From 70d1cbafe4ab0176cd9fc01f740e34cd1bae326b Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 13 Nov 2019 20:29:50 +0100 Subject: [PATCH 001/655] [gentls_cert] Update message digest Debian Buster updated /etc/ssl/openssl.cnf to default to MinProtocol = TLSv1.2 CipherString = DEFAULT@SECLEVEL=2 gentls_cert currently uses SHA1 as message digest. According to OpenSSL documentation this only offers 80 bit of security. 80 bits is enough for security level 1, but not 2. The OpenSSL default MD nowadays is SHA256. This commit updates gentls_cert to use it. Issue was reported on the FS mailing list. The certificates created by gentls_cert caused "md too weak" errors and clients were unable to connect. Signed-off-by: Sebastian Kemper --- scripts/gentls_cert.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/gentls_cert.in b/scripts/gentls_cert.in index 43aa8ac605..dd56c9f6dc 100644 --- a/scripts/gentls_cert.in +++ b/scripts/gentls_cert.in @@ -89,7 +89,7 @@ setup_ca() { openssl req -out "${CONFDIR}/CA/cacert.pem" \ -new -x509 -keyout "${CONFDIR}/CA/cakey.pem" \ - -config "${TMPFILE}.cfg" -nodes -days ${DAYS} -sha1 >/dev/null || exit 1 + -config "${TMPFILE}.cfg" -nodes -days ${DAYS} -sha256 >/dev/null || exit 1 cat "${CONFDIR}/CA/cacert.pem" > "${CONFDIR}/cafile.pem" cp $TMPFILE.cfg /tmp/ssl.cfg rm "${TMPFILE}.cfg" @@ -131,11 +131,11 @@ generate_cert() { openssl req -new -out "${TMPFILE}.req" \ -newkey rsa:${KEY_SIZE} -keyout "${TMPFILE}.key" \ - -config "${TMPFILE}.cfg" -nodes -sha1 >/dev/null || exit 1 + -config "${TMPFILE}.cfg" -nodes -sha256 >/dev/null || exit 1 openssl x509 -req -CAkey "${CONFDIR}/CA/cakey.pem" -CA "${CONFDIR}/CA/cacert.pem" -CAcreateserial \ -in "${TMPFILE}.req" -out "${TMPFILE}.crt" -extfile "${TMPFILE}.cfg" \ - -extensions "${EXTENSIONS}" -days ${DAYS} -sha1 >/dev/null || exit 1 + -extensions "${EXTENSIONS}" -days ${DAYS} -sha256 >/dev/null || exit 1 cat "${TMPFILE}.crt" "${TMPFILE}.key" > "${CONFDIR}/${OUTFILE}" From dbea1482e754afb569d804d72e13946dc66eb0a5 Mon Sep 17 00:00:00 2001 From: Andrew Topp Date: Sun, 15 Mar 2020 14:05:53 +1000 Subject: [PATCH 002/655] [mod_xml_curl] Allow XML_CURL_MAX_BYTES to be configured at runtime per-binding * Added "response-max-bytes" config param for mod_xml_curl * XML_CURL_MAX_BYTES still used as default if param omitted * Added example configuration to module example config. --- .../conf/autoload_configs/xml_curl.conf.xml | 4 ++++ src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mod/xml_int/mod_xml_curl/conf/autoload_configs/xml_curl.conf.xml b/src/mod/xml_int/mod_xml_curl/conf/autoload_configs/xml_curl.conf.xml index 30951d83c8..8efee1f9f8 100644 --- a/src/mod/xml_int/mod_xml_curl/conf/autoload_configs/xml_curl.conf.xml +++ b/src/mod/xml_int/mod_xml_curl/conf/autoload_configs/xml_curl.conf.xml @@ -44,6 +44,10 @@ + + + diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index dab29a550f..5a2e201a72 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -59,6 +59,7 @@ struct xml_binding { int use_dynamic_url; long auth_scheme; int timeout; + switch_size_t curl_max_bytes; }; static int keep_files_around = 0; @@ -218,7 +219,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con memset(&config_data, 0, sizeof(config_data)); config_data.name = filename; - config_data.max_bytes = XML_CURL_MAX_BYTES; + config_data.max_bytes = binding->curl_max_bytes; if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { if (!zstr(binding->cred)) { @@ -364,6 +365,7 @@ static switch_status_t do_config(void) char *method = NULL; int disable100continue = 1; int use_dynamic_url = 0, timeout = 0; + switch_size_t curl_max_bytes = XML_CURL_MAX_BYTES; uint32_t enable_cacert_check = 0; char *ssl_cert_file = NULL; char *ssl_key_file = NULL; @@ -452,6 +454,13 @@ static switch_status_t do_config(void) } } else if (!strcasecmp(var, "bind-local")) { bind_local = val; + } else if (!strcasecmp(var, "response-max-bytes")) { + int tmp = atoi(val); + if (tmp >= 0) { + curl_max_bytes = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set a negative maximum response bytes!\n"); + } } } @@ -540,6 +549,8 @@ static switch_status_t do_config(void) } + binding->curl_max_bytes = curl_max_bytes; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n", zstr(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all"); switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->bindings), binding); From 0b9c7c678b395b45976c336f8b5d154903bf1f8b Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 10 Jun 2020 12:17:27 +0000 Subject: [PATCH 003/655] [mod_amrwb] add cfg setting to switch between OA/BE when originating --- src/mod/codecs/mod_amrwb/mod_amrwb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_amrwb/mod_amrwb.c b/src/mod/codecs/mod_amrwb/mod_amrwb.c index 19cde02adf..4f12c27f0b 100644 --- a/src/mod/codecs/mod_amrwb/mod_amrwb.c +++ b/src/mod/codecs/mod_amrwb/mod_amrwb.c @@ -87,6 +87,7 @@ static struct { switch_byte_t default_bitrate; switch_byte_t volte; switch_byte_t adjust_bitrate; + switch_byte_t force_oa; /*force OA when originating*/ int debug; } globals; @@ -209,7 +210,11 @@ static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_fla context->enc_mode = globals.default_bitrate; /* octet-align = 0 - per RFC - if there's no `octet-align` FMTP value then BE is employed */ - switch_clear_flag(context, AMRWB_OPT_OCTET_ALIGN); + if (!globals.force_oa) { + switch_clear_flag(context, AMRWB_OPT_OCTET_ALIGN); + } else { + switch_set_flag(context, AMRWB_OPT_OCTET_ALIGN); + } if (codec->fmtp_in) { argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0]))); @@ -548,6 +553,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amrwb_load) if (!strcasecmp(var, "adjust-bitrate")) { globals.adjust_bitrate = (switch_byte_t) atoi(val); } + if (!strcasecmp(var, "force-oa")) { + globals.force_oa = (switch_byte_t) atoi(val); + } } } } From 97676a9b50f5af53b596e00c0bf1df4519bb6cb6 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 8 Jul 2018 14:30:37 +0800 Subject: [PATCH 004/655] [mod_sms] add final chat function --- src/mod/applications/mod_sms/mod_sms.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mod/applications/mod_sms/mod_sms.c b/src/mod/applications/mod_sms/mod_sms.c index 3bdcf3f4b8..68ad7d7ccc 100644 --- a/src/mod/applications/mod_sms/mod_sms.c +++ b/src/mod/applications/mod_sms/mod_sms.c @@ -514,6 +514,13 @@ SWITCH_STANDARD_CHAT_APP(stop_function) return SWITCH_STATUS_FALSE; } +SWITCH_STANDARD_CHAT_APP(final_function) +{ + switch_event_add_header(message, SWITCH_STACK_BOTTOM, "final_delivery", "true"); + switch_set_flag(message, EF_NO_CHAT_EXEC); + return SWITCH_STATUS_FALSE; +} + SWITCH_STANDARD_CHAT_APP(send_function) { const char *dest_proto = data; @@ -627,6 +634,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sms_load) SWITCH_ADD_CHAT_APP(chat_app_interface, "info", "Display Call Info", "Display Call Info", info_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "reply", "reply to a message", "reply to a message", reply_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "stop", "stop execution", "stop execution", stop_function, "", SCAF_NONE); + SWITCH_ADD_CHAT_APP(chat_app_interface, "final", "final delivery", "final delivery", final_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "set", "set a variable", "set a variable", set_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "unset", "unset a variable", "unset a variable", unset_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "send", "send the message as-is", "send the message as-is", send_function, "", SCAF_NONE); From 56478e024884e50fa17d4b35aee77776cc483a84 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Mon, 16 Nov 2020 17:08:19 -0700 Subject: [PATCH 005/655] [core] fix build when undefined APR_INET6 --- src/switch_apr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_apr.c b/src/switch_apr.c index c033d87bc4..91204acba7 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -848,13 +848,16 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, con new_sa->pool = pool; +#if APR_HAVE_IPV6 if (strchr(ip, ':')) { struct sockaddr_in6 sa6 = { 0 }; family = APR_INET6; inet_pton(family, ip, &(sa6.sin6_addr)); memcpy(&new_sa->sa, &sa6, sizeof(struct sockaddr_in6)); - } else { + } else +#endif + { struct sockaddr_in sa4 = { 0 }; family = APR_INET; From 6837661658826ef3b90e3f759f6cac6aa03cdc92 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Mar 2020 03:08:33 +0000 Subject: [PATCH 006/655] [libvpx] add yield to vpx --- libs/libvpx/.update | 2 +- libs/libvpx/vp8/common/threading.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/libvpx/.update b/libs/libvpx/.update index 09e6d8ef57..815a0a77a8 100644 --- a/libs/libvpx/.update +++ b/libs/libvpx/.update @@ -1 +1 @@ -Wed Feb 27 11:26:31 MST 2019 +Thu Mar 19 03:08:11 UTC 2020 diff --git a/libs/libvpx/vp8/common/threading.h b/libs/libvpx/vp8/common/threading.h index 7a637cdff2..f2e5e8c54f 100644 --- a/libs/libvpx/vp8/common/threading.h +++ b/libs/libvpx/vp8/common/threading.h @@ -171,11 +171,11 @@ static inline int sem_destroy(sem_t *sem) { #define sem_wait(sem) (semaphore_wait(*sem)) #define sem_post(sem) semaphore_signal(*sem) #define sem_destroy(sem) semaphore_destroy(mach_task_self(), *sem) -#define thread_sleep(nms) { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} +#define thread_sleep(nms) { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;sched_yield();nanosleep(&ts, NULL);} #else #include #include -#define thread_sleep(nms) {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} +#define thread_sleep(nms) {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;sched_yield();clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);} #endif /* Not Windows. Assume pthreads */ From d2959010c1ddb5ebd35163eb006221fa2e91f4ba Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 9 Dec 2020 13:56:22 +0000 Subject: [PATCH 007/655] [mod_amrwb] show the session in debug logs. --- src/mod/codecs/mod_amrwb/mod_amrwb.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/mod/codecs/mod_amrwb/mod_amrwb.c b/src/mod/codecs/mod_amrwb/mod_amrwb.c index 19cde02adf..ab49949755 100644 --- a/src/mod/codecs/mod_amrwb/mod_amrwb.c +++ b/src/mod/codecs/mod_amrwb/mod_amrwb.c @@ -127,7 +127,7 @@ static switch_bool_t switch_amrwb_pack_oa(unsigned char *shift_buf, int n) return SWITCH_TRUE; } -static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) +static switch_bool_t switch_amrwb_info(switch_codec_t *codec, unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) { uint8_t *tocs; int framesz, index, not_last_frame, q, ft; @@ -144,7 +144,7 @@ static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_d tocs = encoded_buf; index = (tocs[0] >> 3) & 0x0f; if (index > SWITCH_AMRWB_MODES) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMRWB decoder (OA): Invalid TOC 0x%x\n", index); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_ERROR, "AMRWB decoder (OA): Invalid TOC 0x%x\n", index); return SWITCH_FALSE; } framesz = switch_amrwb_frame_sizes[index]; @@ -163,16 +163,18 @@ static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_d ft &= ~(1 << 5); /* Frame Type */ index = (shift_tocs[0] >> 3) & 0x0f; if (index > SWITCH_AMRWB_MODES) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMRWB decoder (BE): Invalid TOC 0x%x\n", index); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_ERROR, "AMRWB decoder (BE): Invalid TOC 0x%x\n", index); return SWITCH_FALSE; } framesz = switch_amrwb_frame_sizes[index]; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", - print_text, payload_format ? "OA":"BE", ft, q, not_last_frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMRWB encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", - print_text, payload_format ? "OA":"BE", framesz, encoded_data_len); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_DEBUG, + "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", + print_text, payload_format ? "OA":"BE", ft, q, not_last_frame); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_DEBUG, + "%s (%s): AMRWB encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", + print_text, payload_format ? "OA":"BE", framesz, encoded_data_len); return SWITCH_TRUE; } @@ -359,7 +361,7 @@ static switch_status_t switch_amrwb_encode(switch_codec_t *codec, } if (globals.debug) { - switch_amrwb_info(shift_buf, *encoded_data_len, switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, "AMRWB encoder"); + switch_amrwb_info(codec, shift_buf, *encoded_data_len, switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, "AMRWB encoder"); } return SWITCH_STATUS_SUCCESS; @@ -387,7 +389,7 @@ static switch_status_t switch_amrwb_decode(switch_codec_t *codec, } if (globals.debug) { - switch_amrwb_info(buf, encoded_data_len, switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, "AMRWB decoder"); + switch_amrwb_info(codec, buf, encoded_data_len, switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, "AMRWB decoder"); } if (switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN)) { From 7078e0bfcf1a7729d1d97fa57afcd027e91d2c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Rossi?= Date: Thu, 11 Feb 2021 15:53:08 -0300 Subject: [PATCH 008/655] [core] Exclude RFC-6598 CGNAT private space from wan.auto acl --- src/switch_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core.c b/src/switch_core.c index 7b7f8fe9d8..2a27b57ea3 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1485,6 +1485,7 @@ SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload) switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_FALSE); switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_FALSE); switch_network_list_add_cidr(rfc_list, "169.254.0.0/16", SWITCH_FALSE); + switch_network_list_add_cidr(rfc_list, "100.64.0.0/10", SWITCH_FALSE); switch_network_list_add_cidr(rfc_list, "fe80::/10", SWITCH_FALSE); switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list); @@ -1504,6 +1505,7 @@ SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload) switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_FALSE); switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_FALSE); switch_network_list_add_cidr(rfc_list, "169.254.0.0/16", SWITCH_FALSE); + switch_network_list_add_cidr(rfc_list, "100.64.0.0/10", SWITCH_FALSE); switch_network_list_add_cidr(rfc_list, "::/0", SWITCH_FALSE); switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list); From f5388e444c94fed707acef983555bfe6ddd069da Mon Sep 17 00:00:00 2001 From: Taner Mansur Date: Sat, 13 Feb 2021 19:32:43 +0300 Subject: [PATCH 009/655] [mod_http_cache] Generic HTTP API Authorization header support (#1048) [mod_http_cache] Generic HTTP API Authorization header support --- src/mod/applications/mod_http_cache/common.h | 4 +- .../mod_http_cache/mod_http_cache.c | 55 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_http_cache/common.h b/src/mod/applications/mod_http_cache/common.h index 9092f2a13b..f2406983c5 100644 --- a/src/mod/applications/mod_http_cache/common.h +++ b/src/mod/applications/mod_http_cache/common.h @@ -45,7 +45,9 @@ struct http_profile { char *region; // AWS region. Used by AWS S3 switch_time_t expires; // Expiration time in seconds for URL signature. Default is 604800 seconds. Used by AWS S3 switch_size_t bytes_per_block; - + int header_count; + char** header_names; + char** header_values; // function to be called to add the profile specific headers to the GET/PUT requests switch_curl_slist_t *(*append_headers_ptr)(struct http_profile *profile, switch_curl_slist_t *headers, const char *verb, unsigned int content_length, const char *content_type, const char *url, const unsigned int block_num, char **query_string); 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 d8ea87578e..dcf1d7bff5 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -1532,6 +1532,51 @@ static void *SWITCH_THREAD_FUNC prefetch_thread(switch_thread_t *thread, void *o return NULL; } +static switch_curl_slist_t *default_append_headers(http_profile_t *profile, switch_curl_slist_t *headers, + const char *verb, unsigned int content_length, const char *content_type, const char *url, const unsigned int block_num, char **query_string) +{ + char header[1024]; + int i; + + for (i = 0; i < profile->header_count; i++) { + switch_snprintf(header, sizeof(header), "%s: %s", profile->header_names[i], profile->header_values[i]); + + headers = switch_curl_slist_append(headers, header); + } + + return headers; +} + +static switch_status_t default_config_profile(switch_xml_t xml, http_profile_t *profile, switch_memory_pool_t *pool) +{ + int i, header_count = 0; + switch_xml_t header; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Configuring default profile\n"); + + for (header = switch_xml_child(xml, "header"); header; header = header->next) { + header_count++; + } + + profile->header_count = header_count; + profile->header_names = switch_core_alloc(pool, sizeof(char*) * header_count); + profile->header_values = switch_core_alloc(pool, sizeof(char*) * header_count); + + for (i = 0, header = switch_xml_child(xml, "header"); header; i++, header = header->next) { + char *header_name = (char *) switch_xml_attr_soft(header, "name"); + char *header_value = (char *) switch_xml_txt(header); + + profile->header_names[i] = switch_core_strdup(pool, header_name); + profile->header_values[i] = switch_core_strdup(pool, header_value); + } + + profile->append_headers_ptr = default_append_headers; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Configured default profile\n"); + + return SWITCH_STATUS_SUCCESS; +} + /** * Configure the module * @param cache to configure @@ -1632,6 +1677,9 @@ static switch_status_t do_config(url_cache_t *cache) profile_obj->secret_access_key = NULL; profile_obj->base_domain = NULL; profile_obj->bytes_per_block = 0; + profile_obj->header_count = 0; + profile_obj->header_names = NULL; + profile_obj->header_values = NULL; profile_obj->append_headers_ptr = NULL; profile_obj->finalise_put_ptr = NULL; @@ -1646,6 +1694,13 @@ static switch_status_t do_config(url_cache_t *cache) if (azure_blob_config_profile(profile_xml, profile_obj) == SWITCH_STATUS_FALSE) { continue; } + } else { + profile_xml = switch_xml_child(profile, "default"); + if (profile_xml) { + if (default_config_profile(profile_xml, profile_obj, cache->pool) == SWITCH_STATUS_FALSE) { + continue; + } + } } } From d27cd90155a69186a27fcbb59131e18ce52c20bb Mon Sep 17 00:00:00 2001 From: figaro2015 Date: Sat, 13 Feb 2021 08:37:01 -0800 Subject: [PATCH 010/655] Verification of the wss.pem certificate in mod_sofia application code. Display correct reason why sofia profile failed to create (#1067) [mod_sofia] Verification of the wss.pem certificate in mod_sofia application code. Display correct reason why sofia profile failed to create. --- src/mod/endpoints/mod_sofia/sofia.c | 62 ++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d439b7f72f..7d8b2fe6eb 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -40,7 +40,7 @@ * */ #include "mod_sofia.h" - +#include extern su_log_t tport_log[]; extern su_log_t iptsec_log[]; @@ -3149,6 +3149,16 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void switch_status_t st; char qname [128] = ""; +#if defined(HAVE_OPENSSL) + char *key = switch_core_sprintf(profile->pool, "%s/%s", profile->tls_cert_dir, "wss.pem"); + char *cert = switch_core_sprintf(profile->pool, "%s/%s", profile->tls_cert_dir, "wss.pem"); + char *chain = switch_core_sprintf(profile->pool, "%s/%s", profile->tls_cert_dir, "wss.pem"); + SSL_CTX *ssl_ctx; + const SSL_METHOD *ssl_method = SSLv23_server_method(); +#endif + + switch_bool_t ssl_error = SWITCH_FALSE; + switch_mutex_lock(mod_sofia_globals.mutex); mod_sofia_globals.threads++; switch_mutex_unlock(mod_sofia_globals.mutex); @@ -3185,6 +3195,42 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void profile->tls_verify_in_subjects = su_strlst_dup_split((su_home_t *)profile->nua, profile->tls_verify_in_subjects_str, "|"); } +#if defined(HAVE_OPENSSL) + ssl_ctx = SSL_CTX_new((SSL_METHOD *)ssl_method); + switch_assert(ssl_ctx); + + /* Disable SSLv2 */ + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2); + /* Disable SSLv3 */ + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv3); + /* Disable TLSv1 */ + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1); + /* Disable Compression CRIME (Compression Ratio Info-leak Made Easy) */ + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_COMPRESSION); + + if (!SSL_CTX_use_certificate_chain_file(ssl_ctx, chain)) { + ssl_error = SWITCH_TRUE; + } + + if (!ssl_error && !SSL_CTX_use_certificate_file(ssl_ctx, cert, SSL_FILETYPE_PEM)) { + ssl_error = SWITCH_TRUE; + } + + if (!ssl_error && !SSL_CTX_use_PrivateKey_file(ssl_ctx, key, SSL_FILETYPE_PEM)) { + ssl_error = SWITCH_TRUE; + } + + if (!ssl_error && !SSL_CTX_check_private_key(ssl_ctx)) { + ssl_error = SWITCH_TRUE; + } + + if (ssl_error) { + attempts = profile->bind_attempts; + } + + SSL_CTX_free(ssl_ctx); +#endif + do { profile->nua = nua_create(profile->s_root, /* Event loop */ sofia_event_callback, /* Callback for processing events */ @@ -3256,7 +3302,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TPTAG_REUSE(0)), TAG_END()); /* Last tag should always finish the sequence */ - if (!profile->nua) { + if (!ssl_error && !profile->nua) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s (%s) ATTEMPT %d (RETRY IN %d SEC)\n", profile->name, profile->bindurl, attempts + 1, profile->bind_attempt_interval); if (attempts < profile->bind_attempts) { @@ -3267,9 +3313,15 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } while (!profile->nua && attempts++ < profile->bind_attempts); if (!profile->nua) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s (%s)\n" - "The likely causes for this are:\n" "1) Another application is already listening on the specified address.\n" - "2) The IP the profile is attempting to bind to is not local to this system.\n", profile->name, profile->bindurl); + if (!ssl_error) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s (%s)\n" + "The likely causes for this are:\n" "1) Another application is already listening on the specified address.\n" + "2) The IP the profile is attempting to bind to is not local to this system.\n", profile->name, profile->bindurl); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Error Creating SIP UA for profile: %s (%s). Bad WSS.PEM certificate.\n", profile->name, profile->bindurl); + } + sofia_profile_start_failure(profile, profile->name); sofia_glue_del_profile(profile); goto end; From 7942cb93637253c666a610d25a53ddb7f9091f37 Mon Sep 17 00:00:00 2001 From: voipke Date: Tue, 3 Nov 2020 08:32:58 +0800 Subject: [PATCH 011/655] [mod_unimrcp] Allow prosody-rate to be negative --- src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 990875b784..a89329f4b5 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -1312,7 +1312,7 @@ static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int break; case SYNTHESIZER_HEADER_PROSODY_RATE: - if (switch_isdigit(*val) || *val == '.') { + 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)) { From a6a5784871b46c13556465e0c8e1072efd8bbc14 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 14 Feb 2021 01:34:54 +0800 Subject: [PATCH 012/655] [mod_callcenter] fix leak (#1050) [mod_callcenter] Fix small leak in cc-instance-id configuration parameter. --- .../applications/mod_callcenter/mod_callcenter.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index f59b744098..58816ea0ac 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2016, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -426,7 +426,7 @@ static struct { int debug; char *odbc_dsn; char *dbname; - char *cc_instance_id; + const char *cc_instance_id; switch_bool_t reserve_agents; switch_bool_t truncate_tiers; switch_bool_t truncate_agents; @@ -1501,7 +1501,7 @@ static int sqlite_column_rename_callback(void *pArg, const char *errmsg) return 0; } -static switch_status_t load_config(void) +static switch_status_t load_config(switch_memory_pool_t *pool) { switch_status_t status = SWITCH_STATUS_SUCCESS; switch_xml_t cfg, xml, settings, param, x_queues, x_queue, x_agents, x_agent, x_tiers; @@ -1536,7 +1536,7 @@ static switch_status_t load_config(void) } else if (!strcasecmp(var, "global-database-lock")) { globals.global_database_lock = switch_true(val); } else if (!strcasecmp(var, "cc-instance-id")) { - globals.cc_instance_id = strdup(val); + globals.cc_instance_id = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "agent-originate-timeout")) { globals.agent_originate_timeout = atoi(val); } @@ -1546,7 +1546,7 @@ static switch_status_t load_config(void) globals.dbname = strdup(CC_SQLITE_DB_NAME); } if (zstr(globals.cc_instance_id)) { - globals.cc_instance_id = strdup("single_box"); + globals.cc_instance_id = switch_core_strdup(pool, "single_box"); } if (!globals.reserve_agents) { globals.reserve_agents = SWITCH_FALSE; @@ -4227,7 +4227,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_core_hash_init(&globals.queue_hash); switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); - if ((status = load_config()) != SWITCH_STATUS_SUCCESS) { + if ((status = load_config(pool)) != SWITCH_STATUS_SUCCESS) { switch_event_unbind(&globals.node); switch_event_free_subclass(CALLCENTER_EVENT); switch_core_hash_destroy(&globals.queue_hash); @@ -4341,7 +4341,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown) switch_safe_free(globals.odbc_dsn); switch_safe_free(globals.dbname); - switch_safe_free(globals.cc_instance_id); switch_mutex_unlock(globals.mutex); return SWITCH_STATUS_SUCCESS; From 3556119fde5499e951008a2c9aa5d4719e633e38 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 20 Jan 2021 20:49:05 +0300 Subject: [PATCH 013/655] [libesl] Fix leak of esl_event_header_t in esl_event_base_add_header(). Code cleanup. --- libs/esl/src/esl_event.c | 79 ++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index fa51194853..68e0688114 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -54,6 +54,8 @@ static char *my_dup(const char *s) #define FREE(ptr) esl_safe_free(ptr) #endif +static void free_header(esl_event_header_t **header); + /* make sure this is synced with the esl_event_types_t enum in esl_types.h also never put any new ones before EVENT_ALL */ @@ -319,27 +321,8 @@ ESL_DECLARE(esl_status_t) esl_event_del_header_val(esl_event_t *event, const cha if (hp == event->last_header || !hp->next) { event->last_header = lp; } - FREE(hp->name); - if (hp->idx) { - int i = 0; - - for (i = 0; i < hp->idx; i++) { - FREE(hp->array[i]); - } - FREE(hp->array); - } - - FREE(hp->value); - - memset(hp, 0, sizeof(*hp)); -#ifdef ESL_EVENT_RECYCLE - if (esl_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, hp) != ESL_SUCCESS) { - FREE(hp); - } -#else - FREE(hp); -#endif + free_header(&hp); status = ESL_SUCCESS; } else { lp = hp; @@ -369,7 +352,34 @@ static esl_event_header_t *new_header(const char *header_name) header->name = DUP(header_name); return header; +} +static void free_header(esl_event_header_t **header) +{ + assert(header); + + if (*header) { + FREE((*header)->name); + + if ((*header)->idx) { + int i = 0; + + for (i = 0; i < (*header)->idx; i++) { + FREE((*header)->array[i]); + } + FREE((*header)->array); + } + + FREE((*header)->value); + +#ifdef ESL_EVENT_RECYCLE + if (esl_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, *header) != ESL_SUCCESS) { + FREE(*header); + } +#else + FREE(*header); +#endif + } } ESL_DECLARE(int) esl_event_add_array(esl_event_t *event, const char *var, const char *val) @@ -437,10 +447,11 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st } if (index_ptr || (stack & ESL_STACK_PUSH) || (stack & ESL_STACK_UNSHIFT)) { + esl_event_header_t *tmp_header = NULL; if (!(header = esl_event_get_header_ptr(event, header_name)) && index_ptr) { - header = new_header(header_name); + tmp_header = header = new_header(header_name); if (esl_test_flag(event, ESL_EF_UNIQ_HEADERS)) { esl_event_del_header(event, header_name); @@ -474,6 +485,8 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st goto redraw; } + } else if (tmp_header) { + free_header(&tmp_header); } goto end; } else { @@ -675,29 +688,7 @@ ESL_DECLARE(void) esl_event_destroy(esl_event_t **event) for (hp = ep->headers; hp;) { this = hp; hp = hp->next; - FREE(this->name); - - if (this->idx) { - int i = 0; - - for (i = 0; i < this->idx; i++) { - FREE(this->array[i]); - } - FREE(this->array); - } - - FREE(this->value); - - -#ifdef ESL_EVENT_RECYCLE - if (esl_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, this) != ESL_SUCCESS) { - FREE(this); - } -#else - FREE(this); -#endif - - + free_header(&this); } FREE(ep->body); FREE(ep->subclass_name); From 91f12b592020a8bf8f57f8a8518640c558e98fe2 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Tue, 23 Feb 2021 19:59:26 +0200 Subject: [PATCH 014/655] [Unit-tests] Fix previously defined AM_* in tests. --- src/include/test/switch_test.h | 3 ++- tests/unit/Makefile.am | 7 +++---- tests/unit/switch_console.c | 6 ++---- tests/unit/switch_core_db.c | 4 ++-- tests/unit/switch_core_video.c | 2 +- tests/unit/switch_event.c | 5 +---- tests/unit/switch_hash.c | 6 +----- tests/unit/switch_ivr_originate.c | 28 ++++++---------------------- tests/unit/switch_rtp.c | 3 ++- tests/unit/switch_utils.c | 4 ++-- tests/unit/switch_vad.c | 3 ++- tests/unit/switch_vpx.c | 13 ++++++------- 12 files changed, 30 insertions(+), 54 deletions(-) diff --git a/src/include/test/switch_test.h b/src/include/test/switch_test.h index 561bf7a4fb..eb6f7f3ee6 100644 --- a/src/include/test/switch_test.h +++ b/src/include/test/switch_test.h @@ -811,11 +811,12 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char */ #define fst_sched_recv_dtmf(when, digits) \ { \ + switch_status_t api_result; \ switch_stream_handle_t stream = { 0 }; \ SWITCH_STANDARD_STREAM(stream); \ fst_requires(fst_core > 1); \ fst_requires_module("mod_commands"); \ - switch_status_t api_result = switch_api_execute("sched_api", switch_core_session_sprintf(fst_session, "%s none uuid_recv_dtmf %s %s", when, switch_core_session_get_uuid(fst_session), digits), NULL, &stream); \ + api_result = switch_api_execute("sched_api", switch_core_session_sprintf(fst_session, "%s none uuid_recv_dtmf %s %s", when, switch_core_session_get_uuid(fst_session), digits), NULL, &stream); \ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_INFO, "Injecting DTMF %s at %s\n", digits, when); \ fst_requires(api_result == SWITCH_STATUS_SUCCESS); \ switch_safe_free(stream.data); \ diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 214ec467b1..6e7e128d62 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -2,11 +2,10 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ switch_ivr_play_say switch_core_codec switch_rtp switch_xml -noinst_PROGRAMS+= switch_core_video switch_core_db switch_vad switch_core_asr -AM_LDFLAGS = -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS) +noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_core_asr + +AM_LDFLAGS += -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS) AM_LDFLAGS += $(FREESWITCH_LIBS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) -AM_CFLAGS = $(SWITCH_AM_CPPFLAGS) -AM_CPPFLAGS = $(SWITCH_AM_CPPFLAGS) if HAVE_FVAD AM_CFLAGS += -DSWITCH_HAVE_FVAD diff --git a/tests/unit/switch_console.c b/tests/unit/switch_console.c index 49a2568e71..8e470b56fd 100644 --- a/tests/unit/switch_console.c +++ b/tests/unit/switch_console.c @@ -29,7 +29,6 @@ * */ -#include #include #include @@ -49,11 +48,10 @@ FST_TEARDOWN_END() FST_TEST_BEGIN(benchmark) { - switch_stream_handle_t stream = { 0 }; - SWITCH_STANDARD_STREAM(stream); - char expected_result[] = {'A', 0x00, 0x01, 0x02, 'B'}; char raw_data[] = {0x00, 0x01, 0x02}; + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); stream.write_function(&stream, "%s", "A"); stream.raw_write_function(&stream, (uint8_t *) raw_data, sizeof(raw_data)); diff --git a/tests/unit/switch_core_db.c b/tests/unit/switch_core_db.c index 5ebf41c8ab..f688b3ff2e 100644 --- a/tests/unit/switch_core_db.c +++ b/tests/unit/switch_core_db.c @@ -70,10 +70,10 @@ FST_CORE_DB_BEGIN("./conf") if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) == SWITCH_STATUS_SUCCESS) { switch_cache_db_execute_sql2str(dbh, "SELECT 1", (char *)&res1, 20, NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT 1: %s\n", switch_str_nil(res1)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT 1: %s\n", res1); switch_cache_db_execute_sql2str(dbh, "SELECT NULL", (char *)&res2, 20, NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT NULL: %s\n", switch_str_nil(res2)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT NULL: %s\n", res2); } diff --git a/tests/unit/switch_core_video.c b/tests/unit/switch_core_video.c index cdd03cbac1..bd963a4d03 100644 --- a/tests/unit/switch_core_video.c +++ b/tests/unit/switch_core_video.c @@ -50,13 +50,13 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(data_url_test) { + char *data_url = NULL; switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1); switch_image_t *argb_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, 120, 60, 1); switch_rgb_color_t color = { 0 }; color.r = 255; // color.g = 255; // color.b = 255; - char *data_url = NULL; switch_img_fill(img, 0, 0, img->d_w, img->d_h, &color); switch_img_add_text(img->planes[0], img->d_w, 10, 10, "-1234567890"); diff --git a/tests/unit/switch_event.c b/tests/unit/switch_event.c index 69410cec48..bf8c3f43d2 100644 --- a/tests/unit/switch_event.c +++ b/tests/unit/switch_event.c @@ -1,4 +1,3 @@ -#include #include #include @@ -21,10 +20,8 @@ FST_TEARDOWN_END() FST_TEST_BEGIN(benchmark) { switch_event_t *event = NULL; - switch_bool_t verbose = SWITCH_TRUE; - const char *err = NULL; switch_time_t start_ts, end_ts; - int rc = 0, loops = 10, x = 0; + int loops = 10, x = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; char **index = NULL; uint64_t micro_total = 0; diff --git a/tests/unit/switch_hash.c b/tests/unit/switch_hash.c index e0de407917..5c647bde62 100644 --- a/tests/unit/switch_hash.c +++ b/tests/unit/switch_hash.c @@ -1,4 +1,3 @@ -#include #include #include @@ -20,9 +19,6 @@ FST_TEARDOWN_END() FST_TEST_BEGIN(benchmark) { - switch_event_t *event = NULL; - switch_bool_t verbose = SWITCH_TRUE; - const char *err = NULL; switch_time_t start_ts, end_ts; uint64_t micro_total = 0; double micro_per = 0; @@ -33,7 +29,7 @@ FST_TEST_BEGIN(benchmark) switch_time_t small_start_ts, small_end_ts; #endif - int rc = 0, loops = 10; + int loops = 10; switch_status_t status = SWITCH_STATUS_SUCCESS; char **index = NULL; switch_hash_t *hash = NULL; diff --git a/tests/unit/switch_ivr_originate.c b/tests/unit/switch_ivr_originate.c index 49174f3b33..9369506b13 100644 --- a/tests/unit/switch_ivr_originate.c +++ b/tests/unit/switch_ivr_originate.c @@ -212,7 +212,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_empty_dial_string) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -235,7 +234,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_one_leg) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -261,7 +259,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_no_pre_answer) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -291,7 +288,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_exec_in_pre_answer) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -322,7 +318,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_exec_after_answer_early_ok) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -354,7 +349,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_exec_after_answer_ignore_early_media) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -385,8 +379,8 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_2_legs) { + const char *name; switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -407,7 +401,7 @@ FST_CORE_BEGIN("./conf") status = switch_ivr_originate(NULL, &session, &cause, NULL, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, dh); fst_requires(status == SWITCH_STATUS_SUCCESS); fst_requires(session); - const char *name = switch_core_session_get_name(session); + name = switch_core_session_get_name(session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "channel %s\n", name); fst_check_string_equals(name, "null/test2"); switch_core_session_rwunlock(session); @@ -418,8 +412,8 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_global_var) { + const char *name; switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; const char *dialstring = "{group_confirm_file='playback silence_stream://1000',group_confirm_key=exec}null/test"; @@ -427,7 +421,7 @@ FST_CORE_BEGIN("./conf") status = switch_ivr_originate(NULL, &session, &cause, dialstring, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_requires(status == SWITCH_STATUS_SUCCESS); fst_requires(session); - const char *name = switch_core_session_get_name(session); + name = switch_core_session_get_name(session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "channel %s\n", name); fst_check_string_equals(name, "null/test"); switch_core_session_rwunlock(session); @@ -436,8 +430,8 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_local_var) { + const char *name; switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; const char *dialstring = "[group_confirm_file='playback silence_stream://1000',group_confirm_key=exec]null/test1," @@ -446,7 +440,7 @@ FST_CORE_BEGIN("./conf") status = switch_ivr_originate(NULL, &session, &cause, dialstring, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_requires(status == SWITCH_STATUS_SUCCESS); fst_requires(session); - const char *name = switch_core_session_get_name(session); + name = switch_core_session_get_name(session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "channel %s\n", name); fst_check_string_equals(name, "null/test2"); switch_core_session_rwunlock(session); @@ -456,7 +450,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_loopback_endpoint_originate) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; const char *dialstring = "[group_confirm_key=exec,group_confirm_file='event a=1']loopback/loopback"; @@ -475,10 +468,6 @@ FST_CORE_BEGIN("./conf") FST_SESSION_BEGIN(originate_test_group_confirm_loopback_endpoint_bridge) { - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - switch_status_t status; - switch_call_cause_t cause; const char *dialstring = "[group_confirm_key=exec,group_confirm_file='event a=1']loopback/loopback"; switch_event_bind("test", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, loopback_group_confirm_event_handler, NULL); @@ -493,7 +482,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_leg_timeout_not_finished) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -521,7 +509,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_leg_timeout_finished) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -552,7 +539,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_timeout_leg) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -581,7 +567,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_timeout_global) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; @@ -610,7 +595,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(originate_test_group_confirm_cancel_timeout_global) { switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; switch_status_t status; switch_call_cause_t cause; switch_dial_handle_t *dh; diff --git a/tests/unit/switch_rtp.c b/tests/unit/switch_rtp.c index 5459775393..d411fe20fc 100644 --- a/tests/unit/switch_rtp.c +++ b/tests/unit/switch_rtp.c @@ -32,6 +32,7 @@ FST_TEARDOWN_BEGIN() FST_TEARDOWN_END() FST_TEST_BEGIN(test_rtp) { + switch_rtp_stats_t *stats; switch_core_new_memory_pool(&pool); rtp_session = switch_rtp_new(rx_host, rx_port, tx_host, tx_port, TEST_PT, 8000, 20 * 1000, flags, "soft", &err, pool, 0, 0); @@ -44,7 +45,7 @@ FST_TEARDOWN_END() switch_rtp_set_ssrc(rtp_session, 0xabcd); switch_rtp_set_remote_ssrc(rtp_session, 0xcdef); fst_xcheck(switch_rtp_get_ssrc(rtp_session) == 0xabcd, "get SSRC"); - switch_rtp_stats_t *stats = switch_rtp_get_stats(rtp_session, pool); + stats = switch_rtp_get_stats(rtp_session, pool); fst_requires(stats); switch_rtp_destroy(&rtp_session); diff --git a/tests/unit/switch_utils.c b/tests/unit/switch_utils.c index 7b7fa3729a..1fc291ea96 100644 --- a/tests/unit/switch_utils.c +++ b/tests/unit/switch_utils.c @@ -29,7 +29,6 @@ * */ -#include #include #include @@ -65,6 +64,7 @@ FST_TEST_END() FST_TEST_BEGIN(b64) { + switch_size_t size; char *str = "ABC"; unsigned char b64_str[6]; char decoded_str[4]; @@ -73,7 +73,7 @@ FST_TEST_BEGIN(b64) fst_check(status == SWITCH_STATUS_SUCCESS); fst_check_string_equals((const char *)b64_str, "QUJD"); - switch_size_t size = switch_b64_decode((const char *)b64_str, decoded_str, sizeof(decoded_str)); + size = switch_b64_decode((const char *)b64_str, decoded_str, sizeof(decoded_str)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "decoded_str: %s\n", decoded_str); fst_check_string_equals(decoded_str, str); fst_check(size == 4); diff --git a/tests/unit/switch_vad.c b/tests/unit/switch_vad.c index 9b97d8bd18..8b0f85bb1f 100644 --- a/tests/unit/switch_vad.c +++ b/tests/unit/switch_vad.c @@ -148,6 +148,7 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(energy) { + int res; int16_t *buf = malloc(sizeof(int16_t) * 160); int duration; float pos = 0.0; @@ -156,7 +157,7 @@ FST_CORE_BEGIN("./conf") switch_vad_t *vad = switch_vad_init(8000, 1); fst_requires(vad); - int res = switch_vad_set_mode(vad, -1); + res = switch_vad_set_mode(vad, -1); fst_requires(res == 0); switch_vad_set_param(vad, "silence_ms", 400); switch_vad_set_param(vad, "voice_ms", 80); diff --git a/tests/unit/switch_vpx.c b/tests/unit/switch_vpx.c index d97d09f186..0c42fd8665 100644 --- a/tests/unit/switch_vpx.c +++ b/tests/unit/switch_vpx.c @@ -21,9 +21,14 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(vp8_test) { + switch_image_t *img; + uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12]; switch_status_t status; switch_codec_t codec = { 0 }; + switch_frame_t frame = { 0 }; switch_codec_settings_t codec_settings = {{ 0 }}; + int packets = 0; + switch_status_t encode_status; // switch_set_string(codec_settings.video.config_profile_name, "conference"); codec_settings.video.width = 1280; @@ -39,12 +44,9 @@ FST_CORE_BEGIN("./conf") &codec_settings, fst_pool); fst_check(status == SWITCH_STATUS_SUCCESS); - switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1); + img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1); fst_requires(img); - uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12]; - switch_frame_t frame = { 0 }; - frame.packet = buf; frame.packetlen = SWITCH_DEFAULT_VIDEO_SIZE + 12; frame.data = buf + 12; @@ -55,9 +57,6 @@ FST_CORE_BEGIN("./conf") frame.timestamp = 0; frame.img = img; - int packets = 0; - switch_status_t encode_status; - do { frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE; encode_status = switch_core_codec_encode_video(&codec, &frame); From 6609ce9510aaf141c2a98dc634a18be94a0d5965 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 1 May 2020 13:51:52 +0200 Subject: [PATCH 015/655] Fix some typos (most found by codespell) Signed-off-by: Stefan Weil --- .../flex/com/adobe/air/filesystem/FileUtil.as | 2 +- .../com/adobe/air/filesystem/VolumeMonitor.as | 2 +- .../flex/com/adobe/net/DynamicURLLoader.as | 4 +-- clients/flex/com/adobe/net/MimeTypeMap.as | 2 +- clients/flex/com/adobe/net/URI.as | 12 +++---- .../adobe/serialization/json/JSONEncoder.as | 2 +- .../serialization/json/JSONParseError.as | 2 +- clients/flex/com/adobe/utils/DateUtil.as | 10 +++--- clients/flex/com/adobe/utils/StringUtil.as | 6 ++-- clients/flex/jquery-1.4.2.js | 20 +++++------ clients/flex/jquery.tmpl.js | 2 +- .../curl/autoload_configs/conference.conf.xml | 2 +- conf/curl/autoload_configs/xml_cdr.conf.xml | 2 +- .../autoload_configs/conference.conf.xml | 2 +- .../autoload_configs/xml_cdr.conf.xml | 2 +- conf/insideout/dialplan/default.xml | 4 +-- .../rayo/autoload_configs/conference.conf.xml | 2 +- conf/rayo/autoload_configs/spandsp.conf.xml | 2 +- debian/README.source | 2 +- docker/base_image/README.md | 2 +- docker/base_image/docker-entrypoint.sh | 4 +-- docs/Doxygen.conf | 4 +-- docs/phrase/README.TXT | 4 +-- docs/phrase/make_checks.sh | 4 +-- freeswitch.spec | 36 +++++++++---------- fscomm/preferences/prefdialog.ui | 2 +- src/switch_xml_config.c | 2 +- tests/unit/conf/vpx.conf.xml | 2 +- w32/Setup/GitInfo/GitInfo.targets | 2 +- 29 files changed, 72 insertions(+), 72 deletions(-) diff --git a/clients/flex/com/adobe/air/filesystem/FileUtil.as b/clients/flex/com/adobe/air/filesystem/FileUtil.as index 33bf04df79..9a6bbc3dde 100644 --- a/clients/flex/com/adobe/air/filesystem/FileUtil.as +++ b/clients/flex/com/adobe/air/filesystem/FileUtil.as @@ -53,7 +53,7 @@ package com.adobe.air.filesystem } else if(os.indexOf("Linux") > -1) { - //todo: need to impliment Linux + //todo: need to implement Linux } return v; diff --git a/clients/flex/com/adobe/air/filesystem/VolumeMonitor.as b/clients/flex/com/adobe/air/filesystem/VolumeMonitor.as index cbb5ad5ba2..67901a264b 100644 --- a/clients/flex/com/adobe/air/filesystem/VolumeMonitor.as +++ b/clients/flex/com/adobe/air/filesystem/VolumeMonitor.as @@ -110,7 +110,7 @@ package com.adobe.air.filesystem timer.addEventListener(TimerEvent.TIMER, onTimerEvent,false,0, true); } - //we reinitialize the hash everytime we start watching + //we reinitialize the hash every time we start watching volumes = new Dictionary(); var v:Array = FileUtil.getRootDirectories(); diff --git a/clients/flex/com/adobe/net/DynamicURLLoader.as b/clients/flex/com/adobe/net/DynamicURLLoader.as index 2a9eea1c36..a365b2479d 100644 --- a/clients/flex/com/adobe/net/DynamicURLLoader.as +++ b/clients/flex/com/adobe/net/DynamicURLLoader.as @@ -35,9 +35,9 @@ package com.adobe.net import flash.net.URLLoader; /** - * Class that provides a dynamic implimentation of the URLLoader class. + * Class that provides a dynamic implementation of the URLLoader class. * - * This class provides no API implimentations. However, since the class is + * This class provides no API implementations. However, since the class is * declared as dynamic, it can be used in place of URLLoader, and allow * you to dynamically attach properties to it (which URLLoader does not allow). * diff --git a/clients/flex/com/adobe/net/MimeTypeMap.as b/clients/flex/com/adobe/net/MimeTypeMap.as index 63353cab8c..cd9224722f 100644 --- a/clients/flex/com/adobe/net/MimeTypeMap.as +++ b/clients/flex/com/adobe/net/MimeTypeMap.as @@ -169,7 +169,7 @@ package com.adobe.net } /** - * Returns the prefered extension for the given mimetype. + * Returns the preferred extension for the given mimetype. */ public function getExtension(mimetype:String):String { diff --git a/clients/flex/com/adobe/net/URI.as b/clients/flex/com/adobe/net/URI.as index a212cdd7b8..b77896b250 100644 --- a/clients/flex/com/adobe/net/URI.as +++ b/clients/flex/com/adobe/net/URI.as @@ -64,7 +64,7 @@ package com.adobe.net * URI syntax (e.g. custom query syntax or special handling of * non-hierarchical URI's), this class can be fully subclassed. If you * intended to subclass URI, please see the source code for complete - * documation on protected members and protected fuctions.

+ * documentation on protected members and protected functions.

* * @langversion ActionScript 3.0 * @playerversion Flash 9.0 @@ -203,7 +203,7 @@ package com.adobe.net /** - * @private Private initializiation. + * @private Private initialization. */ protected function initialize() : void { @@ -332,7 +332,7 @@ package com.adobe.net * well formed. Sometimes characters that should have been escaped * are not, and those situations would break a regexp pattern. This * function attempts to be smart about what it is parsing based on - * location of characters relative to eachother. This function has + * location of characters relative to each other. This function has * been proven through real-world use to parse the vast majority * of URI's correctly. * @@ -835,7 +835,7 @@ package com.adobe.net * to be properly escaped and unescaped, it must be split into its * component parts. This accessor escapes/unescapes the entire query * part without regard for it's component parts. This has the - * possibliity of leaving the query string in an ambiguious state in + * possibliity of leaving the query string in an ambiguous state in * regards to its syntax. If the contents of the query part are * important, it is recommended that get/setQueryValue() or * get/setQueryByMap() are used instead.

@@ -2340,7 +2340,7 @@ package com.adobe.net *

This function is intended to be a helper function. * It is not all-knowning and will probably make mistakes * when attempting to parse a string of unknown origin. If - * your applicaiton is receiving input from the user, your + * your application is receiving input from the user, your * application should already have a good idea what the user * should be entering, and your application should be * pre-processing the user's input to make sure it is well formed @@ -2354,7 +2354,7 @@ package com.adobe.net * on a URI that was created from unknownToURI() may not match * the input string due to the difference in escaping.

* - * @param unknown a potental URI string that should be parsed + * @param unknown a potential URI string that should be parsed * and loaded into this object. * @param defaultScheme if it is determined that the passed string * looks like a URI, but it is missing the scheme part, this diff --git a/clients/flex/com/adobe/serialization/json/JSONEncoder.as b/clients/flex/com/adobe/serialization/json/JSONEncoder.as index 639df02c2c..1b5311e970 100644 --- a/clients/flex/com/adobe/serialization/json/JSONEncoder.as +++ b/clients/flex/com/adobe/serialization/json/JSONEncoder.as @@ -104,7 +104,7 @@ package com.adobe.serialization.json } /** - * Escapes a string accoding to the JSON specification. + * Escapes a string according to the JSON specification. * * @param str The string to be escaped * @return The string with escaped special characters diff --git a/clients/flex/com/adobe/serialization/json/JSONParseError.as b/clients/flex/com/adobe/serialization/json/JSONParseError.as index 5aec1e3b02..1c25b71da4 100644 --- a/clients/flex/com/adobe/serialization/json/JSONParseError.as +++ b/clients/flex/com/adobe/serialization/json/JSONParseError.as @@ -47,7 +47,7 @@ package com.adobe.serialization.json { /** * Constructs a new JSONParseError. * - * @param message The error message that occured during parsing + * @param message The error message that occurred during parsing * @langversion ActionScript 3.0 * @playerversion Flash 9.0 * @tiptext diff --git a/clients/flex/com/adobe/utils/DateUtil.as b/clients/flex/com/adobe/utils/DateUtil.as index a741df0d76..13d4ee647c 100644 --- a/clients/flex/com/adobe/utils/DateUtil.as +++ b/clients/flex/com/adobe/utils/DateUtil.as @@ -74,7 +74,7 @@ package com.adobe.utils * @param Optional parameter indicating whether the search should be case * sensitive * - * @return A int that represents that month represented by the specifed + * @return A int that represents that month represented by the specified * short name. * * @langversion ActionScript 3.0 @@ -114,7 +114,7 @@ package com.adobe.utils * * @param m A full month name. * - * @return A int that represents that month represented by the specifed + * @return A int that represents that month represented by the specified * full month name. * * @langversion ActionScript 3.0 @@ -154,7 +154,7 @@ package com.adobe.utils * * @param m A short day name. * - * @return A int that represents that short day represented by the specifed + * @return A int that represents that short day represented by the specified * full month name. * * @langversion ActionScript 3.0 @@ -194,7 +194,7 @@ package com.adobe.utils * * @param m A full day name. * - * @return A int that represents that full day represented by the specifed + * @return A int that represents that full day represented by the specified * full month name. * * @langversion ActionScript 3.0 @@ -675,7 +675,7 @@ package com.adobe.utils } /** - * Converts a date into just befor midnight. + * Converts a date into just before midnight. */ public static function makeNight(d:Date):Date { diff --git a/clients/flex/com/adobe/utils/StringUtil.as b/clients/flex/com/adobe/utils/StringUtil.as index d7e98ed08b..af236d210e 100644 --- a/clients/flex/com/adobe/utils/StringUtil.as +++ b/clients/flex/com/adobe/utils/StringUtil.as @@ -79,7 +79,7 @@ package com.adobe.utils * @param input The String whose beginning and ending whitespace will * will be removed. * - * @returns A String with whitespace removed from the begining and end + * @returns A String with whitespace removed from the beginning and end * * @langversion ActionScript 3.0 * @playerversion Flash 9.0 @@ -95,7 +95,7 @@ package com.adobe.utils * * @param input The String whose beginning whitespace will will be removed. * - * @returns A String with whitespace removed from the begining + * @returns A String with whitespace removed from the beginning * * @langversion ActionScript 3.0 * @playerversion Flash 9.0 @@ -236,4 +236,4 @@ package com.adobe.utils return (s != null && s.length > 0); } } -} \ No newline at end of file +} diff --git a/clients/flex/jquery-1.4.2.js b/clients/flex/jquery-1.4.2.js index fff6776433..cc6e7dd4ea 100644 --- a/clients/flex/jquery-1.4.2.js +++ b/clients/flex/jquery-1.4.2.js @@ -519,7 +519,7 @@ jQuery.extend({ noop: function() {}, - // Evalulates a script in a global context + // Evaluates a script in a global context globalEval: function( data ) { if ( data && rnotwhite.test(data) ) { // Inspired by code by Andrea Giammarchi @@ -855,7 +855,7 @@ function now() { htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute - // (IE uses .cssText insted) + // (IE uses .cssText instead) style: /red/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated @@ -1310,7 +1310,7 @@ jQuery.fn.extend({ classNames = value.split( rspace ); while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list + // check each className given, space separated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } @@ -1364,7 +1364,7 @@ jQuery.fn.extend({ var option = options[ i ]; if ( option.selected ) { - // Get the specifc value for the option + // Get the specific value for the option value = jQuery(option).val(); // We don't need an array for one selects @@ -2636,7 +2636,7 @@ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^ baseHasDuplicate = true; // Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision +// optimization where it does not always call our comparison // function. If that is the case, discard the hasDuplicate value. // Thus far that includes Google Chrome. [0, 0].sort(function(){ @@ -3415,7 +3415,7 @@ if ( document.documentElement.compareDocumentPosition ) { }; } -// Utility function for retreiving the text value of an array of DOM nodes +// Utility function for retrieving the text value of an array of DOM nodes function getText( elems ) { var ret = "", elem; @@ -4149,7 +4149,7 @@ jQuery.fn.extend({ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { // IE copies events bound via attachEvent when // using cloneNode. Calling detachEvent on the - // clone will also remove the events from the orignal + // clone will also remove the events from the original // In order to get around this, we use innerHTML. // Unfortunately, this means some modifications to // attributes in IE that are actually only stored @@ -4886,7 +4886,7 @@ jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".sp jQuery.extend({ get: function( url, data, callback, type ) { - // shift arguments if data argument was omited + // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; @@ -4911,7 +4911,7 @@ jQuery.extend({ }, post: function( url, data, callback, type ) { - // shift arguments if data argument was omited + // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; @@ -4948,7 +4948,7 @@ jQuery.extend({ // Create the request object; Microsoft failed to properly // implement the XMLHttpRequest in IE7 (can't request local files), // so we use the ActiveXObject when it is available - // This function can be overriden by calling jQuery.ajaxSetup + // This function can be overridden by calling jQuery.ajaxSetup xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ? function() { return new window.XMLHttpRequest(); diff --git a/clients/flex/jquery.tmpl.js b/clients/flex/jquery.tmpl.js index 7e850f9d06..24188733b6 100644 --- a/clients/flex/jquery.tmpl.js +++ b/clients/flex/jquery.tmpl.js @@ -362,7 +362,7 @@ function updateWrapped( options, wrapped ) { // Build the wrapped content. options._wrap = build( options, true, - // Suport imperative scenario in which options.wrapped can be set to a selector or an HTML string. + // Support imperative scenario in which options.wrapped can be set to a selector or an HTML string. jQuery.isArray( wrapped ) ? wrapped : [htmlExpr.test( wrapped ) ? wrapped : jQuery( wrapped ).html()] ).join(""); } diff --git a/conf/curl/autoload_configs/conference.conf.xml b/conf/curl/autoload_configs/conference.conf.xml index dad34b2cce..75a12c78fd 100644 --- a/conf/curl/autoload_configs/conference.conf.xml +++ b/conf/curl/autoload_configs/conference.conf.xml @@ -53,7 +53,7 @@ - + diff --git a/conf/curl/autoload_configs/xml_cdr.conf.xml b/conf/curl/autoload_configs/xml_cdr.conf.xml index 7f635d64aa..6aed35ac91 100644 --- a/conf/curl/autoload_configs/xml_cdr.conf.xml +++ b/conf/curl/autoload_configs/xml_cdr.conf.xml @@ -6,7 +6,7 @@ - + diff --git a/conf/insideout/autoload_configs/conference.conf.xml b/conf/insideout/autoload_configs/conference.conf.xml index dad34b2cce..75a12c78fd 100644 --- a/conf/insideout/autoload_configs/conference.conf.xml +++ b/conf/insideout/autoload_configs/conference.conf.xml @@ -53,7 +53,7 @@ - + diff --git a/conf/insideout/autoload_configs/xml_cdr.conf.xml b/conf/insideout/autoload_configs/xml_cdr.conf.xml index 7f635d64aa..6aed35ac91 100644 --- a/conf/insideout/autoload_configs/xml_cdr.conf.xml +++ b/conf/insideout/autoload_configs/xml_cdr.conf.xml @@ -6,7 +6,7 @@ - + diff --git a/conf/insideout/dialplan/default.xml b/conf/insideout/dialplan/default.xml index 560b3023bb..6290dd53b0 100644 --- a/conf/insideout/dialplan/default.xml +++ b/conf/insideout/dialplan/default.xml @@ -2,7 +2,7 @@ NOTICE: This context is usually accessed via authenticated callers on the sip profile on port 5060 - or transfered callers from the public context which arrived via the sip profile on port 5080. + or transferred callers from the public context which arrived via the sip profile on port 5080. Authenticated users will use the user_context variable on the user to determine what context they can access. You can also add a user in the directory with the cidr= attribute acl.conf.xml @@ -330,7 +330,7 @@ - + diff --git a/conf/rayo/autoload_configs/conference.conf.xml b/conf/rayo/autoload_configs/conference.conf.xml index 1ccd675d75..0641df764e 100644 --- a/conf/rayo/autoload_configs/conference.conf.xml +++ b/conf/rayo/autoload_configs/conference.conf.xml @@ -64,7 +64,7 @@ - + diff --git a/conf/rayo/autoload_configs/spandsp.conf.xml b/conf/rayo/autoload_configs/spandsp.conf.xml index f70416bc66..f9556d3c78 100644 --- a/conf/rayo/autoload_configs/spandsp.conf.xml +++ b/conf/rayo/autoload_configs/spandsp.conf.xml @@ -10,7 +10,7 @@ 2) copy conf/config.FS0 to /var/spool/hylafax/etc (or wherver the appropriate dir is on your system) - Subsequent modem configs would incrment the 0 to 1 and so on. + Subsequent modem configs would increment the 0 to 1 and so on. --> diff --git a/debian/README.source b/debian/README.source index f1d4cff376..c5dc90b5de 100644 --- a/debian/README.source +++ b/debian/README.source @@ -63,7 +63,7 @@ The format of debian/modules.conf is: Building the Debian packaging ----------------------------- -If you want actualy Debian binary or source packages to upload to your +If you want actually Debian binary or source packages to upload to your own repository, you'll need to build them as described here. We have some fancy automatic tools to accomplish this. The tools allow you to start from a very bare Debian image and generate working packages. diff --git a/docker/base_image/README.md b/docker/base_image/README.md index 75e6e02dae..25ffe1a85f 100644 --- a/docker/base_image/README.md +++ b/docker/base_image/README.md @@ -70,7 +70,7 @@ systemd enable freeswitch-docker.service .bashrc file ------------ -To simplify freeswitch managment you can add alias for ```fs_cli``` to ```.bashrc``` file as example bellow. +To simplify freeswitch management you can add alias for ```fs_cli``` to ```.bashrc``` file as example bellow. ```sh alias fs_cli='docker exec -i -t freeswitch /usr/bin/fs_cli' ``` diff --git a/docker/base_image/docker-entrypoint.sh b/docker/base_image/docker-entrypoint.sh index f3e0519f23..030ee543ad 100755 --- a/docker/base_image/docker-entrypoint.sh +++ b/docker/base_image/docker-entrypoint.sh @@ -43,7 +43,7 @@ wget_helper() { local SOUND_FILE=$1 grep -q $SOUND_FILE /usr/share/freeswitch/sounds/soundfiles_present.txt 2> /dev/null if [ "$?" -eq 0 ]; then - echo "Skiping download of $SOUND_FILE. Already present" + echo "Skipping download of $SOUND_FILE. Already present" return fi wget $BASEURL/$SOUND_FILE @@ -99,7 +99,7 @@ SOUND_RATES=$(echo "$SOUND_RATES" | sed -e 's/:/\n/g') SOUND_TYPES=$(echo "$SOUND_TYPES" | sed -e 's/:/\n/g') if [ -z "$SOUND_RATES" -o -z "$SOUND_TYPES" ]; then - echo "Environment variables 'SOUND_RATES' or 'SOUND_TYPES' not defined. Skiping sound files checking." + echo "Environment variables 'SOUND_RATES' or 'SOUND_TYPES' not defined. Skipping sound files checking." else download_sound_types extract_sound_files diff --git a/docs/Doxygen.conf b/docs/Doxygen.conf index 692a9f9e6c..5df2a2bcb2 100644 --- a/docs/Doxygen.conf +++ b/docs/Doxygen.conf @@ -278,10 +278,10 @@ TYPEDEF_HIDES_STRUCT = NO # 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 penality. +# 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 rougly double the +# 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 diff --git a/docs/phrase/README.TXT b/docs/phrase/README.TXT index 463718289f..088147652c 100644 --- a/docs/phrase/README.TXT +++ b/docs/phrase/README.TXT @@ -8,9 +8,9 @@ language. If you are capable of recording each language please do so and contribute them to the project. As phrases are added, the files will need to be updated for the respective phrase_xx.xml file. make_checks.sh - script to compare phrase_en.xml with other language xml files. -Script output contans prompt elements with attributes: +Script output contains prompt elements with attributes: translated - value 'false' or not displayed; -transpated-to - tranlation value if exists; +translated-to - translation value if exists; more-then-one-translation - displayed if exist two or more for given wav file. How can you contribute? diff --git a/docs/phrase/make_checks.sh b/docs/phrase/make_checks.sh index 72e6105987..17bf93fa09 100755 --- a/docs/phrase/make_checks.sh +++ b/docs/phrase/make_checks.sh @@ -3,13 +3,13 @@ SAXON_JAR=/usr/share/java/saxon9he.jar XML=$1 if [ ! -f "$SAXON_JAR" ]; then - echo "Please update 'SAXON_JAR' varaiable value to location of SAXON jar" + echo "Please update 'SAXON_JAR' variable value to location of SAXON jar" exit -1 fi if [ -z "$XML" ]; then echo "Error: Please enter xml file name that must be ckecked." - echo "Exmple: make_checks.sh phrase_es_ES.xml > comparison_result.xml" + echo "Example: make_checks.sh phrase_es_ES.xml > comparison_result.xml" exit -1 fi diff --git a/freeswitch.spec b/freeswitch.spec index dfd71f5429..4cf49c2118 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -296,7 +296,7 @@ Group: System/Libraries Requires: %{name} = %{version}-%{release} %description application-directory -Provides FreeSWITCH mod_directory, a dial by name directory application. +Provides FreeSWITCH mod_directory, a dial by name directory application. %package application-distributor Summary: FreeSWITCH mod_distributor @@ -304,7 +304,7 @@ Group: System/Libraries Requires: %{name} = %{version}-%{release} %description application-distributor -Provides FreeSWITCH mod_distributor, a simple round-robbin style distribution +Provides FreeSWITCH mod_distributor, a simple round-robin style distribution to call gateways. %package application-easyroute @@ -461,7 +461,7 @@ Group: System/Libraries Requires: %{name} = %{version}-%{release} %description application-rad_auth -Provides FreeSWITCH mod_rad_auth, authetication via RADIUS protocol from FreeSWITCH dialplan +Provides FreeSWITCH mod_rad_auth, authentication via RADIUS protocol from FreeSWITCH dialplan %package application-redis Summary: FreeSWITCH mod_redis @@ -839,7 +839,7 @@ 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 enpoint support for FreeSWITCH open source telephony platform +#Summary: Generic GSM endpoint support for FreeSWITCH open source telephony platform #Group: System/Libraries #Requires: %{name} = %{version}-%{release} # @@ -849,12 +849,12 @@ to be used as a client for GoogleTalk or other XMPP Servers. #SMS is handled via the standard CHAT API in FreeSWITCH. #%package endpoint-h323 -#Summary: H.323 enpoint support for FreeSWITCH open source telephony platform +#Summary: H.323 endpoint support for FreeSWITCH open source telephony platform #Group: System/Libraries #Requires: %{name} = %{version}-%{release} # #%description endpoint-h323 -#H.323 enpoint support for FreeSWITCH open source telephony platform +#H.323 endpoint support for FreeSWITCH open source telephony platform #%package endpoint-khomp #Summary: khomp endpoint support for FreeSWITCH open source telephony platform @@ -1170,7 +1170,7 @@ Requires: %{name} = %{version}-%{release} ###################################################################################################################### %package lang-en -Summary: Provides english language dependand modules and speech config for the FreeSWITCH Open Source telephone platform. +Summary: Provides english language dependent modules and speech config for the FreeSWITCH Open Source telephone platform. Group: System/Libraries Requires: %{name} = %{version}-%{release} @@ -1178,7 +1178,7 @@ Requires: %{name} = %{version}-%{release} English language phrases module and directory structure for say module and voicemail %package lang-ru -Summary: Provides russian language dependand modules and speech config for the FreeSWITCH Open Source telephone platform. +Summary: Provides russian language dependent modules and speech config for the FreeSWITCH Open Source telephone platform. Group: System/Libraries Requires: %{name} = %{version}-%{release} @@ -1218,12 +1218,12 @@ Requires: %{name} = %{version}-%{release} Spanish language phrases module and directory structure for say module and voicemail %package lang-pt -Summary: Provides Portugese language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. +Summary: Provides Portuguese language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. Group: System/Libraries Requires: %{name} = %{version}-%{release} %description lang-pt -Portugese language phrases module and directory structure for say module and voicemail +Portuguese language phrases module and directory structure for say module and voicemail %package lang-sv Summary: Provides Swedish language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. @@ -1982,7 +1982,7 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/directory/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/directory/default/* ###################################################################################################################### -# IVR Menues +# IVR Menus ###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/ivr_menus/*.xml ###################################################################################################################### @@ -2557,7 +2557,7 @@ fi * Wed Jun 19 2013 - krice@freeswitch.org - tweak files included for vanilla configs * Wed Sep 19 2012 - krice@freeswitch.org -- Add support for Spanish and Portugese say language modules +- Add support for Spanish and Portuguese say language modules * Thu Jan 26 2012 - krice@freeswitch.org - complete rework of spec file * Tue Jun 14 2011 - michal.bielicki@seventhsignal.de @@ -2576,7 +2576,7 @@ fi - fixes for ss7 freetdm modules - added mod_opus - added selector for sangoma modules -- addded python esl module to rpm +- added python esl module to rpm - some minor cleanups - cut sangoma modules into separate rpms as addons for freetdm * Tue Jan 18 2011 - michal.bielicki@seventhsignal.de @@ -2594,7 +2594,7 @@ fi - added mod_nibblebill to standard modules * Sun Sep 26 2010 - michal.bielicki@seventhsignal.de - added portaudio_stream module -- some more formating work +- some more formatting work * Mon Jul 19 2010 - michal.bielicki@seventhsignal.de - new hash module config file added to freeswitch.spec * Mon Jul 19 2010 - michal.bielicki@seventhsignal.de @@ -2607,7 +2607,7 @@ fi - Added Contributors - Added Anthony's copyright for the whole package into the header * Tue Jun 22 2010 - michal.bielicki@seventhsignal.de -- Reorganized the modules alphabeticaly +- Reorganized the modules alphabetically - synced SFEopensolaris and centos spec - started to fix Run Dependencies - added mod_say_ru which seemd to have gone missing @@ -2619,7 +2619,7 @@ fi - replaced mod_limit with mod_db - added mod_spy - added mod_valet_parking -- addded mod_memcache +- added mod_memcache - added mod_distributor - added mod_avmd * Thu Apr 29 2010 - michal.bielicki@seventhsignal.de @@ -2639,7 +2639,7 @@ fi * Sat Nov 21 2009 - michal.bielicki@seventhsignal.de - added patch by Igor Neves : Added some checkup in %post and %postun to prevent upgrades from removing freeswitch user * Wed Nov 18 2009 - michal.bielicki@seventhsignal.de -- added new config files for diretory and distributor +- added new config files for directory and distributor - removed sangoma boost from openzap for builds that do not inherit wanpipe while building. * Fri Jul 24 2009 - mike@jerris.com - removed mod_http @@ -2704,7 +2704,7 @@ fi - fixed odbc requirements - added all buildable modules - added redhat style init file -- splitted off language dependant stuff into separate language files +- split off language dependent stuff into separate language files - disable non complete language modules * Tue Apr 24 2007 - peter+rpmspam@suntel.com.tr - Added a debug package diff --git a/fscomm/preferences/prefdialog.ui b/fscomm/preferences/prefdialog.ui index aca5eff198..66742f2c78 100644 --- a/fscomm/preferences/prefdialog.ui +++ b/fscomm/preferences/prefdialog.ui @@ -1092,7 +1092,7 @@ - Noise Supressor + Noise Suppressor diff --git a/src/switch_xml_config.c b/src/switch_xml_config.c index 21a6af38af..6d67ccdad4 100644 --- a/src/switch_xml_config.c +++ b/src/switch_xml_config.c @@ -333,7 +333,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *ev } else if (value && switch_false(value)) { newval = SWITCH_FALSE; } else if (value) { - /* Value isnt true or false */ + /* Value isn't true or false */ newval = (switch_bool_t) (intptr_t) item->defaultvalue; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%s]\n", value, item->key, newval ? "true" : "false"); diff --git a/tests/unit/conf/vpx.conf.xml b/tests/unit/conf/vpx.conf.xml index 63372ff5e7..2fce09dc13 100644 --- a/tests/unit/conf/vpx.conf.xml +++ b/tests/unit/conf/vpx.conf.xml @@ -189,7 +189,7 @@ - + diff --git a/w32/Setup/GitInfo/GitInfo.targets b/w32/Setup/GitInfo/GitInfo.targets index 7c587c62d6..3d5da69590 100644 --- a/w32/Setup/GitInfo/GitInfo.targets +++ b/w32/Setup/GitInfo/GitInfo.targets @@ -57,7 +57,7 @@ GitInfo.txt - + $(MSBuildProjectDirectory) $([MSBuild]::GetDirectoryNameOfFileAbove($(GitInfoBaseDir), $(GitVersionFile)))\$(GitVersionFile) From a4a7afdca8e2bd320f4dc66a95723ec38bd47ce5 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 1 May 2020 14:08:14 +0200 Subject: [PATCH 016/655] Fix typo and convert line endings from CRLF to LF Signed-off-by: Stefan Weil --- README.md | 126 +++++++++++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 77de167e3e..f2525918f3 100644 --- a/README.md +++ b/README.md @@ -1,63 +1,63 @@ -# FreeSWITCH - -FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device. Combined with our hosted cloud platform, SignalWire, FreeSWITCH can interconnect with the outside world and scale to any size. - -Visit [https://signalwire.com](https://signalwire.com/) or https://github.com/signalwire for more info. - -## Getting Started - -FreeSWITCH is available on [Github](https://github.com/signalwire/freeswitch) in source code format. You can checkout the development branch and build for many poplular platforms including Linux, Windows, MacOSX and BSD. There is an issue tracker and pull request system available as part of the repo online. - -See [https://freeswitch.com/#getting-started](https://freeswitch.com/#getting-started) for more detailed instructions. - -## Additional Help - -If you need assistance or have an interest in using a commercially supported build, you can contact coreteam@freeswitch.com to learn about professional services to support your project. - -## Voice-over-IP services - SIP / SMS - App Integrations - -[SignalWire](https://signalwire.com) is the primary sponsor of the FreeSWITCH project and was founded by the original developers of FreeSWITCH. SignalWire provides scalable services to enhance and scale your project such as SMS, SIP, Serverless Application hosting as well as programmable telecom. mod_signalwire which is distributed in this code base allows you to instantly pair with SignalWire and extend your FreeSWITCH. - -## Documentation - -The main index for documentation is available at: - - * https://freeswitch.org/confluence/ - -### Release notes: - - * https://freeswitch.org/confluence/display/FREESWITCH/Release+Notes - -### Installation - -Step by step tutorials to install FreeSWITCH from packages or source code are available at: - - * [Debian 10 Buster](https://freeswitch.org/confluence/display/FREESWITCH/Debian+10+Buster) [Recommended] - * [Raspberry Pi](https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi) - * [CentOS 7](https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7) - -## Downloads - - * [Tarballs](https://files.freeswitch.org/releases/freeswitch/) - * [Windows Installer](http://files.freeswitch.org/windows/installer/x64/) - * [Windows Sound Packages](http://files.freeswitch.org/windows/installer/x64/sounds/) - -## Contributions - -GitHub pull requests are the recommended way to contribute to the FreeSWITCH source code: - - * https://github.com/signalwire/freeswitch/pulls - -## Community - -Slack is our chat system where the developers, the FreeSWITCH team, and the most active users are present. -This is the place to get answers faster and chat with other users in real time. All you need to do is enter your email and verify it on the Slack signup page and you are ready to join in the discussion! - -Slack Community: - * https://signalwire.community/ - -Mailing list: - - * http://lists.freeswitch.org/mailman/listinfo/freeswitch-users - -**Thank you for using FreeSWITCH!** \ No newline at end of file +# FreeSWITCH + +FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device. Combined with our hosted cloud platform, SignalWire, FreeSWITCH can interconnect with the outside world and scale to any size. + +Visit [https://signalwire.com](https://signalwire.com/) or https://github.com/signalwire for more info. + +## Getting Started + +FreeSWITCH is available on [Github](https://github.com/signalwire/freeswitch) in source code format. You can checkout the development branch and build for many popular platforms including Linux, Windows, MacOSX and BSD. There is an issue tracker and pull request system available as part of the repo online. + +See [https://freeswitch.com/#getting-started](https://freeswitch.com/#getting-started) for more detailed instructions. + +## Additional Help + +If you need assistance or have an interest in using a commercially supported build, you can contact coreteam@freeswitch.com to learn about professional services to support your project. + +## Voice-over-IP services - SIP / SMS - App Integrations + +[SignalWire](https://signalwire.com) is the primary sponsor of the FreeSWITCH project and was founded by the original developers of FreeSWITCH. SignalWire provides scalable services to enhance and scale your project such as SMS, SIP, Serverless Application hosting as well as programmable telecom. mod_signalwire which is distributed in this code base allows you to instantly pair with SignalWire and extend your FreeSWITCH. + +## Documentation + +The main index for documentation is available at: + + * https://freeswitch.org/confluence/ + +### Release notes: + + * https://freeswitch.org/confluence/display/FREESWITCH/Release+Notes + +### Installation + +Step by step tutorials to install FreeSWITCH from packages or source code are available at: + + * [Debian 10 Buster](https://freeswitch.org/confluence/display/FREESWITCH/Debian+10+Buster) [Recommended] + * [Raspberry Pi](https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi) + * [CentOS 7](https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7) + +## Downloads + + * [Tarballs](https://files.freeswitch.org/releases/freeswitch/) + * [Windows Installer](http://files.freeswitch.org/windows/installer/x64/) + * [Windows Sound Packages](http://files.freeswitch.org/windows/installer/x64/sounds/) + +## Contributions + +GitHub pull requests are the recommended way to contribute to the FreeSWITCH source code: + + * https://github.com/signalwire/freeswitch/pulls + +## Community + +Slack is our chat system where the developers, the FreeSWITCH team, and the most active users are present. +This is the place to get answers faster and chat with other users in real time. All you need to do is enter your email and verify it on the Slack signup page and you are ready to join in the discussion! + +Slack Community: + * https://signalwire.community/ + +Mailing list: + + * http://lists.freeswitch.org/mailman/listinfo/freeswitch-users + +**Thank you for using FreeSWITCH!** From 0426ffaec77322cb0c6572b4cb37c12220a5e084 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 27 Feb 2021 00:09:44 +0300 Subject: [PATCH 017/655] [Build-System] Add src/include/switch_swigable_cpp.h requirement to make swigall --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index fa0bb9abd7..984872c36d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -745,7 +745,7 @@ update-clean: clean python-reconf cd libs/esl && $(MAKE) clean cd libs/srtp && $(MAKE) clean -swigall: +swigall: src/include/switch_swigable_cpp.h @echo reswigging all sh $(switch_srcdir)/build/swigall.sh From fd2ed2546c588e6a2313a0387ff881e2ae1a9b04 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 3 Mar 2021 10:02:29 -0700 Subject: [PATCH 018/655] [build] fix configure checks for ipv6 on latest osx --- libs/apr/build/apr_common.m4 | 3 +++ libs/apr/build/apr_network.m4 | 18 ++++++++++++++++++ libs/apr/configure.ac | 3 +++ 3 files changed, 24 insertions(+) diff --git a/libs/apr/build/apr_common.m4 b/libs/apr/build/apr_common.m4 index 1f79f7acd0..e8e9f51f08 100644 --- a/libs/apr/build/apr_common.m4 +++ b/libs/apr/build/apr_common.m4 @@ -519,6 +519,9 @@ AC_TRY_RUN([ #include #include #include +#ifdef HAVE_STDLIB_H +#include +#endif int main(void) { char buf[1024]; diff --git a/libs/apr/build/apr_network.m4 b/libs/apr/build/apr_network.m4 index d8b1bcad27..df582960ac 100644 --- a/libs/apr/build/apr_network.m4 +++ b/libs/apr/build/apr_network.m4 @@ -40,6 +40,9 @@ AC_DEFUN([APR_CHECK_WORKING_GETADDRINFO],[ #ifdef HAVE_SYS_SOCKET_H #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif int main(void) { struct addrinfo hints, *ai; @@ -134,6 +137,12 @@ AC_DEFUN([APR_CHECK_WORKING_GETNAMEINFO],[ #ifdef HAVE_NETINET_IN_H #include #endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif int main(void) { struct sockaddr_in sa; @@ -177,6 +186,9 @@ AC_DEFUN([APR_CHECK_NEGATIVE_EAI],[ #ifdef HAVE_NETDB_H #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif int main(void) { if (EAI_ADDRFAMILY < 0) { @@ -282,6 +294,9 @@ AC_DEFUN([APR_CHECK_TCP_NODELAY_INHERITED],[ #ifndef HAVE_SOCKLEN_T typedef int socklen_t; #endif +#ifdef HAVE_STDLIB_H +#include +#endif int main(void) { int listen_s, connected_s, client_s; int listen_port, rc; @@ -453,6 +468,9 @@ typedef int socklen_t; #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif int main(void) { int listen_s, connected_s, client_s; int listen_port, rc; diff --git a/libs/apr/configure.ac b/libs/apr/configure.ac index fa5796ecca..2b8f551880 100644 --- a/libs/apr/configure.ac +++ b/libs/apr/configure.ac @@ -1552,6 +1552,7 @@ AC_TRY_RUN([ #include #include #include +#include main() { struct rlimit limit; @@ -1580,6 +1581,7 @@ AC_TRY_RUN([ #include #include #include +#include main() { sem_t *psem; @@ -1634,6 +1636,7 @@ if test "$threads" = "1"; then AC_TRY_RUN([ #include #include +#include int main() { pthread_mutex_t mutex; From 752e1c3386414c8413aedaecdcfbbdf75fcdaadd Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 25 Feb 2021 16:16:14 +0200 Subject: [PATCH 019/655] [mod_amr] handle frame type NO_DATA and add unit test. --- src/mod/codecs/mod_amr/Makefile.am | 11 +++ src/mod/codecs/mod_amr/amr_be.c | 2 +- src/mod/codecs/mod_amr/mod_amr.c | 8 +- src/mod/codecs/mod_amr/test/freeswitch.xml | 21 +++++ src/mod/codecs/mod_amr/test/test_amr.c | 100 +++++++++++++++++++++ 5 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 src/mod/codecs/mod_amr/test/freeswitch.xml create mode 100644 src/mod/codecs/mod_amr/test/test_amr.c diff --git a/src/mod/codecs/mod_amr/Makefile.am b/src/mod/codecs/mod_amr/Makefile.am index ac80d8ac35..43fa399305 100644 --- a/src/mod/codecs/mod_amr/Makefile.am +++ b/src/mod/codecs/mod_amr/Makefile.am @@ -20,3 +20,14 @@ else mod_amr_la_CFLAGS += -DAMR_PASSTHROUGH endif +if HAVE_AMR +noinst_PROGRAMS = test/test_amr + +test_test_amr_SOURCES = test/test_amr.c +test_test_amr_CFLAGS = $(AM_CFLAGS) -I./ -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AMR_CFLAGS) +test_test_amr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) $(AMR_LIBS) + +TESTS = $(noinst_PROGRAMS) +endif + + diff --git a/src/mod/codecs/mod_amr/amr_be.c b/src/mod/codecs/mod_amr/amr_be.c index b7d9c9053d..339d0c703e 100644 --- a/src/mod/codecs/mod_amr/amr_be.c +++ b/src/mod/codecs/mod_amr/amr_be.c @@ -106,7 +106,7 @@ extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *t switch_amr_array_lshift(2, shift_buf, encoded_len - 1); /* get frame size */ index = ((shift_tocs[0] >> 3) & 0x0f); - if (index > 9) { + if (index > 9 && index != 0xf) { return SWITCH_FALSE; } framesz = switch_amr_frame_sizes[index]; diff --git a/src/mod/codecs/mod_amr/mod_amr.c b/src/mod/codecs/mod_amr/mod_amr.c index b9d2c5882d..04717ca52c 100644 --- a/src/mod/codecs/mod_amr/mod_amr.c +++ b/src/mod/codecs/mod_amr/mod_amr.c @@ -139,7 +139,7 @@ static struct { int debug; } globals; -const int switch_amr_frame_sizes[] = {12,13,15,17,19,20,26,31,5,0}; +const int switch_amr_frame_sizes[] = {12,13,15,17,19,20,26,31,5,0,0,0,0,0,0,1}; #define SWITCH_AMR_OUT_MAX_SIZE 32 #define SWITCH_AMR_MODES 9 /* plus SID */ @@ -157,7 +157,7 @@ static switch_bool_t switch_amr_unpack_oa(unsigned char *buf, uint8_t *tmp, int tocs = buf; index = ((tocs[0]>>3) & 0xf); buf++; /* point to voice payload */ - if (index > SWITCH_AMR_MODES) { + if (index > SWITCH_AMR_MODES && index != 0xf) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (OA): Invalid Table Of Contents (TOC): 0x%x\n", index); return SWITCH_FALSE; } @@ -195,7 +195,7 @@ static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_dat encoded_buf++; /* CMR skip */ tocs = encoded_buf; index = (tocs[0] >> 3) & 0x0f; - if (index > SWITCH_AMR_MODES) { + if (index > SWITCH_AMR_MODES && index != 0xf) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (OA): Invalid Table Of Contents (TOC): 0x%x\n", index); return SWITCH_FALSE; } @@ -215,7 +215,7 @@ static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_dat ft = shift_tocs[0] >> 3 ; ft &= ~(1 << 5); /* Frame Type */ index = (shift_tocs[0] >> 3) & 0x0f; - if (index > SWITCH_AMR_MODES) { + if (index > SWITCH_AMR_MODES && index != 0xf) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (BE): Invalid Table Of Contents (TOC): 0x%x\n", index); return SWITCH_FALSE; } diff --git a/src/mod/codecs/mod_amr/test/freeswitch.xml b/src/mod/codecs/mod_amr/test/freeswitch.xml new file mode 100644 index 0000000000..900073a6f0 --- /dev/null +++ b/src/mod/codecs/mod_amr/test/freeswitch.xml @@ -0,0 +1,21 @@ + + +
+ + + + + + +
+ +
+ + + + + + + +
+
diff --git a/src/mod/codecs/mod_amr/test/test_amr.c b/src/mod/codecs/mod_amr/test/test_amr.c new file mode 100644 index 0000000000..f81401e6aa --- /dev/null +++ b/src/mod/codecs/mod_amr/test/test_amr.c @@ -0,0 +1,100 @@ +/* + * 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 + * + * + * test_amr.c -- tests mod_amr + * + */ + +#ifndef AMR_PASSTHROUGH +#include +#include + +#include +FST_CORE_BEGIN(".") +{ + FST_SUITE_BEGIN(test_amr) + { + FST_SETUP_BEGIN() + { + fst_requires_module("mod_loopback"); + fst_requires_module("mod_amr"); + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(amr_decode) + { + switch_codec_t read_codec = { 0 }; + switch_status_t status; + switch_codec_settings_t codec_settings = {{ 0 }}; + uint32_t flags = 0; + uint32_t rate; + /*amr frame types*/ + static char no_data[] = "\x77\xc0"; + static char fail[] = "\x76\xc0"; + /*decode*/ + uint32_t decoded_len; + unsigned char decbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + switch_stream_handle_t stream = { 0 }; + + status = switch_core_codec_init(&read_codec, + "AMR", + "mod_amr", + NULL, + 8000, + 20, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + &codec_settings, fst_pool); + fst_check(status == SWITCH_STATUS_SUCCESS); + + SWITCH_STANDARD_STREAM(stream); + + switch_api_execute("amr_debug", "on", NULL, &stream); + + switch_safe_free(stream.data); + + /*NO DATA = 0xf*/ + status = switch_core_codec_decode(&read_codec, NULL, &no_data, 2, 8000, &decbuf, &decoded_len, &rate, &flags); + fst_check(status == SWITCH_STATUS_SUCCESS); + + /*Invalid frame type*/ + status = switch_core_codec_decode(&read_codec, NULL, &fail, 2, 8000, &decbuf, &decoded_len, &rate, &flags); + fst_check(status != SWITCH_STATUS_SUCCESS); + + switch_core_codec_destroy(&read_codec); + } + + FST_TEST_END() + } + FST_SUITE_END() +} +FST_CORE_END() +#endif From 1d07634d7dcee98057c64262e0f4732782adcda4 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Fri, 5 Mar 2021 11:24:22 +0200 Subject: [PATCH 020/655] [mod_amrwb] handle frame types SPEECH_LOST and NO_DATA. add unit test. --- src/mod/codecs/mod_amrwb/Makefile.am | 10 ++ src/mod/codecs/mod_amrwb/amrwb_be.c | 2 +- src/mod/codecs/mod_amrwb/mod_amrwb.c | 10 +- src/mod/codecs/mod_amrwb/test/freeswitch.xml | 21 ++++ src/mod/codecs/mod_amrwb/test/test_amrwb.c | 105 +++++++++++++++++++ 5 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 src/mod/codecs/mod_amrwb/test/freeswitch.xml create mode 100644 src/mod/codecs/mod_amrwb/test/test_amrwb.c diff --git a/src/mod/codecs/mod_amrwb/Makefile.am b/src/mod/codecs/mod_amrwb/Makefile.am index d3a7d67761..176a0ed614 100644 --- a/src/mod/codecs/mod_amrwb/Makefile.am +++ b/src/mod/codecs/mod_amrwb/Makefile.am @@ -20,3 +20,13 @@ else mod_amrwb_la_CFLAGS += -DAMRWB_PASSTHROUGH endif +if HAVE_AMRWB +noinst_PROGRAMS = test/test_amrwb + +test_test_amrwb_SOURCES = test/test_amrwb.c +test_test_amrwb_CFLAGS = $(AM_CFLAGS) -I./ -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AMRWB_CFLAGS) +test_test_amrwb_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) $(AMRWB_LIBS) + +TESTS = $(noinst_PROGRAMS) +endif + diff --git a/src/mod/codecs/mod_amrwb/amrwb_be.c b/src/mod/codecs/mod_amrwb/amrwb_be.c index c668ac94cb..7b43b2b583 100644 --- a/src/mod/codecs/mod_amrwb/amrwb_be.c +++ b/src/mod/codecs/mod_amrwb/amrwb_be.c @@ -109,7 +109,7 @@ extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t switch_amr_array_lshift(2, shift_buf, encoded_len - 1); /* get frame size */ index = ((shift_tocs[0] >> 3) & 0x0f); - if (index > 10) { + if (index > 10 && index != 0xe && index != 0xf) { return SWITCH_FALSE; } framesz = switch_amrwb_frame_sizes[index]; diff --git a/src/mod/codecs/mod_amrwb/mod_amrwb.c b/src/mod/codecs/mod_amrwb/mod_amrwb.c index db18082983..ef7891cde6 100644 --- a/src/mod/codecs/mod_amrwb/mod_amrwb.c +++ b/src/mod/codecs/mod_amrwb/mod_amrwb.c @@ -91,11 +91,13 @@ static struct { int debug; } globals; -const int switch_amrwb_frame_sizes[] = {17, 23, 32, 36, 40, 46, 50, 58, 60, 5}; +const int switch_amrwb_frame_sizes[] = {17, 23, 32, 36, 40, 46, 50, 58, 60, 5, 0, 0, 0, 0, 1, 1}; #define SWITCH_AMRWB_OUT_MAX_SIZE 61 #define SWITCH_AMRWB_MODES 10 /* Silence Indicator (SID) included */ +#define invalid_frame_type (index > SWITCH_AMRWB_MODES && index != 0xe && index != 0xf) /* include SPEECH_LOST and NO_DATA*/ + static switch_bool_t switch_amrwb_unpack_oa(unsigned char *buf, uint8_t *tmp, int encoded_data_len) { uint8_t *tocs; @@ -107,7 +109,7 @@ static switch_bool_t switch_amrwb_unpack_oa(unsigned char *buf, uint8_t *tmp, in index = ((tocs[0]>>3) & 0xf); buf++; /* point to voice payload */ - if (index > 10) { + if (invalid_frame_type) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMRWB decoder (OA): Invalid TOC: 0x%x", index); return SWITCH_FALSE; } @@ -144,7 +146,7 @@ static switch_bool_t switch_amrwb_info(switch_codec_t *codec, unsigned char *enc encoded_buf++; /* CMR skip */ tocs = encoded_buf; index = (tocs[0] >> 3) & 0x0f; - if (index > SWITCH_AMRWB_MODES) { + if (invalid_frame_type) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_ERROR, "AMRWB decoder (OA): Invalid TOC 0x%x\n", index); return SWITCH_FALSE; } @@ -163,7 +165,7 @@ static switch_bool_t switch_amrwb_info(switch_codec_t *codec, unsigned char *enc ft = shift_tocs[0] >> 3; ft &= ~(1 << 5); /* Frame Type */ index = (shift_tocs[0] >> 3) & 0x0f; - if (index > SWITCH_AMRWB_MODES) { + if (invalid_frame_type) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_ERROR, "AMRWB decoder (BE): Invalid TOC 0x%x\n", index); return SWITCH_FALSE; } diff --git a/src/mod/codecs/mod_amrwb/test/freeswitch.xml b/src/mod/codecs/mod_amrwb/test/freeswitch.xml new file mode 100644 index 0000000000..14e5629f12 --- /dev/null +++ b/src/mod/codecs/mod_amrwb/test/freeswitch.xml @@ -0,0 +1,21 @@ + + +
+ + + + + + +
+ +
+ + + + + + + +
+
diff --git a/src/mod/codecs/mod_amrwb/test/test_amrwb.c b/src/mod/codecs/mod_amrwb/test/test_amrwb.c new file mode 100644 index 0000000000..1b63f644eb --- /dev/null +++ b/src/mod/codecs/mod_amrwb/test/test_amrwb.c @@ -0,0 +1,105 @@ +/* + * 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 + * + * + * test_amrwb.c -- tests mod_amrwb + * + */ + +#ifndef AMRWB_PASSTHROUGH +#include +#include + +#include +FST_CORE_BEGIN(".") +{ + FST_SUITE_BEGIN(test_amrwb) + { + FST_SETUP_BEGIN() + { + fst_requires_module("mod_loopback"); + fst_requires_module("mod_amrwb"); + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(amrwb_decode) + { + switch_codec_t read_codec = { 0 }; + switch_status_t status; + switch_codec_settings_t codec_settings = {{ 0 }}; + uint32_t flags = 0; + uint32_t rate; + /*amrwb frame types*/ + static char no_data[] = "\x77\xc0"; + static char speech_lost[] = "\x77\x00"; + static char fail[] = "\x76\xc0"; + /*decode*/ + uint32_t decoded_len; + unsigned char decbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + switch_stream_handle_t stream = { 0 }; + + status = switch_core_codec_init(&read_codec, + "AMR-WB", + "mod_amrwb", + NULL, + 16000, + 20, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + &codec_settings, fst_pool); + fst_check(status == SWITCH_STATUS_SUCCESS); + + SWITCH_STANDARD_STREAM(stream); + + switch_api_execute("amrwb_debug", "on", NULL, &stream); + + switch_safe_free(stream.data); + + /*NO DATA = 0xf*/ + status = switch_core_codec_decode(&read_codec, NULL, &no_data, 2, 16000, &decbuf, &decoded_len, &rate, &flags); + fst_check(status == SWITCH_STATUS_SUCCESS); + + /*SPEECH LOST = 0xe*/ + status = switch_core_codec_decode(&read_codec, NULL, &speech_lost, 2, 16000, &decbuf, &decoded_len, &rate, &flags); + fst_check(status == SWITCH_STATUS_SUCCESS); + + /*Invalid frame type*/ + status = switch_core_codec_decode(&read_codec, NULL, &fail, 2, 16000, &decbuf, &decoded_len, &rate, &flags); + fst_check(status != SWITCH_STATUS_SUCCESS); + + switch_core_codec_destroy(&read_codec); + } + + FST_TEST_END() + } + FST_SUITE_END() +} +FST_CORE_END() +#endif From 9da3408d2d63eb6b2b5fbc6aab276f6d74b2d0fc Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Fri, 5 Mar 2021 11:57:25 +0200 Subject: [PATCH 021/655] [mod_tts_commandline] check return of switch_system() against 127 too --- src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c index a19af3a18d..e5cfbb5c42 100644 --- a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c +++ b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c @@ -133,6 +133,7 @@ static switch_status_t tts_commandline_speech_feed_tts(switch_speech_handle_t *s switch_status_t ret=SWITCH_STATUS_SUCCESS; char *message, *tmp, *mtmp, *rate; tts_commandline_t *info = (tts_commandline_t *) sh->private_info; + int sys_ret; assert(info != NULL); @@ -159,7 +160,8 @@ static switch_status_t tts_commandline_speech_feed_tts(switch_speech_handle_t *s switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Executing: %s\n", message); - if (switch_system(message, SWITCH_TRUE) < 0) { + sys_ret = switch_system(message, SWITCH_TRUE); + if (sys_ret < 0 || sys_ret == 127) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute command: %s\n", message); ret = SWITCH_STATUS_FALSE; goto done; } From 5d80d53c9701cd9455deaed3b716f6902a1aeba6 Mon Sep 17 00:00:00 2001 From: Paul Mateer <78475208+Paul-Mateer@users.noreply.github.com> Date: Mon, 8 Mar 2021 11:28:27 +0000 Subject: [PATCH 022/655] [Core] Capture return value of 2nd call to LoadLibraryEx and add a third call to widen the search to the module in switch_dso_open(). --- src/switch_dso.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/switch_dso.c b/src/switch_dso.c index 8ec57139b1..a78bba2f8c 100644 --- a/src/switch_dso.c +++ b/src/switch_dso.c @@ -39,7 +39,11 @@ SWITCH_DECLARE(switch_dso_lib_t) switch_dso_open(const char *path, int global, c lib = LoadLibraryEx(path, NULL, 0); if (!lib) { - LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + lib = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + } + + if (!lib) { + lib = LoadLibraryEx(path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); } if (!lib) { From 4734904d2d42b29fac5dee8c10a6871abd96d613 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 10 Mar 2021 15:43:45 +0200 Subject: [PATCH 023/655] [mod_amr] introduce new cfg setting force-oa to change between OA/BE when originating, show session in debug logs, update configs. --- conf/testing/autoload_configs/amrwb.conf.xml | 22 +++++++++++++++++ conf/vanilla/autoload_configs/amr.conf.xml | 2 ++ conf/vanilla/autoload_configs/amrwb.conf.xml | 23 ++++++++++++++---- src/mod/codecs/mod_amr/mod_amr.c | 25 +++++++++++++------- 4 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 conf/testing/autoload_configs/amrwb.conf.xml diff --git a/conf/testing/autoload_configs/amrwb.conf.xml b/conf/testing/autoload_configs/amrwb.conf.xml new file mode 100644 index 0000000000..0bd8e6b733 --- /dev/null +++ b/conf/testing/autoload_configs/amrwb.conf.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/conf/vanilla/autoload_configs/amr.conf.xml b/conf/vanilla/autoload_configs/amr.conf.xml index e1c3e3cc1b..19b8cb8891 100644 --- a/conf/vanilla/autoload_configs/amr.conf.xml +++ b/conf/vanilla/autoload_configs/amr.conf.xml @@ -15,5 +15,7 @@ + + diff --git a/conf/vanilla/autoload_configs/amrwb.conf.xml b/conf/vanilla/autoload_configs/amrwb.conf.xml index 9dac3505a4..0bd8e6b733 100644 --- a/conf/vanilla/autoload_configs/amrwb.conf.xml +++ b/conf/vanilla/autoload_configs/amrwb.conf.xml @@ -1,7 +1,22 @@ - - - - + + + + + + + + + diff --git a/src/mod/codecs/mod_amr/mod_amr.c b/src/mod/codecs/mod_amr/mod_amr.c index 04717ca52c..e7c45c7aff 100644 --- a/src/mod/codecs/mod_amr/mod_amr.c +++ b/src/mod/codecs/mod_amr/mod_amr.c @@ -137,6 +137,7 @@ static struct { switch_byte_t volte; /* enable special fmtp for VoLTE compliance */ switch_byte_t adjust_bitrate; int debug; + switch_byte_t force_oa; /*force OA when originating*/ } globals; const int switch_amr_frame_sizes[] = {12,13,15,17,19,20,26,31,5,0,0,0,0,0,0,1}; @@ -179,7 +180,7 @@ static switch_bool_t switch_amr_pack_oa(unsigned char *shift_buf, int n) return SWITCH_TRUE; } -static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) +static switch_bool_t switch_amr_info(switch_codec_t *codec, unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) { uint8_t *tocs; int framesz, index, not_last_frame, q, ft; @@ -196,7 +197,7 @@ static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_dat tocs = encoded_buf; index = (tocs[0] >> 3) & 0x0f; if (index > SWITCH_AMR_MODES && index != 0xf) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (OA): Invalid Table Of Contents (TOC): 0x%x\n", index); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_ERROR, "AMR decoder (OA): Invalid Table Of Contents (TOC): 0x%x\n", index); return SWITCH_FALSE; } framesz = switch_amr_frame_sizes[index]; @@ -216,15 +217,15 @@ static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_dat ft &= ~(1 << 5); /* Frame Type */ index = (shift_tocs[0] >> 3) & 0x0f; if (index > SWITCH_AMR_MODES && index != 0xf) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (BE): Invalid Table Of Contents (TOC): 0x%x\n", index); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_ERROR, "AMR decoder (BE): Invalid Table Of Contents (TOC): 0x%x\n", index); return SWITCH_FALSE; } framesz = switch_amr_frame_sizes[index]; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", print_text, payload_format ? "OA":"BE", ft, q, not_last_frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMR encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_DEBUG, "%s (%s): AMR encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", print_text, payload_format ? "OA":"BE", framesz, encoded_data_len); return SWITCH_TRUE; @@ -276,8 +277,11 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ * bandwidth-efficient operation is employed." * */ - switch_clear_flag(context, AMR_OPT_OCTET_ALIGN); - + if (!globals.force_oa) { + switch_clear_flag(context, AMR_OPT_OCTET_ALIGN); + } else { + switch_set_flag(context, AMR_OPT_OCTET_ALIGN); + } if (codec->fmtp_in) { argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0]))); for (x = 0; x < argc; x++) { @@ -452,7 +456,7 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec, } if (globals.debug) { - switch_amr_info(shift_buf, *encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR encoder"); + switch_amr_info(codec, shift_buf, *encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR encoder"); } return SWITCH_STATUS_SUCCESS; @@ -479,7 +483,7 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec, } if (globals.debug) { - switch_amr_info(buf, encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR decoder"); + switch_amr_info(codec, buf, encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR decoder"); } if (switch_test_flag(context, AMR_OPT_OCTET_ALIGN)) { @@ -643,6 +647,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load) if (!strcasecmp(var, "adjust-bitrate")) { globals.adjust_bitrate = (switch_byte_t) atoi(val); } + if (!strcasecmp(var, "force-oa")) { + globals.force_oa = (switch_byte_t) atoi(val); + } } } } From b775c1f91a94d101e47a528db879ecb3007cf6c1 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 16 Mar 2021 14:45:12 +0000 Subject: [PATCH 025/655] [mod_enum] fix mem leak - ldns_resolver_new() - vanilla cfg. --- src/mod/applications/mod_enum/mod_enum.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index f6ca99abce..de5804e1fd 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -496,6 +496,9 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n if (!added_server) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No Nameservers specified, using host default\n"); /* create a new resolver from /etc/resolv.conf */ + if (res) { + ldns_resolver_free(res); + } s = ldns_resolver_new_frm_file(&res, NULL); } From e8fa2d37b2db06a4f80ddc38758db88c8efe3b7e Mon Sep 17 00:00:00 2001 From: surendrasignalwire <56929670+surendrasignalwire@users.noreply.github.com> Date: Tue, 29 Oct 2019 23:36:59 +0530 Subject: [PATCH 026/655] [Core] execute_on_audio_change on codec change --- src/switch_core_media.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 1449724782..0ae007ad90 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3860,8 +3860,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_ end: if (resetting) { - switch_core_session_unlock_codec_write(session); - switch_core_session_unlock_codec_read(session); + switch_channel_execute_on(session->channel, "execute_on_audio_change"); + switch_core_session_unlock_codec_write(session); + switch_core_session_unlock_codec_read(session); } return status; From 16ee826e2b8172345aff12ac0c651c46791b5f67 Mon Sep 17 00:00:00 2001 From: surendrasignalwire <56929670+surendrasignalwire@users.noreply.github.com> Date: Sat, 21 Dec 2019 03:36:57 +0530 Subject: [PATCH 027/655] [mod_sofia] Url encode the sip_to_user before using in 200 ok contact --- src/mod/endpoints/mod_sofia/sofia.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7d8b2fe6eb..32ed268b7e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -10891,9 +10891,10 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (switch_channel_get_variable(channel, "sip_to_uri")) { const char *ipv6; const char *tmp, *at, *url = NULL; - + const char *tmp_user = switch_channel_get_variable(channel, "sip_to_user"); + + user = switch_core_session_url_encode(session, tmp_user); host = switch_channel_get_variable(channel, "sip_to_host"); - user = switch_channel_get_variable(channel, "sip_to_user"); switch_channel_set_variable(channel, "sip_to_comment", sip->sip_to->a_comment); From 21a536e774cfb389505831a8cfca72ec0e50564f Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 12 Mar 2020 22:01:56 +0800 Subject: [PATCH 028/655] [mod_video_filter] Disable waiting video ready which blocks the channel 10 seconds in early media --- src/mod/applications/mod_video_filter/mod_video_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3cd8c84ce9..613f8d9195 100644 --- a/src/mod/applications/mod_video_filter/mod_video_filter.c +++ b/src/mod/applications/mod_video_filter/mod_video_filter.c @@ -970,7 +970,7 @@ SWITCH_STANDARD_APP(video_replace_start_function) return; } - switch_channel_wait_for_flag(channel, CF_VIDEO_READY, SWITCH_TRUE, 10000, NULL); + // switch_channel_wait_for_flag(channel, CF_VIDEO_READY, SWITCH_TRUE, 10000, NULL); context = (video_replace_context_t *) switch_core_session_alloc(session, sizeof(*context)); switch_assert(context != NULL); From 3c5773719e1908a5a31102dd1001318225b9e447 Mon Sep 17 00:00:00 2001 From: phonecomwire <62449660+phonecomwire@users.noreply.github.com> Date: Fri, 24 Apr 2020 15:10:41 -0700 Subject: [PATCH 029/655] [Core] Adding fix for switch_ivr_originate to not copy group_confirm variables to the channel --- src/switch_ivr_originate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 2ae0919519..99370d7e79 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -830,6 +830,12 @@ static uint8_t check_channel_status(originate_global_t *oglobals, uint32_t len, } } else if (switch_channel_test_flag(oglobals->originate_status[i].peer_channel, CF_WINNER)) { + /* unset group_confirm variables */ + switch_channel_set_variable(oglobals->originate_status[i].peer_channel, "group_confirm_key", NULL); + switch_channel_set_variable(oglobals->originate_status[i].peer_channel, "group_confirm_file", NULL); + switch_channel_set_variable(oglobals->originate_status[i].peer_channel, "group_confirm_error_file", NULL); + switch_channel_set_variable(oglobals->originate_status[i].peer_channel, "group_confirm_cancel_timeout", NULL); + switch_channel_set_variable(oglobals->originate_status[i].peer_channel, "group_confirm_read_timeout", NULL); oglobals->idx = i; rval = 0; pindex = (uint32_t) i; From 9875e190aad74e47929703b1f9ceef144c7cd7c8 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 15 Apr 2020 10:36:32 +0800 Subject: [PATCH 030/655] [mod_av] enable resampler when sample rate mismatch (#153) --- src/mod/applications/mod_av/avformat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index ae7d2e840c..0b3a452325 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -702,7 +702,7 @@ GCC_DIAG_ON(deprecated-declarations) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "sample_rate: %d nb_samples: %d\n", mst->frame->sample_rate, mst->frame->nb_samples); - if (c->sample_fmt != AV_SAMPLE_FMT_S16) { + if (c->sample_fmt != AV_SAMPLE_FMT_S16 || c->sample_rate != mst->sample_rate) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "sample_fmt %d != AV_SAMPLE_FMT_S16, start resampler\n", c->sample_fmt); mst->resample_ctx = swr_alloc(); @@ -1231,7 +1231,7 @@ GCC_DIAG_ON(deprecated-declarations) context->audio_st[1].sample_rate = handle->samplerate; GCC_DIAG_OFF(deprecated-declarations) - if (context->audio_st[0].st->codec->sample_fmt != AV_SAMPLE_FMT_S16) { + if (context->audio_st[0].st->codec->sample_fmt != AV_SAMPLE_FMT_S16 || context->audio_st[0].st->codec->sample_rate != handle->samplerate) { GCC_DIAG_ON(deprecated-declarations) int x; for (x = 0; x < context->has_audio && x < 2 && c[x]; x++) { From 561a31d72374d81a7ce35701fb483334c8826fca Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sat, 25 Apr 2020 04:47:45 +0800 Subject: [PATCH 031/655] [mod_sndfile] fix read sndfiles with float data --- src/mod/formats/mod_sndfile/mod_sndfile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index 5d2962a8c4..0977a4950b 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -309,6 +309,12 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha sf_command(context->handle, SFC_FILE_TRUNCATE, &frames, sizeof(frames)); } + /* + http://www.mega-nerd.com/libsndfile/api.html#note2 + */ + if (switch_test_flag(handle, SWITCH_FILE_DATA_SHORT)) { + sf_command(context->handle, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE); + } end: From b774c5e23f99c419c4421629f93a29710563d5fe Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 28 Apr 2020 17:46:15 +0100 Subject: [PATCH 032/655] [core] eavesdrop: reduce lock contention, fix error condition + enable eavesdrop stereo --- src/include/switch_types.h | 3 ++- src/switch_ivr_async.c | 33 +++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 133422764b..2037889c01 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -353,7 +353,8 @@ typedef enum { ED_BRIDGE_READ = (1 << 4), ED_BRIDGE_WRITE = (1 << 5), ED_TAP_READ = (1 << 6), - ED_TAP_WRITE = (1 << 7) + ED_TAP_WRITE = (1 << 7), + ED_STEREO = (1 << 8) } switch_eavesdrop_flag_enum_t; typedef uint32_t switch_eavesdrop_flag_t; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 705142228c..cc5ec0581a 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2209,9 +2209,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session char cid_buf[1024] = ""; switch_caller_profile_t *cp = NULL; uint32_t sanity = 600; - switch_media_bug_flag_t read_flags = 0, write_flags = 0; + switch_media_bug_flag_t read_flags = 0, write_flags = 0, stereo_flag = 0; const char *vval; int buf_size = 0; + int channels; if (!switch_channel_media_up(channel)) { goto end; @@ -2280,8 +2281,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session ep = switch_core_session_alloc(session, sizeof(*ep)); - tlen = tread_impl.decoded_bytes_per_packet; - if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { goto end; @@ -2355,7 +2354,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session write_flags = SMBF_TAP_NATIVE_WRITE; read_flags = 0; } - + + if (flags & ED_STEREO) { + stereo_flag = SMBF_STEREO; + } if (switch_channel_test_flag(session->channel, CF_VIDEO) && switch_channel_test_flag(tsession->channel, CF_VIDEO)) { if ((vval = switch_channel_get_variable(session->channel, "eavesdrop_show_listener_video"))) { @@ -2384,7 +2386,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session if (switch_core_media_bug_add(tsession, "eavesdrop", uuid, eavesdrop_callback, ep, 0, - read_flags | write_flags | SMBF_READ_PING | SMBF_THREAD_LOCK | SMBF_NO_PAUSE, + read_flags | write_flags | SMBF_READ_PING | SMBF_THREAD_LOCK | SMBF_NO_PAUSE | stereo_flag, &bug) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot attach bug\n"); goto end; @@ -2561,18 +2563,27 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session switch_buffer_unlock(ep->w_buffer); } + channels = switch_core_media_bug_test_flag(bug, SMBF_STEREO) ? 2 : tread_impl.number_of_channels; + + if (channels == 0) { + channels = 1; + } + + tlen = tread_impl.decoded_bytes_per_packet * channels; + if (len > tlen) { len = tlen; } - if (ep->buffer && switch_buffer_inuse(ep->buffer) >= len) { - switch_buffer_lock(ep->buffer); + if (ep->buffer) { while (switch_buffer_inuse(ep->buffer) >= len) { int tchanged = 0, changed = 0; + switch_buffer_lock(ep->buffer); write_frame.datalen = (uint32_t) switch_buffer_read(ep->buffer, buf, len); - write_frame.samples = write_frame.datalen / 2; - + switch_buffer_unlock(ep->buffer); + write_frame.samples = write_frame.datalen / 2 / channels; + write_frame.channels = channels; switch_core_session_get_read_impl(tsession, &tread_impl); switch_core_session_get_read_impl(session, &read_impl); @@ -2606,7 +2617,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session tread_impl.actual_samples_per_second, tread_impl.number_of_channels); - tlen = tread_impl.decoded_bytes_per_packet; + tlen = tread_impl.decoded_bytes_per_packet * channels; if (len > tlen) { len = tlen; @@ -2624,7 +2635,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot init codec\n"); - switch_core_session_rwunlock(tsession); goto end; } } @@ -2646,7 +2656,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session break; } } - switch_buffer_unlock(ep->buffer); } } From bb6ec01d1e377572c5cc343bcf54678aec984548 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 12 May 2020 01:33:14 +0800 Subject: [PATCH 033/655] [mod_sofia] fix session log --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index e236b09a38..8ce1996ccb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5070,7 +5070,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session if (gateway_ptr && gateway_ptr->ob_vars) { switch_event_header_t *hp; for (hp = gateway_ptr->ob_vars->headers; hp; hp = hp->next) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n", switch_channel_get_name(nchannel), hp->name, hp->value); if (!strncmp(hp->name, "p:", 2)) { switch_channel_set_profile_var(nchannel, hp->name + 2, hp->value); From 09d4ec64338a32463577e8d7c48bf77cb0159418 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 19 May 2020 02:48:02 +0400 Subject: [PATCH 034/655] [Core] Fix multiple missing session unlocks in switch_core_media.c --- src/switch_core_media.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 0ae007ad90..d69e1286f5 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6791,6 +6791,7 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void } if (!(smh = session->media_handle)) { + switch_core_session_rwunlock(session); return NULL; } @@ -7301,12 +7302,14 @@ static void *SWITCH_THREAD_FUNC text_helper_thread(switch_thread_t *thread, void return NULL; } - mh->ready = 1; - if (!(smh = session->media_handle)) { + switch_core_session_rwunlock(session); + mh->ready = -1; return NULL; } + mh->ready = 1; + channel = switch_core_session_get_channel(session); if (switch_channel_var_true(session->channel, "fire_text_events")) { @@ -7460,12 +7463,14 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi return NULL; } - mh->ready = 1; - if (!(smh = session->media_handle)) { + switch_core_session_rwunlock(session); + mh->ready = -1; return NULL; } + mh->ready = 1; + channel = switch_core_session_get_channel(session); switch_core_autobind_cpu(); From a931220af6969edc0c9fda81e44efcf2867691b4 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 19 May 2020 19:55:36 +0400 Subject: [PATCH 035/655] [Core] Fix wrong switch_assert expressions in switch_core_session_write_frame() --- src/switch_core_media.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d69e1286f5..810306a91d 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -16018,7 +16018,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess session->write_codec->cur_frame = frame; frame->codec->cur_frame = frame; switch_assert(enc_frame->datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); - switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); + switch_assert(session->enc_write_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); status = switch_core_codec_encode(session->write_codec, frame->codec, enc_frame->data, @@ -16026,7 +16026,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess session->write_impl.actual_samples_per_second, session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag); - switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); + switch_assert(session->enc_write_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); session->write_codec->cur_frame = NULL; frame->codec->cur_frame = NULL; @@ -16128,7 +16128,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess session->write_codec->cur_frame = frame; frame->codec->cur_frame = frame; switch_assert(enc_frame->datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); - switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); + switch_assert(session->enc_write_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); status = switch_core_codec_encode(session->write_codec, frame->codec, enc_frame->data, @@ -16136,7 +16136,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess rate, session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag); - switch_assert(session->enc_read_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); + switch_assert(session->enc_write_frame.datalen <= SWITCH_RECOMMENDED_BUFFER_SIZE); session->write_codec->cur_frame = NULL; frame->codec->cur_frame = NULL; From 2dfda2f40947bb5c682e64f2756e774c4a7245f7 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 19 May 2020 20:29:25 +0400 Subject: [PATCH 036/655] [Core] Fix reference counter lock order when protect/unprotect interface. --- src/include/switch_module_interfaces.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index d49f7f3eb6..d347b1c7fb 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -854,8 +854,8 @@ struct switch_json_api_interface { struct switch_json_api_interface *next; }; -#define PROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); _it->refs++; _it->parent->refs++; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "+++++++++++LOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs); -#define UNPROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it->refs--; _it->parent->refs--; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "---------UNLOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs); +#define PROTECT_INTERFACE(_it) if (_it) {switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); switch_mutex_lock(_it->reflock); _it->refs++; _it->parent->refs++; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "+++++++++++LOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs); +#define UNPROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); _it->refs--; _it->parent->refs--; switch_mutex_unlock(_it->reflock); switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "---------UNLOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs); #include "switch_frame.h" From 7e2c9393dcdbf1620c39650cce6e0d21a7c1bf44 Mon Sep 17 00:00:00 2001 From: surendrasignalwire Date: Wed, 10 Jun 2020 20:09:01 +0400 Subject: [PATCH 037/655] [core] Fix ODBC column size performance issue --- src/switch_odbc.c | 57 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 31161ee158..9ea062d997 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -605,17 +605,66 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c for (x = 1; x <= c; x++) { SQLSMALLINT NameLength = 0, DataType = 0, DecimalDigits = 0, Nullable = 0; SQLULEN ColumnSize = 0; + SQLLEN numRecs = 0; + SQLCHAR SqlState[6], Msg[SQL_MAX_MESSAGE_LENGTH]; + SQLINTEGER NativeError; + SQLSMALLINT diagCount, MsgLen; names[y] = malloc(name_len); switch_assert(names[y]); memset(names[y], 0, name_len); SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT) name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable); - if (!ColumnSize) { + if (ColumnSize <= 16383 || ColumnSize == 2147483647) { SQLCHAR val[16384] = { 0 }; + SQLLEN StrLen_or_IndPtr; + SQLRETURN rc; ColumnSize = 16384; - SQLGetData(stmt, x, SQL_C_CHAR, val, ColumnSize, NULL); - vals[y] = strdup((char *)val); + + /* check diag record and see if we can get real size + * https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/using-sqlgetdiagrec-and-sqlgetdiagfield?view=sql-server-ver15 + * szSqlState = "01004" and StrLen_or_IndPtr=15794 + */ + rc = SQLGetData(stmt, x, SQL_C_CHAR, val, ColumnSize, &StrLen_or_IndPtr); + + if (rc == SQL_SUCCESS_WITH_INFO) { + int truncated = 0; + diagCount = 1; + + SQLGetDiagField(SQL_HANDLE_STMT, stmt, 0, SQL_DIAG_NUMBER, &numRecs, 0, 0); + + while (diagCount <= numRecs) { + SQLGetDiagRec(SQL_HANDLE_STMT, stmt, diagCount, SqlState, &NativeError,Msg, sizeof(Msg), &MsgLen); + if (!strcmp((char*)SqlState,"01004")){ + truncated = 1; + break; + } + + diagCount++; + } + + if (truncated) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sql data truncated - %s\n",SqlState); + if (StrLen_or_IndPtr && StrLen_or_IndPtr <= 268435456) { + ColumnSize = StrLen_or_IndPtr + 1; + vals[y] = malloc(ColumnSize); + switch_assert(vals[y]); + memset(vals[y], 0, ColumnSize); + SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData failed"); + vals[y] = NULL; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData failed"); + vals[y] = NULL; + } + } else if (rc == SQL_SUCCESS){ + vals[y] = strdup((char *)val); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData failed"); + vals[y] = NULL; + } } else { ColumnSize++; @@ -633,7 +682,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c for (x = 0; x < y; x++) { free(names[x]); - free(vals[x]); + switch_safe_free(vals[x]); } free(names); free(vals); From b5459fb5f558d79c7b87ac9d43f12d6eed3aceba Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sat, 13 Jun 2020 06:53:25 +0800 Subject: [PATCH 038/655] [mod_av] remove extra space --- src/mod/applications/mod_av/avcodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index f1a58cb7d7..01c862cf11 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -110,7 +110,7 @@ static void dump_encoder_ctx(AVCodecContext *ctx) #ifdef DUMP_ENCODER_CTX #define STRINGIFY(x) #x #define my_dump_int(x) switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, STRINGIFY(x) " = %d\n", ctx->x); -#define my_dump_int64(x) switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, STRINGIFY(x) " = % " SWITCH_INT64_T_FMT "\n", ctx->x); +#define my_dump_int64(x) switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, STRINGIFY(x) " = %" SWITCH_INT64_T_FMT "\n", ctx->x); #define my_dump_float(x) switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, STRINGIFY(x) " = %f\n", ctx->x); #define my_dump_enum(x) switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, STRINGIFY(x) " = %d\n", ctx->x); #define my_dump_uint(x) switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, STRINGIFY(x) " = 0x%x\n", ctx->x); From 034a7eea5edeb313f40ce10ac84fcd8570115776 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 17 Jun 2020 18:52:20 +0400 Subject: [PATCH 039/655] [mod_pgsql] Fix potential hang when calling PQconsumeInput() while checking if db_is_up(). --- src/mod/databases/mod_pgsql/mod_pgsql.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c index a534594548..b94b1abc73 100644 --- a/src/mod/databases/mod_pgsql/mod_pgsql.c +++ b/src/mod/databases/mod_pgsql/mod_pgsql.c @@ -113,6 +113,7 @@ static int db_is_up(switch_pgsql_handle_t *handle) int max_tries = DEFAULT_PGSQL_RETRIES; int code = 0; int recon = 0; + switch_byte_t sanity = 255; if (handle) { max_tries = handle->num_retries; @@ -132,10 +133,24 @@ top: } /* Try a non-blocking read on the connection to gobble up any EOF from a closed connection and mark the connection BAD if it is closed. */ - PQconsumeInput(handle->con); + while (--sanity > 0) + { + if (PQisBusy(handle->con)) { + PQconsumeInput(handle->con); + switch_yield(1); + continue; + } + break; + } + + if (!sanity) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Can not check DB Connection status: sanity = 0. Reconnecting...\n"); + goto reset; + } if (PQstatus(handle->con) == CONNECTION_BAD) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PQstatus returned bad connection; reconnecting...\n"); +reset: handle->state = SWITCH_PGSQL_STATE_ERROR; PQreset(handle->con); if (PQstatus(handle->con) == CONNECTION_BAD) { @@ -486,15 +501,13 @@ error: err_str = pgsql_handle_get_error(handle); if (zstr(err_str)) { - if (zstr(er)) { + if (!er) { err_str = strdup((char *)"SQL ERROR!"); } else { err_str = er; } } else { - if (!zstr(er)) { - free(er); - } + switch_safe_free(er); } if (err_str) { From cffc29927b45d4c36490d4e1b42f4df0761f439a Mon Sep 17 00:00:00 2001 From: surendrasignalwire <56929670+surendrasignalwire@users.noreply.github.com> Date: Fri, 10 Jul 2020 02:56:42 +0530 Subject: [PATCH 040/655] [Core] Fix crash while writing text_frame in conference --- src/switch_core_media.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 810306a91d..674c5b92f9 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -15502,6 +15502,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT]; + if (!t_engine || !t_engine->tf) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "text engine not available for processing\n"); + switch_goto_status(SWITCH_STATUS_BREAK, done); + } + if (!is_msrp && switch_channel_test_cap(session->channel, CC_RTP_RTT)) { if (frame) { From 23321373edfb5c568d5e604008ab5e3cbd43e5c1 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 7 Jul 2020 18:00:35 +0400 Subject: [PATCH 041/655] [Core] Fix double close of a socket in switch_rtp --- src/switch_rtp.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e7aafd0482..e2e6dedc2d 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2991,7 +2991,7 @@ static void ping_socket(switch_rtp_t *rtp_session) switch_size_t len = sizeof(o); switch_socket_sendto(rtp_session->sock_input, rtp_session->local_addr, 0, (void *) &o, &len); - if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && rtp_session->rtcp_sock_input) { + if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_input != rtp_session->sock_input) { switch_socket_sendto(rtp_session->rtcp_sock_input, rtp_session->rtcp_local_addr, 0, (void *) &o, &len); } } @@ -5077,11 +5077,11 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session) } if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) { - if (rtp_session->rtcp_sock_input) { + if (rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_input != rtp_session->sock_input) { ping_socket(rtp_session); switch_socket_shutdown(rtp_session->rtcp_sock_input, SWITCH_SHUTDOWN_READWRITE); } - if (rtp_session->rtcp_sock_output && rtp_session->rtcp_sock_output != rtp_session->rtcp_sock_input) { + if (rtp_session->rtcp_sock_output && rtp_session->rtcp_sock_output != rtp_session->sock_output && rtp_session->rtcp_sock_output != rtp_session->rtcp_sock_input) { switch_socket_shutdown(rtp_session->rtcp_sock_output, SWITCH_SHUTDOWN_READWRITE); } } @@ -5197,6 +5197,13 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session) free_dtls(&(*rtp_session)->rtcp_dtls); } + if ((*rtp_session)->rtcp_sock_input == (*rtp_session)->sock_input) { + (*rtp_session)->rtcp_sock_input = NULL; + } + + if ((*rtp_session)->rtcp_sock_output == (*rtp_session)->sock_output) { + (*rtp_session)->rtcp_sock_output = NULL; + } sock = (*rtp_session)->sock_input; (*rtp_session)->sock_input = NULL; @@ -5211,13 +5218,12 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session) if ((sock = (*rtp_session)->rtcp_sock_input)) { (*rtp_session)->rtcp_sock_input = NULL; switch_socket_close(sock); + } - if ((*rtp_session)->rtcp_sock_output && (*rtp_session)->rtcp_sock_output != sock) { - if ((sock = (*rtp_session)->rtcp_sock_output)) { - (*rtp_session)->rtcp_sock_output = NULL; - switch_socket_close(sock); - } - } + if ((*rtp_session)->rtcp_sock_output && (*rtp_session)->rtcp_sock_output != sock) { + sock = (*rtp_session)->rtcp_sock_output; + (*rtp_session)->rtcp_sock_output = NULL; + switch_socket_close(sock); } #ifdef ENABLE_SRTP From 167ab110064f45f9a52458b2300129d6f30e773a Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 17 Jul 2020 20:38:15 +0400 Subject: [PATCH 042/655] [mod_sofia] Fix potential leak of uuid in sofia_event_callback(). --- src/mod/endpoints/mod_sofia/sofia.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 32ed268b7e..7f7b0c2b75 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2435,11 +2435,16 @@ void sofia_event_callback(nua_event_t event, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "detaching session %s\n", sofia_private->uuid); if (!zstr(tech_pvt->call_id)) { + char *uuid = strdup(switch_core_session_get_uuid(session)); tech_pvt->sofia_private = NULL; tech_pvt->nh = NULL; sofia_set_flag(tech_pvt, TFLAG_BYE); switch_mutex_lock(profile->flag_mutex); - switch_core_hash_insert_auto_free(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session))); + + if (switch_core_hash_insert_auto_free(profile->chat_hash, tech_pvt->call_id, uuid) != SWITCH_STATUS_SUCCESS) { + switch_safe_free(uuid); + } + switch_mutex_unlock(profile->flag_mutex); nua_handle_destroy(nh); } else { From b220a05010679ca4760c32ec05bb4a601fc9831c Mon Sep 17 00:00:00 2001 From: surendrasignalwire <56929670+surendrasignalwire@users.noreply.github.com> Date: Thu, 23 Jul 2020 03:00:31 +0530 Subject: [PATCH 043/655] [Core] Fixed issue while setting mode on reinvite or outbound direction --- src/switch_core_media.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 674c5b92f9..4778edbf8c 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -4815,11 +4815,7 @@ static void switch_core_media_set_rmode(switch_core_session_t *session, switch_m if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { - if (!switch_channel_media_up(session->channel) && sdp_type == SDP_TYPE_REQUEST) { - engine->rmode = switch_core_session_remote_media_flow(other_session, type); - - media_flow_get_mode(engine->rmode, &rmode_str, &opp_rmode); - } else if (sdp_type == SDP_TYPE_RESPONSE && (switch_channel_test_flag(other_session->channel, CF_REINVITE) || switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND)) { + if (sdp_type == SDP_TYPE_RESPONSE && (switch_channel_test_flag(other_session->channel, CF_REINVITE) || switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND)) { switch_core_media_set_smode(other_session, type, rmode, sdp_type); } From f09ed875b95823e7a52c155e2152d9becb83f27f Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 24 Jul 2020 22:42:49 +0400 Subject: [PATCH 044/655] [Core] Fix buffer race in switch_ivr_eavesdrop_session() --- src/switch_ivr_async.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index cc5ec0581a..621836de00 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2576,12 +2576,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session } if (ep->buffer) { + switch_buffer_lock(ep->buffer); while (switch_buffer_inuse(ep->buffer) >= len) { int tchanged = 0, changed = 0; - switch_buffer_lock(ep->buffer); write_frame.datalen = (uint32_t) switch_buffer_read(ep->buffer, buf, len); - switch_buffer_unlock(ep->buffer); write_frame.samples = write_frame.datalen / 2 / channels; write_frame.channels = channels; @@ -2635,6 +2634,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot init codec\n"); + switch_buffer_unlock(ep->buffer); goto end; } } @@ -2655,7 +2655,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) { break; } + + switch_buffer_unlock(ep->buffer); + switch_buffer_lock(ep->buffer); } + + switch_buffer_unlock(ep->buffer); } } From 4fe8aecbfb3f96de4a8b7afddc1c22b61d771370 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 27 Jul 2020 21:41:13 +0400 Subject: [PATCH 045/655] [Core] Make switch_core_media_set_codec() and switch_core_media_set_video_codec() thread-safe so there is no race when a session's codec is initiated by different threads simultaneously. --- src/include/private/switch_core_pvt.h | 1 + src/switch_core_media.c | 27 +++++++++++++++++++-------- src/switch_core_session.c | 1 + 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index c3478f109e..68a8d9c463 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -132,6 +132,7 @@ struct switch_core_session { switch_mutex_t *mutex; switch_mutex_t *stack_count_mutex; switch_mutex_t *resample_mutex; + switch_mutex_t *codec_init_mutex; switch_mutex_t *codec_read_mutex; switch_mutex_t *codec_write_mutex; switch_mutex_t *video_codec_read_mutex; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 4778edbf8c..8173996e3d 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3587,24 +3587,27 @@ static void switch_core_session_parse_codec_settings(switch_core_session_t *sess //? SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_session_t *session, int force) { + switch_status_t status = SWITCH_STATUS_SUCCESS; switch_media_handle_t *smh; switch_rtp_engine_t *v_engine; switch_assert(session); + switch_mutex_lock(session->codec_init_mutex); + if (!(smh = session->media_handle)) { - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO]; if (!v_engine->codec_negotiated) { - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } if (v_engine->read_codec.implementation && switch_core_codec_ready(&v_engine->read_codec)) { if (!force) { - return SWITCH_STATUS_SUCCESS; + switch_goto_status(SWITCH_STATUS_SUCCESS, end); } if (strcasecmp(v_engine->read_codec.implementation->iananame, v_engine->cur_payload_map->rm_encoding) || v_engine->read_codec.implementation->samples_per_second != v_engine->cur_payload_map->rm_rate) { @@ -3616,7 +3619,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already using %s\n", v_engine->read_codec.implementation->iananame); - return SWITCH_STATUS_SUCCESS; + switch_goto_status(SWITCH_STATUS_SUCCESS, end); } } @@ -3632,7 +3635,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, &v_engine->codec_settings, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't load codec?\n"); - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } else { if (switch_core_codec_init(&v_engine->write_codec, v_engine->cur_payload_map->rm_encoding, @@ -3644,7 +3647,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, &v_engine->codec_settings, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't load codec?\n"); - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } else { v_engine->read_frame.rate = v_engine->cur_payload_map->rm_rate; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set VIDEO Codec %s %s/%ld %d ms\n", @@ -3685,7 +3688,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se switch_channel_set_variable_printf(session->channel, "rtp_use_video_codec_ptime", "%d", 0); } } - return SWITCH_STATUS_SUCCESS; + +end: + switch_mutex_unlock(session->codec_init_mutex); + + return status; } @@ -3698,9 +3705,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_ switch_rtp_engine_t *a_engine; switch_assert(session); + + switch_mutex_lock(session->codec_init_mutex); if (!(smh = session->media_handle)) { - return SWITCH_STATUS_FALSE; + switch_goto_status(SWITCH_STATUS_FALSE, end); } a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; @@ -3865,6 +3874,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_ switch_core_session_unlock_codec_read(session); } + switch_mutex_unlock(session->codec_init_mutex); + return status; } static void clear_ice(switch_core_session_t *session, switch_media_type_t type) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index ca58566b2f..36cf62f111 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2417,6 +2417,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ switch_mutex_init(&session->mutex, SWITCH_MUTEX_NESTED, session->pool); switch_mutex_init(&session->stack_count_mutex, SWITCH_MUTEX_NESTED, session->pool); switch_mutex_init(&session->resample_mutex, SWITCH_MUTEX_NESTED, session->pool); + switch_mutex_init(&session->codec_init_mutex, SWITCH_MUTEX_NESTED, session->pool); switch_mutex_init(&session->codec_read_mutex, SWITCH_MUTEX_NESTED, session->pool); switch_mutex_init(&session->codec_write_mutex, SWITCH_MUTEX_NESTED, session->pool); switch_mutex_init(&session->video_codec_read_mutex, SWITCH_MUTEX_NESTED, session->pool); From 785d92a5f52d91f428677032235f27cc0365a570 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 4 Aug 2020 23:06:59 +0400 Subject: [PATCH 046/655] [mod_pgsql] Prevent a stall of PQconsumeInput(). --- src/mod/databases/mod_pgsql/mod_pgsql.c | 150 +++++++++++++----------- 1 file changed, 83 insertions(+), 67 deletions(-) diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c index b94b1abc73..e2efa5252c 100644 --- a/src/mod/databases/mod_pgsql/mod_pgsql.c +++ b/src/mod/databases/mod_pgsql/mod_pgsql.c @@ -373,6 +373,20 @@ switch_status_t pgsql_handle_connect(switch_pgsql_handle_t *handle) return SWITCH_STATUS_FALSE; } + if (PQsetnonblocking(handle->con, 1) == -1) { + char *err_str; + + if ((err_str = pgsql_handle_get_error(handle))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err_str); + switch_safe_free(err_str); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to setup socket for the database [%s]\n", handle->dsn); + pgsql_handle_disconnect(handle); + } + + return SWITCH_STATUS_FALSE; + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Connected to [%s]\n", handle->dsn); handle->state = SWITCH_PGSQL_STATE_CONNECTED; handle->sock = PQsocket(handle->con); @@ -635,89 +649,91 @@ switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pg return SWITCH_STATUS_FALSE; } - /* Try to consume input that might be waiting right away */ - if (PQconsumeInput(handle->con)) { - /* And check to see if we have a full result ready for reading */ - if (PQisBusy(handle->con)) { + if (PQisBusy(handle->con)) { + /* Try to consume input that might be waiting right away */ + if (PQconsumeInput(handle->con)) { + /* And check to see if we have a full result ready for reading */ + if (PQisBusy(handle->con)) { - /* Wait for a result to become available, up to msec milliseconds */ - start = switch_micro_time_now(); - while ((ctime = switch_micro_time_now()) - start <= usec) { - switch_time_t wait_time = (usec - (ctime - start)) / 1000; - /* Wait for the PostgreSQL socket to be ready for data reads. */ + /* Wait for a result to become available, up to msec milliseconds */ + start = switch_micro_time_now(); + while ((ctime = switch_micro_time_now()) - start <= usec) { + switch_time_t wait_time = (usec - (ctime - start)) / 1000; + /* Wait for the PostgreSQL socket to be ready for data reads. */ #ifndef _WIN32 - fds[0].fd = handle->sock; - fds[0].events |= POLLIN; - fds[0].events |= POLLERR; - fds[0].events |= POLLNVAL; - fds[0].events |= POLLHUP; - fds[0].events |= POLLPRI; - fds[0].events |= POLLRDNORM; - fds[0].events |= POLLRDBAND; + fds[0].fd = handle->sock; + fds[0].events |= POLLIN; + fds[0].events |= POLLERR; + fds[0].events |= POLLNVAL; + fds[0].events |= POLLHUP; + fds[0].events |= POLLPRI; + fds[0].events |= POLLRDNORM; + fds[0].events |= POLLRDBAND; - poll_res = poll(&fds[0], 1, wait_time); + poll_res = poll(&fds[0], 1, wait_time); #else - struct timeval wait = { (long)wait_time * 1000, 0 }; - FD_ZERO(&rs); - FD_SET(handle->sock, &rs); - FD_ZERO(&es); - FD_SET(handle->sock, &es); - poll_res = select(0, &rs, 0, &es, &wait); + struct timeval wait = { (long)wait_time * 1000, 0 }; + FD_ZERO(&rs); + FD_SET(handle->sock, &rs); + FD_ZERO(&es); + FD_SET(handle->sock, &es); + poll_res = select(0, &rs, 0, &es, &wait); #endif - if (poll_res > 0) { + if (poll_res > 0) { #ifndef _WIN32 - if (fds[0].revents & POLLHUP || fds[0].revents & POLLNVAL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "PGSQL socket closed or invalid while waiting for result for query (%s)\n", handle->sql); - goto error; - } else if (fds[0].revents & POLLERR) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Poll error trying to read PGSQL socket for query (%s)\n", handle->sql); - goto error; - } else if (fds[0].revents & POLLIN || fds[0].revents & POLLPRI || fds[0].revents & POLLRDNORM || fds[0].revents & POLLRDBAND) { + if (fds[0].revents & POLLHUP || fds[0].revents & POLLNVAL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "PGSQL socket closed or invalid while waiting for result for query (%s)\n", handle->sql); + goto error; + } else if (fds[0].revents & POLLERR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Poll error trying to read PGSQL socket for query (%s)\n", handle->sql); + goto error; + } else if (fds[0].revents & POLLIN || fds[0].revents & POLLPRI || fds[0].revents & POLLRDNORM || fds[0].revents & POLLRDBAND) { #else - if (FD_ISSET(handle->sock, &rs)) { + if (FD_ISSET(handle->sock, &rs)) { #endif - /* Then try to consume any input waiting. */ - if (PQconsumeInput(handle->con)) { - if (PQstatus(handle->con) == CONNECTION_BAD) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Connection terminated while waiting for result.\n"); - handle->state = SWITCH_PGSQL_STATE_ERROR; + /* Then try to consume any input waiting. */ + if (PQconsumeInput(handle->con)) { + if (PQstatus(handle->con) == CONNECTION_BAD) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Connection terminated while waiting for result.\n"); + handle->state = SWITCH_PGSQL_STATE_ERROR; + goto error; + } + + /* And check to see if we have a full result ready for reading */ + if (!PQisBusy(handle->con)) { + /* If we can pull a full result without blocking, then break this loop */ + break; + } + } else { + /* If we had an error trying to consume input, report it and cancel the query. */ + err_str = pgsql_handle_get_error(handle); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "An error occurred trying to consume input for query (%s): %s\n", handle->sql, err_str); + switch_safe_free(err_str); + pgsql_cancel(handle); goto error; } - - /* And check to see if we have a full result ready for reading */ - if (!PQisBusy(handle->con)) { - /* If we can pull a full result without blocking, then break this loop */ - break; - } - } else { - /* If we had an error trying to consume input, report it and cancel the query. */ - err_str = pgsql_handle_get_error(handle); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "An error occurred trying to consume input for query (%s): %s\n", handle->sql, err_str); - switch_safe_free(err_str); - pgsql_cancel(handle); - goto error; } + } else if (poll_res == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Poll failed trying to read PGSQL socket for query (%s)\n", handle->sql); + goto error; } - } else if (poll_res == -1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Poll failed trying to read PGSQL socket for query (%s)\n", handle->sql); + } + + /* If we broke the loop above because of a timeout, report that and cancel the query. */ + if (ctime - start > usec) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Query (%s) took too long to complete or database not responding.\n", handle->sql); + pgsql_cancel(handle); goto error; } } - - /* If we broke the loop above because of a timeout, report that and cancel the query. */ - if (ctime - start > usec) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Query (%s) took too long to complete or database not responding.\n", handle->sql); - pgsql_cancel(handle); - goto error; - } + } else { + /* If we had an error trying to consume input, report it and cancel the query. */ + err_str = pgsql_handle_get_error(handle); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "An error occurred trying to consume input for query (%s): %s\n", handle->sql, err_str); + switch_safe_free(err_str); + /* pgsql_cancel(handle); */ + goto error; } - } else { - /* If we had an error trying to consume input, report it and cancel the query. */ - err_str = pgsql_handle_get_error(handle); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "An error occurred trying to consume input for query (%s): %s\n", handle->sql, err_str); - switch_safe_free(err_str); - /* pgsql_cancel(handle); */ - goto error; } /* At this point, we know we can read a full result without blocking. */ From 1fee1fc6adcdad2808716ed99d03831724349f01 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 12 Aug 2020 21:53:06 +0400 Subject: [PATCH 047/655] [Core] Fix SDP parsing causing segfault. --- src/switch_core_media.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 8173996e3d..23e77047b9 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -9051,6 +9051,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi // goto video; //} + if (!t_engine->cur_payload_map) { + goto text_up; + } + if (switch_channel_test_flag(session->channel, CF_TEXT_POSSIBLE) && t_engine->cur_payload_map->rm_encoding && t_engine->cur_payload_map->remote_sdp_port) { /******************************************************************************************/ if (t_engine->rtp_session && is_reinvite) { From 7b8a36c2a98281e2c31db1c908842a327d2cfdca Mon Sep 17 00:00:00 2001 From: surendrasignalwire Date: Thu, 13 Aug 2020 14:49:47 +0400 Subject: [PATCH 048/655] [mod_sofia] Fix recovery reinvite issue --- src/mod/endpoints/mod_sofia/sofia.c | 9 +++++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 11 +++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7f7b0c2b75..4975ca8feb 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1733,6 +1733,10 @@ static void our_sofia_event_callback(nua_event_t event, switch_channel_set_variable(channel, "sip_call_id", sip->sip_call_id->i_id); } + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + switch_channel_set_variable(channel, "dlg_req_swap_direction", "true"); + } + extract_header_vars(profile, sip, session, nh); switch_core_recovery_track(session); sofia_set_flag(tech_pvt, TFLAG_GOT_ACK); @@ -7111,8 +7115,13 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { + switch_channel_set_variable(channel, "dlg_req_swap_direction", "true"); + } + extract_header_vars(profile, sip, session, nh); extract_vars(profile, sip, session); + switch_core_recovery_track(session); switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING); } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index a49bd998a9..2eea09bd5e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2235,7 +2235,7 @@ int sofia_recover_callback(switch_core_session_t *session) const char *rr; int r = 0; const char *profile_name = switch_channel_get_variable_dup(channel, "recovery_profile_name", SWITCH_FALSE, -1); - + int swap = switch_channel_var_true(channel, "dlg_req_swap_direction"); if (zstr(profile_name)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Missing profile\n"); @@ -2275,10 +2275,9 @@ int sofia_recover_callback(switch_core_session_t *session) rr = switch_channel_get_variable(channel, "sip_invite_record_route"); if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - int break_rfc = switch_true(switch_channel_get_variable(channel, "sip_recovery_break_rfc")); tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_req_uri")); - switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, break_rfc ? "sip_full_to" : "sip_full_from")); - switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, break_rfc ? "sip_full_from" : "sip_full_to")); + switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, swap ? "sip_full_to" : "sip_full_from")); + switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, swap ? "sip_full_from" : "sip_full_to")); } else { const char *contact_params = switch_channel_get_variable(channel, "sip_contact_params"); const char *contact_uri = switch_channel_get_variable(channel, "sip_contact_uri"); @@ -2297,11 +2296,11 @@ int sofia_recover_callback(switch_core_session_t *session) tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri")); if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE, -1)) { - switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_to")); + switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, swap ? "sip_full_from" :"sip_full_to")); } if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE, -1)) { - switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_from")); + switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, swap ? "sip_full_to" : "sip_full_from")); } } From 3509ae537e944b967d29f23340baf358ade4314c Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Thu, 17 Sep 2020 00:20:17 +0300 Subject: [PATCH 049/655] [core] native tap fix (pass the copy of the frame to switch_core_session_write_frame() so it does not get encoded) --- src/switch_ivr_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 621836de00..a6972e847c 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2084,7 +2084,7 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data memcpy(frame.data, nframe->data, nframe->datalen); - if (switch_core_session_write_frame(ep->eavesdropper, nframe, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + if (switch_core_session_write_frame(ep->eavesdropper, &frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { return SWITCH_FALSE; } } From 5aabb54f68f495bfd51c083bd89d4fdaa1a9ba6c Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Fri, 4 Sep 2020 08:57:28 +0000 Subject: [PATCH 050/655] [core] eavesdrop: init L16 codec at right ptime in certain conditions. [core] eavesdrop: avoid eavesdropping on itself and return error. [core] eavesdrop: adjust buffer operations for ptime mismatch and for when ptimes are the same. [core] eavesdrop: add buffering based on LCM (Least Common Multiple) when ptime mismatch, and have audio write thread enabled when ptime eavesdropee < ptime eavesdropper. [unit-tests] add unit-tests for eavesdrop. --- src/switch_ivr_async.c | 113 +++++- tests/unit/Makefile.am | 5 + tests/unit/conf_eavesdrop/freeswitch.xml | 238 +++++++++++++ tests/unit/conf_eavesdrop/gw/eavestest.xml | 14 + tests/unit/switch_eavesdrop.c | 392 +++++++++++++++++++++ 5 files changed, 743 insertions(+), 19 deletions(-) create mode 100644 tests/unit/conf_eavesdrop/freeswitch.xml create mode 100644 tests/unit/conf_eavesdrop/gw/eavestest.xml create mode 100644 tests/unit/switch_eavesdrop.c diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index a6972e847c..07f28a36e8 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2184,6 +2184,25 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_update_display(switch_core_ return status; } +/*Greatest Common Divisor*/ +static uint32_t switch_gcd(uint32_t x, uint32_t y) +{ + if (y == 0) { + return x; + } + + return switch_gcd(y, x % y); +} + +/*Least Common Multiple*/ +static uint32_t switch_lcm(uint32_t x, uint32_t y) +{ + uint32_t gcd = switch_gcd(x, y); + + if (gcd) return (x * y) / gcd; + + return 0; +} SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session, const char *uuid, const char *require_group, switch_eavesdrop_flag_t flags) @@ -2213,11 +2232,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session const char *vval; int buf_size = 0; int channels; + int lcm, buff_min_len, buffered = 1; if (!switch_channel_media_up(channel)) { goto end; } + if (tsession == session) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Eavesdrop target invalid.\n"); + goto end; + } + while(switch_channel_state_change_pending(tchannel) || !switch_channel_media_up(tchannel)) { switch_yield(10000); if (!--sanity) break; @@ -2286,8 +2311,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session goto end; } - - if (switch_core_codec_init(&codec, + if (tread_impl.decoded_bytes_per_packet < read_impl.decoded_bytes_per_packet) { + if (switch_core_codec_init(&codec, + "L16", + NULL, + NULL, + read_impl.actual_samples_per_second, + read_impl.microseconds_per_packet / 1000, + read_impl.number_of_channels, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot init codec\n"); + goto end; + } + } else { + if (switch_core_codec_init(&codec, "L16", NULL, NULL, @@ -2298,10 +2336,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot init codec\n"); goto end; + } + buffered = 0; } - switch_core_session_get_read_impl(session, &read_impl); - ep->read_impl = read_impl; ep->tread_impl = tread_impl; @@ -2440,6 +2478,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session switch_core_session_receive_message(tsession, &msg); } + lcm = switch_lcm(tread_impl.decoded_bytes_per_packet, read_impl.decoded_bytes_per_packet); + while (switch_channel_up_nosig(tchannel) && switch_channel_ready(channel)) { uint32_t len = sizeof(buf); switch_event_t *event = NULL; @@ -2569,15 +2609,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session channels = 1; } - tlen = tread_impl.decoded_bytes_per_packet * channels; + tlen = ep->read_impl.decoded_bytes_per_packet * channels; if (len > tlen) { len = tlen; } + if (buffered) { + buff_min_len = lcm * 2; + if (switch_buffer_inuse(ep->buffer) < buff_min_len) { + continue; + } + } else { + buff_min_len = len; + } + if (ep->buffer) { switch_buffer_lock(ep->buffer); - while (switch_buffer_inuse(ep->buffer) >= len) { + while (switch_buffer_inuse(ep->buffer) >= buff_min_len) { int tchanged = 0, changed = 0; write_frame.datalen = (uint32_t) switch_buffer_read(ep->buffer, buf, len); @@ -2592,7 +2641,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session tchanged = 1; } - if (read_impl.number_of_channels != ep->tread_impl.number_of_channels || + if (read_impl.number_of_channels != ep->read_impl.number_of_channels || read_impl.actual_samples_per_second != ep->read_impl.actual_samples_per_second) { changed = 1; } @@ -2606,6 +2655,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session ep->read_impl.number_of_channels, read_impl.actual_samples_per_second, read_impl.number_of_channels); + + tlen = read_impl.decoded_bytes_per_packet * channels; + + if (len > tlen) { + len = tlen; + } + } if (tchanged) { @@ -2615,28 +2671,44 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session ep->tread_impl.number_of_channels, tread_impl.actual_samples_per_second, tread_impl.number_of_channels); + } + - tlen = tread_impl.decoded_bytes_per_packet * channels; - - if (len > tlen) { - len = tlen; - } - - switch_core_codec_destroy(&codec); + switch_core_codec_destroy(&codec); + if (tread_impl.decoded_bytes_per_packet < read_impl.decoded_bytes_per_packet) { if (switch_core_codec_init(&codec, "L16", NULL, NULL, - tread_impl.actual_samples_per_second, - tread_impl.microseconds_per_packet / 1000, - tread_impl.number_of_channels, + read_impl.actual_samples_per_second, + read_impl.microseconds_per_packet / 1000, + read_impl.number_of_channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot init codec\n"); + switch_buffer_unlock(ep->buffer); + goto end; + } + buffered = 1; + lcm = switch_lcm(tread_impl.decoded_bytes_per_packet, read_impl.decoded_bytes_per_packet); + } else { + if (switch_core_codec_init(&codec, + "L16", + NULL, + NULL, + tread_impl.actual_samples_per_second, + tread_impl.microseconds_per_packet / 1000, + tread_impl.number_of_channels, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot init codec\n"); switch_buffer_unlock(ep->buffer); goto end; } + if (buffered == 1) { + buffered = 0; + } } ep->read_impl = read_impl; @@ -2658,11 +2730,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session switch_buffer_unlock(ep->buffer); switch_buffer_lock(ep->buffer); - } + if (ep->tread_impl.decoded_bytes_per_packet == ep->read_impl.decoded_bytes_per_packet) { + /* push just the number of samples worth of a packet. */ + break; + } + } switch_buffer_unlock(ep->buffer); } - } end_loop: diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 6e7e128d62..2511a143c2 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -7,8 +7,13 @@ noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_core_asr AM_LDFLAGS += -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS) AM_LDFLAGS += $(FREESWITCH_LIBS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) +# "make check" will not run these. +examples = switch_eavesdrop + if HAVE_FVAD AM_CFLAGS += -DSWITCH_HAVE_FVAD endif TESTS = $(noinst_PROGRAMS) + +bin_PROGRAMS = $(examples) diff --git a/tests/unit/conf_eavesdrop/freeswitch.xml b/tests/unit/conf_eavesdrop/freeswitch.xml new file mode 100644 index 0000000000..4a65caf6d8 --- /dev/null +++ b/tests/unit/conf_eavesdrop/freeswitch.xml @@ -0,0 +1,238 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/tests/unit/conf_eavesdrop/gw/eavestest.xml b/tests/unit/conf_eavesdrop/gw/eavestest.xml new file mode 100644 index 0000000000..a2f268424e --- /dev/null +++ b/tests/unit/conf_eavesdrop/gw/eavestest.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/unit/switch_eavesdrop.c b/tests/unit/switch_eavesdrop.c new file mode 100644 index 0000000000..867ad7a6bc --- /dev/null +++ b/tests/unit/switch_eavesdrop.c @@ -0,0 +1,392 @@ +#include +#include +#include + +static switch_memory_pool_t *pool = NULL; + +static switch_status_t test_detect_long_tone_in_file(const char *filepath, int rate, int freq, int ptime) { + teletone_multi_tone_t mt; + teletone_tone_map_t map; + int16_t data[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + size_t len = (rate * ptime / 1000) /*packet len in samples */ * 8; /*length of chunk that must contain tone*/ + size_t fin = 0; + switch_status_t status; + switch_file_handle_t fh = { 0 }; + uint8_t fail = 0, gaps = 0, audio = 0; + uint32_t pos = 0; + size_t full_len = 0; + + status = switch_core_file_open(&fh, filepath, 1, rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL); + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open file [%s]\n", filepath); + return SWITCH_STATUS_FALSE; + } + + mt.sample_rate = rate; + map.freqs[0] = (teletone_process_t)freq; + + teletone_multi_tone_init(&mt, &map); + + len = (rate * 2 / 100) /*packet len in samples */ * 8; + + while (switch_core_file_read(&fh, &data, &len) == SWITCH_STATUS_SUCCESS) { + fin += len; + /*skip silence at the beginning of the file, 1 second max. */ + if (!teletone_multi_tone_detect(&mt, data, len)) { + if ((fin > rate && !audio) || gaps > 30) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many gaps in audio or no tone detected 1st second. [%u][%d]\n", fin, gaps); + fail = 1; + break; + } + gaps++; + continue; + } else { + audio++; + } + } + + switch_core_file_close(&fh); + + if (fail) { + return SWITCH_STATUS_FALSE; + } + return SWITCH_STATUS_SUCCESS; +} + +FST_CORE_BEGIN("./conf_eavesdrop") + +{ +FST_SUITE_BEGIN(switch_eavesdrop) +{ + FST_SETUP_BEGIN() + { + fst_requires_module("mod_loopback"); + fst_requires_module("mod_sofia"); + switch_core_set_variable("link_ip", switch_core_get_variable("local_ip_v4")); + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(test_eavesdrop_bridged_same_ptime_20ms) + { + switch_core_session_t *session1 = NULL; + switch_core_session_t *session2 = NULL; + switch_core_session_t *session3 = NULL; + + switch_channel_t *channel1 = NULL; + switch_channel_t *channel2 = NULL; + switch_channel_t *channel3 = NULL; + + switch_status_t status; + switch_call_cause_t cause; + switch_stream_handle_t stream = { 0 }; + char eavesdrop_command[256] = { 0 }; + char rec_path[256]; + char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; + char eaves_dialstr[256] = { 0 }; + + switch_uuid_str(rec_uuid, sizeof(rec_uuid)); + + /*parked 20 ms ptime */ + status = switch_ivr_originate(NULL, &session1, &cause, "{ignore_early_media=true}sofia/gateway/eavestest/+15553332220", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session1); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel1 = switch_core_session_get_channel(session1); + fst_requires(channel1); + + snprintf(eaves_dialstr, sizeof(eaves_dialstr), "{ignore_early_media=true}{sip_h_X-UnitTestRecfile=%s}sofia/gateway/eavestest/+15553332230", rec_uuid); + + /*eavesdropper 20 ms ptime*/ + status = switch_ivr_originate(NULL, &session2, &cause, eaves_dialstr, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session2); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel2 = switch_core_session_get_channel(session2); + fst_requires(channel2); + + /*milliwatt tone 20 ms ptime*/ + status = switch_ivr_originate(NULL, &session3, &cause, "{ignore_early_media=true}sofia/gateway/eavestest/+15553332226", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session3); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel3 = switch_core_session_get_channel(session3); + fst_requires(channel3); + + SWITCH_STANDARD_STREAM(stream); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_bridge %s %s", switch_core_session_get_uuid(session1), switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session1, &stream); + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command),"uuid_setvar_multi %s eavesdrop_enable_dtmf=false;eavesdrop_whisper_bleg=true;eavesdrop_whisper_aleg=false", switch_core_session_get_uuid(session3)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_transfer %s 'eavesdrop:%s' inline", switch_core_session_get_uuid(session3), switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + switch_safe_free(stream.data); + + sleep(5); // it will record ~ 5 secs + + snprintf(rec_path, sizeof(rec_path), "/tmp/eaves-%s.wav", rec_uuid); + + fst_requires(switch_file_exists(rec_path, fst_pool) == SWITCH_STATUS_SUCCESS); + + fst_requires(test_detect_long_tone_in_file(rec_path, 8000, 300, 20) == SWITCH_STATUS_SUCCESS); + + unlink(rec_path); + + switch_channel_hangup(channel1, SWITCH_CAUSE_NORMAL_CLEARING); + switch_channel_hangup(channel2, SWITCH_CAUSE_NORMAL_CLEARING); + switch_channel_hangup(channel3, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session1); + switch_core_session_rwunlock(session2); + switch_core_session_rwunlock(session3); + + } + FST_TEST_END() + + FST_TEST_BEGIN(test_eavesdrop_bridged_ptime_mismatch_20ms_30ms) + { + switch_core_session_t *session1 = NULL; + switch_core_session_t *session2 = NULL; + switch_core_session_t *session3 = NULL; + + switch_channel_t *channel1 = NULL; + switch_channel_t *channel2 = NULL; + switch_channel_t *channel3 = NULL; + + switch_status_t status; + switch_call_cause_t cause; + switch_stream_handle_t stream = { 0 }; + char eavesdrop_command[256] = { 0 }; + char rec_path[256]; + char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; + char eaves_dialstr[256] = { 0 }; + + switch_uuid_str(rec_uuid, sizeof(rec_uuid)); + + /*parked 20 ms ptime */ + status = switch_ivr_originate(NULL, &session1, &cause, "{ignore_early_media=true}sofia/gateway/eavestest/+15553332220", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session1); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel1 = switch_core_session_get_channel(session1); + fst_requires(channel1); + + snprintf(eaves_dialstr, sizeof(eaves_dialstr), "{ignore_early_media=true}{sip_h_X-UnitTestRecfile=%s}sofia/gateway/eavestest/+15553332230", rec_uuid); + + /*eavesdropper 20 ms ptime*/ + status = switch_ivr_originate(NULL, &session2, &cause, eaves_dialstr, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session2); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel2 = switch_core_session_get_channel(session2); + fst_requires(channel2); + + /*milliwatt tone 30 ms ptime*/ + status = switch_ivr_originate(NULL, &session3, &cause, "{ignore_early_media=true}sofia/gateway/eavestest/+15553332222", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session3); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel3 = switch_core_session_get_channel(session3); + fst_requires(channel3); + + SWITCH_STANDARD_STREAM(stream); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_bridge %s %s", switch_core_session_get_uuid(session1), switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session1, &stream); + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command),"uuid_setvar_multi %s eavesdrop_enable_dtmf=false;eavesdrop_whisper_bleg=true;eavesdrop_whisper_aleg=false", switch_core_session_get_uuid(session3)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_transfer %s 'eavesdrop:%s' inline", switch_core_session_get_uuid(session3), switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + switch_safe_free(stream.data); + + sleep(5); // it will record ~ 5 secs + + snprintf(rec_path, sizeof(rec_path), "/tmp/eaves-%s.wav", rec_uuid); + + fst_requires(switch_file_exists(rec_path, fst_pool) == SWITCH_STATUS_SUCCESS); + + fst_requires(test_detect_long_tone_in_file(rec_path, 8000, 300, 20) == SWITCH_STATUS_SUCCESS); + + unlink(rec_path); + + switch_channel_hangup(channel1, SWITCH_CAUSE_NORMAL_CLEARING); + switch_channel_hangup(channel2, SWITCH_CAUSE_NORMAL_CLEARING); + switch_channel_hangup(channel3, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session1); + switch_core_session_rwunlock(session2); + switch_core_session_rwunlock(session3); + + } + FST_TEST_END() + + FST_TEST_BEGIN(test_eavesdrop_bridged_ptime_mismatch_30ms_20ms) + { + switch_core_session_t *session1 = NULL; + switch_core_session_t *session2 = NULL; + switch_core_session_t *session3 = NULL; + + switch_channel_t *channel1 = NULL; + switch_channel_t *channel2 = NULL; + switch_channel_t *channel3 = NULL; + + switch_status_t status; + switch_call_cause_t cause; + switch_stream_handle_t stream = { 0 }; + char eavesdrop_command[256] = { 0 }; + char rec_path[256]; + char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; + char eaves_dialstr[256] = { 0 }; + + switch_uuid_str(rec_uuid, sizeof(rec_uuid)); + + /*parked 30 ms ptime */ + status = switch_ivr_originate(NULL, &session1, &cause, "{ignore_early_media=true}sofia/gateway/eavestest/+15553332231", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session1); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel1 = switch_core_session_get_channel(session1); + fst_requires(channel1); + + snprintf(eaves_dialstr, sizeof(eaves_dialstr), "{ignore_early_media=true}{sip_h_X-UnitTestRecfile=%s}sofia/gateway/eavestest/+15553332240", rec_uuid); + + /*eavesdropper 30 ms ptime*/ + status = switch_ivr_originate(NULL, &session2, &cause, eaves_dialstr, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session2); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel2 = switch_core_session_get_channel(session2); + fst_requires(channel2); + + /*milliwatt tone 20 ms ptime*/ + status = switch_ivr_originate(NULL, &session3, &cause, "{ignore_early_media=true}sofia/gateway/eavestest/+15553332226", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session3); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel3 = switch_core_session_get_channel(session3); + fst_requires(channel3); + + SWITCH_STANDARD_STREAM(stream); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_bridge %s %s", switch_core_session_get_uuid(session1), switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session1, &stream); + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command),"uuid_setvar_multi %s eavesdrop_enable_dtmf=false;eavesdrop_whisper_bleg=true;eavesdrop_whisper_aleg=false", switch_core_session_get_uuid(session3)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_transfer %s 'eavesdrop:%s' inline", switch_core_session_get_uuid(session3), switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + switch_safe_free(stream.data); + + sleep(5); // it will record ~ 5 secs + + snprintf(rec_path, sizeof(rec_path), "/tmp/eaves-%s.wav", rec_uuid); + + fst_requires(switch_file_exists(rec_path, fst_pool) == SWITCH_STATUS_SUCCESS); + + fst_requires(test_detect_long_tone_in_file(rec_path, 8000, 300, 30) == SWITCH_STATUS_SUCCESS); + + unlink(rec_path); + + switch_channel_hangup(channel1, SWITCH_CAUSE_NORMAL_CLEARING); + switch_channel_hangup(channel2, SWITCH_CAUSE_NORMAL_CLEARING); + switch_channel_hangup(channel3, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session1); + switch_core_session_rwunlock(session2); + switch_core_session_rwunlock(session3); + + } + FST_TEST_END() + + FST_TEST_BEGIN(test_eavesdrop_bridged_ptime_mismatch_reneg) + { + switch_core_session_t *session1 = NULL; + switch_core_session_t *session2 = NULL; + switch_core_session_t *session3 = NULL; + + switch_channel_t *channel1 = NULL; + switch_channel_t *channel2 = NULL; + switch_channel_t *channel3 = NULL; + + switch_status_t status; + switch_call_cause_t cause; + switch_stream_handle_t stream = { 0 }; + char eavesdrop_command[256] = { 0 }; + char rec_path[256]; + char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; + char eaves_dialstr[256] = { 0 }; + + switch_uuid_str(rec_uuid, sizeof(rec_uuid)); + + /*parked 30 ms ptime */ + status = switch_ivr_originate(NULL, &session1, &cause, "{ignore_early_media=true}sofia/gateway/eavestest/+15553332231", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session1); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel1 = switch_core_session_get_channel(session1); + fst_requires(channel1); + + snprintf(eaves_dialstr, sizeof(eaves_dialstr), "{ignore_early_media=true}{sip_h_X-UnitTestRecfile=%s}sofia/gateway/eavestest/+15553332240", rec_uuid); + + /*eavesdropper 30 ms ptime*/ + status = switch_ivr_originate(NULL, &session2, &cause, eaves_dialstr, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session2); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel2 = switch_core_session_get_channel(session2); + fst_requires(channel2); + + /*milliwatt tone 20 ms ptime*/ + status = switch_ivr_originate(NULL, &session3, &cause, "{ignore_early_media=true}sofia/gateway/eavestest/+15553332226", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session3); + fst_check(status == SWITCH_STATUS_SUCCESS); + channel3 = switch_core_session_get_channel(session3); + fst_requires(channel3); + + SWITCH_STANDARD_STREAM(stream); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_bridge %s %s", switch_core_session_get_uuid(session1), switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session1, &stream); + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command),"uuid_setvar_multi %s eavesdrop_enable_dtmf=false;eavesdrop_whisper_bleg=true;eavesdrop_whisper_aleg=false", switch_core_session_get_uuid(session3)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_transfer %s 'eavesdrop:%s' inline", switch_core_session_get_uuid(session3), switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + + sleep(2); + + // codec reneg for eavesdropper + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_media_reneg %s = PCMU@20i", switch_core_session_get_uuid(session2)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + + sleep(1); + + // codec reneg for eavesdroppee + memset(eavesdrop_command, 0, sizeof(eavesdrop_command)); + switch_snprintf(eavesdrop_command, sizeof(eavesdrop_command), "uuid_media_reneg %s = PCMU@30i", switch_core_session_get_uuid(session3)); + switch_api_execute("bgapi", eavesdrop_command, session3, &stream); + switch_safe_free(stream.data); + + sleep(2); + + snprintf(rec_path, sizeof(rec_path), "/tmp/eaves-%s.wav", rec_uuid); + + fst_requires(switch_file_exists(rec_path, fst_pool) == SWITCH_STATUS_SUCCESS); + + fst_requires(test_detect_long_tone_in_file(rec_path, 8000, 300, 30) == SWITCH_STATUS_SUCCESS); + + unlink(rec_path); + + switch_channel_hangup(channel1, SWITCH_CAUSE_NORMAL_CLEARING); + switch_channel_hangup(channel2, SWITCH_CAUSE_NORMAL_CLEARING); + switch_channel_hangup(channel3, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session1); + switch_core_session_rwunlock(session2); + switch_core_session_rwunlock(session3); + + } + FST_TEST_END() + +} +FST_SUITE_END() +} +FST_CORE_END() + From dbc894d95912d903ed5e5a7acccdea1c03e0b10f Mon Sep 17 00:00:00 2001 From: surendrasignalwire <56929670+surendrasignalwire@users.noreply.github.com> Date: Tue, 29 Sep 2020 20:40:33 +0530 Subject: [PATCH 051/655] [Core] Reuse caller profile --- src/include/switch_types.h | 2 ++ src/mod/applications/mod_dptools/mod_dptools.c | 8 ++++++++ src/switch_ivr.c | 11 +++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 2037889c01..79ef9caa26 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1416,6 +1416,7 @@ CF_HOLD_BLEG - B leg is on hold CF_SERVICE - Channel has a service thread CF_TAGGED - Channel is tagged CF_WINNER - Channel is the winner +CF_REUSE_CALLER_PROFILE - Channel reuse caller profile CF_CONTROLLED - Channel is under control CF_PROXY_MODE - Channel has no media CF_SUSPEND - Suspend i/o @@ -1468,6 +1469,7 @@ typedef enum { CF_SERVICE, CF_TAGGED, CF_WINNER, + CF_REUSE_CALLER_PROFILE, CF_CONTROLLED, CF_PROXY_MODE, CF_PROXY_OFF, diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f891c6a513..43329eb006 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1150,6 +1150,13 @@ SWITCH_STANDARD_APP(break_function) } } +SWITCH_STANDARD_APP(reuse_caller_profile_function) +{ + switch_channel_t *channel; + channel = switch_core_session_get_channel(session); + switch_channel_set_flag(channel, CF_REUSE_CALLER_PROFILE); +} + SWITCH_STANDARD_APP(queue_dtmf_function) { switch_channel_queue_dtmf_string(switch_core_session_get_channel(session), (const char *) data); @@ -6551,6 +6558,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "recovery_refresh", "Send call recovery_refresh", "Send a call recovery_refresh.", recovery_refresh_function, "", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "reuse_caller_profile", "Reuse the caller profile", "Reuse the caller profile", reuse_caller_profile_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "", diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 8d21513388..be319e353e 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2192,7 +2192,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ extension = "service"; } - new_profile = switch_caller_profile_clone(session, profile); + + if (switch_channel_test_flag(channel, CF_REUSE_CALLER_PROFILE)){ + new_profile = switch_channel_get_caller_profile(channel); + } else { + new_profile = switch_caller_profile_clone(session, profile); + } new_profile->dialplan = switch_core_strdup(new_profile->pool, use_dialplan); new_profile->context = switch_core_strdup(new_profile->pool, use_context); @@ -2238,7 +2243,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ switch_core_session_rwunlock(other_session); } - switch_channel_set_caller_profile(channel, new_profile); + if (!switch_channel_test_flag(channel, CF_REUSE_CALLER_PROFILE)){ + switch_channel_set_caller_profile(channel, new_profile); + } switch_channel_set_state(channel, CS_ROUTING); switch_channel_audio_sync(channel); From 22ae5a1ba124632c17159edfe0cc51deff76e859 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 5 Oct 2020 02:49:08 +0400 Subject: [PATCH 052/655] [Core] Fix memory leak of local_var_event in switch_ivr_originate() when caller_channel is not ready. --- src/switch_ivr_originate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 99370d7e79..d2baeb2741 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2861,6 +2861,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (oglobals.session) { if (!switch_channel_ready(caller_channel)) { status = SWITCH_STATUS_FALSE; + if (local_var_event) switch_event_destroy(&local_var_event); goto done; } From 8e4b418ee4d85545d20f3af08ae25311a9920ea9 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Tue, 6 Oct 2020 11:26:42 -0400 Subject: [PATCH 053/655] [core] fix leak in http request parser --- src/switch_utils.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index e4e26a6eef..5d6b8f2aaf 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -4176,11 +4176,12 @@ SWITCH_DECLARE(void) switch_http_parse_qs(switch_http_request_t *request, char * char *q; char *next; char *name, *val; + char *dup = NULL; if (qs) { q = qs; } else { /*parse our own qs, dup to avoid modify the original string */ - q = strdup(request->qs); + dup = q = strdup(request->qs); } switch_assert(q); @@ -4207,9 +4208,7 @@ SWITCH_DECLARE(void) switch_http_parse_qs(switch_http_request_t *request, char * q = next; } while (q); - if (!qs) { - switch_safe_free(q); - } + switch_safe_free(dup); } /* clean the uri to protect us from vulnerability attack */ From dcb75a79e36cb131cc6fa8827ffdfcd852fa5adf Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 7 Oct 2020 03:21:16 +0400 Subject: [PATCH 054/655] [mod_sofia] Fix multiple memory leaks in sofia_presence_handle_sip_i_subscribe() --- src/mod/endpoints/mod_sofia/sofia_presence.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index e1c31c99c8..e27b0495ff 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -4284,7 +4284,11 @@ void sofia_presence_handle_sip_i_subscribe(int status, } } } + + switch_xml_free(xml); } + + switch_safe_free(pd_dup); } switch_event_fire(&event); } else if (!strcasecmp(event, "message-summary")) { From 3065cb9168e994b5388c37170c61b0956c91e0d2 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 28 Oct 2020 23:49:36 +0400 Subject: [PATCH 055/655] [mod_sofia] Fix memory leaks caused by improper profile destroy. Add a unit-test. --- src/mod/endpoints/mod_sofia/sofia.c | 25 +++-- tests/unit/Makefile.am | 2 +- tests/unit/conf_sofia/freeswitch.xml | 144 +++++++++++++++++++++++++++ tests/unit/test_sofia.c | 31 ++++++ 4 files changed, 191 insertions(+), 11 deletions(-) create mode 100644 tests/unit/conf_sofia/freeswitch.xml create mode 100644 tests/unit/test_sofia.c diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4975ca8feb..87b09e5406 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3180,7 +3180,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void if (!sofia_glue_init_sql(profile)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database [%s]!\n", profile->name); sofia_profile_start_failure(profile, profile->name); - sofia_glue_del_profile(profile); goto end; } @@ -3332,7 +3331,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } sofia_profile_start_failure(profile, profile->name); - sofia_glue_del_profile(profile); goto end; } @@ -3500,6 +3498,20 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } } + /* Do gateway cleanups */ + sofia_glue_del_every_gateway(profile); + sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); + sofia_sub_check_gateway(profile, switch_epoch_time_now(NULL)); + sofia_glue_fire_events(profile); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n"); + + if (worker_thread) { + switch_thread_join(&st, worker_thread); + } + else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Sofia worker thead failed to start\n"); + } sofia_reg_unregister(profile); nua_shutdown(profile->nua); @@ -3514,13 +3526,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void sofia_clear_pflag_locked(profile, PFLAG_RUNNING); sofia_clear_pflag_locked(profile, PFLAG_SHUTDOWN); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n"); - - if ( worker_thread ) { - switch_thread_join(&st, worker_thread); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Sofia worker thead failed to start\n"); - } sanity = 4; while (profile->inuse) { @@ -3569,6 +3574,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } } + end: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock %s\n", profile->name); switch_thread_rwlock_wrlock(profile->rwlock); @@ -3590,7 +3596,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void sofia_profile_destroy(profile); - end: switch_mutex_lock(mod_sofia_globals.mutex); mod_sofia_globals.threads--; switch_mutex_unlock(mod_sofia_globals.mutex); diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 2511a143c2..231225c5aa 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ switch_ivr_play_say switch_core_codec switch_rtp switch_xml -noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_core_asr +noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_core_asr test_sofia 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_sofia/freeswitch.xml b/tests/unit/conf_sofia/freeswitch.xml new file mode 100644 index 0000000000..793ac5a04a --- /dev/null +++ b/tests/unit/conf_sofia/freeswitch.xml @@ -0,0 +1,144 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+
diff --git a/tests/unit/test_sofia.c b/tests/unit/test_sofia.c new file mode 100644 index 0000000000..e45bd5d3fd --- /dev/null +++ b/tests/unit/test_sofia.c @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2018-2019, Signalwire, Inc. ALL RIGHTS RESERVED + * test_sofia.c -- Tests mod_sofia for memory leaks + */ + +#include +#include + +FST_CORE_DB_BEGIN("conf_sofia") +{ + FST_SUITE_BEGIN(switch_sofia) + { + FST_SETUP_BEGIN() + { + fst_requires_module("mod_sofia"); + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(sofia_leaks) + { + } + FST_TEST_END() + } + FST_SUITE_END() +} +FST_CORE_END() From 5ed17dd19cdda148c6d9f48b0dcc7ea9afb653cf Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 23 Oct 2020 21:48:53 +0400 Subject: [PATCH 056/655] [Core] Scheduler: Fix race between switch_scheduler_add_task() and task_thread_loop(). Add new switch_scheduler_add_task_ex() method. --- src/include/switch_scheduler.h | 17 +++++++++++++++++ src/switch_scheduler.c | 26 +++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/include/switch_scheduler.h b/src/include/switch_scheduler.h index 14403917ca..1100fdb052 100644 --- a/src/include/switch_scheduler.h +++ b/src/include/switch_scheduler.h @@ -66,6 +66,23 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime, switch_scheduler_func_t func, const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags); +/*! + \brief Schedule a task in the future + \param task_runtime the time in epoch seconds to execute the task. + \param func the callback function to execute when the task is executed. + \param desc an arbitrary description of the task. + \param group a group id tag to link multiple tasks to a single entity. + \param cmd_id an arbitrary index number be used in the callback. + \param cmd_arg user data to be passed to the callback. + \param flags flags to alter behaviour + \param task_id pointer to put the id of the task to + \return the id of the task +*/ + +SWITCH_DECLARE(uint32_t) switch_scheduler_add_task_ex(time_t task_runtime, + switch_scheduler_func_t func, + const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags, uint32_t *task_id); + /*! \brief Delete a scheduled task \param task_id the id of the task diff --git a/src/switch_scheduler.c b/src/switch_scheduler.c index c08d1071b4..9c0f29a35b 100644 --- a/src/switch_scheduler.c +++ b/src/switch_scheduler.c @@ -209,9 +209,21 @@ static void *SWITCH_THREAD_FUNC switch_scheduler_task_thread(switch_thread_t *th } SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime, - switch_scheduler_func_t func, - const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags) + switch_scheduler_func_t func, + const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags) { + uint32_t task_id; + + switch_scheduler_add_task_ex(task_runtime, func, desc, group, cmd_id, cmd_arg, flags, &task_id); + + return task_id; +} + +SWITCH_DECLARE(uint32_t) switch_scheduler_add_task_ex(time_t task_runtime, + switch_scheduler_func_t func, + const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags, uint32_t *task_id) +{ + uint32_t result; switch_scheduler_task_container_t *container, *tp; switch_event_t *event; switch_time_t now = switch_epoch_time_now(NULL); @@ -220,6 +232,7 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime, switch_mutex_lock(globals.task_mutex); switch_zmalloc(container, sizeof(*container)); switch_assert(func); + switch_assert(task_id); if (task_runtime < now) { container->task.repeat = (uint32_t)task_runtime; @@ -246,8 +259,6 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime, for (container->task.task_id = 0; !container->task.task_id; container->task.task_id = ++globals.task_id); - switch_mutex_unlock(globals.task_mutex); - tp = container; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Added task %u %s (%s) to run at %" SWITCH_INT64_T_FMT "\n", tp->task.task_id, tp->desc, switch_str_nil(tp->task.group), tp->task.runtime); @@ -260,7 +271,12 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime, switch_queue_push(globals.event_queue, event); event = NULL; } - return container->task.task_id; + + result = *task_id = container->task.task_id; + + switch_mutex_unlock(globals.task_mutex); + + return result; } SWITCH_DECLARE(uint32_t) switch_scheduler_del_task_id(uint32_t task_id) From eaf5a70246e2786bd02c257e26946eb07d58c090 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 17 Mar 2021 01:15:42 +0300 Subject: [PATCH 057/655] [Unit-tests] Fix build issues in switch_eavesdrop.c test file. --- tests/unit/switch_eavesdrop.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/tests/unit/switch_eavesdrop.c b/tests/unit/switch_eavesdrop.c index 867ad7a6bc..18c293f833 100644 --- a/tests/unit/switch_eavesdrop.c +++ b/tests/unit/switch_eavesdrop.c @@ -1,20 +1,15 @@ -#include #include #include -static switch_memory_pool_t *pool = NULL; - static switch_status_t test_detect_long_tone_in_file(const char *filepath, int rate, int freq, int ptime) { teletone_multi_tone_t mt; teletone_tone_map_t map; int16_t data[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; - size_t len = (rate * ptime / 1000) /*packet len in samples */ * 8; /*length of chunk that must contain tone*/ - size_t fin = 0; + switch_size_t len = (rate * ptime / 1000) /*packet len in samples */ * 8; /*length of chunk that must contain tone*/ + switch_size_t fin = 0; switch_status_t status; switch_file_handle_t fh = { 0 }; uint8_t fail = 0, gaps = 0, audio = 0; - uint32_t pos = 0; - size_t full_len = 0; status = switch_core_file_open(&fh, filepath, 1, rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL); if (status != SWITCH_STATUS_SUCCESS) { @@ -34,7 +29,7 @@ static switch_status_t test_detect_long_tone_in_file(const char *filepath, int r /*skip silence at the beginning of the file, 1 second max. */ if (!teletone_multi_tone_detect(&mt, data, len)) { if ((fin > rate && !audio) || gaps > 30) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many gaps in audio or no tone detected 1st second. [%u][%d]\n", fin, gaps); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many gaps in audio or no tone detected 1st second. [%" SWITCH_SIZE_T_FMT "][%d]\n", fin, gaps); fail = 1; break; } @@ -85,9 +80,9 @@ FST_SUITE_BEGIN(switch_eavesdrop) switch_call_cause_t cause; switch_stream_handle_t stream = { 0 }; char eavesdrop_command[256] = { 0 }; - char rec_path[256]; + char rec_path[1024]; char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - char eaves_dialstr[256] = { 0 }; + char eaves_dialstr[512] = { 0 }; switch_uuid_str(rec_uuid, sizeof(rec_uuid)); @@ -160,9 +155,9 @@ FST_SUITE_BEGIN(switch_eavesdrop) switch_call_cause_t cause; switch_stream_handle_t stream = { 0 }; char eavesdrop_command[256] = { 0 }; - char rec_path[256]; + char rec_path[1024]; char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - char eaves_dialstr[256] = { 0 }; + char eaves_dialstr[512] = { 0 }; switch_uuid_str(rec_uuid, sizeof(rec_uuid)); @@ -235,9 +230,9 @@ FST_SUITE_BEGIN(switch_eavesdrop) switch_call_cause_t cause; switch_stream_handle_t stream = { 0 }; char eavesdrop_command[256] = { 0 }; - char rec_path[256]; + char rec_path[1024]; char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - char eaves_dialstr[256] = { 0 }; + char eaves_dialstr[512] = { 0 }; switch_uuid_str(rec_uuid, sizeof(rec_uuid)); @@ -310,9 +305,9 @@ FST_SUITE_BEGIN(switch_eavesdrop) switch_call_cause_t cause; switch_stream_handle_t stream = { 0 }; char eavesdrop_command[256] = { 0 }; - char rec_path[256]; + char rec_path[1024]; char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - char eaves_dialstr[256] = { 0 }; + char eaves_dialstr[512] = { 0 }; switch_uuid_str(rec_uuid, sizeof(rec_uuid)); From a746d12f6c8f5651fc52c3c63bf5f8e3eeae51c1 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 29 Oct 2020 00:14:00 +0400 Subject: [PATCH 058/655] [mod_sofia] Keep noreg gateways as NOREG, mark unregistered gateways as DOWN. Co-authored-by: Mike Jerris --- src/mod/endpoints/mod_sofia/mod_sofia.c | 33 ++++++++++++++++--------- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia_reg.c | 3 ++- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8ce1996ccb..3143fffa42 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2740,6 +2740,7 @@ const char *sofia_state_names[] = { "FAIL_WAIT", "EXPIRED", "NOREG", + "DOWN", "TIMEOUT", NULL }; @@ -3653,15 +3654,19 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t if (!strcasecmp(gname, "all")) { for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) { - gateway_ptr->retry = 0; - gateway_ptr->state = REG_STATE_UNREGED; + if (gateway_ptr->state != REG_STATE_NOREG) { + gateway_ptr->retry = 0; + gateway_ptr->state = REG_STATE_UNREGED; + } } stream->write_function(stream, "+OK\n"); } else if ((gateway_ptr = sofia_reg_find_gateway(gname))) { - gateway_ptr->retry = 0; - gateway_ptr->state = REG_STATE_UNREGED; - stream->write_function(stream, "+OK\n"); - sofia_reg_release_gateway(gateway_ptr); + if (gateway_ptr->state != REG_STATE_NOREG) { + gateway_ptr->retry = 0; + gateway_ptr->state = REG_STATE_UNREGED; + stream->write_function(stream, "+OK\n"); + sofia_reg_release_gateway(gateway_ptr); + } } else { stream->write_function(stream, "Invalid gateway!\n"); } @@ -3680,15 +3685,19 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t if (!strcasecmp(gname, "all")) { for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) { - gateway_ptr->retry = 0; - gateway_ptr->state = REG_STATE_UNREGISTER; + if (gateway_ptr->state != REG_STATE_NOREG) { + gateway_ptr->retry = 0; + gateway_ptr->state = REG_STATE_UNREGISTER; + } } stream->write_function(stream, "+OK\n"); } else if ((gateway_ptr = sofia_reg_find_gateway(gname))) { - gateway_ptr->retry = 0; - gateway_ptr->state = REG_STATE_UNREGISTER; - stream->write_function(stream, "+OK\n"); - sofia_reg_release_gateway(gateway_ptr); + if (gateway_ptr->state != REG_STATE_NOREG) { + gateway_ptr->retry = 0; + gateway_ptr->state = REG_STATE_UNREGISTER; + stream->write_function(stream, "+OK\n"); + sofia_reg_release_gateway(gateway_ptr); + } } else { stream->write_function(stream, "Invalid gateway!\n"); } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 3249533730..d4631b02d6 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -432,6 +432,7 @@ typedef enum { REG_STATE_FAIL_WAIT, REG_STATE_EXPIRED, REG_STATE_NOREG, + REG_STATE_DOWN, REG_STATE_TIMEOUT, REG_STATE_LAST } reg_state_t; diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 81d2ffdabd..b1586405b7 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -398,6 +398,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) } switch (ostate) { + case REG_STATE_DOWN: case REG_STATE_NOREG: if (!gateway_ptr->ping && !gateway_ptr->pinging && gateway_ptr->status != SOFIA_GATEWAY_UP) { gateway_ptr->status = SOFIA_GATEWAY_UP; @@ -432,7 +433,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) case REG_STATE_UNREGISTER: sofia_reg_kill_reg(gateway_ptr); - gateway_ptr->state = REG_STATE_NOREG; + gateway_ptr->state = REG_STATE_DOWN; gateway_ptr->status = SOFIA_GATEWAY_DOWN; break; case REG_STATE_UNREGED: From 96e139854e57cdce3c3dccc0206b76fc5d8cee4a Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 13 Nov 2020 21:23:20 +0400 Subject: [PATCH 059/655] [mod_sofia] Prevent crash in sofia_handle_sip_i_state on switch_channel_set_state() when PFLAG_3PCC_PROXY flag is set. --- src/mod/endpoints/mod_sofia/sofia.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 87b09e5406..7e71717aff 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7930,7 +7930,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, //switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0); sofia_set_flag(tech_pvt, TFLAG_LATE_NEGOTIATION); //Moves into CS_INIT so call moves forward into the dialplan - switch_channel_set_state(channel, CS_INIT); + if (switch_channel_get_state(channel) == CS_NEW) { + switch_channel_set_state(channel, CS_INIT); + } } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No SDP in INVITE and 3pcc not enabled, hanging up.\n"); switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "3PCC DISABLED"); From 7539921ecae86df78b7c198e31103d817c4ad307 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Mon, 16 Nov 2020 17:08:43 -0700 Subject: [PATCH 060/655] [core] improve logging on oversized fields in odbc --- src/switch_odbc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 9ea062d997..4445eb4c1f 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -644,25 +644,25 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c } if (truncated) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sql data truncated - %s\n",SqlState); if (StrLen_or_IndPtr && StrLen_or_IndPtr <= 268435456) { ColumnSize = StrLen_or_IndPtr + 1; vals[y] = malloc(ColumnSize); switch_assert(vals[y]); memset(vals[y], 0, ColumnSize); SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQLGetData large column [%lu]\n", (unsigned long)ColumnSize); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData failed"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sql data truncated - %s\n",SqlState); vals[y] = NULL; } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData failed"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData failed\n"); vals[y] = NULL; } } else if (rc == SQL_SUCCESS){ vals[y] = strdup((char *)val); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData failed"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData failed\n"); vals[y] = NULL; } } else { From 81aa6fa9d0417ea43be32f06671e7d3e3cfb9092 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 18 Nov 2020 00:01:03 +0400 Subject: [PATCH 061/655] [Core] ODBC: Fix large column logic and improve error handling. --- src/switch_odbc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 4445eb4c1f..fbad0e371a 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -645,12 +645,21 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c if (truncated) { if (StrLen_or_IndPtr && StrLen_or_IndPtr <= 268435456) { + int ValLen = strlen((char*)val); ColumnSize = StrLen_or_IndPtr + 1; vals[y] = malloc(ColumnSize); switch_assert(vals[y]); memset(vals[y], 0, ColumnSize); - SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQLGetData large column [%lu]\n", (unsigned long)ColumnSize); + strcpy(vals[y], (char*)val); + rc = SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *)vals[y] + ValLen, ColumnSize - ValLen, NULL); + if (rc != SQL_SUCCESS +#if (ODBCVER >= 0x0300) + && rc != SQL_NO_DATA +#endif + ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQLGetData was truncated and failed to complete.\n"); + switch_safe_free(vals[y]); + } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sql data truncated - %s\n",SqlState); vals[y] = NULL; From 9608a5687399223910690adb8318f80b6ad4d3cc Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 18 Nov 2020 21:50:04 +0400 Subject: [PATCH 062/655] [Core] Fix leaks in switch_ivr_park when initially no rate. --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index be319e353e..9aa05fcd73 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1011,7 +1011,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, rate = read_impl.actual_samples_per_second; bpf = read_impl.decoded_bytes_per_packet; - if ((var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var))) { + if (rate && (var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var))) { switch_core_session_get_read_impl(session, &imp); if (switch_core_codec_init(&codec, From 90c35685c315b0deb2413d623839e2f3641140a6 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 19 Nov 2020 21:18:09 +0400 Subject: [PATCH 063/655] [mod_mongo, mod_redis, mod_voicemail] Fix leaking hash iterators. --- src/mod/applications/mod_mongo/mod_mongo.c | 1 + src/mod/applications/mod_redis/mod_redis.c | 2 ++ src/mod/applications/mod_voicemail/mod_voicemail.c | 1 + 3 files changed, 4 insertions(+) diff --git a/src/mod/applications/mod_mongo/mod_mongo.c b/src/mod/applications/mod_mongo/mod_mongo.c index aac3221fe7..b66b01369a 100644 --- a/src/mod/applications/mod_mongo/mod_mongo.c +++ b/src/mod/applications/mod_mongo/mod_mongo.c @@ -698,6 +698,7 @@ SWITCH_LIMIT_RELEASE(mod_mongo_limit_release) if (mod_mongo_increment(session, (const char *)p_key, -1, 0, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Couldn't decrement %s\n", (const char *)p_key); status = SWITCH_STATUS_FALSE; + free(hi); break; } else { switch_core_hash_delete(pvt->resources, (const char *) p_key); diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c index 7f140fe7d6..5d4c132cd7 100644 --- a/src/mod/applications/mod_redis/mod_redis.c +++ b/src/mod/applications/mod_redis/mod_redis.c @@ -197,11 +197,13 @@ SWITCH_LIMIT_RELEASE(limit_release_redis) if (credis_decr(redis, (const char*)p_key, &val) != 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", (char *)p_key); + free(hi); switch_goto_status(SWITCH_STATUS_FALSE, end); } p_uuid_key = switch_core_session_sprintf(session, "%s_%s", switch_core_get_switchname(), (char *)p_key); if (credis_decr(redis,p_uuid_key,&uuid_val) != 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", p_uuid_key); + free(hi); switch_goto_status(SWITCH_STATUS_FALSE, end); } switch_core_hash_delete(pvt->hash, (const char *) p_key); diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index aba1dc4cf0..dd3a74a463 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3855,6 +3855,7 @@ SWITCH_STANDARD_API(boxcount_api_function) total_new_messages = total_saved_messages = 0; message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages, &total_new_urgent_messages, &total_saved_urgent_messages); + free(hi); } switch_mutex_unlock(globals.mutex); } From b78c9a115e4ce43e7d37c65816c82f078fd6466c Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 30 Nov 2020 22:24:21 +0400 Subject: [PATCH 064/655] [mod_sofia] Properly handle nua events came without nua handles. --- src/mod/endpoints/mod_sofia/sofia.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7e71717aff..dcedbc7e43 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2282,7 +2282,7 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) profile->queued_events--; switch_mutex_unlock(profile->flag_mutex); - nua_handle_unref(nh); + if (nh) nua_handle_unref(nh); nua_unref(nua); } @@ -2516,7 +2516,7 @@ void sofia_event_callback(nua_event_t event, de = su_alloc(nua_handle_get_home(nh), sizeof(*de)); memset(de, 0, sizeof(*de)); nua_save_event(nua, de->event); - de->nh = nua_handle_ref(nh); + de->nh = nh ? nua_handle_ref(nh) : NULL; de->data = nua_event_data(de->event); de->sip = sip_object(de->data->e_msg); de->profile = profile; From e3e0c7c2596c3870db79eedb51fe77cf45a89fc7 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 1 Dec 2020 04:21:57 +0400 Subject: [PATCH 065/655] [mod_sofia] Protect insertion into profile->reg_nh_hash with a mutex. --- src/mod/endpoints/mod_sofia/sofia_reg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index b1586405b7..5eee1c17e3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1933,7 +1933,6 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu switch_mutex_lock(profile->flag_mutex); hnh = switch_core_hash_find(profile->reg_nh_hash, key); - switch_mutex_unlock(profile->flag_mutex); if (!hnh) { if (!(sofia_private = su_alloc(nua_handle_get_home(nh), sizeof(*sofia_private)))) { @@ -1954,6 +1953,8 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu nua_handle_ref(nh); switch_core_hash_insert(profile->reg_nh_hash, key, nh); } + + switch_mutex_unlock(profile->flag_mutex); } From f6e076507e6645745b733e0c91305bba7a832473 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 15 Dec 2020 00:46:08 +0400 Subject: [PATCH 066/655] [mod_loopback] Fix new_session leak in the case of a hangup_cause. --- src/mod/endpoints/mod_loopback/mod_loopback.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 88400fcaf6..6fa0d4fbd4 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -1700,6 +1700,7 @@ static switch_call_cause_t null_channel_outgoing_channel(switch_core_session_t * if (hangup_cause || !strncmp(caller_profile->destination_number, "cause-", 6)) { if (!hangup_cause) hangup_cause = caller_profile->destination_number + 6; + switch_core_session_destroy(new_session); return switch_channel_str2cause(hangup_cause); } From 82b6f01b692afe3a76a28e6650b7b51361300bbe Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 16 Jan 2021 22:53:23 +0300 Subject: [PATCH 067/655] [Core] Fix codec ready checks in switch_core_session_read_frame() --- src/switch_core_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 22d0474e3e..1d5ff7510b 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -227,7 +227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_assert((*frame)->codec != NULL); - if (!(session->read_codec && (*frame)->codec && (*frame)->codec->implementation) && switch_core_codec_ready((*frame)->codec)) { + if (!switch_core_codec_ready(session->read_codec) || !switch_core_codec_ready((*frame)->codec)) { status = SWITCH_STATUS_FALSE; goto done; } From 29b50439042d012d0eb020efc94201df38b0a6f8 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 20 Jan 2021 18:30:32 +0300 Subject: [PATCH 068/655] [mod_shout] Fix memory leak in do_telecast --- src/mod/formats/mod_shout/mod_shout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 6799b38391..14cba068d3 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -1333,8 +1333,6 @@ void do_telecast(switch_stream_handle_t *stream) end: - switch_safe_free(uuid); - if (gfp) { lame_close(gfp); gfp = NULL; @@ -1350,6 +1348,8 @@ void do_telecast(switch_stream_handle_t *stream) switch_core_session_rwunlock(tsession); } + + switch_safe_free(uuid); } void do_broadcast(switch_stream_handle_t *stream) From c8e7a57b4c177c19d9289e0c5db76a720c9a1e16 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 20 Jan 2021 22:31:35 +0300 Subject: [PATCH 069/655] [Unit-Tests] Fix leak of arg in the case of an error in fct_clp__parse() --- src/include/test/switch_fct.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/include/test/switch_fct.h b/src/include/test/switch_fct.h index a9b3595d0e..f88821b49c 100644 --- a/src/include/test/switch_fct.h +++ b/src/include/test/switch_fct.h @@ -1716,6 +1716,12 @@ fct_clp__parse(fct_clp_t *clp, int argc, char const *argv[]) arg =NULL; } } + + if (arg != NULL) + { + free(arg); + arg = NULL; + } } From 3e7ba04cbecb12642373ae1215925372c5137cd3 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 21 Jan 2021 00:46:40 +0300 Subject: [PATCH 070/655] [mod_curl] Avoid passing null pointer value via data parameter of do_lookup_url() --- src/mod/applications/mod_curl/mod_curl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index e82502cb6c..f0c952a215 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -799,7 +799,7 @@ SWITCH_STANDARD_APP(curl_app_function) switch_channel_t *channel = switch_core_session_get_channel(session); char *url = NULL; char *method = NULL; - char *postdata = NULL; + char *postdata = ""; char *content_type = NULL; switch_bool_t do_headers = SWITCH_FALSE; switch_bool_t do_json = SWITCH_FALSE; @@ -920,7 +920,7 @@ SWITCH_STANDARD_API(curl_function) char *mydata = NULL; char *url = NULL; char *method = NULL; - char *postdata = NULL; + char *postdata = ""; char *content_type = NULL; switch_bool_t do_headers = SWITCH_FALSE; switch_bool_t do_json = SWITCH_FALSE; From e614f08c9342062b4bdb5dc52809d8c25eb05744 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 21 Jan 2021 17:40:29 +0300 Subject: [PATCH 071/655] [mod_httapi] Fix memory leak of dup_creds in httapi_sync() --- src/mod/applications/mod_httapi/mod_httapi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 76d273d020..cc2c857a58 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -1534,6 +1534,7 @@ static switch_status_t httapi_sync(client_t *client) char *q, *p = strstr(dynamic_url, "://"); use_url++; + switch_safe_free(dup_creds); dup_creds = strdup(p+3); *p = '\0'; From c282386fdb9d8944eaf2414ec817da936c4500cb Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 21 Jan 2021 18:29:44 +0300 Subject: [PATCH 072/655] [mod_pgsql] Fix memory leek in the case of an empty string of err_str in pgsql_handle_exec_base_detailed() --- src/mod/databases/mod_pgsql/mod_pgsql.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c index e2efa5252c..f7c2983f91 100644 --- a/src/mod/databases/mod_pgsql/mod_pgsql.c +++ b/src/mod/databases/mod_pgsql/mod_pgsql.c @@ -515,6 +515,7 @@ error: err_str = pgsql_handle_get_error(handle); if (zstr(err_str)) { + switch_safe_free(err_str); if (!er) { err_str = strdup((char *)"SQL ERROR!"); } else { From be6b40b024d38b64ca515be3087a5a39db0f867b Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 21 Jan 2021 18:43:02 +0300 Subject: [PATCH 073/655] [mod_lcr] Fix order_by and sql_stream streams leaking in the case of a DB error in lcr_load_config() --- src/mod/applications/mod_lcr/mod_lcr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index a9adb3db10..ab7c163ce5 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -1186,6 +1186,8 @@ static switch_status_t lcr_load_config() if (db_check("ALTER TABLE carrier_gateway add codec varchar(255);") == SWITCH_TRUE) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "adding codec field your lcr carrier_gateway database schema.\n"); } else { + switch_safe_free(order_by.data); + switch_safe_free(sql_stream.data); switch_goto_status(SWITCH_STATUS_FALSE, done); } } @@ -1197,6 +1199,8 @@ static switch_status_t lcr_load_config() if (db_check("ALTER TABLE lcr add cid varchar(32);") == SWITCH_TRUE) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "adding cid field to your lcr database schema.\n"); } else { + switch_safe_free(order_by.data); + switch_safe_free(sql_stream.data); switch_goto_status(SWITCH_STATUS_FALSE, done); } } @@ -1205,6 +1209,8 @@ static switch_status_t lcr_load_config() if (db_check("ALTER TABLE lcr ADD lrn BOOLEAN NOT NULL DEFAULT false")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "adding lrn field to your lcr database schema.\n"); } else { + switch_safe_free(order_by.data); + switch_safe_free(sql_stream.data); switch_goto_status(SWITCH_STATUS_FALSE, done); } } From 91066f56fa85d1ca592d78a61846c45cc7409b0c Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 21 Jan 2021 19:38:37 +0300 Subject: [PATCH 074/655] [Core] Fix leaking stream in switch_event_expand_headers_check() --- src/switch_event.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/switch_event.c b/src/switch_event.c index efe43e603a..295708eda3 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -2464,8 +2464,6 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, char *expanded = NULL; char *expanded_vname = NULL; - SWITCH_STANDARD_STREAM(stream); - if ((expanded_vname = switch_event_expand_headers_check(event, (char *) vname, var_list, api_list, recur+1)) == vname) { expanded_vname = NULL; } else { @@ -2482,6 +2480,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, func_val = NULL; sub_val = ""; } else { + SWITCH_STANDARD_STREAM(stream); if (switch_api_execute(vname, vval, NULL, &stream) == SWITCH_STATUS_SUCCESS) { func_val = stream.data; sub_val = func_val; From 2a8804af9760b8038cc3edc58741f4f0626c5af6 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 21 Jan 2021 22:32:12 +0300 Subject: [PATCH 075/655] [Core] Fix leak of switch_event_header_t in switch_event_base_add_header(). Code cleanup. --- src/switch_event.c | 88 ++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 49 deletions(-) diff --git a/src/switch_event.c b/src/switch_event.c index 295708eda3..709ea95e7e 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -129,6 +129,8 @@ static char *my_dup(const char *s) #define FREE(ptr) switch_safe_free(ptr) #endif +static void free_header(switch_event_header_t **header); + /* make sure this is synced with the switch_event_types_t enum in switch_types.h also never put any new ones before EVENT_ALL */ @@ -891,27 +893,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *even if (hp == event->last_header || !hp->next) { event->last_header = lp; } - FREE(hp->name); - - if (hp->idx) { - int i = 0; - - for (i = 0; i < hp->idx; i++) { - FREE(hp->array[i]); - } - FREE(hp->array); - } - - FREE(hp->value); - - memset(hp, 0, sizeof(*hp)); -#ifdef SWITCH_EVENT_RECYCLE - if (switch_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, hp) != SWITCH_STATUS_SUCCESS) { - FREE(hp); - } -#else - FREE(hp); -#endif + free_header(&hp); status = SWITCH_STATUS_SUCCESS; } else { lp = hp; @@ -944,6 +926,37 @@ static switch_event_header_t *new_header(const char *header_name) } +static void free_header(switch_event_header_t **header) +{ + assert(header); + + if (*header) { + if ((*header)->idx) { + if (!(*header)->array) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "INDEX WITH NO ARRAY ?? [%s][%s]\n", (*header)->name, (*header)->value); + } else { + int i = 0; + + for (i = 0; i < (*header)->idx; i++) { + FREE((*header)->array[i]); + } + FREE((*header)->array); + } + } + + FREE((*header)->name); + FREE((*header)->value); + +#ifdef SWITCH_EVENT_RECYCLE + if (switch_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, *header) != SWITCH_STATUS_SUCCESS) { + FREE(*header); + } +#else + FREE(*header); +#endif + } +} + SWITCH_DECLARE(int) switch_event_add_array(switch_event_t *event, const char *var, const char *val) { char *data; @@ -1012,10 +1025,11 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc } if (index_ptr || (stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT)) { + switch_event_header_t *tmp_header = NULL; if (!(header = switch_event_get_header_ptr(event, header_name)) && index_ptr) { - header = new_header(header_name); + tmp_header = header = new_header(header_name); if (switch_test_flag(event, EF_UNIQ_HEADERS)) { switch_event_del_header(event, header_name); @@ -1049,6 +1063,8 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc goto redraw; } + } else if (tmp_header) { + free_header(&tmp_header); } goto end; } else { @@ -1266,33 +1282,7 @@ SWITCH_DECLARE(void) switch_event_destroy(switch_event_t **event) for (hp = ep->headers; hp;) { this = hp; hp = hp->next; - - if (this->idx) { - if (!this->array) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "INDEX WITH NO ARRAY WTF?? [%s][%s]\n", this->name, this->value); - } else { - int i = 0; - - for (i = 0; i < this->idx; i++) { - FREE(this->array[i]); - } - FREE(this->array); - } - } - - FREE(this->name); - FREE(this->value); - - -#ifdef SWITCH_EVENT_RECYCLE - if (switch_queue_trypush(EVENT_HEADER_RECYCLE_QUEUE, this) != SWITCH_STATUS_SUCCESS) { - FREE(this); - } -#else - FREE(this); -#endif - - + free_header(&this); } FREE(ep->body); FREE(ep->subclass_name); From d127eeeeccc4f3c137e5d6f8195d45c0710140fc Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 22 Jan 2021 21:45:37 +0300 Subject: [PATCH 076/655] [mod_snom, mod_snmp] Replace strncpy with snprintf --- src/mod/applications/mod_snom/mod_snom.c | 2 +- src/mod/event_handlers/mod_snmp/subagent.c | 28 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mod/applications/mod_snom/mod_snom.c b/src/mod/applications/mod_snom/mod_snom.c index af460e7523..2f706c2556 100644 --- a/src/mod/applications/mod_snom/mod_snom.c +++ b/src/mod/applications/mod_snom/mod_snom.c @@ -143,7 +143,7 @@ SWITCH_STANDARD_API(snom_command_api_function) } if (switch_inet_pton(AF_INET, argv[0], &ip)) { - strncpy(host, argv[0], sizeof(host)); + snprintf(host, sizeof(host), "%s", argv[0]); } else { char *sql = NULL; char *ret = NULL; diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index dd29939e6a..cd61955461 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -79,22 +79,22 @@ static int channelList_callback(void *pArg, int argc, char **argv, char **column row->data = entry; entry->idx = idx++; - strncpy(entry->uuid, switch_str_nil(argv[0]), sizeof(entry->uuid)); - strncpy(entry->direction, switch_str_nil(argv[1]), sizeof(entry->direction)); + snprintf(entry->uuid, sizeof(entry->uuid), "%s", switch_str_nil(argv[0])); + snprintf(entry->direction, sizeof(entry->direction), "%s", switch_str_nil(argv[1])); entry->created_epoch = atoi(argv[3]); - strncpy(entry->name, switch_str_nil(argv[4]), sizeof(entry->name)); - strncpy(entry->state, switch_str_nil(argv[5]), sizeof(entry->state)); - strncpy(entry->cid_name, switch_str_nil(argv[6]), sizeof(entry->cid_name)); - strncpy(entry->cid_num, switch_str_nil(argv[7]), sizeof(entry->cid_num)); - strncpy(entry->dest, switch_str_nil(argv[9]), sizeof(entry->dest)); - strncpy(entry->application, switch_str_nil(argv[10]), sizeof(entry->application)); - strncpy(entry->application_data, switch_str_nil(argv[11]), sizeof(entry->application_data)); - strncpy(entry->dialplan, switch_str_nil(argv[12]), sizeof(entry->dialplan)); - strncpy(entry->context, switch_str_nil(argv[13]), sizeof(entry->context)); - strncpy(entry->read_codec, switch_str_nil(argv[14]), sizeof(entry->read_codec)); + snprintf(entry->name, sizeof(entry->name), "%s", switch_str_nil(argv[4])); + snprintf(entry->state, sizeof(entry->state), "%s", switch_str_nil(argv[5])); + snprintf(entry->cid_name, sizeof(entry->cid_name), "%s", switch_str_nil(argv[6])); + snprintf(entry->cid_num, sizeof(entry->cid_num), "%s", switch_str_nil(argv[7])); + snprintf(entry->dest, sizeof(entry->dest), "%s", switch_str_nil(argv[9])); + snprintf(entry->application, sizeof(entry->application), "%s", switch_str_nil(argv[10])); + snprintf(entry->application_data, sizeof(entry->application_data), "%s", switch_str_nil(argv[11])); + snprintf(entry->dialplan, sizeof(entry->dialplan), "%s", switch_str_nil(argv[12])); + snprintf(entry->context, sizeof(entry->context), "%s", switch_str_nil(argv[13])); + snprintf(entry->read_codec, sizeof(entry->read_codec), "%s", switch_str_nil(argv[14])); entry->read_rate = atoi(switch_str_nil(argv[15])); entry->read_bitrate = atoi(switch_str_nil(argv[16])); - strncpy(entry->write_codec, switch_str_nil(argv[17]), sizeof(entry->write_codec)); + snprintf(entry->write_codec, sizeof(entry->write_codec), "%s", switch_str_nil(argv[17])); entry->write_rate = atoi(switch_str_nil(argv[18])); entry->write_bitrate = atoi(switch_str_nil(argv[19])); @@ -186,7 +186,7 @@ int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration * snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version)); break; case ID_UUID: - strncpy(uuid, switch_core_get_uuid(), sizeof(uuid)); + snprintf(uuid, sizeof(uuid), "%s", switch_core_get_uuid()); snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid)); break; default: From 97930570dce98a436ce720ec00e886c8458979b9 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 22 Jan 2021 21:57:24 +0300 Subject: [PATCH 077/655] [Core] Fix possible memory leak of switch_core_session_message_t in switch_core_session_queue_indication() --- src/switch_core_session.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 36cf62f111..4dde4cba84 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1026,8 +1026,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core msg->message_id = indication; msg->from = __FILE__; switch_set_flag(msg, SCSMF_DYNAMIC); - switch_core_session_queue_message(session, msg); - return SWITCH_STATUS_SUCCESS; + + if (switch_core_session_queue_message(session, msg) == SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_SUCCESS; + } + + free(msg); } return SWITCH_STATUS_FALSE; From 4aa1c1736fb46887dc89194a79a188506321f074 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 20 Jan 2021 18:48:01 +0300 Subject: [PATCH 078/655] [mod_sofia] scan-build in sofia_glue_do_invite(): Null pointer passed as an argument to a 'nonnull' parameter --- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2eea09bd5e..0c0035412f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1211,7 +1211,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) } sofia_glue_get_url_from_contact(rpid_domain, 0); - if ((rpid_domain = strrchr(rpid_domain, '@'))) { + if (rpid_domain && (rpid_domain = strrchr(rpid_domain, '@'))) { rpid_domain++; if ((p = strchr(rpid_domain, ';'))) { *p = '\0'; From cfdd1d9be89ae4b1e9d654ff84512671ff73bc2c Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 26 Jan 2021 20:26:14 +0300 Subject: [PATCH 079/655] [mod_http_cache] Handle error cases to avoid using uninitialized variables in aws logic. --- src/mod/applications/mod_http_cache/aws.c | 27 +++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/mod/applications/mod_http_cache/aws.c b/src/mod/applications/mod_http_cache/aws.c index 740fe2e9c4..cc02b4e5b5 100644 --- a/src/mod/applications/mod_http_cache/aws.c +++ b/src/mod/applications/mod_http_cache/aws.c @@ -144,10 +144,12 @@ static char* aws_s3_signature_key(char* key_signing, switch_aws_s3_profile* aws_ char key_service[SHA256_DIGEST_LENGTH]; char* aws4_secret_access_key = switch_mprintf("AWS4%s", aws_s3_profile->access_key_secret); - hmac256(key_date, SHA256_DIGEST_LENGTH, aws4_secret_access_key, strlen(aws4_secret_access_key), aws_s3_profile->date_stamp); - hmac256(key_region, SHA256_DIGEST_LENGTH, key_date, SHA256_DIGEST_LENGTH, aws_s3_profile->region); - hmac256(key_service, SHA256_DIGEST_LENGTH, key_region, SHA256_DIGEST_LENGTH, "s3"); - hmac256(key_signing, SHA256_DIGEST_LENGTH, key_service, SHA256_DIGEST_LENGTH, "aws4_request"); + if (!hmac256(key_date, SHA256_DIGEST_LENGTH, aws4_secret_access_key, (unsigned int)strlen(aws4_secret_access_key), aws_s3_profile->date_stamp) + || !hmac256(key_region, SHA256_DIGEST_LENGTH, key_date, SHA256_DIGEST_LENGTH, aws_s3_profile->region) + || !hmac256(key_service, SHA256_DIGEST_LENGTH, key_region, SHA256_DIGEST_LENGTH, "s3") + || !hmac256(key_signing, SHA256_DIGEST_LENGTH, key_service, SHA256_DIGEST_LENGTH, "aws4_request")) { + key_signing = NULL; + } switch_safe_free(aws4_secret_access_key); @@ -166,7 +168,7 @@ static char* aws_s3_standardized_query_string(switch_aws_s3_profile* aws_s3_prof char* standardized_query_string; credential = switch_mprintf("%s%%2F%s%%2F%s%%2Fs3%%2Faws4_request", aws_s3_profile->access_key_id, aws_s3_profile->date_stamp, aws_s3_profile->region); - switch_snprintf(expires, 9, "%ld", aws_s3_profile->expires); + switch_snprintf(expires, 9, "%" SWITCH_TIME_T_FMT, aws_s3_profile->expires); standardized_query_string = switch_mprintf( "X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=%s&X-Amz-Date=%s&X-Amz-Expires=%s&X-Amz-SignedHeaders=host", @@ -243,13 +245,14 @@ static char *aws_s3_authentication_create(switch_aws_s3_profile* aws_s3_profile) string_to_sign = aws_s3_string_to_sign(standardized_request, aws_s3_profile); // Get signature_key - aws_s3_signature_key(signature_key, aws_s3_profile); - - // Get signature - hmac256_hex(signature, signature_key, SHA256_DIGEST_LENGTH, string_to_sign); - - // Build final query string - query_param = switch_mprintf("%s&X-Amz-Signature=%s", standardized_query_string, signature); + if (!aws_s3_signature_key(signature_key, aws_s3_profile) + // Get signature + || !hmac256_hex(signature, signature_key, SHA256_DIGEST_LENGTH, string_to_sign)) { + query_param = NULL; + } else { + // Build final query string + query_param = switch_mprintf("%s&X-Amz-Signature=%s", standardized_query_string, signature); + } switch_safe_free(string_to_sign); switch_safe_free(standardized_query_string); From f348ab9d3893ad116e7c94a7fd2d42f4307b7313 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 26 Jan 2021 20:23:52 +0300 Subject: [PATCH 080/655] [mod_sofia] Fix use of uninitialized network_ip in sofia_handle_sip_r_invite() --- 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 dcedbc7e43..e1e6435670 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6516,7 +6516,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status const char *uuid; switch_core_session_t *other_session; private_object_t *tech_pvt = switch_core_session_get_private(session); - char network_ip[80]; + char network_ip[80] = ""; int network_port = 0; switch_caller_profile_t *caller_profile = NULL; int has_t38 = 0; From 3134c9aa578d119528a610c5d1fcfa2ec1ac4c6e Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 26 Jan 2021 20:24:38 +0300 Subject: [PATCH 081/655] [mod_callcenter] Fix use of uninitialized res variable in cc_agent_update() --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 58816ea0ac..cba6dc84f4 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -998,7 +998,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen { cc_status_t result = CC_STATUS_SUCCESS; char *sql; - char res[256]; + char res[256] = ""; switch_event_t *event; /* Check to see if agent already exist */ From e6e227d1f4f44f64966417f37b2cb9bb7fd6daae Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 28 Jan 2021 03:13:13 +0300 Subject: [PATCH 082/655] [Core] Fix leaking stream in switch_channel_expand_variables_check() --- src/switch_channel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_channel.c b/src/switch_channel.c index c5c61d43ae..09a0697f9f 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -4175,6 +4175,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) { func_val = NULL; sub_val = ""; + free(stream.data); } else { if (switch_api_execute(vname, vval, channel->session, &stream) == SWITCH_STATUS_SUCCESS) { func_val = stream.data; From 2ca0d02531f91f66cc2f34b909eb14221dc04f54 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 18 Feb 2021 19:02:03 +0300 Subject: [PATCH 083/655] [Core] Fix leaking codec, timer and abuf in switch_ivr_play_file() in the case of failing switch_ivr_phrase_macro() or switch_ivr_speak_text() --- src/switch_ivr_play_say.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index e217950958..a8cb5fd4a1 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1309,8 +1309,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess *arg++ = '\0'; } if ((status = switch_ivr_phrase_macro(session, dup, arg, lang, args)) != SWITCH_STATUS_SUCCESS) { - arg_recursion_check_stop(args); - return status; + break; } continue; } else { @@ -1327,8 +1326,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess if (engine && text) { if ((status = switch_ivr_speak_text(session, engine, voice, (char *)text, args)) != SWITCH_STATUS_SUCCESS) { - arg_recursion_check_stop(args); - return status; + break; } } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Args\n"); From 8e2234a205f9b19b628670df6d517974c62b2317 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 20 Feb 2021 21:14:15 +0300 Subject: [PATCH 084/655] [Core] Fix race between switch_ivr_park_session() and the state machine. switch_core_session_run() wants to clear the CF_TRANSFER flag on state change while parking sets the flag. --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 9aa05fcd73..f1493a723d 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -3522,8 +3522,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_json_cdr(switch_core_session SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_channel_set_state(channel, CS_PARK); switch_channel_set_flag(channel, CF_TRANSFER); + switch_channel_set_state(channel, CS_PARK); } From 9e49a4176b3f1583eb3064076f8676918e4dcf35 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Sat, 20 Feb 2021 19:17:50 +0000 Subject: [PATCH 085/655] [test] Fix fst_session_park() to wait for CF_PARK instead of CS_PARK. CF_PARK will be set when the channel has actually parked. --- src/include/test/switch_test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/test/switch_test.h b/src/include/test/switch_test.h index eb6f7f3ee6..3413884145 100644 --- a/src/include/test/switch_test.h +++ b/src/include/test/switch_test.h @@ -141,7 +141,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char */ #define fst_session_park(session) \ switch_ivr_park_session(session); \ - switch_channel_wait_for_state(switch_core_session_get_channel(session), NULL, CS_PARK); + switch_channel_wait_for_flag(switch_core_session_get_channel(session), CF_PARK, SWITCH_TRUE, 10000, NULL); /** * check for test requirement - execute teardown on failure From 0059f0cc1b34a59818a7bfc5074b7be94b2e432a Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 18 Mar 2021 00:53:38 +0300 Subject: [PATCH 086/655] [mod_sofia] Gateways DOWN state introduced a regression: REG gateways in DOWN state could not be killed. NOREG gateways could change state in some conditions. Register and Unregister commands will now error if a gateway is NOREG. --- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 ++++ src/mod/endpoints/mod_sofia/sofia_reg.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3143fffa42..ecc925cf78 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3666,6 +3666,8 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t gateway_ptr->state = REG_STATE_UNREGED; stream->write_function(stream, "+OK\n"); sofia_reg_release_gateway(gateway_ptr); + } else { + stream->write_function(stream, "-ERR NOREG gateway [%s] can't be registered!\n", gname); } } else { stream->write_function(stream, "Invalid gateway!\n"); @@ -3697,6 +3699,8 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t gateway_ptr->state = REG_STATE_UNREGISTER; stream->write_function(stream, "+OK\n"); sofia_reg_release_gateway(gateway_ptr); + } else { + stream->write_function(stream, "-ERR NOREG gateway [%s] can't be unregistered!\n", gname); } } else { stream->write_function(stream, "Invalid gateway!\n"); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 5eee1c17e3..22997cecae 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -323,7 +323,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) free(pkey); } - if (gateway_ptr->state == REG_STATE_NOREG) { + if (gateway_ptr->state == REG_STATE_NOREG || gateway_ptr->state == REG_STATE_DOWN) { if (last) { last->next = gateway_ptr->next; @@ -356,7 +356,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) char *user_via = NULL; char *register_host = NULL; - if (!now) { + if (!now && ostate != REG_STATE_NOREG) { gateway_ptr->state = ostate = REG_STATE_UNREGED; gateway_ptr->expires_str = "0"; } From 9c589b7750f277a52e82c7c773cd093af40c4e6a Mon Sep 17 00:00:00 2001 From: sergey-safarov Date: Fri, 19 Mar 2021 00:30:08 +0300 Subject: [PATCH 087/655] [Build-System] freeswitch.spec update * freeswitch.spec: mod_shout - build always enabled * Removed not nessary erlang spec file * freeswitch.spec: Added cache direcory to http_cache module * freeswitch.spec: added zrtp feature in packaging * freeswitch.spec: added dependency for gumbo-parser-devel on fedora dist (HTML parser for MSRP) * remove autoload_configs dir dublication --- erlang.spec | 297 ------------------------------------------------ freeswitch.spec | 21 ++-- 2 files changed, 7 insertions(+), 311 deletions(-) delete mode 100644 erlang.spec diff --git a/erlang.spec b/erlang.spec deleted file mode 100644 index 6cdd7245b9..0000000000 --- a/erlang.spec +++ /dev/null @@ -1,297 +0,0 @@ -%define ver %{VERSION_NUMBER} -%define rel %{RELEASE_NUMBER} - -Name: erlang -Version: %{ver} -Release: %{rel}.1%{?dist} -Summary: General-purpose programming language and runtime environment - -Group: Development/Languages -License: ERPL -URL: http://www.erlang.org -Source: http://www.erlang.org/download/otp_src_R14B03.tar.gz -Source1: http://www.erlang.org/download/otp_doc_html_R14B03.tar.gz -Source2: http://www.erlang.org/download/otp_doc_man_R14B03.tar.gz -Patch1: otp-R14B-00-0001-Do-not-format-man-pages.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: ncurses-devel -BuildRequires: openssl-devel -BuildRequires: unixODBC-devel -BuildRequires: tcl-devel -BuildRequires: tk-devel -BuildRequires: gd-devel -# BuildRequires: jdk -BuildRequires: flex -BuildRequires: m4 - -Requires: tk - -# Added virtual Provides for each erlang module -Provides: erlang-appmon = %{version}-%{release} -Provides: erlang-asn1 = %{version}-%{release} -Provides: erlang-common_test = %{version}-%{release} -Provides: erlang-compiler = %{version}-%{release} -Provides: erlang-cosEvent = %{version}-%{release} -Provides: erlang-cosEventDomain = %{version}-%{release} -Provides: erlang-cosFileTransfer = %{version}-%{release} -Provides: erlang-cosNotification = %{version}-%{release} -Provides: erlang-cosProperty = %{version}-%{release} -Provides: erlang-cosTime = %{version}-%{release} -Provides: erlang-cosTransactions = %{version}-%{release} -Provides: erlang-crypto = %{version}-%{release} -Provides: erlang-debugger = %{version}-%{release} -Provides: erlang-dialyzer = %{version}-%{release} -Provides: erlang-docbuilder = %{version}-%{release} -Provides: erlang-edoc = %{version}-%{release} -Provides: erlang-erts = %{version}-%{release} -Provides: erlang-et = %{version}-%{release} -Provides: erlang-eunit = %{version}-%{release} -Provides: erlang-gs = %{version}-%{release} -Provides: erlang-hipe = %{version}-%{release} -Provides: erlang-ic = %{version}-%{release} -Provides: erlang-inets = %{version}-%{release} -Provides: erlang-inviso = %{version}-%{release} -Provides: erlang-kernel = %{version}-%{release} -Provides: erlang-megaco = %{version}-%{release} -Provides: erlang-mnesia = %{version}-%{release} -Provides: erlang-observer = %{version}-%{release} -Provides: erlang-odbc = %{version}-%{release} -Provides: erlang-orber = %{version}-%{release} -Provides: erlang-os_mon = %{version}-%{release} -Provides: erlang-otp_mibs = %{version}-%{release} -Provides: erlang-parsetools = %{version}-%{release} -Provides: erlang-percept = %{version}-%{release} -Provides: erlang-pman = %{version}-%{release} -Provides: erlang-public_key = %{version}-%{release} -Provides: erlang-runtime_tools = %{version}-%{release} -Provides: erlang-sasl = %{version}-%{release} -Provides: erlang-snmp = %{version}-%{release} -Provides: erlang-ssh = %{version}-%{release} -Provides: erlang-ssl = %{version}-%{release} -Provides: erlang-stdlib = %{version}-%{release} -Provides: erlang-syntax_tools = %{version}-%{release} -Provides: erlang-test_server = %{version}-%{release} -Provides: erlang-toolbar = %{version}-%{release} -Provides: erlang-tools = %{version}-%{release} -Provides: erlang-tv = %{version}-%{release} -Provides: erlang-typer = %{version}-%{release} -Provides: erlang-webtool = %{version}-%{release} -Provides: erlang-xmerl = %{version}-%{release} - -%description -Erlang is a general-purpose programming language and runtime -environment. Erlang has built-in support for concurrency, distribution -and fault tolerance. Erlang is used in several large telecommunication -systems from Ericsson. - - -%package doc -Summary: Erlang documentation -Group: Development/Languages - -%description doc -Documentation for Erlang. - - -%prep -%setup -q -n otp_src_%{ver}%{rel} -#%setup -q -n otp_src_%{ver} - -%build -# WARN: --enable-dynamic-ssl-lib needed for preventing strange messages about missing dependencies on EPEL -# see https://bugzilla.redhat.com/458646 and https://bugzilla.redhat.com/499525 -%ifarch sparcv9 sparc64 -CFLAGS="$RPM_OPT_FLAGS -mcpu=ultrasparc -fno-strict-aliasing" %configure --enable-dynamic-ssl-lib -%else -CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %configure --enable-dynamic-ssl-lib -%endif -chmod -R u+w . -make - - -%install -rm -rf $RPM_BUILD_ROOT -make INSTALL_PREFIX=$RPM_BUILD_ROOT install - -# clean up -find $RPM_BUILD_ROOT%{_libdir}/erlang -perm 0775 | xargs chmod 755 -find $RPM_BUILD_ROOT%{_libdir}/erlang -name Makefile | xargs chmod 644 -find $RPM_BUILD_ROOT%{_libdir}/erlang -name \*.o | xargs chmod 644 -find $RPM_BUILD_ROOT%{_libdir}/erlang -name \*.bat | xargs rm -f -find $RPM_BUILD_ROOT%{_libdir}/erlang -name index.txt.old | xargs rm -f - -# doc -mkdir -p erlang_doc -tar -C erlang_doc -zxf %{SOURCE1} -tar -C $RPM_BUILD_ROOT/%{_libdir}/erlang -zxf %{SOURCE2} - -# make links to binaries -#mkdir -p $RPM_BUILD_ROOT/%{_bindir} -#cd $RPM_BUILD_ROOT/%{_bindir} -#for file in erl erlc escript dialyzer -#do -# ln -sf ../%{_lib}/erlang/bin/$file . -#done - -# remove buildroot from installed files -cd $RPM_BUILD_ROOT/%{_libdir}/erlang -sed -i "s|$RPM_BUILD_ROOT||" erts*/bin/{erl,start} releases/RELEASES bin/{erl,start} - - -%clean -rm -rf $RPM_BUILD_ROOT - - -%files -%defattr(-,root,root) -%doc AUTHORS EPLICENCE README.md -%{_bindir}/* -%{_libdir}/erlang - - -%files doc -%defattr(-,root,root) -%doc erlang_doc/* - - -%post -%{_libdir}/erlang/Install -minimal %{_libdir}/erlang >/dev/null 2>/dev/null - - -%changelog -* Wed Sep 29 2010 Anthony Molinaro - R14B-00.1 -- modified R13B04 spec to work with R14B - -* Wed Jul 7 2010 Anthony Molinaro - R13B-04.1 -- modified the R12B spec to work with R13B04 - -* Mon Jun 7 2010 Peter Lemenkov - R12B-5.10 -- Added missing virtual provides erlang-erts - -* Tue May 25 2010 Peter Lemenkov - R12B-5.9 -- Use java-1.4.2 only for EL-[45] -- Added virtual provides for each erlang module -- Small typo fix - -* Mon Apr 19 2010 Peter Lemenkov - R12B-5.8 -- Patches rebased -- Added patches 6,7 from trunk -- Use %%configure - -* Tue Apr 21 2009 Debarshi Ray R12B-5.7 -- Updated rpath patch. -- Fixed configure to respect $RPM_OPT_FLAGS. - -* Sun Mar 1 2009 Gerard Milmeister - R12B-5.6 -- new release R12B-5 -- link escript and dialyzer to %{_bindir} - -* Tue Feb 24 2009 Fedora Release Engineering - R12B-5.5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Sat Feb 14 2009 Dennis Gilmore - R12B-4.5 -- fix sparc arches to compile - -* Fri Jan 16 2009 Tomas Mraz - R12B-4.4 -- rebuild with new openssl - -* Sat Oct 25 2008 Gerard Milmeister - R12B-4.1 -- new release R12B-4 - -* Fri Sep 5 2008 Gerard Milmeister - R12B-3.3 -- fixed sslrpath patch - -* Thu Jul 17 2008 Tom "spot" Callaway - R12B-3.2 -- fix license tag - -* Sun Jul 6 2008 Gerard Milmeister - R12B-3.1 -- new release R12B-3 - -* Thu Mar 27 2008 Gerard Milmeister - R12B-1.1 -- new release R12B-1 - -* Sat Feb 23 2008 Gerard Milmeister - R12B-0.3 -- disable strict aliasing optimization - -* Mon Feb 18 2008 Fedora Release Engineering - R12B-0.2 -- Autorebuild for GCC 4.3 - -* Sat Dec 8 2007 Gerard Milmeister - R12B-0.1 -- new release R12B-0 - -* Wed Dec 05 2007 Release Engineering - R11B-6 - - Rebuild for deps - -* Sun Aug 19 2007 Gerard Milmeister - R11B-5.3 -- fix some permissions - -* Sat Aug 18 2007 Gerard Milmeister - R11B-5.2 -- enable dynamic linking for ssl - -* Sat Aug 18 2007 Gerard Milmeister - R11B-5.1 -- new release R11B-5 - -* Sat Mar 24 2007 Thomas Fitzsimmons - R11B-2.4 -- Require java-1.5.0-gcj-devel for build. - -* Sun Dec 31 2006 Gerard Milmeister - R11B-2.3 -- remove buildroot from installed files - -* Sat Dec 30 2006 Gerard Milmeister - R11B-2.2 -- added patch for compiling with glibc 2.5 - -* Sat Dec 30 2006 Gerard Milmeister - R11B-2.1 -- new version R11B-2 - -* Mon Aug 28 2006 Gerard Milmeister - R11B-0.3 -- Rebuild for FE6 - -* Wed Jul 5 2006 Gerard Milmeister - R11B-0.2 -- add BR m4 - -* Thu May 18 2006 Gerard Milmeister - R11B-0.1 -- new version R11B-0 - -* Wed May 3 2006 Gerard Milmeister - R10B-10.3 -- added patch for run_erl by Knut-Håvard Aksnes - -* Mon Mar 13 2006 Gerard Milmeister - R10B-10.1 -- new version R10B-10 - -* Thu Dec 29 2005 Gerard Milmeister - R10B-9.1 -- New Version R10B-9 - -* Sat Oct 29 2005 Gerard Milmeister - R10B-8.2 -- updated rpath patch - -* Sat Oct 29 2005 Gerard Milmeister - R10B-8.1 -- New Version R10B-8 - -* Sat Oct 1 2005 Gerard Milmeister - R10B-6.4 -- Added tk-devel and tcl-devel to buildreq -- Added tk to req - -* Tue Sep 6 2005 Gerard Milmeister - R10B-6.3 -- Remove perl BuildRequires - -* Tue Aug 30 2005 Gerard Milmeister - R10B-6.2 -- change /usr/lib to %%{_libdir} -- redirect output in %%post to /dev/null -- add unixODBC-devel to BuildRequires -- split doc off to erlang-doc package - -* Sat Jun 25 2005 Gerard Milmeister - R10B-6.1 -- New Version R10B-6 - -* Sun Feb 13 2005 Gerard Milmeister - R10B-3.1 -- New Version R10B-3 - -* Mon Dec 27 2004 Gerard Milmeister - 0:R10B-2-0.fdr.1 -- New Version R10B-2 - -* Wed Oct 6 2004 Gerard Milmeister - 0:R10B-0.fdr.1 -- New Version R10B - -* Thu Oct 16 2003 Gerard Milmeister - 0:R9B-1.fdr.1 -- First Fedora release diff --git a/freeswitch.spec b/freeswitch.spec index 4cf49c2118..66bd762caa 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -37,7 +37,6 @@ %define build_mod_esl 0 %define build_mod_rayo 1 %define build_mod_ssml 1 -%define build_mod_shout 1 %define build_mod_opusfile 0 %define build_mod_v8 0 @@ -47,7 +46,6 @@ %{?with_py26_esl:%define build_py26_esl 1 } %{?with_timerfd:%define build_timerfd 1 } %{?with_mod_esl:%define build_mod_esl 1 } -%{?with_mod_shout:%define build_mod_shout 1 } %{?with_mod_opusfile:%define build_mod_opusfile 1 } %{?with_mod_v8:%define build_mod_v8 1 } @@ -176,6 +174,9 @@ Requires: libsndfile PreReq: %insserv_prereq %fillup_prereq %endif +%if 0%{?fedora} +BuildRequires: gumbo-parser-devel +%endif ###################################################################################################################### # @@ -1078,7 +1079,6 @@ Mod shell stream is a FreeSWITCH module to allow you to stream audio from an arbitrary shell command. You could use it to read audio from a database, from a soundcard, etc. -%if %{build_mod_shout} %package format-mod-shout Summary: Implements Media Steaming from arbitrary shell commands for the FreeSWITCH open source telephony platform Group: System/Libraries @@ -1093,7 +1093,6 @@ BuildRequires: lame-devel %description format-mod-shout Mod Shout is a FreeSWITCH module to allow you to stream audio from MP3s or a i shoutcast stream. -%endif %if %{build_mod_opusfile} %package format-mod-opusfile @@ -1503,10 +1502,7 @@ EVENT_HANDLERS_MODULES+=" event_handlers/mod_rayo" # ###################################################################################################################### FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ - formats/mod_shell_stream formats/mod_sndfile formats/mod_tone_stream" -%if %{build_mod_shout} -FORMATS_MODULES+=" formats/mod_shout " -%endif + formats/mod_shell_stream formats/mod_shout formats/mod_sndfile formats/mod_tone_stream" %if %{build_mod_ssml} FORMATS_MODULES+=" formats/mod_ssml" %endif @@ -1622,6 +1618,7 @@ autoreconf --force --install --with-odbc \ --with-erlang \ --with-openssl \ +--enable-zrtp \ %{?configure_options} unset MODULES @@ -1645,6 +1642,7 @@ cd libs/esl %{__mkdir} -p %{buildroot}%{prefix}/log %{__mkdir} -p %{buildroot}%{logfiledir} %{__mkdir} -p %{buildroot}%{runtimedir} +%{__mkdir} -p %{buildroot}%{_localstatedir}/cache/freeswitch #install the esl stuff cd libs/esl @@ -2073,6 +2071,7 @@ fi %{MODINSTDIR}/mod_httapi.so* %files application-http-cache +%dir %attr(0750, freeswitch, daemon) %{_localstatedir}/cache/freeswitch %{MODINSTDIR}/mod_http_cache.so* %files application-lcr @@ -2324,10 +2323,8 @@ fi %files format-shell-stream %{MODINSTDIR}/mod_shell_stream.so* -%if %{build_mod_shout} %files format-mod-shout %{MODINSTDIR}/mod_shout.so* -%endif %if %{build_mod_ssml} %files format-ssml @@ -2344,18 +2341,15 @@ fi ###################################################################################################################### %files lua %{MODINSTDIR}/mod_lua*.so* -%dir %attr(0750, freeswitch, daemon) %{sysconfdir}/autoload_configs %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/lua.conf.xml %files perl %{MODINSTDIR}/mod_perl*.so* %{prefix}/perl/* -%dir %attr(0750, freeswitch, daemon) %{sysconfdir}/autoload_configs %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/perl.conf.xml %files python %{MODINSTDIR}/mod_python*.so* -%dir %attr(0750, freeswitch, daemon) %{sysconfdir}/autoload_configs %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/python.conf.xml %if %{build_mod_v8} @@ -2365,7 +2359,6 @@ fi %{LIBDIR}/libicui18n.so %{LIBDIR}/libicuuc.so %endif -%dir %attr(0750, freeswitch, daemon) %{sysconfdir}/autoload_configs %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/v8.conf.xml ###################################################################################################################### From 48c4db71c229444bc12a53550d7fd12f51131956 Mon Sep 17 00:00:00 2001 From: Alexander Traud Date: Tue, 13 Oct 2020 14:33:19 +0200 Subject: [PATCH 088/655] [core] Allow other (D)TLS Curves/Groups beside P-256 Five years ago, commit 8e1b2ea enabled ECDHE for the DTLS server by hard-coding P-256. Released before that, OpenSSL 1.0.2, allows auto selection of the curve (P-256, P-384, and P-512). OpenSSL 1.1.x has this enabled on default, which adds groups/curves like X25519 and X448 automatically. This change here allows DTLS clients with a demand for Security Level 4 (192 bit) and 5 (256 bit) connecting to the DTLS server. --- src/switch_rtp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e2e6dedc2d..fbe49eb15a 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3734,8 +3734,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d DH *dh; switch_status_t status = SWITCH_STATUS_SUCCESS; #ifndef OPENSSL_NO_EC +#if OPENSSL_VERSION_NUMBER < 0x10002000L EC_KEY* ecdh; #endif +#endif #ifndef HAVE_OPENSSL_DTLS_SRTP return SWITCH_STATUS_FALSE; @@ -3871,6 +3873,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d //SSL_set_verify(dtls->ssl, (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT), cb_verify_peer); #ifndef OPENSSL_NO_EC +#if OPENSSL_VERSION_NUMBER < 0x10002000L ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); if (!ecdh) { switch_goto_status(SWITCH_STATUS_FALSE, done); @@ -3878,6 +3881,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d SSL_set_options(dtls->ssl, SSL_OP_SINGLE_ECDH_USE); SSL_set_tmp_ecdh(dtls->ssl, ecdh); EC_KEY_free(ecdh); +#elif OPENSSL_VERSION_NUMBER < 0x10100000L + SSL_set_ecdh_auto(dtls->ssl, 1); + SSL_set_options(dtls->ssl, SSL_OP_SINGLE_ECDH_USE); +#endif #endif SSL_set_verify(dtls->ssl, SSL_VERIFY_NONE, NULL); From fddc6adf8d3d1581f041984bd475ff18336a3f4e Mon Sep 17 00:00:00 2001 From: Aron Podrigal Date: Thu, 18 Mar 2021 17:13:01 -0500 Subject: [PATCH 089/655] [mod_pgsql] Use PQcmdTuples() to get number of effected rows to support UPDATE and INSERT without RETURNING. --- src/mod/databases/mod_pgsql/mod_pgsql.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c index f7c2983f91..8c24cf9fce 100644 --- a/src/mod/databases/mod_pgsql/mod_pgsql.c +++ b/src/mod/databases/mod_pgsql/mod_pgsql.c @@ -633,6 +633,7 @@ error: switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pgsql_result_t **result_out, int msec) { + char *affected_rows = NULL; switch_pgsql_result_t *res; switch_time_t start; switch_time_t ctime; @@ -747,6 +748,11 @@ switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pg res->result = PQgetResult(handle->con); if (res->result) { + affected_rows = PQcmdTuples(res->result); + if (!zstr(affected_rows)) { + handle->affected_rows = atoi(affected_rows); + } + *result_out = res; res->status = PQresultStatus(res->result); switch (res->status) { @@ -757,7 +763,6 @@ switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pg case PGRES_TUPLES_OK: { res->rows = PQntuples(res->result); - handle->affected_rows = res->rows; res->cols = PQnfields(res->result); } break; From af272f517947c99faa08ac22f70866f8c7150bb2 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 19 Mar 2021 23:31:46 +0300 Subject: [PATCH 090/655] [mod_conference] Bridged conference did not wait it's last member before destroy and crashed. --- .../applications/mod_conference/mod_conference.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index a2b5058656..d1ee467757 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1895,7 +1895,7 @@ SWITCH_STANDARD_APP(conference_function) const char *cflags_str, *v_cflags_str; member_flag_t mflags[MFLAG_MAX] = { 0 }; switch_core_session_message_t msg = { 0 }; - uint8_t rl = 0, isbr = 0; + uint8_t isbr = 0; char *dpin = ""; const char *mdpin = ""; conference_xml_cfg_t xml_cfg = { 0 }; @@ -2200,14 +2200,6 @@ SWITCH_STANDARD_APP(conference_function) /* Indicate the conference is dynamic */ conference_utils_set_flag_locked(conference, CFLAG_DYNAMIC); - /* acquire a read lock on the thread so it can't leave without us */ - if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Read Lock Fail\n"); - goto done; - } - - rl++; - /* Start the conference thread for this conference */ conference_launch_thread(conference); @@ -2215,7 +2207,6 @@ SWITCH_STANDARD_APP(conference_function) } else { /* setup user variable */ switch_channel_set_variable(channel, "conference_name", conference->name); switch_channel_set_variable(channel, SWITCH_RFC7989_APP_SESSION_ID_VARIABLE, conference->uuid_str); - rl++; } /* Moderator PIN as a channel variable */ @@ -2595,7 +2586,7 @@ SWITCH_STANDARD_APP(conference_function) switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); /* release the readlock */ - if (rl) { + if (conference) { switch_thread_rwlock_unlock(conference->rwlock); } @@ -3798,6 +3789,9 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co switch_event_fire(&event); end: + if (conference) { + switch_thread_rwlock_rdlock(conference->rwlock); + } switch_mutex_unlock(conference_globals.hash_mutex); From dfb9541b08f033b89a25994fc5c8708ef4889404 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 11 Dec 2020 22:32:25 +0300 Subject: [PATCH 091/655] [mod_sofia] Use thread-safe alternatives when destroying nua and nua_handle references. Bump sofia-sip library requirement to version 1.13.3 --- configure.ac | 2 +- debian/bootstrap.sh | 2 +- freeswitch.spec | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 ++-- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 26 ++++++++++++++++--------- src/mod/endpoints/mod_sofia/sofia_reg.c | 4 ++-- 7 files changed, 25 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 9ea2d11b87..810003eda2 100644 --- a/configure.ac +++ b/configure.ac @@ -725,7 +725,7 @@ PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[ AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent]) ]) -PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.12.12],[ +PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.3],[ AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[ AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent]) ]) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index c9b2d522f9..594e7adb7c 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -332,7 +332,7 @@ Build-Depends: uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev, # used by many modules libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, - bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.12.12), + bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.3), libspandsp3-dev, # used to format the private freeswitch apt-repo key properly gnupg, diff --git a/freeswitch.spec b/freeswitch.spec index 66bd762caa..3bbc518119 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -142,7 +142,7 @@ BuildRequires: curl-devel >= 7.19 BuildRequires: gcc-c++ BuildRequires: libtool >= 1.5.17 BuildRequires: openssl-devel >= 1.0.1e -BuildRequires: sofia-sip-devel >= 1.12.12 +BuildRequires: sofia-sip-devel >= 1.13.3 BuildRequires: spandsp3-devel >= 3.0 BuildRequires: pcre-devel BuildRequires: speex-devel diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ecc925cf78..8c1b7fd325 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1328,7 +1328,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi de->session = session; } - sofia_process_dispatch_event(&de); + sofia_process_dispatch_event(&de, SWITCH_FALSE); switch_mutex_unlock(tech_pvt->sofia_mutex); @@ -5791,7 +5791,7 @@ void general_event_handler(switch_event_t *event) TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END()); if (call_id && nh) { - nua_handle_unref(nh); + nua_handle_unref_user(nh); } done: diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index d4631b02d6..db709b9721 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1237,7 +1237,7 @@ uint32_t sofia_presence_get_cseq(sofia_profile_t *profile); void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua_handle_t *nh, sofia_dispatch_event_t *de, sofia_nat_parse_t *np); void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on); -void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); +void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t stack_thread); void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep); char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool); void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e1e6435670..b76a804e8e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2230,7 +2230,7 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run_once(switch_thread_t *thread, void if (de) { pool = de->pool; de->pool = NULL; - sofia_process_dispatch_event(&de); + sofia_process_dispatch_event(&de, SWITCH_FALSE); } if (pool) { @@ -2263,7 +2263,7 @@ void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep) switch_thread_pool_launch_thread(&td); } -void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) +void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t stack_thread) { sofia_dispatch_event_t *de = *dep; nua_handle_t *nh = de->nh; @@ -2282,8 +2282,15 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) profile->queued_events--; switch_mutex_unlock(profile->flag_mutex); - if (nh) nua_handle_unref(nh); - nua_unref(nua); + if (stack_thread) { + /* Safe to unref directly */ + if (nh) nua_handle_unref(nh); + nua_unref(nua); + } else { + /* This is not a stack thread, need to call via stack (_user) using events */ + if (nh) nua_handle_unref_user(nh); + nua_unref_user(nua); + } } @@ -2320,7 +2327,7 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run(switch_thread_t *thread, void *obj if (pop) { sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) pop; - sofia_process_dispatch_event(&de); + sofia_process_dispatch_event(&de, SWITCH_FALSE); } else { break; } @@ -2374,7 +2381,8 @@ void sofia_queue_message(sofia_dispatch_event_t *de) int launch = 0; if (mod_sofia_globals.running == 0 || !mod_sofia_globals.msg_queue) { - sofia_process_dispatch_event(&de); + /* Calling with SWITCH_TRUE as we are sure this is the stack's thread */ + sofia_process_dispatch_event(&de, SWITCH_TRUE); return; } @@ -7877,7 +7885,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR"); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } - nua_handle_unref(bnh); + nua_handle_unref_user(bnh); } su_home_unref(home); home = NULL; @@ -9311,7 +9319,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t } switch_core_session_rwunlock(b_session); } - nua_handle_unref(bnh); + nua_handle_unref_user(bnh); } else { /* the other channel is on a different box, we have to go find them */ if (exten && (br_a = switch_channel_get_partner_uuid(channel_a))) { switch_core_session_t *a_session; @@ -11344,7 +11352,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_core_session_rwunlock(b_session); } } - nua_handle_unref(bnh); + nua_handle_unref_user(bnh); } else if (sip->sip_replaces && sip->sip_replaces->rp_call_id) { switch_core_session_t *b_session = NULL; if ((b_session = switch_core_session_locate((char*) sip->sip_replaces->rp_call_id))) { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 22997cecae..582de54cb4 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -694,7 +694,7 @@ void sofia_reg_check_socket(sofia_profile_t *profile, const char *call_id, const switch_mutex_lock(profile->flag_mutex); if ((hnh = switch_core_hash_find(profile->reg_nh_hash, key))) { switch_core_hash_delete(profile->reg_nh_hash, key); - nua_handle_unref(hnh); + nua_handle_unref_user(hnh); nua_handle_destroy(hnh); } switch_mutex_unlock(profile->flag_mutex); @@ -1214,7 +1214,7 @@ void sofia_reg_close_handles(sofia_profile_t *profile) for (hi = switch_core_hash_first_iter( profile->reg_nh_hash, hi); hi; hi = switch_core_hash_next(&hi)) { switch_core_hash_this(hi, &var, NULL, &val); if ((nh = (nua_handle_t *) val)) { - nua_handle_unref(nh); + nua_handle_unref_user(nh); nua_handle_destroy(nh); switch_core_hash_delete(profile->reg_nh_hash, (char *) var); goto top; From c63f9524eebf2f03f8d0a496294c8be2b2a567e8 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Thu, 25 Feb 2021 06:04:27 -0500 Subject: [PATCH 092/655] [core] Remove unused buffers and mutexes in switch_core_session. Remove destruction of resamplers that will already be destroyed by switch_core_session_reset(). --- src/include/private/switch_core_pvt.h | 13 +------------ src/switch_core_media.c | 17 +---------------- src/switch_core_session.c | 15 +-------------- 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 68a8d9c463..388813701f 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -135,8 +135,6 @@ struct switch_core_session { switch_mutex_t *codec_init_mutex; switch_mutex_t *codec_read_mutex; switch_mutex_t *codec_write_mutex; - switch_mutex_t *video_codec_read_mutex; - switch_mutex_t *video_codec_write_mutex; switch_thread_cond_t *cond; switch_mutex_t *frame_read_mutex; @@ -170,15 +168,6 @@ struct switch_core_session { uint8_t raw_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]; uint8_t enc_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]; - /* video frame.data being trated differently than audio, allocate a dynamic data buffer if necessary*/ - switch_buffer_t *video_raw_write_buffer; - switch_frame_t video_raw_write_frame; - // switch_frame_t video_enc_write_frame; - - switch_buffer_t *video_raw_read_buffer; - switch_frame_t video_raw_read_frame; - // switch_frame_t video_enc_read_frame; - switch_codec_t bug_codec; uint32_t read_frame_count; uint32_t track_duration; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 23e77047b9..fe0abd918d 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2018, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -3583,7 +3583,6 @@ static void switch_core_session_parse_codec_settings(switch_core_session_t *sess } } - //? SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_session_t *session, int force) { @@ -3727,20 +3726,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_ (uint32_t) a_engine->read_impl.microseconds_per_packet / 1000 != a_engine->cur_payload_map->codec_ms || a_engine->read_impl.samples_per_second != a_engine->cur_payload_map->rm_rate ) { - if (session->read_resampler) { - switch_mutex_lock(session->resample_mutex); - switch_resample_destroy(&session->read_resampler); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Deactivating read resampler\n"); - switch_mutex_unlock(session->resample_mutex); - } - - if (session->write_resampler) { - switch_mutex_lock(session->resample_mutex); - switch_resample_destroy(&session->write_resampler); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Deactivating write resampler\n"); - switch_mutex_unlock(session->resample_mutex); - } - switch_core_session_reset(session, 0, 0); switch_channel_audio_sync(session->channel); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 4dde4cba84..f8ebe3db72 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -1393,17 +1393,6 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, s switch_buffer_destroy(&session->raw_read_buffer); switch_mutex_unlock(session->codec_read_mutex); - switch_mutex_lock(session->video_codec_write_mutex); - switch_buffer_destroy(&session->video_raw_write_buffer); - switch_mutex_unlock(session->video_codec_write_mutex); - - switch_mutex_lock(session->video_codec_read_mutex); - switch_buffer_destroy(&session->video_raw_read_buffer); - switch_mutex_unlock(session->video_codec_read_mutex); - - //video_raw_read_frame.data is dynamically allocated if necessary, so wipe this also - switch_safe_free(session->video_raw_read_frame.data); - if (flush_dtmf) { while ((has = switch_channel_has_dtmf(channel))) { switch_channel_flush_dtmf(channel); @@ -2424,8 +2413,6 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ switch_mutex_init(&session->codec_init_mutex, SWITCH_MUTEX_NESTED, session->pool); switch_mutex_init(&session->codec_read_mutex, SWITCH_MUTEX_NESTED, session->pool); switch_mutex_init(&session->codec_write_mutex, SWITCH_MUTEX_NESTED, session->pool); - switch_mutex_init(&session->video_codec_read_mutex, SWITCH_MUTEX_NESTED, session->pool); - switch_mutex_init(&session->video_codec_write_mutex, SWITCH_MUTEX_NESTED, session->pool); switch_mutex_init(&session->frame_read_mutex, SWITCH_MUTEX_NESTED, session->pool); switch_thread_rwlock_create(&session->bug_rwlock, session->pool); switch_thread_cond_create(&session->cond, session->pool); From c61d89a47fc793475aa7ef97b39c58d266284889 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 27 Feb 2021 01:04:16 +0300 Subject: [PATCH 093/655] [Core] Add new switch_core_session_try_reset() API to fix a deadlock for the case when two threads want to set session codecs. --- src/include/switch_core.h | 8 ++++++++ src/switch_core_media.c | 17 +++++++++++++++-- src/switch_core_session.c | 17 +++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 92e1452aa0..6299e09c52 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1359,6 +1359,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_impl(switch_ */ SWITCH_DECLARE(void) switch_core_session_reset(_In_ switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec); +/*! + \brief Reset the buffers and resampler on a session, fail if can not lock codec mutexes + \param session the session to reset + \param flush_dtmf flush all queued dtmf events too + \return SWITCH_STATUS_SUCCESS if the session was reset +*/ +SWITCH_DECLARE(switch_status_t) switch_core_session_try_reset(switch_core_session_t* session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec); + /*! \brief Write a frame to a session \param session the session to write to diff --git a/src/switch_core_media.c b/src/switch_core_media.c index fe0abd918d..ac8b9b9f71 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3702,9 +3702,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_ int resetting = 0; switch_media_handle_t *smh; switch_rtp_engine_t *a_engine; + switch_time_t start = switch_micro_time_now(); switch_assert(session); - + +retry: switch_mutex_lock(session->codec_init_mutex); if (!(smh = session->media_handle)) { @@ -3726,7 +3728,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_ (uint32_t) a_engine->read_impl.microseconds_per_packet / 1000 != a_engine->cur_payload_map->codec_ms || a_engine->read_impl.samples_per_second != a_engine->cur_payload_map->rm_rate ) { - switch_core_session_reset(session, 0, 0); + if (switch_core_session_try_reset(session, 0, 0) != SWITCH_STATUS_SUCCESS) { + switch_time_t elapsed = switch_micro_time_now() - start; + if (elapsed > 1000000) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Could not reset session in %"SWITCH_TIME_T_FMT" us. Give up.\n", elapsed); + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + + switch_mutex_unlock(session->codec_init_mutex); + switch_yield(10000); + goto retry; + } + switch_channel_audio_sync(session->channel); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, diff --git a/src/switch_core_session.c b/src/switch_core_session.c index f8ebe3db72..323adfc482 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1364,6 +1364,23 @@ SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_se return x; } +SWITCH_DECLARE(switch_status_t) switch_core_session_try_reset(switch_core_session_t* session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + + if (switch_mutex_trylock(session->codec_read_mutex) == SWITCH_STATUS_SUCCESS) { + if (switch_mutex_trylock(session->codec_write_mutex) == SWITCH_STATUS_SUCCESS) { + switch_core_session_reset(session, flush_dtmf, reset_read_codec); + switch_mutex_unlock(session->codec_write_mutex); + status = SWITCH_STATUS_SUCCESS; + } + + switch_mutex_unlock(session->codec_read_mutex); + } + + return status; +} + 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); From dd399975882ac473f38a6c6ac81d3b63dcad24bb Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Sat, 27 Feb 2021 14:01:27 +0000 Subject: [PATCH 094/655] [mod_av] fix memory leak on file playing --- src/mod/applications/mod_av/avformat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 0b3a452325..d45f584b2d 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1571,6 +1571,8 @@ GCC_DIAG_ON(deprecated-declarations) } + } else { + av_packet_unref(&pkt); } } From 2e65ca908d0fc74016fcb43be09ea3d2eb8d61b4 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Mon, 1 Mar 2021 19:48:45 +0200 Subject: [PATCH 095/655] [core] rtp: fix #ifdef DEBUG_TS_ROLLOVER (#357) --- src/switch_rtp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index fbe49eb15a..a461c9ba32 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -50,7 +50,9 @@ #include //#define DEBUG_TS_ROLLOVER -//#define TS_ROLLOVER_START 4294951295 +#ifdef DEBUG_TS_ROLLOVER +#define TS_ROLLOVER_START 4294951295 +#endif //#define DEBUG_2833 //#define RTP_DEBUG_WRITE_DELTA From effafb6993a963b425dc8a4b8be162f5c510131d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 10 Mar 2021 16:10:54 +0300 Subject: [PATCH 096/655] [Core] switch_ivr_set_user_xml: Buffer is wrongly truncated when it's small in get_prefixed_str() --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index f1493a723d..97bece7c36 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -3861,7 +3861,7 @@ static const char *get_prefixed_str(char *buffer, size_t buffer_size, const char if (str_len + prefix_size + 1 > buffer_size) { memcpy(buffer + prefix_size, str, buffer_size - prefix_size - 1); - buffer[buffer_size - prefix_size - 1] = '\0'; + buffer[buffer_size - 1] = '\0'; } else { memcpy(buffer + prefix_size, str, str_len + 1); } From 0cab42bfb6284aff2e25c611d0df142a8864ed6f Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 12 Mar 2021 17:27:07 +0300 Subject: [PATCH 097/655] [Core] Hangup call instead of crashing system on SSL_CTX_new failure. Improve logging. --- src/switch_rtp.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index a461c9ba32..d75219c6cf 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3732,6 +3732,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d const char *var; int ret; const char *kind = ""; + unsigned long ssl_method_error = 0; + unsigned long ssl_ctx_error = 0; + const SSL_METHOD *ssl_method; + SSL_CTX *ssl_ctx; BIO *bio; DH *dh; switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -3787,14 +3791,29 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d dtls->ca = switch_core_sprintf(rtp_session->pool, "%s%sca-bundle.crt", SWITCH_GLOBAL_dirs.certs_dir, SWITCH_PATH_SEPARATOR); #if OPENSSL_VERSION_NUMBER >= 0x10100000 - dtls->ssl_ctx = SSL_CTX_new((type & DTLS_TYPE_SERVER) ? DTLS_server_method() : DTLS_client_method()); + ssl_method = (type & DTLS_TYPE_SERVER) ? DTLS_server_method() : DTLS_client_method(); #else #ifdef HAVE_OPENSSL_DTLSv1_2_method - dtls->ssl_ctx = SSL_CTX_new((type & DTLS_TYPE_SERVER) ? (want_DTLSv1_2 ? DTLSv1_2_server_method() : DTLSv1_server_method()) : (want_DTLSv1_2 ? DTLSv1_2_client_method() : DTLSv1_client_method())); - #else - dtls->ssl_ctx = SSL_CTX_new((type & DTLS_TYPE_SERVER) ? DTLSv1_server_method() : DTLSv1_client_method()); + ssl_method = (type & DTLS_TYPE_SERVER) ? (want_DTLSv1_2 ? DTLSv1_2_server_method() : DTLSv1_server_method()) : (want_DTLSv1_2 ? DTLSv1_2_client_method() : DTLSv1_client_method()); + #else + ssl_method = (type & DTLS_TYPE_SERVER) ? DTLSv1_server_method() : DTLSv1_client_method(); #endif // HAVE_OPENSSL_DTLSv1_2_method #endif + + if (!ssl_method) { + ssl_method_error = ERR_peek_error(); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "%s ssl_method is NULL [%lu]\n", rtp_type(rtp_session), ssl_method_error); + } + + dtls->ssl_ctx = ssl_ctx = SSL_CTX_new(ssl_method); + + if (!ssl_ctx) { + ssl_ctx_error = ERR_peek_error(); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "%s SSL_CTX_new failed [%lu]\n", rtp_type(rtp_session), ssl_ctx_error); + switch_channel_hangup(switch_core_session_get_channel(rtp_session->session), SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } + switch_assert(dtls->ssl_ctx); bio = BIO_new_file(dtls->pem, "r"); From e3a6ec86f8542b3ec059ed3e2ff26bc72f1a0fe2 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Fri, 19 Mar 2021 02:28:40 +0300 Subject: [PATCH 098/655] [core] Update switch_ivr_enterprise_originate() to accept optional switch_dial_handle_list_t instead of dialstring. --- src/include/switch_ivr.h | 15 +- src/include/switch_types.h | 4 +- src/switch_ivr_originate.c | 348 +++++++++++++++++++++++++++++- tests/unit/switch_ivr_originate.c | 190 ++++++++++++++++ 4 files changed, 543 insertions(+), 14 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 34d6625541..09577152b4 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2019, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -525,7 +525,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess const char *cid_num_override, switch_caller_profile_t *caller_profile_override, switch_event_t *ovars, switch_originate_flag_t flags, - switch_call_cause_t *cancel_cause); + switch_call_cause_t *cancel_cause, + switch_dial_handle_list_t *hl); SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session); @@ -1057,6 +1058,16 @@ SWITCH_DECLARE(switch_event_t *) switch_dial_handle_get_global_vars(switch_dial_ SWITCH_DECLARE(switch_event_t *) switch_dial_leg_get_vars(switch_dial_leg_t *leg); SWITCH_DECLARE(const char *) switch_dial_leg_get_var(switch_dial_leg_t *leg, const char *key); SWITCH_DECLARE(int) switch_dial_handle_get_total(switch_dial_handle_t *handle); +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_serialize_json_obj(switch_dial_handle_list_t *hl, cJSON **json); +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_serialize_json(switch_dial_handle_list_t *hl, char **str); +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_json_obj(switch_dial_handle_list_t **handle, cJSON *json); +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_json(switch_dial_handle_list_t **handle, const char *handle_string); +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create(switch_dial_handle_list_t **hl); +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_handle(switch_dial_handle_list_t *hl, switch_dial_handle_t **handle); +SWITCH_DECLARE(void) switch_dial_handle_list_destroy(switch_dial_handle_list_t **hl); +SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var(switch_dial_handle_list_t *hl, const char *var, const char *val); +SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var_printf(switch_dial_handle_list_t *hl, const char *var, const char *fmt, ...); +SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_list_t *hl, switch_call_cause_t *cause); SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause); SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_session_t *session, diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 79ef9caa26..58f708729d 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2015, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -2868,6 +2868,8 @@ typedef struct switch_dial_leg_s switch_dial_leg_t; struct switch_dial_leg_list_s; typedef struct switch_dial_leg_list_s switch_dial_leg_list_t; +struct switch_dial_handle_list_s; +typedef struct switch_dial_handle_list_s switch_dial_handle_list_t; SWITCH_END_EXTERN_C #endif diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index d2baeb2741..d81ffcc357 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -106,6 +106,14 @@ struct switch_dial_handle_s { switch_memory_pool_t *pool; }; +struct switch_dial_handle_list_s { + int handle_idx; + switch_dial_handle_t *handles[MAX_PEERS]; + switch_event_t *global_vars; + switch_memory_pool_t *pool; +}; + +static switch_status_t switch_dial_handle_dup(switch_dial_handle_t **handle, switch_dial_handle_t *todup); typedef struct { switch_core_session_t *down_session; @@ -1451,6 +1459,7 @@ typedef struct { int done; switch_thread_t *thread; switch_mutex_t *mutex; + switch_dial_handle_t *dh; } enterprise_originate_handle_t; @@ -1475,7 +1484,7 @@ static void *SWITCH_THREAD_FUNC enterprise_originate_thread(switch_thread_t *thr handle->ovars, handle->flags, &handle->cancel_cause, - NULL); + handle->dh); handle->done = 1; @@ -1541,7 +1550,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess const char *cid_num_override, switch_caller_profile_t *caller_profile_override, switch_event_t *ovars, switch_originate_flag_t flags, - switch_call_cause_t *cancel_cause) + switch_call_cause_t *cancel_cause, + switch_dial_handle_list_t *hl) { int x_argc = 0; char *x_argv[MAX_PEERS] = { 0 }; @@ -1549,7 +1559,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess int i; switch_caller_profile_t *cp = NULL; switch_channel_t *channel = NULL; - char *data; + char *data = NULL; switch_status_t status = SWITCH_STATUS_FALSE; switch_threadattr_t *thd_attr = NULL; int running = 0, over = 0; @@ -1565,13 +1575,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess switch_core_new_memory_pool(&pool); - if (zstr(bridgeto)) { + if (zstr(bridgeto) && (!hl || hl->handle_idx == 0)) { *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; getcause = 0; switch_goto_status(SWITCH_STATUS_FALSE, end); } - data = switch_core_strdup(pool, bridgeto); + if (!hl) { + data = switch_core_strdup(pool, bridgeto); + } if (session) { switch_caller_profile_t *cpp = NULL; @@ -1632,6 +1644,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess data = parsed; } + if (hl && hl->global_vars) { + switch_event_merge(var_event, hl->global_vars); + } /* strip leading spaces (again) */ while (data && *data && *data == ' ') { @@ -1646,10 +1661,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); - if (!(x_argc = switch_separate_string_string(data, SWITCH_ENT_ORIGINATE_DELIM, x_argv, MAX_PEERS))) { - *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - getcause = 0; - switch_goto_status(SWITCH_STATUS_FALSE, end); + if (data) { + if (!(x_argc = switch_separate_string_string(data, SWITCH_ENT_ORIGINATE_DELIM, x_argv, MAX_PEERS))) { + *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + getcause = 0; + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + } else { + x_argc = hl->handle_idx; } switch_threadattr_create(&thd_attr, pool); @@ -1668,6 +1687,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess handles[i].caller_profile_override = cp; switch_event_dup(&handles[i].ovars, var_event); handles[i].flags = flags; + if (hl) { + switch_dial_handle_dup(&handles[i].dh, hl->handles[i]); + } switch_mutex_init(&handles[i].mutex, SWITCH_MUTEX_NESTED, pool); switch_mutex_lock(handles[i].mutex); switch_thread_create(&handles[i].thread, thd_attr, enterprise_originate_thread, &handles[i], pool); @@ -1756,6 +1778,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess switch_mutex_unlock(hp->mutex); switch_thread_join(&tstatus, hp->thread); switch_event_destroy(&hp->ovars); + switch_dial_handle_destroy(&hp->dh); } for (i = 0; i < x_argc; i++) { @@ -1789,6 +1812,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess switch_thread_join(&tstatus, handles[i].thread); switch_event_destroy(&handles[i].ovars); + switch_dial_handle_destroy(&handles[i].dh); } if (channel && rb_data.thread) { @@ -2078,7 +2102,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (strstr(bridgeto, SWITCH_ENT_ORIGINATE_DELIM)) { return switch_ivr_enterprise_originate(session, bleg, cause, bridgeto, timelimit_sec, table, cid_name_override, cid_num_override, - caller_profile_override, ovars, flags, cancel_cause); + caller_profile_override, ovars, flags, cancel_cause, NULL); } oglobals.check_vars = SWITCH_TRUE; @@ -4234,6 +4258,133 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess return status; } +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create(switch_dial_handle_list_t **hl) +{ + switch_dial_handle_list_t *hlP = NULL; + switch_memory_pool_t *pool = NULL; + + switch_core_new_memory_pool(&pool); + switch_assert(pool); + + hlP = switch_core_alloc(pool, sizeof(*hlP)); + switch_assert(hlP); + + hlP->pool = pool; + + *hl = hlP; + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t switch_dial_handle_list_add_handle(switch_dial_handle_list_t *hl, switch_dial_handle_t *handle) +{ + if (hl->handle_idx < MAX_PEERS && handle) { + hl->handles[hl->handle_idx++] = handle; + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_handle(switch_dial_handle_list_t *hl, switch_dial_handle_t **handle) +{ + switch_dial_handle_t *hp = NULL; + if (hl->handle_idx < MAX_PEERS && switch_dial_handle_create(&hp) == SWITCH_STATUS_SUCCESS && hp) { + hl->handles[hl->handle_idx++] = hp; + *handle = hp; + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + +SWITCH_DECLARE(void) switch_dial_handle_list_destroy(switch_dial_handle_list_t **hl) +{ + switch_dial_handle_list_t *hlP = *hl; + switch_memory_pool_t *pool = NULL; + + *hl = NULL; + + if (hlP) { + int i; + for (i = 0; i < hlP->handle_idx; i++) { + switch_dial_handle_destroy(&hlP->handles[i]); + } + + switch_event_destroy(&hlP->global_vars); + pool = hlP->pool; + hlP = NULL; + switch_core_destroy_memory_pool(&pool); + } +} + +SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var(switch_dial_handle_list_t *hl, const char *var, const char *val) +{ + switch_assert(hl); + + if (!hl->global_vars) { + switch_event_create_plain(&hl->global_vars, SWITCH_EVENT_CHANNEL_DATA); + } + + switch_event_add_header_string(hl->global_vars, SWITCH_STACK_BOTTOM, var, val); +} + +SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var_printf(switch_dial_handle_list_t *hl, const char *var, const char *fmt, ...) +{ + int ret = 0; + char *data = NULL; + va_list ap; + + va_start(ap, fmt); + ret = switch_vasprintf(&data, fmt, ap); + va_end(ap); + + if (ret == -1) { + abort(); + } + + switch_dial_handle_list_add_global_var(hl, var, data); + free(data); +} + +static switch_status_t switch_dial_handle_dup(switch_dial_handle_t **handle, switch_dial_handle_t *todup) +{ + int i; + switch_dial_handle_t *hp; + + if (!todup || !handle) { + return SWITCH_STATUS_FALSE; + } + + *handle = NULL; + + switch_dial_handle_create(&hp); + switch_assert(hp); + + for (i = 0; i < todup->leg_list_idx; i++) { + int j; + switch_dial_leg_list_t *ll_todup = todup->leg_lists[i]; + switch_dial_leg_list_t *ll = NULL; + switch_dial_handle_add_leg_list(hp, &ll); + for (j = 0; j < ll_todup->leg_idx; j++) { + switch_dial_leg_t *leg; + switch_dial_leg_t *leg_todup = ll_todup->legs[j]; + switch_dial_leg_list_add_leg(ll, &leg, leg_todup->dial_string); + if (leg_todup->leg_vars) { + switch_event_dup(&leg->leg_vars, leg_todup->leg_vars); + } + } + } + + if (todup->global_vars) { + switch_event_dup(&hp->global_vars, todup->global_vars); + } + + hp->is_sub = todup->is_sub; + + *handle = hp; + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_dial_handle_create(switch_dial_handle_t **handle) { switch_dial_handle_t *hp; @@ -4605,6 +4756,115 @@ SWITCH_DECLARE(switch_status_t) switch_dial_handle_create_json(switch_dial_handl } +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_serialize_json_obj(switch_dial_handle_list_t *hl, cJSON **json) +{ + int i; + cJSON *global_vars_json = NULL; + cJSON *handles_json = NULL; + if (!hl) { + return SWITCH_STATUS_FALSE; + } + *json = cJSON_CreateObject(); + if (hl->global_vars && vars_serialize_json_obj(hl->global_vars, &global_vars_json) == SWITCH_STATUS_SUCCESS && global_vars_json) { + cJSON_AddItemToObject(*json, "vars", global_vars_json); + } + + handles_json = cJSON_CreateArray(); + cJSON_AddItemToObject(*json, "handles", handles_json); + for (i = 0; i < hl->handle_idx; i++) { + switch_dial_handle_t *handle = hl->handles[i]; + cJSON *handle_json = NULL; + if (switch_dial_handle_serialize_json_obj(handle, &handle_json) == SWITCH_STATUS_SUCCESS && handle_json) { + cJSON_AddItemToArray(handles_json, handle_json); + } + } + + return SWITCH_STATUS_SUCCESS; +} + + +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_serialize_json(switch_dial_handle_list_t *hl, char **str) +{ + cJSON *json = NULL; + if (switch_dial_handle_list_serialize_json_obj(hl, &json) == SWITCH_STATUS_SUCCESS && json) { + *str = cJSON_PrintUnformatted(json); + cJSON_Delete(json); + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + + +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_json_obj(switch_dial_handle_list_t **hl, cJSON *handle_list_json) +{ + cJSON *handle_json = NULL; + cJSON *handles_json = NULL; + cJSON *vars_json = NULL; + + *hl = NULL; + + handles_json = cJSON_GetObjectItem(handle_list_json, "handles"); + if (!handles_json || !cJSON_IsArray(handles_json)) { + return SWITCH_STATUS_FALSE; + } + switch_dial_handle_list_create(hl); + switch_assert(*hl); + for (handle_json = handles_json->child; handle_json; handle_json = handle_json->next) { + switch_dial_handle_t *handle = NULL; + if (switch_dial_handle_create_json_obj(&handle, handle_json) == SWITCH_STATUS_SUCCESS && handle) { + if (switch_dial_handle_list_add_handle(*hl, handle) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not adding remaining dial handles: exceeded limit of %d handles\n", MAX_PEERS); + switch_dial_handle_destroy(&handle); + break; + } + } else { + char *handle_json_str = cJSON_PrintUnformatted(handle_json); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to create dial handle: %s\n", handle_json_str); + switch_safe_free(handle_json_str); + } + } + + if ((*hl)->handle_idx == 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to create dial handle list: no handles added!\n"); + switch_dial_handle_list_destroy(hl); + return SWITCH_STATUS_FALSE; + } + + vars_json = cJSON_GetObjectItem(handle_list_json, "vars"); + if (vars_json && vars_json->type == cJSON_Object) { + cJSON *var_json = NULL; + cJSON_ArrayForEach(var_json, vars_json) { + if (!var_json || var_json->type != cJSON_String || !var_json->valuestring || !var_json->string) { + continue; + } + switch_dial_handle_list_add_global_var(*hl, var_json->string, var_json->valuestring); + } + } + + return SWITCH_STATUS_SUCCESS; +} + + +SWITCH_DECLARE(switch_status_t) switch_dial_handle_list_create_json(switch_dial_handle_list_t **hl, const char *handle_list_string) +{ + switch_status_t status; + cJSON *handle_list_json = NULL; + + if (zstr(handle_list_string)) { + return SWITCH_STATUS_FALSE; + } + + handle_list_json = cJSON_Parse(handle_list_string); + if (!handle_list_json) { + return SWITCH_STATUS_FALSE; + } + + status = switch_dial_handle_list_create_json_obj(hl, handle_list_json); + cJSON_Delete(handle_list_json); + return status; +} + + static switch_status_t o_bridge_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) { char *str = (char *) buf; @@ -4618,6 +4878,72 @@ static switch_status_t o_bridge_on_dtmf(switch_core_session_t *session, void *in return SWITCH_STATUS_SUCCESS; } + +SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_list_t *hl, switch_call_cause_t *cause) +{ + switch_channel_t *caller_channel = switch_core_session_get_channel(session); + switch_core_session_t *peer_session = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + int fail = 0; + + if ((status = switch_ivr_enterprise_originate(session, + &peer_session, + cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, hl)) != SWITCH_STATUS_SUCCESS) { + fail = 1; + } + + + if (fail) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n", switch_channel_cause2str(*cause)); + + switch_channel_set_variable(caller_channel, "originate_failed_cause", switch_channel_cause2str(*cause)); + + switch_channel_handle_cause(caller_channel, *cause); + + return status; + } else { + switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session); + + if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) || + switch_true(switch_channel_get_variable(peer_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) { + switch_channel_set_flag(caller_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE); + } + + if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) { + switch_ivr_signal_bridge(session, peer_session); + } else { + char *a_key = (char *) switch_channel_get_variable(caller_channel, "bridge_terminate_key"); + char *b_key = (char *) switch_channel_get_variable(peer_channel, "bridge_terminate_key"); + int ok = 0; + switch_input_callback_function_t func = NULL; + + if (a_key) { + a_key = switch_core_session_strdup(session, a_key); + ok++; + } + if (b_key) { + b_key = switch_core_session_strdup(session, b_key); + ok++; + } + if (ok) { + func = o_bridge_on_dtmf; + } else { + a_key = NULL; + b_key = NULL; + } + + switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, b_key); + } + + if (peer_session) { + switch_core_session_rwunlock(peer_session); + } + } + + return status; +} + + SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause) { switch_channel_t *caller_channel = switch_core_session_get_channel(session); diff --git a/tests/unit/switch_ivr_originate.c b/tests/unit/switch_ivr_originate.c index 9369506b13..6c34fcc1e8 100644 --- a/tests/unit/switch_ivr_originate.c +++ b/tests/unit/switch_ivr_originate.c @@ -209,6 +209,99 @@ FST_CORE_BEGIN("./conf") } FST_TEST_END(); + FST_TEST_BEGIN(dial_handle_list_create_json) + { + const char *dh_str_1 = "{\n" + " \"vars\": {\n" + " \"foo\": \"bar\",\n" + " \"absolute_codec_string\": \"pcmu,pcma\",\n" + " \"ignore_early_media\": \"true\"\n" + " },\n" + " \"leg_lists\": [\n" + " { \"legs\": [\n" + " { \n" + " \"dial_string\": \"loopback/dest2\", \n" + " \"vars\": {\n" + " \"bar\": \"bar\"\n" + " }\n" + " },\n" + " { \n" + " \"dial_string\": \"sofia/gateway/gw/123456\"\n" + " }\n" + " ] },\n" + " { \"legs\": [\n" + " {\n" + " \"dial_string\": \"sofia/external/foo@example.com^5551231234\",\n" + " \"vars\": {\n" + " \"sip_h_X-Custom\": \"my val 2\"\n" + " }\n" + " }\n" + " ] },\n" + " { \"legs\": [\n" + " {\n" + " \"dial_string\": \"group/my_group_2\"\n" + " }\n" + " ] }\n" + " ]\n" + "}"; + const char *dh_str_2 = "{\n" + " \"vars\": {\n" + " \"foo\": \"bar\",\n" + " \"absolute_codec_string\": \"opus,pcmu,pcma\",\n" + " \"ignore_early_media\": \"true\"\n" + " },\n" + " \"leg_lists\": [\n" + " { \"legs\": [\n" + " { \n" + " \"dial_string\": \"loopback/dest\", \n" + " \"vars\": {\n" + " \"bar\": \"bar\"\n" + " }\n" + " },\n" + " { \n" + " \"dial_string\": \"sofia/gateway/gw/12345\"\n" + " }\n" + " ] },\n" + " { \"legs\": [\n" + " {\n" + " \"dial_string\": \"sofia/external/foo@example.com^5551231234\",\n" + " \"vars\": {\n" + " \"sip_h_X-Custom\": \"my val\"\n" + " }\n" + " }\n" + " ] },\n" + " { \"legs\": [\n" + " {\n" + " \"dial_string\": \"group/my_group\"\n" + " }\n" + " ] }\n" + " ]\n" + "}"; + const char *dl_str = switch_core_sprintf(fst_pool, "{ \"handles\": [ %s, %s ], \"vars\": { \"global_1\":\"val_1\" } }", dh_str_1, dh_str_2); + // create dial handle from json string, convert back to json and compare + switch_dial_handle_list_t *dl = NULL; + char *dl_str_2 = NULL; + char *dl_str_3 = NULL; + cJSON *dl_json = NULL; + fst_requires(switch_dial_handle_list_create_json(&dl, dl_str) == SWITCH_STATUS_SUCCESS); + fst_requires(dl != NULL); + fst_requires(switch_dial_handle_list_serialize_json_obj(dl, &dl_json) == SWITCH_STATUS_SUCCESS); + fst_requires(dl_json != NULL); + fst_requires(switch_dial_handle_list_serialize_json(dl, &dl_str_2) == SWITCH_STATUS_SUCCESS); + fst_requires(dl_str_2 != NULL); + fst_check_string_equals(dl_str_2, "{\"vars\":{\"global_1\":\"val_1\"},\"handles\":[{\"vars\":{\"foo\":\"bar\",\"absolute_codec_string\":\"pcmu,pcma\",\"ignore_early_media\":\"true\"},\"leg_lists\":[{\"legs\":[{\"dial_string\":\"loopback/dest2\",\"vars\":{\"bar\":\"bar\"}},{\"dial_string\":\"sofia/gateway/gw/123456\"}]},{\"legs\":[{\"dial_string\":\"sofia/external/foo@example.com^5551231234\",\"vars\":{\"sip_h_X-Custom\":\"my val 2\"}}]},{\"legs\":[{\"dial_string\":\"group/my_group_2\"}]}]},{\"vars\":{\"foo\":\"bar\",\"absolute_codec_string\":\"opus,pcmu,pcma\",\"ignore_early_media\":\"true\"},\"leg_lists\":[{\"legs\":[{\"dial_string\":\"loopback/dest\",\"vars\":{\"bar\":\"bar\"}},{\"dial_string\":\"sofia/gateway/gw/12345\"}]},{\"legs\":[{\"dial_string\":\"sofia/external/foo@example.com^5551231234\",\"vars\":{\"sip_h_X-Custom\":\"my val\"}}]},{\"legs\":[{\"dial_string\":\"group/my_group\"}]}]}]}"); + + dl_str_3 = cJSON_PrintUnformatted(dl_json); + fst_requires(dl_str_3); + fst_check_string_equals(dl_str_2, dl_str_3); + + switch_safe_free(dl_str_2); + switch_safe_free(dl_str_3); + cJSON_Delete(dl_json); + switch_dial_handle_list_destroy(&dl); + } + FST_TEST_END(); + FST_TEST_BEGIN(originate_test_empty_dial_string) { switch_core_session_t *session = NULL; @@ -622,6 +715,103 @@ FST_CORE_BEGIN("./conf") fst_check_duration(4500, 600); // (>= 3.9 sec, <= 5.1 sec) } FST_TEST_END() + + FST_TEST_BEGIN(enterprise_originate_test_group_confirm_two_handles) + { + switch_core_session_t *session = NULL; + switch_status_t status; + switch_call_cause_t cause; + switch_dial_handle_list_t *dl; + switch_dial_handle_t *dh; + switch_dial_leg_list_t *ll; + switch_dial_leg_t *leg = NULL; + + switch_dial_handle_list_create(&dl); + + switch_dial_handle_list_create_handle(dl, &dh); + switch_dial_handle_add_leg_list(dh, &ll); + switch_dial_leg_list_add_leg(ll, &leg, "null/test"); + switch_dial_handle_add_leg_var(leg, "group_confirm_file", "playback silence_stream://1000"); + switch_dial_handle_add_leg_var(leg, "group_confirm_key", "exec"); + switch_dial_handle_add_leg_var(leg, "expected_winner", "true"); + + switch_dial_handle_list_create_handle(dl, &dh); + switch_dial_handle_add_leg_list(dh, &ll); + switch_dial_leg_list_add_leg(ll, &leg, "error/user_busy"); + + switch_dial_handle_list_add_global_var(dl, "continue_on_fail", "true"); + switch_dial_handle_list_add_global_var(dl, "is_from_dial_handle_list", "true"); + + status = switch_ivr_enterprise_originate(NULL, &session, &cause, NULL, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, dl); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(session); + fst_xcheck(switch_true(switch_channel_get_variable(switch_core_session_get_channel(session), "is_from_dial_handle_list")), "Expect dial handle list global var to be set on channel"); + fst_xcheck(switch_true(switch_channel_get_variable(switch_core_session_get_channel(session), "expected_winner")), "Wrong winning leg"); + switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_dial_handle_list_destroy(&dl); + } + FST_TEST_END() + + FST_SESSION_BEGIN(switch_ivr_enterprise_orig_and_bridge) + { + switch_status_t status; + switch_call_cause_t cause = SWITCH_CAUSE_NONE; + switch_dial_handle_list_t *dl; + switch_dial_handle_t *dh; + switch_dial_leg_list_t *ll; + switch_dial_leg_t *leg = NULL; + + switch_dial_handle_list_create(&dl); + + switch_dial_handle_list_create_handle(dl, &dh); + switch_dial_handle_add_leg_list(dh, &ll); + switch_dial_leg_list_add_leg(ll, &leg, "null/test"); + switch_dial_handle_add_leg_var(leg, "execute_on_answer", "sched_hangup +2 normal_clearing"); + + switch_dial_handle_list_create_handle(dl, &dh); + switch_dial_handle_add_leg_list(dh, &ll); + switch_dial_leg_list_add_leg(ll, &leg, "error/user_busy"); + + switch_dial_handle_list_add_global_var(dl, "continue_on_fail", "true"); + switch_dial_handle_list_add_global_var(dl, "is_from_dial_handle_list", "true"); + + switch_channel_set_variable(fst_channel, "park_after_bridge", "true"); + status = switch_ivr_enterprise_orig_and_bridge(fst_session, NULL, dl, &cause); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_enterprise_orig_and_bridge() to succeed"); + fst_xcheck(cause == SWITCH_CAUSE_SUCCESS, "Expect called party to answer"); + switch_dial_handle_list_destroy(&dl); + } + FST_SESSION_END() + + FST_SESSION_BEGIN(switch_ivr_enterprise_orig_and_bridge_fail) + { + switch_status_t status; + switch_call_cause_t cause = SWITCH_CAUSE_NONE; + switch_dial_handle_list_t *dl; + switch_dial_handle_t *dh; + switch_dial_leg_list_t *ll; + switch_dial_leg_t *leg = NULL; + + switch_dial_handle_list_create(&dl); + + switch_dial_handle_list_create_handle(dl, &dh); + switch_dial_handle_add_leg_list(dh, &ll); + switch_dial_leg_list_add_leg(ll, &leg, "error/no_answer"); + + switch_dial_handle_list_create_handle(dl, &dh); + switch_dial_handle_add_leg_list(dh, &ll); + switch_dial_leg_list_add_leg(ll, &leg, "error/user_busy"); + + switch_dial_handle_list_add_global_var(dl, "continue_on_fail", "true"); + + switch_channel_set_variable(fst_channel, "park_after_bridge", "true"); + status = switch_ivr_enterprise_orig_and_bridge(fst_session, NULL, dl, &cause); + fst_xcheck(status == SWITCH_STATUS_FALSE, "Expect switch_ivr_enterprise_orig_and_bridge() to fail"); + fst_xcheck(cause == SWITCH_CAUSE_USER_BUSY || cause == SWITCH_CAUSE_NO_ANSWER, "Expect called party not to answer"); + switch_dial_handle_list_destroy(&dl); + } + FST_SESSION_END() } FST_SUITE_END() } From 877102d4b9d66ddf90ec3e7443c9662ca474c7eb Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 23 Mar 2021 17:33:46 +0000 Subject: [PATCH 099/655] swigall --- .../src/org/freeswitch/swig/Event.java | 4 + .../org/freeswitch/swig/freeswitchJNI.java | 1 + .../languages/mod_java/switch_swig_wrap.cpp | 18 ++ src/mod/languages/mod_lua/mod_lua_wrap.cpp | 32 +++ .../languages/mod_managed/freeswitch_wrap.cxx | 229 +++++++++++++++++- src/mod/languages/mod_managed/managed/swig.cs | 186 +++++++++++++- src/mod/languages/mod_perl/freeswitch.pm | 1 + src/mod/languages/mod_perl/mod_perl_wrap.cpp | 39 +++ src/mod/languages/mod_python/freeswitch.py | 3 + .../languages/mod_python/mod_python_wrap.cpp | 32 +++ 10 files changed, 539 insertions(+), 6 deletions(-) diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/Event.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/Event.java index fd2c933b20..5c3961dc8c 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/Event.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/Event.java @@ -112,4 +112,8 @@ public class Event { return freeswitchJNI.Event_fire(swigCPtr, this); } + public boolean merge(Event to_merge) { + return freeswitchJNI.Event_merge(swigCPtr, this, Event.getCPtr(to_merge), to_merge); + } + } diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index cceea3402a..37786aff1a 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -71,6 +71,7 @@ public class freeswitchJNI { public final static native boolean Event_addHeader(long jarg1, Event jarg1_, String jarg2, String jarg3); public final static native boolean Event_delHeader(long jarg1, Event jarg1_, String jarg2); public final static native boolean Event_fire(long jarg1, Event jarg1_); + public final static native boolean Event_merge(long jarg1, Event jarg1_, long jarg2, Event jarg2_); public final static native void EventConsumer_events_set(long jarg1, EventConsumer jarg1_, long jarg2); public final static native long EventConsumer_events_get(long jarg1, EventConsumer jarg1_); public final static native void EventConsumer_e_event_id_set(long jarg1, EventConsumer jarg1_, long jarg2); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index f1b004dece..efd0211940 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -1450,6 +1450,24 @@ SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_Event_1fire(J } +SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_Event_1merge(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; + Event *arg1 = (Event *) 0 ; + Event *arg2 = (Event *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(Event **)&jarg1; + arg2 = *(Event **)&jarg2; + result = (bool)(arg1)->merge(arg2); + jresult = (jboolean)result; + return jresult; +} + + SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1events_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_queue_t *arg2 = (switch_queue_t *) 0 ; diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index a54f1faf68..7d91ba33ba 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -4961,6 +4961,37 @@ fail: } +static int _wrap_Event_merge(lua_State* L) { + int SWIG_arg = 0; + Event *arg1 = (Event *) 0 ; + Event *arg2 = (Event *) 0 ; + bool result; + + SWIG_check_num_args("Event::merge",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event::merge",1,"Event *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("Event::merge",2,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_merge",1,SWIGTYPE_p_Event); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_merge",2,SWIGTYPE_p_Event); + } + + result = (bool)(arg1)->merge(arg2); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + static void swig_delete_Event(void *obj) { Event *arg1 = (Event *) obj; delete arg1; @@ -4991,6 +5022,7 @@ static swig_lua_method swig_Event_methods[]= { { "addHeader", _wrap_Event_addHeader}, { "delHeader", _wrap_Event_delHeader}, { "fire", _wrap_Event_fire}, + { "merge", _wrap_Event_merge}, {0,0} }; static swig_lua_method swig_Event_meta[] = { diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 7ecadca826..378be590e6 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -14551,6 +14551,22 @@ SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_reset__ } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_try_reset___(void * jarg1, int jarg2, int jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_bool_t arg2 ; + switch_bool_t arg3 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_bool_t)jarg2; + arg3 = (switch_bool_t)jarg3; + result = (switch_status_t)switch_core_session_try_reset(arg1,arg2,arg3); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_write_frame___(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -15736,6 +15752,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_file_pre_close__ } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_file_handle_dup___(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ; + switch_file_handle_t **arg2 = (switch_file_handle_t **) 0 ; + switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ; + switch_status_t result; + + arg1 = (switch_file_handle_t *)jarg1; + arg2 = (switch_file_handle_t **)jarg2; + arg3 = (switch_memory_pool_t *)jarg3; + result = (switch_status_t)switch_core_file_handle_dup(arg1,arg2,arg3); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_file_close___(void * jarg1) { int jresult ; switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ; @@ -18554,6 +18586,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_gen_certs___(cha } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_check_dtls_pem___(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_bool_t result; + + arg1 = (char *)jarg1; + result = (switch_bool_t)switch_core_check_dtls_pem((char const *)arg1); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_cert_gen_fingerprint___(char * jarg1, void * jarg2) { int jresult ; char *arg1 = (char *) 0 ; @@ -41895,7 +41939,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_originate___(void } -SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_enterprise_originate___(void * jarg1, void * jarg2, void * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, char * jarg7, char * jarg8, void * jarg9, void * jarg10, unsigned long jarg11, void * jarg12) { +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_enterprise_originate___(void * jarg1, void * jarg2, void * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, char * jarg7, char * jarg8, void * jarg9, void * jarg10, unsigned long jarg11, void * jarg12, void * jarg13) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_core_session_t **arg2 = (switch_core_session_t **) 0 ; @@ -41909,6 +41953,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_enterprise_origin switch_event_t *arg10 = (switch_event_t *) 0 ; switch_originate_flag_t arg11 ; switch_call_cause_t *arg12 = (switch_call_cause_t *) 0 ; + switch_dial_handle_list_t *arg13 = (switch_dial_handle_list_t *) 0 ; switch_status_t result; arg1 = (switch_core_session_t *)jarg1; @@ -41923,7 +41968,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_enterprise_origin arg10 = (switch_event_t *)jarg10; arg11 = (switch_originate_flag_t)jarg11; arg12 = (switch_call_cause_t *)jarg12; - result = (switch_status_t)switch_ivr_enterprise_originate(arg1,arg2,arg3,(char const *)arg4,arg5,(switch_state_handler_table const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12); + arg13 = (switch_dial_handle_list_t *)jarg13; + result = (switch_status_t)switch_ivr_enterprise_originate(arg1,arg2,arg3,(char const *)arg4,arg5,(switch_state_handler_table const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13); jresult = (int)result; return jresult; } @@ -43694,6 +43740,139 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_get_total } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_serialize_json_obj___(void * jarg1, void * jarg2) { + int jresult ; + switch_dial_handle_list_t *arg1 = (switch_dial_handle_list_t *) 0 ; + cJSON **arg2 = (cJSON **) 0 ; + switch_status_t result; + + arg1 = (switch_dial_handle_list_t *)jarg1; + arg2 = (cJSON **)jarg2; + result = (switch_status_t)switch_dial_handle_list_serialize_json_obj(arg1,arg2); + jresult = (int)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_serialize_json___(void * jarg1, void * jarg2) { + int jresult ; + switch_dial_handle_list_t *arg1 = (switch_dial_handle_list_t *) 0 ; + char **arg2 = (char **) 0 ; + switch_status_t result; + + arg1 = (switch_dial_handle_list_t *)jarg1; + arg2 = (char **)jarg2; + result = (switch_status_t)switch_dial_handle_list_serialize_json(arg1,arg2); + jresult = (int)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_create_json_obj___(void * jarg1, void * jarg2) { + int jresult ; + switch_dial_handle_list_t **arg1 = (switch_dial_handle_list_t **) 0 ; + cJSON *arg2 = (cJSON *) 0 ; + switch_status_t result; + + arg1 = (switch_dial_handle_list_t **)jarg1; + arg2 = (cJSON *)jarg2; + result = (switch_status_t)switch_dial_handle_list_create_json_obj(arg1,arg2); + jresult = (int)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_create_json___(void * jarg1, char * jarg2) { + int jresult ; + switch_dial_handle_list_t **arg1 = (switch_dial_handle_list_t **) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_dial_handle_list_t **)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_dial_handle_list_create_json(arg1,(char const *)arg2); + jresult = (int)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_create___(void * jarg1) { + int jresult ; + switch_dial_handle_list_t **arg1 = (switch_dial_handle_list_t **) 0 ; + switch_status_t result; + + arg1 = (switch_dial_handle_list_t **)jarg1; + result = (switch_status_t)switch_dial_handle_list_create(arg1); + jresult = (int)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_create_handle___(void * jarg1, void * jarg2) { + int jresult ; + switch_dial_handle_list_t *arg1 = (switch_dial_handle_list_t *) 0 ; + switch_dial_handle_t **arg2 = (switch_dial_handle_t **) 0 ; + switch_status_t result; + + arg1 = (switch_dial_handle_list_t *)jarg1; + arg2 = (switch_dial_handle_t **)jarg2; + result = (switch_status_t)switch_dial_handle_list_create_handle(arg1,arg2); + jresult = (int)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_destroy___(void * jarg1) { + switch_dial_handle_list_t **arg1 = (switch_dial_handle_list_t **) 0 ; + + arg1 = (switch_dial_handle_list_t **)jarg1; + switch_dial_handle_list_destroy(arg1); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_add_global_var___(void * jarg1, char * jarg2, char * jarg3) { + switch_dial_handle_list_t *arg1 = (switch_dial_handle_list_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + + arg1 = (switch_dial_handle_list_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + switch_dial_handle_list_add_global_var(arg1,(char const *)arg2,(char const *)arg3); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_list_add_global_var_printf___(void * jarg1, char * jarg2, char * jarg3) { + switch_dial_handle_list_t *arg1 = (switch_dial_handle_list_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *arg4 = 0 ; + + arg1 = (switch_dial_handle_list_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + switch_dial_handle_list_add_global_var_printf(arg1,(char const *)arg2,(char const *)arg3,arg4); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_enterprise_orig_and_bridge___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_dial_handle_list_t *arg3 = (switch_dial_handle_list_t *) 0 ; + switch_call_cause_t *arg4 = (switch_call_cause_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_dial_handle_list_t *)jarg3; + arg4 = (switch_call_cause_t *)jarg4; + result = (switch_status_t)switch_ivr_enterprise_orig_and_bridge(arg1,(char const *)arg2,arg3,arg4); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -49740,6 +49919,38 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_scheduler_a } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_scheduler_add_task_ex___(void * jarg1, void * jarg2, char * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, unsigned long jarg7, void * jarg8) { + unsigned long jresult ; + time_t arg1 ; + switch_scheduler_func_t arg2 = (switch_scheduler_func_t) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + uint32_t arg5 ; + void *arg6 = (void *) 0 ; + switch_scheduler_flag_t arg7 ; + uint32_t *arg8 = (uint32_t *) 0 ; + time_t *argp1 ; + uint32_t result; + + argp1 = (time_t *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0); + return 0; + } + arg1 = *argp1; + arg2 = (switch_scheduler_func_t)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + arg5 = (uint32_t)jarg5; + arg6 = (void *)jarg6; + arg7 = (switch_scheduler_flag_t)jarg7; + arg8 = (uint32_t *)jarg8; + result = (uint32_t)switch_scheduler_add_task_ex(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7,arg8); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_scheduler_del_task_id___(unsigned long jarg1) { unsigned long jresult ; uint32_t arg1 ; @@ -50809,6 +51020,20 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_FreeSWITCHfNative_Event_Fire___(void } +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_FreeSWITCHfNative_Event_merge___(void * jarg1, void * jarg2) { + unsigned int jresult ; + Event *arg1 = (Event *) 0 ; + Event *arg2 = (Event *) 0 ; + bool result; + + arg1 = (Event *)jarg1; + arg2 = (Event *)jarg2; + result = (bool)(arg1)->merge(arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_EventConsumer_events_set___(void * jarg1, void * jarg2) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_queue_t *arg2 = (switch_queue_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 3002981514..25d419680c 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -650,6 +650,11 @@ public partial class Event : global::System.IDisposable { return ret; } + public bool merge(Event to_merge) { + bool ret = freeswitchPINVOKE.Event_merge(swigCPtr, Event.getCPtr(to_merge)); + return ret; + } + } } @@ -4795,6 +4800,35 @@ public class SWIGTYPE_p_p_switch_device_record_s { namespace FreeSWITCH.Native { +public class SWIGTYPE_p_p_switch_dial_handle_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_handle_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_list_s 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_switch_dial_handle_s { private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -6071,6 +6105,35 @@ public class SWIGTYPE_p_switch_core_session { namespace FreeSWITCH.Native { +public class SWIGTYPE_p_switch_dial_handle_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_handle_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_list_s 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_switch_dial_handle_s { private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -8907,6 +8970,11 @@ else freeswitchPINVOKE.switch_core_session_reset(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)flush_dtmf, (int)reset_read_codec); } + public static switch_status_t switch_core_session_try_reset(SWIGTYPE_p_switch_core_session session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_try_reset(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)flush_dtmf, (int)reset_read_codec); + return ret; + } + public static switch_status_t switch_core_session_write_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, uint flags, int stream_id) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), flags, stream_id); return ret; @@ -9328,6 +9396,11 @@ 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)); + return ret; + } + public static switch_status_t switch_core_file_close(switch_file_handle fh) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_close(switch_file_handle.getCPtr(fh)); return ret; @@ -10207,6 +10280,11 @@ else return ret; } + public static switch_bool_t switch_core_check_dtls_pem(string file) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_core_check_dtls_pem(file); + return ret; + } + public static int switch_core_cert_gen_fingerprint(string prefix, dtls_fingerprint_t fp) { int ret = freeswitchPINVOKE.switch_core_cert_gen_fingerprint(prefix, dtls_fingerprint_t.getCPtr(fp)); return ret; @@ -13076,8 +13154,8 @@ else return ret; } - public static switch_status_t switch_ivr_enterprise_originate(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session bleg, SWIGTYPE_p_switch_call_cause_t cause, string bridgeto, uint timelimit_sec, switch_state_handler_table table, string cid_name_override, string cid_num_override, switch_caller_profile caller_profile_override, switch_event ovars, uint flags, SWIGTYPE_p_switch_call_cause_t cancel_cause) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_enterprise_originate(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(bleg), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause), bridgeto, timelimit_sec, switch_state_handler_table.getCPtr(table), cid_name_override, cid_num_override, switch_caller_profile.getCPtr(caller_profile_override), switch_event.getCPtr(ovars), flags, SWIGTYPE_p_switch_call_cause_t.getCPtr(cancel_cause)); + public static switch_status_t switch_ivr_enterprise_originate(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session bleg, SWIGTYPE_p_switch_call_cause_t cause, string bridgeto, uint timelimit_sec, switch_state_handler_table table, string cid_name_override, string cid_num_override, switch_caller_profile caller_profile_override, switch_event ovars, uint flags, SWIGTYPE_p_switch_call_cause_t cancel_cause, SWIGTYPE_p_switch_dial_handle_list_s hl) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_enterprise_originate(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(bleg), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause), bridgeto, timelimit_sec, switch_state_handler_table.getCPtr(table), cid_name_override, cid_num_override, switch_caller_profile.getCPtr(caller_profile_override), switch_event.getCPtr(ovars), flags, SWIGTYPE_p_switch_call_cause_t.getCPtr(cancel_cause), SWIGTYPE_p_switch_dial_handle_list_s.getCPtr(hl)); return ret; } @@ -13649,6 +13727,53 @@ else return ret; } + public static switch_status_t switch_dial_handle_list_serialize_json_obj(SWIGTYPE_p_switch_dial_handle_list_s hl, SWIGTYPE_p_p_cJSON json) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_dial_handle_list_serialize_json_obj(SWIGTYPE_p_switch_dial_handle_list_s.getCPtr(hl), SWIGTYPE_p_p_cJSON.getCPtr(json)); + return ret; + } + + public static switch_status_t switch_dial_handle_list_serialize_json(SWIGTYPE_p_switch_dial_handle_list_s hl, ref string str) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_dial_handle_list_serialize_json(SWIGTYPE_p_switch_dial_handle_list_s.getCPtr(hl), ref str); + return ret; + } + + public static switch_status_t switch_dial_handle_list_create_json_obj(SWIGTYPE_p_p_switch_dial_handle_list_s handle, SWIGTYPE_p_cJSON json) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_dial_handle_list_create_json_obj(SWIGTYPE_p_p_switch_dial_handle_list_s.getCPtr(handle), SWIGTYPE_p_cJSON.getCPtr(json)); + return ret; + } + + public static switch_status_t switch_dial_handle_list_create_json(SWIGTYPE_p_p_switch_dial_handle_list_s handle, string handle_string) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_dial_handle_list_create_json(SWIGTYPE_p_p_switch_dial_handle_list_s.getCPtr(handle), handle_string); + return ret; + } + + public static switch_status_t switch_dial_handle_list_create(SWIGTYPE_p_p_switch_dial_handle_list_s hl) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_dial_handle_list_create(SWIGTYPE_p_p_switch_dial_handle_list_s.getCPtr(hl)); + return ret; + } + + public static switch_status_t switch_dial_handle_list_create_handle(SWIGTYPE_p_switch_dial_handle_list_s hl, SWIGTYPE_p_p_switch_dial_handle_s handle) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_dial_handle_list_create_handle(SWIGTYPE_p_switch_dial_handle_list_s.getCPtr(hl), SWIGTYPE_p_p_switch_dial_handle_s.getCPtr(handle)); + return ret; + } + + public static void switch_dial_handle_list_destroy(SWIGTYPE_p_p_switch_dial_handle_list_s hl) { + freeswitchPINVOKE.switch_dial_handle_list_destroy(SWIGTYPE_p_p_switch_dial_handle_list_s.getCPtr(hl)); + } + + public static void switch_dial_handle_list_add_global_var(SWIGTYPE_p_switch_dial_handle_list_s hl, string var, string val) { + freeswitchPINVOKE.switch_dial_handle_list_add_global_var(SWIGTYPE_p_switch_dial_handle_list_s.getCPtr(hl), var, val); + } + + public static void switch_dial_handle_list_add_global_var_printf(SWIGTYPE_p_switch_dial_handle_list_s hl, string var, string fmt) { + freeswitchPINVOKE.switch_dial_handle_list_add_global_var_printf(SWIGTYPE_p_switch_dial_handle_list_s.getCPtr(hl), var, fmt); + } + + public static switch_status_t switch_ivr_enterprise_orig_and_bridge(SWIGTYPE_p_switch_core_session session, string data, SWIGTYPE_p_switch_dial_handle_list_s hl, SWIGTYPE_p_switch_call_cause_t cause) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_enterprise_orig_and_bridge(SWIGTYPE_p_switch_core_session.getCPtr(session), data, SWIGTYPE_p_switch_dial_handle_list_s.getCPtr(hl), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause)); + return ret; + } + public static switch_status_t switch_ivr_orig_and_bridge(SWIGTYPE_p_switch_core_session session, string data, SWIGTYPE_p_switch_dial_handle_s dh, SWIGTYPE_p_switch_call_cause_t cause) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_orig_and_bridge(SWIGTYPE_p_switch_core_session.getCPtr(session), data, SWIGTYPE_p_switch_dial_handle_s.getCPtr(dh), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause)); return ret; @@ -14626,6 +14751,12 @@ else return ret; } + public static uint switch_scheduler_add_task_ex(SWIGTYPE_p_time_t task_runtime, SWIGTYPE_p_f_p_switch_scheduler_task__void func, string desc, string group, uint cmd_id, SWIGTYPE_p_void cmd_arg, uint flags, SWIGTYPE_p_unsigned_long task_id) { + uint ret = freeswitchPINVOKE.switch_scheduler_add_task_ex(SWIGTYPE_p_time_t.getCPtr(task_runtime), SWIGTYPE_p_f_p_switch_scheduler_task__void.getCPtr(func), desc, group, cmd_id, SWIGTYPE_p_void.getCPtr(cmd_arg), flags, SWIGTYPE_p_unsigned_long.getCPtr(task_id)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static uint switch_scheduler_del_task_id(uint task_id) { uint ret = freeswitchPINVOKE.switch_scheduler_del_task_id(task_id); return ret; @@ -18830,6 +18961,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_reset___")] public static extern void switch_core_session_reset(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_try_reset___")] + public static extern int switch_core_session_try_reset(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_write_frame___")] public static extern int switch_core_session_write_frame(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, uint jarg3, int jarg4); @@ -19073,6 +19207,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_file_pre_close___")] public static extern int switch_core_file_pre_close(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_file_handle_dup___")] + public static extern int switch_core_file_handle_dup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_file_close___")] public static extern int switch_core_file_close(global::System.Runtime.InteropServices.HandleRef jarg1); @@ -19742,6 +19879,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_gen_certs___")] public static extern int switch_core_gen_certs(string jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_check_dtls_pem___")] + public static extern int switch_core_check_dtls_pem(string jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_cert_gen_fingerprint___")] public static extern int switch_core_cert_gen_fingerprint(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -25359,7 +25499,7 @@ class freeswitchPINVOKE { public static extern int switch_ivr_originate(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, string jarg4, uint jarg5, global::System.Runtime.InteropServices.HandleRef jarg6, string jarg7, string jarg8, global::System.Runtime.InteropServices.HandleRef jarg9, global::System.Runtime.InteropServices.HandleRef jarg10, uint jarg11, global::System.Runtime.InteropServices.HandleRef jarg12, global::System.Runtime.InteropServices.HandleRef jarg13); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_enterprise_originate___")] - public static extern int switch_ivr_enterprise_originate(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, string jarg4, uint jarg5, global::System.Runtime.InteropServices.HandleRef jarg6, string jarg7, string jarg8, global::System.Runtime.InteropServices.HandleRef jarg9, global::System.Runtime.InteropServices.HandleRef jarg10, uint jarg11, global::System.Runtime.InteropServices.HandleRef jarg12); + public static extern int switch_ivr_enterprise_originate(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, string jarg4, uint jarg5, global::System.Runtime.InteropServices.HandleRef jarg6, string jarg7, string jarg8, global::System.Runtime.InteropServices.HandleRef jarg9, global::System.Runtime.InteropServices.HandleRef jarg10, uint jarg11, global::System.Runtime.InteropServices.HandleRef jarg12, global::System.Runtime.InteropServices.HandleRef jarg13); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_bridge_display___")] public static extern void switch_ivr_bridge_display(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -25706,6 +25846,36 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_get_total___")] public static extern int switch_dial_handle_get_total(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_serialize_json_obj___")] + public static extern int switch_dial_handle_list_serialize_json_obj(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_serialize_json___")] + public static extern int switch_dial_handle_list_serialize_json(global::System.Runtime.InteropServices.HandleRef jarg1, ref string jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_create_json_obj___")] + public static extern int switch_dial_handle_list_create_json_obj(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_create_json___")] + public static extern int switch_dial_handle_list_create_json(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_create___")] + public static extern int switch_dial_handle_list_create(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_create_handle___")] + public static extern int switch_dial_handle_list_create_handle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_destroy___")] + public static extern void switch_dial_handle_list_destroy(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_add_global_var___")] + public static extern void switch_dial_handle_list_add_global_var(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_dial_handle_list_add_global_var_printf___")] + public static extern void switch_dial_handle_list_add_global_var_printf(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_enterprise_orig_and_bridge___")] + public static extern int switch_ivr_enterprise_orig_and_bridge(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge___")] public static extern int switch_ivr_orig_and_bridge(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); @@ -27158,6 +27328,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_scheduler_add_task___")] public static extern uint switch_scheduler_add_task(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3, string jarg4, uint jarg5, global::System.Runtime.InteropServices.HandleRef jarg6, uint jarg7); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_scheduler_add_task_ex___")] + public static extern uint switch_scheduler_add_task_ex(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3, string jarg4, uint jarg5, global::System.Runtime.InteropServices.HandleRef jarg6, uint jarg7, global::System.Runtime.InteropServices.HandleRef jarg8); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_scheduler_del_task_id___")] public static extern uint switch_scheduler_del_task_id(uint jarg1); @@ -27416,6 +27589,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_Event_Fire___")] public static extern bool Event_Fire(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_Event_merge___")] + public static extern bool Event_merge(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_EventConsumer_events_set___")] public static extern void EventConsumer_events_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -31483,6 +31659,7 @@ public enum switch_channel_flag_t { CF_SERVICE, CF_TAGGED, CF_WINNER, + CF_REUSE_CALLER_PROFILE, CF_CONTROLLED, CF_PROXY_MODE, CF_PROXY_OFF, @@ -36106,7 +36283,8 @@ namespace FreeSWITCH.Native { ED_BRIDGE_READ = (1 << 4), ED_BRIDGE_WRITE = (1 << 5), ED_TAP_READ = (1 << 6), - ED_TAP_WRITE = (1 << 7) + ED_TAP_WRITE = (1 << 7), + ED_STEREO = (1 << 8) } } diff --git a/src/mod/languages/mod_perl/freeswitch.pm b/src/mod/languages/mod_perl/freeswitch.pm index 3d511c9225..9717fbb944 100644 --- a/src/mod/languages/mod_perl/freeswitch.pm +++ b/src/mod/languages/mod_perl/freeswitch.pm @@ -311,6 +311,7 @@ sub DESTROY { *addHeader = *freeswitchc::Event_addHeader; *delHeader = *freeswitchc::Event_delHeader; *fire = *freeswitchc::Event_fire; +*merge = *freeswitchc::Event_merge; sub DISOWN { my $self = shift; my $ptr = tied(%$self); diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index a6b48e7670..27e98ee3e6 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -4482,6 +4482,44 @@ XS(_wrap_Event_fire) { } +XS(_wrap_Event_merge) { + { + Event *arg1 = (Event *) 0 ; + Event *arg2 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int argvi = 0; + bool result; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: Event_merge(self,to_merge);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_merge" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_merge" "', argument " "2"" of type '" "Event *""'"); + } + arg2 = reinterpret_cast< Event * >(argp2); + result = (bool)(arg1)->merge(arg2); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + XS(_wrap_EventConsumer_events_set) { { EventConsumer *arg1 = (EventConsumer *) 0 ; @@ -10792,6 +10830,7 @@ static swig_command_info swig_commands[] = { {"freeswitchc::Event_addHeader", _wrap_Event_addHeader}, {"freeswitchc::Event_delHeader", _wrap_Event_delHeader}, {"freeswitchc::Event_fire", _wrap_Event_fire}, +{"freeswitchc::Event_merge", _wrap_Event_merge}, {"freeswitchc::EventConsumer_events_set", _wrap_EventConsumer_events_set}, {"freeswitchc::EventConsumer_events_get", _wrap_EventConsumer_events_get}, {"freeswitchc::EventConsumer_e_event_id_set", _wrap_EventConsumer_e_event_id_set}, diff --git a/src/mod/languages/mod_python/freeswitch.py b/src/mod/languages/mod_python/freeswitch.py index ac9f655ad9..48ccf472f1 100644 --- a/src/mod/languages/mod_python/freeswitch.py +++ b/src/mod/languages/mod_python/freeswitch.py @@ -327,6 +327,9 @@ class Event(_object): def fire(self): return _freeswitch.Event_fire(self) + + def merge(self, to_merge): + return _freeswitch.Event_merge(self, to_merge) Event_swigregister = _freeswitch.Event_swigregister Event_swigregister(Event) diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index 31ec090c6a..227b441b59 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -5765,6 +5765,37 @@ fail: } +SWIGINTERN PyObject *_wrap_Event_merge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + Event *arg2 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OO:Event_merge",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_merge" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_merge" "', argument " "2"" of type '" "Event *""'"); + } + arg2 = reinterpret_cast< Event * >(argp2); + result = (bool)(arg1)->merge(arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *Event_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; @@ -10541,6 +10572,7 @@ static PyMethodDef SwigMethods[] = { { "Event_addHeader", _wrap_Event_addHeader, METH_VARARGS, NULL}, { "Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL}, { "Event_fire", _wrap_Event_fire, METH_VARARGS, NULL}, + { "Event_merge", _wrap_Event_merge, METH_VARARGS, NULL}, { "Event_swigregister", Event_swigregister, METH_VARARGS, NULL}, { "EventConsumer_events_set", _wrap_EventConsumer_events_set, METH_VARARGS, NULL}, { "EventConsumer_events_get", _wrap_EventConsumer_events_get, METH_VARARGS, NULL}, From 513b0fbf00c671b1ae6c416a06dd6a3d56e3fb66 Mon Sep 17 00:00:00 2001 From: Christian Glombek Date: Wed, 24 Mar 2021 17:30:52 +0100 Subject: [PATCH 100/655] [mod_avmd, esl/python] Two build fixups (#611) --- libs/esl/python/python-config | 14 +++++++------- src/mod/applications/mod_avmd/mod_avmd.c | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/esl/python/python-config b/libs/esl/python/python-config index 71699916f5..1e60a89047 100644 --- a/libs/esl/python/python-config +++ b/libs/esl/python/python-config @@ -1,5 +1,6 @@ -#! /usr/bin/python2.5 +#!/usr/bin/env python +from __future__ import print_function import sys import os import getopt @@ -9,8 +10,7 @@ valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', 'ldflags', 'help'] def exit_with_usage(code=1): - print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0], - '|'.join('--'+opt for opt in valid_opts)) + print("Usage: %s [%s]" % (sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr) sys.exit(code) try: @@ -30,17 +30,17 @@ if opt == '--help': exit_with_usage(0) elif opt == '--prefix': - print sysconfig.PREFIX + print(sysconfig.PREFIX) elif opt == '--exec-prefix': - print sysconfig.EXEC_PREFIX + print(sysconfig.EXEC_PREFIX) elif opt in ('--includes', '--cflags'): flags = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True)] if opt == '--cflags': flags.extend(getvar('CFLAGS').split()) - print ' '.join(flags) + print(' '.join(flags)) elif opt in ('--libs', '--ldflags'): libs = getvar('LIBS').split() + getvar('SYSLIBS').split() @@ -49,5 +49,5 @@ elif opt in ('--libs', '--ldflags'): # shared library in prefix/lib/. if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'): libs.insert(0, '-L' + getvar('LIBPL')) - print ' '.join(libs) + print(' '.join(libs)) diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index a7a59d9289..ea1c5f483a 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -1343,8 +1343,10 @@ static switch_status_t avmd_parse_cmd_data(avmd_session_t *s, const char *cmd_da switch_assert(argv[idx]); status = avmd_parse_cmd_data_one_entry(argv[idx], &settings); if (status != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + if (argv[idx]) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, "Error parsing option [%d] [%s]\n", idx + 1, argv[idx]); /* idx + 1 to report option 0 as 1 for users convenience */ + } switch (status) { case SWITCH_STATUS_TERM: From 67cec5c3e80e653d4540b9ba2c4a0b38b92a9458 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 25 Mar 2021 18:52:56 +0300 Subject: [PATCH 101/655] 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 defa9f0e12..ef3ef34409 100644 --- a/build/next-release.txt +++ b/build/next-release.txt @@ -1 +1 @@ -1.10.6-dev +1.10.7-dev diff --git a/configure.ac b/configure.ac index 810003eda2..a74edfbc8b 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.6-dev], bugs@freeswitch.org) +AC_INIT([freeswitch], [1.10.7-dev], bugs@freeswitch.org) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [10]) -AC_SUBST(SWITCH_VERSION_MICRO, [6-dev]) +AC_SUBST(SWITCH_VERSION_MICRO, [7-dev]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, []) From ec1a0215fedb56bcd6f73fb1e93f763ed5286cbb Mon Sep 17 00:00:00 2001 From: figaro2015 Date: Fri, 2 Apr 2021 12:18:16 -0700 Subject: [PATCH 102/655] [Core, mod_conference] Fixed oscillation in conference AGC processing. Especially during volume reduction processing (#1064) * Fixed oscillation in conference AGC processing. Especially during volume reduction processing * Re-scaled granular volume to +/- 50 dB level change. 10 = double loudness, -10 = half loudness, 0 = no change Co-authored-by: Chris Rienzo --- src/include/switch_resample.h | 7 ++-- .../mod_conference/conference_api.c | 9 ----- .../mod_conference/mod_conference.c | 8 ++--- src/switch_resample.c | 33 +++++++++++++++---- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/include/switch_resample.h b/src/include/switch_resample.h index 6656c205d7..462aa0629b 100644 --- a/src/include/switch_resample.h +++ b/src/include/switch_resample.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -26,7 +26,7 @@ * Anthony Minessale II * * - * switch_caller.h -- Caller Identification + * switch_resample.h * */ /*! \file switch_resample.h @@ -39,7 +39,8 @@ */ #define switch_normalize_volume(x) if (x > 4) x = 4; if (x < -4) x = -4; -#define switch_normalize_volume_granular(x) if (x > 13) x = 13; if (x < -13) x = -13; +#define SWITCH_GRANULAR_VOLUME_MAX 50 +#define switch_normalize_volume_granular(x) if (x > SWITCH_GRANULAR_VOLUME_MAX) x = SWITCH_GRANULAR_VOLUME_MAX; if (x < -SWITCH_GRANULAR_VOLUME_MAX) x = -SWITCH_GRANULAR_VOLUME_MAX; #ifndef SWITCH_RESAMPLE_H #define SWITCH_RESAMPLE_H diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index 2c323d2b8d..ee74f2a371 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -1276,15 +1276,6 @@ void conference_api_set_agc(conference_member_t *member, const char *data) } - if (argv[0]) { - tmp = atoi(argv[0]); - - if (tmp > 0) { - member->agc_period_len = (1000 / member->conference->interval) * tmp; - } - } - - if (!member->agc) { switch_agc_create(&member->agc, member->agc_level, member->agc_low_energy_level, member->agc_margin, member->agc_change_factor, member->agc_period_len); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index d1ee467757..498de9fefc 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -3574,9 +3574,9 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co conference->agc_level = 0; conference->agc_low_energy_level = 0; - conference->agc_margin = 20; - conference->agc_change_factor = 3; - conference->agc_period_len = (1000 / conference->interval) * 2; + conference->agc_margin = 100; + conference->agc_change_factor = 2; + conference->agc_period_len = 500 / conference->interval; if (agc_level) { @@ -3610,7 +3610,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co if (agc_period_len) { tmp = atoi(agc_period_len); if (tmp > 0) { - conference->agc_period_len = (1000 / conference->interval) * tmp; + conference->agc_period_len = tmp; } } diff --git a/src/switch_resample.c b/src/switch_resample.c index 866acdd99c..ca14a221ab 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -345,9 +345,23 @@ SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, u SWITCH_DECLARE(void) switch_change_sln_volume_granular(int16_t *data, uint32_t samples, int32_t vol) { double newrate = 0; - double pos[13] = {1.25, 1.50, 1.75, 2.0, 2.25, 2.50, 2.75, 3.0, 3.25, 3.50, 3.75, 4.0, 4.5}; - double neg[13] = {.917, .834, .751, .668, .585, .502, .419, .336, .253, .087, .017, .004, 0.0}; - double *chart; + // change in dB mapped to ratio for output sample + // computed as (powf(10.0f, (float)(change_in_dB) / 20.0f)) + static const double pos[SWITCH_GRANULAR_VOLUME_MAX] = { + 1.122018, 1.258925, 1.412538, 1.584893, 1.778279, 1.995262, 2.238721, 2.511887, 2.818383, 3.162278, + 3.548134, 3.981072, 4.466835, 5.011872, 5.623413, 6.309574, 7.079458, 7.943282, 8.912509, 10.000000, + 11.220183, 12.589254, 14.125375, 15.848933, 17.782795, 19.952621, 22.387213, 25.118862, 28.183832, 31.622776, + 35.481335, 39.810719, 44.668358, 50.118729, 56.234131, 63.095726, 70.794586, 79.432816, 89.125107, 100.000000, + 112.201836, 125.892517, 141.253784, 158.489334, 177.827942, 199.526215, 223.872070, 251.188705, 281.838318, 316.227753 + }; + static const double neg[SWITCH_GRANULAR_VOLUME_MAX] = { + 0.891251, 0.794328, 0.707946, 0.630957, 0.562341, 0.501187, 0.446684, 0.398107, 0.354813, 0.316228, + 0.281838, 0.251189, 0.223872, 0.199526, 0.177828, 0.158489, 0.141254, 0.125893, 0.112202, 0.100000, + 0.089125, 0.079433, 0.070795, 0.063096, 0.056234, 0.050119, 0.044668, 0.039811, 0.035481, 0.031623, + 0.028184, 0.025119, 0.022387, 0.019953, 0.017783, 0.015849, 0.014125, 0.012589, 0.011220, 0.010000, + 0.008913, 0.007943, 0.007079, 0.006310, 0.005623, 0.005012, 0.004467, 0.003981, 0.003548, 0.000000 // NOTE mapped -50 dB ratio to total silence instead of 0.003162 + }; + const double *chart; uint32_t i; if (vol == 0) return; @@ -362,7 +376,7 @@ SWITCH_DECLARE(void) switch_change_sln_volume_granular(int16_t *data, uint32_t s i = abs(vol) - 1; - switch_assert(i < 13); + switch_assert(i < SWITCH_GRANULAR_VOLUME_MAX); newrate = chart[i]; @@ -444,6 +458,13 @@ SWITCH_DECLARE(void) switch_agc_set(switch_agc_t *agc, uint32_t energy_avg, agc->change_factor = change_factor; agc->period_len = period_len; agc->low_energy_point = low_energy_point; + + agc->score = 0; + agc->score_count = 0; + agc->score_sum = 0; + agc->score_avg = 0; + agc->score_over = 0; + agc->score_under = 0; } SWITCH_DECLARE(switch_status_t) switch_agc_create(switch_agc_t **agcP, uint32_t energy_avg, @@ -539,6 +560,8 @@ SWITCH_DECLARE(switch_status_t) switch_agc_feed(switch_agc_t *agc, int16_t *data switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] OVER++ SCORE AVG: %d ENERGY AVG: %d MARGIN: %d\n", agc->token, agc->score_avg, agc->energy_avg, agc->margin); agc->score_over++; + } else { + agc->score_over = 0; } } else { agc->score_over = 0; @@ -549,8 +572,6 @@ SWITCH_DECLARE(switch_status_t) switch_agc_feed(switch_agc_t *agc, int16_t *data switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] BELOW LOW POINT, SCORE AVG: %d ENERGY AVG: %d MARGIN: %d\n", agc->token, agc->score_avg, agc->energy_avg, agc->margin); } else if (((agc->score_avg < agc->energy_avg) && (agc->energy_avg - agc->score_avg > agc->margin))) { - //&& (agc->vol < 0 || agc->score_avg > agc->low_energy_point)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] UNDER++ SCORE AVG: %d ENERGY AVG: %d MARGIN: %d\n", agc->token, agc->score_avg, agc->energy_avg, agc->margin); agc->score_under++; From fd27504a7dc4561b5f7f2ff27762f8e5c362f3bd Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 9 Apr 2021 00:55:52 +0300 Subject: [PATCH 103/655] [Core] Add switch_digest(), switch_digest_string() APIs. Add unit-tests. --- src/include/switch_utils.h | 3 + src/switch_core.c | 2 + src/switch_utils.c | 87 ++++++++++++++++++++++++ tests/unit/switch_core.c | 50 ++++++++++++++ tests/unit/test_switch_core.2017.vcxproj | 1 + 5 files changed, 143 insertions(+) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 1c40975908..20655ecd4e 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1460,6 +1460,9 @@ SWITCH_DECLARE(char *)switch_html_strip(const char *str); SWITCH_DECLARE(unsigned long) switch_getpid(void); +SWITCH_DECLARE(switch_status_t) switch_digest(const char *digest_name, unsigned char **digest, const void *input, switch_size_t inputLen, unsigned int *outputlen); +SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, char **digest_str, const void *input, switch_size_t inputLen, unsigned int *outputlen); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/switch_core.c b/src/switch_core.c index 2a27b57ea3..d4507aa49c 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1945,6 +1945,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc SSL_library_init(); switch_ssl_init_ssl_locks(); + OpenSSL_add_all_algorithms(); switch_curl_init(); switch_core_set_variable("hostname", runtime.hostname); @@ -3037,6 +3038,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void) switch_curl_destroy(); switch_ssl_destroy_ssl_locks(); + EVP_cleanup(); switch_scheduler_task_thread_stop(); diff --git a/src/switch_utils.c b/src/switch_utils.c index 5d6b8f2aaf..0fee81551b 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -51,6 +51,10 @@ #include "gumbo.h" #endif +#if defined(HAVE_OPENSSL) +#include +#endif + struct switch_network_node { ip_t ip; ip_t mask; @@ -4549,6 +4553,89 @@ SWITCH_DECLARE(unsigned long) switch_getpid(void) return (unsigned long)pid; } +SWITCH_DECLARE(switch_status_t) switch_digest(const char *digest_name, unsigned char **digest, const void *input, switch_size_t inputLen, unsigned int *outputlen) +{ +#if defined(HAVE_OPENSSL) + EVP_MD_CTX *mdctx; + const EVP_MD *md; + int size; + + switch_assert(digest); + + if (!digest_name) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Message digest is not set\n"); + return SWITCH_STATUS_FALSE; + } + + md = EVP_get_digestbyname(digest_name); + + if (!md) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown message digest %s\n", digest_name); + return SWITCH_STATUS_FALSE; + } + + size = EVP_MD_size(md); + if (!size || !(*digest = malloc(size))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Zero digest size or can't allocate memory to store results %s\n", digest_name); + return SWITCH_STATUS_FALSE; + } + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + mdctx = EVP_MD_CTX_new(); +#else + mdctx = EVP_MD_CTX_create(); +#endif + + if (!mdctx) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "EVP_MD_CTX_new error\n"); + switch_safe_free(*digest); + return SWITCH_STATUS_FALSE; + } + + EVP_MD_CTX_init(mdctx); + EVP_DigestInit_ex(mdctx, md, NULL); + EVP_DigestUpdate(mdctx, input, inputLen); + EVP_DigestFinal_ex(mdctx, *digest, outputlen); + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + EVP_MD_CTX_free(mdctx); +#else + EVP_MD_CTX_destroy(mdctx); +#endif + + return SWITCH_STATUS_SUCCESS; +#else + return SWITCH_STATUS_FALSE; +#endif +} + +SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, char **digest_str, const void *input, switch_size_t inputLen, unsigned int *outputlen) +{ + unsigned char *digest = NULL; + switch_status_t status; + short i = 0, x; + uint8_t b; + + status = switch_digest(digest_name, &digest, input, inputLen, outputlen); + + if (status == SWITCH_STATUS_SUCCESS) { + if ((*digest_str = malloc(*outputlen * 2 + 1))) { + for (x = i = 0; x < *outputlen; x++) { + b = (digest[x] >> 4) & 15; + (*digest_str)[i++] = b + (b > 9 ? 'a' - 10 : '0'); + b = digest[x] & 15; + (*digest_str)[i++] = b + (b > 9 ? 'a' - 10 : '0'); + } + + (*digest_str)[i] = '\0'; + } + } + + switch_safe_free(digest); + *outputlen = i; + + return status; +} /* For Emacs: * Local Variables: diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index 9f58969a6f..d0d6bacef2 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -34,6 +34,10 @@ #include +#if defined(HAVE_OPENSSL) +#include +#endif + FST_CORE_BEGIN("./conf") { FST_SUITE_BEGIN(switch_ivr_originate) @@ -48,6 +52,52 @@ FST_CORE_BEGIN("./conf") } FST_TEARDOWN_END() +#ifdef HAVE_OPENSSL + FST_TEST_BEGIN(test_md5) + { + char *digest_name = "md5"; + char *digest_str = NULL; + const char *str = "test data"; + unsigned int outputlen; + + switch_status_t status = switch_digest_string(digest_name, &digest_str, str, strlen(str), &outputlen); + fst_check_int_equals(status, SWITCH_STATUS_SUCCESS); + fst_check_string_equals(digest_str, "eb733a00c0c9d336e65691a37ab54293"); + switch_safe_free(digest_str); + } + FST_TEST_END() + + FST_TEST_BEGIN(test_sha256) + { + char *digest_name = "sha256"; + char *digest_str = NULL; + const char *str = "test data"; + unsigned int outputlen; + + switch_status_t status = switch_digest_string(digest_name, &digest_str, str, strlen(str), &outputlen); + fst_check_int_equals(status, SWITCH_STATUS_SUCCESS); + fst_check_string_equals(digest_str, "916f0027a575074ce72a331777c3478d6513f786a591bd892da1a577bf2335f9"); + switch_safe_free(digest_str); + } + FST_TEST_END() +#endif + +#if OPENSSL_VERSION_NUMBER >= 0x10101000L + FST_TEST_BEGIN(test_sha512_256) + { + char *digest_name = "sha512-256"; + char *digest_str = NULL; + const char *str = "test data"; + unsigned int outputlen; + + switch_status_t status = switch_digest_string(digest_name, &digest_str, str, strlen(str), &outputlen); + fst_check_int_equals(status, SWITCH_STATUS_SUCCESS); + fst_check_string_equals(digest_str, "9fe875600168548c1954aed4f03974ce06b3e17f03a70980190da2d7ef937a43"); + switch_safe_free(digest_str); + } + FST_TEST_END() +#endif + #ifndef WIN32 FST_TEST_BEGIN(test_fork) { diff --git a/tests/unit/test_switch_core.2017.vcxproj b/tests/unit/test_switch_core.2017.vcxproj index 922fb9b51f..c9e1cd5423 100644 --- a/tests/unit/test_switch_core.2017.vcxproj +++ b/tests/unit/test_switch_core.2017.vcxproj @@ -47,6 +47,7 @@ $(DefaultPlatformToolset)
+ From 833235b94139bdf43991eb0a5dd59046ef6bb3ac Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Fri, 9 Apr 2021 15:45:17 +0000 Subject: [PATCH 104/655] [mod_sofia] Add RFC8760 (sha-256, sha-512) enable on the sip profile, eg: --- src/mod/endpoints/mod_sofia/mod_sofia.h | 13 ++ src/mod/endpoints/mod_sofia/sofia.c | 11 ++ src/mod/endpoints/mod_sofia/sofia_reg.c | 162 ++++++++++++++++++++++-- 3 files changed, 172 insertions(+), 14 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index db709b9721..3c2d02a5a7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -369,6 +369,8 @@ typedef enum { #define SOFIA_MAX_MSG_QUEUE 64 #define SOFIA_MSG_QUEUE_SIZE 1000 +#define SOFIA_MAX_REG_ALGS 7 /* rfc8760 */ + struct mod_sofia_globals { switch_memory_pool_t *pool; switch_hash_t *profile_hash; @@ -599,6 +601,13 @@ typedef enum { KA_INFO } ka_type_t; +typedef enum { + ALG_MD5 = (1 << 0), + ALG_SHA256 = (1 << 1), + ALG_SHA512 = (1 << 2), + ALG_NONE = (1 << 3), +} sofia_auth_algs_t; + struct sofia_profile { int debug; int parse_invite_tel_params; @@ -789,6 +798,8 @@ struct sofia_profile { char *rfc7989_filter; char *acl_inbound_x_token_header; char *acl_proxy_x_token_header; + uint8_t rfc8760_algs_count; + sofia_auth_algs_t auth_algs[SOFIA_MAX_REG_ALGS]; }; @@ -1260,6 +1271,8 @@ void sofia_reg_close_handles(sofia_profile_t *profile); void write_csta_xml_chunk(switch_event_t *event, switch_stream_handle_t stream, const char *csta_event, char *fwd_type); void sofia_glue_clear_soa(switch_core_session_t *session, switch_bool_t partner); +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); /* For Emacs: * Local Variables: diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b76a804e8e..82fb6471c9 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6039,6 +6039,17 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) profile->proxy_notify_events = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "proxy-info-content-types")) { profile->proxy_info_content_types = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "rfc8760-auth-algorithms")) { + /* the order in which algorithms are allowed matters */ + char *algs_arr[100] = { 0 }; + uint8_t algs = switch_separate_string(val, ',', algs_arr, (sizeof(algs_arr) / sizeof(algs_arr[0]))); + if (algs && algs < SOFIA_MAX_REG_ALGS) { + int i; + for (i = 0; i < algs && algs_arr[i]; i++) { + profile->auth_algs[i] = sofia_alg_str2id(algs_arr[i], SWITCH_TRUE); + } + profile->rfc8760_algs_count = algs; + } } } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 582de54cb4..6263e05170 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1123,13 +1123,22 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_with_positive_expires_mu return cbt.list; } +static char * sofia_alg_to_str(sofia_auth_algs_t alg) +{ + if (alg == ALG_SHA256) + return "SHA-256"; + if (alg == ALG_SHA512) + return "SHA-512-256"; + return "MD5"; +} void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_dispatch_event_t *de, sofia_regtype_t regtype, const char *realm, int stale, long exptime) { switch_uuid_t uuid; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; - char *sql, *auth_str; + char *sql, *auth_str = NULL; + char *auth_str_rfc8760[SOFIA_MAX_REG_ALGS] = {0}; msg_t *msg = NULL; @@ -1147,14 +1156,53 @@ void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_ switch_assert(sql != NULL); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - auth_str = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=true," : ""); + if (!profile->rfc8760_algs_count) { + auth_str = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=true," : ""); + } else { + int i; + for (i = 0 ; i < profile->rfc8760_algs_count; i++) { + if (profile->auth_algs[i] != ALG_NONE) { + auth_str_rfc8760[i] = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=%s, qop=\"auth\"", realm, uuid_str, stale ? " stale=true," : "", sofia_alg_to_str(profile->auth_algs[i])); + } + } + } if (regtype == REG_REGISTER) { - nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END()); + if (!profile->rfc8760_algs_count) { + nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END()); + } else { + int i; + nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)), + TAG_IF(auth_str_rfc8760[0], SIPTAG_WWW_AUTHENTICATE_STR(auth_str_rfc8760[0])), TAG_IF(auth_str_rfc8760[1], SIPTAG_WWW_AUTHENTICATE_STR(auth_str_rfc8760[1])), + TAG_IF(auth_str_rfc8760[2], SIPTAG_WWW_AUTHENTICATE_STR(auth_str_rfc8760[2])), TAG_IF(auth_str_rfc8760[3], SIPTAG_WWW_AUTHENTICATE_STR(auth_str_rfc8760[3])), + TAG_IF(auth_str_rfc8760[4], SIPTAG_WWW_AUTHENTICATE_STR(auth_str_rfc8760[4])), TAG_IF(auth_str_rfc8760[5], SIPTAG_WWW_AUTHENTICATE_STR(auth_str_rfc8760[5])), + TAG_IF(auth_str_rfc8760[6], SIPTAG_WWW_AUTHENTICATE_STR(auth_str_rfc8760[6])), TAG_END()); + for (i = 0 ; i < profile->rfc8760_algs_count; i++) { + switch_safe_free(auth_str_rfc8760[i]); + } + } } else if (regtype == REG_INVITE) { - nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, + if (!profile->rfc8760_algs_count) { + nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, + TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)), + SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END()); + } else { + int i; + nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)), - SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END()); + TAG_IF(auth_str_rfc8760[0], SIPTAG_PROXY_AUTHENTICATE_STR(auth_str_rfc8760[0])), + TAG_IF(auth_str_rfc8760[1], SIPTAG_PROXY_AUTHENTICATE_STR(auth_str_rfc8760[1])), + TAG_IF(auth_str_rfc8760[2], SIPTAG_PROXY_AUTHENTICATE_STR(auth_str_rfc8760[2])), + TAG_IF(auth_str_rfc8760[3], SIPTAG_PROXY_AUTHENTICATE_STR(auth_str_rfc8760[3])), + TAG_IF(auth_str_rfc8760[4], SIPTAG_PROXY_AUTHENTICATE_STR(auth_str_rfc8760[4])), + TAG_IF(auth_str_rfc8760[5], SIPTAG_PROXY_AUTHENTICATE_STR(auth_str_rfc8760[5])), + TAG_IF(auth_str_rfc8760[6], SIPTAG_PROXY_AUTHENTICATE_STR(auth_str_rfc8760[6])), + TAG_END()); + for (i = 0 ; i < profile->rfc8760_algs_count; i++) { + switch_safe_free(auth_str_rfc8760[i]); + } + } + } switch_safe_free(auth_str); @@ -2710,6 +2758,54 @@ static int sofia_reg_regcount_callback(void *pArg, int argc, char **argv, char * return 0; } +static switch_bool_t sofia_alg_is_allowed(sofia_profile_t *profile, sofia_auth_algs_t alg) +{ + int i; + + for (i = 0 ; i < SOFIA_MAX_REG_ALGS; i++) { + if (profile->auth_algs[i] == alg) { + return SWITCH_TRUE; + } + } + return SWITCH_FALSE; +} + +/*we are more permissive with the alg names that come from cfg */ +sofia_auth_algs_t sofia_alg_str2id(char *algorithm, switch_bool_t permissive) +{ + if (!strcasecmp(algorithm, "MD5") || (permissive && !strcasecmp(algorithm, "MD-5"))) { + return ALG_MD5; + } + if (!strcasecmp(algorithm, "SHA-256") || (permissive && !strcasecmp(algorithm, "SHA256"))) { + return ALG_SHA256; + } + if (!strcasecmp(algorithm, "SHA-512-256") || (permissive && !strcasecmp(algorithm, "SHA512")) + || (permissive && !strcasecmp(algorithm, "SHA512-256")) || (permissive && !strcasecmp(algorithm, "SHA-512"))) { + return ALG_SHA512; + } + + return ALG_NONE; +} + +switch_status_t sofia_make_digest(sofia_auth_algs_t use_alg, char **digest, const void *input, unsigned int *outputlen) +{ + switch (use_alg) + { + case ALG_MD5: + switch_digest_string("md5", digest, input, strlen((char *)input), outputlen); + break; + case ALG_SHA256: + switch_digest_string("sha256", digest, input, strlen((char *)input), outputlen); + break; + case ALG_SHA512: + switch_digest_string("sha512-256", digest, input, strlen((char *)input), outputlen); + break; + default: + return SWITCH_STATUS_FALSE; + } + return SWITCH_STATUS_SUCCESS; +} + auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, @@ -2724,9 +2820,8 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, { int indexnum; const char *cur; - char uridigest[SWITCH_MD5_DIGEST_STRING_SIZE]; - char bigdigest[SWITCH_MD5_DIGEST_STRING_SIZE]; - char *username, *realm, *nonce, *uri, *qop, *cnonce, *nc, *response, *input = NULL, *input2 = NULL; + char *uridigest = NULL, *bigdigest = NULL, *hexdigest = NULL; + char *username, *realm, *nonce, *uri, *qop, *cnonce, *nc, *response, *algorithm, *input = NULL, *input2 = NULL; auth_res_t ret = AUTH_FORBIDDEN; int first = 0; const char *passwd = NULL; @@ -2737,7 +2832,6 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, char *sql; char *number_alias = NULL; switch_xml_t user = NULL, param, uparams; - char hexdigest[SWITCH_MD5_DIGEST_STRING_SIZE] = ""; char *domain_name = NULL; switch_event_t *params = NULL; const char *auth_acl = NULL; @@ -2747,9 +2841,12 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, const char *user_agent_filter = profile->user_agent_filter; uint32_t max_registrations_perext = profile->max_registrations_perext; char client_port[16]; + uint8_t use_alg; + unsigned int digest_outputlen; + snprintf(client_port, 15, "%d", network_port); - username = realm = nonce = uri = qop = cnonce = nc = response = NULL; + username = realm = nonce = uri = qop = cnonce = nc = response = algorithm = NULL; if (authorization->au_params) { for (indexnum = 0; (cur = authorization->au_params[indexnum]); indexnum++) { @@ -2782,7 +2879,10 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, response = strdup(val); } else if (!strcasecmp(var, "nc") && !nc) { nc = strdup(val); + } else if (!strcasecmp(var, "algorithm") && !algorithm) { + algorithm = strdup(val); } + } free(work); @@ -2807,6 +2907,26 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, } } + if (algorithm) { + if (profile->rfc8760_algs_count) { + switch_bool_t not_allowed = SWITCH_FALSE; + sofia_auth_algs_t alg_id = sofia_alg_str2id(algorithm, SWITCH_FALSE); + if ((alg_id == ALG_NONE) || !sofia_alg_is_allowed(profile, alg_id)) { + not_allowed = SWITCH_TRUE; + } else { + use_alg = alg_id; + } + if (not_allowed) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth hash algorithm explicitly not allowed. [%s]\n", algorithm); + goto end; + } + } else { + use_alg = ALG_MD5; + } + } else { + use_alg = ALG_MD5; + } + user_agent = (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown"; if (zstr(np)) { @@ -3059,10 +3179,14 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, if (!a1_hash) { input = switch_mprintf("%s:%s:%s", username, realm, passwd); - switch_md5_string(hexdigest, (void *) input, strlen(input)); + + if (sofia_make_digest(use_alg, &hexdigest, (void *)input, &digest_outputlen) != SWITCH_STATUS_SUCCESS) { + switch_safe_free(input); + goto end; + } + switch_safe_free(input); a1_hash = hexdigest; - } if (user_agent_filter) { @@ -3110,7 +3234,10 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, for_the_sake_of_interop: if ((input = switch_mprintf("%s:%q", regstr, uri))) { - switch_md5_string(uridigest, (void *) input, strlen(input)); + if (sofia_make_digest(use_alg, &uridigest, (void *)input, &digest_outputlen) != SWITCH_STATUS_SUCCESS) { + switch_safe_free(input); + goto end; + } } if (nc && cnonce && qop) { @@ -3120,7 +3247,10 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, } if (input2) { - switch_md5_string(bigdigest, (void *) input2, strlen(input2)); + if (sofia_make_digest(use_alg, &bigdigest, (void *)input2, &digest_outputlen) != SWITCH_STATUS_SUCCESS) { + switch_safe_free(input2); + goto end; + } } if (input2 && !strcasecmp(bigdigest, response)) { @@ -3286,6 +3416,10 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, switch_safe_free(cnonce); switch_safe_free(nc); switch_safe_free(response); + switch_safe_free(algorithm); + switch_safe_free(uridigest); + switch_safe_free(bigdigest); + switch_safe_free(hexdigest); if (reg_count && !*reg_count) { if ((ret == AUTH_OK || ret == AUTH_RENEWED)) { From e6b6aea6ff906e8567e3b0dedf7d28be32b8b368 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 10 Mar 2021 20:08:20 +0300 Subject: [PATCH 105/655] [mod_sofia] Add basic INVITE test --- .../mod_sofia/test/conf/freeswitch.xml | 102 ++++++++++++++++++ .../mod_sofia/test/test_sofia_funcs.c | 28 ++++- 2 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml diff --git a/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml new file mode 100644 index 0000000000..c654a84ebc --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml @@ -0,0 +1,102 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+
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 e5b1baa932..0c03d232d1 100644 --- a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c +++ b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2018, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -33,9 +33,9 @@ #include #include "../mod_sofia.c" -FST_MINCORE_BEGIN("./conf") +FST_CORE_EX_BEGIN("./conf", SCF_VG | SCF_USE_SQL) -FST_SUITE_BEGIN(switch_hash) +FST_MODULE_BEGIN(mod_sofia, sofia) FST_SETUP_BEGIN() { @@ -94,9 +94,27 @@ FST_TEST_BEGIN(test_protect_url) } FST_TEST_END() -FST_SUITE_END() +FST_TEST_BEGIN(originate_test) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true}sofia/internal/park@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session); + fst_check(status == SWITCH_STATUS_SUCCESS); + 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); +} +FST_TEST_END() -FST_MINCORE_END() +FST_MODULE_END() + +FST_CORE_END() /* For Emacs: From 73569bb1f79fb2d8349f957c582c84dcd5dd4f5d Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 13 Apr 2021 10:30:15 +0000 Subject: [PATCH 106/655] [mod_sofia] rfc8760: reorder hash algorithms by priority (strength), no matter the order provided in the cfg --- src/mod/endpoints/mod_sofia/sofia.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 82fb6471c9..dbd9f94343 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6040,15 +6040,30 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else if (!strcasecmp(var, "proxy-info-content-types")) { profile->proxy_info_content_types = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "rfc8760-auth-algorithms")) { - /* the order in which algorithms are allowed matters */ char *algs_arr[100] = { 0 }; uint8_t algs = switch_separate_string(val, ',', algs_arr, (sizeof(algs_arr) / sizeof(algs_arr[0]))); if (algs && algs < SOFIA_MAX_REG_ALGS) { - int i; + sofia_auth_algs_t temp; + int i, j = 0; for (i = 0; i < algs && algs_arr[i]; i++) { - profile->auth_algs[i] = sofia_alg_str2id(algs_arr[i], SWITCH_TRUE); + temp = sofia_alg_str2id(algs_arr[i], SWITCH_TRUE); + if (temp != ALG_NONE) { + profile->auth_algs[j] = temp; + j++; + } + } + profile->rfc8760_algs_count = j; + for (i = 0; i < profile->rfc8760_algs_count; i++) { + for (j = i + 1; j < profile->rfc8760_algs_count; j++) { + /* when adding algs: algs must be kept in priority order in the enum */ + if (profile->auth_algs[i] < profile->auth_algs[j]) + { + temp = profile->auth_algs[i]; + profile->auth_algs[i] = profile->auth_algs[j]; + profile->auth_algs[j] = temp; + } + } } - profile->rfc8760_algs_count = algs; } } } From 7fc5d9a7c36337b15a5c7044bdaecdc82d95d94b Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 31 Mar 2021 13:49:59 +0000 Subject: [PATCH 107/655] [core] RTP: handle flush for incoming stream with DTX or packet loss. --- src/switch_rtp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index d75219c6cf..e879436206 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -390,6 +390,7 @@ struct switch_rtp { //uint32_t last_clock_ts; uint32_t last_write_ts; uint32_t last_read_ts; + uint32_t prev_read_ts; uint32_t last_cng_ts; uint32_t last_write_samplecount; uint32_t delay_samples; @@ -6413,6 +6414,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t } if (ts) { + rtp_session->prev_read_ts = rtp_session->last_read_ts; rtp_session->last_read_ts = ts; } @@ -6488,7 +6490,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t } } else { if (rtp_session->last_rtp_hdr.m && rtp_session->last_rtp_hdr.pt != rtp_session->recv_te && - !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && !(rtp_session->rtp_bugs & RTP_BUG_IGNORE_MARK_BIT)) { + !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && !(rtp_session->rtp_bugs & RTP_BUG_IGNORE_MARK_BIT) && + rtp_session->last_read_ts - rtp_session->prev_read_ts < rtp_session->samples_per_interval * 3) { switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH); } else if (rtp_session->last_jb_read_ssrc && rtp_session->last_jb_read_ssrc != read_ssrc) { switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH); From 0877bd5770b8853dc81132c64b971bdb81b56d8c Mon Sep 17 00:00:00 2001 From: Norm Brandinger Date: Fri, 16 Apr 2021 10:24:51 -0400 Subject: [PATCH 108/655] [Core] switch_rtp: fix switch_rtp_set_max_missed_packets logging Warning message about missed packets is misleading. Message indicates greater (>) however, the conditional is greater than or equals (>=). The message prints the value of rtp_sesstion->missed_count twice instead of printing the value of rtp_session->max_missed_packets. --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e879436206..1b0d407dec 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2913,11 +2913,11 @@ SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session return; } - if (rtp_session->missed_count >= max) { + if (rtp_session->missed_count > max) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "new max missed packets(%d->%d) greater than current missed packets(%d). RTP will timeout.\n", - rtp_session->missed_count, max, rtp_session->missed_count); + rtp_session->max_missed_packets, max, rtp_session->missed_count); } rtp_session->max_missed_packets = max; From b7316ba557e6e30e5f12f9ac8c797e947c8d8dca Mon Sep 17 00:00:00 2001 From: sergey-safarov Date: Mon, 26 Apr 2021 17:46:26 +0300 Subject: [PATCH 109/655] [Build-System] Use a fresher gcc on RHEL based dists --- freeswitch.spec | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/freeswitch.spec b/freeswitch.spec index 3bbc518119..a62776b1cc 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -170,6 +170,19 @@ Requires: zlib Requires: libxml2 Requires: libsndfile +%if 0%{?rhel} == 7 +# to build mariadb module required gcc >= 4.9 (more details GH #1046) +# On CentOS 7 dist you can install fresh gcc using command +# yum install centos-release-scl && yum install devtoolset-9 +BuildRequires: devtoolset-9 +%endif +%if 0%{?rhel} == 8 +# we want use fresh gcc on RHEL 8 based dists +# On CentOS 8 dist you can install fresh gcc using command +# dnf install gcc-toolset-9 +BuildRequires: gcc-toolset-9 +%endif + %if 0%{?suse_version} > 800 PreReq: %insserv_prereq %fillup_prereq %endif @@ -1575,6 +1588,16 @@ export DESTDIR=%{buildroot}/ export PKG_CONFIG_PATH=/usr/bin/pkg-config:$PKG_CONFIG_PATH export ACLOCAL_FLAGS="-I /usr/share/aclocal" +%if 0%{?rhel} == 7 +# to build mod_mariadb we need gcc >= 4.9 (more details GH #1046) +export CFLAGS="$CFLAGS -Wno-error=expansion-to-defined" +. /opt/rh/devtoolset-9/enable +%endif +%if 0%{?rhel} == 8 +# we want use fresh gcc on RHEL 8 based dists +. /opt/rh/gcc-toolset-9/enable +%endif + ###################################################################################################################### # # Bootstrap, Configure and Build the whole enchilada @@ -1635,6 +1658,15 @@ cd libs/esl # ###################################################################################################################### %install +%if 0%{?rhel} == 7 +# to build mod_mariadb we need gcc >= 4.9 +. /opt/rh/devtoolset-9/enable +%endif +%if 0%{?rhel} == 8 +# we want use fresh gcc on RHEL 8 based dists +. /opt/rh/gcc-toolset-9/enable +%endif + %{__make} DESTDIR=%{buildroot} install From deecaae870dc0caf14bfc421c871bb6660f5e602 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 27 Apr 2021 15:54:32 -0400 Subject: [PATCH 110/655] STIR/SHAKEN (#1160) * [core] Add SWITCH_CAUSEs for STIR/SHAKEN. [mod_sofia] Add sofia_verify_identity dialplan APP as a STIR/SHAKEN verification service. Set sip_hangup_on_verify_identity_fail=true to end calls that fail verification, otherwise check sip_verstat and sip_verstat_detailed channel variables for verification result. * [mod_sofia] Fix stir shaken implementation issues on fail. * fix build * Fix given comments * stir_shaken_passport_get_grant return does not require to be freed. * reworked things * [core] add switch_rfc822_datetime_to_epoch() * [mod_sofia] fix test return code * [mod_sofia] Add Date header when signing Identity * [mod_sofia] Check Date - WIP doesn't work * [mod_sofia] STIR/SHAKEN check SIP Date header * Try to give time for sofia to clean up calls Co-authored-by: Andrey Volk --- configure.ac | 4 + src/include/switch_types.h | 7 +- src/mod/endpoints/mod_sofia/Makefile.am | 16 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 426 +++++++++++++++++- src/mod/endpoints/mod_sofia/mod_sofia.h | 7 + src/mod/endpoints/mod_sofia/sofia.c | 20 + src/mod/endpoints/mod_sofia/sofia_glue.c | 29 +- .../mod_sofia/test/conf/freeswitch.xml | 44 ++ .../mod_sofia/test/stir-shaken/priv.pem | 5 + .../mod_sofia/test/stir-shaken/pub.pem | 4 + .../mod_sofia/test/stir-shaken/www/cert.pem | 13 + .../mod_sofia/test/stir-shaken/www/pub.pem | 13 + .../mod_sofia/test/test_sofia_funcs.c | 144 ++++++ .../mod_sofia/test/test_sofia_funcs.sh | 11 + src/switch_channel.c | 5 + tests/unit/switch_vad.c | 3 +- 16 files changed, 742 insertions(+), 9 deletions(-) create mode 100644 src/mod/endpoints/mod_sofia/test/stir-shaken/priv.pem create mode 100644 src/mod/endpoints/mod_sofia/test/stir-shaken/pub.pem create mode 100644 src/mod/endpoints/mod_sofia/test/stir-shaken/www/cert.pem create mode 100644 src/mod/endpoints/mod_sofia/test/stir-shaken/www/pub.pem create mode 100755 src/mod/endpoints/mod_sofia/test/test_sofia_funcs.sh diff --git a/configure.ac b/configure.ac index a74edfbc8b..73c260f311 100644 --- a/configure.ac +++ b/configure.ac @@ -838,6 +838,10 @@ PKG_CHECK_MODULES([AMRWB], [opencore-amrwb >= 0.1.0 vo-amrwbenc >= 0.1.0],[ AM_CONDITIONAL([HAVE_AMRWB],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMRWB],[false])]) +PKG_CHECK_MODULES([STIRSHAKEN], [stirshaken],[ + AM_CONDITIONAL([HAVE_STIRSHAKEN],[true])],[ + AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_STIRSHAKEN],[false])]) + AC_CHECK_LIB(apr-1, apr_pool_mutex_set, use_system_apr=yes, use_system_apr=no) AM_CONDITIONAL([SYSTEM_APR],[test "${use_system_apr}" = "yes"]) AC_CHECK_LIB(aprutil-1, apr_queue_pop_timeout, use_system_aprutil=yes, use_system_aprutil=no) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 58f708729d..fafc508823 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -2235,7 +2235,12 @@ typedef enum { SWITCH_CAUSE_DECLINE = 616, SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE = 617, SWITCH_CAUSE_NOT_ACCEPTABLE = 618, - SWITCH_CAUSE_UNWANTED = 619 + 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_call_cause_t; typedef enum { diff --git a/src/mod/endpoints/mod_sofia/Makefile.am b/src/mod/endpoints/mod_sofia/Makefile.am index 0e4346e237..4bd1749175 100644 --- a/src/mod/endpoints/mod_sofia/Makefile.am +++ b/src/mod/endpoints/mod_sofia/Makefile.am @@ -5,21 +5,27 @@ MODNAME=mod_sofia noinst_LTLIBRARIES = libsofiamod.la libsofiamod_la_SOURCES = mod_sofia.c sofia.c sofia_json_api.c sofia_glue.c sofia_presence.c sofia_reg.c sofia_media.c sip-dig.c rtp.c mod_sofia.h libsofiamod_la_LDFLAGS = -static -libsofiamod_la_CFLAGS = $(AM_CFLAGS) -I. $(SOFIA_SIP_CFLAGS) +libsofiamod_la_CFLAGS = $(AM_CFLAGS) -I. $(SOFIA_SIP_CFLAGS) $(STIRSHAKEN_CFLAGS) +if HAVE_STIRSHAKEN +libsofiamod_la_CFLAGS += -DHAVE_STIRSHAKEN +endif mod_LTLIBRARIES = mod_sofia.la mod_sofia_la_SOURCES = mod_sofia_la_LIBADD = $(switch_builddir)/libfreeswitch.la libsofiamod.la -mod_sofia_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(SOFIA_SIP_LIBS) +mod_sofia_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(SOFIA_SIP_LIBS) $(STIRSHAKEN_LIBS) noinst_PROGRAMS = test/test_sofia_funcs test_test_sofia_funcs_SOURCES = test/test_sofia_funcs.c -test_test_sofia_funcs_CFLAGS = $(AM_CFLAGS) $(SOFIA_SIP_CFLAGS) -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" -test_test_sofia_funcs_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) +test_test_sofia_funcs_CFLAGS = $(AM_CFLAGS) $(SOFIA_SIP_CFLAGS) $(STIRSHAKEN_CFLAGS) -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" +if HAVE_STIRSHAKEN +test_test_sofia_funcs_CFLAGS += -DHAVE_STIRSHAKEN +endif +test_test_sofia_funcs_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) $(STIRSHAKEN_LIBS) test_test_sofia_funcs_LDADD = libsofiamod.la $(SOFIA_SIP_LIBS) -TESTS = $(noinst_PROGRAMS) +TESTS = test/test_sofia_funcs.sh if ISMAC mod_sofia_la_LDFLAGS += -framework CoreFoundation -framework SystemConfiguration diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8c1b7fd325..ce9d520ba8 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II + * Copyright (C) 2005-2021, Anthony Minessale II * * Version: MPL 1.1 * @@ -41,6 +41,10 @@ #include "mod_sofia.h" #include "sofia-sip/sip_extra.h" +#if HAVE_STIRSHAKEN +#include +#endif + SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown); SWITCH_MODULE_DEFINITION(mod_sofia, mod_sofia_load, mod_sofia_shutdown, NULL); @@ -351,6 +355,17 @@ static int hangup_cause_to_sip(switch_call_cause_t cause) return 606; case SWITCH_CAUSE_UNWANTED: return 607; + /* STIR/SHAKEN */ + case SWITCH_CAUSE_NO_IDENTITY: + return 428; + case SWITCH_CAUSE_BAD_IDENTITY_INFO: + return 429; + case SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE: + return 437; + case SWITCH_CAUSE_INVALID_IDENTITY: + return 438; + case SWITCH_CAUSE_STALE_DATE: + return 403; default: return 480; } @@ -6109,6 +6124,409 @@ SWITCH_STANDARD_APP(sofia_sla_function) switch_ivr_eavesdrop_session(session, data, NULL, ED_MUX_READ | ED_MUX_WRITE | ED_COPY_DISPLAY); } +#if HAVE_STIRSHAKEN +static stir_shaken_as_t *sofia_stir_shaken_as = NULL; +static stir_shaken_vs_t *sofia_stir_shaken_vs = NULL; + +static switch_status_t sofia_stir_shaken_vs_create(stir_shaken_context_t *context) +{ + sofia_stir_shaken_vs = stir_shaken_vs_create(context); + if (!sofia_stir_shaken_vs) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create Identity verification service!\n"); + return SWITCH_STATUS_FALSE; + } + if (mod_sofia_globals.stir_shaken_vs_ca_dir) { + stir_shaken_vs_load_ca_dir(context, sofia_stir_shaken_vs, mod_sofia_globals.stir_shaken_vs_ca_dir); + } + stir_shaken_vs_set_x509_cert_path_check(context, sofia_stir_shaken_vs, mod_sofia_globals.stir_shaken_vs_cert_path_check); + stir_shaken_vs_set_connect_timeout(context, sofia_stir_shaken_vs, 3); + //stir_shaken_vs_set_callback(context, sofia_stir_shaken_vs, shaken_callback); + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t sofia_stir_shaken_as_create(stir_shaken_context_t *context) +{ + if (mod_sofia_globals.stir_shaken_as_key && mod_sofia_globals.stir_shaken_as_url) { + sofia_stir_shaken_as = stir_shaken_as_create(context); + if (!sofia_stir_shaken_as) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create Identity authentication service!\n"); + return SWITCH_STATUS_FALSE; + } + if (stir_shaken_as_load_private_key(context, sofia_stir_shaken_as, mod_sofia_globals.stir_shaken_as_key) != STIR_SHAKEN_STATUS_OK) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load key for Identity authentication service: %s", mod_sofia_globals.stir_shaken_as_key); + stir_shaken_as_destroy(&sofia_stir_shaken_as); + return SWITCH_STATUS_FALSE; + } + } + return SWITCH_STATUS_SUCCESS; +} +#endif + +static void sofia_stir_shaken_create_services(void) +{ +#if HAVE_STIRSHAKEN + stir_shaken_context_t context = { 0 }; + if (stir_shaken_init(&context, STIR_SHAKEN_LOGLEVEL_NOTHING) != STIR_SHAKEN_STATUS_OK) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to initialize stirshaken library!\n"); + return; + } + sofia_stir_shaken_vs_create(&context); + sofia_stir_shaken_as_create(&context); +#endif +} + +static void sofia_stir_shaken_destroy_services(void) +{ +#if HAVE_STIRSHAKEN + stir_shaken_vs_destroy(&sofia_stir_shaken_vs); + stir_shaken_as_destroy(&sofia_stir_shaken_as); + stir_shaken_deinit(); +#endif +} + +#if HAVE_STIRSHAKEN +static char *canonicalize_phone_number(const char *number) +{ + // remove all characters except for digits, *, and # from the phone number + // TODO determine if dial number and remove dial codes or add country code + char *canonicalized_number = strdup(number ? number : ""); + size_t i = 0, j = 0; + size_t number_len = strlen(canonicalized_number); + for (i = 0; i < number_len; i++) { + if (isdigit(canonicalized_number[i]) || canonicalized_number[i] == '#' || canonicalized_number[i] == '*') { + canonicalized_number[j] = canonicalized_number[i]; + j++; + } + } + canonicalized_number[j] = '\0'; + return canonicalized_number; +} + +static switch_status_t sofia_stir_shaken_validate_passport_claims(switch_core_session_t *session, long iat, const char *orig, int orig_is_tn, const char *dest, int dest_is_tn) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *from = NULL; + const char *to = NULL; + char *canonicalized_from = NULL; + char *canonicalized_to = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + switch_time_t now = switch_epoch_time_now(NULL); + + if (iat > now) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "PASSporT iat is in the future\n"); + return SWITCH_STATUS_FALSE; + } else if (now - iat > 60) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "PASSporT iat is too old\n"); + return SWITCH_STATUS_FALSE; + } + + if (mod_sofia_globals.stir_shaken_vs_require_date || switch_true(switch_channel_get_variable(channel, "sip_stir_shaken_vs_require_date"))) { + const char *sip_epoch_time_var = switch_channel_get_variable(channel, "sip_date_epoch_time"); + switch_time_t sip_epoch_time; + + if (zstr(sip_epoch_time_var)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Missing required SIP Date\n"); + return SWITCH_STATUS_FALSE; + } + sip_epoch_time = strtol(sip_epoch_time_var, NULL, 10); + if (sip_epoch_time > now) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "SIP Date %s is in the future\n", sip_epoch_time_var); + return SWITCH_STATUS_FALSE; + } + if (now - sip_epoch_time > 60) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "SIP Date %s is too old\n", sip_epoch_time_var); + return SWITCH_STATUS_FALSE; + } + if ((iat > sip_epoch_time && iat - sip_epoch_time > 60) || (iat < sip_epoch_time && sip_epoch_time - iat > 60)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "SIP Date %s is too far from PASSporT iat %ld\n", sip_epoch_time_var, iat); + return SWITCH_STATUS_FALSE; + } + // Date is within 60 seconds of now and within 60 seconds of iat + } + + if (orig_is_tn) { + from = switch_channel_get_variable(channel, "sip_from_user"); + from = canonicalized_from = canonicalize_phone_number(from); + } else { + from = switch_channel_get_variable(channel, "sip_from_uri"); + } + if (dest_is_tn) { + to = switch_channel_get_variable(channel, "sip_to_user"); + to = canonicalized_to = canonicalize_phone_number(to); + } else { + to = switch_channel_get_variable(channel, "sip_to_uri"); + } + + if (zstr(from) || zstr(to) || zstr(orig) || zstr(dest)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Missing data to verify SIP From/To matches PASSporT claims. From=%s, To=%s, orig=%s, dest=%s\n", from, to, orig, dest); + status = SWITCH_STATUS_FALSE; + } else if (strcmp(orig, from) || strcmp(dest, to)) { + status = SWITCH_STATUS_FALSE; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "SIP From/To does not match PASSporT claims. From=%s, To=%s, orig=%s, dest=%s\n", from, to, orig, dest); + } else { + status = SWITCH_STATUS_SUCCESS; + } + switch_safe_free(canonicalized_from); + switch_safe_free(canonicalized_to); + return status; +} + +/** + * Returns first dest if found. Must be freed by caller. + */ +static char* sofia_stir_shaken_passport_get_dest(stir_shaken_passport_t *passport, int *is_tn) +{ + char *id = NULL; + char *dest = NULL; + int tn_form = 0; + int id_int = 0; + cJSON *item = NULL; + cJSON *destjson = NULL; + stir_shaken_context_t ss = { 0 }; + + if (!passport) return NULL; + + dest = stir_shaken_passport_get_grants_json(&ss, passport, "dest"); + if (!dest) { + return NULL; + } + + destjson = cJSON_Parse(dest); + if (!destjson) { + free(dest); + return NULL; + } + + if ((item = cJSON_GetObjectItem(destjson, "tn"))) { + tn_form = 1; + } else if ((item = cJSON_GetObjectItem(destjson, "uri"))) { + tn_form = 0; + } else { + cJSON_Delete(destjson); + free(dest); + return NULL; + } + + if (cJSON_IsArray(item)) { + item = cJSON_GetArrayItem(item, 0); + if (!item) { + cJSON_Delete(destjson); + free(dest); + return NULL; + } + } else { + item = destjson; + } + + if (cJSON_IsString(item)) { + id = strdup(item->valuestring); + } else if (cJSON_IsNumber(item)) { + id_int = item->valueint; + id = malloc(20); + if (!id) { + cJSON_Delete(destjson); + free(dest); + return NULL; + } + snprintf(id, 20, "%d", id_int); + } else { + cJSON_Delete(destjson); + free(dest); + return NULL; + } + + if (is_tn) *is_tn = tn_form; + cJSON_Delete(destjson); + free(dest); + return id; +} + + +#endif + +// TODO Date header must be present +// Date header must be < (expiration policy) age +// Date header must be within 1 minute of iat + + +/* Check signature in Identity header and save result to sip_verstat */ +SWITCH_STANDARD_APP(sofia_stir_shaken_vs_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); +#if HAVE_STIRSHAKEN + stir_shaken_status_t verify_signature_status = STIR_SHAKEN_STATUS_FALSE; + stir_shaken_context_t verify_signature_context = { 0 }; + stir_shaken_status_t validate_passport_status = STIR_SHAKEN_STATUS_FALSE; + stir_shaken_context_t validate_passport_context = { 0 }; + stir_shaken_context_t get_grant_context = { 0 }; + stir_shaken_passport_t *passport = NULL; + stir_shaken_cert_t *cert = NULL; + stir_shaken_error_t stir_error = { 0 }; + switch_status_t claim_status = SWITCH_STATUS_FALSE; + const char *identity_header = switch_channel_get_variable(channel, "sip_h_identity"); + const char *attestation = NULL; + int orig_is_tn = 0; + switch_bool_t hangup_on_fail = switch_true(switch_channel_get_variable(channel, "sip_stir_shaken_vs_hangup_on_fail")); + + // TODO: compact Identity header is not supported - this will require construction of PASSporT from SIP headers in order to check signature + + if (zstr(identity_header)) { + // Nothing to do + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No-TN-Validation: no SIP Identity\n"); + switch_channel_set_variable(channel, "sip_verstat_detailed", "No-TN-Validation"); + switch_channel_set_variable(channel, "sip_verstat", "No-TN-Validation"); + if (hangup_on_fail) { + switch_channel_hangup(channel, SWITCH_CAUSE_NO_IDENTITY); + } + goto done; + } + + // verify the JWT signature in the SIP Identity header + verify_signature_status = stir_shaken_vs_sih_verify(&verify_signature_context, sofia_stir_shaken_vs, identity_header, &cert, &passport); + if (verify_signature_status != STIR_SHAKEN_STATUS_OK) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "PASSporT failed signature verification: %s\n", stir_shaken_get_error(&verify_signature_context, &stir_error)); + if (hangup_on_fail) { + switch_channel_hangup(channel, SWITCH_CAUSE_INVALID_IDENTITY); + goto done; + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "PASSporT passed signature verification\n"); + } + + if (passport) { + // validate the PASSporT is not expired + int timeout = 60; + const char *timeout_str = switch_channel_get_variable(channel, "sip_stir_shaken_vs_max_age"); + if (timeout_str && switch_is_number(timeout_str)) { + int new_timeout = atoi(timeout_str); + if (new_timeout > 0) { + timeout = new_timeout; + } + } + validate_passport_status = stir_shaken_passport_validate_iat_against_freshness(&validate_passport_context, passport, timeout); + if (validate_passport_status != STIR_SHAKEN_STATUS_OK) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "PASSporT failed stale check: %s\n", stir_shaken_get_error(&validate_passport_context, &stir_error)); + if (hangup_on_fail) { + switch_channel_hangup(channel, SWITCH_CAUSE_STALE_DATE); + goto done; + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "PASSporT passed stale check\n"); + } + + // validate the required PASSporT headers and grants are set + validate_passport_status = stir_shaken_passport_validate_headers_and_grants(&validate_passport_context, passport); + if (validate_passport_status != STIR_SHAKEN_STATUS_OK) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "PASSporT failed header and grant validation: %s\n", stir_shaken_get_error(&validate_passport_context, &stir_error)); + if (hangup_on_fail) { + switch_channel_hangup(channel, SWITCH_CAUSE_INVALID_IDENTITY); + if (validate_passport_status == STIR_SHAKEN_STATUS_OK && verify_signature_status == STIR_SHAKEN_STATUS_OK) { + switch_channel_hangup(channel, SWITCH_CAUSE_INCOMING_CALL_BARRED); + } else { + switch_channel_hangup(channel, SWITCH_CAUSE_INVALID_IDENTITY); + } + goto done; + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "PASSporT passed header and grant validation\n"); + } + } + + if (passport) { + // validate the PASSporT claims match the SIP headers + stir_shaken_context_t validate_claims_context = { 0 }; + int dest_is_tn = 0; + char *orig = stir_shaken_passport_get_identity(&validate_claims_context, passport, &orig_is_tn); + char *dest = sofia_stir_shaken_passport_get_dest(passport, &dest_is_tn); // TODO libstirshaken should provide helper for 'dest' values + long iat = stir_shaken_passport_get_grant_int(&validate_claims_context, passport, "iat"); + claim_status = sofia_stir_shaken_validate_passport_claims(session, iat, orig, orig_is_tn, dest, dest_is_tn); + if (claim_status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "PASSporT claims do not match SIP request\n"); + if (hangup_on_fail) { + switch_channel_hangup(channel, SWITCH_CAUSE_INVALID_IDENTITY); + switch_safe_free(orig); + switch_safe_free(dest); + goto done; + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "PASSporT claims match SIP request\n"); + } + switch_safe_free(orig); + switch_safe_free(dest); + } + + attestation = stir_shaken_passport_get_grant(&get_grant_context, passport, "attest"); + + if (!zstr(attestation) && verify_signature_status == STIR_SHAKEN_STATUS_OK && validate_passport_status == STIR_SHAKEN_STATUS_OK && claim_status == SWITCH_STATUS_SUCCESS) { + if (orig_is_tn) { + switch_channel_set_variable_printf(channel, "sip_verstat_detailed", "TN-Validation-Passed-%s", attestation); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No-TN-Validation: PASSporT orig is not a telephone number\n"); + switch_channel_set_variable(channel, "sip_verstat", "No-TN-Validation"); + } + if (orig_is_tn && !strcmp(attestation, "A")) { + // Signature is valid and call has "A" attestation + switch_channel_set_variable(channel, "sip_verstat", "TN-Validation-Passed"); + } else { + // Signature is valid and call has "B" or "C" attestation or is not from a phone number + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No-TN-Validation: PASSporT only has \"%s\" attestation\n", attestation); + switch_channel_set_variable(channel, "sip_verstat", "No-TN-Validation"); + } + } else if (!passport || !cert || zstr(attestation) || verify_signature_status == STIR_SHAKEN_STATUS_OK) { + // failed to get cert / bad passport / no attestation / claims don't match SIP + switch_channel_set_variable(channel, "sip_verstat_detailed", "No-TN-Validation"); + switch_channel_set_variable(channel, "sip_verstat", "No-TN-Validation"); + } else { + // bad signature + switch_channel_set_variable_printf(channel, "sip_verstat_detailed", "TN-Validation-Failed-%s", attestation); + switch_channel_set_variable(channel, "sip_verstat", "TN-Validation-Failed"); + } + + +done: + stir_shaken_passport_destroy(&passport); + stir_shaken_cert_destroy(&cert); + +#else + switch_channel_set_variable(channel, "sip_verstat_detailed", "No-TN-Validation"); + switch_channel_set_variable(channel, "sip_verstat", "No-TN-Validation"); +#endif + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "verstat=%s, verstat_detailed=%s\n", switch_channel_get_variable(channel, "sip_verstat"), switch_channel_get_variable(channel, "sip_verstat_detailed")); +} + +/* This assumes TN attestation for orig and dest only */ +char *sofia_stir_shaken_as_create_identity_header(switch_core_session_t *session, const char *attest, const char *orig, const char *dest) +{ +#if HAVE_STIRSHAKEN + stir_shaken_context_t as_context = { 0 }; + stir_shaken_passport_params_t passport_params = { 0 }; + char *canonical_desttn = NULL; + char *canonical_origtn = NULL; + char *passport = NULL; + + if (zstr(attest) || zstr(orig) || zstr(dest) || !mod_sofia_globals.stir_shaken_as_url) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Missing required parameter to create PASSporT\n"); + return NULL; + } + + passport_params.attest = attest; + passport_params.x5u = mod_sofia_globals.stir_shaken_as_url; + passport_params.desttn_key = "tn"; + passport_params.desttn_val = canonical_desttn = canonicalize_phone_number(dest); + passport_params.iat = switch_epoch_time_now(NULL); + passport_params.origtn_key = "tn"; + passport_params.origtn_val = canonical_origtn = canonicalize_phone_number(orig); + passport_params.origid = switch_core_session_get_uuid(session); + + passport = stir_shaken_as_authenticate_to_sih(&as_context, sofia_stir_shaken_as, &passport_params, NULL); + switch_safe_free(canonical_desttn); + switch_safe_free(canonical_origtn); + return passport; +#else + return NULL; +#endif +} + SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) { @@ -6367,6 +6785,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) SWITCH_ADD_APP(app_interface, "sofia_sla", "private sofia sla function", "private sofia sla function", sofia_sla_function, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "sofia_stir_shaken_vs", "Verify SIP Identity header and store result in sip_verstat channel variable", + "Verify SIP Identity header and store result in sip_verstat channel variable", sofia_stir_shaken_vs_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, " "); SWITCH_ADD_API(api_interface, "sofia_gateway_data", "Get data from a sofia gateway", sofia_gateway_data_function, " [ivar|ovar|var] "); @@ -6410,6 +6830,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) crtp_init(*module_interface); + sofia_stir_shaken_create_services(); + /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; @@ -6496,6 +6918,8 @@ void mod_sofia_shutdown_cleanup() { switch_core_hash_destroy(&mod_sofia_globals.profile_hash); switch_core_hash_destroy(&mod_sofia_globals.gateway_hash); switch_mutex_unlock(mod_sofia_globals.hash_mutex); + + sofia_stir_shaken_destroy_services(); } SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 3c2d02a5a7..e91d849913 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -407,6 +407,11 @@ struct mod_sofia_globals { time_t presence_epoch; int presence_year; int abort_on_empty_external_ip; + const char *stir_shaken_as_key; + const char *stir_shaken_as_url; + const char *stir_shaken_vs_ca_dir; + int stir_shaken_vs_cert_path_check; + int stir_shaken_vs_require_date; }; extern struct mod_sofia_globals mod_sofia_globals; @@ -1274,6 +1279,8 @@ void sofia_glue_clear_soa(switch_core_session_t *session, switch_bool_t partner) 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); +char *sofia_stir_shaken_as_create_identity_header(switch_core_session_t *session, const char *attest, const char *orig, const char *dest); + /* For Emacs: * Local Variables: * mode:c diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index dbd9f94343..dd46fb4c0f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4547,6 +4547,19 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } else if (!strcasecmp(var, "capture-server")) { mod_sofia_globals.capture_server = switch_core_strdup(mod_sofia_globals.pool, val); + } else if (!strcasecmp(var, "stir-shaken-as-key")) { + /* The private key to authenticate SIP Identity when sip_identity_attest is set */ + mod_sofia_globals.stir_shaken_as_key = switch_core_strdup(mod_sofia_globals.pool, val); + } else if (!strcasecmp(var, "stir-shaken-as-url")) { + /* The x5u URL to advertise when sip_identity_attest is set */ + mod_sofia_globals.stir_shaken_as_url = switch_core_strdup(mod_sofia_globals.pool, val); + } else if (!strcasecmp(var, "stir-shaken-vs-ca-dir")) { + /* The dir that contains the trusted CA root certs. */ + mod_sofia_globals.stir_shaken_vs_ca_dir = switch_core_strdup(mod_sofia_globals.pool, val); + } else if (!strcasecmp(var, "stir-shaken-vs-cert-path-check")) { + mod_sofia_globals.stir_shaken_vs_cert_path_check = switch_true(val); + } else if (!strcasecmp(var, "stir-shaken-vs-require-date")) { + mod_sofia_globals.stir_shaken_vs_require_date = switch_true(val); } } } @@ -11426,6 +11439,13 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (sip->sip_identity && sip->sip_identity->id_value) { switch_channel_set_variable(channel, "sip_h_identity", sip->sip_identity->id_value); } + if (sip->sip_date && sip->sip_date->d_time > 0) { + // This INVITE has a SIP Date header. + // sofia-sip stores the Date header value in sip_date->d_time as seconds since January 1, 1900 0:00:00. + // Unix epoch time is seconds since January 1, 1970 0:00:00, making d_time larger by 2208988800. + // Convert to Unix epoch time and save it. + switch_channel_set_variable_printf(channel, "sip_date_epoch_time", "%ld", sip->sip_date->d_time - 2208988800); + } /* Loop thru unknown Headers Here so we can do something with them */ for (un = sip->sip_unknown; un; un = un->un_next) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 0c0035412f..10282383d2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1064,6 +1064,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) uint8_t is_t38 = 0; const char *hold_char = "*"; const char *session_id_header = sofia_glue_session_id_header(session, tech_pvt->profile); + const char *stir_shaken_attest = NULL; + char *identity_to_free = NULL; + const char *date = NULL; if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD_INACTIVE) || @@ -1123,7 +1126,20 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) alert_info = switch_core_session_sprintf(tech_pvt->session, "Alert-Info: %s", alertbuf); } - identity = switch_channel_get_variable(channel, "sip_h_identity"); + if ((stir_shaken_attest = switch_channel_get_variable(tech_pvt->channel, "sip_stir_shaken_attest"))) { + char date_buf[80] = ""; + char *dest = caller_profile->destination_number; + check_decode(dest, session); + switch_rfc822_date(date_buf, switch_micro_time_now()); + date = switch_core_session_strdup(tech_pvt->session, date_buf); + identity = identity_to_free = sofia_stir_shaken_as_create_identity_header(tech_pvt->session, stir_shaken_attest, cid_num, dest); + } + if (!identity) { + identity = switch_channel_get_variable(channel, "sip_h_identity"); + } + if (!date) { + date = switch_channel_get_variable(channel, "sip_h_date"); + } max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE); @@ -1658,6 +1674,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) TAG_IF(!zstr(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)), TAG_IF(!zstr(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)), TAG_IF(!zstr(identity), SIPTAG_IDENTITY_STR(identity)), + TAG_IF(!zstr(date), SIPTAG_DATE_STR(date)), TAG_IF(!zstr(alert_info), SIPTAG_HEADER_STR(alert_info)), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID), SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), @@ -1725,6 +1742,8 @@ end: sofia_glue_free_destination(dst); } + switch_safe_free(identity_to_free); + return status; } @@ -1832,6 +1851,14 @@ switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status) return SWITCH_CAUSE_EXCHANGE_ROUTING_ERROR; case 487: return SWITCH_CAUSE_ORIGINATOR_CANCEL; + case 428: + return SWITCH_CAUSE_NO_IDENTITY; + case 429: + return SWITCH_CAUSE_BAD_IDENTITY_INFO; + case 437: + return SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE; + case 438: + return SWITCH_CAUSE_INVALID_IDENTITY; default: return SWITCH_CAUSE_NORMAL_UNSPECIFIED; } diff --git a/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml index c654a84ebc..d58f45b983 100644 --- a/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml +++ b/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml @@ -31,6 +31,11 @@ + + + + + @@ -97,6 +102,45 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/endpoints/mod_sofia/test/stir-shaken/priv.pem b/src/mod/endpoints/mod_sofia/test/stir-shaken/priv.pem new file mode 100644 index 0000000000..0e812f09b6 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/stir-shaken/priv.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIKigooZBuy0XvaeIEFPkuvOehEbhrqFIKdeBZAJaZIawoAoGCCqGSM49 +AwEHoUQDQgAEnqiYijyOLEo9hJ/x2oVYIQT12XL3YREF2XS+cWmabEtjJpfAPmS+ +1f+fg3APWD+owNyaDV54r3YTHqkvTK/5mA== +-----END EC PRIVATE KEY----- diff --git a/src/mod/endpoints/mod_sofia/test/stir-shaken/pub.pem b/src/mod/endpoints/mod_sofia/test/stir-shaken/pub.pem new file mode 100644 index 0000000000..96c90cbeeb --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/stir-shaken/pub.pem @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEnqiYijyOLEo9hJ/x2oVYIQT12XL3 +YREF2XS+cWmabEtjJpfAPmS+1f+fg3APWD+owNyaDV54r3YTHqkvTK/5mA== +-----END PUBLIC KEY----- diff --git a/src/mod/endpoints/mod_sofia/test/stir-shaken/www/cert.pem b/src/mod/endpoints/mod_sofia/test/stir-shaken/www/cert.pem new file mode 100644 index 0000000000..f364baa301 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/stir-shaken/www/cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB6DCCAY6gAwIBAgIBATAKBggqhkjOPQQDAjAlMQswCQYDVQQGEwJVUzEWMBQG +A1UEAwwNbGlic3RpcnNoYWtlbjAeFw0yMTA0MTMwMTA1MDBaFw0zMTA0MTEwMTA1 +MDBaMCUxCzAJBgNVBAYTAlVTMRYwFAYDVQQDDA1saWJzdGlyc2hha2VuMFkwEwYH +KoZIzj0CAQYIKoZIzj0DAQcDQgAEnqiYijyOLEo9hJ/x2oVYIQT12XL3YREF2XS+ +cWmabEtjJpfAPmS+1f+fg3APWD+owNyaDV54r3YTHqkvTK/5mKOBrjCBqzAdBgNV +HQ4EFgQUdCtIqcHHdpzTxT0uZ3BUo7f+IhYwHwYDVR0jBBgwFoAUdCtIqcHHdpzT +xT0uZ3BUo7f+IhYwNQYJYIZIAYb4QgENBCgWJkFsd2F5cyBsb29rIG9uIHRoZSBi +cmlnaHQgc2lkZSBvZiBsaWZlMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMBEGCWCGSAGG+EIBAQQEAwICBDAKBggqhkjOPQQDAgNIADBFAiAN2YS+x4Nb +fWAwiLKlQV141PkFQ7KbjVYeHHjPO7u1dgIhAI7N+vW2BdFzhH65xcHn/nWv1HXe +5NfoHbhDS+cC7Bet +-----END CERTIFICATE----- diff --git a/src/mod/endpoints/mod_sofia/test/stir-shaken/www/pub.pem b/src/mod/endpoints/mod_sofia/test/stir-shaken/www/pub.pem new file mode 100644 index 0000000000..f364baa301 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/stir-shaken/www/pub.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB6DCCAY6gAwIBAgIBATAKBggqhkjOPQQDAjAlMQswCQYDVQQGEwJVUzEWMBQG +A1UEAwwNbGlic3RpcnNoYWtlbjAeFw0yMTA0MTMwMTA1MDBaFw0zMTA0MTEwMTA1 +MDBaMCUxCzAJBgNVBAYTAlVTMRYwFAYDVQQDDA1saWJzdGlyc2hha2VuMFkwEwYH +KoZIzj0CAQYIKoZIzj0DAQcDQgAEnqiYijyOLEo9hJ/x2oVYIQT12XL3YREF2XS+ +cWmabEtjJpfAPmS+1f+fg3APWD+owNyaDV54r3YTHqkvTK/5mKOBrjCBqzAdBgNV +HQ4EFgQUdCtIqcHHdpzTxT0uZ3BUo7f+IhYwHwYDVR0jBBgwFoAUdCtIqcHHdpzT +xT0uZ3BUo7f+IhYwNQYJYIZIAYb4QgENBCgWJkFsd2F5cyBsb29rIG9uIHRoZSBi +cmlnaHQgc2lkZSBvZiBsaWZlMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMBEGCWCGSAGG+EIBAQQEAwICBDAKBggqhkjOPQQDAgNIADBFAiAN2YS+x4Nb +fWAwiLKlQV141PkFQ7KbjVYeHHjPO7u1dgIhAI7N+vW2BdFzhH65xcHn/nWv1HXe +5NfoHbhDS+cC7Bet +-----END CERTIFICATE----- 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 0c03d232d1..e769057363 100644 --- a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c +++ b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c @@ -112,6 +112,150 @@ FST_TEST_BEGIN(originate_test) } FST_TEST_END() +FST_TEST_BEGIN(sofia_verify_identity_test_no_identity) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true}sofia/internal/verifyidentity@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status != SWITCH_STATUS_SUCCESS); + fst_check(cause == SWITCH_CAUSE_NO_IDENTITY); + if (session) { + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); + } +} +FST_TEST_END() + +FST_TEST_BEGIN(sofia_verify_identity_test_bad_identity) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true,sip_h_identity=foo;info=bar}sofia/internal/verifyidentity@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status != SWITCH_STATUS_SUCCESS); + fst_check(cause == SWITCH_CAUSE_INVALID_IDENTITY); + if (session) { + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); + } +} +FST_TEST_END() + +FST_TEST_BEGIN(sofia_verify_identity_test_valid_identity_no_cert_available) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_h_identity=eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cDovLzEyNy4wLjAuMS80MDQucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxNTU1MzIxNDMyMSJdfSwiaWF0IjoxNjE4Mjc5OTYzLCJvcmlnIjp7InRuIjoiMTU1NTEyMzEyMzQifSwib3JpZ2lkIjoiMTMxMzEzMTMifQ.Cm34sISkFWYB6ohtjjJEO71Hyz4TQ5qrTDyYmCXBj-ni5Fe7IbNjmMyvY_lD_Go0u2csWQNe8n03fHSO7Z7nNw;info=;alg=ES256;ppt=shaken}sofia/internal/+15553214321@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status != SWITCH_STATUS_SUCCESS); + fst_check(cause == SWITCH_CAUSE_INVALID_IDENTITY); + if (session) { + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); + } +} +FST_TEST_END() + +FST_TEST_BEGIN(sofia_auth_identity_test_attest_a) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=A}sofia/internal/+15553214322@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_requires(session); + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); +} +FST_TEST_END() + +FST_TEST_BEGIN(sofia_auth_identity_test_attest_b) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=B}sofia/internal/+15553214322@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_requires(session); + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); +} +FST_TEST_END() + +FST_TEST_BEGIN(sofia_auth_identity_test_attest_c) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=C}sofia/internal/+15553214322@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_requires(session); + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); +} +FST_TEST_END() + +FST_TEST_BEGIN(sofia_verify_identity_test_verified_attest_a_expired) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_h_identity=eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cDovLzEyNy4wLjAuMTo4MDgwL2NlcnQucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxNTU1MzIxNDMyMiJdfSwiaWF0IjoxNjE4MzczMTc0LCJvcmlnIjp7InRuIjoiMTU1NTEyMzEyMzQifSwib3JpZ2lkIjoiMzliZDYzZDQtOTE1Mi00MzU0LWFkNjctNjg5NjQ2NmI4ZDI3In0.mUaikwHSOb8RVPwwMZTsqBe57MZY29CgbIqmiiEmyq9DzKZO-y4qShiIVT3serg-xHgC9SCMjUOBWaDfeXnEvA;info=;alg=ES256;ppt=shaken}sofia/internal/+15553214322@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status != SWITCH_STATUS_SUCCESS); + fst_check(cause == SWITCH_CAUSE_CALL_REJECTED); + if (session) { + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); + } +} +FST_TEST_END() + +FST_TEST_BEGIN(sofia_auth_identity_test_attest_a_date) +{ + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231235,ignore_early_media=true,sip_stir_shaken_attest=A}sofia/internal/+15553214323@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_requires(session); + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(10 * 1000 * 1000); +} +FST_TEST_END() + FST_MODULE_END() FST_CORE_END() diff --git a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.sh b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.sh new file mode 100755 index 0000000000..3ef117ee52 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.sh @@ -0,0 +1,11 @@ +#/bin/sh +cd test +pushd stir-shaken/www +python -m SimpleHTTPServer 8080 & +ppid=$! +popd +./test_sofia_funcs $@ +test=$? +kill $ppid +wait $ppid +exit $test diff --git a/src/switch_channel.c b/src/switch_channel.c index 09a0697f9f..1beeaef4c4 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -130,6 +130,11 @@ static struct switch_cause_table CAUSE_CHART[] = { {"DOES_NOT_EXIST_ANYWHERE", SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE}, {"NOT_ACCEPTABLE", SWITCH_CAUSE_NOT_ACCEPTABLE}, {"UNWANTED", SWITCH_CAUSE_UNWANTED}, + {"NO_IDENTITY", SWITCH_CAUSE_NO_IDENTITY}, + {"BAD_IDENTITY_INFO", SWITCH_CAUSE_BAD_IDENTITY_INFO}, + {"UNSUPPORTED_CERTIFICATE", SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE}, + {"INVALID_IDENTITY", SWITCH_CAUSE_INVALID_IDENTITY}, + {"STALE_DATE", SWITCH_CAUSE_STALE_DATE}, {NULL, 0} }; diff --git a/tests/unit/switch_vad.c b/tests/unit/switch_vad.c index 8b0f85bb1f..95519c7b92 100644 --- a/tests/unit/switch_vad.c +++ b/tests/unit/switch_vad.c @@ -75,11 +75,12 @@ FST_CORE_BEGIN("./conf") int duration; float pos = 0.0; int got_transition = 0; + int res; switch_vad_state_t cur_state = SWITCH_VAD_STATE_NONE; switch_vad_t *vad = switch_vad_init(8000, 1); fst_requires(vad); - int res = switch_vad_set_mode(vad, 0); // tone is detected as speech in mode 0 + res = switch_vad_set_mode(vad, 0); // tone is detected as speech in mode 0 fst_requires(res == 0); switch_vad_set_param(vad, "silence_ms", 400); switch_vad_set_param(vad, "voice_ms", 80); From 583443e384c3b05f35c461265ad930825a9254b8 Mon Sep 17 00:00:00 2001 From: Clarence Date: Wed, 28 Apr 2021 19:59:52 +0800 Subject: [PATCH 111/655] [mod_sofia] release nat mapping when nua create failed --- src/mod/endpoints/mod_sofia/sofia.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index dd46fb4c0f..d152a12810 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3188,7 +3188,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void if (!sofia_glue_init_sql(profile)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database [%s]!\n", profile->name); sofia_profile_start_failure(profile, profile->name); - goto end; + goto db_fail; } supported = switch_core_sprintf(profile->pool, "%s%s%spath, replaces", use_100rel ? "100rel, " : "", use_timer ? "timer, " : "", use_rfc_5626 ? "outbound, " : ""); @@ -3339,7 +3339,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } sofia_profile_start_failure(profile, profile->name); - goto end; + goto nua_fail; } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created agent for %s\n", profile->name); @@ -3570,6 +3570,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void switch_event_fire(&s_event); } + nua_fail: if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_nat_get_type()) { if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); @@ -3582,7 +3583,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } } - end: + db_fail: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock %s\n", profile->name); switch_thread_rwlock_wrlock(profile->rwlock); From fc054360b70e026122249c834b28d95248c881b5 Mon Sep 17 00:00:00 2001 From: sergey-safarov Date: Thu, 6 May 2021 20:51:54 +0300 Subject: [PATCH 112/655] [Build-System] Rename package format-mod-opusfile to format-opusfile on CentOS --- freeswitch.spec | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index a62776b1cc..9e5f368fe6 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -37,7 +37,6 @@ %define build_mod_esl 0 %define build_mod_rayo 1 %define build_mod_ssml 1 -%define build_mod_opusfile 0 %define build_mod_v8 0 %{?with_sang_tc:%define build_sng_tc 1 } @@ -46,7 +45,6 @@ %{?with_py26_esl:%define build_py26_esl 1 } %{?with_timerfd:%define build_timerfd 1 } %{?with_mod_esl:%define build_mod_esl 1 } -%{?with_mod_opusfile:%define build_mod_opusfile 1 } %{?with_mod_v8:%define build_mod_v8 1 } %define nonparsedversion 1.7.0 @@ -1107,17 +1105,15 @@ BuildRequires: lame-devel Mod Shout is a FreeSWITCH module to allow you to stream audio from MP3s or a i shoutcast stream. -%if %{build_mod_opusfile} -%package format-mod-opusfile +%package format-opusfile Summary: Plays Opus encoded files Group: System/Libraries Requires: %{name} = %{version}-%{release} Requires: opusfile >= 0.5 BuildRequires: opusfile-devel >= 0.5 -%description format-mod-opusfile +%description format-opusfile Mod Opusfile is a FreeSWITCH module to allow you to play Opus encoded files -%endif %if %{build_mod_ssml} %package format-ssml @@ -1514,14 +1510,11 @@ EVENT_HANDLERS_MODULES+=" event_handlers/mod_rayo" # File and Audio Format Handlers # ###################################################################################################################### -FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ +FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_opusfile formats/mod_portaudio_stream \ formats/mod_shell_stream formats/mod_shout formats/mod_sndfile formats/mod_tone_stream" %if %{build_mod_ssml} FORMATS_MODULES+=" formats/mod_ssml" %endif -%if %{build_mod_opusfile} -FORMATS_MODULES+=" formats/mod_opusfile" -%endif ###################################################################################################################### # @@ -2349,6 +2342,9 @@ fi %files format-native-file %{MODINSTDIR}/mod_native_file.so* +%files format-opusfile +%{MODINSTDIR}/mod_opusfile.so* + %files format-portaudio-stream %{MODINSTDIR}/mod_portaudio_stream.so* From 2915d3aba8f52e34a7fd258fbd4182fddfa42879 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Fri, 7 May 2021 14:17:15 +0000 Subject: [PATCH 113/655] [mod_amrwb] add cfg setting mode-set-overwrite (it will answer with just one mode-set value) - fixes audio quality issues in mod_conference with some UEs. --- conf/testing/autoload_configs/amrwb.conf.xml | 2 ++ conf/vanilla/autoload_configs/amrwb.conf.xml | 2 ++ src/mod/codecs/mod_amrwb/mod_amrwb.c | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/testing/autoload_configs/amrwb.conf.xml b/conf/testing/autoload_configs/amrwb.conf.xml index 0bd8e6b733..1163ffd1a6 100644 --- a/conf/testing/autoload_configs/amrwb.conf.xml +++ b/conf/testing/autoload_configs/amrwb.conf.xml @@ -18,5 +18,7 @@ + + diff --git a/conf/vanilla/autoload_configs/amrwb.conf.xml b/conf/vanilla/autoload_configs/amrwb.conf.xml index 0bd8e6b733..1163ffd1a6 100644 --- a/conf/vanilla/autoload_configs/amrwb.conf.xml +++ b/conf/vanilla/autoload_configs/amrwb.conf.xml @@ -18,5 +18,7 @@ + + diff --git a/src/mod/codecs/mod_amrwb/mod_amrwb.c b/src/mod/codecs/mod_amrwb/mod_amrwb.c index ef7891cde6..8be5f4d541 100644 --- a/src/mod/codecs/mod_amrwb/mod_amrwb.c +++ b/src/mod/codecs/mod_amrwb/mod_amrwb.c @@ -88,6 +88,7 @@ static struct { switch_byte_t volte; switch_byte_t adjust_bitrate; switch_byte_t force_oa; /*force OA when originating*/ + switch_byte_t mode_set_overwrite; int debug; } globals; @@ -273,7 +274,7 @@ static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_fla } } - if (context->enc_modes) { + if (context->enc_modes && !globals.mode_set_overwrite) { /* choose the highest mode (bitrate) for high audio quality. */ for (i = SWITCH_AMRWB_MODES-2; i > -1; i--) { if (context->enc_modes & (1 << i)) { @@ -572,6 +573,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amrwb_load) if (!strcasecmp(var, "force-oa")) { globals.force_oa = (switch_byte_t) atoi(val); } + if (!strcasecmp(var, "mode-set-overwrite")) { + globals.mode_set_overwrite = (switch_byte_t) atoi(val); + } } } } From 954056c009482d8093b37c26d6e2fbda33d85383 Mon Sep 17 00:00:00 2001 From: Aron Podrigal Date: Mon, 10 May 2021 14:32:48 -0500 Subject: [PATCH 114/655] [mod_curl] Added PATCH method, add insecure and secure options to verify SSL certs, add proxy option. * mod_curl: hanlde PATCH method * mod_curl: verify ssl with an option `insecure` to not verify * mod_curl: added option to use proxy * mod_curl: use assert(options) * [mod_curl] default certificate validation secure/insecure controlled by `validate-certs` config option. * [mod_curl] Added option secure to force https certs validation --- src/mod/applications/mod_curl/mod_curl.c | 105 ++++++++++++----------- 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index f0c952a215..2da7d4e1ea 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -50,7 +50,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load); */ SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL); -static char *SYNTAX = "curl url [headers|json|content-type |connect-timeout |timeout |append_headers [|append_headers ]] [get|head|post|delete|put [data]]"; +static char *SYNTAX = "curl url [headers|json|content-type |connect-timeout |timeout |append_headers [|append_headers ]|insecure|secure|[proxy ]] [get|head|post|delete|put [data]]"; #define HTTP_SENDFILE_ACK_EVENT "curl_sendfile::ack" #define HTTP_SENDFILE_RESPONSE_SIZE 32768 @@ -61,11 +61,13 @@ static struct { switch_memory_pool_t *pool; switch_event_node_t *node; int max_bytes; + switch_bool_t validate_certs; } globals; static switch_xml_config_item_t instructions[] = { /* parameter name type reloadable pointer default value options structure */ SWITCH_CONFIG_ITEM("max-bytes", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.max_bytes, (void *) HTTP_DEFAULT_MAX_BYTES, NULL,NULL, NULL), + SWITCH_CONFIG_ITEM("validate-certs", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.validate_certs, SWITCH_FALSE, NULL, NULL, NULL), SWITCH_CONFIG_ITEM_END() }; @@ -124,6 +126,8 @@ typedef struct callback_obj callback_t; struct curl_options_obj { long connect_timeout; long timeout; + int insecure; + char *proxy; }; typedef struct curl_options_obj curl_options_t; @@ -178,6 +182,8 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c switch_curl_slist_t *headers = NULL; struct data_stream dstream = { NULL }; + assert(options); + http_data = switch_core_alloc(pool, sizeof(http_data_t)); memset(http_data, 0, sizeof(http_data_t)); http_data->pool = pool; @@ -192,20 +198,27 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "method: %s, url: %s, content-type: %s\n", method, url, content_type); curl_handle = switch_curl_easy_init(); - if (options) { - if (options->connect_timeout) { - switch_curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, options->connect_timeout); - } + if (options->connect_timeout) { + switch_curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, options->connect_timeout); + } - if (options->timeout) { - switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, options->timeout); - } + if (options->timeout) { + switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, options->timeout); + } + + if (options->proxy) { + switch_curl_easy_setopt(curl_handle, CURLOPT_PROXY, options->proxy); } if (!strncasecmp(url, "https", 5)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", url); - switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); - switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0); + if (options->insecure) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", url); + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0); + } else { + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 1); + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 1); + } } if (append_headers) { @@ -228,6 +241,16 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c switch_safe_free(ct); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Post data: %s\n", data); + } else if (!strcasecmp(method, "patch")) { + switch_curl_easy_setopt(curl_handle, CURLOPT_CUSTOMREQUEST, "PATCH"); + switch_curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(data)); + switch_curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, (void *) data); + if (content_type) { + char *ct = switch_mprintf("Content-Type: %s", content_type); + headers = switch_curl_slist_append(headers, ct); + switch_safe_free(ct); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PATCH data: %s\n", data); } else if (!strcasecmp(method, "delete")) { switch_curl_easy_setopt(curl_handle, CURLOPT_CUSTOMREQUEST, "DELETE"); switch_curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(data)); @@ -807,7 +830,7 @@ SWITCH_STANDARD_APP(curl_app_function) switch_curl_slist_t *slist = NULL; switch_stream_handle_t stream = { 0 }; int i = 0; - curl_options_t options = { 0 }; + curl_options_t options = { .insecure = !globals.validate_certs }; const char *curl_timeout; char *append_headers[HTTP_MAX_APPEND_HEADERS + 1] = { 0 }; int ah_index = 0; @@ -830,24 +853,8 @@ SWITCH_STANDARD_APP(curl_app_function) do_json = SWITCH_TRUE; } else if (!strcasecmp("get", argv[i]) || !strcasecmp("head", argv[i])) { method = switch_core_strdup(pool, argv[i]); - } else if (!strcasecmp("post", argv[i])) { - method = "post"; - if (++i < argc) { - postdata = switch_core_strdup(pool, argv[i]); - switch_url_decode(postdata); - } else { - postdata = ""; - } - } else if (!strcasecmp("delete", argv[i])) { - method = "delete"; - if (++i < argc) { - postdata = switch_core_strdup(pool, argv[i]); - switch_url_decode(postdata); - } else { - postdata = ""; - } - } else if (!strcasecmp("put", argv[i])) { - method = "put"; + } else if (!strcasecmp("post", argv[i]) || !strcasecmp("patch", argv[i]) || !strcasecmp("put", argv[i]) || !strcasecmp("delete", argv[i])) { + method = argv[i]; if (++i < argc) { postdata = switch_core_strdup(pool, argv[i]); switch_url_decode(postdata); @@ -863,6 +870,14 @@ SWITCH_STANDARD_APP(curl_app_function) if (ah_index == HTTP_MAX_APPEND_HEADERS) continue; append_headers[ah_index++] = argv[i]; } + } else if (!strcasecmp("insecure", argv[i])) { + options.insecure = 1; + } else if (!strcasecmp("secure", argv[i])) { + options.insecure = 0; + } else if (!strcasecmp("proxy", argv[i])) { + if (++i < argc) { + options.proxy = argv[i]; + } } } } @@ -931,7 +946,7 @@ SWITCH_STANDARD_API(curl_function) int ah_index = 0; switch_memory_pool_t *pool = NULL; - curl_options_t options = { 0 }; + curl_options_t options = { .insecure = !globals.validate_certs }; if (zstr(cmd)) { switch_goto_status(SWITCH_STATUS_SUCCESS, usage); @@ -958,24 +973,8 @@ SWITCH_STANDARD_API(curl_function) do_json = SWITCH_TRUE; } else if (!strcasecmp("get", argv[i]) || !strcasecmp("head", argv[i])) { method = switch_core_strdup(pool, argv[i]); - } else if (!strcasecmp("post", argv[i])) { - method = "post"; - if (++i < argc) { - postdata = switch_core_strdup(pool, argv[i]); - switch_url_decode(postdata); - } else { - postdata = ""; - } - } else if (!strcasecmp("delete", argv[i])) { - method = "delete"; - if (++i < argc) { - postdata = switch_core_strdup(pool, argv[i]); - switch_url_decode(postdata); - } else { - postdata = ""; - } - } else if (!strcasecmp("put", argv[i])) { - method = "put"; + } else if (!strcasecmp("post", argv[i]) || !strcasecmp("patch", argv[i]) || !strcasecmp("put", argv[i]) || !strcasecmp("delete", argv[i])) { + method = argv[i]; if (++i < argc) { postdata = switch_core_strdup(pool, argv[i]); switch_url_decode(postdata); @@ -1011,6 +1010,14 @@ SWITCH_STANDARD_API(curl_function) if (ah_index == HTTP_MAX_APPEND_HEADERS) continue; append_headers[ah_index++] = argv[i]; } + } else if (!strcasecmp("insecure", argv[i])) { + options.insecure = 1; + } else if (!strcasecmp("secure", argv[i])) { + options.insecure = 0; + } else if (!strcasecmp("proxy", argv[i])) { + if (++i < argc) { + options.proxy = argv[i]; + } } } From 21c113ba2c07b3328d2d3cfc41cb005d06dfd3da Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 11 Apr 2020 22:37:04 +0000 Subject: [PATCH 115/655] [mod_curl] look for cacert in certs dir --- src/mod/applications/mod_curl/mod_curl.c | 34 +++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 2da7d4e1ea..02079d6767 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -85,6 +85,7 @@ struct http_data_obj { int err; long http_response_code; char *http_response; + char *cacert; switch_curl_slist_t *headers; }; typedef struct http_data_obj http_data_t; @@ -102,6 +103,7 @@ struct http_sendfile_data_obj { char *filename_element_name; char *extrapost_elements; switch_CURL *curl_handle; + char *cacert; struct curl_httppost *formpost; struct curl_httppost *lastptr; uint8_t flags; /* This is for where to send output of the curl_sendfile commands */ @@ -211,13 +213,20 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c } if (!strncasecmp(url, "https", 5)) { - if (options->insecure) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", url); - switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); - switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0); + http_data->cacert = switch_core_sprintf(http_data->pool, "%s%scacert.pem", SWITCH_GLOBAL_dirs.certs_dir, SWITCH_PATH_SEPARATOR); + + if (switch_file_exists(http_data->cacert, http_data->pool) == SWITCH_STATUS_SUCCESS) { + switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, http_data->cacert); } else { - switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 1); - switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 1); + http_data->cacert = NULL; + if (options->insecure) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", url); + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0); + } else { + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 1); + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 1); + } } } @@ -413,9 +422,16 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data) if (!strncasecmp(http_data->url, "https", 5)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", http_data->url); - curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYPEER, 0); - curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYHOST, 0); + http_data->cacert = switch_core_sprintf(http_data->pool, "%s%scacert.pem", SWITCH_GLOBAL_dirs.certs_dir, SWITCH_PATH_SEPARATOR); + + if (switch_file_exists(http_data->cacert, http_data->pool) == SWITCH_STATUS_SUCCESS) { + switch_curl_easy_setopt(http_data->curl_handle, CURLOPT_CAINFO, http_data->cacert); + } else { + http_data->cacert = NULL; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", http_data->url); + curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYHOST, 0); + } } /* From the docs: From a562db760c8a9247d35d353ed98331b835ca3636 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Fri, 14 May 2021 18:36:30 +0300 Subject: [PATCH 116/655] [mod_opus] add cfg setting to overwrite the fmtp stereo param coming from remote. Eg: incoming SDP has stereo=1 but we want a mono call so we answer with stereo=0. * [mod_opus] add cfg setting to overwrite the fmtp stereo param coming from remote. Eg: incoming SDP has stereo=1 but we want a mono call so we answer with stereo=0. sprop-stereo will be set to 0 too. * [core] opus: use switch_core_max_audio_channels() with remote fmtp stereo=1 to allow disabling of stereo. --- conf/testing/autoload_configs/opus.conf.xml | 3 ++- conf/vanilla/autoload_configs/opus.conf.xml | 4 +++- src/mod/codecs/mod_opus/mod_opus.c | 10 +++++++++- src/switch_core_media.c | 8 +++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/conf/testing/autoload_configs/opus.conf.xml b/conf/testing/autoload_configs/opus.conf.xml index e187a0a6c5..1154797dce 100644 --- a/conf/testing/autoload_configs/opus.conf.xml +++ b/conf/testing/autoload_configs/opus.conf.xml @@ -6,6 +6,7 @@ - + + diff --git a/conf/vanilla/autoload_configs/opus.conf.xml b/conf/vanilla/autoload_configs/opus.conf.xml index 94aaede471..8494c2d3c7 100644 --- a/conf/vanilla/autoload_configs/opus.conf.xml +++ b/conf/vanilla/autoload_configs/opus.conf.xml @@ -28,6 +28,8 @@ - + + + diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index 2081ef1b88..a90aba346a 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -160,6 +160,7 @@ struct { int debuginfo; uint32_t use_jb_lookahead; switch_mutex_t *mutex; + int mono; } opus_prefs; static struct { @@ -283,7 +284,7 @@ static switch_status_t switch_opus_fmtp_parse(const char *fmtp, switch_codec_fmt } if (!strcasecmp(data, "stereo")) { - codec_settings->stereo = atoi(arg); + codec_settings->stereo = opus_prefs.mono ? 0 : atoi(arg); codec_fmtp->stereo = codec_settings->stereo; } @@ -563,6 +564,11 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag opus_codec_settings.usedtx = opus_prefs.use_dtx; + if (opus_prefs.mono) { + opus_codec_settings.stereo = 0; + opus_codec_settings.sprop_stereo = 0; + } + codec->fmtp_out = gen_fmtp(&opus_codec_settings, codec->memory_pool); if (encoding) { @@ -1080,6 +1086,8 @@ static switch_status_t opus_load_config(switch_bool_t reload) if (!switch_opus_acceptable_rate(opus_prefs.sprop_maxcapturerate)) { opus_prefs.sprop_maxcapturerate = 0; /* value not supported */ } + } else if (!strcasecmp(key, "mono")) { + opus_prefs.mono = atoi(val); } } } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index ac8b9b9f71..686bc344f7 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5774,7 +5774,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s pmap->adv_channels = 2; /* IKR ???*/ } if (!zstr((char *) mmap->rm_fmtp) && switch_stristr("stereo=1", (char *) mmap->rm_fmtp)) { - pmap->channels = 2; + uint32_t allow_channels = switch_core_max_audio_channels(0); + if (!allow_channels || allow_channels >= 2) { /*default*/ + pmap->channels = 2; + } else { /* allow_channels == 1 */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Opus: setting 1 audio channel via config.\n"); + pmap->channels = 1; + } } else { pmap->channels = 1; } From 5a9eabca8e085451c259ea06c580aae74753fe15 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Sun, 16 May 2021 23:12:28 +0000 Subject: [PATCH 117/655] [core] Fix read of uninitialized buffer in switch_simple_email(). --- src/switch_utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index 0fee81551b..85e12f0488 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -1128,6 +1128,8 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, switch_bool_t rval = SWITCH_FALSE; const char *err = NULL; + filename[0] = '\0'; + if (zstr(to)) { err = "No to address specified"; goto end; @@ -1323,7 +1325,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, close(fd); } - if (unlink(filename) != 0) { + if (!zstr_buf(filename) && unlink(filename) != 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", filename); } From 189f6f8db256bca8ef63683104247e4b85c81f93 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 28 May 2021 21:26:56 +0300 Subject: [PATCH 118/655] [apr] error: use of undeclared identifier 'NSIG' --- libs/apr/include/apr_general.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/apr/include/apr_general.h b/libs/apr/include/apr_general.h index 42eec83ce4..3a956288e3 100644 --- a/libs/apr/include/apr_general.h +++ b/libs/apr/include/apr_general.h @@ -29,6 +29,10 @@ #include "apr_pools.h" #include "apr_errno.h" +#if !defined(_ANSI_SOURCE) && defined(_DARWIN_C_SOURCE) +#define NSIG __DARWIN_NSIG +#endif + #if APR_HAVE_SIGNAL_H #include #endif From 81fff857c5455167d807179ff5621d62d9a137f8 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 7 Jun 2021 20:46:58 +0300 Subject: [PATCH 119/655] [mod_sofia] sofia_process_dispatch_event() should unref all handles via sofia stack --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 20 +++++++------------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ce9d520ba8..79a3c06795 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1343,7 +1343,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi de->session = session; } - sofia_process_dispatch_event(&de, SWITCH_FALSE); + sofia_process_dispatch_event(&de); switch_mutex_unlock(tech_pvt->sofia_mutex); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index e91d849913..02128bf2fd 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1253,7 +1253,7 @@ uint32_t sofia_presence_get_cseq(sofia_profile_t *profile); void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua_handle_t *nh, sofia_dispatch_event_t *de, sofia_nat_parse_t *np); void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on); -void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t stack_thread); +void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep); char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool); void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d152a12810..9ebd0ee35f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2230,7 +2230,7 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run_once(switch_thread_t *thread, void if (de) { pool = de->pool; de->pool = NULL; - sofia_process_dispatch_event(&de, SWITCH_FALSE); + sofia_process_dispatch_event(&de); } if (pool) { @@ -2263,7 +2263,7 @@ void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep) switch_thread_pool_launch_thread(&td); } -void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t stack_thread) +void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) { sofia_dispatch_event_t *de = *dep; nua_handle_t *nh = de->nh; @@ -2282,15 +2282,9 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep, switch_bool_t st profile->queued_events--; switch_mutex_unlock(profile->flag_mutex); - if (stack_thread) { - /* Safe to unref directly */ - if (nh) nua_handle_unref(nh); - nua_unref(nua); - } else { - /* This is not a stack thread, need to call via stack (_user) using events */ - if (nh) nua_handle_unref_user(nh); - nua_unref_user(nua); - } + /* This is not a stack thread, need to call via stack (_user) using events */ + if (nh) nua_handle_unref_user(nh); + nua_unref_user(nua); } @@ -2327,7 +2321,7 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run(switch_thread_t *thread, void *obj if (pop) { sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) pop; - sofia_process_dispatch_event(&de, SWITCH_FALSE); + sofia_process_dispatch_event(&de); } else { break; } @@ -2382,7 +2376,7 @@ void sofia_queue_message(sofia_dispatch_event_t *de) if (mod_sofia_globals.running == 0 || !mod_sofia_globals.msg_queue) { /* Calling with SWITCH_TRUE as we are sure this is the stack's thread */ - sofia_process_dispatch_event(&de, SWITCH_TRUE); + sofia_process_dispatch_event(&de); return; } From 9b91e82fa8fa0c11eee2c7ce03f14be7eb47816c Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 15 Jun 2021 20:51:03 +0300 Subject: [PATCH 120/655] Bump sofia-sip library requirement to version 1.13.4 --- configure.ac | 2 +- debian/bootstrap.sh | 2 +- freeswitch.spec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 73c260f311..ccbf0ed3e1 100644 --- a/configure.ac +++ b/configure.ac @@ -725,7 +725,7 @@ PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[ AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent]) ]) -PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.3],[ +PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.4],[ AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[ AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent]) ]) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 594e7adb7c..53db0f9499 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -332,7 +332,7 @@ Build-Depends: uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev, # used by many modules libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, - bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.3), + bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.4), libspandsp3-dev, # used to format the private freeswitch apt-repo key properly gnupg, diff --git a/freeswitch.spec b/freeswitch.spec index 9e5f368fe6..c9c7a447f3 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -140,7 +140,7 @@ BuildRequires: curl-devel >= 7.19 BuildRequires: gcc-c++ BuildRequires: libtool >= 1.5.17 BuildRequires: openssl-devel >= 1.0.1e -BuildRequires: sofia-sip-devel >= 1.13.3 +BuildRequires: sofia-sip-devel >= 1.13.4 BuildRequires: spandsp3-devel >= 3.0 BuildRequires: pcre-devel BuildRequires: speex-devel From 65d0665a95daf1b030d8dc24d5838305403a2c57 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 16 Jun 2021 11:18:15 +0300 Subject: [PATCH 121/655] [mod_sofia] Calling direct _unref() functions in sofia_event_callback() is unsafe. --- src/mod/endpoints/mod_sofia/sofia.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9ebd0ee35f..70ed479ab5 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2581,8 +2581,8 @@ void sofia_event_callback(nua_event_t event, profile->queued_events--; switch_mutex_unlock(profile->flag_mutex); - nua_handle_unref(nh); - nua_unref(nua); + nua_handle_unref_user(nh); + nua_unref_user(nua); goto end; } @@ -2619,8 +2619,8 @@ void sofia_event_callback(nua_event_t event, profile->queued_events--; switch_mutex_unlock(profile->flag_mutex); - nua_handle_unref(nh); - nua_unref(nua); + nua_handle_unref_user(nh); + nua_unref_user(nua); goto end; } From f275f416b399afb443087916e9e1ad8097ca9513 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 25 Jun 2021 00:26:51 +0300 Subject: [PATCH 122/655] [FreeSwitchConsole] Fix build with Visual Studio 2022 --- w32/Console/FreeSwitchConsole.2017.vcxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/w32/Console/FreeSwitchConsole.2017.vcxproj b/w32/Console/FreeSwitchConsole.2017.vcxproj index 5e29a6f52d..5f636c96b3 100644 --- a/w32/Console/FreeSwitchConsole.2017.vcxproj +++ b/w32/Console/FreeSwitchConsole.2017.vcxproj @@ -99,7 +99,7 @@ true ProgramDatabase true - 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + 28251;6031;6340;6246;6011;6387;%(DisableSpecificWarnings) $(OutDir);%(AdditionalLibraryDirectories) @@ -129,7 +129,7 @@ true ProgramDatabase true - 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + 28251;6031;6340;6246;6011;6387;%(DisableSpecificWarnings) $(OutDir);%(AdditionalLibraryDirectories) @@ -152,7 +152,7 @@ Level4 true ProgramDatabase - 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + 28251;6031;6340;6246;6011;6387;%(DisableSpecificWarnings) $(OutDir);%(AdditionalLibraryDirectories) @@ -180,7 +180,7 @@ Level4 true ProgramDatabase - 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + 28251;6031;6340;6246;6011;6387;%(DisableSpecificWarnings) $(OutDir);%(AdditionalLibraryDirectories) From f6f3f38d252511dd6203cec2fc561cf2e8c7834d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 9 Jul 2021 14:52:00 +0300 Subject: [PATCH 123/655] [Core] Fix bridge_early_media --- src/switch_ivr_originate.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index d81ffcc357..9785d0b7aa 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -124,6 +124,7 @@ typedef struct { uint8_t early_media; uint8_t answered; uint8_t tagged; + uint8_t array_pos; uint32_t per_channel_timelimit_sec; uint32_t per_channel_progress_timelimit_sec; uint32_t per_channel_delay_start; @@ -1862,7 +1863,8 @@ typedef struct early_state early_state_t; static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *obj) { early_state_t *state = (early_state_t *) obj; - //originate_status_t originate_status[MAX_PEERS] = { {0} }; + originate_status_t originate_status[MAX_PEERS] = { {0} }; + uint8_t array_pos = 0; int16_t mux_data[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 }; int32_t sample; switch_codec_t read_codecs[MAX_PEERS] = { {0} }; @@ -1873,9 +1875,8 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * switch_frame_t *read_frame = NULL; switch_codec_implementation_t read_impl = { 0 }; -#if 0 for (i = 0; i < MAX_PEERS && i < state->ttl; i++) { - switch_core_session_t *session = state->originate_status[i].peer_session; + switch_core_session_t *session = state->oglobals->originate_status[i].peer_session; switch_channel_t *channel = NULL; if (session) channel = switch_core_session_get_channel(session); @@ -1885,11 +1886,12 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * } if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) { - originate_status[i].peer_session = session; - originate_status[i].peer_channel = channel; + originate_status[array_pos].peer_session = session; + originate_status[array_pos].peer_channel = channel; + originate_status[array_pos].array_pos = (uint8_t) i; + array_pos++; } } -#endif if (state->oglobals->session) { switch_core_session_get_read_impl(state->oglobals->session, &read_impl); @@ -1901,9 +1903,10 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * ready = 0; answered = 0; - for (i = 0; i < MAX_PEERS && i < state->ttl; i++) { - switch_core_session_t *session = state->oglobals->originate_status[i].peer_session; - switch_channel_t *channel = state->oglobals->originate_status[i].peer_channel; + for (array_pos = 0; array_pos < MAX_PEERS && originate_status[array_pos].peer_session; array_pos++) { + switch_core_session_t *session = originate_status[array_pos].peer_session; + switch_channel_t *channel = originate_status[array_pos].peer_channel; + i = originate_status[array_pos].array_pos; if (!session || !channel || !switch_channel_up(channel)) { continue; @@ -1981,9 +1984,10 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * } - for (i = 0; i < MAX_PEERS && i < state->ttl; i++) { - switch_core_session_t *session = state->oglobals->originate_status[i].peer_session; - switch_channel_t *channel = state->oglobals->originate_status[i].peer_channel; + for (array_pos = 0; array_pos < MAX_PEERS && originate_status[array_pos].peer_session; array_pos++) { + switch_core_session_t *session = originate_status[array_pos].peer_session; + switch_channel_t *channel = originate_status[array_pos].peer_channel; + i = originate_status[array_pos].array_pos; if (!session) continue; From d03100661e0d73fad1986de5ed2ab1a5c8d520ef Mon Sep 17 00:00:00 2001 From: bmlkc Date: Fri, 9 Jul 2021 20:44:43 +0200 Subject: [PATCH 124/655] [mod_opusfile] not draining before destroying encoder causes loss on encoded file --- src/mod/formats/mod_opusfile/mod_opusfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/formats/mod_opusfile/mod_opusfile.c b/src/mod/formats/mod_opusfile/mod_opusfile.c index 25246a7ced..ae6eebed15 100644 --- a/src/mod/formats/mod_opusfile/mod_opusfile.c +++ b/src/mod/formats/mod_opusfile/mod_opusfile.c @@ -316,6 +316,7 @@ static switch_status_t switch_opusfile_close(switch_file_handle_t *handle) } #ifdef HAVE_OPUSFILE_ENCODE if (context->enc) { + ope_encoder_drain(context->enc); ope_encoder_destroy(context->enc); } if (context->comments) { From a4d09d26359d15ed3b6831b37200204d0b647472 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 14 Jul 2021 19:03:58 +0300 Subject: [PATCH 125/655] [Testing] Update Drone CI signature. --- .drone.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.drone.yml b/.drone.yml index 45cbab5880..d8b61ec59b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -5,14 +5,14 @@ name: unit-tests steps: - name: bootstrap image: signalwire/freeswitch-public-base - pull: true + pull: always commands: - cat /proc/sys/kernel/core_pattern - ./bootstrap.sh -j - name: configure image: signalwire/freeswitch-public-base - pull: true + pull: always commands: - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev @@ -27,7 +27,7 @@ steps: - name: build image: signalwire/freeswitch-public-base - pull: true + pull: always commands: - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev @@ -37,7 +37,7 @@ steps: - name: run-tests image: signalwire/freeswitch-public-base - pull: true + pull: always commands: - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev @@ -53,7 +53,7 @@ steps: - name: notify image: signalwire/drone-notify - pull: true + pull: always environment: SLACK_WEBHOOK_URL: from_secret: slack_webhook_url @@ -76,13 +76,13 @@ name: scan-build steps: - name: bootstrap image: signalwire/freeswitch-public-base:stretch - pull: true + pull: always commands: - ./bootstrap.sh -j - name: configure image: signalwire/freeswitch-public-base:stretch - pull: true + pull: always commands: - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev @@ -113,7 +113,7 @@ steps: - name: scan-build image: signalwire/freeswitch-public-base:stretch - pull: true + pull: always commands: - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev @@ -126,7 +126,7 @@ steps: - name: notify image: signalwire/drone-notify - pull: true + pull: always environment: SLACK_WEBHOOK_URL: from_secret: slack_webhook_url @@ -145,6 +145,6 @@ trigger: --- kind: signature -hmac: af77439b382612b49140cb95f04d6d695e0a188c411ae227abcba205bf96bab9 +hmac: bc24832140c40a8fde4bb04bd6bcce43029bf1641ed4acc3585fe52049ae24dc ... From 9aee9b8e24b1106973e62f58b78100fb34e5acc0 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 6 Feb 2021 00:38:51 +0300 Subject: [PATCH 126/655] [Core, mod_commands] Add posix_spawn replacement for the system call. Add unit-tests. --- src/include/switch_core.h | 2 + src/mod/applications/mod_commands/Makefile.am | 7 + .../applications/mod_commands/mod_commands.c | 50 +++++ .../applications/mod_commands/test/.gitignore | 5 + .../mod_commands/test/conf/freeswitch.xml | 37 ++++ .../mod_commands/test/test_mod_commands.c | 72 +++++++ src/switch_core.c | 200 ++++++++++++++++-- tests/unit/switch_core.c | 34 +++ 8 files changed, 392 insertions(+), 15 deletions(-) create mode 100644 src/mod/applications/mod_commands/test/.gitignore create mode 100644 src/mod/applications/mod_commands/test/conf/freeswitch.xml create mode 100644 src/mod/applications/mod_commands/test/test_mod_commands.c diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 6299e09c52..e2dfa57afc 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2842,6 +2842,8 @@ SWITCH_DECLARE(int) switch_system(const char *cmd, switch_bool_t wait); SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_handle_t *stream); SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream); +SWITCH_DECLARE(int) switch_spawn(const char *cmd, switch_bool_t wait); +SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, switch_stream_handle_t *stream); SWITCH_DECLARE(void) switch_core_session_debug_pool(switch_stream_handle_t *stream); diff --git a/src/mod/applications/mod_commands/Makefile.am b/src/mod/applications/mod_commands/Makefile.am index 82cfe69a4d..60d4aa13bd 100644 --- a/src/mod/applications/mod_commands/Makefile.am +++ b/src/mod/applications/mod_commands/Makefile.am @@ -6,3 +6,10 @@ mod_commands_la_SOURCES = mod_commands.c mod_commands_la_CFLAGS = $(AM_CFLAGS) mod_commands_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_commands_la_LDFLAGS = -avoid-version -module -no-undefined -shared + +noinst_PROGRAMS = test/test_mod_commands +test_test_mod_commands_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" +test_test_mod_commands_LDFLAGS = -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) +test_test_mod_commands_LDADD = mod_commands.la $(switch_builddir)/libfreeswitch.la + +TESTS = $(noinst_PROGRAMS) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 37eda79929..6c36d26d2a 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -6522,6 +6522,53 @@ SWITCH_STANDARD_API(bg_system_function) return SWITCH_STATUS_SUCCESS; } +#define SPAWN_SYNTAX "" +SWITCH_STANDARD_API(spawn_stream_function) +{ + if (zstr(cmd)) { + stream->write_function(stream, "-USAGE: %s\n", SPAWN_SYNTAX); + return SWITCH_STATUS_SUCCESS; + } + + if (switch_stream_spawn(cmd, SWITCH_TRUE, stream) < 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd); + } + + return SWITCH_STATUS_SUCCESS; +} + +#define SPAWN_SYNTAX "" +SWITCH_STANDARD_API(spawn_function) +{ + if (zstr(cmd)) { + stream->write_function(stream, "-USAGE: %s\n", SPAWN_SYNTAX); + return SWITCH_STATUS_SUCCESS; + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Executing command: %s\n", cmd); + if (switch_spawn(cmd, SWITCH_TRUE) < 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd); + } + stream->write_function(stream, "+OK\n"); + return SWITCH_STATUS_SUCCESS; +} + +#define SPAWN_SYNTAX "" +SWITCH_STANDARD_API(bg_spawn_function) +{ + if (zstr(cmd)) { + stream->write_function(stream, "-USAGE: %s\n", SPAWN_SYNTAX); + return SWITCH_STATUS_SUCCESS; + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Executing command: %s\n", cmd); + if (switch_spawn(cmd, SWITCH_FALSE) < 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd); + } + stream->write_function(stream, "+OK\n"); + return SWITCH_STATUS_SUCCESS; +} + SWITCH_STANDARD_API(strftime_tz_api_function) { char *format = NULL; @@ -7456,6 +7503,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) if (use_system_commands) { SWITCH_ADD_API(commands_api_interface, "bg_system", "Execute a system command in the background", bg_system_function, SYSTEM_SYNTAX); SWITCH_ADD_API(commands_api_interface, "system", "Execute a system command", system_function, SYSTEM_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "bg_spawn", "Execute a spawn command in the background", bg_spawn_function, SPAWN_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "spawn", "Execute a spawn command without capturing it's output", spawn_function, SPAWN_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "spawn_stream", "Execute a spawn command and capture it's output", spawn_stream_function, SPAWN_SYNTAX); } SWITCH_ADD_API(commands_api_interface, "acl", "Compare an ip to an acl list", acl_function, " "); diff --git a/src/mod/applications/mod_commands/test/.gitignore b/src/mod/applications/mod_commands/test/.gitignore new file mode 100644 index 0000000000..b752c84499 --- /dev/null +++ b/src/mod/applications/mod_commands/test/.gitignore @@ -0,0 +1,5 @@ +.dirstamp +.libs/ +.deps/ +test_mod_commands*.o +test_mod_commands diff --git a/src/mod/applications/mod_commands/test/conf/freeswitch.xml b/src/mod/applications/mod_commands/test/conf/freeswitch.xml new file mode 100644 index 0000000000..9369d4e918 --- /dev/null +++ b/src/mod/applications/mod_commands/test/conf/freeswitch.xml @@ -0,0 +1,37 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+
diff --git a/src/mod/applications/mod_commands/test/test_mod_commands.c b/src/mod/applications/mod_commands/test/test_mod_commands.c new file mode 100644 index 0000000000..d12535e430 --- /dev/null +++ b/src/mod/applications/mod_commands/test/test_mod_commands.c @@ -0,0 +1,72 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2018, 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 + * Andrey Volk + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Andrey Volk + * + * mod_commands_test -- mod_commands tests + * + */ + +#include + +FST_CORE_BEGIN("conf") +{ + FST_MODULE_BEGIN(mod_commands, mod_commands_test) + { + FST_SETUP_BEGIN() + { + } + FST_SETUP_END() + + FST_TEST_BEGIN(spawn_test) + { +#ifdef __linux__ + switch_stream_handle_t stream = { 0 }; + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("bg_spawn", "echo TEST_BG_SPAWN", NULL, &stream); + fst_check_string_equals(stream.data, "+OK\n"); + switch_safe_free(stream.data); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("spawn_stream", "echo DEADBEEF", NULL, &stream); + fst_check_string_equals(stream.data, "DEADBEEF\n"); + switch_safe_free(stream.data); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("spawn", "echo TEST_NO_OUTPUT", NULL, &stream); + fst_check_string_equals(stream.data, "+OK\n"); + switch_safe_free(stream.data); +#endif + } + FST_TEST_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + } + FST_MODULE_END() +} +FST_CORE_END() diff --git a/src/switch_core.c b/src/switch_core.c index d4507aa49c..617b623753 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -59,6 +59,15 @@ #include #endif +#ifdef __linux__ +#include +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* Required for POSIX_SPAWN_USEVFORK */ +#endif +#include +#include +#endif + #ifdef WIN32 #define popen _popen #define pclose _pclose @@ -2282,6 +2291,17 @@ static void switch_load_core_config(const char *file) } else { switch_clear_flag((&runtime), SCF_THREADED_SYSTEM_EXEC); } +#endif + } else if (!strcasecmp(var, "spawn-instead-of-system") && !zstr(val)) { +#ifdef WIN32 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "spawn-instead-of-system is not implemented on this platform\n"); +#else + int v = switch_true(val); + if (v) { + switch_core_set_variable("spawn_instead_of_system", "true"); + } else { + switch_core_set_variable("spawn_instead_of_system", "false"); + } #endif } else if (!strcasecmp(var, "min-idle-cpu") && !zstr(val)) { switch_core_min_idle_cpu(atof(val)); @@ -3341,9 +3361,14 @@ static int switch_system_fork(const char *cmd, switch_bool_t wait) SWITCH_DECLARE(int) switch_system(const char *cmd, switch_bool_t wait) { +#ifdef __linux__ + switch_bool_t spawn_instead_of_system = switch_true(switch_core_get_variable("spawn_instead_of_system")); +#else + switch_bool_t spawn_instead_of_system = SWITCH_FALSE; +#endif int (*sys_p)(const char *cmd, switch_bool_t wait); - sys_p = switch_test_flag((&runtime), SCF_THREADED_SYSTEM_EXEC) ? switch_system_thread : switch_system_fork; + sys_p = spawn_instead_of_system ? switch_spawn : switch_test_flag((&runtime), SCF_THREADED_SYSTEM_EXEC) ? switch_system_thread : switch_system_fork; return sys_p(cmd, wait); @@ -3356,6 +3381,141 @@ SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_han return switch_stream_system(cmd, stream); } +#ifdef __linux__ +extern char **environ; +#endif + +SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, switch_stream_handle_t *stream) +{ +#ifndef __linux__ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "posix_spawn is unsupported on current platform\n"); + return 1; +#else + int status = 0, rval; + char buffer[1024]; + pid_t pid; + char *pdata = NULL, *argv[64]; + posix_spawn_file_actions_t action; + posix_spawnattr_t *attr; + int cout_pipe[2]; + int cerr_pipe[2]; + struct pollfd pfds[2] = { {0} }; + + if (zstr(cmd)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to execute switch_spawn_stream because of empty command\n"); + return 1; + } + + if (!(pdata = strdup(cmd))) { + return 1; + } + + if (!switch_separate_string(pdata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { + free(pdata); + return 1; + } + + if (!(attr = malloc(sizeof(posix_spawnattr_t)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute switch_spawn_stream because of a memory error: %s\n", cmd); + free(pdata); + return 1; + } + + if (stream) { + if (pipe(cout_pipe)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute switch_spawn_stream because of a pipe error: %s\n", cmd); + free(attr); + free(pdata); + return 1; + } + + if (pipe(cerr_pipe)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute switch_spawn_stream because of a pipe error: %s\n", cmd); + close(cout_pipe[0]); + close(cout_pipe[1]); + free(attr); + free(pdata); + return 1; + } + } + + memset(attr, 0, sizeof(posix_spawnattr_t)); + posix_spawnattr_init(attr); + posix_spawnattr_setflags(attr, POSIX_SPAWN_USEVFORK); + + posix_spawn_file_actions_init(&action); + + if (stream) { + posix_spawn_file_actions_addclose(&action, cout_pipe[0]); + posix_spawn_file_actions_addclose(&action, cerr_pipe[0]); + posix_spawn_file_actions_adddup2(&action, cout_pipe[1], 1); + posix_spawn_file_actions_adddup2(&action, cerr_pipe[1], 2); + + posix_spawn_file_actions_addclose(&action, cout_pipe[1]); + posix_spawn_file_actions_addclose(&action, cerr_pipe[1]); + } + + if (posix_spawnp(&pid, argv[0], &action, attr, argv, environ) != 0) { + status = 1; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to execute posix_spawnp: %s\n", cmd); + if (stream) { + close(cout_pipe[0]), close(cerr_pipe[0]); + close(cout_pipe[1]), close(cerr_pipe[1]); + } + } else { + if (stream) { + close(cout_pipe[1]), close(cerr_pipe[1]); /* close child-side of pipes */ + + pfds[0] = (struct pollfd) { + .fd = cout_pipe[0], + .events = POLLIN, + .revents = 0 + }; + + pfds[1] = (struct pollfd) { + .fd = cerr_pipe[0], + .events = POLLIN, + .revents = 0 + }; + + while ((rval = 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); + } else if (pfds[1].revents & POLLIN) { + int bytes_read = read(cerr_pipe[0], buffer, sizeof(buffer)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "STDERR of cmd (%s): %.*s\n", cmd, bytes_read, buffer); + } else { + break; /* nothing left to read */ + } + } + + close(cout_pipe[0]), close(cerr_pipe[0]); + } + + if (wait) { + if (waitpid(pid, &status, 0) != pid) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "waitpid failed: %s\n", cmd); + } else if (status != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Exit status (%d): %s\n", status, cmd); + } + } + } + + posix_spawnattr_destroy(attr); + free(attr); + posix_spawn_file_actions_destroy(&action); + free(pdata); + + return status; +#endif +} + +SWITCH_DECLARE(int) switch_spawn(const char *cmd, switch_bool_t wait) +{ + return switch_stream_spawn(cmd, wait, NULL); +} + SWITCH_DECLARE(switch_status_t) switch_core_get_stacksizes(switch_size_t *cur, switch_size_t *max) { #ifdef HAVE_SETRLIMIT @@ -3382,26 +3542,36 @@ SWITCH_DECLARE(switch_status_t) switch_core_get_stacksizes(switch_size_t *cur, s SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream) { - char buffer[128]; - size_t bytes; - FILE* pipe = popen(cmd, "r"); - if (!pipe) return 1; +#ifdef __linux__ + switch_bool_t spawn_instead_of_system = switch_true(switch_core_get_variable("spawn_instead_of_system")); +#else + switch_bool_t spawn_instead_of_system = SWITCH_FALSE; +#endif - while (!feof(pipe)) { - while ((bytes = fread(buffer, 1, 128, pipe)) > 0) { - if (stream != NULL) { - stream->raw_write_function(stream, (unsigned char *)buffer, bytes); + if (spawn_instead_of_system){ + return switch_stream_spawn(cmd, SWITCH_TRUE, stream); + } else { + char buffer[128]; + size_t bytes; + FILE* pipe = popen(cmd, "r"); + if (!pipe) return 1; + + while (!feof(pipe)) { + while ((bytes = fread(buffer, 1, 128, pipe)) > 0) { + if (stream != NULL) { + stream->raw_write_function(stream, (unsigned char *)buffer, bytes); + } } } - } - if (ferror(pipe)) { + if (ferror(pipe)) { + pclose(pipe); + return 1; + } + pclose(pipe); - return 1; + return 0; } - - pclose(pipe); - return 0; } SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port() diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index d0d6bacef2..44cfe148bf 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -160,6 +160,40 @@ FST_CORE_BEGIN("./conf") fst_check_int_equals(r, SWITCH_TRUE); } FST_TEST_END() + + FST_TEST_BEGIN(test_switch_spawn) + { +#ifdef __linux__ + int status; + switch_stream_handle_t stream = { 0 }; + + status = switch_spawn("echo CHECKING_BAD_FILE_DESCRIPTOR", SWITCH_TRUE); + fst_check_int_equals(status, 0); + + SWITCH_STANDARD_STREAM(stream); + status = switch_stream_spawn("echo DEADBEEF", SWITCH_TRUE, &stream); + fst_check_int_equals(status, 0); + fst_check_string_equals(stream.data, "DEADBEEF\n"); + switch_safe_free(stream.data); + + SWITCH_STANDARD_STREAM(stream); + status = switch_stream_spawn("echo DEADBEEF", SWITCH_FALSE, &stream); + fst_check_int_equals(status, 0); + fst_check_string_equals(stream.data, "DEADBEEF\n"); + switch_safe_free(stream.data); + + printf("\nExpected warning check ... "); + status = switch_spawn("false", SWITCH_TRUE); + fct_chk_neq_int(status, 0); + + status = switch_spawn("false", SWITCH_FALSE); + fct_chk_eq_int(status, 0); + + status = switch_spawn("true", SWITCH_TRUE); + fct_chk_eq_int(status, 0); +#endif + } + FST_TEST_END() } FST_SUITE_END() } From 311e932df5ac30f7fdb8b31f3579f6a012b964cf Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 9 Feb 2021 13:19:22 -0500 Subject: [PATCH 127/655] [core, mod_commands] Execute command under shell when using spawn in switch_system(). --- src/include/switch_core.h | 2 +- .../applications/mod_commands/mod_commands.c | 2 +- src/switch_core.c | 53 ++++++++++++------- tests/unit/conf/freeswitch.xml | 3 ++ tests/unit/switch_core.c | 53 ++++++++++++++----- 5 files changed, 79 insertions(+), 34 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index e2dfa57afc..4f172a928e 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2843,7 +2843,7 @@ SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_han SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream); SWITCH_DECLARE(int) switch_spawn(const char *cmd, switch_bool_t wait); -SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, switch_stream_handle_t *stream); +SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t shell, switch_bool_t wait, switch_stream_handle_t *stream); SWITCH_DECLARE(void) switch_core_session_debug_pool(switch_stream_handle_t *stream); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 6c36d26d2a..ad5bd51ce9 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -6530,7 +6530,7 @@ SWITCH_STANDARD_API(spawn_stream_function) return SWITCH_STATUS_SUCCESS; } - if (switch_stream_spawn(cmd, SWITCH_TRUE, stream) < 0) { + if (switch_stream_spawn(cmd, SWITCH_FALSE, SWITCH_TRUE, stream) < 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd); } diff --git a/src/switch_core.c b/src/switch_core.c index 617b623753..2589d276a4 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -3361,17 +3361,21 @@ static int switch_system_fork(const char *cmd, switch_bool_t wait) SWITCH_DECLARE(int) switch_system(const char *cmd, switch_bool_t wait) { + int retval = 0; #ifdef __linux__ switch_bool_t spawn_instead_of_system = switch_true(switch_core_get_variable("spawn_instead_of_system")); #else switch_bool_t spawn_instead_of_system = SWITCH_FALSE; #endif - int (*sys_p)(const char *cmd, switch_bool_t wait); - - sys_p = spawn_instead_of_system ? switch_spawn : switch_test_flag((&runtime), SCF_THREADED_SYSTEM_EXEC) ? switch_system_thread : switch_system_fork; - - return sys_p(cmd, wait); - + + if (spawn_instead_of_system) { + retval = switch_stream_spawn(cmd, SWITCH_TRUE, wait, NULL); + } else if (switch_test_flag((&runtime), SCF_THREADED_SYSTEM_EXEC)) { + retval = switch_system_thread(cmd, wait); + } else { + retval = switch_system_fork(cmd, wait); + } + return retval; } @@ -3385,7 +3389,7 @@ SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_han extern char **environ; #endif -SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, switch_stream_handle_t *stream) +SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t shell, switch_bool_t wait, switch_stream_handle_t *stream) { #ifndef __linux__ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "posix_spawn is unsupported on current platform\n"); @@ -3406,18 +3410,27 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, swi return 1; } - if (!(pdata = strdup(cmd))) { - return 1; - } - - if (!switch_separate_string(pdata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { - free(pdata); - return 1; + if (shell) { + argv[0] = switch_core_get_variable("spawn_system_shell"); + argv[1] = "-c"; + argv[2] = (char *)cmd; + argv[3] = NULL; + if (zstr(argv[0])) { + argv[0] = "/bin/sh"; + } + } else { + if (!(pdata = strdup(cmd))) { + return 1; + } + if (!switch_separate_string(pdata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { + free(pdata); + return 1; + } } if (!(attr = malloc(sizeof(posix_spawnattr_t)))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute switch_spawn_stream because of a memory error: %s\n", cmd); - free(pdata); + switch_safe_free(pdata); return 1; } @@ -3425,7 +3438,7 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, swi if (pipe(cout_pipe)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute switch_spawn_stream because of a pipe error: %s\n", cmd); free(attr); - free(pdata); + switch_safe_free(pdata); return 1; } @@ -3434,7 +3447,7 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, swi close(cout_pipe[0]); close(cout_pipe[1]); free(attr); - free(pdata); + switch_safe_free(pdata); return 1; } } @@ -3505,7 +3518,7 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, swi posix_spawnattr_destroy(attr); free(attr); posix_spawn_file_actions_destroy(&action); - free(pdata); + switch_safe_free(pdata); return status; #endif @@ -3513,7 +3526,7 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t wait, swi SWITCH_DECLARE(int) switch_spawn(const char *cmd, switch_bool_t wait) { - return switch_stream_spawn(cmd, wait, NULL); + return switch_stream_spawn(cmd, SWITCH_FALSE, wait, NULL); } SWITCH_DECLARE(switch_status_t) switch_core_get_stacksizes(switch_size_t *cur, switch_size_t *max) @@ -3549,7 +3562,7 @@ SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t #endif if (spawn_instead_of_system){ - return switch_stream_spawn(cmd, SWITCH_TRUE, stream); + return switch_stream_spawn(cmd, SWITCH_TRUE, SWITCH_TRUE, stream); } else { char buffer[128]; size_t bytes; diff --git a/tests/unit/conf/freeswitch.xml b/tests/unit/conf/freeswitch.xml index 578a4fe2b7..3dcb33198b 100644 --- a/tests/unit/conf/freeswitch.xml +++ b/tests/unit/conf/freeswitch.xml @@ -1,6 +1,9 @@ + + +
diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index 44cfe148bf..bba7272cac 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -40,10 +40,11 @@ FST_CORE_BEGIN("./conf") { - FST_SUITE_BEGIN(switch_ivr_originate) + FST_SUITE_BEGIN(switch_core) { FST_SETUP_BEGIN() { + switch_core_set_variable("spawn_instead_of_system", "false"); } FST_SETUP_END() @@ -101,17 +102,17 @@ FST_CORE_BEGIN("./conf") #ifndef WIN32 FST_TEST_BEGIN(test_fork) { - switch_stream_handle_t exec_result = { 0 }; - SWITCH_STANDARD_STREAM(exec_result); - fst_requires(switch_stream_system_fork("ip ad sh", &exec_result) == 0); - fst_requires(!zstr(exec_result.data)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", (char *)exec_result.data); + switch_stream_handle_t exec_result = { 0 }; + SWITCH_STANDARD_STREAM(exec_result); + fst_requires(switch_stream_system_fork("ip ad sh", &exec_result) == 0); + fst_requires(!zstr(exec_result.data)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", (char *)exec_result.data); - fst_requires(switch_stream_system_fork("ip ad sh | grep link", &exec_result) == 0); - fst_requires(!zstr(exec_result.data)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", (char *)exec_result.data); + fst_requires(switch_stream_system_fork("ip ad sh | grep link", &exec_result) == 0); + fst_requires(!zstr(exec_result.data)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", (char *)exec_result.data); - switch_safe_free(exec_result.data); + switch_safe_free(exec_result.data); } FST_TEST_END() #endif @@ -171,13 +172,13 @@ FST_CORE_BEGIN("./conf") fst_check_int_equals(status, 0); SWITCH_STANDARD_STREAM(stream); - status = switch_stream_spawn("echo DEADBEEF", SWITCH_TRUE, &stream); + status = switch_stream_spawn("echo DEADBEEF", SWITCH_FALSE, SWITCH_TRUE, &stream); fst_check_int_equals(status, 0); fst_check_string_equals(stream.data, "DEADBEEF\n"); switch_safe_free(stream.data); SWITCH_STANDARD_STREAM(stream); - status = switch_stream_spawn("echo DEADBEEF", SWITCH_FALSE, &stream); + status = switch_stream_spawn("echo DEADBEEF", SWITCH_FALSE, SWITCH_FALSE, &stream); fst_check_int_equals(status, 0); fst_check_string_equals(stream.data, "DEADBEEF\n"); switch_safe_free(stream.data); @@ -191,6 +192,34 @@ FST_CORE_BEGIN("./conf") status = switch_spawn("true", SWITCH_TRUE); fct_chk_eq_int(status, 0); +#endif + } + FST_TEST_END() + + FST_TEST_BEGIN(test_switch_spawn_instead_of_system) + { +#ifdef __linux__ + int status; + char file_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; + const char *filename = NULL; + const char *cmd = NULL; + + // tell FS core to use posix_spawn() instead of popen() and friends + switch_core_set_variable("spawn_instead_of_system", "true"); + + // echo text to a file using shell redirection- this will ensure the command was executed in a shell, as expected + switch_uuid_str(file_uuid, sizeof(file_uuid)); + filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "%s", SWITCH_GLOBAL_dirs.temp_dir, file_uuid); + cmd = switch_core_sprintf(fst_pool, "echo test_switch_spawn_instead_of_system with spaces > %s", filename); + status = switch_system(cmd, SWITCH_TRUE); + + fst_check_int_equals(status, 0); + fst_xcheck(status == 0, "Expect switch_system() command to return 0"); + fst_xcheck(switch_file_exists(filename, fst_pool) == SWITCH_STATUS_SUCCESS, "Expect switch_system() to use shell to create file via > redirection"); + unlink(filename); + + // verify exec-set works- see conf/freeswitch.xml for test setup of shell_exec_set_test global variable + fst_check_string_equals(switch_core_get_variable("shell_exec_set_test"), "usr"); #endif } FST_TEST_END() From ba8aff571e5d61c63bf7e28ae8b73836c7b8b402 Mon Sep 17 00:00:00 2001 From: nrensen Date: Mon, 19 Jul 2021 23:57:13 +0800 Subject: [PATCH 128/655] [mod_commands] OpenBSD compat --- src/mod/applications/mod_commands/Makefile.am | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_commands/Makefile.am b/src/mod/applications/mod_commands/Makefile.am index 60d4aa13bd..18d5832063 100644 --- a/src/mod/applications/mod_commands/Makefile.am +++ b/src/mod/applications/mod_commands/Makefile.am @@ -7,9 +7,13 @@ mod_commands_la_CFLAGS = $(AM_CFLAGS) mod_commands_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_commands_la_LDFLAGS = -avoid-version -module -no-undefined -shared +noinst_LTLIBRARIES = libmodcommands.la +libmodcommands_la_SOURCES = $(mod_commands_la_SOURCES) +libmodcommands_la_CFLAGS = $(mod_commands_la_CFLAGS) + noinst_PROGRAMS = test/test_mod_commands test_test_mod_commands_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" test_test_mod_commands_LDFLAGS = -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) -test_test_mod_commands_LDADD = mod_commands.la $(switch_builddir)/libfreeswitch.la +test_test_mod_commands_LDADD = libmodcommands.la $(switch_builddir)/libfreeswitch.la TESTS = $(noinst_PROGRAMS) From 1311a84ee20fe6e476bc2848faccbdd08c65ebbd Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 20 Jul 2021 20:39:58 +0300 Subject: [PATCH 129/655] [mod_signalwire] When SignalWire SIP Gateway is in unregistered state it's DOWN and can not be NOREG. --- src/mod/applications/mod_signalwire/mod_signalwire.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_signalwire/mod_signalwire.c b/src/mod/applications/mod_signalwire/mod_signalwire.c index 15e0672984..445de3744b 100644 --- a/src/mod/applications/mod_signalwire/mod_signalwire.c +++ b/src/mod/applications/mod_signalwire/mod_signalwire.c @@ -869,7 +869,7 @@ static void on_sofia_gateway_state(switch_event_t *event) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SignalWire SIP Gateway registered to %s:%s\n", ip, port); switch_set_string(globals.gateway_ip, ip); switch_set_string(globals.gateway_port, port); - } else if (!strcmp(state, "NOREG")) { + } else if (!strcmp(state, "DOWN")) { globals.gateway_ip[0] = '\0'; globals.gateway_port[0] = '\0'; } From f631ac800c1a697806f4898a6c97fcc499ba5b17 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 24 May 2021 17:17:28 +0300 Subject: [PATCH 130/655] [Unit-tests] Build sofia-sip on the fly on Drone CI so backtraces are more informative in ASAN reports. --- .drone.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.drone.yml b/.drone.yml index d8b61ec59b..d7bcb8a7d9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,8 +14,10 @@ steps: image: signalwire/freeswitch-public-base pull: always commands: - - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev + - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libsofia-sip-ua0 libspandsp-dev + - DEBIAN_FRONTEND=noninteractive apt-get -yq install libspandsp3-dev + - git clone https://github.com/freeswitch/sofia-sip.git + - cd sofia-sip && ./autogen.sh && ./configure.gnu && make -j`nproc` && make install && cd .. - echo "applications/mod_test" >> modules.conf - echo 'codecs/mod_openh264' >> modules.conf - sed -i '/applications\\/mod_http_cache/s/^#//g' modules.conf @@ -29,8 +31,9 @@ steps: image: signalwire/freeswitch-public-base pull: always commands: - - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev + - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libsofia-sip-ua0 libspandsp-dev + - DEBIAN_FRONTEND=noninteractive apt-get -yq install libspandsp3-dev + - cd sofia-sip && make install && cd .. - echo '#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./build-status.txt\n' > build.sh - chmod +x build.sh - ./build.sh @@ -39,8 +42,9 @@ steps: image: signalwire/freeswitch-public-base pull: always commands: - - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev + - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libsofia-sip-ua0 libspandsp-dev + - DEBIAN_FRONTEND=noninteractive apt-get -yq install libspandsp3-dev + - cd sofia-sip && make install && cd .. - make install || true - cd tests/unit - ./run-tests.sh @@ -61,7 +65,7 @@ steps: from_secret: notify_env commands: - /root/unit-tests-notify.sh - + trigger: branch: - master @@ -135,7 +139,6 @@ steps: commands: - /root/scan-build-notify.sh - trigger: branch: - master @@ -145,6 +148,6 @@ trigger: --- kind: signature -hmac: bc24832140c40a8fde4bb04bd6bcce43029bf1641ed4acc3585fe52049ae24dc +hmac: 5d5cfb225053294d7cf1a4fed88eaf9a3a53c99a7bad4dc7164eece336c8861a ... From dd1e0c160555e50774395fa7350dd851c3146b05 Mon Sep 17 00:00:00 2001 From: tomeeo Date: Fri, 23 Jul 2021 17:04:59 -0400 Subject: [PATCH 131/655] [mod_http_cache] Fix the query string not included for HTTP PUT requests to s3 --- src/mod/applications/mod_http_cache/aws.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_http_cache/aws.c b/src/mod/applications/mod_http_cache/aws.c index cc02b4e5b5..264756eda7 100644 --- a/src/mod/applications/mod_http_cache/aws.c +++ b/src/mod/applications/mod_http_cache/aws.c @@ -47,7 +47,7 @@ */ static char *hmac256(char* buffer, unsigned int buffer_length, const char* key, unsigned int key_length, const char* message) { - if (zstr(key) || zstr(message) || buffer_length < SHA256_DIGEST_LENGTH) { + if (!key || zstr(message) || buffer_length < SHA256_DIGEST_LENGTH) { return NULL; } From 73571bf9c6b66f3a18838e25e8506e0e63e50327 Mon Sep 17 00:00:00 2001 From: Mario G Date: Mon, 5 Jul 2021 14:46:00 -0700 Subject: [PATCH 132/655] [libvpx] configure: macos release independence for sse --- libs/libvpx/build/make/configure.sh | 96 +++-------------------------- libs/libvpx/configure | 27 +------- 2 files changed, 9 insertions(+), 114 deletions(-) diff --git a/libs/libvpx/build/make/configure.sh b/libs/libvpx/build/make/configure.sh index 1b52c053c1..728c3e2568 100644 --- a/libs/libvpx/build/make/configure.sh +++ b/libs/libvpx/build/make/configure.sh @@ -767,49 +767,9 @@ process_common_toolchain() { # detect tgt_os case "$gcctarget" in - *darwin10*) + *darwin*) tgt_isa=x86_64 - tgt_os=darwin10 - ;; - *darwin11*) - tgt_isa=x86_64 - tgt_os=darwin11 - ;; - *darwin12*) - tgt_isa=x86_64 - tgt_os=darwin12 - ;; - *darwin13*) - tgt_isa=x86_64 - tgt_os=darwin13 - ;; - *darwin14*) - tgt_isa=x86_64 - tgt_os=darwin14 - ;; - *darwin15*) - tgt_isa=x86_64 - tgt_os=darwin15 - ;; - *darwin16*) - tgt_isa=x86_64 - tgt_os=darwin16 - ;; - *darwin17*) - tgt_isa=x86_64 - tgt_os=darwin17 - ;; - *darwin18*) - tgt_isa=x86_64 - tgt_os=darwin18 - ;; - *darwin19*) - tgt_isa=x86_64 - tgt_os=darwin19 - ;; - *darwin20*) - tgt_isa=x86_64 - tgt_os=darwin20 + tgt_os=darwin ;; x86_64*mingw32*) tgt_os=win64 @@ -903,53 +863,11 @@ process_common_toolchain() { esac case ${toolchain} in - *-darwin8-*) - add_cflags "-mmacosx-version-min=10.4" - add_ldflags "-mmacosx-version-min=10.4" - ;; - *-darwin9-*) - add_cflags "-mmacosx-version-min=10.5" - add_ldflags "-mmacosx-version-min=10.5" - ;; - *-darwin10-*) - add_cflags "-mmacosx-version-min=10.6" - add_ldflags "-mmacosx-version-min=10.6" - ;; - *-darwin11-*) - add_cflags "-mmacosx-version-min=10.7" - add_ldflags "-mmacosx-version-min=10.7" - ;; - *-darwin12-*) - add_cflags "-mmacosx-version-min=10.8" - add_ldflags "-mmacosx-version-min=10.8" - ;; - *-darwin13-*) - add_cflags "-mmacosx-version-min=10.9" - add_ldflags "-mmacosx-version-min=10.9" - ;; - *-darwin14-*) - add_cflags "-mmacosx-version-min=10.10" - add_ldflags "-mmacosx-version-min=10.10" - ;; - *-darwin15-*) - add_cflags "-mmacosx-version-min=10.11" - add_ldflags "-mmacosx-version-min=10.11" - ;; - *-darwin16-*) - add_cflags "-mmacosx-version-min=10.12" - add_ldflags "-mmacosx-version-min=10.12" - ;; - *-darwin17-*) - add_cflags "-mmacosx-version-min=10.13" - add_ldflags "-mmacosx-version-min=10.13" - ;; - *-darwin18-*) - add_cflags "-mmacosx-version-min=10.14" - add_ldflags "-mmacosx-version-min=10.14" - ;; - *-darwin19-*) - add_cflags "-mmacosx-version-min=10.15" - add_ldflags "-mmacosx-version-min=10.15" + *-darwin-*) + mvmin=$(sw_vers -productVersion) + mvmin="-mmacosx-version-min="${mvmin%.*} + add_cflags $mvmin + add_ldflags $mvmin ;; *-iphonesimulator-*) add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}" diff --git a/libs/libvpx/configure b/libs/libvpx/configure index 731bcb5bc8..354f03d525 100755 --- a/libs/libvpx/configure +++ b/libs/libvpx/configure @@ -117,19 +117,7 @@ all_platforms="${all_platforms} mips64-linux-gcc" all_platforms="${all_platforms} ppc64le-linux-gcc" all_platforms="${all_platforms} sparc-solaris-gcc" all_platforms="${all_platforms} x86-android-gcc" -all_platforms="${all_platforms} x86-darwin8-gcc" -all_platforms="${all_platforms} x86-darwin8-icc" -all_platforms="${all_platforms} x86-darwin9-gcc" -all_platforms="${all_platforms} x86-darwin9-icc" -all_platforms="${all_platforms} x86-darwin10-gcc" -all_platforms="${all_platforms} x86-darwin11-gcc" -all_platforms="${all_platforms} x86-darwin12-gcc" -all_platforms="${all_platforms} x86-darwin13-gcc" -all_platforms="${all_platforms} x86-darwin14-gcc" -all_platforms="${all_platforms} x86-darwin15-gcc" -all_platforms="${all_platforms} x86-darwin16-gcc" -all_platforms="${all_platforms} x86-darwin17-gcc" -all_platforms="${all_platforms} x86-darwin18-gcc" +all_platforms="${all_platforms} x86-darwin-gcc" all_platforms="${all_platforms} x86-iphonesimulator-gcc" all_platforms="${all_platforms} x86-linux-gcc" all_platforms="${all_platforms} x86-linux-icc" @@ -139,18 +127,7 @@ all_platforms="${all_platforms} x86-win32-gcc" all_platforms="${all_platforms} x86-win32-vs14" all_platforms="${all_platforms} x86-win32-vs15" all_platforms="${all_platforms} x86_64-android-gcc" -all_platforms="${all_platforms} x86_64-darwin9-gcc" -all_platforms="${all_platforms} x86_64-darwin10-gcc" -all_platforms="${all_platforms} x86_64-darwin11-gcc" -all_platforms="${all_platforms} x86_64-darwin12-gcc" -all_platforms="${all_platforms} x86_64-darwin13-gcc" -all_platforms="${all_platforms} x86_64-darwin14-gcc" -all_platforms="${all_platforms} x86_64-darwin15-gcc" -all_platforms="${all_platforms} x86_64-darwin16-gcc" -all_platforms="${all_platforms} x86_64-darwin17-gcc" -all_platforms="${all_platforms} x86_64-darwin18-gcc" -all_platforms="${all_platforms} x86_64-darwin19-gcc" -all_platforms="${all_platforms} x86_64-darwin20-gcc" +all_platforms="${all_platforms} x86_64-darwin-gcc" all_platforms="${all_platforms} x86_64-iphonesimulator-gcc" all_platforms="${all_platforms} x86_64-linux-gcc" all_platforms="${all_platforms} x86_64-linux-icc" From bd87b8892c260753af5672b6f865684036f157dc Mon Sep 17 00:00:00 2001 From: xiaobaozidi Date: Tue, 29 Jun 2021 20:08:16 -0500 Subject: [PATCH 133/655] [mod_sofia] Fixed a few Usage-of-uninitialized value bugs which may cause information discolsure and bypass ACL check --- src/mod/endpoints/mod_sofia/sofia.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 70ed479ab5..79deb3e08a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -856,7 +856,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, if (sofia_test_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY)) { const char *mwi_status = NULL; - char network_ip[80]; + char network_ip[80] = ""; uint32_t x = 0; int acl_ok = 1; char *last_acl = NULL; @@ -1616,7 +1616,7 @@ static void our_sofia_event_callback(nua_event_t event, } if (authorization) { - char network_ip[80]; + char network_ip[80] = ""; int network_port; sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port); auth_res = sofia_reg_parse_auth(profile, authorization, sip, de, @@ -10192,7 +10192,7 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session, if (session && profile && sip && sofia_test_pflag(profile, PFLAG_TRACK_CALLS)) { switch_channel_t *channel = switch_core_session_get_channel(session); private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session); - char network_ip[80]; + char network_ip[80] = ""; int network_port = 0; char via_space[2048]; char branch[16] = ""; @@ -10308,7 +10308,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia const char *referred_by_user = NULL;//, *referred_by_host = NULL; const char *context = NULL; const char *dialplan = NULL; - char network_ip[80]; + char network_ip[80] = ""; char proxied_client_ip[80]; switch_event_t *v_event = NULL; switch_xml_t x_user = NULL; From 9376db0aae8422787ba9e688fd263814c16d9ed5 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 15 Jul 2021 17:26:20 +0300 Subject: [PATCH 134/655] [Core] Fix FreeSWITCH crashes caused by race conditions when working with Secure RTP. --- src/switch_rtp.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1b0d407dec..d4e3f10218 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -64,9 +64,9 @@ #define JITTER_LEAD_FRAMES 10 #define READ_INC(rtp_session) switch_mutex_lock(rtp_session->read_mutex); rtp_session->reading++ -#define READ_DEC(rtp_session) switch_mutex_unlock(rtp_session->read_mutex); rtp_session->reading-- -#define WRITE_INC(rtp_session) switch_mutex_lock(rtp_session->write_mutex); rtp_session->writing++ -#define WRITE_DEC(rtp_session) switch_mutex_unlock(rtp_session->write_mutex); rtp_session->writing-- +#define READ_DEC(rtp_session) rtp_session->reading--; switch_mutex_unlock(rtp_session->read_mutex) +#define WRITE_INC(rtp_session) switch_mutex_lock(rtp_session->write_mutex); rtp_session->writing++ +#define WRITE_DEC(rtp_session) rtp_session->writing--; switch_mutex_unlock(rtp_session->write_mutex) #define RTP_STUN_FREQ 1000000 #define rtp_header_len 12 @@ -2387,6 +2387,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) #ifdef ENABLE_SRTP + switch_mutex_lock(rtp_session->ice_mutex); if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) { int stat = 0; int sbytes = (int) rtcp_bytes; @@ -2399,12 +2400,13 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) if (stat) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error: SRTP RTCP protection failed with code %d\n", stat); + switch_mutex_unlock(rtp_session->ice_mutex); goto end; } else { rtcp_bytes = sbytes; } - } + switch_mutex_unlock(rtp_session->ice_mutex); #endif #ifdef ENABLE_ZRTP @@ -7099,9 +7101,6 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes = 0; } } - switch_mutex_unlock(rtp_session->ice_mutex); - - #ifdef ENABLE_SRTP if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && rtp_session->rtcp_recv_msg_p->header.version == 2) { @@ -7128,6 +7127,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t } #endif + switch_mutex_unlock(rtp_session->ice_mutex); #ifdef ENABLE_ZRTP if (zrtp_on && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && rtp_session->rtcp_recv_msg_p->header.version == 2) { @@ -7606,6 +7606,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ other_rtp_session->rtcp_send_msg = rtp_session->rtcp_recv_msg; #ifdef ENABLE_SRTP + switch_mutex_lock(other_rtp_session->ice_mutex); if (switch_rtp_test_flag(other_rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) { int stat = 0; int sbytes = (int) rtcp_bytes; @@ -7620,8 +7621,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error: SRTP RTCP protection failed with code %d\n", stat); } rtcp_bytes = sbytes; - } + switch_mutex_unlock(other_rtp_session->ice_mutex); #endif #ifdef ENABLE_ZRTP @@ -9237,6 +9238,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, if (process_encryption) { #ifdef ENABLE_SRTP + switch_mutex_lock(rtp_session->ice_mutex); if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) { int sbytes = (int) *bytes; @@ -9251,6 +9253,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, 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; + switch_mutex_unlock(rtp_session->ice_mutex); goto end; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, "RE-Activating Secure RTP SEND\n"); @@ -9268,6 +9271,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, } *bytes = sbytes; } + switch_mutex_unlock(rtp_session->ice_mutex); #endif #ifdef ENABLE_ZRTP /* ZRTP Send */ From 432bfc0c45de62cdf146ad3870f8b8d351c5c22b Mon Sep 17 00:00:00 2001 From: dhruvecosmob Date: Tue, 20 Jul 2021 16:02:52 +0300 Subject: [PATCH 135/655] [mod_sofia] Deprecate the auth-messages profile param by setting it to be enabled by default and introducing the new disable-auth-messages param with a higher priority when set. --- .../endpoints/mod_sofia/conf/sofia.conf.xml | 8 +++++++- src/mod/endpoints/mod_sofia/sofia.c | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 7c802aa43b..3166094a27 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -317,12 +317,18 @@ register for nat handling --> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + diff --git a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c new file mode 100644 index 0000000000..382dbc2970 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -0,0 +1,295 @@ + +/* + * 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 + * + * + * sipp-based-tests.c - Test FreeSwitch using sipp (https://github.com/SIPp/sipp) + * + */ + +#include +#include +#include + +int test_success = 0; +int test_sofia_debug = 1; + +static switch_bool_t has_ipv6() +{ + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("sofia", "status profile external-ipv6", NULL, &stream); + + if (strstr((char *)stream.data, "Invalid Profile")) { + + switch_safe_free(stream.data); + + return SWITCH_FALSE; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "STATUS PROFILE: %s\n", (char *) stream.data); + + switch_safe_free(stream.data); + + return SWITCH_TRUE; +} + +static int start_sipp_uac(const char *ip, int remote_port,const char *scenario_uac, const char *extra) +{ + char *cmd = switch_mprintf("sipp %s:%d -nr -p 5062 -m 1 -s 1001 -recv_timeout 10000 -timeout 10s -sf %s -bg %s", ip, remote_port, scenario_uac, extra); + int sys_ret = switch_system(cmd, SWITCH_TRUE); + + printf("%s\n", cmd); + switch_safe_free(cmd); + switch_sleep(1000 * 1000); + return sys_ret; +} + +static void kill_sipp(void) +{ + switch_system("pkill -x sipp", SWITCH_TRUE); + switch_sleep(1000 * 1000); +} + +static void event_handler(switch_event_t *event) +{ + const char *new_ev = switch_event_get_header(event, "Event-Subclass"); + char *str; + + if (new_ev && !strcmp(new_ev, "sofia::gateway_invalid_digest_req")) { + test_success = 1; + } + + /*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); + } +} + +FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) +{ + FST_MODULE_BEGIN(mod_sofia, uac-uas) + { + FST_SETUP_BEGIN() + { + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("sofia", "global siptrace on", NULL, &stream); + if (test_sofia_debug) { + switch_api_execute("sofia", "loglevel all 9", NULL, &stream); + switch_api_execute("sofia", "tracelevel debug", NULL, &stream); + } + switch_safe_free(stream.data); + + switch_core_set_variable("spawn_instead_of_system", "true"); + + fst_requires_module("mod_sndfile"); + fst_requires_module("mod_voicemail"); + fst_requires_module("mod_sofia"); + fst_requires_module("mod_loopback"); + fst_requires_module("mod_console"); + fst_requires_module("mod_dptools"); + fst_requires_module("mod_dialplan_xml"); + fst_requires_module("mod_commands"); + fst_requires_module("mod_say_en"); + fst_requires_module("mod_tone_stream"); + + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(uac_digest_leak_udp) + { + switch_core_session_t *session; + switch_call_cause_t cause; + switch_status_t status; + switch_channel_t *channel; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + int sipp_ret; + + switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler, NULL); + + status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + sipp_ret = start_sipp_uac(local_ip_v4, 5080, "sipp-scenarios/uac_digest_leak.xml", ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + + fst_check(status == SWITCH_STATUS_SUCCESS); + if (!session) { + fst_requires(session); + } + + channel = switch_core_session_get_channel(session); + fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); + + while (1) { + int ret; + switch_sleep(1000 * 1000); + ret = switch_system("pidof sipp", SWITCH_TRUE); + if (!ret) { + break; + } + } + + switch_sleep(5000 * 1000); + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session); + switch_sleep(1000 * 1000); + + switch_event_unbind_callback(event_handler); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); + test_success = 0; + } + FST_TEST_END() + + FST_TEST_BEGIN(uac_digest_leak_tcp) + { + switch_core_session_t *session; + switch_call_cause_t cause; + switch_status_t status; + switch_channel_t *channel; + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + int sipp_ret; + + switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler, NULL); + + status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + sipp_ret = start_sipp_uac(local_ip_v4, 5080, "sipp-scenarios/uac_digest_leak-tcp.xml", "-t t1"); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + + fst_check(status == SWITCH_STATUS_SUCCESS); + if (!session) { + fst_requires(session); + } + + channel = switch_core_session_get_channel(session); + fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); + + while (1) { + int ret; + switch_sleep(1000 * 1000); + ret = switch_system("pidof sipp", SWITCH_TRUE); + if (!ret) { + break; + } + } + + switch_sleep(5000 * 1000); + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session); + switch_sleep(1000 * 1000); + + switch_event_unbind_callback(event_handler); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); + test_success = 0; + } + FST_TEST_END() + + FST_TEST_BEGIN(uac_digest_leak_udp_ipv6) + { + switch_core_session_t *session; + switch_call_cause_t cause; + switch_status_t status; + switch_channel_t *channel; + const char *local_ip_v6 = switch_core_get_variable("local_ip_v6"); + int sipp_ret; + char *ipv6 = NULL; + + if (!has_ipv6()) { + goto skiptest; + } + switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler, NULL); + + if (!strchr(local_ip_v6,'[')) { + ipv6 = switch_mprintf("[%s]", local_ip_v6); + } + status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + + if (!ipv6) { + sipp_ret = start_sipp_uac(local_ip_v6, 6060, "sipp-scenarios/uac_digest_leak-ipv6.xml", "-i [::1]"); + } else { + sipp_ret = start_sipp_uac(ipv6, 6060, "sipp-scenarios/uac_digest_leak-ipv6.xml", "-i [::1] -mi [::1]"); + } + + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + + fst_check(status == SWITCH_STATUS_SUCCESS); + if (!session) { + fst_requires(session); + } + + channel = switch_core_session_get_channel(session); + fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); + + while (1) { + int ret; + switch_sleep(1000 * 1000); + ret = switch_system("pidof sipp", SWITCH_TRUE); + if (!ret) { + break; + } + } + + switch_sleep(5000 * 1000); + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session); + switch_sleep(1000 * 1000); + + switch_event_unbind_callback(event_handler); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + switch_safe_free(ipv6); + fst_check(test_success); +skiptest: + test_success = 0; + } + FST_TEST_END() + + } + FST_MODULE_END() +} +FST_CORE_END() diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak-ipv6.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak-ipv6.xml new file mode 100644 index 0000000000..6ddbe069da --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak-ipv6.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + ;tag=[call_number] + To: sut + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:1001@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=user1 53655765 2353687637 IN IP[local_ip_type] 0000:0000:0000:0000:0000:0000:0000:0001 + s=- + c=IN IP6 0000:0000:0000:0000:0000:0000:0000:0001 + t=0 0 + m=audio [media_port] RTP/AVP 0 + a=rtpmap:0 PCMU/8000 + + ]]> + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: sut [peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:1001@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak-tcp.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak-tcp.xml new file mode 100644 index 0000000000..7276fa1d46 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak-tcp.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + ;tag=[call_number] + To: sut + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: + Max-Forwards: 70 + Subject: Performance Test + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=user1 53655765 2353687637 IN IP[local_ip_type] 127.0.0.1 + s=- + c=IN IP[media_ip_type] 127.0.0.1 + t=0 0 + m=audio [media_port] RTP/AVP 0 + a=rtpmap:0 PCMU/8000 + + ]]> + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: sut [peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: + Max-Forwards: 70 + Subject: Performance Test + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + + diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak.xml new file mode 100644 index 0000000000..7c1e9ebd62 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_digest_leak.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + ;tag=[call_number] + To: sut + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:1001@127.0.0.1:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 + a=rtpmap:0 PCMU/8000 + + ]]> + + + + + + + + + + + + + + + + + + + + + ;tag=[call_number] + To: sut [peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:1001@127.0.0.1:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Length: 0 + + ]]> + + + + + + + + + + + + + + + + diff --git a/src/mod/endpoints/mod_sofia/test/test_run_sipp.sh b/src/mod/endpoints/mod_sofia/test/test_run_sipp.sh new file mode 100755 index 0000000000..fbe01c144d --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/test_run_sipp.sh @@ -0,0 +1,3 @@ +#/bin/sh +./sipp-based-tests + diff --git a/src/mod/endpoints/mod_sofia/test/voicemail/vm-goodbye.wav b/src/mod/endpoints/mod_sofia/test/voicemail/vm-goodbye.wav new file mode 100644 index 0000000000000000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f<1?n zh1V7V1;KeZA8J(=Zh*Ue!O>>K<4yb?^d5LjEg)GLkvB3zqy3OyzXj^n2f1f1a?n&- zj{1On0t!bcjUFOG*3s|C8jX<6$^iW`DGaP|;dodR~s52ay3! z10%c#&f@4Le6$L*P#@G<&=}}^B&MZJw3p5!M_&gA1He~SU~Hw46R#rY-2jH>qPibI zBpv6S;N}WW-iw&}6}e&usHZ?b0-k#n2=EJFyesguKk~v+aJvK5;sz?2q^IC95A=}- z7VQQ-xB4IDX7n>K+{(D~1MJipeC3C>N`eCuHPWOfYyf+_gL>?R=1Kx1jR9i#5z^en z=Ll%tM_&0G5pW6|ZH24{!RZZ1d>5JhD)7~p_?s10%nZ3}!X|YwuapCo%J|NT>nNa< z*--!T0)_m7YQBT#JO!30LEXZ=FSvF9TDuDU<)d5t26g`iXr$u56F`!4AR;m$GVb9` z2UY7OuF@fw<^l}?nTi7kE&>X1@Q4iXjO;iuJ!<+pXyzZ}s8}Gg7BJ^D*zXN0{%6?k d6XN9yLTrPUgL^jC7Zlcm6HNHi7ay|u{{YPU)KmZf literal 0 HcmV?d00001 diff --git a/src/mod/endpoints/mod_sofia/test/voicemail/vm-not_available.wav b/src/mod/endpoints/mod_sofia/test/voicemail/vm-not_available.wav new file mode 100644 index 0000000000000000000000000000000000000000..fc5358332f08445eace117f1467414c0c5b3ac70 GIT binary patch literal 15658 zcmXwg1$Y!m*L793&BSnbcL?t8wu`&#;;^_a?(U1b!xG$C+`GtRZT0n_uv*dmZ^mF+QY&^bnXGrj%PPHLyO zpPRQ>Zu(8_71zDh?&n~`U_Q66*NT^uTwT-gq!rCfFOdwSm%gO3s?CZkhxDOsjT@%z z%=8`g-S-dm{q3wX+tRfF=4yM3e@^Jluyo-~BHlU7+-#MQrQIUlkGQEnd&EtSUmR%SMyOJx zFMVzPv}TyEjOHv(J6Q|S%dc(Zx{Oj)$+9teec>1tYp>h5p>=Rj|Teyn@j{?==cg7_R zGV#Ua z2a}g-pGvDs%Bf<9xG#=~#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xH zK~E2)GaM-C3|7mJB!FC;a>y-fLkHk!PixU%QFkij&)y^Zuq(MHxRC^SD&rx8n&9id zAdmJrTD=<_!*Tg9c=v}g5xK9~(a+(?k64Nk%>bjFDsBt z6lNgD=TkuQtDqZr76p6}FOZCryR{3mdO7x)jzHd9SFpb|u~)k>MyVN|rqT!Bjsu&q z86$ofSqnc9b;|T8;oXnD(h%{zT`J5N$&Qlhn@VoO&DCe0~VPKPj;S)GnUQSdz zJ|%bIBT(f7lzRhq@eJy?j9M>1r<~m(F&L9?$jC?rR}_YMoB{pG3z_7CUmFeS6va^p zbvw0W#;>U$D~fCfXa9q9!~$u(K>7C|k$ZT5gKy%%l{wFx{Dj^H;G3Grsz{AUs)>7@ zd^YF#j+x+xhTjKK&mN>f+ruHPP`uKhmh>po*^lA$$a&gVSW16?K9AE4 zpW4Y6_*oAqQk0p5mlGRL!jXV6aw5iwIGi3hxd2WtbjT|xMKVquX;F4sv_5@GKM?y% xX}{A0Ct~l!<(*i(Gvdj3`EVqo>_n97{CA$5^)na3Dcg~b6We$4Fq~YD{|AkA%OwB+ literal 0 HcmV?d00001 diff --git a/src/mod/endpoints/mod_sofia/test/voicemail/vm-record_message.wav b/src/mod/endpoints/mod_sofia/test/voicemail/vm-record_message.wav new file mode 100644 index 0000000000000000000000000000000000000000..b591ec528f04c1f78c92a195ad847c2504aa894f GIT binary patch literal 73566 zcmZ5|1$-1q_ia_Rj6@;8;_mJQcXxM};4Bc_-Q8^$UECM9#a$P--~@>$lbP<4cZTnM z@BQCneiM?J?(({I?z!i7tA_RJwaYhGZmJ zNDjQRk>Bu_8~1bE_f5T3kJW8;Nu5zg)d6(~KQE{|>bd%Ya^1MPENM)7kr8ApnLtL9 zVWcN%MJkf?BuU*=JJdAQOVw9JRaTV&?_zjWRKwM7^;zX2oyaosgyf-p=>~d@KBuqf zA=;1HZs$gf_xyBh(V&IXfNi8ucDsZCbO!8syoR?Khl$IkM>^AU^aAQbvTVs zEi22$D$|DQHlJpd^L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~XZl?jK@IEQfv6 zkGyy;QD`cz)LQDQi||Gq%Jx_C^>OaW46a@d&gqS`SY0P@ELXs%8ZeiZ0gow-kHu${ zrnj^KT2^$IH`T>xHqJ59-!W%v-d5J$i7=cxpuEnDUcDZ3@;b>3j}LTZR?waxKj(>} z(t!`%77sT^_K5sz!RIY123e^!v_%Oujy=vo@Aix+qzwGRl4>EJW2mN4)2Uh2Y+#1_7?FjT z^IubMpGd{03Atq$ekT7iUz~%de3>!&iYmA7g_H-b)&O*92bsfTP{3yRQi1RtP*W4v zmuLNIO_bQ3Rc|8ZqUcskkj5t(*{5r_juE3?agHi0YC3Af}_Fs?Zq7GlT zqmt5=IkPiQ_5!fufw(J80he44>OA|4-_kF{m-(o2XsE)D(M#fIFzv=1K?z2GF6NJd z@EG!;PixD)U&pF-ni1qzI(%2y1Sl2@aK?VOP~TlTDb){~pZc9gk})^t1@CUgG1Ugo zY|5VJ!_HjE%&;7_U{BW8n!I10ZD`B|mxT5O2uc&>L{KW6* z@!`ue^@?~g2x4E5JyxX>P>z~gDOQgkIln4YwThCzq+xXUy;*2}h(hnfm#WTZMvqO- z^VQG$t1s_=RV3g2*yDWs-+a%W{Fm>w?7#eL5dWn{`PCoU_c;FA!NvdASD^ad$9|Pc W1NY#D{J(!lRH)tfFaHleRQ?}*@J*ut literal 0 HcmV?d00001 diff --git a/src/mod/endpoints/mod_sofia/test/voicemail/vm-too-small.wav b/src/mod/endpoints/mod_sofia/test/voicemail/vm-too-small.wav new file mode 100644 index 0000000000000000000000000000000000000000..35ca061177326f9ebcaade279387539279ef35e9 GIT binary patch literal 64896 zcmZtu1&|cU_caV>W=YEk?(XjH4ht;q?(XjHE{nq;i@PoE?z${4gS*d6cU9VZ8veg{ z;*0pEqIz8fWG8t^K~k6$!2cZho{-oifU6$p%lf1~ zpm*qPcuU`n!6rqSZU)*I9K_ zJsrbw9lMOfBbHECQk~=<@`b1@Ziv)!fMBYVTA(VDL1Z>BQ2@X5yV{ElTlBvW{rY1N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})nXBDj{!(tOUzU$b57xTLbAiLec%NoFLj)J+ZbL@WO zoY$4`zU0aMI3t>)5Zj(zwHb3qE42=Ut)*-7ZUEW61Z(&yyO36AtpM`cjC-}=)at{! z7|ip>Gpok3BTl5h$MM}XS~P;)A(j?4ftOtoY_$M3yu`Y=$@?B=M(<*V{7M^srWN1Q z>)$ixs~Ewptj#@)<8hvP0hB%jx~^;2<>d~gd3sIytqJE-d$8rsw4pOS*^_?g&PQkZ zzd66HPw!|=v^PM6P0nY{R@Q9l^Yq{zp1c#hT37%5AD^1v{Tuw7UBoSpVv(Qc{JO*6 zKLL65Sgl(7wE&}A1lCGMHni4L(>iKe1GW+@w~UVx{6+EC2(o6A+PtgI4NvAiI>+`V z&p*riT<7~M*ho49{Tz0v&T&lOL+1u)^|^b@CY@Uz=B+im*k-&m=Qt}?a6Wn=JN$iJ zBUjf|*39Azbu^y_efdvU49>_(*8J%geCnKg&7RggbIq$x;-^|GOlR6Z;X9pCtW|I| h&YaHsLQdhCT47SNn00Qt<_7 Date: Mon, 9 Aug 2021 21:28:56 +0300 Subject: [PATCH 145/655] [Core] Add switch_safe_atol() and switch_safe_atoll() functions. Add a unit-test. --- src/include/switch_utils.h | 28 ++++++++++++++++++++++++++-- tests/unit/switch_core.c | 16 ++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 20655ecd4e..24c6151331 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -831,10 +831,10 @@ static inline char *switch_clean_name_string(char *s) /*! - \brief Turn a string into a number (default if NULL) + \brief Turn a string into an integer (default if NULL) \param nptr the string \param dft the default - \return the number version of the string or the default + \return the integer version of the string or the default */ static inline int switch_safe_atoi(const char *nptr, int dft) { @@ -842,6 +842,30 @@ static inline int switch_safe_atoi(const char *nptr, int dft) } +/*! + \brief Turn a string into a long integer (default if NULL) + \param nptr the string + \param dft the default + \return the long integer version of the string or the default +*/ +static inline long int switch_safe_atol(const char *nptr, long int dft) +{ + return nptr ? atol(nptr) : dft; +} + + +/*! + \brief Turn a string into a long long integer (default if NULL) + \param nptr the string + \param dft the default + \return the long long integer version of the string or the default +*/ +static inline long long int switch_safe_atoll(const char *nptr, long long int dft) +{ + return nptr ? atoll(nptr) : dft; +} + + /*! \brief Free a pointer and set it to NULL unless it already is NULL \param it the pointer diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index bba7272cac..ed84e39c06 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -223,6 +223,22 @@ FST_CORE_BEGIN("./conf") #endif } FST_TEST_END() + + FST_TEST_BEGIN(test_switch_safe_atoXX) + { + fst_check_int_equals(switch_safe_atoi("1", 0), 1); + fst_check_int_equals(switch_safe_atoi("", 2), 0); + fst_check_int_equals(switch_safe_atoi(0, 3), 3); + + fst_check_int_equals(switch_safe_atol("9275806", 0), 9275806); + fst_check_int_equals(switch_safe_atol("", 2), 0); + fst_check_int_equals(switch_safe_atol(0, 3), 3); + + fst_check_int_equals(switch_safe_atoll("9275806", 0), 9275806); + fst_check_int_equals(switch_safe_atoll("", 2), 0); + fst_check_int_equals(switch_safe_atoll(0, 3), 3); + } + FST_TEST_END() } FST_SUITE_END() } From 6ec1cee2565be13d43541d0eaac2468efd13ee68 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 19 Aug 2021 19:32:18 +0300 Subject: [PATCH 146/655] [Build-System] Allow out-of-tree modules to stay commented out in modules.conf and fix false-positive warnings from module integrity checking when running make install. --- build/modcheck.sh | 4 ++-- configure.ac | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/modcheck.sh b/build/modcheck.sh index 5df91f7e97..e8a82abf29 100644 --- a/build/modcheck.sh +++ b/build/modcheck.sh @@ -21,8 +21,8 @@ cd $here for i in $files ; do mod=${i%%.*} - infile=`grep ^.*$mod\$ ../modules.conf | grep -v ftmod_` - commented=`grep ^\#.*$mod\$ ../modules.conf | grep -v ftmod_` + infile=`grep -E "^.*$mod(\|.*)?$" ../modules.conf | grep -v ftmod_` + commented=`grep -E "^\#.*$mod(\|.*)?$" ../modules.conf | grep -v ftmod_` if [ -z "$infile" ] ; then echo "${on}WARNING: installed module: $i was not installed by this build. It is not present in modules.conf.${off}" diff --git a/configure.ac b/configure.ac index ccbf0ed3e1..5ea8e3921e 100644 --- a/configure.ac +++ b/configure.ac @@ -2078,7 +2078,7 @@ AM_CONDITIONAL(HAVE_G729, [ test -d ${switch_srcdir}/libs/libg729 ]) LIBTOOL='$(SHELL) $(switch_builddir)/libtool' TOUCH_TARGET='if test -f "$@";then touch "$@";fi;' CONF_MODULES='$$(grep -v "\#" $(switch_builddir)/modules.conf | sed "s/|.*//" | sed -e "s|^.*/||" | sort | uniq )' -CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed "s/|.*//" | sed -e "s|^.*/||" | sort | uniq )' +CONF_DISABLED_MODULES='$$(grep "\#" $(switch_builddir)/modules.conf | grep -v "\#\#" | sed "s/|.*//" | sed "s/\#/\#\//"| sed -e "s|^.*/||" | sort | uniq )' OUR_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-all ; done )"; echo $$mods )' OUR_CLEAN_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-clean ; done )"; echo $$mods )' OUR_INSTALL_MODS='$$(if test -z "$(MODULES)" ; then tmp_mods="$(CONF_MODULES)"; else tmp_mods="$(MODULES)" ; fi ; mods="$$(for i in $$tmp_mods ; do echo $$i-install ; done)"; echo $$mods )' From 380fd060ef719b1d8f8781422e84d2a32066351d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 19 Aug 2021 01:12:54 +0300 Subject: [PATCH 147/655] [Build-System] Remove freetdm from the FreeSWITCH tree. Use out-of-tree module https://github.com/freeswitch/freetdm instead. --- .gitignore | 9 - bootstrap.sh | 2 +- build/modules.conf.in | 2 +- configure.ac | 1 - libs/.gitignore | 6 - libs/freetdm/.gitignore | 39 - libs/freetdm/.update | 1 - libs/freetdm/AUTHORS | 0 libs/freetdm/CMakeLists.txt | 244 - libs/freetdm/ChangeLog | 0 libs/freetdm/Makefile.am | 290 - libs/freetdm/NEWS | 0 libs/freetdm/README | 3 - libs/freetdm/TODO | 22 - libs/freetdm/acinclude.m4 | 2 - libs/freetdm/bootstrap | 6 - libs/freetdm/build/ax_compiler_vendor.m4 | 15 - libs/freetdm/build/libpcap.m4 | 150 - libs/freetdm/conf/freetdm.conf | 82 - libs/freetdm/conf/freetdm.conf.xml | 633 -- libs/freetdm/conf/pika.conf | 43 - libs/freetdm/conf/tones.conf | 142 - libs/freetdm/conf/wanpipe.conf | 13 - libs/freetdm/conf/zt.conf | 8 - libs/freetdm/configure.ac | 480 -- libs/freetdm/configure.gnu | 3 - libs/freetdm/cyginstall.sh | 14 - libs/freetdm/docs/Doxygen.conf | 265 - libs/freetdm/docs/PRI-BRI-Debug.pdf | Bin 399483 -> 0 bytes libs/freetdm/docs/async.txt | 15 - libs/freetdm/docs/ftdm-open-issues.txt | 76 - libs/freetdm/docs/glare.txt | 25 - libs/freetdm/docs/io_modules.txt | 13 - libs/freetdm/docs/locking.txt | 125 - libs/freetdm/docs/sigstatus.txt | 59 - libs/freetdm/docs/ss7-native-bridge.txt | 43 - libs/freetdm/docs/variables.txt | 122 - libs/freetdm/freetdm.2008.sln | 155 - libs/freetdm/freetdm.2010.sln | 127 - libs/freetdm/freetdm.2012.sln | 127 - libs/freetdm/freetdm.pc.in | 18 - libs/freetdm/mkrelease.sh | 144 - libs/freetdm/mod_freetdm/CMakeLists.txt | 32 - libs/freetdm/mod_freetdm/Makefile.in | 24 - libs/freetdm/mod_freetdm/clean.sh | 6 - .../mod_freetdm/mod_freetdm.2008.vcproj | 369 - .../mod_freetdm.2010.vcxproj.filters | 14 - libs/freetdm/mod_freetdm/mod_freetdm.c | 5715 -------------- .../mod_freetdm/mod_openzap.2005.vcproj | 201 - libs/freetdm/mod_freetdm/tdm.c | 719 -- libs/freetdm/msvc/freetdm.2008.vcproj | 499 -- .../freetdm/msvc/freetdm.2010.vcxproj.filters | 137 - libs/freetdm/msvc/openzap.2005.vcproj | 301 - .../msvc/testanalog/testanalog.2005.vcproj | 193 - .../msvc/testanalog/testanalog.2008.vcproj | 349 - .../testanalog.2010.vcxproj.filters | 14 - .../msvc/testboost/testboost.2008.vcproj | 354 - .../testboost/testboost.2010.vcxproj.filters | 14 - .../testboost/testsangomaboost.2008.vcproj | 354 - .../testsangomaboost.2010.vcxproj.filters | 14 - .../msvc/testisdn/testisdn.2005.vcproj | 193 - .../msvc/testisdn/testisdn.2008.vcproj | 349 - .../testisdn/testisdn.2010.vcxproj.filters | 14 - libs/freetdm/sample/CMakeLists.txt | 7 - libs/freetdm/sample/dso/CMakeLists.txt | 12 - libs/freetdm/sample/dso/Makefile | 14 - libs/freetdm/sample/dso/ftdmload.c | 168 - libs/freetdm/sample/sched/CMakeLists.txt | 12 - libs/freetdm/sample/sched/ftdmsched.c | 110 - libs/freetdm/src/detect_dtmf.c | 54 - libs/freetdm/src/detect_tones.c | 32 - libs/freetdm/src/fsk.c | 351 - libs/freetdm/src/ftdm_backtrace.c | 78 - libs/freetdm/src/ftdm_buffer.c | 308 - libs/freetdm/src/ftdm_call_utils.c | 237 - libs/freetdm/src/ftdm_callerid.c | 307 - libs/freetdm/src/ftdm_config.c | 383 - libs/freetdm/src/ftdm_cpu_monitor.c | 307 - libs/freetdm/src/ftdm_dso.c | 126 - libs/freetdm/src/ftdm_io.c | 7027 ----------------- libs/freetdm/src/ftdm_queue.c | 234 - libs/freetdm/src/ftdm_sched.c | 576 -- libs/freetdm/src/ftdm_state.c | 575 -- libs/freetdm/src/ftdm_threadmutex.c | 635 -- libs/freetdm/src/ftdm_variables.c | 151 - .../src/ftmod/ftmod_analog/ftdm_analog.h | 75 - .../ftmod_analog/ftmod_analog.2008.vcproj | 353 - .../ftmod_analog.2010.vcxproj.filters | 23 - .../src/ftmod/ftmod_analog/ftmod_analog.c | 1270 --- .../ftmod/ftmod_analog_em/ftdm_analog_em.h | 77 - .../ftmod_analog_em.2008.vcproj | 353 - .../ftmod_analog_em.2010.vcxproj.filters | 23 - .../ftmod/ftmod_analog_em/ftmod_analog_em.c | 1160 --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 1592 ---- .../ftmod/ftmod_isdn/ftmod_isdn.2008.vcproj | 465 -- .../ftmod_isdn.2010.vcxproj.filters | 110 - .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 2927 ------- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h | 100 - .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 3248 -------- .../src/ftmod/ftmod_libpri/ftmod_libpri.h | 151 - .../src/ftmod/ftmod_libpri/lpwrap_pri.c | 464 -- .../src/ftmod/ftmod_libpri/lpwrap_pri.h | 144 - .../src/ftmod/ftmod_misdn/ftmod_misdn.c | 2837 ------- libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h | 132 - .../ftmod/ftmod_pika/ftmod_pika.2008.vcproj | 353 - .../ftmod_pika.2010.vcxproj.filters | 23 - .../freetdm/src/ftmod/ftmod_pika/ftmod_pika.c | 1469 ---- .../ftmod/ftmod_pika/ozmod_pika.2005.vcproj | 197 - .../src/ftmod/ftmod_pritap/ftmod_pritap.c | 1189 --- .../src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj | 196 - .../ftmod_r2/ftmod_r2.2010.vcxproj.filters | 22 - libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c | 2437 ------ .../src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.c | 163 - .../src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.h | 73 - .../ftmod_sangoma_isdn.2008.vcproj | 249 - .../ftmod_sangoma_isdn.2010.vcxproj.filters | 57 - .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 1563 ---- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 613 -- .../ftmod_sangoma_isdn_cfg.c | 657 -- .../ftmod_sangoma_isdn_cntrl.c | 98 - .../ftmod_sangoma_isdn_stack_cfg.c | 1273 --- .../ftmod_sangoma_isdn_stack_cntrl.c | 403 - .../ftmod_sangoma_isdn_stack_hndl.c | 1437 ---- .../ftmod_sangoma_isdn_stack_out.c | 588 -- .../ftmod_sangoma_isdn_stack_rcv.c | 1134 --- .../ftmod_sangoma_isdn_support.c | 1643 ---- .../ftmod_sangoma_isdn_trace.c | 996 --- .../ftmod_sangoma_isdn_trace.h | 599 -- .../ftmod_sangoma_isdn_transfer.c | 281 - .../ftmod_sangoma_isdn_user.h | 154 - .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c | 1745 ---- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 4007 ---------- .../ftmod_sangoma_ss7_cntrl.c | 921 --- .../ftmod_sangoma_ss7_handle.c | 2750 ------- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c | 722 -- .../ftmod_sangoma_ss7_logger.c | 1155 --- .../ftmod_sangoma_ss7_m2ua.c | 1773 ----- .../ftmod_sangoma_ss7_m2ua.h | 136 - .../ftmod_sangoma_ss7_m2ua_xml.c | 690 -- .../ftmod_sangoma_ss7_main.c | 2766 ------- .../ftmod_sangoma_ss7_main.h | 1246 --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 1052 --- .../ftmod_sangoma_ss7_relay.c | 345 - .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c | 240 - .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c | 61 - .../ftmod_sangoma_ss7_support.c | 3415 -------- .../ftmod_sangoma_ss7_timers.c | 163 - .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 3454 -------- .../freetdm/src/ftmod/ftmod_skel/ftmod_skel.c | 183 - .../ftmod_wanpipe/ftmod_wanpipe.2008.vcproj | 355 - .../ftmod_wanpipe.2010.vcxproj.filters | 18 - .../src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 1807 ----- libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c | 1571 ---- libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h | 393 - libs/freetdm/src/g711.c | 104 - libs/freetdm/src/hashtable.c | 340 - libs/freetdm/src/hashtable_itr.c | 186 - libs/freetdm/src/include/freetdm.h | 2023 ----- libs/freetdm/src/include/ftdm_call_utils.h | 154 - libs/freetdm/src/include/ftdm_declare.h | 299 - libs/freetdm/src/include/ftdm_dso.h | 54 - libs/freetdm/src/include/ftdm_os.h | 205 - libs/freetdm/src/include/ftdm_threadmutex.h | 78 - libs/freetdm/src/include/private/fsk.h | 121 - .../freetdm/src/include/private/ftdm_buffer.h | 154 - .../freetdm/src/include/private/ftdm_config.h | 145 - libs/freetdm/src/include/private/ftdm_core.h | 803 -- .../src/include/private/ftdm_cpu_monitor.h | 75 - libs/freetdm/src/include/private/ftdm_sched.h | 119 - libs/freetdm/src/include/private/ftdm_state.h | 247 - libs/freetdm/src/include/private/ftdm_types.h | 390 - libs/freetdm/src/include/private/g711.h | 395 - libs/freetdm/src/include/private/hashtable.h | 235 - .../src/include/private/hashtable_itr.h | 134 - .../src/include/private/hashtable_private.h | 110 - .../freetdm/src/include/private/libteletone.h | 161 - .../src/include/private/libteletone_detect.h | 282 - .../include/private/libteletone_generate.h | 316 - .../src/include/private/sangoma_tdm_api.h | 321 - libs/freetdm/src/include/private/uart.h | 83 - libs/freetdm/src/isdn/5ESSStateNT.c | 132 - libs/freetdm/src/isdn/5ESSStateTE.c | 291 - libs/freetdm/src/isdn/5ESSmes.c | 361 - libs/freetdm/src/isdn/DMSStateNT.c | 126 - libs/freetdm/src/isdn/DMSStateTE.c | 284 - libs/freetdm/src/isdn/DMSmes.c | 344 - libs/freetdm/src/isdn/EuroISDNStateNT.c | 44 - libs/freetdm/src/isdn/EuroISDNStateTE.c | 58 - libs/freetdm/src/isdn/Q921.c | 3518 --------- libs/freetdm/src/isdn/Q931.c | 888 --- libs/freetdm/src/isdn/Q931StateNT.c | 1218 --- libs/freetdm/src/isdn/Q931StateTE.c | 1310 --- libs/freetdm/src/isdn/Q931api.c | 598 -- libs/freetdm/src/isdn/Q931ie.c | 3074 ------- libs/freetdm/src/isdn/Q931mes.c | 1870 ----- libs/freetdm/src/isdn/Q932mes.c | 286 - libs/freetdm/src/isdn/include/5ESS.h | 103 - libs/freetdm/src/isdn/include/DMS.h | 91 - libs/freetdm/src/isdn/include/Q921.h | 227 - libs/freetdm/src/isdn/include/Q921priv.h | 321 - libs/freetdm/src/isdn/include/Q931.h | 1175 --- libs/freetdm/src/isdn/include/Q931ie.h | 1205 --- libs/freetdm/src/isdn/include/Q932.h | 95 - libs/freetdm/src/isdn/include/mfifo.h | 85 - libs/freetdm/src/isdn/include/national.h | 86 - libs/freetdm/src/isdn/mfifo.c | 399 - libs/freetdm/src/isdn/nationalStateNT.c | 130 - libs/freetdm/src/isdn/nationalStateTE.c | 217 - libs/freetdm/src/isdn/nationalmes.c | 269 - libs/freetdm/src/libteletone_detect.c | 485 -- libs/freetdm/src/libteletone_generate.c | 505 -- libs/freetdm/src/priserver.c | 328 - libs/freetdm/src/sangoma_pri.c | 251 - libs/freetdm/src/sangoma_pri.h | 100 - libs/freetdm/src/ss7/README | 3 - libs/freetdm/src/testanalog.c | 138 - libs/freetdm/src/testapp.c | 89 - libs/freetdm/src/testcid.c | 109 - libs/freetdm/src/testisdn.c | 74 - libs/freetdm/src/testpri.c | 174 - libs/freetdm/src/testr2.c | 169 - libs/freetdm/src/testtones.c | 76 - libs/freetdm/src/uart.c | 125 - 223 files changed, 2 insertions(+), 118395 deletions(-) delete mode 100644 libs/freetdm/.gitignore delete mode 100644 libs/freetdm/.update delete mode 100644 libs/freetdm/AUTHORS delete mode 100644 libs/freetdm/CMakeLists.txt delete mode 100644 libs/freetdm/ChangeLog delete mode 100644 libs/freetdm/Makefile.am delete mode 100644 libs/freetdm/NEWS delete mode 100644 libs/freetdm/README delete mode 100644 libs/freetdm/TODO delete mode 100644 libs/freetdm/acinclude.m4 delete mode 100755 libs/freetdm/bootstrap delete mode 100644 libs/freetdm/build/ax_compiler_vendor.m4 delete mode 100644 libs/freetdm/build/libpcap.m4 delete mode 100644 libs/freetdm/conf/freetdm.conf delete mode 100644 libs/freetdm/conf/freetdm.conf.xml delete mode 100644 libs/freetdm/conf/pika.conf delete mode 100644 libs/freetdm/conf/tones.conf delete mode 100644 libs/freetdm/conf/wanpipe.conf delete mode 100644 libs/freetdm/conf/zt.conf delete mode 100644 libs/freetdm/configure.ac delete mode 100755 libs/freetdm/configure.gnu delete mode 100755 libs/freetdm/cyginstall.sh delete mode 100644 libs/freetdm/docs/Doxygen.conf delete mode 100755 libs/freetdm/docs/PRI-BRI-Debug.pdf delete mode 100644 libs/freetdm/docs/async.txt delete mode 100644 libs/freetdm/docs/ftdm-open-issues.txt delete mode 100644 libs/freetdm/docs/glare.txt delete mode 100644 libs/freetdm/docs/io_modules.txt delete mode 100644 libs/freetdm/docs/locking.txt delete mode 100644 libs/freetdm/docs/sigstatus.txt delete mode 100644 libs/freetdm/docs/ss7-native-bridge.txt delete mode 100644 libs/freetdm/docs/variables.txt delete mode 100644 libs/freetdm/freetdm.2008.sln delete mode 100644 libs/freetdm/freetdm.2010.sln delete mode 100644 libs/freetdm/freetdm.2012.sln delete mode 100644 libs/freetdm/freetdm.pc.in delete mode 100755 libs/freetdm/mkrelease.sh delete mode 100644 libs/freetdm/mod_freetdm/CMakeLists.txt delete mode 100644 libs/freetdm/mod_freetdm/Makefile.in delete mode 100755 libs/freetdm/mod_freetdm/clean.sh delete mode 100644 libs/freetdm/mod_freetdm/mod_freetdm.2008.vcproj delete mode 100644 libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj.filters delete mode 100644 libs/freetdm/mod_freetdm/mod_freetdm.c delete mode 100644 libs/freetdm/mod_freetdm/mod_openzap.2005.vcproj delete mode 100644 libs/freetdm/mod_freetdm/tdm.c delete mode 100644 libs/freetdm/msvc/freetdm.2008.vcproj delete mode 100644 libs/freetdm/msvc/freetdm.2010.vcxproj.filters delete mode 100644 libs/freetdm/msvc/openzap.2005.vcproj delete mode 100644 libs/freetdm/msvc/testanalog/testanalog.2005.vcproj delete mode 100644 libs/freetdm/msvc/testanalog/testanalog.2008.vcproj delete mode 100644 libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj.filters delete mode 100644 libs/freetdm/msvc/testboost/testboost.2008.vcproj delete mode 100644 libs/freetdm/msvc/testboost/testboost.2010.vcxproj.filters delete mode 100644 libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj delete mode 100644 libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj.filters delete mode 100644 libs/freetdm/msvc/testisdn/testisdn.2005.vcproj delete mode 100644 libs/freetdm/msvc/testisdn/testisdn.2008.vcproj delete mode 100644 libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj.filters delete mode 100644 libs/freetdm/sample/CMakeLists.txt delete mode 100644 libs/freetdm/sample/dso/CMakeLists.txt delete mode 100644 libs/freetdm/sample/dso/Makefile delete mode 100644 libs/freetdm/sample/dso/ftdmload.c delete mode 100644 libs/freetdm/sample/sched/CMakeLists.txt delete mode 100644 libs/freetdm/sample/sched/ftdmsched.c delete mode 100644 libs/freetdm/src/detect_dtmf.c delete mode 100644 libs/freetdm/src/detect_tones.c delete mode 100644 libs/freetdm/src/fsk.c delete mode 100644 libs/freetdm/src/ftdm_backtrace.c delete mode 100644 libs/freetdm/src/ftdm_buffer.c delete mode 100644 libs/freetdm/src/ftdm_call_utils.c delete mode 100644 libs/freetdm/src/ftdm_callerid.c delete mode 100644 libs/freetdm/src/ftdm_config.c delete mode 100644 libs/freetdm/src/ftdm_cpu_monitor.c delete mode 100755 libs/freetdm/src/ftdm_dso.c delete mode 100644 libs/freetdm/src/ftdm_io.c delete mode 100644 libs/freetdm/src/ftdm_queue.c delete mode 100644 libs/freetdm/src/ftdm_sched.c delete mode 100644 libs/freetdm/src/ftdm_state.c delete mode 100644 libs/freetdm/src/ftdm_threadmutex.c delete mode 100644 libs/freetdm/src/ftdm_variables.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj.filters delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2008.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj.filters delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c delete mode 100755 libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2008.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj.filters delete mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2008.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj.filters delete mode 100644 libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_pika/ozmod_pika.2005.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters delete mode 100755 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c delete mode 100755 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.c delete mode 100755 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj.filters delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2008.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj.filters delete mode 100755 libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h delete mode 100644 libs/freetdm/src/g711.c delete mode 100644 libs/freetdm/src/hashtable.c delete mode 100644 libs/freetdm/src/hashtable_itr.c delete mode 100755 libs/freetdm/src/include/freetdm.h delete mode 100644 libs/freetdm/src/include/ftdm_call_utils.h delete mode 100644 libs/freetdm/src/include/ftdm_declare.h delete mode 100755 libs/freetdm/src/include/ftdm_dso.h delete mode 100644 libs/freetdm/src/include/ftdm_os.h delete mode 100644 libs/freetdm/src/include/ftdm_threadmutex.h delete mode 100644 libs/freetdm/src/include/private/fsk.h delete mode 100644 libs/freetdm/src/include/private/ftdm_buffer.h delete mode 100644 libs/freetdm/src/include/private/ftdm_config.h delete mode 100644 libs/freetdm/src/include/private/ftdm_core.h delete mode 100644 libs/freetdm/src/include/private/ftdm_cpu_monitor.h delete mode 100644 libs/freetdm/src/include/private/ftdm_sched.h delete mode 100644 libs/freetdm/src/include/private/ftdm_state.h delete mode 100755 libs/freetdm/src/include/private/ftdm_types.h delete mode 100644 libs/freetdm/src/include/private/g711.h delete mode 100644 libs/freetdm/src/include/private/hashtable.h delete mode 100644 libs/freetdm/src/include/private/hashtable_itr.h delete mode 100644 libs/freetdm/src/include/private/hashtable_private.h delete mode 100644 libs/freetdm/src/include/private/libteletone.h delete mode 100644 libs/freetdm/src/include/private/libteletone_detect.h delete mode 100644 libs/freetdm/src/include/private/libteletone_generate.h delete mode 100644 libs/freetdm/src/include/private/sangoma_tdm_api.h delete mode 100644 libs/freetdm/src/include/private/uart.h delete mode 100644 libs/freetdm/src/isdn/5ESSStateNT.c delete mode 100644 libs/freetdm/src/isdn/5ESSStateTE.c delete mode 100644 libs/freetdm/src/isdn/5ESSmes.c delete mode 100644 libs/freetdm/src/isdn/DMSStateNT.c delete mode 100644 libs/freetdm/src/isdn/DMSStateTE.c delete mode 100644 libs/freetdm/src/isdn/DMSmes.c delete mode 100644 libs/freetdm/src/isdn/EuroISDNStateNT.c delete mode 100644 libs/freetdm/src/isdn/EuroISDNStateTE.c delete mode 100644 libs/freetdm/src/isdn/Q921.c delete mode 100644 libs/freetdm/src/isdn/Q931.c delete mode 100644 libs/freetdm/src/isdn/Q931StateNT.c delete mode 100644 libs/freetdm/src/isdn/Q931StateTE.c delete mode 100644 libs/freetdm/src/isdn/Q931api.c delete mode 100644 libs/freetdm/src/isdn/Q931ie.c delete mode 100644 libs/freetdm/src/isdn/Q931mes.c delete mode 100644 libs/freetdm/src/isdn/Q932mes.c delete mode 100644 libs/freetdm/src/isdn/include/5ESS.h delete mode 100644 libs/freetdm/src/isdn/include/DMS.h delete mode 100644 libs/freetdm/src/isdn/include/Q921.h delete mode 100644 libs/freetdm/src/isdn/include/Q921priv.h delete mode 100644 libs/freetdm/src/isdn/include/Q931.h delete mode 100644 libs/freetdm/src/isdn/include/Q931ie.h delete mode 100644 libs/freetdm/src/isdn/include/Q932.h delete mode 100644 libs/freetdm/src/isdn/include/mfifo.h delete mode 100644 libs/freetdm/src/isdn/include/national.h delete mode 100644 libs/freetdm/src/isdn/mfifo.c delete mode 100644 libs/freetdm/src/isdn/nationalStateNT.c delete mode 100644 libs/freetdm/src/isdn/nationalStateTE.c delete mode 100644 libs/freetdm/src/isdn/nationalmes.c delete mode 100644 libs/freetdm/src/libteletone_detect.c delete mode 100644 libs/freetdm/src/libteletone_generate.c delete mode 100644 libs/freetdm/src/priserver.c delete mode 100644 libs/freetdm/src/sangoma_pri.c delete mode 100644 libs/freetdm/src/sangoma_pri.h delete mode 100644 libs/freetdm/src/ss7/README delete mode 100644 libs/freetdm/src/testanalog.c delete mode 100644 libs/freetdm/src/testapp.c delete mode 100644 libs/freetdm/src/testcid.c delete mode 100644 libs/freetdm/src/testisdn.c delete mode 100644 libs/freetdm/src/testpri.c delete mode 100644 libs/freetdm/src/testr2.c delete mode 100644 libs/freetdm/src/testtones.c delete mode 100644 libs/freetdm/src/uart.c diff --git a/.gitignore b/.gitignore index a4fb5ca6f6..a6cbd8cb92 100644 --- a/.gitignore +++ b/.gitignore @@ -115,15 +115,6 @@ Release/ /libs/esl/fs_ivrd /libs/esl/testclient /libs/esl/testserver -/libs/freetdm/detect_dtmf -/libs/freetdm/detect_tones -/libs/freetdm/testanalog -/libs/freetdm/testapp -/libs/freetdm/testcid -/libs/freetdm/testpri -/libs/freetdm/testr2 -/libs/freetdm/testsangomaboost -/libs/freetdm/testtones /libs/fsg729-*-installer /libs/g729/ /libs/libcodec2/compile diff --git a/bootstrap.sh b/bootstrap.sh index fa7e10ad88..b19a522044 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 freetdm unimrcp fs"; +SUBDIRS="apr libzrtp iksemel libdingaling 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 14ad5dd080..b38900047b 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -168,7 +168,7 @@ xml_int/mod_xml_cdr xml_int/mod_xml_rpc xml_int/mod_xml_scgi -#../../libs/freetdm/mod_freetdm +#mod_freetdm|https://github.com/freeswitch/freetdm.git -b master ## Experimental Modules (don't cry if they're broken) #../../contrib/mod/xml_int/mod_xml_odbc diff --git a/configure.ac b/configure.ac index 5ea8e3921e..c6a634eb95 100644 --- a/configure.ac +++ b/configure.ac @@ -2124,7 +2124,6 @@ if test "$use_system_aprutil" != "yes"; then fi AC_CONFIG_SUBDIRS([libs/iksemel]) AC_CONFIG_SUBDIRS([libs/libdingaling]) -AC_CONFIG_SUBDIRS([libs/freetdm]) AC_CONFIG_SUBDIRS([libs/unimrcp]) if test "x${enable_zrtp}" = "xyes"; then AC_CONFIG_SUBDIRS([libs/libzrtp]) diff --git a/libs/.gitignore b/libs/.gitignore index 392aaffdbd..5a83438d92 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -85,12 +85,6 @@ opal /esl/Release/ /flite-*/ /freeradius-client-*/ -/freetdm/build/compile -/freetdm/COPYING -/freetdm/INSTALL -/freetdm/Makefile.in -/freetdm/msvc/Debug/ -/freetdm/msvc/Release/ /iksemel/build/compile /iksemel/doc/Makefile /iksemel/doc/Makefile.in diff --git a/libs/freetdm/.gitignore b/libs/freetdm/.gitignore deleted file mode 100644 index da2caa7d87..0000000000 --- a/libs/freetdm/.gitignore +++ /dev/null @@ -1,39 +0,0 @@ -*.o -*.lo -*.so -*.a -*.orig -*.rej -*.log - -Makefile -config.* -configure -libtool -aclocal.m4 -build/libtool.m4 -build/ltoptions.m4 -build/ltsugar.m4 -build/ltversion.m4 -build/lt~obsolete.m4 - -testanalog -testapp -testboost -testcid -testpri -testr2 -testsangomaboost -testtones - -!/msvc/testanalog/ -!/msvc/testboost/ - -!/sample/boost/Makefile -!/sample/dso/Makefile - -freetdm.2010.sdf -/mod_freetdm/Win32/ -/msvc/Win32/ -/src/ftmod/*/Win32/ -/src/ftmod/*/x64/ diff --git a/libs/freetdm/.update b/libs/freetdm/.update deleted file mode 100644 index b537cc4f2d..0000000000 --- a/libs/freetdm/.update +++ /dev/null @@ -1 +0,0 @@ -Fri Feb 3 11:55:29 PST 2012 diff --git a/libs/freetdm/AUTHORS b/libs/freetdm/AUTHORS deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/freetdm/CMakeLists.txt b/libs/freetdm/CMakeLists.txt deleted file mode 100644 index 24cbf7c9eb..0000000000 --- a/libs/freetdm/CMakeLists.txt +++ /dev/null @@ -1,244 +0,0 @@ -# -# cmake file that generate build files for freetdm. -# this automatically includes the tests and also -# mod_freetdm -# -# Arnaldo M Pereira -# -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(freetdm) - -ADD_SUBDIRECTORY(sample) -ADD_SUBDIRECTORY(mod_freetdm) - -# includes -SET(freetdm_INCLUDES - ${PROJECT_SOURCE_DIR}/src/include - ${PROJECT_SOURCE_DIR}/src/isdn/include - ${PROJECT_SOURCE_DIR}/src/include/private - ${PROJECT_SOURCE_DIR}/src/ftmod/ftmod_sangoma_boost -) -INCLUDE_DIRECTORIES(${freetdm_INCLUDES}) -LINK_DIRECTORIES(${freetdm_BINARY_DIR}) - -# optional includes -IF(DEFINED SNGSS7) - SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_ss7) -ENDIF(DEFINED SNGSS7) - -IF(DEFINED SNGISDN) - SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_isdn) -ENDIF(DEFINED SNGISDN) - -# definitions / CFLAGS -ADD_DEFINITIONS(-DFTDM_CONFIG_DIR="/FIXME" -DFTDM_MOD_DIR="/FIXME") -IF(DEFINED WIN32) - ADD_DEFINITIONS(-DFREETDM_EXPORTS -DTELETONE_EXPORTS -DMOD_EXPORTS -DDLL_EXPORTS) -ENDIF(DEFINED WIN32) -IF(DEFINED SNGISDN) - SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_isdn) -ENDIF(DEFINED SNGISDN) - -# lib sources -SET(freetdm_SOURCES - ${PROJECT_SOURCE_DIR}/src/hashtable.c - ${PROJECT_SOURCE_DIR}/src/hashtable_itr.c - ${PROJECT_SOURCE_DIR}/src/ftdm_io.c - ${PROJECT_SOURCE_DIR}/src/ftdm_queue.c - ${PROJECT_SOURCE_DIR}/src/ftdm_sched.c - ${PROJECT_SOURCE_DIR}/src/ftdm_call_utils.c - ${PROJECT_SOURCE_DIR}/src/ftdm_config.c - ${PROJECT_SOURCE_DIR}/src/ftdm_callerid.c - ${PROJECT_SOURCE_DIR}/src/fsk.c - ${PROJECT_SOURCE_DIR}/src/uart.c - ${PROJECT_SOURCE_DIR}/src/g711.c - ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c - ${PROJECT_SOURCE_DIR}/src/libteletone_generate.c - ${PROJECT_SOURCE_DIR}/src/ftdm_buffer.c - ${PROJECT_SOURCE_DIR}/src/ftdm_threadmutex.c - ${PROJECT_SOURCE_DIR}/src/ftdm_dso.c - ${PROJECT_SOURCE_DIR}/src/ftdm_cpu_monitor.c -) - -# libfreetdm.so -ADD_LIBRARY(${PROJECT_NAME} SHARED ${freetdm_SOURCES}) - -IF(NOT DEFINED WIN32) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} m pthread dl) -ENDIF(NOT DEFINED WIN32) - -REMOVE_DEFINITIONS(-DLL_EXPORTS) - -# tools & tests -IF(NOT DEFINED WIN32) - FOREACH(TOOL testtones testpri testr2 testapp testcid) - ADD_EXECUTABLE(${TOOL} ${PROJECT_SOURCE_DIR}/src/${TOOL}.c) - TARGET_LINK_LIBRARIES(${TOOL} -l${PROJECT_NAME}) - ADD_DEPENDENCIES(${TOOL} ${PROJECT_NAME}) - ENDFOREACH(TOOL) - - ADD_EXECUTABLE(detect_dtmf - ${PROJECT_SOURCE_DIR}/src/detect_dtmf.c - ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c - ) - TARGET_LINK_LIBRARIES(detect_dtmf ${PROJECT_NAME}) - ADD_DEPENDENCIES(detect_dtmf ${PROJECT_NAME}) - - ADD_EXECUTABLE(detect_tones - ${PROJECT_SOURCE_DIR}/src/detect_tones.c - ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c - ) - TARGET_LINK_LIBRARIES(detect_tones ${PROJECT_NAME}) - ADD_DEPENDENCIES(detect_tones ${PROJECT_NAME}) - - ADD_EXECUTABLE(testanalog - ${PROJECT_SOURCE_DIR}/src/testanalog.c - ) - TARGET_LINK_LIBRARIES(testanalog -l${PROJECT_NAME}) - ADD_DEPENDENCIES(testanalog ${PROJECT_NAME}) - - # optional tests/tools - IF(HAVE_SCTP) - ADD_EXECUTABLE(testboost src/testboost.c) - TARGET_LINK_LIBRARIES(testboost ${PROJECT_NAME}) - ENDIF(HAVE_SCTP) -ELSE(NOT DEFINED WIN32) - MESSAGE(WARNING "Not building tools/tests on WIN32 yet.") -ENDIF(NOT DEFINED WIN32) - -# -# ftmod modules -# -SET(ftmod_DIR ${PROJECT_SOURCE_DIR}/src/ftmod) - -IF(DEFINED WIN32) - SET(ftmod_ADDITIONAL_SOURCES - ${PROJECT_SOURCE_DIR}/src/ftdm_io.c - ${PROJECT_SOURCE_DIR}/src/ftdm_config.c - ${PROJECT_SOURCE_DIR}/src/ftdm_queue.c - ${PROJECT_SOURCE_DIR}/src/g711.c - ) - SET(module_list skel analog analog_em) -ELSE(DEFINED WIN32) - SET(module_list skel analog analog_em zt) -ENDIF(DEFINED WIN32) - -# build default modules -FOREACH(module ${module_list}) - ADD_LIBRARY(ftmod_${module} MODULE ${ftmod_DIR}/ftmod_${module}/ftmod_${module}.c ${ftmod_ADDITIONAL_SOURCES}) - TARGET_LINK_LIBRARIES(ftmod_${module} ${PROJECT_NAME}) -ENDFOREACH(module) - -# build isdn ftmod -IF(DEFINED BUILD_FTMOD_ISDN) - SET(ftmod_isdn_SOURCES - ${PROJECT_SOURCE_DIR}/src/isdn/EuroISDNStateNT.c - ${PROJECT_SOURCE_DIR}/src/isdn/EuroISDNStateTE.c - ${PROJECT_SOURCE_DIR}/src/isdn/mfifo.c - ${PROJECT_SOURCE_DIR}/src/isdn/Q921.c - ${PROJECT_SOURCE_DIR}/src/isdn/Q931api.c - ${PROJECT_SOURCE_DIR}/src/isdn/Q931.c - ${PROJECT_SOURCE_DIR}/src/isdn/Q931ie.c - ${PROJECT_SOURCE_DIR}/src/isdn/Q931mes.c - ${PROJECT_SOURCE_DIR}/src/isdn/Q931StateNT.c - ${PROJECT_SOURCE_DIR}/src/isdn/Q931StateTE.c - ${PROJECT_SOURCE_DIR}/src/isdn/nationalmes.c - ${PROJECT_SOURCE_DIR}/src/isdn/nationalStateNT.c - ${PROJECT_SOURCE_DIR}/src/isdn/nationalStateTE.c - ${PROJECT_SOURCE_DIR}/src/isdn/DMSmes.c - ${PROJECT_SOURCE_DIR}/src/isdn/DMSStateNT.c - ${PROJECT_SOURCE_DIR}/src/isdn/DMSStateTE.c - ${PROJECT_SOURCE_DIR}/src/isdn/5ESSmes.c - ${PROJECT_SOURCE_DIR}/src/isdn/5ESSStateNT.c - ${PROJECT_SOURCE_DIR}/src/isdn/5ESSStateTE.c - ${PROJECT_SOURCE_DIR}/src/isdn/Q932mes.c - ${ftmod_DIR}/ftmod_isdn/ftmod_isdn.c - ) - IF(NOT DEFINED WIN32) - ADD_DEFINITIONS(-D_GNU_SOURCE) - ENDIF(NOT DEFINED WIN32) - ADD_LIBRARY(ftmod_isdn MODULE ${ftmod_isdn_SOURCES}) - TARGET_LINK_LIBRARIES(ftmod_isdn ${PROJECT_NAME}) -ENDIF(DEFINED BUILD_FTMOD_ISDN) - -# from now on, optionals -IF(DEFINED LIBSANGOMA) - ADD_LIBRARY(ftmod_wanpipe MODULE ${ftmod_DIR}/ftmod_wanpipe/ftmod_wanpipe.c) - IF(DEFINED WIN32) - MESSAGE(WARNING "FIXME: look for wanpipe headers on win32") - ELSE(DEFINED WIN32) - ADD_DEFINITIONS(-D__LINUX__) - INCLUDE_DIRECTORIES(/usr/include/wanpipe) - ENDIF(DEFINED WIN32) - TARGET_LINK_LIBRARIES(ftmod_wanpipe sangoma ${PROJECT_NAME}) -ENDIF(DEFINED LIBSANGOMA) - -IF(DEFINED HAVE_SCTP) - ADD_LIBRARY(ftmod_sangoma_boost MODULE - ${ftmod_DIR}/ftmod_sangoma_boost/sangoma_boost_client.c - ${ftmod_DIR}/ftmod_sangoma_boost/ftmod_sangoma_boost.c - ) - TARGET_LINK_LIBRARIES(ftmod_sangoma_boost ${PROJECT_NAME}) -ENDIF(DEFINED HAVE_SCTP) - -IF(DEFINED LIBPRI) - ADD_LIBRARY(ftmod_libpri MODULE - ${ftmod_DIR}/ftmod_libpri/libpri_client.c - ${ftmod_DIR}/ftmod_libpri/ftmod_libpri.c - ) - TARGET_LINK_LIBRARIES(ftmod_libpri ${PROJECT_NAME}) -ENDIF(DEFINED LIBPRI) - -IF(DEFINED PRITAP) - ADD_LIBRARY(ftmod_pritap MODULE - ${ftmod_DIR}/ftmod_pritap/pritap_client.c - ${ftmod_DIR}/ftmod_pritap/ftmod_pritap.c - ) - TARGET_LINK_LIBRARIES(ftmod_pritap ${PROJECT_NAME} pri) -ENDIF(DEFINED PRITAP) - -IF(DEFINED SNGSS7) - ADD_LIBRARY(ftmod_sangoma_ss7 MODULE - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c - ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c - ) - IF(NOT DEFINED WIN32) - ADD_DEFINITIONS(-D_GNU_SOURCE) - ENDIF(NOT DEFINED WIN32) - TARGET_LINK_LIBRARIES(ftmod_sangoma_ss7 ${PROJECT_NAME} sng_ss7) -ENDIF(DEFINED SNGSS7) - -IF(DEFINED SNGISDN) - ADD_LIBRARY(ftmod_sangoma_isdn MODULE - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c - ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c - ) - IF(NOT DEFINED WIN32) - ADD_DEFINITIONS(-D_GNU_SOURCE) - ENDIF(NOT DEFINED WIN32) - TARGET_LINK_LIBRARIES(ftmod_sangoma_isdn ${PROJECT_NAME} sng_isdn) -ENDIF(DEFINED SNGISDN) - -IF(DEFINED OPENR2) - ADD_LIBRARY(ftmod_r2 MODULE ${ftmod_DIR}/ftmod_r2/ftmod_r2.c) - TARGET_LINK_LIBRARIES(ftmod_r2 ${PROJECT_NAME} openr2) -ENDIF(DEFINED OPENR2) diff --git a/libs/freetdm/ChangeLog b/libs/freetdm/ChangeLog deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am deleted file mode 100644 index f6211e58e8..0000000000 --- a/libs/freetdm/Makefile.am +++ /dev/null @@ -1,290 +0,0 @@ -# Copyright (c) 2007-2014, Anthony Minessale II -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of the original author; nor the names of any contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -ACLOCAL_AMFLAGS = -I build -AUTOMAKE_OPTIONS = foreign - -SRC = src - -moddir = @modinstdir@ -libdir = @libdir@ -library_includedir = $(prefix)/include - -INCS = -I$(FT_SRCDIR)/$(SRC)/include -I$(FT_SRCDIR)/$(SRC)/include/private - -# we needed to separate CFLAGS in FTDM_COMPAT_CFLAGS and FTDM_CFLAGS due to -c99 which causes problems with wanpipe headers -FTDM_COMPAT_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_COMPAT_CFLAGS@ @DEFS@ -FTDM_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@ -COMPILE = $(CC) $(FTDM_CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE) -LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(FTDM_CFLAGS) $(LDFLAGS) -o $@ - - -# -# GNU pkgconfig file -# -EXTRA_DIST = freetdm.pc.in - -pkgconfigdir = @pkgconfigdir@ -pkgconfig_DATA = freetdm.pc - - -# -# libfreetdm -# -libfreetdm_la_SOURCES = \ - $(SRC)/hashtable.c \ - $(SRC)/hashtable_itr.c \ - $(SRC)/ftdm_io.c \ - $(SRC)/ftdm_state.c \ - $(SRC)/ftdm_queue.c \ - $(SRC)/ftdm_sched.c \ - $(SRC)/ftdm_call_utils.c \ - $(SRC)/ftdm_variables.c \ - $(SRC)/ftdm_config.c \ - $(SRC)/ftdm_callerid.c \ - $(SRC)/fsk.c \ - $(SRC)/uart.c \ - $(SRC)/g711.c \ - $(SRC)/libteletone_detect.c \ - $(SRC)/libteletone_generate.c \ - $(SRC)/ftdm_buffer.c \ - $(SRC)/ftdm_threadmutex.c \ - $(SRC)/ftdm_dso.c \ - $(SRC)/ftdm_cpu_monitor.c \ - $(SRC)/ftdm_backtrace.c - -library_include_HEADERS = \ - $(SRC)/include/freetdm.h \ - $(SRC)/include/ftdm_declare.h \ - $(SRC)/include/ftdm_threadmutex.h \ - $(SRC)/include/ftdm_os.h \ - $(SRC)/include/ftdm_call_utils.h \ - $(SRC)/include/ftdm_dso.h - -lib_LTLIBRARIES = libfreetdm.la -libfreetdm_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -libfreetdm_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) -libfreetdm_la_LIBADD = $(LIBS) - -core: libfreetdm.la -core-install: install-libLTLIBRARIES - -# -# tools & test programs -# -noinst_PROGRAMS = testtones detect_tones detect_dtmf testpri testr2 testanalog testapp testcid - -testapp_SOURCES = $(SRC)/testapp.c -testapp_LDADD = libfreetdm.la -testapp_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -testcid_SOURCES = $(SRC)/testcid.c -testcid_LDADD = libfreetdm.la -testcid_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -testtones_SOURCES = $(SRC)/testtones.c -testtones_LDADD = libfreetdm.la -testtones_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -detect_tones_SOURCES = $(SRC)/detect_tones.c -detect_tones_LDADD = libfreetdm.la -detect_tones_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -detect_dtmf_SOURCES = $(SRC)/detect_dtmf.c -detect_dtmf_LDADD = libfreetdm.la -detect_dtmf_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -#testisdn_SOURCES = $(SRC)/testisdn.c -#testisdn_LDADD = libfreetdm.la -#testisdn_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -testpri_SOURCES = $(SRC)/testpri.c -testpri_LDADD = libfreetdm.la -testpri_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -testr2_SOURCES = $(SRC)/testr2.c -testr2_LDADD = libfreetdm.la -testr2_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -testanalog_SOURCES = $(SRC)/testanalog.c -testanalog_LDADD = libfreetdm.la -testanalog_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) - -# -# ftmod modules -# -mod_LTLIBRARIES = ftmod_zt.la ftmod_skel.la ftmod_analog.la ftmod_analog_em.la - -ftmod_zt_la_SOURCES = $(SRC)/ftmod/ftmod_zt/ftmod_zt.c -ftmod_zt_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -ftmod_zt_la_LDFLAGS = -shared -module -avoid-version -ftmod_zt_la_LIBADD = libfreetdm.la - -ftmod_skel_la_SOURCES = $(SRC)/ftmod/ftmod_skel/ftmod_skel.c -ftmod_skel_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -ftmod_skel_la_LDFLAGS = -shared -module -avoid-version -ftmod_skel_la_LIBADD = libfreetdm.la - -ftmod_analog_la_SOURCES = $(SRC)/ftmod/ftmod_analog/ftmod_analog.c -ftmod_analog_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -ftmod_analog_la_LDFLAGS = -shared -module -avoid-version -ftmod_analog_la_LIBADD = libfreetdm.la - -ftmod_analog_em_la_SOURCES = $(SRC)/ftmod/ftmod_analog_em/ftmod_analog_em.c -ftmod_analog_em_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -ftmod_analog_em_la_LDFLAGS = -shared -module -avoid-version -ftmod_analog_em_la_LIBADD = libfreetdm.la - -if HAVE_LIBSANGOMA -mod_LTLIBRARIES += ftmod_wanpipe.la -ftmod_wanpipe_la_SOURCES = $(SRC)/ftmod/ftmod_wanpipe/ftmod_wanpipe.c -# some structures within Wanpipe drivers are not c99 compatible, so we need to compile ftmod_wanpipe -# without c99 flags, use FTDM_COMPAT_CFLAGS instead -ftmod_wanpipe_la_CFLAGS = $(FTDM_COMPAT_CFLAGS) $(AM_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe -ftmod_wanpipe_la_LDFLAGS = -shared -module -avoid-version -ftmod_wanpipe_la_LIBADD = libfreetdm.la -lsangoma -endif - -if HAVE_LIBISDN -mod_LTLIBRARIES += ftmod_isdn.la -ftmod_isdn_la_SOURCES = $(SRC)/ftmod/ftmod_isdn/ftmod_isdn.c -ftmod_isdn_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -D_GNU_SOURCE $(LIBISDN_CPPFLAGS) $(PCAP_CPPFLAGS) -ftmod_isdn_la_LDFLAGS = -shared -module -avoid-version $(LIBISDN_LDFLAGS) $(PCAP_LDFLAGS) -ftmod_isdn_la_LIBADD = libfreetdm.la $(LIBISDN_LIBS) $(PCAP_LIBS) -endif - -if HAVE_LIBPRI -mod_LTLIBRARIES += ftmod_libpri.la -ftmod_libpri_la_SOURCES = $(SRC)/ftmod/ftmod_libpri/ftmod_libpri.c $(SRC)/ftmod/ftmod_libpri/lpwrap_pri.c -ftmod_libpri_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) $(LIBPRI_CPPFLAGS) -ftmod_libpri_la_LDFLAGS = -shared -module -avoid-version $(LIBPRI_LDFLAGS) -ftmod_libpri_la_LIBADD = libfreetdm.la $(LIBPRI_LIBS) -endif - -if HAVE_PRITAP -mod_LTLIBRARIES += ftmod_pritap.la -ftmod_pritap_la_SOURCES = $(SRC)/ftmod/ftmod_pritap/ftmod_pritap.c -ftmod_pritap_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -ftmod_pritap_la_LDFLAGS = -shared -module -avoid-version -ftmod_pritap_la_LIBADD = libfreetdm.la -lpri -endif - -if HAVE_SNG_SS7 -mod_LTLIBRARIES += ftmod_sangoma_ss7.la -ftmod_sangoma_ss7_la_SOURCES = \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c - -ftmod_sangoma_ss7_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -D_GNU_SOURCE -ftmod_sangoma_ss7_la_LDFLAGS = -shared -module -avoid-version -ftmod_sangoma_ss7_la_LIBADD = libfreetdm.la -lsng_ss7 -endif - -if HAVE_SNG_ISDN -mod_LTLIBRARIES += ftmod_sangoma_isdn.la -ftmod_sangoma_isdn_la_SOURCES = \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c - -ftmod_sangoma_isdn_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -D_GNU_SOURCE -ftmod_sangoma_isdn_la_LDFLAGS = -shared -module -avoid-version -ftmod_sangoma_isdn_la_LIBADD = libfreetdm.la -lsng_isdn -endif - -if HAVE_OPENR2 -mod_LTLIBRARIES += ftmod_r2.la -ftmod_r2_la_SOURCES = $(SRC)/ftmod/ftmod_r2/ftmod_r2.c $(SRC)/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.c -ftmod_r2_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -ftmod_r2_la_LDFLAGS = -shared -module -avoid-version -ftmod_r2_la_LIBADD = libfreetdm.la -lopenr2 -endif - -if HAVE_WAT -mod_LTLIBRARIES += ftmod_gsm.la -ftmod_gsm_la_SOURCES = $(SRC)/ftmod/ftmod_gsm/ftmod_gsm.c -ftmod_gsm_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -ftmod_gsm_la_LDFLAGS = -shared -module -avoid-version -ftmod_gsm_la_LIBADD = libfreetdm.la -lwat -endif - -if HAVE_MISDN -mod_LTLIBRARIES += ftmod_misdn.la -ftmod_misdn_la_SOURCES = $(SRC)/ftmod/ftmod_misdn/ftmod_misdn.c -ftmod_misdn_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) $(MISDN_CFLAGS) -D_GNU_SOURCE -ftmod_misdn_la_LDFLAGS = -shared -module -avoid-version -ftmod_misdn_la_LIBADD = libfreetdm.la -endif - -dox doxygen: - doxygen $(FT_SRCDIR)/docs/Doxygen.conf - -mod_freetdm/mod_freetdm.so: libfreetdm.la mod_freetdm/mod_freetdm.c - $(MAKE) -C mod_freetdm - -mod_freetdm: mod_freetdm/mod_freetdm.so - -mod_freetdm-install: mod_freetdm - $(MAKE) -C mod_freetdm install - -mod_freetdm-clean: - @if [ -f mod_freetdm/mod_freetdm.so ] ; then \ - $(MAKE) -C mod_freetdm clean ; \ - fi - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(prefix) - $(mkinstalldirs) $(DESTDIR)@confdir@ - @[ -f "$(DESTDIR)@confdir@/freetdm.conf" ] || ( cp conf/*.conf $(DESTDIR)@confdir@) - @echo FreeTDM Installed diff --git a/libs/freetdm/NEWS b/libs/freetdm/NEWS deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/freetdm/README b/libs/freetdm/README deleted file mode 100644 index 4ca13d19c9..0000000000 --- a/libs/freetdm/README +++ /dev/null @@ -1,3 +0,0 @@ -FreeTDM -http://wiki.freeswitch.org/wiki/FreeTDM - diff --git a/libs/freetdm/TODO b/libs/freetdm/TODO deleted file mode 100644 index 6b4cf71f5f..0000000000 --- a/libs/freetdm/TODO +++ /dev/null @@ -1,22 +0,0 @@ -== Interface inconsistency == -- enum_id member of ftdm_event_t is inconsistent. Most of the time is just for OOB events, the only other - type of event as of now is FTDM_EVENT_DTMF and is not using the enum_id member. I think we can get rid - of the FTDM_EVENT_DTMF and create ftdm_dtmf_event_t type instead of reusing ftdm_event_t - then ftdm_event_t would be renamed to ftdm_oob_event_t and the enum_id renamed to type, then ftdm_span_next_event() - will only return OOB events - -- Deprecate last_error members. - It requires a lot of discipline to set the last_error string for every failure. - It does not add much value to the user either, most of the errors are criptic and - cannot be shown to end users, we already provide extensive logging for problem - troubleshooting. - -- Implement threaded IO. - Currently IO modules only work on-demand, where the user (ie, FreeSWITCH) drives the read/write - of media. If the user stops reading, some functions are not possible - (DTMF detection or Hangup tone detection). It would be useful to implement a FreeTDM mode - where the media is driven by a group of threads that are always reading (and possibly writing) - then when the user does ftdm_channel_read(), the media would be read from the buffers filled - by the media thread and not from the underlying IO device, this gives a chance to FreeTDM to - still perform hangup detection or other media services even if the application is not reading. - diff --git a/libs/freetdm/acinclude.m4 b/libs/freetdm/acinclude.m4 deleted file mode 100644 index 097278b6ef..0000000000 --- a/libs/freetdm/acinclude.m4 +++ /dev/null @@ -1,2 +0,0 @@ -m4_include([build/ax_compiler_vendor.m4]) -m4_include([build/libpcap.m4]) diff --git a/libs/freetdm/bootstrap b/libs/freetdm/bootstrap deleted file mode 100755 index 247d396da5..0000000000 --- a/libs/freetdm/bootstrap +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -autoheader -libtoolize --force --copy -aclocal -automake -f --copy --add-missing -autoconf diff --git a/libs/freetdm/build/ax_compiler_vendor.m4 b/libs/freetdm/build/ax_compiler_vendor.m4 deleted file mode 100644 index a24a58da0f..0000000000 --- a/libs/freetdm/build/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/freetdm/build/libpcap.m4 b/libs/freetdm/build/libpcap.m4 deleted file mode 100644 index ea7581e69b..0000000000 --- a/libs/freetdm/build/libpcap.m4 +++ /dev/null @@ -1,150 +0,0 @@ -dnl libpcap.m4--PCAP libraries and includes -dnl Derrick Brashear -dnl from KTH krb and Arla -dnl $Id: libpcap.m4,v 1.4 2006/01/20 20:21:09 snsimon Exp $ -dnl 2010/10/31 (stkn): -dnl rename: PCAP_INC_FLAGS -> PCAP_CPPFLAGS -dnl rename: PCAP_LIB_FLAGS -> PCAP_LDFLAGS (-L flags only) -dnl add: PCAP_LIBS (libs only) - -AC_DEFUN([PCAP_INC_WHERE1], [ -ac_cv_found_pcap_inc=no -if test -f "$1/pcap.h" ; then - ac_cv_found_pcap_inc=yes -fi -]) - -AC_DEFUN([PCAP_INC_WHERE], [ - for i in $1; do - AC_MSG_CHECKING(for pcap header in $i) - PCAP_INC_WHERE1($i) - if test "$ac_cv_found_pcap_inc" = "yes"; then - ac_cv_pcap_where_inc=$i - AC_MSG_RESULT(found) - break - else - AC_MSG_RESULT(no found) - fi - done -]) - -AC_DEFUN([PCAP_LIB_WHERE1], [ -saved_LIBS=$LIBS -LIBS="$saved_LIBS -L$1 -lpcap" -AC_TRY_LINK(, -[pcap_lookupdev("");], -[ac_cv_found_pcap_lib=yes], -ac_cv_found_pcap_lib=no) -LIBS=$saved_LIBS -]) - -AC_DEFUN([TEST_LIBPATH], [ -changequote(<<, >>) -define(<>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>)) -changequote([, ]) -if test "$AC_CV_FOUND" = "yes"; then - if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl" -a \! -r "$1/lib$2.dylib"; then - AC_CV_FOUND=no - fi -fi -]) - - -AC_DEFUN([PCAP_LIB_WHERE], [ - for i in $1; do - AC_MSG_CHECKING(for pcap library in $i) - PCAP_LIB_WHERE1($i) - TEST_LIBPATH($i, pcap) - if test "$ac_cv_found_pcap_lib" = "yes" ; then - ac_cv_pcap_where_lib=$i - AC_MSG_RESULT(found) - break - else - AC_MSG_RESULT(no found) - fi - done -]) - -AC_DEFUN([FIND_LIB_SUBDIR], -[dnl -AC_ARG_WITH([lib-subdir], AC_HELP_STRING([--with-lib-subdir=DIR],[Find libraries in DIR instead of lib])) -AC_CHECK_SIZEOF(long) -AC_CACHE_CHECK([what directory libraries are found in], [ac_cv_cmu_lib_subdir], -[test "X$with_lib_subdir" = "Xyes" && with_lib_subdir= -test "X$with_lib_subdir" = "Xno" && with_lib_subdir= - if test "X$with_lib_subdir" = "X" ; then - ac_cv_cmu_lib_subdir=lib - if test $ac_cv_sizeof_long -eq 4 ; then - test -d /usr/lib32 && ac_cv_cmu_lib_subdir=lib32 - test -r /usr/lib/libpcap.so && ac_cv_cmu_lib_subdir=lib - fi - if test $ac_cv_sizeof_long -eq 8 ; then - test -d /usr/lib64 && ac_cv_cmu_lib_subdir=lib64 - fi - else - ac_cv_cmu_lib_subdir=$with_lib_subdir - fi]) - AC_SUBST(LIB_SUBDIR, $ac_cv_cmu_lib_subdir) - ]) - - -AC_DEFUN([AX_LIB_PCAP], [ -AC_REQUIRE([FIND_LIB_SUBDIR]) -AC_ARG_WITH(pcap, - [ --with-pcap=PREFIX Compile with PCAP support], - [if test "X$with_pcap" = "X"; then - with_pcap=yes - fi]) -AC_ARG_WITH(pcap-lib, - [ --with-pcap-lib=dir use pcap libraries in dir], - [if test "$withval" = "yes" -o "$withval" = "no"; then - AC_MSG_ERROR([No argument for --with-pcap-lib]) - fi]) -AC_ARG_WITH(pcap-include, - [ --with-pcap-include=dir use pcap headers in dir], - [if test "$withval" = "yes" -o "$withval" = "no"; then - AC_MSG_ERROR([No argument for --with-pcap-include]) - fi]) - - if test "X$with_pcap" != "X"; then - if test "$with_pcap" != "yes"; then - ac_cv_pcap_where_lib=$with_pcap - ac_cv_pcap_where_inc=$with_pcap/include - fi - fi - - if test "X$with_pcap_lib" != "X"; then - ac_cv_pcap_where_lib=$with_pcap_lib - fi - if test "X$ac_cv_pcap_where_lib" = "X"; then - PCAP_LIB_WHERE(/usr/$LIB_SUBDIR /usr/local/$LIB_SUBDIR) - fi - - if test "X$with_pcap_include" != "X"; then - ac_cv_pcap_where_inc=$with_pcap_include - fi - if test "X$ac_cv_pcap_where_inc" = "X"; then - PCAP_INC_WHERE(/usr/ng/include /usr/include /usr/local/include) - fi - - AC_MSG_CHECKING(whether to include pcap) - if test "X$ac_cv_pcap_where_lib" != "X" -a "X$ac_cv_pcap_where_inc" != "X"; then - ac_cv_found_pcap=yes - AC_MSG_RESULT(yes) - PCAP_INC_DIR=$ac_cv_pcap_where_inc - PCAP_LIB_DIR=$ac_cv_pcap_where_lib - PCAP_CPPFLAGS="-I${PCAP_INC_DIR}" - PCAP_LDFLAGS="-L${PCAP_LIB_DIR}" - PCAP_LIBS="-lpcap" - AC_SUBST(PCAP_INC_DIR) - AC_SUBST(PCAP_LIB_DIR) - AC_SUBST(PCAP_CPPFLAGS) - AC_SUBST(PCAP_LDFLAGS) - AC_SUBST(PCAP_LIBS) - AC_DEFINE([HAVE_LIBPCAP],[1],[libpcap]) - else - ac_cv_found_pcap=no - AC_MSG_RESULT(no) - fi - ]) - diff --git a/libs/freetdm/conf/freetdm.conf b/libs/freetdm/conf/freetdm.conf deleted file mode 100644 index 0d53992979..0000000000 --- a/libs/freetdm/conf/freetdm.conf +++ /dev/null @@ -1,82 +0,0 @@ -; !! THIS IS A SAMPLE CONFIGURATION ONLY !! - -; refer to http://wiki.freeswitch.org/wiki/FreeTDM for further documentation - -[general] -; whether to launch a thread for CPU usage monitoring -cpu_monitor => no - -; How often (in milliseconds) monitor CPU usage -cpu_monitoring_interval => 1000 - -; At what CPU percentage raise a CPU alarm -cpu_set_alarm_threshold => 80 - -; At what CPU percentage stop the CPU alarm -cpu_clear_alarm_threshold => 70 - -; Which action to take when the CPU alarm is raised -; it can be warn and/or reject calls -; cpu_alarm_action => warn,reject -cpu_alarm_action => warn - -; Where to dump DTMF debug files (see per span debugdtmf=yes option) -debugdtmf_directory=/full/path/to/dtmf/directory - -; spans are defined with [span ] -; the span type can either be zt, wanpipe or pika -; the span name can be any unique string -[span wanpipe myWanpipe] - -; valid trunk types are: FXO, FXS, EM, E1, T1, J1, BRI, BRI_PTMP -trunk_type => FXS - -; add FXS channels from 3 to 4 at wanpipe span 1 to this freetdm span -fxs-channel => 1:3-4 - -; IO stats. Defaults to yes, you can print the stats with ftdm iostats print -; This feature depends on the span IO type, currently only Wanpipe spans support it -; This may cause a warning to be printed once in a while if audio is not provided fast enough -; and causes the driver to transmit an idle frame (when there is no data provided by the application) -iostats => yes - -[span wanpipe myWanpipe2] -trunk_type => FXO -; This number will be used as DNIS for FXO devices -fxo-channel => 1:1-2 - -[span zt myZaptelSpan] -number => 9999 -fxs-channel => 1 - -[span zt mySecondZaptelSpan] -; This number will be used as DNIS for FXO devices -number => 2 -fxo-channel => 3 - -; MFC-R2 typical span configuration - -; MFC-R2 with wanpipe (Sangoma) -[span wanpipe myWanpipeSpan] -trunk_type => E1 -cas-channel => 1-15:1101 -cas-channel => 17-31:1101 - -; MFC-R2 with Zaptel/DAHDI -[span zt myWanpipeSpan] -trunk_type => E1 -cas-channel => 1-15:1101 -cas-channel => 17-31:1101 - -; generic channel parameters -; this parameters are accepted by any type of span/channel -; remember that for generic channel parameters only channels -; below the parameter within the span will be affected - -; Channel audio gain -; rxgain => 0.0 -; txgain => 0.0 - -; Whether to perform media dumps for DTMF debugging -; debugdtmf => yes - diff --git a/libs/freetdm/conf/freetdm.conf.xml b/libs/freetdm/conf/freetdm.conf.xml deleted file mode 100644 index 0b006dc704..0000000000 --- a/libs/freetdm/conf/freetdm.conf.xml +++ /dev/null @@ -1,633 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/conf/pika.conf b/libs/freetdm/conf/pika.conf deleted file mode 100644 index 01629fd08e..0000000000 --- a/libs/freetdm/conf/pika.conf +++ /dev/null @@ -1,43 +0,0 @@ -; you dont need this file unless you use PIKA boards - -; each category is a config profile -; to apply the profile append it to a channel def in -; freetdm.conf with @ -; e.g. -; [span pika] -; name => pika -; number => pika -; fxs-channel => 1:0:1-12@default - -[default] -; region is na or eu -;region => na -;rx-gain => 0.00 -;rx-agc-enabled => false -;rx-agc-targetPower => -15.00 -;rx-agc-minGain => -6.00 -;rx-agc-maxGain => 18.00 -;rx-agc-attackRate => 170 -;rx-agc-decayRate => 750 -;rx-agc-speechThreshold => -36.00 -;rx-vad-enabled => false -;rx-vad-activationThreshold => -40.00 -;rx-vad-activationDebounceTime => 72 -;rx-vad-deactivationThreshold => -40.00 -;rx-vad-deactivationDebounceTime => 984 -;rx-vad-preSpeechBufferSize => 240 -;tx-gain => 0.00 -;tx-agc-enabled => true -;tx-agc-targetPower => -15.00 -;tx-agc-minGain => -6.00 -;tx-agc-maxGain => 18.00 -;tx-agc-attackRate => 170 -;tx-agc-decayRate => 750 -;tx-agc-speechThreshold => -36.00 -;ec-enabled => false -;ec-doubleTalkerThreshold => -6.00 -;ec-speechPresentThreshold => -40.00 -;ec-echoSuppressionThreshold => -18.00 -;ec-echoSuppressionEnabled => true -;ec-comfortNoiseEnabled => true -;ec-adaptationModeEnabled => true diff --git a/libs/freetdm/conf/tones.conf b/libs/freetdm/conf/tones.conf deleted file mode 100644 index 9bb0b43e92..0000000000 --- a/libs/freetdm/conf/tones.conf +++ /dev/null @@ -1,142 +0,0 @@ -[us] -generate-dial => v=-7;%(1000,0,350,440) -detect-dial => 350,440 - -generate-ring => v=-7;%(2000,4000,440,480) -detect-ring => 440,480 - -generate-busy => v=-7;%(500,500,480,620) -detect-busy => 480,620 - -generate-attn => v=0;%(100,100,1400,2060,2450,2600) -detect-attn => 1400,2060,2450,2600 - -generate-callwaiting-sas => v=0;%(300,0,440) -detect-callwaiting-sas => 440 - -generate-callwaiting-cas => v=0;%(80,0,2750,2130) -detect-callwaiting-cas => 2750,2130 - -detect-fail1 => 913.8 -detect-fail2 => 1370.6 -detect-fail3 => 1776.7 - - -[sg] -generate-dial => v=-7;%(1000,0,425) -detect-dial => 425 - -generate-ring => v=-7;%(2000,4000,425) -detect-ring => 425 - -generate-busy => v=-7;%(750,750,425) -detect-busy => 425 - -generate-attn => v=0;%(100,100,1400,2060,2450,2600) -detect-attn => 1400,2060,2450,2600 - -generate-callwaiting-sas => v=0;%(300,0,440) -detect-callwaiting-sas => 440 - -generate-callwaiting-cas => v=0;%(80,0,2750,2130) -detect-callwaiting-cas => 2750,2130 - -detect-fail1 => 913.8 -detect-fail2 => 1370.6 -detect-fail3 => 1776.7 - - -[ru] -generate-dial => v=-7;%(1000,425) -detect-dial => 0 - -generate-ring => v=-7;%(800,5000,425,0) -detect-ring => 425,0 - -generate-busy => v=-7;%(350,350,425,0) -detect-busy => 425,0 - -generate-attn => v=0;%(100,100,1400,2060,2450,2600) -detect-attn => 1400,2060,2450,2600 - -generate-callwaiting-sas => v=0;%(300,0,440) -detect-callwaiting-sas => 440,480 - -generate-callwaiting-cas => v=0;%(80,0,2750,2130) -detect-callwaiting-cas => 2750,2130 - -detect-fail1 => 913.8 -detect-fail2 => 1370.6 -detect-fail3 => 1776.7 - - -[in] -generate-dial => v=-7;%(1000,0,375,425) -detect-dial => 375,425 - -generate-ring => v=-7;%(2000,4000,440,480) -detect-ring => 440,480 - -generate-busy => v=-7;%(500,500,480,620) -detect-busy => 480,620 - -generate-attn => v=0;%(100,100,1400,2060,2450,2600) -detect-attn => 1400,2060,2450,2600 - -generate-callwaiting-sas => v=0;%(300,0,440) -detect-callwaiting-sas => 440 - -generate-callwaiting-cas => v=0;%(80,0,2750,2130) -detect-callwaiting-cas => 2750,2130 - -detect-fail1 => 913.8 -detect-fail2 => 1370.6 -detect-fail3 => 776.7 - - -[th] -generate-dial => v=-7;%(1000,0,400,400) -detect-dial => 400,400 - -generate-ring => v=-7;%(2000,4000,400,400) -detect-ring => 400,400 - -generate-busy => v=-7;%(500,500,480,620) -detect-busy => 480,620 - -generate-attn => v=0;%(100,100,1400,2060,2450,2600) -detect-attn => 1400,2060,2450,2600 - -generate-callwaiting-sas => v=0;%(300,0,440) -detect-callwaiting-sas => 440 - -generate-callwaiting-cas => v=0;%(80,0,2750,2130) -detect-callwaiting-cas => 2750,2130 - -detect-fail1 => 913.8 -detect-fail2 => 1370.6 -detect-fail3 => 1776.7 - - -[au] -generate-dial => v=-7;%(1000,0,413,438) -detect-dial => 413,438 - -generate-ring => v=-7;%(400,200,413,438);%(400,2000,413,438) -detect-ring => 413,438 - -generate-busy => v=-7;%(375,375,425) -detect-busy => 425 - -generate-attn => v=0;%(100,100,1400,2060,2450,2600) -detect-attn => 1400,2060,2450,2600 - -generate-callwaiting-sas => v=0;%(300,0,440) -detect-callwaiting-sas => 440 - -generate-callwaiting-cas => v=0;%(80,0,2750,2130) -detect-callwaiting-cas => 2750,2130 - -detect-fail1 => 913.8 -detect-fail2 => 1370.6 -detect-fail3 => 776.7 diff --git a/libs/freetdm/conf/wanpipe.conf b/libs/freetdm/conf/wanpipe.conf deleted file mode 100644 index 3784eaf17a..0000000000 --- a/libs/freetdm/conf/wanpipe.conf +++ /dev/null @@ -1,13 +0,0 @@ -[defaults] -; User space interval at which data will be delivered -codec_ms => 20 - -; wink and flash interval -wink_ms => 150 -flash_ms => 750 - -; size of the driver queue of elements of MTU size -; typical case is 10 elements of 80 bytes each (10ms of ulaw/alaw) -; don't mess with this if you don't know what you're doing -; txqueue_size => 10 -; rxqueue_size => 10 diff --git a/libs/freetdm/conf/zt.conf b/libs/freetdm/conf/zt.conf deleted file mode 100644 index a060a40315..0000000000 --- a/libs/freetdm/conf/zt.conf +++ /dev/null @@ -1,8 +0,0 @@ -[defaults] -codec_ms => 20 -wink_ms => 150 -flash_ms => 750 -echo_cancel_level => 64 -rxgain => 0.0 -txgain => 0.0 - diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac deleted file mode 100644 index e6aad59e52..0000000000 --- a/libs/freetdm/configure.ac +++ /dev/null @@ -1,480 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.59]) -AC_INIT([freetdm], [0.1], [bugs@freeswitch.org]) -AC_CONFIG_SRCDIR([src/ftdm_io.c]) - -AC_CONFIG_AUX_DIR([build]) -AC_CONFIG_MACRO_DIR([build]) -AM_INIT_AUTOMAKE - -# >=automake-1.11 -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -# override some default libtool behavior and invoke AC_PROG_LIBTOOL -# (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html) -m4_defun([_LT_AC_LANG_F77_CONFIG], [:]) -m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:]) -m4_defun([_LT_AC_LANG_RC_CONFIG], [:]) - -# Checks for programs. -AC_PROG_CC -AC_PROG_MAKE_SET -AM_PROG_CC_C_O -AC_PROG_LIBTOOL -AC_PROG_INSTALL - -# NOTE: pkg-config is used to detect libisdn -m4_ifdef([PKG_PROG_PKG_CONFIG], - [PKG_PROG_PKG_CONFIG], - [AC_MSG_WARN([pkg-config missing (required for libisdn detection)])] -) - -AX_COMPILER_VENDOR - -# AC_PREFIX_DEFAULT does not get expanded until too late so we need -# to do this to use prefix in this script -AC_PREFIX_DEFAULT([/usr/local/freetdm]) -if test "x${prefix}" = "xNONE" ; then - prefix='/usr/local/freetdm' -fi - -# Absolute source/build directory -FT_SRCDIR=`(cd $srcdir && pwd)` -ft_builddir=`pwd` -AC_SUBST([FT_SRCDIR]) -AC_SUBST([ft_builddir]) - -if test "$sysconfdir" = "\${prefix}/etc" ; then - confdir="$prefix/conf" -else - confdir="$sysconfdir" -fi - -AC_SUBST([confdir]) - -DEFAULT_INCLUDES="-I. -I./src/include -I\$(srcdir)" -AC_SUBST([DEFAULT_INCLUDES]) - -# Where to install the modules -AC_ARG_WITH([modinstdir], - [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: ${prefix}/mod)])], - [case "${withval}" in - no|yes) AC_MSG_ERROR([Invalid value \"${withval}\", option requires a valid path]) ;; - *) modinstdir="${withval}" ;; - esac], - [modinstdir="${prefix}/mod"] -) -AC_SUBST([modinstdir]) - -# freetdm.pc pkgconfig file -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir=DIR], [Installation directory for pkgconfig file (default: ${libdir}/pkgconfig)])], - [case "${withval}" in - yes|no) AC_MSG_ERROR([Invalid value ${withval} for option --with-pkgconfigdir]) ;; - *) pkgconfigdir="${withval}" ;; - esac - ], - [pkgconfigdir="${libdir}/pkgconfig"] -) -AC_SUBST([pkgconfigdir]) - -AC_ARG_ENABLE([enable_64], - [AS_HELP_STRING([--enable-64], [Enable 64bit compilation])], - [enable_64="${enableval}"], - [enable_64="no"] -) - -case "${ax_cv_c_compiler_vendor}" in -gnu) - COMP_VENDOR_CFLAGS="-ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0" - ;; -sun) - COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -xvpara" - if test "$enable_64" != "no" ; then - COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS" - fi - ;; -*) - COMP_VENDOR_COMPAT_CFLAGS="-Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" - COMP_VENDOR_CFLAGS="-std=c99 $COMP_VENDOR_COMPAT_CFLAGS" - ;; -esac -AC_SUBST([COMP_VENDOR_COMPAT_CFLAGS]) -AC_SUBST([COMP_VENDOR_CFLAGS]) - - -# Enable debugging -AC_ARG_ENABLE([debug], - [AC_HELP_STRING([--enable-debug], [build with debug information])], - [enable_debug="${enableval}"], - [enable_debug="yes"] -) -if test "${enable_debug}" != "no"; then - AC_DEFINE([DEBUG], [], [Enable extra debugging.]) - - if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then - COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS -g -ggdb" - fi -fi -AC_SUBST([COMP_VENDOR_CFLAGS]) - -AC_CHECK_LIB([dl], [dlopen]) -AC_CHECK_LIB([pthread], [pthread_create]) -AC_CHECK_LIB([m], [cos]) - -AC_CHECK_HEADERS([netdb.h sys/select.h execinfo.h]) - -AC_CHECK_FUNC([gethostbyname_r], - [], [AC_CHECK_LIB([nsl], [gethostbyname_r])] -) -if test "$ac_cv_func_gethostbyname_r" = "yes" -o "$ac_cv_lib_nsl_gethostbyname_r" = "yes" -then - AC_MSG_CHECKING([whether gethostbyname_r requires five arguments]) - - ac_cv_func_gethostbyname_r_five_args="no" - - AC_TRY_COMPILE([#include ], - [char *name; - struct hostent *he, *res; - char buffer[2048]; - int buflen = 2048; - (void)gethostbyname_r(name, he, buffer, buflen, &res)], - [ac_cv_func_gethostbyname_r_five_args="yes" - AC_DEFINE([HAVE_GETHOSTBYNAME_R_FIVE], [1], [gethostbyname_r has five arguments])] - ) - - AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args]) - AC_DEFINE([HAVE_GETHOSTBYNAME_R], [1], [threadsafe gethostbyname]) -fi - -## -## Modules and optional features -## -AC_MSG_RESULT([${as_nl}<<>> Modules and optional features]) - -## -# pritap (TODO: add checks) -# -HAVE_PRITAP="no" -AC_ARG_WITH([pritap], - [AS_HELP_STRING([--with-pritap], [Install ftmod_pritap])], - [case "${withval}" in - no) enable_pritap="no" ;; - *) enable_pritap="yes" ;; - esac], - [enable_pritap="no"] -) -HAVE_PRITAP="${enable_pritap}" -AM_CONDITIONAL([HAVE_PRITAP],[test "${enable_pritap}" = "yes"]) - -## -# OpenR2 stack -# -HAVE_OPENR2="no" -AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [HAVE_OPENR2="yes"]) -AC_MSG_RESULT([checking whether to build ftmod_r2... ${HAVE_OPENR2}]) -AM_CONDITIONAL([HAVE_OPENR2], [test "${HAVE_OPENR2}" = "yes"]) - -## -# WAT GSM stack -# -HAVE_WAT="no" -AC_CHECK_LIB([wat], [wat_version], [HAVE_WAT="yes"]) -AC_MSG_RESULT([checking whether to build ftmod_wat... ${HAVE_WAT}]) -AM_CONDITIONAL([HAVE_WAT], [test "${HAVE_WAT}" = "yes"]) - -## -# Digium libpri (TODO: add checks) -# -HAVE_LIBPRI="no" -AC_ARG_WITH([libpri], - [AS_HELP_STRING([--with-libpri@<:@=PREFIX@:>@], [Install ftmod_libpri])], - [case "${withval}" in - no|yes) with_libpri="${withval}" ;; - *) AS_IF([test -d "${withval}"], - [with_libpri="${withval}"], - [AC_MSG_ERROR([Invalid argument for --with-libpri, \"${withval}\" is not a directory])] - ) ;; - esac], - [with_libpri="no"] -) -if test "x${with_libpri}" != "xno" -then - save_LIBS="${LIBS}" - save_CPPFLAGS="${CPPFLAGS}" - save_LDFLAGS="${LDFLAGS}" - - LIBPRI_CPPFLAGS="" - LIBPRI_LDFLAGS="" - - AC_MSG_RESULT([${as_nl}<<>> Digium libpri]) - - AS_IF([test "x${with_libpri}" != "xyes"], - [LIBPRI_CPPFLAGS="-I${with_libpri}/include" - LIBPRI_LDFLAGS="-L${with_libpri}/lib"], - ) - - LDFLAGS="${save_LDFLAGS} ${LIBPRI_LDFLAGS}" - CPPFLAGS="${save_CPPFLAGS} ${LIBPRI_CPPFLAGS}" - LIBS="${LIBS} -lpri" - - AC_MSG_CHECKING([whether libpri is usable]) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include ], - [const char *version = pri_get_version(); - (void)version;] - )], - [AC_MSG_RESULT([yes]) - HAVE_LIBPRI="yes"], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([libpri not found or unusable (see config.log for details)])] - ) - - AC_MSG_CHECKING([whether libpri is too old]) - AC_PREPROC_IFELSE( - [AC_LANG_PROGRAM( - [#include ], - [#if !defined(PRI_IO_FUNCS) - #error "libpri is lacking PRI_IO_FUNCS" - #elif !defined(PRI_NEW_SET_API) - #error "libpri is lacking PRI_NEW_SET_API" - #endif] - )], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([yes]) - AC_MSG_ERROR([Your version of libpri is too old (pre 1.2), please update!])] - ) - - AC_MSG_CHECKING([whether libpri has BRI support]) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [extern void pri_new_bri_cb(void);], - [pri_new_bri_cb();] - )], - [AC_DEFINE([HAVE_LIBPRI_BRI], [1], [libpri has BRI support]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for BRI support])] - ) - - AC_MSG_CHECKING([whether libpri has AOC event support]) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [extern void pri_aoc_events_enable(void);], - [pri_aoc_events_enable();] - )], - [AC_DEFINE([HAVE_LIBPRI_AOC], [1], [libpri has AOC event support]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for AOC event support])] - ) - - - AC_MSG_CHECKING([whether libpri has pri_maintenance_service()]) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [extern int pri_maintenance_service(void);], - [pri_maintenance_service();] - )], - [AC_DEFINE([HAVE_LIBPRI_MAINT_SERVICE], [1], [libpri has pri_maintenance_service()]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_NOTICE([You will need libpri-1.4.11 or newer for the ftdm libpri maintenance set of commands])] - ) - - # libpri is available, set variables for Makefile(.am) - AC_SUBST([LIBPRI_LIBS], [-lpri]) - AC_SUBST([LIBPRI_LDFLAGS]) - AC_SUBST([LIBPRI_CPPFLAGS]) - - LIBS="${save_LIBS}" - LDFLAGS="${save_LDFLAGS}" - CPPFLAGS="${save_CPPFLAGS}" -fi -AM_CONDITIONAL([HAVE_LIBPRI],[test "x${HAVE_LIBPRI}" = "xyes"]) - -## -# Sangoma Wanpipe -# -HAVE_LIBSANGOMA="no" -AC_MSG_RESULT([${as_nl}<<>> Sangoma Wanpipe]) -AC_CHECK_LIB([sangoma], [sangoma_span_chan_toif], [HAVE_LIBSANGOMA="yes"]) -AC_MSG_RESULT([checking whether to build ftmod_wanpipe... ${HAVE_LIBSANGOMA}]) -AM_CONDITIONAL([HAVE_LIBSANGOMA], [test "${HAVE_LIBSANGOMA}" = "yes"]) - -## -# Sangoma ISDN stack -# -HAVE_SNG_ISDN="no" -AC_MSG_RESULT([${as_nl}<<>> Sangoma ISDN stack]) -AC_CHECK_LIB([sng_isdn], [sng_isdn_init], [HAVE_SNG_ISDN="yes"]) -AC_MSG_RESULT([checking whether to build ftmod_sangoma_isdn... ${HAVE_SNG_ISDN}]) -AM_CONDITIONAL([HAVE_SNG_ISDN], [test "${HAVE_SNG_ISDN}" = "yes"]) - -if test "${HAVE_SNG_ISDN}" = "yes"; then - if test "${build}" = "${host}" - then - case "${host}" in - x86_64-*) - # X86_64 machines need additional flags when compiling against libsng_isdn - CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT" - ;; - esac - fi -fi - -## -# Sangoma SS7 stack -# -HAVE_SNG_SS7="no" -AC_MSG_RESULT([${as_nl}<<>> Sangoma SS7 stack]) -AC_CHECK_LIB([sng_ss7], [sng_isup_init_gen], [HAVE_SNG_SS7="yes"]) -AC_MSG_RESULT([checking whether to build ftmod_sangoma_ss7... ${HAVE_SNG_SS7}]) -AM_CONDITIONAL([HAVE_SNG_SS7], [test "${HAVE_SNG_SS7}" = "yes"]) - -if test "${HAVE_SNG_SS7}" = "yes"; then - if test "${build}" = "${host}" - then - case "${host}" in - x86_64-*) - # X86_64 machines need additional flags when compiling against libsng_isdn - CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT" - ;; - esac - fi -fi - - -## -# zlib (required for Sangoma SS7 Transparent IAM) -# -HAVE_ZLIB="no" -AC_MSG_RESULT([${as_nl}<<>> zlib]) -AC_CHECK_LIB([z], [compress], [HAVE_ZLIB="yes"]) -AC_MSG_RESULT([checking whether zlib is installed... ${HAVE_ZLIB}]) -AM_CONDITIONAL([HAVE_ZLIB], [test "{HAVE_ZLIB]" = "yes"]) -if test "${HAVE_ZLIB}" = "yes"; then - CFLAGS="$CFLAGS -DHAVE_ZLIB" -fi - -## -# libisdn -# -HAVE_LIBISDN="no" -AC_ARG_WITH([libisdn], - [AS_HELP_STRING([--with-libisdn], [Install ftmod_isdn (libisdn stack)])], - [case "${withval}" in - no) with_libisdn="no" ;; - *) with_libisdn="yes" ;; - esac - ], - [with_libisdn="no"] -) -if test "${with_libisdn}" != "no" -then - AC_MSG_RESULT([${as_nl}<<>> ftmod_isdn (libisdn stack)]) - m4_ifdef([PKG_CHECK_MODULES], - [PKG_CHECK_MODULES([libisdn], - [libisdn >= 0.0.1], - [AC_MSG_CHECKING([libisdn version]) - LIBISDN_VERSION="`${PKG_CONFIG} --modversion libisdn`" - if test -z "${LIBISDN_VERSION}"; then - AC_MSG_ERROR([Failed to retrieve libisdn version]) - fi - AC_MSG_RESULT([${LIBISDN_VERSION}]) - - # check features - AC_MSG_CHECKING([for new experimental API]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [#include - #if !LIBISDN_FEATURE(API2) - #error "libisdn API v2 not available" - #endif - ], - [;] - )], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])] - ) - - HAVE_LIBISDN="yes" - AC_DEFINE([HAVE_LIBISDN], [1], [libisdn support]) - AC_SUBST([LIBISDN_CFLAGS], [${libisdn_CFLAGS}]) - AC_SUBST([LIBISDN_CPPFLAGS],[${libisdn_CPPFLAGS}]) - AC_SUBST([LIBISDN_LDFLAGS], [${libisdn_LDFLAGS}]) - AC_SUBST([LIBISDN_LIBS], [${libisdn_LIBS}]) - AC_SUBST([LIBISDN_VERSION]) - ], - [AC_MSG_ERROR([Need libisdn-0.0.1 or higher])] - ) - AX_LIB_PCAP], - [AC_MSG_WARN([pkg-config missing (required for libisdn detection)])] - ) -fi -AM_CONDITIONAL([HAVE_LIBISDN], [test "${HAVE_LIBISDN}" = "yes"]) - - -## -# mISDN dependencies -# -HAVE_MISDN="no" -AC_ARG_WITH([misdn], - [AS_HELP_STRING([--with-misdn], [Install ftmod_misdn (mISDN I/O plugin)])], - [case "${withval}" in - no|yes) with_misdn="${withval}" ;; - *) AC_MSG_ERROR([Invalid value \"${with_misdn}\" for --with-misdn option]) ;; - esac], - [with_misdn="auto"] -) -AS_IF([test "${with_misdn}" != "no"], - [AC_MSG_RESULT([${as_nl}<<>> ftmod_misdn (Linux mISDN I/O plugin)]) - AC_CHECK_HEADER([mISDN/mISDNif.h], - [HAVE_MISDN="yes" - AC_CHECK_LIB([rt], [clock_gettime])], - [AS_IF([test "${with_misdn}" = "yes"], - [AC_MSG_ERROR([mISDN/mISDNif.h not found])], - [AC_MSG_NOTICE([mISDN/mISDNif.h not found])] - )], - [#include ] - )] -) -AM_CONDITIONAL([HAVE_MISDN], [test "${HAVE_MISDN}" = "yes"]) - - -AC_MSG_RESULT([${as_nl}<<>> Creating output files]) -AC_CONFIG_FILES([ - Makefile - freetdm.pc - mod_freetdm/Makefile -]) -AC_OUTPUT - -# -# summary screen -# -AC_MSG_RESULT([ -============================ FreeTDM configuration ============================ - -+ Modules - - Signalling: - ftmod_analog....................... yes - ftmod_analog_em.................... yes - ftmod_isdn......................... ${HAVE_LIBISDN} - ftmod_libpri....................... ${HAVE_LIBPRI} - ftmod_sangoma_isdn................. ${HAVE_SNG_ISDN} - ftmod_sangoma_ss7.................. ${HAVE_SNG_SS7} - ftmod_r2........................... ${HAVE_OPENR2} - ftmod_gsm.......................... ${HAVE_WAT} - ftmod_pritap....................... ${HAVE_PRITAP} - I/O: - ftmod_zt........................... yes - ftmod_wanpipe...................... ${HAVE_LIBSANGOMA} - ftmod_misdn........................ ${HAVE_MISDN} - -=============================================================================== -]) diff --git a/libs/freetdm/configure.gnu b/libs/freetdm/configure.gnu deleted file mode 100755 index d00cd18473..0000000000 --- a/libs/freetdm/configure.gnu +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -srcpath=$(dirname $0 2>/dev/null ) || srcpath="." -$srcpath/configure "$@" --with-pic diff --git a/libs/freetdm/cyginstall.sh b/libs/freetdm/cyginstall.sh deleted file mode 100755 index e7953675b6..0000000000 --- a/libs/freetdm/cyginstall.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# this script must be run from freetdm root dir and it is assuming -# FreeSWITCH is trunk is located at ../../ -fsdir=../.. -set -x -cp Debug/mod/*.dll $fsdir/Debug/mod/ -cp mod_freetdm/Debug/*.pdb $fsdir/Debug/mod/ -cp Debug/freetdm.dll $fsdir/Debug/ -cp Debug/ftmod_*.dll $fsdir/Debug/mod/ -cp Debug/*.pdb $fsdir/Debug/mod/ -#cp Debug/testsangomaboost.exe $fsdir/Debug/ -echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS" -set +x - diff --git a/libs/freetdm/docs/Doxygen.conf b/libs/freetdm/docs/Doxygen.conf deleted file mode 100644 index 1f69952879..0000000000 --- a/libs/freetdm/docs/Doxygen.conf +++ /dev/null @@ -1,265 +0,0 @@ -# Doxyfile 1.4.6 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = FreeTDM -PROJECT_NUMBER = -OUTPUT_DIRECTORY = docs/ -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 = ftdm_ FTDM_ Q921 Q931 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = YES -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 = YES -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/include/freetdm.h - -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 = ftdm_ -#--------------------------------------------------------------------------- -# 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 = freetdm.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 = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -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 = NO -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 = FT_DECLARE(x)=x \ - FT_MOD_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/freetdm/docs/PRI-BRI-Debug.pdf b/libs/freetdm/docs/PRI-BRI-Debug.pdf deleted file mode 100755 index 53386b1b52eb580ef551c5e26954d5d6b202b119..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 399483 zcmdqIbyS_n(l3m=OK{j|@C|I-g1bu~xVyWD0KtPxaCdhP?ht~zgy4Y$CjZ&gJRaa9hiAgZAGIO9JQ8$49P?1;xEC72WD^w(YexRDC zgDFtd(8bWk-W;f8Xm08ZU<1Ea0m>QLnbVruF{!K40R#n6kxcDO9@>0=`%B}8MnF+} zS34H~J5bir#912v`rZYAjpN}5^xGZi;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8bL^u)8i}Xt%9fq)@-OL)iyU;lqDM9J#tOf*QFn~>_BFbO+UA~+d zeso1;`i8vG**&ec)_|1t$4Y9BXsg;~Vw?IMHFrZJ>K|s^f8v~0rEE!ZSZ{LEzcM2! zIwnFWKoJPp>)#C_A;cll|KwQ%Qe>cqXkIWWo0IBuVobP4PUSDgNGQ8s)|T6eYOxu}sQm7|zWlKyjW2fVF@h zM`1X}KY&XquBU)NdFKy69K*O{A;h>|0VpN7XB?1#s|5f^arXuQiE=$<833I5SVnLe zn@Gq#r!1ogjy?=f0C2o#8RV{u158SAyutxaaNjqU@%G!#q#RFi)>E9bE>26?jlA$w zuTw?GF*>1uE%bxs9scJveXwe)bo#-fhSL;E;6j0`tG`kq6g;nVs8H~Kh?6YTF-gdv Xrh%{C5`8>-+wU4rH;tpclose API will be called where the IO module is responsible -for turning off ec or any other operations to leave the channel unused/idle (not really closed). There was indeed a bug where ftdm_zt module -was not properly closing the channel, if that is what you mean, then it means that was already fixed by you with your audio mode turn off patch. - -Now, a more lengthy response ... - -When we, Sangoma, took over freetdm and renamed it to freetdm, it was not just a name change, many API cleanups were done so API users cannot access - -the internal data structures and cannot explicitly move between channel states. Also, some order on the state transitions has been put into place. - -We've tried to keep backwards compatibility though, so old modules may not follow all of the conventions. Some unwritten conventions are: - -1. Signaling modules are responsible for calling ftdm_channel_close() when done with the channel. In fact, signaling modules should not - call ftdm_channel_done unless they really know what they're doing. ftdm_channel_close will call ftdm_channel_done anyways. - -2. When remote end hangs up a call, signaling module should go to TERMINATING state and send SIGEVENT_STOP to the user. The signaling stack - should not acknowledge the hangup until the user implicitly moves us to HANGUP (via ftdm_channel_call_hangup()). There is a core timer - that will ensure we move from TERMINATING to HANGUP if the user does not moves us fast enough (arbitrarely 3000ms), although that is considered - a bug in the user application (at some point we saw that in FreeSWITCH) and we complain loudly when that happens. - -3. Signaling modules should leave the channel with NO pending states once they unlock it. This means, whenever you have a message to process - you must lock the channel, check its current state (the user may have already changed the state to something else), process any pending - state set by the user, then process your message and if required move the channel to a new state and process that state before releasing the lock. - There is a chance of a deadlock due to the callbacks we use to notify users of messages if we call those callbacks with the channel lock held and - that is why new signaling modules should use the FTDM_SPAN_USE_SIGNALS_QUEUE to defer the notification to the user when the ftdm_channel_t is not - locked calling ftdm_span_trigger_signals() at the end of their processing loop which delivers the callback notifications to users. - -Having said that, there is a major architectural change coming, probably early 2011, and I'd like to have your input. - -== Decoupling calls from IO channels == - -We've also found that the concept of a channel and a call are unnecesarily coupled together in FreeTDM. I've never asked Anthony the reasoning -for this, but it seems the API was meant to be used with, or without calls. That is, a user should be able to just 'open' a channel and start -reading and writing raw data without ever launching one of the provided signaling stacks on top, may be just because the user is using their -own signaling stack and just needs freetdm as an I/O API. In fact, signaling modules work like this (but there are defects there). -The problem is, as you have noticed, the way ftdm_channel_open_xx APIs has been implemented is abusing this concept. - -Problems with current implementation. - -1. Exclusive channel is the only way we can request channels to the ISDN network. There is no room to change the channel later on easily. -2. Multi-rate calls cannot be done. We need to associate multiple B-channels to a single call. -3. Low-bit-rate calls (not sure what is the proper name for them) where a single B-channel can feed media to multiple calls with a low bit-rate - codec (I know of at least one request from a big company for this to support some Q.SIG stuff for Eurocontrol). - - -What do we need? - -I think there should be only one open() API that wraps calls around fio->open(), the other current open_xx functions that do hunting, should -be eliminated and some extra arguments provided to ftdm_channel_call_place to provide information about the channel where we would like to -place the call or group hunting information and the API would return immediately providing a ftdm_call_t reference pointer that can be used -to further track the status of that call, or in the case where a channel exclusivity was requested and we know for a fact is not available, -just return failure. At that point there is no I/O channel involved yet. Eventually after the signaling stack hunts the channel and -negotiaties its availability with the network, an I/O channel can be attached to that call, or even attach multiple channels (for the case -of multi rate calls?). - -This involves heavy changes. The state machine should be moved out of the ftdm_channel_t structure along with probably some other members -and stuffed into a new ftdm_call_t structure. Signaling modules would have to be updated to run their state machines with this call -structure and then at some point attach IO channels to the call. There would be 2 type of read/write APIs, one low level ftdm_channel_read -which receives an ftdm_channel_t as parameter and an ftdm_call_read() which receives an ftdm_call_t as parameter, for the case of multi-rate -calls or low-bit-rate multiplexed calls in the same B-channel this API would return just the media corresponding to that call already -demultiplexed or concatenated, or whatever needs to be done with the media from the multiple low-level IO channels. - -This is fairly disruptive, but I believe should be done sooner or later. - - diff --git a/libs/freetdm/docs/glare.txt b/libs/freetdm/docs/glare.txt deleted file mode 100644 index 0753db817f..0000000000 --- a/libs/freetdm/docs/glare.txt +++ /dev/null @@ -1,25 +0,0 @@ -Glare is a PITA. - -Although configuration of ISDN links can be done to minimize glare, we also must have a clear policy -on how the FreeTDM API is supposed to behave on glare across signaling modules. - -There is a well-known race in the FreeTDM API since the beginning. When a user wants to place a call with -the old APIs: - -1. ftdm_channel_open_xx (to hunt the channel by group, span or select a channel individually) -2. ftdm_channel_call_place() to place the actual call. - -Since the user has no access to channel locking, between opening a channel and placing a call, an incoming call could be -received. Therefore things can get complicated and that is why you should STOP USING those 2 deprecated functions. - -The replacement is ftdm_call_place(). - -ftdm_call_place receives the information required to hunt the channel and place the call. - -If glare is detected after placing the call and the signaling stack decides to drop the local call, a regular -SIGEVENT_STOP will be sent with the hangup cause FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL. - -ftdm_call_place may return FTDM_BREAK if glare is detected while placing the call, in such cases you can try -calling ftdm_call_place again to hunt another channel. - - diff --git a/libs/freetdm/docs/io_modules.txt b/libs/freetdm/docs/io_modules.txt deleted file mode 100644 index a164bbb249..0000000000 --- a/libs/freetdm/docs/io_modules.txt +++ /dev/null @@ -1,13 +0,0 @@ -Last Updated: Jan 19, 2011 - -== BACKGROUND == - -The IO module provides an abstracted IO interface to FreeTDM. - -== SHUTDOWN == -Upon global shutdown, for each channel FIO_CLOSE_FUNCTION will be called. -When FIO_CLOSE_FUNCTION is called, all waiters on this channel shall be signalled. -If FIO_WAIT_FUNCTION is called on a function that has already been closed, this function shall return FTDM_TIMEOUT without blocking. -FIO_CHANNEL_DESTROY will eventually be called, and IO module is responsible for clearing all internal states and free allocated memory upon channel destroy. - - diff --git a/libs/freetdm/docs/locking.txt b/libs/freetdm/docs/locking.txt deleted file mode 100644 index 851d045b41..0000000000 --- a/libs/freetdm/docs/locking.txt +++ /dev/null @@ -1,125 +0,0 @@ -Last Updated: Fri 30 Dec, 2010 - -== Background == - -FreeTDM is a threaded library. As such, locking considerations must be taken when using it and when writing code inside the library. - -At the moment locks are not exposed to users. This means API users cannot acquire a lock on a channel or span structure. There is no -need for users to lock channels or spans since all their interactions with those structures should be done thru the FreeTDM API which -can (and in most cases must) internally lock on their behalf. - -Internally, locking can be done either by the core or the signaling modules. To better understand the locking considerations we must -understand first the threading model of FreeTDM. - -== Threading Model == - -At startup, when the user calls ftdm_global_init(), just one timing thread is created to dispatch internal timers. If you write -a signaling module or any other code using the scheduling API, you can choose to run your schedule in this timing thread or in -a thread of your choice. This is the only thread launched at initialization. - -If the application decides to use ftdm_global_configuration(), which reads freetdm.conf to create the spans and channels data -structures, then possibly another thread will be launched for CPU usage monitoring (only if enabled in the configuration cpu_monitor=yes -This thread sole purpose is to check the CPU and raise an alarm if reaches a configurable threshold, the alarm then is checked to avoid -placing or receiving further calls. - -At this point FreeTDM has initialized and configured its channels input output configuration. - -The user is then supposed to configure the signaling via ftdm_configure_span_signaling() and then start the signaling work -using ftdm_span_start(). This will typically launch at least 1 thread per span. Some signaling modules (actually just the analog one) -launches another thread per channel when receiving a call. The rest of the signaling modules currently launch only one thread per -span and the signaling for all channels within the span is handled in that thread. We call that thread 'the signaling thread'. - -At this point the user can start placing calls using the FreeTDM call API ftdm_channel_call_place(). Any of the possible threads in -which the user calls the FreeTDM API is called 'the user thread', depending on the application thread model (the application using FreeTDM) -this user thread may be different each time or the same all the time, we cannot make any assumptions. In the case of FreeSWITCH, the most -common user of FreeTDM, the user thread is most of the cases a thread for each new call leg. - -At this point we have identified 4 types of threads. - -1. The timing thread (the core thread that triggers timers). - Its responsibility is simply check for timers that were scheduled and trigger them when the time comes. This means that if you decide - to use the scheduling API in freerun mode (where you use the core timer thread) you callbacks will be executed in this global thread - and you MUST not block at all since there might be other events waiting. - -2. The CPU thread (we don't really care about this one as it does not interact with channels or spans). - -3. The signaling thread. - There is one thread of this per span. This thread takes care of reading signaling specific messages from the network (ISDN network, etc) and - changing the channel call state accordingly and processing state changes caused by user API calls (like ftdm_channel_call_hangup for example). - -4. The user thread. - This is a thread in which the user decides to execute FreeTDM APIs, in some cases it might even be the same than the signaling thread (because - most SIGEVENT notifications are delivered by the signaling thread, however we are advicing users to not use FreeTDM unsafe APIs from the - thread where they receive SIGEVENT notifications as some APIs may block for a few milliseconds, effectively blocking the whole signaling thread - that is servicing a span. - -== Application Locking == - -Users of the FreeTDM API will typically have locking of their own for their own application-specific data structures (in the case of FreeSWITCH, the -session lock for example). Other application-specific locks may be involved. - -== DeadLocks == - -As soon as we think of application locks, and we mix them with the FreeTDM internal locks, the possibility of deadlocks arise. - -A typical deadlock scenario when 2 locks are involved is: - -- User Thread - - Signaling Thread - -1. Application locks applock. 1. A network message is received for a channel. - -2. Aplication invokes a FreeTDM call API (ie: ftdm_channel_call_hangup()). 2. The involved channel is locked. - -3. The FreeTDM API attempts to acquire the channel lock and stalls because 3. The message processing results in a notification - the signaling thread just acquired it. to be delivered to the user via the callback function - provided for that purpose. The callback is then called. - -4. The thread is now deadlocked because the signaling thread will never 4. The application callback attempts to acquire its application - release the channel lock. lock but deadlocks because the user thread already has it. - -To avoid this signaling modules should not deliver signals to the user while holding the channel lock. An easy way to avoid this is -to not deliver signals while processing a state change, but rather defer them until the channel lock is released. Most new signaling modules -accomplish this by setting the span flag FTDM_SPAN_USE_SIGNALS_QUEUE, this flag tells the core to enqueue signals (ie FTDM_SIGEVENT_START) -when ftdm_span_send_signal() is called and not deliver them until ftdm_span_trigger_signals() is called, which is done by the signaling module -in its signaling thread when no channel lock is being held. - -== State changes while locking == - -Only 2 types of threads should be performing state changes. - -User threads. -The user thread is a random thread that was crated by the API user. We do not know what threading model users of FreeTDM will follow -and therefore cannot make assumptions about it. The user should be free to call FreeTDM APIs from any thread, except threads that -are under our control, like the signaling threads. Although it may work in most situations, is discouraged for users to try -to use FreeTDM APIs from the signaling thread, that is, the thread where the signaling callback provided during configuration -is called (the callback where FTDM_SIGEVENT_XXX signals are delivered). - -A user thread may request state changes implicitly through calls to FreeTDM API's. The idea of state changes is internal to freetdm -and should not be exposed to users of the API (except for debugging purposes, like the ftdm_channel_get_state, ftdm_channel_get_state_str etc) - -This is an example of the API's that implicitly request a state change. - -ftdm_channel_call_answer() - -Signaling modules should guarantee that upon releasing a lock on a channel, any state changes will be already processed and -not deferred to other threads, otherwise that leads to a situation where a state change requested by the signaling module is pending -to be serviced by another signaling module thread but a user thread wins the channel lock and attempts to perform a state change which will -fail because another state change is pending (and user threads are not meant to process signaling states). - -ONLY one signaling thread per channel should try to perform state changes and processing of the states, -otherwise complexity arises and is not worth it! - -At some point before we stablished this policies we could have 3 different threads doing state changes. - -1. A user random thread could implcitly try to change the state in response to a call API. -2. The ftmod signaling thread could try to change the state in response to other state changes. -3. The lower level signaling stack threads could try to change the state in response to stack events. - -As a result, lower level signaling stack thread could set a state and then let the signaling thread to -process it, but when unlocking the channel, the user thread may win the lock over the signaling thread and -may try to set a state change of its own and fail (due to the unprocessed state change)! - -The rule is, the signaling module should never unlock a channel with states pending to process this way the user, -when acquiring a channel lock (inside ftdm_channel_call_answer for example) it will always find a consistent state -for the channel and not in the middle of state processing. - - diff --git a/libs/freetdm/docs/sigstatus.txt b/libs/freetdm/docs/sigstatus.txt deleted file mode 100644 index 10561bfb5b..0000000000 --- a/libs/freetdm/docs/sigstatus.txt +++ /dev/null @@ -1,59 +0,0 @@ -FreeTDM can both notify and set signaling status changes in the different protocols thru a unified interface. More -specific details on the C data types and function prototypes are found in freetdm.h - -The API provides the following functions and data types to do it: - -The signaling status in any channel/span is represented thru ftdm_signaling_status_t - - /* The signaling link is down (no d-chans up in the span/group, MFC-R2 bit pattern unidentified) */ - FTDM_SIG_STATE_DOWN, - /* The signaling link is suspended (MFC-R2 bit pattern blocked, PRI maintenance, ss7 blocked?) */ - FTDM_SIG_STATE_SUSPENDED, - /* The signaling link is ready and calls can be placed (ie: d-chan up, MFC-R2 both rx and tx in IDLE) */ - FTDM_SIG_STATE_UP, - /* Invalid status */ - FTDM_SIG_STATE_INVALID - -Changes in the signaling status are notified to the user using the standard callback notification function provided -during configuration using the sigevent type FTDM_SIGEVENT_SIGSTATUS_CHANGED which is sent when the line status changes. - -On startup the signalling status default is FTDM_SIG_STATE_DOWN, and no notification is provided until the state change, -so applications must assume the status is down unless told otherwise. - -When ftdm_span_start is called, the signaling stack takes care of attempting to bring the status to UP -but it will ultimately depend on the other side too. - -== Setting the signaling status == - -Users can set the signaling status on a given channel/span thru FreeTDM the following API functions: - -ftdm_channel_set_sig_status -ftdm_span_set_sig_status - -If the user calls ftdm_channel_set_sig_status(chan, FTDM_SIG_STATE_SUSPENDED), the signaling stack will try to set -the status of the line to the one requested, if successful, it will result in a SIGEVENT_SIGSTATUS_CHANGED notification -being sent with status FTDM_SIG_STATE_SUSPENDED. - -** MFC-R2 Signaling Notes ** -For MFC-R2, calling ftdm_span_start() results in setting the tx CAS bits to IDLE. However, if the rx bits are in BLOCKED state -the signaling status will be reported as SUSPENDED. - -If the user calls ftdm_channel_set_sig_status(chan, SUSPENDED), the tx CAS bits will be set to BLOCKED and, if, the current rx bits -are IDLE then a SIGEVENT_SIGSTATUS_CHANGED with state SUSPENDED will be sent. If the rx bits are already in blocked then no further -SIGEVENT_SIGSTATUS_CHANGED notification is needed (because it was already sent when the rx bits were initially detected as BLOCKED). - -If the user calls ftdm_channel_set_sig_status(chan, UP), the tx CAS bits will be set to IDLE and, if, the current rx bits -are IDLE, then SIGEVENT_SIGSTATUS_CHANGED with state UP will be sent. If the rx bits are BLOCKED, then no notification is -sent at all until the rx bits change. - -Bottom line is, for MFC-R2, SIGEVENT_SIGSTATUS_CHANGED UP is only sent to the user when both the rx and tx bits are in IDLE, and -SIGEVENT_SIGSTATUS_CHANGED SUSPENDED is only sent to the user when any of the rx or tx bits are in BLOCKED. - -== Getting the signaling status == -Users can get the signaling status on a given channel/span thru FreeTDM the following API functions: - -ftdm_channel_get_sig_status -ftdm_span_get_sig_status - -The line status returned should be the same as the last time a SIGEVENT_SIGSTATUS_CHANGED was reported. - diff --git a/libs/freetdm/docs/ss7-native-bridge.txt b/libs/freetdm/docs/ss7-native-bridge.txt deleted file mode 100644 index d44b067b0a..0000000000 --- a/libs/freetdm/docs/ss7-native-bridge.txt +++ /dev/null @@ -1,43 +0,0 @@ -SS7 Native Bridge - -Native bridge is enabled on 2 conditions: - -* The SIP header FreeTDM-TransUUID is set in the originating leg and matches a freetdm channel -* The variable freetdm_native_sigbridge is true and the originating leg is also a freetdm channel - -Some coding rules apply to this feature: - -- Each channel is responsible for clearning its own peer_data and event queue - at the end of the call (when moving to DOWN state) - -- Each channel dequeues messages only from its own queue and enqueues messages - in the peer's queue, with the only exception being messages received before - the bridge is stablished (IAM for sure and possible SAM messages) because - if the bridge is not yet stablished the messages must be queued by the channel - in its own queue temporarily until the bridge is ready - -- When the bridge is ready it is the responsibility of the incoming channel to - move the messages that stored temporarily in its own queue to the bridged peer queue - -- During hangup, each channel is responsible for moving itself to DOWN. The procedure - however differs slightly depending on the hangup conditions - - If the user requests hangup (ie, FreeSWITCH) the request will be noted by setting the - FTDM_CHANNEL_USER_HANGUP flag but will not be processed yet because call control is - driven only by the link messages (so no hangup from ESL or command line allowed) - - When REL message comes, the channel receiving it must move to TERMINATING state and: - - - If the user has not hangup yet (FTDM_CHANNEL_USER_HANGUP flag not set) then - notify the user via SIGEVENT_STOP and wait for the user to move to HANGUP - state by calling ftdm_channel_call_hangup() before sending RLC - - - If the user did hangup already (FTDM_CHANNEL_USER_HANGUP flag is set) then - skip user notification and move to HANGUP state directly where the RLC message - will be sent - -- On HANGUP state the RLC is sent and the channel is moved to DOWN, final state - The peer channel will forward the REL message and wait for RLC from the network, when - RLC is received the channel can move straight to DOWN itself because the peer channel - is completing its own shutdown procedure when it received the REL message - diff --git a/libs/freetdm/docs/variables.txt b/libs/freetdm/docs/variables.txt deleted file mode 100644 index cb518e14d8..0000000000 --- a/libs/freetdm/docs/variables.txt +++ /dev/null @@ -1,122 +0,0 @@ -Using FreeTDM Variables - -1. User application sending variables or raw buffer to FreeTDM -============================================================== - -The User can include a ftdm_usrmsg_t before sending an event to freetdm. - -example #1a - Making an outbound call: --------------------------------------- - -To make an outbound call: - ftdm_usrmsg_t usrmsg; - memset(&usrmsg, 0, sizeof(usrmsg)); - - /* Attach variable to usrmsg */ - ftdm_usrmsg_add_var(&usrmsg, "isdn.prog_ind.descr", "inband-info-available"); - - ftdm_channel_call_place_ex(ftdmchan, &usrmsg); - -example #1b - Adding a variable: --------------------------------- -When using ftmod_sangoma_isdn, user want to specify progress indicator inside PROCEED message. - - - ftdm_usrmsg_t usrmsg; - memset(&usrmsg, 0, sizeof(usrmsg)); - - /* Attach variable to usrmsg */ - ftdm_usrmsg_add_var(&usrmsg, "isdn.prog_ind.descr", "inband-info-available"); - - /* Request FreeTDM to send a PROCEED msg */ - ftdm_channel_call_indicate_ex(ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED, &usrmsg); - - -example #2 - Setting raw data: --------------------------------------------------------- - -When using ftmod_sangoma_isdn, user wants to transmit a custom Facility IE, inside a FACILITY message. - - ftdm_usrmsg_t usrmsg; - - uint8_t *my_facility_ie = ftdm_calloc(1, 200); /*memory has to be allocated using ftdm_calloc !! */ - unsigned my_facility_ie_len = 0; - - memset(&usrmsg, 0, sizeof(usrmsg)); - - /* Fill my_facility_ie with custom data here */ - my_facility_ie[my_facility_ie_len++] = 0x1C; /* Q.931 Facility IE ID */ - my_facility_ie[my_facility_ie_len++] = 0x03; /* Length of facility IE */ - my_facility_ie[my_facility_ie_len++] = 0x01; - my_facility_ie[my_facility_ie_len++] = 0x02; - my_facility_ie[my_facility_ie_len++] = 0x03; - - ftdm_usrmsg_set_raw_data(&usrmsg, my_facility_ie, my_facility_ie_len); - - ftdm_channel_call_indicate_ex(ftdmchan, FTDM_CHANNEL_INDICATE_FACILITY, &usrmsg); - - /* FreeTDM will automatically free my_facility_ie */ - - -2. User application receiving variables and raw buffer from FreeTDM -================================================================== - -example #1 - print all variables received from FreeTDM ------------------------------------------------------- - - /* Inside event call-back function */ - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - const char *var_name = NULL; - const char *var_value = NULL; - - /* Read all variables attached to this event */ - iter = ftdm_sigmsg_get_var_iterator(sigmsg, iter); - for (curr = iter ; curr; curr = ftdm_iterator_next(curr)) { - ftdm_get_current_var(curr, &var_name, &var_value); - fprintf("Call Variable: %s=%s\n", var_name, var_value); - } - ftdm_iterator_free(iter); - - -example #2 - accessing a specific variable ------------------------------------------- - - /* Inside event call-back function */ - char *string = NULL; - string = ftdm_sigmsg_get_var(sigmsg, "isdn.prog_ind.descr"); - if (string && *string) { - fprintf("Progress indicator:%s\n", string); - } - - -example #3a - accessing raw data -------------------------------- - - /* Inside event call-back function */ - ftdm_size_t len; - uint8_t *mydata; - if (ftdm_sigmsg_get_raw_data(sigmsg, (void**)&mydata, &len) == FTDM_SUCCESS) { - /* raw data is available, do something with mydata here */ - } - /* Once this function returns, raw data will be free'd inside FreeTDM */ - - -example #3b - accessing raw data -------------------------------- - - /* Inside event call-back function */ - ftdm_size_t len; - uint8_t *mydata; - if (ftdm_sigmsg_get_raw_data_detached(sigmsg, (void**)&mydata, &len) == FTDM_SUCCESS) { - /* raw data is available, do something with mydata here */ - - } - - : - : - : - - /* User owns raw data and is responsible for free'ing it*/ - ftdm_safe_free(mydata); - diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln deleted file mode 100644 index 4bf2c795a6..0000000000 --- a/libs/freetdm/freetdm.2008.sln +++ /dev/null @@ -1,155 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetdm", "msvc\freetdm.2008.vcproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2008.vcproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2008.vcproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_freetdm", "mod_freetdm\mod_freetdm.2008.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog", "src\ftmod\ftmod_analog\ftmod_analog.2008.vcproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog_em", "src\ftmod\ftmod_analog_em\ftmod_analog_em.2008.vcproj", "{B3F49375-2834-4937-9D8C-4AC2EC911010}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_isdn", "src\ftmod\ftmod_isdn\ftmod_isdn.2008.vcproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_pika", "src\ftmod\ftmod_pika\ftmod_pika.2008.vcproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_wanpipe", "src\ftmod\ftmod_wanpipe\ftmod_wanpipe.2008.vcproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\ftmod\ftmod_sangoma_isdn\ftmod_sangoma_isdn.2008.vcproj", "{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.2008.vcproj", "{08C3EA27-A51D-47F8-B47D-B189C649CF30}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - 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 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.ActiveCfg = Debug|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.Build.0 = Debug|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.ActiveCfg = Release|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.Build.0 = Release|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.ActiveCfg = Debug|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.Build.0 = Debug|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.ActiveCfg = Release|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.Build.0 = Release|x64 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|x64.ActiveCfg = Debug|x64 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|x64.ActiveCfg = Release|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.ActiveCfg = Debug|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.Build.0 = Debug|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.ActiveCfg = Release|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.Build.0 = Release|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.ActiveCfg = Debug|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.Build.0 = Debug|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.ActiveCfg = Release|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.Build.0 = Release|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.Build.0 = Debug|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.ActiveCfg = Debug|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.Build.0 = Debug|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.ActiveCfg = Release|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.Build.0 = Release|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.ActiveCfg = Release|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.Build.0 = Release|x64 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|x64.ActiveCfg = Debug|x64 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|x64.ActiveCfg = Release|x64 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|x64.ActiveCfg = Debug|x64 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|x64.ActiveCfg = Release|x64 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.Build.0 = Debug|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|x64.ActiveCfg = Debug|x64 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.ActiveCfg = Debug|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.ActiveCfg = Debug|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.Build.0 = Debug|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.ActiveCfg = Release|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.Build.0 = Release|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.ActiveCfg = Release|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.Build.0 = Release|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.ActiveCfg = Debug|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.ActiveCfg = Debug|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.Build.0 = Debug|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.ActiveCfg = Release|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.Build.0 = Release|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.ActiveCfg = Release|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.Build.0 = Release|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.ActiveCfg = Debug|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.Build.0 = Debug|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.ActiveCfg = Release|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.Build.0 = Release|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.ActiveCfg = Release|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libs/freetdm/freetdm.2010.sln b/libs/freetdm/freetdm.2010.sln deleted file mode 100644 index b6259e5960..0000000000 --- a/libs/freetdm/freetdm.2010.sln +++ /dev/null @@ -1,127 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetdm", "msvc\freetdm.2010.vcxproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2010.vcxproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2010.vcxproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_freetdm", "mod_freetdm\mod_freetdm.2010.vcxproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog", "src\ftmod\ftmod_analog\ftmod_analog.2010.vcxproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog_em", "src\ftmod\ftmod_analog_em\ftmod_analog_em.2010.vcxproj", "{B3F49375-2834-4937-9D8C-4AC2EC911010}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_isdn", "src\ftmod\ftmod_isdn\ftmod_isdn.2010.vcxproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_pika", "src\ftmod\ftmod_pika\ftmod_pika.2010.vcxproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_wanpipe", "src\ftmod\ftmod_wanpipe\ftmod_wanpipe.2010.vcxproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\ftmod\ftmod_sangoma_isdn\ftmod_sangoma_isdn.2010.vcxproj", "{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.2010.vcxproj", "{08C3EA27-A51D-47F8-B47D-B189C649CF30}" -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 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.ActiveCfg = Debug|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.Build.0 = Debug|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.ActiveCfg = Release|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.Build.0 = Release|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.ActiveCfg = Debug|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.Build.0 = Debug|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.ActiveCfg = Release|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.Build.0 = Release|x64 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|x64.ActiveCfg = Debug|x64 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|x64.ActiveCfg = Release|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.ActiveCfg = Debug|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.Build.0 = Debug|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.ActiveCfg = Release|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.Build.0 = Release|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.ActiveCfg = Debug|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.Build.0 = Debug|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.ActiveCfg = Release|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.Build.0 = Release|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.Build.0 = Debug|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.ActiveCfg = Debug|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.Build.0 = Debug|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.ActiveCfg = Release|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.Build.0 = Release|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.ActiveCfg = Release|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.Build.0 = Release|x64 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|x64.ActiveCfg = Debug|x64 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|x64.ActiveCfg = Release|x64 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|x64.ActiveCfg = Debug|x64 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|x64.ActiveCfg = Release|x64 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.Build.0 = Debug|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|x64.ActiveCfg = Debug|x64 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.ActiveCfg = Debug|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.Build.0 = Debug|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.ActiveCfg = Debug|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.Build.0 = Debug|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.ActiveCfg = Release|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.Build.0 = Release|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.ActiveCfg = Release|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.Build.0 = Release|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.ActiveCfg = Debug|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.Build.0 = Debug|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.ActiveCfg = Debug|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.Build.0 = Debug|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.ActiveCfg = Release|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.Build.0 = Release|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.ActiveCfg = Release|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.Build.0 = Release|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.Build.0 = Debug|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.ActiveCfg = Debug|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.Build.0 = Debug|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.ActiveCfg = Release|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.Build.0 = Release|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.ActiveCfg = Release|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|x64 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|x64 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|x64 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libs/freetdm/freetdm.2012.sln b/libs/freetdm/freetdm.2012.sln deleted file mode 100644 index 1d4c335a8d..0000000000 --- a/libs/freetdm/freetdm.2012.sln +++ /dev/null @@ -1,127 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetdm", "msvc\freetdm.2012.vcxproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2012.vcxproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2012.vcxproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_freetdm", "mod_freetdm\mod_freetdm.2012.vcxproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog", "src\ftmod\ftmod_analog\ftmod_analog.2012.vcxproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog_em", "src\ftmod\ftmod_analog_em\ftmod_analog_em.2012.vcxproj", "{B3F49375-2834-4937-9D8C-4AC2EC911010}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_isdn", "src\ftmod\ftmod_isdn\ftmod_isdn.2012.vcxproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_pika", "src\ftmod\ftmod_pika\ftmod_pika.2012.vcxproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_wanpipe", "src\ftmod\ftmod_wanpipe\ftmod_wanpipe.2012.vcxproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\ftmod\ftmod_sangoma_isdn\ftmod_sangoma_isdn.2012.vcxproj", "{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.2012.vcxproj", "{08C3EA27-A51D-47F8-B47D-B189C649CF30}" -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 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.ActiveCfg = Debug|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.Build.0 = Debug|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.ActiveCfg = Release|x64 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.Build.0 = Release|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.ActiveCfg = Debug|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.Build.0 = Debug|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.ActiveCfg = Release|x64 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.Build.0 = Release|x64 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|x64.ActiveCfg = Debug|x64 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|x64.ActiveCfg = Release|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.ActiveCfg = Debug|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.Build.0 = Debug|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.ActiveCfg = Release|x64 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.Build.0 = Release|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.ActiveCfg = Debug|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.Build.0 = Debug|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.ActiveCfg = Release|x64 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.Build.0 = Release|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.Build.0 = Debug|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.ActiveCfg = Debug|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.Build.0 = Debug|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.ActiveCfg = Release|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.Build.0 = Release|Win32 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.ActiveCfg = Release|x64 - {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.Build.0 = Release|x64 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|x64.ActiveCfg = Debug|x64 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|x64.ActiveCfg = Release|x64 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|x64.ActiveCfg = Debug|x64 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|x64.ActiveCfg = Release|x64 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.Build.0 = Debug|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|x64.ActiveCfg = Debug|x64 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.ActiveCfg = Debug|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.Build.0 = Debug|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.ActiveCfg = Debug|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.Build.0 = Debug|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.ActiveCfg = Release|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.Build.0 = Release|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.ActiveCfg = Release|x64 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.Build.0 = Release|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.ActiveCfg = Debug|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.Build.0 = Debug|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.ActiveCfg = Debug|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.Build.0 = Debug|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.ActiveCfg = Release|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.Build.0 = Release|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.ActiveCfg = Release|x64 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.Build.0 = Release|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.Build.0 = Debug|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.ActiveCfg = Debug|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.Build.0 = Debug|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.ActiveCfg = Release|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.Build.0 = Release|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.ActiveCfg = Release|x64 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|x64 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|x64 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|x64 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libs/freetdm/freetdm.pc.in b/libs/freetdm/freetdm.pc.in deleted file mode 100644 index 0b563f9840..0000000000 --- a/libs/freetdm/freetdm.pc.in +++ /dev/null @@ -1,18 +0,0 @@ -# -# FreeTDM pkg-config file -# -prefix=@prefix@ -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include -modulesdir=@modinstdir@ - -Name: FreeTDM -Description: -Version: @PACKAGE_VERSION@ -URL: http://www.openzap.org/ -Requires: -Conflicts: -Libs: -L${libdir} -lfreetdm -Libs.private: -lm -Cflags: -I${includedir} diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh deleted file mode 100755 index b079158541..0000000000 --- a/libs/freetdm/mkrelease.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash -INSTALLPREFIX="/usr/local/freetdm" -VERSION="" -NODOCS="NO" - -for i in $* -do - case $i in - --version=*) - VERSION=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` - ;; - --prefix=*) - INSTALLPREFIX=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` - ;; - --nodocs) - NODOCS="YES" - ;; - *) - # unknown option - echo "Unknown option $i" - exit - ;; - esac -done - -if [ "x$VERSION" = "x" ] -then - echo "Provide a version number with --version=" - exit 1 -fi - -arch=$(uname -m) - -# defs -LIBSNG_ISDN_URL=ftp://ftp.sangoma.com/linux/libsng_isdn -LIBSNG_ISDN_NAME=libsng_isdn-7-current -LIBSNG_SS7_URL=ftp://ftp.sangoma.com/linux/libsng_ss7 -LIBSNG_SS7_NAME=libsng_ss7-3-current -LIBSNG_ISDN_DIR="$LIBSNG_ISDN_NAME.$arch" -LIBSNG_SS7_DIR="$LIBSNG_SS7_NAME.$arch" - -# download and decompress a tarball -# $1 = prefix_url, such as ftp://ftp.sangoma.com/foo/bar -# $2 = package name, such as libsng_isdn-7.0.0.x86_64 -function download() { - wget $1/$2.tgz - if [ $? = 0 ] - then - tardir=$(tar -tf $2.tgz | head -n1 | sed 's,\/,,g') - tar -xvzf $2.tgz || echo "FAILED to decompress $2.tgz" - if [ "$tardir" != "$2" ] - then - mv $tardir $2 || echo "FAILED to move $tardir to $2" - fi - echo "SUCCESSFULLY downloaded $2" - else - echo "FAILED to download $1/$2.tgz" - fi -} - -# download and build libsng-ss7 -fullname="$LIBSNG_ISDN_NAME.$arch" -if [ -d $fullname ] -then - echo "skipping isdn download since $fullname directory already exists ... remove if you want this step to be performed" -else - download $LIBSNG_ISDN_URL $fullname -fi - -cd $LIBSNG_ISDN_DIR -make DESTDIR=$INSTALLPREFIX install || echo "Failed to build libsng-isdn" -cd .. - -# download and build libsng-ss7 -fullname="$LIBSNG_SS7_NAME.$arch" -if [ -d $fullname ] -then - echo "skipping ss7 download since $fullname directory already exists ... remove if you want this step to be performed" -else - download $LIBSNG_SS7_URL $fullname -fi - -cd $LIBSNG_SS7_DIR -make DESTDIR=$INSTALLPREFIX install || echo "Failed to build libsng-ss7" -cd .. - -if [ ! -d $INSTALLPREFIX ] -then - mkdir -p $INSTALLPREFIX || exit 1 -fi - -if [ ! -d $INSTALLPREFIX/bin-releases ] -then - mkdir -p $INSTALLPREFIX/bin-releases || exit 1 -fi - -# attempt to compile freetdm -echo "Build freetdm and mod_freetdm now..." -make all mod_freetdm || exit 1 -echo "freetdm built OK" - -major=$(echo "$VERSION" | cut -d. -f1) -minor=$(echo "$VERSION" | cut -d. -f2) -micro=$(echo "$VERSION" | cut -d. -f3) -release="freetdm-$VERSION" - -# ABI compatibility check -if [ -x /usr/local/bin/ftdm_abi_check.py ]; then - /usr/local/bin/ftdm_abi_check.py --release_path=$(pwd) --archive_path=$INSTALLPREFIX/bin-releases --version=$VERSION - - if [ $? -ne 0 ]; then - echo "ABI compabitility test failed, not creating release. Either increment the major version number or fix the interface." - exit 1 - fi -else - echo -ne "\n\nWARNING: /usr/local/bin/ftdm_abi_check.py not found, skipping ABI compatibility test\n\n" -fi - -if [ $NODOCS = "NO" ] -then - make dox || exit 1 -fi - -echo "Creating $release ($major.$minor.$micro) at $INSTALLPREFIX/$release (directory will be removed if exists already) ... " - -mkdir -p $INSTALLPREFIX/$release $INSTALLPREFIX/bin-releases/$major/$release - -cp -r ./* $INSTALLPREFIX/bin-releases/$major/$release -cp -r ./.libs $INSTALLPREFIX/bin-releases/$major/$release - -make clean -make mod_freetdm-clean - -cp -r ./* $INSTALLPREFIX/$release - -# copy ABI compatibility reports to release -if [ -d compat_reports ]; then - mv ./compat_reports $INSTALLPREFIX/$release -fi - -rm -rf $INSTALLPREFIX/$release/{$LIBSNG_ISDN_DIR,$LIBSNG_SS7_DIR,*.tgz} -rm -rf $INSTALLPREFIX/bin-releases/$major/$release/{$LIBSNG_ISDN_DIR,$LIBSNG_SS7_DIR,*.tgz} - -tar -C $INSTALLPREFIX -czf $INSTALLPREFIX/$release.tar.gz $release/ diff --git a/libs/freetdm/mod_freetdm/CMakeLists.txt b/libs/freetdm/mod_freetdm/CMakeLists.txt deleted file mode 100644 index 25847e713f..0000000000 --- a/libs/freetdm/mod_freetdm/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -# Arnaldo M Pereira -# -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(mod_freetdm) - -IF(NOT DEFINED WIN32) - ADD_DEFINITIONS(-g -O2 -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0 -g -ggdb -DPACKAGE_NAME=\"freetdm\" -DPACKAGE_TARNAME=\"freetdm\" -DPACKAGE_VERSION=\"pre-alpha\" -DPACKAGE_STRING=\"freetdm\ pre-alpha\" -DPACKAGE_BUGREPORT=\"bugs@freeswitch.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"libfreetdm\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_LIBDL=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBM=1 -DSIZEOF_LONG=8 -DHAVE_NETINET_SCTP_H=1 -DHAVE_NETDB_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_GETHOSTBYNAME_R=1) # -DDEBUG=/\*\*/) -ENDIF(NOT DEFINED WIN32) - -# includes -SET(mod_freetdm_INCLUDES - ${PROJECT_SOURCE_DIR}/../src/include - ${PROJECT_SOURCE_DIR}/../src/isdn/include - ${PROJECT_SOURCE_DIR}/../../libteletone/src - ${PROJECT_SOURCE_DIR}/../../../src/include -) -INCLUDE_DIRECTORIES(${mod_freetdm_INCLUDES}) - -LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/..) -ADD_LIBRARY(${PROJECT_NAME} SHARED mod_freetdm.c) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} freetdm -fPIC -Werror -fvisibility=hidden) - -IF(DEFINED WIN32) - SET(EXT lib) -ELSE(DEFINED WIN32) - SET(EXT so) -ENDIF(DEFINED WIN32) - -ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E rename lib${PROJECT_NAME}.${EXT} ${PROJECT_NAME}.${EXT} -) diff --git a/libs/freetdm/mod_freetdm/Makefile.in b/libs/freetdm/mod_freetdm/Makefile.in deleted file mode 100644 index 33ca03b440..0000000000 --- a/libs/freetdm/mod_freetdm/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -FT_CFLAGS=@CFLAGS@ @COMP_VENDOR_CFLAGS@ @DEFS@ - -BASE=../../.. -FT_DIR=.. -VERBOSE=1 -FTLA=$(FT_DIR)/libfreetdm.la -LOCAL_OBJS=tdm.o -LOCAL_CFLAGS=-I$(FT_DIR)/src/include -I$(FT_DIR)/src/isdn/include $(FT_CFLAGS) -LOCAL_LDFLAGS=-L$(FT_DIR) -lfreetdm -include $(BASE)/build/modmake.rules - -local_depend: $(FTLA) - -$(FTLA): $(FT_DIR)/.update - cd $(FT_DIR) && $(MAKE) - -local_install: - cd $(FT_DIR) && $(MAKE) install - [ -f $(DESTDIR)@confdir@/autoload_configs/freetdm.conf.xml ] || cp -f $(FT_DIR)/conf/freetdm.conf.xml $(DESTDIR)@confdir@/autoload_configs - -local_clean: - cd $(FT_DIR) && $(MAKE) clean - - diff --git a/libs/freetdm/mod_freetdm/clean.sh b/libs/freetdm/mod_freetdm/clean.sh deleted file mode 100755 index 7e531ac7ff..0000000000 --- a/libs/freetdm/mod_freetdm/clean.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -rm -rf mod_freetdm.so -rm -rf .libs/mod_freetdm.so -rm -rf mod_freetdm.o -rm -rf .libs/mod_freetdm.o -rm -rf mod_freetdm.lo diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.2008.vcproj b/libs/freetdm/mod_freetdm/mod_freetdm.2008.vcproj deleted file mode 100644 index 3fdd92af05..0000000000 --- a/libs/freetdm/mod_freetdm/mod_freetdm.2008.vcproj +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj.filters b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj.filters deleted file mode 100644 index 92ac5ead47..0000000000 --- a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c deleted file mode 100644 index 5126a3690a..0000000000 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ /dev/null @@ -1,5715 +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 - * Moises Silva - * David Yat Sin - * James Zhang - * Gideon Sadan - * - * mod_freetdm.c -- FreeTDM Endpoint Module - * - */ -#include -#include "freetdm.h" - -//#define BACKTRACE_DEBUG - -#define FREETDM_LIMIT_REALM "__freetdm" -#define FREETDM_VAR_PREFIX "freetdm_" -#define FREETDM_VAR_PREFIX_LEN (sizeof(FREETDM_VAR_PREFIX)-1) - -/* How many consecutive IO errors before giving up */ -#define FTDM_MAX_READ_WRITE_ERRORS 10 - -#define get_ss7_config_node(_cfg, _confname) _get_ss7_config_node(cfg, confname, "ISUP") - -SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load); -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_freetdm_shutdown); -SWITCH_MODULE_DEFINITION(mod_freetdm, mod_freetdm_load, mod_freetdm_shutdown, NULL); - -switch_endpoint_interface_t *freetdm_endpoint_interface; - -static switch_memory_pool_t *module_pool = NULL; - -typedef enum { - ANALOG_OPTION_NONE = 0, - ANALOG_OPTION_3WAY = (1 << 0), - ANALOG_OPTION_CALL_SWAP = (1 << 1) -} analog_option_t; - -typedef enum { - FTDM_LIMIT_RESET_ON_TIMEOUT = 0, - FTDM_LIMIT_RESET_ON_ANSWER = 1 -} limit_reset_event_t; - -typedef enum { - TFLAG_IO = (1 << 0), - TFLAG_DTMF = (1 << 1), - TFLAG_CODEC = (1 << 2), - TFLAG_BREAK = (1 << 3), - TFLAG_HOLD = (1 << 4), - TFLAG_DEAD = (1 << 5), - TFLAG_TRANSFER = (1 << 6), -} TFLAGS; - -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; - int fd; - int calls; - char hold_music[256]; - switch_mutex_t *mutex; - analog_option_t analog_options; - switch_hash_t *ss7_configs; - int sip_headers; - uint8_t crash_on_assert; - uint8_t fail_on_error; - uint8_t config_error; -} globals; - -/* private data attached to each fs session */ -struct private_object { - unsigned int flags; - switch_codec_t read_codec; - switch_codec_t write_codec; - switch_frame_t read_frame; - unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE]; - switch_frame_t cng_frame; - unsigned char cng_databuf[SWITCH_RECOMMENDED_BUFFER_SIZE]; - switch_core_session_t *session; - switch_caller_profile_t *caller_profile; - unsigned int codec; - unsigned int codecs; - unsigned short samprate; - switch_mutex_t *mutex; - switch_mutex_t *flag_mutex; - ftdm_channel_t *ftdmchan; - uint32_t write_error; - uint32_t read_error; - char network_peer_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1]; -}; - -/* private data attached to FTDM channels (only FXS for now) */ -typedef struct chan_pvt { - unsigned int flags; -} chan_pvt_t; - -typedef struct private_object private_t; - -struct span_config { - ftdm_span_t *span; - char dialplan[80]; - char context[80]; - char dial_regex[256]; - char fail_dial_regex[256]; - char hold_music[256]; - char type[256]; - analog_option_t analog_options; - const char *limit_backend; - int limit_calls; - int limit_seconds; - limit_reset_event_t limit_reset_event; - /* digital codec and digital sampling rate are used to configure the codec - * when bearer capability is set to unrestricted digital */ - const char *digital_codec; - int digital_sampling_rate; - chan_pvt_t pvts[FTDM_MAX_CHANNELS_SPAN]; -}; - -static struct span_config SPAN_CONFIG[FTDM_MAX_SPANS_INTERFACE] = {{0}}; - -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 const char* channel_get_variable(switch_core_session_t *session, switch_event_t *var_event, const char *variable_name); -ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session_t **sp); -void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream); -void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream); -#if 0 -void ctdm_init(switch_loadable_module_interface_t *module_interface); -#endif - -static switch_core_session_t *ftdm_channel_get_session(ftdm_channel_t *channel, int32_t id) -{ - switch_core_session_t *session = NULL; - const char *token = ftdm_channel_get_token(channel, id); - - if (!zstr(token)) { - if (!(session = switch_core_session_locate(token))) { - ftdm_channel_clear_token(channel, token); - } - } - - return session; -} - -static const char *ftdm_channel_get_uuid(ftdm_channel_t *channel, int32_t id) -{ - return ftdm_channel_get_token(channel, id); -} - -static void stop_hold(switch_core_session_t *session_a, const char *uuid) -{ - switch_core_session_t *session; - switch_channel_t *channel, *channel_a; - - if (!uuid) { - return; - } - - if ((session = switch_core_session_locate(uuid))) { - channel = switch_core_session_get_channel(session); - - if (switch_channel_test_flag(channel, CF_HOLD)) { - channel_a = switch_core_session_get_channel(session_a); - switch_ivr_unhold(session); - switch_channel_clear_flag(channel_a, CF_SUSPEND); - switch_channel_clear_flag(channel_a, CF_HOLD); - } else { - switch_channel_stop_broadcast(channel); - switch_channel_wait_for_flag(channel, CF_BROADCAST, SWITCH_FALSE, 2000, NULL); - } - - switch_core_session_rwunlock(session); - } -} - -static void start_hold(ftdm_channel_t *ftdmchan, switch_core_session_t *session_a, const char *uuid, const char *stream) -{ - switch_core_session_t *session; - switch_channel_t *channel, *channel_a; - int32_t spanid = 0; - - if (!uuid) { - return; - } - - spanid = ftdm_channel_get_span_id(ftdmchan); - if ((session = switch_core_session_locate(uuid))) { - channel = switch_core_session_get_channel(session); - if (zstr(stream)) { - if (!strcasecmp(globals.hold_music, "indicate_hold")) { - stream = "indicate_hold"; - } - if (!strcasecmp(SPAN_CONFIG[spanid].hold_music, "indicate_hold")) { - stream = "indicate_hold"; - } - } - - if (zstr(stream)) { - stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); - } - - if (zstr(stream)) { - stream = SPAN_CONFIG[spanid].hold_music; - } - - if (zstr(stream)) { - stream = globals.hold_music; - } - - if (zstr(stream) && !(stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE))) { - stream = globals.hold_music; - } - - if (!zstr(stream)) { - if (!strcasecmp(stream, "indicate_hold")) { - channel_a = switch_core_session_get_channel(session_a); - switch_ivr_hold_uuid(uuid, NULL, 0); - switch_channel_set_flag(channel_a, CF_SUSPEND); - switch_channel_set_flag(channel_a, CF_HOLD); - } else { - switch_ivr_broadcast(switch_core_session_get_uuid(session), stream, SMF_ECHO_ALEG | SMF_LOOP); - } - } - - switch_core_session_rwunlock(session); - } -} - - -static void cycle_foreground(ftdm_channel_t *ftdmchan, int flash, const char *bcast) { - uint32_t i = 0; - switch_core_session_t *session; - switch_channel_t *channel; - private_t *tech_pvt; - uint32_t tokencnt = ftdm_channel_get_token_count(ftdmchan); - - for (i = 0; i < tokencnt; i++) { - if ((session = ftdm_channel_get_session(ftdmchan, i))) { - const char *buuid; - tech_pvt = switch_core_session_get_private(session); - channel = switch_core_session_get_channel(session); - buuid = switch_channel_get_partner_uuid(channel); - - if (tokencnt == 1 && flash) { - if (switch_test_flag(tech_pvt, TFLAG_HOLD)) { - stop_hold(session, buuid); - switch_clear_flag_locked(tech_pvt, TFLAG_HOLD); - } else { - start_hold(ftdmchan, session, buuid, bcast); - switch_set_flag_locked(tech_pvt, TFLAG_HOLD); - } - } else if (i) { - start_hold(ftdmchan, session, buuid, bcast); - switch_set_flag_locked(tech_pvt, TFLAG_HOLD); - } else { - stop_hold(session, buuid); - switch_clear_flag_locked(tech_pvt, TFLAG_HOLD); - if (!switch_channel_test_flag(channel, CF_ANSWERED)) { - switch_channel_mark_answered(channel); - } - } - switch_core_session_rwunlock(session); - } - } -} - -static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *session, ftdm_channel_t *ftdmchan, ftdm_caller_data_t *caller_data) -{ - const char *dname = NULL; - uint32_t interval = 0, srate = 8000; - uint32_t span_id; - ftdm_codec_t codec; - - tech_pvt->ftdmchan = ftdmchan; - tech_pvt->read_frame.data = tech_pvt->databuf; - tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf); - tech_pvt->cng_frame.data = tech_pvt->cng_databuf; - tech_pvt->cng_frame.buflen = sizeof(tech_pvt->cng_databuf); - tech_pvt->cng_frame.flags = SFF_CNG; - tech_pvt->cng_frame.codec = &tech_pvt->read_codec; - memset(tech_pvt->cng_frame.data, 255, tech_pvt->cng_frame.buflen); - switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); - switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); - switch_core_session_set_private(session, tech_pvt); - tech_pvt->session = session; - - if (FTDM_SUCCESS != ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to retrieve channel interval.\n"); - return SWITCH_STATUS_GENERR; - } - - span_id = ftdm_channel_get_span_id(ftdmchan); - if (caller_data->bearer_capability == FTDM_BEARER_CAP_UNRESTRICTED - && SPAN_CONFIG[span_id].digital_codec) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Initializing digital call with codec %s at %dhz.\n", - SPAN_CONFIG[span_id].digital_codec, SPAN_CONFIG[span_id].digital_sampling_rate); - dname = SPAN_CONFIG[span_id].digital_codec; - srate = SPAN_CONFIG[span_id].digital_sampling_rate; - goto init_codecs; - } - - if (FTDM_SUCCESS != ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_CODEC, &codec)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to retrieve channel codec.\n"); - return SWITCH_STATUS_GENERR; - } - - switch (codec) { - case FTDM_CODEC_ULAW: - { - dname = "PCMU"; - } - break; - case FTDM_CODEC_ALAW: - { - dname = "PCMA"; - } - break; - case FTDM_CODEC_SLIN: - { - dname = "L16"; - } - break; - default: - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid codec value retrieved from channel, codec value: %d\n", codec); - return SWITCH_STATUS_GENERR; - } - } - -init_codecs: - - if (switch_core_codec_init(&tech_pvt->read_codec, - dname, - NULL, - NULL, - srate, - interval, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); - return SWITCH_STATUS_GENERR; - } else { - if (switch_core_codec_init(&tech_pvt->write_codec, - dname, - NULL, - NULL, - srate, - interval, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); - switch_core_codec_destroy(&tech_pvt->read_codec); - return SWITCH_STATUS_GENERR; - } - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set codec %s %dms\n", dname, interval); - switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec); - switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec); - switch_set_flag_locked(tech_pvt, TFLAG_CODEC); - tech_pvt->read_frame.codec = &tech_pvt->read_codec; - switch_set_flag_locked(tech_pvt, TFLAG_IO); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_init(switch_core_session_t *session) -{ - switch_channel_t *channel; - private_t *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_SUCCESS; - } - - /* Move channel's state machine to ROUTING */ - switch_channel_set_state(channel, CS_ROUTING); - switch_mutex_lock(globals.mutex); - globals.calls++; - switch_mutex_unlock(globals.mutex); - - //switch_channel_set_flag(channel, CF_ACCEPT_CNG); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_routing(switch_core_session_t *session) -{ - switch_channel_t *channel = NULL; - private_t *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_assert(tech_pvt->ftdmchan != NULL); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); - - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED); - } - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_execute(switch_core_session_t *session) -{ - - switch_channel_t *channel = NULL; - private_t *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_LOG, 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) -{ - private_t *tech_pvt = NULL; - - if ((tech_pvt = switch_core_session_get_private(session))) { - - if (tech_pvt->read_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->read_codec); - } - - if (tech_pvt->write_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->write_codec); - } - - switch_core_session_unset_read_codec(session); - switch_core_session_unset_write_codec(session); - - } - - return SWITCH_STATUS_SUCCESS; -} - -#ifdef BACKTRACE_DEBUG -struct debug_trace_priv { - const char *name; - int span_id; - int chan_id; -}; - -static void debug_trace(const int tid, const void *addr, const char *symbol, void *priv) -{ - struct debug_trace_priv *data = priv; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%d:%d][tid:%d] %s -> %s\n", - data->span_id, data->chan_id, tid, data->name, symbol); -} -#endif - -static switch_status_t channel_on_hangup(switch_core_session_t *session) -{ - switch_channel_t *channel = NULL; - private_t *tech_pvt = NULL; - ftdm_chan_type_t chantype; - const char *name = NULL; - int span_id = 0; - int chan_id = 0; - uint32_t t = 0; - uint32_t tokencnt; - char *uuid = NULL; - const char *token = NULL; - uint8_t uuid_found = 0; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - /* ignore any further I/O requests, we're hanging up already! */ - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - - name = switch_channel_get_name(channel); - - span_id = tech_pvt->ftdmchan ? ftdm_channel_get_span_id(tech_pvt->ftdmchan) : 0; - chan_id = tech_pvt->ftdmchan ? ftdm_channel_get_id(tech_pvt->ftdmchan) : 0; - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%d:%d] %s CHANNEL HANGUP ENTER\n", span_id, chan_id, name); - - /* First verify this call has a device attached */ - if (!tech_pvt->ftdmchan) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s does not have any ftdmchan attached\n", name); - goto end; - } - - /* Now verify the device is still attached to this call :-) - * Sometimes the FS core takes too long (more than 3 seconds) in calling - * channel_on_hangup() and the FreeTDM core decides to take the brute - * force approach and hangup and detach themselves from the call. Later - * when FS finally comes around, we might end up hanging up the device - * attached to another call, this verification avoids that. */ - uuid = switch_core_session_get_uuid(session); - tokencnt = ftdm_channel_get_token_count(tech_pvt->ftdmchan); - for (t = 0; t < tokencnt; t++) { - token = ftdm_channel_get_token(tech_pvt->ftdmchan, t); - if (!zstr(token) && !strcasecmp(uuid, token)) { - uuid_found = 1; - break; - } - } - - if (!uuid_found) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Device [%d:%d] is no longer attached to %s\n", span_id, chan_id, name); - goto end; - } - -#ifdef BACKTRACE_DEBUG - { - struct debug_trace_priv trace_data; - trace_data.name = name; - trace_data.span_id = span_id; - trace_data.chan_id = chan_id; - ftdm_backtrace_walk(&debug_trace, &trace_data); - } -#endif - - ftdm_channel_clear_token(tech_pvt->ftdmchan, switch_core_session_get_uuid(session)); - - chantype = ftdm_channel_get_type(tech_pvt->ftdmchan); - switch (chantype) { - case FTDM_CHAN_TYPE_FXO: - case FTDM_CHAN_TYPE_EM: - { - ftdm_channel_call_hangup(tech_pvt->ftdmchan); - } - break; - case FTDM_CHAN_TYPE_FXS: - { - tokencnt = ftdm_channel_get_token_count(tech_pvt->ftdmchan); - if (!ftdm_channel_call_check_busy(tech_pvt->ftdmchan) && !ftdm_channel_call_check_done(tech_pvt->ftdmchan)) { - if (tokencnt) { - cycle_foreground(tech_pvt->ftdmchan, 0, NULL); - } else { - ftdm_channel_call_hangup(tech_pvt->ftdmchan); - } - } - } - break; - case FTDM_CHAN_TYPE_CAS: - case FTDM_CHAN_TYPE_B: - { - const char *var = NULL; - switch_call_cause_t ccause = switch_channel_get_cause_q850(channel); - ftdm_call_cause_t hcause; - if (ccause < 1 || ccause > 127) { - hcause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - } else { - hcause = (ftdm_call_cause_t)ccause; - } - var = switch_channel_get_variable(channel, "ss7_rel_loc"); - if (var) { - ftdm_usrmsg_t usrmsg; - memset(&usrmsg, 0, sizeof(ftdm_usrmsg_t)); - ftdm_usrmsg_add_var(&usrmsg, "ss7_rel_loc", var); - ftdm_channel_call_hangup_with_cause_ex(tech_pvt->ftdmchan, hcause, &usrmsg); - } else { - ftdm_channel_call_hangup_with_cause(tech_pvt->ftdmchan, hcause); - } - } - break; - default: - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unhandled channel type %d for channel %s\n", chantype, switch_channel_get_name(channel)); - } - break; - } - - end: - - switch_mutex_lock(globals.mutex); - globals.calls--; - if (globals.calls < 0) { - globals.calls = 0; - } - switch_mutex_unlock(globals.mutex); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%d:%d] %s CHANNEL HANGUP EXIT\n", span_id, chan_id, name); - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig) -{ - switch_channel_t *channel = NULL; - private_t *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - switch (sig) { - case SWITCH_SIG_KILL: - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - switch_set_flag_locked(tech_pvt, TFLAG_DEAD); - break; - case SWITCH_SIG_BREAK: - switch_set_flag_locked(tech_pvt, TFLAG_BREAK); - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_exchange_media(switch_core_session_t *session) -{ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL EXCHANGE_MEDIA\n"); - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_soft_execute(switch_core_session_t *session) -{ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL SOFT_EXECUTE\n"); - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) -{ - private_t *tech_pvt = NULL; - char tmp[2] = ""; - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } - - tmp[0] = dtmf->digit; - ftdm_channel_command(tech_pvt->ftdmchan, FTDM_COMMAND_SEND_DTMF, tmp); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) -{ - switch_channel_t *channel = NULL; - private_t *tech_pvt = NULL; - ftdm_size_t len; - ftdm_wait_flag_t wflags = FTDM_READ; - char dtmf[128] = ""; - ftdm_status_t status; - int total_to; - int chunk, do_break = 0; - uint32_t span_id, chan_id; - const char *name = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - name = switch_channel_get_name(channel); - if (!tech_pvt->ftdmchan) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "no ftdmchan set in channel %s!\n", name); - return SWITCH_STATUS_FALSE; - } - - span_id = ftdm_channel_get_span_id(tech_pvt->ftdmchan); - chan_id = ftdm_channel_get_id(tech_pvt->ftdmchan); - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "TFLAG_DEAD is set in channel %s device %d:%d!\n", name, span_id, chan_id); - return SWITCH_STATUS_FALSE; - } - - /* Digium Cards sometimes timeout several times in a row here. - Yes, we support digium cards, ain't we nice....... - 6 double length intervals should compensate */ - chunk = ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 2; - total_to = chunk * 6; - - top: - - if (switch_channel_test_flag(channel, CF_SUSPEND)) { - do_break = 1; - } - - if (switch_test_flag(tech_pvt, TFLAG_BREAK)) { - switch_clear_flag_locked(tech_pvt, TFLAG_BREAK); - do_break = 1; - } - - if (switch_test_flag(tech_pvt, TFLAG_HOLD) || do_break) { - switch_yield(ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 1000); - tech_pvt->cng_frame.datalen = ftdm_channel_get_io_packet_len(tech_pvt->ftdmchan); - tech_pvt->cng_frame.samples = tech_pvt->cng_frame.datalen; - tech_pvt->cng_frame.flags = SFF_CNG; - *frame = &tech_pvt->cng_frame; - if (ftdm_channel_get_codec(tech_pvt->ftdmchan) == FTDM_CODEC_SLIN) { - tech_pvt->cng_frame.samples /= 2; - } - return SWITCH_STATUS_SUCCESS; - } - - if (!switch_test_flag(tech_pvt, TFLAG_IO)) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "TFLAG_IO is not set in channel %s device %d:%d!\n", name, span_id, chan_id); - goto fail; - } - - wflags = FTDM_READ; - status = ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, chunk); - - if (status == FTDM_FAIL) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_ERROR, "Failed to read from channel %s device %d:%d!\n", name, span_id, chan_id); - goto fail; - } - - if (status == FTDM_TIMEOUT) { - if (!switch_test_flag(tech_pvt, TFLAG_HOLD)) { - total_to -= chunk; - if (total_to <= 0) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "Too many timeouts while waiting I/O in channel %s device %d:%d!\n", name, span_id, chan_id); - goto fail; - } - } - goto top; - } - - if (!(wflags & FTDM_READ)) { - goto top; - } - - len = tech_pvt->read_frame.buflen; - if (ftdm_channel_read(tech_pvt->ftdmchan, tech_pvt->read_frame.data, &len) != FTDM_SUCCESS) { - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to read from dead channel %s device %d:%d\n", name, span_id, chan_id); - goto normal_failure; - } - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "Failed to read from channel %s device %d:%d!\n", name, span_id, chan_id); - if (++tech_pvt->read_error > FTDM_MAX_READ_WRITE_ERRORS) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_ERROR, "too many I/O read errors on channel %s device %d:%d!\n", name, span_id, chan_id); - goto fail; - } - - } else { - tech_pvt->read_error = 0; - } - - *frame = &tech_pvt->read_frame; - tech_pvt->read_frame.datalen = (uint32_t)len; - tech_pvt->read_frame.samples = tech_pvt->read_frame.datalen; - - if (ftdm_channel_get_codec(tech_pvt->ftdmchan) == FTDM_CODEC_SLIN) { - tech_pvt->read_frame.samples /= 2; - } - - while (ftdm_channel_dequeue_dtmf(tech_pvt->ftdmchan, dtmf, sizeof(dtmf))) { - switch_dtmf_t _dtmf = { 0, switch_core_default_dtmf_duration(0) }; - char *p; - for (p = dtmf; p && *p; p++) { - if (is_dtmf(*p)) { - _dtmf.digit = *p; - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Queuing DTMF [%c] in channel %s device %d:%d\n", *p, name, span_id, chan_id); - switch_channel_queue_dtmf(channel, &_dtmf); - } - } - } - - return SWITCH_STATUS_SUCCESS; - -fail: - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_ERROR, "clearing IO in channel %s device %d:%d!\n", name, span_id, chan_id); -normal_failure: - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - return SWITCH_STATUS_GENERR; -} - -static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) -{ - switch_channel_t *channel = NULL; - private_t *tech_pvt = NULL; - ftdm_size_t len; - unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; - const char *name = "(none)"; - ftdm_wait_flag_t wflags = FTDM_WRITE; - uint32_t span_id = 0, chan_id = 0; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - name = switch_channel_get_name(channel); - if (!tech_pvt->ftdmchan) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "no ftdmchan set in channel %s!\n", name); - return SWITCH_STATUS_FALSE; - } - - span_id = ftdm_channel_get_span_id(tech_pvt->ftdmchan); - chan_id = ftdm_channel_get_id(tech_pvt->ftdmchan); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "TFLAG_DEAD is set in channel %s device %d:%d!\n", name, span_id, chan_id); - return SWITCH_STATUS_FALSE; - } - - if (switch_test_flag(tech_pvt, TFLAG_HOLD)) { - return SWITCH_STATUS_SUCCESS; - } - - if (!switch_test_flag(tech_pvt, TFLAG_IO)) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "TFLAG_IO is not set in channel %s device %d:%d!\n", name, span_id, chan_id); - goto fail; - } - - if (switch_test_flag(frame, SFF_CNG)) { - frame->data = data; - frame->buflen = sizeof(data); - if ((frame->datalen = tech_pvt->write_codec.implementation->encoded_bytes_per_packet) > frame->buflen) { - goto fail; - } - memset(data, 255, frame->datalen); - } - - - wflags = FTDM_WRITE; - ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 10); - - if (!(wflags & FTDM_WRITE)) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Dropping frame! (write not ready) in channel %s device %d:%d!\n", name, span_id, chan_id); - return SWITCH_STATUS_SUCCESS; - } - - len = frame->datalen; - if (ftdm_channel_write(tech_pvt->ftdmchan, frame->data, frame->buflen, &len) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Failed to write to channel %s device %d:%d!\n", name, span_id, chan_id); - if (++tech_pvt->write_error > FTDM_MAX_READ_WRITE_ERRORS) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), - SWITCH_LOG_ERROR, "Too many I/O write errors on channel %s device %d:%d!\n", name, span_id, chan_id); - goto fail; - } - } else { - tech_pvt->write_error = 0; - } - - return SWITCH_STATUS_SUCCESS; - - fail: - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Error writing to channel %s device %d:%d!\n", name, span_id, chan_id); - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - return SWITCH_STATUS_GENERR; - -} - -static switch_status_t channel_receive_message_cas(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - switch_channel_t *channel; - private_t *tech_pvt; - uint32_t phy_id; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = (private_t *) switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } - - phy_id = ftdm_channel_get_ph_id(tech_pvt->ftdmchan); - ftdm_log(FTDM_LOG_DEBUG, "Got Freeswitch message in R2 channel %d [%d]\n", phy_id, msg->message_id); - - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - return SWITCH_STATUS_SUCCESS; - } - - switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_RINGING: - { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROGRESS); - } - break; - case SWITCH_MESSAGE_INDICATE_PROGRESS: - { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA); - } - break; - case SWITCH_MESSAGE_INDICATE_ANSWER: - { - ftdm_channel_call_answer(tech_pvt->ftdmchan); - } - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_receive_message_b(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - switch_channel_t *channel; - private_t *tech_pvt; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = (private_t *) switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } - - if (ftdm_channel_call_check_hangup(tech_pvt->ftdmchan)) { - return SWITCH_STATUS_SUCCESS; - } - - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - return SWITCH_STATUS_SUCCESS; - } - - switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_RINGING: - { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_RINGING); - } - break; - case SWITCH_MESSAGE_INDICATE_PROGRESS: - { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA); - } - break; - case SWITCH_MESSAGE_INDICATE_ANSWER: - { - ftdm_channel_call_answer(tech_pvt->ftdmchan); - } - break; - case SWITCH_MESSAGE_INDICATE_REDIRECT: - case SWITCH_MESSAGE_INDICATE_DEFLECT: - { - ftdm_usrmsg_t usrmsg; - const char *val = NULL; - - memset(&usrmsg, 0, sizeof(usrmsg)); - - if ((val = switch_channel_get_variable(channel, "freetdm_transfer_data"))) { - ftdm_usrmsg_add_var(&usrmsg, "transfer_data", val); - } - - switch_set_flag(tech_pvt, TFLAG_TRANSFER); - if (ftdm_channel_call_transfer_ex(tech_pvt->ftdmchan, msg->string_arg, &usrmsg) != FTDM_SUCCESS) { - switch_clear_flag(tech_pvt, TFLAG_TRANSFER); - } - while (switch_test_flag(tech_pvt, TFLAG_TRANSFER)) { - switch_yield(100000); - } - } - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_receive_message_fxo(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - switch_channel_t *channel; - private_t *tech_pvt; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = (private_t *) switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } - - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - return SWITCH_STATUS_SUCCESS; - } - - switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_PROGRESS: - case SWITCH_MESSAGE_INDICATE_ANSWER: - ftdm_channel_call_answer(tech_pvt->ftdmchan); - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_receive_message_fxs(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - switch_channel_t *channel; - private_t *tech_pvt; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = (private_t *) switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } - - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - return SWITCH_STATUS_SUCCESS; - } - - switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_PROGRESS: - case SWITCH_MESSAGE_INDICATE_ANSWER: - ftdm_channel_call_answer(tech_pvt->ftdmchan); - switch_channel_mark_answered(channel); - break; - case SWITCH_MESSAGE_INDICATE_RINGING: - if (!switch_channel_test_flag(channel, CF_ANSWERED) && - !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && - !switch_channel_test_flag(channel, CF_RING_READY) - ) { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_RINGING); - switch_channel_mark_ring_ready(channel); - } - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - private_t *tech_pvt; - switch_status_t status; - switch_channel_t *channel; - const char *var; - ftdm_channel_t *ftdmchan = NULL; - - tech_pvt = (private_t *) switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - channel = switch_core_session_get_channel(session); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } - - if (!(ftdmchan = tech_pvt->ftdmchan)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } - - if (!tech_pvt->ftdmchan) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } - - switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_PROGRESS: - case SWITCH_MESSAGE_INDICATE_ANSWER: - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { - if ((var = switch_channel_get_variable(channel, "freetdm_pre_buffer_size"))) { - int tmp = atoi(var); - if (tmp > -1) { - ftdm_channel_command(tech_pvt->ftdmchan, FTDM_COMMAND_SET_PRE_BUFFER_SIZE, &tmp); - } - } - if ((var = switch_channel_get_variable(channel, "freetdm_disable_dtmf"))) { - ftdm_channel_command(tech_pvt->ftdmchan, FTDM_COMMAND_DISABLE_DTMF_DETECT, NULL); - } - } - break; - case SWITCH_MESSAGE_INDICATE_UUID_CHANGE: - { - ftdm_channel_replace_token(tech_pvt->ftdmchan, msg->string_array_arg[0], msg->string_array_arg[1]); - } - break; - default: - break; - } - - switch (ftdm_channel_get_type(tech_pvt->ftdmchan)) { - case FTDM_CHAN_TYPE_FXS: - case FTDM_CHAN_TYPE_EM: - status = channel_receive_message_fxs(session, msg); - break; - case FTDM_CHAN_TYPE_FXO: - status = channel_receive_message_fxo(session, msg); - break; - case FTDM_CHAN_TYPE_B: - status = channel_receive_message_b(session, msg); - break; - case FTDM_CHAN_TYPE_CAS: - status = channel_receive_message_cas(session, msg); - break; - default: - status = SWITCH_STATUS_FALSE; - break; - } - - return status; -} - -switch_state_handler_table_t freetdm_state_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 freetdm_io_routines = { - /*.outgoing_channel */ channel_outgoing_channel, - /*.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 -}; - -static const char* channel_get_variable(switch_core_session_t *session, switch_event_t *var_event, const char *variable_name) -{ - const char *variable = NULL; - - if (var_event) { - if ((variable = switch_event_get_header(var_event, variable_name))) { - return variable; - } - } - - if (session) { - switch_channel_t *channel = switch_core_session_get_channel(session); - if ((variable = switch_channel_get_variable(channel, variable_name))) { - return variable; - } - } - return NULL; -} - -typedef struct { - switch_event_t *var_event; - switch_core_session_t *new_session; - private_t *tech_pvt; - switch_caller_profile_t *caller_profile; -} hunt_data_t; - -static ftdm_status_t on_channel_found(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data) -{ - uint32_t span_id, chan_id; - const char *var; - char *sess_uuid; - char name[128]; - ftdm_status_t status; - hunt_data_t *hdata = caller_data->priv; - switch_channel_t *channel = switch_core_session_get_channel(hdata->new_session); - - if ((var = switch_event_get_header(hdata->var_event, "freetdm_pre_buffer_size"))) { - int tmp = atoi(var); - if (tmp > -1) { - ftdm_channel_command(fchan, FTDM_COMMAND_SET_PRE_BUFFER_SIZE, &tmp); - } - } - - span_id = ftdm_channel_get_span_id(fchan); - chan_id = ftdm_channel_get_id(fchan); - - tech_init(hdata->tech_pvt, hdata->new_session, fchan, caller_data); - - snprintf(name, sizeof(name), "FreeTDM/%u:%u/%s", span_id, chan_id, caller_data->dnis.digits); - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Connect outbound channel %s\n", name); - switch_channel_set_name(channel, name); - switch_channel_set_variable(channel, "freetdm_span_name", ftdm_channel_get_span_name(fchan)); - switch_channel_set_variable_printf(channel, "freetdm_span_number", "%d", span_id); - switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chan_id); - - switch_channel_set_caller_profile(channel, hdata->caller_profile); - hdata->tech_pvt->caller_profile = hdata->caller_profile; - - switch_channel_set_state(channel, CS_INIT); - sess_uuid = switch_core_session_get_uuid(hdata->new_session); - status = ftdm_channel_add_token(fchan, sess_uuid, ftdm_channel_get_token_count(fchan)); - switch_assert(status == FTDM_SUCCESS); - - if (SPAN_CONFIG[span_id].limit_calls) { - char spanresource[512]; - snprintf(spanresource, sizeof(spanresource), "span_%s_%s", ftdm_channel_get_span_name(fchan), - caller_data->dnis.digits); - - ftdm_log(FTDM_LOG_DEBUG, "Adding rate limit resource on channel %d:%d (%s/%s/%d/%d)\n", - span_id, chan_id, FREETDM_LIMIT_REALM, - spanresource, SPAN_CONFIG[span_id].limit_calls, SPAN_CONFIG[span_id].limit_seconds); - - if (switch_limit_incr("hash", hdata->new_session, FREETDM_LIMIT_REALM, spanresource, - SPAN_CONFIG[span_id].limit_calls, SPAN_CONFIG[span_id].limit_seconds) != SWITCH_STATUS_SUCCESS) { - return FTDM_BREAK; - } - } - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Attached session %s to channel %d:%d\n", sess_uuid, span_id, chan_id); - return FTDM_SUCCESS; -} - -/* 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 flags, switch_call_cause_t *cancel_cause) -{ - hunt_data_t hunt_data; - const char *dest = NULL; - char *data = NULL; - int span_id = -1, group_id = -1, chan_id = 0; - switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_status_t status; - ftdm_hunt_direction_t direction = FTDM_HUNT_BOTTOM_UP; - ftdm_caller_data_t caller_data = {{ 0 }}; - char *span_name = NULL; - switch_event_header_t *h; - char *argv[3]; - int argc = 0; - const char *var; - const char *dest_num = NULL, *callerid_num = NULL; - const char *network_peer_uuid = NULL; - char sigbridge_peer[255]; - switch_channel_t *peer_chan = NULL; - switch_channel_t *our_chan = NULL; - ftdm_hunting_scheme_t hunting; - ftdm_usrmsg_t usrmsg; - - memset(&usrmsg, 0, sizeof(ftdm_usrmsg_t)); - memset(sigbridge_peer, 0, sizeof(sigbridge_peer)); - - if (!outbound_profile) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing caller profile\n"); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - if (zstr(outbound_profile->destination_number)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string\n"); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - - data = switch_core_strdup(outbound_profile->pool, outbound_profile->destination_number); - - if (!zstr(outbound_profile->destination_number)) { - dest_num = switch_sanitize_number(switch_core_strdup(outbound_profile->pool, outbound_profile->destination_number)); - } - - if (!zstr(outbound_profile->caller_id_number)) { - callerid_num = switch_sanitize_number(switch_core_strdup(outbound_profile->pool, outbound_profile->caller_id_number)); - if ( callerid_num && *callerid_num == '+' ) { - callerid_num++; - } - } - - if (!zstr(callerid_num) && !strcmp(callerid_num, SWITCH_DEFAULT_CLID_NUMBER)) { - callerid_num = NULL; - } - - if ((argc = switch_separate_string(data, '/', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string\n"); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - if (switch_is_number(argv[0])) { - span_id = atoi(argv[0]); - } else { - span_name = argv[0]; - } - - if (*argv[1] == 'a') { - direction = FTDM_HUNT_BOTTOM_UP; - } else if (*argv[1] == 'A') { - direction = FTDM_HUNT_TOP_DOWN; - } else if (*argv[1] == 'R') { - direction = FTDM_HUNT_RR_DOWN; - } else if (*argv[1] == 'r') { - direction = FTDM_HUNT_RR_UP; - } else { - chan_id = atoi(argv[1]); - } - - if (!(dest = argv[2])) { - dest = ""; - } - - if (span_id == 0 && chan_id != 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Span 0 is used to pick the first available span, selecting a channel is not supported (and doesn't make sense)\n"); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - if (span_id == -1 && !zstr(span_name)) { - ftdm_span_t *span; - ftdm_status_t zstatus = ftdm_span_find_by_name(span_name, &span); - if (zstatus == FTDM_SUCCESS && span) { - span_id = ftdm_span_get_id(span); - } - } - - if (span_id == -1) { - //Look for a group - ftdm_group_t *group; - ftdm_status_t zstatus = ftdm_group_find_by_name(span_name, &group); - if (zstatus == FTDM_SUCCESS && group) { - group_id = ftdm_group_get_id(group); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing ftdm span or group: %s\n", span_name); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - } - - if (group_id < 0 && chan_id < 0) { - direction = FTDM_HUNT_BOTTOM_UP; - chan_id = 0; - } - - if (session && globals.sip_headers && !switch_core_session_check_interface (session,freetdm_endpoint_interface) ) { - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *sipvar; - - network_peer_uuid = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-TransUUID"); - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-CallerName"); - if (sipvar) { - ftdm_set_string(caller_data.cid_name, sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-CallerNumber"); - if (sipvar) { - if ( *sipvar == '+' ) { - sipvar++; - } - ftdm_set_string(caller_data.cid_num.digits, sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI"); - if (sipvar) { - ftdm_set_string(caller_data.ani.digits, sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI-TON"); - if (sipvar) { - caller_data.ani.type = (uint8_t)atoi(sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI-Plan"); - if (sipvar) { - caller_data.ani.plan = (uint8_t)atoi(sipvar); - } - - /* Used by ftmod_sangoma_ss7 only */ - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI-NADI"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_clg_nadi", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI2"); - if (sipvar) { - ftdm_set_string(caller_data.aniII, sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-DNIS"); - if (sipvar) { - ftdm_set_string(caller_data.dnis.digits, sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-LOC"); - if (sipvar) { - ftdm_set_string(caller_data.loc.digits, sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Access-Transport-URLENC"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_access_transport_urlenc", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-LOC-Screen"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_loc_screen_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-LOC-Presentation"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_loc_pres_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-LOC-NADI"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_loc_nadi", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-DNIS-TON"); - if (sipvar) { - caller_data.dnis.type = (uint8_t)atoi(sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-DNIS-Plan"); - if (sipvar) { - caller_data.dnis.plan = (uint8_t)atoi(sipvar); - } - - /* Used by ftmod_sangoma_ss7 only */ - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-DNIS-NADI"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_cld_nadi", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS"); - if (sipvar) { - ftdm_set_string(caller_data.rdnis.digits, sipvar); - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_digits", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_plan", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-NADI"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_nadi", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Screen"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_screen_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Presentation"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_pres_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_digits", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NumQual"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_numqual", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NADI"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_nadi", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Screen"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_screen_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Presentation"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_pres_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Plan"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_npi", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NumInComp"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_num_inc_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_screen_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Presentation"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_pres_ind", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-CPC"); - if (sipvar) { - ftdm_set_calling_party_category(sipvar, (uint8_t *)&caller_data.cpc); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-IAM"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_iam", sipvar); - } - - /* redirection information */ - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDINF-Indicator"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdinfo_indicator", sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDINF-OrigReason"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdinfo_orig", sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDINF-Count"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdinfo_count", sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDINF-Reason"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_rdinfo_reason", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-OCN"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_ocn", sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-OCN-NADI"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_ocn_nadi", sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-OCN-Plan"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_ocn_plan", sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-OCN-Presentation"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_ocn_pres", sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-IAM-FWD-IND-HEX"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_iam_fwd_ind_hex", sipvar); - } - - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-IAM-NATURE-CONN-HEX"); - if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_iam_nature_connection_hex", sipvar); - } - } - - if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) { - caller_data.screen = FTDM_SCREENING_VERIFIED_PASSED; - } - - if (switch_test_flag(outbound_profile, SWITCH_CPF_HIDE_NUMBER)) { - caller_data.pres = FTDM_PRES_RESTRICTED; - } - - if ((var = channel_get_variable(session, var_event, "freetdm_iam_fwd_ind_isdn_access_ind"))) { - ftdm_usrmsg_add_var(&usrmsg, "iam_fwd_ind_isdn_access_ind", var); - } - - if ((var = channel_get_variable(session, var_event, "freetdm_bearer_capability"))) { - caller_data.bearer_capability = (uint8_t)atoi(var); - } - - if ((var = channel_get_variable(session, var_event, "freetdm_bearer_layer1"))) { - caller_data.bearer_layer1 = (uint8_t)atoi(var); - } - - if ((var = channel_get_variable(session, var_event, "freetdm_screening_ind"))) { - ftdm_set_screening_ind(var, &caller_data.screen); - } - - if ((var = channel_get_variable(session, var_event, "freetdm_presentation_ind"))) { - ftdm_set_presentation_ind(var, &caller_data.pres); - } - - if ((var = channel_get_variable(session, var_event, "freetdm_outbound_ton"))) { - ftdm_set_ton(var, &caller_data.dnis.type); - } else { - caller_data.dnis.type = outbound_profile->destination_number_ton; - } - - if ((var = channel_get_variable(session, var_event, "freetdm_outbound_npi"))) { - ftdm_set_npi(var, &caller_data.dnis.plan); - } else { - caller_data.dnis.plan = outbound_profile->destination_number_numplan; - } - - if ((var = channel_get_variable(session, var_event, "freetdm_calling_party_category"))) { - ftdm_set_calling_party_category(var, (uint8_t *)&caller_data.cpc); - } - - if (!zstr(dest)) { - ftdm_set_string(caller_data.dnis.digits, dest); - } - - caller_data.dnis.plan = outbound_profile->destination_number_numplan; - - /* blindly copy data from outbound_profile. They will be overwritten - * by calling ftdm_caller_data if needed after */ - caller_data.cid_num.type = outbound_profile->caller_ton; - caller_data.cid_num.plan = outbound_profile->caller_numplan; - caller_data.rdnis.type = outbound_profile->rdnis_ton; - caller_data.rdnis.plan = outbound_profile->rdnis_numplan; - - ftdm_set_string(caller_data.cid_name, outbound_profile->caller_id_name); - ftdm_set_string(caller_data.cid_num.digits, switch_str_nil(callerid_num)); - - memset(&hunting, 0, sizeof(hunting)); - - if (group_id >= 0) { - hunting.mode = FTDM_HUNT_GROUP; - hunting.mode_data.group.group_id = group_id; - hunting.mode_data.group.direction = direction; - } else if (chan_id) { - hunting.mode = FTDM_HUNT_CHAN; - hunting.mode_data.chan.span_id = span_id; - hunting.mode_data.chan.chan_id = chan_id; - } else { - hunting.mode = FTDM_HUNT_SPAN; - hunting.mode_data.span.span_id = span_id; - hunting.mode_data.span.direction = direction; - } - - for (h = var_event->headers; h; h = h->next) { - if (!strncasecmp(h->name, FREETDM_VAR_PREFIX, FREETDM_VAR_PREFIX_LEN)) { - char *v = h->name + FREETDM_VAR_PREFIX_LEN; - if (!zstr(v)) { - if (!strcasecmp(v, "ss7_iam")) { - /* Do not print the value of ss7_iam as it is very long */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding outbound freetdm variable %s to channel %d:%d\n", v, span_id, chan_id); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding outbound freetdm variable %s=%s to channel %d:%d\n", v, h->value, span_id, chan_id); - } - - ftdm_usrmsg_add_var(&usrmsg, v, h->value); - } - } - } - - if ((*new_session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { - private_t *tech_pvt; - switch_caller_profile_t *caller_profile; - - switch_core_session_add_stream(*new_session, NULL); - if (!(tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t)))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n"); - switch_core_session_destroy(new_session); - cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - goto fail; - } - - our_chan = switch_core_session_get_channel(*new_session); - - switch_channel_set_flag(our_chan, CF_AUDIO); - - /* Figure out if there is a native bridge requested through SIP x headers */ - if (network_peer_uuid) { - switch_core_session_t *network_peer = switch_core_session_locate(network_peer_uuid); - if (network_peer) { - const char *my_uuid = switch_core_session_get_uuid(*new_session); - private_t *peer_private = switch_core_session_get_private(network_peer); - peer_chan = switch_core_session_get_channel(network_peer); - switch_set_string(tech_pvt->network_peer_uuid, network_peer_uuid); - switch_set_string(peer_private->network_peer_uuid, my_uuid); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session %s is network-bridged with %s\n", - my_uuid, network_peer_uuid); - - snprintf(sigbridge_peer, sizeof(sigbridge_peer), "%u:%u", - ftdm_channel_get_span_id(peer_private->ftdmchan), ftdm_channel_get_id(peer_private->ftdmchan)); - switch_core_session_rwunlock(network_peer); - } - /* Figure out if there is a native bridge requested through dial plan variable and the originating channel is also freetdm (not going through SIP) */ - } else if (session - && (var = channel_get_variable(session, var_event, FREETDM_VAR_PREFIX "native_sigbridge")) - && switch_true(var) - && switch_core_session_compare(*new_session, session)) { - private_t *peer_pvt = switch_core_session_get_private(session); - peer_chan = switch_core_session_get_channel(session); - snprintf(sigbridge_peer, sizeof(sigbridge_peer), "%u:%u", - ftdm_channel_get_span_id(peer_pvt->ftdmchan), ftdm_channel_get_id(peer_pvt->ftdmchan)); - } - - caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); - caller_profile->destination_number = switch_core_strdup(caller_profile->pool, switch_str_nil(dest_num)); - caller_profile->caller_id_number = switch_core_strdup(caller_profile->pool, switch_str_nil(callerid_num)); - - hunting.result_cb = on_channel_found; - hunt_data.var_event = var_event; - hunt_data.new_session = *new_session; - hunt_data.caller_profile = caller_profile; - hunt_data.tech_pvt = tech_pvt; - caller_data.priv = &hunt_data; - - if (session && !zstr(sigbridge_peer)) { - peer_chan = switch_core_session_get_channel(session); - ftdm_usrmsg_add_var(&usrmsg, "sigbridge_peer", sigbridge_peer); - } - - if ((status = ftdm_call_place_ex(&caller_data, &hunting, &usrmsg)) != FTDM_SUCCESS) { - if (tech_pvt->read_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->read_codec); - } - - if (tech_pvt->write_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->write_codec); - } - switch_core_session_destroy(new_session); - if (status == FTDM_BREAK || status == FTDM_EBUSY) { - cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION; - } else { - cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - goto fail; - } - - if (our_chan && peer_chan) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, - "Bridging native signaling of channel %s to channel %s\n", - switch_channel_get_name(peer_chan), switch_channel_get_name(our_chan)); - } - - return SWITCH_CAUSE_SUCCESS; - } - -fail: - return cause; -} - -static void ftdm_enable_channel_dtmf(ftdm_channel_t *fchan, switch_channel_t *channel) -{ - if (channel) { - const char *var; - if ((var = switch_channel_get_variable(channel, "freetdm_disable_dtmf"))) { - if (switch_true(var)) { - ftdm_channel_command(fchan, FTDM_COMMAND_DISABLE_DTMF_DETECT, NULL); - ftdm_log(FTDM_LOG_INFO, "DTMF detection disabled in channel %d:%d\n", ftdm_channel_get_span_id(fchan), ftdm_channel_get_id(fchan)); - return; - } - } - /* the variable is not present or has a negative value then proceed to enable DTMF ... */ - } - if (ftdm_channel_command(fchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, NULL) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to enable DTMF detection in channel %d:%d\n", ftdm_channel_get_span_id(fchan), ftdm_channel_get_id(fchan)); - } -} - -ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session_t **sp) -{ - switch_core_session_t *session = NULL; - private_t *tech_pvt = NULL; - switch_channel_t *channel = NULL; - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - const char *var_name = NULL; - const char *var_value = NULL; - uint32_t spanid, chanid; - char name[128]; - ftdm_caller_data_t *channel_caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - - *sp = NULL; - - spanid = ftdm_channel_get_span_id(sigmsg->channel); - chanid = ftdm_channel_get_id(sigmsg->channel); - - if (!(session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n"); - return FTDM_FAIL; - } - - /* I guess we always want DTMF detection */ - ftdm_enable_channel_dtmf(sigmsg->channel, NULL); - - switch_core_session_add_stream(session, NULL); - - tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t)); - assert(tech_pvt != NULL); - channel = switch_core_session_get_channel(session); - if (tech_init(tech_pvt, session, sigmsg->channel, channel_caller_data) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n"); - switch_core_session_destroy(&session); - return FTDM_FAIL; - } - - switch_channel_set_flag(channel, CF_AUDIO); - - channel_caller_data->collected[0] = '\0'; - - if (zstr(channel_caller_data->cid_name)) { - switch_set_string(channel_caller_data->cid_name, ftdm_channel_get_name(sigmsg->channel)); - } - - if (zstr(channel_caller_data->cid_num.digits)) { - if (!zstr(channel_caller_data->ani.digits)) { - switch_set_string(channel_caller_data->cid_num.digits, channel_caller_data->ani.digits); - } else { - switch_set_string(channel_caller_data->cid_num.digits, ftdm_channel_get_number(sigmsg->channel)); - } - } - - tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), - "FreeTDM", - SPAN_CONFIG[spanid].dialplan, - channel_caller_data->cid_name, - channel_caller_data->cid_num.digits, - NULL, - channel_caller_data->ani.digits, - channel_caller_data->aniII, - channel_caller_data->rdnis.digits, - (char *)modname, - SPAN_CONFIG[spanid].context, - channel_caller_data->dnis.digits); - - assert(tech_pvt->caller_profile != NULL); - - if (channel_caller_data->screen == 1 || channel_caller_data->screen == 3) { - switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_SCREEN); - } - - tech_pvt->caller_profile->caller_ton = channel_caller_data->cid_num.type; - tech_pvt->caller_profile->caller_numplan = channel_caller_data->cid_num.plan; - tech_pvt->caller_profile->ani_ton = channel_caller_data->ani.type; - tech_pvt->caller_profile->ani_numplan = channel_caller_data->ani.plan; - tech_pvt->caller_profile->destination_number_ton = channel_caller_data->dnis.type; - tech_pvt->caller_profile->destination_number_numplan = channel_caller_data->dnis.plan; - tech_pvt->caller_profile->rdnis_ton = channel_caller_data->rdnis.type; - tech_pvt->caller_profile->rdnis_numplan = channel_caller_data->rdnis.plan; - - if (channel_caller_data->pres) { - switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER); - } - - snprintf(name, sizeof(name), "FreeTDM/%u:%u/%s", spanid, chanid, tech_pvt->caller_profile->destination_number); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect inbound channel %s\n", name); - switch_channel_set_name(channel, name); - switch_channel_set_caller_profile(channel, tech_pvt->caller_profile); - - switch_channel_set_variable(channel, "freetdm_span_name", ftdm_channel_get_span_name(sigmsg->channel)); - switch_channel_set_variable_printf(channel, "freetdm_span_number", "%d", spanid); - switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chanid); - switch_channel_set_variable_printf(channel, "freetdm_bearer_capability", "%d", channel_caller_data->bearer_capability); - switch_channel_set_variable_printf(channel, "freetdm_bearer_layer1", "%d", channel_caller_data->bearer_layer1); - switch_channel_set_variable_printf(channel, "freetdm_calling_party_category", ftdm_calling_party_category2str(channel_caller_data->cpc)); - switch_channel_set_variable_printf(channel, "screening_ind", ftdm_screening2str(channel_caller_data->screen)); - switch_channel_set_variable_printf(channel, "presentation_ind", ftdm_presentation2str(channel_caller_data->pres)); - - if (globals.sip_headers) { - switch_channel_set_variable(channel, "sip_h_X-FreeTDM-SpanName", ftdm_channel_get_span_name(sigmsg->channel)); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-SpanNumber", "%d", spanid); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-TransUUID", "%s",switch_core_session_get_uuid(session)); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-SpanNumber", "%d", spanid); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ChanNumber", "%d", chanid); - - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CallerName", "%s", channel_caller_data->cid_name); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CallerNumber", "%s", channel_caller_data->cid_num.digits); - - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ANI", "%s", channel_caller_data->ani.digits); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ANI-TON", "%d", channel_caller_data->ani.type); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ANI-Plan", "%d", channel_caller_data->ani.plan); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ANI2", "%s", channel_caller_data->aniII); - - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS", "%s", channel_caller_data->dnis.digits); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-TON", "%d", channel_caller_data->dnis.type); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-Plan", "%d", channel_caller_data->dnis.plan); - - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS", "%s", channel_caller_data->rdnis.digits); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-NADI", "%d", channel_caller_data->rdnis.type); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%s", ftdm_calling_party_category2str(channel_caller_data->cpc)); - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_iam_nature_connection_hex"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-IAM-NATURE-CONN-HEX", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_iam_fwd_ind_hex"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-IAM-FWD-IND-HEX", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_access_transport_urlenc"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Access-Transport-URLENC", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_indicator"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-Indicator", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_orig"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-OrigReason", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_count"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-Count", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdinfo_reason"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDINF-Reason", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_clg_nadi"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-NADI", "%s", var_value); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ANI-NADI", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_cld_nadi"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-NADI", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_screen_ind"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Screen", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_pres_ind"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Presentation", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN", "%s", var_value); - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_numqual"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumQual", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_nadi"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NADI", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_screen_ind"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Screen", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_pres_ind"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Presentation", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_npi"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Plan", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_num_inc_ind"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumInComp", "%s", var_value); - } - } /* End - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); */ - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_iam"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-IAM", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_cic"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CIC", "%s", var_value); - } - - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CallReference", "%d", channel_caller_data->call_reference); - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_opc"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-OPC", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_loc_digits"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-LOC", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_loc_screen_ind"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-LOC-Screen", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_loc_pres_ind"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-LOC-Presentation", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_loc_nadi"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-LOC-NADI", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_ocn"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-OCN", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_ocn_nadi"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-OCN-NADI", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_ocn_plan"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-OCN-Plan", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_ocn_pres"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-OCN-Presentation", "%s", var_value); - } - } - - /* Add any call variable to the dial plan */ - iter = ftdm_sigmsg_get_var_iterator(sigmsg, iter); - for (curr = iter ; curr; curr = ftdm_iterator_next(curr)) { - ftdm_get_current_var(curr, &var_name, &var_value); - snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); - switch_channel_set_variable_printf(channel, name, "%s", var_value); - if (!strcasecmp(var_name, "ss7_iam")) { - /* Do not print freetdm_ss7_iam as it is a very long variable */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Variable: %s is present\n", name); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Variable: %s = %s\n", name, var_value); - } - } - ftdm_iterator_free(iter); - - switch_channel_set_state(channel, CS_INIT); - if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n"); - switch_core_session_destroy(&session); - return FTDM_FAIL; - } - - if (ftdm_channel_add_token(sigmsg->channel, switch_core_session_get_uuid(session), 0) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding token\n"); - switch_core_session_destroy(&session); - return FTDM_FAIL; - } - *sp = session; - - return FTDM_SUCCESS; -} - -static FIO_SIGNAL_CB_FUNCTION(on_common_signal) -{ - uint32_t chanid, spanid; - switch_event_t *event = NULL; - ftdm_alarm_flag_t alarmbits = FTDM_ALARM_NONE; - - chanid = ftdm_channel_get_id(sigmsg->channel); - spanid = ftdm_channel_get_span_id(sigmsg->channel); - - switch (sigmsg->event_id) { - case FTDM_SIGEVENT_SMS: - { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - ftdm_sms_data_t *sms = (ftdm_sms_data_t*) caller_data->priv; - - ftdm_log(FTDM_LOG_INFO, "SMS received on %d:%d from %s: %s", spanid, chanid, sms->from, sms->body); - if (switch_event_create(&event, SWITCH_EVENT_TRAP) != SWITCH_STATUS_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to create SMS event\n"); - return FTDM_FAIL; - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", sms->from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "body", sms->body); - alarmbits = 0; - } - //return FTDM_BREAK; - break; - case FTDM_SIGEVENT_ALARM_CLEAR: - case FTDM_SIGEVENT_ALARM_TRAP: - { - if (ftdm_channel_get_alarms(sigmsg->channel, &alarmbits) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to retrieve alarms\n"); - return FTDM_FAIL; - } - if (switch_event_create(&event, SWITCH_EVENT_TRAP) != SWITCH_STATUS_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to create alarms events\n"); - return FTDM_FAIL; - } - if (sigmsg->event_id == FTDM_SIGEVENT_ALARM_CLEAR) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "condition", "ftdm-alarm-clear"); - } else { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "condition", "ftdm-alarm-trap"); - } - } - break; - case FTDM_SIGEVENT_UP: - { - /* clear any rate limit resource for this span */ - char spanresource[512]; - if (SPAN_CONFIG[spanid].limit_reset_event == FTDM_LIMIT_RESET_ON_ANSWER && SPAN_CONFIG[spanid].limit_calls) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - snprintf(spanresource, sizeof(spanresource), "span_%s_%s", ftdm_channel_get_span_name(sigmsg->channel), caller_data->dnis.digits); - ftdm_log(FTDM_LOG_DEBUG, "Clearing rate limit resource on channel %d:%d (%s/%s)\n", spanid, chanid, FREETDM_LIMIT_REALM, spanresource); - switch_limit_interval_reset("hash", FREETDM_LIMIT_REALM, spanresource); - } - return FTDM_SUCCESS; - } - break; - case FTDM_SIGEVENT_TRANSFER_COMPLETED: - { - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - private_t *tech_pvt = NULL; - - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - tech_pvt = switch_core_session_get_private(session); - - switch_clear_flag_locked(tech_pvt, TFLAG_TRANSFER); - switch_channel_set_variable(channel, "freetdm_transfer_response", ftdm_transfer_response2str(sigmsg->ev_data.transfer_completed.response)); - switch_core_session_rwunlock(session); - } - return FTDM_SUCCESS; - } - break; - case FTDM_SIGEVENT_RELEASED: - case FTDM_SIGEVENT_INDICATION_COMPLETED: - case FTDM_SIGEVENT_DIALING: - { - /* Swallow these events */ - return FTDM_BREAK; - } - break; - case FTDM_SIGEVENT_STOP: - case FTDM_SIGEVENT_RESTART: - { - switch_core_session_t *session = NULL; - private_t *tech_pvt = NULL; - while ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - tech_pvt = switch_core_session_get_private(session); - - switch_clear_flag_locked(tech_pvt, TFLAG_TRANSFER); - switch_core_session_rwunlock(session); - return FTDM_SUCCESS; - } - } - break; - default: - return FTDM_SUCCESS; - break; - } - - if (event) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-name", "%s", ftdm_channel_get_span_name(sigmsg->channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-number", "%d", ftdm_channel_get_span_id(sigmsg->channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "chan-number", "%d", ftdm_channel_get_id(sigmsg->channel)); - - if (alarmbits & FTDM_ALARM_RED) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "red"); - } - if (alarmbits & FTDM_ALARM_YELLOW) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "yellow"); - } - if (alarmbits & FTDM_ALARM_RAI) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "rai"); - } - if (alarmbits & FTDM_ALARM_BLUE) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "blue"); - } - if (alarmbits & FTDM_ALARM_AIS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "ais"); - } - if (alarmbits & FTDM_ALARM_GENERAL) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "general"); - } - switch_event_fire(&event); - } - - return FTDM_BREAK; -} - -static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) -{ - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - ftdm_status_t status = FTDM_SUCCESS; - uint32_t spanid; - uint32_t chanid; - ftdm_caller_data_t *caller_data; - - spanid = ftdm_channel_get_span_id(sigmsg->channel); - chanid = ftdm_channel_get_id(sigmsg->channel); - caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - - ftdm_log(FTDM_LOG_DEBUG, "got FXO sig %d:%d [%s]\n", spanid, chanid, ftdm_signal_event2str(sigmsg->event_id)); - - switch (sigmsg->event_id) { - case FTDM_SIGEVENT_PROGRESS_MEDIA: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_pre_answered(channel); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_STOP: - { - private_t *tech_pvt = NULL; - while ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - tech_pvt = switch_core_session_get_private(session); - switch_set_flag_locked(tech_pvt, TFLAG_DEAD); - ftdm_channel_clear_token(sigmsg->channel, 0); - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, caller_data->hangup_cause); - ftdm_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session)); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_UP: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_answered(channel); - ftdm_enable_channel_dtmf(sigmsg->channel, channel); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_START: - { - status = ftdm_channel_from_event(sigmsg, &session); - if (status != FTDM_SUCCESS) { - ftdm_channel_call_hangup(sigmsg->channel); - } - } - break; - case FTDM_SIGEVENT_COLLECTED_DIGIT: /* Analog E&M */ - { - int span_id = ftdm_channel_get_span_id(sigmsg->channel); - char *dtmf = sigmsg->ev_data.collected.digits; - char *regex = SPAN_CONFIG[span_id].dial_regex; - char *fail_regex = SPAN_CONFIG[span_id].fail_dial_regex; - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - - if (zstr(regex)) { - regex = NULL; - } - - if (zstr(fail_regex)) { - fail_regex = NULL; - } - - ftdm_log(FTDM_LOG_DEBUG, "got DTMF sig [%s]\n", dtmf); - switch_set_string(caller_data->collected, dtmf); - - if ((regex || fail_regex) && !zstr(dtmf)) { - switch_regex_t *re = NULL; - int ovector[30]; - int match = 0; - - if (fail_regex) { - match = switch_regex_perform(dtmf, fail_regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])); - status = match ? FTDM_SUCCESS : FTDM_BREAK; - switch_regex_safe_free(re); - ftdm_log(FTDM_LOG_DEBUG, "DTMF [%s] vs fail regex %s %s\n", dtmf, fail_regex, match ? "matched" : "did not match"); - } - - if (status == FTDM_SUCCESS && regex) { - match = switch_regex_perform(dtmf, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])); - status = match ? FTDM_BREAK : FTDM_SUCCESS; - switch_regex_safe_free(re); - ftdm_log(FTDM_LOG_DEBUG, "DTMF [%s] vs dial regex %s %s\n", dtmf, regex, match ? "matched" : "did not match"); - } - ftdm_log(FTDM_LOG_DEBUG, "returning %s to COLLECT event with DTMF %s\n", status == FTDM_SUCCESS ? "success" : "break", dtmf); - } - } - break; - case FTDM_SIGEVENT_SIGSTATUS_CHANGED: - /* span signaling status changed ... nothing to do here .. */ - break; - default: - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled msg type %d for channel %d:%d\n", - sigmsg->event_id, spanid, chanid); - } - break; - } - - return status; -} - -static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal) -{ - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - ftdm_status_t status = FTDM_SUCCESS; - uint32_t chanid, spanid, tokencount; - - chanid = ftdm_channel_get_id(sigmsg->channel); - spanid = ftdm_channel_get_span_id(sigmsg->channel); - tokencount = ftdm_channel_get_token_count(sigmsg->channel); - - ftdm_log(FTDM_LOG_DEBUG, "got FXS sig [%s]\n", ftdm_signal_event2str(sigmsg->event_id)); - - switch (sigmsg->event_id) { - case FTDM_SIGEVENT_UP: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_answered(channel); - ftdm_enable_channel_dtmf(sigmsg->channel, channel); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_PROGRESS: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_ring_ready(channel); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_START: - { - status = ftdm_channel_from_event(sigmsg, &session); - if (status != FTDM_SUCCESS) { - ftdm_channel_call_indicate(sigmsg->channel, FTDM_CHANNEL_INDICATE_BUSY); - } - } - break; - case FTDM_SIGEVENT_STOP: - { - private_t *tech_pvt = NULL; - switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; - if (tokencount) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - switch_core_session_t *session_a, *session_b, *session_t = NULL; - switch_channel_t *channel_a = NULL, *channel_b = NULL; - int digits = !zstr(caller_data->collected); - const char *br_a_uuid = NULL, *br_b_uuid = NULL; - private_t *tech_pvt = NULL; - - - if ((session_a = switch_core_session_locate(ftdm_channel_get_token(sigmsg->channel, 0)))) { - channel_a = switch_core_session_get_channel(session_a); - br_a_uuid = switch_channel_get_partner_uuid(channel_a); - - tech_pvt = switch_core_session_get_private(session_a); - stop_hold(session_a, switch_channel_get_partner_uuid(channel_a)); - switch_clear_flag_locked(tech_pvt, TFLAG_HOLD); - } - - if ((session_b = switch_core_session_locate(ftdm_channel_get_token(sigmsg->channel, 1)))) { - channel_b = switch_core_session_get_channel(session_b); - br_b_uuid = switch_channel_get_partner_uuid(channel_b); - - tech_pvt = switch_core_session_get_private(session_b); - stop_hold(session_a, switch_channel_get_partner_uuid(channel_b)); - switch_clear_flag_locked(tech_pvt, TFLAG_HOLD); - } - - if (channel_a && channel_b && switch_channel_direction(channel_a) == SWITCH_CALL_DIRECTION_INBOUND && - switch_channel_direction(channel_b) == SWITCH_CALL_DIRECTION_INBOUND) { - - cause = SWITCH_CAUSE_ATTENDED_TRANSFER; - if (br_a_uuid && br_b_uuid) { - switch_ivr_uuid_bridge(br_a_uuid, br_b_uuid); - } else if (br_a_uuid && digits) { - session_t = switch_core_session_locate(br_a_uuid); - } else if (br_b_uuid && digits) { - session_t = switch_core_session_locate(br_b_uuid); - } - } - - if (session_t) { - switch_ivr_session_transfer(session_t, caller_data->collected, NULL, NULL); - switch_core_session_rwunlock(session_t); - } - - if (session_a) { - switch_core_session_rwunlock(session_a); - } - - if (session_b) { - switch_core_session_rwunlock(session_b); - } - } - - while ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - tech_pvt = switch_core_session_get_private(session); - switch_set_flag_locked(tech_pvt, TFLAG_DEAD); - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, cause); - ftdm_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session)); - switch_core_session_rwunlock(session); - } - ftdm_channel_clear_token(sigmsg->channel, NULL); - } - break; - case FTDM_SIGEVENT_ADD_CALL: - { - cycle_foreground(sigmsg->channel, 1, NULL); - } - break; - case FTDM_SIGEVENT_FLASH: - { - chan_pvt_t *chanpvt = ftdm_channel_get_private(sigmsg->channel); - if (!chanpvt) { - ftdm_log(FTDM_LOG_ERROR, "%d:%d has no private data, can't handle FXS features! (this is a bug)\n", - chanid, spanid); - break; - } - if (ftdm_channel_call_check_hold(sigmsg->channel) && tokencount == 1) { - switch_core_session_t *session; - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - const char *buuid; - switch_channel_t *channel; - private_t *tech_pvt; - - tech_pvt = switch_core_session_get_private(session); - channel = switch_core_session_get_channel(session); - buuid = switch_channel_get_partner_uuid(channel); - ftdm_channel_call_unhold(sigmsg->channel); - stop_hold(session, buuid); - switch_clear_flag_locked(tech_pvt, TFLAG_HOLD); - switch_core_session_rwunlock(session); - } - } else if (tokencount == 2 && (SPAN_CONFIG[sigmsg->span_id].analog_options & ANALOG_OPTION_3WAY)) { - if (switch_test_flag(chanpvt, ANALOG_OPTION_3WAY)) { - switch_clear_flag(chanpvt, ANALOG_OPTION_3WAY); - if ((session = ftdm_channel_get_session(sigmsg->channel, 1))) { - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - ftdm_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session)); - switch_core_session_rwunlock(session); - } - cycle_foreground(sigmsg->channel, 1, NULL); - } else { - char *cmd; - cmd = switch_mprintf("three_way::%s", ftdm_channel_get_token(sigmsg->channel, 0)); - switch_set_flag(chanpvt, ANALOG_OPTION_3WAY); - cycle_foreground(sigmsg->channel, 1, cmd); - free(cmd); - } - } else if ((SPAN_CONFIG[sigmsg->span_id].analog_options & ANALOG_OPTION_CALL_SWAP) - || (SPAN_CONFIG[sigmsg->span_id].analog_options & ANALOG_OPTION_3WAY) - ) { - cycle_foreground(sigmsg->channel, 1, NULL); - if (tokencount == 1) { - ftdm_channel_call_hold(sigmsg->channel); - } - } - } - break; - case FTDM_SIGEVENT_COLLECTED_DIGIT: - { - int span_id = ftdm_channel_get_span_id(sigmsg->channel); - char *dtmf = sigmsg->ev_data.collected.digits; - char *regex = SPAN_CONFIG[span_id].dial_regex; - char *fail_regex = SPAN_CONFIG[span_id].fail_dial_regex; - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - - if (zstr(regex)) { - regex = NULL; - } - - if (zstr(fail_regex)) { - fail_regex = NULL; - } - - ftdm_log(FTDM_LOG_DEBUG, "got DTMF sig [%s]\n", dtmf); - switch_set_string(caller_data->collected, dtmf); - - if ((regex || fail_regex) && !zstr(dtmf)) { - switch_regex_t *re = NULL; - int ovector[30]; - int match = 0; - - if (fail_regex) { - match = switch_regex_perform(dtmf, fail_regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])); - status = match ? FTDM_SUCCESS : FTDM_BREAK; - switch_regex_safe_free(re); - ftdm_log(FTDM_LOG_DEBUG, "DTMF [%s] vs fail regex %s %s\n", dtmf, fail_regex, match ? "matched" : "did not match"); - } - - if (status == FTDM_SUCCESS && regex) { - match = switch_regex_perform(dtmf, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])); - status = match ? FTDM_BREAK : FTDM_SUCCESS; - switch_regex_safe_free(re); - ftdm_log(FTDM_LOG_DEBUG, "DTMF [%s] vs dial regex %s %s\n", dtmf, regex, match ? "matched" : "did not match"); - } - ftdm_log(FTDM_LOG_DEBUG, "returning %s to COLLECT event with DTMF %s\n", status == FTDM_SUCCESS ? "success" : "break", dtmf); - } - } - break; - default: - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled msg type %d for channel %d:%d\n", - sigmsg->event_id, spanid, chanid); - } - break; - } - - return status; -} - -static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) -{ - uint32_t phyid, chanid, spanid; - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - ftdm_status_t status = FTDM_SUCCESS; - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - - phyid = ftdm_channel_get_ph_id(sigmsg->channel); - chanid = ftdm_channel_get_id(sigmsg->channel); - spanid = ftdm_channel_get_span_id(sigmsg->channel); - - ftdm_log(FTDM_LOG_DEBUG, "Got R2 channel sig [%s] in channel %d\n", ftdm_signal_event2str(sigmsg->event_id), phyid); - - if (on_common_signal(sigmsg) == FTDM_BREAK) { - return FTDM_SUCCESS; - } - - switch (sigmsg->event_id) { - case FTDM_SIGEVENT_STOP: /* on_call_disconnect from the R2 side */ - { - private_t *tech_pvt = NULL; - while ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - tech_pvt = switch_core_session_get_private(session); - switch_set_flag_locked(tech_pvt, TFLAG_DEAD); - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, caller_data->hangup_cause); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_START: /* on_call_offered from the R2 side */ - { - status = ftdm_channel_from_event(sigmsg, &session); - } - break; - case FTDM_SIGEVENT_COLLECTED_DIGIT: /* on DNIS received from the R2 forward side, return status == FTDM_BREAK to stop requesting DNIS */ - { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - int span_id = ftdm_channel_get_span_id(sigmsg->channel); - char *regex = SPAN_CONFIG[span_id].dial_regex; - char *fail_regex = SPAN_CONFIG[span_id].fail_dial_regex; - - if (zstr(regex)) { - regex = NULL; - } - - if (zstr(fail_regex)) { - fail_regex = NULL; - } - - ftdm_log(FTDM_LOG_DEBUG, "R2 DNIS so far [%s]\n", caller_data->dnis.digits); - - if ((regex || fail_regex) && !zstr(caller_data->dnis.digits)) { - switch_regex_t *re = NULL; - int ovector[30]; - int match = 0; - - if (fail_regex) { - match = switch_regex_perform(caller_data->dnis.digits, fail_regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])); - status = match ? FTDM_SUCCESS : FTDM_BREAK; - switch_regex_safe_free(re); - } - - if (status == FTDM_SUCCESS && regex) { - match = switch_regex_perform(caller_data->dnis.digits, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])); - status = match ? FTDM_BREAK : FTDM_SUCCESS; - } - - switch_regex_safe_free(re); - } - } - break; - case FTDM_SIGEVENT_PROGRESS: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_ring_ready(channel); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_PROGRESS_MEDIA: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_pre_answered(channel); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_UP: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_answered(channel); - ftdm_enable_channel_dtmf(sigmsg->channel, channel); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_SIGSTATUS_CHANGED: - { - ftdm_signaling_status_t sigstatus = sigmsg->ev_data.sigstatus.status; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to: %s\n", - spanid, chanid, ftdm_signaling_status2str(sigstatus)); - } - break; - case FTDM_SIGEVENT_PROCEED: - case FTDM_SIGEVENT_INDICATION_COMPLETED: - break; - default: - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled event %d from R2 for channel %d:%d\n", - sigmsg->event_id, spanid, chanid); - } - break; - } - - return status; -} - -static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) -{ - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - ftdm_caller_data_t *caller_data; - uint32_t spanid, chanid; - - ftdm_log(FTDM_LOG_DEBUG, "got clear channel sig [%s]\n", ftdm_signal_event2str(sigmsg->event_id)); - - caller_data = ftdm_channel_get_caller_data(sigmsg->channel); - chanid = ftdm_channel_get_id(sigmsg->channel); - spanid = ftdm_channel_get_span_id(sigmsg->channel); - - if (on_common_signal(sigmsg) == FTDM_BREAK) { - return FTDM_SUCCESS; - } - - switch (sigmsg->event_id) { - case FTDM_SIGEVENT_START: - { - return ftdm_channel_from_event(sigmsg, &session); - } - break; - case FTDM_SIGEVENT_STOP: - case FTDM_SIGEVENT_RESTART: - { - private_t *tech_pvt = NULL; - while ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - tech_pvt = switch_core_session_get_private(session); - switch_set_flag_locked(tech_pvt, TFLAG_DEAD); - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, caller_data->hangup_cause); - switch_core_session_rwunlock(session); - } - } - break; - case FTDM_SIGEVENT_UP: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_answered(channel); - ftdm_enable_channel_dtmf(sigmsg->channel, channel); - switch_core_session_rwunlock(session); - } else { - const char *uuid = ftdm_channel_get_uuid(sigmsg->channel, 0); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Session for channel %d:%d not found [UUID: %s]\n", - spanid, chanid, (uuid) ? uuid : "N/A"); - } - } - break; - case FTDM_SIGEVENT_PROGRESS_MEDIA: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_pre_answered(channel); - switch_core_session_rwunlock(session); - } else { - const char *uuid = ftdm_channel_get_uuid(sigmsg->channel, 0); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Session for channel %d:%d not found [UUID: %s]\n", - spanid, chanid, (uuid) ? uuid : "N/A"); - } - } - break; - case FTDM_SIGEVENT_PROGRESS: - case FTDM_SIGEVENT_RINGING: - { - if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { - channel = switch_core_session_get_channel(session); - switch_channel_mark_ring_ready(channel); - switch_core_session_rwunlock(session); - } else { - const char *uuid = ftdm_channel_get_uuid(sigmsg->channel, 0); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Session for channel %d:%d not found [UUID: %s]\n", - spanid, chanid, (uuid) ? uuid : "N/A"); - } - } - break; - case FTDM_SIGEVENT_SIGSTATUS_CHANGED: - { - ftdm_signaling_status_t sigstatus = sigmsg->ev_data.sigstatus.status; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to :%s\n", - spanid, chanid, ftdm_signaling_status2str(sigstatus)); - } - break; - case FTDM_SIGEVENT_PROCEED: - case FTDM_SIGEVENT_FACILITY: - case FTDM_SIGEVENT_TRANSFER_COMPLETED: - /* FS does not have handlers for these messages, so ignore them for now */ - break; - default: - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled msg type %d for channel %d:%d\n", - sigmsg->event_id, spanid, chanid); - } - break; - } - - return FTDM_SUCCESS; -} - -static FIO_SIGNAL_CB_FUNCTION(on_analog_signal) -{ - uint32_t spanid, chanid; - ftdm_chan_type_t type; - ftdm_status_t status = FTDM_FAIL; - - spanid = ftdm_channel_get_span_id(sigmsg->channel); - chanid = ftdm_channel_get_span_id(sigmsg->channel); - type = ftdm_channel_get_type(sigmsg->channel); - - if (on_common_signal(sigmsg) == FTDM_BREAK) { - return FTDM_SUCCESS; - } - - switch (type) { - case FTDM_CHAN_TYPE_FXO: - case FTDM_CHAN_TYPE_EM: - { - status = on_fxo_signal(sigmsg); - } - break; - case FTDM_CHAN_TYPE_FXS: - { - status = on_fxs_signal(sigmsg); - } - break; - default: - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled analog channel type %d for channel %d:%d\n", - type, spanid, chanid); - } - break; - } - - return status; -} - -static void ftdm_logger(const char *file, const char *func, int line, int level, const char *fmt, ...) -{ - char *data = NULL; - va_list ap; - - va_start(ap, fmt); - - if (switch_vasprintf(&data, fmt, ap) != -1) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, (char *)func, line, NULL, level, "%s", data); - } - if (data) { - free(data); - } - - va_end(ap); -} - -static uint32_t enable_analog_option(const char *str, uint32_t current_options) -{ - if (!strcasecmp(str, "3-way")) { - current_options |= ANALOG_OPTION_3WAY; - current_options &= ~ANALOG_OPTION_CALL_SWAP; - } else if (!strcasecmp(str, "call-swap")) { - current_options |= ANALOG_OPTION_CALL_SWAP; - current_options &= ~ANALOG_OPTION_3WAY; - } - - return current_options; -} - -#define LOAD_ERROR(...) { \ - ftdm_log(FTDM_LOG_ERROR, __VA_ARGS__); \ - globals.config_error = 1; \ - } - -/* - * Create ftdm_conf_node_t tree based on a fixed pattern XML configuration list. - * Last 2 args are for limited aka dumb recursivity. - */ -static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode, - const char *list_name, const char *list_element_name, - const char *sub_list_name, const char *sub_list_element_name) -{ - char *var, *val; - switch_xml_t list; - switch_xml_t element; - switch_xml_t param; - - ftdm_conf_node_t *n_list; - ftdm_conf_node_t *n_element; - - list = switch_xml_child(swnode, list_name); - if (!list) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no list %s found\n", list_name); - return -1; - } - - if ((FTDM_SUCCESS != ftdm_conf_node_create(list_name, &n_list, rootnode))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node\n", list_name); - return -1; - } - - for (element = switch_xml_child(list, list_element_name); element; element = element->next) { - char *element_name = (char *) switch_xml_attr(element, "name"); - - if (!element_name) { - continue; - } - - if ((FTDM_SUCCESS != ftdm_conf_node_create(list_element_name, &n_element, n_list))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node for %s\n", list_element_name, element_name); - return -1; - } - ftdm_conf_node_add_param(n_element, "name", element_name); - - for (param = switch_xml_child(element, "param"); param; param = param->next) { - var = (char *) switch_xml_attr_soft(param, "name"); - val = (char *) switch_xml_attr_soft(param, "value"); - ftdm_conf_node_add_param(n_element, var, val); - } - - if (sub_list_name && sub_list_element_name) { - if (add_config_list_nodes(element, n_element, sub_list_name, sub_list_element_name, NULL, NULL)) { - return -1; - } - } - } - - return 0; -} - -/* - * Create ftdm_conf_node_t tree based on a fixed pattern XML configuration list. - * Last arg is to specify if we have any sublist for e.g.: - * - * - * - * - * - * - * - * - * - */ -static int add_config_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode, - const char *list_name, const char *list_element_name, const char *sub_list_name) -{ - char *var, *val; - switch_xml_t list; - switch_xml_t sub_list; - switch_xml_t element; - switch_xml_t param; - - ftdm_conf_node_t *n_list; - ftdm_conf_node_t *n_element; - - list = switch_xml_child(swnode, list_name); - if (!list) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no list %s found\n", list_name); - return -1; - } - - if ((FTDM_SUCCESS != ftdm_conf_node_create(list_name, &n_list, rootnode))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node\n", list_name); - return -1; - } - - for (element = switch_xml_child(list, list_element_name); element; element = element->next) { - char *element_name = (char *) switch_xml_attr(element, "name"); - - if (!element_name) { - continue; - } - - if ((FTDM_SUCCESS != ftdm_conf_node_create(list_element_name, &n_element, n_list))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node for %s\n", list_element_name, element_name); - return -1; - } - ftdm_conf_node_add_param(n_element, "name", element_name); - - for (param = switch_xml_child(element, "param"); param; param = param->next) { - var = (char *) switch_xml_attr_soft(param, "name"); - val = (char *) switch_xml_attr_soft(param, "value"); - ftdm_conf_node_add_param(n_element, var, val); - } - - /*If we have single node list */ - if (sub_list_name ) { - sub_list = switch_xml_child(element, sub_list_name); - if (!sub_list) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no sub_list %s found\n", sub_list_name); - return -1; - } - for (param = switch_xml_child(sub_list, "param"); param; param = param->next) { - var = (char *) switch_xml_attr_soft(param, "name"); - val = (char *) switch_xml_attr_soft(param, "value"); - ftdm_conf_node_add_param(n_element, var, val); - } - } - } - - return 0; -} - -static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *confname, const char *operating_mode) -{ - switch_xml_t signode, ss7configs, isup, gen, param; - ftdm_conf_node_t *rootnode, *list; - char *var, *val; - int is_isup = 0x00; - - /* try to find the conf in the hash first */ - rootnode = switch_core_hash_find(globals.ss7_configs, confname); - if (rootnode) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ss7 config %s was found in the hash already\n", confname); - return rootnode; - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not found %s config in hash, searching in xml ...\n", confname); - - signode = switch_xml_child(cfg, "signaling_configs"); - if (!signode) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "not found 'signaling_configs' XML config section\n"); - return NULL; - } - - ss7configs = switch_xml_child(signode, "sngss7_configs"); - if (!ss7configs) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "not found 'sngss7_configs' XML config section\n"); - return NULL; - } - - /* sng_isup and ss7config xml childs are treated the same way. sng_isup was used initially, but does not make sense - * for configurations that do not have an ISUP layer, sng_isup is kept for backward compatibility */ - - /* search the ss7config */ - for (isup = switch_xml_child(ss7configs, "sngss7_config"); isup; isup = isup->next) { - char *name = (char *) switch_xml_attr(isup, "name"); - if (!name) { - continue; - } - if (!strcasecmp(name, confname)) { - break; - } - } - - if (!isup) { - /* search the isup config */ - for (isup = switch_xml_child(ss7configs, "sng_isup"); isup; isup = isup->next) { - char *name = (char *) switch_xml_attr(isup, "name"); - if (!name) { - continue; - } - if (!strcasecmp(name, confname)) { - break; - } - } - - if (!isup) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "not found '%s' ss7config or sng_isup XML config section\n", confname); - return NULL; - } - } - - /* found our XML chunk, create the root node */ - if ((FTDM_SUCCESS != ftdm_conf_node_create("sng_isup", &rootnode, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create root node for sng_isup config %s\n", confname); - return NULL; - } - - /* operating mode , M2UA or ISUP */ - if (operating_mode && ('\0' != operating_mode[0])) { - if (!strcasecmp(operating_mode, "ISUP")) { - is_isup = 0x01; - } - else if (!strcasecmp(operating_mode, "M2UA_SG")) { - is_isup = 0x00; - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid operating Mode[%s] \n", operating_mode); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Operating mode not specified, default to ISUP \n"); - is_isup = 0x01; - } - - /* add sng_gen */ - gen = switch_xml_child(isup, "sng_gen"); - if (gen == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_gen for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - if ((FTDM_SUCCESS != ftdm_conf_node_create("sng_gen", &list, rootnode))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create %s node for %s\n", "sng_gen", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - for (param = switch_xml_child(gen, "param"); param; param = param->next) { - var = (char *) switch_xml_attr_soft(param, "name"); - val = (char *) switch_xml_attr_soft(param, "value"); - ftdm_conf_node_add_param(list, var, val); - } - - /* add relay channels */ - if (add_config_list_nodes(isup, rootnode, "sng_relay", "relay_channel", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_relay for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - /* add mtp1 links */ - if (add_config_list_nodes(isup, rootnode, "mtp1_links", "mtp1_link", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp1_links for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - /* add mtp2 links */ - if (add_config_list_nodes(isup, rootnode, "mtp2_links", "mtp2_link", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp2_links for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - if (is_isup) { - /* add mtp3 links */ - if (add_config_list_nodes(isup, rootnode, "mtp3_links", "mtp3_link", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp3_links for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - /* add mtp linksets */ - if (add_config_list_nodes(isup, rootnode, "mtp_linksets", "mtp_linkset", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_linksets for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - /* add mtp routes */ - if (add_config_list_nodes(isup, rootnode, "mtp_routes", "mtp_route", "linksets", "linkset")) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp_routes for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - /* add isup interfaces */ - if (add_config_list_nodes(isup, rootnode, "isup_interfaces", "isup_interface", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process isup_interfaces for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - /* add cc spans */ - if (add_config_list_nodes(isup, rootnode, "cc_spans", "cc_span", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process cc_spans for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - } else { - /* add sctp links */ - if (add_config_nodes(isup, rootnode, "sng_sctp_interfaces", "sng_sctp_interface", "sng_source_addresses")) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_sctp_interface for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - if (add_config_list_nodes(isup, rootnode, "sng_nif_interfaces", "sng_nif_interface", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_nif_interfaces for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - if (add_config_list_nodes(isup, rootnode, "sng_m2ua_interfaces", "sng_m2ua_interface", NULL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_interfaces for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - if (add_config_nodes(isup, rootnode, "sng_m2ua_peer_interfaces", "sng_m2ua_peer_interface", "sng_destination_addresses")) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_peer_interfaces for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - - if (add_config_nodes(isup, rootnode, "sng_m2ua_cluster_interfaces", "sng_m2ua_cluster_interface", "sng_m2ua_peers")) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process sng_m2ua_cluster_interfaces for sng_isup config %s\n", confname); - ftdm_conf_node_destroy(rootnode); - return NULL; - } - } - - switch_core_hash_insert(globals.ss7_configs, confname, rootnode); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added SS7 node configuration %s\n", confname); - return rootnode; -} - -static int add_profile_parameters(switch_xml_t cfg, const char *profname, ftdm_conf_parameter_t *parameters, int len) -{ - switch_xml_t profnode, profile, param; - int paramindex = 0; - - profnode = switch_xml_child(cfg, "config_profiles"); - if (!profnode) { - LOAD_ERROR("cannot find profile '%s', there is no 'config_profiles' XML section\n", profname); - return 0; - } - - /* search the profile */ - for (profile = switch_xml_child(profnode, "profile"); profile; profile = profile->next) { - char *name = (char *) switch_xml_attr(profile, "name"); - if (!name) { - continue; - } - if (!strcasecmp(name, profname)) { - break; - } - } - - if (!profile) { - LOAD_ERROR("failed to find profile '%s'\n", profname); - return 0; - } - - for (param = switch_xml_child(profile, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - if (!var || !val) { - continue; - } - parameters[paramindex].var = var; - parameters[paramindex].val = val; - paramindex++; - } - - return paramindex; -} - -static void parse_gsm_spans(switch_xml_t cfg, switch_xml_t spans) -{ - switch_xml_t myspan, param; - - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; - char *id = (char *) switch_xml_attr(myspan, "id"); - char *name = (char *) switch_xml_attr(myspan, "name"); - char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); - ftdm_span_t *span = NULL; - uint32_t span_id = 0; - unsigned paramindex = 0; - - if (!name && !id) { - LOAD_ERROR("GSM span missing required attribute 'id' or 'name', skipping ...\n"); - continue; - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); - continue; - } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - memset(spanparameters, 0, sizeof(spanparameters)); - paramindex = 0; - - if (configname) { - paramindex = add_profile_parameters(cfg, configname, spanparameters, ftdm_array_len(spanparameters)); - if (paramindex) { - ftdm_log(FTDM_LOG_DEBUG, "Added %d parameters from profile %s for span %d\n", paramindex, configname, span_id); - } - } - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (ftdm_array_len(spanparameters) - 1 == paramindex) { - LOAD_ERROR("Too many parameters for GSM span, ignoring any parameter after %s\n", var); - break; - } - - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } - - if (ftdm_configure_span_signaling(span, - "gsm", - on_clear_channel_signal, - spanparameters) != FTDM_SUCCESS) { - LOAD_ERROR("Error configuring Sangoma GSM FreeTDM span %d\n", span_id); - continue; - } - - SPAN_CONFIG[span_id].span = span; - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "GSM", sizeof(SPAN_CONFIG[span_id].type)); - - ftdm_log(FTDM_LOG_DEBUG, "Configured GSM FreeTDM span %d\n", span_id); - ftdm_span_start(span); - } -} - -static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) -{ - switch_xml_t myspan, param; - - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; - char *id = (char *) switch_xml_attr(myspan, "id"); - char *name = (char *) switch_xml_attr(myspan, "name"); - char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); - ftdm_span_t *span = NULL; - uint32_t span_id = 0; - unsigned paramindex = 0; - - if (!name && !id) { - LOAD_ERROR("sangoma isdn span missing required attribute 'id' or 'name', skipping ...\n"); - continue; - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); - continue; - } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - memset(spanparameters, 0, sizeof(spanparameters)); - paramindex = 0; - - if (configname) { - paramindex = add_profile_parameters(cfg, configname, spanparameters, ftdm_array_len(spanparameters)); - if (paramindex) { - ftdm_log(FTDM_LOG_DEBUG, "Added %d parameters from profile %s for span %d\n", paramindex, configname, span_id); - } - } - - /* some defaults first */ - SPAN_CONFIG[span_id].limit_backend = "hash"; - SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_TIMEOUT; - SPAN_CONFIG[span_id].digital_sampling_rate = 8000; - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (ftdm_array_len(spanparameters) - 1 == paramindex) { - LOAD_ERROR("Too many parameters for ss7 span, ignoring any parameter after %s\n", var); - break; - } - - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else if (!strcasecmp(var, "unrestricted-digital-codec")) { - //switch_core_strdup(pool, val); - const switch_codec_implementation_t *codec = NULL; - int num_codecs; - num_codecs = switch_loadable_module_get_codecs_sorted(&codec, NULL, 1, &val, 1); - if (num_codecs != 1 || !codec) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed finding codec %s for unrestricted digital calls\n", val); - } else { - SPAN_CONFIG[span_id].digital_codec = switch_core_strdup(module_pool, codec->iananame); - SPAN_CONFIG[span_id].digital_sampling_rate = codec->samples_per_second; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Unrestricted digital codec is %s at %dhz for span %d\n", - SPAN_CONFIG[span_id].digital_codec, SPAN_CONFIG[span_id].digital_sampling_rate, span_id); - } - } else if (!strcasecmp(var, "call_limit_backend")) { - SPAN_CONFIG[span_id].limit_backend = val; - ftdm_log(FTDM_LOG_DEBUG, "Using limit backend %s for span %d\n", SPAN_CONFIG[span_id].limit_backend, span_id); - } else if (!strcasecmp(var, "call_limit_rate")) { - int calls; - int seconds; - if (sscanf(val, "%d/%d", &calls, &seconds) != 2) { - LOAD_ERROR("Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); - } else { - if (calls < 1 || seconds < 1) { - LOAD_ERROR("Invalid %s parameter value, minimum call limit must be 1 per second\n", var); - } else { - SPAN_CONFIG[span_id].limit_calls = calls; - SPAN_CONFIG[span_id].limit_seconds = seconds; - } - } - } else if (!strcasecmp(var, "call_limit_reset_event")) { - if (!strcasecmp(val, "answer")) { - SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_ANSWER; - } else { - LOAD_ERROR("Invalid %s parameter value, only accepted event is 'answer'\n", var); - } - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } - - if (ftdm_configure_span_signaling(span, - "sangoma_isdn", - on_clear_channel_signal, - spanparameters) != FTDM_SUCCESS) { - LOAD_ERROR("Error configuring Sangoma ISDN FreeTDM span %d\n", span_id); - continue; - } - - SPAN_CONFIG[span_id].span = span; - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (ISDN)", sizeof(SPAN_CONFIG[span_id].type)); - - ftdm_log(FTDM_LOG_DEBUG, "Configured Sangoma ISDN FreeTDM span %d\n", span_id); - ftdm_span_start(span); - } -} -static switch_status_t load_config_path(void) -{ - const char *cf = "freetdm.conf"; - switch_xml_t cfg, xml, settings, param; - 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, "mod-dir")) { - ftdm_global_set_mod_directory(val); - } else if (!strcasecmp(var, "conf-dir")) { - ftdm_global_set_config_directory(val); - } - } - } - - switch_xml_free(xml); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t load_config(void) -{ - const char *cf = "freetdm.conf"; - switch_xml_t cfg, xml, settings, param, spans, myspan; - ftdm_conf_node_t *ss7confnode = NULL; - unsigned int i = 0; - ftdm_channel_t *fchan = NULL; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - memset(&globals, 0, sizeof(globals)); - switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool); - - 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, "hold-music")) { - switch_set_string(globals.hold_music, val); - } else if (!strcasecmp(var, "crash-on-assert")) { - globals.crash_on_assert = (uint8_t)switch_true(val); - } else if (!strcasecmp(var, "fail-on-error")) { - globals.fail_on_error = (uint8_t)switch_true(val); - } else if (!strcasecmp(var, "sip-headers")) { - globals.sip_headers = switch_true(val); - } else if (!strcasecmp(var, "enable-analog-option")) { - globals.analog_options = enable_analog_option(val, globals.analog_options); - } - } - } - - if ((spans = switch_xml_child(cfg, "sangoma_pri_spans"))) { - parse_bri_pri_spans(cfg, spans); - } - - if ((spans = switch_xml_child(cfg, "sangoma_bri_spans"))) { - parse_bri_pri_spans(cfg, spans); - } - - if ((spans = switch_xml_child(cfg, "gsm_spans"))) { - parse_gsm_spans(cfg, spans); - } - - switch_core_hash_init(&globals.ss7_configs); - if ((spans = switch_xml_child(cfg, "sangoma_ss7_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; - char *id = (char *) switch_xml_attr(myspan, "id"); - char *name = (char *) switch_xml_attr(myspan, "name"); - char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); - char *operating_mode = (char *) switch_xml_attr(myspan, "operating_mode"); - ftdm_span_t *span = NULL; - uint32_t span_id = 0; - unsigned paramindex = 0; - if (!name && !id) { - LOAD_ERROR("ss7 span missing required attribute 'id' or 'name', skipping ...\n"); - continue; - } - if (!configname) { - LOAD_ERROR("ss7 span missing required attribute, skipping ...\n"); - continue; - } - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); - continue; - } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - ss7confnode = _get_ss7_config_node(cfg, configname, operating_mode); - if (!ss7confnode) { - LOAD_ERROR("Error finding ss7config '%s' for FreeTDM span id: %s\n", configname, switch_str_nil(id)); - continue; - } - - memset(spanparameters, 0, sizeof(spanparameters)); - paramindex = 0; - - if (operating_mode) { - spanparameters[paramindex].var = "operating-mode"; - spanparameters[paramindex].val = operating_mode; - paramindex++; - } - - spanparameters[paramindex].var = "confnode"; - spanparameters[paramindex].ptr = ss7confnode; - paramindex++; - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (ftdm_array_len(spanparameters) - 1 == paramindex) { - LOAD_ERROR("Too many parameters for ss7 span, ignoring any parameter after %s\n", var); - break; - } - - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } - - if (ftdm_configure_span_signaling(span, - "sangoma_ss7", - on_clear_channel_signal, - spanparameters) != FTDM_SUCCESS) { - LOAD_ERROR("Error configuring ss7 FreeTDM span %d\n", span_id); - continue; - } - - SPAN_CONFIG[span_id].span = span; - - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (SS7)", sizeof(SPAN_CONFIG[span_id].type)); - - ftdm_log(FTDM_LOG_DEBUG, "Configured ss7 FreeTDM span %d with config node %s\n", span_id, configname); - - if (FTDM_SUCCESS != ftdm_span_start(span)) { - LOAD_ERROR("Error Starting ss7 FreeTDM span %d\n", span_id); - continue; - } - } - } - - if ((spans = switch_xml_child(cfg, "analog_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *id = (char *) switch_xml_attr(myspan, "id"); - char *name = (char *) switch_xml_attr(myspan, "name"); - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - const char *tonegroup = NULL; - char *digit_timeout = NULL; - char *max_digits = NULL; - char *hotline = NULL; - char *dial_regex = NULL; - char *hold_music = NULL; - char *fail_dial_regex = NULL; - const char *enable_callerid = "true"; - const char *answer_polarity = "false"; - const char *hangup_polarity = "false"; - const char *polarity_callerid = "false"; - int polarity_delay = 600; - int callwaiting = 1; - int dialtone_timeout = 5000; - - uint32_t span_id = 0, to = 0, max = 0; - ftdm_span_t *span = NULL; - analog_option_t analog_options = ANALOG_OPTION_NONE; - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); - continue; - } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - /* some defaults first */ - SPAN_CONFIG[span_id].limit_backend = "hash"; - SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_TIMEOUT; - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "analog_spans var = %s\n", var); - if (!strcasecmp(var, "tonegroup")) { - tonegroup = val; - } else if (!strcasecmp(var, "digit_timeout") || !strcasecmp(var, "digit-timeout")) { - digit_timeout = val; - } else if (!strcasecmp(var, "wait-dialtone-timeout")) { - dialtone_timeout = atoi(val); - } else if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else if (!strcasecmp(var, "call_limit_backend")) { - SPAN_CONFIG[span_id].limit_backend = val; - ftdm_log(FTDM_LOG_DEBUG, "Using limit backend %s for span %d\n", SPAN_CONFIG[span_id].limit_backend, span_id); - } else if (!strcasecmp(var, "call_limit_rate")) { - int calls; - int seconds; - if (sscanf(val, "%d/%d", &calls, &seconds) != 2) { - LOAD_ERROR("Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); - } else { - if (calls < 1 || seconds < 1) { - LOAD_ERROR("Invalid %s parameter value, minimum call limit must be 1 per second\n", var); - } else { - SPAN_CONFIG[span_id].limit_calls = calls; - SPAN_CONFIG[span_id].limit_seconds = seconds; - } - } - } else if (!strcasecmp(var, "call_limit_reset_event")) { - if (!strcasecmp(val, "answer")) { - SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_ANSWER; - } else { - LOAD_ERROR("Invalid %s parameter value, only accepted event is 'answer'\n", var); - } - } else if (!strcasecmp(var, "dial-regex")) { - dial_regex = val; - } else if (!strcasecmp(var, "enable-callerid")) { - enable_callerid = val; - } else if (!strcasecmp(var, "answer-polarity-reverse")) { - answer_polarity = val; - } else if (!strcasecmp(var, "hangup-polarity-reverse")) { - hangup_polarity = val; - } else if (!strcasecmp(var, "polarity-delay")) { - polarity_delay = atoi(val); - } else if (!strcasecmp(var, "polarity-callerid")) { - polarity_callerid = val; - } else if (!strcasecmp(var, "fail-dial-regex")) { - fail_dial_regex = val; - } else if (!strcasecmp(var, "hold-music")) { - hold_music = val; - } else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) { - max_digits = val; - } else if (!strcasecmp(var, "hotline")) { - hotline = val; - } else if (!strcasecmp(var, "callwaiting")) { - callwaiting = switch_true(val) ? 1 : 0; - } else if (!strcasecmp(var, "enable-analog-option")) { - analog_options = enable_analog_option(val, analog_options); - } - } - - if (!id && !name) { - LOAD_ERROR("span missing required param 'id'\n"); - continue; - } - - if (!tonegroup) { - tonegroup = "us"; - } - - if (digit_timeout) { - to = atoi(digit_timeout); - } - - if (max_digits) { - max = atoi(max_digits); - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); - continue; - } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - if (ftdm_configure_span(span, "analog", on_analog_signal, - "tonemap", tonegroup, - "digit_timeout", &to, - "max_dialstr", &max, - "hotline", hotline ? hotline : "", - "enable_callerid", enable_callerid, - "answer_polarity_reverse", answer_polarity, - "hangup_polarity_reverse", hangup_polarity, - "polarity_callerid", polarity_callerid, - "polarity_delay", &polarity_delay, - "callwaiting", &callwaiting, - "wait_dialtone_timeout", &dialtone_timeout, - FTDM_TAG_END) != FTDM_SUCCESS) { - LOAD_ERROR("Error configuring FreeTDM analog span %s\n", ftdm_span_get_name(span)); - continue; - } - - SPAN_CONFIG[span_id].span = span; - switch_set_string(SPAN_CONFIG[span_id].context, context); - switch_set_string(SPAN_CONFIG[span_id].dialplan, dialplan); - SPAN_CONFIG[span_id].analog_options = analog_options | globals.analog_options; - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - fchan = ftdm_iterator_current(curr); - ftdm_channel_set_private(fchan, &SPAN_CONFIG[span_id].pvts[i]); - } - ftdm_iterator_free(chaniter); - - if (dial_regex) { - switch_set_string(SPAN_CONFIG[span_id].dial_regex, dial_regex); - } - - if (fail_dial_regex) { - switch_set_string(SPAN_CONFIG[span_id].fail_dial_regex, fail_dial_regex); - } - - if (hold_music) { - switch_set_string(SPAN_CONFIG[span_id].hold_music, hold_music); - } - switch_copy_string(SPAN_CONFIG[span_id].type, "analog", sizeof(SPAN_CONFIG[span_id].type)); - ftdm_span_start(span); - } - } - - if ((spans = switch_xml_child(cfg, "analog_em_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *id = (char *) switch_xml_attr(myspan, "id"); - char *name = (char *) switch_xml_attr(myspan, "name"); - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - const char *tonegroup = NULL; - char *digit_timeout = NULL; - char *dial_timeout = NULL; - char *release_guard_time_ms = NULL; - char *max_digits = NULL; - char *dial_regex = NULL; - char *hold_music = NULL; - char *fail_dial_regex = NULL; - char str_false[] = "false"; - char str_empty[] = ""; - char *answer_supervision = str_false; - char *immediate_ringback = str_false; - char *ringback_file = str_empty; - uint32_t span_id = 0, to = 0, max = 0, dial_timeout_int = 0, release_guard_time_ms_int = 0; - ftdm_span_t *span = NULL; - analog_option_t analog_options = ANALOG_OPTION_NONE; - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (!strcasecmp(var, "tonegroup")) { - tonegroup = val; - } else if (!strcasecmp(var, "digit_timeout") || !strcasecmp(var, "digit-timeout")) { - digit_timeout = val; - } else if (!strcasecmp(var, "dial-timeout")) { - dial_timeout = val; - } else if (!strcasecmp(var, "release-guard-time-ms")) { - release_guard_time_ms = val; - } else if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else if (!strcasecmp(var, "dial-regex")) { - dial_regex = val; - } else if (!strcasecmp(var, "fail-dial-regex")) { - fail_dial_regex = val; - } else if (!strcasecmp(var, "hold-music")) { - hold_music = val; - } else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) { - max_digits = val; - } else if (!strcasecmp(var, "answer-supervision")) { - answer_supervision = val; - } else if (!strcasecmp(var, "immediate-ringback")) { - immediate_ringback = val; - } else if (!strcasecmp(var, "ringback-file")) { - ringback_file = val; - } else if (!strcasecmp(var, "enable-analog-option")) { - analog_options = enable_analog_option(val, analog_options); - } - } - - if (!id && !name) { - LOAD_ERROR("span missing required param 'id'\n"); - continue; - } - - if (!tonegroup) { - tonegroup = "us"; - } - - if (digit_timeout) { - to = atoi(digit_timeout); - } - - if (dial_timeout) { - dial_timeout_int = atoi(dial_timeout); - } - - if (release_guard_time_ms) { - release_guard_time_ms_int = atoi(release_guard_time_ms); - } - - if (max_digits) { - max = atoi(max_digits); - } - - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); - continue; - } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - - if (ftdm_configure_span(span, "analog_em", on_analog_signal, - "tonemap", tonegroup, - "answer_supervision", answer_supervision, - "immediate_ringback", immediate_ringback, - "ringback_file", ringback_file, - "digit_timeout", &to, - "dial_timeout", &dial_timeout_int, - "release_guard_time_ms", &release_guard_time_ms_int, - "max_dialstr", &max, - FTDM_TAG_END) != FTDM_SUCCESS) { - LOAD_ERROR("Error starting FreeTDM span %d\n", span_id); - continue; - } - - SPAN_CONFIG[span_id].span = span; - switch_set_string(SPAN_CONFIG[span_id].context, context); - switch_set_string(SPAN_CONFIG[span_id].dialplan, dialplan); - SPAN_CONFIG[span_id].analog_options = analog_options | globals.analog_options; - - if (dial_regex) { - switch_set_string(SPAN_CONFIG[span_id].dial_regex, dial_regex); - } - - if (fail_dial_regex) { - switch_set_string(SPAN_CONFIG[span_id].fail_dial_regex, fail_dial_regex); - } - - if (hold_music) { - switch_set_string(SPAN_CONFIG[span_id].hold_music, hold_music); - } - switch_copy_string(SPAN_CONFIG[span_id].type, "analog_em", sizeof(SPAN_CONFIG[span_id].type)); - ftdm_span_start(span); - } - } - - if ((spans = switch_xml_child(cfg, "pri_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *name = (char *) switch_xml_attr(myspan, "name"); - ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - unsigned paramindex = 0; - ftdm_span_t *span = NULL; - uint32_t span_id = 0; - - if (!name) { - LOAD_ERROR("span missing required attribute 'name'\n"); - continue; - } - - memset(spanparameters, 0, sizeof(spanparameters)); - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (ftdm_array_len(spanparameters) - 1 == paramindex) { - LOAD_ERROR("Too many parameters for pri span '%s', ignoring everything after '%s'\n", name, var); - break; - } - - if (ftdm_strlen_zero(var) || ftdm_strlen_zero(val)) { - ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with empty name or value\n"); - continue; - } - - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } - - zstatus = ftdm_span_find_by_name(name, &span); - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span %s\n", name); - continue; - } - - span_id = ftdm_span_get_id(span); - if (ftdm_configure_span_signaling(span, "isdn", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - LOAD_ERROR("Error configuring FreeTDM span %s\n", name); - continue; - } - - SPAN_CONFIG[span_id].span = span; - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "isdn", sizeof(SPAN_CONFIG[span_id].type)); - - ftdm_span_start(span); - } - } - - if ((spans = switch_xml_child(cfg, "pritap_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - - char *name = (char *) switch_xml_attr(myspan, "name"); - - ftdm_status_t zstatus = FTDM_FAIL; - unsigned paramindex = 0; - ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; - const char *context = "default"; - const char *dialplan = "XML"; - ftdm_span_t *span = NULL; - int span_id = 0; - - if (!name) { - LOAD_ERROR("span missing required attribute 'name'\n"); - continue; - } - - memset(spanparameters, 0, sizeof(spanparameters)); - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (ftdm_array_len(spanparameters) - 1 == paramindex) { - LOAD_ERROR("Too many parameters for pritap span '%s', ignoring everything after '%s'\n", name, var); - break; - } - - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } - - zstatus = ftdm_span_find_by_name(name, &span); - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span %s\n", name); - continue; - } - - span_id = ftdm_span_get_id(span); - if (ftdm_configure_span_signaling(span, "pritap", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - LOAD_ERROR("Error configuring FreeTDM span %s\n", name); - continue; - } - - SPAN_CONFIG[span_id].span = span; - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "isdn", sizeof(SPAN_CONFIG[span_id].type)); - - ftdm_span_start(span); - } - } - - - if ((spans = switch_xml_child(cfg, "libpri_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *name = (char *) switch_xml_attr(myspan, "name"); - ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - unsigned paramindex = 0; - ftdm_span_t *span = NULL; - uint32_t span_id = 0; - - if (!name) { - LOAD_ERROR("span missing required attribute 'name'\n"); - continue; - } - - memset(spanparameters, 0, sizeof(spanparameters)); - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (ftdm_array_len(spanparameters) - 1 == paramindex) { - LOAD_ERROR("Too many parameters for libpri span, ignoring everything after '%s'\n", var); - break; - } - - if (ftdm_strlen_zero(var) || ftdm_strlen_zero(val)) { - ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with empty name or value\n"); - continue; - } - - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } - - zstatus = ftdm_span_find_by_name(name, &span); - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM span %s\n", name); - continue; - } - - span_id = ftdm_span_get_id(span); - if (ftdm_configure_span_signaling(span, "libpri", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - LOAD_ERROR("Error configuring FreeTDM span %s\n", name); - continue; - } - - SPAN_CONFIG[span_id].span = span; - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "isdn", sizeof(SPAN_CONFIG[span_id].type)); - - ftdm_span_start(span); - } - } - - if ((spans = switch_xml_child(cfg, "r2_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *name = (char *) switch_xml_attr(myspan, "name"); - char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); - ftdm_status_t zstatus = FTDM_FAIL; - - /* common non r2 stuff */ - const char *context = "default"; - const char *dialplan = "XML"; - char *dial_regex = NULL; - char *fail_dial_regex = NULL; - uint32_t span_id = 0; - ftdm_span_t *span = NULL; - - ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; - unsigned paramindex = 0; - - if (!name) { - LOAD_ERROR("'name' attribute required for R2 spans!\n"); - continue; - } - - memset(spanparameters, 0, sizeof(spanparameters)); - - if (configname) { - paramindex = add_profile_parameters(cfg, configname, spanparameters, ftdm_array_len(spanparameters)); - if (paramindex) { - ftdm_log(FTDM_LOG_DEBUG, "Added %d parameters from profile %s for span %d\n", paramindex, configname, span_id); - } - } - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - /* string parameters */ - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else if (!strcasecmp(var, "dial-regex")) { - dial_regex = val; - } else if (!strcasecmp(var, "fail-dial-regex")) { - fail_dial_regex = val; - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } - - zstatus = ftdm_span_find_by_name(name, &span); - if (zstatus != FTDM_SUCCESS) { - LOAD_ERROR("Error finding FreeTDM R2 Span '%s'\n", name); - continue; - } - span_id = ftdm_span_get_id(span); - - if (ftdm_configure_span_signaling(span, "r2", on_r2_signal, spanparameters) != FTDM_SUCCESS) { - LOAD_ERROR("Error configuring FreeTDM R2 span %s, error: %s\n", name, ftdm_span_get_last_error(span)); - continue; - } - - if (dial_regex) { - switch_set_string(SPAN_CONFIG[span_id].dial_regex, dial_regex); - } - - if (fail_dial_regex) { - switch_set_string(SPAN_CONFIG[span_id].fail_dial_regex, fail_dial_regex); - } - - SPAN_CONFIG[span_id].span = span; - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "R2", sizeof(SPAN_CONFIG[span_id].type)); - - if (ftdm_span_start(span) == FTDM_FAIL) { - LOAD_ERROR("Error starting FreeTDM R2 span %s, error: %s\n", name, ftdm_span_get_last_error(span)); - continue; - } - } - } - - if (globals.crash_on_assert) { - ftdm_log(FTDM_LOG_WARNING, "Crash on assert enabled\n"); - ftdm_global_set_crash_policy(FTDM_CRASH_ON_ASSERT); - } - - switch_xml_free(xml); - - if (globals.fail_on_error && globals.config_error) { - ftdm_log(FTDM_LOG_ERROR, "Refusing to load module with errors\n"); - return SWITCH_STATUS_TERM; - } - - return SWITCH_STATUS_SUCCESS; -} - -void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream) -{ - uint32_t span_id; - uint32_t phspan_id, phchan_id; - const char *chan_type; - const char *state; - const char *last_state; - const char *uuid = NULL; - char sessionid[255]; - float txgain, rxgain; - switch_core_session_t *session = NULL; - ftdm_alarm_flag_t alarmflag; - ftdm_caller_data_t *caller_data; - ftdm_channel_t *ftdmchan; - ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; - - if (chan_id > ftdm_span_get_chan_count(span)) { - return; - } - - strcpy(sessionid, "(none)"); - ftdmchan = ftdm_span_get_channel(span, chan_id); - span_id = ftdm_span_get_id(span); - - phspan_id = ftdm_channel_get_ph_span_id(ftdmchan); - phchan_id = ftdm_channel_get_ph_id(ftdmchan); - chan_type = ftdm_chan_type2str(ftdm_channel_get_type(ftdmchan)); - state = ftdm_channel_get_state_str(ftdmchan); - last_state = ftdm_channel_get_last_state_str(ftdmchan); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_RX_GAIN, &rxgain); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_TX_GAIN, &txgain); - caller_data = ftdm_channel_get_caller_data(ftdmchan); - ftdm_channel_get_sig_status(ftdmchan, &sigstatus); - ftdm_channel_get_alarms(ftdmchan, &alarmflag); - - uuid = ftdm_channel_get_uuid(ftdmchan, 0); - if (!zstr(uuid)) { - if (!(session = switch_core_session_locate(uuid))) { - snprintf(sessionid, sizeof(sessionid), "%s (dead)", uuid); - } else { - snprintf(sessionid, sizeof(sessionid), "%s", uuid); - switch_core_session_rwunlock(session); - } - } - - stream->write_function(stream, - "span_id: %u\n" - "chan_id: %u\n" - "physical_span_id: %u\n" - "physical_chan_id: %u\n" - "physical_status: %s\n" - "physical_status_red: %d\n" - "physical_status_yellow: %d\n" - "physical_status_rai: %d\n" - "physical_status_blue: %d\n" - "physical_status_ais: %d\n" - "physical_status_general: %d\n" - "signaling_status: %s\n" - "type: %s\n" - "state: %s\n" - "last_state: %s\n" - "txgain: %3.2f\n" - "rxgain: %3.2f\n" - "cid_date: %s\n" - "cid_name: %s\n" - "cid_num: %s\n" - "ani: %s\n" - "aniII: %s\n" - "dnis: %s\n" - "rdnis: %s\n" - "cause: %s\n" - "session: %s\n\n", - span_id, - chan_id, - phspan_id, - phchan_id, - alarmflag ? "alarmed" : "ok", - (alarmflag & FTDM_ALARM_RED) ? 1 : 0, - (alarmflag & FTDM_ALARM_YELLOW) ? 1 : 0, - (alarmflag & FTDM_ALARM_RAI) ? 1 : 0, - (alarmflag & FTDM_ALARM_BLUE) ? 1 : 0, - (alarmflag & FTDM_ALARM_AIS) ? 1 : 0, - (alarmflag & FTDM_ALARM_GENERAL) ? 1 : 0, - ftdm_signaling_status2str(sigstatus), - chan_type, - state, - last_state, - txgain, - rxgain, - caller_data->cid_date, - caller_data->cid_name, - caller_data->cid_num.digits, - caller_data->ani.digits, - caller_data->aniII, - caller_data->dnis.digits, - caller_data->rdnis.digits, - switch_channel_cause2str(caller_data->hangup_cause), - sessionid); -} - -void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream) -{ - uint32_t span_id; - uint32_t phspan_id, phchan_id; - const char *chan_type; - const char *state; - const char *last_state; - float txgain, rxgain; - ftdm_caller_data_t *caller_data; - ftdm_channel_t *ftdmchan; - ftdm_alarm_flag_t alarmflag; - ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; - - if (chan_id > ftdm_span_get_chan_count(span)) { - return; - } - - ftdmchan = ftdm_span_get_channel(span, chan_id); - span_id = ftdm_span_get_id(span); - - phspan_id = ftdm_channel_get_ph_span_id(ftdmchan); - phchan_id = ftdm_channel_get_ph_id(ftdmchan); - chan_type = ftdm_chan_type2str(ftdm_channel_get_type(ftdmchan)); - state = ftdm_channel_get_state_str(ftdmchan); - last_state = ftdm_channel_get_last_state_str(ftdmchan); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_RX_GAIN, &rxgain); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_TX_GAIN, &txgain); - caller_data = ftdm_channel_get_caller_data(ftdmchan); - ftdm_channel_get_sig_status(ftdmchan, &sigstatus); - ftdm_channel_get_alarms(ftdmchan, &alarmflag); - - - stream->write_function(stream, - " \n" - " %u\n" - " %u>\n" - " %u\n" - " %u\n" - " %s\n" - " %d\n" - " %d\n" - " %d\n" - " %d\n" - " %d\n" - " %d\n" - " %s\n" - " %s\n" - " %s\n" - " %s\n" - " %3.2f\n" - " %3.2f\n" - " %s\n" - " %s\n" - " %s\n" - " %s\n" - " %s\n" - " %s\n" - " %s\n" - " %s\n" - " \n", - span_id, - chan_id, - phspan_id, - phchan_id, - alarmflag ? "alarmed" : "ok", - (alarmflag & FTDM_ALARM_RED) ? 1 : 0, - (alarmflag & FTDM_ALARM_YELLOW) ? 1 : 0, - (alarmflag & FTDM_ALARM_RAI) ? 1 : 0, - (alarmflag & FTDM_ALARM_BLUE) ? 1 : 0, - (alarmflag & FTDM_ALARM_AIS) ? 1 : 0, - (alarmflag & FTDM_ALARM_GENERAL) ? 1 : 0, - ftdm_signaling_status2str(sigstatus), - chan_type, - state, - last_state, - txgain, - rxgain, - caller_data->cid_date, - caller_data->cid_name, - caller_data->cid_num.digits, - caller_data->ani.digits, - caller_data->aniII, - caller_data->dnis.digits, - caller_data->rdnis.digits, - switch_channel_cause2str(caller_data->hangup_cause)); -} - -typedef struct ftdm_cli_entry ftdm_cli_entry_t; -typedef switch_status_t (*ftdm_cli_function_t)(ftdm_cli_entry_t *cli, const char *cmd, switch_core_session_t *session, - switch_stream_handle_t *stream, int argc, char *argv[]); -#define FTDM_CLI_DECLARE(name) static switch_status_t name(ftdm_cli_entry_t *cli, const char *cmd, \ - switch_core_session_t *session, switch_stream_handle_t *stream, \ - int argc, char *argv[]) -static void print_usage(switch_stream_handle_t *stream, ftdm_cli_entry_t *cli); - - -typedef struct cmd_ioread_data { - int num_times; - uint32_t interval; - ftdm_span_t *span; - ftdm_channel_t *fchan; - switch_memory_pool_t *pool; - int already_open; -} cmd_ioread_data_t; - -static void *SWITCH_THREAD_FUNC ioread_thread(switch_thread_t *thread, void *obj) -{ - ftdm_wait_flag_t wflags = FTDM_READ; - ftdm_status_t status = FTDM_FAIL; - unsigned char iobuf[SWITCH_RECOMMENDED_BUFFER_SIZE]; - cmd_ioread_data_t *data = obj; - int span_id = ftdm_span_get_id(data->span); - int chan_id = ftdm_channel_get_id(data->fchan); - ftdm_size_t len = ftdm_channel_get_io_packet_len(data->fchan); - ftdm_size_t origlen = len; - unsigned int pbuf[5]; - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Started ioread thread (times = %d, interval = %ums, len = %"FTDM_SIZE_FMT", span = %d, chan = %d\n", - data->num_times, data->interval, len, span_id, chan_id); - - while (ftdm_running() && data->num_times > 0) { - data->num_times--; - - wflags = FTDM_READ; - status = ftdm_channel_wait(data->fchan, &wflags, (data->interval * 10)); - - if (status == FTDM_FAIL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to wait for IO in device %d:%d!\n", span_id, chan_id); - continue; - } - - if (status == FTDM_TIMEOUT) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out while waiting I/O in device %d:%d!\n", span_id, chan_id); - continue; - } - - len = origlen; - if (ftdm_channel_read(data->fchan, iobuf, &len) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to read from device %d:%d!\n", span_id, chan_id); - continue; - } - pbuf[0] = iobuf[0]; - pbuf[1] = iobuf[1]; - pbuf[2] = iobuf[2]; - pbuf[3] = iobuf[3]; - pbuf[4] = iobuf[4]; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Read 0x%1X 0x%1X 0x%1X 0x%1X 0x%1X\n", - pbuf[0], pbuf[1], pbuf[2], pbuf[3], pbuf[4]); - } - - if (!data->already_open) { - ftdm_channel_close(&data->fchan); - } - - switch_core_destroy_memory_pool(&data->pool); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Done ioread thread (times = %d, interval = %ums, len = %"FTDM_SIZE_FMT", span = %d, chan = %d\n", - data->num_times, data->interval, origlen, span_id, chan_id); - return NULL; -} - -FTDM_CLI_DECLARE(ftdm_cmd_ioread) -{ - char *span_name = NULL; - int channo = 0; - ftdm_status_t status = FTDM_SUCCESS; - switch_threadattr_t *attr = NULL; - switch_thread_t *thread = NULL; - - cmd_ioread_data_t *thdata; - cmd_ioread_data_t data; - - memset(&data, 0, sizeof(data)); - data.num_times = 1; - - if (argc < 3) { - print_usage(stream, cli); - goto end; - } - - span_name = argv[1]; - - ftdm_span_find_by_name(span_name, &data.span); - if (!data.span) { - stream->write_function(stream, "-ERR span %s not found\n", span_name); - goto end; - } - - channo = atoi(argv[2]); - - status = ftdm_channel_open(ftdm_span_get_id(data.span), channo, &data.fchan); - if (!data.fchan || (status != FTDM_SUCCESS && status != FTDM_EBUSY)) { - stream->write_function(stream, "-ERR Failed to open channel %d in span %s\n", channo, span_name); - goto end; - } - - if (status == FTDM_EBUSY) { - data.already_open = 1; - } - - if (argc > 3) { - data.num_times = atoi(argv[3]); - if (data.num_times < 1) { - data.num_times = 1; - } - } - - if (argc > 4) { - data.interval = atoi(argv[4]); - } - - if (data.interval <= 0 || data.interval > 10000) { - data.interval = ftdm_channel_get_io_interval(data.fchan); - } - - switch_core_new_memory_pool(&data.pool); - - thdata = switch_core_alloc(data.pool, sizeof(data)); - memcpy(thdata, &data, sizeof(*thdata)); - - switch_threadattr_create(&attr, data.pool); - switch_threadattr_detach_set(attr, 1); - switch_threadattr_stacksize_set(attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&thread, attr, ioread_thread, thdata, data.pool); - -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_list) -{ - int j; - - for (j = 0 ; j < FTDM_MAX_SPANS_INTERFACE; j++) { - ftdm_channel_t *fchan; - ftdm_alarm_flag_t alarmbits = FTDM_ALARM_NONE; - const char *flags = "none"; - ftdm_signaling_status_t sigstatus; - - if (!SPAN_CONFIG[j].span) { - continue; - } - - if (SPAN_CONFIG[j].analog_options & ANALOG_OPTION_3WAY) { - flags = "3way"; - } else if (SPAN_CONFIG[j].analog_options & ANALOG_OPTION_CALL_SWAP) { - flags = "call swap"; - } - fchan = ftdm_span_get_channel(SPAN_CONFIG[j].span, 1); - ftdm_channel_get_alarms(fchan, &alarmbits); - - if ((FTDM_SUCCESS == ftdm_span_get_sig_status(SPAN_CONFIG[j].span, &sigstatus))) { - stream->write_function(stream, - "+OK\n" - "span: %u (%s)\n" - "type: %s\n" - "physical_status: %s\n" - "signaling_status: %s\n" - "chan_count: %u\n" - "dialplan: %s\n" - "context: %s\n" - "dial_regex: %s\n" - "fail_dial_regex: %s\n" - "hold_music: %s\n" - "analog_options: %s\n", - j, - ftdm_span_get_name(SPAN_CONFIG[j].span), - SPAN_CONFIG[j].type, - alarmbits ? "alarmed" : "ok", - ftdm_signaling_status2str(sigstatus), - ftdm_span_get_chan_count(SPAN_CONFIG[j].span), - SPAN_CONFIG[j].dialplan, - SPAN_CONFIG[j].context, - SPAN_CONFIG[j].dial_regex, - SPAN_CONFIG[j].fail_dial_regex, - SPAN_CONFIG[j].hold_music, - flags - ); - } else { - stream->write_function(stream, - "+OK\n" - "span: %u (%s)\n" - "type: %s\n" - "physical_status: %s\n" - "chan_count: %u\n" - "dialplan: %s\n" - "context: %s\n" - "dial_regex: %s\n" - "fail_dial_regex: %s\n" - "hold_music: %s\n" - "analog_options: %s\n", - j, - ftdm_span_get_name(SPAN_CONFIG[j].span), - SPAN_CONFIG[j].type, - alarmbits ? "alarmed" : "ok", - ftdm_span_get_chan_count(SPAN_CONFIG[j].span), - SPAN_CONFIG[j].dialplan, - SPAN_CONFIG[j].context, - SPAN_CONFIG[j].dial_regex, - SPAN_CONFIG[j].fail_dial_regex, - SPAN_CONFIG[j].hold_music, - flags); - } - } - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_start_stop) -{ - char *span_name = argv[1]; - ftdm_span_t *span = NULL; - ftdm_status_t status; - - if (argc < 2) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(span_name, &span); - if (!span) { - stream->write_function(stream, "-ERR span %s not found\n", span_name); - goto end; - } - - if (!strcasecmp(argv[0], "stop")) { - status = ftdm_span_stop(span); - } else { - status = ftdm_span_start(span); - } - - stream->write_function(stream, status == FTDM_SUCCESS ? "+OK\n" : "-ERR failure\n"); -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_reset) -{ - uint32_t chan_id = 0; - uint32_t ccount = 0; - ftdm_channel_t *chan; - ftdm_span_t *span = NULL; - - if (argc < 2) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[1], &span); - if (!span) { - stream->write_function(stream, "-ERR span %s not found\n", argv[1]); - goto end; - } - - if (argc > 2) { - chan_id = atoi(argv[2]); - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "-ERR invalid channel %d\n", chan_id); - goto end; - } - } - - if (chan_id) { - chan = ftdm_span_get_channel(span, chan_id); - if (!chan) { - stream->write_function(stream, "-ERR Could not find channel %d\n", chan_id); - goto end; - } - stream->write_function(stream, "Resetting channel %s:%s\n", argv[1], argv[2]); - ftdm_channel_reset(chan); - } else { - uint32_t i = 0; - ccount = ftdm_span_get_chan_count(span); - for (i = 1; i < ccount; i++) { - chan = ftdm_span_get_channel(span, i); - stream->write_function(stream, "Resetting channel %s:%d\n", argv[1], i); - ftdm_channel_reset(chan); - } - } - -end: - - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_dump) -{ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - uint32_t chan_id = 0; - ftdm_span_t *span; - char *as = NULL; - - if (argc < 2) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[1], &span); - if (argc > 2) { - if (argv[3] && !strcasecmp(argv[2], "as")) { - as = argv[3]; - } else { - chan_id = atoi(argv[2]); - } - } - - if (argv[4] && !strcasecmp(argv[3], "as")) { - as = argv[4]; - } - - if (!zstr(as) && !strcasecmp(as, "xml")) { - stream->write_function(stream, "\n"); - if (!span) { - stream->write_function(stream, "invalid span\n"); - } else { - if (chan_id) { - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "invalid channel\n"); - } else { - dump_chan_xml(span, chan_id, stream); - } - } else { - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - dump_chan_xml(span, ftdm_channel_get_id(ftdm_iterator_current(curr)), stream); - } - ftdm_iterator_free(chaniter); - } - } - stream->write_function(stream, "\n"); - } else { - if (!span) { - stream->write_function(stream, "-ERR invalid span\n"); - } else { - if (chan_id) { - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "-ERR invalid channel\n"); - } else { - char *dbgstr = NULL; - ftdm_channel_t *fchan = ftdm_span_get_channel(span, chan_id); - dump_chan(span, chan_id, stream); - dbgstr = ftdm_channel_get_history_str(fchan); - stream->write_function(stream, "%s\n", dbgstr); - ftdm_free(dbgstr); - } - } else { - stream->write_function(stream, "+OK\n"); - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - dump_chan(span, ftdm_channel_get_id(ftdm_iterator_current(curr)), stream); - } - ftdm_iterator_free(chaniter); - } - } - } - -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_alarms) -{ - ftdm_alarm_flag_t alarmbits = FTDM_ALARM_NONE; - uint32_t chan_id = 0; - ftdm_span_t *span; - - if (argc < 3) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[1], &span); - chan_id = atoi(argv[2]); - if (!span) { - stream->write_function(stream, "-ERR invalid span\n"); - } else if (chan_id) { - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "-ERR invalid channel\n"); - } else { - ftdm_channel_t *chan = ftdm_span_get_channel(span, chan_id); - if (!chan) { - stream->write_function(stream, "-ERR channel not configured\n"); - } else { - ftdm_channel_get_alarms(chan, &alarmbits); - if (!strlen(ftdm_channel_get_last_error(chan))) { - stream->write_function(stream, "+OK No alarms\n"); - } else { - stream->write_function(stream, "-ERR %s on %s:%d\n", ftdm_channel_get_last_error(chan), argv[1], chan); - } - } - } - } -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_sigstatus) -{ - ftdm_span_t *span = NULL; - ftdm_signaling_status_t sigstatus; - - if (argc < 3) { - print_usage(stream, cli); - goto end; - } - - if (!strcasecmp(argv[1], "get") && argc < 3) { - print_usage(stream, cli); - goto end; - } - - if (!strcasecmp(argv[1], "set") && argc != 5) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[2], &span); - if (!span) { - stream->write_function(stream, "-ERR invalid span %s\n", argv[2]); - goto end; - } - - if (!strcasecmp(argv[1], "get")) { - if (argc == 4) { - uint32_t chan_id = atol(argv[3]); - ftdm_channel_t *fchan = ftdm_span_get_channel(span, chan_id); - if (!fchan) { - stream->write_function(stream, "-ERR invalid channel id '%d'\n", chan_id); - goto end; - } - - if ((FTDM_SUCCESS == ftdm_channel_get_sig_status(fchan, &sigstatus))) { - stream->write_function(stream, "Channel %d signaling status: %s\n", chan_id, ftdm_signaling_status2str(sigstatus)); - } else { - stream->write_function(stream, "-ERR failed to get channel signaling status\n"); - } - goto end; - } else { - if ((FTDM_SUCCESS == ftdm_span_get_sig_status(span, &sigstatus))) { - stream->write_function(stream, "signaling_status: %s\n", ftdm_signaling_status2str(sigstatus)); - } else { - stream->write_function(stream, "-ERR failed to read span signaling status: %s\n", ftdm_span_get_last_error(span)); - } - } - goto end; - } - if (!strcasecmp(argv[1], "set")) { - sigstatus = ftdm_str2ftdm_signaling_status(argv[4]); - - if (!strcasecmp(argv[3], "all")) { - if ((FTDM_SUCCESS == ftdm_span_set_sig_status(span, sigstatus))) { - stream->write_function(stream, "Signaling status of all channels from span %s set to %s\n", - ftdm_span_get_name(span), ftdm_signaling_status2str(sigstatus)); - } else { - stream->write_function(stream, "-ERR failed to set span sigstatus to '%s'\n", ftdm_signaling_status2str(sigstatus)); - } - goto end; - } else { - uint32_t chan_id = atol(argv[3]); - ftdm_channel_t *fchan = ftdm_span_get_channel(span, chan_id); - if (!fchan) { - stream->write_function(stream, "-ERR failed to get channel id '%d'\n", chan_id); - goto end; - } - - if ((FTDM_SUCCESS == ftdm_channel_set_sig_status(fchan, sigstatus))) { - stream->write_function(stream, "Signaling status of channel %d set to %s\n", chan_id, - ftdm_signaling_status2str(sigstatus)); - } else { - stream->write_function(stream, "-ERR failed to set span sigstatus to '%s'\n", ftdm_signaling_status2str(sigstatus)); - } - goto end; - } - } - -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_trace) -{ - char tracepath[255]; - unsigned i = 0; - uint32_t chan_id = 0; - uint32_t span_id = 0; - uint32_t chan_count = 0; - ftdm_status_t status; - ftdm_span_t *span = NULL; - ftdm_channel_t *chan = NULL; - - if (argc < 3) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[2], &span); - if (!span) { - stream->write_function(stream, "-ERR failed to find span %s\n", argv[2]); - goto end; - } - - chan_count = ftdm_span_get_chan_count(span); - - if (argc > 3) { - chan_id = atoi(argv[3]); - if (chan_id > chan_count) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - } - - span_id = ftdm_span_get_id(span); - - if (chan_id) { - chan = ftdm_span_get_channel(span, chan_id); - - snprintf(tracepath, sizeof(tracepath), "%s-in-s%dc%d", argv[1], span_id, chan_id); - status = ftdm_channel_command(chan, FTDM_COMMAND_TRACE_INPUT, tracepath); - if (status != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR failed to enable input trace at path %s\n", tracepath); - goto end; - } - - snprintf(tracepath, sizeof(tracepath), "%s-out-s%dc%d", argv[1], span_id, chan_id); - status = ftdm_channel_command(chan, FTDM_COMMAND_TRACE_OUTPUT, tracepath); - if (status != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR failed to enable output trace at path %s\n", tracepath); - ftdm_channel_command(chan, FTDM_COMMAND_TRACE_END_ALL, NULL); - goto end; - } - } else { - for (i = 1; i <= chan_count; i++) { - chan = ftdm_span_get_channel(span, i); - - snprintf(tracepath, sizeof(tracepath), "%s-in-s%dc%d", argv[1], span_id, i); - status = ftdm_channel_command(chan, FTDM_COMMAND_TRACE_INPUT, tracepath); - if (status != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR failed to enable input trace at path %s\n", tracepath); - goto end; - } - - snprintf(tracepath, sizeof(tracepath), "%s-out-s%dc%d", argv[1], span_id, i); - status = ftdm_channel_command(chan, FTDM_COMMAND_TRACE_OUTPUT, tracepath); - if (status != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR failed to enable output trace at path %s\n", tracepath); - ftdm_channel_command(chan, FTDM_COMMAND_TRACE_END_ALL, NULL); - goto end; - } - } - } - stream->write_function(stream, "+OK trace enabled with prefix path %s\n", argv[1]); -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_notrace) -{ - uint32_t i = 0; - uint32_t chan_id = 0; - uint32_t chan_count = 0; - ftdm_channel_t *fchan = NULL; - ftdm_span_t *span = NULL; - - if (argc < 2) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[1], &span); - if (!span) { - stream->write_function(stream, "-ERR failed to find span %s\n", argv[1]); - goto end; - } - - chan_count = ftdm_span_get_chan_count(span); - - if (argc > 2) { - chan_id = atoi(argv[2]); - if (chan_id > chan_count) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - } - - if (chan_id) { - fchan = ftdm_span_get_channel(span, chan_id); - ftdm_channel_command(fchan, FTDM_COMMAND_TRACE_END_ALL, NULL); - } else { - for (i = 1; i <= chan_count; i++) { - fchan = ftdm_span_get_channel(span, i); - ftdm_channel_command(fchan, FTDM_COMMAND_TRACE_END_ALL, NULL); - } - } - stream->write_function(stream, "+OK trace disabled\n"); - -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_gains) -{ - unsigned int i = 0; - float txgain = 0.0; - float rxgain = 0.0; - uint32_t chan_id = 0; - uint32_t ccount = 0; - ftdm_channel_t *chan; - ftdm_span_t *span = NULL; - - if (argc < 4) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[3], &span); - if (!span) { - stream->write_function(stream, "-ERR failed to find span %s\n", argv[3]); - goto end; - } - - if (argc > 4) { - chan_id = atoi(argv[4]); - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - } - - i = sscanf(argv[1], "%f", &rxgain); - i += sscanf(argv[2], "%f", &txgain); - if (i != 2) { - stream->write_function(stream, "-ERR invalid gains\n"); - goto end; - } - - if (chan_id) { - chan = ftdm_span_get_channel(span, chan_id); - ftdm_channel_command(chan, FTDM_COMMAND_SET_RX_GAIN, &rxgain); - ftdm_channel_command(chan, FTDM_COMMAND_SET_TX_GAIN, &txgain); - } else { - ccount = ftdm_span_get_chan_count(span); - for (i = 1; i < ccount; i++) { - chan = ftdm_span_get_channel(span, i); - ftdm_channel_command(chan, FTDM_COMMAND_SET_RX_GAIN, &rxgain); - ftdm_channel_command(chan, FTDM_COMMAND_SET_TX_GAIN, &txgain); - } - } - stream->write_function(stream, "+OK gains set to Rx %f and Tx %f\n", rxgain, txgain); -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_dtmf) -{ - unsigned i = 0; - uint32_t chan_id = 0; - unsigned schan_count = 0; - ftdm_span_t *span = NULL; - ftdm_command_t fcmd = FTDM_COMMAND_ENABLE_DTMF_DETECT; - ftdm_channel_t *fchan; - - if (argc < 3) { - print_usage(stream, cli); - goto end; - } - - if (switch_true(argv[1])) { - fcmd = FTDM_COMMAND_ENABLE_DTMF_DETECT; - } else { - fcmd = FTDM_COMMAND_DISABLE_DTMF_DETECT; - } - - ftdm_span_find_by_name(argv[2], &span); - if (!span) { - stream->write_function(stream, "-ERR failed to find span %s\n", argv[2]); - goto end; - } - - schan_count = ftdm_span_get_chan_count(span); - if (argc > 3) { - chan_id = atoi(argv[3]); - if (chan_id > schan_count) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - } - - if (chan_id) { - fchan = ftdm_span_get_channel(span, chan_id); - ftdm_channel_command(fchan, fcmd, NULL); - } else { - for (i = 1; i <= schan_count; i++) { - fchan = ftdm_span_get_channel(span, i); - ftdm_channel_command(fchan, fcmd, NULL); - } - } - - stream->write_function(stream, "+OK DTMF detection was %s\n", fcmd == FTDM_COMMAND_ENABLE_DTMF_DETECT ? "enabled" : "disabled"); -end: - return SWITCH_STATUS_SUCCESS; -} - -FTDM_CLI_DECLARE(ftdm_cmd_queuesize) -{ - unsigned int i = 0; - uint32_t rxsize = 10; - uint32_t txsize = 10; - uint32_t chan_id = 0; - uint32_t ccount = 0; - ftdm_channel_t *chan; - ftdm_span_t *span = NULL; - - if (argc < 4) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[3], &span); - if (!span) { - stream->write_function(stream, "-ERR failed to find span %s\n", argv[3]); - goto end; - } - - if (argc > 4) { - chan_id = atoi(argv[4]); - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - } - - i = sscanf(argv[1], "%u", &rxsize); - i += sscanf(argv[2], "%u", &txsize); - if (i != 2) { - stream->write_function(stream, "-ERR invalid queue sizes provided\n"); - goto end; - } - - if (chan_id) { - chan = ftdm_span_get_channel(span, chan_id); - ftdm_channel_command(chan, FTDM_COMMAND_SET_RX_QUEUE_SIZE, &rxsize); - ftdm_channel_command(chan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &txsize); - } else { - ccount = ftdm_span_get_chan_count(span); - for (i = 1; i < ccount; i++) { - chan = ftdm_span_get_channel(span, i); - ftdm_channel_command(chan, FTDM_COMMAND_SET_RX_QUEUE_SIZE, &rxsize); - ftdm_channel_command(chan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &txsize); - } - } - stream->write_function(stream, "+OK queue sizes set to Rx %d and Tx %d\n", rxsize, txsize); -end: - return SWITCH_STATUS_SUCCESS; -} - -static void exec_io_command(const char *cmd, switch_stream_handle_t *stream, ftdm_channel_t *fchan) -{ - int enable = 0; - ftdm_channel_iostats_t stats; - - if (!strcasecmp("enable", cmd)) { - enable = 1; - ftdm_channel_command(fchan, FTDM_COMMAND_SWITCH_IOSTATS, &enable); - } else if (!strcasecmp("disable", cmd)) { - enable = 0; - ftdm_channel_command(fchan, FTDM_COMMAND_SWITCH_IOSTATS, &enable); - } else if (!strcasecmp("flush", cmd)) { - ftdm_channel_command(fchan, FTDM_COMMAND_FLUSH_IOSTATS, NULL); - } else { - ftdm_channel_command(fchan, FTDM_COMMAND_GET_IOSTATS, &stats); - stream->write_function(stream, "-- IO statistics for channel %d:%d --\n", - ftdm_channel_get_span_id(fchan), ftdm_channel_get_id(fchan)); - stream->write_function(stream, "Rx errors: %u\n", stats.rx.errors); - stream->write_function(stream, "Rx queue size: %u\n", stats.rx.queue_size); - stream->write_function(stream, "Rx queue len: %u\n", stats.rx.queue_len); - stream->write_function(stream, "Rx count: %lu\n", stats.rx.packets); - - stream->write_function(stream, "Tx errors: %u\n", stats.tx.errors); - stream->write_function(stream, "Tx queue size: %u\n", stats.tx.queue_size); - stream->write_function(stream, "Tx queue len: %u\n", stats.tx.queue_len); - stream->write_function(stream, "Tx count: %lu\n", stats.tx.packets); - stream->write_function(stream, "Tx idle: %u\n", stats.tx.idle_packets); - } -} - -FTDM_CLI_DECLARE(ftdm_cmd_iostats) -{ - uint32_t chan_id = 0; - ftdm_channel_t *chan; - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - ftdm_span_t *span = NULL; - - if (argc < 3) { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[2], &span); - if (!span) { - stream->write_function(stream, "-ERR failed to find span %s\n", argv[2]); - goto end; - } - - if (argc > 3) { - chan_id = atoi(argv[3]); - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - chan = ftdm_span_get_channel(span, chan_id); - exec_io_command(argv[1], stream, chan); - } else { - iter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - chan = ftdm_iterator_current(curr); - exec_io_command(argv[1], stream, chan); - } - ftdm_iterator_free(iter); - } - stream->write_function(stream, "+OK\n"); -end: - return SWITCH_STATUS_SUCCESS; -} - -#define CASINTS(cas) ((cas) & (1 << 3)) ? 1 : 0, \ - ((cas) & (1 << 2)) ? 1 : 0, \ - ((cas) & (1 << 1)) ? 1 : 0, \ - ((cas) & (1 << 0)) ? 1 : 0 -FTDM_CLI_DECLARE(ftdm_cmd_cas) -{ - uint32_t chan_id = 0; - switch_bool_t do_read = SWITCH_FALSE; - ftdm_channel_t *chan; - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - ftdm_span_t *span = NULL; - const char *write_bits_str = ""; - int32_t abcd_bits = 0; - - if (argc < 3) { - print_usage(stream, cli); - goto end; - } - - if (!strcasecmp(argv[1], "read")) { - do_read = SWITCH_TRUE; - chan_id = argc > 3 ? atoi(argv[3]) : 0; - } else if (!strcasecmp(argv[1], "write") && argc >= 4) { - const char *str = NULL; - int mask = 0x08; - do_read = SWITCH_FALSE; - if (argc == 4) { - chan_id = 0; - write_bits_str = argv[3]; - } else { - chan_id = atoi(argv[3]); - write_bits_str = argv[4]; - } - if (strlen(write_bits_str) != 4) { - stream->write_function(stream, "-ERR Invalid CAS bits '%s'. CAS ABCD string must be composed of only four 1's and 0's (e.g. 1101)\n", write_bits_str); - goto end; - } - str = write_bits_str; - while (*str) { - if (*str == '1') { - abcd_bits |= mask; - } else if (*str != '0') { - stream->write_function(stream, "-ERR Invalid CAS bits '%s'. CAS ABCD string must be composed of only four 1's and 0's (e.g. 1101)\n", write_bits_str); - goto end; - } - str++; - mask = (mask >> 1); - } - } else { - print_usage(stream, cli); - goto end; - } - - ftdm_span_find_by_name(argv[2], &span); - if (!span) { - stream->write_function(stream, "-ERR failed to find span %s\n", argv[2]); - goto end; - } - - if (chan_id) { - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - chan = ftdm_span_get_channel(span, chan_id); - if (do_read) { - ftdm_channel_command(chan, FTDM_COMMAND_GET_CAS_BITS, &abcd_bits); - stream->write_function(stream, "Read CAS bits from channel %d: %d%d%d%d (0x0%X)\n", chan_id, CASINTS(abcd_bits), abcd_bits); - } else { - stream->write_function(stream, "Writing 0x0%X to channel %d\n", abcd_bits, chan_id); - } - } else { - iter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - chan = ftdm_iterator_current(curr); - //ftdm_channel_command(); - chan_id = ftdm_channel_get_id(chan); - if (do_read) { - ftdm_channel_command(chan, FTDM_COMMAND_GET_CAS_BITS, &abcd_bits); - stream->write_function(stream, "Read CAS bits from channel %d: %d%d%d%d (0x0%X)\n", chan_id, CASINTS(abcd_bits), abcd_bits); - } else { - stream->write_function(stream, "Writing 0x0%X to channel %d\n", abcd_bits, chan_id); - } - } - ftdm_iterator_free(iter); - } - stream->write_function(stream, "+OK\n"); -end: - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_STANDARD_API(ftdm_api_exec_usage) -{ - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - uint32_t chan_id = 0; - ftdm_channel_t *chan = NULL; - ftdm_span_t *span = NULL; - uint32_t tokencnt = 0; - /*ftdm_cli_entry_t *entry = NULL;*/ - - if (!zstr(cmd) && (mycmd = strdup(cmd))) { - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - if (!argc) { - stream->write_function(stream, "-ERR invalid args\n"); - goto end; - } - - if (argc < 2) { - stream->write_function(stream, "-ERR invalid args\n"); - goto end; - } - - ftdm_span_find_by_name(argv[0], &span); - chan_id = atoi(argv[1]); - if (!span) { - stream->write_function(stream, "-ERR invalid span\n"); - goto end; - } - - if (chan_id <= 0) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - - if (chan_id > ftdm_span_get_chan_count(span)) { - stream->write_function(stream, "-ERR invalid channel\n"); - goto end; - } - - chan = ftdm_span_get_channel(span, chan_id); - if (!chan) { - stream->write_function(stream, "-ERR channel not configured\n"); - goto end; - } - - tokencnt = ftdm_channel_get_token_count(chan); - stream->write_function(stream, "%d", tokencnt); - -end: - switch_safe_free(mycmd); - return SWITCH_STATUS_SUCCESS; -} - -struct ftdm_cli_entry { - const char *name; - const char *args; - const char *complete; - const char *desc; - ftdm_cli_function_t execute; - switch_api_function_t execute_api; -}; - -static ftdm_cli_entry_t ftdm_cli_options[] = -{ - { "list", "", "", NULL, ftdm_cmd_list, NULL }, - { "start", "", "", NULL, ftdm_cmd_start_stop, NULL }, - { "stop", "", "", NULL, ftdm_cmd_start_stop, NULL }, - { "reset", " []", "", NULL, ftdm_cmd_reset, NULL }, - { "alarms", " ", "", NULL, ftdm_cmd_alarms, NULL }, - { "dump", " []", "", NULL, ftdm_cmd_dump, NULL }, - { "sigstatus", "get|set [] []", "::[set:get", NULL, ftdm_cmd_sigstatus, NULL }, - { "trace", " []", "", NULL, ftdm_cmd_trace, NULL }, - { "notrace", " []", "", NULL, ftdm_cmd_notrace, NULL }, - { "gains", " []", "", NULL, ftdm_cmd_gains, NULL }, - { "dtmf", "on|off []", "::[on:off", NULL, ftdm_cmd_dtmf, NULL }, - { "queuesize", " []", "", NULL, ftdm_cmd_queuesize, NULL }, - { "iostats", "enable|disable|flush|print ", "::[enable:disable:flush:print", NULL, ftdm_cmd_iostats, NULL }, - { "ioread", " [num_times] [interval]", "", NULL, ftdm_cmd_ioread, NULL }, - { "cas", "read|write [] []", "::[read:write", NULL, ftdm_cmd_cas, NULL }, - - /* Stand-alone commands (not part of the generic ftdm API */ - { "ftdm_usage", " ", "", "Return channel call count", NULL, ftdm_api_exec_usage }, - - /* Fake handlers as they are handled within freetdm library, - * we should provide a way inside freetdm to query for completions from signaling modules */ - { "core state", "[!]", "", NULL, NULL, NULL }, - { "core flag", "[!] [] []", "", NULL, NULL, NULL }, - { "core spanflag", "[!] []", "", NULL, NULL, NULL }, - { "core calls", "", "", NULL, NULL, NULL }, -}; - -static void print_usage(switch_stream_handle_t *stream, ftdm_cli_entry_t *cli) -{ - stream->write_function(stream, "-ERR Usage: ftdm %s %s\n", cli->name, cli->args); -} - -static void print_full_usage(switch_stream_handle_t *stream) -{ - int i = 0; - ftdm_cli_entry_t *entry = NULL; - - stream->write_function(stream, "USAGE:\n"); - stream->write_function(stream, "--------------------------------------------------------------------------------\n"); - for (i = 0 ; i < ftdm_array_len(ftdm_cli_options); i++) { - entry = &ftdm_cli_options[i]; - if (entry->execute_api) { - continue; - } - stream->write_function(stream, "ftdm %s %s\n", entry->name, entry->args); - } - stream->write_function(stream, "--------------------------------------------------------------------------------\n"); -} - -SWITCH_STANDARD_API(ftdm_api_exec) -{ - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - int i = 0; - ftdm_cli_entry_t *entry = NULL; - - if (!zstr(cmd) && (mycmd = strdup(cmd))) { - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - if (!argc) { - print_full_usage(stream); - goto end; - } - - for (i = 0 ; i < ftdm_array_len(ftdm_cli_options); i++) { - entry = &ftdm_cli_options[i]; - if (!strcasecmp(argv[0], entry->name) && entry->execute) { - entry->execute(entry, cmd, session, stream, argc, argv); - break; - } - } - - /* if the command was not found in the main CLI entries, try to execute it as a FreeTDM API */ - if (i == ftdm_array_len(ftdm_cli_options)) { - char *rply = ftdm_api_execute(cmd); - if (rply) { - stream->write_function(stream, "%s", rply); - ftdm_free(rply); - } else { - print_full_usage(stream); - } - } - -end: - switch_safe_free(mycmd); - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_STANDARD_APP(enable_dtmf_function) -{ - private_t *tech_pvt; - - if (!switch_core_session_check_interface(session, freetdm_endpoint_interface)) { - ftdm_log(FTDM_LOG_ERROR, "This application is only for FreeTDM channels.\n"); - return; - } - - tech_pvt = switch_core_session_get_private(session); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_LOSE_RACE); - return; - } - - ftdm_channel_command(tech_pvt->ftdmchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, NULL); - ftdm_log(FTDM_LOG_INFO, "DTMF detection enabled in channel %d:%d\n", ftdm_channel_get_id(tech_pvt->ftdmchan), ftdm_channel_get_span_id(tech_pvt->ftdmchan)); -} - -SWITCH_STANDARD_APP(disable_dtmf_function) -{ - private_t *tech_pvt; - - if (!switch_core_session_check_interface(session, freetdm_endpoint_interface)) { - ftdm_log(FTDM_LOG_ERROR, "This application is only for FreeTDM channels.\n"); - return; - } - - tech_pvt = switch_core_session_get_private(session); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_LOSE_RACE); - return; - } - - ftdm_channel_command(tech_pvt->ftdmchan, FTDM_COMMAND_DISABLE_DTMF_DETECT, NULL); - ftdm_log(FTDM_LOG_INFO, "DTMF detection Disabled in channel %d:%d\n", ftdm_channel_get_id(tech_pvt->ftdmchan), ftdm_channel_get_span_id(tech_pvt->ftdmchan)); -} - -SWITCH_STANDARD_APP(disable_ec_function) -{ - private_t *tech_pvt; - int x = 0; - - if (!switch_core_session_check_interface(session, freetdm_endpoint_interface)) { - ftdm_log(FTDM_LOG_ERROR, "This application is only for FreeTDM channels.\n"); - return; - } - - tech_pvt = switch_core_session_get_private(session); - - if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_LOSE_RACE); - return; - } - - ftdm_channel_command(tech_pvt->ftdmchan, FTDM_COMMAND_DISABLE_ECHOCANCEL, &x); - ftdm_channel_command(tech_pvt->ftdmchan, FTDM_COMMAND_DISABLE_ECHOTRAIN, &x); - ftdm_log(FTDM_LOG_INFO, "Echo Canceller Disabled\n"); -} - - -SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load) -{ - int i = 0; - ftdm_cli_entry_t *entry = NULL; - switch_api_interface_t *commands_api_interface = NULL; - switch_application_interface_t *app_interface = NULL; - - module_pool = pool; - - ftdm_global_set_logger(ftdm_logger); - - ftdm_global_set_mod_directory(SWITCH_GLOBAL_dirs.mod_dir); - - ftdm_global_set_config_directory(SWITCH_GLOBAL_dirs.conf_dir); - - if (load_config_path() != SWITCH_STATUS_SUCCESS) { - ftdm_global_destroy(); - return SWITCH_STATUS_TERM; - } - - if (ftdm_global_init() != FTDM_SUCCESS) { - ftdm_global_destroy(); - ftdm_log(FTDM_LOG_ERROR, "Error loading FreeTDM\n"); - return SWITCH_STATUS_TERM; - } - - if (ftdm_global_configuration() != FTDM_SUCCESS) { - ftdm_global_destroy(); - ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM\n"); - return SWITCH_STATUS_TERM; - } - - if (load_config() != SWITCH_STATUS_SUCCESS) { - ftdm_global_destroy(); - return SWITCH_STATUS_TERM; - } - - *module_interface = switch_loadable_module_create_module_interface(pool, modname); - freetdm_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); - freetdm_endpoint_interface->interface_name = "freetdm"; - freetdm_endpoint_interface->io_routines = &freetdm_io_routines; - freetdm_endpoint_interface->state_handler = &freetdm_state_handlers; - - SWITCH_ADD_API(commands_api_interface, "ftdm", "FreeTDM commands", ftdm_api_exec, " "); - for (i = 0 ; i < ftdm_array_len(ftdm_cli_options); i++) { - char complete_cli[512]; - entry = &ftdm_cli_options[i]; - if (entry->execute_api) { - /* This is a stand-alone API */ - SWITCH_ADD_API(commands_api_interface, entry->name, entry->desc, ftdm_api_exec_usage, entry->args); - snprintf(complete_cli, sizeof(complete_cli), "add %s %s", entry->name, entry->complete); - switch_console_set_complete(complete_cli); - } else { - snprintf(complete_cli, sizeof(complete_cli), "add ftdm %s %s", entry->name, entry->complete); - switch_console_set_complete(complete_cli); - } - } - - SWITCH_ADD_APP(app_interface, "disable_ec", "Disable Echo Canceller", "Disable Echo Canceller", disable_ec_function, "", SAF_NONE); - SWITCH_ADD_APP(app_interface, "disable_dtmf", "Disable DTMF Detection", "Disable DTMF Detection", disable_dtmf_function, "", SAF_NONE); - SWITCH_ADD_APP(app_interface, "enable_dtmf", "Enable DTMF Detection", "Enable DTMF Detection", enable_dtmf_function, "", SAF_NONE); -#if 0 - ctdm_init(*module_interface); -#endif - /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_freetdm_shutdown) -{ - switch_hash_index_t *hi; - const void *var; - void *val; - - /* destroy ss7 configs */ - for (hi = switch_core_hash_first(globals.ss7_configs); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, &var, NULL, &val); - ftdm_conf_node_destroy(val); - } - - switch_core_hash_destroy(&globals.ss7_configs); - ftdm_global_destroy(); - - // this breaks pika but they are MIA so *shrug* - //return SWITCH_STATUS_NOUNLOAD; - return SWITCH_STATUS_SUCCESS; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/freetdm/mod_freetdm/mod_openzap.2005.vcproj b/libs/freetdm/mod_freetdm/mod_openzap.2005.vcproj deleted file mode 100644 index 491d0d574a..0000000000 --- a/libs/freetdm/mod_freetdm/mod_openzap.2005.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/mod_freetdm/tdm.c b/libs/freetdm/mod_freetdm/tdm.c deleted file mode 100644 index d53c8a584b..0000000000 --- a/libs/freetdm/mod_freetdm/tdm.c +++ /dev/null @@ -1,719 +0,0 @@ -/* -* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -* Copyright (C) 2005-2011, Anthony Minessale II -* -* Version: MPL 1.1 -* -* The contents of this file are subject to the Mozilla Public License Version -* 1.1 (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* http://www.mozilla.org/MPL/ -* -* Software distributed under the License is distributed on an "AS IS" basis, -* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -* for the specific language governing rights and limitations under the -* License. -* -* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -* -* The Initial Developer of the Original Code is -* Anthony Minessale II -* Portions created by the Initial Developer are Copyright (C) -* the Initial Developer. All Rights Reserved. -* -* Contributor(s): -* -* Mathieu Rene -* -* tdm.c -- FreeTDM Controllable Channel Module -* -*/ - -#include -#include "freetdm.h" - -void ctdm_init(switch_loadable_module_interface_t *module_interface); - -/* Parameters */ - -#define kSPAN_ID "span" -#define kCHAN_ID "chan" -#define kSPAN_NAME "span_name" -#define kPREBUFFER_LEN "prebuffer_len" -#define kECHOCANCEL "echo_cancel" - - -static struct { - switch_memory_pool_t *pool; - switch_endpoint_interface_t *endpoint_interface; -} ctdm; - -typedef struct { - int span_id; - int chan_id; - ftdm_channel_t *ftdm_channel; - switch_core_session_t *session; - switch_codec_t read_codec, write_codec; - switch_frame_t read_frame; - int prebuffer_len; - - unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE]; -} ctdm_private_t; - -static switch_status_t channel_on_init(switch_core_session_t *session); -static switch_status_t channel_on_destroy(switch_core_session_t *session); -static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, - switch_caller_profile_t *outbound_profile, - switch_core_session_t **new_session, - switch_memory_pool_t **pool, - switch_originate_flag_t flags, switch_call_cause_t *cancel_cause); -static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); -static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); -static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg); -static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event); -static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf); - - -static ftdm_status_t ctdm_span_prepare(ftdm_span_t *span); - -switch_state_handler_table_t ctdm_state_handlers = { - .on_init = channel_on_init, - .on_destroy = channel_on_destroy -}; - -switch_io_routines_t ctdm_io_routines = { - .send_dtmf = channel_send_dtmf, - .outgoing_channel = channel_outgoing_channel, - .read_frame = channel_read_frame, - .write_frame = channel_write_frame, - .receive_message = channel_receive_message, - .receive_event = channel_receive_event -}; - -static void ctdm_report_alarms(ftdm_channel_t *channel) -{ - switch_event_t *event = NULL; - ftdm_alarm_flag_t alarmflag = 0; - - if (switch_event_create(&event, SWITCH_EVENT_TRAP) != SWITCH_STATUS_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to create alarms events\n"); - return; - } - - if (ftdm_channel_get_alarms(channel, &alarmflag) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to retrieve alarms %s:%d\n", ftdm_channel_get_span_name(channel), ftdm_channel_get_id(channel)); - return; - } - - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-name", "%s", ftdm_channel_get_span_name(channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-number", "%d", ftdm_channel_get_span_id(channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "chan-number", "%d", ftdm_channel_get_id(channel)); - - if (alarmflag) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "condition", "ftdm-alarm-trap"); - } else { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "condition", "ftdm-alarm-clear"); - } - - if (alarmflag & FTDM_ALARM_RED) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "red"); - } - if (alarmflag & FTDM_ALARM_YELLOW) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "yellow"); - } - if (alarmflag & FTDM_ALARM_RAI) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "rai"); - } - if (alarmflag & FTDM_ALARM_BLUE) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "blue"); - } - if (alarmflag & FTDM_ALARM_AIS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "ais"); - } - if (alarmflag & FTDM_ALARM_GENERAL) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "general"); - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Reporting [%s] alarms for %s:%d\n", - (alarmflag?"ftdm-alarm-trap":"ftdm-alarm-clear"), ftdm_channel_get_span_name(channel), ftdm_channel_get_id(channel)); - - switch_event_fire(&event); - return; -} - -static ftdm_channel_t *ctdm_get_channel_from_event(switch_event_t *event, ftdm_span_t *span) -{ - uint32_t chan_id = 0; - const char *chan_number = NULL; - - chan_number = switch_event_get_header(event, "chan-number"); - - if (zstr(chan_number)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No channel number specified\n"); - return NULL; - } - chan_id = atoi(chan_number); - if (!chan_id) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid channel number:%s\n", chan_number); - return NULL; - } - - return ftdm_span_get_channel_ph(span, chan_id); -} - - -static void ctdm_event_handler(switch_event_t *event) -{ - ftdm_status_t status = FTDM_FAIL; - switch(event->event_id) { - case SWITCH_EVENT_TRAP: - { - ftdm_span_t *span = NULL; - ftdm_channel_t *channel = NULL; - const char *span_name = NULL; - - const char *cond = switch_event_get_header(event, "condition"); - const char *command = switch_event_get_header(event, "command"); - if (zstr(cond)) { - return; - } - - span_name = switch_event_get_header(event, "span-name"); - - if (ftdm_span_find_by_name(span_name, &span) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find span [%s]\n", span_name); - return; - } - - if (!strcmp(cond, "mg-tdm-prepare")) { - status = ctdm_span_prepare(span); - if (status == FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s:prepared successfully\n", span_name); - } else if (status != FTDM_EINVAL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s:Failed to prepare span\n", span_name); - } - } else if (!strcmp(cond, "mg-tdm-check")) { - channel = ctdm_get_channel_from_event(event, span); - if (!channel) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find channel\n"); - return; - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting alarm status for %s:%d\n", - ftdm_channel_get_span_name(channel), ftdm_channel_get_id(channel)); - - ctdm_report_alarms(channel); - } else if (!strcmp(cond, "mg-tdm-dtmfremoval")) { - uint8_t enable = 0; - channel = ctdm_get_channel_from_event(event, span); - if (!channel) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find channel\n"); - return; - } - - if (zstr(command)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s:No command specified for mg-tdm-dtmfremoval\n", span_name); - return; - } - - if (!strcmp(command, "enable")) { - enable = 1; - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s DTMF-removal for %s:%d\n", - enable ? "Enabling" : "Disabling", ftdm_channel_get_span_name(channel), ftdm_channel_get_id(channel)); - - ftdm_channel_command(channel, enable ? FTDM_COMMAND_ENABLE_DTMF_REMOVAL : FTDM_COMMAND_DISABLE_DTMF_REMOVAL, 0); - } - } - break; - default: - break; - } - return; -} - -void ctdm_init(switch_loadable_module_interface_t *module_interface) -{ - switch_endpoint_interface_t *endpoint_interface; - ctdm.pool = module_interface->pool; - endpoint_interface = switch_loadable_module_create_interface(module_interface, SWITCH_ENDPOINT_INTERFACE); - endpoint_interface->interface_name = "tdm"; - endpoint_interface->io_routines = &ctdm_io_routines; - endpoint_interface->state_handler = &ctdm_state_handlers; - ctdm.endpoint_interface = endpoint_interface; - - switch_event_bind("mod_freetdm", SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, ctdm_event_handler, NULL); -} - -static FIO_SIGNAL_CB_FUNCTION(on_signal_cb) -{ - uint32_t chanid, spanid; - switch_event_t *event = NULL; - ftdm_alarm_flag_t alarmbits = FTDM_ALARM_NONE; - - chanid = ftdm_channel_get_id(sigmsg->channel); - spanid = ftdm_channel_get_span_id(sigmsg->channel); - - switch(sigmsg->event_id) { - case FTDM_SIGEVENT_ALARM_CLEAR: - case FTDM_SIGEVENT_ALARM_TRAP: - { - if (ftdm_channel_get_alarms(sigmsg->channel, &alarmbits) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to retrieve alarms\n"); - return FTDM_FAIL; - } - - if (switch_event_create(&event, SWITCH_EVENT_TRAP) != SWITCH_STATUS_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to create alarms events\n"); - return FTDM_FAIL; - } - if (sigmsg->event_id == FTDM_SIGEVENT_ALARM_CLEAR) { - ftdm_log(FTDM_LOG_NOTICE, "Alarm cleared on channel %d:%d\n", spanid, chanid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "condition", "ftdm-alarm-clear"); - } else { - ftdm_log(FTDM_LOG_NOTICE, "Alarm raised on channel %d:%d\n", spanid, chanid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "condition", "ftdm-alarm-trap"); - } - } - break; - default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unhandled event %d\n", sigmsg->event_id); - break; - } - - if (event) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-name", "%s", ftdm_channel_get_span_name(sigmsg->channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-number", "%d", ftdm_channel_get_span_id(sigmsg->channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "chan-number", "%d", ftdm_channel_get_id(sigmsg->channel)); - - if (alarmbits & FTDM_ALARM_RED) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "red"); - } - if (alarmbits & FTDM_ALARM_YELLOW) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "yellow"); - } - if (alarmbits & FTDM_ALARM_RAI) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "rai"); - } - if (alarmbits & FTDM_ALARM_BLUE) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "blue"); - } - if (alarmbits & FTDM_ALARM_AIS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "ais"); - } - if (alarmbits & FTDM_ALARM_GENERAL) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alarm", "general"); - } - - switch_event_fire(&event); - } - return FTDM_SUCCESS; -} - -static ftdm_status_t ctdm_span_prepare(ftdm_span_t *span) -{ - if (ftdm_span_register_signal_cb(span, on_signal_cb) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register signal CB\n"); - return FTDM_FAIL; - } - return ftdm_span_start(span); -} - -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) -{ - const char *szchanid = switch_event_get_header(var_event, kCHAN_ID), - *span_name = switch_event_get_header(var_event, kSPAN_NAME), - *szprebuffer_len = switch_event_get_header(var_event, kPREBUFFER_LEN); - int chan_id; - int span_id; - switch_caller_profile_t *caller_profile; - ftdm_span_t *span; - ftdm_channel_t *chan; - switch_channel_t *channel; - char name[128]; - const char *dname; - ftdm_codec_t codec; - uint32_t interval; - ctdm_private_t *tech_pvt = NULL; - - if (zstr(szchanid) || zstr(span_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Both ["kSPAN_ID"] and ["kCHAN_ID"] have to be set.\n"); - goto fail; - } - - chan_id = atoi(szchanid); - - if (ftdm_span_find_by_name(span_name, &span) == FTDM_SUCCESS) { - span_id = ftdm_span_get_id(span); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find span [%s]\n", span_name); - goto fail; - } - - if (!(*new_session = switch_core_session_request(ctdm.endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, 0, pool))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't request session.\n"); - goto fail; - } - - channel = switch_core_session_get_channel(*new_session); - - if (ftdm_channel_open_ph(span_id, chan_id, &chan) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't open span or channel.\n"); - goto fail; - } - - switch_channel_set_flag(channel, CF_AUDIO); - - span = ftdm_channel_get_span(chan); - - tech_pvt = switch_core_session_alloc(*new_session, sizeof *tech_pvt); - tech_pvt->chan_id = chan_id; - tech_pvt->span_id = span_id; - tech_pvt->ftdm_channel = chan; - tech_pvt->session = *new_session; - tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf); - tech_pvt->read_frame.data = tech_pvt->databuf; - tech_pvt->prebuffer_len = zstr(szprebuffer_len) ? 0 : atoi(szprebuffer_len); - switch_core_session_set_private(*new_session, tech_pvt); - - - caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); - switch_channel_set_caller_profile(channel, caller_profile); - - snprintf(name, sizeof(name), "tdm/%d:%d", span_id, chan_id); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect outbound channel %s\n", name); - switch_channel_set_name(channel, name); - - switch_channel_set_state(channel, CS_INIT); - - if (FTDM_SUCCESS != ftdm_channel_command(chan, FTDM_COMMAND_GET_CODEC, &codec)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to retrieve channel codec.\n"); - return SWITCH_CAUSE_NETWORK_OUT_OF_ORDER; - } - - if (FTDM_SUCCESS != ftdm_channel_command(chan, FTDM_COMMAND_GET_INTERVAL, &interval)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to retrieve channel interval.\n"); - return SWITCH_CAUSE_NETWORK_OUT_OF_ORDER; - } - - if (FTDM_SUCCESS != ftdm_channel_command(chan, FTDM_COMMAND_SET_PRE_BUFFER_SIZE, &tech_pvt->prebuffer_len)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set channel pre buffer size.\n"); - return SWITCH_CAUSE_NETWORK_OUT_OF_ORDER; - } - - if (FTDM_SUCCESS != ftdm_channel_command(tech_pvt->ftdm_channel, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to set enable echo cancellation.\n"); - } - - switch(codec) { - case FTDM_CODEC_ULAW: - { - dname = "PCMU"; - } - break; - case FTDM_CODEC_ALAW: - { - dname = "PCMA"; - } - break; - case FTDM_CODEC_SLIN: - { - dname = "L16"; - } - break; - default: - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid codec value retrieved from channel, codec value: %d\n", codec); - goto fail; - } - } - - - if (switch_core_codec_init(&tech_pvt->read_codec, - dname, - NULL, - NULL, - 8000, - interval, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); - goto fail; - } else { - if (switch_core_codec_init(&tech_pvt->write_codec, - dname, - NULL, - NULL, - 8000, - interval, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); - switch_core_codec_destroy(&tech_pvt->read_codec); - goto fail; - } - } - - if (switch_core_session_set_read_codec(*new_session, &tech_pvt->read_codec) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set read codec?\n"); - goto fail; - } - - if (switch_core_session_set_write_codec(*new_session, &tech_pvt->write_codec) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set write codec?\n"); - } - - if (switch_core_session_thread_launch(*new_session) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't start session thread.\n"); - goto fail; - } - - switch_channel_mark_answered(channel); - - return SWITCH_CAUSE_SUCCESS; - -fail: - - if (tech_pvt) { - if (tech_pvt->ftdm_channel) { - ftdm_channel_close(&tech_pvt->ftdm_channel); - } - - if (tech_pvt->read_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->read_codec); - } - - if (tech_pvt->write_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->write_codec); - } - } - - if (*new_session) { - switch_core_session_destroy(new_session); - } - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; -} - -static switch_status_t channel_on_init(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - - switch_channel_set_state(channel, CS_CONSUME_MEDIA); - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_destroy(switch_core_session_t *session) -{ - ctdm_private_t *tech_pvt = switch_core_session_get_private(session); - - if ((tech_pvt = switch_core_session_get_private(session))) { - - if (FTDM_SUCCESS != ftdm_channel_command(tech_pvt->ftdm_channel, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to enable echo cancellation.\n"); - } - - if (tech_pvt->read_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->read_codec); - } - - if (tech_pvt->write_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->write_codec); - } - - switch_core_session_unset_read_codec(session); - switch_core_session_unset_write_codec(session); - - ftdm_channel_close(&tech_pvt->ftdm_channel); - } - - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) -{ - ftdm_wait_flag_t wflags = FTDM_READ; - ftdm_status_t status; - ctdm_private_t *tech_pvt; - const char *name; - switch_channel_t *channel; - int chunk; - uint32_t span_id, chan_id; - ftdm_size_t len; - char dtmf[128] = ""; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - name = switch_channel_get_name(channel); - -top: - wflags = FTDM_READ; - chunk = ftdm_channel_get_io_interval(tech_pvt->ftdm_channel) * 2; - status = ftdm_channel_wait(tech_pvt->ftdm_channel, &wflags, chunk); - - - span_id = ftdm_channel_get_span_id(tech_pvt->ftdm_channel); - chan_id = ftdm_channel_get_id(tech_pvt->ftdm_channel); - - if (status == FTDM_FAIL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read from channel %s device %d:%d!\n", name, span_id, chan_id); - goto fail; - } - - if (status == FTDM_TIMEOUT) { - goto top; - } - - if (!(wflags & FTDM_READ)) { - goto top; - } - - len = tech_pvt->read_frame.buflen; - if (ftdm_channel_read(tech_pvt->ftdm_channel, tech_pvt->read_frame.data, &len) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to read from channel %s device %d:%d!\n", name, span_id, chan_id); - } - - *frame = &tech_pvt->read_frame; - tech_pvt->read_frame.datalen = (uint32_t)len; - tech_pvt->read_frame.samples = tech_pvt->read_frame.datalen; - tech_pvt->read_frame.codec = &tech_pvt->read_codec; - - if (ftdm_channel_get_codec(tech_pvt->ftdm_channel) == FTDM_CODEC_SLIN) { - tech_pvt->read_frame.samples /= 2; - } - - while (ftdm_channel_dequeue_dtmf(tech_pvt->ftdm_channel, dtmf, sizeof(dtmf))) { - switch_dtmf_t _dtmf = { 0, switch_core_default_dtmf_duration(0) }; - char *p; - for (p = dtmf; p && *p; p++) { - if (is_dtmf(*p)) { - _dtmf.digit = *p; - ftdm_log(FTDM_LOG_DEBUG, "Queuing DTMF [%c] in channel %s device %d:%d\n", *p, name, span_id, chan_id); - switch_channel_queue_dtmf(channel, &_dtmf); - } - } - } - - return SWITCH_STATUS_SUCCESS; - -fail: - return SWITCH_STATUS_GENERR; -} - -static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) -{ - ftdm_wait_flag_t wflags = FTDM_WRITE; - ctdm_private_t *tech_pvt; - const char *name; - switch_channel_t *channel; - uint32_t span_id, chan_id; - ftdm_size_t len; - unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - span_id = ftdm_channel_get_span_id(tech_pvt->ftdm_channel); - chan_id = ftdm_channel_get_id(tech_pvt->ftdm_channel); - - name = switch_channel_get_name(channel); - - if (switch_test_flag(frame, SFF_CNG)) { - frame->data = data; - frame->buflen = sizeof(data); - if ((frame->datalen = tech_pvt->write_codec.implementation->encoded_bytes_per_packet) > frame->buflen) { - goto fail; - } - memset(data, 255, frame->datalen); - } - - wflags = FTDM_WRITE; - ftdm_channel_wait(tech_pvt->ftdm_channel, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdm_channel) * 10); - - if (!(wflags & FTDM_WRITE)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping frame! (write not ready) in channel %s device %d:%d!\n", name, span_id, chan_id); - return SWITCH_STATUS_SUCCESS; - } - - len = frame->datalen; - if (ftdm_channel_write(tech_pvt->ftdm_channel, frame->data, frame->buflen, &len) != FTDM_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to write to channel %s device %d:%d!\n", name, span_id, chan_id); - } - - return SWITCH_STATUS_SUCCESS; - -fail: - return SWITCH_STATUS_GENERR; -} - -static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) -{ - ctdm_private_t *tech_pvt = NULL; - char tmp[2] = ""; - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - tmp[0] = dtmf->digit; - ftdm_channel_command(tech_pvt->ftdm_channel, FTDM_COMMAND_SEND_DTMF, tmp); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event) -{ - const char *command = switch_event_get_header(event, "command"); - ctdm_private_t *tech_pvt = switch_core_session_get_private(session); - - if (!zstr(command)) { - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeTDM received %s command \n",command); - - if (!strcasecmp(command, kPREBUFFER_LEN)) { - const char *szval = switch_event_get_header(event, kPREBUFFER_LEN); - int val = !zstr(szval) ? atoi(szval) : 0; - - if (tech_pvt->prebuffer_len == val) { - tech_pvt->prebuffer_len = val; - if (FTDM_SUCCESS != ftdm_channel_command(tech_pvt->ftdm_channel, FTDM_COMMAND_SET_PRE_BUFFER_SIZE, &tech_pvt->prebuffer_len)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set channel pre buffer size.\n"); - return SWITCH_STATUS_GENERR; - } - } - } else if (!strcasecmp(command, kECHOCANCEL)) { - const char *szval = switch_event_get_header(event, kECHOCANCEL); - int enabled = !!switch_true(szval); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeTDM sending echo cancel [%s] command \n",enabled ? "enable" : "disable"); - - if (FTDM_SUCCESS != ftdm_channel_command(tech_pvt->ftdm_channel, enabled ? FTDM_COMMAND_ENABLE_ECHOCANCEL : FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to %s echo cancellation.\n", enabled ? "enable" : "disable"); - } - - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeTDM received unknown command [%s] \n",command); - } - } - - return SWITCH_STATUS_SUCCESS; -} - diff --git a/libs/freetdm/msvc/freetdm.2008.vcproj b/libs/freetdm/msvc/freetdm.2008.vcproj deleted file mode 100644 index 46594bf38c..0000000000 --- a/libs/freetdm/msvc/freetdm.2008.vcproj +++ /dev/null @@ -1,499 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/msvc/freetdm.2010.vcxproj.filters b/libs/freetdm/msvc/freetdm.2010.vcxproj.filters deleted file mode 100644 index 9f15c9c737..0000000000 --- a/libs/freetdm/msvc/freetdm.2010.vcxproj.filters +++ /dev/null @@ -1,137 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - diff --git a/libs/freetdm/msvc/openzap.2005.vcproj b/libs/freetdm/msvc/openzap.2005.vcproj deleted file mode 100644 index 85d4a89206..0000000000 --- a/libs/freetdm/msvc/openzap.2005.vcproj +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/msvc/testanalog/testanalog.2005.vcproj b/libs/freetdm/msvc/testanalog/testanalog.2005.vcproj deleted file mode 100644 index 93553d2a5f..0000000000 --- a/libs/freetdm/msvc/testanalog/testanalog.2005.vcproj +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/msvc/testanalog/testanalog.2008.vcproj b/libs/freetdm/msvc/testanalog/testanalog.2008.vcproj deleted file mode 100644 index 24f418ab19..0000000000 --- a/libs/freetdm/msvc/testanalog/testanalog.2008.vcproj +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj.filters b/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj.filters deleted file mode 100644 index 7ac3635cc5..0000000000 --- a/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/freetdm/msvc/testboost/testboost.2008.vcproj b/libs/freetdm/msvc/testboost/testboost.2008.vcproj deleted file mode 100644 index c273b3c02b..0000000000 --- a/libs/freetdm/msvc/testboost/testboost.2008.vcproj +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/msvc/testboost/testboost.2010.vcxproj.filters b/libs/freetdm/msvc/testboost/testboost.2010.vcxproj.filters deleted file mode 100644 index 74181d60a8..0000000000 --- a/libs/freetdm/msvc/testboost/testboost.2010.vcxproj.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj b/libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj deleted file mode 100644 index 77ca1594df..0000000000 --- a/libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj.filters b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj.filters deleted file mode 100644 index e72f14e161..0000000000 --- a/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/freetdm/msvc/testisdn/testisdn.2005.vcproj b/libs/freetdm/msvc/testisdn/testisdn.2005.vcproj deleted file mode 100644 index 133557166b..0000000000 --- a/libs/freetdm/msvc/testisdn/testisdn.2005.vcproj +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/msvc/testisdn/testisdn.2008.vcproj b/libs/freetdm/msvc/testisdn/testisdn.2008.vcproj deleted file mode 100644 index 86698ec3e4..0000000000 --- a/libs/freetdm/msvc/testisdn/testisdn.2008.vcproj +++ /dev/null @@ -1,349 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj.filters b/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj.filters deleted file mode 100644 index 9d48828d4a..0000000000 --- a/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/freetdm/sample/CMakeLists.txt b/libs/freetdm/sample/CMakeLists.txt deleted file mode 100644 index 9baf1bdf16..0000000000 --- a/libs/freetdm/sample/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# Arnaldo M Pereira -# -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(sample) - -#ADD_SUBDIRECTORY(sched) FIXME: this code doesnt compile diff --git a/libs/freetdm/sample/dso/CMakeLists.txt b/libs/freetdm/sample/dso/CMakeLists.txt deleted file mode 100644 index defcc5c7f5..0000000000 --- a/libs/freetdm/sample/dso/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# -# Arnaldo M Pereira -# -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(dso) - -IF(NOT DEFINED WIN32) - INCLUDE_DIRECTORIES(/usr/local/freeswitch/include) - ADD_DEFINITIONS(-Wall) - ADD_EXECUTABLE(ftdmload ftdmload.c) - TARGET_LINK_LIBRARIES(ftdmload freetdm) -ENDIF(NOT DEFINED WIN32) diff --git a/libs/freetdm/sample/dso/Makefile b/libs/freetdm/sample/dso/Makefile deleted file mode 100644 index 51067191d2..0000000000 --- a/libs/freetdm/sample/dso/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CC=gcc -CFLAGS=-Wall -I/usr/local/freeswitch/include -LDFLAGS=-L/usr/local/freeswitch/lib -lfreetdm - -ftdmload: ftdmload.o - -clean: - rm -rf ftdmload.o - rm -rf ftdmload - -export: - export LD_LIBRARY_PATH=/usr/local/freeswitch/lib - - diff --git a/libs/freetdm/sample/dso/ftdmload.c b/libs/freetdm/sample/dso/ftdmload.c deleted file mode 100644 index 80bcc02fc0..0000000000 --- a/libs/freetdm/sample/dso/ftdmload.c +++ /dev/null @@ -1,168 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include - -#define ARRLEN(obj) (sizeof(obj)/sizeof(obj[0])) - -struct dso_entry { - char name[25]; - ftdm_dso_lib_t lib; -}; - -struct dso_entry loaded[10]; - -static void *(*real_dlopen)(const char *filename, int flag) = NULL; -static int (*real_dlclose)(void *handle) = NULL; - -static void print_stack() -{ - void *stacktrace[100]; - char **symbols; - int size; - int i; - size = backtrace(stacktrace, ARRLEN(stacktrace)); - symbols = backtrace_symbols(stacktrace, size); - if (!symbols) { - return; - } - for (i = 0; i < size; i++) { - ftdm_log(FTDM_LOG_DEBUG, "%s\n", symbols[i]); - } - free(symbols); -} - -void *dlopen(const char *filename, int flag) -{ - char *msg = NULL; - void *handle = NULL; - print_stack(); - if (real_dlopen == NULL) { - dlerror(); - real_dlopen = dlsym(RTLD_NEXT, "dlopen"); - if ((msg = dlerror()) != NULL) { - fprintf(stderr, "dlsym failed: %s\n", msg); - exit(1); - } - fprintf(stderr, "Real dlopen at addr %p\n", real_dlopen); - } - handle = real_dlopen(filename, flag); - if (!handle) { - return NULL; - } - ftdm_log(FTDM_LOG_NOTICE, "Loaded %s with handle %p\n", filename, handle); - return handle; -} - -int dlclose(void *handle) -{ - char *msg = NULL; - print_stack(); - if (real_dlclose == NULL) { - dlerror(); - real_dlclose = dlsym(RTLD_NEXT, "dlclose"); - if ((msg = dlerror()) != NULL) { - fprintf(stderr, "dlsym failed: %s\n", msg); - exit(1); - } - fprintf(stderr, "Real dlclose at addr %p\n", real_dlclose); - } - ftdm_log(FTDM_LOG_NOTICE, "Unloading %p\n", handle); - return real_dlclose(handle); -} - -int load(char *name) -{ - char path[255]; - char *err; - struct dso_entry *entry = NULL; - int i; - - for (i = 0; i < ARRLEN(loaded); i++) { - if (!loaded[i].lib) { - entry = &loaded[i]; - break; - } - } - - if (!entry) { - ftdm_log(FTDM_LOG_CRIT, "Cannot load more libraries\n"); - return -1; - } - - ftdm_build_dso_path(name, path, sizeof(path)); - ftdm_log(FTDM_LOG_DEBUG, "Loading %s!\n", path); - entry->lib = ftdm_dso_open(path, &err); - if (!entry->lib) { - ftdm_log(FTDM_LOG_CRIT, "Cannot load library '%s': %s\n", path, err); - return -1; - } - strncpy(entry->name, name, sizeof(entry->name)-1); - entry->name[sizeof(entry->name)-1] = 0; - return 0; -} - -int unload(char *name) -{ - int i; - struct dso_entry *entry = NULL; - ftdm_log(FTDM_LOG_DEBUG, "Unloading %s!\n", name); - for (i = 0; i < ARRLEN(loaded); i++) { - if (loaded[i].lib && !strcasecmp(loaded[i].name, name)) { - entry = &loaded[i]; - break; - } - } - - if (!entry) { - ftdm_log(FTDM_LOG_CRIT, "Library %s not found\n", name); - return -1; - } - - ftdm_dso_destroy(&entry->lib); - entry->lib = NULL; - return 0; -} - -int main(int argc, char *argv[]) -{ - char cmdline[255]; - char name[255]; - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - - if (ftdm_global_init() != FTDM_SUCCESS) { - fprintf(stderr, "Error loading FreeTDM\n"); - exit(-1); - } - - memset(loaded, 0, sizeof(loaded)); - - printf("CLI> "); - while (fgets(cmdline, sizeof(cmdline), stdin)) { - if (sscanf(cmdline, "load=%s\n", name) == 1) { - load(name); - } else if (sscanf(cmdline, "unload=%s\n", name) == 1) { - unload(name); - } else if (!strncasecmp(cmdline, "exit", sizeof("exit")-1)) { - printf("Quitting ...\n"); - sleep(1); - break; - } else { - fprintf(stderr, "load= | unload= | exit\n"); - } - printf("\nCLI> "); - } - - - ftdm_global_destroy(); - - printf("Done, press any key to die!\n"); - - getchar(); - return 0; -} - diff --git a/libs/freetdm/sample/sched/CMakeLists.txt b/libs/freetdm/sample/sched/CMakeLists.txt deleted file mode 100644 index d769925be0..0000000000 --- a/libs/freetdm/sample/sched/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# -# Arnaldo M Pereira -# -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(sched) - -IF(NOT DEFINED WIN32) - INCLUDE_DIRECTORIES(/usr/local/freeswitch/include) - ADD_DEFINITIONS(-Wall) - ADD_EXECUTABLE(ftdmsched ftdmsched.c) - TARGET_LINK_LIBRARIES(ftdmsched freetdm) -ENDIF(NOT DEFINED WIN32) diff --git a/libs/freetdm/sample/sched/ftdmsched.c b/libs/freetdm/sample/sched/ftdmsched.c deleted file mode 100644 index e6e391ee4b..0000000000 --- a/libs/freetdm/sample/sched/ftdmsched.c +++ /dev/null @@ -1,110 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include -#include "../../src/include/private/ftdm_core.h" - -static int running = 1; - -typedef struct custom_data { - ftdm_timer_t *heartbeat_timer; - int beat; - int counter; - ftdm_sched_callback_t callback; - ftdm_sched_t *sched; -} custom_data_t; - -void trap(int signal) -{ - running = 0; -} - -void handle_heartbeat(void *usrdata) -{ - ftdm_status_t status; - custom_data_t *data = usrdata; - - printf("beep (elapsed %dms count= %d)\n", data->beat, data->counter); - if (data->beat > 1000) { - data->beat -= 1000; - } else if (data->beat <= 1000 && data->beat > 200) { - data->beat -= 100; - } else if (data->beat <= 200 && data->beat > 100) { - if (!data->counter--) { - data->counter = 5; - data->beat -= 100; - } - } else if (data->beat <= 100 && data->beat > 10) { - if (!data->counter--) { - data->counter = 10; - data->beat -= 10; - if (data->beat == 10) { - data->counter = 200; - } - } - } else { - if (!data->counter--) { - data->counter = 5; - data->beat--; - } - } - - if (!data->beat) { - printf("beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep you're dead!\n"); - return; - } - - data->heartbeat_timer = NULL; - status = ftdm_sched_timer(data->sched, "heartbeat", data->beat, data->callback, data, &data->heartbeat_timer); - if (status != FTDM_SUCCESS) { - fprintf(stderr, "Error creating heartbeat timer\n"); - running = 0; - return; - } -} - -int main(int argc, char *argv[]) -{ - ftdm_status_t status; - custom_data_t data; - - ftdm_sched_t *sched; - signal(SIGINT, trap); - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - - if (ftdm_global_init() != FTDM_SUCCESS) { - fprintf(stderr, "Error loading FreeTDM\n"); - exit(-1); - } - - status = ftdm_sched_create(&sched, "testsched"); - if (status != FTDM_SUCCESS) { - fprintf(stderr, "Error creating sched\n"); - exit(-1); - } - - data.sched = sched; - data.counter = 10; - data.beat = 5000; - data.callback = handle_heartbeat; - status = ftdm_sched_timer(sched, "heartbeat", data.beat, data.callback, &data, &data.heartbeat_timer); - if (status != FTDM_SUCCESS) { - fprintf(stderr, "Error creating heartbeat timer\n"); - exit(-1); - } - - ftdm_sched_free_run(sched); - - while (running) { - ftdm_sleep(10); - } - - ftdm_global_destroy(); - - printf("Done, press any key to die!\n"); - - getchar(); - return 0; -} - diff --git a/libs/freetdm/src/detect_dtmf.c b/libs/freetdm/src/detect_dtmf.c deleted file mode 100644 index 34335256f0..0000000000 --- a/libs/freetdm/src/detect_dtmf.c +++ /dev/null @@ -1,54 +0,0 @@ -//#include "freetdm.h" -#include "libteletone_detect.h" - -int main(int argc, char *argv[]) -{ - int fd, b; - short sln[512] = {0}; - teletone_dtmf_detect_state_t dtmf_detect = {0}; - teletone_hit_type_t hit; - - if (argc < 2) { - fprintf(stderr, "Arg Error!\n"); - exit(-1); - } - - teletone_dtmf_detect_init (&dtmf_detect, 8000); - - if ((fd = open(argv[1], O_RDONLY)) < 0) { - fprintf(stderr, "File Error! [%s]\n", strerror(errno)); - exit(-1); - } - - while((b = read(fd, sln, 320)) > 0) { - char digit_char; - unsigned int dur; - - teletone_dtmf_detect(&dtmf_detect, sln, b / 2); - if ((hit = teletone_dtmf_get(&dtmf_detect, &digit_char, &dur))) { - const char *hs = NULL; - - - switch(hit) { - case TT_HIT_BEGIN: - hs = "begin"; - break; - - case TT_HIT_MIDDLE: - hs = "middle"; - break; - - case TT_HIT_END: - hs = "end"; - break; - default: - break; - } - - printf("%s digit: %c\n", hs, digit_char); - } - } - close(fd); - return 0; -} - diff --git a/libs/freetdm/src/detect_tones.c b/libs/freetdm/src/detect_tones.c deleted file mode 100644 index 5cd52d4d99..0000000000 --- a/libs/freetdm/src/detect_tones.c +++ /dev/null @@ -1,32 +0,0 @@ -//#include "freetdm.h" -#include "libteletone_detect.h" - -int main(int argc, char *argv[]) -{ - teletone_multi_tone_t mt = {0}; - teletone_tone_map_t map = {{0}}; - - int fd, b; - short sln[512] = {0}; - - if (argc < 2) { - fprintf(stderr, "Arg Error!\n"); - exit(-1); - } - - map.freqs[0] = atof("350"); - map.freqs[1] = atof("440"); - teletone_multi_tone_init(&mt, &map); - - if ((fd = open(argv[1], O_RDONLY)) < 0) { - fprintf(stderr, "File Error! [%s]\n", strerror(errno)); - exit(-1); - } - - while((b = read(fd, sln, 320)) > 0) { - printf("TEST %d %d\n", b, teletone_multi_tone_detect(&mt, sln, b / 2)); - } - close(fd); - return 0; -} - diff --git a/libs/freetdm/src/fsk.c b/libs/freetdm/src/fsk.c deleted file mode 100644 index 9e6f97287e..0000000000 --- a/libs/freetdm/src/fsk.c +++ /dev/null @@ -1,351 +0,0 @@ - -/* - * bell202.c - * - * Copyright (c) 2005 Robert Krten. 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 THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. - * - * This module contains a Bell-202 1200-baud FSK decoder, suitable for - * use in a library. The general style of the library calls is modeled - * after the POSIX pthread_*() functions. - * - * 2005 03 20 R. Krten created -*/ -#include -#include -#include -#include -#include -#include - -#include "fsk.h" -#include "uart.h" - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -fsk_modem_definition_t fsk_modem_definitions[] = -{ - { /* FSK_V23_FORWARD_MODE1 */ 1700, 1300, 600 }, - { /* FSK_V23_FORWARD_MODE2 */ 2100, 1300, 1200 }, - { /* FSK_V23_BACKWARD */ 450, 390, 75 }, - { /* FSK_BELL202 */ 2200, 1200, 1200 }, -}; - -/* - * dsp_fsk_attr_init - * - * Initializes the attributes structure; this must be done before the - * attributes structure is used. -*/ - -void dsp_fsk_attr_init (dsp_fsk_attr_t *attr) -{ - memset(attr, 0, sizeof(*attr)); -} - -/* - * dsp_fsk_attr_get_bithandler - * dsp_fsk_attr_set_bithandler - * dsp_fsk_attr_get_bytehandler - * dsp_fsk_attr_set_bytehandler - * dsp_fsk_attr_getsamplerate - * dsp_fsk_attr_setsamplerate - * - * These functions get and set their respective elements from the - * attributes structure. If an error code is returned, it is just - * zero == ok, -1 == fail. -*/ - -bithandler_func_t dsp_fsk_attr_get_bithandler(dsp_fsk_attr_t *attr, void **bithandler_arg) -{ - *bithandler_arg = attr->bithandler_arg; - return attr->bithandler; -} - -void dsp_fsk_attr_set_bithandler(dsp_fsk_attr_t *attr, bithandler_func_t bithandler, void *bithandler_arg) -{ - attr->bithandler = bithandler; - attr->bithandler_arg = bithandler_arg; -} - -bytehandler_func_t dsp_fsk_attr_get_bytehandler(dsp_fsk_attr_t *attr, void **bytehandler_arg) -{ - *bytehandler_arg = attr->bytehandler_arg; - return attr->bytehandler; -} - -void dsp_fsk_attr_set_bytehandler(dsp_fsk_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg) -{ - attr->bytehandler = bytehandler; - attr->bytehandler_arg = bytehandler_arg; -} - -int dsp_fsk_attr_get_samplerate (dsp_fsk_attr_t *attr) -{ - return attr->sample_rate; -} - -int dsp_fsk_attr_set_samplerate (dsp_fsk_attr_t *attr, int samplerate) -{ - if (samplerate <= 0) { - return -1; - } - attr->sample_rate = samplerate; - return 0; -} - -/* - * dsp_fsk_create - * - * Creates a handle for subsequent use. The handle is created to contain - * a context data structure for use by the sample handler function. The - * function expects an initialized attributes structure, and returns the - * handle or a NULL if there were errors. - * - * Once created, the handle can be used until it is destroyed. -*/ - -dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr) -{ - int i; - double phi_mark, phi_space; - dsp_fsk_handle_t *handle; - - handle = ftdm_malloc(sizeof(*handle)); - if (!handle) { - return NULL; - } - - memset(handle, 0, sizeof(*handle)); - - /* fill the attributes member */ - memcpy(&handle->attr, attr, sizeof(*attr)); - - /* see if we can do downsampling. We only really need 6 samples to "match" */ - if (attr->sample_rate / fsk_modem_definitions[FSK_BELL202].freq_mark > 6) { - handle->downsampling_count = attr->sample_rate / fsk_modem_definitions[FSK_BELL202].freq_mark / 6; - } else { - handle->downsampling_count = 1; - } - handle->current_downsample = 1; - - /* calculate the correlate size (number of samples required for slowest wave) */ - handle->corrsize = attr->sample_rate / handle->downsampling_count / fsk_modem_definitions[FSK_BELL202].freq_mark; - - /* allocate the correlation sin/cos arrays and initialize */ - for (i = 0; i < 4; i++) { - handle->correlates[i] = ftdm_malloc(sizeof(double) * handle->corrsize); - if (handle->correlates[i] == NULL) { - /* some failed, back out memory allocations */ - dsp_fsk_destroy(&handle); - return NULL; - } - } - - /* now initialize them */ - phi_mark = 2. * M_PI / ((double) attr->sample_rate / (double) handle->downsampling_count / (double) fsk_modem_definitions[FSK_BELL202].freq_mark); - phi_space = 2. * M_PI / ((double) attr->sample_rate / (double) handle->downsampling_count / (double) fsk_modem_definitions[FSK_BELL202].freq_space); - - for (i = 0; i < handle->corrsize; i++) { - handle->correlates[0][i] = sin(phi_mark * (double) i); - handle->correlates[1][i] = cos(phi_mark * (double) i); - handle->correlates[2][i] = sin(phi_space * (double) i); - handle->correlates[3][i] = cos(phi_space * (double) i); - } - - /* initialize the ring buffer */ - handle->buffer = ftdm_malloc(sizeof(double) * handle->corrsize); - if (!handle->buffer) { /* failed; back out memory allocations */ - dsp_fsk_destroy(&handle); - return NULL; - } - memset(handle->buffer, 0, sizeof(double) * handle->corrsize); - handle->ringstart = 0; - - /* initalize intra-cell position */ - handle->cellpos = 0; - handle->celladj = fsk_modem_definitions[FSK_BELL202].baud_rate / (double) attr->sample_rate * (double) handle->downsampling_count; - - /* if they have provided a byte handler, add a UART to the processing chain */ - if (handle->attr.bytehandler) { - dsp_uart_attr_t uart_attr; - dsp_uart_handle_t *uart_handle; - - dsp_uart_attr_init(&uart_attr); - dsp_uart_attr_set_bytehandler(&uart_attr, handle->attr.bytehandler, handle->attr.bytehandler_arg); - uart_handle = dsp_uart_create(&uart_attr); - if (uart_handle == NULL) { - dsp_fsk_destroy(&handle); - return NULL; - } - handle->attr.bithandler = dsp_uart_bit_handler; - handle->attr.bithandler_arg = uart_handle; - } - - return handle; -} - -/* - * dsp_fsk_destroy - * - * Destroys a handle, releasing any associated memory. Sets handle pointer to NULL - * so A destroyed handle can not be used for anything after the destroy. -*/ - -void dsp_fsk_destroy(dsp_fsk_handle_t **handle) -{ - int i; - - /* if empty handle, just return */ - if (*handle == NULL) { - return; - } - - for (i = 0; i < 4; i++) { - if ((*handle)->correlates[i] != NULL) { - ftdm_safe_free((*handle)->correlates[i]); - (*handle)->correlates[i] = NULL; - } - } - - if ((*handle)->buffer != NULL) { - ftdm_safe_free((*handle)->buffer); - (*handle)->buffer = NULL; - } - - if ((*handle)->attr.bytehandler) { - dsp_uart_handle_t** dhandle = (void *)(&(*handle)->attr.bithandler_arg); - dsp_uart_destroy(dhandle); - } - - ftdm_safe_free(*handle); - *handle = NULL; -} - -/* - * dsp_fsk_sample - * - * This is the main processing entry point. The function accepts a normalized - * sample (i.e., one whose range is between -1 and +1). The function performs - * the Bell-202 FSK modem decode processing, and, if it detects a valid bit, - * will call the bithandler associated with the attributes structure. - * - * For the Bell-202 standard, a logical zero (space) is 2200 Hz, and a logical - * one (mark) is 1200 Hz. -*/ - -void -dsp_fsk_sample (dsp_fsk_handle_t *handle, double normalized_sample) -{ - double val; - double factors[4]; - int i, j; - - /* if we can avoid processing samples, do so */ - if (handle->downsampling_count != 1) { - if (handle->current_downsample < handle->downsampling_count) { - handle->current_downsample++; - return; /* throw this sample out */ - } - handle->current_downsample = 1; - } - - /* store sample in buffer */ - handle->buffer[handle->ringstart++] = normalized_sample; - if (handle->ringstart >= handle->corrsize) { - handle->ringstart = 0; - } - - /* do the correlation calculation */ - factors[0] = factors[1] = factors[2] = factors[3] = 0; /* clear out intermediate sums */ - j = handle->ringstart; - for (i = 0; i < handle->corrsize; i++) { - if (j >= handle->corrsize) { - j = 0; - } - val = handle->buffer[j]; - factors[0] += handle->correlates[0][i] * val; - factors[1] += handle->correlates[1][i] * val; - factors[2] += handle->correlates[2][i] * val; - factors[3] += handle->correlates[3][i] * val; - j++; - } - - /* store the bit (bit value is comparison of the two sets of correlate factors) */ - handle->previous_bit = handle->current_bit; - handle->current_bit = (factors[0] * factors[0] + factors[1] * factors[1] > factors[2] * factors[2] + factors[3] * factors[3]); - - /* if there's a transition, we can synchronize the cell position */ - if (handle->previous_bit != handle->current_bit) { - handle->cellpos = 0.5; /* adjust cell position to be in the middle of the cell */ - } - handle->cellpos += handle->celladj; /* walk the cell along */ - - if (handle->cellpos > 1.0) { - handle->cellpos -= 1.0; - - switch (handle->state) { - case FSK_STATE_DATA: - { - - (*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit); - } - break; - case FSK_STATE_CHANSEIZE: - { - - if (handle->last_bit != handle->current_bit) { - handle->conscutive_state_bits++; - } else { - handle->conscutive_state_bits = 0; - } - - if (handle->conscutive_state_bits > 15) { - handle->state = FSK_STATE_CARRIERSIG; - handle->conscutive_state_bits = 0; - } - } - break; - case FSK_STATE_CARRIERSIG: - { - if (handle->current_bit) { - handle->conscutive_state_bits++; - } else { - handle->conscutive_state_bits = 0; - } - - if (handle->conscutive_state_bits > 15) { - handle->state = FSK_STATE_DATA; - handle->conscutive_state_bits = 0; - } - } - break; - } - - handle->last_bit = handle->current_bit; - } -} - diff --git a/libs/freetdm/src/ftdm_backtrace.c b/libs/freetdm/src/ftdm_backtrace.c deleted file mode 100644 index 8f6756d939..0000000000 --- a/libs/freetdm/src/ftdm_backtrace.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * - */ -#ifndef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE -#endif -#define _BSD_SOURCE -#include "private/ftdm_core.h" - -#if defined(HAVE_EXECINFO_H) && !defined(__FreeBSD__) -#include -#include -#include -#include - -#define FTDM_BACKTRACE_MAX 50 - -FT_DECLARE(ftdm_status_t) ftdm_backtrace_walk(void (* callback)(const int tid, const void *addr, const char *symbol, void *priv), void *priv) -{ - void *stacktrace[FTDM_BACKTRACE_MAX]; - char **symbols = NULL; - size_t size = 0; - pid_t tid = 0; - int si = 0; - - if (!callback) { - return FTDM_EINVAL; - } - - tid = syscall(SYS_gettid); - - size = backtrace(stacktrace, ftdm_array_len(stacktrace)); - symbols = backtrace_symbols(stacktrace, size); - - for (si = 0; si < size; si++) { - callback(tid, stacktrace[si], symbols[si], priv); - } - - free(symbols); - return FTDM_SUCCESS; -} - -#else /* !HAVE_EXECINFO_H */ - -FT_DECLARE(ftdm_status_t) ftdm_backtrace_walk(void (* callback)(const int tid, const void *addr, const char *symbol, void *priv), void *priv) -{ - ftdm_log(FTDM_LOG_DEBUG, "Stack traces are not available on this platform!\n"); - return FTDM_NOTIMPL; -} - -#endif - - -static void span_backtrace(const int tid, const void *addr, const char *symbol, void *priv) -{ - ftdm_span_t *span = priv; - ftdm_log(FTDM_LOG_DEBUG, "[%d][tid:%d] %p -> %s\n", - ftdm_span_get_id(span), tid, addr, symbol); -} - -FT_DECLARE(ftdm_status_t) ftdm_backtrace_span(ftdm_span_t *span) -{ - return ftdm_backtrace_walk(&span_backtrace, span); -} - - -static void chan_backtrace(const int tid, const void *addr, const char *symbol, void *priv) -{ - ftdm_channel_t *chan = priv; - ftdm_log(FTDM_LOG_DEBUG, "[%d:%d][tid:%d] %p -> %s\n", - ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan), tid, addr, symbol); -} - -FT_DECLARE(ftdm_status_t) ftdm_backtrace_chan(ftdm_channel_t *chan) -{ - return ftdm_backtrace_walk(&chan_backtrace, chan); -} diff --git a/libs/freetdm/src/ftdm_buffer.c b/libs/freetdm/src/ftdm_buffer.c deleted file mode 100644 index 42d5fbaec6..0000000000 --- a/libs/freetdm/src/ftdm_buffer.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "private/ftdm_core.h" -#include "ftdm_buffer.h" - -static unsigned buffer_id = 0; - -struct ftdm_buffer { - unsigned char *data; - unsigned char *head; - ftdm_size_t used; - ftdm_size_t actually_used; - ftdm_size_t datalen; - ftdm_size_t max_len; - ftdm_size_t blocksize; - unsigned id; - int loops; -}; - - -FT_DECLARE(ftdm_status_t) ftdm_buffer_create(ftdm_buffer_t **buffer, ftdm_size_t blocksize, ftdm_size_t start_len, ftdm_size_t max_len) -{ - ftdm_buffer_t *new_buffer; - - new_buffer = ftdm_malloc(sizeof(*new_buffer)); - if (new_buffer) { - memset(new_buffer, 0, sizeof(*new_buffer)); - - if (!start_len) { - start_len = 250; - } - - if (!blocksize) { - blocksize = start_len; - } - - new_buffer->data = ftdm_malloc(start_len); - if (!new_buffer->data) { - ftdm_safe_free(new_buffer); - return FTDM_MEMERR; - } - memset(new_buffer->data, 0, start_len); - - new_buffer->max_len = max_len; - new_buffer->datalen = start_len; - new_buffer->id = buffer_id++; - new_buffer->blocksize = blocksize; - new_buffer->head = new_buffer->data; - - *buffer = new_buffer; - return FTDM_SUCCESS; - } - - return FTDM_MEMERR; -} - -FT_DECLARE(ftdm_size_t) ftdm_buffer_len(ftdm_buffer_t *buffer) -{ - - assert(buffer != NULL); - - return buffer->datalen; - -} - - -FT_DECLARE(ftdm_size_t) ftdm_buffer_freespace(ftdm_buffer_t *buffer) -{ - assert(buffer != NULL); - - - if (buffer->max_len) { - return (ftdm_size_t) (buffer->max_len - buffer->used); - } - return 1000000; - -} - -FT_DECLARE(ftdm_size_t) ftdm_buffer_inuse(ftdm_buffer_t *buffer) -{ - assert(buffer != NULL); - - return buffer->used; -} - -FT_DECLARE(ftdm_size_t) ftdm_buffer_seek(ftdm_buffer_t *buffer, ftdm_size_t datalen) -{ - ftdm_size_t reading = 0; - - assert(buffer != NULL); - - if (buffer->used < 1) { - buffer->used = 0; - return 0; - } else if (buffer->used >= datalen) { - reading = datalen; - } else { - reading = buffer->used; - } - - buffer->used = buffer->actually_used - reading; - buffer->head = buffer->data + reading; - - return reading; -} - -FT_DECLARE(ftdm_size_t) ftdm_buffer_toss(ftdm_buffer_t *buffer, ftdm_size_t datalen) -{ - ftdm_size_t reading = 0; - - assert(buffer != NULL); - - if (buffer->used < 1) { - buffer->used = 0; - return 0; - } else if (buffer->used >= datalen) { - reading = datalen; - } else { - reading = buffer->used; - } - - buffer->used -= reading; - buffer->head += reading; - - return buffer->used; -} - -FT_DECLARE(void) ftdm_buffer_set_loops(ftdm_buffer_t *buffer, int loops) -{ - buffer->loops = loops; -} - -FT_DECLARE(ftdm_size_t) ftdm_buffer_read_loop(ftdm_buffer_t *buffer, void *data, ftdm_size_t datalen) -{ - ftdm_size_t len; - if ((len = ftdm_buffer_read(buffer, data, datalen)) < datalen) { - if (buffer->loops == 0) { - return len; - } - buffer->head = buffer->data; - buffer->used = buffer->actually_used; - len = ftdm_buffer_read(buffer, (char*)data + len, datalen - len); - buffer->loops--; - } - return len; -} - -FT_DECLARE(ftdm_size_t) ftdm_buffer_read(ftdm_buffer_t *buffer, void *data, ftdm_size_t datalen) -{ - ftdm_size_t reading = 0; - - assert(buffer != NULL); - assert(data != NULL); - - - if (buffer->used < 1) { - buffer->used = 0; - return 0; - } else if (buffer->used >= datalen) { - reading = datalen; - } else { - reading = buffer->used; - } - - memcpy(data, buffer->head, reading); - buffer->used -= reading; - buffer->head += reading; - - /* if (buffer->id == 4) printf("%u o %d = %d\n", buffer->id, (unsigned)reading, (unsigned)buffer->used); */ - return reading; -} - -FT_DECLARE(ftdm_size_t) ftdm_buffer_write(ftdm_buffer_t *buffer, const void *data, ftdm_size_t datalen) -{ - ftdm_size_t freespace, actual_freespace; - - assert(buffer != NULL); - assert(data != NULL); - assert(buffer->data != NULL); - - if (!datalen) { - return buffer->used; - } - - actual_freespace = buffer->datalen - buffer->actually_used; - if (actual_freespace < datalen && (!buffer->max_len || (buffer->used + datalen <= buffer->max_len))) { - memmove(buffer->data, buffer->head, buffer->used); - buffer->head = buffer->data; - buffer->actually_used = buffer->used; - } - - freespace = buffer->datalen - buffer->used; - - /* - if (buffer->data != buffer->head) { - memmove(buffer->data, buffer->head, buffer->used); - buffer->head = buffer->data; - } - */ - - if (freespace < datalen) { - ftdm_size_t new_size, new_block_size; - void *data; - - new_size = buffer->datalen + datalen; - new_block_size = buffer->datalen + buffer->blocksize; - - if (new_block_size > new_size) { - new_size = new_block_size; - } - buffer->head = buffer->data; - data = realloc(buffer->data, new_size); - if (!data) { - return 0; - } - buffer->data = data; - buffer->head = buffer->data; - buffer->datalen = new_size; - } - - - freespace = buffer->datalen - buffer->used; - - if (freespace < datalen) { - return 0; - } else { - memcpy(buffer->head + buffer->used, data, datalen); - buffer->used += datalen; - buffer->actually_used += datalen; - } - /* if (buffer->id == 4) printf("%u i %d = %d\n", buffer->id, (unsigned)datalen, (unsigned)buffer->used); */ - - return buffer->used; -} - -FT_DECLARE(void) ftdm_buffer_zero(ftdm_buffer_t *buffer) -{ - assert(buffer != NULL); - assert(buffer->data != NULL); - - buffer->used = 0; - buffer->actually_used = 0; - buffer->head = buffer->data; -} - -FT_DECLARE(ftdm_size_t) ftdm_buffer_zwrite(ftdm_buffer_t *buffer, const void *data, ftdm_size_t datalen) -{ - ftdm_size_t w; - - if (!(w = ftdm_buffer_write(buffer, data, datalen))) { - ftdm_buffer_zero(buffer); - return ftdm_buffer_write(buffer, data, datalen); - } - - return w; -} - -FT_DECLARE(void) ftdm_buffer_destroy(ftdm_buffer_t **buffer) -{ - if (*buffer) { - ftdm_safe_free((*buffer)->data); - ftdm_safe_free(*buffer); - } - - *buffer = NULL; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c deleted file mode 100644 index d23c95af4e..0000000000 --- a/libs/freetdm/src/ftdm_call_utils.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * Ricardo Barroetaveña - * - */ - -#include "private/ftdm_core.h" -#include - - - - -FT_DECLARE(char *) ftdm_url_encode(const char *url, char *buf, ftdm_size_t len) -{ - /* This implementation of url_encode is slightly different compared to the - * Freeswitch one. This is because this implementation accepts the full - * range of values (0x00 - 0xFF) compared to the Freeswitch implementation - * that does not accept 0x00 */ - - const char *p; - size_t x = 0,y = 0; - const char urlunsafe[] = "\r\n \"#%&+:;<=>?@[\\]^`{|}"; - const char hex[] = "0123456789ABCDEF"; - - if (!buf) { - return 0; - } - - if (!url) { - return 0; - } - - len--; - - for (p = url; y <= len; p++) { - if (*p < ' ' || *p > '~' || strchr(urlunsafe, *p)) { - buf[x++] = '%'; - buf[x++] = hex[(*p >> 4) & 0x0f]; - buf[x++] = hex[*p & 0x0f]; - } else { - buf[x++] = *p; - } - y++; - } - buf[x] = '\0'; - return buf; -} - - -FT_DECLARE(char *) ftdm_url_decode(char *s, ftdm_size_t *len) -{ - /* This implementation of url_decode is slightly different compared to the - * Freeswitch one. This is because this implementation accepts the full - * range of values (0x00 - 0xFF) compared to the Freeswitch implementation - * that does not accept 0x00 */ - - char *o; - unsigned int tmp; - ftdm_size_t mylen = 0; - - if (ftdm_strlen_zero(s)) { - return s; - } - - for (o = s; *s; s++, o++) { - if (*s == '%' && strlen(s) > 2 && sscanf(s + 1, "%2x", &tmp) == 1) { - *o = (char) tmp; - s += 2; - } else { - *o = *s; - } - mylen++; - } - *o = '\0'; - *len = mylen; - return s; -} - -FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) -{ - uint8_t val; - ftdm_status_t status = FTDM_SUCCESS; - - val = ftdm_str2ftdm_npi(string); - if (val == FTDM_NPI_INVALID) { - ftdm_log(FTDM_LOG_WARNING, "Invalid NPI string (%s)\n", string); - status = FTDM_FAIL; - val = FTDM_NPI_UNKNOWN; - } - *target = val; - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) -{ - uint8_t val; - ftdm_status_t status = FTDM_SUCCESS; - - val = ftdm_str2ftdm_ton(string); - if (val == FTDM_TON_INVALID) { - ftdm_log(FTDM_LOG_WARNING, "Invalid TON string (%s)\n", string); - status = FTDM_FAIL; - val = FTDM_TON_UNKNOWN; - } - *target = val; - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t *target) -{ - uint8_t val; - ftdm_status_t status = FTDM_SUCCESS; - - val = ftdm_str2ftdm_bearer_cap(string); - if (val == FTDM_NPI_INVALID) { - ftdm_log(FTDM_LOG_WARNING, "Invalid Bearer-Capability string (%s)\n", string); - status = FTDM_FAIL; - val = FTDM_BEARER_CAP_SPEECH; - } - - *target = val; - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *target) -{ - uint8_t val; - ftdm_status_t status = FTDM_SUCCESS; - - val = ftdm_str2ftdm_usr_layer1_prot(string); - if (val == FTDM_USER_LAYER1_PROT_INVALID) { - ftdm_log(FTDM_LOG_WARNING, "Invalid Bearer Layer 1 Protocol string (%s)\n", string); - status = FTDM_FAIL; - val = FTDM_USER_LAYER1_PROT_ULAW; - } - - *target = val; - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target) -{ - uint8_t val; - ftdm_status_t status = FTDM_SUCCESS; - - val = ftdm_str2ftdm_screening(string); - if (val == FTDM_SCREENING_INVALID) { - ftdm_log(FTDM_LOG_WARNING, "Invalid screening indicator string (%s)\n", string); - status = FTDM_FAIL; - val = FTDM_SCREENING_NOT_SCREENED; - } - - *target = val; - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target) -{ - uint8_t val; - ftdm_status_t status = FTDM_SUCCESS; - - val = ftdm_str2ftdm_presentation(string); - if (val == FTDM_PRES_INVALID) { - ftdm_log(FTDM_LOG_WARNING, "Invalid presentation string (%s)\n", string); - status = FTDM_FAIL; - val = FTDM_PRES_ALLOWED; - } - - *target = val; - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number) -{ - if (!number) { - return FTDM_FAIL; - } - - for ( ; *number; number++) { - if (!isdigit(*number)) { - return FTDM_FAIL; - } - } - return FTDM_SUCCESS; -} - - -FT_DECLARE(ftdm_status_t) ftdm_set_calling_party_category(const char *string, uint8_t *target) -{ - uint8_t val; - ftdm_status_t status = FTDM_SUCCESS; - - val = ftdm_str2ftdm_calling_party_category(string); - if (val == FTDM_CPC_INVALID) { - ftdm_log(FTDM_LOG_WARNING, "Invalid category string (%s)\n", string); - val = FTDM_CPC_ORDINARY; - status = FTDM_FAIL; - } - - *target = val; - return status; -} - diff --git a/libs/freetdm/src/ftdm_callerid.c b/libs/freetdm/src/ftdm_callerid.c deleted file mode 100644 index d3223502f4..0000000000 --- a/libs/freetdm/src/ftdm_callerid.c +++ /dev/null @@ -1,307 +0,0 @@ -#include "private/ftdm_core.h" -#include "fsk.h" -#include "uart.h" - - - -static void fsk_byte_handler (void *x, int data) -{ - ftdm_fsk_data_state_t *state = (ftdm_fsk_data_state_t *) x; - uint8_t byte = (uint8_t)data; - - top: - - if (state->init == 3) { - return; - } - - if (state->dlen) { - goto add_byte; - } - - if (state->bpos == 1) { - state->blen = byte; - - if ((uint32_t)(state->dlen = state->bpos + byte + 2) > state->bufsize) { - state->dlen = state->bufsize; - } - goto top; - } - - add_byte: - - if (state->bpos <= state->dlen) { - state->buf[state->bpos++] = byte; - } else { - state->init = 3; - } -} - -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_init(ftdm_fsk_data_state_t *state, uint8_t *data, uint32_t datalen) -{ - memset(state, 0, sizeof(*state)); - state->buf = data; - state->bufsize = datalen; - state->bpos = 2; - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_sdmf(ftdm_fsk_data_state_t *state, const char *date, char *number) -{ - size_t dlen = strlen(date); - size_t nlen = strlen(number); - - state->buf[0] = FTDM_CID_TYPE_SDMF; - memcpy(&state->buf[state->bpos], date, dlen); - state->bpos += dlen; - memcpy(&state->buf[state->bpos], number, nlen); - state->bpos += nlen; - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_mdmf(ftdm_fsk_data_state_t *state, ftdm_mdmf_type_t type, const uint8_t *data, uint32_t datalen) -{ - state->buf[0] = FTDM_CID_TYPE_MDMF; - state->buf[state->bpos++] = type; - state->buf[state->bpos++] = (uint8_t)datalen; - memcpy(&state->buf[state->bpos], data, datalen); - state->bpos += datalen; - return FTDM_SUCCESS; -} - - -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_checksum(ftdm_fsk_data_state_t *state) -{ - uint32_t i; - uint8_t check = 0; - - state->buf[1] = (uint8_t)(state->bpos - 2); - - for (i = 0; i < state->bpos; i++) { - check = check + state->buf[i]; - } - - state->checksum = state->buf[state->bpos] = (uint8_t)(256 - check); - state->bpos++; - - state->dlen = state->bpos; - state->blen = state->buf[1]; - - return FTDM_SUCCESS; -} - - -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_parse(ftdm_fsk_data_state_t *state, ftdm_size_t *type, char **data, ftdm_size_t *len) -{ - - ftdm_size_t i; - int sum = 0; - - top: - - if (state->checksum != 0 || state->ppos >= state->dlen - 1) { - return FTDM_FAIL; - } - - if (!state->ppos) { - for(i = 0; i < state->bpos; i++) { - sum += state->buf[i]; - } - state->checksum = sum % 256; - state->ppos = 2; - - if (state->buf[0] != FTDM_CID_TYPE_MDMF && state->buf[0] != FTDM_CID_TYPE_SDMF) { - state->checksum = -1; - } - goto top; - } - - if (state->buf[0] == FTDM_CID_TYPE_SDMF) { - /* convert sdmf to mdmf so we don't need 2 parsers */ - if (state->ppos == 2) { - *type = MDMF_DATETIME; - *len = 8; - } else { - if (state->buf[state->ppos] == 'P' || state->buf[state->ppos] == 'O') { - *type = MDMF_NO_NUM; - *len = 1; - } else { - *type = MDMF_PHONE_NUM; - *len = state->blen - 8; - } - } - *data = (char *)&state->buf[state->ppos]; - state->ppos += *len; - return FTDM_SUCCESS; - } else if (state->buf[0] == FTDM_CID_TYPE_MDMF) { - *type = state->buf[state->ppos++]; - *len = state->buf[state->ppos++]; - *data = (char *)&state->buf[state->ppos]; - state->ppos += *len; - return FTDM_SUCCESS; - } - - return FTDM_FAIL; -} - -FT_DECLARE(ftdm_status_t) ftdm_fsk_demod_feed(ftdm_fsk_data_state_t *state, int16_t *data, ftdm_size_t samples) -{ - uint32_t x; - int16_t *sp = data; - - if (state->init == 3) { - return FTDM_FAIL; - } - - for (x = 0; x < samples; x++) { - dsp_fsk_sample (state->fsk1200_handle, (double) *sp++ / 32767.0); - if (state->dlen && state->bpos >= state->dlen) { - state->init = 3; - return FTDM_FAIL; - } - } - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_fsk_demod_destroy(ftdm_fsk_data_state_t *state) -{ - dsp_fsk_destroy(&state->fsk1200_handle); - memset(state, 0, sizeof(*state)); - return FTDM_SUCCESS; -} - -FT_DECLARE(int) ftdm_fsk_demod_init(ftdm_fsk_data_state_t *state, int rate, uint8_t *buf, ftdm_size_t bufsize) -{ - - dsp_fsk_attr_t fsk1200_attr; - - if (state->fsk1200_handle) { - dsp_fsk_destroy(&state->fsk1200_handle); - } - - memset(state, 0, sizeof(*state)); - memset(buf, 0, bufsize); - state->buf = buf; - state->bufsize = bufsize; - - dsp_fsk_attr_init (&fsk1200_attr); - dsp_fsk_attr_set_samplerate (&fsk1200_attr, rate); - dsp_fsk_attr_set_bytehandler (&fsk1200_attr, fsk_byte_handler, state); - state->fsk1200_handle = dsp_fsk_create (&fsk1200_attr); - - if (state->fsk1200_handle == NULL) { - return FTDM_FAIL; - } - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_size_t) ftdm_fsk_modulator_generate_bit(ftdm_fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, ftdm_size_t buflen) -{ - ftdm_size_t i; - - for(i = 0 ; i < buflen; i++) { - fsk_trans->bit_accum += fsk_trans->bit_factor; - if (fsk_trans->bit_accum >= FTDM_FSK_MOD_FACTOR) { - fsk_trans->bit_accum -= (FTDM_FSK_MOD_FACTOR + fsk_trans->bit_factor); - break; - } - - buf[i] = teletone_dds_state_modulate_sample(&fsk_trans->dds, bit); - } - - return i; -} - - -FT_DECLARE(int32_t) ftdm_fsk_modulator_generate_carrier_bits(ftdm_fsk_modulator_t *fsk_trans, uint32_t bits) -{ - uint32_t i = 0; - ftdm_size_t r = 0; - int8_t bit = 1; - - for (i = 0; i < bits; i++) { - if ((r = ftdm_fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) { - if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != FTDM_SUCCESS) { - break; - } - } else { - break; - } - } - - return i; -} - - -FT_DECLARE(void) ftdm_fsk_modulator_generate_chan_sieze(ftdm_fsk_modulator_t *fsk_trans) -{ - uint32_t i = 0; - ftdm_size_t r = 0; - int8_t bit = 0; - - for (i = 0; i < fsk_trans->chan_sieze_bits; i++) { - if ((r = ftdm_fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) { - if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != FTDM_SUCCESS) { - break; - } - } else { - break; - } - bit = !bit; - } - - -} - - -FT_DECLARE(void) ftdm_fsk_modulator_send_data(ftdm_fsk_modulator_t *fsk_trans) -{ - ftdm_size_t r = 0; - int8_t bit = 0; - - while((bit = ftdm_bitstream_get_bit(&fsk_trans->bs)) > -1) { - if ((r = ftdm_fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) { - if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != FTDM_SUCCESS) { - break; - } - } else { - break; - } - } -} - - -FT_DECLARE(ftdm_status_t) ftdm_fsk_modulator_init(ftdm_fsk_modulator_t *fsk_trans, - fsk_modem_types_t modem_type, - uint32_t sample_rate, - ftdm_fsk_data_state_t *fsk_data, - float db_level, - uint32_t carrier_bits_start, - uint32_t carrier_bits_stop, - uint32_t chan_sieze_bits, - ftdm_fsk_write_sample_t write_sample_callback, - void *user_data) -{ - memset(fsk_trans, 0, sizeof(*fsk_trans)); - fsk_trans->modem_type = modem_type; - teletone_dds_state_set_tone(&fsk_trans->dds, fsk_modem_definitions[fsk_trans->modem_type].freq_space, sample_rate, 0); - teletone_dds_state_set_tone(&fsk_trans->dds, fsk_modem_definitions[fsk_trans->modem_type].freq_mark, sample_rate, 1); - fsk_trans->bit_factor = (uint32_t)((fsk_modem_definitions[fsk_trans->modem_type].baud_rate * FTDM_FSK_MOD_FACTOR) / (float)sample_rate); - fsk_trans->samples_per_bit = (uint32_t) (sample_rate / fsk_modem_definitions[fsk_trans->modem_type].baud_rate); - fsk_trans->est_bytes = (int32_t)(((fsk_data->dlen * 10) + carrier_bits_start + carrier_bits_stop + chan_sieze_bits) * ((fsk_trans->samples_per_bit + 1) * 2)); - fsk_trans->bit_accum = 0; - fsk_trans->fsk_data = fsk_data; - teletone_dds_state_set_tx_level(&fsk_trans->dds, db_level); - ftdm_bitstream_init(&fsk_trans->bs, fsk_trans->fsk_data->buf, (uint32_t)fsk_trans->fsk_data->dlen, FTDM_ENDIAN_BIG, 1); - fsk_trans->carrier_bits_start = carrier_bits_start; - fsk_trans->carrier_bits_stop = carrier_bits_stop; - fsk_trans->chan_sieze_bits = chan_sieze_bits; - fsk_trans->write_sample_callback = write_sample_callback; - fsk_trans->user_data = user_data; - return FTDM_SUCCESS; -} - diff --git a/libs/freetdm/src/ftdm_config.c b/libs/freetdm/src/ftdm_config.c deleted file mode 100644 index 9352284edf..0000000000 --- a/libs/freetdm/src/ftdm_config.c +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - */ - -#include "private/ftdm_core.h" - -#ifndef FTDM_MOD_DIR -#define FTDM_MOD_DIR "." -#endif - -#define FTDM_MAX_CONF_DIR 512 - -static char g_ftdm_config_dir[FTDM_MAX_CONF_DIR] = FTDM_CONFIG_DIR; -static char g_ftdm_mod_dir[FTDM_MAX_CONF_DIR] = FTDM_MOD_DIR; - -FT_DECLARE(void) ftdm_global_set_mod_directory(const char *path) -{ - snprintf(g_ftdm_mod_dir, sizeof(g_ftdm_mod_dir), "%s", path); - ftdm_log(FTDM_LOG_DEBUG, "New mod directory: %s\n", g_ftdm_mod_dir); -} - -FT_DECLARE(void) ftdm_global_set_config_directory(const char *path) -{ - snprintf(g_ftdm_config_dir, sizeof(g_ftdm_config_dir), "%s", path); - ftdm_log(FTDM_LOG_DEBUG, "New config directory: %s\n", g_ftdm_config_dir); -} - -int ftdm_config_open_file(ftdm_config_t *cfg, const char *file_path) -{ - FILE *f; - const char *path = NULL; - char path_buf[1024]; - - if (file_path[0] == '/') { - path = file_path; - } else { - snprintf(path_buf, sizeof(path_buf), "%s%s%s", g_ftdm_config_dir, FTDM_PATH_SEPARATOR, file_path); - path = path_buf; - } - - if (!path) { - return 0; - } - - memset(cfg, 0, sizeof(*cfg)); - cfg->lockto = -1; - ftdm_log(FTDM_LOG_DEBUG, "Configuration file is %s\n", path); - f = fopen(path, "r"); - - if (!f) { - if (file_path[0] != '/') { - int last = -1; - char *var, *val; - - snprintf(path_buf, sizeof(path_buf), "%s%sfreetdm.conf", g_ftdm_config_dir, FTDM_PATH_SEPARATOR); - path = path_buf; - - if ((f = fopen(path, "r")) == 0) { - return 0; - } - - cfg->file = f; - ftdm_set_string(cfg->path, path); - - while (ftdm_config_next_pair(cfg, &var, &val)) { - if ((cfg->sectno != last) && !strcmp(cfg->section, file_path)) { - cfg->lockto = cfg->sectno; - return 1; - } - } - - ftdm_config_close_file(cfg); - memset(cfg, 0, sizeof(*cfg)); - return 0; - } - - return 0; - } else { - cfg->file = f; - ftdm_set_string(cfg->path, path); - return 1; - } -} - -void ftdm_config_close_file(ftdm_config_t *cfg) -{ - - if (cfg->file) { - fclose(cfg->file); - } - - memset(cfg, 0, sizeof(*cfg)); -} - - - -int ftdm_config_next_pair(ftdm_config_t *cfg, char **var, char **val) -{ - int ret = 0; - char *p, *end; - - *var = *val = NULL; - - if (!cfg->path) { - return 0; - } - - for (;;) { - cfg->lineno++; - - if (!fgets(cfg->buf, sizeof(cfg->buf), cfg->file)) { - ret = 0; - break; - } - *var = cfg->buf; - - if (**var == '[' && (end = strchr(*var, ']')) != 0) { - *end = '\0'; - (*var)++; - if (**var == '+') { - (*var)++; - ftdm_copy_string(cfg->section, *var, sizeof(cfg->section)); - cfg->sectno++; - - if (cfg->lockto > -1 && cfg->sectno != cfg->lockto) { - break; - } - cfg->catno = 0; - cfg->lineno = 0; - *var = (char *) ""; - *val = (char *) ""; - return 1; - } else { - ftdm_copy_string(cfg->category, *var, sizeof(cfg->category)); - cfg->catno++; - } - continue; - } - - - - if (**var == '#' || **var == ';' || **var == '\n' || **var == '\r') { - continue; - } - - if (!strncmp(*var, "__END__", 7)) { - break; - } - - - if ((end = strchr(*var, ';')) && *(end+1) == *end) { - *end = '\0'; - end--; - } else if ((end = strchr(*var, '\n')) != 0) { - if (*(end - 1) == '\r') { - end--; - } - *end = '\0'; - } - - p = *var; - while ((*p == ' ' || *p == '\t') && p != end) { - *p = '\0'; - p++; - } - *var = p; - - - if ((*val = strchr(*var, '=')) == 0) { - ret = -1; - /* log_printf(0, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno); */ - continue; - } else { - p = *val - 1; - *(*val) = '\0'; - (*val)++; - if (*(*val) == '>') { - *(*val) = '\0'; - (*val)++; - } - - while ((*p == ' ' || *p == '\t') && p != *var) { - *p = '\0'; - p--; - } - - p = *val; - while ((*p == ' ' || *p == '\t') && p != end) { - *p = '\0'; - p++; - } - *val = p; - ret = 1; - break; - } - } - - - return ret; - -} - -FT_DECLARE (int) ftdm_config_get_cas_bits(char *strvalue, unsigned char *outbits) -{ - char cas_bits[5]; - unsigned char bit = 0x8; - int x = 0; - char *double_colon = strchr(strvalue, ':'); - if (!double_colon) { - ftdm_log(FTDM_LOG_ERROR, "No CAS bits specified: %s, :xxxx definition expected, where x is 1 or 0\n", strvalue); - return -1; - } - double_colon++; - *outbits = 0; - cas_bits[4] = 0; - if (sscanf(double_colon, "%c%c%c%c", &cas_bits[0], &cas_bits[1], &cas_bits[2], &cas_bits[3]) != 4) { - ftdm_log(FTDM_LOG_ERROR, "Invalid CAS bits specified: '%s', :xxxx definition expected, where x is 1 or 0\n", double_colon); - return -1; - } - ftdm_log(FTDM_LOG_DEBUG, "CAS bits specification found: %s\n", cas_bits); - for (; cas_bits[x]; x++) { - if ('1' == cas_bits[x]) { - *outbits |= bit; - } else if ('0' != cas_bits[x]) { - ftdm_log(FTDM_LOG_ERROR, "Invalid CAS pattern specified: %s, just 0 or 1 allowed for each bit\n", - strvalue); - return -1; - } - bit >>= 1; - } - return 0; -} - -#define PARAMETERS_CHUNK_SIZE 20 -FT_DECLARE(ftdm_status_t) ftdm_conf_node_create(const char *name, ftdm_conf_node_t **node, ftdm_conf_node_t *parent) -{ - ftdm_conf_node_t *newnode; - ftdm_conf_node_t *sibling = NULL; - - ftdm_assert_return(name != NULL, FTDM_FAIL, "null node name"); - - newnode = ftdm_calloc(1, sizeof(**node)); - if (!newnode) { - return FTDM_MEMERR; - } - - strncpy(newnode->name, name, sizeof(newnode->name)-1); - newnode->name[sizeof(newnode->name)-1] = 0; - - newnode->parameters = ftdm_calloc(PARAMETERS_CHUNK_SIZE, sizeof(*newnode->parameters)); - if (!newnode->parameters) { - ftdm_safe_free(newnode); - return FTDM_MEMERR; - } - newnode->t_parameters = PARAMETERS_CHUNK_SIZE; - - if (parent) { - /* store who my parent is */ - newnode->parent = parent; - - /* arrange them in FIFO order (newnode should be last) */ - if (!parent->child) { - /* we're the first node being added */ - parent->child = newnode; - } else { - if (!parent->last) { - /* we're the second node being added */ - parent->last = newnode; - parent->child->next = newnode; - newnode->prev = parent->child; - } else { - /* we're the third or Nth node to be added */ - sibling = parent->last; - sibling->next = newnode; - parent->last = newnode; - newnode->prev = sibling; - } - } - } - - *node = newnode; - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_conf_node_add_param(ftdm_conf_node_t *node, const char *param, const char *val) -{ - void *newparameters; - - ftdm_assert_return(param != NULL, FTDM_FAIL, "param is null"); - ftdm_assert_return(val != NULL, FTDM_FAIL, "val is null"); - - if (node->n_parameters == node->t_parameters) { - newparameters = ftdm_realloc(node->parameters, (node->t_parameters + PARAMETERS_CHUNK_SIZE) * sizeof(*node->parameters)); - if (!newparameters) { - return FTDM_MEMERR; - } - node->parameters = newparameters; - node->t_parameters = node->n_parameters + PARAMETERS_CHUNK_SIZE; - } - node->parameters[node->n_parameters].var = param; - node->parameters[node->n_parameters].val = val; - node->n_parameters++; - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_conf_node_destroy(ftdm_conf_node_t *node) -{ - ftdm_conf_node_t *curr = NULL; - ftdm_conf_node_t *child = node->child; - while (child) { - curr = child; - child = curr->next; - ftdm_conf_node_destroy(curr); - } - ftdm_free(node->parameters); - ftdm_free(node); - return FTDM_SUCCESS; -} - -FT_DECLARE(char *) ftdm_build_dso_path(const char *name, char *path, ftdm_size_t len) -{ -#ifdef WIN32 - const char *ext = ".dll"; - //const char *EXT = ".DLL"; -#elif defined (MACOSX) || defined (DARWIN) - const char *ext = ".dylib"; - //const char *EXT = ".DYLIB"; -#else - const char *ext = ".so"; - //const char *EXT = ".SO"; -#endif - if (*name == *FTDM_PATH_SEPARATOR) { - snprintf(path, len, "%s%s", name, ext); - } else { - snprintf(path, len, "%s%s%s%s", g_ftdm_mod_dir, FTDM_PATH_SEPARATOR, name, ext); - } - return path; -} - -/* 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/freetdm/src/ftdm_cpu_monitor.c b/libs/freetdm/src/ftdm_cpu_monitor.c deleted file mode 100644 index 1aa9b16c41..0000000000 --- a/libs/freetdm/src/ftdm_cpu_monitor.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * David Yat Sin - * - */ - -#ifdef WIN32 -# if (_WIN32_WINNT < 0x0501) -# error "Need to target at least Windows XP/Server 2003 because GetSystemTimes is needed" -# endif -# include -#else /* LINUX */ - -#include -#include -#include -#include -#include -#include -#include -#endif - -#include "private/ftdm_core.h" -#include "ftdm_cpu_monitor.h" -struct ftdm_cpu_monitor_stats -{ - /* bool, just used to retrieve the values for the first time and not calculate the percentage of idle time */ - int valid_last_times; - - /* last calculated percentage of idle time */ - double last_percentage_of_idle_time; - -#ifdef __linux__ - /* the cpu feature gets disabled on errors */ - int disabled; - - /* all of these are the Linux jiffies last retrieved count */ - unsigned long long last_user_time; - unsigned long long last_system_time; - unsigned long long last_idle_time; - - unsigned long long last_nice_time; - unsigned long long last_irq_time; - unsigned long long last_soft_irq_time; - unsigned long long last_io_wait_time; - unsigned long long last_steal_time; - - /* /proc/stat file descriptor used to retrieve the counters */ - int procfd; - int initd; -#elif defined (WIN32) || defined (WIN64) - __int64 i64LastUserTime; - __int64 i64LastKernelTime; - __int64 i64LastIdleTime; -#else -/* Unsupported */ -#endif -}; - -#ifdef __linux__ -static ftdm_status_t ftdm_cpu_read_stats(struct ftdm_cpu_monitor_stats *p, - unsigned long long *user, - unsigned long long *nice, - unsigned long long *system, - unsigned long long *idle, - unsigned long long *iowait, - unsigned long long *irq, - unsigned long long *softirq, - unsigned long long *steal) -{ -// the output of proc should not change that often from one kernel to other -// see fs/proc/proc_misc.c or fs/proc/stat.c in the Linux kernel for more details -// also man 5 proc is useful. -#define CPU_ELEMENTS_1 7 // change this if you change the format string -#define CPU_INFO_FORMAT_1 "cpu %llu %llu %llu %llu %llu %llu %llu" - -#define CPU_ELEMENTS_2 8 // change this if you change the format string -#define CPU_INFO_FORMAT_2 "cpu %llu %llu %llu %llu %llu %llu %llu %llu" - -#define CPU_ELEMENTS_3 9 // change this if you change the format string -#define CPU_INFO_FORMAT_3 "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu" - - static const char procfile[] = "/proc/stat"; - int rc = 0; - int myerrno = 0; - int elements = 0; - const char *cpustr = NULL; - char statbuff[1024]; - unsigned long long guest = 0; - - if (!p->initd) { - p->procfd = open(procfile, O_RDONLY, 0); - if(p->procfd == -1) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open CPU statistics file %s: %s\n", procfile, strerror(myerrno)); - return FTDM_FAIL; - } - p->initd = 1; - } else { - lseek(p->procfd, 0L, SEEK_SET); - } - - rc = read(p->procfd, statbuff, sizeof(statbuff) - 1); - if (rc <= 0) { - myerrno = errno; - ftdm_log(FTDM_LOG_ERROR, "Failed to read CPU statistics file %s: %s\n", procfile, strerror(myerrno)); - return FTDM_FAIL; - } - - cpustr = strstr(statbuff, "cpu "); - if (!cpustr) { - ftdm_log(FTDM_LOG_ERROR, "wrong format for Linux proc cpu statistics: missing cpu string\n"); - return FTDM_FAIL; - } - - /* test each of the known formats starting from the bigger one */ - elements = sscanf(cpustr, CPU_INFO_FORMAT_3, user, nice, system, idle, iowait, irq, softirq, steal, &guest); - if (elements == CPU_ELEMENTS_3) { - user += guest; /* guest operating system's run in user space */ - return FTDM_SUCCESS; - } - - elements = sscanf(cpustr, CPU_INFO_FORMAT_2, user, nice, system, idle, iowait, irq, softirq, steal); - if (elements == CPU_ELEMENTS_2) { - return FTDM_SUCCESS; - } - - elements = sscanf(cpustr, CPU_INFO_FORMAT_1, user, nice, system, idle, iowait, irq, softirq); - if (elements == CPU_ELEMENTS_1) { - *steal = 0; - return FTDM_SUCCESS; - } - - ftdm_log(FTDM_LOG_ERROR, "Unexpected format for Linux proc cpu statistics:%s\n", cpustr); - return FTDM_FAIL; -} -#endif - -#ifdef __linux__ -FT_DECLARE(ftdm_status_t) ftdm_cpu_get_system_idle_time (struct ftdm_cpu_monitor_stats *p, double *idle_percentage) -{ - unsigned long long user, nice, system, idle, iowait, irq, softirq, steal; - unsigned long long usertime, kerneltime, idletime, totaltime, halftime; - - *idle_percentage = 100.0; - if (p->disabled) { - return FTDM_FAIL; - } - if (ftdm_cpu_read_stats(p, &user, &nice, &system, &idle, &iowait, &irq, &softirq, &steal)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to retrieve Linux CPU statistics - disabling cpu monitor\n"); - p->disabled = 1; - return FTDM_FAIL; - } - - if (!p->valid_last_times) { - // we dont strictly need to save all of them but I feel code is more clear if we do - p->valid_last_times = 1; - p->last_user_time = user; - p->last_nice_time = nice; - p->last_system_time = system; - p->last_irq_time = irq; - p->last_soft_irq_time = softirq; - p->last_io_wait_time = iowait; - p->last_steal_time = steal; - p->last_idle_time = idle; - p->last_percentage_of_idle_time = 100.0; - *idle_percentage = p->last_percentage_of_idle_time; - return FTDM_SUCCESS; - } - - usertime = (user - p->last_user_time) + (nice - p->last_nice_time); - kerneltime = (system - p->last_system_time) + (irq - p->last_irq_time) + (softirq - p->last_soft_irq_time); - kerneltime += (iowait - p->last_io_wait_time); - kerneltime += (steal - p->last_steal_time); - idletime = (idle - p->last_idle_time); - - totaltime = usertime + kerneltime + idletime; - - if (totaltime <= 0) { - // this may happen if not enough time has elapsed and the jiffies counters are the same than the last time we checked - // jiffies depend on timer interrupts which depend on the number of HZ compile time setting of the kernel - // typical configs set HZ to 100 (that means, 100 jiffies updates per second, that is one each 10ms) - // avoid an arithmetic exception and return the same values - *idle_percentage = p->last_percentage_of_idle_time; - return FTDM_SUCCESS; - } - - halftime = totaltime / 2UL; - - p->last_percentage_of_idle_time = ((100 * idletime + halftime) / totaltime); - *idle_percentage = p->last_percentage_of_idle_time; - - p->last_user_time = user; - p->last_nice_time = nice; - p->last_system_time = system; - p->last_irq_time = irq; - p->last_soft_irq_time = softirq; - p->last_io_wait_time = iowait; - p->last_steal_time = steal; - p->last_idle_time = idle; - - return FTDM_SUCCESS; -} - -#elif defined (__WINDOWS__) -FT_DECLARE(ftdm_status_t) ftdm_cpu_get_system_idle_time(struct ftdm_cpu_monitor_stats *p, double *idle_percentage) -{ - FILETIME idleTime; - FILETIME kernelTime; - FILETIME userTime; - int64_t i64UserTime; - int64_t i64KernelTime; - int64_t i64IdleTime; - - if (!GetSystemTimes(&idleTime, &kernelTime, &userTime)) { - return FTDM_FAIL; - } - - i64UserTime = (int64_t)userTime.dwLowDateTime | ((int64_t)userTime.dwHighDateTime << 32); - - i64KernelTime = (int64_t)kernelTime.dwLowDateTime | ((int64_t)kernelTime.dwHighDateTime << 32); - - i64IdleTime = (int64_t)idleTime.dwLowDateTime | ((int64_t)idleTime.dwHighDateTime << 32); - - if (p->valid_last_times) { - int64_t i64User = i64UserTime - p->i64LastUserTime; - int64_t i64Kernel = i64KernelTime - p->i64LastKernelTime; - int64_t i64Idle = i64IdleTime - p->i64LastIdleTime; - int64_t i64System = i64User + i64Kernel; - *idle_percentage = 100.0 * i64Idle / i64System; - } else { - *idle_percentage = 100.0; - p->valid_last_times = 1; - } - - /* Remember current value for the next call */ - p->i64LastUserTime = i64UserTime; - p->i64LastKernelTime = i64KernelTime; - p->i64LastIdleTime = i64IdleTime; - - /* Success */ - return FTDM_SUCCESS; -} -#else -/* Unsupported */ -FT_DECLARE(ftdm_status_t) ftdm_cpu_get_system_idle_time(struct ftdm_cpu_monitor_stats *p, double *idle_percentage) -{ - *idle_percentage = 100.0; - return FTDM_FAIL; -} -#endif - -FT_DECLARE(struct ftdm_cpu_monitor_stats*) ftdm_new_cpu_monitor(void) -{ - return calloc(1, sizeof(struct ftdm_cpu_monitor_stats)); -} - -FT_DECLARE(void) ftdm_delete_cpu_monitor(struct ftdm_cpu_monitor_stats *p) -{ -#ifdef __linux__ - close(p->procfd); -#endif - free(p); -} - - -/* 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/freetdm/src/ftdm_dso.c b/libs/freetdm/src/ftdm_dso.c deleted file mode 100755 index a646ed3469..0000000000 --- a/libs/freetdm/src/ftdm_dso.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Cross Platform dso/dll load abstraction - * Copyright(C) 2008 Michael Jerris - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so. - * - * This work 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. - * - */ - -#include "private/ftdm_core.h" -#include "ftdm_dso.h" -#include -#include - -#ifdef WIN32 -#include -#include - - -FT_DECLARE(ftdm_status_t) ftdm_dso_destroy(ftdm_dso_lib_t *lib) { - if (lib && *lib) { - FreeLibrary(*lib); - *lib = NULL; - } - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_dso_lib_t) ftdm_dso_open(const char *path, char **err) { - HINSTANCE lib; - - lib = LoadLibraryEx(path, NULL, 0); - - if (!lib) { - LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - } - - if (!lib) { - DWORD error = GetLastError(); - char tmp[80]; - sprintf(tmp, "dll open error [%ul]\n", error); - *err = ftdm_strdup(tmp); - } - - return lib; -} - -FT_DECLARE(void*) ftdm_dso_func_sym(ftdm_dso_lib_t lib, const char *sym, char **err) { - FARPROC func = GetProcAddress(lib, sym); - if (!func) { - DWORD error = GetLastError(); - char tmp[80]; - sprintf(tmp, "dll sym error [%ul]\n", error); - *err = ftdm_strdup(tmp); - } - return (void *)(intptr_t)func; // this should really be addr - ftdm_dso_func_data -} - -#else - -/* -** {======================================================================== -** This is an implementation of loadlib based on the dlfcn interface. -** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, -** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least -** as an emulation layer on top of native functions. -** ========================================================================= -*/ - - -#include - -FT_DECLARE(ftdm_status_t) ftdm_dso_destroy(ftdm_dso_lib_t *lib) { - int rc; - if (lib && *lib) { - rc = dlclose(*lib); - if (rc) { - ftdm_log(FTDM_LOG_ERROR, "Failed to close lib %p: %s\n", *lib, dlerror()); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "lib %p was closed with success\n", *lib); - *lib = NULL; - return FTDM_SUCCESS; - } - ftdm_log(FTDM_LOG_ERROR, "Invalid pointer provided to ftdm_dso_destroy\n"); - return FTDM_FAIL; -} - -FT_DECLARE(ftdm_dso_lib_t) ftdm_dso_open(const char *path, char **err) { - void *lib = dlopen(path, RTLD_NOW | RTLD_LOCAL); - if (lib == NULL) { - *err = ftdm_strdup(dlerror()); - } - return lib; -} - -FT_DECLARE(void *) ftdm_dso_func_sym(ftdm_dso_lib_t lib, const char *sym, char **err) { - void *func = dlsym(lib, sym); - if (!func) { - *err = ftdm_strdup(dlerror()); - } - return func; -} -#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/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c deleted file mode 100644 index 9adcd27509..0000000000 --- a/libs/freetdm/src/ftdm_io.c +++ /dev/null @@ -1,7027 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * David Yat Sin - * - */ -#define _GNU_SOURCE -#include "private/ftdm_core.h" -#include -#include -#ifdef WIN32 -#include -#endif -#ifdef FTDM_PIKA_SUPPORT -#include "ftdm_pika.h" -#endif -#include "ftdm_cpu_monitor.h" - -#ifndef localtime_r -struct tm *localtime_r(const time_t *clock, struct tm *result); -#endif - -#define FORCE_HANGUP_TIMER 30000 -#define FTDM_READ_TRACE_INDEX 0 -#define FTDM_WRITE_TRACE_INDEX 1 -#define MAX_CALLIDS 6000 -#define FTDM_HALF_DTMF_PAUSE 500 -#define FTDM_FULL_DTMF_PAUSE 1000 - -#define FTDM_CHANNEL_SW_DTMF_ALLOWED(ftdmchan) (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_DTMF_DETECTION)) - -ftdm_time_t time_last_throttle_log = 0; -ftdm_time_t time_current_throttle_log = 0; - -typedef struct val_str { - const char *str; - unsigned long long val; -} val_str_t; - -static val_str_t channel_flag_strs[] = { - { "configured" , FTDM_CHANNEL_CONFIGURED}, - { "ready", FTDM_CHANNEL_READY}, - { "open", FTDM_CHANNEL_OPEN}, - { "dtmf-detect", FTDM_CHANNEL_DTMF_DETECT}, - { "suppress-dtmf", FTDM_CHANNEL_SUPRESS_DTMF}, - { "transcode", FTDM_CHANNEL_TRANSCODE}, - { "buffer", FTDM_CHANNEL_BUFFER}, - { "in-thread", FTDM_CHANNEL_INTHREAD}, - { "wink", FTDM_CHANNEL_WINK}, - { "flash", FTDM_CHANNEL_FLASH}, - { "state-change", FTDM_CHANNEL_STATE_CHANGE}, - { "hold", FTDM_CHANNEL_HOLD}, - { "in-use", FTDM_CHANNEL_INUSE}, - { "off-hook", FTDM_CHANNEL_OFFHOOK}, - { "ringing", FTDM_CHANNEL_RINGING}, - { "progress-detect", FTDM_CHANNEL_PROGRESS_DETECT}, - { "callerid-detect", FTDM_CHANNEL_CALLERID_DETECT}, - { "outbound", FTDM_CHANNEL_OUTBOUND}, - { "suspended", FTDM_CHANNEL_SUSPENDED}, - { "3-way", FTDM_CHANNEL_3WAY}, - { "progress", FTDM_CHANNEL_PROGRESS}, - { "media", FTDM_CHANNEL_MEDIA}, - { "answered", FTDM_CHANNEL_ANSWERED}, - { "mute", FTDM_CHANNEL_MUTE}, - { "use-rx-gain", FTDM_CHANNEL_USE_RX_GAIN}, - { "use-tx-gain", FTDM_CHANNEL_USE_TX_GAIN}, - { "in-alarm", FTDM_CHANNEL_IN_ALARM}, - { "sig-up", FTDM_CHANNEL_SIG_UP}, - { "user-hangup", FTDM_CHANNEL_USER_HANGUP}, - { "rx-disabled", FTDM_CHANNEL_RX_DISABLED}, - { "tx-disabled", FTDM_CHANNEL_TX_DISABLED}, - { "call-started", FTDM_CHANNEL_CALL_STARTED}, - { "non-block", FTDM_CHANNEL_NONBLOCK}, - { "ind-ack-pending", FTDM_CHANNEL_IND_ACK_PENDING}, - { "blocking", FTDM_CHANNEL_BLOCKING}, - { "media", FTDM_CHANNEL_DIGITAL_MEDIA}, - { "native-sigbridge", FTDM_CHANNEL_NATIVE_SIGBRIDGE}, - { "sig-dtmf-detection", FTDM_CHANNEL_SIG_DTMF_DETECTION}, - { "invalid", FTDM_CHANNEL_MAX_FLAG}, -}; - -static val_str_t span_flag_strs[] = { - { "configured", FTDM_SPAN_CONFIGURED}, - { "started", FTDM_SPAN_STARTED}, - { "state-change", FTDM_SPAN_STATE_CHANGE}, - { "suspended", FTDM_SPAN_SUSPENDED}, - { "in-thread", FTDM_SPAN_IN_THREAD}, - { "stop-thread", FTDM_SPAN_STOP_THREAD}, - { "use-chan-queue", FTDM_SPAN_USE_CHAN_QUEUE}, - { "suggest-chan-id", FTDM_SPAN_SUGGEST_CHAN_ID}, - { "use-av-rate", FTDM_SPAN_USE_AV_RATE}, - { "power-saving", FTDM_SPAN_PWR_SAVING}, - { "signals-queue", FTDM_SPAN_USE_SIGNALS_QUEUE}, - { "proceed-state", FTDM_SPAN_USE_PROCEED_STATE}, - { "skip-state", FTDM_SPAN_USE_SKIP_STATES}, - { "non-stoppable", FTDM_SPAN_NON_STOPPABLE}, - { "use-transfer", FTDM_SPAN_USE_TRANSFER}, -}; - -static ftdm_status_t ftdm_call_set_call_id(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data); -static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data); -static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan); -static ftdm_status_t ftdm_channel_sig_indicate(ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_usrmsg_t *usrmsg); - -static const char *ftdm_val2str(unsigned long long val, val_str_t *val_str_table, ftdm_size_t array_size, const char *default_str); -static unsigned long long ftdm_str2val(const char *str, val_str_t *val_str_table, ftdm_size_t array_size, unsigned long long default_val); - - -static int time_is_init = 0; - -static void time_init(void) -{ -#ifdef WIN32 - timeBeginPeriod(1); -#endif - time_is_init = 1; -} - -static void time_end(void) -{ -#ifdef WIN32 - timeEndPeriod(1); -#endif - time_is_init = 0; -} - -FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void) -{ -#ifdef WIN32 - return timeGetTime(); -#else - struct timeval tv; - gettimeofday(&tv, NULL); - return ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); -#endif -} - -static void write_chan_io_dump(ftdm_io_dump_t *dump, char *dataptr, int dlen) -{ - int windex = dump->windex; - int avail = (int)dump->size - windex; - - if (!dump->buffer) { - return; - } - - if (dlen > avail) { - int diff = dlen - avail; - - ftdm_assert(diff < (int)dump->size, "Very small buffer or very big IO chunk!\n"); - - /* write only what we can and the rest at the beginning of the buffer */ - memcpy(&dump->buffer[windex], dataptr, avail); - memcpy(&dump->buffer[0], &dataptr[avail], diff); - windex = diff; - - /*ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p up to index %d\n\n", dump, windex);*/ - dump->wrapped = 1; - } else { - memcpy(&dump->buffer[windex], dataptr, dlen); - windex += dlen; - } - - if (windex == (int)dump->size) { - /*ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p\n", dump);*/ - windex = 0; - dump->wrapped = 1; - } - - dump->windex = windex; -} - -static void dump_chan_io_to_file(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, FILE *file) -{ - /* write the saved audio buffer */ - ftdm_size_t rc = 0; - ftdm_size_t towrite = 0; - - if (!dump->buffer) { - return; - } - - towrite = dump->size - dump->windex; - - if (dump->wrapped) { - rc = fwrite(&dump->buffer[dump->windex], 1, towrite, file); - if (rc != towrite) { - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "only wrote %"FTDM_SIZE_FMT" out of %"FTDM_SIZE_FMT" bytes in io dump buffer: %s\n", - rc, towrite, strerror(errno)); - } - } - if (dump->windex) { - towrite = dump->windex; - rc = fwrite(&dump->buffer[0], 1, towrite, file); - if (rc != towrite) { - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "only wrote %"FTDM_SIZE_FMT" out of %"FTDM_SIZE_FMT" bytes in io dump buffer: %s\n", - rc, towrite, strerror(errno)); - } - } - dump->windex = 0; - dump->wrapped = 0; -} - -static void stop_chan_io_dump(ftdm_io_dump_t *dump) -{ - if (!dump->buffer) { - return; - } - ftdm_safe_free(dump->buffer); - memset(dump, 0, sizeof(*dump)); -} - -static ftdm_status_t start_chan_io_dump(ftdm_channel_t *chan, ftdm_io_dump_t *dump, ftdm_size_t size) -{ - if (dump->buffer) { - ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "IO dump is already started\n"); - return FTDM_FAIL; - } - memset(dump, 0, sizeof(*dump)); - dump->buffer = ftdm_malloc(size); - if (!dump->buffer) { - return FTDM_FAIL; - } - dump->size = size; - return FTDM_SUCCESS; -} - - -static void close_dtmf_debug_file(ftdm_channel_t *ftdmchan) -{ - if (ftdmchan->dtmfdbg.file) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "closing debug dtmf file\n"); - fclose(ftdmchan->dtmfdbg.file); - ftdmchan->dtmfdbg.file = NULL; - } -} - -static ftdm_status_t disable_dtmf_debug(ftdm_channel_t *ftdmchan) -{ - if (!ftdmchan->dtmfdbg.enabled) { - return FTDM_SUCCESS; - } - - if (!ftdmchan->rxdump.buffer) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "DTMF debug enabled but no rx dump?\n"); - return FTDM_FAIL; - } - - close_dtmf_debug_file(ftdmchan); - stop_chan_io_dump(&ftdmchan->rxdump); - ftdmchan->dtmfdbg.enabled = 0; - return FTDM_SUCCESS; -} - -typedef struct { - uint8_t enabled; - uint8_t running; - uint8_t alarm; - uint32_t interval; - uint8_t alarm_action_flags; - uint8_t set_alarm_threshold; - uint8_t clear_alarm_threshold; - ftdm_interrupt_t *interrupt; -} cpu_monitor_t; - -static struct { - ftdm_hash_t *interface_hash; - ftdm_hash_t *module_hash; - ftdm_hash_t *span_hash; - ftdm_hash_t *group_hash; - ftdm_mutex_t *mutex; - ftdm_mutex_t *span_mutex; - ftdm_mutex_t *group_mutex; - ftdm_sched_t *timingsched; - uint32_t span_index; - uint32_t group_index; - uint32_t running; - ftdm_span_t *spans; - ftdm_group_t *groups; - cpu_monitor_t cpu_monitor; - - ftdm_caller_data_t *call_ids[MAX_CALLIDS+1]; - ftdm_mutex_t *call_id_mutex; - uint32_t last_call_id; - char dtmfdebug_directory[1024]; -} globals; - -enum ftdm_enum_cpu_alarm_action_flags -{ - FTDM_CPU_ALARM_ACTION_WARN = (1 << 0), - FTDM_CPU_ALARM_ACTION_REJECT = (1 << 1) -}; - -/* enum lookup funcs */ -FTDM_ENUM_NAMES(TONEMAP_NAMES, TONEMAP_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_tonemap, ftdm_tonemap2str, ftdm_tonemap_t, TONEMAP_NAMES, FTDM_TONEMAP_INVALID) - -FTDM_ENUM_NAMES(OOB_NAMES, OOB_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_oob_event, ftdm_oob_event2str, ftdm_oob_event_t, OOB_NAMES, FTDM_OOB_INVALID) - -FTDM_ENUM_NAMES(TRUNK_TYPE_NAMES, TRUNK_TYPE_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_trunk_type, ftdm_trunk_type2str, ftdm_trunk_type_t, TRUNK_TYPE_NAMES, FTDM_TRUNK_NONE) - -FTDM_ENUM_NAMES(TRUNK_MODE_NAMES, TRUNK_MODE_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_trunk_mode, ftdm_trunk_mode2str, ftdm_trunk_mode_t, TRUNK_MODE_NAMES, FTDM_TRUNK_MODE_INVALID) - -FTDM_ENUM_NAMES(START_TYPE_NAMES, START_TYPE_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_analog_start_type, ftdm_analog_start_type2str, ftdm_analog_start_type_t, START_TYPE_NAMES, FTDM_ANALOG_START_NA) - -FTDM_ENUM_NAMES(SIGNAL_NAMES, SIGNAL_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t, SIGNAL_NAMES, FTDM_SIGEVENT_INVALID) - -FTDM_ENUM_NAMES(MDMF_TYPE_NAMES, MDMF_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_mdmf_type, ftdm_mdmf_type2str, ftdm_mdmf_type_t, MDMF_TYPE_NAMES, MDMF_INVALID) - -FTDM_ENUM_NAMES(CHAN_TYPE_NAMES, CHAN_TYPE_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t, CHAN_TYPE_NAMES, FTDM_CHAN_TYPE_COUNT) - -FTDM_ENUM_NAMES(SIGNALING_STATUS_NAMES, SIGSTATUS_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t, SIGNALING_STATUS_NAMES, FTDM_SIG_STATE_INVALID) - -FTDM_ENUM_NAMES(TRACE_DIR_NAMES, TRACE_DIR_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t, TRACE_DIR_NAMES, FTDM_TRACE_DIR_INVALID) - -FTDM_ENUM_NAMES(TRACE_TYPE_NAMES, TRACE_TYPE_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_trace_type, ftdm_trace_type2str, ftdm_trace_type_t, TRACE_TYPE_NAMES, FTDM_TRACE_TYPE_INVALID) - -FTDM_ENUM_NAMES(TON_NAMES, TON_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t, TON_NAMES, FTDM_TON_INVALID) - -FTDM_ENUM_NAMES(NPI_NAMES, NPI_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_npi, ftdm_npi2str, ftdm_npi_t, NPI_NAMES, FTDM_NPI_INVALID) - -FTDM_ENUM_NAMES(PRESENTATION_NAMES, PRESENTATION_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_presentation, ftdm_presentation2str, ftdm_presentation_t, PRESENTATION_NAMES, FTDM_PRES_INVALID) - -FTDM_ENUM_NAMES(SCREENING_NAMES, SCREENING_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_screening, ftdm_screening2str, ftdm_screening_t, SCREENING_NAMES, FTDM_SCREENING_INVALID) - -FTDM_ENUM_NAMES(BEARER_CAP_NAMES, BEARER_CAP_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_bearer_cap, ftdm_bearer_cap2str, ftdm_bearer_cap_t, BEARER_CAP_NAMES, FTDM_BEARER_CAP_INVALID) - -FTDM_ENUM_NAMES(USER_LAYER1_PROT_NAMES, USER_LAYER1_PROT_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t, USER_LAYER1_PROT_NAMES, FTDM_USER_LAYER1_PROT_INVALID) - -FTDM_ENUM_NAMES(CALLING_PARTY_CATEGORY_NAMES, CALLING_PARTY_CATEGORY_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_calling_party_category, ftdm_calling_party_category2str, ftdm_calling_party_category_t, CALLING_PARTY_CATEGORY_NAMES, FTDM_CPC_INVALID) - -FTDM_ENUM_NAMES(INDICATION_NAMES, INDICATION_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_channel_indication, ftdm_channel_indication2str, ftdm_channel_indication_t, INDICATION_NAMES, FTDM_CHANNEL_INDICATE_INVALID) - -FTDM_ENUM_NAMES(TRANSFER_RESPONSE_NAMES, TRANSFER_RESPONSE_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_transfer_response, ftdm_transfer_response2str, ftdm_transfer_response_t, TRANSFER_RESPONSE_NAMES, FTDM_TRANSFER_RESPONSE_INVALID) - -static ftdm_status_t ftdm_group_add_channels(ftdm_span_t* span, int currindex, const char* name); - -static void null_logger(const char *file, const char *func, int line, int level, const char *fmt, ...) -{ - ftdm_unused_arg(file); - ftdm_unused_arg(func); - ftdm_unused_arg(line); - ftdm_unused_arg(level); - ftdm_unused_arg(fmt); -} - - -const char *FTDM_LEVEL_NAMES[9] = { - "EMERG", - "ALERT", - "CRIT", - "ERROR", - "WARNING", - "NOTICE", - "INFO", - "DEBUG", - NULL -}; - -static int ftdm_log_level = FTDM_LOG_LEVEL_DEBUG; - -static void default_logger(const char *file, const char *func, int line, int level, const char *fmt, ...) -{ - char data[1024]; - va_list ap; - - if (level < 0 || level > 7) { - level = 7; - } - if (level > ftdm_log_level) { - return; - } - - va_start(ap, fmt); - - vsnprintf(data, sizeof(data), fmt, ap); - - fprintf(stderr, "[%s] %s:%d %s() %s", FTDM_LEVEL_NAMES[level], file, line, func, data); - - va_end(ap); - -} - -static __inline__ void *ftdm_std_malloc(void *pool, ftdm_size_t size) -{ - void *ptr = malloc(size); - ftdm_unused_arg(pool); - ftdm_assert_return(ptr != NULL, NULL, "Out of memory\n"); - return ptr; -} - -static __inline__ void *ftdm_std_calloc(void *pool, ftdm_size_t elements, ftdm_size_t size) -{ - void *ptr = calloc(elements, size); - ftdm_unused_arg(pool); - ftdm_assert_return(ptr != NULL, NULL, "Out of memory\n"); - return ptr; -} - -static __inline__ void *ftdm_std_realloc(void *pool, void *buff, ftdm_size_t size) -{ - buff = realloc(buff, size); - ftdm_unused_arg(pool); - ftdm_assert_return(buff != NULL, NULL, "Out of memory\n"); - return buff; -} - -static __inline__ void ftdm_std_free(void *pool, void *ptr) -{ - ftdm_unused_arg(pool); - ftdm_assert_return(ptr != NULL, , "Attempted to free null pointer"); - free(ptr); -} - -FT_DECLARE(void) ftdm_set_echocancel_call_begin(ftdm_channel_t *chan) -{ - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) { - if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) { - /* If the ec is disabled on idle, we need to enable it unless is a digital call */ - if (caller_data->bearer_capability != FTDM_BEARER_CAP_UNRESTRICTED) { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Enabling ec for call in channel state %s\n", ftdm_channel_state2str(chan->state)); - ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); - } - } else { - /* If the ec is enabled on idle, we do nothing unless is a digital call that needs it disabled */ - if (caller_data->bearer_capability == FTDM_BEARER_CAP_UNRESTRICTED) { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Disabling ec for digital call in channel state %s\n", ftdm_channel_state2str(chan->state)); - ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); - } - } - } -} - -FT_DECLARE(void) ftdm_set_echocancel_call_end(ftdm_channel_t *chan) -{ - if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) { - if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Disabling ec on call end in channel state %s\n", ftdm_channel_state2str(chan->state)); - ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); - } else { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Enabling ec back on call end in channel state %s\n", ftdm_channel_state2str(chan->state)); - ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); - } - } -} - -FT_DECLARE_DATA ftdm_memory_handler_t g_ftdm_mem_handler = -{ - /*.pool =*/ NULL, - /*.malloc =*/ ftdm_std_malloc, - /*.calloc =*/ ftdm_std_calloc, - /*.realloc =*/ ftdm_std_realloc, - /*.free =*/ ftdm_std_free -}; - -FT_DECLARE_DATA ftdm_crash_policy_t g_ftdm_crash_policy = FTDM_CRASH_NEVER; - -static ftdm_status_t ftdm_set_caller_data(ftdm_span_t *span, ftdm_caller_data_t *caller_data) -{ - if (!caller_data) { - ftdm_log(FTDM_LOG_CRIT, "Error: trying to set caller data, but no caller_data!\n"); - return FTDM_FAIL; - } - - if (caller_data->dnis.plan >= FTDM_NPI_INVALID) { - caller_data->dnis.plan = span->default_caller_data.dnis.plan; - } - - if (caller_data->dnis.type >= FTDM_TON_INVALID) { - caller_data->dnis.type = span->default_caller_data.dnis.type; - } - - if (caller_data->cid_num.plan >= FTDM_NPI_INVALID) { - caller_data->cid_num.plan = span->default_caller_data.cid_num.plan; - } - - if (caller_data->cid_num.type >= FTDM_TON_INVALID) { - caller_data->cid_num.type = span->default_caller_data.cid_num.type; - } - - if (caller_data->ani.plan >= FTDM_NPI_INVALID) { - caller_data->ani.plan = span->default_caller_data.ani.plan; - } - - if (caller_data->ani.type >= FTDM_TON_INVALID) { - caller_data->ani.type = span->default_caller_data.ani.type; - } - - if (caller_data->rdnis.plan >= FTDM_NPI_INVALID) { - caller_data->rdnis.plan = span->default_caller_data.rdnis.plan; - } - - if (caller_data->rdnis.type >= FTDM_NPI_INVALID) { - caller_data->rdnis.type = span->default_caller_data.rdnis.type; - } - - if (caller_data->bearer_capability >= FTDM_BEARER_CAP_INVALID) { - caller_data->bearer_capability = span->default_caller_data.bearer_capability; - } - - if (caller_data->bearer_layer1 >= FTDM_USER_LAYER1_PROT_INVALID) { - caller_data->bearer_layer1 = span->default_caller_data.bearer_layer1; - } - - if (FTDM_FAIL == ftdm_is_number(caller_data->cid_num.digits)) { - ftdm_log(FTDM_LOG_DEBUG, "dropping caller id number %s since we only accept digits\n", caller_data->cid_num.digits); - caller_data->cid_num.digits[0] = '\0'; - } - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_set_caller_data(ftdm_channel_t *ftdmchan, ftdm_caller_data_t *caller_data) -{ - ftdm_status_t err = FTDM_SUCCESS; - if (!ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "trying to set caller data, but no ftdmchan!\n"); - return FTDM_FAIL; - } - if ((err = ftdm_set_caller_data(ftdmchan->span, caller_data)) != FTDM_SUCCESS) { - return err; - } - ftdmchan->caller_data = *caller_data; - if (ftdmchan->caller_data.bearer_capability == FTDM_BEARER_CAP_UNRESTRICTED) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_DIGITAL_MEDIA); - } - return FTDM_SUCCESS; -} - -FT_DECLARE_DATA ftdm_logger_t ftdm_log = null_logger; - -FT_DECLARE(void) ftdm_global_set_crash_policy(ftdm_crash_policy_t policy) -{ - g_ftdm_crash_policy |= policy; -} - -FT_DECLARE(ftdm_status_t) ftdm_global_set_memory_handler(ftdm_memory_handler_t *handler) -{ - if (!handler) { - return FTDM_FAIL; - } - if (!handler->malloc) { - return FTDM_FAIL; - } - if (!handler->calloc) { - return FTDM_FAIL; - } - if (!handler->free) { - return FTDM_FAIL; - } - memcpy(&g_ftdm_mem_handler, handler, sizeof(*handler)); - return FTDM_SUCCESS; -} - -FT_DECLARE(void) ftdm_global_set_logger(ftdm_logger_t logger) -{ - if (logger) { - ftdm_log = logger; - } else { - ftdm_log = null_logger; - } -} - -FT_DECLARE(void) ftdm_global_set_default_logger(int level) -{ - if (level < 0 || level > 7) { - level = 7; - } - - ftdm_log = default_logger; - ftdm_log_level = level; -} - -FT_DECLARE_NONSTD(int) ftdm_hash_equalkeys(void *k1, void *k2) -{ - return strcmp((char *) k1, (char *) k2) ? 0 : 1; -} - -FT_DECLARE_NONSTD(uint32_t) ftdm_hash_hashfromstring(void *ky) -{ - unsigned char *str = (unsigned char *) ky; - uint32_t hash = 0; - int c; - - while ((c = *str++)) { - hash = c + (hash << 6) + (hash << 16) - hash; - } - - return hash; -} - -static ftdm_status_t ftdm_channel_destroy(ftdm_channel_t *ftdmchan) -{ - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CONFIGURED)) { - - while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { - ftdm_log(FTDM_LOG_INFO, "Waiting for thread to exit on channel %u:%u\n", ftdmchan->span_id, ftdmchan->chan_id); - ftdm_sleep(500); - } - - ftdm_mutex_lock(ftdmchan->pre_buffer_mutex); - ftdm_buffer_destroy(&ftdmchan->pre_buffer); - ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - - ftdm_buffer_destroy(&ftdmchan->digit_buffer); - ftdm_buffer_destroy(&ftdmchan->gen_dtmf_buffer); - ftdm_buffer_destroy(&ftdmchan->dtmf_buffer); - ftdm_buffer_destroy(&ftdmchan->fsk_buffer); - ftdmchan->pre_buffer_size = 0; - - ftdm_safe_free(ftdmchan->dtmf_hangup_buf); - - if (ftdmchan->tone_session.buffer) { - teletone_destroy_session(&ftdmchan->tone_session); - memset(&ftdmchan->tone_session, 0, sizeof(ftdmchan->tone_session)); - } - - - if (ftdmchan->span->fio->channel_destroy) { - ftdm_log(FTDM_LOG_INFO, "Closing channel %s:%u:%u fd:%d\n", ftdmchan->span->type, ftdmchan->span_id, ftdmchan->chan_id, ftdmchan->sockfd); - if (ftdmchan->span->fio->channel_destroy(ftdmchan) == FTDM_SUCCESS) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_CONFIGURED); - } else { - ftdm_log(FTDM_LOG_ERROR, "Error Closing channel %u:%u fd:%d\n", ftdmchan->span_id, ftdmchan->chan_id, ftdmchan->sockfd); - } - } - - ftdm_mutex_destroy(&ftdmchan->mutex); - ftdm_mutex_destroy(&ftdmchan->pre_buffer_mutex); - if (ftdmchan->state_completed_interrupt) { - ftdm_interrupt_destroy(&ftdmchan->state_completed_interrupt); - } - } - - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_span_destroy(ftdm_span_t *span) -{ - ftdm_status_t status = FTDM_SUCCESS; - unsigned j; - - /* The signaling must be already stopped (this is just a sanity check, should never happen) */ - ftdm_assert_return(!ftdm_test_flag(span, FTDM_SPAN_STARTED), FTDM_FAIL, "Signaling for span %s has not been stopped, refusing to destroy span\n"); - - ftdm_mutex_lock(span->mutex); - - /* destroy the channels */ - ftdm_clear_flag(span, FTDM_SPAN_CONFIGURED); - for(j = 1; j <= span->chan_count && span->channels[j]; j++) { - ftdm_channel_t *cur_chan = span->channels[j]; - if (cur_chan) { - if (ftdm_test_flag(cur_chan, FTDM_CHANNEL_CONFIGURED)) { - ftdm_channel_destroy(cur_chan); - } - ftdm_safe_free(cur_chan); - cur_chan = NULL; - } - } - - /* destroy the I/O for the span */ - if (span->fio && span->fio->span_destroy) { - ftdm_log(FTDM_LOG_INFO, "Destroying span %u type (%s)\n", span->span_id, span->type); - if (span->fio->span_destroy(span) != FTDM_SUCCESS) { - status = FTDM_FAIL; - } - } - - /* destroy final basic resources of the span data structure */ - if (span->pendingchans) { - ftdm_queue_destroy(&span->pendingchans); - } - if (span->pendingsignals) { - ftdm_sigmsg_t *sigmsg = NULL; - while ((sigmsg = ftdm_queue_dequeue(span->pendingsignals))) { - ftdm_sigmsg_free(&sigmsg); - } - ftdm_queue_destroy(&span->pendingsignals); - } - ftdm_mutex_unlock(span->mutex); - ftdm_mutex_destroy(&span->mutex); - - /* Give the span a chance to destroy its own signaling data */ - if (span->destroy) { - span->destroy(span); - } else if (span->signal_data) { - /* We take care of their dirty business ... */ - ftdm_free(span->signal_data); - } - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_get_alarms(ftdm_channel_t *ftdmchan, ftdm_alarm_flag_t *alarmbits) -{ - ftdm_status_t status = FTDM_FAIL; - - ftdm_assert_return(alarmbits != NULL, FTDM_EINVAL, "null alarmbits argument\n"); - ftdm_assert_return(ftdmchan != NULL, FTDM_EINVAL, "null channel argument\n"); - ftdm_assert_return(ftdmchan->span != NULL, FTDM_EINVAL, "null span\n"); - ftdm_assert_return(ftdmchan->span->fio != NULL, FTDM_EINVAL, "null io\n"); - - *alarmbits = FTDM_ALARM_NONE; - - if (!ftdmchan->span->fio->get_alarms) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "No get_alarms interface for this channel\n"); - return FTDM_ENOSYS; - } - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CONFIGURED)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot get alarms from an unconfigured channel\n"); - return FTDM_EINVAL; - } - - ftdm_channel_lock(ftdmchan); - - if ((status = ftdmchan->span->fio->get_alarms(ftdmchan)) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to get alarms from channel\n"); - goto done; - } - - *ftdmchan->last_error = '\0'; - *alarmbits = ftdmchan->alarm_flags; - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_RED)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "RED/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_YELLOW)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "YELLOW/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_RAI)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "RAI/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_BLUE)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "BLUE/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_AIS)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "AIS/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_GENERAL)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "GENERAL"); - } - *(ftdmchan->last_error + strlen(ftdmchan->last_error) - 1) = '\0'; - -done: - - ftdm_channel_unlock(ftdmchan); - - return status; -} - -static void ftdm_span_add(ftdm_span_t *span) -{ - ftdm_span_t *sp; - ftdm_mutex_lock(globals.span_mutex); - for (sp = globals.spans; sp && sp->next; sp = sp->next); - if (sp) { - sp->next = span; - } else { - globals.spans = span; - } - hashtable_insert(globals.span_hash, (void *)span->name, span, HASHTABLE_FLAG_FREE_VALUE); - ftdm_mutex_unlock(globals.span_mutex); -} - -FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span) -{ - ftdm_status_t status = FTDM_SUCCESS; - - ftdm_mutex_lock(span->mutex); - - if (ftdm_test_flag(span, FTDM_SPAN_NON_STOPPABLE)) { - status = FTDM_NOTIMPL; - goto done; - } - - if (!ftdm_test_flag(span, FTDM_SPAN_STARTED)) { - status = FTDM_EINVAL; - goto done; - } - - if (!span->stop) { - status = FTDM_ENOSYS; - goto done; - } - - /* Stop SIG */ - status = span->stop(span); - if (status == FTDM_SUCCESS) { - ftdm_clear_flag(span, FTDM_SPAN_STARTED); - } - - /* Stop I/O */ - if (span->fio && span->fio->span_stop) { - status = span->fio->span_stop(span); - } -done: - ftdm_mutex_unlock(span->mutex); - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_create(const char *iotype, const char *name, ftdm_span_t **span) -{ - ftdm_span_t *new_span = NULL; - ftdm_io_interface_t *fio = NULL; - ftdm_status_t status = FTDM_FAIL; - char buf[128] = ""; - - ftdm_assert_return(iotype != NULL, FTDM_FAIL, "No IO type provided\n"); - ftdm_assert_return(name != NULL, FTDM_FAIL, "No span name provided\n"); - - *span = NULL; - - fio = ftdm_global_get_io_interface(iotype, FTDM_TRUE); - if (!fio) { - ftdm_log(FTDM_LOG_CRIT, "failure creating span, no such I/O type '%s'\n", iotype); - return FTDM_FAIL; - } - - if (!fio->configure_span) { - ftdm_log(FTDM_LOG_CRIT, "failure creating span, no configure_span method for I/O type '%s'\n", iotype); - return FTDM_FAIL; - } - - ftdm_mutex_lock(globals.mutex); - if (globals.span_index < FTDM_MAX_SPANS_INTERFACE) { - new_span = ftdm_calloc(sizeof(*new_span), 1); - - ftdm_assert(new_span, "allocating span failed\n"); - - status = ftdm_mutex_create(&new_span->mutex); - ftdm_assert(status == FTDM_SUCCESS, "mutex creation failed\n"); - - ftdm_set_flag(new_span, FTDM_SPAN_CONFIGURED); - new_span->span_id = ++globals.span_index; - new_span->fio = fio; - ftdm_copy_string(new_span->tone_map[FTDM_TONEMAP_DIAL], "%(1000,0,350,440)", FTDM_TONEMAP_LEN); - ftdm_copy_string(new_span->tone_map[FTDM_TONEMAP_RING], "%(2000,4000,440,480)", FTDM_TONEMAP_LEN); - ftdm_copy_string(new_span->tone_map[FTDM_TONEMAP_BUSY], "%(500,500,480,620)", FTDM_TONEMAP_LEN); - ftdm_copy_string(new_span->tone_map[FTDM_TONEMAP_ATTN], "%(100,100,1400,2060,2450,2600)", FTDM_TONEMAP_LEN); - new_span->trunk_type = FTDM_TRUNK_NONE; - new_span->trunk_mode = FTDM_TRUNK_MODE_CPE; - new_span->data_type = FTDM_TYPE_SPAN; - - ftdm_mutex_lock(globals.span_mutex); - if (!ftdm_strlen_zero(name) && hashtable_search(globals.span_hash, (void *)name)) { - ftdm_log(FTDM_LOG_WARNING, "name %s is already used, substituting 'span%d' as the name\n", name, new_span->span_id); - name = NULL; - } - ftdm_mutex_unlock(globals.span_mutex); - - if (!name) { - snprintf(buf, sizeof(buf), "span%d", new_span->span_id); - name = buf; - } - new_span->name = ftdm_strdup(name); - new_span->type = ftdm_strdup(iotype); - ftdm_span_add(new_span); - *span = new_span; - status = FTDM_SUCCESS; - } - ftdm_mutex_unlock(globals.mutex); - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_close_all(void) -{ - ftdm_span_t *span; - uint32_t i = 0, j; - - ftdm_mutex_lock(globals.span_mutex); - for (span = globals.spans; span; span = span->next) { - if (ftdm_test_flag(span, FTDM_SPAN_CONFIGURED)) { - for(j = 1; j <= span->chan_count && span->channels[j]; j++) { - ftdm_channel_t *toclose = span->channels[j]; - if (ftdm_test_flag(toclose, FTDM_CHANNEL_INUSE)) { - ftdm_channel_close(&toclose); - } - i++; - } - } - } - ftdm_mutex_unlock(globals.span_mutex); - - return i ? FTDM_SUCCESS : FTDM_FAIL; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_load_tones(ftdm_span_t *span, const char *mapname) -{ - ftdm_config_t cfg; - char *var, *val; - int x = 0; - - if (!ftdm_config_open_file(&cfg, "tones.conf")) { - snprintf(span->last_error, sizeof(span->last_error), "error loading tones."); - return FTDM_FAIL; - } - - while (ftdm_config_next_pair(&cfg, &var, &val)) { - int detect = 0; - - if (!strcasecmp(cfg.category, mapname) && var && val) { - uint32_t index; - char *name = NULL; - - if (!strncasecmp(var, "detect-", 7)) { - name = var + 7; - detect = 1; - } else if (!strncasecmp(var, "generate-", 9)) { - name = var + 9; - } else { - ftdm_log(FTDM_LOG_WARNING, "Unknown tone name %s\n", var); - continue; - } - - index = ftdm_str2ftdm_tonemap(name); - - if (index >= FTDM_TONEMAP_INVALID || index == FTDM_TONEMAP_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Unknown tone name %s\n", name); - } else { - if (detect) { - char *p = val, *next; - int i = 0; - do { - teletone_process_t this; - next = strchr(p, ','); - this = (teletone_process_t)atof(p); - span->tone_detect_map[index].freqs[i++] = this; - if (next) { - p = next + 1; - } - } while (next); - ftdm_log(FTDM_LOG_DEBUG, "added tone detect [%s] = [%s]\n", name, val); - } else { - ftdm_log(FTDM_LOG_DEBUG, "added tone generation [%s] = [%s]\n", name, val); - ftdm_copy_string(span->tone_map[index], val, sizeof(span->tone_map[index])); - } - x++; - } - } - } - - ftdm_config_close_file(&cfg); - - if (!x) { - snprintf(span->last_error, sizeof(span->last_error), "error loading tones."); - return FTDM_FAIL; - } - - return FTDM_SUCCESS; - -} - -#define FTDM_SLINEAR_MAX_VALUE 32767 -#define FTDM_SLINEAR_MIN_VALUE -32767 -static void reset_gain_table(uint8_t *gain_table, float new_gain, ftdm_codec_t codec_gain) -{ - /* sample value */ - uint8_t sv = 0; - /* linear gain factor */ - float lingain = 0; - /* linear value for each table sample */ - float linvalue = 0; - /* amplified (or attenuated in case of negative amplification) sample value */ - int ampvalue = 0; - - /* gain tables are only for alaw and ulaw */ - if (codec_gain != FTDM_CODEC_ALAW && codec_gain != FTDM_CODEC_ULAW) { - ftdm_log(FTDM_LOG_DEBUG, "Not resetting gain table because codec is not ALAW or ULAW but %d\n", codec_gain); - return; - } - - if (!new_gain) { - /* for a 0.0db gain table, each alaw/ulaw sample value is left untouched (0 ==0, 1 == 1, 2 == 2 etc)*/ - sv = 0; - while (1) { - gain_table[sv] = sv; - if (sv == (FTDM_GAINS_TABLE_SIZE-1)) { - break; - } - sv++; - } - return; - } - - /* use the 20log rule to increase the gain: http://en.wikipedia.org/wiki/Gain, http:/en.wipedia.org/wiki/20_log_rule#Definitions */ - lingain = (float)pow(10.0, new_gain/ 20.0); - sv = 0; - while (1) { - /* get the linear value for this alaw/ulaw sample value */ - linvalue = codec_gain == FTDM_CODEC_ALAW ? (float)alaw_to_linear(sv) : (float)ulaw_to_linear(sv); - - /* multiply the linear value and the previously calculated linear gain */ - ampvalue = (int)(linvalue * lingain); - - /* chop it if goes beyond the limits */ - if (ampvalue > FTDM_SLINEAR_MAX_VALUE) { - ampvalue = FTDM_SLINEAR_MAX_VALUE; - } - - if (ampvalue < FTDM_SLINEAR_MIN_VALUE) { - ampvalue = FTDM_SLINEAR_MIN_VALUE; - } - gain_table[sv] = codec_gain == FTDM_CODEC_ALAW ? linear_to_alaw(ampvalue) : linear_to_ulaw(ampvalue); - if (sv == (FTDM_GAINS_TABLE_SIZE-1)) { - break; - } - sv++; - } -} - -FT_DECLARE(ftdm_status_t) ftdm_span_add_channel(ftdm_span_t *span, ftdm_socket_t sockfd, ftdm_chan_type_t type, ftdm_channel_t **chan) -{ - unsigned char i = 0; - if (span->chan_count < FTDM_MAX_CHANNELS_SPAN) { - ftdm_channel_t *new_chan = span->channels[++span->chan_count]; - - if (!new_chan) { -#ifdef FTDM_DEBUG_CHAN_MEMORY - void *chanmem = NULL; - int pages = 1; - int pagesize = sysconf(_SC_PAGE_SIZE); - if (sizeof(*new_chan) > pagesize) { - pages = sizeof(*new_chan)/pagesize; - pages++; - } - ftdm_log(FTDM_LOG_DEBUG, "Allocating %d pages of %d bytes for channel of size %d\n", pages, pagesize, sizeof(*new_chan)); - if (posix_memalign(&chanmem, pagesize, pagesize*pages)) { - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "Channel pages allocated start at mem %p\n", chanmem); - memset(chanmem, 0, sizeof(*new_chan)); - new_chan = chanmem; -#else - if (!(new_chan = ftdm_calloc(1, sizeof(*new_chan)))) { - return FTDM_FAIL; - } -#endif - span->channels[span->chan_count] = new_chan; - } - - new_chan->type = type; - new_chan->sockfd = sockfd; - new_chan->fio = span->fio; - new_chan->span_id = span->span_id; - new_chan->chan_id = span->chan_count; - new_chan->span = span; - new_chan->fds[FTDM_READ_TRACE_INDEX] = -1; - new_chan->fds[FTDM_WRITE_TRACE_INDEX] = -1; - new_chan->data_type = FTDM_TYPE_CHANNEL; - if (!new_chan->dtmf_on) { - new_chan->dtmf_on = FTDM_DEFAULT_DTMF_ON; - } - - if (!new_chan->dtmf_off) { - new_chan->dtmf_off = FTDM_DEFAULT_DTMF_OFF; - } - - ftdm_mutex_create(&new_chan->mutex); - ftdm_mutex_create(&new_chan->pre_buffer_mutex); - - ftdm_buffer_create(&new_chan->digit_buffer, 128, 128, 0); - ftdm_buffer_create(&new_chan->gen_dtmf_buffer, 128, 128, 0); - - new_chan->dtmf_hangup_buf = ftdm_calloc (span->dtmf_hangup_len + 1, sizeof (char)); - - /* set 0.0db gain table */ - i = 0; - while (1) { - new_chan->txgain_table[i] = i; - new_chan->rxgain_table[i] = i; - if (i == (sizeof(new_chan->txgain_table)-1)) { - break; - } - i++; - } - - ftdm_set_flag(new_chan, FTDM_CHANNEL_CONFIGURED | FTDM_CHANNEL_READY); - new_chan->state = FTDM_CHANNEL_STATE_DOWN; - new_chan->state_status = FTDM_STATE_STATUS_COMPLETED; - *chan = new_chan; - return FTDM_SUCCESS; - } - - return FTDM_FAIL; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_find_by_name(const char *name, ftdm_span_t **span) -{ - ftdm_status_t status = FTDM_FAIL; - - ftdm_mutex_lock(globals.span_mutex); - if (!ftdm_strlen_zero(name)) { - if ((*span = hashtable_search(globals.span_hash, (void *)name))) { - status = FTDM_SUCCESS; - } else { - int span_id = atoi(name); - - ftdm_span_find(span_id, span); - if (*span) { - status = FTDM_SUCCESS; - } - } - } - ftdm_mutex_unlock(globals.span_mutex); - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_find(uint32_t id, ftdm_span_t **span) -{ - ftdm_span_t *fspan = NULL, *sp; - - if (id > FTDM_MAX_SPANS_INTERFACE) { - return FTDM_FAIL; - } - - ftdm_mutex_lock(globals.span_mutex); - for (sp = globals.spans; sp; sp = sp->next) { - if (sp->span_id == id) { - fspan = sp; - break; - } - } - ftdm_mutex_unlock(globals.span_mutex); - - if (!fspan || !ftdm_test_flag(fspan, FTDM_SPAN_CONFIGURED)) { - return FTDM_FAIL; - } - - *span = fspan; - - return FTDM_SUCCESS; - -} - -FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms, short *poll_events) -{ - assert(span->fio != NULL); - - if (span->fio->poll_event) { - return span->fio->poll_event(span, ms, poll_events); - } else { - ftdm_log(FTDM_LOG_ERROR, "poll_event method not implemented in module %s!", span->fio->name); - } - - return FTDM_NOTIMPL; -} - -/* handle oob events and send the proper SIGEVENT signal to user, when applicable */ -static __inline__ ftdm_status_t ftdm_event_handle_oob(ftdm_event_t *event) -{ - ftdm_sigmsg_t sigmsg; - ftdm_status_t status = FTDM_SUCCESS; - ftdm_channel_t *fchan = event->channel; - ftdm_span_t *span = fchan->span; - - memset(&sigmsg, 0, sizeof(sigmsg)); - sigmsg.span_id = span->span_id; - sigmsg.chan_id = fchan->chan_id; - sigmsg.channel = fchan; - switch (event->enum_id) { - case FTDM_OOB_ALARM_CLEAR: - { - sigmsg.event_id = FTDM_SIGEVENT_ALARM_CLEAR; - ftdm_clear_flag_locked(fchan, FTDM_CHANNEL_IN_ALARM); - status = ftdm_span_send_signal(span, &sigmsg); - } - break; - case FTDM_OOB_ALARM_TRAP: - { - sigmsg.event_id = FTDM_SIGEVENT_ALARM_TRAP; - ftdm_set_flag_locked(fchan, FTDM_CHANNEL_IN_ALARM); - status = ftdm_span_send_signal(span, &sigmsg); - } - break; - default: - /* NOOP */ - break; - } - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n"); - - if (!span->fio->next_event) { - ftdm_log(FTDM_LOG_ERROR, "next_event method not implemented in module %s!", span->fio->name); - return FTDM_NOTIMPL; - } - - status = span->fio->next_event(span, event); - if (status != FTDM_SUCCESS) { - return status; - } - - status = ftdm_event_handle_oob(*event); - if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to handle event %d\n", (*event)->e_type); - } - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_span_t *span = ftdmchan->span; - ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n"); - - ftdm_channel_lock(ftdmchan); - - if (!span->fio->channel_next_event) { - ftdm_log(FTDM_LOG_ERROR, "channel_next_event method not implemented in module %s!\n", span->fio->name); - status = FTDM_NOTIMPL; - goto done; - } - - if (ftdm_test_io_flag(ftdmchan, FTDM_CHANNEL_IO_EVENT)) { - ftdm_clear_io_flag(ftdmchan, FTDM_CHANNEL_IO_EVENT); - } - - status = span->fio->channel_next_event(ftdmchan, event); - if (status != FTDM_SUCCESS) { - goto done; - } - - status = ftdm_event_handle_oob(*event); - if (status != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "failed to handle event %d\n", (*event)->e_type); - } - -done: - ftdm_channel_unlock(ftdmchan); - return status; -} - -static ftdm_status_t ftdmchan_fsk_write_sample(int16_t *buf, ftdm_size_t buflen, void *user_data) -{ - ftdm_channel_t *ftdmchan = (ftdm_channel_t *) user_data; - ftdm_buffer_write(ftdmchan->fsk_buffer, buf, buflen * 2); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_send_fsk_data(ftdm_channel_t *ftdmchan, ftdm_fsk_data_state_t *fsk_data, float db_level) -{ - struct ftdm_fsk_modulator fsk_trans; - - if (!ftdmchan->fsk_buffer) { - ftdm_buffer_create(&ftdmchan->fsk_buffer, 128, 128, 0); - } else { - ftdm_buffer_zero(ftdmchan->fsk_buffer); - } - - if (ftdmchan->token_count > 1) { - ftdm_fsk_modulator_init(&fsk_trans, FSK_BELL202, ftdmchan->rate, fsk_data, db_level, 80, 5, 0, ftdmchan_fsk_write_sample, ftdmchan); - ftdm_fsk_modulator_send_all((&fsk_trans)); - } else { - ftdm_fsk_modulator_init(&fsk_trans, FSK_BELL202, ftdmchan->rate, fsk_data, db_level, 180, 5, 300, ftdmchan_fsk_write_sample, ftdmchan); - ftdm_fsk_modulator_send_all((&fsk_trans)); - ftdmchan->buffer_delay = 3500 / ftdmchan->effective_interval; - } - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_clear_token(ftdm_channel_t *ftdmchan, const char *token) -{ - ftdm_status_t status = FTDM_FAIL; - - ftdm_mutex_lock(ftdmchan->mutex); - if (token == NULL) { - memset(ftdmchan->tokens, 0, sizeof(ftdmchan->tokens)); - ftdmchan->token_count = 0; - } else if (*token != '\0') { - char tokens[FTDM_MAX_TOKENS][FTDM_TOKEN_STRLEN]; - int32_t i, count = ftdmchan->token_count; - memcpy(tokens, ftdmchan->tokens, sizeof(tokens)); - memset(ftdmchan->tokens, 0, sizeof(ftdmchan->tokens)); - ftdmchan->token_count = 0; - - for (i = 0; i < count; i++) { - if (strcmp(tokens[i], token)) { - ftdm_copy_string(ftdmchan->tokens[ftdmchan->token_count], tokens[i], sizeof(ftdmchan->tokens[ftdmchan->token_count])); - ftdmchan->token_count++; - } - } - - status = FTDM_SUCCESS; - } - ftdm_mutex_unlock(ftdmchan->mutex); - - return status; -} - -FT_DECLARE(void) ftdm_channel_rotate_tokens(ftdm_channel_t *ftdmchan) -{ - if (ftdmchan->token_count) { - memmove(ftdmchan->tokens[1], ftdmchan->tokens[0], ftdmchan->token_count * FTDM_TOKEN_STRLEN); - ftdm_copy_string(ftdmchan->tokens[0], ftdmchan->tokens[ftdmchan->token_count], FTDM_TOKEN_STRLEN); - *ftdmchan->tokens[ftdmchan->token_count] = '\0'; - } -} - -FT_DECLARE(void) ftdm_channel_replace_token(ftdm_channel_t *ftdmchan, const char *old_token, const char *new_token) -{ - unsigned int i; - - if (ftdmchan->token_count) { - for(i = 0; i < ftdmchan->token_count; i++) { - if (!strcmp(ftdmchan->tokens[i], old_token)) { - ftdm_copy_string(ftdmchan->tokens[i], new_token, FTDM_TOKEN_STRLEN); - break; - } - } - } -} - -FT_DECLARE(void) ftdm_channel_set_private(ftdm_channel_t *ftdmchan, void *pvt) -{ - ftdmchan->user_private = pvt; -} - -FT_DECLARE(void *) ftdm_channel_get_private(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->user_private; -} - -FT_DECLARE(uint32_t) ftdm_channel_get_token_count(const ftdm_channel_t *ftdmchan) -{ - uint32_t count; - ftdm_mutex_lock(ftdmchan->mutex); - count = ftdmchan->token_count; - ftdm_mutex_unlock(ftdmchan->mutex); - return count; -} - -FT_DECLARE(uint32_t) ftdm_channel_get_io_interval(const ftdm_channel_t *ftdmchan) -{ - uint32_t count; - ftdm_mutex_lock(ftdmchan->mutex); - count = ftdmchan->effective_interval; - ftdm_mutex_unlock(ftdmchan->mutex); - return count; -} - -FT_DECLARE(uint32_t) ftdm_channel_get_io_packet_len(const ftdm_channel_t *ftdmchan) -{ - uint32_t count; - ftdm_mutex_lock(ftdmchan->mutex); - count = ftdmchan->packet_len; - ftdm_mutex_unlock(ftdmchan->mutex); - return count; -} - -FT_DECLARE(uint32_t) ftdm_channel_get_type(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->type; -} - -FT_DECLARE(ftdm_codec_t) ftdm_channel_get_codec(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->effective_codec; -} - -FT_DECLARE(const char *) ftdm_channel_get_token(const ftdm_channel_t *ftdmchan, uint32_t tokenid) -{ - const char *token = NULL; - ftdm_mutex_lock(ftdmchan->mutex); - - if (ftdmchan->token_count <= tokenid) { - ftdm_mutex_unlock(ftdmchan->mutex); - return NULL; - } - - token = ftdmchan->tokens[tokenid]; - ftdm_mutex_unlock(ftdmchan->mutex); - return token; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_add_token(ftdm_channel_t *ftdmchan, char *token, int end) -{ - ftdm_status_t status = FTDM_FAIL; - - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdmchan->token_count < FTDM_MAX_TOKENS) { - if (end) { - ftdm_copy_string(ftdmchan->tokens[ftdmchan->token_count++], token, FTDM_TOKEN_STRLEN); - } else { - memmove(ftdmchan->tokens[1], ftdmchan->tokens[0], ftdmchan->token_count * FTDM_TOKEN_STRLEN); - ftdm_copy_string(ftdmchan->tokens[0], token, FTDM_TOKEN_STRLEN); - ftdmchan->token_count++; - } - status = FTDM_SUCCESS; - } - ftdm_mutex_unlock(ftdmchan->mutex); - - return status; -} - - -FT_DECLARE(uint32_t) ftdm_group_get_id(const ftdm_group_t *group) -{ - return group->group_id; -} - -FT_DECLARE(ftdm_status_t) ftdm_group_channel_use_count(ftdm_group_t *group, uint32_t *count) -{ - uint32_t j; - - *count = 0; - - if (!group) { - return FTDM_FAIL; - } - - for(j = 0; j < group->chan_count && group->channels[j]; j++) { - if (group->channels[j]) { - if (ftdm_test_flag(group->channels[j], FTDM_CHANNEL_INUSE)) { - (*count)++; - } - } - } - - return FTDM_SUCCESS; -} - -static __inline__ int chan_is_avail(ftdm_channel_t *check) -{ - if ((check->span->signal_type == FTDM_SIGTYPE_M2UA) || - (check->span->signal_type == FTDM_SIGTYPE_NONE)) { - if (!ftdm_test_flag(check, FTDM_CHANNEL_READY) || - ftdm_test_flag(check, FTDM_CHANNEL_INUSE) || - ftdm_test_flag(check, FTDM_CHANNEL_SUSPENDED) || - ftdm_test_flag(check, FTDM_CHANNEL_IN_ALARM) || - check->state != FTDM_CHANNEL_STATE_DOWN) { - return 0; - } - } else { - if (!ftdm_test_flag(check, FTDM_CHANNEL_READY) || - !ftdm_test_flag(check, FTDM_CHANNEL_SIG_UP) || - ftdm_test_flag(check, FTDM_CHANNEL_INUSE) || - ftdm_test_flag(check, FTDM_CHANNEL_SUSPENDED) || - ftdm_test_flag(check, FTDM_CHANNEL_IN_ALARM) || - check->state != FTDM_CHANNEL_STATE_DOWN) { - return 0; - } - } - /* release guard time check */ - if (check->span->sig_release_guard_time_ms && check->last_release_time) { - ftdm_time_t time_diff = (ftdm_current_time_in_ms() - check->last_release_time); - if (time_diff < check->span->sig_release_guard_time_ms) { - return 0; - } - /* circuit now available for outbound dialing */ - check->last_release_time = 0; - ftdm_log_chan(check, FTDM_LOG_DEBUG, "Channel is now available, release guard timer expired %" FTDM_UINT64_FMT "ms ago\n", (time_diff - check->span->sig_release_guard_time_ms)); - } - return 1; -} - -static __inline__ int chan_voice_is_avail(ftdm_channel_t *check) -{ - if (!FTDM_IS_VOICE_CHANNEL(check)) { - return 0; - } - return chan_is_avail(check); -} - -static __inline__ int request_voice_channel(ftdm_channel_t *check, ftdm_channel_t **ftdmchan, - ftdm_caller_data_t *caller_data, ftdm_hunt_direction_t direction) -{ - ftdm_status_t status; - if (chan_voice_is_avail(check)) { - /* unlocked testing passed, try again with the channel locked */ - ftdm_mutex_lock(check->mutex); - if (chan_voice_is_avail(check)) { - if (check->span && check->span->channel_request) { - /* I am only unlocking here cuz this function is called - * sometimes with the group or span lock held and were - * blocking anyone hunting for channels available and - * I believe teh channel_request() function may take - * a bit of time. However channel_request is a callback - * used by boost and may be only a few other old sig mods - * and it should be deprecated */ - ftdm_mutex_unlock(check->mutex); - ftdm_set_caller_data(check->span, caller_data); - status = check->span->channel_request(check->span, check->chan_id, - direction, caller_data, ftdmchan); - if (status == FTDM_SUCCESS) { - return 1; - } - } else { - status = ftdm_channel_open_chan(check); - if (status == FTDM_SUCCESS) { - *ftdmchan = check; - ftdm_set_flag(check, FTDM_CHANNEL_OUTBOUND); -#if 0 - ftdm_mutex_unlock(check->mutex); -#endif - return 1; - } - } - } - ftdm_mutex_unlock(check->mutex); - } - return 0; -} - -static void __inline__ calculate_best_rate(ftdm_channel_t *check, ftdm_channel_t **best_rated, int *best_rate) -{ - if (ftdm_test_flag(check->span, FTDM_SPAN_USE_AV_RATE)) { - ftdm_mutex_lock(check->mutex); - if (ftdm_test_flag(check, FTDM_CHANNEL_INUSE)) { - /* twiddle */ - } else if (ftdm_test_flag(check, FTDM_CHANNEL_SIG_UP)) { - /* twiddle */ - } else if (check->availability_rate > *best_rate){ - /* the channel is not in use and the signaling status is down, - * it is a potential candidate to place a call */ - *best_rated = check; - *best_rate = check->availability_rate; - } - ftdm_mutex_unlock(check->mutex); - } -} - -static ftdm_status_t __inline__ get_best_rated(ftdm_channel_t **fchan, ftdm_channel_t *best_rated) -{ - ftdm_status_t status; - - if (!best_rated) { - return FTDM_FAIL; - } - - ftdm_mutex_lock(best_rated->mutex); - - if (ftdm_test_flag(best_rated, FTDM_CHANNEL_INUSE)) { - ftdm_mutex_unlock(best_rated->mutex); - return FTDM_FAIL; - } - - ftdm_log_chan_msg(best_rated, FTDM_LOG_DEBUG, "I may not be available but I had the best availability rate, trying to open I/O now\n"); - - status = ftdm_channel_open_chan(best_rated); - if (status != FTDM_SUCCESS) { - ftdm_mutex_unlock(best_rated->mutex); - return FTDM_FAIL; - } - *fchan = best_rated; - ftdm_set_flag(best_rated, FTDM_CHANNEL_OUTBOUND); -#if 0 - ftdm_mutex_unlock(best_rated->mutex); -#endif - return FTDM_SUCCESS; -} - -static uint32_t __inline__ rr_next(uint32_t last, uint32_t min, uint32_t max, ftdm_hunt_direction_t direction) -{ - uint32_t next = min; - - ftdm_log(FTDM_LOG_DEBUG, "last = %d, min = %d, max = %d\n", last, min, max); - - if (direction == FTDM_HUNT_RR_UP) { - next = (last >= max) ? min : ++last; - } else { - next = (last <= min) ? max : --last; - } - return next; -} - - -FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan) -{ - int availability = -1; - ftdm_channel_lock(ftdmchan); - if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_AV_RATE)) { - availability = ftdmchan->availability_rate; - } - ftdm_channel_unlock(ftdmchan); - return availability; -} - -static ftdm_status_t _ftdm_channel_open_by_group(uint32_t group_id, ftdm_hunt_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_channel_t *check = NULL; - ftdm_channel_t *best_rated = NULL; - ftdm_group_t *group = NULL; - int best_rate = 0; - uint32_t i = 0; - uint32_t count = 0; - uint32_t first_channel = 0; - - if (group_id) { - ftdm_group_find(group_id, &group); - } - - if (!group) { - ftdm_log(FTDM_LOG_ERROR, "Group %d not defined!\n", group_id); - *ftdmchan = NULL; - return FTDM_FAIL; - } - - ftdm_group_channel_use_count(group, &count); - - if (count >= group->chan_count) { - ftdm_log(FTDM_LOG_WARNING, "All circuits are busy (%d channels used out of %d available).\n", count, group->chan_count); - *ftdmchan = NULL; - return FTDM_FAIL; - } - - - if (direction == FTDM_HUNT_BOTTOM_UP) { - i = 0; - } else if (direction == FTDM_HUNT_RR_DOWN || direction == FTDM_HUNT_RR_UP) { - i = rr_next(group->last_used_index, 0, group->chan_count - 1, direction); - first_channel = i; - } else { - i = group->chan_count-1; - } - - ftdm_mutex_lock(group->mutex); - for (;;) { - - if (!(check = group->channels[i])) { - status = FTDM_FAIL; - break; - } - - if (request_voice_channel(check, ftdmchan, caller_data, direction)) { - status = FTDM_SUCCESS; - if (direction == FTDM_HUNT_RR_UP || direction == FTDM_HUNT_RR_DOWN) { - group->last_used_index = i; - } - break; - } - - calculate_best_rate(check, &best_rated, &best_rate); - - if (direction == FTDM_HUNT_BOTTOM_UP) { - if (i >= (group->chan_count - 1)) { - break; - } - i++; - } else if (direction == FTDM_HUNT_RR_DOWN || direction == FTDM_HUNT_RR_UP) { - if (check == best_rated) { - group->last_used_index = i; - } - i = rr_next(i, 0, group->chan_count - 1, direction); - if (first_channel == i) { - break; - } - } else { - if (i == 0) { - break; - } - i--; - } - } - - if (status == FTDM_FAIL) { - status = get_best_rated(ftdmchan, best_rated); - } - - ftdm_mutex_unlock(group->mutex); - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_hunt_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) -{ - ftdm_status_t status; - status = _ftdm_channel_open_by_group(group_id, direction, caller_data, ftdmchan); - if (status == FTDM_SUCCESS) { - ftdm_channel_t *fchan = *ftdmchan; - ftdm_channel_unlock(fchan); - } - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_channel_use_count(ftdm_span_t *span, uint32_t *count) -{ - uint32_t j; - - *count = 0; - - if (!span || !ftdm_test_flag(span, FTDM_SPAN_CONFIGURED)) { - return FTDM_FAIL; - } - - for(j = 1; j <= span->chan_count && span->channels[j]; j++) { - if (span->channels[j]) { - if (ftdm_test_flag(span->channels[j], FTDM_CHANNEL_INUSE)) { - (*count)++; - } - } - } - - return FTDM_SUCCESS; -} - -/* Hunt a channel by span, if successful the channel is returned locked */ -static ftdm_status_t _ftdm_channel_open_by_span(uint32_t span_id, ftdm_hunt_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_channel_t *check = NULL; - ftdm_channel_t *best_rated = NULL; - ftdm_span_t *span = NULL; - int best_rate = 0; - uint32_t i = 0; - uint32_t count = 0; - uint32_t first_channel = 0; - - *ftdmchan = NULL; - - if (!span_id) { - ftdm_log(FTDM_LOG_CRIT, "No span supplied\n"); - return FTDM_FAIL; - } - - ftdm_span_find(span_id, &span); - - if (!span || !ftdm_test_flag(span, FTDM_SPAN_CONFIGURED)) { - ftdm_log(FTDM_LOG_CRIT, "span %d not defined or configured!\n", span_id); - return FTDM_FAIL; - } - - ftdm_span_channel_use_count(span, &count); - - if (count >= span->chan_count) { - ftdm_log(FTDM_LOG_WARNING, "All circuits are busy: active=%i max=%i.\n", count, span->chan_count); - return FTDM_FAIL; - } - - if (span->channel_request && !ftdm_test_flag(span, FTDM_SPAN_SUGGEST_CHAN_ID)) { - ftdm_set_caller_data(span, caller_data); - return span->channel_request(span, 0, direction, caller_data, ftdmchan); - } - - ftdm_mutex_lock(span->mutex); - - if (direction == FTDM_HUNT_BOTTOM_UP) { - i = 1; - } else if (direction == FTDM_HUNT_RR_DOWN || direction == FTDM_HUNT_RR_UP) { - i = rr_next(span->last_used_index, 1, span->chan_count, direction); - first_channel = i; - } else { - i = span->chan_count; - } - - for(;;) { - - if (direction == FTDM_HUNT_BOTTOM_UP) { - if (i > span->chan_count) { - break; - } - } else { - if (i == 0) { - break; - } - } - - if (!(check = span->channels[i])) { - status = FTDM_FAIL; - break; - } - - if (request_voice_channel(check, ftdmchan, caller_data, direction)) { - status = FTDM_SUCCESS; - if (direction == FTDM_HUNT_RR_UP || direction == FTDM_HUNT_RR_DOWN) { - span->last_used_index = i; - } - break; - } - - calculate_best_rate(check, &best_rated, &best_rate); - - if (direction == FTDM_HUNT_BOTTOM_UP) { - i++; - } else if (direction == FTDM_HUNT_RR_DOWN || direction == FTDM_HUNT_RR_UP) { - if (check == best_rated) { - span->last_used_index = i; - } - i = rr_next(i, 1, span->chan_count, direction); - if (first_channel == i) { - break; - } - } else { - i--; - } - } - - if (status == FTDM_FAIL) { - status = get_best_rated(ftdmchan, best_rated); - } - - ftdm_mutex_unlock(span->mutex); - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_hunt_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) -{ - ftdm_status_t status; - status = _ftdm_channel_open_by_span(span_id, direction, caller_data, ftdmchan); - if (status == FTDM_SUCCESS) { - ftdm_channel_t *fchan = *ftdmchan; - ftdm_channel_unlock(fchan); - } - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan) -{ - ftdm_status_t status = FTDM_FAIL; - - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "invalid ftdmchan pointer\n"); - - ftdm_mutex_lock(ftdmchan->mutex); - - if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "Channel is suspended\n"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is suspended\n"); - goto done; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) && !ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "Channel is alarmed\n"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is alarmed\n"); - goto done; - } - - if (globals.cpu_monitor.alarm && - globals.cpu_monitor.alarm_action_flags & FTDM_CPU_ALARM_ACTION_REJECT) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "CPU usage alarm is on - refusing to open channel\n"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "CPU usage alarm is on - refusing to open channel\n"); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_SWITCH_CONGESTION; - goto done; - } - } - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_READY)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Channel is not ready"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is not ready\n"); - goto done; - } - - status = ftdmchan->fio->open(ftdmchan); - if (status == FTDM_SUCCESS) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OPEN | FTDM_CHANNEL_INUSE); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "IO open failed: %d\n", status); - } - -done: - - ftdm_mutex_unlock(ftdmchan->mutex); - - return status; -} - -static ftdm_status_t _ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan, uint8_t physical) -{ - ftdm_channel_t *check = NULL; - ftdm_span_t *span = NULL; - ftdm_channel_t *best_rated = NULL; - ftdm_status_t status = FTDM_FAIL; - int best_rate = 0; - - *ftdmchan = NULL; - - ftdm_mutex_lock(globals.mutex); - - ftdm_span_find(span_id, &span); - - if (!span) { - ftdm_log(FTDM_LOG_CRIT, "Could not find span!\n"); - goto done; - } - - if (!ftdm_test_flag(span, FTDM_SPAN_CONFIGURED)) { - ftdm_log(FTDM_LOG_CRIT, "Span %d is not configured\n", span_id); - goto done; - } - - if (span->channel_request) { - ftdm_log(FTDM_LOG_ERROR, "Individual channel selection not implemented on this span.\n"); - goto done; - } - - if (physical) { /* Open by physical */ - ftdm_channel_t *fchan = NULL; - ftdm_iterator_t *citer = NULL; - ftdm_iterator_t *curr = NULL; - - if (chan_id < 1) { - ftdm_log(FTDM_LOG_ERROR, "Invalid physical channel %d to open in span %d\n", chan_id, span_id); - status = FTDM_FAIL; - goto done; - } - - citer = ftdm_span_get_chan_iterator(span, NULL); - if (!citer) { - status = ENOMEM; - goto done; - } - - for (curr = citer ; curr; curr = ftdm_iterator_next(curr)) { - fchan = ftdm_iterator_current(curr); - if (fchan->physical_chan_id == chan_id) { - check = fchan; - break; - } - } - - ftdm_iterator_free(citer); - if (!check) { - ftdm_log(FTDM_LOG_CRIT, "Wow, no physical channel %d in span %d\n", chan_id, span_id); - goto done; - } - } else { /* Open by logical */ - if (chan_id < 1 || chan_id > span->chan_count) { - ftdm_log(FTDM_LOG_ERROR, "Invalid channel %d to open in span %d\n", chan_id, span_id); - goto done; - } - - if (!(check = span->channels[chan_id])) { - ftdm_log(FTDM_LOG_CRIT, "Wow, no channel %d in span %d\n", chan_id, span_id); - goto done; - } - } - - ftdm_channel_lock(check); - - if (ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { - /* let them know is already open, but return the channel anyway */ - status = FTDM_EBUSY; - *ftdmchan = check; - goto unlockchan; - } - - /* The following if's and gotos replace a big if (this || this || this || this) else { nothing; } */ - - /* if it is not a voice channel, nothing else to check to open it */ - if (!FTDM_IS_VOICE_CHANNEL(check)) { - goto openchan; - } - - /* if it's an FXS device with a call active and has callwaiting enabled, we allow to open it twice */ - if (check->type == FTDM_CHAN_TYPE_FXS - && check->token_count == 1 - && ftdm_channel_test_feature(check, FTDM_CHANNEL_FEATURE_CALLWAITING)) { - goto openchan; - } - - /* if channel is available, time to open it */ - if (chan_is_avail(check)) { - goto openchan; - } - - /* not available, but still might be available ... */ - calculate_best_rate(check, &best_rated, &best_rate); - if (best_rated) { - goto openchan; - } - - /* channel is unavailable, do not open the channel */ - goto unlockchan; - -openchan: - if (!ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { - status = check->fio->open(check); - if (status == FTDM_SUCCESS) { - ftdm_set_flag(check, FTDM_CHANNEL_OPEN); - } - } else { - status = FTDM_SUCCESS; - } - ftdm_set_flag(check, FTDM_CHANNEL_INUSE); - ftdm_set_flag(check, FTDM_CHANNEL_OUTBOUND); - *ftdmchan = check; - - /* we've got the channel, do not unlock it */ - goto done; - -unlockchan: - ftdm_channel_unlock(check); - -done: - ftdm_mutex_unlock(globals.mutex); - if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open channel %d:%d\n", span_id, chan_id); - } - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan) -{ - ftdm_status_t status; - status = _ftdm_channel_open(span_id, chan_id, ftdmchan, 0); - if (status == FTDM_SUCCESS) { - ftdm_channel_t *fchan = *ftdmchan; - ftdm_channel_unlock(fchan); - } - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_open_ph(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan) -{ - ftdm_status_t status; - status = _ftdm_channel_open(span_id, chan_id, ftdmchan, 1); - if (status == FTDM_SUCCESS) { - ftdm_channel_t *fchan = *ftdmchan; - ftdm_channel_unlock(fchan); - } - return status; -} - -FT_DECLARE(uint32_t) ftdm_channel_get_id(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->chan_id; -} - -FT_DECLARE(uint32_t) ftdm_channel_get_ph_id(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->physical_chan_id; -} - -FT_DECLARE(uint32_t) ftdm_channel_get_span_id(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->span_id; -} - -FT_DECLARE(ftdm_span_t *) ftdm_channel_get_span(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->span; -} - -FT_DECLARE(const char *) ftdm_channel_get_span_name(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->span->name; -} - -FT_DECLARE(void) ftdm_span_set_trunk_type(ftdm_span_t *span, ftdm_trunk_type_t type) -{ - span->trunk_type = type; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_set_blocking_mode(const ftdm_span_t *span, ftdm_bool_t enabled) -{ - ftdm_channel_t *fchan = NULL; - ftdm_iterator_t *citer = NULL; - ftdm_iterator_t *curr = NULL; - - citer = ftdm_span_get_chan_iterator(span, NULL); - if (!citer) { - return FTDM_ENOMEM; - } - - for (curr = citer ; curr; curr = ftdm_iterator_next(curr)) { - fchan = ftdm_iterator_current(curr); - if (enabled) { - ftdm_clear_flag_locked(fchan, FTDM_CHANNEL_NONBLOCK); - } else { - ftdm_set_flag_locked(fchan, FTDM_CHANNEL_NONBLOCK); - } - } - ftdm_iterator_free(citer); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span) -{ - return span->trunk_type; -} - -FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span) -{ - return ftdm_trunk_type2str(span->trunk_type); -} - -FT_DECLARE(void) ftdm_span_set_trunk_mode(ftdm_span_t *span, ftdm_trunk_mode_t mode) -{ - span->trunk_mode = mode; -} - -FT_DECLARE(ftdm_trunk_mode_t) ftdm_span_get_trunk_mode(const ftdm_span_t *span) -{ - return span->trunk_mode; -} - -FT_DECLARE(const char *) ftdm_span_get_trunk_mode_str(const ftdm_span_t *span) -{ - return ftdm_trunk_mode2str(span->trunk_mode); -} - -FT_DECLARE(uint32_t) ftdm_span_get_id(const ftdm_span_t *span) -{ - return span->span_id; -} - -FT_DECLARE(const char *) ftdm_span_get_name(const ftdm_span_t *span) -{ - return span->name; -} - -FT_DECLARE(const char *) ftdm_channel_get_name(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->chan_name; -} - -FT_DECLARE(const char *) ftdm_channel_get_number(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->chan_number; -} - -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_hold(const ftdm_channel_t *ftdmchan) -{ - ftdm_bool_t condition; - ftdm_channel_lock(ftdmchan); - condition = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_HOLD) ? FTDM_TRUE : FTDM_FALSE; - ftdm_channel_unlock(ftdmchan); - return condition; -} - -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_answered(const ftdm_channel_t *ftdmchan) -{ - ftdm_bool_t condition = FTDM_FALSE; - - ftdm_channel_lock(ftdmchan); - condition = (ftdmchan->state == FTDM_CHANNEL_STATE_UP) ? FTDM_TRUE : FTDM_FALSE; - ftdm_channel_unlock(ftdmchan); - - return condition; -} - -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_busy(const ftdm_channel_t *ftdmchan) -{ - ftdm_bool_t condition = FTDM_FALSE; - - ftdm_channel_lock(ftdmchan); - condition = (ftdmchan->state == FTDM_CHANNEL_STATE_BUSY) ? FTDM_TRUE : FTDM_FALSE; - ftdm_channel_unlock(ftdmchan); - - return condition; -} - -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_hangup(const ftdm_channel_t *ftdmchan) -{ - ftdm_bool_t condition = FTDM_FALSE; - - ftdm_channel_lock(ftdmchan); - condition = (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP || ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) - ? FTDM_TRUE : FTDM_FALSE; - ftdm_channel_unlock(ftdmchan); - - return condition; -} - -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_done(const ftdm_channel_t *ftdmchan) -{ - ftdm_bool_t condition = FTDM_FALSE; - - ftdm_channel_lock(ftdmchan); - condition = (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) ? FTDM_TRUE : FTDM_FALSE; - ftdm_channel_unlock(ftdmchan); - - return condition; -} - -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hold(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status; - ftdm_channel_lock(ftdmchan); - - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_HOLD); - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_DIALTONE, 0, usrmsg); - ftdm_channel_unlock(ftdmchan); - - return status; -} - -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_unhold(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status; - - ftdm_channel_lock(ftdmchan); - - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 0, usrmsg); - - ftdm_channel_unlock(ftdmchan); - - return status; -} - -FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *fchan, ftdm_channel_indication_t indication, ftdm_status_t status) -{ - ftdm_sigmsg_t msg; - - if (!ftdm_test_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING)) { - return; - } - - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Acknowledging indication %s in state %s (rc = %d)\n", - ftdm_channel_indication2str(indication), ftdm_channel_state2str(fchan->state), status); - ftdm_clear_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING); - memset(&msg, 0, sizeof(msg)); - msg.channel = fchan; - msg.event_id = FTDM_SIGEVENT_INDICATION_COMPLETED; - msg.ev_data.indication_completed.indication = indication; - msg.ev_data.indication_completed.status = status; - ftdm_span_send_signal(fchan->span, &msg); -} - -/*! Answer call without locking the channel. The caller must have locked first */ -static ftdm_status_t _ftdm_channel_call_answer_nl(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status = FTDM_SUCCESS; - - if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { - /* We will fail RFC's if we not skip states, but some modules apart from ftmod_sangoma_isdn - * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so - * use FTDM_SPAN_USE_SKIP_STATES for now while we update the sig modules */ - - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1, usrmsg); - if (status != FTDM_SUCCESS) { - status = FTDM_ECANCELED; - goto done; - } - } - - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); - status = FTDM_ECANCELED; - goto done; - } - - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1, usrmsg); - if (status != FTDM_SUCCESS) { - status = FTDM_ECANCELED; - goto done; - } - } - - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); - status = FTDM_ECANCELED; - goto done; - } - } - - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1, usrmsg); - if (status != FTDM_SUCCESS) { - status = FTDM_ECANCELED; - goto done; - } - -done: - - return status; -} - -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status; - - /* we leave the locking up to ftdm_channel_call_indicate, DO NOT lock here since ftdm_channel_call_indicate expects - * the lock recursivity to be 1 */ - status = _ftdm_channel_call_indicate(file, func, line, ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, usrmsg); - - return status; -} - -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_transfer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, const char* arg, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status; - ftdm_usrmsg_t *msg = NULL; - ftdm_bool_t free_msg = FTDM_FALSE; - - if (!usrmsg) { - msg = ftdm_calloc(1, sizeof(*msg)); - ftdm_assert_return(msg, FTDM_FAIL, "Failed to allocate usr msg"); - memset(msg, 0, sizeof(*msg)); - free_msg = FTDM_TRUE; - } else { - msg = usrmsg; - } - - ftdm_usrmsg_add_var(msg, "transfer_arg", arg); - /* we leave the locking up to ftdm_channel_call_indicate, DO NOT lock here since ftdm_channel_call_indicate expects - * the lock recursivity to be 1 */ - status = _ftdm_channel_call_indicate(file, func, line, ftdmchan, FTDM_CHANNEL_INDICATE_TRANSFER, msg); - if (free_msg == FTDM_TRUE) { - ftdm_safe_free(msg); - } - return status; -} - -/* lock must be acquired by the caller! */ -static ftdm_status_t _ftdm_channel_call_hangup_nl(const char *file, const char *func, int line, ftdm_channel_t *chan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status = FTDM_SUCCESS; - - /* In native sigbridge mode we ignore hangup requests from the user and hangup only when the signaling module decides it */ - if (ftdm_test_flag(chan, FTDM_CHANNEL_NATIVE_SIGBRIDGE) && chan->state != FTDM_CHANNEL_STATE_TERMINATING) { - - ftdm_log_chan_ex(chan, file, func, line, FTDM_LOG_LEVEL_DEBUG, - "Ignoring hangup in channel in state %s (native bridge enabled)\n", ftdm_channel_state2str(chan->state)); - ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); - goto done; - } - - if (chan->state != FTDM_CHANNEL_STATE_DOWN) { - if (chan->state == FTDM_CHANNEL_STATE_HANGUP) { - /* make user's life easier, and just ignore double hangup requests */ - return FTDM_SUCCESS; - } - if (chan->hangup_timer) { - ftdm_sched_cancel_timer(globals.timingsched, chan->hangup_timer); - } - ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); - /* if a state change requested by the user was pending, a hangup certainly cancels that request */ - if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_channel_cancel_state(file, func, line, chan); - } - status = ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1, usrmsg); - } else { - /* the signaling stack did not touch the state, - * core is responsible from clearing flags and stuff, however, because ftmod_analog - * is a bitch in a serious need of refactoring, we also check whether the channel is open - * to avoid an spurious warning about the channel not being open. This is because ftmod_analog - * does not follow our convention of sending SIGEVENT_STOP and waiting for the user to move - * to HANGUP (implicitly through ftdm_channel_call_hangup(), as soon as ftmod_analog is fixed - * this check can be removed */ - if (ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_close(&chan); - } - } - -done: - return status; -} - -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup_with_cause(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_call_cause_t cause, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status = FTDM_SUCCESS; - ftdm_channel_lock(ftdmchan); - - ftdmchan->caller_data.hangup_cause = cause; - - status = _ftdm_channel_call_hangup_nl(file, func, line, ftdmchan, usrmsg); - - ftdm_channel_unlock(ftdmchan); - return status; -} - -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status = FTDM_SUCCESS; - - ftdm_channel_lock(ftdmchan); - - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; - - status = _ftdm_channel_call_hangup_nl(file, func, line, ftdmchan, usrmsg); - - ftdm_channel_unlock(ftdmchan); - return status; -} - -FT_DECLARE(const char *) ftdm_channel_get_last_error(const ftdm_channel_t *ftdmchan) -{ - return ftdmchan->last_error; -} - -FT_DECLARE(const char *) ftdm_span_get_last_error(const ftdm_span_t *span) -{ - return span->last_error; -} - -FT_DECLARE(ftdm_caller_data_t *) ftdm_channel_get_caller_data(ftdm_channel_t *ftdmchan) -{ - return &ftdmchan->caller_data; -} - -FT_DECLARE(ftdm_channel_t *) ftdm_span_get_channel(const ftdm_span_t *span, uint32_t chanid) -{ - ftdm_channel_t *chan; - ftdm_mutex_lock(span->mutex); - if (chanid == 0 || chanid > span->chan_count) { - ftdm_mutex_unlock(span->mutex); - return NULL; - } - chan = span->channels[chanid]; - ftdm_mutex_unlock(span->mutex); - return chan; -} - -FT_DECLARE(ftdm_channel_t *) ftdm_span_get_channel_ph(const ftdm_span_t *span, uint32_t chanid) -{ - ftdm_channel_t *chan = NULL; - ftdm_channel_t *fchan = NULL; - ftdm_iterator_t *citer = NULL; - ftdm_iterator_t *curr = NULL; - - ftdm_mutex_lock(span->mutex); - if (chanid == 0) { - ftdm_mutex_unlock(span->mutex); - return NULL; - } - - citer = ftdm_span_get_chan_iterator(span, NULL); - if (!citer) { - ftdm_mutex_unlock(span->mutex); - return NULL; - } - - for (curr = citer ; curr; curr = ftdm_iterator_next(curr)) { - fchan = ftdm_iterator_current(curr); - if (fchan->physical_chan_id == chanid) { - chan = fchan; - break; - } - } - - ftdm_iterator_free(citer); - - ftdm_mutex_unlock(span->mutex); - return chan; -} - -FT_DECLARE(uint32_t) ftdm_span_get_chan_count(const ftdm_span_t *span) -{ - uint32_t count; - ftdm_mutex_lock(span->mutex); - count = span->chan_count; - ftdm_mutex_unlock(span->mutex); - return count; -} - -FT_DECLARE(uint32_t) ftdm_channel_get_ph_span_id(const ftdm_channel_t *ftdmchan) -{ - uint32_t id; - ftdm_channel_lock(ftdmchan); - id = ftdmchan->physical_span_id; - ftdm_channel_unlock(ftdmchan); - return id; -} - -/* - * Every user requested indication *MUST* be acknowledged with the proper status (ftdm_status_t) - * However, if the indication fails before we notify the signaling stack, we don't need to ack - * but if we already notified the signaling stack about the indication, the signaling stack is - * responsible for the acknowledge. Bottom line is, whenever this function returns FTDM_SUCCESS - * someone *MUST* acknowledge the indication, either the signaling stack, this function or the core - * at some later point - * */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status = FTDM_SUCCESS; - - ftdm_assert_return(ftdmchan, FTDM_FAIL, "Null channel\n"); - - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Indicating %s in state %s\n", - ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); - - ftdm_channel_lock(ftdmchan); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE)) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, - "Ignoring indication %s in channel in state %s (native bridge enabled)\n", - ftdm_channel_indication2str(indication), - ftdm_channel_state2str(ftdmchan->state)); - status = FTDM_SUCCESS; - goto done; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IND_ACK_PENDING)) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Cannot indicate %s in channel with indication %s still pending in state %s\n", - ftdm_channel_indication2str(indication), - ftdm_channel_indication2str(ftdmchan->indication), - ftdm_channel_state2str(ftdmchan->state)); - status = FTDM_EBUSY; - goto done; - } - - ftdmchan->indication = indication; - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_IND_ACK_PENDING); - } - - if (indication != FTDM_CHANNEL_INDICATE_FACILITY && - ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Cannot indicate %s in outgoing channel in state %s\n", - ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); - status = FTDM_EINVAL; - goto done; - } - - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Ignoring indication %s because the call is in %s state\n", - ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); - status = FTDM_ECANCELED; - goto done; - } - - switch (indication) { - /* FIXME: ring and busy cannot be used with all signaling stacks - * (particularly isdn stacks I think, we should emulate or just move to hangup with busy cause) */ - case FTDM_CHANNEL_INDICATE_RINGING: - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RINGING, 1, usrmsg); - break; - case FTDM_CHANNEL_INDICATE_BUSY: - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_BUSY, 1, usrmsg); - break; - case FTDM_CHANNEL_INDICATE_PROCEED: - if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_PROCEED_STATE) || - ftdmchan->state >= FTDM_CHANNEL_STATE_PROCEED) { - ftdm_ack_indication(ftdmchan, indication, status); - goto done; - } - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROCEED, 1, usrmsg); - break; - case FTDM_CHANNEL_INDICATE_PROGRESS: - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1, usrmsg); - break; - case FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA: - if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1, usrmsg); - if (status != FTDM_SUCCESS) { - goto done; - } - } - - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_ex_msg(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Ignoring progress media because the call is terminating\n"); - goto done; - } - } - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1, usrmsg); - break; - case FTDM_CHANNEL_INDICATE_ANSWER: - status = _ftdm_channel_call_answer_nl(file, func, line, ftdmchan, usrmsg); - break; - case FTDM_CHANNEL_INDICATE_TRANSFER: - if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_TRANSFER)) { - ftdm_log_chan_ex_msg(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Transfer not supported\n"); - status = FTDM_EINVAL; - goto done; - } - status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_TRANSFER, 1, usrmsg); - break; - default: - /* See if signalling module can provide this indication */ - status = ftdm_channel_sig_indicate(ftdmchan, indication, usrmsg); - break; - } - -done: - ftdm_channel_unlock(ftdmchan); - - return status; -} - -FT_DECLARE(ftdm_status_t) _ftdm_channel_reset(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); - - ftdm_channel_lock(ftdmchan); - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RESET, 1, usrmsg); - ftdm_channel_unlock(ftdmchan); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_get_channel_from_string(const char *string_id, ftdm_span_t **out_span, ftdm_channel_t **out_channel) -{ - ftdm_status_t status = FTDM_SUCCESS; - int rc = 0; - ftdm_span_t *span = NULL; - ftdm_channel_t *ftdmchan = NULL; - unsigned span_id = 0; - unsigned chan_id = 0; - - *out_span = NULL; - *out_channel = NULL; - - if (!string_id) { - ftdm_log(FTDM_LOG_ERROR, "Cannot parse NULL channel id string\n"); - status = FTDM_EINVAL; - goto done; - } - - rc = sscanf(string_id, "%u:%u", &span_id, &chan_id); - if (rc != 2) { - ftdm_log(FTDM_LOG_ERROR, "Failed to parse channel id string '%s'\n", string_id); - status = FTDM_EINVAL; - goto done; - } - - status = ftdm_span_find(span_id, &span); - if (status != FTDM_SUCCESS || !span) { - ftdm_log(FTDM_LOG_ERROR, "Failed to find span for channel id string '%s'\n", string_id); - status = FTDM_EINVAL; - goto done; - } - - if (chan_id > (FTDM_MAX_CHANNELS_SPAN+1) || !(ftdmchan = span->channels[chan_id])) { - ftdm_log(FTDM_LOG_ERROR, "Invalid channel id string '%s'\n", string_id); - status = FTDM_EINVAL; - goto done; - } - - status = FTDM_SUCCESS; - *out_span = span; - *out_channel = ftdmchan; -done: - return status; -} - -/* this function MUST be called with the channel lock held with lock recursivity of 1 exactly, - * and the caller must be aware we might unlock the channel for a brief period of time and then lock it again */ -static ftdm_status_t _ftdm_channel_call_place_nl(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - const char *var = NULL; - ftdm_status_t status = FTDM_FAIL; - - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); - ftdm_assert_return(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND), FTDM_FAIL, "Call place, but outbound flag not set\n"); - - if (!ftdmchan->span->outgoing_call) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); - status = FTDM_ENOSYS; - goto done; - } - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot place call in channel that is not open!\n"); - goto done; - } - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot place call in non outbound channel in state %s!\n", ftdm_channel_state2str(ftdmchan->state)); - goto done; - } - - status = ftdmchan->span->outgoing_call(ftdmchan); - if (status == FTDM_BREAK) { - /* the signaling module detected glare on time */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Glare detected, you should hunt in another channel!\n"); - goto done; - } - - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to place call!\n"); - goto done; - } - - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED); - ftdm_call_set_call_id(ftdmchan, &ftdmchan->caller_data); - var = ftdm_usrmsg_get_var(usrmsg, "sigbridge_peer"); - if (var) { - ftdm_span_t *peer_span = NULL; - ftdm_channel_t *peer_chan = NULL; - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE); - ftdm_get_channel_from_string(var, &peer_span, &peer_chan); - if (peer_chan) { - ftdm_set_flag(peer_chan, FTDM_CHANNEL_NATIVE_SIGBRIDGE); - } - } - - /* if the signaling stack left the channel in state down on success, is expecting us to move to DIALING */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_DIALING, 1, usrmsg); - } else { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_DIALING, 0, usrmsg); - } - } else if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) && - !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { - - ftdm_channel_unlock(ftdmchan); - - ftdm_interrupt_wait(ftdmchan->state_completed_interrupt, 500); - - ftdm_channel_lock(ftdmchan); - } - -done: - ftdm_unused_arg(file); - ftdm_unused_arg(func); - ftdm_unused_arg(line); - return status; -} - -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status; - ftdm_channel_lock(ftdmchan); - - /* be aware that _ftdm_channl_call_place_nl can unlock/lock the channel quickly if working in blocking mode */ - status = _ftdm_channel_call_place_nl(file, func, line, ftdmchan, usrmsg); - - ftdm_channel_unlock(ftdmchan); - return status; -} - -FT_DECLARE(ftdm_status_t) _ftdm_call_place(const char *file, const char *func, int line, - ftdm_caller_data_t *caller_data, ftdm_hunting_scheme_t *hunting, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status = FTDM_SUCCESS; - ftdm_channel_t *fchan = NULL; - - ftdm_assert_return(caller_data, FTDM_EINVAL, "Invalid caller data\n"); - ftdm_assert_return(hunting, FTDM_EINVAL, "Invalid hunting scheme\n"); - - if (hunting->mode == FTDM_HUNT_SPAN) { - status = _ftdm_channel_open_by_span(hunting->mode_data.span.span_id, - hunting->mode_data.span.direction, caller_data, &fchan); - } else if (hunting->mode == FTDM_HUNT_GROUP) { - status = _ftdm_channel_open_by_group(hunting->mode_data.group.group_id, - hunting->mode_data.group.direction, caller_data, &fchan); - } else if (hunting->mode == FTDM_HUNT_CHAN) { - status = _ftdm_channel_open(hunting->mode_data.chan.span_id, hunting->mode_data.chan.chan_id, &fchan, 0); - } else { - ftdm_log(FTDM_LOG_ERROR, "Cannot make outbound call with invalid hunting mode %d\n", hunting->mode); - return FTDM_EINVAL; - } - - if (status != FTDM_SUCCESS) { - return FTDM_EBUSY; - } - - /* we have a locked channel and are not afraid of using it! */ - if (hunting->result_cb) { - status = hunting->result_cb(fchan, caller_data); - if (status != FTDM_SUCCESS) { - status = FTDM_ECANCELED; - goto done; - } - } - - ftdm_channel_set_caller_data(fchan, caller_data); - - /* be aware that _ftdm_channl_call_place_nl can unlock/lock the channel quickly if working in blocking mode */ - status = _ftdm_channel_call_place_nl(file, func, line, fchan, usrmsg); - if (status != FTDM_SUCCESS) { - _ftdm_channel_call_hangup_nl(file, func, line, fchan, usrmsg); - goto done; - } - - /* let the user know which channel was picked and which call id was generated */ - caller_data->fchan = fchan; - caller_data->call_id = fchan->caller_data.call_id; -done: - ftdm_channel_unlock(fchan); - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *fchan, ftdm_signaling_status_t sigstatus) -{ - ftdm_status_t res; - - ftdm_assert_return(fchan != NULL, FTDM_FAIL, "Null channel\n"); - ftdm_assert_return(fchan->span != NULL, FTDM_FAIL, "Null span\n"); - ftdm_assert_return(fchan->span->set_channel_sig_status != NULL, FTDM_ENOSYS, "Not implemented\n"); - - ftdm_channel_lock(fchan); - - res = fchan->span->set_channel_sig_status(fchan, sigstatus); - - ftdm_channel_unlock(fchan); - - return res; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_get_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *sigstatus) -{ - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel\n"); - ftdm_assert_return(ftdmchan->span != NULL, FTDM_FAIL, "Null span\n"); - ftdm_assert_return(sigstatus != NULL, FTDM_FAIL, "Null sig status parameter\n"); - - if (ftdmchan->span->get_channel_sig_status) { - ftdm_status_t res; - ftdm_channel_lock(ftdmchan); - res = ftdmchan->span->get_channel_sig_status(ftdmchan, sigstatus); - ftdm_channel_unlock(ftdmchan); - return res; - } else { - /* don't log error here, it can be called just to test if its supported */ - return FTDM_NOTIMPL; - } -} - -FT_DECLARE(ftdm_status_t) ftdm_span_set_sig_status(ftdm_span_t *span, ftdm_signaling_status_t sigstatus) -{ - ftdm_assert_return(span != NULL, FTDM_FAIL, "Null span\n"); - - if (sigstatus == FTDM_SIG_STATE_DOWN) { - ftdm_log(FTDM_LOG_WARNING, "The user is not allowed to set the signaling status to DOWN, valid states are UP or SUSPENDED\n"); - return FTDM_FAIL; - } - - if (span->set_span_sig_status) { - return span->set_span_sig_status(span, sigstatus); - } else { - ftdm_log(FTDM_LOG_ERROR, "set_span_sig_status method not implemented!\n"); - return FTDM_FAIL; - } -} - -FT_DECLARE(ftdm_status_t) ftdm_span_get_sig_status(ftdm_span_t *span, ftdm_signaling_status_t *sigstatus) -{ - ftdm_assert_return(span != NULL, FTDM_FAIL, "Null span\n"); - ftdm_assert_return(sigstatus != NULL, FTDM_FAIL, "Null sig status parameter\n"); - - if (span->get_span_sig_status) { - return span->get_span_sig_status(span, sigstatus); - } else { - return FTDM_FAIL; - } -} - -static ftdm_status_t ftdm_channel_sig_indicate(ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_usrmsg_t *usrmsg) -{ - ftdm_status_t status = FTDM_FAIL; - if (ftdmchan->span->indicate) { - - ftdm_channel_save_usrmsg(ftdmchan, usrmsg); - - status = ftdmchan->span->indicate(ftdmchan, indication); - if (status == FTDM_NOTIMPL) { - ftdm_log(FTDM_LOG_WARNING, "Do not know how to indicate %s\n", ftdm_channel_indication2str(indication)); - } else if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_WARNING, "Failed to indicate %s\n", ftdm_channel_indication2str(indication)); - } else { /* SUCCESS */ - ftdm_ack_indication(ftdmchan, indication, FTDM_SUCCESS); - } - ftdm_usrmsg_free(&ftdmchan->usrmsg); - } else { - return FTDM_NOTIMPL; - } - return status; -} - - -/* this function must be called with the channel lock */ -static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) -{ - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel can't be done!\n"); - - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OPEN); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_INUSE); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_WINK); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_FLASH); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_HOLD); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_RINGING); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_PROGRESS_DETECT); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_3WAY); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_MEDIA); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_ANSWERED); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_USER_HANGUP); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DIGITAL_MEDIA); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE); - ftdm_mutex_lock(ftdmchan->pre_buffer_mutex); - ftdm_buffer_destroy(&ftdmchan->pre_buffer); - ftdmchan->pre_buffer_size = 0; - ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - - if (ftdmchan->hangup_timer) { - ftdm_sched_cancel_timer(globals.timingsched, ftdmchan->hangup_timer); - } - - ftdmchan->init_state = FTDM_CHANNEL_STATE_DOWN; - ftdmchan->state = FTDM_CHANNEL_STATE_DOWN; - ftdmchan->state_status = FTDM_STATE_STATUS_COMPLETED; - - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_DEBUG_DTMF, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_OUTPUT_DUMP, NULL); - - if (FTDM_IS_VOICE_CHANNEL(ftdmchan) && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED)) { - ftdm_sigmsg_t sigmsg; - memset(&sigmsg, 0, sizeof(sigmsg)); - sigmsg.span_id = ftdmchan->span_id; - sigmsg.chan_id = ftdmchan->chan_id; - sigmsg.channel = ftdmchan; - sigmsg.event_id = FTDM_SIGEVENT_RELEASED; - ftdm_span_send_signal(ftdmchan->span, &sigmsg); - ftdm_call_clear_call_id(&ftdmchan->caller_data); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED); - } - - if (ftdmchan->txdrops || ftdmchan->rxdrops) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "channel dropped data: txdrops = %d, rxdrops = %d\n", - ftdmchan->txdrops, ftdmchan->rxdrops); - } - - memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_HOLD); - - memset(ftdmchan->tokens, 0, sizeof(ftdmchan->tokens)); - ftdmchan->token_count = 0; - - ftdm_channel_flush_dtmf(ftdmchan); - - if (ftdmchan->gen_dtmf_buffer) { - ftdm_buffer_zero(ftdmchan->gen_dtmf_buffer); - } - - if (ftdmchan->dtmf_buffer) { - ftdm_buffer_zero(ftdmchan->dtmf_buffer); - } - - if (ftdmchan->digit_buffer) { - ftdm_buffer_zero(ftdmchan->digit_buffer); - } - - if (!ftdmchan->dtmf_on) { - ftdmchan->dtmf_on = FTDM_DEFAULT_DTMF_ON; - } - - if (!ftdmchan->dtmf_off) { - ftdmchan->dtmf_off = FTDM_DEFAULT_DTMF_OFF; - } - - memset(ftdmchan->dtmf_hangup_buf, '\0', ftdmchan->span->dtmf_hangup_len); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE)) { - ftdmchan->effective_codec = ftdmchan->native_codec; - ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE); - } - - if (ftdmchan->span->sig_release_guard_time_ms) { - ftdmchan->last_release_time = ftdm_current_time_in_ms(); - } - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "channel done\n"); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_use(ftdm_channel_t *ftdmchan) -{ - - ftdm_assert(ftdmchan != NULL, "Null channel\n"); - - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_INUSE); - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_close(ftdm_channel_t **ftdmchan) -{ - ftdm_channel_t *check; - ftdm_status_t status = FTDM_FAIL; - - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel double pointer provided!\n"); - ftdm_assert_return(*ftdmchan != NULL, FTDM_FAIL, "null channel pointer provided!\n"); - - check = *ftdmchan; - *ftdmchan = NULL; - - if (ftdm_test_flag(check, FTDM_CHANNEL_CONFIGURED)) { - ftdm_mutex_lock(check->mutex); - if (!ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { - ftdm_log_chan_msg(check, FTDM_LOG_WARNING, "Channel not opened, proceeding anyway\n"); - } - status = check->fio->close(check); - ftdm_assert(status == FTDM_SUCCESS, "Failed to close channel!\n"); - ftdm_channel_done(check); - *ftdmchan = NULL; - check->ring_count = 0; - ftdm_mutex_unlock(check->mutex); - } - - return status; -} - -static ftdm_status_t ftdmchan_activate_dtmf_buffer(ftdm_channel_t *ftdmchan) -{ - if (!ftdmchan->dtmf_buffer) { - if (ftdm_buffer_create(&ftdmchan->dtmf_buffer, 1024, 3192, 0) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to allocate DTMF Buffer!\n"); - return FTDM_FAIL; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Created DTMF buffer\n"); - } - } - - - if (!ftdmchan->tone_session.buffer) { - memset(&ftdmchan->tone_session, 0, sizeof(ftdmchan->tone_session)); - teletone_init_session(&ftdmchan->tone_session, 0, NULL, NULL); - } - - ftdmchan->tone_session.rate = ftdmchan->rate; - ftdmchan->tone_session.duration = ftdmchan->dtmf_on * (ftdmchan->tone_session.rate / 1000); - ftdmchan->tone_session.wait = ftdmchan->dtmf_off * (ftdmchan->tone_session.rate / 1000); - ftdmchan->tone_session.volume = -7; - - /* - ftdmchan->tone_session.debug = 1; - ftdmchan->tone_session.debug_stream = stdout; - */ - - return FTDM_SUCCESS; -} - -/* - * ftdmchan_activate_dtmf_buffer to initialize ftdmchan->dtmf_buffer should be called prior to - * calling ftdm_insert_dtmf_pause - */ -static ftdm_status_t ftdm_insert_dtmf_pause(ftdm_channel_t *ftdmchan, ftdm_size_t pausems) -{ - void *data = NULL; - ftdm_size_t datalen = pausems * sizeof(uint16_t); - - data = ftdm_malloc(datalen); - ftdm_assert(data, "Failed to allocate memory\n"); - - memset(data, FTDM_SILENCE_VALUE(ftdmchan), datalen); - - ftdm_buffer_write(ftdmchan->dtmf_buffer, data, datalen); - ftdm_safe_free(data); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_command_t command, void *obj) -{ - ftdm_status_t status = FTDM_FAIL; - - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "No channel\n"); - ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "No IO attached to channel\n"); - - ftdm_channel_lock(ftdmchan); - - switch (command) { - - case FTDM_COMMAND_ENABLE_CALLERID_DETECT: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_CALLERID)) { - if (ftdm_fsk_demod_init(&ftdmchan->fsk, ftdmchan->rate, ftdmchan->fsk_buf, sizeof(ftdmchan->fsk_buf)) != FTDM_SUCCESS) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); - GOTO_STATUS(done, FTDM_FAIL); - } - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_DISABLE_CALLERID_DETECT: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_CALLERID)) { - ftdm_fsk_demod_destroy(&ftdmchan->fsk); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_TRACE_INPUT: - { - char *path = FTDM_COMMAND_OBJ_CHAR_P; - if (ftdmchan->fds[FTDM_READ_TRACE_INDEX] > 0) { - close(ftdmchan->fds[FTDM_READ_TRACE_INDEX]); - ftdmchan->fds[FTDM_READ_TRACE_INDEX] = -1; - } - if ((ftdmchan->fds[FTDM_READ_TRACE_INDEX] = open(path, O_WRONLY | O_CREAT | O_TRUNC - | FTDM_O_BINARY, S_IRUSR | S_IWUSR)) > -1) { - ftdm_log(FTDM_LOG_DEBUG, "Tracing channel %u:%u input to [%s]\n", ftdmchan->span_id, ftdmchan->chan_id, path); - GOTO_STATUS(done, FTDM_SUCCESS); - } - - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); - GOTO_STATUS(done, FTDM_FAIL); - } - break; - case FTDM_COMMAND_TRACE_OUTPUT: - { - char *path = (char *) obj; - if (ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] > 0) { - close(ftdmchan->fds[FTDM_WRITE_TRACE_INDEX]); - ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] = -1; - } - if ((ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] = open(path, O_WRONLY | O_CREAT | O_TRUNC - | FTDM_O_BINARY, S_IRUSR | S_IWUSR)) > -1) { - ftdm_log(FTDM_LOG_DEBUG, "Tracing channel %u:%u output to [%s]\n", ftdmchan->span_id, ftdmchan->chan_id, path); - GOTO_STATUS(done, FTDM_SUCCESS); - } - - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); - GOTO_STATUS(done, FTDM_FAIL); - } - break; - case FTDM_COMMAND_TRACE_END_ALL: - { - if (ftdmchan->fds[FTDM_READ_TRACE_INDEX] > 0) { - close(ftdmchan->fds[FTDM_READ_TRACE_INDEX]); - ftdmchan->fds[FTDM_READ_TRACE_INDEX] = -1; - } - if (ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] > 0) { - close(ftdmchan->fds[FTDM_WRITE_TRACE_INDEX]); - ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] = -1; - } - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - /*!< Enable DTMF debugging */ - case FTDM_COMMAND_ENABLE_DEBUG_DTMF: - { - if (ftdmchan->dtmfdbg.enabled) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot enable debug DTMF again\n"); - GOTO_STATUS(done, FTDM_FAIL); - } - if (ftdmchan->rxdump.buffer) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot debug DTMF if Rx dumping is already enabled\n"); - GOTO_STATUS(done, FTDM_FAIL); - } - if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, FTDM_IO_DUMP_DEFAULT_BUFF_SIZE) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable rx dump for DTMF debugging\n"); - GOTO_STATUS(done, FTDM_FAIL); - } - ftdmchan->dtmfdbg.enabled = 1; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Enabled DTMF debugging\n"); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - /*!< Disable DTMF debugging (if not disabled explicitly, it is disabled automatically when calls hangup) */ - case FTDM_COMMAND_DISABLE_DEBUG_DTMF: - { - if (!ftdmchan->dtmfdbg.enabled) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "DTMF debug is already disabled\n"); - GOTO_STATUS(done, FTDM_SUCCESS); - } - if (disable_dtmf_debug(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to disable DTMF debug\n"); - GOTO_STATUS(done, FTDM_FAIL); - } - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - /*!< Start dumping all input to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ - case FTDM_COMMAND_ENABLE_INPUT_DUMP: - { - ftdm_size_t size = obj ? FTDM_COMMAND_OBJ_SIZE : FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; - if (ftdmchan->rxdump.buffer) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Input dump is already enabled\n"); - GOTO_STATUS(done, FTDM_FAIL); - } - if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, size) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to enable input dump of size %"FTDM_SIZE_FMT"\n", size); - GOTO_STATUS(done, FTDM_FAIL); - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled input dump with size %"FTDM_SIZE_FMT"\n", size); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - /*!< Stop dumping all input to a circular buffer. */ - case FTDM_COMMAND_DISABLE_INPUT_DUMP: - { - if (!ftdmchan->rxdump.buffer) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No need to disable input dump\n"); - GOTO_STATUS(done, FTDM_SUCCESS); - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled input dump of size %"FTDM_SIZE_FMT"\n", - ftdmchan->rxdump.size); - stop_chan_io_dump(&ftdmchan->rxdump); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - /*!< Start dumping all output to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ - case FTDM_COMMAND_ENABLE_OUTPUT_DUMP: - { - ftdm_size_t size = obj ? FTDM_COMMAND_OBJ_SIZE : FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; - if (ftdmchan->txdump.buffer) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Output dump is already enabled\n"); - GOTO_STATUS(done, FTDM_FAIL); - } - if (start_chan_io_dump(ftdmchan, &ftdmchan->txdump, size) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to enable output dump of size %"FTDM_SIZE_FMT"\n", size); - GOTO_STATUS(done, FTDM_FAIL); - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled output dump with size %"FTDM_SIZE_FMT"\n", size); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - /*!< Stop dumping all output to a circular buffer. */ - case FTDM_COMMAND_DISABLE_OUTPUT_DUMP: - { - if (!ftdmchan->txdump.buffer) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No need to disable output dump\n"); - GOTO_STATUS(done, FTDM_SUCCESS); - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled output dump of size %"FTDM_SIZE_FMT"\n", ftdmchan->rxdump.size); - stop_chan_io_dump(&ftdmchan->txdump); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - /*!< Dump the current input circular buffer to the specified FILE* structure */ - case FTDM_COMMAND_DUMP_INPUT: - { - if (!obj) { - GOTO_STATUS(done, FTDM_FAIL); - } - if (!ftdmchan->rxdump.buffer) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Not dumped input to file %p, input dump is not enabled\n", obj); - GOTO_STATUS(done, FTDM_FAIL); - } - dump_chan_io_to_file(ftdmchan, &ftdmchan->rxdump, obj); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %"FTDM_SIZE_FMT" to file %p\n", ftdmchan->rxdump.size, obj); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - /*!< Dump the current output circular buffer to the specified FILE* structure */ - case FTDM_COMMAND_DUMP_OUTPUT: - { - if (!obj) { - GOTO_STATUS(done, FTDM_FAIL); - } - if (!ftdmchan->txdump.buffer) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Not dumped output to file %p, output dump is not enabled\n", obj); - GOTO_STATUS(done, FTDM_FAIL); - } - dump_chan_io_to_file(ftdmchan, &ftdmchan->txdump, obj); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %"FTDM_SIZE_FMT" to file %p\n", ftdmchan->txdump.size, obj); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - - case FTDM_COMMAND_SET_INTERVAL: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL)) { - ftdmchan->effective_interval = FTDM_COMMAND_OBJ_INT; - if (ftdmchan->effective_interval == ftdmchan->native_interval) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_BUFFER); - } else { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_BUFFER); - } - ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_GET_INTERVAL: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL)) { - FTDM_COMMAND_OBJ_INT = ftdmchan->effective_interval; - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_SET_CODEC: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_CODECS)) { - ftdmchan->effective_codec = FTDM_COMMAND_OBJ_INT; - - if (ftdmchan->effective_codec == ftdmchan->native_codec) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE); - } else { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE); - } - ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - - case FTDM_COMMAND_SET_NATIVE_CODEC: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_CODECS)) { - ftdmchan->effective_codec = ftdmchan->native_codec; - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE); - ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - - case FTDM_COMMAND_GET_CODEC: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_CODECS)) { - FTDM_COMMAND_OBJ_INT = ftdmchan->effective_codec; - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_GET_NATIVE_CODEC: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_CODECS)) { - FTDM_COMMAND_OBJ_INT = ftdmchan->native_codec; - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_ENABLE_PROGRESS_DETECT: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_PROGRESS)) { - /* if they don't have thier own, use ours */ - ftdm_channel_clear_detected_tones(ftdmchan); - ftdm_channel_clear_needed_tones(ftdmchan); - teletone_multi_tone_init(&ftdmchan->span->tone_finder[FTDM_TONEMAP_DIAL], &ftdmchan->span->tone_detect_map[FTDM_TONEMAP_DIAL]); - teletone_multi_tone_init(&ftdmchan->span->tone_finder[FTDM_TONEMAP_RING], &ftdmchan->span->tone_detect_map[FTDM_TONEMAP_RING]); - teletone_multi_tone_init(&ftdmchan->span->tone_finder[FTDM_TONEMAP_BUSY], &ftdmchan->span->tone_detect_map[FTDM_TONEMAP_BUSY]); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS_DETECT); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_DISABLE_PROGRESS_DETECT: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_PROGRESS)) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_PROGRESS_DETECT); - ftdm_channel_clear_detected_tones(ftdmchan); - ftdm_channel_clear_needed_tones(ftdmchan); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_ENABLE_DTMF_DETECT: - { - /* if they don't have thier own, use ours */ - if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - if (FTDM_CHANNEL_SW_DTMF_ALLOWED(ftdmchan)) { - teletone_dtmf_detect_init (&ftdmchan->dtmf_detect, ftdmchan->rate); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Enabled software DTMF detector\n"); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - } - break; - case FTDM_COMMAND_DISABLE_DTMF_DETECT: - { - if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - if (FTDM_CHANNEL_SW_DTMF_ALLOWED(ftdmchan)) { - teletone_dtmf_detect_init (&ftdmchan->dtmf_detect, ftdmchan->rate); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled software DTMF detector\n"); - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - } - break; - case FTDM_COMMAND_SET_PRE_BUFFER_SIZE: - { - int val = FTDM_COMMAND_OBJ_INT; - - if (val < 0) { - val = 0; - } - - ftdmchan->pre_buffer_size = val * 8; - - ftdm_mutex_lock(ftdmchan->pre_buffer_mutex); - if (!ftdmchan->pre_buffer_size) { - ftdm_buffer_destroy(&ftdmchan->pre_buffer); - } else if (!ftdmchan->pre_buffer) { - ftdm_buffer_create(&ftdmchan->pre_buffer, 1024, ftdmchan->pre_buffer_size, 0); - } - ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - - GOTO_STATUS(done, FTDM_SUCCESS); - - } - break; - case FTDM_COMMAND_GET_DTMF_ON_PERIOD: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_GENERATE)) { - FTDM_COMMAND_OBJ_INT = ftdmchan->dtmf_on; - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_GET_DTMF_OFF_PERIOD: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_GENERATE)) { - FTDM_COMMAND_OBJ_INT = ftdmchan->dtmf_on; - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - case FTDM_COMMAND_SET_DTMF_ON_PERIOD: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_GENERATE)) { - int val = FTDM_COMMAND_OBJ_INT; - if (val > 10 && val < 1000) { - ftdmchan->dtmf_on = val; - GOTO_STATUS(done, FTDM_SUCCESS); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "invalid value %d range 10-1000", val); - GOTO_STATUS(done, FTDM_FAIL); - } - } - } - break; - case FTDM_COMMAND_SET_DTMF_OFF_PERIOD: - { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_GENERATE)) { - int val = FTDM_COMMAND_OBJ_INT; - if (val > 10 && val < 1000) { - ftdmchan->dtmf_off = val; - GOTO_STATUS(done, FTDM_SUCCESS); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "invalid value %d range 10-1000", val); - GOTO_STATUS(done, FTDM_FAIL); - } - } - } - break; - case FTDM_COMMAND_SEND_DTMF: - { - char *digits = FTDM_COMMAND_OBJ_CHAR_P; - if (ftdmchan->span->sig_send_dtmf) { - status = ftdmchan->span->sig_send_dtmf(ftdmchan, digits); - GOTO_STATUS(done, status); - } else if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_GENERATE)) { - - if ((status = ftdmchan_activate_dtmf_buffer(ftdmchan)) != FTDM_SUCCESS) { - GOTO_STATUS(done, status); - } - - ftdm_buffer_write(ftdmchan->gen_dtmf_buffer, digits, strlen(digits)); - - GOTO_STATUS(done, FTDM_SUCCESS); - } - } - break; - - case FTDM_COMMAND_DISABLE_ECHOCANCEL: - { - ftdm_mutex_lock(ftdmchan->pre_buffer_mutex); - ftdm_buffer_destroy(&ftdmchan->pre_buffer); - ftdmchan->pre_buffer_size = 0; - ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - } - break; - - case FTDM_COMMAND_SET_RX_GAIN: - { - if (!FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - ftdm_log(FTDM_LOG_ERROR, "Cannot set rx gain in non-voice channel of type: %s\n", ftdm_chan_type2str(ftdmchan->type)); - GOTO_STATUS(done, FTDM_FAIL); - } - ftdmchan->rxgain = FTDM_COMMAND_OBJ_FLOAT; - reset_gain_table(ftdmchan->rxgain_table, ftdmchan->rxgain, ftdmchan->native_codec); - if (ftdmchan->rxgain == 0.0) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN); - } else { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN); - } - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - case FTDM_COMMAND_GET_RX_GAIN: - { - FTDM_COMMAND_OBJ_FLOAT = ftdmchan->rxgain; - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - case FTDM_COMMAND_SET_TX_GAIN: - { - if (!FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - ftdm_log(FTDM_LOG_ERROR, "Cannot set tx gain in non-voice channel of type: %s\n", ftdm_chan_type2str(ftdmchan->type)); - GOTO_STATUS(done, FTDM_FAIL); - } - ftdmchan->txgain = FTDM_COMMAND_OBJ_FLOAT; - reset_gain_table(ftdmchan->txgain_table, ftdmchan->txgain, ftdmchan->native_codec); - if (ftdmchan->txgain == 0.0) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_USE_TX_GAIN); - } else { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_USE_TX_GAIN); - } - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - case FTDM_COMMAND_GET_TX_GAIN: - { - FTDM_COMMAND_OBJ_FLOAT = ftdmchan->txgain; - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - case FTDM_COMMAND_GET_IOSTATS: - { - if (!obj) { - GOTO_STATUS(done, FTDM_EINVAL); - } - memcpy(obj, &ftdmchan->iostats, sizeof(ftdmchan->iostats)); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - case FTDM_COMMAND_SWITCH_IOSTATS: - { - ftdm_bool_t enable = *(ftdm_bool_t *)obj; - if (enable) { - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); - } else { - ftdm_channel_clear_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); - } - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - default: - break; - } - - if (!ftdmchan->fio->command) { - ftdm_log(FTDM_LOG_ERROR, "no command function defined by the I/O freetdm module!\n"); - GOTO_STATUS(done, FTDM_FAIL); - } - - status = ftdmchan->fio->command(ftdmchan, command, obj); - - if (status == FTDM_NOTIMPL) { - ftdm_log(FTDM_LOG_ERROR, "I/O backend does not support command %d!\n", command); - } - -done: - ftdm_channel_unlock(ftdmchan); - - return status; - -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_wait(ftdm_channel_t *ftdmchan, ftdm_wait_flag_t *flags, int32_t to) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel\n"); - ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "Null io interface\n"); - ftdm_assert_return(ftdmchan->fio->wait != NULL, FTDM_NOTIMPL, "wait method not implemented\n"); - - status = ftdmchan->fio->wait(ftdmchan, flags, to); - if (status == FTDM_TIMEOUT) { - /* make sure the flags are cleared on timeout */ - *flags = 0; - } - return status; -} - -/*******************************/ -FIO_CODEC_FUNCTION(fio_slin2ulaw) -{ - int16_t sln_buf[512] = {0}, *sln = sln_buf; - uint8_t *lp = data; - uint32_t i; - ftdm_size_t len = *datalen; - - if (max > len) { - max = len; - } - - memcpy(sln, data, max); - - for(i = 0; i < max; i++) { - *lp++ = linear_to_ulaw(*sln++); - } - - *datalen = max / 2; - - return FTDM_SUCCESS; - -} - - -FIO_CODEC_FUNCTION(fio_ulaw2slin) -{ - int16_t *sln = data; - uint8_t law[1024] = {0}, *lp = law; - uint32_t i; - ftdm_size_t len = *datalen; - - if (max > len) { - max = len; - } - - memcpy(law, data, max); - - for(i = 0; i < max; i++) { - *sln++ = ulaw_to_linear(*lp++); - } - - *datalen = max * 2; - - return FTDM_SUCCESS; -} - -FIO_CODEC_FUNCTION(fio_slin2alaw) -{ - int16_t sln_buf[512] = {0}, *sln = sln_buf; - uint8_t *lp = data; - uint32_t i; - ftdm_size_t len = *datalen; - - if (max > len) { - max = len; - } - - memcpy(sln, data, max); - - for(i = 0; i < max; i++) { - *lp++ = linear_to_alaw(*sln++); - } - - *datalen = max / 2; - - return FTDM_SUCCESS; - -} - - -FIO_CODEC_FUNCTION(fio_alaw2slin) -{ - int16_t *sln = data; - uint8_t law[1024] = {0}, *lp = law; - uint32_t i; - ftdm_size_t len = *datalen; - - if (max > len) { - max = len; - } - - memcpy(law, data, max); - - for(i = 0; i < max; i++) { - *sln++ = alaw_to_linear(*lp++); - } - - *datalen = max * 2; - - return FTDM_SUCCESS; -} - -FIO_CODEC_FUNCTION(fio_ulaw2alaw) -{ - ftdm_size_t len = *datalen; - uint32_t i; - uint8_t *lp = data; - - if (max > len) { - max = len; - } - - for(i = 0; i < max; i++) { - *lp = ulaw_to_alaw(*lp); - lp++; - } - - return FTDM_SUCCESS; -} - -FIO_CODEC_FUNCTION(fio_alaw2ulaw) -{ - ftdm_size_t len = *datalen; - uint32_t i; - uint8_t *lp = data; - - if (max > len) { - max = len; - } - - for(i = 0; i < max; i++) { - *lp = alaw_to_ulaw(*lp); - lp++; - } - - return FTDM_SUCCESS; -} - -/******************************/ - -FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan) -{ - uint32_t i; - - memset(ftdmchan->detected_tones, 0, sizeof(ftdmchan->detected_tones[0]) * FTDM_TONEMAP_INVALID); - - for (i = 1; i < FTDM_TONEMAP_INVALID; i++) { - ftdmchan->span->tone_finder[i].tone_count = 0; - } -} - -FT_DECLARE(void) ftdm_channel_clear_needed_tones(ftdm_channel_t *ftdmchan) -{ - memset(ftdmchan->needed_tones, 0, sizeof(ftdmchan->needed_tones[0]) * FTDM_TONEMAP_INVALID); -} - -FT_DECLARE(ftdm_size_t) ftdm_channel_dequeue_dtmf(ftdm_channel_t *ftdmchan, char *dtmf, ftdm_size_t len) -{ - ftdm_size_t bytes = 0; - - assert(ftdmchan != NULL); - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_READY)) { - return 0; - } - - if (ftdmchan->digit_buffer && ftdm_buffer_inuse(ftdmchan->digit_buffer)) { - ftdm_mutex_lock(ftdmchan->mutex); - if ((bytes = ftdm_buffer_read(ftdmchan->digit_buffer, dtmf, len)) > 0) { - *(dtmf + bytes) = '\0'; - } - ftdm_mutex_unlock(ftdmchan->mutex); - } - - return bytes; -} - -FT_DECLARE(void) ftdm_channel_flush_dtmf(ftdm_channel_t *ftdmchan) -{ - if (ftdmchan->digit_buffer && ftdm_buffer_inuse(ftdmchan->digit_buffer)) { - ftdm_mutex_lock(ftdmchan->mutex); - ftdm_buffer_zero(ftdmchan->digit_buffer); - ftdm_mutex_unlock(ftdmchan->mutex); - } -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, const char *dtmf) -{ - ftdm_status_t status; - register ftdm_size_t len, inuse; - ftdm_size_t wr = 0; - const char *p; - - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "No channel\n"); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Queuing DTMF %s (debug = %d)\n", dtmf, ftdmchan->dtmfdbg.enabled); - - if (ftdmchan->span->sig_queue_dtmf && (ftdmchan->span->sig_queue_dtmf(ftdmchan, dtmf) == FTDM_BREAK)) { - /* Signalling module wants to absorb this DTMF event */ - return FTDM_SUCCESS; - } - - if (!ftdmchan->dtmfdbg.enabled) { - goto skipdebug; - } - - if (!ftdmchan->dtmfdbg.file) { - struct tm currtime; - time_t currsec; - char dfile[1138]; - - currsec = time(NULL); - -#ifdef WIN32 - _tzset(); - _localtime64_s(&currtime, &currsec); -#else - localtime_r(&currsec, &currtime); -#endif - - if (ftdm_strlen_zero(globals.dtmfdebug_directory)) { - snprintf(dfile, sizeof(dfile), "dtmf-s%dc%d-20%d-%d-%d-%d%d%d.%s", - ftdmchan->span_id, ftdmchan->chan_id, - currtime.tm_year-100, currtime.tm_mon+1, currtime.tm_mday, - currtime.tm_hour, currtime.tm_min, currtime.tm_sec, ftdmchan->native_codec == FTDM_CODEC_ULAW ? "ulaw" : ftdmchan->native_codec == FTDM_CODEC_ALAW ? "alaw" : "sln"); - } else { - snprintf(dfile, sizeof(dfile), "%s/dtmf-s%dc%d-20%d-%d-%d-%d%d%d.%s", - globals.dtmfdebug_directory, - ftdmchan->span_id, ftdmchan->chan_id, - currtime.tm_year-100, currtime.tm_mon+1, currtime.tm_mday, - currtime.tm_hour, currtime.tm_min, currtime.tm_sec, ftdmchan->native_codec == FTDM_CODEC_ULAW ? "ulaw" : ftdmchan->native_codec == FTDM_CODEC_ALAW ? "alaw" : "sln"); - } - ftdmchan->dtmfdbg.file = fopen(dfile, "wb"); - if (!ftdmchan->dtmfdbg.file) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "failed to open debug dtmf file %s\n", dfile); - } else { - ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, ftdmchan->dtmfdbg.file); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped initial DTMF output to %s\n", dfile); - } - } else { - ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; - } - -skipdebug: - - if (ftdmchan->pre_buffer) { - ftdm_buffer_zero(ftdmchan->pre_buffer); - } - - ftdm_mutex_lock(ftdmchan->mutex); - - inuse = ftdm_buffer_inuse(ftdmchan->digit_buffer); - len = strlen(dtmf); - - if (len + inuse > ftdm_buffer_len(ftdmchan->digit_buffer)) { - ftdm_buffer_toss(ftdmchan->digit_buffer, strlen(dtmf)); - } - - if (ftdmchan->span->dtmf_hangup_len) { - for (p = dtmf; ftdm_is_dtmf(*p); p++) { - memmove (ftdmchan->dtmf_hangup_buf, ftdmchan->dtmf_hangup_buf + 1, ftdmchan->span->dtmf_hangup_len - 1); - ftdmchan->dtmf_hangup_buf[ftdmchan->span->dtmf_hangup_len - 1] = *p; - if (!strcmp(ftdmchan->dtmf_hangup_buf, ftdmchan->span->dtmf_hangup)) { - ftdm_log(FTDM_LOG_DEBUG, "DTMF hangup detected.\n"); - - ftdm_channel_set_state(__FILE__, __FTDM_FUNC__, __LINE__, ftdmchan, FTDM_CHANNEL_STATE_HANGUP, 0, NULL); - break; - } - } - } - - p = dtmf; - while (wr < len && p) { - if (ftdm_is_dtmf(*p)) { - wr++; - } else { - break; - } - p++; - } - - status = ftdm_buffer_write(ftdmchan->digit_buffer, dtmf, wr) ? FTDM_SUCCESS : FTDM_FAIL; - ftdm_mutex_unlock(ftdmchan->mutex); - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_raw_write (ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen) -{ - int dlen = (int) *datalen; - - if (ftdm_test_io_flag(ftdmchan, FTDM_CHANNEL_IO_WRITE)) { - ftdm_clear_io_flag(ftdmchan, FTDM_CHANNEL_IO_WRITE); - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED)) { - ftdmchan->txdrops++; - if (ftdmchan->txdrops <= 10) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "cannot write in channel with tx disabled\n"); - } - if (ftdmchan->txdrops == 10) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Too many tx drops, not printing anymore\n"); - } - return FTDM_FAIL; - } - if (ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] > -1) { - if ((write(ftdmchan->fds[FTDM_WRITE_TRACE_INDEX], data, dlen)) != dlen) { - ftdm_log(FTDM_LOG_WARNING, "Raw output trace failed to write all of the %d bytes\n", dlen); - } - } - write_chan_io_dump(&ftdmchan->txdump, data, dlen); - return ftdmchan->fio->write(ftdmchan, data, datalen); -} - -FT_DECLARE(ftdm_status_t) ftdm_raw_read (ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen) -{ - ftdm_status_t status; - - if (ftdm_test_io_flag(ftdmchan, FTDM_CHANNEL_IO_READ)) { - ftdm_clear_io_flag(ftdmchan, FTDM_CHANNEL_IO_READ); - } - status = ftdmchan->fio->read(ftdmchan, data, datalen); - - if (status == FTDM_SUCCESS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN) - && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { - ftdm_size_t i = 0; - unsigned char *rdata = data; - for (i = 0; i < *datalen; i++) { - rdata[i] = ftdmchan->rxgain_table[rdata[i]]; - } - } - - if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) { - ftdm_size_t dlen = *datalen; - if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, (int)dlen) != dlen) { - ftdm_log(FTDM_LOG_WARNING, "Raw input trace failed to write all of the %"FTDM_SIZE_FMT" bytes\n", dlen); - } - } - - if (status == FTDM_SUCCESS && ftdmchan->span->sig_read) { - ftdmchan->span->sig_read(ftdmchan, data, *datalen); - } - - if (status == FTDM_SUCCESS) { - ftdm_size_t dlen = *datalen; - ftdm_size_t rc = 0; - - write_chan_io_dump(&ftdmchan->rxdump, data, (int)dlen); - - /* if dtmf debug is enabled and initialized, write there too */ - if (ftdmchan->dtmfdbg.file) { - rc = fwrite(data, 1, dlen, ftdmchan->dtmfdbg.file); - if (rc != dlen) { - ftdm_log(FTDM_LOG_WARNING, "DTMF debugger wrote only %"FTDM_SIZE_FMT" out of %"FTDM_SIZE_FMT" bytes: %s\n", - rc, *datalen, strerror(errno)); - } - ftdmchan->dtmfdbg.closetimeout--; - if (!ftdmchan->dtmfdbg.closetimeout) { - close_dtmf_debug_file(ftdmchan); - } - } - } - return status; -} - -/* This function takes care of automatically generating DTMF or FSK tones when needed */ -static ftdm_status_t handle_tone_generation(ftdm_channel_t *ftdmchan) -{ - /* - * datalen: size in bytes of the chunk of data the user requested to read (this function - * is called from the ftdm_channel_read function) - * dblen: size currently in use in any of the tone generation buffers (data available in the buffer) - * gen_dtmf_buffer: buffer holding the raw ASCII digits that the user requested to generate - * dtmf_buffer: raw linear tone data generated by teletone to be written to the devices - * fsk_buffer: raw linear FSK modulated data for caller id - */ - ftdm_buffer_t *buffer = NULL; - ftdm_size_t dblen = 0; - int wrote = 0; - - if (ftdmchan->gen_dtmf_buffer && (dblen = ftdm_buffer_inuse(ftdmchan->gen_dtmf_buffer))) { - char digits[128] = ""; - char *cur; - int x = 0; - - if (dblen > sizeof(digits) - 1) { - dblen = sizeof(digits) - 1; - } - - if (ftdm_buffer_read(ftdmchan->gen_dtmf_buffer, digits, dblen) && !ftdm_strlen_zero_buf(digits)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generating DTMF [%s]\n", digits); - - cur = digits; - - for (; *cur; cur++) { - if (*cur == 'F') { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLASH, NULL); - } else if (*cur == 'w') { - ftdm_insert_dtmf_pause(ftdmchan, FTDM_HALF_DTMF_PAUSE); - } else if (*cur == 'W') { - ftdm_insert_dtmf_pause(ftdmchan, FTDM_FULL_DTMF_PAUSE); - } else { - if ((wrote = teletone_mux_tones(&ftdmchan->tone_session, &ftdmchan->tone_session.TONES[(int)*cur]))) { - ftdm_buffer_write(ftdmchan->dtmf_buffer, ftdmchan->tone_session.buffer, wrote * 2); - x++; - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Problem adding DTMF sequence [%s]\n", digits); - return FTDM_FAIL; - } - } - if (x) { - ftdmchan->skip_read_frames = (wrote / (ftdmchan->effective_interval * 8)) + 4; - } - } - } - } - - if (!ftdmchan->buffer_delay || --ftdmchan->buffer_delay == 0) { - /* time to pick a buffer, either the dtmf or fsk buffer */ - if (ftdmchan->dtmf_buffer && (dblen = ftdm_buffer_inuse(ftdmchan->dtmf_buffer))) { - buffer = ftdmchan->dtmf_buffer; - } else if (ftdmchan->fsk_buffer && (dblen = ftdm_buffer_inuse(ftdmchan->fsk_buffer))) { - buffer = ftdmchan->fsk_buffer; - } - } - - /* if we picked a buffer, time to read from it and write the linear data to the device */ - if (buffer) { - uint8_t auxbuf[1024]; - ftdm_size_t dlen = ftdmchan->packet_len; - ftdm_size_t len, br, max = sizeof(auxbuf); - - /* if the codec is not linear, then data is really twice as much cuz - tone generation is done in linear (we assume anything different than linear is G.711) */ - if (ftdmchan->native_codec != FTDM_CODEC_SLIN) { - dlen *= 2; - } - - /* we do not expect the user chunks to be bigger than auxbuf */ - ftdm_assert((dlen <= sizeof(auxbuf)), "Unexpected size for user data chunk size\n"); - - /* dblen is the size in use for dtmf_buffer or fsk_buffer, and dlen is the size - * of the io chunks to write, we pick the smaller one */ - len = dblen > dlen ? dlen : dblen; - - /* we can't read more than the size of our auxiliary buffer */ - ftdm_assert((len <= sizeof(auxbuf)), "Unexpected size to read into auxbuf\n"); - - br = ftdm_buffer_read(buffer, auxbuf, len); - - /* the amount read can't possibly be bigger than what we requested */ - ftdm_assert((br <= len), "Unexpected size read from tone generation buffer\n"); - - /* if we read less than the chunk size, we must fill in with silence the rest */ - if (br < dlen) { - memset(auxbuf + br, 0, dlen - br); - } - - /* finally we convert to the native format for the channel if necessary */ - if (ftdmchan->native_codec != FTDM_CODEC_SLIN) { - if (ftdmchan->native_codec == FTDM_CODEC_ULAW) { - fio_slin2ulaw(auxbuf, max, &dlen); - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW) { - fio_slin2alaw(auxbuf, max, &dlen); - } - } - - /* write the tone to the channel */ - return ftdm_raw_write(ftdmchan, auxbuf, &dlen); - } - - return FTDM_SUCCESS; - -} - - -FT_DECLARE(void) ftdm_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor) -{ - int16_t x; - uint32_t i; - int sum_rnd = 0; - int16_t rnd2 = (int16_t) ftdm_current_time_in_ms() * (int16_t) (intptr_t) data; - - assert(divisor); - - for (i = 0; i < samples; i++, sum_rnd = 0) { - for (x = 0; x < 6; x++) { - rnd2 = rnd2 * 31821U + 13849U; - sum_rnd += rnd2 ; - } - //switch_normalize_to_16bit(sum_rnd); - *data = (int16_t) ((int16_t) sum_rnd / (int) divisor); - - data++; - } -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_process_media(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen) -{ - fio_codec_t codec_func = NULL; - ftdm_size_t max = *datalen; - - handle_tone_generation(ftdmchan); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_DIGITAL_MEDIA)) { - goto done; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) { - if (ftdmchan->native_codec == FTDM_CODEC_ULAW && ftdmchan->effective_codec == FTDM_CODEC_SLIN) { - codec_func = fio_ulaw2slin; - } else if (ftdmchan->native_codec == FTDM_CODEC_ULAW && ftdmchan->effective_codec == FTDM_CODEC_ALAW) { - codec_func = fio_ulaw2alaw; - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW && ftdmchan->effective_codec == FTDM_CODEC_SLIN) { - codec_func = fio_alaw2slin; - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW && ftdmchan->effective_codec == FTDM_CODEC_ULAW) { - codec_func = fio_alaw2ulaw; - } - - if (codec_func) { - codec_func(data, max, datalen); - } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "codec error!"); - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "no codec function to perform transcoding from %d to %d\n", ftdmchan->native_codec, ftdmchan->effective_codec); - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT) || - ftdm_test_flag(ftdmchan, FTDM_CHANNEL_PROGRESS_DETECT) || - ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT)) { - - uint8_t sln_buf[1024] = {0}; - int16_t *sln; - ftdm_size_t slen = 0; - - if (ftdmchan->effective_codec == FTDM_CODEC_SLIN) { - sln = data; - slen = *datalen / 2; - } else { - ftdm_size_t len = *datalen; - uint32_t i; - uint8_t *lp = data; - - slen = sizeof(sln_buf) / 2; - if (len > slen) { - len = slen; - } - - sln = (int16_t *) sln_buf; - for(i = 0; i < len; i++) { - if (ftdmchan->effective_codec == FTDM_CODEC_ULAW) { - *sln++ = ulaw_to_linear(*lp++); - } else if (ftdmchan->effective_codec == FTDM_CODEC_ALAW) { - *sln++ = alaw_to_linear(*lp++); - } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "codec error!"); - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "invalid effective codec %d\n", ftdmchan->effective_codec); - goto done; - } - } - sln = (int16_t *) sln_buf; - slen = len; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT)) { - if (ftdm_fsk_demod_feed(&ftdmchan->fsk, sln, slen) != FTDM_SUCCESS) { - ftdm_size_t type, mlen; - char str[128], *sp; - - while(ftdm_fsk_data_parse(&ftdmchan->fsk, &type, &sp, &mlen) == FTDM_SUCCESS) { - *(str+mlen) = '\0'; - ftdm_copy_string(str, sp, ++mlen); - ftdm_clean_string(str); - - ftdm_log(FTDM_LOG_DEBUG, "FSK: TYPE %s LEN %"FTDM_SIZE_FMT" VAL [%s]\n", - ftdm_mdmf_type2str(type), mlen-1, str); - - switch(type) { - case MDMF_DDN: - case MDMF_PHONE_NUM: - { - if (mlen > sizeof(ftdmchan->caller_data.ani)) { - mlen = sizeof(ftdmchan->caller_data.ani); - } - ftdm_set_string(ftdmchan->caller_data.ani.digits, str); - ftdm_set_string(ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.ani.digits); - } - break; - case MDMF_NO_NUM: - { - ftdm_set_string(ftdmchan->caller_data.ani.digits, *str == 'P' ? "private" : "unknown"); - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.ani.digits); - } - break; - case MDMF_PHONE_NAME: - { - if (mlen > sizeof(ftdmchan->caller_data.cid_name)) { - mlen = sizeof(ftdmchan->caller_data.cid_name); - } - ftdm_set_string(ftdmchan->caller_data.cid_name, str); - } - break; - case MDMF_NO_NAME: - { - ftdm_set_string(ftdmchan->caller_data.cid_name, *str == 'P' ? "private" : "unknown"); - } - case MDMF_DATETIME: - { - if (mlen > sizeof(ftdmchan->caller_data.cid_date)) { - mlen = sizeof(ftdmchan->caller_data.cid_date); - } - ftdm_set_string(ftdmchan->caller_data.cid_date, str); - } - break; - } - } - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_CALLERID_DETECT, NULL); - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_PROGRESS_DETECT) && !ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_PROGRESS)) { - uint32_t i; - - for (i = 1; i < FTDM_TONEMAP_INVALID; i++) { - if (ftdmchan->span->tone_finder[i].tone_count) { - if (ftdmchan->needed_tones[i] && teletone_multi_tone_detect(&ftdmchan->span->tone_finder[i], sln, (int)slen)) { - if (++ftdmchan->detected_tones[i]) { - ftdmchan->needed_tones[i] = 0; - ftdmchan->detected_tones[0]++; - } - } - } - } - } - - if (FTDM_CHANNEL_SW_DTMF_ALLOWED(ftdmchan) && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT)) { - teletone_hit_type_t hit; - char digit_char; - uint32_t dur; - - if ((hit = teletone_dtmf_detect(&ftdmchan->dtmf_detect, sln, (int)slen)) == TT_HIT_END) { - teletone_dtmf_get(&ftdmchan->dtmf_detect, &digit_char, &dur); - - if (ftdmchan->state == FTDM_CHANNEL_STATE_CALLWAITING && (digit_char == 'D' || digit_char == 'A')) { - ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]++; - } else { - char digit_str[2] = { 0 }; - - digit_str[0] = digit_char; - - ftdm_channel_queue_dtmf(ftdmchan, digit_str); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF)) { - ftdmchan->skip_read_frames = 20; - } - } - } - } - } - - if (ftdmchan->skip_read_frames > 0 || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_MUTE)) { - - ftdm_mutex_lock(ftdmchan->pre_buffer_mutex); - if (ftdmchan->pre_buffer && ftdm_buffer_inuse(ftdmchan->pre_buffer)) { - ftdm_buffer_zero(ftdmchan->pre_buffer); - } - ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - - memset(data, FTDM_SILENCE_VALUE(ftdmchan), *datalen); - - if (ftdmchan->skip_read_frames > 0) { - ftdmchan->skip_read_frames--; - } - } else { - ftdm_mutex_lock(ftdmchan->pre_buffer_mutex); - if (ftdmchan->pre_buffer_size && ftdmchan->pre_buffer) { - ftdm_buffer_write(ftdmchan->pre_buffer, data, *datalen); - if (ftdm_buffer_inuse(ftdmchan->pre_buffer) >= ftdmchan->pre_buffer_size) { - ftdm_buffer_read(ftdmchan->pre_buffer, data, *datalen); - } else { - memset(data, FTDM_SILENCE_VALUE(ftdmchan), *datalen); - } - } - ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - } - -done: - return FTDM_SUCCESS; -} - - -FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen) -{ - - ftdm_status_t status = FTDM_FAIL; - - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "ftdmchan is null\n"); - ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "No I/O module attached to ftdmchan\n"); - - ftdm_channel_lock(ftdmchan); - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "cannot read from channel that is not open\n"); - status = FTDM_FAIL; - goto done; - } - - if (!ftdmchan->fio->read) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "read method not implemented\n"); - status = FTDM_FAIL; - goto done; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED)) { - ftdmchan->rxdrops++; - if (ftdmchan->rxdrops <= 10) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "cannot read from channel with rx disabled\n"); - } - if (ftdmchan->rxdrops == 10) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "too many rx drops, not logging anymore\n"); - } - status = FTDM_FAIL; - goto done; - } - status = ftdm_raw_read(ftdmchan, data, datalen); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "raw I/O read filed\n"); - goto done; - } - - status = ftdm_channel_process_media(ftdmchan, data, datalen); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to process media\n"); - } -done: - ftdm_channel_unlock(ftdmchan); - return status; -} - - -FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t datasize, ftdm_size_t *datalen) -{ - ftdm_status_t status = FTDM_SUCCESS; - fio_codec_t codec_func = NULL; - ftdm_size_t max = datasize; - unsigned int i = 0; - - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel on write!\n"); - ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "null I/O on write!\n"); - - ftdm_channel_lock(ftdmchan); - - if (!ftdmchan->buffer_delay && - ((ftdmchan->dtmf_buffer && ftdm_buffer_inuse(ftdmchan->dtmf_buffer)) || - (ftdmchan->fsk_buffer && ftdm_buffer_inuse(ftdmchan->fsk_buffer)))) { - /* generating some kind of tone at the moment (see handle_tone_generation), - * we ignore user data ... */ - goto done; - } - - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "cannot write in channel not open\n"); - status = FTDM_FAIL; - goto done; - } - - if (!ftdmchan->fio->write) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "write method not implemented\n"); - status = FTDM_FAIL; - goto done; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_DIGITAL_MEDIA)) { - goto do_write; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) { - if (ftdmchan->native_codec == FTDM_CODEC_ULAW && ftdmchan->effective_codec == FTDM_CODEC_SLIN) { - codec_func = fio_slin2ulaw; - } else if (ftdmchan->native_codec == FTDM_CODEC_ULAW && ftdmchan->effective_codec == FTDM_CODEC_ALAW) { - codec_func = fio_alaw2ulaw; - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW && ftdmchan->effective_codec == FTDM_CODEC_SLIN) { - codec_func = fio_slin2alaw; - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW && ftdmchan->effective_codec == FTDM_CODEC_ULAW) { - codec_func = fio_ulaw2alaw; - } - - if (codec_func) { - status = codec_func(data, max, datalen); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Do not know how to handle transcoding from %d to %d\n", - ftdmchan->effective_codec, ftdmchan->native_codec); - status = FTDM_FAIL; - goto done; - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_TX_GAIN) - && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { - unsigned char *wdata = data; - for (i = 0; i < *datalen; i++) { - wdata[i] = ftdmchan->txgain_table[wdata[i]]; - } - } - -do_write: - - if (ftdmchan->span->sig_write) { - status = ftdmchan->span->sig_write(ftdmchan, data, *datalen); - if (status == FTDM_BREAK) { - /* signaling module decided to drop user frame */ - status = FTDM_SUCCESS; - goto done; - } - } - - status = ftdm_raw_write(ftdmchan, data, datalen); - -done: - ftdm_channel_unlock(ftdmchan); - - return status; -} - -FT_DECLARE(ftdm_iterator_t *) ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter) -{ - int allocated = 0; - if (iter) { - if (iter->type != type) { - ftdm_log(FTDM_LOG_ERROR, "Cannot switch iterator types\n"); - return NULL; - } - allocated = iter->allocated; - memset(iter, 0, sizeof(*iter)); - iter->type = type; - iter->allocated = allocated; - return iter; - } - - iter = ftdm_calloc(1, sizeof(*iter)); - if (!iter) { - return NULL; - } - iter->type = type; - iter->allocated = 1; - return iter; -} - -FT_DECLARE(ftdm_iterator_t *) ftdm_get_span_iterator(ftdm_iterator_t *iter) -{ - if (!(iter = ftdm_get_iterator(FTDM_ITERATOR_SPANS, iter))) { - return NULL; - } - - iter->pvt.hashiter = hashtable_first(globals.span_hash); - return iter; -} - -FT_DECLARE(ftdm_iterator_t *) ftdm_span_get_chan_iterator(const ftdm_span_t *span, ftdm_iterator_t *iter) -{ - if (!span->chan_count) { - return NULL; - } - if (!(iter = ftdm_get_iterator(FTDM_ITERATOR_CHANS, iter))) { - return NULL; - } - iter->pvt.chaniter.index = 1; - iter->pvt.chaniter.span = span; - return iter; -} - -FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter) -{ - ftdm_assert_return(iter && iter->type, NULL, "Invalid iterator\n"); - - switch (iter->type) { - case FTDM_ITERATOR_VARS: - case FTDM_ITERATOR_SPANS: - if (!iter->pvt.hashiter) { - return NULL; - } - iter->pvt.hashiter = hashtable_next(iter->pvt.hashiter); - if (!iter->pvt.hashiter) { - return NULL; - } - return iter; - case FTDM_ITERATOR_CHANS: - ftdm_assert_return(iter->pvt.chaniter.index, NULL, "channel iterator index cannot be zero!\n"); - if (iter->pvt.chaniter.index == iter->pvt.chaniter.span->chan_count) { - return NULL; - } - iter->pvt.chaniter.index++; - return iter; - default: - break; - } - - ftdm_assert_return(0, NULL, "Unknown iterator type\n"); - return NULL; -} - -FT_DECLARE(void *) ftdm_iterator_current(ftdm_iterator_t *iter) -{ - const void *key = NULL; - void *val = NULL; - - ftdm_assert_return(iter && iter->type, NULL, "Invalid iterator\n"); - - switch (iter->type) { - case FTDM_ITERATOR_VARS: - hashtable_this(iter->pvt.hashiter, &key, NULL, &val); - /* I decided to return the key instead of the value since the value can be retrieved using the key */ - return (void *)key; - case FTDM_ITERATOR_SPANS: - hashtable_this(iter->pvt.hashiter, &key, NULL, &val); - return (void *)val; - case FTDM_ITERATOR_CHANS: - ftdm_assert_return(iter->pvt.chaniter.index, NULL, "channel iterator index cannot be zero!\n"); - ftdm_assert_return(iter->pvt.chaniter.index <= iter->pvt.chaniter.span->chan_count, NULL, "channel iterator index bigger than span chan count!\n"); - return iter->pvt.chaniter.span->channels[iter->pvt.chaniter.index]; - default: - break; - } - - ftdm_assert_return(0, NULL, "Unknown iterator type\n"); - return NULL; -} - -FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter) -{ - /* it's valid to pass a NULL iterator, do not return failure */ - if (!iter) { - return FTDM_SUCCESS; - } - - if (!iter->allocated) { - memset(iter, 0, sizeof(*iter)); - return FTDM_SUCCESS; - } - - ftdm_assert_return(iter->type, FTDM_FAIL, "Cannot free invalid iterator\n"); - ftdm_safe_free(iter); - - return FTDM_SUCCESS; -} - - -static const char *print_neg_char[] = { "", "!" }; -static const char *print_flag_state[] = { "OFF", "ON" }; - -static void print_channels_by_flag(ftdm_stream_handle_t *stream, ftdm_span_t *inspan, uint32_t inchan_id, uint64_t flagval, int not, int *count) -{ - ftdm_bool_t neg = !!not; - const char *negind = print_neg_char[neg]; - const char *flagname; - uint64_t flag = ((uint64_t)1 << flagval); - int mycount = 0; - - flagname = ftdm_val2str(flag, channel_flag_strs, ftdm_array_len(channel_flag_strs), "invalid"); - - ftdm_mutex_lock(globals.mutex); - - if (inspan) { - ftdm_iterator_t *c_iter, *c_cur; - - c_iter = ftdm_span_get_chan_iterator(inspan, NULL); - - for (c_cur = c_iter; c_cur; c_cur = ftdm_iterator_next(c_cur)) { - ftdm_channel_t *fchan; - ftdm_bool_t cond; - - fchan = ftdm_iterator_current(c_cur); - if (inchan_id && inchan_id != fchan->chan_id) { - continue; - } - - cond = !!ftdm_test_flag(fchan, flag); - if (neg ^ cond) { - mycount++; - } - - stream->write_function(stream, "[s%dc%d][%d:%d] flag %s%"FTDM_UINT64_FMT"(%s%s) %s\n", - fchan->span_id, fchan->chan_id, - fchan->physical_span_id, fchan->physical_chan_id, - negind, flagval, negind, flagname, - print_flag_state[cond]); - } - - ftdm_iterator_free(c_iter); - - } else { - ftdm_iterator_t *s_iter, *s_cur; - - s_iter = ftdm_get_span_iterator(NULL); - - for (s_cur = s_iter; s_cur; s_cur = ftdm_iterator_next(s_cur)) { - ftdm_iterator_t *c_iter, *c_cur; - ftdm_span_t *span; - - span = ftdm_iterator_current(s_cur); - if (!span) { - break; - } - - c_iter = ftdm_span_get_chan_iterator(span, NULL); - - for (c_cur = c_iter; c_cur; c_cur = ftdm_iterator_next(c_cur)) { - ftdm_channel_t *fchan; - - fchan = ftdm_iterator_current(c_cur); - - if (neg ^ !!ftdm_test_flag(fchan, flag)) { - stream->write_function(stream, "[s%dc%d][%d:%d] flag %s%"FTDM_UINT64_FMT"(%s%s)\n", - fchan->span_id, fchan->chan_id, - fchan->physical_span_id, fchan->physical_chan_id, - negind, flagval, negind, flagname); - mycount++; - } - } - - ftdm_iterator_free(c_iter); - } - - ftdm_iterator_free(s_iter); - } - - *count = mycount; - ftdm_mutex_unlock(globals.mutex); -} - -static void print_spans_by_flag(ftdm_stream_handle_t *stream, ftdm_span_t *inspan, uint64_t flagval, int not, int *count) -{ - ftdm_bool_t neg = !!not; - const char *negind = print_neg_char[neg]; - const char *flagname; - uint64_t flag = ((uint64_t)1 << flagval); - int mycount = 0; - - flagname = ftdm_val2str(flag, span_flag_strs, ftdm_array_len(span_flag_strs), "invalid"); - - ftdm_mutex_lock(globals.mutex); - - if (inspan) { - ftdm_bool_t cond; - - cond = !!ftdm_test_flag(inspan, flag); - if (neg ^ cond) { - mycount++; - } - - stream->write_function(stream, "[s%d] flag %s%"FTDM_UINT64_FMT"(%s%s) %s\n", - inspan->span_id, negind, flagval, negind, flagname, - print_flag_state[cond]); - } else { - ftdm_iterator_t *s_iter, *s_cur; - - s_iter = ftdm_get_span_iterator(NULL); - - for (s_cur = s_iter; s_cur; s_cur = ftdm_iterator_next(s_cur)) { - ftdm_span_t *span; - - span = ftdm_iterator_current(s_cur); - if (!span) { - break; - } - - if (neg ^ !!ftdm_test_flag(span, flag)) { - stream->write_function(stream, "[s%d] flag %s%"FTDM_UINT64_FMT"(%s%s)\n", - span->span_id, negind, flagval, negind, flagname); - mycount++; - } - } - - ftdm_iterator_free(s_iter); - } - - *count = mycount; - ftdm_mutex_unlock(globals.mutex); -} - -static void print_channels_by_state(ftdm_stream_handle_t *stream, ftdm_channel_state_t state, int not, int *count) -{ - ftdm_iterator_t *s_iter, *s_cur; - ftdm_bool_t neg = !!not; - int mycount = 0; - - s_iter = ftdm_get_span_iterator(NULL); - - ftdm_mutex_lock(globals.mutex); - - for (s_cur = s_iter; s_cur; s_cur = ftdm_iterator_next(s_cur)) { - ftdm_iterator_t *c_iter, *c_cur; - ftdm_span_t *span; - - span = ftdm_iterator_current(s_cur); - if (!span) { - break; - } - - c_iter = ftdm_span_get_chan_iterator(span, NULL); - - for (c_cur = c_iter ; c_cur; c_cur = ftdm_iterator_next(c_cur)) { - ftdm_channel_t *fchan = ftdm_iterator_current(c_cur); - - if (neg ^ (fchan->state == state)) { - stream->write_function(stream, "[s%dc%d][%d:%d] in state %s\n", - fchan->span_id, fchan->chan_id, - fchan->physical_span_id, fchan->physical_chan_id, ftdm_channel_state2str(fchan->state)); - mycount++; - } - } - - ftdm_iterator_free(c_iter); - } - - *count = mycount; - ftdm_mutex_unlock(globals.mutex); - - ftdm_iterator_free(s_iter); -} - -static void print_core_usage(ftdm_stream_handle_t *stream) -{ - stream->write_function(stream, - "--------------------------------------------------------------------------------\n" - "ftdm core state [!] - List all channels in or not in the given state\n" - "ftdm core flag [!] [] [] - List all channels with the given flag value set\n" - "ftdm core spanflag [!] [] - List all spans with the given span flag value set\n" - "ftdm core calls - List all known calls to the FreeTDM core\n" - "--------------------------------------------------------------------------------\n"); -} - - -static unsigned long long ftdm_str2val(const char *str, val_str_t *val_str_table, ftdm_size_t array_size, unsigned long long default_val) -{ - ftdm_size_t i; - for (i = 0; i < array_size; i++) { - if (!strcasecmp(val_str_table[i].str, str)) { - return val_str_table[i].val; - } - } - return default_val; -} - -static const char *ftdm_val2str(unsigned long long val, val_str_t *val_str_table, ftdm_size_t array_size, const char *default_str) -{ - ftdm_size_t i; - for (i = 0; i < array_size; i++) { - if (val_str_table[i].val == val) { - return val_str_table[i].str; - } - } - return default_str; -} - -static void print_channel_flag_values(ftdm_stream_handle_t *stream) -{ - int i; - for (i = 0; i < ftdm_array_len(channel_flag_strs); i++) { - stream->write_function(stream, "%s\n", channel_flag_strs[i].str); - } -} - -static void print_span_flag_values(ftdm_stream_handle_t *stream) -{ - int i; - for (i = 0; i < ftdm_array_len(span_flag_strs); i++) { - stream->write_function(stream, "%s\n", span_flag_strs[i].str); - } -} - -/** - * Compute log2 of 64bit integer v - * - * Bit Twiddling Hacks - * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog - */ -static int ftdm_log2_64(uint64_t v) -{ - unsigned int shift; - uint64_t r; - - r = (v > 0xFFFFFFFF) << 5; v >>= r; - shift = (v > 0xFFFF ) << 4; v >>= shift; r |= shift; - shift = (v > 0xFF ) << 3; v >>= shift; r |= shift; - shift = (v > 0xF ) << 2; v >>= shift; r |= shift; - shift = (v > 0x3 ) << 1; v >>= shift; r |= shift; - - return ((int)(r | (v >> 1))); -} - -static char *handle_core_command(const char *cmd) -{ - char *mycmd = NULL; - int argc = 0; - int count = 0; - int not = 0; - char *argv[10] = { 0 }; - char *flag = NULL; - uint64_t flagval = 0; - ftdm_channel_t *fchan = NULL; - ftdm_span_t *fspan = NULL; - ftdm_stream_handle_t stream = { 0 }; - - FTDM_STANDARD_STREAM(stream); - - if (!ftdm_strlen_zero(cmd)) { - mycmd = ftdm_strdup(cmd); - argc = ftdm_separate_string(mycmd, ' ', argv, ftdm_array_len(argv)); - } else { - print_core_usage(&stream); - goto done; - } - - if (!argc) { - print_core_usage(&stream); - goto done; - } - - if (!strcasecmp(argv[0], "state")) { - ftdm_channel_state_t st = FTDM_CHANNEL_STATE_INVALID; - char *state = NULL; - - if (argc < 2) { - stream.write_function(&stream, "core state command requires an argument\n"); - print_core_usage(&stream); - goto done; - } - - state = argv[1]; - if (state[0] == '!') { - not = 1; - state++; - } - - for (st = FTDM_CHANNEL_STATE_DOWN; st < FTDM_CHANNEL_STATE_INVALID; st++) { - if (!strcasecmp(state, ftdm_channel_state2str(st))) { - break; - } - } - if (st == FTDM_CHANNEL_STATE_INVALID) { - stream.write_function(&stream, "invalid state %s\n", state); - goto done; - } - print_channels_by_state(&stream, st, not, &count); - stream.write_function(&stream, "\nTotal channels %s state %s: %d\n", - not ? "not in" : "in", ftdm_channel_state2str(st), count); - } else if (!strcasecmp(argv[0], "flag")) { - uint32_t chan_id = 0; - - if (argc < 2) { - stream.write_function(&stream, "core flag command requires an argument\n"); - print_core_usage(&stream); - goto done; - } - - flag = argv[1]; - if (flag[0] == '!') { - not = 1; - flag++; - } - - if (isalpha(flag[0])) { - flagval = ftdm_str2val(flag, channel_flag_strs, ftdm_array_len(channel_flag_strs), FTDM_CHANNEL_MAX_FLAG); - if (flagval == FTDM_CHANNEL_MAX_FLAG) { - stream.write_function(&stream, "\nInvalid channel flag value. Possible channel flags:\n"); - print_channel_flag_values(&stream); - goto done; - } - flagval = ftdm_log2_64(flagval); - } else { - flagval = atoi(flag); - } - - /* Specific span specified */ - if (argv[2]) { - ftdm_span_find_by_name(argv[2], &fspan); - if (!fspan) { - stream.write_function(&stream, "-ERR span:%s not found\n", argv[2]); - goto done; - } - } - - /* Specific channel specified */ - if (argv[3]) { - chan_id = atoi(argv[3]); - if (chan_id == 0 || chan_id >= ftdm_span_get_chan_count(fspan)) { - stream.write_function(&stream, "-ERR invalid channel %u\n", chan_id); - goto done; - } - } - - print_channels_by_flag(&stream, fspan, chan_id, flagval, not, &count); - stream.write_function(&stream, "\nTotal channels %s flag %"FTDM_UINT64_FMT": %d\n", not ? "without" : "with", flagval, count); - } else if (!strcasecmp(argv[0], "spanflag")) { - if (argc < 2) { - stream.write_function(&stream, "core spanflag command requires an argument\n"); - print_core_usage(&stream); - goto done; - } - - flag = argv[1]; - if (flag[0] == '!') { - not = 1; - flag++; - } - - if (isalpha(flag[0])) { - flagval = ftdm_str2val(flag, span_flag_strs, ftdm_array_len(span_flag_strs), FTDM_SPAN_MAX_FLAG); - if (flagval == FTDM_SPAN_MAX_FLAG) { - stream.write_function(&stream, "\nInvalid span flag value. Possible span flags\n"); - print_span_flag_values(&stream); - goto done; - } - flagval = ftdm_log2_64(flagval); - } else { - flagval = atoi(flag); - } - - /* Specific span specified */ - if (argv[2]) { - ftdm_span_find_by_name(argv[2], &fspan); - if (!fspan) { - stream.write_function(&stream, "-ERR span:%s not found\n", argv[2]); - goto done; - } - } - - print_spans_by_flag(&stream, fspan, flagval, not, &count); - if (!fspan) { - stream.write_function(&stream, "\nTotal spans %s flag %"FTDM_UINT64_FMT": %d\n", not ? "without" : "with", flagval, count); - } - } else if (!strcasecmp(argv[0], "calls")) { - uint32_t current_call_id = 0; - - ftdm_mutex_lock(globals.call_id_mutex); - for (current_call_id = 0; current_call_id <= MAX_CALLIDS; current_call_id++) { - ftdm_caller_data_t *calldata = NULL; - - if (!globals.call_ids[current_call_id]) { - continue; - } - - calldata = globals.call_ids[current_call_id]; - fchan = calldata->fchan; - if (fchan) { - stream.write_function(&stream, "Call %u on channel %d:%d\n", current_call_id, - fchan->span_id, fchan->chan_id); - } else { - stream.write_function(&stream, "Call %u without a channel?\n", current_call_id); - } - count++; - } - ftdm_mutex_unlock(globals.call_id_mutex); - stream.write_function(&stream, "\nTotal calls: %d\n", count); - } else { - stream.write_function(&stream, "invalid core command %s\n", argv[0]); - print_core_usage(&stream); - } - -done: - ftdm_safe_free(mycmd); - - return stream.data; -} - -FT_DECLARE(char *) ftdm_api_execute(const char *cmd) -{ - ftdm_io_interface_t *fio = NULL; - char *dup = NULL, *p; - char *rval = NULL; - char *type = NULL; - - dup = ftdm_strdup(cmd); - if ((p = strchr(dup, ' '))) { - *p++ = '\0'; - cmd = p; - } else { - cmd = ""; - } - - type = dup; - - if (!strcasecmp(type, "core")) { - return handle_core_command(cmd); - } - - fio = ftdm_global_get_io_interface(type, FTDM_TRUE); - if (fio && fio->api) { - ftdm_stream_handle_t stream = { 0 }; - ftdm_status_t status; - FTDM_STANDARD_STREAM(stream); - - status = fio->api(&stream, cmd); - if (status != FTDM_SUCCESS) { - ftdm_safe_free(stream.data); - } else { - rval = (char *) stream.data; - } - } - - ftdm_safe_free(dup); - - return rval; -} - -static ftdm_status_t ftdm_set_channels_gains(ftdm_span_t *span, int currindex, float rxgain, float txgain) -{ - unsigned chan_index = 0; - - if (!span->chan_count) { - ftdm_log(FTDM_LOG_ERROR, "Failed to set channel gains because span %s has no channels\n", span->name); - return FTDM_FAIL; - } - - for (chan_index = currindex+1; chan_index <= span->chan_count; chan_index++) { - if (!FTDM_IS_VOICE_CHANNEL(span->channels[chan_index])) { - continue; - } - if (ftdm_channel_command(span->channels[chan_index], FTDM_COMMAND_SET_RX_GAIN, &rxgain) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - if (ftdm_channel_command(span->channels[chan_index], FTDM_COMMAND_SET_TX_GAIN, &txgain) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_report_initial_channels_alarms(ftdm_span_t *span) -{ - ftdm_channel_t *fchan = NULL; - ftdm_iterator_t *curr = NULL; - ftdm_status_t status = FTDM_SUCCESS; - ftdm_alarm_flag_t alarmbits; - ftdm_event_t fake_event; - ftdm_iterator_t *citer = ftdm_span_get_chan_iterator(span, NULL); - - if (!citer) { - status = FTDM_ENOMEM; - goto done; - } - - memset(&fake_event, 0, sizeof(fake_event)); - fake_event.e_type = FTDM_EVENT_OOB; - - for (curr = citer; curr; curr = ftdm_iterator_next(curr)) { - fchan = ftdm_iterator_current(curr); - status = ftdm_channel_get_alarms(fchan, &alarmbits); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Failed to initialize alarms\n"); - continue; - } - fake_event.channel = fchan; - fake_event.enum_id = fchan->alarm_flags ? FTDM_OOB_ALARM_TRAP : FTDM_OOB_ALARM_CLEAR; - ftdm_event_handle_oob(&fake_event); - } - -done: - - ftdm_iterator_free(citer); - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const char* str, ftdm_channel_config_t *chan_config, unsigned *configured) -{ - int currindex; - unsigned chan_index = 0; - - ftdm_assert_return(span != NULL, FTDM_EINVAL, "span is null\n"); - ftdm_assert_return(chan_config != NULL, FTDM_EINVAL, "config is null\n"); - ftdm_assert_return(configured != NULL, FTDM_EINVAL, "configured pointer is null\n"); - ftdm_assert_return(span->fio != NULL, FTDM_EINVAL, "span with no I/O configured\n"); - ftdm_assert_return(span->fio->configure_span != NULL, FTDM_NOTIMPL, "span I/O with no channel configuration implemented\n"); - - currindex = span->chan_count; - *configured = 0; - *configured = span->fio->configure_span(span, str, chan_config->type, chan_config->name, chan_config->number); - if (!*configured) { - ftdm_log(FTDM_LOG_ERROR, "%d:Failed to configure span\n", span->span_id); - return FTDM_FAIL; - } - - if (chan_config->group_name[0]) { - if (ftdm_group_add_channels(span, currindex, chan_config->group_name) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%d:Failed to add channels to group %s\n", span->span_id, chan_config->group_name); - return FTDM_FAIL; - } - } - - if (ftdm_set_channels_gains(span, currindex, chan_config->rxgain, chan_config->txgain) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%d:Failed to set channel gains\n", span->span_id); - return FTDM_FAIL; - } - - for (chan_index = currindex + 1; chan_index <= span->chan_count; chan_index++) { - if (chan_config->iostats) { - ftdm_channel_set_feature(span->channels[chan_index], FTDM_CHANNEL_FEATURE_IO_STATS); - } - - if (!FTDM_IS_VOICE_CHANNEL(span->channels[chan_index])) { - continue; - } - - if (chan_config->debugdtmf) { - span->channels[chan_index]->dtmfdbg.requested = 1; - } - - span->channels[chan_index]->dtmfdetect.duration_ms = chan_config->dtmfdetect_ms; - if (chan_config->dtmf_on_start) { - span->channels[chan_index]->dtmfdetect.trigger_on_start = 1; - } - if (chan_config->dtmf_time_on) { - ftdm_channel_command(span->channels[chan_index], FTDM_COMMAND_SET_DTMF_ON_PERIOD, &chan_config->dtmf_time_on); - } - if (chan_config->dtmf_time_off) { - ftdm_channel_command(span->channels[chan_index], FTDM_COMMAND_SET_DTMF_OFF_PERIOD, &chan_config->dtmf_time_off); - } - } - - return FTDM_SUCCESS; -} - - -static ftdm_status_t load_config(void) -{ - const char cfg_name[] = "freetdm.conf"; - ftdm_config_t cfg; - char *var, *val; - int catno = -1; - int intparam = 0; - ftdm_span_t *span = NULL; - unsigned configured = 0, d = 0; - ftdm_analog_start_type_t tmp; - ftdm_size_t len = 0; - ftdm_channel_config_t chan_config; - ftdm_status_t ret = FTDM_SUCCESS; - - memset(&chan_config, 0, sizeof(chan_config)); - sprintf(chan_config.group_name, "__default"); - - if (!ftdm_config_open_file(&cfg, cfg_name)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open configuration file %s\n", cfg_name); - return FTDM_FAIL; - } - - ftdm_log(FTDM_LOG_DEBUG, "Reading FreeTDM configuration file\n"); - - while (ftdm_config_next_pair(&cfg, &var, &val)) { - if (*cfg.category == '#') { - if (cfg.catno != catno) { - ftdm_log(FTDM_LOG_DEBUG, "Skipping %s\n", cfg.category); - catno = cfg.catno; - } - } else if (!strncasecmp(cfg.category, "span", 4)) { - if (cfg.catno != catno) { - char *type = cfg.category + 4; - char *name; - - if (*type == ' ') { - type++; - } - - ftdm_log(FTDM_LOG_DEBUG, "found config for span\n"); - catno = cfg.catno; - - if (ftdm_strlen_zero(type)) { - ftdm_log(FTDM_LOG_CRIT, "failure creating span, no type specified.\n"); - span = NULL; - continue; - } - - if ((name = strchr(type, ' '))) { - *name++ = '\0'; - } - - /* Verify if trunk_type was specified for previous span */ - if (span && span->trunk_type == FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_ERROR, "trunk_type not specified for span %d (%s)\n", span->span_id, span->name); - ret = FTDM_FAIL; - goto done; - } - - if (ftdm_span_create(type, name, &span) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "created span %d (%s) of type %s\n", span->span_id, span->name, type); - d = 0; - /* it is confusing that parameters from one span affect others, so let's clear them */ - memset(&chan_config, 0, sizeof(chan_config)); - sprintf(chan_config.group_name, "__default"); - /* default to storing iostats */ - chan_config.iostats = FTDM_TRUE; - } else { - ftdm_log(FTDM_LOG_CRIT, "failure creating span of type %s\n", type); - span = NULL; - continue; - } - } - - if (!span) { - continue; - } - - ftdm_log(FTDM_LOG_DEBUG, "span %d [%s]=[%s]\n", span->span_id, var, val); - - if (!strcasecmp(var, "trunk_type")) { - ftdm_trunk_type_t trtype = ftdm_str2ftdm_trunk_type(val); - ftdm_span_set_trunk_type(span, trtype); - ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s'\n", ftdm_trunk_type2str(trtype)); - } else if (!strcasecmp(var, "trunk_mode")) { - ftdm_trunk_mode_t trmode = ftdm_str2ftdm_trunk_mode(val); - ftdm_span_set_trunk_mode(span, trmode); - ftdm_log(FTDM_LOG_DEBUG, "setting trunk mode to '%s'\n", ftdm_trunk_mode2str(trmode)); - } else if (!strcasecmp(var, "name")) { - if (!strcasecmp(val, "undef")) { - chan_config.name[0] = '\0'; - } else { - ftdm_copy_string(chan_config.name, val, FTDM_MAX_NAME_STR_SZ); - } - } else if (!strcasecmp(var, "number")) { - if (!strcasecmp(val, "undef")) { - chan_config.number[0] = '\0'; - } else { - ftdm_copy_string(chan_config.number, val, FTDM_MAX_NUMBER_STR_SZ); - } - } else if (!strcasecmp(var, "analog-start-type")) { - if (span->trunk_type == FTDM_TRUNK_FXS || span->trunk_type == FTDM_TRUNK_FXO || span->trunk_type == FTDM_TRUNK_EM) { - if ((tmp = ftdm_str2ftdm_analog_start_type(val)) != FTDM_ANALOG_START_NA) { - span->start_type = tmp; - ftdm_log(FTDM_LOG_DEBUG, "changing start type to '%s'\n", ftdm_analog_start_type2str(span->start_type)); - } - } else { - ftdm_log(FTDM_LOG_ERROR, "This option is only valid on analog trunks!\n"); - } - } else if (!strcasecmp(var, "fxo-channel")) { - if (span->trunk_type == FTDM_TRUNK_NONE) { - span->trunk_type = FTDM_TRUNK_FXO; - span->trunk_mode = FTDM_TRUNK_MODE_CPE; - ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s), mode(%s)\n", ftdm_trunk_type2str(span->trunk_type), - ftdm_analog_start_type2str(span->start_type), ftdm_trunk_mode2str(span->trunk_mode)); - } - if (span->trunk_type == FTDM_TRUNK_FXO) { - unsigned chans_configured = 0; - chan_config.type = FTDM_CHAN_TYPE_FXO; - if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { - configured += chans_configured; - } - } else { - ftdm_log(FTDM_LOG_WARNING, "Cannot add FXO channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); - } - } else if (!strcasecmp(var, "fxs-channel")) { - if (span->trunk_type == FTDM_TRUNK_NONE) { - span->trunk_type = FTDM_TRUNK_FXS; - span->trunk_mode = FTDM_TRUNK_MODE_NET; - ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s), mode(%s)\n", ftdm_trunk_type2str(span->trunk_type), - ftdm_analog_start_type2str(span->start_type), ftdm_trunk_mode2str(span->trunk_mode)); - } - if (span->trunk_type == FTDM_TRUNK_FXS) { - unsigned chans_configured = 0; - chan_config.type = FTDM_CHAN_TYPE_FXS; - if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { - configured += chans_configured; - } - } else { - ftdm_log(FTDM_LOG_WARNING, "Cannot add FXS channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); - } - } else if (!strcasecmp(var, "em-channel")) { - if (span->trunk_type == FTDM_TRUNK_NONE) { - span->trunk_type = FTDM_TRUNK_EM; - span->trunk_mode = FTDM_TRUNK_MODE_CPE; - ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s), mode(%s)\n", ftdm_trunk_type2str(span->trunk_type), - ftdm_analog_start_type2str(span->start_type), ftdm_trunk_mode2str(span->trunk_mode)); - } - if (span->trunk_type == FTDM_TRUNK_EM) { - unsigned chans_configured = 0; - chan_config.type = FTDM_CHAN_TYPE_EM; - if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { - configured += chans_configured; - } - } else { - ftdm_log(FTDM_LOG_WARNING, "Cannot add EM channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); - } - } else if (!strcasecmp(var, "b-channel")) { - if (span->trunk_type == FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_ERROR, "No trunk type specified in configuration file\n"); - break; - } - if (FTDM_SPAN_IS_DIGITAL(span)) { - unsigned chans_configured = 0; - chan_config.type = FTDM_CHAN_TYPE_B; - if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { - configured += chans_configured; - } - } else { - ftdm_log(FTDM_LOG_WARNING, "Cannot add B channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); - } - } else if (!strcasecmp(var, "d-channel")) { - if (span->trunk_type == FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_ERROR, "No trunk type specified in configuration file\n"); - break; - } - if (FTDM_SPAN_IS_DIGITAL(span)) { - unsigned chans_configured = 0; - if (d) { - ftdm_log(FTDM_LOG_WARNING, "ignoring extra d-channel\n"); - continue; - } - if (!strncasecmp(val, "lapd:", 5)) { - chan_config.type = FTDM_CHAN_TYPE_DQ931; - val += 5; - } else { - chan_config.type = FTDM_CHAN_TYPE_DQ921; - } - if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { - configured += chans_configured; - } - d++; - } else { - ftdm_log(FTDM_LOG_WARNING, "Cannot add D channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); - } - } else if (!strcasecmp(var, "cas-channel")) { - unsigned chans_configured = 0; - chan_config.type = FTDM_CHAN_TYPE_CAS; - if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { - configured += chans_configured; - } - } else if (!strcasecmp(var, "dtmf_hangup")) { - span->dtmf_hangup = ftdm_strdup(val); - span->dtmf_hangup_len = strlen(val); - } else if (!strcasecmp(var, "txgain")) { - if (sscanf(val, "%f", &(chan_config.txgain)) != 1) { - ftdm_log(FTDM_LOG_ERROR, "invalid txgain: '%s'\n", val); - } - } else if (!strcasecmp(var, "rxgain")) { - if (sscanf(val, "%f", &(chan_config.rxgain)) != 1) { - ftdm_log(FTDM_LOG_ERROR, "invalid rxgain: '%s'\n", val); - } - } else if (!strcasecmp(var, "debugdtmf")) { - chan_config.debugdtmf = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Setting debugdtmf to '%s'\n", chan_config.debugdtmf ? "yes" : "no"); - } else if (!strncasecmp(var, "dtmfdetect_ms", sizeof("dtmfdetect_ms")-1)) { - if (chan_config.dtmf_on_start == FTDM_TRUE) { - chan_config.dtmf_on_start = FTDM_FALSE; - ftdm_log(FTDM_LOG_WARNING, "dtmf_on_start parameter disabled because dtmfdetect_ms specified\n"); - } - if (sscanf(val, "%d", &(chan_config.dtmfdetect_ms)) != 1) { - ftdm_log(FTDM_LOG_ERROR, "invalid dtmfdetect_ms: '%s'\n", val); - } - } else if (!strncasecmp(var, "dtmf_on_start", sizeof("dtmf_on_start")-1)) { - if (chan_config.dtmfdetect_ms) { - ftdm_log(FTDM_LOG_WARNING, "dtmf_on_start parameter ignored because dtmf_detect_ms specified\n"); - } else { - if (ftdm_true(val)) { - chan_config.dtmf_on_start = FTDM_TRUE; - } else { - chan_config.dtmf_on_start = FTDM_FALSE; - } - } - } else if (!strcasecmp(var, "dtmf_time_on")) { - if (sscanf(val, "%u", &(chan_config.dtmf_time_on)) != 1) { - ftdm_log(FTDM_LOG_ERROR, "invalid dtmf_time_on: '%s'\n", val); - } - } else if (!strcasecmp(var, "dtmf_time_off")) { - if (sscanf(val, "%u", &(chan_config.dtmf_time_off)) != 1) { - ftdm_log(FTDM_LOG_ERROR, "invalid dtmf_time_off: '%s'\n", val); - } - } else if (!strncasecmp(var, "iostats", sizeof("iostats")-1)) { - if (ftdm_true(val)) { - chan_config.iostats = FTDM_TRUE; - } else { - chan_config.iostats = FTDM_FALSE; - } - ftdm_log(FTDM_LOG_DEBUG, "Setting iostats to '%s'\n", chan_config.iostats ? "yes" : "no"); - } else if (!strcasecmp(var, "group")) { - len = strlen(val); - if (len >= FTDM_MAX_NAME_STR_SZ) { - len = FTDM_MAX_NAME_STR_SZ - 1; - ftdm_log(FTDM_LOG_WARNING, "Truncating group name %s to %"FTDM_SIZE_FMT" length\n", val, len); - } - memcpy(chan_config.group_name, val, len); - chan_config.group_name[len] = '\0'; - } else { - ftdm_log(FTDM_LOG_ERROR, "unknown span variable '%s'\n", var); - } - } else if (!strncasecmp(cfg.category, "general", 7)) { - if (!strncasecmp(var, "cpu_monitor", sizeof("cpu_monitor")-1)) { - if (!strncasecmp(val, "yes", 3)) { - globals.cpu_monitor.enabled = 1; - if (!globals.cpu_monitor.alarm_action_flags) { - globals.cpu_monitor.alarm_action_flags |= FTDM_CPU_ALARM_ACTION_WARN; - } - } - } else if (!strncasecmp(var, "debugdtmf_directory", sizeof("debugdtmf_directory")-1)) { - ftdm_set_string(globals.dtmfdebug_directory, val); - ftdm_log(FTDM_LOG_DEBUG, "Debug DTMF directory set to '%s'\n", globals.dtmfdebug_directory); - } else if (!strncasecmp(var, "cpu_monitoring_interval", sizeof("cpu_monitoring_interval")-1)) { - if (atoi(val) > 0) { - globals.cpu_monitor.interval = atoi(val); - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid cpu monitoring interval %s\n", val); - } - } else if (!strncasecmp(var, "cpu_set_alarm_threshold", sizeof("cpu_set_alarm_threshold")-1)) { - intparam = atoi(val); - if (intparam > 0 && intparam < 100) { - globals.cpu_monitor.set_alarm_threshold = (uint8_t)intparam; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid cpu alarm set threshold %s\n", val); - } - } else if (!strncasecmp(var, "cpu_reset_alarm_threshold", sizeof("cpu_reset_alarm_threshold")-1) || - !strncasecmp(var, "cpu_clear_alarm_threshold", sizeof("cpu_clear_alarm_threshold")-1)) { - intparam = atoi(val); - if (intparam > 0 && intparam < 100) { - globals.cpu_monitor.clear_alarm_threshold = (uint8_t)intparam; - if (globals.cpu_monitor.clear_alarm_threshold > globals.cpu_monitor.set_alarm_threshold) { - globals.cpu_monitor.clear_alarm_threshold = globals.cpu_monitor.set_alarm_threshold - 10; - ftdm_log(FTDM_LOG_ERROR, "Cpu alarm clear threshold must be lower than set threshold, " - "setting clear threshold to %d\n", globals.cpu_monitor.clear_alarm_threshold); - } - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid cpu alarm reset threshold %s\n", val); - } - } else if (!strncasecmp(var, "cpu_alarm_action", sizeof("cpu_alarm_action")-1)) { - char* p = val; - do { - if (!strncasecmp(p, "reject", sizeof("reject")-1)) { - globals.cpu_monitor.alarm_action_flags |= FTDM_CPU_ALARM_ACTION_REJECT; - } else if (!strncasecmp(p, "warn", sizeof("warn")-1)) { - globals.cpu_monitor.alarm_action_flags |= FTDM_CPU_ALARM_ACTION_WARN; - } - p = strchr(p, ','); - if (p) { - while(*p++) if (*p != 0x20) break; - } - } while (p); - } - } else { - ftdm_log(FTDM_LOG_ERROR, "unknown param [%s] '%s' / '%s'\n", cfg.category, var, val); - } - } - - /* Verify is trunk_type was specified for the last span */ - if (span && span->trunk_type == FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_ERROR, "trunk_type not specified for span %d (%s)\n", span->span_id, span->name); - ret = FTDM_FAIL; - } - -done: - ftdm_config_close_file(&cfg); - - ftdm_log(FTDM_LOG_INFO, "Configured %u channel(s)\n", configured); - if (!configured) { - ret = FTDM_FAIL; - } - - return ret; -} - -static ftdm_status_t process_module_config(ftdm_io_interface_t *fio) -{ - ftdm_config_t cfg; - char *var, *val; - char filename[256] = ""; - - ftdm_assert_return(fio != NULL, FTDM_FAIL, "fio argument is null\n"); - - snprintf(filename, sizeof(filename), "%s.conf", fio->name); - - if (!fio->configure) { - ftdm_log(FTDM_LOG_DEBUG, "Module %s does not support configuration.\n", fio->name); - return FTDM_FAIL; - } - - if (!ftdm_config_open_file(&cfg, filename)) { - /* This is normal if the user did not provide a configuration for this module */ - ftdm_log(FTDM_LOG_DEBUG, "File %s is not available\n", filename); - return FTDM_FAIL; - } - - while (ftdm_config_next_pair(&cfg, &var, &val)) { - fio->configure(cfg.category, var, val, cfg.lineno); - } - - ftdm_config_close_file(&cfg); - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_global_add_io_interface(ftdm_io_interface_t *interface1) -{ - ftdm_status_t ret = FTDM_SUCCESS; - ftdm_mutex_lock(globals.mutex); - if (hashtable_search(globals.interface_hash, (void *)interface1->name)) { - ftdm_log(FTDM_LOG_ERROR, "Interface %s already loaded!\n", interface1->name); - } else { - hashtable_insert(globals.interface_hash, (void *)interface1->name, interface1, HASHTABLE_FLAG_NONE); - } - ftdm_mutex_unlock(globals.mutex); - return ret; -} - -FT_DECLARE(ftdm_io_interface_t *) ftdm_global_get_io_interface(const char *iotype, ftdm_bool_t autoload) -{ - ftdm_io_interface_t *fio = NULL; - - ftdm_mutex_lock(globals.mutex); - - fio = (ftdm_io_interface_t *) hashtable_search(globals.interface_hash, (void *)iotype); - if (!fio && autoload) { - ftdm_load_module_assume(iotype); - fio = (ftdm_io_interface_t *) hashtable_search(globals.interface_hash, (void *)iotype); - if (fio) { - ftdm_log(FTDM_LOG_INFO, "Auto-loaded I/O module '%s'\n", iotype); - } - } - - ftdm_mutex_unlock(globals.mutex); - return fio; -} - -FT_DECLARE(int) ftdm_load_module(const char *name) -{ - ftdm_dso_lib_t lib; - int count = 0; - ftdm_bool_t load_proceed = FTDM_TRUE; - char path[512] = ""; - char *err; - ftdm_module_t *mod; - - ftdm_build_dso_path(name, path, sizeof(path)); - - if (!(lib = ftdm_dso_open(path, &err))) { - ftdm_log(FTDM_LOG_ERROR, "Error loading %s [%s]\n", path, err); - ftdm_safe_free(err); - return 0; - } - - if (!(mod = (ftdm_module_t *) ftdm_dso_func_sym(lib, "ftdm_module", &err))) { - ftdm_log(FTDM_LOG_ERROR, "Error loading %s [%s]\n", path, err); - ftdm_safe_free(err); - return 0; - } - - if (mod->io_load) { - ftdm_io_interface_t *interface1 = NULL; /* name conflict w/windows here */ - - if (mod->io_load(&interface1) != FTDM_SUCCESS || !interface1 || !interface1->name) { - ftdm_log(FTDM_LOG_ERROR, "Error loading %s\n", path); - load_proceed = FTDM_FALSE; - } else { - ftdm_log(FTDM_LOG_INFO, "Loading IO from %s [%s]\n", path, interface1->name); - if (ftdm_global_add_io_interface(interface1) == FTDM_SUCCESS) { - process_module_config(interface1); - } - } - } - - if (mod->sig_load) { - if (mod->sig_load() != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error loading %s\n", path); - load_proceed = FTDM_FALSE; - } else { - ftdm_log(FTDM_LOG_INFO, "Loading SIG from %s\n", path); - } - } - - if (load_proceed) { - char *p; - mod->lib = lib; - ftdm_set_string(mod->path, path); - if (mod->name[0] == '\0') { - if (!(p = strrchr(path, *FTDM_PATH_SEPARATOR))) { - p = path; - } - ftdm_set_string(mod->name, p); - } - - ftdm_mutex_lock(globals.mutex); - if (hashtable_search(globals.module_hash, (void *)mod->name)) { - ftdm_log(FTDM_LOG_ERROR, "Module %s already loaded!\n", mod->name); - ftdm_dso_destroy(&lib); - } else { - hashtable_insert(globals.module_hash, (void *)mod->name, mod, HASHTABLE_FLAG_NONE); - count++; - } - ftdm_mutex_unlock(globals.mutex); - } else { - ftdm_log(FTDM_LOG_ERROR, "Errors during module load. Unloading %s\n", path); - ftdm_dso_destroy(&lib); - } - - return count; -} - -FT_DECLARE(int) ftdm_load_module_assume(const char *name) -{ - char buf[256] = ""; - - snprintf(buf, sizeof(buf), "ftmod_%s", name); - return ftdm_load_module(buf); -} - -FT_DECLARE(int) ftdm_load_modules(void) -{ - char cfg_name[] = "modules.conf"; - ftdm_config_t cfg; - char *var, *val; - int count = 0; - - if (!ftdm_config_open_file(&cfg, cfg_name)) { - return FTDM_FAIL; - } - - while (ftdm_config_next_pair(&cfg, &var, &val)) { - if (!strcasecmp(cfg.category, "modules")) { - if (!strcasecmp(var, "load")) { - count += ftdm_load_module(val); - } - } - } - - return count; -} - -FT_DECLARE(ftdm_status_t) ftdm_unload_modules(void) -{ - ftdm_hash_iterator_t *i = NULL; - ftdm_dso_lib_t lib = NULL; - char modpath[256] = { 0 }; - - /* stop signaling interfaces first as signaling depends on I/O and not the other way around */ - for (i = hashtable_first(globals.module_hash); i; i = hashtable_next(i)) { - const void *key = NULL; - void *val = NULL; - ftdm_module_t *mod = NULL; - - hashtable_this(i, &key, NULL, &val); - - if (!key || !val) { - continue; - } - - mod = (ftdm_module_t *) val; - - if (!mod->sig_unload) { - continue; - } - - ftdm_log(FTDM_LOG_INFO, "Unloading signaling interface %s\n", mod->name); - - if (mod->sig_unload() != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error unloading signaling interface %s\n", mod->name); - continue; - } - - ftdm_log(FTDM_LOG_INFO, "Unloaded signaling interface %s\n", mod->name); - } - - /* Now go ahead with I/O interfaces */ - for (i = hashtable_first(globals.module_hash); i; i = hashtable_next(i)) { - const void *key = NULL; - void *val = NULL; - ftdm_module_t *mod = NULL; - - hashtable_this(i, &key, NULL, &val); - - if (!key || !val) { - continue; - } - - mod = (ftdm_module_t *) val; - - if (!mod->io_unload) { - continue; - } - - ftdm_log(FTDM_LOG_INFO, "Unloading I/O interface %s\n", mod->name); - - if (mod->io_unload() != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error unloading I/O interface %s\n", mod->name); - continue; - } - - ftdm_log(FTDM_LOG_INFO, "Unloaded I/O interface %s\n", mod->name); - } - - /* Now unload the actual shared object/dll */ - for (i = hashtable_first(globals.module_hash); i; i = hashtable_next(i)) { - ftdm_module_t *mod = NULL; - const void *key = NULL; - void *val = NULL; - - hashtable_this(i, &key, NULL, &val); - - if (!key || !val) { - continue; - } - - mod = (ftdm_module_t *) val; - - lib = mod->lib; - snprintf(modpath, sizeof(modpath), "%s", mod->path); - ftdm_log(FTDM_LOG_INFO, "Unloading module %s\n", modpath); - ftdm_dso_destroy(&lib); - ftdm_log(FTDM_LOG_INFO, "Unloaded module %s\n", modpath); - } - - return FTDM_SUCCESS; -} - -static ftdm_status_t post_configure_span_channels(ftdm_span_t *span) -{ - unsigned i = 0; - ftdm_status_t status = FTDM_SUCCESS; - ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; - for (i = 1; i <= span->chan_count; i++) { - sigstatus = FTDM_SIG_STATE_DOWN; - ftdm_channel_get_sig_status(span->channels[i], &sigstatus); - if (sigstatus == FTDM_SIG_STATE_UP) { - ftdm_set_flag(span->channels[i], FTDM_CHANNEL_SIG_UP); - } - } - if (ftdm_test_flag(span, FTDM_SPAN_USE_CHAN_QUEUE)) { - status = ftdm_queue_create(&span->pendingchans, SPAN_PENDING_CHANS_QUEUE_SIZE); - } - if (status == FTDM_SUCCESS && ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE)) { - status = ftdm_queue_create(&span->pendingsignals, SPAN_PENDING_SIGNALS_QUEUE_SIZE); - } - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_configure_span(ftdm_span_t *span, const char *type, fio_signal_cb_t sig_cb, ...) -{ - ftdm_module_t *mod = (ftdm_module_t *) hashtable_search(globals.module_hash, (void *)type); - ftdm_status_t status = FTDM_FAIL; - - if (!span->chan_count) { - ftdm_log(FTDM_LOG_WARNING, "Cannot configure signaling on span with no channels\n"); - return FTDM_FAIL; - } - - if (!mod) { - ftdm_load_module_assume(type); - if ((mod = (ftdm_module_t *) hashtable_search(globals.module_hash, (void *)type))) { - ftdm_log(FTDM_LOG_INFO, "auto-loaded '%s'\n", type); - } else { - ftdm_log(FTDM_LOG_ERROR, "can't load '%s'\n", type); - return FTDM_FAIL; - } - } - - if (mod->sig_configure) { - va_list ap; - va_start(ap, sig_cb); - status = mod->sig_configure(span, sig_cb, ap); - va_end(ap); - if (status == FTDM_SUCCESS) { - status = post_configure_span_channels(span); - } - } else { - ftdm_log(FTDM_LOG_CRIT, "module '%s' did not implement the sig_configure method\n", type); - status = FTDM_FAIL; - } - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const char *type, fio_signal_cb_t sig_cb, ftdm_conf_parameter_t *parameters) -{ - ftdm_module_t *mod = (ftdm_module_t *) hashtable_search(globals.module_hash, (void *)type); - ftdm_status_t status = FTDM_FAIL; - - ftdm_assert_return(type != NULL, FTDM_FAIL, "No signaling type"); - ftdm_assert_return(span != NULL, FTDM_FAIL, "No span"); - ftdm_assert_return(sig_cb != NULL, FTDM_FAIL, "No signaling callback"); - ftdm_assert_return(parameters != NULL, FTDM_FAIL, "No parameters"); - - if (!span->chan_count) { - ftdm_log(FTDM_LOG_WARNING, "Cannot configure signaling on span %s with no channels\n", span->name); - return FTDM_FAIL; - } - - if (!mod) { - ftdm_load_module_assume(type); - if ((mod = (ftdm_module_t *) hashtable_search(globals.module_hash, (void *)type))) { - ftdm_log(FTDM_LOG_INFO, "auto-loaded '%s'\n", type); - } - } - - if (!mod) { - ftdm_log(FTDM_LOG_ERROR, "Failed to load module type: %s\n", type); - return FTDM_FAIL; - } - - if (mod->configure_span_signaling) { - status = mod->configure_span_signaling(span, sig_cb, parameters); - if (status == FTDM_SUCCESS) { - status = post_configure_span_channels(span); - } - } else { - ftdm_log(FTDM_LOG_ERROR, "Module %s did not implement the signaling configuration method\n", type); - } - - return status; -} - -static void *ftdm_span_service_events(ftdm_thread_t *me, void *obj) -{ - uint32_t i; - unsigned waitms; - ftdm_event_t *event; - ftdm_status_t status = FTDM_SUCCESS; - ftdm_span_t *span = (ftdm_span_t*) obj; - short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); - - if (me == 0) {}; - - memset(poll_events, 0, sizeof(short) * span->chan_count); - - for(i = 1; i <= span->chan_count; i++) { - poll_events[i] |= FTDM_EVENTS; - } - - while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { - waitms = 1000; - status = ftdm_span_poll_event(span, waitms, poll_events); - switch (status) { - case FTDM_FAIL: - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to poll span for events\n", span->name); - break; - case FTDM_TIMEOUT: - break; - case FTDM_SUCCESS: - /* Check if there are any channels that have events available */ - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS); - break; - default: - ftdm_log(FTDM_LOG_CRIT, "%s:Unhandled IO event\n", span->name); - } - } - return NULL; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_register_signal_cb(ftdm_span_t *span, fio_signal_cb_t sig_cb) -{ - span->signal_cb = sig_cb; - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_mutex_lock(span->mutex); - - if (ftdm_test_flag(span, FTDM_SPAN_STARTED)) { - status = FTDM_EINVAL; - goto done; - } - if (span->signal_type == FTDM_SIGTYPE_NONE) { - /* If there is no signalling component, start a thread to poll events */ - status = ftdm_thread_create_detached(ftdm_span_service_events, span); - if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT,"Failed to start span event monitor thread!\n"); - goto done; - } - - //ftdm_report_initial_channels_alarms(span); - ftdm_set_flag_locked(span, FTDM_SPAN_STARTED); - goto done; - } - - if (!span->start) { - status = FTDM_ENOSYS; - goto done; - } - - /* Start I/O */ - if (span->fio && span->fio->span_start) { - status = span->fio->span_start(span); - if (status != FTDM_SUCCESS) - goto done; - } - - /* Start SIG */ - status = ftdm_report_initial_channels_alarms(span); - if (status != FTDM_SUCCESS) { - goto done; - } - - status = span->start(span); - if (status == FTDM_SUCCESS) { - ftdm_set_flag_locked(span, FTDM_SPAN_STARTED); - } -done: - ftdm_mutex_unlock(span->mutex); - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_channel_t* ftdmchan) -{ - unsigned int i; - ftdm_group_t* group = NULL; - - ftdm_mutex_lock(globals.group_mutex); - - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Cannot add a null channel to a group\n"); - - if (ftdm_group_find_by_name(name, &group) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "Creating new group:%s\n", name); - ftdm_group_create(&group, name); - } - - /*verify that group does not already include this channel first */ - for(i = 0; i < group->chan_count; i++) { - if (group->channels[i]->physical_span_id == ftdmchan->physical_span_id && - group->channels[i]->physical_chan_id == ftdmchan->physical_chan_id) { - - ftdm_mutex_unlock(globals.group_mutex); - ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d is already added to group %s\n", - group->channels[i]->physical_span_id, - group->channels[i]->physical_chan_id, - name); - return FTDM_SUCCESS; - } - } - - if (group->chan_count >= FTDM_MAX_CHANNELS_GROUP) { - ftdm_log(FTDM_LOG_ERROR, "Max number of channels exceeded (max:%d)\n", FTDM_MAX_CHANNELS_GROUP); - ftdm_mutex_unlock(globals.group_mutex); - return FTDM_FAIL; - } - - group->channels[group->chan_count++] = ftdmchan; - ftdm_mutex_unlock(globals.group_mutex); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_remove_from_group(ftdm_group_t* group, ftdm_channel_t* ftdmchan) -{ - unsigned int i, j; - //Need to test this function - ftdm_mutex_lock(globals.group_mutex); - - for (i=0; i < group->chan_count; i++) { - if (group->channels[i]->physical_span_id == ftdmchan->physical_span_id && - group->channels[i]->physical_chan_id == ftdmchan->physical_chan_id) { - - j=i; - while(j < group->chan_count-1) { - group->channels[j] = group->channels[j+1]; - j++; - } - group->channels[group->chan_count--] = NULL; - if (group->chan_count <=0) { - /* Delete group if it is empty */ - hashtable_remove(globals.group_hash, (void *)group->name); - } - ftdm_mutex_unlock(globals.group_mutex); - return FTDM_SUCCESS; - } - } - - ftdm_mutex_unlock(globals.group_mutex); - //Group does not contain this channel - return FTDM_FAIL; -} - -static ftdm_status_t ftdm_group_add_channels(ftdm_span_t* span, int currindex, const char* name) -{ - unsigned chan_index = 0; - - ftdm_assert_return(strlen(name) > 0, FTDM_FAIL, "Invalid group name provided\n"); - ftdm_assert_return(currindex >= 0, FTDM_FAIL, "Invalid current channel index provided\n"); - - if (!span->chan_count) { - return FTDM_SUCCESS; - } - - for (chan_index = currindex+1; chan_index <= span->chan_count; chan_index++) { - if (!FTDM_IS_VOICE_CHANNEL(span->channels[chan_index])) { - continue; - } - if (ftdm_channel_add_to_group(name, span->channels[chan_index])) { - ftdm_log(FTDM_LOG_ERROR, "Failed to add chan:%d to group:%s\n", chan_index, name); - } - } - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_group_find(uint32_t id, ftdm_group_t **group) -{ - ftdm_group_t *fgroup = NULL, *grp; - - if (id > FTDM_MAX_GROUPS_INTERFACE) { - return FTDM_FAIL; - } - - - ftdm_mutex_lock(globals.group_mutex); - for (grp = globals.groups; grp; grp = grp->next) { - if (grp->group_id == id) { - fgroup = grp; - break; - } - } - ftdm_mutex_unlock(globals.group_mutex); - - if (!fgroup) { - return FTDM_FAIL; - } - - *group = fgroup; - - return FTDM_SUCCESS; - -} - -FT_DECLARE(ftdm_status_t) ftdm_group_find_by_name(const char *name, ftdm_group_t **group) -{ - ftdm_status_t status = FTDM_FAIL; - *group = NULL; - ftdm_mutex_lock(globals.group_mutex); - if (!ftdm_strlen_zero(name)) { - if ((*group = hashtable_search(globals.group_hash, (void *) name))) { - status = FTDM_SUCCESS; - } - } - ftdm_mutex_unlock(globals.group_mutex); - return status; -} - -static void ftdm_group_add(ftdm_group_t *group) -{ - ftdm_group_t *grp; - ftdm_mutex_lock(globals.group_mutex); - - for (grp = globals.groups; grp && grp->next; grp = grp->next); - - if (grp) { - grp->next = group; - } else { - globals.groups = group; - } - hashtable_insert(globals.group_hash, (void *)group->name, group, HASHTABLE_FLAG_NONE); - - ftdm_mutex_unlock(globals.group_mutex); -} - -FT_DECLARE(ftdm_status_t) ftdm_group_create(ftdm_group_t **group, const char *name) -{ - ftdm_group_t *new_group = NULL; - ftdm_status_t status = FTDM_FAIL; - - ftdm_mutex_lock(globals.mutex); - if (globals.group_index < FTDM_MAX_GROUPS_INTERFACE) { - new_group = ftdm_calloc(1, sizeof(*new_group)); - - ftdm_assert(new_group != NULL, "Failed to create new ftdm group, expect a crash\n"); - - status = ftdm_mutex_create(&new_group->mutex); - - ftdm_assert(status == FTDM_SUCCESS, "Failed to create group mutex, expect a crash\n"); - - new_group->group_id = ++globals.group_index; - new_group->name = ftdm_strdup(name); - ftdm_group_add(new_group); - *group = new_group; - status = FTDM_SUCCESS; - } else { - ftdm_log(FTDM_LOG_ERROR, "Group %s was not added, we exceeded the max number of groups\n", name); - } - ftdm_mutex_unlock(globals.mutex); - return status; -} - -static void ftdm_group_destroy(ftdm_group_t **group) -{ - ftdm_group_t *grp = NULL; - ftdm_assert(group != NULL, "Group must not be null\n"); - grp = *group; - ftdm_mutex_destroy(&grp->mutex); - ftdm_safe_free(grp->name); - ftdm_safe_free(grp); - *group = NULL; -} - -static ftdm_status_t ftdm_span_trigger_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) -{ - if (!span->signal_cb) { - return FTDM_FAIL; - } - return span->signal_cb(sigmsg); -} - -static ftdm_status_t ftdm_span_queue_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) -{ - ftdm_sigmsg_t *new_sigmsg = NULL; - - new_sigmsg = ftdm_calloc(1, sizeof(*sigmsg)); - if (!new_sigmsg) { - return FTDM_FAIL; - } - memcpy(new_sigmsg, sigmsg, sizeof(*sigmsg)); - - ftdm_queue_enqueue(span->pendingsignals, new_sigmsg); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span) -{ - ftdm_sigmsg_t *sigmsg = NULL; - while ((sigmsg = ftdm_queue_dequeue(span->pendingsignals))) { - ftdm_span_trigger_signal(span, sigmsg); - ftdm_sigmsg_free(&sigmsg); - } - return FTDM_SUCCESS; -} - -static void execute_safety_hangup(void *data) -{ - ftdm_channel_t *fchan = data; - ftdm_channel_lock(fchan); - fchan->hangup_timer = 0; - if (fchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Forcing hangup since the user did not confirmed our hangup after %dms\n", FORCE_HANGUP_TIMER); - _ftdm_channel_call_hangup_nl(__FILE__, __FTDM_FUNC__, __LINE__, fchan, NULL); - } else { - ftdm_log_chan(fchan, FTDM_LOG_CRIT, "Not performing safety hangup, channel state is %s\n", ftdm_channel_state2str(fchan->state)); - } - ftdm_channel_unlock(fchan); -} - -FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) -{ - ftdm_channel_t *fchan = NULL; - ftdm_status_t status = FTDM_SUCCESS; - if (sigmsg->channel) { - fchan = sigmsg->channel; - ftdm_channel_lock(fchan); - } - - /* some core things to do on special events */ - switch (sigmsg->event_id) { - - case FTDM_SIGEVENT_SIGSTATUS_CHANGED: - { - if (sigmsg->ev_data.sigstatus.status == FTDM_SIG_STATE_UP) { - ftdm_set_flag(fchan, FTDM_CHANNEL_SIG_UP); - ftdm_clear_flag(fchan, FTDM_CHANNEL_SUSPENDED); - } else { - ftdm_clear_flag(fchan, FTDM_CHANNEL_SIG_UP); - if (sigmsg->ev_data.sigstatus.status == FTDM_SIG_STATE_SUSPENDED) { - ftdm_set_flag(fchan, FTDM_CHANNEL_SUSPENDED); - } else { - ftdm_clear_flag(fchan, FTDM_CHANNEL_SUSPENDED); - } - } - } - break; - - case FTDM_SIGEVENT_START: - { - ftdm_assert(!ftdm_test_flag(fchan, FTDM_CHANNEL_CALL_STARTED), "Started call twice!\n"); - - if (ftdm_test_flag(fchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_log_chan_msg(fchan, FTDM_LOG_WARNING, "Inbound call taking over outbound channel\n"); - ftdm_clear_flag(fchan, FTDM_CHANNEL_OUTBOUND); - } - ftdm_set_flag(fchan, FTDM_CHANNEL_CALL_STARTED); - ftdm_call_set_call_id(fchan, &fchan->caller_data); - /* when cleaning up the public API I added this because mod_freetdm.c on_fxs_signal was - * doing it during SIGEVENT_START, but now that flags are private they can't, wonder if - * is needed at all? */ - ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_HOLD); - if (sigmsg->channel->caller_data.bearer_capability == FTDM_BEARER_CAP_UNRESTRICTED) { - ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_DIGITAL_MEDIA); - } - } - break; - - case FTDM_SIGEVENT_PROGRESS_MEDIA: - { - /* test signaling module compliance */ - if (fchan->state != FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "FTDM_SIGEVENT_PROGRESS_MEDIA sent in state %s\n", ftdm_channel_state2str(fchan->state)); - } - } - break; - - case FTDM_SIGEVENT_UP: - { - /* test signaling module compliance */ - if (fchan->state != FTDM_CHANNEL_STATE_UP) { - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "FTDM_SIGEVENT_UP sent in state %s\n", ftdm_channel_state2str(fchan->state)); - } - } - break; - - case FTDM_SIGEVENT_STOP: - { - /* TODO: we could test for compliance here and check the state is FTDM_CHANNEL_STATE_TERMINATING - * but several modules need to be updated first */ - - /* if the call was never started, do not send SIGEVENT_STOP - this happens for FXS devices in ftmod_analog which blindly send SIGEVENT_STOP, we should fix it there ... */ - if (!ftdm_test_flag(fchan, FTDM_CHANNEL_CALL_STARTED)) { - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user never knew about a call in this channel\n"); - goto done; - } - - if (ftdm_test_flag(fchan, FTDM_CHANNEL_USER_HANGUP)) { - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user already requested hangup\n"); - goto done; - } - - if (fchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Scheduling safety hangup timer\n"); - /* if the user does not move us to hangup in 2 seconds, we will do it ourselves */ - ftdm_sched_timer(globals.timingsched, "safety-hangup", FORCE_HANGUP_TIMER, execute_safety_hangup, fchan, &fchan->hangup_timer); - } - } - break; - - default: - break; - - } - - if (fchan) { - /* set members of the sigmsg that must be present for all events */ - sigmsg->chan_id = fchan->chan_id; - sigmsg->span_id = fchan->span_id; - sigmsg->call_id = fchan->caller_data.call_id; - sigmsg->call_priv = fchan->caller_data.priv; - } - - /* if the signaling module uses a queue for signaling notifications, then enqueue it */ - if (ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE)) { - ftdm_span_queue_signal(span, sigmsg); - } else { - status = ftdm_span_trigger_signal(span, sigmsg); - } - -done: - - if (fchan) { - ftdm_channel_unlock(fchan); - } - - return status; -} - -static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj) -{ - cpu_monitor_t *monitor = (cpu_monitor_t *)obj; - struct ftdm_cpu_monitor_stats *cpu_stats = ftdm_new_cpu_monitor(); - - ftdm_log(FTDM_LOG_DEBUG, "CPU monitor thread is now running\n"); - if (!cpu_stats) { - goto done; - } - monitor->running = 1; - - while (ftdm_running()) { - double idle_time = 0.0; - int cpu_usage = 0; - - if (ftdm_cpu_get_system_idle_time(cpu_stats, &idle_time)) { - break; - } - - cpu_usage = (int)(100 - idle_time); - if (monitor->alarm) { - if (cpu_usage <= monitor->clear_alarm_threshold) { - ftdm_log(FTDM_LOG_DEBUG, "CPU alarm is now OFF (cpu usage: %d)\n", cpu_usage); - monitor->alarm = 0; - } else if (monitor->alarm_action_flags & FTDM_CPU_ALARM_ACTION_WARN) { - ftdm_log(FTDM_LOG_WARNING, "CPU alarm is still ON (cpu usage: %d)\n", cpu_usage); - } - } else { - if (cpu_usage >= monitor->set_alarm_threshold) { - ftdm_log(FTDM_LOG_WARNING, "CPU alarm is now ON (cpu usage: %d)\n", cpu_usage); - monitor->alarm = 1; - } - } - ftdm_interrupt_wait(monitor->interrupt, monitor->interval); - } - - ftdm_delete_cpu_monitor(cpu_stats); - monitor->running = 0; - -done: - ftdm_unused_arg(me); - ftdm_log(FTDM_LOG_DEBUG, "CPU monitor thread is now terminating\n"); - return NULL; -} - -static ftdm_status_t ftdm_cpu_monitor_start(void) -{ - if (ftdm_interrupt_create(&globals.cpu_monitor.interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to create CPU monitor interrupt\n"); - return FTDM_FAIL; - } - - if (ftdm_thread_create_detached(ftdm_cpu_monitor_run, &globals.cpu_monitor) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to create cpu monitor thread!!\n"); - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -static void ftdm_cpu_monitor_stop(void) -{ - if (!globals.cpu_monitor.interrupt) { - return; - } - - if (!globals.cpu_monitor.running) { - return; - } - - if (ftdm_interrupt_signal(globals.cpu_monitor.interrupt) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to interrupt the CPU monitor\n"); - return; - } - - while (globals.cpu_monitor.running) { - ftdm_sleep(10); - } - - ftdm_interrupt_destroy(&globals.cpu_monitor.interrupt); -} - -FT_DECLARE(ftdm_status_t) ftdm_global_init(void) -{ - memset(&globals, 0, sizeof(globals)); - - time_init(); - - ftdm_thread_override_default_stacksize(FTDM_THREAD_STACKSIZE); - - globals.interface_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - globals.module_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - globals.span_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - globals.group_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - ftdm_mutex_create(&globals.mutex); - ftdm_mutex_create(&globals.span_mutex); - ftdm_mutex_create(&globals.group_mutex); - ftdm_mutex_create(&globals.call_id_mutex); - - ftdm_sched_global_init(); - globals.running = 1; - if (ftdm_sched_create(&globals.timingsched, "freetdm-master") != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to create master timing schedule context\n"); - goto global_init_fail; - } - if (ftdm_sched_free_run(globals.timingsched) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to run master timing schedule context\n"); - goto global_init_fail; - } - - return FTDM_SUCCESS; - -global_init_fail: - globals.running = 0; - ftdm_mutex_destroy(&globals.mutex); - ftdm_mutex_destroy(&globals.span_mutex); - ftdm_mutex_destroy(&globals.group_mutex); - ftdm_mutex_destroy(&globals.call_id_mutex); - hashtable_destroy(globals.interface_hash); - hashtable_destroy(globals.module_hash); - hashtable_destroy(globals.span_hash); - hashtable_destroy(globals.group_hash); - - return FTDM_FAIL; -} - -FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void) -{ - int modcount = 0; - - if (!globals.running) { - return FTDM_FAIL; - } - - modcount = ftdm_load_modules(); - - ftdm_log(FTDM_LOG_NOTICE, "Modules configured: %d \n", modcount); - - globals.cpu_monitor.enabled = 0; - globals.cpu_monitor.interval = 1000; - globals.cpu_monitor.alarm_action_flags = 0; - globals.cpu_monitor.set_alarm_threshold = 92; - globals.cpu_monitor.clear_alarm_threshold = 82; - - if (load_config() != FTDM_SUCCESS) { - globals.running = 0; - ftdm_log(FTDM_LOG_ERROR, "FreeTDM global configuration failed!\n"); - return FTDM_FAIL; - } - - if (globals.cpu_monitor.enabled) { - ftdm_log(FTDM_LOG_INFO, "CPU Monitor is running interval:%d set-thres:%d clear-thres:%d\n", - globals.cpu_monitor.interval, - globals.cpu_monitor.set_alarm_threshold, - globals.cpu_monitor.clear_alarm_threshold); - - if (ftdm_cpu_monitor_start() != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } - - - return FTDM_SUCCESS; -} - -FT_DECLARE(uint32_t) ftdm_running(void) -{ - return globals.running; -} - -static void destroy_span(ftdm_span_t *span) -{ - if (ftdm_test_flag(span, FTDM_SPAN_CONFIGURED)) { - ftdm_span_destroy(span); - } - hashtable_remove(globals.span_hash, (void *)span->name); - ftdm_safe_free(span->dtmf_hangup); - ftdm_safe_free(span->type); - ftdm_safe_free(span->name); - ftdm_safe_free(span); -} - -static void force_stop_span(ftdm_span_t *span) -{ - /* This is a forced stop */ - ftdm_clear_flag(span, FTDM_SPAN_NON_STOPPABLE); - ftdm_span_stop(span); -} - -static void span_for_each(void (*func)(ftdm_span_t *span)) -{ - ftdm_span_t *sp = NULL, *next = NULL; - for (sp = globals.spans; sp; sp = next) { - next = sp->next; - func(sp); - } -} - -FT_DECLARE(ftdm_status_t) ftdm_global_destroy(void) -{ - ftdm_group_t *grp = NULL, *next_grp = NULL; - - time_end(); - - /* many freetdm event loops rely on this variable to decide when to stop, do this first */ - globals.running = 0; - - /* stop the scheduling thread */ - ftdm_free_sched_stop(); - - /* stop the cpu monitor thread */ - ftdm_cpu_monitor_stop(); - - /* now destroy channels and spans */ - globals.span_index = 0; - - ftdm_span_close_all(); - - /* Stop and destroy alls pans */ - ftdm_mutex_lock(globals.span_mutex); - - span_for_each(force_stop_span); - span_for_each(destroy_span); - globals.spans = NULL; - - ftdm_mutex_unlock(globals.span_mutex); - - /* destroy signaling and io modules */ - ftdm_unload_modules(); - - /* Destroy hunting groups */ - ftdm_mutex_lock(globals.group_mutex); - grp = globals.groups; - while (grp) { - next_grp = grp->next; - ftdm_group_destroy(&grp); - grp = next_grp; - } - ftdm_mutex_unlock(globals.group_mutex); - - /* finally destroy the globals */ - ftdm_mutex_lock(globals.mutex); - - ftdm_sched_destroy(&globals.timingsched); - - hashtable_destroy(globals.interface_hash); - hashtable_destroy(globals.module_hash); - hashtable_destroy(globals.span_hash); - hashtable_destroy(globals.group_hash); - - ftdm_mutex_destroy(&globals.span_mutex); - ftdm_mutex_destroy(&globals.group_mutex); - ftdm_mutex_destroy(&globals.call_id_mutex); - - ftdm_mutex_unlock(globals.mutex); - - ftdm_mutex_destroy(&globals.mutex); - - ftdm_sched_global_destroy(); - - ftdm_global_set_logger(NULL); - memset(&globals, 0, sizeof(globals)); - return FTDM_SUCCESS; -} - - -FT_DECLARE(uint32_t) ftdm_separate_string(char *buf, char delim, char **array, int arraylen) -{ - int argc; - char *ptr; - int quot = 0; - char qc = '\''; - int x; - - if (!buf || !array || !arraylen) { - return 0; - } - - memset(array, 0, arraylen * sizeof(*array)); - - ptr = buf; - - /* we swallow separators that are contiguous */ - while (*ptr == delim) ptr++; - - for (argc = 0; *ptr && (argc < arraylen - 1); argc++) { - array[argc] = ptr; - for (; *ptr; ptr++) { - if (*ptr == qc) { - if (quot) { - quot--; - } else { - quot++; - } - } else if ((*ptr == delim) && !quot) { - *ptr++ = '\0'; - /* we swallow separators that are contiguous */ - while (*ptr == delim) ptr++; - break; - } - } - } - - if (*ptr) { - array[argc++] = ptr; - } - - /* strip quotes */ - for (x = 0; x < argc; x++) { - char *p = array[x]; - while((p = strchr(array[x], qc))) { - memmove(p, p+1, strlen(p)); - p++; - } - } - - return argc; -} - -FT_DECLARE(void) ftdm_bitstream_init(ftdm_bitstream_t *bsp, uint8_t *data, uint32_t datalen, ftdm_endian_t endian, uint8_t ss) -{ - memset(bsp, 0, sizeof(*bsp)); - bsp->data = data; - bsp->datalen = datalen; - bsp->endian = endian; - bsp->ss = ss; - - if (endian < 0) { - bsp->top = bsp->bit_index = 7; - bsp->bot = 0; - } else { - bsp->top = bsp->bit_index = 0; - bsp->bot = 7; - } - -} - -FT_DECLARE(int8_t) ftdm_bitstream_get_bit(ftdm_bitstream_t *bsp) -{ - int8_t bit = -1; - - - if (bsp->byte_index >= bsp->datalen) { - goto done; - } - - if (bsp->ss) { - if (!bsp->ssv) { - bsp->ssv = 1; - return 0; - } else if (bsp->ssv == 2) { - bsp->byte_index++; - bsp->ssv = 0; - return 1; - } - } - - - - - bit = (bsp->data[bsp->byte_index] >> (bsp->bit_index)) & 1; - - if (bsp->bit_index == bsp->bot) { - bsp->bit_index = bsp->top; - if (bsp->ss) { - bsp->ssv = 2; - goto done; - } - - if (++bsp->byte_index > bsp->datalen) { - bit = -1; - goto done; - } - - } else { - bsp->bit_index = bsp->bit_index + bsp->endian; - } - - - done: - return bit; -} - -FT_DECLARE(void) print_hex_bytes(uint8_t *data, ftdm_size_t dlen, char *buf, ftdm_size_t blen) -{ - char *bp = buf; - uint8_t *byte = data; - uint32_t i, j = 0; - - if (blen < (dlen * 3) + 2) { - return; - } - - *bp++ = '['; - j++; - - for(i = 0; i < dlen; i++) { - snprintf(bp, blen-j, "%02x ", *byte++); - bp += 3; - j += 3; - } - - *--bp = ']'; - -} - -FT_DECLARE(void) print_bits(uint8_t *b, int bl, char *buf, int blen, ftdm_endian_t e, uint8_t ss) -{ - ftdm_bitstream_t bs; - int j = 0, c = 0; - int8_t bit; - uint32_t last; - - if (blen < (bl * 10) + 2) { - return; - } - - ftdm_bitstream_init(&bs, b, bl, e, ss); - last = bs.byte_index; - while((bit = ftdm_bitstream_get_bit(&bs)) > -1) { - buf[j++] = bit ? '1' : '0'; - if (bs.byte_index != last) { - buf[j++] = ' '; - last = bs.byte_index; - if (++c == 8) { - buf[j++] = '\n'; - c = 0; - } - } - } - -} - - - -FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_raw_write(ftdm_stream_handle_t *handle, uint8_t *data, ftdm_size_t datalen) -{ - ftdm_size_t need = handle->data_len + datalen; - - if (need >= handle->data_size) { - void *new_data; - need += handle->alloc_chunk; - - if (!(new_data = realloc(handle->data, need))) { - return FTDM_MEMERR; - } - - handle->data = new_data; - handle->data_size = need; - } - - memcpy((uint8_t *) (handle->data) + handle->data_len, data, datalen); - handle->data_len += datalen; - handle->end = (uint8_t *) (handle->data) + handle->data_len; - *(uint8_t *)handle->end = '\0'; - - return FTDM_SUCCESS; -} - -FT_DECLARE(int) ftdm_vasprintf(char **ret, const char *fmt, va_list ap) /* code from switch_apr.c */ -{ -#ifdef HAVE_VASPRINTF - return vasprintf(ret, fmt, ap); -#else - char *buf; - int len; - size_t buflen; - va_list ap2; - char *tmp = NULL; - -#ifdef _MSC_VER -#if _MSC_VER >= 1500 - /* hack for incorrect assumption in msvc header files for code analysis */ - __analysis_assume(tmp); -#endif - ap2 = ap; -#else - va_copy(ap2, ap); -#endif - - len = vsnprintf(tmp, 0, fmt, ap2); - - if (len > 0 && (buf = ftdm_malloc((buflen = (size_t) (len + 1)))) != NULL) { - len = vsnprintf(buf, buflen, fmt, ap); - *ret = buf; - } else { - *ret = NULL; - len = -1; - } - - va_end(ap2); - return len; -#endif -} - -FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_write(ftdm_stream_handle_t *handle, const char *fmt, ...) -{ - va_list ap; - char *buf = handle->data; - char *end = handle->end; - int ret = 0; - char *data = NULL; - - if (handle->data_len >= handle->data_size) { - return FTDM_FAIL; - } - - va_start(ap, fmt); - ret = ftdm_vasprintf(&data, fmt, ap); - va_end(ap); - - if (data) { - ftdm_size_t remaining = handle->data_size - handle->data_len; - ftdm_size_t need = strlen(data) + 1; - - if ((remaining < need) && handle->alloc_len) { - ftdm_size_t new_len; - void *new_data; - - new_len = handle->data_size + need + handle->alloc_chunk; - if ((new_data = ftdm_realloc(handle->data, new_len))) { - handle->data_size = handle->alloc_len = new_len; - handle->data = new_data; - buf = handle->data; - remaining = handle->data_size - handle->data_len; - handle->end = (uint8_t *) (handle->data) + handle->data_len; - end = handle->end; - } else { - ftdm_log(FTDM_LOG_CRIT, "Memory Error!\n"); - ftdm_safe_free(data); - return FTDM_FAIL; - } - } - - if (remaining < need) { - ret = -1; - } else { - ret = 0; - snprintf(end, remaining, "%s", data); - handle->data_len = strlen(buf); - handle->end = (uint8_t *) (handle->data) + handle->data_len; - } - ftdm_safe_free(data); - } - - return ret ? FTDM_FAIL : FTDM_SUCCESS; -} - -FT_DECLARE(char *) ftdm_strdup(const char *str) -{ - ftdm_size_t len = strlen(str) + 1; - void *new = ftdm_malloc(len); - - if (!new) { - return NULL; - } - - return (char *)memcpy(new, str, len); -} - -FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen) -{ - char *new = NULL; - ftdm_size_t len = strlen(str) + 1; - if (len > (inlen+1)) { - len = inlen+1; - } - new = (char *)ftdm_malloc(len); - - if (!new) { - return NULL; - } - - memcpy(new, str, len-1); - new[len-1] = 0; - return new; -} - -static ftdm_status_t ftdm_call_set_call_id(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data) -{ - uint32_t current_call_id; - - ftdm_assert_return(!caller_data->call_id, FTDM_FAIL, "Overwriting non-cleared call-id\n"); - - ftdm_mutex_lock(globals.call_id_mutex); - - current_call_id = globals.last_call_id; - - for (current_call_id = globals.last_call_id + 1; - current_call_id != globals.last_call_id; - current_call_id++ ) { - if (current_call_id > MAX_CALLIDS) { - current_call_id = 1; - } - if (globals.call_ids[current_call_id] == NULL) { - break; - } - } - - ftdm_assert_return(globals.call_ids[current_call_id] == NULL, FTDM_FAIL, "We ran out of call ids\n"); - - globals.last_call_id = current_call_id; - caller_data->call_id = current_call_id; - - globals.call_ids[current_call_id] = caller_data; - caller_data->fchan = fchan; - - ftdm_mutex_unlock(globals.call_id_mutex); - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data) -{ - if (caller_data->call_id) { - ftdm_assert_return((caller_data->call_id <= MAX_CALLIDS), FTDM_FAIL, "Cannot clear call with invalid call-id\n"); - } else { - /* there might not be a call at all */ - return FTDM_SUCCESS; - } - - ftdm_mutex_lock(globals.call_id_mutex); - if (globals.call_ids[caller_data->call_id]) { - ftdm_log(FTDM_LOG_DEBUG, "Cleared call with id %u\n", caller_data->call_id); - globals.call_ids[caller_data->call_id] = NULL; - caller_data->call_id = 0; - } else { - ftdm_log(FTDM_LOG_CRIT, "call-id did not exist %u\n", caller_data->call_id); - } - ftdm_mutex_unlock(globals.call_id_mutex); - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_get_raw_data(ftdm_sigmsg_t *sigmsg, void **data, ftdm_size_t *datalen) -{ - if (!sigmsg || !sigmsg->raw.len) { - return FTDM_FAIL; - } - - *data = sigmsg->raw.data; - *datalen = sigmsg->raw.len; - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_get_raw_data_detached(ftdm_sigmsg_t *sigmsg, void **data, ftdm_size_t *datalen) -{ - if (!sigmsg || !sigmsg->raw.len) { - return FTDM_FAIL; - } - - *data = sigmsg->raw.data; - *datalen = sigmsg->raw.len; - - sigmsg->raw.data = NULL; - sigmsg->raw.len = 0; - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_set_raw_data(ftdm_sigmsg_t *sigmsg, void *data, ftdm_size_t datalen) -{ - ftdm_assert_return(sigmsg, FTDM_FAIL, "Trying to set raw data on a NULL event\n"); - ftdm_assert_return(!sigmsg->raw.len, FTDM_FAIL, "Overwriting existing raw data\n"); - ftdm_assert_return(datalen, FTDM_FAIL, "Data length not set\n"); - - sigmsg->raw.data = data; - sigmsg->raw.len = datalen; - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_usrmsg_get_raw_data(ftdm_usrmsg_t *usrmsg, void **data, ftdm_size_t *datalen) -{ - if (!usrmsg || !usrmsg->raw.len) { - return FTDM_FAIL; - } - - *data = usrmsg->raw.data; - *datalen = usrmsg->raw.len; - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_usrmsg_set_raw_data(ftdm_usrmsg_t *usrmsg, void *data, ftdm_size_t datalen) -{ - ftdm_assert_return(usrmsg, FTDM_FAIL, "Trying to set raw data on a NULL event\n"); - ftdm_assert_return(!usrmsg->raw.len, FTDM_FAIL, "Overwriting existing raw data\n"); - ftdm_assert_return(datalen, FTDM_FAIL, "Data length not set\n"); - - usrmsg->raw.data = data; - usrmsg->raw.len = datalen; - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_save_usrmsg(ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg) -{ - ftdm_assert_return(!ftdmchan->usrmsg, FTDM_FAIL, "Info from previous event was not cleared\n"); - if (usrmsg) { - /* Copy sigmsg from user to internal copy so user can set new variables without race condition */ - ftdmchan->usrmsg = ftdm_calloc(1, sizeof(ftdm_usrmsg_t)); - memcpy(ftdmchan->usrmsg, usrmsg, sizeof(ftdm_usrmsg_t)); - - if (usrmsg->raw.data) { - usrmsg->raw.data = NULL; - usrmsg->raw.len = 0; - } - if (usrmsg->variables) { - usrmsg->variables = NULL; - } - } - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_free(ftdm_sigmsg_t **sigmsg) -{ - if (!*sigmsg) { - return FTDM_SUCCESS; - } - - if ((*sigmsg)->variables) { - hashtable_destroy((*sigmsg)->variables); - (*sigmsg)->variables = NULL; - } - - if ((*sigmsg)->raw.data) { - ftdm_safe_free((*sigmsg)->raw.data); - (*sigmsg)->raw.data = NULL; - (*sigmsg)->raw.len = 0; - } - - ftdm_safe_free(*sigmsg); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_usrmsg_free(ftdm_usrmsg_t **usrmsg) -{ - if (!*usrmsg) { - return FTDM_SUCCESS; - } - - if ((*usrmsg)->variables) { - hashtable_destroy((*usrmsg)->variables); - (*usrmsg)->variables = NULL; - } - - if ((*usrmsg)->raw.data) { - ftdm_safe_free((*usrmsg)->raw.data); - (*usrmsg)->raw.data = NULL; - (*usrmsg)->raw.len = 0; - } - - ftdm_safe_free(*usrmsg); - return FTDM_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: - */ diff --git a/libs/freetdm/src/ftdm_queue.c b/libs/freetdm/src/ftdm_queue.c deleted file mode 100644 index c4c6524064..0000000000 --- a/libs/freetdm/src/ftdm_queue.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2009, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "private/ftdm_core.h" - -static ftdm_status_t ftdm_std_queue_create(ftdm_queue_t **outqueue, ftdm_size_t capacity); -static ftdm_status_t ftdm_std_queue_enqueue(ftdm_queue_t *queue, void *obj); -static void *ftdm_std_queue_dequeue(ftdm_queue_t *queue); -static ftdm_status_t ftdm_std_queue_wait(ftdm_queue_t *queue, int ms); -static ftdm_status_t ftdm_std_queue_get_interrupt(ftdm_queue_t *queue, ftdm_interrupt_t **interrupt); -static ftdm_status_t ftdm_std_queue_destroy(ftdm_queue_t **inqueue); - -struct ftdm_queue { - ftdm_mutex_t *mutex; - ftdm_interrupt_t *interrupt; - ftdm_size_t capacity; - ftdm_size_t size; - unsigned rindex; - unsigned windex; - void **elements; -}; - -FT_DECLARE_DATA ftdm_queue_handler_t g_ftdm_queue_handler = -{ - /*.create = */ ftdm_std_queue_create, - /*.enqueue = */ ftdm_std_queue_enqueue, - /*.dequeue = */ ftdm_std_queue_dequeue, - /*.wait = */ ftdm_std_queue_wait, - /*.get_interrupt = */ ftdm_std_queue_get_interrupt, - /*.destroy = */ ftdm_std_queue_destroy -}; - -FT_DECLARE(ftdm_status_t) ftdm_global_set_queue_handler(ftdm_queue_handler_t *handler) -{ - if (!handler || - !handler->create || - !handler->enqueue || - !handler->dequeue || - !handler->wait || - !handler->get_interrupt || - !handler->destroy) { - return FTDM_FAIL; - } - memcpy(&g_ftdm_queue_handler, handler, sizeof(*handler)); - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_std_queue_create(ftdm_queue_t **outqueue, ftdm_size_t capacity) -{ - ftdm_queue_t *queue = NULL; - ftdm_assert_return(outqueue, FTDM_FAIL, "Queue double pointer is null\n"); - ftdm_assert_return(capacity > 0, FTDM_FAIL, "Queue capacity is not bigger than 0\n"); - - *outqueue = NULL; - queue = ftdm_calloc(1, sizeof(*queue)); - if (!queue) { - return FTDM_FAIL; - } - - queue->elements = ftdm_calloc(1, (sizeof(void*)*capacity)); - if (!queue->elements) { - goto failed; - } - queue->capacity = capacity; - - if (ftdm_mutex_create(&queue->mutex) != FTDM_SUCCESS) { - goto failed; - } - - if (ftdm_interrupt_create(&queue->interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS) != FTDM_SUCCESS) { - goto failed; - } - - *outqueue = queue; - return FTDM_SUCCESS; - -failed: - if (queue) { - if (queue->interrupt) { - ftdm_interrupt_destroy(&queue->interrupt); - } - if (queue->mutex) { - ftdm_mutex_destroy(&queue->mutex); - } - ftdm_safe_free(queue->elements); - ftdm_safe_free(queue); - } - return FTDM_FAIL; -} - -static ftdm_status_t ftdm_std_queue_enqueue(ftdm_queue_t *queue, void *obj) -{ - ftdm_status_t status = FTDM_FAIL; - - ftdm_assert_return(queue != NULL, FTDM_FAIL, "Queue is null!"); - - ftdm_mutex_lock(queue->mutex); - - if (queue->windex == queue->capacity) { - /* try to see if we can wrap around */ - queue->windex = 0; - } - - if (queue->size != 0 && queue->windex == queue->rindex) { - ftdm_log(FTDM_LOG_ERROR, "Failed to enqueue obj %p in queue %p, no more room! windex == rindex == %d!\n", obj, queue, queue->windex); - goto done; - } - - queue->elements[queue->windex++] = obj; - queue->size++; - status = FTDM_SUCCESS; - - /* wake up queue reader */ - ftdm_interrupt_signal(queue->interrupt); - -done: - - ftdm_mutex_unlock(queue->mutex); - - return status; -} - -static void *ftdm_std_queue_dequeue(ftdm_queue_t *queue) -{ - void *obj = NULL; - - ftdm_assert_return(queue != NULL, NULL, "Queue is null!"); - - ftdm_mutex_lock(queue->mutex); - - if (queue->size == 0) { - goto done; - } - - obj = queue->elements[queue->rindex]; - queue->elements[queue->rindex++] = NULL; - queue->size--; - if (queue->rindex == queue->capacity) { - queue->rindex = 0; - } - -done: - - ftdm_mutex_unlock(queue->mutex); - - return obj; -} - -static ftdm_status_t ftdm_std_queue_wait(ftdm_queue_t *queue, int ms) -{ - ftdm_status_t ret; - ftdm_assert_return(queue != NULL, FTDM_FAIL, "Queue is null!"); - - ftdm_mutex_lock(queue->mutex); - - /* if there is elements in the queue, no need to wait */ - if (queue->size != 0) { - ftdm_mutex_unlock(queue->mutex); - return FTDM_SUCCESS; - } - - /* no elements on the queue, wait for someone to write an element */ - ret = ftdm_interrupt_wait(queue->interrupt, ms); - - /* got an element or timeout, bail out */ - ftdm_mutex_unlock(queue->mutex); - - return ret; -} - -static ftdm_status_t ftdm_std_queue_get_interrupt(ftdm_queue_t *queue, ftdm_interrupt_t **interrupt) -{ - ftdm_assert_return(queue != NULL, FTDM_FAIL, "Queue is null!\n"); - ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Queue is null!\n"); - *interrupt = queue->interrupt; - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_std_queue_destroy(ftdm_queue_t **inqueue) -{ - ftdm_queue_t *queue = NULL; - ftdm_assert_return(inqueue != NULL, FTDM_FAIL, "Queue is null!\n"); - ftdm_assert_return(*inqueue != NULL, FTDM_FAIL, "Queue is null!\n"); - - queue = *inqueue; - ftdm_interrupt_destroy(&queue->interrupt); - ftdm_mutex_destroy(&queue->mutex); - ftdm_safe_free(queue->elements); - ftdm_safe_free(queue); - *inqueue = NULL; - return FTDM_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: - */ diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c deleted file mode 100644 index 324073976c..0000000000 --- a/libs/freetdm/src/ftdm_sched.c +++ /dev/null @@ -1,576 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "private/ftdm_core.h" - -#ifdef __WINDOWS__ -struct ftdm_timezone { - int tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; -int gettimeofday(struct timeval *tv, struct ftdm_timezone *tz) -{ - FILETIME ft; - unsigned __int64 tmpres = 0; - static int tzflag; - if (NULL != tv) { - GetSystemTimeAsFileTime(&ft); - tmpres |= ft.dwHighDateTime; - tmpres <<= 32; - tmpres |= ft.dwLowDateTime; - - /*converting file time to unix epoch */ - tmpres /= 10; /*convert into microseconds */ - tmpres -= DELTA_EPOCH_IN_MICROSECS; - tv->tv_sec = (long) (tmpres / 1000000UL); - tv->tv_usec = (long) (tmpres % 1000000UL); - } - if (NULL != tz) { - if (!tzflag) { - _tzset(); - tzflag++; - } - tz->tz_minuteswest = _timezone / 60; - tz->tz_dsttime = _daylight; - } - return 0; -} -#endif /* __WINDOWS__ */ - -typedef struct ftdm_timer ftdm_timer_t; - -static struct { - ftdm_sched_t *freeruns; - ftdm_mutex_t *mutex; - ftdm_bool_t running; -} sched_globals; - -struct ftdm_sched { - char name[80]; - ftdm_timer_id_t currid; - ftdm_mutex_t *mutex; - ftdm_timer_t *timers; - int freerun; - ftdm_sched_t *next; - ftdm_sched_t *prev; -}; - -struct ftdm_timer { - char name[80]; - ftdm_timer_id_t id; - struct timeval time; - void *usrdata; - ftdm_sched_callback_t callback; - ftdm_timer_t *next; - ftdm_timer_t *prev; -}; - -/* FIXME: use ftdm_interrupt_t to wait for new schedules to monitor */ -#define SCHED_MAX_SLEEP 100 -static void *run_main_schedule(ftdm_thread_t *thread, void *data) -{ - int32_t timeto; - int32_t sleepms; - ftdm_status_t status; - ftdm_sched_t *current = NULL; - - ftdm_unused_arg(data); - ftdm_unused_arg(thread); - - while (ftdm_running()) { - - sleepms = SCHED_MAX_SLEEP; - - ftdm_mutex_lock(sched_globals.mutex); - - if (!sched_globals.freeruns) { - - /* there are no free runs, wait a bit and check again (FIXME: use ftdm_interrupt_t for this) */ - ftdm_mutex_unlock(sched_globals.mutex); - - if (ftdm_running()) { - ftdm_sleep(sleepms); - } - } - - for (current = sched_globals.freeruns; current; current = current->next) { - if (!ftdm_running()) { - break; - } - - /* first run the schedule */ - ftdm_sched_run(current); - - /* now find out how much time to sleep until running them again */ - status = ftdm_sched_get_time_to_next_timer(current, &timeto); - if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_WARNING, "Failed to get time to next timer for schedule %s, skipping\n", current->name); - continue; - } - - /* if timeto == -1 we don't want to sleep forever, so keep the last sleepms */ - if (timeto != -1 && sleepms > timeto) { - sleepms = timeto; - } - } - - ftdm_mutex_unlock(sched_globals.mutex); - - if (ftdm_running()) { - ftdm_sleep(sleepms); - } - } - ftdm_log(FTDM_LOG_NOTICE, "Main scheduling thread going out ...\n"); - sched_globals.running = 0; - return NULL; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_global_init() -{ - ftdm_log(FTDM_LOG_DEBUG, "Initializing scheduling API\n"); - memset(&sched_globals, 0, sizeof(sched_globals)); - if (ftdm_mutex_create(&sched_globals.mutex) == FTDM_SUCCESS) { - return FTDM_SUCCESS; - } - return FTDM_FAIL; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_global_destroy() -{ - ftdm_mutex_destroy(&sched_globals.mutex); - memset(&sched_globals, 0, sizeof(sched_globals)); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_free_run(ftdm_sched_t *sched) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_assert_return(sched != NULL, FTDM_EINVAL, "invalid pointer\n"); - - ftdm_mutex_lock(sched->mutex); - - ftdm_mutex_lock(sched_globals.mutex); - - if (sched->freerun) { - ftdm_log(FTDM_LOG_ERROR, "Schedule %s is already running in free run\n", sched->name); - goto done; - } - sched->freerun = 1; - - if (sched_globals.running == FTDM_FALSE) { - ftdm_log(FTDM_LOG_NOTICE, "Launching main schedule thread\n"); - status = ftdm_thread_create_detached(run_main_schedule, NULL); - if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to launch main schedule thread\n"); - goto done; - } - sched_globals.running = FTDM_TRUE; - } - - ftdm_log(FTDM_LOG_DEBUG, "Running schedule %s in the main schedule thread\n", sched->name); - status = FTDM_SUCCESS; - - /* Add the schedule to the global list of free runs */ - if (!sched_globals.freeruns) { - sched_globals.freeruns = sched; - } else { - sched->next = sched_globals.freeruns; - sched_globals.freeruns->prev = sched; - sched_globals.freeruns = sched; - } - -done: - ftdm_mutex_unlock(sched_globals.mutex); - - ftdm_mutex_unlock(sched->mutex); - return status; -} - -FT_DECLARE(ftdm_bool_t) ftdm_free_sched_running(void) -{ - return sched_globals.running; -} - -FT_DECLARE(ftdm_bool_t) ftdm_free_sched_stop(void) -{ - /* currently we really dont stop the thread here, we rely on freetdm being shutdown and ftdm_running() to be false - * so the scheduling thread dies and we just wait for it here */ - uint32_t sanity = 100; - while (ftdm_free_sched_running() && --sanity) { - ftdm_log(FTDM_LOG_DEBUG, "Waiting for main schedule thread to finish\n"); - ftdm_sleep(100); - } - - if (!sanity) { - ftdm_log(FTDM_LOG_CRIT, "schedule thread did not stop running, we may crash on shutdown\n"); - return FTDM_FALSE; - } - - return FTDM_TRUE; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_create(ftdm_sched_t **sched, const char *name) -{ - ftdm_sched_t *newsched = NULL; - - ftdm_assert_return(sched != NULL, FTDM_EINVAL, "invalid pointer\n"); - ftdm_assert_return(name != NULL, FTDM_EINVAL, "invalid sched name\n"); - - *sched = NULL; - - newsched = ftdm_calloc(1, sizeof(*newsched)); - if (!newsched) { - return FTDM_MEMERR; - } - - if (ftdm_mutex_create(&newsched->mutex) != FTDM_SUCCESS) { - goto failed; - } - - ftdm_set_string(newsched->name, name); - newsched->currid = 1; - - *sched = newsched; - ftdm_log(FTDM_LOG_DEBUG, "Created schedule %s\n", name); - return FTDM_SUCCESS; - -failed: - ftdm_log(FTDM_LOG_CRIT, "Failed to create schedule\n"); - - if (newsched) { - if (newsched->mutex) { - ftdm_mutex_destroy(&newsched->mutex); - } - ftdm_safe_free(newsched); - } - return FTDM_FAIL; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_run(ftdm_sched_t *sched) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_timer_t *runtimer; - ftdm_timer_t *timer; - ftdm_sched_callback_t callback; - int ms = 0; - int rc = -1; - void *data; - struct timeval now; - - ftdm_assert_return(sched != NULL, FTDM_EINVAL, "sched is null!\n"); - -tryagain: - - ftdm_mutex_lock(sched->mutex); - - rc = gettimeofday(&now, NULL); - if (rc == -1) { - ftdm_log(FTDM_LOG_ERROR, "Failed to retrieve time of day\n"); - goto done; - } - - timer = sched->timers; - while (timer) { - runtimer = timer; - timer = runtimer->next; - - ms = ((runtimer->time.tv_sec - now.tv_sec) * 1000) + - ((runtimer->time.tv_usec - now.tv_usec) / 1000); - - if (ms <= 0) { - - if (runtimer == sched->timers) { - sched->timers = runtimer->next; - if (sched->timers) { - sched->timers->prev = NULL; - } - } - - callback = runtimer->callback; - data = runtimer->usrdata; - if (runtimer->next) { - runtimer->next->prev = runtimer->prev; - } - if (runtimer->prev) { - runtimer->prev->next = runtimer->next; - } - - runtimer->id = 0; - ftdm_safe_free(runtimer); - - /* avoid deadlocks by releasing the sched lock before triggering callbacks */ - ftdm_mutex_unlock(sched->mutex); - - callback(data); - /* after calling a callback we must start the scanning again since the - * callback or some other thread may have added or cancelled timers to - * the linked list */ - goto tryagain; - } - } - - status = FTDM_SUCCESS; -done: - ftdm_mutex_unlock(sched->mutex); - ftdm_unused_arg(sched); - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name, - int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_id_t *timerid) -{ - ftdm_status_t status = FTDM_FAIL; - struct timeval now; - int rc = 0; - ftdm_timer_t *newtimer; - - ftdm_assert_return(sched != NULL, FTDM_EINVAL, "sched is null!\n"); - ftdm_assert_return(name != NULL, FTDM_EINVAL, "timer name is null!\n"); - ftdm_assert_return(callback != NULL, FTDM_EINVAL, "sched callback is null!\n"); - ftdm_assert_return(ms > 0, FTDM_EINVAL, "milliseconds must be bigger than 0!\n"); - - if (timerid) { - *timerid = 0; - } - - rc = gettimeofday(&now, NULL); - if (rc == -1) { - ftdm_log(FTDM_LOG_ERROR, "Failed to retrieve time of day\n"); - return FTDM_FAIL; - } - - ftdm_mutex_lock(sched->mutex); - - newtimer = ftdm_calloc(1, sizeof(*newtimer)); - if (!newtimer) { - goto done; - } - newtimer->id = sched->currid; - sched->currid++; - if (!sched->currid) { - ftdm_log(FTDM_LOG_NOTICE, "Timer id wrap around for sched %s\n", sched->name); - /* we do not want currid to be zero since is an invalid id - * TODO: check that currid does not exists already in the context, it'd be insane - * though, having a timer to live all that time */ - sched->currid++; - } - - ftdm_set_string(newtimer->name, name); - newtimer->callback = callback; - newtimer->usrdata = data; - - newtimer->time.tv_sec = now.tv_sec + (ms / 1000); - newtimer->time.tv_usec = now.tv_usec + (ms % 1000) * 1000; - if (newtimer->time.tv_usec >= FTDM_MICROSECONDS_PER_SECOND) { - newtimer->time.tv_sec += 1; - newtimer->time.tv_usec -= FTDM_MICROSECONDS_PER_SECOND; - } - - if (!sched->timers) { - sched->timers = newtimer; - } else { - newtimer->next = sched->timers; - sched->timers->prev = newtimer; - sched->timers = newtimer; - } - - if (timerid) { - *timerid = newtimer->id; - } - - status = FTDM_SUCCESS; -done: - ftdm_mutex_unlock(sched->mutex); - ftdm_unused_arg(sched); - ftdm_unused_arg(name); - ftdm_unused_arg(ms); - ftdm_unused_arg(callback); - ftdm_unused_arg(data); - ftdm_unused_arg(timerid); - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *sched, int32_t *timeto) -{ - ftdm_status_t status = FTDM_FAIL; - int res = -1; - int ms = 0; - struct timeval currtime; - ftdm_timer_t *current = NULL; - ftdm_timer_t *winner = NULL; - - /* forever by default */ - *timeto = -1; - - ftdm_mutex_lock(sched->mutex); - - res = gettimeofday(&currtime, NULL); - if (-1 == res) { - ftdm_log(FTDM_LOG_ERROR, "Failed to get next event time\n"); - goto done; - } - status = FTDM_SUCCESS; - current = sched->timers; - while (current) { - /* if no winner, set this as winner */ - if (!winner) { - winner = current; - } - current = current->next; - /* if no more timers, return the winner */ - if (!current) { - ms = (((winner->time.tv_sec - currtime.tv_sec) * 1000) + - ((winner->time.tv_usec - currtime.tv_usec) / 1000)); - - /* if the timer is expired already, return 0 to attend immediately */ - if (ms < 0) { - *timeto = 0; - break; - } - *timeto = ms; - break; - } - - /* if the winner timer is after the current timer, then we have a new winner */ - if (winner->time.tv_sec > current->time.tv_sec - || (winner->time.tv_sec == current->time.tv_sec && - winner->time.tv_usec > current->time.tv_usec)) { - winner = current; - } - } - -done: - ftdm_mutex_unlock(sched->mutex); - ftdm_unused_arg(timeto); - ftdm_unused_arg(sched); - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_cancel_timer(ftdm_sched_t *sched, ftdm_timer_id_t timerid) -{ - ftdm_status_t status = FTDM_FAIL; - ftdm_timer_t *timer; - - ftdm_assert_return(sched != NULL, FTDM_EINVAL, "sched is null!\n"); - - if (!timerid) { - return FTDM_SUCCESS; - } - - ftdm_mutex_lock(sched->mutex); - - /* look for the timer and destroy it */ - for (timer = sched->timers; timer; timer = timer->next) { - if (timer->id == timerid) { - if (timer == sched->timers) { - /* it's the head timer, put a new head */ - sched->timers = timer->next; - } - if (timer->prev) { - timer->prev->next = timer->next; - } - if (timer->next) { - timer->next->prev = timer->prev; - } - ftdm_safe_free(timer); - status = FTDM_SUCCESS; - break; - } - } - - ftdm_mutex_unlock(sched->mutex); - - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_sched_destroy(ftdm_sched_t **insched) -{ - ftdm_sched_t *sched = NULL; - ftdm_timer_t *timer; - ftdm_timer_t *deltimer; - ftdm_assert_return(insched != NULL, FTDM_EINVAL, "sched is null!\n"); - ftdm_assert_return(*insched != NULL, FTDM_EINVAL, "sched is null!\n"); - - sched = *insched; - - /* since destroying a sched may affect the global list, we gotta check */ - ftdm_mutex_lock(sched_globals.mutex); - - /* if we're head, replace head with our next (whatever our next is, even null will do) */ - if (sched == sched_globals.freeruns) { - sched_globals.freeruns = sched->next; - } - /* if we have a previous member (then we were not head) set our previous next to our next */ - if (sched->prev) { - sched->prev->next = sched->next; - } - /* if we have a next then set their prev to our prev (if we were head prev will be null and sched->next is already the new head) */ - if (sched->next) { - sched->next->prev = sched->prev; - } - - ftdm_mutex_unlock(sched_globals.mutex); - - /* now grab the sched mutex */ - ftdm_mutex_lock(sched->mutex); - - timer = sched->timers; - while (timer) { - deltimer = timer; - timer = timer->next; - ftdm_safe_free(deltimer); - } - - ftdm_log(FTDM_LOG_DEBUG, "Destroying schedule %s\n", sched->name); - - ftdm_mutex_unlock(sched->mutex); - - ftdm_mutex_destroy(&sched->mutex); - - ftdm_safe_free(sched); - - *insched = NULL; - return FTDM_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: - */ diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c deleted file mode 100644 index f6bc0ef4c4..0000000000 --- a/libs/freetdm/src/ftdm_state.c +++ /dev/null @@ -1,575 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "private/ftdm_core.h" - -FTDM_ENUM_NAMES(CHANNEL_STATE_NAMES, CHANNEL_STATE_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t, CHANNEL_STATE_NAMES, FTDM_CHANNEL_STATE_INVALID) - -FTDM_ENUM_NAMES(CHANNEL_STATE_STATUS_NAMES, CHANNEL_STATE_STATUS_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_state_status, ftdm_state_status2str, ftdm_state_status_t, CHANNEL_STATE_STATUS_NAMES, FTDM_STATE_STATUS_INVALID) - -static ftdm_status_t ftdm_core_set_state(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int waitrq); - -FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const char *func, int line, ftdm_channel_t *fchan) -{ - uint8_t hindex = 0; - ftdm_time_t diff = 0; - ftdm_channel_state_t state = fchan->state; - -#if 0 - /* I could not perform this sanity check without more disruptive changes. Ideally we should check here if the signaling module completing the state - executed a state processor (called ftdm_channel_advance_states() which call fchan->span->state_processor(fchan)) for the state. That is just a - sanity check, as in the past we had at least one bug where the signaling module set the state and then accidentally changed the state to a new one - without calling ftdm_channel_advance_states(), meaning the state processor for the first state was not executed and that lead to unexpected behavior. - - If we want to be able to perform this kind of sanity check it would be nice to add a new state status (FTDM_STATE_STATUS_PROCESSING), the function - ftdm_channel_advance_states() would set the state_status to PROCESSING and then the check below for STATUS_NEW would be valid. Currently is not - valid because the signaling module may be completing the state at the end of the state_processor callback and therefore the state will still be - in STATUS_NEW, and is perfectly valid ... */ - - if (fchan->state_status == FTDM_STATE_STATUS_NEW) { - ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_CRIT, - "Asking to complete state change from %s to %s in %llums, but the state is still unprocessed (this might be a bug!)\n", - ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(state), diff); - } -#endif - - if (fchan->state_status == FTDM_STATE_STATUS_COMPLETED) { - ftdm_assert_return(!ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE), FTDM_FAIL, "State change flag set but state is already completed\n"); - return FTDM_SUCCESS; - } - - ftdm_usrmsg_free(&fchan->usrmsg); - - ftdm_clear_flag(fchan, FTDM_CHANNEL_STATE_CHANGE); - - if (state == FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); - } else if (state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); - ftdm_test_and_set_media(fchan); - } else if (state == FTDM_CHANNEL_STATE_UP) { - ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); - ftdm_set_flag(fchan, FTDM_CHANNEL_ANSWERED); - ftdm_test_and_set_media(fchan); - } else if (state == FTDM_CHANNEL_STATE_DIALING) { - ftdm_sigmsg_t msg; - memset(&msg, 0, sizeof(msg)); - msg.channel = fchan; - msg.event_id = FTDM_SIGEVENT_DIALING; - ftdm_span_send_signal(fchan->span, &msg); - } else if (state == FTDM_CHANNEL_STATE_HANGUP) { - ftdm_set_echocancel_call_end(fchan); - } - - /* MAINTENANCE WARNING - * we're assuming an indication performed - * via state change will involve a single state change */ - ftdm_ack_indication(fchan, fchan->indication, FTDM_SUCCESS); - - hindex = (fchan->hindex == 0) ? (ftdm_array_len(fchan->history) - 1) : (fchan->hindex - 1); - - ftdm_assert(!fchan->history[hindex].end_time, "End time should be zero!\n"); - - fchan->history[hindex].end_time = ftdm_current_time_in_ms(); - fchan->last_state_change_time = ftdm_current_time_in_ms(); - - fchan->state_status = FTDM_STATE_STATUS_COMPLETED; - - diff = fchan->history[hindex].end_time - fchan->history[hindex].time; - - ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Completed state change from %s to %s in %"FTDM_TIME_FMT" ms\n", - ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(state), diff); - - - if (ftdm_test_flag(fchan, FTDM_CHANNEL_BLOCKING)) { - ftdm_clear_flag(fchan, FTDM_CHANNEL_BLOCKING); - ftdm_interrupt_signal(fchan->state_completed_interrupt); - } - - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) _ftdm_set_state(const char *file, const char *func, int line, - ftdm_channel_t *fchan, ftdm_channel_state_t state) -{ - if (fchan->state_status != FTDM_STATE_STATUS_COMPLETED) { - /* the current state is not completed, setting a new state from a signaling module - when the current state is not completed is equivalent to implicitly acknowledging - the current state */ - _ftdm_channel_complete_state(file, func, line, fchan); - } - return ftdm_core_set_state(file, func, line, fchan, state, 0); -} - -static int ftdm_parse_state_map(ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, ftdm_state_map_t *state_map) -{ - int x = 0, ok = 0; - ftdm_state_direction_t direction = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? ZSD_OUTBOUND : ZSD_INBOUND; - - for(x = 0; x < FTDM_MAP_NODE_SIZE; x++) { - int i = 0, proceed = 0; - if (!state_map->nodes[x].type) { - break; - } - - if (state_map->nodes[x].direction != direction) { - continue; - } - - if (state_map->nodes[x].check_states[0] == FTDM_CHANNEL_STATE_ANY) { - proceed = 1; - } else { - for(i = 0; i < FTDM_MAP_MAX; i++) { - if (state_map->nodes[x].check_states[i] == ftdmchan->state) { - proceed = 1; - break; - } - } - } - - if (!proceed) { - continue; - } - - for(i = 0; i < FTDM_MAP_MAX; i++) { - ok = (state_map->nodes[x].type == ZSM_ACCEPTABLE); - if (state_map->nodes[x].states[i] == FTDM_CHANNEL_STATE_END) { - break; - } - if (state_map->nodes[x].states[i] == state) { - ok = !ok; - goto end; - } - } - } - end: - - return ok; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_cancel_state(const char *file, const char *func, int line, ftdm_channel_t *fchan) -{ - ftdm_time_t diff; - ftdm_channel_state_t state; - ftdm_channel_state_t last_state; - uint8_t hindex = 0; - - if (!ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Cannot cancel state change from %s to %s, it was already processed\n", - ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(fchan->state)); - return FTDM_FAIL; - } - - if (fchan->state_status != FTDM_STATE_STATUS_NEW) { - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Failed to cancel state change from %s to %s, state is not new anymore\n", - ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(fchan->state)); - return FTDM_FAIL; - } - - /* compute the last history index */ - hindex = (fchan->hindex == 0) ? (ftdm_array_len(fchan->history) - 1) : (fchan->hindex - 1); - diff = fchan->history[hindex].end_time - fchan->history[hindex].time; - - /* go back in time and revert the state to the previous state */ - state = fchan->state; - last_state = fchan->last_state; - - fchan->state = fchan->last_state; - fchan->state_status = FTDM_STATE_STATUS_COMPLETED; - fchan->last_state = fchan->history[hindex].last_state; - fchan->hindex = hindex; - - /* clear the state change flag */ - ftdm_clear_flag(fchan, FTDM_CHANNEL_STATE_CHANGE); - - /* ack any pending indications as cancelled */ - ftdm_ack_indication(fchan, fchan->indication, FTDM_ECANCELED); - - /* wake up anyone sleeping waiting for the state change to complete, it won't ever be completed */ - if (ftdm_test_flag(fchan, FTDM_CHANNEL_BLOCKING)) { - ftdm_clear_flag(fchan, FTDM_CHANNEL_BLOCKING); - ftdm_interrupt_signal(fchan->state_completed_interrupt); - } - - /* NOTE - * we could potentially also take out the channel from the pendingchans queue, but I believe is easier just leave it, - * the only side effect will be a call to ftdm_channel_advance_states() for a channel that has nothing to advance */ - ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Cancelled state change from %s to %s in %"FTDM_TIME_FMT" ms\n", - ftdm_channel_state2str(last_state), ftdm_channel_state2str(state), diff); - - return FTDM_SUCCESS; -} - - -FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int waitrq, ftdm_usrmsg_t *usrmsg) -{ - ftdm_channel_save_usrmsg(ftdmchan, usrmsg); - - if (ftdm_core_set_state(file, func, line, ftdmchan, state, waitrq) != FTDM_SUCCESS) { - ftdm_usrmsg_free(&ftdmchan->usrmsg); - } - return FTDM_SUCCESS; -} - -/* this function MUST be called with the channel lock held. If waitrq == 1, the channel will be unlocked/locked (never call it with waitrq == 1 with an lock recursivity > 1) */ -#define DEFAULT_WAIT_TIME 1000 -static ftdm_status_t ftdm_core_set_state(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int waitrq) -{ - ftdm_status_t status; - int ok = 1; - int waitms = DEFAULT_WAIT_TIME; - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_READY)) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the channel is not ready\n", - ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - return FTDM_FAIL; - } - - if (ftdmchan->state_status != FTDM_STATE_STATUS_COMPLETED) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, - "Ignored state change request from %s to %s, the previous state change has not been processed yet (status = %s)\n", - ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state), - ftdm_state_status2str(ftdmchan->state_status)); - return FTDM_FAIL; - } - - if (ftdmchan->state == state) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Why bother changing state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - return FTDM_FAIL; - } - - if (!ftdmchan->state_completed_interrupt) { - status = ftdm_interrupt_create(&ftdmchan->state_completed_interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_CRIT, - "Failed to create state change interrupt when moving from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - return status; - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE)) { - goto perform_state_change; - } - - if (ftdmchan->span->state_map) { - ok = ftdm_parse_state_map(ftdmchan, state, ftdmchan->span->state_map); - goto end; - } - - /* basic core state validation (by-passed if the signaling module provides a state_map) */ - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_TERMINATING: - { - ok = 0; - switch(state) { - case FTDM_CHANNEL_STATE_DOWN: - case FTDM_CHANNEL_STATE_BUSY: - case FTDM_CHANNEL_STATE_RESTART: - ok = 1; - break; - default: - break; - } - } - break; - case FTDM_CHANNEL_STATE_UP: - { - ok = 1; - switch(state) { - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_RING: - ok = 0; - break; - default: - break; - } - } - break; - case FTDM_CHANNEL_STATE_DOWN: - { - ok = 0; - - switch(state) { - case FTDM_CHANNEL_STATE_DIALTONE: - case FTDM_CHANNEL_STATE_COLLECT: - case FTDM_CHANNEL_STATE_DIALING: - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_IDLE: - case FTDM_CHANNEL_STATE_GET_CALLERID: - case FTDM_CHANNEL_STATE_GENRING: - ok = 1; - break; - default: - break; - } - } - break; - case FTDM_CHANNEL_STATE_BUSY: - { - switch(state) { - case FTDM_CHANNEL_STATE_UP: - ok = 0; - break; - default: - break; - } - } - break; - case FTDM_CHANNEL_STATE_RING: - { - switch(state) { - case FTDM_CHANNEL_STATE_UP: - ok = 1; - break; - default: - break; - } - } - break; - default: - break; - } - -end: - - if (!ok) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "VETO state change from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - goto done; - } - -perform_state_change: - - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - ftdmchan->last_state = ftdmchan->state; - ftdmchan->state = state; - ftdmchan->state_status = FTDM_STATE_STATUS_NEW; - ftdmchan->history[ftdmchan->hindex].file = file; - ftdmchan->history[ftdmchan->hindex].func = func; - ftdmchan->history[ftdmchan->hindex].line = line; - ftdmchan->history[ftdmchan->hindex].state = ftdmchan->state; - ftdmchan->history[ftdmchan->hindex].last_state = ftdmchan->last_state; - ftdmchan->history[ftdmchan->hindex].time = ftdm_current_time_in_ms(); - ftdmchan->history[ftdmchan->hindex].end_time = 0; - ftdmchan->hindex++; - if (ftdmchan->hindex == ftdm_array_len(ftdmchan->history)) { - ftdmchan->hindex = 0; - } - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - - if (ftdmchan->span->pendingchans) { - ftdm_queue_enqueue(ftdmchan->span->pendingchans, ftdmchan); - } else { - /* there is a potential deadlock here, if a signaling module is processing - * state changes while the ftdm_span_stop() function is called, the signaling - * thread will block until it can acquire the span lock, but the thread calling - * ftdm_span_stop() which holds the span lock is waiting on the signaling thread - * to finish ... The only reason to acquire the span lock is this flag, new - * signaling modules should use the pendingchans queue instead of this flag, - * as of today a few modules need still to be updated before we can get rid of - * this flag (ie, ftmod_libpri, ftmod_isdn, ftmod_analog) */ - ftdm_set_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { - /* the channel should not block waiting for state processing */ - goto done; - } - - if (!waitrq) { - /* no waiting was requested */ - goto done; - } - - /* let's wait for the state change to be completed by the signaling stack */ - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_BLOCKING); - - ftdm_mutex_unlock(ftdmchan->mutex); - - status = ftdm_interrupt_wait(ftdmchan->state_completed_interrupt, waitms); - - ftdm_mutex_lock(ftdmchan->mutex); - - if (status != FTDM_SUCCESS) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_BLOCKING); - ftdm_log_chan_ex(ftdmchan, file, func, line, - FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not completed after aprox %dms\n", - ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME); - ok = 0; - goto done; - } -done: - return ok ? FTDM_SUCCESS : FTDM_FAIL; -} - -FT_DECLARE(int) ftdm_channel_get_state(const ftdm_channel_t *ftdmchan) -{ - int state; - ftdm_channel_lock(ftdmchan); - state = ftdmchan->state; - ftdm_channel_unlock(ftdmchan); - return state; -} - -FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *ftdmchan) -{ - const char *state; - ftdm_channel_lock(ftdmchan); - state = ftdm_channel_state2str(ftdmchan->state); - ftdm_channel_unlock(ftdmchan); - return state; -} - -FT_DECLARE(int) ftdm_channel_get_last_state(const ftdm_channel_t *ftdmchan) -{ - int last_state; - ftdm_channel_lock(ftdmchan); - last_state = ftdmchan->last_state; - ftdm_channel_unlock(ftdmchan); - return last_state; -} - -FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *ftdmchan) -{ - const char *state; - ftdm_channel_lock(ftdmchan); - state = ftdm_channel_state2str(ftdmchan->last_state); - ftdm_channel_unlock(ftdmchan); - return state; -} - -static void write_history_entry(const ftdm_channel_t *fchan, ftdm_stream_handle_t *stream, int i, ftdm_time_t *prevtime) -{ - char func[255]; - char line[255]; - char states[255]; - const char *filename = NULL; - snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); - snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); - filename = strrchr(fchan->history[i].file, *FTDM_PATH_SEPARATOR); - if (!filename) { - filename = fchan->history[i].file; - } else { - filename++; - } - if (!(*prevtime)) { - *prevtime = fchan->history[i].time; - } - snprintf(line, sizeof(func), "[%s:%d]", filename, fchan->history[i].line); - stream->write_function(stream, "%-30.30s %-30.30s %-30.30s %lums\n", states, func, line, (fchan->history[i].time - *prevtime)); - *prevtime = fchan->history[i].time; -} - -FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) -{ - uint8_t i = 0; - ftdm_time_t currtime = 0; - ftdm_time_t prevtime = 0; - - ftdm_stream_handle_t stream = { 0 }; - FTDM_STANDARD_STREAM(stream); - if (!fchan->history[0].file) { - stream.write_function(&stream, "-- No state history --\n"); - return stream.data; - } - - stream.write_function(&stream, "%-30.30s %-30.30s %-30.30s %s", - "-- States --", "-- Function --", "-- Location --", "-- Time Offset --\n"); - - for (i = fchan->hindex; i < ftdm_array_len(fchan->history); i++) { - if (!fchan->history[i].file) { - break; - } - write_history_entry(fchan, &stream, i, &prevtime); - } - - for (i = 0; i < fchan->hindex; i++) { - write_history_entry(fchan, &stream, i, &prevtime); - } - - currtime = ftdm_current_time_in_ms(); - - stream.write_function(&stream, "\nTime since last state change: %lums\n", (currtime - prevtime)); - - return stream.data; -} - -FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan) -{ - ftdm_channel_state_t state; - - ftdm_assert_return(fchan->span->state_processor, FTDM_FAIL, "Cannot process states without a state processor!\n"); - - while (fchan->state_status == FTDM_STATE_STATUS_NEW) { - state = fchan->state; - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Executing state processor for %s\n", ftdm_channel_state2str(fchan->state)); - fchan->span->state_processor(fchan); - if (state == fchan->state && fchan->state_status == FTDM_STATE_STATUS_NEW) { - /* if the state did not change and is still NEW, the state status must go to PROCESSED - * otherwise we don't touch it since is a new state and the old state was - * already completed implicitly by the state_processor() function via some internal - * call to ftdm_set_state() */ - fchan->state_status = FTDM_STATE_STATUS_PROCESSED; - } - } - - return FTDM_SUCCESS; -} - -FT_DECLARE(int) ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state_t state) -{ - uint32_t j; - for(j = 1; j <= span->chan_count; j++) { - if (span->channels[j]->state != state || ftdm_test_flag(span->channels[j], FTDM_CHANNEL_STATE_CHANGE)) { - return 0; - } - } - return 1; -} - -/* 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/freetdm/src/ftdm_threadmutex.c b/libs/freetdm/src/ftdm_threadmutex.c deleted file mode 100644 index 6dc2c64f8f..0000000000 --- a/libs/freetdm/src/ftdm_threadmutex.c +++ /dev/null @@ -1,635 +0,0 @@ -/* - * Cross Platform Thread/Mutex abstraction - * Copyright(C) 2007 Michael Jerris - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so. - * - * This work 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. - * - * Contributors: - * - * Moises Silva - * - */ - -#ifdef WIN32 -# if (_WIN32_WINNT < 0x0400) -# error "Need to target at least Windows 95/WINNT 4.0 because TryEnterCriticalSection is needed" -# endif -# include -#endif -/*#define FTDM_DEBUG_MUTEX 0*/ - -#include "private/ftdm_core.h" -#include "ftdm_threadmutex.h" - -#ifdef WIN32 -#include - -#define FTDM_THREAD_CALLING_CONVENTION __stdcall - -struct ftdm_mutex { - CRITICAL_SECTION mutex; -}; - -#else -#include -#include - -#define FTDM_THREAD_CALLING_CONVENTION - -#ifdef FTDM_DEBUG_MUTEX -#define FTDM_MUTEX_MAX_REENTRANCY 30 -typedef struct ftdm_lock_entry { - const char *file; - const char *func; - uint32_t line; -} ftdm_lock_entry_t; - -typedef struct ftdm_lock_history { - ftdm_lock_entry_t locked; - ftdm_lock_entry_t unlocked; -} ftdm_lock_history_t; -#endif - -struct ftdm_mutex { - pthread_mutex_t mutex; -#ifdef FTDM_DEBUG_MUTEX - ftdm_lock_history_t lock_history[FTDM_MUTEX_MAX_REENTRANCY]; - uint8_t reentrancy; -#endif -}; - -#endif - -struct ftdm_interrupt { - ftdm_socket_t device; - ftdm_wait_flag_t device_input_flags; - ftdm_wait_flag_t device_output_flags; -#ifdef WIN32 - /* for generic interruption */ - HANDLE event; -#else - /* In theory we could be using thread conditions for generic interruption, - * however, Linux does not have a primitive like Windows WaitForMultipleObjects - * to wait for both thread condition and file descriptors, therefore we decided - * to use a dummy pipe for generic interruption/condition logic - * */ - int readfd; - int writefd; -#endif -}; - -struct ftdm_thread { -#ifdef WIN32 - void *handle; -#else - pthread_t handle; -#endif - void *private_data; - ftdm_thread_function_t function; - ftdm_size_t stack_size; -#ifndef WIN32 - pthread_attr_t attribute; -#endif -}; - -ftdm_size_t thread_default_stacksize = 0; - -FT_DECLARE(void) ftdm_thread_override_default_stacksize(ftdm_size_t size) -{ - thread_default_stacksize = size; -} - -static void * FTDM_THREAD_CALLING_CONVENTION thread_launch(void *args) -{ - void *exit_val; - ftdm_thread_t *thread = (ftdm_thread_t *)args; - exit_val = thread->function(thread, thread->private_data); -#ifndef WIN32 - pthread_attr_destroy(&thread->attribute); -#endif - ftdm_safe_free(thread); - - return exit_val; -} - -FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached(ftdm_thread_function_t func, void *data) -{ - return ftdm_thread_create_detached_ex(func, data, thread_default_stacksize); -} - -FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached_ex(ftdm_thread_function_t func, void *data, ftdm_size_t stack_size) -{ - ftdm_thread_t *thread = NULL; - ftdm_status_t status = FTDM_FAIL; - - if (!func || !(thread = (ftdm_thread_t *)ftdm_calloc(1, sizeof(ftdm_thread_t)))) { - goto done; - } - - thread->private_data = data; - thread->function = func; - thread->stack_size = stack_size; - -#if defined(WIN32) - thread->handle = (void *)_beginthreadex(NULL, (unsigned)thread->stack_size, (unsigned int (__stdcall *)(void *))thread_launch, thread, 0, NULL); - if (!thread->handle) { - goto fail; - } - CloseHandle(thread->handle); - - status = FTDM_SUCCESS; - goto done; -#else - - if (pthread_attr_init(&thread->attribute) != 0) goto fail; - - if (pthread_attr_setdetachstate(&thread->attribute, PTHREAD_CREATE_DETACHED) != 0) goto failpthread; - - if (thread->stack_size && pthread_attr_setstacksize(&thread->attribute, thread->stack_size) != 0) goto failpthread; - - if (pthread_create(&thread->handle, &thread->attribute, thread_launch, thread) != 0) goto failpthread; - - status = FTDM_SUCCESS; - goto done; - failpthread: - pthread_attr_destroy(&thread->attribute); -#endif - - fail: - if (thread) { - ftdm_safe_free(thread); - } - done: - return status; -} - - -FT_DECLARE(ftdm_status_t) ftdm_mutex_create(ftdm_mutex_t **mutex) -{ - ftdm_status_t status = FTDM_FAIL; -#ifndef WIN32 - pthread_mutexattr_t attr; -#endif - ftdm_mutex_t *check = NULL; - - check = (ftdm_mutex_t *)ftdm_calloc(1, sizeof(**mutex)); - if (!check) - goto done; -#ifdef WIN32 - InitializeCriticalSection(&check->mutex); -#else - if (pthread_mutexattr_init(&attr)) - goto done; - - if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) - goto fail; - - if (pthread_mutex_init(&check->mutex, &attr)) - goto fail; - - goto success; - - fail: - pthread_mutexattr_destroy(&attr); - goto done; - - success: -#endif - *mutex = check; - status = FTDM_SUCCESS; - - done: - return status; -} - -FT_DECLARE(ftdm_status_t) ftdm_mutex_destroy(ftdm_mutex_t **mutex) -{ - ftdm_mutex_t *mp = *mutex; - *mutex = NULL; - if (!mp) { - return FTDM_FAIL; - } -#ifdef WIN32 - DeleteCriticalSection(&mp->mutex); -#else - if (pthread_mutex_destroy(&mp->mutex)) - return FTDM_FAIL; -#endif - ftdm_safe_free(mp); - return FTDM_SUCCESS; -} - -#define ADD_LOCK_HISTORY(mutex, file, line, func) \ - { \ - if ((mutex)->reentrancy < FTDM_MUTEX_MAX_REENTRANCY) { \ - (mutex)->lock_history[mutex->reentrancy].locked.file = (file); \ - (mutex)->lock_history[mutex->reentrancy].locked.func = (func); \ - (mutex)->lock_history[mutex->reentrancy].locked.line = (line); \ - (mutex)->lock_history[mutex->reentrancy].unlocked.file = NULL; \ - (mutex)->lock_history[mutex->reentrancy].unlocked.func = NULL; \ - (mutex)->lock_history[mutex->reentrancy].unlocked.line = 0; \ - (mutex)->reentrancy++; \ - if ((mutex)->reentrancy == FTDM_MUTEX_MAX_REENTRANCY) { \ - ftdm_log((file), (func), (line), FTDM_LOG_LEVEL_ERROR, "Max reentrancy reached for mutex %p\n", (mutex)); \ - } \ - } \ - } - -FT_DECLARE(ftdm_status_t) _ftdm_mutex_lock(const char *file, int line, const char *func, ftdm_mutex_t *mutex) -{ -#ifdef WIN32 - ftdm_unused_arg(file); - ftdm_unused_arg(line); - ftdm_unused_arg(func); - - EnterCriticalSection(&mutex->mutex); -#else - int err; - if ((err = pthread_mutex_lock(&mutex->mutex))) { - ftdm_log(file, func, line, FTDM_LOG_LEVEL_ERROR, "Failed to lock mutex %d:%s\n", err, strerror(err)); - return FTDM_FAIL; - } -#endif -#ifdef FTDM_DEBUG_MUTEX - ADD_LOCK_HISTORY(mutex, file, line, func); -#endif - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) _ftdm_mutex_trylock(const char *file, int line, const char *func, ftdm_mutex_t *mutex) -{ - ftdm_unused_arg(file); - ftdm_unused_arg(line); - ftdm_unused_arg(func); -#ifdef WIN32 - if (!TryEnterCriticalSection(&mutex->mutex)) - return FTDM_FAIL; -#else - if (pthread_mutex_trylock(&mutex->mutex)) - return FTDM_FAIL; -#endif -#ifdef FTDM_DEBUG_MUTEX - ADD_LOCK_HISTORY(mutex, file, line, func); -#endif - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(const char *file, int line, const char *func, ftdm_mutex_t *mutex) -{ -#ifdef FTDM_DEBUG_MUTEX - int i = 0; - if (mutex->reentrancy == 0) { - ftdm_log(file, func, line, FTDM_LOG_LEVEL_ERROR, "Cannot unlock something that is not locked!\n"); - return FTDM_FAIL; - } - i = mutex->reentrancy - 1; - /* I think this is a fair assumption when debugging */ - if (func != mutex->lock_history[i].locked.func) { - ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Mutex %p was suspiciously locked at %s->%s:%d but unlocked at %s->%s:%d!\n", - mutex, mutex->lock_history[i].locked.func, mutex->lock_history[i].locked.file, mutex->lock_history[i].locked.line, - func, file, line); - } - mutex->lock_history[i].unlocked.file = file; - mutex->lock_history[i].unlocked.line = line; - mutex->lock_history[i].unlocked.func = func; - mutex->reentrancy--; -#endif -#ifdef WIN32 - ftdm_unused_arg(file); - ftdm_unused_arg(line); - ftdm_unused_arg(func); - - LeaveCriticalSection(&mutex->mutex); -#else - if (pthread_mutex_unlock(&mutex->mutex)) { - ftdm_log(file, func, line, FTDM_LOG_LEVEL_ERROR, "Failed to unlock mutex: %s\n", strerror(errno)); -#ifdef FTDM_DEBUG_MUTEX - mutex->reentrancy++; -#endif - return FTDM_FAIL; - } -#endif - return FTDM_SUCCESS; -} - - -FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device, ftdm_wait_flag_t device_flags) -{ - ftdm_status_t status = FTDM_SUCCESS; - ftdm_interrupt_t *interrupt = NULL; -#ifndef WIN32 - int fds[2]; -#endif - - ftdm_assert_return(ininterrupt != NULL, FTDM_FAIL, "interrupt double pointer is null!\n"); - - interrupt = ftdm_calloc(1, sizeof(*interrupt)); - if (!interrupt) { - ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt memory\n"); - return FTDM_ENOMEM; - } - - interrupt->device = device; - interrupt->device_input_flags = device_flags; -#ifdef WIN32 - interrupt->event = CreateEvent(NULL, FALSE, FALSE, NULL); - if (!interrupt->event) { - ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt event\n"); - status = FTDM_ENOMEM; - goto failed; - } -#else - if (pipe(fds)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt pipe: %s\n", strerror(errno)); - status = FTDM_FAIL; - goto failed; - } - interrupt->readfd = fds[0]; - interrupt->writefd = fds[1]; -#endif - - *ininterrupt = interrupt; - return FTDM_SUCCESS; - -failed: - if (interrupt) { -#ifndef WIN32 - if (interrupt->readfd) { - close(interrupt->readfd); - close(interrupt->writefd); - interrupt->readfd = -1; - interrupt->writefd = -1; - } -#endif - ftdm_safe_free(interrupt); - } - return status; -} - -#define ONE_BILLION 1000000000 - -FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int ms) -{ - int num = 1; -#ifdef WIN32 - DWORD res = 0; - HANDLE ints[2]; -#else - int res = 0; - struct pollfd ints[2]; - char pipebuf[255]; -#endif - - ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Interrupt is null!\n"); - - interrupt->device_output_flags = FTDM_NO_FLAGS; - /* start implementation */ -#ifdef WIN32 - ints[0] = interrupt->event; - if (interrupt->device != FTDM_INVALID_SOCKET) { - num++; - ints[1] = interrupt->device; - ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_output_flags member!)\n"); - } - res = WaitForMultipleObjects(num, ints, FALSE, ms >= 0 ? ms : INFINITE); - switch (res) { - case WAIT_TIMEOUT: - return FTDM_TIMEOUT; - case WAIT_FAILED: - case WAIT_ABANDONED: /* is it right to fail with abandoned? */ - return FTDM_FAIL; - default: - if (res >= (sizeof(ints)/sizeof(ints[0]))) { - ftdm_log(FTDM_LOG_ERROR, "Error waiting for freetdm interrupt event (WaitForSingleObject returned %d)\n", res); - return FTDM_FAIL; - } - return FTDM_SUCCESS; - } -#else -pollagain: - ints[0].fd = interrupt->readfd; - ints[0].events = POLLIN; - ints[0].revents = 0; - - if (interrupt->device != FTDM_INVALID_SOCKET) { - num++; - ints[1].fd = interrupt->device; - ints[1].events = interrupt->device_input_flags; - ints[1].revents = 0; - } - - res = poll(ints, num, ms); - - if (res == -1) { - if (errno == EINTR) { - goto pollagain; - } - ftdm_log(FTDM_LOG_CRIT, "interrupt poll failed (%s)\n", strerror(errno)); - return FTDM_FAIL; - } - - if (res == 0) { - return FTDM_TIMEOUT; - } - - if (ints[0].revents & POLLIN) { - res = read(ints[0].fd, pipebuf, sizeof(pipebuf)); - if (res == -1) { - ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno)); - } - } - if (interrupt->device != FTDM_INVALID_SOCKET) { - if (ints[1].revents & POLLIN) { - interrupt->device_output_flags |= FTDM_READ; - } - if (ints[1].revents & POLLOUT) { - interrupt->device_output_flags |= FTDM_WRITE; - } - if (ints[1].revents & POLLPRI) { - interrupt->device_output_flags |= FTDM_EVENTS; - } - } - return FTDM_SUCCESS; -#endif -} - -FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *interrupt) -{ - ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Interrupt is null!\n"); -#ifdef WIN32 - if (!SetEvent(interrupt->event)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to signal interrupt\n"); - return FTDM_FAIL; - - } -#else - int err; - struct pollfd testpoll; - testpoll.revents = 0; - testpoll.events = POLLIN; - testpoll.fd = interrupt->readfd; - err = poll(&testpoll, 1, 0); - if (err == 0 && !(testpoll.revents & POLLIN)) { - /* we just try to notify if there is nothing on the read fd already, - * otherwise users that never call interrupt wait eventually will - * eventually have the pipe buffer filled */ - if ((err = write(interrupt->writefd, "w", 1)) != 1) { - ftdm_log(FTDM_LOG_ERROR, "Failed to signal interrupt: %s\n", strerror(errno)); - return FTDM_FAIL; - } - } -#endif - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **ininterrupt) -{ - ftdm_interrupt_t *interrupt = NULL; - ftdm_assert_return(ininterrupt != NULL, FTDM_FAIL, "Interrupt null when destroying!\n"); - interrupt = *ininterrupt; -#ifdef WIN32 - CloseHandle(interrupt->event); -#else - close(interrupt->readfd); - close(interrupt->writefd); - - interrupt->readfd = -1; - interrupt->writefd = -1; -#endif - ftdm_safe_free(interrupt); - *ininterrupt = NULL; - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms) -{ - int numdevices = 0; - unsigned i = 0; - -#if defined(__WINDOWS__) - DWORD res = 0; - HANDLE ints[20]; - if (size > (ftdm_array_len(ints)/2)) { - /* improve if needed: dynamically allocate the list of interrupts *only* when exceeding the default size */ - ftdm_log(FTDM_LOG_CRIT, "Unsupported size of interrupts: %d, implement me!\n", size); - return FTDM_FAIL; - } - - for (i = 0; i < size; i++) { - ints[i] = interrupts[i]->event; - interrupts[i]->device_output_flags = FTDM_NO_FLAGS; - if (interrupts[i]->device != FTDM_INVALID_SOCKET) { - /* WARNING: if the device is ready for data we must implement for Windows the device_output_flags member */ - ints[size+numdevices] = interrupts[i]->device; - numdevices++; - ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_data_ready member!)\n", size); - } - } - - res = WaitForMultipleObjects((DWORD)size+numdevices, ints, FALSE, ms >= 0 ? ms : INFINITE); - - switch (res) { - case WAIT_TIMEOUT: - return FTDM_TIMEOUT; - case WAIT_FAILED: - case WAIT_ABANDONED: /* is it right to fail with abandoned? */ - return FTDM_FAIL; - default: - if (res >= (size+numdevices)) { - ftdm_log(FTDM_LOG_ERROR, "Error waiting for freetdm interrupt event (WaitForSingleObject returned %d)\n", res); - return FTDM_FAIL; - } - /* fall-through to FTDM_SUCCESS at the end of the function */ - } -#elif defined(__linux__) || defined(__FreeBSD__) - int res = 0; - char pipebuf[255]; - struct pollfd ints[size*2]; - - memset(&ints, 0, sizeof(ints)); -pollagain: - for (i = 0; i < size; i++) { - ints[i].events = POLLIN; - ints[i].revents = 0; - ints[i].fd = interrupts[i]->readfd; - interrupts[i]->device_output_flags = FTDM_NO_FLAGS; - if (interrupts[i]->device != FTDM_INVALID_SOCKET) { - ints[size+numdevices].events = interrupts[i]->device_input_flags; - ints[size+numdevices].revents = 0; - ints[size+numdevices].fd = interrupts[i]->device; - numdevices++; - } - } - - res = poll(ints, size + numdevices, ms); - if (res == -1) { - if (errno == EINTR) { - goto pollagain; - } - ftdm_log(FTDM_LOG_CRIT, "interrupt poll failed (%s)\n", strerror(errno)); - return FTDM_FAIL; - } - - if (res == 0) { - return FTDM_TIMEOUT; - } - - /* check for events in the pipes and in the devices, but service only the pipes */ - numdevices = 0; - for (i = 0; i < size; i++) { - if (ints[i].revents & POLLIN) { - res = read(ints[i].fd, pipebuf, sizeof(pipebuf)); - if (res == -1) { - ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno)); - } - } - if (interrupts[i]->device != FTDM_INVALID_SOCKET) { - if (ints[size+numdevices].revents & POLLIN) { - interrupts[i]->device_output_flags |= FTDM_READ; - } - if (ints[size+numdevices].revents & POLLOUT) { - interrupts[i]->device_output_flags |= FTDM_WRITE; - } - if (ints[size+numdevices].revents & POLLPRI) { - interrupts[i]->device_output_flags |= FTDM_EVENTS; - } - numdevices++; - } - } -#else - /* for MacOS compilation, unused vars */ - numdevices = i; -#endif - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_wait_flag_t) ftdm_interrupt_device_ready(ftdm_interrupt_t *interrupt) -{ -#if defined(__WINDOWS__) - /* device output flags are not currently filled for Windows upon returning from a wait function */ - ftdm_log(FTDM_LOG_CRIT, "IMPLEMENT ME!\n"); -#endif - return interrupt->device_output_flags; -} - -/* For Emacs: - * Local Variables: - * mode:c - * 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/freetdm/src/ftdm_variables.c b/libs/freetdm/src/ftdm_variables.c deleted file mode 100644 index a2899c4ca9..0000000000 --- a/libs/freetdm/src/ftdm_variables.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * - */ - -#include "private/ftdm_core.h" - -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_add_var(ftdm_sigmsg_t *sigmsg, const char *var_name, const char *value) -{ - char *t_name = 0, *t_val = 0; - - if (!sigmsg || !var_name || !value) { - return FTDM_FAIL; - } - - if (!sigmsg->variables) { - /* initialize on first use */ - sigmsg->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - ftdm_assert_return(sigmsg->variables, FTDM_FAIL, "Failed to create hash table\n"); - } - - t_name = ftdm_strdup(var_name); - t_val = ftdm_strdup(value); - hashtable_insert(sigmsg->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE); - return FTDM_SUCCESS; -} - -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_remove_var(ftdm_sigmsg_t *sigmsg, const char *var_name) -{ - if (sigmsg && sigmsg->variables) { - hashtable_remove(sigmsg->variables, (void *)var_name); - } - return FTDM_SUCCESS; -} - -FT_DECLARE(const char *) ftdm_sigmsg_get_var(ftdm_sigmsg_t *sigmsg, const char *var_name) -{ - const char *var = NULL; - - if (!sigmsg || !sigmsg->variables || !var_name) { - return NULL; - } - - var = (const char *)hashtable_search(((struct hashtable*)sigmsg->variables), (void *)var_name); - return var; -} - -FT_DECLARE(ftdm_iterator_t *) ftdm_sigmsg_get_var_iterator(const ftdm_sigmsg_t *sigmsg, ftdm_iterator_t *iter) -{ - ftdm_hash_iterator_t *hashiter = NULL; - if (!sigmsg) { - return NULL; - } - - hashiter = sigmsg->variables == NULL ? NULL : hashtable_first(sigmsg->variables); - - if (hashiter == NULL) { - return NULL; - } - - if (!(iter = ftdm_get_iterator(FTDM_ITERATOR_VARS, iter))) { - return NULL; - } - iter->pvt.hashiter = hashiter; - return iter; -} - -FT_DECLARE(ftdm_status_t) ftdm_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val) -{ - const void *key = NULL; - void *val = NULL; - - *var_name = NULL; - *var_val = NULL; - - ftdm_assert_return(iter && (iter->type == FTDM_ITERATOR_VARS) && iter->pvt.hashiter, FTDM_FAIL, "Cannot get variable from invalid iterator!\n"); - - hashtable_this(iter->pvt.hashiter, &key, NULL, &val); - - *var_name = key; - *var_val = val; - - return FTDM_SUCCESS; -} - - -FT_DECLARE(ftdm_status_t) ftdm_usrmsg_add_var(ftdm_usrmsg_t *usrmsg, const char *var_name, const char *value) -{ - char *t_name = 0, *t_val = 0; - - if (!usrmsg || !var_name || !value) { - return FTDM_FAIL; - } - - if (!usrmsg->variables) { - /* initialize on first use */ - usrmsg->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - ftdm_assert_return(usrmsg->variables, FTDM_FAIL, "Failed to create hash table\n"); - } - - t_name = ftdm_strdup(var_name); - t_val = ftdm_strdup(value); - hashtable_insert(usrmsg->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE); - return FTDM_SUCCESS; -} - -FT_DECLARE(const char *) ftdm_usrmsg_get_var(ftdm_usrmsg_t *usrmsg, const char *var_name) -{ - const char *var = NULL; - - if (!usrmsg || !usrmsg->variables || !var_name) { - return NULL; - } - - var = (const char *)hashtable_search(((struct hashtable*)usrmsg->variables), (void *)var_name); - return var; -} diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h b/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h deleted file mode 100644 index 2bc1717556..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FTDM_ANALOG_H -#define FTDM_ANALOG_H -#include "freetdm.h" - -typedef enum { - FTDM_ANALOG_RUNNING = (1 << 0), - FTDM_ANALOG_CALLERID = (1 << 1), - FTDM_ANALOG_ANSWER_POLARITY_REVERSE = (1 << 2), - FTDM_ANALOG_HANGUP_POLARITY_REVERSE = (1 << 3), - FTDM_ANALOG_POLARITY_CALLERID = (1 << 4) -} ftdm_analog_flag_t; - -#define FTDM_MAX_HOTLINE_STR 32 -#define MAX_DTMF 256 - -struct ftdm_analog_data { - uint32_t flags; - uint32_t max_dialstr; - uint32_t wait_dialtone_timeout; - uint32_t polarity_delay; - uint32_t digit_timeout; - char hotline[FTDM_MAX_HOTLINE_STR]; -}; - -/* Analog flags to be set in the sflags (signaling flags) channel memeber */ -#define AF_POLARITY_REVERSE (1 << 0) - -static void *ftdm_analog_run(ftdm_thread_t *me, void *obj); -typedef struct ftdm_analog_data ftdm_analog_data_t; - -#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/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj deleted file mode 100644 index 09349fc05f..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj.filters deleted file mode 100644 index b6fed5927a..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj.filters +++ /dev/null @@ -1,23 +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 - - - - - Source Files - - - - - Header Files - - - \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c deleted file mode 100644 index 065e12a0d0..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ /dev/null @@ -1,1270 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "private/ftdm_core.h" -#include "ftdm_analog.h" - -#ifndef localtime_r -struct tm * localtime_r(const time_t *clock, struct tm *result); -#endif - -static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj); - -/** - * \brief Starts an FXO channel thread (outgoing call) - * \param ftdmchan Channel to initiate call on - * \return Success or failure - * - * Initialises state, starts tone progress detection and runs the channel in a new a thread. - */ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxo_outgoing_call) -{ - ftdm_analog_data_t *analog_data = ftdmchan->span->signal_data; - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { - ftdm_channel_clear_needed_tones(ftdmchan); - ftdm_channel_clear_detected_tones(ftdmchan); - - ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_PROGRESS_DETECT, NULL); - if (analog_data->wait_dialtone_timeout) { - ftdmchan->needed_tones[FTDM_TONEMAP_DIAL] = 1; - } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALING); - ftdm_thread_create_detached(ftdm_analog_channel_run, ftdmchan); - return FTDM_SUCCESS; - } - - return FTDM_FAIL; -} - -/** - * \brief Starts an FXS channel thread (outgoing call) - * \param ftdmchan Channel to initiate call on - * \return Success or failure - * - * Indicates call waiting if channel is already in use, otherwise runs the channel in a new thread. - */ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxs_outgoing_call) -{ - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CALLWAITING); - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_GENRING); - ftdm_thread_create_detached(ftdm_analog_channel_run, ftdmchan); - } - - return FTDM_SUCCESS; -} - -/** - * \brief Returns the signalling status on a channel - * \param ftdmchan Channel to get status on - * \param status Pointer to set signalling status - * \return Success or failure - */ - -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(analog_get_channel_sig_status) -{ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) { - *status = FTDM_SIG_STATE_DOWN; - return FTDM_SUCCESS; - } - *status = FTDM_SIG_STATE_UP; - return FTDM_SUCCESS; -} - -/** - * \brief Returns the signalling status on a span - * \param span Span to get status on - * \param status Pointer to set signalling status - * \return Success or failure - */ - -static FIO_SPAN_GET_SIG_STATUS_FUNCTION(analog_get_span_sig_status) -{ - ftdm_iterator_t *citer = NULL; - ftdm_iterator_t *chaniter = ftdm_span_get_chan_iterator(span, NULL); - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - return FTDM_FAIL; - } - /* if ALL channels are in alarm, report DOWN, UP otherwise. */ - *status = FTDM_SIG_STATE_DOWN; - for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { - ftdm_channel_t *fchan = ftdm_iterator_current(citer); - ftdm_channel_lock(fchan); - if (!ftdm_test_flag(fchan, FTDM_CHANNEL_IN_ALARM)) { - *status = FTDM_SIG_STATE_UP; - ftdm_channel_unlock(fchan); - break; - } - ftdm_channel_unlock(fchan); - } - ftdm_iterator_free(chaniter); - return FTDM_SUCCESS; -} - -/** - * \brief Starts an analog span thread (monitor) - * \param span Span to monitor - * \return Success or failure - */ -static ftdm_status_t ftdm_analog_start(ftdm_span_t *span) -{ - ftdm_analog_data_t *analog_data = span->signal_data; - ftdm_set_flag(analog_data, FTDM_ANALOG_RUNNING); - return ftdm_thread_create_detached(ftdm_analog_run, span); -} - -/** - * \brief Stops the analog span thread (monitor) - * \param span Span to stop - * \return Success or failure - */ -static ftdm_status_t ftdm_analog_stop(ftdm_span_t *span) -{ - ftdm_analog_data_t *analog_data = span->signal_data; - int32_t sanity = 100; - while (ftdm_test_flag(analog_data, FTDM_ANALOG_RUNNING) && sanity--) { - ftdm_sleep(100); - ftdm_log(FTDM_LOG_DEBUG, "Waiting for analog thread for span %s to stop\n", span->name); - } - - if (!sanity) { - ftdm_log(FTDM_LOG_ERROR, "The analog thread for span %s is probably still running, we may crash :(\n", span->name); - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -/** - * \brief Initialises an analog span from configuration variables - * \param span Span to configure - * \param sig_cb Callback function for event signals - * \param ap List of configuration variables - * \return Success or failure - */ -static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span) -//ftdm_status_t ftdm_analog_configure_span(ftdm_span_t *span, char *tonemap, uint32_t digit_timeout, uint32_t max_dialstr, fio_signal_cb_t sig_cb) -{ - ftdm_analog_data_t *analog_data; - const char *tonemap = "us"; - const char *hotline = ""; - uint32_t digit_timeout = 10; - uint32_t wait_dialtone_timeout = 5000; - uint32_t max_dialstr = MAX_DTMF; - uint32_t polarity_delay = 600; - const char *var, *val; - int *intval; - uint32_t flags = FTDM_ANALOG_CALLERID; - int callwaiting = 1; - unsigned int i = 0; - - assert(sig_cb != NULL); - ftdm_log(FTDM_LOG_DEBUG, "Configuring span %s for analog signaling ...\n", span->name); - - if (span->signal_type) { - ftdm_log(FTDM_LOG_ERROR, "Span %s is already configured for signaling %d\n", span->name, span->signal_type); - snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling."); - return FTDM_FAIL; - } - - analog_data = ftdm_malloc(sizeof(*analog_data)); - - ftdm_assert_return(analog_data != NULL, FTDM_FAIL, "malloc failure\n"); - - memset(analog_data, 0, sizeof(*analog_data)); - - while ((var = va_arg(ap, char *))) { - ftdm_log(FTDM_LOG_DEBUG, "Analog config var = %s\n", var); - if (!strcasecmp(var, "tonemap")) { - if (!(val = va_arg(ap, char *))) { - break; - } - tonemap = val; - } else if (!strcasecmp(var, "digit_timeout")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - digit_timeout = *intval; - } else if (!strcasecmp(var, "wait_dialtone_timeout")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - wait_dialtone_timeout = ftdm_max(0, *intval); - ftdm_log(FTDM_LOG_DEBUG, "Wait dial tone ms = %d\n", wait_dialtone_timeout); - } else if (!strcasecmp(var, "enable_callerid")) { - if (!(val = va_arg(ap, char *))) { - break; - } - - if (ftdm_true(val)) { - flags |= FTDM_ANALOG_CALLERID; - } else { - flags &= ~FTDM_ANALOG_CALLERID; - } - } else if (!strcasecmp(var, "answer_polarity_reverse")) { - if (!(val = va_arg(ap, char *))) { - break; - } - if (ftdm_true(val)) { - flags |= FTDM_ANALOG_ANSWER_POLARITY_REVERSE; - } else { - flags &= ~FTDM_ANALOG_ANSWER_POLARITY_REVERSE; - } - } else if (!strcasecmp(var, "hangup_polarity_reverse")) { - if (!(val = va_arg(ap, char *))) { - break; - } - if (ftdm_true(val)) { - flags |= FTDM_ANALOG_HANGUP_POLARITY_REVERSE; - } else { - flags &= ~FTDM_ANALOG_HANGUP_POLARITY_REVERSE; - } - } else if (!strcasecmp(var, "polarity_delay")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - polarity_delay = *intval; - } else if (!strcasecmp(var, "callwaiting")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - callwaiting = *intval; - } else if (!strcasecmp(var, "max_dialstr")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - max_dialstr = *intval; - } else if (!strcasecmp(var, "hotline")) { - if (!(val = va_arg(ap, char *))) { - break; - } - hotline = val; - } else if (!strcasecmp(var, "polarity_callerid")) { - if (!(val = va_arg(ap, char *))) { - break; - } - if (ftdm_true(val)) { - flags |= FTDM_ANALOG_POLARITY_CALLERID; - } else { - flags &= ~FTDM_ANALOG_POLARITY_CALLERID; - } - } else { - ftdm_log(FTDM_LOG_ERROR, "Unknown parameter %s in span %s\n", var, span->name); - } - } - - if (digit_timeout < 2000 || digit_timeout > 10000) { - digit_timeout = 2000; - } - - if ((max_dialstr < 1 && !strlen(hotline)) || max_dialstr > MAX_DTMF) { - max_dialstr = MAX_DTMF; - } - - if (callwaiting) { - for (i = 1; i <= span->chan_count; i++) { - ftdm_log_chan_msg(span->channels[i], FTDM_LOG_DEBUG, "Enabled call waiting\n"); - ftdm_channel_set_feature(span->channels[i], FTDM_CHANNEL_FEATURE_CALLWAITING); - } - } - - span->start = ftdm_analog_start; - span->stop = ftdm_analog_stop; - analog_data->flags = flags; - analog_data->digit_timeout = digit_timeout; - analog_data->wait_dialtone_timeout = wait_dialtone_timeout; - analog_data->polarity_delay = polarity_delay; - analog_data->max_dialstr = max_dialstr; - span->signal_cb = sig_cb; - strncpy(analog_data->hotline, hotline, sizeof(analog_data->hotline)); - span->signal_type = FTDM_SIGTYPE_ANALOG; - span->signal_data = analog_data; - span->outgoing_call = span->trunk_type == FTDM_TRUNK_FXS ? analog_fxs_outgoing_call : analog_fxo_outgoing_call; - span->get_channel_sig_status = analog_get_channel_sig_status; - span->get_span_sig_status = analog_get_span_sig_status; - - ftdm_span_load_tones(span, tonemap); - - ftdm_log(FTDM_LOG_DEBUG, "Configuration of analog signaling for span %s is done\n", span->name); - return FTDM_SUCCESS; - -} - -/** - * \brief Retrieves tone generation output to be sent - * \param ts Teletone generator - * \param map Tone map - * \return -1 on error, 0 on success - */ -static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map) -{ - ftdm_buffer_t *dt_buffer = ts->user_data; - int wrote; - - if (!dt_buffer) { - return -1; - } - wrote = teletone_mux_tones(ts, map); - ftdm_buffer_write(dt_buffer, ts->buffer, wrote * 2); - return 0; -} - -/** - * \brief Sends caller id on an analog channel (FSK coded) - * \param ftdmchan Channel to send caller id on - */ -static void send_caller_id(ftdm_channel_t *ftdmchan) -{ - ftdm_fsk_data_state_t fsk_data; - uint8_t databuf[1024] = ""; - char time_str[9]; - struct tm tm; - time_t now; - ftdm_mdmf_type_t mt = MDMF_INVALID; - - time(&now); -#ifdef WIN32 - _tzset(); - _localtime64_s(&tm, &now); -#else - localtime_r(&now, &tm); -#endif - strftime(time_str, sizeof(time_str), "%m%d%H%M", &tm); - - ftdm_fsk_data_init(&fsk_data, databuf, sizeof(databuf)); - ftdm_fsk_data_add_mdmf(&fsk_data, MDMF_DATETIME, (uint8_t *) time_str, 8); - - if (ftdm_strlen_zero(ftdmchan->caller_data.cid_num.digits)) { - mt = MDMF_NO_NUM; - ftdm_set_string(ftdmchan->caller_data.cid_num.digits, "O"); - } else if (!strcasecmp(ftdmchan->caller_data.cid_num.digits, "P") || !strcasecmp(ftdmchan->caller_data.cid_num.digits, "O")) { - mt = MDMF_NO_NUM; - } else { - mt = MDMF_PHONE_NUM; - } - ftdm_fsk_data_add_mdmf(&fsk_data, mt, (uint8_t *) ftdmchan->caller_data.cid_num.digits, (uint8_t)strlen(ftdmchan->caller_data.cid_num.digits)); - - if (ftdm_strlen_zero(ftdmchan->caller_data.cid_name)) { - mt = MDMF_NO_NAME; - ftdm_set_string(ftdmchan->caller_data.cid_name, "O"); - } else if (!strcasecmp(ftdmchan->caller_data.cid_name, "P") || !strcasecmp(ftdmchan->caller_data.cid_name, "O")) { - mt = MDMF_NO_NAME; - } else { - mt = MDMF_PHONE_NAME; - } - ftdm_fsk_data_add_mdmf(&fsk_data, mt, (uint8_t *) ftdmchan->caller_data.cid_name, (uint8_t)strlen(ftdmchan->caller_data.cid_name)); - - ftdm_fsk_data_add_checksum(&fsk_data); - ftdm_channel_send_fsk_data(ftdmchan, &fsk_data, -14); -} - -static void analog_dial(ftdm_channel_t *ftdmchan, uint32_t *state_counter, uint32_t *dial_timeout) -{ - if (ftdm_strlen_zero(ftdmchan->caller_data.dnis.digits)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No digits to send, moving to UP!\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - } else { - if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_SEND_DTMF, ftdmchan->caller_data.dnis.digits) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Send Digits Failed [%s]\n", ftdmchan->last_error); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else { - *state_counter = 0; - ftdmchan->needed_tones[FTDM_TONEMAP_RING] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_BUSY] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL1] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL2] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL3] = 1; - *dial_timeout = (uint32_t)((ftdmchan->dtmf_on + ftdmchan->dtmf_off) * strlen(ftdmchan->caller_data.dnis.digits)) + 2000; - } - } -} - -/** - * \brief Main thread function for analog channel (outgoing call) - * \param me Current thread - * \param obj Channel to run in this thread - */ -static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) -{ - ftdm_channel_t *ftdmchan = (ftdm_channel_t *) obj; - ftdm_buffer_t *dt_buffer = NULL; - teletone_generation_session_t ts; - uint8_t frame[1024]; - ftdm_size_t len, rlen; - ftdm_tone_type_t tt = FTDM_TONE_DTMF; - char dtmf[MAX_DTMF+1] = ""; - ftdm_size_t dtmf_offset = 0; - ftdm_analog_data_t *analog_data = ftdmchan->span->signal_data; - ftdm_channel_t *closed_chan; - uint32_t state_counter = 0, elapsed = 0, collecting = 0, interval = 0, last_digit = 0, indicate = 0, dial_timeout = analog_data->wait_dialtone_timeout; - uint32_t answer_on_polarity_counter = 0; - ftdm_sigmsg_t sig; - - ftdm_unused_arg(me); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "ANALOG CHANNEL thread starting.\n"); - - ts.buffer = NULL; - - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "OPEN ERROR [%s]\n", ftdmchan->last_error); - goto done; - } - - if (ftdm_buffer_create(&dt_buffer, 1024, 3192, 0) != FTDM_SUCCESS) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "memory error!"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "MEM ERROR\n"); - goto done; - } - - if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, &tt) != FTDM_SUCCESS) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "error initilizing tone detector!"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to initialize DTMF detector\n"); - goto done; - } - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Initialized DTMF detection\n"); - - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_INTHREAD); - teletone_init_session(&ts, 0, teletone_handler, dt_buffer); - ts.rate = 8000; -#if 0 - ts.debug = 1; - ts.debug_stream = stdout; -#endif - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); - ftdm_buffer_set_loops(dt_buffer, -1); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - - ftdm_assert(interval != 0, "Invalid interval"); - - if (!dial_timeout) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Not waiting for dial tone to dial number %s\n", ftdmchan->caller_data.dnis.digits); - } - - while (ftdm_running() && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { - ftdm_wait_flag_t flags = FTDM_READ; - ftdm_size_t dlen = 0; - - len = sizeof(frame); - - elapsed += interval; - state_counter += interval; - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_GET_CALLERID: - { - if (state_counter > 5000 || !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_CALLERID_DETECT, NULL); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - } - break; - case FTDM_CHANNEL_STATE_DIALING: - { - if (state_counter > dial_timeout) { - if (ftdmchan->needed_tones[FTDM_TONEMAP_DIAL]) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else { - /* do not go up if we're waiting for polarity reversal */ - if (ftdm_test_flag(analog_data, FTDM_ANALOG_ANSWER_POLARITY_REVERSE)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - } - } - } - } - break; - case FTDM_CHANNEL_STATE_GENRING: - { - if (state_counter > 60000) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else if (!ftdmchan->fsk_buffer || !ftdm_buffer_inuse(ftdmchan->fsk_buffer)) { - ftdm_sleep(interval); - continue; - } - } - break; - case FTDM_CHANNEL_STATE_DIALTONE: - { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_HOLD) && state_counter > 10000) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } - } - break; - case FTDM_CHANNEL_STATE_BUSY: - { - if (state_counter > 20000) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_ATTN); - } - } - break; - case FTDM_CHANNEL_STATE_ATTN: - { - if (state_counter > 20000) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - break; - case FTDM_CHANNEL_STATE_HANGUP: - { - if (state_counter > 500) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RINGING)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_OFF, NULL); - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && - ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && - (ftdmchan->last_state == FTDM_CHANNEL_STATE_RINGING - || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE - || ftdmchan->last_state == FTDM_CHANNEL_STATE_RING - || ftdmchan->last_state == FTDM_CHANNEL_STATE_UP)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - } - break; - case FTDM_CHANNEL_STATE_CALLWAITING: - { - int done = 0; - - if (ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] == 1) { - send_caller_id(ftdmchan); - ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]++; - } else if (state_counter > 600 && !ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]) { - send_caller_id(ftdmchan); - ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]++; - } else if (state_counter > 1000 && !ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]) { - done = 1; - } else if (state_counter > 10000) { - if (ftdmchan->fsk_buffer) { - ftdm_buffer_zero(ftdmchan->fsk_buffer); - } else { - ftdm_buffer_create(&ftdmchan->fsk_buffer, 128, 128, 0); - } - - ts.user_data = ftdmchan->fsk_buffer; - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_CALLWAITING_SAS]); - ts.user_data = dt_buffer; - done = 1; - } - - if (done) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0; - } - } - case FTDM_CHANNEL_STATE_UP: - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && - ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA && - ftdm_test_sflag(ftdmchan, AF_POLARITY_REVERSE)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Answering on polarity reverse\n"); - ftdm_clear_sflag(ftdmchan, AF_POLARITY_REVERSE); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - answer_on_polarity_counter = state_counter; - } else if (ftdmchan->state == FTDM_CHANNEL_STATE_UP - && ftdm_test_sflag(ftdmchan, AF_POLARITY_REVERSE)){ - /* if this polarity reverse is close to the answer polarity reverse, ignore it */ - if (answer_on_polarity_counter - && (state_counter - answer_on_polarity_counter) > analog_data->polarity_delay) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Hanging up on polarity reverse\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, - "Not hanging up on polarity reverse, too close to Answer reverse\n"); - } - ftdm_clear_sflag(ftdmchan, AF_POLARITY_REVERSE); - } else { - ftdm_sleep(interval); - } - continue; - } - break; - case FTDM_CHANNEL_STATE_DOWN: - { - goto done; - } - break; - default: - break; - } - } else { - ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - indicate = 0; - state_counter = 0; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler on %d:%d for %s\n", - ftdmchan->span_id, ftdmchan->chan_id, - ftdm_channel_state2str(ftdmchan->state)); - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - { - ftdm_channel_use(ftdmchan); - ftdm_channel_clear_needed_tones(ftdmchan); - ftdm_channel_flush_dtmf(ftdmchan); - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL); - } - - if (ftdmchan->fsk_buffer && ftdm_buffer_inuse(ftdmchan->fsk_buffer)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Cancel FSK transmit due to early answer.\n"); - ftdm_buffer_zero(ftdmchan->fsk_buffer); - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RINGING)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_OFF, NULL); - } - - if (ftdmchan->token_count == 1) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_HOLD); - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_HOLD)) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_HOLD); - sig.event_id = FTDM_SIGEVENT_ADD_CALL; - } else { - sig.event_id = FTDM_SIGEVENT_UP; - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && - !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && - ftdm_test_flag(analog_data, FTDM_ANALOG_ANSWER_POLARITY_REVERSE)) { - ftdm_polarity_t polarity = FTDM_POLARITY_REVERSE; - if (ftdmchan->polarity == FTDM_POLARITY_FORWARD) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Reversing polarity on answer\n"); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_POLARITY, &polarity); - } else { - /* the polarity may be already reversed if this is the second time we - * answer (ie, due to 2 calls being on the same line) */ - } - } - - ftdm_span_send_signal(ftdmchan->span, &sig); - continue; - } - break; - case FTDM_CHANNEL_STATE_DIALING: - { - ftdm_channel_use(ftdmchan); - } - break; - case FTDM_CHANNEL_STATE_RING: - { - ftdm_channel_use(ftdmchan); - sig.event_id = FTDM_SIGEVENT_START; - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { - ftdm_set_string(ftdmchan->caller_data.dnis.digits, ftdmchan->chan_number); - } else { - ftdm_set_string(ftdmchan->caller_data.dnis.digits, dtmf); - } - - ftdm_span_send_signal(ftdmchan->span, &sig); - continue; - } - break; - - case FTDM_CHANNEL_STATE_HANGUP: - /* this state is only used when the user hangup, if the device hang up (onhook) we currently - * go straight to DOWN. If we ever change this (as other signaling modules do) by using this - * state for both user and device hangup, we should check here for the type of hangup since - * some actions (polarity reverse) do not make sense if the device hung up */ - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && - ftdmchan->last_state == FTDM_CHANNEL_STATE_UP && - ftdm_test_flag(analog_data, FTDM_ANALOG_HANGUP_POLARITY_REVERSE)) { - ftdm_polarity_t polarity = ftdmchan->polarity == FTDM_POLARITY_REVERSE - ? FTDM_POLARITY_FORWARD : FTDM_POLARITY_REVERSE; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Reversing polarity on hangup\n"); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_POLARITY, &polarity); - } - break; - - case FTDM_CHANNEL_STATE_DOWN: - { - sig.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(ftdmchan->span, &sig); - goto done; - } - break; - case FTDM_CHANNEL_STATE_DIALTONE: - { - memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - *dtmf = '\0'; - dtmf_offset = 0; - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_DIAL]); - indicate = 1; - } - break; - case FTDM_CHANNEL_STATE_CALLWAITING: - { - ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0; - if (ftdmchan->fsk_buffer) { - ftdm_buffer_zero(ftdmchan->fsk_buffer); - } else { - ftdm_buffer_create(&ftdmchan->fsk_buffer, 128, 128, 0); - } - - ts.user_data = ftdmchan->fsk_buffer; - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_CALLWAITING_SAS]); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_CALLWAITING_CAS]); - ts.user_data = dt_buffer; - } - break; - case FTDM_CHANNEL_STATE_GENRING: - { - ftdm_sigmsg_t sig; - - send_caller_id(ftdmchan); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_ON, NULL); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - sig.event_id = FTDM_SIGEVENT_PROGRESS; - ftdm_span_send_signal(ftdmchan->span, &sig); - - } - break; - case FTDM_CHANNEL_STATE_GET_CALLERID: - { - memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Initializing cid data!\n"); - ftdm_set_string(ftdmchan->caller_data.ani.digits, "unknown"); - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.ani.digits); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_CALLERID_DETECT, NULL); - continue; - } - break; - case FTDM_CHANNEL_STATE_RINGING: - { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]); - indicate = 1; - - } - break; - case FTDM_CHANNEL_STATE_BUSY: - { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CIRCUIT_CONGESTION; - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_BUSY]); - indicate = 1; - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - break; - case FTDM_CHANNEL_STATE_ATTN: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_ATTN]); - indicate = 1; - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - break; - default: - break; - } - } - - - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE || ftdmchan->state == FTDM_CHANNEL_STATE_COLLECT) { - if ((dlen = ftdm_channel_dequeue_dtmf(ftdmchan, dtmf + dtmf_offset, sizeof(dtmf) - strlen(dtmf)))) { - - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - collecting = 1; - } - dtmf_offset = strlen(dtmf); - last_digit = elapsed; - sig.event_id = FTDM_SIGEVENT_COLLECTED_DIGIT; - ftdm_set_string(sig.ev_data.collected.digits, dtmf); - if (ftdm_span_send_signal(ftdmchan->span, &sig) == FTDM_BREAK) { - collecting = 0; - } - } - else if(!analog_data->max_dialstr) - { - last_digit = elapsed; - collecting = 0; - strcpy(dtmf, analog_data->hotline); - } - } - - - if (last_digit && (!collecting || ((elapsed - last_digit > analog_data->digit_timeout) || strlen(dtmf) >= analog_data->max_dialstr))) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Number obtained [%s]\n", dtmf); - if (ftdmchan->state == FTDM_CHANNEL_STATE_COLLECT && ftdmchan->state_status != FTDM_STATE_STATUS_COMPLETED) { - ftdm_channel_complete_state(ftdmchan); - } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - last_digit = 0; - collecting = 0; - } - - if (ftdm_channel_wait(ftdmchan, &flags, interval * 2) != FTDM_SUCCESS) { - continue; - } - - if (!(flags & FTDM_READ)) { - continue; - } - - if (ftdm_channel_read(ftdmchan, frame, &len) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "read error [%s]\n", ftdmchan->last_error); - continue; - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && ftdmchan->detected_tones[0]) { - int i; - - for (i = 1; i < FTDM_TONEMAP_INVALID; i++) { - if (ftdmchan->detected_tones[i]) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Detected tone %s on %d:%d\n", ftdm_tonemap2str(i), ftdmchan->span_id, ftdmchan->chan_id); - } - } - - if (ftdmchan->detected_tones[FTDM_TONEMAP_BUSY] || - ftdmchan->detected_tones[FTDM_TONEMAP_FAIL1] || - ftdmchan->detected_tones[FTDM_TONEMAP_FAIL2] || - ftdmchan->detected_tones[FTDM_TONEMAP_FAIL3] || - ftdmchan->detected_tones[FTDM_TONEMAP_ATTN] - ) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failure indication detected!\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else if (ftdmchan->detected_tones[FTDM_TONEMAP_DIAL]) { - analog_dial(ftdmchan, &state_counter, &dial_timeout); - } else if (ftdmchan->detected_tones[FTDM_TONEMAP_RING]) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - } - - ftdm_channel_clear_detected_tones(ftdmchan); - } else if (!dial_timeout) { - /* we were requested not to wait for dial tone, we can dial immediately */ - analog_dial(ftdmchan, &state_counter, &dial_timeout); - } - - if ((ftdmchan->dtmf_buffer && ftdm_buffer_inuse(ftdmchan->dtmf_buffer)) || (ftdmchan->fsk_buffer && ftdm_buffer_inuse(ftdmchan->fsk_buffer))) { - //rlen = len; - //memset(frame, 0, len); - //ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen); - continue; - } - - if (!indicate) { - continue; - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL); - } - - if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) { - len *= 2; - } - - rlen = ftdm_buffer_read_loop(dt_buffer, frame, len); - - if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) { - fio_codec_t codec_func = NULL; - - if (ftdmchan->native_codec == FTDM_CODEC_ULAW) { - codec_func = fio_slin2ulaw; - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW) { - codec_func = fio_slin2alaw; - } - - if (codec_func) { - codec_func(frame, sizeof(frame), &rlen); - } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "codec error!"); - goto done; - } - } - - ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen); - } - - done: - - closed_chan = ftdmchan; - - ftdm_channel_lock(closed_chan); - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Going onhook\n"); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL); - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RINGING)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_OFF, NULL); - } - - - ftdm_clear_sflag(ftdmchan, AF_POLARITY_REVERSE); - - ftdm_channel_close(&ftdmchan); - - ftdm_channel_command(closed_chan, FTDM_COMMAND_SET_NATIVE_CODEC, NULL); - - if (ts.buffer) { - teletone_destroy_session(&ts); - } - - if (dt_buffer) { - ftdm_buffer_destroy(&dt_buffer); - } - - if (closed_chan->state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state_locked(closed_chan, FTDM_CHANNEL_STATE_DOWN); - } - - ftdm_log_chan(closed_chan, FTDM_LOG_DEBUG, "ANALOG CHANNEL %d:%d thread ended.\n", closed_chan->span_id, closed_chan->chan_id); - - ftdm_clear_flag(closed_chan, FTDM_CHANNEL_INTHREAD); - - ftdm_channel_unlock(closed_chan); - - return NULL; -} - -/** - * \brief Processes freetdm event - * \param span Span on which the event was fired - * \param event Event to be treated - * \return Success or failure - */ -static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event) -{ - ftdm_sigmsg_t sig; - ftdm_analog_data_t *analog_data = event->channel->span->signal_data; - int locked = 0; - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = event->channel->chan_id; - sig.span_id = event->channel->span_id; - sig.channel = event->channel; - - - ftdm_log_chan(event->channel, FTDM_LOG_DEBUG, "Received event [%s] in state [%s]\n", ftdm_oob_event2str(event->enum_id), ftdm_channel_state2str(event->channel->state)); - - ftdm_mutex_lock(event->channel->mutex); - locked++; - - /* MAINTENANCE WARNING: - * 1. Be aware you are working on the locked channel - * 2. We should not be calling ftdm_span_send_signal or ftdm_set_state when there is already a channel thread running - * however, since this is old code I am not changing it now, but new code should adhere to that convention - * otherwise, we have possible races where we compete with the user for state changes, ie, the user requests - * a state change and then we process an event, the state change from the user is pending so our ftdm_set_state - * operation will fail. In cases where we win the race, our state change will be accepted but if a user requests - * a state change before the state change we requested here is processed by the channel thread, we'll end up - * rejecting the user request. - * - * See docs/locking.txt for further information about what guarantees should signaling modules provide when - * locking/unlocking a channel - * */ - switch(event->enum_id) { - case FTDM_OOB_RING_START: - { - if (event->channel->type != FTDM_CHAN_TYPE_FXO) { - ftdm_log_chan_msg(event->channel, FTDM_LOG_ERROR, "Cannot get a RING_START event on a non-fxo channel, please check your config.\n"); - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); - goto end; - } - if (!event->channel->ring_count && (event->channel->state == FTDM_CHANNEL_STATE_DOWN && !ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD))) { - if (ftdm_test_flag(analog_data, FTDM_ANALOG_CALLERID)) { - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_GET_CALLERID); - } else { - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_RING); - } - event->channel->ring_count = 1; - ftdm_mutex_unlock(event->channel->mutex); - locked = 0; - ftdm_thread_create_detached(ftdm_analog_channel_run, event->channel); - } else { - event->channel->ring_count++; - } - } - break; - case FTDM_OOB_ONHOOK: - { - if (ftdm_test_flag(event->channel, FTDM_CHANNEL_RINGING)) { - ftdm_channel_command(event->channel, FTDM_COMMAND_GENERATE_RING_OFF, NULL); - } - - if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { - if (event->channel->state == FTDM_CHANNEL_STATE_HANGUP && - ftdm_test_flag(event->channel, FTDM_CHANNEL_STATE_CHANGE)) { - /* we do not need to process HANGUP since the device also hangup already */ - ftdm_channel_complete_state(event->channel); - } - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); - } - if (event->channel->type == FTDM_CHAN_TYPE_FXS) { - /* we always return to forward when the device goes onhook */ - ftdm_polarity_t forward_polarity = FTDM_POLARITY_FORWARD; - ftdm_channel_command(event->channel, FTDM_COMMAND_SET_POLARITY, &forward_polarity); - } - } - break; - case FTDM_OOB_FLASH: - { - if (event->channel->state == FTDM_CHANNEL_STATE_CALLWAITING) { - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_UP); - ftdm_clear_flag(event->channel->span, FTDM_SPAN_STATE_CHANGE); - ftdm_channel_complete_state(event->channel); - event->channel->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0; - } - - ftdm_channel_rotate_tokens(event->channel); - - if (ftdm_test_flag(event->channel, FTDM_CHANNEL_HOLD) && event->channel->token_count != 1) { - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_UP); - } else { - sig.event_id = FTDM_SIGEVENT_FLASH; - ftdm_span_send_signal(span, &sig); - } - } - break; - case FTDM_OOB_OFFHOOK: - { - if (event->channel->type == FTDM_CHAN_TYPE_FXS) { - if (ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD)) { - if (ftdm_test_flag(event->channel, FTDM_CHANNEL_RINGING)) { - ftdm_channel_command(event->channel, FTDM_COMMAND_GENERATE_RING_OFF, NULL); - } - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_UP); - } else { - if(!analog_data->max_dialstr) { - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_COLLECT); - } else { - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DIALTONE); - } - ftdm_mutex_unlock(event->channel->mutex); - locked = 0; - ftdm_thread_create_detached(ftdm_analog_channel_run, event->channel); - } - } else { - if (!ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD)) { - if (ftdm_test_flag(event->channel, FTDM_CHANNEL_OFFHOOK)) { - ftdm_channel_command(event->channel, FTDM_COMMAND_ONHOOK, NULL); - } - } - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); - } - } - break; - case FTDM_OOB_ALARM_TRAP: - { - sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; - ftdm_span_send_signal(span, &sig); - } - break; - case FTDM_OOB_ALARM_CLEAR: - { - sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.ev_data.sigstatus.status = FTDM_SIG_STATE_UP; - ftdm_span_send_signal(span, &sig); - } - break; - case FTDM_OOB_POLARITY_REVERSE: - { - if (event->channel->type != FTDM_CHAN_TYPE_FXO) { - ftdm_log_chan_msg(event->channel, FTDM_LOG_WARNING, - "Ignoring polarity reversal, this should not happen in non-FXO channels!\n"); - break; - } - if (!ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD) && - ftdm_test_flag(event->channel, FTDM_CHANNEL_OFFHOOK)) { - ftdm_log_chan_msg(event->channel, FTDM_LOG_WARNING, - "Forcing onhook in channel not in thread after polarity reversal\n"); - ftdm_channel_command(event->channel, FTDM_COMMAND_ONHOOK, NULL); - break; - } - if (!ftdm_test_flag(analog_data, FTDM_ANALOG_ANSWER_POLARITY_REVERSE) - && !ftdm_test_flag(analog_data, FTDM_ANALOG_HANGUP_POLARITY_REVERSE)) { - ftdm_log_chan_msg(event->channel, FTDM_LOG_DEBUG, - "Ignoring polarity reversal because this channel is not configured for it\n"); - break; - } - if (event->channel->state == FTDM_CHANNEL_STATE_DOWN) { - if (ftdm_test_flag(analog_data, FTDM_ANALOG_CALLERID) - && ftdm_test_flag(analog_data, FTDM_ANALOG_POLARITY_CALLERID)) { - ftdm_log_chan_msg(event->channel, FTDM_LOG_DEBUG, "Polarity reversal detected while down, getting caller id now\n"); - ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_GET_CALLERID); - event->channel->ring_count = 1; - ftdm_mutex_unlock(event->channel->mutex); - locked = 0; - ftdm_thread_create_detached(ftdm_analog_channel_run, event->channel); - } else { - ftdm_log_chan_msg(event->channel, FTDM_LOG_DEBUG, - "Ignoring polarity reversal because this channel is down\n"); - } - break; - } - /* we have a good channel, set the polarity flag and let the channel thread deal with it */ - ftdm_set_sflag(event->channel, AF_POLARITY_REVERSE); - } - break; - default: - { - ftdm_log_chan(event->channel, FTDM_LOG_DEBUG, "Ignoring event [%s] in state [%s]\n", ftdm_oob_event2str(event->enum_id), ftdm_channel_state2str(event->channel->state)); - } - break; - } - - end: - - if (locked) { - ftdm_mutex_unlock(event->channel->mutex); - } - return FTDM_SUCCESS; -} - -/** - * \brief Main thread function for analog span (monitor) - * \param me Current thread - * \param obj Span to run in this thread - */ -static void *ftdm_analog_run(ftdm_thread_t *me, void *obj) -{ - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_analog_data_t *analog_data = span->signal_data; - int errs = 0; - - ftdm_unused_arg(me); - ftdm_log(FTDM_LOG_DEBUG, "ANALOG thread starting.\n"); - - while(ftdm_running() && ftdm_test_flag(analog_data, FTDM_ANALOG_RUNNING)) { - int waitms = 1000; - ftdm_status_t status; - - if ((status = ftdm_span_poll_event(span, waitms, NULL)) != FTDM_FAIL) { - errs = 0; - } - - switch(status) { - case FTDM_SUCCESS: - { - ftdm_event_t *event; - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { - if (event->enum_id == FTDM_OOB_NOOP) { - continue; - } - if (process_event(span, event) != FTDM_SUCCESS) { - goto end; - } - } - } - break; - case FTDM_FAIL: - { - ftdm_log(FTDM_LOG_ERROR, "Failure Polling event! [%s]\n", span->last_error); - if (++errs > 300) { - ftdm_log(FTDM_LOG_CRIT, "Too Many Errors!\n"); - goto end; - } - } - break; - default: - break; - } - - } - - end: - - ftdm_clear_flag(analog_data, FTDM_ANALOG_RUNNING); - - ftdm_log(FTDM_LOG_DEBUG, "ANALOG thread ending.\n"); - - return NULL; -} - -/** - * \brief FreeTDM analog signaling module initialisation - * \return Success - */ -static FIO_SIG_LOAD_FUNCTION(ftdm_analog_init) -{ - return FTDM_SUCCESS; -} - -/** - * \brief FreeTDM analog signaling module definition - */ -EX_DECLARE_DATA ftdm_module_t ftdm_module = { - "analog", - NULL, - NULL, - ftdm_analog_init, - ftdm_analog_configure_span, - NULL -}; - - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h b/libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h deleted file mode 100644 index e52a319155..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2008-2012, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributor(s): - * - * John Wehle (john@feith.com) - * Moises Silva (moy@sangoma.com) - * - */ - -#ifndef FTDM_ANALOG_EM_H -#define FTDM_ANALOG_EM_H -#include "freetdm.h" - -#define MAX_DIALSTRING 256 - -typedef enum { - FTDM_ANALOG_EM_RUNNING = (1 << 0), - FTDM_ANALOG_EM_LOCAL_WRITE = (1 << 2), - FTDM_ANALOG_EM_LOCAL_SUSPEND = (1 << 3), - FTDM_ANALOG_EM_REMOTE_SUSPEND = (1 << 4), -} ftdm_analog_em_flag_t; - -struct ftdm_analog_data { - uint32_t flags; - uint32_t max_dialstr; - uint32_t digit_timeout; - uint32_t dial_timeout; - ftdm_bool_t answer_supervision; - ftdm_bool_t immediate_ringback; - char ringback_file[512]; -}; - -static void *ftdm_analog_em_run(ftdm_thread_t *me, void *obj); -typedef struct ftdm_analog_data ftdm_analog_em_data_t; - -#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/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2008.vcproj deleted file mode 100644 index 837ba7de0f..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2008.vcproj +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj.filters deleted file mode 100644 index 3326f9fd16..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj.filters +++ /dev/null @@ -1,23 +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 - - - - - Source Files - - - - - Header Files - - - \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c deleted file mode 100644 index 98fde2a514..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c +++ /dev/null @@ -1,1160 +0,0 @@ -/* - * Copyright (c) 2008-2012, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributor(s): - * - * John Wehle (john@feith.com) - * Moises Silva (moy@sangoma.com) - * - */ - -#include "private/ftdm_core.h" -#include "ftdm_analog_em.h" - -#ifndef localtime_r -struct tm * localtime_r(const time_t *clock, struct tm *result); -#endif - -static FIO_SPAN_SET_SIG_STATUS_FUNCTION(analog_em_set_span_sig_status); - -/* check if the given file is a wave file and skip the header if it is */ -#define WAVE_CHUNK_ID "RIFF" -#define WAVE_FMT "WAVEfmt " -#define WAVE_HEADER_LEN 44 -static int skip_wave_header(const char *fname, FILE *f) -{ - char rbuff[10] = { 0 }; - unsigned int hz = 0; - unsigned int hs = 0; - unsigned short fmt = 0; - unsigned short chans = 0; - unsigned int size = 0; - - /* check chunk id */ - if (fread(rbuff, 1, 4, f) != 4) { - ftdm_log(FTDM_LOG_ERROR, "Unable to read wav chunk id from file %s\n", fname); - goto error; - } - rbuff[4] = 0; - - if (strncasecmp(rbuff, WAVE_CHUNK_ID, sizeof(WAVE_CHUNK_ID)-1)) { - goto notwave; - } - - /* read chunk size */ - if (fread(&size, 1, 4, f) != 4) { - ftdm_log(FTDM_LOG_ERROR, "Unable to read wav chunk size from file %s\n", fname); - goto error; - } - - /* check format and sub chunk id */ - if (fread(rbuff, 1, 8, f) != 8) { - ftdm_log(FTDM_LOG_ERROR, "Unable to read wav format and sub chunk id from file %s\n", fname); - goto error; - } - rbuff[8] = 0; - - if (strncasecmp(rbuff, WAVE_FMT, sizeof(WAVE_FMT)-1)) { - goto notwave; - } - - /* At this point we know is a wav file ... */ - - /* validate sub chunk size */ - if (fread(&hs, 1, 4, f) != 4) { - ftdm_log(FTDM_LOG_ERROR, "Unable to read wav sub chunk size from file %s\n", fname); - goto error; - } - - if (hs != 16) { - ftdm_log(FTDM_LOG_ERROR, "Unsupported wav sub chunk size %d from file %s\n", hs, fname); - goto error; - } - - /* validate audio format */ - if (fread(&fmt, 1, 2, f) != 2) { - ftdm_log(FTDM_LOG_ERROR, "Unable to read wav audio format from file %s\n", fname); - goto error; - } - - if (fmt != 1) { - ftdm_log(FTDM_LOG_ERROR, "Unsupported wav audio format %d in file %s, we only support PCM\n", fmt, fname); - goto error; - } - - /* validate channels */ - if (fread(&chans, 1, 2, f) != 2) { - ftdm_log(FTDM_LOG_ERROR, "Unable to read wav channels from file %s\n", fname); - goto error; - } - - if (chans != 1) { - ftdm_log(FTDM_LOG_ERROR, "Unsupported number of channels %d in file %s, we only support 1 (mono)\n", chans, fname); - goto error; - } - - /* validate sampling rate */ - if (fread(&hz, 1, 2, f) != 2) { - ftdm_log(FTDM_LOG_ERROR, "Unable to read wav sampling rate from file %s\n", fname); - goto error; - } - - if (hz != 8000) { - ftdm_log(FTDM_LOG_ERROR, "Invalid input wav sampling rate %dHz, only 8000Hz supported\n", hz); - goto error; - } - - ftdm_log(FTDM_LOG_DEBUG, "Found input file %s. PCM mono wav of %d bytes at %dHz, skipping header ...\n", fname, size, hz); - fseek(f, WAVE_HEADER_LEN, SEEK_SET); - - return 0; - -notwave: - ftdm_log(FTDM_LOG_ERROR, "File %s is not a wav file\n", fname); - return -1; - -error: - return -1; -} - -static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj); - -/** - * \brief Starts an EM channel thread (outgoing call) - * \param ftdmchan Channel to initiate call on - * \return Success or failure - * - * Initialises state, starts tone progress detection and runs the channel in a new a thread. - */ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_em_outgoing_call) -{ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { - ftdm_channel_clear_needed_tones(ftdmchan); - ftdm_channel_clear_detected_tones(ftdmchan); - - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); - - ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_PROGRESS_DETECT, NULL); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALING); - ftdm_thread_create_detached(ftdm_analog_em_channel_run, ftdmchan); - return FTDM_SUCCESS; - } - - return FTDM_FAIL; -} - -static ftdm_status_t ftdm_analog_em_sig_write(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size) -{ - ftdm_analog_em_data_t *analog_data = ftdmchan->span->signal_data; - if (ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA - && analog_data->immediate_ringback - && ftdm_test_sflag(ftdmchan, FTDM_ANALOG_EM_LOCAL_WRITE)) { - /* ringback is being played in the analog thread, ignore user data for now */ - return FTDM_BREAK; - } - return FTDM_SUCCESS; -} - -/** - * \brief Starts an EM span thread (monitor) - * \param span Span to monitor - * \return Success or failure - */ -static ftdm_status_t ftdm_analog_em_start(ftdm_span_t *span) -{ - ftdm_analog_em_data_t *analog_data = span->signal_data; - ftdm_set_flag(analog_data, FTDM_ANALOG_EM_RUNNING); - return ftdm_thread_create_detached(ftdm_analog_em_run, span); -} - -static void ftdm_analog_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) -{ - ftdm_sigmsg_t sig; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n", ftdm_signaling_status2str(status)); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.ev_data.sigstatus.status = status; - if (ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to change channel status to %s\n", ftdm_signaling_status2str(status)); - } - return; -} - -/** - * \brief Stops EM span thread (monitor) - * \param span Span to monitor - * \return Success or failure - */ -static ftdm_status_t ftdm_analog_em_stop(ftdm_span_t *span) -{ - ftdm_analog_em_data_t *analog_data = span->signal_data; - ftdm_clear_flag(analog_data, FTDM_ANALOG_EM_RUNNING); - ftdm_sleep(100); - analog_em_set_span_sig_status(span, FTDM_SIG_STATE_SUSPENDED); - return FTDM_SUCCESS; -} - -/** - * \brief Returns the signalling status on a channel - * \param ftdmchan Channel to get status on - * \param status Pointer to set signalling status - * \return Success or failure - */ -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(analog_em_get_channel_sig_status) -{ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) { - *status = FTDM_SIG_STATE_DOWN; - return FTDM_SUCCESS; - } - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { - *status = FTDM_SIG_STATE_SUSPENDED; - return FTDM_SUCCESS; - } - *status = FTDM_SIG_STATE_UP; - return FTDM_SUCCESS; -} - -/** - * \brief Returns the signalling status on a span - * \param span Span to get status on - * \param status Pointer to set signalling status - * \return Success or failure - */ -static FIO_SPAN_GET_SIG_STATUS_FUNCTION(analog_em_get_span_sig_status) -{ - ftdm_iterator_t *citer = NULL; - ftdm_iterator_t *chaniter = ftdm_span_get_chan_iterator(span, NULL); - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - return FTDM_FAIL; - } - /* if ALL channels are in alarm, report DOWN, UP otherwise. */ - *status = FTDM_SIG_STATE_DOWN; - for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { - ftdm_channel_t *fchan = ftdm_iterator_current(citer); - ftdm_channel_lock(fchan); - if (!ftdm_test_flag(fchan, FTDM_CHANNEL_IN_ALARM)) { - if (!ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED)) { - *status = FTDM_SIG_STATE_UP; - ftdm_channel_unlock(fchan); - break; - } else { - *status = FTDM_SIG_STATE_SUSPENDED; - } - } - ftdm_channel_unlock(fchan); - } - ftdm_iterator_free(chaniter); - return FTDM_SUCCESS; -} - -static ftdm_status_t analog_em_set_channel_sig_status_ex(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status, ftdm_bool_t remote) -{ - switch (status) { - case FTDM_SIG_STATE_DOWN: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot bring channel down, perhaps you want to try '%s'\n", ftdm_signaling_status2str(FTDM_SIG_STATE_SUSPENDED)); - return FTDM_FAIL; - case FTDM_SIG_STATE_SUSPENDED: - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { - int cas_bits = 0xFF; - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_CAS_BITS, &cas_bits); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL); - } - ftdm_analog_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); - } - if (remote) { - ftdm_set_sflag(ftdmchan, FTDM_ANALOG_EM_REMOTE_SUSPEND); - } else { - ftdm_set_sflag(ftdmchan, FTDM_ANALOG_EM_LOCAL_SUSPEND); - } - break; - case FTDM_SIG_STATE_UP: - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { - if (remote) { - ftdm_clear_sflag(ftdmchan, FTDM_ANALOG_EM_REMOTE_SUSPEND); - } else { - ftdm_clear_sflag(ftdmchan, FTDM_ANALOG_EM_LOCAL_SUSPEND); - } - if (!ftdm_test_sflag(ftdmchan, FTDM_ANALOG_EM_REMOTE_SUSPEND) && - !ftdm_test_sflag(ftdmchan, FTDM_ANALOG_EM_LOCAL_SUSPEND)) { - int cas_bits = 0x00; - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_CAS_BITS, &cas_bits); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL); - } - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) { - ftdm_analog_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); - } - } - } - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(analog_em_set_channel_sig_status) -{ - return analog_em_set_channel_sig_status_ex(ftdmchan, status, FTDM_FALSE); -} - -static FIO_SPAN_SET_SIG_STATUS_FUNCTION(analog_em_set_span_sig_status) -{ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *citer = NULL; - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - return FTDM_FAIL; - } - /* iterate over all channels, setting them to the requested state */ - for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { - ftdm_channel_t *fchan = ftdm_iterator_current(citer); - /* we set channel's state through analog_em_set_channel_sig_status(), since it already takes care of notifying the user when appropriate */ - ftdm_channel_lock(fchan); - if ((analog_em_set_channel_sig_status_ex(fchan, status, FTDM_FALSE)) != FTDM_SUCCESS) { - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "Failed to set signaling status to %s\n", ftdm_signaling_status2str(status)); - } - ftdm_channel_unlock(fchan); - } - ftdm_iterator_free(chaniter); - return FTDM_SUCCESS; -} - -/** - * \brief Initialises an EM span from configuration variables - * \param span Span to configure - * \param sig_cb Callback function for event signals - * \param ap List of configuration variables - * \return Success or failure - */ -static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_em_configure_span) -//ftdm_status_t ftdm_analog_em_configure_span(ftdm_span_t *span, char *tonemap, uint32_t digit_timeout, uint32_t max_dialstr, fio_signal_cb_t sig_cb) -{ - ftdm_analog_em_data_t *analog_data = NULL; - const char *tonemap = "us"; - const char *ringback_file = ""; - ftdm_bool_t immediate_ringback = FTDM_FALSE; - uint32_t digit_timeout = 2000; - uint32_t max_dialstr = 11; - uint32_t dial_timeout = 0; - uint32_t release_guard_time_ms = 500; - ftdm_bool_t answer_supervision = FTDM_FALSE; - const char *var, *val; - int *intval; - - assert(sig_cb != NULL); - - if (span->signal_type) { - snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling."); - return FTDM_FAIL; - } - - analog_data = ftdm_calloc(1, sizeof(*analog_data)); - assert(analog_data != NULL); - - while((var = va_arg(ap, char *))) { - ftdm_log(FTDM_LOG_DEBUG, "Parsing analog em parameter '%s'\n", var); - if (!strcasecmp(var, "tonemap")) { - if (!(val = va_arg(ap, char *))) { - break; - } - tonemap = val; - } else if (!strcasecmp(var, "immediate_ringback")) { - if (!(val = va_arg(ap, char *))) { - break; - } - immediate_ringback = ftdm_true(val); - } else if (!strcasecmp(var, "ringback_file")) { - if (!(val = va_arg(ap, char *))) { - break; - } - ringback_file = val; - } else if (!strcasecmp(var, "answer_supervision")) { - if (!(val = va_arg(ap, char *))) { - break; - } - answer_supervision = ftdm_true(val); - } else if (!strcasecmp(var, "dial_timeout")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - dial_timeout = *intval; - } else if (!strcasecmp(var, "digit_timeout")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - digit_timeout = *intval; - } else if (!strcasecmp(var, "max_dialstr")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - max_dialstr = *intval; - } else if (!strcasecmp(var, "release_guard_time_ms")) { - if (!(intval = va_arg(ap, int *))) { - break; - } - release_guard_time_ms = *intval; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid parameter for analog em span: '%s'\n", var); - return FTDM_FAIL; - } - } - - - if (digit_timeout < 2000 || digit_timeout > 10000) { - digit_timeout = 2000; - } - - if (max_dialstr < 2 || max_dialstr > MAX_DIALSTRING) { - ftdm_log(FTDM_LOG_ERROR, "Invalid max_dialstr, setting to %d\n", MAX_DIALSTRING); - max_dialstr = MAX_DIALSTRING; - } - - span->start = ftdm_analog_em_start; - span->stop = ftdm_analog_em_stop; - span->sig_write = ftdm_analog_em_sig_write; - analog_data->digit_timeout = digit_timeout; - analog_data->max_dialstr = max_dialstr; - analog_data->dial_timeout = dial_timeout; - analog_data->answer_supervision = answer_supervision; - span->signal_cb = sig_cb; - span->signal_type = FTDM_SIGTYPE_ANALOG; - span->signal_data = analog_data; - span->outgoing_call = analog_em_outgoing_call; - span->get_channel_sig_status = analog_em_get_channel_sig_status; - span->get_span_sig_status = analog_em_get_span_sig_status; - span->set_channel_sig_status = analog_em_set_channel_sig_status; - span->set_span_sig_status = analog_em_set_span_sig_status; - span->sig_release_guard_time_ms = release_guard_time_ms; - ftdm_span_load_tones(span, tonemap); - if (immediate_ringback || !ftdm_strlen_zero(ringback_file)) { - analog_data->immediate_ringback = FTDM_TRUE; - ftdm_set_string(analog_data->ringback_file, ringback_file); - } - - return FTDM_SUCCESS; - -} - -/** - * \brief Retrieves tone generation output to be sent - * \param ts Teletone generator - * \param map Tone map - * \return -1 on error, 0 on success - */ -static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map) -{ - ftdm_buffer_t *dt_buffer = ts->user_data; - int wrote; - - if (!dt_buffer) { - return -1; - } - wrote = teletone_mux_tones(ts, map); - ftdm_buffer_write(dt_buffer, ts->buffer, wrote * 2); - return 0; -} - -/** - * \brief Main thread function for EM channel (outgoing call) - * \param me Current thread - * \param obj Channel to run in this thread - */ -static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) -{ - ftdm_channel_t *ftdmchan = (ftdm_channel_t *) obj; - ftdm_buffer_t *dt_buffer = NULL; - teletone_generation_session_t ts; - uint8_t frame[1024]; - ftdm_size_t len, rlen; - ftdm_tone_type_t tt = FTDM_TONE_DTMF; - char dtmf[128] = ""; - ftdm_size_t dtmf_offset = 0; - ftdm_analog_em_data_t *analog_data = ftdmchan->span->signal_data; - ftdm_channel_t *closed_chan; - uint32_t state_counter = 0, elapsed = 0, collecting = 0, interval = 0, last_digit = 0, indicate = 0, dial_timeout = 30000; - ftdm_sigmsg_t sig; - int cas_bits = 0; - uint32_t cas_answer = 0; - uint32_t cas_hangup = 0; - int cas_answer_ms = 500; - int cas_hangup_ms = 500; - ftdm_bool_t busy_timeout = FTDM_FALSE; - FILE *ringback_f = NULL; - ftdm_bool_t digits_sent = FTDM_FALSE; - - ftdm_unused_arg(me); - ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM CHANNEL thread starting.\n"); - - ts.buffer = NULL; - - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "OPEN ERROR [%s]\n", ftdmchan->last_error); - goto done; - } - - if (ftdm_buffer_create(&dt_buffer, 1024, 3192, 0) != FTDM_SUCCESS) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "memory error!"); - ftdm_log(FTDM_LOG_ERROR, "MEM ERROR\n"); - goto done; - } - - if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, &tt) != FTDM_SUCCESS) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "error initilizing tone detector!"); - ftdm_log(FTDM_LOG_ERROR, "TONE ERROR\n"); - goto done; - } - - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_INTHREAD); - teletone_init_session(&ts, 0, teletone_handler, dt_buffer); - ts.rate = 8000; -#if 0 - ts.debug = 1; - ts.debug_stream = stdout; -#endif - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); - ftdm_buffer_set_loops(dt_buffer, -1); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - - assert(interval != 0); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "IO Interval: %u\n", interval); - - if (analog_data->immediate_ringback && !ftdm_strlen_zero(analog_data->ringback_file)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Using ringback file '%s'\n", analog_data->ringback_file); - ringback_f = fopen(analog_data->ringback_file, "rb"); - if (!ringback_f) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open ringback file '%s'\n", analog_data->ringback_file); - } else { - if (skip_wave_header(analog_data->ringback_file, ringback_f)) { - ringback_f = NULL; - } - } - } - - while (ftdm_running() && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { - ftdm_wait_flag_t flags = FTDM_READ; - ftdm_size_t dlen = 0; - - elapsed += interval; - state_counter += interval; - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_DIALING: - { - if (! ftdmchan->needed_tones[FTDM_TONEMAP_RING] - && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK) - && !digits_sent) { - if (ftdm_strlen_zero(ftdmchan->caller_data.dnis.digits)) { - ftdm_log(FTDM_LOG_ERROR, "No Digits to send!\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else { - if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_SEND_DTMF, ftdmchan->caller_data.dnis.digits) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Send Digits Failed [%s]\n", ftdmchan->last_error); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else { - state_counter = 0; - digits_sent = FTDM_TRUE; - ftdmchan->needed_tones[FTDM_TONEMAP_RING] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_BUSY] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL1] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL2] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL3] = 1; - dial_timeout = ((ftdmchan->dtmf_on + ftdmchan->dtmf_off) * strlen(ftdmchan->caller_data.dnis.digits)) + 2000; - if (analog_data->dial_timeout) { - dial_timeout += analog_data->dial_timeout; - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Outbound dialing timeout: %dms\n", dial_timeout); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Outbound CAS answer timeout: %dms\n", cas_answer_ms); - } - } - break; - } - if (state_counter > dial_timeout) { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else if (!analog_data->answer_supervision) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - } - } - cas_bits = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_CAS_BITS, &cas_bits); - if (!(state_counter % 1000)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "CAS bits: 0x%X\n", cas_bits); - } - if (cas_bits == 0xF) { - cas_answer += interval; - if (cas_answer >= cas_answer_ms) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Answering on CAS answer signal persistence!\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - } - } else if (cas_answer) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Resetting cas answer to 0: 0x%X!\n", cas_bits); - cas_answer = 0; - } - } - break; - case FTDM_CHANNEL_STATE_DIALTONE: - { - if (state_counter > 10000) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } - } - break; - case FTDM_CHANNEL_STATE_BUSY: - { - if (state_counter > 20000) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_ATTN); - } - } - break; - case FTDM_CHANNEL_STATE_ATTN: - { - if (state_counter > 20000) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - break; - case FTDM_CHANNEL_STATE_HANGUP: - { - if (state_counter > 500) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && - (ftdmchan->last_state == FTDM_CHANNEL_STATE_RINGING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE - || ftdmchan->last_state == FTDM_CHANNEL_STATE_RING)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - } - break; - case FTDM_CHANNEL_STATE_UP: - case FTDM_CHANNEL_STATE_RING: - { - ftdm_sleep(interval); - if (ftdmchan->state == FTDM_CHANNEL_STATE_UP) { - cas_bits = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_CAS_BITS, &cas_bits); - if (cas_bits == 0x0) { - cas_hangup += interval; - if (cas_hangup >= cas_hangup_ms) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Hanging up on CAS hangup signal persistence\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } else if (cas_hangup) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Resetting cas hangup to 0: 0x%X!\n", cas_bits); - cas_hangup = 0; - } - } - continue; - } - break; - case FTDM_CHANNEL_STATE_DOWN: - { - goto done; - } - break; - default: - break; - } - } else { - ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - indicate = 0; - state_counter = 0; - - ftdm_log(FTDM_LOG_DEBUG, "Executing state handler on %d:%d for %s\n", - ftdmchan->span_id, ftdmchan->chan_id, - ftdm_channel_state2str(ftdmchan->state)); - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - { - ftdm_channel_use(ftdmchan); - ftdm_channel_clear_needed_tones(ftdmchan); - ftdm_channel_flush_dtmf(ftdmchan); - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL); - } - - sig.event_id = FTDM_SIGEVENT_UP; - - ftdm_span_send_signal(ftdmchan->span, &sig); - continue; - } - break; - case FTDM_CHANNEL_STATE_DIALING: - { - ftdm_channel_use(ftdmchan); - } - break; - case FTDM_CHANNEL_STATE_RING: - { - ftdm_channel_use(ftdmchan); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_set_string(ftdmchan->caller_data.dnis.digits, ftdmchan->chan_number); - } else { - ftdm_set_string(ftdmchan->caller_data.dnis.digits, dtmf); - } - - sig.event_id = FTDM_SIGEVENT_START; - - ftdm_span_send_signal(ftdmchan->span, &sig); - continue; - } - break; - case FTDM_CHANNEL_STATE_DOWN: - { - sig.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(ftdmchan->span, &sig); - goto done; - } - break; - case FTDM_CHANNEL_STATE_DIALTONE: - { - memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - *dtmf = '\0'; - dtmf_offset = 0; - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_DIAL]); - indicate = 1; - - ftdm_channel_command(ftdmchan, FTDM_COMMAND_WINK, NULL); - } - break; - case FTDM_CHANNEL_STATE_RINGING: - { - if (!analog_data->immediate_ringback) { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]); - indicate = 1; - } - } - break; - case FTDM_CHANNEL_STATE_BUSY: - { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CIRCUIT_CONGESTION; - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_BUSY]); - indicate = 1; - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - busy_timeout = FTDM_TRUE; - } - } - break; - case FTDM_CHANNEL_STATE_ATTN: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_ATTN]); - indicate = 1; - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - break; - default: - break; - } - } - - - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE || ftdmchan->state == FTDM_CHANNEL_STATE_COLLECT) { - if ((dlen = ftdm_channel_dequeue_dtmf(ftdmchan, dtmf + dtmf_offset, sizeof(dtmf) - strlen(dtmf)))) { - - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - collecting = 1; - } - dtmf_offset = strlen(dtmf); - last_digit = elapsed; - sig.event_id = FTDM_SIGEVENT_COLLECTED_DIGIT; - ftdm_set_string(sig.ev_data.collected.digits, dtmf); - if (ftdm_span_send_signal(ftdmchan->span, &sig) == FTDM_BREAK) { - collecting = 0; - } - } - } - - if (last_digit && (!collecting || ((elapsed - last_digit > analog_data->digit_timeout) || strlen(dtmf) > analog_data->max_dialstr))) { - ftdm_log(FTDM_LOG_DEBUG, "Number obtained [%s]\n", dtmf); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - last_digit = 0; - collecting = 0; - } - - if (ftdm_channel_wait(ftdmchan, &flags, interval * 2) != FTDM_SUCCESS) { - continue; - } - - if (!(flags & FTDM_READ)) { - continue; - } - - /* Do not try to read more than the proper interval size */ - len = ftdmchan->packet_len * 2; - if (ftdm_channel_read(ftdmchan, frame, &len) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "READ ERROR [%s]\n", ftdmchan->last_error); - goto done; - } - - if (0 == len) { - ftdm_log(FTDM_LOG_DEBUG, "Nothing read\n"); - continue; - } - - if (len >= (sizeof(frame)/2)) { - ftdm_log(FTDM_LOG_CRIT, "Ignoring big read of %zd bytes!\n", len); - continue; - } - - if (ftdmchan->detected_tones[0]) { - int i; - - for (i = 1; i < FTDM_TONEMAP_INVALID; i++) { - if (ftdmchan->detected_tones[i]) { - ftdm_log(FTDM_LOG_DEBUG, "Detected tone %s on %d:%d\n", ftdm_tonemap2str(i), ftdmchan->span_id, ftdmchan->chan_id); - } - } - - if (ftdmchan->detected_tones[FTDM_TONEMAP_BUSY] || - ftdmchan->detected_tones[FTDM_TONEMAP_FAIL1] || - ftdmchan->detected_tones[FTDM_TONEMAP_FAIL2] || - ftdmchan->detected_tones[FTDM_TONEMAP_FAIL3] || - ftdmchan->detected_tones[FTDM_TONEMAP_ATTN] - ) { - ftdm_log(FTDM_LOG_ERROR, "Failure indication detected!\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else if (ftdmchan->detected_tones[FTDM_TONEMAP_RING]) { - if (!analog_data->answer_supervision) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ringing, but not answering since answer supervision is enabled\n"); - } - } - - ftdm_channel_clear_detected_tones(ftdmchan); - } - - if ((ftdmchan->dtmf_buffer && ftdm_buffer_inuse(ftdmchan->dtmf_buffer))) { - rlen = len; - memset(frame, 0, len); - ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen); - continue; - } - - if (analog_data->immediate_ringback && - (ftdmchan->state == FTDM_CHANNEL_STATE_COLLECT || - ftdmchan->state == FTDM_CHANNEL_STATE_RING || - ftdmchan->state == FTDM_CHANNEL_STATE_RINGING || - ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS || - ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA - )) { - indicate = 1; - if (!ringback_f) { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]); - } - } - - if (!indicate) { - continue; - } - - if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) { - len *= 2; - } - - if (ringback_f) { - uint8_t failed_read = 0; -read_try: - rlen = fread(frame, 1, len, ringback_f); - if (rlen != len) { - if (!feof(ringback_f)) { - ftdm_log(FTDM_LOG_ERROR, "Error reading from ringback file: %zd != %zd\n", rlen, len); - } - if (failed_read) { - continue; - } - /* return cursor to start of wav file */ - fseek(ringback_f, WAVE_HEADER_LEN, SEEK_SET); - failed_read++; - goto read_try; - } - } else { - rlen = ftdm_buffer_read_loop(dt_buffer, frame, len); - } - - if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) { - fio_codec_t codec_func = NULL; - - if (ftdmchan->native_codec == FTDM_CODEC_ULAW) { - codec_func = fio_slin2ulaw; - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW) { - codec_func = fio_slin2alaw; - } - - if (codec_func) { - codec_func(frame, sizeof(frame), &rlen); - } else { - ftdm_log(FTDM_LOG_ERROR, "codec error, no codec function for native codec %d!", ftdmchan->native_codec); - goto done; - } - } - - /* we must lock the channel and make sure we let our own generated audio thru (FTDM_ANALOG_EM_LOCAL_WRITE is tested in the ftdm_analog_em_sig_write handler)*/ - ftdm_channel_lock(ftdmchan); - ftdm_set_sflag(ftdmchan, FTDM_ANALOG_EM_LOCAL_WRITE); - ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen); - ftdm_clear_sflag(ftdmchan, FTDM_ANALOG_EM_LOCAL_WRITE); - ftdm_channel_unlock(ftdmchan); - } - - done: - - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL); - if (busy_timeout) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_CAS_BITS, &cas_bits); - if (cas_bits == 0XF) { - /* the remote end never sent any digits, neither moved to onhook, let's stay suspended */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Moving channel to suspended after timeout, remote end still offhook\n"); - analog_em_set_channel_sig_status_ex(ftdmchan, FTDM_SIG_STATE_SUSPENDED, FTDM_TRUE); - } - } - - closed_chan = ftdmchan; - ftdm_channel_close(&ftdmchan); - - ftdm_channel_command(closed_chan, FTDM_COMMAND_SET_NATIVE_CODEC, NULL); - - if (ts.buffer) { - teletone_destroy_session(&ts); - } - - if (dt_buffer) { - ftdm_buffer_destroy(&dt_buffer); - } - - if (ringback_f) { - fclose(ringback_f); - } - - ftdm_clear_flag(closed_chan, FTDM_CHANNEL_INTHREAD); - - ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM CHANNEL thread ended.\n"); - - return NULL; -} - -/** - * \brief Processes EM events coming from ftdmtel/dahdi - * \param span Span on which the event was fired - * \param event Event to be treated - * \return Success or failure - */ -static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event) -{ - ftdm_sigmsg_t sig; - int locked = 0; - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = event->channel->chan_id; - sig.span_id = event->channel->span_id; - sig.channel = event->channel; - - ftdm_unused_arg(span); - ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d:%d] STATE [%s]\n", - ftdm_oob_event2str(event->enum_id), event->channel->span_id, event->channel->chan_id, ftdm_channel_state2str(event->channel->state)); - - ftdm_mutex_lock(event->channel->mutex); - locked++; - - if (event->enum_id == FTDM_OOB_ONHOOK && ftdm_test_sflag(event->channel, FTDM_ANALOG_EM_REMOTE_SUSPEND)) { - /* We've got remote suspend, now we're back on hook, lift the remote suspend status */ - analog_em_set_channel_sig_status_ex(event->channel, FTDM_SIG_STATE_UP, FTDM_TRUE); - } - - if (ftdm_test_flag(event->channel, FTDM_CHANNEL_SUSPENDED)) { - ftdm_log(FTDM_LOG_WARNING, "Ignoring event %s on channel %d:%d in state %s, channel is suspended\n", - ftdm_oob_event2str(event->enum_id), event->channel->span_id, event->channel->chan_id, ftdm_channel_state2str(event->channel->state)); - goto done; - } - - switch(event->enum_id) { - case FTDM_OOB_ONHOOK: - { - if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN); - } - - } - break; - case FTDM_OOB_OFFHOOK: - { - if (ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD)) { - if (event->channel->state < FTDM_CHANNEL_STATE_UP) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_UP); - } - } else { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DIALTONE); - ftdm_mutex_unlock(event->channel->mutex); - locked = 0; - ftdm_thread_create_detached(ftdm_analog_em_channel_run, event->channel); - } - break; - } - case FTDM_OOB_WINK: - { - if (event->channel->state != FTDM_CHANNEL_STATE_DIALING) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN); - } else { - ftdm_set_flag_locked(event->channel, FTDM_CHANNEL_WINK); - } - - } - break; - } - -done: - - if (locked) { - ftdm_mutex_unlock(event->channel->mutex); - } - return FTDM_SUCCESS; -} - -/** - * \brief Main thread function for EM span (monitor) - * \param me Current thread - * \param obj Span to run in this thread - */ -static void *ftdm_analog_em_run(ftdm_thread_t *me, void *obj) -{ - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_analog_em_data_t *analog_data = span->signal_data; - - ftdm_unused_arg(me); - ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM thread starting.\n"); - analog_em_set_span_sig_status(span, FTDM_SIG_STATE_UP); - - while(ftdm_running() && ftdm_test_flag(analog_data, FTDM_ANALOG_EM_RUNNING)) { - int waitms = 10; - ftdm_status_t status; - - status = ftdm_span_poll_event(span, waitms, NULL); - - switch(status) { - case FTDM_SUCCESS: - { - ftdm_event_t *event; - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { - if (event->enum_id == FTDM_OOB_NOOP) { - continue; - } - if (process_event(span, event) != FTDM_SUCCESS) { - goto end; - } - } - } - break; - case FTDM_FAIL: - { - ftdm_log(FTDM_LOG_ERROR, "Failure Polling event! [%s]\n", span->last_error); - } - break; - default: - break; - } - - } - - end: - - ftdm_clear_flag(analog_data, FTDM_ANALOG_EM_RUNNING); - - ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM thread ending.\n"); - - return NULL; -} - -/** - * \brief FreeTDM analog EM module initialisation - * \return Success - */ -static FIO_SIG_LOAD_FUNCTION(ftdm_analog_em_init) -{ - return FTDM_SUCCESS; -} - -/** - * \brief FreeTDM analog EM module definition - */ -EX_DECLARE_DATA ftdm_module_t ftdm_module = { - "analog_em", - NULL, - NULL, - ftdm_analog_em_init, - ftdm_analog_em_configure_span, - NULL -}; - - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c deleted file mode 100755 index 0dbe1e647b..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ /dev/null @@ -1,1592 +0,0 @@ -/* - * Copyright (c) 2011, Sangoma Technologies - * All rights reserved. - * - Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Gideon Sadan - * Moises Silva - * - */ - - -#define _GNU_SOURCE - -#include -#include - -#ifndef __WINDOWS__ -#include -#include -#include -#endif - -#include -#include -#include -/*========================*/ - -#include -#include -#include - -#include - -/********************************************************************************/ -/* */ -/* MACROS */ -/* */ -/********************************************************************************/ -// Macro to send signals -#define SEND_STATE_SIGNAL(sig) \ - { \ - ftdm_sigmsg_t sigev; \ - memset(&sigev, 0, sizeof(sigev)); \ - sigev.event_id = sig; \ - sigev.channel = ftdmchan; \ - ftdm_span_send_signal(ftdmchan->span, &sigev); \ - } - -// Syntax message -#define FT_SYNTAX "USAGE:\n" \ -"--------------------------------------------------------------------------------\n" \ -"ftdm gsm version \n" \ -"ftdm gsm status \n" \ -"ftdm gsm sms \n" \ -"ftdm gsm exec \n" \ -"ftdm gsm call [number]\n" \ -"--------------------------------------------------------------------------------\n" - -// Used to declare command handler -#define COMMAND_HANDLER(name) \ - static ftdm_status_t gsm_cmd_##name(ftdm_stream_handle_t *stream, char *argv[], int argc); \ - ftdm_status_t gsm_cmd_##name(ftdm_stream_handle_t *stream, char *argv[], int argc) - -// Used to define command entry in the command map -#define COMMAND(name, argc) {#name, argc, gsm_cmd_##name} - -/********************************************************************************/ -/* */ -/* types */ -/* */ -/********************************************************************************/ - -typedef enum { - FTDM_GSM_RUNNING = (1 << 0), - FTDM_GSM_SPAN_STARTED = (1 << 1), -} ftdm_gsm_flag_t; - -// private data -typedef struct ftdm_gsm_span_data_s { - ftdm_span_t *span; - ftdm_channel_t *dchan; - ftdm_channel_t *bchan; - int32_t call_id; - uint32_t sms_id; - char conditional_forward_prefix[10]; - char conditional_forward_number[50]; - char immediate_forward_prefix[10]; - struct { - char number[50]; - char span[50]; - } immediate_forward_numbers[10]; - char disable_forward_number[50]; - ftdm_sched_t *sched; - ftdm_timer_id_t conditional_forwarding_timer; - ftdm_timer_id_t immediate_forwarding_timer; - ftdm_bool_t init_conditional_forwarding; - ftdm_bool_t startup_forwarding_disabled; - char startup_commands[20][50]; - ftdm_gsm_flag_t flags; - ftdm_bool_t sig_up; -} ftdm_gsm_span_data_t; - -// command handler function type. -typedef ftdm_status_t (*command_handler_t)(ftdm_stream_handle_t *stream, char *argv[], int argc); - -typedef struct ftdm_gsm_exec_helper { - ftdm_span_t *span; - ftdm_stream_handle_t *stream; - uint8_t cmd_pending; -} ftdm_gsm_exec_helper_t; - -/********************************************************************************/ -/* */ -/* function declaration */ -/* */ -/********************************************************************************/ -static ftdm_status_t init_wat_lib(void); -static int wat_lib_initialized = 0; -static FIO_API_FUNCTION(ftdm_gsm_api); - -/* ugh, wasteful since unlikely anyone will ever have more than 4 or 8 GSM spans, but we couldn't use ftdm_find_span() - * because during the stop sequence the internal span lock is held and we end up deadlocked, ideally libwat would just give - * us a pointer we provide instead of a span id */ -static ftdm_span_t * span_map[255] = { 0 }; - -/* wat callbacks */ -static int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len); - -static void on_wat_con_ind(unsigned char span_id, uint8_t call_id, wat_con_event_t *con_event); -static void on_wat_con_sts(unsigned char span_id, uint8_t call_id, wat_con_status_t *status); -static void on_wat_rel_ind(unsigned char span_id, uint8_t call_id, wat_rel_event_t *rel_event); -static void on_wat_rel_cfm(unsigned char span_id, uint8_t call_id); -static void on_wat_sms_ind(unsigned char span_id, wat_sms_event_t *sms_event); -static void on_wat_sms_sts(unsigned char span_id, uint8_t sms_id, wat_sms_status_t *status); - -static void on_wat_log(uint8_t level, char *fmt, ...); -static void *on_wat_malloc(size_t size); -static void *on_wat_calloc(size_t nmemb, size_t size); -static void on_wat_free(void *ptr); -static void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...); - -static ftdm_span_t *get_span_by_id(uint8_t span_id, ftdm_gsm_span_data_t **gsm_data); - -static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj); - -/********************************************************************************/ -/* */ -/* static & global data */ -/* */ -/********************************************************************************/ - -/* At the moment we support only one concurrent call per span, so no need to have different ids */ -#define GSM_OUTBOUND_CALL_ID 8 - -/* IO interface for the command API */ -static ftdm_io_interface_t g_ftdm_gsm_interface; - -/********************************************************************************/ -/* */ -/* implementation */ -/* */ -/********************************************************************************/ -static int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len) -{ - ftdm_span_t *span = NULL; - ftdm_status_t status = FTDM_FAIL; - ftdm_gsm_span_data_t *gsm_data = NULL; - ftdm_size_t outsize = len; - - status = ftdm_span_find(span_id, &span); - if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to find span %d to write %d bytes\n", span_id, len); - return -1; - } - - gsm_data = span->signal_data; - status = ftdm_channel_write(gsm_data->dchan, (void *)buffer, len, &outsize); - if (status != FTDM_SUCCESS) { - char errbuf[255]; - ftdm_log(FTDM_LOG_ERROR, "Failed to write %d bytes to d-channel in span %s: %s\n", len, span->name, strerror_r(errno, errbuf, sizeof(errbuf))); - return -1; - } - return len; -} - -static void ftdm_gsm_make_raw_call(ftdm_gsm_span_data_t *gsm_data, const char *number) -{ - wat_con_event_t con_event; - - ftdm_channel_lock(gsm_data->bchan); - - if (ftdm_test_flag(gsm_data->bchan, FTDM_CHANNEL_INUSE)) { - ftdm_log_chan(gsm_data->bchan, FTDM_LOG_ERROR, "Failed to place raw call to %s: channel busy\n", number); - goto done; - } - - ftdm_log_chan(gsm_data->bchan, FTDM_LOG_INFO, "Placing raw call to %s\n", number); - ftdm_set_flag(gsm_data->bchan, FTDM_CHANNEL_INUSE); - - gsm_data->call_id = GSM_OUTBOUND_CALL_ID; - memset(&con_event, 0, sizeof(con_event)); - ftdm_set_string(con_event.called_num.digits, number); - wat_con_req(gsm_data->span->span_id, gsm_data->call_id , &con_event); - -done: - ftdm_channel_unlock(gsm_data->bchan); -} - -static void ftdm_gsm_enable_conditional_forwarding(void *data) -{ - char number[255]; - ftdm_gsm_span_data_t *gsm_data = data; - snprintf(number, sizeof(number), "%s%s", gsm_data->conditional_forward_prefix, gsm_data->conditional_forward_number); - ftdm_log_chan(gsm_data->bchan, FTDM_LOG_INFO, "Enabling conditional forwarding to %s\n", number); - ftdm_gsm_make_raw_call(data, number); -} - -static void on_wat_span_status(unsigned char span_id, wat_span_status_t *status) -{ - ftdm_gsm_span_data_t *gsm_data = NULL; - ftdm_span_t *span = get_span_by_id(span_id, &gsm_data); - - switch (status->type) { - case WAT_SPAN_STS_READY: - { - int i = 0; - ftdm_log(FTDM_LOG_INFO, "span %s: Ready\n", span->name); - for (i = 0; !ftdm_strlen_zero_buf(gsm_data->startup_commands[i]); i++) { - ftdm_log(FTDM_LOG_INFO, "span %d: Executing startup command '%s'\n", span_id, gsm_data->startup_commands[i]); - if (WAT_SUCCESS != wat_cmd_req(span_id, gsm_data->startup_commands[i], NULL, NULL)) { - ftdm_log(FTDM_LOG_ERROR, "span %d: Failed requesting execution of command '%s'\n", span_id, gsm_data->startup_commands[i]); - } - } - } - break; - case WAT_SPAN_STS_SIGSTATUS: - { - if (status->sts.sigstatus == WAT_SIGSTATUS_UP) { - ftdm_log_chan_msg(gsm_data->bchan, FTDM_LOG_INFO, "Signaling is now up\n"); - gsm_data->sig_up = FTDM_TRUE; - } else { - ftdm_log_chan_msg(gsm_data->bchan, FTDM_LOG_INFO, "Signaling is now down\n"); - gsm_data->sig_up = FTDM_FALSE; - } - if (gsm_data->init_conditional_forwarding == FTDM_TRUE && !ftdm_strlen_zero_buf(gsm_data->conditional_forward_number)) { - ftdm_sched_timer(gsm_data->sched, "conditional_forwarding_delay", 1000, - ftdm_gsm_enable_conditional_forwarding, - gsm_data, - &gsm_data->conditional_forwarding_timer); - gsm_data->init_conditional_forwarding = FTDM_FALSE; - } - } - break; - case WAT_SPAN_STS_SIM_INFO_READY: - { - const wat_sim_info_t *sim_info = NULL; - ftdm_log(FTDM_LOG_INFO, "span %s: SIM information ready\n", span->name); - sim_info = wat_span_get_sim_info(span->span_id); - if (!ftdm_strlen_zero(sim_info->subscriber.digits)) { - ftdm_set_string(gsm_data->bchan->chan_number, sim_info->subscriber.digits); - } - } - break; - case WAT_SPAN_STS_ALARM: - { - ftdm_log(FTDM_LOG_INFO, "span %s: Alarm received\n", span->name); - } - break; - default: - { - ftdm_log(FTDM_LOG_INFO, "span %s: Unhandled span status notification %d\n", span->name, status->type); - } - break; - } -} - -static void on_wat_con_ind(uint8_t span_id, uint8_t call_id, wat_con_event_t *con_event) -{ - ftdm_span_t *span = NULL; - ftdm_gsm_span_data_t *gsm_data = NULL; - - ftdm_log(FTDM_LOG_INFO, "s%d: Incoming call (id:%d) Calling Number:%s Calling Name:\"%s\" type:%d plan:%d\n", span_id, call_id, con_event->calling_num.digits, con_event->calling_name, con_event->calling_num.type, con_event->calling_num.plan); - - span = get_span_by_id(span_id, &gsm_data); - - gsm_data->call_id = call_id; - - // cid name - ftdm_set_string(gsm_data->bchan->caller_data.cid_name, con_event->calling_name); - - // cid number - ftdm_set_string(gsm_data->bchan->caller_data.cid_num.digits, con_event->calling_num.digits); - - // destination number - ftdm_set_string(gsm_data->bchan->caller_data.dnis.digits, gsm_data->bchan->chan_number); - - ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_RING); - - if (ftdm_channel_open_chan(gsm_data->bchan) != FTDM_SUCCESS) { - ftdm_log_chan(gsm_data->bchan, FTDM_LOG_ERROR, "Failed to open GSM b-channel of span %s!\n", span->name); - } - -} - -static ftdm_span_t *get_span_by_id(unsigned char span_id, ftdm_gsm_span_data_t **gsm_data) -{ - ftdm_span_t *span = NULL; - - if (gsm_data) { - (*gsm_data) = NULL; - } - - span = span_map[span_id]; - if (gsm_data) { - (*gsm_data) = span->signal_data; - } - return span; -} - -static void on_wat_con_sts(unsigned char span_id, uint8_t call_id, wat_con_status_t *status) -{ - ftdm_span_t *span = NULL; - ftdm_channel_state_t state = FTDM_CHANNEL_STATE_END; - ftdm_gsm_span_data_t *gsm_data = NULL; - - if (!(span = get_span_by_id(span_id, &gsm_data))) { - return; - } - - switch (status->type) { - case WAT_CON_STATUS_TYPE_RINGING: - ftdm_log_chan_msg(gsm_data->bchan, FTDM_LOG_INFO, "Received ringing indication\n"); - state = FTDM_CHANNEL_STATE_RINGING; - break; - - case WAT_CON_STATUS_TYPE_ANSWER: - ftdm_log_chan_msg(gsm_data->bchan, FTDM_LOG_INFO, "Received answer indication\n"); - state = FTDM_CHANNEL_STATE_PROGRESS_MEDIA; - break; - - default: - ftdm_log_chan(gsm_data->bchan, FTDM_LOG_WARNING, "Unhandled indication status %d\n", status->type); - break; - - } - - if (state != FTDM_CHANNEL_STATE_END && gsm_data->bchan->state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state(gsm_data->bchan, state); - } -} - -static void on_wat_rel_ind(unsigned char span_id, uint8_t call_id, wat_rel_event_t *rel_event) -{ - ftdm_span_t *span = NULL; - ftdm_gsm_span_data_t *gsm_data = NULL; - - ftdm_log(FTDM_LOG_INFO, "s%d: Call hangup (id:%d) cause:%d\n", span_id, call_id, rel_event->cause); - - if (!(span = get_span_by_id(span_id, &gsm_data))) { - return; - } - - if (gsm_data->bchan->state == FTDM_CHANNEL_STATE_DOWN) { - /* This is most likely due to a call to enable call - * forwarding, which does not run the state machine */ - ftdm_clear_flag(gsm_data->bchan, FTDM_CHANNEL_INUSE); - wat_rel_req(span_id, call_id); - return; - } - - if (gsm_data->bchan->state > FTDM_CHANNEL_STATE_DOWN && - gsm_data->bchan->state < FTDM_CHANNEL_STATE_HANGUP) { - ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_HANGUP); - } -} - -static void on_wat_rel_cfm(unsigned char span_id, uint8_t call_id) -{ - ftdm_span_t *span = NULL; - ftdm_gsm_span_data_t *gsm_data = NULL; - - ftdm_log(FTDM_LOG_INFO, "s%d: Call hangup complete (id:%d)\n", span_id, call_id); - - if (!(span = get_span_by_id(span_id, &gsm_data))) { - return; - } - - if (gsm_data->bchan->state == FTDM_CHANNEL_STATE_DOWN) { - /* This is most likely due to a call to enable call - * forwarding, which does not run the state machine */ - ftdm_clear_flag(gsm_data->bchan, FTDM_CHANNEL_INUSE); - return; - } - - switch(gsm_data->dchan->state) { - case FTDM_CHANNEL_STATE_UP: - ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_HANGUP); - break; - default: - ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_DOWN); - break; - } -} - -static void on_wat_sms_ind(unsigned char span_id, wat_sms_event_t *sms_event) -{ - ftdm_span_t *span = NULL; - ftdm_channel_t *ftdmchan; - - ftdm_gsm_span_data_t *gsm_data = NULL; - - if(!(span = get_span_by_id(span_id, &gsm_data))) { - return; - } - - ftdmchan = gsm_data->dchan; - - { - ftdm_sms_data_t sms_data; - ftdm_sigmsg_t sigev; - memset(&sms_data, 0, sizeof(sms_data)); - - strncpy(sms_data.from, sms_event->from.digits, sizeof(sms_data.from)); - strncpy(sms_data.body, sms_event->content.data, sizeof(sms_data.body)); - - memset(&sigev, 0, sizeof(sigev)); - sigev.event_id = FTDM_SIGEVENT_SMS; - sigev.channel = ftdmchan ; - gsm_data->dchan->caller_data.priv = (void *)&sms_data; - ftdm_span_send_signal(span, &sigev); - } - return; -} - -static void on_wat_sms_sts(unsigned char span_id, uint8_t sms_id, wat_sms_status_t *status) -{ - if (status->success) { - ftdm_log(FTDM_LOG_INFO, "Span %d SMS Send - OK\n", span_id ); - } else { - ftdm_log(FTDM_LOG_CRIT, "Span %d SMS Send - FAIL (%s)\n", span_id, status->error); - } -} - -static void on_wat_dtmf_ind(unsigned char span_id, const char *dtmf) -{ - ftdm_span_t *span = NULL; - ftdm_gsm_span_data_t *gsm_data = NULL; - - if (!(span = get_span_by_id(span_id, &gsm_data))) { - return; - } - - ftdm_channel_queue_dtmf(gsm_data->bchan, dtmf); -} - - -static void on_wat_log(uint8_t level, char *fmt, ...) -{ - int ftdm_level; - char buff[4096]; - - va_list argptr; - va_start(argptr, fmt); - - switch(level) { - case WAT_LOG_CRIT: ftdm_level = FTDM_LOG_LEVEL_CRIT; break; - case WAT_LOG_ERROR: ftdm_level = FTDM_LOG_LEVEL_ERROR; break; - case WAT_LOG_WARNING: ftdm_level = FTDM_LOG_LEVEL_WARNING; break; - case WAT_LOG_INFO: ftdm_level = FTDM_LOG_LEVEL_INFO; break; - case WAT_LOG_NOTICE: ftdm_level = FTDM_LOG_LEVEL_NOTICE; break; - case WAT_LOG_DEBUG: ftdm_level = FTDM_LOG_LEVEL_DEBUG; break; - default: ftdm_level = FTDM_LOG_LEVEL_ERROR; break; - }; - - - vsprintf(buff, fmt, argptr); - - ftdm_log(FTDM_PRE, ftdm_level, "%s", buff); - - va_end(argptr); -} - - -static void *on_wat_malloc(size_t size) -{ - return ftdm_malloc(size); -} - -static void *on_wat_calloc(size_t nmemb, size_t size) -{ - return ftdm_calloc(nmemb, size); -} - -static void on_wat_free(void *ptr) -{ - ftdm_free(ptr); -} - -static void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...) -{ - ftdm_span_t *span = NULL; - ftdm_gsm_span_data_t *gsm_data = NULL; - int ftdm_level; - char buff[4096]; - va_list argptr; - - if (!(span = get_span_by_id(span_id, &gsm_data))) { - return; - } - - va_start(argptr, fmt); - - switch(level) { - case WAT_LOG_CRIT: ftdm_level = FTDM_LOG_LEVEL_CRIT; break; - case WAT_LOG_ERROR: ftdm_level = FTDM_LOG_LEVEL_ERROR; break; - case WAT_LOG_WARNING: ftdm_level = FTDM_LOG_LEVEL_WARNING; break; - case WAT_LOG_INFO: ftdm_level = FTDM_LOG_LEVEL_INFO; break; - case WAT_LOG_NOTICE: ftdm_level = FTDM_LOG_LEVEL_NOTICE; break; - case WAT_LOG_DEBUG: ftdm_level = FTDM_LOG_LEVEL_DEBUG; break; - default: ftdm_level = FTDM_LOG_LEVEL_ERROR; break; - }; - - vsprintf(buff, fmt, argptr); - - ftdm_log_chan_ex(gsm_data->bchan, __FILE__, __FTDM_FUNC__, __LINE__, ftdm_level, "%s", buff); - - va_end(argptr); -} - - -/* END wat callbacks */ - -/* span monitor thread */ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(gsm_outgoing_call) -{ - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_gsm_start(ftdm_span_t *span) -{ - ftdm_gsm_span_data_t *gsm_data = span->signal_data; - ftdm_set_flag(gsm_data, FTDM_GSM_SPAN_STARTED); - return ftdm_thread_create_detached(ftdm_gsm_run, span); -} - -static ftdm_status_t ftdm_gsm_stop(ftdm_span_t *span) -{ - ftdm_gsm_span_data_t *gsm_data = span->signal_data; - ftdm_clear_flag(gsm_data, FTDM_GSM_SPAN_STARTED); - while (ftdm_test_flag(gsm_data, FTDM_GSM_RUNNING)) { - ftdm_log(FTDM_LOG_DEBUG, "Waiting for GSM span %s\n", span->name); - ftdm_sleep(100); - } - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_gsm_destroy(ftdm_span_t *span) -{ - ftdm_gsm_span_data_t *gsm_data = span->signal_data; - ftdm_assert_return(gsm_data != NULL, FTDM_FAIL, "Span does not have GSM data!\n"); - if (gsm_data->sched) { - ftdm_sched_destroy(&gsm_data->sched); - } - ftdm_free(gsm_data); - return FTDM_SUCCESS; -} - -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_gsm_get_channel_sig_status) -{ - ftdm_gsm_span_data_t *gsm_data = ftdmchan->span->signal_data; - *status = gsm_data->sig_up ? FTDM_SIG_STATE_UP : FTDM_SIG_STATE_DOWN; - return FTDM_SUCCESS; -} - -static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_gsm_set_channel_sig_status) -{ - ftdm_log(FTDM_LOG_ERROR, "You cannot set the signaling status for GSM channels (%s)\n", ftdmchan->span->name); - return FTDM_FAIL; -} - -static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_gsm_get_span_sig_status) -{ - ftdm_gsm_span_data_t *gsm_data = span->signal_data; - *status = gsm_data->sig_up ? FTDM_SIG_STATE_UP : FTDM_SIG_STATE_DOWN; - return FTDM_SUCCESS; -} - -static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_gsm_set_span_sig_status) -{ - ftdm_log(FTDM_LOG_ERROR, "You cannot set the signaling status for GSM spans (%s)\n", span->name); - return FTDM_FAIL; -} - -static ftdm_state_map_t gsm_state_map = { - { - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - }, - - /* Outbound states */ - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_END} - }, - - - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END} - }, - } -}; - -#define immediate_forward_enabled(gsm_data) !ftdm_strlen_zero_buf(gsm_data->immediate_forward_numbers[0].number) - -static void perform_enable_immediate_forward(void *data) -{ - ftdm_span_t *fwd_span = NULL; - ftdm_gsm_span_data_t *fwd_gsm_data = NULL; - char *fwd_span_name = NULL; - char *number = NULL; - char cmd[100]; - int i = 0; - ftdm_channel_t *ftdmchan = data; - ftdm_gsm_span_data_t *gsm_data = ftdmchan->span->signal_data; - - for (i = 0; i < ftdm_array_len(gsm_data->immediate_forward_numbers); i++) { - fwd_span_name = gsm_data->immediate_forward_numbers[i].span; - fwd_span = NULL; - if (!ftdm_strlen_zero_buf(fwd_span_name) && - ftdm_span_find_by_name(fwd_span_name, &fwd_span) != FTDM_SUCCESS) { - continue; - } - fwd_gsm_data = fwd_span ? fwd_span->signal_data : NULL; - if (fwd_gsm_data && fwd_gsm_data->call_id) { - /* span busy, do not forward here */ - continue; - } - number = gsm_data->immediate_forward_numbers[i].number; - break; - } - - if (!number) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "No numbers available to enable immediate forwarding\n"); - return; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Enabling immediate forwarding to %s\n", number); - snprintf(cmd, sizeof(cmd), "ATD%s%s", gsm_data->immediate_forward_prefix, number); - wat_cmd_req(ftdmchan->span->span_id, cmd, NULL, NULL); -} - -static __inline__ void enable_immediate_forward(ftdm_channel_t *ftdmchan) -{ - ftdm_gsm_span_data_t *gsm_data = ftdmchan->span->signal_data; - ftdm_sched_timer(gsm_data->sched, "immediate_forwarding_delay", 1000, - perform_enable_immediate_forward, - ftdmchan, - &gsm_data->immediate_forwarding_timer); -} - -static __inline__ void disable_all_forwarding(ftdm_channel_t *ftdmchan) -{ - char cmd[100]; - ftdm_gsm_span_data_t *gsm_data = ftdmchan->span->signal_data; - - if (ftdm_strlen_zero_buf(gsm_data->disable_forward_number)) { - return; - } - - snprintf(cmd, sizeof(cmd), "ATD%s", gsm_data->disable_forward_number); - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Disabling GSM immediate forward dialing %s\n", gsm_data->disable_forward_number); - wat_cmd_req(ftdmchan->span->span_id, cmd, NULL, NULL); -} - -static ftdm_status_t ftdm_gsm_state_advance(ftdm_channel_t *ftdmchan) -{ - ftdm_gsm_span_data_t *gsm_data = ftdmchan->span->signal_data; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing GSM state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); - - ftdm_channel_complete_state(ftdmchan); - - switch (ftdmchan->state) { - - /* starting an outgoing call */ - case FTDM_CHANNEL_STATE_DIALING: - { - uint32_t interval = 0; - wat_con_event_t con_event; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting outgoing call with interval %d\n", interval); - - gsm_data->call_id = GSM_OUTBOUND_CALL_ID; - memset(&con_event, 0, sizeof(con_event)); - ftdm_set_string(con_event.called_num.digits, ftdmchan->caller_data.dnis.digits); - ftdm_log(FTDM_LOG_DEBUG, "Dialing number %s\n", con_event.called_num.digits); - wat_con_req(ftdmchan->span->span_id, gsm_data->call_id , &con_event); - - SEND_STATE_SIGNAL(FTDM_SIGEVENT_DIALING); - } - break; - - /* incoming call was offered */ - case FTDM_CHANNEL_STATE_RING: - { - /* notify the user about the new call */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Inbound call detected\n"); - SEND_STATE_SIGNAL(FTDM_SIGEVENT_START); - } - break; - - /* the call is making progress */ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - SEND_STATE_SIGNAL(FTDM_SIGEVENT_PROGRESS_MEDIA); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - } - break; - - /* the call was answered */ - case FTDM_CHANNEL_STATE_UP: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - SEND_STATE_SIGNAL(FTDM_SIGEVENT_UP); - } else { - wat_con_cfm(ftdmchan->span->span_id, gsm_data->call_id); - } - if (immediate_forward_enabled(gsm_data)) { - enable_immediate_forward(ftdmchan); - } - } - break; - - /* just got hangup */ - case FTDM_CHANNEL_STATE_HANGUP: - { - wat_rel_req(ftdmchan->span->span_id, gsm_data->call_id); - SEND_STATE_SIGNAL(FTDM_SIGEVENT_STOP); - } - break; - - /* finished call for good */ - case FTDM_CHANNEL_STATE_DOWN: - { - ftdm_channel_t *closed_chan; - gsm_data->call_id = 0; - closed_chan = ftdmchan; - ftdm_channel_close(&closed_chan); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "State processing ended.\n"); - SEND_STATE_SIGNAL(FTDM_SIGEVENT_STOP); - if (immediate_forward_enabled(gsm_data)) { - disable_all_forwarding(ftdmchan); - } - } - break; - - /* Outbound call is ringing */ - case FTDM_CHANNEL_STATE_RINGING: - { - SEND_STATE_SIGNAL(FTDM_SIGEVENT_RINGING); - } - break; - - case FTDM_CHANNEL_STATE_RESET: - { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - break; - - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state: %s\n", ftdm_channel_state2str(ftdmchan->state)); - } - break; - } - - return FTDM_SUCCESS; -} - -static ftdm_status_t init_wat_lib(void) -{ - wat_interface_t wat_interface; - - if (wat_lib_initialized) { - return FTDM_SUCCESS; - } - - ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); - - memset(&wat_interface, 0, sizeof(wat_interface)); - wat_interface.wat_span_write = on_wat_span_write; - - wat_interface.wat_log = on_wat_log; - wat_interface.wat_log_span = on_wat_log_span; - wat_interface.wat_malloc = on_wat_malloc; - wat_interface.wat_calloc = on_wat_calloc; - wat_interface.wat_free = on_wat_free; - - wat_interface.wat_con_ind = on_wat_con_ind; - wat_interface.wat_con_sts = on_wat_con_sts; - wat_interface.wat_rel_ind = on_wat_rel_ind; - wat_interface.wat_rel_cfm = on_wat_rel_cfm; - wat_interface.wat_sms_ind = on_wat_sms_ind; - wat_interface.wat_sms_sts = on_wat_sms_sts; - wat_interface.wat_span_sts = on_wat_span_status; - wat_interface.wat_dtmf_ind = on_wat_dtmf_ind; - - if (wat_register(&wat_interface)) { - ftdm_log(FTDM_LOG_DEBUG, "Failed registering interface to WAT library ...\n"); - return FTDM_FAIL; - } - - ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT library\n"); - - wat_lib_initialized = 1; - return FTDM_SUCCESS; -} - -WAT_AT_CMD_RESPONSE_FUNC(on_dtmf_sent) -{ - ftdm_channel_t *ftdmchan = obj; - ftdm_span_t *span = ftdmchan->span; - int i = 0; - - if (success == WAT_TRUE) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "DTMF successfully transmitted on span %s\n", span->name); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Command execution failed on span %s. Err: %s\n", span->name, error); - } - - for (i = 0; tokens[i]; i++) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "%s\n", tokens[i]); - } - return i; -} - -static ftdm_status_t ftdm_gsm_send_dtmf(ftdm_channel_t *ftdmchan, const char* dtmf) -{ - ftdm_gsm_span_data_t *gsm_data = ftdmchan->span->signal_data; - wat_send_dtmf(ftdmchan->span->span_id, gsm_data->call_id, dtmf, on_dtmf_sent, ftdmchan); - return FTDM_SUCCESS; -} - -static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) -{ - wat_span_config_t span_config; - ftdm_gsm_span_data_t *gsm_data = NULL; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *citer = NULL; - ftdm_channel_t *ftdmchan = NULL; - ftdm_channel_t *dchan = NULL; - ftdm_channel_t *bchan = NULL; - ftdm_bool_t hwdtmf_detect = FTDM_FALSE; - ftdm_bool_t hwdtmf_generate = FTDM_FALSE; - - unsigned paramindex = 0; - const char *var = NULL; - const char *val = NULL; - char schedname[255]; - int cmdindex = 0; - - int codec = FTDM_CODEC_SLIN; - int interval = 20; - - /* libwat is smart enough to set good default values for the timers if they are set to 0 */ - memset(&span_config, 0, sizeof(span_config)); - - /* set some span defaults */ - span_config.moduletype = WAT_MODULE_TELIT; - span_config.hardware_dtmf = WAT_FALSE; - - if (FTDM_SUCCESS != init_wat_lib()) { - return FTDM_FAIL; - } - - if (!sig_cb) { - ftdm_log(FTDM_LOG_ERROR, "No signaling callback provided\n"); - return FTDM_FAIL; - } - - if (span->signal_type) { - ftdm_log(FTDM_LOG_ERROR, "Span %s is already configured for another signaling\n", span->name); - return FTDM_FAIL; - } - - /* verify the span has one d-channel */ - chaniter = ftdm_span_get_chan_iterator(span, NULL); - - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - return FTDM_FAIL; - } - - citer = ftdm_span_get_chan_iterator(span, chaniter); - for ( ; citer; citer = ftdm_iterator_next(citer)) { - ftdmchan = ftdm_iterator_current(citer); - - if ((NULL == dchan) && FTDM_IS_DCHAN(ftdmchan)) { - dchan = ftdmchan; - } - if ((NULL == bchan) && FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - bchan = ftdmchan; - } - - } - ftdm_iterator_free(chaniter); - - if (!dchan) { - ftdm_log(FTDM_LOG_CRIT, "Could not find a d-channel for GSM span %s!\n", span->name); - return FTDM_FAIL; - } - if (!bchan) { - ftdm_log(FTDM_LOG_CRIT, "Could not find a b-channel for GSM span %s!\n", span->name); - return FTDM_FAIL; - } - - gsm_data = ftdm_calloc(1, sizeof(*gsm_data)); - if (!gsm_data) { - return FTDM_FAIL; - } - gsm_data->dchan = dchan; - gsm_data->bchan = bchan; - - cmdindex = 0; - for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { - var = ftdm_parameters[paramindex].var; - val = ftdm_parameters[paramindex].val; - if (ftdm_strlen_zero_buf(val)) { - ftdm_log(FTDM_LOG_WARNING, "Ignoring empty GSM parameter %s for span %s\n", var, span->name); - continue; - } - ftdm_log(FTDM_LOG_DEBUG, "Reading GSM parameter %s=%s for span %s\n", var, val, span->name); - if (!strcasecmp(var, "moduletype")) { - span_config.moduletype = wat_str2wat_moduletype(val); - if (span_config.moduletype == WAT_MODULE_INVALID) { - ftdm_log(FTDM_LOG_ERROR, "Unknown GSM module type %s for span %s\n", val, span->name); - continue; - } - ftdm_log(FTDM_LOG_DEBUG, "Configuring GSM span %s with moduletype %s\n", span->name, val); - } else if (!strcasecmp(var, "debug")) { - span_config.debug_mask = wat_str2debug(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring GSM span %s with debug mask %s == 0x%X\n", span->name, val, span_config.debug_mask); - } else if (!strcasecmp(var, "hwdtmf")) { - hwdtmf_detect = FTDM_FALSE; - hwdtmf_generate = FTDM_FALSE; - if (!strcasecmp(val, "generate")) { - hwdtmf_generate = FTDM_TRUE; - } else if (!strcasecmp(val, "detect")) { - hwdtmf_detect = FTDM_TRUE; - } else if (!strcasecmp(val, "both") || ftdm_true(val)) { - hwdtmf_detect = FTDM_TRUE; - hwdtmf_generate = FTDM_TRUE; - } else { - span_config.hardware_dtmf = WAT_FALSE; - } - ftdm_log(FTDM_LOG_DEBUG, "Configuring GSM span %s with hardware dtmf %s\n", span->name, val); - } else if (!strcasecmp(var, "conditional-forwarding-number")) { - ftdm_set_string(gsm_data->conditional_forward_number, val); - gsm_data->init_conditional_forwarding = FTDM_TRUE; - } else if (!strcasecmp(var, "conditional-forwarding-prefix")) { - ftdm_set_string(gsm_data->conditional_forward_prefix, val); - } else if (!strcasecmp(var, "immediate-forwarding-numbers")) { - char *state = NULL; - char *span_end = NULL; - char *number = NULL; - char *span_name = NULL; - int f = 0; - char *valdup = ftdm_strdup(val); - char *s = valdup; - - if (!ftdm_strlen_zero_buf(gsm_data->immediate_forward_numbers[0].number)) { - ftdm_log(FTDM_LOG_ERROR, "immediate-forwarding-numbers already parsed! failed to parse: %s\n", val); - goto ifn_parse_done; - } - - /* The string must be in the form [:], optionally multiple elements separated by comma */ - while ((number = strtok_r(s, ",", &state))) { - if (f == ftdm_array_len(gsm_data->immediate_forward_numbers)) { - ftdm_log(FTDM_LOG_ERROR, "Max number (%d) of immediate forwarding numbers reached!\n", f); - break; - } - - s = NULL; - span_end = strchr(number, ':'); - if (span_end) { - *span_end = '\0'; - span_name = number; - number = (span_end + 1); - ftdm_set_string(gsm_data->immediate_forward_numbers[f].span, span_name); - ftdm_log(FTDM_LOG_DEBUG, "Parsed immediate forwarding to span %s number %s\n", span_name, number); - } else { - ftdm_log(FTDM_LOG_DEBUG, "Parsed immediate forwarding to number %s\n", number); - } - ftdm_set_string(gsm_data->immediate_forward_numbers[f].number, number); - f++; - } -ifn_parse_done: - ftdm_safe_free(valdup); - } else if (!strcasecmp(var, "immediate-forwarding-prefix")) { - ftdm_set_string(gsm_data->immediate_forward_prefix, val); - } else if (!strcasecmp(var, "disable-forwarding-number")) { - ftdm_set_string(gsm_data->disable_forward_number, val); - } else if (!strcasecmp(var, "startup-command")) { - if (cmdindex < (ftdm_array_len(gsm_data->startup_commands) - 1)) { - ftdm_set_string(gsm_data->startup_commands[cmdindex], val); - ftdm_log(FTDM_LOG_DEBUG, "Adding startup command '%s' to GSM span %s\n", gsm_data->startup_commands[cmdindex], span->name); - cmdindex++; - } else { - ftdm_log(FTDM_LOG_ERROR, "Ignoring startup command '%s' ... max commands limit reached", val); - } - } else { - ftdm_log(FTDM_LOG_ERROR, "Ignoring unknown GSM parameter '%s'", var); - } - } - - /* Bind function pointers for control operations */ - span->start = ftdm_gsm_start; - span->stop = ftdm_gsm_stop; - span->destroy = ftdm_gsm_destroy; - span->sig_read = NULL; - span->sig_write = NULL; - if (hwdtmf_detect || hwdtmf_generate) { - span_config.hardware_dtmf = WAT_TRUE; - if (hwdtmf_generate) { - span->sig_send_dtmf = ftdm_gsm_send_dtmf; - } - if (hwdtmf_detect) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SIG_DTMF_DETECTION); - } - } - span->signal_cb = sig_cb; - span->signal_type = FTDM_SIGTYPE_GSM; - span->signal_data = gsm_data; - span->outgoing_call = gsm_outgoing_call; - span->get_span_sig_status = ftdm_gsm_get_span_sig_status; - span->set_span_sig_status = ftdm_gsm_set_span_sig_status; - span->get_channel_sig_status = ftdm_gsm_get_channel_sig_status; - span->set_channel_sig_status = ftdm_gsm_set_channel_sig_status; - - span->state_map = &gsm_state_map; - span->state_processor = ftdm_gsm_state_advance; - - /* use signals queue */ - ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); - ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); - - /* we can skip states (going straight from RING to UP) */ - ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); - - gsm_data->span = span; - span_map[span->span_id] = span; - - /* Setup the scheduler */ - snprintf(schedname, sizeof(schedname), "ftmod_gsm_%s", span->name); - if (ftdm_sched_create(&gsm_data->sched, schedname) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to setup scheduler for span %s!\n", span->name); - ftdm_gsm_destroy(span); - return FTDM_FAIL; - } - - /* Start the signaling stack */ - if (wat_span_config(span->span_id, &span_config)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to configure span %s for GSM signaling!!\n", span->name); - ftdm_gsm_destroy(span); - return FTDM_FAIL; - } - - ftdm_channel_command(gsm_data->bchan, FTDM_COMMAND_SET_NATIVE_CODEC, &codec); - ftdm_channel_command(gsm_data->bchan, FTDM_COMMAND_SET_CODEC, &codec); - ftdm_channel_command(gsm_data->bchan, FTDM_COMMAND_SET_INTERVAL, &interval); - - return FTDM_SUCCESS; - -} - -#define GSM_POLL_INTERVAL_MS 20 -static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) -{ - ftdm_channel_t *ftdmchan = NULL; - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_gsm_span_data_t *gsm_data = NULL; - ftdm_interrupt_t *data_sources[2] = {NULL, NULL}; - ftdm_wait_flag_t flags = FTDM_READ | FTDM_EVENTS; - ftdm_status_t status = FTDM_SUCCESS; - ftdm_alarm_flag_t alarms; - char buffer[1024] = { 0 }; - ftdm_size_t bufsize = 0; - int waitms = 0; - - gsm_data = span->signal_data; - ftdm_assert_return(gsm_data != NULL, NULL, "No gsm data attached to span\n"); - - /* as long as this thread is running, this flag is set */ - ftdm_set_flag(gsm_data, FTDM_GSM_RUNNING); - - ftdm_log(FTDM_LOG_DEBUG, "GSM monitor thread for span %s started\n", span->name); - if (!gsm_data->dchan || ftdm_channel_open_chan(gsm_data->dchan) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open GSM d-channel of span %s!\n", span->name); - gsm_data->dchan = NULL; - goto done; - } - - /* Do not start if the link layer is not ready yet */ - ftdm_channel_get_alarms(gsm_data->dchan, &alarms); - if (alarms != FTDM_ALARM_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Delaying initialization of span %s until alarms are cleared\n", span->name); - while (ftdm_running() && ftdm_test_flag(gsm_data, FTDM_GSM_SPAN_STARTED) && alarms != FTDM_ALARM_NONE) { - ftdm_channel_get_alarms(gsm_data->dchan, &alarms); - ftdm_sleep(100); - } - if (!ftdm_running() || !ftdm_test_flag(gsm_data, FTDM_GSM_SPAN_STARTED)) { - goto done; - } - } - - if (wat_span_start(span->span_id)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to start span %s!\n", span->name); - goto done; - } - - while (ftdm_running() && ftdm_test_flag(gsm_data, FTDM_GSM_SPAN_STARTED)) { - wat_span_run(span->span_id); - ftdm_sched_run(gsm_data->sched); - - waitms = wat_span_schedule_next(span->span_id); - if (waitms > GSM_POLL_INTERVAL_MS) { - waitms = GSM_POLL_INTERVAL_MS; - } - - flags = FTDM_READ | FTDM_EVENTS; - status = ftdm_channel_wait(gsm_data->dchan, &flags, waitms); - - /* check if this channel has a state change pending and process it if needed */ - ftdm_channel_lock(gsm_data->bchan); - ftdm_channel_advance_states(gsm_data->bchan); - - if (FTDM_SUCCESS == status && (flags & FTDM_READ)) { - bufsize = sizeof(buffer); - status = ftdm_channel_read(gsm_data->dchan, buffer, &bufsize); - if (status == FTDM_SUCCESS && bufsize > 0) { - wat_span_process_read(span->span_id, buffer, bufsize); - buffer[0] = 0; - } - } - - ftdm_channel_advance_states(gsm_data->bchan); - ftdm_channel_unlock(gsm_data->bchan); - - ftdm_span_trigger_signals(span); - - } - - if (wat_span_stop(span->span_id)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to stop GSM span %s!\n", span->name); - } - - if (wat_span_unconfig(span->span_id)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to unconfigure GSM span %s!\n", span->name); - } - -done: - if (data_sources[0]) { - ftdm_interrupt_destroy(&data_sources[0]); - } - - ftdm_log(FTDM_LOG_DEBUG, "GSM thread ending\n"); - ftdm_clear_flag(gsm_data, FTDM_GSM_RUNNING); - - return NULL; -} - - - -static FIO_IO_LOAD_FUNCTION(ftdm_gsm_io_init) -{ - assert(fio != NULL); - memset(&g_ftdm_gsm_interface, 0, sizeof(g_ftdm_gsm_interface)); - - g_ftdm_gsm_interface.name = "gsm"; - g_ftdm_gsm_interface.api = ftdm_gsm_api; - - *fio = &g_ftdm_gsm_interface; - - return (FTDM_SUCCESS); -} - -EX_DECLARE_DATA ftdm_module_t ftdm_module = { - /* .name */ "gsm", - /* .io_load */ ftdm_gsm_io_init, - /* .io_unload */ NULL, - /* .sig_load */ NULL, - /* .sig_configure */ NULL, - /* .sig_unload */ NULL, - /* .configure_span_signaling */ ftdm_gsm_configure_span_signaling -}; - -/********************************************************************************/ -/* */ -/* COMMAND HANDLERS */ -/* */ -/********************************************************************************/ - - -// Version Command Handler -COMMAND_HANDLER(version) -{ - uint8_t current = 0, revision = 0, age = 0; - wat_version(¤t, &revision, &age); - stream->write_function(stream, "libwat version: %d.%d.%d\n", current, revision, age); - stream->write_function(stream, "+OK.\n"); - return FTDM_SUCCESS; -} - - -// Status Command Handler -COMMAND_HANDLER(status) -{ - int span_id = 0; - ftdm_span_t *span = NULL; - const wat_chip_info_t *chip_info = NULL; - const wat_sim_info_t *sim_info = NULL; - const wat_net_info_t *net_info = NULL; - const wat_sig_info_t *sig_info = NULL; - wat_pin_stat_t pin_stat = 0; - - span_id = atoi(argv[0]); - if (ftdm_span_find_by_name(argv[0], &span) != FTDM_SUCCESS && ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR Failed to find GSM span '%s'\n", argv[1]); - return FTDM_FAIL; - } - - if (!span || !span->signal_data || (span->start != ftdm_gsm_start)) { - stream->write_function(stream, "-ERR '%s' is not a valid GSM span\n", argv[1]); - return FTDM_FAIL; - } - - chip_info = wat_span_get_chip_info(span->span_id); - sim_info = wat_span_get_sim_info(span->span_id); - net_info = wat_span_get_net_info(span->span_id); - sig_info = wat_span_get_sig_info(span->span_id); - - /* This is absolutely retarded and should be fixed in libwat - * why the hell would you return a pointer to an internal state enum instead of a copy? - * probably the same applies to the rest of the info (sim_info, chip_info, net_info, etc), - * but at least there you could have the lame excuse that you don't need to copy the whole struct */ - pin_stat = *wat_span_get_pin_info(span->span_id); - - stream->write_function(stream, "Span %d (%s):\n", span->span_id, span->name); - - stream->write_function(stream, "CHIP type - %s (%s), revision %s, serial %s \n", - chip_info->manufacturer, - chip_info->model, - chip_info->revision, - chip_info->serial); - - stream->write_function(stream, "SIM - Subscriber type %s, imsi %s\n", sim_info->subscriber_type, sim_info->imsi); - - stream->write_function(stream, "Subscriber - Number %s, Plan %s, validity %s\n", - sim_info->subscriber.digits, - wat_number_type2str(sim_info->subscriber.type), - wat_number_plan2str(sim_info->subscriber.plan), - wat_number_validity2str(sim_info->subscriber.validity)); - - stream->write_function(stream, "Network - status %s, Area Code %d, Cell ID %d, Operator %s\n", - wat_net_stat2str(net_info->stat), net_info->lac, net_info->ci, net_info->operator_name); - - - stream->write_function(stream, "Sig Info: rssi(%d) ber(%d)\n", sig_info->rssi, sig_info->ber); - - stream->write_function(stream, "PIN Status: %s\n", wat_pin_stat2str(pin_stat)); - - stream->write_function(stream, "\n"); - - stream->write_function(stream, "+OK.\n"); - - return FTDM_SUCCESS; -} - -// SMS Command Handler -COMMAND_HANDLER(sms) -{ - int span_id = 0, i; - uint32_t sms_id = 0; - ftdm_span_t *span = NULL; - wat_sms_event_t sms; - ftdm_gsm_span_data_t *gsm_data = NULL; - - span_id = atoi(argv[0]); - if (ftdm_span_find_by_name(argv[0], &span) != FTDM_SUCCESS && ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR Failed to find GSM span '%s'\n", argv[1]); - return FTDM_FAIL; - } - - if (!span || !span->signal_data || (span->start != ftdm_gsm_start)) { - stream->write_function(stream, "-ERR '%s' is not a valid GSM span\n", argv[1]); - return FTDM_FAIL; - } - gsm_data = span->signal_data; - - memset(&sms, 0, sizeof(sms)); - strcpy(sms.to.digits, argv[1]); - sms.type = WAT_SMS_TXT; - sms.content.data[0] = '\0'; - for(i=2;ibchan); - - sms_id = gsm_data->sms_id >= WAT_MAX_SMSS_PER_SPAN ? 0 : gsm_data->sms_id; - gsm_data->sms_id++; - - ftdm_channel_unlock(gsm_data->bchan); - - if (WAT_SUCCESS != wat_sms_req(span->span_id, sms_id, &sms)) { - stream->write_function(stream, "Failed to Send SMS \n"); - } else { - stream->write_function(stream, "SMS Sent.\n"); - } - return FTDM_SUCCESS; -} - -WAT_AT_CMD_RESPONSE_FUNC(gsm_exec_cb) -{ - ftdm_gsm_exec_helper_t *helper = (ftdm_gsm_exec_helper_t *)obj; - ftdm_stream_handle_t *stream = helper->stream; - ftdm_span_t *span = helper->span; - int i = 0; - - if (success == WAT_TRUE) { - stream->write_function(stream, "Command executed successfully on span %s\n", span->name); - } else { - stream->write_function(stream, "Command execution failed on span %s. Err: %s\n", span->name, error); - } - - for (i = 0; tokens[i]; i++) { - stream->write_function(stream, "%s\n", tokens[i]); - } - - helper->cmd_pending = 0; - return i; -} - -// AT Command Handler -COMMAND_HANDLER(exec) -{ - int span_id = 0; - int sanity = 100; - ftdm_span_t *span = NULL; - ftdm_gsm_exec_helper_t helper; - - span_id = atoi(argv[0]); - if (ftdm_span_find_by_name(argv[0], &span) != FTDM_SUCCESS && ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR Failed to find GSM span '%s'\n", argv[0]); - return FTDM_FAIL; - } - - if (!span || !span->signal_data || (span->start != ftdm_gsm_start)) { - stream->write_function(stream, "-ERR '%s' is not a valid GSM span\n", argv[0]); - return FTDM_FAIL; - } - - helper.stream = stream; - helper.span = span; - helper.cmd_pending = 1; - if (WAT_SUCCESS != wat_cmd_req(span->span_id, argv[1], gsm_exec_cb, &helper)) { - stream->write_function(stream, "Failed to send AT command on span %s\n", span->name); - } else { - stream->write_function(stream, "AT command sent on span %s\n", span->name); - } - - while (helper.cmd_pending && (--sanity > 0)) { - ftdm_sleep(100); - } - - if (sanity < 0) { - stream->write_function(stream, "Timed out waiting for respons for AT command on span %s\n", span->name); - } - return FTDM_SUCCESS; -} - -// AT Command Handler -COMMAND_HANDLER(call) -{ - int span_id = 0; - ftdm_span_t *span = NULL; - - span_id = atoi(argv[0]); - if (ftdm_span_find_by_name(argv[0], &span) != FTDM_SUCCESS && ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR Failed to find GSM span '%s'\n", argv[0]); - return FTDM_FAIL; - } - - if (!span || !span->signal_data || (span->start != ftdm_gsm_start)) { - stream->write_function(stream, "-ERR '%s' is not a valid GSM span\n", argv[0]); - return FTDM_FAIL; - } - - ftdm_gsm_make_raw_call(span->signal_data, argv[1]); - stream->write_function(stream, "+OK\n"); - return FTDM_SUCCESS; -} - -// command map -static struct { - const char *cmd; // command - int argc; // minimum args - command_handler_t handler; // handling function -} GSM_COMMANDS[] = { - COMMAND(version, 0), - COMMAND(status, 1), - COMMAND(sms, 3), - COMMAND(exec, 2), - COMMAND(call, 2), -}; - -// main command API entry point -static FIO_API_FUNCTION(ftdm_gsm_api) -{ - - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - int i; - ftdm_status_t status = FTDM_FAIL; - ftdm_status_t syntax = FTDM_FAIL; - - - if (data) { - mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - if (argc > 0) { - for (i = 0; i< ftdm_array_len(GSM_COMMANDS); i++) { - if (strcasecmp(argv[0], GSM_COMMANDS[i].cmd) == 0) { - if (argc -1 >= GSM_COMMANDS[i].argc) { - syntax = FTDM_SUCCESS; - status = GSM_COMMANDS[i].handler(stream, &argv[1], argc-1); - } - break; - } - } - } - - if (FTDM_SUCCESS != syntax) { - stream->write_function(stream, "%s", FT_SYNTAX); - } else if (FTDM_SUCCESS != status) { - stream->write_function(stream, "%s Command Failed\r\n", GSM_COMMANDS[i].cmd); - } - - ftdm_safe_free(mycmd); - - return FTDM_SUCCESS; -} - - -/* 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/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2008.vcproj deleted file mode 100644 index 0177d4246a..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2008.vcproj +++ /dev/null @@ -1,465 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj.filters deleted file mode 100644 index 30824888fc..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj.filters +++ /dev/null @@ -1,110 +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 - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c deleted file mode 100644 index fba15eaca2..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ /dev/null @@ -1,2927 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#endif - -#include "ftmod_isdn.h" - -#define LINE "--------------------------------------------------------------------------------" - -/* helper macros */ -#define FTDM_SPAN_IS_NT(x) (((ftdm_isdn_data_t *)(x)->signal_data)->mode == Q921_NT) - -#define DEFAULT_NATIONAL_PREFIX "0" -#define DEFAULT_INTERNATIONAL_PREFIX "00" - -/***************************************************************************************** - * PCAP - * Based on Helmut Kuper's () implementation, - * but using a different approach (needs a recent libpcap + wireshark) - *****************************************************************************************/ -#ifdef HAVE_PCAP -#include /* htons() */ -#include - -#define PCAP_SNAPLEN 1500 - -struct pcap_context { - pcap_dumper_t *dump; /*!< pcap file handle */ - pcap_t *handle; /*!< pcap lib context */ - char *filename; /*!< capture file name */ -}; - -static inline ftdm_status_t isdn_pcap_is_open(struct ftdm_isdn_data *isdn) -{ - return (isdn->pcap) ? 1 : 0; -} - -static inline ftdm_status_t isdn_pcap_capture_both(struct ftdm_isdn_data *isdn) -{ - return ((isdn->flags & (FTDM_ISDN_CAPTURE | FTDM_ISDN_CAPTURE_L3ONLY)) == FTDM_ISDN_CAPTURE) ? 1 : 0; -} - -static inline ftdm_status_t isdn_pcap_capture_l3only(struct ftdm_isdn_data *isdn) -{ - return ((isdn->flags & FTDM_ISDN_CAPTURE) && (isdn->flags & FTDM_ISDN_CAPTURE_L3ONLY)) ? 1 : 0; -} - -static ftdm_status_t isdn_pcap_open(struct ftdm_isdn_data *isdn, char *filename) -{ - struct pcap_context *pcap = NULL; - - if (!isdn || ftdm_strlen_zero(filename)) - return FTDM_FAIL; - - pcap = malloc(sizeof(struct pcap_context)); - if (!pcap) { - ftdm_log(FTDM_LOG_ERROR, "Failed to allocate isdn pcap context\n"); - return FTDM_FAIL; - } - - memset(pcap, 0, sizeof(struct pcap_context)); - - pcap->filename = strdup(filename); - - pcap->handle = pcap_open_dead(DLT_LINUX_LAPD, PCAP_SNAPLEN); - if (!pcap->handle) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open pcap handle\n"); - goto error; - } - - pcap->dump = pcap_dump_open(pcap->handle, pcap->filename); - if (!pcap->dump) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open capture file: '%s'\n", pcap_geterr(pcap->handle)); - goto error; - } - - ftdm_log(FTDM_LOG_INFO, "Capture file '%s' opened\n", pcap->filename); - - isdn->pcap = pcap; - - return FTDM_SUCCESS; -error: - if (pcap->handle) - pcap_close(pcap->handle); - if (pcap->filename) - free(pcap->filename); - - free(pcap); - - return FTDM_FAIL; -} - -static ftdm_status_t isdn_pcap_close(struct ftdm_isdn_data *isdn) -{ - struct pcap_context *pcap = NULL; - long size; - - if (!isdn || !isdn->pcap) - return FTDM_FAIL; - - pcap = isdn->pcap; - - isdn->flags &= ~(FTDM_ISDN_CAPTURE | FTDM_ISDN_CAPTURE_L3ONLY); - isdn->pcap = NULL; - - pcap_dump_flush(pcap->dump); - - size = pcap_dump_ftell(pcap->dump); - ftdm_log(FTDM_LOG_INFO, "File '%s' captured %ld bytes of data\n", pcap->filename, size); - - pcap_dump_close(pcap->dump); - pcap_close(pcap->handle); - - free(pcap->filename); - free(pcap); - - return FTDM_SUCCESS; -} - -static inline void isdn_pcap_start(struct ftdm_isdn_data *isdn) -{ - if (!isdn->pcap) - return; - - isdn->flags |= FTDM_ISDN_CAPTURE; -} - -static inline void isdn_pcap_stop(struct ftdm_isdn_data *isdn) -{ - isdn->flags &= ~FTDM_ISDN_CAPTURE; -} - -#ifndef ETH_P_LAPD -#define ETH_P_LAPD 0x0030 -#endif - -struct isdn_sll_hdr { - uint16_t slltype; - uint16_t sllhatype; - uint16_t slladdrlen; - uint8_t slladdr[8]; - uint16_t sllproto; -}; - -/* Fake Q.921 I-frame */ -//static const char q921_fake_frame[] = { 0x00, 0x00, 0x00, 0x00 }; - -enum { - ISDN_PCAP_INCOMING = 0, - ISDN_PCAP_INCOMING_BCAST = 1, - ISDN_PCAP_OUTGOING = 4, -}; - -static ftdm_status_t isdn_pcap_write(struct ftdm_isdn_data *isdn, unsigned char *buf, ftdm_ssize_t len, int direction) -{ - unsigned char frame[PCAP_SNAPLEN]; - struct pcap_context *pcap; - struct isdn_sll_hdr *sll_hdr = (struct isdn_sll_hdr *)frame; - struct pcap_pkthdr hdr; - int offset = sizeof(struct isdn_sll_hdr); - int nbytes; - - if (!isdn || !isdn->pcap || !buf || !len) - return FTDM_FAIL; - - pcap = isdn->pcap; - - /* Update SLL header */ - sll_hdr->slltype = htons(direction); - sll_hdr->sllhatype = 0; - sll_hdr->slladdrlen = 1; - sll_hdr->slladdr[0] = (isdn->mode == Q921_NT) ? 1 : 0; /* TODO: NT/TE */ - sll_hdr->sllproto = htons(ETH_P_LAPD); - -#if 0 - /* Q.931-only mode: copy fake Q.921 header */ - if (isdn->flags & FTDM_ISDN_CAPTURE_L3ONLY) { - /* copy fake q921 header */ - memcpy(frame + offset, q921_fake_frame, sizeof(q921_fake_frame)); - offset += sizeof(q921_fake_frame); - } -#endif - - /* Copy data */ - nbytes = (len > (PCAP_SNAPLEN - offset)) ? (PCAP_SNAPLEN - offset) : len; - memcpy(frame + offset, buf, nbytes); - - /* Update timestamp */ - memset(&hdr, 0, sizeof(struct pcap_pkthdr)); - gettimeofday(&hdr.ts, NULL); - hdr.caplen = offset + nbytes; - hdr.len = hdr.caplen; - - /* Write packet */ - pcap_dump((unsigned char *)pcap->dump, &hdr, frame); - - return FTDM_SUCCESS; -} -#endif /* HAVE_PCAP */ - - -static L2ULONG ftdm_time_now(void) -{ - return (L2ULONG)ftdm_current_time_in_ms(); -} - -/** - * \brief Returns the signalling status on a channel - * \param ftdmchan Channel to get status on - * \param status Pointer to set signalling status - * \return Success or failure - */ -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(isdn_get_channel_sig_status) -{ - *status = FTDM_SIG_STATE_DOWN; - - ftdm_isdn_data_t *isdn_data = ftdmchan->span->signal_data; - if (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { - *status = FTDM_SIG_STATE_UP; - } - return FTDM_SUCCESS; -} - -/** - * \brief Returns the signalling status on a span - * \param span Span to get status on - * \param status Pointer to set signalling status - * \return Success or failure - */ -static FIO_SPAN_GET_SIG_STATUS_FUNCTION(isdn_get_span_sig_status) -{ - *status = FTDM_SIG_STATE_DOWN; - - ftdm_isdn_data_t *isdn_data = span->signal_data; - if (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { - *status = FTDM_SIG_STATE_UP; - } - return FTDM_SUCCESS; -} - -/** - * \brief Create outgoing channel - * \param ftdmchan Channel to create outgoing call on - * \return Success or failure - */ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(isdn_outgoing_call) -{ - return FTDM_SUCCESS; -} - -/** - * \brief Create outgoing channel, let module select the channel to use - * \param span Span to create outgoing call on - * \param caller_data - * \return Success or failure - */ -#ifdef __TODO__ -static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) -{ -#if 1 /* FIXME caller_data.raw_data does not exist anymore, see docs/variables.txt for more info */ - Q931mes_Generic empty_gen; - Q931mes_Generic *gen = &empty_gen; - - memset(&empty_gen, 0, sizeof(empty_gen)) ; -#else - Q931mes_Generic *gen = (Q931mes_Generic *) caller_data->raw_data; -#endif - Q931ie_BearerCap BearerCap; - Q931ie_ChanID ChanID = { 0 }; - Q931ie_CallingNum CallingNum; - Q931ie_CallingNum *ptrCallingNum; - Q931ie_CalledNum CalledNum; - Q931ie_CalledNum *ptrCalledNum; - Q931ie_Display Display, *ptrDisplay; - Q931ie_HLComp HLComp; /* High-Layer Compatibility IE */ - Q931ie_ProgInd Progress; /* Progress Indicator IE */ - ftdm_status_t status = FTDM_FAIL; - ftdm_isdn_data_t *isdn_data = span->signal_data; - int sanity = 60000; - int codec = 0; - - /* - * get codec type - */ - ftdm_channel_command(span->channels[chan_id], FTDM_COMMAND_GET_NATIVE_CODEC, &codec); - - /* - * Q.931 Setup Message - */ - Q931InitMesGeneric(gen); - gen->MesType = Q931mes_SETUP; - gen->CRVFlag = 0; /* outgoing call */ - - /* - * Bearer Capability IE - */ - Q931InitIEBearerCap(&BearerCap); - BearerCap.CodStand = Q931_CODING_ITU; /* ITU-T = 0, ISO/IEC = 1, National = 2, Network = 3 */ - BearerCap.ITC = Q931_ITC_SPEECH; /* Speech */ - BearerCap.TransMode = 0; /* Circuit = 0, Packet = 1 */ - BearerCap.ITR = Q931_ITR_64K; /* 64k */ - BearerCap.Layer1Ident = 1; - BearerCap.UIL1Prot = (codec == FTDM_CODEC_ALAW) ? Q931_UIL1P_G711A : Q931_UIL1P_G711U; /* U-law = 2, A-law = 3 */ - gen->BearerCap = Q931AppendIE(gen, (L3UCHAR *) &BearerCap); - - /* - * Channel ID IE - */ - Q931InitIEChanID(&ChanID); - ChanID.IntType = FTDM_SPAN_IS_BRI(span) ? 0 : 1; /* PRI = 1, BRI = 0 */ - - if (!FTDM_SPAN_IS_NT(span)) { - ChanID.PrefExcl = (isdn_data->opts & FTDM_ISDN_OPT_SUGGEST_CHANNEL) ? 0 : 1; /* 0 = preferred, 1 exclusive */ - } else { - ChanID.PrefExcl = 1; /* always exclusive in NT-mode */ - } - - if (ChanID.IntType) { - ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ - ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)chan_id; - } else { - ChanID.InfoChanSel = (unsigned char)chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ - } - gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); - - /* - * Progress IE - */ - Q931InitIEProgInd(&Progress); - Progress.CodStand = Q931_CODING_ITU; /* 0 = ITU */ - Progress.Location = 0; /* 0 = User, 1 = Private Network */ - Progress.ProgDesc = 3; /* 1 = Not end-to-end ISDN */ - gen->ProgInd = Q931AppendIE(gen, (L3UCHAR *)&Progress); - - /* - * Display IE - */ - if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE) && FTDM_SPAN_IS_NT(span)) { - Q931InitIEDisplay(&Display); - Display.Size = Display.Size + (unsigned char)strlen(caller_data->cid_name); - gen->Display = Q931AppendIE(gen, (L3UCHAR *) &Display); - ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf); - ftdm_copy_string((char *)ptrDisplay->Display, caller_data->cid_name, strlen(caller_data->cid_name)+1); - } - - /* - * Calling Number IE - */ - Q931InitIECallingNum(&CallingNum); - CallingNum.TypNum = Q931_TON_UNKNOWN; - CallingNum.NumPlanID = Q931_NUMPLAN_E164; - CallingNum.PresInd = Q931_PRES_ALLOWED; - CallingNum.ScreenInd = Q931_SCREEN_USER_NOT_SCREENED; - CallingNum.Size = CallingNum.Size + (unsigned char)strlen(caller_data->cid_num.digits); - gen->CallingNum = Q931AppendIE(gen, (L3UCHAR *) &CallingNum); - ptrCallingNum = Q931GetIEPtr(gen->CallingNum, gen->buf); - ftdm_copy_string((char *)ptrCallingNum->Digit, caller_data->cid_num.digits, strlen(caller_data->cid_num.digits)+1); - - - /* - * Called number IE - */ - Q931InitIECalledNum(&CalledNum); - CalledNum.TypNum = Q931_TON_UNKNOWN; - CalledNum.NumPlanID = Q931_NUMPLAN_E164; - CalledNum.Size = CalledNum.Size + (unsigned char)strlen(caller_data->ani.digits); - gen->CalledNum = Q931AppendIE(gen, (L3UCHAR *) &CalledNum); - ptrCalledNum = Q931GetIEPtr(gen->CalledNum, gen->buf); - ftdm_copy_string((char *)ptrCalledNum->Digit, caller_data->ani.digits, strlen(caller_data->ani.digits)+1); - - /* - * High-Layer Compatibility IE (Note: Required for AVM FritzBox) - */ - Q931InitIEHLComp(&HLComp); - HLComp.CodStand = Q931_CODING_ITU; /* ITU */ - HLComp.Interpret = 4; /* only possible value */ - HLComp.PresMeth = 1; /* High-layer protocol profile */ - HLComp.HLCharID = 1; /* Telephony = 1, Fax G2+3 = 4, Fax G4 = 65 (Class I)/ 68 (Class II or III) */ - gen->HLComp = Q931AppendIE(gen, (L3UCHAR *) &HLComp); - - caller_data->call_state = FTDM_CALLER_STATE_DIALING; - Q931Rx43(&isdn_data->q931, gen, gen->Size); - - isdn_data->outbound_crv[gen->CRV] = caller_data; - //isdn_data->channels_local_crv[gen->CRV] = ftdmchan; - - while (ftdm_running() && caller_data->call_state == FTDM_CALLER_STATE_DIALING) { - ftdm_sleep(1); - - if (!--sanity) { - caller_data->call_state = FTDM_CALLER_STATE_FAIL; - break; - } - } - isdn_data->outbound_crv[gen->CRV] = NULL; - - if (caller_data->call_state == FTDM_CALLER_STATE_SUCCESS) { - ftdm_channel_t *new_chan = NULL; - int fail = 1; - - new_chan = NULL; - if (caller_data->chan_id > 0 && caller_data->chan_id <= ftdm_span_get_chan_count(span)) { - new_chan = ftdm_span_get_channel(span, caller_data->chan_id); - } - - if (new_chan && (status = ftdm_channel_open_chan(new_chan) == FTDM_SUCCESS)) { - if (ftdm_test_flag(new_chan, FTDM_CHANNEL_INUSE) || new_chan->state != FTDM_CHANNEL_STATE_DOWN) { - if (new_chan->state == FTDM_CHANNEL_STATE_DOWN || new_chan->state >= FTDM_CHANNEL_STATE_TERMINATING) { - int x = 0; - ftdm_log(FTDM_LOG_WARNING, "Channel %d:%d ~ %d:%d is already in use waiting for it to become available.\n"); - - for (x = 0; x < 200; x++) { - if (!ftdm_test_flag(new_chan, FTDM_CHANNEL_INUSE)) { - break; - } - ftdm_sleep(5); - } - } - if (ftdm_test_flag(new_chan, FTDM_CHANNEL_INUSE)) { - ftdm_log(FTDM_LOG_ERROR, "Channel %d:%d ~ %d:%d is already in use.\n", - new_chan->span_id, - new_chan->chan_id, - new_chan->physical_span_id, - new_chan->physical_chan_id - ); - new_chan = NULL; - } - } - - if (new_chan && new_chan->state == FTDM_CHANNEL_STATE_DOWN) { - struct Q931_Call *call = NULL; - - memset(&new_chan->caller_data, 0, sizeof(new_chan->caller_data)); - ftdm_set_flag(new_chan, FTDM_CHANNEL_OUTBOUND); - ftdm_set_state_locked(new_chan, FTDM_CHANNEL_STATE_DIALING); - - call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); - Q931CallSetPrivate(call, new_chan); - - switch(gen->MesType) { - case Q931mes_ALERTING: - new_chan->init_state = FTDM_CHANNEL_STATE_PROGRESS_MEDIA; - break; - case Q931mes_CONNECT: - new_chan->init_state = FTDM_CHANNEL_STATE_UP; - break; - default: - new_chan->init_state = FTDM_CHANNEL_STATE_PROGRESS; - break; - } - - fail = 0; - } - } - - if (!fail) { - *ftdmchan = new_chan; - return FTDM_SUCCESS; - } else { - Q931ie_Cause cause; - gen->MesType = Q931mes_DISCONNECT; - cause.IEId = Q931ie_CAUSE; - cause.Size = sizeof(Q931ie_Cause); - cause.CodStand = 0; - cause.Location = 1; - cause.Recom = 1; - //should we be casting here.. or do we need to translate value? - cause.Value = (unsigned char) FTDM_CAUSE_WRONG_CALL_STATE; - *cause.Diag = '\0'; - gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, gen, gen->Size); - - if (gen->CRV) { - Q931ReleaseCRV(&isdn_data->q931, gen->CRV); - } - - if (new_chan) { - ftdm_log(FTDM_LOG_CRIT, "Channel is busy\n"); - } else { - ftdm_log(FTDM_LOG_CRIT, "Failed to open channel for new setup message\n"); - } - } - } - - *ftdmchan = NULL; - return FTDM_FAIL; - -} -#endif /* __TODO__ */ - -static L3INT ftdm_isdn_931_err(void *pvt, L3INT id, L3INT p1, L3INT p2) -{ - ftdm_log(FTDM_LOG_ERROR, "ERROR: [%s] [%d] [%d]\n", q931_error_to_name(id), p1, p2); - return 0; -} - -/** - * \brief The new call event handler - * \note W000t!!! \o/ ;D - * \todo A lot - */ -static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent *event, void *priv) -{ - Q931_TrunkInfo_t *trunk = NULL; - ftdm_isdn_data_t *isdn_data = NULL; - ftdm_span_t *span = priv; - - assert(span); - assert(call); - assert(event); - - trunk = Q931CallGetTrunk(call); - assert(trunk); - - isdn_data = span->signal_data; - assert(isdn_data); - - if (Q931CallIsGlobal(call)) { - /* - * Global event - */ - ftdm_log(FTDM_LOG_DEBUG, "Received global event from Q.931\n"); - } else { - ftdm_channel_t *ftdmchan = NULL; - ftdm_sigmsg_t sig; - int call_crv = Q931CallGetCRV(call); - int type; - - /* - * Call-specific event - */ - ftdm_log(FTDM_LOG_DEBUG, "Received call-specific event from Q.931 for call %d [%hu]\n", Q931CallGetCRV(call), Q931CallGetCRV(call)); - - /* - * Try to get associated zap channel - * and init sigmsg struct if there is one - */ - ftdmchan = Q931CallGetPrivate(call); - if (ftdmchan) { - memset(&sig, 0, sizeof(ftdm_sigmsg_t)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - } - - type = Q931CallEventGetType(event); - - if (type == Q931_EVENT_TYPE_CRV) { - - ftdm_log(FTDM_LOG_DEBUG, "\tCRV event\n"); - - switch (Q931CallEventGetId(event)) { - case Q931_EVENT_RELEASE_CRV: - { - /* WARNING contains old interface code, yuck! */ - if (!ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "Call %d [0x%x] not associated to zap channel\n", call_crv, call_crv); - return; - } - - if (ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_DOWN && - ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_HANGUP_COMPLETE) - { - ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d not in DOWN state, cleaning up\n", - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan)); - - /* - * Send hangup signal to mod_freetdm - */ - if (!sig.channel->caller_data.hangup_cause) { - sig.channel->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; - } - - sig.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(ftdm_channel_get_span(ftdmchan), &sig); - - /* Release zap channel */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - return; - } - break; - default: - ftdm_log(FTDM_LOG_ERROR, "Unknown CRV event: %d\n", Q931CallEventGetId(event)); - return; - } - } - else if (type == Q931_EVENT_TYPE_TIMER) { - struct Q931_CallTimerEvent *timer_evt = Q931CallEventGetData(event); - - ftdm_log(FTDM_LOG_DEBUG, "\tTimer event\n"); - assert(timer_evt->id); - - switch (timer_evt->id) { - case Q931_TIMER_T303: - /* - * SETUP timeout - * - * TE-mode: Q931_EVENT_SETUP_CONFIRM (error) - * NT-mode: Q931_EVENT_RELEASE_INDICATION - */ - { - /* WARNING contains old interface code, yuck! */ - if (!ftdmchan) { - ftdm_log(FTDM_LOG_ERROR, "Call %d [0x%x] not associated to zap channel\n", call_crv, call_crv); - return; - } - - ftdm_log(FTDM_LOG_DEBUG, "Call setup failed on channel %d:%d\n", - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan)); - - /* - * Send signal to mod_freetdm - */ - sig.channel->caller_data.hangup_cause = FTDM_CAUSE_NETWORK_OUT_OF_ORDER; - - sig.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(ftdm_channel_get_span(ftdmchan), &sig); - - /* Release zap channel */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - return; - } - break; - - default: - ftdm_log(FTDM_LOG_ERROR, "Unhandled timer event %d\n", timer_evt->id); - } - } - else if (type == Q931_EVENT_TYPE_MESSAGE) { - struct Q931_CallMessageEvent *msg_evt = Q931CallEventGetData(event); - - ftdm_log(FTDM_LOG_DEBUG, "\tMessage event\n"); - assert(msg_evt); - - /* - * Slowly move stuff from the old event handler into this part... - */ - switch (Q931CallEventGetId(event)) { - case Q931_EVENT_SETUP_CONFIRM: - case Q931_EVENT_SETUP_COMPLETE_INDICATION: /* CONNECT */ - { - /* WARNING contains old interface code, yuck! */ - if (!ftdmchan) { - ftdm_log(FTDM_LOG_ERROR, "Call %d [0x%x] not associated to zap channel\n", call_crv, call_crv); - return; - } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - } - break; - - default: - ftdm_log(FTDM_LOG_DEBUG, "Not yet handled message event %d\n", Q931CallEventGetId(event)); - } - } - else { - ftdm_log(FTDM_LOG_ERROR, "Unknown event type %d\n", type); - } - } -} - -/** - * Copy callednum, readding prefix as needed - */ -static void __isdn_get_number(const char *digits, const int ton, char *buf, int size) -{ - int offset = 0; - - if (!digits || !buf || size <= 0) - return; - - switch (ton) { - case Q931_TON_NATIONAL: - offset = strlen(DEFAULT_NATIONAL_PREFIX); - memcpy(buf, DEFAULT_NATIONAL_PREFIX, offset); - break; - case Q931_TON_INTERNATIONAL: - offset = strlen(DEFAULT_INTERNATIONAL_PREFIX); - memcpy(buf, DEFAULT_INTERNATIONAL_PREFIX, offset); - break; - default: - break; - } - - strncpy(&buf[offset], digits, size - (offset + 1)); - buf[size - 1] = '\0'; -} - -#define isdn_get_number(num, buf) \ - __isdn_get_number((const char *)(num)->Digit, (num)->TypNum, (char *)buf, sizeof(buf)) - - -/** - * \brief The old call event handler (err, call message handler) - * \todo This one must die! - */ -static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic *msg, int mlen) -{ - Q931mes_Generic *gen = (Q931mes_Generic *) msg; - ftdm_span_t *span = (ftdm_span_t *) pvt; - ftdm_isdn_data_t *isdn_data = span->signal_data; - ftdm_channel_t *ftdmchan = NULL; - int chan_id = 0; - int chan_hunt = 0; - - if (Q931IsIEPresent(gen->ChanID)) { - Q931ie_ChanID *chanid = Q931GetIEPtr(gen->ChanID, gen->buf); - - if (chanid->IntType) - chan_id = chanid->ChanSlot; - else - chan_id = chanid->InfoChanSel; - - /* "any" channel specified */ - if (chanid->InfoChanSel == 3) { - chan_hunt++; - } - } else if (FTDM_SPAN_IS_NT(span)) { - /* no channel ie */ - chan_hunt++; - } - - assert(span != NULL); - assert(isdn_data != NULL); - - /* ftdm channel is stored in call private */ - if (call) { - ftdmchan = Q931CallGetPrivate(call); - if (!ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "[s%d] No channel associated to call [%#x] private\n", - ftdm_span_get_id(span), Q931CallGetCRV(call)); - } - } - - ftdm_log(FTDM_LOG_DEBUG, "Yay I got an event! Type:[%02x] Size:[%d] CRV: %d (%#hx, CTX: %s)\n", - gen->MesType, gen->Size, gen->CRV, gen->CRV, gen->CRVFlag ? "Terminator" : "Originator"); - -#ifdef __TODO__ - /* - * This code block is needed for isdn_channel_request() - * isdn_data->outbound_crv has been removed so another way to pass data around is required - */ - if (gen->CRVFlag && (caller_data = isdn_data->outbound_crv[gen->CRV])) { - if (chan_id) { - caller_data->chan_id = chan_id; - } - - switch(gen->MesType) { - case Q931mes_STATUS: - case Q931mes_CALL_PROCEEDING: - break; - case Q931mes_ALERTING: - case Q931mes_PROGRESS: - case Q931mes_CONNECT: - caller_data->call_state = FTDM_CALLER_STATE_SUCCESS; - break; - default: - caller_data->call_state = FTDM_CALLER_STATE_FAIL; - break; - } - - return 0; - } -#endif - ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %p (%d:%d) via CRV[%#hx]\n", - ftdmchan, - ((ftdmchan) ? ftdm_channel_get_span_id(ftdmchan) : -1), - ((ftdmchan) ? ftdm_channel_get_id(ftdmchan) : -1), - gen->CRV); - - if (gen->ProtDisc == 3) { - switch(gen->MesType) { - case Q931mes_SERVICE: - { - Q931ie_ChangeStatus *changestatus = Q931GetIEPtr(gen->ChangeStatus, gen->buf); - if (ftdmchan) { - switch (changestatus->NewStatus) { - case 0: /* change status to "in service" */ - { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_SUSPENDED); - ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d in service\n", - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan)); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - break; - case 1: - { /* change status to "maintenance" */ - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_SUSPENDED); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - break; - case 2: - { /* change status to "out of service" */ - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_SUSPENDED); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - break; - default: /* unknown */ - { - break; - } - } - } - } - break; - default: - break; - } - } else { - switch(gen->MesType) { - case Q931mes_RESTART: - { - if (chan_id) { - ftdmchan = ftdm_span_get_channel(span, chan_id); - } - if (ftdmchan) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } else { - uint32_t i; - - for (i = 1; i < ftdm_span_get_chan_count(span); i++) { - ftdmchan = ftdm_span_get_channel(span, chan_id); - - /* Skip channels that are down and D-Channels (#OpenZAP-39) */ - if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN || - ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_DQ921) - continue; - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - } - } - break; - case Q931mes_RELEASE: - case Q931mes_RELEASE_COMPLETE: - { - const char *what = gen->MesType == Q931mes_RELEASE ? "Release" : "Release Complete"; - if (ftdmchan) { - if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_TERMINATING || - ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_HANGUP) - { - if (gen->MesType == Q931mes_RELEASE) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - else if (gen->MesType == Q931mes_RELEASE_COMPLETE && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALTONE) { - /* Go DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - else if ((gen->MesType == Q931mes_RELEASE && ftdm_channel_get_state(ftdmchan) <= FTDM_CHANNEL_STATE_UP) || - (gen->MesType == Q931mes_RELEASE_COMPLETE && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALING)) { - - /* - * Don't keep inbound channels open if the remote side hangs up before we answered - */ - Q931ie_Cause *cause = Q931GetIEPtr(gen->Cause, gen->buf); - ftdm_sigmsg_t sig; - - memset(&sig, 0, sizeof(sig)); - sig.span_id = ftdm_channel_get_span_id(ftdmchan); - sig.chan_id = ftdm_channel_get_id(ftdmchan); - sig.channel = ftdmchan; - sig.channel->caller_data.hangup_cause = (cause) ? cause->Value : FTDM_CAUSE_NORMAL_UNSPECIFIED; - - sig.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(span, &sig); - - ftdm_log(FTDM_LOG_DEBUG, "Received %s in state %s, requested hangup for channel %d:%d\n", what, - ftdm_channel_get_state_str(ftdmchan), - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan)); - } else { - ftdm_log(FTDM_LOG_DEBUG, "Ignoring %s on channel %d in state %s\n", what, - ftdm_channel_get_id(ftdmchan), ftdm_channel_get_state_str(ftdmchan)); - } - } else { - ftdm_log(FTDM_LOG_CRIT, "Received %s with no matching channel %d\n", what, chan_id); - } - } - break; - case Q931mes_DISCONNECT: - { - if (ftdmchan) { - Q931ie_Cause *cause = Q931GetIEPtr(gen->Cause, gen->buf); - ftdmchan->caller_data.hangup_cause = cause->Value; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - } else { - ftdm_log(FTDM_LOG_CRIT, "Received Disconnect with no matching channel %d\n", chan_id); - } - } - break; - case Q931mes_ALERTING: - { - if (ftdmchan) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else { - ftdm_log(FTDM_LOG_CRIT, "Received Alerting with no matching channel %d\n", chan_id); - } - } - break; - case Q931mes_PROGRESS: - { - if (ftdmchan) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - } else { - ftdm_log(FTDM_LOG_CRIT, "Received Progress with no matching channel %d\n", chan_id); - } - } - break; - case Q931mes_CONNECT: -#if 0 /* Handled by new event code */ - { - if (ftdmchan) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - -#if 0 /* Auto-Ack is enabled, we actually don't need this */ - gen->MesType = Q931mes_CONNECT_ACKNOWLEDGE; - gen->CRVFlag = 0; /* outbound */ - Q931Rx43(&isdn_data->q931, gen, gen->Size); -#endif - } else { - ftdm_log(FTDM_LOG_CRIT, "Received Connect with no matching channel %d\n", chan_id); - } - } -#endif - break; - case Q931mes_SETUP: - { - Q931ie_CallingNum *callingnum = Q931GetIEPtr(gen->CallingNum, gen->buf); - Q931ie_CalledNum *callednum = Q931GetIEPtr(gen->CalledNum, gen->buf); - int overlap_dial = 0; - int fail_cause = 0; - int fail = 1; - - if (ftdmchan && ftdmchan == Q931CallGetPrivate(call)) { - ftdm_log(FTDM_LOG_INFO, "Duplicate SETUP message(?) for Channel %d:%d ~ %d:%d in state %s [ignoring]\n", - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), - ftdm_channel_get_ph_span_id(ftdmchan), - ftdm_channel_get_ph_id(ftdmchan), - ftdm_channel_get_state_str(ftdmchan)); - break; - } - - ftdmchan = NULL; - /* - * Channel selection for incoming calls: - */ - if (FTDM_SPAN_IS_NT(span) && chan_hunt) { - int x; - - /* - * In NT-mode with channel selection "any", - * try to find a free channel - */ - for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { - ftdm_channel_t *zc = ftdm_span_get_channel(span, x); - - if (!ftdm_test_flag(zc, FTDM_CHANNEL_INUSE) && ftdm_channel_get_state(zc) == FTDM_CHANNEL_STATE_DOWN) { - ftdmchan = zc; - break; - } - } - } - else if (!FTDM_SPAN_IS_NT(span) && chan_hunt) { - /* - * In TE-mode this ("any") is invalid - */ - fail_cause = FTDM_CAUSE_CHANNEL_UNACCEPTABLE; - - ftdm_log(FTDM_LOG_ERROR, "Invalid channel selection in incoming call (network side didn't specify a channel)\n"); - } - else { - /* - * Otherwise simply try to select the channel we've been told - * - * TODO: NT mode is abled to select a different channel if the one chosen - * by the TE side is already in use - */ - if (chan_id > 0 && chan_id < FTDM_MAX_CHANNELS_SPAN && chan_id <= ftdm_span_get_chan_count(span)) { - ftdmchan = ftdm_span_get_channel(span, chan_id); - } - else { - /* invalid channel id */ - fail_cause = FTDM_CAUSE_CHANNEL_UNACCEPTABLE; - - ftdm_log(FTDM_LOG_ERROR, "Invalid channel selection in incoming call (none selected or out of bounds)\n"); - } - } - - if (!callednum || ftdm_strlen_zero((char *)callednum->Digit)) { - if (FTDM_SPAN_IS_NT(span)) { - ftdm_log(FTDM_LOG_NOTICE, "No destination number found, assuming overlap dial\n"); - overlap_dial++; - } else { - ftdm_log(FTDM_LOG_ERROR, "No destination number found\n"); - ftdmchan = NULL; - } - } - - if (ftdmchan) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) || ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_DOWN) { - if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN || ftdm_channel_get_state(ftdmchan) >= FTDM_CHANNEL_STATE_TERMINATING) - { - int x = 0; - ftdm_log(FTDM_LOG_WARNING, "Channel %d:%d ~ %d:%d is already in use waiting for it to become available.\n", - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), - ftdm_channel_get_ph_span_id(ftdmchan), - ftdm_channel_get_ph_id(ftdmchan)); - - for (x = 0; x < 200; x++) { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - break; - } - ftdm_sleep(5); - } - } - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - ftdm_log(FTDM_LOG_ERROR, "Channel %d:%d ~ %d:%d is already in use.\n", - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), - ftdm_channel_get_ph_span_id(ftdmchan), - ftdm_channel_get_ph_id(ftdmchan)); - ftdmchan = NULL; - } - } - - if (ftdmchan && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); - - memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - - if (ftdmchan->call_data) { - memset(ftdmchan->call_data, 0, sizeof(ftdm_isdn_bchan_data_t)); - } - - /* copy number readd prefix as needed */ - isdn_get_number(callingnum, caller_data->cid_num.digits); - isdn_get_number(callingnum, caller_data->cid_name); - isdn_get_number(callingnum, caller_data->ani.digits); - - if (!overlap_dial) { - isdn_get_number(callednum, caller_data->dnis.digits); - } - - ftdmchan->caller_data.call_reference = gen->CRV; - Q931CallSetPrivate(call, ftdmchan); - - gen->CRVFlag = !(gen->CRVFlag); - - fail = 0; - } - } - - if (fail) { - Q931ie_Cause cause; - - gen->MesType = Q931mes_DISCONNECT; - gen->CRVFlag = 1; /* inbound call */ - - cause.IEId = Q931ie_CAUSE; - cause.Size = sizeof(Q931ie_Cause); - cause.CodStand = Q931_CODING_ITU; - cause.Location = 1; - cause.Recom = 1; - //should we be casting here.. or do we need to translate value? - cause.Value = (unsigned char)((fail_cause) ? fail_cause : FTDM_CAUSE_WRONG_CALL_STATE); - *cause.Diag = '\0'; - gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, gen, gen->Size); - - if (gen->CRV) { - Q931ReleaseCRV(&isdn_data->q931, gen->CRV); - } - - if (ftdmchan) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Channel is busy\n"); - } else { - ftdm_log(FTDM_LOG_CRIT, "Failed to open channel for new setup message\n"); - } - - } else { - Q931ie_ChanID ChanID; - - /* - * Update Channel ID IE - */ - Q931InitIEChanID(&ChanID); - ChanID.IntType = FTDM_SPAN_IS_BRI(ftdmchan->span) ? 0 : 1; /* PRI = 1, BRI = 0 */ - ChanID.PrefExcl = FTDM_SPAN_IS_NT(ftdmchan->span) ? 1 : 0; /* Exclusive in NT-mode = 1, Preferred otherwise = 0 */ - if (ChanID.IntType) { - ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ - ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); - } else { - ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ - } - gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); - - if (overlap_dial) { - Q931ie_ProgInd progress; - - /* - * Setup Progress indicator - */ - progress.IEId = Q931ie_PROGRESS_INDICATOR; - progress.Size = sizeof(Q931ie_ProgInd); - progress.CodStand = Q931_CODING_ITU; /* ITU */ - progress.Location = 1; /* private network serving the local user */ - progress.ProgDesc = 8; /* call is not end-to-end isdn = 1, in-band information available = 8 */ - gen->ProgInd = Q931AppendIE(gen, (L3UCHAR *) &progress); - - /* - * Send SETUP ACK - */ - gen->MesType = Q931mes_SETUP_ACKNOWLEDGE; - gen->CRVFlag = 1; /* inbound call */ - Q931Rx43(&isdn_data->q931, gen, gen->Size); - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALTONE); - } else { - /* - * Advance to RING state - */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - } - } - break; - - case Q931mes_CALL_PROCEEDING: - { - if (ftdmchan) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Received CALL PROCEEDING message for channel\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - } else { - ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING with no matching channel %d\n", chan_id); - } - } - break; - case Q931mes_CONNECT_ACKNOWLEDGE: - { - if (ftdmchan) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Received CONNECT_ACK message for channel\n"); - } else { - ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK with no matching channel %d\n", chan_id); - } - } - break; - - case Q931mes_INFORMATION: - { - if (ftdmchan) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Received INFORMATION message for channel\n"); - - if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALTONE) { - char digit = '\0'; - - /* - * overlap dial digit indication - */ - if (Q931IsIEPresent(gen->CalledNum)) { - ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->call_data; - Q931ie_CalledNum *callednum = Q931GetIEPtr(gen->CalledNum, gen->buf); - int pos; - - digit = callednum->Digit[strlen((char *)callednum->Digit) - 1]; - if (digit == '#') { - callednum->Digit[strlen((char *)callednum->Digit) - 1] = '\0'; - } - - /* TODO: make this more safe with strncat() */ - pos = strlen(ftdmchan->caller_data.dnis.digits); - strcat(&ftdmchan->caller_data.dnis.digits[pos], (char *)callednum->Digit); - - /* update timer */ - data->digit_timeout = ftdm_time_now() + isdn_data->digit_timeout; - - ftdm_log(FTDM_LOG_DEBUG, "Received new overlap digit (%s), destination number: %s\n", callednum->Digit, ftdmchan->caller_data.dnis.digits); - } - - if (Q931IsIEPresent(gen->SendComplete) || digit == '#') { - ftdm_log(FTDM_LOG_DEBUG, "Leaving overlap dial mode\n"); - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - } - } else { - ftdm_log(FTDM_LOG_CRIT, "Received INFORMATION message with no matching channel\n"); - } - } - break; - - default: - ftdm_log(FTDM_LOG_CRIT, "Received unhandled message %d (%#x)\n", (int)gen->MesType, (int)gen->MesType); - break; - } - } - - return 0; -} - -static int ftdm_isdn_921_23(void *pvt, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *msg, L2INT mlen) -{ - ftdm_span_t *span = pvt; - ftdm_isdn_data_t *isdn_data = span->signal_data; - int ret, offset = (ind == Q921_DL_DATA) ? 4 : 3; - char bb[4096] = ""; - - switch(ind) { - case Q921_DL_DATA: - case Q921_DL_UNIT_DATA: - print_hex_bytes(msg + offset, mlen - offset, bb, sizeof(bb)); - ftdm_log(FTDM_LOG_DEBUG, "READ %d\n%s\n%s\n\n", (int)mlen - offset, LINE, bb); -#ifdef HAVE_PCAP - if (isdn_pcap_capture_l3only(isdn_data)) { - isdn_pcap_write(isdn_data, msg, mlen, (ind == Q921_DL_UNIT_DATA) ? ISDN_PCAP_INCOMING_BCAST : ISDN_PCAP_INCOMING); - } -#endif - default: - ret = Q931Rx23(&isdn_data->q931, ind, tei, msg, mlen); - if (ret != 0) - ftdm_log(FTDM_LOG_DEBUG, "931 parse error [%d] [%s]\n", ret, q931_error_to_name(ret)); - break; - } - - return ((ret >= 0) ? 1 : 0); -} - -static int ftdm_isdn_921_21(void *pvt, L2UCHAR *msg, L2INT mlen) -{ - ftdm_span_t *span = (ftdm_span_t *) pvt; - ftdm_size_t len = (ftdm_size_t) mlen; - ftdm_isdn_data_t *isdn_data = span->signal_data; - - assert(span != NULL); - -#ifdef HAVE_PCAP - if (isdn_pcap_capture_both(isdn_data)) { - isdn_pcap_write(isdn_data, msg, mlen, ISDN_PCAP_OUTGOING); - } -#endif - return ftdm_channel_write(isdn_data->dchan, msg, len, &len) == FTDM_SUCCESS ? 0 : -1; -} - -static __inline__ void state_advance(ftdm_channel_t *ftdmchan) -{ - ftdm_span_t *span = ftdm_channel_get_span(ftdmchan); - ftdm_isdn_data_t *isdn_data = NULL; - ftdm_sigmsg_t sig; - ftdm_status_t status; - - Q931mes_Generic empty_gen; - Q931mes_Generic *gen = &empty_gen; - struct Q931_Call *call = NULL; - - Q931InitMesGeneric(gen); - - isdn_data = span->signal_data; - assert(isdn_data); - - call = Q931GetCallByCRV(&isdn_data->q931, ftdmchan->caller_data.call_reference); - if (call) { - gen->CRV = Q931CallGetCRV(call); - gen->CRVFlag = Q931CallGetDirection(call) == Q931_DIRECTION_INBOUND ? 1 : 0; - } - - ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), - ftdm_channel_get_state_str(ftdmchan)); - - memset(&sig, 0, sizeof(sig)); - sig.span_id = ftdm_channel_get_span_id(ftdmchan); - sig.chan_id = ftdm_channel_get_id(ftdmchan); - sig.channel = ftdmchan; - - /* Acknowledge channel state change */ - ftdm_channel_complete_state(ftdmchan); - - switch (ftdm_channel_get_state(ftdmchan)) { - case FTDM_CHANNEL_STATE_DOWN: - { - if (gen->CRV) { - Q931CallSetPrivate(call, NULL); - Q931ReleaseCRV(&isdn_data->q931, gen->CRV); - } - ftdmchan->caller_data.call_reference = 0; - ftdm_channel_close(&ftdmchan); - } - break; - case FTDM_CHANNEL_STATE_PROGRESS: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_PROGRESS; - if ((status = ftdm_span_send_signal(ftdm_channel_get_span(ftdmchan), &sig) != FTDM_SUCCESS)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } else { - gen->MesType = Q931mes_CALL_PROCEEDING; - - if (FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan))) { - Q931ie_ChanID ChanID; - - /* - * Set new Channel ID - */ - Q931InitIEChanID(&ChanID); - ChanID.IntType = FTDM_SPAN_IS_BRI(ftdm_channel_get_span(ftdmchan)) ? 0 : 1; /* PRI = 1, BRI = 0 */ - ChanID.PrefExcl = 1; /* always exclusive in NT-mode */ - - if (ChanID.IntType) { - ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ - ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); - } else { - ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ - } - gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); - } - - Q931Rx43(&isdn_data->q931, gen, gen->Size); - } - } - break; - case FTDM_CHANNEL_STATE_DIALTONE: - { - ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->call_data; - - if (data) { - data->digit_timeout = ftdm_time_now() + isdn_data->digit_timeout; - } - } - break; - case FTDM_CHANNEL_STATE_RING: - { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_START; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } - } - break; - case FTDM_CHANNEL_STATE_RESTART: - { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; - sig.event_id = FTDM_SIGEVENT_RESTART; - status = ftdm_span_send_signal(span, &sig); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - break; - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } else { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - return; - } - } - gen->MesType = Q931mes_ALERTING; - Q931Rx43(&isdn_data->q931, gen, gen->Size); - } - } - break; - case FTDM_CHANNEL_STATE_UP: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_UP; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } else { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - return; - } - } - - gen->MesType = Q931mes_CONNECT; - - Q931Rx43(&isdn_data->q931, gen, gen->Size); - } - } - break; - case FTDM_CHANNEL_STATE_DIALING: - if (!(isdn_data->opts & FTDM_ISDN_OPT_SUGGEST_CHANNEL)) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); - Q931ie_BearerCap BearerCap; - Q931ie_ChanID ChanID; - Q931ie_CallingNum CallingNum; - Q931ie_CallingNum *ptrCallingNum; - Q931ie_CalledNum CalledNum; - Q931ie_CalledNum *ptrCalledNum; - Q931ie_Display Display, *ptrDisplay; - Q931ie_HLComp HLComp; /* High-Layer Compatibility IE */ - Q931ie_ProgInd Progress; /* Progress Indicator IE */ - int codec = 0; - - /* - * get codec type - */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_NATIVE_CODEC, &codec); - - /* - * Q.931 Setup Message - */ - Q931InitMesGeneric(gen); - gen->MesType = Q931mes_SETUP; - gen->CRVFlag = 0; /* outbound(?) */ - - /* - * Bearer Capability IE - */ - Q931InitIEBearerCap(&BearerCap); - BearerCap.CodStand = Q931_CODING_ITU; /* ITU-T = 0, ISO/IEC = 1, National = 2, Network = 3 */ - BearerCap.ITC = Q931_ITC_SPEECH; /* Speech */ - BearerCap.TransMode = 0; /* Circuit = 0, Packet = 1 */ - BearerCap.ITR = Q931_ITR_64K; /* 64k = 16, Packet mode = 0 */ - BearerCap.Layer1Ident = 1; - BearerCap.UIL1Prot = (codec == FTDM_CODEC_ALAW) ? 3 : 2; /* U-law = 2, A-law = 3 */ - gen->BearerCap = Q931AppendIE(gen, (L3UCHAR *) &BearerCap); - - /* - * ChannelID IE - */ - Q931InitIEChanID(&ChanID); - ChanID.IntType = FTDM_SPAN_IS_BRI(ftdm_channel_get_span(ftdmchan)) ? 0 : 1; /* PRI = 1, BRI = 0 */ - ChanID.PrefExcl = FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan)) ? 1 : 0; /* Exclusive in NT-mode = 1, Preferred otherwise = 0 */ - if (ChanID.IntType) { - ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ - ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); - } else { - ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ - } - gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); - - /* - * Progress IE - */ - Q931InitIEProgInd(&Progress); - Progress.CodStand = Q931_CODING_ITU; /* 0 = ITU */ - Progress.Location = 0; /* 0 = User, 1 = Private Network */ - Progress.ProgDesc = 3; /* 1 = Not end-to-end ISDN */ - gen->ProgInd = Q931AppendIE(gen, (L3UCHAR *)&Progress); - - /* - * Display IE - */ - if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE) && FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan))) { - Q931InitIEDisplay(&Display); - Display.Size = Display.Size + (unsigned char)strlen(caller_data->cid_name); - gen->Display = Q931AppendIE(gen, (L3UCHAR *) &Display); - ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf); - ftdm_copy_string((char *)ptrDisplay->Display, caller_data->cid_name, strlen(caller_data->cid_name) + 1); - } - - /* - * CallingNum IE - */ - Q931InitIECallingNum(&CallingNum); - CallingNum.TypNum = caller_data->ani.type; - CallingNum.NumPlanID = Q931_NUMPLAN_E164; - CallingNum.PresInd = Q931_PRES_ALLOWED; - CallingNum.ScreenInd = Q931_SCREEN_USER_NOT_SCREENED; - CallingNum.Size = CallingNum.Size + (unsigned char)strlen(caller_data->cid_num.digits); - gen->CallingNum = Q931AppendIE(gen, (L3UCHAR *) &CallingNum); - ptrCallingNum = Q931GetIEPtr(gen->CallingNum, gen->buf); - ftdm_copy_string((char *)ptrCallingNum->Digit, caller_data->cid_num.digits, strlen(caller_data->cid_num.digits) + 1); - - /* - * CalledNum IE - */ - Q931InitIECalledNum(&CalledNum); - CalledNum.TypNum = Q931_TON_UNKNOWN; - CalledNum.NumPlanID = Q931_NUMPLAN_E164; - CalledNum.Size = CalledNum.Size + (unsigned char)strlen(caller_data->ani.digits); - gen->CalledNum = Q931AppendIE(gen, (L3UCHAR *) &CalledNum); - ptrCalledNum = Q931GetIEPtr(gen->CalledNum, gen->buf); - ftdm_copy_string((char *)ptrCalledNum->Digit, caller_data->ani.digits, strlen(caller_data->ani.digits) + 1); - - /* - * High-Layer Compatibility IE (Note: Required for AVM FritzBox) - */ - Q931InitIEHLComp(&HLComp); - HLComp.CodStand = Q931_CODING_ITU; /* ITU */ - HLComp.Interpret = 4; /* only possible value */ - HLComp.PresMeth = 1; /* High-layer protocol profile */ - HLComp.HLCharID = Q931_HLCHAR_TELEPHONY; /* Telephony = 1, Fax G2+3 = 4, Fax G4 = 65 (Class I)/ 68 (Class II or III) */ /* TODO: make accessible from user layer */ - gen->HLComp = Q931AppendIE(gen, (L3UCHAR *) &HLComp); - - Q931Rx43(&isdn_data->q931, gen, gen->Size); - - /* - * Support code for the new event handling system - * Remove this as soon as we have the new api to set up calls - */ - if (gen->CRV) { - call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); - if (call) { - ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); - - Q931CallSetPrivate(call, ftdmchan); - ftdmchan->caller_data.call_reference = gen->CRV; - } - } - } - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - { - /* reply RELEASE with RELEASE_COMPLETE message */ - if (ftdm_channel_get_last_state(ftdmchan) == FTDM_CHANNEL_STATE_HANGUP) { - gen->MesType = Q931mes_RELEASE_COMPLETE; - - Q931Rx43(&isdn_data->q931, gen, gen->Size); - } - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - break; - case FTDM_CHANNEL_STATE_HANGUP: - { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); - Q931ie_Cause cause; - - ftdm_log(FTDM_LOG_DEBUG, "Hangup: Call direction %s\n", - ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); - - cause.IEId = Q931ie_CAUSE; - cause.Size = sizeof(Q931ie_Cause); - cause.CodStand = Q931_CODING_ITU; /* ITU */ - cause.Location = 1; /* private network */ - cause.Recom = 1; /* */ - - /* - * BRI PTMP needs special handling here... - * TODO: cleanup / refine (see above) - */ - if (ftdm_channel_get_last_state(ftdmchan) == FTDM_CHANNEL_STATE_RING) { - /* - * inbound call [was: number unknown (= not found in routing state)] - * (in Q.931 spec terms: Reject request) - */ - if (!FTDM_SPAN_IS_NT(span)) { - gen->MesType = Q931mes_RELEASE_COMPLETE; /* TE mode: Reject call */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - gen->MesType = Q931mes_DISCONNECT; /* NT mode: Disconnect and wait */ - //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - } - - //cause.Value = (unsigned char) FTDM_CAUSE_UNALLOCATED; - cause.Value = (unsigned char) caller_data->hangup_cause; - *cause.Diag = '\0'; - gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, gen, gen->Size); - - /* we're done, release channel */ - ////ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - else if (ftdm_channel_get_last_state(ftdmchan) <= FTDM_CHANNEL_STATE_PROGRESS) { - /* - * just release all unanswered calls [was: inbound call, remote side hung up before we answered] - */ - gen->MesType = Q931mes_RELEASE; - - cause.Value = (unsigned char) caller_data->hangup_cause; - *cause.Diag = '\0'; - gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, gen, gen->Size); - - /* this will be triggered by the RELEASE_COMPLETE reply */ - /* ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); */ - } - else { - /* - * call connected, hangup - */ - gen->MesType = Q931mes_DISCONNECT; - - cause.Value = (unsigned char) caller_data->hangup_cause; - *cause.Diag = '\0'; - gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, gen, gen->Size); - } - } - break; - case FTDM_CHANNEL_STATE_TERMINATING: - { - ftdm_log(FTDM_LOG_DEBUG, "Terminating: Call direction %s\n", - ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); - - sig.event_id = FTDM_SIGEVENT_STOP; - status = ftdm_span_send_signal(span, &sig); - - gen->MesType = Q931mes_RELEASE; - Q931Rx43(&isdn_data->q931, gen, gen->Size); - } - default: - break; - } -} - -static __inline__ void check_state(ftdm_span_t *span) -{ - if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { - uint32_t j; - - ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - - for (j = 1; j <= ftdm_span_get_chan_count(span); j++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, j); - - if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_channel_lock(chan); - ftdm_clear_flag(chan, FTDM_CHANNEL_STATE_CHANGE); - state_advance(chan); - ftdm_channel_unlock(chan); - } - } - } -} - - -static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event) -{ - ftdm_alarm_flag_t alarmbits; - ftdm_sigmsg_t sig; - - memset(&sig, 0, sizeof(sig)); - sig.span_id = ftdm_channel_get_span_id(event->channel); - sig.chan_id = ftdm_channel_get_id(event->channel); - sig.channel = event->channel; - - ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d:%d] STATE [%s]\n", - ftdm_oob_event2str(event->enum_id), - ftdm_channel_get_span_id(event->channel), - ftdm_channel_get_id(event->channel), - ftdm_channel_get_state_str(event->channel)); - - switch (event->enum_id) { - case FTDM_OOB_ALARM_TRAP: - { - sig.event_id = FTDM_OOB_ALARM_TRAP; - if (ftdm_channel_get_state(event->channel) != FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); - } - ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); - ftdm_channel_get_alarms(event->channel, &alarmbits); - ftdm_span_send_signal(span, &sig); - - ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms [%s]\n", - ftdm_channel_get_span_id(event->channel), - ftdm_channel_get_id(event->channel), - ftdm_channel_get_ph_span_id(event->channel), - ftdm_channel_get_ph_id(event->channel), - ftdm_channel_get_last_error(event->channel)); - } - break; - case FTDM_OOB_ALARM_CLEAR: - { - sig.event_id = FTDM_OOB_ALARM_CLEAR; - ftdm_clear_flag(event->channel, FTDM_CHANNEL_SUSPENDED); - ftdm_channel_get_alarms(event->channel, &alarmbits); - ftdm_span_send_signal(span, &sig); - } - break; -#ifdef __BROKEN_BY_FREETDM_CONVERSION__ - case FTDM_OOB_DTMF: /* Taken from ozmod_analog, minus the CALLWAITING state handling */ - { - const char * digit_str = (const char *)event->data; - - if (digit_str) { - fio_event_cb_t event_callback = NULL; - - ftdm_channel_queue_dtmf(event->channel, digit_str); - if (span->event_callback) { - event_callback = span->event_callback; - } else if (event->channel->event_callback) { - event_callback = event->channel->event_callback; - } - - if (event_callback) { - event->channel->event_header.channel = event->channel; - event->channel->event_header.e_type = FTDM_EVENT_DTMF; - event->channel->event_header.data = (void *)digit_str; - event_callback(event->channel, &event->channel->event_header); - event->channel->event_header.e_type = FTDM_EVENT_NONE; - event->channel->event_header.data = NULL; - } - ftdm_safe_free(event->data); - } - } - break; -#endif - } - - return FTDM_SUCCESS; -} - - -static __inline__ void check_events(ftdm_span_t *span) -{ - ftdm_status_t status = ftdm_span_poll_event(span, 5, NULL); - - switch (status) { - case FTDM_SUCCESS: - { - ftdm_event_t *event; - - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { - if (event->enum_id == FTDM_OOB_NOOP) { - continue; - } - if (process_event(span, event) != FTDM_SUCCESS) { - break; - } - } - } - break; - case FTDM_FAIL: - { - ftdm_log(FTDM_LOG_DEBUG, "Event Failure! %d\n", ftdm_running()); - } - break; - default: - break; - } -} - - -static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map) -{ - ftdm_buffer_t *dt_buffer = ts->user_data; - int wrote; - - if (!dt_buffer) { - return -1; - } - - wrote = teletone_mux_tones(ts, map); - ftdm_buffer_write(dt_buffer, ts->buffer, wrote * 2); - return 0; -} - -static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) -{ - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_isdn_data_t *isdn_data = span->signal_data; - ftdm_buffer_t *dt_buffer = NULL; - teletone_generation_session_t ts = {{{{0}}}};; - unsigned char frame[1024]; - int x, interval; - - ftdm_log(FTDM_LOG_DEBUG, "ISDN tones thread starting.\n"); - ftdm_set_flag(isdn_data, FTDM_ISDN_TONES_RUNNING); - - if (ftdm_buffer_create(&dt_buffer, 1024, 1024, 0) != FTDM_SUCCESS) { - snprintf(isdn_data->dchan->last_error, sizeof(isdn_data->dchan->last_error), "memory error!"); - ftdm_log(FTDM_LOG_ERROR, "MEM ERROR\n"); - goto done; - } - ftdm_buffer_set_loops(dt_buffer, -1); - - /* get a tone generation friendly interval to avoid distortions */ - for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, x); - - if (ftdm_channel_get_type(chan) != FTDM_CHAN_TYPE_DQ921) { - ftdm_channel_command(chan, FTDM_COMMAND_GET_INTERVAL, &interval); - break; - } - } - if (!interval) { - interval = 20; - } - ftdm_log(FTDM_LOG_NOTICE, "Tone generating interval %d\n", interval); - - /* init teletone */ - teletone_init_session(&ts, 0, teletone_handler, dt_buffer); - ts.rate = 8000; - ts.duration = ts.rate; - - /* main loop */ - while (ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { - ftdm_wait_flag_t flags; - ftdm_status_t status; - int last_chan_state = 0; - int gated = 0; - L2ULONG now = ftdm_time_now(); - - /* - * check b-channel states and generate & send tones if neccessary - */ - for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, x); - ftdm_size_t len = sizeof(frame), rlen; - ftdm_isdn_bchan_data_t *data = chan->call_data; - - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_DQ921) { - continue; - } - - /* - * Generate tones based on current bchan state - * (Recycle buffer content if succeeding channels share the - * same state, this saves some cpu cycles) - */ - switch (ftdm_channel_get_state(chan)) { - case FTDM_CHANNEL_STATE_DIALTONE: - { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - - /* check overlap dial timeout first before generating tone */ - if (data && data->digit_timeout && data->digit_timeout <= now) { - if (strlen(caller_data->dnis.digits) > 0) { - ftdm_log(FTDM_LOG_DEBUG, "Overlap dial timeout, advancing to RING state\n"); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RING); - } else { - /* no digits received, hangup */ - ftdm_log(FTDM_LOG_DEBUG, "Overlap dial timeout, no digits received, going to HANGUP state\n"); - caller_data->hangup_cause = FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE; /* TODO: probably wrong cause value */ - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - data->digit_timeout = 0; - continue; - } - - if (last_chan_state != ftdm_channel_get_state(chan)) { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, span->tone_map[FTDM_TONEMAP_DIAL]); - last_chan_state = ftdm_channel_get_state(chan); - } - } - break; - - case FTDM_CHANNEL_STATE_RING: - { - if (last_chan_state != ftdm_channel_get_state(chan)) { - ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, span->tone_map[FTDM_TONEMAP_RING]); - last_chan_state = ftdm_channel_get_state(chan); - } - } - break; - - default: /* Not in a tone generating state, go to next round */ - continue; - } - - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - continue; - } - ftdm_log(FTDM_LOG_NOTICE, "Successfully opened channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - } - - flags = FTDM_READ; - - status = ftdm_channel_wait(chan, &flags, (gated) ? 0 : interval); - switch (status) { - case FTDM_FAIL: - continue; - - case FTDM_TIMEOUT: - gated = 1; - continue; - - default: - if (!(flags & FTDM_READ)) { - continue; - } - } - gated = 1; - - status = ftdm_channel_read(chan, frame, &len); - if (status != FTDM_SUCCESS || len <= 0) { - continue; - } - - /* - * Teletone operates on SLIN data (2 bytes per sample). - * Convert the length of non-SLIN codecs, so we read - * the right amount of samples from the buffer. - */ - if (chan->effective_codec != FTDM_CODEC_SLIN) { - len *= 2; - } - - /* seek to current offset */ - ftdm_buffer_seek(dt_buffer, data->offset); - - /* - * ftdm_channel_read() can read up to sizeof(frame) bytes - * (in certain situations). Avoid overflowing the stack (and smashing dt_buffer) - * if the codec is not slin and we had to double the length. - */ - len = ftdm_min(len, sizeof(frame)); - rlen = ftdm_buffer_read_loop(dt_buffer, frame, len); - - if (chan->effective_codec != FTDM_CODEC_SLIN) { - fio_codec_t codec_func = NULL; - - if (chan->native_codec == FTDM_CODEC_ULAW) { - codec_func = fio_slin2ulaw; - } else if (chan->native_codec == FTDM_CODEC_ALAW) { - codec_func = fio_slin2alaw; - } - - /* - * Convert SLIN to native format (a-law/u-law), - * input size is 2 bytes per sample, output size - * (after conversion) is one byte per sample - * (= max. half the input size). - */ - if (codec_func) { - status = codec_func(frame, sizeof(frame), &rlen); - } else { - snprintf(chan->last_error, sizeof(chan->last_error), "codec error!"); - goto done; - } - } - - if (ftdm_channel_write(chan, frame, sizeof(frame), &rlen) == FTDM_SUCCESS) { - /* - * Advance offset in teletone buffer by amount - * of data actually written to channel. - */ - if (chan->effective_codec != FTDM_CODEC_SLIN) { - data->offset += rlen << 1; /* Teletone buffer is in SLIN (= rlen * 2) */ - } else { - data->offset += rlen; - } - - /* Limit offset to [0..Rate(Samples/s)-1] in SLIN (2 bytes per sample) units. */ - data->offset %= (ts.rate << 1); - } - } - - /* - * sleep a bit if there was nothing to do - */ - if (!gated) { - ftdm_sleep(interval); - } - } - -done: - if (ts.buffer) { - teletone_destroy_session(&ts); - } - - if (dt_buffer) { - ftdm_buffer_destroy(&dt_buffer); - } - - ftdm_log(FTDM_LOG_DEBUG, "ISDN tone thread ended.\n"); - ftdm_clear_flag(isdn_data, FTDM_ISDN_TONES_RUNNING); - - return NULL; -} - -static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) -{ - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_isdn_data_t *isdn_data = span->signal_data; - unsigned char frame[1024]; - ftdm_size_t len = sizeof(frame); - int errs = 0; - -#ifdef WIN32 - timeBeginPeriod(1); -#endif - - ftdm_log(FTDM_LOG_DEBUG, "ISDN thread starting.\n"); - ftdm_set_flag(isdn_data, FTDM_ISDN_RUNNING); - - Q921Start(&isdn_data->q921); - Q931Start(&isdn_data->q931); - - while (ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { - ftdm_wait_flag_t flags = FTDM_READ; - ftdm_status_t status = ftdm_channel_wait(isdn_data->dchan, &flags, 100); - - Q921TimerTick(&isdn_data->q921); - Q931TimerTick(&isdn_data->q931); - check_state(span); - check_events(span); - - /* - * - */ - switch (status) { - case FTDM_FAIL: - { - ftdm_log(FTDM_LOG_ERROR, "D-Chan Read Error!\n"); - snprintf(span->last_error, sizeof(span->last_error), "D-Chan Read Error!"); - if (++errs == 10) { - isdn_data->dchan->state = FTDM_CHANNEL_STATE_UP; - goto done; - } - } - break; - case FTDM_TIMEOUT: - { - errs = 0; - } - break; - default: - { - if (flags & FTDM_READ) { - len = sizeof(frame); - if (ftdm_channel_read(isdn_data->dchan, frame, &len) != FTDM_SUCCESS) { - ftdm_log_chan_msg(isdn_data->dchan, FTDM_LOG_ERROR, "Failed to read from D-Channel\n"); - continue; - } - if (len > 0) { -#ifdef HAVE_PCAP - if (isdn_pcap_capture_both(isdn_data)) { - isdn_pcap_write(isdn_data, frame, len, ISDN_PCAP_INCOMING); - } -#endif - Q921QueueHDLCFrame(&isdn_data->q921, frame, (int)len); - Q921Rx12(&isdn_data->q921); - - /* Successful read, reset error counter */ - errs = 0; - } - } else { - ftdm_log(FTDM_LOG_DEBUG, "No Read FLAG!\n"); - } - } - break; - } - } - -done: - ftdm_channel_close(&isdn_data->dchan); - ftdm_clear_flag(isdn_data, FTDM_ISDN_RUNNING); - -#ifdef WIN32 - timeEndPeriod(1); -#endif -#ifdef HAVE_PCAP - if (isdn_pcap_is_open(isdn_data)) { - isdn_pcap_close(isdn_data); - } -#endif - ftdm_log(FTDM_LOG_DEBUG, "ISDN thread ended.\n"); - return NULL; -} - -static int q931_rx_32(void *pvt, Q921DLMsg_t ind, L3UCHAR tei, L3UCHAR *msg, L3INT mlen) -{ - ftdm_span_t *span = pvt; - ftdm_isdn_data_t *isdn_data = span->signal_data; - int offset = 4; - char bb[4096] = ""; - - switch(ind) { - case Q921_DL_UNIT_DATA: - offset = 3; - - case Q921_DL_DATA: - print_hex_bytes(msg + offset, mlen - offset, bb, sizeof(bb)); - ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n%s\n%s\n\n", (int)mlen - offset, LINE, bb); - break; - - default: - break; - } - -#ifdef HAVE_PCAP - if (isdn_pcap_capture_l3only(isdn_data)) { - isdn_pcap_write(isdn_data, msg, mlen, ISDN_PCAP_OUTGOING); - } -#endif - return Q921Rx32(&isdn_data->q921, ind, tei, msg, mlen); -} - -static int ftdm_isdn_q921_log(void *pvt, Q921LogLevel_t level, char *msg, L2INT size) -{ - ftdm_span_t *span = (ftdm_span_t *) pvt; - - ftdm_log("Span", "Q.921", span->span_id, (int)level, "%s", msg); - return 0; -} - -static L3INT ftdm_isdn_q931_log(void *pvt, Q931LogLevel_t level, const char *msg, L3INT size) -{ - ftdm_span_t *span = (ftdm_span_t *) pvt; - - ftdm_log("Span", "Q.931", span->span_id, (int)level, "%s", msg); - return 0; -} - -static ftdm_state_map_t isdn_state_map = { - { - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END} - }, - - /****************************************/ - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DIALTONE, FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALTONE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, - FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - }, - } -}; - -/** - * \brief Stop signalling on span - */ -static ftdm_status_t ftdm_isdn_stop(ftdm_span_t *span) -{ - ftdm_isdn_data_t *isdn_data = span->signal_data; - - if (!ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { - return FTDM_FAIL; - } - - ftdm_set_flag(isdn_data, FTDM_ISDN_STOP); - - while (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { - ftdm_sleep(100); - } - - while (ftdm_test_flag(isdn_data, FTDM_ISDN_TONES_RUNNING)) { - ftdm_sleep(100); - } - - return FTDM_SUCCESS; -} - -/** - * \brief Start signalling on span - */ -static ftdm_status_t ftdm_isdn_start(ftdm_span_t *span) -{ - ftdm_isdn_data_t *isdn_data = span->signal_data; - ftdm_status_t ret; - - if (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { - return FTDM_FAIL; - } - - ftdm_clear_flag(isdn_data, FTDM_ISDN_STOP); - ret = ftdm_thread_create_detached(ftdm_isdn_run, span); - - if (ret != FTDM_SUCCESS) { - return ret; - } - - if (FTDM_SPAN_IS_NT(span) && !(isdn_data->opts & FTDM_ISDN_OPT_DISABLE_TONES)) { - ret = ftdm_thread_create_detached(ftdm_isdn_tones_run, span); - } - return ret; -} - - -/*###################################################################* - * (text) value parsing / translation - *###################################################################*/ - -static int32_t parse_loglevel(const char *level) -{ - if (!level) - return -1; - - if (!strcasecmp(level, "debug")) { - return FTDM_LOG_LEVEL_DEBUG; - } else if (!strcasecmp(level, "info")) { - return FTDM_LOG_LEVEL_INFO; - } else if (!strcasecmp(level, "notice")) { - return FTDM_LOG_LEVEL_NOTICE; - } else if (!strcasecmp(level, "warning")) { - return FTDM_LOG_LEVEL_WARNING; - } else if (!strcasecmp(level, "error")) { - return FTDM_LOG_LEVEL_ERROR; - } else if (!strcasecmp(level, "alert")) { - return FTDM_LOG_LEVEL_ALERT; - } else if (!strcasecmp(level, "crit")) { - return FTDM_LOG_LEVEL_CRIT; - } else if (!strcasecmp(level, "emerg")) { - return FTDM_LOG_LEVEL_EMERG; - } else { - return -1; - } -} - -static int parse_opts(const char *in, uint32_t *flags) -{ - if (!in || !flags) - return -1; - - if (strstr(in, "suggest_channel")) { - *flags |= FTDM_ISDN_OPT_SUGGEST_CHANNEL; - } - if (strstr(in, "omit_display")) { - *flags |= FTDM_ISDN_OPT_OMIT_DISPLAY_IE; - } - if (strstr(in, "disable_tones")) { - *flags |= FTDM_ISDN_OPT_DISABLE_TONES; - } - - return 0; -} - -static int parse_dialect(const char *in, uint32_t *dialect) -{ - if (!in || !dialect) - return -1; - -#if __UNSUPPORTED__ - if (!strcasecmp(in, "national")) { - *dialect = Q931_Dialect_National; - return 0; - } - if (!strcasecmp(in, "dms")) { - *dialect = Q931_Dialect_DMS; - return 0; - } -#endif - if (!strcasecmp(in, "5ess")) { - *dialect = Q931_Dialect_5ESS; - return 0; - } - if (!strcasecmp(in, "dss1") || !strcasecmp(in, "euroisdn")) { - *dialect = Q931_Dialect_DSS1; - return 0; - } - if (!strcasecmp(in, "q931")) { - *dialect = Q931_Dialect_Q931; - return 0; - } - - return -1; -} - - -/*###################################################################* - * API commands - *###################################################################*/ - -static const char isdn_api_usage[] = -#ifdef HAVE_PCAP - "isdn capture [q931only]\n" - "isdn capture \n" -#endif - "isdn loglevel \n" - "isdn dump calls\n" - "isdn help"; - - -/** - * isdn_api - */ -static FIO_API_FUNCTION(isdn_api) -{ - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - - if (data) { - mycmd = strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - if (!argc || !strcasecmp(argv[0], "help")) { - stream->write_function(stream, "%s\n", isdn_api_usage); - goto done; - } - else if (!strcasecmp(argv[0], "dump")) { - ftdm_isdn_data_t *isdn_data = NULL; - ftdm_span_t *span = NULL; - int span_id = 0; - - /* dump calls */ - - if (argc < 3) { - stream->write_function(stream, "-ERR not enough arguments.\n"); - goto done; - } - - span_id = atoi(argv[1]); - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - isdn_data = span->signal_data; - } else { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - - if (!strcasecmp(argv[2], "calls")) { - /* dump all calls to log */ - Q931DumpAllCalls(&isdn_data->q931); - stream->write_function(stream, "+OK call information dumped to log\n"); - goto done; - } - } - else if (!strcasecmp(argv[0], "loglevel")) { - ftdm_isdn_data_t *isdn_data = NULL; - ftdm_span_t *span = NULL; - int span_id = 0; - int layer = 0; - int level = 0; - - /* loglevel [level] */ - - if (argc < 3) { - stream->write_function(stream, "-ERR not enough arguments.\n"); - goto done; - } - - span_id = atoi(argv[1]); - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - isdn_data = span->signal_data; - } else { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - - if (!strcasecmp(argv[2], "q921")) { - layer = 0x01; - } else if (!strcasecmp(argv[2], "q931")) { - layer = 0x02; - } else if (!strcasecmp(argv[2], "all")) { - layer = 0x03; - } else { - stream->write_function(stream, "-ERR invalid layer\n"); - goto done; - } - - if (argc > 3) { - /* set loglevel */ - if ((level = parse_loglevel(argv[3])) < 0) { - stream->write_function(stream, "-ERR invalid loglevel\n"); - goto done; - } - - if (layer & 0x01) { /* q921 */ - Q921SetLogLevel(&isdn_data->q921, (Q921LogLevel_t)level); - } - if (layer & 0x02) { /* q931 */ - Q931SetLogLevel(&isdn_data->q931, (Q931LogLevel_t)level); - } - stream->write_function(stream, "+OK loglevel set"); - } else { - /* get loglevel */ - if (layer & 0x01) { - stream->write_function(stream, "Q.921 loglevel: %s\n", - Q921GetLogLevelName(&isdn_data->q921)); - } - if (layer & 0x02) { - stream->write_function(stream, "Q.931 loglevel: %s\n", - Q931GetLogLevelName(&isdn_data->q931)); - } - stream->write_function(stream, "+OK"); - } - goto done; - } -#ifdef HAVE_PCAP - else if (!strcasecmp(argv[0], "capture")) { - ftdm_isdn_data_t *isdn_data = NULL; - ftdm_span_t *span = NULL; - int span_id = 0; - - /* capture [q931only] */ - /* capture */ - - if (argc < 3) { - stream->write_function(stream, "-ERR not enough arguments.\n"); - goto done; - } - - span_id = atoi(argv[1]); - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - isdn_data = span->signal_data; - } else { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - - if (!strcasecmp(argv[2], "start")) { - char *filename = NULL; - - if (argc < 4) { - stream->write_function(stream, "-ERR not enough parameters.\n"); - goto done; - } - - if (isdn_pcap_is_open(isdn_data)) { - stream->write_function(stream, "-ERR capture is already running.\n"); - goto done; - } - - filename = argv[3]; - - if (isdn_pcap_open(isdn_data, filename) != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR failed to open capture file.\n"); - goto done; - } - - if (argc > 4 && !strcasecmp(argv[4], "q931only")) { - isdn_data->flags |= FTDM_ISDN_CAPTURE_L3ONLY; - } - isdn_pcap_start(isdn_data); - - stream->write_function(stream, "+OK capture started.\n"); - goto done; - } - else if (!strcasecmp(argv[2], "stop")) { - - if (!isdn_pcap_is_open(isdn_data)) { - stream->write_function(stream, "-ERR capture is not running.\n"); - goto done; - } - - isdn_pcap_stop(isdn_data); - isdn_pcap_close(isdn_data); - - stream->write_function(stream, "+OK capture stopped.\n"); - goto done; - } - else if (!strcasecmp(argv[2], "suspend")) { - - if (!isdn_pcap_is_open(isdn_data)) { - stream->write_function(stream, "-ERR capture is not running.\n"); - goto done; - } - isdn_pcap_stop(isdn_data); - - stream->write_function(stream, "+OK capture suspended.\n"); - goto done; - } - else if (!strcasecmp(argv[2], "resume")) { - - if (!isdn_pcap_is_open(isdn_data)) { - stream->write_function(stream, "-ERR capture is not running.\n"); - goto done; - } - isdn_pcap_start(isdn_data); - - stream->write_function(stream, "+OK capture resumed.\n"); - goto done; - } - else { - stream->write_function(stream, "-ERR wrong action.\n"); - goto done; - } - } -#endif - else { - stream->write_function(stream, "-ERR invalid command.\n"); - } -done: - ftdm_safe_free(mycmd); - - return FTDM_SUCCESS; -} - -static int parse_mode(const char *mode) -{ - if (!mode) - return -1; - - if (!strcasecmp(mode, "user") || !strcasecmp(mode, "cpe")) { - return Q931_TE; - } - if (!strcasecmp(mode, "net") || !strcasecmp(mode, "network")) { - return Q931_NT; - } - - return -1; -} - -static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) -{ - Q931Dialect_t dialect = Q931_Dialect_National; - ftdm_channel_t *dchan = NULL; - ftdm_isdn_data_t *isdn_data; - int32_t digit_timeout = 0; - const char *tonemap = "us"; - int dchan_count = 0, bchan_count = 0; - int q921loglevel = -1; - int q931loglevel = -1; - uint32_t i; - - if (span->signal_type) { - ftdm_log(FTDM_LOG_ERROR, "Span is already configured for signalling [%d]\n", span->signal_type); - snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling [%d]", span->signal_type); - return FTDM_FAIL; - } - - if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1\n", ftdm_span_get_trunk_type_str(span)); - span->trunk_type = FTDM_TRUNK_T1; - } - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - - switch (ftdm_channel_get_type(chan)) { - case FTDM_CHAN_TYPE_DQ921: - if (dchan_count > 1) { - ftdm_log(FTDM_LOG_ERROR, "Span has more than 1 D-Channel!\n"); - snprintf(span->last_error, sizeof(span->last_error), "Span has more than 1 D-Channel!"); - return FTDM_FAIL; - } - - if (ftdm_channel_open(ftdm_span_get_id(span), i, &dchan) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", dchan_count, - ftdm_channel_get_span_id(dchan), ftdm_channel_get_id(dchan)); - dchan->state = FTDM_CHANNEL_STATE_UP; - } - - dchan_count++; - break; - - case FTDM_CHAN_TYPE_B: - bchan_count++; - break; - - default: - break; - } - } - if (!dchan_count) { - ftdm_log(FTDM_LOG_ERROR, "Span has no D-Channel!\n"); - snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channel!"); - return FTDM_FAIL; - } - if (!bchan_count) { - ftdm_log(FTDM_LOG_ERROR, "Span has no B-Channels!\n"); - snprintf(span->last_error, sizeof(span->last_error), "Span has no B-Channels!"); - return FTDM_FAIL; - } - - isdn_data = malloc(sizeof(*isdn_data)); - assert(isdn_data != NULL); - - memset(isdn_data, 0, sizeof(*isdn_data)); - dialect = Q931_Dialect_Q931; - - /* Use trunk_mode span parameter to set default */ - switch (ftdm_span_get_trunk_mode(span)) { - case FTDM_TRUNK_MODE_NET: - ftdm_log(FTDM_LOG_INFO, "Span '%s' [s%d] defaulting to NET mode\n", - ftdm_span_get_name(span), ftdm_span_get_id(span)); - isdn_data->mode = Q931_NT; - break; - default: - ftdm_log(FTDM_LOG_INFO, "Span '%s' [s%d] defaulting to USER mode\n", - ftdm_span_get_name(span), ftdm_span_get_id(span)); - isdn_data->mode = Q931_TE; - break; - } - - for (i = 0; ftdm_parameters[i].var; i++) { - const char *var = ftdm_parameters[i].var; - const char *val = ftdm_parameters[i].val; - - if (ftdm_strlen_zero(var)) { - ftdm_log(FTDM_LOG_WARNING, "Skipping variable with no name\n"); - continue; - } - - if (ftdm_strlen_zero(val)) { - ftdm_log(FTDM_LOG_ERROR, "Variable '%s' has no value\n", var); - return FTDM_FAIL; - } - - if (!strcasecmp(var, "mode")) { - if ((isdn_data->mode = parse_mode(val)) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown mode '%s'\n", val); - snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown mode [%s]!", val); - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "dialect")) { - if (parse_dialect(val, &dialect) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown dialect '%s'\n", val); - snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown dialect [%s]!", val); - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "opts")) { - if (parse_opts(val, &isdn_data->opts) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown options '%s'\n", val); - snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown options [%s]!", val); - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "tonemap")) { - tonemap = (const char *)val; - } else if (!strcasecmp(var, "digit_timeout")) { - digit_timeout = atoi(val); - if (digit_timeout < 3000 || digit_timeout > 30000) { - ftdm_log(FTDM_LOG_WARNING, "Digit timeout %d ms outside of range (3000 - 30000 ms), using default (10000 ms)\n", digit_timeout); - digit_timeout = DEFAULT_DIGIT_TIMEOUT; - } - } else if (!strcasecmp(var, "q921loglevel")) { - if ((q921loglevel = parse_loglevel(val)) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown loglevel '%s'\n", val); - snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown loglevel [%s]!", val); - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "q931loglevel")) { - if ((q931loglevel = parse_loglevel(val)) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown loglevel '%s'\n", val); - snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown loglevel [%s]!", val); - return FTDM_FAIL; - } - } else { - ftdm_log(FTDM_LOG_ERROR, "Unknown parameter '%s'\n", var); - snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); - return FTDM_FAIL; - } - } - - if (!digit_timeout) { - digit_timeout = DEFAULT_DIGIT_TIMEOUT; - } - - /* Check if modes match and log a message if they do not. Just to be on the safe side. */ - if (isdn_data->mode == Q931_TE && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET) { - ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for TE/CPE/USER mode, while port is running in NT/NET mode. You may want to check your 'trunk_mode' settings.\n", - ftdm_span_get_name(span)); - } - else if (isdn_data->mode == Q931_NT && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_CPE) { - ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for NT/NET mode, while port is running in TE/CPE/USER mode. You may want to check your 'trunk_mode' settings.\n", - ftdm_span_get_name(span)); - } - - /* allocate per b-chan data */ - if (isdn_data->mode == Q931_NT) { - ftdm_isdn_bchan_data_t *data; - - data = malloc(bchan_count * sizeof(ftdm_isdn_bchan_data_t)); - if (!data) { - return FTDM_FAIL; - } - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++, data++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - chan->call_data = data; - memset(data, 0, sizeof(ftdm_isdn_bchan_data_t)); - } - } - } - - isdn_data->dchan = dchan; - isdn_data->digit_timeout = digit_timeout; - - Q921_InitTrunk(&isdn_data->q921, - 0, - 0, - isdn_data->mode, - (ftdm_span_get_trunk_type(span) == FTDM_TRUNK_BRI_PTMP) ? Q921_PTMP : Q921_PTP, - 0, - ftdm_isdn_921_21, - (Q921Tx23CB_t)ftdm_isdn_921_23, - span, - span); - - Q921SetLogCB(&isdn_data->q921, &ftdm_isdn_q921_log, span); - Q921SetLogLevel(&isdn_data->q921, (Q921LogLevel_t)q921loglevel); - - Q931InitTrunk(&isdn_data->q931, - dialect, - isdn_data->mode, - span->trunk_type, - ftdm_isdn_931_34, - (Q931Tx32CB_t)q931_rx_32, - ftdm_isdn_931_err, - span, - span); - - Q931SetLogCB(&isdn_data->q931, &ftdm_isdn_q931_log, span); - Q931SetLogLevel(&isdn_data->q931, (Q931LogLevel_t)q931loglevel); - - /* Register new event hander CB */ - Q931SetCallEventCB(&isdn_data->q931, ftdm_isdn_call_event, span); - - /* TODO: hmm, maybe drop the "Trunk" prefix */ - Q931TrunkSetAutoRestartAck(&isdn_data->q931, 1); - Q931TrunkSetAutoConnectAck(&isdn_data->q931, 1); - Q931TrunkSetAutoServiceAck(&isdn_data->q931, 1); - Q931TrunkSetStatusEnquiry(&isdn_data->q931, 0); - - span->state_map = &isdn_state_map; - span->signal_data = isdn_data; - span->signal_type = FTDM_SIGTYPE_ISDN; - span->signal_cb = sig_cb; - span->start = ftdm_isdn_start; - span->stop = ftdm_isdn_stop; - span->outgoing_call = isdn_outgoing_call; - - span->get_channel_sig_status = isdn_get_channel_sig_status; - span->get_span_sig_status = isdn_get_span_sig_status; - -#ifdef __TODO__ - if ((isdn_data->opts & FTDM_ISDN_OPT_SUGGEST_CHANNEL)) { - span->channel_request = isdn_channel_request; - span->flags |= FTDM_SPAN_SUGGEST_CHAN_ID; - } -#endif - ftdm_span_load_tones(span, tonemap); - - return FTDM_SUCCESS; -} - -/** - * ISDN module io interface - * \note This is really ugly... - */ -static ftdm_io_interface_t isdn_interface = { - .name = "isdn", - .api = isdn_api -}; - -/** - * \brief ISDN module io interface init callback - */ -static FIO_IO_LOAD_FUNCTION(isdn_io_load) -{ - assert(fio != NULL); - - *fio = &isdn_interface; - - return FTDM_SUCCESS; -} - -/** - * \brief ISDN module load callback - */ -static FIO_SIG_LOAD_FUNCTION(isdn_load) -{ - Q931Initialize(); - - Q921SetGetTimeCB(ftdm_time_now); - Q931SetGetTimeCB(ftdm_time_now); - - return FTDM_SUCCESS; -} - -/** - * \brief ISDN module shutdown callback - */ -static FIO_SIG_UNLOAD_FUNCTION(isdn_unload) -{ - return FTDM_SUCCESS; -}; - -ftdm_module_t ftdm_module = { - .name = "isdn", - .io_load = isdn_io_load, - .io_unload = NULL, - .sig_load = isdn_load, - .sig_unload = isdn_unload, - .configure_span_signaling = isdn_configure_span -}; - -/* 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 expandtab: - */ diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h deleted file mode 100644 index 378f901320..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FTDM_ISDN_H -#define FTDM_ISDN_H - -#define DEFAULT_DIGIT_TIMEOUT 10000 /* default overlap timeout: 10 seconds */ - - -typedef enum { - FTDM_ISDN_OPT_NONE = 0, - FTDM_ISDN_OPT_SUGGEST_CHANNEL = (1 << 0), - FTDM_ISDN_OPT_OMIT_DISPLAY_IE = (1 << 1), /*!< Do not send Caller name in outgoing SETUP message (= Display IE) */ - FTDM_ISDN_OPT_DISABLE_TONES = (1 << 2), /*!< Disable tone generating thread (NT mode) */ - - FTDM_ISDN_OPT_MAX = (2 << 0) -} ftdm_isdn_opts_t; - -typedef enum { - FTDM_ISDN_RUNNING = (1 << 0), - FTDM_ISDN_TONES_RUNNING = (1 << 1), - FTDM_ISDN_STOP = (1 << 2), - - FTDM_ISDN_CAPTURE = (1 << 3), - FTDM_ISDN_CAPTURE_L3ONLY = (1 << 4) -} ftdm_isdn_flag_t; - -#ifdef HAVE_PCAP -struct pcap_context; -#endif - -struct ftdm_isdn_data { - Q921Data_t q921; - Q931_TrunkInfo_t q931; - ftdm_channel_t *dchan; - uint32_t flags; - int32_t mode; - int32_t digit_timeout; - ftdm_isdn_opts_t opts; -#ifdef HAVE_PCAP - struct pcap_context *pcap; -#endif -}; - -typedef struct ftdm_isdn_data ftdm_isdn_data_t; - - -/* b-channel private data */ -struct ftdm_isdn_bchan_data -{ - ftdm_time_t digit_timeout; - int offset; /* offset in teletone buffer */ -}; - -typedef struct ftdm_isdn_bchan_data ftdm_isdn_bchan_data_t; - - -#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 expandtab: - */ - diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c deleted file mode 100644 index 03f2fc3c8b..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ /dev/null @@ -1,3248 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * Copyright (c) 2010, Stefan Knoblich - * Copyright (c) 2012-2013, Stefan Knoblich - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "private/ftdm_core.h" -#include "ftmod_libpri.h" - - -static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); -static ftdm_io_interface_t ftdm_libpri_interface; - -static int on_timeout_t302(struct lpwrap_pri *spri, struct lpwrap_timer *timer); -static int on_timeout_t316(struct lpwrap_pri *spri, struct lpwrap_timer *timer); -static int on_timeout_t3xx(struct lpwrap_pri *spri, struct lpwrap_timer *timer); - - -static void _ftdm_channel_set_state_force(ftdm_channel_t *chan, const ftdm_channel_state_t state) -{ - assert(chan); - chan->state = state; -} - -/** - * \brief Unloads libpri IO module - * \return Success - */ -static FIO_IO_UNLOAD_FUNCTION(ftdm_libpri_unload) -{ - return FTDM_SUCCESS; -} - -/** - * \brief Returns the signalling status on a channel - * \param ftdmchan Channel to get status on - * \param status Pointer to set signalling status - * \return Success or failure - */ - -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(isdn_get_channel_sig_status) -{ - *status = FTDM_SIG_STATE_DOWN; - - ftdm_libpri_data_t *isdn_data = ftdmchan->span->signal_data; - if (ftdm_test_flag(&(isdn_data->spri), LPWRAP_PRI_READY)) { - *status = FTDM_SIG_STATE_UP; - } - return FTDM_SUCCESS; -} - -/** - * \brief Returns the signalling status on a span - * \param span Span to get status on - * \param status Pointer to set signalling status - * \return Success or failure - */ - -static FIO_SPAN_GET_SIG_STATUS_FUNCTION(isdn_get_span_sig_status) -{ - *status = FTDM_SIG_STATE_DOWN; - - ftdm_libpri_data_t *isdn_data = span->signal_data; - if (ftdm_test_flag(&(isdn_data->spri), LPWRAP_PRI_READY)) { - *status = FTDM_SIG_STATE_UP; - } - return FTDM_SUCCESS; -} - - -/** - * \brief Starts a libpri channel (outgoing call) - * \param ftdmchan Channel to initiate call on - * \return Success or failure - */ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(isdn_outgoing_call) -{ - ftdm_unused_arg(ftdmchan); - return FTDM_SUCCESS; -} - -/** - * \brief Requests an libpri channel on a span (outgoing call) - * \param span Span where to get a channel (unused) - * \param chan_id Specific channel to get (0 for any) (unused) - * \param direction Call direction (unused) - * \param caller_data Caller information (unused) - * \param ftdmchan Channel to initialise (unused) - * \return Failure - */ -static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) -{ - ftdm_unused_arg(span); - ftdm_unused_arg(chan_id); - ftdm_unused_arg(direction); - ftdm_unused_arg(caller_data); - ftdm_unused_arg(ftdmchan); - return FTDM_FAIL; -} - - -/** - * \brief Logs a libpri message - * \param pri libpri structure - * \param s Message string - */ -static void s_pri_message(struct pri *pri, char *s) -{ - struct lpwrap_pri *spri = pri_get_userdata(pri); - - if (spri && spri->dchan) { - ftdm_log_chan(spri->dchan, FTDM_LOG_DEBUG, "%s", s); - } else { - ftdm_log(FTDM_LOG_DEBUG, "%s", s); - } -} - -/** - * \brief Logs a libpri error - * \param pri libpri structure - * \param s Error string - */ -static void s_pri_error(struct pri *pri, char *s) -{ - struct lpwrap_pri *spri = pri_get_userdata(pri); - - if (spri && spri->dchan) { - ftdm_log_chan(spri->dchan, FTDM_LOG_ERROR, "%s", s); - } else { - ftdm_log(FTDM_LOG_ERROR, "%s", s); - } -} - - -#define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE) -#define PRI_DEBUG_Q931_ALL (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY) - -static const struct ftdm_libpri_debug { - const char *name; - const int flags; -} ftdm_libpri_debug[] = { - /* NOTE: order is important for print_debug() */ - { "q921_all", PRI_DEBUG_Q921_ALL }, - { "q921_raw", PRI_DEBUG_Q921_RAW }, - { "q921_dump", PRI_DEBUG_Q921_DUMP }, - { "q921_state", PRI_DEBUG_Q921_STATE }, - - { "q931_all", PRI_DEBUG_Q931_ALL }, - { "q931_dump", PRI_DEBUG_Q931_DUMP }, - { "q931_state", PRI_DEBUG_Q931_STATE }, - { "q931_anomaly", PRI_DEBUG_Q931_ANOMALY }, - - { "config", PRI_DEBUG_CONFIG }, - { "apdu", PRI_DEBUG_APDU }, - { "aoc", PRI_DEBUG_AOC } -}; - -/** - * \brief Parses a debug string to flags - * \param in Debug string to parse for - * \return Flags or -1 if nothing matched - */ -static int parse_debug(const char *in, uint32_t *flags) -{ - int res = -1; - int i; - - if (!in || !flags) - return -1; - - if (!strcmp(in, "all")) { - *flags = PRI_DEBUG_ALL; - return 0; - } - if (strstr(in, "none")) { - *flags = 0; - return 0; - } - - for (i = 0; i < ftdm_array_len(ftdm_libpri_debug); i++) { - if (strstr(in, ftdm_libpri_debug[i].name)) { - *flags |= ftdm_libpri_debug[i].flags; - res = 0; - } - } - return res; -} - -#ifdef HAVE_LIBPRI_MAINT_SERVICE -/** - * \brief Parses a change status string to flags - * \param in change status string to parse for - * \return Flags - */ -static int parse_change_status(const char *in) -{ - int flags = 0; - if (!in) { - return 0; - } - - if (strstr(in, "in_service") || strstr(in, "in")) { - flags = SERVICE_CHANGE_STATUS_INSERVICE; - } - if (strstr(in, "maintenance") || strstr(in, "maint")) { - flags = SERVICE_CHANGE_STATUS_MAINTENANCE; - } - if (strstr(in, "out_of_service") || strstr(in, "out")) { - flags = SERVICE_CHANGE_STATUS_OUTOFSERVICE; - } - - - return flags; -} -#endif - - -static int print_debug(uint32_t flags, char *tmp, const int size) -{ - int offset = 0; - int res = 0; - int i; - - if ((flags & PRI_DEBUG_ALL) == PRI_DEBUG_ALL) { - strcat(tmp, "all"); - return 0; - } - else if (!flags) { - strcat(tmp, "none"); - return 0; - } - - for (i = 0; i < ftdm_array_len(ftdm_libpri_debug); i++) { - if ((flags & ftdm_libpri_debug[i].flags) == ftdm_libpri_debug[i].flags) { - res = snprintf(&tmp[offset], size - offset, "%s,", ftdm_libpri_debug[i].name); - if (res <= 0 || res == (size - offset)) - goto out; - offset += res; - flags &= ~ftdm_libpri_debug[i].flags; /* remove detected flags to make *_all work correctly */ - } - } - -out: - tmp[offset - 1] = '\0'; - return 0; -} - - -/*************************************************************** - * MSN filter - ***************************************************************/ - -/** - * Initialize MSN filter data structures - * \param[in] isdn_data Span private data - * \return FTDM_SUCCESS, FTDM_FAIL - */ -static int msn_filter_init(ftdm_libpri_data_t *isdn_data) -{ - if (!isdn_data) - return FTDM_FAIL; - - isdn_data->msn_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - if (!isdn_data->msn_hash) - return FTDM_FAIL; - - if (ftdm_mutex_create(&isdn_data->msn_mutex)) { - hashtable_destroy(isdn_data->msn_hash); - return FTDM_FAIL; - } - - return FTDM_SUCCESS; -} - -/** - * Destroy MSN filter data structures - * \param[in] isdn_data Span private data - * \return FTDM_SUCCESS, FTDM_FAIL - */ -static int msn_filter_destroy(ftdm_libpri_data_t *isdn_data) -{ - if (!isdn_data) - return FTDM_FAIL; - - if (isdn_data->msn_hash) - hashtable_destroy(isdn_data->msn_hash); - if (isdn_data->msn_mutex) - ftdm_mutex_destroy(&isdn_data->msn_mutex); - - return FTDM_SUCCESS; -} - -/** - * Check if the given string is a valid MSN/DDI - * (i.e.: Not empty, not longer than FDM_DIGITS_LIMIT and all numbers) - * \param[in] str String to check - * \return FTDM_SUCCESS, FTDM_FAIL - */ -static int msn_filter_verify(const char *str) -{ - if (ftdm_strlen_zero(str) || strlen(str) >= FTDM_DIGITS_LIMIT) - return FTDM_FALSE; - - if (ftdm_is_number(str) != FTDM_SUCCESS) - return FTDM_FALSE; - - return FTDM_TRUE; -} - -/** - * Add a new MSN/DDI to the filter - * \param[in] isdn_data Span private data - * \param[in] msn New MSN/DDI to add - * \return FTDM_SUCCESS, FTDM_FAIL - */ -static int msn_filter_add(ftdm_libpri_data_t *isdn_data, const char *msn) -{ - static const int value = 0xdeadbeef; - char *key = NULL; - int ret = FTDM_SUCCESS; - - if (!isdn_data || !msn_filter_verify(msn)) - return FTDM_FAIL; - - ftdm_mutex_lock(isdn_data->msn_mutex); - - /* check for duplicates (ignore if already in set) */ - if (hashtable_search(isdn_data->msn_hash, (void *)msn)) { - ret = FTDM_SUCCESS; - goto out; - } - - /* Copy MSN (transient string), hashtable will free it in hashtable_destroy() */ - key = ftdm_strdup(msn); - if (!key) { - ret = FTDM_FAIL; - goto out; - } - - /* add MSN to list/hash */ - if (!hashtable_insert(isdn_data->msn_hash, (void *)key, (void *)&value, HASHTABLE_FLAG_FREE_KEY)) { - ftdm_safe_free(key); - ret = FTDM_FAIL; - } -out: - ftdm_mutex_unlock(isdn_data->msn_mutex); - return ret; -} - - -/** - * Check if a DNIS (destination number) is a valid MSN/DDI - * \param[in] isdn_data Span private data - * \param[in] msn Number to check - * \retval FTDM_TRUE \p msn is a valid MSN/DDI or filter list is empty - * \retval FTDM_FALSE \p msn is not a valid MSN/DDI - */ -static int msn_filter_match(ftdm_libpri_data_t *isdn_data, const char *msn) -{ - int ret = FTDM_FALSE; - - if (!isdn_data) - return FTDM_FALSE; - /* No number? return match found */ - if (ftdm_strlen_zero(msn)) - return FTDM_TRUE; - - ftdm_mutex_lock(isdn_data->msn_mutex); - - /* No MSN configured? */ - if (hashtable_count(isdn_data->msn_hash) <= 0) { - ret = FTDM_TRUE; - goto out; - } - /* Search for a matching MSN */ - if (hashtable_search(isdn_data->msn_hash, (void *)msn)) - ret = FTDM_TRUE; -out: - ftdm_mutex_unlock(isdn_data->msn_mutex); - return ret; -} - -/** - * Helper function to iterate over MSNs in the filter hash (handles locking) - * \param[in] isdn_data Span private data - * \param[in] func Callback function that is invoked for each entry - * \param[in] data Private data passed to callback - * \return FTDM_SUCCESS, FTDM_FAIL - */ -static int msn_filter_foreach(ftdm_libpri_data_t *isdn_data, int (* func)(const char *, void *), void *data) -{ - ftdm_hash_iterator_t *iter = NULL; - int ret = FTDM_SUCCESS; - - if (!isdn_data || !func) - return FTDM_FAIL; - - /* iterate over MSNs */ - ftdm_mutex_lock(isdn_data->msn_mutex); - - for (iter = hashtable_first(isdn_data->msn_hash); iter; iter = hashtable_next(iter)) { - const void *msn = NULL; - - hashtable_this(iter, &msn, NULL, NULL); - - if (ftdm_strlen_zero((const char *)msn)) - break; - if ((ret = func(msn, data)) != FTDM_SUCCESS) - break; - } - - ftdm_mutex_unlock(isdn_data->msn_mutex); - return ret; -} - - -/*************************************************************** - * Module API (CLI) interface - ***************************************************************/ - -static const char *ftdm_libpri_usage = - "Usage:\n" - "libpri kill \n" - "libpri reset \n" - "libpri restart \n" -#ifdef HAVE_LIBPRI_MAINT_SERVICE - "libpri maintenance \n" -#endif - "libpri debug [all|none|flag,...flagN]\n" - "libpri msn \n" - "\n" - "Possible debug flags:\n" - "\tq921_raw - Q.921 Raw messages\n" - "\tq921_dump - Q.921 Decoded messages\n" - "\tq921_state - Q.921 State machine changes\n" - "\tq921_all - Enable all Q.921 debug options\n" - "\n" - "\tq931_dump - Q.931 Messages\n" - "\tq931_state - Q.931 State machine changes\n" - "\tq931_anomaly - Q.931 Anomalies\n" - "\tq931_all - Enable all Q.931 debug options\n" - "\n" - "\tapdu - Application protocol data unit\n" - "\taoc - Advice of Charge messages\n" - "\tconfig - Configuration\n" - "\n" - "\tnone - Disable debugging\n" - "\tall - Enable all debug options\n"; - - -/** - * Custom data handle for list iterator functions - */ -struct msn_list_cb_private { - ftdm_stream_handle_t *stream; - unsigned int count; -}; - -/** - * "ftdm libpri msn " API command callback - * function for msn_filter_foreach() - */ -static int msn_list_cb(const char *msn, void *priv) -{ - struct msn_list_cb_private *data = priv; - ftdm_stream_handle_t *stream = data->stream; - - if (!stream || ftdm_strlen_zero(msn)) - return FTDM_FAIL; - - stream->write_function(stream, "\t%s\n", msn); - data->count++; - return FTDM_SUCCESS; -} - - -/** - * \brief API function to kill or debug a libpri span - * \param stream API stream handler - * \param data String containing argurments - * \return Flags - */ -static FIO_API_FUNCTION(ftdm_libpri_api) -{ - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - - if (data) { - mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - if (argc == 1) { - if (!strcasecmp(argv[0], "help") || !strcasecmp(argv[0], "usage")) { - stream->write_function(stream, ftdm_libpri_usage); - goto done; - } - } else if (argc == 2) { - if (!strcasecmp(argv[0], "kill")) { - int span_id = atoi(argv[1]); - ftdm_span_t *span = NULL; - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - ftdm_libpri_data_t *isdn_data = span->signal_data; - - if (span->start != ftdm_libpri_start) { - stream->write_function(stream, "%s: -ERR '%s' is not a libpri span.\n", - __FILE__, ftdm_span_get_name(span)); - goto done; - } - - ftdm_clear_flag(&(isdn_data->spri), LPWRAP_PRI_READY); - stream->write_function(stream, "%s: +OK killed.\n", __FILE__); - goto done; - } else { - stream->write_function(stream, "%s: -ERR span '%s' not found.\n", - __FILE__, argv[0]); - goto done; - } - } - if (!strcasecmp(argv[0], "msn")) { - ftdm_span_t *span = NULL; - struct msn_list_cb_private data; - data.stream = stream; - data.count = 0; - - if (ftdm_span_find_by_name(argv[1], &span) != FTDM_SUCCESS) { - stream->write_function(stream, "%s: -ERR span '%s' not found.\n", - __FILE__, argv[1]); - goto done; - } - if (span->start != ftdm_libpri_start) { - stream->write_function(stream, "%s: -ERR '%s' is not a libpri span.\n", - __FILE__, ftdm_span_get_name(span)); - goto done; - } - - /* header */ - stream->write_function(stream, "------------------------------------------------------------------------------\n"); - - if (msn_filter_foreach(span->signal_data, msn_list_cb, &data)) { - stream->write_function(stream, "-ERR: Failed to list MSN(s)\n"); - goto done; - } - if (data.count == 0) { - stream->write_function(stream, "\t\t\t -- no entries --\n"); - } - - /* footer */ - stream->write_function(stream, "---------------------------------------------------------------[ %02d MSN(s) ]--\n", - data.count); - stream->write_function(stream, "+OK"); - goto done; - } - } else if (argc >= 2) { - if (!strcasecmp(argv[0], "debug")) { - ftdm_span_t *span = NULL; - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) { - ftdm_libpri_data_t *isdn_data = span->signal_data; - uint32_t flags = 0; - - if (span->start != ftdm_libpri_start) { - stream->write_function(stream, "%s: -ERR '%s' is not a libpri span.\n", - __FILE__, ftdm_span_get_name(span)); - goto done; - } - - if (argc == 2) { - char tmp[100] = { 0 }; - print_debug(pri_get_debug(isdn_data->spri.pri), tmp, sizeof(tmp)); - stream->write_function(stream, "%s: +OK current debug flags: '%s'\n", __FILE__, tmp); - goto done; - } - - if (parse_debug(argv[2], &flags) == -1) { - stream->write_function(stream, "%s: -ERR invalid debug flags given\n", __FILE__); - goto done; - } - - pri_set_debug(isdn_data->spri.pri, flags); - stream->write_function(stream, "%s: +OK debug %s.\n", __FILE__, (flags) ? "enabled" : "disabled"); - goto done; - } else { - stream->write_function(stream, "%s: -ERR span '%s' not found.\n", - __FILE__, argv[0]); - goto done; - } - } - if (!strcasecmp(argv[0], "reset")) { - ftdm_span_t *span = NULL; - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) { - ftdm_libpri_data_t *isdn_data = span->signal_data; - - if (span->start != ftdm_libpri_start) { - stream->write_function(stream, "%s: -ERR '%s' is not a libpri span.\n", - __FILE__, ftdm_span_get_name(span)); - goto done; - } - - pri_restart(isdn_data->spri.pri); - stream->write_function(stream, "%s: +OK reset.\n", __FILE__); - goto done; - } else { - stream->write_function(stream, "%s: -ERR span '%s' not found.\n", - __FILE__, argv[0]); - goto done; - } - } - if (!strcasecmp(argv[0], "restart") && argc == 3) { - ftdm_span_t *span = NULL; - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) { - ftdm_libpri_data_t *isdn_data = span->signal_data; - - if (span->start != ftdm_libpri_start) { - stream->write_function(stream, "%s: -ERR '%s' is not a libpri span.\n", - __FILE__, ftdm_span_get_name(span)); - goto done; - } - if (!strcasecmp(argv[2], "all")) { - int j; - for(j = 1; j <= span->chan_count; j++) { - pri_reset(isdn_data->spri.pri, j); - ftdm_sleep(50); - } - } else { - pri_reset(isdn_data->spri.pri, atoi(argv[2])); - } - stream->write_function(stream, "%s: +OK restart set.\n", __FILE__); - goto done; - } else { - stream->write_function(stream, "%s: -ERR span '%s' not found.\n", - __FILE__, argv[0]); - goto done; - } - } -#ifdef HAVE_LIBPRI_MAINT_SERVICE - if (!strcasecmp(argv[0], "maintenance") && argc > 3) { - ftdm_span_t *span = NULL; - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) { - ftdm_libpri_data_t *isdn_data = span->signal_data; - - if (span->start != ftdm_libpri_start) { - stream->write_function(stream, "%s: -ERR '%s' is not a libpri span.\n", - __FILE__, ftdm_span_get_name(span)); - goto done; - } - if (!isdn_data->service_message_support) { - stream->write_function(stream, "%s: -ERR service message support is disabled\n", __FILE__); - goto done; - } - if (!strcasecmp(argv[2], "all")) { - int j; - for(j = 1; j <= span->chan_count; j++) { - pri_maintenance_service(isdn_data->spri.pri, atoi(argv[1]), j, parse_change_status(argv[3])); - ftdm_sleep(50); - } - } else { - pri_maintenance_service(isdn_data->spri.pri, atoi(argv[1]), atoi(argv[2]), parse_change_status(argv[3])); - } - stream->write_function(stream, "%s: +OK change status set.\n", __FILE__); - goto done; - } else { - stream->write_function(stream, "%s: -ERR span '%s' not found.\n", - __FILE__, argv[0]); - goto done; - } - } -#endif - } else { - /* zero args print usage */ - stream->write_function(stream, ftdm_libpri_usage); - goto done; - } - - stream->write_function(stream, "%s: -ERR invalid command.\n", __FILE__); - -done: - ftdm_safe_free(mycmd); - - return FTDM_SUCCESS; -} - - -/** - * \brief Loads libpri IO module - * \param fio FreeTDM IO interface - * \return Success - */ -static FIO_IO_LOAD_FUNCTION(ftdm_libpri_io_init) -{ - assert(fio != NULL); - - memset(&ftdm_libpri_interface, 0, sizeof(ftdm_libpri_interface)); - ftdm_libpri_interface.name = "libpri"; - ftdm_libpri_interface.api = &ftdm_libpri_api; - - *fio = &ftdm_libpri_interface; - - return FTDM_SUCCESS; -} - -/** - * \brief Loads libpri signaling module - * \param fio FreeTDM IO interface - * \return Success - */ -static FIO_SIG_LOAD_FUNCTION(ftdm_libpri_init) -{ - pri_set_error(s_pri_error); - pri_set_message(s_pri_message); - return FTDM_SUCCESS; -} - -/** - * \brief libpri state map - */ -static ftdm_state_map_t isdn_state_map = { - { - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - - /****************************************/ - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DIALTONE, FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALTONE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, - FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - } -}; - -/** - * \brief Handler for channel state change - * \param ftdmchan Channel to handle - * \note This function MUST be called with the channel locked - */ -static ftdm_status_t state_advance(ftdm_channel_t *chan) -{ - ftdm_span_t *span = ftdm_channel_get_span(chan); - ftdm_libpri_data_t *isdn_data = span->signal_data; - ftdm_libpri_b_chan_t *chan_priv = chan->call_data; - q931_call *call = chan_priv->call; - ftdm_status_t status; - ftdm_sigmsg_t sig; - - ftdm_log(FTDM_LOG_DEBUG, "-- %d:%d STATE [%s]\n", - ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan), ftdm_channel_get_state_str(chan)); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdm_channel_get_id(chan); - sig.span_id = ftdm_channel_get_span_id(chan); - sig.channel = chan; - - ftdm_channel_complete_state(chan); - - switch (ftdm_channel_get_state(chan)) { - case FTDM_CHANNEL_STATE_DOWN: - { - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - ftdm_channel_t *chtmp = chan; - - if (call) { - /* pri call destroy is done by libpri itself (on release_ack) */ - chan_priv->call = NULL; - } - - /* Stop T302 */ - lpwrap_stop_timer(&isdn_data->spri, &chan_priv->t302); - - /* Stop T316 and reset counter */ - lpwrap_stop_timer(&isdn_data->spri, &chan_priv->t316); - chan_priv->t316_timeout_cnt = 0; - - /* Unset remote hangup */ - chan_priv->peerhangup = 0; - - if (ftdm_channel_close(&chtmp) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_WARNING, "-- Failed to close channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Closed channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - } - } - } - break; - - case FTDM_CHANNEL_STATE_PROGRESS: - { - if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_PROGRESS; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - } else if (call) { - /* - * Even if we have no media, sending progress without PI is forbidden - * by Q.931 3.1.8, so a protocol error will be issued from libpri - * and from remote equipment. - * So just pretend we have PI. - */ - pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); - } else { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - } - break; - - case FTDM_CHANNEL_STATE_RINGING: - { - if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_RINGING; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - } else if (call) { -// pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); - pri_acknowledge(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); - } else { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - } - break; - - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - } else if (call) { - /* make sure channel is open in this state (outbound handled in on_proceeding()) */ - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_open_chan(chan); - } - pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); - } else { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - } - break; - - case FTDM_CHANNEL_STATE_PROCEED: - { - if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { - /* PROCEED from other end, notify user */ - sig.event_id = FTDM_SIGEVENT_PROCEED; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to send PROCEED sigevent on Channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - } else if (call) { - pri_proceeding(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); - } else { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - } - break; - - case FTDM_CHANNEL_STATE_COLLECT: /* Overlap receive */ - { - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { - if (!call) { - ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "No call handle\n"); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - else if (pri_need_more_info(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0)) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - - ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "Failed to send INFORMATION request\n"); - - /* hangup call */ - caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - else { - /* Start T302 */ - lpwrap_start_timer(&isdn_data->spri, &chan_priv->t302, - isdn_data->overlap_timeout_ms, &on_timeout_t302); - } - } else { - ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "Overlap receiving on outbound call?\n"); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - } - break; - - case FTDM_CHANNEL_STATE_RING: - { - /* - * This needs more auditing for BRI PTMP: - * does pri_acknowledge() steal the call from other devices? (yes, it does) - */ - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { - if (call) { - pri_proceeding(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); -// pri_acknowledge(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); - sig.event_id = FTDM_SIGEVENT_START; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - } else { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - } - } - break; - - case FTDM_CHANNEL_STATE_RESTART: - { - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - chan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; - sig.event_id = FTDM_SIGEVENT_RESTART; - status = ftdm_span_send_signal(span, &sig); - - if (ftdm_span_get_trunk_type(span) == FTDM_TRUNK_BRI_PTMP) { - /* Just put the channel into DOWN state, libpri won't send RESTART on BRI PTMP */ - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); - - } else if (!(chan_priv->flags & FTDM_LIBPRI_B_REMOTE_RESTART)) { - /* Locally triggered restart, send RESTART to remote, wait for ACK */ - pri_reset(isdn_data->spri.pri, ftdm_channel_get_id(chan)); - /* Start T316 */ - lpwrap_start_timer(&isdn_data->spri, &chan_priv->t316, isdn_data->t316_timeout_ms, &on_timeout_t316); - } else { - /* Remote restart complete, clear flag (RESTART ACK already sent by libpri) */ - chan_priv->flags &= ~FTDM_LIBPRI_B_REMOTE_RESTART; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); - } - } - } - break; - - case FTDM_CHANNEL_STATE_UP: - { - if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_UP; - if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - } else if (call) { - /* make sure channel is open in this state (outbound handled in on_answer()) */ - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_open_chan(chan); - } - pri_answer(isdn_data->spri.pri, call, 0, 1); - } else { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - } - break; - - case FTDM_CHANNEL_STATE_DIALING: - if (isdn_data) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - struct pri_sr *sr; - int caller_ton; - int called_ton; - - if (!(call = pri_new_call(isdn_data->spri.pri))) { - ftdm_log(FTDM_LOG_ERROR, "Failed to create new call on channel %d:%d\n", - ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); - /* TODO: set hangup cause? */ - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - return FTDM_SUCCESS; - } - - caller_ton = caller_data->cid_num.type; - switch (caller_ton) { - case FTDM_TON_NATIONAL: - caller_ton = PRI_NATIONAL_ISDN; - break; - case FTDM_TON_INTERNATIONAL: - caller_ton = PRI_INTERNATIONAL_ISDN; - break; - case FTDM_TON_SUBSCRIBER_NUMBER: - caller_ton = PRI_LOCAL_ISDN; - break; - default: - caller_ton = isdn_data->ton; - } - - called_ton = caller_data->dnis.type; - switch (called_ton) { - case FTDM_TON_NATIONAL: - called_ton = PRI_NATIONAL_ISDN; - break; - case FTDM_TON_INTERNATIONAL: - called_ton = PRI_INTERNATIONAL_ISDN; - break; - case FTDM_TON_SUBSCRIBER_NUMBER: - called_ton = PRI_LOCAL_ISDN; - break; - default: - called_ton = isdn_data->ton; - } - - chan_priv->call = call; - - sr = pri_sr_new(); - if (!sr) { - ftdm_log(FTDM_LOG_ERROR, "Failed to create new setup request on channel %d:%d\n", - ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); - /* TODO: handle error properly */ - } - assert(sr); - - pri_sr_set_channel(sr, ftdm_channel_get_id(chan), 1, 0); - pri_sr_set_bearer(sr, PRI_TRANS_CAP_SPEECH, isdn_data->layer1); - - pri_sr_set_called(sr, caller_data->dnis.digits, called_ton, 1); - pri_sr_set_caller(sr, caller_data->cid_num.digits, - ((isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE) ? NULL : caller_data->cid_name), - caller_ton, - ((caller_data->pres != 1) ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_PROHIB_USER_NUMBER_NOT_SCREENED)); - - if (!(isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE)) { - pri_sr_set_redirecting(sr, caller_data->cid_num.digits, caller_ton, - PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL); - } -#ifdef HAVE_LIBPRI_AOC - if (isdn_data->opts & FTMOD_LIBPRI_OPT_FACILITY_AOC) { - /* request AOC on call */ - pri_sr_set_aoc_charging_request(sr, (PRI_AOC_REQUEST_S | PRI_AOC_REQUEST_E | PRI_AOC_REQUEST_D)); - ftdm_log(FTDM_LOG_DEBUG, "Requesting AOC-S/D/E on call\n"); - } -#endif - if (pri_setup(isdn_data->spri.pri, call, sr)) { - caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); - } - - pri_sr_free(sr); - } - break; - - case FTDM_CHANNEL_STATE_HANGUP: - { - if (call) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - pri_hangup(isdn_data->spri.pri, call, caller_data->hangup_cause); - - if (chan_priv->peerhangup) { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - } - } - } - break; - - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - { -// if (call) { -// pri_destroycall(isdn_data->spri.pri, call); -// chan_priv->call = NULL; -// } - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); - } - break; - - case FTDM_CHANNEL_STATE_TERMINATING: - { - sig.event_id = FTDM_SIGEVENT_STOP; - status = ftdm_span_send_signal(span, &sig); - /* user moves us to HANGUP and from there we go to DOWN */ - } - default: - break; - } - return FTDM_SUCCESS; -} - -/** - * \brief Checks current state on a span - * \param span Span to check status on - */ -static __inline__ void check_state(ftdm_span_t *span) -{ - if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { - uint32_t j; - - ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - - for (j = 1; j <= ftdm_span_get_chan_count(span); j++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, j); - ftdm_channel_lock(chan); - ftdm_channel_advance_states(chan); - ftdm_channel_unlock(chan); - } - } -} - - -/** - * \brief Handler for libpri keypad digit event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_keypad_digit(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_span_t *span = spri->span; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ring.channel); - - ftdm_unused_arg(event_type); - - if (!chan) { - ftdm_log(FTDM_LOG_ERROR, "-- Keypad event on invalid channel %d:%d\n", - ftdm_span_get_id(span), pevent->ring.channel); - return 0; - } - - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "-- Keypad event received, incoming digits: '%s'\n", - pevent->digit.digits); - - /* Enqueue DTMF digits on channel */ - ftdm_channel_queue_dtmf(chan, pevent->digit.digits); - return 0; -} - - -/** - * \brief Handler for libpri information event (overlap receiving) - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_information(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_span_t *span = spri->span; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ring.channel); - ftdm_libpri_b_chan_t *chan_priv = NULL; - ftdm_caller_data_t *caller_data = NULL; - ftdm_libpri_data_t *isdn_data = span->signal_data; - - ftdm_unused_arg(event_type); - - if (!chan) { - ftdm_log(FTDM_LOG_CRIT, "-- Info on channel %d:%d but it's not in use?\n", ftdm_span_get_id(span), pevent->ring.channel); - return 0; - } - - caller_data = ftdm_channel_get_caller_data(chan); - chan_priv = chan->call_data; - - switch (ftdm_channel_get_state(chan)) { - case FTDM_CHANNEL_STATE_COLLECT: /* TE-mode overlap receiving */ - case FTDM_CHANNEL_STATE_DIALTONE: /* NT-mode overlap receiving */ - - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "-- Incoming INFORMATION indication, received digits: '%s', number complete: %c, collected digits: '%s'\n", - pevent->ring.callednum, - pevent->ring.complete ? 'Y' : 'N', - caller_data->dnis.digits); - - /* Stop T302 */ - lpwrap_stop_timer(spri, &chan_priv->t302); - - /* append digits to dnis */ - if (!ftdm_strlen_zero(pevent->ring.callednum)) { - int digits = strlen(pevent->ring.callednum); - int offset = strlen(caller_data->dnis.digits); - int len = 0; - - if (strchr(pevent->ring.callednum, '#')) { - pevent->ring.complete = 1; - digits--; - } - - len = ftdm_min(sizeof(caller_data->dnis.digits) - 1 - offset, digits); /* max. length without terminator */ - if (len < digits) { - ftdm_log_chan(chan, FTDM_LOG_WARNING, "Digit string of length %d exceeds available space %d of DNIS, truncating!\n", - digits, len); - } - if (len) { - ftdm_copy_string(&caller_data->dnis.digits[offset], (char *)pevent->ring.callednum, len + 1); /* max. length with terminator */ - caller_data->dnis.digits[offset + len] = '\0'; - } - } - if (pevent->ring.complete) { - ftdm_log_chan_msg(chan, FTDM_LOG_DEBUG, "Number complete indication received, moving channel to RING state\n"); - /* notify switch */ - ftdm_set_state(chan, FTDM_CHANNEL_STATE_RING); - } else { - /* Restart T302 */ - lpwrap_start_timer(spri, &chan_priv->t302, isdn_data->overlap_timeout_ms, &on_timeout_t302); - } - break; - default: - ftdm_log_chan(chan, FTDM_LOG_ERROR, "-- INFORMATION indication in invalid state '%s'\n", - ftdm_channel_get_state_str(chan)); - } - return 0; -} - -/** - * \brief Handler for libpri hangup event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_span_t *span = spri->span; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->hangup.channel); - ftdm_libpri_b_chan_t *chan_priv = chan->call_data; - - if (!chan) { - ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d but it's not in use?\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); - return 0; - } - - ftdm_channel_lock(chan); - - switch (event_type) { - case LPWRAP_PRI_EVENT_HANGUP_REQ: /* DISCONNECT */ - if (ftdm_channel_get_state(chan) >= FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s\n", - ftdm_channel_get_state_str(chan)); - goto done; - } - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup REQ on channel %d:%d\n", - ftdm_span_get_id(spri->span), pevent->hangup.channel); - - chan->caller_data.hangup_cause = pevent->hangup.cause; - - switch (ftdm_channel_get_state(chan)) { - case FTDM_CHANNEL_STATE_DIALTONE: - case FTDM_CHANNEL_STATE_COLLECT: - ftdm_set_state(chan, FTDM_CHANNEL_STATE_HANGUP); - break; - default: - ftdm_set_state(chan, FTDM_CHANNEL_STATE_TERMINATING); - } - break; - - case LPWRAP_PRI_EVENT_HANGUP_ACK: /* RELEASE_COMPLETE */ - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup ACK on channel %d:%d\n", - ftdm_span_get_id(spri->span), pevent->hangup.channel); - - switch (ftdm_channel_get_state(chan)) { - case FTDM_CHANNEL_STATE_RESTART: - /* ACK caused by DL FAILURE in DISC REQ */ - ftdm_set_state(chan, FTDM_CHANNEL_STATE_DOWN); - break; - default: - ftdm_set_state(chan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - break; - } - break; - - case LPWRAP_PRI_EVENT_HANGUP: /* "RELEASE/RELEASE_COMPLETE/other" */ - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", - ftdm_span_get_id(spri->span), pevent->hangup.channel); - - chan_priv->peerhangup = 1; - - switch (ftdm_channel_get_state(chan)) { - case FTDM_CHANNEL_STATE_DIALING: - case FTDM_CHANNEL_STATE_RINGING: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_UP: - chan->caller_data.hangup_cause = pevent->hangup.cause; - ftdm_set_state(chan, FTDM_CHANNEL_STATE_TERMINATING); - break; - case FTDM_CHANNEL_STATE_HANGUP: - /* this will send "RELEASE_COMPLETE", eventually */ - pri_hangup(spri->pri, pevent->hangup.call, chan->caller_data.hangup_cause); - chan->caller_data.hangup_cause = pevent->hangup.cause; - ftdm_set_state(chan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - break; - case FTDM_CHANNEL_STATE_RESTART: - /* - * We got an hungup doing a restart, normally beacause link has been lost during - * a call and the T309 timer has expired. So destroy it :) (DL_RELEASE_IND) - */ - pri_destroycall(spri->pri, pevent->hangup.call); - ftdm_set_state(chan, FTDM_CHANNEL_STATE_DOWN); - break; -// case FTDM_CHANNEL_STATE_TERMINATING: -// ftdm_set_state(chan, FTDM_CHANNEL_STATE_HANGUP); -// break; -// case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: -// ftdm_set_state(chan, FTDM_CHANNEL_STATE_DOWN); -// break; - } - break; - default: - break; - } - -done: - ftdm_channel_unlock(chan); - return 0; -} - -/** - * \brief Handler for libpri answer event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_answer(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_span_t *span = spri->span; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->answer.channel); - - ftdm_unused_arg(event_type); - - if (chan) { - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - ftdm_log(FTDM_LOG_DEBUG, "-- Call answered, opening B-Channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - - ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); - goto out; - } - } - ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d\n", ftdm_span_get_id(span), pevent->answer.channel); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_UP); - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d but it's not in the span?\n", - ftdm_span_get_id(span), pevent->answer.channel); - } -out: - return 0; -} - -/** - * \brief Handler for libpri proceeding event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_proceeding(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_span_t *span = spri->span; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->proceeding.channel); - - ftdm_unused_arg(event_type); - - if (chan) { - /* Open channel if inband information is available */ - if (pevent->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE || pevent->proceeding.progressmask & PRI_PROG_CALL_NOT_E2E_ISDN) { - ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, B-Channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN) && (ftdm_channel_open_chan(chan) != FTDM_SUCCESS)) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - - ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); - goto out; - } - } - ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROCEED); - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d but it's not in the span?\n", - ftdm_span_get_id(span), pevent->proceeding.channel); - } -out: - return 0; -} - -/** - * \brief Handler for libpri progress event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - * \note also uses pri_event->proceeding - */ -static int on_progress(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_span_t *span = spri->span; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->proceeding.channel); - - ftdm_unused_arg(event_type); - - if (chan) { - /* Open channel if inband information is available */ - if (pevent->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE || pevent->proceeding.progressmask & PRI_PROG_CALL_NOT_E2E_ISDN) { - ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, B-Channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN) && (ftdm_channel_open_chan(chan) != FTDM_SUCCESS)) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - - ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); - goto out; - } - ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d with media\n", ftdm_span_get_id(span), pevent->proceeding.channel); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); - } - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d but it's not in the span?\n", - ftdm_span_get_id(span), pevent->proceeding.channel); - } -out: - return 0; -} - -/** - * \brief Handler for libpri ringing event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_span_t *span = spri->span; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ringing.channel); - - ftdm_unused_arg(event_type); - - if (chan) { - /* we may get on_ringing even when we're already in FTDM_CHANNEL_STATE_PROGRESS_MEDIA */ -// if (ftdm_channel_get_state(chan) == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { -// /* dont try to move to STATE_PROGRESS to avoid annoying veto warning */ -// return 0; -// } - - /* Open channel if inband information is available */ - if ((pevent->ringing.progressmask & PRI_PROG_INBAND_AVAILABLE)) { - ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, B-Channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN) && (ftdm_channel_open_chan(chan) != FTDM_SUCCESS)) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - - ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); - goto out; - } - ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d with media\n", ftdm_span_get_id(span), pevent->proceeding.channel); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else { -// ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); - ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RINGING); - } - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d but it's not in the span?\n", - ftdm_span_get_id(span), pevent->ringing.channel); - } -out: - return 0; -} - - -/** - * Look up FreeTDM channel by call reference value - * \param[in] span Span object - * \param[in] crv CRV to search for - * \return Channel on success, NULL otherwise - */ -static ftdm_channel_t *find_channel_by_cref(ftdm_span_t *span, const int cref) -{ - ftdm_iterator_t *c_iter, *c_cur; - ftdm_channel_t *chan = NULL; - - if (!span || cref <= 0) - return NULL; - - ftdm_mutex_lock(span->mutex); - - c_iter = ftdm_span_get_chan_iterator(span, NULL); - - /* Iterate over all channels on this span */ - for (c_cur = c_iter; c_cur; c_cur = ftdm_iterator_next(c_cur)) { - ftdm_channel_t *cur = ftdm_iterator_current(c_cur); - ftdm_caller_data_t *caller_data = NULL; - - if (ftdm_channel_get_type(cur) != FTDM_CHAN_TYPE_B) - continue; - - caller_data = ftdm_channel_get_caller_data(cur); - - if (caller_data->call_reference == cref) { - chan = cur; - break; - } - } - - ftdm_iterator_free(c_iter); - ftdm_mutex_unlock(span->mutex); - return chan; -} - - -/** - * Hunt for free channel (NT-mode only) - * \param[in] span Span to hunt on - * \param[in] hint Channel ID hint (preferred by remote end) - * \param[in] excl Is the hint exclusive (or preferred)? - * \param[out] chan Selected channel - * \retval FTDM_SUCCESS A free channel has been found - * \retval FTDM_FAIL No free channels could be found on the span - * \retval FTDM_EBUSY The channel indicated in the exclusive hint is already in use - */ -static ftdm_status_t hunt_channel(ftdm_span_t *span, const int hint, const ftdm_bool_t excl, ftdm_channel_t **chan) -{ - ftdm_iterator_t *c_iter, *c_cur; - ftdm_channel_t *tmp = NULL; - int ret = FTDM_FAIL; - - /* lock span */ - ftdm_mutex_lock(span->mutex); - - /* Check hint */ - if (hint > 0) { - tmp = ftdm_span_get_channel(span, hint); - if (!tmp) { - ftdm_log(FTDM_LOG_NOTICE, "Invalid channel hint '%d' given (out of bounds)\n", hint); - } - else if (!ftdm_test_flag(tmp, FTDM_CHANNEL_INUSE) && ftdm_channel_get_type(tmp) == FTDM_CHAN_TYPE_B) { - ftdm_log(FTDM_LOG_DEBUG, "Using channel '%d' from hint\n", ftdm_channel_get_id(tmp)); - ftdm_channel_use(tmp); - ret = FTDM_SUCCESS; - *chan = tmp; - goto out; - } - else if (excl) { - ftdm_log(FTDM_LOG_NOTICE, "Channel '%d' in exclusive hint is not available\n", - ftdm_channel_get_id(tmp)); - ret = FTDM_EBUSY; - goto out; - } - } - - c_iter = ftdm_span_get_chan_iterator(span, NULL); - - /* Iterate over all channels on this span */ - for (c_cur = c_iter; c_cur; c_cur = ftdm_iterator_next(c_cur)) { - tmp = ftdm_iterator_current(c_cur); - - if (ftdm_channel_get_type(tmp) != FTDM_CHAN_TYPE_B) - continue; - - if (!ftdm_test_flag(tmp, FTDM_CHANNEL_INUSE)) { - ftdm_channel_use(tmp); - ret = FTDM_SUCCESS; - *chan = tmp; - break; - } - } - - ftdm_iterator_free(c_iter); -out: - ftdm_mutex_unlock(span->mutex); - return ret; -} - - -/** - * \brief Handler for libpri ring event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 on success - */ -static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_span_t *span = spri->span; - ftdm_libpri_data_t *isdn_data = span->signal_data; - ftdm_libpri_b_chan_t *chan_priv = NULL; - ftdm_channel_t *chan = NULL; - ftdm_caller_data_t *caller_data = NULL; - int ret = 0; - - ftdm_unused_arg(event_type); - - /* - * Check if call has an associated channel (duplicate ring event) - */ - if ((chan = find_channel_by_cref(span, pevent->ring.cref))) { - ftdm_log_chan_msg(chan, FTDM_LOG_NOTICE, "-- Duplicate ring received (ignored)\n"); - return ret; - } - - if (isdn_data->mode == PRI_NETWORK) { - /* - * Always hunt for a free channel in NT-mode, - * but use the pre-selected one as hint - */ - switch (hunt_channel(span, pevent->ring.channel, !pevent->ring.flexible, &chan)) { - case FTDM_SUCCESS: /* OK channel found */ - break; - case FTDM_EBUSY: /* Exclusive channel hint is not available */ - ftdm_log(FTDM_LOG_ERROR, "-- New call without channel on span '%s' [NOTE: Initial SETUP w/o channel selection is not supported by FreeTDM]\n", - ftdm_span_get_name(span)); - pri_hangup(spri->pri, pevent->ring.call, PRI_CAUSE_CHANNEL_UNACCEPTABLE); - return ret; - default: - ftdm_log(FTDM_LOG_ERROR, "-- New call without channel on span '%s' [NOTE: Initial SETUP w/o channel selection is not supported by FreeTDM]\n", - ftdm_span_get_name(span)); - pri_hangup(spri->pri, pevent->ring.call, PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION); - return ret; - } - - ftdm_channel_lock(chan); - - } else if (pevent->ring.channel == -1) { - /* - * TE-mode incoming call without channel selection (not supported) - */ - ftdm_log(FTDM_LOG_ERROR, "-- New call without channel on span '%s' [NOTE: Initial SETUP w/o channel selection is not supported by FreeTDM]\n", - ftdm_span_get_name(span)); - pri_destroycall(spri->pri, pevent->ring.call); - return ret; - } else { - /* - * TE-mode, check MSN filter, ignore calls that aren't for this PTMP terminal - */ - if (!msn_filter_match(isdn_data, pevent->ring.callednum)) { - ftdm_log(FTDM_LOG_INFO, "-- MSN filter not matching incoming DNIS '%s', ignoring call\n", - pevent->ring.callednum); - pri_destroycall(spri->pri, pevent->ring.call); - return ret; - } - - /* - * TE-mode channel selection, use whatever the NT tells us to - */ - chan = ftdm_span_get_channel(span, pevent->ring.channel); - if (!chan) { - ftdm_log(FTDM_LOG_ERROR, "-- Unable to get channel %d:%d\n", - ftdm_span_get_id(span), pevent->ring.channel); - pri_hangup(spri->pri, pevent->ring.call, PRI_CAUSE_DESTINATION_OUT_OF_ORDER); - return ret; - } - - ftdm_channel_lock(chan); - - if (ftdm_channel_get_state(chan) != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(chan, FTDM_CHANNEL_INUSE)) { - ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "-- Selected channel is already in use\n"); - pri_hangup(spri->pri, pevent->ring.call, PRI_CAUSE_DESTINATION_OUT_OF_ORDER); - goto done; - } - - /* Reserve channel */ - if (ftdm_channel_use(chan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "-- Error reserving channel\n"); - pri_hangup(spri->pri, pevent->ring.call, PRI_CAUSE_DESTINATION_OUT_OF_ORDER); - goto done; - } - } - - /* Get per-channel private data */ - chan_priv = chan->call_data; - - if (chan_priv->call) { - /* we could drop the incoming call, but most likely the pointer is just a ghost of the past, - * this check is just to detect potentially unreleased pointers */ - ftdm_log_chan(chan, FTDM_LOG_WARNING, "Channel already has call %p!\n", chan_priv->call); - chan_priv->call = NULL; - } - - caller_data = ftdm_channel_get_caller_data(chan); - - memset(caller_data, 0, sizeof(*caller_data)); - - /* Save CRV, so we can do proper duplicate RING detection */ - caller_data->call_reference = pevent->ring.cref; - - ftdm_set_string(caller_data->cid_num.digits, (char *)pevent->ring.callingnum); - ftdm_set_string(caller_data->ani.digits, (char *)pevent->ring.callingani); - ftdm_set_string(caller_data->dnis.digits, (char *)pevent->ring.callednum); - ftdm_set_string(caller_data->rdnis.digits, (char *)pevent->ring.redirectingnum); - - if (pevent->ring.callingpres == PRES_ALLOWED_USER_NUMBER_NOT_SCREENED) { - caller_data->pres = FTDM_PRES_ALLOWED; - caller_data->screen = FTDM_SCREENING_NOT_SCREENED; - } else if (pevent->ring.callingpres == PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN) { - caller_data->pres = FTDM_PRES_ALLOWED; - caller_data->screen = FTDM_SCREENING_VERIFIED_PASSED; - } else if (pevent->ring.callingpres == PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN) { - caller_data->pres = FTDM_PRES_ALLOWED; - caller_data->screen = FTDM_SCREENING_VERIFIED_FAILED; - } else if (pevent->ring.callingpres == PRES_ALLOWED_NETWORK_NUMBER) { - caller_data->pres = FTDM_PRES_ALLOWED; - caller_data->screen = FTDM_SCREENING_NETWORK_PROVIDED; - } else if (pevent->ring.callingpres == PRES_PROHIB_USER_NUMBER_NOT_SCREENED) { - caller_data->pres = FTDM_PRES_RESTRICTED; - caller_data->screen = FTDM_SCREENING_NOT_SCREENED; - } else if (pevent->ring.callingpres == PRES_PROHIB_USER_NUMBER_PASSED_SCREEN) { - caller_data->pres = FTDM_PRES_RESTRICTED; - caller_data->screen = FTDM_SCREENING_VERIFIED_PASSED; - } else if (pevent->ring.callingpres == PRES_PROHIB_USER_NUMBER_FAILED_SCREEN) { - caller_data->pres = FTDM_PRES_RESTRICTED; - caller_data->screen = FTDM_SCREENING_VERIFIED_FAILED; - } else if (pevent->ring.callingpres == PRES_PROHIB_NETWORK_NUMBER) { - caller_data->pres = FTDM_PRES_RESTRICTED; - caller_data->screen = FTDM_SCREENING_NETWORK_PROVIDED; - } else if (pevent->ring.callingpres == PRES_NUMBER_NOT_AVAILABLE) { - caller_data->pres = FTDM_PRES_NOT_AVAILABLE; - caller_data->screen = FTDM_SCREENING_NETWORK_PROVIDED; - } else { - caller_data->pres = FTDM_PRES_INVALID; - caller_data->screen = FTDM_SCREENING_INVALID; - } - - if (pevent->ring.callingplanani != -1) { - caller_data->ani.type = pevent->ring.callingplanani >> 4; - caller_data->ani.plan = pevent->ring.callingplanani & 0x0F; - } else { - /* the remote party did not sent a valid (according to libpri) ANI ton, - * so let's use the callingplan ton/type and hope is correct. - */ - caller_data->ani.type = pevent->ring.callingplan >> 4; - caller_data->ani.plan = pevent->ring.callingplan & 0x0F; - } - - caller_data->cid_num.type = pevent->ring.callingplan >> 4; - caller_data->cid_num.plan = pevent->ring.callingplan & 0x0F; - - caller_data->dnis.type = pevent->ring.calledplan >> 4; - caller_data->dnis.plan = pevent->ring.calledplan & 0x0F; - - if (!ftdm_strlen_zero((char *)pevent->ring.callingname)) { - ftdm_set_string(caller_data->cid_name, (char *)pevent->ring.callingname); - } else { - ftdm_set_string(caller_data->cid_name, (char *)pevent->ring.callingnum); - } - - if (pevent->ring.ani2 >= 0) { - snprintf(caller_data->aniII, 5, "%.2d", pevent->ring.ani2); - } - - // scary to trust this pointer, you'd think they would give you a copy of the call data so you own it...... - /* hurr, this is valid as along as nobody releases the call */ - chan_priv->call = pevent->ring.call; - - /* Open Channel if inband information is available */ - if ((pevent->ring.progressmask & PRI_PROG_INBAND_AVAILABLE)) { - /* Open channel if inband information is available */ - ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, opening B-Channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN) && ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { -// ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); - - ftdm_log(FTDM_LOG_WARNING, "-- Error opening channel %d:%d (ignored)\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - -// caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; -// ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); -// goto done; - } - } - - ftdm_log(FTDM_LOG_NOTICE, "-- Ring on channel %d:%d (from %s to %s)\n", ftdm_span_get_id(span), pevent->ring.channel, - pevent->ring.callingnum, pevent->ring.callednum); - - /* Only go to RING state if we have the complete called number (indicated via pevent->complete flag) */ - if (!pevent->ring.complete && (isdn_data->overlap & FTMOD_LIBPRI_OVERLAP_RECEIVE)) { - ftdm_log(FTDM_LOG_DEBUG, "RING event without complete indicator, waiting for more digits\n"); - ftdm_set_state(chan, FTDM_CHANNEL_STATE_COLLECT); - } else { - ftdm_log(FTDM_LOG_DEBUG, "RING event with complete indicator (or overlap receive disabled)\n"); - ftdm_set_state(chan, FTDM_CHANNEL_STATE_RING); - } -done: - ftdm_channel_unlock(chan); - return ret; -} - - -/** - * Timeout handler for T302 (overlap receiving) - */ -static int on_timeout_t302(struct lpwrap_pri *spri, struct lpwrap_timer *timer) -{ - ftdm_libpri_b_chan_t *chan_priv = ftdm_container_of(timer, ftdm_libpri_b_chan_t, t302); - ftdm_channel_t *chan = chan_priv->channel; - - ftdm_unused_arg(spri); - - ftdm_log_chan_msg(chan, FTDM_LOG_INFO, "-- T302 timed out, going to state RING\n"); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RING); - return 0; -} - -/** - * Timeout handler for T316 (RESTART ACK timer) - */ -static int on_timeout_t316(struct lpwrap_pri *spri, struct lpwrap_timer *timer) -{ - ftdm_libpri_b_chan_t *chan_priv = ftdm_container_of(timer, ftdm_libpri_b_chan_t, t316); - ftdm_libpri_data_t *isdn_data = ftdm_container_of(spri, ftdm_libpri_data_t, spri); - ftdm_channel_t *chan = chan_priv->channel; - - if (++chan_priv->t316_timeout_cnt > isdn_data->t316_max_attempts) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "-- T316 timed out, channel reached restart attempt limit '%d' and is suspended\n", - isdn_data->t316_max_attempts); - - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_SUSPENDED); - } else { - ftdm_log_chan_msg(chan, FTDM_LOG_WARNING, "-- T316 timed out, resending RESTART request\n"); - pri_reset(spri->pri, ftdm_channel_get_id(chan)); - - /* Restart T316 */ - lpwrap_start_timer(spri, timer, isdn_data->t316_timeout_ms, &on_timeout_t316); - } - return 0; -} - - -/** - * Timeout handler for T3xx (NT-mode idle restart) - */ -static int on_timeout_t3xx(struct lpwrap_pri *spri, struct lpwrap_timer *timer) -{ - ftdm_span_t *span = spri->span; - ftdm_libpri_data_t *isdn_data = span->signal_data; - ftdm_iterator_t *c_iter, *c_cur; - - ftdm_log_chan_msg(isdn_data->dchan, FTDM_LOG_INFO, "-- T3xx timed out, restarting idle b-channels\n"); - ftdm_mutex_lock(span->mutex); - - c_iter = ftdm_span_get_chan_iterator(span, NULL); - - /* Iterate b-channels */ - for (c_cur = c_iter; c_cur; c_cur = ftdm_iterator_next(c_cur)) { - ftdm_channel_t *cur = ftdm_iterator_current(c_cur); - /* Skip non-b-channels */ - if (ftdm_channel_get_type(cur) != FTDM_CHAN_TYPE_B) - continue; - /* Restart idle b-channels */ - if (ftdm_channel_get_state(cur) == FTDM_CHANNEL_STATE_DOWN && !ftdm_test_flag(cur, FTDM_CHANNEL_INUSE)) { - ftdm_set_state_locked(cur, FTDM_CHANNEL_STATE_RESTART); - } - } - ftdm_iterator_free(c_iter); - ftdm_mutex_unlock(span->mutex); - - /* Start timer again */ - lpwrap_start_timer(spri, timer, isdn_data->idle_restart_timeout_ms, &on_timeout_t3xx); - return 0; -} - - -/** - * \brief Processes freetdm event - * \param span Span on which the event was fired - * \param event Event to be treated - * \return Success or failure - */ -static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event) -{ - ftdm_alarm_flag_t alarmbits; - - ftdm_unused_arg(span); - - ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d][%d:%d] STATE [%s]\n", - ftdm_oob_event2str(event->enum_id), - event->enum_id, - ftdm_channel_get_span_id(event->channel), - ftdm_channel_get_id(event->channel), - ftdm_channel_get_state_str(event->channel)); - - switch (event->enum_id) { - case FTDM_OOB_ALARM_TRAP: - { - if (ftdm_channel_get_state(event->channel) != FTDM_CHANNEL_STATE_DOWN) { - if (ftdm_channel_get_type(event->channel) == FTDM_CHAN_TYPE_B) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); - } - } - - ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); - ftdm_channel_get_alarms(event->channel, &alarmbits); - ftdm_log_chan_msg(event->channel, FTDM_LOG_WARNING, "channel has alarms!\n"); - } - break; - case FTDM_OOB_ALARM_CLEAR: - { - ftdm_clear_flag(event->channel, FTDM_CHANNEL_SUSPENDED); - ftdm_channel_get_alarms(event->channel, &alarmbits); - ftdm_log_chan_msg(event->channel, FTDM_LOG_WARNING, "channel alarms cleared!\n"); - } - break; - } - return FTDM_SUCCESS; -} - -/** - * \brief Checks for events on a span - * \param span Span to check for events - */ -static __inline__ void check_events(ftdm_span_t *span) -{ - ftdm_status_t status; - - status = ftdm_span_poll_event(span, 5, NULL); - - switch (status) { - case FTDM_SUCCESS: - { - ftdm_event_t *event; - - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { - if (event->enum_id == FTDM_OOB_NOOP) { - continue; - } - if (process_event(span, event) != FTDM_SUCCESS) { - break; - } - } - } - break; - - case FTDM_FAIL: - ftdm_log(FTDM_LOG_DEBUG, "Event Failure! %d\n", ftdm_running()); - ftdm_sleep(2000); - break; - - default: - break; - } -} - -/** - * \brief Checks flags on a pri span - * \param spri Pri wrapper structure (libpri, span, dchan) - * \return 0 on success, -1 on error - */ -static int check_flags(lpwrap_pri_t *spri) -{ - ftdm_span_t *span = spri->span; - check_state(span); - check_events(span); - return 0; -} - -/** - * \brief Handler for libpri restart event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_restart(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_channel_t *chan = NULL; - ftdm_span_t *span = spri->span; - int i; - - ftdm_unused_arg(event_type); - - if (pevent->restart.channel < 1) { - ftdm_log_chan_msg(spri->dchan, FTDM_LOG_DEBUG, "-- Restarting interface\n"); - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - chan = ftdm_span_get_channel(span, i); - if (!chan) - continue; - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - ftdm_libpri_b_chan_t *chan_priv = chan->call_data; - chan_priv->flags |= FTDM_LIBPRI_B_REMOTE_RESTART; /* Remote triggered RESTART, set flag */ - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } - } - } - else if ((chan = ftdm_span_get_channel(span, pevent->restart.channel))) { - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - ftdm_libpri_b_chan_t *chan_priv = chan->call_data; - - ftdm_log_chan_msg(chan, FTDM_LOG_DEBUG, "-- Restarting single channel\n"); - chan_priv->flags |= FTDM_LIBPRI_B_REMOTE_RESTART; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - } else { - ftdm_log_chan_msg(chan, FTDM_LOG_NOTICE, "Ignoring RESTART on D-Channel\n"); - } - } - else { - ftdm_log(FTDM_LOG_ERROR, "Invalid restart indicator / channel id '%d' received\n", - pevent->restart.channel); - } - - _ftdm_channel_set_state_force(spri->dchan, FTDM_CHANNEL_STATE_UP); - return 0; -} - -/** - * \brief Handler for libpri restart acknowledge event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_restart_ack(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_channel_t *chan = NULL; - ftdm_span_t *span = spri->span; - int i; - - ftdm_unused_arg(event_type); - - if (pevent->restartack.channel < 1) { - ftdm_log_chan_msg(spri->dchan, FTDM_LOG_DEBUG, "-- Restart of interface completed\n"); - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - chan = ftdm_span_get_channel(span, i); - if (!chan) - continue; - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - ftdm_libpri_b_chan_t *chan_priv = chan->call_data; - if (!(chan_priv->flags & FTDM_LIBPRI_B_REMOTE_RESTART)) { - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); - } - } - } - } - else if ((chan = ftdm_span_get_channel(span, pevent->restart.channel))) { - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - ftdm_log_chan_msg(chan, FTDM_LOG_DEBUG, "-- Restart of channel completed\n"); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); - } else { - ftdm_log_chan_msg(chan, FTDM_LOG_NOTICE, "Ignoring RESTART ACK on D-Channel\n"); - } - } - else { - ftdm_log(FTDM_LOG_ERROR, "Invalid restart indicator / channel id '%d' received\n", - pevent->restartack.channel); - } - - _ftdm_channel_set_state_force(spri->dchan, FTDM_CHANNEL_STATE_UP); - return 0; -} - - - - -/* - * FACILITY Advice-On-Charge handler - */ -#if defined(HAVE_LIBPRI_AOC) && defined(PRI_EVENT_FACILITY) -static const char *aoc_billing_id(const int id) -{ - switch (id) { - case PRI_AOC_E_BILLING_ID_NOT_AVAILABLE: - return "not available"; - case PRI_AOC_E_BILLING_ID_NORMAL: - return "normal"; - case PRI_AOC_E_BILLING_ID_REVERSE: - return "reverse"; - case PRI_AOC_E_BILLING_ID_CREDIT_CARD: - return "credit card"; - case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_UNCONDITIONAL: - return "call forwarding unconditional"; - case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_BUSY: - return "call forwarding busy"; - case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_NO_REPLY: - return "call forwarding no reply"; - case PRI_AOC_E_BILLING_ID_CALL_DEFLECTION: - return "call deflection"; - case PRI_AOC_E_BILLING_ID_CALL_TRANSFER: - return "call transfer"; - default: - return "unknown\n"; - } -} - -static float aoc_money_amount(const struct pri_aoc_amount *amount) -{ - switch (amount->multiplier) { - case PRI_AOC_MULTIPLIER_THOUSANDTH: - return amount->cost * 0.001f; - case PRI_AOC_MULTIPLIER_HUNDREDTH: - return amount->cost * 0.01f; - case PRI_AOC_MULTIPLIER_TENTH: - return amount->cost * 0.1f; - case PRI_AOC_MULTIPLIER_TEN: - return amount->cost * 10.0f; - case PRI_AOC_MULTIPLIER_HUNDRED: - return amount->cost * 100.0f; - case PRI_AOC_MULTIPLIER_THOUSAND: - return amount->cost * 1000.0f; - default: - return amount->cost; - } -} - -static int handle_facility_aoc_s(const struct pri_subcmd_aoc_s *aoc_s) -{ - /* Left as an excercise to the reader */ - ftdm_unused_arg(aoc_s); - return 0; -} - -static int handle_facility_aoc_d(const struct pri_subcmd_aoc_d *aoc_d) -{ - /* Left as an excercise to the reader */ - ftdm_unused_arg(aoc_d); - return 0; -} - -static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e) -{ - char tmp[1024] = { 0 }; - int x = 0, offset = 0; - - switch (aoc_e->charge) { - case PRI_AOC_DE_CHARGE_FREE: - strcat(tmp, "\tcharge-type: none\n"); - offset = strlen(tmp); - break; - - case PRI_AOC_DE_CHARGE_CURRENCY: - sprintf(tmp, "\tcharge-type: money\n\tcharge-amount: %.2f\n\tcharge-currency: %s\n", - aoc_money_amount(&aoc_e->recorded.money.amount), - aoc_e->recorded.money.currency); - offset = strlen(tmp); - break; - - case PRI_AOC_DE_CHARGE_UNITS: - strcat(tmp, "\tcharge-type: units\n"); - offset = strlen(tmp); - - for (x = 0; x < aoc_e->recorded.unit.num_items; x++) { - sprintf(&tmp[offset], "\tcharge-amount: %ld (type: %d)\n", - aoc_e->recorded.unit.item[x].number, - aoc_e->recorded.unit.item[x].type); - offset += strlen(&tmp[offset]); - } - break; - - default: - strcat(tmp, "\tcharge-type: not available\n"); - offset = strlen(tmp); - } - - sprintf(&tmp[offset], "\tbilling-id: %s\n", aoc_billing_id(aoc_e->billing_id)); - offset += strlen(&tmp[offset]); - - strcat(&tmp[offset], "\tassociation-type: "); - offset += strlen(&tmp[offset]); - - switch (aoc_e->associated.charging_type) { - case PRI_AOC_E_CHARGING_ASSOCIATION_NOT_AVAILABLE: - strcat(&tmp[offset], "not available\n"); - break; - case PRI_AOC_E_CHARGING_ASSOCIATION_NUMBER: - sprintf(&tmp[offset], "number\n\tassociation-number: %s\n", aoc_e->associated.charge.number.str); - break; - case PRI_AOC_E_CHARGING_ASSOCIATION_ID: - sprintf(&tmp[offset], "id\n\tassociation-id: %d\n", aoc_e->associated.charge.id); - break; - default: - strcat(&tmp[offset], "unknown\n"); - } - - ftdm_log(FTDM_LOG_INFO, "AOC-E:\n%s", tmp); - return 0; -} -#endif - -#ifdef PRI_EVENT_FACILITY -/** - * \brief Handler for libpri facility events - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - struct pri_event_facility *pfac = &pevent->facility; - int i = 0; - - if (!pevent) - return 0; - - ftdm_log(FTDM_LOG_DEBUG, "Got a FACILITY event on span %d:%d\n", ftdm_span_get_id(spri->span), pfac->channel); - - if (!pfac->subcmds || pfac->subcmds->counter_subcmd <= 0) - return 0; - - for (i = 0; i < pfac->subcmds->counter_subcmd; i++) { - struct pri_subcommand *sub = &pfac->subcmds->subcmd[i]; - int res = -1; - - switch (sub->cmd) { -#ifdef HAVE_LIBPRI_AOC - case PRI_SUBCMD_AOC_S: /* AOC-S: Start of call */ - res = handle_facility_aoc_s(&sub->u.aoc_s); - break; - case PRI_SUBCMD_AOC_D: /* AOC-D: During call */ - res = handle_facility_aoc_d(&sub->u.aoc_d); - break; - case PRI_SUBCMD_AOC_E: /* AOC-E: End of call */ - res = handle_facility_aoc_e(&sub->u.aoc_e); - break; - case PRI_SUBCMD_AOC_CHARGING_REQ: - ftdm_log(FTDM_LOG_NOTICE, "AOC Charging Request received\n"); - break; - case PRI_SUBCMD_AOC_CHARGING_REQ_RSP: - ftdm_log(FTDM_LOG_NOTICE, "AOC Charging Request Response received [aoc_s data: %s, req: %x, resp: %x]\n", - sub->u.aoc_request_response.valid_aoc_s ? "yes" : "no", - sub->u.aoc_request_response.charging_request, - sub->u.aoc_request_response.charging_response); - break; -#endif - default: - ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d is not implemented, ignoring\n", sub->cmd); - } - - ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d handler returned %d\n", sub->cmd, res); - } - - ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); - return 0; -} -#endif - -/** - * \brief Handler for libpri dchan up event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_dchan_up(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_unused_arg(event_type); - ftdm_unused_arg(pevent); - - if (!ftdm_test_flag(spri, LPWRAP_PRI_READY)) { - ftdm_signaling_status_t status = FTDM_SIG_STATE_UP; - ftdm_span_t *span = spri->span; - ftdm_libpri_data_t *isdn_data = span->signal_data; - ftdm_sigmsg_t sig; - int i; - - ftdm_log(FTDM_LOG_INFO, "Span %d D-Channel UP!\n", ftdm_span_get_id(span)); - ftdm_set_flag(spri, LPWRAP_PRI_READY); - ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - - ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", ftdm_span_get_id(span), ftdm_signaling_status2str(status)); - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - - memset(&sig, 0, sizeof(sig)); - sig.span_id = ftdm_channel_get_span_id(chan); - sig.chan_id = ftdm_channel_get_id(chan); - sig.channel = chan; - sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.ev_data.sigstatus.status = status; - ftdm_span_send_signal(span, &sig); - } - - /* NT-mode idle b-channel restart timer */ - if (ftdm_span_get_trunk_type(span) != FTDM_TRUNK_BRI_PTMP && - isdn_data->mode == PRI_NETWORK && isdn_data->idle_restart_timeout_ms > 0) - { - ftdm_log_chan(isdn_data->dchan, FTDM_LOG_INFO, "Starting NT-mode idle b-channel restart timer (%d ms)\n", - isdn_data->idle_restart_timeout_ms); - lpwrap_start_timer(&isdn_data->spri, &isdn_data->t3xx, isdn_data->idle_restart_timeout_ms, &on_timeout_t3xx); - } - } - return 0; -} - -/** - * \brief Handler for libpri dchan down event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_unused_arg(event_type); - ftdm_unused_arg(pevent); - - if (ftdm_test_flag(spri, LPWRAP_PRI_READY)) { - ftdm_signaling_status_t status = FTDM_SIG_STATE_DOWN; - ftdm_span_t *span = spri->span; - ftdm_libpri_data_t *isdn_data = span->signal_data; - ftdm_sigmsg_t sig; - int i; - - ftdm_log(FTDM_LOG_INFO, "Span %d D-Channel DOWN!\n", ftdm_span_get_id(span)); - ftdm_clear_flag(spri, LPWRAP_PRI_READY); - ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - - ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", ftdm_span_get_id(span), ftdm_signaling_status2str(status)); - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - - memset(&sig, 0, sizeof(sig)); - sig.span_id = ftdm_channel_get_span_id(chan); - sig.chan_id = ftdm_channel_get_id(chan); - sig.channel = chan; - sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.ev_data.sigstatus.status = status; - - ftdm_span_send_signal(span, &sig); - - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - ftdm_libpri_b_chan_t *chan_priv = chan->call_data; - /* Stop T316 and reset counter */ - lpwrap_stop_timer(spri, &chan_priv->t316); - chan_priv->t316_timeout_cnt = 0; - } - } - - /* NT-mode idle b-channel restart timer */ - ftdm_log_chan_msg(isdn_data->dchan, FTDM_LOG_INFO, "Stopping NT-mode idle b-channel restart timer\n"); - lpwrap_stop_timer(&isdn_data->spri, &isdn_data->t3xx); - } - return 0; -} - -/** - * \brief Handler for any libpri event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_log(FTDM_LOG_DEBUG, "-- Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); - switch (pevent->e) { - case PRI_EVENT_CONFIG_ERR: - { - ftdm_log(FTDM_LOG_WARNING, "-- PRI error event: %s\n", pevent->err.err); - } - break; - } - return 0; -} - -/** - * \brief Handler for libpri io fail event - * \param spri Pri wrapper structure (libpri, span, dchan) - * \param event_type Event type (unused) - * \param pevent Event - * \return 0 - */ -static int on_io_fail(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ - ftdm_unused_arg(pevent); - - ftdm_log(FTDM_LOG_DEBUG, "-- Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); - return 0; -} - -/** - * \brief Main thread function for libpri span (monitor) - * \param me Current thread - * \param obj Span to run in this thread - * - * \todo Move all init stuff outside of loop or into ftdm_libpri_configure_span() - */ -static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) -{ - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_libpri_data_t *isdn_data = span->signal_data; - int down = 0; - int res = 0; - int i; - - ftdm_unused_arg(me); - - ftdm_set_flag(span, FTDM_SPAN_IN_THREAD); - isdn_data->dchan = NULL; - - /* - * Open D-Channel - */ - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_DQ921) { - if (ftdm_channel_open(ftdm_span_get_id(span), i, &isdn_data->dchan) == FTDM_SUCCESS) { - ftdm_log_chan_msg(chan, FTDM_LOG_DEBUG, "Opened D-Channel\n"); - break; - } else { - ftdm_log_chan_msg(chan, FTDM_LOG_CRIT, "Failed to open D-Channel\n"); - goto out; - } - } - } - - /* - * Initialize BRI/PRI context - */ - res = lpwrap_init_pri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->dialect, isdn_data->mode, isdn_data->debug_mask); - - if (res) { - ftdm_log(FTDM_LOG_CRIT, "Failed to initialize BRI/PRI on span %d\n", - ftdm_span_get_id(span)); - goto out; - } - -#ifdef HAVE_LIBPRI_AOC - /* - * Only enable facility on trunk if really required, - * this may help avoid problems on troublesome lines. - */ - if (isdn_data->opts & FTMOD_LIBPRI_OPT_FACILITY_AOC) { - pri_facility_enable(isdn_data->spri.pri); - } -#endif -#ifdef HAVE_LIBPRI_MAINT_SERVICE - /* Support the different switch of service status */ - if (isdn_data->service_message_support) { - pri_set_service_message_support(isdn_data->spri.pri, 1); - } -#endif - - /* Callbacks for libpri events */ - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_ANY, on_anything); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RING, on_ring); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RINGING, on_ringing); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_PROCEEDING, on_proceeding); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_PROGRESS, on_progress); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_ANSWER, on_answer); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_DCHAN_UP, on_dchan_up); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_DCHAN_DOWN, on_dchan_down); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_HANGUP_REQ, on_hangup); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_HANGUP_ACK, on_hangup); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_HANGUP, on_hangup); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_INFO_RECEIVED, on_information); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_KEYPAD_DIGIT, on_keypad_digit); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RESTART, on_restart); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RESTART_ACK, on_restart_ack); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_IO_FAIL, on_io_fail); -#ifdef PRI_EVENT_FACILITY - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_FACILITY, on_facility); -#endif - - /* Callback invoked on each iteration of the lpwrap_run_pri() event loop */ - isdn_data->spri.on_loop = check_flags; - - /* - * Event loop - */ - while (ftdm_running() && !ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { - if (down) { - ftdm_log(FTDM_LOG_INFO, "PRI back up on span %d\n", ftdm_span_get_id(span)); - ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - down = 0; - } - - lpwrap_run_pri(&isdn_data->spri); - - if (!ftdm_running() || ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { - break; - } - - ftdm_log(FTDM_LOG_CRIT, "PRI down on span %d\n", ftdm_span_get_id(span)); - if (isdn_data->spri.dchan) { - _ftdm_channel_set_state_force(isdn_data->spri.dchan, FTDM_CHANNEL_STATE_DOWN); - } - - if (!down) { - ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - check_state(span); - } - - check_state(span); - check_events(span); - - down = 1; - ftdm_sleep(5000); - } -out: - /* close d-channel, if set */ - if (isdn_data->dchan) { - if (ftdm_channel_close(&isdn_data->dchan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(isdn_data->dchan, FTDM_LOG_ERROR, "Failed to close D-Channel\n"); - } - } - - ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", ftdm_span_get_id(span)); - - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - ftdm_clear_flag(isdn_data, FTMOD_LIBPRI_RUNNING); - - lpwrap_destroy_pri(&isdn_data->spri); - return NULL; -} - -/** - * \brief Stops a libpri span - * \param span Span to halt - * \return Success - * - * Sets a stop flag and waits for the thread to end - */ -static ftdm_status_t ftdm_libpri_stop(ftdm_span_t *span) -{ - ftdm_libpri_data_t *isdn_data = span->signal_data; - - if (!ftdm_test_flag(isdn_data, FTMOD_LIBPRI_RUNNING)) { - ftdm_log(FTDM_LOG_DEBUG, "Span %d already stopped, continuing anyway...\n", ftdm_span_get_id(span)); - return FTDM_SUCCESS; - } - - ftdm_log(FTDM_LOG_INFO, "Stopping span [s%d][%s]\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - check_state(span); - - ftdm_set_flag(span, FTDM_SPAN_STOP_THREAD); - lpwrap_stop_pri(&isdn_data->spri); - - while (ftdm_test_flag(span, FTDM_SPAN_IN_THREAD)) { - ftdm_sleep(100); - } - - check_state(span); - - return FTDM_SUCCESS; -} - -/** - * \brief Starts a libpri span - * \param span Span to halt - * \return Success or failure - * - * Launches a thread to monitor the span - */ -static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) -{ - ftdm_libpri_data_t *isdn_data = span->signal_data; - - if (ftdm_test_flag(isdn_data, FTMOD_LIBPRI_RUNNING)) { - return FTDM_FAIL; - } - - ftdm_log(FTDM_LOG_INFO, "Starting span [s%d][%s]\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - ftdm_clear_flag(span, FTDM_SPAN_STOP_THREAD); - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - - ftdm_set_flag(isdn_data, FTMOD_LIBPRI_RUNNING); - - return ftdm_thread_create_detached(ftdm_libpri_run, span); -} - -/** - * \brief Converts a node string to node value - * \param node Node string to convert - * \return -1 on failure, node value on success - */ -static int parse_mode(const char *mode) -{ - if (!strcasecmp(mode, "cpe") || !strcasecmp(mode, "user")) - return PRI_CPE; - if (!strcasecmp(mode, "network") || !strcasecmp(mode, "net")) - return PRI_NETWORK; - - return -1; -} - -/** - * \brief Converts a switch string to switch value - * \param swtype Swtype string to convert - * \return Switch value - */ -static int parse_dialect(const char *dialect) -{ - if (!strcasecmp(dialect, "ni1")) - return PRI_SWITCH_NI1; - if (!strcasecmp(dialect, "ni2")) - return PRI_SWITCH_NI2; - if (!strcasecmp(dialect, "dms100")) - return PRI_SWITCH_DMS100; - if (!strcasecmp(dialect, "lucent5e") || !strcasecmp(dialect, "5ess")) - return PRI_SWITCH_LUCENT5E; - if (!strcasecmp(dialect, "att4ess") || !strcasecmp(dialect, "4ess")) - return PRI_SWITCH_ATT4ESS; - if (!strcasecmp(dialect, "euroisdn") || !strcasecmp(dialect, "q931")) - return PRI_SWITCH_EUROISDN_E1; - if (!strcasecmp(dialect, "gr303eoc")) - return PRI_SWITCH_GR303_EOC; - if (!strcasecmp(dialect, "gr303tmc")) - return PRI_SWITCH_GR303_TMC; - - return PRI_SWITCH_DMS100; -} - -/** - * \brief Converts a L1 string to L1 value - * \param l1 L1 string to convert - * \return L1 value - */ -static int parse_layer1(const char *val) -{ - if (!strcasecmp(val, "alaw")) - return PRI_LAYER_1_ALAW; - - return PRI_LAYER_1_ULAW; -} - -/** - * \brief Converts a DP string to DP value - * \param dp DP string to convert - * \return DP value - */ -static int parse_ton(const char *ton) -{ - if (!strcasecmp(ton, "international")) - return PRI_INTERNATIONAL_ISDN; - if (!strcasecmp(ton, "national")) - return PRI_NATIONAL_ISDN; - if (!strcasecmp(ton, "local")) - return PRI_LOCAL_ISDN; - if (!strcasecmp(ton, "private")) - return PRI_PRIVATE; - if (!strcasecmp(ton, "unknown")) - return PRI_UNKNOWN; - - return PRI_UNKNOWN; -} - -/** - * \brief Parse overlap string to value - * \param val String to parse - * \return Overlap flags - */ -static int parse_overlap_dial(const char *val) -{ - if (!strcasecmp(val, "yes") || !strcasecmp(val, "both")) - return FTMOD_LIBPRI_OVERLAP_BOTH; - if (!strcasecmp(val, "incoming") || !strcasecmp(val, "receive")) - return FTMOD_LIBPRI_OVERLAP_RECEIVE; - if (!strcasecmp(val, "outgoing") || !strcasecmp(val, "send")) - return FTMOD_LIBPRI_OVERLAP_SEND; - if (!strcasecmp(val, "no")) - return FTMOD_LIBPRI_OVERLAP_NONE; - - return -1; -} - -/** - * \brief Parses an option string to flags - * \param in String to parse for configuration options - * \return Flags - */ -static uint32_t parse_opts(const char *in) -{ - uint32_t flags = 0; - - if (!in) { - return 0; - } - - if (strstr(in, "suggest_channel")) { - flags |= FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL; - } - if (strstr(in, "omit_display")) { - flags |= FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE; - } - if (strstr(in, "omit_redirecting_number")) { - flags |= FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE; - } - if (strstr(in, "aoc")) { - flags |= FTMOD_LIBPRI_OPT_FACILITY_AOC; - } - return flags; -} - -/** - * Parse timeout value with (convenience) modifier suffix - * \param[in] in Input string, e.g. '1d' = 1 day, '7w' = 7 weeks, '3s' = 3 seconds - * \todo Could be simplified by using strtol() instead of atoi() - */ -static int parse_timeout(const char *in) -{ - const char *p_end = NULL, *p_start = in; - int msec = 0; - - if (ftdm_strlen_zero(in)) - return 0; - - p_end = in + strlen(in); - - /* skip whitespace at start */ - while (p_start != p_end && *p_start == ' ') - p_start++; - - /* skip whitespace at end */ - while (p_end != p_start && (*p_end == ' ' || *p_end == '\0')) - p_end--; - - msec = atoi(p_start); - - switch (p_end[0]) { - case 's': /* seconds */ - msec *= 1000; - break; - case 'm': /* minutes */ - if (p_end[1] != 's') msec *= 60 * 1000; - break; - case 'h': /* hours */ - msec *= 3600 * 1000; - break; - case 'd': /* days */ - msec *= 86400 * 1000; - break; - case 'w': /* weeks */ - msec *= 604800 * 1000; - break; - default: /* miliseconds */ - break; - } - return msec; -} - -/** - * \brief Initialises a libpri span from configuration variables - * \param span Span to configure - * \param sig_cb Callback function for event signals - * \param ftdm_parameters List of configuration variables - * \return Success or failure - */ -static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) -{ - ftdm_libpri_data_t *isdn_data = NULL; - uint32_t bchan_count = 0; - uint32_t dchan_count = 0; - uint32_t i; - - if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_span_get_trunk_type_str(span)); - ftdm_span_set_trunk_type(span, FTDM_TRUNK_T1); - } - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - - switch (ftdm_channel_get_type(chan)) { - case FTDM_CHAN_TYPE_DQ921: - if (dchan_count > 1) { - ftdm_log(FTDM_LOG_ERROR, "Span has more than 2 D-Channels!\n"); - return FTDM_FAIL; - } - dchan_count++; - break; - case FTDM_CHAN_TYPE_B: - bchan_count++; - break; - default: /* Ignore other channel types */ - break; - } - } - if (!dchan_count) { - ftdm_log(FTDM_LOG_ERROR, "Span has no D-Channel!\n"); - return FTDM_FAIL; - } - if (!bchan_count) { - ftdm_log(FTDM_LOG_ERROR, "Span has no B-Channels!\n"); - return FTDM_FAIL; - } - - isdn_data = ftdm_malloc(sizeof(*isdn_data)); - assert(isdn_data != NULL); - memset(isdn_data, 0, sizeof(*isdn_data)); - - /* set some default values */ - isdn_data->ton = PRI_UNKNOWN; - isdn_data->overlap_timeout_ms = OVERLAP_TIMEOUT_MS_DEFAULT; - isdn_data->idle_restart_timeout_ms = IDLE_RESTART_TIMEOUT_MS_DEFAULT; - - /* - * T316 restart ack timeout and retry limit - * (ITU-T Q.931 05/98 Paragraph 5.5.1 and Table 9-1) - */ - isdn_data->t316_timeout_ms = T316_TIMEOUT_MS_DEFAULT; - isdn_data->t316_max_attempts = T316_ATTEMPT_LIMIT_DEFAULT; - - - /* Use span's trunk_mode as a reference for the default libpri mode */ - if (ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET) { - isdn_data->mode = PRI_NETWORK; - } else { - isdn_data->mode = PRI_CPE; - } - - switch (ftdm_span_get_trunk_type(span)) { - case FTDM_TRUNK_BRI: - case FTDM_TRUNK_BRI_PTMP: -#ifndef HAVE_LIBPRI_BRI - ftdm_log(FTDM_LOG_ERROR, "Unsupported trunk type: '%s', libpri too old\n", ftdm_span_get_trunk_type_str(span)); - goto error; -#endif - case FTDM_TRUNK_E1: - ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1/BRI/BRI PTMP trunk\n"); - isdn_data->layer1 = PRI_LAYER_1_ALAW; - isdn_data->dialect = PRI_SWITCH_EUROISDN_E1; - break; - case FTDM_TRUNK_T1: - case FTDM_TRUNK_J1: - ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ULAW since this is a T1/J1 trunk\n"); - isdn_data->layer1 = PRI_LAYER_1_ULAW; - isdn_data->dialect = PRI_SWITCH_LUCENT5E; - break; - default: - ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_span_get_trunk_type_str(span)); - goto error; - } - - /* - * Init MSN filter - */ - if (msn_filter_init(isdn_data) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to init MSN filter\n"); - goto error; - } - - for (i = 0; ftdm_parameters[i].var; i++) { - const char *var = ftdm_parameters[i].var; - const char *val = ftdm_parameters[i].val; - - if (ftdm_strlen_zero(var)) { - ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with no name\n"); - continue; - } - - if (ftdm_strlen_zero(val)) { - ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); - goto error; - } - - if (!strcasecmp(var, "node") || !strcasecmp(var, "mode")) { - if ((isdn_data->mode = parse_mode(val)) == -1) { - ftdm_log(FTDM_LOG_ERROR, "Unknown node type '%s'\n", val); - goto error; - } - } - else if (!strcasecmp(var, "switch") || !strcasecmp(var, "dialect")) { - isdn_data->dialect = parse_dialect(val); - } - else if (!strcasecmp(var, "opts")) { - isdn_data->opts = parse_opts(val); - } - else if (!strcasecmp(var, "dp") || !strcasecmp(var, "ton")) { - isdn_data->ton = parse_ton(val); - } - else if (!strcasecmp(var, "l1") || !strcasecmp(var, "layer1")) { - isdn_data->layer1 = parse_layer1(val); - } - else if (!strcasecmp(var, "overlapdial")) { - if ((isdn_data->overlap = parse_overlap_dial(val)) == -1) { - ftdm_log(FTDM_LOG_ERROR, "Invalid overlap flag, ignoring parameter\n"); - isdn_data->overlap = FTMOD_LIBPRI_OVERLAP_NONE; - } - } - else if (!strcasecmp(var, "digit_timeout") || !strcasecmp(var, "t302")) { - int tmp = parse_timeout(val); - if (!tmp) { - isdn_data->overlap_timeout_ms = 0; /* disabled */ - } - else if ((isdn_data->overlap_timeout_ms = ftdm_clamp(tmp, OVERLAP_TIMEOUT_MS_MIN, OVERLAP_TIMEOUT_MS_MAX)) != tmp) { - ftdm_log(FTDM_LOG_WARNING, "'%s' value %d ms ('%s') outside of range [%d:%d] ms, using %d ms instead\n", - var, tmp, val, OVERLAP_TIMEOUT_MS_MIN, OVERLAP_TIMEOUT_MS_MAX, - isdn_data->overlap_timeout_ms); - } - } - else if (!strcasecmp(var, "idle_restart_interval")) { - int tmp = parse_timeout(val); - if (!tmp) { - isdn_data->idle_restart_timeout_ms = 0; /* disabled */ - } - else if ((isdn_data->idle_restart_timeout_ms = ftdm_clamp(tmp, IDLE_RESTART_TIMEOUT_MS_MIN, IDLE_RESTART_TIMEOUT_MS_MAX)) != tmp) { - ftdm_log(FTDM_LOG_WARNING, "'%s' value %d ms ('%s') outside of range [%d:%d] ms, using %d ms instead\n", - var, tmp, val, IDLE_RESTART_TIMEOUT_MS_MIN, IDLE_RESTART_TIMEOUT_MS_MAX, - isdn_data->idle_restart_timeout_ms); - } - } - else if (!strcasecmp(var, "restart_timeout") || !strcasecmp(var, "t316")) { - int tmp = parse_timeout(val); - if (tmp <= 0) { - ftdm_log(FTDM_LOG_ERROR, "'%s' value '%s' is invalid\n", var, val); - goto error; - } - else if ((isdn_data->t316_timeout_ms = ftdm_clamp(tmp, T316_TIMEOUT_MS_MIN, T316_TIMEOUT_MS_MAX)) != tmp) { - ftdm_log(FTDM_LOG_WARNING, "'%s' value %d ms ('%s') outside of range [%d:%d] ms, using %d ms instead\n", - var, tmp, val, T316_TIMEOUT_MS_MIN, T316_TIMEOUT_MS_MAX, - isdn_data->t316_timeout_ms); - } - } - else if (!strcasecmp(var, "restart_attempts") || !strcasecmp(var, "t316_limit")) { - int tmp = atoi(val); - if (tmp <= 0) { - ftdm_log(FTDM_LOG_ERROR, "'%s' value '%s' is invalid\n", var, val); - goto error; - } - else if ((isdn_data->t316_max_attempts = ftdm_clamp(tmp, T316_ATTEMPT_LIMIT_MIN, T316_ATTEMPT_LIMIT_MAX)) != tmp) { - ftdm_log(FTDM_LOG_WARNING, "'%s' value %d ('%s') outside of range [%d:%d], using %d instead\n", - var, tmp, val, T316_ATTEMPT_LIMIT_MIN, T316_ATTEMPT_LIMIT_MAX, - isdn_data->t316_max_attempts); - } - } - else if (!strcasecmp(var, "debug")) { - if (parse_debug(val, &isdn_data->debug_mask) == -1) { - ftdm_log(FTDM_LOG_ERROR, "Invalid debug flag, ignoring parameter\n"); - isdn_data->debug_mask = 0; - } - } - else if (!strcasecmp(var, "service_message_support")) { - if (ftdm_true(val)) { - isdn_data->service_message_support = 1; - } - } - else if (!strcasecmp(var, "local-number") || !strcasecmp(var, "msn")) { - if (msn_filter_add(isdn_data, val) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Invalid MSN/DDI(s) '%s' specified\n", val); - goto error; - } - } - else { - ftdm_log(FTDM_LOG_ERROR, "Unknown parameter '%s', aborting configuration\n", var); - goto error; - } - } - - /* Check if modes match and log a message if they do not. Just to be on the safe side. */ - if (isdn_data->mode == PRI_CPE && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET) { - ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for TE/CPE/USER mode, while port is running in NT/NET mode. You may want to check your 'trunk_mode' settings.\n", - ftdm_span_get_name(span)); - } - else if (isdn_data->mode == PRI_NETWORK && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_CPE) { - ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for NT/NET mode, while port is running in TE/CPE/USER mode. You may want to check your 'trunk_mode' settings.\n", - ftdm_span_get_name(span)); - } - - span->start = ftdm_libpri_start; - span->stop = ftdm_libpri_stop; - span->signal_cb = sig_cb; - - span->signal_data = isdn_data; - span->signal_type = FTDM_SIGTYPE_ISDN; - span->outgoing_call = isdn_outgoing_call; - - span->state_map = &isdn_state_map; - span->state_processor = state_advance; - - span->get_channel_sig_status = isdn_get_channel_sig_status; - span->get_span_sig_status = isdn_get_span_sig_status; - - /* move calls to PROCEED state when they hit dialplan (ROUTING state in FreeSWITCH) */ - ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); - - if ((isdn_data->opts & FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL)) { - span->channel_request = isdn_channel_request; - ftdm_set_flag(span, FTDM_SPAN_SUGGEST_CHAN_ID); - } - - /* Allocate per-channel private data */ - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - - if (!chan) - continue; - - if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - ftdm_libpri_b_chan_t *priv = NULL; - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - ftdm_log_chan_msg(chan, FTDM_LOG_CRIT, "Failed to allocate per-channel private data\n"); - goto error; - } - priv->channel = chan; - chan->call_data = priv; - } - } - return FTDM_SUCCESS; -error: - /* TODO: free per-channel private data */ - msn_filter_destroy(isdn_data); - ftdm_safe_free(isdn_data); - return FTDM_FAIL; -} - -/** - * \brief FreeTDM libpri signaling and IO module definition - */ -ftdm_module_t ftdm_module = { - "libpri", - ftdm_libpri_io_init, - ftdm_libpri_unload, - ftdm_libpri_init, - NULL, - NULL, - ftdm_libpri_configure_span -}; - -/* 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/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h deleted file mode 100644 index 8ace29693b..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2009-2012, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef FTMOD_LIBPRI_H -#define FTMOD_LIBPRI_H -#include "freetdm.h" -#include "lpwrap_pri.h" - -/* T302 Overlap receiving inter-digit timeout */ -#define OVERLAP_TIMEOUT_MS_DEFAULT 5000 /* 5 sec */ -#define OVERLAP_TIMEOUT_MS_MIN 3000 /* 3 sec */ -#define OVERLAP_TIMEOUT_MS_MAX 30000 /* 30 sec */ - -/* NT-mode idle b-channel restart timer */ -#define IDLE_RESTART_TIMEOUT_MS_DEFAULT 0 /* disabled */ -#define IDLE_RESTART_TIMEOUT_MS_MIN 10000 /* 10 sec */ -#define IDLE_RESTART_TIMEOUT_MS_MAX 86400000 /* 1 day */ - -/* T316 RESTART ACK wait timer */ -#define T316_TIMEOUT_MS_DEFAULT 30000 /* 30 sec */ -#define T316_TIMEOUT_MS_MIN 10000 /* 10 sec */ -#define T316_TIMEOUT_MS_MAX 300000 /* 5 min */ - -/* T316 restart attempts until channel is suspended */ -#define T316_ATTEMPT_LIMIT_DEFAULT 3 -#define T316_ATTEMPT_LIMIT_MIN 1 -#define T316_ATTEMPT_LIMIT_MAX 10 - - -typedef enum { - SERVICE_CHANGE_STATUS_INSERVICE = 0, - SERVICE_CHANGE_STATUS_MAINTENANCE, - SERVICE_CHANGE_STATUS_OUTOFSERVICE -} service_change_status_t; - -typedef enum { - FTMOD_LIBPRI_OPT_NONE = 0, - FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL = (1 << 0), - FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE = (1 << 1), - FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE = (1 << 2), - FTMOD_LIBPRI_OPT_FACILITY_AOC = (1 << 3), - - FTMOD_LIBPRI_OPT_MAX = (1 << 4) -} ftdm_isdn_opts_t; - -typedef enum { - FTMOD_LIBPRI_RUNNING = (1 << 0) -} ftdm_isdn_flag_t; - -typedef enum { - FTMOD_LIBPRI_OVERLAP_NONE = 0, - FTMOD_LIBPRI_OVERLAP_RECEIVE = (1 << 0), - FTMOD_LIBPRI_OVERLAP_SEND = (1 << 1) -#define FTMOD_LIBPRI_OVERLAP_BOTH (FTMOD_LIBPRI_OVERLAP_RECEIVE | FTMOD_LIBPRI_OVERLAP_SEND) -} ftdm_isdn_overlap_t; - -struct ftdm_libpri_data { - ftdm_channel_t *dchan; - ftdm_isdn_opts_t opts; - uint32_t flags; - uint32_t debug_mask; - - int mode; - int dialect; - int overlap; /*!< Overlap dial flags */ - int overlap_timeout_ms; /*!< Overlap dial timeout */ - int idle_restart_timeout_ms; /*!< NT-mode idle b-channel restart */ - int t316_timeout_ms; /*!< T316 RESTART ACK timeout */ - int t316_max_attempts; /*!< T316 timeout limit */ - unsigned int layer1; - unsigned int ton; - unsigned int service_message_support; - - lpwrap_pri_t spri; - - /* MSN filter */ - ftdm_hash_t *msn_hash; - ftdm_mutex_t *msn_mutex; - - /* NT-mode idle restart timer */ - struct lpwrap_timer t3xx; -}; - -typedef struct ftdm_libpri_data ftdm_libpri_data_t; - - -/* - * b-channel flags - */ -enum { - FTDM_LIBPRI_B_NONE = 0, - FTDM_LIBPRI_B_REMOTE_RESTART = (1 << 0), /*!< Remote triggered channel restart */ -}; - -/** - * Per-b-channel private data - */ -struct ftdm_libpri_b_chan { - struct lpwrap_timer t302; /*!< T302 overlap receive timer */ - struct lpwrap_timer t316; /*!< T316 restart ack timer */ - ftdm_channel_t *channel; /*!< back-pointer to b-channel */ - q931_call *call; /*!< libpri opaque call handle */ - uint32_t flags; /*!< channel flags */ - uint32_t t316_timeout_cnt; /*!< T316 timeout counter */ - int peerhangup; /*!< hangup requested from libpri (RELEASE/RELEASE_ACK/DL_RELEASE/TIMERS EXPIRY) */ -}; - -typedef struct ftdm_libpri_b_chan ftdm_libpri_b_chan_t; - -#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/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c deleted file mode 100644 index a59baccbe5..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Copyright (c) 2009-2012, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//#define IODEBUG - -#include "private/ftdm_core.h" -#include "lpwrap_pri.h" - -static struct lpwrap_pri_event_list LPWRAP_PRI_EVENT_LIST[LPWRAP_PRI_EVENT_MAX] = { - {0, LPWRAP_PRI_EVENT_ANY, "ANY"}, - {1, LPWRAP_PRI_EVENT_DCHAN_UP, "DCHAN_UP"}, - {2, LPWRAP_PRI_EVENT_DCHAN_DOWN, "DCHAN_DOWN"}, - {3, LPWRAP_PRI_EVENT_RESTART, "RESTART"}, - {4, LPWRAP_PRI_EVENT_CONFIG_ERR, "CONFIG_ERR"}, - {5, LPWRAP_PRI_EVENT_RING, "RING"}, - {6, LPWRAP_PRI_EVENT_HANGUP, "HANGUP"}, - {7, LPWRAP_PRI_EVENT_RINGING, "RINGING"}, - {8, LPWRAP_PRI_EVENT_ANSWER, "ANSWER"}, - {9, LPWRAP_PRI_EVENT_HANGUP_ACK, "HANGUP_ACK"}, - {10, LPWRAP_PRI_EVENT_RESTART_ACK, "RESTART_ACK"}, - {11, LPWRAP_PRI_EVENT_FACILITY, "FACILITY"}, - {12, LPWRAP_PRI_EVENT_INFO_RECEIVED, "INFO_RECEIVED"}, - {13, LPWRAP_PRI_EVENT_PROCEEDING, "PROCEEDING"}, - {14, LPWRAP_PRI_EVENT_SETUP_ACK, "SETUP_ACK"}, - {15, LPWRAP_PRI_EVENT_HANGUP_REQ, "HANGUP_REQ"}, - {16, LPWRAP_PRI_EVENT_NOTIFY, "NOTIFY"}, - {17, LPWRAP_PRI_EVENT_PROGRESS, "PROGRESS"}, - {18, LPWRAP_PRI_EVENT_KEYPAD_DIGIT, "KEYPAD_DIGIT"}, - {19, LPWRAP_PRI_EVENT_IO_FAIL, "IO_FAIL"}, -}; - -const char *lpwrap_pri_event_str(lpwrap_pri_event_t event_id) -{ - if (event_id >= LPWRAP_PRI_EVENT_MAX) - return ""; - - return LPWRAP_PRI_EVENT_LIST[event_id].name; -} - -static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen) -{ - struct lpwrap_pri *spri = (struct lpwrap_pri *) pri_get_userdata(pri); - ftdm_size_t len = buflen; - ftdm_status_t zst; - int res; - - if ((zst = ftdm_channel_read(spri->dchan, buf, &len)) != FTDM_SUCCESS) { - if (zst == FTDM_FAIL) { - ftdm_log(FTDM_LOG_CRIT, "span %d D-READ FAIL! [%s]\n", spri->span->span_id, spri->dchan->last_error); - spri->errs++; - } else { - ftdm_log(FTDM_LOG_CRIT, "span %d D-READ TIMEOUT\n", spri->span->span_id); - } - /* we cannot return -1, libpri seems to expect values >= 0 */ - return 0; - } - spri->errs = 0; - res = (int)len; - - if (res > 0) { - memset(&((unsigned char*)buf)[res], 0, 2); - res += 2; -#ifdef IODEBUG - { - char bb[2048] = { 0 }; - - print_hex_bytes(buf, res - 2, bb, sizeof(bb)); - ftdm_log(FTDM_LOG_DEBUG, "READ %d\n", res - 2); - } -#endif - } - return res; -} - -static int __pri_lpwrap_write(struct pri *pri, void *buf, int buflen) -{ - struct lpwrap_pri *spri = (struct lpwrap_pri *) pri_get_userdata(pri); - ftdm_size_t len = buflen - 2; - - if (ftdm_channel_write(spri->dchan, buf, buflen, &len) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "span %d D-WRITE FAIL! [%s]\n", spri->span->span_id, spri->dchan->last_error); - /* we cannot return -1, libpri seems to expect values >= 0 */ - return 0; - } - -#ifdef IODEBUG - { - char bb[2048] = { 0 }; - - print_hex_bytes(buf, buflen - 2, bb, sizeof(bb)); - ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n", (int)buflen - 2); - } -#endif - return (int)buflen; -} - - -/* - * Unified init function for BRI + PRI libpri spans - */ -int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int debug) -{ - int ret = -1; - - memset(spri, 0, sizeof(struct lpwrap_pri)); - spri->dchan = dchan; - spri->span = span; - - if (!spri->dchan) { - ftdm_log(FTDM_LOG_ERROR, "No D-Channel available, unable to create BRI/PRI\n"); - return ret; - } - - if (ftdm_mutex_create(&spri->timer_mutex) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to create timer list mutex\n"); - return ret; - } - - switch (ftdm_span_get_trunk_type(span)) { - case FTDM_TRUNK_E1: - case FTDM_TRUNK_J1: - case FTDM_TRUNK_T1: - spri->pri = pri_new_cb(spri->dchan->sockfd, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri); - break; -#ifdef HAVE_LIBPRI_BRI - case FTDM_TRUNK_BRI: - spri->pri = pri_new_bri_cb(spri->dchan->sockfd, 1, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri); - break; - case FTDM_TRUNK_BRI_PTMP: - spri->pri = pri_new_bri_cb(spri->dchan->sockfd, 0, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri); - break; -#endif - default: - ftdm_log(FTDM_LOG_CRIT, "Invalid/unsupported trunk type '%s'\n", - ftdm_span_get_trunk_type_str(span)); - ftdm_mutex_destroy(&spri->timer_mutex); - return ret; - } - - if (spri->pri) { - pri_set_debug(spri->pri, debug); -#ifdef HAVE_LIBPRI_BRI - /* "follow Q.931 Section 5.3.2 call hangup better" */ - pri_hangup_fix_enable(spri->pri, 1); -#endif -#ifdef HAVE_LIBPRI_AOC - pri_aoc_events_enable(spri->pri, 1); -#endif - ret = 0; - } else { - ftdm_log(FTDM_LOG_CRIT, "Unable to create BRI/PRI\n"); - ftdm_mutex_destroy(&spri->timer_mutex); - } - return ret; -} - - -#define timeval_to_ms(x) \ - (ftdm_time_t)(((x)->tv_sec * 1000) + ((x)->tv_usec / 1000)) - -int lpwrap_start_timer(struct lpwrap_pri *spri, struct lpwrap_timer *timer, const uint32_t timeout_ms, timeout_handler callback) -{ - struct lpwrap_timer **prev, *cur; - - if (!spri || !timer || timer->timeout) - return -1; - - ftdm_log_chan(spri->dchan, FTDM_LOG_DEBUG, "-- Starting timer %p with timeout %u ms\n", - timer, timeout_ms); - - timer->timeout = ftdm_current_time_in_ms() + timeout_ms; - timer->callback = callback; - timer->next = NULL; - - ftdm_mutex_lock(spri->timer_mutex); - - for (prev = &spri->timer_list, cur = spri->timer_list; cur; prev = &(*prev)->next, cur = cur->next) { - if (cur->timeout > timer->timeout) { - *prev = timer; - timer->next = cur; - break; - } - } - if (!cur) { - *prev = timer; - } - - ftdm_mutex_unlock(spri->timer_mutex); - return 0; -} - -int lpwrap_stop_timer(struct lpwrap_pri *spri, struct lpwrap_timer *timer) -{ - struct lpwrap_timer **prev, *cur; - - if (!spri || !timer) - return -1; - - if (!timer->timeout) - return 0; - - ftdm_log_chan(spri->dchan, FTDM_LOG_DEBUG, "-- Stopping timer %p\n", timer); - - ftdm_mutex_lock(spri->timer_mutex); - - for (prev = &spri->timer_list, cur = spri->timer_list; cur; prev = &(*prev)->next, cur = cur->next) { - if (cur == timer) { - *prev = cur->next; - break; - } - } - - ftdm_mutex_unlock(spri->timer_mutex); - - if (!cur) { - ftdm_log_chan(spri->dchan, FTDM_LOG_WARNING, "-- Timer %p not found in list\n", timer); - } - - timer->next = NULL; - timer->timeout = 0; - timer->callback = NULL; - return 0; -} - -static struct lpwrap_timer *lpwrap_timer_next(struct lpwrap_pri *spri) -{ - return spri ? spri->timer_list : NULL; -} - -static int lpwrap_run_expired(struct lpwrap_pri *spri, ftdm_time_t now_ms) -{ - struct lpwrap_timer *expired_list = NULL; - struct lpwrap_timer **prev, *cur; - - if (!spri || !spri->timer_list) - return 0; - - ftdm_mutex_lock(spri->timer_mutex); - - /* Move all timers to expired list */ - expired_list = spri->timer_list; - - for (prev = &expired_list, cur = expired_list; cur; prev = &(*prev)->next, cur = cur->next) { - if (cur->timeout > now_ms) { - *prev = NULL; - break; - } - } - /* Move non-expired timer to front of timer_list (or clear list if there are none) */ - spri->timer_list = cur; - - ftdm_mutex_unlock(spri->timer_mutex); - - /* fire callbacks */ - while ((cur = expired_list)) { - timeout_handler handler = cur->callback; - expired_list = cur->next; - - /* Stop timer */ - cur->next = NULL; - cur->timeout = 0; - cur->callback = NULL; - - if (handler) - handler(spri, cur); - } - return 0; -} - - -#define LPWRAP_MAX_TIMEOUT_MS 100 -#define LPWRAP_MAX_ERRORS 2 - -int lpwrap_run_pri_once(struct lpwrap_pri *spri) -{ - struct timeval *next = NULL; - struct lpwrap_timer *timer = NULL; - pri_event *event = NULL; - ftdm_wait_flag_t flags; - ftdm_time_t now_ms, next_ms, timeout_ms, tmp_ms; - int ret; - - if (spri->on_loop) { - if ((ret = spri->on_loop(spri)) < 0) - return FTDM_FAIL; - } - - /* Default timeout when no scheduled events are pending */ - timeout_ms = LPWRAP_MAX_TIMEOUT_MS; - next_ms = 0; - now_ms = ftdm_current_time_in_ms(); - - /* - * Get the next scheduled timer from libpri to set the maximum timeout, - * but limit it to MAX_TIMEOUT_MS (100ms). - */ - if ((next = pri_schedule_next(spri->pri))) { - next_ms = timeval_to_ms(next); - if (now_ms >= next_ms) { - /* Already late, handle timeout */ - timeout_ms = 0; - } else { - /* Calculate new timeout and limit it to MAX_TIMEOUT_MS miliseconds */ - tmp_ms = ftdm_min(next_ms - now_ms, LPWRAP_MAX_TIMEOUT_MS); - timeout_ms = ftdm_min(timeout_ms, tmp_ms); - } - } - - /* - * Next lpwrap_timer timeout - */ - if ((timer = lpwrap_timer_next(spri))) { - if (now_ms >= timer->timeout) { - /* Already late, handle timeout */ - timeout_ms = 0; - } else { - /* Calculate new timeout and limit it to MAX_TIMEOUT_MS miliseconds */ - tmp_ms = ftdm_min(timer->timeout - now_ms, LPWRAP_MAX_TIMEOUT_MS); - timeout_ms = ftdm_min(timeout_ms, tmp_ms); - } - } - - /* */ - if (timeout_ms > 0) { - flags = FTDM_READ | FTDM_EVENTS; - ret = ftdm_channel_wait(spri->dchan, &flags, timeout_ms); - - if (spri->flags & LPWRAP_PRI_ABORT) - return FTDM_SUCCESS; - - if (ret == FTDM_TIMEOUT) { - now_ms = ftdm_current_time_in_ms(); - - if (next) { - if (next_ms < now_ms) { - ftdm_log_chan(spri->dchan, FTDM_LOG_DEBUG, "pri timer %d ms late\n", - (int)(now_ms - next_ms)); - } - event = pri_schedule_run(spri->pri); - } - if (timer) { - if (timer->timeout < now_ms) { - ftdm_log_chan(spri->dchan, FTDM_LOG_DEBUG, "lpwrap timer %d ms late\n", - (int)(now_ms - timer->timeout)); - } - lpwrap_run_expired(spri, now_ms); - } - } else if (flags & (FTDM_READ | FTDM_EVENTS)) { - event = pri_check_event(spri->pri); - } - } else { - /* - * Scheduled event has already expired, handle it immediately - */ - if (next) { - event = pri_schedule_run(spri->pri); - } - if (timer) { - lpwrap_run_expired(spri, now_ms); - } - } - - if (spri->flags & LPWRAP_PRI_ABORT) - return FTDM_SUCCESS; - - if (event) { - event_handler handler; - - /* 0 is catchall event handler */ - if (event->e < 0 || event->e >= LPWRAP_PRI_EVENT_MAX) { - handler = spri->eventmap[0]; - } else if (spri->eventmap[event->e]) { - handler = spri->eventmap[event->e]; - } else { - handler = spri->eventmap[0]; - } - - if (handler) { - handler(spri, event->e, event); - } else { - ftdm_log(FTDM_LOG_CRIT, "No event handler found for event %d.\n", event->e); - } - } - - return FTDM_SUCCESS; -} - -int lpwrap_run_pri(struct lpwrap_pri *spri) -{ - int ret = 0; - - while (!(spri->flags & LPWRAP_PRI_ABORT)) { - ret = lpwrap_run_pri_once(spri); - if (ret) { - ftdm_log(FTDM_LOG_ERROR, "Error = %d, [%s]\n", - ret, strerror(errno)); - spri->errs++; - } else { - spri->errs = 0; - } - if (!ftdm_running()) - break; - if (spri->errs >= LPWRAP_MAX_ERRORS) { - ftdm_log(FTDM_LOG_CRIT, "Too many errors on span, restarting\n"); - spri->errs = 0; - break; - } - } - return ret; -} - -int lpwrap_stop_pri(struct lpwrap_pri *spri) -{ - spri->flags |= LPWRAP_PRI_ABORT; - return FTDM_SUCCESS; -} - -int lpwrap_destroy_pri(struct lpwrap_pri *spri) -{ - if (spri->timer_mutex) - ftdm_mutex_destroy(&spri->timer_mutex); - return FTDM_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: - */ diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h deleted file mode 100644 index 89708da270..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2009-2012, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _LPWRAP_PRI_H -#define _LPWRAP_PRI_H -#include -#include - - -#define LPWRAP_MAX_CHAN_PER_SPAN 32 - -typedef enum { - LPWRAP_PRI_EVENT_ANY = 0, - LPWRAP_PRI_EVENT_DCHAN_UP = PRI_EVENT_DCHAN_UP, - LPWRAP_PRI_EVENT_DCHAN_DOWN = PRI_EVENT_DCHAN_DOWN, - LPWRAP_PRI_EVENT_RESTART = PRI_EVENT_RESTART, - LPWRAP_PRI_EVENT_CONFIG_ERR = PRI_EVENT_CONFIG_ERR, - LPWRAP_PRI_EVENT_RING = PRI_EVENT_RING, - LPWRAP_PRI_EVENT_HANGUP = PRI_EVENT_HANGUP, - LPWRAP_PRI_EVENT_RINGING = PRI_EVENT_RINGING, - LPWRAP_PRI_EVENT_ANSWER = PRI_EVENT_ANSWER, - LPWRAP_PRI_EVENT_HANGUP_ACK = PRI_EVENT_HANGUP_ACK, - LPWRAP_PRI_EVENT_RESTART_ACK = PRI_EVENT_RESTART_ACK, -#ifdef PRI_EVENT_FACILITY - LPWRAP_PRI_EVENT_FACILITY = PRI_EVENT_FACILITY, -#else - LPWRAP_PRI_EVENT_FACILITY = PRI_EVENT_FACNAME, -#endif - LPWRAP_PRI_EVENT_INFO_RECEIVED = PRI_EVENT_INFO_RECEIVED, - LPWRAP_PRI_EVENT_PROCEEDING = PRI_EVENT_PROCEEDING, - LPWRAP_PRI_EVENT_SETUP_ACK = PRI_EVENT_SETUP_ACK, - LPWRAP_PRI_EVENT_HANGUP_REQ = PRI_EVENT_HANGUP_REQ, - LPWRAP_PRI_EVENT_NOTIFY = PRI_EVENT_NOTIFY, - LPWRAP_PRI_EVENT_PROGRESS = PRI_EVENT_PROGRESS, - LPWRAP_PRI_EVENT_KEYPAD_DIGIT = PRI_EVENT_KEYPAD_DIGIT, - LPWRAP_PRI_EVENT_IO_FAIL = 19, - - /* don't touch */ - LPWRAP_PRI_EVENT_MAX -} lpwrap_pri_event_t; - -typedef enum { - LPWRAP_PRI_NETWORK = PRI_NETWORK, - LPWRAP_PRI_CPE = PRI_CPE -} lpwrap_pri_node_t; - -typedef enum { - LPWRAP_PRI_SWITCH_UNKNOWN = PRI_SWITCH_UNKNOWN, - LPWRAP_PRI_SWITCH_NI2 = PRI_SWITCH_NI2, - LPWRAP_PRI_SWITCH_DMS100 = PRI_SWITCH_DMS100, - LPWRAP_PRI_SWITCH_LUCENT5E = PRI_SWITCH_LUCENT5E, - LPWRAP_PRI_SWITCH_ATT4ESS = PRI_SWITCH_ATT4ESS, - LPWRAP_PRI_SWITCH_EUROISDN_E1 = PRI_SWITCH_EUROISDN_E1, - LPWRAP_PRI_SWITCH_EUROISDN_T1 = PRI_SWITCH_EUROISDN_T1, - LPWRAP_PRI_SWITCH_NI1 = PRI_SWITCH_NI1, - LPWRAP_PRI_SWITCH_GR303_EOC = PRI_SWITCH_GR303_EOC, - LPWRAP_PRI_SWITCH_GR303_TMC = PRI_SWITCH_GR303_TMC, - LPWRAP_PRI_SWITCH_QSIG = PRI_SWITCH_QSIG, - - /* don't touch */ - LPWRAP_PRI_SWITCH_MAX -} lpwrap_pri_switch_t; - -typedef enum { - LPWRAP_PRI_READY = (1 << 0), - LPWRAP_PRI_ABORT = (1 << 1) -} lpwrap_pri_flag_t; - -struct lpwrap_pri; -struct lpwrap_timer; - -typedef int (*timeout_handler)(struct lpwrap_pri *, struct lpwrap_timer *); -typedef int (*event_handler)(struct lpwrap_pri *, lpwrap_pri_event_t, pri_event *); -typedef int (*loop_handler)(struct lpwrap_pri *); - -struct lpwrap_pri { - struct pri *pri; - ftdm_span_t *span; - ftdm_channel_t *dchan; - unsigned int flags; - void *private_info; - event_handler eventmap[LPWRAP_PRI_EVENT_MAX]; - loop_handler on_loop; - int errs; - struct lpwrap_timer *timer_list; - ftdm_mutex_t *timer_mutex; -}; - -typedef struct lpwrap_pri lpwrap_pri_t; - -struct lpwrap_pri_event_list { - int event_id; - int pri_event; - const char *name; -}; - -struct lpwrap_timer { - struct lpwrap_timer *next; - ftdm_time_t timeout; - timeout_handler callback; -}; - -int lpwrap_start_timer(struct lpwrap_pri *spri, struct lpwrap_timer *timer, const uint32_t timeout_ms, timeout_handler callback); -int lpwrap_stop_timer(struct lpwrap_pri *spri, struct lpwrap_timer *timer); - -#define LPWRAP_MAP_PRI_EVENT(spri, event, func) spri.eventmap[event] = func; -const char *lpwrap_pri_event_str(lpwrap_pri_event_t event_id); - -int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int debug); -int lpwrap_destroy_pri(struct lpwrap_pri *spri); -int lpwrap_run_pri_once(struct lpwrap_pri *spri); -int lpwrap_run_pri(struct lpwrap_pri *spri); -int lpwrap_stop_pri(struct lpwrap_pri *spri); -#endif diff --git a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c deleted file mode 100644 index 4909595a0b..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c +++ /dev/null @@ -1,2837 +0,0 @@ -/** - * mISDN HW interface - * - * Copyright (c) 2011, Stefan Knoblich - * - * 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. - * - * NOTE: This is intended as a Layer 1 interface only, signaling - * is handled by other modules (e.g. ftmod_libpri or ftmod_isdn). - */ -/* - * TODO: - * - Use a fifo and PH_DATA_CNF for b-channel write polling (drop timerfd) - * - * - Disable L1 idle deactivation on BRI PTMP with IMGL1HOLD ioctl(? optional) - * - * - Add hfcsusb specific state + flag defines and try to do something useful with - * it in misdn_handle_mph_information_ind(). - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* this is how it should have been... -#ifdef HAVE_FREETDM_FREETDM_H -#include -#else -#include -#endif -*/ -/* ... and this is how it is */ -#include - -#include - -/* - * mISDNcompat.h replaces these with references to an extern int, - * which is exported by libmisdn... unset them and use the official - * AF ID "34" - */ -#undef PF_ISDN -#undef AF_ISDN -#define AF_ISDN 34 -#define PF_ISDN AF_ISDN - -//#define MISDN_DEBUG_EVENTS -//#define MISDN_DEBUG_IO - -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) - -typedef enum { - MISDN_CAPS_NONE = 0, - - /* D-Channel */ - MISDN_CAPS_PRI = (1 << 0), - MISDN_CAPS_BRI = (1 << 1), - MISDN_CAPS_UP0 = (1 << 2), - MISDN_CAPS_NT = (1 << 3), - MISDN_CAPS_TE = (1 << 4), - - /* B-Channel */ - MISDN_CAPS_RAW = (1 << 10), - MISDN_CAPS_HDLC = (1 << 11), -} misdn_capability_flags_t; - -#define MISDN_IS_BRI(x) (x & MISDN_CAPS_BRI) -#define MISDN_IS_PRI(x) (x & MISDN_CAPS_PRI) - -#define MISDN_IS_TE(x) (x & MISDN_CAPS_TE) -#define MISDN_IS_NT(x) (x & MISDN_CAPS_NT) - -#define MISDN_IS_RAW(x) (x & MISDN_CAPS_RAW) -#define MISDN_IS_HDLC(x) (x & MISDN_CAPS_HDLC) - -#define MISDN_MSG_DATA(x) ((void *)((unsigned char *)(x) + MISDN_HEADER_LEN)) - -const static struct { - const int id; - const char *name; -} misdn_event_types[] = { -#define MISDN_EVENT_TYPE(x) { x, #x } - MISDN_EVENT_TYPE(PH_DATA_REQ), - MISDN_EVENT_TYPE(PH_DATA_IND), - MISDN_EVENT_TYPE(PH_DATA_CNF), - MISDN_EVENT_TYPE(PH_DATA_E_IND), - MISDN_EVENT_TYPE(PH_CONTROL_REQ), - MISDN_EVENT_TYPE(PH_CONTROL_IND), - MISDN_EVENT_TYPE(PH_CONTROL_CNF), - MISDN_EVENT_TYPE(PH_ACTIVATE_REQ), - MISDN_EVENT_TYPE(PH_ACTIVATE_IND), - MISDN_EVENT_TYPE(PH_ACTIVATE_CNF), - MISDN_EVENT_TYPE(PH_DEACTIVATE_REQ), - MISDN_EVENT_TYPE(PH_DEACTIVATE_IND), - MISDN_EVENT_TYPE(PH_DEACTIVATE_CNF), - MISDN_EVENT_TYPE(MPH_ACTIVATE_REQ), - MISDN_EVENT_TYPE(MPH_ACTIVATE_IND), - MISDN_EVENT_TYPE(MPH_DEACTIVATE_REQ), - MISDN_EVENT_TYPE(MPH_DEACTIVATE_IND), - MISDN_EVENT_TYPE(MPH_INFORMATION_REQ), - MISDN_EVENT_TYPE(MPH_INFORMATION_IND), -#undef MISDN_EVENT_TYPE -}; - -static const char *misdn_event2str(const int event) -{ - int x; - - for (x = 0; x < ftdm_array_len(misdn_event_types); x++) { - if (event == misdn_event_types[x].id) - return misdn_event_types[x].name; - } - return "unknown"; -} - - -const static struct { - const int id; - const char *name; -} misdn_control_types[] = { -#define MISDN_CONTROL_TYPE(x) { x, #x } - MISDN_CONTROL_TYPE(DTMF_HFC_COEF), - MISDN_CONTROL_TYPE(DSP_CONF_JOIN), - MISDN_CONTROL_TYPE(DSP_CONF_SPLIT), - MISDN_CONTROL_TYPE(DSP_RECEIVE_OFF), - MISDN_CONTROL_TYPE(DSP_RECEIVE_ON), - MISDN_CONTROL_TYPE(DSP_ECHO_ON), - MISDN_CONTROL_TYPE(DSP_ECHO_OFF), - MISDN_CONTROL_TYPE(DSP_MIX_ON), - MISDN_CONTROL_TYPE(DSP_MIX_OFF), - MISDN_CONTROL_TYPE(DSP_DELAY), - MISDN_CONTROL_TYPE(DSP_JITTER), - MISDN_CONTROL_TYPE(DSP_TXDATA_ON), - MISDN_CONTROL_TYPE(DSP_TXDATA_OFF), - MISDN_CONTROL_TYPE(DSP_TX_DEJITTER), - MISDN_CONTROL_TYPE(DSP_TX_DEJ_OFF), - MISDN_CONTROL_TYPE(DSP_TONE_PATT_ON), - MISDN_CONTROL_TYPE(DSP_TONE_PATT_OFF), - MISDN_CONTROL_TYPE(DSP_VOL_CHANGE_TX), - MISDN_CONTROL_TYPE(DSP_VOL_CHANGE_RX), - MISDN_CONTROL_TYPE(DSP_BF_ENABLE_KEY), - MISDN_CONTROL_TYPE(DSP_BF_DISABLE), - MISDN_CONTROL_TYPE(DSP_BF_ACCEPT), - MISDN_CONTROL_TYPE(DSP_BF_REJECT), - MISDN_CONTROL_TYPE(DSP_PIPELINE_CFG), - MISDN_CONTROL_TYPE(HFC_VOL_CHANGE_TX), - MISDN_CONTROL_TYPE(HFC_VOL_CHANGE_RX), - MISDN_CONTROL_TYPE(HFC_SPL_LOOP_ON), - MISDN_CONTROL_TYPE(HFC_SPL_LOOP_OFF), -#undef MISDN_CONTROL_TYPE -}; - -static const char *misdn_control2str(const int ctrl) -{ - int x; - - for (x = 0; x < ftdm_array_len(misdn_control_types); x++) { - if (ctrl == misdn_control_types[x].id) - return misdn_control_types[x].name; - } - return "unknown"; -} - - -/*********************************************************************************** - * mISDN <-> FreeTDM audio conversion - ***********************************************************************************/ - -/* - * Code used to generate table values taken from - * Linux Call Router (LCR) http://www.linux-call-router.de/ - * - * chan_lcr.c:3488 ff., load_module() - */ -static const unsigned char conv_audio_tbl[256] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, -}; - -/* Convert ISDN_P_B_RAW audio data to/from a-/u-law */ -static inline void misdn_convert_audio_bits(char *buf, int buflen) -{ - int i; - - for (i = 0; i < buflen; i++) { - buf[i] = conv_audio_tbl[(unsigned char)buf[i]]; - } -} - - -/*********************************************************************************** - * mISDN <-> FreeTDM data structures - ***********************************************************************************/ - -typedef enum { - MISDN_CMD_NONE = 0, - MISDN_CMD_STOP, /*!< Stop the I/O thread */ -} misdn_cmd_t; - -struct misdn_command { - misdn_cmd_t type; -/* union { } cmd; */ /*!< Command-specific parameters */ -}; - -enum { - MISDN_SPAN_NONE = 0, - MISDN_SPAN_RUNNING = (1 << 0), - MISDN_SPAN_STOPPED = (1 << 1) -}; - -struct misdn_span_private { - int flags; - int running; - - int event_pipe_in; - int event_pipe_out; - - /* event conditional */ - pthread_mutex_t event_cond_mutex; - pthread_cond_t event_cond; - - /* start / stop feedback */ - pthread_mutex_t ctrl_cond_mutex; - pthread_cond_t ctrl_cond; -}; - -struct misdn_event_queue; - -struct misdn_chan_private { - /* */ - int debugfd; - int active; - - /* hw addr of channel */ - struct sockaddr_mISDN addr; - - /* audio tx pipe (= socketpair ends) */ - int tx_audio_pipe_in; - int tx_audio_pipe_out; - int rx_audio_pipe_in; - int rx_audio_pipe_out; - - /* counters */ - unsigned long tx_cnt; - unsigned long tx_ack_cnt; - unsigned long rx_cnt; - unsigned long slip_rx_cnt; - unsigned long slip_tx_cnt; - - unsigned long tx_pipe_wr_bytes; /*!< Number of bytes written into tx audio pipe */ - unsigned long tx_pipe_rd_bytes; /*!< Number of bytes read from tx audio pipe */ - unsigned long tx_miss_bytes; /*!< Number of bytes missing in short reads from tx audio pipe */ - unsigned long tx_lost_bytes; /*!< Number of bytes lost in short writes to the mISDN B-Channel */ - unsigned long tx_sent_bytes; /*!< Number of bytes successfully sent to the mISDN B-Channel */ - unsigned long tx_pipe_under_cnt; /*!< Number of tx audio pipe underflows */ - unsigned long tx_pipe_over_cnt; /*!< Number of tx audio pipe overflows */ - - struct misdn_event_queue *events; -}; - -#define ftdm_chan_io_private(x) ((x)->io_data) -#define ftdm_span_io_private(x) ((x)->io_data) - -static ftdm_status_t misdn_handle_incoming(ftdm_channel_t *ftdmchan, const char *rbuf, const int size); -static int misdn_handle_mph_information_ind(ftdm_channel_t *chan, const struct mISDNhead *hh, const void *data, const int data_len); - -static const char *ftdm_channel_get_type_str(const ftdm_channel_t *chan) -{ - return ftdm_chan_type2str(ftdm_channel_get_type(chan)); -} - -/*********************************************************************************** - * mISDN interface functions - ***********************************************************************************/ - -/* - * Event Queue - */ -#define MISDN_EVENTS_MAX 8 - -struct misdn_event { - int id; -}; - -struct misdn_event_queue { - int read_pos; - int write_pos; - pthread_mutex_t mutex; - - struct misdn_event events[MISDN_EVENTS_MAX]; -}; - -/** - * Initialize event queue - */ -static ftdm_status_t misdn_event_queue_create(struct misdn_event_queue **queue) -{ - struct misdn_event_queue *tmp = NULL; - - if (!queue) - return FTDM_FAIL; - - tmp = calloc(1, sizeof(*tmp)); - if (!tmp) - return FTDM_FAIL; - - pthread_mutex_init(&tmp->mutex, NULL); - - *queue = tmp; - return FTDM_SUCCESS; -} - -/** - * Destroy event queue - */ -static ftdm_status_t misdn_event_queue_destroy(struct misdn_event_queue **queue) -{ - if (!queue || !*queue) - return FTDM_FAIL; - - pthread_mutex_destroy(&(*queue)->mutex); - ftdm_safe_free(*queue); - *queue = NULL; - - return FTDM_SUCCESS; -} - -static ftdm_status_t misdn_event_queue_reset(struct misdn_event_queue *queue) -{ - if (!queue) - return FTDM_FAIL; - pthread_mutex_lock(&queue->mutex); - - memset(queue->events, 0, sizeof(queue->events)); - queue->read_pos = queue->write_pos = 0; - - pthread_mutex_unlock(&queue->mutex); - return FTDM_SUCCESS; -} - -static ftdm_bool_t misdn_event_queue_has_data(const struct misdn_event_queue *queue) -{ - if (!queue) - return FTDM_FALSE; - - return (queue->read_pos == queue->write_pos) ? FTDM_FALSE : FTDM_TRUE; -} - -static struct misdn_event *misdn_event_queue_pop(struct misdn_event_queue *queue) -{ - struct misdn_event *evt = NULL; - int next_idx = 0; - - if (!queue) - return NULL; - - pthread_mutex_lock(&queue->mutex); - - next_idx = (queue->read_pos + 1) % MISDN_EVENTS_MAX; - - if (queue->read_pos == queue->write_pos) { -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN queue %p: empty\n", queue); -#endif - pthread_mutex_unlock(&queue->mutex); - return NULL; - } - -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN queue %p: read event (read_pos: %d, write_pos: %d, next_write_pos: %d)\n", - queue, queue->read_pos, queue->write_pos, next_idx); -#endif - /* update read pos */ - evt = &queue->events[queue->read_pos]; - queue->read_pos = next_idx; - - pthread_mutex_unlock(&queue->mutex); - return evt; -} - -static ftdm_status_t misdn_event_queue_push(struct misdn_event_queue *queue, struct misdn_event *evt) -{ - int next_idx = 0; - - if (!queue || !evt) - return FTDM_FAIL; - - pthread_mutex_lock(&queue->mutex); - - next_idx = (queue->write_pos + 1) % MISDN_EVENTS_MAX; - - if (next_idx == queue->read_pos) { -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN queue %p: full\n", queue); -#endif - pthread_mutex_unlock(&queue->mutex); - return FTDM_FAIL; - } - -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN queue %p: wrote event (read_pos: %d, write_pos: %d, next_write_pos: %d)\n", - queue, queue->read_pos, queue->write_pos, next_idx); -#endif - memcpy(&queue->events[queue->write_pos], evt, sizeof(*evt)); - queue->write_pos = next_idx; - - pthread_mutex_unlock(&queue->mutex); - return FTDM_SUCCESS; -} - -#if 0 /* unused for now */ -static void misdn_event_queue_print_info(const struct misdn_event_queue *queue) -{ - ftdm_log(FTDM_LOG_DEBUG, "Queue %p\n\tread idx: %d\n\twrite idx: %d\n", queue, - queue->read_pos, queue->write_pos); -} -#endif - -/*********************************************************************************** - * mISDN helper functions - ***********************************************************************************/ - -#define MISDN_PH_ACTIVATE_TIMEOUT_MS 10000 -#define MISDN_MPH_INFORMATION_TIMEOUT_MS 3000 - -static inline void ts_add_msec(struct timespec *a, int msec) -{ - a->tv_sec += (msec / 1000); - a->tv_nsec += (msec % 1000) * 1000000; - if (a->tv_nsec >= 1000000000) { - a->tv_sec++; - a->tv_nsec -= 1000000000; - } -} - -static inline int ts_sub_msec(struct timespec *a, struct timespec *b) -{ - int msec = 0; - msec += (a->tv_sec - b->tv_sec) * 1000; - msec += (a->tv_nsec - b->tv_nsec) / 1000000; - return msec; -} - -static inline int ts_after(struct timespec *a, struct timespec *b) -{ - if (a->tv_sec > b->tv_sec) return 1; - if (a->tv_sec == b->tv_sec && a->tv_nsec > b->tv_nsec) return 1; - return 0; -} - -static inline int ts_before(struct timespec *a, struct timespec *b) -{ - if (a->tv_sec < b->tv_sec) return 1; - if (a->tv_sec == b->tv_sec && a->tv_nsec < b->tv_nsec) return 1; - return 0; -} - -/* - * Asynchronous channel (de-)activation - */ -static ftdm_status_t _misdn_toggle_channel_nowait(ftdm_channel_t *chan, int activate) -{ - struct misdn_chan_private *priv = ftdm_chan_io_private(chan); - char buf[MAX_DATA_MEM] = { 0 }; - struct mISDNhead *hh = (struct mISDNhead *) buf; - int retval; - - /* NOTE: sending PH_DEACTIVATE_REQ to closed b-channels kills the d-channel (hfcsusb)... */ - if ((activate && priv->active) || (!activate && !priv->active)) - return FTDM_SUCCESS; - - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN sending %s request\n", - (activate) ? "activation" : "deactivation"); - - /* prepare + send request primitive */ - hh->prim = (activate) ? PH_ACTIVATE_REQ : PH_DEACTIVATE_REQ; - hh->id = MISDN_ID_ANY; - - if ((retval = sendto(chan->sockfd, hh, sizeof(*hh), 0, NULL, 0)) < sizeof(*hh)) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to send activation request: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - - return FTDM_SUCCESS; -} - -static ftdm_status_t misdn_activate_channel_nowait(ftdm_channel_t *chan) -{ - return _misdn_toggle_channel_nowait(chan, 1); -} - -static ftdm_status_t misdn_deactivate_channel_nowait(ftdm_channel_t *chan) -{ - return _misdn_toggle_channel_nowait(chan, 0); -} - -/* - * Synchronous channel (de-)activation - */ -static ftdm_status_t _misdn_toggle_channel(ftdm_channel_t *chan, int activate) -{ - struct misdn_chan_private *priv = ftdm_chan_io_private(chan); - char buf[MAX_DATA_MEM] = { 0 }; - struct mISDNhead *hh = (struct mISDNhead *) buf; - struct timespec abstimeout; - int req = 0, resp = 0, ms_left = MISDN_PH_ACTIVATE_TIMEOUT_MS; - int retval; - - /* NOTE: sending PH_DEACTIVATE_REQ to closed b-channels kills the d-channel (hfcsusb)... */ - if ((activate && priv->active) || (!activate && !priv->active)) - return FTDM_SUCCESS; - - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN sending %s request\n", - (activate) ? "activation" : "deactivation"); - - /* prepare + send request primitive */ - req = (activate) ? PH_ACTIVATE_REQ : PH_DEACTIVATE_REQ; - hh->prim = req; - hh->id = MISDN_ID_ANY; - - if ((retval = sendto(chan->sockfd, hh, sizeof(*hh), 0, NULL, 0)) < sizeof(*hh)) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to send activation request: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - - clock_gettime(CLOCK_MONOTONIC, &abstimeout); - ts_add_msec(&abstimeout, ms_left); - - /* wait for answer */ - while (1) { - struct timespec now; - struct pollfd pfd; - - pfd.fd = chan->sockfd; - pfd.events = POLLIN | POLLPRI; - pfd.revents = 0; - - switch ((retval = poll(&pfd, 1, ms_left))) { - case 0: /* timeout */ - goto out; - case -1: /* error */ - if (!(retval == EAGAIN || retval == EINTR)) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN polling for activation confirmation failed: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - break; - default: /* read data */ - break; - } - - if (pfd.revents & (POLLIN | POLLPRI)) { - /* handle incoming message */ - if ((retval = recvfrom(chan->sockfd, buf, sizeof(buf), 0, NULL, NULL)) <= 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to receive possible answer for %s request: %s\n", - (activate) ? "activation" : "deactivation", strerror(errno)); - return FTDM_FAIL; - } -#ifdef MISDN_DEBUG_EVENTS - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN got event '%s (%#x)', id %#x, while waiting for %s confirmation on %c-channel\n", - misdn_event2str(hh->prim), hh->prim, hh->id, (activate) ? "activation" : "deactivation", - ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B ? 'B' : 'D'); -#endif - switch (hh->prim) { - case PH_ACTIVATE_IND: - case PH_ACTIVATE_CNF: - resp = hh->prim; - priv->active = 1; - if (activate) goto out; - break; - case PH_DEACTIVATE_CNF: - case PH_DEACTIVATE_IND: - resp = hh->prim; - priv->active = 0; - if (!activate) goto out; - break; - case PH_ACTIVATE_REQ: /* REQ echo, ignore */ - case PH_DEACTIVATE_REQ: - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN got '%s' echo while waiting for %s confirmation (id: %#x)\n", - misdn_event2str(hh->prim), (activate) ? "activation" : "deactivation", hh->id); - break; - case MPH_INFORMATION_IND: - misdn_handle_mph_information_ind(chan, hh, MISDN_MSG_DATA(buf), retval - MISDN_HEADER_LEN); - break; - case PH_DATA_IND: /* ignore */ - case PH_DATA_CNF: /* ignore */ - break; - default: /* other messages, ignore */ - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN ignoring event '%s (%#x)', id %#x, while waiting for %s confirmation\n", - misdn_event2str(hh->prim), hh->prim, hh->id, (activate) ? "activation" : "deactivation"); - break; - } - } - - /* check timeout */ - clock_gettime(CLOCK_MONOTONIC, &now); - - if (ts_after(&now, &abstimeout) || (ms_left = ts_sub_msec(&abstimeout, &now)) <= 0) - goto out; - } -out: - if (resp == 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN timeout waiting for %s confirmation\n", - (activate) ? "activation" : "deactivation"); - return FTDM_TIMEOUT; - } - if ((req == PH_ACTIVATE_REQ && !(resp == PH_ACTIVATE_CNF || resp == PH_ACTIVATE_IND)) || - (req == PH_DEACTIVATE_REQ && !(resp == PH_DEACTIVATE_CNF || resp == PH_DEACTIVATE_IND))) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN received '%s' while waiting for %s\n", - misdn_event2str(resp), (activate) ? "activation" : "deactivation"); - return FTDM_FAIL; - } - - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN received %s confirmation\n", - (activate) ? "activation" : "deactivation"); - return FTDM_SUCCESS; -} - -static ftdm_status_t misdn_activate_channel(ftdm_channel_t *chan) -{ - return _misdn_toggle_channel(chan, 1); -} - -static ftdm_status_t misdn_deactivate_channel(ftdm_channel_t *chan) -{ - return _misdn_toggle_channel(chan, 0); -} - - -#if 0 /* unused for now */ -static ftdm_status_t misdn_get_ph_info(ftdm_channel_t *chan, struct ph_info *info) -{ - char buf[MAX_DATA_MEM] = { 0 }; - struct mISDNhead *hh; - struct timespec abstimeout; - int req = 0, resp = 0, ms_left = MISDN_MPH_INFORMATION_TIMEOUT_MS; - int retval; - - /* prepare + send request primitive */ - req = MPH_INFORMATION_REQ; - hh = (struct mISDNhead *)buf; - hh->prim = req; - hh->id = MISDN_ID_ANY; - - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN sending %s request\n", - misdn_event2str(req)); - - if ((retval = sendto(chan->sockfd, &hh, sizeof(hh), 0, NULL, 0)) < sizeof(hh)) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to send %s request: %s\n", - misdn_event2str(req), strerror(errno)); - return FTDM_FAIL; - } - - clock_gettime(CLOCK_MONOTONIC, &abstimeout); - ts_add_msec(&abstimeout, ms_left); - - /* wait for answer */ - while (1) { - struct timespec now; - struct pollfd pfd; - - pfd.fd = chan->sockfd; - pfd.events = POLLIN /* | POLLPRI */; - pfd.revents = 0; - - switch ((retval = poll(&pfd, 1, ms_left))) { - case 0: /* timeout */ - goto out; - case -1: /* error */ - if (!(retval == EAGAIN || retval == EINTR)) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN polling for %s answer failed: %s\n", - misdn_event2str(req), strerror(errno)); - return FTDM_FAIL; - } - break; - default: /* read data */ - break; - } - - if (pfd.revents & (POLLIN | POLLPRI)) { - /* handle incoming message */ - if ((retval = recvfrom(chan->sockfd, buf, sizeof(buf), 0, NULL, NULL)) <= 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to receive possible answer for %s request: %s\n", - misdn_event2str(req), strerror(errno)); - return FTDM_FAIL; - } -#ifdef MISDN_DEBUG_EVENTS - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN got event '%s' while waiting for %s answer\n", - misdn_event2str(hh->prim), misdn_event2str(req)); -#endif - switch (hh->prim) { - case MPH_INFORMATION_IND: /* success */ - if (retval < MISDN_HEADER_LEN + sizeof(*info)) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN answer for %s is too short\n", - misdn_event2str(req)); - return FTDM_FAIL; - } - resp = hh->prim; - /* TODO */ - goto out; - case MPH_INFORMATION_REQ: /* REQ echo, ignore */ - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN got '%s' echo while waiting for %s answer\n", - misdn_event2str(hh->prim), misdn_event2str(req)); - break; - default: /* other messages, ignore */ - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN ignoring event '%s' while waiting for %s answer\n", - misdn_event2str(hh->prim), misdn_event2str(req)); - break; - } - } - - /* check timeout */ - clock_gettime(CLOCK_MONOTONIC, &now); - - if (ts_after(&now, &abstimeout) || (ms_left = ts_sub_msec(&abstimeout, &now)) <= 0) - goto out; - } -out: - if (resp == 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN timeout waiting for %s answer\n", - misdn_event2str(req)); - return FTDM_TIMEOUT; - } - - return FTDM_SUCCESS; -} -#endif - -static int misdn_handle_ph_control_ind(ftdm_channel_t *chan, const struct mISDNhead *hh, const void *data, const int data_len) -{ - ftdm_unused_arg(data); - - ftdm_log_chan(chan, FTDM_LOG_DEBUG, - "PH_CONTROL_IND:\n" - "\tMessage:\t%s (%#x)\n" - "\tPayload:\t%d\n", - misdn_control2str(hh->id), hh->id, data_len); - - switch (hh->id) { - case DTMF_HFC_COEF: - break; - default: - break; - } - - return FTDM_SUCCESS; -} - -/* - * TE/NT state names - * taken from linux-3.2.1/drivers/isdn/hardware/mISDN/hfcsusb.h - */ -static const char *misdn_layer1_te_states[] = { - "TE F0 - Reset", - "TE F1 - Reset", - "TE F2 - Sensing", - "TE F3 - Deactivated", - "TE F4 - Awaiting signal", - "TE F5 - Identifying input", - "TE F6 - Synchronized", - "TE F7 - Activated", - "TE F8 - Lost framing", -}; - -static const char *misdn_layer1_nt_states[] = { - "NT G0 - Reset", - "NT G1 - Deactive", - "NT G2 - Pending activation", - "NT G3 - Active", - "NT G4 - Pending deactivation", -}; - -static const char *misdn_hw_state_name(const int proto, const int id) -{ - if (IS_ISDN_P_TE(proto)) { - if (id < 0 || id >= ftdm_array_len(misdn_layer1_te_states)) - return NULL; - return misdn_layer1_te_states[id]; - } - else if (IS_ISDN_P_NT(proto)) { - if (id < 0 || id >= ftdm_array_len(misdn_layer1_nt_states)) - return NULL; - return misdn_layer1_nt_states[id]; - } - return NULL; -} - - -static const struct misdn_hw_flag { - const unsigned int flag; - const char *name; -} misdn_hw_flags[] = { -#define MISDN_HW_FLAG(v,n) { v, #n } - MISDN_HW_FLAG(0, FLG_TX_BUSY), - MISDN_HW_FLAG(1, FLG_TX_NEXT), - MISDN_HW_FLAG(2, FLG_L1_BUSY), - MISDN_HW_FLAG(3, FLG_L2_ACTIVATED), - MISDN_HW_FLAG(5, FLG_OPEN), - MISDN_HW_FLAG(6, FLG_ACTIVE), - MISDN_HW_FLAG(7, FLG_BUSY_TIMER), - MISDN_HW_FLAG(8, FLG_DCHANNEL), - MISDN_HW_FLAG(9, FLG_BCHANNEL), - MISDN_HW_FLAG(10, FLG_ECHANNEL), - MISDN_HW_FLAG(12, FLG_TRANSPARENT), - MISDN_HW_FLAG(13, FLG_HDLC), - MISDN_HW_FLAG(14, FLG_L2DATA), - MISDN_HW_FLAG(15, FLG_ORIGIN), - MISDN_HW_FLAG(16, FLG_FILLEMPTY), - MISDN_HW_FLAG(17, FLG_ARCOFI_TIMER), - MISDN_HW_FLAG(18, FLG_ARCOFI_ERROR), - MISDN_HW_FLAG(17, FLG_INITIALIZED), - MISDN_HW_FLAG(18, FLG_DLEETX), - MISDN_HW_FLAG(19, FLG_LASTDLE), - MISDN_HW_FLAG(20, FLG_FIRST), - MISDN_HW_FLAG(21, FLG_LASTDATA), - MISDN_HW_FLAG(22, FLG_NMD_DATA), - MISDN_HW_FLAG(23, FLG_FTI_RUN), - MISDN_HW_FLAG(24, FLG_LL_OK), - MISDN_HW_FLAG(25, FLG_LL_CONN), - MISDN_HW_FLAG(26, FLG_DTMFSEND), - MISDN_HW_FLAG(30, FLG_RECVQUEUE), - MISDN_HW_FLAG(31, FLG_PHCHANGE), -#undef MISDN_HW_FLAG -}; - -static const char *misdn_hw_print_flags(unsigned int flags, char *buf, int buflen) -{ - int i; - - buf[0] = '\0'; - for (i = 0; i < ftdm_array_len(misdn_hw_flags); i++) { - if ((1 << misdn_hw_flags[i].flag) & flags) { - strncat(buf, misdn_hw_flags[i].name, buflen); - flags &= ~(1 << misdn_hw_flags[i].flag); - if (!flags) break; - strncat(buf, ",", buflen); - } - } - return buf; -} - -static int misdn_handle_mph_information_ind(ftdm_channel_t *chan, const struct mISDNhead *hh, const void *data, const int data_len) -{ - struct misdn_chan_private *priv = ftdm_chan_io_private(chan); - - ftdm_unused_arg(hh); - - /* - * mISDN has some inconsistency issues here. - * - * There are only two drivers that emit MPH_INFORMATION_IND messages, - * hfcsusb and hfcmulti. The former sends a set of ph_info and ph_info_ch structures, - * while the latter just sends an int containing the current L1_SIGNAL_* event id. - * - * The flags and state information in the ph_info and ph_info_ch structures - * are defined in kernel internal hw-specific headers (mISDNhw.h). - * - * Use the payload size to guess the type of message. - */ - if (data_len >= sizeof(struct ph_info)) { - /* complete port status, hfcsusb sends this */ - struct ph_info *info = (struct ph_info *)data; - struct ph_info_ch *bch_info = NULL; - char tmp[1024] = { 0 }; - - if (data_len < (sizeof(*info) + info->dch.num_bch * sizeof(*bch_info))) { - ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "mISDN MPH_INFORMATION_IND message is too short\n"); - return FTDM_FAIL; - } - bch_info = &info->bch[0]; - - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN port state:\n\tD-Chan proto:\t%hu\n\tD-Chan state:\t%s (%hu)\n\tD-Chan flags:\t%#"FTDM_XINT64_FMT"\n\t\t\t%-70s\n", - info->dch.ch.protocol, - misdn_hw_state_name(info->dch.ch.protocol, info->dch.state), info->dch.state, - (uint64_t)info->dch.ch.Flags, - misdn_hw_print_flags(info->dch.ch.Flags, tmp, sizeof(tmp) - 1)); - - /* TODO: try to translate this to a usable set of alarm flags */ - - } else if (data_len == sizeof(int)) { - /* alarm info, sent by hfcmulti */ - int value = *(int *)data; - int alarm_flags = chan->alarm_flags; - - if (data_len < sizeof(value)) { - ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "mISDN MPH_INFORMATION_IND message is too short\n"); - return FTDM_FAIL; - } - - switch (value) { - case L1_SIGNAL_LOS_ON: - alarm_flags |= FTDM_ALARM_RED; - break; - case L1_SIGNAL_LOS_OFF: - alarm_flags &= ~FTDM_ALARM_RED; - break; - case L1_SIGNAL_AIS_ON: - alarm_flags |= FTDM_ALARM_AIS; - break; - case L1_SIGNAL_AIS_OFF: - alarm_flags &= ~FTDM_ALARM_AIS; - break; - case L1_SIGNAL_RDI_ON: - alarm_flags |= FTDM_ALARM_YELLOW; - break; - case L1_SIGNAL_RDI_OFF: - alarm_flags &= ~FTDM_ALARM_YELLOW; - break; - case L1_SIGNAL_SLIP_RX: - priv->slip_rx_cnt++; - break; - case L1_SIGNAL_SLIP_TX: - priv->slip_tx_cnt++; - break; - default: - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN unknown MPH_INFORMATION_IND signal: %#04x\n", - value); - return FTDM_FAIL; - } - - /* check whether alarm status has changed, update channel flags if it has */ - if ((value = (alarm_flags ^ chan->alarm_flags))) { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN alarm flags have changed %#x -> %#x\n", - chan->alarm_flags, alarm_flags); - chan->alarm_flags ^= value; - } - } else { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN sent MPH_INFORMATION_IND message with unknown size %d\n", - data_len); - return FTDM_FAIL; - } - - return FTDM_SUCCESS; -} - -/*********************************************************************************** - * mISDN <-> FreeTDM interface functions - ***********************************************************************************/ - -static struct misdn_globals { - int sockfd; -} globals; - -/** - * \brief Open channel - * \param ftdmchan FreeTDM channel to open - */ -static FIO_OPEN_FUNCTION(misdn_open) -{ - struct misdn_chan_private *chan_priv = ftdm_chan_io_private(ftdmchan); - ftdm_span_t *span = ftdm_channel_get_span(ftdmchan); - struct misdn_span_private *span_priv = ftdm_span_io_private(span); - ftdm_status_t ret = 0; - - assert(chan_priv); - assert(span_priv); - - if (chan_priv->active) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "mISDN channel is already open, skipping activation\n"); - return FTDM_SUCCESS; - } - - /* flush all events */ - misdn_event_queue_reset(chan_priv->events); - - /* - * Send activation request - */ - ret = misdn_activate_channel(ftdmchan); - if (ret != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to activate channel (socket: %d)\n", - ftdmchan->sockfd); - /* - * Ignore error, ftdm_channel_open() does not correctly handle return FTDM_FAIL cases. - * We will try to activate the channel later. - */ - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN channel activation request sent\n"); - - switch (ftdmchan->type) { - case FTDM_CHAN_TYPE_B: - case FTDM_CHAN_TYPE_DQ921: - chan_priv->active = 1; - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN invalid channel type '%s'\n", - ftdm_channel_get_type_str(ftdmchan)); - break; - } - } - return FTDM_SUCCESS; -} - -/** - * \brief Close channel - * \param ftdmchan FreeTDM channel to close - */ -static FIO_CLOSE_FUNCTION(misdn_close) -{ - struct misdn_chan_private *chan_priv = ftdm_chan_io_private(ftdmchan); - ftdm_status_t ret = 0; - - assert(chan_priv); - - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "mISDN trying to close %c-channel\n", - ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B ? 'B' : 'D'); - - if (chan_priv->active) { - - if (ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B) { - ret = misdn_deactivate_channel(ftdmchan); - } else { - /* Don't wait for D-Channel deactivation */ - ret = misdn_deactivate_channel_nowait(ftdmchan); - } - - if (ret != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to deactivate %c-channel\n", - ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B ? 'B' : 'D'); - /* Ignore error, channel might be closed already */ - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "mISDN %c-channel deactivated\n", - ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B ? 'B' : 'D'); - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "mISDN tx stats: wr: %lu, rd: %lu, tx: %lu, tx-lost: %lu, tx-miss: %lu, tx-under#: %lu, tx-over#: %lu\n", - chan_priv->tx_pipe_wr_bytes, chan_priv->tx_pipe_rd_bytes, - chan_priv->tx_sent_bytes, chan_priv->tx_lost_bytes, chan_priv->tx_miss_bytes, - chan_priv->tx_pipe_over_cnt, chan_priv->tx_pipe_under_cnt); - - chan_priv->active = 0; - } - - return FTDM_SUCCESS; -} - -/** - * \brief Execute command - * \param ftdmchan FreeTDM channel - * \param command Command to execute - * \param obj Additional command data - */ -static FIO_COMMAND_FUNCTION(misdn_command) -{ - switch (command) { - case FTDM_COMMAND_NOOP: - break; - case FTDM_COMMAND_SET_INTERVAL: -// case FTDM_COMMAND_GET_INTERVAL: - case FTDM_COMMAND_SET_CODEC: - case FTDM_COMMAND_GET_CODEC: - case FTDM_COMMAND_SET_NATIVE_CODEC: - case FTDM_COMMAND_GET_NATIVE_CODEC: - case FTDM_COMMAND_ENABLE_DTMF_DETECT: - case FTDM_COMMAND_DISABLE_DTMF_DETECT: - case FTDM_COMMAND_SEND_DTMF: - case FTDM_COMMAND_SET_DTMF_ON_PERIOD: - case FTDM_COMMAND_GET_DTMF_ON_PERIOD: - case FTDM_COMMAND_SET_DTMF_OFF_PERIOD: - case FTDM_COMMAND_GET_DTMF_OFF_PERIOD: - case FTDM_COMMAND_SET_RX_GAIN: /* DSP_VOL_CHANGE_RX / HFC_VOL_CHANGE_RX */ - case FTDM_COMMAND_GET_RX_GAIN: - case FTDM_COMMAND_SET_TX_GAIN: /* DSP_VOL_CHANGE_TX / HFC_VOL_CHANGE_TX */ - case FTDM_COMMAND_GET_TX_GAIN: - case FTDM_COMMAND_FLUSH_TX_BUFFERS: - case FTDM_COMMAND_FLUSH_RX_BUFFERS: - case FTDM_COMMAND_FLUSH_BUFFERS: - case FTDM_COMMAND_FLUSH_IOSTATS: - case FTDM_COMMAND_SET_PRE_BUFFER_SIZE: - case FTDM_COMMAND_SET_LINK_STATUS: - case FTDM_COMMAND_GET_LINK_STATUS: - case FTDM_COMMAND_SET_RX_QUEUE_SIZE: - case FTDM_COMMAND_SET_TX_QUEUE_SIZE: - case FTDM_COMMAND_START_MF_PLAYBACK: - case FTDM_COMMAND_STOP_MF_PLAYBACK: - case FTDM_COMMAND_GET_IOSTATS: - case FTDM_COMMAND_SWITCH_IOSTATS: - /* Supported by mISDN */ - case FTDM_COMMAND_ENABLE_ECHOCANCEL: /* DSP_ECHO_ON */ - case FTDM_COMMAND_DISABLE_ECHOCANCEL: /* DSP_ECHO_OFF */ - case FTDM_COMMAND_ENABLE_LOOP: - case FTDM_COMMAND_DISABLE_LOOP: - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Received unimplemented command: %d\n", - command); - break; - - case FTDM_COMMAND_GET_INTERVAL: - FTDM_COMMAND_OBJ_INT = ftdm_channel_get_io_interval(ftdmchan); - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Interval %d ms\n", - ftdm_channel_get_io_interval(ftdmchan)); - break; - - default: - ftdm_log(FTDM_LOG_ERROR, "Unknown command %d\n", command); - } - return FTDM_SUCCESS; -} - - -/** - * \brief Wait for new data - * \param ftdmchan FreeTDM channel to wait on - * \param flags Wait flags - * \param to Timeout - */ -static FIO_WAIT_FUNCTION(misdn_wait) -{ - struct misdn_chan_private *chan_priv = ftdm_chan_io_private(ftdmchan); - struct pollfd pfds[2]; - int nr_fds = 0; - int retval; - - memset(pfds, 0, sizeof(pfds)); - - switch (ftdm_channel_get_type(ftdmchan)) { - case FTDM_CHAN_TYPE_B: - if (*flags & FTDM_WRITE) { - pfds[nr_fds].fd = chan_priv->tx_audio_pipe_in; - pfds[nr_fds].events = POLLOUT; - nr_fds++; - } - if (*flags & FTDM_READ) { - pfds[nr_fds].fd = chan_priv->rx_audio_pipe_out; - pfds[nr_fds].events = POLLIN; - nr_fds++; - } -/* if (*flags & (FTDM_READ | FTDM_EVENTS)) { - pfds[nr_fds].fd = ftdmchan->sockfd; - pfds[nr_fds].events |= (*flags & FTDM_READ) ? POLLIN : 0; - pfds[nr_fds].events |= (*flags & FTDM_EVENTS) ? POLLPRI : 0; - nr_fds++; - } -*/ - break; - default: - if (*flags & FTDM_READ) - pfds[0].events |= POLLIN; - if (*flags & FTDM_WRITE) - pfds[0].events |= POLLOUT; - if (*flags & FTDM_EVENTS) - pfds[0].events |= POLLPRI; - pfds[0].fd = ftdmchan->sockfd; - nr_fds++; - break; - } - - *flags = FTDM_NO_FLAGS; - - if (!(pfds[0].events || pfds[1].events)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "mISDN poll(): no flags set!\n"); - return FTDM_SUCCESS; - } - - if ((retval = poll(pfds, nr_fds, to)) < 0) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN poll() failed: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - if (retval == 0) - return FTDM_TIMEOUT; - - switch (ftdm_channel_get_type(ftdmchan)) { - case FTDM_CHAN_TYPE_B: - if ((pfds[0].revents & POLLOUT) || (pfds[1].revents & POLLOUT)) - *flags |= FTDM_WRITE; - if ((pfds[0].revents & POLLIN) || (pfds[1].revents & POLLIN)) - *flags |= FTDM_READ; - if ((pfds[0].revents & POLLPRI) || (pfds[1].revents & POLLPRI)) - *flags |= FTDM_EVENTS; - break; - default: - if (pfds[0].revents & POLLIN) - *flags |= FTDM_READ; - if (pfds[0].revents & POLLOUT) - *flags |= FTDM_WRITE; - if (pfds[0].revents & POLLPRI) - *flags |= FTDM_EVENTS; - break; - } - return FTDM_SUCCESS; -} - - -/** - * Handle incoming mISDN message on d-channel - * \param[in] ftdmchan - * \param[in] msg_buf - * \param[in] msg_len - * \internal - */ -static ftdm_status_t misdn_handle_incoming(ftdm_channel_t *ftdmchan, const char *msg_buf, const int msg_len) -{ - struct misdn_chan_private *priv = ftdm_chan_io_private(ftdmchan); - struct mISDNhead *hh = (struct mISDNhead *)msg_buf; - const char *data = msg_buf + sizeof(*hh); - int data_len = msg_len - sizeof(*hh); - - assert(msg_buf); - assert(priv); - - if (msg_len < sizeof(*hh)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN message to small (%d < %"FTDM_SIZE_FMT" bytes)\n", - msg_len, sizeof(*hh)); - return FTDM_FAIL; - } - -#ifdef MISDN_DEBUG_EVENTS - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN %c-channel received '%s' message (id: 0x%x, additional data: %d bytes)\n", - ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B ? 'B' : 'D', misdn_event2str(hh->prim), hh->id, data_len); -#endif - - switch (hh->prim) { - /* data events */ - case PH_DATA_CNF: /* TX: ack */ - priv->tx_ack_cnt++; - break; - case PH_DATA_REQ: /* TX: request echo (ignore) */ - break; - case PH_DATA_E_IND: /* RX: e-channel data received (monitoring?) */ - break; - - /* control requests */ - case PH_CONTROL_IND: - return misdn_handle_ph_control_ind(ftdmchan, hh, data, data_len); - case PH_CONTROL_REQ: - case PH_CONTROL_CNF: - break; - - /* information */ - case MPH_INFORMATION_IND: - return misdn_handle_mph_information_ind(ftdmchan, hh, data, data_len); - - /* channel de-/activation */ - case PH_ACTIVATE_REQ: /* Echoed requests, ignore */ - case PH_DEACTIVATE_REQ: - break; - case PH_ACTIVATE_IND: - case PH_DEACTIVATE_IND: { - /* other events, enqueue and let misdn_event_next handle it */ - struct misdn_span_private *span_priv = ftdm_span_io_private(ftdmchan->span); - struct misdn_event evt = { 0 }; - evt.id = hh->prim; - - misdn_event_queue_push(priv->events, &evt); - - /* wake possible readers */ - pthread_cond_signal(&span_priv->event_cond); - break; - } - default: /* error? */ - ftdm_log(FTDM_LOG_DEBUG, "mISDN channel %d:%d received unknown event %d\n", - ftdm_channel_get_span_id(ftdmchan), ftdm_channel_get_id(ftdmchan), hh->prim); - break; - } - return FTDM_SUCCESS; -} - -/** - * \brief Read data - * \param ftdmchan FreeTDM channel - * \param data Buffer for data - * \param datalen Number of bytes to read (contains bytes read after return) - */ -static FIO_READ_FUNCTION(misdn_read) -{ - struct misdn_chan_private *priv = ftdm_chan_io_private(ftdmchan); - char rbuf[MAX_DATA_MEM] = { 0 }; - struct mISDNhead *hh = (struct mISDNhead *)rbuf; - int bytes = *datalen; - int retval; - int maxretry = 10; - - /* nothing read yet */ - *datalen = 0; - - /* - * try to read all messages, as long as we haven't received a PH_DATA_IND one - * we'll get a lot of "mISDN_send: error -12" message in dmesg otherwise - * (= b-channel receive queue overflowing) - */ - switch (ftdm_channel_get_type(ftdmchan)) { - case FTDM_CHAN_TYPE_DQ921: { - while (maxretry--) { - struct sockaddr_mISDN addr; - socklen_t addrlen = sizeof(addr); - - if ((retval = recvfrom(ftdmchan->sockfd, rbuf, sizeof(rbuf), 0, (struct sockaddr *)&addr, &addrlen)) < 0) { - if (errno == EWOULDBLOCK || errno == EAGAIN) break; - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN failed to receive incoming message: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - - if (retval < MISDN_HEADER_LEN) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "mISDN received message too small\n"); - return FTDM_FAIL; - } - - if (hh->prim == PH_DATA_IND) { - *datalen = ftdm_clamp(retval - MISDN_HEADER_LEN, 0, bytes); - - if (*datalen <= 0) - continue; - - /* - * Copy data into ouput buffer (excluding the mISDN message header) - * NOTE: audio data needs to be converted to a-law / u-law! - */ - memcpy(data, rbuf + MISDN_HEADER_LEN, *datalen); - return FTDM_SUCCESS; - } else { - *datalen = 0; - /* event */ - misdn_handle_incoming(ftdmchan, rbuf, retval); - } - } - break; - } - case FTDM_CHAN_TYPE_B: { - if (!priv->active) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN ignoring read on closed b-channel\n"); - return FTDM_SUCCESS; - } - - if ((retval = read(priv->rx_audio_pipe_out, data, bytes)) < 0) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN failed to read audio data from rx pipe: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - *datalen = retval; - break; - } - default: - break; - } - return FTDM_SUCCESS; -} - -/** - * \brief Write data - * \param ftdmchan FreeTDM channel - * \param data Buffer for data - * \param datalen Number of bytes to write (contains bytes written after return) - */ -static FIO_WRITE_FUNCTION(misdn_write) -{ - struct misdn_chan_private *priv = ftdm_chan_io_private(ftdmchan); - char wbuf[MAX_DATA_MEM]; - struct mISDNhead *hh = (struct mISDNhead *)wbuf; - int size = *datalen; - int retval = 0; - ftdm_wait_flag_t wflags; - - assert(priv); - - /* ignore empty writes */ - if (*datalen <= 0) - return FTDM_SUCCESS; - -#ifdef MISDN_DEBUG_IO - { - char hbuf[MAX_DATA_MEM] = { 0 }; - print_hex_bytes(data, *datalen, hbuf, sizeof(hbuf)); - ftdm_log(FTDM_LOG_DEBUG, "mISDN write data: %s\n", hbuf); - } -#endif - *datalen = 0; - - switch (ftdm_channel_get_type(ftdmchan)) { - case FTDM_CHAN_TYPE_B: - /* - * Check state, send activation request (async) if channel is not open - */ - if (!priv->active) { - misdn_activate_channel_nowait(ftdmchan); - return FTDM_SUCCESS; /* eat data */ - } - /* - * Write to audio pipe, misdn_read() will pull - * from there as needed and send it to the b-channel - * - * NOTE: can't use blocking I/O here since both parts are serviced - * from the same thread - */ - if ((retval = write(priv->tx_audio_pipe_in, data, size)) < 0) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN channel audio pipe write error [wr: %lu, rd: %lu: tx: %lu, tx-under#: %lu, tx-over#: %lu]: %s\n", - priv->tx_pipe_wr_bytes, priv->tx_pipe_rd_bytes, priv->tx_sent_bytes, - priv->tx_pipe_under_cnt, priv->tx_pipe_over_cnt, strerror(errno)); - return FTDM_FAIL; - } else if (retval < size) { - priv->tx_pipe_over_cnt++; - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "mISDN channel audio pipe short write [wr: %lu, rd: %lu: tx: %lu, tx-under#: %lu, tx-over#: %lu], expected: %d, written: %d\n", - priv->tx_pipe_wr_bytes, priv->tx_pipe_rd_bytes, priv->tx_sent_bytes, - priv->tx_pipe_under_cnt, priv->tx_pipe_over_cnt, size, retval); - } - ACCESS_ONCE(priv->tx_pipe_wr_bytes) += retval; - *datalen = retval; - break; - default: - hh->prim = PH_DATA_REQ; - hh->id = MISDN_ID_ANY; - - /* Avoid buffer overflow */ - size = ftdm_min(size, MAX_DATA_MEM - MISDN_HEADER_LEN); - - memcpy(wbuf + MISDN_HEADER_LEN, data, size); - size += MISDN_HEADER_LEN; - - /* - * Check state, send activation request (sync) if channel is not open - */ - if (!priv->active) { - retval = misdn_activate_channel(ftdmchan); - if (retval) { - *datalen = 0; - return FTDM_FAIL; - } - } - - /* wait for channel to get ready */ - wflags = FTDM_WRITE; - retval = misdn_wait(ftdmchan, &wflags, 20); - if (retval) { - /* timeout, io error */ - *datalen = 0; - return FTDM_FAIL; - } - -#ifdef MISDN_DEBUG_IO - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN writing %d bytes to channel socket %d [dev.ch: %d.%d]\n", - size, ftdmchan->sockfd, priv->addr.dev, priv->addr.channel); -#endif - - if ((retval = sendto(ftdmchan->sockfd, wbuf, size, 0, NULL, 0)) < size) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN channel socket write error: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - *datalen = retval; - break; - } - - priv->tx_cnt++; - return FTDM_SUCCESS; -} - -/** - * Carefully choosen size for socket send/recv buffers - * larger values will add more latency, while lower values will cause deadlocks - * (see misdn_span_run() comments below for an explanation) - */ -#define SOCKETPAIR_BUFFER_SIZE 3072 - -static ftdm_status_t misdn_open_range(ftdm_span_t *span, ftdm_chan_type_t type, struct mISDN_devinfo *devinfo, int start, int end) -{ - int num_configured = 0; - int d_protocol, d_channel; - int x; - - ftdm_log(FTDM_LOG_DEBUG, "mISDN configuring card:range %d:%d->%d\n", - devinfo->id, start, end); - - switch (ftdm_span_get_trunk_type(span)) { - case FTDM_TRUNK_E1: - d_protocol = ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET ? ISDN_P_NT_E1 : ISDN_P_TE_E1; - d_channel = 16; - break; - case FTDM_TRUNK_BRI: - case FTDM_TRUNK_BRI_PTMP: - d_protocol = ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET ? ISDN_P_NT_S0 : ISDN_P_TE_S0; - d_channel = 0; - break; - default: - ftdm_log(FTDM_LOG_ERROR, "Unsupported span type %s\n", - ftdm_span_get_trunk_type_str(span)); - return FTDM_FAIL; - } - - for (x = start; x <= end; x++) { - struct misdn_chan_private *priv; - struct sockaddr_mISDN addr; - ftdm_channel_t *ftdmchan = NULL; - ftdm_socket_t sockfd = -1; - - ftdm_log(FTDM_LOG_DEBUG, "mISDN configuring card:channel => %d:%d\n", - devinfo->id, x); - - memset(&addr, 0, sizeof(addr)); - addr.family = AF_ISDN; - addr.dev = devinfo->id; - - switch (type) { - case FTDM_CHAN_TYPE_DQ931: /* unsupported */ - ftdm_log(FTDM_LOG_ERROR, "Unsupported channel type '%s'\n", - ftdm_chan_type2str(type)); - return FTDM_FAIL; - - case FTDM_CHAN_TYPE_DQ921: - /* No NT-mode support, since we have no idea which mode we should run in at this point */ - sockfd = socket(PF_ISDN, SOCK_DGRAM, d_protocol); - addr.channel = d_channel; /* 0 for S0 and 16 for E1 */ - break; - - case FTDM_CHAN_TYPE_B: - if (!test_channelmap(x, devinfo->channelmap)) { - ftdm_log(FTDM_LOG_ERROR, "Invalid B-Channel specified: %d\n", x); - return FTDM_FAIL; - } - sockfd = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_RAW); - addr.channel = x; - break; - - default: - ftdm_log(FTDM_LOG_ERROR, "Invalid/unsupported channel type '%s' (%d)\n", - ftdm_chan_type2str(type), type); - return FTDM_FAIL; - } - - if (sockfd < 0) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open socket: %s\n", strerror(errno)); - return FTDM_FAIL; - } - - ftdm_log(FTDM_LOG_DEBUG, "mISDN opened socket (on chan:dev => %d:%d): %d\n", - addr.dev, addr.channel, sockfd); - - /* Set mISDN channel socket non-blocking */ - if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN Failed to set socket fd to non-blocking: %s\n", - strerror(errno)); - close(sockfd); - return FTDM_FAIL; - } - - /* - * Bind socket to card:channel - */ - if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Failed to bind mISDN socket [%d:%d]: %s\n", - addr.dev, x, strerror(errno)); - close(sockfd); - return FTDM_FAIL; - } - - /* - * Add channel to span - */ - if (ftdm_span_add_channel(span, sockfd, type, &ftdmchan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to add mISDN ftdmchan to span\n"); - close(sockfd); - return FTDM_FAIL; - } - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to allocate channel private data\n"); - close(sockfd); - return FTDM_FAIL; - } - ftdm_chan_io_private(ftdmchan) = priv; - - priv->addr = addr; - priv->debugfd = -1; - - /* - * Create event queue - */ - misdn_event_queue_create(&priv->events); - - ftdmchan->rate = 8000; - ftdmchan->physical_span_id = devinfo->id; - ftdmchan->physical_chan_id = x; - - if (ftdmchan->type == FTDM_CHAN_TYPE_B) { - int pipefd[2] = { -1, -1 }; - - ftdmchan->packet_len = 30 /* ms */ * (ftdmchan->rate / 1000); - ftdmchan->effective_interval = ftdmchan->native_interval = ftdmchan->packet_len / 8; - ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_ALAW; - -// ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL); - -#ifdef USE_PIPE - /* - * Create audio tx pipe, use non-blocking I/O to avoid deadlock since both ends - * are used from the same thread - */ - if (pipe2(pipefd, 0 | O_NONBLOCK) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Failed to create mISDN audio tx pipe [%d:%d]: %s\n", - addr.dev, x, strerror(errno)); - close(sockfd); - return FTDM_FAIL; - } - priv->tx_audio_pipe_in = pipefd[1]; - priv->tx_audio_pipe_out = pipefd[0]; - -#if 1 || defined(HAVE_F_SETPIPE_SZ) - if (fcntl(priv->tx_audio_pipe_in, F_SETPIPE_SZ, 4096) < 0) { - ftdm_log(FTDM_LOG_WARNING, "Failed to set mISDN audio tx pipe size [%d:%d]: %s\n", - addr.dev, x, strerror(errno)); - } -#endif - /* - * Create audio rx pipe, use non-blocking I/O to avoid deadlock since both ends - * are used from the same thread - */ - if (pipe2(pipefd, 0 | O_NONBLOCK) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Failed to create mISDN audio rx pipe [%d:%d]: %s\n", - addr.dev, x, strerror(errno)); - close(sockfd); - return FTDM_FAIL; - } - priv->rx_audio_pipe_in = pipefd[1]; - priv->rx_audio_pipe_out = pipefd[0]; - -#if 1 || defined(HAVE_F_SETPIPE_SZ) - if (fcntl(priv->rx_audio_pipe_in, F_SETPIPE_SZ, 4096) < 0) { - ftdm_log(FTDM_LOG_WARNING, "Failed to set mISDN audio rx pipe size [%d:%d]: %s\n", - addr.dev, x, strerror(errno)); - } -#endif -#else /* !USE_PIPE */ - /* - * Use a socket pair for audio rx/tx, allows for more fine-grained control - * of latency (= amounts of data in buffers) - */ - if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipefd) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Failed to create mISDN audio socket pair [%d:%d]: %s\n", - addr.dev, x, strerror(errno)); - close(sockfd); - return FTDM_FAIL; - } else { - int opt = SOCKETPAIR_BUFFER_SIZE; - socklen_t optlen = sizeof(opt); - - if (fcntl(pipefd[0], F_SETFL, O_NONBLOCK) < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN Failed to set socket pair fd[0] to non-blocking: %s\n", - strerror(errno)); - close(sockfd); - close(pipefd[0]); - close(pipefd[1]); - return FTDM_FAIL; - } - if (fcntl(pipefd[1], F_SETFL, O_NONBLOCK) < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN Failed to set socket pair fd[1] to non-blocking: %s\n", - strerror(errno)); - close(sockfd); - close(pipefd[0]); - close(pipefd[1]); - return FTDM_FAIL; - } - - /* - * Set RX/TX buffer sizes on each end of the socket pair - */ - if (setsockopt(pipefd[0], SOL_SOCKET, SO_RCVBUF, &opt, optlen) < 0) { - ftdm_log(FTDM_LOG_WARNING, "mISDN Failed to set socket pair fd[0] RCVBUF: %s\n", - strerror(errno)); - } - if (setsockopt(pipefd[0], SOL_SOCKET, SO_SNDBUF, &opt, optlen) < 0) { - ftdm_log(FTDM_LOG_WARNING, "mISDN Failed to set socket pair fd[0] SNDBUF: %s\n", - strerror(errno)); - } - if (setsockopt(pipefd[1], SOL_SOCKET, SO_RCVBUF, &opt, optlen) < 0) { - ftdm_log(FTDM_LOG_WARNING, "mISDN Failed to set socket pair fd[1] RCVBUF: %s\n", - strerror(errno)); - } - if (setsockopt(pipefd[1], SOL_SOCKET, SO_SNDBUF, &opt, optlen) < 0) { - ftdm_log(FTDM_LOG_WARNING, "mISDN Failed to set socket pair fd[1] SNDBUF: %s\n", - strerror(errno)); - } - - priv->rx_audio_pipe_in = pipefd[1]; - priv->rx_audio_pipe_out = pipefd[0]; - - priv->tx_audio_pipe_in = pipefd[0]; - priv->tx_audio_pipe_out = pipefd[1]; - } -#endif - } else { - /* early activate D-Channel */ - misdn_activate_channel(ftdmchan); - ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_NONE; - } - num_configured++; - } - - return num_configured; -} - -static int misdn_find_device(const char *name, int nr_devices, struct mISDN_devinfo *info) -{ - struct mISDN_devinfo devinfo; - char *endp = NULL; - int port_id = -1; - int i; - - port_id = strtoul(name, &endp, 10); - if (endp == name || errno == EINVAL) - port_id = -1; - if (port_id < 0 || port_id >= nr_devices) - port_id = -1; - - for (i = 0; i < nr_devices; i++) { - memset(&devinfo, 0, sizeof(devinfo)); - devinfo.id = i; - - if (ioctl(globals.sockfd, IMGETDEVINFO, &devinfo) < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN unable to get device %d info: %s\n", - devinfo.id, strerror(errno)); - return FTDM_FAIL; - } - if (devinfo.id == port_id) - break; - if (strlen(devinfo.name) <= 0) - continue; - if (!strcasecmp(devinfo.name, name)) - break; - } - if (i == nr_devices) - return FTDM_FAIL; - - if (info) *info = devinfo; - return FTDM_SUCCESS; -} - -#define MISDN_PH_TE_PROTOCOLS(x) \ - ((x) & ((1 << ISDN_P_TE_S0) | (1 << ISDN_P_TE_E1) | (1 << ISDN_P_TE_UP0))) -#define MISDN_PH_NT_PROTOCOLS(x) \ - ((x) & ((1 << ISDN_P_NT_S0) | (1 << ISDN_P_NT_E1) | (1 << ISDN_P_NT_UP0))) - -/** - * \brief Configure/open span ftmod_misdn settings - */ -static FIO_CONFIGURE_SPAN_FUNCTION(misdn_configure_span) -{ - struct misdn_span_private *span_priv = ftdm_span_io_private(span); - struct mISDN_devinfo devinfo; - int range_start = 0, range_end = 0; - int nr_ports = 0, nr_items = 0; - int res = 0, i; - char *chan_str, *ptr; - char *data = strdup(str); - char *item_list[10]; - - ftdm_unused_arg(name); - ftdm_unused_arg(number); - - /* only these are supported */ - switch (ftdm_span_get_trunk_type(span)) { - case FTDM_TRUNK_E1: - case FTDM_TRUNK_BRI: - case FTDM_TRUNK_BRI_PTMP: - break; - default: - ftdm_log(FTDM_LOG_ERROR, "Unsupported span type %s\n", - ftdm_span_get_trunk_type_str(span)); - return FTDM_FAIL; - } - - /* get port count */ - if (ioctl(globals.sockfd, IMGETCOUNT, &nr_ports) < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN unable to get port count: %s\n", - strerror(errno)); - goto error; - } - if (nr_ports <= 0) { - ftdm_log(FTDM_LOG_ERROR, "No mISDN devices found\n"); - goto error; - } - - /* split configuration string into port ID and channel list */ - if (!(chan_str = strchr(data, ':'))) { - ftdm_log(FTDM_LOG_ERROR, "Invalid configuration string: %s\nExpected format :[-]\n", str); - goto error; - } - *chan_str++ = '\0'; - - /* lookup port id, by number first, then by name */ - if (misdn_find_device(data, nr_ports, &devinfo) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "No such mISDN device/port: %s\n", - data); - goto error; - } - if (devinfo.nrbchan == 0 || devinfo.channelmap == 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN device '%s' has no b-channels\n", - data); - goto error; - } - if (!MISDN_PH_TE_PROTOCOLS(devinfo.Dprotocols)) { - ftdm_log(FTDM_LOG_ERROR, "mISDN device '%s' does not support any ISDN TE modes\n", - data); - goto error; - } - - /* allocate span private */ - if (!span_priv) { - int pipe[2] = { -1, -1 }; - - /* - * Not perfect, there should be something like span_create too - */ - span_priv = calloc(1, sizeof(*span_priv)); - if (!span_priv) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to allocate span private data\n"); - return FTDM_FAIL; - } - ftdm_span_io_private(span) = span_priv; - - /* init event condition */ - pthread_cond_init(&span_priv->event_cond, NULL); - pthread_mutex_init(&span_priv->event_cond_mutex, NULL); - - /* init control condition */ - pthread_cond_init(&span_priv->ctrl_cond, NULL); - pthread_mutex_init(&span_priv->ctrl_cond_mutex, NULL); - - /* create event pipe */ - if (pipe2(pipe, O_CLOEXEC) < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to create event pipe: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - span_priv->event_pipe_in = pipe[0]; - span_priv->event_pipe_out = pipe[1]; - } - - /* split channel list by ',' */ - nr_items = ftdm_separate_string(chan_str, ',', item_list, ftdm_array_len(item_list)); - - for (i = 0; i < nr_items; i++) { - /* */ - if (!(ptr = strchr(item_list[i], '-'))) { - /* single channel */ - range_start = atoi(item_list[i]); - range_end = range_start; - } else { - *ptr++ = '\0'; - /* channel range */ - range_start = atoi(item_list[i]); - range_end = atoi(ptr); - } - - /* check if channel range/id is valid */ - if (range_start <= 0 || range_end <= 0 || range_end < range_start) { - ftdm_log(FTDM_LOG_ERROR, "Invalid configuration string: %s\n", - item_list[i]); - goto error; - } - - /* add range to span */ - res = misdn_open_range(span, type, &devinfo, range_start, range_end); - if (res <= 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to configure channel(s)\n"); - goto error; - } - } - - ftdm_safe_free(data); - return res; -error: - ftdm_span_io_private(span) = NULL; - ftdm_safe_free(span_priv); - ftdm_safe_free(data); - return res; -} - -/** - * \brief Configure global ftmod_misdn settings - */ -static FIO_CONFIGURE_FUNCTION(misdn_configure) -{ - ftdm_unused_arg(category); - ftdm_unused_arg(var); - ftdm_unused_arg(val); - ftdm_unused_arg(lineno); - return FTDM_SUCCESS; -} - -/** - * \brief Retrieve alarm event information (if any) - * \param ftdmchan FreeTDM channel - */ -static FIO_GET_ALARMS_FUNCTION(misdn_get_alarms) -{ - ftdm_unused_arg(ftdmchan); -#if 0 -/* - Nope, this won't work... - - There's no way to create a separate "control" socket for a device - that can be used to send / receive MPH_INFORMATION_REQ/_IND without - having to care about PH_* messages in between... - - ... well, unless we use our own event loop (= thread) and - add event queues and data fifos, so we can sift all the - messages we get to forward them to the right receiver -*/ - char buf[MAX_DATA_MEM] = { 0 }; - struct sockaddr_mISDN addr; - struct mISDNhead *hh; - struct ph_info *phi = NULL; - struct pollfd pfd; - socklen_t addrlen = sizeof(addr); - int retval; - - /* use the global socket to query alarms */ - ftdm_log(FTDM_LOG_DEBUG, "mISDN getting alarms for channel %d:%d [%d:%d]\n", - ftdm_channel_get_span_id(ftdmchan), ftdm_channel_get_id(ftdmchan), - ftdm_channel_get_ph_span_id(ftdmchan), ftdm_channel_get_ph_id(ftdmchan)); - - memset(&addr, 0, sizeof(addr)); - addr.family = AF_ISDN; - addr.dev = ftdm_channel_get_ph_span_id(ftdmchan) - 1; - addr.channel = ftdm_channel_get_ph_id(ftdmchan) - 1; - - hh = (struct mISDNhead *)buf; - hh->prim = MPH_INFORMATION_REQ; - hh->id = MISDN_ID_ANY; - - /* */ - if ((retval = sendto(span_priv->ctrlsock, hh, sizeof(*hh), 0, (struct sockaddr *)&addr, addrlen)) <= 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to send '%s' to channel %d:%d: %s\n", - misdn_event2str(hh->prim), ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), strerror(errno)); - return FTDM_FAIL; - } - - pfd.fd = span_priv->ctrlsock; - pfd.events = POLLIN /*| POLLPRI*/; - pfd.revents = 0; - - if ((retval = poll(&pfd, 1, -1)) <= 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to poll for '%s' answer on channel %d:%d: %s\n", - misdn_event2str(hh->prim), ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), strerror(errno)); - return FTDM_FAIL; - } - - if (!(pfd.revents & (POLLIN | POLLPRI))) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to poll for '%s' answer on channel %d:%d: %s\n", - misdn_event2str(hh->prim), ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), "No read/pri flag"); - return FTDM_FAIL; - } - - if ((retval = recvfrom(span_priv->ctrlsock, buf, sizeof(buf), 0, (struct sockaddr *)&addr, &addrlen)) < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to receive answer for '%s' on channel %d:%d: %s\n", - misdn_event2str(hh->prim), ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), strerror(errno)); - return FTDM_FAIL; - } - if (retval < MISDN_HEADER_LEN) { - ftdm_log(FTDM_LOG_ERROR, "mISDN short read on channel %d:%d\n", - ftdm_channel_get_span_id(ftdmchan), ftdm_channel_get_id(ftdmchan)); - return FTDM_FAIL; - } - - switch (hh->prim) { - case MPH_INFORMATION_IND: - ftdm_log(FTDM_LOG_DEBUG, "mISDN received '%s' on channel %d:%d, size %d bytes\n", - misdn_event2str(hh->prim), ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), retval); - break; - default: - ftdm_log(FTDM_LOG_ERROR, "mISDN received unexpected answer '%s' on channel %d:%d: %s\n", - misdn_event2str(hh->prim), ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan), strerror(errno)); - return FTDM_FAIL; - } -#endif - return FTDM_SUCCESS; -} - - -/** - * \brief Poll for new events - * \param span FreeTDM span - * \param ms Timeout (in ms) - */ -static FIO_SPAN_POLL_EVENT_FUNCTION(misdn_poll_event) -{ - struct misdn_span_private *span_priv = ftdm_span_io_private(span); - struct timespec ts; - int retval = 0, nr_events = 0; - int i; - - ftdm_unused_arg(poll_events); - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - struct misdn_chan_private *chan_priv = ftdm_chan_io_private(chan); - - /* Skip channels that have event processing pending (Avoids event storms) */ - if (ftdm_test_io_flag(chan, FTDM_CHANNEL_IO_EVENT)) - continue; - - if (misdn_event_queue_has_data(chan_priv->events)) { -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN channel %d:%d has event(s)\n", - ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); -#endif - ftdm_set_io_flag(chan, FTDM_CHANNEL_IO_EVENT); - chan->last_event_time = ftdm_current_time_in_ms(); - nr_events++; - } - } - if (nr_events) { -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN span %d has %d new events pending (pre poll)\n", - ftdm_span_get_id(span), nr_events); -#endif - return FTDM_SUCCESS; - } - - -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN span %d has no events pending, polling for new events with %d ms timeout\n", - ftdm_span_get_id(span), ms); -#endif - /* Wait at least 1 ms, max 1 s */ - ms = ftdm_clamp(ms, 1, 1000); - - clock_gettime(CLOCK_REALTIME, &ts); - ts_add_msec(&ts, ms); - - if ((retval = pthread_cond_timedwait(&span_priv->event_cond, &span_priv->event_cond_mutex, &ts))) { - switch (retval) { - case ETIMEDOUT: -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN span %d: No events within %d ms\n", - ftdm_span_get_id(span), ms); -#endif - return FTDM_TIMEOUT; - default: - ftdm_log(FTDM_LOG_DEBUG, "mISDN failed to poll for events on span %d: %s\n", - ftdm_span_get_id(span), strerror(retval)); - return FTDM_FAIL; - } - } - -#ifdef MISDN_DEBUG_EVENTS - ftdm_log(FTDM_LOG_DEBUG, "mISDN span %d received new event notification, checking channel event queues\n", - ftdm_span_get_id(span)); -#endif - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - struct misdn_chan_private *chan_priv = ftdm_chan_io_private(chan); - - /* Skip channels that have event processing pending (Avoids event storms) */ - if (ftdm_test_io_flag(chan, FTDM_CHANNEL_IO_EVENT)) - continue; - - if (misdn_event_queue_has_data(chan_priv->events)) { - ftdm_set_io_flag(chan, FTDM_CHANNEL_IO_EVENT); - chan->last_event_time = ftdm_current_time_in_ms(); - nr_events++; - } - } - return (nr_events) ? FTDM_SUCCESS : FTDM_TIMEOUT; /* no events? => timeout */ -} - -/** - * Retrieve event from channel - * \param ftdmchan Channel to retrieve event from - * \param event FreeTDM event to return - * \return Success or failure - */ -static FIO_CHANNEL_NEXT_EVENT_FUNCTION(misdn_channel_next_event) -{ - struct misdn_chan_private *chan_priv = ftdm_chan_io_private(ftdmchan); - struct misdn_event *evt = NULL; - ftdm_span_t *span = ftdm_channel_get_span(ftdmchan); - uint32_t event_id = FTDM_OOB_INVALID; - - ftdm_assert(span, "span == NULL"); - - ftdm_clear_io_flag(ftdmchan, FTDM_CHANNEL_IO_EVENT); - - if (!(evt = misdn_event_queue_pop(chan_priv->events))) { -#ifdef MISDN_DEBUG_EVENTS - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN channel event queue has no events\n"); -#endif - return FTDM_FAIL; - } - -#ifdef MISDN_DEBUG_EVENTS - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Got event '%s' from channel event queue\n", - misdn_event2str(evt->id)); -#endif - /* Convert from misdn event to ftdm */ - switch (evt->id) { - case PH_DEACTIVATE_IND: - event_id = FTDM_OOB_ALARM_TRAP; - ftdmchan->alarm_flags |= FTDM_ALARM_RED; - break; - case PH_ACTIVATE_IND: - event_id = FTDM_OOB_ALARM_CLEAR; - ftdmchan->alarm_flags &= ~FTDM_ALARM_RED; - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled event id %d (0x%x) %s\n", - evt->id, evt->id, misdn_event2str(evt->id)); - } - - ftdmchan->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = ftdmchan; - *event = &span->event_header; - return FTDM_SUCCESS; -} - -/** - * \brief Retrieve event - * \param span FreeTDM span - * \param event FreeTDM event - */ -static FIO_SPAN_NEXT_EVENT_FUNCTION(misdn_next_event) -{ - int32_t event_id = FTDM_OOB_INVALID; - int i; - - ftdm_log(FTDM_LOG_DEBUG, "Reading next event from span %d\n", - ftdm_span_get_id(span)); - - for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { - ftdm_channel_t *chan = ftdm_span_get_channel(span, i); - struct misdn_chan_private *chan_priv = ftdm_chan_io_private(chan); - struct misdn_event *evt = NULL; - - ftdm_clear_io_flag(chan, FTDM_CHANNEL_IO_EVENT); - - if (!(evt = misdn_event_queue_pop(chan_priv->events))) { -#ifdef MISDN_DEBUG_EVENTS - ftdm_log_chan_msg(chan, FTDM_LOG_DEBUG, "mISDN channel event queue has no events\n"); -#endif - continue; - } - -#ifdef MISDN_DEBUG_EVENTS - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Got event '%s' from channel event queue\n", - misdn_event2str(evt->id)); -#endif - switch (evt->id) { - case PH_DEACTIVATE_IND: - event_id = FTDM_OOB_ALARM_TRAP; - chan->alarm_flags |= FTDM_ALARM_RED; - break; - case PH_ACTIVATE_IND: - event_id = FTDM_OOB_ALARM_CLEAR; - chan->alarm_flags &= ~FTDM_ALARM_RED; - break; - default: - ftdm_log(FTDM_LOG_ERROR, "Unhandled event id %d (0x%x) %s\n", - evt->id, evt->id, misdn_event2str(evt->id)); - continue; - } - - chan->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = chan; - *event = &span->event_header; - return FTDM_SUCCESS; - } - return FTDM_FAIL; -} - -/** - * \brief Shutdown ftmod_misdn channel - * \param ftdmchan FreeTDM channel - */ -static FIO_CHANNEL_DESTROY_FUNCTION(misdn_channel_destroy) -{ - struct misdn_chan_private *chan_priv = ftdm_chan_io_private(ftdmchan); - assert(chan_priv); - - ftdm_log(FTDM_LOG_DEBUG, "Destroying channel %d:%d\n", - ftdm_channel_get_span_id(ftdmchan), - ftdm_channel_get_id(ftdmchan)); - - if (ftdmchan->sockfd >= 0) { - close(ftdmchan->sockfd); - ftdmchan->sockfd = -1; - } - - /* - * Destroy fifo + event queue - */ - if (chan_priv->events) - misdn_event_queue_destroy(&chan_priv->events); - - ftdm_chan_io_private(ftdmchan) = NULL; - ftdm_safe_free(chan_priv); - - ftdm_log(FTDM_LOG_DEBUG, "mISDN channel %d:%d destroyed\n", - ftdm_channel_get_span_id(ftdmchan), ftdm_channel_get_id(ftdmchan)); - return FTDM_SUCCESS; -} - -/** - * \brief Shutdown ftmod_misdn span - * \param span FreeTDM span - */ -static FIO_SPAN_DESTROY_FUNCTION(misdn_span_destroy) -{ - struct misdn_span_private *span_priv = ftdm_span_io_private(span); - - /* free resources */ - ftdm_span_io_private(span) = NULL; - ftdm_safe_free(span_priv); - - ftdm_log(FTDM_LOG_DEBUG, "mISDN span %d (%s) destroyed\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - return FTDM_SUCCESS; -} - - -/** - * Called by misdn_span_run() to handle incoming b-channel events - * \param[in] chan FreeTDM channel object - * \return FTDM_SUCCESS on success, FTDM_* on error - */ -static ftdm_status_t handle_b_channel_event(ftdm_channel_t *chan) -{ - struct misdn_chan_private *priv = ftdm_chan_io_private(chan); - char buf[MAX_DATA_MEM] = { 0 }; - struct mISDNhead *mh = (void *)buf; - int retval, retries = 5; - - do { - /* - * Retry reading multiple times if recvfrom() returns EAGAIN - */ - retval = recvfrom(chan->sockfd, buf, sizeof(buf), 0, NULL, NULL); - if (retval < 0 && errno != EAGAIN) - break; - - } while (retval < 0 && retries-- > 0); - - if (retval < 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to receive message: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - if (retval < MISDN_HEADER_LEN) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN message too short, min.: %d, read: %d\n", - (int)MISDN_HEADER_LEN, retval); - return FTDM_FAIL; - } - - switch (mh->prim) { - case PH_DATA_IND: { - int datalen = retval - MISDN_HEADER_LEN; - char *data = buf + MISDN_HEADER_LEN; - - /* Discard incoming audio if not active */ - if (priv->active) { - /* Convert audio data */ - misdn_convert_audio_bits(data, datalen); - - /* Write audio into receive pipe */ - if ((retval = write(priv->rx_audio_pipe_in, data, datalen)) < 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to write audio data into rx pipe: %s\n", - strerror(errno)); - return FTDM_FAIL; - } else if (retval < datalen) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN short write into rx pipe, written: %d, expected: %d\n", - retval, datalen); - return FTDM_FAIL; - } - } - - /* Get receive buffer usage */ - if (ioctl(priv->tx_audio_pipe_out, FIONREAD, &retval) < 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to get tx audio buffer usage: %s\n", - strerror(errno)); - return FTDM_FAIL; - } else if (retval < datalen) { -// ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN has not enough bytes in tx audio pipe, available: %d, requested: %d\n", -// retval, datalen); - priv->tx_pipe_under_cnt++; - return FTDM_SUCCESS; - } - -#ifdef MISDN_DEBUG_IO - ftdm_log_chan(chan, FTDM_LOG_INFO, "mISDN tx audio buffer usage: %d\n", - retval); -#endif - - /* Get audio from tx pipe */ - if ((retval = read(priv->tx_audio_pipe_out, data, datalen)) < 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to read audio data from tx pipe: %s\n", - strerror(errno)); - return FTDM_FAIL; - } else if (retval == 0) { - ftdm_log_chan_msg(chan, FTDM_LOG_NOTICE, "mISDN tx pipe is empty\n"); - priv->tx_pipe_under_cnt++; - return FTDM_SUCCESS; - } else if (retval < datalen) { - ftdm_log_chan(chan, FTDM_LOG_NOTICE, "mISDN short read from tx pipe, read: %d, expected: %d\n", - retval, datalen); - priv->tx_pipe_under_cnt++; - priv->tx_miss_bytes += ftdm_max(0, datalen - retval); - datalen = retval; - } - priv->tx_pipe_rd_bytes += retval; - - if (!priv->active) { - /* discard */ - return FTDM_SUCCESS; - } - - /* Convert audio data */ - misdn_convert_audio_bits(data, datalen); - - /* Write to channel */ - mh->prim = PH_DATA_REQ; - mh->id = 0; - datalen += MISDN_HEADER_LEN; - - if ((retval = write(chan->sockfd, buf, datalen)) < 0) { - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to write audio data into b-channel: %s\n", - strerror(errno)); - return FTDM_FAIL; - } else if (retval < datalen) { - ftdm_log_chan(chan, FTDM_LOG_WARNING, "mISDN short write into b-channel, written: %d, expected: %d\n", - retval, datalen); - priv->tx_lost_bytes += ftdm_max(0, datalen - retval - MISDN_HEADER_LEN); - } - priv->tx_sent_bytes += ftdm_max(0, retval - MISDN_HEADER_LEN); - break; - } - case PH_DATA_CNF: - priv->tx_ack_cnt++; - break; - case PH_DEACTIVATE_IND: - priv->active = 0; - break; - case PH_ACTIVATE_IND: - priv->active = 1; - break; - case PH_CONTROL_IND: { - int datalen = retval - MISDN_HEADER_LEN; - char *data = buf + MISDN_HEADER_LEN; - - misdn_handle_ph_control_ind(chan, mh, data, datalen); - break; - } - default: - ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN received unknown/unhandled event primitive: (%d) %s\n", - mh->prim, misdn_event2str(mh->prim)); - break; - } - return FTDM_SUCCESS; -} - - -/** - * Timeout (miliseconds) for epoll_wait() - */ -#define MISDN_EPOLL_WAIT_MAX_MSEC 1000 - -/** - * mISDN I/O thread - * This thread handles all of the B-Channel I/O, this avoids all of the hazzles with - * intermixed data + control frames on mISDN sockets and the missing write poll support on B-Channels. - * - * Each channel uses a unix stream socketpair as a two-way, pipe replacement for incoming and outgoing - * data. Socketpairs allow a more fine grained tuning of the buffer sizes (pipe are restricted to multiples of - * the native page size (with the smallest possible size (4k) being already 500ms worth of audio). - * - * The socketpair buffer sizes and the send algorithm have been carefully tuned to: - * - * - Minimize the risk of sending too much data and making the mISDN drivers unhappy, by - * sending PH_DATA_REQ only when there is as much data available as we have received in - * the PH_DATA_IND. - * - * - Avoid deadlocks between ftdm_write() trying to fill an almust full socket buffer and - * the I/O thread not having enough data to send a PH_DATA_REQ message. - * (The write() call will return EAGAIN since there is not ehough space free to send all audio data.) - * - * \param thread FreeTDM thread handle - * \param data Private data pointer passed to ftdm_thread_create_detached() (the span object) - * \return Always returns NULL (unused) - * - * \note - * ftdm_span_start/_stop() locks the span mutex, - * use direct access to span members to avoid deadlocking - * - * \todo - * Move D-Channel handling into the I/O thread too. - * Use custom ring buffer structures instead of socketpairs - * (for even more fine grained size control). - */ -static void *misdn_span_run(ftdm_thread_t *thread, void *data) -{ - ftdm_span_t *span = data; - struct misdn_span_private *priv = ftdm_span_io_private(span); - struct epoll_event evh; - int epfd = -1; - int ret; - int i; - - ftdm_unused_arg(thread); - ftdm_log(FTDM_LOG_NOTICE, "mISDN[%d:%s] span thread initializing\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - /* Use epoll for event handling */ - epfd = epoll_create(1); - if (epfd < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN[%d:%s] failed to create epoll context: %s\n", - ftdm_span_get_id(span), ftdm_span_get_name(span), strerror(errno)); - goto error; - } - - ftdm_log(FTDM_LOG_DEBUG, "mISDN[%d:%s] adding event pipe to epoll context\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - /* Add event pipe */ - evh.events = EPOLLIN | EPOLLPRI | EPOLLERR; - evh.data.fd = priv->event_pipe_out; - - ret = epoll_ctl(epfd, EPOLL_CTL_ADD, priv->event_pipe_out, &evh); - if (ret < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN[%d:%s] failed to add event pipe to epoll context: %s\n", - ftdm_span_get_id(span), ftdm_span_get_name(span), strerror(errno)); - goto error; - } - - ftdm_log(FTDM_LOG_DEBUG, "mISDN[%d:%s] adding b-channels to epoll context\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - /* Add b-channels */ - for (i = 1; i <= span->chan_count; i++) { - ftdm_channel_t *chan = span->channels[i]; - ftdm_assert(chan, "channel == NULL"); - - if (ftdm_channel_get_type(chan) != FTDM_CHAN_TYPE_B) - continue; - - ftdm_log(FTDM_LOG_DEBUG, "mISDN[%d:%s] adding b-channel [%d:%d] to epoll context\n", - ftdm_span_get_id(span), ftdm_span_get_name(span), - ftdm_channel_get_id(chan), ftdm_channel_get_ph_id(chan)); - - evh.events = EPOLLIN | EPOLLPRI | EPOLLERR; - evh.data.ptr = chan; - - ret = epoll_ctl(epfd, EPOLL_CTL_ADD, chan->sockfd, &evh); - if (ret < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN[%d:%s] failed to add b-channel [%d] socket to epoll context: %s\n", - ftdm_span_get_id(span), ftdm_span_get_name(span), ftdm_channel_get_id(chan), strerror(errno)); - goto error; - } - } - - ftdm_log(FTDM_LOG_NOTICE, "mISDN[%d:%s] span thread started\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - /* Notify world we're running */ - priv->running = 1; - pthread_cond_signal(&priv->ctrl_cond); - - while (priv->running > 0) { - struct epoll_event ev[10]; - int timeout_ms = MISDN_EPOLL_WAIT_MAX_MSEC; - - ret = epoll_wait(epfd, ev, ftdm_array_len(ev), timeout_ms); - if (ret < 0) { - switch (errno) { - case EAGAIN: - case EINTR: - continue; - default: - ftdm_log(FTDM_LOG_ERROR, "mISDN[%d:%s] epoll_wait() failed: %s\n", - ftdm_span_get_id(span), ftdm_span_get_name(span), strerror(errno)); - goto error; - } - } - /* Check events */ - for (i = 0; i < ret; i++) { - /* */ - if (ev[i].data.fd == priv->event_pipe_out) { - struct misdn_command cmd; - /* event pipe */ - ftdm_log(FTDM_LOG_DEBUG, "mISDN[%d:%s] event pipe notification\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - ret = read(priv->event_pipe_out, &cmd, sizeof(cmd)); - if (ret < sizeof(cmd)) { - ftdm_log(FTDM_LOG_ERROR, "mISDN[%d:%s] failed to read span thread command\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - continue; - } - - switch (cmd.type) { - case MISDN_CMD_STOP: - ftdm_log(FTDM_LOG_ERROR, "mISDN[%d:%s] got STOP command\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - priv->running = -1; - break; - default: - ftdm_log(FTDM_LOG_ERROR, "mISDN[%d:%s] got unknown command: %d\n", - ftdm_span_get_id(span), ftdm_span_get_name(span), cmd.type); - } - - } else { - ftdm_channel_t *chan = ev[i].data.ptr; - handle_b_channel_event(chan); - } - } - } -error: - ftdm_log(FTDM_LOG_NOTICE, "mISDN[%d:%s] span thread stopped\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - /* Remove epoll event sources */ - for (i = 1; i <= span->chan_count; i++) { - ftdm_channel_t *chan = span->channels[i]; - ftdm_assert(chan, "channel == NULL"); - - if (ftdm_channel_get_type(chan) != FTDM_CHAN_TYPE_B) - continue; - - ret = epoll_ctl(epfd, EPOLL_CTL_DEL, chan->sockfd, NULL); - if (ret < 0) { - ftdm_log(FTDM_LOG_ERROR, "mISDN[%d:%s] failed to remove b-channel [%d] socket from epoll context: %s\n", - ftdm_span_get_id(span), ftdm_span_get_name(span), ftdm_channel_get_id(chan), strerror(errno)); - } - } - - /* Close epoll context */ - if (epfd >= 0) close(epfd); - - /* Notify world we stopped running */ - priv->running = 0; - pthread_cond_signal(&priv->ctrl_cond); - return NULL; -} - -/** - * Timeout (miliseconds) for span start/stop completion - */ -#define SPAN_DEFAULT_TIMEOUT_MSEC 10000 - -static FIO_SPAN_START_FUNCTION(misdn_span_start) -{ - struct misdn_span_private *span_priv = ftdm_span_io_private(span); - struct timespec timeout; - int retval; - - ftdm_log(FTDM_LOG_NOTICE, "mISDN starting span %d (%s)\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - span_priv->running = 0; - - if (ftdm_thread_create_detached(misdn_span_run, span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to start span %d (%s)\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - return FTDM_FAIL; - } - - /* - * Wait SPAN_DEFAULT_TIMEOUT_MSEC miliseconds for I/O thread to start up - */ - clock_gettime(CLOCK_REALTIME, &timeout); - ts_add_msec(&timeout, SPAN_DEFAULT_TIMEOUT_MSEC); - - pthread_mutex_lock(&span_priv->ctrl_cond_mutex); - - retval = pthread_cond_timedwait(&span_priv->ctrl_cond, &span_priv->ctrl_cond_mutex, &timeout); - if (retval == ETIMEDOUT) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to start span %d (%s) in 10 seconds\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - return FTDM_FAIL; - } else if (retval) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to start span %d (%s): %s\n", - ftdm_span_get_id(span), ftdm_span_get_name(span), strerror(errno)); - return FTDM_FAIL; - } - - pthread_mutex_unlock(&span_priv->ctrl_cond_mutex); - return FTDM_SUCCESS; -} - -static FIO_SPAN_STOP_FUNCTION(misdn_span_stop) -{ - struct misdn_span_private *span_priv = ftdm_span_io_private(span); - struct timespec timeout; - struct misdn_command cmd; - int retval; - - ftdm_log(FTDM_LOG_NOTICE, "mISDN stopping span %d (%s)\n", - ftdm_span_get_id(span), ftdm_span_get_name(span)); - - span_priv->running = -1; - - /* Wake up thread */ - cmd.type = MISDN_CMD_STOP; - retval = write(span_priv->event_pipe_in, &cmd, sizeof(cmd)); - if (retval < sizeof(cmd)) { - ftdm_log(FTDM_LOG_WARNING, "mISDN failed to send STOP command to span thread\n"); - } - - /* - * Wait SPAN_DEFAULT_TIMEOUT_MSEC miliseconds for I/O thread to shut down - */ - clock_gettime(CLOCK_REALTIME, &timeout); - ts_add_msec(&timeout, SPAN_DEFAULT_TIMEOUT_MSEC); - - pthread_mutex_lock(&span_priv->ctrl_cond_mutex); - - retval = pthread_cond_timedwait(&span_priv->ctrl_cond, &span_priv->ctrl_cond_mutex, &timeout); - if (retval == ETIMEDOUT) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to stop thread in 10 seconds\n"); - return FTDM_FAIL; - } else if (retval) { - ftdm_log(FTDM_LOG_ERROR, "mISDN failed to stop thread: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - - pthread_mutex_unlock(&span_priv->ctrl_cond_mutex); - return FTDM_SUCCESS; -} - - -/** - * \brief ftmod_misdn interface - */ -static const ftdm_io_interface_t misdn_interface = { - .name = "misdn", - - .open = misdn_open, - .close = misdn_close, - .wait = misdn_wait, - .read = misdn_read, - .write = misdn_write, - - .poll_event = misdn_poll_event, - .next_event = misdn_next_event, - - .command = misdn_command, - .get_alarms = misdn_get_alarms, - .configure = misdn_configure, /* configure global parameters */ - .configure_span = misdn_configure_span, /* assign channels to span */ - .channel_next_event = misdn_channel_next_event, - .channel_destroy = misdn_channel_destroy, /* clean up channel */ - .span_destroy = misdn_span_destroy, /* clean up span */ - - .span_start = misdn_span_start, - .span_stop = misdn_span_stop, -}; - - -/** - * \brief ftmod_misdn module init function - */ -static FIO_IO_LOAD_FUNCTION(misdn_load) -{ - struct mISDNversion ver; - struct mISDN_devinfo devinfo; - int devcnt, usecnt; - int i; - - /* */ - globals.sockfd = socket(PF_ISDN, SOCK_RAW, ISDN_P_BASE); - if (globals.sockfd < 0) { - ftdm_log(FTDM_LOG_CRIT, "Unable to create mISDN base socket (are you sure this kernel has mISDN support?)\n"); - return FTDM_FAIL; - } - - if (ioctl(globals.sockfd, IMGETVERSION, &ver) < 0) { - ftdm_log(FTDM_LOG_CRIT, "Unable to retrieve mISDN version\n"); - goto error; - } - - ftdm_log(FTDM_LOG_INFO, "mISDN Interface version %hhd.%hhd.%hd\n", ver.major, ver.minor, ver.release); - - devcnt = 0; - if (ioctl(globals.sockfd, IMGETCOUNT, &devcnt) < 0) { - ftdm_log(FTDM_LOG_CRIT, "Unable to retrieve number of mISDN devices\n"); - goto error; - - } - - if (!devcnt) { - ftdm_log(FTDM_LOG_CRIT, "No mISDN devices found\n"); - goto error; - } - usecnt = devcnt; - - ftdm_log(FTDM_LOG_INFO, "Found %d mISDN devices:\n", devcnt); - - /* Output most important device information */ - for (i = 0; i < devcnt; i++) { - int caps = MISDN_CAPS_NONE; - - devinfo.id = i; - if (ioctl(globals.sockfd, IMGETDEVINFO, &devinfo) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Failed to retrieve information for device %d\n", i); - continue; - } - - /* print */ - ftdm_log(FTDM_LOG_INFO, "<%d> Name: %s, B-Channels: %d\n", - devinfo.id, - ftdm_strlen_zero_buf(devinfo.name) ? "Unknown" : devinfo.name, - devinfo.nrbchan); - - /* D-Channels capabilities */ - if (devinfo.Dprotocols & (1 << ISDN_P_TE_E1)) - caps |= MISDN_CAPS_TE | MISDN_CAPS_PRI; - if (devinfo.Dprotocols & (1 << ISDN_P_NT_E1)) - caps |= MISDN_CAPS_NT | MISDN_CAPS_PRI; - if (devinfo.Dprotocols & (1 << ISDN_P_TE_S0)) - caps |= MISDN_CAPS_TE | MISDN_CAPS_BRI; - if (devinfo.Dprotocols & (1 << ISDN_P_NT_S0)) - caps |= MISDN_CAPS_NT | MISDN_CAPS_BRI; -#ifdef ISDN_P_TE_UP0 - if (devinfo.Dprotocols & (1 << ISDN_P_TE_UP0)) - caps |= MISDN_CAPS_TE | MISDN_CAPS_UP0 | MISDN_CAPS_BRI; -#endif -#ifdef ISDN_P_NT_UP0 - if (devinfo.Dprotocols & (1 << ISDN_P_NT_UP0)) - caps |= MISDN_CAPS_NT | MISDN_CAPS_UP0 | MISDN_CAPS_BRI; -#endif - /* B-Channel capabilities */ - if (devinfo.Bprotocols & (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK))) - caps |= MISDN_CAPS_RAW; - if (devinfo.Bprotocols & (1 << (ISDN_P_B_HDLC & ISDN_P_B_MASK))) - caps |= MISDN_CAPS_HDLC; - - ftdm_log(FTDM_LOG_INFO, " Type: %s, Modes: %s %s\n", - MISDN_IS_PRI(caps) ? "PRI" : "BRI", - MISDN_IS_NT(caps) ? "NT" : "", - MISDN_IS_TE(caps) ? "TE" : ""); - - ftdm_log(FTDM_LOG_INFO, " B-Channel modes: %s %s\n", - MISDN_IS_RAW(caps) ? "RAW" : "", - MISDN_IS_HDLC(caps) ? "HDLC" : ""); - - if (!(MISDN_IS_NT(caps) || MISDN_IS_TE(caps)) && !MISDN_IS_RAW(caps)) { - ftdm_log(FTDM_LOG_ERROR, " This device is unusable!\n"); - usecnt--; - } - } - if (!usecnt) { - ftdm_log(FTDM_LOG_CRIT, "No useable devices found!\n"); - goto error; - } - - ftdm_log(FTDM_LOG_INFO, "Found %d useable mISDN devices\n", usecnt); - - /* assign interface struct */ - *fio = (ftdm_io_interface_t *)&misdn_interface; - return FTDM_SUCCESS; -error: - if (globals.sockfd >= 0) - close(globals.sockfd); - return FTDM_FAIL; -} - -/** - * \brief ftmod_misdn module shutdown - */ -static FIO_IO_UNLOAD_FUNCTION(misdn_unload) -{ - if (globals.sockfd >= 0) - close(globals.sockfd); - return FTDM_SUCCESS; -} - -/** - * \brief ftmod_misdn module - */ -ftdm_module_t ftdm_module = { - .name = "misdn", - .io_load = misdn_load, - .io_unload = misdn_unload -}; diff --git a/libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h b/libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h deleted file mode 100644 index 54c550e8e7..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FTDM_PIKA_H -#define FTDM_PIKA_H -#include "freetdm.h" -#include "pikahmpapi.h" - - - -#define PIKA_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); -#define PIKA_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ - _TYPE _FUNC1 (const char *name) \ - { \ - int i; \ - _TYPE t = _MAX ; \ - \ - for (i = 0; i < _MAX ; i++) { \ - if (!strcasecmp(name, _STRINGS[i])) { \ - t = (_TYPE) i; \ - break; \ - } \ - } \ - \ - return t; \ - } \ - const char * _FUNC2 (_TYPE type) \ - { \ - if (type > _MAX) { \ - type = _MAX; \ - } \ - return _STRINGS[(int)type]; \ - } - - -typedef enum { - PIKA_SPAN_FRAMING_T1_D4, - PIKA_SPAN_FRAMING_T1_ESF, - PIKA_SPAN_FRAMING_E1_BASIC, - PIKA_SPAN_FRAMING_E1_CRC4, - PIKA_SPAN_INVALID -} PIKA_TSpanFraming; -#define PIKA_SPAN_STRINGS "T1_D4", "T1_ESF", "E1_BASIC", "E1_CRC4" -PIKA_STR2ENUM_P(pika_str2span, pika_span2str, PIKA_TSpanFraming) - -typedef enum { - PIKA_SPAN_ENCODING_T1_AMI_ZS_NONE, - PIKA_SPAN_ENCODING_T1_AMI_ZS_GTE, - PIKA_SPAN_ENCODING_T1_AMI_ZS_BELL, - PIKA_SPAN_ENCODING_T1_AMI_ZS_JAM8, - PIKA_SPAN_ENCODING_T1_B8ZS, - PIKA_SPAN_ENCODING_E1_AMI, - PIKA_SPAN_ENCODING_E1_HDB3, - PIKA_SPAN_ENCODING_INVALID -} PIKA_TSpanEncoding; -#define PIKA_SPAN_ENCODING_STRINGS "T1_AMI_ZS_NONE", "T1_AMI_ZS_GTE", "T1_AMI_ZS_BELL", "T1_AMI_ZS_JAM8", "T1_B8ZS", "E1_AMI", "E1_HDB3" -PIKA_STR2ENUM_P(pika_str2span_encoding, pika_span_encoding2str, PIKA_TSpanEncoding) - -typedef enum { - PIKA_SPAN_LOOP_LENGTH_SHORT_HAUL, - PIKA_SPAN_LOOP_LENGTH_LONG_HAUL, - PIKA_SPAN_LOOP_INVALID -} PIKA_TSpanLoopLength; -#define PIKA_LL_STRINGS "SHORT_HAUL", "LONG_HAUL" -PIKA_STR2ENUM_P(pika_str2loop_length, pika_loop_length2str, PIKA_TSpanLoopLength) - -typedef enum { - PIKA_SPAN_LBO_T1_LONG_0_DB, - PIKA_SPAN_LBO_T1_LONG_7_DB, - PIKA_SPAN_LBO_T1_LONG_15_DB, - PIKA_SPAN_LBO_T1_LONG_22_DB, - PIKA_SPAN_LBO_T1_SHORT_133_FT, - PIKA_SPAN_LBO_T1_SHORT_266_FT, - PIKA_SPAN_LBO_T1_SHORT_399_FT, - PIKA_SPAN_LBO_T1_SHORT_533_FT, - PIKA_SPAN_LBO_T1_SHORT_655_FT, - PIKA_SPAN_LBO_E1_WAVEFORM_120_OHM, - PIKA_SPAN_LBO_INVALID -} PIKA_TSpanBuildOut; -#define PIKA_LBO_STRINGS "T1_LONG_0_DB", "T1_LONG_7_DB", "T1_LONG_15_DB", "T1_LONG_22_DB", "T1_SHORT_133_FT", "T1_SHORT_266_FT", "T1_SHORT_399_FT", "T1_SHORT_533_FT", "T1_SHORT_655_FT", "E1_WAVEFORM_120_OHM" -PIKA_STR2ENUM_P(pika_str2lbo, pika_lbo2str, PIKA_TSpanBuildOut) - -typedef enum { - PIKA_SPAN_COMPAND_MODE_MU_LAW = 1, - PIKA_SPAN_COMPAND_MODE_A_LAW, - PIKA_SPAN_COMPAND_MODE_INVALID -} PIKA_TSpanCompandMode; -#define PIKA_SPAN_COMPAND_MODE_STRINGS "MU_LAW", "A_LAW" -PIKA_STR2ENUM_P(pika_str2compand_mode, pika_compand_mode2str, PIKA_TSpanCompandMode) - -#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/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2008.vcproj deleted file mode 100644 index 7ad535ea3f..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2008.vcproj +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj.filters deleted file mode 100644 index 4d4cec4668..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj.filters +++ /dev/null @@ -1,23 +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 - - - - - Source Files - - - - - Header Files - - - \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c deleted file mode 100644 index fcd5149814..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c +++ /dev/null @@ -1,1469 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include "freetdm.h" -#include "ftdm_pika.h" - - -#define MAX_NUMBER_OF_TRUNKS 64 -#define PIKA_BLOCK_SIZE 160 -#define PIKA_BLOCK_LEN 20 -#define PIKA_NUM_BUFFERS 8 -#define TRY_OR_DIE(__code, __status, __label) if ((status = __code ) != __status) goto __label -#define pk_atof(__a) (PK_FLOAT) atof(__a) - -PK_VOID PK_CALLBACK media_out_callback(PKH_TPikaEvent *event); - -FTDM_ENUM_NAMES(PIKA_SPAN_NAMES, PIKA_SPAN_STRINGS) -PIKA_STR2ENUM(pika_str2span, pika_span2str, PIKA_TSpanFraming, PIKA_SPAN_NAMES, PIKA_SPAN_INVALID) - -FTDM_ENUM_NAMES(PIKA_SPAN_ENCODING_NAMES, PIKA_SPAN_ENCODING_STRINGS) -PIKA_STR2ENUM(pika_str2span_encoding, pika_span_encoding2str, PIKA_TSpanEncoding, PIKA_SPAN_ENCODING_NAMES, PIKA_SPAN_ENCODING_INVALID) - -FTDM_ENUM_NAMES(PIKA_LL_NAMES, PIKA_LL_STRINGS) -PIKA_STR2ENUM(pika_str2loop_length, pika_loop_length2str, PIKA_TSpanLoopLength, PIKA_LL_NAMES, PIKA_SPAN_LOOP_INVALID) - -FTDM_ENUM_NAMES(PIKA_LBO_NAMES, PIKA_LBO_STRINGS) -PIKA_STR2ENUM(pika_str2lbo, pika_lbo2str, PIKA_TSpanBuildOut, PIKA_LBO_NAMES, PIKA_SPAN_LBO_INVALID) - -FTDM_ENUM_NAMES(PIKA_SPAN_COMPAND_MODE_NAMES, PIKA_SPAN_COMPAND_MODE_STRINGS) -PIKA_STR2ENUM(pika_str2compand_mode, pika_compand_mode2str, PIKA_TSpanCompandMode, PIKA_SPAN_COMPAND_MODE_NAMES, PIKA_SPAN_COMPAND_MODE_INVALID) - - -typedef enum { - PK_FLAG_READY = (1 << 0), - PK_FLAG_LOCKED = (1 << 1) -} pk_flag_t; - -struct general_config { - uint32_t region; -}; -typedef struct general_config general_config_t; - -struct pika_channel_profile { - char name[80]; - PKH_TRecordConfig record_config; - PKH_TPlayConfig play_config; - int ec_enabled; - PKH_TECConfig ec_config; - PKH_TSpanConfig span_config; - general_config_t general_config; - int cust_span; -}; -typedef struct pika_channel_profile pika_channel_profile_t; - -static struct { - PKH_TSystemDeviceList board_list; - TPikaHandle open_boards[MAX_NUMBER_OF_TRUNKS]; - TPikaHandle system_handle; - PKH_TSystemConfig system_config; - PKH_TRecordConfig record_config; - PKH_TPlayConfig play_config; - PKH_TECConfig ec_config; - PKH_TSpanConfig t1_span_config; - PKH_TSpanConfig e1_span_config; - ftdm_hash_t *profile_hash; - general_config_t general_config; -} globals; - - -struct pika_span_data { - TPikaHandle event_queue; - PKH_TPikaEvent last_oob_event; - uint32_t boardno; - PKH_TSpanConfig span_config; - TPikaHandle handle; - uint32_t flags; -}; -typedef struct pika_span_data pika_span_data_t; - -struct pika_chan_data { - TPikaHandle handle; - TPikaHandle media_in; - TPikaHandle media_out; - TPikaHandle media_in_queue; - TPikaHandle media_out_queue; - PKH_TPikaEvent last_media_event; - PKH_TPikaEvent last_oob_event; - PKH_TRecordConfig record_config; - PKH_TPlayConfig play_config; - int ec_enabled; - PKH_TECConfig ec_config; - PKH_THDLCConfig hdlc_config; - ftdm_buffer_t *digit_buffer; - ftdm_mutex_t *digit_mutex; - ftdm_size_t dtmf_len; - uint32_t flags; - uint32_t hdlc_bytes; -}; -typedef struct pika_chan_data pika_chan_data_t; - -static const char *pika_board_type_string(PK_UINT type) -{ - if (type == PKH_BOARD_TYPE_DIGITAL_GATEWAY) { - return "digital_gateway"; - } - - if (type == PKH_BOARD_TYPE_ANALOG_GATEWAY) { - return "analog_gateway"; - } - - return "unknown"; -} - -/** - * \brief Process configuration variable for a pika profile - * \param category Pika profile name - * \param var Variable name - * \param val Variable value - * \param lineno Line number from configuration file (unused) - * \return Success - */ -static FIO_CONFIGURE_FUNCTION(pika_configure) -{ - pika_channel_profile_t *profile = NULL; - int ok = 1; - - if (!(profile = (pika_channel_profile_t *) hashtable_search(globals.profile_hash, (char *)category))) { - profile = ftdm_malloc(sizeof(*profile)); - memset(profile, 0, sizeof(*profile)); - ftdm_set_string(profile->name, category); - profile->ec_config = globals.ec_config; - profile->record_config = globals.record_config; - profile->play_config = globals.play_config; - hashtable_insert(globals.profile_hash, (void *)profile->name, profile, HASHTABLE_FLAG_NONE); - ftdm_log(FTDM_LOG_INFO, "creating profile [%s]\n", category); - } - - if (!strcasecmp(var, "rx-gain")) { - profile->record_config.gain = pk_atof(val); - } else if (!strcasecmp(var, "rx-agc-enabled")) { - profile->record_config.AGC.enabled = ftdm_true(val); - } else if (!strcasecmp(var, "rx-agc-targetPower")) { - profile->record_config.AGC.targetPower = pk_atof(val); - } else if (!strcasecmp(var, "rx-agc-minGain")) { - profile->record_config.AGC.minGain = pk_atof(val); - } else if (!strcasecmp(var, "rx-agc-maxGain")) { - profile->record_config.AGC.maxGain = pk_atof(val); - } else if (!strcasecmp(var, "rx-agc-attackRate")) { - profile->record_config.AGC.attackRate = atoi(val); - } else if (!strcasecmp(var, "rx-agc-decayRate")) { - profile->record_config.AGC.decayRate = atoi(val); - } else if (!strcasecmp(var, "rx-agc-speechThreshold")) { - profile->record_config.AGC.speechThreshold = pk_atof(val); - } else if (!strcasecmp(var, "rx-vad-enabled")) { - profile->record_config.VAD.enabled = ftdm_true(val); - } else if (!strcasecmp(var, "rx-vad-activationThreshold")) { - profile->record_config.VAD.activationThreshold = pk_atof(val); - } else if (!strcasecmp(var, "rx-vad-activationDebounceTime")) { - profile->record_config.VAD.activationDebounceTime = atoi(val); - } else if (!strcasecmp(var, "rx-vad-deactivationThreshold")) { - profile->record_config.VAD.deactivationThreshold = pk_atof(val); - } else if (!strcasecmp(var, "rx-vad-deactivationDebounceTime")) { - profile->record_config.VAD.deactivationDebounceTime = atoi(val); - } else if (!strcasecmp(var, "rx-vad-preSpeechBufferSize")) { - profile->record_config.VAD.preSpeechBufferSize = atoi(val); - } else if (!strcasecmp(var, "tx-gain")) { - profile->play_config.gain = pk_atof(val); - } else if (!strcasecmp(var, "tx-agc-enabled")) { - profile->play_config.AGC.enabled = ftdm_true(val); - } else if (!strcasecmp(var, "tx-agc-targetPower")) { - profile->play_config.AGC.targetPower = pk_atof(val); - } else if (!strcasecmp(var, "tx-agc-minGain")) { - profile->play_config.AGC.minGain = pk_atof(val); - } else if (!strcasecmp(var, "tx-agc-maxGain")) { - profile->play_config.AGC.maxGain = pk_atof(val); - } else if (!strcasecmp(var, "tx-agc-attackRate")) { - profile->play_config.AGC.attackRate = atoi(val); - } else if (!strcasecmp(var, "tx-agc-decayRate")) { - profile->play_config.AGC.decayRate = atoi(val); - } else if (!strcasecmp(var, "tx-agc-speechThreshold")) { - profile->play_config.AGC.speechThreshold = pk_atof(val); - } else if (!strcasecmp(var, "ec-enabled")) { - profile->ec_enabled = ftdm_true(val); - } else if (!strcasecmp(var, "ec-doubleTalkerThreshold")) { - profile->ec_config.doubleTalkerThreshold = pk_atof(val); - } else if (!strcasecmp(var, "ec-speechPresentThreshold")) { - profile->ec_config.speechPresentThreshold = pk_atof(val); - } else if (!strcasecmp(var, "ec-echoSuppressionThreshold")) { - profile->ec_config.echoSuppressionThreshold = pk_atof(val); - } else if (!strcasecmp(var, "ec-echoSuppressionEnabled")) { - profile->ec_config.echoSuppressionEnabled = ftdm_true(val); - } else if (!strcasecmp(var, "ec-comfortNoiseEnabled")) { - profile->ec_config.comfortNoiseEnabled = ftdm_true(val); - } else if (!strcasecmp(var, "ec-adaptationModeEnabled")) { - profile->ec_config.adaptationModeEnabled = ftdm_true(val); - } else if (!strcasecmp(var, "framing")) { - profile->span_config.framing = pika_str2span(val); - profile->cust_span++; - } else if (!strcasecmp(var, "encoding")) { - profile->span_config.encoding = pika_str2span_encoding(val); - profile->cust_span++; - } else if (!strcasecmp(var, "loopLength")) { - profile->span_config.loopLength = pika_str2loop_length(val); - profile->cust_span++; - } else if (!strcasecmp(var, "buildOut")) { - profile->span_config.buildOut = pika_str2lbo(val); - profile->cust_span++; - } else if (!strcasecmp(var, "compandMode")) { - profile->span_config.compandMode = pika_str2compand_mode(val); - profile->cust_span++; - } else if (!strcasecmp(var, "region")) { - if (!strcasecmp(val, "eu")) { - profile->general_config.region = PKH_TRUNK_EU; - } else { - profile->general_config.region = PKH_TRUNK_NA; - } - } else { - ok = 0; - } - - if (ok) { - ftdm_log(FTDM_LOG_INFO, "setting param [%s]=[%s] for profile [%s]\n", var, val, category); - } else { - ftdm_log(FTDM_LOG_ERROR, "unknown param [%s]\n", var); - } - - return FTDM_SUCCESS; -} - -/** - * \brief Pika event handler - * \param event Pika event - */ -PK_VOID PK_CALLBACK media_out_callback(PKH_TPikaEvent *event) -{ - PK_STATUS pk_status; - ftdm_channel_t *ftdmchan = event->userData; - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; - - //PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; - //PKH_EVENT_GetText(event->id, event_text, sizeof(event_text)); - //ftdm_log(FTDM_LOG_DEBUG, "Event: %s\n", event_text); - - switch (event->id) { - case PKH_EVENT_PLAY_IDLE: - { - while (ftdm_buffer_inuse(chan_data->digit_buffer)) { - char dtmf[128] = ""; - ftdm_mutex_lock(chan_data->digit_mutex); - chan_data->dtmf_len = ftdm_buffer_read(chan_data->digit_buffer, dtmf, sizeof(dtmf)); - pk_status = PKH_TG_PlayDTMF(chan_data->media_out, dtmf); - ftdm_mutex_unlock(chan_data->digit_mutex); - } - } - break; - case PKH_EVENT_TG_TONE_PLAYED: - { - - if (!event->p1) { - ftdm_mutex_lock(chan_data->digit_mutex); - PKH_PLAY_Start(chan_data->media_out); - chan_data->dtmf_len = 0; - ftdm_mutex_unlock(chan_data->digit_mutex); - } - - - } - break; - default: - break; - } - -} - -/** - * \brief Initialises a range of pika channels - * \param span FreeTDM span - * \param boardno Pika board number - * \param spanno Pika span number - * \param start Initial pika channel number - * \param end Final pika channel number - * \param type FreeTDM channel type - * \param name FreeTDM span name - * \param number FreeTDM span number - * \param profile Pika channel profile - * \return number of spans configured - */ -static unsigned pika_open_range(ftdm_span_t *span, unsigned boardno, unsigned spanno, unsigned start, unsigned end, - ftdm_chan_type_t type, char *name, char *number, pika_channel_profile_t *profile) -{ - unsigned configured = 0, x; - PK_STATUS status; - PK_CHAR error_text[PKH_ERROR_MAX_NAME_LENGTH]; - pika_span_data_t *span_data; - - if (boardno >= globals.board_list.numberOfBoards) { - ftdm_log(FTDM_LOG_ERROR, "Board %u is not present!\n", boardno); - return 0; - } - - if (!globals.open_boards[boardno]) { - status = PKH_BOARD_Open(globals.board_list.board[boardno].id, - NULL, - &globals.open_boards[boardno]); - if(status != PK_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error: PKH_BOARD_Open %d failed(%s)!\n", boardno, - PKH_ERROR_GetText(status, error_text, sizeof(error_text))); - return 0; - } - - ftdm_log(FTDM_LOG_DEBUG, "Open board %u\n", boardno); - - //PKH_BOARD_SetDebugTrace(globals.open_boards[boardno], 1, 0); - - } - - if (span->io_data) { - span_data = span->io_data; - } else { - span_data = ftdm_malloc(sizeof(*span_data)); - assert(span_data != NULL); - memset(span_data, 0, sizeof(*span_data)); - span_data->boardno = boardno; - - status = PKH_QUEUE_Create(PKH_QUEUE_TYPE_NORMAL, &span_data->event_queue); - - if (status != PK_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error: PKH_QUEUE_Create failed(%s)!\n", - PKH_ERROR_GetText(status, error_text, sizeof(error_text))); - ftdm_safe_free(span_data); - return 0; - } - - //PKH_QUEUE_Attach(span_data->event_queue, globals.open_boards[boardno], NULL); - - span->io_data = span_data; - } - - if (type == FTDM_CHAN_TYPE_FXS || type == FTDM_CHAN_TYPE_FXO) { - start--; - end--; - } - - for(x = start; x < end; x++) { - ftdm_channel_t *chan; - pika_chan_data_t *chan_data = NULL; - - chan_data = ftdm_malloc(sizeof *chan_data); - assert(chan_data); - memset(chan_data, 0, sizeof(*chan_data)); - ftdm_span_add_channel(span, 0, type, &chan); - chan->io_data = chan_data; - - if ((type == FTDM_CHAN_TYPE_B || type == FTDM_CHAN_TYPE_DQ921) && !span_data->handle) { - PKH_TBoardConfig boardConfig; - - TRY_OR_DIE(PKH_BOARD_GetConfig(globals.open_boards[boardno], &boardConfig), PK_SUCCESS, error); - if ((profile && profile->general_config.region == PKH_TRUNK_EU) || ftdm_test_flag(span_data, PK_FLAG_LOCKED)) { - if (span->trunk_type == FTDM_TRUNK_T1) { - ftdm_log(FTDM_LOG_WARNING, "Changing trunk type to E1 based on previous config.\n"); - } - span->trunk_type = FTDM_TRUNK_E1; - } - - if (span->trunk_type == FTDM_TRUNK_T1) { - if (ftdm_test_flag(span_data, PK_FLAG_LOCKED)) { - ftdm_log(FTDM_LOG_WARNING, "Already locked into E1 mode!\n"); - } - } else if (span->trunk_type == FTDM_TRUNK_E1) { - boardConfig.specific.DigitalGateway.interfaceType = PKH_BOARD_INTERFACE_TYPE_E1; - if ((status = PKH_BOARD_SetConfig(globals.open_boards[boardno], &boardConfig)) != PK_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error: [%s]\n", - PKH_ERROR_GetText(status, error_text, sizeof(error_text))); - } - ftdm_set_flag(span_data, PK_FLAG_LOCKED); - } - - TRY_OR_DIE(PKH_SPAN_Open(globals.open_boards[boardno], spanno, NULL, &span_data->handle), PK_SUCCESS, error); - TRY_OR_DIE(PKH_SPAN_GetConfig(span_data->handle, &span_data->span_config), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(span_data->event_queue, span_data->handle, (PK_VOID*) span), PK_SUCCESS, error); - } - - if (type == FTDM_CHAN_TYPE_FXO) { - PKH_TTrunkConfig trunkConfig; - - TRY_OR_DIE(PKH_TRUNK_Open(globals.open_boards[boardno], x, &chan_data->handle), PK_SUCCESS, error); - TRY_OR_DIE(PKH_TRUNK_Seize(chan_data->handle), PK_SUCCESS, error); - - if (profile && profile->general_config.region == PKH_TRUNK_EU) { - TRY_OR_DIE(PKH_TRUNK_GetConfig(chan_data->handle, &trunkConfig), PK_SUCCESS, error); - trunkConfig.internationalControl = PKH_PHONE_INTERNATIONAL_CONTROL_EU; - trunkConfig.audioFormat = PKH_AUDIO_ALAW; - trunkConfig.compandMode = PKH_PHONE_AUDIO_ALAW; - chan->native_codec = chan->effective_codec = FTDM_CODEC_ALAW; - TRY_OR_DIE(PKH_TRUNK_SetConfig(chan_data->handle, &trunkConfig), PK_SUCCESS, error); - } else { - chan->native_codec = chan->effective_codec = FTDM_CODEC_ULAW; - } - - - TRY_OR_DIE(PKH_QUEUE_Attach(span_data->event_queue, chan_data->handle, (PK_VOID*) chan), PK_SUCCESS, error); - TRY_OR_DIE(PKH_TRUNK_GetMediaStreams(chan_data->handle, &chan_data->media_in, &chan_data->media_out), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Create(PKH_QUEUE_TYPE_NORMAL, &chan_data->media_in_queue), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(chan_data->media_in_queue, chan_data->media_in, (PK_VOID*) chan), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Create(PKH_QUEUE_TYPE_CALLBACK, &chan_data->media_out_queue), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_SetEventHandler(chan_data->media_out_queue, media_out_callback), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(chan_data->media_out_queue, chan_data->media_out, (PK_VOID*) chan), PK_SUCCESS, error); - TRY_OR_DIE(PKH_TRUNK_Start(chan_data->handle), PK_SUCCESS, error); - } else if (type == FTDM_CHAN_TYPE_FXS) { - PKH_TPhoneConfig phoneConfig; - - if (profile && profile->general_config.region == PKH_TRUNK_EU) { - TRY_OR_DIE(PKH_PHONE_GetConfig(chan_data->handle, &phoneConfig), PK_SUCCESS, error); - phoneConfig.internationalControl = PKH_PHONE_INTERNATIONAL_CONTROL_EU; - phoneConfig.compandMode = PKH_PHONE_AUDIO_ALAW; - chan->native_codec = chan->effective_codec = FTDM_CODEC_ALAW; - TRY_OR_DIE(PKH_PHONE_SetConfig(chan_data->handle, &phoneConfig), PK_SUCCESS, error); - } else { - chan->native_codec = chan->effective_codec = FTDM_CODEC_ULAW; - } - - TRY_OR_DIE(PKH_PHONE_Open(globals.open_boards[boardno], x, &chan_data->handle), PK_SUCCESS, error); - TRY_OR_DIE(PKH_PHONE_Seize(chan_data->handle), PK_SUCCESS, error); - TRY_OR_DIE(PKH_PHONE_GetMediaStreams(chan_data->handle, &chan_data->media_in, &chan_data->media_out), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(span_data->event_queue, chan_data->handle, (PK_VOID*) chan), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Create(PKH_QUEUE_TYPE_NORMAL, &chan_data->media_in_queue), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(chan_data->media_in_queue, chan_data->media_in, (PK_VOID*) chan), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Create(PKH_QUEUE_TYPE_CALLBACK, &chan_data->media_out_queue), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_SetEventHandler(chan_data->media_out_queue, media_out_callback), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(chan_data->media_out_queue, chan_data->media_out, (PK_VOID*) chan), PK_SUCCESS, error); - TRY_OR_DIE(PKH_PHONE_Start(chan_data->handle), PK_SUCCESS, error); - } else if (type == FTDM_CHAN_TYPE_B) { - TRY_OR_DIE(PKH_SPAN_SeizeChannel(span_data->handle, x), PK_SUCCESS, error); - TRY_OR_DIE(PKH_SPAN_GetMediaStreams(span_data->handle, x, &chan_data->media_in, &chan_data->media_out), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Create(PKH_QUEUE_TYPE_NORMAL, &chan_data->media_in_queue), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(chan_data->media_in_queue, chan_data->media_in, (PK_VOID*) chan), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Create(PKH_QUEUE_TYPE_CALLBACK, &chan_data->media_out_queue), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_SetEventHandler(chan_data->media_out_queue, media_out_callback), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(chan_data->media_out_queue, chan_data->media_out, (PK_VOID*) chan), PK_SUCCESS, error); - } else if (type == FTDM_CHAN_TYPE_DQ921) { - TRY_OR_DIE(PKH_SPAN_HDLC_Open(span_data->handle, PKH_SPAN_HDLC_MODE_NORMAL, &chan_data->handle), PK_SUCCESS, error); - TRY_OR_DIE(PKH_SPAN_HDLC_GetConfig(chan_data->handle, &chan_data->hdlc_config), PK_SUCCESS, error); - chan_data->hdlc_config.channelId = x; - TRY_OR_DIE(PKH_SPAN_HDLC_SetConfig(chan_data->handle, &chan_data->hdlc_config), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Create(PKH_QUEUE_TYPE_NORMAL, &chan_data->media_in_queue), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(chan_data->media_in_queue, chan_data->handle, (PK_VOID*) chan), PK_SUCCESS, error); - TRY_OR_DIE(PKH_QUEUE_Attach(span_data->event_queue, chan_data->handle, (PK_VOID*) chan), PK_SUCCESS, error); - - if (profile) { - if (profile->cust_span) { - span_data->span_config.framing = profile->span_config.framing; - span_data->span_config.encoding = profile->span_config.encoding; - span_data->span_config.loopLength = profile->span_config.loopLength; - span_data->span_config.buildOut = profile->span_config.buildOut; - span_data->span_config.compandMode = profile->span_config.compandMode; - } else { - if (profile->general_config.region == PKH_TRUNK_EU) { - span_data->span_config = globals.e1_span_config; - } else { - span_data->span_config = globals.t1_span_config; - } - } - } else { - if (span->trunk_type == FTDM_TRUNK_E1) { - span_data->span_config = globals.e1_span_config; - } else { - span_data->span_config = globals.t1_span_config; - } - } - - PKH_SPAN_SetConfig(span_data->handle, &span_data->span_config); - TRY_OR_DIE(PKH_SPAN_Start(span_data->handle), PK_SUCCESS, error); - } - - goto ok; - - error: - PKH_ERROR_GetText(status, error_text, sizeof(error_text)); - ftdm_log(FTDM_LOG_ERROR, "failure configuring device b%ds%dc%d [%s]\n", boardno, spanno, x, error_text); - continue; - ok: - ftdm_set_flag(chan_data, PK_FLAG_READY); - status = PKH_RECORD_GetConfig(chan_data->media_in, &chan_data->record_config); - chan_data->record_config.encoding = PKH_RECORD_ENCODING_MU_LAW; - chan_data->record_config.samplingRate = PKH_RECORD_SAMPLING_RATE_8KHZ; - chan_data->record_config.bufferSize = PIKA_BLOCK_SIZE; - chan_data->record_config.numberOfBuffers = PIKA_NUM_BUFFERS; - chan_data->record_config.VAD.enabled = PK_FALSE; - //chan_data->record_config.speechSegmentEventsEnabled = PK_FALSE; - //chan_data->record_config.gain = rxgain; - - status = PKH_PLAY_GetConfig(chan_data->media_out, &chan_data->play_config); - chan_data->play_config.encoding = PKH_RECORD_ENCODING_MU_LAW; - chan_data->play_config.samplingRate = PKH_RECORD_SAMPLING_RATE_8KHZ; - chan_data->play_config.AGC.enabled = PK_FALSE; - ftdm_log(FTDM_LOG_INFO, "configuring device b%ds%dc%d as FreeTDM device %d:%d\n", boardno, spanno, x, chan->span_id, chan->chan_id); - - if (profile) { - ftdm_log(FTDM_LOG_INFO, "applying config profile %s to device %d:%d\n", profile->name, chan->span_id, chan->chan_id); - chan_data->record_config.gain = profile->record_config.gain; - chan_data->record_config.AGC = profile->record_config.AGC; - chan_data->record_config.VAD = profile->record_config.VAD; - chan_data->play_config.gain = profile->play_config.gain; - chan_data->play_config.AGC = profile->play_config.AGC; - chan_data->ec_enabled = profile->ec_enabled; - chan_data->ec_config = profile->ec_config; - } - - if (type == FTDM_CHAN_TYPE_B) { - if (span_data->span_config.compandMode == PKH_SPAN_COMPAND_MODE_A_LAW) { - chan->native_codec = chan->effective_codec = FTDM_CODEC_ALAW; - } else { - chan->native_codec = chan->effective_codec = FTDM_CODEC_ULAW; - } - } - - status = PKH_RECORD_SetConfig(chan_data->media_in, &chan_data->record_config); - status = PKH_PLAY_SetConfig(chan_data->media_out, &chan_data->play_config); - - chan->physical_span_id = spanno; - chan->physical_chan_id = x; - - chan->rate = 8000; - chan->packet_len = (uint32_t)chan_data->record_config.bufferSize; - chan->effective_interval = chan->native_interval = chan->packet_len / 8; - - PKH_RECORD_Start(chan_data->media_in); - PKH_PLAY_Start(chan_data->media_out); - if (chan_data->ec_enabled) { - PKH_EC_SetConfig(chan_data->media_in, &chan_data->ec_config); - PKH_EC_Start(chan_data->media_in, chan_data->media_in, chan_data->media_out); - } - - if (!ftdm_strlen_zero(name)) { - ftdm_copy_string(chan->chan_name, name, sizeof(chan->chan_name)); - } - - if (!ftdm_strlen_zero(number)) { - ftdm_copy_string(chan->chan_number, number, sizeof(chan->chan_number)); - } - - ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_DTMF_GENERATE); - ftdm_buffer_create(&chan_data->digit_buffer, 128, 128, 0); - ftdm_mutex_create(&chan_data->digit_mutex); - - configured++; - } - - - return configured; -} - -/** - * \brief Initialises an freetdm pika span from a configuration string - * \param span FreeTDM span - * \param str Configuration string - * \param type FreeTDM span type - * \param name FreeTDM span name - * \param number FreeTDM span number - * \return Success or failure - */ -static FIO_CONFIGURE_SPAN_FUNCTION(pika_configure_span) -{ - int items, i; - char *mydata, *item_list[10]; - char *bd, *sp, *ch = NULL, *mx; - int boardno; - int channo; - int spanno; - int top = 0; - unsigned configured = 0; - char *profile_name = NULL; - pika_channel_profile_t *profile = NULL; - - assert(str != NULL); - - mydata = ftdm_strdup(str); - assert(mydata != NULL); - - if ((profile_name = strchr(mydata, '@'))) { - *profile_name++ = '\0'; - if (!ftdm_strlen_zero(profile_name)) { - profile = (pika_channel_profile_t *) hashtable_search(globals.profile_hash, (char *)profile_name); - } - } - - items = ftdm_separate_string(mydata, ',', item_list, (sizeof(item_list) / sizeof(item_list[0]))); - - for(i = 0; i < items; i++) { - bd = item_list[i]; - if ((sp = strchr(bd, ':'))) { - *sp++ = '\0'; - if ((ch = strchr(sp, ':'))) { - *ch++ = '\0'; - } - } - - if (!(bd && sp && ch)) { - ftdm_log(FTDM_LOG_ERROR, "Invalid input\n"); - continue; - } - - boardno = atoi(bd); - channo = atoi(ch); - spanno = atoi(sp); - - - if (boardno < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid board number %d\n", boardno); - continue; - } - - if (channo < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid channel number %d\n", channo); - continue; - } - - if (spanno < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid span number %d\n", channo); - continue; - } - - if ((mx = strchr(ch, '-'))) { - mx++; - top = atoi(mx) + 1; - } else { - top = channo + 1; - } - - - if (top < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid range number %d\n", top); - continue; - } - - configured += pika_open_range(span, boardno, spanno, channo, top, type, name, number, profile); - - } - - ftdm_safe_free(mydata); - - return configured; -} - -/** - * \brief Opens Pika channel - * \param ftdmchan Channel to open - * \return Success or failure - */ -static FIO_OPEN_FUNCTION(pika_open) -{ - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; - - if (!chan_data && !ftdm_test_flag(chan_data, PK_FLAG_READY)) { - return FTDM_FAIL; - } - - if (chan_data->media_in_queue) { - PKH_QUEUE_Flush(chan_data->media_in_queue); - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS || ftdmchan->type == FTDM_CHAN_TYPE_FXO || ftdmchan->type == FTDM_CHAN_TYPE_B) { - PKH_PLAY_Start(chan_data->media_out); - } - return FTDM_SUCCESS; -} - -/** - * \brief Closes Pika channel - * \param ftdmchan Channel to close - * \return Success - */ -static FIO_CLOSE_FUNCTION(pika_close) -{ - return FTDM_SUCCESS; -} - -/** - * \brief Waits for an event on a Pika channel - * \param ftdmchan Channel to open - * \param flags Type of event to wait for - * \param to Time to wait (in ms) - * \return Success, failure or timeout - */ -static FIO_WAIT_FUNCTION(pika_wait) -{ - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; - PK_STATUS status; - ftdm_wait_flag_t myflags = *flags; - PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; - - *flags = FTDM_NO_FLAGS; - - if (myflags & FTDM_READ) { - if (chan_data->hdlc_bytes) { - *flags |= FTDM_READ; - return FTDM_SUCCESS; - } - status = PKH_QUEUE_WaitOnEvent(chan_data->media_in_queue, to, &chan_data->last_media_event); - - if (status == PK_SUCCESS) { - if (chan_data->last_media_event.id == PKH_EVENT_QUEUE_TIMEOUT || chan_data->last_media_event.id == PKH_EVENT_RECORD_BUFFER_OVERFLOW) { - return FTDM_TIMEOUT; - } - - *flags |= FTDM_READ; - return FTDM_SUCCESS; - } - - PKH_EVENT_GetText(chan_data->last_media_event.id, event_text, sizeof(event_text)); - ftdm_log(FTDM_LOG_DEBUG, "Event: %s\n", event_text); - } - - return FTDM_SUCCESS; -} - -/** - * \brief Reads data from a Pika channel - * \param ftdmchan Channel to read from - * \param data Data buffer - * \param datalen Size of data buffer - * \return Success or failure - */ -static FIO_READ_FUNCTION(pika_read) -{ - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; - PK_STATUS status; - PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; - uint32_t len; - - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - if ((status = PKH_SPAN_HDLC_GetMessage(chan_data->handle, data, *datalen)) == PK_SUCCESS) { - *datalen = chan_data->hdlc_bytes; - chan_data->hdlc_bytes = 0; - return FTDM_SUCCESS; - } - return FTDM_FAIL; - } - - if (!(len = chan_data->last_media_event.p0)) { - len = ftdmchan->packet_len; - } - - if (len < *datalen) { - *datalen = len; - } - - if ((status = PKH_RECORD_GetData(chan_data->media_in, data, *datalen)) == PK_SUCCESS) { - return FTDM_SUCCESS; - } - - - PKH_ERROR_GetText(status, event_text, sizeof(event_text)); - ftdm_log(FTDM_LOG_DEBUG, "ERR: %s\n", event_text); - return FTDM_FAIL; -} - -/** - * \brief Writes data to a Pika channel - * \param ftdmchan Channel to write to - * \param data Data buffer - * \param datalen Size of data buffer - * \return Success or failure - */ -static FIO_WRITE_FUNCTION(pika_write) -{ - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; - PK_STATUS status; - - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - if ((status = PKH_SPAN_HDLC_SendMessage(chan_data->handle, data, *datalen)) == PK_SUCCESS) { - return FTDM_SUCCESS; - } - return FTDM_FAIL; - } - - if (PKH_PLAY_AddData(chan_data->media_out, 0, data, *datalen) == PK_SUCCESS) { - return FTDM_SUCCESS; - } - - return FTDM_FAIL; -} - -/** - * \brief Executes an FreeTDM command on a Pika channel - * \param ftdmchan Channel to execute command on - * \param command FreeTDM command to execute - * \param obj Object (unused) - * \return Success or failure - */ -static FIO_COMMAND_FUNCTION(pika_command) -{ - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; - //pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->io_data; - PK_STATUS pk_status; - ftdm_status_t status = FTDM_SUCCESS; - - switch(command) { - case FTDM_COMMAND_OFFHOOK: - { - if ((pk_status = PKH_TRUNK_SetHookSwitch(chan_data->handle, PKH_TRUNK_OFFHOOK)) != PK_SUCCESS) { - PKH_ERROR_GetText(pk_status, ftdmchan->last_error, sizeof(ftdmchan->last_error)); - GOTO_STATUS(done, FTDM_FAIL); - } else { - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - } - } - break; - case FTDM_COMMAND_ONHOOK: - { - if ((pk_status = PKH_TRUNK_SetHookSwitch(chan_data->handle, PKH_TRUNK_ONHOOK)) != PK_SUCCESS) { - PKH_ERROR_GetText(pk_status, ftdmchan->last_error, sizeof(ftdmchan->last_error)); - GOTO_STATUS(done, FTDM_FAIL); - } else { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - } - } - break; - case FTDM_COMMAND_GENERATE_RING_ON: - { - if ((pk_status = PKH_PHONE_RingStart(chan_data->handle, 0, 0)) != PK_SUCCESS) { - PKH_ERROR_GetText(pk_status, ftdmchan->last_error, sizeof(ftdmchan->last_error)); - GOTO_STATUS(done, FTDM_FAIL); - } else { - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_RINGING); - } - } - break; - case FTDM_COMMAND_GENERATE_RING_OFF: - { - if ((pk_status = PKH_PHONE_RingStop(chan_data->handle)) != PK_SUCCESS) { - PKH_ERROR_GetText(pk_status, ftdmchan->last_error, sizeof(ftdmchan->last_error)); - GOTO_STATUS(done, FTDM_FAIL); - } else { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_RINGING); - } - } - break; - case FTDM_COMMAND_GET_INTERVAL: - { - - FTDM_COMMAND_OBJ_INT = ftdmchan->native_interval; - - } - break; - case FTDM_COMMAND_SET_INTERVAL: - { - int interval = FTDM_COMMAND_OBJ_INT; - int len = interval * 8; - chan_data->record_config.bufferSize = len; - chan_data->record_config.numberOfBuffers = (PK_UINT)chan_data->record_config.bufferSize; - ftdmchan->packet_len = (uint32_t)chan_data->record_config.bufferSize; - ftdmchan->effective_interval = ftdmchan->native_interval = ftdmchan->packet_len / 8; - PKH_RECORD_SetConfig(chan_data->media_in, &chan_data->record_config); - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - case FTDM_COMMAND_GET_DTMF_ON_PERIOD: - { - - FTDM_COMMAND_OBJ_INT = ftdmchan->dtmf_on; - GOTO_STATUS(done, FTDM_SUCCESS); - - } - break; - case FTDM_COMMAND_GET_DTMF_OFF_PERIOD: - { - FTDM_COMMAND_OBJ_INT = ftdmchan->dtmf_on; - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - case FTDM_COMMAND_SET_DTMF_ON_PERIOD: - { - int val = FTDM_COMMAND_OBJ_INT; - if (val > 10 && val < 1000) { - ftdmchan->dtmf_on = val; - GOTO_STATUS(done, FTDM_SUCCESS); - } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "invalid value %d range 10-1000", val); - GOTO_STATUS(done, FTDM_FAIL); - } - } - break; - case FTDM_COMMAND_SET_DTMF_OFF_PERIOD: - { - int val = FTDM_COMMAND_OBJ_INT; - if (val > 10 && val < 1000) { - ftdmchan->dtmf_off = val; - GOTO_STATUS(done, FTDM_SUCCESS); - } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "invalid value %d range 10-1000", val); - GOTO_STATUS(done, FTDM_FAIL); - } - } - break; - case FTDM_COMMAND_SEND_DTMF: - { - char *digits = FTDM_COMMAND_OBJ_CHAR_P; - ftdm_log(FTDM_LOG_DEBUG, "Adding DTMF SEQ [%s]\n", digits); - ftdm_mutex_lock(chan_data->digit_mutex); - ftdm_buffer_write(chan_data->digit_buffer, digits, strlen(digits)); - ftdm_mutex_unlock(chan_data->digit_mutex); - pk_status = PKH_PLAY_Stop(chan_data->media_out); - - if (pk_status != PK_SUCCESS) { - PKH_ERROR_GetText(pk_status, ftdmchan->last_error, sizeof(ftdmchan->last_error)); - GOTO_STATUS(done, FTDM_FAIL); - } - GOTO_STATUS(done, FTDM_SUCCESS); - } - break; - default: - break; - }; - - done: - return status; -} - -/** - * \brief Checks for events on a Pika span - * \param span Span to check for events - * \param ms Time to wait for event - * \return Success if event is waiting or failure if not - */ -static FIO_SPAN_POLL_EVENT_FUNCTION(pika_poll_event) -{ - pika_span_data_t *span_data = (pika_span_data_t *) span->io_data; - PK_STATUS status; - PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; - - status = PKH_QUEUE_WaitOnEvent(span_data->event_queue, ms, &span_data->last_oob_event); - - if (status == PK_SUCCESS) { - ftdm_channel_t *ftdmchan = NULL; - uint32_t *data = (uint32_t *) span_data->last_oob_event.userData; - ftdm_data_type_t data_type = FTDM_TYPE_NONE; - - if (span_data->last_oob_event.id == PKH_EVENT_QUEUE_TIMEOUT) { - return FTDM_TIMEOUT; - } - - if (data) { - data_type = *data; - } - - if (data_type == FTDM_TYPE_CHANNEL) { - ftdmchan = span_data->last_oob_event.userData; - } else if (data_type == FTDM_TYPE_SPAN) { - ftdm_time_t last_event_time = ftdm_current_time_in_ms(); - uint32_t event_id = 0; - - switch (span_data->last_oob_event.id) { - case PKH_EVENT_SPAN_ALARM_T1_RED: - case PKH_EVENT_SPAN_ALARM_T1_YELLOW: - case PKH_EVENT_SPAN_ALARM_T1_AIS: - case PKH_EVENT_SPAN_ALARM_E1_RED: - case PKH_EVENT_SPAN_ALARM_E1_RAI: - case PKH_EVENT_SPAN_ALARM_E1_AIS: - case PKH_EVENT_SPAN_ALARM_E1_RMAI: - case PKH_EVENT_SPAN_ALARM_E1_TS16AIS: - case PKH_EVENT_SPAN_ALARM_E1_TS16LOS: - case PKH_EVENT_SPAN_OUT_OF_SYNC: - case PKH_EVENT_SPAN_FRAMING_ERROR: - case PKH_EVENT_SPAN_LOSS_OF_SIGNAL: - case PKH_EVENT_SPAN_OUT_OF_CRC_MF_SYNC: - case PKH_EVENT_SPAN_OUT_OF_CAS_MF_SYNC: - event_id = FTDM_OOB_ALARM_TRAP; - break; - case PKH_EVENT_SPAN_ALARM_T1_RED_CLEAR: - case PKH_EVENT_SPAN_ALARM_T1_YELLOW_CLEAR: - case PKH_EVENT_SPAN_ALARM_T1_AIS_CLEAR: - case PKH_EVENT_SPAN_ALARM_E1_RED_CLEAR: - case PKH_EVENT_SPAN_ALARM_E1_RAI_CLEAR: - case PKH_EVENT_SPAN_ALARM_E1_AIS_CLEAR: - case PKH_EVENT_SPAN_ALARM_E1_RMAI_CLEAR: - case PKH_EVENT_SPAN_ALARM_E1_TS16AIS_CLEAR: - case PKH_EVENT_SPAN_ALARM_E1_TS16LOS_CLEAR: - case PKH_EVENT_SPAN_IN_SYNC: - case PKH_EVENT_SPAN_LOSS_OF_SIGNAL_CLEAR: - case PKH_EVENT_SPAN_IN_CRC_MF_SYNC: - case PKH_EVENT_SPAN_IN_CAS_MF_SYNC: - event_id = FTDM_OOB_ALARM_CLEAR; - break; - case PKH_EVENT_SPAN_MESSAGE: - case PKH_EVENT_SPAN_ABCD_SIGNAL_CHANGE: - break; - } - - if (event_id) { - uint32_t x = 0; - ftdm_channel_t *ftdmchan; - pika_chan_data_t *chan_data; - for(x = 1; x <= span->chan_count; x++) { - ftdmchan = span->channels[x]; - assert(ftdmchan != NULL); - chan_data = (pika_chan_data_t *) ftdmchan->io_data; - assert(chan_data != NULL); - - - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_EVENT); - ftdmchan->last_event_time = last_event_time; - chan_data->last_oob_event = span_data->last_oob_event; - } - - } - - } - - PKH_EVENT_GetText(span_data->last_oob_event.id, event_text, sizeof(event_text)); - //ftdm_log(FTDM_LOG_DEBUG, "Event: %s\n", event_text); - - if (ftdmchan) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; - - assert(chan_data != NULL); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_EVENT); - ftdmchan->last_event_time = ftdm_current_time_in_ms(); - chan_data->last_oob_event = span_data->last_oob_event; - } - - return FTDM_SUCCESS; - } - - return FTDM_FAIL; -} - -/** - * \brief Retrieves an event from a Pika span - * \param span Span to retrieve event from - * \param event FreeTDM event to return - * \return Success or failure - */ -static FIO_SPAN_NEXT_EVENT_FUNCTION(pika_next_event) -{ - uint32_t i, event_id = 0; - - for(i = 1; i <= span->chan_count; i++) { - if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_EVENT)) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) span->channels[i]->io_data; - PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; - - ftdm_clear_flag(span->channels[i], FTDM_CHANNEL_EVENT); - - PKH_EVENT_GetText(chan_data->last_oob_event.id, event_text, sizeof(event_text)); - - switch(chan_data->last_oob_event.id) { - case PKH_EVENT_HDLC_MESSAGE: - chan_data->hdlc_bytes = chan_data->last_oob_event.p2; - continue; - case PKH_EVENT_TRUNK_HOOKFLASH: - event_id = FTDM_OOB_FLASH; - break; - case PKH_EVENT_TRUNK_RING_OFF: - event_id = FTDM_OOB_RING_STOP; - break; - case PKH_EVENT_TRUNK_RING_ON: - event_id = FTDM_OOB_RING_START; - break; - - case PKH_EVENT_PHONE_OFFHOOK: - ftdm_set_flag_locked(span->channels[i], FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_OFFHOOK; - break; - - case PKH_EVENT_TRUNK_BELOW_THRESHOLD: - case PKH_EVENT_TRUNK_ABOVE_THRESHOLD: - case PKH_EVENT_PHONE_ONHOOK: - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_ONHOOK; - break; - - - - case PKH_EVENT_SPAN_ALARM_T1_RED: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_RED); - snprintf(span->channels[i]->last_error, sizeof(span->channels[i]->last_error), "RED ALARM"); - event_id = FTDM_OOB_ALARM_TRAP; - break; - case PKH_EVENT_SPAN_ALARM_T1_YELLOW: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_YELLOW); - snprintf(span->channels[i]->last_error, sizeof(span->channels[i]->last_error), "YELLOW ALARM"); - event_id = FTDM_OOB_ALARM_TRAP; - break; - case PKH_EVENT_SPAN_ALARM_T1_AIS: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_AIS); - snprintf(span->channels[i]->last_error, sizeof(span->channels[i]->last_error), "AIS ALARM"); - event_id = FTDM_OOB_ALARM_TRAP; - break; - case PKH_EVENT_SPAN_ALARM_E1_RED: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_RED); - snprintf(span->channels[i]->last_error, sizeof(span->channels[i]->last_error), "RED ALARM"); - event_id = FTDM_OOB_ALARM_TRAP; - break; - case PKH_EVENT_SPAN_ALARM_E1_RAI: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_RAI); - snprintf(span->channels[i]->last_error, sizeof(span->channels[i]->last_error), "RAI ALARM"); - event_id = FTDM_OOB_ALARM_TRAP; - break; - case PKH_EVENT_SPAN_ALARM_E1_AIS: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_AIS); - snprintf(span->channels[i]->last_error, sizeof(span->channels[i]->last_error), "AIS ALARM"); - event_id = FTDM_OOB_ALARM_TRAP; - break; - case PKH_EVENT_SPAN_ALARM_E1_RMAI: - case PKH_EVENT_SPAN_ALARM_E1_TS16AIS: - case PKH_EVENT_SPAN_ALARM_E1_TS16LOS: - case PKH_EVENT_SPAN_OUT_OF_SYNC: - case PKH_EVENT_SPAN_FRAMING_ERROR: - case PKH_EVENT_SPAN_LOSS_OF_SIGNAL: - case PKH_EVENT_SPAN_OUT_OF_CRC_MF_SYNC: - case PKH_EVENT_SPAN_OUT_OF_CAS_MF_SYNC: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_GENERAL); - snprintf(span->channels[i]->last_error, sizeof(span->channels[i]->last_error), "GENERAL ALARM"); - event_id = FTDM_OOB_ALARM_TRAP; - break; - case PKH_EVENT_SPAN_ALARM_T1_RED_CLEAR: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_RED); - case PKH_EVENT_SPAN_ALARM_T1_YELLOW_CLEAR: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_YELLOW); - case PKH_EVENT_SPAN_ALARM_T1_AIS_CLEAR: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_AIS); - case PKH_EVENT_SPAN_ALARM_E1_RED_CLEAR: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_RED); - case PKH_EVENT_SPAN_ALARM_E1_RAI_CLEAR: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_RAI); - case PKH_EVENT_SPAN_ALARM_E1_AIS_CLEAR: - ftdm_set_alarm_flag(span->channels[i], FTDM_ALARM_AIS); - case PKH_EVENT_SPAN_ALARM_E1_RMAI_CLEAR: - case PKH_EVENT_SPAN_ALARM_E1_TS16AIS_CLEAR: - case PKH_EVENT_SPAN_ALARM_E1_TS16LOS_CLEAR: - case PKH_EVENT_SPAN_IN_SYNC: - case PKH_EVENT_SPAN_LOSS_OF_SIGNAL_CLEAR: - case PKH_EVENT_SPAN_IN_CRC_MF_SYNC: - case PKH_EVENT_SPAN_IN_CAS_MF_SYNC: - ftdm_clear_alarm_flag(span->channels[i], FTDM_ALARM_GENERAL); - event_id = FTDM_OOB_ALARM_CLEAR; - break; - case PKH_EVENT_SPAN_MESSAGE: - case PKH_EVENT_SPAN_ABCD_SIGNAL_CHANGE: - break; - - - - - case PKH_EVENT_TRUNK_ONHOOK: - case PKH_EVENT_TRUNK_OFFHOOK: - case PKH_EVENT_TRUNK_DIALED : - case PKH_EVENT_TRUNK_REVERSAL: - case PKH_EVENT_TRUNK_LCSO: - case PKH_EVENT_TRUNK_DROPOUT: - case PKH_EVENT_TRUNK_LOF: - case PKH_EVENT_TRUNK_RX_OVERLOAD: - default: - ftdm_log(FTDM_LOG_DEBUG, "Unhandled event %d on channel %d [%s]\n", chan_data->last_oob_event.id, i, event_text); - event_id = FTDM_OOB_INVALID; - break; - } - - span->channels[i]->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = span->channels[i]; - *event = &span->event_header; - return FTDM_SUCCESS; - } - } - - return FTDM_FAIL; -} - -/** - * \brief Destroys a Pika Span - * \param span Span to destroy - * \return Success - */ -static FIO_SPAN_DESTROY_FUNCTION(pika_span_destroy) -{ - pika_span_data_t *span_data = (pika_span_data_t *) span->io_data; - - if (span_data) { - PKH_QUEUE_Destroy(span_data->event_queue); - ftdm_safe_free(span_data); - } - - return FTDM_SUCCESS; -} - -/** - * \brief Destroys a Pika Channel - * \param ftdmchan Channel to destroy - * \return Success or failure - */ -static FIO_CHANNEL_DESTROY_FUNCTION(pika_channel_destroy) -{ - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; - pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->io_data; - - if (!chan_data) { - return FTDM_FAIL; - } - - if (!ftdm_test_flag(chan_data, PK_FLAG_READY)) { - goto end; - } - - PKH_RECORD_Stop(chan_data->media_in); - PKH_PLAY_Stop(chan_data->media_out); - PKH_QUEUE_Destroy(chan_data->media_in_queue); - PKH_QUEUE_Destroy(chan_data->media_out_queue); - - switch(ftdmchan->type) { - case FTDM_CHAN_TYPE_FXS: - PKH_QUEUE_Detach(span_data->event_queue, chan_data->handle); - PKH_PHONE_Close(chan_data->handle); - break; - case FTDM_CHAN_TYPE_FXO: - PKH_QUEUE_Detach(span_data->event_queue, chan_data->handle); - PKH_TRUNK_Close(chan_data->handle); - break; - case FTDM_CHAN_TYPE_DQ921: - PKH_SPAN_Stop(span_data->handle); - break; - default: - break; - } - - - ftdm_mutex_destroy(&chan_data->digit_mutex); - ftdm_buffer_destroy(&chan_data->digit_buffer); - - end: - ftdm_safe_free(chan_data); - - return FTDM_SUCCESS; -} - -/** - * \brief Gets alarms from a Pika Channel (does nothing) - * \param ftdmchan Channel to get alarms from - * \return Failure - */ -static FIO_GET_ALARMS_FUNCTION(pika_get_alarms) -{ - return FTDM_FAIL; -} - -static ftdm_io_interface_t pika_interface; - -/** - * \brief Loads Pika IO module - * \param fio FreeTDM IO interface - * \return Success or failure - */ -static FIO_IO_LOAD_FUNCTION(pika_init) -{ - - PK_STATUS status; - PK_CHAR error_text[PKH_ERROR_MAX_NAME_LENGTH]; - uint32_t i; - int ok = 0; - PKH_TLogMasks m; - TPikaHandle tmpHandle; - - assert(fio != NULL); - memset(&pika_interface, 0, sizeof(pika_interface)); - memset(&globals, 0, sizeof(globals)); - globals.general_config.region = PKH_TRUNK_NA; - - globals.profile_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - - // Open the system object, to enumerate boards configured for this system - if ((status = PKH_SYSTEM_Open(&globals.system_handle)) != PK_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error: PKH_SYSTEM_Open failed(%s)!\n", - PKH_ERROR_GetText(status, error_text, sizeof(error_text))); - return FTDM_FAIL; - } - - // Retrieves a list of all boards in this system, existing, - // or listed in pika.cfg - if ((status = PKH_SYSTEM_Detect(globals.system_handle, &globals.board_list)) != PK_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error: PKH_SYSTEM_Detect failed(%s)!\n", - PKH_ERROR_GetText(status, error_text, sizeof(error_text))); - return FTDM_FAIL; - } - - PKH_SYSTEM_GetConfig(globals.system_handle, &globals.system_config); - globals.system_config.maxAudioProcessBlockSize = PIKA_BLOCK_LEN; - globals.system_config.playBufferSize = PIKA_BLOCK_SIZE; - globals.system_config.recordBufferSize = PIKA_BLOCK_SIZE; - globals.system_config.recordNumberOfBuffers = PIKA_NUM_BUFFERS; - PKH_SYSTEM_SetConfig(globals.system_handle, &globals.system_config); - - status = PKH_MEDIA_STREAM_Create(&tmpHandle); - status = PKH_RECORD_GetConfig(tmpHandle, &globals.record_config); - status = PKH_PLAY_GetConfig(tmpHandle, &globals.play_config); - status = PKH_EC_GetConfig(tmpHandle, &globals.ec_config); - status = PKH_MEDIA_STREAM_Destroy(tmpHandle); - - - - ftdm_log(FTDM_LOG_DEBUG, "Found %u board%s\n", globals.board_list.numberOfBoards, globals.board_list.numberOfBoards == 1 ? "" : "s"); - for(i = 0; i < globals.board_list.numberOfBoards; ++i) { - ftdm_log(FTDM_LOG_INFO, "Found PIKA board type:[%s] id:[%u] serno:[%u]\n", - pika_board_type_string(globals.board_list.board[i].type), globals.board_list.board[i].id, (uint32_t) - globals.board_list.board[i].serialNumber); - - if (globals.board_list.board[i].type == PKH_BOARD_TYPE_DIGITAL_GATEWAY) { - TPikaHandle board_handle, span_handle; - PKH_TBoardConfig boardConfig; - PKH_BOARD_GetConfig(board_handle, &boardConfig); - PKH_BOARD_Open(globals.board_list.board[i].id, NULL, &board_handle); - PKH_SPAN_Open(board_handle, 0, NULL, &span_handle); - PKH_SPAN_GetConfig(span_handle, &globals.t1_span_config); - PKH_SPAN_Close(span_handle); - boardConfig.specific.DigitalGateway.interfaceType = PKH_BOARD_INTERFACE_TYPE_E1; - PKH_BOARD_SetConfig(board_handle, &boardConfig); - PKH_SPAN_Open(board_handle, 0, NULL, &span_handle); - PKH_SPAN_GetConfig(span_handle, &globals.e1_span_config); - PKH_SPAN_Close(span_handle); - boardConfig.specific.DigitalGateway.interfaceType = PKH_BOARD_INTERFACE_TYPE_T1; - PKH_BOARD_SetConfig(board_handle, &boardConfig); - PKH_BOARD_Close(board_handle); - } - ok++; - - } - - if (!ok) { - return FTDM_FAIL; - } - - pika_interface.name = "pika"; - pika_interface.configure = pika_configure; - pika_interface.configure_span = pika_configure_span; - pika_interface.open = pika_open; - pika_interface.close = pika_close; - pika_interface.wait = pika_wait; - pika_interface.read = pika_read; - pika_interface.write = pika_write; - pika_interface.command = pika_command; - pika_interface.poll_event = pika_poll_event; - pika_interface.next_event = pika_next_event; - pika_interface.channel_destroy = pika_channel_destroy; - pika_interface.span_destroy = pika_span_destroy; - pika_interface.get_alarms = pika_get_alarms; - *fio = &pika_interface; - - - ftdm_log(FTDM_LOG_INFO, "Dumping Default configs:\n"); - ftdm_log(FTDM_LOG_INFO, "rx-gain => %0.2f\n", (float)globals.record_config.gain); - ftdm_log(FTDM_LOG_INFO, "rx-agc-enabled => %s\n", globals.record_config.AGC.enabled ? "true" : "false"); - ftdm_log(FTDM_LOG_INFO, "rx-agc-targetPower => %0.2f\n", (float)globals.record_config.AGC.targetPower); - ftdm_log(FTDM_LOG_INFO, "rx-agc-minGain => %0.2f\n", (float)globals.record_config.AGC.minGain); - ftdm_log(FTDM_LOG_INFO, "rx-agc-maxGain => %0.2f\n", (float)globals.record_config.AGC.maxGain); - ftdm_log(FTDM_LOG_INFO, "rx-agc-attackRate => %d\n", (int)globals.record_config.AGC.attackRate); - ftdm_log(FTDM_LOG_INFO, "rx-agc-decayRate => %d\n", (int)globals.record_config.AGC.decayRate); - ftdm_log(FTDM_LOG_INFO, "rx-agc-speechThreshold => %0.2f\n", (float)globals.record_config.AGC.speechThreshold); - ftdm_log(FTDM_LOG_INFO, "rx-vad-enabled => %s\n", globals.record_config.VAD.enabled ? "true" : "false"); - ftdm_log(FTDM_LOG_INFO, "rx-vad-activationThreshold => %0.2f\n", (float)globals.record_config.VAD.activationThreshold); - ftdm_log(FTDM_LOG_INFO, "rx-vad-activationDebounceTime => %d\n", (int)globals.record_config.VAD.activationDebounceTime); - ftdm_log(FTDM_LOG_INFO, "rx-vad-deactivationThreshold => %0.2f\n", (float)globals.record_config.VAD.deactivationThreshold); - ftdm_log(FTDM_LOG_INFO, "rx-vad-deactivationDebounceTime => %d\n", (int)globals.record_config.VAD.deactivationDebounceTime); - ftdm_log(FTDM_LOG_INFO, "rx-vad-preSpeechBufferSize => %d\n", (int)globals.record_config.VAD.preSpeechBufferSize); - ftdm_log(FTDM_LOG_INFO, "tx-gain => %0.2f\n", (float)globals.play_config.gain); - ftdm_log(FTDM_LOG_INFO, "tx-agc-enabled => %s\n", globals.play_config.AGC.enabled ? "true" : "false"); - ftdm_log(FTDM_LOG_INFO, "tx-agc-targetPower => %0.2f\n", (float)globals.play_config.AGC.targetPower); - ftdm_log(FTDM_LOG_INFO, "tx-agc-minGain => %0.2f\n", (float)globals.play_config.AGC.minGain); - ftdm_log(FTDM_LOG_INFO, "tx-agc-maxGain => %0.2f\n", (float)globals.play_config.AGC.maxGain); - ftdm_log(FTDM_LOG_INFO, "tx-agc-attackRate => %d\n", (int)globals.play_config.AGC.attackRate); - ftdm_log(FTDM_LOG_INFO, "tx-agc-decayRate => %d\n", (int)globals.play_config.AGC.decayRate); - ftdm_log(FTDM_LOG_INFO, "tx-agc-speechThreshold => %0.2f\n", (float)globals.play_config.AGC.speechThreshold); - ftdm_log(FTDM_LOG_INFO, "ec-doubleTalkerThreshold => %0.2f\n", (float)globals.ec_config.doubleTalkerThreshold); - ftdm_log(FTDM_LOG_INFO, "ec-speechPresentThreshold => %0.2f\n", (float)globals.ec_config.speechPresentThreshold); - ftdm_log(FTDM_LOG_INFO, "ec-echoSuppressionThreshold => %0.2f\n", (float)globals.ec_config.echoSuppressionThreshold); - ftdm_log(FTDM_LOG_INFO, "ec-echoSuppressionEnabled => %s\n", globals.ec_config.echoSuppressionEnabled ? "true" : "false"); - ftdm_log(FTDM_LOG_INFO, "ec-comfortNoiseEnabled => %s\n", globals.ec_config.comfortNoiseEnabled ? "true" : "false"); - ftdm_log(FTDM_LOG_INFO, "ec-adaptationModeEnabled => %s\n", globals.ec_config.adaptationModeEnabled ? "true" : "false"); - - - - memset(&m, 0, sizeof(m)); - //m.apiMask = 0xffffffff; - //PKH_LOG_SetMasks(&m); - - return FTDM_SUCCESS; -} - -/** - * \brief Unloads Pika IO module - * \return Success - */ -static FIO_IO_UNLOAD_FUNCTION(pika_destroy) -{ - uint32_t x; - PK_STATUS status; - PK_CHAR error_text[PKH_ERROR_MAX_NAME_LENGTH]; - - for (x = 0; x < MAX_NUMBER_OF_TRUNKS; x++) { - if (globals.open_boards[x]) { - ftdm_log(FTDM_LOG_INFO, "Closing board %u\n", x); - PKH_BOARD_Close(globals.open_boards[x]); - } - } - - // The system can now be closed. - if ((status = PKH_SYSTEM_Close(globals.system_handle)) != PK_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error: PKH_SYSTEM_Close failed(%s)!\n", - PKH_ERROR_GetText(status, error_text, sizeof(error_text))); - } else { - ftdm_log(FTDM_LOG_INFO, "Closing system handle\n"); - } - - hashtable_destroy(globals.profile_hash); - - return FTDM_SUCCESS; -} - -/** - * \brief Pika IO module definition - */ -EX_DECLARE_DATA ftdm_module_t ftdm_module = { - "pika", - pika_init, - pika_destroy, -}; - -/* 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/freetdm/src/ftmod/ftmod_pika/ozmod_pika.2005.vcproj b/libs/freetdm/src/ftmod/ftmod_pika/ozmod_pika.2005.vcproj deleted file mode 100644 index 646cc11428..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_pika/ozmod_pika.2005.vcproj +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c deleted file mode 100644 index 38f9c48e84..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c +++ /dev/null @@ -1,1189 +0,0 @@ -/* - * Copyright (c) 2010, Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include "private/ftdm_core.h" - -#define PRI_SPAN(p) (((p) >> 8) & 0xff) -#define PRI_CHANNEL(p) ((p) & 0xff) - -#define PRITAP_NETWORK_ANSWER 0x1 - -typedef enum { - PRITAP_RUNNING = (1 << 0), - PRITAP_MASTER = (1 << 1), -} pritap_flags_t; - -typedef enum { - PRITAP_MIX_BOTH = 0, - PRITAP_MIX_PEER, - PRITAP_MIX_SELF, -} pritap_mix_mode_t; - -typedef struct { - void *callref; - ftdm_number_t callingnum; - ftdm_number_t callingani; - ftdm_number_t callednum; - ftdm_channel_t *fchan; - char callingname[80]; - uint8_t proceeding; - uint8_t inuse; -} passive_call_t; - -typedef enum pritap_iface { - PRITAP_IFACE_UNKNOWN = 0, - PRITAP_IFACE_CPE = 1, - PRITAP_IFACE_NET = 2, -} pritap_iface_t; - -typedef struct pritap { - int32_t flags; - struct pri *pri; - int debug; - pritap_mix_mode_t mixaudio; - ftdm_channel_t *dchan; - ftdm_span_t *span; - ftdm_span_t *peerspan; - ftdm_mutex_t *pcalls_lock; - passive_call_t pcalls[FTDM_MAX_CHANNELS_PHYSICAL_SPAN]; - pritap_iface_t iface; -} pritap_t; - -static FIO_IO_UNLOAD_FUNCTION(ftdm_pritap_unload) -{ - return FTDM_SUCCESS; -} - -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(pritap_get_channel_sig_status) -{ - *status = FTDM_SIG_STATE_UP; - return FTDM_SUCCESS; -} - -static FIO_SPAN_GET_SIG_STATUS_FUNCTION(pritap_get_span_sig_status) -{ - *status = FTDM_SIG_STATE_UP; - return FTDM_SUCCESS; -} - - -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(pritap_outgoing_call) -{ - ftdm_log(FTDM_LOG_ERROR, "Cannot dial on PRI tapping line!\n"); - return FTDM_FAIL; -} - -static void s_pri_error(struct pri *pri, char *s) -{ - pritap_t *pritap = pri_get_userdata(pri); - - if (pritap && pritap->dchan) { - ftdm_log_chan(pritap->dchan, FTDM_LOG_ERROR, "%s", s); - } else { - ftdm_log(FTDM_LOG_ERROR, "%s", s); - } -} - -static void s_pri_message(struct pri *pri, char *s) -{ - pritap_t *pritap = pri_get_userdata(pri); - - if (pritap && pritap->dchan) { - ftdm_log_chan(pritap->dchan, FTDM_LOG_DEBUG, "%s", s); - } else { - ftdm_log(FTDM_LOG_DEBUG, "%s", s); - } -} - -#define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE) -#define PRI_DEBUG_Q931_ALL (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY) - -static int parse_debug(const char *in) -{ - int flags = 0; - - if (!in) { - return 0; - } - - if (!strcmp(in, "none")) { - return 0; - } - - if (!strcmp(in, "all")) { - return PRI_DEBUG_ALL; - } - - if (strstr(in, "q921_all")) { - flags |= PRI_DEBUG_Q921_ALL; - } - - if (strstr(in, "q921_raw")) { - flags |= PRI_DEBUG_Q921_RAW; - } - - if (strstr(in, "q921_dump")) { - flags |= PRI_DEBUG_Q921_DUMP; - } - - if (strstr(in, "q921_state")) { - flags |= PRI_DEBUG_Q921_STATE; - } - - if (strstr(in, "config")) { - flags |= PRI_DEBUG_CONFIG; - } - - if (strstr(in, "q931_all")) { - flags |= PRI_DEBUG_Q931_ALL; - } - - if (strstr(in, "q931_dump")) { - flags |= PRI_DEBUG_Q931_DUMP; - } - - if (strstr(in, "q931_state")) { - flags |= PRI_DEBUG_Q931_STATE; - } - - if (strstr(in, "q931_anomaly")) { - flags |= PRI_DEBUG_Q931_ANOMALY; - } - - if (strstr(in, "apdu")) { - flags |= PRI_DEBUG_APDU; - } - - if (strstr(in, "aoc")) { - flags |= PRI_DEBUG_AOC; - } - - return flags; -} - -static ftdm_io_interface_t ftdm_pritap_interface; - -static ftdm_status_t ftdm_pritap_start(ftdm_span_t *span); - -static FIO_API_FUNCTION(ftdm_pritap_api) -{ - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - - if (data) { - mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - if (argc > 2) { - if (!strcasecmp(argv[0], "debug")) { - ftdm_span_t *span = NULL; - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) { - pritap_t *pritap = span->signal_data; - if (span->start != ftdm_pritap_start) { - stream->write_function(stream, "%s: -ERR invalid span.\n", __FILE__); - goto done; - } - - pri_set_debug(pritap->pri, parse_debug(argv[2])); - stream->write_function(stream, "%s: +OK debug set.\n", __FILE__); - goto done; - } else { - stream->write_function(stream, "%s: -ERR invalid span.\n", __FILE__); - goto done; - } - } - - } - - stream->write_function(stream, "%s: -ERR invalid command.\n", __FILE__); - - done: - - ftdm_safe_free(mycmd); - - return FTDM_SUCCESS; -} - -static FIO_IO_LOAD_FUNCTION(ftdm_pritap_io_init) -{ - memset(&ftdm_pritap_interface, 0, sizeof(ftdm_pritap_interface)); - - ftdm_pritap_interface.name = "pritap"; - ftdm_pritap_interface.api = ftdm_pritap_api; - - *fio = &ftdm_pritap_interface; - - return FTDM_SUCCESS; -} - -static FIO_SIG_LOAD_FUNCTION(ftdm_pritap_init) -{ - pri_set_error(s_pri_error); - pri_set_message(s_pri_message); - return FTDM_SUCCESS; -} - -static ftdm_state_map_t pritap_state_map = { - { - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - }, - - } -}; - -#define PRITAP_GET_INTERFACE(iface) iface == PRITAP_IFACE_CPE ? "CPE" : \ - iface == PRITAP_IFACE_NET ? "NET" : "UNKNOWN" -static ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) -{ - ftdm_status_t status; - ftdm_sigmsg_t sig; - pritap_t *pritap = ftdmchan->span->signal_data; - pritap_t *peer_pritap = pritap->peerspan->signal_data; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "processing state %s\n", ftdm_channel_state2str(ftdmchan->state)); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - - ftdm_channel_complete_state(ftdmchan); - - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_DOWN: - { - ftdm_channel_t *fchan = ftdmchan; - - /* Destroy the peer data first */ - if (fchan->call_data) { - ftdm_channel_t *peerchan = fchan->call_data; - ftdm_channel_t *pchan = peerchan; - - ftdm_channel_lock(peerchan); - - pchan->call_data = NULL; - pchan->pflags = 0; - ftdm_channel_close(&pchan); - - ftdm_channel_unlock(peerchan); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "No call data?\n"); - } - - ftdmchan->call_data = NULL; - ftdmchan->pflags = 0; - ftdm_channel_close(&fchan); - } - break; - - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_HANGUP: - break; - - case FTDM_CHANNEL_STATE_UP: - { - if (ftdm_test_pflag(ftdmchan, PRITAP_NETWORK_ANSWER)) { - ftdm_clear_pflag(ftdmchan, PRITAP_NETWORK_ANSWER); - sig.event_id = FTDM_SIGEVENT_UP; - ftdm_span_send_signal(ftdmchan->span, &sig); - } - } - break; - - case FTDM_CHANNEL_STATE_RING: - { - sig.event_id = FTDM_SIGEVENT_START; - /* The ring interface (where the setup was received) is the peer, since we RING the channel - * where PROCEED/PROGRESS is received */ - ftdm_sigmsg_add_var(&sig, "pritap_ring_interface", PRITAP_GET_INTERFACE(peer_pritap->iface)); - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } - break; - - case FTDM_CHANNEL_STATE_TERMINATING: - { - if (ftdmchan->last_state != FTDM_CHANNEL_STATE_HANGUP) { - sig.event_id = FTDM_SIGEVENT_STOP; - status = ftdm_span_send_signal(ftdmchan->span, &sig); - } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - break; - - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ignoring state change from %s to %s\n", ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(ftdmchan->state)); - } - break; - } - - return FTDM_SUCCESS; -} - -static __inline__ void pritap_check_state(ftdm_span_t *span) -{ - if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { - uint32_t j; - ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - for(j = 1; j <= span->chan_count; j++) { - ftdm_channel_lock(span->channels[j]); - ftdm_channel_advance_states(span->channels[j]); - ftdm_channel_unlock(span->channels[j]); - } - } -} - -static int pri_io_read(struct pri *pri, void *buf, int buflen) -{ - int res; - ftdm_status_t zst; - pritap_t *pritap = pri_get_userdata(pri); - ftdm_size_t len = buflen; - - if ((zst = ftdm_channel_read(pritap->dchan, buf, &len)) != FTDM_SUCCESS) { - if (zst == FTDM_FAIL) { - ftdm_log(FTDM_LOG_CRIT, "span %d D channel read fail! [%s]\n", pritap->span->span_id, pritap->dchan->last_error); - } else { - ftdm_log(FTDM_LOG_CRIT, "span %d D channel read timeout!\n", pritap->span->span_id); - } - return -1; - } - - res = (int)len; - - memset(&((unsigned char*)buf)[res],0,2); - res += 2; - - /* libpri passive q921 raw dump does not work for all frames */ - if (pritap->debug & PRI_DEBUG_Q921_RAW) { - char hbuf[2048] = { 0 }; - - print_hex_bytes(buf, len, hbuf, sizeof(hbuf)); - ftdm_log_chan(pritap->dchan, FTDM_LOG_DEBUG, "READ %"FTDM_SIZE_FMT"\n%s\n", len, hbuf); - } - return res; -} - -static int pri_io_write(struct pri *pri, void *buf, int buflen) -{ - pritap_t *pritap = pri_get_userdata(pri); - ftdm_size_t len = buflen - 2; - - /* libpri passive q921 raw dump does not work for all frames */ - if (pritap->debug & PRI_DEBUG_Q921_RAW) { - char hbuf[2048] = { 0 }; - - print_hex_bytes(buf, len, hbuf, sizeof(hbuf)); - ftdm_log_chan(pritap->dchan, FTDM_LOG_DEBUG, "WRITE %"FTDM_SIZE_FMT"\n%s\n", len, hbuf); - } - - if (ftdm_channel_write(pritap->dchan, buf, buflen, &len) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "span %d D channel write failed! [%s]\n", pritap->span->span_id, pritap->dchan->last_error); - return -1; - } - - return (int)buflen; -} - -static int tap_pri_get_crv(struct pri *ctrl, q931_call *call) -{ - int callmode = 0; - int crv = pri_get_crv(ctrl, call, &callmode); - crv <<= 3; - crv |= (callmode & 0x7); - return crv; -} - -static passive_call_t *tap_pri_get_pcall_bycrv(pritap_t *pritap, int crv) -{ - int i; - int tstcrv; - - ftdm_mutex_lock(pritap->pcalls_lock); - - for (i = 0; i < ftdm_array_len(pritap->pcalls); i++) { - tstcrv = pritap->pcalls[i].callref ? tap_pri_get_crv(pritap->pri, pritap->pcalls[i].callref) : 0; - if (pritap->pcalls[i].callref && tstcrv == crv) { - if (pritap->pcalls[i].inuse) { - ftdm_mutex_unlock(pritap->pcalls_lock); - return &pritap->pcalls[i]; - } - /* This just means the crv is being re-used in another call before this one was destroyed */ - ftdm_log(FTDM_LOG_DEBUG, "Found crv %d in slot %d of span %s with call %p but is no longer in use\n", - crv, i, pritap->span->name, pritap->pcalls[i].callref); - } - } - - ftdm_log(FTDM_LOG_DEBUG, "crv %d was not found active in span %s\n", crv, pritap->span->name); - - ftdm_mutex_unlock(pritap->pcalls_lock); - - return NULL; -} - -/* - * This is a tricky function with some side effects, some explanation needed ... - * - * The libpri stack process HDLC frames, then finds Q921 frames and Q931 events, each time - * it finds a new Q931 event, checks if the crv of that event matches a known call in the internal - * list found in the PRI control block (for us, one control block per span), if it does not find - * the call, allocates a new one and then sends the event up to the user (us, ftmod_pritap in this case) - * - * The user is then expected to destroy the call when done with it (on hangup), but things get tricky here - * because in ftmod_pritap we do not destroy the call right away to be sure we only destroy it when no one - * else needs that pointer, therefore we decide to delay the destruction of the call pointer until later - * when a new call comes which triggers the garbage collecting code in this function - * - * Now, what happens if a new call arrives right away with the same crv than the last call? the pri stack - * does *not* allocate a new call pointer because is still a known call and we must therefore re-use the - * same call pointer - * - * This function accepts a pointer to a callref, even a NULL one. When callref is NULL we search for an - * available slot so the caller of this function can use it to store a new callref pointer. In the process - * we also scan for slots that still have a callref pointer but are no longer in use (inuse=0) and we - * destroy that callref and clear the slot (memset). The trick is, we only do this if the callref to - * be garbage collected is NOT the one provided by the parameter callref, of course! otherwise we may - * be freeing a pointer to a callref for a new call that used an old (recycled) callref! - */ -static passive_call_t *tap_pri_get_pcall(pritap_t *pritap, void *callref) -{ - int i; - int crv; - - ftdm_mutex_lock(pritap->pcalls_lock); - - for (i = 0; i < ftdm_array_len(pritap->pcalls); i++) { - /* If this slot has a call reference - * and it is different than the *callref provided to us - * and is no longer in use, - * then it is time to garbage collect it ... */ - if (pritap->pcalls[i].callref && callref != pritap->pcalls[i].callref && !pritap->pcalls[i].inuse) { - crv = tap_pri_get_crv(pritap->pri, pritap->pcalls[i].callref); - /* garbage collection */ - ftdm_log(FTDM_LOG_DEBUG, "Garbage collecting callref %d/%p from span %s in slot %d\n", - crv, pritap->pcalls[i].callref, pritap->span->name, i); - pri_passive_destroycall(pritap->pri, pritap->pcalls[i].callref); - memset(&pritap->pcalls[i], 0, sizeof(pritap->pcalls[0])); - } - if (callref == pritap->pcalls[i].callref) { - if (callref == NULL) { - pritap->pcalls[i].inuse = 1; - ftdm_log(FTDM_LOG_DEBUG, "Enabling callref slot %d in span %s\n", i, pritap->span->name); - } else if (!pritap->pcalls[i].inuse) { - crv = tap_pri_get_crv(pritap->pri, callref); - ftdm_log(FTDM_LOG_DEBUG, "Recyclying callref slot %d in span %s for callref %d/%p\n", - i, pritap->span->name, crv, callref); - memset(&pritap->pcalls[i], 0, sizeof(pritap->pcalls[0])); - pritap->pcalls[i].callref = callref; - pritap->pcalls[i].inuse = 1; - } - - ftdm_mutex_unlock(pritap->pcalls_lock); - - return &pritap->pcalls[i]; - } - } - - ftdm_mutex_unlock(pritap->pcalls_lock); - - return NULL; -} - -static void tap_pri_put_pcall(pritap_t *pritap, void *callref) -{ - int i; - int crv; - int tstcrv; - - if (!callref) { - ftdm_log(FTDM_LOG_ERROR, "Cannot put pcall for null callref in span %s\n", pritap->span->name); - return; - } - - ftdm_mutex_lock(pritap->pcalls_lock); - - crv = tap_pri_get_crv(pritap->pri, callref); - for (i = 0; i < ftdm_array_len(pritap->pcalls); i++) { - if (!pritap->pcalls[i].callref) { - continue; - } - tstcrv = tap_pri_get_crv(pritap->pri, pritap->pcalls[i].callref); - if (tstcrv == crv) { - if (pritap->pcalls[i].inuse) { - ftdm_log(FTDM_LOG_DEBUG, "releasing slot %d in span %s used by callref %d/%p\n", i, - pritap->span->name, crv, pritap->pcalls[i].callref); - pritap->pcalls[i].inuse = 0; - } - } - } - - ftdm_mutex_unlock(pritap->pcalls_lock); -} - -static __inline__ ftdm_channel_t *tap_pri_get_fchan(pritap_t *pritap, passive_call_t *pcall, int channel) -{ - ftdm_channel_t *fchan = NULL; - int err = 0; - int chanpos = PRI_CHANNEL(channel); - if (!chanpos || chanpos > pritap->span->chan_count) { - ftdm_log(FTDM_LOG_CRIT, "Invalid pri tap channel %d requested in span %s\n", channel, pritap->span->name); - return NULL; - } - - fchan = pritap->span->channels[PRI_CHANNEL(channel)]; - - ftdm_channel_lock(fchan); - - if (ftdm_test_flag(fchan, FTDM_CHANNEL_INUSE)) { - ftdm_log(FTDM_LOG_ERROR, "Channel %d requested in span %s is already in use!\n", channel, pritap->span->name); - err = 1; - goto done; - } - - if (ftdm_channel_open_chan(fchan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Could not open tap channel %d requested in span %s\n", channel, pritap->span->name); - err = 1; - goto done; - } - - memset(&fchan->caller_data, 0, sizeof(fchan->caller_data)); - - ftdm_set_string(fchan->caller_data.cid_num.digits, pcall->callingnum.digits); - if (!ftdm_strlen_zero(pcall->callingname)) { - ftdm_set_string(fchan->caller_data.cid_name, pcall->callingname); - } else { - ftdm_set_string(fchan->caller_data.cid_name, pcall->callingnum.digits); - } - ftdm_set_string(fchan->caller_data.ani.digits, pcall->callingani.digits); - ftdm_set_string(fchan->caller_data.dnis.digits, pcall->callednum.digits); - -done: - if (fchan) { - ftdm_channel_unlock(fchan); - } - - if (err) { - return NULL; - } - - return fchan; -} - -static void handle_pri_passive_event(pritap_t *pritap, pri_event *e) -{ - passive_call_t *pcall = NULL; - passive_call_t *peerpcall = NULL; - ftdm_channel_t *fchan = NULL; - ftdm_channel_t *peerfchan = NULL; - int layer1, transcap = 0; - int crv = 0; - pritap_t *peertap = pritap->peerspan->signal_data; - - switch (e->e) { - - case PRI_EVENT_RING: - /* we cannot use ftdm_channel_t because we still dont know which channel will be used - * (ie, flexible channel was requested), thus, we need our own list of call references */ - crv = tap_pri_get_crv(pritap->pri, e->ring.call); - ftdm_log(FTDM_LOG_DEBUG, "Ring on channel %s:%d:%d with callref %d\n", - pritap->span->name, PRI_SPAN(e->ring.channel), PRI_CHANNEL(e->ring.channel), crv); - pcall = tap_pri_get_pcall_bycrv(pritap, crv); - if (pcall) { - ftdm_log(FTDM_LOG_WARNING, "There is a call with callref %d already, ignoring duplicated ring event\n", crv); - break; - } - - /* Try to get a recycled call (ie, e->ring.call is a call that the PRI stack allocated previously and then - * re-used for the next RING event because we did not destroy it fast enough) */ - pcall = tap_pri_get_pcall(pritap, e->ring.call); - if (!pcall) { - /* ok so the call is really not known to us, let's get a new one */ - pcall = tap_pri_get_pcall(pritap, NULL); - if (!pcall) { - ftdm_log(FTDM_LOG_ERROR, "Failed to get a free passive PRI call slot for callref %d, this is a bug!\n", crv); - break; - } - } - pcall->callref = e->ring.call; - ftdm_set_string(pcall->callingnum.digits, e->ring.callingnum); - ftdm_set_string(pcall->callingani.digits, e->ring.callingani); - ftdm_set_string(pcall->callednum.digits, e->ring.callednum); - ftdm_set_string(pcall->callingname, e->ring.callingname); - break; - - case PRI_EVENT_PROGRESS: - crv = tap_pri_get_crv(pritap->pri, e->proceeding.call); - ftdm_log(FTDM_LOG_DEBUG, "Progress on channel %s:%d:%d with callref %d\n", - pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv); - break; - - case PRI_EVENT_PROCEEDING: - crv = tap_pri_get_crv(pritap->pri, e->proceeding.call); - /* at this point we should know the real b chan that will be used and can therefore proceed to notify about the call, but - * only if a couple of call tests are passed first */ - ftdm_log(FTDM_LOG_DEBUG, "Proceeding on channel %s:%d:%d with callref %d\n", - pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv); - - /* check that we already know about this call in the peer PRI (which was the one receiving the PRI_EVENT_RING event) */ - if (!(pcall = tap_pri_get_pcall_bycrv(peertap, crv))) { - ftdm_log(FTDM_LOG_DEBUG, - "ignoring proceeding in channel %s:%d:%d for callref %d since we don't know about it\n", - pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv); - break; - } - if (pcall->proceeding) { - ftdm_log(FTDM_LOG_DEBUG, "Ignoring duplicated proceeding with callref %d\n", crv); - break; - } - pcall->proceeding = 1; - - /* This call should not be known to this PRI yet ... */ - if ((peerpcall = tap_pri_get_pcall_bycrv(pritap, crv))) { - ftdm_log(FTDM_LOG_ERROR, - "ignoring proceeding in channel %s:%d:%d for callref %d, dup???\n", - pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv); - break; - } - - /* Check if the call pointer is being recycled */ - peerpcall = tap_pri_get_pcall(pritap, e->proceeding.call); - if (!peerpcall) { - peerpcall = tap_pri_get_pcall(pritap, NULL); - if (!peerpcall) { - ftdm_log(FTDM_LOG_ERROR, "Failed to get a free peer PRI passive call slot for callref %d in span %s, this is a bug!\n", - crv, pritap->span->name); - break; - } - peerpcall->callref = e->proceeding.call; - } - - /* check that the layer 1 and trans capability are supported */ - layer1 = pri_get_layer1(peertap->pri, pcall->callref); - transcap = pri_get_transcap(peertap->pri, pcall->callref); - - if (PRI_LAYER_1_ULAW != layer1 && PRI_LAYER_1_ALAW != layer1) { - ftdm_log(FTDM_LOG_NOTICE, "Not monitoring callref %d with unsupported layer 1 format %d\n", crv, layer1); - break; - } - - if (transcap != PRI_TRANS_CAP_SPEECH && transcap != PRI_TRANS_CAP_3_1K_AUDIO && transcap != PRI_TRANS_CAP_7K_AUDIO) { - ftdm_log(FTDM_LOG_NOTICE, "Not monitoring callref %d with unsupported capability %d\n", crv, transcap); - break; - } - - fchan = tap_pri_get_fchan(pritap, pcall, e->proceeding.channel); - if (!fchan) { - ftdm_log(FTDM_LOG_ERROR, "Proceeding requested on odd/unavailable channel %s:%d:%d for callref %d\n", - pritap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv); - break; - } - - peerfchan = tap_pri_get_fchan(peertap, pcall, e->proceeding.channel); - if (!peerfchan) { - ftdm_log(FTDM_LOG_ERROR, "Proceeding requested on odd/unavailable channel %s:%d:%d for callref %d\n", - peertap->span->name, PRI_SPAN(e->proceeding.channel), PRI_CHANNEL(e->proceeding.channel), crv); - break; - } - pcall->fchan = fchan; - peerpcall->fchan = fchan; - - ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "Starting new tapped call with callref %d\n", crv); - - ftdm_channel_lock(fchan); - fchan->call_data = peerfchan; - ftdm_set_state(fchan, FTDM_CHANNEL_STATE_RING); - ftdm_channel_unlock(fchan); - - ftdm_channel_lock(peerfchan); - peerfchan->call_data = fchan; - ftdm_channel_unlock(peerfchan); - - break; - - case PRI_EVENT_ANSWER: - crv = tap_pri_get_crv(pritap->pri, e->answer.call); - ftdm_log(FTDM_LOG_DEBUG, "Answer on channel %s:%d:%d with callref %d\n", - pritap->span->name, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), crv); - if (!(pcall = tap_pri_get_pcall_bycrv(pritap, crv))) { - ftdm_log(FTDM_LOG_DEBUG, - "ignoring answer in channel %s:%d:%d for callref %d since we don't know about it\n", - pritap->span->name, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->proceeding.channel), crv); - break; - } - if (!pcall->fchan) { - ftdm_log(FTDM_LOG_ERROR, - "Received answer in channel %s:%d:%d for callref %d but we never got a channel\n", - pritap->span->name, PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), crv); - break; - } - ftdm_channel_lock(pcall->fchan); - ftdm_log_chan(pcall->fchan, FTDM_LOG_NOTICE, "Tapped call was answered in state %s\n", ftdm_channel_state2str(pcall->fchan->state)); - ftdm_set_pflag(pcall->fchan, PRITAP_NETWORK_ANSWER); - ftdm_set_state(pcall->fchan, FTDM_CHANNEL_STATE_UP); - ftdm_channel_unlock(pcall->fchan); - break; - - case PRI_EVENT_HANGUP_REQ: - crv = tap_pri_get_crv(pritap->pri, e->hangup.call); - - ftdm_log(FTDM_LOG_DEBUG, "Hangup on channel %s:%d:%d with callref %d\n", - pritap->span->name, PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), crv); - - if (!(pcall = tap_pri_get_pcall_bycrv(pritap, crv))) { - ftdm_log(FTDM_LOG_DEBUG, - "ignoring hangup in channel %s:%d:%d for callref %d since we don't know about it", - pritap->span->name, PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), crv); - break; - } - - if (pcall->fchan) { - fchan = pcall->fchan; - ftdm_channel_lock(fchan); - if (fchan->state < FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_set_state(fchan, FTDM_CHANNEL_STATE_TERMINATING); - } - pcall->fchan = NULL; /* after this event we're not supposed to need to do anything with the channel anymore */ - ftdm_channel_unlock(fchan); - } - - tap_pri_put_pcall(pritap, e->hangup.call); - tap_pri_put_pcall(peertap, e->hangup.call); - break; - - case PRI_EVENT_HANGUP_ACK: - crv = tap_pri_get_crv(pritap->pri, e->hangup.call); - ftdm_log(FTDM_LOG_DEBUG, "Hangup ack on channel %s:%d:%d with callref %d\n", - pritap->span->name, PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), crv); - tap_pri_put_pcall(pritap, e->hangup.call); - tap_pri_put_pcall(peertap, e->hangup.call); - break; - - default: - ftdm_log(FTDM_LOG_DEBUG, "Ignoring passive event %s on span %s\n", pri_event2str(e->gen.e), pritap->span->name); - break; - - } -} - -static void *ftdm_pritap_run(ftdm_thread_t *me, void *obj) -{ - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_span_t *peer = NULL; - pritap_t *pritap = span->signal_data; - pritap_t *p_pritap = NULL; - pri_event *event = NULL; - struct pollfd dpoll[2]; - int rc = 0; - - ftdm_log(FTDM_LOG_DEBUG, "Tapping PRI thread started on span %s\n", span->name); - - pritap->span = span; - - ftdm_set_flag(span, FTDM_SPAN_IN_THREAD); - - if (ftdm_channel_open(span->span_id, pritap->dchan->chan_id, &pritap->dchan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open D-channel for span %s\n", span->name); - goto done; - } - - if ((pritap->pri = pri_new_cb(pritap->dchan->sockfd, PRI_NETWORK, PRI_SWITCH_NI2, pri_io_read, pri_io_write, pritap))){ - pri_set_debug(pritap->pri, pritap->debug); - } else { - ftdm_log(FTDM_LOG_CRIT, "Failed to create tapping PRI\n"); - goto done; - } - - /* The last span starting runs the show ... - * This simplifies locking and avoid races by having multiple threads for a single tapped link - * Since both threads really handle a single tapped link there is no benefit on multi-threading, just complications ... */ - peer = pritap->peerspan; - p_pritap = peer->signal_data; - if (!ftdm_test_flag(pritap, PRITAP_MASTER)) { - ftdm_log(FTDM_LOG_DEBUG, "Running dummy thread on span %s\n", span->name); - while (ftdm_running() && !ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { - poll(NULL, 0, 100); - } - } else { - memset(&dpoll, 0, sizeof(dpoll)); - dpoll[0].fd = pritap->dchan->sockfd; - dpoll[1].fd = p_pritap->dchan->sockfd; - - ftdm_log(FTDM_LOG_DEBUG, "Master tapping thread on span %s (fd1=%d, fd2=%d)\n", span->name, - pritap->dchan->sockfd, p_pritap->dchan->sockfd); - - while (ftdm_running() && !ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { - - pritap_check_state(span); - pritap_check_state(peer); - - dpoll[0].revents = 0; - dpoll[0].events = POLLIN; - - dpoll[1].revents = 0; - dpoll[1].events = POLLIN; - - rc = poll(&dpoll[0], 2, 10); - - if (rc < 0) { - if (errno == EINTR) { - ftdm_log(FTDM_LOG_DEBUG, "D-channel waiting interrupted, continuing ...\n"); - continue; - } - ftdm_log(FTDM_LOG_ERROR, "poll failed: %s\n", strerror(errno)); - continue; - } - - pri_schedule_run(pritap->pri); - pri_schedule_run(p_pritap->pri); - - pritap_check_state(span); - pritap_check_state(peer); - - if (rc) { - if (dpoll[0].revents & POLLIN) { - event = pri_read_event(pritap->pri); - if (event) { - handle_pri_passive_event(pritap, event); - pritap_check_state(span); - } - } - - if (dpoll[1].revents & POLLIN) { - event = pri_read_event(p_pritap->pri); - if (event) { - handle_pri_passive_event(p_pritap, event); - pritap_check_state(peer); - } - } - } - - } - } - - -done: - ftdm_log(FTDM_LOG_DEBUG, "Tapping PRI thread ended on span %s\n", span->name); - - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - ftdm_clear_flag(pritap, PRITAP_RUNNING); - ftdm_clear_flag(pritap, PRITAP_MASTER); - - return NULL; -} - -static ftdm_status_t ftdm_pritap_stop(ftdm_span_t *span) -{ - pritap_t *pritap = span->signal_data; - - if (!ftdm_test_flag(pritap, PRITAP_RUNNING)) { - return FTDM_FAIL; - } - - ftdm_set_flag(span, FTDM_SPAN_STOP_THREAD); - - while (ftdm_test_flag(span, FTDM_SPAN_IN_THREAD)) { - ftdm_sleep(100); - } - - ftdm_mutex_destroy(&pritap->pcalls_lock); - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_pritap_sig_read(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size) -{ - ftdm_status_t status; - fio_codec_t codec_func; - ftdm_channel_t *peerchan = ftdmchan->call_data; - pritap_t *pritap = ftdmchan->span->signal_data; - int16_t chanbuf[size]; - int16_t peerbuf[size]; - int16_t mixedbuf[size]; - int i = 0; - ftdm_size_t sizeread = size; - - if (!FTDM_IS_VOICE_CHANNEL(ftdmchan) || !ftdmchan->call_data) { - return FTDM_SUCCESS; - } - - if (pritap->mixaudio == PRITAP_MIX_SELF) { - return FTDM_SUCCESS; - } - - if (pritap->mixaudio == PRITAP_MIX_PEER) { - /* start out by clearing the self audio to make sure we don't return audio we were - * not supposed to in an error condition */ - memset(data, FTDM_SILENCE_VALUE(ftdmchan), size); - } - - if (ftdmchan->native_codec != peerchan->native_codec) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Invalid peer channel with format %d, ours = %d\n", - peerchan->native_codec, ftdmchan->native_codec); - return FTDM_FAIL; - } - - memcpy(chanbuf, data, size); - status = peerchan->fio->read(peerchan, peerbuf, &sizeread); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to read from peer channel!\n"); - return FTDM_FAIL; - } - if (sizeread != size) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "read from peer channel only %"FTDM_SIZE_FMT" bytes!\n", sizeread); - return FTDM_FAIL; - } - - if (pritap->mixaudio == PRITAP_MIX_PEER) { - /* only the peer audio is requested */ - memcpy(data, peerbuf, size); - return FTDM_SUCCESS; - } - - codec_func = peerchan->native_codec == FTDM_CODEC_ULAW ? fio_ulaw2slin : peerchan->native_codec == FTDM_CODEC_ALAW ? fio_alaw2slin : NULL; - if (codec_func) { - sizeread = size; - codec_func(chanbuf, sizeof(chanbuf), &sizeread); - sizeread = size; - codec_func(peerbuf, sizeof(peerbuf), &sizeread); - } - - for (i = 0; i < size; i++) { - mixedbuf[i] = ftdm_saturated_add(chanbuf[i], peerbuf[i]); - } - - codec_func = peerchan->native_codec == FTDM_CODEC_ULAW ? fio_slin2ulaw : peerchan->native_codec == FTDM_CODEC_ALAW ? fio_slin2alaw : NULL; - if (codec_func) { - size = sizeof(mixedbuf); - codec_func(mixedbuf, size, &size); - } - memcpy(data, mixedbuf, size); - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_pritap_start(ftdm_span_t *span) -{ - ftdm_status_t ret; - pritap_t *pritap = span->signal_data; - pritap_t *p_pritap = pritap->peerspan->signal_data; - - if (ftdm_test_flag(pritap, PRITAP_RUNNING)) { - return FTDM_FAIL; - } - - ftdm_mutex_create(&pritap->pcalls_lock); - - ftdm_clear_flag(span, FTDM_SPAN_STOP_THREAD); - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - - ftdm_set_flag(pritap, PRITAP_RUNNING); - if (p_pritap && ftdm_test_flag(p_pritap, PRITAP_RUNNING)) { - /* our peer already started, we're the master */ - ftdm_set_flag(pritap, PRITAP_MASTER); - } - ret = ftdm_thread_create_detached(ftdm_pritap_run, span); - - if (ret != FTDM_SUCCESS) { - return ret; - } - - return ret; -} - -static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span) -{ - uint32_t i; - const char *var, *val; - const char *debug = NULL; - pritap_mix_mode_t mixaudio = PRITAP_MIX_BOTH; - ftdm_channel_t *dchan = NULL; - pritap_t *pritap = NULL; - ftdm_span_t *peerspan = NULL; - pritap_iface_t iface = PRITAP_IFACE_UNKNOWN; - unsigned paramindex = 0; - - if (span->trunk_type >= FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(span->trunk_type)); - span->trunk_type = FTDM_TRUNK_T1; - } - - for (i = 1; i <= span->chan_count; i++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { - dchan = span->channels[i]; - } - } - - if (!dchan) { - ftdm_log(FTDM_LOG_ERROR, "No d-channel specified in freetdm.conf!\n"); - return FTDM_FAIL; - } - - for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { - var = ftdm_parameters[paramindex].var; - val = ftdm_parameters[paramindex].val; - ftdm_log(FTDM_LOG_DEBUG, "Tapping PRI key=value, %s=%s\n", var, val); - - if (!strcasecmp(var, "debug")) { - debug = val; - } else if (!strcasecmp(var, "mixaudio")) { - if (ftdm_true(val) || !strcasecmp(val, "both")) { - ftdm_log(FTDM_LOG_DEBUG, "Setting mix audio mode to 'both' for span %s\n", span->name); - mixaudio = PRITAP_MIX_BOTH; - } else if (!strcasecmp(val, "peer")) { - ftdm_log(FTDM_LOG_DEBUG, "Setting mix audio mode to 'peer' for span %s\n", span->name); - mixaudio = PRITAP_MIX_PEER; - } else { - ftdm_log(FTDM_LOG_DEBUG, "Setting mix audio mode to 'self' for span %s\n", span->name); - mixaudio = PRITAP_MIX_SELF; - } - } else if (!strcasecmp(var, "interface")) { - if (!strcasecmp(val, "cpe")) { - iface = PRITAP_IFACE_CPE; - } else if (!strcasecmp(val, "net")) { - iface = PRITAP_IFACE_NET; - } else { - ftdm_log(FTDM_LOG_WARNING, "Ignoring invalid tapping interface type %s\n", val); - } - } else if (!strcasecmp(var, "peerspan")) { - if (ftdm_span_find_by_name(val, &peerspan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Invalid tapping peer span %s\n", val); - break; - } - } else { - ftdm_log(FTDM_LOG_ERROR, "Unknown pri tapping parameter [%s]", var); - } - } - - if (!peerspan) { - ftdm_log(FTDM_LOG_ERROR, "No valid peerspan was specified!\n"); - return FTDM_FAIL; - } - - pritap = ftdm_calloc(1, sizeof(*pritap)); - if (!pritap) { - return FTDM_FAIL; - } - - pritap->debug = parse_debug(debug); - pritap->dchan = dchan; - pritap->peerspan = peerspan; - pritap->mixaudio = mixaudio; - pritap->iface = iface; - - span->start = ftdm_pritap_start; - span->stop = ftdm_pritap_stop; - span->sig_read = ftdm_pritap_sig_read; - span->signal_cb = sig_cb; - - span->signal_data = pritap; - span->signal_type = FTDM_SIGTYPE_ISDN; - span->outgoing_call = pritap_outgoing_call; - - span->get_channel_sig_status = pritap_get_channel_sig_status; - span->get_span_sig_status = pritap_get_span_sig_status; - - span->state_map = &pritap_state_map; - span->state_processor = state_advance; - - return FTDM_SUCCESS; -} - -/** - * \brief FreeTDM pritap signaling and IO module definition - */ -ftdm_module_t ftdm_module = { - "pritap", - ftdm_pritap_io_init, - ftdm_pritap_unload, - ftdm_pritap_init, - NULL, - NULL, - ftdm_pritap_configure_span, -}; - - -/* 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/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj deleted file mode 100644 index 565a31e505..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters deleted file mode 100644 index 9c91228e09..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c deleted file mode 100755 index 8b36cdb8f3..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ /dev/null @@ -1,2437 +0,0 @@ -/* - * Copyright (c) 2009, Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Arnaldo Pereira - * Ricardo Barroetaveña - * - */ - -#ifdef __linux__ -#ifndef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE -#endif -#ifndef _BSD_SOURCE -#define _BSD_SOURCE /* for strsep() */ -#endif -#include -#include -#include -#endif -#include -#include -#include -#include - -#include "ftmod_r2_io_mf_lib.h" // ftdm_r2_get_native_channel_mf_generation_iface - -/* when the user stops a span, we clear FTDM_R2_SPAN_STARTED, so that the signaling thread - * knows it must stop, and we wait for FTDM_R2_RUNNING to be clear, which tells us the - * signaling thread is done. */ -/* FIXME: what about the calls that are already up-and-running? */ -typedef enum { - FTDM_R2_RUNNING = (1 << 0), - FTDM_R2_SPAN_STARTED = (1 << 1), -} ftdm_r2_flag_t; - -/* private call information stored in ftdmchan->call_data void* ptr, - * remember that each time you add a new member to this structure - * most likely you want to clear it in ft_r2_clean_call function - * */ -#define R2CALL(ftdmchan) ((ftdm_r2_call_t*)((ftdmchan)->call_data)) -typedef struct ftdm_r2_call_t { - openr2_chan_t *r2chan; - int accepted:1; - int answer_pending:1; - int disconnect_rcvd:1; - int protocol_error:1; - int localsuspend_on_alarm:1; - ftdm_size_t dnis_index; - ftdm_size_t ani_index; - char logname[255]; - char name[10]; - ftdm_timer_id_t protocol_error_recovery_timer; -} ftdm_r2_call_t; - -/* this is just used as place holder in the stack when configuring the span to avoid using bunch of locals */ -typedef struct ft_r2_conf_s { - /* openr2 types */ - openr2_variant_t variant; - openr2_calling_party_category_t category; - openr2_log_level_t loglevel; - - /* strings */ - char *logdir; - char *advanced_protocol_file; - - /* ints */ - int32_t max_ani; - int32_t max_dnis; - int32_t mfback_timeout; - int32_t metering_pulse_timeout; - ftdm_size_t mf_dump_size; - - /* booleans */ - int immediate_accept; - int skip_category; - int get_ani_first; - int call_files; - int double_answer; - int charge_calls; - int forced_release; - int allow_collect_calls; - int use_channel_native_mf_generation; -} ft_r2_conf_t; - -/* r2 configuration stored in span->signal_data */ -typedef struct ftdm_r2_data_s { - /* span flags */ - ftdm_r2_flag_t flags; - /* openr2 handle for the R2 variant context */ - openr2_context_t *r2context; - /* category to use when making calls */ - openr2_calling_party_category_t category; - /* whether to use OR2_CALL_WITH_CHARGE or OR2_CALL_NO_CHARGE when accepting a call */ - int charge_calls:1; - /* allow or reject collect calls */ - int allow_collect_calls:1; - /* whether to use forced release when hanging up */ - int forced_release:1; - /* whether accept the call when offered, or wait until the user decides to accept */ - int accept_on_offer:1; - /* Size of multi-frequency (or any media) dumps used during protocol errors */ - ftdm_size_t mf_dump_size; - /* max time spent in ms doing real work in a single loop */ - int32_t jobmax; - /* Total number of loops performed so far */ - uint64_t total_loops; - /* number of loops per 10ms increment from 0-9ms, 10-19ms .. 100ms and above */ - uint64_t loops[11]; - /* Total number of sleeps performed so far */ - uint64_t total_sleeps; - /* number of sleeps per 10ms increment from 0-9ms, 10-19ms .. 100ms and above */ - uint64_t sleeps[11]; - /* max time spent in ms sleeping in a single loop */ - int32_t sleepmax; - /* LWP */ - uint32_t monitor_thread_id; - /* Logging directory */ - char logdir[512]; - /* scheduling context */ - ftdm_sched_t *sched; -} ftdm_r2_data_t; - -/* one element per span will be stored in g_mod_data_hash global var to keep track of them - and destroy them on module unload */ -typedef struct ftdm_r2_span_pvt_s { - openr2_context_t *r2context; /* r2 context allocated for this span */ - ftdm_hash_t *r2calls; /* hash table of allocated call data per channel for this span */ - ftdm_sched_t *sched; /* schedule for the span */ -} ftdm_r2_span_pvt_t; - -/* span monitor thread */ -static void *ftdm_r2_run(ftdm_thread_t *me, void *obj); - -/* hash of all the private span allocations - we need to keep track of them to destroy them when unloading the module - since freetdm does not notify signaling modules when destroying a span - span -> ftdm_r2_mod_allocs_t */ -static ftdm_hash_t *g_mod_data_hash; - -/* IO interface for the command API */ -static ftdm_io_interface_t g_ftdm_r2_interface; - -static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan); - -/* whether R2 call accept process is pending */ -#define IS_ACCEPTING_PENDING(ftdmchan) \ - ( (!ftdm_test_flag((ftdmchan), FTDM_CHANNEL_OUTBOUND)) && !R2CALL((ftdmchan))->accepted && \ - ((ftdmchan)->state == FTDM_CHANNEL_STATE_PROGRESS || \ - (ftdmchan)->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA || \ - (ftdmchan)->state == FTDM_CHANNEL_STATE_UP) ) - -/* functions not available on windows */ -#ifdef WIN32 -#include - -static __inline int gettimeofday(struct timeval *tp, void *nothing) -{ -#ifdef WITHOUT_MM_LIB - SYSTEMTIME st; - time_t tt; - struct tm tmtm; - /* mktime converts local to UTC */ - GetLocalTime (&st); - tmtm.tm_sec = st.wSecond; - tmtm.tm_min = st.wMinute; - tmtm.tm_hour = st.wHour; - tmtm.tm_mday = st.wDay; - tmtm.tm_mon = st.wMonth - 1; - tmtm.tm_year = st.wYear - 1900; tmtm.tm_isdst = -1; - tt = mktime (&tmtm); - tp->tv_sec = tt; - tp->tv_usec = st.wMilliseconds * 1000; -#else - /** - ** The earlier time calculations using GetLocalTime - ** had a time resolution of 10ms.The timeGetTime, part - ** of multimedia apis offer a better time resolution - ** of 1ms.Need to link against winmm.lib for this - **/ - unsigned long Ticks = 0; - unsigned long Sec =0; - unsigned long Usec = 0; - Ticks = timeGetTime(); - - Sec = Ticks/1000; - Usec = (Ticks - (Sec*1000))*1000; - tp->tv_sec = Sec; - tp->tv_usec = Usec; -#endif /* WITHOUT_MM_LIB */ - (void)nothing; - return 0; -} - -static char *strsep(char **stringp, const char *delim) -{ - char *start = *stringp; - char *ptr; - - if (!start) - return NULL; - - if (!*delim) - ptr = start + strlen(start); - else { - ptr = strpbrk(start, delim); - if (!ptr) { - *stringp = NULL; - return start; - } - } - - *ptr = '\0'; - *stringp = ptr + 1; - - return start; -} -#endif /* WIN32 */ - -static void ftdm_r2_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) -{ - ftdm_sigmsg_t sig; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n", ftdm_signaling_status2str(status)); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.ev_data.sigstatus.status = status; - if (ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to change channel status to %s\n", ftdm_signaling_status2str(status)); - } - return; -} - -static ftdm_call_cause_t ftdm_r2_cause_to_ftdm_cause(ftdm_channel_t *fchan, openr2_call_disconnect_cause_t cause) -{ - switch (cause) { - - case OR2_CAUSE_NORMAL_CLEARING: - return FTDM_CAUSE_NORMAL_CLEARING; - - case OR2_CAUSE_BUSY_NUMBER: - return FTDM_CAUSE_USER_BUSY; - - case OR2_CAUSE_NETWORK_CONGESTION: - return FTDM_CAUSE_SWITCH_CONGESTION; - - case OR2_CAUSE_UNALLOCATED_NUMBER: - return FTDM_CAUSE_NO_ROUTE_DESTINATION; - - case OR2_CAUSE_NUMBER_CHANGED: - return FTDM_CAUSE_NUMBER_CHANGED; - - case OR2_CAUSE_OUT_OF_ORDER: - return FTDM_CAUSE_NETWORK_OUT_OF_ORDER; - - case OR2_CAUSE_NO_ANSWER: - return FTDM_CAUSE_NO_ANSWER; - - case OR2_CAUSE_UNSPECIFIED: - return FTDM_CAUSE_NORMAL_UNSPECIFIED; - - case OR2_CAUSE_FORCED_RELEASE: - return FTDM_CAUSE_NORMAL_CLEARING; - - case OR2_CAUSE_GLARE: - return FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL; - } - ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "Mapping openr2 cause %d to unspecified\n", cause); - return FTDM_CAUSE_NORMAL_UNSPECIFIED; -} - -static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_channel_t *fchan) -{ - switch (fchan->caller_data.hangup_cause) { - - case FTDM_CAUSE_NORMAL_CLEARING: - return OR2_CAUSE_NORMAL_CLEARING; - - case FTDM_CAUSE_USER_BUSY: - case FTDM_CAUSE_CALL_REJECTED: - return OR2_CAUSE_BUSY_NUMBER; - - case FTDM_CAUSE_SWITCH_CONGESTION: - return OR2_CAUSE_NETWORK_CONGESTION; - - case FTDM_CAUSE_NO_ROUTE_DESTINATION: - return OR2_CAUSE_UNALLOCATED_NUMBER; - - case FTDM_CAUSE_NUMBER_CHANGED: - return OR2_CAUSE_NUMBER_CHANGED; - - case FTDM_CAUSE_NETWORK_OUT_OF_ORDER: - case FTDM_CAUSE_SERVICE_UNAVAILABLE: - case FTDM_CAUSE_PROTOCOL_ERROR: - return OR2_CAUSE_OUT_OF_ORDER; - - case FTDM_CAUSE_NO_ANSWER: - case FTDM_CAUSE_NO_USER_RESPONSE: - return OR2_CAUSE_NO_ANSWER; - - case FTDM_CAUSE_NORMAL_UNSPECIFIED: - return OR2_CAUSE_UNSPECIFIED; - - case FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL: - return OR2_CAUSE_GLARE; - - } - ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "freetdm hangup cause %d mapped to openr2 cause %s\n", - fchan->caller_data.hangup_cause, openr2_proto_get_disconnect_string(OR2_CAUSE_UNSPECIFIED)); - return OR2_CAUSE_UNSPECIFIED; -} - -static void ft_r2_clean_call(ftdm_r2_call_t *call) -{ - openr2_chan_t *r2chan = call->r2chan; - - /* Do not memset call structure, that clears values we do not want to clear, - * like the log name set in on_call_log_created() */ - call->r2chan = r2chan; - call->accepted = 0; - call->answer_pending = 0; - call->disconnect_rcvd = 0; - call->protocol_error = 0; - call->dnis_index = 0; - call->ani_index = 0; - call->name[0] = 0; - call->protocol_error_recovery_timer = 0; -} - -static void ft_r2_accept_call(ftdm_channel_t *ftdmchan) -{ - openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; - - // FIXME: we should check the return code from openr2_chan_accept_call and handle error condition - // hanging up the call with protocol error as the reason, this openr2 API will fail only when there something - // wrong at the I/O layer or the library itself - if (r2data->charge_calls) - openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE); - else - openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE); -} - -static void ft_r2_answer_call(ftdm_channel_t *ftdmchan) -{ - openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - // FIXME - // 1. check openr2_chan_answer_call return code - // 2. The openr2_chan_answer_call_with_mode should be used depending on user settings - // openr2_chan_answer_call_with_mode(r2chan, OR2_ANSWER_SIMPLE); - openr2_chan_answer_call(r2chan); - R2CALL(ftdmchan)->answer_pending = 0; -} - -static __inline__ ftdm_calling_party_category_t ftdm_openr2_cpc_to_r2_ftdm_cpc(openr2_calling_party_category_t cpc) -{ - switch (cpc) { - case OR2_CALLING_PARTY_CATEGORY_UNKNOWN: - return FTDM_CPC_UNKNOWN; - - case OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER: - return FTDM_CPC_ORDINARY; - - case OR2_CALLING_PARTY_CATEGORY_NATIONAL_PRIORITY_SUBSCRIBER: - return FTDM_CPC_PRIORITY; - - case OR2_CALLING_PARTY_CATEGORY_INTERNATIONAL_SUBSCRIBER: - return FTDM_CPC_UNKNOWN; - - case OR2_CALLING_PARTY_CATEGORY_INTERNATIONAL_PRIORITY_SUBSCRIBER: - return FTDM_CPC_UNKNOWN; - - case OR2_CALLING_PARTY_CATEGORY_TEST_EQUIPMENT: - return FTDM_CPC_TEST; - - case OR2_CALLING_PARTY_CATEGORY_PAY_PHONE: - return FTDM_CPC_PAYPHONE; - - case OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL: - return FTDM_CPC_OPERATOR; - } - return FTDM_CPC_INVALID; -} - -static __inline openr2_calling_party_category_t ftdm_r2_ftdm_cpc_to_openr2_cpc(ftdm_calling_party_category_t cpc) -{ - switch (cpc) { - case FTDM_CPC_UNKNOWN: - return OR2_CALLING_PARTY_CATEGORY_UNKNOWN; - - case FTDM_CPC_OPERATOR: - return OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL; - - case FTDM_CPC_ORDINARY: - return OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER; - - case FTDM_CPC_PRIORITY: - return OR2_CALLING_PARTY_CATEGORY_NATIONAL_PRIORITY_SUBSCRIBER; - - case FTDM_CPC_DATA: - return OR2_CALLING_PARTY_CATEGORY_UNKNOWN; - - case FTDM_CPC_TEST: - return OR2_CALLING_PARTY_CATEGORY_TEST_EQUIPMENT; - - case FTDM_CPC_PAYPHONE: - return OR2_CALLING_PARTY_CATEGORY_PAY_PHONE; - - case FTDM_CPC_OPERATOR_FRENCH: - case FTDM_CPC_OPERATOR_ENGLISH: - case FTDM_CPC_OPERATOR_GERMAN: - case FTDM_CPC_OPERATOR_RUSSIAN: - case FTDM_CPC_OPERATOR_SPANISH: - return OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL; - - case FTDM_CPC_INVALID: - return OR2_CALLING_PARTY_CATEGORY_UNKNOWN; - } - return OR2_CALLING_PARTY_CATEGORY_UNKNOWN; -} - -/* this function must be called with the chan mutex held! */ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) -{ - int ret; - ftdm_r2_data_t *r2data; - openr2_calling_party_category_t category = OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER; - - r2data = ftdmchan->span->signal_data; - - ft_r2_clean_call(ftdmchan->call_data); - - if (ftdmchan->caller_data.cpc == FTDM_CPC_INVALID || ftdmchan->caller_data.cpc == FTDM_CPC_UNKNOWN) { - category = r2data->category; - } else { - category = ftdm_r2_ftdm_cpc_to_openr2_cpc(ftdmchan->caller_data.cpc); - } - - /* start io dump */ - if (r2data->mf_dump_size) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_INPUT_DUMP, &r2data->mf_dump_size); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_OUTPUT_DUMP, &r2data->mf_dump_size); - } - - ret = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, - ftdmchan->caller_data.cid_num.digits, - ftdmchan->caller_data.dnis.digits, - category, - ftdmchan->caller_data.pres == FTDM_PRES_ALLOWED ? 0 : 1); - - if (ret) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n"); - return FTDM_FAIL; - } - - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_TX_BUFFERS, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_RX_BUFFERS, NULL); - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_r2_start(ftdm_span_t *span) -{ - ftdm_r2_data_t *r2_data = span->signal_data; - ftdm_set_flag(r2_data, FTDM_R2_SPAN_STARTED); - return ftdm_thread_create_detached(ftdm_r2_run, span); -} - -static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) -{ - ftdm_r2_data_t *r2_data = span->signal_data; - ftdm_clear_flag(r2_data, FTDM_R2_SPAN_STARTED); - while (ftdm_test_flag(r2_data, FTDM_R2_RUNNING)) { - ftdm_log(FTDM_LOG_DEBUG, "Waiting for R2 span %s\n", span->name); - ftdm_sleep(100); - } - return FTDM_SUCCESS; -} - -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_channel_sig_status) -{ - openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - openr2_cas_signal_t rxcas, txcas; - - /* get the current rx and tx cas bits */ - openr2_chan_get_cas(r2chan, &rxcas, &txcas); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - *status = FTDM_SIG_STATE_UP; - } else if (rxcas == OR2_CAS_BLOCK || txcas == OR2_CAS_BLOCK) { - *status = FTDM_SIG_STATE_SUSPENDED; - } else { - *status = FTDM_SIG_STATE_DOWN; - } - - return FTDM_SUCCESS; -} - -static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status) -{ - openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - openr2_cas_signal_t rxcas, txcas; - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, - "Received request to change sig status of alarmed channel to %s", ftdm_signaling_status2str(status)); - - switch (status) { - case FTDM_SIG_STATE_SUSPENDED: - openr2_chan_set_blocked(r2chan); - /* Need to send sig status change to SUSPENDED once out of alarm */ - R2CALL(ftdmchan)->localsuspend_on_alarm = 1; - break; - case FTDM_SIG_STATE_UP: - openr2_chan_set_blocked(r2chan); - /* DO NOT send sig status change to SUSPENDED once out of alarm */ - R2CALL(ftdmchan)->localsuspend_on_alarm = 0; - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); - return FTDM_FAIL; - } - return FTDM_SUCCESS; - } - - /* get the current rx and tx cas bits */ - openr2_chan_get_cas(r2chan, &rxcas, &txcas); - - /* if we're already in the state the user asks us to be, we have nothing to do */ - if (status == FTDM_SIG_STATE_SUSPENDED && txcas == OR2_CAS_BLOCK) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Channel signaling status already in BLOCK state\n"); - return FTDM_SUCCESS; - } - if (status == FTDM_SIG_STATE_UP && txcas == OR2_CAS_IDLE) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Channel signaling status already in IDLE state\n"); - return FTDM_SUCCESS; - } - - /* set the signaling as requested and send SIGEVENT_SIGSTATUS_CHANGED, if applicable. - * see docs/sigstatus.txt for details */ - switch(status) { - case FTDM_SIG_STATE_SUSPENDED: - openr2_chan_set_blocked(r2chan); - if (rxcas == OR2_CAS_IDLE) { - ftdm_r2_set_chan_sig_status(ftdmchan, status); - } - break; - case FTDM_SIG_STATE_UP: - openr2_chan_set_idle(r2chan); - if (rxcas == OR2_CAS_IDLE) { - ftdm_r2_set_chan_sig_status(ftdmchan, status); - } - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_span_sig_status) -{ - ftdm_iterator_t *citer = NULL; - ftdm_iterator_t *chaniter = ftdm_span_get_chan_iterator(span, NULL); - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - return FTDM_FAIL; - } - /* if ALL channels are non-idle, report SUSPENDED. UP otherwise. */ - *status = FTDM_SIG_STATE_SUSPENDED; - for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { - ftdm_channel_t *fchan = ftdm_iterator_current(citer); - ftdm_channel_lock(fchan); - if (ftdm_test_flag(fchan, FTDM_CHANNEL_IN_ALARM)) { - *status = FTDM_SIG_STATE_DOWN; - ftdm_channel_unlock(fchan); - break; - } - if (ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP)) { - *status = FTDM_SIG_STATE_UP; - ftdm_channel_unlock(fchan); - break; - } - ftdm_channel_unlock(fchan); - } - ftdm_iterator_free(chaniter); - return FTDM_SUCCESS; -} - -static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) -{ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *citer = NULL; - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - return FTDM_FAIL; - } - /* iterate over all channels, setting them to the requested state */ - for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { - ftdm_channel_t *fchan = ftdm_iterator_current(citer); - /* we set channel's state through ftdm_r2_set_channel_sig_status(), since it already takes - * care of notifying the user when appropriate */ - ftdm_channel_lock(fchan); - if ((ftdm_r2_set_channel_sig_status(fchan, status)) != FTDM_SUCCESS) { - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "Failed to set signaling status to %s\n", ftdm_signaling_status2str(status)); - } - ftdm_channel_unlock(fchan); - } - ftdm_iterator_free(chaniter); - return FTDM_SUCCESS; -} - -/* always called from the monitor thread */ -static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) -{ - ftdm_r2_call_t *r2call; - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Received request to start call\n"); - - if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { - r2call = R2CALL(ftdmchan); - if (r2call->protocol_error) { - /* we had a protocol error and we were giving some recovery time, cancel the recovery timer now - * that is obvious that the other side recovered */ - ftdm_sched_cancel_timer(r2data->sched, r2call->protocol_error_recovery_timer); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Cancelled protocol error recovery timer\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - ftdm_channel_advance_states(ftdmchan); - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); - return; - } - - if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot handle request to start call in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - return; - } - - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open channel during incoming call! [%s]\n", ftdmchan->last_error); - return; - } - - memset(ftdmchan->caller_data.dnis.digits, 0, sizeof(ftdmchan->caller_data.collected)); - memset(ftdmchan->caller_data.ani.digits, 0, sizeof(ftdmchan->caller_data.collected)); - - ft_r2_clean_call(ftdmchan->call_data); - r2call = R2CALL(ftdmchan); - - /* start io dump */ - if (r2data->mf_dump_size) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_INPUT_DUMP, &r2data->mf_dump_size); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_OUTPUT_DUMP, &r2data->mf_dump_size); - } - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_TX_BUFFERS, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_RX_BUFFERS, NULL); -} - -static void dump_mf(openr2_chan_t *r2chan); -/* only called for incoming calls when the ANI, DNIS etc is complete and the user has to decide either to accept or reject the call */ -static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, - openr2_calling_party_category_t category, int ani_restricted) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; - - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = %s, ANI restricted = %s\n", - ani, dnis, openr2_proto_get_category_string(category), ani_restricted ? "Yes" : "No"); - - /* check if this is a collect call and if we should accept it */ - if (!r2data->allow_collect_calls && category == OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Rejecting collect call\n"); - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_UNALLOCATED_NUMBER); - } else { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - ftdmchan->caller_data.cpc = ftdm_openr2_cpc_to_r2_ftdm_cpc(category); - ftdmchan->caller_data.pres = ani_restricted ? FTDM_PRES_RESTRICTED : FTDM_PRES_ALLOWED; -} - -/* - * Accepting a call in R2 is a lengthy process due to MF tones, - * when the user sends PROGRESS indication (implicitly moving the - * ftdm channel to PROGRESS state) the R2 processing loop - * does not clear FTDM_CHANNEL_STATE_CHANGE immediately as it does - * for all the other states, instead has to wait for on_call_accepted - * callback from openr2, which means the MF has ended and the progress - * indication is done, in order to clear the flag. However, if - * a protocol error or call disconnection (which is indicated using CAS bits) - * occurrs while accepting, we must clear the pending flag, this function - * takes care of that - * */ -static void clear_accept_pending(ftdm_channel_t *fchan) -{ - if (IS_ACCEPTING_PENDING(fchan)) { - ftdm_channel_complete_state(fchan); - } else if (ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_log_chan(fchan, FTDM_LOG_CRIT, "State change flag set in state %s, last state = %s\n", - ftdm_channel_state2str(fchan->state), ftdm_channel_state2str(fchan->last_state)); - ftdm_channel_complete_state(fchan); - } -} - -static void dump_mf(openr2_chan_t *r2chan) -{ - char dfile[512]; - FILE *f = NULL; - int rc = 0; - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; - if (r2data->mf_dump_size) { - char *logname = R2CALL(ftdmchan)->logname; - - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in prefix %s\n", !ftdm_strlen_zero(logname) - ? logname : r2data->logdir); - snprintf(dfile, sizeof(dfile), !ftdm_strlen_zero(logname) ? "%s.s%dc%d.input.alaw" : "%s/s%dc%d.input.alaw", - !ftdm_strlen_zero(logname) ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); - f = fopen(dfile, "wb"); - if (f) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO input in file %s\n", dfile); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, f); - rc = fclose(f); - if (rc) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failure closing IO input file %s: %s\n", dfile, strerror(errno)); - } - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Could not dump IO input in file %s, error: %s", dfile, strerror(errno)); - } - - snprintf(dfile, sizeof(dfile), !ftdm_strlen_zero(logname) ? "%s.s%dc%d.output.alaw" : "%s/s%dc%d.output.alaw", - !ftdm_strlen_zero(logname) ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); - f = fopen(dfile, "wb"); - if (f) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in file %s\n", dfile); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_OUTPUT, f); - rc = fclose(f); - if (rc) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failure closing IO output file %s: %s\n", dfile, strerror(errno)); - } - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Could not dump IO output in file %s, error: %s", dfile, strerror(errno)); - } - } -} - -static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t mode) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call accepted\n"); - - clear_accept_pending(ftdmchan); - - /* at this point the MF signaling has ended and there is no point on keep reading */ - openr2_chan_disable_read(r2chan); - - /* at this point we are no longer responsible for reading and writing, - * we are not interested in the stats anymore */ - ftdm_channel_clear_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); - - - R2CALL(ftdmchan)->accepted = 1; - - /* nothing went wrong during call setup, MF has ended, we can and must disable the MF dump */ - if (r2data->mf_dump_size) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_OUTPUT_DUMP, NULL); - } - - if (OR2_DIR_BACKWARD == openr2_chan_get_direction(r2chan)) { - if (R2CALL(ftdmchan)->answer_pending) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Answer was pending, answering now.\n"); - ft_r2_answer_call(ftdmchan); - R2CALL(ftdmchan)->answer_pending = 0; - return; - } - } else { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } -} - -static void ftdm_r2_on_call_answered(openr2_chan_t *r2chan) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call answered\n"); - /* notify the upper layer of progress in the outbound call */ - if (OR2_DIR_FORWARD == openr2_chan_get_direction(r2chan)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - } -} - -/* may be called in the signaling or media thread depending on whether the hangup is product of MF or CAS signaling */ -static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_disconnect_cause_t cause) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call disconnected\n"); - - clear_accept_pending(ftdmchan); - - R2CALL(ftdmchan)->disconnect_rcvd = 1; - - if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call had been disconnected already by the user\n"); - /* just ack the hangup to trigger the on_call_end callback and go down */ - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); - return; - } - - ftdmchan->caller_data.hangup_cause = ftdm_r2_cause_to_ftdm_cause(ftdmchan, cause); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); -} - -static void ftdm_r2_on_call_end(openr2_chan_t *r2chan) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call finished\n"); - - /* the call is done as far as the stack is concerned, lets move to down here */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - /* in some circumstances openr2 can call on_call_init right after this, so let's advance the state right here */ - ftdm_channel_advance_states(ftdmchan); -} - -static void ftdm_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf, int buflen) -{ -#if 0 - ftdm_log(FTDM_LOG_NOTICE, "Call read data on chan %d\n", openr2_chan_get_number(r2chan)); -#endif -} - -static void ftdm_r2_on_hardware_alarm(openr2_chan_t *r2chan, int alarm) -{ - ftdm_channel_t *fchan = openr2_chan_get_client_data(r2chan); - - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Alarm notification %d when in state %s (sigstatus = %d)\n", - alarm, ftdm_channel_state2str(fchan->state), ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP) ? 1 : 0); - - if (alarm) { - R2CALL(fchan)->localsuspend_on_alarm = ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED) ? 1 : 0; - if (ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP) || ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED)) { - ftdm_r2_set_chan_sig_status(fchan, FTDM_SIG_STATE_DOWN); - } - } -} - -static void ftdm_r2_on_os_error(openr2_chan_t *r2chan, int errorcode) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "OS error: %s\n", strerror(errorcode)); -} - -static void ftdm_r2_recover_from_protocol_error(void *data) -{ - openr2_chan_t *r2chan = data; - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_channel_lock(ftdmchan); - if (ftdmchan->state != FTDM_CHANNEL_STATE_HANGUP) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Recovering from protocol error but state is %s!\n", ftdm_channel_state2str(ftdmchan->state)); - goto done; - } - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - ftdm_channel_advance_states(ftdmchan); -done: - ftdm_channel_unlock(ftdmchan); -} - -static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_error_t reason) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Got protocol error when we're already down!\n"); - return; - } - - dump_mf(r2chan); - - clear_accept_pending(ftdmchan); - - R2CALL(ftdmchan)->disconnect_rcvd = 1; - R2CALL(ftdmchan)->protocol_error = 1; - - if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "The user already hung up, finishing call in protocol error\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - return; - } - - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_PROTOCOL_ERROR; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); -} - -static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end blocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP) - || !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { - ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); - } -} - -static void ftdm_r2_on_line_idle(openr2_chan_t *r2chan) -{ - openr2_cas_signal_t rxcas, txcas; - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - - /* get the current rx and tx cas bits */ - openr2_chan_get_cas(r2chan, &rxcas, &txcas); - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end unblocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP) - && txcas == OR2_CAS_IDLE) { - /* if txcas is not idle, it means we're still blocked as far as the user is concerned, do not send SIGEVENT UP, - * it will be done when the user set the line to IDLE (if the remote is still also IDLE) */ - ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); - } else if (txcas == OR2_CAS_BLOCK && R2CALL(ftdmchan)->localsuspend_on_alarm) { - /* the user requested to block, we do not notify about state up until the user set the bits to IDLE, however - * if we're just getting back from alarmed condition, we notify about suspended again */ - ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); - } - R2CALL(ftdmchan)->localsuspend_on_alarm = 0; -} - -static void ftdm_r2_write_log(openr2_log_level_t level, const char *file, const char *function, int line, const char *message) -{ - switch (level) { - case OR2_LOG_NOTICE: - ftdm_log(file, function, line, FTDM_LOG_LEVEL_NOTICE, "%s", message); - break; - case OR2_LOG_WARNING: - ftdm_log(file, function, line, FTDM_LOG_LEVEL_WARNING, "%s", message); - break; - case OR2_LOG_ERROR: - ftdm_log(file, function, line, FTDM_LOG_LEVEL_ERROR, "%s", message); - break; - case OR2_LOG_STACK_TRACE: - case OR2_LOG_MF_TRACE: - case OR2_LOG_CAS_TRACE: - case OR2_LOG_DEBUG: - case OR2_LOG_EX_DEBUG: - ftdm_log(file, function, line, FTDM_LOG_LEVEL_DEBUG, "%s", message); - break; - default: - ftdm_log(FTDM_LOG_WARNING, "We should handle logging level %d here.\n", level); - ftdm_log(file, function, line, FTDM_LOG_LEVEL_DEBUG, "%s", message); - break; - } -} - -static void ftdm_r2_on_context_log(openr2_context_t *r2context, const char *file, const char *function, unsigned int line, - openr2_log_level_t level, const char *fmt, va_list ap) -{ -#define CONTEXT_TAG "Context - " - char logmsg[256]; - char completemsg[sizeof(logmsg) + sizeof(CONTEXT_TAG) - 1]; - vsnprintf(logmsg, sizeof(logmsg), fmt, ap); - snprintf(completemsg, sizeof(completemsg), CONTEXT_TAG "%s", logmsg); - ftdm_r2_write_log(level, file, function, line, completemsg); -#undef CONTEXT_TAG -} - -static void ftdm_r2_on_chan_log(openr2_chan_t *r2chan, const char *file, const char *function, unsigned int line, - openr2_log_level_t level, const char *fmt, va_list ap) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - char logmsg[1024]; - char completemsg[sizeof(logmsg)]; - vsnprintf(logmsg, sizeof(logmsg), fmt, ap); - snprintf(completemsg, sizeof(completemsg), "[s%dc%d] [%d:%d] [%s] %s", - ftdmchan->span_id, ftdmchan->chan_id, ftdmchan->physical_span_id, ftdmchan->physical_chan_id, - ftdm_channel_state2str(ftdmchan->state), logmsg); - ftdm_r2_write_log(level, file, function, line, completemsg); -} - -static int ftdm_r2_on_dnis_digit_received(openr2_chan_t *r2chan, char digit) -{ - ftdm_sigmsg_t sigev; - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_size_t collected_len = R2CALL(ftdmchan)->dnis_index; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "DNIS digit %c received\n", digit); - - /* save the digit we just received */ - ftdmchan->caller_data.dnis.digits[collected_len] = digit; - collected_len++; - ftdmchan->caller_data.dnis.digits[collected_len] = '\0'; - R2CALL(ftdmchan)->dnis_index = collected_len; - - /* notify the user about the new digit and check if we should stop requesting more DNIS */ - memset(&sigev, 0, sizeof(sigev)); - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - sigev.event_id = FTDM_SIGEVENT_COLLECTED_DIGIT; - if (ftdm_span_send_signal(ftdmchan->span, &sigev) == FTDM_BREAK) { - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Requested to stop getting DNIS. Current DNIS = %s\n", ftdmchan->caller_data.dnis.digits); - return OR2_STOP_DNIS_REQUEST; - } - - /* the only other reason to stop requesting DNIS is that there is no more room to save it */ - if (collected_len == (sizeof(ftdmchan->caller_data.dnis.digits) - 1)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "No more room for DNIS. Current DNIS = %s\n", ftdmchan->caller_data.dnis.digits); - return OR2_STOP_DNIS_REQUEST; - } - - return OR2_CONTINUE_DNIS_REQUEST; -} - -static void ftdm_r2_on_ani_digit_received(openr2_chan_t *r2chan, char digit) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_size_t collected_len = R2CALL(ftdmchan)->ani_index; - - /* check if we should drop ANI */ - if (collected_len == (sizeof(ftdmchan->caller_data.ani.digits) - 1)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "No more room for ANI, digit dropped: %c\n", digit); - return; - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ANI digit %c received\n", digit); - - /* save the digit we just received */ - ftdmchan->caller_data.ani.digits[collected_len] = digit; - collected_len++; - ftdmchan->caller_data.ani.digits[collected_len] = '\0'; - R2CALL(ftdmchan)->ani_index = collected_len; -} - -static void ftdm_r2_on_billing_pulse(openr2_chan_t *r2chan) {} - -static void ftdm_r2_on_call_log_created(openr2_chan_t *r2chan, const char *logname) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_r2_call_t *r2call = R2CALL(ftdmchan); - /* this is used when dumping I/O for debugging */ - snprintf(r2call->logname, sizeof(r2call->logname), "%s", logname); -} - -static void ftdm_r2_on_call_proceed(openr2_chan_t *r2chan) -{ - ftdm_sigmsg_t sigev; - ftdm_channel_t *fchan = openr2_chan_get_client_data(r2chan); - memset(&sigev, 0, sizeof(sigev)); - sigev.event_id = FTDM_SIGEVENT_PROCEED; - sigev.channel = fchan; - ftdm_span_send_signal(fchan->span, &sigev); -} - -static openr2_event_interface_t ftdm_r2_event_iface = { - /* .on_call_init */ ftdm_r2_on_call_init, - /* .on_call_proceed */ ftdm_r2_on_call_proceed, - /* .on_call_offered */ ftdm_r2_on_call_offered, - /* .on_call_accepted */ ftdm_r2_on_call_accepted, - /* .on_call_answered */ ftdm_r2_on_call_answered, - /* .on_call_disconnect */ ftdm_r2_on_call_disconnect, - /* .on_call_end */ ftdm_r2_on_call_end, - /* .on_call_read */ ftdm_r2_on_call_read, - /* .on_hardware_alarm */ ftdm_r2_on_hardware_alarm, - /* .on_os_error */ ftdm_r2_on_os_error, - /* .on_protocol_error */ ftdm_r2_on_protocol_error, - /* .on_line_blocked */ ftdm_r2_on_line_blocked, - /* .on_line_idle */ ftdm_r2_on_line_idle, - - /* cast seems to be needed to get rid of the annoying warning regarding format attribute */ - /* .on_context_log */ (openr2_handle_context_logging_func)ftdm_r2_on_context_log, - /* .on_dnis_digit_received */ ftdm_r2_on_dnis_digit_received, - /* .on_ani_digit_received */ ftdm_r2_on_ani_digit_received, - - /* so far we do nothing with billing pulses */ - /* .on_billing_pulse_received */ ftdm_r2_on_billing_pulse, - /* .on_call_log_created */ ftdm_r2_on_call_log_created, -}; - -static int ftdm_r2_io_set_cas(openr2_chan_t *r2chan, int cas) -{ - ftdm_channel_t *ftdm_chan = openr2_chan_get_fd(r2chan); - ftdm_status_t status = ftdm_channel_command(ftdm_chan, FTDM_COMMAND_SET_CAS_BITS, &cas); - if (FTDM_FAIL == status) { - return -1; - } - return 0; -} - -static int ftdm_r2_io_get_cas(openr2_chan_t *r2chan, int *cas) -{ - ftdm_channel_t *ftdm_chan = openr2_chan_get_fd(r2chan); - ftdm_status_t status = ftdm_channel_command(ftdm_chan, FTDM_COMMAND_GET_CAS_BITS, cas); - if (FTDM_FAIL == status) { - return -1; - } - return 0; -} - -static int ftdm_r2_io_flush_write_buffers(openr2_chan_t *r2chan) -{ - ftdm_channel_t *ftdm_chan = openr2_chan_get_fd(r2chan); - ftdm_status_t status = ftdm_channel_command(ftdm_chan, FTDM_COMMAND_FLUSH_TX_BUFFERS, NULL); - if (FTDM_FAIL == status) { - return -1; - } - return 0; -} - -static int ftdm_r2_io_write(openr2_chan_t *r2chan, const void *buf, int size) -{ - ftdm_channel_t *ftdm_chan = openr2_chan_get_fd(r2chan); - ftdm_size_t outsize = size; - ftdm_status_t status = ftdm_channel_write(ftdm_chan, (void *)buf, size, &outsize); - if (FTDM_FAIL == status) { - return -1; - } - return (int)outsize; -} - -static int ftdm_r2_io_read(openr2_chan_t *r2chan, const void *buf, int size) -{ - ftdm_channel_t *ftdm_chan = openr2_chan_get_fd(r2chan); - ftdm_size_t outsize = size; - ftdm_status_t status = ftdm_channel_read(ftdm_chan, (void *)buf, &outsize); - if (FTDM_FAIL == status) { - return -1; - } - return (int)outsize; -} - -static int ftdm_r2_io_wait(openr2_chan_t *r2chan, int *flags, int block) -{ - ftdm_status_t status; - int32_t timeout; - ftdm_wait_flag_t ftdmflags = 0; - - ftdm_channel_t *fchan = openr2_chan_get_fd(r2chan); - timeout = block ? -1 : 0; - - if (*flags & OR2_IO_READ) { - ftdmflags |= FTDM_READ; - } - if (*flags & OR2_IO_WRITE) { - ftdmflags |= FTDM_WRITE; - } - if (*flags & OR2_IO_OOB_EVENT) { - ftdmflags |= FTDM_EVENTS; - } - - status = ftdm_channel_wait(fchan, &ftdmflags, timeout); - - if (FTDM_SUCCESS != status && FTDM_TIMEOUT != status) { - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Failed to wait for events on channel\n"); - return -1; - } - - *flags = 0; - if (ftdmflags & FTDM_READ) { - *flags |= OR2_IO_READ; - } - if (ftdmflags & FTDM_WRITE) { - *flags |= OR2_IO_WRITE; - } - if (ftdmflags & FTDM_EVENTS) { - *flags |= OR2_IO_OOB_EVENT; - } - - return 0; -} - -/* The following openr2 hooks never get called, read on for reasoning ... */ -/* since freetdm takes care of opening the file descriptor and using openr2_chan_new_from_fd, openr2 should never call this hook */ -static openr2_io_fd_t ftdm_r2_io_open(openr2_context_t *r2context, int channo) -{ - ftdm_log(FTDM_LOG_ERROR, "I should not be called (I/O open)!!\n"); - return NULL; -} - -/* since freetdm takes care of closing the file descriptor and uses openr2_chan_new_from_fd, openr2 should never call this hook */ -static int ftdm_r2_io_close(openr2_chan_t *r2chan) -{ - ftdm_channel_t *fchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "I should not be called (I/O close)!!\n"); - return 0; -} - -/* since freetdm takes care of opening the file descriptor and using openr2_chan_new_from_fd, openr2 should never call this hook */ -static int ftdm_r2_io_setup(openr2_chan_t *r2chan) -{ - ftdm_channel_t *fchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "I should not be called (I/O Setup)!!\n"); - return 0; -} - -static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *event) -{ - ftdm_status_t status; - ftdm_event_t *fevent = NULL; - ftdm_channel_t *ftdmchan = openr2_chan_get_fd(r2chan); - - *event = OR2_OOB_EVENT_NONE; - - status = ftdm_channel_read_event(ftdmchan, &fevent); - - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); - return -1; - } - - if (fevent->e_type != FTDM_EVENT_OOB) { - return 0; - } - - switch (fevent->enum_id) { - case FTDM_OOB_CAS_BITS_CHANGE: - { - *event = OR2_OOB_EVENT_CAS_CHANGE; - } - break; - case FTDM_OOB_ALARM_TRAP: - { - *event = OR2_OOB_EVENT_ALARM_ON; - } - break; - case FTDM_OOB_ALARM_CLEAR: - { - *event = OR2_OOB_EVENT_ALARM_OFF; - } - break; - } - return 0; -} - -static int ftdm_r2_io_get_alarm_state(openr2_chan_t *r2chan, int *alarm) -{ - ftdm_channel_t *fchan = openr2_chan_get_fd(r2chan); - ftdm_assert_return(alarm, -1, "Alarm pointer is null\n"); - *alarm = ftdm_test_flag(fchan, FTDM_CHANNEL_IN_ALARM) ? 1 : 0; - return 0; -} - -static openr2_io_interface_t ftdm_r2_io_iface = { - /* .open */ ftdm_r2_io_open, /* never called */ - /* .close */ ftdm_r2_io_close, /* never called */ - /* .set_cas */ ftdm_r2_io_set_cas, - /* .get_cas */ ftdm_r2_io_get_cas, - /* .flush_write_buffers */ ftdm_r2_io_flush_write_buffers, - /* .write */ ftdm_r2_io_write, - /* .read */ ftdm_r2_io_read, - /* .setup */ ftdm_r2_io_setup, /* never called */ - /* .wait */ ftdm_r2_io_wait, - /* .get_oob_event */ ftdm_r2_io_get_oob_event, - /* .get_alarm_state */ ftdm_r2_io_get_alarm_state -}; - -/* resolve a loglevel string, such as "debug,notice,warning", to an openr2 log level integer */ -static openr2_log_level_t ftdm_r2_loglevel_from_string(const char *level) -{ - openr2_log_level_t tmplevel; - openr2_log_level_t newlevel = 0; - char *clevel = NULL; - char *logval = NULL; - - logval = ftdm_malloc(strlen(level)+1); /* alloca man page scared me, so better to use good ol' malloc */ - if (!logval) { - ftdm_log(FTDM_LOG_WARNING, "Ignoring R2 logging parameter: '%s', failed to alloc memory\n", level); - return newlevel; - } - strcpy(logval, level); - while (logval) { - clevel = strsep(&logval, ","); - if (-1 == (tmplevel = openr2_log_get_level(clevel))) { - ftdm_log(FTDM_LOG_WARNING, "Ignoring invalid R2 logging level: '%s'\n", clevel); - continue; - } - newlevel |= tmplevel; - } - ftdm_safe_free(logval); - return newlevel; -} - -static ftdm_state_map_t r2_state_map = { - { - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - }, - - /* Outbound states */ - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END} - }, - } -}; - -static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) -{ - unsigned int i = 0; - int conf_failure = 0; - int intval = 0; - char schedname[255]; - const char *var = NULL, *val = NULL; - const char *log_level = "notice,warning,error"; /* default loglevel, if none is read from conf */ - ftdm_r2_data_t *r2data = NULL; - ftdm_r2_span_pvt_t *spanpvt = NULL; - ftdm_r2_call_t *r2call = NULL; - openr2_chan_t *r2chan = NULL; - unsigned paramindex = 0; - - ft_r2_conf_t r2conf = - { - /* .variant */ OR2_VAR_ITU, - /* .category */ OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER, - /* .loglevel */ OR2_LOG_ERROR | OR2_LOG_WARNING, -#ifdef WIN32 - /* .logdir */ (char *)"c:\\", -#else - /* .logdir */ (char *)"/tmp", -#endif - /* .advanced_protocol_file */ NULL, - /* .max_ani */ 10, - /* .max_dnis */ 4, - /* .mfback_timeout */ -1, - /* .metering_pulse_timeout */ -1, - /* .mf_dump_size */ 0, - /* .immediate_accept */ -1, - /* .skip_category */ -1, - /* .get_ani_first */ -1, - /* .call_files */ 0, - /* .double_answer */ -1, - /* .charge_calls */ -1, - /* .forced_release */ -1, - /* .allow_collect_calls */ -1, - /* .use_channel_native_mf_generation */ 0 - }; - - ftdm_assert_return(sig_cb != NULL, FTDM_FAIL, "No signaling cb provided\n"); - - if (span->signal_type) { - snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling."); - return FTDM_FAIL; - } - - for (; ftdm_parameters[paramindex].var; paramindex++) { - var = ftdm_parameters[paramindex].var; - val = ftdm_parameters[paramindex].val; - ftdm_log(FTDM_LOG_DEBUG, "Reading R2 parameter %s for span %d\n", var, span->span_id); - if (!strcasecmp(var, "variant")) { - if (!val) { - break; - } - if (ftdm_strlen_zero_buf(val)) { - ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 variant parameter\n"); - continue; - } - r2conf.variant = openr2_proto_get_variant(val); - if (r2conf.variant == OR2_VAR_UNKNOWN) { - ftdm_log(FTDM_LOG_ERROR, "Unknown R2 variant %s\n", val); - conf_failure = 1; - break; - } - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d for variant %s\n", span->span_id, val); - } else if (!strcasecmp(var, "category")) { - if (!val) { - break; - } - if (ftdm_strlen_zero_buf(val)) { - ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 category parameter\n"); - continue; - } - r2conf.category = openr2_proto_get_category(val); - if (r2conf.category == OR2_CALLING_PARTY_CATEGORY_UNKNOWN) { - ftdm_log(FTDM_LOG_ERROR, "Unknown R2 caller category %s\n", val); - conf_failure = 1; - break; - } - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with default category %s\n", span->span_id, val); - } else if (!strcasecmp(var, "logdir")) { - if (!val) { - break; - } - if (ftdm_strlen_zero_buf(val)) { - ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 logdir parameter\n"); - continue; - } - r2conf.logdir = (char *)val; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with logdir %s\n", span->span_id, val); - } else if (!strcasecmp(var, "logging")) { - if (!val) { - break; - } - if (ftdm_strlen_zero_buf(val)) { - ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 logging parameter\n"); - continue; - } - log_level = val; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with loglevel %s\n", span->name, val); - } else if (!strcasecmp(var, "advanced_protocol_file")) { - if (!val) { - break; - } - if (ftdm_strlen_zero_buf(val)) { - ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 advanced_protocol_file parameter\n"); - continue; - } - r2conf.advanced_protocol_file = (char *)val; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with advanced protocol file %s\n", span->name, val); - } else if (!strcasecmp(var, "mf_dump_size")) { - intval = atoi(val); - if (intval < 0) { - r2conf.mf_dump_size = FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with default mf_dump_size = %"FTDM_SIZE_FMT" bytes\n", span->name, r2conf.mf_dump_size); - } else { - r2conf.mf_dump_size = intval; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with mf_dump_size = %"FTDM_SIZE_FMT" bytes\n", span->name, r2conf.mf_dump_size); - } - } else if (!strcasecmp(var, "allow_collect_calls")) { - r2conf.allow_collect_calls = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with allow collect calls max ani = %d\n", span->name, r2conf.allow_collect_calls); - } else if (!strcasecmp(var, "double_answer")) { - r2conf.double_answer = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with double answer = %d\n", span->name, r2conf.double_answer); - } else if (!strcasecmp(var, "immediate_accept")) { - r2conf.immediate_accept = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with immediate accept = %d\n", span->name, r2conf.immediate_accept); - } else if (!strcasecmp(var, "skip_category")) { - r2conf.skip_category = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with skip category = %d\n", span->name, r2conf.skip_category); - } else if (!strcasecmp(var, "forced_release")) { - r2conf.forced_release = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with forced release = %d\n", span->name, r2conf.forced_release); - } else if (!strcasecmp(var, "charge_calls")) { - r2conf.charge_calls = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with charge calls = %d\n", span->name, r2conf.charge_calls); - } else if (!strcasecmp(var, "get_ani_first")) { - r2conf.get_ani_first = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with get ani first = %d\n", span->name, r2conf.get_ani_first); - } else if (!strcasecmp(var, "call_files")) { - r2conf.call_files = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with call files = %d\n", span->name, r2conf.call_files); - } else if (!strcasecmp(var, "mfback_timeout")) { - r2conf.mfback_timeout = atoi(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with MF backward timeout = %dms\n", span->name, r2conf.mfback_timeout); - } else if (!strcasecmp(var, "metering_pulse_timeout")) { - r2conf.metering_pulse_timeout = atoi(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with metering pulse timeout = %dms\n", span->name, r2conf.metering_pulse_timeout); - } else if (!strcasecmp(var, "max_ani")) { - r2conf.max_ani = atoi(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with max ani = %d\n", span->name, r2conf.max_ani); - } else if (!strcasecmp(var, "max_dnis")) { - r2conf.max_dnis = atoi(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with max dnis = %d\n", span->name, r2conf.max_dnis); - } else if (!strcasecmp(var, "use_channel_native_mf_generation")) { - r2conf.use_channel_native_mf_generation = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with \"use native channel MF generation\" = %d\n", span->name, r2conf.use_channel_native_mf_generation); - } else { - snprintf(span->last_error, sizeof(span->last_error), "Unknown R2 parameter [%s]", var); - return FTDM_FAIL; - } - } - - if (conf_failure) { - snprintf(span->last_error, sizeof(span->last_error), "R2 configuration error"); - return FTDM_FAIL; - } - - /* set span log level */ - r2conf.loglevel = ftdm_r2_loglevel_from_string(log_level); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with loglevel %s\n", span->span_id, log_level); - - r2data = ftdm_malloc(sizeof(*r2data)); - if (!r2data) { - snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate R2 data."); - return FTDM_FAIL; - } - memset(r2data, 0, sizeof(*r2data)); - - spanpvt = ftdm_malloc(sizeof(*spanpvt)); - if (!spanpvt) { - snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate private span data container."); - goto fail; - } - memset(spanpvt, 0, sizeof(*spanpvt)); - - r2data->r2context = openr2_context_new(r2conf.variant, &ftdm_r2_event_iface, r2conf.max_ani, r2conf.max_dnis); - if (!r2data->r2context) { - snprintf(span->last_error, sizeof(span->last_error), "Cannot create openr2 context for span."); - goto fail; - } - openr2_context_set_io_type(r2data->r2context, OR2_IO_CUSTOM, &ftdm_r2_io_iface); - openr2_context_set_log_level(r2data->r2context, r2conf.loglevel); - openr2_context_set_ani_first(r2data->r2context, r2conf.get_ani_first); - openr2_context_set_skip_category_request(r2data->r2context, r2conf.skip_category); - openr2_context_set_mf_back_timeout(r2data->r2context, r2conf.mfback_timeout); - openr2_context_set_metering_pulse_timeout(r2data->r2context, r2conf.metering_pulse_timeout); - openr2_context_set_double_answer(r2data->r2context, r2conf.double_answer); - openr2_context_set_immediate_accept(r2data->r2context, r2conf.immediate_accept); - - ftdm_log(FTDM_LOG_DEBUG, "Setting span %s logdir to %s\n", span->name, r2conf.logdir); - openr2_context_set_log_directory(r2data->r2context, r2conf.logdir); - snprintf(r2data->logdir, sizeof(r2data->logdir), "%s", r2conf.logdir); - - if (r2conf.advanced_protocol_file) { - openr2_context_configure_from_advanced_file(r2data->r2context, r2conf.advanced_protocol_file); - } - - if(r2conf.use_channel_native_mf_generation) { - openr2_context_set_mflib_interface(r2data->r2context, ftdm_r2_get_native_channel_mf_generation_iface()); - } - - spanpvt->r2calls = create_hashtable(FTDM_MAX_CHANNELS_SPAN, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - if (!spanpvt->r2calls) { - snprintf(span->last_error, sizeof(span->last_error), "Cannot create channel calls hash for span."); - goto fail; - } - - for (i = 1; (i <= span->chan_count) && (i <= FTDM_MAX_CHANNELS_SPAN); i++) { - r2chan = openr2_chan_new_from_fd(r2data->r2context, span->channels[i], span->channels[i]->chan_id); - if (!r2chan) { - snprintf(span->last_error, sizeof(span->last_error), "Cannot create all openr2 channels for span."); - goto fail; - } - openr2_chan_set_log_level(r2chan, r2conf.loglevel); - if (r2conf.call_files) { - openr2_chan_enable_call_files(r2chan); - } - - if (r2conf.use_channel_native_mf_generation) { - /* Allocate a new write handle per r2chan */ - ftdm_r2_mf_write_handle_t *mf_write_handle = ftdm_calloc(1, sizeof(*mf_write_handle)); - /* Associate to the FreeTDM channel */ - mf_write_handle->ftdmchan = span->channels[i]; - /* Make sure the FreeTDM channel supports MF the generation feature */ - if (!ftdm_channel_test_feature(mf_write_handle->ftdmchan, FTDM_CHANNEL_FEATURE_MF_GENERATE)) { - ftdm_log_chan_msg(mf_write_handle->ftdmchan, FTDM_LOG_ERROR, - "FreeTDM channel does not support native MF generation: " - "\"use_channel_native_mf_generation\" configuration parameter cannot" - " be used\n"); - goto fail; - } - /* Associate the mf_write_handle to the openR2 channel */ - openr2_chan_set_mflib_handles(r2chan, mf_write_handle, NULL); - } - - r2call = ftdm_calloc(1, sizeof(*r2call)); - if (!r2call) { - snprintf(span->last_error, sizeof(span->last_error), "Cannot create all R2 call data structures for the span."); - ftdm_safe_free(r2chan); - goto fail; - } - openr2_chan_set_logging_func(r2chan, ftdm_r2_on_chan_log); - openr2_chan_set_client_data(r2chan, span->channels[i]); - r2call->r2chan = r2chan; - span->channels[i]->call_data = r2call; - /* value and key are the same so just free one of them */ - snprintf(r2call->name, sizeof(r2call->name), "chancall%d", i); - hashtable_insert(spanpvt->r2calls, (void *)r2call->name, r2call, HASHTABLE_FLAG_FREE_VALUE); - } - r2data->mf_dump_size = r2conf.mf_dump_size; - r2data->category = r2conf.category; - r2data->allow_collect_calls = r2conf.allow_collect_calls; - r2data->flags = 0; - r2data->charge_calls = r2conf.charge_calls; - r2data->forced_release = r2conf.forced_release; - spanpvt->r2context = r2data->r2context; - - /* just the value must be freed by the hash */ - hashtable_insert(g_mod_data_hash, (void *)span->name, spanpvt, HASHTABLE_FLAG_FREE_VALUE); - - span->start = ftdm_r2_start; - span->stop = ftdm_r2_stop; - span->sig_read = NULL; - span->sig_write = NULL; - - span->signal_cb = sig_cb; - span->signal_type = FTDM_SIGTYPE_R2; - span->signal_data = r2data; - span->outgoing_call = r2_outgoing_call; - span->get_span_sig_status = ftdm_r2_get_span_sig_status; - span->set_span_sig_status = ftdm_r2_set_span_sig_status; - span->get_channel_sig_status = ftdm_r2_get_channel_sig_status; - span->set_channel_sig_status = ftdm_r2_set_channel_sig_status; - - span->state_map = &r2_state_map; - span->state_processor = ftdm_r2_state_advance; - - /* use signals queue */ - ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); - - /* we can skip states (going straight from RING to UP) */ - ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); - - /* setup the scheduler */ - snprintf(schedname, sizeof(schedname), "ftmod_r2_%s", span->name); - ftdm_assert(ftdm_sched_create(&r2data->sched, schedname) == FTDM_SUCCESS, "Failed to create schedule!\n"); - spanpvt->sched = r2data->sched; - - return FTDM_SUCCESS; - -fail: - - if (r2data && r2data->r2context) { - openr2_context_delete(r2data->r2context); - } - if (spanpvt && spanpvt->r2calls) { - hashtable_destroy(spanpvt->r2calls); - } - ftdm_safe_free(r2data); - ftdm_safe_free(spanpvt); - return FTDM_FAIL; - -} - -/* the channel must be locked when calling this function */ -static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) -{ - ftdm_sigmsg_t sigev; - ftdm_status_t ret; - ftdm_r2_call_t *r2call = R2CALL(ftdmchan); - openr2_chan_t *r2chan = r2call->r2chan; - ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; - - memset(&sigev, 0, sizeof(sigev)); - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - - ret = FTDM_SUCCESS; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); - - if (IS_ACCEPTING_PENDING(ftdmchan)) { - /* - Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call first, and accepting - the call in R2 means sending a tone, then waiting for the acknowledge from the other end, - since all of that requires sending and detecting tones, it takes a few milliseconds (I'd say around 100) - which means during that time the user should not try to perform any operations like answer, hangup or anything - else, therefore we DO NOT clear the FTDM_CHANNEL_STATE_CHANGE flag here, we rely on ftdm_io.c to block - the user thread until we're done with the accept (see on_call_accepted callback) and then we clear the state change flag, - otherwise we have a race condition between freetdm calling openr2_chan_answer_call and openr2 accepting the call first, - if freetdm calls openr2_chan_answer_call before the accept cycle completes, openr2 will fail to answer the call */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "State ack for state %s will have to wait a bit\n", ftdm_channel_state2str(ftdmchan->state)); - } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ - ftdm_channel_complete_state(ftdmchan); - } - - switch (ftdmchan->state) { - - /* starting an incoming call */ - case FTDM_CHANNEL_STATE_COLLECT: - { - uint32_t interval = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); - ftdm_assert(interval != 0, "Invalid interval!"); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of incoming call with interval %d\n", interval); - openr2_chan_enable_read(r2chan); - } - break; - - /* starting an outgoing call */ - case FTDM_CHANNEL_STATE_DIALING: - { - uint32_t interval = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); - ftdm_assert(interval != 0, "Invalid interval!"); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting outgoing call with interval %d\n", interval); - openr2_chan_enable_read(r2chan); - } - break; - - /* incoming call was offered */ - case FTDM_CHANNEL_STATE_RING: - - /* notify the user about the new call */ - sigev.event_id = FTDM_SIGEVENT_START; - ftdm_span_send_signal(ftdmchan->span, &sigev); - break; - - /* the call is making progress */ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!r2call->accepted) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Accepting call\n"); - ft_r2_accept_call(ftdmchan); - } - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); - sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } - } - break; - - /* the call was answered */ - case FTDM_CHANNEL_STATE_UP: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call was answered\n"); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!r2call->accepted) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call has not been accepted, need to accept first\n"); - // the answering will be done in the on_call_accepted handler - ft_r2_accept_call(ftdmchan); - r2call->answer_pending = 1; - } else { - ft_r2_answer_call(ftdmchan); - } - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying of call answered\n"); - sigev.event_id = FTDM_SIGEVENT_UP; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } - } - break; - - /* just got hangup */ - case FTDM_CHANNEL_STATE_HANGUP: - { - if (!r2call->disconnect_rcvd) { - openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); - /* overwrite the hangup cause if this is an incoming call and forced_release is set */ - if (openr2_chan_get_direction(r2chan) == OR2_DIR_BACKWARD && r2data->forced_release) { - disconnect_cause = OR2_CAUSE_FORCED_RELEASE; - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); - /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ - openr2_chan_disconnect_call(r2chan, disconnect_cause); - } else if (!r2call->protocol_error) { - /* just ack the hangup, on_call_end will be called by openr2 right after */ - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Clearing call due to protocol error\n"); - /* do not set to down yet, give some time for recovery */ - ftdm_sched_timer(r2data->sched, "protocolerr_recover", 100, - ftdm_r2_recover_from_protocol_error, r2chan, &r2call->protocol_error_recovery_timer); - } - } - break; - - case FTDM_CHANNEL_STATE_TERMINATING: - { - /* if the call has not been started yet we must go to HANGUP right here */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } else { - openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); - /* notify the user of the call terminating and we wait for the user to move us to hangup */ - sigev.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } - } - break; - - /* finished call for good */ - case FTDM_CHANNEL_STATE_DOWN: - { - if (ftdmchan->last_state != FTDM_CHANNEL_STATE_RESET) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Reset Complete\n"); - } - ret = FTDM_BREAK; - } - break; - - /* INDICATE_RINGING doesn't apply to MFC/R2. maybe we could generate a tone */ - case FTDM_CHANNEL_STATE_RINGING: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RINGING indicated, ignoring it as it doesn't apply to MFC/R2\n"); - } - break; - - /* put the r2 channel back to IDLE, close ftdmchan and set it's state as DOWN */ - case FTDM_CHANNEL_STATE_RESET: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RESET indicated, putting the R2 channel back to IDLE\n"); - openr2_chan_set_idle(r2chan); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - break; - - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); - } - break; - } - - if (ret == FTDM_BREAK) { - ftdm_channel_t *closed_chan; - closed_chan = ftdmchan; - ftdm_channel_close(&closed_chan); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "State processing ended.\n"); - } - return ret; -} - -static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) -{ - openr2_chan_t *r2chan = NULL; - ftdm_channel_t *ftdmchan = NULL; - ftdm_r2_call_t *call = NULL; - ftdm_status_t status; - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_r2_data_t *r2data = span->signal_data; - int waitms = 20; - unsigned int i; - int res, ms; - int index = 0; - struct timeval start, end; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *citer = NULL; - uint32_t txqueue_size = 4; - short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); - - /* as long as this thread is running, this flag is set */ - ftdm_set_flag(r2data, FTDM_R2_RUNNING); - -#ifdef __linux__ - r2data->monitor_thread_id = syscall(SYS_gettid); -#endif - - ftdm_log(FTDM_LOG_DEBUG, "OpenR2 monitor thread %u started.\n", r2data->monitor_thread_id); - r2chan = NULL; - chaniter = ftdm_span_get_chan_iterator(span, NULL); - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - goto done; - } - for (i = 1, citer = chaniter; citer; citer = ftdm_iterator_next(citer), i++) { - ftdmchan = ftdm_iterator_current(citer); - ftdm_channel_lock(ftdmchan); - r2chan = R2CALL(ftdmchan)->r2chan; - openr2_chan_set_span_id(r2chan, span->span_id); - openr2_chan_set_idle(r2chan); - openr2_chan_process_cas_signaling(r2chan); - ftdm_channel_unlock(ftdmchan); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &txqueue_size); - } - - memset(&start, 0, sizeof(start)); - memset(&end, 0, sizeof(end)); - while (ftdm_running() && ftdm_test_flag(r2data, FTDM_R2_SPAN_STARTED)) { - res = gettimeofday(&end, NULL); - if (res) { - ftdm_log(FTDM_LOG_CRIT, "Failure gettimeofday [%s]\n", strerror(errno)); - } - if (start.tv_sec) { - ms = ((end.tv_sec - start.tv_sec) * 1000) - + ((( 1000000 + end.tv_usec - start.tv_usec) / 1000) - 1000); - if (ms < 0) { - ms = 0; - } - if (ms > r2data->jobmax) { - r2data->jobmax = ms; - } - index = (ms / 10); - index = (index > 10) ? 10 : index; - r2data->loops[index]++; - r2data->total_loops++; - } - - /* run any span timers */ - ftdm_sched_run(r2data->sched); - - /* deliver the actual channel events to the user now without any channel locking */ - ftdm_span_trigger_signals(span); - - /* figure out what event to poll each channel for. POLLPRI when the channel is down, - * POLLPRI|POLLIN|POLLOUT otherwise */ - memset(poll_events, 0, sizeof(short)*span->chan_count); - citer = ftdm_span_get_chan_iterator(span, chaniter); - if (!citer) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - goto done; - } - for (i = 0; citer; citer = ftdm_iterator_next(citer), i++) { - ftdmchan = ftdm_iterator_current(citer); - r2chan = R2CALL(ftdmchan)->r2chan; - poll_events[i] = FTDM_EVENTS; - if (openr2_chan_get_read_enabled(r2chan)) { - poll_events[i] |= FTDM_READ; - } - } - status = ftdm_span_poll_event(span, waitms, poll_events); - - /* run any span timers */ - ftdm_sched_run(r2data->sched); - - res = gettimeofday(&start, NULL); - if (res) { - ftdm_log(FTDM_LOG_CRIT, "Failure gettimeofday [%s]\n", strerror(errno)); - } - - if (FTDM_FAIL == status) { - ftdm_log(FTDM_LOG_CRIT, "Failure waiting I/O! [%s]\n", span->channels[1]->last_error); - continue; - } - - ms = ((start.tv_sec - end.tv_sec) * 1000) - + ((( 1000000 + start.tv_usec - end.tv_usec) / 1000) - 1000); - if (ms < 0) { - ms = 0; - } - if (ms > r2data->sleepmax) { - r2data->sleepmax = ms; - } - index = (ms / 15); - index = (index > 10) ? 10 : index; - r2data->sleeps[index]++; - r2data->total_sleeps++; - - /* this main loop takes care of MF and CAS signaling during call setup and tear down - * for every single channel in the span, do not perform blocking operations here! */ - citer = ftdm_span_get_chan_iterator(span, chaniter); - for ( ; citer; citer = ftdm_iterator_next(citer)) { - ftdmchan = ftdm_iterator_current(citer); - - ftdm_channel_lock(ftdmchan); - - call = R2CALL(ftdmchan); - - /* This let knows the core and io signaling hooks know that - * read/writes come from us and should be allowed */ - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED); - - ftdm_channel_advance_states(ftdmchan); - - r2chan = call->r2chan; - openr2_chan_process_signaling(r2chan); - - ftdm_channel_advance_states(ftdmchan); - - if (!call->accepted) { - /* if the call is not accepted we do not want users reading */ - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED); - } - - ftdm_channel_unlock(ftdmchan); - } - } - -done: - citer = ftdm_span_get_chan_iterator(span, chaniter); - for ( ; citer; citer = ftdm_iterator_next(citer)) { - ftdmchan = ftdm_iterator_current(citer); - ftdm_channel_lock(ftdmchan); - r2chan = R2CALL(ftdmchan)->r2chan; - openr2_chan_set_blocked(r2chan); - ftdm_channel_unlock(ftdmchan); - } - - ftdm_iterator_free(chaniter); - ftdm_safe_free(poll_events); - - ftdm_clear_flag(r2data, FTDM_R2_RUNNING); - ftdm_log(FTDM_LOG_DEBUG, "R2 thread ending.\n"); - - return NULL; -} - -static void __inline__ block_channel(ftdm_channel_t *fchan, ftdm_stream_handle_t *stream) -{ - openr2_chan_t *r2chan = R2CALL(fchan)->r2chan; - ftdm_mutex_lock(fchan->mutex); - if (fchan->state != FTDM_CHANNEL_STATE_DOWN) { - stream->write_function(stream, "cannot block channel %d:%d because has a call in progress\n", - fchan->span_id, fchan->chan_id); - } else { - if (!openr2_chan_set_blocked(r2chan)) { - ftdm_set_flag(fchan, FTDM_CHANNEL_SUSPENDED); - stream->write_function(stream, "blocked channel %d:%d\n", - fchan->span_id, fchan->chan_id); - } else { - stream->write_function(stream, "failed to block channel %d:%d\n", - fchan->span_id, fchan->chan_id); - } - } - ftdm_mutex_unlock(fchan->mutex); -} - -static void __inline__ unblock_channel(ftdm_channel_t *fchan, ftdm_stream_handle_t *stream) -{ - openr2_chan_t *r2chan = R2CALL(fchan)->r2chan; - ftdm_mutex_lock(fchan->mutex); - if (!openr2_chan_set_idle(r2chan)) { - ftdm_clear_flag(fchan, FTDM_CHANNEL_SUSPENDED); - stream->write_function(stream, "unblocked channel %d:%d\n", - fchan->span_id, fchan->chan_id); - } else { - stream->write_function(stream, "failed to unblock channel %d:%d\n", - fchan->span_id, fchan->chan_id); - } - ftdm_mutex_unlock(fchan->mutex); -} - -#define FT_SYNTAX "USAGE:\n" \ -"--------------------------------------------------------------------------------\n" \ -"ftdm r2 status \n" \ -"ftdm r2 loopstats \n" \ -"ftdm r2 block|unblock []\n" \ -"ftdm r2 version\n" \ -"ftdm r2 variants\n" \ -"--------------------------------------------------------------------------------\n" -static FIO_API_FUNCTION(ftdm_r2_api) -{ - ftdm_span_t *span = NULL; - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - int span_id = 0; - unsigned int chan_id = 0; - unsigned int i = 0; - ftdm_r2_data_t *r2data = NULL; - openr2_chan_t *r2chan = NULL; - openr2_context_t *r2context = NULL; - openr2_variant_t r2variant; - - if (data) { - mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - if (argc >= 2) { - if (!strcasecmp(argv[0], "block")) { - int span_id = atoi(argv[1]); - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - - if (span->start != ftdm_r2_start) { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - - if (argc > 2) { - chan_id = atoi(argv[2]); - if (chan_id && chan_id <= span->chan_count) { - block_channel(span->channels[chan_id], stream); - } else { - stream->write_function(stream, "-ERR invalid chan %d.\n", chan_id); - } - } else { - for (i = 1; i <= span->chan_count; i++) { - block_channel(span->channels[i], stream); - } - } - stream->write_function(stream, "+OK blocked.\n"); - goto done; - } else { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - } - - if (!strcasecmp(argv[0], "unblock")) { - span_id = atoi(argv[1]); - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - - if (span->start != ftdm_r2_start) { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - - if (argc > 2) { - chan_id = atoi(argv[2]); - if (chan_id && chan_id <= span->chan_count) { - unblock_channel(span->channels[chan_id], stream); - } else { - stream->write_function(stream, "-ERR invalid chan %d.\n", chan_id); - } - } else { - for (i = 1; i <= span->chan_count; i++) { - unblock_channel(span->channels[i], stream); - } - } - - stream->write_function(stream, "+OK.\n"); - goto done; - } else { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - - } - - if (!strcasecmp(argv[0], "status")) { - //openr2_chan_stats_t stats; - span_id = atoi(argv[1]); - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - if (span->start != ftdm_r2_start) { - stream->write_function(stream, "-ERR not an R2 span.\n"); - goto done; - } - if (!(r2data = span->signal_data)) { - stream->write_function(stream, "-ERR invalid span. No R2 signal data in span.\n"); - goto done; - } - r2context = r2data->r2context; - r2variant = openr2_context_get_variant(r2context); - stream->write_function(stream, - "Variant: %s\n" - "Max ANI: %d\n" - "Max DNIS: %d\n" - "ANI First: %s\n" - "Immediate Accept: %s\n" - "Job Thread: %u\n" - "Job Max ms: %d\n" - "Job Loops: %lu\n", - openr2_proto_get_variant_string(r2variant), - openr2_context_get_max_ani(r2context), - openr2_context_get_max_dnis(r2context), - openr2_context_get_ani_first(r2context) ? "Yes" : "No", - openr2_context_get_immediate_accept(r2context) ? "Yes" : "No", - r2data->monitor_thread_id, - r2data->jobmax, - r2data->total_loops); - stream->write_function(stream, "\n"); - stream->write_function(stream, "%4s %-12.12s %-12.12s\n", "Channel", "Tx CAS", "Rx CAS"); - for (i = 1; i <= span->chan_count; i++) { - r2chan = R2CALL(span->channels[i])->r2chan; - stream->write_function(stream, "%4d %-12.12s %-12.12s\n", - span->channels[i]->chan_id, - openr2_chan_get_tx_cas_string(r2chan), - openr2_chan_get_rx_cas_string(r2chan)); - } - stream->write_function(stream, "\n"); - stream->write_function(stream, "+OK.\n"); - goto done; - } else { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - } - - if (!strcasecmp(argv[0], "loopstats")) { - int range; - float pct; - span_id = atoi(argv[1]); - - if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - if (span->start != ftdm_r2_start) { - stream->write_function(stream, "-ERR not an R2 span.\n"); - goto done; - } - if (!(r2data = span->signal_data)) { - stream->write_function(stream, "-ERR invalid span. No R2 signal data in span.\n"); - goto done; - } - stream->write_function(stream, "-- Working --\n"); - stream->write_function(stream, "Total loops: %llu\n", r2data->total_loops); - range = 0; - for (i = 0; i < ftdm_array_len(r2data->loops); i++) { - pct = 100*(float)r2data->loops[i]/r2data->total_loops; - if ((i + 1) == ftdm_array_len(r2data->loops)) { - stream->write_function(stream, ">= %dms: %llu - %.03lf%%\n", range, r2data->loops[i], pct); - } else { - stream->write_function(stream, "%d-%dms: %llu - %.03lf%%\n", range, range + 9, r2data->loops[i], pct); - } - range += 10; - } - stream->write_function(stream, "\n"); - - stream->write_function(stream, "-- Sleeping --\n"); - stream->write_function(stream, "Total sleeps: %llu\n", r2data->total_sleeps); - range = 0; - for (i = 0; i < ftdm_array_len(r2data->sleeps); i++) { - pct = 100*(float)r2data->sleeps[i]/r2data->total_sleeps; - if ((i + 1) == ftdm_array_len(r2data->sleeps)) { - stream->write_function(stream, ">= %dms: %llu - %.03lf%%\n", range, r2data->sleeps[i], pct); - } else { - stream->write_function(stream, "%d-%dms: %llu - %.03lf%%\n", range, range + 14, r2data->sleeps[i], pct); - } - range += 15; - } - stream->write_function(stream, "\n"); - - stream->write_function(stream, "+OK.\n"); - goto done; - } else { - stream->write_function(stream, "-ERR invalid span.\n"); - goto done; - } - } - - } - - if (argc == 1) { - if (!strcasecmp(argv[0], "version")) { - stream->write_function(stream, "OpenR2 version: %s, revision: %s\n", openr2_get_version(), openr2_get_revision()); - stream->write_function(stream, "+OK.\n"); - goto done; - } - - if (!strcasecmp(argv[0], "variants")) { - int32_t numvariants = 0; - const openr2_variant_entry_t *variants = openr2_proto_get_variant_list(&numvariants); - if (!variants) { - stream->write_function(stream, "-ERR failed to retrieve openr2 variant list.\n"); - goto done; - } -#define VARIANT_FORMAT "%4s %40s\n" - stream->write_function(stream, VARIANT_FORMAT, "Variant Code", "Country"); - numvariants--; - for (; numvariants; numvariants--) { - stream->write_function(stream, VARIANT_FORMAT, variants[numvariants].name, variants[numvariants].country); - } - stream->write_function(stream, "+OK.\n"); -#undef VARIANT_FORMAT - goto done; - } - } - - stream->write_function(stream, "%s", FT_SYNTAX); - -done: - - ftdm_safe_free(mycmd); - - return FTDM_SUCCESS; - -} - -static FIO_IO_LOAD_FUNCTION(ftdm_r2_io_init) -{ - assert(fio != NULL); - memset(&g_ftdm_r2_interface, 0, sizeof(g_ftdm_r2_interface)); - - g_ftdm_r2_interface.name = "r2"; - g_ftdm_r2_interface.api = ftdm_r2_api; - - *fio = &g_ftdm_r2_interface; - - return FTDM_SUCCESS; -} - -static FIO_SIG_LOAD_FUNCTION(ftdm_r2_init) -{ - g_mod_data_hash = create_hashtable(10, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - if (!g_mod_data_hash) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -static FIO_SIG_UNLOAD_FUNCTION(ftdm_r2_destroy) -{ - ftdm_hash_iterator_t *i = NULL; - ftdm_r2_span_pvt_t *spanpvt = NULL; - const void *key = NULL; - void *val = NULL; - for (i = hashtable_first(g_mod_data_hash); i; i = hashtable_next(i)) { - hashtable_this(i, &key, NULL, &val); - if (key && val) { - spanpvt = val; - openr2_context_delete(spanpvt->r2context); - hashtable_destroy(spanpvt->r2calls); - ftdm_sched_destroy(&spanpvt->sched); - } - } - hashtable_destroy(g_mod_data_hash); - return FTDM_SUCCESS; -} - -EX_DECLARE_DATA ftdm_module_t ftdm_module = { - /* .name */ "r2", - /* .io_load */ ftdm_r2_io_init, - /* .io_unload */ NULL, - /* .sig_load */ ftdm_r2_init, - /* .sig_configure */ NULL, - /* .sig_unload */ ftdm_r2_destroy, - /* .configure_span_signaling */ ftdm_r2_configure_span_signaling -}; - - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.c deleted file mode 100755 index 0b17885ba9..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2011 Sebastien Trottier - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include - -#include - -#include "ftmod_r2_io_mf_lib.h" - -/* Convert openr2 MF tone enum value to FreeTDM MF tone value - 1-15 bitwise OR FTDM_MF_DIRECTION_FORWARD/BACKWARD - 0 (stop playing) - openr2_mf_tone_t defined in r2proto.h -*/ -static int ftdm_r2_openr2_mf_tone_to_ftdm_mf_tone(openr2_mf_tone_t - openr2_tone_value, int forward_signals) -{ - int tone; - - switch (openr2_tone_value) { - case 0: return 0; -#define TONE_FROM_NAME(name) case OR2_MF_TONE_##name: tone = name; break; - TONE_FROM_NAME(1) - TONE_FROM_NAME(2) - TONE_FROM_NAME(3) - TONE_FROM_NAME(4) - TONE_FROM_NAME(5) - TONE_FROM_NAME(6) - TONE_FROM_NAME(7) - TONE_FROM_NAME(8) - TONE_FROM_NAME(9) - TONE_FROM_NAME(10) - TONE_FROM_NAME(11) - TONE_FROM_NAME(12) - TONE_FROM_NAME(13) - TONE_FROM_NAME(14) - TONE_FROM_NAME(15) -#undef TONE_FROM_NAME - default: - ftdm_assert(0, "Invalid openr2_tone_value\n"); - return -1; - } - - /* Add flag corresponding to direction */ - if (forward_signals) { - tone |= FTDM_MF_DIRECTION_FORWARD; - } else { - tone |= FTDM_MF_DIRECTION_BACKWARD; - } - - return tone; -} - -/* MF generation routines (using IO command of a FreeTDM channel) - write_init stores the direction of the MF to generate */ -static void *ftdm_r2_io_mf_write_init(ftdm_r2_mf_write_handle_t *handle, int forward_signals) -{ - ftdm_log_chan(handle->ftdmchan, FTDM_LOG_DEBUG, "ftdm_r2_io_mf_write_init, " - "forward = %d\n", forward_signals); - - handle->fwd = forward_signals; - return handle; -} - -static int ftdm_r2_io_mf_generate_tone(ftdm_r2_mf_write_handle_t *handle, int16_t buffer[], int samples) -{ - /* Our mf_want_generate implementation always return 0, so mf_generate_tone should never be called */ - ftdm_assert(0, "ftdm_r2_io_mf_generate_tone not implemented\n"); - return 0; -} - -/* \brief mf_select_tone starts tone generation or stops current tone - * \return 0 on success, -1 on error - */ -static int ftdm_r2_io_mf_select_tone(ftdm_r2_mf_write_handle_t *handle, char signal) -{ - int tone; /* (0, 1-15) (0 meaning to stop playing) */ - - ftdm_log_chan(handle->ftdmchan, FTDM_LOG_DEBUG, "ftdm_r2_io_mf_select_tone, " - "signal = %c\n", signal); - - if (-1 == (tone = ftdm_r2_openr2_mf_tone_to_ftdm_mf_tone(signal, handle->fwd))) { - return -1; - } - - /* Start/stop playback directly here, as select tone is called each time a tone - is started or stopped (called if tone changes, but silence is tone 0, - triggering a tone change) */ - if (tone > 0) { - ftdm_channel_command(handle->ftdmchan, FTDM_COMMAND_START_MF_PLAYBACK, &tone); - } else { - /* tone 0 means to stop current tone */ - ftdm_channel_command(handle->ftdmchan, FTDM_COMMAND_STOP_MF_PLAYBACK, NULL); - } - return 0; -} - -static int ftdm_r2_io_mf_want_generate(ftdm_r2_mf_write_handle_t *handle, int signal) -{ - /* Return 0, meaning mf_generate_tone doesn't need to be called */ - return 0; -} - -/* MF lib interface that generate MF tones via FreeTDM channel IO commands - MF detection using the default openr2 provider (r2engine) */ -static openr2_mflib_interface_t g_mf_ftdm_io_iface = { - /* .mf_read_init */ (openr2_mf_read_init_func)openr2_mf_rx_init, - /* .mf_write_init */ (openr2_mf_write_init_func)ftdm_r2_io_mf_write_init, - /* .mf_detect_tone */ (openr2_mf_detect_tone_func)openr2_mf_rx, - /* .mf_generate_tone */ (openr2_mf_generate_tone_func)ftdm_r2_io_mf_generate_tone, - /* .mf_select_tone */ (openr2_mf_select_tone_func)ftdm_r2_io_mf_select_tone, - /* .mf_want_generate */ (openr2_mf_want_generate_func)ftdm_r2_io_mf_want_generate, - /* .mf_read_dispose */ NULL, - /* .mf_write_dispose */ NULL -}; - -openr2_mflib_interface_t *ftdm_r2_get_native_channel_mf_generation_iface() -{ - return &g_mf_ftdm_io_iface; -} - -/* 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/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.h b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.h deleted file mode 100755 index cf3c171c3d..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Sebastien Trottier - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef _FTMOD_R2_IO_MFLIB_H_ -#define _FTMOD_R2_IO_MFLIB_H_ - -#include - -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -/* MFC/R2 tone generator handle (mf_write_handle) */ -typedef struct { - /*! FTDM channel performing the MF generation */ - ftdm_channel_t *ftdmchan; - /*! 1 if generating forward tones, otherwise generating reverse tones. */ - int fwd; -} ftdm_r2_mf_write_handle_t; - -/* MF lib interface that generate MF tones via FreeTDM channel IO commands - MF detection using the default openr2 provider (r2engine) */ -openr2_mflib_interface_t *ftdm_r2_get_native_channel_mf_generation_iface(void); - -#if defined(__cplusplus) -} /* endif extern "C" */ -#endif - -#endif /* endif defined _FTMOD_R2_IO_MFLIB_H_ */ - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj deleted file mode 100644 index f6263907e1..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj.filters deleted file mode 100644 index 5f592fa9ef..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj.filters +++ /dev/null @@ -1,57 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c deleted file mode 100644 index ed0a99dc95..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ /dev/null @@ -1,1563 +0,0 @@ - -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include "ftmod_sangoma_isdn.h" - -#ifdef FTDM_DEBUG_CHAN_MEMORY -#include -#endif - -static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj); -static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span); -static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span); -static ftdm_status_t ftdm_sangoma_isdn_dtmf(ftdm_channel_t *ftdmchan, const char* dtmf); - -ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); -static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event); -static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); -static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); -static void ftdm_sangoma_isdn_wakeup_phy(ftdm_channel_t *dchan); -static void ftdm_sangoma_isdn_dchan_set_queue_size(ftdm_channel_t *ftdmchan); - -static ftdm_io_interface_t g_sngisdn_io_interface; -static sng_isdn_event_interface_t g_sngisdn_event_interface; - -ftdm_sngisdn_data_t g_sngisdn_data; - -SNGISDN_ENUM_NAMES(SNGISDN_TRANSFER_TYPE_NAMES, SNGISDN_TRANSFER_TYPE_STRINGS) -SNGISDN_STR2ENUM(ftdm_str2sngisdn_transfer_type, sngisdn_transfer_type2str, sngisdn_transfer_type_t, SNGISDN_TRANSFER_TYPE_NAMES, SNGISDN_TRANSFER_INVALID) - -ftdm_state_map_t sangoma_isdn_state_map = { - { - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_DIALING, - FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_GET_CALLERID, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_GET_CALLERID, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_TRANSFER, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TRANSFER, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - }, - - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TRANSFER, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_TERMINATING,FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_ANY, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_DIALING, - FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, - FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - } - } -}; - -static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - sngisdn_snd_event(signal_data, event); - - switch (event) { - /* Check if the span woke up from power-saving mode */ - case FTDM_OOB_ALARM_CLEAR: - if (FTDM_SPAN_IS_BRI(span)) { - ftdm_channel_t *ftdmchan; - sngisdn_chan_data_t *sngisdn_info; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); - sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; - - if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)) { - ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); - - ftdm_sched_timer(signal_data->sched, "delayed_setup", 1000, sngisdn_delayed_setup, (void*) ftdmchan->call_data, NULL); - } - } - ftdm_iterator_free(chaniter); - } - break; - default: - /* Ignore other events for now */ - break; - } -} - -static void ftdm_sangoma_isdn_dchan_set_queue_size(ftdm_channel_t *dchan) -{ - ftdm_status_t ret_status; - uint32_t queue_size; - - queue_size = SNGISDN_DCHAN_QUEUE_LEN; - ret_status = ftdm_channel_command(dchan, FTDM_COMMAND_SET_RX_QUEUE_SIZE, &queue_size); - ftdm_assert(ret_status == FTDM_SUCCESS, "Failed to set Rx Queue size"); - - queue_size = SNGISDN_DCHAN_QUEUE_LEN; - ret_status = ftdm_channel_command(dchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &queue_size); - ftdm_assert(ret_status == FTDM_SUCCESS, "Failed to set Tx Queue size"); - - RETVOID; -} - -static void ftdm_sangoma_isdn_wakeup_phy(ftdm_channel_t *dchan) -{ - ftdm_status_t ret_status; - ftdm_channel_hw_link_status_t status = FTDM_HW_LINK_CONNECTED; - ret_status = ftdm_channel_command(dchan, FTDM_COMMAND_SET_LINK_STATUS, &status); - if (ret_status != FTDM_SUCCESS) { - ftdm_log_chan_msg(dchan, FTDM_LOG_WARNING, "Failed to wake-up link\n"); - } - return; -} - -static void *ftdm_sangoma_isdn_io_run(ftdm_thread_t *me, void *obj) -{ - uint8_t data[8192]; - unsigned i = 0; - ftdm_status_t status = FTDM_SUCCESS; - ftdm_span_t *span = (ftdm_span_t*) obj; - ftdm_size_t len = 0; - ftdm_channel_t *ftdmchan = NULL; - unsigned waitms = 10000; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *citer = NULL; - ftdm_event_t *event; - short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); - - /* Initialize the d-channel */ - chaniter = ftdm_span_get_chan_iterator(span, NULL); - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - goto done; - } - - while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { - len = 1000; - waitms = 1000; - memset(poll_events, 0, sizeof(short)*span->chan_count); - - for (i = 0, citer = ftdm_span_get_chan_iterator(span, chaniter); citer; citer = ftdm_iterator_next(citer), i++) { - ftdmchan = ftdm_iterator_current(citer); - - poll_events[i] |= FTDM_EVENTS; - if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED)) { - poll_events[i] |= FTDM_READ; - waitms = 20; - } - } else { - /* We always read the d-channel */ - poll_events[i] |= FTDM_READ; - } - } - - status = ftdm_span_poll_event(span, waitms, poll_events); - switch (status) { - case FTDM_FAIL: - ftdm_log(FTDM_LOG_CRIT, "Failed to poll span for IO\n"); - break; - case FTDM_TIMEOUT: - break; - case FTDM_SUCCESS: - /* Check if there are any channels that have data available */ - for (citer = ftdm_span_get_chan_iterator(span, chaniter); citer; citer = ftdm_iterator_next(citer)) { - len = sizeof(data); - ftdmchan = ftdm_iterator_current(citer); - if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED)) { - if (ftdm_test_io_flag(ftdmchan, FTDM_CHANNEL_IO_READ)) { - status = ftdm_raw_read(ftdmchan, data, &len); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "raw I/O read failed\n"); - continue; - } - - status = ftdm_channel_process_media(ftdmchan, data, &len); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to process media\n"); - continue; - } - } - } - } else { - if (ftdm_test_io_flag(ftdmchan, FTDM_CHANNEL_IO_READ)) { - status = ftdm_channel_read(ftdmchan, data, &len); - if (status == FTDM_SUCCESS) { - sngisdn_snd_data(ftdmchan, data, len); - } - } - } - } - - /* Check if there are any channels that have events available */ - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { - ftdm_sangoma_isdn_process_phy_events(span, event->enum_id); - } - - break; - default: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Unhandled IO event\n"); - } - } -done: - ftdm_iterator_free(chaniter); - ftdm_safe_free(poll_events); - return NULL; -} - -static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) -{ - ftdm_interrupt_t *ftdm_sangoma_isdn_int[3]; - ftdm_status_t ret_status; - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_channel_t *ftdmchan = NULL; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - sngisdn_event_data_t *sngisdn_event = NULL; - int32_t sleep = SNGISDN_EVENT_POLL_RATE; - - ftdm_log(FTDM_LOG_INFO, "ftmod_sangoma_isdn monitor thread for span=%u started.\n", span->span_id); - - /* set IN_THREAD flag so that we know this thread is running */ - ftdm_set_flag(span, FTDM_SPAN_IN_THREAD); - - /* get an interrupt queue for this span */ - if (ftdm_queue_get_interrupt(span->pendingchans, &ftdm_sangoma_isdn_int[0]) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to get a ftdm_interrupt for span = %s!\n", span->name); - goto ftdm_sangoma_isdn_run_exit; - } - - if (ftdm_queue_get_interrupt(span->pendingsignals, &ftdm_sangoma_isdn_int[1]) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to get a signal interrupt for span = %s!\n", span->name); - goto ftdm_sangoma_isdn_run_exit; - } - - if (ftdm_queue_get_interrupt(signal_data->event_queue, &ftdm_sangoma_isdn_int[2]) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to get a event interrupt for span = %s!\n", span->name); - goto ftdm_sangoma_isdn_run_exit; - } - - while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { - /* Check if there are any timers to process */ - ftdm_sched_run(signal_data->sched); - ftdm_span_trigger_signals(span); - - if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { - if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { - sleep = SNGISDN_EVENT_POLL_RATE; - } - } - ret_status = ftdm_interrupt_multiple_wait(ftdm_sangoma_isdn_int, 3, sleep); - /* find out why we returned from the interrupt queue */ - switch (ret_status) { - case FTDM_SUCCESS: /* there was a state change on the span */ - /* process all pending state changes */ - while ((ftdmchan = ftdm_queue_dequeue(span->pendingchans))) { - /* double check that this channel has a state change pending */ - ftdm_channel_lock(ftdmchan); - ftdm_channel_advance_states(ftdmchan); - ftdm_channel_unlock(ftdmchan); - } - - while ((sngisdn_event = ftdm_queue_dequeue(signal_data->event_queue))) { - ftdm_sangoma_isdn_process_stack_event(span, sngisdn_event); - ftdm_safe_free(sngisdn_event); - } - break; - case FTDM_TIMEOUT: - /* twiddle */ - break; - case FTDM_FAIL: - ftdm_log(FTDM_LOG_ERROR, "%s: ftdm_interrupt_wait returned error!\n", span->name); - break; - - default: - ftdm_log(FTDM_LOG_ERROR, "%s: ftdm_interrupt_wait returned with unknown code\n", span->name); - break; - } - } - - /* clear the IN_THREAD flag so that we know the thread is done */ - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - - ftdm_log(FTDM_LOG_INFO, "ftmod_sangoma_isdn monitor thread for span %s stopping.\n", span->name); - - return NULL; - -ftdm_sangoma_isdn_run_exit: - - /* clear the IN_THREAD flag so that we know the thread is done */ - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - - ftdm_log(FTDM_LOG_INFO, "ftmod_sangoma_isdn monitor thread for span %s stopping due to error.\n", span->name); - - return NULL; -} - - -/** - * \brief Checks if span has state changes pending and processes - * \param span Span where event was fired - * \param sngisdn_event Event to handle - * \return The locked FTDM channel associated to the event if any, NULL otherwise - */ - -ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event) -{ - ftdm_channel_t *ftdmchan = NULL; - switch (sngisdn_event->event_id) { - /* Events that do not have a channel associated to them */ - case SNGISDN_EVENT_SRV_IND: - case SNGISDN_EVENT_SRV_CFM: - case SNGISDN_EVENT_RST_CFM: - case SNGISDN_EVENT_RST_IND: - return NULL; - break; - case SNGISDN_EVENT_CON_IND: - case SNGISDN_EVENT_CON_CFM: - case SNGISDN_EVENT_CNST_IND: - case SNGISDN_EVENT_DISC_IND: - case SNGISDN_EVENT_REL_IND: - case SNGISDN_EVENT_DAT_IND: - case SNGISDN_EVENT_SSHL_IND: - case SNGISDN_EVENT_SSHL_CFM: - case SNGISDN_EVENT_RMRT_IND: - case SNGISDN_EVENT_RMRT_CFM: - case SNGISDN_EVENT_FLC_IND: - case SNGISDN_EVENT_FAC_IND: - case SNGISDN_EVENT_STA_CFM: - ftdmchan = sngisdn_event->sngisdn_info->ftdmchan; - ftdm_assert_return(ftdmchan, NULL,"Event should have a channel associated\n"); - break; - } - ftdm_channel_lock(ftdmchan); - ftdm_channel_advance_states(ftdmchan); - return ftdmchan; -} - - - -static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event) -{ - ftdm_channel_t *ftdmchan = NULL; - - ftdmchan = ftdm_sangoma_isdn_process_event_states(span, sngisdn_event); - switch(sngisdn_event->event_id) { - case SNGISDN_EVENT_CON_IND: - sngisdn_process_con_ind(sngisdn_event); - break; - case SNGISDN_EVENT_CON_CFM: - sngisdn_process_con_cfm(sngisdn_event); - break; - case SNGISDN_EVENT_CNST_IND: - sngisdn_process_cnst_ind(sngisdn_event); - break; - case SNGISDN_EVENT_DISC_IND: - sngisdn_process_disc_ind(sngisdn_event); - break; - case SNGISDN_EVENT_REL_IND: - sngisdn_process_rel_ind(sngisdn_event); - break; - case SNGISDN_EVENT_DAT_IND: - sngisdn_process_dat_ind(sngisdn_event); - break; - case SNGISDN_EVENT_SSHL_IND: - sngisdn_process_sshl_ind(sngisdn_event); - break; - case SNGISDN_EVENT_SSHL_CFM: - sngisdn_process_sshl_cfm(sngisdn_event); - break; - case SNGISDN_EVENT_RMRT_IND: - sngisdn_process_rmrt_ind(sngisdn_event); - break; - case SNGISDN_EVENT_RMRT_CFM: - sngisdn_process_rmrt_cfm(sngisdn_event); - break; - case SNGISDN_EVENT_FLC_IND: - sngisdn_process_flc_ind(sngisdn_event); - break; - case SNGISDN_EVENT_FAC_IND: - sngisdn_process_fac_ind(sngisdn_event); - break; - case SNGISDN_EVENT_STA_CFM: - sngisdn_process_sta_cfm(sngisdn_event); - break; - case SNGISDN_EVENT_SRV_IND: - sngisdn_process_srv_ind(sngisdn_event); - break; - case SNGISDN_EVENT_SRV_CFM: - sngisdn_process_srv_cfm(sngisdn_event); - break; - case SNGISDN_EVENT_RST_CFM: - sngisdn_process_rst_cfm(sngisdn_event); - break; - case SNGISDN_EVENT_RST_IND: - sngisdn_process_rst_ind(sngisdn_event); - break; - } - if (ftdmchan != NULL) { - ftdm_channel_advance_states(ftdmchan); - ftdm_channel_unlock(ftdmchan); - } -} - -/* this function is called with the channel already locked by the core */ -static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) -{ - ftdm_sigmsg_t sigev; - ftdm_channel_state_t initial_state; - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - uint8_t state_change = 0; - - memset(&sigev, 0, sizeof(sigev)); - - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - -#ifdef FTDM_DEBUG_CHAN_MEMORY - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { - ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ) == 0, "Failed to mprotect"); - } -#endif - - /* Only needed for debugging */ - initial_state = ftdmchan->state; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "processing state change to %s\n", ftdm_channel_state2str(ftdmchan->state)); - - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_COLLECT: /* SETUP received but waiting on digits */ - { - /* TODO: Re-implement this. There is a way to re-evaluate new incoming digits from dialplan as they come */ - sngisdn_snd_setup_ack(ftdmchan); - /* Just wait in this state until we get enough digits or T302 timeout */ - } - break; - case FTDM_CHANNEL_STATE_GET_CALLERID: - { - /* By default, we do not send a progress indicator in the proceed */ - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID}; - sngisdn_snd_proceed(ftdmchan, prog_ind); - - /* Wait in this state until we get FACILITY msg */ - } - break; - case FTDM_CHANNEL_STATE_RING: /* incoming call request */ - { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending incoming call from %s to %s to FTDM core\n", ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.dnis.digits); - - /* we have enough information to inform FTDM of the call*/ - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_START); - } - break; - case FTDM_CHANNEL_STATE_DIALING: /* outgoing call request */ - { - if (FTDM_SPAN_IS_BRI(ftdmchan->span) && ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) { - ftdm_signaling_status_t sigstatus; - ftdm_span_get_sig_status(ftdmchan->span, &sigstatus); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) { - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)ftdmchan->span->signal_data; - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Physical Line activation\n"); - sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING); - ftdm_sangoma_isdn_wakeup_phy(ftdmchan); - ftdm_sched_timer(signal_data->sched, "timer_t3", signal_data->timer_t3*1000, sngisdn_t3_timeout, (void*) sngisdn_info, NULL); - } else if (sigstatus == FTDM_SIG_STATE_DOWN) { - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)ftdmchan->span->signal_data; - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Q.921 Line activation\n"); - sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING); - sngisdn_snd_dl_req(ftdmchan); - ftdm_sched_timer(signal_data->sched, "timer_t3", signal_data->timer_t3*1000, sngisdn_t3_timeout, (void*) sngisdn_info, NULL); - } else { - sngisdn_snd_setup(ftdmchan); - } - } else { - sngisdn_snd_setup(ftdmchan); - } - } - break; - case FTDM_CHANNEL_STATE_PROCEED: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /*OUTBOUND...so we were told by the line of this so noifiy the user*/ - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROCEED); - - if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { - state_change++; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } - } else { - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID}; - sngisdn_snd_proceed(ftdmchan, prog_ind); - } - } - break; - case FTDM_CHANNEL_STATE_RINGING: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /* OUTBOUND...so we were told by the line of this so notify the user */ - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_RINGING); - - if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { - state_change++; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } - } else { - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; - sngisdn_snd_alert(ftdmchan, prog_ind); - } - } - break; - case FTDM_CHANNEL_STATE_PROGRESS: - { - /*check if the channel is inbound or outbound*/ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /*OUTBOUND...so we were told by the line of this so noifiy the user*/ - - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROGRESS); - } else { - /* Send a progress message, indicating: Call is not end-to-end ISDN, further call progress may be available */ - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; - sngisdn_snd_progress(ftdmchan, prog_ind); - } - } - break; - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROGRESS_MEDIA); - } else { - /* Send a progress message, indicating: In-band information/pattern available */ - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_IB_AVAIL}; - sngisdn_snd_progress(ftdmchan, prog_ind); - } - } - break; - case FTDM_CHANNEL_STATE_UP: /* call is answered */ - { - /* check if the channel is inbound or outbound */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /* OUTBOUND ... so we were told by the line that the other side answered */ - - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_UP); - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && - ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->signalling == SNGISDN_SIGNALING_NET) { - /* Assign the call to a specific equipment */ - sngisdn_snd_con_complete(ftdmchan); - } - } else { - /* INBOUND ... so FS told us it just answered ... tell the stack */ - sngisdn_snd_connect(ftdmchan); - } - } - break; - case FTDM_CHANNEL_STATE_CANCEL: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Hanging up call before informing user!\n"); - - /* Send a release complete */ - sngisdn_snd_release(ftdmchan, 0); - /*now go to the HANGUP complete state*/ - state_change++; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - } - break; - case FTDM_CHANNEL_STATE_TERMINATING: /* call is hung up by the remote end */ - { - /* this state is set when the line is hanging up */ - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_STOP); - } - break; - case FTDM_CHANNEL_STATE_HANGUP: /* call is hung up locally */ - { - if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Acknowledging remote abort\n"); - } else if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_REL)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Acknowledging remote hangup\n"); - sngisdn_snd_release(ftdmchan, 0); - } else if (sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) { - /* We aborted this call before sending anything to the stack, so nothing to do anymore */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Clearing local states from local abort\n"); - } else if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE)) { - /* We are hangup local call because there was a glare, we are waiting for a - RELEASE on this call, before we can process the saved call */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Waiting for RELEASE on hungup glared call\n"); - } else if (sngisdn_test_flag(sngisdn_info, FLAG_SEND_DISC)) { - /* Remote side sent a PROGRESS message, but cause indicates disconnect or T310 expired*/ - sngisdn_snd_disconnect(ftdmchan); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Hanging up call upon local request!\n"); - - /* set the flag to indicate this hangup is started from the local side */ - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL); - - switch(ftdmchan->last_state) { - case FTDM_CHANNEL_STATE_RING: - /* If we never sent PROCEED/ALERT/PROGRESS/CONNECT on an incoming call, we need to send release instead of disconnect */ - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - sngisdn_snd_release(ftdmchan, 0); - break; - case FTDM_CHANNEL_STATE_DIALING: - /* If we never received a PROCEED/ALERT/PROGRESS/CONNECT on an outgoing call, we need to send release instead of disconnect */ - sngisdn_snd_release(ftdmchan, 0); - break; - case FTDM_CHANNEL_STATE_PROCEED: - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (((sngisdn_span_data_t*)(ftdmchan->span->signal_data))->switchtype == SNGISDN_SWITCH_4ESS || - ((sngisdn_span_data_t*)(ftdmchan->span->signal_data))->switchtype == SNGISDN_SWITCH_5ESS) { - - /* When using 5ESS, if the user wants to clear an inbound call, the correct procedure is to send a PROGRESS with in-band info available, and play tones. Then send a DISCONNECT. If we reached this point, it means user did not try to play-tones, so send a RELEASE because remote side does not expect DISCONNECT in state 3 */ - sngisdn_snd_release(ftdmchan, 0); - break; - } - } - /* fall-through */ - default: - sngisdn_snd_disconnect(ftdmchan); - break; - } - } - /* now go to the HANGUP complete state */ - state_change++; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - } - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - { - if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT) || - sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) { - /* If the remote side aborted, we will not get anymore message for this call */ - state_change++; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - /* waiting on remote confirmation before moving to down */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Waiting for release from stack\n"); - } - } - break; - case FTDM_CHANNEL_STATE_DOWN: /* the call is finished and removed */ - { - uint8_t glare = sngisdn_test_flag(sngisdn_info, FLAG_GLARE); - /* clear all of the call specific data store in the channel structure */ - clear_call_data(sngisdn_info); - - /* Close the channel even if we had a glare, we will re-open it when processing state COLLECT for the - "glared call" */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_t *close_chan = ftdmchan; - /* close the channel */ - ftdm_channel_close(&close_chan); - } - if (glare) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Glare detected, processing saved call\n"); - /* We are calling sngisdn_rcv_con_ind with ftdmchan->mutex being locked, - so no other threads will be able to touch this channel. The next time we will - process this channel is in this function, and it should be in state COLLECT (set inside - sngisdn_rcv_con_ind)*/ - sngisdn_rcv_con_ind(sngisdn_info->glare.suId, sngisdn_info->glare.suInstId, sngisdn_info->glare.spInstId, &sngisdn_info->glare.setup, sngisdn_info->glare.dChan, sngisdn_info->glare.ces); - } - } - break; - case FTDM_CHANNEL_STATE_TRANSFER: - { - /* sngisdn_transfer function will always result in a state change */ - sngisdn_transfer(ftdmchan); - state_change++; - } - break; - case FTDM_CHANNEL_STATE_RESTART: - { - /* IMPLEMENT ME */ - } - break; - case FTDM_CHANNEL_STATE_SUSPENDED: - { - /* IMPLEMENT ME */ - } - break; - case FTDM_CHANNEL_STATE_RESET: - { - sngisdn_snd_restart(ftdmchan); - } - break; - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "unsupported sngisdn_rcvd state %s\n", ftdm_channel_state2str(ftdmchan->state)); - } - break; - } - - if (!state_change) { - /* Acknowledge the state change */ - ftdm_channel_complete_state(ftdmchan); - } - - /* If sngisdn_info->variables is not NULL, it means did not send any - * sigevent to the user, therefore we have to free that hashtable */ - if (sngisdn_info->variables) { - hashtable_destroy(sngisdn_info->variables); - sngisdn_info->variables = NULL; - } - - /* If sngisdn_info->raw_data is not NULL, it means did not send any - * sigevent to the user, therefore we have to free that raw data */ - if (sngisdn_info->raw_data) { - ftdm_safe_free(sngisdn_info->raw_data); - sngisdn_info->raw_data = NULL; - sngisdn_info->raw_data_len = 0; - } - - if (ftdmchan->state == initial_state) { - ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "state change flag is still set, but we did not change state\n"); - } -#ifdef FTDM_DEBUG_CHAN_MEMORY - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { - ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ|PROT_WRITE) == 0, "Failed to mprotect"); - } -#endif - return FTDM_SUCCESS; -} - -static FIO_CHANNEL_INDICATE_FUNCTION(ftdm_sangoma_isdn_indicate) -{ - ftdm_status_t status = FTDM_FAIL; - - switch (indication) { - case FTDM_CHANNEL_INDICATE_FACILITY: - sngisdn_snd_fac_req(ftdmchan); - status = FTDM_SUCCESS; - break; - default: - status = FTDM_NOTIMPL; - } - return status; -} - -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call) -{ - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - ftdm_status_t status = FTDM_FAIL; - - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { - if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE)) { - /* A call came in after we called ftdm_channel_open_chan for this call, but before we got here */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Glare detected - aborting outgoing call\n"); - - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - - status = FTDM_BREAK; - } else { - status = FTDM_SUCCESS; - } - } else { - /* the channel is already used...this can't be, end the request */ - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Outgoing call requested channel in already in use (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - status = FTDM_BREAK; - } - - return status; -} -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_chan_sig_status) -{ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - *status = FTDM_SIG_STATE_UP; - } else { - *status = FTDM_SIG_STATE_DOWN; - } - - return FTDM_SUCCESS; -} - -static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_chan_sig_status) -{ - ftdm_log(FTDM_LOG_ERROR,"Cannot set channel status in this module\n"); - return FTDM_NOTIMPL; -} - -static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_span_sig_status) -{ - if (ftdm_test_flag(span->channels[1], FTDM_CHANNEL_SIG_UP)) { - *status = FTDM_SIG_STATE_UP; - } else { - *status = FTDM_SIG_STATE_DOWN; - } - - return FTDM_SUCCESS; -} - -static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_span_sig_status) -{ - ftdm_log(FTDM_LOG_ERROR,"Cannot set span status in this module\n"); - return FTDM_NOTIMPL; -} - -static ftdm_status_t ftdm_sangoma_isdn_dtmf(ftdm_channel_t *ftdmchan, const char* dtmf) -{ - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - switch(sngisdn_info->transfer_data.type) { - case SNGISDN_TRANSFER_ATT_COURTESY_VRU: - case SNGISDN_TRANSFER_ATT_COURTESY_VRU_DATA: - return sngisdn_att_transfer_process_dtmf(ftdmchan, dtmf); - default: - /* We do not care about DTMF events, do nothing */ - break; - } - - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_sangoma_isdn_perform_start(ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = span->signal_data; - - ftdm_log(FTDM_LOG_DEBUG, "Actually starting span:%s\n", span->name); - /* clear the monitor thread stop flag */ - ftdm_clear_flag(span, FTDM_SPAN_STOP_THREAD); - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - - if (signal_data->trace_q921 == SNGISDN_OPT_TRUE || - signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) { - - sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); - } - - if (signal_data->trace_q931 == SNGISDN_OPT_TRUE || - signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) { - - sngisdn_activate_trace(span, SNGISDN_TRACE_Q931); - } - - /*start the span monitor thread*/ - if (ftdm_thread_create_detached(ftdm_sangoma_isdn_run, span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT,"Failed to start Sangoma ISDN Span Monitor Thread!\n"); - return FTDM_FAIL; - } - - /*start the dchan monitor thread*/ - if (ftdm_thread_create_detached(ftdm_sangoma_isdn_io_run, span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT,"Failed to start Sangoma ISDN d-channel Monitor Thread!\n"); - return FTDM_FAIL; - } - - if (signal_data->restart_timeout) { - ftdm_log(FTDM_LOG_DEBUG, "%s:Scheduling Restart timeout\n", signal_data->ftdm_span->name); - ftdm_sched_timer(signal_data->sched, "restart_timeout", signal_data->restart_timeout, - sngisdn_restart_timeout, (void*) signal_data, &signal_data->timers[SNGISDN_SPAN_TIMER_RESTART]); - } - - ftdm_log(FTDM_LOG_DEBUG,"Finished starting span %s\n", span->name); - return FTDM_SUCCESS; -} - - -static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = span->signal_data; - - ftdm_log(FTDM_LOG_INFO,"Starting span %s:%u.\n",span->name,span->span_id); - - if (signal_data->dchan) { - ftdm_channel_set_feature(signal_data->dchan, FTDM_CHANNEL_FEATURE_IO_STATS); - ftdm_channel_open_chan(signal_data->dchan); - ftdm_sangoma_isdn_dchan_set_queue_size(signal_data->dchan); - } - - if (signal_data->nfas.trunk) { - if (signal_data->nfas.trunk->num_spans == signal_data->nfas.trunk->num_spans_configured) { - int i; - ftdm_log(FTDM_LOG_DEBUG, "Starting span for all spans within trunkgroup:%s\n", signal_data->nfas.trunk->name); - - sngisdn_stack_start(signal_data->nfas.trunk->dchan->ftdm_span); - ftdm_sangoma_isdn_perform_start(signal_data->nfas.trunk->dchan->ftdm_span); - - if (signal_data->nfas.trunk->backup) { - sngisdn_stack_start(signal_data->nfas.trunk->backup->ftdm_span); - ftdm_sangoma_isdn_perform_start(signal_data->nfas.trunk->backup->ftdm_span); - } - - for (i = 0; i < signal_data->nfas.trunk->num_spans; i++) { - if (signal_data->nfas.trunk->spans[i] && - signal_data->nfas.trunk->spans[i]->nfas.sigchan == SNGISDN_NFAS_DCHAN_NONE) { - sngisdn_stack_start(signal_data->nfas.trunk->spans[i]->ftdm_span); - ftdm_sangoma_isdn_perform_start(signal_data->nfas.trunk->spans[i]->ftdm_span); - } - } - - return FTDM_SUCCESS; - } else { - ftdm_log(FTDM_LOG_DEBUG, "Delaying span start until all spans within trunkgroup are started: %s\n", signal_data->nfas.trunk->name); - return FTDM_SUCCESS; - } - } - - if (sngisdn_stack_start(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to start span %s\n", span->name); - return FTDM_FAIL; - } - - ftdm_sangoma_isdn_perform_start(span); - - return FTDM_SUCCESS; -} - -static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span) -{ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - unsigned i; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - ftdm_log(FTDM_LOG_INFO, "Stopping span %s\n", span->name); - - /* throw the STOP_THREAD flag to signal monitor thread stop */ - ftdm_set_flag(span, FTDM_SPAN_STOP_THREAD); - - /* wait for the thread to stop */ - while (ftdm_test_flag(span, FTDM_SPAN_IN_THREAD)) { - ftdm_log(FTDM_LOG_DEBUG, "Waiting for monitor thread to end for span %s\n", span->name); - ftdm_sleep(10); - } - - if (sngisdn_stack_stop(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to stop span %s\n", span->name); - } - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_safe_free(((ftdm_channel_t*)ftdm_iterator_current(curr))->call_data); - ((ftdm_channel_t*)ftdm_iterator_current(curr))->call_data = NULL; - } - ftdm_iterator_free(chaniter); - - ftdm_sched_destroy(&signal_data->sched); - ftdm_queue_destroy(&signal_data->event_queue); - for (i = 0 ; i < signal_data->num_local_numbers ; i++) { - if (signal_data->local_numbers[i] != NULL) { - ftdm_safe_free(signal_data->local_numbers[i]); - } - } - ftdm_safe_free(span->signal_data); - - ftdm_log(FTDM_LOG_DEBUG, "Finished stopping span %s\n", span->name); - - return FTDM_SUCCESS; -} - -static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) -{ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - sngisdn_span_data_t *signal_data; - - ftdm_log(FTDM_LOG_INFO, "Configuring ftmod_sangoma_isdn span = %s\n", span->name); - - signal_data = ftdm_calloc(1, sizeof(sngisdn_span_data_t)); - signal_data->ftdm_span = span; - span->signal_data = signal_data; - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - sngisdn_chan_data_t *chan_data = ftdm_calloc(1, sizeof(sngisdn_chan_data_t)); - chan_data->ftdmchan = ((ftdm_channel_t*)ftdm_iterator_current(curr)); - ((ftdm_channel_t*)ftdm_iterator_current(curr))->call_data = chan_data; - - } - ftdm_iterator_free(chaniter); - - if (ftmod_isdn_parse_cfg(ftdm_parameters, span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to parse configuration\n"); - return FTDM_FAIL; - } - - if (signal_data->nfas.trunk) { - if (signal_data->nfas.trunk->num_spans == ++signal_data->nfas.trunk->num_spans_configured) { - int i; - ftdm_log(FTDM_LOG_DEBUG, "Starting stack configuration for all spans within trunkgroup:%s\n", signal_data->nfas.trunk->name); - - sngisdn_stack_cfg(signal_data->nfas.trunk->dchan->ftdm_span); - if (signal_data->nfas.trunk->backup) { - sngisdn_stack_cfg(signal_data->nfas.trunk->backup->ftdm_span); - } - - for (i = 0; i < signal_data->nfas.trunk->num_spans; i++) { - if (signal_data->nfas.trunk->spans[i] && - signal_data->nfas.trunk->spans[i]->nfas.sigchan == SNGISDN_NFAS_DCHAN_NONE) { - sngisdn_stack_cfg(signal_data->nfas.trunk->spans[i]->ftdm_span); - } - } - } else { - ftdm_log(FTDM_LOG_DEBUG, "Delaying span stack configuration until all spans within trunkgroup are started:%s\n", signal_data->nfas.trunk->name); - } - } else if (sngisdn_stack_cfg(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Sangoma ISDN Stack configuration failed\n"); - return FTDM_FAIL; - } - - if (signal_data->cid_name_method == SNGISDN_CID_NAME_AUTO) { - switch (signal_data->switchtype) { - case SNGISDN_SWITCH_EUROISDN: - if (FTDM_SPAN_IS_BRI(span)) { - signal_data->cid_name_method = SNGISDN_CID_NAME_USR_USR_IE; - } else { - signal_data->cid_name_method = SNGISDN_CID_NAME_DISPLAY_IE; - } - break; - case SNGISDN_SWITCH_DMS100: - signal_data->cid_name_method = SNGISDN_CID_NAME_DISPLAY_IE; - break; - case SNGISDN_SWITCH_NI2: - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_4ESS: - signal_data->cid_name_method = SNGISDN_CID_NAME_FACILITY_IE; - break; - default: - break; - } - } - - if (signal_data->send_cid_name == SNGISDN_OPT_DEFAULT) { - switch (signal_data->switchtype) { - case SNGISDN_SWITCH_EUROISDN: -#ifdef SNGISDN_SUPPORT_CALLING_NAME_IN_FACILITY - case SNGISDN_SWITCH_NI2: - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_4ESS: -#endif - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - signal_data->send_cid_name = SNGISDN_OPT_TRUE; - } else { - signal_data->send_cid_name = SNGISDN_OPT_FALSE; - } - break; - case SNGISDN_SWITCH_DMS100: - signal_data->send_cid_name = SNGISDN_OPT_TRUE; - break; -#ifndef SNGISDN_SUPPORT_CALLING_NAME_IN_FACILITY - case SNGISDN_SWITCH_NI2: - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_4ESS: - signal_data->send_cid_name = SNGISDN_OPT_FALSE; - break; -#endif - default: - signal_data->send_cid_name = SNGISDN_OPT_FALSE; - break; - } - } else if (signal_data->send_cid_name == SNGISDN_OPT_TRUE) { - switch (signal_data->switchtype) { - case SNGISDN_SWITCH_NI2: - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_4ESS: -#ifndef SNGISDN_SUPPORT_CALLING_NAME_IN_FACILITY - ftdm_log(FTDM_LOG_WARNING, "Sending Calling Name in Facility IE not supported, please update your libsng_isdn library\n"); - signal_data->send_cid_name = SNGISDN_OPT_FALSE; -#endif - break; - case SNGISDN_SWITCH_INSNET: /* Don't know how to transmit caller ID name on INSNET */ - case SNGISDN_SWITCH_QSIG: /* It seems like QSIG does not support Caller ID */ - signal_data->send_cid_name = SNGISDN_OPT_FALSE; - break; - case SNGISDN_SWITCH_EUROISDN: - break; - default: - signal_data->send_cid_name = SNGISDN_OPT_FALSE; - break; - } - } - - span->start = ftdm_sangoma_isdn_start; - span->stop = ftdm_sangoma_isdn_stop; - span->signal_type = FTDM_SIGTYPE_ISDN; - span->outgoing_call = ftdm_sangoma_isdn_outgoing_call; - span->indicate = ftdm_sangoma_isdn_indicate; - span->channel_request = NULL; - span->signal_cb = sig_cb; - span->sig_queue_dtmf = ftdm_sangoma_isdn_dtmf; - span->get_channel_sig_status = ftdm_sangoma_isdn_get_chan_sig_status; - span->set_channel_sig_status = ftdm_sangoma_isdn_set_chan_sig_status; - span->get_span_sig_status = ftdm_sangoma_isdn_get_span_sig_status; - span->set_span_sig_status = ftdm_sangoma_isdn_set_span_sig_status; - span->state_map = &sangoma_isdn_state_map; - span->state_processor = ftdm_sangoma_isdn_process_state_change; - ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); - ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); - ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); - ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); - ftdm_set_flag(span, FTDM_SPAN_NON_STOPPABLE); - ftdm_set_flag(span, FTDM_SPAN_USE_TRANSFER); - - if (FTDM_SPAN_IS_BRI(span)) { - sngisdn_set_span_avail_rate(span, SNGISDN_AVAIL_PWR_SAVING); - } - - /* Initialize scheduling context */ - ftdm_assert(ftdm_sched_create(&((sngisdn_span_data_t*)span->signal_data)->sched, "sngisdn_schedule") == FTDM_SUCCESS, "Failed to create a new schedule!!"); - - /* Initialize the event queue */ - ftdm_assert(ftdm_queue_create(&((sngisdn_span_data_t*)span->signal_data)->event_queue, SNGISDN_EVENT_QUEUE_SIZE) == FTDM_SUCCESS, "Failed to create a new queue!!"); - - ftdm_log(FTDM_LOG_INFO, "Finished configuring ftmod_sangoma_isdn span = %s\n", span->name); - return FTDM_SUCCESS; -} - -static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) -{ - unsigned i; - ftdm_log(FTDM_LOG_INFO, "Loading ftmod_sangoma_isdn...\n"); - - memset(&g_sngisdn_data, 0, sizeof(g_sngisdn_data)); - memset(&g_sngisdn_event_interface, 0, sizeof(g_sngisdn_event_interface)); - /* set callbacks */ - g_sngisdn_event_interface.cc.sng_con_ind = sngisdn_rcv_con_ind; - g_sngisdn_event_interface.cc.sng_con_cfm = sngisdn_rcv_con_cfm; - g_sngisdn_event_interface.cc.sng_cnst_ind = sngisdn_rcv_cnst_ind; - g_sngisdn_event_interface.cc.sng_disc_ind = sngisdn_rcv_disc_ind; - g_sngisdn_event_interface.cc.sng_rel_ind = sngisdn_rcv_rel_ind; - g_sngisdn_event_interface.cc.sng_dat_ind = sngisdn_rcv_dat_ind; - g_sngisdn_event_interface.cc.sng_sshl_ind = sngisdn_rcv_sshl_ind; - g_sngisdn_event_interface.cc.sng_sshl_cfm = sngisdn_rcv_sshl_cfm; - g_sngisdn_event_interface.cc.sng_rmrt_ind = sngisdn_rcv_rmrt_ind; - g_sngisdn_event_interface.cc.sng_rmrt_cfm = sngisdn_rcv_rmrt_cfm; - g_sngisdn_event_interface.cc.sng_flc_ind = sngisdn_rcv_flc_ind; - g_sngisdn_event_interface.cc.sng_fac_ind = sngisdn_rcv_fac_ind; - g_sngisdn_event_interface.cc.sng_sta_cfm = sngisdn_rcv_sta_cfm; - g_sngisdn_event_interface.cc.sng_srv_ind = sngisdn_rcv_srv_ind; - g_sngisdn_event_interface.cc.sng_srv_cfm = sngisdn_rcv_srv_cfm; - g_sngisdn_event_interface.cc.sng_rst_ind = sngisdn_rcv_rst_ind; - g_sngisdn_event_interface.cc.sng_rst_cfm = sngisdn_rcv_rst_cfm; - - g_sngisdn_event_interface.lg.sng_log = sngisdn_rcv_sng_log; - g_sngisdn_event_interface.lg.sng_assert = sngisdn_rcv_sng_assert; - - g_sngisdn_event_interface.sta.sng_phy_sta_ind = sngisdn_rcv_phy_ind; - g_sngisdn_event_interface.sta.sng_q921_sta_ind = sngisdn_rcv_q921_ind; - g_sngisdn_event_interface.sta.sng_q921_trc_ind = sngisdn_rcv_q921_trace; - g_sngisdn_event_interface.sta.sng_q931_sta_ind = sngisdn_rcv_q931_ind; - g_sngisdn_event_interface.sta.sng_q931_trc_ind = sngisdn_rcv_q931_trace; - g_sngisdn_event_interface.sta.sng_cc_sta_ind = sngisdn_rcv_cc_ind; - - g_sngisdn_event_interface.io.sng_l1_data_req = sngisdn_rcv_l1_data_req; - g_sngisdn_event_interface.io.sng_l1_cmd_req = sngisdn_rcv_l1_cmd_req; - - for(i=1;i<=MAX_VARIANTS;i++) { - ftdm_mutex_create(&g_sngisdn_data.ccs[i].mutex); - } - - /* initalize sng_isdn library */ - ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n"); - - /* Load Stack General Configuration */ - sngisdn_start_gen_cfg(); - - return FTDM_SUCCESS; -} - -static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_isdn_unload) -{ - unsigned i; - ftdm_log(FTDM_LOG_INFO, "Starting ftmod_sangoma_isdn unload...\n"); - - sng_isdn_free(); - - for(i=1;i<=MAX_VARIANTS;i++) { - ftdm_mutex_destroy(&g_sngisdn_data.ccs[i].mutex); - } - - ftdm_log(FTDM_LOG_INFO, "Finished ftmod_sangoma_isdn unload!\n"); - return FTDM_SUCCESS; -} - -#define SANGOMA_ISDN_API_USAGE_TRACE "ftdm sangoma_isdn trace \n" -#define SANGOMA_ISDN_API_USAGE_SHOW_L1_STATS "ftdm sangoma_isdn l1_stats \n" -#define SANGOMA_ISDN_API_USAGE_SHOW_SPANS "ftdm sangoma_isdn show_spans []\n" - -#define SANGOMA_ISDN_API_USAGE "\t"SANGOMA_ISDN_API_USAGE_TRACE \ - "\t"SANGOMA_ISDN_API_USAGE_SHOW_L1_STATS \ - "\t"SANGOMA_ISDN_API_USAGE_SHOW_SPANS - -static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) -{ - ftdm_status_t status = FTDM_EINVAL; - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - - if (data) { - mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - /*ftdm_log(FTDM_LOG_DEBUG, "Sangoma argc:%d argv[0]:%s argv[1]:%s argv[2]:%s \n", argc, argv[0], argv[1], argv[2]);*/ - if (argc <= 0) { - ftdm_log(FTDM_LOG_ERROR, "No parameters provided\n"); - goto done; - } - - /* TODO: Move functions to table + function pointers */ - if (!strcasecmp(argv[0], "trace")) { - char *trace_opt; - - ftdm_span_t *span; - - if (argc < 3) { - ftdm_log(FTDM_LOG_ERROR, "Usage: %s\n", SANGOMA_ISDN_API_USAGE_TRACE); - status = FTDM_FAIL; - goto done; - } - trace_opt = argv[1]; - - status = ftdm_span_find_by_name(argv[2], &span); - if (FTDM_SUCCESS != status) { - stream->write_function(stream, "-ERR failed to find span by name %s\n", argv[2]); - - status = FTDM_FAIL; - goto done; - } - - if (!strcasecmp(trace_opt, "q921")) { - status = sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); - } else if (!strcasecmp(trace_opt, "q931")) { - status = sngisdn_activate_trace(span, SNGISDN_TRACE_Q931); - } else if (!strcasecmp(trace_opt, "disable")) { - status = sngisdn_activate_trace(span, SNGISDN_TRACE_DISABLE); - } else { - stream->write_function(stream, "-ERR invalid trace option \n"); - status = FTDM_FAIL; - } - goto done; - } - - if (!strcasecmp(argv[0], "l1_stats")) { - ftdm_span_t *span; - if (argc < 2) { - stream->write_function(stream, "Usage: %s\n", SANGOMA_ISDN_API_USAGE_SHOW_L1_STATS); - status = FTDM_FAIL; - goto done; - } - status = ftdm_span_find_by_name(argv[1], &span); - if (FTDM_SUCCESS != status) { - stream->write_function(stream, "-ERR failed to find span with name %s\n", argv[1]); - - status = FTDM_FAIL; - goto done; - } - status = sngisdn_show_l1_stats(stream, span); - goto done; - } - - if (!strcasecmp(argv[0], "show_spans")) { - ftdm_span_t *span = NULL; - if (argc == 2) { - status = ftdm_span_find_by_name(argv[1], &span); - if (FTDM_SUCCESS != status) { - stream->write_function(stream, "-ERR failed to find span with name %s\n", argv[1]); - - stream->write_function(stream, "Usage: %s\n", SANGOMA_ISDN_API_USAGE_SHOW_SPANS); - status = FTDM_FAIL; - goto done; - } - status = sngisdn_show_span(stream, span); - goto done; - } - status = sngisdn_show_spans(stream); - goto done; - } - - if (!strcasecmp(argv[0], "check_ids")) { - status = sngisdn_check_free_ids(); - goto done; - } - if (!strcasecmp(argv[0], "check_mem")) { - sngisdn_get_memory_info(); - } -done: - switch (status) { - case FTDM_SUCCESS: - stream->write_function(stream, "Command executed OK\n"); - break; - case FTDM_EINVAL: - stream->write_function(stream, "Invalid arguments [%s]\n", mycmd); - stream->write_function(stream, "Usage:\n%s\n", SANGOMA_ISDN_API_USAGE); - break; - default: - /* FTDM_FAIL - Do nothing since we already printed the cause of the error */ - break; - } - - /* Return SUCCESS because we do not want to print the general FTDM usage list */ - status = FTDM_SUCCESS; - - ftdm_safe_free(mycmd); - return status; -} - - -static FIO_IO_LOAD_FUNCTION(ftdm_sangoma_isdn_io_init) -{ - memset(&g_sngisdn_io_interface, 0, sizeof(g_sngisdn_io_interface)); - - g_sngisdn_io_interface.name = "sangoma_isdn"; - g_sngisdn_io_interface.api = ftdm_sangoma_isdn_api; - - *fio = &g_sngisdn_io_interface; - - return FTDM_SUCCESS; -} - -EX_DECLARE_DATA ftdm_module_t ftdm_module = -{ - "sangoma_isdn", /* char name[256]; */ - ftdm_sangoma_isdn_io_init, /* fio_io_load_t */ - NULL, /* fio_io_unload_t */ - ftdm_sangoma_isdn_init, /* fio_sig_load_t */ - NULL, /* fio_sig_configure_t */ - ftdm_sangoma_isdn_unload, /* fio_sig_unload_t */ - ftdm_sangoma_isdn_span_config /* fio_configure_span_signaling_t */ -}; - - -/* 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/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h deleted file mode 100644 index 64c1a20999..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ /dev/null @@ -1,613 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef __FTMOD_SNG_ISDN_H__ -#define __FTMOD_SNG_ISDN_H__ - -#include -#include -#include -#ifdef HAVE_STDINT_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#include - -#include "private/ftdm_core.h" -#include "ftmod_sangoma_isdn_user.h" - -#ifdef WIN32 -#include -#else -#include -#endif - -/* Theoretical limit for MAX_SPANS_PER_NFAS_LINK is 31, - but set to 8 for now to save some memory */ - -#define MAX_SPANS_PER_NFAS_LINK 16 -#define MAX_NFAS_GROUPS 16 -#define NUM_E1_CHANNELS_PER_SPAN 32 -#define NUM_T1_CHANNELS_PER_SPAN 24 -#define NUM_BRI_CHANNELS_PER_SPAN 2 -#define SNGISDN_EVENT_QUEUE_SIZE 100 -#define SNGISDN_EVENT_POLL_RATE 100 -#define SNGISDN_NUM_LOCAL_NUMBERS 8 -#define SNGISDN_DCHAN_QUEUE_LEN 200 -#define MAX_NFAS_GROUP_NAME 50 - -#define NSG - -#ifndef MI_NOTIFY -#define MI_NOTIFY 0x14 -#endif - -typedef enum { - FLAG_RESET_RX = (1 << 0), - FLAG_RESET_TX = (1 << 1), - FLAG_REMOTE_REL = (1 << 2), - FLAG_LOCAL_REL = (1 << 3), - FLAG_REMOTE_ABORT = (1 << 4), - FLAG_LOCAL_ABORT = (1 << 5), - FLAG_GLARE = (1 << 6), - FLAG_DELAYED_REL = (1 << 7), - FLAG_SENT_PROCEED = (1 << 8), - FLAG_SEND_DISC = (1 << 9), - /* Used for BRI only, flag is set after we request line CONNECTED */ - FLAG_ACTIVATING = (1 << 10), - /* Used when we receive an ALERT msg + inband tones ready */ - FLAG_MEDIA_READY = (1 << 11), - /* Set when we already sent a Channel ID IE */ - FLAG_SENT_CHAN_ID = (1 << 12), - /* Set when we already sent a Connect */ - FLAG_SENT_CONNECT = (1 << 13), -} sngisdn_flag_t; - - -typedef enum { - SNGISDN_SWITCH_INVALID = 0, /* invalid */ - SNGISDN_SWITCH_NI2 , /* national isdn-2 */ - SNGISDN_SWITCH_5ESS, /* att 5ess */ - SNGISDN_SWITCH_4ESS, /* att 4ess */ - SNGISDN_SWITCH_DMS100, /* nt dms100 */ - SNGISDN_SWITCH_EUROISDN,/* etsi */ - SNGISDN_SWITCH_QSIG, /* etsi qsig */ - SNGISDN_SWITCH_INSNET, /* int - net */ -} sngisdn_switchtype_t; - -typedef enum { - SNGISDN_SIGNALING_INVALID = 0, /* invalid */ - SNGISDN_SIGNALING_CPE , /* customer side emulation */ - SNGISDN_SIGNALING_NET, /* network side emulation */ -} sngisdn_signalingtype_t; - -typedef enum { - SNGISDN_TRACE_DISABLE = 0, - SNGISDN_TRACE_Q921 = 1, - SNGISDN_TRACE_Q931 = 2, -} sngisdn_tracetype_t; - -typedef enum { - SNGISDN_OPT_DEFAULT = 0, - SNGISDN_OPT_TRUE = 1, - SNGISDN_OPT_FALSE = 2, -} sngisdn_opt_t; - -typedef enum { - SNGISDN_EARLY_MEDIA_ON_PROCEED = (1 << 0), - SNGISDN_EARLY_MEDIA_ON_PROGRESS = (1 << 1), - SNGISDN_EARLY_MEDIA_ON_ALERT= (1 << 2), -} sngisdn_early_media_opt_t; - -typedef enum { - SNGISDN_AVAIL_DOWN = 1, - SNGISDN_AVAIL_PWR_SAVING = 5, - SNGISDN_AVAIL_UP = 10, -} sngisdn_avail_t; - -typedef enum { - SNGISDN_CID_NAME_AUTO, - SNGISDN_CID_NAME_DISPLAY_IE, - SNGISDN_CID_NAME_USR_USR_IE, - SNGISDN_CID_NAME_FACILITY_IE, -} sngisdn_cid_name_t; - -typedef enum { - SNGISDN_EVENT_CON_IND = 1, - SNGISDN_EVENT_CON_CFM, - SNGISDN_EVENT_CNST_IND, - SNGISDN_EVENT_DISC_IND, - SNGISDN_EVENT_REL_IND, - SNGISDN_EVENT_DAT_IND, - SNGISDN_EVENT_SSHL_IND, - SNGISDN_EVENT_SSHL_CFM, - SNGISDN_EVENT_RMRT_IND, - SNGISDN_EVENT_RMRT_CFM, - SNGISDN_EVENT_FLC_IND, - SNGISDN_EVENT_FAC_IND, - SNGISDN_EVENT_STA_CFM, - SNGISDN_EVENT_SRV_IND, - SNGISDN_EVENT_SRV_CFM, - SNGISDN_EVENT_RST_CFM, - SNGISDN_EVENT_RST_IND, -} ftdm_sngisdn_event_id_t; - -typedef struct ftdm_sngisdn_prog_ind { - ftdm_sngisdn_progind_loc_t loc; /* location */ - ftdm_sngisdn_progind_descr_t descr; /* description */ -} ftdm_sngisdn_progind_t; - -/* Only timers that can be cancelled are listed here */ -#define SNGISDN_NUM_CHAN_TIMERS 2 -/* Increase SNGISDN_NUM_CHAN_TIMERS as number of ftdm_sngisdn_chan_timer_t increases */ -typedef enum { - SNGISDN_CHAN_TIMER_FACILITY, - SNGISDN_CHAN_TIMER_ATT_TRANSFER, -} ftdm_sngisdn_chan_timer_t; - -#define SNGISDN_NUM_SPAN_TIMERS 1 -/* Increase SNGISDN_NUM_SPAN_TIMERS as number of ftdm_sngisdn_spanan_timer_t increases */ -typedef enum { - SNGISDN_SPAN_TIMER_RESTART, -} ftdm_sngisdn_span_timer_t; - -typedef struct sngisdn_glare_data { - int16_t suId; - uint32_t suInstId; - uint32_t spInstId; - int16_t dChan; - ConEvnt setup; - uint8_t ces; -} sngisdn_glare_data_t; - -typedef enum { - SNGISDN_TRANSFER_NONE = 0, /* Default value, no transfer being done */ - SNGISDN_TRANSFER_ATT_COURTESY_VRU, - SNGISDN_TRANSFER_ATT_COURTESY_VRU_DATA, - SNGISDN_TRANSFER_INVALID, -} sngisdn_transfer_type_t; -#define SNGISDN_TRANSFER_TYPE_STRINGS "NONE", "ATT_COURTESY_VRU", "ATT_COURTERY_VRU_DATA", "INVALID" -SNGISDN_STR2ENUM_P(ftdm_str2sngisdn_transfer_type, sngisdn_transfer_type2str, sngisdn_transfer_type_t) - -/* From section 4.2 of TR50075, max length of data is 100 when single UUI is sent */ -#define COURTESY_TRANSFER_MAX_DATA_SIZE 100 - -typedef struct _att_courtesy_vru -{ - char dtmf_digits [20]; - char data[COURTESY_TRANSFER_MAX_DATA_SIZE]; -} att_courtesy_vru_t; - -typedef struct _sngisdn_transfer_data -{ - sngisdn_transfer_type_t type; /* Specifies which type of transfer is being used */ - ftdm_transfer_response_t response; - union - { - att_courtesy_vru_t att_courtesy_vru; - } tdata; -} sngisdn_transfer_data_t; - -/* Channel specific data */ -typedef struct sngisdn_chan_data { - ftdm_channel_t *ftdmchan; - uint32_t flags; - uint8_t ces; /* used only for BRI, otherwise always 0 */ - uint8_t dchan_id; - uint16_t call_ref; /* Q.931 call reference, only valid for ETSI/INSNET/QSIG */ - uint32_t suInstId; /* instance ID generated locally */ - uint32_t spInstId; /* instance ID generated by stack */ - - uint8_t globalFlg; - sngisdn_glare_data_t glare; - ftdm_timer_id_t timers[SNGISDN_NUM_CHAN_TIMERS]; - sngisdn_transfer_data_t transfer_data; - - /* variables saved here will be sent to the user application - on next SIGEVENT_XXX */ - ftdm_hash_t* variables; - - /* raw_data saved here will be sent to the user application - on next SIGEVENT_XXX */ - void *raw_data; - ftdm_size_t raw_data_len; -} sngisdn_chan_data_t; - -struct sngisdn_nfas_data; -typedef struct sngisdn_nfas_data sngisdn_nfas_data_t; - -typedef enum { - SNGISDN_NFAS_DCHAN_NONE, - SNGISDN_NFAS_DCHAN_PRIMARY, - SNGISDN_NFAS_DCHAN_BACKUP, -} sngisdn_nfas_sigchan_t; - -/* Span specific data */ -typedef struct sngisdn_span_data { - ftdm_span_t *ftdm_span; - ftdm_channel_t *dchan; - uint8_t link_id; - uint8_t switchtype; - uint8_t signalling; /* SNGISDN_SIGNALING_CPE or SNGISDN_SIGNALING_NET */ - uint8_t cc_id; - ftdm_signaling_status_t sigstatus; - - uint8_t tei; - uint8_t min_digits; - uint8_t trace_flags; /* TODO change to bit map of sngisdn_tracetype_t */ - uint8_t early_media_flags; /* bit map of ftdm_sngisdn_early_media_opt_t */ - uint8_t overlap_dial; - uint8_t setup_arb; - uint8_t facility_ie_decode; - uint8_t facility; - int32_t facility_timeout; - uint8_t att_remove_dtmf; - int32_t transfer_timeout; - uint8_t num_local_numbers; - uint8_t ignore_cause_value; - uint8_t trace_q931; /* TODO: combine with trace_flags */ - uint8_t trace_q921; /* TODO: combine with trace_flags */ - uint8_t raw_trace_q931; /* TODO: combine with trace_flags */ - uint8_t raw_trace_q921; /* TODO: combine with trace_flags */ - uint8_t timer_t3; - uint8_t restart_opt; - uint8_t restart_timeout; - uint8_t force_sending_complete; - uint8_t cid_name_method; - uint8_t send_cid_name; - uint8_t send_connect_ack; - uint8_t dl_request_pending; /* Whether we have a DL request pending */ - - - int32_t timer_t301; - int32_t timer_t302; - int32_t timer_t303; - int32_t timer_t304; - int32_t timer_t305; - int32_t timer_t306; - int32_t timer_t307; - int32_t timer_t308; - int32_t timer_t310; - int32_t timer_t312; - int32_t timer_t313; - int32_t timer_t314; - int32_t timer_t316; - int32_t timer_t318; - int32_t timer_t319; - int32_t timer_t322; - char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; - ftdm_timer_id_t timers[SNGISDN_NUM_SPAN_TIMERS]; - ftdm_sched_t *sched; - ftdm_queue_t *event_queue; - - struct nfas_info { - sngisdn_nfas_data_t *trunk; - sngisdn_nfas_sigchan_t sigchan; - uint8_t interface_id; - } nfas; - - uint32_t num_chans; - sngisdn_chan_data_t *channels[NUM_E1_CHANNELS_PER_SPAN]; -} sngisdn_span_data_t; - -typedef struct sngisdn_event_data { - - int16_t suId; - int16_t dChan; - uint32_t suInstId; - uint32_t spInstId; - uint8_t ces; - uint8_t action; - uint8_t evntType; - - sngisdn_chan_data_t *sngisdn_info; - sngisdn_span_data_t *signal_data; - - ftdm_sngisdn_event_id_t event_id; - - union - { - ConEvnt conEvnt; - CnStEvnt cnStEvnt; - DiscEvnt discEvnt; - RelEvnt relEvnt; - InfoEvnt infoEvnt; - SsHlEvnt ssHlEvnt; - RmRtEvnt rmRtEvnt; - StaEvnt staEvnt; - FacEvnt facEvnt; - Srv srvEvnt; - Rst rstEvnt; - }event; - -} sngisdn_event_data_t; - -struct sngisdn_nfas_data { - char name[MAX_NFAS_GROUP_NAME]; - - char dchan_span_name[20]; - sngisdn_span_data_t *dchan; /* Span that contains primary d-channel */ - - char backup_span_name[20]; - sngisdn_span_data_t *backup; /* Span that contains backup d-channel */ - uint8_t num_spans; /* Number of spans within this NFAS */ - uint8_t num_spans_configured; - sngisdn_span_data_t *spans[MAX_SPANS_PER_NFAS_LINK+1]; //indexed by logical span id -}; - -typedef struct sngisdn_cc { - /* TODO: use flags instead of config_done and activation_done */ - uint8_t config_done; - uint8_t activation_done; - uint8_t switchtype; - ftdm_trunk_type_t trunktype; - uint32_t last_suInstId; - ftdm_mutex_t *mutex; - sngisdn_chan_data_t *active_spInstIds[MAX_INSTID+1]; - sngisdn_chan_data_t *active_suInstIds[MAX_INSTID+1]; -}sngisdn_cc_t; - -/* Global sngisdn data */ -typedef struct ftdm_sngisdn_data { - uint8_t gen_config_done; - uint8_t num_cc; /* 1 ent per switchtype */ - struct sngisdn_cc ccs[MAX_VARIANTS+1]; - uint8_t num_nfas; - sngisdn_nfas_data_t nfass[MAX_NFAS_GROUPS+1]; - sngisdn_span_data_t *spans[MAX_L1_LINKS+1]; /* spans are indexed by link_id */ - -#ifdef SANGOMA_ISDN_CHAN_ID_INVERT_BIT - /* Since this is a global configuration, place it here instead of sngisdn_span_data_t */ - uint8_t chan_id_invert_extend_bit; -#endif -}ftdm_sngisdn_data_t; - -typedef struct ftdm2trillium -{ - uint8_t ftdm_val; - uint8_t trillium_val; -}ftdm2trillium_t; - - -/* TODO implement these 2 functions */ -#define ISDN_FUNC_TRACE_ENTER(a) -#define ISDN_FUNC_TRACE_EXIT(a) - -/* Global Structs */ -extern ftdm_sngisdn_data_t g_sngisdn_data; - -/* Configuration functions */ -ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); - -/* Support functions */ -uint32_t get_unique_suInstId(int16_t cc_id); -void clear_call_data(sngisdn_chan_data_t *sngisdn_info); -void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); -ftdm_status_t get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); -ftdm_status_t get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); - -ftdm_status_t sngisdn_set_span_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail); -ftdm_status_t sngisdn_set_chan_avail_rate(ftdm_channel_t *chan, sngisdn_avail_t avail); -void sngisdn_set_span_sig_status(ftdm_span_t *ftdmspan, ftdm_signaling_status_t status); -void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status); - -ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); - - -void stack_hdr_init(Header *hdr); -void stack_pst_init(Pst *pst); - -/* Outbound Call Control functions */ -void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); -void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); -void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); -void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); -void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); -void sngisdn_snd_notify_req(ftdm_channel_t *ftdmchan); -void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); -void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan); -void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare); -void sngisdn_snd_reset(ftdm_channel_t *ftdmchan); -void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan); -void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan); -void sngisdn_snd_dl_req(ftdm_channel_t *ftdmchan); -void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan); -void sngisdn_snd_restart(ftdm_channel_t *ftdmchan); -void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len); -void sngisdn_snd_event(sngisdn_span_data_t *signal_data, ftdm_oob_event_t event); - -/* Inbound Call Control functions */ -void sngisdn_rcv_con_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces); -void sngisdn_rcv_con_cfm(int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces); -void sngisdn_rcv_cnst_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces); -void sngisdn_rcv_disc_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt); -void sngisdn_rcv_rel_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt); -void sngisdn_rcv_dat_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt); -void sngisdn_rcv_sshl_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); -void sngisdn_rcv_sshl_cfm(int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); -void sngisdn_rcv_rmrt_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); -void sngisdn_rcv_rmrt_cfm(int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); -void sngisdn_rcv_flc_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); -void sngisdn_rcv_fac_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces); -void sngisdn_rcv_sta_cfm(int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); -void sngisdn_rcv_srv_ind(int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); -void sngisdn_rcv_srv_cfm(int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); -void sngisdn_rcv_rst_cfm(int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); -void sngisdn_rcv_rst_ind(int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); -int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame); -int16_t sngisdn_rcv_l1_cmd_req(uint16_t spId, sng_l1_cmd_t *l1_cmd); - - -void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_sshl_cfm (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event); - -void sngisdn_process_srv_ind (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event); -void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event); - -void sngisdn_rcv_phy_ind(SuId suId, Reason reason); -void sngisdn_rcv_q921_ind(BdMngmt *status); - -void sngisdn_trace_interpreted_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); -void sngisdn_trace_interpreted_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); -void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); -void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); - -void sngisdn_get_memory_info(void); - -ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); -ftdm_status_t sngisdn_check_free_ids(void); - -void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf); -void sngisdn_rcv_q931_ind(InMngmt *status); -void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf); -void sngisdn_rcv_cc_ind(CcMngmt *status); -void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); -void sngisdn_rcv_sng_assert(char *message); - -#ifdef NETBORDER_CALL_REF -ftdm_status_t get_callref(ftdm_channel_t *ftdmchan, BCCallRef* callRef); -#endif -ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); -ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); -ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); -ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); -ftdm_status_t get_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); -ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); -ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd); -ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); -ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t data_len); -ftdm_status_t get_network_specific_fac(ftdm_channel_t *ftdmchan, NetFac *netFac); - -ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); -ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); -ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); -ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); -ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); -ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); -ftdm_status_t set_called_subaddr(ftdm_channel_t *ftdmchan, CdPtySad *cdPtySad); -ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind); -ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap); -ftdm_status_t set_network_specific_fac(ftdm_channel_t *ftdmchan, NetFac *netFac); -ftdm_status_t set_chan_id_ie(ftdm_channel_t *ftdmchan, ChanId *chanId); -ftdm_status_t set_restart_ind_ie(ftdm_channel_t *ftdmchan, RstInd *rstInd); -ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); -ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len); -ftdm_status_t set_user_to_user_ie(ftdm_channel_t *ftdmchan, UsrUsr *usrUsr); -ftdm_status_t set_cause_ie(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn); -ftdm_status_t set_not_ind_ie(ftdm_channel_t *ftdmchan, NotInd *notInd); - -ftdm_status_t sngisdn_add_var(sngisdn_chan_data_t *sngisdn_info, const char* var, const char* val); -ftdm_status_t sngisdn_add_raw_data(sngisdn_chan_data_t *sngisdn_info, uint8_t* data, ftdm_size_t data_len); -ftdm_status_t sngisdn_clear_data(sngisdn_chan_data_t *sngisdn_info); -void sngisdn_send_signal(sngisdn_chan_data_t *sngisdn_info, ftdm_signal_event_t event_id); - -uint8_t sngisdn_get_infoTranCap_from_user(ftdm_bearer_cap_t bearer_capability); -uint8_t sngisdn_get_usrInfoLyr1Prot_from_user(ftdm_user_layer1_prot_t layer1_prot); -ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_stack(uint8_t bearer_capability); -ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_stack(uint8_t layer1_prot); - -ftdm_status_t sngisdn_transfer(ftdm_channel_t *ftdmchan); -ftdm_status_t sngisdn_att_transfer_process_dtmf(ftdm_channel_t *ftdmchan, const char* dtmf); - -static __inline__ uint32_t sngisdn_test_flag(sngisdn_chan_data_t *sngisdn_info, sngisdn_flag_t flag) -{ - return (uint32_t) sngisdn_info->flags & flag; -} -static __inline__ void sngisdn_clear_flag(sngisdn_chan_data_t *sngisdn_info, sngisdn_flag_t flag) -{ - sngisdn_info->flags &= ~flag; -} - -static __inline__ void sngisdn_set_flag(sngisdn_chan_data_t *sngisdn_info, sngisdn_flag_t flag) -{ - sngisdn_info->flags |= flag; -} - -#define sngisdn_set_trace_flag(obj, flag) ((obj)->trace_flags |= (flag)) -#define sngisdn_clear_trace_flag(obj, flag) ((obj)->trace_flags &= ~(flag)) -#define sngisdn_test_trace_flag(obj, flag) ((obj)->trace_flags & flag) - - -void handle_sng_log(uint8_t level, char *fmt,...); -void sngisdn_delayed_setup(void* p_sngisdn_info); -void sngisdn_delayed_release(void* p_sngisdn_info); -void sngisdn_delayed_release_nfas(void *p_sngisdn_info); -void sngisdn_delayed_connect(void* p_sngisdn_info); -void sngisdn_delayed_disconnect(void* p_sngisdn_info); -void sngisdn_facility_timeout(void* p_sngisdn_info); -void sngisdn_t3_timeout(void* p_sngisdn_info); -void sngisdn_restart_timeout(void* p_signal_data); -void sngisdn_delayed_dl_req(void* p_signal_data); - -/* Stack management functions */ -ftdm_status_t sngisdn_start_gen_cfg(void); -ftdm_status_t sngisdn_stack_cfg(ftdm_span_t *span); -ftdm_status_t sngisdn_stack_start(ftdm_span_t *span); -ftdm_status_t sngisdn_stack_stop(ftdm_span_t *span); -ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span); -sngisdn_span_data_t *sngisdn_dchan(sngisdn_span_data_t *signal_data); - -ftdm_status_t sngisdn_show_l1_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span); -ftdm_status_t sngisdn_show_spans(ftdm_stream_handle_t *stream); -ftdm_status_t sngisdn_show_span(ftdm_stream_handle_t *stream, ftdm_span_t *span); - -#endif /* __FTMOD_SNG_ISDN_H__ */ - -/* 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/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c deleted file mode 100644 index 31a1a5b69f..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ /dev/null @@ -1,657 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ - -#include "ftmod_sangoma_isdn.h" - -static ftdm_status_t parse_timer(const char* val, int32_t *target); -static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span); -static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span); -static ftdm_status_t parse_trunkgroup(const char *_trunkgroup); -static ftdm_status_t add_local_number(const char* val, ftdm_span_t *span); -static ftdm_status_t parse_yesno(const char* var, const char* val, uint8_t *target); -static ftdm_status_t set_switchtype_defaults(ftdm_span_t *span); - -extern ftdm_sngisdn_data_t g_sngisdn_data; - - -static ftdm_status_t parse_timer(const char* val, int32_t *target) -{ - *target = atoi(val); - if (*target < 0) { - *target = 0; - } - return FTDM_SUCCESS; -} - -static ftdm_status_t parse_yesno(const char* var, const char* val, uint8_t *target) -{ - if (ftdm_true(val)) { - *target = SNGISDN_OPT_TRUE; - } else { - *target = SNGISDN_OPT_FALSE; - } - return FTDM_SUCCESS; -} - -static ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - - if (signal_data->num_local_numbers >= SNGISDN_NUM_LOCAL_NUMBERS) { - ftdm_log(FTDM_LOG_ERROR, "%s: Maximum number of local-numbers exceeded (max:%d)\n", span->name, SNGISDN_NUM_LOCAL_NUMBERS); - return FTDM_FAIL; - } - - signal_data->local_numbers[signal_data->num_local_numbers++] = ftdm_strdup(val); - return FTDM_SUCCESS; -} - -static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) -{ - unsigned i; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - //sngisdn_dchan_data_t *dchan_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - - switch(span->trunk_type) { - case FTDM_TRUNK_T1: - if (!strcasecmp(switch_name, "ni2") || - !strcasecmp(switch_name, "national")) { - signal_data->switchtype = SNGISDN_SWITCH_NI2; - } else if (!strcasecmp(switch_name, "5ess")) { - signal_data->switchtype = SNGISDN_SWITCH_5ESS; - } else if (!strcasecmp(switch_name, "4ess")) { - signal_data->switchtype = SNGISDN_SWITCH_4ESS; - } else if (!strcasecmp(switch_name, "dms100")) { - signal_data->switchtype = SNGISDN_SWITCH_DMS100; - } else if (!strcasecmp(switch_name, "qsig")) { - signal_data->switchtype = SNGISDN_SWITCH_QSIG; - } else { - ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported switchtype %s for trunktype:%s\n", span->name, switch_name, ftdm_trunk_type2str(span->trunk_type)); - return FTDM_FAIL; - } - break; - case FTDM_TRUNK_E1: - if (!strcasecmp(switch_name, "euroisdn") || - !strcasecmp(switch_name, "etsi")) { - signal_data->switchtype = SNGISDN_SWITCH_EUROISDN; - } else if (!strcasecmp(switch_name, "qsig")) { - signal_data->switchtype = SNGISDN_SWITCH_QSIG; - } else { - ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported switchtype %s for trunktype:%s\n", span->name, switch_name, ftdm_trunk_type2str(span->trunk_type)); - return FTDM_FAIL; - } - break; - case FTDM_TRUNK_BRI: - case FTDM_TRUNK_BRI_PTMP: - if (!strcasecmp(switch_name, "euroisdn") || - !strcasecmp(switch_name, "etsi")) { - signal_data->switchtype = SNGISDN_SWITCH_EUROISDN; - } else if (!strcasecmp(switch_name, "insnet") || - !strcasecmp(switch_name, "ntt")) { - signal_data->switchtype = SNGISDN_SWITCH_INSNET; - } else { - ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported switchtype %s for trunktype:%s\n", span->name, switch_name, ftdm_trunk_type2str(span->trunk_type)); - return FTDM_FAIL; - } - ftdm_set_flag(span, FTDM_SPAN_USE_AV_RATE); - ftdm_set_flag(span, FTDM_SPAN_PWR_SAVING); - /* can be > 1 for some BRI variants */ - break; - default: - ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported trunktype:%s\n", span->name, ftdm_trunk_type2str(span->trunk_type)); - return FTDM_FAIL; - } - - /* see if we have profile with this switch_type already */ - for (i = 1; i <= g_sngisdn_data.num_cc; i++) { - if (g_sngisdn_data.ccs[i].switchtype == signal_data->switchtype && - g_sngisdn_data.ccs[i].trunktype == span->trunk_type) { - break; - } - } - - /* need to create a new switch_type */ - if (i > g_sngisdn_data.num_cc) { - g_sngisdn_data.num_cc++; - g_sngisdn_data.ccs[i].switchtype = signal_data->switchtype; - g_sngisdn_data.ccs[i].trunktype = span->trunk_type; - ftdm_log(FTDM_LOG_DEBUG, "%s: New switchtype:%s cc_id:%u\n", span->name, switch_name, i); - } - - /* add this span to its ent_cc */ - signal_data->cc_id = i; - - g_sngisdn_data.spans[signal_data->link_id] = signal_data; - - ftdm_log(FTDM_LOG_DEBUG, "%s: cc_id:%d link_id:%d\n", span->name, signal_data->cc_id, signal_data->link_id); - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - int32_t chan_id; - ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - /* set the d-channel */ - signal_data->dchan = ftdmchan; - } else { - /* Add the channels to the span */ - chan_id = ftdmchan->physical_chan_id; - signal_data->channels[chan_id] = (sngisdn_chan_data_t*)ftdmchan->call_data; - signal_data->num_chans++; - } - } - ftdm_iterator_free(chaniter); - return FTDM_SUCCESS; -} - -static ftdm_status_t parse_signalling(const char *signalling, ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - if (!strcasecmp(signalling, "net") || - !strcasecmp(signalling, "pri_net")|| - !strcasecmp(signalling, "bri_net")) { - - signal_data->signalling = SNGISDN_SIGNALING_NET; - } else if (!strcasecmp(signalling, "cpe") || - !strcasecmp(signalling, "pri_cpe")|| - !strcasecmp(signalling, "bri_cpe")) { - - signal_data->signalling = SNGISDN_SIGNALING_CPE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Unsupported signalling/interface %s\n", signalling); - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -static ftdm_status_t parse_spanmap(const char *_spanmap, ftdm_span_t *span) -{ - int i; - char *p, *name, *spanmap; - uint8_t logical_span_id = 0; - ftdm_status_t ret = FTDM_SUCCESS; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - - spanmap = ftdm_strdup(_spanmap); - - p = name = NULL; - - i = 0; - for (p = strtok(spanmap, ","); p; p = strtok(NULL, ",")) { - while (*p == ' ') { - p++; - } - switch(i++) { - case 0: - name = ftdm_strdup(p); - break; - case 1: - logical_span_id = atoi(p); - break; - } - } - - if (!name) { - ftdm_log(FTDM_LOG_ERROR, "Invalid spanmap syntax %s\n", _spanmap); - ret = FTDM_FAIL; - goto done; - } - - for (i = 0; i < g_sngisdn_data.num_nfas; i++) { - if (!ftdm_strlen_zero(g_sngisdn_data.nfass[i].name) && - !strcasecmp(g_sngisdn_data.nfass[i].name, name)) { - - signal_data->nfas.trunk = &g_sngisdn_data.nfass[i]; - break; - } - } - - if (!signal_data->nfas.trunk) { - ftdm_log(FTDM_LOG_ERROR, "Could not find trunkgroup with name %s\n", name); - ret = FTDM_FAIL; - goto done; - } - - if (signal_data->nfas.trunk->spans[logical_span_id]) { - ftdm_log(FTDM_LOG_ERROR, "trunkgroup:%s already had a span with logical span id:%d\n", name, logical_span_id); - } else { - signal_data->nfas.trunk->spans[logical_span_id] = signal_data; - signal_data->nfas.interface_id = logical_span_id; - } - - if (!strcasecmp(signal_data->ftdm_span->name, signal_data->nfas.trunk->dchan_span_name)) { - - signal_data->nfas.sigchan = SNGISDN_NFAS_DCHAN_PRIMARY; - signal_data->nfas.trunk->dchan = signal_data; - } - - if (!strcasecmp(signal_data->ftdm_span->name, signal_data->nfas.trunk->backup_span_name)) { - - signal_data->nfas.sigchan = SNGISDN_NFAS_DCHAN_BACKUP; - signal_data->nfas.trunk->backup = signal_data; - } - -done: - ftdm_safe_free(spanmap); - ftdm_safe_free(name); - return ret; -} - -static ftdm_status_t parse_trunkgroup(const char *_trunkgroup) -{ - int i; - char *p, *name, *dchan_span, *backup_span, *trunkgroup; - uint8_t num_spans = 0; - ftdm_status_t ret = FTDM_SUCCESS; - - trunkgroup = ftdm_strdup(_trunkgroup); - - p = name = dchan_span = backup_span = NULL; - - /* format: name, num_chans, dchan_span, [backup_span] */ - - i = 0; - for (p = strtok(trunkgroup, ","); p; p = strtok(NULL, ",")) { - while (*p == ' ') { - p++; - } - switch(i++) { - case 0: - name = ftdm_strdup(p); - break; - case 1: - num_spans = atoi(p); - break; - case 2: - dchan_span = ftdm_strdup(p); - break; - case 3: - backup_span = ftdm_strdup(p); - } - } - - if (!name || !dchan_span || num_spans <= 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid parameters for trunkgroup:%s\n", _trunkgroup); - ret = FTDM_FAIL; - goto done; - } - - for (i = 0; i < g_sngisdn_data.num_nfas; i++) { - if (!ftdm_strlen_zero(g_sngisdn_data.nfass[i].name) && - !strcasecmp(g_sngisdn_data.nfass[i].name, name)) { - - /* We already configured this trunkgroup */ - goto done; - } - } - - /* Trunk group was not found, need to configure it */ - strncpy(g_sngisdn_data.nfass[i].name, name, sizeof(g_sngisdn_data.nfass[i].name)); - g_sngisdn_data.nfass[i].num_spans = num_spans; - strncpy(g_sngisdn_data.nfass[i].dchan_span_name, dchan_span, sizeof(g_sngisdn_data.nfass[i].dchan_span_name)); - - if (backup_span) { - strncpy(g_sngisdn_data.nfass[i].backup_span_name, backup_span, sizeof(g_sngisdn_data.nfass[i].backup_span_name)); - } - - - g_sngisdn_data.num_nfas++; -done: - ftdm_safe_free(trunkgroup); - ftdm_safe_free(name); - ftdm_safe_free(dchan_span); - ftdm_safe_free(backup_span); - return ret; -} - -static ftdm_status_t parse_early_media(const char* opt, ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - if (!strcasecmp(opt, "on-proceed")) { - signal_data->early_media_flags |= SNGISDN_EARLY_MEDIA_ON_PROCEED; - } else if (!strcasecmp(opt, "on-progress")) { - signal_data->early_media_flags |= SNGISDN_EARLY_MEDIA_ON_PROGRESS; - } else if (!strcasecmp(opt, "on-alert")) { - signal_data->early_media_flags |= SNGISDN_EARLY_MEDIA_ON_ALERT; - } else { - ftdm_log(FTDM_LOG_ERROR, "Unsupported early-media option %s\n", opt); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "Early media opt:0x%x\n", signal_data->early_media_flags); - return FTDM_SUCCESS; -} - - -static ftdm_status_t set_switchtype_defaults(ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - switch(signal_data->switchtype) { - case SNGISDN_SWITCH_NI2: - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_4ESS: - case SNGISDN_SWITCH_DMS100: - if (span->default_caller_data.dnis.plan >= FTDM_NPI_INVALID) { - ftdm_set_npi("isdn", &span->default_caller_data.dnis.plan); - } - if (span->default_caller_data.dnis.type >= FTDM_TON_INVALID) { - ftdm_set_ton("national", &span->default_caller_data.dnis.type); - } - if (span->default_caller_data.cid_num.plan >= FTDM_NPI_INVALID) { - ftdm_set_npi("isdn", &span->default_caller_data.cid_num.plan); - } - if (span->default_caller_data.cid_num.type >= FTDM_TON_INVALID) { - ftdm_set_ton("national", &span->default_caller_data.cid_num.type); - } - if (span->default_caller_data.rdnis.plan >= FTDM_NPI_INVALID) { - ftdm_set_npi("isdn", &span->default_caller_data.rdnis.plan); - } - if (span->default_caller_data.rdnis.type >= FTDM_TON_INVALID) { - ftdm_set_ton("national", &span->default_caller_data.rdnis.type); - } - break; - case SNGISDN_SWITCH_EUROISDN: - case SNGISDN_SWITCH_QSIG: - case SNGISDN_SWITCH_INSNET: - if (span->default_caller_data.dnis.plan >= FTDM_NPI_INVALID) { - ftdm_set_npi("unknown", &span->default_caller_data.dnis.plan); - } - if (span->default_caller_data.dnis.type >= FTDM_TON_INVALID) { - ftdm_set_ton("unknown", &span->default_caller_data.dnis.type); - } - if (span->default_caller_data.cid_num.plan >= FTDM_NPI_INVALID) { - ftdm_set_npi("unknown", &span->default_caller_data.cid_num.plan); - } - if (span->default_caller_data.cid_num.type >= FTDM_TON_INVALID) { - ftdm_set_ton("unknown", &span->default_caller_data.cid_num.type); - } - if (span->default_caller_data.rdnis.plan >= FTDM_NPI_INVALID) { - ftdm_set_npi("unknown", &span->default_caller_data.rdnis.plan); - } - if (span->default_caller_data.rdnis.type >= FTDM_TON_INVALID) { - ftdm_set_ton("unknown", &span->default_caller_data.rdnis.type); - } - break; - case SNGISDN_SWITCH_INVALID: - default: - ftdm_log(FTDM_LOG_ERROR, "Unsupported switchtype[%d]\n", signal_data->switchtype); - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - - -ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span) -{ - unsigned paramindex; - const char *var, *val; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - /* Set defaults here */ - signal_data->tei = 0; - signal_data->min_digits = 8; - signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; - signal_data->setup_arb = SNGISDN_OPT_DEFAULT; - signal_data->facility_ie_decode = SNGISDN_OPT_DEFAULT; - signal_data->ignore_cause_value = SNGISDN_OPT_DEFAULT; - signal_data->timer_t3 = 8; - signal_data->restart_opt = SNGISDN_OPT_DEFAULT; - signal_data->link_id = span->span_id; - signal_data->transfer_timeout = 20000; - signal_data->att_remove_dtmf = SNGISDN_OPT_DEFAULT; - signal_data->force_sending_complete = SNGISDN_OPT_DEFAULT; - - signal_data->cid_name_method = SNGISDN_CID_NAME_AUTO; - signal_data->send_cid_name = SNGISDN_OPT_DEFAULT; - signal_data->send_connect_ack = SNGISDN_OPT_DEFAULT; - - span->default_caller_data.dnis.plan = FTDM_NPI_INVALID; - span->default_caller_data.dnis.type = FTDM_TON_INVALID; - span->default_caller_data.cid_num.plan = FTDM_NPI_INVALID; - span->default_caller_data.cid_num.type = FTDM_TON_INVALID; - span->default_caller_data.rdnis.plan = FTDM_NPI_INVALID; - span->default_caller_data.rdnis.type = FTDM_TON_INVALID; - - span->default_caller_data.bearer_capability = IN_ITC_SPEECH; - /* Cannot set default bearer_layer1 yet, as we do not know the switchtype */ - span->default_caller_data.bearer_layer1 = FTDM_INVALID_INT_PARM; - - /* Find out if NFAS is enabled first */ - for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { - ftdm_log(FTDM_LOG_DEBUG, "Sangoma ISDN key=value, %s=%s\n", ftdm_parameters[paramindex].var, ftdm_parameters[paramindex].val); - var = ftdm_parameters[paramindex].var; - val = ftdm_parameters[paramindex].val; - - if (!strcasecmp(var, "trunkgroup")) { - if (parse_trunkgroup(val) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } - } - - for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { - ftdm_log(FTDM_LOG_DEBUG, "Sangoma ISDN key=value, %s=%s\n", ftdm_parameters[paramindex].var, ftdm_parameters[paramindex].val); - var = ftdm_parameters[paramindex].var; - val = ftdm_parameters[paramindex].val; - - if (!strcasecmp(var, "switchtype")) { - if (parse_switchtype(val, span) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - if (set_switchtype_defaults(span) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "signalling") || - !strcasecmp(var, "interface")) { - if (parse_signalling(val, span) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "spanmap")) { - if (parse_spanmap(val, span) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "tei")) { - uint8_t tei = atoi(val); - if (tei > 127) { - ftdm_log(FTDM_LOG_ERROR, "Invalid TEI %d, valid values are (0-127)", tei); - return FTDM_FAIL; - } - signal_data->tei = tei; - } else if (!strcasecmp(var, "overlap")) { - if (!strcasecmp(val, "yes")) { - signal_data->overlap_dial = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->overlap_dial = SNGISDN_OPT_FALSE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); - } - } else if (!strcasecmp(var, "setup-arbitration")) { - parse_yesno(var, val, &signal_data->setup_arb); - } else if (!strcasecmp(var, "facility")) { - parse_yesno(var, val, &signal_data->facility); - } else if (!strcasecmp(var, "min-digits") || - !strcasecmp(var, "min_digits")) { - signal_data->min_digits = atoi(val); - } else if (!strcasecmp(var, "outbound-called-ton")) { - ftdm_set_ton(val, &span->default_caller_data.dnis.type); - } else if (!strcasecmp(var, "outbound-called-npi")) { - ftdm_set_npi(val, &span->default_caller_data.dnis.plan); - } else if (!strcasecmp(var, "outbound-calling-ton")) { - ftdm_set_ton(val, &span->default_caller_data.cid_num.type); - } else if (!strcasecmp(var, "outbound-calling-npi")) { - ftdm_set_npi(val, &span->default_caller_data.cid_num.plan); - } else if (!strcasecmp(var, "outbound-rdnis-ton")) { - ftdm_set_ton(val, &span->default_caller_data.rdnis.type); - } else if (!strcasecmp(var, "outbound-rdnis-npi")) { - ftdm_set_npi(val, &span->default_caller_data.rdnis.plan); - } else if (!strcasecmp(var, "outbound-bc-transfer-cap") || - !strcasecmp(var, "outbound-bearer_cap")) { - ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability); - } else if (!strcasecmp(var, "outbound-bc-user-layer1") || - !strcasecmp(var, "outbound-bearer_layer1")) { - ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1); - } else if (!strcasecmp(var, "channel-restart-on-link-up")) { - parse_yesno(var, val, &signal_data->restart_opt); - } else if (!strcasecmp(var, "channel-restart-timeout")) { - signal_data->restart_timeout = atoi(val); - } else if (!strcasecmp(var, "local-number")) { - if (add_local_number(val, span) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "facility-timeout")) { - parse_timer(val, &signal_data->facility_timeout); - } else if (!strcasecmp(var, "transfer-timeout")) { - parse_timer(val, &signal_data->transfer_timeout); - } else if (!strcasecmp(var, "att-remove-dtmf")) { - parse_yesno(var, val, &signal_data->att_remove_dtmf); - } else if (!strcasecmp(var, "facility-ie-decode")) { - parse_yesno(var, val, &signal_data->facility_ie_decode); - } else if (!strcasecmp(var, "ignore-cause-value")) { - parse_yesno(var, val, &signal_data->ignore_cause_value); - } else if (!strcasecmp(var, "q931-trace")) { - parse_yesno(var, val, &signal_data->trace_q931); - } else if (!strcasecmp(var, "q921-trace")) { - parse_yesno(var, val, &signal_data->trace_q921); - } else if (!strcasecmp(var, "q931-raw-trace")) { - parse_yesno(var, val, &signal_data->raw_trace_q931); - } else if (!strcasecmp(var, "q921-raw-trace")) { - parse_yesno(var, val, &signal_data->raw_trace_q921); - } else if (!strcasecmp(var, "force-sending-complete")) { - parse_yesno(var, val, &signal_data->force_sending_complete); - } else if (!strcasecmp(var, "early-media-override")) { - if (parse_early_media(val, span) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } else if (!strcasecmp(var, "chan-id-invert-extend-bit")) { -#ifdef SANGOMA_ISDN_CHAN_ID_INVERT_BIT - parse_yesno(var, val, &g_sngisdn_data.chan_id_invert_extend_bit); -#else - ftdm_log(FTDM_LOG_WARNING, "chan-id-invert-extend-bit is not supported in your version of libsng_isdn\n"); -#endif - } else if (!strcasecmp(var, "cid-name-transmit-method")) { - if (!strcasecmp(val, "display-ie")) { - signal_data->cid_name_method = SNGISDN_CID_NAME_DISPLAY_IE; - } else if (!strcasecmp(val, "user-user-ie")) { - signal_data->cid_name_method = SNGISDN_CID_NAME_USR_USR_IE; - } else if (!strcasecmp(val, "facility-ie")) { - signal_data->cid_name_method = SNGISDN_CID_NAME_FACILITY_IE; - } else if (!strcasecmp(val, "auto") || !strcasecmp(val, "automatic") || !strcasecmp(val, "default")) { - signal_data->cid_name_method = SNGISDN_CID_NAME_AUTO; - } else { - ftdm_log(FTDM_LOG_WARNING, "Invalid option %s for parameter %s\n", val, var); - signal_data->cid_name_method = SNGISDN_CID_NAME_AUTO; - } - } else if (!strcasecmp(var, "send-cid-name")) { - if (!strcasecmp(val, "yes")) { - signal_data->send_cid_name = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->send_cid_name = SNGISDN_OPT_FALSE; - } else if (!strcasecmp(val, "auto") || !strcasecmp(val, "automatic") || !strcasecmp(val, "default")) { - signal_data->send_cid_name = SNGISDN_OPT_DEFAULT; - } else { - ftdm_log(FTDM_LOG_WARNING, "Invalid option %s for parameter %s\n", val, var); - signal_data->send_cid_name = SNGISDN_OPT_DEFAULT; - } - } else if (!strcasecmp(var, "timer-t301")) { - parse_timer(val, &signal_data->timer_t301); - } else if (!strcasecmp(var, "timer-t302")) { - parse_timer(val, &signal_data->timer_t302); - } else if (!strcasecmp(var, "timer-t303")) { - parse_timer(val, &signal_data->timer_t303); - } else if (!strcasecmp(var, "timer-t304")) { - parse_timer(val, &signal_data->timer_t304); - } else if (!strcasecmp(var, "timer-t305")) { - parse_timer(val, &signal_data->timer_t305); - } else if (!strcasecmp(var, "timer-t306")) { - parse_timer(val, &signal_data->timer_t306); - } else if (!strcasecmp(var, "timer-t307")) { - parse_timer(val, &signal_data->timer_t307); - } else if (!strcasecmp(var, "timer-t308")) { - parse_timer(val, &signal_data->timer_t308); - } else if (!strcasecmp(var, "timer-t310")) { - parse_timer(val, &signal_data->timer_t310); - } else if (!strcasecmp(var, "timer-t312")) { - parse_timer(val, &signal_data->timer_t312); - } else if (!strcasecmp(var, "timer-t313")) { - parse_timer(val, &signal_data->timer_t313); - } else if (!strcasecmp(var, "timer-t314")) { - parse_timer(val, &signal_data->timer_t314); - } else if (!strcasecmp(var, "timer-t316")) { - parse_timer(val, &signal_data->timer_t316); - } else if (!strcasecmp(var, "timer-t318")) { - parse_timer(val, &signal_data->timer_t318); - } else if (!strcasecmp(var, "timer-t319")) { - parse_timer(val, &signal_data->timer_t319); - } else if (!strcasecmp(var, "timer-t322")) { - parse_timer(val, &signal_data->timer_t322); - } else if (!strcasecmp(var, "trunkgroup")) { - /* Do nothing, we already parsed this parameter */ - } else if (!strcasecmp(var, "send-connect-ack")) { - parse_yesno(var, val, &signal_data->send_connect_ack); - } else { - ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); - } - } /* for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) */ - - if (signal_data->switchtype == SNGISDN_SWITCH_INVALID) { - ftdm_log(FTDM_LOG_ERROR, "%s: switchtype not specified", span->name); - return FTDM_FAIL; - } - if (signal_data->signalling == SNGISDN_SIGNALING_INVALID) { - ftdm_log(FTDM_LOG_ERROR, "%s: signalling not specified", span->name); - return FTDM_FAIL; - } - - if (span->default_caller_data.bearer_layer1 == FTDM_INVALID_INT_PARM) { - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN || - signal_data->switchtype == SNGISDN_SWITCH_QSIG) { - span->default_caller_data.bearer_layer1 = IN_UIL1_G711ALAW; - } else { - span->default_caller_data.bearer_layer1 = IN_UIL1_G711ULAW; - } - } - return FTDM_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: - */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c deleted file mode 100644 index c0caf10ab7..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ - -#include "ftmod_sangoma_isdn.h" - -void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status); - -void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) -{ - ftdm_sigmsg_t sig; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)ftdmchan->span->signal_data; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n", ftdm_signaling_status2str(status)); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.ev_data.sigstatus.status = status; - ftdm_span_send_signal(ftdmchan->span, &sig); - - if (FTDM_SPAN_IS_BRI(ftdmchan->span)) { - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)) { - ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); - - ftdm_sched_timer(signal_data->sched, "delayed_setup", 1000, sngisdn_delayed_setup, (void*) sngisdn_info, NULL); - } - } - return; -} - -void sngisdn_set_span_sig_status(ftdm_span_t *span, ftdm_signaling_status_t status) -{ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - ((sngisdn_span_data_t*)span->signal_data)->sigstatus = status; - - if (status == FTDM_SIG_STATE_UP) { - ((sngisdn_span_data_t*)span->signal_data)->dl_request_pending = 0; - } - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - sngisdn_set_chan_sig_status(((ftdm_channel_t*)ftdm_iterator_current(curr)), status); - } - ftdm_iterator_free(chaniter); - return; -} - - -/* 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/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c deleted file mode 100644 index 92d401d5e0..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ /dev/null @@ -1,1273 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ftmod_sangoma_isdn.h" - -extern ftdm_sngisdn_data_t g_sngisdn_data; - -uint8_t sng_isdn_stack_switchtype(sngisdn_switchtype_t switchtype); - -ftdm_status_t sngisdn_cfg_phy(ftdm_span_t *span); -ftdm_status_t sngisdn_cfg_q921(ftdm_span_t *span); -ftdm_status_t sngisdn_cfg_q931(ftdm_span_t *span); -ftdm_status_t sngisdn_cfg_cc(ftdm_span_t *span); - -ftdm_status_t sngisdn_stack_cfg_phy_gen(void); -ftdm_status_t sngisdn_stack_cfg_q921_gen(void); -ftdm_status_t sngisdn_stack_cfg_q931_gen(void); -ftdm_status_t sngisdn_stack_cfg_cc_gen(void); - - -ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span); -ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span); -ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management); -ftdm_status_t sngisdn_stack_cfg_q931_tsap(ftdm_span_t *span); -ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span); -ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span); - -ftdm_status_t sngisdn_stack_cfg_cc_sap(ftdm_span_t *span); - -ftdm_status_t sngisdn_start_gen_cfg(void) -{ - if (!g_sngisdn_data.gen_config_done) { - g_sngisdn_data.gen_config_done = 1; - ftdm_log(FTDM_LOG_DEBUG, "Starting general stack configuration\n"); - if(sngisdn_stack_cfg_phy_gen()!= FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed general physical configuration\n"); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "General stack physical done\n"); - - if(sngisdn_stack_cfg_q921_gen()!= FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed general q921 configuration\n"); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "General stack q921 done\n"); - - if(sngisdn_stack_cfg_q931_gen()!= FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed general q921 configuration\n"); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "General stack q931 done\n"); - - if(sngisdn_stack_cfg_cc_gen()!= FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed general CC configuration\n"); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "General stack CC done\n"); - ftdm_log(FTDM_LOG_INFO, "General stack configuration done\n"); - } - return FTDM_SUCCESS; -} - - -ftdm_status_t sngisdn_stack_cfg(ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - ftdm_log(FTDM_LOG_DEBUG, "Starting stack configuration for span:%s\n", span->name); - - if (signal_data->dchan) { - if (sngisdn_stack_cfg_phy_psap(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%s:phy_psap configuration failed\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:phy_psap configuration done\n", span->name); - - if (sngisdn_stack_cfg_q921_msap(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%s:q921_msap configuration failed\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:q921_msap configuration done\n", span->name); - - if (sngisdn_stack_cfg_q921_dlsap(span, 0) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%s:q921_dlsap configuration failed\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:q921_dlsap configuration done\n", span->name); - - if (span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - if (sngisdn_stack_cfg_q921_dlsap(span, 1) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%s:q921_dlsap management configuration failed\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:q921_dlsap management configuration done\n", span->name); - } - } - - if (sngisdn_stack_cfg_q931_dlsap(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%s:q931_dlsap configuration failed\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:q931_dlsap configuration done\n", span->name); - - if (signal_data->dchan) { - if (sngisdn_stack_cfg_q931_lce(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%s:q931_lce configuration failed\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:q931_lce configuration done\n", span->name); - } - - if (!g_sngisdn_data.ccs[signal_data->cc_id].config_done) { - g_sngisdn_data.ccs[signal_data->cc_id].config_done = 1; - /* if BRI, need to configure dlsap_mgmt */ - if (sngisdn_stack_cfg_q931_tsap(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%s:q931_tsap configuration failed\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:q931_tsap configuration done\n", span->name); - - if (sngisdn_stack_cfg_cc_sap(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%s:cc_sap configuration failed\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:cc_sap configuration done\n", span->name); - } - - ftdm_log(FTDM_LOG_INFO, "%s:stack configuration done\n", span->name); - return FTDM_SUCCESS; -} - - - -ftdm_status_t sngisdn_stack_cfg_phy_gen(void) -{ - /*local variables*/ - L1Mngmt cfg; /*configuration structure*/ - Pst pst; /*post structure*/ - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTL1; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTL1; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - - stack_pst_init(&cfg.t.cfg.s.l1Gen.sm ); - cfg.t.cfg.s.l1Gen.sm.srcEnt = ENTL1; - cfg.t.cfg.s.l1Gen.sm.dstEnt = ENTSM; - - cfg.t.cfg.s.l1Gen.nmbLnks = MAX_L1_LINKS; - cfg.t.cfg.s.l1Gen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ - cfg.t.cfg.s.l1Gen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ - - if (sng_isdn_phy_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span) -{ - L1Mngmt cfg; - Pst pst; - - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTL1; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTL1; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STPSAP; - - cfg.hdr.elmId.elmntInst1 = signal_data->link_id; - - if (!signal_data->dchan) { - ftdm_log(FTDM_LOG_ERROR, "%s:No d-channels specified\n", span->name); - return FTDM_FAIL; - } - - cfg.t.cfg.s.l1PSAP.sockfd = (int32_t)signal_data->dchan->sockfd; - - switch(span->trunk_type) { - case FTDM_TRUNK_E1: - cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_PRI; - break; - case FTDM_TRUNK_T1: - case FTDM_TRUNK_J1: - cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_PRI; - break; - case FTDM_TRUNK_BRI: - case FTDM_TRUNK_BRI_PTMP: - cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_BRI; - break; - default: - ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported trunk type %d\n", span->name, span->trunk_type); - return FTDM_FAIL; - } - - cfg.t.cfg.s.l1PSAP.spId = signal_data->link_id; - - if (sng_isdn_phy_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - - -ftdm_status_t sngisdn_stack_cfg_q921_gen(void) -{ - BdMngmt cfg; - Pst pst; - - /* initalize the post structure */ - stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTLD; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTLD; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - /* fill in the Gen Conf structures internal pst struct */ - - stack_pst_init(&cfg.t.cfg.s.bdGen.sm); - - cfg.t.cfg.s.bdGen.sm.dstEnt = ENTSM; /* entity */ - - cfg.t.cfg.s.bdGen.nmbPLnks = MAX_L1_LINKS+1; - cfg.t.cfg.s.bdGen.nmbLDLnks = MAX_L1_LINKS+1; /* Not used in LAPD */ - cfg.t.cfg.s.bdGen.nmbDLCs = MAX_L1_LINKS+1; - cfg.t.cfg.s.bdGen.nmbDLCs = MAX_TEIS_PER_LINK*(MAX_L1_LINKS+1); - cfg.t.cfg.s.bdGen.nmbASPLnks = MAX_L1_LINKS+1; - -#ifdef LAPD_3_4 - cfg.t.cfg.s.bdGen.timeRes = 100; /* timer resolution = 1 sec */ -#endif - cfg.t.cfg.s.bdGen.poolTrUpper = 2; /* upper pool threshold */ - cfg.t.cfg.s.bdGen.poolTrLower = 1; /* lower pool threshold */ - - if (sng_isdn_q921_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span) -{ - BdMngmt cfg; - Pst pst; - - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTLD; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTLD; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STMSAP; - - cfg.t.cfg.s.bdMSAP.lnkNmb = signal_data->link_id; - - cfg.t.cfg.s.bdMSAP.maxOutsFrms = 24; /* MAC window */ - cfg.t.cfg.s.bdMSAP.tQUpperTrs = 32; /* Tx Queue Upper Threshold */ - cfg.t.cfg.s.bdMSAP.tQLowerTrs = 24; /* Tx Queue Lower Threshold */ - cfg.t.cfg.s.bdMSAP.selector = 0; /* Selector 0 */ - /* TODO: check if bdMSAP parameters can be initialized by calling stack_pst_init */ - cfg.t.cfg.s.bdMSAP.mem.region = S_REG; /* Memory region */ - cfg.t.cfg.s.bdMSAP.mem.pool = S_POOL; /* Memory pool */ - cfg.t.cfg.s.bdMSAP.prior = PRIOR0; /* Priority */ - cfg.t.cfg.s.bdMSAP.route = RTESPEC; /* Route */ - cfg.t.cfg.s.bdMSAP.dstProcId = SFndProcId(); /* destination proc id */ - cfg.t.cfg.s.bdMSAP.dstEnt = ENTL1; /* entity */ - cfg.t.cfg.s.bdMSAP.dstInst = S_INST; /* instance */ - cfg.t.cfg.s.bdMSAP.t201Tmr = 1; /* T201 - should be equal to t200Tmr */ - cfg.t.cfg.s.bdMSAP.t202Tmr = 2; /* T202 */ - cfg.t.cfg.s.bdMSAP.bndRetryCnt = 2; /* bind retry counter */ - cfg.t.cfg.s.bdMSAP.tIntTmr = 200; /* bind retry timer */ - cfg.t.cfg.s.bdMSAP.n202 = 3; /* N202 */ - cfg.t.cfg.s.bdMSAP.lowTei = 64; /* Lowest dynamic TEI */ - - if (span->trunk_type == FTDM_TRUNK_BRI_PTMP && - signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.bdMSAP.kpL1Up = FALSE; /* flag to keep l1 up or not */ - } else { - cfg.t.cfg.s.bdMSAP.kpL1Up = TRUE; /* flag to keep l1 up or not */ - } - - switch(signal_data->switchtype) { - case SNGISDN_SWITCH_NI2: - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_4ESS: - case SNGISDN_SWITCH_DMS100: - cfg.t.cfg.s.bdMSAP.type = SW_NI2; - break; - case SNGISDN_SWITCH_INSNET: - cfg.t.cfg.s.bdMSAP.type = SW_CCITT; - break; - case SNGISDN_SWITCH_EUROISDN: - case SNGISDN_SWITCH_QSIG: - cfg.t.cfg.s.bdMSAP.type = SW_ETSI; - break; - } - - if (span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - cfg.t.cfg.s.bdMSAP.teiChkTmr = 20; /* Tei check timer */ - } else { - cfg.t.cfg.s.bdMSAP.teiChkTmr = 0; /* Tei check timer */ - } - - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.bdMSAP.logInt = 1; /* logical interface = 0 = user, 1= network */ - cfg.t.cfg.s.bdMSAP.setUpArb = PASSIVE; /* set up arbitration */ - } else { - cfg.t.cfg.s.bdMSAP.logInt = 0; /* logical interface = 0 = user, 1= network */ - cfg.t.cfg.s.bdMSAP.setUpArb = ACTIVE; /* set up arbitration */ - } - - /* Overwrite setUpArb value if user forced it */ - if (signal_data->setup_arb == SNGISDN_OPT_TRUE) { - cfg.t.cfg.s.bdMSAP.setUpArb = ACTIVE; - } else if (signal_data->setup_arb == SNGISDN_OPT_FALSE) { - cfg.t.cfg.s.bdMSAP.setUpArb = PASSIVE; - } - - if (sng_isdn_q921_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management) -{ - BdMngmt cfg; - Pst pst; - - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* initalize the post structure */ - stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTLD; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTLD; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STDLSAP; - - cfg.t.cfg.s.bdDLSAP.lnkNmb = signal_data->link_id; - - cfg.t.cfg.s.bdDLSAP.n201 = 1028; /* n201 */ - if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || - span->trunk_type == FTDM_TRUNK_BRI) { - - cfg.t.cfg.s.bdDLSAP.k = 1; /* Based on q.921 recommendations */ - } else { - cfg.t.cfg.s.bdDLSAP.k = 7; /* k */ - } - - cfg.t.cfg.s.bdDLSAP.n200 = 3; /* n200 */ - cfg.t.cfg.s.bdDLSAP.congTmr = 300; /* congestion timer */ - cfg.t.cfg.s.bdDLSAP.t200Tmr = 3; /* t1 changed from 25 */ - cfg.t.cfg.s.bdDLSAP.t203Tmr = 10; /* t3 changed from 50 */ - cfg.t.cfg.s.bdDLSAP.mod = 128; /* modulo */ - cfg.t.cfg.s.bdDLSAP.selector = 0; /* Selector 0 */ - cfg.t.cfg.s.bdDLSAP.mem.region = S_REG; /* Memory region */ - cfg.t.cfg.s.bdDLSAP.mem.pool = S_POOL; /* Memory pool */ - cfg.t.cfg.s.bdDLSAP.prior = PRIOR0; /* Priority */ - cfg.t.cfg.s.bdDLSAP.route = RTESPEC; /* Route */ - - if (management) { - cfg.t.cfg.s.bdDLSAP.sapi = MNGMT_SAPI; - cfg.t.cfg.s.bdDLSAP.teiAss = NON_AUTOMATIC; /* static tei assignment */ - cfg.t.cfg.s.bdDLSAP.noOfDlc = 1; - cfg.t.cfg.s.bdDLSAP.tei[0] = 0x7f; - } else { - cfg.t.cfg.s.bdDLSAP.sapi = Q930_SAPI; - if (span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.bdDLSAP.teiAss = AUTOMATIC; - cfg.t.cfg.s.bdDLSAP.noOfDlc = 8; - - cfg.t.cfg.s.bdDLSAP.tei[0] = 64; - cfg.t.cfg.s.bdDLSAP.tei[1] = 65; - cfg.t.cfg.s.bdDLSAP.tei[2] = 66; - cfg.t.cfg.s.bdDLSAP.tei[3] = 67; - cfg.t.cfg.s.bdDLSAP.tei[4] = 68; - cfg.t.cfg.s.bdDLSAP.tei[5] = 69; - cfg.t.cfg.s.bdDLSAP.tei[6] = 70; - cfg.t.cfg.s.bdDLSAP.tei[7] = 71; - } else { - cfg.t.cfg.s.bdDLSAP.teiAss = AUTOMATIC; - cfg.t.cfg.s.bdDLSAP.noOfDlc = 1; - } - } else { - /* Point to point configs */ - cfg.t.cfg.s.bdDLSAP.teiAss = NON_AUTOMATIC; - cfg.t.cfg.s.bdDLSAP.noOfDlc = 1; - cfg.t.cfg.s.bdDLSAP.tei[0] = signal_data->tei; - } - } - - if (sng_isdn_q921_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_stack_cfg_q931_gen(void) -{ - InMngmt cfg; - Pst pst; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTIN; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTIN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - - /* fill in the Gen Conf structures internal pst struct */ - stack_pst_init(&cfg.t.cfg.s.inGen.sm); - - cfg.t.cfg.s.inGen.nmbSaps = MAX_VARIANTS+1; /* Total number of variants supported */ - - cfg.t.cfg.s.inGen.nmbLnks = MAX_L1_LINKS+1; /* number of Data Link SAPs */ - cfg.t.cfg.s.inGen.nmbSigLnks = MAX_L1_LINKS+1; - - /* number of CESs */ - cfg.t.cfg.s.inGen.nmbCes = (MAX_L1_LINKS+1)*MAX_NUM_CES_PER_LINK; - /* number of global Call References can have 2 per channel when using HOLD/RESUME */ - cfg.t.cfg.s.inGen.nmbCalRef = MAX_NUM_CALLS; - /* number of bearer channels */ - cfg.t.cfg.s.inGen.nmbBearer = NUM_E1_CHANNELS_PER_SPAN*(MAX_L1_LINKS+1); - /* maximum number of routing entries */ - cfg.t.cfg.s.inGen.nmbRouts = 0; - /* number of profiles */ - cfg.t.cfg.s.inGen.nmbProfiles = 0; - /* upper pool threshold */ - cfg.t.cfg.s.inGen.poolTrUpper = INGEN_POOL_UP_TR; - /* time resolution */ - cfg.t.cfg.s.inGen.timeRes = 100; /* timer resolution = 1 sec */ - - cfg.t.cfg.s.inGen.sm.dstEnt = ENTSM; - - if (sng_isdn_q931_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -/* Link between CC and q931 */ -ftdm_status_t sngisdn_stack_cfg_q931_tsap(ftdm_span_t *span) -{ - InMngmt cfg; - Pst pst; - unsigned i; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTIN; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTIN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STTSAP; - - cfg.t.cfg.s.inTSAP.sapId = signal_data->cc_id; - - cfg.t.cfg.s.inTSAP.prior = PRIOR0; - cfg.t.cfg.s.inTSAP.route = RTESPEC; - - cfg.t.cfg.s.inTSAP.swtch = sng_isdn_stack_switchtype(signal_data->switchtype); - cfg.t.cfg.s.inTSAP.useSubAdr = 0; /* call routing on subaddress */ - cfg.t.cfg.s.inTSAP.adrPref = 0; /* use of prefix for int'l calls */ - cfg.t.cfg.s.inTSAP.nmbPrefDig = 0; /* number of digits used for prefix */ - - for (i = 0; i < IN_MAXPREFDIG; i++) - cfg.t.cfg.s.inTSAP.prefix[i] = 0; /* address prefix */ - - cfg.t.cfg.s.inTSAP.keyPad = 0; - cfg.t.cfg.s.inTSAP.wcRout = 0; - - for (i = 0; i < ADRLEN; i++) - cfg.t.cfg.s.inTSAP.wcMask[i] = 0; /* address prefix */ - - cfg.t.cfg.s.inTSAP.sidIns = FALSE; /* SID insertion Flag */ - cfg.t.cfg.s.inTSAP.sid.length = 0; /* SID */ - cfg.t.cfg.s.inTSAP.sidTon = 0; /* SID Type of Number */ - cfg.t.cfg.s.inTSAP.sidNPlan = 0; /* SID Numbering Plan */ - cfg.t.cfg.s.inTSAP.callId.len = 0; /* Default Call Identity */ - cfg.t.cfg.s.inTSAP.minAdrDig = 0; /* Minimum number of address digits */ - cfg.t.cfg.s.inTSAP.comptChck = FALSE; /* Validate compatibility */ - cfg.t.cfg.s.inTSAP.nmbApplProf = 0; /* Number of application profiles */ - cfg.t.cfg.s.inTSAP.profNmb[0] = 0; /* Application profiles */ - cfg.t.cfg.s.inTSAP.mem.region = S_REG; - cfg.t.cfg.s.inTSAP.mem.pool = S_POOL; - cfg.t.cfg.s.inTSAP.selector = 0; - - - if (sng_isdn_q931_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) -{ - InMngmt cfg; - Pst pst; - - unsigned i; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTIN; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTIN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STDLSAP; - - cfg.hdr.response.selector=0; - - cfg.t.cfg.s.inDLSAP.sapId = signal_data->link_id; - cfg.t.cfg.s.inDLSAP.spId = signal_data->link_id; - - cfg.t.cfg.s.inDLSAP.swtch = sng_isdn_stack_switchtype(signal_data->switchtype); - - cfg.t.cfg.s.inDLSAP.n201 = 1024; - cfg.t.cfg.s.inDLSAP.nmbRst = 2; - cfg.t.cfg.s.inDLSAP.tCbCfg = TRUE; - - cfg.t.cfg.s.inDLSAP.tCbId = signal_data->cc_id; - - if (signal_data->facility == SNGISDN_OPT_TRUE) { - cfg.t.cfg.s.inDLSAP.facilityHandling = IN_FACILITY_STANDRD; - } else { - cfg.t.cfg.s.inDLSAP.facilityHandling = 0; - } - - if (!signal_data->nfas.trunk) { - cfg.t.cfg.s.inDLSAP.nfasInt = FALSE; - cfg.t.cfg.s.inDLSAP.intId = 0; - cfg.t.cfg.s.inDLSAP.sigInt = 0; - cfg.t.cfg.s.inDLSAP.bupInt = 0; - cfg.t.cfg.s.inDLSAP.nmbNfasInt = 0; - cfg.t.cfg.s.inDLSAP.buIntPr = FALSE; - - for (i = 0; i < IN_MAX_NMB_INTRFS; i++) - cfg.t.cfg.s.inDLSAP.ctldInt[i] = IN_INT_NOT_CFGD; - - } else { - cfg.t.cfg.s.inDLSAP.nfasInt = TRUE; - cfg.t.cfg.s.inDLSAP.intId = signal_data->nfas.interface_id; - - for (i = 0; i < IN_MAX_NMB_INTRFS; i++) - cfg.t.cfg.s.inDLSAP.ctldInt[i] = IN_INT_NOT_CFGD; - - switch (signal_data->nfas.sigchan) { - case SNGISDN_NFAS_DCHAN_PRIMARY: - cfg.t.cfg.s.inDLSAP.sigInt = signal_data->nfas.trunk->dchan->link_id; - cfg.t.cfg.s.inDLSAP.nmbNfasInt = signal_data->nfas.trunk->num_spans; - - if (signal_data->nfas.trunk->backup) { - cfg.t.cfg.s.inDLSAP.buIntPr = TRUE; - cfg.t.cfg.s.inDLSAP.bupInt = signal_data->nfas.trunk->backup->link_id; - } else { - cfg.t.cfg.s.inDLSAP.buIntPr = FALSE; - } - - for (i = 0; i < MAX_SPANS_PER_NFAS_LINK; i++) { - if (signal_data->nfas.trunk->spans[i]) { - cfg.t.cfg.s.inDLSAP.ctldInt[i] = signal_data->nfas.trunk->spans[i]->link_id; - } - } - - break; - case SNGISDN_NFAS_DCHAN_BACKUP: - cfg.t.cfg.s.inDLSAP.sigInt = signal_data->nfas.trunk->dchan->link_id; - cfg.t.cfg.s.inDLSAP.nmbNfasInt = signal_data->nfas.trunk->num_spans; - - if (signal_data->nfas.trunk->backup) { - cfg.t.cfg.s.inDLSAP.buIntPr = TRUE; - cfg.t.cfg.s.inDLSAP.bupInt = signal_data->nfas.trunk->backup->link_id; - } else { - cfg.t.cfg.s.inDLSAP.buIntPr = FALSE; - } - - for (i = 0; i < MAX_SPANS_PER_NFAS_LINK; i++) { - if (signal_data->nfas.trunk->spans[i]) { - cfg.t.cfg.s.inDLSAP.ctldInt[i] = signal_data->nfas.trunk->spans[i]->link_id; - } - } - - break; - case SNGISDN_NFAS_DCHAN_NONE: - cfg.t.cfg.s.inDLSAP.sigInt = signal_data->nfas.trunk->dchan->link_id; - cfg.t.cfg.s.inDLSAP.nmbNfasInt = 0; - - break; - } - } - - cfg.t.cfg.s.inDLSAP.numRstInd = 255; - cfg.t.cfg.s.inDLSAP.relOpt = TRUE; -#ifdef ISDN_SRV - cfg.t.cfg.s.inDLSAP.bcas = FALSE; - cfg.t.cfg.s.inDLSAP.maxBSrvCnt = 2; - cfg.t.cfg.s.inDLSAP.maxDSrvCnt = 2; -#endif /* ISDN_SRV */ - - if (signal_data->switchtype == SNGISDN_SWITCH_QSIG) { - cfg.t.cfg.s.inDLSAP.intType = SYM_USER; - cfg.t.cfg.s.inDLSAP.clrGlr = TRUE; /* in case of glare, clear local call */ - cfg.t.cfg.s.inDLSAP.statEnqOpt = FALSE; - cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; - } else { - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.inDLSAP.intType = NETWORK; - cfg.t.cfg.s.inDLSAP.clrGlr = FALSE; /* in case of glare, do not clear local call */ - cfg.t.cfg.s.inDLSAP.statEnqOpt = TRUE; - - if (signal_data->ftdm_span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; - } else { - cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; - } - } else { - cfg.t.cfg.s.inDLSAP.intType = USER; - cfg.t.cfg.s.inDLSAP.clrGlr = TRUE; /* in case of glare, clear local call */ - cfg.t.cfg.s.inDLSAP.statEnqOpt = FALSE; - cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; - } - } - - if (signal_data->switchtype == SNGISDN_SWITCH_QSIG || - signal_data->switchtype == SNGISDN_SWITCH_5ESS) { - - cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; - } else if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; - } else { - cfg.t.cfg.s.inDLSAP.ackOpt = FALSE; - } - - if (signal_data->send_connect_ack != SNGISDN_OPT_DEFAULT) { - if (signal_data->send_connect_ack == SNGISDN_OPT_TRUE) { - cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; - } else { - cfg.t.cfg.s.inDLSAP.ackOpt = FALSE; - } - } - - /* Override the restart options if user selected that option */ - if (signal_data->restart_opt != SNGISDN_OPT_DEFAULT) { - if (signal_data->restart_opt == SNGISDN_OPT_TRUE) { - cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; - } else { - cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; - } - } - - for (i = 0; i < IN_MAXBCHNL; i++) - { - cfg.t.cfg.s.inDLSAP.bProf[i].profNmb = 0; - cfg.t.cfg.s.inDLSAP.bProf[i].valid = FALSE; - cfg.t.cfg.s.inDLSAP.bProf[i].state = IN_PROV_AVAIL; - } - - if (span->trunk_type == FTDM_TRUNK_BRI_PTMP && - signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.inDLSAP.nmbCes = MAX_NUM_CES_PER_LINK; - } else { - cfg.t.cfg.s.inDLSAP.nmbCes=1; - } - - cfg.t.cfg.s.inDLSAP.useSubAdr = 0; /* call routing on subaddress */ -#ifdef SANGOMA_ISDN_CHAN_ID_INVERT_BIT - if (signal_data->switchtype == SNGISDN_SWITCH_DMS100 && - g_sngisdn_data.chan_id_invert_extend_bit == SNGISDN_OPT_TRUE) { - /* Since this feature is not standard, we modified Trillium to check - the useSubAdr field and remove the extended bit if this is set, this - is a global configuration and once set, applies to all spans configured - as DMS 100 */ - cfg.t.cfg.s.inDLSAP.useSubAdr = PRSNT_NODEF; - } -#endif - cfg.t.cfg.s.inDLSAP.adrPref = 0; /* use of prefix for international calls */ - cfg.t.cfg.s.inDLSAP.nmbPrefDig = 0; /* number of digits used for prefix */ - for (i = 0; i < IN_MAXPREFDIG; i++) - cfg.t.cfg.s.inDLSAP.prefix[i] = 0; /* address prefix */ - cfg.t.cfg.s.inDLSAP.keyPad = 0; - cfg.t.cfg.s.inDLSAP.wcRout = 0; - for (i = 0; i < ADRLEN; i++) - cfg.t.cfg.s.inDLSAP.wcMask[i] = 0; /* address prefix */ - - cfg.t.cfg.s.inDLSAP.sidIns = FALSE; /* SID insertion flag */ - cfg.t.cfg.s.inDLSAP.sid.length = 0; /* SID */ - cfg.t.cfg.s.inDLSAP.sidTon = 0; /* SID Type of Number */ - cfg.t.cfg.s.inDLSAP.sidNPlan = 0; /* SID Numbering Plan */ - cfg.t.cfg.s.inDLSAP.sidPresInd = FALSE; /* SID Presentation Indicator */ - cfg.t.cfg.s.inDLSAP.minAdrDig = 0; /* minimum number of address digits */ - cfg.t.cfg.s.inDLSAP.srvOpt = FALSE; - cfg.t.cfg.s.inDLSAP.callId.len = 0; /* default call id */ - cfg.t.cfg.s.inDLSAP.redirSubsc = FALSE; /* subscription to call redirection */ - cfg.t.cfg.s.inDLSAP.redirAdr.eh.pres = NOTPRSNT; /* redirAdr Numbering Plan */ - cfg.t.cfg.s.inDLSAP.forwSubsc = FALSE; /* programmed forwarding subscription */ - cfg.t.cfg.s.inDLSAP.cndSubsc = TRUE; /* calling adddress delivery service subscription */ - - cfg.t.cfg.s.inDLSAP.tmr.t301.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t301.val = 180; - if (signal_data->timer_t301 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t301.val = signal_data->timer_t301; - } - - /* It looks like ETSI is the only variant that supports Overlap */ - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { - cfg.t.cfg.s.inDLSAP.tmr.t302.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t302.val = 15; - } else { - cfg.t.cfg.s.inDLSAP.tmr.t302.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t302.val = 0; - } - - if (signal_data->timer_t302 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t302.val = signal_data->timer_t302; - } - - cfg.t.cfg.s.inDLSAP.tmr.t303.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t303.val = 4; - - if (signal_data->timer_t303 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t303.val = signal_data->timer_t303; - } - - cfg.t.cfg.s.inDLSAP.tmr.t304.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t304.val = 30; - - if (signal_data->timer_t304 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t304.val = signal_data->timer_t304; - } - - cfg.t.cfg.s.inDLSAP.tmr.t305.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t305.val = 30; - - if (signal_data->timer_t305 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t305.val = signal_data->timer_t305; - } - - cfg.t.cfg.s.inDLSAP.tmr.t306.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t306.val = 35; - - if (signal_data->timer_t306 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t306.val = signal_data->timer_t306; - } - - cfg.t.cfg.s.inDLSAP.tmr.t307.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t307.val = 35; - - if (signal_data->timer_t307 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t307.val = signal_data->timer_t307; - } - - cfg.t.cfg.s.inDLSAP.tmr.t308.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t308.val = 4; - cfg.t.cfg.s.inDLSAP.tmr.t310.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t310.val = 120; - - if (signal_data->timer_t308 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t308.val = signal_data->timer_t308; - } - - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.inDLSAP.tmr.t312.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t312.val = cfg.t.cfg.s.inDLSAP.tmr.t303.val+2; - } else { - cfg.t.cfg.s.inDLSAP.tmr.t312.enb = FALSE; - } - - if (signal_data->timer_t310 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t310.val = signal_data->timer_t310; - } - - if (signal_data->timer_t312 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t312.val = signal_data->timer_t312; - } - - cfg.t.cfg.s.inDLSAP.tmr.t313.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t313.val = 4; - - if (signal_data->timer_t313 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t313.val = signal_data->timer_t313; - } - - cfg.t.cfg.s.inDLSAP.tmr.t316.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t316.val = 120; - - if (signal_data->timer_t316 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t316.val = signal_data->timer_t316; - } - - cfg.t.cfg.s.inDLSAP.tmr.t316c.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t316c.val = 35; - - cfg.t.cfg.s.inDLSAP.tmr.t318.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t318.val = 4; - - if (signal_data->timer_t318 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t318.val = signal_data->timer_t318; - } - - cfg.t.cfg.s.inDLSAP.tmr.t319.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t319.val = 4; - - if (signal_data->timer_t319 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t319.val = signal_data->timer_t319; - } - - cfg.t.cfg.s.inDLSAP.tmr.t322.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t322.val = 4; - - if (signal_data->timer_t322 > 0) { - cfg.t.cfg.s.inDLSAP.tmr.t322.val = signal_data->timer_t322; - } - - cfg.t.cfg.s.inDLSAP.tmr.t332.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t332.val = 35; - - cfg.t.cfg.s.inDLSAP.tmr.tRst.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.tRst.val = 8; - - cfg.t.cfg.s.inDLSAP.tmr.tAns.enb = FALSE; /* non-standard timer */ - cfg.t.cfg.s.inDLSAP.tmr.t396.enb = FALSE; /* non-standard timer */ - cfg.t.cfg.s.inDLSAP.tmr.t397.enb = TRUE; /* non-standard timer */ - cfg.t.cfg.s.inDLSAP.tmr.tProg.enb= TRUE; - cfg.t.cfg.s.inDLSAP.tmr.tProg.val= 35; -#ifdef NI2 -#ifdef NI2_TREST - cfg.t.cfg.s.inDLSAP.tmr.tRest.enb= FALSE; - cfg.t.cfg.s.inDLSAP.tmr.tRest.val= 35; /* tRest timer for NI2 */ -#endif /* NI2_TREST */ -#endif /* NI2 */ - - cfg.t.cfg.s.inDLSAP.dstEnt = ENTLD; - cfg.t.cfg.s.inDLSAP.dstInst = S_INST; - cfg.t.cfg.s.inDLSAP.dstProcId = SFndProcId(); - cfg.t.cfg.s.inDLSAP.prior = PRIOR0; - cfg.t.cfg.s.inDLSAP.route = RTESPEC; - cfg.t.cfg.s.inDLSAP.selector = 0; - cfg.t.cfg.s.inDLSAP.mem.region = S_REG; - cfg.t.cfg.s.inDLSAP.mem.pool = S_POOL; - - switch (span->trunk_type) { - case FTDM_TRUNK_E1: - cfg.t.cfg.s.inDLSAP.dChannelNum = 16; - cfg.t.cfg.s.inDLSAP.nmbBearChan = NUM_E1_CHANNELS_PER_SPAN; - cfg.t.cfg.s.inDLSAP.firstBChanNum = 0; - cfg.t.cfg.s.inDLSAP.callRefLen = 2; - cfg.t.cfg.s.inDLSAP.teiAlloc = IN_STATIC; - cfg.t.cfg.s.inDLSAP.intCfg = IN_INTCFG_PTPT; - break; - case FTDM_TRUNK_T1: - case FTDM_TRUNK_J1: - /* if NFAS, could be 0 if no signalling */ - cfg.t.cfg.s.inDLSAP.callRefLen = 2; - cfg.t.cfg.s.inDLSAP.teiAlloc = IN_STATIC; - cfg.t.cfg.s.inDLSAP.intCfg = IN_INTCFG_PTPT; - cfg.t.cfg.s.inDLSAP.firstBChanNum = 1; - - if (signal_data->nfas.trunk) { - if (signal_data->nfas.sigchan == SNGISDN_NFAS_DCHAN_PRIMARY || - signal_data->nfas.sigchan == SNGISDN_NFAS_DCHAN_BACKUP) { - - cfg.t.cfg.s.inDLSAP.dChannelNum = 24; - cfg.t.cfg.s.inDLSAP.nmbBearChan = NUM_T1_CHANNELS_PER_SPAN - 1; - } else { - cfg.t.cfg.s.inDLSAP.dChannelNum = 0; - cfg.t.cfg.s.inDLSAP.nmbBearChan = NUM_T1_CHANNELS_PER_SPAN; - } - } else { - cfg.t.cfg.s.inDLSAP.dChannelNum = 24; - cfg.t.cfg.s.inDLSAP.nmbBearChan = NUM_T1_CHANNELS_PER_SPAN; - cfg.t.cfg.s.inDLSAP.firstBChanNum = 1; - } - break; - case FTDM_TRUNK_BRI: - cfg.t.cfg.s.inDLSAP.dChannelNum = 0; /* Unused for BRI */ - cfg.t.cfg.s.inDLSAP.nmbBearChan = NUM_BRI_CHANNELS_PER_SPAN; - cfg.t.cfg.s.inDLSAP.firstBChanNum = 1; - cfg.t.cfg.s.inDLSAP.callRefLen = 1; - cfg.t.cfg.s.inDLSAP.teiAlloc = IN_STATIC; - cfg.t.cfg.s.inDLSAP.intCfg = IN_INTCFG_PTPT; - break; - case FTDM_TRUNK_BRI_PTMP: - cfg.t.cfg.s.inDLSAP.dChannelNum = 0; /* Unused for BRI */ - cfg.t.cfg.s.inDLSAP.nmbBearChan = NUM_BRI_CHANNELS_PER_SPAN; - cfg.t.cfg.s.inDLSAP.firstBChanNum = 1; - cfg.t.cfg.s.inDLSAP.callRefLen = 1; - cfg.t.cfg.s.inDLSAP.teiAlloc = IN_DYNAMIC; - cfg.t.cfg.s.inDLSAP.intCfg = IN_INTCFG_MULTI; - break; - default: - ftdm_log(FTDM_LOG_ERROR, "%s: Unsupported trunk_type\n", span->name); - return FTDM_FAIL; - } - - if (sng_isdn_q931_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span) -{ - InMngmt cfg; - Pst pst; - uint8_t i; - uint8_t numCes=1; - - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - if (span->trunk_type == FTDM_TRUNK_BRI_PTMP && signal_data->signalling == SNGISDN_SIGNALING_NET) { - numCes = 8; - } - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTIN; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTIN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STDLC; - - cfg.hdr.response.selector=0; - - cfg.t.cfg.s.inLCe.sapId = signal_data->link_id; - - if (span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - /* Stack will send Restart CFM's each time link is established (TEI negotiated), - and we do not want thi s event */ - cfg.t.cfg.s.inLCe.lnkUpDwnInd = FALSE; - } else { - cfg.t.cfg.s.inLCe.lnkUpDwnInd = TRUE; - } - - if (FTDM_SPAN_IS_BRI(span)) { - /* tCon Timer causes unwanted hangup on BRI links - where the Q.921 link goes into disconnected - state when idle. */ - - cfg.t.cfg.s.inLCe.tCon.enb = FALSE; - cfg.t.cfg.s.inLCe.tCon.val = 0; - } else { - cfg.t.cfg.s.inLCe.tCon.enb = TRUE; - cfg.t.cfg.s.inLCe.tCon.val = 35; - } - - cfg.t.cfg.s.inLCe.tDisc.enb = TRUE; - cfg.t.cfg.s.inLCe.tDisc.val = 35; - cfg.t.cfg.s.inLCe.t314.enb = FALSE; /* if segmentation enabled, set to TRUE */ - cfg.t.cfg.s.inLCe.t314.val = 35; - - if (signal_data->nfas.trunk) { - cfg.t.cfg.s.inLCe.t332i.enb = TRUE; - cfg.t.cfg.s.inLCe.t332i.val = 35; - } else { - cfg.t.cfg.s.inLCe.t332i.enb = FALSE; - cfg.t.cfg.s.inLCe.t332i.val = 35; - } - -#if (ISDN_NI1 || ISDN_NT || ISDN_ATT) - cfg.t.cfg.s.inLCe.tSpid.enb = TRUE; - cfg.t.cfg.s.inLCe.tSpid.val = 5; - - /* In case we want to support BRI - NORTH America, we will need to configure 8 spid's per CES */ - cfg.t.cfg.s.inLCe.spid.pres = NOTPRSNT; - cfg.t.cfg.s.inLCe.spid.len = 0; -#endif - cfg.t.cfg.s.inLCe.tRstAck.enb = TRUE; - cfg.t.cfg.s.inLCe.tRstAck.val = 10; - - cfg.t.cfg.s.inLCe.usid = 0; - cfg.t.cfg.s.inLCe.tid = 0; - - for(i=0;isignal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTCC; - - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); - - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTCC; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STTSAP; - - cfg.t.cfg.s.ccISAP.pst.srcProcId = SFndProcId(); - cfg.t.cfg.s.ccISAP.pst.srcEnt = ENTCC; - cfg.t.cfg.s.ccISAP.pst.srcInst = S_INST; - cfg.t.cfg.s.ccISAP.pst.dstEnt = ENTIN; - cfg.t.cfg.s.ccISAP.pst.dstInst = S_INST; - cfg.t.cfg.s.ccISAP.pst.dstProcId = SFndProcId(); - - cfg.t.cfg.s.ccISAP.pst.prior = PRIOR0; - cfg.t.cfg.s.ccISAP.pst.route = RTESPEC; - cfg.t.cfg.s.ccISAP.pst.region = S_REG; - cfg.t.cfg.s.ccISAP.pst.pool = S_POOL; - cfg.t.cfg.s.ccISAP.pst.selector = 0; - - cfg.t.cfg.s.ccISAP.suId = signal_data->cc_id; - cfg.t.cfg.s.ccISAP.spId = signal_data->cc_id; - - cfg.t.cfg.s.ccISAP.swtch = sng_isdn_stack_switchtype(signal_data->switchtype); - cfg.t.cfg.s.ccISAP.sapType = SNG_SAP_TYPE_ISDN; - - if (sng_isdn_cc_config(&pst, &cfg)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -/* TODO: see if we can move this to inside the library */ -void stack_pst_init(Pst *pst) -{ - memset(pst, 0, sizeof(Pst)); - /*fill in the post structure*/ - pst->dstProcId = SFndProcId(); - pst->dstInst = S_INST; - - pst->srcProcId = SFndProcId(); - pst->srcEnt = ENTSM; - pst->srcInst = S_INST; - - pst->prior = PRIOR0; - pst->route = RTESPEC; - pst->region = S_REG; - pst->pool = S_POOL; - pst->selector = 0; - return; -} - - - -void stack_hdr_init(Header *hdr) -{ - hdr->msgType = 0; - hdr->msgLen = 0; - hdr->entId.ent = 0; - hdr->entId.inst = 0; - hdr->elmId.elmnt = 0; - hdr->elmId.elmntInst1 = 0; - hdr->elmId.elmntInst2 = 0; - hdr->elmId.elmntInst3 = 0; - hdr->seqNmb = 0; - hdr->version = 0; - hdr->response.prior = PRIOR0; - hdr->response.route = RTESPEC; - hdr->response.mem.region = S_REG; - hdr->response.mem.pool = S_POOL; - hdr->transId = 0; - hdr->response.selector = 0; - return; -} - -uint8_t sng_isdn_stack_switchtype(sngisdn_switchtype_t switchtype) -{ - switch (switchtype) { - case SNGISDN_SWITCH_NI2: - return SW_NI2; - case SNGISDN_SWITCH_5ESS: - return SW_ATT5EP; - case SNGISDN_SWITCH_4ESS: - return SW_ATT4E; - case SNGISDN_SWITCH_DMS100: - return SW_NTDMS100P; - case SNGISDN_SWITCH_EUROISDN: - return SW_ETSI; - case SNGISDN_SWITCH_QSIG: - return SW_QSIG; - case SNGISDN_SWITCH_INSNET: - return SW_INSNET; - case SNGISDN_SWITCH_INVALID: - ftdm_log(FTDM_LOG_ERROR, "Invalid switchtype: %d\n", switchtype); - break; - } - return 0; -} - -/* 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/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c deleted file mode 100644 index 6a944e28bb..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ftmod_sangoma_isdn.h" - -void stack_resp_hdr_init(Header *hdr); - -ftdm_status_t sngisdn_activate_phy(ftdm_span_t *span); -ftdm_status_t sngisdn_deactivate_phy(ftdm_span_t *span); - -ftdm_status_t sngisdn_activate_cc(ftdm_span_t *span); - -ftdm_status_t sngisdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction); -ftdm_status_t sngisdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t subaction); - - -extern ftdm_sngisdn_data_t g_sngisdn_data; - -ftdm_status_t sngisdn_stack_stop(ftdm_span_t *span); - - -ftdm_status_t sngisdn_stack_start(ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - if (signal_data->dchan) { - if (sngisdn_cntrl_q921(span, ABND_ENA, NOTUSED) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to activate stack q921\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:Stack q921 activated\n", span->name); - } - - /* Try to find an alternative for this */ - /* LAPD will call LdUiDatBndCfm before it received a LdLiMacBndCfm from L1, - so we need to give some time before activating q931, as q931 will send a - LdUiDatConReq when activated, and this requires the Mac SAP to be already - bound first */ - ftdm_sleep(500); - - if (!g_sngisdn_data.ccs[signal_data->cc_id].activation_done) { - g_sngisdn_data.ccs[signal_data->cc_id].activation_done = 1; - if (sngisdn_activate_cc(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to activate stack CC\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:Stack CC activated\n", span->name); - } - - if (sngisdn_cntrl_q931(span, ABND_ENA, SAELMNT) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to activate stack q931\n", span->name); - return FTDM_FAIL; - } - ftdm_log(FTDM_LOG_DEBUG, "%s:Stack q931 activated\n", span->name); - - ftdm_log(FTDM_LOG_INFO, "%s:Stack activated\n",span->name); - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_stack_stop(ftdm_span_t *span) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* Stop L1 first, so we do not receive any more frames */ - if (!signal_data->dchan) { - return FTDM_SUCCESS; - } - if (sngisdn_deactivate_phy(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack phy\n", span->name); - return FTDM_FAIL; - } - - if (sngisdn_cntrl_q931(span, AUBND_DIS, SAELMNT) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack q931\n", span->name); - return FTDM_FAIL; - } - - if (sngisdn_cntrl_q921(span, AUBND_DIS, SAELMNT) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack q921\n", span->name); - return FTDM_FAIL; - } - - ftdm_log(FTDM_LOG_INFO, "%s:Signalling stopped\n", span->name); - return FTDM_SUCCESS; -} - - -ftdm_status_t sngisdn_activate_phy(ftdm_span_t *span) -{ - - /* There is no need to start phy, as it will Q921 will send a activate request to phy when it starts */ - - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_deactivate_phy(ftdm_span_t *span) -{ - L1Mngmt cntrl; - Pst pst; - - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTL1; - - /* initalize the control structure */ - memset(&cntrl, 0, sizeof(cntrl)); - - /* initalize the control header */ - stack_hdr_init(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* configuration */ - cntrl.hdr.entId.ent = ENTL1; /* entity */ - cntrl.hdr.entId.inst = S_INST; /* instance */ - cntrl.hdr.elmId.elmnt = STTSAP; /* SAP Specific cntrl */ - - cntrl.t.cntrl.action = AUBND_DIS; - cntrl.t.cntrl.subAction = SAELMNT; - - cntrl.t.cntrl.sapId = signal_data->link_id; - - if (sng_isdn_phy_cntrl(&pst, &cntrl)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span) -{ - L1Mngmt cntrl; - Pst pst; - - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTL1; - - /* initalize the control structure */ - memset(&cntrl, 0, sizeof(cntrl)); - - /* initalize the control header */ - stack_hdr_init(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* configuration */ - cntrl.hdr.entId.ent = ENTL1; /* entity */ - cntrl.hdr.entId.inst = S_INST; /* instance */ - cntrl.hdr.elmId.elmnt = STTSAP; /* SAP Specific cntrl */ - - cntrl.t.cntrl.action = AENA; - cntrl.t.cntrl.subAction = SAELMNT; - - cntrl.t.cntrl.sapId = signal_data->link_id; - - if (sng_isdn_phy_cntrl(&pst, &cntrl)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_activate_cc(ftdm_span_t *span) -{ - CcMngmt cntrl; - Pst pst; - - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTCC; - - /* initalize the control structure */ - memset(&cntrl, 0, sizeof(cntrl)); - - /* initalize the control header */ - stack_hdr_init(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* configuration */ - cntrl.hdr.entId.ent = ENTCC; /* entity */ - cntrl.hdr.entId.inst = S_INST; /* instance */ - cntrl.hdr.elmId.elmnt = STTSAP; /* physical sap */ - - cntrl.t.cntrl.action = ABND_ENA; - cntrl.t.cntrl.subAction = SAELMNT; - - cntrl.t.cntrl.sapId = signal_data->cc_id; - if (sng_isdn_cc_cntrl(&pst, &cntrl)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt) -{ - sngisdn_span_data_t *signal_data = sngisdn_dchan((sngisdn_span_data_t*)span->signal_data); - - if (!signal_data) { - ftdm_log(FTDM_LOG_ERROR, "%s:Span is not used by signalling module\n", span->name); - return FTDM_FAIL; - } - - switch (trace_opt) { - case SNGISDN_TRACE_DISABLE: - if (sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q921)) { - ftdm_log(FTDM_LOG_INFO, "%s:Disabling q921 trace\n", signal_data->ftdm_span->name); - sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q921); - - if (sngisdn_cntrl_q921(signal_data->ftdm_span, ADISIMM, SATRC) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_INFO, "%s:Failed to disable q921 trace\n", signal_data->ftdm_span->name); - } - } - if (sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q931)) { - ftdm_log(FTDM_LOG_INFO, "%s:Disabling q921 trace\n", signal_data->ftdm_span->name); - sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q931); - - if (sngisdn_cntrl_q931(signal_data->ftdm_span, ADISIMM, SATRC) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_INFO, "%s:Failed to disable q921 trace\n", signal_data->ftdm_span->name); - } - } - break; - case SNGISDN_TRACE_Q921: - if (!sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q921)) { - ftdm_log(FTDM_LOG_INFO, "%s:Enabling q921 trace\n", signal_data->ftdm_span->name); - sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q921); - - if (sngisdn_cntrl_q921(signal_data->ftdm_span, AENA, SATRC) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_INFO, "%s:Failed to enable q921 trace\n", signal_data->ftdm_span->name); - } - } - break; - case SNGISDN_TRACE_Q931: - if (!sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q931)) { - ftdm_log(FTDM_LOG_INFO, "s%d Enabling q931 trace\n", signal_data->link_id); - sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q931); - - if (sngisdn_cntrl_q931(signal_data->ftdm_span, AENA, SATRC) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_INFO, "%s:Failed to enable q931 trace\n", signal_data->ftdm_span->name); - } - } - break; - } - return FTDM_SUCCESS; -} - - -ftdm_status_t sngisdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction) -{ - InMngmt cntrl; - Pst pst; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTIN; - - /* initalize the control structure */ - memset(&cntrl, 0, sizeof(cntrl)); - - /* initalize the control header */ - stack_hdr_init(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* configuration */ - cntrl.hdr.entId.ent = ENTIN; /* entity */ - cntrl.hdr.entId.inst = S_INST; /* instance */ - cntrl.hdr.elmId.elmnt = STDLSAP; /* physical sap */ - - cntrl.t.cntrl.action = action; - cntrl.t.cntrl.subAction = subaction; - - if (action == AENA && subaction == SATRC) { - cntrl.t.cntrl.trcLen = -1; /* Trace the entire message buffer */ - } - - cntrl.t.cntrl.sapId = signal_data->link_id; - cntrl.t.cntrl.ces = 0; - - if(sng_isdn_q931_cntrl(&pst, &cntrl)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; - -} - -ftdm_status_t sngisdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t subaction) -{ - BdMngmt cntrl; - Pst pst; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTLD; - - /* initalize the control structure */ - memset(&cntrl, 0, sizeof(cntrl)); - - /* initalize the control header */ - stack_hdr_init(&cntrl.hdr); - /* build control request */ - cntrl.hdr.msgType = TCNTRL; - cntrl.hdr.entId.ent = ENTLD; - cntrl.hdr.entId.inst = S_INST; - -#if (SMBD_LMINT3 || BD_LMINT3) - stack_resp_hdr_init(&cntrl.hdr); -#endif /* _LMINT3 */ - - cntrl.hdr.elmId.elmnt = STMSAP; - cntrl.t.cntrl.action = action; - cntrl.t.cntrl.subAction = subaction; - -#if (SMBD_LMINT3 || BD_LMINT3) - cntrl.t.cntrl.lnkNmb = signal_data->link_id; - cntrl.t.cntrl.sapi = NOTUSED; - cntrl.t.cntrl.tei = NOTUSED; -#else /* _LMINT3 */ - cntrl.hdr.elmId.elmntInst1 = signal_data->link_id; - cntrl.hdr.elmId.elmntInst2 = NOTUSED; - cntrl.hdr.elmId.elmntInst3 = NOTUSED; -#endif /* _LMINT3 */ - - cntrl.t.cntrl.logInt = NOTUSED; - cntrl.t.cntrl.trcLen = NOTUSED; - if (action == AENA && subaction == SATRC) { - cntrl.t.cntrl.trcLen = -1; /* Trace the entire message buffer */ - } - - SGetDateTime(&(cntrl.t.cntrl.dt)); - if(sng_isdn_q921_cntrl(&pst, &cntrl)) { - return FTDM_FAIL; - } - - return FTDM_SUCCESS; -} - - -void stack_resp_hdr_init(Header *hdr) -{ - hdr->response.selector = 0; - hdr->response.mem.region = RTESPEC; - hdr->response.mem.pool = S_POOL; - hdr->response.prior = PRIOR0; - hdr->response.route = RTESPEC; - - return; -} - - - -/* 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/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c deleted file mode 100644 index 688c083adb..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ /dev/null @@ -1,1437 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ftmod_sangoma_isdn.h" -static ftdm_status_t sngisdn_cause_val_requires_disconnect(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn); -static ftdm_status_t sngisdn_bring_down(ftdm_channel_t *ftdmchan); - -/* Remote side transmit a SETUP */ -void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) -{ - unsigned i; - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - int16_t dChan = sngisdn_event->dChan; - uint8_t ces = sngisdn_event->ces; - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ConEvnt *conEvnt = &sngisdn_event->event.conEvnt; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_DOWN: /* Proper state to receive a SETUP */ - if (signal_data->nfas.trunk) { - ftdm_alarm_flag_t alarmflag = 0; - - ftdm_channel_get_alarms(ftdmchan, &alarmflag); - if (alarmflag) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Received SETUP but channel has physical layer alarm - rejecting\n"); - - ftdmchan->caller_data.hangup_cause = 0x2C; /* Channel requested not available */ - ftdm_sched_timer(signal_data->sched, "delayed_release", 1, sngisdn_delayed_release, (void*) sngisdn_info, NULL); - break; - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) || - ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Received SETUP but channel is in USE, saving call for later processing\n"); - /* the flag the channel as having a collision */ - sngisdn_set_flag(sngisdn_info, FLAG_GLARE); - - /* save the SETUP for processing once the channel has gone to DOWN */ - memcpy(&sngisdn_info->glare.setup, conEvnt, sizeof(*conEvnt)); - sngisdn_info->glare.suId = suId; - sngisdn_info->glare.suInstId = suInstId; /* Do not generate a suInstId now, we will generate when glared call gets extracted */ - sngisdn_info->glare.spInstId = spInstId; - sngisdn_info->glare.dChan = dChan; - sngisdn_info->glare.ces = ces; - break; - } - - sngisdn_info->suInstId = get_unique_suInstId(suId); - sngisdn_info->spInstId = spInstId; - - if (conEvnt->cdPtyNmb.eh.pres && signal_data->num_local_numbers) { - uint8_t local_number_matched = 0; - for (i = 0 ; i < signal_data->num_local_numbers ; i++) { - if (!strcmp(signal_data->local_numbers[i], (char*)conEvnt->cdPtyNmb.nmbDigits.val)) { - local_number_matched++; - break; - } - } - if (!local_number_matched) { - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SETUP, but local-number %s does not match - ignoring\n", conEvnt->cdPtyNmb.nmbDigits.val); - /* Special case to tell the stack to clear all internal resources about this call. We will no receive any event for this call after sending disconnect request */ - ftdmchan->caller_data.hangup_cause = IN_CCNORTTODEST; - ftdm_sched_timer(signal_data->sched, "delayed_disconnect", 1, sngisdn_delayed_disconnect, (void*) sngisdn_info, NULL); - return; - } - } - - /* If this is a glared call that was previously saved, we moved - all the info to the current call, so clear the glared saved data */ - if (sngisdn_info->glare.spInstId == spInstId) { - clear_call_glare_data(sngisdn_info); - } - - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - sngisdn_info->ces = ces; - } - } - - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); - - /* try to open the channel */ - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to open channel"); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - break; - } - - /* Fill in call information */ -#ifdef NETBORDER_CALL_REF - get_callref(ftdmchan, &conEvnt->callRef); -#endif - get_calling_num(ftdmchan, &conEvnt->cgPtyNmb); - get_calling_num2(ftdmchan, &conEvnt->cgPtyNmb2); - get_called_num(ftdmchan, &conEvnt->cdPtyNmb); - get_redir_num(ftdmchan, &conEvnt->redirNmb); - get_calling_subaddr(ftdmchan, &conEvnt->cgPtySad); - get_prog_ind_ie(ftdmchan, &conEvnt->progInd); - get_facility_ie(ftdmchan, &conEvnt->facilityStr); - get_calling_name(ftdmchan, conEvnt); - get_network_specific_fac(ftdmchan, &conEvnt->netFac[0]); - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); - - if (conEvnt->bearCap[0].eh.pres) { - ftdmchan->caller_data.bearer_layer1 = sngisdn_get_usrInfoLyr1Prot_from_stack(conEvnt->bearCap[0].usrInfoLyr1Prot.val); - ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val); - } - - if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { - if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { - uint8_t encoding = (conEvnt->ni2OctStr.str.val[2] >> 5); - if (encoding == 0 || encoding == 1) { - /* BCD even or BCD odd */ - uint8_t value = (conEvnt->ni2OctStr.str.val[3] & 0x0F)*10 + ((conEvnt->ni2OctStr.str.val[3] >> 4) & 0x0F); - snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", value); - } else if (encoding == 2) { - /* IA 5 */ - snprintf(ftdmchan->caller_data.aniII, 5, "%c", conEvnt->ni2OctStr.str.val[3]); - } - } - } - -#if 1 - /* this section will not be needed once asn decoding function with key-value pairs is implemented */ - if (signal_data->facility == SNGISDN_OPT_TRUE && - signal_data->facility_ie_decode != SNGISDN_OPT_FALSE && - conEvnt->facilityStr.eh.pres) { - - /* Verify whether the Caller Name will come in a subsequent FACILITY message */ - uint16_t ret_val; - char retrieved_str[255]; - - ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); - /* - return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ - - if (ret_val == 1) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); - /* Launch timer in case we never get a FACILITY msg */ - if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, - sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_CHAN_TIMER_FACILITY]); - } - break; - } else if (ret_val == 0) { - strcpy(ftdmchan->caller_data.cid_name, retrieved_str); - } - } -#endif - if (signal_data->overlap_dial == SNGISDN_OPT_TRUE) { - ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits; - ftdm_size_t num_digits; - - num_digits = strlen(ftdmchan->caller_data.dnis.digits); - - if (conEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } else { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - } - } else { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - break; - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Processing SETUP in %s state, saving SETUP info for later processing\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_assert(!sngisdn_test_flag(sngisdn_info, FLAG_GLARE), "Trying to save GLARE info, but we already had a glare\n"); - - sngisdn_set_flag(sngisdn_info, FLAG_GLARE); - - /* save the SETUP for processing once the channel has gone to DOWN */ - memcpy(&sngisdn_info->glare.setup, conEvnt, sizeof(*conEvnt)); - sngisdn_info->glare.suId = suId; - sngisdn_info->glare.suInstId = suInstId; /* Do not generate a suInstId now, we will generate when glared call gets extracted */ - sngisdn_info->glare.spInstId = spInstId; - sngisdn_info->glare.dChan = dChan; - sngisdn_info->glare.ces = ces; - - break; - case FTDM_CHANNEL_STATE_DIALING: /* glare */ - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - /* Save inbound call info so we can send a RELEASE when this channel goes to a different state */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Processing SETUP in DIALING state, rejecting inbound call\n"); - sngisdn_set_flag(sngisdn_info, FLAG_DELAYED_REL); - - sngisdn_info->glare.suId = suId; - sngisdn_info->glare.suInstId = get_unique_suInstId(suId); - sngisdn_info->glare.spInstId = spInstId; - - sngisdn_info->glare.dChan = dChan; - sngisdn_info->glare.ces = ces; - ftdmchan->caller_data.hangup_cause = 0x2C; /* Channel requested not available */ - ftdm_sched_timer(signal_data->sched, "delayed_release", 1, sngisdn_delayed_release, (void*) sngisdn_info, NULL); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Processing SETUP in DIALING state, saving SETUP info for later processing\n"); - - /* the flag the channel as having a collision */ - ftdm_assert(!sngisdn_test_flag(sngisdn_info, FLAG_GLARE), "Trying to save GLARE info, but we already had a glare"); - sngisdn_set_flag(sngisdn_info, FLAG_GLARE); - - /* save the SETUP for processing once the channel has gone to DOWN */ - memcpy(&sngisdn_info->glare.setup, conEvnt, sizeof(*conEvnt)); - sngisdn_info->glare.suId = suId; - sngisdn_info->glare.suInstId = suInstId; /* Do not generate a suInstId now, we will generate when glared call gets extracted */ - sngisdn_info->glare.spInstId = spInstId; - sngisdn_info->glare.dChan = dChan; - sngisdn_info->glare.ces = ces; - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - } - break; - case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing SETUP in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - break; - } - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -/* Remote side transmit a CONNECT or CONNECT ACK */ -void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - uint8_t ces = sngisdn_event->ces; - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing CONNECT/CONNECT ACK (suId:%u suInstId:%u spInstId:%u ces:%d)\n", suId, suInstId, spInstId, ces); - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && - ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->signalling == SNGISDN_SIGNALING_NET) { - - if(sngisdn_info->ces == CES_MNGMNT) { - /* We assign the call to the first TE */ - sngisdn_info->ces = ces; - } else { - /* We already assigned this call, do nothing */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call already assigned, ignoring connect\n"); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_RINGING: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_DIALING: -#ifdef NETBORDER_CALL_REF - get_callref(ftdmchan, &cnStEvnt->callRef); -#endif - get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); - get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - case FTDM_CHANNEL_STATE_HANGUP: - /* Race condition, we just hung up the call - ignore this message */ - break; - case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - - /* Start the disconnect procedure */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - } - } else { - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_TRANSFER: - case FTDM_CHANNEL_STATE_UP: - /* These are the only valid states we should get a CONNECT ACK on */ - /* do nothing */ - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* Race condition, We just hung up an incoming call right after we sent a CONNECT - ignore this message */ - break; - case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - - /* Start the disconnect procedure */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - } - } - - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - uint8_t ces = sngisdn_event->ces; - uint8_t evntType = sngisdn_event->evntType; - - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing %s (suId:%u suInstId:%u spInstId:%u ces:%d)\n", - (evntType == MI_ALERTING)?"ALERT": - (evntType == MI_CALLPROC)?"PROCEED": - (evntType == MI_PROGRESS)?"PROGRESS": - (evntType == MI_SETUPACK)?"SETUP ACK": - (evntType == MI_NOTIFY)?"NOTIFY": - (evntType == MI_INFO)?"INFO":"UNKNOWN", - suId, suInstId, spInstId, ces); - - switch(evntType) { - case MI_CALLPROC: - case MI_PROGRESS: - case MI_ALERTING: -#ifdef NETBORDER_CALL_REF - get_callref(ftdmchan, &cnStEvnt->callRef); -#endif - get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); - get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); - - if (sngisdn_cause_val_requires_disconnect(ftdmchan, &cnStEvnt->causeDgn[0]) == FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Cause requires disconnect (cause:%d)\n", cnStEvnt->causeDgn[0].causeVal.val); - ftdmchan->caller_data.hangup_cause = cnStEvnt->causeDgn[0].causeVal.val; - - sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - goto sngisdn_process_cnst_ind_end; - } - - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_DIALING: - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_RINGING: - if ((cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) || - (cnStEvnt->progInd1.eh.pres && cnStEvnt->progInd1.progDesc.val == IN_PD_IBAVAIL) || - (cnStEvnt->progInd2.eh.pres && cnStEvnt->progInd2.progDesc.val == IN_PD_IBAVAIL) || - (cnStEvnt->progInd3.eh.pres && cnStEvnt->progInd3.progDesc.val == IN_PD_IBAVAIL)) { - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media available\n"); - sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media not available\n"); - } - switch (evntType) { - case MI_CALLPROC: - if (!sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY) && - (signal_data->early_media_flags & SNGISDN_EARLY_MEDIA_ON_PROCEED)) { - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media override on proceed\n"); - sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); - } - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); - } - break; - case MI_ALERTING: - if (!sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY) && - (signal_data->early_media_flags & SNGISDN_EARLY_MEDIA_ON_ALERT)) { - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media override on alert\n"); - sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); - } - if (ftdmchan->state == FTDM_CHANNEL_STATE_PROCEED) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RINGING); - } - break; - case MI_PROGRESS: - if (!sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY) && - (signal_data->early_media_flags & SNGISDN_EARLY_MEDIA_ON_PROGRESS)) { - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media override on progress\n"); - sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); - } - if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else if (ftdmchan->state != FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - } - break; - default: - /* We should never reach this section !*/ - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle this event %d\n", evntType); - } - break; - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - /* We are already in progress media, we can't go to any higher state except up */ - /* Do nothing */ - break; - case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring ALERT/PROCEED/PROGRESS because channel is in RESET state\n"); - break; - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* Ignore this message as we already started the hangup process */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring ALERT/PROCEED/PROGRESS because we are already hanging up\n"); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing ALERT/PROCEED/PROGRESS in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - - /* Start the disconnect procedure */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - } - break; - case MI_SETUPACK: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Processing SETUP_ACK, but overlap sending not implemented (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - break; - case MI_INFO: - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing INFO (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - if (cnStEvnt->cdPtyNmb.eh.pres) { - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_COLLECT: - { - ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits; - ftdm_size_t num_digits; - - get_called_num(ftdmchan, &cnStEvnt->cdPtyNmb); - num_digits = strlen(ftdmchan->caller_data.dnis.digits); - - if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "received %"FTDM_SIZE_FMT" of %"FTDM_SIZE_FMT" digits\n", num_digits, min_digits); - } - } - break; - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_RINGING: - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Receiving more digits %s, but we already proceeded with call\n", cnStEvnt->cdPtyNmb.nmbDigits.val); - break; - case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled INFO (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - break; - } - } - break; - case MI_NOTIFY: - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing NOTIFY (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - /* Do nothing */ - break; - default: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Unhandled STATUS event\n"); - break; - } - -sngisdn_process_cnst_ind_end: - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_RINGING: - case FTDM_CHANNEL_STATE_DIALING: - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - get_facility_ie(ftdmchan, &discEvnt->facilityStr); - - if (discEvnt->causeDgn[0].eh.pres && discEvnt->causeDgn[0].causeVal.pres) { - ftdmchan->caller_data.hangup_cause = discEvnt->causeDgn[0].causeVal.val; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "DISCONNECT did not have a cause code\n"); - ftdmchan->caller_data.hangup_cause = 0; - } - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_REL); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - case FTDM_CHANNEL_STATE_COLLECT: - case FTDM_CHANNEL_STATE_GET_CALLERID: - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - break; - case FTDM_CHANNEL_STATE_DOWN: - /* somehow we are in down, nothing we can do locally */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Received DISCONNECT but we are in DOWN state\n"); - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* This is a race condition. We just sent a DISCONNECT, on this channel */ - /* Do nothing */ - break; - case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received DISCONNECT in an invalid state (%s)\n", - ftdm_channel_state2str(ftdmchan->state)); - /* start reset procedure */ - - /* Start the release procedure */ - ftdm_set_flag(sngisdn_info, FLAG_REMOTE_REL); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - } - - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - RelEvnt *relEvnt = &sngisdn_event->event.relEvnt; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing RELEASE/RELEASE COMPLETE (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); - - if ((suInstId && (sngisdn_info->glare.suInstId == suInstId)) || - (spInstId && (sngisdn_info->glare.spInstId == spInstId))) { - - /* This hangup is for a glared saved call */ - ftdm_clear_flag(sngisdn_info, FLAG_DELAYED_REL); - clear_call_glare_data(sngisdn_info); - - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* go to DOWN */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - break; - case FTDM_CHANNEL_STATE_DOWN: - /* do nothing, just drop the message */ - break; - case FTDM_CHANNEL_STATE_DIALING: - /* Remote side rejected our SETUP message on outbound call */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - sngisdn_set_span_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); - } - /* fall-through */ - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_RINGING: - /* If we previously had a glare on this channel, - this RELEASE could be for the previous call. Confirm whether call_data has - not changed while we were waiting for ftdmchan->mutex by comparing suInstId's */ - if (((sngisdn_chan_data_t*)ftdmchan->call_data)->suInstId == suInstId || - ((sngisdn_chan_data_t*)ftdmchan->call_data)->spInstId == spInstId) { - - get_facility_ie(ftdmchan, &relEvnt->facilityStr); - - if (relEvnt->causeDgn[0].eh.pres && relEvnt->causeDgn[0].causeVal.pres) { - ftdmchan->caller_data.hangup_cause = relEvnt->causeDgn[0].causeVal.val; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "cause:%d\n", ftdmchan->caller_data.hangup_cause); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "RELEASE COMPLETE did not have a cause code\n"); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL; - } - - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "RELEASE was for previous call (suInstId:%u spInstId:%u)\n", suInstId, spInstId); - } - break; - case FTDM_CHANNEL_STATE_COLLECT: - case FTDM_CHANNEL_STATE_GET_CALLERID: - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - break; - case FTDM_CHANNEL_STATE_TERMINATING: - if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE) && - sngisdn_info->glare.suInstId != suInstId) { - /* This release if for the outbound call that we already started clearing */ - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Received RELEASE for local glared call\n"); - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Received release before we could clear local call\n"); - /* FS core took too long to respond to the SIG STOP event */ - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - /* set abort flag so that we do not transmit another release complete on this channel once FS core is done */ - } - break; - case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing RELEASE but channel in RESET state, ignoring\n"); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received RELEASE in an invalid state (%s)\n", - ftdm_channel_state2str(ftdmchan->state)); - break; - } - - - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - /* Function does not require any info from infoEvnt struct for now */ - /* InfoEvnt *infoEvnt = &sngisdn_event->event.infoEvnt; */ - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DATA IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - /* Function does not require any info from ssHlEvnt struct for now */ - /* SsHlEvnt *ssHlEvnt = &sngisdn_event->event.ssHlEvnt; */ - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing SSHL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_sshl_cfm (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - /* Function does not require any info from ssHlEvnt struct for now */ - /* SsHlEvnt *ssHlEvnt = &sngisdn_event->event.ssHlEvnt; */ - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing SSHL CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - /* Function does not require any info from ssHlEvnt struct for now */ - /* RmRtEvnt *rmRtEvnt = &sngisdn_event->event.rmRtEvnt; */ - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing RESUME/RETRIEVE IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - /* Function does not require any info from ssHlEvnt struct for now */ - /* RmRtEvnt *rmRtEvnt = &sngisdn_event->event.rmRtEvnt; */ - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing RESUME/RETRIEVE CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - /* Function does not require any info from ssHlEvnt struct for now */ - /* StaEvnt *staEvnt = &sngisdn_event->event.staEvnt; */ - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FLOW CONTROL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - FacEvnt *facEvnt = &sngisdn_event->event.facEvnt; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - /* If Facility decoding is disabled, we do not care about current call state, just pass event up to user */ - if (facEvnt->facElmt.facStr.pres) { - get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2); - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_FACILITY); - } - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_GET_CALLERID: - /* Update the caller ID Name */ - - if (facEvnt->facElmt.facStr.pres) { - char retrieved_str[255]; - - /* return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ - - if (sng_isdn_retrieve_facility_caller_name(&facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len, retrieved_str) == 0) { - strcpy(ftdmchan->caller_data.cid_name, retrieved_str); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Failed to retrieve Caller Name from Facility IE\n"); - } - if (signal_data->facility_timeout) { - /* Cancel facility timeout */ - ftdm_sched_cancel_timer(signal_data->sched, sngisdn_info->timers[SNGISDN_CHAN_TIMER_FACILITY]); - } - } - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - break; - case FTDM_CHANNEL_STATE_RING: - /* We received the caller ID Name in FACILITY, but its too late, facility-timeout already occurred */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "FACILITY received, but we already proceeded with call\n"); - break; - case FTDM_CHANNEL_STATE_UP: - { - ftdm_sigmsg_t sigev; - if (facEvnt->facElmt.facStr.pres) { - get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2); - } - memset(&sigev, 0, sizeof(sigev)); - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - - sigev.event_id = FTDM_SIGEVENT_FACILITY; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } - break; - default: - /* We do not support other FACILITY types for now, so do nothing */ - break; - } - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - uint32_t suInstId = sngisdn_event->suInstId; - uint32_t spInstId = sngisdn_event->spInstId; - sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - StaEvnt *staEvnt = &sngisdn_event->event.staEvnt; - - uint8_t call_state = 0; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!suInstId && !spInstId) { - /* We already cleared this call */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dropping STATUS CONFIRM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - return; - } - - if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) { - call_state = staEvnt->callSte.callGlblSte.val; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing STATUS CONFIRM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); - - if (staEvnt->causeDgn[0].eh.pres && staEvnt->causeDgn[0].causeVal.pres) { - if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) { - call_state = staEvnt->callSte.callGlblSte.val; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Received STATUS without call state\n"); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - switch (staEvnt->causeDgn[0].causeVal.val) { - case FTDM_CAUSE_RESPONSE_TO_STATUS_ENQUIRY: - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Status Check OK:%d", call_state); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - case FTDM_CAUSE_WRONG_CALL_STATE: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Message incompatible with call state (call_state:%d channel-state:%s cause:%d) (suId:%u suInstId:%u spInstId:%u)\n", call_state, ftdm_channel_state2str(ftdmchan->state), staEvnt->causeDgn[0].causeVal.val, suId, suInstId, spInstId); - break; - case FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Recovery on timer expire (call_state:%d channel-state:%s cause:%d) (suId:%u suInstId:%u spInstId:%u)\n", call_state, ftdm_channel_state2str(ftdmchan->state), staEvnt->causeDgn[0].causeVal.val, suId, suInstId, spInstId); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "STATUS CONFIRM (call_state:%d channel-state:%s cause:%d) (suId:%u suInstId:%u spInstId:%u)\n", call_state, ftdm_channel_state2str(ftdmchan->state), staEvnt->causeDgn[0].causeVal.val, suId, suInstId, spInstId); - break; - } - - /* Section 4.3.30 from INT Interface - Service Definition */ - ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; - - switch(call_state) { - /* Sere ITU-T Q931 for definition of call states */ - case 0: /* Remote switch thinks there are no calls on this channel */ - if (sngisdn_bring_down(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - } - break; - case 1: - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - /* Remote side is still waiting for our CONNECT message */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_connect", 1, sngisdn_delayed_connect, (void*) sngisdn_info, NULL); - break; - } - /* Fall-through */ - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - case 2: /* overlap sending */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_COLLECT: - /* T302 Timeout reached */ - /* Send the call to user, and see if they accept it */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T302 Timer expired, proceeding with call\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - break; - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_RINGING: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Remote switch expecting OVERLAP receive, but we are already PROCEEDING\n"); - sngisdn_snd_disconnect(ftdmchan); - break; - case FTDM_CHANNEL_STATE_DOWN: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* We hung up locally, but remote switch doesn't know send disconnect again*/ - sngisdn_snd_disconnect(ftdmchan); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - case 3: - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_RINGING: - /* T310 timer has expired */ - ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T310 Timer expired, hanging up call\n"); - sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - - break; - case FTDM_CHANNEL_STATE_UP: - /* Remote side is still waiting for our CONNECT message */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_connect", 1, sngisdn_delayed_connect, (void*) sngisdn_info, NULL); - break; - } - /* Fall-through */ - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - case 8: /* Remote switch is in "Connect Request state" */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - /* This is ok. We sent a Connect, and we are waiting for a connect ack */ - /* Do nothing */ - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* We hung up locally, but remote switch doesn't know send disconnect again*/ - sngisdn_snd_disconnect(ftdmchan); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - case 9: /* Remote switch is in "Incoming call proceeding" state */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_RINGING: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_GET_CALLERID: - /* Do nothing */ - break; - case FTDM_CHANNEL_STATE_UP: - /* Remote switch missed our CONNECT message, re-send */ - ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_connect", 1, sngisdn_delayed_connect, (void*) sngisdn_info, NULL); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - case 10: /* Remote switch is in active state */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - /* This is ok, they are in active state and we are in active state */ - /* Do nothing */ - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* We sent a disconnect message, but remote side missed it ? */ - ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_disconnect", 1, sngisdn_delayed_disconnect, (void*) sngisdn_info, NULL); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - case 12: /* We received a disconnect indication */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_TERMINATING: - /* We are already waiting for user app to handle the disconnect, do nothing */ - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - case 22: - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - /* Stack is in the process of clearing the call*/ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* Do nothing as we will get a RELEASE COMPLETE */ - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - } - break; - case 25: /* Overlap receiving */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_COLLECT: - /* T302 Timeout reached */ - /* Send the call to user, and see if they accept it */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T302 Timer expired, proceeding with call\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - } - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - } - } - - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - - -void sngisdn_process_srv_ind (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - int16_t dChan = sngisdn_event->dChan; - uint8_t ces = sngisdn_event->ces; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - /* Function does not require any info from ssHlEvnt struct for now */ - /*Srv *srvEvnt = &sngisdn_event->event.srvEvnt;*/ - - ftdm_log(FTDM_LOG_DEBUG, "Processing SERVICE IND (suId:%u dChan:%d ces:%d)\n", suId, dChan, ces); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event) -{ - int16_t suId = sngisdn_event->suId; - int16_t dChan = sngisdn_event->dChan; - uint8_t ces = sngisdn_event->ces; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - /* Function does not require any info from ssHlEvnt struct for now */ - /*Srv *srvEvnt = &sngisdn_event->event.srvEvnt;*/ - - ftdm_log(FTDM_LOG_DEBUG, "Processing SERVICE CFM (suId:%u dChan:%d ces:%d)\n", suId, dChan, ces); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -static ftdm_status_t sngisdn_bring_down(ftdm_channel_t *ftdmchan) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; - ftdm_status_t status = FTDM_SUCCESS; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Bringing channel to DOWN state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_DOWN: - /* Do nothing */ - break; - case FTDM_CHANNEL_STATE_RESET: - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - break; - case FTDM_CHANNEL_STATE_COLLECT: - case FTDM_CHANNEL_STATE_DIALING: - case FTDM_CHANNEL_STATE_UP: - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - case FTDM_CHANNEL_STATE_TERMINATING: - /* We are already waiting for usr to respond to SIGEVENT stop. - FreeTDM already scheduled a timout in case the User does respond to - SIGEVENT_STOP, no need to do anything here */ - break; - case FTDM_CHANNEL_STATE_HANGUP: - /* This cannot happen, state_advance always sets - ftdmchan to STATE_HANGUP_COMPLETE when in STATE_HANGUP - and we called check_for_state_change earlier so something is very wrong here!!! */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "How can we we in FTDM_CHANNEL_STATE_HANGUP after checking for state change?\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* We were waiting for remote switch to send RELEASE COMPLETE - but this will not happen, so just clear local state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - break; - default: - status = FTDM_FAIL; - - } - return status; -} - -void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event) -{ - ftdm_signaling_status_t sigstatus; - int16_t suId = sngisdn_event->suId; - int16_t dChan = sngisdn_event->dChan; - uint8_t ces = sngisdn_event->ces; - uint8_t evntType = sngisdn_event->evntType; - uint8_t chan_no = 0; - Rst *rstEvnt = &sngisdn_event->event.rstEvnt; - - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[dChan]; - if (!signal_data) { - ftdm_log(FTDM_LOG_CRIT, "Received RESTART CFM on unconfigured span (suId:%d)\n", suId); - return; - } - - ftdm_log(FTDM_LOG_DEBUG, "%s: Processing RESTART CFM (suId:%u dChan:%d ces:%d %s(%d))\n", - signal_data->ftdm_span->name, - suId, dChan, ces, - (evntType == IN_LNK_DWN)?"LNK_DOWN": - (evntType == IN_LNK_UP)?"LNK_UP": - (evntType == IN_INDCHAN)?"b-channel": - (evntType == IN_LNK_DWN_DM_RLS)?"NFAS service procedures": - (evntType == IN_SWCHD_BU_DCHAN)?"NFAS switchover to backup":"Unknown", evntType); - - if (rstEvnt->rstInd.eh.pres == PRSNT_NODEF && rstEvnt->rstInd.rstClass.pres == PRSNT_NODEF) { - switch(rstEvnt->rstInd.rstClass.val) { - case IN_CL_INDCHAN: /* Indicated b-channel */ - if (rstEvnt->chanId.eh.pres) { - if (rstEvnt->chanId.intType.val == IN_IT_BASIC) { - if (rstEvnt->chanId.infoChanSel.pres == PRSNT_NODEF) { - chan_no = rstEvnt->chanId.infoChanSel.val; - } - } else if (rstEvnt->chanId.intType.val == IN_IT_OTHER) { - if (rstEvnt->chanId.chanNmbSlotMap.pres == PRSNT_NODEF) { - chan_no = rstEvnt->chanId.chanNmbSlotMap.val[0]; - } - } - - if (signal_data->nfas.trunk) { - if (!rstEvnt->chanId.intIdent.pres) { - ftdm_log(FTDM_LOG_CRIT, "Failed to determine interface from RESTART\n"); - return; - } else if (signal_data->nfas.interface_id != rstEvnt->chanId.intIdent.val) { - /* This RESTART is for another interface */ - return; - } - } - } - if (!chan_no) { - ftdm_log(FTDM_LOG_CRIT, "Failed to determine channel from RESTART\n"); - return; - } - break; - case IN_CL_SNGINT: /* Single interface */ - case IN_CL_ALLINT: /* All interfaces */ - /* In case restart class indicates all interfaces, we will duplicate - this event on each span associated to this d-channel in sngisdn_rcv_rst_cfm, - so treat it as a single interface anyway */ - chan_no = 0; - break; - default: - ftdm_log(FTDM_LOG_CRIT, "Invalid restart indicator class:%d\n", rstEvnt->rstInd.rstClass.val); - return; - } - } - - ftdm_span_get_sig_status(signal_data->ftdm_span, &sigstatus); - if (sigstatus == FTDM_SIG_STATE_DOWN) { - if (chan_no) { /* For a single channel */ - if (chan_no > ftdm_span_get_chan_count(signal_data->ftdm_span)) { - ftdm_log(FTDM_LOG_CRIT, "Received RESTART on invalid channel:%d\n", chan_no); - } else { - ftdm_channel_t *ftdmchan = ftdm_span_get_channel(signal_data->ftdm_span, chan_no); - sngisdn_bring_down(ftdmchan); - } - } else { /* for all channels */ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - sngisdn_bring_down((ftdm_channel_t*)ftdm_iterator_current(curr)); - } - ftdm_iterator_free(chaniter); - } - } - - ftdm_log(FTDM_LOG_DEBUG, "Processing RESTART CFM (suId:%u dChan:%d ces:%d type:%d)\n", suId, dChan, ces, evntType); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - - -/* The remote side sent us a RESTART Msg. Trillium automatically acks with RESTART ACK, but - we need to clear our call states if there is a call on this channel */ -void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event) -{ - uint8_t chan_no = 0; - int16_t suId = sngisdn_event->suId; - int16_t dChan = sngisdn_event->dChan; - uint8_t ces = sngisdn_event->ces; - uint8_t evntType = sngisdn_event->evntType; - Rst *rstEvnt = NULL; - sngisdn_span_data_t *signal_data = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - rstEvnt = &sngisdn_event->event.rstEvnt; - - signal_data = g_sngisdn_data.spans[dChan]; - - if (!signal_data) { - ftdm_log(FTDM_LOG_CRIT, "Received RESTART IND on unconfigured span (suId:%d)\n", suId); - return; - } - - if (signal_data->restart_timeout) { - ftdm_sched_cancel_timer(signal_data->sched, signal_data->timers[SNGISDN_SPAN_TIMER_RESTART]); - } - - ftdm_log(FTDM_LOG_DEBUG, "Processing RESTART IND (suId:%u dChan:%d ces:%d %s(%d))\n", suId, dChan, ces, - (evntType == IN_LNK_DWN)?"LNK_DOWN": - (evntType == IN_LNK_UP)?"LNK_UP": - (evntType == IN_INDCHAN)?"b-channel": - (evntType == IN_LNK_DWN_DM_RLS)?"NFAS service procedures": - (evntType == IN_SWCHD_BU_DCHAN)?"NFAS switchover to backup":"Unknown", evntType); - - if (rstEvnt->rstInd.eh.pres == PRSNT_NODEF && rstEvnt->rstInd.rstClass.pres == PRSNT_NODEF) { - switch(rstEvnt->rstInd.rstClass.val) { - case IN_CL_INDCHAN: /* Indicated b-channel */ - if (rstEvnt->chanId.eh.pres) { - if (rstEvnt->chanId.intType.val == IN_IT_BASIC) { - if (rstEvnt->chanId.infoChanSel.pres == PRSNT_NODEF) { - chan_no = rstEvnt->chanId.infoChanSel.val; - } - } else if (rstEvnt->chanId.intType.val == IN_IT_OTHER) { - if (rstEvnt->chanId.chanNmbSlotMap.pres == PRSNT_NODEF) { - chan_no = rstEvnt->chanId.chanNmbSlotMap.val[0]; - } - } - - if (signal_data->nfas.trunk) { - if (!rstEvnt->chanId.intIdent.pres) { - ftdm_log(FTDM_LOG_CRIT, "Failed to determine interface from RESTART\n"); - return; - } else if (signal_data->nfas.interface_id != rstEvnt->chanId.intIdent.val) { - /* This RESTART is for another interface */ - return; - } - } - } - if (!chan_no) { - ftdm_log(FTDM_LOG_CRIT, "Failed to determine channel from RESTART\n"); - return; - } - break; - case IN_CL_SNGINT: /* Single interface */ - case IN_CL_ALLINT: /* All interfaces */ - /* In case restart class indicates all interfaces, we will duplicated - this event on each span associated to this d-channel in sngisdn_rcv_rst_cfm, - so treat it as a single interface anyway */ - chan_no = 0; - break; - default: - ftdm_log(FTDM_LOG_CRIT, "Invalid restart indicator class:%d\n", rstEvnt->rstInd.rstClass.val); - return; - } - } - - if (chan_no) { /* For a single channel */ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - if (sngisdn_info->ces == ces && ftdmchan->physical_chan_id == chan_no) { - sngisdn_bring_down(ftdmchan); - } - } - ftdm_iterator_free(chaniter); - } else { /* for all channels */ - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - if (sngisdn_info->ces == ces) { - sngisdn_bring_down(ftdmchan); - } - } - ftdm_iterator_free(chaniter); - } - - - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -static ftdm_status_t sngisdn_cause_val_requires_disconnect(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (signal_data->ignore_cause_value == SNGISDN_OPT_TRUE) { - return FTDM_FAIL; - } - - /* By default, we only evaluate cause value on 5ESS switches */ - if (signal_data->ignore_cause_value == SNGISDN_OPT_DEFAULT && - signal_data->switchtype != SNGISDN_SWITCH_5ESS) { - - return FTDM_FAIL; - } - - /* ignore_cause_value = SNGISDN_OPT_FALSE or switchtype == 5ESS */ - switch(causeDgn->causeVal.val) { - case 17: /* User Busy */ - case 18: /* No User responding */ - case 19: /* User alerting, no answer */ - case 21: /* Call rejected, the called party does not with to accept this call */ - case 27: /* Destination out of order */ - case 31: /* Normal, unspecified */ - case 34: /* Circuit/Channel congestion */ - case 41: /* Temporary failure */ - case 42: /* Switching equipment is experiencing a period of high traffic */ - case 47: /* Resource unavailable */ - case 58: /* Bearer Capability not available */ - case 63: /* Service or option not available */ - case 65: /* Bearer Cap not implemented, not supported */ - case 79: /* Service or option not implemented, unspecified */ - return FTDM_SUCCESS; - } - return FTDM_FAIL; -} diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c deleted file mode 100644 index 9fc8ad1d82..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ /dev/null @@ -1,588 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ftmod_sangoma_isdn.h" - -void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) -{ - ConEvnt conEvnt; - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID}; - - ftdm_assert((!sngisdn_info->suInstId && !sngisdn_info->spInstId), "Trying to call out, but call data was not cleared\n"); - - sngisdn_info->suInstId = get_unique_suInstId(signal_data->cc_id); - sngisdn_info->spInstId = 0; - - ftdm_mutex_lock(g_sngisdn_data.ccs[signal_data->cc_id].mutex); - g_sngisdn_data.ccs[signal_data->cc_id].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[signal_data->cc_id].mutex); - - memset(&conEvnt, 0, sizeof(conEvnt)); - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN || signal_data->force_sending_complete == SNGISDN_OPT_TRUE) { - conEvnt.sndCmplt.eh.pres = PRSNT_NODEF; - } - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && - signal_data->signalling == SNGISDN_SIGNALING_NET) { - sngisdn_info->ces = CES_MNGMNT; - } - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); - - set_chan_id_ie(ftdmchan, &conEvnt.chanId); - set_bear_cap_ie(ftdmchan, &conEvnt.bearCap[0]); - set_called_num(ftdmchan, &conEvnt.cdPtyNmb); - set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); - set_calling_num2(ftdmchan, &conEvnt.cgPtyNmb2); - set_calling_subaddr(ftdmchan, &conEvnt.cgPtySad); - set_called_subaddr(ftdmchan, &conEvnt.cdPtySad); - set_redir_num(ftdmchan, &conEvnt.redirNmb); - set_calling_name(ftdmchan, &conEvnt); - set_network_specific_fac(ftdmchan, &conEvnt.netFac[0]); - - /* set_facility_ie will overwrite Calling Name for NI-2 if user specifies custom Facility IE */ - set_facility_ie(ftdmchan, &conEvnt.facilityStr); - set_prog_ind_ie(ftdmchan, &conEvnt.progInd, prog_ind); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - - if (sng_isdn_con_request(signal_data->cc_id, sngisdn_info->suInstId, &conEvnt, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused SETUP request\n"); - } - - return; -} - -/* Unsed only for overlap receive */ -void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan) -{ - CnStEvnt cnStEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending SETUP ACK , but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - return; - } - - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP ACK (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - - if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, MI_SETUPACK, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused SETUP ACK request\n"); - } - return; -} - - -/* Used only for BRI PTMP - This function is used when the NT side makes a call out, - and one or multiple TE's reply, then NT assigns the call by sending a con_complete*/ -void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) -{ - CnStEvnt cnStEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending CONNECT COMPL , but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - return; - } - - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - /* Indicate channel ID only in first response */ - if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT COMPL (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - - if(sng_isdn_con_comp(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused CONNECT ACK request\n"); - } - return; -} - - -void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) -{ - CnStEvnt cnStEvnt; - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { - return; - } - sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending PROGRESS, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - return; - } - - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - /* Indicate channel ID only in first response */ - if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); - } - set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); - set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - - if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, MI_CALLPROC, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused PROCEED request\n"); - } - return; -} - -void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) -{ - CnStEvnt cnStEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending PROGRESS, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - return; - } - - if (signal_data->switchtype == SNGISDN_SWITCH_INSNET) { - /* Trillium Q931 layer complains of invalid event when receiving PROGRESS in - INSNET variant, so PROGRESS event is probably invalid */ - return; - } - - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); - set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused PROGRESS request\n"); - } - return; -} - -void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) -{ - CnStEvnt cnStEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending ALERT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - return; - } - - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); - set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - - if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_ALERTING, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused ALERT request\n"); - } - return; -} - -void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) -{ - CnStEvnt cnStEvnt; - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; - - if (sngisdn_test_flag(sngisdn_info, FLAG_SENT_CONNECT)) { - return; - } - sngisdn_set_flag(sngisdn_info, FLAG_SENT_CONNECT); - - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending CONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - return; - } - - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - /* Indicate channel ID only in first response */ - if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); - } - set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); - set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused CONNECT request\n"); - } - return; -} - -void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan) -{ - FacEvnt facEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (!sngisdn_info->suInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending FACILITY, but no call data, ignoring (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - return; - } - - memset(&facEvnt, 0, sizeof(facEvnt)); - - if (set_facility_ie_str(ftdmchan, &facEvnt.facElmt.facStr.val[2], (uint8_t*)&facEvnt.facElmt.facStr.len) != FTDM_SUCCESS) { - /* No point in sending a FACILITY message if there is no Facility IE to transmit */ - return; - } - - facEvnt.facElmt.eh.pres = PRSNT_NODEF; - facEvnt.facElmt.facStr.pres = PRSNT_NODEF; - facEvnt.facElmt.facStr.val[0] = 0x1C; - facEvnt.facElmt.facStr.val[1] = (uint8_t)facEvnt.facElmt.facStr.len; - facEvnt.facElmt.facStr.len +=2; /* Need to include the size of identifier + len */ - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending FACILITY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - - if (sng_isdn_facility_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &facEvnt, MI_FACIL, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused FACILITY request\n"); - } - return; -} - -/* This is used to request Q.921 to initiate link establishment */ -void sngisdn_snd_dl_req(ftdm_channel_t *ftdmchan) -{ - CnStEvnt cnStEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Requesting Link establishment (suId:%d dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - - if (sng_isdn_con_status(signal_data->cc_id, 0, 0, &cnStEvnt, MI_INFO, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused Link establishment\n"); - } - return; -} - -void sngisdn_snd_notify_req(ftdm_channel_t *ftdmchan) -{ - CnStEvnt cnStEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending NOTIFY, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - return; - } - - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - set_not_ind_ie(ftdmchan, &cnStEvnt.notInd); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending NOTIFY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - - if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_NOTIFY, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused NOTIFY request\n"); - } - return; -} - - -void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan) -{ - StaEvnt staEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending STATUS ENQ\n"); - - memset(&staEvnt, 0, sizeof(StaEvnt)); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Status ENQ on suId:%d suInstId:%u spInstId:%d dchan:%d ces:%d\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_dchan(signal_data)->link_id, sngisdn_info->ces); - if (sng_isdn_status_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &staEvnt, MI_STATENQ)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused Status ENQ request\n"); - } - return; -} - - -void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) -{ - DiscEvnt discEvnt; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending DISCONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - return; - } - - memset(&discEvnt, 0, sizeof(discEvnt)); - - set_cause_ie(ftdmchan, &discEvnt.causeDgn[0]); - set_facility_ie(ftdmchan, &discEvnt.facilityStr); - set_user_to_user_ie(ftdmchan, &discEvnt.usrUsr); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused DISCONNECT request\n"); - } - return; -} - -void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) -{ - RelEvnt relEvnt; - uint32_t suInstId, spInstId; - - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (!sngisdn_info->suInstId) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending RELEASE, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - return; - } - - memset(&relEvnt, 0, sizeof(relEvnt)); - - /* Fill relEvnt here */ - relEvnt.causeDgn[0].eh.pres = PRSNT_NODEF; - relEvnt.causeDgn[0].location.pres = PRSNT_NODEF; - relEvnt.causeDgn[0].location.val = IN_LOC_PRIVNETLU; - relEvnt.causeDgn[0].codeStand3.pres = PRSNT_NODEF; - relEvnt.causeDgn[0].codeStand3.val = IN_CSTD_CCITT; - - relEvnt.causeDgn[0].causeVal.pres = PRSNT_NODEF; - relEvnt.causeDgn[0].causeVal.val = ftdmchan->caller_data.hangup_cause; - relEvnt.causeDgn[0].recommend.pres = NOTPRSNT; - relEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; - - if (glare) { - suInstId = sngisdn_info->glare.suInstId; - spInstId = sngisdn_info->glare.spInstId; - } else { - suInstId = sngisdn_info->suInstId; - spInstId = sngisdn_info->spInstId; - } - - set_facility_ie(ftdmchan, &relEvnt.facilityStr); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId); - - if (glare) { - if (sng_isdn_release_request(signal_data->cc_id, suInstId, spInstId, &relEvnt)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused RELEASE/RELEASE COMPLETE request\n"); - } - } else { - if (sng_isdn_release_request(signal_data->cc_id, suInstId, spInstId, &relEvnt)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused RELEASE/RELEASE COMPLETE request\n"); - } - } - return; -} - -void sngisdn_snd_restart(ftdm_channel_t *ftdmchan) -{ - Rst rstEvnt; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - memset(&rstEvnt, 0, sizeof(rstEvnt)); - - set_chan_id_ie(ftdmchan, &rstEvnt.chanId); - set_restart_ind_ie(ftdmchan, &rstEvnt.rstInd); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RESTART (suId:%d dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_dchan(signal_data)->link_id, CES_MNGMNT); - - if (sng_isdn_restart_request(signal_data->cc_id, &rstEvnt, sngisdn_dchan(signal_data)->link_id, CES_MNGMNT, IN_SND_RST)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused RESTART request\n"); - } - return; -} - - -/* We received an incoming frame on the d-channel, send data to the stack */ -void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) -{ - sng_l1_frame_t l1_frame; - ftdm_alarm_flag_t alarmbits = 0; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) dchan->span->signal_data; - - ftdm_channel_get_alarms(dchan, &alarmbits); - - if (alarmbits) { - ftdm_log_chan_msg(dchan, FTDM_LOG_WARNING, "Dropping incoming data due to L1 alarm\n"); - return; - } - - if (len > sizeof(l1_frame.data)) { - ftdm_log_chan(dchan, FTDM_LOG_ERROR, "Received frame of %"FTDM_SIZE_FMT" bytes, exceeding max size of %"FTDM_SIZE_FMT" bytes\n", - len, sizeof(l1_frame.data)); - return; - } - if (len <= 2) { - return; - } - - memset(&l1_frame, 0, sizeof(l1_frame)); - l1_frame.len = len; - - memcpy(&l1_frame.data, data, len); - - if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC)) { - l1_frame.flags |= SNG_L1FRAME_ERROR_CRC; - } - - if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME)) { - l1_frame.flags |= SNG_L1FRAME_ERROR_FRAME; - } - - if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT)) { - l1_frame.flags |= SNG_L1FRAME_ERROR_ABORT; - } - - if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO)) { - l1_frame.flags |= SNG_L1FRAME_ERROR_FIFO; - } - - if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA)) { - l1_frame.flags |= SNG_L1FRAME_ERROR_DMA; - } - - if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)) { - /* Should we trigger congestion here? */ - l1_frame.flags |= SNG_L1FRAME_QUEUE_THRES; - } - - if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)) { - /* Should we trigger congestion here? */ - l1_frame.flags |= SNG_L1FRAME_QUEUE_FULL; - } -#if 0 - if (1) { - int i; - char string [2000]; - unsigned string_len = 0; - for (i = 0; i < l1_frame.len; i++) { - string_len += sprintf(&string[string_len], "0x%02x ", l1_frame.data[i]); - } - - ftdm_log_chan(dchan, FTDM_LOG_CRIT, "\nL1 RX [%s] flags:%x\n", string, l1_frame.flags); - } -#endif - sng_isdn_data_ind(signal_data->link_id, &l1_frame); -} - -void sngisdn_snd_event(sngisdn_span_data_t *signal_data, ftdm_oob_event_t event) -{ - sng_l1_event_t l1_event; - - if (!signal_data->dchan) { - return; - } - memset(&l1_event, 0, sizeof(l1_event)); - - switch(event) { - case FTDM_OOB_ALARM_CLEAR: - l1_event.type = SNG_L1EVENT_ALARM_OFF; - sng_isdn_event_ind(signal_data->link_id, &l1_event); - - if (!signal_data->dl_request_pending) { - signal_data->dl_request_pending = 1; - ftdm_sched_timer(signal_data->sched, "delayed_dl_req", 8000, sngisdn_delayed_dl_req, (void*) signal_data, NULL); - } - break; - case FTDM_OOB_ALARM_TRAP: - l1_event.type = SNG_L1EVENT_ALARM_ON; - sng_isdn_event_ind(signal_data->link_id, &l1_event); - break; - default: - /* We do not care about the other OOB events for now */ - return; - } - return; -} - - -/* 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/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c deleted file mode 100644 index e5bebb1c8b..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ /dev/null @@ -1,1134 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ftmod_sangoma_isdn.h" -//static void sngisdn_rcv_q931_ind_span(sngisdn_span_data_t *signal_data, InMngmt *status); - -void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces) -{ - uint8_t bchan_no = 0; - int8_t interface_id = -1; /* Specifies which interface for NFAS */ - sngisdn_chan_data_t *sngisdn_info = NULL; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Ind on unconfigured cc\n"); - ftdm_assert(g_sngisdn_data.spans[dChan], "Con Ind on unconfigured dchan\n"); - - if (conEvnt->chanId.eh.pres != PRSNT_NODEF) { - /* TODO: Implement me */ - ftdm_log(FTDM_LOG_ERROR, "Incoming call without Channel Id not supported yet\n"); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - if (conEvnt->chanId.chanNmbSlotMap.pres) { - bchan_no = conEvnt->chanId.chanNmbSlotMap.val[0]; - } else if (conEvnt->chanId.infoChanSel.pres) { - bchan_no = conEvnt->chanId.infoChanSel.val; - } - - if (conEvnt->chanId.intIdent.pres) { - interface_id = conEvnt->chanId.intIdent.val; - } - - if (!bchan_no) { - ftdm_log(FTDM_LOG_ERROR, "Failed to obtain b-channel number from SETUP message\n"); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - if (g_sngisdn_data.spans[dChan]->nfas.trunk) { - if (interface_id < 0) { - ftdm_log(FTDM_LOG_ERROR, "Interface ID not present on NFAS interface\n"); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } else if (!g_sngisdn_data.spans[dChan]->nfas.trunk->spans[interface_id]) { - ftdm_log(FTDM_LOG_ERROR, "NFAS group:%s does not have logical interface %d\n", g_sngisdn_data.spans[dChan]->nfas.trunk->name, interface_id); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } else { - sngisdn_info = g_sngisdn_data.spans[dChan]->nfas.trunk->spans[interface_id]->channels[bchan_no]; - } - } else { - if (g_sngisdn_data.spans[dChan]->channels[bchan_no] == NULL) { - ftdm_log(FTDM_LOG_ERROR, "Incoming call on unconfigured b-channel:%d\n", bchan_no); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - sngisdn_info = g_sngisdn_data.spans[dChan]->channels[bchan_no]; - } - - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SETUP (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_CON_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->spInstId = spInstId; - sngisdn_event->dChan = dChan; - sngisdn_event->ces = ces; - - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - - memcpy(&sngisdn_event->event.conEvnt, conEvnt, sizeof(*conEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces) -{ - sngisdn_chan_data_t *sngisdn_info = NULL; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Cfm on unconfigured cc\n"); - ftdm_assert(g_sngisdn_data.spans[dChan] != 0, "Con Cfm on unconfigured dchan\n"); - - if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - if (!sngisdn_info->spInstId) { - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - } - - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received CONNECT/CONNECT ACK (suId:%u suInstId:%u spInstId:%u ces:%d)\n", suId, suInstId, spInstId, ces); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_CON_CFM; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - sngisdn_event->dChan = dChan; - sngisdn_event->ces = ces; - memcpy(&sngisdn_event->event.cnStEvnt, cnStEvnt, sizeof(*cnStEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) -{ - sngisdn_chan_data_t *sngisdn_info = NULL; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Cnst Ind on unconfigured cc\n"); - ftdm_assert(g_sngisdn_data.spans[dChan] != 0, "Cnst Ind on unconfigured dchan\n"); - - if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - if (!sngisdn_info->spInstId) { - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received %s (suId:%u suInstId:%u spInstId:%u ces:%d)\n", - (evntType == MI_ALERTING)?"ALERT": - (evntType == MI_CALLPROC)?"PROCEED": - (evntType == MI_PROGRESS)?"PROGRESS": - (evntType == MI_SETUPACK)?"SETUP ACK": - (evntType == MI_NOTIFY)?"NOTIFY": - (evntType == MI_INFO)?"INFO":"UNKNOWN", - suId, suInstId, spInstId, ces); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_CNST_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - sngisdn_event->dChan = dChan; - sngisdn_event->ces = ces; - sngisdn_event->evntType = evntType; - - memcpy(&sngisdn_event->event.cnStEvnt, cnStEvnt, sizeof(*cnStEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt) -{ - sngisdn_chan_data_t *sngisdn_info = NULL; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id"); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_DISC_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - - memcpy(&sngisdn_event->event.discEvnt, discEvnt, sizeof(*discEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt) -{ - sngisdn_chan_data_t *sngisdn_info = NULL; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - /* It seems that Trillium has a bug where they sometimes send release twice on a call, so do not crash on these for now */ - /* ftdm_assert(0, "Inconsistent call states\n"); */ - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RELEASE/RELEASE COMPLETE (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_REL_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - - memcpy(&sngisdn_event->event.relEvnt, relEvnt, sizeof(*relEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt) -{ - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received DATA IND suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_DAT_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - - memcpy(&sngisdn_event->event.infoEvnt, infoEvnt, sizeof(*infoEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action) -{ - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SSHL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_SSHL_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - sngisdn_event->action = action; - - memcpy(&sngisdn_event->event.ssHlEvnt, ssHlEvnt, sizeof(*ssHlEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action) -{ - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SSHL CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_SSHL_CFM; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - sngisdn_event->action = action; - - memcpy(&sngisdn_event->event.ssHlEvnt, ssHlEvnt, sizeof(*ssHlEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} -void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) -{ - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RMRT IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_RMRT_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - sngisdn_event->action = action; - - memcpy(&sngisdn_event->event.rmRtEvnt, rmRtEvnt, sizeof(*rmRtEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) -{ - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RESUME/RETRIEVE CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_RMRT_CFM; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - sngisdn_event->action = action; - - memcpy(&sngisdn_event->event.rmRtEvnt, rmRtEvnt, sizeof(*rmRtEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt) -{ - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received FLOW CONTROL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_FLC_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - - memcpy(&sngisdn_event->event.staEvnt, staEvnt, sizeof(*staEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - - -void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) -{ - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_FAC_IND; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - sngisdn_event->evntType = evntType; - - memcpy(&sngisdn_event->event.facEvnt, facEvnt, sizeof(*facEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - - -void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt) -{ - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - if (!suInstId && !spInstId) { - /* This is a response to a sngisdn_snd_info_req - * that was sent to attempt to re-establish DL link */ - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* We sometimes receive a STA CFM after receiving a RELEASE/RELEASE COMPLETE, so we need to lock - here in case we are calling clear_call_data at the same time this function is called */ - - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - return; - } - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received STATUS CONFIRM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - - sngisdn_event->event_id = SNGISDN_EVENT_STA_CFM; - sngisdn_event->sngisdn_info = sngisdn_info; - sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; - sngisdn_event->spInstId = spInstId; - - memcpy(&sngisdn_event->event.staEvnt, staEvnt, sizeof(*staEvnt)); - - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) -{ - - sngisdn_span_data_t *signal_data; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_log(FTDM_LOG_INFO, "Received SERVICE IND (dChan:%d ces:%u)\n", dChan, ces); - - signal_data = g_sngisdn_data.spans[dChan]; - - if (signal_data->nfas.trunk) { - unsigned i; - for (i = 0; i < signal_data->nfas.trunk->num_spans; i++) { - sngisdn_span_data_t *my_signal_data = signal_data->nfas.trunk->spans[i]; - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - sngisdn_event->event_id = SNGISDN_EVENT_SRV_IND; - sngisdn_event->suId = suId; - sngisdn_event->dChan = dChan; - sngisdn_event->ces = ces; - sngisdn_event->signal_data = my_signal_data; - memcpy(&sngisdn_event->event.srvEvnt, srvEvnt, sizeof(*srvEvnt)); - ftdm_queue_enqueue(my_signal_data->event_queue, sngisdn_event); - } - } else { - ftdm_queue_enqueue(signal_data->event_queue, sngisdn_event); - } - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - - -void sngisdn_rcv_srv_cfm (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) -{ - sngisdn_span_data_t *signal_data = NULL; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_log(FTDM_LOG_INFO, "Received SERVICE CFM (dChan:%d ces:%u)\n", dChan, ces); - - signal_data = g_sngisdn_data.spans[dChan]; - - if (signal_data->nfas.trunk) { - unsigned i; - for (i = 0; i < signal_data->nfas.trunk->num_spans; i++) { - sngisdn_span_data_t *my_signal_data = signal_data->nfas.trunk->spans[i]; - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - sngisdn_event->event_id = SNGISDN_EVENT_SRV_CFM; - sngisdn_event->suId = suId; - sngisdn_event->dChan = dChan; - sngisdn_event->ces = ces; - sngisdn_event->signal_data = my_signal_data; - memcpy(&sngisdn_event->event.srvEvnt, srvEvnt, sizeof(*srvEvnt)); - ftdm_queue_enqueue(my_signal_data->event_queue, sngisdn_event); - } - } else { - ftdm_queue_enqueue(signal_data->event_queue, sngisdn_event); - } - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType) -{ - sngisdn_span_data_t *signal_data = NULL; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_log(FTDM_LOG_INFO, "Received RESTART IND (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); - - signal_data = g_sngisdn_data.spans[dChan]; - - if (signal_data->nfas.trunk) { - unsigned i; - for (i = 0; i < signal_data->nfas.trunk->num_spans; i++) { - sngisdn_span_data_t *my_signal_data = signal_data->nfas.trunk->spans[i]; - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - sngisdn_event->event_id = SNGISDN_EVENT_RST_IND; - sngisdn_event->suId = suId; - sngisdn_event->dChan = dChan; - sngisdn_event->ces = ces; - sngisdn_event->signal_data = my_signal_data; - memcpy(&sngisdn_event->event.rstEvnt, rstEvnt, sizeof(*rstEvnt)); - ftdm_queue_enqueue(my_signal_data->event_queue, sngisdn_event); - } - } else { - ftdm_queue_enqueue(signal_data->event_queue, sngisdn_event); - } - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void sngisdn_rcv_rst_cfm (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType) -{ - sngisdn_span_data_t *signal_data; - sngisdn_event_data_t *sngisdn_event = NULL; - - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - - ftdm_log(FTDM_LOG_INFO, "Received RESTART CFM (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); - - signal_data = g_sngisdn_data.spans[dChan]; - - if (signal_data->nfas.trunk) { - unsigned i; - for (i = 0; i < signal_data->nfas.trunk->num_spans; i++) { - sngisdn_span_data_t *my_signal_data = signal_data->nfas.trunk->spans[i]; - - sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); - memset(sngisdn_event, 0, sizeof(*sngisdn_event)); - sngisdn_event->event_id = SNGISDN_EVENT_RST_CFM; - sngisdn_event->suId = suId; - sngisdn_event->dChan = dChan; - sngisdn_event->ces = ces; - sngisdn_event->signal_data = my_signal_data; - memcpy(&sngisdn_event->event.rstEvnt, rstEvnt, sizeof(*rstEvnt)); - ftdm_queue_enqueue(my_signal_data->event_queue, sngisdn_event); - } - } else { - ftdm_queue_enqueue(signal_data->event_queue, sngisdn_event); - } - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - - -void sngisdn_rcv_phy_ind(SuId suId, Reason reason) -{ - if (reason != LL1_REASON_CON_REQ_FAIL) { - ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN PHY] D-chan %d : %s\n", suId, DECODE_LL1_REASON(reason)); - } - return; -} - -void sngisdn_rcv_q921_ind(BdMngmt *status) -{ - ftdm_span_t *ftdmspan; - - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[status->t.usta.lnkNmb]; - - if (!signal_data) { - ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.lnkNmb); - return; - } - ftdmspan = signal_data->ftdm_span; - - if (!ftdmspan) { - ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.lnkNmb); - return; - } - - switch (status->t.usta.alarm.category) { - case (LCM_CATEGORY_PROTOCOL): - ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", - ftdmspan->name, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LLD_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LLD_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - - if (FTDM_SPAN_IS_BRI(ftdmspan) && (status->t.usta.alarm.event == PROT_ST_DN)) { - /* Q.921 link is down - This is a line where the Q.921 stops transmitting - after the line goes idle. - - Do not drop current calls, but set sigstatus do down so that we - can try to re-initialize link before trying new outbound calls */ - - sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_DOWN); - sngisdn_set_span_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING); - } - break; - default: - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", - ftdmspan->name, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LLD_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LLD_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - - switch (status->t.usta.alarm.event) { - case ENTR_CONG: /* Entering Congestion */ - ftdm_log(FTDM_LOG_WARNING, "s%d: Entering Congestion\n", ftdmspan->span_id); - ftdm_set_flag(ftdmspan, FTDM_SPAN_SUSPENDED); - break; - case EXIT_CONG: /* Exiting Congestion */ - ftdm_log(FTDM_LOG_WARNING, "s%d: Exiting Congestion\n", ftdmspan->span_id); - ftdm_clear_flag(ftdmspan, FTDM_SPAN_SUSPENDED); - break; - } - break; - } - return; -} - -#if 0 -static void sngisdn_rcv_q931_ind_span(sngisdn_span_data_t *signal_data, InMngmt *status) -{ - ftdm_span_t *ftdmspan = signal_data->ftdm_span; - uint32_t chan_no = status->t.usta.evntParm[2]; - - if (!signal_data) { - ftdm_log(FTDM_LOG_INFO, "Received q931 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId); - return; - } - - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", - status->t.usta.suId, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - - if (chan_no) { - ftdm_channel_t *ftdmchan = ftdm_span_get_channel(ftdmspan, chan_no); - if (ftdmchan) { - sngisdn_set_chan_sig_status(ftdmchan, (status->t.usta.alarm.event == LCM_EVENT_UP) ? FTDM_SIG_STATE_UP : FTDM_SIG_STATE_DOWN); - sngisdn_set_chan_avail_rate(ftdmchan, (status->t.usta.alarm.event == LCM_EVENT_UP) ? SNGISDN_AVAIL_UP: SNGISDN_AVAIL_PWR_SAVING); - } else { - ftdm_log(FTDM_LOG_CRIT, "stack alarm event on invalid channel :%d\n", chan_no); - } - } else { - sngisdn_set_span_sig_status(ftdmspan, (status->t.usta.alarm.event == LCM_EVENT_UP) ? FTDM_SIG_STATE_UP : FTDM_SIG_STATE_DOWN); - sngisdn_set_span_avail_rate(ftdmspan, (status->t.usta.alarm.event == LCM_EVENT_UP) ? SNGISDN_AVAIL_UP: SNGISDN_AVAIL_PWR_SAVING); - } -} -#endif - -void sngisdn_rcv_q931_ind(InMngmt *status) -{ - sngisdn_span_data_t *signal_data = NULL; - ftdm_span_t *ftdmspan = NULL; -#ifndef WIN32 - if (status->t.usta.alarm.cause == 287) { - sngisdn_get_memory_info(); - return; - } -#endif - - signal_data = g_sngisdn_data.spans[status->t.usta.suId]; - if (!signal_data) { - ftdm_log(FTDM_LOG_INFO, "Received q931 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId); - return; - } - - ftdmspan = signal_data->ftdm_span; - - switch (status->t.usta.alarm.event) { - case LCM_EVENT_UP: - case LCM_EVENT_DOWN: - { - int i; - sngisdn_nfas_data_t *nfas_data = NULL; - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", - status->t.usta.suId, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - - nfas_data = signal_data->nfas.trunk; - - if (nfas_data && status->t.usta.alarm.event == LCM_EVENT_UP) { - for (i = 0; i < ftdm_array_len(nfas_data->spans); i++) { - if (nfas_data->spans[i] && nfas_data->spans[i]->nfas.sigchan == SNGISDN_NFAS_DCHAN_NONE) { - - sngisdn_set_span_sig_status(nfas_data->spans[i]->ftdm_span, FTDM_SIG_STATE_UP); - sngisdn_set_span_avail_rate(nfas_data->spans[i]->ftdm_span, SNGISDN_AVAIL_UP); - } - } - } - - sngisdn_set_span_sig_status(ftdmspan, (status->t.usta.alarm.event == LCM_EVENT_UP) ? FTDM_SIG_STATE_UP : FTDM_SIG_STATE_DOWN); - sngisdn_set_span_avail_rate(ftdmspan, (status->t.usta.alarm.event == LCM_EVENT_UP) ? SNGISDN_AVAIL_UP: SNGISDN_AVAIL_PWR_SAVING); - - if (nfas_data && status->t.usta.alarm.event == LCM_EVENT_DOWN) { - if (nfas_data->dchan->sigstatus == FTDM_SIG_STATE_DOWN && - ((nfas_data->backup && nfas_data->backup->sigstatus == FTDM_SIG_STATE_DOWN) || !nfas_data->backup)) { - - for (i = 0; i < ftdm_array_len(nfas_data->spans); i++) { - if (nfas_data->spans[i] && nfas_data->spans[i]->nfas.sigchan == SNGISDN_NFAS_DCHAN_NONE) { - - sngisdn_set_span_sig_status(nfas_data->spans[i]->ftdm_span, FTDM_SIG_STATE_DOWN); - sngisdn_set_span_avail_rate(nfas_data->spans[i]->ftdm_span, SNGISDN_AVAIL_PWR_SAVING); - } - } - } - } - } - break; - default: - ftdm_log(FTDM_LOG_WARNING, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", - status->t.usta.suId, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - } - - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_rcv_cc_ind(CcMngmt *status) -{ - ISDN_FUNC_TRACE_ENTER(__FTDM_FUNC__); - ftdm_log(FTDM_LOG_INFO, "RECEIVED %s\n", __FTDM_FUNC__); - ISDN_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - -void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) -{ - MsgLen mlen; - int16_t j; - Buffer *tmp; - Data *cptr; - uint8_t data; - ftdm_trace_dir_t dir; - uint8_t tdata[1000]; - - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[trc->t.trc.suId]; - - ftdm_assert(mBuf != NULLP, "Received a Q931 trace with no buffer"); - mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; - - if (trc->t.trc.evnt == TL3PKTTX) { - dir = FTDM_TRACE_DIR_OUTGOING; - } else { - dir = FTDM_TRACE_DIR_INCOMING; - } - - if (mlen) { - tmp = mBuf->b_cont; - cptr = tmp->b_rptr; - data = *cptr++; - - for(j=0;jb_wptr) { - tmp = tmp->b_cont; - if (tmp) cptr = tmp->b_rptr; - } - data = *cptr++; - } - if (signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) { - sngisdn_trace_raw_q931(signal_data, dir, tdata, mlen); - } else { - sngisdn_trace_interpreted_q931(signal_data, dir, tdata, mlen); - } - } - return; -} - - -void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf) -{ - MsgLen mlen; - Buffer *tmp; - MsgLen i; - int16_t j; - Data *cptr; - uint8_t data; - ftdm_trace_dir_t dir; - uint8_t tdata[1000]; - - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[trc->t.trc.lnkNmb]; - - if (trc->t.trc.evnt == TL2TMR) { - return; - } - - if (trc->t.trc.evnt == TL2FRMTX) { - dir = FTDM_TRACE_DIR_OUTGOING; - } else { - dir = FTDM_TRACE_DIR_INCOMING; - } - - ftdm_assert(mBuf != NULLP, "Received a Q921 trace with no buffer"); - mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; - if (mlen != 0) { - tmp = mBuf->b_cont; - cptr = tmp->b_rptr; - data = *cptr++; - i = 0; - while (i < mlen) { - j = 0; - for(j=0;j<16;j++) { - if (ib_wptr) { - tmp = tmp->b_cont; - if (tmp) cptr = tmp->b_rptr; - } - i++; - if (iraw_trace_q921 == SNGISDN_OPT_TRUE) { - sngisdn_trace_raw_q921(signal_data, dir, tdata, mlen); - } else { - sngisdn_trace_interpreted_q921(signal_data, dir, tdata, mlen); - } - } - return; -} - -/* The stacks is wants to transmit a frame */ -int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame) -{ - ftdm_status_t status; - ftdm_wait_flag_t flags = FTDM_WRITE; - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; - ftdm_size_t length = l1_frame->len; - - ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); - - do { - flags = FTDM_WRITE; - status = signal_data->dchan->fio->wait(signal_data->dchan, &flags, 1000); - switch(status) { - case FTDM_SUCCESS: - break; - case FTDM_TIMEOUT: - continue; - case FTDM_FAIL: - default: - ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_WARNING, "failed to poll for channel\n"); - return -1; - } - - - /* status = FTDM_SUCCESS */ - if ((flags & FTDM_WRITE)) { -#if 0 - int i; - char string [2000]; - unsigned string_len = 0; - for (i = 0; i < length; i++) { - string_len += sprintf(&string[string_len], "0x%02x ", l1_frame->data[i]); - } - - ftdm_log_chan(signal_data->dchan, FTDM_LOG_CRIT, "\nL1 TX [%s]\n", string); -#endif - - status = signal_data->dchan->fio->write(signal_data->dchan, l1_frame->data, (ftdm_size_t*)&length); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_CRIT, "Failed to transmit frame\n"); - return -1; - } - break; - /* On WIN32, it is possible for poll to return without FTDM_WRITE flag set, so we try to retransmit */ -#ifndef WIN32 - } else { - ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_WARNING, "Failed to poll for d-channel\n"); - return -1; -#endif - } - } while(1); - return 0; -} - -int16_t sngisdn_rcv_l1_cmd_req(uint16_t spId, sng_l1_cmd_t *l1_cmd) -{ - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; - ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); - - switch(l1_cmd->type) { - case SNG_L1CMD_SET_LINK_STATUS: - { - ftdm_channel_hw_link_status_t status = FTDM_HW_LINK_CONNECTED; - ftdm_channel_command(signal_data->dchan, FTDM_COMMAND_SET_LINK_STATUS, &status); - } - break; - case SNG_L1CMD_GET_LINK_STATUS: - { - ftdm_channel_hw_link_status_t status = 0; - ftdm_channel_command(signal_data->dchan, FTDM_COMMAND_GET_LINK_STATUS, &status); - if (status == FTDM_HW_LINK_CONNECTED) { - l1_cmd->cmd.status = 1; - } else if (status == FTDM_HW_LINK_DISCONNECTED) { - l1_cmd->cmd.status = 0; - } else { - ftdm_log_chan(signal_data->dchan, FTDM_LOG_CRIT, "Invalid link status reported %d\n", status); - l1_cmd->cmd.status = 0; - } - } - break; - case SNG_L1CMD_FLUSH_STATS: - ftdm_channel_command(signal_data->dchan, FTDM_COMMAND_FLUSH_IOSTATS, NULL); - break; - case SNG_L1CMD_FLUSH_BUFFERS: - ftdm_channel_command(signal_data->dchan, FTDM_COMMAND_FLUSH_BUFFERS, NULL); - break; - default: - ftdm_log_chan(signal_data->dchan, FTDM_LOG_CRIT, "Unsupported channel command:%d\n", l1_cmd->type); - return -1; - } - return 0; -} - -void sngisdn_rcv_sng_assert(char *message) -{ - ftdm_assert(0, message); -} - -void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...) -{ - char *data; - int ret; - va_list ap; - - va_start(ap, fmt); - ret = ftdm_vasprintf(&data, fmt, ap); - if (ret == -1) { - return; - } - - switch (level) { - case SNG_LOGLEVEL_DEBUG: - ftdm_log(FTDM_LOG_DEBUG, "sng_isdn->%s", data); - break; - case SNG_LOGLEVEL_WARN: - if ( strncmp(data, "Invalid Q.921/Q.931 frame", 25) ) { - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); - } - break; - case SNG_LOGLEVEL_INFO: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s\n", data); - break; - case SNG_LOGLEVEL_STATS: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s\n", data); - break; - case SNG_LOGLEVEL_ERROR: - ftdm_log(FTDM_LOG_ERROR, "sng_isdn->%s\n", data); - /*ftdm_assert(0, "Got an error from stack");*/ - break; - case SNG_LOGLEVEL_CRIT: - ftdm_log(FTDM_LOG_CRIT, "sng_isdn->%s\n", data); - /* ftdm_assert(0, "Got an error from stack"); */ - break; - default: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s\n", data); - break; - } - ftdm_safe_free(data); - return; -} - -/* 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/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c deleted file mode 100644 index 83dd070387..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ /dev/null @@ -1,1643 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ftmod_sangoma_isdn.h" -#define SNGISDN_Q931_FACILITY_IE_ID 0x1C - -/* ftmod_sangoma_isdn specific enum look-up functions */ - -SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_STRINGS) -SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t, SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_INVALID) - -SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) -SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) - -SNGISDN_ENUM_NAMES(SNGISDN_NETSPECFAC_TYPE_NAMES, SNGISDN_NETSPECFAC_TYPE_STRINGS) -SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_netspecfac_type, ftdm_sngisdn_netspecfac_type2str, ftdm_sngisdn_netspecfac_type_t, SNGISDN_NETSPECFAC_TYPE_NAMES, SNGISDN_NETSPECFAC_TYPE_INVALID) - -SNGISDN_ENUM_NAMES(SNGISDN_NETSPECFAC_PLAN_NAMES, SNGISDN_NETSPECFAC_PLAN_STRINGS) -SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_netspecfac_plan, ftdm_sngisdn_netspecfac_plan2str, ftdm_sngisdn_netspecfac_plan_t, SNGISDN_NETSPECFAC_PLAN_NAMES, SNGISDN_NETSPECFAC_PLAN_INVALID) - -SNGISDN_ENUM_NAMES(SNGISDN_NETSPECFAC_SPEC_NAMES, SNGISDN_NETSPECFAC_SPEC_STRINGS) -SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_netspecfac_spec, ftdm_sngisdn_netspecfac_spec2str, ftdm_sngisdn_netspecfac_spec_t, SNGISDN_NETSPECFAC_SPEC_NAMES, SNGISDN_NETSPECFAC_SPEC_INVALID) - -static uint8_t _get_trillium_val(ftdm2trillium_t *vals, unsigned int num_vals, uint8_t ftdm_val, uint8_t default_val); -static uint8_t _get_ftdm_val(ftdm2trillium_t *vals, unsigned int num_vals, uint8_t trillium_val, uint8_t default_val); - -#define get_trillium_val(vals, ftdm_val, default_val) _get_trillium_val(vals, ftdm_array_len(vals), ftdm_val, default_val) -#define get_ftdm_val(vals, trillium_val, default_val) _get_ftdm_val(vals, ftdm_array_len(vals), trillium_val, default_val) - -ftdm_status_t get_calling_name_from_usr_usr(ftdm_channel_t *ftdmchan, UsrUsr *usrUsr); -ftdm_status_t get_calling_name_from_display(ftdm_channel_t *ftdmchan, Display *display); -ftdm_status_t get_calling_name_from_ntDisplay(ftdm_channel_t *ftdmchan, NtDisplay *display); - -extern ftdm_sngisdn_data_t g_sngisdn_data; - -ftdm2trillium_t npi_codes[] = { - {FTDM_NPI_UNKNOWN, IN_NP_UNK}, - {FTDM_NPI_ISDN, IN_NP_ISDN}, - {FTDM_NPI_DATA, IN_NP_DATA}, - {FTDM_NPI_TELEX, IN_NP_TELEX}, - {FTDM_NPI_NATIONAL, IN_NP_NATIONAL}, - {FTDM_NPI_PRIVATE, IN_NP_PRIVATE}, - {FTDM_NPI_RESERVED, IN_NP_EXT}, -}; - -ftdm2trillium_t ton_codes[] = { - {FTDM_TON_UNKNOWN, IN_TON_UNK}, - {FTDM_TON_INTERNATIONAL, IN_TON_INT}, - {FTDM_TON_NATIONAL, IN_TON_NAT}, - {FTDM_TON_NETWORK_SPECIFIC, IN_TON_NETSPEC}, - {FTDM_TON_SUBSCRIBER_NUMBER, IN_TON_SUB}, - {FTDM_TON_ABBREVIATED_NUMBER, IN_TON_ABB}, - {FTDM_TON_RESERVED, IN_TON_EXT}, -}; - -ftdm2trillium_t nsf_spec_codes[] = { - {SNGISDN_NETSPECFAC_SPEC_ACCUNET, 0xe6}, - {SNGISDN_NETSPECFAC_SPEC_MEGACOM, 0xe3}, - {SNGISDN_NETSPECFAC_SPEC_MEGACOM_800, 0xe2}, - {SNGISDN_NETSPECFAC_SPEC_SDDN, 0xe1}, - {SNGISDN_NETSPECFAC_SPEC_INVALID, 0x00}, -}; - -ftdm2trillium_t nsf_type_codes[] = { - {SNGISDN_NETSPECFAC_TYPE_USER_SPEC, 0x00}, - {SNGISDN_NETSPECFAC_TYPE_NATIONAL_NETWORK_IDENT, 0x02}, - {SNGISDN_NETSPECFAC_TYPE_INTERNATIONAL_NETWORK_IDENT, 0x03}, - {SNGISDN_NETSPECFAC_TYPE_INVALID, 0x00}, -}; - -ftdm2trillium_t nsf_plan_codes[] = { - {SNGISDN_NETSPECFAC_PLAN_UNKNOWN, 0x00}, - {SNGISDN_NETSPECFAC_PLAN_CARRIER_IDENT, 0x01}, - {SNGISDN_NETSPECFAC_PLAN_DATA_NETWORK_IDENT, 0x03}, - {SNGISDN_NETSPECFAC_PLAN_INVALID, 0x00}, -}; - -static uint8_t _get_trillium_val(ftdm2trillium_t *vals, unsigned int num_vals, uint8_t ftdm_val, uint8_t default_val) -{ - int i; - for (i = 0; i < num_vals; i++) { - if (vals[i].ftdm_val == ftdm_val) { - return vals[i].trillium_val; - } - } - - return default_val; -} - -static uint8_t _get_ftdm_val(ftdm2trillium_t *vals, unsigned int num_vals, uint8_t trillium_val, uint8_t default_val) -{ - int i; - for (i = 0; i < num_vals; i++) { - if (vals[i].trillium_val == trillium_val) { - return vals[i].ftdm_val; - } - } - return default_val; -} - -void clear_call_data(sngisdn_chan_data_t *sngisdn_info) -{ - uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id; - - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing call data (suId:%u suInstId:%u spInstId:%u)\n", cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex); - g_sngisdn_data.ccs[cc_id].active_spInstIds[sngisdn_info->spInstId]=NULL; - g_sngisdn_data.ccs[cc_id].active_suInstIds[sngisdn_info->suInstId]=NULL; - - sngisdn_info->suInstId = 0; - sngisdn_info->spInstId = 0; - sngisdn_info->globalFlg = 0; - sngisdn_info->flags = 0; - sngisdn_info->transfer_data.type = SNGISDN_TRANSFER_NONE; - - ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].mutex); - return; -} - -void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) -{ - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing glare data (suId:%d suInstId:%u spInstId:%u actv-suInstId:%u actv-spInstId:%u)\n", - sngisdn_info->glare.suId, - sngisdn_info->glare.suInstId, sngisdn_info->glare.spInstId, - sngisdn_info->suInstId, sngisdn_info->spInstId); - - ftdm_mutex_lock(g_sngisdn_data.ccs[sngisdn_info->glare.suId].mutex); - if (sngisdn_info->glare.spInstId != sngisdn_info->spInstId) { - g_sngisdn_data.ccs[sngisdn_info->glare.suId].active_spInstIds[sngisdn_info->glare.spInstId]=NULL; - } - g_sngisdn_data.ccs[sngisdn_info->glare.suId].active_suInstIds[sngisdn_info->glare.suInstId]=NULL; - ftdm_mutex_unlock(g_sngisdn_data.ccs[sngisdn_info->glare.suId].mutex); - - ftdm_clear_flag(sngisdn_info, FLAG_GLARE); - memset(&sngisdn_info->glare.setup, 0, sizeof(ConEvnt)); - sngisdn_info->glare.suId = 0; - sngisdn_info->glare.suInstId = 0; - sngisdn_info->glare.spInstId = 0; - sngisdn_info->glare.dChan = 0; - sngisdn_info->glare.ces = 0; - return; -} - - -uint32_t get_unique_suInstId(int16_t cc_id) -{ - uint32_t suInstId; - ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); - ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex); - suInstId = g_sngisdn_data.ccs[cc_id].last_suInstId; - - while(1) { - if (++suInstId == MAX_INSTID) { - suInstId = 1; - } - if (g_sngisdn_data.ccs[cc_id].active_suInstIds[suInstId] == NULL) { - g_sngisdn_data.ccs[cc_id].last_suInstId = suInstId; - ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].mutex); - return suInstId; - } - } - /* Should never reach here */ - ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].mutex); - return 0; -} - -ftdm_status_t get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) -{ - ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); - ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); - - if (g_sngisdn_data.ccs[cc_id].active_suInstIds[suInstId] == NULL) { - return FTDM_FAIL; - } - *sngisdn_data = g_sngisdn_data.ccs[cc_id].active_suInstIds[suInstId]; - return FTDM_SUCCESS; -} - -ftdm_status_t get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) -{ - ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); - ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); - - if (g_sngisdn_data.ccs[cc_id].active_spInstIds[spInstId] == NULL) { - return FTDM_FAIL; - } - *sngisdn_data = g_sngisdn_data.ccs[cc_id].active_spInstIds[spInstId]; - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_set_chan_avail_rate(ftdm_channel_t *chan, sngisdn_avail_t avail) -{ - if (FTDM_SPAN_IS_BRI(chan->span)) { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Setting availability rate to:%d\n", avail); - chan->availability_rate = avail; - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_set_span_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) -{ - if (FTDM_SPAN_IS_BRI(span)) { - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_log_chan(((ftdm_channel_t*)ftdm_iterator_current(curr)), FTDM_LOG_DEBUG, "Setting availability rate to:%d\n", avail); - sngisdn_set_chan_avail_rate(((ftdm_channel_t*)ftdm_iterator_current(curr)), avail); - } - ftdm_iterator_free(chaniter); - } - return FTDM_SUCCESS; -} - -#ifdef NETBORDER_CALL_REF -ftdm_status_t get_callref(ftdm_channel_t *ftdmchan, BCCallRef* callRef) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - - if (signal_data->raw_trace_q931) { - if (callRef->eh.pres != PRSNT_NODEF || callRef->reference.pres != PRSNT_NODEF) { - /* Netborder only supports BRI, so we only care for BRI for now */ - if (FTDM_SPAN_IS_BRI(ftdmchan->span) && !sngisdn_info->call_ref) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to obtain call reference\n"); - } - return FTDM_FAIL; - } - if (FTDM_SPAN_IS_BRI(ftdmchan->span)) { - sngisdn_info->call_ref = 0x7F & callRef->reference.val; - } else { - sngisdn_info->call_ref = 0x7FFF & callRef->reference.val; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Call reference:%04x\n", sngisdn_info->call_ref); - } - return FTDM_SUCCESS; -} -#endif - -ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - if (cgPtyNmb->eh.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - - if (cgPtyNmb->screenInd.pres == PRSNT_NODEF) { - caller_data->screen = cgPtyNmb->screenInd.val; - } - - if (cgPtyNmb->presInd0.pres == PRSNT_NODEF) { - caller_data->pres = cgPtyNmb->presInd0.val; - } - - if (cgPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - caller_data->cid_num.plan = cgPtyNmb->nmbPlanId.val; - } - - if (cgPtyNmb->typeNmb1.pres == PRSNT_NODEF) { - caller_data->cid_num.type = cgPtyNmb->typeNmb1.val; - } - - if (cgPtyNmb->nmbDigits.pres == PRSNT_NODEF) { - ftdm_copy_string(caller_data->cid_num.digits, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len+1); - } - memcpy(&caller_data->ani, &caller_data->cid_num, sizeof(caller_data->ani)); - return FTDM_SUCCESS; -} - -ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - if (cgPtyNmb->eh.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - - if (cgPtyNmb->screenInd.pres == PRSNT_NODEF) { - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.screen_ind", ftdm_screening2str(cgPtyNmb->screenInd.val)); - } - - if (cgPtyNmb->presInd0.pres == PRSNT_NODEF) { - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.presentation_ind", ftdm_presentation2str(cgPtyNmb->presInd0.val)); - } - - if (cgPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.npi", ftdm_npi2str(cgPtyNmb->nmbPlanId.val)); - } - - if (cgPtyNmb->typeNmb1.pres == PRSNT_NODEF) { - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.ton", ftdm_ton2str(cgPtyNmb->typeNmb1.val)); - } - - if (cgPtyNmb->nmbDigits.pres == PRSNT_NODEF) { - char digits_string [32]; - memcpy(digits_string, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len); - digits_string[cgPtyNmb->nmbDigits.len] = '\0'; - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.digits", digits_string); - } - memcpy(&caller_data->ani, &caller_data->cid_num, sizeof(caller_data->ani)); - return FTDM_SUCCESS; -} - -ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - if (cdPtyNmb->eh.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - - if (cdPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - caller_data->dnis.plan = get_ftdm_val(npi_codes, cdPtyNmb->nmbPlanId.val, IN_NP_UNK); - } - - if (cdPtyNmb->typeNmb0.pres == PRSNT_NODEF) { - caller_data->dnis.type = get_ftdm_val(ton_codes, cdPtyNmb->typeNmb0.val, IN_TON_UNK); - } - - if (cdPtyNmb->nmbDigits.pres == PRSNT_NODEF) { - /* In overlap receive mode, append the new digits to the existing dnis */ - unsigned i = strlen(caller_data->dnis.digits); - - ftdm_copy_string(&caller_data->dnis.digits[i], (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1); - } - return FTDM_SUCCESS; -} - -ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - if (redirNmb->eh.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - - if (redirNmb->nmbPlanId.pres == PRSNT_NODEF) { - caller_data->rdnis.plan = get_ftdm_val(npi_codes, redirNmb->nmbPlanId.val, IN_NP_UNK); - } - - if (redirNmb->typeNmb.pres == PRSNT_NODEF) { - caller_data->rdnis.type = get_ftdm_val(ton_codes, redirNmb->typeNmb.val, IN_TON_UNK); - } - - if (redirNmb->nmbDigits.pres == PRSNT_NODEF) { - ftdm_copy_string(caller_data->rdnis.digits, (const char*)redirNmb->nmbDigits.val, redirNmb->nmbDigits.len+1); - } - return FTDM_SUCCESS; -} - -ftdm_status_t get_calling_name_from_display(ftdm_channel_t *ftdmchan, Display *display) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - if (display->eh.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - if (display->dispInfo.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - - ftdm_copy_string(caller_data->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1); - return FTDM_SUCCESS; -} - -ftdm_status_t get_calling_name_from_ntDisplay(ftdm_channel_t *ftdmchan, NtDisplay *display) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - if (display->eh.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - if (display->dispInfo.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - - ftdm_copy_string(caller_data->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1); - return FTDM_SUCCESS; -} - -ftdm_status_t get_calling_name_from_usr_usr(ftdm_channel_t *ftdmchan, UsrUsr *usrUsr) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - if (usrUsr->eh.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - - if (usrUsr->protocolDisc.val != PD_IA5) { - return FTDM_FAIL; - } - - if (usrUsr->usrInfo.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - - ftdm_copy_string(caller_data->cid_name, (const char*)usrUsr->usrInfo.val, usrUsr->usrInfo.len+1); - return FTDM_SUCCESS; -} - -ftdm_status_t get_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt) -{ - ftdm_status_t status = FTDM_FAIL; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (signal_data->switchtype == SNGISDN_SWITCH_DMS100) { - status = get_calling_name_from_ntDisplay(ftdmchan, &conEvnt->ntDisplay[0]); - } else { - status = get_calling_name_from_display(ftdmchan, &conEvnt->display); - - } - if (status != FTDM_SUCCESS) { - status = get_calling_name_from_usr_usr(ftdmchan, &conEvnt->usrUsr); - } - return status; -} - - -ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) -{ - char subaddress[100]; - - if (cgPtySad->eh.pres != PRSNT_NODEF) { - return FTDM_FAIL; - } - memset(subaddress, 0, sizeof(subaddress)); - if(cgPtySad->sadInfo.len >= sizeof(subaddress)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Calling Party Subaddress exceeds local size limit (len:%d max:%"FTDM_SIZE_FMT")\n", cgPtySad->sadInfo.len, sizeof(subaddress)); - cgPtySad->sadInfo.len = sizeof(subaddress)-1; - } - - memcpy(subaddress, (char*)cgPtySad->sadInfo.val, cgPtySad->sadInfo.len); - subaddress[cgPtySad->sadInfo.len] = '\0'; - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.calling_subaddr", subaddress); - return FTDM_SUCCESS; -} - -ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ - if (!facilityStr->eh.pres) { - return FTDM_FAIL; - } - - return get_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, facilityStr->facilityStr.len); -} - -ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t data_len) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - /* Max size of Facility IE is 255 */ - uint8_t my_data [255]; - - /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ - my_data[0] = SNGISDN_Q931_FACILITY_IE_ID; - my_data[1] = data_len; - memcpy(&my_data[2], data, data_len); - - sngisdn_add_raw_data((sngisdn_chan_data_t*)ftdmchan->call_data, my_data, data_len+2); - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Raw Facility IE copied available\n"); - } else { - /* Call libsng_isdn to process facility IE's here */ - } - return FTDM_SUCCESS; -} - -ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd) -{ - uint8_t val; - - if (!progInd->eh.pres) { - return FTDM_FAIL; - } - - if (progInd->progDesc.pres) { - /* TODO: use get_ftdm_val function and table here */ - switch (progInd->progDesc.val) { - case IN_PD_NOTETEISDN: - val = SNGISDN_PROGIND_DESCR_NETE_ISDN; - break; - case IN_PD_DSTNOTISDN: - val = SNGISDN_PROGIND_DESCR_DEST_NISDN; - break; - case IN_PD_ORGNOTISDN: - val = SNGISDN_PROGIND_DESCR_ORIG_NISDN; - break; - case IN_PD_CALLRET: - val = SNGISDN_PROGIND_DESCR_RET_ISDN; - break; - case IN_PD_DELRESP: - val = SNGISDN_PROGIND_DESCR_SERV_CHANGE; - break; - case IN_PD_IBAVAIL: - val = SNGISDN_PROGIND_DESCR_IB_AVAIL; - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unknown Progress Indicator Description (%d)\n", progInd->progDesc.val); - val = SNGISDN_PROGIND_DESCR_INVALID; - break; - } - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val)); - } - - if (progInd->location.pres) { - switch (progInd->location.val) { - case IN_LOC_USER: - val = SNGISDN_PROGIND_LOC_USER; - break; - case IN_LOC_PRIVNETLU: - val = SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR; - break; - case IN_LOC_PUBNETLU: - val = SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR; - break; - case IN_LOC_TRANNET: - val = SNGISDN_PROGIND_LOC_TRANSIT_NET; - break; - case IN_LOC_PUBNETRU: - val = SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR; - break; - case IN_LOC_PRIVNETRU: - val = SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR; - break; - case IN_LOC_NETINTER: - val = SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW; - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unknown Progress Indicator Location (%d)", progInd->location.val); - val = SNGISDN_PROGIND_LOC_INVALID; - break; - } - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val)); - } - return FTDM_SUCCESS; -} - - -ftdm_status_t get_network_specific_fac(ftdm_channel_t *ftdmchan, NetFac *netFac) -{ - if (!netFac->eh.pres) { - return FTDM_FAIL; - } - - if (netFac->netFacSpec.pres == PRSNT_NODEF) { - char digits_string [32]; - memcpy(digits_string, (const char*)netFac->netFacSpec.val, netFac->netFacSpec.len); - digits_string[netFac->netFacSpec.len] = '\0'; - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.netFac.spec", digits_string); - } - - if (netFac->typeNetId.pres == PRSNT_NODEF) { - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.netFac.type", ftdm_sngisdn_netspecfac_type2str(get_ftdm_val(nsf_type_codes, netFac->typeNetId.val, 0x00))); - } - - if (netFac->netIdPlan.pres == PRSNT_NODEF) { - sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.netFac.plan", ftdm_sngisdn_netspecfac_type2str(get_ftdm_val(nsf_plan_codes, netFac->netIdPlan.val, 0x00))); - } - return FTDM_SUCCESS; -} - -ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - uint8_t len = strlen(caller_data->cid_num.digits); - if (!len) { - return FTDM_SUCCESS; - } - - if (!strncasecmp(caller_data->cid_num.digits, "0000000000", strlen("0000000000"))) { - return FTDM_SUCCESS; - } - - cgPtyNmb->eh.pres = PRSNT_NODEF; - - cgPtyNmb->screenInd.pres = PRSNT_NODEF; - cgPtyNmb->screenInd.val = caller_data->screen; - - cgPtyNmb->presInd0.pres = PRSNT_NODEF; - cgPtyNmb->presInd0.val = caller_data->pres; - - cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - cgPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->cid_num.plan, IN_NP_UNK); - - cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; - - cgPtyNmb->typeNmb1.val = get_trillium_val(ton_codes, caller_data->cid_num.type, IN_TON_UNK); - - cgPtyNmb->nmbDigits.pres = PRSNT_NODEF; - cgPtyNmb->nmbDigits.len = len; - - memcpy(cgPtyNmb->nmbDigits.val, caller_data->cid_num.digits, len); - - return FTDM_SUCCESS; -} - -ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) -{ - const char* string = NULL; - uint8_t len,val; - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.digits"); - if (ftdm_strlen_zero(string)) { - return FTDM_FAIL; - } - - cgPtyNmb->eh.pres = PRSNT_NODEF; - - len = strlen(string); - cgPtyNmb->nmbDigits.len = len; - - cgPtyNmb->nmbDigits.pres = PRSNT_NODEF; - memcpy(cgPtyNmb->nmbDigits.val, string, len); - - /* Screening Indicator */ - cgPtyNmb->screenInd.pres = PRSNT_NODEF; - - val = FTDM_SCREENING_INVALID; - string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.screening_ind"); - if (!ftdm_strlen_zero(string)) { - val = ftdm_str2ftdm_screening(string); - } - - /* isdn.cg_pty2.screen_ind does not exist or we could not parse its value */ - if (val == FTDM_SCREENING_INVALID) { - /* default to caller data screening ind */ - cgPtyNmb->screenInd.val = caller_data->screen; - } else { - cgPtyNmb->screenInd.val = val; - } - - /* Presentation Indicator */ - cgPtyNmb->presInd0.pres = PRSNT_NODEF; - - val = FTDM_PRES_INVALID; - string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.presentation_ind"); - if (!ftdm_strlen_zero(string)) { - val = ftdm_str2ftdm_presentation(string); - } - - if (val == FTDM_PRES_INVALID) { - cgPtyNmb->presInd0.val = caller_data->pres; - } else { - cgPtyNmb->presInd0.val = val; - } - - /* Numbering Plan Indicator */ - cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - - val = FTDM_NPI_INVALID; - string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.npi"); - if (!ftdm_strlen_zero(string)) { - val = ftdm_str2ftdm_npi(string); - } - - if (val == FTDM_NPI_INVALID) { - cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; - } else { - cgPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, val, IN_NP_UNK); - } - - cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; - - /* Type of Number */ - val = FTDM_TON_INVALID; - string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.ton"); - if (!ftdm_strlen_zero(string)) { - val = ftdm_str2ftdm_ton(string); - } - - if (val == FTDM_TON_INVALID) { - cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; - } else { - cgPtyNmb->typeNmb1.val = get_trillium_val(ton_codes, val, IN_TON_UNK); - } - return FTDM_SUCCESS; -} - -ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - uint8_t len = strlen(caller_data->dnis.digits); - - if (!len) { - return FTDM_SUCCESS; - } - - cdPtyNmb->eh.pres = PRSNT_NODEF; - - cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - cdPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->dnis.plan, IN_NP_UNK); - - cdPtyNmb->typeNmb0.pres = PRSNT_NODEF; - cdPtyNmb->typeNmb0.val = get_trillium_val(ton_codes, caller_data->dnis.type, IN_TON_UNK); - - cdPtyNmb->nmbDigits.pres = PRSNT_NODEF; - cdPtyNmb->nmbDigits.len = len; - - - memcpy(cdPtyNmb->nmbDigits.val, caller_data->dnis.digits, len); - return FTDM_SUCCESS; -} - -ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - uint8_t len = strlen(caller_data->rdnis.digits); - if (!len) { - return FTDM_SUCCESS; - } - - redirNmb->eh.pres = PRSNT_NODEF; - - redirNmb->nmbPlanId.pres = PRSNT_NODEF; - redirNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->rdnis.plan, IN_NP_UNK); - - redirNmb->typeNmb.pres = PRSNT_NODEF; - redirNmb->typeNmb.val = get_trillium_val(ton_codes, caller_data->rdnis.type, IN_TON_UNK); - - redirNmb->nmbDigits.pres = PRSNT_NODEF; - redirNmb->nmbDigits.len = len; - - memcpy(redirNmb->nmbDigits.val, caller_data->rdnis.digits, len); - - return FTDM_SUCCESS; -} - - -ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt) -{ - uint8_t len; - const char *string = NULL; - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ftdm_bool_t force_send_cid_name = FTDM_FALSE; - - len = strlen(caller_data->cid_name); - if (!len) { - return FTDM_SUCCESS; - } - - string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.send_cid_name"); - if (!ftdm_strlen_zero(string)) { - if (!strcasecmp(string, "no")) { - return FTDM_SUCCESS; - } else if (!strcasecmp(string, "yes")) { - force_send_cid_name = FTDM_TRUE; - } - } - - if (force_send_cid_name == FTDM_FALSE && signal_data->send_cid_name == SNGISDN_OPT_FALSE) { - return FTDM_SUCCESS; - } - - switch(signal_data->cid_name_method) { - case SNGISDN_CID_NAME_FACILITY_IE: -#ifdef SNGISDN_SUPPORT_CALLING_NAME_IN_FACILITY - /* Note: The Facility IE will be overwritten if user chose to transmit a Raw Facility IE */ - sng_isdn_encode_facility_caller_name(caller_data->cid_name, conEvnt->facilityStr.facilityStr.val, &conEvnt->facilityStr.facilityStr.len); - conEvnt->facilityStr.eh.pres = PRSNT_NODEF; - conEvnt->facilityStr.facilityStr.pres = PRSNT_NODEF; -#endif - break; - case SNGISDN_CID_NAME_USR_USR_IE: - conEvnt->usrUsr.eh.pres = PRSNT_NODEF; - conEvnt->usrUsr.protocolDisc.pres = PRSNT_NODEF; - conEvnt->usrUsr.protocolDisc.val = PD_IA5; /* IA5 chars */ - conEvnt->usrUsr.usrInfo.pres = PRSNT_NODEF; - conEvnt->usrUsr.usrInfo.len = len; - /* in sangoma_brid we used to send usr-usr info as !, - change to previous style if current one does not work */ - memcpy(conEvnt->usrUsr.usrInfo.val, caller_data->cid_name, len); - break; - case SNGISDN_CID_NAME_DISPLAY_IE: - if (signal_data->switchtype == SNGISDN_SWITCH_DMS100) { - conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].dispTypeNt.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].dispTypeNt.val = 0x01; /* Calling Party Name */ - conEvnt->ntDisplay[0].assocInfo.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].assocInfo.val = 0x03; /* Included */ - conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].dispInfo.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].dispInfo.len = len; - memcpy(conEvnt->ntDisplay[0].dispInfo.val, caller_data->cid_name, len); - } else { - conEvnt->display.eh.pres = PRSNT_NODEF; - conEvnt->display.dispInfo.pres = PRSNT_NODEF; - conEvnt->display.dispInfo.len = len; - memcpy(conEvnt->display.dispInfo.val, caller_data->cid_name, len); - } - break; - default: - break; - } - - return FTDM_SUCCESS; -} - -ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) -{ - const char* clg_subaddr = NULL; - clg_subaddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.calling_subaddr"); - if (!ftdm_strlen_zero(clg_subaddr)) { - unsigned len = strlen (clg_subaddr); - cgPtySad->eh.pres = PRSNT_NODEF; - cgPtySad->typeSad.pres = 1; - cgPtySad->typeSad.val = 0; /* NSAP */ - cgPtySad->oddEvenInd.pres = 1; - cgPtySad->oddEvenInd.val = 0; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Calling Party Subaddress:%s\n", clg_subaddr); - cgPtySad->sadInfo.pres = 1; - cgPtySad->sadInfo.len = len; - memcpy(cgPtySad->sadInfo.val, clg_subaddr, len); - } - return FTDM_SUCCESS; -} - -ftdm_status_t set_called_subaddr(ftdm_channel_t *ftdmchan, CdPtySad *cdPtySad) -{ - const char* cld_subaddr = NULL; - cld_subaddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.called_subaddr"); - if (!ftdm_strlen_zero(cld_subaddr)) { - unsigned len = strlen (cld_subaddr); - cdPtySad->eh.pres = PRSNT_NODEF; - cdPtySad->typeSad.pres = 1; - cdPtySad->typeSad.val = 0; /* NSAP */ - cdPtySad->oddEvenInd.pres = 1; - cdPtySad->oddEvenInd.val = 0; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Called Party Subaddress:%s\n", cld_subaddr); - cdPtySad->sadInfo.pres = 1; - cdPtySad->sadInfo.len = len; - memcpy(cdPtySad->sadInfo.val, cld_subaddr, len); - } - return FTDM_SUCCESS; -} - -ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ - ftdm_status_t status; - status = set_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, (uint8_t*)&(facilityStr->facilityStr.len)); - if (status == FTDM_SUCCESS) { - facilityStr->eh.pres = PRSNT_NODEF; - facilityStr->facilityStr.pres = PRSNT_NODEF; - } - return status; -} - -ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len) -{ - ftdm_size_t len; - uint8_t *mydata; - void *vdata; - - if (ftdm_usrmsg_get_raw_data(ftdmchan->usrmsg, &vdata, &len) == FTDM_SUCCESS) { - mydata = vdata; - if (len > 2 && mydata[0] == SNGISDN_Q931_FACILITY_IE_ID) { - len = mydata[1]; - memcpy(data, &mydata[2], len); - *data_len = len; - return FTDM_SUCCESS; - } - } - return FTDM_FAIL; -} - -ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind) -{ - const char *str = NULL; - int descr = prog_ind.descr; - int loc = prog_ind.loc; - - str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.prog_ind.descr"); - if (!ftdm_strlen_zero(str)) { - /* User wants to override progress indicator */ - descr = ftdm_str2ftdm_sngisdn_progind_descr(str); - } - - if (descr == SNGISDN_PROGIND_DESCR_INVALID) { - /* User does not want to send progress indicator */ - return FTDM_SUCCESS; - } - - str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.prog_ind.loc"); - if (!ftdm_strlen_zero(str)) { - loc = ftdm_str2ftdm_sngisdn_progind_loc(str); - } - if (loc == SNGISDN_PROGIND_LOC_INVALID) { - loc = SNGISDN_PROGIND_LOC_USER; - } - - progInd->eh.pres = PRSNT_NODEF; - progInd->codeStand0.pres = PRSNT_NODEF; - progInd->codeStand0.val = IN_CSTD_CCITT; - - progInd->progDesc.pres = PRSNT_NODEF; - switch(descr) { - case SNGISDN_PROGIND_DESCR_NETE_ISDN: - progInd->progDesc.val = IN_PD_NOTETEISDN; - break; - case SNGISDN_PROGIND_DESCR_DEST_NISDN: - progInd->progDesc.val = IN_PD_DSTNOTISDN; - break; - case SNGISDN_PROGIND_DESCR_ORIG_NISDN: - progInd->progDesc.val = IN_PD_ORGNOTISDN; - break; - case SNGISDN_PROGIND_DESCR_RET_ISDN: - progInd->progDesc.val = IN_PD_CALLRET; - break; - case SNGISDN_PROGIND_DESCR_SERV_CHANGE: - /* Trillium defines do not match ITU-T Q931 Progress descriptions, - indicate a delayed response for now */ - progInd->progDesc.val = IN_PD_DELRESP; - break; - case SNGISDN_PROGIND_DESCR_IB_AVAIL: - progInd->progDesc.val = IN_PD_IBAVAIL; - break; - default: - ftdm_log(FTDM_LOG_WARNING, "Invalid prog_ind description:%d\n", descr); - progInd->progDesc.val = IN_PD_NOTETEISDN; - break; - } - - progInd->location.pres = PRSNT_NODEF; - switch (loc) { - case SNGISDN_PROGIND_LOC_USER: - progInd->location.val = IN_LOC_USER; - break; - case SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR: - progInd->location.val = IN_LOC_PRIVNETLU; - break; - case SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR: - progInd->location.val = IN_LOC_PUBNETLU; - break; - case SNGISDN_PROGIND_LOC_TRANSIT_NET: - progInd->location.val = IN_LOC_TRANNET; - break; - case SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR: - progInd->location.val = IN_LOC_PUBNETRU; - break; - case SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR: - progInd->location.val = IN_LOC_PRIVNETRU; - break; - case SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW: - progInd->location.val = IN_LOC_NETINTER; - break; - default: - ftdm_log(FTDM_LOG_WARNING, "Invalid prog_ind location:%d\n", loc); - progInd->location.val = IN_LOC_USER; - } - return FTDM_SUCCESS; -} - -ftdm_status_t set_network_specific_fac(ftdm_channel_t *ftdmchan, NetFac *netFac) -{ - const char *str = NULL; - - str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.netFac.spec"); - if (ftdm_strlen_zero(str)) { - /* Network-specific facility specification is mandatory, cannot send IE - without it */ - return FTDM_SUCCESS; - } else { - ftdm_sngisdn_netspecfac_spec_t spec = ftdm_str2ftdm_sngisdn_netspecfac_spec(str); - - netFac->eh.pres = PRSNT_NODEF; - netFac->netFacSpec.pres = PRSNT_NODEF; - - if (spec == SNGISDN_NETSPECFAC_SPEC_INVALID) { - int byte = 0; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Non-standard NSF specified:%s\n", str); - - if (sscanf(str, "%x", &byte) == 1) { - netFac->netFacSpec.val[0] = byte & 0xFF; - } - - netFac->netFacSpec.len = 1; - } else { - /* User is using one of the pre-specified NSF's */ - netFac->netFacSpec.val[0] = get_trillium_val(nsf_spec_codes, spec, 0x00); - netFac->netFacSpec.len = 1; - } - } - - netFac->lenNetId.pres = PRSNT_NODEF; - netFac->lenNetId.val = 0; - - str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.netFac.type"); - if (!ftdm_strlen_zero(str)) { - netFac->typeNetId.pres = PRSNT_NODEF; - netFac->typeNetId.val = ftdm_str2ftdm_sngisdn_netspecfac_type(str); - } - - str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.netFac.plan"); - if (!ftdm_strlen_zero(str)) { - netFac->netIdPlan.pres = PRSNT_NODEF; - netFac->netIdPlan.val = ftdm_str2ftdm_sngisdn_netspecfac_plan(str); - } - - if (netFac->netIdPlan.pres == PRSNT_NODEF || netFac->typeNetId.pres == PRSNT_NODEF) { - netFac->lenNetId.val++; - } - - str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.netFac.ident"); - if (!ftdm_strlen_zero(str)) { - netFac->lenNetId.val++; - - netFac->netId.pres = PRSNT_NODEF; - memcpy(netFac->netId.val, str, strlen(str)); - } - - return FTDM_SUCCESS; -} - -ftdm_status_t set_user_to_user_ie(ftdm_channel_t *ftdmchan, UsrUsr *usrUsr) -{ - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - - if (sngisdn_info->transfer_data.type == SNGISDN_TRANSFER_ATT_COURTESY_VRU_DATA) { - usrUsr->eh.pres = PRSNT_NODEF; - - usrUsr->protocolDisc.pres = PRSNT_NODEF; - usrUsr->protocolDisc.val = 0x08; - usrUsr->usrInfo.pres = PRSNT_NODEF; - usrUsr->usrInfo.len = strlen(sngisdn_info->transfer_data.tdata.att_courtesy_vru.data); - memcpy(usrUsr->usrInfo.val, sngisdn_info->transfer_data.tdata.att_courtesy_vru.data, usrUsr->usrInfo.len); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending AT&T Transfer data len:%d\n", usrUsr->usrInfo.len); - - return FTDM_SUCCESS; - } - - return FTDM_SUCCESS; -} - -ftdm_status_t set_cause_ie(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn) -{ - - causeDgn->eh.pres = PRSNT_NODEF; - causeDgn->location.pres = PRSNT_NODEF; - causeDgn->location.val = IN_LOC_PRIVNETLU; - causeDgn->codeStand3.pres = PRSNT_NODEF; - causeDgn->codeStand3.val = IN_CSTD_CCITT; - causeDgn->causeVal.pres = PRSNT_NODEF; - causeDgn->causeVal.val = ftdmchan->caller_data.hangup_cause; - causeDgn->recommend.pres = NOTPRSNT; - causeDgn->dgnVal.pres = NOTPRSNT; - return FTDM_SUCCESS; -} - -ftdm_status_t set_chan_id_ie(ftdm_channel_t *ftdmchan, ChanId *chanId) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; - if (!ftdmchan) { - return FTDM_SUCCESS; - } - - ftdm_set_flag(sngisdn_info, FLAG_SENT_CHAN_ID); - - chanId->eh.pres = PRSNT_NODEF; - chanId->prefExc.pres = PRSNT_NODEF; - chanId->prefExc.val = IN_PE_EXCLSVE; - chanId->dChanInd.pres = PRSNT_NODEF; - chanId->dChanInd.val = IN_DSI_NOTDCHAN; - chanId->intIdentPres.pres = PRSNT_NODEF; - chanId->intIdentPres.val = IN_IIP_IMPLICIT; - - if (FTDM_SPAN_IS_BRI(ftdmchan->span)) { - - /* BRI only params */ - chanId->intType.pres = PRSNT_NODEF; - chanId->intType.val = IN_IT_BASIC; - chanId->infoChanSel.pres = PRSNT_NODEF; - chanId->infoChanSel.val = ftdmchan->physical_chan_id; - } else { - if (signal_data->nfas.trunk) { - chanId->intIdentPres.val = IN_IIP_EXPLICIT; - chanId->intIdent.pres = PRSNT_NODEF; - chanId->intIdent.val = signal_data->nfas.interface_id; - } - - chanId->intType.pres = PRSNT_NODEF; - chanId->intType.val = IN_IT_OTHER; - chanId->infoChanSel.pres = PRSNT_NODEF; - chanId->infoChanSel.val = IN_ICS_B1CHAN; - chanId->chanMapType.pres = PRSNT_NODEF; - chanId->chanMapType.val = IN_CMT_BCHAN; - chanId->nmbMap.pres = PRSNT_NODEF; - chanId->nmbMap.val = IN_NM_CHNNMB; - chanId->codeStand1.pres = PRSNT_NODEF; - chanId->codeStand1.val = IN_CSTD_CCITT; - chanId->chanNmbSlotMap.pres = PRSNT_NODEF; - chanId->chanNmbSlotMap.len = 1; - chanId->chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; - } - - return FTDM_SUCCESS; -} - -ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - bearCap->eh.pres = PRSNT_NODEF; - bearCap->infoTranCap.pres = PRSNT_NODEF; - bearCap->infoTranCap.val = sngisdn_get_infoTranCap_from_user(ftdmchan->caller_data.bearer_capability); - - bearCap->codeStand0.pres = PRSNT_NODEF; - bearCap->codeStand0.val = IN_CSTD_CCITT; - bearCap->infoTranRate0.pres = PRSNT_NODEF; - bearCap->infoTranRate0.val = IN_ITR_64KBIT; - bearCap->tranMode.pres = PRSNT_NODEF; - bearCap->tranMode.val = IN_TM_CIRCUIT; - - bearCap->usrInfoLyr1Prot.pres = PRSNT_NODEF; - bearCap->usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1); - - switch (signal_data->switchtype) { - case SNGISDN_SWITCH_NI2: - case SNGISDN_SWITCH_4ESS: - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_DMS100: - case SNGISDN_SWITCH_INSNET: - if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to u-law\n"); - bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ULAW; - } - break; - case SNGISDN_SWITCH_EUROISDN: - case SNGISDN_SWITCH_QSIG: - if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to a-law\n"); - bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ALAW; - } - break; - } - - bearCap->lyr1Ident.pres = PRSNT_NODEF; - bearCap->lyr1Ident.val = IN_L1_IDENT; - - return FTDM_SUCCESS; -} - -ftdm_status_t set_restart_ind_ie(ftdm_channel_t *ftdmchan, RstInd *rstInd) -{ - rstInd->eh.pres = PRSNT_NODEF; - rstInd->rstClass.pres = PRSNT_NODEF; - rstInd->rstClass.val = IN_CL_INDCHAN; - return FTDM_SUCCESS; -} - -ftdm_status_t set_not_ind_ie(ftdm_channel_t *ftdmchan, NotInd *notInd) -{ - notInd->eh.pres = PRSNT_NODEF; - notInd->notDesc.pres = PRSNT_NODEF; - notInd->notDesc.val = 0x71; /* Call information event */ - return FTDM_SUCCESS; -} - -void sngisdn_t3_timeout(void *p_sngisdn_info) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Timer T3 expired (suId:%d suInstId:%u spInstId:%u)\n", - signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)){ - /* PHY layer timed-out, need to clear the call */ - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Failed to Wake-Up line (suId:%d suInstId:%u spInstId:%u)\n", - signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); - - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NO_ROUTE_DESTINATION; - ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); - ftdm_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - } - ftdm_mutex_unlock(ftdmchan->mutex); -} - - -void sngisdn_delayed_dl_req(void *p_signal_data) -{ - ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t *)p_signal_data; - ftdm_span_t *span = signal_data->ftdm_span; - - if (!signal_data->dl_request_pending) { - return; - } - - ftdm_span_get_sig_status(span, &sigstatus); - if (sigstatus == FTDM_SIG_STATE_UP) { - signal_data->dl_request_pending = 0; - return; - } - - sngisdn_snd_dl_req(span->channels[1]); - ftdm_sched_timer(signal_data->sched, "delayed_dl_req", 4000, sngisdn_delayed_dl_req, (void*) signal_data, NULL); - - return; -} - -void sngisdn_restart_timeout(void *p_signal_data) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t *)p_signal_data; - ftdm_span_t *span = signal_data->ftdm_span; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - ftdm_log(FTDM_LOG_DEBUG, "s%s:Did not receive a RESTART from remote switch in %d ms - restarting\n", span->name, signal_data->restart_timeout); - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); - if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESET); - } - ftdm_mutex_unlock(ftdmchan->mutex); - } - } - return; -} - -void sngisdn_delayed_setup(void *p_sngisdn_info) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ftdm_mutex_lock(ftdmchan->mutex); - sngisdn_snd_setup(ftdmchan); - ftdm_mutex_unlock(ftdmchan->mutex); - return; -} - -void sngisdn_delayed_release_nfas(void *p_sngisdn_info) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - ftdm_mutex_lock(ftdmchan->mutex); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed RELEASE (suId:%d suInstId:%u spInstId:%u)\n", - signal_data->cc_id, sngisdn_info->spInstId, sngisdn_info->suInstId); - - sngisdn_snd_release(ftdmchan, 0); - - ftdm_mutex_unlock(ftdmchan->mutex); - return; -} - -void sngisdn_delayed_release(void *p_sngisdn_info) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - ftdm_mutex_lock(ftdmchan->mutex); - - if (ftdm_test_flag(sngisdn_info, FLAG_DELAYED_REL)) { - ftdm_clear_flag(sngisdn_info, FLAG_DELAYED_REL); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed RELEASE (suId:%d suInstId:%u spInstId:%u)\n", - signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); - - sngisdn_snd_release(ftdmchan, 1); - clear_call_glare_data(sngisdn_info); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Call was already released (suId:%d suInstId:%u spInstId:%u)\n", - signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); - } - ftdm_mutex_unlock(ftdmchan->mutex); - return; -} - -void sngisdn_delayed_connect(void *p_sngisdn_info) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - ftdm_mutex_lock(ftdmchan->mutex); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed CONNECT (suId:%d suInstId:%u spInstId:%u)\n", - signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); - - sngisdn_snd_connect(ftdmchan); - ftdm_mutex_unlock(ftdmchan->mutex); - return; -} - -void sngisdn_delayed_disconnect(void *p_sngisdn_info) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdmchan->caller_data.hangup_cause == IN_CCNORTTODEST || ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", - signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); - - sngisdn_snd_disconnect(ftdmchan); - if (ftdmchan->caller_data.hangup_cause == IN_CCNORTTODEST) { - ftdm_channel_t *close_chan = ftdmchan; - ftdm_channel_close(&close_chan); - } - } - - ftdm_mutex_unlock(ftdmchan->mutex); - return; -} - -void sngisdn_facility_timeout(void *p_sngisdn_info) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdmchan->state == FTDM_CHANNEL_STATE_GET_CALLERID) { - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Facility timeout reached proceeding with call (suId:%d suInstId:%u spInstId:%u)\n", - signal_data->cc_id, sngisdn_info->spInstId, sngisdn_info->suInstId); - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - - ftdm_mutex_unlock(ftdmchan->mutex); - return; -} - -ftdm_status_t sngisdn_check_free_ids(void) -{ - unsigned i; - unsigned j; - ftdm_log(FTDM_LOG_INFO, "Checking suInstId's\n"); - for(j=1;j<=MAX_VARIANTS;j++) { - if (g_sngisdn_data.ccs[j].config_done) { - for(i=1;isignal_data; - - memset(&sts, 0, sizeof(sts)); - sng_isdn_phy_stats(sngisdn_dchan(signal_data)->link_id , &sts); - - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, " Span:%s", span->name); - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, " Performance Counters"); - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, "RX Packets:\t%u\tTX Packets:\t%u\tEvents:%u\n", sts.t.sts.rx_packets, sts.t.sts.tx_packets, sts.t.sts.rx_events); - stream->write_function(stream, "RX Bytes:\t%u\tTX Bytes:\t%u\n\n", sts.t.sts.rx_bytes, sts.t.sts.tx_bytes); - stream->write_function(stream, "TX Queue:\t%u/%u\tRX Queue:\t%u/%u\tEvents Queue:\t%u/%u\n", - sts.t.sts.num_frames_in_tx_queue,sts.t.sts.tx_queue_len, - sts.t.sts.num_frames_in_rx_queue, sts.t.sts.rx_queue_len, - sts.t.sts.rx_events_in_queue, sts.t.sts.event_queue_len); - - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, " Errors"); - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, "RX Errors:\t%u\tTX Errors:\t%u\n", sts.t.sts.rx_errors, sts.t.sts.tx_errors); - stream->write_function(stream, "RX Dropped:\t%u\tTX Dropped:\t%u\tEvents Dropped:\t%u\n", sts.t.sts.rx_dropped, sts.t.sts.tx_dropped,sts.t.sts.rx_events_dropped); - - - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, " RX Errors Details"); - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, "CRC:\t\t%u\tFrame:\t\t%u\tOverruns:\t%u\n", sts.t.sts.rx_crc_errors, sts.t.sts.rx_frame_errors, sts.t.sts.rx_over_errors); - stream->write_function(stream, "Fifo:\t\t%u\tAborts:\t\t%u\tMissed:\t\t%u\n", sts.t.sts.rx_fifo_errors, sts.t.sts.rx_hdlc_abort_counter, sts.t.sts.rx_missed_errors); - stream->write_function(stream, "Length:\t\t%u\n", sts.t.sts.rx_length_errors); - - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, " TX Errors Details"); - stream->write_function(stream, "\n---------------------------------------------------------------------\n"); - stream->write_function(stream, "Aborted:\t%u\tFifo:\t\t%u\tCarrier:\t%u\n", sts.t.sts.tx_aborted_errors, sts.t.sts.tx_fifo_errors, sts.t.sts.tx_carrier_errors); - return FTDM_SUCCESS; -} - - -ftdm_status_t sngisdn_show_span(ftdm_stream_handle_t *stream, ftdm_span_t *span) -{ - ftdm_signaling_status_t sigstatus; - ftdm_alarm_flag_t alarmbits; - ftdm_channel_t *fchan; - alarmbits = FTDM_ALARM_NONE; - fchan = ftdm_span_get_channel(span, 1); - if (fchan) { - ftdm_channel_get_alarms(fchan, &alarmbits); - } - - ftdm_span_get_sig_status(span, &sigstatus); - stream->write_function(stream, "span:%s physical:%s signalling:%s\n", - span->name, alarmbits ? "ALARMED" : "OK", - ftdm_signaling_status2str(sigstatus)); - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_show_spans(ftdm_stream_handle_t *stream) -{ - int i; - for(i=1;i<=MAX_L1_LINKS;i++) { - if (g_sngisdn_data.spans[i]) { - sngisdn_show_span(stream, g_sngisdn_data.spans[i]->ftdm_span); - } - } - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_add_var(sngisdn_chan_data_t *sngisdn_info, const char* var, const char* val) -{ - char *t_name = 0, *t_val = 0; - if (!var || !val) { - return FTDM_FAIL; - } - if (!sngisdn_info->variables) { - /* initialize on first use */ - sngisdn_info->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - ftdm_assert_return(sngisdn_info->variables, FTDM_FAIL, "Failed to create hash table\n"); - } - t_name = ftdm_strdup(var); - t_val = ftdm_strdup(val); - hashtable_insert(sngisdn_info->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE); - return FTDM_SUCCESS; -} - -ftdm_status_t sngisdn_add_raw_data(sngisdn_chan_data_t *sngisdn_info, uint8_t* data, ftdm_size_t data_len) -{ - ftdm_assert_return(!sngisdn_info->raw_data, FTDM_FAIL, "Overwriting existing raw data\n"); - - sngisdn_info->raw_data = ftdm_calloc(1, data_len); - ftdm_assert_return(sngisdn_info->raw_data, FTDM_FAIL, "Failed to allocate raw data\n"); - - memcpy(sngisdn_info->raw_data, data, data_len); - sngisdn_info->raw_data_len = data_len; - return FTDM_SUCCESS; -} - -void sngisdn_send_signal(sngisdn_chan_data_t *sngisdn_info, ftdm_signal_event_t event_id) -{ - ftdm_sigmsg_t sigev; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - memset(&sigev, 0, sizeof(sigev)); - - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - sigev.event_id = event_id; - - if (sngisdn_info->variables) { - /* - * variables now belongs to the ftdm core, and - * will be cleared after sigev is processed by user. Set - * local pointer to NULL so we do not attempt to - * destroy it */ - sigev.variables = sngisdn_info->variables; - sngisdn_info->variables = NULL; - } - - if (sngisdn_info->raw_data) { - /* - * raw_data now belongs to the ftdm core, and - * will be cleared after sigev is processed by user. Set - * local pointer to NULL so we do not attempt to - * destroy it */ - - sigev.raw.data = sngisdn_info->raw_data; - sigev.raw.len = sngisdn_info->raw_data_len; - - sngisdn_info->raw_data = NULL; - sngisdn_info->raw_data_len = 0; - } - if (event_id == FTDM_SIGEVENT_TRANSFER_COMPLETED) { - sigev.ev_data.transfer_completed.response = sngisdn_info->transfer_data.response; - } - ftdm_span_send_signal(ftdmchan->span, &sigev); -} - -sngisdn_span_data_t *sngisdn_dchan(sngisdn_span_data_t *signal_data) -{ - if (!signal_data) { - return NULL; - } - - if (!signal_data->nfas.trunk) { - return signal_data; - } - return signal_data->nfas.trunk->dchan; -} - - -/* 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/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c deleted file mode 100644 index 56797fbf9c..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ /dev/null @@ -1,996 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ftmod_sangoma_isdn.h" -#include "ftmod_sangoma_isdn_trace.h" - -#define OCTET(x) (ieData[x-1] & 0xFF) -#define MAX_DECODE_STR_LEN 2000 - -typedef struct sngisdn_trace_info -{ - uint8_t call_ref_flag; - uint16_t call_ref; - uint8_t msgtype; - uint8_t bchan_no; - ftdm_trace_dir_t dir; -} sngisdn_frame_info_t; - -void print_hex_dump(char* str, uint32_t *str_len, uint8_t* data, uint32_t index_start, uint32_t index_end); -uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset, uint8_t *data, uint16_t index_start); -static ftdm_status_t sngisdn_map_call(sngisdn_span_data_t *signal_data, sngisdn_frame_info_t frame_info, ftdm_channel_t **found); -static ftdm_status_t sngisdn_get_frame_info(uint8_t *data, uint32_t data_len, ftdm_trace_dir_t dir, sngisdn_frame_info_t *frame_info); - -uint8_t get_bits(uint8_t octet, uint8_t bitLo, uint8_t bitHi); -char* get_code_2_str(int code, struct code2str *pCodeTable); -void sngisdn_decode_q921(char* str, uint8_t* data, uint32_t data_len); -void sngisdn_decode_q931(char* str, uint8_t* data, uint32_t data_len); - - -char* get_code_2_str(int code, struct code2str *pCodeTable) -{ - struct code2str* pCode2txt; - pCode2txt = pCodeTable; - while(pCode2txt) { - if(pCode2txt->code >= 0) { - if (pCode2txt->code == code) { - return pCode2txt->text; - } - pCode2txt++; - } else { - /* This is the default value from the table */ - return pCode2txt->text; - } - } - return (char*)"unknown"; -} - - -uint8_t get_bits(uint8_t octet, uint8_t bitLo, uint8_t bitHi) -{ - if (!bitLo || !bitHi) { - return 0; - } - if (bitLo > bitHi) { - return 0; - } - - bitLo--; - bitHi--; - - switch(bitHi - bitLo) { - case 0: - return (octet >> bitLo) & 0x01; - case 1: - return (octet >> bitLo) & 0x03; - case 2: - return (octet >> bitLo) & 0x07; - case 3: - return (octet >> bitLo) & 0x0F; - case 4: - return (octet >> bitLo) & 0x1F; - case 5: - return (octet >> bitLo) & 0x3F; - case 6: - return (octet >> bitLo) & 0x7F; - case 7: - return (octet >> bitLo) & 0xFF; - } - return 0; -} - -void sngisdn_trace_interpreted_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len) -{ - char *data_str = ftdm_calloc(1,500); /* TODO Find a proper size */ - sngisdn_decode_q921(data_str, data, data_len); - ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN Q921] %s FRAME %s:\n%s\n", signal_data->ftdm_span->name, ftdm_trace_dir2str(dir), data_str); - ftdm_safe_free(data_str); -} - -void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len) -{ - uint8_t *raw_data; - ftdm_sigmsg_t sigev; - - memset(&sigev, 0, sizeof(sigev)); - - sigev.span_id = signal_data->ftdm_span->span_id; - sigev.chan_id = signal_data->dchan->chan_id; - sigev.channel = signal_data->dchan; - sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; - - sigev.ev_data.trace.dir = dir; - sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q921; - - raw_data = ftdm_malloc(data_len); - ftdm_assert(raw_data, "Failed to malloc"); - - memcpy(raw_data, data, data_len); - sigev.raw.data = raw_data; - sigev.raw.len = data_len; - ftdm_span_send_signal(signal_data->ftdm_span, &sigev); -} - -void sngisdn_decode_q921(char* str, uint8_t* data, uint32_t data_len) -{ - uint32_t str_len; - uint32_t i; - uint8_t sapi, cr, ea, tei, ns, nr, pf, p, cmd; - uint8_t frame_format = 0; - - str_len = 0; - - if(data_len >= 2) { - switch ((int)data[2] & 0x03) { - case 0: case 2: - frame_format = I_FRAME; - break; - case 1: - frame_format = S_FRAME; - break; - case 3: - frame_format = U_FRAME; - break; - } - } - - str_len+= sprintf(&str[str_len], " format: %s\n", - get_code_2_str(frame_format, dcodQ921FrameFormatTable)); - - for(i=0; i < data_len; i++) { - switch(i) { - case 0: // Octet 2 - sapi = (uint8_t)((data[i]>>2) & 0x3F); - cr = (uint8_t)((data[i]>>1) & 0x1); - ea = (uint8_t)(data[i] & 0x1); - str_len+= sprintf(&str[str_len], " sapi: %03d c/r: %01d ea: %01d\n", sapi, cr, ea); - break; - case 1: - tei = (uint8_t)((data[i]>>1) & 0x7F); - ea = (uint8_t)(data[i] & 0x1); - str_len+= sprintf(&str[str_len], " tei: %03d ea: %01d\n", tei, ea); - break; - case 2: - switch(frame_format) { - case I_FRAME: - ns = (uint8_t)((data[i]>>1) & 0x7F); - nr = (uint8_t)((data[i+1]>>1) & 0x7F); - p = (uint8_t)(data[i+1] & 0x01); - str_len+= sprintf(&str[str_len], " n(s): %03d\n n(r): %03d p: %01d\n", ns, nr, p); - break; - case S_FRAME: - nr = (uint8_t)((data[i+1]>>1) & 0x7F); - pf = (uint8_t)(data[i+1] & 0x01); - str_len+= sprintf(&str[str_len], " n(r): %03d p/f: %01d\n", nr, pf); - - cmd = (uint8_t)((data[i]>>2) & 0x03); - str_len+= sprintf(&str[str_len], " cmd: %s\n", get_code_2_str(cmd, dcodQ921SupervisoryCmdTable)); - - break; - case U_FRAME: - pf = (uint8_t)((data[i]>>4) & 0x01); - str_len+= sprintf(&str[str_len], " p/f: %01d\n", pf); - - cmd = (uint8_t)((data[i]>>2) & 0x03); - cmd |= (uint8_t)((data[i]>>5) & 0x07); - - str_len+= sprintf(&str[str_len], " cmd: %s\n", get_code_2_str(cmd, dcodQ921UnnumberedCmdTable)); - break; - } - break; - } - } - - print_hex_dump(str, &str_len, (uint8_t*) data, 0, data_len); - return; -} - - -void sngisdn_trace_interpreted_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len) -{ - char *data_str = ftdm_calloc(1,MAX_DECODE_STR_LEN); /* TODO Find a proper size */ - sngisdn_decode_q931(data_str, data, data_len); - ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN Q931] %s FRAME %s:\n%s\n", signal_data->ftdm_span->name, ftdm_trace_dir2str(dir), data_str); - ftdm_safe_free(data_str); -} - -void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len) -{ - uint8_t *raw_data; - ftdm_sigmsg_t sigev; - ftdm_channel_t *ftdmchan = NULL; - sngisdn_frame_info_t frame_info; - - memset(&sigev, 0, sizeof(sigev)); - - /* Note: Mapped raw trace assume only exclusive b-channel selection is used. i.e the b-channel selected on outgoing SETUP is always used for the call */ - - if (sngisdn_get_frame_info(data, data_len, dir, &frame_info) == FTDM_SUCCESS) { - if (sngisdn_map_call(signal_data, frame_info, &ftdmchan) == FTDM_SUCCESS) { - sigev.call_id = ftdmchan->caller_data.call_id; - sigev.span_id = ftdmchan->physical_span_id; - sigev.chan_id = ftdmchan->physical_chan_id; - sigev.channel = ftdmchan; - } else { - /* We could not map the channel, but at least set the span */ - if (signal_data->ftdm_span->channels[1]) { - sigev.span_id = signal_data->ftdm_span->channels[1]->physical_span_id; - } - } - sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; - - sigev.ev_data.trace.dir = dir; - sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q931; - - raw_data = ftdm_malloc(data_len); - ftdm_assert(raw_data, "Failed to malloc"); - - memcpy(raw_data, data, data_len); - sigev.raw.data = raw_data; - sigev.raw.len = data_len; - ftdm_span_send_signal(signal_data->ftdm_span, &sigev); - } -} - -void sngisdn_decode_q931(char* str, uint8_t* data, uint32_t data_len) -{ - uint32_t str_len; - uint8_t prot_disc, callRefFlag; - uint16_t lenCallRef, c, i; - uint8_t current_codeset = 0; - - str_len = 0; - - /* Decode Protocol Discrimator */ - prot_disc = (uint8_t)data[0]; - str_len += sprintf(&str[str_len], " Prot Disc:%s (0x%02x)\n", get_code_2_str(prot_disc, dcodQ931ProtDiscTable), prot_disc); - - /* Decode Call Reference */ - lenCallRef = (uint8_t) (data[1] & 0x0F); - - str_len += sprintf(&str[str_len], " Call Ref:"); - c=2; - callRefFlag = get_bits(data[c], 8,8); - for(i=0; i<(2*lenCallRef);i++) { - if(i==0) { - str_len += sprintf(&str[str_len], "%s%s", - get_code_2_str((uint8_t)(data[c] & 0x70), dcodQ931CallRefHiTable), - get_code_2_str((uint8_t)(data[c] & 0x0F), dcodQ931CallRefLoTable)); - } else { - str_len += sprintf(&str[str_len], "%s%s", - get_code_2_str((uint8_t)(data[c] & 0xF0), dcodQ931CallRefHiTable), - get_code_2_str((uint8_t)(data[c] & 0x0F), dcodQ931CallRefLoTable)); - } - - i=i+1; - c=c+1; - } - str_len += sprintf(&str[str_len], " (%s side)\n", callRefFlag?"Destination":"Originating"); - - /* Decode message type */ - str_len+= sprintf(&str[str_len], " Type:%s (0x%x)\n", get_code_2_str((int)(data[2+lenCallRef] & 0xFF), dcodQ931MsgTypeTable), (int)(data[2+lenCallRef] & 0xFF)); - - /* go through rest of data and look for important info */ - for(i=3+lenCallRef; i < data_len; i++) { - switch (data[i] & 0xF8) { - case Q931_LOCKING_SHIFT: - current_codeset = (data[i] & 0x7); - str_len+= sprintf(&str[str_len], "Codeset shift to %d (locking)\n", current_codeset); - continue; - case Q931_NON_LOCKING_SHIFT: - current_codeset = (data[i] & 0x7); - str_len+= sprintf(&str[str_len], "Codeset shift to %d (non-locking)\n", current_codeset); - continue; - } - i+= sngisdn_decode_ie(str, &str_len, current_codeset, data, i); - } - print_hex_dump(str, &str_len, (uint8_t*) data, 0, data_len); - return; -} - -uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset, uint8_t *data, uint16_t index_start) -{ - unsigned char* ieData; - uint8_t ieId; - uint32_t len = 0; - int index_end; - - ieData = (unsigned char*) &data[index_start]; - - ieId = OCTET(1); - len = OCTET(2); - index_end = index_start+len+1; - - *str_len += sprintf(&str[*str_len], " %s:", get_code_2_str(data[index_start], dcodQ931IEIDTable)); - switch(ieId) { - case PROT_Q931_IE_BEARER_CAP: - { - uint8_t codingStandard, infTransferCap, infTransferRate, usrL1Prot; - /*uint8_t transferMode;*/ - - codingStandard = get_bits(OCTET(3),6,7); - infTransferCap = get_bits(OCTET(3),1,5); - /*transferMode = get_bits(OCTET(4),6,7);*/ - infTransferRate = get_bits(OCTET(4),1,5); - usrL1Prot = get_bits(OCTET(5),1,5); - - *str_len+= sprintf(&str[*str_len], "Coding:%s(%d) TransferCap:%s(%d) TransferRate:%s(%d) L1Prot:%s(%d)\n", - get_code_2_str(codingStandard, dcodQ931BcCodingStandardTable), codingStandard, - get_code_2_str(infTransferCap, dcodQ931BcInfTransferCapTable), infTransferCap, - get_code_2_str(infTransferRate, dcodQ931BcInfTransferRateTable), infTransferRate, - get_code_2_str(usrL1Prot, dcodQ931BcusrL1ProtTable), usrL1Prot); - } - break; - case PROT_Q931_IE_CAUSE: - { - uint8_t codingStandard, location, cause,diagOct = 5; - codingStandard = get_bits(OCTET(3),6,7); - location = get_bits(OCTET(3),1,4); - - cause = get_bits(OCTET(4),1,7); - - *str_len+= sprintf(&str[*str_len], "coding:%s(%d) location:%s(%d) val:%s(%d)\n", - get_code_2_str(codingStandard, dcodQ931BcCodingStandardTable), codingStandard, - get_code_2_str(location,dcodQ931IelocationTable), location, - get_code_2_str(cause, dcodQ931CauseCodeTable), - cause); - switch(cause) { - case PROT_Q931_RELEASE_CAUSE_IE_NOT_EXIST: - while(diagOct++ < len) { - *str_len+= sprintf(&str[*str_len], " %d:IE %s(0x%02x)\n", - diagOct, - get_code_2_str(OCTET(diagOct), dcodQ931IEIDTable), - OCTET(diagOct)); - } - break; - case PROT_Q931_RELEASE_CAUSE_WRONG_CALL_STATE: - while(diagOct++ < len) { - *str_len+= sprintf(&str[*str_len], " %d:Message %s(0x%02x)\n", - diagOct, - get_code_2_str(OCTET(diagOct), dcodQ931MsgTypeTable), - OCTET(diagOct)); - } - break; - case PROT_Q931_RECOVERY_ON_TIMER_EXPIRE: - *str_len+= sprintf(&str[*str_len], " Timer T\n"); - while(diagOct++ < len) { - if(OCTET(diagOct) >= ' ' && OCTET(diagOct) < 0x7f) { - *str_len+= sprintf(&str[*str_len], "%c", OCTET(diagOct)); - } else { - *str_len+= sprintf(&str[*str_len], "."); - } - } - break; - default: - while(diagOct++ < len) { - *str_len+= sprintf(&str[*str_len], " %d: 0x%02x\n", - diagOct, - OCTET(diagOct)); - } - break; - } - } - break; - case PROT_Q931_IE_CHANNEL_ID: - { - uint8_t infoChannelSelection=0; - uint8_t prefExclusive=0; - uint8_t ifaceIdPresent=0; - /* uint8_t ifaceIdentifier = 0; */ /* octet_3_1 */ - uint8_t chanType=0, numberMap=0; - /* uint8_t codingStandard=0; */ - uint8_t channelNo = 0; - - infoChannelSelection = get_bits(OCTET(3),1,2); - prefExclusive = get_bits(OCTET(3),4,4); - ifaceIdPresent = get_bits(OCTET(3),7,7); - - if (ifaceIdPresent) { - /*ifaceIdentifier= get_bits(OCTET(4),1,7);*/ - chanType = get_bits(OCTET(5),1,4); - numberMap = get_bits(OCTET(5),5,5); - /*codingStandard = get_bits(OCTET(5),6,7);*/ - channelNo = get_bits(OCTET(6),1,7); - } else { - chanType = get_bits(OCTET(4),1,4); - numberMap = get_bits(OCTET(4),5,5); - /*codingStandard = get_bits(OCTET(4),6,7);*/ - channelNo = get_bits(OCTET(5),1,7); - } - - if (numberMap) { - *str_len+= sprintf(&str[*str_len], " MAP:%s ", get_code_2_str(infoChannelSelection, dcodQ931InfoChannelSelTable)); - } else { - *str_len+= sprintf(&str[*str_len], "No:%d ", channelNo); - } - - *str_len+= sprintf(&str[*str_len], "Type:%s(%d) %s ", get_code_2_str(chanType,dcodQ931ChanTypeTable), chanType, (numberMap)? "Map":""); - *str_len+= sprintf(&str[*str_len], "%s/%s \n", - (prefExclusive)? "Exclusive":"Preferred", - (ifaceIdPresent)? "Explicit":"Implicit"); - } - break; - case PROT_Q931_IE_CALLING_PARTY_NUMBER: - { - uint8_t plan, type, screening = 0, presentation = 0, callingNumOct, j; - uint8_t screeningEnabled = 0, presentationEnabled = 0; - char callingNumDigits[32]; - memset(callingNumDigits, 0, sizeof(callingNumDigits)); - - plan = get_bits(OCTET(3),1,4); - type = get_bits(OCTET(3),5,7); - - if(!get_bits(OCTET(3),8,8)) { - screening = get_bits(OCTET(4),1,2); - presentation = get_bits(OCTET(4),6,7); - screeningEnabled = 1; - presentationEnabled = 1; - callingNumOct = 4; - } else { - callingNumOct = 3; - } - if(len >= sizeof(callingNumDigits)) { - len = sizeof(callingNumDigits)-1; - } - j = 0; - while(callingNumOct++ <= len+1) { - callingNumDigits[j++]=ia5[get_bits(OCTET(callingNumOct),1,4)][get_bits(OCTET(callingNumOct),5,8)]; - } - callingNumDigits[j]='\0'; - *str_len+= sprintf(&str[*str_len], "%s(l:%d) plan:%s(%d) type:%s(%d)", - - callingNumDigits, j, - get_code_2_str(plan, dcodQ931NumberingPlanTable), plan, - get_code_2_str(type, dcodQ931TypeofNumberTable), type); - - if (presentationEnabled||screeningEnabled) { - *str_len+= sprintf(&str[*str_len], "scr:%s(%d) pres:%s(%d)\n", - get_code_2_str(screening, dcodQ931ScreeningTable), screening, - get_code_2_str(presentation, dcodQ931PresentationTable), presentation); - } else { - *str_len+= sprintf(&str[*str_len], "\n"); - } - } - break; - - case PROT_Q931_IE_CALLED_PARTY_NUMBER: - { - uint8_t plan, type, calledNumOct,j; - char calledNumDigits[32]; - memset(calledNumDigits, 0, sizeof(calledNumDigits)); - plan = get_bits(OCTET(3),1,4); - type = get_bits(OCTET(3),5,7); - - if(len >= sizeof(calledNumDigits)) { - len = sizeof(calledNumDigits)-1; - } - calledNumOct = 3; - j = 0; - while(calledNumOct++ <= len+1) { - calledNumDigits[j++]=ia5[get_bits(OCTET(calledNumOct),1,4)][get_bits(OCTET(calledNumOct),5,8)]; - } - calledNumDigits[j]='\0'; - *str_len+= sprintf(&str[*str_len], "%s(l:%d) plan:%s(%d) type:%s(%d)\n", - calledNumDigits, j, - get_code_2_str(plan, dcodQ931NumberingPlanTable), plan, - get_code_2_str(type, dcodQ931TypeofNumberTable), type); - } - break; - case PROT_Q931_IE_REDIRECTING_NUMBER: //rdnis - { - uint8_t plan, type, screening = 0, presentation = 0, reason = 0, rdnisOct,j; - uint8_t screeningEnabled = 0, presentationEnabled = 0, reasonEnabled = 0; - char rdnis_string[32]; - memset(rdnis_string, 0, sizeof(rdnis_string)); - rdnisOct = 5; - plan = get_bits(OCTET(3),1,4); - type = get_bits(OCTET(3),5,7); - - if(!get_bits(OCTET(3),8,8)) { //Oct 3a exists - rdnisOct++; - screening = get_bits(OCTET(4),1,2); - presentation = get_bits(OCTET(4),6,7); - screeningEnabled = 1; - presentationEnabled = 1; - if (!get_bits(OCTET(4),8,8)) { //Oct 3b exists - rdnisOct++; - reason = get_bits(OCTET(5),1,4); - reasonEnabled = 1; - } - } - - if(len >= sizeof(rdnis_string)) { - len = sizeof(rdnis_string)-1; - } - - j = 0; - while(rdnisOct++ <= len+1) { - rdnis_string[j++]=ia5[get_bits(OCTET(rdnisOct),1,4)][get_bits(OCTET(rdnisOct),5,8)]; - } - - rdnis_string[j]='\0'; - *str_len+= sprintf(&str[*str_len], "%s(l:%d) plan:%s(%d) type:%s(%d)", - rdnis_string, j, - get_code_2_str(plan, dcodQ931NumberingPlanTable), plan, - get_code_2_str(type, dcodQ931TypeofNumberTable), type); - - if(presentationEnabled || screeningEnabled) { - *str_len+= sprintf(&str[*str_len], "scr:%s(%d) pres:%s(%d)", - get_code_2_str(screening, dcodQ931ScreeningTable), screening, - get_code_2_str(presentation, dcodQ931PresentationTable), presentation); - } - - if(reasonEnabled) { - *str_len+= sprintf(&str[*str_len], "reason:%s(%d)", - get_code_2_str(reason, dcodQ931ReasonTable), reason); - } - *str_len+= sprintf(&str[*str_len], "\n"); - } - break; - case PROT_Q931_IE_USER_USER: - { - uint8_t protDiscr = 0x00, j, uui_stringOct; - char uui_string[32]; - memset(uui_string, 0, sizeof(uui_string)); - protDiscr = OCTET(3); - uui_stringOct = 3; - if (protDiscr != 0x04) { /* Non-IA5 */ - *str_len+= sprintf(&str[*str_len], "%s (0x%02x)\n", - get_code_2_str(protDiscr, dcodQ931UuiProtDiscrTable), protDiscr); - } else { - j = 0; - - if(len >= sizeof(uui_string)) { - len = sizeof(uui_string)-1; - } - while(uui_stringOct++ <= len+1) { - uui_string[j++]=ia5[get_bits(OCTET(uui_stringOct),1,4)][get_bits(OCTET(uui_stringOct),5,8)]; - } - uui_string[j]='\0'; - *str_len+= sprintf(&str[*str_len], " %s (0x%02x) <%s>\n", - get_code_2_str(protDiscr, dcodQ931UuiProtDiscrTable), protDiscr, - uui_string); - } - } - break; - case PROT_Q931_IE_DISPLAY: - { - uint8_t j; - char displayStr[82]; - uint8_t displayNtEnabled = 0; - uint8_t displayStrOct = 2; - uint8_t displayType = 0; - uint8_t assocInfo = 0; - - memset(displayStr, 0, sizeof(displayStr)); - - if(get_bits(OCTET(3),8,8)) { - displayType = get_bits(OCTET(3),1,4); - assocInfo = get_bits(OCTET(3),5,7); - - displayNtEnabled = 1; - displayStrOct++; - } - j = 0; - if(len >= sizeof(displayStr)) { - len = sizeof(displayStr)-1; - } - while(displayStrOct++ <= len+1) { - displayStr[j++]=ia5[get_bits(OCTET(displayStrOct),1,4)][get_bits(OCTET(displayStrOct),5,8)]; - } - displayStr[j]='\0'; - if (displayNtEnabled) { - *str_len+= sprintf(&str[*str_len], "%s(l:%d) type:%s(%d) info:%s(%d)\n", - displayStr, len, - get_code_2_str(displayType, dcodQ931DisplayTypeTable), displayType, - get_code_2_str(assocInfo, dcodQ931AssocInfoTable), assocInfo); - } else { - *str_len+= sprintf(&str[*str_len], "%s(l:%d)\n", - displayStr, len); - } - } - break; - case PROT_Q931_IE_RESTART_IND: - { - uint8_t indClass; - indClass = get_bits(OCTET(3),1,3); - *str_len+= sprintf(&str[*str_len], "class:%s(%d)\n", - get_code_2_str(indClass,dcodQ931RestartIndClassTable), indClass); - } - break; - case PROT_Q931_IE_PROGRESS_IND: - { - uint8_t codingStandard, location, progressDescr; - codingStandard = get_bits(OCTET(3),6,7); - location = get_bits(OCTET(3),1,4); - progressDescr = get_bits(OCTET(4),1,7); - *str_len+= sprintf(&str[*str_len], "coding:%s(%d) location:%s(%d) descr:%s(%d)\n", - get_code_2_str(codingStandard,dcodQ931BcCodingStandardTable), codingStandard, - get_code_2_str(location,dcodQ931IelocationTable), location, - get_code_2_str(progressDescr,dcodQ931IeprogressDescrTable), progressDescr); - } - break; - case PROT_Q931_IE_KEYPAD_FACILITY: - { - uint8_t keypadFacilityStrOct = 3, j; - char keypadFacilityStr[82]; - memset(keypadFacilityStr, 0, sizeof(keypadFacilityStr)); - - j = 0; - if(len >= sizeof(keypadFacilityStr)) { - len = sizeof(keypadFacilityStr)-1; - } - while(keypadFacilityStrOct++ < len+1) { - keypadFacilityStr[j++]=ia5[get_bits(OCTET(keypadFacilityStrOct),1,4)][get_bits(OCTET(keypadFacilityStrOct),5,8)]; - } - keypadFacilityStr[j]='\0'; - *str_len+= sprintf(&str[*str_len], " digits:%s(l:%d)\n", - keypadFacilityStr, len); - } - break; - case PROT_Q931_IE_FACILITY: - { - uint8_t protProfile; - protProfile = get_bits(OCTET(3),1,5); - *str_len+= sprintf(&str[*str_len], "Prot profile:%s(%d)\n", - get_code_2_str(protProfile,dcodQ931IeFacilityProtProfileTable), protProfile); - } - break; - case PROT_Q931_IE_GENERIC_DIGITS: - { - uint8_t encoding,type; - int value = 0; - - encoding = get_bits(OCTET(3),6,8); - type = get_bits(OCTET(3),1,5); - - *str_len+= sprintf(&str[*str_len], "encoding:%s(%d) type:%s(%d) ", - get_code_2_str(encoding,dcodQ931GenDigitsEncodingTable), encoding, - get_code_2_str(encoding,dcodQ931GenDigitsTypeTable), type); - - if (len > 1) { - uint32_t j=0; - - while(++j < len) { - switch(encoding) { - case 0: /* BCD even */ - case 1: /* BCD odd */ - { - uint8_t byte = OCTET(j+3); - value = (get_bits(byte,1,4)*10) + get_bits(byte,5,8) + (value*10); - } - break; - case 2: /* IA 5 */ - value = value*10 + OCTET(j+3)-'0'; - *str_len+= sprintf(&str[*str_len], "%c", OCTET(j+3)); - break; - case 3: - /* Don't know how to decode binary encoding yet */ - *str_len+= sprintf(&str[*str_len], "Binary encoded"); - break; - } - } - *str_len+= sprintf(&str[*str_len], " "); - switch(type) { - case 4: /* info digits */ - *str_len+= sprintf(&str[*str_len], "ani2:%s(%d)", get_code_2_str(value,dcodQ931LineInfoTable), value); - break; - case 5: /* Callid */ - *str_len+= sprintf(&str[*str_len], "Caller ID not implemented\n"); - break; - } - } - *str_len+= sprintf(&str[*str_len], "\n"); - print_hex_dump(str, str_len, (uint8_t*) data, index_start, index_end); - } - break; - case PROT_Q931_IE_SENDING_COMPLETE: - /* No need to decode sending complete IE, as no additional info is available except that sending is done */ - /* This is a single octet IE */ - *str_len+= sprintf(&str[*str_len], "\n"); - return 0; - break; - case PROT_Q931_IE_CALLED_PARTY_SUBADDRESS: - { - uint8_t type; - uint8_t currentOct, j=0; - char calling_subaddr_string[82]; - memset(calling_subaddr_string, 0, sizeof(calling_subaddr_string)); - type = get_bits(OCTET(3),5,7); - currentOct = 3; - while(currentOct++ <= len+1) { - calling_subaddr_string[j++]=ia5[get_bits(OCTET(currentOct),1,4)][get_bits(OCTET(currentOct),5,8)]; - } - calling_subaddr_string[j++]='\0'; - *str_len += sprintf(&str[*str_len], "%s (l:%d) type:%s(%d) \n", - calling_subaddr_string, (j-1), get_code_2_str(type, dcodQ931TypeOfSubaddressTable), type); - } - break; - case PROT_Q931_IE_NOTIFICATION_IND: - { - uint8_t desc; - - desc = get_bits(OCTET(3),1,7); - *str_len += sprintf(&str[*str_len], "%s (%d)\n", - get_code_2_str(desc, dcodQ931NotificationIndTable), desc); - } - break; - case PROT_Q931_IE_REDIRECTION_NUMBER: - case PROT_Q931_IE_DATE_TIME: - case PROT_Q931_IE_INFORMATION_REQUEST: - case PROT_Q931_IE_SIGNAL: - case PROT_Q931_IE_SWITCHOOK: - case PROT_Q931_IE_FEATURE_ACT: - case PROT_Q931_IE_FEATURE_IND: - case PROT_Q931_IE_INFORMATION_RATE: - case PROT_Q931_IE_END_TO_END_TRANSIT_DELAY: - case PROT_Q931_IE_TRANSIT_DELAY_SELECT_IND: - case PROT_Q931_IE_PACKET_LAYER_BINARY_PARAMS: - case PROT_Q931_IE_PACKET_LAYER_WINDOW_SIZE: - case PROT_Q931_IE_PACKET_LAYER_SIZE: - case PROT_Q931_IE_TRANSIT_NETWORK_SELECTION: - case PROT_Q931_IE_LOW_LAYER_COMPAT: - case PROT_Q931_IE_HIGH_LAYER_COMPAT: - case PROT_Q931_IE_ESCAPE_FOR_EXTENSION: - case PROT_Q931_IE_CALL_IDENTITY: - case PROT_Q931_IE_CALL_STATE: - case PROT_Q931_IE_SEGMENTED_MESSAGE: - case PROT_Q931_IE_NETWORK_SPF_FACILITY: - case PROT_Q931_IE_CALLING_PARTY_SUBADDRESS: - default: - { - *str_len += sprintf(&str[*str_len], "Undecoded"); - print_hex_dump((char*)str, str_len, data, index_start, index_end + 1); - } - break; - } - - return len+1; -} - -void print_hex_dump(char* str, uint32_t *str_len, uint8_t* data, uint32_t index_start, uint32_t index_end) -{ - uint32_t k; - *str_len += sprintf(&str[*str_len], " [ "); - for(k=index_start; k < index_end; k++) { - if (k && !(k%32)) { - *str_len += sprintf(&str[*str_len], "\n "); - } - *str_len += sprintf(&str[*str_len], "%02x ", data[k]); - } - *str_len += sprintf(&str[*str_len], "]\n"); - return; -} - -static ftdm_status_t sngisdn_get_frame_info(uint8_t *data, uint32_t data_len, ftdm_trace_dir_t dir, sngisdn_frame_info_t *target) -{ - uint8_t pos = 0; - uint8_t flag; - uint16_t ref = 0; - uint8_t ref_len = 0; - uint8_t bchan_no = 0; - uint8_t msgtype; - - /* First octet is protocol discriminator */ - pos++; - /* Second octet contains length of call reference */ - ref_len = data[pos++] & 0x0F; - - /* third octet is call reference */ - flag = (data[pos] & 0x80) >> 7; - if (ref_len == 2) { - ref = (data[pos++] & 0x7F) << 8; - ref |= (data[pos++] & 0xFF) ; - } else { - ref = (data[pos++] & 0x7F); - } - - /* Next octet is the message type */ - msgtype = data[pos++] & 0x7F; - - /* - ftdm_log(FTDM_LOG_DEBUG, "Raw frame:call_ref:0x%04x flag:%d msgtype:%d\n", ref, flag, msgtype); - */ - if (!ref) { - /* This is not a call specific message (RESTART for example and we do not care about it) */ - return FTDM_FAIL; - } - - /* Look for the b-channel */ - if (msgtype == PROT_Q931_MSGTYPE_SETUP) { - /* Try to find the b-channel no*/ - - for(; pos < data_len; pos++) { - uint8_t ie_id = data[pos]; - uint8_t ie_len = data[pos+1]; - - switch(ie_id) { - case PROT_Q931_IE_SENDING_COMPLETE: - /* Single octet ie's do not have a length */ - ie_len = 0; - break; - case PROT_Q931_IE_CHANNEL_ID: - { - /* Try to obtain the b-channel */ - uint8_t ie_pos = pos+2; - //ifaceIdPresent = get_bits(OCTET(3),7,7); - if (data[ie_pos] & 0x20) { - /* Interface type is Primary Rate */ - ie_pos+=2; - bchan_no = data[ie_pos] & 0x7F; - } else { - /* Interface type is Basic Interface */ - /* Get the channel number from info channel selection */ - bchan_no = data[ie_pos] & 0x03; - } - ftdm_log(FTDM_LOG_DEBUG, "Found b-channel:%d\n", bchan_no); - goto parse_ies_done; - } - break; - default: - pos = pos+ie_len+1; - } - //ftdm_log(FTDM_LOG_DEBUG, "Decoded IE:%s\n", get_code_2_str(ie_id, dcodQ931IEIDTable)); - } - if (!bchan_no) { - uint32_t tmp_len = 0; - char tmp[1000]; - print_hex_dump(tmp, &tmp_len, data, 0, data_len); - ftdm_log(FTDM_LOG_DEBUG, "Failed to determine b-channel on SETUP message\n%s\n", tmp); - } - } - -parse_ies_done: - - target->call_ref = ref; - target->call_ref_flag = flag; - target->msgtype = msgtype; - target->bchan_no = bchan_no; - target->dir = dir; - - return FTDM_SUCCESS; -} - -static ftdm_status_t sngisdn_map_call(sngisdn_span_data_t *signal_data, sngisdn_frame_info_t frame_info, ftdm_channel_t **found) -{ - sngisdn_chan_data_t *sngisdn_info; - ftdm_channel_t *ftdmchan = NULL; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - ftdm_status_t status = FTDM_FAIL; - uint8_t outbound_call = 0; - - if ((!frame_info.call_ref_flag && frame_info.dir == FTDM_TRACE_DIR_OUTGOING) || - (frame_info.call_ref_flag && frame_info.dir == FTDM_TRACE_DIR_INCOMING)) { - - /* If this is an outgoing frame and this frame was sent by the originating side - of the call (frame_info.call_ref_flag == 0), then this is an outbound call */ - outbound_call = 1; - } else { - outbound_call = 0; - } - - switch (frame_info.msgtype) { - case PROT_Q931_MSGTYPE_SETUP: - /* We initiated this outgoing call try to match the call reference with our internal call-id*/ - if (!frame_info.bchan_no) { - /* We were not able to determine the bchannel on this call, so we will not be able to match it anyway */ - status = FTDM_FAIL; - } - - chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdmchan = (ftdm_channel_t*)(ftdm_iterator_current(curr)); - ftdm_channel_lock(ftdmchan); - - if (outbound_call) { - sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; - if (sngisdn_info && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (ftdmchan->caller_data.call_id && ftdmchan->physical_chan_id == frame_info.bchan_no) { - - sngisdn_info->call_ref = frame_info.call_ref; - *found = ftdmchan; - status = FTDM_SUCCESS; - } - } - } else { - if (ftdmchan->physical_chan_id == frame_info.bchan_no) { - *found = ftdmchan; - status = FTDM_SUCCESS; - } - } - ftdm_channel_unlock(ftdmchan); - } - ftdm_iterator_free(chaniter); - break; - case PROT_Q931_MSGTYPE_ALERTING: - case PROT_Q931_MSGTYPE_PROCEEDING: - case PROT_Q931_MSGTYPE_PROGRESS: - case PROT_Q931_MSGTYPE_CONNECT: - case PROT_Q931_MSGTYPE_SETUP_ACK: - case PROT_Q931_MSGTYPE_CONNECT_ACK: - case PROT_Q931_MSGTYPE_USER_INFO: - case PROT_Q931_MSGTYPE_DISCONNECT: - case PROT_Q931_MSGTYPE_RELEASE: - case PROT_Q931_MSGTYPE_RESTART_ACK: - case PROT_Q931_MSGTYPE_RELEASE_COMPLETE: - case PROT_Q931_MSGTYPE_FACILITY: - case PROT_Q931_MSGTYPE_NOTIFY: - case PROT_Q931_MSGTYPE_STATUS_ENQUIRY: - case PROT_Q931_MSGTYPE_INFORMATION: - case PROT_Q931_MSGTYPE_STATUS: - /* Look for an outbound call on that span and and try to match the call-id */ - chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdmchan = (ftdm_channel_t*)(ftdm_iterator_current(curr)); - ftdm_channel_lock(ftdmchan); - sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; - if (outbound_call) { - if (sngisdn_info && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (sngisdn_info->call_ref == frame_info.call_ref) { - - *found = ftdmchan; - status = FTDM_SUCCESS; - } - } - } else { - if (sngisdn_info && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (sngisdn_info->call_ref && sngisdn_info->call_ref == frame_info.call_ref) { - - *found = ftdmchan; - status = FTDM_SUCCESS; - } - } - } - ftdm_channel_unlock(ftdmchan); - } - ftdm_iterator_free(chaniter); - break; - default: - /* This frame is not call specific, ignore */ - break; - } - if (status == FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Mapped %s with Call Ref:%04x to call-id:%d\n", get_code_2_str(frame_info.msgtype, dcodQ931MsgTypeTable), frame_info.call_ref, (*found)->caller_data.call_id); - } else { - /* We could not map this frame to a call-id */ - ftdm_log(FTDM_LOG_DEBUG, "Failed to map %s with Call Ref:%04x to local call\n", - get_code_2_str(frame_info.msgtype, dcodQ931MsgTypeTable), frame_info.call_ref); - } - - return status; -} - - - diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h deleted file mode 100644 index b09bcbd33a..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h +++ /dev/null @@ -1,599 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef __FTMOD_SANGOMA_ISDN_TRACE_H__ -#define __FTMOD_SANGOMA_ISDN_TRACE_H__ - -#define MX_CODE_TXT_LEN 70 -#define Q931_LOCKING_SHIFT 0x90 -#define Q931_NON_LOCKING_SHIFT 0x98 - -#define PROT_Q931_RELEASE_CAUSE_MISDIALED_TRUNK_PREFIX 5 -#define PROT_Q931_RELEASE_CAUSE_INVALID_NUMBER_FORMAT 28 -#define PROT_Q931_RELEASE_CAUSE_NO_CHAN_AVAIL 34 -#define PROT_Q931_RELEASE_CAUSE_DEST_OUT_OF_ORDER 27 -#define PROT_Q931_RELEASE_CAUSE_IE_NOT_EXIST 99 -#define PROT_Q931_RECOVERY_ON_TIMER_EXPIRE 102 -#define PROT_Q931_RELEASE_CAUSE_WRONG_CALL_STATE 101 - - -#define PROT_Q931_IE_SEGMENTED_MESSAGE 0x00 -#define PROT_Q931_IE_BEARER_CAP 0x04 -#define PROT_Q931_IE_CAUSE 0x08 -#define PROT_Q931_IE_CALL_IDENTITY 0x10 -#define PROT_Q931_IE_CALL_STATE 0x14 -#define PROT_Q931_IE_CHANNEL_ID 0x18 -#define PROT_Q931_IE_FACILITY 0x1c -#define PROT_Q931_IE_PROGRESS_IND 0x1e -#define PROT_Q931_IE_NETWORK_SPF_FACILITY 0x20 -#define PROT_Q931_IE_NOTIFICATION_IND 0x27 -#define PROT_Q931_IE_DISPLAY 0x28 -#define PROT_Q931_IE_DATE_TIME 0x29 -#define PROT_Q931_IE_KEYPAD_FACILITY 0x2c -#define PROT_Q931_IE_INFORMATION_REQUEST 0x32 -#define PROT_Q931_IE_SIGNAL 0x34 -#define PROT_Q931_IE_SWITCHOOK 0x36 -#define PROT_Q931_IE_GENERIC_DIGITS 0x37 -#define PROT_Q931_IE_FEATURE_ACT 0x38 -#define PROT_Q931_IE_FEATURE_IND 0x39 -#define PROT_Q931_IE_INFORMATION_RATE 0x40 -#define PROT_Q931_IE_END_TO_END_TRANSIT_DELAY 0x42 -#define PROT_Q931_IE_TRANSIT_DELAY_SELECT_IND 0x43 -#define PROT_Q931_IE_PACKET_LAYER_BINARY_PARAMS 0x44 -#define PROT_Q931_IE_PACKET_LAYER_WINDOW_SIZE 0x45 -#define PROT_Q931_IE_PACKET_LAYER_SIZE 0x46 -#define PROT_Q931_IE_CALLING_PARTY_NUMBER 0x6c -#define PROT_Q931_IE_CALLING_PARTY_SUBADDRESS 0x6d -#define PROT_Q931_IE_CALLED_PARTY_NUMBER 0x70 -#define PROT_Q931_IE_CALLED_PARTY_SUBADDRESS 0x71 -#define PROT_Q931_IE_REDIRECTING_NUMBER 0x74 -#define PROT_Q931_IE_REDIRECTION_NUMBER 0x76 -#define PROT_Q931_IE_TRANSIT_NETWORK_SELECTION 0x78 -#define PROT_Q931_IE_RESTART_IND 0x79 -#define PROT_Q931_IE_LOW_LAYER_COMPAT 0x7c -#define PROT_Q931_IE_HIGH_LAYER_COMPAT 0x7d -#define PROT_Q931_IE_USER_USER 0x7e -#define PROT_Q931_IE_SENDING_COMPLETE 0xa1 -#define PROT_Q931_IE_ESCAPE_FOR_EXTENSION 0x7f -#define PROT_Q931_IE_SENDING_COMPLETE 0xa1 - -#define NULL_CHAR 0 - - -struct code2str -{ - int code; - char text[MX_CODE_TXT_LEN]; -}; - -enum { - I_FRAME = 1, /* Information frame */ - S_FRAME, /* Supervisory frame */ - U_FRAME, /* Unnumbered frame */ -}; - -char ia5[16][8]={{NULL_CHAR,NULL_CHAR,' ','0','@','P','`','p'}, - {NULL_CHAR,NULL_CHAR,'!','1','A','Q','a','q'}, - {NULL_CHAR,NULL_CHAR,'"','2','B','R','b','r'}, - {NULL_CHAR,NULL_CHAR,'#','3','C','S','c','s'}, - {NULL_CHAR,NULL_CHAR,'$','4','D','T','d','t'}, - {NULL_CHAR,NULL_CHAR,'%','5','E','U','e','u'}, - {NULL_CHAR,NULL_CHAR,'&','6','F','V','f','v'}, - {NULL_CHAR,NULL_CHAR,'\'','7','G','W','g','w'}, - {NULL_CHAR,NULL_CHAR,'(','8','H','X','h','x'}, - {NULL_CHAR,NULL_CHAR,')','9','I','Y','i','y'}, - {NULL_CHAR,NULL_CHAR,'*',':','J','Z','j','z'}, - {NULL_CHAR,NULL_CHAR,'+',';','K','[','k','{'}, - {NULL_CHAR,NULL_CHAR,',','<','L','\\','l','|'}, - {NULL_CHAR,NULL_CHAR,'-','=','M',']','m','}'}, - {NULL_CHAR,NULL_CHAR,'.','>','N','^','n','~'}, - {NULL_CHAR,NULL_CHAR,'/','?','O','_','o',NULL_CHAR}}; - -/* Based on Table 4 - pg 15 of Q.921 Recommendation */ -struct code2str dcodQ921FrameFormatTable[] = { - {I_FRAME, "Information"}, - {S_FRAME, "Supervisory"}, - {U_FRAME, "Unnumbered"}, - {-1, "?"}, -}; - - -/* Based on Table 5 - pg 15 of Q.921 Recommendation */ -struct code2str dcodQ921SupervisoryCmdTable[] = { - {0, "RR - receive ready"}, - {1, "RNR - receive not ready"}, - {2, "REJ - reject"}, - {-1, "Unknown"}, -}; - -/* Based on Table 5 - pg 15 of Q.921 Recommendation */ -struct code2str dcodQ921UnnumberedCmdTable[] = { - {0x0F, "SABME - set async balanced mode extended"}, - {0x03, "DM - disconnected mode"}, - {0x00, "UI - unnumbered information"}, - {0x08, "DISC - disconnect"}, - {0x0C, "UA - unnumbered acknowledgement"}, - {0x11, "FRMR - frame reject"}, - {0x17, "XID - Exchange Identification)"}, - {-1, "Unknown"}, -}; - -struct code2str dcodQ931ProtDiscTable[] = { - {0x08, "Q.931/I.451"}, - {0x09, "Q.2931"}, - {-1, "Unknown"}, -}; - -struct code2str dcodQ931CallRefHiTable[] = { - {0, "0"}, - {16, "1"}, - {32, "2"}, - {48, "3"}, - {64, "4"}, - {80, "5"}, - {96, "6"}, - {112, "7"}, - {128, "8"}, - {144, "9"}, - {160, "A"}, - {176, "B"}, - {192, "C"}, - {208, "D"}, - {224, "E"}, - {240, "F"}, - {-1,"?"}, -}; - -struct code2str dcodQ931CallRefLoTable[] = { - {0, "0"}, - {1, "1"}, - {2, "2"}, - {3, "3"}, - {4, "4"}, - {5, "5"}, - {6, "6"}, - {7, "7"}, - {8, "8"}, - {9, "9"}, - {10, "A"}, - {11, "B"}, - {12, "C"}, - {13, "D"}, - {14, "E"}, - {15, "F"}, - {-1, "?"}, -}; - -#define PROT_Q931_MSGTYPE_ALERTING 1 -#define PROT_Q931_MSGTYPE_PROCEEDING 2 -#define PROT_Q931_MSGTYPE_PROGRESS 3 -#define PROT_Q931_MSGTYPE_SETUP 5 -#define PROT_Q931_MSGTYPE_CONNECT 7 -#define PROT_Q931_MSGTYPE_SETUP_ACK 13 -#define PROT_Q931_MSGTYPE_CONNECT_ACK 15 -#define PROT_Q931_MSGTYPE_USER_INFO 32 -#define PROT_Q931_MSGTYPE_SUSPEND_REJ 33 -#define PROT_Q931_MSGTYPE_RESUME_REJ 34 -#define PROT_Q931_MSGTYPE_SUSPEND 37 -#define PROT_Q931_MSGTYPE_RESUME 38 -#define PROT_Q931_MSGTYPE_SUSPEND_ACK 45 -#define PROT_Q931_MSGTYPE_RESUME_ACK 46 -#define PROT_Q931_MSGTYPE_DISCONNECT 69 -#define PROT_Q931_MSGTYPE_RESTART 70 -#define PROT_Q931_MSGTYPE_RELEASE 77 -#define PROT_Q931_MSGTYPE_RESTART_ACK 78 -#define PROT_Q931_MSGTYPE_RELEASE_COMPLETE 90 -#define PROT_Q931_MSGTYPE_SEGMENT 96 -#define PROT_Q931_MSGTYPE_FACILITY 98 -#define PROT_Q931_MSGTYPE_NOTIFY 110 -#define PROT_Q931_MSGTYPE_STATUS_ENQUIRY 117 -#define PROT_Q931_MSGTYPE_CONGESTION_CNTRL 121 -#define PROT_Q931_MSGTYPE_INFORMATION 123 -#define PROT_Q931_MSGTYPE_STATUS 125 - - -struct code2str dcodQ931MsgTypeTable[] = { - {PROT_Q931_MSGTYPE_ALERTING, "ALERT"}, - {PROT_Q931_MSGTYPE_PROCEEDING, "PROCEED"}, - {PROT_Q931_MSGTYPE_PROGRESS, "PROGRESS"}, - {PROT_Q931_MSGTYPE_SETUP, "SETUP"}, - {PROT_Q931_MSGTYPE_CONNECT, "CONNECT"}, - {PROT_Q931_MSGTYPE_SETUP_ACK, "SETUP ACK"}, - {PROT_Q931_MSGTYPE_CONNECT_ACK, "CONNECT ACK"}, - {PROT_Q931_MSGTYPE_USER_INFO, "USER INFO"}, - {PROT_Q931_MSGTYPE_SUSPEND_REJ, "SUSPEND REJ"}, - {PROT_Q931_MSGTYPE_RESUME_REJ, "RESUME REJ"}, - {PROT_Q931_MSGTYPE_SUSPEND, "SUSPEND"}, - {PROT_Q931_MSGTYPE_RESUME, "RESUME"}, - {PROT_Q931_MSGTYPE_SUSPEND_ACK, "SUSPEND ACK"}, - {PROT_Q931_MSGTYPE_RESUME_ACK, "RESUME ACK"}, - {PROT_Q931_MSGTYPE_DISCONNECT, "DISCONNECT"}, - {PROT_Q931_MSGTYPE_RESTART, "RESTART"}, - {PROT_Q931_MSGTYPE_RELEASE, "RELEASE"}, - {PROT_Q931_MSGTYPE_RESTART_ACK, "RESTART ACK"}, - {PROT_Q931_MSGTYPE_RELEASE_COMPLETE, "RELEASE COMPLETE"}, - {PROT_Q931_MSGTYPE_SEGMENT, "SEGMENT"}, - {PROT_Q931_MSGTYPE_FACILITY, "FACILITY"}, - {PROT_Q931_MSGTYPE_NOTIFY, "NOTIFY"}, - {PROT_Q931_MSGTYPE_STATUS_ENQUIRY, "STATUS ENQ"}, - {PROT_Q931_MSGTYPE_CONGESTION_CNTRL, "CONGESTION CTRL"}, - {PROT_Q931_MSGTYPE_INFORMATION, "INFO"}, - {PROT_Q931_MSGTYPE_STATUS, "STATUS"}, - {-1, "UNKNOWN"}, -}; - -struct code2str dcodQ931CauseCodeTable[] = { - {1, "Unallocated (unassigned) number"}, - {2, "No route to specified network"}, - {3, "No route to destination"}, - {4, "Send special information tone"}, - {5, "Misdialed trunk prefix"}, - {6, "Channel Unacceptable"}, - {7, "Call awarded and channel established"}, - {8, "Pre-emption"}, - {9, "Pre-emption-circuit reserved"}, - {16, "Normal call clearing"}, - {17, "User Busy"}, - {18, "No User Responding"}, - {19, "No Answer from User"}, - {20, "Subscriber Absent"}, - {21, "Call Rejected"}, - {22, "Number Changed"}, - {26, "Non-Selected User Clearing"}, - {27, "Destination Out-of-Order"}, - {28, "Invalid Number Format"}, - {29, "Facility Rejected"}, - {30, "Response to Status Enquiry"}, - {31, "Normal, Unspecified"}, - {34, "No Circuit/Channel Available"}, - {38, "Network Out-of-Order"}, - {39, "Permanent Frame Mode OOS"}, - {40, "Permanent Frame Mode Operational"}, - {41, "Temporary Failure"}, - {42, "Switching Equipment Congestion"}, - {43, "Access Information Discarded"}, - {44, "Requested Circuit/Channel not available"}, - {47, "Resource Unavailable, Unspecified"}, - {49, "Quality of Service not available"}, - {50, "Requested facility not subscribed"}, - {53, "Outgoing calls barred within CUG"}, - {55, "Incoming calls barred within CUG"}, - {57, "Bearer capability not authorized"}, - {58, "Bearer capability not presently available"}, - {62, "Inconsistency in access inf and subscriber"}, - {63, "Service or Option not available"}, - {65, "Bearer capability not implemented"}, - {66, "Channel type not implemented"}, - {69, "Requested facility not implemented"}, - {70, "Only restricted digital BC available"}, - {79, "Service or option not implemented"}, - {81, "Invalid call reference value"}, - {82, "Identified channel does not exist"}, - {83, "Suspended call exists"}, - {84, "Call identity in use"}, - {85, "No call suspended"}, - {86, "Call already cleared"}, - {87, "User not member of CUG"}, - {88, "Incompatible destination"}, - {90, "Non existent CUG"}, - {91, "Invalid transit network selection"}, - {95, "Invalid message, unspecified"}, - {96, "Mandatory IE missing"}, - {97, "Message type non-existent, not implemented"}, - {98, "Message not compatible with call state"}, - {99, "An IE or parameter does not exist"}, - {100, "Invalid IE contents"}, - {101, "Message not compatible with call state"}, - {102, "Recovery on timer expired"}, - {103, "Parameter non-existent, not impl"}, - {110, "Message with unrecognized parameter"}, - {111, "Protocol error, unspecified"}, - {127, "Interworking, unspecified"}, - {-1, "Unknown"}, -}; - -struct code2str dcodQ931IEIDTable[] = { - {PROT_Q931_IE_SEGMENTED_MESSAGE, "Segmented Message"}, - {PROT_Q931_IE_BEARER_CAP, "Bearer Capability"}, - {PROT_Q931_IE_CAUSE, "Cause"}, - {PROT_Q931_IE_CALL_IDENTITY, "Call Identity"}, - {PROT_Q931_IE_CALL_STATE, "Call State"}, - {PROT_Q931_IE_CHANNEL_ID, "Channel Id"}, - {PROT_Q931_IE_FACILITY, "Facility"}, - {PROT_Q931_IE_PROGRESS_IND, "Progress Indicator"}, - {PROT_Q931_IE_NETWORK_SPF_FACILITY, "Network Specific Facilities"}, - {PROT_Q931_IE_NOTIFICATION_IND, "Notification Indicator"}, - {PROT_Q931_IE_DISPLAY, "Display"}, - {PROT_Q931_IE_DATE_TIME, "Date/Time"}, - {PROT_Q931_IE_KEYPAD_FACILITY, "Keypad Facility"}, - {PROT_Q931_IE_INFORMATION_REQUEST, "Information Request"}, - {PROT_Q931_IE_SIGNAL, "Signal"}, - {PROT_Q931_IE_SWITCHOOK, "Switchhook"}, - {PROT_Q931_IE_GENERIC_DIGITS, "Generic Digits"}, - {PROT_Q931_IE_FEATURE_ACT, "Feature Activation"}, - {PROT_Q931_IE_FEATURE_IND, "Feature Indication"}, - {PROT_Q931_IE_INFORMATION_RATE, "Information Rate"}, - {PROT_Q931_IE_END_TO_END_TRANSIT_DELAY, "End-to-end Transit Delay"}, - {PROT_Q931_IE_TRANSIT_DELAY_SELECT_IND, "Transit Delay Selection and Indication"}, - {PROT_Q931_IE_PACKET_LAYER_BINARY_PARAMS, "Packet layer binary parameters"}, - {PROT_Q931_IE_PACKET_LAYER_WINDOW_SIZE, "Packet layer Window Size"}, - {PROT_Q931_IE_PACKET_LAYER_SIZE, "Packet layer Size"}, - {PROT_Q931_IE_CALLING_PARTY_NUMBER, "Calling Party Number"}, - {PROT_Q931_IE_CALLING_PARTY_SUBADDRESS, "Calling Party Subaddress"}, - {PROT_Q931_IE_CALLED_PARTY_NUMBER, "Called Party Number"}, - {PROT_Q931_IE_CALLED_PARTY_SUBADDRESS, "Called Party Subaddress"}, - {PROT_Q931_IE_REDIRECTING_NUMBER, "Redirecting Number"}, - {PROT_Q931_IE_REDIRECTION_NUMBER, "Redirection Number"}, - {PROT_Q931_IE_TRANSIT_NETWORK_SELECTION, "Transit Network Selection"}, - {PROT_Q931_IE_RESTART_IND, "Restart Indicator"}, - {PROT_Q931_IE_LOW_LAYER_COMPAT, "Low-Layer Compatibility"}, - {PROT_Q931_IE_HIGH_LAYER_COMPAT, "High-Layer Compatibility"}, - {PROT_Q931_IE_USER_USER, "User-User"}, - {PROT_Q931_IE_SENDING_COMPLETE, "Sending complete"}, - {PROT_Q931_IE_ESCAPE_FOR_EXTENSION, "Escape for extension"}, - {-1,"Unknown"}, -}; - -struct code2str dcodQ931NumberingPlanTable[] = { - {0, "unknown"}, - {1, "isdn"}, - {3, "data"}, - {4, "telex"}, - {8, "national"}, - {9, "private"}, - {15, "reserved"}, - {-1, "invalid"}, -}; - -struct code2str dcodQ931TypeofNumberTable[] = { - {0, "unknown"}, - {1, "international"}, - {2, "national"}, - {3, "network spf"}, - {4, "subscriber"}, - {6, "abbreviated"}, - {7, "reserved"}, - {-1, "invalid" }, -}; - -struct code2str dcodQ931PresentationTable[] = { - {0, "allowed"}, - {1, "restricted"}, - {2, "not available"}, - {-1, "invalid" }, -}; - -struct code2str dcodQ931ScreeningTable[] = { - {0, "user, not screened"}, - {1, "user, passed"}, - {2, "user, failed"}, - {3, "network, provided"}, - {-1, "invalid" }, -}; - -struct code2str dcodQ931InfoChannelSelTable[] = { - {0, "No Chan"}, - {1, "B1"}, - {2, "B2"}, - {3, "Any Chan"}, - {-1, "invalid" }, -}; - -struct code2str dcodQ931ReasonTable[] = { - {0x0, "Unknown"}, - {0x1, "Call forwarding busy"}, - {0x2, "Call forwarding no reply"}, - {0x4, "Call deflection"}, - {0x9, "Called DTE out of order"}, - {0xA, "Call forwarding by the called DTE"}, - {0xF, "Call forwarding unconditional"}, - {-1, "reserved" }, -}; - -struct code2str dcodQ931BcCodingStandardTable[] = { - {0x0, "ITU-T"}, - {0x1, "ISO/IEC"}, - {0x2, "National"}, - {0x3, "Defined standard"}, - {-1, "unknown"}, -}; - -struct code2str dcodQ931BcInfTransferCapTable[] = { - {0x00, "Speech"}, - {0x08, "Unrestricted digital"}, - {0x09, "Restricted digital"}, - {0x10, "3.1Khz audio"}, - {0x11, "Unrestricted digital w/ tones"}, - {0x18, "Video"}, - {-1, "reserved"}, -}; - -struct code2str dcodQ931BcInfTransferRateTable[] = { - {0x00, "n/a"}, /* for packet-mode calls */ - {0x10, "64 Kbit/s"}, - {0x11, "2x64 Kbit/s"}, - {0x13, "384 Kbit/s"}, - {0x15, "1536 Kbit/s"}, - {0x17, "1920 Kbit/s"}, - {0x18, "Multirate"}, - {-1, "reserved"}, -}; - - -struct code2str dcodQ931BcusrL1ProtTable[] = { - {0x01, "ITU-T rate/V.110/I.460/X.30"}, - {0x02, "G.711 u-Law"}, - {0x03, "G.711 A-Law"}, - {0x04, "G.721/I.460"}, - {0x05, "H.221/H.242"}, - {0x06, "H.223/H.245"}, - {0x07, "Non-ITU-T rate"}, - {0x08, "V.120"}, - {0x09, "X.31 HDLC"}, - {-1, "reserved"}, -}; - -struct code2str dcodQ931UuiProtDiscrTable[] = { - {0x00, "User-specific"}, - {0x01, "OSI high layer prot"}, - {0x02, "Recommendation X.244"}, - {0x03, "System management"}, - {0x04, "IA5 Chars"}, - {0x05, "X.208/X.209"}, - {0x07, "V.120"}, - {0x08, "Q.931/I.451"}, - {0x10, "X.25"}, - {-1,"reserved"}, -}; - -struct code2str dcodQ931ChanTypeTable[] = { - {0x3,"B-chans"}, - {0x6,"H0-chans"}, - {0x8,"H11-chans"}, - {0x9,"H12-chans"}, - {-1,"reserved"}, -}; - -struct code2str dcodQ931RestartIndClassTable[] = { - {0x0 ,"Indicated in channel IE"}, - {0x6 ,"Single interface"}, - {0x7 ,"All interfaces"}, - {-1, "reserved"}, -}; - -struct code2str dcodQ931IelocationTable[] = { - {0x0, "User"}, - {0x1, "Private network, local user"}, - {0x2, "Public network, local user"}, - {0x3, "Transit network"}, - {0x4, "Public network, remote user"}, - {0x5, "Private network, remote user"}, - {0xA, "Beyond interworking point"}, - {-1, "reserved"}, -}; - -struct code2str dcodQ931IeprogressDescrTable[] = { - {0x01, "Further info maybe available"}, - {0x02, "Destination is non-ISDN"}, - {0x03, "Origination address is non-ISDN"}, - {0x04, "Call returned to ISDN"}, - {0x08, "In-band data ready"}, - {-1, "reserved"}, -}; - -struct code2str dcodQ931IeFacilityProtProfileTable[] = { - {0x11, "Remote Operations Protocol"}, - {0x12, "CMIP Protocol"}, - {0x13, "ACSE Protocol"}, - {0x16, "GAT Protocol"}, - {0x1F, "Networking Extensions"}, - {-1, "reserved"}, -}; - -//from www.voip-info.org/wiki/ANI2 - NANPA -struct code2str dcodQ931LineInfoTable[] = { - {0, "Plain Old Telephone Service(POTS)" }, - {1, "Multiparty line"}, - {2, "ANI Failure"}, - {6, "Station Level Rating"}, - {7, "Special Operator Handling Required"}, - {20, "Automatic Identified Outward Dialing (AIOD)"}, - {23, "Coin or Non-coin"}, - {24, "Toll free service, POTS originated for non-pay station"}, - {25, "Toll free service, POTS originated for pay station"}, - {27, "Pay station with coin control"}, - {29, "Prison-Inmate service"}, - {30, "Intercept - blank"}, - {31, "Intercept - trouble"}, - {32, "Intercept - regular"}, - {34, "Telco operator handled call"}, - {52, "Outward Wide Area Telecommunications Service(OUTWATS)"}, - {60, "TRS call - from unrestricted line"}, - {61, "Cellular-Wireless PCS Type 1"}, - {62, "Cellular-Wireless PCS Type 2"}, - {63, "Cellular-Wireless PCS Type Roaming"}, - {66, "TRS call - from hotel/motel"}, - {67, "TRS call - from restricted line"}, - {70, "Line connected to pay station"}, - {93, "Private virtual network call"}, - {-1, "Unassigned"}, -}; - - -struct code2str dcodQ931GenDigitsEncodingTable[] = { - {0, "BCD even"}, - {1, "BCD odd"}, - {2, "IA5"}, - {3, "Binary"}, - {-1, "Invalid"}, -}; - - -struct code2str dcodQ931GenDigitsTypeTable[] = { - { 0, "Account Code"}, - { 1, "Auth Code"}, - { 2, "Customer ID" }, - { 3, "Universal Access"}, - { 4, "Info Digits"}, - { 5, "Callid"}, - { 6, "Opart"}, - { 7, "TCN"}, - { 9, "Adin"}, - {-1, "Invalid"}, -}; - -struct code2str dcodQ931TypeOfSubaddressTable[] = { - { 0x00, "NSAP"}, - { 0x02, "User-specified"}, - { -1, "Invalid"}, -}; - -struct code2str dcodQ931DisplayTypeTable[] = { - { 0x00, "Calling Party Name"}, - { 0x01, "Connected Party Name"}, - { 0x05, "Original Called Party Name"}, - { -1, "Invalid"}, -}; - -struct code2str dcodQ931AssocInfoTable[] = { - { 0x00, "Requested"}, - { 0x03, "Included"}, - { -1, "Invalid"}, -}; - - -struct code2str dcodQ931NotificationIndTable[] = { - { 0x71, "Call Information/event"}, - { -1, "Invalid"}, -}; -#endif /* __FTMOD_SANGOMA_ISDN_TRACE_H__ */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c deleted file mode 100644 index 5df54f48ea..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (c) 2011, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ftmod_sangoma_isdn.h" - -#define TRANSFER_FUNC(name) ftdm_status_t (name)(ftdm_channel_t *ftdmchan, sngisdn_transfer_type_t type, char* target) - -#define SNGISDN_ATT_TRANSFER_RESPONSE_CP_DROP_OFF "**1" -#define SNGISDN_ATT_TRANSFER_RESPONSE_LIMITS_EXCEEDED "**5" -#define SNGISDN_ATT_TRANSFER_RESPONSE_OK "**6" -#define SNGISDN_ATT_TRANSFER_RESPONSE_INVALID_NUM "**7" -#define SNGISDN_ATT_TRANSFER_RESPONSE_INVALID_COMMAND "**8" - - -void att_courtesy_transfer_complete(sngisdn_chan_data_t *sngisdn_info, ftdm_transfer_response_t response); -void att_courtesy_transfer_timeout(void* p_sngisdn_info); -static ftdm_status_t att_courtesy_vru(ftdm_channel_t *ftdmchan, sngisdn_transfer_type_t type, char* target); - -typedef struct transfer_interfaces { - const char *name; - sngisdn_transfer_type_t type; - TRANSFER_FUNC(*func); -}transfer_interface_t; - -static transfer_interface_t transfer_interfaces[] = { - /* AT&T TR-50075 Courtesy Transfer - VRU -- No Data (Section 4.3) */ - { "ATT_COURTESY_TRANSFER_V", SNGISDN_TRANSFER_ATT_COURTESY_VRU, att_courtesy_vru}, - /* AT&T TR-50075 Courtesy Transfer - VRU --Data (Section 4.4) */ - { "ATT_COURTESY_TRANSFER_V_DATA", SNGISDN_TRANSFER_ATT_COURTESY_VRU_DATA, att_courtesy_vru}, -}; - -void att_courtesy_transfer_complete(sngisdn_chan_data_t *sngisdn_info, ftdm_transfer_response_t response) -{ - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_DTMF_DETECT, NULL); - - sngisdn_info->transfer_data.type = SNGISDN_TRANSFER_NONE; - sngisdn_info->transfer_data.response = response; - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Transfer Complete:%s\n", ftdm_transfer_response2str(sngisdn_info->transfer_data.response)); - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_TRANSFER_COMPLETED); - - ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_RX_BUFFERS, NULL); - return; -} - -void att_courtesy_transfer_timeout(void* p_sngisdn_info) -{ - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; - ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - - ftdm_mutex_lock(ftdmchan->mutex); - if (sngisdn_info->transfer_data.type == SNGISDN_TRANSFER_NONE) { - /* Call was already cleared */ - ftdm_mutex_unlock(ftdmchan->mutex); - return; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "AT&T Courtesy Transfer timeout (%d)\n", signal_data->transfer_timeout); - att_courtesy_transfer_complete(sngisdn_info, FTDM_TRANSFER_RESPONSE_TIMEOUT); - ftdm_mutex_unlock(ftdmchan->mutex); - return; -} - -static ftdm_status_t att_courtesy_vru(ftdm_channel_t *ftdmchan, sngisdn_transfer_type_t type, char* args) -{ - char dtmf_digits[64]; - ftdm_status_t status = FTDM_FAIL; - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - char *p = args; - uint8_t forced_answer = 0; - - switch (signal_data->switchtype) { - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_4ESS: - break; - default: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "AT&T Courtesy Transfer not supported for switchtype\n"); - return FTDM_FAIL; - } - - while (!ftdm_strlen_zero(p)) { - if (!isdigit(*p) && *p != 'w' && *p != 'W') { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot transfer to non-numeric number:%s\n", args); - return FTDM_FAIL; - } - p++; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Performing AT&T Courtesy Transfer-VRU%s to %s\n", (type == SNGISDN_TRANSFER_ATT_COURTESY_VRU_DATA) ?"--data" : "", args); - sprintf(dtmf_digits, "*8w%s", args); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending digits %s\n", dtmf_digits); - - switch (ftdmchan->last_state) { - case FTDM_CHANNEL_STATE_PROCEED: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - /* Call has to be in answered state - so send a CONNECT message if we did not answer this call yet */ - forced_answer++; - sngisdn_snd_connect(ftdmchan); - /* fall-through */ - case FTDM_CHANNEL_STATE_UP: - memset(&sngisdn_info->transfer_data.tdata.att_courtesy_vru.dtmf_digits, 0, sizeof(sngisdn_info->transfer_data.tdata.att_courtesy_vru.dtmf_digits)); - sngisdn_info->transfer_data.type = type; - - /* We will be polling the channel for IO so that we can receive the DTMF events, - * Disable user RX otherwise it is a race between who calls channel_read */ - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED); - - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SEND_DTMF, dtmf_digits); - - if (type == SNGISDN_TRANSFER_ATT_COURTESY_VRU_DATA) { - /* We need to save transfer data, so we can send it in the disconnect msg */ - const char *val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "transfer_data"); - if (ftdm_strlen_zero(val)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot perform data transfer because transfer_data variable is not set\n"); - goto done; - } - if (strlen(val) > COURTESY_TRANSFER_MAX_DATA_SIZE) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Data exceeds max size (len:%"FTDM_SIZE_FMT" max:%d), cannot perform transfer\n", strlen(val), COURTESY_TRANSFER_MAX_DATA_SIZE); - goto done; - } - memcpy(sngisdn_info->transfer_data.tdata.att_courtesy_vru.data, val, strlen(val)); - } - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - if (forced_answer) { - /* Notify the user that we answered the call */ - sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_UP); - } - if (signal_data->transfer_timeout) { - ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "courtesy_transfer_timeout", signal_data->transfer_timeout, att_courtesy_transfer_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_CHAN_TIMER_ATT_TRANSFER]); - } - - status = FTDM_SUCCESS; - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot perform transfer in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - break; - - } -done: - return status; -} - - -ftdm_status_t sngisdn_transfer(ftdm_channel_t *ftdmchan) -{ - const char* args; - char *p; - char *type = NULL; - char *target = NULL; - ftdm_status_t status = FTDM_FAIL; - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - unsigned i; - - args = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "transfer_arg"); - if (ftdm_strlen_zero(args)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot perform transfer because call_transfer_arg variable is not set\n"); - goto done; - } - - type = ftdm_strdup(args); - if ((p = strchr(type, '/'))) { - target = ftdm_strdup(p+1); - *p = '\0'; - } - - if (ftdm_strlen_zero(type) || ftdm_strlen_zero(target)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Invalid parameters for transfer %s, expected /\n", args); - goto done; - } - - if (sngisdn_info->transfer_data.type != SNGISDN_TRANSFER_NONE) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot perform transfer because an existing transfer transfer is pending (%s)\n", sngisdn_transfer_type2str(sngisdn_info->transfer_data.type)); - goto done; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Transfer requested type:%s target:%s\n", type, target); - for (i = 0; i < ftdm_array_len(transfer_interfaces); i++ ) { - if (!strcasecmp(transfer_interfaces[i].name, type)) { - /* Depending on the transfer type, the transfer function may change the - * channel state to UP, or last_state, but the transfer function will always result in - * an immediate state change if FTDM_SUCCESS is returned */ - - status = transfer_interfaces[i].func(ftdmchan, transfer_interfaces[i].type, target); - goto done; - } - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Invalid transfer type:%s\n", type); - -done: - if (status != FTDM_SUCCESS) { - ftdm_set_state(ftdmchan, ftdmchan->last_state); - } - - ftdm_safe_free(type); - ftdm_safe_free(target); - return status; -} - -ftdm_status_t sngisdn_att_transfer_process_dtmf(ftdm_channel_t *ftdmchan, const char* dtmf) -{ - ftdm_status_t status = FTDM_SUCCESS; - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - char *dtmf_digits = sngisdn_info->transfer_data.tdata.att_courtesy_vru.dtmf_digits; - ftdm_size_t dtmf_digits_len = strlen(dtmf_digits); - - dtmf_digits_len += sprintf(&dtmf_digits[dtmf_digits_len], "%s", dtmf); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Transfer response digits:%s\n", dtmf_digits); - if (dtmf_digits_len == 3) { - if (!strcmp(dtmf_digits, SNGISDN_ATT_TRANSFER_RESPONSE_CP_DROP_OFF)) { - sngisdn_info->transfer_data.response = FTDM_TRANSFER_RESPONSE_CP_DROP_OFF; - } else if (!strcmp(dtmf_digits, SNGISDN_ATT_TRANSFER_RESPONSE_LIMITS_EXCEEDED)) { - sngisdn_info->transfer_data.response = FTDM_TRANSFER_RESPONSE_LIMITS_EXCEEDED; - } else if (!strcmp(dtmf_digits, SNGISDN_ATT_TRANSFER_RESPONSE_OK)) { - sngisdn_info->transfer_data.response = FTDM_TRANSFER_RESPONSE_OK; - } else if (!strcmp(dtmf_digits, SNGISDN_ATT_TRANSFER_RESPONSE_INVALID_NUM)) { - sngisdn_info->transfer_data.response = FTDM_TRANSFER_RESPONSE_INVALID_NUM; - } else if (!strcmp(dtmf_digits, SNGISDN_ATT_TRANSFER_RESPONSE_INVALID_COMMAND)) { - sngisdn_info->transfer_data.response = FTDM_TRANSFER_RESPONSE_INVALID_COMMAND; - } else { - sngisdn_info->transfer_data.response = FTDM_TRANSFER_RESPONSE_INVALID; - } - if (signal_data->transfer_timeout) { - ftdm_sched_cancel_timer(signal_data->sched, sngisdn_info->timers[SNGISDN_CHAN_TIMER_ATT_TRANSFER]); - } - - if (sngisdn_info->transfer_data.response == FTDM_TRANSFER_RESPONSE_OK && - sngisdn_info->transfer_data.type == SNGISDN_TRANSFER_ATT_COURTESY_VRU_DATA) { - sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; - sngisdn_snd_disconnect(ftdmchan); - } - /* Network side will send disconnect in case of NO-DATA Transfer */ - att_courtesy_transfer_complete(sngisdn_info, sngisdn_info->transfer_data.response); - } - - if (signal_data->att_remove_dtmf != SNGISDN_OPT_FALSE) { - /* If we return FTDM_BREAK, dtmf event is not queue'ed to user */ - status = FTDM_BREAK; - } - return status; -} diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h deleted file mode 100644 index 74abeef94c..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef __FTMOD_SANGOMA_ISDN_USER_H__ -#define __FTMOD_SANGOMA_ISDN_USER_H__ - - -#define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL }; -#define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); -#define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ - _TYPE _FUNC1 (const char *name) \ - { \ - int i; \ - _TYPE t = _MAX ; \ - \ - for (i = 0; i < _MAX ; i++) { \ - if (!strcasecmp(name, _STRINGS[i])) { \ - t = (_TYPE) i; \ - break; \ - } \ - } \ - return t; \ - } \ - const char * _FUNC2 (_TYPE type) \ - { \ - if (type > _MAX) { \ - type = _MAX; \ - } \ - return _STRINGS[(int)type]; \ - } \ - - -typedef enum { - /* Call is not end-to-end ISDN */ - SNGISDN_PROGIND_DESCR_NETE_ISDN, - /* Destination address is non-ISDN */ - SNGISDN_PROGIND_DESCR_DEST_NISDN, - /* Origination address is non-ISDN */ - SNGISDN_PROGIND_DESCR_ORIG_NISDN, - /* Call has returned to the ISDN */ - SNGISDN_PROGIND_DESCR_RET_ISDN, - /* Interworking as occured and has resulted in a telecommunication service change */ - SNGISDN_PROGIND_DESCR_SERV_CHANGE, - /* In-band information or an appropriate pattern is now available */ - SNGISDN_PROGIND_DESCR_IB_AVAIL, - /* Invalid */ - SNGISDN_PROGIND_DESCR_INVALID, -} ftdm_sngisdn_progind_descr_t; -#define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); - - -typedef enum { - /* User */ - SNGISDN_PROGIND_LOC_USER, - /* Private network serving the local user */ - SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR, - /* Public network serving the local user */ - SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR, - /* Transit network */ - SNGISDN_PROGIND_LOC_TRANSIT_NET, - /* Public network serving remote user */ - SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR, - /* Private network serving remote user */ - SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR, - /* Network beyond the interworking point */ - SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW, - /* Invalid */ - SNGISDN_PROGIND_LOC_INVALID, -} ftdm_sngisdn_progind_loc_t; -#define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); - -typedef enum { - /* User Specified */ - SNGISDN_NETSPECFAC_TYPE_USER_SPEC, - /* National network identification */ - SNGISDN_NETSPECFAC_TYPE_NATIONAL_NETWORK_IDENT, - /* International network identification */ - SNGISDN_NETSPECFAC_TYPE_INTERNATIONAL_NETWORK_IDENT, - /* Invalid */ - SNGISDN_NETSPECFAC_TYPE_INVALID, -} ftdm_sngisdn_netspecfac_type_t; -#define SNGISDN_NETSPECFAC_TYPE_STRINGS "user-specified", "national-network-identification", "national-network-identification", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_netspecfac_type, ftdm_sngisdn_netspecfac_type2str, ftdm_sngisdn_netspecfac_type_t); - -typedef enum { - /* Unknown */ - SNGISDN_NETSPECFAC_PLAN_UNKNOWN, - /* Carrier Identification Code */ - SNGISDN_NETSPECFAC_PLAN_CARRIER_IDENT, - /* Data network identification code */ - SNGISDN_NETSPECFAC_PLAN_DATA_NETWORK_IDENT, - /* Invalid */ - SNGISDN_NETSPECFAC_PLAN_INVALID, -} ftdm_sngisdn_netspecfac_plan_t; -#define SNGISDN_NETSPECFAC_PLAN_STRINGS "unknown", "carrier-identification", "data-network-identification", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_netspecfac_plan, ftdm_sngisdn_netspecfac_plan2str, ftdm_sngisdn_netspecfac_plan_t); - -typedef enum { - /* Unknown */ - SNGISDN_NETSPECFAC_SPEC_ACCUNET, - SNGISDN_NETSPECFAC_SPEC_MEGACOM, - SNGISDN_NETSPECFAC_SPEC_MEGACOM_800, - SNGISDN_NETSPECFAC_SPEC_SDDN, - SNGISDN_NETSPECFAC_SPEC_INVALID, -} ftdm_sngisdn_netspecfac_spec_t; -#define SNGISDN_NETSPECFAC_SPEC_STRINGS "accunet", "megacom", "megacom-800", "sddn", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_netspecfac_spec, ftdm_sngisdn_netspecfac_spec2str, ftdm_sngisdn_netspecfac_spec_t); - -#endif /* __FTMOD_SANGOMA_ISDN_USER_H__*/ - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ - -/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c deleted file mode 100644 index 1210e39bb0..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ /dev/null @@ -1,1745 +0,0 @@ -/* - * Copyright (c) 2009|Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms|with or without - * modification|are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice|this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice|this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT - * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL, - * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -int ft_to_sngss7_cfg_all(void); - -int ftmod_ss7_relay_gen_config(void); -int ftmod_ss7_mtp1_gen_config(void); -int ftmod_ss7_mtp2_gen_config(void); -int ftmod_ss7_mtp3_gen_config(void); -int ftmod_ss7_isup_gen_config(void); -int ftmod_ss7_cc_gen_config(void); - -int ftmod_ss7_mtp1_psap_config(int id); - -int ftmod_ss7_mtp2_dlsap_config(int id); - -int ftmod_ss7_mtp3_dlsap_config(int id); -int ftmod_ss7_mtp3_nsap_config(int id); -int ftmod_ss7_mtp3_linkset_config(int id); -int ftmod_ss7_mtp3_route_config(int id); - -int ftmod_ss7_isup_nsap_config(int id); -int ftmod_ss7_isup_intf_config(int id); -int ftmod_ss7_isup_ckt_config(int id); -int ftmod_ss7_isup_isap_config(int id); - -int ftmod_ss7_cc_isap_config(int id); - -int ftmod_ss7_relay_chan_config(int id); -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ -int ft_to_sngss7_cfg_all(void) -{ - int x = 0; - int ret = 0; - - /* check if we have done gen_config already */ - if (g_ftdm_sngss7_data.gen_config == SNG_GEN_CFG_STATUS_INIT) { - /* update the global gen_config so we don't do it again */ - g_ftdm_sngss7_data.gen_config = SNG_GEN_CFG_STATUS_PENDING; - - /* start of by checking if the license and sig file are valid */ - if (sng_validate_license(g_ftdm_sngss7_data.cfg.license, - g_ftdm_sngss7_data.cfg.signature)) { - - SS7_CRITICAL("License verification failed..ending!\n"); - return 1; - } - - /* if the procId is not 0 then we are using relay mode */ - if (g_ftdm_sngss7_data.cfg.procId != 0) { - /* set the desired procID value */ - sng_set_procId((uint16_t)g_ftdm_sngss7_data.cfg.procId); - } - - /* start up the stack manager */ - if (sng_isup_init_sm()) { - SS7_CRITICAL("Failed to start Stack Manager\n"); - return 1; - } else { - SS7_INFO("Started Stack Manager!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED); - } - - /* check if the configuration had a Relay Channel */ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_PRESENT)) { - /* start up the relay task */ - if (sng_isup_init_relay()) { - SS7_CRITICAL("Failed to start Relay\n"); - return 1; - } else { - SS7_INFO("Started Relay!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED); - } - - /* run general configuration on the relay task */ - if (ftmod_ss7_relay_gen_config()) { - SS7_CRITICAL("Relay General configuration FAILED!\n"); - return 1; - } else { - SS7_INFO("Relay General configuration DONE\n"); - } - - } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) */ - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_PRESENT)) { - if (sng_isup_init_cc()) { - SS7_CRITICAL("Failed to start Call-Control\n"); - return 1; - } else { - SS7_INFO("Started Call-Control!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_STARTED); - } - if (ftmod_ss7_cc_gen_config()) { - SS7_CRITICAL("CC General configuration FAILED!\n"); - return 1; - } else { - SS7_INFO("CC General configuration DONE\n"); - } - if (ftmod_ss7_cc_isap_config(1)) { - SS7_CRITICAL("CC ISAP configuration FAILED!\n"); - return 1; - } else { - SS7_INFO("CC ISAP configuration DONE!\n"); - } - } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) */ - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_PRESENT)) { - if (sng_isup_init_isup()) { - SS7_CRITICAL("Failed to start ISUP\n"); - return 1; - } else { - SS7_INFO("Started ISUP!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_STARTED); - } - if (ftmod_ss7_isup_gen_config()) { - SS7_CRITICAL("ISUP General configuration FAILED!\n"); - return 1; - } else { - SS7_INFO("ISUP General configuration DONE\n"); - } - } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) */ - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_PRESENT)) { - if (sng_isup_init_mtp3()) { - SS7_CRITICAL("Failed to start MTP3\n"); - return 1; - } else { - SS7_INFO("Started MTP3!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_STARTED); - } - - if (ftmod_ss7_mtp3_gen_config()) { - SS7_CRITICAL("MTP3 General configuration FAILED!\n"); - return 1; - } else { - SS7_INFO("MTP3 General configuration DONE\n"); - } - } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3)) */ - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_PRESENT)) { - if (sng_isup_init_mtp2()) { - SS7_CRITICAL("Failed to start MTP2\n"); - return 1; - } else { - SS7_INFO("Started MTP2!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED); - } - if (sng_isup_init_mtp1()) { - SS7_CRITICAL("Failed to start MTP1\n"); - return 1; - } else { - SS7_INFO("Started MTP1!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1_STARTED); - } - if (ftmod_ss7_mtp1_gen_config()) { - SS7_CRITICAL("MTP1 General configuration FAILED!\n"); - return 1; - } else { - SS7_INFO("MTP1 General configuration DONE\n"); - } - if (ftmod_ss7_mtp2_gen_config()) { - SS7_CRITICAL("MTP2 General configuration FAILED!\n"); - return 1; - } else { - SS7_INFO("MTP2 General configuration DONE\n"); - } - } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) */ - - if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){ - if(FTDM_SUCCESS != ftmod_ss7_m2ua_init()){ - ftdm_log (FTDM_LOG_ERROR, "ftmod_ss7_m2ua_init FAILED \n"); - return FTDM_FAIL; - } - } - - g_ftdm_sngss7_data.gen_config = SNG_GEN_CFG_STATUS_DONE; - - } /* if (!(g_ftdm_sngss7_data.gen_config)) */ - - - if (g_ftdm_sngss7_data.gen_config != SNG_GEN_CFG_STATUS_DONE) { - SS7_CRITICAL("General configuration FAILED!\n"); - return 1; - } - - x = 1; - while (x < (MAX_MTP_LINKS)) { - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.mtp1Link[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.mtp1Link[x].flags & SNGSS7_CONFIGURED))) { - - /* configure mtp1 */ - if (ftmod_ss7_mtp1_psap_config(x)) { - SS7_CRITICAL("MTP1 PSAP %d configuration FAILED!\n", x); - return 1;; - } else { - SS7_INFO("MTP1 PSAP %d configuration DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.mtp1Link[x].flags |= SNGSS7_CONFIGURED; - } - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - x = 1; - while (x < (MAX_MTP_LINKS)) { - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.mtp2Link[x].flags & SNGSS7_CONFIGURED))) { - - /* configure mtp2 */ - if (ftmod_ss7_mtp2_dlsap_config(x)) { - SS7_CRITICAL("MTP2 DLSAP %d configuration FAILED!\n",x); - return 1;; - } else { - SS7_INFO("MTP2 DLSAP %d configuration DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.mtp2Link[x].flags |= SNGSS7_CONFIGURED; - } - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - /* no configs above mtp2 for relay */ - if (g_ftdm_sngss7_data.cfg.procId == 1) { - x = 1; - while (x < (MAX_MTP_LINKS)) { - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.mtp3Link[x].flags & SNGSS7_CONFIGURED))) { - - /* configure mtp3 */ - if (ftmod_ss7_mtp3_dlsap_config(x)) { - SS7_CRITICAL("MTP3 DLSAP %d configuration FAILED!\n", x); - return 1;; - } else { - SS7_INFO("MTP3 DLSAP %d configuration DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.mtp3Link[x].flags |= SNGSS7_CONFIGURED; - } - - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - /* in M2UA_SG mode there will not be any MTP3 layer */ - if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){ - x = 1; - while (x < (MAX_NSAPS)) { - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.nsap[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_CONFIGURED))) { - - ret = ftmod_ss7_mtp3_nsap_config(x); - if (ret) { - SS7_CRITICAL("MTP3 NSAP %d configuration FAILED!(%s)\n", x, DECODE_LCM_REASON(ret)); - return 1; - } else { - SS7_INFO("MTP3 NSAP %d configuration DONE!\n", x); - } - - ret = ftmod_ss7_isup_nsap_config(x); - if (ret) { - SS7_CRITICAL("ISUP NSAP %d configuration FAILED!(%s)\n", x, DECODE_LCM_REASON(ret)); - return 1; - } else { - SS7_INFO("ISUP NSAP %d configuration DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.nsap[x].flags |= SNGSS7_CONFIGURED; - } /* if !SNGSS7_CONFIGURED */ - - x++; - } /* while (x < (MAX_NSAPS)) */ - } - - /* in M2UA_SG mode there will not be any MTP3 layer */ - if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){ - x = 1; - while (x < (MAX_MTP_LINKSETS+1)) { - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_CONFIGURED))) { - - if (ftmod_ss7_mtp3_linkset_config(x)) { - SS7_CRITICAL("MTP3 LINKSET %d configuration FAILED!\n", x); - return 1; - } else { - SS7_INFO("MTP3 LINKSET %d configuration DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= SNGSS7_CONFIGURED; - } /* if !SNGSS7_CONFIGURED */ - - x++; - } /* while (x < (MAX_MTP_LINKSETS+1)) */ - } - - /* in M2UA_SG mode there will not be any MTP3 layer */ - if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){ - x = 1; - while (x < (MAX_MTP_ROUTES+1)) { - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.mtpRoute[x].flags & SNGSS7_CONFIGURED))) { - - if (ftmod_ss7_mtp3_route_config(x)) { - SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x); - return 1; - } else { - SS7_INFO("MTP3 ROUTE %d configuration DONE!\n",x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.mtpRoute[x].flags |= SNGSS7_CONFIGURED; - } /* if !SNGSS7_CONFIGURED */ - - x++; - } /* while (x < (MAX_MTP_ROUTES+1)) */ - } - - x = 1; - while (x < (MAX_ISAPS)) { - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.isap[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_CONFIGURED))) { - - if (ftmod_ss7_isup_isap_config(x)) { - SS7_CRITICAL("ISUP ISAP %d configuration FAILED!\n", x); - return 1; - } else { - SS7_INFO("ISUP ISAP %d configuration DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.isap[x].flags |= SNGSS7_CONFIGURED; - } /* if !SNGSS7_CONFIGURED */ - - x++; - } /* while (x < (MAX_ISAPS)) */ - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_STARTED)) { - x = 1; - while (x < (MAX_ISUP_INFS)) { - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.isupIntf[x].flags & SNGSS7_CONFIGURED))) { - - if (ftmod_ss7_isup_intf_config(x)) { - SS7_CRITICAL("ISUP INTF %d configuration FAILED!\n", x); - return 1; - } else { - SS7_INFO("ISUP INTF %d configuration DONE!\n", x); - /* set the interface to paused */ - sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[x], SNGSS7_PAUSED); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.isupIntf[x].flags |= SNGSS7_CONFIGURED; - } /* if !SNGSS7_CONFIGURED */ - - x++; - } /* while (x < (MAX_ISUP_INFS)) */ - } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) */ - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - - if (g_ftdm_sngss7_data.cfg.procId > 1) { - break; - } - - /* check if this link has been configured already */ - if ((g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.isupCkt[x].flags & SNGSS7_CONFIGURED))) { - - if (ftmod_ss7_isup_ckt_config(x)) { - SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x); - return 1; - } else { - SS7_INFO("ISUP CKT %d configuration DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= SNGSS7_CONFIGURED; - } /* if !SNGSS7_CONFIGURED */ - - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ - } - - /* go through all the relays channels and configure it */ - x = 1; - while (x < (MAX_RELAY_CHANNELS)) { - /* check if this relay channel has been configured already */ - if ((g_ftdm_sngss7_data.cfg.relay[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED))) { - - /* send the specific configuration */ - if (ftmod_ss7_relay_chan_config(x)) { - SS7_CRITICAL("Relay Channel %d configuration FAILED!\n", x); - return 1; - } else { - SS7_INFO("Relay Channel %d configuration DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.relay[x].flags |= SNGSS7_CONFIGURED; - } /* if !SNGSS7_CONFIGURED */ - x++; - } /* while (x < (MAX_RELAY_CHANNELS)) */ - - - if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){ - return ftmod_ss7_m2ua_cfg(); - } - - return 0; -} - -/******************************************************************************/ -int ftmod_ss7_relay_gen_config(void) -{ - RyMngmt cfg; /*configuration structure*/ - Pst pst; /*post structure*/ - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTRY; - - /* clear the configuration structure */ - memset(&cfg, 0x0, sizeof(RyMngmt)); - - /* fill in some general sections of the header */ - smHdrInit(&cfg.hdr); - - /* fill in the post structure */ - smPstInit( &cfg.t.cfg.s.ryGenCfg.lmPst ); - - /*fill in the specific fields of the header */ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTRY; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - - cfg.t.cfg.s.ryGenCfg.lmPst.srcEnt = ENTRY; - cfg.t.cfg.s.ryGenCfg.lmPst.dstEnt = ENTSM; - - cfg.t.cfg.s.ryGenCfg.nmbChan = 10; - cfg.t.cfg.s.ryGenCfg.tmrRes = RY_PERIOD; - cfg.t.cfg.s.ryGenCfg.usta = 1; - - - return(sng_cfg_relay(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp1_gen_config(void) -{ - L1Mngmt cfg; /*configuration structure*/ - Pst pst; /*post structure*/ - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTL1; - - /* clear the configuration structure */ - memset(&cfg, 0x0, sizeof(L1Mngmt)); - - /* fill in some general sections of the header */ - smHdrInit(&cfg.hdr); - - /* fill in the post structure */ - smPstInit( &cfg.t.cfg.s.l1Gen.sm ); - - /*fill in the specific fields of the header */ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTL1; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - - cfg.t.cfg.s.l1Gen.sm.srcEnt = ENTL1; - cfg.t.cfg.s.l1Gen.sm.dstEnt = ENTSM; - - cfg.t.cfg.s.l1Gen.nmbLnks = MAX_L1_LINKS; - cfg.t.cfg.s.l1Gen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ - cfg.t.cfg.s.l1Gen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ - - return(sng_cfg_mtp1(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp2_gen_config(void) -{ - SdMngmt cfg; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSD; - - /* clear the configuration structure */ - memset(&cfg, 0x0, sizeof(SdMngmt)); - - /* fill in some general sections of the header */ - smHdrInit(&cfg.hdr); - - /* fill in the post structure */ - smPstInit( &cfg.t.cfg.s.sdGen.sm ); - - /* fill in the specific fields of the header */ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSD; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - - cfg.t.cfg.s.sdGen.sm.srcEnt = ENTSD; - cfg.t.cfg.s.sdGen.sm.dstEnt = ENTSM; - - cfg.t.cfg.s.sdGen.nmbLnks = MAX_SD_LINKS; - cfg.t.cfg.s.sdGen.poolTrUpper = POOL_UP_TR; - cfg.t.cfg.s.sdGen.poolTrLower = POOL_LW_TR; - - return(sng_cfg_mtp2(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp3_gen_config(void) -{ - SnMngmt cfg; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SnMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /* fill in the post structure */ - smPstInit(&cfg.t.cfg.s.snGen.sm); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - - cfg.t.cfg.s.snGen.sm.srcEnt = ENTSN; - cfg.t.cfg.s.snGen.sm.dstEnt = ENTSM; - - - cfg.t.cfg.s.snGen.typeSP = LSN_TYPE_SP; /* type of signalling postatic int */ - cfg.t.cfg.s.snGen.spCode1 = 0; /* our DPC for CCITT version */ -#if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snGen.spCode2 = 0; /* our DPC for ANSI or CHINA version */ -#endif - cfg.t.cfg.s.snGen.ssfValid = TRUE; /* ssf validation required */ - cfg.t.cfg.s.snGen.nmbDLSap = MAX_SN_LINKS; /* number of MTP Data Link SAPs */ - cfg.t.cfg.s.snGen.nmbNSap = MAX_SN_ROUTES; /* number of Upper Layer Saps */ - cfg.t.cfg.s.snGen.nmbRouts = MAX_SN_ROUTES; /* maximum number of routing entries */ - cfg.t.cfg.s.snGen.nmbLnkSets = MAX_SN_LINKSETS; /* number of link sets */ - cfg.t.cfg.s.snGen.nmbRteInst = MAX_SN_ROUTES*16; /* number of simultaneous Rte instances */ - cfg.t.cfg.s.snGen.cbTimeRes = SN_CB_PERIOD; /* link time resolution */ - cfg.t.cfg.s.snGen.spTimeRes = SN_SP_PERIOD; /* general time resolution */ - cfg.t.cfg.s.snGen.rteTimeRes = SN_RTE_PERIOD; /* route time resolution */ - cfg.t.cfg.s.snGen.extCmbndLnkst = FALSE; /* enbale extended combined linkset feature */ - -#if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART)) - -#else - cfg.t.cfg.s.snGen.rstReq = LSN_NO_RST; /* restarting procedure required */ - cfg.t.cfg.s.snGen.tfrReq = FALSE; /* TFR procedure required or not */ - cfg.t.cfg.s.snGen.tmr.t15.enb = TRUE; /* t15 - waiting to start route set congestion test */ - cfg.t.cfg.s.snGen.tmr.t15.val = 30; - cfg.t.cfg.s.snGen.tmr.t16.enb = TRUE; /* t16 - waiting for route set congestion status update */ - cfg.t.cfg.s.snGen.tmr.t16.val = 20; - cfg.t.cfg.s.snGen.tmr.t18.enb = TRUE; /* t18 - waiting for links to become available */ - cfg.t.cfg.s.snGen.tmr.t18.val = 200; - cfg.t.cfg.s.snGen.tmr.t19.enb = TRUE; /* t19 - waiting to receive all traffic restart allowed */ - cfg.t.cfg.s.snGen.tmr.t19.val = 690; - cfg.t.cfg.s.snGen.tmr.t21.enb = TRUE; /* t21 - waiting to restart traffic routed through adjacent SP */ - cfg.t.cfg.s.snGen.tmr.t21.val = 650; -# if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snGen.tmr.t26.enb = TRUE; /* t26 - waiting to repeat traffic restart waiting message for ANSI */ - cfg.t.cfg.s.snGen.tmr.t26.val = 600; -# endif -#endif - -#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS96) - cfg.t.cfg.s.snGen.mopc = FALSE; -#endif - - return(sng_cfg_mtp3(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_isup_gen_config(void) -{ - SiMngmt cfg; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /* clear the configuration structure */ - memset(&cfg, 0x0, sizeof(SiMngmt)); - - /* fill in some general sections of the header */ - smHdrInit(&cfg.hdr); - - /* fill in the post structure */ - smPstInit( &cfg.t.cfg.s.siGen.sm ); - - /*fill in the specific fields of the header */ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSI; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - - cfg.t.cfg.s.siGen.sm.srcEnt = ENTSI; - cfg.t.cfg.s.siGen.sm.dstEnt = ENTSM; - - cfg.t.cfg.s.siGen.nmbSaps = MAX_CC_INTERFACE; /* Number of ISUP Saps */ - cfg.t.cfg.s.siGen.nmbNSaps = MAX_SN_INTERFACE; /* Number of Network Saps */ - cfg.t.cfg.s.siGen.nmbCir = MAX_SI_CIRCUITS; /* Number of circuits */ - cfg.t.cfg.s.siGen.nmbIntf = MAX_SI_INTERFACES; /* Number of interfaces */ - cfg.t.cfg.s.siGen.nmbCirGrp = MAX_SI_CIR_GRP; /* Max number of circuit groups */ - cfg.t.cfg.s.siGen.nmbCalRef = MAX_SI_CALL_REF; /* Number of Call References */ - cfg.t.cfg.s.siGen.timeRes = SI_PERIOD; /* time resolution */ - cfg.t.cfg.s.siGen.sccpSup = FALSE; /* SCCP support */ - cfg.t.cfg.s.siGen.handleTTBinCC = FALSE; /* Flag used for controlling TTB feature */ - cfg.t.cfg.s.siGen.mapCPCandFCI = TRUE; /* Flag used for controlling TTB feature */ -#if (LSIV3 || LSIV4 || LSIV5) - cfg.t.cfg.s.siGen.lnkSelOpt = SI_LINK_SELECTION; /* link selector option */ -#endif - cfg.t.cfg.s.siGen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ - cfg.t.cfg.s.siGen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ - cfg.t.cfg.s.siGen.cirGrTmr.t18.enb = TRUE; /* t18 timer - group blocking sent */ - cfg.t.cfg.s.siGen.cirGrTmr.t18.val = 300; - cfg.t.cfg.s.siGen.cirGrTmr.t19.enb = TRUE; /* t19 timer - initial group blocking sent */ - cfg.t.cfg.s.siGen.cirGrTmr.t19.val = 3000; - cfg.t.cfg.s.siGen.cirGrTmr.t20.enb = TRUE; /* t20 timer - group unblocking sent */ - cfg.t.cfg.s.siGen.cirGrTmr.t20.val = 300; - cfg.t.cfg.s.siGen.cirGrTmr.t21.enb = TRUE; /* t21 timer - initial grp unblocking sent */ - cfg.t.cfg.s.siGen.cirGrTmr.t21.val = 3000; - cfg.t.cfg.s.siGen.cirGrTmr.t22.enb = TRUE; /* t22 timer - group reset sent */ - cfg.t.cfg.s.siGen.cirGrTmr.t22.val = 300; - cfg.t.cfg.s.siGen.cirGrTmr.t23.enb = TRUE; /* t23 timer - initial group reset sent */ - cfg.t.cfg.s.siGen.cirGrTmr.t23.val = 3000; -#ifndef SS7_UK - cfg.t.cfg.s.siGen.cirGrTmr.t28.enb = TRUE; /* t28 timer - circuit group query sent */ - cfg.t.cfg.s.siGen.cirGrTmr.t28.val = 100; -#endif -#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) - cfg.t.cfg.s.siGen.cirGrTmr.tFGR.enb = TRUE; /* first group received timer */ - cfg.t.cfg.s.siGen.cirGrTmr.tFGR.val = 50; -#endif -#if CGPN_CHK - cfg.t.cfg.s.siGen.cgPtyNumGenCfg = TRUE; /* Calling party number general config flag */ -#endif -#ifdef SI_SUPPRESS_CFN - cfg.t.cfg.s.siGen.suppressCfn = TRUE; /* Flag used for 'suppress CFN' feature */ -#endif - - return(sng_cfg_isup(&pst, &cfg)); - -} - -/******************************************************************************/ -int ftmod_ss7_cc_gen_config(void) -{ - CcMngmt cfg; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTCC; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(CcMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /* fill in the post structure */ - smPstInit( &cfg.t.cfg.s.ccGen.sm ); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTCC; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - - cfg.t.cfg.s.ccGen.sm.srcEnt = ENTCC; - cfg.t.cfg.s.ccGen.sm.dstEnt = ENTSM; - - cfg.t.cfg.s.ccGen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ - cfg.t.cfg.s.ccGen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ - - return(sng_cfg_cc(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp1_psap_config(int id) -{ - L1Mngmt cfg; - Pst pst; - sng_mtp1_link_t *k = &g_ftdm_sngss7_data.cfg.mtp1Link[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTL1; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(L1Mngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTL1; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STPSAP; - - cfg.hdr.elmId.elmntInst1 = k->id; - - cfg.t.cfg.s.l1PSAP.span = k->span; - cfg.t.cfg.s.l1PSAP.chan = k->chan; - cfg.t.cfg.s.l1PSAP.spId = k->id; - - return(sng_cfg_mtp1(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp2_dlsap_config(int id) -{ - SdMngmt cfg; - Pst pst; - sng_mtp2_link_t *k = &g_ftdm_sngss7_data.cfg.mtp2Link[id]; - - /* initalize the post structure */ - smPstInit( &pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSD; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SdMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSD; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STDLSAP; - - cfg.hdr.elmId.elmntInst1 = k->id; - - cfg.t.cfg.s.sdDLSAP.mem.region = S_REG; /* memory region */ - cfg.t.cfg.s.sdDLSAP.mem.pool = S_POOL; /* memory pool */ - cfg.t.cfg.s.sdDLSAP.swtch = k->linkType; /* protocol type */ - cfg.t.cfg.s.sdDLSAP.priorDl = PRIOR0; /* priority for data link layer */ - cfg.t.cfg.s.sdDLSAP.routeDl = RTESPEC; /* route for data link layer */ - cfg.t.cfg.s.sdDLSAP.selectorDl = 0; /* upper interface selector */ - if (k->mtp1ProcId > 0) { - cfg.t.cfg.s.sdDLSAP.dstProcId = k->mtp1ProcId; /* the procid of MAC/L1/MTP1 */ - } else { - cfg.t.cfg.s.sdDLSAP.dstProcId = SFndProcId(); /* the procid of MAC/L1/MTP1 */ - } - cfg.t.cfg.s.sdDLSAP.dstProcId = SFndProcId(); /* the procid of MAC/L1/MTP1 */ - cfg.t.cfg.s.sdDLSAP.entMac = ENTL1; /* entity for MAC */ - cfg.t.cfg.s.sdDLSAP.instMac = S_INST; /* instance for MAC */ - cfg.t.cfg.s.sdDLSAP.priorMac = PRIOR0; /* priority for MAC layer */ - cfg.t.cfg.s.sdDLSAP.routeMac = RTESPEC; /* route for MAC layer */ - cfg.t.cfg.s.sdDLSAP.selectorMac = 0; /* lower interface selector */ - cfg.t.cfg.s.sdDLSAP.memMac.region = S_REG; /* memory region and pool id for MAC */ - cfg.t.cfg.s.sdDLSAP.memMac.pool = S_POOL; - cfg.t.cfg.s.sdDLSAP.maxOutsFrms = MAX_SD_OUTSTANDING; /* maximum outstanding frames */ - cfg.t.cfg.s.sdDLSAP.errType = k->errorType; - cfg.t.cfg.s.sdDLSAP.t1.enb = TRUE; /* timer 1 - Alignment Ready Timer */ - cfg.t.cfg.s.sdDLSAP.t1.val = k->t1; - cfg.t.cfg.s.sdDLSAP.t2.enb = TRUE; /* timer 2 - Not Aligned Timer */ - cfg.t.cfg.s.sdDLSAP.t2.val = k->t2; - cfg.t.cfg.s.sdDLSAP.t3.enb = TRUE; /* timer 3 - Aligned Timer */ - cfg.t.cfg.s.sdDLSAP.t3.val = k->t3; - cfg.t.cfg.s.sdDLSAP.t5.enb = TRUE; /* timer 5 - Sending SIB timer */ - cfg.t.cfg.s.sdDLSAP.t5.val = k->t5; - cfg.t.cfg.s.sdDLSAP.t6.enb = TRUE; /* timer 6 - Remote Congestion Timer */ - cfg.t.cfg.s.sdDLSAP.t6.val = k->t6; - cfg.t.cfg.s.sdDLSAP.t7.enb = TRUE; /* timer 7 - Excessive delay of acknowledgement timer */ - cfg.t.cfg.s.sdDLSAP.t7.val = k->t7; - cfg.t.cfg.s.sdDLSAP.provEmrgcy = k->t4e; /* emergency proving period */ - cfg.t.cfg.s.sdDLSAP.provNormal = k->t4n; /* normal proving period */ - cfg.t.cfg.s.sdDLSAP.lssuLen = k->lssuLength; /* one or two byte LSSU length */ - cfg.t.cfg.s.sdDLSAP.maxFrmLen = MAX_SD_FRAME_LEN; /* max frame length for MSU */ - cfg.t.cfg.s.sdDLSAP.congDisc = FALSE; /* congestion discard TRUE or FALSE */ - cfg.t.cfg.s.sdDLSAP.sdT = MAX_SD_SUERM; /* SUERM error rate threshold */ - cfg.t.cfg.s.sdDLSAP.sdTie = MAX_SD_AERM_EMERGENCY; /* AERM emergency error rate threshold */ - cfg.t.cfg.s.sdDLSAP.sdTin = MAX_SD_AERM_NORMAL; /* AERM normal error rate threshold */ - cfg.t.cfg.s.sdDLSAP.sdN1 = MAX_SD_MSU_RETRANS; /* maximum number of MSUs for retransmission */ - cfg.t.cfg.s.sdDLSAP.sdN2 = MAX_SD_OCTETS_RETRANS; /* maximum number of MSU octets for retrans */ - cfg.t.cfg.s.sdDLSAP.sdCp = MAX_SD_ALIGN_ATTEMPTS; /* maximum number of alignment attempts */ - cfg.t.cfg.s.sdDLSAP.spIdSE = k->mtp1Id; /* service provider id */ - cfg.t.cfg.s.sdDLSAP.sdtFlcStartTr = 256; /* SDT interface flow control start thresh */ - cfg.t.cfg.s.sdDLSAP.sdtFlcEndTr = 512; /* SDT interface flow control end thresh */ - -#ifdef SD_HSL - cfg.t.cfg.s.sdDLSAP.sapType =; /* Indcates whether link is HSL or LSL */ - cfg.t.cfg.s.sdDLSAP.sapFormat =; /* The extened sequence no to be used or not */ - cfg.t.cfg.s.sdDLSAP.t8.enb =; /* timer 8 configuration structure */ - cfg.t.cfg.s.sdDLSAP.sdTe =; /* EIM threshold */ - cfg.t.cfg.s.sdDLSAP.sdUe =; /* increment constant */ - cfg.t.cfg.s.sdDLSAP.sdDe =; /* decrement constant */ -#endif /* HIGH_SPEED_SIGNALING_SUPPORT */ - -#if (SS7_TTC || SS7_NTT) - cfg.t.cfg.s.sdDLSAP.numRtb =; /* outstanding number of messages in RTB */ - cfg.t.cfg.s.sdDLSAP.tf =; /* FISU transmission interval */ - cfg.t.cfg.s.sdDLSAP.tfv =; /* FISU transmission interval during verification */ - cfg.t.cfg.s.sdDLSAP.to =; /* SIO transmission interval */ - cfg.t.cfg.s.sdDLSAP.ta =; /* SIE transmission interval */ - cfg.t.cfg.s.sdDLSAP.ts =; /* SIOS transmission interval */ - cfg.t.cfg.s.sdDLSAP.tso =; /* SIOS transmission duration when out of service */ - cfg.t.cfg.s.sdDLSAP.te =; /* SU normalization time */ -#endif /* (SS7_TTC || SS7_NTT) */ - -#if (SS7_NTT) /* NTTT - Q.703 */ - cfg.t.cfg.s.sdDLSAP.repMsuNack =; /* Nack on receipt of repeated MSU */ - cfg.t.cfg.s.sdDLSAP.invFibIgnore =; /* invalid FIB ignore or bring the link down */ - cfg.t.cfg.s.sdDLSAP.invBsnIgnore =; /* invalid BSN ignore or bring the link down */ - cfg.t.cfg.s.sdDLSAP.congAbatOnNack =; /* congestion abatement on nack or only on acks */ -#endif /* (SS7_NTT) */ - -#ifdef TDS_ROLL_UPGRADE_SUPPORT - cfg.t.cfg.s.sdDLSAP.hlremIntfValid = FALSE; /* Upper Sap Version number valid ? */ - cfg.t.cfg.s.sdDLSAP.remIntfVer = SDTIFVER; /* remote version info */ -#endif /*RUG*/ - - return(sng_cfg_mtp2(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp3_dlsap_config(int id) -{ - Pst pst; - SnMngmt cfg; - sng_mtp3_link_t *k = &g_ftdm_sngss7_data.cfg.mtp3Link[id]; - - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SnMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STDLSAP; - - cfg.hdr.elmId.elmntInst1 = k->id; - - cfg.t.cfg.s.snDLSAP.lnkSetId = k->linkSetId; /* link set ID */ - cfg.t.cfg.s.snDLSAP.opc = k->spc; /* Originating Postatic int Code */ - cfg.t.cfg.s.snDLSAP.adjDpc = k->apc; /* Adlacent Destination Postatic int Code */ - cfg.t.cfg.s.snDLSAP.lnkPrior = 0; /* link priority within the link set */ - cfg.t.cfg.s.snDLSAP.msgSize = MAX_SN_MSG_SIZE; /* message length */ - cfg.t.cfg.s.snDLSAP.msgPrior = 0; /* management message priority */ - cfg.t.cfg.s.snDLSAP.lnkType = k->linkType; /* link type ANSI, ITU, BICI or CHINA */ - cfg.t.cfg.s.snDLSAP.upSwtch = k->switchType; /* user part switch type */ - cfg.t.cfg.s.snDLSAP.maxSLTtry = MAX_SLTM_RETRIES; /* maximun times to retry SLTM */ - cfg.t.cfg.s.snDLSAP.p0QLen = 32; /* size of the priority 0 Q */ - cfg.t.cfg.s.snDLSAP.p1QLen = 32; /* size of the priority 1 Q */ - cfg.t.cfg.s.snDLSAP.p2QLen = 32; /* size of the priority 2 Q */ - cfg.t.cfg.s.snDLSAP.p3QLen = 32; /* size of the priority 3 Q */ - cfg.t.cfg.s.snDLSAP.discPrior = 0; /* discard priority */ -#ifndef SDT2 - cfg.t.cfg.s.snDLSAP.maxCredit = MAX_SN_CREDIT; /* max credit */ -#endif /* SDT2 */ - cfg.t.cfg.s.snDLSAP.lnkId = 0; /* signalling link allocation procedure identity */ - cfg.t.cfg.s.snDLSAP.lnkTstSLC = k->slc; /* link selection code for link test */ - cfg.t.cfg.s.snDLSAP.tstLen = 7; /* link test pattern length */ - cfg.t.cfg.s.snDLSAP.tst[0] = 'S'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[1] = 'A'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[2] = 'N'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[3] = 'G'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[4] = 'O'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[5] = 'M'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[6] = 'A'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.ssf = k->ssf; /* sub service field */ - cfg.t.cfg.s.snDLSAP.dstProcId = k->mtp2ProcId; /* destination processor id */ - cfg.t.cfg.s.snDLSAP.dstEnt = ENTSD; /* entity */ - cfg.t.cfg.s.snDLSAP.dstInst = S_INST; /* instance */ - cfg.t.cfg.s.snDLSAP.prior = PRIOR0; /* priority */ - cfg.t.cfg.s.snDLSAP.route = RTESPEC; /* route */ - cfg.t.cfg.s.snDLSAP.selector = 0; /* lower layer selector */ - cfg.t.cfg.s.snDLSAP.mem.region = S_REG; /* memory region id */ - cfg.t.cfg.s.snDLSAP.mem.pool = S_POOL; /* memory pool id */ - cfg.t.cfg.s.snDLSAP.spId = k->mtp2Id; /* service provider id */ - - switch (k->linkType) { - /**************************************************************************/ - case (LSN_SW_ANS): - case (LSN_SW_ANS96): - case (LSN_SW_CHINA): - cfg.t.cfg.s.snDLSAP.dpcLen = DPC24; /* dpc length 24 bits */ - cfg.t.cfg.s.snDLSAP.l2Type = LSN_MTP2_56KBPS; /* layer 2 type - 56kbps MTP2 link, 1.536Mbps MTP2 link or QSAAL link */ - cfg.t.cfg.s.snDLSAP.isCLink = FALSE; /* identifies if the link is a C type link.Required to check if sls has to be rotated.*/ - break; - /**************************************************************************/ - case (LSN_SW_ITU): - cfg.t.cfg.s.snDLSAP.dpcLen = DPC14; /* dpc length 14 bits */ - break; - /**************************************************************************/ - default: - cfg.t.cfg.s.snDLSAP.dpcLen = DPC14; /* dpc length 14 bits */ - break; - /**************************************************************************/ - } /* switch (k->linkType) */ - - switch (k->linkType) { - /**************************************************************************/ - case (LSN_SW_ANS): - case (LSN_SW_ANS96): - cfg.t.cfg.s.snDLSAP.flushContFlag = TRUE; /* flush continue handling */ - break; - /**************************************************************************/ - case (LSN_SW_ITU): - case (LSN_SW_CHINA): - cfg.t.cfg.s.snDLSAP.flushContFlag = FALSE; /* flush continue handling */ - break; - /**************************************************************************/ - default: - cfg.t.cfg.s.snDLSAP.flushContFlag = FALSE; /* flush continue handling */ - break; - /**************************************************************************/ - } /* switch (k->linkType) */ - - cfg.t.cfg.s.snDLSAP.tmr.t1.enb = TRUE; /* t1 - delay to avoid missequencing on changeover */ - cfg.t.cfg.s.snDLSAP.tmr.t1.val = k->t1; - cfg.t.cfg.s.snDLSAP.tmr.t2.enb = TRUE; /* t2 - waiting for changeover ack */ - cfg.t.cfg.s.snDLSAP.tmr.t2.val = k->t2; - cfg.t.cfg.s.snDLSAP.tmr.t3.enb = TRUE; /* t3 - delay to avoid missequencing on changeback */ - cfg.t.cfg.s.snDLSAP.tmr.t3.val = k->t3; - cfg.t.cfg.s.snDLSAP.tmr.t4.enb = TRUE; /* t4 - waiting for first changeback ack */ - cfg.t.cfg.s.snDLSAP.tmr.t4.val = k->t4; - cfg.t.cfg.s.snDLSAP.tmr.t5.enb = TRUE; /* t5 - waiting for second changeback ack */ - cfg.t.cfg.s.snDLSAP.tmr.t5.val = k->t5; - cfg.t.cfg.s.snDLSAP.tmr.t7.enb = TRUE; /* t7 - waiting for link connection ack */ - cfg.t.cfg.s.snDLSAP.tmr.t7.val = k->t7; - cfg.t.cfg.s.snDLSAP.tmr.t12.enb = TRUE; /* t12 - waiting for uninhibit ack */ - cfg.t.cfg.s.snDLSAP.tmr.t12.val = k->t12; - cfg.t.cfg.s.snDLSAP.tmr.t13.enb = TRUE; /* t13 - waiting for forced uninhibit */ - cfg.t.cfg.s.snDLSAP.tmr.t13.val = k->t13; - cfg.t.cfg.s.snDLSAP.tmr.t14.enb = TRUE; /* t14 - waiting for inhibition ack */ - cfg.t.cfg.s.snDLSAP.tmr.t14.val = k->t14; - cfg.t.cfg.s.snDLSAP.tmr.t17.enb = TRUE; /* t17 - delay to avoid oscillation of initial alignment failure */ - cfg.t.cfg.s.snDLSAP.tmr.t17.val = k->t17; - cfg.t.cfg.s.snDLSAP.tmr.t22.enb = TRUE; /* t22 - local inhibit test timer */ - cfg.t.cfg.s.snDLSAP.tmr.t22.val = k->t22; - cfg.t.cfg.s.snDLSAP.tmr.t23.enb = TRUE; /* t23 - remote inhibit test timer */ - cfg.t.cfg.s.snDLSAP.tmr.t23.val = k->t23; - cfg.t.cfg.s.snDLSAP.tmr.t24.enb = TRUE; /* t24 - stabilizing timer */ - cfg.t.cfg.s.snDLSAP.tmr.t24.val = k->t24; - cfg.t.cfg.s.snDLSAP.tmr.t31.enb = TRUE; /* t31 - BSN requested timer */ - cfg.t.cfg.s.snDLSAP.tmr.t31.val = k->t31; - cfg.t.cfg.s.snDLSAP.tmr.t32.enb = TRUE; /* t32 - SLT timer */ - cfg.t.cfg.s.snDLSAP.tmr.t32.val = k->t32; - cfg.t.cfg.s.snDLSAP.tmr.t33.enb = TRUE; /* t33 - connecting timer */ - cfg.t.cfg.s.snDLSAP.tmr.t33.val = k->t33; - cfg.t.cfg.s.snDLSAP.tmr.t34.enb = TRUE; /* t34 - periodic signalling link test timer */ - cfg.t.cfg.s.snDLSAP.tmr.t34.val = k->t34; -#if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snDLSAP.tmr.t35.enb = TRUE; /* t35 - false link congestion timer, same as t31 of ANSI'96*/ - cfg.t.cfg.s.snDLSAP.tmr.t35.val = k->t35; - cfg.t.cfg.s.snDLSAP.tmr.t36.enb = TRUE; /* t36 - false link congestion timer, same as t33 of ANSI'96*/ - cfg.t.cfg.s.snDLSAP.tmr.t36.val = k->t36; - cfg.t.cfg.s.snDLSAP.tmr.t37.enb = TRUE; /* t37 - false link congestion timer, same as t34 of ANSI'96*/ - cfg.t.cfg.s.snDLSAP.tmr.t37.val = k->t37; - cfg.t.cfg.s.snDLSAP.tmr.tCraft.enb = TRUE; /* link referral craft timer - T19 in ANSI */ - cfg.t.cfg.s.snDLSAP.tmr.tCraft.val = k->tcraft; -#endif -#ifdef SDT2 - cfg.t.cfg.s.snDLSAP.tmr.tFlc.enb = TRUE; /* flow control timer */ - cfg.t.cfg.s.snDLSAP.tmr.tFlc.val = 300; - cfg.t.cfg.s.snDLSAP.tmr.tBnd.enb = TRUE; /* bind request timer */ - cfg.t.cfg.s.snDLSAP.tmr.tBnd.val = 20; -#endif /* SDT2 */ -#ifdef TDS_ROLL_UPGRADE_SUPPORT - cfg.t.cfg.s.snDLSAP.remIntfValid = FALSE; /* remote interface version is valid */ - cfg.t.cfg.s.snDLSAP.remIntfVer = SNTIFVER; /* remote interface version */ -#endif - - return(sng_cfg_mtp3(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp3_nsap_config(int id) -{ - Pst pst; - SnMngmt cfg; - sng_nsap_t *k = &g_ftdm_sngss7_data.cfg.nsap[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SnMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STNSAP; - - cfg.hdr.elmId.elmntInst1 = k->spId; - - cfg.t.cfg.s.snNSAP.ssf = k->ssf; /* sub service field */ - cfg.t.cfg.s.snNSAP.lnkType = k->linkType; /* link type -ANSI, ITU, CHINA or BICI */ - cfg.t.cfg.s.snNSAP.upSwtch = k->switchType; /* user part switch type */ - cfg.t.cfg.s.snNSAP.selector = 0; /* upper layer selector */ - cfg.t.cfg.s.snNSAP.mem.region = S_REG; /* memory region id */ - cfg.t.cfg.s.snNSAP.mem.pool = S_POOL; /* memory pool id */ - cfg.t.cfg.s.snNSAP.prior = PRIOR0; /* priority */ - cfg.t.cfg.s.snNSAP.route = RTESPEC; /* route */ -#if( SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA ) - cfg.t.cfg.s.snNSAP.dpcLen = DPC24; /* dpc length 14 or 24 bits */ -#else - cfg.t.cfg.s.snNSAP.dpcLen = DPC14; /* dpc length 14 or 24 bits */ -#endif -#if (defined(SN_SG) || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snNSAP.usrParts = ; /* user parts configured on self postatic int code on IP side */ -#endif -#ifdef TDS_ROLL_UPGRADE_SUPPORT - cfg.t.cfg.s.snNSAP.remIntfValid = FALSE; /* remote interface version is valid */ - cfg.t.cfg.s.snNSAP.remIntfVer = SNTIFVER; /* remote interface version */ -#endif - - return(sng_cfg_mtp3(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp3_linkset_config(int id) -{ - Pst pst; - SnMngmt cfg; - int c; - sng_link_set_t *k = &g_ftdm_sngss7_data.cfg.mtpLinkSet[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SnMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STLNKSET; /* link set */ - - cfg.hdr.elmId.elmntInst1 = k->id; - - cfg.t.cfg.s.snLnkSet.lnkSetId = k->id; /* link set ID */ - cfg.t.cfg.s.snLnkSet.lnkSetType = k->linkType; /* link type */ - cfg.t.cfg.s.snLnkSet.adjDpc = k->apc; /* adjacent DPC */ - cfg.t.cfg.s.snLnkSet.nmbActLnkReqd = k->minActive; /* minimum number of active links */ - cfg.t.cfg.s.snLnkSet.nmbCmbLnkSet = k->numLinks; /* number of combined link sets */ - for(c = 0; c < k->numLinks;c++) { - cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].cmbLnkSetId = k->links[c]; - cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].lnkSetPrior = 0; - } - - - return(sng_cfg_mtp3(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp3_route_config(int id) -{ - Pst pst; - SnMngmt cfg; - sng_route_t *k = &g_ftdm_sngss7_data.cfg.mtpRoute[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SnMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STROUT; - - cfg.hdr.elmId.elmntInst1 = k->id; - - cfg.t.cfg.s.snRout.dpc = k->dpc; /* destination postatic int code */ - cfg.t.cfg.s.snRout.spType = LSN_TYPE_SP; /* signalling postatic int type */ - cfg.t.cfg.s.snRout.swtchType = k->linkType; /* switch type */ - cfg.t.cfg.s.snRout.upSwtch = k->switchType; /* user part switch type */ - cfg.t.cfg.s.snRout.cmbLnkSetId = k->cmbLinkSetId; /* combined link set ID */ - if (k->dir == SNG_RTE_UP) { - cfg.t.cfg.s.snRout.dir = LSN_RTE_UP; /* direction */ - } else { - cfg.t.cfg.s.snRout.dir = LSN_RTE_DN; /* direction */ - } - cfg.t.cfg.s.snRout.rteToAdjSp = 0; /* flag indicating this route to adjacent SP */ - cfg.t.cfg.s.snRout.ssf = k->ssf; /* sub service field */ - cfg.t.cfg.s.snRout.brdcastFlg = TRUE; /* flag indicating to have TFP broadcast */ - if (cfg.t.cfg.s.snRout.swtchType == LSN_SW_ITU) { - cfg.t.cfg.s.snRout.rstReq = LSN_ITU92_RST; /* Restart type supported by the node */ - } else if ((cfg.t.cfg.s.snRout.swtchType == LSN_SW_ANS) || - (cfg.t.cfg.s.snRout.swtchType == LSN_SW_ANS96)) { - cfg.t.cfg.s.snRout.rstReq = LSN_ANS_RST; /* Restart type supported by the node */ - } else { - cfg.t.cfg.s.snRout.rstReq = LSN_NO_RST; /* Restart type supported by the node */ - } - if ((cfg.t.cfg.s.snRout.swtchType == LSN_SW_ITU) || - (cfg.t.cfg.s.snRout.swtchType == LSN_SW_CHINA) || - (cfg.t.cfg.s.snRout.swtchType == LSN_SW_BICI)) { - cfg.t.cfg.s.snRout.slsRange = LSN_ITU_SLS_RANGE; /* max value of SLS for this DPC */ - } else { - cfg.t.cfg.s.snRout.slsRange = LSN_ANSI_5BIT_SLS_RANGE; /* max value of SLS for this DPC */ - } - cfg.t.cfg.s.snRout.lsetSel = 0x1; /* linkset selection bit in SLS for STP */ - cfg.t.cfg.s.snRout.multiMsgPrior = TRUE; /* TRUE if multiple cong priorities of messages */ - cfg.t.cfg.s.snRout.rctReq = TRUE; /* route set congestion test required or not */ - cfg.t.cfg.s.snRout.slsLnk = FALSE; -#ifdef LSNV2 -# if (SS7_NTT || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snRout.destSpec =; /* destination specfication A or B*/ -# endif -#endif -#if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART)) - cfg.t.cfg.s.snRout.tfrReq =; /* TFR procedure required or not */ -#endif - cfg.t.cfg.s.snRout.tmr.t6.enb = TRUE; - cfg.t.cfg.s.snRout.tmr.t6.val = k->t6; - cfg.t.cfg.s.snRout.tmr.t8.enb = TRUE; /* t8 - transfer prohibited inhibition timer */ - cfg.t.cfg.s.snRout.tmr.t8.val = k->t8; - cfg.t.cfg.s.snRout.tmr.t10.enb = TRUE; /* t10 - waiting to repeat route set test */ - cfg.t.cfg.s.snRout.tmr.t10.val = k->t10; - cfg.t.cfg.s.snRout.tmr.t11.enb = TRUE; /* t11 - transfer restrict timer */ - cfg.t.cfg.s.snRout.tmr.t11.val = k->t11; - cfg.t.cfg.s.snRout.tmr.t19.enb = TRUE; /* t19 - TRA sent timer */ - cfg.t.cfg.s.snRout.tmr.t19.val = k->t19; - cfg.t.cfg.s.snRout.tmr.t21.enb = TRUE; /* t21 - waiting to restart traffic routed through adjacent SP */ - cfg.t.cfg.s.snRout.tmr.t21.val = k->t21; - -#if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART)) - cfg.t.cfg.s.snRout.tmr.t15.enb = TRUE; /* t15 - waiting to start route set congestion test */ - cfg.t.cfg.s.snRout.tmr.t15.val = k->t15; - cfg.t.cfg.s.snRout.tmr.t16.enb = TRUE; /* t16 - waiting for route set congestion status update */ - cfg.t.cfg.s.snRout.tmr.t16.val = k->t16; - cfg.t.cfg.s.snRout.tmr.t18.enb = TRUE; /* t18 - transfer prohibited inhibition timer */ - cfg.t.cfg.s.snRout.tmr.t18.val = k->t18; -# if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snRout.tmr.t25.enb = TRUE; /* t25 - waiting to traffic resatrt allowed message for ANSI */ - cfg.t.cfg.s.snRout.tmr.t25.val = k->t25; - cfg.t.cfg.s.snRout.tmr.t26.enb = TRUE; /* t26 - waiting to repeat traffic restart waiting message for ANSI */ - cfg.t.cfg.s.snRout.tmr.t26.val = k->t26; -# endif -#endif -#if (SS7_TTC || SS7_NTT || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snRout.tmr.tc.enb = TRUE; /* tc - Waiting for congestion abatement */ - cfg.t.cfg.s.snRout.tmr.tc.val = k->tc; -#endif -#if (defined(SN_SG) || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snRout.tmr.tQry.enb = TRUE; /* Periodic query timer over the NIF */ - cfg.t.cfg.s.snRout.tmr.tQry.val = k->tqry; -#endif - - return(sng_cfg_mtp3(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_isup_nsap_config(int id) -{ - SiMngmt cfg; - Pst pst; - sng_nsap_t *k = &g_ftdm_sngss7_data.cfg.nsap[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SiMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSI; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STNSAP; - - cfg.hdr.elmId.elmntInst1 = k->id; - -#if (SI_LMINT3 || SMSI_LMINT3) - cfg.t.cfg.s.siNSap.nsapId = k->id; /* Id of the NSAP being configured */ -#endif - cfg.t.cfg.s.siNSap.nwId = k->nwId; /* Network Id */ - cfg.t.cfg.s.siNSap.spId = k->spId; /* service providor id */ - cfg.t.cfg.s.siNSap.ssf = k->ssf; /* sub service field */ - cfg.t.cfg.s.siNSap.dstEnt = ENTSN; /* entity */ - cfg.t.cfg.s.siNSap.dstInst = S_INST; /* instance */ - cfg.t.cfg.s.siNSap.prior = PRIOR0; /* priority */ - cfg.t.cfg.s.siNSap.route = RTESPEC; /* route */ - cfg.t.cfg.s.siNSap.dstProcId = SFndProcId(); /* destination processor id */ - cfg.t.cfg.s.siNSap.sapType = SAP_MTP; /* sap type */ - cfg.t.cfg.s.siNSap.selector = 0; /* selector */ - cfg.t.cfg.s.siNSap.tINT.enb = TRUE; /* interface (Bind Confirm) timer */ - cfg.t.cfg.s.siNSap.tINT.val = 50; - cfg.t.cfg.s.siNSap.mem.region = S_REG; /* memory region & pool id */ - cfg.t.cfg.s.siNSap.mem.pool = S_POOL; - -#ifdef TDS_ROLL_UPGRADE_SUPPORT - cfg.t.cfg.s.siNSap.remIntfValid = FALSE; /* remote interface version is valid */ - cfg.t.cfg.s.siNSap.remIntfVer; /* remote interface version */ -#endif - - return(sng_cfg_isup(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_isup_intf_config(int id) -{ - SiMngmt cfg; - Pst pst; - sng_isup_inf_t *k = &g_ftdm_sngss7_data.cfg.isupIntf[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SiMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSI; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = SI_STINTF; - - cfg.hdr.elmId.elmntInst1 = k->id; - - cfg.t.cfg.s.siIntfCb.intfId = k->id; /* Interface id */ - cfg.t.cfg.s.siIntfCb.nwId = k->nwId; /* Network Id */ - cfg.t.cfg.s.siIntfCb.sapId = k->isap; /* Id of the Upper ISUP SAP */ - cfg.t.cfg.s.siIntfCb.opc = k->spc; /* physical originating postatic int code */ - cfg.t.cfg.s.siIntfCb.phyDpc = k->dpc; /* physical destination postatic int code */ - cfg.t.cfg.s.siIntfCb.swtch = k->switchType; /* Protocol Switch */ - cfg.t.cfg.s.siIntfCb.ssf = k->ssf; /* subsystem service information */ - cfg.t.cfg.s.siIntfCb.pauseActn = SI_PAUSE_CLRTRAN; /* call clearing behavior upon rx. PAUSE */ - cfg.t.cfg.s.siIntfCb.dpcCbTmr.t4.enb = TRUE; /* t4 timer - user part test sent */ - cfg.t.cfg.s.siIntfCb.dpcCbTmr.t4.val = k->t4; - cfg.t.cfg.s.siIntfCb.dpcCbTmr.tPAUSE.enb = TRUE; /* waiting for PAUSE to be effective */ - cfg.t.cfg.s.siIntfCb.dpcCbTmr.tPAUSE.val = k->tpause; - cfg.t.cfg.s.siIntfCb.dpcCbTmr.tSTAENQ.enb = TRUE; /* status enquiry timer */ - cfg.t.cfg.s.siIntfCb.dpcCbTmr.tSTAENQ.val = k->tstaenq; -#if SS7_ANS95 - cfg.t.cfg.s.siIntfCb.availTest = FALSE; /* circuit validation test */ -#endif -#if (SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_ITU2000 || SS7_KZ) - cfg.t.cfg.s.siIntfCb.checkTable = LSI_CHKTBLE_MRATE; /* Validation flag for Table 3 p1/p2 Q.763 */ -#endif -#if (SS7_ANS95 || SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_ITU2000 || SS7_KZ) - switch (k->switchType) { - case LSI_SW_TST: - case LSI_SW_ITU: - case LSI_SW_ITU97: - case LSI_SW_ITU2000: - case LSI_SW_ETSI: - case LSI_SW_ETSIV3: - case LSI_SW_RUSSIA: - case LSI_SW_RUSS2000: - case LSI_SW_INDIA: - case LSI_SW_CHINA: - cfg.t.cfg.s.siIntfCb.trunkType = TRUE; /* truck type E1(TRUE)/T1(FALSE) at intf */ - break; - case LSI_SW_ANS88: - case LSI_SW_ANS92: - case LSI_SW_ANS95: - case LSI_SW_BELL: - cfg.t.cfg.s.siIntfCb.trunkType = FALSE; /* truck type E1(TRUE)/T1(FALSE) at intf */ - break; - } - -#endif -#if (LSIV4 || LSIV5) - cfg.t.cfg.s.siIntfCb.lnkSelOpt = LSI_LINSEK_CIC; /* link select option */ -# if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) - cfg.t.cfg.s.siIntfCb.lnkSelBits = LSI_LNKSEL_8BITS; /* number of bits for link selection */ -# endif -#endif - - return(sng_cfg_isup(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_isup_ckt_config(int id) -{ - SiMngmt cfg; - Pst pst; - U32 tmp_flag; - sng_isup_ckt_t *k = &g_ftdm_sngss7_data.cfg.isupCkt[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /* check the for the correct ProcId and make sure it goes to the right system */ - if (g_ftdm_sngss7_data.cfg.procId != 1) { - pst.dstProcId = 1; - } - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SiMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSI; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STICIR; - - cfg.hdr.elmId.elmntInst1 = k->id; - - cfg.t.cfg.s.siCir.cirId = k->id; /* circuit id code */ - cfg.t.cfg.s.siCir.cic = k->cic; /* cic */ - cfg.t.cfg.s.siCir.intfId = k->infId; /* interface id */ - cfg.t.cfg.s.siCir.typeCntrl = k->typeCntrl; /* type of control */ - cfg.t.cfg.s.siCir.contReq = FALSE; /* continuity check required */ -#if (SI_218_COMP || SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) - cfg.t.cfg.s.siCir.firstCic = 1; /* First cic in the circuit group */ - cfg.t.cfg.s.siCir.numCir = 24; /* Number of circuits in the circuit group */ - cfg.t.cfg.s.siCir.nonSS7Con = TRUE; /* connecting to non SS7 network */ - cfg.t.cfg.s.siCir.outTrkGrpN.length = 0; /* outgoing trunk group number (For EXM) */ - cfg.t.cfg.s.siCir.cvrTrkClli.length = 0; /* Trunk Group number (For CVR validation) */ - cfg.t.cfg.s.siCir.clli.length = 0; /* common language location identifier */ -#endif - cfg.t.cfg.s.siCir.cirTmr.t3.enb = TRUE; /* t3 timer - overload received */ - cfg.t.cfg.s.siCir.cirTmr.t3.val = k->t3; - cfg.t.cfg.s.siCir.cirTmr.t12.enb = TRUE; /* t12 timer - blocking sent */ - cfg.t.cfg.s.siCir.cirTmr.t12.val = k->t12; - cfg.t.cfg.s.siCir.cirTmr.t13.enb = TRUE; /* t13 timer - initial blocking sent */ - cfg.t.cfg.s.siCir.cirTmr.t13.val = k->t13; - cfg.t.cfg.s.siCir.cirTmr.t14.enb = TRUE; /* t14 timer - unblocking sent */ - cfg.t.cfg.s.siCir.cirTmr.t14.val = k->t14; - cfg.t.cfg.s.siCir.cirTmr.t15.enb = TRUE; /* t15 timer - initial unblocking sent */ - cfg.t.cfg.s.siCir.cirTmr.t15.val = k->t15; - cfg.t.cfg.s.siCir.cirTmr.t16.enb = TRUE; /* t16 timer - reset sent */ - cfg.t.cfg.s.siCir.cirTmr.t16.val = k->t16; - cfg.t.cfg.s.siCir.cirTmr.t17.enb = TRUE; /* t17 timer - initial reset sent */ - cfg.t.cfg.s.siCir.cirTmr.t17.val = k->t17; -#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) - cfg.t.cfg.s.siCir.cirTmr.tVal.enb = TRUE; /* circuit validation timer */ - cfg.t.cfg.s.siCir.cirTmr.tVal.val = k->tval; -#endif -#if (SS7_ANS95 || SS7_ITU97 || SS7_ETSIV3 || SS7_UK) - tmp_flag = 0x0; - /* bit 0 - 4 is the timeslot on the span for this circuit */ - tmp_flag = ( 1 ); - - /* bit 5 -> can this timeslot be used for contigous M-rate call */ - tmp_flag |= !(0x20); - - /* bit 6 -> does this timeslot support contigous M-rate call */ - tmp_flag |= !(0x40); - - cfg.t.cfg.s.siCir.slotId = tmp_flag ; /* physical slot id bit wise flag */ - cfg.t.cfg.s.siCir.ctrlMult = 0; /* Controller for multirate calls */ -#endif - - tmp_flag = 0x0; - /* bit 0 -> ANSI international support or national support */ - tmp_flag = k->ssf; - - /* bit 1 -> confusion message on */ - tmp_flag |= LSI_CIRFLG_CFN_ON; - - /*bit 2-3 -> circuit group carrier information */ - tmp_flag |= LSI_CFCI_ANALDIG; - - /*bit 4-5 -> alarm carrier */ - tmp_flag |= LSI_CFAC_UNKNOWN; - - /*bit 6-7 -> continuity check requirement*/ - tmp_flag |= LSI_CFCO_NONE; - - cfg.t.cfg.s.siCir.cirFlg = tmp_flag; /* Flag indicating diff cfg options for ckt */ - - return(sng_cfg_isup(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_isup_isap_config(int id) -{ - SiMngmt cfg; - Pst pst; - sng_isap_t *k = &g_ftdm_sngss7_data.cfg.isap[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(SiMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSI; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STISAP; - - cfg.hdr.elmId.elmntInst1 = k->id; - -#if (SI_LMINT3 || SMSI_LMINT3) - cfg.t.cfg.s.siSap.sapId = k->id; /* Id of the SAP being configured */ -#endif - cfg.t.cfg.s.siSap.swtch = k->switchType; /* Protocol Switch */ - cfg.t.cfg.s.siSap.ssf = k->ssf; /* Sub service field */ - cfg.t.cfg.s.siSap.sidIns = FALSE; /* SID insertion Flag */ - cfg.t.cfg.s.siSap.sidVer = FALSE; /* SID verification Flag */ - if ( cfg.t.cfg.s.siSap.sidIns == TRUE ) { /* SID */ - #if 0 - cfg.t.cfg.s.siSap.sid =; - cfg.t.cfg.s.siSap.natAddrInd =; /* SID Nature of Addres Indicator */ - cfg.t.cfg.s.siSap.sidNPlan =; /* SID Numbering Plan */ - cfg.t.cfg.s.siSap.sidPresInd =; /* default presentation indicator */ - cfg.t.cfg.s.siSap.incSidPresRes =; /* Presentation Restriction of incoming SID */ - cfg.t.cfg.s.siSap.sidPresRes =; /* Presentation Restriction */ - #endif - } else { - cfg.t.cfg.s.siSap.sid.length = 0; - /*cfg.t.cfg.s.siSap.sid.strg[0] =*/ - cfg.t.cfg.s.siSap.natAddrInd = ADDR_NOTPRSNT; /* SID Nature of Addres Indicator */ - cfg.t.cfg.s.siSap.sidNPlan = NP_ISDN; /* SID Numbering Plan */ - cfg.t.cfg.s.siSap.sidPresInd = FALSE; /* default presentation indicator */ - cfg.t.cfg.s.siSap.incSidPresRes = FALSE; /* Presentation Restriction of incoming SID */ - cfg.t.cfg.s.siSap.sidPresRes = 0; /* Presentation Restriction */ - } - cfg.t.cfg.s.siSap.reqOpt = FALSE; /* Request option */ - cfg.t.cfg.s.siSap.allCallMod = TRUE; /* call modification allowed flag */ - cfg.t.cfg.s.siSap.maxLenU2U = MAX_SI_USER_2_USER_LEN; /* Max length of user to user messages */ - cfg.t.cfg.s.siSap.passOnFlag = TRUE; /* flag for passing unknown par/msg */ - cfg.t.cfg.s.siSap.relLocation = ILOC_PRIVNETLU; /* release location indicator in cause val */ - cfg.t.cfg.s.siSap.prior = PRIOR0; /* priority */ - cfg.t.cfg.s.siSap.route = RTESPEC; /* route */ - cfg.t.cfg.s.siSap.selector = 0; /* selector */ - cfg.t.cfg.s.siSap.mem.region = S_REG; /* memory region & pool id */ - cfg.t.cfg.s.siSap.mem.pool = S_POOL; /* memory region & pool id */ - - cfg.t.cfg.s.siSap.tmr.t1.enb = TRUE; /* t1 timer - release sent */ - cfg.t.cfg.s.siSap.tmr.t1.val = k->t1; - cfg.t.cfg.s.siSap.tmr.t2.enb = TRUE; /* t2 timer - suspend received */ - cfg.t.cfg.s.siSap.tmr.t2.val = k->t2; - cfg.t.cfg.s.siSap.tmr.t5.enb = TRUE; /* t5 timer - initial release sent */ - cfg.t.cfg.s.siSap.tmr.t5.val = k->t5; - cfg.t.cfg.s.siSap.tmr.t6.enb = TRUE; /* t6 timer - suspend received */ - cfg.t.cfg.s.siSap.tmr.t6.val = k->t6; - cfg.t.cfg.s.siSap.tmr.t7.enb = TRUE; /* t7 timer - latest address sent */ - cfg.t.cfg.s.siSap.tmr.t7.val = k->t7; - cfg.t.cfg.s.siSap.tmr.t8.enb = TRUE; /* t8 timer - initial address received */ - cfg.t.cfg.s.siSap.tmr.t8.val = k->t8; - cfg.t.cfg.s.siSap.tmr.t9.enb = TRUE; /* t9 timer - latest address sent after ACM */ - cfg.t.cfg.s.siSap.tmr.t9.val = k->t9; - cfg.t.cfg.s.siSap.tmr.t27.enb = TRUE; /* t27 timer - wait. for continuity recheck */ - cfg.t.cfg.s.siSap.tmr.t27.val = k->t27; - cfg.t.cfg.s.siSap.tmr.t31.enb = TRUE; /* t31 timer - call reference frozen period */ - cfg.t.cfg.s.siSap.tmr.t31.val = k->t31; - cfg.t.cfg.s.siSap.tmr.t33.enb = TRUE; /* t33 timer - INR sent */ - cfg.t.cfg.s.siSap.tmr.t33.val = k->t33; - cfg.t.cfg.s.siSap.tmr.t34.enb = TRUE; /* t34 timer - wait. for continuity after recheck */ - cfg.t.cfg.s.siSap.tmr.t34.val = k->t34; - cfg.t.cfg.s.siSap.tmr.t36.enb = TRUE; /* waiting SGM */ - cfg.t.cfg.s.siSap.tmr.t36.val = k->t36; - cfg.t.cfg.s.siSap.tmr.tCCR.enb = TRUE; /* tCCR timer - continuity recheck timer */ - cfg.t.cfg.s.siSap.tmr.tCCR.val = k->tccr; - cfg.t.cfg.s.siSap.tmr.tRELRSP.enb = TRUE; /* waiting for release response */ - cfg.t.cfg.s.siSap.tmr.tRELRSP.val = k->trelrsp; - cfg.t.cfg.s.siSap.tmr.tFNLRELRSP.enb = TRUE; /* waiting for final release response */ - cfg.t.cfg.s.siSap.tmr.tFNLRELRSP.val = k->tfnlrelrsp; -#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) - cfg.t.cfg.s.siSap.tmr.tEx.enb = TRUE; /* tEx timer - Exit to be sent */ - cfg.t.cfg.s.siSap.tmr.tEx.val = k->tex; - cfg.t.cfg.s.siSap.tmr.tCCRt.enb = TRUE; /* tCCR timer (o/g side) - continuity recheck timer */ - cfg.t.cfg.s.siSap.tmr.tCCRt.val = k->tccrt; -#endif -#if (SS7_ANS92 || SS7_ANS95 || SS7_BELL) - cfg.t.cfg.s.siSap.tmr.tCRM.enb = TRUE; /* circuit reservation message timer */ - cfg.t.cfg.s.siSap.tmr.tCRM.val = k->tcrm; - cfg.t.cfg.s.siSap.tmr.tCRA.enb = TRUE; /* circuit reservation ack. timer */ - cfg.t.cfg.s.siSap.tmr.tCRA.val = k->tcra; -#endif -#if (SS7_ETSI || SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_KZ) - cfg.t.cfg.s.siSap.tmr.tECT.enb = TRUE; /* Explicit Call Transfer - waiting for loop prvnt rsp */ - cfg.t.cfg.s.siSap.tmr.tECT.val = k->tect; -#endif - -#ifdef TDS_ROLL_UPGRADE_SUPPORT - cfg.t.cfg.s.siSap.remIntfValid = FALSE; /* remote interface version is valid */ - cfg.t.cfg.s.siSap.remIntfVer =; /* remote interface version */ -#endif - - return(sng_cfg_isup(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_cc_isap_config(int dstProcId) -{ - CcMngmt cfg; - Pst pst; - - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTCC; - - /*clear the configuration structure*/ - memset(&cfg, 0x0, sizeof(CcMngmt)); - - /*fill in some general sections of the header*/ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTCC; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STISAP; - - cfg.hdr.elmId.elmntInst1 = 1; - - cfg.t.cfg.s.ccISAP.suId = 1; - cfg.t.cfg.s.ccISAP.spId = 1; - cfg.t.cfg.s.ccISAP.pst.dstProcId = dstProcId; - cfg.t.cfg.s.ccISAP.pst.dstEnt = ENTSI; - cfg.t.cfg.s.ccISAP.pst.dstInst = S_INST; - cfg.t.cfg.s.ccISAP.pst.srcProcId = SFndProcId(); - cfg.t.cfg.s.ccISAP.pst.srcEnt = ENTCC; - cfg.t.cfg.s.ccISAP.pst.srcInst = S_INST; - cfg.t.cfg.s.ccISAP.pst.prior = PRIOR0; - cfg.t.cfg.s.ccISAP.pst.route = RTESPEC; - cfg.t.cfg.s.ccISAP.pst.region = S_REG; - cfg.t.cfg.s.ccISAP.pst.pool = S_POOL; - cfg.t.cfg.s.ccISAP.pst.selector = 0; - - return(sng_cfg_cc(&pst, &cfg)); -} - -/******************************************************************************/ -int ftmod_ss7_relay_chan_config(int id) -{ - RyMngmt cfg; /*configuration structure*/ - Pst pst; /*post structure*/ - sng_relay_t *k = &g_ftdm_sngss7_data.cfg.relay[id]; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTRY; - - /* clear the configuration structure */ - memset(&cfg, 0x0, sizeof(RyMngmt)); - - /* fill in some general sections of the header */ - smHdrInit(&cfg.hdr); - - /*fill in the specific fields of the header */ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTRY; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STCHCFG; - - cfg.hdr.elmId.elmntInst1 = k->id; - - cfg.t.cfg.s.ryChanCfg.id = k->id; /* channel id */ - cfg.t.cfg.s.ryChanCfg.type = k->type; /* channel type */ -/* cfg.t.cfg.s.ryChanCfg.msInd =;*/ /* master/slave indicator */ - if (k->type == LRY_CT_TCP_LISTEN) { - cfg.t.cfg.s.ryChanCfg.low = 0; /* low proc id for channel */ - cfg.t.cfg.s.ryChanCfg.high = 0; /* high proc id for channel */ - } else { - cfg.t.cfg.s.ryChanCfg.low = k->procId; /* low proc id for channel */ - cfg.t.cfg.s.ryChanCfg.high = k->procId; /* high proc id for channel */ - } - cfg.t.cfg.s.ryChanCfg.nmbScanQ = MAX_RELAY_NMBSCAN; /* number of times to scan the queue */ - cfg.t.cfg.s.ryChanCfg.flags = LRY_FLG_INTR; /* flags */ - cfg.t.cfg.s.ryChanCfg.congThrsh = MAX_RELAY_CONGTHRSH; /* congestion threshold */ - cfg.t.cfg.s.ryChanCfg.dropThrsh = 0; /* drop threshold */ - cfg.t.cfg.s.ryChanCfg.contThrsh = MAX_RELAY_CONGTHRSH + 1; /* continue threshold */ - cfg.t.cfg.s.ryChanCfg.kaTxTmr.enb = 1; /* keep alive transmit timer config */ - cfg.t.cfg.s.ryChanCfg.kaTxTmr.val = RY_TX_KP_ALIVE_TMR; - cfg.t.cfg.s.ryChanCfg.kaRxTmr.enb = 1; /* keep alive receive timer config */ - cfg.t.cfg.s.ryChanCfg.kaRxTmr.val = RY_RX_KP_ALIVE_TMR; - cfg.t.cfg.s.ryChanCfg.btTmr.enb = 1; /* boot timer */ - cfg.t.cfg.s.ryChanCfg.btTmr.val = RY_BT_TMR; - cfg.t.cfg.s.ryChanCfg.region = S_REG; /* Relay region */ - cfg.t.cfg.s.ryChanCfg.pool = S_POOL; /* Relay pool */ -#if (RY_ENBUDPSOCK || RY_ENBTCPSOCK) - cfg.t.cfg.s.ryChanCfg.listenPortNo = k->port; /* Listen Port of Rx Relay Channel*/ - strncpy(cfg.t.cfg.s.ryChanCfg.transmittoHostName, k->hostname, (size_t)RY_REMHOSTNAME_SIZE); - cfg.t.cfg.s.ryChanCfg.transmittoPortNo = k->port; /* TransmitTo PortId for Tx Relay Channel */ - cfg.t.cfg.s.ryChanCfg.targetProcId = k->procId; /* procId of the node present in the other end of this channel */ -# ifdef LRY1 - cfg.t.cfg.s.ryChanCfg.sockParam =; /* Socket Parameters */ -# endif /* LRY1 */ -# ifdef LRYV2 - cfg.t.cfg.s.ryChanCfg.selfHostName[RY_REMHOSTNAME_SIZE]; -# endif /* LRY2 */ -#endif /* RY_ENBUDPSOCK || RY_ENBTCPSOCK */ - - return(sng_cfg_relay(&pst, &cfg)); -} - -/******************************************************************************/ -/* 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c deleted file mode 100644 index 98a2398630..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ /dev/null @@ -1,4007 +0,0 @@ -/* - * Copyright (c) 2009|Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms|with or without - * modification|are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice|this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice|this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT - * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL, - * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * James Zhang - * - */ - -#if 0 -#define SMG_RELAY_DBG -#endif - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); - -static ftdm_status_t handle_print_usage(ftdm_stream_handle_t *stream); - -static ftdm_status_t handle_show_procId(ftdm_stream_handle_t *stream); - -static ftdm_status_t handle_set_function_trace(ftdm_stream_handle_t *stream, int on, int level); -static ftdm_status_t handle_set_message_trace(ftdm_stream_handle_t *stream, int on, int level); -static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *name); - -static ftdm_status_t handle_show_free(ftdm_stream_handle_t *stream, int span, int chan, int verbose); -static ftdm_status_t handle_show_inuse(ftdm_stream_handle_t *stream, int span, int chan, int verbose); -static ftdm_status_t handle_show_inreset(ftdm_stream_handle_t *stream, int span, int chan, int verbose); -static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, int chan, int verbose); -static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span, int chan, int verbose); -static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, int chan, int verbose); - -static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int chan, int verbose); -static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); - -static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int chan, int verbose); -static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int chan, int verbose); - -static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); -static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); - -static ftdm_status_t handle_bind_link(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_unbind_link(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_activate_link(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_deactivate_link(ftdm_stream_handle_t *stream, char *name); - -static ftdm_status_t handle_activate_linkset(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_deactivate_linkset(ftdm_stream_handle_t *stream, char *name); - -static ftdm_status_t handle_tx_lpo(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name); - -static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t handle_status_isup_ckt(ftdm_stream_handle_t *stream, char *id_name); - -static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan); -static ftdm_status_t check_arg_count(int args, int min); - - - -static ftdm_status_t cli_ss7_show_general(ftdm_stream_handle_t *stream); - -static ftdm_status_t cli_ss7_show_mtp2link_by_id(ftdm_stream_handle_t *stream, int rcId); -static ftdm_status_t cli_ss7_show_mtp2link_by_name(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t cli_ss7_show_all_mtp2link(ftdm_stream_handle_t *stream); - -static ftdm_status_t cli_ss7_show_mtp3link_by_id(ftdm_stream_handle_t *stream, int rcId); -static ftdm_status_t cli_ss7_show_mtp3link_by_name(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t cli_ss7_show_all_mtp3link(ftdm_stream_handle_t *stream); - -static ftdm_status_t cli_ss7_show_relay_by_id(ftdm_stream_handle_t *stream, int rcId); -static ftdm_status_t cli_ss7_show_relay_by_name(ftdm_stream_handle_t *stream, char *name); -static ftdm_status_t cli_ss7_show_all_relay(ftdm_stream_handle_t *stream); - -static ftdm_status_t cli_ss7_show_channel_detail_of_span(ftdm_stream_handle_t *stream, char *span_id, char *chan_id); -static ftdm_status_t cli_ss7_show_all_channels_of_span(ftdm_stream_handle_t *stream, char *span_id); - -static ftdm_status_t cli_ss7_show_span_by_id(ftdm_stream_handle_t *stream, char *span_id); -static ftdm_status_t cli_ss7_show_all_spans_general(ftdm_stream_handle_t *stream); -static ftdm_status_t cli_ss7_show_all_spans_detail(ftdm_stream_handle_t *stream); -static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream); -static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char* sctp_profile_name); -static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream); -static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char* m2ua_profile_name); -static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name); -static ftdm_status_t handle_show_m2ua_cluster_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name); -static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream); -static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char* profile_name); -int get_assoc_resp_buf(char* buf,SbMgmt* cfm); - -/******************************************************************************/ -/* FUNCTIONS ******************************************************************/ -ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data) -{ - char *mycmd = NULL; - char *argv[10] = { 0 }; - int argc = 0; - int span = 0; - int chan = 0; - int range = 0; - int trace = 0; - int trace_level = 7; - int verbose = 1; - int c = 0; - - if (data) { - mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, ftdm_array_len(argv)); - } - - if (check_arg_count(argc, 1)) { - goto handle_cli_error_argc; - } - - if (!strcasecmp(argv[c], "show")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) { - cli_ss7_show_general(stream); - return FTDM_SUCCESS; - } - c++; - - if (!strcasecmp(argv[c], "relay")) { - /**********************************************************************/ - c++; - handle_status_relay(stream, argv[c]); - - } else if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - switch (argc) { - case 2: - { - /* > ftdm ss7 show span */ - cli_ss7_show_all_spans_general(stream); - } - break; - - case 3: - { - if (!strcasecmp(argv[2], "all")) { - /* > ftdm ss7 show span all */ - cli_ss7_show_all_spans_detail(stream); - } else { - /* > ftdm ss7 show span 1 */ - cli_ss7_show_span_by_id(stream, argv[2]); - } - } - break; - - case 4: - { - /* > ftdm ss7 show span 1 chan */ - cli_ss7_show_all_channels_of_span(stream, argv[2]); - } - break; - - case 5: - default: - { - if (!strcasecmp(argv[3], "chan")) { - /* > ftdm ss7 show span 1 chan 2 */ - cli_ss7_show_channel_detail_of_span(stream, argv[2], argv[4]); - } else { - /* > ftdm ss7 show span 1 bla bla bla*/ - cli_ss7_show_all_channels_of_span(stream, argv[2]); - } - } - break; - } - } else if (!strcasecmp(argv[c], "status")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) { - cli_ss7_show_general(stream); - return FTDM_SUCCESS; - } - - c++; - - if (!strcasecmp(argv[c], "mtp3")) { - /******************************************************************/ - c++; - handle_status_mtp3link(stream, argv[c]); - /******************************************************************/ - } else if (!strcasecmp(argv[c], "mtp2")) { - /******************************************************************/ - c++; - handle_status_mtp2link(stream, argv[c]); - /******************************************************************/ - } else if (!strcasecmp(argv[c], "linkset")) { - /******************************************************************/ - c++; - handle_status_linkset(stream, argv[c]); - /******************************************************************/ - } else if (!strcasecmp(argv[c], "relay")) { - /******************************************************************/ - c++; - handle_status_relay(stream, argv[c]); - /******************************************************************/ - } else if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_status(stream, span, chan, verbose); - /******************************************************************/ - } else if (!strcasecmp(argv[c], "isup")) { - /******************************************************************/ - if (check_arg_count(argc, 4)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "ckt")) { - /**************************************************************/ - if (check_arg_count(argc, 5)) goto handle_cli_error_argc; - c++; - - handle_status_isup_ckt(stream, argv[c]); - /**************************************************************/ - } else { - /**************************************************************/ - stream->write_function(stream, "Unknown \"status isup\" command\n"); - goto handle_cli_error; - /**************************************************************/ - } - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"status\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "inuse")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_inuse(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"inuse\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "inreset")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_inreset(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"inreset\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "free")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_free(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"free\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "blocks")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_blocks(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"blocks\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "flags")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_flags(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"flags\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "mem")) { - /**********************************************************************/ - sng_isup_reg_info_show(); - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "stats")) { - /**********************************************************************/ -/* sng_mtp1_sts_t sts; - - memset(&sts, 0x0, sizeof(sng_mtp1_sts_t)); - - sng_mtp1_sts(1, &sts); - - stream->write_function(stream,"MTP1 tx stats:|tx_frm=%d|tx_err=%d|tx_fisu=%d|tx_lssu=%d|tx_msu=%d|\n", - sts.tx_frm, sts.tx_err, sts.tx_fisu, sts.tx_lssu, sts.tx_msu); - stream->write_function(stream,"MTP1 rx stats:|rx_frm=%d|rx_err=%d|rx_fisu=%d|rx_lssu=%d|rx_msu=%d|\n", - sts.rx_frm, sts.rx_err, sts.rx_fisu, sts.rx_lssu, sts.rx_msu); -*/ - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "procid")) { - /**********************************************************************/ - handle_show_procId(stream); - - /**********************************************************************/ - } else{ - /**********************************************************************/ - stream->write_function(stream, "Unknown \"show\" command\n"); - goto handle_cli_error; - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "xmlshow")) { - /**************************************************************************/ - - if (check_arg_count(argc, 2)) { - stream->write_function(stream, "Unknown \"xmlshow\" command\n"); - goto handle_cli_error; - } - c++; - /**************************************************************************/ - if (!strcasecmp(argv[c], "m2ua")) { - /**************************************************************************/ - switch(argc) - { - case 2: /* show m2ua */ - { - handle_show_m2ua_profiles(stream); - break; - } - case 3: /* show m2ua */ - { - c++; - handle_show_m2ua_profile(stream, argv[c]); - break; - } - case 4: - { - char* profile_name = argv[++c]; - c++; - /***************************************************************/ - if(!strcasecmp(argv[c],"peerstatus")){ - /***************************************************************/ - handle_show_m2ua_peer_status(stream, profile_name); - /***************************************************************/ - }else if(!strcasecmp(argv[c],"clusterstatus")){ - /***************************************************************/ - handle_show_m2ua_cluster_status(stream, profile_name); - /***************************************************************/ - } else{ - /***************************************************************/ - stream->write_function(stream, "Unknown \"show m2ua \" command..\n"); - goto handle_cli_error_argc; - } - break; - } - default: - goto handle_cli_error_argc; - } - - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "nif")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)){ - handle_show_nif_profiles(stream); - }else{ - c++; - handle_show_nif_profile(stream, argv[c]); - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "sctp")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)){ - handle_show_sctp_profiles(stream); - }else{ - c++; - handle_show_sctp_profile(stream, argv[c]); - } - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"xmlshow\" command\n"); - goto handle_cli_error; - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "set")) { - /**************************************************************************/ - if (check_arg_count(argc, 4)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "ftrace")) { - /**********************************************************************/ - c++; - trace = atoi(argv[c]); - c++; - trace_level = atoi(argv[c]); - c++; - handle_set_function_trace(stream, trace, trace_level); - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "mtrace")) { - /**********************************************************************/ - c++; - trace = atoi(argv[c]); - c++; - trace_level = atoi(argv[c]); - c++; - handle_set_message_trace(stream, trace, trace_level); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"set\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "inhibit")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "link")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_set_inhibit(stream, argv[c]); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"block\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "uninhibit")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "link")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_set_uninhibit(stream, argv[c]); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"unblock\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "blo")) { - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - if (check_arg_count(argc, 5)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_tx_blo(stream, span, chan, verbose); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"block\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "ubl")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - if (check_arg_count(argc, 5)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_tx_ubl(stream, span, chan, verbose); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"ubl\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "cgb")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - if (check_arg_count(argc, 5)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - c = c + 4; - - if (check_arg_count(argc, 7)) goto handle_cli_error_argc; - - if (!strcasecmp(argv[c], "range")) { - /******************************************************************/ - c++; - range = atoi(argv[c]); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"cgb range\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - - handle_tx_cgb(stream, span, chan, range, verbose); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"cgb\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "cgu")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - if (check_arg_count(argc, 5)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - c = c + 4; - - if (check_arg_count(argc, 7)) goto handle_cli_error_argc; - - if (!strcasecmp(argv[c], "range")) { - /******************************************************************/ - c++; - range = atoi(argv[c]); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"cgu range\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - - handle_tx_cgu(stream, span, chan, range, verbose); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"cgu\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "rsc")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - if (check_arg_count(argc, 5)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_tx_rsc(stream, span, chan, verbose); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"rsc\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "grs")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - if (check_arg_count(argc, 5)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - c = c + 4; - - if (check_arg_count(argc, 7)) goto handle_cli_error_argc; - - if (!strcasecmp(argv[c], "range")) { - /******************************************************************/ - c++; - range = atoi(argv[c]); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"grs range\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - - handle_tx_grs(stream, span, chan, range, verbose); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"grs\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "lpo")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "link")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_tx_lpo(stream, argv[c]); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"lpo\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "lpr")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "link")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_tx_lpr(stream, argv[c]); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"lpr\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "bind")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "link")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_bind_link(stream, argv[c]); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"bind\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "unbind")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "link")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_unbind_link(stream, argv[c]); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"bind\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "activate")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "link")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_activate_link(stream, argv[c]); - /**********************************************************************/ - }else if (!strcasecmp(argv[c], "linkset")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_activate_linkset(stream, argv[c]); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"activate\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "deactivate")) { - /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "link")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_deactivate_link(stream, argv[c]); - /**********************************************************************/ - }else if (!strcasecmp(argv[c], "linkset")) { - /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_deactivate_linkset(stream, argv[c]); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"deactivate\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "m2ua")) { - /**************************************************************************/ - if (check_arg_count(argc, 3)) { - stream->write_function(stream, "Invalid \"m2ua option\", please use \"m2ua logging [enable|disable] \n"); - goto handle_cli_error_argc; - } - c++; - if(!strcasecmp(argv[c],"logging")){ - c++; - if(!strcasecmp(argv[c],"enable")){ - ftmod_ss7_enable_m2ua_sg_logging(); - }else if(!strcasecmp(argv[c],"disable")){ - ftmod_ss7_disable_m2ua_sg_logging(); - } else{ - stream->write_function(stream, "Unknown \"m2ua logging %s option\", supported values enable/disable\n",argv[c]); - goto handle_cli_error_argc; - } - }else{ - stream->write_function(stream, "Unknown \"m2ua %s option\", supported values \"logging\"\n",argv[c]); - goto handle_cli_error_argc; - } - /**************************************************************************/ - } else { - /**************************************************************************/ - goto handle_cli_error; - /**************************************************************************/ - } - - return FTDM_SUCCESS; - -handle_cli_error_argc: - stream->write_function(stream, "Invalid # of arguments in command\n"); - handle_print_usage(stream); - return FTDM_SUCCESS; - -handle_cli_error_span_chan: - stream->write_function(stream, "Unknown \"span\\chan\" command\n"); - handle_print_usage(stream); - return FTDM_SUCCESS; - -handle_cli_error: - stream->write_function(stream, "Unknown command requested\n"); - handle_print_usage(stream); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_print_usage(ftdm_stream_handle_t *stream) -{ - stream->write_function(stream, "Sangoma SS7 CLI usage:\n\n"); - - stream->write_function(stream, "ftmod_sangoma_ss7 general control:\n"); - stream->write_function(stream, "ftdm ss7 set ftrace X Y\n"); - stream->write_function(stream, "ftdm ss7 set mtrace X Y\n"); - stream->write_function(stream, "\n"); - - stream->write_function(stream, "ftmod_sangoma_ss7 signaling information:\n"); - stream->write_function(stream, "ftdm ss7 show \n"); - stream->write_function(stream, "ftdm ss7 show status mtp2 X\n"); - stream->write_function(stream, "ftdm ss7 show status mtp3 X\n"); - stream->write_function(stream, "ftdm ss7 show status linkset X\n"); - stream->write_function(stream, "\n"); - - stream->write_function(stream, "ftmod_sangoma_ss7 circuit information:\n"); - stream->write_function(stream, "ftdm ss7 show span all\n"); - stream->write_function(stream, "ftdm ss7 show span X\n"); - stream->write_function(stream, "ftdm ss7 show status span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 show free span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 show blocks span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 show inuse span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 show inreset span X chan Y\n"); - stream->write_function(stream, "\n"); - - stream->write_function(stream, "ftmod_sangoma_ss7 circuit control:\n"); - stream->write_function(stream, "ftdm ss7 blo span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 ubl span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 rsc span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 grs span X chan Y range Z\n"); - stream->write_function(stream, "ftdm ss7 cgb span X chan Y range Z\n"); - stream->write_function(stream, "ftdm ss7 cgu span X chan Y range Z\n"); - stream->write_function(stream, "\n"); - - stream->write_function(stream, "ftmod_sangoma_ss7 link control:\n"); - /* - stream->write_function(stream, "ftdm ss7 inhibit link X\n"); - stream->write_function(stream, "ftdm ss7 uninhibit link X\n"); - */ - stream->write_function(stream, "ftdm ss7 activate link X\n"); - stream->write_function(stream, "ftdm ss7 deactivate link X\n"); - stream->write_function(stream, "ftdm ss7 activate linkset X\n"); - stream->write_function(stream, "ftdm ss7 deactivate linkset X\n"); - stream->write_function(stream, "ftdm ss7 lpo link X\n"); - stream->write_function(stream, "ftdm ss7 lpr link X\n"); - stream->write_function(stream, "\n"); - - - stream->write_function(stream, "ftmod_sangoma_ss7 Relay status:\n"); - stream->write_function(stream, "ftdm ss7 show status relay X\n"); - stream->write_function(stream, "ftdm ss7 show relay X\n"); - stream->write_function(stream, "ftdm ss7 show relay\n"); - stream->write_function(stream, "\n"); - - stream->write_function(stream, "ftmod_sangoma_ss7 M2UA :\n"); - stream->write_function(stream, "ftdm ss7 xmlshow sctp \n"); - stream->write_function(stream, "ftdm ss7 xmlshow sctp \n"); - stream->write_function(stream, "ftdm ss7 xmlshow m2ua \n"); - stream->write_function(stream, "ftdm ss7 xmlshow m2ua \n"); - stream->write_function(stream, "ftdm ss7 xmlshow m2ua peerstatus\n"); - stream->write_function(stream, "ftdm ss7 xmlshow m2ua clusterstatus\n"); - stream->write_function(stream, "ftdm ss7 xmlshow nif \n"); - stream->write_function(stream, "ftdm ss7 xmlshow nif \n"); - stream->write_function(stream, "\n"); - - - stream->write_function(stream, "ftmod_sangoma_ss7 M2UA logging:\n"); - stream->write_function(stream, "ftdm ss7 m2ua logging [enable|disable] \n"); - - stream->write_function(stream, "\n"); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_show_procId(ftdm_stream_handle_t *stream) -{ - int procId = sng_get_procId(); - - stream->write_function(stream, "Local ProcId = %d\n", procId); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_set_function_trace(ftdm_stream_handle_t *stream, int on, int level) -{ - stream->write_function(stream, "ftmod_sangoma_ss7 Function Trace was %s, level = %d\n", - (g_ftdm_sngss7_data.function_trace == 1) ? "ON" : "OFF", - g_ftdm_sngss7_data.function_trace_level); - - g_ftdm_sngss7_data.function_trace = on; - g_ftdm_sngss7_data.function_trace_level = level; - - stream->write_function(stream, "ftmod_sangoma_ss7 Function Trace now is %s, level = %d\n", - (g_ftdm_sngss7_data.function_trace == 1) ? "ON" : "OFF", - g_ftdm_sngss7_data.function_trace_level); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_set_message_trace(ftdm_stream_handle_t *stream, int on, int level) -{ - stream->write_function(stream, "ftmod_sangoma_ss7 Message Trace was %s, level = %d\n", - (g_ftdm_sngss7_data.message_trace == 1) ? "ON" : "OFF", - g_ftdm_sngss7_data.message_trace_level); - - g_ftdm_sngss7_data.message_trace = on; - g_ftdm_sngss7_data.message_trace_level = level; - - stream->write_function(stream, "ftmod_sangoma_ss7 Message Trace now is %s, level = %d\n", - (g_ftdm_sngss7_data.message_trace == 1) ? "ON" : "OFF", - g_ftdm_sngss7_data.message_trace_level); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_show_free(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - int x; - int free; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - free = 0; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - switch (ftdmchan->state) { - /******************************************************************/ - case (FTDM_CHANNEL_STATE_DOWN): - if (verbose) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|state=%s\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic, - ftdm_channel_state2str(ftdmchan->state)); - } /* if (verbose) */ - - /*increment the count of circuits in reset */ - free++; - break; - /******************************************************************/ - default: - break; - /******************************************************************/ - } /* switch (ftdmchan->state) */ - } /* if ( span and chan) */ - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - stream->write_function(stream, "\nTotal # of CICs free = %d\n",free); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_show_inuse(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - int x; - int in_use; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - in_use = 0; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - switch (ftdmchan->state) { - /******************************************************************/ - case (FTDM_CHANNEL_STATE_COLLECT): - case (FTDM_CHANNEL_STATE_RING): - case (FTDM_CHANNEL_STATE_DIALING): - case (FTDM_CHANNEL_STATE_PROGRESS): - case (FTDM_CHANNEL_STATE_PROGRESS_MEDIA): - case (FTDM_CHANNEL_STATE_UP): - case (FTDM_CHANNEL_STATE_TERMINATING): - case (FTDM_CHANNEL_STATE_HANGUP): - if (verbose) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|state=%s\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic, - ftdm_channel_state2str(ftdmchan->state)); - } /* if (verbose) */ - - /*increment the count of circuits in reset */ - in_use++; - break; - /******************************************************************/ - default: - break; - /******************************************************************/ - } /* switch (ftdmchan->state) */ - } /* if ( span and chan) */ - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - stream->write_function(stream, "\nTotal # of CICs in use = %d\n",in_use); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_show_inreset(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - int x; - int in_reset; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - in_reset = 0; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - if ((sngss7_test_ckt_flag(ss7_info, FLAG_RESET_RX)) || - (sngss7_test_ckt_flag(ss7_info, FLAG_RESET_TX)) || - (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_RESET_RX)) || - (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_RESET_TX))) { - - if (verbose) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|in_reset=Y\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic); - } /* if (verbose) */ - - /*increment the count of circuits in reset */ - in_reset++; - } /* if ((sngss7_test_ckt_flag(ss7_info, FLAG_RESET_RX) ... */ - } /* if ( span and chan) */ - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - stream->write_function(stream, "\nTotal # of CICs in reset = %d\n",in_reset); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int x; - int bit; - int lspan; - int lchan; - const char *text; - int flag; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic); - - for (bit = 0; bit < 33; bit++) { - if (ss7_info->ckt_flags & ( 0x1 << bit)) { - stream->write_function(stream, "|"); - flag = bit; - text = ftmod_ss7_ckt_flag2str(flag); - stream->write_function(stream, "%s",text); - } - } - - for (bit = 0; bit < 33; bit++) { - if (ss7_info->blk_flags & ( 0x1 << bit)) { - stream->write_function(stream, "|"); - flag = bit; - text = ftmod_ss7_blk_flag2str(flag); - stream->write_function(stream, "%s",text); - } - } - - stream->write_function(stream, "\n"); - } /* if ( span and chan) */ - - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic); - - if((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) { - stream->write_function(stream, "l_mn=Y|"); - }else { - stream->write_function(stream, "l_mn=N|"); - } - - if((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) { - stream->write_function(stream, "r_mn=Y|"); - }else { - stream->write_function(stream, "r_mn=N|"); - } - - if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) { - stream->write_function(stream, "l_hw=Y|"); - }else { - stream->write_function(stream, "l_hw=N|"); - } - - if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) { - stream->write_function(stream, "r_hw=Y|"); - }else { - stream->write_function(stream, "r_hw=N|"); - } - - if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) { - stream->write_function(stream, "l_mngmt=Y|"); - }else { - stream->write_function(stream, "l_mngmt=N|"); - } - - if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) { - stream->write_function(stream, "l_ucic=Y|"); - }else { - stream->write_function(stream, "l_ucic=N|"); - } - -#ifdef SMG_RELAY_DBG - stream->write_function(stream," blk_flag=%x | ckt_flag=%x | chan_flag=%x", ss7_info->blk_flags, ss7_info->ckt_flags, ftdmchan->flags); -#endif - stream->write_function(stream, "\n"); - } /* if ( span and chan) */ - - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; - sng_isup_ckt_t *ckt; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - /* extract the circuit to make it easier to work with */ - ckt = &g_ftdm_sngss7_data.cfg.isupCkt[x]; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ckt->span; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ckt->chan; - } else { - lchan = chan; - } - - /* check if this circuit is one of the circuits we're interested in */ - if ((ckt->span == lspan) && (ckt->chan == lchan)) { - if (ckt->type == SNG_CKT_HOLE) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|NOT USED\n", - ckt->span, - ckt->chan, - ckt->cic); - } else if (ckt->type == SNG_CKT_SIG) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|SIGNALING LINK\n", - ckt->span, - ckt->chan, - ckt->cic); - } else { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - - if (ftdmchan == NULL) { - /* this should never happen!!! */ - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|FTDMCHAN DOES NOT EXISTS", - ckt->span, - ckt->chan, - ckt->cic); - - } else { - /* grab the signaling_status */ - ftdm_channel_get_sig_status(ftdmchan, &sigstatus); - - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|ckt=%4d|sig_status=%4s|state=%s|", - ckt->span, - ckt->chan, - ckt->cic, - ckt->id, - ftdm_signaling_status2str(sigstatus), - ftdm_channel_state2str(ftdmchan->state)); - - if ((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || - (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX)) || - (sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX))) { - stream->write_function(stream, "l_mn=Y|"); - }else { - stream->write_function(stream, "l_mn=N|"); - } - - if ((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || - (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) { - stream->write_function(stream, "r_mn=Y|"); - }else { - stream->write_function(stream, "r_mn=N|"); - } - - if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) { - stream->write_function(stream, "l_hw=Y|"); - }else { - stream->write_function(stream, "l_hw=N|"); - } - - if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) { - stream->write_function(stream, "r_hw=Y|"); - }else { - stream->write_function(stream, "r_hw=N|"); - } - - - if (g_ftdm_sngss7_data.cfg.procId != 1) { - /* if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_RELAY_DOWN)) { */ - stream->write_function(stream, "relay=Y|"); - }else { - stream->write_function(stream, "relay=N"); - } - -#ifdef SMG_RELAY_DBG - stream->write_function(stream, "| flag=0x%llx", ftdmchan->flags); -#endif - } - -#ifdef SMG_RELAY_DBG - stream->write_function(stream," | blk_flag=%x | ckt_flag=%x", ss7_info->blk_flags, ss7_info->ckt_flags); -#endif - stream->write_function(stream, "\n"); - } /* if ( hole, sig, voice) */ - } /* if ( span and chan) */ - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - /* Look spans that are being used by M2UA SG links */ - for (x = 1; x < ftdm_array_len(g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif); x++) { - if (g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].id) { - if (g_ftdm_sngss7_data.cfg.mtp2Link[g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].mtp2LnkNmb].id) { - uint32_t mtp1_id = g_ftdm_sngss7_data.cfg.mtp2Link[g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[x].mtp2LnkNmb].id; - if (g_ftdm_sngss7_data.cfg.mtp1Link[mtp1_id].id) { - if (g_ftdm_sngss7_data.cfg.mtp1Link[mtp1_id].span == span) { - if (chan) { - if (chan == g_ftdm_sngss7_data.cfg.mtp1Link[mtp1_id].chan) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|SIGNALING LINK\n", - g_ftdm_sngss7_data.cfg.mtp1Link[mtp1_id].span, - g_ftdm_sngss7_data.cfg.mtp1Link[mtp1_id].chan, - 0); - } - } else { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|SIGNALING LINK\n", - g_ftdm_sngss7_data.cfg.mtp1Link[mtp1_id].span, - g_ftdm_sngss7_data.cfg.mtp1Link[mtp1_id].chan, - 0); - } - } - } - - } - } - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change|give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); - ftdm_assert(0, "State change not completed\n"); - ftdm_mutex_unlock(ftdmchan->mutex); - continue; - } else { - sngss7_set_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - ftdm_mutex_unlock(ftdmchan->mutex); - } - - } - - x++; - } - - handle_show_blocks(stream, span, chan, verbose); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change|give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); - ftdm_assert(0, "State change not completed\n"); - ftdm_mutex_unlock(ftdmchan->mutex); - continue; - } else { - sngss7_set_ckt_blk_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX); - sngss7_clear_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX); - sngss7_clear_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX); - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - ftdm_mutex_unlock(ftdmchan->mutex); - - } - - } - - /* go the next circuit */ - x++; - } - - handle_show_blocks(stream, span, chan, verbose); - - return FTDM_SUCCESS; -} - - -/******************************************************************************/ -static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char *name) -{ - SS7_RELAY_DBG_FUN(handle_status_mtp3link); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Invalid stream\n"); - - if (!name) { - return cli_ss7_show_all_mtp3link(stream); - } - - return cli_ss7_show_mtp3link_by_name(stream, name); -} - - -/******************************************************************************/ -static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char *name) -{ - SS7_RELAY_DBG_FUN(handle_status_mtp2link); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Invalid stream\n"); - - if (!name) { - return cli_ss7_show_all_mtp2link(stream); - } - - return cli_ss7_show_mtp2link_by_name(stream, name); -} - -/******************************************************************************/ -static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - SnMngmt sta; - - /* find the linkset request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKSETS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { - - /* send the status request */ - if (ftmod_ss7_mtplinkSet_sta(x, &sta)) { - stream->write_function(stream, "Failed to read linkset=%s status\n", name); - return FTDM_FAIL; - } - - /* print the results */ - stream->write_function(stream, "%s|state=%s|nmbActLnk=%d\n", - name, - DECODE_LSN_LINKSET_STATUS(sta.t.ssta.s.snLnkSet.state), - sta.t.ssta.s.snLnkSet.nmbActLnks); - - goto success; - } - - /* move to the next linkset */ - x++; - } /* while (id != 0) */ - - stream->write_function(stream, "Failed to find link=\"%s\"\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - - /* send the inhibit request */ - if (ftmod_ss7_inhibit_mtp3link(x)) { - stream->write_function(stream, "Failed to inhibit link=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the link */ - handle_status_mtp3link(stream, &name[0]); - - goto success; - } - - /* move to the next linkset */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Failed to find link=\"%s\"\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - - /* send the uninhibit request */ - if (ftmod_ss7_uninhibit_mtp3link(x)) { - stream->write_function(stream, "Failed to uninhibit link=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the link */ - handle_status_mtp3link(stream, &name[0]); - - goto success; - } - - /* move to the next linkset */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Failed to find link=\"%s\"\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int chan, int verbose) -{ - int x; - sngss7_chan_data_t *sngss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = sngss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* throw the reset flag */ - sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL); - sngss7_clear_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - sngss7_tx_reset_restart(sngss7_info); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - /* go to idle so that we can redo the restart state*/ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - break; - /**************************************************************************/ - default: - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - } /* if ( span and chan) */ - - } /* if ( cic == voice) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - /* print the status of channels */ - handle_show_status(stream, span, chan, verbose); - - - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose) -{ - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_span_data_t *sngss7_span = NULL; - int x = 0; - int basefound = 0; - - if (range > 31) { - stream->write_function(stream, "Range value %d is too big for a GRS", range); - return FTDM_SUCCESS; - } - - if (range < 2) { - stream->write_function(stream, "Range value %d is too small for a GRS", range); - return FTDM_SUCCESS; - } - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->signal_data; - - if ((ftdmchan->physical_span_id == span) && - ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_channel_lock(ftdmchan); - - /* if another reset is still in progress, skip this channel */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX)) { - ftdm_channel_unlock(ftdmchan); - continue; - } - - /* check if there is a pending state change|give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_channel_unlock(ftdmchan); - continue; - } - - /* throw the grp reset flag */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX); - if (!basefound) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Setting channel as GRS base\n"); - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE); - sngss7_info->tx_grs.circuit = sngss7_info->circuit->id; - sngss7_info->tx_grs.range = range - 1; - basefound = 1; - } - - /* set the channel to restart state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - ftdm_channel_unlock(ftdmchan); - - } - - } - - /* go the next circuit */ - x++; - } - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->signal_data; - - if ((ftdmchan->physical_span_id == span) && - ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { - - handle_show_status(stream, span, chan, verbose); - } - } /* if ( cic == voice) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose) -{ - int x; - sngss7_chan_data_t *sngss7_info; - ftdm_channel_t *ftdmchan; - ftdm_channel_t *main_chan = NULL; - sngss7_span_data_t *sngss7_span; - int byte = 0; - int bit = 0; - ftdm_sigmsg_t sigev; - - memset (&sigev, 0, sizeof (sigev)); - - - if (range <= 1 || range > 31) { - stream->write_function(stream, "Invalid range value %d. Range value must be greater than 1 and less than 31. \n", range); - return FTDM_SUCCESS; - } - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - /* extract the channel and span info for this circuit */ - sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->signal_data; - - /* check if this circuit is part of the block */ - if ((ftdmchan->physical_span_id == span) && - ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_channel_lock(ftdmchan); - - /* throw the grp maint. block flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX); - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* bring the sig status down */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - - /* if this is the first channel in the range */ - if (!main_chan) { - /* attach the cgb information */ - main_chan = ftdmchan; - sngss7_span->tx_cgb.circuit = sngss7_info->circuit->id; - sngss7_span->tx_cgb.range = 0; - sngss7_span->tx_cgb.type = 0; /* maintenace block */ - } else { - ((sngss7_span_data_t*)(main_chan->span->signal_data))->tx_cgb.range++; - } - - /* update the status field */ - sngss7_span->tx_cgb.status[byte] = (sngss7_span->tx_cgb.status[byte] | (1 << bit)); - - /* update the bit and byte counter*/ - bit ++; - if (bit == 8) { - byte++; - bit = 0; - } - - /* unlock the channel again before we exit */ - ftdm_channel_unlock(ftdmchan); - } - } - /* go the next circuit */ - x++; - } - - if (!main_chan) { - stream->write_function(stream, "Failed to find a voice cic in span %d chan %d range %d", span, chan, range); - return FTDM_SUCCESS; - } - - /* send the circuit group block */ - ft_to_sngss7_cgb(main_chan); - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->signal_data; - - if ((ftdmchan->physical_span_id == span) && - ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { - - handle_show_status(stream, ftdmchan->physical_span_id, ftdmchan->physical_chan_id, verbose); - } - } /* if ( cic == voice) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose) -{ - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - ftdm_channel_t *main_chan = NULL; - sngss7_span_data_t *sngss7_span = NULL; - sngss7_chan_data_t *ubl_sng_info[MAX_CIC_MAP_LENGTH+1]; - int x = 0; - int byte = 0; - int bit = 0; - int ubl_sng_info_idx = 1; - ftdm_sigmsg_t sigev; - - memset(ubl_sng_info, 0, sizeof(ubl_sng_info)); - memset (&sigev, 0, sizeof (sigev)); - - if (range <= 1 || range > 31) { - stream->write_function(stream, "Invalid range value %d. Range value must be greater than 1 and less than 31.\n", range); - return FTDM_SUCCESS; - } - - /* verify that there is not hardware block in the range. - * if there is any channel within the group unblock range, do not execute the group unblock */ - x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->signal_data; - - if ( (ftdmchan->physical_span_id == span) - && (ftdmchan->physical_chan_id >= chan) - && (ftdmchan->physical_chan_id < (chan+range)) - && sngss7_test_ckt_blk_flag(sngss7_info, (FLAG_GRP_HW_BLOCK_TX | FLAG_GRP_HW_BLOCK_TX_DN)) - ) { - stream->write_function(stream, "There is at least one channel with hardware block. Group unblock operation not allowed at this time.\n"); - return FTDM_SUCCESS; - } - } - x++; - } - - - x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - /* extract the channel and span info for this circuit */ - sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->signal_data; - - /* check if this circuit is part of the block */ - if ((ftdmchan->physical_span_id == span) && - ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_channel_lock(ftdmchan); - - /* throw the grp maint. block flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX); - - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN)) { - ubl_sng_info[ubl_sng_info_idx] = sngss7_info; - ubl_sng_info_idx++; - } - - /* bring the sig status up */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* if this is the first channel in the range */ - if (!main_chan) { - /* attach the cgb information */ - main_chan = ftdmchan; - sngss7_span->tx_cgu.circuit = sngss7_info->circuit->id; - sngss7_span->tx_cgu.range = 0; - sngss7_span->tx_cgu.type = 0; /* maintenace block */ - } else { - ((sngss7_span_data_t*)(main_chan->span->signal_data))->tx_cgu.range++; - } - - /* update the status field */ - sngss7_span->tx_cgu.status[byte] = (sngss7_span->tx_cgu.status[byte] | (1 << bit)); - - /* update the bit and byte counter*/ - bit ++; - if (bit == 8) { - byte++; - bit = 0; - } - - /* unlock the channel again before we exit */ - ftdm_channel_unlock(ftdmchan); - } - } - /* go the next circuit */ - x++; - } - - if (!main_chan) { - stream->write_function(stream, "Failed to find a voice cic in span %d chan %d range %d", span, chan, range); - return FTDM_SUCCESS; - } - - /* send the circuit group block */ - ft_to_sngss7_cgu(main_chan); - - /* clearing blocking flags */ - for (x = 1; ubl_sng_info[x]; x++) { - sngss7_info = ubl_sng_info[x]; - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN); - } - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->signal_data; - - if ((ftdmchan->physical_span_id == span) && - ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { - - handle_show_status(stream, ftdmchan->physical_span_id, ftdmchan->physical_chan_id, verbose); - - } - } /* if ( cic == voice) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ - - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_bind_link(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - - /* send the uninhibit request */ - if (ftmod_ss7_bind_mtp3link(g_ftdm_sngss7_data.cfg.mtp3Link[x].mtp2Id)) { - stream->write_function(stream, "Failed to bind link=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the link */ - handle_status_mtp3link(stream, &name[0]); - goto success; - } - - /* move to the next link */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Could not find link=%s\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_unbind_link(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - - /* send the uninhibit request */ - if (ftmod_ss7_unbind_mtp3link(g_ftdm_sngss7_data.cfg.mtp3Link[x].mtp2Id)) { - stream->write_function(stream, "Failed to bind link=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the link */ - handle_status_mtp3link(stream, &name[0]); - goto success; - } - - /* move to the next link */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Could not find link=%s\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_activate_link(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - - /* send the uninhibit request */ - if (ftmod_ss7_activate_mtp3link(x)) { - stream->write_function(stream, "Failed to activate link=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the link */ - handle_status_mtp3link(stream, &name[0]); - goto success; - } - - /* move to the next link */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Could not find link=%s\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_deactivate_link(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - - /* send the deactivate request */ - if (ftmod_ss7_deactivate2_mtp3link(x)) { - stream->write_function(stream, "Failed to deactivate link=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the link */ - handle_status_mtp3link(stream, &name[0]); - goto success; - } - - /* move to the next link */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Could not find link=%s\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_activate_linkset(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the linkset request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKSETS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { - - /* send the activate request */ - if (ftmod_ss7_activate_mtplinkSet(x)) { - stream->write_function(stream, "Failed to activate linkset=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the linkset */ - handle_status_linkset(stream, &name[0]); - goto success; - } - - /* move to the next linkset */ - x++; - } /* while (id != 0) */ - - stream->write_function(stream, "Could not find linkset=%s\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_deactivate_linkset(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the linkset request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKSETS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { - - /* send the deactivate request */ - if (ftmod_ss7_deactivate2_mtplinkSet(x)) { - stream->write_function(stream, "Failed to deactivate linkset=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the linkset */ - handle_status_linkset(stream, &name[0]); - goto success; - } - - /* move to the next linkset */ - x++; - } /* while (id != 0) */ - - stream->write_function(stream, "Could not find linkset=%s\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ - -static ftdm_status_t handle_tx_lpo(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - - /* send the uninhibit request */ - if (ftmod_ss7_lpo_mtp3link(x)) { - stream->write_function(stream, "Failed set LPO link=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the link */ - handle_status_mtp3link(stream, &name[0]); - goto success; - } - - /* move to the next link */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Could not find link=%s\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - - /* send the uninhibit request */ - if (ftmod_ss7_lpr_mtp3link(x)) { - stream->write_function(stream, "Failed set LPR link=%s\n", name); - return FTDM_FAIL; - } - - /* print the new status of the link */ - handle_status_mtp3link(stream, &name[0]); - goto success; - } - - /* move to the next link */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Could not find link=%s\n", name); - -success: - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *name) -{ - SS7_RELAY_DBG_FUN(handle_status_relay); - if (!name) { - return cli_ss7_show_all_relay(stream); - } - return cli_ss7_show_relay_by_name(stream, name); -} - -/******************************************************************************/ -static ftdm_status_t handle_status_isup_ckt(ftdm_stream_handle_t *stream, char *id_name) -{ - sng_isup_ckt_t *ckt; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - uint32_t id; - uint8_t state = 0; - uint8_t bits_ab = 0; - uint8_t bits_cd = 0; - uint8_t bits_ef = 0; - - /* extract the integer version of the id (ckt) */ - id = atoi(id_name); - - /* extract the global config circuit structure */ - ckt = &g_ftdm_sngss7_data.cfg.isupCkt[id]; - - /* confirm the ckt exists */ - if (ckt->id == 0) { - stream->write_function(stream, "Requested ckt does not exist (%d)\n", id); - return FTDM_FAIL; - } - - /* confirm the ckt is a voice channel */ - if (ckt->type != SNG_CKT_VOICE) { - stream->write_function(stream, "Requested ckt is a sig link/hole and can not be queried (%d)\n", id); - return FTDM_FAIL; - } - - /* extract the global structure */ - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[id].obj; - ftdmchan = ss7_info->ftdmchan; - - /* query the isup stack for the state of the ckt */ - if (ftmod_ss7_isup_ckt_sta(ckt->id, &state)) { - stream->write_function(stream, "Failed to read isup ckt =%d status\n", id); - return FTDM_FAIL; - } - - - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|ckt=%4d|state=0x%02X|", - ckt->span, - ckt->chan, - ckt->cic, - ckt->id, - state); - - /* extract the bit sections */ - bits_ab = (state & (SNG_BIT_A + SNG_BIT_B)) >> 0; - - bits_cd = (state & (SNG_BIT_C + SNG_BIT_D)) >> 2; - - bits_ef = (state & (SNG_BIT_E + SNG_BIT_F)) >> 4; - - /* check bits C and D */ - switch (bits_cd) { - /**************************************************************************/ - case (0): - /* ckt is either un-equipped or transient, check bits A and B */ - switch (bits_ab) { - /**********************************************************************/ - case (0): - /* bit a and bit are cleared, transient */ - stream->write_function(stream, "transient\n"); - goto success; - break; - /**********************************************************************/ - case (1): - case (2): - /* bit a or bit b are set, spare ... shouldn't happen */ - stream->write_function(stream, "spare\n"); - goto success; - break; - /**********************************************************************/ - case (3): - /* bit a and bit b are set, unequipped */ - stream->write_function(stream, "unequipped\n"); - goto success; - break; - /**********************************************************************/ - default: - stream->write_function(stream, "invalid values for bits A and B (%d)\n", - bits_ab); - goto success; - break; - /**********************************************************************/ - } /* switch (bits_ab) */ - - /* shouldn't get here but have a break for properness */ - break; - /**************************************************************************/ - case (1): - /* circuit incoming busy */ - stream->write_function(stream, "incoming busy"); - break; - /**************************************************************************/ - case (2): - /* circuit outgoing busy */ - stream->write_function(stream, "outgoing busy"); - break; - /**************************************************************************/ - case (3): - /* circuit idle */ - stream->write_function(stream, "idle"); - break; - /**************************************************************************/ - default: - /* invalid */ - stream->write_function(stream, "bits C and D are invalid (%d)!\n", - bits_cd); - goto success; - /**************************************************************************/ - } /* switch (bits_cd) */ - - /* check the maintenance block status in bits A and B */ - switch (bits_ab) { - /**************************************************************************/ - case (0): - /* no maintenace block...do nothing */ - break; - /**************************************************************************/ - case (1): - /* locally blocked */ - stream->write_function(stream, "|l_mn"); - break; - /**************************************************************************/ - case (2): - /* remotely blocked */ - stream->write_function(stream, "|r_mn"); - break; - /**************************************************************************/ - case (3): - /* both locally and remotely blocked */ - stream->write_function(stream, "|l_mn|r_mn"); - break; - /**************************************************************************/ - default: - stream->write_function(stream, "bits A and B are invlaid (%d)!\n", - bits_ab); - goto success; - /**************************************************************************/ - } /* switch (bits_ab) */ - - /* check the hardware block status in bits e and f */ - switch (bits_ef) { - /**************************************************************************/ - case (0): - /* no maintenace block...do nothing */ - break; - /**************************************************************************/ - case (1): - /* locally blocked */ - stream->write_function(stream, "|l_hw"); - break; - /**************************************************************************/ - case (2): - /* remotely blocked */ - stream->write_function(stream, "|r_hw"); - break; - /**************************************************************************/ - case (3): - /* both locally and remotely blocked */ - stream->write_function(stream, "|l_hw|r_hw"); - break; - /**************************************************************************/ - default: - stream->write_function(stream, "bits E and F are invlaid (%d)!\n", - bits_ef); - goto success; - /**************************************************************************/ - } /* switch (bits_ef) */ - -success: - stream->write_function(stream, "\n"); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan) -{ - - if (!strcasecmp(argv[pos], "span")) { - /**************************************************************************/ - pos++; - *span = atoi(argv[pos]); - - pos++; - if (!strcasecmp(argv[pos], "chan")) { - /**********************************************************************/ - pos++; - *chan = atoi(argv[pos]); - /**********************************************************************/ - } else { - /**********************************************************************/ - return FTDM_FAIL; - /**********************************************************************/ - } - /**************************************************************************/ - } else { - /**************************************************************************/ - *span = atoi(argv[pos]); - - pos++; - if (!strcasecmp(argv[pos], "chan")) { - /**********************************************************************/ - pos++; - *chan = atoi(argv[pos]); - /**********************************************************************/ - } else { - /**********************************************************************/ - return FTDM_FAIL; - /**********************************************************************/ - } - /**************************************************************************/ - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t check_arg_count(int args, int min) -{ - if ( args < min ) { - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} - - -/****************************************************************************** -* Fun: cli_ss7_show_mtp2link_by_id() -* Desc: display mtp3 link information with id -* Param: -* stream : output stream object -* rcId : mtp2 link's id -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_mtp2link_by_id(ftdm_stream_handle_t *stream, int rcId) -{ - SdMngmt sta; - - SS7_RELAY_DBG_FUN(cli_ss7_show_mtp2link_by_id); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - - if (ftmod_ss7_mtp2link_sta(rcId, &sta)) { - stream->write_function(stream, "Failed to read status of MTP2 link, id=%d \n", rcId); - return FTDM_FAIL; - } - - stream->write_function(stream, "name=%s|span=%d|chan=%d|sap=%d|state=%s|outsFrm=%d|drpdFrm=%d|lclStatus=%s|rmtStatus=%s|fsn=%d|bsn=%d\n", - g_ftdm_sngss7_data.cfg.mtp2Link[rcId].name, - g_ftdm_sngss7_data.cfg.mtp1Link[rcId].span, - g_ftdm_sngss7_data.cfg.mtp1Link[rcId].chan, - g_ftdm_sngss7_data.cfg.mtp2Link[rcId].id, - DECODE_LSD_LINK_STATUS(sta.t.ssta.s.sdDLSAP.hlSt), - sta.t.ssta.s.sdDLSAP.psOutsFrm, - sta.t.ssta.s.sdDLSAP.cntMaDrop, - (sta.t.ssta.s.sdDLSAP.lclBsy) ? "Y":"N", - (sta.t.ssta.s.sdDLSAP.remBsy) ? "Y":"N", - sta.t.ssta.s.sdDLSAP.fsn, - sta.t.ssta.s.sdDLSAP.bsn - ); - - return FTDM_SUCCESS; -} - -/****************************************************************************** -* Fun: cli_ss7_show_mtp2link_by_name() -* Desc: display all relay channels information -* Param: -* stream : output stream object -* rcName: mtp2 link's name -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_mtp2link_by_name(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - SS7_RELAY_DBG_FUN(cli_ss7_show_mtp2link_by_name); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - ftdm_assert_return(!ftdm_strlen_zero(name), FTDM_FAIL, "Null MTP2 link name\n"); - - for (x = 0; x < (MAX_MTP_LINKS + 1); x++) { - if (0 == strcasecmp(g_ftdm_sngss7_data.cfg.mtp2Link[x].name, name)) { - return cli_ss7_show_mtp2link_by_id( stream, x ); - } - } - - stream->write_function (stream, "The MTP2 link with name \'%s\' is not found. \n", name); - return FTDM_FAIL; -} - -/****************************************************************************** -* Fun: cli_ss7_show_all_mtp2link() -* Desc: display all mtp2 links information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_all_mtp2link(ftdm_stream_handle_t *stream) -{ - int x = 0; - - SS7_RELAY_DBG_FUN(cli_ss7_show_all_mtp2link); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - - for (x = 0; x < (MAX_MTP_LINKS + 1); x++) { - if (!ftdm_strlen_zero( g_ftdm_sngss7_data.cfg.mtp2Link[x].name)) { - cli_ss7_show_mtp2link_by_id(stream, x ); - } - } - - return FTDM_SUCCESS; -} - -/****************************************************************************** -* Fun: cli_ss7_show_mtp3link_by_id() -* Desc: display mtp3 link information with id -* Param: -* stream : output stream object -* rcId : mtp3 link's id -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_mtp3link_by_id(ftdm_stream_handle_t *stream, int rcId) -{ - SnMngmt sta; - - SS7_RELAY_DBG_FUN(cli_ss7_show_mtp3link_by_id); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - - memset(&sta, 0, sizeof(sta)); - if (ftmod_ss7_mtp3link_sta(rcId, &sta)) { - stream->write_function(stream, "Failed to read status of MTP3 link, id=%d \n", rcId); - return FTDM_FAIL; - } - - stream->write_function(stream, "name=%s|span=%d|chan=%d|sap=%d|state=%s|l_blk=%s|r_blk=%s|l_inhbt=%s|r_inhbt=%s\n", - g_ftdm_sngss7_data.cfg.mtp3Link[rcId].name, - g_ftdm_sngss7_data.cfg.mtp1Link[rcId].span, - g_ftdm_sngss7_data.cfg.mtp1Link[rcId].chan, - g_ftdm_sngss7_data.cfg.mtp3Link[rcId].id, - DECODE_LSN_LINK_STATUS(sta.t.ssta.s.snDLSAP.state), - (sta.t.ssta.s.snDLSAP.locBlkd) ? "Y":"N", - (sta.t.ssta.s.snDLSAP.remBlkd) ? "Y":"N", - (sta.t.ssta.s.snDLSAP.locInhbt) ? "Y":"N", - (sta.t.ssta.s.snDLSAP.rmtInhbt) ? "Y":"N" - ); - - return FTDM_SUCCESS; -} - -/****************************************************************************** -* Fun: cli_ss7_show_mtp3link_by_name() -* Desc: display all relay channels information -* Param: -* stream : output stream object -* rcName: mtp3 link's name -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_mtp3link_by_name(ftdm_stream_handle_t *stream, char *name) -{ - int x=0; - SS7_RELAY_DBG_FUN(cli_ss7_show_mtp3link_by_name); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - ftdm_assert_return(!ftdm_strlen_zero(name), FTDM_FAIL, "Null MTP3 link name\n"); - - for (x = 0; x < (MAX_MTP_LINKS + 1); x++) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - return cli_ss7_show_mtp3link_by_id(stream, x ); - } - } - - stream->write_function(stream, "The MTP3 link with name \'%s\' is not found. \n", name); - return FTDM_FAIL; -} -/****************************************************************************** -* Fun: cli_ss7_show_all_mtp3link() -* Desc: display all mtp3 links information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_all_mtp3link(ftdm_stream_handle_t *stream) -{ - int x = 0; - - SS7_RELAY_DBG_FUN(cli_ss7_show_all_mtp3link); - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - - for (x = 0; x < (MAX_MTP_LINKS + 1); x++) { - if (!ftdm_strlen_zero(g_ftdm_sngss7_data.cfg.mtp3Link[x].name)) { - cli_ss7_show_mtp3link_by_id(stream, x); - } - } - - return FTDM_SUCCESS; -} - - -/****************************************************************************** -* Fun: cli_ss7_show_all_linkset() -* Desc: display all mtp3 linksets information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_all_linkset(ftdm_stream_handle_t *stream) -{ - int x = 0; - SnMngmt sta; - - SS7_RELAY_DBG_FUN(cli_ss7_show_all_linkset); - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - - x = 1; - while(x < (MAX_MTP_LINKSETS+1)) { - if (!ftdm_strlen_zero(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name)) { - if (ftmod_ss7_mtplinkSet_sta(x, &sta)) { - stream->write_function(stream, "Failed to read linkset=%s status\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); - } else { - stream->write_function(stream, "name=%s|state=%s|nmbActLnk=%d\n", - g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, - DECODE_LSN_LINKSET_STATUS(sta.t.ssta.s.snLnkSet.state), sta.t.ssta.s.snLnkSet.nmbActLnks - ); - } - } - x++; - } - return FTDM_SUCCESS; -} - - -/****************************************************************************** -* Fun: cli_ss7_show_general() -* Desc: display all general information about ss7 -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_general(ftdm_stream_handle_t *stream) -{ - SS7_RELAY_DBG_FUN(cli_ss7_show_general); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - - stream->write_function(stream, "MTP2 status: \n"); - cli_ss7_show_all_mtp2link(stream); - - if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){ - stream->write_function(stream, "\nMTP3 status: \n"); - cli_ss7_show_all_mtp3link(stream); - - stream->write_function(stream, "\nMTP3 linkset status: \n"); - cli_ss7_show_all_linkset(stream); - -#if 0 - stream->write_function(stream, "\nMTP3 link route status: \n"); - - stream->write_function(stream, "\nISUP status: \n"); -#endif - - stream->write_function(stream, "\nRelay status: \n"); - cli_ss7_show_all_relay(stream); - } - - return FTDM_SUCCESS; -} - -/****************************************************************************** -* Fun: cli_ss7_show_relay_by_id() -* Desc: display all relay channels information -* Param: -* stream : output stream object -* rcId : channel's id -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_relay_by_id(ftdm_stream_handle_t *stream, int rcId) -{ - RyMngmt sta; - - SS7_RELAY_DBG_FUN(cli_ss7_show_relay_by_id); - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - - memset(&sta, 0x0, sizeof(sta)); - if (ftmod_ss7_relay_status(g_ftdm_sngss7_data.cfg.relay[rcId].id, &sta)) { - stream->write_function(stream, "Failed to read relay =%s status\n", g_ftdm_sngss7_data.cfg.relay[rcId].name); - return FTDM_FAIL; - } - - stream->write_function(stream, "name=%s|sap=%d|type=%d|port=%d|hostname=%s|procId=%d|status=%s\n", - g_ftdm_sngss7_data.cfg.relay[rcId].name, - g_ftdm_sngss7_data.cfg.relay[rcId].id, - g_ftdm_sngss7_data.cfg.relay[rcId].type, - g_ftdm_sngss7_data.cfg.relay[rcId].port, - g_ftdm_sngss7_data.cfg.relay[rcId].hostname, - g_ftdm_sngss7_data.cfg.relay[rcId].procId, - DECODE_LRY_CHAN_STATUS(sta.t.ssta.rySta.cStatus) - ); - - return FTDM_SUCCESS; -} -/****************************************************************************** -* Fun: cli_ss7_show_relay_by_name() -* Desc: display all relay channels information -* Param: -* stream : output stream object -* rcName: channel's name -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_relay_by_name(ftdm_stream_handle_t *stream, char *name) -{ - int x = 0; - - SS7_RELAY_DBG_FUN(cli_ss7_show_relay_by_name); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - ftdm_assert_return(!ftdm_strlen_zero(name), FTDM_FAIL, "Null relay link name\n"); - - for (x = 1; x < MAX_RELAY_CHANNELS; x++) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.relay[x].name, name)) { - return cli_ss7_show_relay_by_id(stream, x); - } - } - - stream->write_function( stream, "The relay channel with name \'%s\' is not found. \n", name); - return FTDM_FAIL; - -} -/****************************************************************************** -* Fun: cli_ss7_show_all_relay() -* Desc: display all relay channels information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_all_relay(ftdm_stream_handle_t *stream) -{ - int x = 0; - SS7_RELAY_DBG_FUN(cli_ss7_show_relay_by_name); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - - for (x = 1; x < MAX_RELAY_CHANNELS; x++) { - if (!ftdm_strlen_zero(g_ftdm_sngss7_data.cfg.relay[x].name)) { - cli_ss7_show_relay_by_id (stream, x); - } - } - - return FTDM_SUCCESS; -} - - -/****************************************************************************** -* Fun: cli_ss7_show_channel_detail_of_span() -* Desc: display span information of a given id -* Param: -* stream : output stream object -* span_id : span id string received from cli -* chan_id : channel id string received from cli -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_channel_detail_of_span(ftdm_stream_handle_t *stream, char *span_id, char *chan_id) -{ - int x, y; - - SS7_RELAY_DBG_FUN(cli_ss7_show_channel_detail_of_span); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - ftdm_assert_return(span_id != 0, FTDM_FAIL, "Invalid span id\n"); - ftdm_assert_return(chan_id != 0, FTDM_FAIL, "Invalid chan id\n"); - - x = atoi(span_id); - y = atoi(chan_id); - if (!x) { - stream->write_function( stream, "Span \'%s\' does not exist. \n", span_id); - return FTDM_FAIL; - } - - return handle_show_status(stream, x, y, 1); -} - -/****************************************************************************** -* Fun: cli_ss7_show_all_channels_of_span() -* Desc: display span information of a given id -* Param: -* stream : output stream object -* span_id : span id string received from cli -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_all_channels_of_span(ftdm_stream_handle_t *stream, char *span_id) -{ - int x=-1; - SS7_RELAY_DBG_FUN(cli_ss7_show_all_channels_of_span); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - ftdm_assert_return(span_id != 0, FTDM_FAIL, "Invalid span id\n"); - - x = atoi(span_id); - if (!x) { - stream->write_function( stream, "Span \'%s\' does not exist. \n", span_id); - return FTDM_FAIL; - } - return handle_show_status(stream, x, 0, 1); -} - -/****************************************************************************** -* Fun: cli_ss7_show_span_by_id() -* Desc: display span information of a given id -* Param: -* stream : output stream object -* span_id : span id string received from cli -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_span_by_id(ftdm_stream_handle_t *stream, char *span_id) -{ - int x = -1; - - SS7_RELAY_DBG_FUN(cli_ss7_show_span_by_id); - - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - ftdm_assert_return(span_id != 0, FTDM_FAIL, "Invalid span id\n"); - - x = atoi(span_id); - if (!x) { - stream->write_function(stream, "Span \'%s\' does not exist. \n", span_id); - return FTDM_FAIL; - } - -#if 0 - stream->write_function( stream, "JZ: we should display span details here \n" ); -#endif - - cli_ss7_show_all_channels_of_span(stream, span_id); - - return FTDM_FAIL; -} - - -/****************************************************************************** -* Fun: cli_ss7_show_all_spans_detail() -* Desc: display all spans information in detail -* Param: -* stream : output stream object -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_all_spans_detail(ftdm_stream_handle_t *stream) -{ - SS7_RELAY_DBG_FUN(cli_ss7_show_all_spans_detail); - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - return handle_show_status(stream, 0, 0, 1); -} - -/****************************************************************************** -* Fun: cli_ss7_show_all_spans_general() -* Desc: display all spans information in general -* Param: -* stream : output stream object -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: James Zhang -*******************************************************************************/ -static ftdm_status_t cli_ss7_show_all_spans_general(ftdm_stream_handle_t *stream) -{ - SS7_RELAY_DBG_FUN(cli_ss7_show_all_spans_general); - ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); - return FTDM_FAIL; -} - - -/****************************************************************************** -* Fun: handle_show_m2ua_profiles() -* Desc: display all m2ua profile information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: Kapil Gupta -*******************************************************************************/ - -static ftdm_status_t handle_show_m2ua_profiles(ftdm_stream_handle_t *stream) -{ - MwMgmt cfm; - MwMgmt rsp; - char buf[2048]; - char* xmlhdr = (char*)""; - int x = 0x00; - int idx = 0x00; - int len = 0x00; - - memset((U8 *)&cfm, 0, sizeof(MwMgmt)); - memset((U8 *)&rsp, 0, sizeof(MwMgmt)); - memset(&buf[0], 0, sizeof(buf)); - - len = len + sprintf(buf + len, "%s\n", xmlhdr); - len = len + sprintf(buf + len, "\n"); - - if(ftmod_m2ua_ssta_req(STMWGEN, 0x00, &cfm)) { - stream->write_function(stream," Request to layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); -#ifdef BIT_64 - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.genSta.memSize); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.genSta.memAlloc); -#else - len = len + sprintf(buf + len, " %ld \n", cfm.t.ssta.s.genSta.memSize); - len = len + sprintf(buf + len, " %ld \n", cfm.t.ssta.s.genSta.memAlloc); -#endif - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.genSta.nmbClusters); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.genSta.nmbPeers); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.genSta.nmbIntf); - len = len + sprintf(buf + len, "\n"); - } - - /*iterate through all the m2ua links and prints all information */ - x = 1; - while(x\n"); - len = len + sprintf(buf + len, " %s \n", g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].name); - - if(ftmod_m2ua_ssta_req(STMWDLSAP,x,&cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.dlSapSta.state)); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_LINK_STATE(cfm.t.ssta.s.dlSapSta.lnkState)); - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.dlSapSta.rpoEnable); - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.dlSapSta.lpoEnable); - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.dlSapSta.congLevel); - len = len + sprintf(buf + len, "\n"); - } - - memset((U8 *)&cfm, 0, sizeof(MwMgmt)); - if(ftmod_m2ua_ssta_req(STMWCLUSTER,g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].clusterId,&cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_CLUSTER_STATE(cfm.t.ssta.s.clusterSta.state)); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.clusterSta.nmbPeer); - len = len + sprintf(buf + len, "\n"); - for(idx = 0; idx < cfm.t.ssta.s.clusterSta.nmbPeer; idx++) - { - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.clusterSta.peerSt[idx].peerId); - len = len + sprintf(buf + len, " %s \n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.clusterSta.peerSt[idx].peerState)); - } - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.clusterSta.nmbActPeer); - - len = len + sprintf(buf + len, "\n"); - - memset((U8 *)&rsp, 0, sizeof(MwMgmt)); - memcpy(&rsp, &cfm, sizeof(MwMgmt)); - - - /* loop through configured peers */ - for(idx = 0; idx < rsp.t.ssta.s.clusterSta.nmbPeer; idx++) - { - int peer_id = rsp.t.ssta.s.clusterSta.peerSt[idx].peerId; - - memset(&cfm, 0, sizeof(MwMgmt)); - - if(LMW_PEER_DOWN != rsp.t.ssta.s.clusterSta.peerSt[idx].peerState){ - - if(ftmod_m2ua_ssta_req(STMWPEER, peer_id, &cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %s \n",g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id].name); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state)); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.retryCount); - len = len + sprintf(buf + len, " %d \n", (int)cfm.t.ssta.s.peerSta.assocSta.spAssocId); - len = len + sprintf(buf + len, " %s \n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED"); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.assocSta.flcInProg); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.assocSta.flcLevel); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.assocSta.sctpHBeatEnb); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.assocSta.locOutStrms); - - len = len + sprintf(buf + len, "\n"); - } - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %s \n",g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id].name); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_PEER_STATE(rsp.t.ssta.s.clusterSta.peerSt[idx].peerState)); - len = len + sprintf(buf + len, "\n"); - } - } - } - - memset((U8 *)&cfm, 0, sizeof(MwMgmt)); - if(ftmod_m2ua_ssta_req(STMWSCTSAP,x,&cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.sctSapSta.state)); - len = len + sprintf(buf + len," %s \n", (cfm.t.ssta.s.sctSapSta.endpOpen)?"END_POINT_OPENED_SUCCESSFULLY":"END_POINT_NOT_OPEN"); - len = len + sprintf(buf + len," %d \n", (int) cfm.t.ssta.s.sctSapSta.spEndpId); - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.sctSapSta.nmbPrimRetry); - len = len + sprintf(buf + len, "\n"); - } - - len = len + sprintf(buf + len, "\n"); - } - x++; - } - - len = len + sprintf(buf + len, "\n"); - stream->write_function(stream,"\n%s\n",buf); - - return FTDM_SUCCESS; - -} - -/****************************************************************************** -* Fun: handle_show_m2ua_profile() -* Desc: display requested m2ua profile information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: Kapil Gupta -*******************************************************************************/ - -static ftdm_status_t handle_show_m2ua_profile(ftdm_stream_handle_t *stream, char* m2ua_profile_name) -{ - char* xmlhdr = (char*)""; - char buf[4096]; - int x = 0x00; - int idx = 0x00; - int found = 0x00; - int len = 0x00; - MwMgmt cfm; - MwMgmt rsp; - - memset((U8 *)&cfm, 0, sizeof(MwMgmt)); - memset((U8 *)&rsp, 0, sizeof(MwMgmt)); - memset(&buf[0], 0, sizeof(buf)); - - len = len + sprintf(buf + len, "%s\n", xmlhdr); - - /*iterate through all the m2ua links and get required profile */ - x = 1; - while(xwrite_function(stream,"Requested M2UA profile[%s] not configured\n", m2ua_profile_name); - return FTDM_FAIL; - } - - - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %s \n", m2ua_profile_name); - - if(ftmod_m2ua_ssta_req(STMWDLSAP,x,&cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.dlSapSta.state)); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_LINK_STATE(cfm.t.ssta.s.dlSapSta.lnkState)); - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.dlSapSta.rpoEnable); - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.dlSapSta.lpoEnable); - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.dlSapSta.congLevel); - len = len + sprintf(buf + len, "\n"); - } - - if(ftmod_m2ua_ssta_req(STMWCLUSTER, g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].clusterId, &cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_CLUSTER_STATE(cfm.t.ssta.s.clusterSta.state)); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.clusterSta.nmbPeer); - len = len + sprintf(buf + len, "\n"); - for(idx = 0; idx < cfm.t.ssta.s.clusterSta.nmbPeer; idx++) - { - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.clusterSta.peerSt[idx].peerId); - len = len + sprintf(buf + len, " %s \n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.clusterSta.peerSt[idx].peerState)); - } - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.clusterSta.nmbActPeer); - - len = len + sprintf(buf + len, "\n"); - } - - memcpy((U8 *)&rsp, &cfm, sizeof(MwMgmt)); - - /* loop through configured peers */ - for(idx = 0; idx < rsp.t.ssta.s.clusterSta.nmbPeer; idx++) - { - memset((U8 *)&cfm, 0, sizeof(MwMgmt)); - - if(ftmod_m2ua_ssta_req(STMWPEER, rsp.t.ssta.s.clusterSta.peerSt[idx].peerId, &cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %s \n",g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[rsp.t.ssta.s.clusterSta.peerSt[idx].peerId].name); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state)); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.retryCount); -#ifdef BIT_64 - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.peerSta.assocSta.spAssocId); -#else - len = len + sprintf(buf + len, " %ld \n", cfm.t.ssta.s.peerSta.assocSta.spAssocId); -#endif - len = len + sprintf(buf + len, " %s \n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED"); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.assocSta.flcInProg); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.assocSta.flcLevel); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.assocSta.sctpHBeatEnb); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.peerSta.assocSta.locOutStrms); - - len = len + sprintf(buf + len, "\n"); - } - } - - if(ftmod_m2ua_ssta_req(STMWSCTSAP,x,&cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_SAP_STATE(cfm.t.ssta.s.sctSapSta.state)); - len = len + sprintf(buf + len," %s \n", (cfm.t.ssta.s.sctSapSta.endpOpen)?"END_POINT_OPENED_SUCCESSFULLY":"END_POINT_NOT_OPEN"); -#ifdef BIT_64 - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.sctSapSta.spEndpId); -#else - len = len + sprintf(buf + len," %ld \n", cfm.t.ssta.s.sctSapSta.spEndpId); -#endif - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.sctSapSta.nmbPrimRetry); - len = len + sprintf(buf + len, "\n"); - } - - len = len + sprintf(buf + len, "\n"); - - stream->write_function(stream,"\n%s\n",buf); - - return FTDM_SUCCESS; - -} - -/****************************************************************************** -* Fun: handle_show_sctp_profiles() -* Desc: display all sctp profile information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: Kapil Gupta -*******************************************************************************/ -static ftdm_status_t handle_show_sctp_profiles(ftdm_stream_handle_t *stream) -{ - char* xmlhdr = (char*)""; - char buf[4096]; - int x = 0x00; - int len = 0x00; - SbMgmt cfm; - - memset((U8 *)&cfm, 0, sizeof(SbMgmt)); - memset(&buf[0], 0, sizeof(buf)); - - len = len + sprintf(buf + len, "%s\n", xmlhdr); - len = len + sprintf(buf + len, "\n"); - - if(ftmod_sctp_ssta_req(STSBGEN, 0x00, &cfm)) { - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); -#ifdef BIT_64 - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.genSta.memSize); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.genSta.memAlloc); -#else - len = len + sprintf(buf + len, " %ld \n",cfm.t.ssta.s.genSta.memSize); - len = len + sprintf(buf + len, " %ld \n",cfm.t.ssta.s.genSta.memAlloc); -#endif - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.genSta.nmbAssoc); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.genSta.nmbEndp); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.genSta.nmbLocalAddr); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.genSta.nmbPeerAddr); - len = len + sprintf(buf + len, "\n"); - } - -#ifdef LSB12 - if(ftmod_sctp_ssta_req(STSBTMR, 0x00, &cfm)) { - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.lifetimeTmr); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.ackDelayTmr); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.cookieTmr); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.keyTmr); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.freezeTmr); -#ifdef LSB4 - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.bundleTmr); -#endif - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.t1InitTmr); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.t2ShutdownTmr); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.hbeat); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.t3rtx); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.tmrSta.tIntTmr); - } - -#endif - - - /*iterate through all the sctp links and prints all information */ - x = 1; - while(x\n"); - - if(ftmod_sctp_ssta_req(STSBSCTSAP,x,&cfm)) { - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_SCTP_SAP_STATE(cfm.t.ssta.s.sapSta.hlSt)); - len = len + sprintf(buf + len," %s \n", PRNT_SCTP_PROTO_SWITCH(cfm.t.ssta.s.sapSta.swtch)); - len = len + sprintf(buf + len, "\n"); - } - - if(ftmod_sctp_ssta_req(STSBTSAP,x,&cfm)) { - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_SCTP_SAP_STATE(cfm.t.ssta.s.sapSta.hlSt)); - len = len + sprintf(buf + len," %s \n", PRNT_SCTP_PROTO_SWITCH(cfm.t.ssta.s.sapSta.swtch)); - len = len + sprintf(buf + len, "\n"); - } - - if(ftmod_sctp_ssta_req(STSBASSOC,x,&cfm)) { - if(LCM_REASON_INVALID_PAR_VAL == cfm.cfm.reason){ - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " SCT_ASSOC_STATE_CLOSED \n"); - len = len + sprintf(buf + len, "\n"); - }else{ - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } - } else { - len = len + sprintf(buf + len, "\n"); - len = len + get_assoc_resp_buf(buf + len, &cfm); - len = len + sprintf(buf + len, "\n"); - } - - /* TODO - STSBDTA */ - - len = len + sprintf(buf + len, "\n"); - } - x++; - } - - len = len + sprintf(buf + len, "\n"); - stream->write_function(stream,"\n%s\n",buf); - - return FTDM_SUCCESS; -} - -int get_assoc_resp_buf(char* buf,SbMgmt* cfm) -{ - int len = 0x00; - int idx = 0x00; - char *asciiAddr; - CmInetIpAddr ip; - -#ifdef BIT_64 - len = len + sprintf(buf + len, " %d \n", cfm->t.ssta.s.assocSta.assocId); -#else - len = len + sprintf(buf + len, " %ld \n", cfm->t.ssta.s.assocSta.assocId); -#endif - len = len + sprintf(buf + len, " %s \n", PRNT_SCTP_ASSOC_STATE(cfm->t.ssta.s.assocSta.assocState)); - len = len + sprintf(buf + len, " %d \n", cfm->t.ssta.s.assocSta.dstPort); - len = len + sprintf(buf + len, " %d \n", cfm->t.ssta.s.assocSta.srcPort); - len = len + sprintf(buf + len, " %d \n", cfm->t.ssta.s.assocSta.dstNAddrLst.nmb); - for(idx =0; idx < cfm->t.ssta.s.assocSta.dstNAddrLst.nmb; idx++) - { - len = len + sprintf(buf + len, " \n"); - len = len + sprintf(buf + len, " %s \n", PRNT_CM_ADDR_TYPE(cfm->t.ssta.s.assocSta.dstNAddrLst.nAddr[idx].type)); - if(cfm->t.ssta.s.assocSta.dstNAddrLst.nAddr[idx].type == CM_IPV4ADDR_TYPE) - { - ip = ntohl(cfm->t.ssta.s.assocSta.dstNAddrLst.nAddr[idx].u.ipv4NetAddr); - cmInetNtoa(ip, &asciiAddr); - len = len + sprintf(buf + len, " %s \n",asciiAddr); - } - else - { - len = len + sprintf(buf + len, " %s \n", cfm->t.ssta.s.assocSta.dstNAddrLst.nAddr[idx].u.ipv6NetAddr); - } - len = len + sprintf(buf + len, " \n"); - } - - len = len + sprintf(buf + len, " %d \n", cfm->t.ssta.s.assocSta.srcNAddrLst.nmb); - for(idx =0; idx < cfm->t.ssta.s.assocSta.srcNAddrLst.nmb; idx++) - { - len = len + sprintf(buf + len, " \n"); - len = len + sprintf(buf + len, " %s \n", PRNT_CM_ADDR_TYPE(cfm->t.ssta.s.assocSta.srcNAddrLst.nAddr[idx].type)); - if(cfm->t.ssta.s.assocSta.srcNAddrLst.nAddr[idx].type == CM_IPV4ADDR_TYPE) - { - ip = ntohl(cfm->t.ssta.s.assocSta.srcNAddrLst.nAddr[idx].u.ipv4NetAddr); - cmInetNtoa(ip, &asciiAddr); - len = len + sprintf(buf + len, " %s \n", asciiAddr); - } - else - { - len = len + sprintf(buf + len, " %s \n", cfm->t.ssta.s.assocSta.srcNAddrLst.nAddr[idx].u.ipv6NetAddr); - } - len = len + sprintf(buf + len, " \n"); - } - - len = len + sprintf(buf + len, "\n %s \n", PRNT_CM_ADDR_TYPE(cfm->t.ssta.s.assocSta.priNAddr.type)); - - if(cfm->t.ssta.s.assocSta.priNAddr.type == CM_IPV4ADDR_TYPE) - { - ip = ntohl(cfm->t.ssta.s.assocSta.priNAddr.u.ipv4NetAddr); - cmInetNtoa(ip, &asciiAddr); - len = len + sprintf(buf + len, " %s \n",asciiAddr); - } - else - { - len = len + sprintf(buf + len, " %s \n", cfm->t.ssta.s.assocSta.priNAddr.u.ipv6NetAddr); - } - -#ifdef LSB11 - /* TODO - this flag is not enable as of now.. so later on will convert below prints to XML tags */ - len = len + sprintf(buf + len, " The number of unsent datagrams : %d\n", cfm->t.ssta.s.assocSta.nmbUnsentDgms); - len = len + sprintf(buf + len, " The number of unack datagrams : %d\n", cfm->t.ssta.s.assocSta.nmbUnackDgms); - len = len + sprintf(buf + len, " The number of undelivered datagrams : %d\n", cfm->t.ssta.s.assocSta.nmbUndelDgms); - len = len + sprintf(buf + len, " The number of retransmissions count : %d\n", cfm->t.ssta.s.assocSta.rtxCnt); - len = len + sprintf(buf + len, " The receive window size is: %d\n\n", cfm->t.ssta.s.assocSta.SctWinSize); - for(idx =0; idx < LSB_MAX_TMRS ; idx++) - { - len = len + sprintf(buf + len, " %d) Timer state is %d\n", idx, cfm->t.ssta.s.assocSta.tmr[idx].state); - len = len + sprintf(buf + len, " %d) Timer value is %d\n", idx, cfm->t.ssta.s.assocSta.tmr[idx].tmrVal); - len = len + sprintf(buf + len, " %d) No of paths is %d\n", idx, cfm->t.ssta.s.assocSta.tmr[idx].numPaths); - for(idx1 =0; idx1 < cfm->t.ssta.s.assocSta.tmr[idx].numPaths; idx1++) - { - if( cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].localAddr.type == CM_IPV4ADDR_TYPE) - { - len = len + sprintf(buf + len, " %d) the local Addr is %d\n", idx1, - cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].localAddr.u.ipv4NetAddr); - } - else - { - len = len + sprintf(buf + len, " %d) the local Addr is %s\n", idx1, - cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].localAddr.u.ipv6NetAddr); - } - - if( cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].peerAddr.type == CM_IPV4ADDR_TYPE) - { - len = len + sprintf(buf + len, " %d) the peer Addr is %d\n", idx1, - cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].peerAddr.u.ipv4NetAddr); - } - else - { - len = len + sprintf(buf + len, " %d) the peer Addr is %s\n", idx1, - cfm->t.ssta.s.assocSta.tmr[idx].path[idx1].peerAddr.u.ipv6NetAddr); - } - } /* Loop for paths */ - } /* Loop for timers */ -#endif - - return len; -} - -/****************************************************************************** -* Fun: handle_show_sctp_profile() -* Desc: display requested sctp profile information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: Kapil Gupta -*******************************************************************************/ -static ftdm_status_t handle_show_sctp_profile(ftdm_stream_handle_t *stream, char* sctp_profile_name) -{ - char* xmlhdr = (char*)""; - char buf[4096]; - int x = 0x00; - int len = 0x00; - SbMgmt cfm; - int found = 0x00; - - memset((U8 *)&cfm, 0, sizeof(SbMgmt)); - memset(&buf[0], 0, sizeof(buf)); - - len = len + sprintf(buf + len, "%s\n", xmlhdr); - - /*iterate through all the sctp links and prints all information */ - x = 1; - while(xwrite_function(stream,"Requested SCTP profile[%s] not configured\n", sctp_profile_name); - return FTDM_FAIL; - } - - len = len + sprintf(buf + len, "\n"); - - if(ftmod_sctp_ssta_req(STSBSCTSAP,x,&cfm)) { - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_SCTP_SAP_STATE(cfm.t.ssta.s.sapSta.hlSt)); - len = len + sprintf(buf + len," %s \n", PRNT_SCTP_PROTO_SWITCH(cfm.t.ssta.s.sapSta.swtch)); - len = len + sprintf(buf + len, "\n"); - } - - if(ftmod_sctp_ssta_req(STSBTSAP,x,&cfm)) { - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_SCTP_SAP_STATE(cfm.t.ssta.s.sapSta.hlSt)); - len = len + sprintf(buf + len," %s \n", PRNT_SCTP_PROTO_SWITCH(cfm.t.ssta.s.sapSta.swtch)); - len = len + sprintf(buf + len, "\n"); - } - - if(ftmod_sctp_ssta_req(STSBASSOC,x,&cfm)) { - /* it means assoc id not yet allocated */ - if(LCM_REASON_INVALID_PAR_VAL == cfm.cfm.reason){ - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " SCT_ASSOC_STATE_CLOSED \n"); - len = len + sprintf(buf + len, "\n"); - }else{ - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } - } else { - len = len + sprintf(buf + len, "\n"); - len = len + get_assoc_resp_buf(buf + len, &cfm); - len = len + sprintf(buf + len, "\n"); - } - - /* TODO - STSBDTA */ - - len = len + sprintf(buf + len, "\n"); - - stream->write_function(stream,"\n%s\n",buf); - - return FTDM_SUCCESS; -} - -/****************************************************************************** -* Fun: handle_show_nif_profiles() -* Desc: display all nif profile information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: Kapil Gupta -*******************************************************************************/ -static ftdm_status_t handle_show_nif_profiles(ftdm_stream_handle_t *stream) -{ - char* xmlhdr = (char*)""; - char buf[4096]; - int x = 0x00; - int len = 0x00; - NwMgmt cfm; - - memset((U8 *)&cfm, 0, sizeof(NwMgmt)); - memset(&buf[0], 0, sizeof(buf)); - - len = len + sprintf(buf + len, "%s\n", xmlhdr); - len = len + sprintf(buf + len, "\n"); - - if(ftmod_nif_ssta_req(STNWGEN, 0x00, &cfm)) { - stream->write_function(stream," Request to NIF layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); -#ifdef BIT_64 - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.genSta.memSize); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.genSta.memAlloc); -#else - len = len + sprintf(buf + len, " %ld \n",cfm.t.ssta.s.genSta.memSize); - len = len + sprintf(buf + len, " %ld \n",cfm.t.ssta.s.genSta.memAlloc); -#endif - len = len + sprintf(buf + len, "\n"); - } - - /*iterate through all the NIF links and prints all information */ - x = 1; - while(x\n"); - - if(ftmod_nif_ssta_req(STNWDLSAP,x,&cfm)) { - stream->write_function(stream," Request to NIF layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.m2uaState)); - len = len + sprintf(buf + len," %s \n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.mtp2State)); -#ifdef BIT_64 - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.dlSapSta.nmbRetry); -#else - len = len + sprintf(buf + len," %ld \n", cfm.t.ssta.s.dlSapSta.nmbRetry); -#endif - len = len + sprintf(buf + len, "\n"); - } - - len = len + sprintf(buf + len, "\n"); - } - x++; - } - - len = len + sprintf(buf + len, "\n"); - stream->write_function(stream,"\n%s\n",buf); - - return FTDM_SUCCESS; -} - -/****************************************************************************** -* Fun: handle_show_nif_profile() -* Desc: display requested nif profile information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: Kapil Gupta -*******************************************************************************/ -static ftdm_status_t handle_show_nif_profile(ftdm_stream_handle_t *stream, char* nif_profile_name) -{ - char* xmlhdr = (char*)""; - char buf[4096]; - int x = 0x00; - int found = 0x00; - int len = 0x00; - NwMgmt cfm; - - memset((U8 *)&cfm, 0, sizeof(NwMgmt)); - memset(&buf[0], 0, sizeof(buf)); - - len = len + sprintf(buf + len, "%s\n", xmlhdr); - - /*iterate through all the m2ua links and get required profile */ - x = 1; - while(xwrite_function(stream,"Requested NIF profile[%s] not configured\n", nif_profile_name); - return FTDM_FAIL; - } - - - len = len + sprintf(buf + len, "\n"); - - if(ftmod_nif_ssta_req(STNWDLSAP,x,&cfm)) { - stream->write_function(stream," Request to NIF layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len," %s \n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.m2uaState)); - len = len + sprintf(buf + len," %s \n", PRNT_NIF_SAP_STATE(cfm.t.ssta.s.dlSapSta.mtp2State)); -#ifdef BIT_64 - len = len + sprintf(buf + len," %d \n", cfm.t.ssta.s.dlSapSta.nmbRetry); -#else - len = len + sprintf(buf + len," %ld \n", cfm.t.ssta.s.dlSapSta.nmbRetry); -#endif - len = len + sprintf(buf + len, "\n"); - } - - len = len + sprintf(buf + len, "\n"); - - stream->write_function(stream,"\n%s\n",buf); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -/****************************************************************************** -* Fun: handle_show_m2ua_peer_status() -* Desc: display requested m2ua profile peer information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: Kapil Gupta -*******************************************************************************/ - -static ftdm_status_t handle_show_m2ua_peer_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name) -{ - char* xmlhdr = (char*)""; - char buf[4096]; - int x = 0x00; - int found = 0x00; - int len = 0x00; - MwMgmt cfm; - SbMgmt sctp_cfm; - sng_m2ua_cluster_cfg_t* clust = NULL; - sng_m2ua_cfg_t* m2ua = NULL; - sng_m2ua_peer_cfg_t* peer = NULL; - int peer_id = 0; - int sctp_id = 0; - - memset((U8 *)&cfm, 0, sizeof(MwMgmt)); - memset((U8 *)&sctp_cfm, 0, sizeof(SbMgmt)); - memset(&buf[0], 0, sizeof(buf)); - - len = len + sprintf(buf + len, "%s\n", xmlhdr); - - /*iterate through all the m2ua links and get required profile */ - x = 1; - while(xwrite_function(stream,"Requested M2UA profile[%s] not configured\n", m2ua_profile_name); - return FTDM_FAIL; - } - - m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x]; - clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId]; - - for(x = 0; x < clust->numOfPeers;x++){ - peer_id = clust->peerIdLst[x]; - peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id]; - - if(ftmod_m2ua_ssta_req(STMWPEER, peer_id, &cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %s \n",peer->name); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.peerSta.state)); - /*len = len + sprintf(buf + len, " %s \n",(cfm.t.ssta.s.peerSta.assocSta.connected)?"CONNECTED":"NOT CONNECTED");*/ - len = len + sprintf(buf + len, "\n"); - } - - sctp_id = peer->sctpId; - - if(ftmod_sctp_ssta_req(STSBASSOC, sctp_id, &sctp_cfm)) { - if(LMW_PEER_DOWN == cfm.t.ssta.s.peerSta.state){ - /* If there is no association established so far, it will return fail..*/ - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " SCT_ASSOC_STATE_CLOSED \n"); - len = len + sprintf(buf + len, "\n"); - }else{ - stream->write_function(stream," Request to SCTP layer failed \n"); - return FTDM_FAIL; - } - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %s \n", PRNT_SCTP_ASSOC_STATE(sctp_cfm.t.ssta.s.assocSta.assocState)); - len = len + sprintf(buf + len, "\n"); - } - } - - stream->write_function(stream,"\n%s\n",buf); - - return FTDM_SUCCESS; -} - -/****************************************************************************** -* Fun: handle_show_m2ua_cluster_status() -* Desc: display requested m2ua profile cluster information -* Ret: FTDM_SUCCESS | FTDM_FAIL -* Note: -* author: Kapil Gupta -*******************************************************************************/ - -static ftdm_status_t handle_show_m2ua_cluster_status(ftdm_stream_handle_t *stream, char* m2ua_profile_name) -{ - char* xmlhdr = (char*)""; - char buf[4096]; - int x = 0x00; - int found = 0x00; - int len = 0x00; - int idx = 0x00; - MwMgmt cfm; - SbMgmt sctp_cfm; - sng_m2ua_cluster_cfg_t* clust = NULL; - sng_m2ua_cfg_t* m2ua = NULL; - - memset((U8 *)&cfm, 0, sizeof(MwMgmt)); - memset((U8 *)&sctp_cfm, 0, sizeof(SbMgmt)); - memset(&buf[0], 0, sizeof(buf)); - - len = len + sprintf(buf + len, "%s\n", xmlhdr); - - /*iterate through all the m2ua links and get required profile */ - x = 1; - while(xwrite_function(stream,"Requested M2UA profile[%s] not configured\n", m2ua_profile_name); - return FTDM_FAIL; - } - - m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x]; - clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId]; - - if(ftmod_m2ua_ssta_req(STMWCLUSTER,g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[x].clusterId,&cfm)) { - stream->write_function(stream," Request to M2UA layer failed \n"); - return FTDM_FAIL; - } else { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %s \n",clust->name); - len = len + sprintf(buf + len," %s \n", PRNT_M2UA_CLUSTER_STATE(cfm.t.ssta.s.clusterSta.state)); - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.clusterSta.nmbPeer); - for(idx = 0; idx < cfm.t.ssta.s.clusterSta.nmbPeer; idx++) - { - len = len + sprintf(buf + len, "\n"); - len = len + sprintf(buf + len, " %s \n", g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[cfm.t.ssta.s.clusterSta.peerSt[idx].peerId].name); - len = len + sprintf(buf + len, " %d \n", cfm.t.ssta.s.clusterSta.peerSt[idx].peerId); - len = len + sprintf(buf + len, " %s \n", PRNT_M2UA_PEER_STATE(cfm.t.ssta.s.clusterSta.peerSt[idx].peerState)); - len = len + sprintf(buf + len, "\n"); - } - len = len + sprintf(buf + len, " %d \n",cfm.t.ssta.s.clusterSta.nmbActPeer); - - len = len + sprintf(buf + len, "\n"); - } - - stream->write_function(stream,"\n%s\n",buf); - - return FTDM_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: - */ -/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c deleted file mode 100644 index 6b12605c6a..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c +++ /dev/null @@ -1,921 +0,0 @@ -/* - * Copyright (c) 2009, Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -int ft_to_sngss7_activate_all(void); - -static int ftmod_ss7_enable_isap(int suId); -static int ftmod_ss7_enable_nsap(int suId); -static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId); - - -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ -int ft_to_sngss7_activate_all(void) -{ - int x; - - x = 1; - while (x < (MAX_ISAPS)) { - /* check if this link has already been actived */ - if ((g_ftdm_sngss7_data.cfg.isap[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_ACTIVE))) { - - if (ftmod_ss7_enable_isap(x)) { - SS7_CRITICAL("ISAP %d Enable: NOT OK\n", x); - return 1; - } else { - SS7_INFO("ISAP %d Enable: OK\n", x); - } - - /* set the SNGSS7_ACTIVE flag */ - g_ftdm_sngss7_data.cfg.isap[x].flags |= SNGSS7_ACTIVE; - } /* if !SNGSS7_ACTIVE */ - - x++; - } /* while (x < (MAX_ISAPS)) */ - - if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){ - x = 1; - while (x < (MAX_NSAPS)) { - /* check if this link has already been actived */ - if ((g_ftdm_sngss7_data.cfg.nsap[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_ACTIVE))) { - - if (ftmod_ss7_enable_nsap(x)) { - SS7_CRITICAL("NSAP %d Enable: NOT OK\n", x); - return 1; - } else { - SS7_INFO("NSAP %d Enable: OK\n", x); - } - - /* set the SNGSS7_ACTIVE flag */ - g_ftdm_sngss7_data.cfg.nsap[x].flags |= SNGSS7_ACTIVE; - } /* if !SNGSS7_ACTIVE */ - - x++; - } /* while (x < (MAX_NSAPS)) */ - - if (g_ftdm_sngss7_data.cfg.mtpRoute[1].id != 0) { - x = 1; - while (x < (MAX_MTP_LINKSETS+1)) { - /* check if this link has already been actived */ - if ((g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) && - (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_ACTIVE))) { - - if (ftmod_ss7_enable_mtpLinkSet(x)) { - SS7_CRITICAL("LinkSet \"%s\" Enable: NOT OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); - return 1; - } else { - SS7_INFO("LinkSet \"%s\" Enable: OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); - } - - /* set the SNGSS7_ACTIVE flag */ - g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= SNGSS7_ACTIVE; - } /* if !SNGSS7_ACTIVE */ - - x++; - } /* while (x < (MAX_MTP_LINKSETS+1)) */ - } - } - - if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){ - return ftmod_ss7_m2ua_start(); - } - - return 0; -} - -/******************************************************************************/ -static int ftmod_ss7_enable_isap(int suId) -{ - CcMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTCC; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(CcMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTCC; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STISAP; - - cntrl.hdr.elmId.elmntInst1 = suId; /* this is the SAP to bind */ - - cntrl.t.cntrl.action = ABND_ENA; /* bind and activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_cc(&pst, &cntrl)); -} - -/******************************************************************************/ -static int ftmod_ss7_enable_nsap(int suId) -{ - SiMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SiMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSI; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STNSAP; - - cntrl.t.cntrl.s.siElmnt.elmntId.sapId = suId; - cntrl.t.cntrl.s.siElmnt.elmntParam.nsap.nsapType = SAP_MTP; - - - cntrl.t.cntrl.action = ABND_ENA; /* bind and activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_isup(&pst, &cntrl)); -} - -/******************************************************************************/ -static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STLNKSET; - cntrl.hdr.elmId.elmntInst1 = lnkSetId; /* this is the linkset to bind */ - - cntrl.t.cntrl.action = ABND_ENA; /* bind and activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_inhibit_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = id; /* the DSLAP to inhibit */ - - cntrl.t.cntrl.action = AINH; /* Inhibit */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_uninhibit_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = id; /* the DSLAP to inhibit */ - - cntrl.t.cntrl.action = AUNINH; /* Inhibit */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_bind_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp3Link[id].id; - - cntrl.t.cntrl.action = ABND; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_unbind_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp3Link[id].id; - - cntrl.t.cntrl.action = AUBND_DIS; /* unbind and disable */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_activate_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp3Link[id].id; - - cntrl.t.cntrl.action = AENA; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_deactivate_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp3Link[id].id; - - cntrl.t.cntrl.action = ADISIMM; /* Deactivate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_deactivate2_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp3Link[id].id; - - cntrl.t.cntrl.action = ADISIMM_L2; /* Deactivate...layer 2 only */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_activate_mtplinkSet(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STLNKSET; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; - - cntrl.t.cntrl.action = AACTLNKSET; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_deactivate_mtplinkSet(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STLNKSET; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; - - cntrl.t.cntrl.action = ADEACTLNKSET; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STLNKSET; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; - - cntrl.t.cntrl.action = ADEACTLNKSET_L2; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_lpo_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp3Link[id].id; - - cntrl.t.cntrl.action = ACTION_LPO; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_lpr_mtp3link(uint32_t id) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STDLSAP; - cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp3Link[id].id; - - cntrl.t.cntrl.action = ACTION_LPR; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_shutdown_isup(void) -{ - SiMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SiMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSI; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STGEN; - - cntrl.t.cntrl.action = ASHUTDOWN; /* shutdown */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_isup(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_shutdown_mtp3(void) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STGEN; - - cntrl.t.cntrl.action = ASHUTDOWN; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp3(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_shutdown_mtp2(void) -{ - SdMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSD; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SdMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSD; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STGEN; - - cntrl.t.cntrl.action = ASHUTDOWN; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_mtp2(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_shutdown_relay(void) -{ - RyMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTRY; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(RyMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTRY; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STGEN; - - cntrl.t.cntrl.action = ASHUTDOWN; /* Activate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_relay(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_disable_relay_channel(uint32_t chanId) -{ - RyMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTRY; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(RyMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTRY; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STGEN; - - - cntrl.hdr.elmId.elmntInst1 = chanId; - - cntrl.t.cntrl.action = ADISIMM; /* Deactivate */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_relay(&pst, &cntrl)); -} - -/******************************************************************************/ -int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STGRDLSAP; /* group DLSAP */ - - cntrl.t.cntrl.ctlType.groupKey.dstProcId = procId; /* all SAPS to this ProcId */ - - cntrl.t.cntrl.action = AUBND_DIS; /* disable and unbind */ - cntrl.t.cntrl.subAction = SAGR_DSTPROCID; /* specificed element */ - - if (g_ftdm_sngss7_data.cfg.procId == procId) { - SS7_DEBUG("Executing MTP3 cntrl command local pid =%i\n",procId); - return (sng_cntrl_mtp3(&pst, &cntrl)); - } else { - SS7_WARN("Executing MTP3 cntrl command different local=%i target=%i\n", - g_ftdm_sngss7_data.cfg.procId,procId); - return (sng_cntrl_mtp3_nowait(&pst, &cntrl)); - } - -} - -/******************************************************************************/ -int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId) -{ - SnMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SnMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSN; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STGRDLSAP; /* group DLSAP */ - - cntrl.t.cntrl.ctlType.groupKey.dstProcId = procId; /* all SAPS to this ProcId */ - - cntrl.t.cntrl.action = ABND_ENA; /* bind and enable */ - cntrl.t.cntrl.subAction = SAGR_DSTPROCID; /* specificed element */ - - if (g_ftdm_sngss7_data.cfg.procId == procId) { - SS7_DEBUG("Executing MTP3 cntrl command local pid =%i\n",procId); - return (sng_cntrl_mtp3(&pst, &cntrl)); - } else { - SS7_WARN("Executing MTP3 cntrl command different local=%i target=%i\n", - g_ftdm_sngss7_data.cfg.procId,procId); - return (sng_cntrl_mtp3_nowait(&pst, &cntrl)); - } - -} - -/******************************************************************************/ -int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId) -{ - SdMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSD; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(cntrl)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSD; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STGRNSAP; /* group NSAP */ - - cntrl.t.cntrl.par.dstProcId = procId; /* all SAPS to this ProcId */ - - cntrl.t.cntrl.action = AUBND_DIS; /* disable and unbind */ - cntrl.t.cntrl.subAction = SAGR_DSTPROCID; /* specificed element */ - - return (sng_cntrl_mtp2(&pst, &cntrl)); - -} - -/******************************************************************************/ -int __ftmod_ss7_block_isup_ckt(uint32_t cktId, ftdm_bool_t wait) -{ - SiMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SiMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSI; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STICIR; - - cntrl.t.cntrl.s.siElmnt.elmntId.circuit = cktId; - cntrl.t.cntrl.s.siElmnt.elmntParam.cir.flag = LSI_CNTRL_CIR_FORCE; - - cntrl.t.cntrl.action = ADISIMM; /* block via BLO */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - if (wait == FTDM_TRUE) { - return (sng_cntrl_isup(&pst, &cntrl)); - } else { - return (sng_cntrl_isup_nowait(&pst, &cntrl)); - } -} - -/******************************************************************************/ -int ftmod_ss7_unblock_isup_ckt(uint32_t cktId) -{ - SiMngmt cntrl; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /* initalize the control structure */ - memset(&cntrl, 0x0, sizeof(SiMngmt)); - - /* initalize the control header */ - smHdrInit(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* this is a control request */ - cntrl.hdr.entId.ent = ENTSI; - cntrl.hdr.entId.inst = S_INST; - cntrl.hdr.elmId.elmnt = STICIR; - - cntrl.t.cntrl.s.siElmnt.elmntId.circuit = cktId; - cntrl.t.cntrl.s.siElmnt.elmntParam.cir.flag = LSI_CNTRL_CIR_FORCE; - - cntrl.t.cntrl.action = AENA; /* unblock via UBL */ - cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ - - return (sng_cntrl_isup(&pst, &cntrl)); -} -/******************************************************************************/ -/* For Emacs: - * Local Variables: - * 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c deleted file mode 100644 index f120114667..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ /dev/null @@ -1,2750 +0,0 @@ -/* - * Copyright (c) 2009 Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms|with or without - * modification|are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice|this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice|this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT - * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL, - * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Ricardo Barroetaveña - * James Zhang - * - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" - -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ - -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); -ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); -ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); -ftdm_status_t handle_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt); -ftdm_status_t handle_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt); -ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_olm_msg(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ - -#define ftdm_running_return(var) if (!ftdm_running()) { SS7_ERROR("Error: ftdm_running is not set! Ignoring\n"); return var; } - -ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - char var[FTDM_DIGITS_LIMIT]; - - memset(var, '\0', sizeof(var)); - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) { - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM (glare)\n", sngss7_info->circuit->cic); - } - - /* check if the circuit has a remote block */ - if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { - - /* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX_DN); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX_DN); - - /* KONRAD FIX ME : check in case there is a ckt and grp block */ - } - - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_TX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_SENT); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_RX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_RX_DN); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INF_TX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INF_SENT); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INF_RX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INF_RX_DN); - sngss7_clear_ckt_flag(sngss7_info, FLAG_FULL_NUMBER); - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case (FTDM_CHANNEL_STATE_DOWN): /* only state it is valid to get IAM (except if there is glare */ - - /* check if there is any reason why we can't use this channel */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - /* channel is already requested for use by the ftdm core */ - goto handle_glare; - } else if(ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - /* channel is not inuse but we can't open it...fail the call */ - SS7_ERROR("Failed to open span: %d, chan: %d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_ckt_flag(sngss7_info, FLAG_LOCAL_REL); - - ftdmchan->caller_data.hangup_cause = 41; - - /* move the state to CANCEL */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - - } else { - - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - - /* fill in calling party information */ - if (siConEvnt->cgPtyNum.eh.pres) { - if (siConEvnt->cgPtyNum.addrSig.pres) { - /* fill in cid_num */ - copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, - ftdmchan->caller_data.cid_num.digits, - siConEvnt->cgPtyNum.oddEven); - - /* fill in cid Name */ - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); - - /* fill in ANI */ - ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); - } - else { - if (g_ftdm_sngss7_data.cfg.force_inr) { - sngss7_set_ckt_flag(sngss7_info, FLAG_INR_TX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_SENT); - } - } - - if (siConEvnt->cgPtyNum.scrnInd.pres) { - /* fill in the screening indication value */ - ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; - } - - if (siConEvnt->cgPtyNum.presRest.pres) { - /* fill in the presentation value */ - ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; - } - } else { - if (g_ftdm_sngss7_data.cfg.force_inr) { - sngss7_set_ckt_flag(sngss7_info, FLAG_INR_TX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_SENT); - } - - SS7_INFO_CHAN(ftdmchan,"No Calling party (ANI) information in IAM!%s\n", " "); - } - - /* fill in called party infomation */ - if (siConEvnt->cdPtyNum.eh.pres) { - if (siConEvnt->cdPtyNum.addrSig.pres) { - /* fill in the called number/dnis */ - copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, - ftdmchan->caller_data.dnis.digits, - siConEvnt->cdPtyNum.oddEven); - } - } else { - SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " "); - } - copy_NatureOfConnection_from_sngss7(ftdmchan, &siConEvnt->natConInd); - copy_fwdCallInd_hex_from_sngss7(ftdmchan, &siConEvnt->fwdCallInd); - copy_access_transport_from_sngss7(ftdmchan, &siConEvnt->accTrnspt); - copy_ocn_from_sngss7(ftdmchan, &siConEvnt->origCdNum); - copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum); - copy_redirgInfo_from_sngss7(ftdmchan, &siConEvnt->redirInfo); - copy_genNmb_from_sngss7(ftdmchan, &siConEvnt->genNmb); - - copy_cgPtyCat_from_sngss7(ftdmchan, &siConEvnt->cgPtyCat); - copy_cdPtyNum_from_sngss7(ftdmchan, &siConEvnt->cdPtyNum); - - /* fill in the TMR/bearer capability */ - if (siConEvnt->txMedReq.eh.pres) { - if (siConEvnt->txMedReq.trMedReq.pres) { - /* fill in the bearer type */ - ftdmchan->caller_data.bearer_capability = siConEvnt->txMedReq.trMedReq.val; - } - } else { - SS7_DEBUG_CHAN(ftdmchan,"No TMR/Bearer Cap information in IAM!%s\n", " "); - } - - /* add any special variables for the dialplan */ - sprintf(var, "%d", siConEvnt->cgPtyNum.natAddrInd.val); - sngss7_add_var(sngss7_info, "ss7_clg_nadi", var); - - /* Retrieve the Location Number if present (see ITU Q.763, 3.30) */ - if (siConEvnt->cgPtyNum1.eh.pres) { - if (siConEvnt->cgPtyNum1.addrSig.pres) { - /* fill in the ss7 location address number */ - copy_tknStr_from_sngss7(siConEvnt->cgPtyNum1.addrSig, var, siConEvnt->cgPtyNum1.oddEven); - sngss7_add_var(sngss7_info, "ss7_loc_digits", var); - } - - if (siConEvnt->cgPtyNum1.scrnInd.pres) { - /* fill in the screening indication value */ - sprintf(var, "%d", siConEvnt->cgPtyNum1.scrnInd.val); - sngss7_add_var(sngss7_info, "ss7_loc_screen_ind", var); - } - - if (siConEvnt->cgPtyNum1.presRest.pres) { - /* fill in the presentation value */ - sprintf(var, "%d", siConEvnt->cgPtyNum1.presRest.val); - sngss7_add_var(sngss7_info, "ss7_loc_pres_ind", var); - } - - if (siConEvnt->cgPtyNum1.natAddrInd.pres) { - sprintf(var, "%d", siConEvnt->cgPtyNum1.natAddrInd.val); - sngss7_add_var(sngss7_info, "ss7_loc_nadi", var); - } - } else { - SS7_DEBUG_CHAN(ftdmchan, "No Location Number information in IAM%s\n", " "); - } - - sprintf(var, "%d", sngss7_info->circuit->cic); - sngss7_add_var(sngss7_info, "ss7_cic", var); - - - sprintf(var, "%d", g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].dpc ); - sngss7_add_var(sngss7_info, "ss7_opc", var); - - if (siConEvnt->callRef.callId.pres) { - ftdmchan->caller_data.call_reference = (unsigned int)siConEvnt->callRef.callId.val; - } else { - ftdmchan->caller_data.call_reference = 0; - } - - if (sngss7_info->circuit->transparent_iam) { - sngss7_save_iam(ftdmchan, siConEvnt); - } - - /* check if a COT test is requested */ - if ((siConEvnt->natConInd.eh.pres) && - (siConEvnt->natConInd.contChkInd.pres) && - (siConEvnt->natConInd.contChkInd.val)) { - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Found COT Request\n", sngss7_info->circuit->cic); - - /* tell the core to loop the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL); - - /* move to in loop state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP); - } else { - /* set the state of the channel to collecting...the rest is done by the chan monitor */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - } - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM clg = \"%s\" (NADI=%d), cld = \"%s\" (NADI=%d)\n", - sngss7_info->circuit->cic, - ftdmchan->caller_data.cid_num.digits, - siConEvnt->cgPtyNum.natAddrInd.val, - ftdmchan->caller_data.dnis.digits, - siConEvnt->cdPtyNum.natAddrInd.val); - } /* if (channel is usable */ - - break; - /**************************************************************************/ - case (FTDM_CHANNEL_STATE_DIALING): - case (FTDM_CHANNEL_STATE_TERMINATING): - case (FTDM_CHANNEL_STATE_HANGUP): - case (FTDM_CHANNEL_STATE_HANGUP_COMPLETE): -handle_glare: - /* the core already has plans for this channel...glare */ - SS7_INFO_CHAN(ftdmchan, "Got IAM on channel that is already inuse (state=%s|inuse=%c)...glare!\n", - ftdm_channel_state2str (ftdmchan->state), - ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) ? 'Y' : 'N'); - - /* save the info so that we can use it later on */ - sngss7_info->glare.spInstId = spInstId; - sngss7_info->glare.circuit = circuit; - memcpy(&sngss7_info->glare.iam, siConEvnt, sizeof(*siConEvnt)); - - if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE))) { - /* glare, throw the flag */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GLARE); - - /* setup the hangup cause */ - ftdmchan->caller_data.hangup_cause = 34; /* Circuit Congrestion */ - - /* move the state of the channel to Terminating to end the call - in TERMINATING state, the release cause is set to REMOTE_REL - in any means. So we don't have to set the release reason here. - */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - } - break; - /**************************************************************************/ - default: /* should not have gotten an IAM while in this state */ - SS7_ERROR_CHAN(ftdmchan, "Got IAM on channel in invalid state(%s)...reset!\n", ftdm_channel_state2str (ftdmchan->state)); - - /* throw the TX reset flag */ - if (!sngss7_tx_reset_status_pending(sngss7_info)) { - sngss7_tx_reset_restart(sngss7_info); - sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - - /* go to RESTART */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - switch (evntType) { - /**************************************************************************/ - case (ADDRCMPLT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ACM\n", sngss7_info->circuit->cic); - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - /* KONRAD: should we confirm the instance ids ? */ - - /* need to grab the sp instance id */ - sngss7_info->spInstId = spInstId; - - if ((siCnStEvnt->optBckCalInd.eh.pres) && - (siCnStEvnt->optBckCalInd.inbndInfoInd.pres)) { - - if (siCnStEvnt->optBckCalInd.inbndInfoInd.val) { - /* go to PROGRESS_MEDIA */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else { - /* go to PROGRESS */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - } /* if (inband) */ - } else { - /* go to PROGRESS_MEDIA */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } - - break; - /**********************************************************************/ - default: /* incorrect state...reset the CIC */ - SS7_ERROR_CHAN(ftdmchan, "RX ACM in invalid state :%s...resetting CIC\n", - ftdm_channel_state2str (ftdmchan->state)); - - /* throw the TX reset flag */ - if (!sngss7_tx_reset_status_pending(sngss7_info)) { - sngss7_tx_reset_restart(sngss7_info); - sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - - /* go to RESTART */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - break; - /**********************************************************************/ - } /* switch (ftdmchan->state) */ - - break; - /**************************************************************************/ - case (MODIFY): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MODIFY\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (MODCMPLT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MODIFY-COMPLETE\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (MODREJ): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MODIFY-REJECT\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (PROGRESS): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CPG\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (FRWDTRSFR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx FOT\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (INFORMATION): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx INF\n", sngss7_info->circuit->cic); - - SS7_DEBUG_CHAN (ftdmchan, "Cancelling T.39 timer %s\n", " "); - /* check if t39 is active */ - if (sngss7_info->t39.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t39.sched, sngss7_info->t39.hb_timer_id); - SS7_DEBUG_CHAN (ftdmchan, "T.39 timer has been cancelled upon receiving INF message %s\n", " "); - } - - sngss7_set_ckt_flag(sngss7_info, FLAG_INF_RX_DN); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - case (INFORMATREQ): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx INR\n", sngss7_info->circuit->cic); - - ft_to_sngss7_inf(ftdmchan, siCnStEvnt); - - sngss7_set_ckt_flag(sngss7_info, FLAG_INR_RX); - - break; - /**************************************************************************/ - case (SUBSADDR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SAM\n", sngss7_info->circuit->cic); - - /* check the channel state */ - switch (ftdmchan->state) { - /**********************************************************************/ - case (FTDM_CHANNEL_STATE_COLLECT): - - /* confirm that the event contains the subsquent number field */ - if (siCnStEvnt->subNum.eh.pres && siCnStEvnt->subNum.addrSig.pres) { - /* add the digits to the ftdm channel variable */ - append_tknStr_from_sngss7(siCnStEvnt->subNum.addrSig, - ftdmchan->caller_data.dnis.digits, - siCnStEvnt->subNum.oddEven); - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Rx SAM (digits = %s)\n", sngss7_info->circuit->cic, - ftdmchan->caller_data.dnis.digits); - } else { - SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in SAM!%s\n", " "); - } - - /* go to idle so that collect state is processed again */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**********************************************************************/ - default: - SS7_ERROR_CHAN(ftdmchan, "RX SAM in invalid state :%s...ignoring\n", - ftdm_channel_state2str (ftdmchan->state)); - break; - /**********************************************************************/ - } /* switch (ftdmchan->state) */ - - break; - /**************************************************************************/ - case (EXIT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx EXIT\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (NETRESMGT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx NRM\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (IDENTREQ): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IDR\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (IDENTRSP): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IRS\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (MALCLLPRNT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MALICIOUS CALL\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CHARGE): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CRG\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (TRFFCHGE): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CRG-TARIFF\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CHARGEACK): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CRG-ACK\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CALLOFFMSG): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CALL-OFFER\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (LOOPPRVNT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LOP\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (TECT_TIMEOUT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ECT-Timeout\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (RINGSEND): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RINGING-SEND\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CALLCLEAR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CALL-LINE Clear\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (PRERELEASE): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx PRI\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (APPTRANSPORT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx APM\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (OPERATOR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx OPERATOR\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (METPULSE): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx METERING-PULSE\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CLGPTCLR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CALLING_PARTY_CLEAR\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (SUBDIRNUM): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SUB-DIR\n", sngss7_info->circuit->cic); - break; -#ifdef SANGOMA_SPIROU - case (CHARGE_ACK): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx TXA\n", sngss7_info->circuit->cic); - break; - case (CHARGE_UNIT): - { - uint32_t charging_unit = 0; - uint32_t msg_num = 0; - char val[3]; - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ITX\n", sngss7_info->circuit->cic); - - memset(val, '\0', sizeof(val)); - - if (siCnStEvnt->chargUnitNum.eh.pres == PRSNT_NODEF && - siCnStEvnt->chargUnitNum.chargUnitNum.pres == PRSNT_NODEF) { - - charging_unit = siCnStEvnt->chargUnitNum.chargUnitNum.val; - } - - if (siCnStEvnt->msgNum.eh.pres == PRSNT_NODEF && - siCnStEvnt->msgNum.msgNum.pres == PRSNT_NODEF) { - - msg_num = siCnStEvnt->msgNum.msgNum.val; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Charging Unit:%d Msg Num:%d\n", charging_unit, msg_num); - - sprintf(val, "%d", charging_unit); - sngss7_add_var(sngss7_info, "ss7_itx_charge_unit", val); - - sprintf(val, "%d", msg_num); - sngss7_add_var(sngss7_info, "ss7_itx_msg_num", val); - - if (sngss7_info->circuit->itx_auto_reply) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Auto-reply with TXA msg\n"); - ft_to_sngss7_txa (ftdmchan); - } - } - break; -#endif - /**************************************************************************/ - default: - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Unknown Msg\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ANM\n", sngss7_info->circuit->cic); - - /* go to UP */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CON\n", sngss7_info->circuit->cic); - - /* go to UP */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* already hangup complete, just ignore it */ - /* - * i.e. collision REL & ANM - * IAM -> - * <- ACM - * REL -> <- ANM (if REL gets processed first, ANM needs to be ignored) - * <- RLC - */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ANM/CON Ignoring it because we already hung up\n", sngss7_info->circuit->cic); - - break; - /**************************************************************************/ - default: /* incorrect state...reset the CIC */ - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ANM/CON\n", sngss7_info->circuit->cic); - - /* throw the TX reset flag */ - if (!sngss7_tx_reset_status_pending(sngss7_info)) { - sngss7_tx_reset_restart(sngss7_info); - sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - - /* go to RESTART */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx REL cause=%d\n", - sngss7_info->circuit->cic, - siRelEvnt->causeDgn.causeVal.val); - - /* check whether the ftdm channel is in a state to release a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - - /* pass the release code up to FTDM */ - if (siRelEvnt->causeDgn.causeVal.pres) { - ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; - } else { - SS7_ERROR("REL does not have a cause code!\n"); - ftdmchan->caller_data.hangup_cause = 0; - } - - /* this is a remote hangup request */ - sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); - /* move the state of the channel to CANCEL to end the call */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_RINGING: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - - /* pass the release code up to FTDM */ - if (siRelEvnt->causeDgn.causeVal.pres) { - ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; - } else { - SS7_ERROR("REL does not have a cause ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);code!\n"); - ftdmchan->caller_data.hangup_cause = 0; - } - - /* this is a remote hangup request */ - sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL); - - /* move the state of the channel to TERMINATING to end the call */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* ITU Q.764 2.3.1 e) - * Collision of release messages - * - * ITU Q.784 Test Number 3.8 - * Collision of REL messages - */ - SS7_DEBUG_CHAN(ftdmchan, "Collision of REL messages. Rx REL while waiting for RLC.%s\n", " "); - if (sngss7_test_ckt_flag(sngss7_info, FLAG_LOCAL_REL) && - !sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) { - /* locally requested hangup completed, wait for remote RLC */ - /* need to perform remote release */ - - /* this is also a remote hangup request */ - sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL); - - /* send out the release complete */ - ft_to_sngss7_rlc (ftdmchan); - } else { - SS7_DEBUG_CHAN(ftdmchan, "Collision of REL messages - resetting state.%s\n", " "); - ft_to_sngss7_rlc (ftdmchan); - goto rel_ind_reset; - } - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_IN_LOOP: - - /* inform the core to unloop the channel*/ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); - - /* since we need to acknowledge the hang up set the flag for remote release */ - sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL); - - /* go to hangup complete to send the RLC */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - - /* save the call info for the RLC */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - - break; - /**************************************************************************/ - default: - -rel_ind_reset: - /* throw the TX reset flag */ - if (!sngss7_tx_reset_status_pending(sngss7_info)) { - sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - sngss7_tx_reset_restart(sngss7_info); - - /* go to RESTART */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ - - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RLC\n", sngss7_info->circuit->cic); - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* go to DOWN */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - /* do nothing, just drop the message */ - break; - /**************************************************************************/ - default: - /* KONRAD: should just stop the call...but a reset is easier for now (since it does hangup the call) */ - - /* go to RESTART */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx DATA IND\n", sngss7_info->circuit->cic); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx FAC\n", sngss7_info->circuit->cic); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx FAC-CON\n", sngss7_info->circuit->cic); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx USER-USER msg\n", sngss7_info->circuit->cic); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Call-Suspend msg\n", sngss7_info->circuit->cic); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - ftdm_running_return(FTDM_FAIL); - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Call-Resume msg\n", sngss7_info->circuit->cic); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is active on our side otherwise move to the next circuit */ - if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[circuit], SNGSS7_ACTIVE)) { - SS7_ERROR("[CIC:%d]Rx %s but circuit is not active yet, skipping!\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - return FTDM_FAIL; - } - - switch (evntType) { - /**************************************************************************/ - case SIT_STA_REATTEMPT: /* reattempt indication */ - handle_reattempt(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_ERRORIND: /* error indication */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CONTCHK: /* continuity check */ - handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CONTREP: /* continuity report */ - handle_cot(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_STPCONTIN: /* stop continuity */ - handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGQRYRSP: /* circuit grp query response from far end forwarded to upper layer by ISUP */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CONFUSION: /* confusion */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LOOPBACKACK: /* loop-back acknowledge */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRRSRVREQ: /* circuit reservation request */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRRSRVACK: /* circuit reservation acknowledgement */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRBLOREQ: /* circuit blocking request */ - handle_blo_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRBLORSP: /* circuit blocking response */ - handle_blo_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUBLREQ: /* circuit unblocking request */ - handle_ubl_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUBLRSP: /* circuit unblocking response */ - handle_ubl_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRRESREQ: /* circuit reset request - RSC */ - handle_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCRES: /* reset initiated locally by the software */ - handle_local_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRRESRSP: /* circuit reset response */ - handle_rsc_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGBREQ: /* CGB request */ - handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGUREQ: /* CGU request */ - handle_cgu_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGQRYREQ: /* circuit group query request */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ - SS7_INFO(" Rx CGBA \n"); - break; - /**************************************************************************/ - case SIT_STA_CGURSP: /* mntc. oriented CGU response */ - /*SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType));*/ - SS7_INFO(" Rx CGUA \n"); - break; - /**************************************************************************/ - case SIT_STA_GRSREQ: /* circuit group reset request */ - handle_grs_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUNEQPD: /* circuit unequipped indication */ - handle_ucic(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_GRSRSP: /* circuit group reset response */ - handle_grs_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_PAUSEIND: /* pause indication */ - handle_pause(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_RESUMEIND: /* resume indication */ - handle_resume(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_USRPARTA: /* user part available */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_RMTUSRUNAV: /* remote user not available */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG0: /* congestion indication level 0 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG1: /* congestion indication level 1 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG2: /* congestion indication level 2 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG3: /* congestion indication level 3 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPSTPCONG: /* stop congestion indication level 0 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCALBLOIND: /* Mngmt local blocking */ - handle_local_blk(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCALUBLIND: /* Mngmt local unblocking */ - handle_local_ubl(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_OVERLOAD: /* Overload */ - handle_olm_msg(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_LMCGBREQ: /* when LM requests ckt grp blocking */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCGUREQ: /* when LM requests ckt grp unblocking */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMGRSREQ: /* when LM requests ckt grp reset */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGBINFOIND: /* circuit grp blking ind , no resp req */ -/* handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);*/ - break; - /**************************************************************************/ - case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ -// SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCGRS: /* group reset initiated locally by the software */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - default: - SS7_INFO("[SNG-CC] Received Unknown indication %d\n", evntType); - break; - } /* switch (evntType) */ - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; - -} - -/******************************************************************************/ -ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) { - /* the glare flag is already up so it was caught ... do nothing */ - SS7_DEBUG_CHAN(ftdmchan, "Glare flag is already up...nothing to do!%s\n", " "); - } else { - int bHangup = 0; - SS7_DEBUG_CHAN(ftdmchan, "Glare flag is not up yet...indicating glare from reattempt!%s\n", " "); - /* glare, throw the flag */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GLARE); - - /* clear any existing glare data from the channel */ - memset(&sngss7_info->glare, 0x0, sizeof(sngss7_glare_data_t)); - - if (g_ftdm_sngss7_data.cfg.glareResolution == SNGSS7_GLARE_DOWN) { - /* If I'm in DOWN mode, I will always hangup my call. */ - bHangup = 1; - } - else if (g_ftdm_sngss7_data.cfg.glareResolution == SNGSS7_GLARE_PC) { - /* I'm in PointCode mode. - Case 1: My point code is higher than the other side. - If the CIC number is even, I'm trying to control. - If the CIC number is odd, I'll hangup my call and back off. - Case 2: My point code is lower than the other side. - If the CIC number is odd, I'm trying to control. - If the CIC number is even, I'll hangup my call and back off. - */ - if( g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].spc > g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].dpc ) - { - if ((sngss7_info->circuit->cic % 2) == 1 ) { - bHangup = 1; - } - } else { - if( (sngss7_info->circuit->cic % 2) == 0 ) { - bHangup = 1; - } - } - } - else { - /* If I'm in CONTROL mode, I will not hangup my call. */ - bHangup = 0; - } - - if (bHangup) { - /* setup the hangup cause */ - ftdmchan->caller_data.hangup_cause = 34; /* Circuit Congrestion */ - - /* move the state of the channel to Terminating to end the call - in TERMINATING state, the release cause is set to REMOTE_REL - in any means. So we don't have to set the release reason here. - */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - } - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int infId; - int i; - - ftdm_running_return(FTDM_FAIL); - - /* extract the affected infId from the circuit structure */ - infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; - - /* set the interface to paused */ - sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[infId], SNGSS7_PAUSED); - - /* go through all the circuits now and find any other circuits on this infId */ - i = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { - - /* check that the infId matches and that this is not a siglink */ - if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && - (g_ftdm_sngss7_data.cfg.isupCkt[i].type == SNG_CKT_VOICE)) { - - /* confirm that the circuit is active on our side otherwise move to the next circuit */ - if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[i], SNGSS7_ACTIVE)) { - SS7_ERROR("[CIC:%d]Circuit is not active yet, skipping!\n",g_ftdm_sngss7_data.cfg.isupCkt[i].cic); - i++; - continue; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - i++; - continue; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if the circuit is fully started */ - if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_IN_THREAD)) { - SS7_DEBUG_CHAN(ftdmchan, "Rx PAUSE%s\n", ""); - /* set the pause flag on the channel */ - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - - /* clear the resume flag on the channel */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) */ - - /* move to the next circuit */ - i++; - - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) */ - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int infId; - int i; - - ftdm_running_return(FTDM_FAIL); - - /* extract the affect infId from the circuit structure */ - infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; - - /* set the interface to resumed */ - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg.isupIntf[infId], SNGSS7_PAUSED); - - /* go through all the circuits now and find any other circuits on this infId */ - i = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { - - /* check that the infId matches and that this is not a siglink */ - if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && - (g_ftdm_sngss7_data.cfg.isupCkt[i].type == SNG_CKT_VOICE)) { - - /* confirm that the circuit is active on our side otherwise move to the next circuit */ - if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[i], SNGSS7_ACTIVE)) { - ftdm_log(FTDM_LOG_DEBUG, "[CIC:%d]Circuit is not active yet, skipping!\n",g_ftdm_sngss7_data.cfg.isupCkt[i].cic); - i++; - continue; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - i++; - continue; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* only resume if we are paused */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { - SS7_DEBUG_CHAN(ftdmchan, "Rx RESUME%s\n", ""); - - /* set the resume flag on the channel */ - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - - /* clear the paused flag */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) */ - - /* move to the next circuit */ - i++; - - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) */ - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* open the channel if it is not open */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - SS7_ERROR("Failed to open CIC %d for CCR test!\n", sngss7_info->circuit->cic); - /* KONRAD FIX ME */ - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - } - - /* tell the core to loop the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL); - - /* switch to the IN_LOOP state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* tell the core to stop looping the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); - - /* exit out of the LOOP state to the last state */ - ftdm_set_state(ftdmchan, ftdmchan->last_state); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - switch (ftdmchan->state) { - /**************************************************************************/ - case (FTDM_CHANNEL_STATE_IN_LOOP): - /* tell the core to stop looping the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); - - /* exit out of the LOOP state and go to collect */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - - break; - /**************************************************************************/ - default: - /* exit out of the LOOP state to the last state */ - ftdm_set_state(ftdmchan, ftdmchan->last_state); - - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ - - if ( (siStaEvnt->contInd.eh.pres > 0) && (siStaEvnt->contInd.contInd.pres > 0)) { - SS7_INFO("Continuity Test result for CIC = %d (span %d, chan %d) is: \"%s\"\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - g_ftdm_sngss7_data.cfg.isupCkt[circuit].span, - g_ftdm_sngss7_data.cfg.isupCkt[circuit].chan, - (siStaEvnt->contInd.contInd.val) ? "PASS" : "FAIL"); - } else { - SS7_ERROR("Recieved Continuity report containing no results!\n"); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if the circuit is already blocked or not */ - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { - SS7_WARN("Received BLO on circuit that is already blocked!\n"); - } - - /* throw the ckt block flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); - - /* set the channel to suspended state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* KONRAD FIX ME */ - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if the channel is blocked */ - if (!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) && !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) { - SS7_WARN("Received UBL on circuit that is not blocked! span= %d, chan= %d , flag = %x \n", g_ftdm_sngss7_data.cfg.isupCkt[circuit].span, g_ftdm_sngss7_data.cfg.isupCkt[circuit].chan,sngss7_info->blk_flags ); - } - - /* throw the unblock flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); - - /* clear the block flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX_DN); - - /* set the channel to suspended state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* throw the reset flag */ - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* throw the reset flag */ - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - if ( sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX) ) { - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - SS7_ERROR("Received RSC-RLC but we're not waiting on a RSC-RLC on CIC #%d, dropping\n", sngss7_info->circuit->cic); - } - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - - /* do nothing, just drop the message */ - SS7_DEBUG("Receveived RSC-RLC in down state, dropping\n"); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**********************************************************************/ - default: - /* ITU Q764-2.9.5.1.c -> release the circuit */ - if ((siStaEvnt != NULL) && - (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && - (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; - } else { - ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ - } - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**********************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} -/******************************************************************************/ -ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_span_data_t *sngss7_span = NULL; - int range = 0; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* extract the range value from the event structure */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { - range = siStaEvnt->rangStat.range.val; - } else { - SS7_ERROR("Received GRS with no range value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* fill in the span structure for this circuit */ - sngss7_span = ftdmchan->span->signal_data; - if (sngss7_info->rx_grs.range) { - SS7_CRITICAL("Cannot handle another GRS on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - sngss7_info->rx_grs.circuit = circuit; - sngss7_info->rx_grs.range = range; - - ftdm_set_flag(sngss7_span, SNGSS7_RX_GRS_PENDING); - /* the reset will be started in the main thread by "check_if_rx_grs_started" */ - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_span_data_t *sngss7_span = NULL; - int range = 0; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* extract the range value from the event structure */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { - range = siStaEvnt->rangStat.range.val; - } else { - SS7_ERROR("Received GRA with no range value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* fill in the span structure for this circuit */ - sngss7_span = ftdmchan->span->signal_data; - if (sngss7_info->rx_gra.range) { - SS7_ERROR("Cannot handle another GRA on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - sngss7_info->rx_gra.circuit = circuit; - sngss7_info->rx_gra.range = range; - - /* check if there is a cause value in the GRA */ - if ((siStaEvnt != NULL) && - (siStaEvnt->causeDgn.eh.pres == PRSNT_NODEF) && - (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - - sngss7_info->rx_gra.cause = siStaEvnt->causeDgn.causeVal.val; - } - - ftdm_set_flag(sngss7_span, SNGSS7_RX_GRA_PENDING); - - /* the reset will be started in the main thread by "check_if_rx_gra_started" */ - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if the circuit is already blocked or not */ - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) { - SS7_WARN("Received local BLO on circuit that is already blocked!\n"); - } - - /* throw the ckt block flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); - - /* set the channel to suspended state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if the circuit is blocked or not */ - if (!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) { - SS7_WARN("Received local UBL on circuit that is not blocked!\n"); - } - - /* throw the ckt unblock flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX); - - /* set the channel to suspended state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - sngss7_chan_data_t *sngss7_info = NULL; - sngss7_chan_data_t *cinfo = NULL; - sngss7_span_data_t *sngss7_span = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* find out if the cic belongs to one of our GRS requests, if so, - * all circuits in the request must be blocked */ - sngss7_span = ftdmchan->span->signal_data; - iter = ftdm_span_get_chan_iterator(ftdmchan->span, NULL); - curr = iter; - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *fchan = ftdm_iterator_current(curr); - - ftdm_channel_lock(fchan); - - cinfo = fchan->call_data; - if (circuit == cinfo->tx_grs.circuit) { - cinfo->ucic.circuit = cinfo->tx_grs.circuit; - cinfo->ucic.range = cinfo->tx_grs.range; - ftdm_set_flag(sngss7_span, SNGSS7_UCIC_PENDING); - - SS7_WARN("Set span SNGSS7_UCIC_PENDING for ISUP circuit = %d!\n", circuit); - - ftdm_channel_unlock(fchan); - - goto done; - } - - ftdm_channel_unlock(fchan); - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* throw the ckt block flag */ - SS7_DEBUG("Set FLAG_CKT_UCIC_BLOCK for ISUP circuit = %d!\n", circuit); - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); - - /* set the channel to suspended state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); -done: - if (iter) { - ftdm_iterator_free(iter); - } - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = NULL; - ftdm_channel_t *ftdmchan = NULL; - int range; - uint8_t status[255]; - int blockType = 0; - int byte = 0; - int bit = 0; - int x; - int loop_range=0; - - ftdm_running_return(FTDM_FAIL); - - memset(&status[0], '\0', sizeof(status)); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - /* grab the span info */ - sngss7_span = ftdmchan->span->signal_data; - - /* figure out what type of block needs to be applied */ - if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) { - blockType = siStaEvnt->cgsmti.typeInd.val; - } else { - SS7_ERROR("Received CGB with no circuit group supervision value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* pull out the range value */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { - range = siStaEvnt->rangStat.range.val; - } else { - SS7_ERROR("Received CGB with no range value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* pull out the status field */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.status.pres == PRSNT_NODEF)) { - for (x = 0; x < siStaEvnt->rangStat.status.len; x++) { - status[x] = siStaEvnt->rangStat.status.val[x]; - } - } else { - SS7_ERROR("Received CGB with no status value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* save the circuit, range and status */ - sngss7_span->rx_cgb.circuit = circuit; - sngss7_span->rx_cgb.range = range; - sngss7_span->rx_cgb.type = blockType; - for (x = 0; x < siStaEvnt->rangStat.status.len; x++) { - sngss7_span->rx_cgb.status[x] = status[x]; - } - - /* loop over the cics starting from circuit until range+1 */ - loop_range = circuit + range + 1; - x = circuit; - while( x < loop_range ) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != SNG_CKT_VOICE) { - loop_range++; - } - else { - if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); - } else { - ftdm_mutex_lock(ftdmchan->mutex); - if (status[byte] & (1 << bit)) { - switch (blockType) { - /**********************************************************************/ - case 0: /* maintenance oriented */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); - break; - /**********************************************************************/ - case 1: /* hardware failure oriented */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); - break; - /**********************************************************************/ - case 2: /* reserved for national use */ - break; - /**********************************************************************/ - default: - break; - /**********************************************************************/ - } - } - - /* bring the sig status down */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - /* update the bit and byte counter*/ - bit ++; - if (bit == 8) { - byte++; - bit = 0; - } - } - } - x++; - } - - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - ft_to_sngss7_cgba(ftdmchan); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = NULL; - ftdm_channel_t *ftdmchan = NULL; - int range; - uint8_t status[255]; - int blockType = 0; - int byte = 0; - int bit = 0; - int x; - int loop_range=0; - ftdm_sigmsg_t sigev; - - ftdm_running_return(FTDM_FAIL); - - memset(&sigev, 0, sizeof (sigev)); - memset(&status[0], '\0', sizeof(status)); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* grab the span info */ - sngss7_span = ftdmchan->span->signal_data; - - /* figure out what type of block needs to be applied */ - if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) { - blockType = siStaEvnt->cgsmti.typeInd.val; - } else { - SS7_ERROR("Received CGU with no circuit group supervision value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* pull out the range value */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { - range = siStaEvnt->rangStat.range.val; - } else { - SS7_ERROR("Received CGU with no range value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* pull out the status field */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.status.pres == PRSNT_NODEF)) { - for (x = 0; x < siStaEvnt->rangStat.status.len; x++) { - status[x] = siStaEvnt->rangStat.status.val[x]; - } - } else { - SS7_ERROR("Received CGU with no status value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - /* save the circuit, range and status */ - sngss7_span->rx_cgu.circuit = circuit; - sngss7_span->rx_cgu.range = range; - sngss7_span->rx_cgu.type = blockType; - for (x = 0; x < siStaEvnt->rangStat.status.len; x++) { - sngss7_span->rx_cgu.status[x] = status[x]; - } - - /* loop over the cics starting from circuit until range+1 */ - loop_range = circuit + range + 1; - x = circuit; - while( x < loop_range ) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != SNG_CKT_VOICE) { - loop_range++; - } else { - if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); - } - else { - ftdm_mutex_lock(ftdmchan->mutex); - - if (status[byte] & (1 << bit)) { - switch (blockType) { - /**********************************************************************/ - case 0: /* maintenance oriented */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); - break; - /**********************************************************************/ - case 1: /* hardware failure oriented */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); - break; - /**********************************************************************/ - case 2: /* reserved for national use */ - break; - /**********************************************************************/ - default: - break; - /**********************************************************************/ - } /* switch (blockType) */ - } /* if (status[byte] & (1 << bit)) */ - - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - - /* bring the sig status down */ - if (sngss7_channel_status_clear(sngss7_info)) { - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - } - - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - ftdm_mutex_unlock(ftdmchan->mutex); - - /* update the bit and byte counter*/ - bit ++; - if (bit == 8) { - byte++; - bit = 0; - } - } - } - x++; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - ft_to_sngss7_cgua(ftdmchan); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_olm_msg(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_running_return(FTDM_FAIL); - - /* confirm that the circuit is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } else { - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_FAIL; - } - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - } - - /* handle overload */ - SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]Rx Overload\n", sngss7_info->circuit->cic); - - sng_isup_reg_info_show(); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return FTDM_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: - */ -/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c deleted file mode 100644 index 95ff402ae8..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ /dev/null @@ -1,722 +0,0 @@ -/* - * Copyright (c) 2009, Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); -void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); -void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt); -void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt); -void sngss7_ssp_sta_cfm(uint32_t infId); -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ -void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_CON_IND_EVENT; - memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt)); - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -/******************************************************************************/ -void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_CON_CFM_EVENT; - memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt)); - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -/******************************************************************************/ -void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->evntType = evntType; - sngss7_event->event_id = SNGSS7_CON_STA_EVENT; - memcpy(&sngss7_event->event.siCnStEvnt, siCnStEvnt, sizeof(*siCnStEvnt)); - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -/******************************************************************************/ -void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_REL_IND_EVENT; - memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt)); - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -/******************************************************************************/ -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_REL_CFM_EVENT; - memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt)); - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -/******************************************************************************/ -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_DAT_IND_EVENT; - memcpy(&sngss7_event->event.siInfoEvnt, siInfoEvnt, sizeof(*siInfoEvnt)); - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -/******************************************************************************/ -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->evntType = evntType; - sngss7_event->event_id = SNGSS7_FAC_IND_EVENT; - memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt)); - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -/******************************************************************************/ -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->evntType = evntType; - sngss7_event->event_id = SNGSS7_FAC_CFM_EVENT; - memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt)); - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -/******************************************************************************/ -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_UMSG_IND_EVENT; - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - -} -/* GENERAL STATUS *************************************************************/ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - uint32_t intfId; - int x; - - - - /* check if the eventType is a pause/resume */ - switch (evntType) { - /**************************************************************************/ - case (SIT_STA_PAUSEIND): - case (SIT_STA_RESUMEIND): - /* the circuit may or may not be on the local system so we have to find - * circuit with the same intfId. The circuit specified might also be - * a non-voice cic so we also need to find the first voice cic on this - * system with the same intfId. - */ - intfId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_DEBUG("Rx %s on circuit that is not a voice CIC (%d) finding a new circuit\n", - DECODE_LCC_EVENT(evntType), - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic); - } - - x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; - while ((g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) && - (g_ftdm_sngss7_data.cfg.isupCkt[x].id < ((g_ftdm_sngss7_data.cfg.procId + 1) * MAX_CIC_MAP_LENGTH))) { - /**********************************************************************/ - /* confirm this is a voice channel and not a gap/sig (no ftdmchan there) */ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - /* compare the intfIds */ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].infId == intfId) { - /* we have a match, setup the pointers to the correct values */ - circuit = x; - - /* confirm that the circuit is active on our side otherwise move to the next circuit */ - if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[circuit], SNGSS7_ACTIVE)) { - SS7_DEBUG("[CIC:%d]Rx %s but circuit is not active yet, skipping!\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - x++; - continue; - } - - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* bounce out of the loop */ - break; - } - } - - x++; - /**********************************************************************/ - } - - /* check if we found any circuits that are on the intfId, drop the message - * if none are found */ - if (!ftdmchan) { - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - break; - /**************************************************************************/ - default: - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - ftdm_log(FTDM_LOG_DEBUG, "Rx %s on circuit that is not a voice CIC (%d) (circuit:%d)\n", - DECODE_LCC_EVENT(evntType), g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - break; - /**************************************************************************/ - } /* switch (evntType) */ - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->globalFlg = globalFlg; - sngss7_event->evntType = evntType; - sngss7_event->event_id = SNGSS7_STA_IND_EVENT; - if (siStaEvnt != NULL) { - memcpy(&sngss7_event->event.siStaEvnt, siStaEvnt, sizeof(*siStaEvnt)); - } - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); -} - -/******************************************************************************/ -void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_SUSP_IND_EVENT; - if (siSuspEvnt != NULL) { - memcpy(&sngss7_event->event.siSuspEvnt, siSuspEvnt, sizeof(*siSuspEvnt)); - } - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - -} - -/******************************************************************************/ -void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) { - SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_RESM_IND_EVENT; - if (siResmEvnt != NULL) { - memcpy(&sngss7_event->event.siResmEvnt, siResmEvnt, sizeof(*siResmEvnt)); - } - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - -} - -/******************************************************************************/ -void sngss7_ssp_sta_cfm(uint32_t infId) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); -#if 0 - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - - /* initalize the sngss7_event */ - sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); - if (sngss7_event == NULL) { - SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; - } - memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - - /* fill in the sngss7_event struct */ - sngss7_event->spInstId = spInstId; - sngss7_event->suInstId = suInstId; - sngss7_event->circuit = circuit; - sngss7_event->event_id = SNGSS7_RESM_IND_EVENT; - if (siSuspEvnt != NULL) { - memcpy(&sngss7_event->event.siResmEvnt, siResmEvnt, sizeof(*siResmEvnt)); - } - - /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); -#endif - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - -} -/******************************************************************************/ -/* 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c deleted file mode 100644 index a4c064a323..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +++ /dev/null @@ -1,1155 +0,0 @@ -/* - * Copyright (c) 2009|Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms|with or without - * modification|are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice|this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice|this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT - * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL, - * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -void handle_sng_log(uint8_t level, char *fmt,...); -void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta); -void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta); -void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta); -void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta); -void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta); -void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta); - -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ -void handle_sng_log(uint8_t level, char *fmt,...) -{ - char *data; - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vasprintf(&data, fmt, ap); - if (ret == -1) { - return; - } - - switch (level) { - /**************************************************************************/ - case SNG_LOGLEVEL_DEBUG: - ftdm_log(FTDM_LOG_DEBUG, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_WARN: - ftdm_log(FTDM_LOG_WARNING, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_INFO: - ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_NOTICE: - ftdm_log(FTDM_LOG_NOTICE, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_ERROR: - ftdm_log(FTDM_LOG_ERROR, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_CRIT: - /*printf("%s",data);*/ - ftdm_log(FTDM_LOG_CRIT, "sng_ss7->%s", data); - break; - /**************************************************************************/ - default: - ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); - break; - /**************************************************************************/ - } - - return; -} - -/******************************************************************************/ -void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta) -{ - - -} /* handle_mtp1_alarm */ - -/******************************************************************************/ -void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) -{ - char buf[50]; - int x = 1; - int log_level = FTDM_LOG_LEVEL_DEBUG; - - memset(buf, '\0', sizeof(buf)); - - switch (sta->t.usta.alarm.category) { - /**************************************************************************/ - case (LCM_CATEGORY_PROTOCOL): - case (LCM_CATEGORY_INTERFACE): - - switch (sta->t.usta.alarm.event) { - /**********************************************************************/ - case (LSD_EVENT_ENTR_CONG): - case (LSD_EVENT_EXIT_CONG): - case (LSD_EVENT_PROT_ST_UP): - case (LSD_EVENT_PROT_ST_DN): - case (LSD_EVENT_LINK_ALIGNED): - case (LSD_EVENT_REMOTE_CONG_START): - case (LSD_EVENT_REMOTE_CONG_END): - case (LSD_EVENT_RX_REMOTE_SIPO): - - /* find the name for the sap in question */ - x = 1; - while (x < (MAX_MTP_LINKS+1)) { - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { - break; - } - x++; - } - - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) { - sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); - } else { - sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name); - } - - - switch (sta->t.usta.alarm.cause) { - case (LCM_CAUSE_MGMT_INITIATED): - ftdm_log(FTDM_LOG_DEBUG,"[MTP2]%s[MGMT] cause:%s event:%s\n", - buf, - DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), - DECODE_LSD_EVENT(sta->t.usta.alarm.event)); - break; - case (LCM_CAUSE_UNKNOWN): - default: - { - if ((LSD_EVENT_ALIGN_LOST == sta->t.usta.alarm.event) || - (LSD_EVENT_PROT_ST_DN == sta->t.usta.alarm.event)) { - log_level = FTDM_LOG_LEVEL_WARNING; - } else if ((LSD_EVENT_LINK_ALIGNED == sta->t.usta.alarm.event) || - (LSD_EVENT_PROT_ST_UP == sta->t.usta.alarm.event)){ - log_level = FTDM_LOG_LEVEL_INFO; - } else { - log_level = FTDM_LOG_LEVEL_WARNING; - } - ftdm_log(FTDM_PRE, log_level,"[MTP2]%s cause:%s event:%s\n", - buf, - DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), - DECODE_LSD_EVENT(sta->t.usta.alarm.event)); - break; - } - /******************************************************************/ - } /* switch (sta->t.usta.alarm.cause) */ - break; - /**********************************************************************/ - case (LSD_EVENT_PROT_ERR): - - /* find the name for the sap in question */ - x = 1; - while (x < (MAX_MTP_LINKS+1)) { - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { - break; - } - x++; - } - - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) { - sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); - } else { - sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name); - } - - ftdm_log(FTDM_LOG_WARNING,"[MTP2]%s %s : %s\n", - buf, - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - DECODE_LSD_CAUSE(sta->t.usta.alarm.cause)); - break; - /**********************************************************************/ - case (LSD_EVENT_ALIGN_LOST): - - /* find the name for the sap in question */ - x = 1; - while (x < (MAX_MTP_LINKS+1)) { - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { - break; - } - x++; - } - - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) { - sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); - } else { - sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name); - } - - ftdm_log(FTDM_LOG_WARNING,"[MTP2]%s %s : %s\n", - buf, - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - DECODE_DISC_REASON(sta->t.usta.evntParm[1])); - break; - /**********************************************************************/ - case (LSD_EVENT_RTB_FULL): - case (LSD_EVENT_RTB_FULL_OVER): - - /* find the name for the sap in question */ - x = 1; - while (x < (MAX_MTP_LINKS+1)) { - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { - break; - } - x++; - } - - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) { - sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); - } else { - sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name); - } - - ftdm_log(FTDM_LOG_WARNING,"[MTP2]%s %s : RTB Queue Len(%d)|Oldest BSN(%d)|Tx Queue Len(%d)|Outstanding Frames(%d)\n", - buf, - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - sta->t.usta.evntParm[1], - sta->t.usta.evntParm[2], - sta->t.usta.evntParm[3], - sta->t.usta.evntParm[4]); - break; - /**********************************************************************/ - case (LSD_EVENT_NEG_ACK): - - /* find the name for the sap in question */ - x = 1; - while (x < (MAX_MTP_LINKS+1)) { - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { - break; - } - x++; - } - - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) { - sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); - } else { - sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name); - } - - ftdm_log(FTDM_LOG_WARNING,"[MTP2]%s %s : RTB Queue Len(%d)\n", - buf, - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - sta->t.usta.evntParm[1]); - break; - /**********************************************************************/ - case (LSD_EVENT_DAT_CFM_SDT): - - /* find the name for the sap in question */ - x = 1; - while (x < (MAX_MTP_LINKS+1)) { - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { - break; - } - x++; - } - - if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == 0) { - sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); - } else { - sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name); - } - - ftdm_log(FTDM_LOG_WARNING,"[MTP2]%s %s : %s\n", - buf, - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - DECODE_DISC_REASON(sta->t.usta.evntParm[1])); - break; - /**********************************************************************/ - case (LCM_EVENT_UI_INV_EVT): - case (LCM_EVENT_LI_INV_EVT): - ftdm_log(FTDM_LOG_WARNING,"[MTP2] %s(%d) : %s(%d) : Primitive (%d)\n", - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - sta->t.usta.alarm.event, - DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.alarm.cause, - sta->t.usta.evntParm[0]); - break; - /**********************************************************************/ - case (LCM_EVENT_INV_EVT): - - switch (sta->t.usta.alarm.cause) { - /******************************************************************/ - case (LCM_CAUSE_UNKNOWN): - case (LCM_CAUSE_SWVER_NAVAIL): - ftdm_log(FTDM_LOG_WARNING,"[MTP2] %s : %s : Event (%d)\n", - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.evntParm[0]); - break; - /******************************************************************/ - case (LCM_CAUSE_DECODE_ERR): - ftdm_log(FTDM_LOG_WARNING,"[MTP2] %s : %s : Primitive (%d)|Version (%d)\n", - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.evntParm[0], - sta->t.usta.evntParm[1]); - break; - /******************************************************************/ - default: - ftdm_log(FTDM_LOG_WARNING,"[MTP2] %s(%d) : %s(%d)\n", - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - sta->t.usta.alarm.event, - DECODE_LSD_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.alarm.cause); - break; - /******************************************************************/ - } /* switch (sta->t.usta.alarm.cause) */ - break; - /**********************************************************************/ - default: - ftdm_log(FTDM_LOG_WARNING,"[MTP2] %s(%d) : %s(%d)\n", - DECODE_LSD_EVENT(sta->t.usta.alarm.event), - sta->t.usta.alarm.event, - DECODE_LSD_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.alarm.cause); - break; - /**********************************************************************/ - } /* switch (sta->t.usta.alarm.event) */ - break; - /**************************************************************************/ - default: - ftdm_log(FTDM_LOG_ERROR,"[MTP2] Unknown alarm category %d\n", - sta->t.usta.alarm.category); - break; - /**************************************************************************/ - } /* switch(sta->t.usta.alarm.category) */ - - return; -} /* handle_mtp2_alarm */ - -/******************************************************************************/ -void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) -{ - char buf[50]; - int x = 1; - - SS7_RELAY_DBG_FUN(handle_sng_mtp3_alarm); - - memset(buf, '\0', sizeof(buf)); - - switch (sta->hdr.elmId.elmnt) { - /**************************************************************************/ - case (STDLSAP): - - /* find the name for the sap in question */ - x = 1; - while (x < (MAX_MTP_LINKS+1)) { - if (g_ftdm_sngss7_data.cfg.mtp3Link[x].id == sta->hdr.elmId.elmntInst1) { - break; - } - x++; - } - - if (g_ftdm_sngss7_data.cfg.mtp3Link[x].id == 0) { - sprintf(buf, "[SAPID:%d]", sta->hdr.elmId.elmntInst1); - } else { - sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp3Link[x].name); - } - - switch (sta->t.usta.alarm.event) { - /**********************************************************************/ - case (LSN_EVENT_INV_OPC_OTHER_END): - - ftdm_log(FTDM_LOG_WARNING,"[MTP3]%s %s : %s : OPC(0x%X%X%X%X)\n", - buf, - DECODE_LSN_EVENT(sta->t.usta.alarm.event), - DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.evntParm[3], - sta->t.usta.evntParm[2], - sta->t.usta.evntParm[1], - sta->t.usta.evntParm[0]); - break; - /**********************************************************************/ - case (LSN_EVENT_INV_SLC_OTHER_END): - ftdm_log(FTDM_LOG_WARNING,"[MTP3]%s %s : %s : SLC(%d)\n", - buf, - DECODE_LSN_EVENT(sta->t.usta.alarm.event), - DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.evntParm[0]); - break; - /**********************************************************************/ - default: - ftdm_log(FTDM_LOG_WARNING,"[MTP3]%s %s(%d) : %s(%d)\n", - buf, - DECODE_LSN_EVENT(sta->t.usta.alarm.event), - sta->t.usta.alarm.event, - DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.alarm.cause); - break; - /**********************************************************************/ - } /* sta->t.usta.alarm.event */ - break; - /**************************************************************************/ - case (STNSAP): - ftdm_log(FTDM_LOG_WARNING,"[MTP3][SAPID:%d] %s : %s\n", - sta->hdr.elmId.elmntInst1, - DECODE_LSN_EVENT(sta->t.usta.alarm.event), - DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); - break; - /**************************************************************************/ - case (STLNKSET): - ftdm_log(FTDM_LOG_DEBUG,"[MTP3][LNKSET:%d] %s : %s\n", - sta->hdr.elmId.elmntInst1, - DECODE_LSN_EVENT(sta->t.usta.alarm.event), - DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); - break; - /**************************************************************************/ - case (STROUT): - switch (sta->t.usta.alarm.event) { - /**********************************************************************/ - case (LSN_EVENT_RX_TRANSFER_MSG): - switch (sta->t.usta.evntParm[5]) { - /******************************************************************/ - case (0x23): - ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFC\n"); - break; - /******************************************************************/ - case (0x34): - ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFR\n"); - break; - /******************************************************************/ - case (0x54): - ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFA\n"); - break; - /******************************************************************/ - case (0x14): - ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFP\n"); - break; - /******************************************************************/ - case (0x24): - ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFP (cluster)\n"); - break; - /******************************************************************/ - case (0x64): - ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFA (cluster)\n"); - break; - /******************************************************************/ - case (0x44): - ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFR (cluster)\n"); - break; - /******************************************************************/ - } /* switch (sta->t.usta.evntParm[5]) */ - break; - /**********************************************************************/ - default: - ftdm_log(FTDM_LOG_WARNING,"[MTP3][DPC:0x%X%X%X%X] %s : %s\n", - sta->t.usta.evntParm[0], - sta->t.usta.evntParm[1], - sta->t.usta.evntParm[2], - sta->t.usta.evntParm[3], - DECODE_LSN_EVENT(sta->t.usta.alarm.event), - DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); - break; - /**********************************************************************/ - } /* switch (sta->t.usta.alarm.event) */ - break; - /**************************************************************************/ - default: - ftdm_log(FTDM_LOG_ERROR,"[MTP3] %s(%d) : %s(%d)\n", - DECODE_LSN_EVENT(sta->t.usta.alarm.event), - sta->t.usta.alarm.event, - DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), - sta->t.usta.alarm.cause); - break; - /**************************************************************************/ - } /* switch (sta->hdr.elmId.elmnt) */ - - return; -} /* handle_mtp3_alarm */ - -/******************************************************************************/ -void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta) -{ - char msg[250]; - char tmp[25]; - char *p = NULL; - int x = 0; - - SS7_RELAY_DBG_FUN(handle_sng_isup_alarm); - - /* initalize the msg variable to NULLs */ - memset(&msg[0], '\0', sizeof(&msg)); - - /* if the event is REMOTE/LOCAL we don't need to print these */ - if ((sta->t.usta.alarm.event == LSI_EVENT_REMOTE) || - (sta->t.usta.alarm.event == LSI_EVENT_LOCAL)) { - return; - } - - /* point p to the first spot in msg */ - p = &msg[0]; - - p = strcat(p, "[ISUP]"); - - /* go through the dgnVals */ - for (x = 0; x < 5; x++) { - switch (sta->t.usta.dgn.dgnVal[x].type) { - /**********************************************************************/ - case (LSI_USTA_DGNVAL_NONE): - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_EVENT): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[EVENT:%d]",sta->t.usta.dgn.dgnVal[x].t.event); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_SPID): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[SPID:%d]",sta->t.usta.dgn.dgnVal[x].t.spId); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_SUID): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[SUID:%d]",sta->t.usta.dgn.dgnVal[x].t.suId); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_SPINSTID): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[SPINSTID:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.spInstId); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_SUINSTID): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[SUINSTID:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.suInstId); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_CIRCUIT): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[CKT:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.cirId); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_CIC): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[CIC:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.cic); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_INTF): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[INTF:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.intfId); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_DPC): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[DPC:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.dpc); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_ADDRS): -#if 0 - /* - *typedef struct addrs - *{ - *U8 length; - *U8 strg[ADRLEN]; - *} Addrs; - */ - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[ADDRS:%d]",sta->t.usta.dgn.dgnVal[x].t.); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); -#endif - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_SWTCH): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[SWTCH:%d]",sta->t.usta.dgn.dgnVal[x].t.swtch); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_RANGE): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[RANGE:0x%X]",sta->t.usta.dgn.dgnVal[x].t.range); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_STATUS_OCTS): -#if 0 - /* - *typedef struct addrs - *{ - *U8 length; - *U8 strg[ADRLEN]; - *} Addrs; - */ - /* init tmp with NULLs */ - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[STATUS_OCT:0x%X]",sta->t.usta.dgn.dgnVal[x].t.); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); -#endif - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_VER): -#ifdef SI_RUG - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[VER:%d]",sta->t.usta.dgn.dgnVal[x].t.intfVer); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); -#endif - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_TIMER): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[TIMER:0x%X]",sta->t.usta.dgn.dgnVal[x].t.tmrInfo); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_MSGTYPE): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[MSGTYPE:%d]",sta->t.usta.dgn.dgnVal[x].t.msgType); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - case (LSI_USTA_DGNVAL_STATE): - /* init tmp with NULLs */ - memset(&tmp[0], '\0', sizeof(&tmp)); - - /* fill in the dgn val to tmp */ - sprintf(&tmp[0], "[STATE:%d]",sta->t.usta.dgn.dgnVal[x].t.state); - - /* concat tmp to msg */ - p = strcat(p, &tmp[0]); - break; - /**********************************************************************/ - default: - break; - /**********************************************************************/ - } /* switch (sta->t.usta.dgn.dgnVal[x].t.type) */ - } /* for (x = 0; x < 5; x++) */ - - ftdm_log(FTDM_LOG_WARNING,"%s %s : %s\n", - msg, - DECODE_LSI_EVENT(sta->t.usta.alarm.event), - DECODE_LSI_CAUSE(sta->t.usta.alarm.cause)); - - return; - -} /* handle_isup_alarm */ - -/******************************************************************************/ -void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta) -{ - - SS7_RELAY_DBG_FUN(handle_sng_cc_alarm); - return; -} /* handle_cc_alarm */ - -/******************************************************************************/ -void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta) -{ - - SS7_RELAY_DBG_FUN(handle_sng_relay_alarm); - - switch (sta->hdr.elmId.elmnt) { - /**************************************************************************/ - case (LRY_USTA_ERR): /* ERROR */ - ftdm_log(FTDM_LOG_WARNING,"[RELAY] Error: tx procId %d: err procId %d: channel %d: seq %s: reason %s\n", - sta->t.usta.s.ryErrUsta.sendPid, - sta->t.usta.s.ryErrUsta.errPid, - sta->t.usta.s.ryErrUsta.id, - DECODE_LRY_SEQ(sta->t.usta.s.ryErrUsta.sequence), - DECODE_LRY_REASON(sta->t.usta.s.ryErrUsta.reason)); - - /* process the event */ - switch (sta->t.usta.s.ryErrUsta.reason) { - /**********************************************************************/ - case (LRYRSNMGMTREQ): - /* do nothing since this is a shutdown */ - break; - /**********************************************************************/ - default: - /* handle the error */ - handle_relay_disconnect_on_error(sta); - break; - /**********************************************************************/ - } /* switch (sta->t.usta.s.ryErrUsta.reason) */ - - break; - /**************************************************************************/ - case (LRY_USTA_CNG): /* Congestion */ - ftdm_log(FTDM_LOG_WARNING,"[RELAY] Congestion: tx procId %d: rem procId %d: channel %d: %s\n", - sta->t.usta.s.ryCongUsta.sendPid, - sta->t.usta.s.ryCongUsta.remPid, - sta->t.usta.s.ryCongUsta.id, - DECODE_LRY_CONG_FLAGS(sta->t.usta.s.ryCongUsta.flags)); - break; - /**************************************************************************/ - case (LRY_USTA_UP): /* channel up */ - ftdm_log(FTDM_LOG_INFO,"[RELAY] Channel UP: tx procId %d: channel %d\n", - sta->t.usta.s.ryUpUsta.sendPid, - sta->t.usta.s.ryUpUsta.id); - - /* process the event */ - handle_relay_connect(sta); - - break; - /**************************************************************************/ - case (LRY_USTA_DN): /* channel down */ - ftdm_log(FTDM_LOG_WARNING,"[RELAY] Channel DOWN: tx procId %d: channel %d\n", - sta->t.usta.s.ryUpUsta.sendPid, - sta->t.usta.s.ryUpUsta.id); - - /* process the event */ - handle_relay_disconnect_on_down(sta); - - break; - /**************************************************************************/ - case (LRY_USTA_TCP_CONN_FAILED): - ftdm_log(FTDM_LOG_WARNING,"[RELAY] TCP connection failed \n" ); - - break; - /**************************************************************************/ - default: - ftdm_log(FTDM_LOG_ERROR,"Unknown Relay Alram\n"); - break; - /**************************************************************************/ - } /* switch (sta->hdr.elmId.elmnt) */ - - return; -} - -/******************************************************************************/ -void handle_sng_m2ua_alarm(Pst *pst, MwMgmt *sta) -{ - /* To print the general information */ - ftdm_log(FTDM_LOG_INFO, "Recieved a status indication from M2UA layer \n\n"); - ftdm_log(FTDM_LOG_INFO," Category = %d , event = %d , cause = %d\n", - sta->t.usta.alarm.category, sta->t.usta.alarm.event, sta->t.usta.alarm.cause); - - - /* To print the affected element value */ - switch(sta->hdr.elmId.elmnt) - { - case STMWDLSAP: - { - ftdm_log(FTDM_LOG_INFO," STMWDLSAP: with lnkNmb (%d) \n\n", - sta->t.usta.s.lnkNmb); - break; - } - case STMWSCTSAP: - { - ftdm_log(FTDM_LOG_INFO," STMWSCTSAP: suId (%d) \n\n", - sta->t.usta.s.suId); - break; - } - case STMWPEER: - { - ftdm_log(FTDM_LOG_INFO," STMWPEER: peerId (%d) \n\n", - sta->t.usta.s.peerId); - break; - } - case STMWCLUSTER: - { - ftdm_log(FTDM_LOG_INFO," STMWCLUSTER: clusterId (%d) \n\n", - sta->t.usta.s.peerId); - break; - } - default: - { - ftdm_log(FTDM_LOG_ERROR, "[MW_USTA]: Invalid element \n\n"); - break; - } - } - - /* To print the event specific information */ - switch(sta->t.usta.alarm.event) - { - case LMW_EVENT_TERM_OK: - { - ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_TERM_OK: Association Terminated with PeerId[%d] \n",sta->t.usta.s.peerId); - break; - } - case LMW_EVENT_ENDPOPEN_OK: - { - ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ENDPOPEN_OK: \n"); - break; - } - case LMW_EVENT_ESTABLISH_OK: - { - ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ESTABLISH_OK Event raised on peerId[%d]\n",sta->t.usta.s.peerId); - break; - } - case LMW_EVENT_ESTABLISH_FAIL: - { - ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ESTABLISH_FAIL Event raised on peerId[%d]\n",sta->t.usta.s.peerId); - break; - } - case LMW_EVENT_ASPM: - { - ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_ASPM Event raised with peerId (%d)," - " msgType (%d)\n\n",sta->t.usta.s.peerId, - sta->t.usta.t.aspm.msgType); - break; - } - case LMW_EVENT_CLUSTER: - { - ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_CLUSTER Event raised on clusterId (%d), state (%d)\n\n", - sta->t.usta.s.clusterId, sta->t.usta.t.cluster.state); - - break; - } - case LMW_EVENT_NOTIFY: - { - ftdm_log(FTDM_LOG_INFO," M2UA : LMW_EVENT_NOTIFY: peerId (%d), aspId (%u), ntfy status type (%d)," - " ntfy status id (%d)\n\n", sta->t.usta.s.peerId, - (uint32_t) sta->t.usta.t.ntfy.aspId, sta->t.usta.t.ntfy.stType, - sta->t.usta.t.ntfy.stId); - - break; - } - - - case LMW_EVENT_M2UA_PROTO_ERROR: - { - ftdm_log(FTDM_LOG_ERROR, " M2UA : LMW_EVENT_M2UA_PROTO_ERROR with errorCode (%u)\n\n", - (uint32_t) sta->t.usta.t.error.errCode); - break; - } - default: - break; - } - -} /* handle_sng_m2ua_alarm */ - -/******************************************************************************/ -void handle_sng_nif_alarm(Pst *pst, NwMgmt *sta) -{ - /* To print the general information */ - ftdm_log(FTDM_LOG_INFO," Recieved a status indication from NIF layer\n"); - ftdm_log(FTDM_LOG_INFO," Category = %d , event = %d , cause = %d\n", sta->t.usta.alarm.category, - sta->t.usta.alarm.event, sta->t.usta.alarm.cause); - - switch(sta->hdr.elmId.elmnt) - { - case STNWDLSAP: - { - ftdm_log(FTDM_LOG_INFO," Recieved STNWDLSAP status indication for suId (%d) \n", sta->t.usta.suId); - switch(sta->t.usta.alarm.event) - { - case LCM_EVENT_LI_INV_EVT: - { - switch(sta->t.usta.alarm.cause) - { - case LCM_CAUSE_INV_SAP: - { - ftdm_log(FTDM_LOG_ERROR, " LCM_CAUSE_INV_SAP Alarm \n"); - break; - } - case LCM_CAUSE_INV_STATE: - { - ftdm_log(FTDM_LOG_ERROR, " LCM_CAUSE_INV_STATE Alarm \n"); - break; - } - default: - break; - } - break; - } - case LCM_EVENT_BND_OK: - { - ftdm_log(FTDM_LOG_INFO," NIF: LCM_EVENT_BND_OK Alarm \n"); - break; - } - case LCM_EVENT_BND_FAIL: - { - ftdm_log(FTDM_LOG_INFO," NIF: LCM_EVENT_BND_FAIL Alarm \n"); - break; - } - default: - break; - } - break; - } - default: - break; - } -} /* handle_sng_nif_alarm */ - -/******************************************************************************/ -void handle_sng_tucl_alarm(Pst *pst, HiMngmt *sta) -{ - /* To print the general information */ - ftdm_log(FTDM_LOG_INFO, "Recieved a status indication from TUCL layer \n\n"); - ftdm_log(FTDM_LOG_INFO, " Category = %d , event = %d , cause = %d\n", - sta->t.usta.alarm.category, - sta->t.usta.alarm.event, sta->t.usta.alarm.cause); - - switch(sta->t.usta.alarm.event) - { - case LCM_EVENT_INV_EVT: - { - ftdm_log(FTDM_LOG_INFO," [HI_USTA]: LCM_EVENT_INV_EVT with type (%d)\n\n", - sta->t.usta.info.type); - break; - } - case LHI_EVENT_BNDREQ: - { - ftdm_log(FTDM_LOG_INFO," [HI_USTA]: LHI_EVENT_BNDREQ with type (%d) spId (%d)\n\n", - sta->t.usta.info.type, sta->t.usta.info.spId); - break; - } - case LHI_EVENT_SERVOPENREQ: - case LHI_EVENT_DATREQ: - case LHI_EVENT_UDATREQ: - case LHI_EVENT_CONREQ: - case LHI_EVENT_DISCREQ: -#if(defined(HI_TLS) && defined(HI_TCP_TLS)) - case LHI_EVENT_TLS_ESTREQ: -#endif - { - ftdm_log(FTDM_LOG_INFO," [HI_USTA]: partype (%d) type(%d)\n\n", - sta->t.usta.info.inf.parType, sta->t.usta.info.type); - break; - } - case LCM_EVENT_DMEM_ALLOC_FAIL: - case LCM_EVENT_SMEM_ALLOC_FAIL: - { - ftdm_log(FTDM_LOG_ERROR," [HI_USTA]: MEM_ALLOC_FAIL with region(%d) pool (%d) type(%d)\n\n", - sta->t.usta.info.inf.mem.region, sta->t.usta.info.inf.mem.pool, - sta->t.usta.info.type); - break; - } - default: - break; - } - -} /* handle_sng_tucl_alarm */ - -/******************************************************************************/ -void handle_sng_sctp_alarm(Pst *pst, SbMgmt *sta) -{ - ftdm_log(FTDM_LOG_INFO, "Recieved a status indication from SCTP layer \n\n"); - ftdm_log(FTDM_LOG_INFO," Category = %d , event = %d , cause = %d " - " [SB_USTA]: sapId (%d) and swtch (%d)\n", - sta->t.usta.alarm.category, - sta->t.usta.alarm.event, sta->t.usta.alarm.cause, - sta->t.usta.sapId, sta->t.usta.swtch); - - switch(sta->t.usta.alarm.category) - { - case LCM_CATEGORY_INTERFACE: - { - switch(sta->t.usta.alarm.cause) - { - case LCM_CAUSE_INV_SPID: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LCM_CAUSE_INV_SPID Alarm \n"); - break; - } - case LCM_CAUSE_SWVER_NAVAIL: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LCM_CAUSE_SWVER_NAVAIL Alarm\n"); - break; - } - case LCM_CAUSE_INV_PAR_VAL: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LCM_CAUSE_INV_PAR_VAL Alarm\n"); - break; - } - case LCM_CAUSE_INV_SUID: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LCM_CAUSE_INV_SUID Alarm\n"); - break; - } - case LCM_CAUSE_INV_SAP: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LCM_CAUSE_INV_SAP Alarm\n"); - break; - } - default: - break; - } - - break; - } - case LCM_CATEGORY_RESOURCE: - { - switch(sta->t.usta.alarm.cause) - { - case LCM_CAUSE_MEM_ALLOC_FAIL: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LCM_CAUSE_MEM_ALLOC_FAIL Alarm \n"); - break; - } - case LSB_CAUSE_NUM_ADDR_EXCEED: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LSB_CAUSE_NUM_ADDR_EXCEED Alarm\n"); - break; - } - default: - break; - } - break; - } - case LCM_CATEGORY_PROTOCOL: - { - switch(sta->t.usta.alarm.cause) - { - case LSB_CAUSE_PATH_FAILURE: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LSB_CAUSE_PATH_FAILURE Alarm \n"); - break; - } - case LSB_CAUSE_PATH_ACTIVE: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LSB_CAUSE_PATH_ACTIVE Alarm \n"); - break; - } - case LSB_CAUSE_UNRSLVD_ADDR: - { - ftdm_log(FTDM_LOG_ERROR, "SCTP : LSB_CAUSE_UNRSLVD_ADDR Alarm \n"); - break; - } - default: - break; - } - break; - } - default: - break; - } - -} /* handle_sng_sctp_alarm */ -/******************************************************************************/ - - -/******************************************************************************/ -/* 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c deleted file mode 100644 index 810c5a2902..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c +++ /dev/null @@ -1,1773 +0,0 @@ -/* - * Copyright (c) 2012, Kapil Gupta - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributors: - * - * - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ -/* FUNCTION PROTOTYPES ********************************************************/ -static int ftmod_tucl_gen_config(void); -static int ftmod_tucl_sap_config(int id); -static int ftmod_sctp_gen_config(void); -static int ftmod_cfg_sctp(void); -static int ftmod_sctp_config(int id); -static ftdm_status_t ftmod_sctp_sap_config(int id); -static ftdm_status_t ftmod_sctp_tsap_config(int id); -static int ftmod_m2ua_gen_config(void); -static int ftmod_m2ua_sctsap_config(int sct_sap_id, int sctp_id); -static int ftmod_m2ua_peer_config(int id); -static int ftmod_m2ua_peer_config1(int m2ua_inf_id, int peer_id); -static int ftmod_m2ua_cluster_config(int idx); -static int ftmod_m2ua_dlsap_config(int idx); -static int ftmod_nif_gen_config(void); -static int ftmod_nif_dlsap_config(int idx); -static int ftmod_sctp_tucl_tsap_bind(int idx); -static int ftmod_m2ua_sctp_sctsap_bind(int idx); -static int ftmod_open_endpoint(int idx); -static int ftmod_init_sctp_assoc(int peer_id); -static int ftmod_nif_m2ua_dlsap_bind(int id); -static int ftmod_nif_mtp2_dlsap_bind(int id); -static int ftmod_m2ua_debug(int action); -static int ftmod_tucl_debug(int action); -static int ftmod_sctp_debug(int action); - -static int ftmod_ss7_sctp_shutdown(void); -static int ftmod_ss7_m2ua_shutdown(void); -static int ftmod_ss7_tucl_shutdown(void); - - -/******************************************************************************/ -ftdm_status_t ftmod_ss7_m2ua_init(void) -{ - /****************************************************************************************************/ - if (sng_isup_init_nif()) { - ftdm_log (FTDM_LOG_ERROR , "Failed to start NIF\n"); - return FTDM_FAIL; - } else { - ftdm_log (FTDM_LOG_INFO ,"Started NIF!\n"); - } - /****************************************************************************************************/ - - if (sng_isup_init_m2ua()) { - ftdm_log (FTDM_LOG_ERROR ,"Failed to start M2UA\n"); - return FTDM_FAIL; - } else { - ftdm_log (FTDM_LOG_INFO ,"Started M2UA!\n"); - } - /****************************************************************************************************/ - - if (sng_isup_init_sctp()) { - ftdm_log (FTDM_LOG_ERROR ,"Failed to start SCTP\n"); - return FTDM_FAIL; - } else { - ftdm_log (FTDM_LOG_INFO ,"Started SCTP!\n"); - } - /****************************************************************************************************/ - - if (sng_isup_init_tucl()) { - ftdm_log (FTDM_LOG_ERROR ,"Failed to start TUCL\n"); - return FTDM_FAIL; - } else { - ftdm_log (FTDM_LOG_INFO ,"Started TUCL!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_PRESENT); - } - /****************************************************************************************************/ - - if(ftmod_tucl_gen_config()){ - ftdm_log (FTDM_LOG_ERROR ,"TUCL GEN configuration: NOT OK\n"); - return FTDM_FAIL; - } else { - ftdm_log (FTDM_LOG_INFO ,"TUCL GEN configuration: OK\n"); - } - /****************************************************************************************************/ - if(ftmod_sctp_gen_config()){ - ftdm_log (FTDM_LOG_ERROR ,"SCTP GEN configuration: NOT OK\n"); - return FTDM_FAIL; - } else { - ftdm_log (FTDM_LOG_INFO ,"SCTP GEN configuration: OK\n"); - } - /****************************************************************************************************/ - if(ftmod_m2ua_gen_config()) { - ftdm_log (FTDM_LOG_ERROR ,"M2UA General configuration: NOT OK\n"); - return FTDM_FAIL; - }else { - ftdm_log (FTDM_LOG_INFO ,"M2UA General configuration: OK\n"); - } - /****************************************************************************************************/ - if(ftmod_nif_gen_config()){ - ftdm_log (FTDM_LOG_ERROR ,"NIF General configuration: NOT OK\n"); - return FTDM_FAIL; - }else { - ftdm_log (FTDM_LOG_INFO ,"NIF General configuration: OK\n"); - } - /****************************************************************************************************/ - - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -void ftmod_ss7_m2ua_free() -{ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_PRESENT)) { - ftmod_ss7_m2ua_shutdown(); - sng_isup_free_m2ua(); - } - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_PRESENT)) { - ftmod_ss7_sctp_shutdown(); - sng_isup_free_sctp(); - } - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_TUCL_PRESENT)) { - ftmod_ss7_tucl_shutdown(); - sng_isup_free_tucl(); - } -} - -/******************************************************************************/ -static int ftmod_ss7_tucl_shutdown() -{ - Pst pst; - HiMngmt cntrl; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(HiMngmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTHI; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTHI; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STGEN; /* General */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = ASHUTDOWN; - - return (sng_cntrl_tucl (&pst, &cntrl)); -} -/******************************************************************************/ -static int ftmod_ss7_m2ua_shutdown() -{ - Pst pst; - MwMgmt cntrl; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(MwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTMW; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STMWGEN; /* General */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = ASHUTDOWN; - - return (sng_cntrl_m2ua (&pst, &cntrl)); -} -/***********************************************************************************************************************/ -static int ftmod_ss7_sctp_shutdown() -{ - Pst pst; - SbMgmt cntrl; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(SbMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTSB; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTSB; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STSBGEN; /* General */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = ASHUTDOWN; - - return (sng_cntrl_sctp (&pst, &cntrl)); -} - -/******************************************************************************/ - - - -ftdm_status_t ftmod_ss7_m2ua_cfg(void) -{ - int x=0; - - /* SCTP configuration */ - if(ftmod_cfg_sctp()){ - ftdm_log (FTDM_LOG_ERROR ,"SCTP Configuration : NOT OK\n"); - return FTDM_FAIL; - } else { - ftdm_log (FTDM_LOG_INFO ,"SCTP Configuration : OK\n"); - } - - /****************************************************************************************************/ - /* M2UA SCTP SAP configurations */ - x = 1; - while(xspId = k->id ; /* each SCTP link there will be one tucl sap */ - pCfg->uiSel = 0x00; /*loosley coupled */ - pCfg->flcEnb = TRUE; - pCfg->txqCongStrtLim = HI_SAP_TXN_QUEUE_CONG_START_LIMIT; - pCfg->txqCongDropLim = HI_SAP_TXN_QUEUE_CONG_DROP_LIMIT; - pCfg->txqCongStopLim = HI_SAP_TXN_QUEUE_CONG_STOP_LIMIT; - pCfg->numBins = 10; - - pCfg->uiMemId.region = S_REG; - pCfg->uiMemId.pool = S_POOL; - pCfg->uiPrior = PRIOR0; - pCfg->uiRoute = RTESPEC; - - return(sng_cfg_tucl(&pst, &cfg)); -} - -/****************************************************************************************************/ - -static int ftmod_sctp_gen_config(void) -{ - SbMgmt cfg; - Pst pst; - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSB; - - /* clear the configuration structure */ - memset(&cfg, 0, sizeof(cfg)); - - /* fill in the post structure */ - smPstInit(&cfg.t.cfg.s.genCfg.smPst); - /*fill in the specific fields of the header */ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSB; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STSBGEN; - -#ifdef SB_IPV6_SUPPORTED - /* U8 ipv6SrvcReqdFlg; */ /* IPV6 service required for sctp */ -#endif - - cfg.t.cfg.s.genCfg.serviceType = HI_SRVC_RAW_SCTP; /* Usr packetized TCP Data */ /* TUCL transport protocol (IP/UDP) */ - cfg.t.cfg.s.genCfg.maxNmbSctSaps = SB_MAX_SCT_SAPS; /* max no. SCT SAPS */ - cfg.t.cfg.s.genCfg.maxNmbTSaps = SB_MAX_T_SAPS; /* max no. Transport SAPS */ - cfg.t.cfg.s.genCfg.maxNmbEndp = SB_MAX_NUM_OF_ENDPOINTS; /* max no. endpoints */ - cfg.t.cfg.s.genCfg.maxNmbAssoc = SB_MAX_NUM_OF_ASSOC; /* max no. associations */ - cfg.t.cfg.s.genCfg.maxNmbDstAddr = SB_MAX_NUM_OF_DST_ADDR; /* max no. dest. addresses */ - cfg.t.cfg.s.genCfg.maxNmbSrcAddr = SB_MAX_NUM_OF_SRC_ADDR; /* max no. src. addresses */ - cfg.t.cfg.s.genCfg.maxNmbTxChunks = SB_MAX_NUM_OF_TX_CHUNKS; - cfg.t.cfg.s.genCfg.maxNmbRxChunks = SB_MAX_NUM_OF_RX_CHUNKS; - cfg.t.cfg.s.genCfg.maxNmbInStrms = SB_MAX_INC_STREAMS; - cfg.t.cfg.s.genCfg.maxNmbOutStrms = SB_MAX_OUT_STREAMS; - cfg.t.cfg.s.genCfg.initARwnd = SB_MAX_RWND_SIZE; - cfg.t.cfg.s.genCfg.mtuInitial = SB_MTU_INITIAL; - cfg.t.cfg.s.genCfg.mtuMinInitial = SB_MTU_MIN_INITIAL; - cfg.t.cfg.s.genCfg.mtuMaxInitial = SB_MTU_MAX_INITIAL; - cfg.t.cfg.s.genCfg.performMtu = FALSE; - cfg.t.cfg.s.genCfg.timeRes = 1; - sprintf((char*)cfg.t.cfg.s.genCfg.hostname, "www.sangoma.com"); /* DAVIDY - Fix this later, probably ignored */ - cfg.t.cfg.s.genCfg.useHstName = FALSE; /* Flag whether hostname is to be used in INIT and INITACK msg */ - cfg.t.cfg.s.genCfg.reConfig.maxInitReTx = 8; - cfg.t.cfg.s.genCfg.reConfig.maxAssocReTx = 10; - cfg.t.cfg.s.genCfg.reConfig.maxPathReTx = 10; - cfg.t.cfg.s.genCfg.reConfig.altAcceptFlg = TRUE; - cfg.t.cfg.s.genCfg.reConfig.keyTm = 600; /* initial value for MD5 Key expiry timer */ - cfg.t.cfg.s.genCfg.reConfig.alpha = 12; - cfg.t.cfg.s.genCfg.reConfig.beta = 25; -#ifdef SB_ECN - cfg.t.cfg.s.genCfg.reConfig.ecnFlg = TRUE; -#endif - - return(sng_cfg_sctp(&pst, &cfg)); -} - -/****************************************************************************************************/ -static int ftmod_cfg_sctp(void) -{ - int x=0; - - x = 1; - while(xid; - - c = &cfg.t.cfg.s.tSapCfg; - c->swtch = LSB_SW_RFC_REL0; - c->suId = k->id; - c->sel = 0; - c->ent = ENTHI; - c->inst = S_INST; - c->procId = g_ftdm_sngss7_data.cfg.procId; - c->memId.region = S_REG; - c->memId.pool = S_POOL; - c->prior = PRIOR1; - c->route = RTESPEC; - c->srcNAddrLst.nmb = k->numSrcAddr; - for (i=0; i <= (k->numSrcAddr-1); i++) { - c->srcNAddrLst.nAddr[i].type = CM_NETADDR_IPV4; - c->srcNAddrLst.nAddr[i].u.ipv4NetAddr = k->srcAddrList[i+1]; - } - - c->reConfig.spId = k->id; - c->reConfig.maxBndRetry = 3; - c->reConfig.tIntTmr = 200; - - ret = sng_cfg_sctp(&pst, &cfg); - if (0 == ret) { - SS7_INFO("SCTP TSAP [%d] configuration DONE!\n", id); - return FTDM_SUCCESS; - } else { - SS7_CRITICAL("SCTP TSAP [%d] configuration FAILED!\n", id); - return FTDM_FAIL; - } -} - -/****************************************************************************************************/ - -ftdm_status_t ftmod_sctp_sap_config(int id) -{ - Pst pst; - SbMgmt cfg; - SbSctSapCfg *c; - - int ret = -1; - sng_sctp_link_t *k = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[id]; - - smPstInit(&pst); - pst.dstEnt = ENTSB; - - memset(&cfg, 0x0, sizeof(cfg)); - smHdrInit(&cfg.hdr); - - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTSB; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STSBSCTSAP; - cfg.hdr.elmId.elmntInst1 = k->id; - - c = &cfg.t.cfg.s.sctSapCfg; - c->swtch = LSB_SW_RFC_REL0; - c->spId = k->id; /* Service Provider SAP Id */ - c->sel = 0; - c->memId.region = S_REG; - c->memId.pool = S_POOL; - c->prior = PRIOR1; - c->route = RTESPEC; - - /* Maximum time to wait before the SCTP layer must send a Selective Acknowledgement (SACK) message. Valid range is 1 -165535. */ - c->reConfig.maxAckDelayTm = 200; - /* Maximum number of messages to receive before the SCTP layer must send a SACK message. Valid range is 1 - 165535. */ - c->reConfig.maxAckDelayDg = 2; - /* Initial value of the retransmission timer (RTO). The SCTP layer retransmits data after waiting for feedback during this time period. Valid range is 1 - 65535. */ - c->reConfig.rtoInitial = 3000; - /* Minimum value used for the RTO. If the computed value of RTO is less than rtoMin, the computed value is rounded up to this value. */ - c->reConfig.rtoMin = 1000; - /* Maxiumum value used for RTO. If the computed value of RTO is greater than rtoMax, the computed value is rounded down to this value. */ - c->reConfig.rtoMax = 10000; - /* Default Freeze timer value */ - c->reConfig.freezeTm = 3000; - /* Base cookie lifetime for the cookie in the Initiation Acknowledgement (INIT ACK) message. */ - c->reConfig.cookieLife = 60000; - /* Default heartbeat interval timer. Valid range is 1 - 65535. */ - c->reConfig.intervalTm = 3000; - /* Maximum burst value. Valid range is 1 - 65535. */ - c->reConfig.maxBurst = 4; - /*Maximum number of heartbeats sent at each retransmission timeout (RTO). Valid range is 1 - 65535. */ - c->reConfig.maxHbBurst = 1; - /*Shutdown guard timer value for graceful shutdowns. */ - c->reConfig.t5SdownGrdTm = 15000; - /* Action to take when the receiver's number of incoming streams is less than the sender's number of outgoing streams. Valid values are: - TRUE = Accept incoming stream and continue association. - FALSE = Abort the association. - */ - c->reConfig.negAbrtFlg = FALSE; - /* Whether to enable or disable heartbeat by default. Valid values are: - TRUE = Enable heartbeat. - FALSE = Disable heartbeat. - */ - c->reConfig.hBeatEnable = TRUE; - /* Flow control start threshold. When the number of messages in SCTP’s message queue reaches this value, flow control starts. */ - c->reConfig.flcUpThr = 8; - /* Flow control stop threshold. When the number of messages in SCTP’s message queue reaches this value, flow control stops. */ - c->reConfig.flcLowThr = 6; - - c->reConfig.handleInitFlg = FALSE; - - ret = sng_cfg_sctp(&pst, &cfg); - if (0 == ret) { - SS7_INFO("SCTP SAP [%d] configuration DONE!\n", id); - return FTDM_SUCCESS; - } else { - SS7_CRITICAL("SCTP SAP [%d] configuration FAILED!\n", id); - return FTDM_FAIL; - } -} - -/**********************************************************************************************/ -/* M2UA - General configuration */ -static int ftmod_m2ua_gen_config(void) -{ - Pst pst; - MwMgmt cfg; - - memset((U8 *)&cfg, 0, sizeof(MwMgmt)); - memset((U8 *)&pst, 0, sizeof(Pst)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cfg.hdr.msgType = TCFG; /* message type */ - cfg.hdr.entId.ent = ENTMW; /* entity */ - cfg.hdr.entId.inst = 0; /* instance */ - cfg.hdr.elmId.elmnt = STMWGEN; /* General */ - cfg.hdr.transId = 0; /* transaction identifier */ - - cfg.hdr.response.selector = 0; - cfg.hdr.response.prior = PRIOR0; - cfg.hdr.response.route = RTESPEC; - cfg.hdr.response.mem.region = S_REG; - cfg.hdr.response.mem.pool = S_POOL; - - - - cfg.t.cfg.s.genCfg.nodeType = LMW_TYPE_SGP; /* NodeType == SGP or ASP */ - cfg.t.cfg.s.genCfg.maxNmbIntf = MW_MAX_NUM_OF_INTF; - cfg.t.cfg.s.genCfg.maxNmbCluster = MW_MAX_NUM_OF_CLUSTER; - cfg.t.cfg.s.genCfg.maxNmbPeer = MW_MAX_NUM_OF_PEER; - cfg.t.cfg.s.genCfg.maxNmbSctSap = MW_MAX_NUM_OF_SCT_SAPS; - cfg.t.cfg.s.genCfg.timeRes = 1; /* timer resolution */ - cfg.t.cfg.s.genCfg.maxClusterQSize = MW_MAX_CLUSTER_Q_SIZE; - cfg.t.cfg.s.genCfg.maxIntfQSize = MW_MAX_INTF_Q_SIZE; - -#ifdef LCMWMILMW - cfg.t.cfg.s.genCfg.reConfig.smPst.selector = 0; /* selector */ -#else /* LCSBMILSB */ - cfg.t.cfg.s.genCfg.reConfig.smPst.selector = 1; /* selector */ -#endif /* LCSBMILSB */ - - cfg.t.cfg.s.genCfg.reConfig.smPst.region = S_REG; /* region */ - cfg.t.cfg.s.genCfg.reConfig.smPst.pool = S_POOL; /* pool */ - cfg.t.cfg.s.genCfg.reConfig.smPst.prior = PRIOR0; /* priority */ - cfg.t.cfg.s.genCfg.reConfig.smPst.route = RTESPEC; /* route */ - - cfg.t.cfg.s.genCfg.reConfig.smPst.dstEnt = ENTSM; /* dst entity */ - cfg.t.cfg.s.genCfg.reConfig.smPst.dstInst = S_INST; /* dst inst */ - cfg.t.cfg.s.genCfg.reConfig.smPst.dstProcId = SFndProcId(); /* src proc id */ - - cfg.t.cfg.s.genCfg.reConfig.smPst.srcEnt = ENTMW; /* src entity */ - cfg.t.cfg.s.genCfg.reConfig.smPst.srcInst = S_INST; /* src inst */ - cfg.t.cfg.s.genCfg.reConfig.smPst.srcProcId = SFndProcId(); /* src proc id */ - - cfg.t.cfg.s.genCfg.reConfig.tmrFlcPoll.enb = TRUE; /* SCTP Flc Poll timer */ - cfg.t.cfg.s.genCfg.reConfig.tmrFlcPoll.val = 10; - -#ifdef MWASP - cfg.t.cfg.s.genCfg.reConfig.tmrAspm.enb = TRUE; /* ASPM timer */ - cfg.t.cfg.s.genCfg.reConfig.tmrAspm.val = 10; - cfg.t.cfg.s.genCfg.reConfig.tmrHeartBeat.enb = TRUE; /* Heartbeat timer */ - cfg.t.cfg.s.genCfg.reConfig.tmrHeartBeat.val = 10; -#endif - -#ifdef MWSG - cfg.t.cfg.s.genCfg.reConfig.tmrAsPend.enb = TRUE; /* AS-PENDING timer */ - cfg.t.cfg.s.genCfg.reConfig.tmrAsPend.val = 10; - cfg.t.cfg.s.genCfg.reConfig.tmrCongPoll.enb = TRUE; /* SS7 Congestion poll timer */ - cfg.t.cfg.s.genCfg.reConfig.tmrCongPoll.val = 10; - cfg.t.cfg.s.genCfg.reConfig.tmrHeartBeat.enb = FALSE; /* HBtimer only at ASP */ -#endif - cfg.t.cfg.s.genCfg.reConfig.aspmRetry = 5; - - return (sng_cfg_m2ua (&pst, &cfg)); -} - -/**********************************************************************************************/ -static int ftmod_m2ua_peer_config(int id) -{ - int x = 0; - int peer_id = 0; - sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id]; - sng_m2ua_cluster_cfg_t* clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId]; - sng_m2ua_peer_cfg_t* peer = NULL; - - if((clust->flags & SNGSS7_CONFIGURED)){ - ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_peer_config: Cluster [%s] is already configured \n", clust->name); - return 0x00; - } - - /*NOTE : SCTSAP is based on per source address , so if we have same Cluster / peer shared across many then - * we dont have do configuration for each time */ - - /* loop through peer list from cluster to configure SCTSAP */ - - for(x = 0; x < clust->numOfPeers;x++){ - peer_id = clust->peerIdLst[x]; - peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id]; - if(ftmod_m2ua_sctsap_config(id, peer->sctpId)){ - ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config FAILED \n", id); - return 0x01; - }else{ - ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_sctsap_config: M2UA SCTSAP for M2UA Intf Id[%d] config SUCCESS \n", id); - } - if(ftmod_m2ua_peer_config1(id, peer_id)){ - ftdm_log (FTDM_LOG_ERROR, " ftmod_m2ua_peer_config1: M2UA Peer[%d] configuration for M2UA Intf Id[%d] config FAILED \n", peer_id, id); - return 0x01; - }else{ - ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_peer_config1: M2UA Peer[%d] configuration for M2UA Intf Id[%d] config SUCCESS \n", peer_id, id); - } - - clust->sct_sap_id = id; - - /* set configured flag for cluster and peer */ - clust->flags |= SNGSS7_CONFIGURED; - peer->flags |= SNGSS7_CONFIGURED; - } - - return 0x0;; -} - - -static int ftmod_m2ua_sctsap_config(int sct_sap_id, int sctp_id) -{ - int i; - int ret; - Pst pst; - MwMgmt cfg; - MwMgmt cfm; - sng_sctp_link_t *sctp = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[sctp_id]; - - - - memset((U8 *)&cfg, 0, sizeof(MwMgmt)); - memset((U8 *)&cfm, 0, sizeof(MwMgmt)); - memset((U8 *)&pst, 0, sizeof(Pst)); - - /* check is sct_sap is already configured */ - if(!ftmod_m2ua_ssta_req(STMWSCTSAP, sct_sap_id, &cfm )){ - ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_sctsap_config: SCT SAP [%s] is already configured \n", sctp->name); - return 0x00; - } - - if(LCM_REASON_INVALID_SAP == cfm.cfm.reason){ - ftdm_log (FTDM_LOG_INFO, " ftmod_m2ua_sctsap_config: SCT SAP [%s] is not configured..configuring now \n", sctp->name); - } - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cfg.hdr.msgType = TCFG; /* message type */ - cfg.hdr.entId.ent = ENTMW; /* entity */ - cfg.hdr.entId.inst = 0; /* instance */ - cfg.hdr.elmId.elmnt = STMWSCTSAP; /* SCTSAP */ - cfg.hdr.transId = 0; /* transaction identifier */ - - cfg.hdr.response.selector = 0; - cfg.hdr.response.prior = PRIOR0; - cfg.hdr.response.route = RTESPEC; - cfg.hdr.response.mem.region = S_REG; - cfg.hdr.response.mem.pool = S_POOL; - - cfg.t.cfg.s.sctSapCfg.reConfig.selector = 0; - - /* service user SAP ID */ - cfg.t.cfg.s.sctSapCfg.suId = sct_sap_id; - /* service provider ID */ - cfg.t.cfg.s.sctSapCfg.spId = sctp_id; - /* source port number */ - cfg.t.cfg.s.sctSapCfg.srcPort = sctp->port; - /* interface address */ - /*For multiple IP address support */ -#ifdef SCT_ENDP_MULTI_IPADDR - cfg.t.cfg.s.sctSapCfg.srcAddrLst.nmb = sctp->numSrcAddr; - for (i=0; i <= (sctp->numSrcAddr-1); i++) { - cfg.t.cfg.s.sctSapCfg.srcAddrLst.nAddr[i].type = CM_NETADDR_IPV4; - cfg.t.cfg.s.sctSapCfg.srcAddrLst.nAddr[i].u.ipv4NetAddr = sctp->srcAddrList[i+1]; - } -#else - /* for single ip support ,src address will always be one */ - cfg.t.cfg.s.sctSapCfg.intfAddr.type = CM_NETADDR_IPV4; - cfg.t.cfg.s.sctSapCfg.intfAddr.u.ipv4NetAddr = sctp->srcAddrList[1]; -#endif - - /* lower SAP primitive timer */ - cfg.t.cfg.s.sctSapCfg.reConfig.tmrPrim.enb = TRUE; - cfg.t.cfg.s.sctSapCfg.reConfig.tmrPrim.val = 10; - /* Association primitive timer */ - cfg.t.cfg.s.sctSapCfg.reConfig.tmrAssoc.enb = TRUE; - cfg.t.cfg.s.sctSapCfg.reConfig.tmrAssoc.val = 10; - /* maxnumber of retries */ - cfg.t.cfg.s.sctSapCfg.reConfig.nmbMaxPrimRetry = 5; - /* Life Time of Packets */ - cfg.t.cfg.s.sctSapCfg.reConfig.lifeTime = 200; - /* priority */ - cfg.t.cfg.s.sctSapCfg.reConfig.prior = PRIOR0; - /* route */ - cfg.t.cfg.s.sctSapCfg.reConfig.route = RTESPEC; - cfg.t.cfg.s.sctSapCfg.reConfig.ent = ENTSB; - cfg.t.cfg.s.sctSapCfg.reConfig.inst = 0; - cfg.t.cfg.s.sctSapCfg.reConfig.procId = SFndProcId(); - /* memory region and pool ID */ - cfg.t.cfg.s.sctSapCfg.reConfig.mem.region = S_REG; - cfg.t.cfg.s.sctSapCfg.reConfig.mem.pool = S_POOL; - - if (0 == (ret = sng_cfg_m2ua (&pst, &cfg))){ - sctp->flags |= SNGSS7_CONFIGURED; - } - - return ret; -} - -/****************************************************************************************************/ - -/* M2UA - Peer configuration */ -static int ftmod_m2ua_peer_config1(int m2ua_inf_id, int peer_id) -{ - int i; - Pst pst; - MwMgmt cfg; - sng_m2ua_peer_cfg_t* peer = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[peer_id]; - sng_sctp_link_t *sctp = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[peer->sctpId]; - - memset((U8 *)&cfg, 0, sizeof(MwMgmt)); - memset((U8 *)&pst, 0, sizeof(Pst)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cfg.hdr.msgType = TCFG; /* message type */ - cfg.hdr.entId.ent = ENTMW; /* entity */ - cfg.hdr.entId.inst = 0; /* instance */ - cfg.hdr.elmId.elmnt = STMWPEER; /* Peer */ - cfg.hdr.transId = 0; /* transaction identifier */ - - cfg.hdr.response.selector = 0; - cfg.hdr.response.prior = PRIOR0; - cfg.hdr.response.route = RTESPEC; - cfg.hdr.response.mem.region = S_REG; - cfg.hdr.response.mem.pool = S_POOL; - - - - cfg.t.cfg.s.peerCfg.peerId = peer->id; /* peer id */ - cfg.t.cfg.s.peerCfg.aspIdFlag = peer->aspIdFlag; /* aspId flag */ -#ifdef MWASP - cfg.t.cfg.s.peerCfg.selfAspId = peer->selfAspId; /* aspId */ -#endif - cfg.t.cfg.s.peerCfg.assocCfg.suId = peer->sctpId; /* SCTSAP ID */ - cfg.t.cfg.s.peerCfg.assocCfg.dstAddrLst.nmb = peer->numDestAddr; - for (i=0; i <= (peer->numDestAddr); i++) { - cfg.t.cfg.s.peerCfg.assocCfg.dstAddrLst.nAddr[i].type = CM_NETADDR_IPV4; - cfg.t.cfg.s.peerCfg.assocCfg.dstAddrLst.nAddr[i].u.ipv4NetAddr = peer->destAddrList[i]; - } -#ifdef MW_CFG_DSTPORT - cfg.t.cfg.s.peerCfg.assocCfg.dstPort = peer->port; /* Port on which M2UA runs */ -#endif - cfg.t.cfg.s.peerCfg.assocCfg.srcAddrLst.nmb = sctp->numSrcAddr; /* source address list */ - for (i=0; i <= (sctp->numSrcAddr-1); i++) { - cfg.t.cfg.s.peerCfg.assocCfg.srcAddrLst.nAddr[i].type = CM_NETADDR_IPV4; - cfg.t.cfg.s.peerCfg.assocCfg.srcAddrLst.nAddr[i].u.ipv4NetAddr = sctp->srcAddrList[i+1]; - } - - cfg.t.cfg.s.peerCfg.assocCfg.priDstAddr.type = CM_NETADDR_IPV4; - cfg.t.cfg.s.peerCfg.assocCfg.priDstAddr.u.ipv4NetAddr = cfg.t.cfg.s.peerCfg.assocCfg.dstAddrLst.nAddr[0].u.ipv4NetAddr; - - cfg.t.cfg.s.peerCfg.assocCfg.locOutStrms = peer->locOutStrms; -#ifdef SCT3 - cfg.t.cfg.s.peerCfg.assocCfg.tos = 0; -#endif - - return (sng_cfg_m2ua (&pst, &cfg)); -} -/**********************************************************************************************/ -/* M2UA - Cluster configuration */ -static int ftmod_m2ua_cluster_config(int id) -{ - int i; - Pst pst; - MwMgmt cfg; - sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id]; - sng_m2ua_cluster_cfg_t* clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId]; - - memset((U8 *)&cfg, 0, sizeof(MwMgmt)); - memset((U8 *)&pst, 0, sizeof(Pst)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cfg.hdr.msgType = TCFG; /* message type */ - cfg.hdr.entId.ent = ENTMW; /* entity */ - cfg.hdr.entId.inst = 0; /* instance */ - cfg.hdr.elmId.elmnt = STMWCLUSTER; /* Cluster */ - cfg.hdr.transId = 0; /* transaction identifier */ - - cfg.hdr.response.selector = 0; - cfg.hdr.response.prior = PRIOR0; - cfg.hdr.response.route = RTESPEC; - cfg.hdr.response.mem.region = S_REG; - cfg.hdr.response.mem.pool = S_POOL; - - - cfg.t.cfg.s.clusterCfg.clusterId = clust->id; - cfg.t.cfg.s.clusterCfg.trfMode = clust->trfMode; - cfg.t.cfg.s.clusterCfg.loadshareMode = clust->loadShareAlgo; - cfg.t.cfg.s.clusterCfg.reConfig.nmbPeer = clust->numOfPeers; - for(i=0; i<(clust->numOfPeers);i++) { - cfg.t.cfg.s.clusterCfg.reConfig.peer[i] = clust->peerIdLst[i]; - } - - return (sng_cfg_m2ua (&pst, &cfg)); -} - -/**********************************************************************************************/ - -/* M2UA - DLSAP configuration */ -static int ftmod_m2ua_dlsap_config(int id) -{ - Pst pst; - MwMgmt cfg; - sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id]; - - memset((U8 *)&cfg, 0, sizeof(MwMgmt)); - memset((U8 *)&pst, 0, sizeof(Pst)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cfg.hdr.msgType = TCFG; /* message type */ - cfg.hdr.entId.ent = ENTMW; /* entity */ - cfg.hdr.entId.inst = 0; /* instance */ - cfg.hdr.elmId.elmnt = STMWDLSAP; /* DLSAP */ - cfg.hdr.transId = 0; /* transaction identifier */ - - cfg.hdr.response.selector = 0; - cfg.hdr.response.prior = PRIOR0; - cfg.hdr.response.route = RTESPEC; - cfg.hdr.response.mem.region = S_REG; - cfg.hdr.response.mem.pool = S_POOL; - - - cfg.t.cfg.s.dlSapCfg.lnkNmb = id; /* SapId */ - cfg.t.cfg.s.dlSapCfg.intfId.type = LMW_INTFID_INT; - cfg.t.cfg.s.dlSapCfg.intfId.id.intId = m2ua->iid; - - cfg.t.cfg.s.dlSapCfg.swtch = LMW_SAP_ITU; - - cfg.t.cfg.s.dlSapCfg.reConfig.clusterId = m2ua->clusterId; - cfg.t.cfg.s.dlSapCfg.reConfig.selector = 0; /* Loosely couple mode */ - /* memory region and pool id*/ - cfg.t.cfg.s.dlSapCfg.reConfig.mem.region = S_REG; - cfg.t.cfg.s.dlSapCfg.reConfig.mem.pool = S_POOL; - /* priority */ - cfg.t.cfg.s.dlSapCfg.reConfig.prior = PRIOR0; - /* route */ - cfg.t.cfg.s.dlSapCfg.reConfig.route = RTESPEC; - - return (sng_cfg_m2ua (&pst, &cfg)); - -} -/*****************************************************************************/ -/* NIF - General configuration */ -static int ftmod_nif_gen_config(void) -{ - Pst pst; - NwMgmt cfg; - - memset((U8 *)&cfg, 0, sizeof(NwMgmt)); - memset((U8 *)&pst, 0, sizeof(Pst)); - - smPstInit(&pst); - - pst.dstEnt = ENTNW; - - /* prepare header */ - cfg.hdr.msgType = TCFG; /* message type */ - cfg.hdr.entId.ent = ENTNW; /* entity */ - cfg.hdr.entId.inst = 0; /* instance */ - cfg.hdr.elmId.elmnt = STNWGEN; /* DLSAP */ - cfg.hdr.transId = 0; /* transaction identifier */ - - cfg.hdr.response.selector = 0; - cfg.hdr.response.prior = PRIOR0; - cfg.hdr.response.route = RTESPEC; - cfg.hdr.response.mem.region = S_REG; - cfg.hdr.response.mem.pool = S_POOL; - - cfg.t.cfg.s.genCfg.maxNmbDlSap = NW_MAX_NUM_OF_DLSAPS; - cfg.t.cfg.s.genCfg.timeRes = 1; /* timer resolution */ - - cfg.t.cfg.s.genCfg.reConfig.maxNmbRetry = NW_MAX_NUM_OF_RETRY; - cfg.t.cfg.s.genCfg.reConfig.tmrRetry.enb = TRUE; /* SS7 Congestion poll timer */ - cfg.t.cfg.s.genCfg.reConfig.tmrRetry.val = NW_RETRY_TMR_VALUE; - -#ifdef LCNWMILNW - cfg.t.cfg.s.genCfg.reConfig.smPst.selector = 0; /* selector */ -#else /* LCSBMILSB */ - cfg.t.cfg.s.genCfg.reConfig.smPst.selector = 1; /* selector */ -#endif /* LCSBMILSB */ - - cfg.t.cfg.s.genCfg.reConfig.smPst.region = S_REG; /* region */ - cfg.t.cfg.s.genCfg.reConfig.smPst.pool = S_POOL; /* pool */ - cfg.t.cfg.s.genCfg.reConfig.smPst.prior = PRIOR0; /* priority */ - cfg.t.cfg.s.genCfg.reConfig.smPst.route = RTESPEC; /* route */ - - cfg.t.cfg.s.genCfg.reConfig.smPst.dstEnt = ENTSM; /* dst entity */ - cfg.t.cfg.s.genCfg.reConfig.smPst.dstInst = 0; /* dst inst */ - cfg.t.cfg.s.genCfg.reConfig.smPst.dstProcId = SFndProcId(); /* src proc id */ - - cfg.t.cfg.s.genCfg.reConfig.smPst.srcEnt = ENTNW; /* src entity */ - cfg.t.cfg.s.genCfg.reConfig.smPst.srcInst = 0; /* src inst */ - cfg.t.cfg.s.genCfg.reConfig.smPst.srcProcId = SFndProcId(); /* src proc id */ - - return (sng_cfg_nif (&pst, &cfg)); - -} - -/*****************************************************************************/ - -/* NIF - DLSAP configuration */ -static int ftmod_nif_dlsap_config(int id) -{ - Pst pst; - NwMgmt cfg; - sng_nif_cfg_t* nif = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[id]; - - memset((U8 *)&cfg, 0, sizeof(NwMgmt)); - memset((U8 *)&pst, 0, sizeof(Pst)); - - smPstInit(&pst); - - pst.dstEnt = ENTNW; - - /* prepare header */ - cfg.hdr.msgType = TCFG; /* message type */ - cfg.hdr.entId.ent = ENTNW; /* entity */ - cfg.hdr.entId.inst = 0; /* instance */ - cfg.hdr.elmId.elmnt = STNWDLSAP; /* DLSAP */ - cfg.hdr.transId = 0; /* transaction identifier */ - - cfg.hdr.response.selector = 0; - cfg.hdr.response.prior = PRIOR0; - cfg.hdr.response.route = RTESPEC; - cfg.hdr.response.mem.region = S_REG; - cfg.hdr.response.mem.pool = S_POOL; - cfg.t.cfg.s.dlSapCfg.suId = nif->id; - cfg.t.cfg.s.dlSapCfg.m2uaLnkNmb = nif->m2uaLnkNmb; - cfg.t.cfg.s.dlSapCfg.mtp2LnkNmb = nif->mtp2LnkNmb; - - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.selector = 0; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.region = S_REG; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.pool = S_POOL; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.route = RTESPEC; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.prior = PRIOR0; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.srcEnt = ENTNW; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.srcInst = 0; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.srcProcId = SFndProcId(); - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.dstEnt = ENTMW; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.dstInst = 0; - cfg.t.cfg.s.dlSapCfg.reConfig.m2uaPst.dstProcId = SFndProcId(); - - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.selector = 0; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.region = S_REG; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.pool = S_POOL; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.route = RTESPEC; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.prior = PRIOR0; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.srcEnt = ENTNW; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.srcInst = 0; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.srcProcId = SFndProcId(); - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.dstEnt = ENTSD; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.dstInst = 0; - cfg.t.cfg.s.dlSapCfg.reConfig.mtp2Pst.dstProcId = SFndProcId(); - - return (sng_cfg_nif (&pst, &cfg)); -} - -/*****************************************************************************/ -uint32_t iptoul(const char *ip) -{ - char i,*tmp; - int strl; - char strIp[16]; - unsigned long val=0, cvt; - if (!ip) - return 0; - - memset(strIp, 0, sizeof(char)*16); - strl = strlen(ip); - strncpy(strIp, ip, strl>=15?15:strl); - - - tmp=strtok(strIp, "."); - for (i=0;i<4;i++) - { - sscanf(tmp, "%lu", &cvt); - val <<= 8; - val |= (unsigned char)cvt; - tmp=strtok(NULL,"."); - } - return (uint32_t)val; -} -/***********************************************************************************************************************/ -void ftmod_ss7_enable_m2ua_sg_logging(void){ - - /* Enable DEBUGs*/ - ftmod_sctp_debug(AENA); - ftmod_m2ua_debug(AENA); - ftmod_tucl_debug(AENA); -} - -/***********************************************************************************************************************/ -void ftmod_ss7_disable_m2ua_sg_logging(void){ - - /* DISABLE DEBUGs*/ - ftmod_sctp_debug(ADISIMM); - ftmod_m2ua_debug(ADISIMM); - ftmod_tucl_debug(ADISIMM); -} - -/***********************************************************************************************************************/ -int ftmod_ss7_m2ua_start(void){ - int x=0; - -/***********************************************************************************************************************/ - x = 1; - while(xclusterId]; - - if(clust->flags & SNGSS7_M2UA_EP_OPENED) { - ftdm_log (FTDM_LOG_INFO ," END-POINT already opened\n"); - return ret; - } - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(MwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTMW; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STMWSCTSAP; /* General */ - cntrl.hdr.transId = 1; /* transaction identifier */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - - cntrl.t.cntrl.action = AMWENDPOPEN; - cntrl.t.cntrl.s.suId = m2ua->id; /* M2UA sct sap Id */ - - - if(0 == (ret = sng_cntrl_m2ua (&pst, &cntrl))){ - clust->flags |= SNGSS7_M2UA_EP_OPENED; - } - return ret; - -} - -/***********************************************************************************************************************/ -static int ftmod_init_sctp_assoc(int peer_id) -{ - - Pst pst; - MwMgmt cntrl; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(MwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTMW; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STMWPEER; /* General */ - cntrl.hdr.transId = 1; /* transaction identifier */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - - cntrl.t.cntrl.action = AMWESTABLISH; - /*cntrl.t.cntrl.s.suId = 1;*/ - - cntrl.t.cntrl.s.peerId = (MwPeerId) peer_id; - - return (sng_cntrl_m2ua (&pst, &cntrl)); -} - -/***********************************************************************************************************************/ -static int ftmod_sctp_tucl_tsap_bind(int id) -{ - Pst pst; - SbMgmt cntrl; - sng_sctp_link_t *k = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[id]; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(SbMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTSB; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTSB; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STSBTSAP; /* General */ - cntrl.hdr.transId = 1; /* transaction identifier */ - - cntrl.hdr.response.selector = 0; - - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = ABND_ENA; - cntrl.t.cntrl.sapId = k->id; /* SCT sap id configured at SCTP layer */ - - return (sng_cntrl_sctp (&pst, &cntrl)); -} -/***********************************************************************************************************************/ - -static int ftmod_m2ua_sctp_sctsap_bind(int id) -{ - int ret = 0x00; - Pst pst; - MwMgmt cntrl; - sng_m2ua_cfg_t* m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id]; - sng_m2ua_cluster_cfg_t* clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId]; - - if(clust->flags & SNGSS7_ACTIVE) { - ftdm_log (FTDM_LOG_INFO ," SCT-SAP is already enabled\n"); - return ret; - } - - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(MwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTMW; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STMWSCTSAP; /* General */ - cntrl.hdr.transId = 1; /* transaction identifier */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = ABND; - cntrl.t.cntrl.s.suId = m2ua->id; - - if(0 == (ret = sng_cntrl_m2ua (&pst, &cntrl))){ - clust->flags |= SNGSS7_ACTIVE; - } - return ret; -} -/***********************************************************************************************************************/ -static int ftmod_nif_m2ua_dlsap_bind(int id) -{ - Pst pst; - NwMgmt cntrl; - sng_nif_cfg_t* nif = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[id]; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(NwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTNW; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTNW; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STNWDLSAP; /* General */ - cntrl.hdr.transId = 1; /* transaction identifier */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = ABND; - cntrl.t.cntrl.suId = nif->id; /* NIF DL sap Id */ - cntrl.t.cntrl.entity = ENTMW; /* M2UA */ - - return (sng_cntrl_nif (&pst, &cntrl)); - -} - -/***********************************************************************************************************************/ -static int ftmod_nif_mtp2_dlsap_bind(int id) -{ - Pst pst; - NwMgmt cntrl; - sng_nif_cfg_t* nif = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[id]; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(NwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTNW; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTNW; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STNWDLSAP; /* General */ - cntrl.hdr.transId = 1; /* transaction identifier */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = ABND; - cntrl.t.cntrl.suId = nif->id; /* NIF DL sap Id */ - cntrl.t.cntrl.entity = ENTSD; /* MTP2 */ - - return (sng_cntrl_nif (&pst, &cntrl)); - -} - -/***********************************************************************************************************************/ -static int ftmod_sctp_debug(int action) -{ - Pst pst; - SbMgmt cntrl; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(SbMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTSB; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTSB; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STSBGEN; /* General */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = action; - cntrl.t.cntrl.subAction = SADBG; - cntrl.t.cntrl.dbgMask = 0xFFFF; - - return (sng_cntrl_sctp (&pst, &cntrl)); -} -/***********************************************************************************************************************/ - -static int ftmod_m2ua_debug(int action) -{ - Pst pst; - MwMgmt cntrl; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(MwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTMW; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STMWGEN; /* General */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = action; - cntrl.t.cntrl.subAction = SADBG; - cntrl.t.cntrl.s.dbgMask = 0xFFFF; - - return (sng_cntrl_m2ua (&pst, &cntrl)); -} -/***********************************************************************************************************************/ -static int ftmod_tucl_debug(int action) -{ - Pst pst; - HiMngmt cntrl; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&cntrl, 0, sizeof(HiMngmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTHI; - - /* prepare header */ - cntrl.hdr.msgType = TCNTRL; /* message type */ - cntrl.hdr.entId.ent = ENTHI; /* entity */ - cntrl.hdr.entId.inst = 0; /* instance */ - cntrl.hdr.elmId.elmnt = STGEN; /* General */ - - cntrl.hdr.response.selector = 0; - cntrl.hdr.response.prior = PRIOR0; - cntrl.hdr.response.route = RTESPEC; - cntrl.hdr.response.mem.region = S_REG; - cntrl.hdr.response.mem.pool = S_POOL; - - cntrl.t.cntrl.action = action; - cntrl.t.cntrl.subAction = SADBG; - cntrl.t.cntrl.ctlType.hiDbg.dbgMask = 0xFFFF; - - return (sng_cntrl_tucl (&pst, &cntrl)); -} -/***********************************************************************************************************************/ - -/***********************************************************************************************************************/ -int ftmod_sctp_ssta_req(int elemt, int id, SbMgmt* cfm) -{ - SbMgmt ssta; - Pst pst; - sng_sctp_link_t *k = &g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[id]; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&ssta, 0, sizeof(SbMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTSB; - - /* prepare header */ - ssta.hdr.msgType = TSSTA; /* message type */ - ssta.hdr.entId.ent = ENTSB; /* entity */ - ssta.hdr.entId.inst = 0; /* instance */ - ssta.hdr.elmId.elmnt = elemt; /* STSBGEN */ /* Others are STSBTSAP, STSBSCTSAP, STSBASSOC, STSBDTA, STSBTMR */ - ssta.hdr.transId = 1; /* transaction identifier */ - - ssta.hdr.response.selector = 0; - ssta.hdr.response.prior = PRIOR0; - ssta.hdr.response.route = RTESPEC; - ssta.hdr.response.mem.region = S_REG; - ssta.hdr.response.mem.pool = S_POOL; - - if((ssta.hdr.elmId.elmnt == STSBSCTSAP) || (ssta.hdr.elmId.elmnt == STSBTSAP)) - { - ssta.t.ssta.sapId = k->id; /* SapId */ - } - if(ssta.hdr.elmId.elmnt == STSBASSOC) - { - /*TODO - how to get assoc Id*/ - ssta.t.ssta.s.assocSta.assocId = 0; /* association id */ - } - return(sng_sta_sctp(&pst,&ssta,cfm)); -} - -int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm) -{ - MwMgmt ssta; - Pst pst; - sng_m2ua_cfg_t* m2ua = NULL; - sng_m2ua_cluster_cfg_t* clust = NULL; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&ssta, 0, sizeof(MwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTMW; - - /* prepare header */ - ssta.hdr.msgType = TSSTA; /* message type */ - ssta.hdr.entId.ent = ENTMW; /* entity */ - ssta.hdr.entId.inst = 0; /* instance */ - ssta.hdr.elmId.elmnt = elemt; /*STMWGEN */ /* Others are STMWSCTSAP, STMWCLUSTER, STMWPEER,STMWSID, STMWDLSAP */ - ssta.hdr.transId = 1; /* transaction identifier */ - - ssta.hdr.response.selector = 0; - ssta.hdr.response.prior = PRIOR0; - ssta.hdr.response.route = RTESPEC; - ssta.hdr.response.mem.region = S_REG; - ssta.hdr.response.mem.pool = S_POOL; - - switch(ssta.hdr.elmId.elmnt) - { - case STMWSCTSAP: - { - m2ua = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[id]; - clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[m2ua->clusterId]; - ssta.t.ssta.id.suId = clust->sct_sap_id ; /* lower sap Id */ - break; - } - case STMWDLSAP: - { - ssta.t.ssta.id.lnkNmb = id ; /* upper sap Id */ - break; - } - case STMWPEER: - { - ssta.t.ssta.id.peerId = id ; /* peer Id */ - break; - } - case STMWCLUSTER: - { - clust = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[id]; - ssta.t.ssta.id.clusterId = clust->id ; /* cluster Id */ - break; - } - default: - break; - } - - return(sng_sta_m2ua(&pst,&ssta,cfm)); -} - -int ftmod_nif_ssta_req(int elemt, int id, NwMgmt* cfm) -{ - NwMgmt ssta; - Pst pst; - sng_nif_cfg_t* nif = &g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[id]; - - memset((U8 *)&pst, 0, sizeof(Pst)); - memset((U8 *)&ssta, 0, sizeof(NwMgmt)); - - smPstInit(&pst); - - pst.dstEnt = ENTNW; - - /* prepare header */ - ssta.hdr.msgType = TSSTA; /* message type */ - ssta.hdr.entId.ent = ENTNW; /* entity */ - ssta.hdr.entId.inst = 0; /* instance */ - ssta.hdr.elmId.elmnt = elemt; - - ssta.hdr.response.selector = 0; - ssta.hdr.response.prior = PRIOR0; - ssta.hdr.response.route = RTESPEC; - ssta.hdr.response.mem.region = S_REG; - ssta.hdr.response.mem.pool = S_POOL; - ssta.t.ssta.suId = nif->id; /* Lower sapId */ - - return(sng_sta_nif(&pst,&ssta,cfm)); -} diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h deleted file mode 100644 index 8bb564d284..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2012, Kapil Gupta - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributors: - * - */ -/******************************************************************************/ -#ifndef __FTMOD_SNG_SS7_M2UA_H__ -#define __FTMOD_SNG_SS7_M2UA_H__ -/******************************************************************************/ -#include "private/ftdm_core.h" - -#define MAX_NAME_LEN 25 - -typedef struct sng_nif_cfg{ - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; - uint32_t m2uaLnkNmb; - uint32_t mtp2LnkNmb; -}sng_nif_cfg_t; - -typedef enum{ - SNG_M2UA_NODE_TYPE_SGP = 1, /* type SG */ - SNG_M2UA_NODE_TYPE_ASP = 2, /* type ASP */ -}sng_m2ua_node_types_e; - -typedef struct sng_m2ua_cfg{ - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; /* ID */ - uint32_t iid; /* ID */ - uint8_t nodeType; /*Node Type SG/ASP */ - uint8_t end_point_opened; /* flag to check is end-point already opened */ - uint16_t clusterId; /* idx to m2ua_cluster profile */ -}sng_m2ua_cfg_t; - -typedef struct sng_m2ua_peer_cfg{ - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; /* ID */ - uint8_t aspIdFlag; /* Flag used to indicate whether include the ASP ID in the ASP UP message */ - uint16_t selfAspId; /* Self ASP ID. ASP identifier for this ASP node if the aspIdFlag is TRUE. */ - uint32_t numDestAddr; /* Number of destination address defined */ - uint16_t sctpId; /* idx to sctp profile */ - uint16_t port; - uint32_t destAddrList[SCT_MAX_NET_ADDRS+1]; /* Destination adddress list */ - uint16_t locOutStrms; /*Number of outgoing streams supported by this association*/ - int init_sctp_assoc; /* flag to tell if we need to initiate SCTP association */ -}sng_m2ua_peer_cfg_t; - -typedef enum{ - SNG_M2UA_LOAD_SHARE_ALGO_RR = 0x1, /* Round Robin Mode*/ - SNG_M2UA_LOAD_SHARE_ALGO_LS = 0x2, /* Link Specified */ - SNG_M2UA_LOAD_SHARE_ALGO_CS = 0x3, /* Customer Specified */ -}sng_m2ua_load_share_algo_types_e; - - -/* Possible values of Traffic mode */ -typedef enum{ - SNG_M2UA_TRF_MODE_OVERRIDE = 0x1, /* Override Mode */ - SNG_M2UA_TRF_MODE_LOADSHARE = 0x2, /* Loadshare Mode */ - SNG_M2UA_TRF_MODE_BROADCAST = 0x3, /* Broadcast Mode */ - SNG_M2UA_TRF_MODE_ANY = 0x0, /* ANY Mode */ -}sng_m2ua_traffic_mode_types_e; - -typedef struct sng_m2ua_cluster_cfg{ - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; /* ID */ - uint32_t sct_sap_id; /* Internal - sct_sap_id */ - uint8_t trfMode; /* Traffic mode. This parameter defines the mode in which this m2ua cluster is supposed to work */ - uint8_t loadShareAlgo; /* This parameter defines the M2UA load share algorithm which is used to distribute the traffic */ - uint16_t numOfPeers; /* idx to m2ua_peer profile */ - uint16_t peerIdLst[MW_MAX_NUM_OF_PEER]; /* idx to m2ua_peer profile */ -}sng_m2ua_cluster_cfg_t; - -typedef struct sng_m2ua_gbl_cfg{ - sng_nif_cfg_t nif[MW_MAX_NUM_OF_INTF+1]; - sng_m2ua_cfg_t m2ua[MW_MAX_NUM_OF_INTF+1]; - sng_m2ua_peer_cfg_t m2ua_peer[MW_MAX_NUM_OF_PEER+1]; - sng_m2ua_cluster_cfg_t m2ua_clus[MW_MAX_NUM_OF_CLUSTER+1]; -}sng_m2ua_gbl_cfg_t; - -/* m2ua xml parsing APIs */ -int ftmod_ss7_parse_nif_interfaces(ftdm_conf_node_t *nif_interfaces); -int ftmod_ss7_parse_m2ua_interfaces(ftdm_conf_node_t *m2ua_interfaces); -int ftmod_ss7_parse_m2ua_peer_interfaces(ftdm_conf_node_t *m2ua_peer_interfaces); -int ftmod_ss7_parse_m2ua_clust_interfaces(ftdm_conf_node_t *m2ua_clust_interfaces); -int ftmod_ss7_parse_sctp_links(ftdm_conf_node_t *node); -uint32_t iptoul(const char *ip); - -int ftmod_ss7_m2ua_start(void); -void ftmod_ss7_m2ua_free(void); - -ftdm_status_t ftmod_ss7_m2ua_cfg(void); -ftdm_status_t ftmod_ss7_m2ua_init(void); - -int ftmod_sctp_ssta_req(int elemt, int id, SbMgmt* cfm); -int ftmod_m2ua_ssta_req(int elemt, int id, MwMgmt* cfm); -int ftmod_nif_ssta_req(int elemt, int id, NwMgmt* cfm); -void ftmod_ss7_enable_m2ua_sg_logging(void); -void ftmod_ss7_disable_m2ua_sg_logging(void); - - -#endif /*__FTMOD_SNG_SS7_M2UA_H__*/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c deleted file mode 100644 index bb011c364e..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c +++ /dev/null @@ -1,690 +0,0 @@ -/* - * Copyright (c) 2012, Kapil Gupta - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributors: - * - * - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -static int ftmod_ss7_parse_nif_interface(ftdm_conf_node_t *nif_interface); -static int ftmod_ss7_parse_m2ua_interface(ftdm_conf_node_t *m2ua_interface); -static int ftmod_ss7_parse_m2ua_peer_interface(ftdm_conf_node_t *m2ua_peer_interface); -static int ftmod_ss7_parse_m2ua_clust_interface(ftdm_conf_node_t *m2ua_clust_interface); -static int ftmod_ss7_fill_in_nif_interface(sng_nif_cfg_t *nif_iface); -static int ftmod_ss7_fill_in_m2ua_interface(sng_m2ua_cfg_t *m2ua_iface); -static int ftmod_ss7_fill_in_m2ua_peer_interface(sng_m2ua_peer_cfg_t *m2ua_peer_face); -static int ftmod_ss7_fill_in_m2ua_clust_interface(sng_m2ua_cluster_cfg_t *m2ua_cluster_face); - -static int ftmod_ss7_parse_sctp_link(ftdm_conf_node_t *node); - -/******************************************************************************/ -int ftmod_ss7_parse_nif_interfaces(ftdm_conf_node_t *nif_interfaces) -{ - ftdm_conf_node_t *nif_interface = NULL; - - /* confirm that we are looking at sng_nif_interfaces */ - if (strcasecmp(nif_interfaces->name, "sng_nif_interfaces")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"sng_nif_interfaces\"!\n",nif_interfaces->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"nif_interfaces\"...\n"); - } - - /* extract the isup_interfaces */ - nif_interface = nif_interfaces->child; - - while (nif_interface != NULL) { - /* parse the found mtp_route */ - if (ftmod_ss7_parse_nif_interface(nif_interface)) { - SS7_ERROR("Failed to parse \"nif_interface\"\n"); - return FTDM_FAIL; - } - - /* go to the next nif_interface */ - nif_interface = nif_interface->next; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_nif_interface(ftdm_conf_node_t *nif_interface) -{ - sng_nif_cfg_t sng_nif; - ftdm_conf_parameter_t *parm = nif_interface->parameters; - int num_parms = nif_interface->n_parameters; - int i; - - /* initalize the nif intf and isap structure */ - memset(&sng_nif, 0x0, sizeof(sng_nif)); - - if(!nif_interface){ - SS7_ERROR("ftmod_ss7_parse_nif_interface: Null XML Node pointer \n"); - return FTDM_FAIL; - } - - /* confirm that we are looking at an nif_interface */ - if (strcasecmp(nif_interface->name, "sng_nif_interface")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"nif_interface\"!\n",nif_interface->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"nif_interface\"...\n"); - } - - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - /* try to match the parameter to what we expect */ - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)sng_nif.name, parm->val); - SS7_DEBUG("Found an nif_interface named = %s\n", sng_nif.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - sng_nif.id = atoi(parm->val); - SS7_DEBUG("Found an nif id = %d\n", sng_nif.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "m2ua-interface-id")) { - /**********************************************************************/ - sng_nif.m2uaLnkNmb = atoi(parm->val); - SS7_DEBUG("Found an nif m2ua-interface-id = %d\n", sng_nif.m2uaLnkNmb); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp2-interface-id")) { - /**********************************************************************/ - sng_nif.mtp2LnkNmb=atoi(parm->val); - - SS7_DEBUG("Found an nif mtp2-interface-id = %d\n", sng_nif.mtp2LnkNmb); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter %s!\n", parm->var); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parameter */ - parm = parm + 1; - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - /* fill in the nif interface */ - ftmod_ss7_fill_in_nif_interface(&sng_nif); - - return FTDM_SUCCESS; -} -/******************************************************************************/ -static int ftmod_ss7_fill_in_nif_interface(sng_nif_cfg_t *nif_iface) -{ - int i = nif_iface->id; - - strncpy((char *)g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[i].name, (char *)nif_iface->name, MAX_NAME_LEN-1); - - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[i].id = nif_iface->id; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[i].m2uaLnkNmb = nif_iface->m2uaLnkNmb; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.nif[i].mtp2LnkNmb = nif_iface->mtp2LnkNmb; - - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_NIF_PRESENT); - - return 0; -} - -/******************************************************************************/ -int ftmod_ss7_parse_m2ua_interfaces(ftdm_conf_node_t *m2ua_interfaces) -{ - ftdm_conf_node_t *m2ua_interface = NULL; - - /* confirm that we are looking at sng_m2ua_interfaces */ - if (strcasecmp(m2ua_interfaces->name, "sng_m2ua_interfaces")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"m2ua_nif_interfaces\"!\n",m2ua_interfaces->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"m2ua_interfaces\"...\n"); - } - - /* extract the isup_interfaces */ - m2ua_interface = m2ua_interfaces->child; - - while (m2ua_interface != NULL) { - /* parse the found mtp_route */ - if (ftmod_ss7_parse_m2ua_interface(m2ua_interface)) { - SS7_ERROR("Failed to parse \"m2ua_interface\"\n"); - return FTDM_FAIL; - } - - /* go to the next m2ua_interface */ - m2ua_interface = m2ua_interface->next; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_m2ua_interface(ftdm_conf_node_t *m2ua_interface) -{ - sng_m2ua_cfg_t sng_m2ua; - ftdm_conf_parameter_t *parm = m2ua_interface->parameters; - int num_parms = m2ua_interface->n_parameters; - int i; - - /* initalize the m2ua intf */ - memset(&sng_m2ua, 0x0, sizeof(sng_m2ua)); - - if(!m2ua_interface){ - SS7_ERROR("ftmod_ss7_parse_m2ua_interface: Null XML Node pointer \n"); - return FTDM_FAIL; - } - - /* confirm that we are looking at an nif_interface */ - if (strcasecmp(m2ua_interface->name, "sng_m2ua_interface")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"m2ua_interface\"!\n",m2ua_interface->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"m2ua_interface\"...\n"); - } - - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - /* try to match the parameter to what we expect */ - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)sng_m2ua.name, parm->val); - SS7_DEBUG("Found an m2ua_interface named = %s\n", sng_m2ua.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - sng_m2ua.id = atoi(parm->val); - SS7_DEBUG("Found an m2ua id = %d\n", sng_m2ua.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "m2ua-cluster-interface-id")) { - /**********************************************************************/ - sng_m2ua.clusterId=atoi(parm->val); - - SS7_DEBUG("Found an m2ua cluster_id = %d\n", sng_m2ua.clusterId); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "interface-identifier")) { - /**********************************************************************/ - sng_m2ua.iid=atoi(parm->val); - - SS7_DEBUG("Found an m2ua interface-identifier = %d\n", sng_m2ua.iid); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter %s!\n", parm->var); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parameter */ - parm = parm + 1; - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - sng_m2ua.nodeType = SNG_M2UA_NODE_TYPE_SGP; - - /* fill in the nif interface */ - ftmod_ss7_fill_in_m2ua_interface(&sng_m2ua); - - return FTDM_SUCCESS; -} -/******************************************************************************/ -static int ftmod_ss7_fill_in_m2ua_interface(sng_m2ua_cfg_t *m2ua_iface) -{ - int i = m2ua_iface->id; - - strncpy((char *)g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].name, (char *)m2ua_iface->name, MAX_NAME_LEN-1); - - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].id = m2ua_iface->id; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].nodeType = m2ua_iface->nodeType; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].clusterId = m2ua_iface->clusterId; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua[i].iid = m2ua_iface->iid; - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_M2UA_PRESENT); - - return 0; -} - -/******************************************************************************/ -int ftmod_ss7_parse_m2ua_peer_interfaces(ftdm_conf_node_t *m2ua_peer_interfaces) -{ - ftdm_conf_node_t *m2ua_peer_interface = NULL; - - /* confirm that we are looking at m2ua_peer_interfaces */ - if (strcasecmp(m2ua_peer_interfaces->name, "sng_m2ua_peer_interfaces")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"m2ua_peer_interfaces\"!\n",m2ua_peer_interfaces->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"m2ua_peer_interfaces\"...\n"); - } - - /* extract the m2ua_peer_interfaces */ - m2ua_peer_interface = m2ua_peer_interfaces->child; - - while (m2ua_peer_interface != NULL) { - /* parse the found mtp_route */ - if (ftmod_ss7_parse_m2ua_peer_interface(m2ua_peer_interface)) { - SS7_ERROR("Failed to parse \"m2ua_peer_interface\"\n"); - return FTDM_FAIL; - } - - /* go to the next m2ua_peer_interface */ - m2ua_peer_interface = m2ua_peer_interface->next; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_m2ua_peer_interface(ftdm_conf_node_t *m2ua_peer_interface) -{ - sng_m2ua_peer_cfg_t sng_m2ua_peer; - ftdm_conf_parameter_t *parm = m2ua_peer_interface->parameters; - int num_parms = m2ua_peer_interface->n_parameters; - int i; - - /* initalize the m2ua intf */ - memset(&sng_m2ua_peer, 0x0, sizeof(sng_m2ua_peer)); - - if(!m2ua_peer_interface){ - SS7_ERROR("ftmod_ss7_parse_m2ua_peer_interface: Null XML Node pointer \n"); - return FTDM_FAIL; - } - - /* confirm that we are looking at an m2ua_peer_interface */ - if (strcasecmp(m2ua_peer_interface->name, "sng_m2ua_peer_interface")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"m2ua_peer_interface\"!\n",m2ua_peer_interface->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"m2ua_peer_interface\"...\n"); - } - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - /* try to match the parameter to what we expect */ - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)sng_m2ua_peer.name, parm->val); - SS7_DEBUG("Found an sng_m2ua_peer named = %s\n", sng_m2ua_peer.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - sng_m2ua_peer.id = atoi(parm->val); - SS7_DEBUG("Found an sng_m2ua_peer id = %d\n", sng_m2ua_peer.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "include-asp-identifier")) { - /**********************************************************************/ - if(!strcasecmp(parm->val, "TRUE")){ - sng_m2ua_peer.aspIdFlag = 0x01; - } else if(!strcasecmp(parm->val, "FALSE")){ - sng_m2ua_peer.aspIdFlag = 0x00; - } else { - SS7_ERROR("Found an invalid aspIdFlag Parameter Value[%s]\n", parm->val); - return FTDM_FAIL; - } - SS7_DEBUG("Found an sng_m2ua_peer aspIdFlag = %d\n", sng_m2ua_peer.aspIdFlag); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "asp-identifier")) { - /**********************************************************************/ - sng_m2ua_peer.selfAspId=atoi(parm->val); - - SS7_DEBUG("Found an sng_m2ua_peer self_asp_id = %d\n", sng_m2ua_peer.selfAspId); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "sctp-interface-id")) { - /**********************************************************************/ - sng_m2ua_peer.sctpId = atoi(parm->val); - - SS7_DEBUG("Found an sng_m2ua_peer sctp_id = %d\n", sng_m2ua_peer.sctpId); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "destination-port")) { - /**********************************************************************/ - sng_m2ua_peer.port = atoi(parm->val); - - SS7_DEBUG("Found an sng_m2ua_peer port = %d\n", sng_m2ua_peer.port); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "address")) { - /**********************************************************************/ - if (sng_m2ua_peer.numDestAddr < SCT_MAX_NET_ADDRS) { - sng_m2ua_peer.destAddrList[sng_m2ua_peer.numDestAddr] = iptoul (parm->val); - sng_m2ua_peer.numDestAddr++; - SS7_DEBUG("sng_m2ua_peer - Parsing with dest IP Address = %s \n", parm->val); - } else { - SS7_ERROR("sng_m2ua_peer - too many dest address configured. dropping %s \n", parm->val); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "number-of-outgoing-streams")) { - /**********************************************************************/ - sng_m2ua_peer.locOutStrms=atoi(parm->val); - - SS7_DEBUG("Found an sng_m2ua_peer number-of-outgoing-streams = %d\n", sng_m2ua_peer.locOutStrms); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "init-sctp-association")) { - /**********************************************************************/ - if(!strcasecmp(parm->val, "TRUE")){ - sng_m2ua_peer.init_sctp_assoc = 0x01; - } else if(!strcasecmp(parm->val, "FALSE")){ - sng_m2ua_peer.init_sctp_assoc = 0x00; - } else { - SS7_ERROR("Found an invalid init_sctp_assoc Parameter Value[%s]\n", parm->val); - return FTDM_FAIL; - } - - SS7_DEBUG("Found an sng_m2ua_peer init_sctp_assoc = %d\n", sng_m2ua_peer.init_sctp_assoc); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter %s!\n", parm->var); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parameter */ - parm = parm + 1; - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - /* fill in the sng_m2ua_peer interface */ - ftmod_ss7_fill_in_m2ua_peer_interface(&sng_m2ua_peer); - - return FTDM_SUCCESS; -} -/******************************************************************************/ -static int ftmod_ss7_fill_in_m2ua_peer_interface(sng_m2ua_peer_cfg_t *m2ua_peer_iface) -{ - int k = 0x00; - int i = m2ua_peer_iface->id; - - strncpy((char *)g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].name, (char *)m2ua_peer_iface->name, MAX_NAME_LEN-1); - - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].id = m2ua_peer_iface->id; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].aspIdFlag = m2ua_peer_iface->aspIdFlag; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].selfAspId = m2ua_peer_iface->selfAspId; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].locOutStrms = m2ua_peer_iface->locOutStrms; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].numDestAddr = m2ua_peer_iface->numDestAddr; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].sctpId = m2ua_peer_iface->sctpId; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].port = m2ua_peer_iface->port; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].init_sctp_assoc = m2ua_peer_iface->init_sctp_assoc; - for (k=0; knumDestAddr; k++) { - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_peer[i].destAddrList[k] = m2ua_peer_iface->destAddrList[k]; - } - - - return 0; -} - -/******************************************************************************/ -int ftmod_ss7_parse_m2ua_clust_interfaces(ftdm_conf_node_t *m2ua_cluster_interfaces) -{ - ftdm_conf_node_t *m2ua_cluster_interface = NULL; - - /* confirm that we are looking at m2ua_cluster_interfaces */ - if (strcasecmp(m2ua_cluster_interfaces->name, "sng_m2ua_cluster_interfaces")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"m2ua_cluster_interfaces\"!\n",m2ua_cluster_interfaces->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"m2ua_cluster_interfaces\"...\n"); - } - - /* extract the m2ua_cluster_interfaces */ - m2ua_cluster_interface = m2ua_cluster_interfaces->child; - - while (m2ua_cluster_interface != NULL) { - /* parse the found m2ua_cluster_interface */ - if (ftmod_ss7_parse_m2ua_clust_interface(m2ua_cluster_interface)) { - SS7_ERROR("Failed to parse \"m2ua_cluster_interface\"\n"); - return FTDM_FAIL; - } - - /* go to the next m2ua_cluster_interface */ - m2ua_cluster_interface = m2ua_cluster_interface->next; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_m2ua_clust_interface(ftdm_conf_node_t *m2ua_cluster_interface) -{ - sng_m2ua_cluster_cfg_t sng_m2ua_cluster; - ftdm_conf_parameter_t *parm = m2ua_cluster_interface->parameters; - int num_parms = m2ua_cluster_interface->n_parameters; - int i; - - /* initalize the m2ua_cluster_interface */ - memset(&sng_m2ua_cluster, 0x0, sizeof(sng_m2ua_cluster)); - - if (!m2ua_cluster_interface){ - SS7_ERROR("ftmod_ss7_parse_m2ua_clust_interface - NULL XML Node pointer \n"); - return FTDM_FAIL; - } - - /* confirm that we are looking at an m2ua_cluster_interface */ - if (strcasecmp(m2ua_cluster_interface->name, "sng_m2ua_cluster_interface")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"m2ua_cluster_interface\"!\n",m2ua_cluster_interface->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"m2ua_cluster_interface\"...\n"); - } - - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - /* try to match the parameter to what we expect */ - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)sng_m2ua_cluster.name, parm->val); - SS7_DEBUG("Found an sng_m2ua_cluster named = %s\n", sng_m2ua_cluster.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - sng_m2ua_cluster.id = atoi(parm->val); - SS7_DEBUG("Found an sng_m2ua_cluster id = %d\n", sng_m2ua_cluster.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "traffic-mode")) { - /**********************************************************************/ - if(!strcasecmp(parm->val, "loadshare")){ - sng_m2ua_cluster.trfMode = SNG_M2UA_TRF_MODE_LOADSHARE; - } else if(!strcasecmp(parm->val, "override")){ - sng_m2ua_cluster.trfMode = SNG_M2UA_TRF_MODE_OVERRIDE; - } else if(!strcasecmp(parm->val, "broadcast")){ - sng_m2ua_cluster.trfMode = SNG_M2UA_TRF_MODE_BROADCAST; - } else { - SS7_ERROR("Found an invalid trfMode Parameter Value[%s]..adding default one[ANY]\n", parm->val); - sng_m2ua_cluster.trfMode = SNG_M2UA_TRF_MODE_ANY; - } - SS7_DEBUG("Found an sng_m2ua_cluster.trfMode = %d\n", sng_m2ua_cluster.trfMode); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "load-share-algorithm")) { - /**********************************************************************/ - if(!strcasecmp(parm->val, "roundrobin")){ - sng_m2ua_cluster.loadShareAlgo = SNG_M2UA_LOAD_SHARE_ALGO_RR; - } else if(!strcasecmp(parm->val, "linkspecified")){ - sng_m2ua_cluster.loadShareAlgo = SNG_M2UA_LOAD_SHARE_ALGO_LS; - } else if(!strcasecmp(parm->val, "customerspecified")){ - sng_m2ua_cluster.loadShareAlgo = SNG_M2UA_LOAD_SHARE_ALGO_CS; - } else { - SS7_ERROR("Found an invalid loadShareAlgo Parameter Value[%s]\n", parm->val); - return FTDM_FAIL; - } - - SS7_DEBUG("Found an sng_m2ua_cluster.loadShareAlgo = %d\n", sng_m2ua_cluster.loadShareAlgo); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "m2ua-peer-interface-id")) { - /**********************************************************************/ - if(sng_m2ua_cluster.numOfPeers < MW_MAX_NUM_OF_PEER) { - sng_m2ua_cluster.peerIdLst[sng_m2ua_cluster.numOfPeers] = atoi(parm->val); - SS7_DEBUG("Found an sng_m2ua_cluster peerId[%d], Total numOfPeers[%d] \n", - sng_m2ua_cluster.peerIdLst[sng_m2ua_cluster.numOfPeers], - sng_m2ua_cluster.numOfPeers+1); - sng_m2ua_cluster.numOfPeers++; - }else{ - SS7_ERROR("Peer List excedding max[%d] limit \n", MW_MAX_NUM_OF_PEER); - return FTDM_FAIL; - } - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter %s!\n", parm->var); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parameter */ - parm = parm + 1; - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - /* fill in the sng_m2ua_peer interface */ - ftmod_ss7_fill_in_m2ua_clust_interface(&sng_m2ua_cluster); - - return FTDM_SUCCESS; -} -/******************************************************************************/ -static int ftmod_ss7_fill_in_m2ua_clust_interface(sng_m2ua_cluster_cfg_t *m2ua_cluster_iface) -{ - int k = 0x00; - int i = m2ua_cluster_iface->id; - - strncpy((char *)g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].name, (char *)m2ua_cluster_iface->name, MAX_NAME_LEN-1); - - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].id = m2ua_cluster_iface->id; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].trfMode = m2ua_cluster_iface->trfMode; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].loadShareAlgo = m2ua_cluster_iface->loadShareAlgo; - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].numOfPeers = m2ua_cluster_iface->numOfPeers; - for(k=0;knumOfPeers;k++){ - g_ftdm_sngss7_data.cfg.g_m2ua_cfg.m2ua_clus[i].peerIdLst[k] = m2ua_cluster_iface->peerIdLst[k]; - } - - return 0; -} - -/******************************************************************************/ -int ftmod_ss7_parse_sctp_links(ftdm_conf_node_t *node) -{ - ftdm_conf_node_t *node_sctp_link = NULL; - - if (!node) - return FTDM_FAIL; - - if (strcasecmp(node->name, "sng_sctp_interfaces")) { - SS7_ERROR("SCTP - We're looking at <%s>...but we're supposed to be looking at !\n", node->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("SCTP - Parsing configurations\n"); - } - - for (node_sctp_link = node->child; node_sctp_link != NULL; node_sctp_link = node_sctp_link->next) { - if (ftmod_ss7_parse_sctp_link(node_sctp_link) != FTDM_SUCCESS) { - SS7_ERROR("SCTP - Failed to parse . \n"); - return FTDM_FAIL; - } - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_sctp_link(ftdm_conf_node_t *node) -{ - ftdm_conf_parameter_t *param = NULL; - int num_params = 0; - int i=0; - - if (!node){ - SS7_ERROR("SCTP - NULL XML Node pointer \n"); - return FTDM_FAIL; - } - - param = node->parameters; - num_params = node->n_parameters; - - sng_sctp_link_t t_link; - memset (&t_link, 0, sizeof(sng_sctp_link_t)); - - if (strcasecmp(node->name, "sng_sctp_interface")) { - SS7_ERROR("SCTP - We're looking at <%s>...but we're supposed to be looking at !\n", node->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("SCTP - Parsing configurations\n"); - } - - for (i=0; ivar, "name")) { - int n_strlen = strlen(param->val); - strncpy((char*)t_link.name, param->val, (n_strlen>MAX_NAME_LEN)?MAX_NAME_LEN:n_strlen); - SS7_DEBUG("SCTP - Parsing with name = %s\n", param->val); - } - else if (!strcasecmp(param->var, "id")) { - t_link.id = atoi(param->val); - SS7_DEBUG("SCTP - Parsing with id = %s\n", param->val); - } - else if (!strcasecmp(param->var, "address")) { - if (t_link.numSrcAddr < SCT_MAX_NET_ADDRS) { - t_link.srcAddrList[t_link.numSrcAddr+1] = iptoul (param->val); - t_link.numSrcAddr++; - SS7_DEBUG("SCTP - Parsing with source IP Address = %s\n", param->val); - } else { - SS7_ERROR("SCTP - too many source address configured. dropping %s \n", param->val); - } - } else if (!strcasecmp(param->var, "source-port")) { - t_link.port = atoi(param->val); - SS7_DEBUG("SCTP - Parsing with port = %s\n", param->val); - } - else { - SS7_ERROR("SCTP - Found an unknown parameter <%s>. Skipping it.\n", param->var); - } - } - - g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].id = t_link.id; - g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].port = t_link.port; - strncpy((char*)g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].name, t_link.name, strlen(t_link.name) ); - g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].numSrcAddr = t_link.numSrcAddr; - for (i=1; i<=t_link.numSrcAddr; i++) { - g_ftdm_sngss7_data.cfg.sctpCfg.linkCfg[t_link.id].srcAddrList[i] = t_link.srcAddrList[i]; - } - - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SCTP_PRESENT); - - return FTDM_SUCCESS; -} -/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c deleted file mode 100644 index 47c88c29c5..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ /dev/null @@ -1,2766 +0,0 @@ -/* - * Copyright (c) 2009, Sangoma Technologies - * Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * David Yat Sin - * James Zhang - * - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -static sng_isup_event_interface_t sng_event; -static ftdm_io_interface_t g_ftdm_sngss7_interface; -ftdm_sngss7_data_t g_ftdm_sngss7_data; -ftdm_sngss7_opr_mode g_ftdm_operating_mode; - -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -static void *ftdm_sangoma_ss7_run (ftdm_thread_t * me, void *obj); -static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_event); -static void ftdm_sangoma_ss7_process_peer_stack_event (ftdm_channel_t *ftdmchan, sngss7_event_data_t *sngss7_event); - -static ftdm_status_t ftdm_sangoma_ss7_stop (ftdm_span_t * span); -static ftdm_status_t ftdm_sangoma_ss7_start (ftdm_span_t * span); -/******************************************************************************/ - - -/* STATE MAP ******************************************************************/ -ftdm_state_map_t sangoma_ss7_state_map = { - { - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_DOWN, - FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_COLLECT, - FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, - FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_TERMINATING, - FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_TERMINATING, - FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, - FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_IDLE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_IDLE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN, - FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_RING, - FTDM_CHANNEL_STATE_IDLE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, - FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - /**************************************************************************/ - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_DOWN, - FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_DIALING, - FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, - FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_CANCEL, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_TERMINATING, - FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, - FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_IDLE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_IDLE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_TERMINATING, - FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA ,FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_END}, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_END} - }, - } -}; - -static void handle_hw_alarm(ftdm_event_t *e) -{ - sngss7_chan_data_t *ss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int x = 0; - - ftdm_assert(e != NULL, "Null event!\n"); - - SS7_DEBUG("handle_hw_alarm event [%d/%d]\n",e->channel->physical_span_id,e->channel->physical_chan_id); - - for (x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0; x++) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - - /* NC. Its possible for alarms to come in the middle of configuration - especially on large systems */ - if (!ss7_info || !ss7_info->ftdmchan) { - SS7_DEBUG("handle_hw_alarm: span=%i chan=%i ckt=%i x=%i - ss7_info=%p ftdmchan=%p\n", - ftdmchan->physical_span_id,ftdmchan->physical_chan_id, - g_ftdm_sngss7_data.cfg.isupCkt[x].id,x, - ss7_info,ss7_info?ss7_info->ftdmchan:NULL); - continue; - } - - ftdmchan = ss7_info->ftdmchan; - - if (e->channel->physical_span_id == ftdmchan->physical_span_id && - e->channel->physical_chan_id == ftdmchan->physical_chan_id) { - SS7_DEBUG_CHAN(ftdmchan,"handle_hw_alarm: span=%i chan=%i ckt=%i x=%i\n", - ftdmchan->physical_span_id,ftdmchan->physical_chan_id,g_ftdm_sngss7_data.cfg.isupCkt[x].id,x); - if (e->enum_id == FTDM_OOB_ALARM_TRAP) { - SS7_DEBUG_CHAN(ftdmchan,"handle_hw_alarm: Set FLAG_GRP_HW_BLOCK_TX %s\n", " "); - sngss7_set_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX); - if (ftdmchan->state != FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - } else if (e->enum_id == FTDM_OOB_ALARM_CLEAR) { - SS7_DEBUG_CHAN(ftdmchan,"handle_hw_alarm: Clear %s \n", " "); - sngss7_clear_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX); - sngss7_clear_ckt_blk_flag(ss7_info, FLAG_GRP_HW_UNBLK_TX); - if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX_DN)) { - sngss7_set_ckt_blk_flag(ss7_info, FLAG_GRP_HW_UNBLK_TX); - SS7_DEBUG_CHAN(ftdmchan,"handle_hw_alarm: Setting FLAG_GRP_HW_UNBLK_TX %s\n"," "); - if (ftdmchan->state != FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - } - } - } - } - } -} - - -static void check_span_oob_events(ftdm_span_t *ftdmspan) -{ - ftdm_event_t *event = NULL; - /* Poll for events, e.g HW DTMF */ - switch (ftdm_span_poll_event(ftdmspan, 0, NULL)) { - /**********************************************************************/ - case FTDM_SUCCESS: - while (ftdm_span_next_event(ftdmspan, &event) == FTDM_SUCCESS) { - if (event->e_type == FTDM_EVENT_OOB) { - handle_hw_alarm(event); - } - } - break; - /**********************************************************************/ - case FTDM_TIMEOUT: - /* No events pending */ - break; - /**********************************************************************/ - default: - SS7_ERROR("%s:Failed to poll span event\n", ftdmspan->name); - /**********************************************************************/ - } -} - -/* MONITIOR THREADS ***********************************************************/ -static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) -{ - ftdm_interrupt_t *ftdm_sangoma_ss7_int[2]; - ftdm_span_t *ftdmspan = (ftdm_span_t *) obj; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *sngss7_event = NULL; - sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; - - int b_alarm_test = 1; - sngss7_chan_data_t *ss7_info=NULL; - - ftdm_log (FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", ftdmspan->span_id); - - /* set IN_THREAD flag so that we know this thread is running */ - ftdm_set_flag (ftdmspan, FTDM_SPAN_IN_THREAD); - - - - /* get an interrupt queue for this span for channel state changes */ - if (ftdm_queue_get_interrupt (ftdmspan->pendingchans, &ftdm_sangoma_ss7_int[0]) != FTDM_SUCCESS) { - SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d for channel state changes!\n", ftdmspan->span_id); - goto ftdm_sangoma_ss7_run_exit; - } - - /* get an interrupt queue for this span for Trillium events */ - if (ftdm_queue_get_interrupt (sngss7_span->event_queue, &ftdm_sangoma_ss7_int[1]) != FTDM_SUCCESS) { - SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d for Trillium event queue!\n", ftdmspan->span_id); - goto ftdm_sangoma_ss7_run_exit; - } - - if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){ - ftdm_log (FTDM_LOG_INFO, "FreeTDM running as M2UA_SG mode, freetdm dont have to do anything \n"); - - while (ftdm_running () && !(ftdm_test_flag (ftdmspan, FTDM_SPAN_STOP_THREAD))) { - - switch ((ftdm_interrupt_multiple_wait(ftdm_sangoma_ss7_int, ftdm_array_len(ftdm_sangoma_ss7_int), 100))) { - - case FTDM_SUCCESS: /* process all pending state changes */ - - SS7_DEVEL_DEBUG ("ftdm_interrupt_wait FTDM_SUCCESS on span = %d\n",ftdmspan->span_id); - - /**********************************************************************/ - case FTDM_TIMEOUT: - SS7_DEVEL_DEBUG ("ftdm_interrupt_wait timed-out on span = %d\n",ftdmspan->span_id); - - break; - /**********************************************************************/ - case FTDM_FAIL: - SS7_ERROR ("ftdm_interrupt_wait returned error!\non span = %d\n", ftdmspan->span_id); - - break; - /**********************************************************************/ - default: - SS7_ERROR("ftdm_interrupt_wait returned with unknown code on span = %d\n",ftdmspan->span_id); - - break; - /**********************************************************************/ - } - check_span_oob_events(ftdmspan); - - /* signal the core that sig events are queued for processing */ - ftdm_span_trigger_signals(ftdmspan); - } - goto ftdm_sangoma_ss7_stop; - } - - while (ftdm_running () && !(ftdm_test_flag (ftdmspan, FTDM_SPAN_STOP_THREAD))) { - int x = 0; - if (b_alarm_test) { - b_alarm_test = 0; - for (x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; - g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0; x++) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; - if (!ftdmchan) { - continue; - } - - if (ftdmchan->alarm_flags != 0) { /* we'll send out block */ - sngss7_set_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX ); - } else { /* we'll send out reset */ - if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX )) { - sngss7_clear_ckt_blk_flag( ss7_info, FLAG_GRP_HW_BLOCK_TX ); - sngss7_clear_ckt_blk_flag( ss7_info, FLAG_GRP_HW_BLOCK_TX_DN ); - sngss7_set_ckt_blk_flag (ss7_info, FLAG_GRP_HW_UNBLK_TX); - SS7_DEBUG("b_alarm_test FLAG_GRP_HW_UNBLK_TX\n"); - } - } - } - usleep(50); - } - ftdmchan = NULL; - } - - /* check the channel state queue for an event*/ - switch ((ftdm_interrupt_multiple_wait(ftdm_sangoma_ss7_int, ftdm_array_len(ftdm_sangoma_ss7_int), 100))) { - /**********************************************************************/ - case FTDM_SUCCESS: /* process all pending state changes */ - - /* clean out all pending channel state changes */ - while ((ftdmchan = ftdm_queue_dequeue (ftdmspan->pendingchans))) { - sngss7_chan_data_t *chan_info = ftdmchan->call_data; - - /*first lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* process state changes for this channel until they are all done */ - ftdm_channel_advance_states(ftdmchan); - - if (chan_info->peer_data) { - /* clean out all pending stack events in the peer channel */ - while ((sngss7_event = ftdm_queue_dequeue(chan_info->event_queue))) { - ftdm_sangoma_ss7_process_peer_stack_event(ftdmchan, sngss7_event); - ftdm_safe_free(sngss7_event); - } - } - - /* unlock the channel */ - ftdm_mutex_unlock (ftdmchan->mutex); - } - - /* clean out all pending stack events */ - while ((sngss7_event = ftdm_queue_dequeue(sngss7_span->event_queue))) { - ftdm_sangoma_ss7_process_stack_event(sngss7_event); - ftdm_safe_free(sngss7_event); - } - - /* signal the core that sig events are queued for processing */ - ftdm_span_trigger_signals(ftdmspan); - - break; - /**********************************************************************/ - case FTDM_TIMEOUT: - SS7_DEVEL_DEBUG ("ftdm_interrupt_wait timed-out on span = %d\n",ftdmspan->span_id); - - break; - /**********************************************************************/ - case FTDM_FAIL: - SS7_ERROR ("ftdm_interrupt_wait returned error!\non span = %d\n", ftdmspan->span_id); - - break; - /**********************************************************************/ - default: - SS7_ERROR("ftdm_interrupt_wait returned with unknown code on span = %d\n",ftdmspan->span_id); - - break; - /**********************************************************************/ - } - - /* check if there is a GRA to proccess on the span */ - if (ftdm_test_flag(sngss7_span, SNGSS7_RX_GRA_PENDING)) { - check_if_rx_gra_started(ftdmspan); - } - - /* check if there is a GRS being processed on the span */ - if (ftdm_test_flag(sngss7_span, SNGSS7_RX_GRS_PENDING)) { - /* check if the rx_grs has started */ - check_if_rx_grs_started(ftdmspan); - - /* check if the rx_grs has cleared */ - check_if_rx_grs_processed(ftdmspan); - } - - /* check if there is a UCIC to be processed on the span */ - if (ftdm_test_flag(sngss7_span, SNGSS7_UCIC_PENDING)) { - /* process the span wide UCIC */ - process_span_ucic(ftdmspan); - } - - /* check each channel on the span to see if there is an un-procressed SUS/RES flag */ - check_for_res_sus_flag(ftdmspan); - - /* check each channel on the span to see if it needs to be reconfigured */ - check_for_reconfig_flag(ftdmspan); - - check_span_oob_events(ftdmspan); - } -ftdm_sangoma_ss7_stop: - - /* clear the IN_THREAD flag so that we know the thread is done */ - ftdm_clear_flag (ftdmspan, FTDM_SPAN_IN_THREAD); - - - ftdm_log (FTDM_LOG_INFO,"ftmod_sangoma_ss7 monitor thread for span=%u stopping.\n",ftdmspan->span_id); - - return NULL; - -ftdm_sangoma_ss7_run_exit: - - /* clear the IN_THREAD flag so that we know the thread is done */ - ftdm_clear_flag (ftdmspan, FTDM_SPAN_IN_THREAD); - - ftdm_log (FTDM_LOG_INFO,"ftmod_sangoma_ss7 monitor thread for span=%u stopping due to error.\n",ftdmspan->span_id); - - ftdm_sangoma_ss7_stop (ftdmspan); - - return NULL; -} - -/******************************************************************************/ -static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_event) -{ - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_event_data_t *event_clone = NULL; - int clone_event = 0; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(sngss7_event->circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", sngss7_event->circuit); - return; - } - - /* now that we have the right channel ... put a lock on it so no-one else can use it */ - ftdm_channel_lock(ftdmchan); - - /* while there's a state change present on this channel process it */ - ftdm_channel_advance_states(ftdmchan); - - if (sngss7_event->event_id == SNGSS7_CON_IND_EVENT) { - clone_event++; - } - - /* If the call has already started (we only bridge events related to calls) - * and the event is not a release confirmation, then clone the event. - * We do not clone release cfm events because that is the only event (final event) that is not - * bridged to the other leg, the first Spirou customer we had explicitly requested to send - * release confirm as soon as the release is received and therefore not wait for the other leg - * to send release confirm (hence, not need to clone and enqueue in the other leg) */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED) && sngss7_event->event_id != SNGSS7_REL_CFM_EVENT) { - clone_event++; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE)) { - - if (sngss7_event->event_id == SNGSS7_SUSP_IND_EVENT) { - sngss7_set_ckt_flag(sngss7_info, FLAG_SUS_RECVD); - sngss7_clear_ckt_flag(sngss7_info, FLAG_T6_CANCELED); - } - - if (sngss7_test_ckt_flag(sngss7_info, FLAG_SUS_RECVD) && - !sngss7_test_ckt_flag(sngss7_info, FLAG_T6_CANCELED)) { - if (sng_cancel_isup_tmr(sngss7_info->suInstId, ISUP_T6i) == RFAILED ) { - SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]could not stop timer T6 \n", sngss7_info->circuit->cic); - } else { - sngss7_set_ckt_flag(sngss7_info, FLAG_T6_CANCELED); - SS7_ERROR_CHAN(ftdmchan,"[CIC:%d] isup timer T6 has been cancelled. \n", sngss7_info->circuit->cic); - } - } - } - - /* clone the event and save it for later usage, we do not clone RLC messages */ - if (clone_event) { - event_clone = ftdm_calloc(1, sizeof(*sngss7_event)); - if (event_clone) { - memcpy(event_clone, sngss7_event, sizeof(*sngss7_event)); - /* if we have already a peer channel then enqueue the event in their queue */ - if (sngss7_info->peer_data) { - ftdm_span_t *peer_span = sngss7_info->peer_data->ftdmchan->span; - if (sngss7_info->peer_event_transfer_cnt) { - sngss7_event_data_t *peer_event = NULL; - int qi = 0; - /* looks like for the first time we found our peer, transfer any messages we enqueued */ - for (qi = 0; qi < sngss7_info->peer_event_transfer_cnt; qi++) { - peer_event = ftdm_queue_dequeue(sngss7_info->event_queue); - if (peer_event) { - ftdm_queue_enqueue(sngss7_info->peer_data->event_queue, peer_event); - } else { - /* This should never happen! */ - SS7_CRIT_CHAN(ftdmchan,"[CIC:%d]What!? someone stole my messages!\n", sngss7_info->circuit->cic); - } - } - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Transferred %d messages into my peer's queue\n", - sngss7_info->circuit->cic, sngss7_info->peer_event_transfer_cnt); - sngss7_info->peer_event_transfer_cnt = 0; - } - /* we already have a peer attached, wake him up */ - ftdm_queue_enqueue(sngss7_info->peer_data->event_queue, event_clone); - ftdm_queue_enqueue(peer_span->pendingchans, sngss7_info->peer_data->ftdmchan); - } else { - /* we don't have a peer yet, save the event on our own queue for later - * only the first event in this queue is directly consumed by our peer (IAM), subsequent events - * must be transferred by us to their queue as soon as we find our peer */ - ftdm_queue_enqueue(sngss7_info->event_queue, event_clone); - if (sngss7_event->event_id != SNGSS7_CON_IND_EVENT) { - /* This could be an SAM, save it for transfer once we know who our peer is (if we ever find that) */ - sngss7_info->peer_event_transfer_cnt++; - } - } - } - } - - /* we could test for sngss7_info->peer_data too, bit this flag is set earlier, the earlier we know the better */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE)) { - /* most messages are simply relayed in sig bridge mode, except for hangup which requires state changing */ - switch (sngss7_event->event_id) { - case SNGSS7_REL_IND_EVENT: - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - case SNGSS7_REL_CFM_EVENT: - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - break; - default: - break; - } - goto done; - } - - /* figure out the type of event and send it to the right handler */ - switch (sngss7_event->event_id) { - /**************************************************************************/ - case (SNGSS7_CON_IND_EVENT): - handle_con_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siConEvnt); - break; - /**************************************************************************/ - case (SNGSS7_CON_CFM_EVENT): - handle_con_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siConEvnt); - break; - /**************************************************************************/ - case (SNGSS7_CON_STA_EVENT): - handle_con_sta(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siCnStEvnt, sngss7_event->evntType); - break; - /**************************************************************************/ - case (SNGSS7_REL_IND_EVENT): - handle_rel_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siRelEvnt); - break; - /**************************************************************************/ - case (SNGSS7_REL_CFM_EVENT): - handle_rel_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siRelEvnt); - break; - /**************************************************************************/ - case (SNGSS7_DAT_IND_EVENT): - handle_dat_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siInfoEvnt); - break; - /**************************************************************************/ - case (SNGSS7_FAC_IND_EVENT): - handle_fac_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->evntType, &sngss7_event->event.siFacEvnt); - break; - /**************************************************************************/ - case (SNGSS7_FAC_CFM_EVENT): - handle_fac_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->evntType, &sngss7_event->event.siFacEvnt); - break; - /**************************************************************************/ - case (SNGSS7_UMSG_IND_EVENT): - handle_umsg_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit); - break; - /**************************************************************************/ - case (SNGSS7_STA_IND_EVENT): - handle_sta_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->globalFlg, sngss7_event->evntType, &sngss7_event->event.siStaEvnt); - break; - /**************************************************************************/ - case (SNGSS7_SUSP_IND_EVENT): - handle_susp_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siSuspEvnt); - break; - /**************************************************************************/ - case (SNGSS7_RESM_IND_EVENT): - handle_resm_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siResmEvnt); - break; - /**************************************************************************/ - case (SNGSS7_SSP_STA_CFM_EVENT): - SS7_ERROR("dazed and confused ... hu?!\n"); - break; - /**************************************************************************/ - default: - SS7_ERROR("Unknown Event Id!\n"); - break; - /**************************************************************************/ - } - -done: - /* while there's a state change present on this channel process it */ - ftdm_channel_advance_states(ftdmchan); - - /* unlock the channel */ - ftdm_channel_unlock(ftdmchan); - -} - -FTDM_ENUM_NAMES(SNG_EVENT_TYPE_NAMES, SNG_EVENT_TYPE_STRINGS) -FTDM_STR2ENUM(ftdm_str2sngss7_event, ftdm_sngss7_event2str, sng_event_type_t, SNG_EVENT_TYPE_NAMES, SNGSS7_INVALID_EVENT) -static void ftdm_sangoma_ss7_process_peer_stack_event (ftdm_channel_t *ftdmchan, sngss7_event_data_t *sngss7_event) -{ - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - if (ftdmchan->state < FTDM_CHANNEL_STATE_UP && ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - ftdm_channel_advance_states(ftdmchan); - } - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Receiving message %s from bridged peer (our state = %s)\n", - sngss7_info->circuit->cic, ftdm_sngss7_event2str(sngss7_event->event_id), ftdm_channel_state2str(ftdmchan->state)); - - switch (sngss7_event->event_id) { - - case (SNGSS7_CON_IND_EVENT): - SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]Rx IAM while bridged??\n", sngss7_info->circuit->cic); - break; - - case (SNGSS7_CON_CFM_EVENT): - /* send the ANM request to LibSngSS7 */ - sng_cc_con_response(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &sngss7_event->event.siConEvnt, - 5); - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Tx peer ANM\n", sngss7_info->circuit->cic); - break; - - case (SNGSS7_CON_STA_EVENT): - switch (sngss7_event->evntType) { - /**************************************************************************/ - case (ADDRCMPLT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer ACM\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (MODIFY): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer MODIFY\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (MODCMPLT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer MODIFY-COMPLETE\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (MODREJ): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer MODIFY-REJECT\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (PROGRESS): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer CPG\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (FRWDTRSFR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer FOT\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (INFORMATION): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer INF\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (INFORMATREQ): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer INR\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (SUBSADDR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer SAM\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (EXIT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer EXIT\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (NETRESMGT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer NRM\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (IDENTREQ): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer IDR\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (IDENTRSP): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer IRS\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (MALCLLPRNT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer MALICIOUS CALL\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CHARGE): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer CRG\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (TRFFCHGE): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer CRG-TARIFF\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CHARGEACK): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer CRG-ACK\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CALLOFFMSG): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer CALL-OFFER\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (LOOPPRVNT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer LOP\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (TECT_TIMEOUT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer ECT-Timeout\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (RINGSEND): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer RINGING-SEND\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CALLCLEAR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer CALL-LINE Clear\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (PRERELEASE): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer PRI\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (APPTRANSPORT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer APM\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (OPERATOR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer OPERATOR\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (METPULSE): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer METERING-PULSE\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (CLGPTCLR): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer CALLING_PARTY_CLEAR\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (SUBDIRNUM): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer SUB-DIR\n", sngss7_info->circuit->cic); - break; -#ifdef SANGOMA_SPIROU - case (CHARGE_ACK): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer TXA\n", sngss7_info->circuit->cic); - break; - case (CHARGE_UNIT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer ITX\n", sngss7_info->circuit->cic); - break; -#endif - /**************************************************************************/ - default: - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer Unknown Msg %d\n", sngss7_info->circuit->cic, sngss7_event->evntType); - break; - /**************************************************************************/ - } - sng_cc_con_status (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &sngss7_event->event.siCnStEvnt, - sngss7_event->evntType); - - break; - /**************************************************************************/ - case (SNGSS7_REL_IND_EVENT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer REL cause=%d\n", sngss7_info->circuit->cic, sngss7_event->event.siRelEvnt.causeDgn.causeVal.val); - - //handle_rel_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siRelEvnt); - sng_cc_rel_request (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &sngss7_event->event.siRelEvnt); - break; - - /**************************************************************************/ - case (SNGSS7_REL_CFM_EVENT): - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer RLC\n", sngss7_info->circuit->cic); - sng_cc_rel_response (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &sngss7_event->event.siRelEvnt); - //handle_rel_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siRelEvnt); - break; - - /**************************************************************************/ - case (SNGSS7_DAT_IND_EVENT): - //handle_dat_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siInfoEvnt); - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer %s\n", sngss7_info->circuit->cic, ftdm_sngss7_event2str(sngss7_event->event_id)); - sng_cc_dat_request(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &sngss7_event->event.siInfoEvnt); - break; - /**************************************************************************/ - case (SNGSS7_FAC_IND_EVENT): - //handle_fac_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->evntType, - //&sngss7_event->event.siFacEvnt); - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer %s -> %d\n", sngss7_info->circuit->cic, - ftdm_sngss7_event2str(sngss7_event->event_id), sngss7_event->evntType); - sng_cc_fac_request(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - sngss7_event->evntType, - &sngss7_event->event.siFacEvnt); - - break; - /**************************************************************************/ - case (SNGSS7_FAC_CFM_EVENT): - //handle_fac_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, - //sngss7_event->evntType, &sngss7_event->event.siFacEvnt); - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer %s -> %d\n", sngss7_info->circuit->cic, - ftdm_sngss7_event2str(sngss7_event->event_id), sngss7_event->evntType); - sng_cc_fac_response(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - sngss7_event->evntType, - &sngss7_event->event.siFacEvnt); - break; - /**************************************************************************/ - case (SNGSS7_UMSG_IND_EVENT): - //handle_umsg_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit); - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer %s\n", sngss7_info->circuit->cic, ftdm_sngss7_event2str(sngss7_event->event_id)); - sng_cc_umsg_request (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id); - break; - /**************************************************************************/ - case (SNGSS7_STA_IND_EVENT): - //handle_sta_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->globalFlg, sngss7_event->evntType, &sngss7_event->event.siStaEvnt); - break; - /**************************************************************************/ - case (SNGSS7_SUSP_IND_EVENT): - //handle_susp_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siSuspEvnt); - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer %s\n", sngss7_info->circuit->cic, ftdm_sngss7_event2str(sngss7_event->event_id)); - sng_cc_susp_request (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &sngss7_event->event.siSuspEvnt); - break; - /**************************************************************************/ - case (SNGSS7_RESM_IND_EVENT): - //handle_resm_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siResmEvnt); - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx peer %s\n", sngss7_info->circuit->cic, ftdm_sngss7_event2str(sngss7_event->event_id)); - sng_cc_resm_request(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &sngss7_event->event.siResmEvnt); - break; - /**************************************************************************/ - case (SNGSS7_SSP_STA_CFM_EVENT): - SS7_CRITICAL("dazed and confused ... hu?!\n"); - break; - /**************************************************************************/ - default: - SS7_ERROR("Failed to relay unknown event id %d!\n", sngss7_event->event_id); - break; - /**************************************************************************/ - } - - if ((sngss7_event->event_id == SNGSS7_SUSP_IND_EVENT)) { - sngss7_set_ckt_flag(sngss7_info, FLAG_SUS_RECVD); - } - - if (sngss7_test_ckt_flag(sngss7_info, FLAG_SUS_RECVD) && - !sngss7_test_ckt_flag(sngss7_info, FLAG_T6_CANCELED)) { - if (sng_cancel_isup_tmr(sngss7_info->suInstId, ISUP_T6i) == RFAILED ) { - SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]could not stop timer T6 \n", sngss7_info->circuit->cic); - } else { - sngss7_set_ckt_flag(sngss7_info, FLAG_T6_CANCELED); - SS7_ERROR_CHAN(ftdmchan,"[CIC:%d] isup timer T6 has been cancelled. \n", sngss7_info->circuit->cic); - } - } -} - -static ftdm_status_t ftdm_sangoma_ss7_native_bridge_state_change(ftdm_channel_t *ftdmchan); -static ftdm_status_t ftdm_sangoma_ss7_native_bridge_state_change(ftdm_channel_t *ftdmchan) -{ - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - ftdm_channel_complete_state(ftdmchan); - - switch (ftdmchan->state) { - - case FTDM_CHANNEL_STATE_DOWN: - { - ftdm_channel_t *close_chan = ftdmchan; - sngss7_clear_ckt_flag(sngss7_info, FLAG_SUS_RECVD); - sngss7_clear_ckt_flag(sngss7_info, FLAG_T6_CANCELED); - sngss7_clear_ckt_flag (sngss7_info, FLAG_SENT_ACM); - sngss7_clear_ckt_flag (sngss7_info, FLAG_SENT_CPG); - - sngss7_flush_queue(sngss7_info->event_queue); - sngss7_info->peer_data = NULL; - ftdm_channel_close (&close_chan); - } - break; - - case FTDM_CHANNEL_STATE_UP: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_UP); - } - } - break; - - case FTDM_CHANNEL_STATE_TERMINATING: - { - /* Release confirm is sent immediately, since Spirou customer asked us not to wait for the second call leg - * to come back with a release confirm ... */ - /* when receiving REL we move to TERMINATING and notify the user that the bridge is ending */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USER_HANGUP)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } else { - /* Notify the user and wait for their ack before sending RLC */ - sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_STOP); - } - } - break; - - case FTDM_CHANNEL_STATE_HANGUP: - { - ft_to_sngss7_rlc(ftdmchan); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - break; - - default: - break; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan) -{ - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - sng_isup_inf_t *isup_intf = NULL; - int state_flag = 1; - int i = 0; - - SS7_DEBUG_CHAN(ftdmchan, "ftmod_sangoma_ss7 processing state %s: ckt=0x%X, blk=0x%X\n", - ftdm_channel_state2str (ftdmchan->state), - sngss7_info->ckt_flags, - sngss7_info->blk_flags); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE)) { - /* DIALING is the only state we process normally when doing an outgoing call that is natively bridged, - * all other states are run by a different state machine (and the freetdm core does not do any checking) */ - if (ftdmchan->state != FTDM_CHANNEL_STATE_DIALING) { - return ftdm_sangoma_ss7_native_bridge_state_change(ftdmchan); - } - } - - /*check what state we are supposed to be in */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_COLLECT: /* IAM received but wating on digits */ - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - while (ftdmchan->caller_data.dnis.digits[i] != '\0'){ - i++; - } - - /* kill t10 if active */ - if (sngss7_info->t10.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t10.sched, sngss7_info->t10.hb_timer_id); - } - - /* check if the end of pulsing (ST) character has arrived or the right number of digits */ - if (ftdmchan->caller_data.dnis.digits[i-1] == 'F' - || sngss7_test_ckt_flag(sngss7_info, FLAG_FULL_NUMBER) ) - { - SS7_DEBUG_CHAN(ftdmchan, "Received the end of pulsing character %s\n", ""); - - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_FULL_NUMBER)) { - /* remove the ST */ - ftdmchan->caller_data.dnis.digits[i-1] = '\0'; - sngss7_set_ckt_flag(sngss7_info, FLAG_FULL_NUMBER); - } - - if (sngss7_test_ckt_flag(sngss7_info, FLAG_INR_TX)) { - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_INR_SENT) ) { - ft_to_sngss7_inr(ftdmchan); - sngss7_set_ckt_flag(sngss7_info, FLAG_INR_SENT); - - SS7_DEBUG_CHAN (ftdmchan, "Scheduling T.39 timer %s \n", " "); - - /* start ISUP t39 */ - if (ftdm_sched_timer (sngss7_info->t39.sched, - "t39", - sngss7_info->t39.beat, - sngss7_info->t39.callback, - &sngss7_info->t39, - &sngss7_info->t39.hb_timer_id)) - { - - SS7_ERROR ("Unable to schedule timer T39, hanging up call!\n"); - - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; - sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL); - - /* end the call */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } - }else { - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - } else { - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - } else if (i >= sngss7_info->circuit->min_digits) { - SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, sngss7_info->circuit->min_digits); - - if (sngss7_test_ckt_flag(sngss7_info, FLAG_INR_TX)) { - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_INR_SENT) ) { - ft_to_sngss7_inr(ftdmchan); - sngss7_set_ckt_flag(sngss7_info, FLAG_INR_SENT); - - SS7_DEBUG_CHAN (ftdmchan, "Scheduling T.39 timer %s\n", " " ); - - /* start ISUP t39 */ - if (ftdm_sched_timer (sngss7_info->t39.sched, - "t39", - sngss7_info->t39.beat, - sngss7_info->t39.callback, - &sngss7_info->t39, - &sngss7_info->t39.hb_timer_id)) - { - - SS7_ERROR ("Unable to schedule timer T39, hanging up call!\n"); - - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; - sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL); - - /* end the call */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } - - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - }else { - if (sngss7_test_ckt_flag(sngss7_info, FLAG_INF_RX_DN) ) { - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - } - } else { - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - } - } else { - /* if we are coming from idle state then we have already been here once before */ - if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) { - SS7_INFO_CHAN(ftdmchan, "Received %d out of %d so far: %s...starting T35\n", - i, - sngss7_info->circuit->min_digits, - ftdmchan->caller_data.dnis.digits); - - /* start ISUP t35 */ - if (ftdm_sched_timer (sngss7_info->t35.sched, - "t35", - sngss7_info->t35.beat, - sngss7_info->t35.callback, - &sngss7_info->t35, - &sngss7_info->t35.hb_timer_id)) { - - SS7_ERROR ("Unable to schedule timer, hanging up call!\n"); - - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL); - - /* end the call */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } - } - - /* start ISUP t10 */ - if (ftdm_sched_timer (sngss7_info->t10.sched, - "t10", - sngss7_info->t10.beat, - sngss7_info->t10.callback, - &sngss7_info->t10, - &sngss7_info->t10.hb_timer_id)) { - - SS7_ERROR ("Unable to schedule timer, hanging up call!\n"); - - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL); - - /* end the call */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } - } - - break; - - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RING: /*incoming call request */ - - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_TX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_SENT); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_RX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INR_RX_DN); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INF_TX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INF_SENT); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INF_RX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INF_RX_DN); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /* kill t35 if active */ - if (sngss7_info->t35.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t35.sched, sngss7_info->t35.hb_timer_id); - } - - /* cancel t39 timer */ - if (sngss7_info->t39.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t39.sched, sngss7_info->t39.hb_timer_id); - } - - SS7_DEBUG_CHAN(ftdmchan, "Sending incoming call from %s to %s to FTDM core\n", - ftdmchan->caller_data.ani.digits, - ftdmchan->caller_data.dnis.digits); - - - /* we have enough information to inform FTDM of the call */ - sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_START); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: /*outgoing call request */ - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - SS7_DEBUG_CHAN(ftdmchan, "Sending outgoing call from \"%s\" to \"%s\" to LibSngSS7\n", - ftdmchan->caller_data.ani.digits, - ftdmchan->caller_data.dnis.digits); - - /*call sangoma_ss7_dial to make outgoing call */ - ft_to_sngss7_iam(ftdmchan); - - break; - /**************************************************************************/ - /* We handle RING indication the same way we would indicate PROGRESS */ - case FTDM_CHANNEL_STATE_RINGING: - case FTDM_CHANNEL_STATE_PROGRESS: - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /*check if the channel is inbound or outbound */ - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /*OUTBOUND...so we were told by the line of this so noifiy the user */ - sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_PROGRESS); - - /* move to progress media */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else { - /* inbound call so we need to send out ACM */ - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_SENT_ACM)) { - sngss7_set_ckt_flag(sngss7_info, FLAG_SENT_ACM); - ft_to_sngss7_acm(ftdmchan); - } - if (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cpg_on_progress == FTDM_TRUE) { - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_SENT_CPG)) { - sngss7_set_ckt_flag(sngss7_info, FLAG_SENT_CPG); - ft_to_sngss7_cpg(ftdmchan); - } - } - } - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /* inform the user there is media avai */ - sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_PROGRESS_MEDIA); - } else { - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_SENT_ACM)) { - sngss7_set_ckt_flag(sngss7_info, FLAG_SENT_ACM); - ft_to_sngss7_acm(ftdmchan); - } - if (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cpg_on_progress_media == FTDM_TRUE) { - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_SENT_CPG)) { - sngss7_set_ckt_flag(sngss7_info, FLAG_SENT_CPG); - ft_to_sngss7_cpg(ftdmchan); - } - } - } - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_UP: /*call is accpeted...both incoming and outgoing */ - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /*check if the channel is inbound or outbound */ - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /*OUTBOUND...so we were told by the line that the other side answered */ - sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_UP); - } else { - /*INBOUND...so FS told us it was going to answer...tell the stack */ - ft_to_sngss7_anm(ftdmchan); - } - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_CANCEL: - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - SS7_ERROR_CHAN(ftdmchan,"Hanging up call before informing user%s\n", " "); - - /*now go to the HANGUP complete state */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: /*call is hung up remotely */ - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /* set the flag to indicate this hangup is started from the remote side */ - sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - - /*this state is set when the line is hanging up */ - sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_STOP); - - /* If the RESET flag is set, do not say in TERMINATING state. - Go back to RESTART state and wait for RESET Confirmation */ - if (sngss7_tx_reset_status_pending(sngss7_info)) { - SS7_DEBUG_CHAN(ftdmchan,"Reset pending in Terminating state!%s\n", ""); - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP: /*call is hung up locally */ - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /* check for remote hangup flag */ - if (sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) { - /* remote release ...do nothing here */ - SS7_DEBUG_CHAN(ftdmchan,"Hanging up remotely requested call!%s\n", ""); - } else if (sngss7_test_ckt_flag (sngss7_info, FLAG_GLARE)) { - /* release due to glare */ - SS7_DEBUG_CHAN(ftdmchan,"Hanging up requested call do to glare%s\n", ""); - } else { - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL); - - /*this state is set when FS is hanging up...so tell the stack */ - ft_to_sngss7_rel (ftdmchan); - - SS7_DEBUG_CHAN(ftdmchan,"Hanging up locally requested call!%s\n", ""); - } - - /*now go to the HANGUP complete state */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - - break; - - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - if (sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) { - - sngss7_clear_ckt_flag (sngss7_info, FLAG_LOCAL_REL); - - /* check if this hangup is from a tx RSC */ - if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) { - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_SENT)) { - ft_to_sngss7_rsc (ftdmchan); - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT); - - /* Wait for Reset in HANGUP Complete nothing to do until we - get reset response back */ - } else if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP)) { - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - /* Stay in hangup complete until RSC is received */ - /* Channel is in use if we go to RESTART we will - restart will just come back to HANGUP_COMPLETE */ - } - } else { - /* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */ - if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) && - !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX)) && - !(sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE))) { - - /* send out the release complete */ - ft_to_sngss7_rlc (ftdmchan); - } - - /*now go to the DOWN state */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - - SS7_DEBUG_CHAN(ftdmchan,"Completing remotely requested hangup!%s\n", ""); - } else if (sngss7_test_ckt_flag (sngss7_info, FLAG_LOCAL_REL)) { - - /* if this hang up is do to a rx RESET we need to sit here till the RSP arrives */ - if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX_RSP)) { - /* go to the down state as we have already received RSC-RLC */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - - /* if it's a local release the user sends us to down */ - SS7_DEBUG_CHAN(ftdmchan,"Completing locally requested hangup!%s\n", ""); - } else if (sngss7_test_ckt_flag (sngss7_info, FLAG_GLARE)) { - SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup due to glare!%s\n", ""); - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup for unknown reason!%s\n", ""); - if (sngss7_channel_status_clear(sngss7_info)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - - break; - - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: /*the call is finished and removed */ - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) { - SS7_DEBUG_CHAN(ftdmchan,"Down came from SUSPEND - break %s\n", ""); - break; - } - } - - /* check if there is a reset response that needs to be sent */ - if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX)) { - /* send a RSC-RLC */ - ft_to_sngss7_rsca (ftdmchan); - - /* clear the reset flag */ - clear_rx_rsc_flags(sngss7_info); - } - - /* check if there was a GRS that needs a GRA */ - if ((sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX)) && - (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) && - (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT))) { - - /* check if this is the base circuit and send out the GRA - * we insure that this is the last circuit to have the state change queued */ - if (sngss7_info->rx_grs.range) { - /* send out the GRA */ - ft_to_sngss7_gra(ftdmchan); - - /* clean out the spans GRS structure */ - clear_rx_grs_data(sngss7_info); - } - - /* clear the grp reset flag */ - clear_rx_grs_flags(sngss7_info); - } - - /* check if we got the reset response */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP)) { - /* clear the reset flag */ - clear_tx_rsc_flags(sngss7_info); - } - - if (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) { - /* clear the reset flag */ - clear_tx_grs_flags(sngss7_info); - if (sngss7_info->rx_gra.range) { - /* clean out the spans GRA structure */ - clear_rx_gra_data(sngss7_info); - } - } - - /* check if we came from reset (aka we just processed a reset) */ - if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) || - (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) || - (ftdmchan->last_state == FTDM_CHANNEL_STATE_HANGUP_COMPLETE)) { - - - /* check if reset flags are up indicating there is more processing to do yet */ - if (!(sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) && - !(sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX)) && - !(sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX)) && - !(sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX))) { - - SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X\n", - sngss7_info->ckt_flags, - sngss7_info->blk_flags); - - if (sngss7_channel_status_clear(sngss7_info)) { - /* check if the sig status is down, and bring it up if it isn't */ - if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { - SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", ""); - /* all flags are down so we can bring up the sig status */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - } - } else { - state_flag = 0; - SS7_DEBUG_CHAN(ftdmchan,"Down detected blocked flags go to SUSPEND %s\n", " "); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - break; - - } - } else { - SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->ckt_flags); - - /* there is still another reset pending so go back to reset*/ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - } - - /* check if t35 is active */ - if (sngss7_info->t35.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t35.sched, sngss7_info->t35.hb_timer_id); - } - - /* clear all of the call specific data store in the channel structure */ - sngss7_info->suInstId = 0; - sngss7_info->spInstId = 0; - sngss7_info->globalFlg = 0; - sngss7_info->spId = 0; - - /* clear any call related flags */ - sngss7_clear_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - sngss7_clear_ckt_flag (sngss7_info, FLAG_LOCAL_REL); - sngss7_clear_ckt_flag (sngss7_info, FLAG_SENT_ACM); - sngss7_clear_ckt_flag (sngss7_info, FLAG_SENT_CPG); - - - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_t *close_chan = ftdmchan; - /* close the channel */ - SS7_DEBUG_CHAN(ftdmchan,"FTDM Channel Close %s\n", ""); - sngss7_flush_queue(sngss7_info->event_queue); - ftdm_channel_close (&close_chan); - } - - /* check if there is a glared call that needs to be processed */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) { - sngss7_clear_ckt_flag (sngss7_info, FLAG_GLARE); - - if (sngss7_info->glare.circuit != 0) { - int bHandle=0; - switch (g_ftdm_sngss7_data.cfg.glareResolution) { - case SNGSS7_GLARE_DOWN: - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Giving control to the other side, handling copied IAM from glare. \n", sngss7_info->circuit->cic); - bHandle = 1; - break; - - case SNGSS7_GLARE_PC: - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Trying to handle IAM copied from glare. \n", sngss7_info->circuit->cic); - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]My PC = %d, incoming PC = %d. \n", sngss7_info->circuit->cic, - g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].spc, - g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].dpc ); - - if( g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].spc > g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].dpc ) - { - if ((sngss7_info->circuit->cic % 2) == 1 ) { - bHandle = 1; - } - } else { - if( (sngss7_info->circuit->cic % 2) == 0 ) { - bHandle = 1; - } - } - - break; - default: /* if configured as SNGSS7_GLARE_CONTROL, always abandon incoming glared IAM. */ - bHandle = 0; - break; - } - - if (!bHandle) { - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Handling glare IAM. \n", sngss7_info->circuit->cic); - handle_con_ind (0, sngss7_info->glare.spInstId, sngss7_info->glare.circuit, &sngss7_info->glare.iam); - } - - /* clear the glare info */ - memset(&sngss7_info->glare, 0x0, sizeof(sngss7_glare_data_t)); - state_flag = 0; - } - } - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: /* CICs needs a Reset */ - - SS7_DEBUG_CHAN(ftdmchan,"RESTART: Current flags: ckt=0x%X, blk=0x%X\n", - sngss7_info->ckt_flags, - sngss7_info->blk_flags); - - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) { - if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) || - (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX))) { - - SS7_DEBUG_CHAN(ftdmchan,"Incoming Reset request on CIC in UCIC block, removing UCIC block%s\n", ""); - - /* set the unblk flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK); - - /* clear the block flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); - - /* process the flag */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* break out of the processing for now */ - break; - } - } - - - /* check if this is an outgoing RSC */ - if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) && - !(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_SENT))) { - - /* don't send out reset before finished hanging up if I'm in-use. */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - /* send a reset request */ - ft_to_sngss7_rsc (ftdmchan); - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT); - } - - } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) */ - - /* check if this is the first channel of a GRS (this flag is thrown when requesting reset) */ - if ( (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX)) && - !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT)) && - (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE))) { - - /* send out the grs */ - ft_to_sngss7_grs (ftdmchan); - - } - - /* if the sig_status is up...bring it down */ - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - } - - if (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX)) { - /* set the grp reset done flag so we know we have finished this reset */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN); - } /* if (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX)) */ - - - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_INUSE)) { - /* bring the call down first...then process the rest of the reset */ - switch (ftdmchan->last_state){ - /******************************************************************/ - case (FTDM_CHANNEL_STATE_TERMINATING): - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - break; - /******************************************************************/ - case (FTDM_CHANNEL_STATE_HANGUP): - case (FTDM_CHANNEL_STATE_HANGUP_COMPLETE): - /* go back to the last state after taking care of the rest of the restart state */ - state_flag = 0; - ftdm_set_state(ftdmchan, ftdmchan->last_state); - break; - /******************************************************************/ - case (FTDM_CHANNEL_STATE_IN_LOOP): - /* we screwed up in a COT/CCR, remove the loop */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); - - /* go to down */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - break; - /******************************************************************/ - default: - /* KONRAD: find out what the cause code should be */ - ftdmchan->caller_data.hangup_cause = 41; - - /* change the state to terminatting, it will throw us back here - * once the call is done - */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /******************************************************************/ - } /* switch (ftdmchan->last_state) */ - } else { - /* check if this an incoming RSC or we have a response already */ - if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX) || - sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX_RSP) || - sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX_RSP) || - sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX_CMPLT)) { - - SS7_DEBUG_CHAN(ftdmchan, "Reset processed moving to DOWN (0x%X)\n", sngss7_info->ckt_flags); - - /* go to a down state to clear the channel and send the response */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - - SS7_DEBUG_CHAN(ftdmchan, "Waiting on Reset Rsp/Grp Reset to move to DOWN (0x%X)\n", sngss7_info->ckt_flags); - } - } - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_SUSPENDED: /* circuit has been blocked */ - - SS7_DEBUG_CHAN(ftdmchan,"SUSPEND: Current flags: ckt=0x%X, blk=0x%X, circuit->flag=0x%X\n", - sngss7_info->ckt_flags, sngss7_info->blk_flags, - sngss7_info->circuit->flags ); - - if (!(sngss7_info->circuit->flags & SNGSS7_CONFIGURED)) { - /* Configure the circuit if RESUME and PAUSED are not set. - And also in a case when RESUME is set */ - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED) || - sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME)) { - if (ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id)) { - SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", sngss7_info->circuit->id); - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - } else { - SS7_INFO("ISUP CKT %d configuration DONE!\n", sngss7_info->circuit->id); - sngss7_info->circuit->flags |= SNGSS7_CONFIGURED; - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX); - } - } - } - - /**********************************************************************/ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME)) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing RESUME%s\n", ""); - - /* clear the RESUME flag */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - - /* clear the PAUSE flag */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - - /* We tried to hangup the call while in PAUSED state. - We must send a RESET to clear this circuit */ - if (sngss7_test_ckt_flag (sngss7_info, FLAG_LOCAL_REL)) { - SS7_DEBUG_CHAN(ftdmchan, "Channel local release on RESUME, restart Reset procedure%s\n", ""); - /* By setting RESET_TX flag the check below sngss7_tx_reset_status_pending() will - be true, and will restart the RESET TX procedure */ - sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - sngss7_set_ckt_flag (sngss7_info, FLAG_RESET_TX); - } - - /* We have transmitted Reset/GRS but have not gotten a - * Response. In mean time we got a RESUME. We cannot be sure - * that our reset has been trasmitted, thus restart reset procedure. */ - if (sngss7_tx_reset_status_pending(sngss7_info)) { - SS7_DEBUG_CHAN(ftdmchan, "Channel transmitted RSC/GRS before RESUME, restart Reset procedure%s\n", ""); - clear_rx_grs_flags(sngss7_info); - clear_rx_grs_data(sngss7_info); - clear_tx_grs_flags(sngss7_info); - clear_tx_grs_data(sngss7_info); - clear_rx_rsc_flags(sngss7_info); - clear_tx_rsc_flags(sngss7_info); - - clear_tx_rsc_flags(sngss7_info); - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX); - } - - /* if there are any resets present */ - if (!sngss7_channel_status_clear(sngss7_info)) { - /* don't bring up the sig status but also move to reset */ - if (!sngss7_reset_status_clear(sngss7_info)) { - goto suspend_goto_restart; - } else if (!sngss7_block_status_clear(sngss7_info)) { - /* Do nothing just go through and handle blocks below */ - } else { - /* This should not happen as above function tests - * for reset and blocks */ - SS7_ERROR_CHAN(ftdmchan, "Invalid code path: sngss7_channel_status_clear reset and block are both cleared%s\n", ""); - goto suspend_goto_restart; - } - } else { - /* bring the sig status back up */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - } - } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) */ - - if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE%s\n", ""); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - /* bring the sig status down */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - } - - /* Wait for RESUME */ - goto suspend_goto_last; - } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */ - - /**********************************************************************/ - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX) && - !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN)) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", ""); - - /* bring the sig status down */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - - /* send a BLA */ - ft_to_sngss7_bla (ftdmchan); - - /* throw the done flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); - - } - - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){ - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_RX flag %s\n", ""); - - /* clear the block flags */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); - - /* clear the unblock flag */ - sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX); - - SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X\n", - sngss7_info->ckt_flags, - sngss7_info->blk_flags); - /* not bring the cic up if there is a hardware block */ - if (sngss7_channel_status_clear(sngss7_info)) { - /* bring the sig status up */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - - } - /* send a uba */ - ft_to_sngss7_uba (ftdmchan); - - } - - - /**********************************************************************/ - /* hardware block/unblock tx */ - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_GRP_HW_BLOCK_TX ) && - !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN )) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing FLAG_GRP_HW_BLOCK_TX flag %s\n", ""); - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - - /* dont send block again if the channel is already blocked by maintenance */ - if( !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX) && - !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN) - ) { - ft_to_sngss7_blo(ftdmchan); - } - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN); - - } - - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_TX)) { - int skip_unblock=0; - SS7_DEBUG_CHAN(ftdmchan, "Processing FLAG_GRP_HW_UNBLK_TX flag %s\n", ""); - - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX) || - sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN)) { - /* Real unblock */ - } else { - SS7_ERROR_CHAN(ftdmchan, "FLAG_GRP_HW_UNBLK_TX set while FLAG_GRP_HW_BLOCK_TX is not %s\n", ""); - skip_unblock=1; - } - - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_TX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_TX_DN); - - if (sngss7_channel_status_clear(sngss7_info)) { - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - } - - if (sngss7_tx_block_status_clear(sngss7_info) && !skip_unblock) { - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); - ft_to_sngss7_ubl(ftdmchan); - } - - } - - /**********************************************************************/ -#if 0 - /* This logic is handled in the handle_cgu_req and handle_cgb_req */ - - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_GRP_HW_BLOCK_RX ) && - !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX_DN )) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing FLAG_GRP_HW_BLOCK_RX flag %s\n", ""); - - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - - /* FIXME: Transmit CRG Ack */ - - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX_DN); - - goto suspend_goto_last; - } - - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_GRP_HW_UNBLK_RX )){ - SS7_DEBUG_CHAN(ftdmchan, "Processing FLAG_GRP_HW_UNBLK_RX flag %s\n", ""); - - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX_DN); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_RX); - - if (sngss7_channel_status_clear(sngs7_info)) { - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - } - - /* Transmit CRU Ack */ - - goto suspend_goto_last; - } -#endif - - - /**********************************************************************/ - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX) && - !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN)) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_TX flag %s\n", ""); - - /* bring the sig status down */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - - /* send a blo */ - ft_to_sngss7_blo (ftdmchan); - - /* throw the done flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN); - - } - - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_TX flag %s\n", ""); - - /* clear the block flags */ - sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX); - sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN); - - /* clear the unblock flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX); - - if (sngss7_channel_status_clear(sngss7_info)) { - /* bring the sig status up */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - } - - if (sngss7_tx_block_status_clear(sngss7_info)) { - /* send a ubl */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); - ft_to_sngss7_ubl(ftdmchan); - } - - } - - /**********************************************************************/ - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX) && - !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN)) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_BLOCK_RX flag %s\n", ""); - - /* send a BLA */ - ft_to_sngss7_bla(ftdmchan); - - /* throw the done flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN); - - if (sngss7_tx_block_status_clear(sngss7_info)) { - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); - ft_to_sngss7_ubl(ftdmchan); - } else { - /* bring the sig status down */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - } - - } - - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_UNBLK_RX flag %s\n", ""); - - /* clear the block flags */ - sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX); - sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN); - - /* clear the unblock flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX); - - /* send a uba */ - ft_to_sngss7_uba(ftdmchan); - - if (sngss7_channel_status_clear(sngss7_info)) { - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - } - - - } - /**********************************************************************/ - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK) && - !sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK_DN)) { - - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_BLOCK flag %s\n", ""); - - /* bring the channel signaling status to down */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - - /* remove any reset flags */ - clear_rx_grs_flags(sngss7_info); - clear_rx_grs_data(sngss7_info); - clear_tx_grs_flags(sngss7_info); - clear_tx_grs_data(sngss7_info); - clear_rx_rsc_flags(sngss7_info); - clear_tx_rsc_flags(sngss7_info); - - /* throw the done flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK_DN); - - } - - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) { - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", ""); - - /* remove the UCIC block flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK_DN); - - /* remove the UCIC unblock flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK); - - /* throw the channel into reset to sync states */ - - clear_rx_grs_flags(sngss7_info); - clear_rx_grs_data(sngss7_info); - clear_tx_grs_flags(sngss7_info); - clear_tx_grs_data(sngss7_info); - clear_rx_rsc_flags(sngss7_info); - clear_tx_rsc_flags(sngss7_info); - - clear_tx_rsc_flags(sngss7_info); - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX); - - /* bring the channel into restart again */ - goto suspend_goto_restart; - } - - SS7_DEBUG_CHAN(ftdmchan,"No block flag processed!%s\n", ""); - -suspend_goto_last: - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_UP) { - /* proceed to UP */ - } else if (!sngss7_reset_status_clear(sngss7_info) || - sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { - - /* At this point the circuit is in reset, if the call is - in use make sure that at least REMOTE REL flag is set - in order to drop the call on the sip side */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - if (!sngss7_test_ckt_flag (sngss7_info, FLAG_LOCAL_REL) && - !sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) { - sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL); - } - } - SS7_DEBUG_CHAN(ftdmchan,"Channel opted to stay in RESTART due to reset!%s\n", ""); - SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X, circuit->flag=0x%X\n", - sngss7_info->ckt_flags, sngss7_info->blk_flags, - sngss7_info->circuit->flags ); - - goto suspend_goto_restart; - - } else if (sngss7_channel_status_clear(sngss7_info)) { - - /* In this case all resets and blocks are clear sig state is up, thus go to DOWN */ - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART || - ftdmchan->last_state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdmchan->last_state = FTDM_CHANNEL_STATE_DOWN; - } - - SS7_DEBUG_CHAN(ftdmchan,"Channel signallig is UP: proceed to State %s!\n", - ftdm_channel_state2str(ftdmchan->last_state)); - SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X, circuit->flag=0x%X\n", - sngss7_info->ckt_flags, sngss7_info->blk_flags, - sngss7_info->circuit->flags ); - - } else { - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_DOWN) { - ftdmchan->last_state = FTDM_CHANNEL_STATE_RESTART; - } - SS7_DEBUG_CHAN(ftdmchan,"Channel signaling is in block state: proceed to State=%s]\n", - ftdm_channel_state2str(ftdmchan->last_state)); - SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X, circuit->flag=0x%X\n", - sngss7_info->ckt_flags, sngss7_info->blk_flags, - sngss7_info->circuit->flags); - } - - state_flag = 0; - ftdm_set_state(ftdmchan, ftdmchan->last_state); - break; - -suspend_goto_restart: - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - - /**************************************************************************/ - case FTDM_CHANNEL_STATE_IN_LOOP: /* COT test */ - - isup_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; - - if (sngss7_test_options(isup_intf, SNGSS7_LPA_FOR_COT)) { - /* send the lpa */ - ft_to_sngss7_lpa (ftdmchan); - } - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_IDLE: - state_flag = 0; - ftdm_set_state(ftdmchan, ftdmchan->last_state); - break; - /**************************************************************************/ - default: - /* we don't handle any of the other states */ - SS7_ERROR_CHAN(ftdmchan, "ftmod_sangoma_ss7 does not support %s state\n", ftdm_channel_state2str (ftdmchan->state)); - - break; - /**************************************************************************/ - } - - if (state_flag) { - /* clear the state change flag...since we might be setting a new state */ - ftdm_channel_complete_state(ftdmchan); - } - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call) -{ - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - /* the core has this channel already locked so need to lock again */ - - /* check if the channel sig state is UP */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - SS7_ERROR_CHAN(ftdmchan, "Requested channel sig state is down, skipping channell!%s\n", " "); - /* Sig state will be down due to a block. - Right action is to hunt for another call */ - goto outgoing_break; - } - - /* check if there is a remote block */ - if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { - - /* the channel is blocked...can't send any calls here */ - SS7_ERROR_CHAN(ftdmchan, "Requested channel is remotely blocked, re-hunt channel!%s\n", " "); - goto outgoing_break; - } - - /* check if there is a local block */ - if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) { - - /* KONRAD FIX ME : we should check if this is a TEST call and allow it */ - - /* the channel is blocked...can't send any calls here */ - SS7_ERROR_CHAN(ftdmchan, "Requested channel is locally blocked, re-hunt channel!%s\n", " "); - goto outgoing_break; - } - - - /* This is a gracefull stack resource check. - Removing this function will cause unpredictable - ungracefule errors. */ - if (sng_cc_resource_check()) { - goto outgoing_fail; - } - - /* check the state of the channel */ - switch (ftdmchan->state){ - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - /* inform the monitor thread that we want to make a call by returning FTDM_SUCCESS */ - - goto outgoing_successful; - break; - /**************************************************************************/ - default: - /* the channel is already used...this can't be, end the request */ - SS7_ERROR("Outgoing call requested channel in already in use...indicating glare on span=%d,chan=%d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - goto outgoing_break; - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) (original call) */ - -outgoing_fail: - SS7_DEBUG_CHAN(ftdmchan, "Call Request failed%s\n", " "); - return FTDM_FAIL; - -outgoing_break: - SS7_DEBUG_CHAN(ftdmchan, "Call Request re-hunt%s\n", " "); - return FTDM_BREAK; - -outgoing_successful: - SS7_DEBUG_CHAN(ftdmchan, "Call Request successful%s\n", " "); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -#if 0 - static FIO_CHANNEL_REQUEST_FUNCTION (ftdm_sangoma_ss7_request_chan) - { - SS7_INFO ("KONRAD-> I got called %s\n", __FTDM_FUNC__); - return FTDM_SUCCESS; - } - -#endif - -/******************************************************************************/ - -/* FT-CORE SIG STATUS FUNCTIONS ********************************************** */ -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_ss7_get_sig_status) -{ - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { - *status = FTDM_SIG_STATE_UP; - } else { - *status = FTDM_SIG_STATE_DOWN; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_ss7_set_sig_status) -{ - SS7_ERROR ("Cannot set channel status in this module\n"); - return FTDM_NOTIMPL; -} - -/* FT-CORE SIG FUNCTIONS ******************************************************/ -static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) -{ - ftdm_channel_t *ftdmchan = NULL; - sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = NULL; - sng_isup_inf_t *sngss7_intf = NULL; - int x; - int first_channel; - - first_channel=0; - - - SS7_INFO ("Starting span %s:%u.\n", span->name, span->span_id); - - /* clear the monitor thread stop flag */ - ftdm_clear_flag (span, FTDM_SPAN_STOP_THREAD); - ftdm_clear_flag (span, FTDM_SPAN_IN_THREAD); - - /* check the status of all isup interfaces */ - check_status_of_all_isup_intf(); - - /* throw the channels in pause */ - for (x = 1; x < (span->chan_count + 1); x++) { - /* extract the channel structure and sngss7 channel data */ - ftdmchan = span->channels[x]; - - /* if there is no sig mod data move along */ - if (ftdmchan->call_data == NULL) continue; - - sngss7_info = ftdmchan->call_data; - sngss7_span = ftdmchan->span->signal_data; - sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; - - /* flag the circuit as active so we can receieve events on it */ - sngss7_set_flag(sngss7_info->circuit, SNGSS7_ACTIVE); - - /* if this is a non-voice channel, move along cause we're done with it */ - if (sngss7_info->circuit->type != SNG_CKT_VOICE) continue; - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if the interface is paused or resumed */ - if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { - SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is PAUSED\n", sngss7_intf->id); - /* throw the pause flag */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - } else { - SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is RESUMED\n", sngss7_intf->id); - /* throw the resume flag */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - } -#if 0 - /* throw the grp reset flag */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX); - if (first_channel == 0) { - sngss7_chan_data_t *cinfo = ftdmchan->call_data; - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE); - cinfo->tx_grs.circuit = sngss7_info->circuit->id; - cinfo->tx_grs.range = span->chan_count -1; - first_channel=1; - } -#else - /* throw the channel into reset */ - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX); -#endif - /* throw the channel to suspend */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - } - - /* activate all the configured ss7 links */ - if (ft_to_sngss7_activate_all()) { - SS7_CRITICAL ("Failed to activate LibSngSS7!\n"); - return FTDM_FAIL; - } - - /*start the span monitor thread */ - if (ftdm_thread_create_detached (ftdm_sangoma_ss7_run, span) != FTDM_SUCCESS) { - SS7_CRITICAL ("Failed to start Span Monitor Thread!\n"); - return FTDM_FAIL; - } - - SS7_DEBUG ("Finished starting span %s:%u.\n", span->name, span->span_id); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t * span) -{ - /*this function is called by the FT-Core to stop this span */ - int timeout=0; - - ftdm_log (FTDM_LOG_INFO, "Stopping span %s:%u.\n", span->name,span->span_id); - - /* throw the STOP_THREAD flag to signal monitor thread stop */ - ftdm_set_flag (span, FTDM_SPAN_STOP_THREAD); - - /* wait for the thread to stop */ - while (ftdm_test_flag (span, FTDM_SPAN_IN_THREAD)) { - ftdm_set_flag (span, FTDM_SPAN_STOP_THREAD); - ftdm_log (FTDM_LOG_DEBUG,"Waiting for monitor thread to end for %s:%u. [flags=0x%08X]\n", - span->name, - span->span_id, - span->flags); - /* Wait 50ms */ - ftdm_sleep (50); - timeout++; - - /* timeout after 5 sec, better to crash than hang */ - ftdm_assert_return(timeout < 100, FTDM_FALSE, "SS7 Span stop timeout!\n"); - } - - /* KONRAD FIX ME - deconfigure any circuits, links, attached to this span */ - - ftdm_log (FTDM_LOG_DEBUG, "Finished stopping span %s:%u.\n", span->name, span->span_id); - - return FTDM_SUCCESS; -} - -/* SIG_FUNCTIONS ***************************************************************/ -static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) -{ - sngss7_span_data_t *ss7_span_info; - - ftdm_log (FTDM_LOG_INFO, "Configuring ftmod_sangoma_ss7 span = %s(%d)...\n", - span->name, - span->span_id); - - /* initalize the span's data structure */ - ss7_span_info = ftdm_calloc (1, sizeof (sngss7_span_data_t)); - - /* create a timer schedule */ - if (ftdm_sched_create(&ss7_span_info->sched, "SngSS7_Schedule")) { - SS7_CRITICAL("Unable to create timer schedule!\n"); - return FTDM_FAIL; - } - - /* start the free run thread for the schedule */ - if (ftdm_sched_free_run(ss7_span_info->sched)) { - SS7_CRITICAL("Unable to schedule free run!\n"); - return FTDM_FAIL; - } - - /* create an event queue for this span */ - if ((ftdm_queue_create(&(ss7_span_info)->event_queue, SNGSS7_EVENT_QUEUE_SIZE)) != FTDM_SUCCESS) { - SS7_CRITICAL("Unable to create event queue!\n"); - return FTDM_FAIL; - } - - /*setup the span structure with the info so far */ - g_ftdm_sngss7_data.sig_cb = sig_cb; - span->start = ftdm_sangoma_ss7_start; - span->stop = ftdm_sangoma_ss7_stop; - span->signal_type = FTDM_SIGTYPE_SS7; - span->signal_data = NULL; - span->outgoing_call = ftdm_sangoma_ss7_outgoing_call; - span->channel_request = NULL; - span->signal_cb = sig_cb; - span->get_channel_sig_status = ftdm_sangoma_ss7_get_sig_status; - span->set_channel_sig_status = ftdm_sangoma_ss7_set_sig_status; - span->state_map = &sangoma_ss7_state_map; - span->state_processor = ftdm_sangoma_ss7_process_state_change; - span->signal_data = ss7_span_info; - - /* set the flag to indicate that this span uses channel state change queues */ - ftdm_set_flag (span, FTDM_SPAN_USE_CHAN_QUEUE); - /* set the flag to indicate that this span uses sig event queues */ - ftdm_set_flag (span, FTDM_SPAN_USE_SIGNALS_QUEUE); - - - - /* parse the configuration and apply to the global config structure */ - if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { - ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n"); - ftdm_sleep (100); - return FTDM_FAIL; - } - - if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){ - ftdm_log (FTDM_LOG_INFO, "FreeTDM running as M2UA_SG mode, Setting Span type to FTDM_SIGTYPE_M2UA\n"); - span->signal_type = FTDM_SIGTYPE_M2UA; - } - - if (ft_to_sngss7_cfg_all()) { /* configure libsngss7 */ - ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n"); - ftdm_sleep (100); - return FTDM_FAIL; - } - - ftdm_log (FTDM_LOG_INFO, "Finished configuring ftmod_sangoma_ss7 span = %s(%d)...\n", - span->name, - span->span_id); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) -{ - /*this function is called by the FT-core to load the signaling module */ - uint32_t major = 0; - uint32_t minor = 0; - uint32_t build = 0; - - ftdm_log (FTDM_LOG_INFO, "Loading ftmod_sangoma_ss7...\n"); - - /* default the global structure */ - memset (&g_ftdm_sngss7_data, 0x0, sizeof (ftdm_sngss7_data_t)); - - sngss7_id = 0; - - cmbLinkSetId = 0; - - /* initalize the global gen_config flag */ - g_ftdm_sngss7_data.gen_config = 0; - - /* function trace initizalation */ - g_ftdm_sngss7_data.function_trace = 1; - g_ftdm_sngss7_data.function_trace_level = 7; - - /* message (IAM, ACM, ANM, etc) trace initizalation */ - g_ftdm_sngss7_data.message_trace = 1; - g_ftdm_sngss7_data.message_trace_level = 6; - - /* setup the call backs needed by Sangoma_SS7 library */ - sng_event.cc.sng_con_ind = sngss7_con_ind; - sng_event.cc.sng_con_cfm = sngss7_con_cfm; - sng_event.cc.sng_con_sta = sngss7_con_sta; - sng_event.cc.sng_rel_ind = sngss7_rel_ind; - sng_event.cc.sng_rel_cfm = sngss7_rel_cfm; - sng_event.cc.sng_dat_ind = sngss7_dat_ind; - sng_event.cc.sng_fac_ind = sngss7_fac_ind; - sng_event.cc.sng_fac_cfm = sngss7_fac_cfm; - sng_event.cc.sng_sta_ind = sngss7_sta_ind; - sng_event.cc.sng_umsg_ind = sngss7_umsg_ind; - sng_event.cc.sng_susp_ind = sngss7_susp_ind; - sng_event.cc.sng_resm_ind = sngss7_resm_ind; - - sng_event.sm.sng_log = handle_sng_log; - sng_event.sm.sng_mtp1_alarm = handle_sng_mtp1_alarm; - sng_event.sm.sng_mtp2_alarm = handle_sng_mtp2_alarm; - sng_event.sm.sng_mtp3_alarm = handle_sng_mtp3_alarm; - sng_event.sm.sng_isup_alarm = handle_sng_isup_alarm; - sng_event.sm.sng_cc_alarm = handle_sng_cc_alarm; - sng_event.sm.sng_relay_alarm = handle_sng_relay_alarm; - sng_event.sm.sng_m2ua_alarm = handle_sng_m2ua_alarm; - sng_event.sm.sng_nif_alarm = handle_sng_nif_alarm; - sng_event.sm.sng_tucl_alarm = handle_sng_tucl_alarm; - sng_event.sm.sng_sctp_alarm = handle_sng_sctp_alarm; - - /* initalize sng_ss7 library */ - sng_isup_init_gen(&sng_event); - - /* print the version of the library being used */ - sng_isup_version(&major, &minor, &build); - SS7_INFO("Loaded LibSng-SS7 %d.%d.%d\n", major, minor, build); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) -{ - /*this function is called by the FT-core to unload the signaling module */ - - int x; - - ftdm_log (FTDM_LOG_INFO, "Starting ftmod_sangoma_ss7 unload...\n"); - - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_STARTED)) { - sng_isup_free_cc(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_STARTED); - } - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_STARTED)) { - ftmod_ss7_shutdown_isup(); - sng_isup_free_isup(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_STARTED); - } - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_STARTED)) { - ftmod_ss7_shutdown_mtp3(); - sng_isup_free_mtp3(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_STARTED); - } - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED)) { - ftmod_ss7_shutdown_mtp2(); - sng_isup_free_mtp2(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED); - } - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1_STARTED)) { - sng_isup_free_mtp1(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1_STARTED); - } - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED)) { - /* go through all the relays channels and disable them */ - x = 1; - while (x < (MAX_RELAY_CHANNELS)) { - /* check if this relay channel has been configured already */ - if ((g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED)) { - - /* send the specific configuration */ - if (ftmod_ss7_disable_relay_channel(x)) { - SS7_CRITICAL("Relay Channel %d disable failed!\n", x); - /* jz: dont leave like this - * return 1; - * */ - } else { - SS7_INFO("Relay Channel %d disable DONE!\n", x); - } - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.relay[x].flags &= ~(SNGSS7_CONFIGURED); - } /* if !SNGSS7_CONFIGURED */ - x++; - } /* while (x < (MAX_RELAY_CHANNELS)) */ - - ftmod_ss7_shutdown_relay(); - sng_isup_free_relay(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED); - } - - if(SNG_SS7_OPR_MODE_ISUP != g_ftdm_operating_mode){ - ftmod_ss7_m2ua_free(); - } - - - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED)) { - sng_isup_free_sm(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED); - } - - sng_isup_free_gen(); - - ftdm_log (FTDM_LOG_INFO, "Finished ftmod_sangoma_ss7 unload!\n"); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static FIO_API_FUNCTION(ftdm_sangoma_ss7_api) -{ - /* handle this in it's own file....so much to do */ - return (ftdm_sngss7_handle_cli_cmd (stream, data)); -} - -/******************************************************************************/ -static FIO_IO_LOAD_FUNCTION(ftdm_sangoma_ss7_io_init) -{ - assert (fio != NULL); - memset (&g_ftdm_sngss7_interface, 0, sizeof (g_ftdm_sngss7_interface)); - - g_ftdm_sngss7_interface.name = "ss7"; - g_ftdm_sngss7_interface.api = ftdm_sangoma_ss7_api; - - *fio = &g_ftdm_sngss7_interface; - - return FTDM_SUCCESS; -} - -/******************************************************************************/ - - -/* START **********************************************************************/ -ftdm_module_t ftdm_module = { - "sangoma_ss7", /*char name[256]; */ - ftdm_sangoma_ss7_io_init, /*fio_io_load_t */ - NULL, /*fio_io_unload_t */ - ftdm_sangoma_ss7_init, /*fio_sig_load_t */ - NULL, /*fio_sig_configure_t */ - ftdm_sangoma_ss7_unload, /*fio_sig_unload_t */ - ftdm_sangoma_ss7_span_config /*fio_configure_span_signaling_t */ -}; -/******************************************************************************/ - -/******************************************************************************/ -/* 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h deleted file mode 100644 index 6dabf727cd..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ /dev/null @@ -1,1246 +0,0 @@ -/* - * Copyright (c) 2009, Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributors: - * - * James Zhang - * - */ -/******************************************************************************/ -#ifndef __FTMOD_SNG_SS7_H__ -#define __FTMOD_SNG_SS7_H__ -/******************************************************************************/ - -/* INCLUDE ********************************************************************/ -#include -#include -#include -#include -#include -#include - -#include "private/ftdm_core.h" - -#include "sng_ss7/sng_ss7.h" -#include "ftmod_sangoma_ss7_m2ua.h" - -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -#define MAX_NAME_LEN 25 - -#define MAX_CIC_LENGTH 5 -#define MAX_CIC_MAP_LENGTH 1000 -#define MAX_SCTP_LINK 100 - -#define SNGSS7_EVENT_QUEUE_SIZE 100 -#define SNGSS7_PEER_CHANS_QUEUE_SIZE 100 -#define SNGSS7_CHAN_EVENT_QUEUE_SIZE 100 - -#define MAX_SIZEOF_SUBADDR_IE 24 /* as per Q931 4.5.9 */ - -#define SNGSS7_SWITCHTYPE_ANSI(switchtype) (switchtype == LSI_SW_ANS88) || \ - (switchtype == LSI_SW_ANS92) || \ - (switchtype == LSI_SW_ANS95) - -#define sngss7_flush_queue(queue) \ - do { \ - void *__queue_data = NULL; \ - while ((__queue_data = ftdm_queue_dequeue(queue))) { \ - ftdm_safe_free(__queue_data); \ - } \ - } while (0) - -typedef struct ftdm2trillium { - uint8_t ftdm_val; - uint8_t trillium_val; -} ftdm2trillium_t; - -typedef enum { - SNGSS7_CON_IND_EVENT = 0, - SNGSS7_CON_CFM_EVENT, - SNGSS7_CON_STA_EVENT, - SNGSS7_REL_IND_EVENT, - SNGSS7_REL_CFM_EVENT, - SNGSS7_DAT_IND_EVENT, - SNGSS7_FAC_IND_EVENT, - SNGSS7_FAC_CFM_EVENT, - SNGSS7_UMSG_IND_EVENT, - SNGSS7_STA_IND_EVENT, - SNGSS7_SUSP_IND_EVENT, - SNGSS7_RESM_IND_EVENT, - SNGSS7_SSP_STA_CFM_EVENT, - SNGSS7_INVALID_EVENT, -} sng_event_type_t; -#define SNG_EVENT_TYPE_STRINGS "CON_IND", "CON_CFM", "CON_STA", "REL_IND", "REL_CFM", "DAT_IND", "FAC_IND", \ - "FAC_CFM", "UMSG_IND", "STA_IND", "SUSP_IND", "RESM_IND", "SSP_STA_CFM", "INVALID" -FTDM_STR2ENUM_P(ftdm_str2sngss7_event, ftdm_sngss7_event2str, sng_event_type_t) - -typedef enum { - SNG_BIT_A = (1 << 0), - SNG_BIT_B = (1 << 1), - SNG_BIT_C = (1 << 2), - SNG_BIT_D = (1 << 3), - SNG_BIT_E = (1 << 4), - SNG_BIT_F = (1 << 5), - SNG_BIT_G = (1 << 6), - SNG_BIT_H = (1 << 7) -} sng_bit_enums_t; - -typedef enum { - SNG_CKT_VOICE = 0, - SNG_CKT_SIG, - SNG_CKT_HOLE -} sng_ckt_type_t; - -typedef enum { - SNG_RTE_UP = 0, - SNG_RTE_DN -} sng_route_direction_t; - -typedef enum { - SNGSS7_LPA_FOR_COT = (1 << 0), /* send LPA when COT arrives */ - SNGSS7_ACM_OBCI_BITA = (1 << 10) /* in-band indication */ -} sng_intf_options_t; - -typedef enum { - SNG_CALLED = 1, - SNG_CALLING = 2 -} sng_addr_type_t; - -typedef enum { - SNG_GEN_CFG_STATUS_INIT = 0, - SNG_GEN_CFG_STATUS_PENDING = 1, - SNG_GEN_CFG_STATUS_DONE = 2 -} nsg_gen_cfg_type_t; - -typedef struct sng_mtp2_error_type { - int init; - char sng_type[MAX_NAME_LEN]; - uint32_t tril_type; -} sng_mtp2_error_type_t; - -typedef struct sng_link_type { - int init; - char sng_type[MAX_NAME_LEN]; - uint32_t tril_mtp2_type; - uint32_t tril_mtp3_type; -} sng_link_type_t; - -typedef struct sng_switch_type { - int init; - char sng_type[MAX_NAME_LEN]; - uint32_t tril_mtp3_type; - uint32_t tril_isup_type; -} sng_switch_type_t; - -typedef struct sng_ssf_type { - int init; - char sng_type[MAX_NAME_LEN]; - uint32_t tril_type; -} sng_ssf_type_t; - -typedef struct sng_cic_cntrl_type { - int init; - char sng_type[MAX_NAME_LEN]; - uint32_t tril_type; -} sng_cic_cntrl_type_t; - -typedef struct sng_mtp1_link { - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; - uint32_t span; - uint32_t chan; -} sng_mtp1_link_t; - -typedef struct sng_mtp2_link { - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; - uint32_t lssuLength; - uint32_t errorType; - uint32_t linkType; - uint32_t mtp1Id; - uint32_t mtp1ProcId; - uint32_t t1; - uint32_t t2; - uint32_t t3; - uint32_t t4n; - uint32_t t4e; - uint32_t t5; - uint32_t t6; - uint32_t t7; -} sng_mtp2_link_t; - -/* defining glare handling methods: - SNGSS7_GLARE_PC: - higher PointCode controls even number CIC - lower PointCode controls odd number CIC - SNGSS7_GLARE_DOWN: - always give control to the other side - SNGSS7_GLARE_CONTROL: - always trying to control -*/ -typedef enum { - SNGSS7_GLARE_PC = 0, - SNGSS7_GLARE_DOWN, - SNGSS7_GLARE_CONTROL -} sng_glare_resolution; - -typedef struct sng_mtp3_link { - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; - uint32_t priority; - uint32_t linkType; - uint32_t switchType; - uint32_t apc; - uint32_t spc; - uint32_t ssf; - uint32_t slc; - uint32_t linkSetId; - uint32_t mtp2Id; - uint32_t mtp2ProcId; - uint32_t t1; - uint32_t t2; - uint32_t t3; - uint32_t t4; - uint32_t t5; - uint32_t t6; - uint32_t t7; - uint32_t t8; - uint32_t t9; - uint32_t t10; - uint32_t t11; - uint32_t t12; - uint32_t t13; - uint32_t t14; - uint32_t t15; - uint32_t t16; - uint32_t t17; - uint32_t t18; - uint32_t t19; - uint32_t t20; - uint32_t t21; - uint32_t t22; - uint32_t t23; - uint32_t t24; - uint32_t t25; - uint32_t t27; - uint32_t t28; - uint32_t t29; - uint32_t t30; - uint32_t t31; - uint32_t t32; - uint32_t t33; - uint32_t t34; - uint32_t t35; - uint32_t t36; - uint32_t t37; - uint32_t tcraft; - uint32_t tflc; - uint32_t tbnd; -} sng_mtp3_link_t; - -typedef struct sng_link_set { - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; - uint32_t apc; - uint32_t linkType; - uint32_t switchType; - uint32_t ssf; - uint32_t minActive; - uint32_t numLinks; - uint32_t links[16]; -} sng_link_set_t; - -typedef struct sng_link_set_list { - uint32_t lsId; - struct sng_link_set_list *next; -} sng_link_set_list_t; - -typedef struct sng_route { - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; - uint32_t dpc; - uint32_t cmbLinkSetId; - struct sng_link_set_list lnkSets; - uint32_t linkType; - uint32_t switchType; - uint32_t ssf; - uint32_t nwId; - uint32_t isSTP; - uint32_t dir; - uint32_t t6; - uint32_t t8; - uint32_t t10; - uint32_t t11; - uint32_t t15; - uint32_t t16; - uint32_t t18; - uint32_t t19; - uint32_t t21; - uint32_t t25; - uint32_t t26; -} sng_route_t; - -typedef struct sng_isup_intf { - char name[MAX_NAME_LEN]; - uint32_t options; - uint32_t flags; - uint32_t id; - uint32_t spc; - uint32_t dpc; - uint32_t switchType; - uint32_t nwId; - uint32_t mtpRouteId; - uint32_t ssf; - uint32_t isap; - uint16_t t4; - uint32_t t11; - uint32_t t18; - uint32_t t19; - uint32_t t20; - uint32_t t21; - uint32_t t22; - uint32_t t23; - uint32_t t24; - uint32_t t25; - uint32_t t26; - uint32_t t28; - uint32_t t29; - uint32_t t30; - uint32_t t32; - uint32_t t37; - uint32_t t38; - uint32_t t39; - uint32_t tfgr; - uint32_t tpause; - uint32_t tstaenq; -} sng_isup_inf_t; - -typedef struct sng_isup_ckt { - uint32_t options; - uint32_t flags; - uint32_t procId; - uint32_t id; - uint32_t ccSpanId; - uint32_t span; - uint32_t chan; - uint32_t type; /* VOICE/SIG/HOLE */ - uint32_t cic; - uint32_t infId; - uint32_t typeCntrl; - uint32_t ssf; - uint32_t switchType; - - uint32_t clg_nadi; - uint32_t cld_nadi; - uint8_t rdnis_nadi; - uint32_t loc_nadi; - - /* Generic Number defaults */ - uint8_t gn_nmbqual; /* Number Qualifier */ - uint8_t gn_nadi; /* Nature of Address indicator */ - uint8_t gn_screen_ind; /* Screening Indicator */ - uint8_t gn_pres_ind; /* Presentation Indicator */ - uint8_t gn_npi; /* Numbering Plan Indicator */ - uint8_t gn_num_inc_ind; /* Number Incomplete Indicator */ - /* END - Generic Number defaults */ - - uint32_t min_digits; - uint32_t transparent_iam_max_size; - uint8_t transparent_iam; - uint8_t cpg_on_progress_media; - uint8_t cpg_on_progress; - uint8_t itx_auto_reply; - void *obj; - uint16_t t3; - uint32_t t10; - uint16_t t12; - uint16_t t13; - uint16_t t14; - uint16_t t15; - uint16_t t16; - uint16_t t17; - uint32_t t35; - uint32_t t39; - uint16_t tval; -} sng_isup_ckt_t; - -typedef struct sng_nsap { - uint32_t flags; - uint32_t id; - uint32_t suId; - uint32_t spId; - uint32_t nwId; - uint32_t linkType; - uint32_t switchType; - uint32_t ssf; -} sng_nsap_t; - -typedef struct sng_isap { - uint32_t id; - uint32_t suId; - uint32_t spId; - uint32_t switchType; - uint32_t ssf; - uint32_t flags; - uint32_t t1; - uint32_t t2; - uint32_t t5; - uint32_t t6; - uint32_t t7; - uint32_t t8; - uint32_t t9; - uint32_t t27; - uint32_t t31; - uint32_t t33; - uint32_t t34; - uint32_t t36; - uint32_t tccr; - uint32_t tccrt; - uint32_t tex; - uint32_t tcrm; - uint32_t tcra; - uint32_t tect; - uint32_t trelrsp; - uint32_t tfnlrelrsp; -} sng_isap_t; - -typedef struct sng_relay { - uint32_t id; - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t type; - uint32_t port; - char hostname[RY_REMHOSTNAME_SIZE]; - uint32_t procId; -} sng_relay_t; - -/********************************************** -sctp structures and data definitions -**********************************************/ - -typedef struct sng_sctp_gen_cfg { -} sng_sctp_gen_cfg_t; - -typedef struct sng_sctp_link { - char name[MAX_NAME_LEN]; - uint32_t flags; - uint32_t id; - uint32_t port; - uint32_t numSrcAddr; - uint32_t srcAddrList[SCT_MAX_NET_ADDRS+1]; -} sng_sctp_link_t; - -typedef struct sng_sctp_cfg { - sng_sctp_gen_cfg_t genCfg; - sng_sctp_link_t linkCfg[MAX_SCTP_LINK+1]; -} sng_sctp_cfg_t; - - - -typedef struct sng_ss7_cfg { - uint32_t spc; - uint32_t procId; - char license[MAX_SNGSS7_PATH]; - char signature[MAX_SNGSS7_PATH]; - uint32_t transparent_iam_max_size; - uint32_t flags; - sng_relay_t relay[MAX_RELAY_CHANNELS+1]; - sng_mtp1_link_t mtp1Link[MAX_MTP_LINKS+1]; - sng_mtp2_link_t mtp2Link[MAX_MTP_LINKS+1]; - sng_mtp3_link_t mtp3Link[MAX_MTP_LINKS+1]; - sng_link_set_t mtpLinkSet[MAX_MTP_LINKSETS+1]; - sng_route_t mtpRoute[MAX_MTP_ROUTES+1]; - sng_isup_inf_t isupIntf[MAX_ISUP_INFS+1]; - sng_isup_ckt_t isupCkt[10000]; /* KONRAD - only need 2000 ( and 0-1000 aren't used) since other servers are registerd else where */ - sng_nsap_t nsap[MAX_NSAPS+1]; - sng_isap_t isap[MAX_ISAPS+1]; - sng_glare_resolution glareResolution; - uint32_t force_inr; - sng_m2ua_gbl_cfg_t g_m2ua_cfg; - sng_sctp_cfg_t sctpCfg; -} sng_ss7_cfg_t; - -typedef struct ftdm_sngss7_data { - sng_ss7_cfg_t cfg; - int gen_config; - int function_trace; - int function_trace_level; - int message_trace; - int message_trace_level; - fio_signal_cb_t sig_cb; -} ftdm_sngss7_data_t; - -typedef enum{ - SNG_SS7_OPR_MODE_NONE, - SNG_SS7_OPR_MODE_M2UA_SG, - SNG_SS7_OPR_MODE_ISUP, -}ftdm_sngss7_operating_modes_e; - -typedef ftdm_sngss7_operating_modes_e ftdm_sngss7_opr_mode; - -typedef struct sngss7_timer_data { - ftdm_timer_id_t hb_timer_id; - int beat; - int counter; - ftdm_sched_callback_t callback; - ftdm_sched_t *sched; - void *sngss7_info; -} sngss7_timer_data_t; - -typedef struct sngss7_glare_data { - uint32_t spInstId; - uint32_t circuit; - SiConEvnt iam; -} sngss7_glare_data_t; - -typedef struct sngss7_group_data { - uint32_t circuit; - uint32_t range; - uint8_t status[255]; - uint8_t type; - uint8_t cause; -} sngss7_group_data_t; - -typedef struct sngss7_chan_data { - ftdm_channel_t *ftdmchan; - sng_isup_ckt_t *circuit; - uint32_t base_chan; - uint32_t suInstId; - uint32_t spInstId; - uint32_t spId; - uint8_t globalFlg; - uint32_t ckt_flags; - uint32_t blk_flags; - ftdm_hash_t* variables; /* send on next sigevent */ - ftdm_size_t raw_data_len; - void *raw_data; /* send on next sigevent */ - sngss7_glare_data_t glare; - sngss7_timer_data_t t35; - sngss7_timer_data_t t10; - sngss7_timer_data_t t39; - sngss7_group_data_t rx_grs; - sngss7_group_data_t rx_gra; - sngss7_group_data_t tx_grs; - sngss7_group_data_t ucic; - ftdm_queue_t *event_queue; - struct sngss7_chan_data *peer_data; - uint8_t peer_event_transfer_cnt; -} sngss7_chan_data_t; - -#define SNGSS7_RX_GRS_PENDING (1 << 0) -#define SNGSS7_UCIC_PENDING (1 << 1) -#define SNGSS7_RX_GRA_PENDING (1 << 2) -typedef struct sngss7_span_data { - ftdm_sched_t *sched; - uint32_t flags; - sngss7_group_data_t rx_cgb; - sngss7_group_data_t tx_cgb; - sngss7_group_data_t rx_cgu; - sngss7_group_data_t tx_cgu; - ftdm_queue_t *event_queue; -} sngss7_span_data_t; - -typedef struct sngss7_event_data -{ - uint32_t event_id; - uint32_t spId; - uint32_t suId; - uint32_t spInstId; - uint32_t suInstId; - uint32_t circuit; - uint8_t globalFlg; - uint8_t evntType; - union - { - SiConEvnt siConEvnt; - SiCnStEvnt siCnStEvnt; - SiRelEvnt siRelEvnt; - SiInfoEvnt siInfoEvnt; - SiFacEvnt siFacEvnt; - SiStaEvnt siStaEvnt; - SiSuspEvnt siSuspEvnt; - SiResmEvnt siResmEvnt; - } event; -} sngss7_event_data_t; - - -typedef enum { - FLAG_RESET_RX = (1 << 0), - FLAG_RESET_TX = (1 << 1), - FLAG_RESET_SENT = (1 << 2), - FLAG_RESET_TX_RSP = (1 << 3), - FLAG_GRP_RESET_RX = (1 << 4), - FLAG_GRP_RESET_RX_DN = (1 << 5), - FLAG_GRP_RESET_RX_CMPLT = (1 << 6), - FLAG_GRP_RESET_BASE = (1 << 7), - FLAG_GRP_RESET_TX = (1 << 8), - FLAG_GRP_RESET_SENT = (1 << 9), - FLAG_GRP_RESET_TX_RSP = (1 << 10), - FLAG_REMOTE_REL = (1 << 11), - FLAG_LOCAL_REL = (1 << 12), - FLAG_GLARE = (1 << 13), - FLAG_INFID_RESUME = (1 << 14), - FLAG_INFID_PAUSED = (1 << 15), - FLAG_SENT_ACM = (1 << 16), - FLAG_SENT_CPG = (1 << 17), - FLAG_SUS_RECVD = (1 << 18), - FLAG_T6_CANCELED = (1 << 19), - FLAG_INR_TX = (1 << 20), - FLAG_INR_SENT = (1 << 21), - FLAG_INR_RX = (1 << 22), - FLAG_INR_RX_DN = (1 << 23), - FLAG_INF_TX = (1 << 24), - FLAG_INF_SENT = (1 << 25), - FLAG_INF_RX = (1 << 26), - FLAG_INF_RX_DN = (1 << 27), - FLAG_FULL_NUMBER = (1 << 28), - FLAG_RELAY_DOWN = (1 << 30), - FLAG_CKT_RECONFIG = (1 << 31) -} sng_ckt_flag_t; - -#define CKT_FLAGS_STRING \ - "RX_RSC", \ - "TX_RSC", \ - "TX_RSC_REQ_SENT", \ - "TX_RSC_RSP_RECEIVED", \ - "RX_GRS", \ - "RX_GRS_DONE", \ - "RX_GRS_CMPLT", \ - "GRS_BASE", \ - "TX_GRS", \ - "TX_GRS_REQ_SENT", \ - "TX_GRS_RSP_RECEIVED", \ - "REMOTE_REL", \ - "LOCAL_REL", \ - "GLARE", \ - "INF_RESUME", \ - "INF_PAUSED", \ - "TX_ACM_SENT" \ - "TX_INR" \ - "INR_SENT" \ - "RX_INR" \ - "RX_INR_DN" \ - "TX_INF" \ - "INF SENT" \ - "RX_INF" \ - "RX_INF_DN" \ - "RELAY_DOWN", \ - "CKT_RECONFIG" -FTDM_STR2ENUM_P(ftmod_ss7_ckt_state2flag, ftmod_ss7_ckt_flag2str, sng_ckt_flag_t) - -/* ckt blocking flags */ -typedef enum { - FLAG_CKT_UCIC_BLOCK = (1 << 0), - FLAG_CKT_UCIC_BLOCK_DN = (1 << 1), - FLAG_CKT_UCIC_UNBLK = (1 << 2), - FLAG_CKT_UCIC_UNBLK_DN = (1 << 3), - FLAG_CKT_LC_BLOCK_RX = (1 << 4), - FLAG_CKT_LC_BLOCK_RX_DN = (1 << 5), - FLAG_CKT_LC_UNBLK_RX = (1 << 6), - FLAG_CKT_LC_UNBLK_RX_DN = (1 << 7), - FLAG_CKT_MN_BLOCK_RX = (1 << 8), - FLAG_CKT_MN_BLOCK_RX_DN = (1 << 9), - FLAG_CKT_MN_UNBLK_RX = (1 << 10), - FLAG_CKT_MN_UNBLK_RX_DN = (1 << 11), - FLAG_CKT_MN_BLOCK_TX = (1 << 12), - FLAG_CKT_MN_BLOCK_TX_DN = (1 << 13), - FLAG_CKT_MN_UNBLK_TX = (1 << 14), - FLAG_CKT_MN_UNBLK_TX_DN = (1 << 15), - FLAG_GRP_HW_BLOCK_RX = (1 << 16), - FLAG_GRP_HW_BLOCK_RX_DN = (1 << 17), - FLAG_GRP_HW_BLOCK_TX = (1 << 18), - FLAG_GRP_HW_BLOCK_TX_DN = (1 << 19), - FLAG_GRP_MN_BLOCK_RX = (1 << 20), - FLAG_GRP_MN_BLOCK_RX_DN = (1 << 21), - FLAG_GRP_MN_BLOCK_TX = (1 << 22), - FLAG_GRP_MN_BLOCK_TX_DN = (1 << 23), - FLAG_GRP_HW_UNBLK_TX = (1 << 24), - FLAG_GRP_HW_UNBLK_TX_DN = (1 << 25), - FLAG_GRP_MN_UNBLK_TX = (1 << 26), - FLAG_GRP_MN_UNBLK_TX_DN = (1 << 27), -} sng_ckt_block_flag_t; - -#define BLK_FLAGS_STRING \ - "UCIC BLK", \ - "UCIC BLK DN", \ - "UCIC UNBLK", \ - "UCIC UNBLK DN", \ - "RX LC BLK", \ - "RX LC BLK DN", \ - "RX LC UNBLK", \ - "RX LC UNBLK DN", \ - "RX CKT BLK", \ - "RX CKT BLK DN", \ - "RX CKT UNBLK", \ - "RX CKT UNBLK DN", \ - "TX CKT BLK", \ - "TX CKT BLK DN", \ - "TX CKT UNBLK", \ - "TX CKT UNBLK DN", \ - "RX GRP HW BLK", \ - "RX GRP HW BLK DN", \ - "TX GRP HW BLK", \ - "TX GRP HW BLK DN", \ - "RX GRP MN BLK", \ - "RX GRP MN BLK DN", \ - "TX GRP MN BLK", \ - "TX GRP MN BLK DN", \ - "TX GRP HW UNBLK", \ - "TX GRP HW UNBLK DN", \ - "TX GRP MN UNBLK", \ - "TX GRP MN UNBLK DN", \ - "RX GRP HW UNBLK", \ - "RX GRP HW UNBLK DN" -FTDM_STR2ENUM_P(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t) - -/* valid for every cfg array except circuits */ -typedef enum { - SNGSS7_CONFIGURED = (1 << 0), - SNGSS7_ACTIVE = (1 << 1), - SNGSS7_RELAY_INIT = (1 << 3), - SNGSS7_PAUSED = (1 << 7) /* for isup interfaces */ -} sng_cfg_flag_t; - -typedef enum { - SNGSS7_SM_STARTED = (1 << 0), - - SNGSS7_RY_PRESENT = (1 << 2), - SNGSS7_RY_STARTED = (1 << 3), - - SNGSS7_MTP1_PRESENT = (1 << 4), - SNGSS7_MTP1_STARTED = (1 << 5), - - SNGSS7_MTP2_PRESENT = (1 << 6), - SNGSS7_MTP2_STARTED = (1 << 7), - - SNGSS7_MTP3_PRESENT = (1 << 8), - SNGSS7_MTP3_STARTED = (1 << 9), - - SNGSS7_ISUP_PRESENT = (1 << 10), - SNGSS7_ISUP_STARTED = (1 << 11), - - SNGSS7_CC_PRESENT = (1 << 12), - SNGSS7_CC_STARTED = (1 << 13), - - SNGSS7_TUCL_PRESENT = (1 << 14), - SNGSS7_TUCL_STARTED = (1 << 15), - - SNGSS7_SCTP_PRESENT = (1 << 16), - SNGSS7_SCTP_STARTED = (1 << 17), - - SNGSS7_M2UA_PRESENT = (1 << 18), - SNGSS7_M2UA_STARTED = (1 << 19), - SNGSS7_M2UA_EP_OPENED = (1 << 20), - SNGSS7_M2UA_INIT_ASSOC_DONE = (1 << 21), - - SNGSS7_NIF_PRESENT = (1 << 22), - SNGSS7_NIF_STARTED = (1 << 23), - -} sng_task_flag_t; -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -extern ftdm_sngss7_data_t g_ftdm_sngss7_data; -extern ftdm_sngss7_opr_mode g_ftdm_operating_mode; -extern sng_ssf_type_t sng_ssf_type_map[]; -extern sng_switch_type_t sng_switch_type_map[]; -extern sng_link_type_t sng_link_type_map[]; -extern sng_mtp2_error_type_t sng_mtp2_error_type_map[]; -extern sng_cic_cntrl_type_t sng_cic_cntrl_type_map[]; -extern uint32_t sngss7_id; -extern ftdm_sched_t *sngss7_sched; -extern int cmbLinkSetId; -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -/* in ftmod_sangoma_ss7_main.c */ -ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); - -/* in ftmod_sangoma_ss7_logger.c */ -void handle_sng_log(uint8_t level, char *fmt,...); -void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta); -void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta); -void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta); -void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta); -void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta); -void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta); -void handle_sng_m2ua_alarm(Pst *pst, MwMgmt *sta); -void handle_sng_nif_alarm(Pst *pst, NwMgmt *sta); -void handle_sng_tucl_alarm(Pst *pst, HiMngmt *sta); -void handle_sng_sctp_alarm(Pst *pst, SbMgmt *sta); - -/* in ftmod_sangoma_ss7_relay.c */ -ftdm_status_t handle_relay_connect(RyMngmt *sta); -ftdm_status_t handle_relay_disconnect_on_down(RyMngmt *sta); -ftdm_status_t handle_relay_disconnect_on_error(RyMngmt *sta); - -/* in ftmod_sangoma_ss7_cfg.c */ -int ft_to_sngss7_cfg_all(void); -int ftmod_ss7_mtp1_gen_config(void); -int ftmod_ss7_mtp2_gen_config(void); -int ftmod_ss7_mtp3_gen_config(void); -int ftmod_ss7_isup_gen_config(void); -int ftmod_ss7_cc_gen_config(void); -int ftmod_ss7_mtp1_psap_config(int id); -int ftmod_ss7_mtp2_dlsap_config(int id); -int ftmod_ss7_mtp3_dlsap_config(int id); -int ftmod_ss7_mtp3_nsap_config(int id); -int ftmod_ss7_mtp3_linkset_config(int id); -int ftmod_ss7_mtp3_route_config(int id); -int ftmod_ss7_isup_nsap_config(int id); -int ftmod_ss7_isup_intf_config(int id); -int ftmod_ss7_isup_ckt_config(int id); -int ftmod_ss7_isup_isap_config(int id); -int ftmod_ss7_cc_isap_config(int id); - -/* in ftmod_sangoma_ss7_cntrl.c */ -int ft_to_sngss7_activate_all(void); - -int ftmod_ss7_inhibit_mtp3link(uint32_t id); -int ftmod_ss7_uninhibit_mtp3link(uint32_t id); -int ftmod_ss7_bind_mtp3link(uint32_t id); -int ftmod_ss7_unbind_mtp3link(uint32_t id); -int ftmod_ss7_activate_mtp3link(uint32_t id); -int ftmod_ss7_deactivate_mtp3link(uint32_t id); -int ftmod_ss7_deactivate2_mtp3link(uint32_t id); -int ftmod_ss7_activate_mtplinkSet(uint32_t id); -int ftmod_ss7_deactivate_mtplinkSet(uint32_t id); -int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id); -int ftmod_ss7_lpo_mtp3link(uint32_t id); -int ftmod_ss7_lpr_mtp3link(uint32_t id); - -int ftmod_ss7_shutdown_isup(void); -int ftmod_ss7_shutdown_mtp3(void); -int ftmod_ss7_shutdown_mtp2(void); -int ftmod_ss7_shutdown_relay(void); -int ftmod_ss7_disable_relay_channel(uint32_t chanId); - -int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId); -int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId); - -int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId); - -#define ftmod_ss7_block_isup_ckt(x) __ftmod_ss7_block_isup_ckt(x,FTDM_TRUE) -#define ftmod_ss7_block_isup_ckt_nowait(x) __ftmod_ss7_block_isup_ckt(x,FTDM_FALSE) -int __ftmod_ss7_block_isup_ckt(uint32_t cktId, ftdm_bool_t wait); -int ftmod_ss7_unblock_isup_ckt(uint32_t cktId); - - -/* in ftmod_sangoma_ss7_sta.c */ -int ftmod_ss7_mtp1link_sta(uint32_t id, L1Mngmt *cfm); -int ftmod_ss7_mtp2link_sta(uint32_t id, SdMngmt *cfm); -int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm); -int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm); -int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status); -int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm); -int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state); - - -/* in ftmod_sangoma_ss7_out.c */ -void ft_to_sngss7_iam(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_acm(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_cpg (ftdm_channel_t *ftdmchan); -void ft_to_sngss7_anm(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_rel(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_rlc(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_rsc(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_rsca(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_blo(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_bla(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_ubl(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_uba(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_lpa(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_gra(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_grs(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_inr(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_inf(ftdm_channel_t *ftdmchan, SiCnStEvnt *inr); - - - -/* in ftmod_sangoma_ss7_in.c */ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); -void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); -void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt); -void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt); -void sngss7_ssp_sta_cfm(uint32_t infId); - -ftdm_status_t sngss7_bufferzero_iam(SiConEvnt *siConEvnt); -ftdm_status_t sngss7_retrieve_iam(ftdm_channel_t *ftdmchan, SiConEvnt *siConEvnt); -ftdm_status_t sngss7_save_iam(ftdm_channel_t *ftdmchan, SiConEvnt *siConEvnt); - -/* in ftmod_sangoma_ss7_handle.c */ -ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); -ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); -ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); -ftdm_status_t handle_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt); -ftdm_status_t handle_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt); -ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -/* in ftmod_sangoma_ss7_xml.c */ -int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); - -/* in ftmod_sangoma_ss7_cli.c */ -ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); - -/* in ftmod_sangoma_ss7_support.c */ -ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum); -ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum); -ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum); -ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum); -ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); -ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); -ftdm_status_t copy_redirgInfo_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *redirInfo); -ftdm_status_t copy_redirgInfo_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *redirInfo); -ftdm_status_t copy_ocn_to_sngss7(ftdm_channel_t *ftdmchan, SiOrigCdNum *origCdNum); -ftdm_status_t copy_ocn_from_sngss7(ftdm_channel_t *ftdmchan, SiOrigCdNum *origCdNum); - -ftdm_status_t copy_access_transport_from_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt); -ftdm_status_t copy_access_transport_to_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt); -ftdm_status_t copy_locPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *locPtyNum); -ftdm_status_t copy_locPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *locPtyNum); -ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); -ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); -ftdm_status_t copy_cgPtyCat_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat); -ftdm_status_t copy_cgPtyCat_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat); -ftdm_status_t copy_accTrnspt_to_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt); -ftdm_status_t copy_natConInd_to_sngss7(ftdm_channel_t *ftdmchan, SiNatConInd *natConInd); -ftdm_status_t copy_fwdCallInd_hex_from_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd); -ftdm_status_t copy_fwdCallInd_to_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd); -ftdm_status_t copy_txMedReq_to_sngss7(ftdm_channel_t *ftdmchan, SiTxMedReq *txMedReq); -ftdm_status_t copy_usrServInfoA_to_sngss7(ftdm_channel_t *ftdmchan, SiUsrServInfo *usrServInfoA); -ftdm_status_t copy_NatureOfConnection_from_sngss7(ftdm_channel_t *ftdmchan, SiNatConInd *natConInd ); -ftdm_status_t copy_NatureOfConnection_to_sngss7(ftdm_channel_t *ftdmchan, SiNatConInd *natConInd); - -ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); -ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); -ftdm_status_t copy_tknStr_to_sngss7(char* str, TknStr *tknStr, TknU8 *oddEven); - -int check_for_state_change(ftdm_channel_t *ftdmchan); -int check_for_reset(sngss7_chan_data_t *sngss7_info); -ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan); -unsigned long get_unique_id(void); - -ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan); -ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); -ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan); -ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); - -ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan); - -ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info); -ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info); -ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info); -ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info); -ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info); -ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info); -ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info); - -ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int type); -ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int type); - -int find_mtp2_error_type_in_map(const char *err_type); -int find_link_type_in_map(const char *linkType); -int find_switch_type_in_map(const char *switchType); -int find_ssf_type_in_map(const char *ssfType); -int find_cic_cntrl_in_map(const char *cntrlType); - -ftdm_status_t check_status_of_all_isup_intf(void); -ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan); - -void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id); -void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status); -ftdm_status_t sngss7_add_var(sngss7_chan_data_t *ss7_info, const char* var, const char* val); -ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len); - -/* in ftmod_sangoma_ss7_timers.c */ -void handle_isup_t35(void *userdata); -void handle_isup_t10(void *userdata); -void handle_isup_t39(void *userdata); - - -/******************************************************************************/ - -/* MACROS *********************************************************************/ -#define SS7_STATE_CHANGE(ftdmchan, new_state) \ -if (ftdmchan->state == new_state) { \ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); \ -} else { \ - ftdm_set_state(ftdmchan, new_state); \ -} - -#define SS7_DEBUG(a,...) ftdm_log(FTDM_LOG_DEBUG,a , ##__VA_ARGS__ ); -#define SS7_INFO(a,...) ftdm_log(FTDM_LOG_INFO,a , ##__VA_ARGS__ ); -#define SS7_WARN(a,...) ftdm_log(FTDM_LOG_WARNING,a , ##__VA_ARGS__ ); -#define SS7_ERROR(a,...) ftdm_log(FTDM_LOG_ERROR,a , ##__VA_ARGS__ ); -#define SS7_CRITICAL(a,...) ftdm_log(FTDM_LOG_CRIT,a , ##__VA_ARGS__ ); - -#define SS7_DEBUG_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_DEBUG, msg , ##args) -#define SS7_INFO_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_INFO, msg , ##args) -#define SS7_WARN_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_WARNING, msg , ##args) -#define SS7_ERROR_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_ERROR, msg , ##args) -#define SS7_CRIT_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_CRIT, msg , ##args) - -#ifdef SS7_CODE_DEVEL -#define SS7_DEVEL_DEBUG(a,...) ftdm_log(FTDM_LOG_DEBUG,a,##__VA_ARGS__ ); -#else -#define SS7_DEVEL_DEBUG(a,...) -#endif - -#define SS7_FUNC_TRACE_ENTER(a) if (g_ftdm_sngss7_data.function_trace) { \ - switch (g_ftdm_sngss7_data.function_trace_level) { \ - case 0: \ - ftdm_log(FTDM_LOG_EMERG,"Entering %s\n", a); \ - break; \ - case 1: \ - ftdm_log(FTDM_LOG_ALERT,"Entering %s\n", a); \ - break; \ - case 2: \ - ftdm_log(FTDM_LOG_CRIT,"Entering %s\n", a); \ - break; \ - case 3: \ - ftdm_log(FTDM_LOG_ERROR,"Entering %s\n", a); \ - break; \ - case 4: \ - ftdm_log(FTDM_LOG_WARNING,"Entering %s\n", a); \ - break; \ - case 5: \ - ftdm_log(FTDM_LOG_NOTICE,"Entering %s\n", a); \ - break; \ - case 6: \ - ftdm_log(FTDM_LOG_INFO,"Entering %s\n", a); \ - break; \ - case 7: \ - ftdm_log(FTDM_LOG_DEBUG,"Entering %s\n", a); \ - break; \ - default: \ - ftdm_log(FTDM_LOG_INFO,"Entering %s\n", a); \ - break; \ - } /* switch (g_ftdm_sngss7_data.function_trace_level) */ \ - } /* if(g_ftdm_sngss7_data.function_trace) */ - -#define SS7_FUNC_TRACE_EXIT(a) if (g_ftdm_sngss7_data.function_trace) { \ - switch (g_ftdm_sngss7_data.function_trace_level) { \ - case 0: \ - ftdm_log(FTDM_LOG_EMERG,"Exiting %s\n", a); \ - break; \ - case 1: \ - ftdm_log(FTDM_LOG_ALERT,"Exiting %s\n", a); \ - break; \ - case 2: \ - ftdm_log(FTDM_LOG_CRIT,"Exiting %s\n", a); \ - break; \ - case 3: \ - ftdm_log(FTDM_LOG_ERROR,"Exiting %s\n", a); \ - break; \ - case 4: \ - ftdm_log(FTDM_LOG_WARNING,"Exiting %s\n", a); \ - break; \ - case 5: \ - ftdm_log(FTDM_LOG_NOTICE,"Exiting %s\n", a); \ - break; \ - case 6: \ - ftdm_log(FTDM_LOG_INFO,"Exiting %s\n", a); \ - break; \ - case 7: \ - ftdm_log(FTDM_LOG_DEBUG,"Exiting %s\n", a); \ - break; \ - default: \ - ftdm_log(FTDM_LOG_INFO,"Exiting %s\n", a); \ - break; \ - } /* switch (g_ftdm_sngss7_data.function_trace_level) */ \ - } /* if(g_ftdm_sngss7_data.function_trace) */ - -#define SS7_MSG_TRACE(fchan, sngss7info ,msg) if (g_ftdm_sngss7_data.message_trace) { \ - switch (g_ftdm_sngss7_data.message_trace_level) { \ - case 0: \ - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - case 1: \ - ftdm_log_chan(fchan, FTDM_LOG_ALERT, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - case 2: \ - ftdm_log_chan(fchan, FTDM_LOG_CRIT, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - case 3: \ - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - case 4: \ - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - case 5: \ - ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - case 6: \ - ftdm_log_chan(fchan, FTDM_LOG_INFO, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - case 7: \ - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - default: \ - ftdm_log_chan(fchan, FTDM_LOG_INFO, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ - sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ - break; \ - } /* switch (g_ftdm_sngss7_data.message_trace_level) */ \ - } /* if(g_ftdm_sngss7_data.message_trace) */ - -#define sngss7_test_flag(obj, flag) ((obj)->flags & flag) -#define sngss7_clear_flag(obj, flag) ((obj)->flags &= ~(flag)) -#define sngss7_set_flag(obj, flag) ((obj)->flags |= (flag)) - -#define sngss7_test_ckt_flag(obj, flag) ((obj)->ckt_flags & flag) -#define sngss7_clear_ckt_flag(obj, flag) ((obj)->ckt_flags &= ~(flag)) -#define sngss7_set_ckt_flag(obj, flag) ((obj)->ckt_flags |= (flag)) - -#define sngss7_test_ckt_blk_flag(obj, flag) ((obj)->blk_flags & flag) -#define sngss7_clear_ckt_blk_flag(obj, flag) ((obj)->blk_flags &= ~(flag)) -#define sngss7_set_ckt_blk_flag(obj, flag) ((obj)->blk_flags |= (flag)) - -#define sngss7_test_options(obj, option) ((obj)->options & option) -#define sngss7_clear_options(obj, option) ((obj)->options &= ~(option)) -#define sngss7_set_options(obj, option) ((obj)->options |= (option)) - -#define sngss7_tx_block_status_clear(obj) (!sngss7_test_ckt_blk_flag(obj, (FLAG_CKT_MN_BLOCK_TX | \ - FLAG_CKT_MN_BLOCK_TX_DN | \ - FLAG_GRP_MN_BLOCK_TX | \ - FLAG_GRP_MN_BLOCK_TX_DN | \ - FLAG_GRP_HW_BLOCK_TX | \ - FLAG_GRP_HW_BLOCK_TX_DN | \ - FLAG_GRP_HW_UNBLK_TX | \ - FLAG_CKT_MN_UNBLK_TX ))) - -#define sngss7_block_status_clear(obj) (obj->blk_flags == 0) - -#define sngss7_reset_status_clear(obj) (!sngss7_test_ckt_flag(obj, (FLAG_RESET_TX | \ - FLAG_RESET_RX | \ - FLAG_GRP_RESET_TX | \ - FLAG_GRP_RESET_RX ))) - -#define sngss7_tx_reset_sent(obj) ((sngss7_test_ckt_flag(obj, (FLAG_RESET_TX)) && \ - sngss7_test_ckt_flag(obj, (FLAG_RESET_SENT))) || \ - (sngss7_test_ckt_flag(obj, (FLAG_GRP_RESET_TX)) && \ - sngss7_test_ckt_flag(obj, (FLAG_GRP_RESET_SENT)))) - -#define sngss7_tx_reset_status_pending(obj) (sngss7_test_ckt_flag(obj, (FLAG_RESET_TX)) || sngss7_test_ckt_flag(obj, (FLAG_GRP_RESET_TX))) - -#define sngss7_channel_status_clear(obj) ((sngss7_block_status_clear(obj)) && \ - (sngss7_reset_status_clear(obj)) && \ - (!sngss7_test_ckt_flag((obj),FLAG_INFID_PAUSED))) - -#define sngss7_tx_reset_restart(obj) do { clear_tx_grs_flags((obj)); \ - clear_tx_grs_data((obj)); \ - clear_tx_rsc_flags((obj)); \ - sngss7_set_ckt_flag((obj), (FLAG_RESET_TX)); \ - } while (0); - - - -#ifdef SMG_RELAY_DBG -#define SS7_RELAY_DBG(a,...) printf(a"\n", ##__VA_ARGS__) -#define SS7_RELAY_DBG_FUN(a) printf(#a"\n") -#else -#define SS7_RELAY_DBG(a, ...) -#define SS7_RELAY_DBG_FUN(a) -#endif -/******************************************************************************/ - -/******************************************************************************/ -#endif /* __FTMOD_SNG_SS7_H__ */ -/******************************************************************************/ - -/******************************************************************************/ -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ -/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c deleted file mode 100644 index 7c567ab6ea..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ /dev/null @@ -1,1052 +0,0 @@ -/* - * Copyright (c) 2009, Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -#define SNGSS7_EVNTINFO_IND_INBAND_AVAIL 0x03 -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ - -/* FUNCTIONS ******************************************************************/ -void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) -{ - const char *var = NULL; - SiConEvnt iam; - ftdm_bool_t native_going_up = FTDM_FALSE; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - sngss7_event_data_t *event_clone = NULL; - - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_info->suInstId = get_unique_id (); - sngss7_info->spInstId = 0; - sngss7_info->spId = 1; - - memset (&iam, 0x0, sizeof (iam)); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE)) { - ftdm_span_t *peer_span = NULL; - ftdm_channel_t *peer_chan = NULL; - sngss7_chan_data_t *peer_info = NULL; - - var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "sigbridge_peer"); - ftdm_get_channel_from_string(var, &peer_span, &peer_chan); - if (!peer_chan) { - SS7_ERROR_CHAN(ftdmchan, "Failed to find sigbridge peer from string '%s'\n", var); - } else { - if (peer_span->signal_type != FTDM_SIGTYPE_SS7) { - SS7_ERROR_CHAN(ftdmchan, "Peer channel '%s' has different signaling type %d'\n", - var, peer_span->signal_type); - } else { - peer_info = peer_chan->call_data; - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Starting native bridge with peer CIC %d\n", - sngss7_info->circuit->cic, peer_info->circuit->cic); - - /* retrieve only first message from the others guys queue (must be IAM) */ - event_clone = ftdm_queue_dequeue(peer_info->event_queue); - - /* make each one of us aware of the native bridge */ - peer_info->peer_data = sngss7_info; - sngss7_info->peer_data = peer_info; - - /* Go to up until release comes, note that state processing is done different and much simpler when there is a peer, - We can't go to UP state right away yet though, so do not set the state to UP here, wait until the end of this function - because moving from one state to another causes the ftdmchan->usrmsg structure to be wiped - and we still need those variables for further IAM processing */ - native_going_up = FTDM_TRUE; - } - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE)) { - if (!event_clone) { - SS7_ERROR_CHAN(ftdmchan, "No IAM event clone in peer queue!%s\n", ""); - } else if (event_clone->event_id != SNGSS7_CON_IND_EVENT) { - /* first message in the queue should ALWAYS be an IAM */ - SS7_ERROR_CHAN(ftdmchan, "Invalid initial peer message type '%d'\n", event_clone->event_id); - } else { - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM (Bridged, dialing %s)\n", sngss7_info->circuit->cic, caller_data->dnis.digits); - - /* copy original incoming IAM */ - memcpy(&iam, &event_clone->event.siConEvnt, sizeof(iam)); - - /* Change DNIS to whatever was specified, do not change NADI or anything else! */ - copy_tknStr_to_sngss7(caller_data->dnis.digits, &iam.cdPtyNum.addrSig, &iam.cdPtyNum.oddEven); - - /* SPIROU certification hack - If the IAM already contain RDINF, just increment the count and set the RDNIS digits - otherwise, honor RDNIS and RDINF stuff coming from the user */ - if (iam.redirInfo.eh.pres == PRSNT_NODEF) { - const char *val = NULL; - if (iam.redirInfo.redirCnt.pres) { - iam.redirInfo.redirCnt.val++; - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Tx IAM (Bridged), redirect count incremented = %d\n", sngss7_info->circuit->cic, iam.redirInfo.redirCnt.val); - } - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_digits"); - if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Tx IAM (Bridged), found user supplied RDNIS digits = %s\n", sngss7_info->circuit->cic, val); - copy_tknStr_to_sngss7((char*)val, &iam.redirgNum.addrSig, &iam.redirgNum.oddEven); - } else { - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Tx IAM (Bridged), not found user supplied RDNIS digits\n", sngss7_info->circuit->cic); - } - } else { - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Tx IAM (Bridged), redirect info not present, attempting to copy user supplied values\n", sngss7_info->circuit->cic); - /* Redirecting Number */ - copy_redirgNum_to_sngss7(ftdmchan, &iam.redirgNum); - - /* Redirecting Information */ - copy_redirgInfo_to_sngss7(ftdmchan, &iam.redirInfo); - } - - if (iam.origCdNum.eh.pres != PRSNT_NODEF) { - /* Original Called Number */ - copy_ocn_to_sngss7(ftdmchan, &iam.origCdNum); - } - copy_access_transport_to_sngss7(ftdmchan, &iam.accTrnspt); - } - } else if (sngss7_info->circuit->transparent_iam && - sngss7_retrieve_iam(ftdmchan, &iam) == FTDM_SUCCESS) { - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM (Transparent)\n", sngss7_info->circuit->cic); - - /* Called Number information */ - copy_cdPtyNum_to_sngss7(ftdmchan, &iam.cdPtyNum); - - /* Redirecting Number */ - copy_redirgNum_to_sngss7(ftdmchan, &iam.redirgNum); - - /* Redirecting Information */ - copy_redirgInfo_to_sngss7(ftdmchan, &iam.redirInfo); - - /* Location Number information */ - copy_locPtyNum_to_sngss7(ftdmchan, &iam.cgPtyNum1); - - /* Forward Call Indicators */ - copy_fwdCallInd_to_sngss7(ftdmchan, &iam.fwdCallInd); - - /* Original Called Number */ - copy_ocn_to_sngss7(ftdmchan, &iam.origCdNum); - - copy_access_transport_to_sngss7(ftdmchan, &iam.accTrnspt); - - copy_NatureOfConnection_to_sngss7(ftdmchan, &iam.natConInd); - } else { - /* Nature of Connection Indicators */ - copy_natConInd_to_sngss7(ftdmchan, &iam.natConInd); - - /* Forward Call Indicators */ - copy_fwdCallInd_to_sngss7(ftdmchan, &iam.fwdCallInd); - - /* Transmission medium requirements */ - copy_txMedReq_to_sngss7(ftdmchan, &iam.txMedReq); - - if (SNGSS7_SWITCHTYPE_ANSI(g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType)) { - /* User Service Info A */ - copy_usrServInfoA_to_sngss7(ftdmchan, &iam.usrServInfoA); - } - - /* Called Number information */ - copy_cdPtyNum_to_sngss7(ftdmchan, &iam.cdPtyNum); - - /* Calling Number information */ - copy_cgPtyNum_to_sngss7(ftdmchan, &iam.cgPtyNum); - - /* Location Number information */ - copy_locPtyNum_to_sngss7(ftdmchan, &iam.cgPtyNum1); - - /* Generic Number information */ - copy_genNmb_to_sngss7(ftdmchan, &iam.genNmb); - - /* Calling Party's Category */ - copy_cgPtyCat_to_sngss7(ftdmchan, &iam.cgPtyCat); - - /* Redirecting Number */ - copy_redirgNum_to_sngss7(ftdmchan, &iam.redirgNum); - - /* Redirecting Information */ - copy_redirgInfo_to_sngss7(ftdmchan, &iam.redirInfo); - - /* Original Called Number */ - copy_ocn_to_sngss7(ftdmchan, &iam.origCdNum); - - /* Access Transport - old implementation, taking from channel variable of ss7_clg_subaddr */ - copy_accTrnspt_to_sngss7(ftdmchan, &iam.accTrnspt); - - /* Access Transport - taking from channel variable of ss7_access_transport_urlenc. - This will overwirte the IE value set be above old implementation. - */ - copy_access_transport_to_sngss7(ftdmchan, &iam.accTrnspt); - - copy_NatureOfConnection_to_sngss7(ftdmchan, &iam.natConInd); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM clg = \"%s\" (NADI=%d), cld = \"%s\" (NADI=%d), loc = %s (NADI=%d)\n", - sngss7_info->circuit->cic, - ftdmchan->caller_data.cid_num.digits, - iam.cgPtyNum.natAddrInd.val, - ftdmchan->caller_data.dnis.digits, - iam.cdPtyNum.natAddrInd.val, - ftdmchan->caller_data.loc.digits, - iam.cgPtyNum1.natAddrInd.val); - } - - sng_cc_con_request (sngss7_info->spId, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &iam, - 0); - - if (native_going_up) { - /* - Note that this function (ft_to_sngss7_iam) is run within the main SS7 processing loop in - response to the DIALING state handler, we can set the state to UP here and that will - implicitly complete the DIALING state, but we *MUST* also advance the state handler - right away for a native bridge, otherwise, the processing state function (ftdm_sangoma_ss7_process_state_change) - will complete the state without having executed the handler for FTDM_CHANNEL_STATE_UP, and we won't notify - the user sending FTDM_SIGEVENT_UP which can cause the application to misbehave (ie, no audio) */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - ftdm_channel_advance_states(ftdmchan); - } - - ftdm_safe_free(event_clone); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -void ft_to_sngss7_inf(ftdm_channel_t *ftdmchan, SiCnStEvnt *inr) -{ - SiCnStEvnt evnt; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - memset (&evnt, 0x0, sizeof (evnt)); - - evnt.infoInd.eh.pres = PRSNT_NODEF; - evnt.infoInd.cgPtyAddrRespInd.pres = PRSNT_NODEF; - evnt.infoInd.cgPtyCatRespInd.pres = PRSNT_NODEF; - - evnt.infoInd.chrgInfoRespInd.pres = PRSNT_NODEF; - evnt.infoInd.chrgInfoRespInd.val = 0; - evnt.infoInd.solInfoInd.pres = PRSNT_NODEF; - evnt.infoInd.solInfoInd.val = 0; - evnt.infoInd.holdProvInd.pres = PRSNT_NODEF; - evnt.infoInd.holdProvInd.val = 0; - evnt.infoInd.spare.pres = PRSNT_NODEF; - evnt.infoInd.spare.val = 0; - - if (inr->infoReqInd.eh.pres == PRSNT_NODEF) { - if ((inr->infoReqInd.holdingInd.pres == PRSNT_NODEF) && (inr->infoReqInd.holdingInd.val == HOLD_REQ)) { - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Received INR requesting holding information. Holding is not supported in INF.\n", sngss7_info->circuit->cic); - } - if ((inr->infoReqInd.chrgInfoReqInd.pres == PRSNT_NODEF) && (inr->infoReqInd.chrgInfoReqInd.val == CHRGINFO_REQ)) { - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Received INR requesting charging information. Charging is not supported in INF.\n", sngss7_info->circuit->cic); - } - if ((inr->infoReqInd.malCaIdReqInd.pres == PRSNT_NODEF) && (inr->infoReqInd.malCaIdReqInd.val == CHRGINFO_REQ)) { - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Received INR requesting malicious call id. Malicious call id is not supported in INF.\n", sngss7_info->circuit->cic); - } - - if ((inr->infoReqInd.cgPtyAdReqInd.pres == PRSNT_NODEF) && (inr->infoReqInd.cgPtyAdReqInd.val == CGPRTYADDREQ_REQ)) { - evnt.infoInd.cgPtyAddrRespInd.val=CGPRTYADDRESP_INCL; - copy_cgPtyNum_to_sngss7 (ftdmchan, &evnt.cgPtyNum); - } else { - evnt.infoInd.cgPtyAddrRespInd.val=CGPRTYADDRESP_NOTINCL; - } - - if ((inr->infoReqInd.cgPtyCatReqInd.pres == PRSNT_NODEF) && (inr->infoReqInd.cgPtyCatReqInd.val == CGPRTYCATREQ_REQ)) { - evnt.infoInd.cgPtyCatRespInd.val = CGPRTYCATRESP_INCL; - copy_cgPtyCat_to_sngss7 (ftdmchan, &evnt.cgPtyCat); - } else { - evnt.infoInd.cgPtyCatRespInd.val = CGPRTYCATRESP_NOTINCL; - } - } - else { - SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Received INR with no information request. Sending back default INF.\n", sngss7_info->circuit->cic); - } - - sng_cc_inf(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &evnt, - INFORMATION); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx INF\n", sngss7_info->circuit->cic); - -} - -void ft_to_sngss7_inr(ftdm_channel_t *ftdmchan) -{ - SiCnStEvnt evnt; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - memset (&evnt, 0x0, sizeof (evnt)); - - evnt.infoReqInd.eh.pres = PRSNT_NODEF; - evnt.infoReqInd.cgPtyAdReqInd.pres = PRSNT_NODEF; - evnt.infoReqInd.cgPtyAdReqInd.val=CGPRTYADDREQ_REQ; - - evnt.infoReqInd.holdingInd.pres = PRSNT_NODEF; - evnt.infoReqInd.holdingInd.val = HOLD_REQ; - - evnt.infoReqInd.cgPtyCatReqInd.pres = PRSNT_NODEF; - evnt.infoReqInd.cgPtyCatReqInd.val = CGPRTYCATREQ_REQ; - - evnt.infoReqInd.chrgInfoReqInd.pres = PRSNT_NODEF; - evnt.infoReqInd.chrgInfoReqInd.val = CHRGINFO_REQ; - - evnt.infoReqInd.malCaIdReqInd.pres = PRSNT_NODEF; - evnt.infoReqInd.malCaIdReqInd.val = MLBG_INFOREQ; - - sng_cc_inr(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &evnt, - INFORMATREQ); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx INR\n", sngss7_info->circuit->cic); -} - -void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiCnStEvnt acm; - const char *backwardInd = NULL; - - memset (&acm, 0x0, sizeof (acm)); - - /* fill in the needed information for the ACM */ - acm.bckCallInd.eh.pres = PRSNT_NODEF; - acm.bckCallInd.chrgInd.pres = PRSNT_NODEF; - acm.bckCallInd.chrgInd.val = CHRG_CHRG; - acm.bckCallInd.cadPtyStatInd.pres = PRSNT_NODEF; - acm.bckCallInd.cadPtyStatInd.val = 0x01; - acm.bckCallInd.cadPtyCatInd.pres = PRSNT_NODEF; - acm.bckCallInd.cadPtyCatInd.val = CADCAT_ORDSUBS; - acm.bckCallInd.end2EndMethInd.pres = PRSNT_NODEF; - acm.bckCallInd.end2EndMethInd.val = E2EMTH_NOMETH; - acm.bckCallInd.intInd.pres = PRSNT_NODEF; - acm.bckCallInd.intInd.val = INTIND_NOINTW; - acm.bckCallInd.end2EndInfoInd.pres = PRSNT_NODEF; - acm.bckCallInd.end2EndInfoInd.val = E2EINF_NOINFO; - - acm.bckCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - acm.bckCallInd.isdnUsrPrtInd.val = ISUP_NOTUSED; - backwardInd = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "acm_bi_iup"); - if (!ftdm_strlen_zero(backwardInd)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied backward indicator ISDN user part indicator ACM, value \"%s\"\n", backwardInd); - if (atoi(backwardInd) != 0 ) { - acm.bckCallInd.isdnUsrPrtInd.val = ISUP_USED; - } - } - acm.bckCallInd.holdInd.pres = PRSNT_NODEF; - acm.bckCallInd.holdInd.val = HOLD_NOTREQD; - acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF; - acm.bckCallInd.isdnAccInd.val = ISDNACC_NONISDN; - acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF; - switch (ftdmchan->caller_data.bearer_capability) { - /**********************************************************************/ - case (FTDM_BEARER_CAP_SPEECH): - acm.bckCallInd.echoCtrlDevInd.val = 0x1; - break; - /**********************************************************************/ - case (FTDM_BEARER_CAP_UNRESTRICTED): - acm.bckCallInd.echoCtrlDevInd.val = 0x0; - break; - /**********************************************************************/ - case (FTDM_BEARER_CAP_3_1KHZ_AUDIO): - acm.bckCallInd.echoCtrlDevInd.val = 0x1; - break; - /**********************************************************************/ - default: - SS7_ERROR_CHAN(ftdmchan, "Unknown Bearer capability falling back to speech%s\n", " "); - acm.bckCallInd.echoCtrlDevInd.val = 0x1; - break; - /**********************************************************************/ - } /* switch (ftdmchan->caller_data.bearer_capability) */ - acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; - acm.bckCallInd.sccpMethInd.val = SCCPMTH_NOIND; - - /* fill in any optional parameters */ - if (sngss7_test_options(&g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id], SNGSS7_ACM_OBCI_BITA)) { - SS7_DEBUG_CHAN(ftdmchan, "Found ACM_OBCI_BITA flag:0x%X\n", g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].options); - acm.optBckCalInd.eh.pres = PRSNT_NODEF; - acm.optBckCalInd.inbndInfoInd.pres = PRSNT_NODEF; - acm.optBckCalInd.inbndInfoInd.val = 0x1; - acm.optBckCalInd.caFwdMayOcc.pres = PRSNT_DEF; - acm.optBckCalInd.simpleSegmInd.pres = PRSNT_DEF; - acm.optBckCalInd.mlppUserInd.pres = PRSNT_DEF; - acm.optBckCalInd.usrNetIneractInd.pres = PRSNT_DEF; - acm.optBckCalInd.netExcDelInd.pres = PRSNT_DEF; - } /* if (sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA)) */ - - /* send the ACM request to LibSngSS7 */ - sng_cc_con_status (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &acm, - ADDRCMPLT); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ACM\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -void ft_to_sngss7_cpg (ftdm_channel_t *ftdmchan) -{ - SiCnStEvnt cpg; - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - - memset (&cpg, 0, sizeof (cpg)); - - cpg.evntInfo.eh.pres = PRSNT_NODEF; - - cpg.evntInfo.evntInd.pres = PRSNT_NODEF; - cpg.evntInfo.evntInd.val = SNGSS7_EVNTINFO_IND_INBAND_AVAIL; /* Event Indicator = In-band info is now available */ - - cpg.evntInfo.evntPresResInd.pres = PRSNT_NODEF; - cpg.evntInfo.evntPresResInd.val = 0; /* Event presentation restricted indicator = no indication */ - - /* send the CPG request to LibSngSS7 */ - sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &cpg, PROGRESS); - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "[CIC:%d]Tx CPG\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} -void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiConEvnt anm; - - memset (&anm, 0x0, sizeof (anm)); - - /* send the ANM request to LibSngSS7 */ - sng_cc_con_response(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &anm, - 5); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ANM\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan) -{ - const char *loc_ind = NULL; - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiRelEvnt rel; - - memset (&rel, 0x0, sizeof (rel)); - - rel.causeDgn.eh.pres = PRSNT_NODEF; - rel.causeDgn.location.pres = PRSNT_NODEF; - - loc_ind = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rel_loc"); - if (!ftdm_strlen_zero(loc_ind)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied location indicator in REL, value \"%s\"\n", loc_ind); - rel.causeDgn.location.val = atoi(loc_ind); - } else { - rel.causeDgn.location.val = 0x01; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied location indicator in REL, using 0x01\"%s\"\n", ""); - } - rel.causeDgn.cdeStand.pres = PRSNT_NODEF; - rel.causeDgn.cdeStand.val = 0x00; - rel.causeDgn.recommend.pres = NOTPRSNT; - rel.causeDgn.causeVal.pres = PRSNT_NODEF; - rel.causeDgn.causeVal.val = (uint8_t) ftdmchan->caller_data.hangup_cause; - rel.causeDgn.dgnVal.pres = NOTPRSNT; - - /* send the REL request to LibSngSS7 */ - sng_cc_rel_request (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &rel); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx REL cause=%d \n", - sngss7_info->circuit->cic, - ftdmchan->caller_data.hangup_cause ); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiRelEvnt rlc; - - memset (&rlc, 0x0, sizeof (rlc)); - - /* send the RLC request to LibSngSS7 */ - sng_cc_rel_response (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &rlc); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RLC\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRRESREQ, - NULL); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRRESRSP, - NULL); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC-RLC\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request (1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRBLOREQ, - NULL); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLO\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request (1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRBLORSP, - NULL); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLA\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void -ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request (1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRUBLREQ, - NULL); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBL\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request (1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRUBLRSP, - NULL); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBA\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request (1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_LOOPBACKACK, - NULL); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx LPA\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); -return; -} - -/******************************************************************************/ -void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiStaEvnt gra; - - /* clean out the gra struct */ - memset (&gra, 0x0, sizeof (gra)); - - gra.rangStat.eh.pres = PRSNT_NODEF; - - /* fill in the range */ - gra.rangStat.range.pres = PRSNT_NODEF; - gra.rangStat.range.val = sngss7_info->rx_grs.range; - - /* fill in the status */ - gra.rangStat.status.pres = PRSNT_NODEF; - gra.rangStat.status.len = ((sngss7_info->rx_grs.range + 1) >> 3) + (((sngss7_info->rx_grs.range + 1) & 0x07) ? 1 : 0); - - /* the status field should be 1 if blocked for maintenace reasons - * and 0 is not blocked....since we memset the struct nothing to do - */ - - /* send the GRA to LibSng-SS7 */ - sng_cc_sta_request (1, - 0, - 0, - sngss7_info->rx_grs.circuit, - 0, - SIT_STA_GRSRSP, - &gra); - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Tx GRA (%d:%d)\n", - sngss7_info->circuit->cic, - sngss7_info->circuit->cic, - (sngss7_info->circuit->cic + sngss7_info->rx_grs.range)); - - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_grs (ftdm_channel_t *fchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_chan_data_t *cinfo = fchan->call_data; - - SiStaEvnt grs; - - ftdm_assert(sngss7_test_ckt_flag(cinfo, FLAG_GRP_RESET_TX) && - !sngss7_test_ckt_flag(cinfo, FLAG_GRP_RESET_SENT), "Incorrect flags\n"); - - memset (&grs, 0x0, sizeof(grs)); - grs.rangStat.eh.pres = PRSNT_NODEF; - grs.rangStat.range.pres = PRSNT_NODEF; - grs.rangStat.range.val = cinfo->tx_grs.range; - - sng_cc_sta_request (1, - 0, - 0, - cinfo->tx_grs.circuit, - 0, - SIT_STA_GRSREQ, - &grs); - - SS7_INFO_CHAN(fchan, "[CIC:%d]Tx GRS (%d:%d)\n", - cinfo->circuit->cic, - cinfo->circuit->cic, - (cinfo->circuit->cic + cinfo->tx_grs.range)); - - sngss7_set_ckt_flag(cinfo, FLAG_GRP_RESET_SENT); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); -} - -/******************************************************************************/ -void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - int x = 0; - - SiStaEvnt cgba; - - memset (&cgba, 0x0, sizeof(cgba)); - - /* fill in the circuit group supervisory message */ - cgba.cgsmti.eh.pres = PRSNT_NODEF; - cgba.cgsmti.typeInd.pres = PRSNT_NODEF; - cgba.cgsmti.typeInd.val = sngss7_span->rx_cgb.type; - - cgba.rangStat.eh.pres = PRSNT_NODEF; - /* fill in the range */ - cgba.rangStat.range.pres = PRSNT_NODEF; - cgba.rangStat.range.val = sngss7_span->rx_cgb.range; - /* fill in the status */ - cgba.rangStat.status.pres = PRSNT_NODEF; - cgba.rangStat.status.len = ((sngss7_span->rx_cgb.range + 1) >> 3) + (((sngss7_span->rx_cgb.range + 1) & 0x07) ? 1 : 0); - for(x = 0; x < cgba.rangStat.status.len; x++){ - cgba.rangStat.status.val[x] = sngss7_span->rx_cgb.status[x]; - } - - sng_cc_sta_request (1, - 0, - 0, - sngss7_span->rx_cgb.circuit, - 0, - SIT_STA_CGBRSP, - &cgba); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx CGBA (%d:%d)\n", - sngss7_info->circuit->cic, - sngss7_info->circuit->cic, - (sngss7_info->circuit->cic + sngss7_span->rx_cgb.range)); - - /* clean out the saved data */ - memset(&sngss7_span->rx_cgb, 0x0, sizeof(sngss7_group_data_t)); - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - int x = 0; - - SiStaEvnt cgua; - - memset (&cgua, 0x0, sizeof(cgua)); - - /* fill in the circuit group supervisory message */ - cgua.cgsmti.eh.pres = PRSNT_NODEF; - cgua.cgsmti.typeInd.pres = PRSNT_NODEF; - cgua.cgsmti.typeInd.val = sngss7_span->rx_cgu.type; - - cgua.rangStat.eh.pres = PRSNT_NODEF; - /* fill in the range */ - cgua.rangStat.range.pres = PRSNT_NODEF; - cgua.rangStat.range.val = sngss7_span->rx_cgu.range; - /* fill in the status */ - cgua.rangStat.status.pres = PRSNT_NODEF; - cgua.rangStat.status.len = ((sngss7_span->rx_cgu.range + 1) >> 3) + (((sngss7_span->rx_cgu.range + 1) & 0x07) ? 1 : 0); - for(x = 0; x < cgua.rangStat.status.len; x++){ - cgua.rangStat.status.val[x] = sngss7_span->rx_cgu.status[x]; - } - - sng_cc_sta_request (1, - 0, - 0, - sngss7_span->rx_cgu.circuit, - 0, - SIT_STA_CGURSP, - &cgua); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx CGUA (%d:%d)\n", - sngss7_info->circuit->cic, - sngss7_info->circuit->cic, - (sngss7_info->circuit->cic + sngss7_span->rx_cgu.range)); - - /* clean out the saved data */ - memset(&sngss7_span->rx_cgu, 0x0, sizeof(sngss7_group_data_t)); - - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiStaEvnt cgb; - int x = 0; - - - memset (&cgb, 0x0, sizeof(cgb)); - - /* fill in the circuit group supervisory message */ - cgb.cgsmti.eh.pres = PRSNT_NODEF; - cgb.cgsmti.typeInd.pres = PRSNT_NODEF; - cgb.cgsmti.typeInd.val = sngss7_span->tx_cgb.type; - - /* fill in the range */ - cgb.rangStat.eh.pres = PRSNT_NODEF; - cgb.rangStat.range.pres = PRSNT_NODEF; - cgb.rangStat.range.val = sngss7_span->tx_cgb.range; - - /* fill in the status */ - cgb.rangStat.status.pres = PRSNT_NODEF; - cgb.rangStat.status.len = ((sngss7_span->tx_cgb.range + 1) >> 3) + (((sngss7_span->tx_cgb.range + 1) & 0x07) ? 1 : 0); - for(x = 0; x < cgb.rangStat.status.len; x++){ - cgb.rangStat.status.val[x] = sngss7_span->tx_cgb.status[x]; - } - - sng_cc_sta_request (1, - 0, - 0, - sngss7_span->tx_cgb.circuit, - 0, - SIT_STA_CGBREQ, - &cgb); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx CGB (%d:%d)\n", - sngss7_info->circuit->cic, - sngss7_info->circuit->cic, - (sngss7_info->circuit->cic + sngss7_span->tx_cgb.range)); - - /* clean out the saved data */ - memset(&sngss7_span->tx_cgb, 0x0, sizeof(sngss7_group_data_t)); - - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) -{ - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiStaEvnt cgu; - int x = 0; - - - memset (&cgu, 0x0, sizeof(cgu)); - - /* fill in the circuit group supervisory message */ - cgu.cgsmti.eh.pres = PRSNT_NODEF; - cgu.cgsmti.typeInd.pres = PRSNT_NODEF; - cgu.cgsmti.typeInd.val = sngss7_span->tx_cgu.type; - - /* fill in the range */ - cgu.rangStat.eh.pres = PRSNT_NODEF; - cgu.rangStat.range.pres = PRSNT_NODEF; - cgu.rangStat.range.val = sngss7_span->tx_cgu.range; - - /* fill in the status */ - cgu.rangStat.status.pres = PRSNT_NODEF; - cgu.rangStat.status.len = ((sngss7_span->tx_cgu.range + 1) >> 3) + (((sngss7_span->tx_cgu.range + 1) & 0x07) ? 1 : 0); - for(x = 0; x < cgu.rangStat.status.len; x++){ - cgu.rangStat.status.val[x] = sngss7_span->tx_cgu.status[x]; - } - - sng_cc_sta_request (1, - 0, - 0, - sngss7_span->tx_cgu.circuit, - 0, - SIT_STA_CGUREQ, - &cgu); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx CGU (%d:%d)\n", - sngss7_info->circuit->cic, - sngss7_info->circuit->cic, - (sngss7_info->circuit->cic + sngss7_span->tx_cgu.range)); - - /* clean out the saved data */ - memset(&sngss7_span->tx_cgu, 0x0, sizeof(sngss7_group_data_t)); - - - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/* French SPIROU send Charge Unit */ -/* No one calls this function yet, but it has been implemented to complement TXA messages */ -void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) -{ -#ifndef SANGOMA_SPIROU - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "ITX message not supported!, please update your libsng_ss7\n"); -#else - const char* var = NULL; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiCnStEvnt itx; - - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - memset (&itx, 0x0, sizeof (itx)); - - itx.msgNum.eh.pres = PRSNT_NODEF; - itx.msgNum.msgNum.pres = PRSNT_NODEF; - var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_msg_num"); - if (!ftdm_strlen_zero(var)) { - itx.msgNum.msgNum.val = atoi(var); - } else { - itx.msgNum.msgNum.val = 0x1; - } - - itx.chargUnitNum.eh.pres = PRSNT_NODEF; - itx.chargUnitNum.chargUnitNum.pres = PRSNT_NODEF; - var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_charge_unit"); - if (!ftdm_strlen_zero(var)) { - itx.chargUnitNum.chargUnitNum.val = atoi(var); - } else { - itx.chargUnitNum.chargUnitNum.val = 0x1; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "ITX Charging Unit:%d Msg Num:%d\n", itx.chargUnitNum.chargUnitNum.val, itx.msgNum.msgNum.val); - sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &itx, CHARGE_UNIT); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ITX\n", sngss7_info->circuit->cic); -#endif - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/* French SPIROU send Charging Acknowledgement */ -void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan) -{ -#ifndef SANGOMA_SPIROU - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "TXA message not supported!, please update your libsng_ss7\n"); -#else - SiCnStEvnt txa; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SS7_FUNC_TRACE_ENTER (__FTDM_FUNC__); - - memset (&txa, 0x0, sizeof(txa)); - - sng_cc_con_status(1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &txa, CHARGE_ACK); - - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx TXA\n", sngss7_info->circuit->cic); -#endif - SS7_FUNC_TRACE_EXIT (__FTDM_FUNC__); - return; -} - -/******************************************************************************/ -/* 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c deleted file mode 100644 index 8389e56950..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (c) 2009|Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms|with or without - * modification|are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice|this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice|this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT - * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL, - * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ - -/*static ftdm_status_t enable_all_ckts_for_relay(void);*/ -static ftdm_status_t reconfig_all_ckts_for_relay(void); -static ftdm_status_t disable_all_ckts_for_relay(void); -static ftdm_status_t block_all_ckts_for_relay(uint32_t procId); -/* static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId); */ -static ftdm_status_t disable_all_sigs_for_relay(uint32_t procId); -static ftdm_status_t disble_all_mtp2_sigs_for_relay(void); -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ -ftdm_status_t handle_relay_connect(RyMngmt *sta) -{ - sng_relay_t *sng_relay = &g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id]; - - if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) { - /* SS7_INFO("Relay Channel %d initial connection UP\n", sng_relay->id); */ - sngss7_set_flag(sng_relay, SNGSS7_RELAY_INIT); - } - - SS7_INFO("Relay Channel %d connection UP\n", sng_relay->id); - if (sng_relay->type == LRY_CT_TCP_CLIENT) { - if (reconfig_all_ckts_for_relay()) { - SS7_ERROR("Failed to reconfigure ISUP Ckts!\n"); - /* we're done....this is very bad! */ - } - return FTDM_SUCCESS; - } else if (sng_relay->type == LRY_CT_TCP_SERVER) { - ftmod_ss7_enable_grp_mtp3Link(sta->t.usta.s.ryUpUsta.id); - /* unbloock the ckts on the client system */ - return FTDM_SUCCESS; - } - return FTDM_FAIL; -} - -/******************************************************************************/ -ftdm_status_t handle_relay_disconnect_on_error(RyMngmt *sta) -{ - SS7_DEBUG("SS7 relay disconnect on error\n"); - - /* check which procId is in error, if it is 1, disable the ckts */ - if (sta->t.usta.s.ryErrUsta.errPid == 1 ) { - /* we've lost the server, bring the sig status down on all ckts */ - disable_all_ckts_for_relay(); - - /* we've lost the server, bring down the mtp2 links */ - disble_all_mtp2_sigs_for_relay(); - } - - /* check if the channel is a server, means we just lost a MGW */ - if (g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryErrUsta.errPid].type == LRY_CT_TCP_SERVER) { - /* we've lost the client, bring down all the ckts for this procId */ - block_all_ckts_for_relay(sta->t.usta.s.ryErrUsta.errPid); - - /* we've lost the client, bring down all mtp3 links for this procId */ - disable_all_sigs_for_relay(sta->t.usta.s.ryErrUsta.errPid); - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t handle_relay_disconnect_on_down(RyMngmt *sta) -{ - - SS7_DEBUG("SS7 relay disconnect on down\n"); - - /* check if the channel is a server, means we just lost a MGW */ - if (g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id].type == LRY_CT_TCP_SERVER) { - block_all_ckts_for_relay(sta->t.usta.s.ryUpUsta.id); - - disable_all_sigs_for_relay(sta->t.usta.s.ryUpUsta.id); - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t disable_all_ckts_for_relay(void) -{ - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int x; - - SS7_INFO("Disabling all ckts becuase of Relay loss\n"); - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - /**********************************************************************/ - /* make sure this is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCkt[x].id, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", g_ftdm_sngss7_data.cfg.isupCkt[x].id); - x++; - continue; - } - - /* throw the relay_down flag */ - sngss7_set_ckt_flag(sngss7_info, FLAG_RELAY_DOWN); - - /* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */ - - /* move along */ - x++; - /**********************************************************************/ - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ - - return FTDM_SUCCESS; -} -#if 0 -/******************************************************************************/ -ftdm_status_t enable_all_ckts_for_relay(void) -{ - sngss7_chan_data_t *sngss7_info = NULL; - sng_isup_inf_t *sngIntf = NULL; - ftdm_channel_t *ftdmchan = NULL; - int x; - - SS7_INFO("Enabling all ckts becuase of Relay connection\n"); - - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - /**********************************************************************/ - /* make sure this is voice channel */ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCkt[x].id, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", g_ftdm_sngss7_data.cfg.isupCkt[x].id); - x++; - continue; - } - - /* bring the relay_down flag down */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_RELAY_DOWN); - - sngIntf = &g_ftdm_sngss7_data.cfg.isupIntf[g_ftdm_sngss7_data.cfg.isupCkt[x].infId]; - - /* check if the interface is paused or resumed */ - if (sngss7_test_flag(sngIntf, SNGSS7_PAUSED)) { - /* don't bring the channel resume flag up...the interface is down */ - SS7_DEBUG_CHAN(ftdmchan, "ISUP interface (%d) set to paused, not resuming channel\n", sngIntf->id); - } else { - SS7_DEBUG_CHAN(ftdmchan, "ISUP interface (%d) set to resume, resuming channel\n", sngIntf->id); - /* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */ - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - } - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */ - - /* move along */ - x++; - /**********************************************************************/ - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ - - return FTDM_SUCCESS; -} -#endif -/******************************************************************************/ -ftdm_status_t reconfig_all_ckts_for_relay(void) -{ - int x; - sngss7_chan_data_t *sngss7_info = NULL; - - /* go through all the circuits on our ProcId */ - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - /**************************************************************************/ - if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - /* grab the private data structure */ - sngss7_info = g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - - /* mark the circuit for re-configuration */ - sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG); - - /* clear the relay flag */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_RELAY_DOWN); - } - - /* move to the next circuit */ - x++; - /**************************************************************************/ - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t block_all_ckts_for_relay(uint32_t procId) -{ - int x; - int ret; - - /* we just lost connection to this procId, send out a block for all these circuits */ - x = (procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - /**************************************************************************/ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - /* send a block request via stack manager */ - ret = ftmod_ss7_block_isup_ckt_nowait(g_ftdm_sngss7_data.cfg.isupCkt[x].id); - if (ret) { - SS7_INFO("Successfully BLOcked CIC:%d(ckt:%d) due to Relay failure\n", - g_ftdm_sngss7_data.cfg.isupCkt[x].cic, - g_ftdm_sngss7_data.cfg.isupCkt[x].id); - } else { - SS7_ERROR("Failed to BLOck CIC:%d(ckt:%d) due to Relay failure\n", - g_ftdm_sngss7_data.cfg.isupCkt[x].cic, - g_ftdm_sngss7_data.cfg.isupCkt[x].id); - } - - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */ - - /* move along */ - x++; - /**************************************************************************/ - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t disable_all_sigs_for_relay(uint32_t procId) -{ - SS7_INFO("Disalbing all sig links on ProcID = %d\n", procId); - - ftmod_ss7_disable_grp_mtp3Link(procId); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t disble_all_mtp2_sigs_for_relay(void) -{ - /* check if there is a local mtp2 link*/ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED)) { - SS7_INFO("Disalbing all mtp2 sig links on local system\n"); - - ftmod_ss7_disable_grp_mtp2Link(1); - } - - return FTDM_SUCCESS; - -} - -#if 0 -/******************************************************************************/ -static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId) -{ - int x; - int ret; - - /* we just got connection to this procId, send out a unblock for all these circuits - * since we blocked them when we lost the connection - */ - x = (procId * 1000) + 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - /**************************************************************************/ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { - - /* send a block request via stack manager */ - ret = ftmod_ss7_unblock_isup_ckt(g_ftdm_sngss7_data.cfg.isupCkt[x].id); - if (ret) { - SS7_INFO("Successfully unblocked CIC:%d(ckt:%d) due to Relay connection\n", - g_ftdm_sngss7_data.cfg.isupCkt[x].cic, - g_ftdm_sngss7_data.cfg.isupCkt[x].id); - } else { - SS7_ERROR("Failed to unblock CIC:%d(ckt:%d) due to Relay connection\n", - g_ftdm_sngss7_data.cfg.isupCkt[x].cic, - g_ftdm_sngss7_data.cfg.isupCkt[x].id); - } - - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */ - - /* move along */ - x++; - /**************************************************************************/ - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ - - return FTDM_SUCCESS; -} -#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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c deleted file mode 100644 index d9e1790da0..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2009 Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms|with or without - * modification|are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice|this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice|this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT - * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL, - * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -int ftmod_ss7_mtp1link_sta(uint32_t id, L1Mngmt *cfm); -int ftmod_ss7_mtp2link_sta(uint32_t id, SdMngmt *cfm); -int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm); -int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm); -int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status); -int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm); -int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state); -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ -int ftmod_ss7_mtp1link_sta(uint32_t id, L1Mngmt *cfm) -{ - - return 1; -} - -/******************************************************************************/ -int ftmod_ss7_mtp2link_sta(uint32_t id, SdMngmt *cfm) -{ - SdMngmt sta; - Pst pst; - - memset(&sta, 0x0, sizeof(sta)); - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSD; - - sta.hdr.elmId.elmnt = STDLSAP; - sta.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp2Link[id].id; - - return(sng_sta_mtp2(&pst, &sta, cfm)); -} - -/******************************************************************************/ -int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm) -{ - SnMngmt sta; - Pst pst; - - memset(&sta, 0x0, sizeof(sta)); - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* check the for the correct ProcId and make sure it goes to the right system */ - if (g_ftdm_sngss7_data.cfg.procId != 1) { - pst.dstProcId = 1; - } - - sta.hdr.elmId.elmnt = STDLSAP; - sta.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtp3Link[id].id; - - return(sng_sta_mtp3(&pst, &sta, cfm)); -} - -/******************************************************************************/ -int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm) -{ - SnMngmt sta; - Pst pst; - - memset(&sta, 0x0, sizeof(sta)); - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSN; - - /* check the for the correct ProcId and make sure it goes to the right system */ - if (g_ftdm_sngss7_data.cfg.procId != 1) { - pst.dstProcId = 1; - } - - sta.hdr.elmId.elmnt = STLNKSET; - sta.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; - sta.hdr.elmId.elmntInst2 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].links[0]; - - return(sng_sta_mtp3(&pst, &sta, cfm)); -} - -/******************************************************************************/ -int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status) -{ - SiMngmt sta; - SiMngmt cfm; - Pst pst; - int ret; - - memset(&sta, 0x0, sizeof(sta)); - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /* check the for the correct ProcId and make sure it goes to the right system */ - if (g_ftdm_sngss7_data.cfg.procId != 1) { - pst.dstProcId = 1; - } - - /* request the status of an inftId */ - sta.hdr.entId.ent = ENTSI; - sta.hdr.entId.inst = S_INST; - sta.hdr.msgType = TSSTA; - sta.hdr.elmId.elmnt = SI_STINTF; - - sta.t.ssta.elmntId.intfId = id; - - ret = sng_sta_isup(&pst, &sta, &cfm); - - *status = cfm.t.ssta.cfm.s.intf.state; - - return(ret); -} - -/******************************************************************************/ -int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm) -{ - RyMngmt sta; - Pst pst; - - memset(&sta, 0x0, sizeof(sta)); - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTRY; - - sta.hdr.entId.ent = ENTRY; - sta.hdr.entId.inst = S_INST; - sta.hdr.msgType = TSSTA; - sta.hdr.elmId.elmnt = STCHSTA; - sta.hdr.elmId.elmntInst1 = id; - - - return(sng_sta_relay(&pst, &sta, cfm)); -} - -/******************************************************************************/ -int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state) -{ - SiMngmt sta; - SiMngmt cfm; - Pst pst; - int ret; - - memset(&sta, 0x0, sizeof(sta)); - - /* initalize the post structure */ - smPstInit(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTSI; - - /* check the for the correct ProcId and make sure it goes to the right system */ - if (g_ftdm_sngss7_data.cfg.procId != 1) { - pst.dstProcId = 1; - } - - /* request the status of an inftId */ - sta.hdr.entId.ent = ENTSI; - sta.hdr.entId.inst = S_INST; - sta.hdr.msgType = TSSTA; - sta.hdr.elmId.elmnt = SI_STCIRGRP; - - sta.t.ssta.elmntId.circuit = id; - sta.t.ssta.param.cirgr.range = 1; - - ret = sng_sta_isup(&pst, &sta, &cfm); - - *state = cfm.t.ssta.cfm.s.cir.state[0]; - - return(ret); -} - -/******************************************************************************/ -/* 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c deleted file mode 100644 index 257ccd943a..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2009 Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms|with or without - * modification|are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice|this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice|this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES|INCLUDING|BUT NOT - * LIMITED TO|THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT|INDIRECT|INCIDENTAL|SPECIAL, - * EXEMPLARY|OR CONSEQUENTIAL DAMAGES (INCLUDING|BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE|DATA|OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY|WHETHER IN CONTRACT|STRICT LIABILITY|OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ -/******************************************************************************/ - -/******************************************************************************/ -/* 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c deleted file mode 100644 index 42f1ca82da..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ /dev/null @@ -1,3415 +0,0 @@ -/* - * Copyright (c) 2009, Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -#ifdef HAVE_ZLIB -#include -#endif -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -uint32_t sngss7_id; -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -int check_for_state_change(ftdm_channel_t *ftdmchan); -int check_for_reset(sngss7_chan_data_t *sngss7_info); - -unsigned long get_unique_id(void); - -ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan); - -ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan); -ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); -ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan); -ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); - -ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan); - -ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int type); -ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int type); - -int find_mtp2_error_type_in_map(const char *err_type); -int find_link_type_in_map(const char *linkType); -int find_switch_type_in_map(const char *switchType); -int find_ssf_type_in_map(const char *ssfType); -int find_cic_cntrl_in_map(const char *cntrlType); - -ftdm_status_t check_status_of_all_isup_intf(void); -ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan); - -void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id); -void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status); -ftdm_status_t sngss7_add_var(sngss7_chan_data_t *ss7_info, const char* var, const char* val); -ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len); -/******************************************************************************/ - -FTDM_ENUM_NAMES(CKT_FLAGS_NAMES, CKT_FLAGS_STRING) -FTDM_STR2ENUM(ftmod_ss7_ckt_state2flag, ftmod_ss7_ckt_flag2str, sng_ckt_flag_t, CKT_FLAGS_NAMES, 31) - -FTDM_ENUM_NAMES(BLK_FLAGS_NAMES, BLK_FLAGS_STRING) -FTDM_STR2ENUM(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t, BLK_FLAGS_NAMES, 31) - -/* FUNCTIONS ******************************************************************/ -static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t default_val); -static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val); -ftdm_status_t four_char_to_hex(const char* in, uint16_t* out) ; -ftdm_status_t hex_to_four_char(uint16_t in, char* out); - - -ftdm_status_t hex_to_char(uint16_t in, char* out, int len); -ftdm_status_t char_to_hex(const char* in, uint16_t* out, int len); - -/* Maps generic FreeTDM CPC codes to SS7 CPC codes */ -ftdm2trillium_t cpc_codes[] = { - {FTDM_CPC_UNKNOWN, CAT_UNKNOWN}, - {FTDM_CPC_OPERATOR_FRENCH, CAT_OPLANGFR}, - {FTDM_CPC_OPERATOR_ENGLISH, CAT_OPLANGENG}, - {FTDM_CPC_OPERATOR_GERMAN, CAT_OPLANGGER}, - {FTDM_CPC_OPERATOR_RUSSIAN, CAT_OPLANGRUS}, - {FTDM_CPC_OPERATOR_SPANISH, CAT_OPLANGSP}, - {FTDM_CPC_ORDINARY, CAT_ORD}, - {FTDM_CPC_PRIORITY, CAT_PRIOR}, - {FTDM_CPC_DATA, CAT_DATA}, - {FTDM_CPC_TEST, CAT_TEST}, - {FTDM_CPC_PAYPHONE, CAT_PAYPHONE}, -}; - -ftdm2trillium_t bc_cap_codes[] = { - {FTDM_BEARER_CAP_SPEECH, ITC_SPEECH}, /* speech as per ATIS-1000113.3.2005 */ - {FTDM_BEARER_CAP_UNRESTRICTED, ITC_UNRDIG}, /* unrestricted digital as per ATIS-1000113.3.2005 */ - {FTDM_BEARER_CAP_RESTRICTED, ITC_UNRDIG}, /* Restricted Digital */ - {FTDM_BEARER_CAP_3_1KHZ_AUDIO, ITC_A31KHZ}, /* 3.1kHz audio as per ATIS-1000113.3.2005 */ - {FTDM_BEARER_CAP_7KHZ_AUDIO, ITC_A7KHZ}, /* 7Khz audio */ - {FTDM_BEARER_CAP_15KHZ_AUDIO, ITC_A15KHZ}, /* 15Khz audio */ - {FTDM_BEARER_CAP_VIDEO, ITC_VIDEO}, /* Video */ -}; - -static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t default_val) -{ - ftdm2trillium_t *val = vals; - while(val++) { - if (val->ftdm_val == ftdm_val) { - return val->trillium_val; - } - } - return default_val; -} - -static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val) -{ - ftdm2trillium_t *val = vals; - while(val++) { - if (val->trillium_val == trillium_val) { - return val->ftdm_val; - } - } - return default_val; -} - -ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) -{ - return FTDM_SUCCESS; -} - -ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) -{ - const char *val = NULL; - const char *clg_nadi = NULL; - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - cgPtyNum->eh.pres = PRSNT_NODEF; - - cgPtyNum->natAddrInd.pres = PRSNT_NODEF; - cgPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].clg_nadi; - - - cgPtyNum->scrnInd.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_screen_ind"); - if (!ftdm_strlen_zero(val)) { - cgPtyNum->scrnInd.val = atoi(val); - } else { - cgPtyNum->scrnInd.val = caller_data->screen; - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Screening Ind %d\n", cgPtyNum->scrnInd.val); - - cgPtyNum->presRest.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_pres_ind"); - if (!ftdm_strlen_zero(val)) { - cgPtyNum->presRest.val = atoi(val); - } else { - cgPtyNum->presRest.val = caller_data->pres; - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Presentation Ind %d\n", cgPtyNum->presRest.val); - - cgPtyNum->numPlan.pres = PRSNT_NODEF; - cgPtyNum->numPlan.val = 0x01; - - cgPtyNum->niInd.pres = PRSNT_NODEF; - cgPtyNum->niInd.val = 0x00; - - /* check if the user would like a custom NADI value for the calling Pty Num */ - clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); - if (!ftdm_strlen_zero(clg_nadi)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Calling NADI value \"%s\"\n", clg_nadi); - cgPtyNum->natAddrInd.val = atoi(clg_nadi); - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number NADI value %d\n", cgPtyNum->natAddrInd.val); - - return copy_tknStr_to_sngss7(caller_data->cid_num.digits, &cgPtyNum->addrSig, &cgPtyNum->oddEven); -} - -ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) -{ - char var[FTDM_DIGITS_LIMIT]; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - if (cdPtyNum->eh.pres == PRSNT_NODEF && - cdPtyNum->natAddrInd.pres == PRSNT_NODEF) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Called Party Number NADI %d\n", cdPtyNum->natAddrInd.val); - sprintf(var, "%d", cdPtyNum->natAddrInd.val); - sngss7_add_var(sngss7_info, "ss7_cld_nadi", var); - } - - return FTDM_SUCCESS; -} - - -ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) -{ - const char *val = NULL; - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - cdPtyNum->eh.pres = PRSNT_NODEF; - - cdPtyNum->natAddrInd.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Called NADI value \"%s\"\n", val); - cdPtyNum->natAddrInd.val = atoi(val); - } else { - cdPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied NADI value found for CLD, using \"%d\"\n", cdPtyNum->natAddrInd.val); - } - - cdPtyNum->numPlan.pres = PRSNT_NODEF; - cdPtyNum->numPlan.val = 0x01; - - cdPtyNum->innInd.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_inn"); - if (!ftdm_strlen_zero(val)) { - cdPtyNum->innInd.val = atoi(val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Called INN value \"%s\"\n", val); - } else { - cdPtyNum->innInd.val = 0x01; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Called INN value, set to default value 0x01\n"); - } - - return copy_tknStr_to_sngss7(caller_data->dnis.digits, &cdPtyNum->addrSig, &cdPtyNum->oddEven); -} - -ftdm_status_t copy_locPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *locPtyNum) -{ - return FTDM_SUCCESS; -} - -ftdm_status_t copy_locPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *locPtyNum) -{ - const char *val = NULL; - const char *loc_nadi = NULL; - int pres_val = PRSNT_NODEF; - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - if (!strcasecmp(caller_data->loc.digits, "NULL")) { - pres_val = NOTPRSNT; - return FTDM_SUCCESS; - } - - locPtyNum->eh.pres = pres_val; - locPtyNum->natAddrInd.pres = pres_val; - locPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].loc_nadi; - - locPtyNum->scrnInd.pres = pres_val; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_loc_screen_ind"); - if (!ftdm_strlen_zero(val)) { - locPtyNum->scrnInd.val = atoi(val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Location Screening Ind %d\n", locPtyNum->scrnInd.val); - } else { - locPtyNum->scrnInd.val = caller_data->screen; - } - - locPtyNum->presRest.pres = pres_val; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_loc_pres_ind"); - if (!ftdm_strlen_zero(val)) { - locPtyNum->presRest.val = atoi(val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Location Presentation Ind %d\n", locPtyNum->presRest.val); - } else { - locPtyNum->presRest.val = caller_data->pres; - } - - locPtyNum->numPlan.pres = pres_val; - locPtyNum->numPlan.val = 0x01; - - locPtyNum->niInd.pres = pres_val; - locPtyNum->niInd.val = 0x00; - - /* check if the user would like a custom NADI value for the Location Reference */ - loc_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_loc_nadi"); - if (!ftdm_strlen_zero(loc_nadi)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Location Reference NADI value \"%s\"\n", loc_nadi); - locPtyNum->natAddrInd.val = atoi(loc_nadi); - } else { - locPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].loc_nadi; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied NADI value found for LOC, using \"%d\"\n", locPtyNum->natAddrInd.val); - } - - return copy_tknStr_to_sngss7(caller_data->loc.digits, &locPtyNum->addrSig, &locPtyNum->oddEven); -} - -ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) -{ - const char *val = NULL; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_digits"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number qualifier \"%s\"\n", val); - if (copy_tknStr_to_sngss7((char*)val, &genNmb->addrSig, &genNmb->oddEven) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } else { - return FTDM_SUCCESS; - } - - genNmb->eh.pres = PRSNT_NODEF; - genNmb->addrSig.pres = PRSNT_NODEF; - - genNmb->nmbQual.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_numqual"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"%s\"\n", val); - genNmb->nmbQual.val = atoi(val); - } else { - genNmb->nmbQual.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nmbqual; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \n"); - } - genNmb->natAddrInd.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_nadi"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"nature of address\" \"%s\"\n", val); - genNmb->natAddrInd.val = atoi(val); - } else { - genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nadi; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"nature of address\" \"%d\"\n", genNmb->natAddrInd.val); - } - genNmb->scrnInd.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_screen_ind"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"screening indicator\" \"%s\"\n", val); - genNmb->scrnInd.val = atoi(val); - } else { - genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_screen_ind; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"screening indicator\" \"%d\"\n", genNmb->natAddrInd.val); - } - genNmb->presRest.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_pres_ind"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"presentation indicator\" \"%s\"\n", val); - genNmb->presRest.val = atoi(val); - } else { - genNmb->presRest.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_pres_ind; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"presentation indicator\" \"%d\"\n", genNmb->presRest.val); - } - genNmb->numPlan.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_npi"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"numbering plan\" \"%s\"\n", val); - genNmb->numPlan.val = atoi(val); - } else { - genNmb->numPlan.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_npi; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"numbering plan\" \"%d\"\n", genNmb->numPlan.val); - } - genNmb->niInd.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_num_inc_ind"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"number incomplete indicator\" \"%s\"\n", val); - genNmb->niInd.val = atoi(val); - } else { - genNmb->niInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_num_inc_ind; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val); - } - return FTDM_SUCCESS; -} - -ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) -{ - char val[64]; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - memset(val, 0, sizeof(val)); - - if (genNmb->eh.pres != PRSNT_NODEF || genNmb->addrSig.pres != PRSNT_NODEF) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Generic Number available\n"); - return FTDM_SUCCESS; - } - - copy_tknStr_from_sngss7(genNmb->addrSig, val, genNmb->oddEven); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_gn_digits", val); - - if (genNmb->nmbQual.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", genNmb->nmbQual.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \"%s\"\n", val); - sngss7_add_var(sngss7_info, "ss7_gn_numqual", val); - } - - if (genNmb->natAddrInd.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", genNmb->natAddrInd.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"nature of address\" \"%s\"\n", val); - sngss7_add_var(sngss7_info, "ss7_gn_nadi", val); - } - - if (genNmb->scrnInd.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", genNmb->scrnInd.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"screening indicator\" \"%s\"\n", val); - sngss7_add_var(sngss7_info, "ss7_gn_screen_ind", val); - } - - if (genNmb->presRest.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", genNmb->presRest.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"presentation indicator\" \"%s\"\n", val); - sngss7_add_var(sngss7_info, "ss7_gn_pres_ind", val); - } - - if (genNmb->numPlan.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", genNmb->numPlan.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"numbering plan\" \"%s\"\n", val); - sngss7_add_var(sngss7_info, "ss7_gn_npi", val); - } - - if (genNmb->niInd.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", genNmb->niInd.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number incomplete indicator\" \"%s\"\n", val); - sngss7_add_var(sngss7_info, "ss7_gn_num_inc_ind", val); - } - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum) -{ - const char* val = NULL; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_digits"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Redirection Number\"%s\"\n", val); - if (copy_tknStr_to_sngss7((char*)val, &redirgNum->addrSig, &redirgNum->oddEven) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } else if (!ftdm_strlen_zero(caller_data->rdnis.digits)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Redirection Number\"%s\"\n", caller_data->rdnis.digits); - if (copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - } else { - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_pres_ind"); - if (!ftdm_strlen_zero(val)) { - redirgNum->presRest.val = atoi(val); - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val); - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Number\n"); - return FTDM_SUCCESS; - } - - redirgNum->eh.pres = PRSNT_NODEF; - - /* Nature of address indicator */ - redirgNum->natAddr.pres = PRSNT_NODEF; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_nadi"); - if (!ftdm_strlen_zero(val)) { - redirgNum->natAddr.val = atoi(val); - } else { - redirgNum->natAddr.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].rdnis_nadi; - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%d\n", redirgNum->natAddr.val); - - /* Screening indicator */ - redirgNum->scrInd.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_screen_ind"); - if (!ftdm_strlen_zero(val)) { - redirgNum->scrInd.val = atoi(val); - } else { - redirgNum->scrInd.val = FTDM_SCREENING_VERIFIED_PASSED; - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val); - - /* Address presentation restricted ind */ - redirgNum->presRest.pres = PRSNT_NODEF; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_pres_ind"); - if (!ftdm_strlen_zero(val)) { - redirgNum->presRest.val = atoi(val); - } else { - redirgNum->presRest.val = FTDM_PRES_ALLOWED; - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val); - - /* Numbering plan */ - redirgNum->numPlan.pres = PRSNT_NODEF; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_plan"); - if (!ftdm_strlen_zero(val)) { - redirgNum->numPlan.val = atoi(val); - } else { - redirgNum->numPlan.val = caller_data->rdnis.plan; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Numbering plan:%d\n", redirgNum->numPlan.val); - - return copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven); -} - -ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum) -{ - char val[20]; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - if (redirgNum->eh.pres != PRSNT_NODEF || redirgNum->addrSig.pres != PRSNT_NODEF) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Redirecting Number available\n"); - return FTDM_SUCCESS; - } - - copy_tknStr_from_sngss7(redirgNum->addrSig, ftdmchan->caller_data.rdnis.digits, redirgNum->oddEven); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number:%s\n", ftdmchan->caller_data.rdnis.digits); - snprintf(val, sizeof(val), "%s", ftdmchan->caller_data.rdnis.digits); - sngss7_add_var(sngss7_info, "ss7_rdnis_digits", val); - - - if (redirgNum->natAddr.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", redirgNum->natAddr.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_rdnis_nadi", val); - caller_data->rdnis.type = redirgNum->natAddr.val; - } - - if (redirgNum->scrInd.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", redirgNum->scrInd.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Screening Ind:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_rdnis_screen_ind", val); - } - - if (redirgNum->presRest.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", redirgNum->presRest.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Presentation Ind:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_rdnis_pres_ind", val); - } - - if (redirgNum->numPlan.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", redirgNum->numPlan.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Numbering plan:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_rdnis_plan", val); - caller_data->rdnis.plan = redirgNum->numPlan.val; - } - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_redirgInfo_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *redirInfo) -{ - char val[20]; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - if (redirInfo->eh.pres != PRSNT_NODEF ) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Redirecting Information available\n"); - return FTDM_SUCCESS; - } - - - if (redirInfo->redirInd.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", redirInfo->redirInd.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirection Information - redirection indicator:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_rdinfo_indicator", val); - } - - if (redirInfo->origRedirReas.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", redirInfo->origRedirReas.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirection Information - original redirection reason:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_rdinfo_orig", val); - } - - if (redirInfo->redirCnt.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", redirInfo->redirCnt.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirection Information - redirection count:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_rdinfo_count", val); - } - - if (redirInfo->redirReas.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", redirInfo->redirReas.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirection Information - redirection reason:%s\n", val); - sngss7_add_var(sngss7_info, "ss7_rdinfo_reason", val); - } - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_redirgInfo_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirInfo *redirInfo) -{ - const char* val = NULL; - int bProceed = 0; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdinfo_indicator"); - if (!ftdm_strlen_zero(val)) { - redirInfo->redirInd.val = atoi(val); - redirInfo->redirInd.pres = 1; - bProceed = 1; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Information on Redirection Indicator\n"); - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdinfo_orig"); - if (!ftdm_strlen_zero(val)) { - redirInfo->origRedirReas.val = atoi(val); - redirInfo->origRedirReas.pres = 1; - bProceed = 1; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Information on Original Reasons\n"); - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdinfo_count"); - if (!ftdm_strlen_zero(val)) { - redirInfo->redirCnt.val = atoi(val); - redirInfo->redirCnt.pres= 1; - bProceed = 1; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Information on Redirection Count\n"); - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdinfo_reason"); - if (!ftdm_strlen_zero(val)) { - redirInfo->redirReas.val = atoi(val); - redirInfo->redirReas.pres = 1; - bProceed = 1; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Information on Redirection Reasons\n"); - } - - if( bProceed == 1 ) { - redirInfo->eh.pres = PRSNT_NODEF; - } else { - redirInfo->eh.pres = NOTPRSNT; - } - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_access_transport_from_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt) -{ - char val[3*((MF_SIZE_TKNSTRE + 7) & 0xff8)]; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - if (accTrnspt->eh.pres != PRSNT_NODEF || accTrnspt->infoElmts.pres !=PRSNT_NODEF) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Access Transport IE available\n"); - return FTDM_SUCCESS; - } - - ftdm_url_encode((const char*)accTrnspt->infoElmts.val, val, accTrnspt->infoElmts.len); - sngss7_add_var (sngss7_info, "ss7_access_transport_urlenc", val); - - return FTDM_SUCCESS; -} -ftdm_status_t copy_access_transport_to_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt) -{ - const char *val = NULL; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_access_transport_urlenc"); - if (ftdm_strlen_zero(val)) { - accTrnspt->eh.pres = NOTPRSNT; - accTrnspt->infoElmts.pres = NOTPRSNT; - } - else { - char *val_dec = NULL; - int val_len = strlen (val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found Access Transport IE encoded : %s\n", val); - - accTrnspt->eh.pres = PRSNT_NODEF; - accTrnspt->infoElmts.pres = PRSNT_NODEF; - - val_dec = ftdm_strdup(val); - ftdm_url_decode(val_dec, (ftdm_size_t*)&val_len); - memcpy (accTrnspt->infoElmts.val, val_dec, val_len); - accTrnspt->infoElmts.len = val_len; - ftdm_safe_free(val_dec); - } - return FTDM_SUCCESS; -} - -ftdm_status_t copy_ocn_from_sngss7(ftdm_channel_t *ftdmchan, SiOrigCdNum *origCdNum) -{ - char val[20]; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - if (origCdNum->eh.pres != PRSNT_NODEF ) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Original Called Number available\n"); - return FTDM_SUCCESS; - } - - if (origCdNum->addrSig.pres == PRSNT_NODEF) { - copy_tknStr_from_sngss7(origCdNum->addrSig, val, origCdNum->oddEven); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Original Called Number - Digits: %s\n", val); - sngss7_add_var(sngss7_info, "ss7_ocn", val); - } - - if (origCdNum->natAddr.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", origCdNum->natAddr.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Original Called Number - NADI: %s\n", val); - sngss7_add_var(sngss7_info, "ss7_ocn_nadi", val); - } - - if (origCdNum->numPlan.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", origCdNum->numPlan.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Original Called Number - Plan: %s\n", val); - sngss7_add_var(sngss7_info, "ss7_ocn_plan", val); - } - - if (origCdNum->presRest.pres == PRSNT_NODEF) { - snprintf(val, sizeof(val), "%d", origCdNum->presRest.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Original Called Number - Presentation: %s\n", val); - sngss7_add_var(sngss7_info, "ss7_ocn_pres", val); - } - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_ocn_to_sngss7(ftdm_channel_t *ftdmchan, SiOrigCdNum *origCdNum) -{ - const char *val = NULL; - int bProceed = 0; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_ocn"); - if (!ftdm_strlen_zero(val)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Original Called Number - Digits: %s\n", val); - if (copy_tknStr_to_sngss7((char*)val, &origCdNum->addrSig, &origCdNum->oddEven) != FTDM_SUCCESS) { - return FTDM_FAIL; - } - origCdNum->addrSig.pres = 1; - } else { - return FTDM_SUCCESS; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_ocn_nadi"); - if (!ftdm_strlen_zero(val)) { - origCdNum->natAddr.val = atoi(val); - origCdNum->natAddr.pres = 1; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Original Called Number - NADI: %s\n", val); - bProceed = 1; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Original Called Number NADI value\n"); - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_ocn_plan"); - if (!ftdm_strlen_zero(val)) { - origCdNum->numPlan.val = atoi(val); - origCdNum->numPlan.pres = 1; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Original Called Number - Plan: %s\n", val); - bProceed = 1; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Original Called Number Plan value\n"); - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_ocn_pres"); - if (!ftdm_strlen_zero(val)) { - origCdNum->presRest.val = atoi(val); - origCdNum->presRest.pres = 1; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Original Called Number - Presentation: %s\n", val); - bProceed = 1; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Original Called Number Presentation value\n"); - } - - if( bProceed == 1 ) { - origCdNum->eh.pres = PRSNT_NODEF; - } else { - origCdNum->eh.pres = NOTPRSNT; - } - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_cgPtyCat_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - cgPtyCat->eh.pres = PRSNT_NODEF; - cgPtyCat->cgPtyCat.pres = PRSNT_NODEF; - - cgPtyCat->cgPtyCat.val = get_trillium_val(cpc_codes, caller_data->cpc, CAT_ORD); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Category:0x%x\n",cgPtyCat->cgPtyCat.val); - return FTDM_SUCCESS; -} - -ftdm_status_t copy_cgPtyCat_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat) -{ - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - if (cgPtyCat->eh.pres == PRSNT_NODEF && - cgPtyCat->cgPtyCat.pres == PRSNT_NODEF) { - - caller_data->cpc = get_ftdm_val(cpc_codes, cgPtyCat->cgPtyCat.val, FTDM_CPC_UNKNOWN); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Category:0x%x\n", cgPtyCat->cgPtyCat.val); - } - return FTDM_SUCCESS; -} - - -ftdm_status_t copy_accTrnspt_to_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt) -{ - const char *clg_subAddr = NULL; - const char *cld_subAddr = NULL; - char subAddrIE[MAX_SIZEOF_SUBADDR_IE]; - - /* check if the user would like us to send a clg_sub-address */ - clg_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr"); - if (!ftdm_strlen_zero(clg_subAddr)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr); - - /* clean out the subAddrIE */ - memset(subAddrIE, 0x0, sizeof(subAddrIE)); - - /* check the first character in the sub-address to see what type of encoding to use */ - switch (clg_subAddr[0]) { - case '0': /* NSAP */ - encode_subAddrIE_nsap(&clg_subAddr[1], subAddrIE, SNG_CALLING); - break; - case '1': /* national variant */ - encode_subAddrIE_nat(&clg_subAddr[1], subAddrIE, SNG_CALLING); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Invalid Calling Sub-Address encoding requested: %c\n", clg_subAddr[0]); - break; - } /* switch (cld_subAddr[0]) */ - - - /* if subaddIE is still empty don't copy it in */ - if (subAddrIE[0] != '0') { - /* check if the clg_subAddr has already been added */ - if (accTrnspt->eh.pres == PRSNT_NODEF) { - /* append the subAddrIE */ - memcpy(&accTrnspt->infoElmts.val[accTrnspt->infoElmts.len], subAddrIE, (subAddrIE[1] + 2)); - accTrnspt->infoElmts.len = accTrnspt->infoElmts.len +subAddrIE[1] + 2; - } else { - /* fill in from the beginning */ - accTrnspt->eh.pres = PRSNT_NODEF; - accTrnspt->infoElmts.pres = PRSNT_NODEF; - memcpy(accTrnspt->infoElmts.val, subAddrIE, (subAddrIE[1] + 2)); - accTrnspt->infoElmts.len = subAddrIE[1] + 2; - } - } - } - - /* check if the user would like us to send a cld_sub-address */ - cld_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_subaddr"); - if ((cld_subAddr != NULL) && (*cld_subAddr)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Called Sub-Address value \"%s\"\n", cld_subAddr); - - /* clean out the subAddrIE */ - memset(subAddrIE, 0x0, sizeof(subAddrIE)); - - /* check the first character in the sub-address to see what type of encoding to use */ - switch (cld_subAddr[0]) { - case '0': /* NSAP */ - encode_subAddrIE_nsap(&cld_subAddr[1], subAddrIE, SNG_CALLED); - break; - case '1': /* national variant */ - encode_subAddrIE_nat(&cld_subAddr[1], subAddrIE, SNG_CALLED); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Invalid Called Sub-Address encoding requested: %c\n", cld_subAddr[0]); - break; - } /* switch (cld_subAddr[0]) */ - - /* if subaddIE is still empty don't copy it in */ - if (subAddrIE[0] != '0') { - /* check if the cld_subAddr has already been added */ - if (accTrnspt->eh.pres == PRSNT_NODEF) { - /* append the subAddrIE */ - memcpy(&accTrnspt->infoElmts.val[accTrnspt->infoElmts.len], subAddrIE, (subAddrIE[1] + 2)); - accTrnspt->infoElmts.len = accTrnspt->infoElmts.len +subAddrIE[1] + 2; - } else { - /* fill in from the beginning */ - accTrnspt->eh.pres = PRSNT_NODEF; - accTrnspt->infoElmts.pres = PRSNT_NODEF; - memcpy(accTrnspt->infoElmts.val, subAddrIE, (subAddrIE[1] + 2)); - accTrnspt->infoElmts.len = subAddrIE[1] + 2; - } - } - } /* if ((cld_subAddr != NULL) && (*cld_subAddr)) */ - return FTDM_SUCCESS; -} - -ftdm_status_t copy_natConInd_to_sngss7(ftdm_channel_t *ftdmchan, SiNatConInd *natConInd) -{ - /* copy down the nature of connection indicators */ - natConInd->eh.pres = PRSNT_NODEF; - natConInd->satInd.pres = PRSNT_NODEF; - natConInd->satInd.val = 0; /* no satellite circuit */ - natConInd->contChkInd.pres = PRSNT_NODEF; - natConInd->contChkInd.val = CONTCHK_NOTREQ; - natConInd->echoCntrlDevInd.pres = PRSNT_NODEF; - natConInd->echoCntrlDevInd.val = ECHOCDEV_INCL; - return FTDM_SUCCESS; -} - -ftdm_status_t four_char_to_hex(const char* in, uint16_t* out) -{ - int i= 4; - char a, b, c, d; - if (!in || 4>strlen(in)) { - return FTDM_FAIL; - } - while(i) - { - switch((char)*(in+(4-i))) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (i==4) { - d = *(in+(4-i)) - 48; - } else if (i==3) { - c = *(in+(4-i)) - 48; - } else if (i==2) { - b = *(in+(4-i)) - 48; - } else { - a = *(in+(4-i)) - 48; - } - break; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - if (i==4) { - d = *(in+(4-i)) - 55; - } else if (i==3) { - c = *(in+(4-i)) - 55; - } else if (i==2) { - b = *(in+(4-i)) - 55; - } else { - a = *(in+(4-i)) - 55; - } - break; - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - if (i==4) { - d = *(in+(4-i)) - 87; - } else if (i==3) { - c = *(in+(4-i)) - 87; - } else if (i==2) { - b = *(in+(4-i)) - 87; - } else { - a = *(in+(4-i)) - 87; - } - break; - default: - SS7_ERROR("Invalid character found when decoding hex string, %c!\n", *(in+(4-i)) ); - break; - } - i--; - }; - - *out |= d; - *out = *out<<4; - *out |= c; - *out = *out<<4; - *out |= b; - *out = *out<<4; - *out |= a; - - return FTDM_SUCCESS; -} - -ftdm_status_t char_to_hex(const char* in, uint16_t* out, int len) -{ - int i= len; - char *val = ftdm_malloc(len*sizeof(char)); - - if (!val ||!in || len>strlen(in)) { - return FTDM_FAIL; - } - - while(i) - { - switch((char)*(in+(len-i))) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - *(val+(len-i)) = *(in+(len-i)) - 48; - break; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - *(val+(len-i)) = *(in+(len-i)) - 55; - break; - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - *(val+(len-i)) = *(in+(len-i)) - 87; - break; - default: - SS7_ERROR("Invalid character found when decoding hex string, %c!\n", *(in+(len-i)) ); - break; - } - i--; - }; - - for (i=0; i<=len-1; i++) { - *out = *out << 4; - *out |= *(val+i); - } - - return FTDM_SUCCESS; -} - - - -ftdm_status_t hex_to_char(uint16_t in, char* out, int len) -{ - char val=0; - int mask = 0xf; - int i=0; - if (!out) { - return FTDM_SUCCESS; - } - - for (i=len-1; i>=0; i--) { - val = (in & (mask<<(4*i))) >> (4*i); - sprintf (out+(len-1-i), "%x", val); - } - - return FTDM_SUCCESS; -} -ftdm_status_t hex_to_four_char(uint16_t in, char* out) -{ - char val=0; - int mask = 0xf; - int i=0; - if (!out) { - return FTDM_SUCCESS; - } - - for (i=3; i>=0; i--) { - val = (in & (mask<<(4*i))) >> (4*i); - sprintf (out+(3-i), "%x", val); - } - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_NatureOfConnection_to_sngss7(ftdm_channel_t *ftdmchan, SiNatConInd *natConInd) -{ - const char *val = NULL; - - natConInd->eh.pres = PRSNT_NODEF; - natConInd->satInd.pres = PRSNT_NODEF; - natConInd->contChkInd.pres = PRSNT_NODEF;; - natConInd->echoCntrlDevInd.pres = PRSNT_NODEF; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_nature_connection_hex"); - if (!ftdm_strlen_zero(val)) { - uint16_t val_hex = 0; - if (char_to_hex (val, &val_hex, 2) == FTDM_FAIL) { - SS7_ERROR ("Wrong value set in ss7_iam_nature_connection_hex variable. Please correct the error. Setting to default values.\n" ); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "hex = 0x%x\n", val_hex); - natConInd->satInd.val = (val_hex & 0x3); - natConInd->contChkInd.val = (val_hex & 0xc)>>2; - natConInd->echoCntrlDevInd.val = (val_hex & 0x10) >> 4; - - return FTDM_SUCCESS; - } - } - - natConInd->satInd.val = 0; - natConInd->contChkInd.val = 0; - natConInd->echoCntrlDevInd.val = 0; - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_NatureOfConnection_from_sngss7(ftdm_channel_t *ftdmchan, SiNatConInd *natConInd ) -{ - char val[3]; - uint16_t val_hex = 0; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - memset (val, 0, 3*sizeof(char)); - if (natConInd->eh.pres != PRSNT_NODEF ) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No nature of connection indicator IE available\n"); - return FTDM_SUCCESS; - } - - val_hex |= natConInd->satInd.val; - val_hex |= natConInd->contChkInd.val << 2; - val_hex |= natConInd->echoCntrlDevInd.val <<4; - hex_to_char(val_hex, val, 2) ; - - sngss7_add_var(sngss7_info, "ss7_iam_nature_connection_hex", val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Nature of connection indicator Hex: 0x%s\n", val); - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_fwdCallInd_hex_from_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd) -{ - char val[5]; - uint16_t val_hex = 0; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - memset (val, 0, 5*sizeof(char)); - if (fwdCallInd->eh.pres != PRSNT_NODEF ) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No forward call indicator IE available\n"); - return FTDM_SUCCESS; - } - - val_hex |= fwdCallInd->natIntCallInd.val << 8; - val_hex |= (fwdCallInd->end2EndMethInd.val & 0x1) << 9; - val_hex |= ((fwdCallInd->end2EndMethInd.val & 0x2)>>1) << 10; - val_hex |= fwdCallInd->intInd.val << 11; - val_hex |= fwdCallInd->end2EndInfoInd.val << 12; - val_hex |= fwdCallInd->isdnUsrPrtInd.val << 13; - val_hex |= (fwdCallInd->isdnUsrPrtPrfInd.val & 0x1) << 14; - val_hex |= ((fwdCallInd->isdnUsrPrtPrfInd.val & 0x2)>>1) << 15; - - val_hex |= fwdCallInd->isdnAccInd.val; - hex_to_four_char(val_hex, val) ; - - sngss7_add_var(sngss7_info, "ss7_iam_fwd_ind_hex", val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Forwad Call Indicator Hex: 0x%s\n", val); - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_fwdCallInd_to_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd) -{ - const char *val = NULL; - int acc_val = ISDNACC_ISDN; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - fwdCallInd->eh.pres = PRSNT_NODEF; - fwdCallInd->natIntCallInd.pres = PRSNT_NODEF; - fwdCallInd->end2EndMethInd.pres = PRSNT_NODEF; - fwdCallInd->intInd.pres = PRSNT_NODEF; - fwdCallInd->end2EndInfoInd.pres = PRSNT_NODEF; - fwdCallInd->isdnUsrPrtInd.pres = PRSNT_NODEF; - fwdCallInd->isdnUsrPrtPrfInd.pres = PRSNT_NODEF; - fwdCallInd->isdnAccInd.pres = PRSNT_NODEF; - fwdCallInd->sccpMethInd.pres = PRSNT_NODEF; - fwdCallInd->sccpMethInd.val = SCCPMTH_NOIND; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_fwd_ind_hex"); - if (!ftdm_strlen_zero(val)) { - uint16_t val_hex = 0; - if (four_char_to_hex (val, &val_hex) == FTDM_FAIL) { - SS7_ERROR ("Wrong value set in iam_fwd_ind_HEX variable. Please correct the error. Setting to default values.\n" ); - } else { - fwdCallInd->natIntCallInd.val = (val_hex & 0x100)>>8; - fwdCallInd->end2EndMethInd.val = (val_hex & 0x600)>>9; - fwdCallInd->intInd.val = (val_hex & 0x800)>>11; - fwdCallInd->end2EndInfoInd.val = (val_hex & 0x1000)>>12; - fwdCallInd->isdnUsrPrtInd.val = (val_hex & 0x2000)>>13; - fwdCallInd->isdnUsrPrtPrfInd.val = (val_hex & 0xC000)>>14; - fwdCallInd->isdnUsrPrtPrfInd.val = (fwdCallInd->isdnUsrPrtPrfInd.val==0x03)?0x0:fwdCallInd->isdnUsrPrtPrfInd.val; - fwdCallInd->isdnAccInd.val = val_hex & 0x1; - - if ((g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS88) || - (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS92) || - (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS95)) { - - /* include only if we're running ANSI */ - fwdCallInd->transCallNInd.pres = PRSNT_NODEF; - fwdCallInd->transCallNInd.val = 0x0; - } - - return FTDM_SUCCESS; - } - } - - fwdCallInd->natIntCallInd.val = 0x00; - fwdCallInd->end2EndMethInd.val = E2EMTH_NOMETH; - fwdCallInd->intInd.val = INTIND_NOINTW; - fwdCallInd->end2EndInfoInd.val = E2EINF_NOINFO; - fwdCallInd->isdnUsrPrtInd.val = ISUP_USED; - fwdCallInd->isdnUsrPrtPrfInd.val = PREF_PREFAW; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_fwd_ind_isdn_access_ind"); - if (ftdm_strlen_zero(val)) { - /* Kept for backward compatibility */ - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "iam_fwd_ind_isdn_access_ind"); - } - - if (!ftdm_strlen_zero(val)) { - acc_val = (int)atoi(val); - } - - fwdCallInd->isdnAccInd.val = acc_val; - - if ((g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS88) || - (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS92) || - (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].switchType == LSI_SW_ANS95)) { - - /* include only if we're running ANSI */ - fwdCallInd->transCallNInd.pres = PRSNT_NODEF; - fwdCallInd->transCallNInd.val = 0x0; - } - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_txMedReq_to_sngss7(ftdm_channel_t *ftdmchan, SiTxMedReq *txMedReq) -{ - txMedReq->eh.pres = PRSNT_NODEF; - txMedReq->trMedReq.pres = PRSNT_NODEF; - txMedReq->trMedReq.val = ftdmchan->caller_data.bearer_capability; - - return FTDM_SUCCESS; -} - -ftdm_status_t copy_usrServInfoA_to_sngss7(ftdm_channel_t *ftdmchan, SiUsrServInfo *usrServInfoA) -{ - int bProceed = 0; - const char *val = NULL; - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_trans_cap"); - if (!ftdm_strlen_zero(val)) { - int itc_type = 0; - if (!strcasecmp(val, "SPEECH")) { - itc_type = ITC_SPEECH; - } else if (!strcasecmp(val, "UNRESTRICTED")) { - itc_type = ITC_UNRDIG; - } else if (!strcasecmp(val, "RESTRICTED")) { - itc_type = ITC_RESDIG; - } else if (!strcasecmp(val, "31KHZ")) { - itc_type = ITC_A31KHZ; - } else if (!strcasecmp(val, "7KHZ")) { - itc_type = ITC_A7KHZ; - } else if (!strcasecmp(val, "15KHZ")) { - itc_type = ITC_A15KHZ; - } else if (!strcasecmp(val, "VIDEO")) { - itc_type = ITC_VIDEO; - } else { - itc_type = ITC_SPEECH; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI transmission capability parameter is wrong : %s. Setting to default SPEECH. \n", val ); - } - - usrServInfoA->infoTranCap.pres = PRSNT_NODEF; - usrServInfoA->infoTranCap.val = get_trillium_val(bc_cap_codes, ftdmchan->caller_data.bearer_capability, itc_type); - bProceed = 1; - } else { - usrServInfoA->infoTranCap.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_code_standard"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->cdeStand.pres = PRSNT_NODEF; - usrServInfoA->cdeStand.val = (int)atoi(val); /* default is 0x0 */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI coding standard = %d\n", usrServInfoA->cdeStand.val ); - bProceed = 1; - } else { - usrServInfoA->cdeStand.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_trans_mode"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->tranMode.pres = PRSNT_NODEF; - usrServInfoA->tranMode.val = (int)atoi(val); /* transfer mode, default is 0x0*/ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI transfer mode = %d\n", usrServInfoA->tranMode.val ); - bProceed = 1; - } else { - usrServInfoA->tranMode.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_trans_rate_0"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->infoTranRate0.pres = PRSNT_NODEF; - usrServInfoA->infoTranRate0.val = (int)atoi(val); /* default is 0x10, 64kbps origination to destination*/ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI trans rate 0 = %d\n", usrServInfoA->infoTranRate0.val ); - bProceed = 1; - } else { - usrServInfoA->infoTranRate0.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_trans_rate_1"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->infoTranRate1.pres = PRSNT_NODEF; - usrServInfoA->infoTranRate1.val = (int)atoi(val); /* 64kbps destination to origination, default is 0x10 */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI trans rate 1 = %d\n", usrServInfoA->infoTranRate1.val ); - bProceed = 1; - } else { - usrServInfoA->infoTranRate1.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_layer1_ident"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->lyr1Ident.pres = PRSNT_NODEF; - usrServInfoA->lyr1Ident.val = (int)atoi(val); /*default value is 0x01 */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI layer 1 indentification = %d\n", usrServInfoA->lyr1Ident.val ); - bProceed = 1; - } else { - usrServInfoA->lyr1Ident.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_layer1_prot"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->usrInfLyr1Prot.pres = PRSNT_NODEF; - usrServInfoA->usrInfLyr1Prot.val = (int)atoi(val); /*default value is 0x02 */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI layer 1 protocol = %d\n", usrServInfoA->usrInfLyr1Prot.val ); - bProceed = 1; - } else { - usrServInfoA->usrInfLyr1Prot.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_layer2_ident"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->lyr2Ident.pres = PRSNT_NODEF; - usrServInfoA->lyr2Ident.val = (int)atoi(val); /*default value is 0x01 */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI layer 2 indentification = %d\n", usrServInfoA->lyr2Ident.val ); - bProceed = 1; - } else { - usrServInfoA->lyr2Ident.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_layer2_prot"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->usrInfLyr2Prot.pres = PRSNT_NODEF; - usrServInfoA->usrInfLyr2Prot.val = (int)atoi(val); /*default value is 0x02 */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI layer 2 protocol = %d\n", usrServInfoA->usrInfLyr2Prot.val ); - bProceed = 1; - } else { - usrServInfoA->usrInfLyr2Prot.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_layer3_ident"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->lyr3Ident.pres = PRSNT_NODEF; - usrServInfoA->lyr3Ident.val = (int)atoi(val); /*default value is 0x01 */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI layer 3 indentification = %d\n", usrServInfoA->lyr3Ident.val ); - bProceed = 1; - } else { - usrServInfoA->lyr3Ident.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_layer3_prot"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->usrInfLyr3Prot.pres = PRSNT_NODEF; - usrServInfoA->usrInfLyr3Prot.val = (int)atoi(val); /*default value is 0x02 */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI layer 3 protocol = %d\n", usrServInfoA->usrInfLyr3Prot.val ); - bProceed = 1; - } else { - usrServInfoA->usrInfLyr3Prot.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_chan_struct"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->chanStruct.pres = PRSNT_NODEF; - usrServInfoA->chanStruct.val = (int)atoi(val); /* default value is 0x1, 8kHz integrity */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI channel structure = %d\n", usrServInfoA->chanStruct.val ); - bProceed = 1; - } else { - usrServInfoA->chanStruct.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_config"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->config.pres = PRSNT_NODEF; - usrServInfoA->config.val = (int)atoi(val); /* default value is 0x0, point to point configuration */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI configuration = %d\n", usrServInfoA->config.val ); - bProceed = 1; - } else { - usrServInfoA->config.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_establish"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->establish.pres = PRSNT_NODEF; - usrServInfoA->establish.val = (int)atoi(val); /* default value is 0x0, on demand */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI establishment = %d\n", usrServInfoA->establish.val ); - bProceed = 1; - } else { - usrServInfoA->establish.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_symmetry"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->symmetry.pres = PRSNT_NODEF; - usrServInfoA->symmetry.val = (int)atoi(val); /* default value is 0x0, bi-directional symmetric */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI symmetry = %d\n", usrServInfoA->symmetry.val ); - bProceed = 1; - } else { - usrServInfoA->symmetry.pres = NOTPRSNT; - } - - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam_usi_rate_multiplier"); - if (!ftdm_strlen_zero(val)) { - usrServInfoA->rateMultiplier.pres = PRSNT_NODEF; - usrServInfoA->rateMultiplier.val = (int)atoi(val); /* default value is 0x1, 1x rate multipler */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "USI rate multipier = %d\n", usrServInfoA->rateMultiplier.val ); - bProceed = 1; - } else { - usrServInfoA->rateMultiplier.pres = NOTPRSNT; - } - - if (bProceed) { - usrServInfoA->eh.pres = PRSNT_NODEF; - } else { - usrServInfoA->eh.pres = NOTPRSNT; - } - - return FTDM_SUCCESS; -} - - - -ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) -{ - uint8_t i; - uint8_t j; - - /* check if the token string is present */ - if (str.pres == 1) { - j = 0; - - for (i = 0; i < str.len; i++) { - sprintf(&ftdm[j], "%X", (str.val[i] & 0x0F)); - j++; - sprintf(&ftdm[j], "%X", ((str.val[i] & 0xF0) >> 4)); - j++; - } - - /* if the odd flag is up the last digit is a fake "0" */ - if ((oddEven.pres == 1) && (oddEven.val == 1)) { - ftdm[j-1] = '\0'; - } else { - ftdm[j] = '\0'; - } - - - } else { - SS7_ERROR("Asked to copy tknStr that is not present!\n"); - return FTDM_FAIL; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) -{ - int i = 0; - int j = 0; - - /* check if the token string is present */ - if (str.pres == 1) { - /* find the length of the digits so far */ - j = strlen(ftdm); - - /* confirm that we found an acceptable length */ - if ( j > 25 ) { - SS7_ERROR("string length exceeds maxium value...aborting append!\n"); - return FTDM_FAIL; - } /* if ( j > 25 ) */ - - /* copy in digits */ - for (i = 0; i < str.len; i++) { - /* convert 4 bit integer to char and copy into lower nibblet*/ - sprintf(&ftdm[j], "%X", (str.val[i] & 0x0F)); - /* move along */ - j++; - /* convert 4 bit integer to char and copy into upper nibblet */ - sprintf(&ftdm[j], "%X", ((str.val[i] & 0xF0) >> 4)); - /* move along */ - j++; - } /* for (i = 0; i < str.len; i++) */ - - /* if the odd flag is up the last digit is a fake "0" */ - if ((oddEven.pres == 1) && (oddEven.val == 1)) { - ftdm[j-1] = '\0'; - } else { - ftdm[j] = '\0'; - } /* if ((oddEven.pres == 1) && (oddEven.val == 1)) */ - } else { - SS7_ERROR("Asked to copy tknStr that is not present!\n"); - return FTDM_FAIL; - } /* if (str.pres == 1) */ - - return FTDM_SUCCESS; -} - - -ftdm_status_t copy_tknStr_to_sngss7(char* val, TknStr *tknStr, TknU8 *oddEven) -{ - char tmp[2]; - int k = 0; - int j = 0; - uint8_t flag = 0; - uint8_t odd = 0; - - uint8_t lower = 0x0; - uint8_t upper = 0x0; - - tknStr->pres = PRSNT_NODEF; - - /* atoi will search through memory starting from the pointer it is given until - * it finds the \0...since tmp is on the stack it will start going through the - * possibly causing corruption. Hard code a \0 to prevent this - */ - tmp[1] = '\0'; - - while (1) { - /* grab a digit from the ftdm digits */ - tmp[0] = val[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - if (tmp[0] == '*') { - /* Could not find a spec that specifies this , but on customer system, * was transmitted as 0x0b */ - SS7_DEBUG("Replacing * with 0x0b"); - k++; - tmp[0] = 0x0b; - } else { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - /* move on to the next value */ - k++; - tmp[0] = val[k]; - } - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push it into the lower nibble */ - lower = strtol(&tmp[0], (char **)NULL, 16); - /* move to the next digit */ - k++; - /* grab a digit from the ftdm digits */ - tmp[0] = val[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - k++; - tmp[0] = val[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push the digit into the upper nibble */ - upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; - } else { - /* there is no upper ... fill in 0 */ - upper = 0x0; - /* throw the odd flag */ - odd = 1; - /* throw the end flag */ - flag = 1; - } /* if (tmp != '\0') */ - } else { - /* keep the odd flag down */ - odd = 0; - /* break right away since we don't need to write the digits */ - break; - } - - /* push the digits into the trillium structure */ - tknStr->val[j] = upper | lower; - - /* increment the trillium pointer */ - j++; - - /* if the flag is up we're through all the digits */ - if (flag) break; - - /* move to the next digit */ - k++; - } /* while(1) */ - - tknStr->len = j; - oddEven->pres = PRSNT_NODEF; - oddEven->val = odd; - return FTDM_SUCCESS; -} - - - -/******************************************************************************/ -int check_for_state_change(ftdm_channel_t *ftdmchan) -{ - - /* check to see if there are any pending state changes on the channel and give them a sec to happen*/ - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 500); - - /* check the flag to confirm it is clear now */ - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - /* the flag is still up...so we have a problem */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "FTDM_CHANNEL_STATE_CHANGE flag set for over 500ms, channel state = %s\n", - ftdm_channel_state2str (ftdmchan->state)); - - return 1; - } - - return 0; -} - -/******************************************************************************/ -ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan) -{ - if (!g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj) { - SS7_ERROR("No ss7 info for circuit #%d\n", circuit); - return FTDM_FAIL; - } - - *sngss7_info = g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj; - - if (!(*sngss7_info)->ftdmchan) { - SS7_ERROR("No ftdmchan for circuit #%d\n", circuit); - return FTDM_FAIL; - } - - if (!(*sngss7_info)->ftdmchan->span) { - SS7_CRITICAL("ftdmchan->span = NULL for circuit #%d\n",circuit); - return FTDM_FAIL; - - } - if (!(*sngss7_info)->ftdmchan->span->signal_data) { - SS7_CRITICAL("ftdmchan->span->signal_data = NULL for circuit #%d\n",circuit); - return FTDM_FAIL; - - } - - *ftdmchan = (*sngss7_info)->ftdmchan; - return FTDM_SUCCESS; -} - -/******************************************************************************/ -int check_for_reset(sngss7_chan_data_t *sngss7_info) -{ - - if (sngss7_test_ckt_flag(sngss7_info,FLAG_RESET_RX)) { - return 1; - } - - if (sngss7_test_ckt_flag(sngss7_info,FLAG_RESET_TX)) { - return 1; - } - - if (sngss7_test_ckt_flag(sngss7_info,FLAG_GRP_RESET_RX)) { - return 1; - } - - if (sngss7_test_ckt_flag(sngss7_info,FLAG_GRP_RESET_TX)) { - return 1; - } - - return 0; - -} - -/******************************************************************************/ -unsigned long get_unique_id(void) -{ - int procId = sng_get_procId(); - - /* id values are between (procId * 1,000,000) and ((procId + 1) * 1,000,000) */ - if (sngss7_id < ((procId + 1) * 1000000) ) { - sngss7_id++; - } else { - sngss7_id = procId * 1000000; - } - - return(sngss7_id); -} - -/******************************************************************************/ -ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan) -{ - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_chan_data_t *sngss7_info = NULL; - sngss7_chan_data_t *cinfo = NULL; - int i = 0; - - iter = ftdm_span_get_chan_iterator(ftdmspan, NULL); - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *fchan = ftdm_iterator_current(curr); - - ftdm_channel_lock(fchan); - - cinfo = fchan->call_data; - - if (!cinfo->rx_grs.range) { - ftdm_channel_unlock(fchan); - continue; - } - - SS7_INFO("Rx GRS (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[cinfo->rx_grs.circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[cinfo->rx_grs.circuit].cic + cinfo->rx_grs.range)); - - for (i = cinfo->rx_grs.circuit; i < (cinfo->rx_grs.circuit + cinfo->rx_grs.range + 1); i++) { - - /* confirm this is a voice channel, otherwise we do nothing */ - if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) { - continue; - } - - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - continue; - } - - /* check if the GRP_RESET_RX flag is already up */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX)) { - /* we have already processed this channel...move along */ - continue; - } - - /* lock the channel */ - ftdm_channel_lock(ftdmchan); - - /* clear up any pending state changes */ - while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change (ftdmchan); - } - - /* flag the channel as having received a reset */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_channel_unlock(ftdmchan); - - } - - ftdm_channel_unlock(fchan); - } - - ftdm_iterator_free(iter); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) -{ - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_chan_data_t *sngss7_info = NULL; - sngss7_chan_data_t *cinfo = NULL; - int i = 0, bn = 0; - int byte = 0, bit = 0; - int cic_start = 0, cic_end = 0, num_cics = 0; - ftdm_bitmap_t *lockmap = 0; - ftdm_size_t mapsize = 0; - - iter = ftdm_span_get_chan_iterator(ftdmspan, NULL); - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *fchan = ftdm_iterator_current(curr); - - ftdm_channel_lock(fchan); - - cinfo = fchan->call_data; - - if (!cinfo->rx_grs.range) { - - ftdm_channel_unlock(fchan); - - continue; - } - - cic_start = cinfo->rx_grs.circuit; - cic_end = cinfo->rx_grs.circuit + cinfo->rx_grs.range; - num_cics = cinfo->rx_grs.range + 1; - mapsize = (num_cics / FTDM_BITMAP_NBITS) + 1; - - lockmap = ftdm_calloc(mapsize, sizeof(*lockmap)); - if (!lockmap) { - ftdm_channel_unlock(fchan); - return FTDM_ENOMEM; - } - - /* check all the circuits in the range to see if they are done resetting */ - for (i = cic_start, bn = 0; i <= cic_end; i++, bn++) { - - /* confirm this is a voice channel, otherwise we do nothing */ - if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) { - continue; - } - - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - ftdm_assert(FTDM_FALSE, "Failed to extract channel data during GRS\n"); - continue; - } - - /* lock the channel */ - ftdm_channel_lock(ftdmchan); - ftdm_map_set_bit(lockmap, bn); - - /* check if there is a state change pending on the channel */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - /* check the state to the GRP_RESET_RX_DN flag */ - if (!sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) { - /* this channel is still resetting...do nothing */ - goto GRS_UNLOCK_ALL; - } /* if (!sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) */ - } else { - /* state change pending */ - goto GRS_UNLOCK_ALL; - } - - } - - SS7_DEBUG("All circuits out of reset for GRS: circuit=%d, range=%d\n", cinfo->rx_grs.circuit, cinfo->rx_grs.range); - for (i = cic_start; i <= cic_end; i++) { - - /* confirm this is a voice channel, otherwise we do nothing */ - if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) { - continue; - } - - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n",i); - ftdm_assert(FTDM_FALSE, "Failed to extract channel data during GRS\n"); - continue; - } - - /* throw the GRP reset flag complete flag */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); - - /* move the channel to the down state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - /* update the status map if the ckt is in blocked state */ - if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { - - cinfo->rx_grs.status[byte] = (cinfo->rx_grs.status[byte] | (1 << bit)); - } - - /* update the bit and byte counter*/ - bit ++; - if (bit == 8) { - byte++; - bit = 0; - } - - } -GRS_UNLOCK_ALL: - for (i = cic_start, bn = 0; i <= cic_end; i++, bn++) { - /* confirm this is a voice channel, otherwise we do nothing */ - if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) { - continue; - } - - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - ftdm_assert(FTDM_FALSE, "Failed to extract channel data during GRS\n"); - continue; - } - if (ftdm_map_test_bit(lockmap, bn)) { - /* unlock the channel */ - ftdm_channel_unlock(ftdmchan); - ftdm_map_clear_bit(lockmap, bn); - } - } - - ftdm_safe_free(lockmap); - - ftdm_channel_unlock(fchan); - } - - ftdm_iterator_free(iter); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan) -{ - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_chan_data_t *sngss7_info = NULL; - sngss7_chan_data_t *cinfo = NULL; - int i = 0; - - iter = ftdm_span_get_chan_iterator(ftdmspan, NULL); - - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *fchan = ftdm_iterator_current(curr); - ftdm_channel_lock(fchan); - - cinfo = fchan->call_data; - - if (!cinfo->rx_gra.range) { - - ftdm_channel_unlock(fchan); - - continue; - } - - SS7_INFO("Rx GRA (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[cinfo->rx_gra.circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[cinfo->rx_gra.circuit].cic + cinfo->rx_gra.range)); - - for (i = cinfo->rx_gra.circuit; i < (cinfo->rx_gra.circuit + cinfo->rx_gra.range + 1); i++) { - - /* confirm this is a voice channel, otherwise we do nothing */ - if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) { - continue; - } - - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - continue; - } - - /* check if the channel is already processing the GRA */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) { - /* move along */ - continue; - } - - /* lock the channel */ - ftdm_channel_lock(ftdmchan); - - /* clear up any pending state changes */ - while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change (ftdmchan); - } - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - - /* do nothing, just drop the message */ - SS7_DEBUG("Receveived GRA in down state, dropping\n"); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - break; - /**********************************************************************/ - default: - /* ITU Q764-2.9.5.1.c -> release the circuit */ - if (cinfo->rx_gra.cause != 0) { - ftdmchan->caller_data.hangup_cause = cinfo->rx_gra.cause; - } else { - ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ - } - - /* go to terminating to hang up the call */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**********************************************************************/ - } - - ftdm_channel_unlock(ftdmchan); - } - - ftdm_channel_unlock(fchan); - } - - ftdm_iterator_free(iter); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) -{ - ftdm_channel_t *ftdmchan = NULL; - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_sigmsg_t sigev; - int x; - - for (x = 1; x < (ftdmspan->chan_count + 1); x++) { - - /* extract the channel structure and sngss7 channel data */ - ftdmchan = ftdmspan->channels[x]; - - /* if the call data is NULL move on */ - if (ftdmchan->call_data == NULL) continue; - - sngss7_info = ftdmchan->call_data; - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - memset (&sigev, 0, sizeof (sigev)); - - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - - /* if we have the PAUSED flag and the sig status is still UP */ - if ((sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) && - (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { - - /* clear up any pending state changes */ - while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change (ftdmchan); - } - - /* throw the channel into SUSPENDED to process the flag */ - /* after doing this once the sig status will be down */ - ftdm_set_state (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* if the RESUME flag is up go to SUSPENDED to process the flag */ - /* after doing this the flag will be cleared */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME)) { - - /* clear up any pending state changes */ - while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change (ftdmchan); - } - - /* got SUSPENDED state to clear the flag */ - ftdm_set_state (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* for (x = 1; x < (span->chan_count + 1); x++) */ - - /* signal the core that sig events are queued for processing */ - ftdm_span_trigger_signals(ftdmspan); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan) -{ - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_chan_data_t *sngss7_info = NULL; - sngss7_chan_data_t *cinfo = NULL; - sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; - int i = 0; - - iter = ftdm_span_get_chan_iterator(ftdmspan, NULL); - curr = iter; - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *fchan = ftdm_iterator_current(curr); - - ftdm_channel_lock(fchan); - - cinfo = fchan->call_data; - - if (!cinfo->ucic.range) { - - ftdm_channel_unlock(fchan); - - continue; - } - - for (i = cinfo->ucic.circuit; i < (cinfo->ucic.circuit + cinfo->ucic.range + 1); i++) { - - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - continue; - } - - /* lock the channel */ - ftdm_channel_lock(ftdmchan); - - SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx Span UCIC\n", sngss7_info->circuit->cic); - - /* clear up any pending state changes */ - while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change (ftdmchan); - } - - /* throw the ckt block flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); - - /* set the channel to suspended state */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_channel_unlock(ftdmchan); - } - /* clear out the ucic data since we're done with it */ - memset(&cinfo->ucic, 0, sizeof(cinfo->ucic)); - - ftdm_channel_unlock(fchan); - } - - ftdm_clear_flag(sngss7_span, SNGSS7_UCIC_PENDING); - - ftdm_iterator_free(iter); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info) -{ - /* clear all the flags related to an incoming GRS */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_DN); - sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info) -{ - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - sngss7_chan_data_t *cinfo = NULL; - ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmchan->span->signal_data; - - memset(&sngss7_info->rx_grs, 0, sizeof(sngss7_info->rx_grs)); - - iter = ftdm_span_get_chan_iterator(ftdmchan->span, NULL); - curr = iter; - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *fchan = ftdm_iterator_current(curr); - - ftdm_channel_lock(fchan); - - cinfo = fchan->call_data; - if (cinfo->rx_grs.range) { - /* there is still another grs pending, do not clear the SNGSS7_RX_GRS_PENDING flag yet */ - ftdm_channel_unlock(fchan); - goto done; - } - - ftdm_channel_unlock(fchan); - } - - /* if we're here is because there is no other grs going on now in this span */ - ftdm_clear_flag(sngss7_span, SNGSS7_RX_GRS_PENDING); - -done: - ftdm_iterator_free(iter); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info) -{ - ftdm_iterator_t *iter = NULL; - ftdm_iterator_t *curr = NULL; - sngss7_chan_data_t *cinfo = NULL; - ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; - - /* clear the rx_grs data fields */ - memset(&sngss7_info->rx_gra, 0, sizeof(sngss7_info->rx_gra)); - - iter = ftdm_span_get_chan_iterator(ftdmchan->span, NULL); - curr = iter; - for (curr = iter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *fchan = ftdm_iterator_current(curr); - - ftdm_channel_lock(fchan); - - cinfo = fchan->call_data; - if (cinfo->rx_gra.range) { - /* there is still another gra pending, do not clear the SNGSS7_RX_GRA_PENDING flag yet */ - ftdm_channel_unlock(fchan); - goto done; - } - - ftdm_channel_unlock(fchan); - } - - /* if we're here is because there is no other gra pending in this span */ - ftdm_clear_flag(sngss7_span, SNGSS7_RX_GRA_PENDING); - -done: - - ftdm_iterator_free(iter); - - return FTDM_SUCCESS; -} -/******************************************************************************/ -ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info) -{ - /* clear all the flags related to an outgoing GRS */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE); - sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT); - sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info) -{ - /* clear everything up */ - memset(&sngss7_info->tx_grs, 0, sizeof(sngss7_info->tx_grs)); - return FTDM_SUCCESS; -} - -/******************************************************************************/ - -/******************************************************************************/ -ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info) -{ - /* clear all the flags related to an incoming RSC */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_RESET_RX); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info) -{ - /* clear all the flags related to an outgoing RSC */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_RESET_TX); - sngss7_clear_ckt_flag(sngss7_info, FLAG_RESET_SENT); - sngss7_clear_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int type) -{ - /* Q931 4.5.9 - * 8 7 6 5 4 3 2 1 (octet) - * - * 0 1 1 1 0 0 0 1 (spare 8) ( IE id 1-7) - * X X X X X X X X (length of IE contents) - * 1 0 0 0 Z 0 0 0 (ext 8) (NSAP type 5-7) (odd/even 4) (spare 1-3) - * X X X X X X X X (sub address encoded in ia5) - */ - - int x = 0; - int p = 0; - int len = 0; - char tmp[2]; - - /* initalize the second element of tmp to \0 so that atoi doesn't go to far */ - tmp[1]='\0'; - - /* set octet 1 aka IE id */ - p = 0; - switch(type) { - /**************************************************************************/ - case SNG_CALLED: /* called party sub address */ - subAddrIE[p] = 0x71; - break; - /**************************************************************************/ - case SNG_CALLING: /* calling party sub address */ - subAddrIE[p] = 0x6d; - break; - /**************************************************************************/ - default: /* not good */ - SS7_ERROR("Sub-Address type is invalid: %d\n", type); - return FTDM_FAIL; - break; - /**************************************************************************/ - } /* switch(type) */ - - /* set octet 3 aka type and o/e */ - p = 2; - subAddrIE[p] = 0x80; - - /* set the subAddrIE pointer octet 4 */ - p = 3; - - /* loop through all digits in subAddr and insert them into subAddrIE */ - while (subAddr[x] != '\0') { - - /* grab a character */ - tmp[0] = subAddr[x]; - - /* confirm it is a digit */ - if (!isdigit(tmp[0])) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - /* move to the next character in subAddr */ - x++; - - /* restart the loop */ - continue; - } - - /* convert the character to IA5 encoding and write into subAddrIE */ - subAddrIE[p] = atoi(&tmp[0]); /* lower nibble is the digit */ - subAddrIE[p] |= 0x3 << 4; /* upper nibble is 0x3 */ - - /* increment address length counter */ - len++; - - /* increment the subAddrIE pointer */ - p++; - - /* move to the next character in subAddr */ - x++; - - } /* while (subAddr[x] != '\0') */ - - /* set octet 2 aka length of subaddr */ - p = 1; - subAddrIE[p] = len + 1; - - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int type) -{ - /* Q931 4.5.9 - * 8 7 6 5 4 3 2 1 (octet) - * - * 0 1 1 1 0 0 0 1 (spare 8) ( IE id 1-7) - * X X X X X X X X (length of IE contents) - * 1 0 0 0 Z 0 0 0 (ext 8) (NSAP type 5-7) (odd/even 4) (spare 1-3) - * X X X X X X X X (sub address encoded in ia5) - */ - - int x = 0; - int p = 0; - int len = 0; - char tmp[2]; - int flag = 0; - int odd = 0; - uint8_t lower = 0x0; - uint8_t upper = 0x0; - - /* initalize the second element of tmp to \0 so that atoi doesn't go to far */ - tmp[1]='\0'; - - /* set octet 1 aka IE id */ - p = 0; - switch(type) { - /**************************************************************************/ - case SNG_CALLED: /* called party sub address */ - subAddrIE[p] = 0x71; - break; - /**************************************************************************/ - case SNG_CALLING: /* calling party sub address */ - subAddrIE[p] = 0x6d; - break; - /**************************************************************************/ - default: /* not good */ - SS7_ERROR("Sub-Address type is invalid: %d\n", type); - return FTDM_FAIL; - break; - /**************************************************************************/ - } /* switch(type) */ - - /* set the subAddrIE pointer octet 4 */ - p = 3; - - /* loop through all digits in subAddr and insert them into subAddrIE */ - while (1) { - - /* grab a character */ - tmp[0] = subAddr[x]; - - /* confirm it is a hex digit */ - while ((!isxdigit(tmp[0])) && (tmp[0] != '\0')) { - if (tmp[0] == '*') { - /* Could not find a spec that specifies this, but on customer system, * was transmitted as 0x0b */ - SS7_DEBUG("Replacing * with 0x0b"); - x++; - tmp[0] = 0x0b; - } else { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - /* move to the next character in subAddr */ - x++; - tmp[0] = subAddr[x]; - } - } - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push it into the lower nibble using strtol to allow a-f chars */ - lower = strtol(&tmp[0], (char **)NULL, 16); - /* move to the next digit */ - x++; - /* grab a digit from the ftdm digits */ - tmp[0] = subAddr[x]; - - /* check if the digit is a hex digit and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - x++; - tmp[0] = subAddr[x]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push the digit into the upper nibble using strtol to allow a-f chars */ - upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; - } else { - /* there is no upper ... fill in spare */ - upper = 0x00; - /* throw the odd flag since we need to buffer */ - odd = 1; - /* throw the end flag */ - flag = 1; - } /* if (tmp != '\0') */ - } else { - /* keep the odd flag down */ - odd = 0; - - /* throw the flag */ - flag = 1; - - /* bounce out right away */ - break; - } - - /* fill in the octet */ - subAddrIE[p] = upper | lower; - - /* increment address length counter */ - len++; - - /* if the flag is we're through all the digits */ - if (flag) break; - - /* increment the subAddrIE pointer */ - p++; - - /* move to the next character in subAddr */ - x++; - - } /* while (subAddr[x] != '\0') */ - - /* set octet 2 aka length of subaddr */ - p = 1; - subAddrIE[p] = len + 1; - - /* set octet 3 aka type and o/e */ - p = 2; - subAddrIE[p] = 0xa0 | (odd << 3); - - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -int find_mtp2_error_type_in_map(const char *err_type) -{ - int i = 0; - - while (sng_mtp2_error_type_map[i].init == 1) { - /* check if string matches the sng_type name */ - if (!strcasecmp(err_type, sng_mtp2_error_type_map[i].sng_type)) { - /* we've found a match break from the loop */ - break; - } else { - /* move on to the next on */ - i++; - } - } /* while (sng_mtp2_error_type_map[i].init == 1) */ - - /* check how we exited the loop */ - if (sng_mtp2_error_type_map[i].init == 0) { - return -1; - } else { - return i; - } /* if (sng_mtp2_error_type_map[i].init == 0) */ -} - -/******************************************************************************/ -int find_link_type_in_map(const char *linkType) -{ - int i = 0; - - while (sng_link_type_map[i].init == 1) { - /* check if string matches the sng_type name */ - if (!strcasecmp(linkType, sng_link_type_map[i].sng_type)) { - /* we've found a match break from the loop */ - break; - } else { - /* move on to the next on */ - i++; - } - } /* while (sng_link_type_map[i].init == 1) */ - - /* check how we exited the loop */ - if (sng_link_type_map[i].init == 0) { - return -1; - } else { - return i; - } /* if (sng_link_type_map[i].init == 0) */ -} - -/******************************************************************************/ -int find_switch_type_in_map(const char *switchType) -{ - int i = 0; - - while (sng_switch_type_map[i].init == 1) { - /* check if string matches the sng_type name */ - if (!strcasecmp(switchType, sng_switch_type_map[i].sng_type)) { - /* we've found a match break from the loop */ - break; - } else { - /* move on to the next on */ - i++; - } - } /* while (sng_switch_type_map[i].init == 1) */ - - /* check how we exited the loop */ - if (sng_switch_type_map[i].init == 0) { - return -1; - } else { - return i; - } /* if (sng_switch_type_map[i].init == 0) */ -} - -/******************************************************************************/ -int find_ssf_type_in_map(const char *ssfType) -{ - int i = 0; - - while (sng_ssf_type_map[i].init == 1) { - /* check if string matches the sng_type name */ - if (!strcasecmp(ssfType, sng_ssf_type_map[i].sng_type)) { - /* we've found a match break from the loop */ - break; - } else { - /* move on to the next on */ - i++; - } - } /* while (sng_ssf_type_map[i].init == 1) */ - - /* check how we exited the loop */ - if (sng_ssf_type_map[i].init == 0) { - return -1; - } else { - return i; - } /* if (sng_ssf_type_map[i].init == 0) */ -} - -/******************************************************************************/ -int find_cic_cntrl_in_map(const char *cntrlType) -{ - int i = 0; - - while (sng_cic_cntrl_type_map[i].init == 1) { - /* check if string matches the sng_type name */ - if (!strcasecmp(cntrlType, sng_cic_cntrl_type_map[i].sng_type)) { - /* we've found a match break from the loop */ - break; - } else { - /* move on to the next on */ - i++; - } - } /* while (sng_cic_cntrl_type_map[i].init == 1) */ - - /* check how we exited the loop */ - if (sng_cic_cntrl_type_map[i].init == 0) { - return -1; - } else { - return i; - } /* if (sng_cic_cntrl_type_map[i].init == 0) */ -} - -/******************************************************************************/ -ftdm_status_t check_status_of_all_isup_intf(void) -{ - sng_isup_inf_t *sngss7_intf = NULL; - uint8_t status = 0xff; - int x; - - /* go through all the isupIntfs and ask the stack to give their current state */ - x = 1; - for (x = 1; x < (MAX_ISUP_INFS); x++) { - /**************************************************************************/ - - if (g_ftdm_sngss7_data.cfg.isupIntf[x].id == 0) continue; - - sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[x]; - - if (ftmod_ss7_isup_intf_sta(sngss7_intf->id, &status)) { - SS7_ERROR("Failed to get status of ISUP intf %d\n", sngss7_intf->id); - sngss7_set_flag(sngss7_intf, SNGSS7_PAUSED); - continue; - } - - switch (status){ - /**********************************************************************/ - case (SI_INTF_AVAIL): - SS7_DEBUG("State of ISUP intf %d = AVAIL\n", sngss7_intf->id); - - /* check the current state for interface that we know */ - if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { - /* we thing the intf is paused...put into resume */ - sngss7_clear_flag(sngss7_intf, SNGSS7_PAUSED); - } else { - /* nothing to since we already know that interface is active */ - } - break; - /**********************************************************************/ - case (SI_INTF_UNAVAIL): - SS7_DEBUG("State of ISUP intf %d = UNAVAIL\n", sngss7_intf->id); - /* check the current state for interface that we know */ - if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { - /* nothing to since we already know that interface is active */ - } else { - /* put the interface into pause */ - sngss7_set_flag(sngss7_intf, SNGSS7_PAUSED); - } - break; - /**********************************************************************/ - case (SI_INTF_CONG1): - SS7_DEBUG("State of ISUP intf %d = Congestion 1\n", sngss7_intf->id); - break; - /**********************************************************************/ - case (SI_INTF_CONG2): - SS7_DEBUG("State of ISUP intf %d = Congestion 2\n", sngss7_intf->id); - break; - /**********************************************************************/ - case (SI_INTF_CONG3): - SS7_DEBUG("State of ISUP intf %d = Congestion 3\n", sngss7_intf->id); - break; - /**********************************************************************/ - default: - /* should do something here to handle the possiblity of an unknown case */ - SS7_ERROR("Unknown ISUP intf Status code (%d) for Intf = %d\n", status, sngss7_intf->id); - break; - /**********************************************************************/ - } /* switch (status) */ - - /**************************************************************************/ - } /* for (x = 1; x < MAX_ISUP_INFS); i++) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t sngss7_add_var(sngss7_chan_data_t *sngss7_info, const char* var, const char* val) -{ - char *t_name = 0; - char *t_val = 0; - - /* confirm the user has sent us a value */ - if (!var || !val) { - return FTDM_FAIL; - } - - if (!sngss7_info->variables) { - /* initialize on first use */ - sngss7_info->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); - ftdm_assert_return(sngss7_info->variables, FTDM_FAIL, "Failed to create hash table\n"); - } - - t_name = ftdm_strdup(var); - t_val = ftdm_strdup(val); - - hashtable_insert(sngss7_info->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len) -{ - ftdm_assert_return(!sngss7_info->raw_data, FTDM_FAIL, "Overwriting existing raw data\n"); - - sngss7_info->raw_data = ftdm_calloc(1, data_len); - ftdm_assert_return(sngss7_info->raw_data, FTDM_FAIL, "Failed to allocate raw data\n"); - - memcpy(sngss7_info->raw_data, data, data_len); - sngss7_info->raw_data_len = data_len; - return FTDM_SUCCESS; -} - -/******************************************************************************/ -void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id) -{ - ftdm_sigmsg_t sigev; - ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - - memset(&sigev, 0, sizeof(sigev)); - - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - sigev.event_id = event_id; - - if (sngss7_info->variables) { - /* - * variables now belongs to the ftdm core, and - * will be cleared after sigev is processed by user. Set - * local pointer to NULL so we do not attempt to - * destroy it */ - sigev.variables = sngss7_info->variables; - sngss7_info->variables = NULL; - } - - if (sngss7_info->raw_data) { - /* - * raw_data now belongs to the ftdm core, and - * will be cleared after sigev is processed by user. Set - * local pointer to NULL so we do not attempt to - * destroy it */ - - sigev.raw.data = sngss7_info->raw_data; - sigev.raw.len = sngss7_info->raw_data_len; - - sngss7_info->raw_data = NULL; - sngss7_info->raw_data_len = 0; - } - ftdm_span_send_signal(ftdmchan->span, &sigev); -} - -/******************************************************************************/ -void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status) -{ - ftdm_sigmsg_t sig; - ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n", - ftdm_signaling_status2str(status)); - - memset(&sig, 0, sizeof(sig)); - - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.ev_data.sigstatus.status = status; - - if (ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to change channel status to %s\n", - ftdm_signaling_status2str(status)); - } - return; -} - -#if 0 -ftdm_status_t check_for_invalid_states(ftdm_channel_t *ftmchan) -{ - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - if (!sngss7_info) { - SS7_WARN_CHAN(ftdmchan, "Found ftdmchan with no sig module data!%s\n", " "); - return FTDM_FAIL; - } - - if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { - return FTDM_SUCCESS; - } - - switch (ftdmchan->state) { - case UP: - case DOWN: - return FTDM_SUCCESS; - - default: - if ((ftdm_current_time_in_ms() - ftdmchan->last_state_change_time) > 30000) { - SS7_WARN_CHAN(ftdmchan, "Circuite in state=%s too long - resetting!%s\n", - ftdm_channel_state2str(ftdmchan->state)); - - ftdm_channel_lock(ftdmchan); - - if (sngss7_channel_status_clear(sngss7_info)) { - sngss7_tx_reset_restart(sngss7_info); - - if (ftdmchan->state == FTDM_CHANNEL_STATE_RESTART) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } else { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - } else { - - } - - - - ftdm_channel_unlock(ftdmchan); - } - } - - return FTDM_SUCCESS; -} -#endif - - -/******************************************************************************/ -ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan) -{ - ftdm_channel_t *ftdmchan = NULL; - sngss7_chan_data_t *sngss7_info = NULL; - sng_isup_inf_t *sngss7_intf = NULL; - uint8_t state; - uint8_t bits_ab = 0; - uint8_t bits_cd = 0; - uint8_t bits_ef = 0; - int x; - int ret; - ret=0; - - for (x = 1; x < (ftdmspan->chan_count + 1); x++) { - /**************************************************************************/ - /* extract the channel structure and sngss7 channel data */ - ftdmchan = ftdmspan->channels[x]; - - /* if the call data is NULL move on */ - if (ftdmchan->call_data == NULL) { - SS7_WARN_CHAN(ftdmchan, "Found ftdmchan with no sig module data!%s\n", " "); - continue; - } - - /* grab the private data */ - sngss7_info = ftdmchan->call_data; - - /* check the reconfig flag */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG)) { - /* confirm the state of all isup interfaces*/ - check_status_of_all_isup_intf(); - - sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; - - /* check if the interface is paused or resumed */ - if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Circuit set to PAUSED %s\n"," "); - /* throw the pause flag */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Circuit set to RESUMED %s\n"," "); - /* throw the resume flag */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME); - } - - /* query for the status of the ckt */ - if (ftmod_ss7_isup_ckt_sta(sngss7_info->circuit->id, &state)) { - /* NC: Circuit statistic failed: does not exist. Must re-configure circuit - Reset the circuit CONFIGURED flag so that RESUME will reconfigure - this circuit. */ - sngss7_info->circuit->flags &= ~SNGSS7_CONFIGURED; - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR,"Failed to read isup ckt = %d status\n", sngss7_info->circuit->id); - continue; - } - - /* extract the bit sections */ - bits_ab = (state & (SNG_BIT_A + SNG_BIT_B)) >> 0; - bits_cd = (state & (SNG_BIT_C + SNG_BIT_D)) >> 2; - bits_ef = (state & (SNG_BIT_E + SNG_BIT_F)) >> 4; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Circuit state=0x%X ab=0x%X cd=0x%X ef=0x%X\n",state,bits_ab,bits_cd,bits_ef); - - if (bits_cd == 0x0) { - /* check if circuit is UCIC or transient */ - if (bits_ab == 0x3) { - SS7_INFO("ISUP CKT %d re-configuration pending!\n", x); - sngss7_info->circuit->flags &= ~SNGSS7_CONFIGURED; - SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* NC: The code below should be deleted. Its here for hitorical - reason. The RESUME code will reconfigure the channel since - the CONFIGURED flag has been reset */ -#if 0 - /* bit a and bit b are set, unequipped */ - ret = ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id); - if (ret) { - SS7_CRITICAL("ISUP CKT %d re-configuration FAILED!\n",x); - } else { - SS7_INFO("ISUP CKT %d re-configuration DONE!\n", x); - } - - /* reset the circuit to sync states */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* flag the circuit as active */ - sngss7_set_flag(sngss7_info->circuit, SNGSS7_ACTIVE); - - /* throw the channel into reset */ - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX); - - /* throw the channel to suspend */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); -#endif - - } else { /* if (bits_ab == 0x3) */ - /* The stack status is not blocked. However this is possible if - the circuit state was UP. So even though Master sent out the BLO - the status command is not showing it. - - As a kudge. We will try to send out an UBL even though the status - indicates that there is no BLO. */ - if (!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) { - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX); - - /* set the channel to suspended state */ - SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - } - } else { - /* check the maintenance block status in bits A and B */ - switch (bits_ab) { - /**************************************************************************/ - case (0): - /* no maintenace block...do nothing */ - break; - /**************************************************************************/ - case (1): - /* The stack status is Blocked. Check if the block was sent - by user via console. If the block was not sent by user then, it - was sent out by Master due to relay down. - Therefore send out the unblock to clear it */ - if (!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) { - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX); - - /* set the channel to suspended state */ - SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* Only locally blocked, thus remove a remote block */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); - - break; - /**************************************************************************/ - case (2): - /* remotely blocked */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); - - /* set the channel to suspended state */ - SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - break; - /**************************************************************************/ - case (3): - /* both locally and remotely blocked */ - if (!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) { - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX); - } - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); - - /* set the channel to suspended state */ - SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - break; - /**************************************************************************/ - default: - break; - /**************************************************************************/ - } /* switch (bits_ab) */ - - /* check the hardware block status in bits e and f */ - switch (bits_ef) { - /**************************************************************************/ - case (0): - /* no maintenace block...do nothing */ - break; - /**************************************************************************/ - case (1): - /* locally blocked */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX); - - /* set the channel to suspended state */ - SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - break; - /**************************************************************************/ - case (2): - /* remotely blocked */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); - - /* set the channel to suspended state */ - SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - break; - /**************************************************************************/ - case (3): - /* both locally and remotely blocked */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX); - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); - - /* set the channel to suspended state */ - SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - break; - /**************************************************************************/ - default: - break; - /**************************************************************************/ - } /* switch (bits_ef) */ - } - - /* clear the re-config flag ... no matter what */ - sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG); - - } - } /* for (x = 1; x < (span->chan_count + 1); x++) */ - - return FTDM_SUCCESS; -} - -ftdm_status_t sngss7_bufferzero_iam(SiConEvnt *siConEvnt) -{ - if (siConEvnt->natConInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->natConInd, 0, sizeof(siConEvnt->natConInd)); - if (siConEvnt->fwdCallInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->fwdCallInd, 0, sizeof(siConEvnt->fwdCallInd)); - if (siConEvnt->cgPtyCat.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cgPtyCat, 0, sizeof(siConEvnt->cgPtyCat)); - if (siConEvnt->txMedReq.eh.pres != PRSNT_NODEF) memset(&siConEvnt->txMedReq, 0, sizeof(siConEvnt->txMedReq)); -#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) - if (siConEvnt->usrServInfoA.eh.pres != PRSNT_NODEF) memset(&siConEvnt->usrServInfoA, 0, sizeof(siConEvnt->usrServInfoA)); -#endif - if (siConEvnt->cdPtyNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cdPtyNum, 0, sizeof(siConEvnt->cdPtyNum)); -#if TNS_ANSI -#if (SS7_ANS92 || SS7_ANS95 || SS7_BELL) - if (siConEvnt->tranNetSel1.eh.pres != PRSNT_NODEF) memset(&siConEvnt->tranNetSel1, 0, sizeof(siConEvnt->tranNetSel1)); -#endif -#endif - if (siConEvnt->tranNetSel.eh.pres != PRSNT_NODEF) memset(&siConEvnt->tranNetSel, 0, sizeof(siConEvnt->tranNetSel)); -#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL || SS7_CHINA) - if (siConEvnt->callRefA.eh.pres != PRSNT_NODEF) memset(&siConEvnt->callRefA, 0, sizeof(siConEvnt->callRefA)); -#endif - if (siConEvnt->callRef.eh.pres != PRSNT_NODEF) memset(&siConEvnt->callRef, 0, sizeof(siConEvnt->callRef)); - if (siConEvnt->cgPtyNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cgPtyNum, 0, sizeof(siConEvnt->cgPtyNum)); -#if SS7_BELL - if (siConEvnt->cgPtyNumB.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cgPtyNumB, 0, sizeof(siConEvnt->cgPtyNumB)); -#endif - if (siConEvnt->opFwdCalInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->opFwdCalInd, 0, sizeof(siConEvnt->opFwdCalInd)); -#if (SS7_Q767 || SS7_RUSSIA || SS7_NTT) - if (siConEvnt->opFwdCalIndQ.eh.pres != PRSNT_NODEF) memset(&siConEvnt->opFwdCalIndQ, 0, sizeof(siConEvnt->opFwdCalIndQ)); -#endif -#if SS7_Q767IT - if (siConEvnt->fwdVad.eh.pres != PRSNT_NODEF) memset(&siConEvnt->fwdVad, 0, sizeof(siConEvnt->fwdVad)); -#endif -#if SS7_ANS88 - if (siConEvnt->opFwdCalIndA.eh.pres != PRSNT_NODEF) memset(&siConEvnt->opFwdCalIndA, 0, sizeof(siConEvnt->opFwdCalIndA)); -#endif - if (siConEvnt->redirgNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->redirgNum, 0, sizeof(siConEvnt->redirgNum)); - if (siConEvnt->redirInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->redirInfo, 0, sizeof(siConEvnt->redirInfo)); - if (siConEvnt->cugIntCode.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cugIntCode, 0, sizeof(siConEvnt->cugIntCode)); -#if SS7_ANS88 - if (siConEvnt->cugIntCodeA.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cugIntCodeA, 0, sizeof(siConEvnt->cugIntCodeA)); -#endif -#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL || SS7_CHINA) - if (siConEvnt->connReqA.eh.pres != PRSNT_NODEF) memset(&siConEvnt->connReqA, 0, sizeof(siConEvnt->connReqA)); -#endif -#if SS7_ANS88 - if (siConEvnt->usr2UsrInfoA.eh.pres != PRSNT_NODEF) memset(&siConEvnt->usr2UsrInfoA, 0, sizeof(siConEvnt->usr2UsrInfoA)); -#endif - if (siConEvnt->connReq.eh.pres != PRSNT_NODEF) memset(&siConEvnt->connReq, 0, sizeof(siConEvnt->connReq)); - if (siConEvnt->origCdNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->origCdNum, 0, sizeof(siConEvnt->origCdNum)); - if (siConEvnt->usr2UsrInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->usr2UsrInfo, 0, sizeof(siConEvnt->usr2UsrInfo)); - if (siConEvnt->accTrnspt.eh.pres != PRSNT_NODEF) memset(&siConEvnt->accTrnspt, 0, sizeof(siConEvnt->accTrnspt)); - if (siConEvnt->echoControl.eh.pres != PRSNT_NODEF) memset(&siConEvnt->echoControl, 0, sizeof(siConEvnt->echoControl)); -#if SS7_ANS88 - if (siConEvnt->redirInfoA.eh.pres != PRSNT_NODEF) memset(&siConEvnt->redirInfoA, 0, sizeof(siConEvnt->redirInfoA)); -#endif -#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) - if (siConEvnt->chargeNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->chargeNum, 0, sizeof(siConEvnt->chargeNum)); - if (siConEvnt->origLineInf.eh.pres != PRSNT_NODEF) memset(&siConEvnt->origLineInf, 0, sizeof(siConEvnt->origLineInf)); -#endif - if (siConEvnt->usrServInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->usrServInfo, 0, sizeof(siConEvnt->usrServInfo)); - if (siConEvnt->usr2UsrInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->usr2UsrInd, 0, sizeof(siConEvnt->usr2UsrInd)); - if (siConEvnt->propDly.eh.pres != PRSNT_NODEF) memset(&siConEvnt->propDly, 0, sizeof(siConEvnt->propDly)); - if (siConEvnt->usrServInfo1.eh.pres != PRSNT_NODEF) memset(&siConEvnt->usrServInfo1, 0, sizeof(siConEvnt->usrServInfo1)); - if (siConEvnt->netFac.eh.pres != PRSNT_NODEF) memset(&siConEvnt->netFac, 0, sizeof(siConEvnt->netFac)); -#ifdef SS7_CHINA - if (siConEvnt->orgPteCdeA.eh.pres != PRSNT_NODEF) memset(&siConEvnt->orgPteCdeA, 0, sizeof(siConEvnt->orgPteCdeA)); -#endif - if (siConEvnt->orgPteCde.eh.pres != PRSNT_NODEF) memset(&siConEvnt->orgPteCde, 0, sizeof(siConEvnt->orgPteCde)); - if (siConEvnt->genDigits.eh.pres != PRSNT_NODEF) memset(&siConEvnt->genDigits, 0, sizeof(siConEvnt->genDigits)); - if (siConEvnt->genDigitsR.eh.pres != PRSNT_NODEF) memset(&siConEvnt->genDigitsR, 0, sizeof(siConEvnt->genDigitsR)); - if (siConEvnt->usrTSrvInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->usrTSrvInfo, 0, sizeof(siConEvnt->usrTSrvInfo)); - if (siConEvnt->remotOper.eh.pres != PRSNT_NODEF) memset(&siConEvnt->remotOper, 0, sizeof(siConEvnt->remotOper)); - if (siConEvnt->parmCom.eh.pres != PRSNT_NODEF) memset(&siConEvnt->parmCom, 0, sizeof(siConEvnt->parmCom)); -#if (SS7_ANS92 || SS7_ANS95) - if (siConEvnt->servCode.eh.pres != PRSNT_NODEF) memset(&siConEvnt->servCode, 0, sizeof(siConEvnt->servCode)); -#endif -#if SS7_ANS92 - if (siConEvnt->serviceAct1.eh.pres != PRSNT_NODEF) memset(&siConEvnt->serviceAct1, 0, sizeof(siConEvnt->serviceAct1)); -#endif -#if SS7_CHINA - if (siConEvnt->serviceAct2.eh.pres != PRSNT_NODEF) memset(&siConEvnt->serviceAct2, 0, sizeof(siConEvnt->serviceAct2)); -#endif - if (siConEvnt->serviceAct2.eh.pres != PRSNT_NODEF) memset(&siConEvnt->serviceAct2, 0, sizeof(siConEvnt->serviceAct2)); - if (siConEvnt->serviceAct.eh.pres != PRSNT_NODEF) memset(&siConEvnt->serviceAct, 0, sizeof(siConEvnt->serviceAct)); - if (siConEvnt->mlppPrec.eh.pres != PRSNT_NODEF) memset(&siConEvnt->mlppPrec, 0, sizeof(siConEvnt->mlppPrec)); -#if (defined(SIT_PARAMETER) || defined(TDS_ROLL_UPGRADE_SUPPORT)) - if (siConEvnt->txMedUsPr.eh.pres != PRSNT_NODEF) memset(&siConEvnt->txMedUsPr, 0, sizeof(siConEvnt->txMedUsPr)); -#endif - if (siConEvnt->bckCallInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->bckCallInd, 0, sizeof(siConEvnt->bckCallInd)); - if (siConEvnt->cgPtyNum1.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cgPtyNum1, 0, sizeof(siConEvnt->cgPtyNum1)); - if (siConEvnt->optBckCalInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->optBckCalInd, 0, sizeof(siConEvnt->optBckCalInd)); -#if (SS7_Q767 || SS7_RUSSIA || SS7_NTT) - if (siConEvnt->optBckCalIndQ.eh.pres != PRSNT_NODEF) memset(&siConEvnt->optBckCalIndQ, 0, sizeof(siConEvnt->optBckCalIndQ)); -#endif - if (siConEvnt->connNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->connNum, 0, sizeof(siConEvnt->connNum)); -#if (defined(SIT_PARAMETER) || defined(TDS_ROLL_UPGRADE_SUPPORT)) - if (siConEvnt->connNum2.eh.pres != PRSNT_NODEF) memset(&siConEvnt->connNum2, 0, sizeof(siConEvnt->connNum2)); -#endif - if (siConEvnt->accDelInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->accDelInfo, 0, sizeof(siConEvnt->accDelInfo)); - if (siConEvnt->notifInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->notifInd, 0, sizeof(siConEvnt->notifInd)); - if (siConEvnt->notifIndR2.eh.pres != PRSNT_NODEF) memset(&siConEvnt->notifIndR2, 0, sizeof(siConEvnt->notifIndR2)); - if (siConEvnt->cllHstry.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cllHstry, 0, sizeof(siConEvnt->cllHstry)); - if (siConEvnt->genNmb.eh.pres != PRSNT_NODEF) memset(&siConEvnt->genNmb, 0, sizeof(siConEvnt->genNmb)); - if (siConEvnt->genNmbR.eh.pres != PRSNT_NODEF) memset(&siConEvnt->genNmbR, 0, sizeof(siConEvnt->genNmbR)); - if (siConEvnt->redirNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->redirNum, 0, sizeof(siConEvnt->redirNum)); - if (siConEvnt->redirRstr.eh.pres != PRSNT_NODEF) memset(&siConEvnt->redirRstr, 0, sizeof(siConEvnt->redirRstr)); - -#if SS7_Q767IT - if (siConEvnt->backVad.eh.pres != PRSNT_NODEF) memset(&siConEvnt->backVad, 0, sizeof(siConEvnt->backVad)); -#endif -#if SS7_SINGTEL - if (siConEvnt->cgPtyNumS.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cgPtyNumS, 0, sizeof(siConEvnt->cgPtyNumS)); -#endif -#if (SS7_ANS92 || SS7_ANS95 || SS7_BELL) - if (siConEvnt->businessGrp.eh.pres != PRSNT_NODEF) memset(&siConEvnt->businessGrp, 0, sizeof(siConEvnt->businessGrp)); - if (siConEvnt->infoInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->infoInd, 0, sizeof(siConEvnt->infoInd)); - if (siConEvnt->carrierId.eh.pres != PRSNT_NODEF) memset(&siConEvnt->carrierId, 0, sizeof(siConEvnt->carrierId)); - if (siConEvnt->carSelInf.eh.pres != PRSNT_NODEF) memset(&siConEvnt->carSelInf, 0, sizeof(siConEvnt->carSelInf)); - if (siConEvnt->egress.eh.pres != PRSNT_NODEF) memset(&siConEvnt->egress, 0, sizeof(siConEvnt->egress)); - if (siConEvnt->genAddr.eh.pres != PRSNT_NODEF) memset(&siConEvnt->genAddr, 0, sizeof(siConEvnt->genAddr)); - if (siConEvnt->genAddrR.eh.pres != PRSNT_NODEF) memset(&siConEvnt->genAddrR, 0, sizeof(siConEvnt->genAddrR)); - if (siConEvnt->infoReqInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->infoReqInd, 0, sizeof(siConEvnt->infoReqInd)); - if (siConEvnt->jurisInf.eh.pres != PRSNT_NODEF) memset(&siConEvnt->jurisInf, 0, sizeof(siConEvnt->jurisInf)); - if (siConEvnt->netTransport.eh.pres != PRSNT_NODEF) memset(&siConEvnt->netTransport, 0, sizeof(siConEvnt->netTransport)); - if (siConEvnt->specProcReq.eh.pres != PRSNT_NODEF) memset(&siConEvnt->specProcReq, 0, sizeof(siConEvnt->specProcReq)); - if (siConEvnt->transReq.eh.pres != PRSNT_NODEF) memset(&siConEvnt->transReq, 0, sizeof(siConEvnt->transReq)); -#endif -#if (defined(SIT_PARAMETER) || defined(TDS_ROLL_UPGRADE_SUPPORT)) -#if (SS7_ANS92 || SS7_ANS95) - if (siConEvnt->notifInd1.eh.pres != PRSNT_NODEF) memset(&siConEvnt->notifInd1, 0, sizeof(siConEvnt->notifInd1)); - if (siConEvnt->notifIndR1.eh.pres != PRSNT_NODEF) memset(&siConEvnt->notifIndR1, 0, sizeof(siConEvnt->notifIndR1)); -#endif /* SS7_ANS92 */ -#endif /* SIT_PARAMETER || TDS_ROLL_UPGRADE_SUPPORT */ -#if (SS7_BELL || SS7_ANS95) - if (siConEvnt->genName.eh.pres != PRSNT_NODEF) memset(&siConEvnt->genName, 0, sizeof(siConEvnt->genName)); -#endif -#if (SS7_ITU97 || SS7_RUSS2000 || SS7_ITU2000 || SS7_ETSIV3 || \ - SS7_BELL || SS7_ANS95 || SS7_INDIA || SS7_UK || SS7_NZL || SS7_KZ) - if (siConEvnt->hopCounter.eh.pres != PRSNT_NODEF) memset(&siConEvnt->hopCounter, 0, sizeof(siConEvnt->hopCounter)); -#endif -#if (SS7_BELL || SS7_ITU2000 || SS7_KZ) - if (siConEvnt->redirCap.eh.pres != PRSNT_NODEF) memset(&siConEvnt->redirCap, 0, sizeof(siConEvnt->redirCap)); - if (siConEvnt->redirCntr.eh.pres != PRSNT_NODEF) memset(&siConEvnt->redirCntr, 0, sizeof(siConEvnt->redirCntr)); -#endif -#if (SS7_ETSI || SS7_FTZ) - if (siConEvnt->ccbsParam.eh.pres != PRSNT_NODEF) memset(&siConEvnt->ccbsParam, 0, sizeof(siConEvnt->ccbsParam)); - if (siConEvnt->freePhParam.eh.pres != PRSNT_NODEF) memset(&siConEvnt->freePhParam, 0, sizeof(siConEvnt->freePhParam)); -#endif -#ifdef SS7_FTZ - if (siConEvnt->naPaFF.eh.pres != PRSNT_NODEF) memset(&siConEvnt->naPaFF, 0, sizeof(siConEvnt->naPaFF)); - if (siConEvnt->naPaFE.eh.pres != PRSNT_NODEF) memset(&siConEvnt->naPaFE, 0, sizeof(siConEvnt->naPaFE)); - if (siConEvnt->naPaSSP.eh.pres != PRSNT_NODEF) memset(&siConEvnt->naPaSSP, 0, sizeof(siConEvnt->naPaSSP)); - if (siConEvnt->naPaCdPNO.eh.pres != PRSNT_NODEF) memset(&siConEvnt->naPaCdPNO, 0, sizeof(siConEvnt->naPaCdPNO)); - if (siConEvnt->naPaSPV.eh.pres != PRSNT_NODEF) memset(&siConEvnt->naPaSPV, 0, sizeof(siConEvnt->naPaSPV)); - if (siConEvnt->naPaUKK.eh.pres != PRSNT_NODEF) memset(&siConEvnt->naPaUKK, 0, sizeof(siConEvnt->naPaUKK)); -#endif -#if SS7_NTT - if (siConEvnt->msgAreaInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->msgAreaInfo, 0, sizeof(siConEvnt->msgAreaInfo)); - if (siConEvnt->subsNumber.eh.pres != PRSNT_NODEF) memset(&siConEvnt->subsNumber, 0, sizeof(siConEvnt->subsNumber)); - if (siConEvnt->rpCllngNo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->rpCllngNo, 0, sizeof(siConEvnt->rpCllngNo)); - if (siConEvnt->supplUserType.eh.pres != PRSNT_NODEF) memset(&siConEvnt->supplUserType, 0, sizeof(siConEvnt->supplUserType)); - if (siConEvnt->carrierInfoTrans.eh.pres != PRSNT_NODEF) memset(&siConEvnt->carrierInfoTrans, 0, sizeof(siConEvnt->carrierInfoTrans)); - if (siConEvnt->nwFuncType.eh.pres != PRSNT_NODEF) memset(&siConEvnt->nwFuncType, 0, sizeof(siConEvnt->nwFuncType)); -#endif -#if SS7_ANS95 - if (siConEvnt->optrServicesInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->optrServicesInfo, 0, sizeof(siConEvnt->optrServicesInfo)); -#endif -#if (SS7_ANS95 || SS7_ITU97 || SS7_RUSS2000|| SS7_ITU2000 || SS7_NZL || SS7_KZ) - if (siConEvnt->cirAsgnMap.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cirAsgnMap, 0, sizeof(siConEvnt->cirAsgnMap)); -#endif -#if (SS7_ITU97 || SS7_RUSS2000 || SS7_ITU2000 || SS7_ETSIV3 || \ - SS7_INDIA || SS7_UK || SS7_NZL || SS7_KZ) - if (siConEvnt->displayInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->displayInfo, 0, sizeof(siConEvnt->displayInfo)); - if (siConEvnt->confTrtInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->confTrtInd, 0, sizeof(siConEvnt->confTrtInd)); - if (siConEvnt->netMgmtControls.eh.pres != PRSNT_NODEF) memset(&siConEvnt->netMgmtControls, 0, sizeof(siConEvnt->netMgmtControls)); - if (siConEvnt->correlationId.eh.pres != PRSNT_NODEF) memset(&siConEvnt->correlationId, 0, sizeof(siConEvnt->correlationId)); - if (siConEvnt->callDivTrtInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->callDivTrtInd, 0, sizeof(siConEvnt->callDivTrtInd)); - if (siConEvnt->callInNmb.eh.pres != PRSNT_NODEF) memset(&siConEvnt->callInNmb, 0, sizeof(siConEvnt->callInNmb)); - if (siConEvnt->callOfferTrtInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->callOfferTrtInd, 0, sizeof(siConEvnt->callOfferTrtInd)); - if (siConEvnt->scfId.eh.pres != PRSNT_NODEF) memset(&siConEvnt->scfId, 0, sizeof(siConEvnt->scfId)); - if (siConEvnt->uidCapInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->uidCapInd, 0, sizeof(siConEvnt->uidCapInd)); - if (siConEvnt->collCallReq.eh.pres != PRSNT_NODEF) memset(&siConEvnt->collCallReq, 0, sizeof(siConEvnt->collCallReq)); - if (siConEvnt->ccss.eh.pres != PRSNT_NODEF) memset(&siConEvnt->ccss, 0, sizeof(siConEvnt->ccss)); -#endif -#if (SS7_ITU97 || SS7_RUSS2000 || SS7_ITU2000 || SS7_UK || SS7_NZL || SS7_KZ) - if (siConEvnt->backGVNS.eh.pres != PRSNT_NODEF) memset(&siConEvnt->backGVNS, 0, sizeof(siConEvnt->backGVNS)); - if (siConEvnt->forwardGVNS.eh.pres != PRSNT_NODEF) memset(&siConEvnt->forwardGVNS, 0, sizeof(siConEvnt->forwardGVNS)); -#endif -#if (SS7_ETSIV3 || SS7_ITU97 || SS7_RUSS2000 || SS7_ITU2000 || \ - SS7_INDIA || SS7_UK || SS7_NZL || SS7_KZ) - if (siConEvnt->appTransParam.eh.pres != PRSNT_NODEF) memset(&siConEvnt->appTransParam, 0, sizeof(siConEvnt->appTransParam)); -#endif -#if (SS7_ITU2000 || SS7_UK || SS7_NZL || SS7_KZ) - if (siConEvnt->htrInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->htrInfo, 0, sizeof(siConEvnt->htrInfo)); - if (siConEvnt->pivotCap.eh.pres != PRSNT_NODEF) memset(&siConEvnt->pivotCap, 0, sizeof(siConEvnt->pivotCap)); - if (siConEvnt->cadDirNmb.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cadDirNmb, 0, sizeof(siConEvnt->cadDirNmb)); - if (siConEvnt->origCallInNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->origCallInNum, 0, sizeof(siConEvnt->origCallInNum)); - if (siConEvnt->calgGeoLoc.eh.pres != PRSNT_NODEF) memset(&siConEvnt->calgGeoLoc, 0, sizeof(siConEvnt->calgGeoLoc)); - if (siConEvnt->netRoutNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->netRoutNum, 0, sizeof(siConEvnt->netRoutNum)); - if (siConEvnt->qonRelCap.eh.pres != PRSNT_NODEF) memset(&siConEvnt->qonRelCap, 0, sizeof(siConEvnt->qonRelCap)); - if (siConEvnt->pivotCntr.eh.pres != PRSNT_NODEF) memset(&siConEvnt->pivotCntr, 0, sizeof(siConEvnt->pivotCntr)); - if (siConEvnt->pivotRtgFwInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->pivotRtgFwInfo, 0, sizeof(siConEvnt->pivotRtgFwInfo)); - if (siConEvnt->pivotRtgBkInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->pivotRtgBkInfo, 0, sizeof(siConEvnt->pivotRtgBkInfo)); - if (siConEvnt->numPortFwdInfo.eh.pres != PRSNT_NODEF) memset(&siConEvnt->numPortFwdInfo, 0, sizeof(siConEvnt->numPortFwdInfo)); -#endif -#ifdef SS7_UK - if (siConEvnt->natFwdCalInd.eh.pres != PRSNT_NODEF) memset(&siConEvnt->natFwdCalInd, 0, sizeof(siConEvnt->natFwdCalInd)); - if (siConEvnt->presntNum.eh.pres != PRSNT_NODEF) memset(&siConEvnt->presntNum, 0, sizeof(siConEvnt->presntNum)); - if (siConEvnt->lstDvrtLineId.eh.pres != PRSNT_NODEF) memset(&siConEvnt->lstDvrtLineId, 0, sizeof(siConEvnt->lstDvrtLineId)); - if (siConEvnt->pcgLineId.eh.pres != PRSNT_NODEF) memset(&siConEvnt->pcgLineId, 0, sizeof(siConEvnt->pcgLineId)); - if (siConEvnt->natFwdCalIndLnk.eh.pres != PRSNT_NODEF) memset(&siConEvnt->natFwdCalIndLnk, 0, sizeof(siConEvnt->natFwdCalIndLnk)); - if (siConEvnt->cdBascSrvcMrk.eh.pres != PRSNT_NODEF) memset(&siConEvnt->cdBascSrvcMrk, 0, sizeof(siConEvnt->cdBascSrvcMrk)); -#endif /* SS7_UK */ -#if (defined(CGPN_CHK)) - if (siConEvnt->causeDgnCgPnChk.eh.pres != PRSNT_NODEF) memset(&siConEvnt->causeDgnCgPnChk, 0, sizeof(siConEvnt->causeDgnCgPnChk)); -#endif - return FTDM_SUCCESS; -} - -ftdm_status_t sngss7_save_iam(ftdm_channel_t *ftdmchan, SiConEvnt *siConEvnt) -{ -#ifndef HAVE_ZLIB - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Cannot perform transparent IAM because zlib is missing\n"); - return FTDM_FAIL; -#else - unsigned ret_val = FTDM_FAIL; - char *compressed_iam = NULL; - char *url_encoded_iam = NULL; - uLongf len = sizeof(*siConEvnt); - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - /* By default, Trillium does not memset their whole structure to zero for - * performance. But we want to memset all the IE's that are not present to - * optimize compressed size */ - sngss7_bufferzero_iam(siConEvnt); - - compressed_iam = ftdm_malloc(sizeof(*siConEvnt)); - if (!compressed_iam) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to allocate buffer for compressed_iam\n"); - goto done; - } - - /* Compress IAM structure to minimize buffer size */ - ret_val = compress((Bytef *)compressed_iam, &len, (const Bytef *)siConEvnt, (uLong)sizeof(*siConEvnt)); - if (ret_val != Z_OK) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Failed to compress IAM (error:%d)\n", ret_val); - ret_val = FTDM_FAIL; - goto done; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Compressed IAM size:%lu\n", len); - - /* Worst case: size will triple after url encode */ - url_encoded_iam = ftdm_malloc(3*sizeof(*siConEvnt)); - if (!url_encoded_iam) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to allocated buffer for url_encoded_iam\n"); - ret_val = FTDM_FAIL; - goto done; - } - memset(url_encoded_iam, 0, 2*sizeof(*siConEvnt)); - - /* URL encode buffer to that its safe to store it in a string */ - ftdm_url_encode((const char*)compressed_iam, url_encoded_iam, len); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "IAM variable length:%"FTDM_SIZE_FMT"\n", strlen(url_encoded_iam)); - - if (strlen(url_encoded_iam) > sngss7_info->circuit->transparent_iam_max_size) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "IAM variable length exceeds max size (len:%d max:%d) \n", - strlen(url_encoded_iam), sngss7_info->circuit->transparent_iam_max_size); - ret_val = FTDM_FAIL; - goto done; - } - - sngss7_add_var(sngss7_info, "ss7_iam", url_encoded_iam); -done: - ftdm_safe_free(compressed_iam); - ftdm_safe_free(url_encoded_iam); - return ret_val; -#endif -} - -ftdm_status_t sngss7_retrieve_iam(ftdm_channel_t *ftdmchan, SiConEvnt *siConEvnt) -{ -#ifndef HAVE_ZLIB - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Cannot perform transparent IAM because zlib is missing\n"); - return FTDM_FAIL; -#else - uLongf len = 3*sizeof(*siConEvnt); /* worst case: URL encoded buffer is 3x length of buffer */ - char *val = NULL; - unsigned ret_val = FTDM_FAIL; - void *uncompressed_buffer = NULL; - char *url_encoded_iam = NULL; - ftdm_size_t url_encoded_iam_len; - - val = (char*)ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_iam"); - if (ftdm_strlen_zero(val)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Transparent IAM info available\n"); - return FTDM_FAIL; - } - - url_encoded_iam = ftdm_strdup(val); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "IAM variable length:%"FTDM_SIZE_FMT"\n", strlen(val)); - ftdm_url_decode(url_encoded_iam, &url_encoded_iam_len); - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Compressed IAM size:%"FTDM_SIZE_FMT"\n", url_encoded_iam_len); - - uncompressed_buffer = ftdm_malloc(sizeof(*siConEvnt)); - ftdm_assert_return(uncompressed_buffer, FTDM_FAIL, "Failed to allocate buffer for uncompressed buffer\n"); - - ret_val = uncompress(uncompressed_buffer, &len, (const Bytef *)url_encoded_iam, (uLong)url_encoded_iam_len); - if (ret_val != Z_OK) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Failed to uncompress IAM (error:%d)\n", ret_val); - goto done; - } - - if (len != sizeof(*siConEvnt)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Incompatible IAM structure size (expected:%"FTDM_SIZE_FMT" size:%"FTDM_SIZE_FMT")\n", sizeof(*siConEvnt), strlen(uncompressed_buffer)); - goto done; - } - - memcpy(siConEvnt, uncompressed_buffer, sizeof(*siConEvnt)); - ret_val = FTDM_SUCCESS; - -done: - ftdm_safe_free(uncompressed_buffer); - ftdm_safe_free(url_encoded_iam); - return ret_val; -#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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c deleted file mode 100644 index 541f107704..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2009, Sangoma Technologies - * Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ - -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ - -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ -void handle_isup_t35(void *userdata) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_timer_data_t *timer = userdata; - sngss7_chan_data_t *sngss7_info = timer->sngss7_info; - ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_channel_lock(ftdmchan); - - /* Q.764 2.2.5 Address incomplete (T35 expiry action is hangup with cause 28 according to Table A.1/Q.764) */ - SS7_ERROR("[Call-Control] Timer 35 expired on CIC = %d\n", sngss7_info->circuit->cic); - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_ckt_flag(sngss7_info, FLAG_LOCAL_REL); - - /* hang up on timer expiry */ - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_INVALID_NUMBER_FORMAT; - - /* end the call */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - - /* kill t10 t39 if active */ - if (sngss7_info->t10.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t10.sched, sngss7_info->t10.hb_timer_id); - } - if (sngss7_info->t39.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t39.sched, sngss7_info->t39.hb_timer_id); - } - - /*unlock*/ - ftdm_channel_unlock(ftdmchan); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); - return; -} - - -void handle_isup_t10(void *userdata) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_timer_data_t *timer = userdata; - sngss7_chan_data_t *sngss7_info = timer->sngss7_info; - ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - - ftdm_channel_lock(ftdmchan); - - SS7_DEBUG("[Call-Control] Timer 10 expired on CIC = %d\n", sngss7_info->circuit->cic); - - /* send the call to the user */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - - ftdm_channel_unlock(ftdmchan); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} - -void handle_isup_t39(void *userdata) -{ - SS7_FUNC_TRACE_ENTER(__FTDM_FUNC__); - - sngss7_timer_data_t *timer = userdata; - sngss7_chan_data_t *sngss7_info = timer->sngss7_info; - ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_channel_lock(ftdmchan); - - /* Q.764 2.2.5 Address incomplete (T35 expiry action is hangup with cause 28 according to Table A.1/Q.764) */ - SS7_ERROR("[Call-Control] Timer 39 expired on CIC = %d\n", sngss7_info->circuit->cic); - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_ckt_flag(sngss7_info, FLAG_LOCAL_REL); - - /* hang up on timer expiry */ - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_INVALID_NUMBER_FORMAT; - - /* end the call */ - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - - /* kill t10 t35 if active */ - if (sngss7_info->t10.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t10.sched, sngss7_info->t10.hb_timer_id); - } - if (sngss7_info->t35.hb_timer_id) { - ftdm_sched_cancel_timer (sngss7_info->t35.sched, sngss7_info->t35.hb_timer_id); - } - - /*unlock*/ - ftdm_channel_unlock(ftdmchan); - - SS7_FUNC_TRACE_EXIT(__FTDM_FUNC__); -} -/******************************************************************************/ -/* 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/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c deleted file mode 100644 index ad504b14b0..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ /dev/null @@ -1,3454 +0,0 @@ -/* - * Copyright (c) 2009, Konrad Hammel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributors: - * - * James Zhang - * - */ - -/* INCLUDE ********************************************************************/ -#include "ftmod_sangoma_ss7_main.h" -/******************************************************************************/ - -/* DEFINES ********************************************************************/ -/******************************************************************************/ - -/* GLOBALS ********************************************************************/ -sng_ssf_type_t sng_ssf_type_map[] = -{ - { 1, "nat" , SSF_NAT }, - { 1, "int" , SSF_INTL }, - { 1, "spare" , SSF_SPARE }, - { 1, "res" , SSF_RES }, - { 0, "", 0 }, -}; - -sng_switch_type_t sng_switch_type_map[] = -{ - { 1, "itu88" , LSI_SW_ITU , LSI_SW_ITU }, - { 1, "itu92" , LSI_SW_ITU , LSI_SW_ITU }, - { 1, "itu97" , LSI_SW_ITU97 , LSI_SW_ITU97 }, - { 1, "itu00" , LSI_SW_ITU2000 , LSI_SW_ITU2000 }, - { 1, "ansi88" , LSI_SW_ANS88 , LSI_SW_ANS88 }, - { 1, "ansi92" , LSI_SW_ANS92 , LSI_SW_ANS92 }, - { 1, "ansi95" , LSI_SW_ANS92 , LSI_SW_ANS92 }, - { 1, "etsiv2" , LSI_SW_ETSI , LSI_SW_ETSI }, - { 1, "etsiv3" , LSI_SW_ETSIV3 , LSI_SW_ETSIV3 }, - { 1, "india" , LSI_SW_INDIA , LSI_SW_INDIA }, - { 1, "uk" , LSI_SW_UK , LSI_SW_UK }, - { 1, "russia" , LSI_SW_RUSSIA , LSI_SW_RUSSIA }, - { 1, "china" , LSI_SW_CHINA , LSI_SW_CHINA }, - { 0, "", 0, 0 }, -}; - -sng_link_type_t sng_link_type_map[] = -{ - { 1, "itu88" , LSD_SW_ITU88 , LSN_SW_ITU }, - { 1, "itu92" , LSD_SW_ITU92 , LSN_SW_ITU }, - { 1, "etsi" , LSD_SW_ITU92 , LSN_SW_ITU }, - { 1, "ansi88" , LSD_SW_ANSI88, LSN_SW_ANS }, - { 1, "ansi92" , LSD_SW_ANSI92, LSN_SW_ANS }, - { 1, "ansi96" , LSD_SW_ANSI92, LSN_SW_ANS96 }, - { 0, "", 0, 0 }, -}; - -sng_mtp2_error_type_t sng_mtp2_error_type_map[] = -{ - { 1, "basic", SD_ERR_NRM }, - { 1, "pcr" , SD_ERR_CYC }, - { 0, "", 0 }, -}; - -sng_cic_cntrl_type_t sng_cic_cntrl_type_map[] = -{ - { 1, "bothway" , BOTHWAY }, - { 1, "incoming" , INCOMING }, - { 1, "outgoing" , OUTGOING }, - { 1, "controlling" , CONTROLLING }, - { 1, "controlled" , CONTROLLED }, - { 0, "", 0 }, -}; - -typedef struct sng_timeslot -{ - int channel; - int siglink; - int gap; - int hole; -}sng_timeslot_t; - -typedef struct sng_span -{ - char name[MAX_NAME_LEN]; - ftdm_span_t *span; - uint32_t ccSpanId; -} sng_span_t; - -typedef struct sng_ccSpan -{ - char name[MAX_NAME_LEN]; - uint32_t options; - uint32_t id; - uint32_t procId; - uint32_t isupInf; - uint32_t cicbase; - char ch_map[MAX_CIC_MAP_LENGTH]; - uint32_t typeCntrl; - uint32_t switchType; - uint32_t ssf; - uint32_t clg_nadi; - uint32_t cld_nadi; - uint32_t rdnis_nadi; - uint32_t loc_nadi; - uint32_t min_digits; - uint32_t transparent_iam_max_size; - uint8_t transparent_iam; - uint8_t cpg_on_progress_media; - uint8_t cpg_on_progress; - uint8_t itx_auto_reply; - uint32_t t3; - uint32_t t10; - uint32_t t12; - uint32_t t13; - uint32_t t14; - uint32_t t15; - uint32_t t16; - uint32_t t17; - uint32_t t35; - uint32_t t39; - uint32_t tval; -} sng_ccSpan_t; - -int cmbLinkSetId; -/******************************************************************************/ - -/* PROTOTYPES *****************************************************************/ -int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); - -static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup); - -static int ftmod_ss7_parse_sng_gen(ftdm_conf_node_t *sng_gen); - -static int ftmod_ss7_parse_sng_relay(ftdm_conf_node_t *sng_relay); -static int ftmod_ss7_parse_relay_channel(ftdm_conf_node_t *relay_chan); - -static int ftmod_ss7_parse_mtp1_links(ftdm_conf_node_t *mtp1_links); -static int ftmod_ss7_parse_mtp1_link(ftdm_conf_node_t *mtp1_link); - -static int ftmod_ss7_parse_mtp2_links(ftdm_conf_node_t *mtp2_links); -static int ftmod_ss7_parse_mtp2_link(ftdm_conf_node_t *mtp2_link); - -static int ftmod_ss7_parse_mtp3_links(ftdm_conf_node_t *mtp3_links); -static int ftmod_ss7_parse_mtp3_link(ftdm_conf_node_t *mtp3_link); - -static int ftmod_ss7_parse_mtp_linksets(ftdm_conf_node_t *mtp_linksets); -static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset); - -static int ftmod_ss7_parse_mtp_routes(ftdm_conf_node_t *mtp_routes); -static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route); - -static int ftmod_ss7_parse_isup_interfaces(ftdm_conf_node_t *isup_interfaces); -static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface); - -static int ftmod_ss7_parse_cc_spans(ftdm_conf_node_t *cc_spans); -static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span); - -static int ftmod_ss7_fill_in_relay_channel(sng_relay_t *relay_channel); -static int ftmod_ss7_fill_in_mtp1_link(sng_mtp1_link_t *mtp1Link); -static int ftmod_ss7_fill_in_mtp2_link(sng_mtp2_link_t *mtp1Link); -static int ftmod_ss7_fill_in_mtp3_link(sng_mtp3_link_t *mtp1Link); -static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet); -static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route); -static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route); -static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup); -static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap); -static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan); -static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf); -static int ftmod_ss7_fill_in_circuits(sng_span_t *sngSpan); - -static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot); -static void ftmod_ss7_set_glare_resolution (const char *method); - -/******************************************************************************/ - -/* FUNCTIONS ******************************************************************/ - -int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span) -{ - sng_route_t self_route; - sng_span_t sngSpan; - int i = 0; - const char *var = NULL; - const char *val = NULL; - ftdm_conf_node_t *ptr = NULL; - - /* clean out the isup ckt */ - memset(&sngSpan, 0x0, sizeof(sngSpan)); - - /* clean out the self route */ - memset(&self_route, 0x0, sizeof(self_route)); - - var = ftdm_parameters[i].var; - val = ftdm_parameters[i].val; - - g_ftdm_operating_mode = SNG_SS7_OPR_MODE_ISUP; - - /* confirm that the first parameter is the "operating-mode" */ - if(!strcasecmp(var, "operating-mode")){ - if(!strcasecmp(val, "ISUP")) { - g_ftdm_operating_mode = SNG_SS7_OPR_MODE_ISUP; - } - else if(!strcasecmp(val, "M2UA_SG")) { - g_ftdm_operating_mode = SNG_SS7_OPR_MODE_M2UA_SG; - } else { - SS7_DEBUG("Operating mode not specified, defaulting to ISUP\n"); - } - i++; - } - - - - var = ftdm_parameters[i].var; - val = ftdm_parameters[i].val; - ptr = (ftdm_conf_node_t *)ftdm_parameters[i].ptr; - - /* confirm that the 2nd parameter is the "confnode" */ - if (!strcasecmp(var, "confnode")) { - /* parse the confnode and fill in the global libsng_ss7 config structure */ - if (ftmod_ss7_parse_sng_isup(ptr)) { - SS7_ERROR("Failed to parse the \"confnode\"!\n"); - goto ftmod_ss7_parse_xml_error; - } - } else { - /* ERROR...exit */ - SS7_ERROR("The \"confnode\" configuration was not the first parameter!\n"); - SS7_ERROR("\tFound \"%s\" in the first slot\n", var); - goto ftmod_ss7_parse_xml_error; - } - - i++; - - while (ftdm_parameters[i].var != NULL) { - var = ftdm_parameters[i].var; - val = ftdm_parameters[i].val; - - if (!strcasecmp(var, "dialplan")) { - /* don't care for now */ - } else if (!strcasecmp(var, "context")) { - /* don't care for now */ - } else if (!strcasecmp(var, "span-id") || !strcasecmp(var, "ccSpanId")) { - sngSpan.ccSpanId = atoi(val); - SS7_DEBUG("Found an ccSpanId = %d\n",sngSpan.ccSpanId); - } else { - SS7_ERROR("Unknown parameter found =\"%s\"...ignoring it!\n", var); - } - - i++; - } /* while (ftdm_parameters[i].var != NULL) */ - - /* fill the pointer to span into isupCkt */ - sngSpan.span = span; - - if(SNG_SS7_OPR_MODE_ISUP == g_ftdm_operating_mode){ - /* setup the circuits structure */ - if(ftmod_ss7_fill_in_circuits(&sngSpan)) { - SS7_ERROR("Failed to fill in circuits structure!\n"); - goto ftmod_ss7_parse_xml_error; - } - } - - return FTDM_SUCCESS; - -ftmod_ss7_parse_xml_error: - return FTDM_FAIL; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup) -{ - ftdm_conf_node_t *gen_config = NULL; - ftdm_conf_node_t *relay_channels = NULL; - ftdm_conf_node_t *mtp1_links = NULL; - ftdm_conf_node_t *mtp2_links = NULL; - ftdm_conf_node_t *mtp3_links = NULL; - ftdm_conf_node_t *mtp_linksets = NULL; - ftdm_conf_node_t *mtp_routes = NULL; - ftdm_conf_node_t *isup_interfaces = NULL; - ftdm_conf_node_t *cc_spans = NULL; - ftdm_conf_node_t *tmp_node = NULL; - ftdm_conf_node_t *nif_ifaces = NULL; - ftdm_conf_node_t *m2ua_ifaces = NULL; - ftdm_conf_node_t *m2ua_peer_ifaces = NULL; - ftdm_conf_node_t *m2ua_clust_ifaces = NULL; - ftdm_conf_node_t *sctp_ifaces = NULL; - - /* confirm that we are looking at sng_isup */ - if (strcasecmp(sng_isup->name, "sng_isup")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"sng_isup\"!\n",sng_isup->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"sng_isup\"...\n"); - } - - /* extract the main sections of the sng_isup block */ - tmp_node = sng_isup->child; - - while (tmp_node != NULL) { - /**************************************************************************/ - /* check the type of structure */ - if (!strcasecmp(tmp_node->name, "sng_gen")) { - /**********************************************************************/ - if (gen_config == NULL) { - gen_config = tmp_node; - SS7_DEBUG("Found a \"sng_gen\" section!\n"); - } else { - SS7_ERROR("Found a second \"sng_gen\" section\n!"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "sng_relay")) { - /**********************************************************************/ - if (relay_channels == NULL) { - relay_channels = tmp_node; - SS7_DEBUG("Found a \"sng_relay\" section!\n"); - } else { - SS7_ERROR("Found a second \"sng_relay\" section\n!"); - return FTDM_FAIL; - } - /**********************************************************************/ - }else if (!strcasecmp(tmp_node->name, "mtp1_links")) { - /**********************************************************************/ - if (mtp1_links == NULL) { - mtp1_links = tmp_node; - SS7_DEBUG("Found a \"mtp1_links\" section!\n"); - } else { - SS7_ERROR("Found a second \"mtp1_links\" section!\n"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "mtp2_links")) { - /**********************************************************************/ - if (mtp2_links == NULL) { - mtp2_links = tmp_node; - SS7_DEBUG("Found a \"mtp2_links\" section!\n"); - } else { - SS7_ERROR("Found a second \"mtp2_links\" section!\n"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "mtp3_links")) { - /**********************************************************************/ - if (mtp3_links == NULL) { - mtp3_links = tmp_node; - SS7_DEBUG("Found a \"mtp3_links\" section!\n"); - } else { - SS7_ERROR("Found a second \"mtp3_links\" section!\n"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "mtp_linksets")) { - /**********************************************************************/ - if (mtp_linksets == NULL) { - mtp_linksets = tmp_node; - SS7_DEBUG("Found a \"mtp_linksets\" section!\n"); - } else { - SS7_ERROR("Found a second \"mtp_linksets\" section!\n"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "mtp_routes")) { - /**********************************************************************/ - if (mtp_routes == NULL) { - mtp_routes = tmp_node; - SS7_DEBUG("Found a \"mtp_routes\" section!\n"); - } else { - SS7_ERROR("Found a second \"mtp_routes\" section!\n"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "isup_interfaces")) { - /**********************************************************************/ - if (isup_interfaces == NULL) { - isup_interfaces = tmp_node; - SS7_DEBUG("Found a \"isup_interfaces\" section!\n"); - } else { - SS7_ERROR("Found a second \"isup_interfaces\" section\n!"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "cc_spans")) { - /**********************************************************************/ - if (cc_spans == NULL) { - cc_spans = tmp_node; - SS7_DEBUG("Found a \"cc_spans\" section!\n"); - } else { - SS7_ERROR("Found a second \"cc_spans\" section\n!"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "sng_nif_interfaces")) { - /**********************************************************************/ - if (nif_ifaces == NULL) { - nif_ifaces = tmp_node; - SS7_DEBUG("Found a \"sng_nif_interfaces\" section!\n"); - } else { - SS7_ERROR("Found a second \"sng_nif_interfaces\" section\n!"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "sng_m2ua_interfaces")) { - /**********************************************************************/ - if (m2ua_ifaces == NULL) { - m2ua_ifaces = tmp_node; - SS7_DEBUG("Found a \"sng_m2ua_interfaces\" section!\n"); - } else { - SS7_ERROR("Found a second \"sng_m2ua_interfaces\" section\n!"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "sng_m2ua_peer_interfaces")) { - /**********************************************************************/ - if (m2ua_peer_ifaces == NULL) { - m2ua_peer_ifaces = tmp_node; - SS7_DEBUG("Found a \"sng_m2ua_peer_interfaces\" section!\n"); - } else { - SS7_ERROR("Found a second \"sng_m2ua_peer_interfaces\" section\n!"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "sng_m2ua_cluster_interfaces")) { - /**********************************************************************/ - if (m2ua_clust_ifaces == NULL) { - m2ua_clust_ifaces = tmp_node; - SS7_DEBUG("Found a \"sng_m2ua_cluster_interfaces\" section!\n"); - } else { - SS7_ERROR("Found a second \"sng_m2ua_peer_interfaces\" section\n!"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(tmp_node->name, "sng_sctp_interfaces")) { - /**********************************************************************/ - if (sctp_ifaces == NULL) { - sctp_ifaces = tmp_node; - SS7_DEBUG("Found a section!\n"); - } else { - SS7_ERROR("Found a second section!\n"); - return FTDM_FAIL; - } - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("\tFound an unknown section \"%s\"!\n", tmp_node->name); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* go to the next sibling */ - tmp_node = tmp_node->next; - } /* while (tmp_node != NULL) */ - - /* now try to parse the sections */ - if (ftmod_ss7_parse_sng_gen(gen_config)) { - SS7_ERROR("Failed to parse \"gen_config\"!\n"); - return FTDM_FAIL; - } - - if (ftmod_ss7_parse_sng_relay(relay_channels)) { - SS7_ERROR("Failed to parse \"relay_channels\"!\n"); - return FTDM_FAIL; - } - - if (ftmod_ss7_parse_mtp1_links(mtp1_links)) { - SS7_ERROR("Failed to parse \"mtp1_links\"!\n"); - return FTDM_FAIL; - } - - if (ftmod_ss7_parse_mtp2_links(mtp2_links)) { - SS7_ERROR("Failed to parse \"mtp2_links\"!\n"); - return FTDM_FAIL; - } - - - switch(g_ftdm_operating_mode) - { - case SNG_SS7_OPR_MODE_ISUP: - { - if (mtp3_links && ftmod_ss7_parse_mtp3_links(mtp3_links)) { - SS7_ERROR("Failed to parse \"mtp3_links\"!\n"); - return FTDM_FAIL; - } - - if (ftmod_ss7_parse_mtp_linksets(mtp_linksets)) { - SS7_ERROR("Failed to parse \"mtp_linksets\"!\n"); - return FTDM_FAIL; - } - - if (ftmod_ss7_parse_mtp_routes(mtp_routes)) { - SS7_ERROR("Failed to parse \"mtp_routes\"!\n"); - return FTDM_FAIL; - } - - if (isup_interfaces && ftmod_ss7_parse_isup_interfaces(isup_interfaces)) { - SS7_ERROR("Failed to parse \"isup_interfaces\"!\n"); - return FTDM_FAIL; - } - - if (cc_spans && ftmod_ss7_parse_cc_spans(cc_spans)) { - SS7_ERROR("Failed to parse \"cc_spans\"!\n"); - return FTDM_FAIL; - } - break; - } - case SNG_SS7_OPR_MODE_M2UA_SG: - { - if (ftmod_ss7_parse_sctp_links(sctp_ifaces) != FTDM_SUCCESS) { - SS7_ERROR("Failed to parse !\n"); - return FTDM_FAIL; - } - - if (nif_ifaces && ftmod_ss7_parse_nif_interfaces(nif_ifaces)) { - SS7_ERROR("Failed to parse \"nif_ifaces\"!\n"); - return FTDM_FAIL; - } - - if (m2ua_ifaces && ftmod_ss7_parse_m2ua_interfaces(m2ua_ifaces)) { - SS7_ERROR("Failed to parse \"m2ua_ifaces\"!\n"); - return FTDM_FAIL; - } - if (m2ua_peer_ifaces && ftmod_ss7_parse_m2ua_peer_interfaces(m2ua_peer_ifaces)) { - SS7_ERROR("Failed to parse \"m2ua_peer_ifaces\"!\n"); - return FTDM_FAIL; - } - if (m2ua_clust_ifaces && ftmod_ss7_parse_m2ua_clust_interfaces(m2ua_clust_ifaces)) { - SS7_ERROR("Failed to parse \"m2ua_clust_ifaces\"!\n"); - return FTDM_FAIL; - } - break; - } - default: - SS7_ERROR("Invalid operating mode[%d]\n",g_ftdm_operating_mode); - break; - - } - - return FTDM_SUCCESS; -} - -static void ftmod_ss7_set_glare_resolution (const char *method) -{ - sng_glare_resolution iMethod=SNGSS7_GLARE_PC; - if (!method || (strlen (method) <=0) ) { - SS7_ERROR( "Wrong glare resolution parameter, using default. \n" ); - } else { - if (!strcasecmp( method, "PointCode")) { - iMethod = SNGSS7_GLARE_PC; - } else if (!strcasecmp( method, "Down")) { - iMethod = SNGSS7_GLARE_DOWN; - } else if (!strcasecmp( method, "Control")) { - iMethod = SNGSS7_GLARE_CONTROL; - } else { - SS7_ERROR( "Wrong glare resolution parameter, using default. \n" ); - iMethod = SNGSS7_GLARE_PC; - } - } - g_ftdm_sngss7_data.cfg.glareResolution = iMethod; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_sng_gen(ftdm_conf_node_t *sng_gen) -{ - ftdm_conf_parameter_t *parm = sng_gen->parameters; - int num_parms = sng_gen->n_parameters; - int i = 0; - - /* Set the transparent_iam_max_size to default value */ - g_ftdm_sngss7_data.cfg.transparent_iam_max_size=800; - g_ftdm_sngss7_data.cfg.force_inr = 0; - - /* extract all the information from the parameters */ - for (i = 0; i < num_parms; i++) { - if (!strcasecmp(parm->var, "procId")) { - g_ftdm_sngss7_data.cfg.procId = atoi(parm->val); - SS7_DEBUG("Found a procId = %d\n", g_ftdm_sngss7_data.cfg.procId); - } - else if (!strcasecmp(parm->var, "license")) { - ftdm_set_string(g_ftdm_sngss7_data.cfg.license, parm->val); - snprintf(g_ftdm_sngss7_data.cfg.signature, sizeof(g_ftdm_sngss7_data.cfg.signature), "%s.sig", parm->val); - SS7_DEBUG("Found license file = %s\n", g_ftdm_sngss7_data.cfg.license); - SS7_DEBUG("Found signature file = %s\n", g_ftdm_sngss7_data.cfg.signature); - } - else if (!strcasecmp(parm->var, "transparent_iam_max_size")) { - g_ftdm_sngss7_data.cfg.transparent_iam_max_size = atoi(parm->val); - SS7_DEBUG("Found a transparent_iam max size = %d\n", g_ftdm_sngss7_data.cfg.transparent_iam_max_size); - } - else if (!strcasecmp(parm->var, "glare-reso")) { - ftmod_ss7_set_glare_resolution (parm->val); - SS7_DEBUG("Found glare resolution configuration = %d %s\n", g_ftdm_sngss7_data.cfg.glareResolution, parm->val ); - } - else if (!strcasecmp(parm->var, "force-inr")) { - if (ftdm_true(parm->val)) { - g_ftdm_sngss7_data.cfg.force_inr = 1; - } else { - g_ftdm_sngss7_data.cfg.force_inr = 0; - } - SS7_DEBUG("Found INR force configuration = %s\n", parm->val ); - } - else { - SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - } - - /* move to the next parmeter */ - parm = parm + 1; - } /* for (i = 0; i < num_parms; i++) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_sng_relay(ftdm_conf_node_t *sng_relay) -{ - ftdm_conf_node_t *relay_chan = NULL; - - /* confirm that we are looking at sng_relay */ - if (strcasecmp(sng_relay->name, "sng_relay")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"sng_relay\"!\n",sng_relay->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"sng_relay\"...\n"); - } - - relay_chan = sng_relay->child; - - if (relay_chan != NULL) { - while (relay_chan != NULL) { - /* try to the parse relay_channel */ - if (ftmod_ss7_parse_relay_channel(relay_chan)) { - SS7_ERROR("Failed to parse \"relay_channels\"!\n"); - return FTDM_FAIL; - } - - /* move on to the next linkset */ - relay_chan = relay_chan->next; - } /* while (relay_chan != NULL) */ - } /* if (relay_chan != NULL) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_relay_channel(ftdm_conf_node_t *relay_chan) -{ - sng_relay_t tmp_chan; - ftdm_conf_parameter_t *parm = relay_chan->parameters; - int num_parms = relay_chan->n_parameters; - int i = 0; - - /* confirm that we are looking at relay_channel */ - if (strcasecmp(relay_chan->name, "relay_channel")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"relay_channel\"!\n",relay_chan->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"relay_channel\"...\n"); - } - - /* initalize the tmp_chan structure */ - memset(&tmp_chan, 0x0, sizeof(tmp_chan)); - - /* extract all the information from the parameters */ - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)tmp_chan.name, parm->val); - SS7_DEBUG("Found an relay_channel named = %s\n", tmp_chan.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "type")) { - /**********************************************************************/ - if (!strcasecmp(parm->val, "listen")) { - tmp_chan.type = LRY_CT_TCP_LISTEN; - SS7_DEBUG("Found a type = LISTEN\n"); - } else if (!strcasecmp(parm->val, "server")) { - tmp_chan.type = LRY_CT_TCP_SERVER; - SS7_DEBUG("Found a type = SERVER\n"); - } else if (!strcasecmp(parm->val, "client")) { - tmp_chan.type = LRY_CT_TCP_CLIENT; - SS7_DEBUG("Found a type = CLIENT\n"); - } else { - SS7_ERROR("Found an invalid \"type\" = %s\n", parm->var); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "hostname")) { - /**********************************************************************/ - strcpy((char *)tmp_chan.hostname, parm->val); - SS7_DEBUG("Found a hostname = %s\n", tmp_chan.hostname); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "port")) { - /**********************************************************************/ - tmp_chan.port = atoi(parm->val); - SS7_DEBUG("Found a port = %d\n", tmp_chan.port); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "procId")) { - /**********************************************************************/ - tmp_chan.procId = atoi(parm->val); - SS7_DEBUG("Found a procId = %d\n", tmp_chan.procId); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parmeter */ - parm = parm + 1; - } /* for (i = 0; i < num_parms; i++) */ - - /* store the channel in the global structure */ - ftmod_ss7_fill_in_relay_channel(&tmp_chan); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp1_links(ftdm_conf_node_t *mtp1_links) -{ - ftdm_conf_node_t *mtp1_link = NULL; - - /* confirm that we are looking at mtp1_links */ - if (strcasecmp(mtp1_links->name, "mtp1_links")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp1_links\"!\n",mtp1_links->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp1_links\"...\n"); - } - - /* extract the mtp_links */ - mtp1_link = mtp1_links->child; - - /* run through all of the links found */ - while (mtp1_link != NULL) { - /* try to the parse mtp_link */ - if (ftmod_ss7_parse_mtp1_link(mtp1_link)) { - SS7_ERROR("Failed to parse \"mtp1_link\"!\n"); - return FTDM_FAIL; - } - - /* move on to the next link */ - mtp1_link = mtp1_link->next; - - } /* while (mtp_linkset != NULL) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp1_link(ftdm_conf_node_t *mtp1_link) -{ - sng_mtp1_link_t mtp1Link; - ftdm_conf_parameter_t *parm = mtp1_link->parameters; - int num_parms = mtp1_link->n_parameters; - int i; - - /* initalize the mtp1Link structure */ - memset(&mtp1Link, 0x0, sizeof(mtp1Link)); - - /* confirm that we are looking at an mtp_link */ - if (strcasecmp(mtp1_link->name, "mtp1_link")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp1_link\"!\n",mtp1_link->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp1_link\"...\n"); - } - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)mtp1Link.name, parm->val); - SS7_DEBUG("Found an mtp1_link named = %s\n", mtp1Link.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - mtp1Link.id = atoi(parm->val); - SS7_DEBUG("Found an mtp1_link id = %d\n", mtp1Link.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "span")) { - /**********************************************************************/ - mtp1Link.span = atoi(parm->val); - SS7_DEBUG("Found an mtp1_link span = %d\n", mtp1Link.span); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "chan")) { - /**********************************************************************/ - mtp1Link.chan = atoi(parm->val); - SS7_DEBUG("Found an mtp1_link chan = %d\n", mtp1Link.chan); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parmeter */ - parm = parm + 1; - - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - /* store the link in global structure */ - ftmod_ss7_fill_in_mtp1_link(&mtp1Link); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp2_links(ftdm_conf_node_t *mtp2_links) -{ - ftdm_conf_node_t *mtp2_link = NULL; - - /* confirm that we are looking at mtp2_links */ - if (strcasecmp(mtp2_links->name, "mtp2_links")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp2_links\"!\n",mtp2_links->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp2_links\"...\n"); - } - - /* extract the mtp_links */ - mtp2_link = mtp2_links->child; - - /* run through all of the links found */ - while (mtp2_link != NULL) { - /* try to the parse mtp_linkset */ - if (ftmod_ss7_parse_mtp2_link(mtp2_link)) { - SS7_ERROR("Failed to parse \"mtp2_link\"!\n"); - return FTDM_FAIL; - } - - /* move on to the next link */ - mtp2_link = mtp2_link->next; - - } /* while (mtp_linkset != NULL) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp2_link(ftdm_conf_node_t *mtp2_link) -{ - sng_mtp2_link_t mtp2Link; - ftdm_conf_parameter_t *parm = mtp2_link->parameters; - int num_parms = mtp2_link->n_parameters; - int i; - int ret; - - /* initalize the mtp1Link structure */ - memset(&mtp2Link, 0x0, sizeof(mtp2Link)); - - /* confirm that we are looking at an mtp2_link */ - if (strcasecmp(mtp2_link->name, "mtp2_link")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp2_link\"!\n",mtp2_link->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp2_link\"...\n"); - } - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)mtp2Link.name, parm->val); - SS7_DEBUG("Found an mtp2_link named = %s\n", mtp2Link.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - mtp2Link.id = atoi(parm->val); - SS7_DEBUG("Found an mtp2_link id = %d\n", mtp2Link.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp1Id")) { - /**********************************************************************/ - mtp2Link.mtp1Id = atoi(parm->val); - SS7_DEBUG("Found an mtp2_link mtp1Id = %d\n", mtp2Link.mtp1Id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "errorType")) { - /**********************************************************************/ - ret = find_mtp2_error_type_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid mtp2_link errorType = %s\n", parm->var); - return FTDM_FAIL; - } else { - mtp2Link.errorType = sng_mtp2_error_type_map[ret].tril_type; - SS7_DEBUG("Found an mtp2_link errorType = %s\n", sng_mtp2_error_type_map[ret].sng_type); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "lssuLength")) { - /**********************************************************************/ - mtp2Link.lssuLength = atoi(parm->val); - SS7_DEBUG("Found an mtp2_link lssuLength = %d\n", mtp2Link.lssuLength); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "linkType")) { - /**********************************************************************/ - ret = find_link_type_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid mtp2_link linkType = %s\n", parm->var); - return FTDM_FAIL; - } else { - mtp2Link.linkType = sng_link_type_map[ret].tril_mtp2_type; - SS7_DEBUG("Found an mtp2_link linkType = %s\n", sng_link_type_map[ret].sng_type); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t1")) { - /**********************************************************************/ - mtp2Link.t1 = atoi(parm->val); - SS7_DEBUG("Found an mtp2 t1 = \"%d\"\n",mtp2Link.t1); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t2")) { - /**********************************************************************/ - mtp2Link.t2 = atoi(parm->val); - SS7_DEBUG("Found an mtp2 t2 = \"%d\"\n",mtp2Link.t2); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t3")) { - /**********************************************************************/ - mtp2Link.t3 = atoi(parm->val); - SS7_DEBUG("Found an mtp2 t3 = \"%d\"\n",mtp2Link.t3); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t4n")) { - /**********************************************************************/ - mtp2Link.t4n = atoi(parm->val); - SS7_DEBUG("Found an mtp2 t4n = \"%d\"\n",mtp2Link.t4n); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t4e")) { - /**********************************************************************/ - mtp2Link.t4e = atoi(parm->val); - SS7_DEBUG("Found an mtp2 t4e = \"%d\"\n",mtp2Link.t4e); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t5")) { - /**********************************************************************/ - mtp2Link.t5 = atoi(parm->val); - SS7_DEBUG("Found an mtp2 t5 = \"%d\"\n",mtp2Link.t5); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t6")) { - /**********************************************************************/ - mtp2Link.t6 = atoi(parm->val); - SS7_DEBUG("Found an mtp2 t6 = \"%d\"\n",mtp2Link.t6); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t7")) { - /**********************************************************************/ - mtp2Link.t7 = atoi(parm->val); - SS7_DEBUG("Found an mtp2 t7 = \"%d\"\n",mtp2Link.t7); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parmeter */ - parm = parm + 1; - - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - /* store the link in global structure */ - ftmod_ss7_fill_in_mtp2_link(&mtp2Link); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp3_links(ftdm_conf_node_t *mtp3_links) -{ - ftdm_conf_node_t *mtp3_link = NULL; - - /* confirm that we are looking at mtp3_links */ - if (strcasecmp(mtp3_links->name, "mtp3_links")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp3_links\"!\n",mtp3_links->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp3_links\"...\n"); - } - - /* extract the mtp_links */ - mtp3_link = mtp3_links->child; - - /* run through all of the links found */ - while (mtp3_link != NULL) { - /* try to the parse mtp_linkset */ - if (ftmod_ss7_parse_mtp3_link(mtp3_link)) { - SS7_ERROR("Failed to parse \"mtp3_link\"!\n"); - return FTDM_FAIL; - } - - /* move on to the next link */ - mtp3_link = mtp3_link->next; - - } /* while (mtp_linkset != NULL) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp3_link(ftdm_conf_node_t *mtp3_link) -{ - sng_mtp3_link_t mtp3Link; - ftdm_conf_parameter_t *parm = mtp3_link->parameters; - int num_parms = mtp3_link->n_parameters; - int i; - int ret; - - /* initalize the mtp3Link structure */ - memset(&mtp3Link, 0x0, sizeof(mtp3Link)); - - /* confirm that we are looking at an mtp_link */ - if (strcasecmp(mtp3_link->name, "mtp3_link")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp3_link\"!\n",mtp3_link->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp3_link\"...\n"); - } - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)mtp3Link.name, parm->val); - SS7_DEBUG("Found an mtp3_link named = %s\n", mtp3Link.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - mtp3Link.id = atoi(parm->val); - SS7_DEBUG("Found an mtp3_link id = %d\n", mtp3Link.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp2Id")) { - /**********************************************************************/ - mtp3Link.mtp2Id = atoi(parm->val); - SS7_DEBUG("Found an mtp3_link mtp2Id = %d\n", mtp3Link.mtp2Id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp2ProcId")) { - /**********************************************************************/ - mtp3Link.mtp2ProcId = atoi(parm->val); - SS7_DEBUG("Found an mtp3_link mtp2ProcId = %d\n", mtp3Link.mtp2ProcId); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "priority")) { - /**********************************************************************/ - mtp3Link.priority = atoi(parm->val); - SS7_DEBUG("Found an mtp3 Link priority = %d\n",mtp3Link.priority); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "linkType")) { - /**********************************************************************/ - ret = find_link_type_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid mtp3_link linkType = %s\n", parm->var); - return FTDM_FAIL; - } else { - mtp3Link.linkType = sng_link_type_map[ret].tril_mtp3_type; - SS7_DEBUG("Found an mtp3_link linkType = %s\n", sng_link_type_map[ret].sng_type); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "switchType")) { - /**********************************************************************/ - ret = find_switch_type_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid mtp3_link switchType = %s\n", parm->var); - return FTDM_FAIL; - } else { - mtp3Link.switchType = sng_switch_type_map[ret].tril_mtp3_type; - SS7_DEBUG("Found an mtp3_link switchType = %s\n", sng_switch_type_map[ret].sng_type); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "ssf")) { - /**********************************************************************/ - ret = find_ssf_type_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid mtp3_link ssf = %s\n", parm->var); - return FTDM_FAIL; - } else { - mtp3Link.ssf = sng_ssf_type_map[ret].tril_type; - SS7_DEBUG("Found an mtp3_link ssf = %s\n", sng_ssf_type_map[ret].sng_type); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "slc")) { - /**********************************************************************/ - mtp3Link.slc = atoi(parm->val); - SS7_DEBUG("Found an mtp3 Link slc = %d\n",mtp3Link.slc); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "linkset")) { - /**********************************************************************/ - mtp3Link.linkSetId = atoi(parm->val); - SS7_DEBUG("Found an mtp3 Link linkset = %d\n",mtp3Link.linkSetId); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t1")) { - /**********************************************************************/ - mtp3Link.t1 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t1 = %d\n",mtp3Link.t1); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t2")) { - /**********************************************************************/ - mtp3Link.t2 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t2 = %d\n",mtp3Link.t2); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t3")) { - /**********************************************************************/ - mtp3Link.t3 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t3 = %d\n",mtp3Link.t3); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t4")) { - /**********************************************************************/ - mtp3Link.t4 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t4 = %d\n",mtp3Link.t4); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t5")) { - /**********************************************************************/ - mtp3Link.t5 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t5 = %d\n",mtp3Link.t5); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t7")) { - /**********************************************************************/ - mtp3Link.t7 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t7 = %d\n",mtp3Link.t7); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t12")) { - /**********************************************************************/ - mtp3Link.t12 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t12 = %d\n",mtp3Link.t12); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t13")) { - /**********************************************************************/ - mtp3Link.t13 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t13 = %d\n",mtp3Link.t13); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t14")) { - /**********************************************************************/ - mtp3Link.t14 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t14 = %d\n",mtp3Link.t14); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t17")) { - /**********************************************************************/ - mtp3Link.t17 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t17 = %d\n",mtp3Link.t17); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t22")) { - /**********************************************************************/ - mtp3Link.t22 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t22 = %d\n",mtp3Link.t22); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t23")) { - /**********************************************************************/ - mtp3Link.t23 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t23 = %d\n",mtp3Link.t23); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t24")) { - /**********************************************************************/ - mtp3Link.t24 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t24 = %d\n",mtp3Link.t24); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t31")) { - mtp3Link.t31 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t31 = %d\n",mtp3Link.t31); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t32")) { - /**********************************************************************/ - mtp3Link.t32 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t32 = %d\n",mtp3Link.t32); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t33")) { - /**********************************************************************/ - mtp3Link.t33 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t33 = %d\n",mtp3Link.t33); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t34")) { - /**********************************************************************/ - mtp3Link.t34 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t34 = %d\n",mtp3Link.t34); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t35")) { - /**********************************************************************/ - mtp3Link.t35 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t35 = %d\n",mtp3Link.t35); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t36")) { - /**********************************************************************/ - mtp3Link.t36 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t36 = %d\n",mtp3Link.t36); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "t37")) { - /**********************************************************************/ - mtp3Link.t37 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t37 = %d\n",mtp3Link.t37); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "tcraft")) { - /**********************************************************************/ - mtp3Link.tcraft = atoi(parm->val); - SS7_DEBUG("Found an mtp3 tcraft = %d\n",mtp3Link.tcraft); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "tflc")) { - /**********************************************************************/ - mtp3Link.tflc = atoi(parm->val); - SS7_DEBUG("Found an mtp3 tflc = %d\n",mtp3Link.tflc); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "tbnd")) { - /**********************************************************************/ - mtp3Link.tbnd = atoi(parm->val); - SS7_DEBUG("Found an mtp3 tbnd = %d\n",mtp3Link.tbnd); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter %s!\n", parm->val); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parmeter */ - parm = parm + 1; - - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - /* store the link in global structure */ - ftmod_ss7_fill_in_mtp3_link(&mtp3Link); - - /* move the linktype, switchtype and ssf to the linkset */ - if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].linkType == 0) { - g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].linkType = mtp3Link.linkType; - } else if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].linkType != mtp3Link.linkType) { - SS7_ERROR("Trying to add an MTP3 Link to a Linkset with a different linkType: mtp3.id=%d, mtp3.name=%s, mtp3.linktype=%d, linkset.id=%d, linkset.linktype=%d\n", - mtp3Link.id, mtp3Link.name, mtp3Link.linkType, - g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].id, g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].linkType); - return FTDM_FAIL; - } else { - /* should print that all is ok...*/ - } - - if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].switchType == 0) { - g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].switchType = mtp3Link.switchType; - } else if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].switchType != mtp3Link.switchType) { - SS7_ERROR("Trying to add an MTP3 Link to a Linkset with a different switchType: mtp3.id=%d, mtp3.name=%s, mtp3.switchtype=%d, linkset.id=%d, linkset.switchtype=%d\n", - mtp3Link.id, mtp3Link.name, mtp3Link.switchType, - g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].id, g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].switchType); - return FTDM_FAIL; - } else { - /* should print that all is ok...*/ - } - - if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].ssf == 0) { - g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].ssf = mtp3Link.ssf; - } else if (g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].ssf != mtp3Link.ssf) { - SS7_ERROR("Trying to add an MTP3 Link to a Linkset with a different ssf: mtp3.id=%d, mtp3.name=%s, mtp3.ssf=%d, linkset.id=%d, linkset.ssf=%d\n", - mtp3Link.id, mtp3Link.name, mtp3Link.ssf, - g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].id, g_ftdm_sngss7_data.cfg.mtpLinkSet[mtp3Link.linkSetId].ssf); - return FTDM_FAIL; - } else { - /* should print that all is ok...*/ - } - - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp_linksets(ftdm_conf_node_t *mtp_linksets) -{ - ftdm_conf_node_t *mtp_linkset = NULL; - - /* confirm that we are looking at mtp_linksets */ - if (strcasecmp(mtp_linksets->name, "mtp_linksets")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linksets\"!\n",mtp_linksets->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_linksets\"...\n"); - } - - /* extract the mtp_links */ - mtp_linkset = mtp_linksets->child; - - /* run through all of the mtp_linksets found */ - while (mtp_linkset != NULL) { - /* try to the parse mtp_linkset */ - if (ftmod_ss7_parse_mtp_linkset(mtp_linkset)) { - SS7_ERROR("Failed to parse \"mtp_linkset\"!\n"); - return FTDM_FAIL; - } - - /* move on to the next linkset */ - mtp_linkset = mtp_linkset->next; - - } /* while (mtp_linkset != NULL) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) -{ - sng_link_set_t mtpLinkSet; - ftdm_conf_parameter_t *parm = mtp_linkset->parameters; - int num_parms = mtp_linkset->n_parameters; - int i; - - /* initalize the mtpLinkSet structure */ - memset(&mtpLinkSet, 0x0, sizeof(mtpLinkSet)); - - /* confirm that we are looking at mtp_linkset */ - if (strcasecmp(mtp_linkset->name, "mtp_linkset")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linkset\"!\n",mtp_linkset->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_linkset\"...\n"); - } - - /* extract all the information from the parameters */ - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)mtpLinkSet.name, parm->val); - SS7_DEBUG("Found an mtpLinkSet named = %s\n", mtpLinkSet.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - mtpLinkSet.id = atoi(parm->val); - SS7_DEBUG("Found mtpLinkSet id = %d\n", mtpLinkSet.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "apc")) { - /**********************************************************************/ - mtpLinkSet.apc = atoi(parm->val); - SS7_DEBUG("Found mtpLinkSet apc = %d\n", mtpLinkSet.apc); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "minActive")) { - /**********************************************************************/ - mtpLinkSet.minActive = atoi(parm->val); - SS7_DEBUG("Found mtpLinkSet minActive = %d\n", mtpLinkSet.minActive); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parmeter */ - parm = parm + 1; - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - ftmod_ss7_fill_in_mtpLinkSet(&mtpLinkSet); - - /* go through all the mtp3 links and fill in the apc */ - i = 1; - while (i < (MAX_MTP_LINKS)) { - if (g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId == mtpLinkSet.id) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].apc = mtpLinkSet.apc; - } - - i++; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp_routes(ftdm_conf_node_t *mtp_routes) -{ - ftdm_conf_node_t *mtp_route = NULL; - - /* confirm that we are looking at an mtp_routes */ - if (strcasecmp(mtp_routes->name, "mtp_routes")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_routes\"!\n",mtp_routes->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_routes\"...\n"); - } - - /* extract the mtp_routes */ - mtp_route = mtp_routes->child; - - while (mtp_route != NULL) { - /* parse the found mtp_route */ - if (ftmod_ss7_parse_mtp_route(mtp_route)) { - SS7_ERROR("Failed to parse \"mtp_route\"\n"); - return FTDM_FAIL; - } - - /* go to the next mtp_route */ - mtp_route = mtp_route->next; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route) -{ - sng_route_t mtpRoute; - ftdm_conf_parameter_t *parm = mtp_route->parameters; - int num_parms = mtp_route->n_parameters; - int i; - sng_link_set_list_t *lnkSet; - - ftdm_conf_node_t *linkset; - int numLinks; - - /* initalize the mtpRoute structure */ - memset(&mtpRoute, 0x0, sizeof(mtpRoute)); - - /* confirm that we are looking at an mtp_link */ - if (strcasecmp(mtp_route->name, "mtp_route")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_route\"!\n",mtp_route->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_route\"...\n"); - } - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - /* try to match the parameter to what we expect */ - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)mtpRoute.name, parm->val); - SS7_DEBUG("Found an mtpRoute named = %s\n", mtpRoute.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - mtpRoute.id = atoi(parm->val); - SS7_DEBUG("Found an mtpRoute id = %d\n", mtpRoute.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "dpc")) { - /**********************************************************************/ - mtpRoute.dpc = atoi(parm->val); - SS7_DEBUG("Found an mtpRoute dpc = %d\n", mtpRoute.dpc); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isSTP")) { - /**********************************************************************/ - if (!strcasecmp(parm->val, "no")) { - mtpRoute.isSTP = 0; - SS7_DEBUG("Found an mtpRoute isSTP = no\n"); - } else if (!strcasecmp(parm->val, "yes")) { - mtpRoute.isSTP = 1; - SS7_DEBUG("Found an mtpRoute isSTP = yes\n"); - } else { - SS7_ERROR("Found an invalid parameter for isSTP %s!\n", parm->val); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t6")) { - /**********************************************************************/ - mtpRoute.t6 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t6 = %d\n",mtpRoute.t6); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t8")) { - /**********************************************************************/ - mtpRoute.t8 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t8 = %d\n",mtpRoute.t8); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t10")) { - /**********************************************************************/ - mtpRoute.t10 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t10 = %d\n",mtpRoute.t10); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t11")) { - /**********************************************************************/ - mtpRoute.t11 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t11 = %d\n",mtpRoute.t11); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t15")) { - /**********************************************************************/ - mtpRoute.t15 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t15 = %d\n",mtpRoute.t15); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t16")) { - /**********************************************************************/ - mtpRoute.t16 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t16 = %d\n",mtpRoute.t16); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t18")) { - /**********************************************************************/ - mtpRoute.t18 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t18 = %d\n",mtpRoute.t18); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t19")) { - /**********************************************************************/ - mtpRoute.t19 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t19 = %d\n",mtpRoute.t19); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t21")) { - /**********************************************************************/ - mtpRoute.t21 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t21 = %d\n",mtpRoute.t21); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t25")) { - /**********************************************************************/ - mtpRoute.t25 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t25 = %d\n",mtpRoute.t25); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp3.t26")) { - /**********************************************************************/ - mtpRoute.t26 = atoi(parm->val); - SS7_DEBUG("Found an mtp3 t26 = %d\n",mtpRoute.t26); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parameter */ - parm = parm + 1; - } - - /* fill in the rest of the values in the mtpRoute struct */ - mtpRoute.nwId = 0; - mtpRoute.cmbLinkSetId = mtpRoute.id; - - /* parse in the list of linksets this route is reachable by */ - linkset = mtp_route->child->child; - - /* initalize the link-list of linkSet Ids */ - lnkSet = &mtpRoute.lnkSets; - - while (linkset != NULL) { - /**************************************************************************/ - /* extract the linkset Id */ - lnkSet->lsId = atoi(linkset->parameters->val); - - if (g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].id != 0) { - SS7_DEBUG("Found mtpRoute linkset id = %d that is valid\n",lnkSet->lsId); - } else { - SS7_ERROR("Found mtpRoute linkset id = %d that is invalid\n",lnkSet->lsId); - goto move_along; - } - - /* pull up the linktype, switchtype, and SSF from the linkset */ - mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].linkType; - mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].switchType; - mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].ssf; - - /* extract the number of cmbLinkSetId aleady on this linkset */ - numLinks = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks; - - /* add this routes cmbLinkSetId to the list */ - g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].links[numLinks] = mtpRoute.cmbLinkSetId; - - /* increment the number of cmbLinkSets on this linkset */ - g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks++; - - /* update the linked list */ - lnkSet->next = ftdm_malloc(sizeof(sng_link_set_list_t)); - lnkSet = lnkSet->next; - lnkSet->lsId = 0; - lnkSet->next = NULL; - -move_along: - /* move to the next linkset element */ - linkset = linkset->next; - /**************************************************************************/ - } /* while (linkset != null) */ - - - ftmod_ss7_fill_in_mtp3_route(&mtpRoute); - - ftmod_ss7_fill_in_nsap(&mtpRoute); - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_isup_interfaces(ftdm_conf_node_t *isup_interfaces) -{ - ftdm_conf_node_t *isup_interface = NULL; - - /* confirm that we are looking at isup_interfaces */ - if (strcasecmp(isup_interfaces->name, "isup_interfaces")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"isup_interfaces\"!\n",isup_interfaces->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"isup_interfaces\"...\n"); - } - - /* extract the isup_interfaces */ - isup_interface = isup_interfaces->child; - - while (isup_interface != NULL) { - /* parse the found mtp_route */ - if (ftmod_ss7_parse_isup_interface(isup_interface)) { - SS7_ERROR("Failed to parse \"isup_interface\"\n"); - return FTDM_FAIL; - } - - /* go to the next mtp_route */ - isup_interface = isup_interface->next; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) -{ - sng_isup_inf_t sng_isup; - sng_isap_t sng_isap; - sng_link_set_list_t *lnkSet; - ftdm_conf_parameter_t *parm = isup_interface->parameters; - int num_parms = isup_interface->n_parameters; - int i; - int ret; - - /* initalize the isup intf and isap structure */ - memset(&sng_isup, 0x0, sizeof(sng_isup)); - memset(&sng_isap, 0x0, sizeof(sng_isap)); - - /* confirm that we are looking at an mtp_link */ - if (strcasecmp(isup_interface->name, "isup_interface")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"isup_interface\"!\n",isup_interface->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"isup_interface\"...\n"); - } - - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - /* try to match the parameter to what we expect */ - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)sng_isup.name, parm->val); - SS7_DEBUG("Found an isup_interface named = %s\n", sng_isup.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - sng_isup.id = atoi(parm->val); - SS7_DEBUG("Found an isup id = %d\n", sng_isup.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "spc")) { - /**********************************************************************/ - sng_isup.spc = atoi(parm->val); - SS7_DEBUG("Found an isup SPC = %d\n", sng_isup.spc); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtprouteId")) { - /**********************************************************************/ - sng_isup.mtpRouteId=atoi(parm->val); - - SS7_DEBUG("Found an isup mptRouteId = %d\n", sng_isup.mtpRouteId); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "ssf")) { - /**********************************************************************/ - ret = find_ssf_type_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid isup ssf = %s\n", parm->var); - return FTDM_FAIL; - } else { - sng_isup.ssf = sng_ssf_type_map[ret].tril_type; - sng_isap.ssf = sng_ssf_type_map[ret].tril_type; - SS7_DEBUG("Found an isup ssf = %s\n", sng_ssf_type_map[ret].sng_type); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t1")) { - /**********************************************************************/ - sng_isap.t1 = atoi(parm->val); - SS7_DEBUG("Found isup t1 = %d\n",sng_isap.t1); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t2")) { - /**********************************************************************/ - sng_isap.t2 = atoi(parm->val); - SS7_DEBUG("Found isup t2 = %d\n",sng_isap.t2); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t4")) { - /**********************************************************************/ - sng_isup.t4 = atoi(parm->val); - SS7_DEBUG("Found isup t4 = %d\n",sng_isup.t4); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t5")) { - /**********************************************************************/ - sng_isap.t5 = atoi(parm->val); - SS7_DEBUG("Found isup t5 = %d\n",sng_isap.t5); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t6")) { - /**********************************************************************/ - sng_isap.t6 = atoi(parm->val); - SS7_DEBUG("Found isup t6 = %d\n",sng_isap.t6); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t7")) { - /**********************************************************************/ - sng_isap.t7 = atoi(parm->val); - SS7_DEBUG("Found isup t7 = %d\n",sng_isap.t7); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t8")) { - /**********************************************************************/ - sng_isap.t8 = atoi(parm->val); - SS7_DEBUG("Found isup t8 = %d\n",sng_isap.t8); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t9")) { - /**********************************************************************/ - sng_isap.t9 = atoi(parm->val); - SS7_DEBUG("Found isup t9 = %d\n",sng_isap.t9); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t11")) { - /**********************************************************************/ - sng_isup.t11 = atoi(parm->val); - SS7_DEBUG("Found isup t11 = %d\n",sng_isup.t11); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t18")) { - /**********************************************************************/ - sng_isup.t18 = atoi(parm->val); - SS7_DEBUG("Found isup t18 = %d\n",sng_isup.t18); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t19")) { - /**********************************************************************/ - sng_isup.t19 = atoi(parm->val); - SS7_DEBUG("Found isup t19 = %d\n",sng_isup.t19); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t20")) { - /**********************************************************************/ - sng_isup.t20 = atoi(parm->val); - SS7_DEBUG("Found isup t20 = %d\n",sng_isup.t20); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t21")) { - /**********************************************************************/ - sng_isup.t21 = atoi(parm->val); - SS7_DEBUG("Found isup t21 = %d\n",sng_isup.t21); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t22")) { - /**********************************************************************/ - sng_isup.t22 = atoi(parm->val); - SS7_DEBUG("Found isup t22 = %d\n",sng_isup.t22); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t23")) { - /**********************************************************************/ - sng_isup.t23 = atoi(parm->val); - SS7_DEBUG("Found isup t23 = %d\n",sng_isup.t23); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t24")) { - /**********************************************************************/ - sng_isup.t24 = atoi(parm->val); - SS7_DEBUG("Found isup t24 = %d\n",sng_isup.t24); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t25")) { - /**********************************************************************/ - sng_isup.t25 = atoi(parm->val); - SS7_DEBUG("Found isup t25 = %d\n",sng_isup.t25); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t26")) { - /**********************************************************************/ - sng_isup.t26 = atoi(parm->val); - SS7_DEBUG("Found isup t26 = %d\n",sng_isup.t26); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t28")) { - /**********************************************************************/ - sng_isup.t28 = atoi(parm->val); - SS7_DEBUG("Found isup t28 = %d\n",sng_isup.t28); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t29")) { - /**********************************************************************/ - sng_isup.t29 = atoi(parm->val); - SS7_DEBUG("Found isup t29 = %d\n",sng_isup.t29); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t30")) { - /**********************************************************************/ - sng_isup.t30 = atoi(parm->val); - SS7_DEBUG("Found isup t30 = %d\n",sng_isup.t30); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t31")) { - /**********************************************************************/ - sng_isap.t31 = atoi(parm->val); - SS7_DEBUG("Found isup t31 = %d\n",sng_isap.t31); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t32")) { - /**********************************************************************/ - sng_isup.t32 = atoi(parm->val); - SS7_DEBUG("Found isup t32 = %d\n",sng_isup.t32); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t33")) { - /**********************************************************************/ - sng_isap.t33 = atoi(parm->val); - SS7_DEBUG("Found isup t33 = %d\n",sng_isap.t33); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t34")) { - /**********************************************************************/ - sng_isap.t34 = atoi(parm->val); - SS7_DEBUG("Found isup t34 = %d\n",sng_isap.t34); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t36")) { - /**********************************************************************/ - sng_isap.t36 = atoi(parm->val); - SS7_DEBUG("Found isup t36 = %d\n",sng_isap.t36); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t37")) { - /**********************************************************************/ - sng_isup.t37 = atoi(parm->val); - SS7_DEBUG("Found isup t37 = %d\n",sng_isup.t37); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t38")) { - /**********************************************************************/ - sng_isup.t38 = atoi(parm->val); - SS7_DEBUG("Found isup t38 = %d\n",sng_isup.t38); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t39")) { - /**********************************************************************/ - sng_isup.t39 = atoi(parm->val); - SS7_DEBUG("Found isup t39 = %d\n",sng_isup.t39); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tccr")) { - /**********************************************************************/ - sng_isap.tccr = atoi(parm->val); - SS7_DEBUG("Found isup tccr = %d\n",sng_isap.tccr); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tccrt")) { - /**********************************************************************/ - sng_isap.tccrt = atoi(parm->val); - SS7_DEBUG("Found isup tccrt = %d\n",sng_isap.tccrt); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tex")) { - /**********************************************************************/ - sng_isap.tex = atoi(parm->val); - SS7_DEBUG("Found isup tex = %d\n",sng_isap.tex); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tect")) { - /**********************************************************************/ - sng_isap.tect = atoi(parm->val); - SS7_DEBUG("Found isup tect = %d\n",sng_isap.tect); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tcrm")) { - /**********************************************************************/ - sng_isap.tcrm = atoi(parm->val); - SS7_DEBUG("Found isup tcrm = %d\n",sng_isap.tcrm); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tcra")) { - /**********************************************************************/ - sng_isap.tcra = atoi(parm->val); - SS7_DEBUG("Found isup tcra = %d\n",sng_isap.tcra); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tfgr")) { - /**********************************************************************/ - sng_isup.tfgr = atoi(parm->val); - SS7_DEBUG("Found isup tfgr = %d\n",sng_isup.tfgr); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.trelrsp")) { - /**********************************************************************/ - sng_isap.trelrsp = atoi(parm->val); - SS7_DEBUG("Found isup trelrsp = %d\n",sng_isap.trelrsp); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tfnlrelrsp")) { - /**********************************************************************/ - sng_isap.tfnlrelrsp = atoi(parm->val); - SS7_DEBUG("Found isup tfnlrelrsp = %d\n",sng_isap.tfnlrelrsp); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tfnlrelrsp")) { - /**********************************************************************/ - sng_isap.tfnlrelrsp = atoi(parm->val); - SS7_DEBUG("Found isup tfnlrelrsp = %d\n",sng_isap.tfnlrelrsp); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tpause")) { - /**********************************************************************/ - sng_isup.tpause = atoi(parm->val); - SS7_DEBUG("Found isup tpause = %d\n",sng_isup.tpause); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tstaenq")) { - /**********************************************************************/ - sng_isup.tstaenq = atoi(parm->val); - SS7_DEBUG("Found isup tstaenq = %d\n",sng_isup.tstaenq); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter %s!\n", parm->val); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parameter */ - parm = parm + 1; - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - /* default the interface to paused state */ - sngss7_set_flag(&sng_isup, SNGSS7_PAUSED); - - - - /* trickle down the SPC to all sub entities */ - lnkSet = &g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].lnkSets; - while (lnkSet->next != NULL) { - /**************************************************************************/ - /* go through all the links and check if they belong to this linkset*/ - i = 1; - while (i < (MAX_MTP_LINKS)) { - /* check if this link is in the linkset */ - if (g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId == lnkSet->lsId) { - /* fill in the spc */ - g_ftdm_sngss7_data.cfg.mtp3Link[i].spc = sng_isup.spc; - } - - i++; - } - - /* move to the next lnkSet */ - lnkSet = lnkSet->next; - /**************************************************************************/ - } /* while (lnkSet->next != NULL) */ - - /* pull values from the lower levels */ - sng_isap.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].switchType; - - /* fill in the isap */ - ftmod_ss7_fill_in_isap(&sng_isap); - - /* pull values from the lower levels */ - sng_isup.isap = sng_isap.id; - sng_isup.dpc = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].dpc; - sng_isup.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].switchType; - sng_isup.nwId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].nwId; - - /* fill in the isup interface */ - ftmod_ss7_fill_in_isup_interface(&sng_isup); - - /* setup the self mtp3 route */ - i = sng_isup.mtpRouteId; - if(ftmod_ss7_fill_in_self_route(sng_isup.spc, - g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType, - g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType, - g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf)) { - - SS7_ERROR("Failed to fill in self route structure!\n"); - return FTDM_FAIL; - - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_parse_cc_spans(ftdm_conf_node_t *cc_spans) -{ - ftdm_conf_node_t *cc_span = NULL; - - /* confirm that we are looking at cc_spans */ - if (strcasecmp(cc_spans->name, "cc_spans")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"cc_spans\"!\n",cc_spans->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"cc_spans\"...\n"); - } - - /* extract the cc_spans */ - cc_span = cc_spans->child; - - while (cc_span != NULL) { - /* parse the found cc_span */ - if (ftmod_ss7_parse_cc_span(cc_span)) { - SS7_ERROR("Failed to parse \"cc_span\"\n"); - return FTDM_FAIL; - } - - /* go to the next cc_span */ - cc_span = cc_span->next; - } - - return FTDM_SUCCESS; - -} - -/******************************************************************************/ -static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) -{ - sng_ccSpan_t sng_ccSpan; - ftdm_conf_parameter_t *parm = cc_span->parameters; - int num_parms = cc_span->n_parameters; - int flag_clg_nadi = 0; - int flag_cld_nadi = 0; - int flag_rdnis_nadi = 0; - int flag_loc_nadi = 0; - int i; - int ret; - - /* initalize the ccSpan structure */ - memset(&sng_ccSpan, 0x0, sizeof(sng_ccSpan)); - - - /* confirm that we are looking at an mtp_link */ - if (strcasecmp(cc_span->name, "cc_span")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"cc_span\"!\n",cc_span->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"cc_span\"...\n"); - } - - /* Backward compatible. - * If cpg_on_progress_media is not in the config file - * default the cpg on progress_media to TRUE */ - sng_ccSpan.cpg_on_progress_media=FTDM_TRUE; - /* If transparent_iam_max_size is not set in cc spans - * use the global value */ - sng_ccSpan.transparent_iam_max_size=g_ftdm_sngss7_data.cfg.transparent_iam_max_size; - - - for (i = 0; i < num_parms; i++) { - /**************************************************************************/ - - /* try to match the parameter to what we expect */ - if (!strcasecmp(parm->var, "name")) { - /**********************************************************************/ - strcpy((char *)sng_ccSpan.name, parm->val); - SS7_DEBUG("Found an ccSpan named = %s\n", sng_ccSpan.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "id")) { - /**********************************************************************/ - sng_ccSpan.id = atoi(parm->val); - SS7_DEBUG("Found an ccSpan id = %d\n", sng_ccSpan.id); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "procid")) { - /**********************************************************************/ - sng_ccSpan.procId = atoi(parm->val); - SS7_DEBUG("Found an ccSpan procId = %d\n", sng_ccSpan.procId); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "ch_map")) { - /**********************************************************************/ - strcpy(sng_ccSpan.ch_map, parm->val); - SS7_DEBUG("Found channel map %s\n", sng_ccSpan.ch_map); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "typeCntrl")) { - /**********************************************************************/ - ret = find_cic_cntrl_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid ccSpan typeCntrl = %s\n", parm->var); - return FTDM_FAIL; - } else { - sng_ccSpan.typeCntrl = sng_cic_cntrl_type_map[ret].tril_type; - SS7_DEBUG("Found an ccSpan typeCntrl = %s\n", sng_cic_cntrl_type_map[ret].sng_type); - } - } else if (!strcasecmp(parm->var, "itx_auto_reply")) { - sng_ccSpan.itx_auto_reply = ftdm_true(parm->val); - SS7_DEBUG("Found itx_auto_reply %d\n", sng_ccSpan.itx_auto_reply); - } else if (!strcasecmp(parm->var, "transparent_iam")) { -#ifndef HAVE_ZLIB - SS7_CRIT("Cannot enable transparent IAM becauze zlib not installed\n"); -#else - sng_ccSpan.transparent_iam = ftdm_true(parm->val); - SS7_DEBUG("Found transparent_iam %d\n", sng_ccSpan.transparent_iam); -#endif - } else if (!strcasecmp(parm->var, "transparent_iam_max_size")) { - sng_ccSpan.transparent_iam_max_size = atoi(parm->val); - SS7_DEBUG("Found transparent_iam_max_size %d\n", sng_ccSpan.transparent_iam_max_size); - } else if (!strcasecmp(parm->var, "cpg_on_progress_media")) { - sng_ccSpan.cpg_on_progress_media = ftdm_true(parm->val); - SS7_DEBUG("Found cpg_on_progress_media %d\n", sng_ccSpan.cpg_on_progress_media); - } else if (!strcasecmp(parm->var, "cpg_on_progress")) { - sng_ccSpan.cpg_on_progress = ftdm_true(parm->val); - SS7_DEBUG("Found cpg_on_progress %d\n", sng_ccSpan.cpg_on_progress); - } else if (!strcasecmp(parm->var, "cicbase")) { - /**********************************************************************/ - sng_ccSpan.cicbase = atoi(parm->val); - SS7_DEBUG("Found a cicbase = %d\n", sng_ccSpan.cicbase); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup_interface")) { - /**********************************************************************/ - sng_ccSpan.isupInf = atoi(parm->val); - SS7_DEBUG("Found an isup_interface = %d\n",sng_ccSpan.isupInf); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "min_digits")) { - /**********************************************************************/ - sng_ccSpan.min_digits = atoi(parm->val); - SS7_DEBUG("Found a min_digits = %d\n",sng_ccSpan.min_digits); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "clg_nadi")) { - /**********************************************************************/ - /* throw the flag so that we know we got this optional parameter */ - flag_clg_nadi = 1; - sng_ccSpan.clg_nadi = atoi(parm->val); - SS7_DEBUG("Found default CLG_NADI parm->value = %d\n", sng_ccSpan.clg_nadi); - } else if (!strcasecmp(parm->var, "cld_nadi")) { - /* throw the flag so that we know we got this optional parameter */ - flag_cld_nadi = 1; - sng_ccSpan.cld_nadi = atoi(parm->val); - SS7_DEBUG("Found default CLD_NADI parm->value = %d\n", sng_ccSpan.cld_nadi); - } else if (!strcasecmp(parm->var, "rdnis_nadi")) { - /* throw the flag so that we know we got this optional parameter */ - flag_rdnis_nadi = 1; - sng_ccSpan.rdnis_nadi = atoi(parm->val); - SS7_DEBUG("Found default RDNIS_NADI parm->value = %d\n", sng_ccSpan.rdnis_nadi); - } else if (!strcasecmp(parm->var, "obci_bita")) { - if (*parm->val == '1') { - sngss7_set_options(&sng_ccSpan, SNGSS7_ACM_OBCI_BITA); - SS7_DEBUG("Found Optional Backwards Indicator: Bit A (early media) enable option\n"); - } else if (*parm->val == '0') { - sngss7_clear_options(&sng_ccSpan, SNGSS7_ACM_OBCI_BITA); - SS7_DEBUG("Found Optional Backwards Indicator: Bit A (early media) disable option\n"); - } else { - SS7_DEBUG("Invalid parm->value for obci_bita option\n"); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "loc_nadi")) { - /* add location reference number */ - flag_loc_nadi = 1; - sng_ccSpan.loc_nadi = atoi(parm->val); - SS7_DEBUG("Found default LOC_NADI parm->value = %d\n", sng_ccSpan.loc_nadi); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "lpa_on_cot")) { - /**********************************************************************/ - if (*parm->val == '1') { - sngss7_set_options(&sng_ccSpan, SNGSS7_LPA_FOR_COT); - SS7_DEBUG("Found Tx LPA on COT enable option\n"); - } else if (*parm->val == '0') { - sngss7_clear_options(&sng_ccSpan, SNGSS7_LPA_FOR_COT); - SS7_DEBUG("Found Tx LPA on COT disable option\n"); - } else { - SS7_DEBUG("Invalid parm->value for lpa_on_cot option\n"); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t3")) { - /**********************************************************************/ - sng_ccSpan.t3 = atoi(parm->val); - SS7_DEBUG("Found isup t3 = %d\n", sng_ccSpan.t3); - } else if (!strcasecmp(parm->var, "isup.t10")) { - /**********************************************************************/ - sng_ccSpan.t10 = atoi(parm->val); - SS7_DEBUG("Found isup t10 = %d\n", sng_ccSpan.t10); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t12")) { - /**********************************************************************/ - sng_ccSpan.t12 = atoi(parm->val); - SS7_DEBUG("Found isup t12 = %d\n", sng_ccSpan.t12); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t13")) { - /**********************************************************************/ - sng_ccSpan.t13 = atoi(parm->val); - SS7_DEBUG("Found isup t13 = %d\n", sng_ccSpan.t13); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t14")) { - /**********************************************************************/ - sng_ccSpan.t14 = atoi(parm->val); - SS7_DEBUG("Found isup t14 = %d\n", sng_ccSpan.t14); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t15")) { - /**********************************************************************/ - sng_ccSpan.t15 = atoi(parm->val); - SS7_DEBUG("Found isup t15 = %d\n", sng_ccSpan.t15); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t16")) { - /**********************************************************************/ - sng_ccSpan.t16 = atoi(parm->val); - SS7_DEBUG("Found isup t16 = %d\n", sng_ccSpan.t16); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t17")) { - /**********************************************************************/ - sng_ccSpan.t17 = atoi(parm->val); - SS7_DEBUG("Found isup t17 = %d\n", sng_ccSpan.t17); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t35")) { - /**********************************************************************/ - sng_ccSpan.t35 = atoi(parm->val); - SS7_DEBUG("Found isup t35 = %d\n",sng_ccSpan.t35); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t39")) { - /**********************************************************************/ - sng_ccSpan.t39 = atoi(parm->val); - SS7_DEBUG("Found isup t39 = %d\n",sng_ccSpan.t39); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.tval")) { - /**********************************************************************/ - sng_ccSpan.tval = atoi(parm->val); - SS7_DEBUG("Found isup tval = %d\n", sng_ccSpan.tval); - /**********************************************************************/ - } else { - /**********************************************************************/ - SS7_ERROR("Found an invalid parameter %s!\n", parm->var); - return FTDM_FAIL; - /**********************************************************************/ - } - - /* move to the next parameter */ - parm = parm + 1; - /**************************************************************************/ - } /* for (i = 0; i < num_parms; i++) */ - - /* check if the user filled in a nadi value by looking at flag */ - if (!flag_cld_nadi) { - /* default the nadi value to national */ - sng_ccSpan.cld_nadi = 0x03; - } - - if (!flag_clg_nadi) { - /* default the nadi value to national */ - sng_ccSpan.clg_nadi = 0x03; - } - - if (!flag_rdnis_nadi) { - /* default the nadi value to national */ - sng_ccSpan.rdnis_nadi = 0x03; - } - - if (!flag_loc_nadi) { - /* default the nadi value to national */ - sng_ccSpan.loc_nadi = 0x03; - } - - /* pull up the SSF and Switchtype from the isup interface */ - sng_ccSpan.ssf = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].ssf; - sng_ccSpan.switchType = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].switchType; - - /* add this span to our global listing */ - ftmod_ss7_fill_in_ccSpan(&sng_ccSpan); - - /* make sure the isup interface structure has something in it */ - if (g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].id == 0) { - /* fill in the id, so that we know it exists */ - g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].id = sng_ccSpan.isupInf; - - /* default the status to PAUSED */ - sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf], SNGSS7_PAUSED); - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_relay_channel(sng_relay_t *relay_channel) -{ - int i; - - /* go through all the existing channels and see if we find a match */ - i = 1; - while (g_ftdm_sngss7_data.cfg.relay[i].id != 0) { - if ((g_ftdm_sngss7_data.cfg.relay[i].type == relay_channel->type) && - (g_ftdm_sngss7_data.cfg.relay[i].port == relay_channel->port) && - (g_ftdm_sngss7_data.cfg.relay[i].procId == relay_channel->procId) && - (!strcasecmp(g_ftdm_sngss7_data.cfg.relay[i].hostname, relay_channel->hostname))) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - /* if the id value is 0 that means we didn't find the relay channel */ - if (g_ftdm_sngss7_data.cfg.relay[i].id == 0) { - relay_channel->id = i; - SS7_DEBUG("found new relay channel on type:%d, hostname:%s, port:%d, procId:%d, id = %d\n", - relay_channel->type, - relay_channel->hostname, - relay_channel->port, - relay_channel->procId, - relay_channel->id); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_PRESENT); - } else { - relay_channel->id = i; - SS7_DEBUG("found existing relay channel on type:%d, hostname:%s, port:%d, procId:%d, id = %d\n", - relay_channel->type, - relay_channel->hostname, - relay_channel->port, - relay_channel->procId, - relay_channel->id); - } - - g_ftdm_sngss7_data.cfg.relay[i].id = relay_channel->id; - g_ftdm_sngss7_data.cfg.relay[i].type = relay_channel->type; - g_ftdm_sngss7_data.cfg.relay[i].port = relay_channel->port; - g_ftdm_sngss7_data.cfg.relay[i].procId = relay_channel->procId; - strcpy(g_ftdm_sngss7_data.cfg.relay[i].hostname, relay_channel->hostname); - strcpy(g_ftdm_sngss7_data.cfg.relay[i].name, relay_channel->name); - - /* if this is THE listen channel grab the procId and use it */ - if (relay_channel->type == LRY_CT_TCP_LISTEN) { - g_ftdm_sngss7_data.cfg.procId = relay_channel->procId; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_mtp1_link(sng_mtp1_link_t *mtp1Link) -{ - int i = mtp1Link->id; - - /* check if this id value has been used already */ - if (g_ftdm_sngss7_data.cfg.mtp1Link[i].id == 0) { - SS7_DEBUG("Found new MTP1 Link: id=%d, name=%s\n", mtp1Link->id, mtp1Link->name); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1_PRESENT); - } else { - SS7_DEBUG("Found an existing MTP1 Link: id=%d, name=%s (old name=%s)\n", - mtp1Link->id, - mtp1Link->name, - g_ftdm_sngss7_data.cfg.mtp1Link[i].name); - } - - /* copy over the values */ - strcpy((char *)g_ftdm_sngss7_data.cfg.mtp1Link[i].name, (char *)mtp1Link->name); - - g_ftdm_sngss7_data.cfg.mtp1Link[i].id = mtp1Link->id; - g_ftdm_sngss7_data.cfg.mtp1Link[i].span = mtp1Link->span; - g_ftdm_sngss7_data.cfg.mtp1Link[i].chan = mtp1Link->chan; - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_mtp2_link(sng_mtp2_link_t *mtp2Link) -{ - int i = mtp2Link->id; - - /* check if this id value has been used already */ - if (g_ftdm_sngss7_data.cfg.mtp2Link[i].id == 0) { - SS7_DEBUG("Found new MTP2 Link: id=%d, name=%s\n", mtp2Link->id, mtp2Link->name); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_PRESENT); - } else { - SS7_DEBUG("Found an existing MTP2 Link: id=%d, name=%s (old name=%s)\n", - mtp2Link->id, - mtp2Link->name, - g_ftdm_sngss7_data.cfg.mtp2Link[i].name); - } - - /* copy over the values */ - strcpy((char *)g_ftdm_sngss7_data.cfg.mtp2Link[i].name, (char *)mtp2Link->name); - - g_ftdm_sngss7_data.cfg.mtp2Link[i].id = mtp2Link->id; - g_ftdm_sngss7_data.cfg.mtp2Link[i].lssuLength = mtp2Link->lssuLength; - g_ftdm_sngss7_data.cfg.mtp2Link[i].errorType = mtp2Link->errorType; - g_ftdm_sngss7_data.cfg.mtp2Link[i].linkType = mtp2Link->linkType; - g_ftdm_sngss7_data.cfg.mtp2Link[i].mtp1Id = mtp2Link->mtp1Id; - g_ftdm_sngss7_data.cfg.mtp2Link[i].mtp1ProcId = mtp2Link->mtp1ProcId; - - if ( mtp2Link->t1 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t1 = mtp2Link->t1; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t1 = 500; - } - - if ( mtp2Link->t2 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t2 = mtp2Link->t2; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t2 = 250; - } - - if ( mtp2Link->t3 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t3 = mtp2Link->t3; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t3 = 20; - } - - if ( mtp2Link->t4n != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t4n = mtp2Link->t4n; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t4n = 80; - } - - if ( mtp2Link->t4e != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t4e = mtp2Link->t4e; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t4e = 5; - } - - if ( mtp2Link->t5 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t5 = mtp2Link->t5; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t5 = 1; - } - - if ( mtp2Link->t6 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t6 = mtp2Link->t6; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t6 = 60; - } - - if ( mtp2Link->t7 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t7 = mtp2Link->t7; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t7 = 20; - } - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_mtp3_link(sng_mtp3_link_t *mtp3Link) -{ - int i = mtp3Link->id; - - /* check if this id value has been used already */ - if (g_ftdm_sngss7_data.cfg.mtp3Link[i].id == 0) { - SS7_DEBUG("Found new MTP3 Link: id=%d, name=%s\n", mtp3Link->id, mtp3Link->name); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_PRESENT); - } else { - SS7_DEBUG("Found an existing MTP3 Link: id=%d, name=%s (old name=%s)\n", - mtp3Link->id, - mtp3Link->name, - g_ftdm_sngss7_data.cfg.mtp3Link[i].name); - } - - /* copy over the values */ - strcpy((char *)g_ftdm_sngss7_data.cfg.mtp3Link[i].name, (char *)mtp3Link->name); - - g_ftdm_sngss7_data.cfg.mtp3Link[i].id = mtp3Link->id; - g_ftdm_sngss7_data.cfg.mtp3Link[i].priority = mtp3Link->priority; - g_ftdm_sngss7_data.cfg.mtp3Link[i].linkType = mtp3Link->linkType; - g_ftdm_sngss7_data.cfg.mtp3Link[i].switchType = mtp3Link->switchType; - g_ftdm_sngss7_data.cfg.mtp3Link[i].apc = mtp3Link->apc; - g_ftdm_sngss7_data.cfg.mtp3Link[i].spc = mtp3Link->spc; /* unknown at this time */ - g_ftdm_sngss7_data.cfg.mtp3Link[i].ssf = mtp3Link->ssf; - g_ftdm_sngss7_data.cfg.mtp3Link[i].slc = mtp3Link->slc; - g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId = mtp3Link->linkSetId; - g_ftdm_sngss7_data.cfg.mtp3Link[i].mtp2Id = mtp3Link->mtp2Id; - g_ftdm_sngss7_data.cfg.mtp3Link[i].mtp2ProcId = mtp3Link->mtp2ProcId; - - if (mtp3Link->t1 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t1 = mtp3Link->t1; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t1 = 8; - } - if (mtp3Link->t2 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t2 = mtp3Link->t2; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t2 = 14; - } - if (mtp3Link->t3 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t3 = mtp3Link->t3; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t3 = 8; - } - if (mtp3Link->t4 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t4 = mtp3Link->t4; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t4 = 8; - } - if (mtp3Link->t5 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t5 = mtp3Link->t5; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t5 = 8; - } - if (mtp3Link->t7 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t7 = mtp3Link->t7; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t7 = 15; - } - if (mtp3Link->t12 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t12 = mtp3Link->t12; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t12 = 15; - } - if (mtp3Link->t13 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t13 = mtp3Link->t13; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t13 = 15; - } - if (mtp3Link->t14 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t14 = mtp3Link->t14; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t14 = 30; - } - if (mtp3Link->t17 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t17 = mtp3Link->t17; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t17 = 15; - } - if (mtp3Link->t22 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t22 = mtp3Link->t22; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t22 = 1800; - } - if (mtp3Link->t23 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t23 = mtp3Link->t23; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t23 = 1800; - } - if (mtp3Link->t24 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t24 = mtp3Link->t24; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t24 = 5; - } - if (mtp3Link->t31 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t31 = mtp3Link->t31; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t31 = 50; - } - if (mtp3Link->t32 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t32 = mtp3Link->t32; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t32 = 120; - } - if (mtp3Link->t33 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t33 = mtp3Link->t33; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t33 = 3000; - } - if (mtp3Link->t34 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t34 = mtp3Link->t34; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t34 = 600; - } - if (mtp3Link->tbnd != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].tbnd = mtp3Link->tbnd; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].tbnd = 30000; - } - if (mtp3Link->tflc != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].tflc = mtp3Link->tflc; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].tflc = 300; - } - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet) -{ - int i = mtpLinkSet->id; - - strncpy((char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[i].name, (char *)mtpLinkSet->name, MAX_NAME_LEN-1); - - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id = mtpLinkSet->id; - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].apc = mtpLinkSet->apc; - - /* these values are filled in as we find routes and start allocating cmbLinkSetIds */ - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].minActive = mtpLinkSet->minActive; - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].numLinks = 0; - return 0; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) -{ - sng_link_set_list_t *lnkSet = NULL; - int i = mtp3_route->id; - int tmp = 0; - - - /* check if this id value has been used already */ - if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) { - SS7_DEBUG("Found new MTP3 Link: id=%d, name=%s\n", mtp3_route->id, mtp3_route->name); - } else { - SS7_DEBUG("Found an existing MTP3 Link: id=%d, name=%s (old name=%s)\n", - mtp3_route->id, - mtp3_route->name, - g_ftdm_sngss7_data.cfg.mtpRoute[i].name); - } - - /* fill in the cmbLinkSet in the linkset structure */ - lnkSet = &mtp3_route->lnkSets; - - tmp = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks; - g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].links[tmp] = mtp3_route->cmbLinkSetId; - g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks++; - - while (lnkSet->next != NULL) { - tmp = g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks; - g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].links[tmp] = mtp3_route->cmbLinkSetId; - g_ftdm_sngss7_data.cfg.mtpLinkSet[lnkSet->lsId].numLinks++; - - lnkSet = lnkSet->next; - } - - strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, (char *)mtp3_route->name); - - g_ftdm_sngss7_data.cfg.mtpRoute[i].id = mtp3_route->id; - g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc = mtp3_route->dpc; - g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType = mtp3_route->linkType; - g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType = mtp3_route->switchType; - g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = mtp3_route->cmbLinkSetId; - g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP = mtp3_route->isSTP; - g_ftdm_sngss7_data.cfg.mtpRoute[i].nwId = mtp3_route->nwId; - g_ftdm_sngss7_data.cfg.mtpRoute[i].lnkSets = mtp3_route->lnkSets; - g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = mtp3_route->ssf; - g_ftdm_sngss7_data.cfg.mtpRoute[i].dir = SNG_RTE_DN; - if (mtp3_route->t6 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t6 = mtp3_route->t6; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t6 = 8; - } - if (mtp3_route->t8 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t8 = mtp3_route->t8; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t8 = 12; - } - if (mtp3_route->t10 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t10 = mtp3_route->t10; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t10 = 300; - } - if (mtp3_route->t11 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t11 = mtp3_route->t11; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t11 = 300; - } - if (mtp3_route->t15 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t15 = mtp3_route->t15; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t15 = 30; - } - if (mtp3_route->t16 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t16 = mtp3_route->t16; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t16 = 20; - } - if (mtp3_route->t18 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t18 = mtp3_route->t18; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t18 = 200; - } - if (mtp3_route->t19 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t19 = mtp3_route->t19; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t19 = 690; - } - if (mtp3_route->t21 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t21 = mtp3_route->t21; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t21 = 650; - } - if (mtp3_route->t25 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t25 = mtp3_route->t25; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t25 = 100; - } - if (mtp3_route->t26 != 0) { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t26 = mtp3_route->t26; - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].t26 = 100; - } - - return 0; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf) -{ - int i = 1; - - while (i < (MAX_MTP_ROUTES)) { - if (g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc == spc) { - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) { - /* this is a new route...find the first free spot */ - i = 1; - while (i < (MAX_MTP_ROUTES)) { - if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) { - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - g_ftdm_sngss7_data.cfg.mtpRoute[i].id = i; - SS7_DEBUG("found new mtp3 self route\n"); - } else { - g_ftdm_sngss7_data.cfg.mtpRoute[i].id = i; - SS7_DEBUG("found existing mtp3 self route\n"); - } - - strncpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, "self-route", MAX_NAME_LEN-1); - - g_ftdm_sngss7_data.cfg.mtpRoute[i].id = i; - g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc = spc; - g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType = linkType; - g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType = switchType; - g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = i; - g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP = 0; - g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = ssf; - g_ftdm_sngss7_data.cfg.mtpRoute[i].dir = SNG_RTE_UP; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t6 = 8; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t8 = 12; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t10 = 300; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t11 = 300; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t15 = 30; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t16 = 20; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t18 = 200; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t19 = 690; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t21 = 650; - g_ftdm_sngss7_data.cfg.mtpRoute[i].t25 = 100; - - return 0; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route) -{ - int i; - - /* go through all the existing interfaces and see if we find a match */ - i = 1; - while (g_ftdm_sngss7_data.cfg.nsap[i].id != 0) { - if ((g_ftdm_sngss7_data.cfg.nsap[i].linkType == mtp3_route->linkType) && - (g_ftdm_sngss7_data.cfg.nsap[i].switchType == mtp3_route->switchType)) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - if (g_ftdm_sngss7_data.cfg.nsap[i].id == 0) { - g_ftdm_sngss7_data.cfg.nsap[i].id = i; - SS7_DEBUG("found new mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.nsap[i].id); - } else { - g_ftdm_sngss7_data.cfg.nsap[i].id = i; - SS7_DEBUG("found existing mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.nsap[i].id); - } - - g_ftdm_sngss7_data.cfg.nsap[i].spId = g_ftdm_sngss7_data.cfg.nsap[i].id; - g_ftdm_sngss7_data.cfg.nsap[i].suId = g_ftdm_sngss7_data.cfg.nsap[i].id; - g_ftdm_sngss7_data.cfg.nsap[i].nwId = mtp3_route->nwId; - g_ftdm_sngss7_data.cfg.nsap[i].linkType = mtp3_route->linkType; - g_ftdm_sngss7_data.cfg.nsap[i].switchType = mtp3_route->switchType; - g_ftdm_sngss7_data.cfg.nsap[i].ssf = mtp3_route->ssf; - - return 0; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) -{ - int i = sng_isup->id; - - /* check if this id value has been used already */ - if (g_ftdm_sngss7_data.cfg.isupIntf[i].id == 0) { - SS7_DEBUG("Found new ISUP Interface: id=%d, name=%s\n", sng_isup->id, sng_isup->name); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_PRESENT); - } else { - SS7_DEBUG("Found an existing ISUP Interface: id=%d, name=%s (old name=%s)\n", - sng_isup->id, - sng_isup->name, - g_ftdm_sngss7_data.cfg.isupIntf[i].name); - } - - strncpy((char *)g_ftdm_sngss7_data.cfg.isupIntf[i].name, (char *)sng_isup->name, MAX_NAME_LEN-1); - - g_ftdm_sngss7_data.cfg.isupIntf[i].id = sng_isup->id; - g_ftdm_sngss7_data.cfg.isupIntf[i].mtpRouteId = sng_isup->mtpRouteId; - g_ftdm_sngss7_data.cfg.isupIntf[i].nwId = sng_isup->nwId; - g_ftdm_sngss7_data.cfg.isupIntf[i].dpc = sng_isup->dpc; - g_ftdm_sngss7_data.cfg.isupIntf[i].spc = sng_isup->spc; - g_ftdm_sngss7_data.cfg.isupIntf[i].switchType = sng_isup->switchType; - g_ftdm_sngss7_data.cfg.isupIntf[i].ssf = sng_isup->ssf; - g_ftdm_sngss7_data.cfg.isupIntf[i].isap = sng_isup->isap; - g_ftdm_sngss7_data.cfg.isupIntf[i].options = sng_isup->options; - if (sng_isup->t4 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = sng_isup->t4; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = 3000; - } - if (sng_isup->t11 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t11 = sng_isup->t11; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t11 = 170; - } - if (sng_isup->t18 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t18 = sng_isup->t18; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t18 = 300; - } - if (sng_isup->t19 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t19 = sng_isup->t19; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t19 = 3000; - } - if (sng_isup->t20 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t20 = sng_isup->t20; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t20 = 300; - } - if (sng_isup->t21 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t21 = sng_isup->t21; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t21 = 3000; - } - if (sng_isup->t22 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t22 = sng_isup->t22; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t22 = 300; - } - if (sng_isup->t23 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t23 = sng_isup->t23; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t23 = 3000; - } - if (sng_isup->t24 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t24 = sng_isup->t24; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t24 = 10; - } - if (sng_isup->t25 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t25 = sng_isup->t25; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t25 = 20; - } - if (sng_isup->t26 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t26 = sng_isup->t26; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t26 = 600; - } - if (sng_isup->t28 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t28 = sng_isup->t28; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t28 = 100; - } - if (sng_isup->t29 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t29 = sng_isup->t29; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t29 = 6; - } - if (sng_isup->t30 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t30 = sng_isup->t30; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t30 = 50; - } - if (sng_isup->t32 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t32 = sng_isup->t32; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t32 = 30; - } - if (sng_isup->t37 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t37 = sng_isup->t37; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t37 = 20; - } - if (sng_isup->t38 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t38 = sng_isup->t38; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t38 = 1200; - } - if (sng_isup->t39 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t39 = sng_isup->t39; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t39 = 300; - } - if (sng_isup->tfgr != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].tfgr = sng_isup->tfgr; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].tfgr = 50; - } - if (sng_isup->tpause != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].tpause = sng_isup->tpause; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].tpause = 3000; - } - if (sng_isup->tstaenq != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].tstaenq = sng_isup->tstaenq; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].tstaenq = 5000; - } - - return 0; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap) -{ - int i; - - /* go through all the existing interfaces and see if we find a match */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isap[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.isap[i].switchType == sng_isap->switchType) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - if (g_ftdm_sngss7_data.cfg.isap[i].id == 0) { - sng_isap->id = i; - SS7_DEBUG("found new isup to cc interface, id is = %d\n", sng_isap->id); - } else { - sng_isap->id = i; - SS7_DEBUG("found existing isup to cc interface, id is = %d\n", sng_isap->id); - } - - g_ftdm_sngss7_data.cfg.isap[i].id = sng_isap->id; - g_ftdm_sngss7_data.cfg.isap[i].suId = sng_isap->id; - g_ftdm_sngss7_data.cfg.isap[i].spId = sng_isap->id; - g_ftdm_sngss7_data.cfg.isap[i].switchType = sng_isap->switchType; - g_ftdm_sngss7_data.cfg.isap[i].ssf = sng_isap->ssf; - - if (sng_isap->t1 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t1 = sng_isap->t1; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t1 = 150; - } - if (sng_isap->t2 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t2 = sng_isap->t2; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t2 = 1800; - } - if (sng_isap->t5 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t5 = sng_isap->t5; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t5 = 3000; - } - if (sng_isap->t6 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t6 = sng_isap->t6; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t6 = 600; - } - if (sng_isap->t7 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t7 = sng_isap->t7; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t7 = 200; - } - if (sng_isap->t8 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t8 = sng_isap->t8; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t8 = 100; - } - if (sng_isap->t9 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t9 = sng_isap->t9; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t9 = 1800; - } - if (sng_isap->t27 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t27 = sng_isap->t27; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t27 = 2400; - } - if (sng_isap->t31 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t31 = sng_isap->t31; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t31 = 3650; - } - if (sng_isap->t33 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t33 = sng_isap->t33; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t33 = 120; - } - if (sng_isap->t34 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t34 = sng_isap->t34; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t34 = 40; - } - if (sng_isap->t36 != 0) { - g_ftdm_sngss7_data.cfg.isap[i].t36 = sng_isap->t36; - } else { - g_ftdm_sngss7_data.cfg.isap[i].t36 = 120; - } - if (sng_isap->tccr != 0) { - g_ftdm_sngss7_data.cfg.isap[i].tccr = sng_isap->tccr; - } else { - g_ftdm_sngss7_data.cfg.isap[i].tccr = 200; - } - if (sng_isap->tccrt != 0) { - g_ftdm_sngss7_data.cfg.isap[i].tccrt = sng_isap->tccrt; - } else { - g_ftdm_sngss7_data.cfg.isap[i].tccrt = 20; - } - if (sng_isap->tex != 0) { - g_ftdm_sngss7_data.cfg.isap[i].tex = sng_isap->tex; - } else { - g_ftdm_sngss7_data.cfg.isap[i].tex = 1000; - } - if (sng_isap->tcrm != 0) { - g_ftdm_sngss7_data.cfg.isap[i].tcrm = sng_isap->tcrm; - } else { - g_ftdm_sngss7_data.cfg.isap[i].tcrm = 30; - } - if (sng_isap->tcra != 0) { - g_ftdm_sngss7_data.cfg.isap[i].tcra = sng_isap->tcra; - } else { - g_ftdm_sngss7_data.cfg.isap[i].tcra = 100; - } - if (sng_isap->tect != 0) { - g_ftdm_sngss7_data.cfg.isap[i].tect = sng_isap->tect; - } else { - g_ftdm_sngss7_data.cfg.isap[i].tect = 10; - } - if (sng_isap->trelrsp != 0) { - g_ftdm_sngss7_data.cfg.isap[i].trelrsp = sng_isap->trelrsp; - } else { - g_ftdm_sngss7_data.cfg.isap[i].trelrsp = 10; - } - if (sng_isap->tfnlrelrsp != 0) { - g_ftdm_sngss7_data.cfg.isap[i].tfnlrelrsp = sng_isap->tfnlrelrsp; - } else { - g_ftdm_sngss7_data.cfg.isap[i].tfnlrelrsp = 10; - } - - return 0; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan) -{ - sng_timeslot_t timeslot; - sngss7_chan_data_t *ss7_info = NULL; - int x; - int count = 1; - int flag; - - while (ccSpan->ch_map[0] != '\0') { - /**************************************************************************/ - - /* pull out the next timeslot */ - if (ftmod_ss7_next_timeslot(ccSpan->ch_map, ×lot)) { - SS7_ERROR("Failed to parse the channel map!\n"); - return FTDM_FAIL; - } - - /* find a spot for this circuit in the global structure */ - x = (ccSpan->procId * 1000) + 1; - flag = 0; - while (flag == 0) { - /**********************************************************************/ - /* check the id value ( 0 = new, 0 > circuit can be existing) */ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) { - /* we're at the end of the list of circuitsl aka this is new */ - SS7_DEBUG("Found a new circuit %d, ccSpanId=%d, chan=%d\n", - x, - ccSpan->id, - count); - - /* throw the flag to end the loop */ - flag = 1; - } else { - /* check the ccspan.id and chan to see if the circuit already exists */ - if ((g_ftdm_sngss7_data.cfg.isupCkt[x].ccSpanId == ccSpan->id) && - (g_ftdm_sngss7_data.cfg.isupCkt[x].chan == count)) { - - /* we are processing a circuit that already exists */ - SS7_DEVEL_DEBUG("Found an existing circuit %d, ccSpanId=%d, chan%d\n", - x, - ccSpan->id, - count); - - /* throw the flag to end the loop */ - flag = 1; - - /* not supporting reconfig at this time */ - SS7_DEVEL_DEBUG("Not supporting ckt reconfig at this time!\n"); - goto move_along; - } else { - /* this is not the droid you are looking for */ - x++; - } - } - /**********************************************************************/ - } /* while (flag == 0) */ - - /* prepare the global info sturcture */ - ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t)); - ss7_info->ftdmchan = NULL; - if (ftdm_queue_create(&ss7_info->event_queue, SNGSS7_CHAN_EVENT_QUEUE_SIZE) != FTDM_SUCCESS) { - SS7_CRITICAL("Failed to create ss7 cic event queue\n"); - } - ss7_info->circuit = &g_ftdm_sngss7_data.cfg.isupCkt[x]; - - g_ftdm_sngss7_data.cfg.isupCkt[x].obj = ss7_info; - - /* fill in the rest of the global structure */ - g_ftdm_sngss7_data.cfg.isupCkt[x].procId = ccSpan->procId; - g_ftdm_sngss7_data.cfg.isupCkt[x].id = x; - g_ftdm_sngss7_data.cfg.isupCkt[x].ccSpanId = ccSpan->id; - g_ftdm_sngss7_data.cfg.isupCkt[x].span = 0; - g_ftdm_sngss7_data.cfg.isupCkt[x].chan = count; - - if (timeslot.siglink) { - g_ftdm_sngss7_data.cfg.isupCkt[x].type = SNG_CKT_SIG; - } else if (timeslot.gap) { - g_ftdm_sngss7_data.cfg.isupCkt[x].type = SNG_CKT_HOLE; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].type = SNG_CKT_VOICE; - - /* throw the flag to indicate that we need to start call control */ - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_PRESENT); - } - - if (timeslot.channel) { - g_ftdm_sngss7_data.cfg.isupCkt[x].cic = ccSpan->cicbase; - ccSpan->cicbase++; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].cic = 0; - } - - g_ftdm_sngss7_data.cfg.isupCkt[x].infId = ccSpan->isupInf; - g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = ccSpan->typeCntrl; - g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = ccSpan->ssf; - g_ftdm_sngss7_data.cfg.isupCkt[x].cld_nadi = ccSpan->cld_nadi; - g_ftdm_sngss7_data.cfg.isupCkt[x].clg_nadi = ccSpan->clg_nadi; - g_ftdm_sngss7_data.cfg.isupCkt[x].rdnis_nadi = ccSpan->rdnis_nadi; - g_ftdm_sngss7_data.cfg.isupCkt[x].loc_nadi = ccSpan->loc_nadi; - g_ftdm_sngss7_data.cfg.isupCkt[x].options = ccSpan->options; - g_ftdm_sngss7_data.cfg.isupCkt[x].switchType = ccSpan->switchType; - g_ftdm_sngss7_data.cfg.isupCkt[x].min_digits = ccSpan->min_digits; - g_ftdm_sngss7_data.cfg.isupCkt[x].itx_auto_reply = ccSpan->itx_auto_reply; - g_ftdm_sngss7_data.cfg.isupCkt[x].transparent_iam = ccSpan->transparent_iam; - g_ftdm_sngss7_data.cfg.isupCkt[x].transparent_iam_max_size = ccSpan->transparent_iam_max_size; - g_ftdm_sngss7_data.cfg.isupCkt[x].cpg_on_progress_media = ccSpan->cpg_on_progress_media; - g_ftdm_sngss7_data.cfg.isupCkt[x].cpg_on_progress = ccSpan->cpg_on_progress; - - if (ccSpan->t3 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = ccSpan->t3; - } - if (ccSpan->t10 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t10 = 50; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t10 = ccSpan->t10; - } - if (ccSpan->t12 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = ccSpan->t12; - } - if (ccSpan->t13 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = ccSpan->t13; - } - if (ccSpan->t14 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = ccSpan->t14; - } - if (ccSpan->t15 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = ccSpan->t15; - } - if (ccSpan->t16 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = ccSpan->t16; - } - if (ccSpan->t17 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = ccSpan->t17; - } - if (ccSpan->t35 == 0) { - /* Q.764 2.2.5 Address incomplete (T35 is 15-20 seconds according to Table A.1/Q.764) */ - g_ftdm_sngss7_data.cfg.isupCkt[x].t35 = 170; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t35 = ccSpan->t35; - } - if (ccSpan->t39 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t39 = 120; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t39 = ccSpan->t39; - } - - if (ccSpan->tval == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10; - } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].tval = ccSpan->tval; - } - - SS7_INFO("Added procId=%d, spanId = %d, chan = %d, cic = %d, ISUP cirId = %d\n", - g_ftdm_sngss7_data.cfg.isupCkt[x].procId, - g_ftdm_sngss7_data.cfg.isupCkt[x].ccSpanId, - g_ftdm_sngss7_data.cfg.isupCkt[x].chan, - g_ftdm_sngss7_data.cfg.isupCkt[x].cic, - g_ftdm_sngss7_data.cfg.isupCkt[x].id); - -move_along: - /* increment the span channel count */ - count++; - - /**************************************************************************/ - } /* while (ccSpan->ch_map[0] != '\0') */ - - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_fill_in_circuits(sng_span_t *sngSpan) -{ - ftdm_channel_t *ftdmchan = NULL; - ftdm_span_t *ftdmspan = sngSpan->span; - sng_isup_ckt_t *isupCkt = NULL; - sngss7_chan_data_t *ss7_info = NULL; - int flag; - int i; - int x; - - /* go through all the channels on ftdm span */ - for (i = 1; i < (ftdmspan->chan_count+1); i++) { - /**************************************************************************/ - - /* extract the ftdmchan pointer */ - ftdmchan = ftdmspan->channels[i]; - - /* find the equivalent channel in the global structure */ - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; - flag = 0; - while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - /**********************************************************************/ - /* pull out the circuit to make it easier to work with */ - isupCkt = &g_ftdm_sngss7_data.cfg.isupCkt[x]; - - /* if the ccSpanId's match fill in the span value...this is for sigs - * because they will never have a channel that matches since they - * have a ftdmchan at this time */ - if (sngSpan->ccSpanId == isupCkt->ccSpanId) { - isupCkt->span = ftdmchan->physical_span_id; - } - - /* check if the ccSpanId matches and the physical channel # match */ - if ((sngSpan->ccSpanId == isupCkt->ccSpanId) && - (ftdmchan->physical_chan_id == isupCkt->chan)) { - - /* we've found the channel in the ckt structure...raise the flag */ - flag = 1; - - /* now get out of the loop */ - break; - } - - /* move to the next ckt */ - x++; - - /* check if we are outside of the range of possible indexes */ - if (x == ((g_ftdm_sngss7_data.cfg.procId + 1) * 1000)) { - break; - } - /**********************************************************************/ - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ - - /* check we found the ckt or not */ - if (!flag) { - SS7_ERROR_CHAN(ftdmchan, "Failed to find this channel in the global ckts!%s\n",""); - return FTDM_FAIL; - } - - /* fill in the rest of the global sngss7_chan_data_t structure */ - ss7_info = (sngss7_chan_data_t *)isupCkt->obj; - ss7_info->ftdmchan = ftdmchan; - - /* attach the sngss7_chan_data_t to the freetdm channel structure */ - ftdmchan->call_data = ss7_info; - - /* prepare the timer structures */ - ss7_info->t35.sched = ((sngss7_span_data_t *)(ftdmspan->signal_data))->sched; - ss7_info->t35.counter = 1; - ss7_info->t35.beat = (isupCkt->t35) * 100; /* beat is in ms, t35 is in 100ms */ - ss7_info->t35.callback = handle_isup_t35; - ss7_info->t35.sngss7_info = ss7_info; - - ss7_info->t10.sched = ((sngss7_span_data_t *)(ftdmspan->signal_data))->sched; - ss7_info->t10.counter = 1; - ss7_info->t10.beat = (isupCkt->t10) * 100; /* beat is in ms, t10 is in 100ms */ - ss7_info->t10.callback = handle_isup_t10; - ss7_info->t10.sngss7_info = ss7_info; - - /* prepare the timer structures */ - ss7_info->t39.sched = ((sngss7_span_data_t *)(ftdmspan->signal_data))->sched; - ss7_info->t39.counter = 1; - ss7_info->t39.beat = (isupCkt->t39) * 100; /* beat is in ms, t39 is in 100ms */ - ss7_info->t39.callback = handle_isup_t39; - ss7_info->t39.sngss7_info = ss7_info; - - - /**************************************************************************/ - } /* for (i == 1; i < ftdmspan->chan_count; i++) */ - - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot) -{ - int i; - int x; - int lower; - int upper; - char tmp[5]; /*KONRAD FIX ME*/ - char new_ch_map[MAX_CIC_MAP_LENGTH]; - - memset(&tmp[0], '\0', sizeof(tmp)); - memset(&new_ch_map[0], '\0', sizeof(new_ch_map)); - memset(timeslot, 0x0, sizeof(sng_timeslot_t)); - - SS7_DEVEL_DEBUG("Old channel map = \"%s\"\n", ch_map); - - /* start at the beginning of the ch_map */ - x = 0; - - switch (ch_map[x]) { - /**************************************************************************/ - case 'S': - case 's': /* we have a sig link */ - timeslot->siglink = 1; - - /* check what comes next either a comma or a number */ - x++; - if (ch_map[x] == ',') { - timeslot->hole = 1; - SS7_DEVEL_DEBUG(" Found a siglink in the channel map with a hole in the cic map\n"); - } else if (isdigit(ch_map[x])) { - /* consume all digits until a comma as this is the channel */ - SS7_DEVEL_DEBUG(" Found a siglink in the channel map with out a hole in the cic map\n"); - } else { - SS7_ERROR("Found an illegal channel map character after signal link flag = \"%c\"!\n", ch_map[x]); - return FTDM_FAIL; - } - break; - /**************************************************************************/ - case 'G': - case 'g': /* we have a channel gap */ - timeslot->gap = 1; - - /* check what comes next either a comma or a number */ - x++; - if (ch_map[x] == ',') { - timeslot->hole = 1; - SS7_DEVEL_DEBUG(" Found a gap in the channel map with a hole in the cic map\n"); - } else if (isdigit(ch_map[x])) { - SS7_DEVEL_DEBUG(" Found a gap in the channel map with out a hole in the cic map\n"); - /* consume all digits until a comma as this is the channel */ - } else { - SS7_ERROR("Found an illegal channel map character after signal link flag = \"%c\"!\n", ch_map[x]); - return FTDM_FAIL; - } - break; - /**************************************************************************/ - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': /* we have a channel */ - /* consume all digits until a comma or a dash */ - SS7_DEVEL_DEBUG("Found a starting channel in the channel map\n"); - break; - /**************************************************************************/ - default: - SS7_ERROR("Found an illegal channel map character = \"%c\"!\n", ch_map[x]); - return FTDM_FAIL; - /**************************************************************************/ - } /* switch (ch_map[x]) */ - - /* grab the first number in the string */ - i = 0; - while ((ch_map[x] != '\0') && (ch_map[x] != '-') && (ch_map[x] != ',')) { - tmp[i] = ch_map[x]; - i++; - x++; - } - tmp[i] = '\0'; - timeslot->channel = atoi(tmp); - lower = timeslot->channel + 1; - - /* check the next value in the list */ - if (ch_map[x] == '-') { - /* consume the number after the dash */ - x++; - i = 0; - while ((ch_map[x] != '\0') && (ch_map[x] != '-') && (ch_map[x] != ',')) { - tmp[i] = ch_map[x]; - i++; - x++; - } - tmp[i] = '\0'; - upper = atoi(tmp); - - /* check if the upper end of the range is the same as the lower end of the range */ - if (upper == lower) { - /* the range is completed, eat the next comma or \0 and write it */ - sprintf(new_ch_map, "%d", lower); - } else if ( upper > lower) { - /* the list continues, add 1 from the channel map value and re-insert it to the list */ - sprintf(new_ch_map, "%d-%d", lower, upper); - } else { - SS7_ERROR("The upper is less then the lower end of the range...should not happen!\n"); - return FTDM_FAIL; - } - - /* the the rest of ch_map to new_ch_map */ - strncat(new_ch_map, &ch_map[x], strlen(&ch_map[x])); - - - /* set the new cic map to ch_map*/ - memset(ch_map, '\0', sizeof(ch_map)); - strcpy(ch_map, new_ch_map); - - } else if (ch_map[x] == ',') { - /* move past the comma */ - x++; - - /* copy the rest of the list to new_ch_map */ - memset(new_ch_map, '\0', sizeof(new_ch_map)); - strcpy(new_ch_map, &ch_map[x]); - - /* copy the new_ch_map over the old one */ - memset(ch_map, '\0', sizeof(ch_map)); - strcpy(ch_map, new_ch_map); - - } else if (ch_map[x] == '\0') { - - /* we're at the end of the string...copy the rest of the list to new_ch_map */ - memset(new_ch_map, '\0', sizeof(new_ch_map)); - strcpy(new_ch_map, &ch_map[x]); - - /* set the new cic map to ch_map*/ - memset(ch_map, '\0', sizeof(ch_map)); - strcpy(ch_map, new_ch_map); - } else { - /* nothing to do */ - } - - SS7_DEVEL_DEBUG("New channel map = \"%s\"\n", ch_map); - - return FTDM_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: - */ -/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c b/libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c deleted file mode 100644 index 7d8a9b7393..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include "private/ftdm_core.h" -//#include "ftdm_skel.h" - -static FIO_CONFIGURE_FUNCTION(skel_configure) -{ - ftdm_unused_arg(category); - ftdm_unused_arg(var); - ftdm_unused_arg(val); - ftdm_unused_arg(lineno); - return FTDM_FAIL; -} - -static FIO_CONFIGURE_SPAN_FUNCTION(skel_configure_span) -{ - ftdm_unused_arg(span); - ftdm_unused_arg(str); - ftdm_unused_arg(type); - ftdm_unused_arg(name); - ftdm_unused_arg(number); - return FTDM_FAIL; -} - -static FIO_OPEN_FUNCTION(skel_open) -{ - ftdm_unused_arg(ftdmchan); - return FTDM_FAIL; -} - -static FIO_CLOSE_FUNCTION(skel_close) -{ - ftdm_unused_arg(ftdmchan); - return FTDM_FAIL; -} - -static FIO_WAIT_FUNCTION(skel_wait) -{ - ftdm_unused_arg(ftdmchan); - ftdm_unused_arg(flags); - ftdm_unused_arg(to); - return FTDM_FAIL; -} - -static FIO_READ_FUNCTION(skel_read) -{ - ftdm_unused_arg(ftdmchan); - ftdm_unused_arg(data); - ftdm_unused_arg(datalen); - return FTDM_FAIL; -} - -static FIO_WRITE_FUNCTION(skel_write) -{ - ftdm_unused_arg(ftdmchan); - ftdm_unused_arg(data); - ftdm_unused_arg(datalen); - return FTDM_FAIL; -} - -static FIO_COMMAND_FUNCTION(skel_command) -{ - ftdm_unused_arg(ftdmchan); - ftdm_unused_arg(command); - ftdm_unused_arg(obj); - return FTDM_FAIL; -} - -static FIO_SPAN_POLL_EVENT_FUNCTION(skel_poll_event) -{ - ftdm_unused_arg(span); - ftdm_unused_arg(ms); - ftdm_unused_arg(poll_events); - return FTDM_FAIL; -} - -static FIO_SPAN_NEXT_EVENT_FUNCTION(skel_next_event) -{ - ftdm_unused_arg(span); - ftdm_unused_arg(event); - return FTDM_FAIL; -} - -static FIO_CHANNEL_DESTROY_FUNCTION(skel_channel_destroy) -{ - ftdm_unused_arg(ftdmchan); - return FTDM_FAIL; -} - -static FIO_SPAN_DESTROY_FUNCTION(skel_span_destroy) -{ - ftdm_unused_arg(span); - return FTDM_FAIL; -} - -static FIO_GET_ALARMS_FUNCTION(skel_get_alarms) -{ - ftdm_unused_arg(ftdmchan); - return FTDM_FAIL; -} - -static ftdm_io_interface_t skel_interface; - -static FIO_IO_LOAD_FUNCTION(skel_init) -{ - assert(fio != NULL); - memset(&skel_interface, 0, sizeof(skel_interface)); - - skel_interface.name = "skel"; - skel_interface.configure = skel_configure; - skel_interface.configure_span = skel_configure_span; - skel_interface.open = skel_open; - skel_interface.close = skel_close; - skel_interface.wait = skel_wait; - skel_interface.read = skel_read; - skel_interface.write = skel_write; - skel_interface.command = skel_command; - skel_interface.poll_event = skel_poll_event; - skel_interface.next_event = skel_next_event; - skel_interface.channel_destroy = skel_channel_destroy; - skel_interface.span_destroy = skel_span_destroy; - skel_interface.get_alarms = skel_get_alarms; - *fio = &skel_interface; - - return FTDM_SUCCESS; -} - -static FIO_IO_UNLOAD_FUNCTION(skel_destroy) -{ - return FTDM_SUCCESS; -} - - -ftdm_module_t ftdm_module = { - "skel", - skel_init, - skel_destroy, -}; - - -/* 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/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2008.vcproj deleted file mode 100644 index 7fdb0ff592..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2008.vcproj +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj.filters deleted file mode 100644 index 15a8bc3d35..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.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 - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c deleted file mode 100755 index 58b5c9ca0e..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ /dev/null @@ -1,1807 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * David Yat Sin - * Nenad Corbic - * Arnaldo Pereira - * Gideon Sadan - * - */ -#ifdef WP_DEBUG_IO -#ifndef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE -#endif -#define _BSD_SOURCE -#include -#endif - -#ifdef __sun -#include -#include -#endif -#include "private/ftdm_core.h" -#ifndef __WINDOWS__ -#include -#include -#endif -#include "libsangoma.h" - -#if defined(__WINDOWS__) -/*! Backward compatible defines - current code is all using the old names*/ -#define sangoma_open_tdmapi_span_chan sangoma_open_api_span_chan -#define sangoma_open_tdmapi_span sangoma_open_api_span -#define sangoma_open_tdmapi_ctrl sangoma_open_api_ctrl -#define sangoma_tdm_get_fe_status sangoma_get_fe_status -#define sangoma_socket_close sangoma_close -#define sangoma_tdm_get_hw_coding sangoma_get_hw_coding -#define sangoma_tdm_set_fe_status sangoma_set_fe_status -#define sangoma_tdm_get_link_status sangoma_get_link_status -#define sangoma_tdm_flush_bufs sangoma_flush_bufs -#define sangoma_tdm_cmd_exec sangoma_cmd_exec -#define sangoma_tdm_read_event sangoma_read_event -#define sangoma_readmsg_tdm sangoma_readmsg -#define sangoma_readmsg_socket sangoma_readmsg -#define sangoma_sendmsg_socket sangoma_writemsg -#define sangoma_writemsg_tdm sangoma_writemsg -#define sangoma_create_socket_intr sangoma_open_api_span_chan -#endif - -/*! Starting with libsangoma 3 we can use the new libsangoma waitable API, the poor souls of those using a release where LIBSANGOMA version - * is defined but the version is not higher or equal to 3.0.0 will be forced to upgrade - * */ -#ifdef LIBSANGOMA_VERSION -#if LIBSANGOMA_VERSION_CODE < LIBSANGOMA_VERSION(3,0,0) -#undef LIBSANGOMA_VERSION -#endif -#endif - -/** - * \brief Wanpipe flags - */ -typedef enum { - WP_RINGING = (1 << 0) -} wp_flag_t; - -/** - * \brief Wanpipe globals - */ -static struct { - uint32_t codec_ms; - uint32_t rxqueue_size; - uint32_t txqueue_size; - uint32_t wink_ms; - uint32_t flash_ms; - uint32_t ring_on_ms; - uint32_t ring_off_ms; -} wp_globals; - -typedef struct { - sangoma_wait_obj_t *waitobj; -#ifdef WP_DEBUG_IO - /* record the last reader threads */ - pid_t readers[10]; - int rindex; - ftdm_time_t last_read; -#endif -} wp_channel_t; -#define WP_GET_WAITABLE(fchan) ((wp_channel_t *)((fchan)->io_data))->waitobj - -/* a bunch of this stuff should go into the wanpipe_tdm_api_iface.h */ - -FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event); -FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event); -FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event); - -static void wp_swap16(char *data, int datalen) -{ - int i = 0; - uint16_t *samples = (uint16_t *)data; - for (i = 0; i < datalen/2; i++) { - uint16_t sample = ((samples[i] & 0x00FF) << 8) | ((samples[i] & 0xFF00) >> 8); - samples[i] = sample; - } -} - -/** - * \brief Poll for event on a wanpipe socket - * \param fd Wanpipe socket descriptor - * \param timeout Time to wait for event - * \param flags Sangoma event flags - * \return -1 on failure, wanpipe event flags on success - * - * a cross platform way to poll on an actual pollset (span and/or list of spans) will probably also be needed for analog - * so we can have one analong handler thread that will deal with all the idle analog channels for events - * the alternative would be for the driver to provide one socket for all of the oob events for all analog channels - */ -static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout, int *flags) -{ - -#ifdef LIBSANGOMA_VERSION - int err; - uint32_t inflags = *flags; - uint32_t outflags = 0; - sangoma_wait_obj_t *sangoma_wait_obj = WP_GET_WAITABLE(ftdmchan); - - if (timeout == -1) { - timeout = SANGOMA_WAIT_INFINITE; - } - - err = sangoma_waitfor(sangoma_wait_obj, inflags, &outflags, timeout); - *flags = 0; - if (err == SANG_STATUS_SUCCESS) { - *flags = outflags; - err = 1; /* ideally should be the number of file descriptors with something to read */ - } - if (err == SANG_STATUS_APIPOLL_TIMEOUT) { - err = 0; - } - return err; -#else - struct pollfd pfds[1]; - int res; - - memset(&pfds[0], 0, sizeof(pfds[0])); - pfds[0].fd = ftdmchan->sockfd; - pfds[0].events = *flags; - res = poll(pfds, 1, timeout); - *flags = 0; - - if (pfds[0].revents & POLLERR) { - res = -1; - } - - if (res > 0) { - *flags = pfds[0].revents; - } - - return res; -#endif - -} - -/** - * \brief Opens a sangoma channel socket (TDM API) - * \param span Span number - * \param chan Channel number - * \return 0 on success, wanpipe error code on failure - */ -static __inline__ sng_fd_t tdmv_api_open_span_chan(int span, int chan) -{ - return sangoma_open_tdmapi_span_chan(span, chan); -} - -#ifdef LIBSANGOMA_VERSION -static __inline__ sng_fd_t __tdmv_api_open_span_chan(int span, int chan) -{ - return __sangoma_open_tdmapi_span_chan(span, chan); -} -#endif - -static ftdm_io_interface_t wanpipe_interface; - -/** - * \brief Inverts bit string - * \param cas_bits CAS bit string - * \return Swapped bits - */ -static unsigned char wanpipe_swap_bits(unsigned char cas_bits) -{ - unsigned char swapped_bits = 0x0; - if (cas_bits & 0x8) { - swapped_bits |= 0x1; - } - if (cas_bits & 0x4) { - swapped_bits |= 0x2; - } - if (cas_bits & 0x2) { - swapped_bits |= 0x4; - } - if (cas_bits & 0x1) { - swapped_bits |= 0x8; - } - return swapped_bits; -} - -/** - * \brief Initialises a range of wanpipe channels - * \param span FreeTDM span - * \param spanno Wanpipe span number - * \param start Initial wanpipe channel number - * \param end Final wanpipe channel number - * \param type FreeTDM channel type - * \param name FreeTDM span name - * \param number FreeTDM span number - * \param cas_bits CAS bits - * \return number of spans configured - */ -static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start, unsigned end, ftdm_chan_type_t type, char *name, char *number, unsigned char cas_bits) -{ - unsigned configured = 0, x; -#ifdef LIBSANGOMA_VERSION - sangoma_status_t sangstatus; - sangoma_wait_obj_t *sangoma_wait_obj; -#endif - - if (type == FTDM_CHAN_TYPE_CAS) { - ftdm_log(FTDM_LOG_DEBUG, "Configuring Wanpipe CAS channels with abcd == 0x%X\n", cas_bits); - } - for(x = start; x < end; x++) { - ftdm_channel_t *chan; - ftdm_socket_t sockfd = FTDM_INVALID_SOCKET; - const char *dtmf = "none"; - const char *hwec_str = "none"; - const char *hwec_idle = "none"; - if (!strncasecmp(span->name, "smg_prid_nfas", 8) && span->trunk_type == FTDM_TRUNK_T1 && x == 24) { -#ifdef LIBSANGOMA_VERSION - sockfd = __tdmv_api_open_span_chan(spanno, x); -#else - ftdm_log(FTDM_LOG_ERROR, "span %d channel %d cannot be configured as smg_prid_nfas, you need to compile freetdm with newer libsangoma\n", spanno, x); -#endif - } else { -#ifdef LIBSANGOMA_VERSION - sockfd = __tdmv_api_open_span_chan(spanno, x); -#else - sockfd = tdmv_api_open_span_chan(spanno, x); -#endif - } - - if (sockfd == FTDM_INVALID_SOCKET) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open wanpipe device span %d channel %d\n", spanno, x); - continue; - } - - if (ftdm_span_add_channel(span, sockfd, type, &chan) == FTDM_SUCCESS) { - wp_channel_t *wpchan = NULL; - wanpipe_tdm_api_t tdm_api; - memset(&tdm_api, 0, sizeof(tdm_api)); -#ifdef LIBSANGOMA_VERSION - wpchan = ftdm_calloc(1, sizeof(*wpchan)); - ftdm_assert(wpchan != NULL, "wpchan alloc failed\n"); - chan->io_data = wpchan; - /* we need SANGOMA_DEVICE_WAIT_OBJ_SIG and not SANGOMA_DEVICE_WAIT_OBJ alone because we need to call - * sangoma_wait_obj_sig to wake up any I/O waiters when closing the channel (typically on ftdm shutdown) - * this adds an extra pair of file descriptors to the waitable object - * */ - sangstatus = sangoma_wait_obj_create(&sangoma_wait_obj, sockfd, SANGOMA_DEVICE_WAIT_OBJ_SIG); - if (sangstatus != SANG_STATUS_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failure create waitable object for s%dc%d\n", spanno, x); - continue; - } - WP_GET_WAITABLE(chan) = sangoma_wait_obj; -#endif - - chan->physical_span_id = spanno; - chan->physical_chan_id = x; - chan->rate = 8000; - - if (type == FTDM_CHAN_TYPE_FXS - || type == FTDM_CHAN_TYPE_FXO - || type == FTDM_CHAN_TYPE_CAS - || type == FTDM_CHAN_TYPE_B) { - int err; - - hwec_str = "unavailable"; - hwec_idle = "enabled"; - dtmf = "software"; - - err = sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api); - - - - if (tdm_api.wp_tdm_cmd.hw_tdm_coding) { - chan->native_codec = chan->effective_codec = FTDM_CODEC_ALAW; - } else { - chan->native_codec = chan->effective_codec = FTDM_CODEC_ULAW; - } - - - if ((span->trunk_type == FTDM_TRUNK_GSM) && (chan->type == FTDM_CHAN_TYPE_B)) { - chan->native_codec = FTDM_CODEC_SLIN; - chan->native_interval = 20; - chan->packet_len = 320; - } - - err = sangoma_tdm_get_hw_dtmf(chan->sockfd, &tdm_api); - if (err > 0) { - ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_DTMF_DETECT); - dtmf = "hardware"; - } - - err = sangoma_tdm_get_hw_ec(chan->sockfd, &tdm_api); - if (err > 0) { - hwec_str = "available"; - ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC); - } - -#ifdef WP_API_FEATURE_HWEC_PERSIST - err = sangoma_tdm_get_hwec_persist_status(chan->sockfd, &tdm_api); - if (err == 0) { - ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE); - hwec_idle = "disabled"; - } -#else - if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - ftdm_log(FTDM_LOG_WARNING, "WP_API_FEATURE_HWEC_PERSIST feature is not supported \ - with your version of libsangoma, you should update your Wanpipe drivers\n"); - - } -#endif - - } - -#ifdef LIBSANGOMA_VERSION - if (type == FTDM_CHAN_TYPE_FXS) { - if (sangoma_tdm_disable_ring_trip_detect_events(chan->sockfd, &tdm_api)) { - /* we had problems of on-hook/off-hook detection due to how ring trip events were handled - * if this fails, I believe we will still work ok as long as we dont handle them incorrectly */ - ftdm_log(FTDM_LOG_WARNING, "Failed to disable ring trip events in channel s%dc%d\n", spanno, x); - } - } -#endif -#if 0 - if (type == FTDM_CHAN_TYPE_FXS || type == FTDM_CHAN_TYPE_FXO) { - /* Enable FLASH/Wink Events */ - int err=sangoma_set_rm_rxflashtime(chan->sockfd, &tdm_api, wp_globals.flash_ms); - if (err == 0) { - ftdm_log(FTDM_LOG_ERROR, "flash enabled s%dc%d\n", spanno, x); - } else { - ftdm_log(FTDM_LOG_ERROR, "flash disabled s%dc%d\n", spanno, x); - } - } -#endif - - if (type == FTDM_CHAN_TYPE_CAS || type == FTDM_CHAN_TYPE_EM) { -#ifdef LIBSANGOMA_VERSION - sangoma_tdm_write_rbs(chan->sockfd,&tdm_api,chan->physical_chan_id, wanpipe_swap_bits(cas_bits)); - - /* this should probably be done for old libsangoma but I am not sure if the API is available and I'm lazy to check, - The poll rate is hard coded to 100 per second (done in the driver, is the max rate of polling allowed by wanpipe) - */ - if (sangoma_tdm_enable_rbs_events(chan->sockfd, &tdm_api, 100)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to enable RBS/CAS events in device %d:%d fd:%d\n", chan->span_id, chan->chan_id, sockfd); - continue; - } - sangoma_flush_bufs(chan->sockfd, &tdm_api); - sangoma_flush_event_bufs(chan->sockfd, &tdm_api); -#else - /* - * With wanpipe 3.4.4.2 I get failure even though the events are enabled, /var/log/messages said: - * wanpipe4: WARNING: Event type 9 is already pending! - * wanpipe4: Failed to add new fe event 09 ch_map=FFFFFFFF! - * may be we should not send an error until that is fixed in the driver - */ - if (sangoma_tdm_enable_rbs_events(chan->sockfd, &tdm_api, 100)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to enable RBS/CAS events in device %d:%d fd:%d\n", chan->span_id, chan->chan_id, sockfd); - } - /* probably done by the driver but lets write defensive code this time */ - sangoma_tdm_flush_bufs(chan->sockfd, &tdm_api); - sangoma_tdm_write_rbs(chan->sockfd,&tdm_api, wanpipe_swap_bits(cas_bits)); -#endif - } - - if (!ftdm_strlen_zero(name)) { - ftdm_copy_string(chan->chan_name, name, sizeof(chan->chan_name)); - } - - if (!ftdm_strlen_zero(number)) { - ftdm_copy_string(chan->chan_number, number, sizeof(chan->chan_number)); - } - configured++; - ftdm_log_chan(chan, FTDM_LOG_INFO, "Configured wanpipe device FD: %d, DTMF: %s, HWEC: %s, HWEC_IDLE: %s\n", - sockfd, dtmf, hwec_str, hwec_idle); - - } else { - ftdm_log(FTDM_LOG_ERROR, "ftdm_span_add_channel failed for wanpipe span %d channel %d\n", spanno, x); - } - } - - return configured; -} - -/** - * \brief Process configuration variable for a Wanpipe profile - * \param category Wanpipe profile name - * \param var Variable name - * \param val Variable value - * \param lineno Line number from configuration file - * \return Success - */ -static FIO_CONFIGURE_FUNCTION(wanpipe_configure) -{ - int num; - - if (!strcasecmp(category, "defaults")) { - if (!strcasecmp(var, "codec_ms")) { - num = atoi(val); - if (num < 10 || num > 60) { - ftdm_log(FTDM_LOG_WARNING, "invalid codec ms at line %d\n", lineno); - } else { - wp_globals.codec_ms = num; - } - } else if (!strcasecmp(var, "rxqueue_size")) { - num = atoi(val); - if (num < 1 || num > 1000) { - ftdm_log(FTDM_LOG_WARNING, "invalid rx queue size at line %d\n", lineno); - } else { - wp_globals.rxqueue_size = num; - } - } else if (!strcasecmp(var, "txqueue_size")) { - num = atoi(val); - if (num < 1 || num > 1000) { - ftdm_log(FTDM_LOG_WARNING, "invalid tx queue size at line %d\n", lineno); - } else { - wp_globals.txqueue_size = num; - } - } else if (!strcasecmp(var, "wink_ms")) { - num = atoi(val); - if (num < 50 || num > 3000) { - ftdm_log(FTDM_LOG_WARNING, "invalid wink ms at line %d\n", lineno); - } else { - wp_globals.wink_ms = num; - } - } else if (!strcasecmp(var, "flash_ms")) { - num = atoi(val); - if (num < 50 || num > 3000) { - ftdm_log(FTDM_LOG_WARNING, "invalid flash ms at line %d\n", lineno); - } else { - wp_globals.flash_ms = num; - } - } else if (!strcasecmp(var, "ring_on_ms")) { - num = atoi(val); - if (num < 500 || num > 5000) { - ftdm_log(FTDM_LOG_WARNING, "invalid ring_on_ms at line %d (valid range 500 to 5000)\n", lineno); - } else { - wp_globals.ring_on_ms = num; - } - } else if (!strcasecmp(var, "ring_off_ms")) { - num = atoi(val); - if (num < 500 || num > 5000) { - ftdm_log(FTDM_LOG_WARNING, "invalid ring_off_ms at line %d (valid range 500 to 5000)\n", lineno); - } else { - wp_globals.ring_off_ms = num; - } - } - - } - - return FTDM_SUCCESS; -} - -/** - * \brief Initialises an freetdm Wanpipe span from a configuration string - * \param span FreeTDM span - * \param str Configuration string - * \param type FreeTDM span type - * \param name FreeTDM span name - * \param number FreeTDM span number - * \return Success or failure - */ -static FIO_CONFIGURE_SPAN_FUNCTION(wanpipe_configure_span) -{ - int items, i; - char *mydata, *item_list[10]; - char *sp, *ch, *mx; - unsigned char cas_bits = 0; - int channo; - int spanno; - int top = 0; - unsigned configured = 0; - - assert(str != NULL); - - - mydata = ftdm_strdup(str); - assert(mydata != NULL); - - - items = ftdm_separate_string(mydata, ',', item_list, (sizeof(item_list) / sizeof(item_list[0]))); - - for(i = 0; i < items; i++) { - sp = item_list[i]; - if ((ch = strchr(sp, ':'))) { - *ch++ = '\0'; - } - - if (!(sp && ch)) { - ftdm_log(FTDM_LOG_ERROR, "No valid wanpipe span and channel was specified\n"); - continue; - } - - channo = atoi(ch); - spanno = atoi(sp); - - if (channo < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid channel number %d\n", channo); - continue; - } - - if (spanno < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid span number %d\n", channo); - continue; - } - - if ((mx = strchr(ch, '-'))) { - mx++; - top = atoi(mx) + 1; - } else { - top = channo + 1; - } - - - if (top < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid range number %d\n", top); - continue; - } - if (FTDM_CHAN_TYPE_CAS == type && ftdm_config_get_cas_bits(ch, &cas_bits)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to get CAS bits in CAS channel\n"); - continue; - } - configured += wp_open_range(span, spanno, channo, top, type, name, number, cas_bits); - - } - - ftdm_safe_free(mydata); - - return configured; -} - -/** - * \brief Opens Wanpipe channel - * \param ftdmchan Channel to open - * \return Success or failure - */ -static FIO_OPEN_FUNCTION(wanpipe_open) -{ - - wanpipe_tdm_api_t tdm_api; - - memset(&tdm_api,0,sizeof(tdm_api)); - - sangoma_tdm_flush_bufs(ftdmchan->sockfd, &tdm_api); - sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); - memset(&ftdmchan->iostats, 0, sizeof(ftdmchan->iostats)); - - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921 || ftdmchan->type == FTDM_CHAN_TYPE_DQ931) { - ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_NONE; - } else { - ftdmchan->effective_codec = ftdmchan->native_codec; - - sangoma_tdm_set_usr_period(ftdmchan->sockfd, &tdm_api, wp_globals.codec_ms); - - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL); - ftdmchan->effective_interval = ftdmchan->native_interval = wp_globals.codec_ms; - - /* The packet len will depend on the codec and interval */ - ftdmchan->packet_len = ftdmchan->native_interval * ((ftdmchan->native_codec==FTDM_CODEC_SLIN) ? 16 : 8); - if (wp_globals.txqueue_size > 0) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &wp_globals.txqueue_size); - } - if (wp_globals.rxqueue_size > 0) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_RX_QUEUE_SIZE, &wp_globals.rxqueue_size); - } - } - - return FTDM_SUCCESS; -} - -/** - * \brief Closes Wanpipe channel - * \param ftdmchan Channel to close - * \return Success - */ -static FIO_CLOSE_FUNCTION(wanpipe_close) -{ -#ifdef LIBSANGOMA_VERSION - sangoma_wait_obj_t *waitobj = WP_GET_WAITABLE(ftdmchan); - /* kick any I/O waiters */ - sangoma_wait_obj_signal(waitobj); -#ifdef WP_DEBUG_IO - { - wp_channel_t *wchan = ftdmchan->io_data; - memset(wchan->readers, 0, sizeof(wchan->readers)); - wchan->rindex = 0; - } -#endif -#endif - return FTDM_SUCCESS; -} - -/** - * \brief Executes an FreeTDM command on a Wanpipe channel - * \param ftdmchan Channel to execute command on - * \param command FreeTDM command to execute - * \param obj Object (unused) - * \return Success or failure - */ -static FIO_COMMAND_FUNCTION(wanpipe_command) -{ - wanpipe_tdm_api_t tdm_api; - int err = 0; - - memset(&tdm_api, 0, sizeof(tdm_api)); - - switch(command) { - case FTDM_COMMAND_OFFHOOK: - { - err=sangoma_tdm_txsig_offhook(ftdmchan->sockfd,&tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "OFFHOOK Failed"); - return FTDM_FAIL; - } - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - } - break; - case FTDM_COMMAND_ONHOOK: - { - err=sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ONHOOK Failed"); - return FTDM_FAIL; - } - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - } - break; - case FTDM_COMMAND_GENERATE_RING_ON: - { - err=sangoma_tdm_txsig_start(ftdmchan->sockfd,&tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Ring Failed"); - return FTDM_FAIL; - } - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_RINGING); - ftdm_set_pflag_locked(ftdmchan, WP_RINGING); - ftdmchan->ring_time = ftdm_current_time_in_ms() + wp_globals.ring_on_ms; - } - break; - case FTDM_COMMAND_GENERATE_RING_OFF: - { - err=sangoma_tdm_txsig_offhook(ftdmchan->sockfd,&tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Ring-off Failed"); - return FTDM_FAIL; - } - ftdm_clear_pflag_locked(ftdmchan, WP_RINGING); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_RINGING); - } - break; - case FTDM_COMMAND_GET_INTERVAL: - { - err=sangoma_tdm_get_usr_period(ftdmchan->sockfd, &tdm_api); - if (err > 0 ) { - FTDM_COMMAND_OBJ_INT = err; - err=0; - } - } - break; - case FTDM_COMMAND_ENABLE_ECHOCANCEL: - { -#ifdef WP_API_FEATURE_EC_CHAN_STAT - err=sangoma_tdm_get_hwec_chan_status(ftdmchan->sockfd, &tdm_api); - if (err > 0) { - /* Hardware echo canceller already enabled */ - err = 0; - break; - } -#endif - err=sangoma_tdm_enable_hwec(ftdmchan->sockfd, &tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Enable Failed"); - return FTDM_FAIL; - } - } - break; - case FTDM_COMMAND_DISABLE_ECHOCANCEL: - { -#ifdef WP_API_FEATURE_EC_CHAN_STAT - err=sangoma_tdm_get_hwec_chan_status(ftdmchan->sockfd, &tdm_api); - if (!err) { - /* Hardware echo canceller already disabled */ - break; - } -#endif - err=sangoma_tdm_disable_hwec(ftdmchan->sockfd, &tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Disable Failed"); - return FTDM_FAIL; - } - } - break; - case FTDM_COMMAND_DISABLE_ECHOTRAIN: { err = 0; } - break; - case FTDM_COMMAND_ENABLE_DTMF_DETECT: - { -#ifdef WP_API_FEATURE_DTMF_EVENTS - err = sangoma_tdm_enable_dtmf_events(ftdmchan->sockfd, &tdm_api); - if (err) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Enabling of Sangoma HW DTMF failed\n"); - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HW DTMF Enable Failed"); - return FTDM_FAIL; - } - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Enabled DTMF events\n"); -#else - return FTDM_NOTIMPL; -#endif - } - break; - case FTDM_COMMAND_DISABLE_DTMF_DETECT: - { -#ifdef WP_API_FEATURE_DTMF_EVENTS - err = sangoma_tdm_disable_dtmf_events(ftdmchan->sockfd, &tdm_api); - if (err) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Disabling of Sangoma HW DTMF failed\n"); - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HW DTMF Disable Failed"); - return FTDM_FAIL; - } - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled DTMF events\n"); -#else - return FTDM_NOTIMPL; -#endif - } - break; - case FTDM_COMMAND_ENABLE_DTMF_REMOVAL: - { -#ifdef WP_API_FEATURE_DTMF_REMOVAL - int return_code = 0; - err = sangoma_hwec_set_hwdtmf_removal(ftdmchan->sockfd, ftdmchan->physical_chan_id, &return_code, 1, 0); - if (return_code) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Wanpipe failed to Enable HW-DTMF removal\n"); - } -#endif - } - break; - case FTDM_COMMAND_DISABLE_DTMF_REMOVAL: - { -#ifdef WP_API_FEATURE_DTMF_REMOVAL - int return_code = 0; - err = sangoma_hwec_set_hwdtmf_removal(ftdmchan->sockfd, ftdmchan->physical_chan_id, &return_code, 0, 0); - if (return_code) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Wanpipe failed to Disable HW-DTMF removal\n"); - } -#endif - } - break; - case FTDM_COMMAND_ENABLE_LOOP: - { -#ifdef WP_API_FEATURE_LOOP - err=sangoma_tdm_enable_loop(ftdmchan->sockfd, &tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Loop Enable Failed"); - return FTDM_FAIL; - } -#endif - } - break; - case FTDM_COMMAND_DISABLE_LOOP: - { -#ifdef WP_API_FEATURE_LOOP - err=sangoma_tdm_disable_loop(ftdmchan->sockfd, &tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Loop Disable Failed"); - return FTDM_FAIL; - } -#endif - } - break; - case FTDM_COMMAND_SET_INTERVAL: - { - err=sangoma_tdm_set_usr_period(ftdmchan->sockfd, &tdm_api, FTDM_COMMAND_OBJ_INT); - - ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); - } - break; - case FTDM_COMMAND_SET_CAS_BITS: - { -#ifdef LIBSANGOMA_VERSION - err = sangoma_tdm_write_rbs(ftdmchan->sockfd,&tdm_api, ftdmchan->physical_chan_id, wanpipe_swap_bits(FTDM_COMMAND_OBJ_INT)); -#else - err = sangoma_tdm_write_rbs(ftdmchan->sockfd, &tdm_api, wanpipe_swap_bits(FTDM_COMMAND_OBJ_INT)); -#endif - } - break; - case FTDM_COMMAND_GET_CAS_BITS: - { -#ifdef LIBSANGOMA_VERSION - unsigned char rbsbits; - err = sangoma_tdm_read_rbs(ftdmchan->sockfd, &tdm_api, ftdmchan->physical_chan_id, &rbsbits); - if (!err) { - FTDM_COMMAND_OBJ_INT = wanpipe_swap_bits(rbsbits); - } -#else - /* is sangoma_tdm_read_rbs available here? */ - FTDM_COMMAND_OBJ_INT = ftdmchan->rx_cas_bits; -#endif - } - break; - case FTDM_COMMAND_SET_LINK_STATUS: - { - ftdm_channel_hw_link_status_t status = FTDM_COMMAND_OBJ_INT; - char sangoma_status = status == FTDM_HW_LINK_CONNECTED ? FE_CONNECTED : FE_DISCONNECTED; - err = sangoma_tdm_set_fe_status(ftdmchan->sockfd, &tdm_api, sangoma_status); - } - break; - case FTDM_COMMAND_GET_LINK_STATUS: - { - unsigned char sangoma_status = 0; - err = sangoma_tdm_get_fe_status(ftdmchan->sockfd, &tdm_api, &sangoma_status); - if (!err) { - FTDM_COMMAND_OBJ_INT = sangoma_status == FE_CONNECTED ? FTDM_HW_LINK_CONNECTED : FTDM_HW_LINK_DISCONNECTED; - } - } - break; - case FTDM_COMMAND_FLUSH_BUFFERS: - { - err = sangoma_flush_bufs(ftdmchan->sockfd, &tdm_api); - } - break; - case FTDM_COMMAND_FLUSH_RX_BUFFERS: - { - err = sangoma_flush_rx_bufs(ftdmchan->sockfd, &tdm_api); - } - break; - case FTDM_COMMAND_FLUSH_TX_BUFFERS: - { - err = sangoma_flush_tx_bufs(ftdmchan->sockfd, &tdm_api); - } - break; - case FTDM_COMMAND_FLUSH_IOSTATS: - { - err = sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); - memset(&ftdmchan->iostats, 0, sizeof(ftdmchan->iostats)); - } - break; - case FTDM_COMMAND_SET_RX_QUEUE_SIZE: - { - uint32_t queue_size = FTDM_COMMAND_OBJ_INT; - err = sangoma_set_rx_queue_sz(ftdmchan->sockfd, &tdm_api, queue_size); - } - break; - case FTDM_COMMAND_SET_TX_QUEUE_SIZE: - { - uint32_t queue_size = FTDM_COMMAND_OBJ_INT; - err = sangoma_set_tx_queue_sz(ftdmchan->sockfd, &tdm_api, queue_size); - } - break; - case FTDM_COMMAND_SET_POLARITY: - { - ftdm_polarity_t polarity = FTDM_COMMAND_OBJ_INT; - err = sangoma_tdm_set_polarity(ftdmchan->sockfd, &tdm_api, polarity); - if (!err) { - ftdmchan->polarity = polarity; - } - } - break; - default: - err = FTDM_NOTIMPL; - break; - }; - - if (err) { - int myerrno = errno; - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Wanpipe failed to execute command %d: %s\n", command, strerror(myerrno)); - errno = myerrno; - return err; - } - - return FTDM_SUCCESS; -} - -static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *tx_stats) -{ - ftdmchan->iostats.tx.errors = tx_stats->wp_api_tx_hdr_errors; - ftdmchan->iostats.tx.queue_size = tx_stats->wp_api_tx_hdr_max_queue_length; - ftdmchan->iostats.tx.queue_len = tx_stats->wp_api_tx_hdr_number_of_frames_in_queue; - - /* we don't test for 80% full in tx since is typically full for voice channels, should we test tx 80% full for D-channels? */ - if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.tx.queue_size) { - ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); - } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ - ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); - } - - if (ftdmchan->iostats.tx.idle_packets < tx_stats->wp_api_tx_hdr_tx_idle_packets) { - ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; - } - - if (!ftdmchan->iostats.tx.packets) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet write stats: Tx queue len: %d, Tx queue size: %d, Tx idle: %"FTDM_UINT64_FMT"\n", - ftdmchan->iostats.tx.queue_len, - ftdmchan->iostats.tx.queue_size, - ftdmchan->iostats.tx.idle_packets); - } - - ftdmchan->iostats.tx.packets++; -} - -static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) -{ - ftdmchan->iostats.rx.errors = rx_stats->wp_api_rx_hdr_errors; - ftdmchan->iostats.rx.queue_size = rx_stats->wp_api_rx_hdr_max_queue_length; - ftdmchan->iostats.rx.queue_len = rx_stats->wp_api_rx_hdr_number_of_frames_in_queue; - - if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_ABORT_ERROR_BIT))) { - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT); - } else { - ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT); - } - - if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_DMA_ERROR_BIT))) { - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA); - } else { - ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA); - } - - if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_FIFO_ERROR_BIT))) { - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO); - } else { - ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO); - } - - if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_CRC_ERROR_BIT))) { - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC); - } else { - ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC); - } - - if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_FRAME_ERROR_BIT))) { - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); - } else { - ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); - } - - if (ftdmchan->iostats.rx.queue_len >= (0.8 * ftdmchan->iostats.rx.queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue length exceeded 80%% threshold (%d/%d)\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); - } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue length reduced 80%% threshold (%d/%d)\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); - ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); - } - - if (ftdmchan->iostats.rx.queue_len >= ftdmchan->iostats.rx.queue_size) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue Full (%d/%d)\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); - } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue no longer full (%d/%d)\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); - ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); - } - - if (!ftdmchan->iostats.rx.packets) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet read stats: Rx queue len: %d, Rx queue size: %d\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); - } - - ftdmchan->iostats.rx.packets++; -} - -/** - * \brief Reads data from a Wanpipe channel - * \param ftdmchan Channel to read from - * \param data Data buffer - * \param datalen Size of data buffer - * \return Success, failure or timeout - */ - - -static FIO_READ_FUNCTION(wanpipe_read) -{ - int rx_len = 0; - int rq_len = (int)*datalen; - wp_tdm_api_rx_hdr_t hdrframe; - - -#ifdef WP_DEBUG_IO - wp_channel_t *wchan = ftdmchan->io_data; - ftdm_time_t time_diff = 0; - pid_t previous_thread = 1; - pid_t current_thread = 0; - int previous_thread_index = 0; - - previous_thread_index = wchan->rindex == 0 ? (ftdm_array_len(wchan->readers) - 1) : wchan->rindex - 1; - previous_thread = wchan->readers[previous_thread_index]; - current_thread = syscall(SYS_gettid); - if (current_thread && current_thread != wchan->readers[wchan->rindex]) { - if (!wchan->readers[wchan->rindex]) { - wchan->readers[wchan->rindex] = current_thread; - /* first read */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Initial reader thread is %d\n", current_thread); - previous_thread = current_thread; - } else { - previous_thread = wchan->readers[wchan->rindex]; - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Changed reader thread from %d to %d (rindex = %d)\n", - previous_thread, current_thread, wchan->rindex); - if (wchan->rindex == (ftdm_array_len(wchan->readers) - 1)) { - wchan->rindex = 0; - } else { - wchan->rindex++; - } - wchan->readers[wchan->rindex] = current_thread; - } - } - ftdm_time_t curr = ftdm_current_time_in_ms(); - if (wchan->last_read) { - time_diff = curr - wchan->last_read; - } -#endif - - memset(&hdrframe, 0, sizeof(hdrframe)); - rx_len = sangoma_readmsg_tdm(ftdmchan->sockfd, &hdrframe, (int)sizeof(hdrframe), data, (int)*datalen, 0); - *datalen = 0; - - if (rx_len == 0) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Read 0 bytes\n"); - return FTDM_TIMEOUT; - } - - if (rx_len < 0) { -#ifdef WP_DEBUG_IO - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Failed to read %d bytes from sangoma device: %s (%d) " - "(read time diff = %llums, prev thread = %d, curr thread = %d)\n", rq_len, strerror(errno), rx_len, - time_diff, previous_thread, current_thread); -#else - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Failed to read %d bytes from sangoma device: %s (%d)\n", rq_len, strerror(errno), rx_len); -#endif - return FTDM_FAIL; - } - *datalen = rx_len; - - if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS)) { - wanpipe_read_stats(ftdmchan, &hdrframe); - } - - if ((ftdmchan->type == FTDM_CHAN_TYPE_B) && (ftdmchan->span->trunk_type == FTDM_TRUNK_GSM)) { - wp_swap16(data, *datalen); - } - - return FTDM_SUCCESS; -} - -/** - * \brief Writes data to a Wanpipe channel - * \param ftdmchan Channel to write to - * \param data Data buffer - * \param datalen Size of data buffer - * \return Success or failure - */ -static FIO_WRITE_FUNCTION(wanpipe_write) -{ - int bsent = 0; - int err = 0; - wp_tdm_api_tx_hdr_t hdrframe; - - if ((ftdmchan->type == FTDM_CHAN_TYPE_B) && (ftdmchan->span->trunk_type == FTDM_TRUNK_GSM)) { - wp_swap16(data, *datalen); - } - - /* Do we even need the headerframe here? on windows, we don't even pass it to the driver */ - memset(&hdrframe, 0, sizeof(hdrframe)); - if (*datalen == 0) { - return FTDM_SUCCESS; - } - - if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS) && !ftdmchan->iostats.tx.packets) { - wanpipe_tdm_api_t tdm_api; - memset(&tdm_api, 0, sizeof(tdm_api)); - /* if this is the first write ever, flush the tx first to have clean stats */ - err = sangoma_flush_tx_bufs(ftdmchan->sockfd, &tdm_api); - if (err) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to flush on first write\n"); - } - } - - bsent = sangoma_writemsg_tdm(ftdmchan->sockfd, &hdrframe, (int)sizeof(hdrframe), data, (unsigned short)(*datalen),0); - - /* should we be checking if bsent == *datalen here? */ - if (bsent > 0) { - *datalen = bsent; - if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS)) { - /* BRI cards do not support TX queues for now */ - if(!FTDM_SPAN_IS_BRI(ftdmchan->span)) { - wanpipe_write_stats(ftdmchan, &hdrframe); - } - } - return FTDM_SUCCESS; - } - - return FTDM_FAIL; -} - -/** - * \brief Waits for an event on a Wanpipe channel - * \param ftdmchan Channel to open - * \param flags Type of event to wait for - * \param to Time to wait (in ms) - * \return Success, failure or timeout - */ - -static FIO_WAIT_FUNCTION(wanpipe_wait) -{ - int32_t inflags = 0; - int result; - - if (*flags & FTDM_READ) { - inflags |= POLLIN; - } - - if (*flags & FTDM_WRITE) { - inflags |= POLLOUT; - } - - if (*flags & FTDM_EVENTS) { - inflags |= POLLPRI; - } - - result = tdmv_api_wait_socket(ftdmchan, to, &inflags); - - *flags = FTDM_NO_FLAGS; - - if (result < 0){ - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Poll failed"); - return FTDM_FAIL; - } - - if (result == 0) { - return FTDM_TIMEOUT; - } - - if (inflags & POLLIN) { - *flags |= FTDM_READ; - } - - if (inflags & POLLOUT) { - *flags |= FTDM_WRITE; - } - - if (inflags & POLLPRI) { - *flags |= FTDM_EVENTS; - } - - return FTDM_SUCCESS; -} - -/** - * \brief Checks for events on a Wanpipe span - * \param span Span to check for events - * \param ms Time to wait for event - * \return Success if event is waiting or failure if not - */ -FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event) -{ -#ifdef LIBSANGOMA_VERSION - sangoma_status_t sangstatus; - sangoma_wait_obj_t *pfds[FTDM_MAX_CHANNELS_SPAN] = { 0 }; - uint32_t inflags[FTDM_MAX_CHANNELS_SPAN]; - uint32_t outflags[FTDM_MAX_CHANNELS_SPAN]; -#else - struct pollfd pfds[FTDM_MAX_CHANNELS_SPAN]; -#endif - uint32_t i, j = 0, k = 0, l = 0; - int r; - - for(i = 1; i <= span->chan_count; i++) { - ftdm_channel_t *ftdmchan = span->channels[i]; - uint32_t chan_events = 0; - - /* translate events from ftdm to libsnagoma. if the user don't specify which events to poll the - * channel for, we just use SANG_WAIT_OBJ_HAS_EVENTS */ - if (poll_events) { - if (poll_events[j] & FTDM_READ) { - chan_events = SANG_WAIT_OBJ_HAS_INPUT; - } - if (poll_events[j] & FTDM_WRITE) { - chan_events |= SANG_WAIT_OBJ_HAS_OUTPUT; - } - if (poll_events[j] & FTDM_EVENTS) { - chan_events |= SANG_WAIT_OBJ_HAS_EVENTS; - } - } else { - chan_events = SANG_WAIT_OBJ_HAS_EVENTS; - } - -#ifdef LIBSANGOMA_VERSION - if (!ftdmchan->io_data) { - continue; /* should never happen but happens when shutting down */ - } - pfds[j] = WP_GET_WAITABLE(ftdmchan); - inflags[j] = chan_events; -#else - memset(&pfds[j], 0, sizeof(pfds[j])); - pfds[j].fd = span->channels[i]->sockfd; - pfds[j].events = chan_events; -#endif - - /* The driver probably should be able to do this wink/flash/ringing by itself this is sort of a hack to make it work! */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK) || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_FLASH)) { - l = 5; - } - - j++; - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RINGING)) { - l = 5; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RINGING) && ftdm_current_time_in_ms() >= ftdmchan->ring_time) { - wanpipe_tdm_api_t tdm_api; - int err; - memset(&tdm_api, 0, sizeof(tdm_api)); - if (ftdm_test_pflag(ftdmchan, WP_RINGING)) { - err = sangoma_tdm_txsig_offhook(ftdmchan->sockfd,&tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Ring-off Failed"); - ftdm_log(FTDM_LOG_ERROR, "sangoma_tdm_txsig_offhook failed\n"); - return FTDM_FAIL; - } - ftdm_clear_pflag_locked(ftdmchan, WP_RINGING); - ftdmchan->ring_time = ftdm_current_time_in_ms() + wp_globals.ring_off_ms; - } else { - err=sangoma_tdm_txsig_start(ftdmchan->sockfd,&tdm_api); - if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Ring Failed"); - ftdm_log(FTDM_LOG_ERROR, "sangoma_tdm_txsig_start failed\n"); - return FTDM_FAIL; - } - ftdm_set_pflag_locked(ftdmchan, WP_RINGING); - ftdmchan->ring_time = ftdm_current_time_in_ms() + wp_globals.ring_on_ms; - } - } - } - - if (l) { - ms = l; - } -#ifdef LIBSANGOMA_VERSION - sangstatus = sangoma_waitfor_many(pfds, inflags, outflags, j, ms); - if (SANG_STATUS_APIPOLL_TIMEOUT == sangstatus) { - r = 0; - } else if (SANG_STATUS_SUCCESS == sangstatus) { - r = 1; /* hopefully we never need how many changed -_- */ - } else { - ftdm_log(FTDM_LOG_ERROR, "sangoma_waitfor_many failed: %d, %s\n", sangstatus, strerror(errno)); - r = -1; - } -#else - r = poll(pfds, j, ms); -#endif - - if (r == 0) { - return l ? FTDM_SUCCESS : FTDM_TIMEOUT; - } else if (r < 0) { - snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); - return FTDM_FAIL; - } - - for(i = 1; i <= span->chan_count; i++) { - ftdm_channel_t *ftdmchan = span->channels[i]; - -#ifdef LIBSANGOMA_VERSION - if (outflags[i-1] & POLLPRI) { -#else - if (pfds[i-1].revents & POLLPRI) { -#endif - ftdm_set_io_flag(ftdmchan, FTDM_CHANNEL_IO_EVENT); - ftdmchan->last_event_time = ftdm_current_time_in_ms(); - k++; - } -#ifdef LIBSANGOMA_VERSION - if (outflags[i-1] & POLLIN) { -#else - if (pfds[i-1].revents & POLLIN) { -#endif - ftdm_set_io_flag(ftdmchan, FTDM_CHANNEL_IO_READ); - } -#ifdef LIBSANGOMA_VERSION - if (outflags[i-1] & POLLOUT) { -#else - if (pfds[i-1].revents & POLLOUT) { -#endif - ftdm_set_io_flag(ftdmchan, FTDM_CHANNEL_IO_WRITE); - } - } - /* when k is 0 it might be that an async wanpipe device signal was delivered */ - return FTDM_SUCCESS; -} - -/** - * \brief Gets alarms from a Wanpipe Channel - * \param ftdmchan Channel to get alarms from - * \return Success or failure - */ -static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) -{ - wanpipe_tdm_api_t tdm_api; - unsigned int alarms = 0; - int err; - - memset(&tdm_api, 0, sizeof(tdm_api)); - -#ifdef LIBSANGOMA_VERSION - if ((err = sangoma_tdm_get_fe_alarms(ftdmchan->sockfd, &tdm_api, &alarms))) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ioctl failed (%s)", strerror(errno)); - snprintf(ftdmchan->span->last_error, sizeof(ftdmchan->span->last_error), "ioctl failed (%s)", strerror(errno)); - return FTDM_FAIL; - } -#else - if ((err = sangoma_tdm_get_fe_alarms(ftdmchan->sockfd, &tdm_api)) < 0){ - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ioctl failed (%s)", strerror(errno)); - snprintf(ftdmchan->span->last_error, sizeof(ftdmchan->span->last_error), "ioctl failed (%s)", strerror(errno)); - return FTDM_FAIL; - } - alarms = tdm_api.wp_tdm_cmd.fe_alarms; -#endif -#ifdef WIN32 - /* Temporary fix: in the current trunk of libsangoma, for BRI, - WAN_TE_BIT_ALARM_RED bit is set if the card is in disconnected state, but this has - not been ported to Windows-libsangoma yet */ - if (FTDM_SPAN_IS_BRI(ftdmchan->span)) { - if (alarms) { - ftdmchan->alarm_flags |= FTDM_ALARM_RED; - alarms = 0; - } - } -#endif - - ftdmchan->alarm_flags = FTDM_ALARM_NONE; - - if (alarms & WAN_TE_BIT_ALARM_RED) { - ftdmchan->alarm_flags |= FTDM_ALARM_RED; - alarms &= ~WAN_TE_BIT_ALARM_RED; - } - - - if (alarms & WAN_TE_BIT_ALARM_AIS) { - ftdmchan->alarm_flags |= FTDM_ALARM_BLUE; - alarms &= ~WAN_TE_BIT_ALARM_AIS; - } - - if (alarms & WAN_TE_BIT_ALARM_RAI) { - ftdmchan->alarm_flags |= FTDM_ALARM_YELLOW; - alarms &= ~WAN_TE_BIT_ALARM_RAI; - } - - if (!ftdmchan->alarm_flags) { - /* there is a bug in wanpipe where alarms were not properly set when they should be - * on at application startup, until that is fixed we check the link status here too */ - ftdm_channel_hw_link_status_t sangoma_status = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_LINK_STATUS, &sangoma_status); - ftdmchan->alarm_flags = sangoma_status == FTDM_HW_LINK_DISCONNECTED ? FTDM_ALARM_RED : FTDM_ALARM_NONE; - } - - if (alarms) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Unmapped wanpipe alarms: %d\n", alarms); - } - - return FTDM_SUCCESS; -} - -/** - * \brief Process an event in a channel and set it's OOB event id. The channel must be locked. - * \param fchan Channel in which event occured - * \param event_id Pointer where we save the OOB event id - * \param tdm_api Wanpipe tdm struct that contain the event - * \return FTDM_SUCCESS or FTDM_FAIL - */ -static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fchan, ftdm_oob_event_t *event_id, wanpipe_tdm_api_t *tdm_api) -{ - ftdm_status_t status = FTDM_SUCCESS; - - switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_type) { - case WP_API_EVENT_LINK_STATUS: - { - if (FTDM_IS_DIGITAL_CHANNEL(fchan)) { - switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_link_status) { - case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: - /* *event_id = FTDM_OOB_ALARM_CLEAR; */ - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link connected event\n"); - break; - default: - /* *event_id = FTDM_OOB_ALARM_TRAP; */ - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link disconnected event\n"); - break; - } - /* The WP_API_EVENT_ALARM event should be used to clear alarms */ - *event_id = FTDM_OOB_NOOP; - } else { - switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_link_status) { - case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: - /* *event_id = FTDM_OOB_ALARM_CLEAR; */ - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Using analog link connected event as alarm clear\n"); - *event_id = FTDM_OOB_ALARM_CLEAR; - fchan->alarm_flags = FTDM_ALARM_NONE; - break; - default: - /* *event_id = FTDM_OOB_ALARM_TRAP; */ - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Using analog link disconnected event as alarm trap\n"); - *event_id = FTDM_OOB_ALARM_TRAP; - fchan->alarm_flags = FTDM_ALARM_RED; - break; - } - } - } - break; - - case WP_API_EVENT_RXHOOK: - { - if (fchan->type == FTDM_CHAN_TYPE_FXS) { - *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_hook_state - & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Got wanpipe %s\n", ftdm_oob_event2str(*event_id)); - if (*event_id == FTDM_OOB_OFFHOOK) { - if (ftdm_test_flag(fchan, FTDM_CHANNEL_FLASH)) { - ftdm_clear_flag(fchan, FTDM_CHANNEL_FLASH); - ftdm_clear_flag(fchan, FTDM_CHANNEL_WINK); - *event_id = FTDM_OOB_FLASH; - goto done; - } else { - ftdm_set_flag(fchan, FTDM_CHANNEL_WINK); - } - } else { - if (ftdm_test_flag(fchan, FTDM_CHANNEL_WINK)) { - ftdm_clear_flag(fchan, FTDM_CHANNEL_WINK); - ftdm_clear_flag(fchan, FTDM_CHANNEL_FLASH); - *event_id = FTDM_OOB_WINK; - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Wink flag is set, delivering %s\n", - ftdm_oob_event2str(*event_id)); - goto done; - } else { - ftdm_set_flag(fchan, FTDM_CHANNEL_FLASH); - } - } - status = FTDM_BREAK; - } else { - ftdm_status_t status; - status = sangoma_tdm_txsig_onhook(fchan->sockfd, tdm_api); - if (status) { - snprintf(fchan->last_error, sizeof(fchan->last_error), "ONHOOK Failed"); - return FTDM_FAIL; - } - *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_ONHOOK : FTDM_OOB_NOOP; - } - } - break; - case WP_API_EVENT_RING_DETECT: - { - *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; - } - break; - /* - disabled this ones when configuring, we don't need them, do we? - case WP_API_EVENT_RING_TRIP_DETECT: - { - *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; - } - break; - */ - case WP_API_EVENT_RBS: - { - *event_id = FTDM_OOB_CAS_BITS_CHANGE; - fchan->rx_cas_bits = wanpipe_swap_bits(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); - } - break; - case WP_API_EVENT_DTMF: - { - char tmp_dtmf[2] = { tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; - *event_id = FTDM_OOB_NOOP; - - if (tmp_dtmf[0] == 'f') { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c, fax tones will be passed through!\n", tmp_dtmf[0]); - break; - } - - if (tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { - ftdm_set_flag(fchan, FTDM_CHANNEL_MUTE); - if (fchan->dtmfdetect.duration_ms) { - fchan->dtmfdetect.start_time = ftdm_current_time_in_ms(); - } else if (fchan->dtmfdetect.trigger_on_start) { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); - ftdm_channel_queue_dtmf(fchan, tmp_dtmf); - } - } - - if (tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) { - ftdm_clear_flag(fchan, FTDM_CHANNEL_MUTE); - if (ftdm_test_flag(fchan, FTDM_CHANNEL_INUSE)) { - if (fchan->dtmfdetect.duration_ms) { - ftdm_time_t diff = ftdm_current_time_in_ms() - fchan->dtmfdetect.start_time; - if (diff > fchan->dtmfdetect.duration_ms) { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c (duration:%"FTDM_TIME_FMT" min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms); - ftdm_channel_queue_dtmf(fchan, tmp_dtmf); - } else { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c (duration:%"FTDM_TIME_FMT" min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms); - } - } else if (!fchan->dtmfdetect.trigger_on_start) { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); - ftdm_channel_queue_dtmf(fchan, tmp_dtmf); - } - } - } - } - break; - case WP_API_EVENT_ALARM: - { - if (tdm_api->wp_tdm_cmd.event.wp_api_event_alarm) { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Got Wanpipe alarms %d\n", tdm_api->wp_tdm_cmd.event.wp_api_event_alarm); - *event_id = FTDM_OOB_ALARM_TRAP; - } else { - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Wanpipe alarms cleared\n"); - *event_id = FTDM_OOB_ALARM_CLEAR; - } - } - break; - case WP_API_EVENT_POLARITY_REVERSE: - { - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Got polarity reverse\n"); - *event_id = FTDM_OOB_POLARITY_REVERSE; - } - break; - default: - { - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_type); - *event_id = FTDM_OOB_INVALID; - } - break; - } -done: - return status; -} - -/** - * \brief Retrieves an event from a wanpipe channel - * \param channel Channel to retrieve event from - * \param event FreeTDM event to return - * \return Success or failure - */ -FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) -{ - ftdm_status_t status; - ftdm_oob_event_t event_id; - wanpipe_tdm_api_t tdm_api; - ftdm_span_t *span = ftdmchan->span; - - memset(&tdm_api, 0, sizeof(tdm_api)); - status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); - if (status != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); - return FTDM_FAIL; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); - status = wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api); - if (status == FTDM_BREAK) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Ignoring event for now\n"); - } else if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); - return FTDM_FAIL; - } else { - ftdmchan->last_event_time = 0; - } - - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = ftdmchan; - *event = &span->event_header; - return FTDM_SUCCESS; -} - -/** - * \brief Retrieves an event from a wanpipe span - * \param span Span to retrieve event from - * \param event FreeTDM event to return - * \return Success or failure - */ -FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) -{ - uint32_t i,err; - ftdm_oob_event_t event_id; - for(i = 1; i <= span->chan_count; i++) { - /* as a hack for wink/flash detection, wanpipe_poll_event overrides the timeout parameter - * to force the user to call this function each 5ms or so to detect the timeout of our wink/flash */ - if (span->channels[i]->last_event_time && !ftdm_test_io_flag(span->channels[i], FTDM_CHANNEL_IO_EVENT)) { - ftdm_time_t diff = ftdm_current_time_in_ms() - span->channels[i]->last_event_time; - /* XX printf("%u %u %u\n", diff, (unsigned)ftdm_current_time_in_ms(), (unsigned)span->channels[i]->last_event_time); */ - if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_WINK)) { - if (diff > wp_globals.wink_ms) { - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_WINK); - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_FLASH); - ftdm_set_flag_locked(span->channels[i], FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_OFFHOOK; - ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Diff since last event = %"FTDM_TIME_FMT" ms, delivering %s now\n", diff, ftdm_oob_event2str(event_id)); - goto event; - } - } - - if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_FLASH)) { - if (diff > wp_globals.flash_ms) { - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_FLASH); - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_WINK); - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_ONHOOK; - - if (span->channels[i]->type == FTDM_CHAN_TYPE_FXO) { - ftdm_channel_t *ftdmchan = span->channels[i]; - wanpipe_tdm_api_t tdm_api; - memset(&tdm_api, 0, sizeof(tdm_api)); - - sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); - } - ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Diff since last event = %"FTDM_TIME_FMT" ms, delivering %s now\n", diff, ftdm_oob_event2str(event_id)); - goto event; - } - } - } - if (ftdm_test_io_flag(span->channels[i], FTDM_CHANNEL_IO_EVENT)) { - ftdm_status_t status; - wanpipe_tdm_api_t tdm_api; - ftdm_channel_t *ftdmchan = span->channels[i]; - memset(&tdm_api, 0, sizeof(tdm_api)); - ftdm_clear_io_flag(span->channels[i], FTDM_CHANNEL_IO_EVENT); - - err = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); - if (err != FTDM_SUCCESS) { - ftdm_log_chan(span->channels[i], FTDM_LOG_ERROR, "read wanpipe event got error: %s\n", strerror(errno)); - return FTDM_FAIL; - } - ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); - - ftdm_channel_lock(ftdmchan); - status = wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api); - ftdm_channel_unlock(ftdmchan); - - if (status == FTDM_BREAK) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring event for now\n"); - continue; - } else if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); - return FTDM_FAIL; - } - - event: - - span->channels[i]->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = span->channels[i]; - *event = &span->event_header; - return FTDM_SUCCESS; - } - } - return FTDM_BREAK; -} - -/** - * \brief Destroys a Wanpipe Channel - * \param ftdmchan Channel to destroy - * \return Success - */ -static FIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy) -{ -#ifdef LIBSANGOMA_VERSION - if (ftdmchan->io_data) { - sangoma_wait_obj_t *sangoma_wait_obj = WP_GET_WAITABLE(ftdmchan); - sangoma_wait_obj_delete(&sangoma_wait_obj); - ftdm_safe_free(ftdmchan->io_data); - ftdmchan->io_data = NULL; - } -#endif - - if (ftdmchan->sockfd != FTDM_INVALID_SOCKET) { - /* enable HW DTMF. As odd as it seems. Why enable when the channel is being destroyed and won't be used anymore? - * because that way we can transfer the DTMF state back to the driver, if we're being restarted we will set again - * the FEATURE_DTMF flag and use HW DTMF, if we don't enable here, then on module restart we won't see - * HW DTMF available and will use software */ - if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT)) { - wanpipe_tdm_api_t tdm_api; - int err; - memset(&tdm_api, 0, sizeof(tdm_api)); - err = sangoma_tdm_enable_dtmf_events(ftdmchan->sockfd, &tdm_api); - if (err) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed enabling Sangoma HW DTMF failed on channel destroy\n"); - } - } - sangoma_close(&ftdmchan->sockfd); - } - - return FTDM_SUCCESS; -} - -/** - * \brief Loads wanpipe IO module - * \param fio FreeTDM IO interface - * \return Success - */ -static FIO_IO_LOAD_FUNCTION(wanpipe_init) -{ - ftdm_assert(fio != NULL, "fio should not be null\n"); - - memset(&wanpipe_interface, 0, sizeof(wanpipe_interface)); - - wp_globals.codec_ms = 20; - wp_globals.wink_ms = 150; - wp_globals.flash_ms = 750; - wp_globals.ring_on_ms = 2000; - wp_globals.ring_off_ms = 4000; - /* 0 for queue size will leave driver defaults */ - wp_globals.txqueue_size = 0; - wp_globals.rxqueue_size = 0; - wanpipe_interface.name = "wanpipe"; - wanpipe_interface.configure_span = wanpipe_configure_span; - wanpipe_interface.configure = wanpipe_configure; - wanpipe_interface.open = wanpipe_open; - wanpipe_interface.close = wanpipe_close; - wanpipe_interface.command = wanpipe_command; - wanpipe_interface.wait = wanpipe_wait; - wanpipe_interface.read = wanpipe_read; - wanpipe_interface.write = wanpipe_write; - wanpipe_interface.poll_event = wanpipe_poll_event; - wanpipe_interface.next_event = wanpipe_span_next_event; - wanpipe_interface.channel_next_event = wanpipe_channel_next_event; - wanpipe_interface.channel_destroy = wanpipe_channel_destroy; - wanpipe_interface.get_alarms = wanpipe_get_alarms; - *fio = &wanpipe_interface; - - return FTDM_SUCCESS; -} - -/** - * \brief Unloads wanpipe IO module - * \return Success - */ -static FIO_IO_UNLOAD_FUNCTION(wanpipe_destroy) -{ - memset(&wanpipe_interface, 0, sizeof(wanpipe_interface)); - return FTDM_SUCCESS; -} - -/** - * \brief FreeTDM wanpipe IO module definition - */ -EX_DECLARE_DATA ftdm_module_t ftdm_module = { - "wanpipe", - wanpipe_init, - wanpipe_destroy, -}; - -/* 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/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c deleted file mode 100644 index 369a05d1d0..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ /dev/null @@ -1,1571 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * W McRoberts - * Puskás Zsolt - * - */ - -#include "private/ftdm_core.h" -#include "ftmod_zt.h" - -/* used by dahdi to indicate there is no data available, but events to read */ -#ifndef ELAST -#define ELAST 500 -#endif - -/** - * \brief Zaptel globals - */ -static struct { - uint32_t codec_ms; - uint32_t wink_ms; - uint32_t flash_ms; - uint32_t eclevel; - uint32_t etlevel; - float rxgain; - float txgain; -} zt_globals; - -#if defined(__FreeBSD__) -typedef unsigned long ioctlcmd; -#else -typedef int ioctlcmd; -#endif - -/** - * \brief General IOCTL codes - */ -struct ioctl_codes { - ioctlcmd GET_BLOCKSIZE; - ioctlcmd SET_BLOCKSIZE; - ioctlcmd FLUSH; - ioctlcmd SYNC; - ioctlcmd GET_PARAMS; - ioctlcmd SET_PARAMS; - ioctlcmd HOOK; - ioctlcmd GETEVENT; - ioctlcmd IOMUX; - ioctlcmd SPANSTAT; - ioctlcmd MAINT; - ioctlcmd GETCONF; - ioctlcmd SETCONF; - ioctlcmd CONFLINK; - ioctlcmd CONFDIAG; - ioctlcmd GETGAINS; - ioctlcmd SETGAINS; - ioctlcmd SPANCONFIG; - ioctlcmd CHANCONFIG; - ioctlcmd SET_BUFINFO; - ioctlcmd GET_BUFINFO; - ioctlcmd AUDIOMODE; - ioctlcmd ECHOCANCEL; - ioctlcmd HDLCRAWMODE; - ioctlcmd HDLCFCSMODE; - ioctlcmd SPECIFY; - ioctlcmd SETLAW; - ioctlcmd SETLINEAR; - ioctlcmd GETCONFMUTE; - ioctlcmd ECHOTRAIN; - ioctlcmd SETTXBITS; - ioctlcmd GETRXBITS; - ioctlcmd SETPOLARITY; - ioctlcmd TONEDETECT; -}; - -/** - * \brief Zaptel IOCTL codes - */ -static struct ioctl_codes zt_ioctl_codes = { - .GET_BLOCKSIZE = ZT_GET_BLOCKSIZE, - .SET_BLOCKSIZE = ZT_SET_BLOCKSIZE, - .FLUSH = ZT_FLUSH, - .SYNC = ZT_SYNC, - .GET_PARAMS = ZT_GET_PARAMS, - .SET_PARAMS = ZT_SET_PARAMS, - .HOOK = ZT_HOOK, - .GETEVENT = ZT_GETEVENT, - .IOMUX = ZT_IOMUX, - .SPANSTAT = ZT_SPANSTAT, - .MAINT = ZT_MAINT, - .GETCONF = ZT_GETCONF, - .SETCONF = ZT_SETCONF, - .CONFLINK = ZT_CONFLINK, - .CONFDIAG = ZT_CONFDIAG, - .GETGAINS = ZT_GETGAINS, - .SETGAINS = ZT_SETGAINS, - .SPANCONFIG = ZT_SPANCONFIG, - .CHANCONFIG = ZT_CHANCONFIG, - .SET_BUFINFO = ZT_SET_BUFINFO, - .GET_BUFINFO = ZT_GET_BUFINFO, - .AUDIOMODE = ZT_AUDIOMODE, - .ECHOCANCEL = ZT_ECHOCANCEL, - .HDLCRAWMODE = ZT_HDLCRAWMODE, - .HDLCFCSMODE = ZT_HDLCFCSMODE, - .SPECIFY = ZT_SPECIFY, - .SETLAW = ZT_SETLAW, - .SETLINEAR = ZT_SETLINEAR, - .GETCONFMUTE = ZT_GETCONFMUTE, - .ECHOTRAIN = ZT_ECHOTRAIN, - .SETTXBITS = ZT_SETTXBITS, - .GETRXBITS = ZT_GETRXBITS, - .TONEDETECT = ZT_TONEDETECT, -}; - -/** - * \brief Dahdi IOCTL codes - */ -static struct ioctl_codes dahdi_ioctl_codes = { - .GET_BLOCKSIZE = DAHDI_GET_BLOCKSIZE, - .SET_BLOCKSIZE = DAHDI_SET_BLOCKSIZE, - .FLUSH = DAHDI_FLUSH, - .SYNC = DAHDI_SYNC, - .GET_PARAMS = DAHDI_GET_PARAMS, - .SET_PARAMS = DAHDI_SET_PARAMS, - .HOOK = DAHDI_HOOK, - .GETEVENT = DAHDI_GETEVENT, - .IOMUX = DAHDI_IOMUX, - .SPANSTAT = DAHDI_SPANSTAT, - .MAINT = DAHDI_MAINT, - .GETCONF = DAHDI_GETCONF, - .SETCONF = DAHDI_SETCONF, - .CONFLINK = DAHDI_CONFLINK, - .CONFDIAG = DAHDI_CONFDIAG, - .GETGAINS = DAHDI_GETGAINS, - .SETGAINS = DAHDI_SETGAINS, - .SPANCONFIG = DAHDI_SPANCONFIG, - .CHANCONFIG = DAHDI_CHANCONFIG, - .SET_BUFINFO = DAHDI_SET_BUFINFO, - .GET_BUFINFO = DAHDI_GET_BUFINFO, - .AUDIOMODE = DAHDI_AUDIOMODE, - .ECHOCANCEL = DAHDI_ECHOCANCEL, - .HDLCRAWMODE = DAHDI_HDLCRAWMODE, - .HDLCFCSMODE = DAHDI_HDLCFCSMODE, - .SPECIFY = DAHDI_SPECIFY, - .SETLAW = DAHDI_SETLAW, - .SETLINEAR = DAHDI_SETLINEAR, - .GETCONFMUTE = DAHDI_GETCONFMUTE, - .ECHOTRAIN = DAHDI_ECHOTRAIN, - .SETTXBITS = DAHDI_SETTXBITS, - .GETRXBITS = DAHDI_GETRXBITS, - .SETPOLARITY = DAHDI_SETPOLARITY, - .TONEDETECT = DAHDI_TONEDETECT, -}; - -#define ZT_INVALID_SOCKET -1 -static struct ioctl_codes codes; -static const char *ctlpath = NULL; -static const char *chanpath = NULL; - -static const char dahdi_ctlpath[] = "/dev/dahdi/ctl"; -static const char dahdi_chanpath[] = "/dev/dahdi/channel"; - -static const char zt_ctlpath[] = "/dev/zap/ctl"; -static const char zt_chanpath[] = "/dev/zap/channel"; - -static ftdm_socket_t CONTROL_FD = ZT_INVALID_SOCKET; - -FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event); -FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event); -FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event); - -/** - * \brief Initialises codec, and rx/tx gains - * \param g Structure for gains to be initialised - * \param rxgain RX gain value - * \param txgain TX gain value - * \param codec Codec - */ -static void zt_build_gains(struct zt_gains *g, float rxgain, float txgain, int codec) -{ - int j; - int k; - float linear_rxgain = pow(10.0, rxgain / 20.0); - float linear_txgain = pow(10.0, txgain / 20.0); - - switch (codec) { - case FTDM_CODEC_ALAW: - for (j = 0; j < (sizeof(g->receive_gain) / sizeof(g->receive_gain[0])); j++) { - if (rxgain) { - k = (int) (((float) alaw_to_linear(j)) * linear_rxgain); - if (k > 32767) k = 32767; - if (k < -32767) k = -32767; - g->receive_gain[j] = linear_to_alaw(k); - } else { - g->receive_gain[j] = j; - } - if (txgain) { - k = (int) (((float) alaw_to_linear(j)) * linear_txgain); - if (k > 32767) k = 32767; - if (k < -32767) k = -32767; - g->transmit_gain[j] = linear_to_alaw(k); - } else { - g->transmit_gain[j] = j; - } - } - break; - case FTDM_CODEC_ULAW: - for (j = 0; j < (sizeof(g->receive_gain) / sizeof(g->receive_gain[0])); j++) { - if (rxgain) { - k = (int) (((float) ulaw_to_linear(j)) * linear_rxgain); - if (k > 32767) k = 32767; - if (k < -32767) k = -32767; - g->receive_gain[j] = linear_to_ulaw(k); - } else { - g->receive_gain[j] = j; - } - if (txgain) { - k = (int) (((float) ulaw_to_linear(j)) * linear_txgain); - if (k > 32767) k = 32767; - if (k < -32767) k = -32767; - g->transmit_gain[j] = linear_to_ulaw(k); - } else { - g->transmit_gain[j] = j; - } - } - break; - } -} - -/** - * \brief Initialises a range of Zaptel/DAHDI channels - * \param span FreeTDM span - * \param start Initial wanpipe channel number - * \param end Final wanpipe channel number - * \param type FreeTDM channel type - * \param name FreeTDM span name - * \param number FreeTDM span number - * \param cas_bits CAS bits - * \return number of spans configured - */ -static unsigned zt_open_range(ftdm_span_t *span, unsigned start, unsigned end, ftdm_chan_type_t type, char *name, char *number, unsigned char cas_bits) -{ - unsigned configured = 0, x; - zt_params_t ztp; - zt_tone_mode_t mode = 0; - - memset(&ztp, 0, sizeof(ztp)); - - if (type == FTDM_CHAN_TYPE_CAS) { - ftdm_log(FTDM_LOG_DEBUG, "Configuring CAS channels with abcd == 0x%X\n", cas_bits); - } - for(x = start; x < end; x++) { - ftdm_channel_t *ftdmchan; - ftdm_socket_t sockfd = ZT_INVALID_SOCKET; - int len; - - sockfd = open(chanpath, O_RDWR); - if (sockfd != ZT_INVALID_SOCKET && ftdm_span_add_channel(span, sockfd, type, &ftdmchan) == FTDM_SUCCESS) { - - if (ioctl(sockfd, codes.SPECIFY, &x)) { - ftdm_log(FTDM_LOG_ERROR, "failure configuring device %s chan %d fd %d (%s)\n", chanpath, x, sockfd, strerror(errno)); - close(sockfd); - continue; - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - struct zt_bufferinfo binfo; - memset(&binfo, 0, sizeof(binfo)); - binfo.txbufpolicy = 0; - binfo.rxbufpolicy = 0; - binfo.numbufs = 32; - binfo.bufsize = 1024; - if (ioctl(sockfd, codes.SET_BUFINFO, &binfo)) { - ftdm_log(FTDM_LOG_ERROR, "failure configuring device %s as FreeTDM device %d:%d fd:%d\n", chanpath, ftdmchan->span_id, ftdmchan->chan_id, sockfd); - close(sockfd); - continue; - } - } - - if (type == FTDM_CHAN_TYPE_FXS || type == FTDM_CHAN_TYPE_FXO) { - struct zt_chanconfig cc; - memset(&cc, 0, sizeof(cc)); - cc.chan = cc.master = x; - - switch(type) { - case FTDM_CHAN_TYPE_FXS: - { - switch(span->start_type) { - case FTDM_ANALOG_START_KEWL: - cc.sigtype = ZT_SIG_FXOKS; - break; - case FTDM_ANALOG_START_LOOP: - cc.sigtype = ZT_SIG_FXOLS; - break; - case FTDM_ANALOG_START_GROUND: - cc.sigtype = ZT_SIG_FXOGS; - break; - default: - break; - } - } - break; - case FTDM_CHAN_TYPE_FXO: - { - switch(span->start_type) { - case FTDM_ANALOG_START_KEWL: - cc.sigtype = ZT_SIG_FXSKS; - break; - case FTDM_ANALOG_START_LOOP: - cc.sigtype = ZT_SIG_FXSLS; - break; - case FTDM_ANALOG_START_GROUND: - cc.sigtype = ZT_SIG_FXSGS; - break; - default: - break; - } - } - break; - default: - break; - } - - if (ioctl(CONTROL_FD, codes.CHANCONFIG, &cc)) { - ftdm_log(FTDM_LOG_WARNING, "this ioctl fails in older zaptel but is harmless if you used ztcfg\n[device %s chan %d fd %d (%s)]\n", chanpath, x, CONTROL_FD, strerror(errno)); - } - } - - if (type == FTDM_CHAN_TYPE_CAS) { - struct zt_chanconfig cc; - memset(&cc, 0, sizeof(cc)); - cc.chan = cc.master = x; - cc.sigtype = ZT_SIG_CAS; - cc.idlebits = cas_bits; - if (ioctl(CONTROL_FD, codes.CHANCONFIG, &cc)) { - ftdm_log(FTDM_LOG_ERROR, "failure configuring device %s as FreeTDM device %d:%d fd:%d err:%s\n", chanpath, ftdmchan->span_id, ftdmchan->chan_id, sockfd, strerror(errno)); - close(sockfd); - continue; - } - } - - if (ftdmchan->type != FTDM_CHAN_TYPE_DQ921 && ftdmchan->type != FTDM_CHAN_TYPE_DQ931) { - len = zt_globals.codec_ms * 8; - if (ioctl(ftdmchan->sockfd, codes.SET_BLOCKSIZE, &len)) { - ftdm_log(FTDM_LOG_ERROR, "failure configuring device %s as FreeTDM device %d:%d fd:%d err:%s\n", - chanpath, ftdmchan->span_id, ftdmchan->chan_id, sockfd, strerror(errno)); - close(sockfd); - continue; - } - - ftdmchan->packet_len = len; - ftdmchan->effective_interval = ftdmchan->native_interval = ftdmchan->packet_len / 8; - - if (ftdmchan->effective_codec == FTDM_CODEC_SLIN) { - ftdmchan->packet_len *= 2; - } - } - - if (ioctl(sockfd, codes.GET_PARAMS, &ztp) < 0) { - ftdm_log(FTDM_LOG_ERROR, "failure configuring device %s as FreeTDM device %d:%d fd:%d\n", chanpath, ftdmchan->span_id, ftdmchan->chan_id, sockfd); - close(sockfd); - continue; - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - if ( - (ztp.sig_type != ZT_SIG_HDLCRAW) && - (ztp.sig_type != ZT_SIG_HDLCFCS) && - (ztp.sig_type != ZT_SIG_HARDHDLC) - ) { - ftdm_log(FTDM_LOG_ERROR, "Failure configuring device %s as FreeTDM device %d:%d fd:%d, hardware signaling is not HDLC, fix your Zap/DAHDI configuration!\n", chanpath, ftdmchan->span_id, ftdmchan->chan_id, sockfd); - close(sockfd); - continue; - } - } - - ftdm_log(FTDM_LOG_INFO, "configuring device %s channel %d as FreeTDM device %d:%d fd:%d\n", chanpath, x, ftdmchan->span_id, ftdmchan->chan_id, sockfd); - - ftdmchan->rate = 8000; - ftdmchan->physical_span_id = ztp.span_no; - ftdmchan->physical_chan_id = ztp.chan_no; - - if (type == FTDM_CHAN_TYPE_FXS || type == FTDM_CHAN_TYPE_FXO || type == FTDM_CHAN_TYPE_EM || type == FTDM_CHAN_TYPE_B) { - if (ztp.g711_type == ZT_G711_ALAW) { - ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_ALAW; - } else if (ztp.g711_type == ZT_G711_MULAW) { - ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_ULAW; - } else { - int type; - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_E1) { - type = FTDM_CODEC_ALAW; - } else { - type = FTDM_CODEC_ULAW; - } - - ftdmchan->native_codec = ftdmchan->effective_codec = type; - - } - } - - ztp.wink_time = zt_globals.wink_ms; - ztp.flash_time = zt_globals.flash_ms; - - if (ioctl(sockfd, codes.SET_PARAMS, &ztp) < 0) { - ftdm_log(FTDM_LOG_ERROR, "failure configuring device %s as FreeTDM device %d:%d fd:%d\n", chanpath, ftdmchan->span_id, ftdmchan->chan_id, sockfd); - close(sockfd); - continue; - } - - mode = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE; - if (ioctl(sockfd, codes.TONEDETECT, &mode)) { - ftdm_log(FTDM_LOG_DEBUG, "HW DTMF not available on FreeTDM device %d:%d fd:%d\n", ftdmchan->span_id, ftdmchan->chan_id, sockfd); - } else { - ftdm_log(FTDM_LOG_DEBUG, "HW DTMF available on FreeTDM device %d:%d fd:%d\n", ftdmchan->span_id, ftdmchan->chan_id, sockfd); - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT); - mode = 0; - ioctl(sockfd, codes.TONEDETECT, &mode); - } - - if (!ftdm_strlen_zero(name)) { - ftdm_copy_string(ftdmchan->chan_name, name, sizeof(ftdmchan->chan_name)); - } - if (!ftdm_strlen_zero(number)) { - ftdm_copy_string(ftdmchan->chan_number, number, sizeof(ftdmchan->chan_number)); - } - - configured++; - } else { - ftdm_log(FTDM_LOG_ERROR, "failure configuring device %s\n", chanpath); - } - } - - - - return configured; -} - -/** - * \brief Initialises a freetdm Zaptel/DAHDI span from a configuration string - * \param span FreeTDM span - * \param str Configuration string - * \param type FreeTDM span type - * \param name FreeTDM span name - * \param number FreeTDM span number - * \return Success or failure - */ -static FIO_CONFIGURE_SPAN_FUNCTION(zt_configure_span) -{ - - int items, i; - char *mydata, *item_list[10]; - char *ch, *mx; - unsigned char cas_bits = 0; - int channo; - int top = 0; - unsigned configured = 0; - - assert(str != NULL); - - - mydata = ftdm_strdup(str); - assert(mydata != NULL); - - - items = ftdm_separate_string(mydata, ',', item_list, (sizeof(item_list) / sizeof(item_list[0]))); - - for(i = 0; i < items; i++) { - ch = item_list[i]; - - if (!(ch)) { - ftdm_log(FTDM_LOG_ERROR, "Invalid input\n"); - continue; - } - - channo = atoi(ch); - - if (channo < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid channel number %d\n", channo); - continue; - } - - if ((mx = strchr(ch, '-'))) { - mx++; - top = atoi(mx) + 1; - } else { - top = channo + 1; - } - - - if (top < 0) { - ftdm_log(FTDM_LOG_ERROR, "Invalid range number %d\n", top); - continue; - } - if (FTDM_CHAN_TYPE_CAS == type && ftdm_config_get_cas_bits(ch, &cas_bits)) { - ftdm_log(FTDM_LOG_ERROR, "Failed to get CAS bits in CAS channel\n"); - continue; - } - configured += zt_open_range(span, channo, top, type, name, number, cas_bits); - - } - - ftdm_safe_free(mydata); - - return configured; - -} - -/** - * \brief Process configuration variable for a Zaptel/DAHDI profile - * \param category Wanpipe profile name - * \param var Variable name - * \param val Variable value - * \param lineno Line number from configuration file - * \return Success - */ -static FIO_CONFIGURE_FUNCTION(zt_configure) -{ - - int num; - float fnum; - - if (!strcasecmp(category, "defaults")) { - if (!strcasecmp(var, "codec_ms")) { - num = atoi(val); - if (num < 10 || num > 60) { - ftdm_log(FTDM_LOG_WARNING, "invalid codec ms at line %d\n", lineno); - } else { - zt_globals.codec_ms = num; - } - } else if (!strcasecmp(var, "wink_ms")) { - num = atoi(val); - if (num < 50 || num > 3000) { - ftdm_log(FTDM_LOG_WARNING, "invalid wink ms at line %d\n", lineno); - } else { - zt_globals.wink_ms = num; - } - } else if (!strcasecmp(var, "flash_ms")) { - num = atoi(val); - if (num < 50 || num > 3000) { - ftdm_log(FTDM_LOG_WARNING, "invalid flash ms at line %d\n", lineno); - } else { - zt_globals.flash_ms = num; - } - } else if (!strcasecmp(var, "echo_cancel_level")) { - num = atoi(val); - if (num < 0 || num > 1024) { - ftdm_log(FTDM_LOG_WARNING, "invalid echo can val at line %d\n", lineno); - } else { - zt_globals.eclevel = num; - } - } else if (!strcasecmp(var, "echo_train_level")) { - if (zt_globals.eclevel < 1) { - ftdm_log(FTDM_LOG_WARNING, "can't set echo train level without setting echo cancel level first at line %d\n", lineno); - } else { - num = atoi(val); - if (num < 0 || num > 256) { - ftdm_log(FTDM_LOG_WARNING, "invalid echo train val at line %d\n", lineno); - } else { - zt_globals.etlevel = num; - } - } - } else if (!strcasecmp(var, "rxgain")) { - fnum = (float)atof(val); - if (fnum < -100.0 || fnum > 100.0) { - ftdm_log(FTDM_LOG_WARNING, "invalid rxgain val at line %d\n", lineno); - } else { - zt_globals.rxgain = fnum; - ftdm_log(FTDM_LOG_INFO, "Setting rxgain val to %f\n", fnum); - } - } else if (!strcasecmp(var, "txgain")) { - fnum = (float)atof(val); - if (fnum < -100.0 || fnum > 100.0) { - ftdm_log(FTDM_LOG_WARNING, "invalid txgain val at line %d\n", lineno); - } else { - zt_globals.txgain = fnum; - ftdm_log(FTDM_LOG_INFO, "Setting txgain val to %f\n", fnum); - } - } else { - ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown setting '%s'\n", var); - } - } - - return FTDM_SUCCESS; -} - -/** - * \brief Opens a Zaptel/DAHDI channel - * \param ftdmchan Channel to open - * \return Success or failure - */ -static FIO_OPEN_FUNCTION(zt_open) -{ - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL); - - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921 || ftdmchan->type == FTDM_CHAN_TYPE_DQ931) { - ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_NONE; - } else { - int blocksize = zt_globals.codec_ms * (ftdmchan->rate / 1000); - int err; - if ((err = ioctl(ftdmchan->sockfd, codes.SET_BLOCKSIZE, &blocksize))) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); - return FTDM_FAIL; - } else { - ftdmchan->effective_interval = ftdmchan->native_interval; - ftdmchan->packet_len = blocksize; - ftdmchan->native_codec = ftdmchan->effective_codec; - } - - if (ftdmchan->type == FTDM_CHAN_TYPE_B) { - int one = 1; - if (ioctl(ftdmchan->sockfd, codes.AUDIOMODE, &one)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); - ftdm_log(FTDM_LOG_ERROR, "%s\n", ftdmchan->last_error); - return FTDM_FAIL; - } - } - if (zt_globals.rxgain || zt_globals.txgain) { - struct zt_gains gains; - memset(&gains, 0, sizeof(gains)); - - gains.chan_no = ftdmchan->physical_chan_id; - zt_build_gains(&gains, zt_globals.rxgain, zt_globals.txgain, ftdmchan->native_codec); - - if (zt_globals.rxgain) - ftdm_log(FTDM_LOG_INFO, "Setting rxgain to %f on channel %d\n", zt_globals.rxgain, gains.chan_no); - - if (zt_globals.txgain) - ftdm_log(FTDM_LOG_INFO, "Setting txgain to %f on channel %d\n", zt_globals.txgain, gains.chan_no); - - if (ioctl(ftdmchan->sockfd, codes.SETGAINS, &gains) < 0) { - ftdm_log(FTDM_LOG_ERROR, "failure configuring device %s as FreeTDM device %d:%d fd:%d\n", chanpath, ftdmchan->span_id, ftdmchan->chan_id, ftdmchan->sockfd); - } - } - - if (1) { - int len = zt_globals.eclevel; - if (len) { - ftdm_log(FTDM_LOG_INFO, "Setting echo cancel to %d taps for %d:%d\n", len, ftdmchan->span_id, ftdmchan->chan_id); - } else { - ftdm_log(FTDM_LOG_INFO, "Disable echo cancel for %d:%d\n", ftdmchan->span_id, ftdmchan->chan_id); - } - if (ioctl(ftdmchan->sockfd, codes.ECHOCANCEL, &len)) { - ftdm_log(FTDM_LOG_WARNING, "Echo cancel not available for %d:%d\n", ftdmchan->span_id, ftdmchan->chan_id); - } else if (zt_globals.etlevel > 0) { - len = zt_globals.etlevel; - if (ioctl(ftdmchan->sockfd, codes.ECHOTRAIN, &len)) { - ftdm_log(FTDM_LOG_WARNING, "Echo training not available for %d:%d\n", ftdmchan->span_id, ftdmchan->chan_id); - } - } - } - } - return FTDM_SUCCESS; -} - -/** - * \brief Closes Zaptel/DAHDI channel - * \param ftdmchan Channel to close - * \return Success - */ -static FIO_CLOSE_FUNCTION(zt_close) -{ - if (ftdmchan->type == FTDM_CHAN_TYPE_B) { - int value = 0; /* disable audio mode */ - if (ioctl(ftdmchan->sockfd, codes.AUDIOMODE, &value)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); - ftdm_log(FTDM_LOG_ERROR, "%s\n", ftdmchan->last_error); - return FTDM_FAIL; - } - } - return FTDM_SUCCESS; -} - -/** - * \brief Executes a FreeTDM command on a Zaptel/DAHDI channel - * \param ftdmchan Channel to execute command on - * \param command FreeTDM command to execute - * \param obj Object (unused) - * \return Success or failure - */ -static FIO_COMMAND_FUNCTION(zt_command) -{ - zt_params_t ztp; - int err = 0; - - memset(&ztp, 0, sizeof(ztp)); - - switch(command) { - case FTDM_COMMAND_ENABLE_ECHOCANCEL: - { - int level = FTDM_COMMAND_OBJ_INT; - err = ioctl(ftdmchan->sockfd, codes.ECHOCANCEL, &level); - FTDM_COMMAND_OBJ_INT = level; - } - case FTDM_COMMAND_DISABLE_ECHOCANCEL: - { - int level = 0; - err = ioctl(ftdmchan->sockfd, codes.ECHOCANCEL, &level); - FTDM_COMMAND_OBJ_INT = level; - } - break; - case FTDM_COMMAND_ENABLE_ECHOTRAIN: - { - int level = FTDM_COMMAND_OBJ_INT; - err = ioctl(ftdmchan->sockfd, codes.ECHOTRAIN, &level); - FTDM_COMMAND_OBJ_INT = level; - } - case FTDM_COMMAND_DISABLE_ECHOTRAIN: - { - int level = 0; - err = ioctl(ftdmchan->sockfd, codes.ECHOTRAIN, &level); - FTDM_COMMAND_OBJ_INT = level; - } - break; - case FTDM_COMMAND_OFFHOOK: - { - int command = ZT_OFFHOOK; - if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "OFFHOOK Failed"); - return FTDM_FAIL; - } - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Channel is now offhook\n"); - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - } - break; - case FTDM_COMMAND_ONHOOK: - { - int command = ZT_ONHOOK; - if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "ONHOOK Failed"); - return FTDM_FAIL; - } - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Channel is now onhook\n"); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - } - break; - case FTDM_COMMAND_FLASH: - { - int command = ZT_FLASH; - if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "FLASH Failed"); - return FTDM_FAIL; - } - } - break; - case FTDM_COMMAND_WINK: - { - int command = ZT_WINK; - if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "WINK Failed"); - return FTDM_FAIL; - } - } - break; - case FTDM_COMMAND_GENERATE_RING_ON: - { - int command = ZT_RING; - if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "RING Failed"); - return FTDM_FAIL; - } - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_RINGING); - } - break; - case FTDM_COMMAND_GENERATE_RING_OFF: - { - int command = ZT_RINGOFF; - if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Ring-off Failed"); - return FTDM_FAIL; - } - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_RINGING); - } - break; - case FTDM_COMMAND_GET_INTERVAL: - { - - if (!(err = ioctl(ftdmchan->sockfd, codes.GET_BLOCKSIZE, &ftdmchan->packet_len))) { - ftdmchan->native_interval = ftdmchan->packet_len / 8; - if (ftdmchan->effective_codec == FTDM_CODEC_SLIN) { - ftdmchan->packet_len *= 2; - } - FTDM_COMMAND_OBJ_INT = ftdmchan->native_interval; - } - } - break; - case FTDM_COMMAND_SET_INTERVAL: - { - int interval = FTDM_COMMAND_OBJ_INT; - int len = interval * 8; - - if (!(err = ioctl(ftdmchan->sockfd, codes.SET_BLOCKSIZE, &len))) { - ftdmchan->packet_len = len; - ftdmchan->effective_interval = ftdmchan->native_interval = ftdmchan->packet_len / 8; - - if (ftdmchan->effective_codec == FTDM_CODEC_SLIN) { - ftdmchan->packet_len *= 2; - } - } - } - break; - case FTDM_COMMAND_SET_CAS_BITS: - { - int bits = FTDM_COMMAND_OBJ_INT; - err = ioctl(ftdmchan->sockfd, codes.SETTXBITS, &bits); - } - break; - case FTDM_COMMAND_GET_CAS_BITS: - { - err = ioctl(ftdmchan->sockfd, codes.GETRXBITS, &ftdmchan->rx_cas_bits); - if (!err) { - FTDM_COMMAND_OBJ_INT = ftdmchan->rx_cas_bits; - } - } - break; - case FTDM_COMMAND_FLUSH_TX_BUFFERS: - { - int flushmode = ZT_FLUSH_WRITE; - err = ioctl(ftdmchan->sockfd, codes.FLUSH, &flushmode); - } - break; - case FTDM_COMMAND_SET_POLARITY: - { - ftdm_polarity_t polarity = FTDM_COMMAND_OBJ_INT; - err = ioctl(ftdmchan->sockfd, codes.SETPOLARITY, polarity); - if (!err) { - ftdmchan->polarity = polarity; - } - } - break; - case FTDM_COMMAND_FLUSH_RX_BUFFERS: - { - int flushmode = ZT_FLUSH_READ; - err = ioctl(ftdmchan->sockfd, codes.FLUSH, &flushmode); - } - break; - case FTDM_COMMAND_FLUSH_BUFFERS: - { - int flushmode = ZT_FLUSH_BOTH; - err = ioctl(ftdmchan->sockfd, codes.FLUSH, &flushmode); - } - break; - case FTDM_COMMAND_SET_RX_QUEUE_SIZE: - case FTDM_COMMAND_SET_TX_QUEUE_SIZE: - /* little white lie ... eventually we can implement this, in the meantime, not worth the effort - and this is only used by some sig modules such as ftmod_r2 to behave bettter under load */ - err = 0; - break; - case FTDM_COMMAND_ENABLE_DTMF_DETECT: - { - zt_tone_mode_t mode = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE; - err = ioctl(ftdmchan->sockfd, codes.TONEDETECT, &mode); - } - break; - case FTDM_COMMAND_DISABLE_DTMF_DETECT: - { - zt_tone_mode_t mode = 0; - err = ioctl(ftdmchan->sockfd, codes.TONEDETECT, &mode); - } - break; - default: - err = FTDM_NOTIMPL; - break; - }; - - if (err && err != FTDM_NOTIMPL) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); - return FTDM_FAIL; - } - - - return err == 0 ? FTDM_SUCCESS : err; -} - -/** - * \brief Gets alarms from a Zaptel/DAHDI channel - * \param ftdmchan Channel to get alarms from - * \return Success or failure - */ -static FIO_GET_ALARMS_FUNCTION(zt_get_alarms) -{ - struct zt_spaninfo info; - zt_params_t params; - - memset(&info, 0, sizeof(info)); - info.span_no = ftdmchan->physical_span_id; - - memset(¶ms, 0, sizeof(params)); - - if (ioctl(CONTROL_FD, codes.SPANSTAT, &info)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ioctl failed (%s)", strerror(errno)); - snprintf(ftdmchan->span->last_error, sizeof(ftdmchan->span->last_error), "ioctl failed (%s)", strerror(errno)); - return FTDM_FAIL; - } - - ftdmchan->alarm_flags = info.alarms; - - /* get channel alarms if span has no alarms */ - if (info.alarms == FTDM_ALARM_NONE) { - if (ioctl(ftdmchan->sockfd, codes.GET_PARAMS, ¶ms)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ioctl failed (%s)", strerror(errno)); - snprintf(ftdmchan->span->last_error, sizeof(ftdmchan->span->last_error), "ioctl failed (%s)", strerror(errno)); - return FTDM_FAIL; - } - - if (params.chan_alarms > 0) { - if (params.chan_alarms == DAHDI_ALARM_YELLOW) { - ftdmchan->alarm_flags = FTDM_ALARM_YELLOW; - } - else if (params.chan_alarms == DAHDI_ALARM_BLUE) { - ftdmchan->alarm_flags = FTDM_ALARM_BLUE; - } - else { - ftdmchan->alarm_flags = FTDM_ALARM_RED; - } - } - } - - return FTDM_SUCCESS; -} - -#define ftdm_zt_set_event_pending(fchan) \ - do { \ - ftdm_set_io_flag(fchan, FTDM_CHANNEL_IO_EVENT); \ - fchan->last_event_time = ftdm_current_time_in_ms(); \ - } while (0); - -#define ftdm_zt_store_chan_event(fchan, revent) \ - do { \ - if (fchan->io_data) { \ - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Dropping event %d, not retrieved on time\n", revent); \ - } \ - fchan->io_data = (void *)zt_event_id; \ - ftdm_zt_set_event_pending(fchan); \ - } while (0); - -/** - * \brief Waits for an event on a Zaptel/DAHDI channel - * \param ftdmchan Channel to open - * \param flags Type of event to wait for - * \param to Time to wait (in ms) - * \return Success, failure or timeout - */ -static FIO_WAIT_FUNCTION(zt_wait) -{ - int32_t inflags = 0; - int result; - struct pollfd pfds[1]; - - if (*flags & FTDM_READ) { - inflags |= POLLIN; - } - - if (*flags & FTDM_WRITE) { - inflags |= POLLOUT; - } - - if (*flags & FTDM_EVENTS) { - inflags |= POLLPRI; - } - -pollagain: - memset(&pfds[0], 0, sizeof(pfds[0])); - pfds[0].fd = ftdmchan->sockfd; - pfds[0].events = inflags; - result = poll(pfds, 1, to); - *flags = FTDM_NO_FLAGS; - - if (result < 0 && errno == EINTR) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "DAHDI wait got interrupted, trying again\n"); - goto pollagain; - } - - if (pfds[0].revents & POLLERR) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "DAHDI device got POLLERR\n"); - result = -1; - } - - if (result > 0) { - inflags = pfds[0].revents; - } - - if (result < 0){ - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Poll failed"); - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to poll DAHDI device: %s\n", strerror(errno)); - return FTDM_FAIL; - } - - if (result == 0) { - return FTDM_TIMEOUT; - } - - if (inflags & POLLIN) { - *flags |= FTDM_READ; - } - - if (inflags & POLLOUT) { - *flags |= FTDM_WRITE; - } - - if ((inflags & POLLPRI) || (ftdmchan->io_data && (*flags & FTDM_EVENTS))) { - *flags |= FTDM_EVENTS; - } - - return FTDM_SUCCESS; - -} - -/** - * \brief Checks for events on a Zaptel/DAHDI span - * \param span Span to check for events - * \param ms Time to wait for event - * \return Success if event is waiting or failure if not - */ -FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event) -{ - struct pollfd pfds[FTDM_MAX_CHANNELS_SPAN]; - uint32_t i, j = 0, k = 0; - int r; - - ftdm_unused_arg(poll_events); - - for(i = 1; i <= span->chan_count; i++) { - memset(&pfds[j], 0, sizeof(pfds[j])); - pfds[j].fd = span->channels[i]->sockfd; - pfds[j].events = POLLPRI; - j++; - } - - r = poll(pfds, j, ms); - - if (r == 0) { - return FTDM_TIMEOUT; - } else if (r < 0) { - snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); - return FTDM_FAIL; - } - - for(i = 1; i <= span->chan_count; i++) { - - ftdm_channel_lock(span->channels[i]); - - if (pfds[i-1].revents & POLLERR) { - ftdm_log_chan(span->channels[i], FTDM_LOG_ERROR, "POLLERR, flags=%d\n", pfds[i-1].events); - - ftdm_channel_unlock(span->channels[i]); - - continue; - } - if ((pfds[i-1].revents & POLLPRI) || (span->channels[i]->io_data)) { - ftdm_zt_set_event_pending(span->channels[i]); - k++; - } - if (pfds[i-1].revents & POLLIN) { - ftdm_set_io_flag(span->channels[i], FTDM_CHANNEL_IO_READ); - } - if (pfds[i-1].revents & POLLOUT) { - ftdm_set_io_flag(span->channels[i], FTDM_CHANNEL_IO_WRITE); - } - - ftdm_channel_unlock(span->channels[i]); - - } - - if (!k) { - snprintf(span->last_error, sizeof(span->last_error), "no matching descriptor"); - } - - return k ? FTDM_SUCCESS : FTDM_FAIL; -} - -static __inline__ int handle_dtmf_event(ftdm_channel_t *fchan, zt_event_t zt_event_id) -{ - if ((zt_event_id & ZT_EVENT_DTMFUP)) { - int digit = (zt_event_id & (~ZT_EVENT_DTMFUP)); - char tmp_dtmf[2] = { digit, 0 }; - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "DTMF UP [%d]\n", digit); - ftdm_channel_queue_dtmf(fchan, tmp_dtmf); - return 0; - } else if ((zt_event_id & ZT_EVENT_DTMFDOWN)) { - int digit = (zt_event_id & (~ZT_EVENT_DTMFDOWN)); - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "DTMF DOWN [%d]\n", digit); - return 0; - } else { - return -1; - } -} - -/** - * \brief Process an event from a ftdmchan and set the proper OOB event_id. The channel must be locked. - * \param fchan Channel to retrieve event from - * \param event_id Pointer to OOB event id - * \param zt_event_id Zaptel event id - * \return FTDM_SUCCESS or FTDM_FAIL - */ -static __inline__ ftdm_status_t zt_channel_process_event(ftdm_channel_t *fchan, ftdm_oob_event_t *event_id, zt_event_t zt_event_id) -{ - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Processing zap hardware event %d\n", zt_event_id); - switch(zt_event_id) { - case ZT_EVENT_RINGEROFF: - { - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "ZT RINGER OFF\n"); - *event_id = FTDM_OOB_NOOP; - } - break; - case ZT_EVENT_RINGERON: - { - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "ZT RINGER ON\n"); - *event_id = FTDM_OOB_NOOP; - } - break; - case ZT_EVENT_RINGBEGIN: - { - *event_id = FTDM_OOB_RING_START; - } - break; - case ZT_EVENT_ONHOOK: - { - *event_id = FTDM_OOB_ONHOOK; - } - break; - case ZT_EVENT_WINKFLASH: - { - if (fchan->state == FTDM_CHANNEL_STATE_DOWN || fchan->state == FTDM_CHANNEL_STATE_DIALING) { - *event_id = FTDM_OOB_WINK; - } else { - *event_id = FTDM_OOB_FLASH; - } - } - break; - case ZT_EVENT_RINGOFFHOOK: - { - *event_id = FTDM_OOB_NOOP; - if (fchan->type == FTDM_CHAN_TYPE_FXS || (fchan->type == FTDM_CHAN_TYPE_EM && fchan->state != FTDM_CHANNEL_STATE_UP)) { - if (fchan->type != FTDM_CHAN_TYPE_EM) { - /* In E&M we're supposed to set this flag only when the local side goes offhook, not the remote */ - ftdm_set_flag_locked(fchan, FTDM_CHANNEL_OFFHOOK); - } - - /* For E&M let's count the ring count (it seems sometimes we receive RINGOFFHOOK once before the other end - * answers, then another RINGOFFHOOK when the other end answers?? anyways, now we count rings before delivering the - * offhook event ... the E&M signaling code in ftmod_analog_em also polls the RBS bits looking for answer, just to - * be safe and not rely on this event, so even if this event does not arrive, when there is answer supervision - * the analog signaling code should detect the cas persistance pattern and answer */ - if (fchan->type == FTDM_CHAN_TYPE_EM && ftdm_test_flag(fchan, FTDM_CHANNEL_OUTBOUND)) { - fchan->ring_count++; - /* perhaps some day we'll make this configurable, but since I am not even sure what the hell is going on - * no point in making a configuration option for something that may not be technically correct */ - if (fchan->ring_count == 2) { - *event_id = FTDM_OOB_OFFHOOK; - } - } else { - *event_id = FTDM_OOB_OFFHOOK; - } - } else if (fchan->type == FTDM_CHAN_TYPE_FXO) { - *event_id = FTDM_OOB_RING_START; - } - } - break; - case ZT_EVENT_ALARM: - { - *event_id = FTDM_OOB_ALARM_TRAP; - } - break; - case ZT_EVENT_NOALARM: - { - *event_id = FTDM_OOB_ALARM_CLEAR; - } - break; - case ZT_EVENT_BITSCHANGED: - { - *event_id = FTDM_OOB_CAS_BITS_CHANGE; - int bits = 0; - int err = ioctl(fchan->sockfd, codes.GETRXBITS, &bits); - if (err) { - return FTDM_FAIL; - } - fchan->rx_cas_bits = bits; - } - break; - case ZT_EVENT_BADFCS: - { - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Bad frame checksum (ZT_EVENT_BADFCS)\n"); - *event_id = FTDM_OOB_NOOP; /* What else could we do? */ - } - break; - case ZT_EVENT_OVERRUN: - { - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "HDLC frame overrun (ZT_EVENT_OVERRUN)\n"); - *event_id = FTDM_OOB_NOOP; /* What else could we do? */ - } - break; - case ZT_EVENT_ABORT: - { - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "HDLC abort frame received (ZT_EVENT_ABORT)\n"); - *event_id = FTDM_OOB_NOOP; /* What else could we do? */ - } - break; - case ZT_EVENT_POLARITY: - { - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Got polarity reverse (ZT_EVENT_POLARITY)\n"); - *event_id = FTDM_OOB_POLARITY_REVERSE; - } - break; - case ZT_EVENT_NONE: - { - ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "No event\n"); - *event_id = FTDM_OOB_NOOP; - } - break; - default: - { - if (handle_dtmf_event(fchan, zt_event_id)) { - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Unhandled event %d\n", zt_event_id); - *event_id = FTDM_OOB_INVALID; - } else { - *event_id = FTDM_OOB_NOOP; - } - } - break; - } - return FTDM_SUCCESS; -} - -/** - * \brief Retrieves an event from a ftdm channel - * \param ftdmchan Channel to retrieve event from - * \param event FreeTDM event to return - * \return Success or failure - */ -FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) -{ - uint32_t event_id = FTDM_OOB_INVALID; - zt_event_t zt_event_id = 0; - ftdm_span_t *span = ftdmchan->span; - - if (ftdm_test_io_flag(ftdmchan, FTDM_CHANNEL_IO_EVENT)) { - ftdm_clear_io_flag(ftdmchan, FTDM_CHANNEL_IO_EVENT); - } - - if (ftdmchan->io_data) { - zt_event_id = (zt_event_t)ftdmchan->io_data; - ftdmchan->io_data = NULL; - } else if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event from channel: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - - /* the core already locked the channel for us, so it's safe to call zt_channel_process_event() here */ - if ((zt_channel_process_event(ftdmchan, &event_id, zt_event_id)) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to process DAHDI event %d from channel\n", zt_event_id); - return FTDM_FAIL; - } - - ftdmchan->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = ftdmchan; - *event = &span->event_header; - return FTDM_SUCCESS; -} - -/** - * \brief Retrieves an event from a Zaptel/DAHDI span - * \param span Span to retrieve event from - * \param event FreeTDM event to return - * \return Success or failure - */ -FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) -{ - uint32_t i, event_id = FTDM_OOB_INVALID; - zt_event_t zt_event_id = 0; - - for (i = 1; i <= span->chan_count; i++) { - ftdm_channel_t *fchan = span->channels[i]; - - ftdm_channel_lock(fchan); - - if (!ftdm_test_io_flag(fchan, FTDM_CHANNEL_IO_EVENT)) { - - ftdm_channel_unlock(fchan); - - continue; - } - - ftdm_clear_io_flag(fchan, FTDM_CHANNEL_IO_EVENT); - - if (fchan->io_data) { - zt_event_id = (zt_event_t)fchan->io_data; - fchan->io_data = NULL; - } else if (ioctl(fchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "Failed to retrieve DAHDI event from channel: %s\n", strerror(errno)); - - ftdm_channel_unlock(fchan); - - continue; - } - - if ((zt_channel_process_event(fchan, &event_id, zt_event_id)) != FTDM_SUCCESS) { - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "Failed to process DAHDI event %d from channel\n", zt_event_id); - - ftdm_channel_unlock(fchan); - - return FTDM_FAIL; - } - - fchan->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = fchan; - *event = &span->event_header; - - ftdm_channel_unlock(fchan); - - return FTDM_SUCCESS; - } - - return FTDM_FAIL; -} - -/** - * \brief Reads data from a Zaptel/DAHDI channel - * \param ftdmchan Channel to read from - * \param data Data buffer - * \param datalen Size of data buffer - * \return Success, failure or timeout - */ -static FIO_READ_FUNCTION(zt_read) -{ - ftdm_ssize_t r = 0; - int read_errno = 0; - int errs = 0; - - while (errs++ < 30) { - r = read(ftdmchan->sockfd, data, *datalen); - if (r > 0) { - /* successful read, bail out now ... */ - break; - } - - /* Timeout ... retry after a bit */ - if (r == 0) { - ftdm_sleep(10); - if (errs) errs--; - continue; - } - - /* This gotta be an error, save errno in case we do printf(), ioctl() or other operations which may reset it */ - read_errno = errno; - if (read_errno == EAGAIN || read_errno == EINTR) { - /* Reasonable to retry under those errors */ - continue; - } - - /* When ELAST is returned, it means DAHDI has an out of band event ready and we won't be able to read anything until - * we retrieve the event using an ioctl(), so we try to retrieve it here ... */ - if (read_errno == ELAST) { - zt_event_t zt_event_id = 0; - if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event after ELAST on read: %s\n", strerror(errno)); - r = -1; - break; - } - - if (handle_dtmf_event(ftdmchan, zt_event_id)) { - /* Enqueue this event for later */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Deferring event %d to be able to read data\n", zt_event_id); - ftdm_zt_store_chan_event(ftdmchan, zt_event_id); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Skipping one IO read cycle due to DTMF event processing\n"); - } - break; - } - - /* Read error, keep going unless to many errors force us to abort ...*/ - ftdm_log(FTDM_LOG_ERROR, "IO read failed: %s\n", strerror(read_errno)); - } - - if (r > 0) { - *datalen = r; - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - *datalen -= 2; - } - return FTDM_SUCCESS; - } - else if (read_errno == ELAST) { - return FTDM_SUCCESS; - } - return r == 0 ? FTDM_TIMEOUT : FTDM_FAIL; -} - -/** - * \brief Writes data to a Zaptel/DAHDI channel - * \param ftdmchan Channel to write to - * \param data Data buffer - * \param datalen Size of data buffer - * \return Success or failure - */ -static FIO_WRITE_FUNCTION(zt_write) -{ - ftdm_ssize_t w = 0; - ftdm_size_t bytes = *datalen; - - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - memset(data+bytes, 0, 2); - bytes += 2; - } - -tryagain: - w = write(ftdmchan->sockfd, data, bytes); - - if (w >= 0) { - *datalen = w; - return FTDM_SUCCESS; - } - - if (errno == ELAST) { - zt_event_t zt_event_id = 0; - if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event after ELAST on write: %s\n", strerror(errno)); - return FTDM_FAIL; - } - - if (handle_dtmf_event(ftdmchan, zt_event_id)) { - /* Enqueue this event for later */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Deferring event %d to be able to write data\n", zt_event_id); - ftdm_zt_store_chan_event(ftdmchan, zt_event_id); - } - - goto tryagain; - } - - return FTDM_FAIL; -} - -/** - * \brief Destroys a Zaptel/DAHDI Channel - * \param ftdmchan Channel to destroy - * \return Success - */ -static FIO_CHANNEL_DESTROY_FUNCTION(zt_channel_destroy) -{ - close(ftdmchan->sockfd); - ftdmchan->sockfd = ZT_INVALID_SOCKET; - return FTDM_SUCCESS; -} - -/** - * \brief Global FreeTDM IO interface for Zaptel/DAHDI - */ -static ftdm_io_interface_t zt_interface; - -/** - * \brief Loads Zaptel/DAHDI IO module - * \param fio FreeTDM IO interface - * \return Success or failure - */ -static FIO_IO_LOAD_FUNCTION(zt_init) -{ - assert(fio != NULL); - struct stat statbuf; - memset(&zt_interface, 0, sizeof(zt_interface)); - memset(&zt_globals, 0, sizeof(zt_globals)); - - if (!stat(zt_ctlpath, &statbuf)) { - ftdm_log(FTDM_LOG_NOTICE, "Using Zaptel control device\n"); - ctlpath = zt_ctlpath; - chanpath = zt_chanpath; - memcpy(&codes, &zt_ioctl_codes, sizeof(codes)); - } else if (!stat(dahdi_ctlpath, &statbuf)) { - ftdm_log(FTDM_LOG_NOTICE, "Using DAHDI control device\n"); - ctlpath = dahdi_ctlpath; - chanpath = dahdi_chanpath; - memcpy(&codes, &dahdi_ioctl_codes, sizeof(codes)); - } else { - ftdm_log(FTDM_LOG_ERROR, "No DAHDI or Zap control device found in /dev/\n"); - return FTDM_FAIL; - } - if ((CONTROL_FD = open(ctlpath, O_RDWR)) < 0) { - ftdm_log(FTDM_LOG_ERROR, "Cannot open control device %s: %s\n", ctlpath, strerror(errno)); - return FTDM_FAIL; - } - - zt_globals.codec_ms = 20; - zt_globals.wink_ms = 150; - zt_globals.flash_ms = 750; - zt_globals.eclevel = 0; - zt_globals.etlevel = 0; - - zt_interface.name = "zt"; - zt_interface.configure = zt_configure; - zt_interface.configure_span = zt_configure_span; - zt_interface.open = zt_open; - zt_interface.close = zt_close; - zt_interface.command = zt_command; - zt_interface.wait = zt_wait; - zt_interface.read = zt_read; - zt_interface.write = zt_write; - zt_interface.poll_event = zt_poll_event; - zt_interface.next_event = zt_next_event; - zt_interface.channel_next_event = zt_channel_next_event; - zt_interface.channel_destroy = zt_channel_destroy; - zt_interface.get_alarms = zt_get_alarms; - *fio = &zt_interface; - - return FTDM_SUCCESS; -} - -/** - * \brief Unloads Zaptel/DAHDI IO module - * \return Success - */ -static FIO_IO_UNLOAD_FUNCTION(zt_destroy) -{ - close(CONTROL_FD); - memset(&zt_interface, 0, sizeof(zt_interface)); - return FTDM_SUCCESS; -} - -/** - * \brief FreeTDM Zaptel/DAHDI IO module definition - */ -ftdm_module_t ftdm_module = { - "zt", - zt_init, - zt_destroy, -}; - -/* 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/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h deleted file mode 100644 index 99c7ef451f..0000000000 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * W McRoberts - * - */ - -#ifndef FTDM_ZT_H -#define FTDM_ZT_H -#include "freetdm.h" -#include -#include - -#ifdef __sun -#include -#include -#include -#endif - -/* Hardware interface structures and defines */ -/* Based on documentation of the structures required for the hardware interface */ -/* from http://wiki.freeswitch.org/wiki/Zapata_ftdmtel_interface */ - -/* Structures */ - -/* Used with ioctl: ZT_GET_PARAMS and ZT_SET_PARAMS */ -struct zt_params { - int chan_no; /* Channel Number */ - int span_no; /* Span Number */ - int chan_position; /* Channel Position */ - int sig_type; /* Signal Type (read-only) */ - int sig_cap; /* Signal Cap (read-only) */ - int receive_offhook; /* Receive is offhook (read-only) */ - int receive_bits; /* Number of bits in receive (read-only) */ - int transmit_bits; /* Number of bits in transmit (read-only) */ - int transmit_hook_sig; /* Transmit Hook Signal (read-only) */ - int receive_hook_sig; /* Receive Hook Signal (read-only) */ - int g711_type; /* Member of zt_g711_t (read-only) */ - int idlebits; /* bits for the idle state (read-only) */ - char chan_name[40]; /* Channel Name */ - int prewink_time; - int preflash_time; - int wink_time; - int flash_time; - int start_time; - int receive_wink_time; - int receive_flash_time; - int debounce_time; - int pulse_break_time; - int pulse_make_time; - int pulse_after_time; - /* latest version of this struct include chan_alarms field */ - uint32_t chan_alarms; -}; - -typedef struct zt_params zt_params_t; - -/* Used with ioctl: ZT_CONFLINK, ZT_GETCONF and ZT_SETCONF */ -struct zt_confinfo { - int chan_no; /* Channel Number, 0 for current */ - int conference_number; - int conference_mode; -}; - -/* Used with ioctl: ZT_GETGAINS and ZT_SETGAINS */ -struct zt_gains { - int chan_no; /* Channel Number, 0 for current */ - unsigned char receive_gain[256]; /* Receive gain table */ - unsigned char transmit_gain[256]; /* Transmit gain table */ -}; - -/* Used with ioctl: ZT_SPANSTAT */ -struct zt_spaninfo { - int span_no; /* span number (-1 to use name) */ - char name[20]; /* Name of span */ - char description[40]; /* Description of span */ - int alarms; /* alarms status */ - int transmit_level; /* Transmit level */ - int receive_level; /* Receive level */ - int bpv_count; /* Current BPV count */ - int crc4_count; /* Current CRC4 error count */ - int ebit_count; /* Current E-bit error count */ - int fas_count; /* Current FAS error count */ - int irq_misses; /* Current IRQ misses */ - int sync_src; /* Span # of sync source (0 = free run) */ - int configured_chan_count; /* Count of channels configured on the span */ - int channel_count; /* Total count of channels on the span */ - int span_count; /* Total count of ftdmtel spans on the system*/ - /* end v1 of the struct */ - /* as long as we don't use the fields below we should be ok regardless of the ftdmtel/dahdi version */ - int lbo; /* Line Build Out */ - int lineconfig; /* framing/coding */ - /* end of v2 of the struct */ - char lboname[40]; /* Line Build Out in text form */ - char location[40]; /* span's device location in system */ - char manufacturer[40]; /* manufacturer of span's device */ - char devicetype[40]; /* span's device type */ - int irq; /* span's device IRQ */ - int linecompat; /* signaling modes possible on this span */ - char spantype[6]; /* type of span in text form */ -}; - -struct zt_maintinfo { - int span_no; /* span number */ - int command; /* Maintenance mode to set (from zt_maintenance_mode_t) */ -}; - -struct zt_lineconfig { -/* Used in ZT_SPANCONFIG */ - int span; /* Which span number (0 to use name) */ - char name[20]; /* Name of span to use */ - int lbo; /* line build-outs */ - int lineconfig; /* line config parameters (framing, coding) */ - int sync; /* what level of sync source we are */ -}; - -struct zt_chanconfig { -/* Used in ZT_CHANCONFIG */ - int chan; /* Channel we're applying this to (0 to use name) */ - char name[40]; /* Name of channel to use */ - int sigtype; /* Signal type */ - int deflaw; /* Default law (ZT_LAW_DEFAULT, ZT_LAW_MULAW, or ZT_LAW_ALAW */ - int master; /* Master channel if sigtype is ZT_SLAVE */ - int idlebits; /* Idle bits (if this is a CAS channel) or channel to monitor (if this is DACS channel) */ - char netdev_name[16]; /* name for the hdlc network device */ -}; - -struct zt_bufferinfo { -/* used in ZT_SET_BUFINFO and ZT_GET_BUFINFO */ - int txbufpolicy; /* Policy for handling receive buffers */ - int rxbufpolicy; /* Policy for handling receive buffers */ - int numbufs; /* How many buffers to use */ - int bufsize; /* How big each buffer is */ - int readbufs; /* How many read buffers are full (read-only) */ - int writebufs; /* How many write buffers are full (read-only) */ -}; - -/* Enumerations */ - -/* Values in zt_params structure for member g711_type */ -typedef enum { - ZT_G711_DEFAULT = 0, /* Default mulaw/alaw from the span */ - ZT_G711_MULAW = 1, - ZT_G711_ALAW = 2 -} zt_g711_t; - -typedef enum { - ZT_EVENT_NONE = 0, - ZT_EVENT_ONHOOK = 1, - ZT_EVENT_RINGOFFHOOK = 2, - ZT_EVENT_WINKFLASH = 3, - ZT_EVENT_ALARM = 4, - ZT_EVENT_NOALARM = 5, - ZT_EVENT_ABORT = 6, - ZT_EVENT_OVERRUN = 7, - ZT_EVENT_BADFCS = 8, - ZT_EVENT_DIALCOMPLETE = 9, - ZT_EVENT_RINGERON = 10, - ZT_EVENT_RINGEROFF = 11, - ZT_EVENT_HOOKCOMPLETE = 12, - ZT_EVENT_BITSCHANGED = 13, - ZT_EVENT_PULSE_START = 14, - ZT_EVENT_TIMER_EXPIRED = 15, - ZT_EVENT_TIMER_PING = 16, - ZT_EVENT_POLARITY = 17, - ZT_EVENT_RINGBEGIN = 18, - ZT_EVENT_DTMFDOWN = (1 << 17), - ZT_EVENT_DTMFUP = (1 << 18), -} zt_event_t; - -typedef enum { - ZT_FLUSH_READ = 1, - ZT_FLUSH_WRITE = 2, - ZT_FLUSH_BOTH = (ZT_FLUSH_READ | ZT_FLUSH_WRITE), - ZT_FLUSH_EVENT = 4, - ZT_FLUSH_ALL = (ZT_FLUSH_READ | ZT_FLUSH_WRITE | ZT_FLUSH_EVENT) -} zt_flush_t; - -typedef enum { - ZT_IOMUX_READ = 1, - ZT_IOMUX_WRITE = 2, - ZT_IOMUX_WRITEEMPTY = 4, - ZT_IOMUX_SIGEVENT = 8, - ZT_IOMUX_NOWAIT = 256 -} zt_iomux_t; - -typedef enum { - ZT_ONHOOK = 0, - ZT_OFFHOOK = 1, - ZT_WINK = 2, - ZT_FLASH = 3, - ZT_START = 4, - ZT_RING = 5, - ZT_RINGOFF = 6 -} zt_hookstate_t; - -typedef enum { - ZT_MAINT_NONE = 0, /* Normal Mode */ - ZT_MAINT_LOCALLOOP = 1, /* Local Loopback */ - ZT_MAINT_REMOTELOOP = 2, /* Remote Loopback */ - ZT_MAINT_LOOPUP = 3, /* Send Loopup Code */ - ZT_MAINT_LOOPDOWN = 4, /* Send Loopdown Code */ - ZT_MAINT_LOOPSTOP = 5 /* Stop Sending Loop Codes */ -} zt_maintenance_mode_t; - -typedef enum { -/* Signalling type */ -ZT_SIG_NONE = 0, /* chan not configured. */ - -ZT_SIG_FXSLS = ((1 << 0) | (1 << 13)), /* FXS, Loopstart */ -ZT_SIG_FXSGS = ((1 << 1) | (1 << 13)), /* FXS, Groundstart */ -ZT_SIG_FXSKS = ((1 << 2) | (1 << 13)), /* FXS, Kewlstart */ -ZT_SIG_FXOLS = ((1 << 3) | (1 << 12)), /* FXO, Loopstart */ -ZT_SIG_FXOGS = ((1 << 4) | (1 << 12)), /* FXO, Groupstart */ -ZT_SIG_FXOKS = ((1 << 5) | (1 << 12)), /* FXO, Kewlstart */ -ZT_SIG_EM = (1 << 6), /* E&M */ -ZT_SIG_CLEAR = (1 << 7), -ZT_SIG_HDLCRAW = ((1 << 8) | ZT_SIG_CLEAR), -ZT_SIG_HDLCFCS = ((1 << 9) | ZT_SIG_HDLCRAW), -ZT_SIG_CAS = (1 << 15), -ZT_SIG_HARDHDLC = ((1 << 19) | ZT_SIG_CLEAR), -} zt_sigtype_t; - -typedef enum { -ZT_DBIT = 1, -ZT_CBIT = 2, -ZT_BBIT = 4, -ZT_ABIT = 8 -} zt_cas_bit_t; - -typedef enum { -/* Tone Detection */ -ZT_TONEDETECT_ON = (1 << 0), /* Detect tones */ -ZT_TONEDETECT_MUTE = (1 << 1) /* Mute audio in received channel */ -} zt_tone_mode_t; - -/* Defines */ - -#define ZT_MAX_BLOCKSIZE 8192 -#define ZT_DEFAULT_MTU_MRU 2048 - -/* ioctl defines */ - -#define ZT_CODE 'J' -#define DAHDI_CODE 0xDA - - -#define ZT_GET_BLOCKSIZE _IOR (ZT_CODE, 1, int) /* Get Transfer Block Size. */ -#define ZT_SET_BLOCKSIZE _IOW (ZT_CODE, 2, int) /* Set Transfer Block Size. */ -#define ZT_FLUSH _IOW (ZT_CODE, 3, int) /* Flush Buffer(s) and stop I/O */ -#define ZT_SYNC _IOW (ZT_CODE, 4, int) /* Wait for Write to Finish */ -#define ZT_GET_PARAMS _IOR (ZT_CODE, 5, struct zt_params) /* Get channel parameters */ -#define ZT_SET_PARAMS _IOW (ZT_CODE, 6, struct zt_params) /* Set channel parameters */ -#define ZT_HOOK _IOW (ZT_CODE, 7, int) /* Set Hookswitch Status */ -#define ZT_GETEVENT _IOR (ZT_CODE, 8, int) /* Get Signalling Event */ -#define ZT_IOMUX _IOWR (ZT_CODE, 9, int) /* Wait for something to happen (IO Mux) */ -#define ZT_SPANSTAT _IOWR (ZT_CODE, 10, struct zt_spaninfo) /* Get Span Status */ -#define ZT_MAINT _IOW (ZT_CODE, 11, struct zt_maintinfo)/* Set Maintenance Mode for a span */ -#define ZT_GETCONF _IOWR (ZT_CODE, 12, struct zt_confinfo) /* Get Conference Mode */ -#define ZT_SETCONF _IOWR (ZT_CODE, 13, struct zt_confinfo) /* Set Conference Mode */ -#define ZT_CONFLINK _IOW (ZT_CODE, 14, struct zt_confinfo) /* Setup or Remove Conference Link */ -#define ZT_CONFDIAG _IOR (ZT_CODE, 15, int) /* Display Conference Diagnostic Information on Console */ - -#define ZT_GETGAINS _IOWR (ZT_CODE, 16, struct zt_gains) /* Get Channel audio gains */ -#define ZT_SETGAINS _IOWR (ZT_CODE, 17, struct zt_gains) /* Set Channel audio gains */ -#define ZT_SPANCONFIG _IOW (ZT_CODE, 18, struct zt_lineconfig)/* Set Line (T1) Configurations and start system */ -#define ZT_CHANCONFIG _IOW (ZT_CODE, 19, struct zt_chanconfig)/* Set Channel Configuration */ -#define ZT_SET_BUFINFO _IOW (ZT_CODE, 27, struct zt_bufferinfo)/* Set buffer policy */ -#define ZT_GET_BUFINFO _IOR (ZT_CODE, 28, struct zt_bufferinfo)/* Get current buffer info */ -#define ZT_AUDIOMODE _IOW (ZT_CODE, 32, int) /* Set a clear channel into audio mode */ -#define ZT_ECHOCANCEL _IOW (ZT_CODE, 33, int) /* Control Echo Canceller */ -#define ZT_HDLCRAWMODE _IOW (ZT_CODE, 36, int) /* Set a clear channel into HDLC w/out FCS checking/calculation mode */ -#define ZT_HDLCFCSMODE _IOW (ZT_CODE, 37, int) /* Set a clear channel into HDLC w/ FCS mode */ - -/* Specify a channel on /dev/ftdm/chan -- must be done before any other ioctl's and is only valid on /dev/ftdm/chan */ -#define ZT_SPECIFY _IOW (ZT_CODE, 38, int) - -/* Temporarily set the law on a channel to ZT_LAW_DEFAULT, ZT_LAW_ALAW, or ZT_LAW_MULAW. Is reset on close. */ -#define ZT_SETLAW _IOW (ZT_CODE, 39, int) - -/* Temporarily set the channel to operate in linear mode when non-zero or default law if 0 */ -#define ZT_SETLINEAR _IOW (ZT_CODE, 40, int) - -#define ZT_GETCONFMUTE _IOR (ZT_CODE, 49, int) /* Get Conference to mute mode */ -#define ZT_ECHOTRAIN _IOW (ZT_CODE, 50, int) /* Control Echo Trainer */ - -/* Set/Get CAS bits */ -#define ZT_SETTXBITS _IOW (ZT_CODE, 43, int) -#define ZT_GETRXBITS _IOR (ZT_CODE, 45, int) - -/* - * Enable tone detection -- implemented by low level driver - */ -#define ZT_TONEDETECT _IOW(ZT_CODE, 91, int) - -#define DAHDI_GET_BLOCKSIZE _IOR (DAHDI_CODE, 1, int) /* Get Transfer Block Size. */ -#define DAHDI_SET_BLOCKSIZE _IOW (DAHDI_CODE, 1, int) /* Set Transfer Block Size. */ -#define DAHDI_FLUSH _IOW (DAHDI_CODE, 3, int) /* Flush Buffer(s) and stop I/O */ -#define DAHDI_SYNC _IO (DAHDI_CODE, 4) /* Wait for Write to Finish */ -#define DAHDI_GET_PARAMS _IOR (DAHDI_CODE, 5, struct zt_params) /* Get channel parameters */ -#define DAHDI_SET_PARAMS _IOW (DAHDI_CODE, 5, struct zt_params) /* Set channel parameters */ -#define DAHDI_HOOK _IOW (DAHDI_CODE, 7, int) /* Set Hookswitch Status */ -#define DAHDI_GETEVENT _IOR (DAHDI_CODE, 8, int) /* Get Signalling Event */ -#define DAHDI_IOMUX _IOWR (DAHDI_CODE, 9, int) /* Wait for something to happen (IO Mux) */ -#define DAHDI_SPANSTAT _IOWR (DAHDI_CODE, 10, struct zt_spaninfo) /* Get Span Status */ -#define DAHDI_MAINT _IOW (DAHDI_CODE, 11, struct zt_maintinfo) /* Set Maintenance Mode for a span */ -#define DAHDI_GETCONF _IOR (DAHDI_CODE, 12, struct zt_confinfo) /* Get Conference Mode */ -#define DAHDI_SETCONF _IOW (DAHDI_CODE, 12, struct zt_confinfo) /* Set Conference Mode */ -#define DAHDI_CONFLINK _IOW (DAHDI_CODE, 14, struct zt_confinfo) /* Setup or Remove Conference Link */ -#define DAHDI_CONFDIAG _IOR (DAHDI_CODE, 15, int) /* Display Conference Diagnostic Information on Console */ - -#define DAHDI_GETGAINS _IOR (DAHDI_CODE, 16, struct zt_gains) /* Get Channel audio gains */ -#define DAHDI_SETGAINS _IOW (DAHDI_CODE, 16, struct zt_gains) /* Set Channel audio gains */ -#define DAHDI_SPANCONFIG _IOW (DAHDI_CODE, 18, struct zt_lineconfig)/* Set Line (T1) Configurations and start system */ -#define DAHDI_CHANCONFIG _IOW (DAHDI_CODE, 19, struct zt_chanconfig)/* Set Channel Configuration */ -#define DAHDI_SET_BUFINFO _IOW (DAHDI_CODE, 27, struct zt_bufferinfo)/* Set buffer policy */ -#define DAHDI_GET_BUFINFO _IOR (DAHDI_CODE, 27, struct zt_bufferinfo)/* Get current buffer info */ -#define DAHDI_AUDIOMODE _IOW (DAHDI_CODE, 32, int) /* Set a clear channel into audio mode */ -#define DAHDI_ECHOCANCEL _IOW (DAHDI_CODE, 33, int) /* Control Echo Canceller */ -#define DAHDI_HDLCRAWMODE _IOW (DAHDI_CODE, 36, int) /* Set a clear channel into HDLC w/out FCS checking/calculation mode */ -#define DAHDI_HDLCFCSMODE _IOW (DAHDI_CODE, 37, int) /* Set a clear channel into HDLC w/ FCS mode */ - -/* Dahdi channel alarms */ -#define DAHDI_ALARM_YELLOW (1 << 2) /* Yellow Alarm */ -#define DAHDI_ALARM_BLUE (1 << 4) /* Blue Alarm */ - -/* Specify a channel on /dev/dahdi/chan -- must be done before any other ioctl's and is only valid on /dev/dahdi/chan */ -#define DAHDI_SPECIFY _IOW (DAHDI_CODE, 38, int) - -/* Temporarily set the law on a channel to DAHDI_LAW_DEFAULT, DAHDI_LAW_ALAW, or DAHDI_LAW_MULAW. Is reset on close. */ -#define DAHDI_SETLAW _IOW (DAHDI_CODE, 39, int) - -/* Temporarily set the channel to operate in linear mode when non-zero or default law if 0 */ -#define DAHDI_SETLINEAR _IOW (DAHDI_CODE, 40, int) - -#define DAHDI_GETCONFMUTE _IOR (DAHDI_CODE, 49, int) /* Get Conference to mute mode */ -#define DAHDI_ECHOTRAIN _IOW (DAHDI_CODE, 50, int) /* Control Echo Trainer */ - -/* Set/Get CAS bits */ -#define DAHDI_SETTXBITS _IOW (DAHDI_CODE, 43, int) -#define DAHDI_GETRXBITS _IOR (DAHDI_CODE, 43, int) - -#define DAHDI_SETPOLARITY _IOW (DAHDI_CODE, 92, int) /* Polarity setting for FXO lines */ - -/* - * Enable tone detection -- implemented by low level driver - */ -#define DAHDI_TONEDETECT _IOW(DAHDI_CODE, 91, int) - -#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/freetdm/src/g711.c b/libs/freetdm/src/g711.c deleted file mode 100644 index e113db5811..0000000000 --- a/libs/freetdm/src/g711.c +++ /dev/null @@ -1,104 +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. - * - * $Id: g711.c,v 1.1 2006/06/07 15:46:39 steveu Exp $ - */ - -/*! \file */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#ifndef _MSC_VER -#include -#ifdef HAVE_TGMATH_H -#include -#endif -#endif - -#include "g711.h" - -/* Copied from the CCITT G.711 specification */ -static const uint8_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 uint8_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 - }; - -uint8_t alaw_to_ulaw(uint8_t alaw) -{ - return alaw_to_ulaw_table[alaw]; -} -/*- End of function --------------------------------------------------------*/ - -uint8_t ulaw_to_alaw(uint8_t ulaw) -{ - return ulaw_to_alaw_table[ulaw]; -} -/*- End of function --------------------------------------------------------*/ -/*- End of file ------------------------------------------------------------*/ - -/* 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/freetdm/src/hashtable.c b/libs/freetdm/src/hashtable.c deleted file mode 100644 index 4b39e8599a..0000000000 --- a/libs/freetdm/src/hashtable.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (c) 2002, Christopher Clark - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "private/ftdm_core.h" -#include "hashtable.h" -#include "hashtable_private.h" -#include -#include -#include -#include - -/* - Credit for primes table: Aaron Krowne - http://br.endernet.org/~akrowne/ - http://planetmath.org/encyclopedia/GoodHashTablePrimes.html -*/ -static const unsigned int primes[] = { - 53, 97, 193, 389, - 769, 1543, 3079, 6151, - 12289, 24593, 49157, 98317, - 196613, 393241, 786433, 1572869, - 3145739, 6291469, 12582917, 25165843, - 50331653, 100663319, 201326611, 402653189, - 805306457, 1610612741 -}; -const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]); -const float max_load_factor = 0.65f; - -/*****************************************************************************/ -FT_DECLARE(struct hashtable *) -create_hashtable(unsigned int minsize, - unsigned int (*hashf) (void*), - int (*eqf) (void*,void*)) -{ - struct hashtable *h; - unsigned int pindex, size = primes[0]; - /* Check requested hashtable isn't too large */ - if (minsize > (1u << 30)) return NULL; - /* Enforce size as prime */ - for (pindex=0; pindex < prime_table_length; pindex++) { - if (primes[pindex] > minsize) { size = primes[pindex]; break; } - } - h = (struct hashtable *)ftdm_malloc(sizeof(struct hashtable)); - if (NULL == h) return NULL; /*oom*/ - h->table = (struct entry **)ftdm_malloc(sizeof(struct entry*) * size); - if (NULL == h->table) { ftdm_safe_free(h); return NULL; } /*oom*/ - memset(h->table, 0, size * sizeof(struct entry *)); - h->tablelength = size; - h->primeindex = pindex; - h->entrycount = 0; - h->hashfn = hashf; - h->eqfn = eqf; - h->loadlimit = (unsigned int) ceil(size * max_load_factor); - return h; -} - -/*****************************************************************************/ -unsigned int -hash(struct hashtable *h, void *k) -{ - /* Aim to protect against poor hash functions by adding logic here - * - logic taken from java 1.4 hashtable source */ - unsigned int i = h->hashfn(k); - i += ~(i << 9); - i ^= ((i >> 14) | (i << 18)); /* >>> */ - i += (i << 4); - i ^= ((i >> 10) | (i << 22)); /* >>> */ - return i; -} - -/*****************************************************************************/ -static int -hashtable_expand(struct hashtable *h) -{ - /* Double the size of the table to accomodate more entries */ - struct entry **newtable; - struct entry *e; - struct entry **pE; - unsigned int newsize, i, index; - /* Check we're not hitting max capacity */ - if (h->primeindex == (prime_table_length - 1)) return 0; - newsize = primes[++(h->primeindex)]; - - newtable = (struct entry **)ftdm_malloc(sizeof(struct entry*) * newsize); - if (NULL != newtable) - { - memset(newtable, 0, newsize * sizeof(struct entry *)); - /* This algorithm is not 'stable'. ie. it reverses the list - * when it transfers entries between the tables */ - for (i = 0; i < h->tablelength; i++) { - while (NULL != (e = h->table[i])) { - h->table[i] = e->next; - index = indexFor(newsize,e->h); - e->next = newtable[index]; - newtable[index] = e; - } - } - ftdm_safe_free(h->table); - h->table = newtable; - } - /* Plan B: realloc instead */ - else - { - newtable = (struct entry **) - realloc(h->table, newsize * sizeof(struct entry *)); - if (NULL == newtable) { (h->primeindex)--; return 0; } - h->table = newtable; - memset(newtable[h->tablelength], 0, newsize - h->tablelength); - for (i = 0; i < h->tablelength; i++) { - for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) { - index = indexFor(newsize,e->h); - if (index == i) - { - pE = &(e->next); - } - else - { - *pE = e->next; - e->next = newtable[index]; - newtable[index] = e; - } - } - } - } - h->tablelength = newsize; - h->loadlimit = (unsigned int) ceil(newsize * max_load_factor); - return -1; -} - -/*****************************************************************************/ -FT_DECLARE(unsigned int) -hashtable_count(struct hashtable *h) -{ - return h->entrycount; -} - -/*****************************************************************************/ -FT_DECLARE(int) -hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags) -{ - /* This method allows duplicate keys - but they shouldn't be used */ - unsigned int index; - struct entry *e; - if (++(h->entrycount) > h->loadlimit) - { - /* Ignore the return value. If expand fails, we should - * still try cramming just this value into the existing table - * -- we may not have memory for a larger table, but one more - * element may be ok. Next time we insert, we'll try expanding again.*/ - hashtable_expand(h); - } - e = (struct entry *)ftdm_malloc(sizeof(struct entry)); - if (NULL == e) { --(h->entrycount); return 0; } /*oom*/ - e->h = hash(h,k); - index = indexFor(h->tablelength,e->h); - e->k = k; - e->v = v; - e->flags = flags; - e->next = h->table[index]; - h->table[index] = e; - return -1; -} - -/*****************************************************************************/ -FT_DECLARE(void *) /* returns value associated with key */ -hashtable_search(struct hashtable *h, void *k) -{ - struct entry *e; - unsigned int hashvalue, index; - hashvalue = hash(h,k); - index = indexFor(h->tablelength,hashvalue); - e = h->table[index]; - while (NULL != e) - { - /* Check hash value to short circuit heavier comparison */ - if ((hashvalue == e->h) && (h->eqfn(k, e->k))) return e->v; - e = e->next; - } - return NULL; -} - -/*****************************************************************************/ -FT_DECLARE(void *) /* returns value associated with key */ -hashtable_remove(struct hashtable *h, void *k) -{ - /* TODO: consider compacting the table when the load factor drops enough, - * or provide a 'compact' method. */ - - struct entry *e; - struct entry **pE; - void *v; - unsigned int hashvalue, index; - - hashvalue = hash(h,k); - index = indexFor(h->tablelength,hash(h,k)); - pE = &(h->table[index]); - e = *pE; - while (NULL != e) - { - /* Check hash value to short circuit heavier comparison */ - if ((hashvalue == e->h) && (h->eqfn(k, e->k))) - { - *pE = e->next; - h->entrycount--; - v = e->v; - if (e->flags & HASHTABLE_FLAG_FREE_KEY) { - freekey(e->k); - } - ftdm_safe_free(e); - return v; - } - pE = &(e->next); - e = e->next; - } - return NULL; -} - -/*****************************************************************************/ -/* destroy */ -FT_DECLARE(void) -hashtable_destroy(struct hashtable *h) -{ - unsigned int i; - struct entry *e, *f; - struct entry **table = h->table; - - for (i = 0; i < h->tablelength; i++) - { - e = table[i]; - while (NULL != e) - { f = e; e = e->next; if (f->flags & HASHTABLE_FLAG_FREE_KEY) freekey(f->k); if (f->flags & HASHTABLE_FLAG_FREE_VALUE) ftdm_safe_free(f->v); ftdm_safe_free(f); } - } - - ftdm_safe_free(h->table); - ftdm_safe_free(h); -} - -FT_DECLARE(struct hashtable_iterator *) hashtable_next(struct hashtable_iterator *i) -{ - - if (i->e) { - if ((i->e = i->e->next) != 0) { - return i; - } else { - i->pos++; - } - } - - while(i->pos < i->h->tablelength && !i->h->table[i->pos]) { - i->pos++; - } - - if (i->pos >= i->h->tablelength) { - return NULL; - } - - if ((i->e = i->h->table[i->pos]) != 0) { - return i; - } - - return NULL; -} - -FT_DECLARE(struct hashtable_iterator *) hashtable_first(struct hashtable *h) -{ - h->iterator.pos = 0; - h->iterator.e = NULL; - h->iterator.h = h; - return hashtable_next(&h->iterator); -} - - - -FT_DECLARE(void) hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val) -{ - if (i->e) { - if (key) { - *key = i->e->k; - } - if (klen) { - *klen = (int)strlen(i->e->k); - } - if (val) { - *val = i->e->v; - } - } else { - if (key) { - *key = NULL; - } - if (klen) { - *klen = 0; - } - if (val) { - *val = NULL; - } - } -} - - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ - diff --git a/libs/freetdm/src/hashtable_itr.c b/libs/freetdm/src/hashtable_itr.c deleted file mode 100644 index 113d1ea503..0000000000 --- a/libs/freetdm/src/hashtable_itr.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2002, 2004, Christopher Clark - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "private/ftdm_core.h" -#include "hashtable.h" -#include "hashtable_private.h" -#include "hashtable_itr.h" -#include /* defines NULL */ - -/*****************************************************************************/ -/* hashtable_iterator - iterator constructor */ - -struct hashtable_itr * -hashtable_iterator(struct hashtable *h) -{ - unsigned int i, tablelength; - struct hashtable_itr *itr = ftdm_malloc(sizeof(struct hashtable_itr)); - if (NULL == itr) return NULL; - itr->h = h; - itr->e = NULL; - itr->parent = NULL; - tablelength = h->tablelength; - itr->index = tablelength; - if (0 == h->entrycount) return itr; - - for (i = 0; i < tablelength; i++) - { - if (NULL != h->table[i]) - { - itr->e = h->table[i]; - itr->index = i; - break; - } - } - return itr; -} - -/*****************************************************************************/ -/* advance - advance the iterator to the next element - * returns zero if advanced to end of table */ - -int -hashtable_iterator_advance(struct hashtable_itr *itr) -{ - unsigned int j,tablelength; - struct entry **table; - struct entry *next; - if (NULL == itr->e) return 0; /* stupidity check */ - - next = itr->e->next; - if (NULL != next) - { - itr->parent = itr->e; - itr->e = next; - return -1; - } - tablelength = itr->h->tablelength; - itr->parent = NULL; - if (tablelength <= (j = ++(itr->index))) - { - itr->e = NULL; - return 0; - } - table = itr->h->table; - while (NULL == (next = table[j])) - { - if (++j >= tablelength) - { - itr->index = tablelength; - itr->e = NULL; - return 0; - } - } - itr->index = j; - itr->e = next; - return -1; -} - -/*****************************************************************************/ -/* remove - remove the entry at the current iterator position - * and advance the iterator, if there is a successive - * element. - * If you want the value, read it before you remove: - * beware memory leaks if you don't. - * Returns zero if end of iteration. */ - -int -hashtable_iterator_remove(struct hashtable_itr *itr) -{ - struct entry *remember_e, *remember_parent; - int ret; - - /* Do the removal */ - if (NULL == (itr->parent)) - { - /* element is head of a chain */ - itr->h->table[itr->index] = itr->e->next; - } else { - /* element is mid-chain */ - itr->parent->next = itr->e->next; - } - /* itr->e is now outside the hashtable */ - remember_e = itr->e; - itr->h->entrycount--; - freekey(remember_e->k); - - /* Advance the iterator, correcting the parent */ - remember_parent = itr->parent; - ret = hashtable_iterator_advance(itr); - if (itr->parent == remember_e) { itr->parent = remember_parent; } - ftdm_safe_free(remember_e); - return ret; -} - -/*****************************************************************************/ -int /* returns zero if not found */ -hashtable_iterator_search(struct hashtable_itr *itr, - struct hashtable *h, void *k) -{ - struct entry *e, *parent; - unsigned int hashvalue, index; - - hashvalue = hash(h,k); - index = indexFor(h->tablelength,hashvalue); - - e = h->table[index]; - parent = NULL; - while (NULL != e) - { - /* Check hash value to short circuit heavier comparison */ - if ((hashvalue == e->h) && (h->eqfn(k, e->k))) - { - itr->index = index; - itr->e = e; - itr->parent = parent; - itr->h = h; - return -1; - } - parent = e; - e = e->next; - } - return 0; -} - - -/* 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/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h deleted file mode 100755 index f90744df8d..0000000000 --- a/libs/freetdm/src/include/freetdm.h +++ /dev/null @@ -1,2023 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * David Yat Sin - * - */ - -#ifndef FREETDM_H -#define FREETDM_H - -#include "ftdm_declare.h" -#include "ftdm_call_utils.h" - -/*! \brief Max number of channels per physical span */ -#define FTDM_MAX_CHANNELS_PHYSICAL_SPAN 32 - -/*! \brief Max number of physical spans per logical span */ -#define FTDM_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN 128 - -/*! \brief Max number of channels a logical span can contain */ -#define FTDM_MAX_CHANNELS_SPAN FTDM_MAX_CHANNELS_PHYSICAL_SPAN * FTDM_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN - -/*! \brief Max number of logical spans */ -#define FTDM_MAX_SPANS_INTERFACE 128 - -/*! \brief Max number of channels per hunting group */ -#define FTDM_MAX_CHANNELS_GROUP 2048 - -/*! \brief Max number of groups */ -#define FTDM_MAX_GROUPS_INTERFACE FTDM_MAX_SPANS_INTERFACE - -/*! \brief Max number of key=value pairs to be sent as signaling stack parameters */ -#define FTDM_MAX_SIG_PARAMETERS 30 - -#define FTDM_INVALID_INT_PARM 0xFF - -/*! \brief Thread/Mutex OS abstraction API. */ -#include "ftdm_os.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/*! \brief Limit to span names */ -#define FTDM_MAX_NAME_STR_SZ 128 - -/*! \brief Limit to channel number strings */ -#define FTDM_MAX_NUMBER_STR_SZ 32 - -/*! \brief Hangup cause codes */ -typedef enum { - FTDM_CAUSE_NONE = 0, - FTDM_CAUSE_UNALLOCATED = 1, - FTDM_CAUSE_NO_ROUTE_TRANSIT_NET = 2, - FTDM_CAUSE_NO_ROUTE_DESTINATION = 3, - FTDM_CAUSE_SEND_SPECIAL_INFO_TONE = 4, - FTDM_CAUSE_MISDIALED_TRUNK_PREFIX = 5, - FTDM_CAUSE_CHANNEL_UNACCEPTABLE = 6, - FTDM_CAUSE_CALL_AWARDED_DELIVERED = 7, - FTDM_CAUSE_PREEMPTION = 8, - FTDM_CAUSE_PREEMPTION_CIRCUIT_RESERVED = 9, - FTDM_CAUSE_NORMAL_CLEARING = 16, - FTDM_CAUSE_USER_BUSY = 17, - FTDM_CAUSE_NO_USER_RESPONSE = 18, - FTDM_CAUSE_NO_ANSWER = 19, - FTDM_CAUSE_SUBSCRIBER_ABSENT = 20, - FTDM_CAUSE_CALL_REJECTED = 21, - FTDM_CAUSE_NUMBER_CHANGED = 22, - FTDM_CAUSE_REDIRECTION_TO_NEW_DESTINATION = 23, - FTDM_CAUSE_EXCHANGE_ROUTING_ERROR = 25, - FTDM_CAUSE_DESTINATION_OUT_OF_ORDER = 27, - FTDM_CAUSE_INVALID_NUMBER_FORMAT = 28, - FTDM_CAUSE_FACILITY_REJECTED = 29, - FTDM_CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 30, - FTDM_CAUSE_NORMAL_UNSPECIFIED = 31, - FTDM_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34, - FTDM_CAUSE_NETWORK_OUT_OF_ORDER = 38, - FTDM_CAUSE_PERMANENT_FRAME_MODE_CONNECTION_OOS = 39, - FTDM_CAUSE_PERMANENT_FRAME_MODE_OPERATIONAL = 40, - FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE = 41, - FTDM_CAUSE_SWITCH_CONGESTION = 42, - FTDM_CAUSE_ACCESS_INFO_DISCARDED = 43, - FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL = 44, - FTDM_CAUSE_PRE_EMPTED = 45, - FTDM_CAUSE_PRECEDENCE_CALL_BLOCKED = 46, - FTDM_CAUSE_RESOURCE_UNAVAILABLE_UNSPECIFIED = 47, - FTDM_CAUSE_QOS_NOT_AVAILABLE = 49, - FTDM_CAUSE_FACILITY_NOT_SUBSCRIBED = 50, - FTDM_CAUSE_OUTGOING_CALL_BARRED = 53, - FTDM_CAUSE_INCOMING_CALL_BARRED = 55, - FTDM_CAUSE_BEARERCAPABILITY_NOTAUTH = 57, - FTDM_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58, - FTDM_CAUSE_INCONSISTENCY_IN_INFO = 62, - FTDM_CAUSE_SERVICE_UNAVAILABLE = 63, - FTDM_CAUSE_BEARERCAPABILITY_NOTIMPL = 65, - FTDM_CAUSE_CHAN_NOT_IMPLEMENTED = 66, - FTDM_CAUSE_FACILITY_NOT_IMPLEMENTED = 69, - FTDM_CAUSE_ONLY_DIGITAL_INFO_BC_AVAIL = 70, - FTDM_CAUSE_SERVICE_NOT_IMPLEMENTED = 79, - FTDM_CAUSE_INVALID_CALL_REFERENCE = 81, - FTDM_CAUSE_IDENTIFIED_CHAN_NOT_EXIST = 82, - FTDM_CAUSE_SUSPENDED_CALL_EXISTS_BUT_CALL_ID_DOES_NOT = 83, - FTDM_CAUSE_CALL_ID_IN_USE = 84, - FTDM_CAUSE_NO_CALL_SUSPENDED = 85, - FTDM_CAUSE_CALL_WITH_CALL_ID_CLEARED = 86, - FTDM_CAUSE_USER_NOT_CUG = 87, - FTDM_CAUSE_INCOMPATIBLE_DESTINATION = 88, - FTDM_CAUSE_NON_EXISTENT_CUG = 90, - FTDM_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION = 91, - FTDM_CAUSE_INVALID_MSG_UNSPECIFIED = 95, - FTDM_CAUSE_MANDATORY_IE_MISSING = 96, - FTDM_CAUSE_MESSAGE_TYPE_NONEXIST = 97, - FTDM_CAUSE_WRONG_MESSAGE = 98, - FTDM_CAUSE_IE_NONEXIST = 99, - FTDM_CAUSE_INVALID_IE_CONTENTS = 100, - FTDM_CAUSE_WRONG_CALL_STATE = 101, - FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102, - FTDM_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103, - FTDM_CAUSE_MSG_WITH_UNRECOGNIZED_PARAM_DISCARDED = 110, - FTDM_CAUSE_PROTOCOL_ERROR = 111, - FTDM_CAUSE_INTERWORKING = 127, - FTDM_CAUSE_SUCCESS = 142, - FTDM_CAUSE_ORIGINATOR_CANCEL = 487, - FTDM_CAUSE_CRASH = 500, - FTDM_CAUSE_SYSTEM_SHUTDOWN = 501, - FTDM_CAUSE_LOSE_RACE = 502, - FTDM_CAUSE_MANAGER_REQUEST = 503, - FTDM_CAUSE_BLIND_TRANSFER = 600, - FTDM_CAUSE_ATTENDED_TRANSFER = 601, - FTDM_CAUSE_ALLOTTED_TIMEOUT = 602, - FTDM_CAUSE_USER_CHALLENGE = 603, - FTDM_CAUSE_MEDIA_TIMEOUT = 604 -} ftdm_call_cause_t; - -/*! \brief Hunting direction (when hunting for free channels) */ -typedef enum { - FTDM_HUNT_TOP_DOWN, - FTDM_HUNT_BOTTOM_UP, - FTDM_HUNT_RR_DOWN, - FTDM_HUNT_RR_UP, -} ftdm_hunt_direction_t; - -/*! \brief Legacy Hunting direction (Top down and Bottom up were reversed), keep for source backwards compatibility of freetdm user applications - * \deprecated - * \see ftdm_hunt_direction_t - */ -typedef enum { - FTDM_BOTTOM_UP, - FTDM_TOP_DOWN, - FTDM_RR_UP, - FTDM_RR_DOWN, -} ftdm_direction_t; - -/*! \brief I/O channel type */ -typedef enum { - FTDM_CHAN_TYPE_B, /*!< Bearer channel */ - FTDM_CHAN_TYPE_DQ921, /*!< DQ921 channel (D-channel) */ - FTDM_CHAN_TYPE_DQ931, /*!< DQ931 channel */ - FTDM_CHAN_TYPE_FXS, /*!< FXS analog channel */ - FTDM_CHAN_TYPE_FXO, /*!< FXO analog channel */ - FTDM_CHAN_TYPE_EM, /*!< E & M channel */ - FTDM_CHAN_TYPE_CAS, /*!< CAS channel */ - FTDM_CHAN_TYPE_COUNT /*!< Count of channel types */ -} ftdm_chan_type_t; -#define CHAN_TYPE_STRINGS "B", "DQ921", "DQ931", "FXS", "FXO", "EM", "CAS", "INVALID" -/*! \brief transform from channel type to string and from string to channel type - * ftdm_str2ftdm_chan_type transforms a channel string (ie: "FXO" to FTDM_CHAN_TYPE_FXO) - * ftdm_chan_type2str transforms a channel type to string (ie: FTDM_CHAN_TYPE_B to "B") - */ -FTDM_STR2ENUM_P(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t) - -/*! \brief Test if a channel is a voice channel */ -#define FTDM_IS_VOICE_CHANNEL(fchan) ((fchan)->type != FTDM_CHAN_TYPE_DQ921 && (fchan)->type != FTDM_CHAN_TYPE_DQ931) - -/*! \brief Test if a channel is a D-channel */ -#define FTDM_IS_DCHAN(fchan) ((fchan)->type == FTDM_CHAN_TYPE_DQ921 || (fchan)->type == FTDM_CHAN_TYPE_DQ931) - -/*! \brief Test if a channel is digital channel */ -#define FTDM_IS_DIGITAL_CHANNEL(fchan) ((fchan)->span->trunk_type == FTDM_TRUNK_E1 || \ - (fchan)->span->trunk_type == FTDM_TRUNK_T1 || \ - (fchan)->span->trunk_type == FTDM_TRUNK_J1 || \ - (fchan)->span->trunk_type == FTDM_TRUNK_BRI || \ - (fchan)->span->trunk_type == FTDM_TRUNK_BRI_PTMP) - -/*! \brief Test if a span is digital */ -#define FTDM_SPAN_IS_DIGITAL(span) \ - ((span)->trunk_type == FTDM_TRUNK_E1 || \ - (span)->trunk_type == FTDM_TRUNK_T1 || \ - (span)->trunk_type == FTDM_TRUNK_J1 || \ - (span)->trunk_type == FTDM_TRUNK_GSM || \ - (span)->trunk_type == FTDM_TRUNK_BRI || \ - (span)->trunk_type == FTDM_TRUNK_BRI_PTMP) - - -/*! \brief Logging function prototype to be used for all FreeTDM logs - * you should use ftdm_global_set_logger to set your own logger - */ -typedef void (*ftdm_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...) __ftdm_check_printf(5, 6); - -/*! \brief Data queue operation functions - * you can use ftdm_global_set_queue_handler if you want to override the default implementation (not recommended) - */ -typedef ftdm_status_t (*ftdm_queue_create_func_t)(ftdm_queue_t **queue, ftdm_size_t capacity); -typedef ftdm_status_t (*ftdm_queue_enqueue_func_t)(ftdm_queue_t *queue, void *obj); -typedef void *(*ftdm_queue_dequeue_func_t)(ftdm_queue_t *queue); -typedef ftdm_status_t (*ftdm_queue_wait_func_t)(ftdm_queue_t *queue, int ms); -typedef ftdm_status_t (*ftdm_queue_get_interrupt_func_t)(ftdm_queue_t *queue, ftdm_interrupt_t **interrupt); -typedef ftdm_status_t (*ftdm_queue_destroy_func_t)(ftdm_queue_t **queue); - -typedef struct ftdm_queue_handler { - ftdm_queue_create_func_t create; - ftdm_queue_enqueue_func_t enqueue; - ftdm_queue_dequeue_func_t dequeue; - ftdm_queue_wait_func_t wait; - ftdm_queue_get_interrupt_func_t get_interrupt; - ftdm_queue_destroy_func_t destroy; -} ftdm_queue_handler_t; - -/*! \brief Type Of Number (TON) */ -typedef enum { - FTDM_TON_UNKNOWN = 0, - FTDM_TON_INTERNATIONAL, - FTDM_TON_NATIONAL, - FTDM_TON_NETWORK_SPECIFIC, - FTDM_TON_SUBSCRIBER_NUMBER, - FTDM_TON_ABBREVIATED_NUMBER, - FTDM_TON_RESERVED, - FTDM_TON_INVALID -} ftdm_ton_t; -#define TON_STRINGS "unknown", "international", "national", "network-specific", "subscriber-number", "abbreviated-number", "reserved", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t) - -/*! Numbering Plan Identification (NPI) */ -typedef enum { - FTDM_NPI_UNKNOWN = 0, - FTDM_NPI_ISDN, - FTDM_NPI_DATA, - FTDM_NPI_TELEX, - FTDM_NPI_NATIONAL, - FTDM_NPI_PRIVATE, - FTDM_NPI_RESERVED, - FTDM_NPI_INVALID -} ftdm_npi_t; -#define NPI_STRINGS "unknown", "ISDN", "data", "telex", "national", "private", "reserved", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_npi, ftdm_npi2str, ftdm_npi_t) - -/*! Presentation Ind */ -typedef enum { - FTDM_PRES_ALLOWED, - FTDM_PRES_RESTRICTED, - FTDM_PRES_NOT_AVAILABLE, - FTDM_PRES_RESERVED, - FTDM_PRES_INVALID -} ftdm_presentation_t; -#define PRESENTATION_STRINGS "presentation-allowed", "presentation-restricted", "number-not-available", "reserved", "Invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_presentation, ftdm_presentation2str, ftdm_presentation_t) - -/*! Screening Ind */ -typedef enum { - FTDM_SCREENING_NOT_SCREENED, - FTDM_SCREENING_VERIFIED_PASSED, - FTDM_SCREENING_VERIFIED_FAILED, - FTDM_SCREENING_NETWORK_PROVIDED, - FTDM_SCREENING_INVALID -} ftdm_screening_t; -#define SCREENING_STRINGS "user-provided-not-screened", "user-provided-verified-and-passed", "user-provided-verified-and-failed", "network-provided", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_screening, ftdm_screening2str, ftdm_screening_t) - -/*! \brief bearer capability */ -typedef enum { - FTDM_BEARER_CAP_SPEECH = 0x00, /* Speech */ - FTDM_BEARER_CAP_UNRESTRICTED, /* Unrestricted Digital */ - FTDM_BEARER_CAP_RESTRICTED, /* Restricted Digital */ - FTDM_BEARER_CAP_3_1KHZ_AUDIO, /* 3.1 Khz Audio */ - FTDM_BEARER_CAP_7KHZ_AUDIO, /* 7 Khz Audio or Unrestricted digital w tones */ - FTDM_BEARER_CAP_15KHZ_AUDIO, /* 15 Khz Audio */ - FTDM_BEARER_CAP_VIDEO, /* Video */ - FTDM_BEARER_CAP_INVALID -} ftdm_bearer_cap_t; -#define BEARER_CAP_STRINGS "speech", "unrestricted-digital-information", "restricted-digital-information", "3.1-Khz-audio", "7-Khz-audio", "15-Khz-audio", "video", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_bearer_cap, ftdm_bearer_cap2str, ftdm_bearer_cap_t) - -/*! \brief user information layer 1 protocol */ -typedef enum { - FTDM_USER_LAYER1_PROT_V110 = 0x01, - FTDM_USER_LAYER1_PROT_ULAW = 0x02, - FTDM_USER_LAYER1_PROT_ALAW = 0x03, - FTDM_USER_LAYER1_PROT_INVALID -} ftdm_user_layer1_prot_t; -#define USER_LAYER1_PROT_STRINGS "V.110", "ulaw", "alaw", "Invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t) - -/*! Calling Party Category */ -typedef enum { - FTDM_CPC_UNKNOWN, - FTDM_CPC_OPERATOR, - FTDM_CPC_OPERATOR_FRENCH, - FTDM_CPC_OPERATOR_ENGLISH, - FTDM_CPC_OPERATOR_GERMAN, - FTDM_CPC_OPERATOR_RUSSIAN, - FTDM_CPC_OPERATOR_SPANISH, - FTDM_CPC_ORDINARY, - FTDM_CPC_PRIORITY, - FTDM_CPC_DATA, - FTDM_CPC_TEST, - FTDM_CPC_PAYPHONE, - FTDM_CPC_INVALID -} ftdm_calling_party_category_t; -#define CALLING_PARTY_CATEGORY_STRINGS "unknown", "operator", "operator-french", "operator-english", "operator-german", "operator-russian", "operator-spanish", "ordinary", "priority", "data-call", "test-call", "payphone", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_calling_party_category, ftdm_calling_party_category2str, ftdm_calling_party_category_t) - -/*! Network responses to transfer requests */ -typedef enum { - FTDM_TRANSFER_RESPONSE_OK, /* Call is being transferred */ - FTDM_TRANSFER_RESPONSE_CP_DROP_OFF, /* Calling Party drop off */ - FTDM_TRANSFER_RESPONSE_LIMITS_EXCEEDED, /* Cannot redirect, limits exceeded */ - FTDM_TRANSFER_RESPONSE_INVALID_NUM, /* Network did not receive or recognize dialed number */ - FTDM_TRANSFER_RESPONSE_INVALID_COMMAND, /* Network received an invalid command */ - FTDM_TRANSFER_RESPONSE_TIMEOUT, /* We did not receive a response from Network */ - FTDM_TRANSFER_RESPONSE_INVALID, -} ftdm_transfer_response_t; -#define TRANSFER_RESPONSE_STRINGS "transfer-ok", "cp-drop-off", "limits-exceeded", "invalid-num", "invalid-command", "timeout", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_transfer_response, ftdm_transfer_response2str, ftdm_transfer_response_t) - -/*! \brief Digit limit used in DNIS/ANI */ -#define FTDM_DIGITS_LIMIT 64 - -#define FTDM_SILENCE_VALUE(fchan) (fchan)->native_codec == FTDM_CODEC_ULAW ? 255 : (fchan)->native_codec == FTDM_CODEC_ALAW ? 0xD5 : 0x00 - -/*! \brief Number abstraction */ -typedef struct { - char digits[FTDM_DIGITS_LIMIT]; - uint8_t type; - uint8_t plan; -} ftdm_number_t; - -typedef struct { - char from[FTDM_MAX_NUMBER_STR_SZ]; - char body[FTDM_MAX_NAME_STR_SZ]; -} ftdm_sms_data_t; - -/*! \brief Caller information */ -typedef struct ftdm_caller_data { - char cid_date[8]; /*!< Caller ID date */ - char cid_name[80]; /*!< Caller ID name */ - ftdm_number_t cid_num; /*!< Caller ID number */ - ftdm_number_t ani; /*!< ANI (Automatic Number Identification) */ - ftdm_number_t dnis; /*!< DNIS (Dialed Number Identification Service) */ - ftdm_number_t rdnis; /*!< RDNIS (Redirected Dialed Number Identification Service) */ - ftdm_number_t loc; /*!< LOC (Location Reference Code) */ - char aniII[FTDM_DIGITS_LIMIT]; /*! ANI II */ - uint8_t screen; /*!< Screening */ - uint8_t pres; /*!< Presentation*/ - char collected[FTDM_DIGITS_LIMIT]; /*!< Collected digits so far */ - int hangup_cause; /*!< Hangup cause */ - /* these 2 are undocumented right now, only used by boost: */ - /* bearer capability */ - ftdm_bearer_cap_t bearer_capability; - /* user information layer 1 protocol */ - ftdm_user_layer1_prot_t bearer_layer1; - ftdm_calling_party_category_t cpc; /*!< Calling party category */ - uint32_t call_reference; - - ftdm_channel_t *fchan; /*!< FreeTDM channel associated (can be NULL) */ - - /* - * We need call_id inside caller_data for the user to be able to retrieve - * the call_id when ftdm_channel_call_place is called. This is the only time - * that the user can use caller_data.call_id to obtain the call_id. The user - * should use the call_id from sigmsg otherwise - */ - uint32_t call_id; /*!< Unique call ID for this call */ - - void *priv; /*!< Private data for the FreeTDM user */ -} ftdm_caller_data_t; - -/*! \brief Hunting mode */ -typedef enum { - FTDM_HUNT_SPAN, /*!< Hunt channels in a given span */ - FTDM_HUNT_GROUP, /*!< Hunt channels in a given group */ - FTDM_HUNT_CHAN, /*!< Hunt for a specific channel */ -} ftdm_hunt_mode_t; - -/*! \brief Structure used for FTDM_HUNT_SPAN mode */ -typedef struct { - uint32_t span_id; - ftdm_hunt_direction_t direction; -} ftdm_span_hunt_t; - -/*! \brief Structure used for FTDM_HUNT_GROUP mode */ -typedef struct { - uint32_t group_id; - ftdm_hunt_direction_t direction; -} ftdm_group_hunt_t; - -/*! \brief Structure used for FTDM_HUNT_CHAN mode */ -typedef struct { - uint32_t span_id; - uint32_t chan_id; -} ftdm_chan_hunt_t; - -/*! \brief Function called before placing the call in the hunted channel - * The user can have a last saying in whether to proceed or abort - * the call attempt. Be aware that this callback will be called with - * the channel lock and you must not do any blocking operations during - * its execution. - * \param fchan The channel that will be used to place the call - * \param caller_data The caller data provided to ftdm_call_place - * \return FTDM_SUCCESS to proceed or FTDM_BREAK to abort the hunting - */ -typedef ftdm_status_t (*ftdm_hunt_result_cb_t)(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data); - -/*! \brief Channel Hunting provided to ftdm_call_place() */ -typedef struct { - ftdm_hunt_mode_t mode; - union { - ftdm_span_hunt_t span; - ftdm_group_hunt_t group; - ftdm_chan_hunt_t chan; - } mode_data; - ftdm_hunt_result_cb_t result_cb; -} ftdm_hunting_scheme_t; - - -/*! \brief Tone type */ -typedef enum { - FTDM_TONE_DTMF = (1 << 0) -} ftdm_tone_type_t; - -/*! \brief Signaling messages sent by the stacks */ -typedef enum { - FTDM_SIGEVENT_START,/*!< Incoming call (ie: incoming SETUP msg or Ring) */ - FTDM_SIGEVENT_STOP, /*!< Hangup */ - FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ - FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ - FTDM_SIGEVENT_FLASH, /*!< Flash event (typically on-hook/off-hook for analog devices) */ - FTDM_SIGEVENT_PROCEED, /*!< Outgoing call got an initial positive response from the other end */ - FTDM_SIGEVENT_RINGING, /*!< Remote side is in ringing state */ - FTDM_SIGEVENT_PROGRESS, /*!< Outgoing call is making progress */ - FTDM_SIGEVENT_PROGRESS_MEDIA, /*!< Outgoing call is making progress and there is media available */ - FTDM_SIGEVENT_ALARM_TRAP, /*!< Hardware alarm ON */ - FTDM_SIGEVENT_ALARM_CLEAR, /*!< Hardware alarm OFF */ - FTDM_SIGEVENT_COLLECTED_DIGIT, /*!< Digit collected (in signalings where digits are collected one by one) */ - FTDM_SIGEVENT_ADD_CALL, /*!< New call should be added to the channel */ - FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ - FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ - FTDM_SIGEVENT_FACILITY, /*!< In call facility event */ - FTDM_SIGEVENT_TRACE, /*!priv */ - ftdm_variable_container_t variables; - union { - ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */ - ftdm_event_trace_t trace; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ - ftdm_event_collected_t collected; /*!< valid if event_id is FTDM_SIGEVENT_COLLECTED_DIGIT */ - ftdm_event_indication_completed_t indication_completed; /*!< valid if the event_id is FTDM_SIGEVENT_INDICATION_COMPLETED */ - ftdm_event_transfer_completed_t transfer_completed; - } ev_data; - ftdm_raw_data_t raw; -}; - -/*! \brief Generic user message sent to the stack */ -struct ftdm_usrmsg { - ftdm_variable_container_t variables; - ftdm_raw_data_t raw; -}; - -/*! \brief Crash policy - * Useful for debugging only, default policy is never, if you wish to crash on asserts then use ftdm_global_set_crash_policy */ -typedef enum { - FTDM_CRASH_NEVER = 0, - FTDM_CRASH_ON_ASSERT -} ftdm_crash_policy_t; - -/*! \brief Signaling configuration parameter for the stacks (variable=value pair) */ -typedef struct ftdm_conf_parameter { - const char *var; - const char *val; - void *ptr; -} ftdm_conf_parameter_t; - -/*! \brief Opaque general purpose iterator */ -typedef struct ftdm_iterator ftdm_iterator_t; - -/*! \brief Channel commands that can be executed through ftdm_channel_command() */ -typedef enum { - FTDM_COMMAND_NOOP = 0, - FTDM_COMMAND_SET_INTERVAL = 1, - FTDM_COMMAND_GET_INTERVAL = 2, - FTDM_COMMAND_SET_CODEC = 3, - FTDM_COMMAND_GET_CODEC = 4, - FTDM_COMMAND_SET_NATIVE_CODEC = 5, - FTDM_COMMAND_GET_NATIVE_CODEC = 6, - FTDM_COMMAND_ENABLE_DTMF_DETECT = 7, - FTDM_COMMAND_DISABLE_DTMF_DETECT = 8, - FTDM_COMMAND_SEND_DTMF = 9, - FTDM_COMMAND_SET_DTMF_ON_PERIOD = 10, - FTDM_COMMAND_GET_DTMF_ON_PERIOD = 11, - FTDM_COMMAND_SET_DTMF_OFF_PERIOD = 12, - FTDM_COMMAND_GET_DTMF_OFF_PERIOD = 13, - FTDM_COMMAND_GENERATE_RING_ON = 14, - FTDM_COMMAND_GENERATE_RING_OFF = 15, - FTDM_COMMAND_OFFHOOK = 16, - FTDM_COMMAND_ONHOOK = 17, - FTDM_COMMAND_FLASH = 18, - FTDM_COMMAND_WINK = 19, - FTDM_COMMAND_ENABLE_PROGRESS_DETECT = 20, - FTDM_COMMAND_DISABLE_PROGRESS_DETECT = 21, - - /*!< Start tracing input and output from channel to the given file */ - FTDM_COMMAND_TRACE_INPUT = 22, - FTDM_COMMAND_TRACE_OUTPUT = 23, - - /*!< Stop both Input and Output trace, closing the files */ - FTDM_COMMAND_TRACE_END_ALL = 24, - - /*!< Enable DTMF debugging */ - FTDM_COMMAND_ENABLE_DEBUG_DTMF = 25, - - /*!< Disable DTMF debugging (if not disabled explicitly, it is disabled automatically when calls hangup) */ - FTDM_COMMAND_DISABLE_DEBUG_DTMF = 26, - - /*!< Start dumping all input to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ - FTDM_COMMAND_ENABLE_INPUT_DUMP = 27, - - /*!< Stop dumping all input to a circular buffer. */ - FTDM_COMMAND_DISABLE_INPUT_DUMP = 28, - - /*!< Start dumping all output to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ - FTDM_COMMAND_ENABLE_OUTPUT_DUMP = 29, - - /*!< Stop dumping all output to a circular buffer. */ - FTDM_COMMAND_DISABLE_OUTPUT_DUMP = 30, - - /*!< Dump the current input circular buffer to the specified FILE* structure */ - FTDM_COMMAND_DUMP_INPUT = 31, - - /*!< Dump the current output circular buffer to the specified FILE* structure */ - FTDM_COMMAND_DUMP_OUTPUT = 32, - - FTDM_COMMAND_ENABLE_CALLERID_DETECT = 33, - FTDM_COMMAND_DISABLE_CALLERID_DETECT = 34, - FTDM_COMMAND_ENABLE_ECHOCANCEL = 35, - FTDM_COMMAND_DISABLE_ECHOCANCEL = 36, - FTDM_COMMAND_ENABLE_ECHOTRAIN = 37, - FTDM_COMMAND_DISABLE_ECHOTRAIN = 38, - FTDM_COMMAND_SET_CAS_BITS = 39, - FTDM_COMMAND_GET_CAS_BITS = 40, - FTDM_COMMAND_SET_RX_GAIN = 41, - FTDM_COMMAND_GET_RX_GAIN = 42, - FTDM_COMMAND_SET_TX_GAIN = 43, - FTDM_COMMAND_GET_TX_GAIN = 44, - FTDM_COMMAND_FLUSH_TX_BUFFERS = 45, - FTDM_COMMAND_FLUSH_RX_BUFFERS = 46, - FTDM_COMMAND_FLUSH_BUFFERS = 47, - - /*!< Flush IO statistics */ - FTDM_COMMAND_FLUSH_IOSTATS = 48, - - FTDM_COMMAND_SET_PRE_BUFFER_SIZE = 49, - FTDM_COMMAND_SET_LINK_STATUS = 50, - FTDM_COMMAND_GET_LINK_STATUS = 51, - FTDM_COMMAND_ENABLE_LOOP = 52, - FTDM_COMMAND_DISABLE_LOOP = 53, - FTDM_COMMAND_SET_RX_QUEUE_SIZE = 54, - FTDM_COMMAND_SET_TX_QUEUE_SIZE = 55, - FTDM_COMMAND_SET_POLARITY = 56, - FTDM_COMMAND_START_MF_PLAYBACK = 57, - FTDM_COMMAND_STOP_MF_PLAYBACK = 58, - - /*!< Get a copy of the current IO stats */ - FTDM_COMMAND_GET_IOSTATS = 59, - /*!< Enable/disable IO stats in the channel */ - FTDM_COMMAND_SWITCH_IOSTATS = 60, - - /*!< Enable/disable DTMF removal */ - FTDM_COMMAND_ENABLE_DTMF_REMOVAL = 61, - FTDM_COMMAND_DISABLE_DTMF_REMOVAL = 62, - - FTDM_COMMAND_COUNT, -} ftdm_command_t; - -typedef enum { - FTDM_POLARITY_FORWARD = 0, - FTDM_POLARITY_REVERSE = 1 -} ftdm_polarity_t; - -/*! \brief Custom memory handler hooks. Not recommended to use unless you need memory allocation customizations */ -typedef void *(*ftdm_malloc_func_t)(void *pool, ftdm_size_t len); -typedef void *(*ftdm_calloc_func_t)(void *pool, ftdm_size_t elements, ftdm_size_t len); -typedef void *(*ftdm_realloc_func_t)(void *pool, void *buff, ftdm_size_t len); -typedef void (*ftdm_free_func_t)(void *pool, void *ptr); -struct ftdm_memory_handler { - void *pool; - ftdm_malloc_func_t malloc; - ftdm_calloc_func_t calloc; - ftdm_realloc_func_t realloc; - ftdm_free_func_t free; -}; - -/*! \brief FreeTDM I/O layer interface argument macros - * You don't need these unless your implementing an I/O interface module (most users don't) */ -#define FIO_CHANNEL_REQUEST_ARGS (ftdm_span_t *span, uint32_t chan_id, ftdm_hunt_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) -#define FIO_CHANNEL_OUTGOING_CALL_ARGS (ftdm_channel_t *ftdmchan) -#define FIO_CHANNEL_INDICATE_ARGS (ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication) -#define FIO_CHANNEL_SET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) -#define FIO_CHANNEL_GET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status) -#define FIO_SPAN_SET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t status) -#define FIO_SPAN_GET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t *status) -#define FIO_SPAN_POLL_EVENT_ARGS (ftdm_span_t *span, uint32_t ms, short *poll_events) -#define FIO_SPAN_NEXT_EVENT_ARGS (ftdm_span_t *span, ftdm_event_t **event) -#define FIO_CHANNEL_NEXT_EVENT_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t **event) -#define FIO_SIGNAL_CB_ARGS (ftdm_sigmsg_t *sigmsg) -#define FIO_EVENT_CB_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t *event) -#define FIO_CONFIGURE_SPAN_ARGS (ftdm_span_t *span, const char *str, ftdm_chan_type_t type, char *name, char *number) -#define FIO_CONFIGURE_ARGS (const char *category, const char *var, const char *val, int lineno) -#define FIO_OPEN_ARGS (ftdm_channel_t *ftdmchan) -#define FIO_CLOSE_ARGS (ftdm_channel_t *ftdmchan) -#define FIO_CHANNEL_DESTROY_ARGS (ftdm_channel_t *ftdmchan) -#define FIO_SPAN_DESTROY_ARGS (ftdm_span_t *span) -#define FIO_COMMAND_ARGS (ftdm_channel_t *ftdmchan, ftdm_command_t command, void *obj) -#define FIO_WAIT_ARGS (ftdm_channel_t *ftdmchan, ftdm_wait_flag_t *flags, int32_t to) -#define FIO_GET_ALARMS_ARGS (ftdm_channel_t *ftdmchan) -#define FIO_READ_ARGS (ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen) -#define FIO_WRITE_ARGS (ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen) -#define FIO_IO_LOAD_ARGS (ftdm_io_interface_t **fio) -#define FIO_IO_UNLOAD_ARGS (void) -#define FIO_SIG_LOAD_ARGS (void) -#define FIO_SIG_CONFIGURE_ARGS (ftdm_span_t *span, fio_signal_cb_t sig_cb, va_list ap) -#define FIO_CONFIGURE_SPAN_SIGNALING_ARGS (ftdm_span_t *span, fio_signal_cb_t sig_cb, ftdm_conf_parameter_t *ftdm_parameters) -#define FIO_SIG_UNLOAD_ARGS (void) -#define FIO_API_ARGS (ftdm_stream_handle_t *stream, const char *data) -#define FIO_SPAN_START_ARGS (ftdm_span_t *span) -#define FIO_SPAN_STOP_ARGS (ftdm_span_t *span) - -/*! \brief FreeTDM I/O layer interface function typedefs - * You don't need these unless your implementing an I/O interface module (most users don't) */ -typedef ftdm_status_t (*fio_channel_request_t) FIO_CHANNEL_REQUEST_ARGS ; -typedef ftdm_status_t (*fio_channel_outgoing_call_t) FIO_CHANNEL_OUTGOING_CALL_ARGS ; -typedef ftdm_status_t (*fio_channel_indicate_t) FIO_CHANNEL_INDICATE_ARGS; -typedef ftdm_status_t (*fio_channel_set_sig_status_t) FIO_CHANNEL_SET_SIG_STATUS_ARGS; -typedef ftdm_status_t (*fio_channel_get_sig_status_t) FIO_CHANNEL_GET_SIG_STATUS_ARGS; -typedef ftdm_status_t (*fio_span_set_sig_status_t) FIO_SPAN_SET_SIG_STATUS_ARGS; -typedef ftdm_status_t (*fio_span_get_sig_status_t) FIO_SPAN_GET_SIG_STATUS_ARGS; -typedef ftdm_status_t (*fio_span_poll_event_t) FIO_SPAN_POLL_EVENT_ARGS ; -typedef ftdm_status_t (*fio_span_next_event_t) FIO_SPAN_NEXT_EVENT_ARGS ; -typedef ftdm_status_t (*fio_channel_next_event_t) FIO_CHANNEL_NEXT_EVENT_ARGS ; - -/*! \brief Callback for signal delivery (FTDM_SIGEVENT_START and friends) - * \note This callback is provided by the user during ftdm_configure_span_signaling - * - * \note You must NOT do any blocking during this callback since this function is - * most likely called in an internal signaling thread that can potentially be - * shared for all the channels in a span and blocking will delay processing - * (sometimes even audio processing) for other channels - * - * \note Although some simple FreeTDM APIs can work (ie: ftdm_span_get_id etc), the - * use of any FreeTDM call API (ie ftdm_channel_call_answer) is discouraged - */ -typedef ftdm_status_t (*fio_signal_cb_t) FIO_SIGNAL_CB_ARGS ; - -typedef ftdm_status_t (*fio_event_cb_t) FIO_EVENT_CB_ARGS ; -typedef ftdm_status_t (*fio_configure_span_t) FIO_CONFIGURE_SPAN_ARGS ; -typedef ftdm_status_t (*fio_configure_t) FIO_CONFIGURE_ARGS ; -typedef ftdm_status_t (*fio_open_t) FIO_OPEN_ARGS ; -typedef ftdm_status_t (*fio_close_t) FIO_CLOSE_ARGS ; -typedef ftdm_status_t (*fio_channel_destroy_t) FIO_CHANNEL_DESTROY_ARGS ; -typedef ftdm_status_t (*fio_span_destroy_t) FIO_SPAN_DESTROY_ARGS ; -typedef ftdm_status_t (*fio_get_alarms_t) FIO_GET_ALARMS_ARGS ; -typedef ftdm_status_t (*fio_command_t) FIO_COMMAND_ARGS ; -typedef ftdm_status_t (*fio_wait_t) FIO_WAIT_ARGS ; -typedef ftdm_status_t (*fio_read_t) FIO_READ_ARGS ; -typedef ftdm_status_t (*fio_write_t) FIO_WRITE_ARGS ; -typedef ftdm_status_t (*fio_io_load_t) FIO_IO_LOAD_ARGS ; -typedef ftdm_status_t (*fio_sig_load_t) FIO_SIG_LOAD_ARGS ; -typedef ftdm_status_t (*fio_sig_configure_t) FIO_SIG_CONFIGURE_ARGS ; -typedef ftdm_status_t (*fio_configure_span_signaling_t) FIO_CONFIGURE_SPAN_SIGNALING_ARGS ; -typedef ftdm_status_t (*fio_io_unload_t) FIO_IO_UNLOAD_ARGS ; -typedef ftdm_status_t (*fio_sig_unload_t) FIO_SIG_UNLOAD_ARGS ; -typedef ftdm_status_t (*fio_api_t) FIO_API_ARGS ; -typedef ftdm_status_t (*fio_span_start_t) FIO_SPAN_START_ARGS ; -typedef ftdm_status_t (*fio_span_stop_t) FIO_SPAN_STOP_ARGS ; - - -/*! \brief FreeTDM I/O layer interface function prototype wrapper macros - * You don't need these unless your implementing an I/O interface module (most users don't) */ -#define FIO_CHANNEL_REQUEST_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_REQUEST_ARGS -#define FIO_CHANNEL_OUTGOING_CALL_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_OUTGOING_CALL_ARGS -#define FIO_CHANNEL_INDICATE_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_INDICATE_ARGS -#define FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_SET_SIG_STATUS_ARGS -#define FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_GET_SIG_STATUS_ARGS -#define FIO_SPAN_SET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_SPAN_SET_SIG_STATUS_ARGS -#define FIO_SPAN_GET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_SPAN_GET_SIG_STATUS_ARGS -#define FIO_SPAN_POLL_EVENT_FUNCTION(name) ftdm_status_t name FIO_SPAN_POLL_EVENT_ARGS -#define FIO_SPAN_NEXT_EVENT_FUNCTION(name) ftdm_status_t name FIO_SPAN_NEXT_EVENT_ARGS -#define FIO_CHANNEL_NEXT_EVENT_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_NEXT_EVENT_ARGS -#define FIO_SIGNAL_CB_FUNCTION(name) ftdm_status_t name FIO_SIGNAL_CB_ARGS -#define FIO_EVENT_CB_FUNCTION(name) ftdm_status_t name FIO_EVENT_CB_ARGS -#define FIO_CONFIGURE_SPAN_FUNCTION(name) ftdm_status_t name FIO_CONFIGURE_SPAN_ARGS -#define FIO_CONFIGURE_FUNCTION(name) ftdm_status_t name FIO_CONFIGURE_ARGS -#define FIO_OPEN_FUNCTION(name) ftdm_status_t name FIO_OPEN_ARGS -#define FIO_CLOSE_FUNCTION(name) ftdm_status_t name FIO_CLOSE_ARGS -#define FIO_CHANNEL_DESTROY_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_DESTROY_ARGS -#define FIO_SPAN_DESTROY_FUNCTION(name) ftdm_status_t name FIO_SPAN_DESTROY_ARGS -#define FIO_GET_ALARMS_FUNCTION(name) ftdm_status_t name FIO_GET_ALARMS_ARGS -#define FIO_COMMAND_FUNCTION(name) ftdm_status_t name FIO_COMMAND_ARGS -#define FIO_WAIT_FUNCTION(name) ftdm_status_t name FIO_WAIT_ARGS -#define FIO_READ_FUNCTION(name) ftdm_status_t name FIO_READ_ARGS -#define FIO_WRITE_FUNCTION(name) ftdm_status_t name FIO_WRITE_ARGS -#define FIO_IO_LOAD_FUNCTION(name) ftdm_status_t name FIO_IO_LOAD_ARGS -#define FIO_SIG_LOAD_FUNCTION(name) ftdm_status_t name FIO_SIG_LOAD_ARGS -#define FIO_SIG_CONFIGURE_FUNCTION(name) ftdm_status_t name FIO_SIG_CONFIGURE_ARGS -#define FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(name) ftdm_status_t name FIO_CONFIGURE_SPAN_SIGNALING_ARGS -#define FIO_IO_UNLOAD_FUNCTION(name) ftdm_status_t name FIO_IO_UNLOAD_ARGS -#define FIO_SIG_UNLOAD_FUNCTION(name) ftdm_status_t name FIO_SIG_UNLOAD_ARGS -#define FIO_API_FUNCTION(name) ftdm_status_t name FIO_API_ARGS -#define FIO_SPAN_START_FUNCTION(name) ftdm_status_t name FIO_SPAN_START_ARGS -#define FIO_SPAN_STOP_FUNCTION(name) ftdm_status_t name FIO_SPAN_STOP_ARGS - -/*! \brief FreeTDM I/O layer function prototype wrapper macros - * You don't need these unless your implementing an I/O interface module (most users don't) */ -struct ftdm_io_interface { - const char *name; /*!< I/O module name */ - fio_configure_span_t configure_span; /*!< Configure span I/O */ - fio_configure_t configure; /*!< Configure the module */ - fio_open_t open; /*!< Open I/O channel */ - fio_close_t close; /*!< Close I/O channel */ - fio_channel_destroy_t channel_destroy; /*!< Destroy I/O channel */ - fio_span_destroy_t span_destroy; /*!< Destroy span I/O */ - fio_get_alarms_t get_alarms; /*!< Get hardware alarms */ - fio_command_t command; /*!< Execute an I/O command on the channel */ - fio_wait_t wait; /*!< Wait for events on the channel */ - fio_read_t read; /*!< Read data from the channel */ - fio_write_t write; /*!< Write data to the channel */ - fio_span_poll_event_t poll_event; /*!< Poll for events on the whole span */ - fio_span_next_event_t next_event; /*!< Retrieve an event from the span */ - fio_channel_next_event_t channel_next_event; /*!< Retrieve an event from channel */ - fio_api_t api; /*!< Execute a text command */ - fio_span_start_t span_start; /*!< Start span I/O */ - fio_span_stop_t span_stop; /*!< Stop span I/O */ -}; - -/*! \brief FreeTDM supported I/O codecs */ -typedef enum { - FTDM_CODEC_ULAW = 0, - FTDM_CODEC_ALAW = 8, - FTDM_CODEC_SLIN = 10, - FTDM_CODEC_NONE = (1 << 30) -} ftdm_codec_t; - -/*! \brief FreeTDM supported hardware alarms. */ -typedef enum { - FTDM_ALARM_NONE = 0, - FTDM_ALARM_RED = (1 << 0), - FTDM_ALARM_YELLOW = (1 << 1), - FTDM_ALARM_RAI = (1 << 2), - FTDM_ALARM_BLUE = (1 << 3), - FTDM_ALARM_AIS = (1 << 4), - FTDM_ALARM_GENERAL = (1 << 30) -} ftdm_alarm_flag_t; - -/*! \brief MF generation direction flags - * \note Used in bitwise OR with channel ID as argument to MF_PLAYBACK I/O command, so value must be higher that 255 - * \see FTDM_COMMAND_START_MF_PLAYBACK - * */ - -typedef enum { - FTDM_MF_DIRECTION_FORWARD = (1 << 8), - FTDM_MF_DIRECTION_BACKWARD = (1 << 9) -} ftdm_mf_direction_flag_t; - -/*! \brief IO Error statistics */ -typedef enum { - FTDM_IOSTATS_ERROR_CRC = (1 << 0), - FTDM_IOSTATS_ERROR_FRAME = (1 << 1), - FTDM_IOSTATS_ERROR_ABORT = (1 << 2), - FTDM_IOSTATS_ERROR_FIFO = (1 << 3), - FTDM_IOSTATS_ERROR_DMA = (1 << 4), - FTDM_IOSTATS_ERROR_QUEUE_THRES = (1 << 5), /* Queue reached high threshold */ - FTDM_IOSTATS_ERROR_QUEUE_FULL = (1 << 6), /* Queue is full */ -} ftdm_iostats_error_type_t; - -/*! \brief IO statistics */ -typedef struct { - struct { - uint64_t packets; - uint32_t errors; - uint16_t flags; - uint8_t queue_size; /*!< max queue size configured */ - uint8_t queue_len; /*!< Current number of elements in queue */ - } rx; - - struct { - uint64_t idle_packets; - uint64_t packets; - uint32_t errors; - uint16_t flags; - uint8_t queue_size; /*!< max queue size configured */ - uint8_t queue_len; /*!< Current number of elements in queue */ - } tx; -} ftdm_channel_iostats_t; - -/*! \brief Override the default queue handler */ -FT_DECLARE(ftdm_status_t) ftdm_global_set_queue_handler(ftdm_queue_handler_t *handler); - -/*! \brief Return the availability rate for a channel - * \param ftdmchan Channel to get the availability from - * - * \retval > 0 if availability is supported - * \retval -1 if availability is not supported - */ -FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan); - -/*! \brief Answer call. This can also be accomplished by ftdm_channel_call_indicate with FTDM_CHANNEL_INDICATE_ANSWER, in both - * cases you will get a FTDM_SIGEVENT_INDICATION_COMPLETED when the indication is sent (or an error occurs). - * Just as with ftdm_channel_call_indicate you won't receive FTDM_SIGEVENT_INDICATION_COMPLETED when this function - * returns anything else than FTDM_SUCCESS - * \note Although this API may result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered, - * there is no guarantee of whether the event will arrive after or before your execution thread returns - * from ftdm_channel_call_answer - */ -#define ftdm_channel_call_answer(ftdmchan) _ftdm_channel_call_answer(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), NULL) -#define ftdm_channel_call_answer_ex(ftdmchan, usrmsg) _ftdm_channel_call_answer(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (usrmsg)) - -/*! \brief Answer call recording the source code point where the it was called (see ftdm_channel_call_answer for an easy to use macro) */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg); - -/*! \brief Place an outgoing call in the given channel - * \deprecated This macro is deprecated since leaves the door open to glare issues, use ftdm_call_place instead - */ -#define ftdm_channel_call_place(ftdmchan) _ftdm_channel_call_place(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), NULL) -#define ftdm_channel_call_place_ex(ftdmchan, usrmsg) _ftdm_channel_call_place_ex(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (usrmsg)) - -/*! \brief Place an outgoing call recording the source code point where it was called (see ftdm_channel_call_place for an easy to use macro) - * \deprecated This function is deprecated since leaves the door open to glare issues, use ftdm_call_place instead - */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg); - -/*! \brief Place an outgoing call with the given caller data in a channel according to the hunting scheme provided */ -#define ftdm_call_place(callerdata, hunting) _ftdm_call_place(__FILE__, __FTDM_FUNC__, __LINE__, (callerdata), (hunting), NULL) -#define ftdm_call_place_ex(callerdata, hunting, usrmsg) _ftdm_call_place(__FILE__, __FTDM_FUNC__, __LINE__, (callerdata), (hunting), (usrmsg)) - -/*! \brief Place an outgoing call with the given caller data in a channel according to the hunting scheme provided and records - * the place where it was called. See ftdm_call_place for an easy to use macro - * \return FTDM_SUCCESS if the call attempt was successful - * FTDM_FAIL if there was an unspecified error - * FTDM_EBUSY if the channel was busy - * FTDM_BREAK if glare was detected and you must try again - * \note Even when FTDM_SUCCESS is returned, the call may still fail later on due to glare, in such case FTDM_SIGEVENT_STOP - * will be sent with the hangup cause field set to FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL - * - * \note When this function returns FTDM_SUCCESS, the member .fchan from caller_data will be set to the channel used to place the call - * and .call_id to the generated call id for that call - * - * \note When this function is successful you are guaranteed to receive FTDM_SIGEVENT_DIALING, this event could even be delivered - * before your execution thread returns from this function - */ -FT_DECLARE(ftdm_status_t) _ftdm_call_place(const char *file, const char *func, int line, ftdm_caller_data_t *caller_data, ftdm_hunting_scheme_t *hunting, ftdm_usrmsg_t *usrmsg); - -/*! \brief Indicate a new condition in an incoming call - * - * \note Every indication request will result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered with - * the proper status that will inform you if the request was successful or not. The exception is if this - * function returns something different to FTDM_SUCCESS, in which case the request failed right away and no - * further FTDM_SIGEVENT_INDICATION_COMPLETED will be delivered - * Be aware there is no guarantee of whether the completion event will arrive after or before your execution - * thread returns from ftdm_channel_call_indicate. This means you could get FTDM_SIGEVENT_INDICATION_COMPLETED - * even before your execution thread returns from the ftdm_channel_call_indicate() API - * - * \note You cannot send more than one indication at the time. You must wait for the completed event before - * calling this function again (unless the return code was different than FTDM_SUCCESS) - */ -#define ftdm_channel_call_indicate(ftdmchan, indication) _ftdm_channel_call_indicate(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (indication), NULL) -#define ftdm_channel_call_indicate_ex(ftdmchan, indication, usrmsg) _ftdm_channel_call_indicate(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (indication), (usrmsg)) - -/*! \brief Indicate a new condition in an incoming call recording the source code point where it was called (see ftdm_channel_call_indicate for an easy to use macro) */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_usrmsg_t *usrmsg); - -/*! \brief Hangup the call without cause */ -#define ftdm_channel_call_hangup(ftdmchan) _ftdm_channel_call_hangup(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), NULL) -#define ftdm_channel_call_hangup_ex(ftdmchan, usrmsg) _ftdm_channel_call_hangup(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (usrmsg)) - -/*! \brief Hangup the call without cause recording the source code point where it was called (see ftdm_channel_call_hangup for an easy to use macro)*/ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg); - -/*! \brief Hangup the call with cause */ -#define ftdm_channel_call_hangup_with_cause(ftdmchan, cause) _ftdm_channel_call_hangup_with_cause(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (cause), NULL) -#define ftdm_channel_call_hangup_with_cause_ex(ftdmchan, cause, usrmsg) _ftdm_channel_call_hangup_with_cause(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (cause), (usrmsg)) - -/*! \brief Hangup the call with cause recording the source code point where it was called (see ftdm_channel_call_hangup_with_cause for an easy to use macro) */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup_with_cause(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_call_cause_t, ftdm_usrmsg_t *usrmsg); - -/*! \brief Transfer call. This can also be accomplished by ftdm_channel_call_indicate with FTDM_CHANNEL_INDICATE_TRANSFER, in both - * cases you will get a FTDM_SIGEVENT_INDICATION_COMPLETED when the indication is sent (or an error occurs). - * Just as with ftdm_channel_call_indicate you won't receive FTDM_SIGEVENT_INDICATION_COMPLETED when this function - * returns anything else than FTDM_SUCCESS - * \note Although this API may result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered, - * there is no guarantee of whether the event will arrive after or before your execution thread returns - * from ftdm_channel_call_transfer - */ -#define ftdm_channel_call_transfer(ftdmchan, arg) _ftdm_channel_call_transfer(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (arg), NULL) -#define ftdm_channel_call_transfer_ex(ftdmchan, arg, usrmsg) _ftdm_channel_call_transfer(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (arg), (usrmsg)) - -/*! \brief Answer call recording the source code point where the it was called (see ftdm_channel_call_tranasfer for an easy to use macro) */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_transfer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, const char* arg, ftdm_usrmsg_t *usrmsg); - -/*! \brief Reset the channel */ -#define ftdm_channel_reset(ftdmchan) _ftdm_channel_reset(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), NULL) -#define ftdm_channel_reset_ex(ftdmchan, usrmsg) _ftdm_channel_reset(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), usrmsg) - -/*! \brief Reset the channel (see _ftdm_channel_reset for an easy to use macro) - * \note if there was a call on this channel, call will be cleared without any notifications to the user - */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_reset(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg); - -/*! \brief Put a call on hold (if supported by the signaling stack) */ -#define ftdm_channel_call_hold(ftdmchan) _ftdm_channel_call_hold(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), NULL) -#define ftdm_channel_call_hold_ex(ftdmchan, usrmsg) _ftdm_channel_call_hold(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (usrmsg)) - -/*! \brief Put a call on hold recording the source code point where it was called (see ftdm_channel_call_hold for an easy to use macro) */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hold(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg); - -/*! \brief Unhold a call */ -#define ftdm_channel_call_unhold(ftdmchan) _ftdm_channel_call_unhold(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), NULL) -#define ftdm_channel_call_unhold_ex(ftdmchan, usrmsg) _ftdm_channel_call_unhold(__FILE__, __FTDM_FUNC__, __LINE__, (ftdmchan), (usrmsg)) - -/*! \brief Unhold a call recording the source code point where it was called (see ftdm_channel_call_unhold for an easy to use macro) */ -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_unhold(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg); - -/*! \brief Check if the call is answered already */ -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_answered(const ftdm_channel_t *ftdmchan); - -/*! \brief Check if the call is busy */ -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_busy(const ftdm_channel_t *ftdmchan); - -/*! \brief Check if the call is hangup */ -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_hangup(const ftdm_channel_t *ftdmchan); - -/*! \brief Check if the call is done (final state for a call, just after hangup) */ -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_done(const ftdm_channel_t *ftdmchan); - -/*! \brief Check if the call is in hold */ -FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_hold(const ftdm_channel_t *ftdmchan); - -/*! \brief Set channel signaling status (ie: put specific circuit down) only if supported by the signaling */ -FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status); - -/*! \brief Get channel signaling status (ie: whether protocol layer is up or down) */ -FT_DECLARE(ftdm_status_t) ftdm_channel_get_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status); - -/*! \brief Set span signaling status (ie: put the whole span protocol layer down) only if supported by the signaling */ -FT_DECLARE(ftdm_status_t) ftdm_span_set_sig_status(ftdm_span_t *span, ftdm_signaling_status_t status); - -/*! \brief Get span signaling status (ie: whether protocol layer is up or down) */ -FT_DECLARE(ftdm_status_t) ftdm_span_get_sig_status(ftdm_span_t *span, ftdm_signaling_status_t *status); - - -/*! - * \brief Set user private data in the channel - * - * \param ftdmchan The channel where the private data will be stored - * \param pvt The private pointer to store - * - */ -FT_DECLARE(void) ftdm_channel_set_private(ftdm_channel_t *ftdmchan, void *pvt); - -/*! - * \brief Get user private data in the channel - * - * \param ftdmchan The channel to retrieve the private data - * \retval The private data (if any or NULL if no data has been stored) - * - */ -FT_DECLARE(void *) ftdm_channel_get_private(const ftdm_channel_t *ftdmchan); - -/*! - * \brief Remove the given token from the channel - * - * \param ftdmchan The channel where the token is - * \param token The token string. If NULL, all tokens in the channel are cleared - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_clear_token(ftdm_channel_t *ftdmchan, const char *token); - -/*! - * \brief Replace the given token with the new token - * - * \param ftdmchan The channel where the token is - * \param old_token The token to replace - * \param new_token The token to put in place - */ -FT_DECLARE(void) ftdm_channel_replace_token(ftdm_channel_t *ftdmchan, const char *old_token, const char *new_token); - -/*! - * \brief Add a new token to the channel - * - * \param ftdmchan The channel where the token will be added - * \param token The token string to add - * \param end if 0, the token will be added at the beginning of the token list, to the end otherwise - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_add_token(ftdm_channel_t *ftdmchan, char *token, int end); - -/*! - * \brief Get the requested token - * - * \param ftdmchan The channel where the token is - * \param tokenid The id of the token - * - * \retval The token character string - * \retval NULL token not found - */ -FT_DECLARE(const char *) ftdm_channel_get_token(const ftdm_channel_t *ftdmchan, uint32_t tokenid); - -/*! - * \brief Get the token count - * - * \param ftdmchan The channel to get the token count from - * - * \retval The token count - */ -FT_DECLARE(uint32_t) ftdm_channel_get_token_count(const ftdm_channel_t *ftdmchan); - -/*! - * \brief Get the I/O read/write interval - * - * \param ftdmchan The channel to get the interval from - * - * \retval The interval in milliseconds - */ -FT_DECLARE(uint32_t) ftdm_channel_get_io_interval(const ftdm_channel_t *ftdmchan); - -/*! - * \brief Get the I/O read/write packet length per interval - * - * \param ftdmchan The channel to get the packet length from - * - * \retval The packet length interval in bytes - */ -FT_DECLARE(uint32_t) ftdm_channel_get_io_packet_len(const ftdm_channel_t *ftdmchan); - -/*! - * \brief Get the I/O read/write codec - * - * \param ftdmchan The channel to get the codec from - * - * \retval The codec type - */ -FT_DECLARE(ftdm_codec_t) ftdm_channel_get_codec(const ftdm_channel_t *ftdmchan); - -/*! - * \brief Get the last error string for the channel - * - * \deprecated This API will disappear in the future and not every - * FreeTDM API set the last error value - * - * \param ftdmchan The channel to get the error from - * - * \retval The error string (not thread-safe, the string is per channel, not per thread) - */ -FT_DECLARE(const char *) ftdm_channel_get_last_error(const ftdm_channel_t *ftdmchan); - -/*! - * \brief Get the current alarm bitmask for the channel - * - * \param ftdmchan The channel to get the alarm bitmask from - * \param alarmbits The alarm bitmask pointer to store the current alarms (you are responsible for allocation/deallocation) - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_get_alarms(ftdm_channel_t *ftdmchan, ftdm_alarm_flag_t *alarmbits); - -/*! - * \brief Get the channel type - * - * \param ftdmchan The channel to get the type from - * - * \retval channel type (FXO, FXS, B-channel, D-channel, etc) - */ -FT_DECLARE(ftdm_chan_type_t) ftdm_channel_get_type(const ftdm_channel_t *ftdmchan); - -/*! - * \brief Dequeue DTMF from the given channel - * \note To transmit DTMF use ftdm_channel_command with command FTDM_COMMAND_SEND_DTMF - * - * \param ftdmchan The channel to dequeue DTMF from - * \param dtmf DTMF buffer to store the dtmf (you are responsible for its allocation and deallocation) - * \param len The size of the provided DTMF buffer - * - * \retval The size of the dequeued DTMF (it might be zero if there is no DTMF in the queue) - */ -FT_DECLARE(ftdm_size_t) ftdm_channel_dequeue_dtmf(ftdm_channel_t *ftdmchan, char *dtmf, ftdm_size_t len); - -/*! - * \brief Flush the DTMF queue - * - * \param ftdmchan The channel to flush the dtmf queue of - */ -FT_DECLARE(void) ftdm_channel_flush_dtmf(ftdm_channel_t *ftdmchan); - -/*! - * \brief Wait for an event in the span - * - * \param span The span to wait events for - * \param ms Milliseconds timeout - * \param poll_events Array of events to poll for, for each channel on the span - * - * \retval FTDM_SUCCESS success (at least one event available) - * \retval FTDM_TIMEOUT Timed out waiting for events - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms, short *poll_events); - -/*! - * \brief Find a span by its id - * - * \param id The span id - * \param span Pointer to store the span if found - * - * \retval FTDM_SUCCESS success (span is valid) - * \retval FTDM_FAIL failure (span is not valid) - */ -FT_DECLARE(ftdm_status_t) ftdm_span_find(uint32_t id, ftdm_span_t **span); - -/*! - * \brief Get the last error string for the given span - * - * \deprecated This API will disappear in the future and not every - * FreeTDM API set the last error value - * - * \param span The span to get the last error from - * - * \retval character string for the last error - */ -FT_DECLARE(const char *) ftdm_span_get_last_error(const ftdm_span_t *span); - -/*! - * \brief Create a new span (not needed if you are using freetdm.conf) - * - * \param iotype The I/O interface type this span will use. - * This depends on the available I/O modules - * ftmod_wanpipe = "wanpipe" (Sangoma) - * ftmod_zt = "zt" (DAHDI or Zaptel) - * ftmod_pika "pika" (this one is most likely broken) - * \param name Name for the span - * \param span Pointer to store the create span - * - * \retval FTDM_SUCCESS success (the span was created) - * \retval FTDM_FAIL failure (span was not created) - */ -FT_DECLARE(ftdm_status_t) ftdm_span_create(const char *iotype, const char *name, ftdm_span_t **span); - -/*! - * \brief Add a new channel to a span - * - * \param span Where to add the new channel - * \param sockfd The socket device associated to the channel (ie: sangoma device, dahdi device etc) - * \param type Channel type - * \param chan Pointer to store the newly allocated channel - * - * \retval FTDM_SUCCESS success (the channel was created) - * \retval FTDM_FAIL failure (span was not created) - */ -FT_DECLARE(ftdm_status_t) ftdm_span_add_channel(ftdm_span_t *span, ftdm_socket_t sockfd, ftdm_chan_type_t type, ftdm_channel_t **chan); - -/*! \brief Add the channel to a hunt group */ -FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_channel_t* ftdmchan); - -/*! \brief Remove the channel from a hunt group */ -FT_DECLARE(ftdm_status_t) ftdm_channel_remove_from_group(ftdm_group_t* group, ftdm_channel_t* ftdmchan); - -/*! - * \brief Retrieves an event from the span - * - * \note - * This function is non-reentrant and not thread-safe. - * The event returned may be modified if the function is called again - * from a different thread or even the same. It is recommended to - * handle events from the same span in a single thread. - * - * \param ftdmchan The channel to retrieve the event from - * \param event Pointer to store the pointer to the event - * - * \retval FTDM_SUCCESS success (at least one event available) - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event); - -/*! \brief Find a hunt group by id */ -FT_DECLARE(ftdm_status_t) ftdm_group_find(uint32_t id, ftdm_group_t **group); - -/*! \brief Find a hunt group by name */ -FT_DECLARE(ftdm_status_t) ftdm_group_find_by_name(const char *name, ftdm_group_t **group); - -/*! \brief Create a group with the given name */ -FT_DECLARE(ftdm_status_t) ftdm_group_create(ftdm_group_t **group, const char *name); - -/*! \brief Get the number of channels in use on a span */ -FT_DECLARE(ftdm_status_t) ftdm_span_channel_use_count(ftdm_span_t *span, uint32_t *count); - -/*! \brief Get the number of channels in use on a group */ -FT_DECLARE(ftdm_status_t) ftdm_group_channel_use_count(ftdm_group_t *group, uint32_t *count); - -/*! \brief Get the id of a group */ -FT_DECLARE(uint32_t) ftdm_group_get_id(const ftdm_group_t *group); - -/*! - * \brief Open a channel specifying the span id and chan id (required before placing a call on the channel) - * - * \warning Try using ftdm_call_place instead if you plan to place a call after opening the channel - * - * \note You must call ftdm_channel_close() or ftdm_channel_call_hangup() to release the channel afterwards - * Only use ftdm_channel_close if there is no call (incoming or outgoing) in the channel - * - * \param span_id The span id the channel belongs to - * \param chan_id Logical channel id of the channel you want to open - * \param ftdmchan Pointer to store the channel once is open - * - * \retval FTDM_SUCCESS success (the channel was found and is available) - * \retval FTDM_FAIL failure (channel was not found or not available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan); - -/*! - * \brief Open a channel specifying the span id and physical chan id (required before placing a call on the channel) - * - * \warning Try using ftdm_call_place instead if you plan to place a call after opening the channel - * - * \note You must call ftdm_channel_close() or ftdm_channel_call_hangup() to release the channel afterwards - * Only use ftdm_channel_close if there is no call (incoming or outgoing) in the channel - * - * \param span_id The span id the channel belongs to - * \param chan_id Physical channel id of the channel you want to open - * \param ftdmchan Pointer to store the channel once is open - * - * \retval FTDM_SUCCESS success (the channel was found and is available) - * \retval FTDM_FAIL failure (channel was not found or not available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_open_ph(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan); - -/*! - * \brief Hunts and opens a channel specifying the span id only - * - * \warning Try using ftdm_call_place instead if you plan to place a call after opening the channel - * - * \note You must call ftdm_channel_close() or ftdm_channel_call_hangup() to release the channel afterwards - * Only use ftdm_channel_close if there is no call (incoming or outgoing) in the channel - * - * \param span_id The span id to hunt for a channel - * \param direction The hunting direction - * \param caller_data The calling party information - * \param ftdmchan The channel pointer to store the available channel - * - * \retval FTDM_SUCCESS success (a suitable channel was found available) - * \retval FTDM_FAIL failure (no suitable channel was found available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_hunt_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan); - -/*! - * \brief Hunts and opens a channel specifying group id - * - * \warning Try using ftdm_call_place instead if you plan to place a call after opening the channel - * - * \note You must call ftdm_channel_close() or ftdm_channel_call_hangup() to release the channel afterwards - * Only use ftdm_channel_close if there is no call (incoming or outgoing) in the channel - * - * \param group_id The group id to hunt for a channel - * \param direction The hunting direction - * \param caller_data The calling party information - * \param ftdmchan The channel pointer to store the available channel - * - * \retval FTDM_SUCCESS success (a suitable channel was found available) - * \retval FTDM_FAIL failure (no suitable channel was found available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_hunt_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan); - -/*! - * \brief Close a previously open channel - * - * \warning FreeTDM is more and more a signaling API rather than just a plane IO API, unless you are using - * FreeTDM as a pure IO API without its signaling modules, you should not use this function - * - * \note If you placed a call in this channel use ftdm_channel_call_hangup(), you MUST NOT call this function, - * the signaling stack will close the channel when the call is done. - * - * \param ftdmchan pointer to the channel to close - * - * \retval FTDM_SUCCESS success (a suitable channel was found available) - * \retval FTDM_FAIL failure (no suitable channel was found available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_close(ftdm_channel_t **ftdmchan); - -/*! - * \brief Execute a command in a channel (same semantics as the ioctl() unix system call) - * - * \param ftdmchan The channel to execute the command - * \param command The command to execute - * \param arg The argument for the command - * - * \retval FTDM_SUCCESS success (a suitable channel was found available) - * \retval FTDM_FAIL failure (no suitable channel was found available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_command_t command, void *arg); - -/*! - * \brief Wait for I/O events in a channel - * - * \param ftdmchan The channel to wait I/O for - * \param flags The wait I/O flags - * \param timeout The timeout in milliseconds - * - * \retval FTDM_SUCCESS success (a suitable channel was found available) - * \retval FTDM_FAIL failure (no suitable channel was found available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_wait(ftdm_channel_t *ftdmchan, ftdm_wait_flag_t *flags, int32_t timeout); - -/*! - * \brief Read data from a channel - * - * \param ftdmchan The channel to read data from - * \param data The pointer to the buffer to store the read data - * \param datalen The size in bytes of the provided buffer - * - * \retval FTDM_SUCCESS success (a suitable channel was found available) - * \retval FTDM_FAIL failure (no suitable channel was found available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen); - -/*! - * \brief Write data to a channel - * - * \note The difference between data and datasize is subtle but important. - * - * datalen is a pointer to the size of the actual data that you want to write. This pointer - * will be updated with the number of bytes actually written. - * - * datasize on the other hand is the size of the entire buffer provided in data, whether - * all of that buffer is in use or not is a different matter. The difference becomes - * important only if you are using FreeTDM doing transcoding, for example, providing - * a ulaw frame of 160 bytes but where the I/O device accepts input in signed linear, - * the data to write will be 320 bytes, therefore datasize is expected to be at least - * 320 where datalen would be just 160. - * - * \param ftdmchan The channel to write data to - * \param data The pointer to the buffer to write - * \param datasize The maximum number of bytes in data that can be used (in case transcoding is necessary) - * \param datalen The size of the actual data - * - * \retval FTDM_SUCCESS success (a suitable channel was found available) - * \retval FTDM_FAIL failure (no suitable channel was found available) - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t datasize, ftdm_size_t *datalen); - -/*! \brief Get a custom variable from the sigmsg - * \note The variable pointer returned is only valid while the before the event is processed and it'll be destroyed once the event is processed. */ -FT_DECLARE(const char *) ftdm_sigmsg_get_var(ftdm_sigmsg_t *sigmsg, const char *var_name); - -/*! \brief Get an iterator to iterate over the sigmsg variables - * \param sigmsg The message structure containing the variables - * \param iter Optional iterator. You can reuse an old iterator (not previously freed) to avoid the extra allocation of a new iterator. - * \note The iterator pointer returned is only valid while the channel is open and it'll be destroyed when the channel is closed. - * This iterator is completely non-thread safe, if you are adding variables or removing variables while iterating - * results are unpredictable - */ -FT_DECLARE(ftdm_iterator_t *) ftdm_sigmsg_get_var_iterator(const ftdm_sigmsg_t *sigmsg, ftdm_iterator_t *iter); - -/*! \brief Get raw data from sigmsg - * \param sigmsg The message structure containing the variables - * \param data data will point to available data pointer if available - * \param datalen datalen will be set to length of data available - * \retval FTDM_SUCCESS data is available - * \retval FTDM_FAIL no data available - * \note data is only valid within the duration of the callback, to receive a data pointer that does not get - * \note destroyed when callback returns, see ftdm_sigmsg_get_raw_data_detached - */ -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_get_raw_data(ftdm_sigmsg_t *sigmsg, void **data, ftdm_size_t *datalen); - -/*! \brief Get raw data from event - * \param sigmsg The message structure containing the variables - * \param data data will point to available data pointer if available - * \param datalen datalen will be set to length of data available - * \retval FTDM_SUCCESS data is available - * \retval FTDM_FAIL no data available - * \note Once this function returns, User owns data, and is responsible to free data using ftdm_safe_free(); - */ -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_get_raw_data_detached(ftdm_sigmsg_t *sigmsg, void **data, ftdm_size_t *datalen); - -/*! \brief Add a custom variable to the user message - * \note This variables may be used by signaling modules to override signaling parameters - * \todo Document which signaling variables are available - * */ -FT_DECLARE(ftdm_status_t) ftdm_usrmsg_add_var(ftdm_usrmsg_t *usrmsg, const char *var_name, const char *value); - -/*! \brief Attach raw data to usrmsg - * \param usrmsg The message structure containing the variables - * \param data pointer to data - * \param datalen datalen length of data - * \retval FTDM_SUCCESS success, data was successfully saved - * \retval FTDM_FAIL failed, event already had data attached to it. - * \note data must have been allocated using ftdm_calloc, FreeTDM will free data once the usrmsg is processed. - */ -FT_DECLARE(ftdm_status_t) ftdm_usrmsg_set_raw_data(ftdm_usrmsg_t *usrmsg, void *data, ftdm_size_t datalen); - -/*! \brief Get iterator current value (depends on the iterator type) - * \note Channel iterators return a pointer to ftdm_channel_t - * Span iterators return a pointer to ftdm_span_t - * Variable iterators return a pointer to the variable name (not the variable value) - */ -FT_DECLARE(void *) ftdm_iterator_current(ftdm_iterator_t *iter); - -/*! \brief Get variable name and value for the current iterator position */ -FT_DECLARE(ftdm_status_t) ftdm_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val); - -/*! \brief Advance iterator */ -FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter); - -/*! \brief Free iterator - * \note You must free an iterator after using it unless you plan to reuse it - */ -FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter); - -/*! \brief Get the span pointer associated to the channel */ -FT_DECLARE(ftdm_span_t *) ftdm_channel_get_span(const ftdm_channel_t *ftdmchan); - -/*! \brief Get the span pointer associated to the channel */ -FT_DECLARE(uint32_t) ftdm_channel_get_span_id(const ftdm_channel_t *ftdmchan); - -/*! \brief Get the physical span id associated to the channel */ -FT_DECLARE(uint32_t) ftdm_channel_get_ph_span_id(const ftdm_channel_t *ftdmchan); - -/*! \brief Get the span name associated to the channel */ -FT_DECLARE(const char *) ftdm_channel_get_span_name(const ftdm_channel_t *ftdmchan); - -/*! \brief Get the id associated to the channel */ -FT_DECLARE(uint32_t) ftdm_channel_get_id(const ftdm_channel_t *ftdmchan); - -/*! \brief Get the name associated to the channel */ -FT_DECLARE(const char *) ftdm_channel_get_name(const ftdm_channel_t *ftdmchan); - -/*! \brief Get the number associated to the channel */ -FT_DECLARE(const char *) ftdm_channel_get_number(const ftdm_channel_t *ftdmchan); - -/*! \brief Get the number physical id associated to the channel */ -FT_DECLARE(uint32_t) ftdm_channel_get_ph_id(const ftdm_channel_t *ftdmchan); - -/*! - * \brief Configure span with a signaling type - * - * \deprecated use ftdm_configure_span_signaling instead - * - * \note This function does the same as ftdm_configure_span_signaling - * - * \param span The span to configure - * \param type The signaling type ("boost", "isdn" and others, this depends on the available signaling modules) - * \param sig_cb The callback that the signaling stack will use to notify about events - * \param ... variable argument list with "var", value sequence, the variable and values are signaling type dependant - * the last argument must be FTDM_TAG_END - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_configure_span(ftdm_span_t *span, const char *type, fio_signal_cb_t sig_cb, ...); -#define FTDM_TAG_END NULL - - -/*! - * \brief Configure span with a signaling type - * - * \param span The span to configure - * \param type The signaling type ("boost", "isdn" and others, this depends on the available signaling modules) - * \param sig_cb The callback that the signaling stack will use to notify about events - * \param parameters The array if signaling-specific parameters (the last member of the array MUST have its var member set to NULL, ie: .var = NULL) - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const char *type, fio_signal_cb_t sig_cb, ftdm_conf_parameter_t *parameters); - -/*! - * \brief Register callback to listen for incoming events - * \note This function should only be used when there is no signalling module - * \param span The span to register to - * \param sig_cb The callback that the signaling stack will use to notify about events - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_span_register_signal_cb(ftdm_span_t *span, fio_signal_cb_t sig_cb); - -/*! - * \brief Start the span signaling (must call ftdm_configure_span_signaling first) - * - * \note Even before this function returns you may receive signaling events! - * Never block in the signaling callback since it might be called in a thread - * that handles more than 1 call and therefore you would be blocking all the - * calls handled by that thread! - * - * \param span The span to start - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span); - -/*! - * \brief Stop the span signaling (must call ftdm_span_start first) - * \note certain signalings (boost signaling) does not support granular span start/stop - * so it is recommended to always configure all spans and then starting them all and finally - * stop them all (or call ftdm_global_destroy which takes care of stopping and destroying the spans at once). - * - * \param span The span to stop - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span); - -/*! - * \brief Register a custom I/O interface with the FreeTDM core - * - * \param io_interface the Interface to register - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_global_add_io_interface(ftdm_io_interface_t *io_interface); - -/** - * Get I/O interface by name - * - * \param iotype Name of interface - * \param autoload Try to load missing plugins - * \retval I/O interface handle on success - * \retval NULL on failure - */ -FT_DECLARE(ftdm_io_interface_t *) ftdm_global_get_io_interface(const char *iotype, ftdm_bool_t autoload); - -/*! \brief Find a span by name */ -FT_DECLARE(ftdm_status_t) ftdm_span_find_by_name(const char *name, ftdm_span_t **span); - -/*! \brief Get the span id */ -FT_DECLARE(uint32_t) ftdm_span_get_id(const ftdm_span_t *span); - -/*! \brief Get the span name */ -FT_DECLARE(const char *) ftdm_span_get_name(const ftdm_span_t *span); - -/*! \brief Get iterator for the span channels - * \param span The span containing the channels - * \param iter Optional iterator. You can reuse an old iterator (not previously freed) to avoid the extra allocation of a new iterator. - */ -FT_DECLARE(ftdm_iterator_t *) ftdm_span_get_chan_iterator(const ftdm_span_t *span, ftdm_iterator_t *iter); - -/*! \brief Get iterator for spans - * \param iter Optional iterator. You can reuse an old iterator (not previously freed) to avoid the extra allocation of a new iterator. - */ -FT_DECLARE(ftdm_iterator_t *) ftdm_get_span_iterator(ftdm_iterator_t *iter); - -/*! - * \brief Execute a text command. The text command output will be returned and must be free'd - * - * \param cmd The command to execute - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(char *) ftdm_api_execute(const char *cmd); - -/*! - * \brief Create a configuration node - * - * \param name The name of the configuration node - * \param node The node pointer to store the new node - * \param parent The parent node if any, or NULL if no parent - * - * \return FTDM_SUCCESS success - * \return FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_conf_node_create(const char *name, ftdm_conf_node_t **node, ftdm_conf_node_t *parent); - -/*! - * \brief Adds a new parameter to the specified configuration node - * - * \param node The configuration node to add the param-val pair to - * \param param The parameter name - * \param val The parameter value - * - * \return FTDM_SUCCESS success - * \return FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_conf_node_add_param(ftdm_conf_node_t *node, const char *param, const char *val); - -/*! - * \brief Destroy the memory allocated for a configuration node (and all of its descendance) - * - * \param node The node to destroy - * - * \return FTDM_SUCCESS success - * \return FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_conf_node_destroy(ftdm_conf_node_t *node); - -/*! - * \brief Create and configure channels in the given span - * - * \param span The span container - * \param str The channel range null terminated string. "1-10", "24" etc - * \param chan_config The basic channel configuration for each channel within the range - * \param configured Pointer where the number of channels configured will be stored - * - * \return FTDM_SUCCESS success - * \return FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const char *str, ftdm_channel_config_t *chan_config, unsigned *configured); - -/*! - * \brief Set the trunk type for a span - * This must be called before configuring any channels within the span - * - * \param span The span - * \param type The trunk type - * - */ -FT_DECLARE(void) ftdm_span_set_trunk_type(ftdm_span_t *span, ftdm_trunk_type_t type); - -/*! - * \brief Get the trunk type for a span - * - * \param span The span - * - * \return The span trunk type - */ -FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span); - -/*! \brief For display debugging purposes you can display this string which describes the trunk type of a span */ -FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span); - -/*! - * Set the trunk mode for a span - * \note This must be called before configuring any channels within the span! - * \param[in] span The span - * \param[in] type The trunk mode - */ -FT_DECLARE(void) ftdm_span_set_trunk_mode(ftdm_span_t *span, ftdm_trunk_mode_t mode); - -/*! - * Get the trunk mode for a span - * \param[in] span The span - * \return Span trunk mode - */ -FT_DECLARE(ftdm_trunk_mode_t) ftdm_span_get_trunk_mode(const ftdm_span_t *span); - -/*! - * Get the trunk mode of a span in textual form - * \param[in] span The span - * \return Span mode name as a string - */ -FT_DECLARE(const char *) ftdm_span_get_trunk_mode_str(const ftdm_span_t *span); - -/*! - * \brief Return the channel identified by the provided logical id - * - * \param span The span where the channel belongs - * \param chanid The logical channel id within the span - * - * \return The channel pointer if found, NULL otherwise - */ -FT_DECLARE(ftdm_channel_t *) ftdm_span_get_channel(const ftdm_span_t *span, uint32_t chanid); - -/*! - * \brief Return the channel identified by the provided physical id - * - * \param span The span where the channel belongs - * \param chanid The physical channel id within the span - * - * \return The channel pointer if found, NULL otherwise - */ -FT_DECLARE(ftdm_channel_t *) ftdm_span_get_channel_ph(const ftdm_span_t *span, uint32_t chanid); - -/*! \brief Return the channel count number for the given span */ -FT_DECLARE(uint32_t) ftdm_span_get_chan_count(const ftdm_span_t *span); - -/*! \brief Set the caller data for a channel. Be sure to call this before ftdm_channel_call_place() */ -FT_DECLARE(ftdm_status_t) ftdm_channel_set_caller_data(ftdm_channel_t *ftdmchan, ftdm_caller_data_t *caller_data); - -/*! \brief Get the caller data for a channel, typically you need this when receiving FTDM_SIGEVENT_START */ -FT_DECLARE(ftdm_caller_data_t *) ftdm_channel_get_caller_data(ftdm_channel_t *channel); - -/*! \brief Get current state of a channel */ -FT_DECLARE(int) ftdm_channel_get_state(const ftdm_channel_t *ftdmchan); - -/*! \brief Get last state of a channel */ -FT_DECLARE(int) ftdm_channel_get_last_state(const ftdm_channel_t *ftdmchan); - -/*! \brief For display debugging purposes you can display this string which describes the current channel internal state */ -FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *channel); - -/*! \brief For display debugging purposes you can display this string which describes the last channel internal state */ -FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *channel); - -/*! \brief For display debugging purposes you can display this string which describes the history of the channel - * \param channel The channel to get the history from - * \return History string for the channel. You must free the string with ftdm_free - */ -FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *channel); - -/*! \brief Enable/disable blocking mode in the channels for this span */ -FT_DECLARE(ftdm_status_t) ftdm_span_set_blocking_mode(const ftdm_span_t *span, ftdm_bool_t enabled); - -/*! \brief Initialize the library */ -FT_DECLARE(ftdm_status_t) ftdm_global_init(void); - -/*! \brief Create spans and channels reading the freetdm.conf file */ -FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void); - -/*! \brief Shutdown the library */ -FT_DECLARE(ftdm_status_t) ftdm_global_destroy(void); - -/*! \brief Set memory handler for the library */ -FT_DECLARE(ftdm_status_t) ftdm_global_set_memory_handler(ftdm_memory_handler_t *handler); - -/*! \brief Set the crash policy for the library */ -FT_DECLARE(void) ftdm_global_set_crash_policy(ftdm_crash_policy_t policy); - -/*! \brief Set the logger handler for the library */ -FT_DECLARE(void) ftdm_global_set_logger(ftdm_logger_t logger); - -/*! \brief Set the default logger level */ -FT_DECLARE(void) ftdm_global_set_default_logger(int level); - -/*! \brief Set the directory to look for modules */ -FT_DECLARE(void) ftdm_global_set_mod_directory(const char *path); - -/*! \brief Set the directory to look for configs */ -FT_DECLARE(void) ftdm_global_set_config_directory(const char *path); - -/*! \brief Check if the FTDM library is initialized and running */ -FT_DECLARE(ftdm_bool_t) ftdm_running(void); - -/** - * Generate a stack trace and invoke a callback function for each entry - * \param[in] callback Callback function, that is invoked for each stack symbol - * \param[in] priv (User-)Private data passed to the callback - * \retval - * FTDM_SUCCESS On success - * FTDM_NOTIMPL Backtraces are not available - * FTDM_EINVAL Invalid arguments (callback was NULL) - */ -FT_DECLARE(ftdm_status_t) ftdm_backtrace_walk(void (* callback)(const int tid, const void *addr, const char *symbol, void *priv), void *priv); - -/** - * Convenience function to print a backtrace for a span. - * \note The backtrace is generated with FTDM_LOG_DEBUG log level. - * \param[in] span Span object - * \retval - * FTDM_SUCCESS On success - * FTDM_NOTIMPL Backtraces are not available - * FTDM_EINVAL Invalid arguments (e.g. span was NULL) - */ -FT_DECLARE(ftdm_status_t) ftdm_backtrace_span(ftdm_span_t *span); - -/** - * Convenience function to print a backtrace for a channel. - * \note The backtrace is generated with FTDM_LOG_DEBUG log level. - * \param[in] chan Channel object - * \retval - * FTDM_SUCCESS On success - * FTDM_NOTIMPL Backtraces are not available - * FTDM_EINVAL Invalid arguments (e.g. chan was NULL) - */ -FT_DECLARE(ftdm_status_t) ftdm_backtrace_chan(ftdm_channel_t *chan); - - -FT_DECLARE_DATA extern ftdm_logger_t ftdm_log; - -/*! \brief Basic transcoding function prototype */ -#define FIO_CODEC_ARGS (void *data, ftdm_size_t max, ftdm_size_t *datalen) -#define FIO_CODEC_FUNCTION(name) FT_DECLARE_NONSTD(ftdm_status_t) name FIO_CODEC_ARGS -typedef ftdm_status_t (*fio_codec_t) FIO_CODEC_ARGS ; - -/*! \brief Basic transcoding functions */ -FIO_CODEC_FUNCTION(fio_slin2ulaw); -FIO_CODEC_FUNCTION(fio_ulaw2slin); -FIO_CODEC_FUNCTION(fio_slin2alaw); -FIO_CODEC_FUNCTION(fio_alaw2slin); -FIO_CODEC_FUNCTION(fio_ulaw2alaw); -FIO_CODEC_FUNCTION(fio_alaw2ulaw); - -#define FTDM_PRE __FILE__, __func__, __LINE__ -#define FTDM_LOG_LEVEL_DEBUG 7 -#define FTDM_LOG_LEVEL_INFO 6 -#define FTDM_LOG_LEVEL_NOTICE 5 -#define FTDM_LOG_LEVEL_WARNING 4 -#define FTDM_LOG_LEVEL_ERROR 3 -#define FTDM_LOG_LEVEL_CRIT 2 -#define FTDM_LOG_LEVEL_ALERT 1 -#define FTDM_LOG_LEVEL_EMERG 0 - -/*! \brief Log levels */ -#define FTDM_LOG_DEBUG FTDM_PRE, FTDM_LOG_LEVEL_DEBUG -#define FTDM_LOG_INFO FTDM_PRE, FTDM_LOG_LEVEL_INFO -#define FTDM_LOG_NOTICE FTDM_PRE, FTDM_LOG_LEVEL_NOTICE -#define FTDM_LOG_WARNING FTDM_PRE, FTDM_LOG_LEVEL_WARNING -#define FTDM_LOG_ERROR FTDM_PRE, FTDM_LOG_LEVEL_ERROR -#define FTDM_LOG_CRIT FTDM_PRE, FTDM_LOG_LEVEL_CRIT -#define FTDM_LOG_ALERT FTDM_PRE, FTDM_LOG_LEVEL_ALERT -#define FTDM_LOG_EMERG FTDM_PRE, FTDM_LOG_LEVEL_EMERG - -#ifdef __cplusplus -} /* extern C */ -#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/freetdm/src/include/ftdm_call_utils.h b/libs/freetdm/src/include/ftdm_call_utils.h deleted file mode 100644 index 975e73e729..0000000000 --- a/libs/freetdm/src/include/ftdm_call_utils.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * Ricardo Barroetaveña - * - */ - -#ifndef __FTDM_CALL_UTILS_H__ -#define __FTDM_CALL_UTILS_H__ - -/*! - * \brief Set the Numbering Plan Identification from a string - * - * \param npi_string string value - * \param target the target to set value to - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *npi_string, uint8_t *target); - - -/*! - * \brief Set the Type of number from a string - * - * \param ton_string string value - * \param target the target to set value to - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *ton_string, uint8_t *target); - -/*! - * \brief Set the Bearer Capability from a string - * - * \param bc_string string value - * \param target the target to set value to - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *bc_string, uint8_t *target); - -/*! - * \brief Set the Bearer Capability - Layer 1 from a string - * - * \param bc_string string value - * \param target the target to set value to - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *bc_string, uint8_t *target); - -/*! - * \brief Set the Screening Ind from a string - * - * \param screen_string string value - * \param target the target to set value to - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target); - - -/*! - * \brief Set the Presentation Ind from an enum - * - * \param screen_string string value - * \param target the target to set value to - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target); - - -/*! - * \brief Checks whether a string contains only numbers - * - * \param number string value - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number); - -/*! - * \brief Set the Calling Party Category from an enum - * - * \param cpc_string string value - * \param target the target to set value to - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_set_calling_party_category(const char *string, uint8_t *target); - -/*! - * \brief URL encode a buffer - * - * \param url buffer to convert - * \param buf target to save converted string to - * \param len size of buffer - * - * \retval pointer to converted string - */ -FT_DECLARE(char *) ftdm_url_encode(const char *url, char *buf, ftdm_size_t len); - -/*! - * \param s buffer to convert - * \param len size of buffer - * - * \retval pointer to converted string - */ -FT_DECLARE(char *) ftdm_url_decode(char *s, ftdm_size_t *len); - -#endif /* __FTDM_CALL_UTILS_H__ */ - diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h deleted file mode 100644 index 410944e7d3..0000000000 --- a/libs/freetdm/src/include/ftdm_declare.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __FTDM_DECLARE_H__ -#define __FTDM_DECLARE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) -#define _XOPEN_SOURCE 600 -#endif - -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 1 -#endif -#ifndef HAVE_SYS_SOCKET_H -#define HAVE_SYS_SOCKET_H 1 -#endif - -#ifndef __WINDOWS__ -#if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) || defined(_WIN64) -#define __WINDOWS__ -#endif -#endif - -#ifdef _MSC_VER -#define __FTDM_FUNC__ __FUNCTION__ -#if defined(FT_DECLARE_STATIC) -#define FT_DECLARE(type) type __stdcall -#define FT_DECLARE_NONSTD(type) type __cdecl -#define FT_DECLARE_DATA -#elif defined(FREETDM_EXPORTS) -#define FT_DECLARE(type) __declspec(dllexport) type __stdcall -#define FT_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl -#define FT_DECLARE_DATA __declspec(dllexport) -#else -#define FT_DECLARE(type) __declspec(dllimport) type __stdcall -#define FT_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl -#define FT_DECLARE_DATA __declspec(dllimport) -#endif -#define FT_DECLARE_INLINE(type) extern __inline__ type /* why extern? see http://support.microsoft.com/kb/123768 */ -#define EX_DECLARE_DATA __declspec(dllexport) -#else -#define __FTDM_FUNC__ (const char *)__func__ -#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY) -#define FT_DECLARE(type) __attribute__((visibility("default"))) type -#define FT_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type -#define FT_DECLARE_DATA __attribute__((visibility("default"))) -#else -#define FT_DECLARE(type) type -#define FT_DECLARE_NONSTD(type) type -#define FT_DECLARE_DATA -#endif -#define FT_DECLARE_INLINE(type) __inline__ type -#define EX_DECLARE_DATA -#endif - -#ifdef _MSC_VER -#ifndef __inline__ -#define __inline__ __inline -#endif -#if (_MSC_VER >= 1400) /* VC8+ */ -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE -#endif -#endif -#ifndef strcasecmp -#define strcasecmp(s1, s2) _stricmp(s1, s2) -#endif -#ifndef strncasecmp -#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) -#endif -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif -#ifndef S_IRUSR -#define S_IRUSR _S_IREAD -#endif -#ifndef S_IWUSR -#define S_IWUSR _S_IWRITE -#endif -#undef HAVE_STRINGS_H -#undef HAVE_SYS_SOCKET_H -/* disable warning for zero length array in a struct */ -/* this will cause errors on c99 and ansi compliant compilers and will need to be fixed in the wanpipe header files */ -#pragma warning(disable:4706) -#pragma comment(lib, "Winmm") -#endif - -/* - * Compiler-specific format checking attributes - * use these on custom functions that use printf/scanf-style - * format strings (e.g. ftdm_log()) - */ -#if defined(__GNUC__) -/** - * Enable compiler-specific printf()-style format and argument checks on a function - * @param fmtp Position of printf()-style format string parameter - * @param argp Position of variable argument list ("...") parameter - * @code - * void log(const int level, const char *fmt, ...) __ftdm_check_printf(2, 3); - * @endcode - */ -#define __ftdm_check_printf(fmtp, argp) __attribute__((format (printf, fmtp, argp))) -/** - * Enable compiler-specific scanf()-style format and argument checks on a function - * @param fmtp Position of scanf()-style format string parameter - * @param argp Position of variable argument list ("...") parameter - * @code - * void parse(struct foo *ctx, const char *fmt, ...) __ftdm_check_scanf(2, 3); - * @endcode - */ -#define __ftdm_check_scanf(fmtp, argp) __attribute__((format (scanf, fmtp, argp))) -#else -#define __ftdm_check_printf(fmtp, argp) -#define __ftdm_check_scanf(fmtp, argp) -#endif - - -#define FTDM_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) FT_DECLARE(_TYPE) _FUNC1 (const char *name); FT_DECLARE(const char *) _FUNC2 (_TYPE type); -#define FTDM_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ - FT_DECLARE(_TYPE) _FUNC1 (const char *name) \ - { \ - int i; \ - _TYPE t = _MAX ; \ - \ - for (i = 0; i < _MAX ; i++) { \ - if (!strcasecmp(name, _STRINGS[i])) { \ - t = (_TYPE) i; \ - break; \ - } \ - } \ - \ - return t; \ - } \ - FT_DECLARE(const char *) _FUNC2 (_TYPE type) \ - { \ - if (type > _MAX) { \ - type = _MAX; \ - } \ - return _STRINGS[(int)type]; \ - } \ - -#ifdef __WINDOWS__ -#include -#include -#define FTDM_INVALID_SOCKET INVALID_HANDLE_VALUE -typedef HANDLE ftdm_socket_t; -typedef unsigned __int64 uint64_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int8 uint8_t; -typedef __int64 int64_t; -typedef __int32 int32_t; -typedef __int16 int16_t; -typedef __int8 int8_t; -#define FTDM_O_BINARY O_BINARY -#define FTDM_SIZE_FMT "Id" -#define FTDM_INT64_FMT "lld" -#define FTDM_UINT64_FMT "llu" -#define FTDM_XINT64_FMT "llx" -#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) -#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 -#else -#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL -#endif /* _MSC_VER */ -#else /* __WINDOWS__ */ -#define FTDM_O_BINARY 0 -#define FTDM_SIZE_FMT "zd" -#if (defined(__SIZEOF_LONG__) && (__SIZEOF_LONG__ == 8)) || defined(__LP64__) || defined(__LLP64__) -#define FTDM_INT64_FMT "ld" -#define FTDM_UINT64_FMT "lu" -#define FTDM_XINT64_FMT "lx" -#else -#define FTDM_INT64_FMT "lld" -#define FTDM_UINT64_FMT "llu" -#define FTDM_XINT64_FMT "llx" -#endif -#define FTDM_INVALID_SOCKET -1 -typedef int ftdm_socket_t; -#include -#include -#include -#endif - -/*! \brief FreeTDM APIs possible return codes */ -typedef enum { - FTDM_SUCCESS, /*!< Success */ - FTDM_FAIL, /*!< Failure, generic error return code when no more specific return code can be used */ - - FTDM_MEMERR, /*!< Allocation failure */ - FTDM_ENOMEM = FTDM_MEMERR, - - FTDM_TIMEOUT, /*!< Operation timed out (ie: polling on a device)*/ - FTDM_ETIMEDOUT = FTDM_TIMEOUT, - - FTDM_NOTIMPL, /*!< Operation not implemented */ - FTDM_ENOSYS = FTDM_NOTIMPL, /*!< The function is not implemented */ - - FTDM_BREAK, /*!< Request the caller to perform a break (context-dependant, ie: stop getting DNIS/ANI) */ - - /*!< Any new return codes should try to mimc unix style error codes, no need to reinvent */ - FTDM_EINVAL, /*!< Invalid argument */ - FTDM_ECANCELED, /*!< Operation cancelled */ - FTDM_EBUSY, /*!< Device busy */ -} ftdm_status_t; - -/*! \brief FreeTDM bool type. */ -typedef enum { - FTDM_FALSE, - FTDM_TRUE -} ftdm_bool_t; - -/*! \brief I/O waiting flags */ -typedef enum { - FTDM_NO_FLAGS = 0, - FTDM_READ = (1 << 0), - FTDM_WRITE = (1 << 1), - FTDM_EVENTS = (1 << 2) -} ftdm_wait_flag_t; - -/*! - * \brief FreeTDM channel. - * This is the basic data structure used to place calls and I/O operations - */ -typedef struct ftdm_channel ftdm_channel_t; - -/*! - * \brief FreeTDM span. - * Channel and signaling configuration container. - * This is a logical span structure, a span may ( or may note ) contain channels - * of other physical spans, depending on configuration (freetdm.conf) or if you - * are not using configuration depends on how you call ftdm_span_add_channel - */ -typedef struct ftdm_span ftdm_span_t; - -typedef struct ftdm_event ftdm_event_t; -typedef struct ftdm_conf_node ftdm_conf_node_t; -typedef struct ftdm_group ftdm_group_t; -typedef size_t ftdm_size_t; -typedef struct ftdm_sigmsg ftdm_sigmsg_t; -typedef struct ftdm_usrmsg ftdm_usrmsg_t; -typedef struct ftdm_io_interface ftdm_io_interface_t; -typedef struct ftdm_stream_handle ftdm_stream_handle_t; -typedef struct ftdm_queue ftdm_queue_t; -typedef struct ftdm_memory_handler ftdm_memory_handler_t; - -#ifdef __cplusplus -} /* extern C */ -#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/freetdm/src/include/ftdm_dso.h b/libs/freetdm/src/include/ftdm_dso.h deleted file mode 100755 index b2d3c21999..0000000000 --- a/libs/freetdm/src/include/ftdm_dso.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Cross Platform dso/dll load abstraction - * Copyright(C) 2008 Michael Jerris - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so. - * - * This work 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. - * - */ - -#include "freetdm.h" - -#ifndef _FTDM_DSO_H -#define _FTDM_DSO_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*ftdm_func_ptr_t) (void); -typedef void * ftdm_dso_lib_t; - -FT_DECLARE(ftdm_status_t) ftdm_dso_destroy(ftdm_dso_lib_t *lib); -FT_DECLARE(ftdm_dso_lib_t) ftdm_dso_open(const char *path, char **err); -FT_DECLARE(void *) ftdm_dso_func_sym(ftdm_dso_lib_t lib, const char *sym, char **err); -FT_DECLARE(char *) ftdm_build_dso_path(const char *name, char *path, ftdm_size_t len); - - -#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/freetdm/src/include/ftdm_os.h b/libs/freetdm/src/include/ftdm_os.h deleted file mode 100644 index 913debcd52..0000000000 --- a/libs/freetdm/src/include/ftdm_os.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __FTDM_OS_H__ -#define __FTDM_OS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(__linux__) && !defined(__USE_BSD) -#define __USE_BSD -#endif - -#include "ftdm_declare.h" -#include "ftdm_threadmutex.h" -#include - -#ifndef __WINDOWS__ -#include -#endif - -/*! \brief time data type */ -typedef uint64_t ftdm_time_t; -/*! format string for ftdm_time_t */ -#define FTDM_TIME_FMT FTDM_UINT64_FMT - -/*! \brief sleep x amount of milliseconds */ -#ifdef __WINDOWS__ -#define ftdm_sleep(x) Sleep(x) -#else -#define ftdm_sleep(x) usleep(x * 1000) -#endif - -/*! \brief strncpy replacement */ -#define ftdm_copy_string(x,y,z) strncpy(x, y, z - 1) - -/*! \brief strncpy into a fixed-length buffer */ -#define ftdm_set_string(x,y) strncpy(x, y, sizeof(x)-1) - -/*! \brief check for null or zero length string buffer */ -#define ftdm_strlen_zero(s) (!s || *s == '\0') - -/*! \brief check for zero length string buffer */ -#define ftdm_strlen_zero_buf(s) (*s == '\0') - -/*! \brief array len helper */ -#define ftdm_array_len(array) sizeof(array)/sizeof(array[0]) - -/*! \brief Get smaller value */ -#define ftdm_min(x,y) ((x) < (y) ? (x) : (y)) - -/*! \brief Get larger value */ -#define ftdm_max(x,y) ((x) > (y) ? (x) : (y)) - -/*! \brief Get value that is in range [vmin,vmax] */ -#define ftdm_clamp(val,vmin,vmax) ftdm_max(vmin,ftdm_min(val,vmax)) - -/*!< \brief Safer version of ftdm_clamp(), that swaps vmin/vmax parameters if vmin > vmax */ -#define ftdm_clamp_safe(val,vmin,vmax) \ - ftdm_clamp(val, ftdm_min(vmin,vmax), ftdm_max(vmin,vmax)) - -/*! - * \brief Get offset of member in structure - * \param[in] type Type of struct - * \param[in] member Name of struct member - * \code - * struct a { - * int foo; - * int bar; - * }; - * - * int offset_a_bar = ftdm_offset_of(struct a, bar); // 4 byte offset - * \endcode - */ -#define ftdm_offset_of(type,member) (uintptr_t)&(((type *)0)->member) - -/*! - * \brief Get pointer to enclosing structrure from pointer to embedded member - * \param[in] ptr Pointer to embedded member - * \param[in] type Type of parent/container structure - * \param[in] member Name of embedded member in parent/container struct - * \code - * struct engine { - * int nr_cyl; - * }; - * - * struct car { - * char model[10]; - * struct engine eng; // struct engine embedded in car(!) - * }; - * - * int somefunc(struct engine *e) { - * struct car *c = ftdm_container_of(e, struct car, eng); - * - * ... do something with car ... - * } - * \endcode - */ -#define ftdm_container_of(ptr,type,member) (type *)((uintptr_t)(ptr) - ftdm_offset_of(type, member)) - -/*! - * \brief Silence "unused parameter" compiler warnings - * \note Tested with VS 2010, GCC 4.8, clang 3.1 and suncc - * \code - * int example(char *a) { - * ftdm_unused_arg(a); - * return 0; - * } - * \endcode - */ -#define ftdm_unused_arg(x) (void)(x) - - -/*! \brief The memory handler. - Do not use directly this variable, use the memory macros and ftdm_global_set_memory_handler to override */ -FT_DECLARE_DATA extern ftdm_memory_handler_t g_ftdm_mem_handler; - -/*! - \brief Allocate uninitialized memory - \param chunksize the chunk size -*/ -#define ftdm_malloc(chunksize) g_ftdm_mem_handler.malloc(g_ftdm_mem_handler.pool, chunksize) - -/*! - \brief Reallocates memory - \param buff the buffer - \param chunksize the chunk size -*/ -#define ftdm_realloc(buff, chunksize) g_ftdm_mem_handler.realloc(g_ftdm_mem_handler.pool, buff, chunksize) - -/*! - \brief Allocate initialized memory - \param chunksize the chunk size -*/ -#define ftdm_calloc(elements, chunksize) g_ftdm_mem_handler.calloc(g_ftdm_mem_handler.pool, elements, chunksize) - -/*! - \brief Free chunk of memory - \param chunksize the chunk size -*/ -#define ftdm_free(chunk) g_ftdm_mem_handler.free(g_ftdm_mem_handler.pool, chunk) - -/*! - \brief Free a pointer and set it to NULL unless it already is NULL - \param it the pointer -*/ -#define ftdm_safe_free(it) if (it) { ftdm_free(it); it = NULL; } - -/*! \brief Duplicate string */ -FT_DECLARE(char *) ftdm_strdup(const char *str); - -/*! \brief Duplicate string with limit */ -FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen); - -/*! \brief Get the current time in milliseconds */ -FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void); - -#ifdef __cplusplus -} /* extern C */ -#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/freetdm/src/include/ftdm_threadmutex.h b/libs/freetdm/src/include/ftdm_threadmutex.h deleted file mode 100644 index 45eb87d441..0000000000 --- a/libs/freetdm/src/include/ftdm_threadmutex.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Cross Platform Thread/Mutex abstraction - * Copyright(C) 2007 Michael Jerris - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so. - * - * This work 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. - * - * Contributors: - * - * Moises Silva - * - */ - - -#ifndef _FTDM_THREADMUTEX_H -#define _FTDM_THREADMUTEX_H - -#include "freetdm.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct ftdm_mutex ftdm_mutex_t; -typedef struct ftdm_thread ftdm_thread_t; -typedef struct ftdm_interrupt ftdm_interrupt_t; -typedef void *(*ftdm_thread_function_t) (ftdm_thread_t *, void *); - -FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached(ftdm_thread_function_t func, void *data); -FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached_ex(ftdm_thread_function_t func, void *data, ftdm_size_t stack_size); -FT_DECLARE(void) ftdm_thread_override_default_stacksize(ftdm_size_t size); - -FT_DECLARE(ftdm_status_t) ftdm_mutex_create(ftdm_mutex_t **mutex); -FT_DECLARE(ftdm_status_t) ftdm_mutex_destroy(ftdm_mutex_t **mutex); - -#define ftdm_mutex_lock(_x) _ftdm_mutex_lock(__FILE__, __LINE__, __FTDM_FUNC__, _x) -FT_DECLARE(ftdm_status_t) _ftdm_mutex_lock(const char *file, int line, const char *func, ftdm_mutex_t *mutex); - -#define ftdm_mutex_trylock(_x) _ftdm_mutex_trylock(__FILE__, __LINE__, __FTDM_FUNC__, _x) -FT_DECLARE(ftdm_status_t) _ftdm_mutex_trylock(const char *file, int line, const char *func, ftdm_mutex_t *mutex); - -#define ftdm_mutex_unlock(_x) _ftdm_mutex_unlock(__FILE__, __LINE__, __FTDM_FUNC__, _x) -FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(const char *file, int line, const char *func, ftdm_mutex_t *mutex); - -FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device, ftdm_wait_flag_t device_flags); -FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **cond); -FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *cond); -FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *cond, int ms); -FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms); -FT_DECLARE(ftdm_wait_flag_t) ftdm_interrupt_device_ready(ftdm_interrupt_t *interrupt); - -#ifdef __cplusplus -} -#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/freetdm/src/include/private/fsk.h b/libs/freetdm/src/include/private/fsk.h deleted file mode 100644 index 66da140df9..0000000000 --- a/libs/freetdm/src/include/private/fsk.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * bell202.h - * - * Copyright (c) 2005 Robert Krten. 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 THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. - * - * This module contains the manifest constants and declarations for - * the Bell-202 1200 baud FSK modem. - * - * 2005 03 20 R. Krten created -*/ - -#ifndef __FSK_H__ -#define __FSK_H__ -#include "uart.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int freq_space; /* Frequency of the 0 bit */ - int freq_mark; /* Frequency of the 1 bit */ - int baud_rate; /* baud rate for the modem */ -} fsk_modem_definition_t; - -/* Must be kept in sync with fsk_modem_definitions array in fsk.c */ -/* V.23 definitions: http://www.itu.int/rec/recommendation.asp?type=folders&lang=e&parent=T-REC-V.23 */ -typedef enum { - FSK_V23_FORWARD_MODE1 = 0, /* Maximum 600 bps for long haul */ - FSK_V23_FORWARD_MODE2, /* Standard 1200 bps V.23 */ - FSK_V23_BACKWARD, /* 75 bps return path for V.23 */ - FSK_BELL202 /* Bell 202 half-duplex 1200 bps */ -} fsk_modem_types_t; - -typedef enum { - FSK_STATE_CHANSEIZE = 0, - FSK_STATE_CARRIERSIG, - FSK_STATE_DATA -} fsk_state_t; - -typedef struct dsp_fsk_attr_s -{ - int sample_rate; /* sample rate in HZ */ - bithandler_func_t bithandler; /* bit handler */ - void *bithandler_arg; /* arbitrary ID passed to bithandler as first argument */ - bytehandler_func_t bytehandler; /* byte handler */ - void *bytehandler_arg; /* arbitrary ID passed to bytehandler as first argument */ -} dsp_fsk_attr_t; - -typedef struct -{ - fsk_state_t state; - dsp_fsk_attr_t attr; /* attributes structure */ - double *correlates[4]; /* one for each of sin/cos for mark/space */ - int corrsize; /* correlate size (also number of samples in ring buffer) */ - double *buffer; /* sample ring buffer */ - int ringstart; /* ring buffer start offset */ - double cellpos; /* bit cell position */ - double celladj; /* bit cell adjustment for each sample */ - int previous_bit; /* previous bit (for detecting a transition to sync-up cell position) */ - int current_bit; /* current bit */ - int last_bit; - int downsampling_count; /* number of samples to skip */ - int current_downsample; /* current skip count */ - int conscutive_state_bits; /* number of bits in a row that matches the pattern for the current state */ -} dsp_fsk_handle_t; - -/* - * Function prototypes - * - * General calling order is: - * a) create the attributes structure (dsp_fsk_attr_init) - * b) initialize fields in the attributes structure (dsp_fsk_attr_set_*) - * c) create a Bell-202 handle (dsp_fsk_create) - * d) feed samples through the handler (dsp_fsk_sample) -*/ - -void dsp_fsk_attr_init(dsp_fsk_attr_t *attributes); - -bithandler_func_t dsp_fsk_attr_get_bithandler(dsp_fsk_attr_t *attributes, void **bithandler_arg); -void dsp_fsk_attr_set_bithandler(dsp_fsk_attr_t *attributes, bithandler_func_t bithandler, void *bithandler_arg); -bytehandler_func_t dsp_fsk_attr_get_bytehandler(dsp_fsk_attr_t *attributes, void **bytehandler_arg); -void dsp_fsk_attr_set_bytehandler(dsp_fsk_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg); -int dsp_fsk_attr_get_samplerate(dsp_fsk_attr_t *attributes); -int dsp_fsk_attr_set_samplerate(dsp_fsk_attr_t *attributes, int samplerate); - -dsp_fsk_handle_t * dsp_fsk_create(dsp_fsk_attr_t *attributes); -void dsp_fsk_destroy(dsp_fsk_handle_t **handle); - -void dsp_fsk_sample(dsp_fsk_handle_t *handle, double normalized_sample); - -extern fsk_modem_definition_t fsk_modem_definitions[]; - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif - diff --git a/libs/freetdm/src/include/private/ftdm_buffer.h b/libs/freetdm/src/include/private/ftdm_buffer.h deleted file mode 100644 index fd5628c905..0000000000 --- a/libs/freetdm/src/include/private/ftdm_buffer.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FTDM_BUFFER_H -#define FTDM_BUFFER_H - -#include "freetdm.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ftdm_buffer Buffer Routines - * @ingroup buffer - * The purpose of this module is to make a plain buffering interface that can be used for read/write buffers - * throughout the application. - * @{ - */ -struct ftdm_buffer; -typedef struct ftdm_buffer ftdm_buffer_t; - -/*! \brief Allocate a new dynamic ftdm_buffer - * \param buffer returned pointer to the new buffer - * \param blocksize length to realloc by as data is added - * \param start_len ammount of memory to reserve initially - * \param max_len length the buffer is allowed to grow to - * \return status - */ -FT_DECLARE(ftdm_status_t) ftdm_buffer_create(ftdm_buffer_t **buffer, ftdm_size_t blocksize, ftdm_size_t start_len, ftdm_size_t max_len); - -/*! \brief Get the length of a ftdm_buffer_t - * \param buffer any buffer of type ftdm_buffer_t - * \return int size of the buffer. - */ -FT_DECLARE(ftdm_size_t) ftdm_buffer_len(ftdm_buffer_t *buffer); - -/*! \brief Get the freespace of a ftdm_buffer_t - * \param buffer any buffer of type ftdm_buffer_t - * \return int freespace in the buffer. - */ -FT_DECLARE(ftdm_size_t) ftdm_buffer_freespace(ftdm_buffer_t *buffer); - -/*! \brief Get the in use amount of a ftdm_buffer_t - * \param buffer any buffer of type ftdm_buffer_t - * \return int ammount of buffer curently in use - */ -FT_DECLARE(ftdm_size_t) ftdm_buffer_inuse(ftdm_buffer_t *buffer); - -/*! \brief Read data from a ftdm_buffer_t up to the ammount of datalen if it is available. Remove read data from buffer. - * \param buffer any buffer of type ftdm_buffer_t - * \param data pointer to the read data to be returned - * \param datalen amount of data to be returned - * \return int ammount of data actually read - */ -FT_DECLARE(ftdm_size_t) ftdm_buffer_read(ftdm_buffer_t *buffer, void *data, ftdm_size_t datalen); - -/*! \brief Read data endlessly from a ftdm_buffer_t - * \param buffer any buffer of type ftdm_buffer_t - * \param data pointer to the read data to be returned - * \param datalen amount of data to be returned - * \return int ammount of data actually read - * \note Once you have read all the data from the buffer it will loop around. - */ -FT_DECLARE(ftdm_size_t) ftdm_buffer_read_loop(ftdm_buffer_t *buffer, void *data, ftdm_size_t datalen); - -/*! \brief Assign a number of loops to read - * \param buffer any buffer of type ftdm_buffer_t - * \param loops the number of loops (-1 for infinite) - */ -FT_DECLARE(void) ftdm_buffer_set_loops(ftdm_buffer_t *buffer, int32_t loops); - -/*! \brief Write data into a ftdm_buffer_t up to the length of datalen - * \param buffer any buffer of type ftdm_buffer_t - * \param data pointer to the data to be written - * \param datalen amount of data to be written - * \return int amount of buffer used after the write, or 0 if no space available - */ -FT_DECLARE(ftdm_size_t) ftdm_buffer_write(ftdm_buffer_t *buffer, const void *data, ftdm_size_t datalen); - -/*! \brief Remove data from the buffer - * \param buffer any buffer of type ftdm_buffer_t - * \param datalen amount of data to be removed - * \return int size of buffer, or 0 if unable to toss that much data - */ -FT_DECLARE(ftdm_size_t) ftdm_buffer_toss(ftdm_buffer_t *buffer, ftdm_size_t datalen); - -/*! \brief Remove all data from the buffer - * \param buffer any buffer of type ftdm_buffer_t - */ -FT_DECLARE(void) ftdm_buffer_zero(ftdm_buffer_t *buffer); - -/*! \brief Destroy the buffer - * \param buffer buffer to destroy - * \note only neccessary on dynamic buffers (noop on pooled ones) - */ -FT_DECLARE(void) ftdm_buffer_destroy(ftdm_buffer_t **buffer); - -/*! \brief Seek to offset from the beginning of the buffer - * \param buffer buffer to seek - * \param datalen offset in bytes - * \return new position - */ -FT_DECLARE(ftdm_size_t) ftdm_buffer_seek(ftdm_buffer_t *buffer, ftdm_size_t datalen); - -/** @} */ - -FT_DECLARE(ftdm_size_t) ftdm_buffer_zwrite(ftdm_buffer_t *buffer, const void *data, ftdm_size_t datalen); - -#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/freetdm/src/include/private/ftdm_config.h b/libs/freetdm/src/include/private/ftdm_config.h deleted file mode 100644 index f55261fcc9..0000000000 --- a/libs/freetdm/src/include/private/ftdm_config.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @defgroup config Config File Parser - * @ingroup config - * This module implements a basic interface and file format parser - * - *
- *
- * EXAMPLE 
- * 
- * [category1]
- * var1 => val1
- * var2 => val2
- * \# lines that begin with \# are comments
- * \#var3 => val3
- * 
- * @{ - */ - -#ifndef FTDM_CONFIG_H -#define FTDM_CONFIG_H - -#include "freetdm.h" -#define FTDM_URL_SEPARATOR "://" - - -#ifdef WIN32 -#define FTDM_PATH_SEPARATOR "\\" -#ifndef FTDM_CONFIG_DIR -#define FTDM_CONFIG_DIR "c:\\freetdm" -#endif -#define ftdm_is_file_path(file) (*(file +1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR)) -#else -#define FTDM_PATH_SEPARATOR "/" -#ifndef FTDM_CONFIG_DIR -#define FTDM_CONFIG_DIR "/etc/freetdm" -#endif -#define ftdm_is_file_path(file) ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct ftdm_config ftdm_config_t; - -/*! \brief A simple file handle representing an open configuration file **/ -struct ftdm_config { - /*! FILE stream buffer to the opened file */ - FILE *file; - /*! path to the file */ - char path[512]; - /*! current category */ - char category[256]; - /*! current section */ - char section[256]; - /*! buffer of current line being read */ - char buf[1024]; - /*! current line number in file */ - int lineno; - /*! current category number in file */ - int catno; - /*! current section number in file */ - int sectno; - - int lockto; -}; - -/*! - \brief Open a configuration file - \param cfg (ftdm_config_t *) config handle to use - \param file_path path to the file - \return 1 (true) on success 0 (false) on failure -*/ -int ftdm_config_open_file(ftdm_config_t * cfg, const char *file_path); - -/*! - \brief Close a previously opened configuration file - \param cfg (ftdm_config_t *) config handle to use -*/ -void ftdm_config_close_file(ftdm_config_t * cfg); - -/*! - \brief Retrieve next name/value pair from configuration file - \param cfg (ftdm_config_t *) config handle to use - \param var pointer to aim at the new variable name - \param val pointer to aim at the new value -*/ -int ftdm_config_next_pair(ftdm_config_t * cfg, char **var, char **val); - -/*! - \brief Retrieve the CAS bits from a configuration string value - \param strvalue pointer to the configuration string value (expected to be in format whatever:xxxx) - \param outbits pointer to aim at the CAS bits -*/ -FT_DECLARE (int) ftdm_config_get_cas_bits(char *strvalue, unsigned char *outbits); - -#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/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h deleted file mode 100644 index 935cd50078..0000000000 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ /dev/null @@ -1,803 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "freetdm.h" - -#ifndef __PRIVATE_FTDM_CORE__ -#define __PRIVATE_FTDM_CORE__ - -#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) -#define _XOPEN_SOURCE 600 -#endif - -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 1 -#endif -#ifndef HAVE_SYS_SOCKET_H -#define HAVE_SYS_SOCKET_H 1 -#endif - -#ifdef _MSC_VER -#ifndef __inline__ -#define __inline__ __inline -#endif -#if (_MSC_VER >= 1400) /* VC8+ */ -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE -#endif -#endif -#ifndef strcasecmp -#define strcasecmp(s1, s2) _stricmp(s1, s2) -#endif -#ifndef strncasecmp -#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) -#endif -#ifndef snprintf -#define snprintf _snprintf -#endif -#ifndef S_IRUSR -#define S_IRUSR _S_IREAD -#endif -#ifndef S_IWUSR -#define S_IWUSR _S_IWRITE -#endif -#undef HAVE_STRINGS_H -#undef HAVE_SYS_SOCKET_H -/* disable warning for zero length array in a struct */ -/* this will cause errors on c99 and ansi compliant compilers and will need to be fixed in the wanpipe header files */ -#pragma warning(disable:4706) -#pragma comment(lib, "Winmm") -#endif - -#define FTDM_THREAD_STACKSIZE 240 * 1024 -#define FTDM_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL }; - -#define ftdm_true(expr) \ - (expr && ( !strcasecmp(expr, "yes") || \ - !strcasecmp(expr, "on") || \ - !strcasecmp(expr, "true") || \ - !strcasecmp(expr, "enabled") || \ - !strcasecmp(expr, "active") || \ - atoi(expr))) ? FTDM_TRUE : FTDM_FALSE - -#ifdef WIN32_LEAN_AND_MEAN -#include -#include -#endif - -#include -#ifndef __WINDOWS__ -#include -#endif - -#include -#include -#include -#ifdef HAVE_STRINGS_H -#include -#endif -#include - -#include "ftdm_types.h" -#include "hashtable.h" -#include "ftdm_config.h" -#include "g711.h" -#include "libteletone.h" -#include "ftdm_buffer.h" -#include "ftdm_threadmutex.h" -#include "ftdm_sched.h" -#include "ftdm_call_utils.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define SPAN_PENDING_CHANS_QUEUE_SIZE 1000 -#define SPAN_PENDING_SIGNALS_QUEUE_SIZE 1000 - -#define GOTO_STATUS(label,st) status = st; goto label ; - -#define ftdm_copy_string(x,y,z) strncpy(x, y, z - 1) -#define ftdm_set_string(x,y) strncpy(x, y, sizeof(x)-1) -#define ftdm_strlen_zero(s) (!s || *s == '\0') -#define ftdm_strlen_zero_buf(s) (*s == '\0') - - -#define ftdm_channel_test_feature(obj, flag) ((obj)->features & flag) -#define ftdm_channel_set_feature(obj, flag) (obj)->features = (ftdm_channel_feature_t)((obj)->features | flag) -#define ftdm_channel_clear_feature(obj, flag) (obj)->features = (ftdm_channel_feature_t)((obj)->features & ( ~(flag) )) -#define ftdm_channel_set_member_locked(obj, _m, _v) ftdm_mutex_lock(obj->mutex); obj->_m = _v; ftdm_mutex_unlock(obj->mutex) - -/*! - \brief Test for the existance of a flag on an arbitary object - \command obj the object to test - \command flag the or'd list of flags to test - \return true value if the object has the flags defined -*/ -#define ftdm_test_flag(obj, flag) ((obj)->flags & flag) -/*!< Physical (IO) module specific flags */ -#define ftdm_test_pflag(obj, flag) ((obj)->pflags & flag) -/*!< signaling module specific flags */ -#define ftdm_test_sflag(obj, flag) ((obj)->sflags & flag) - -#define ftdm_set_alarm_flag(obj, flag) (obj)->alarm_flags |= (flag) -#define ftdm_clear_alarm_flag(obj, flag) (obj)->alarm_flags &= ~(flag) -#define ftdm_test_alarm_flag(obj, flag) ((obj)->alarm_flags & flag) - -#define ftdm_set_io_flag(obj, flag) (obj)->io_flags |= (flag) -#define ftdm_clear_io_flag(obj, flag) (obj)->io_flags &= ~(flag) -#define ftdm_test_io_flag(obj, flag) ((obj)->io_flags & flag) - -/*! - \brief Set a flag on an arbitrary object - \command obj the object to set the flags on - \command flag the or'd list of flags to set -*/ -#define ftdm_set_flag(obj, flag) (obj)->flags |= (flag) -#define ftdm_set_flag_locked(obj, flag) assert(obj->mutex != NULL); \ - ftdm_mutex_lock(obj->mutex); \ - (obj)->flags |= (flag); \ - ftdm_mutex_unlock(obj->mutex); - -#define ftdm_set_pflag(obj, flag) (obj)->pflags |= (flag) -#define ftdm_set_pflag_locked(obj, flag) assert(obj->mutex != NULL); \ - ftdm_mutex_lock(obj->mutex); \ - (obj)->pflags |= (flag); \ - ftdm_mutex_unlock(obj->mutex); - -#define ftdm_set_sflag(obj, flag) (obj)->sflags |= (flag) -#define ftdm_set_sflag_locked(obj, flag) assert(obj->mutex != NULL); \ - ftdm_mutex_lock(obj->mutex); \ - (obj)->sflags |= (flag); \ - ftdm_mutex_unlock(obj->mutex); - -/*! - \brief Clear a flag on an arbitrary object while locked - \command obj the object to test - \command flag the or'd list of flags to clear -*/ -#define ftdm_clear_flag(obj, flag) (obj)->flags &= ~(flag) - -#define ftdm_clear_flag_locked(obj, flag) assert(obj->mutex != NULL); ftdm_mutex_lock(obj->mutex); (obj)->flags &= ~(flag); ftdm_mutex_unlock(obj->mutex); - -#define ftdm_clear_pflag(obj, flag) (obj)->pflags &= ~(flag) - -#define ftdm_clear_pflag_locked(obj, flag) assert(obj->mutex != NULL); ftdm_mutex_lock(obj->mutex); (obj)->pflags &= ~(flag); ftdm_mutex_unlock(obj->mutex); - -#define ftdm_clear_sflag(obj, flag) (obj)->sflags &= ~(flag) - -#define ftdm_clear_sflag_locked(obj, flag) assert(obj->mutex != NULL); ftdm_mutex_lock(obj->mutex); (obj)->sflags &= ~(flag); ftdm_mutex_unlock(obj->mutex); - -#ifdef _MSC_VER -/* The while(0) below throws a conditional expression is constant warning */ -#pragma warning(disable:4127) -#endif - -/* this macro assumes obj is locked! */ -#define ftdm_wait_for_flag_cleared(obj, flag, time) \ - do { \ - int __safety = time; \ - while(__safety-- && ftdm_test_flag(obj, flag)) { \ - ftdm_mutex_unlock(obj->mutex); \ - ftdm_sleep(10); \ - ftdm_mutex_lock(obj->mutex); \ - } \ - if(!__safety) { \ - ftdm_log(FTDM_LOG_CRIT, "flag %"FTDM_UINT64_FMT" was never cleared\n", (uint64_t)flag); \ - } \ - } while(0); - -#define ftdm_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119) - -#ifdef __linux__ -#define ftdm_print_stack(level) \ - do { \ - void *__stacktrace[100] = { 0 }; \ - char **__symbols = NULL; \ - int __size = 0; \ - int __i = 0; \ - __size = backtrace(__stacktrace, ftdm_array_len(__stacktrace)); \ - __symbols = backtrace_symbols(__stacktrace, __size); \ - if (__symbols) { \ - for (__i = 0; __i < __size; __i++) { \ - ftdm_log(__level, "%s\n", __symbols[i]); \ - } \ - free(__symbols); \ - } \ - } while (0); -#else -#define ftdm_print_stack(level) ftdm_log(level, "FTDM_PRINT_STACK is not implemented in this operating system!\n"); -#endif - - -#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) -/*! - \brief Copy flags from one arbitrary object to another - \command dest the object to copy the flags to - \command src the object to copy the flags from - \command flags the flags to copy -*/ -#define ftdm_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) - -struct ftdm_stream_handle { - ftdm_stream_handle_write_function_t write_function; - ftdm_stream_handle_raw_write_function_t raw_write_function; - void *data; - void *end; - ftdm_size_t data_size; - ftdm_size_t data_len; - ftdm_size_t alloc_len; - ftdm_size_t alloc_chunk; -}; - -FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_raw_write(ftdm_stream_handle_t *handle, uint8_t *data, ftdm_size_t datalen); -FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_write(ftdm_stream_handle_t *handle, const char *fmt, ...); - -#define FTDM_CMD_CHUNK_LEN 1024 -#define FTDM_STANDARD_STREAM(s) memset(&s, 0, sizeof(s)); s.data = ftdm_malloc(FTDM_CMD_CHUNK_LEN); \ - assert(s.data); \ - memset(s.data, 0, FTDM_CMD_CHUNK_LEN); \ - s.end = s.data; \ - s.data_size = FTDM_CMD_CHUNK_LEN; \ - s.write_function = ftdm_console_stream_write; \ - s.raw_write_function = ftdm_console_stream_raw_write; \ - s.alloc_len = FTDM_CMD_CHUNK_LEN; \ - s.alloc_chunk = FTDM_CMD_CHUNK_LEN - -/*! brief create a new queue */ -#define ftdm_queue_create(queue, capacity) g_ftdm_queue_handler.create(queue, capacity) - -/*! Enqueue an object */ -#define ftdm_queue_enqueue(queue, obj) g_ftdm_queue_handler.enqueue(queue, obj) - -/*! dequeue an object from the queue */ -#define ftdm_queue_dequeue(queue) g_ftdm_queue_handler.dequeue(queue) - -/*! wait ms milliseconds for a queue to have available objects, -1 to wait forever */ -#define ftdm_queue_wait(queue, ms) g_ftdm_queue_handler.wait(queue, ms) - -/*! get the internal interrupt object (to wait for elements to be added from the outside bypassing ftdm_queue_wait) */ -#define ftdm_queue_get_interrupt(queue, ms) g_ftdm_queue_handler.get_interrupt(queue, ms) - -/*! destroy the queue */ -#define ftdm_queue_destroy(queue) g_ftdm_queue_handler.destroy(queue) - -FT_DECLARE_DATA extern ftdm_queue_handler_t g_ftdm_queue_handler; - -#define FTDM_TOKEN_STRLEN 128 -#define FTDM_MAX_TOKENS 10 - -static __inline__ char *ftdm_clean_string(char *s) -{ - char *p; - - for (p = s; p && *p; p++) { - uint8_t x = (uint8_t) *p; - if (x < 32 || x > 127) { - *p = ' '; - } - } - - return s; -} - -struct ftdm_bitstream { - uint8_t *data; - uint32_t datalen; - uint32_t byte_index; - uint8_t bit_index; - int8_t endian; - uint8_t top; - uint8_t bot; - uint8_t ss; - uint8_t ssv; -}; - -struct ftdm_fsk_data_state { - dsp_fsk_handle_t *fsk1200_handle; - uint8_t init; - uint8_t *buf; - size_t bufsize; - ftdm_size_t blen; - ftdm_size_t bpos; - ftdm_size_t dlen; - ftdm_size_t ppos; - int checksum; -}; - -struct ftdm_fsk_modulator { - teletone_dds_state_t dds; - ftdm_bitstream_t bs; - uint32_t carrier_bits_start; - uint32_t carrier_bits_stop; - uint32_t chan_sieze_bits; - uint32_t bit_factor; - uint32_t bit_accum; - uint32_t sample_counter; - int32_t samples_per_bit; - int32_t est_bytes; - fsk_modem_types_t modem_type; - ftdm_fsk_data_state_t *fsk_data; - ftdm_fsk_write_sample_t write_sample_callback; - void *user_data; - int16_t sample_buffer[64]; -}; - - -typedef enum { - FTDM_TYPE_NONE, - FTDM_TYPE_SPAN = 0xFF, - FTDM_TYPE_CHANNEL -} ftdm_data_type_t; - -/* number of bytes for the IO dump circular buffer (5 seconds worth of audio by default) */ -#define FTDM_IO_DUMP_DEFAULT_BUFF_SIZE 8 * 5000 -typedef struct { - char *buffer; - ftdm_size_t size; - int windex; - int wrapped; -} ftdm_io_dump_t; - -/* number of interval cycles before timeout and close the debug dtmf file (5 seconds if interval is 20) */ -#define DTMF_DEBUG_TIMEOUT 250 -typedef struct { - uint8_t enabled; - uint8_t requested; - FILE *file; - int32_t closetimeout; - ftdm_mutex_t *mutex; -} ftdm_dtmf_debug_t; - -typedef struct { - uint32_t duration_ms; - ftdm_time_t start_time; - /* If set to 1, we will send DTMF event the the tone starts, instead of waiting for end */ - uint8_t trigger_on_start; -} ftdm_dtmf_detect_t; - -/* 2^8 table size, one for each byte (sample) value */ -#define FTDM_GAINS_TABLE_SIZE 256 -struct ftdm_channel { - ftdm_data_type_t data_type; - uint32_t span_id; - uint32_t chan_id; - uint32_t physical_span_id; - uint32_t physical_chan_id; - uint32_t rate; - uint32_t extra_id; - ftdm_chan_type_t type; - ftdm_socket_t sockfd; - uint64_t flags; - uint32_t pflags; - uint32_t sflags; - uint8_t io_flags; - ftdm_alarm_flag_t alarm_flags; - ftdm_channel_feature_t features; - ftdm_codec_t effective_codec; - ftdm_codec_t native_codec; - uint32_t effective_interval; - uint32_t native_interval; - uint32_t packet_len; - ftdm_channel_state_t state; - ftdm_state_status_t state_status; - ftdm_channel_state_t last_state; - ftdm_channel_state_t init_state; - ftdm_channel_indication_t indication; - ftdm_state_history_entry_t history[10]; - uint8_t hindex; - ftdm_mutex_t *mutex; - teletone_dtmf_detect_state_t dtmf_detect; - uint32_t buffer_delay; - ftdm_event_t event_header; - char last_error[256]; - fio_event_cb_t event_callback; - uint32_t skip_read_frames; - ftdm_buffer_t *dtmf_buffer; - ftdm_buffer_t *gen_dtmf_buffer; - ftdm_buffer_t *pre_buffer; - ftdm_buffer_t *digit_buffer; - ftdm_buffer_t *fsk_buffer; - ftdm_mutex_t *pre_buffer_mutex; - uint32_t dtmf_on; - uint32_t dtmf_off; - char *dtmf_hangup_buf; - teletone_generation_session_t tone_session; - ftdm_time_t last_event_time; - ftdm_time_t ring_time; - char tokens[FTDM_MAX_TOKENS+1][FTDM_TOKEN_STRLEN]; - uint8_t needed_tones[FTDM_TONEMAP_INVALID]; - uint8_t detected_tones[FTDM_TONEMAP_INVALID]; - ftdm_tonemap_t last_detected_tone; - uint32_t token_count; - char chan_name[128]; - char chan_number[32]; - ftdm_filehandle_t fds[2]; - ftdm_fsk_data_state_t fsk; - uint8_t fsk_buf[80]; - uint32_t ring_count; - ftdm_polarity_t polarity; - /* Private I/O data. Do not touch unless you are an I/O module */ - void *io_data; - /* Private signaling data. Do not touch unless you are a signaling module */ - void *call_data; - struct ftdm_caller_data caller_data; - struct ftdm_span *span; - struct ftdm_io_interface *fio; - unsigned char rx_cas_bits; - uint32_t pre_buffer_size; - uint8_t rxgain_table[FTDM_GAINS_TABLE_SIZE]; - uint8_t txgain_table[FTDM_GAINS_TABLE_SIZE]; - float rxgain; - float txgain; - int availability_rate; - void *user_private; - ftdm_timer_id_t hangup_timer; - ftdm_channel_iostats_t iostats; - ftdm_dtmf_debug_t dtmfdbg; - ftdm_dtmf_detect_t dtmfdetect; - ftdm_io_dump_t rxdump; - ftdm_io_dump_t txdump; - ftdm_interrupt_t *state_completed_interrupt; /*!< Notify when a state change is completed */ - int32_t txdrops; - int32_t rxdrops; - ftdm_usrmsg_t *usrmsg; - ftdm_time_t last_state_change_time; - ftdm_time_t last_release_time; -}; - -struct ftdm_span { - ftdm_data_type_t data_type; - char *name; - uint32_t span_id; - uint32_t chan_count; - ftdm_span_flag_t flags; - struct ftdm_io_interface *fio; - fio_event_cb_t event_callback; - ftdm_mutex_t *mutex; - ftdm_trunk_type_t trunk_type; - ftdm_trunk_mode_t trunk_mode; - ftdm_analog_start_type_t start_type; - ftdm_signal_type_t signal_type; - uint32_t last_used_index; - /* Private signaling data. Do not touch unless you are a signaling module */ - void *signal_data; - fio_signal_cb_t signal_cb; - ftdm_event_t event_header; - char last_error[256]; - char tone_map[FTDM_TONEMAP_INVALID+1][FTDM_TONEMAP_LEN]; - teletone_tone_map_t tone_detect_map[FTDM_TONEMAP_INVALID+1]; - teletone_multi_tone_t tone_finder[FTDM_TONEMAP_INVALID+1]; - ftdm_channel_t *channels[FTDM_MAX_CHANNELS_SPAN+1]; - fio_channel_outgoing_call_t outgoing_call; - fio_channel_indicate_t indicate; - fio_channel_set_sig_status_t set_channel_sig_status; - fio_channel_get_sig_status_t get_channel_sig_status; - fio_span_set_sig_status_t set_span_sig_status; - fio_span_get_sig_status_t get_span_sig_status; - fio_channel_request_t channel_request; - ftdm_span_start_t start; - ftdm_span_stop_t stop; - ftdm_span_destroy_t destroy; - ftdm_channel_sig_read_t sig_read; - ftdm_channel_sig_write_t sig_write; - ftdm_channel_sig_dtmf_t sig_queue_dtmf; - ftdm_channel_sig_dtmf_t sig_send_dtmf; - uint32_t sig_release_guard_time_ms; - ftdm_channel_state_processor_t state_processor; /*!< This guy is called whenever state processing is required */ - void *io_data; /*!< Private I/O data per span. Do not touch unless you are an I/O module */ - char *type; - char *dtmf_hangup; - size_t dtmf_hangup_len; - ftdm_state_map_t *state_map; - ftdm_caller_data_t default_caller_data; - ftdm_queue_t *pendingchans; /*!< Channels pending of state processing */ - ftdm_queue_t *pendingsignals; /*!< Signals pending from being delivered to the user */ - struct ftdm_span *next; -}; - -struct ftdm_group { - char *name; - uint32_t group_id; - uint32_t chan_count; - ftdm_channel_t *channels[FTDM_MAX_CHANNELS_GROUP]; - uint32_t last_used_index; - ftdm_mutex_t *mutex; - struct ftdm_group *next; -}; - -FT_DECLARE_DATA extern ftdm_crash_policy_t g_ftdm_crash_policy; - -FT_DECLARE(ftdm_size_t) ftdm_fsk_modulator_generate_bit(ftdm_fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, ftdm_size_t buflen); -FT_DECLARE(int32_t) ftdm_fsk_modulator_generate_carrier_bits(ftdm_fsk_modulator_t *fsk_trans, uint32_t bits); -FT_DECLARE(void) ftdm_fsk_modulator_generate_chan_sieze(ftdm_fsk_modulator_t *fsk_trans); -FT_DECLARE(void) ftdm_fsk_modulator_send_data(ftdm_fsk_modulator_t *fsk_trans); -#define ftdm_fsk_modulator_send_all(_it) ftdm_fsk_modulator_generate_chan_sieze(_it); \ - ftdm_fsk_modulator_generate_carrier_bits(_it, _it->carrier_bits_start); \ - ftdm_fsk_modulator_send_data(_it); \ - ftdm_fsk_modulator_generate_carrier_bits(_it, _it->carrier_bits_stop) - -FT_DECLARE(ftdm_status_t) ftdm_fsk_modulator_init(ftdm_fsk_modulator_t *fsk_trans, - fsk_modem_types_t modem_type, - uint32_t sample_rate, - ftdm_fsk_data_state_t *fsk_data, - float db_level, - uint32_t carrier_bits_start, - uint32_t carrier_bits_stop, - uint32_t chan_sieze_bits, - ftdm_fsk_write_sample_t write_sample_callback, - void *user_data); -FT_DECLARE(int8_t) ftdm_bitstream_get_bit(ftdm_bitstream_t *bsp); -FT_DECLARE(void) ftdm_bitstream_init(ftdm_bitstream_t *bsp, uint8_t *data, uint32_t datalen, ftdm_endian_t endian, uint8_t ss); -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_parse(ftdm_fsk_data_state_t *state, ftdm_size_t *type, char **data, ftdm_size_t *len); -FT_DECLARE(ftdm_status_t) ftdm_fsk_demod_feed(ftdm_fsk_data_state_t *state, int16_t *data, size_t samples); -FT_DECLARE(ftdm_status_t) ftdm_fsk_demod_destroy(ftdm_fsk_data_state_t *state); -FT_DECLARE(int) ftdm_fsk_demod_init(ftdm_fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsize); -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_init(ftdm_fsk_data_state_t *state, uint8_t *data, uint32_t datalen); -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_mdmf(ftdm_fsk_data_state_t *state, ftdm_mdmf_type_t type, const uint8_t *data, uint32_t datalen); -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_checksum(ftdm_fsk_data_state_t *state); -FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_sdmf(ftdm_fsk_data_state_t *state, const char *date, char *number); -FT_DECLARE(ftdm_status_t) ftdm_channel_send_fsk_data(ftdm_channel_t *ftdmchan, ftdm_fsk_data_state_t *fsk_data, float db_level); - -FT_DECLARE(ftdm_status_t) ftdm_span_load_tones(ftdm_span_t *span, const char *mapname); - -FT_DECLARE(ftdm_status_t) ftdm_channel_use(ftdm_channel_t *ftdmchan); - -FT_DECLARE(void) ftdm_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor); - -FT_DECLARE(uint32_t) ftdm_separate_string(char *buf, char delim, char **array, int arraylen); -FT_DECLARE(void) print_bits(uint8_t *b, int bl, char *buf, int blen, int e, uint8_t ss); -FT_DECLARE(void) print_hex_bytes(uint8_t *data, ftdm_size_t dlen, char *buf, ftdm_size_t blen); - -FT_DECLARE_NONSTD(int) ftdm_hash_equalkeys(void *k1, void *k2); -FT_DECLARE_NONSTD(uint32_t) ftdm_hash_hashfromstring(void *ky); - -FT_DECLARE(int) ftdm_load_modules(void); - -FT_DECLARE(ftdm_status_t) ftdm_unload_modules(void); - -FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg); - -FT_DECLARE(void) ftdm_channel_clear_needed_tones(ftdm_channel_t *ftdmchan); -FT_DECLARE(void) ftdm_channel_rotate_tokens(ftdm_channel_t *ftdmchan); - -FT_DECLARE(int) ftdm_load_module(const char *name); -FT_DECLARE(int) ftdm_load_module_assume(const char *name); -FT_DECLARE(int) ftdm_vasprintf(char **ret, const char *fmt, va_list ap); - -FT_DECLARE(ftdm_status_t) ftdm_span_close_all(void); -FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); -FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_status_t status); - - -FT_DECLARE(ftdm_iterator_t *) ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); - -FT_DECLARE(ftdm_status_t) ftdm_channel_process_media(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen); - -FT_DECLARE(ftdm_status_t) ftdm_raw_read (ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen); -FT_DECLARE(ftdm_status_t) ftdm_raw_write (ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen); - -/*! - * \brief Retrieves an event from the span - * - * \note - * This function is non-reentrant and not thread-safe. - * The event returned may be modified if the function is called again - * from a different thread or even the same. It is recommended to - * handle events from the same span in a single thread. - * WARNING: this function used to be public ( in freetdm.h ) - * but since is really of no use to users better keep it here - * - * \param span The span to retrieve the event from - * \param event Pointer to store the pointer to the event - * - * \retval FTDM_SUCCESS success (at least one event available) - * \retval FTDM_TIMEOUT Timed out waiting for events - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event); - -/*! - * \brief Enqueue a DTMF string into the channel - * - * \param ftdmchan The channel to enqueue the dtmf string to - * \param dtmf null-terminated DTMF string - * - * \retval FTDM_SUCCESS success - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, const char *dtmf); - -/* dequeue pending signals and notify the user via the span signal callback */ -FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span); - -/*! \brief clear the tone detector state */ -FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); - -/*! \brief adjust echocanceller for beginning of call */ -FT_DECLARE(void) ftdm_set_echocancel_call_begin(ftdm_channel_t *chan); - -/*! \brief adjust echocanceller for end of call */ -FT_DECLARE(void) ftdm_set_echocancel_call_end(ftdm_channel_t *chan); - -/*! \brief save data from user */ -FT_DECLARE(ftdm_status_t) ftdm_channel_save_usrmsg(ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg); - -/*! \brief free usrmsg and variables/raw data attached to it */ -FT_DECLARE(ftdm_status_t) ftdm_usrmsg_free(ftdm_usrmsg_t **usrmsg); - -/*! \brief Get a custom variable from the user message - * \note The variable pointer returned is only valid while the before the event is processed and it'll be destroyed once the event is processed. */ -FT_DECLARE(const char *) ftdm_usrmsg_get_var(ftdm_usrmsg_t *usrmsg, const char *var_name); - -/*! \brief Get raw data from user message - * \param usrmsg The message structure containing the variables - * \param data data will point to available data pointer if available - * \param datalen datalen will be set to length of data available - * \retval FTDM_SUCCESS data is available - * \retval FTDM_FAIL no data available - * \note data is only valid within the duration of the callback, to receive a data pointer that does not get - * \note destroyed when callback returns, see ftdm_sigmsg_get_raw_data_detached - */ -FT_DECLARE(ftdm_status_t) ftdm_usrmsg_get_raw_data(ftdm_usrmsg_t *usrmsg, void **data, ftdm_size_t *datalen); - -/*! \brief free sigmsg and variables/raw data attached to it */ -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_free(ftdm_sigmsg_t **sigmsg); - -/*! \brief Add a custom variable to the event - * \note This variables may be used by signaling modules to override signaling parameters - * \todo Document which signaling variables are available - * */ -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_add_var(ftdm_sigmsg_t *sigmsg, const char *var_name, const char *value); - -/*! \brief Remove a custom variable from the event - * \note The variable pointer returned is only valid while the before the event is processed and it'll be destroyed once the event is processed. */ -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_remove_var(ftdm_sigmsg_t *sigmsg, const char *var_name); - -/*! \brief Attach raw data to sigmsg - * \param sigmsg The message structure containing the variables - * \param data pointer to data - * \param datalen datalen length of data - * \retval FTDM_SUCCESS success, data was successfully saved - * \retval FTDM_FAIL failed, event already had data attached to it. - * \note data must have been allocated using ftdm_calloc, FreeTDM will free data once the usrmsg is processed. - */ -FT_DECLARE(ftdm_status_t) ftdm_sigmsg_set_raw_data(ftdm_sigmsg_t *sigmsg, void *data, ftdm_size_t datalen); - -/*! \brief Retrieve a span and channel data structure from a string in the format 'span_id:chan_id'*/ -FT_DECLARE(ftdm_status_t) ftdm_get_channel_from_string(const char *string_id, ftdm_span_t **out_span, ftdm_channel_t **out_channel); - -/*! - \brief Assert condition -*/ -#define ftdm_assert(assertion, msg) \ - if (!(assertion)) { \ - ftdm_log(FTDM_LOG_CRIT, "%s", msg); \ - if (g_ftdm_crash_policy & FTDM_CRASH_ON_ASSERT) { \ - ftdm_abort(); \ - } \ - } - -/*! - \brief Assert condition and return -*/ -#define ftdm_assert_return(assertion, retval, msg) \ - if (!(assertion)) { \ - ftdm_log(FTDM_LOG_CRIT, "%s", msg); \ - if (g_ftdm_crash_policy & FTDM_CRASH_ON_ASSERT) { \ - ftdm_abort(); \ - } else { \ - return retval; \ - } \ - } - -/*! - \brief Socket the given socket - \command it the socket -*/ -#define ftdm_socket_close(it) if (it > -1) { close(it); it = -1;} - -#define ftdm_channel_lock(chan) ftdm_mutex_lock((chan)->mutex) -#define ftdm_channel_unlock(chan) ftdm_mutex_unlock((chan)->mutex) - -#define ftdm_log_throttle(level, ...) \ - time_current_throttle_log = ftdm_current_time_in_ms(); \ - if (time_current_throttle_log - time_last_throttle_log > FTDM_THROTTLE_LOG_INTERVAL) {\ - ftdm_log(level, __VA_ARGS__); \ - time_last_throttle_log = time_current_throttle_log; \ - } - -#define ftdm_log_chan_ex(fchan, file, func, line, level, format, ...) ftdm_log(file, func, line, level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) - -#define ftdm_log_chan_ex_msg(fchan, file, func, line, level, msg) ftdm_log(file, func, line, level, "[s%dc%d][%d:%d] " msg, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id) - -#define ftdm_log_chan(fchan, level, format, ...) ftdm_log(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) - -#define ftdm_log_chan_msg(fchan, level, msg) ftdm_log(level, "[s%dc%d][%d:%d] " msg, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id) - -#define ftdm_log_chan_throttle(fchan, level, format, ...) ftdm_log_throttle(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) -#define ftdm_log_chan_msg_throttle(fchan, level, format, ...) ftdm_log_throttle(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) - -#define ftdm_span_lock(span) ftdm_mutex_lock(span->mutex) -#define ftdm_span_unlock(span) ftdm_mutex_unlock(span->mutex) - -#define ftdm_test_and_set_media(fchan) \ - do { \ - if (!ftdm_test_flag((fchan), FTDM_CHANNEL_MEDIA)) { \ - ftdm_set_flag((fchan), FTDM_CHANNEL_MEDIA); \ - ftdm_set_echocancel_call_begin((fchan)); \ - if ((fchan)->dtmfdbg.requested) { \ - ftdm_channel_command((fchan), FTDM_COMMAND_ENABLE_DEBUG_DTMF, NULL); \ - } \ - } \ - } while (0); - -FT_DECLARE_DATA extern const char *FTDM_LEVEL_NAMES[9]; - -static __inline__ void ftdm_abort(void) -{ -#ifdef __cplusplus - ::abort(); -#else - abort(); -#endif -} - -static __inline__ int16_t ftdm_saturated_add(int16_t sample1, int16_t sample2) -{ - int addres; - - addres = sample1 + sample2; - if (addres > 32767) - addres = 32767; - else if (addres < -32767) - addres = -32767; - return (int16_t)addres; -} - -/* Bitmap helper functions */ -typedef long ftdm_bitmap_t; -#define FTDM_BITMAP_NBITS (sizeof(ftdm_bitmap_t) * 8) -#define ftdm_map_set_bit(map, bit) (map[(bit/FTDM_BITMAP_NBITS)] |= ((ftdm_bitmap_t)1 << (bit % FTDM_BITMAP_NBITS))) -#define ftdm_map_clear_bit(map, bit) (map[(bit/FTDM_BITMAP_NBITS)] &= ~((ftdm_bitmap_t)1 << (bit % FTDM_BITMAP_NBITS))) -#define ftdm_map_test_bit(map, bit) (map[(bit/FTDM_BITMAP_NBITS)] & ((ftdm_bitmap_t)1 << (bit % FTDM_BITMAP_NBITS))) - -#ifdef __cplusplus -} -#endif - -#endif /* endif __PRIVATE_FTDM_CORE__ */ diff --git a/libs/freetdm/src/include/private/ftdm_cpu_monitor.h b/libs/freetdm/src/include/private/ftdm_cpu_monitor.h deleted file mode 100644 index 249a5233c7..0000000000 --- a/libs/freetdm/src/include/private/ftdm_cpu_monitor.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Contributors: - * David Yat Sin - * - */ - -/*! \brief opaque cpu stats structure */ -struct ftdm_cpu_monitor_stats; - -/*! - * \brief create a new cpu monitor - * \return profile timer structure previously created with new_profile_timer, NULL on error - */ -FT_DECLARE(struct ftdm_cpu_monitor_stats*) ftdm_new_cpu_monitor(void); - -/*! - * \brief Deletes cpu_monitor - */ -FT_DECLARE(void) ftdm_delete_cpu_monitor(struct ftdm_cpu_monitor_stats *p); - -/*! - * \brief provides the percentage of idle system time - * \param p cpu_stats structure previously created with ftdm_new_cpu_monitor - * \param pointer to store the percentage of idle time - * \return -1 on error 0 for success - */ -FT_DECLARE(ftdm_status_t) ftdm_cpu_get_system_idle_time (struct ftdm_cpu_monitor_stats *p, double *idle_percentage); - - - - - -/* 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/freetdm/src/include/private/ftdm_sched.h b/libs/freetdm/src/include/private/ftdm_sched.h deleted file mode 100644 index 020da9fb3b..0000000000 --- a/libs/freetdm/src/include/private/ftdm_sched.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __FTDM_SCHED_H__ -#define __FTDM_SCHED_H__ - -#include "freetdm.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define FTDM_MICROSECONDS_PER_SECOND 1000000 - -typedef struct ftdm_sched ftdm_sched_t; -typedef void (*ftdm_sched_callback_t)(void *data); -typedef uint64_t ftdm_timer_id_t; - -/*! \brief Create a new scheduling context */ -FT_DECLARE(ftdm_status_t) ftdm_sched_create(ftdm_sched_t **sched, const char *name); - -/*! \brief Run the schedule to find timers that are expired and run its callbacks */ -FT_DECLARE(ftdm_status_t) ftdm_sched_run(ftdm_sched_t *sched); - -/*! \brief Run the schedule in its own thread. Callbacks will be called in a core thread. You *must* not block there! */ -FT_DECLARE(ftdm_status_t) ftdm_sched_free_run(ftdm_sched_t *sched); - -/*! - * \brief Schedule a new timer - * \param sched The scheduling context (required) - * \param name Timer name, typically unique but is not required to be unique, any null terminated string is fine (required) - * \param callback The callback to call upon timer expiration (required) - * \param data Optional data to pass to the callback - * \param timer Timer id pointer to store the id of the newly created timer. It can be null - * if you do not need to know the id, but you need this if you want to be able - * to cancel the timer with ftdm_sched_cancel_timer - */ -FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name, - int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_id_t *timer); - -/*! - * \brief Cancel the timer - * Note that there is a race between cancelling and triggering a timer. - * By the time you call this function the timer may be about to be triggered. - * This is specially true with timers in free run schedule. - * \param sched The scheduling context (required) - * \param timer The timer to cancel (required) - */ -FT_DECLARE(ftdm_status_t) ftdm_sched_cancel_timer(ftdm_sched_t *sched, ftdm_timer_id_t timer); - -/*! \brief Destroy the context and all of the scheduled timers in it */ -FT_DECLARE(ftdm_status_t) ftdm_sched_destroy(ftdm_sched_t **sched); - -/*! - * \brief Calculate the time to the next timer and return it - * \param sched The sched context - * \param timeto The pointer to store the next timer time in milliseconds - */ -FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *sched, int32_t *timeto); - -/*! \brief Global initialization, called just once, this is called by FreeTDM core, other users MUST not call it */ -FT_DECLARE(ftdm_status_t) ftdm_sched_global_init(void); - -/*! \brief Global destroy, called just once, this is called by FreeTDM core, other users MUST not call it */ -FT_DECLARE(ftdm_status_t) ftdm_sched_global_destroy(void); - -/*! \brief Checks if the main scheduling thread is running */ -FT_DECLARE(ftdm_bool_t) ftdm_free_sched_running(void); - -/*! \brief Stop the main scheduling thread (if running) */ -FT_DECLARE(ftdm_bool_t) ftdm_free_sched_stop(void); - -#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/freetdm/src/include/private/ftdm_state.h b/libs/freetdm/src/include/private/ftdm_state.h deleted file mode 100644 index 733a561dcc..0000000000 --- a/libs/freetdm/src/include/private/ftdm_state.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * Moises Silva - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __FTDM_STATE_H__ -#define __FTDM_STATE_H__ - -/*! \file - * \brief State handling definitions - * \note Most, if not all of the state handling functions assume you have a lock acquired. Touching the channel - * state is a sensitive matter that requires checks and careful thought and is typically a process that - * is not encapsulated within a single function, therefore the lock must be explicitly acquired by the - * caller (most of the time, signaling modules), process states, set a new state and process it, and - * finally unlock the channel. See docs/locking.txt fore more info - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - FTDM_CHANNEL_STATE_ANY = -1, - FTDM_CHANNEL_STATE_END = -1, - FTDM_CHANNEL_STATE_DOWN, - FTDM_CHANNEL_STATE_HOLD, - FTDM_CHANNEL_STATE_SUSPENDED, - FTDM_CHANNEL_STATE_DIALTONE, - FTDM_CHANNEL_STATE_COLLECT, - FTDM_CHANNEL_STATE_RING, - FTDM_CHANNEL_STATE_RINGING, - FTDM_CHANNEL_STATE_BUSY, - FTDM_CHANNEL_STATE_ATTN, - FTDM_CHANNEL_STATE_GENRING, - FTDM_CHANNEL_STATE_DIALING, - FTDM_CHANNEL_STATE_GET_CALLERID, - FTDM_CHANNEL_STATE_CALLWAITING, - FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_PROCEED, - FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, - FTDM_CHANNEL_STATE_UP, - FTDM_CHANNEL_STATE_TRANSFER, - FTDM_CHANNEL_STATE_IDLE, - FTDM_CHANNEL_STATE_TERMINATING, - FTDM_CHANNEL_STATE_CANCEL, - FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_HANGUP_COMPLETE, - FTDM_CHANNEL_STATE_IN_LOOP, - FTDM_CHANNEL_STATE_RESET, - FTDM_CHANNEL_STATE_INVALID -} ftdm_channel_state_t; -/* Purposely not adding ANY (-1) and END (-1) since FTDM_STR2ENUM_P works only on enums starting at zero */ -#define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \ - "RING", "RINGING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ - "RESTART", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "UP", "TRANSFER", "IDLE", "TERMINATING", "CANCEL", \ - "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "RESET", "INVALID" -FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t) - -typedef struct { - const char *file; - const char *func; - int line; - ftdm_channel_state_t state; /*!< Current state (processed or not) */ - ftdm_channel_state_t last_state; /*!< Previous state */ - ftdm_time_t time; /*!< Time the state was set */ - ftdm_time_t end_time; /*!< Time the state processing was completed */ -} ftdm_state_history_entry_t; - -typedef ftdm_status_t (*ftdm_channel_state_processor_t)(ftdm_channel_t *fchan); - -/*! - * \brief Process channel states by invoking the channel state processing routine - * it will keep calling the processing routine while the state status - * is FTDM_STATE_STATUS_NEW, it will not do anything otherwise - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan); - -FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const char *function, int line, ftdm_channel_t *fchan); -#define ftdm_channel_complete_state(obj) _ftdm_channel_complete_state(__FILE__, __FTDM_FUNC__, __LINE__, obj) -FT_DECLARE(int) ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state_t state); - -/*! - * \brief Status of the current channel state - * \note A given state goes thru several status (yes, states for the state!) - * The order is always FTDM_STATE_STATUS_NEW -> FTDM_STATE_STATUS_PROCESSED -> FTDM_STATUS_COMPLETED - * However, is possible to go from NEW -> COMPLETED directly when the signaling module explicitly changes - * the state of the channel in the middle of processing the current state by calling the ftdm_set_state() API - * - * FTDM_STATE_STATUS_NEW - - * Someone just set the state of the channel, either the signaling module or the user (implicitly through a call API). - * This is accomplished by calling ftdm_channel_set_state() which changes the 'state' and 'last_state' memebers of - * the ftdm_channel_t structure. - * - * FTDM_STATE_STATUS_PROCESSED - - * The signaling module did something based on the new state. - * - * This is accomplished via ftdm_channel_advance_states() - * - * When ftdm_channel_advance_states(), at the very least, if the channel has its state in FTDM_STATE_STATUS_NEW, it - * will move to FTDM_STATE_STATUS_PROCESSED, depending on what the signaling module does during the processing - * the state may move to FTDM_STATE_STATUS_COMPLETED right after or wait for a signaling specific event to complete it. - * It is also possible that more state transitions occur during the execution of ftdm_channel_advance_states() if one - * state processing/completion leads to another state change, the function will not return until the chain of events - * lead to a state that is not in FTDM_STATE_STATUS_NEW - * - * FTDM_STATE_STATUS_COMPLETED - - * The signaling module completed the processing of the state and there is nothing further to be done for this state. - * - * This is accomplished either explicitly by the signaling module by calling ftdm_channel_complete_state() or by - * the signaling module implicitly by trying to set the state of the channel to a new state via ftdm_set_state() - * - * When working with blocking channels (FTDM_CHANNEL_NONBLOCK flag not set), the user thread is signaled and unblocked - * so it can continue. - * - * When a state moves to this status is also possible for a signal FTDM_SIGEVENT_INDICATION_COMPLETED to be delivered - * by the core if the state change was associated to an indication requested by the user, - */ -typedef enum { - FTDM_STATE_STATUS_NEW, - FTDM_STATE_STATUS_PROCESSED, - FTDM_STATE_STATUS_COMPLETED, - FTDM_STATE_STATUS_INVALID -} ftdm_state_status_t; -#define CHANNEL_STATE_STATUS_STRINGS "NEW", "PROCESSED", "COMPLETED", "INVALID" -FTDM_STR2ENUM_P(ftdm_str2ftdm_state_status, ftdm_state_status2str, ftdm_state_status_t) - -typedef enum { - ZSM_NONE, - ZSM_UNACCEPTABLE, - ZSM_ACCEPTABLE -} ftdm_state_map_type_t; - -typedef enum { - ZSD_INBOUND, - ZSD_OUTBOUND, -} ftdm_state_direction_t; - -#define FTDM_MAP_NODE_SIZE 512 -#define FTDM_MAP_MAX FTDM_CHANNEL_STATE_INVALID+2 - -struct ftdm_state_map_node { - ftdm_state_direction_t direction; - ftdm_state_map_type_t type; - ftdm_channel_state_t check_states[FTDM_MAP_MAX]; - ftdm_channel_state_t states[FTDM_MAP_MAX]; -}; -typedef struct ftdm_state_map_node ftdm_state_map_node_t; - -struct ftdm_state_map { - ftdm_state_map_node_t nodes[FTDM_MAP_NODE_SIZE]; -}; -typedef struct ftdm_state_map ftdm_state_map_t; - -/*!\brief Cancel the state processing for a channel (the channel must be locked when calling this function) - * \note Only the core should use this function - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_cancel_state(const char *file, const char *func, int line, - ftdm_channel_t *ftdmchan); - -/*!\brief Set the state for a channel (the channel must be locked when calling this function) - * \note Signaling modules should use ftdm_set_state macro instead - * \note If this function is called with the wait parameter set to a non-zero value, the recursivity - * of the channel lock must be == 1 because the channel will be unlocked/locked when waiting */ -FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, - ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int wait, ftdm_usrmsg_t *usrmsg); - -/*!\brief Set the state of a channel immediately and implicitly complete the previous state if needed - * \note FTDM_SIGEVENT_INDICATION_COMPLETED will be sent if the state change - * is associated to some indication (ie FTDM_CHANNEL_INDICATE_PROCEED) - * \note The channel must be locked when calling this function - * */ -FT_DECLARE(ftdm_status_t) _ftdm_set_state(const char *file, const char *func, int line, - ftdm_channel_t *fchan, ftdm_channel_state_t state); -#define ftdm_set_state(obj, s) _ftdm_set_state(__FILE__, __FTDM_FUNC__, __LINE__, obj, s); \ - -/*!\brief This macro is deprecated, signaling modules should always lock the channel themselves anyways since they must - * process first the user pending state changes then set a new state before releasing the lock - * this macro is here for backwards compatibility, DO NOT USE IT in new code since it is *always* wrong to set - * a state in a signaling module without checking and processing the current state first (and for that you must lock the channel) - */ -#define ftdm_set_state_locked(obj, s) \ - do { \ - ftdm_channel_lock(obj); \ - ftdm_channel_set_state(__FILE__, __FTDM_FUNC__, __LINE__, obj, s, 0, NULL); \ - ftdm_channel_unlock(obj); \ - } while(0); - -#define ftdm_set_state_r(obj, s, r) r = ftdm_channel_set_state(__FILE__, __FTDM_FUNC__, __LINE__, obj, s, 0); - -#define ftdm_set_state_all(span, state) \ - do { \ - uint32_t _j; \ - ftdm_mutex_lock((span)->mutex); \ - for(_j = 1; _j <= (span)->chan_count; _j++) { \ - if (!FTDM_IS_DCHAN(span->channels[_j])) { \ - ftdm_set_state_locked((span->channels[_j]), state); \ - } \ - } \ - ftdm_mutex_unlock((span)->mutex); \ - } while (0); - -#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/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h deleted file mode 100755 index a498489af1..0000000000 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright (c) 2007-2014, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributors: - * - * Moises Silva - * - */ - -#ifndef FTDM_TYPES_H -#define FTDM_TYPES_H - -#include "freetdm.h" - -#include "fsk.h" - -#ifdef WIN32 -typedef intptr_t ftdm_ssize_t; -typedef int ftdm_filehandle_t; -#else -#include -#include -#include -typedef ssize_t ftdm_ssize_t; -typedef int ftdm_filehandle_t; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define FTDM_COMMAND_OBJ_SIZE *((ftdm_size_t *)obj) -#define FTDM_COMMAND_OBJ_INT *((int *)obj) -#define FTDM_COMMAND_OBJ_CHAR_P (char *)obj -#define FTDM_COMMAND_OBJ_FLOAT *(float *)obj -#define FTDM_FSK_MOD_FACTOR 0x10000 -#define FTDM_DEFAULT_DTMF_ON 250 -#define FTDM_DEFAULT_DTMF_OFF 50 - -typedef enum { - FTDM_ENDIAN_BIG = 1, - FTDM_ENDIAN_LITTLE = -1 -} ftdm_endian_t; - -typedef enum { - FTDM_CID_TYPE_SDMF = 0x04, - FTDM_CID_TYPE_MDMF = 0x80 -} ftdm_cid_type_t; - -typedef enum { - MDMF_DATETIME = 1, - MDMF_PHONE_NUM = 2, - MDMF_DDN = 3, - MDMF_NO_NUM = 4, - MDMF_PHONE_NAME = 7, - MDMF_NO_NAME = 8, - MDMF_ALT_ROUTE = 9, - MDMF_INVALID = 10 -} ftdm_mdmf_type_t; -#define MDMF_STRINGS "X", "DATETIME", "PHONE_NUM", "DDN", "NO_NUM", "X", "X", "PHONE_NAME", "NO_NAME", "ALT_ROUTE", "INVALID" -FTDM_STR2ENUM_P(ftdm_str2ftdm_mdmf_type, ftdm_mdmf_type2str, ftdm_mdmf_type_t) - -#define FTDM_TONEMAP_LEN 128 -typedef enum { - FTDM_TONEMAP_NONE, - FTDM_TONEMAP_DIAL, - FTDM_TONEMAP_RING, - FTDM_TONEMAP_BUSY, - FTDM_TONEMAP_FAIL1, - FTDM_TONEMAP_FAIL2, - FTDM_TONEMAP_FAIL3, - FTDM_TONEMAP_ATTN, - FTDM_TONEMAP_CALLWAITING_CAS, - FTDM_TONEMAP_CALLWAITING_SAS, - FTDM_TONEMAP_CALLWAITING_ACK, - FTDM_TONEMAP_INVALID -} ftdm_tonemap_t; -#define TONEMAP_STRINGS "NONE", "DIAL", "RING", "BUSY", "FAIL1", "FAIL2", "FAIL3", "ATTN", "CALLWAITING-CAS", "CALLWAITING-SAS", "CALLWAITING-ACK", "INVALID" -FTDM_STR2ENUM_P(ftdm_str2ftdm_tonemap, ftdm_tonemap2str, ftdm_tonemap_t) - -typedef enum { - FTDM_ANALOG_START_KEWL, - FTDM_ANALOG_START_LOOP, - FTDM_ANALOG_START_GROUND, - FTDM_ANALOG_START_WINK, - FTDM_ANALOG_START_NA -} ftdm_analog_start_type_t; -#define START_TYPE_STRINGS "KEWL", "LOOP", "GROUND", "WINK", "NA" -FTDM_STR2ENUM_P(ftdm_str2ftdm_analog_start_type, ftdm_analog_start_type2str, ftdm_analog_start_type_t) - -typedef enum { - FTDM_OOB_NOOP, - FTDM_OOB_ONHOOK, - FTDM_OOB_OFFHOOK, - FTDM_OOB_WINK, - FTDM_OOB_FLASH, - FTDM_OOB_RING_START, - FTDM_OOB_RING_STOP, - FTDM_OOB_ALARM_TRAP, - FTDM_OOB_ALARM_CLEAR, - FTDM_OOB_CAS_BITS_CHANGE, - FTDM_OOB_POLARITY_REVERSE, - FTDM_OOB_INVALID -} ftdm_oob_event_t; -#define OOB_STRINGS "NOOP", "ONHOOK", "OFFHOOK", "WINK", "FLASH", "RING_START", "RING_STOP", "ALARM_TRAP", "ALARM_CLEAR", "CAS_BITS_CHANGE", "POLARITY_REVERSE", "INVALID" -FTDM_STR2ENUM_P(ftdm_str2ftdm_oob_event, ftdm_oob_event2str, ftdm_oob_event_t) - -/*! \brief Event types */ -typedef enum { - FTDM_EVENT_NONE, - /* DTMF digit was just detected */ - FTDM_EVENT_DTMF, - /* Out of band event */ - FTDM_EVENT_OOB, - FTDM_EVENT_COUNT -} ftdm_event_type_t; - -/*! \brief Generic event data type */ -struct ftdm_event { - ftdm_event_type_t e_type; - uint32_t enum_id; - ftdm_channel_t *channel; - void *data; -}; - -typedef enum { - FTDM_SIGTYPE_NONE, - FTDM_SIGTYPE_ISDN, - FTDM_SIGTYPE_RBS, - FTDM_SIGTYPE_ANALOG, - FTDM_SIGTYPE_SANGOMABOOST, - FTDM_SIGTYPE_M3UA, - FTDM_SIGTYPE_M2UA, - FTDM_SIGTYPE_R2, - FTDM_SIGTYPE_SS7, - FTDM_SIGTYPE_GSM -} ftdm_signal_type_t; - -typedef enum { - FTDM_SPAN_CONFIGURED = (1 << 0), - FTDM_SPAN_STARTED = (1 << 1), - FTDM_SPAN_STATE_CHANGE = (1 << 2), - FTDM_SPAN_SUSPENDED = (1 << 3), - FTDM_SPAN_IN_THREAD = (1 << 4), - FTDM_SPAN_STOP_THREAD = (1 << 5), - /*! Signaling modules set this flag to use fchan->pendingchans queue instead - * of the FTDM_SPAN_STATE_CHANGE flag to detect when there is channels with - * a state change pending in the span. If you set this member you can't rely - * on FTDM_SPAN_STATE_CHANGE anymore and must use the queue only instead. This - * is the new way of detecting state changes, new modules should always set this - * flag, the old modules still relying on FTDM_SPAN_STATE_CHANGE should be updated */ - FTDM_SPAN_USE_CHAN_QUEUE = (1 << 6), - FTDM_SPAN_SUGGEST_CHAN_ID = (1 << 7), - FTDM_SPAN_USE_AV_RATE = (1 << 8), - FTDM_SPAN_PWR_SAVING = (1 << 9), - /* If you use this flag, you MUST call ftdm_span_trigger_signals to deliver the user signals - * after having called ftdm_send_span_signal(), which with this flag it will just enqueue the signal - * for later delivery */ - FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 10), - /* If this flag is set, channel will be moved to proceed state when calls goes to routing */ - FTDM_SPAN_USE_PROCEED_STATE = (1 << 11), - /* If this flag is set, the signalling module supports jumping directly to state up, without - going through PROGRESS/PROGRESS_MEDIA */ - FTDM_SPAN_USE_SKIP_STATES = (1 << 12), - /* If this flag is set, then this span cannot be stopped individually, it can only be stopped - on freetdm unload */ - FTDM_SPAN_NON_STOPPABLE = (1 << 13), - /* If this flag is set, then this span supports TRANSFER state */ - FTDM_SPAN_USE_TRANSFER = (1 << 14), - /* This is the last flag, no more flags bigger than this */ - FTDM_SPAN_MAX_FLAG = (1 << 15), -} ftdm_span_flag_t; - -/*! \brief Channel supported features */ -typedef enum { - FTDM_CHANNEL_FEATURE_DTMF_DETECT = (1 << 0), /*!< Channel can detect DTMF (read-only) */ - FTDM_CHANNEL_FEATURE_DTMF_GENERATE = (1 << 1), /*!< Channel can generate DTMF (read-only) */ - FTDM_CHANNEL_FEATURE_CODECS = (1 << 2), /*!< Channel can do transcoding (read-only) */ - FTDM_CHANNEL_FEATURE_INTERVAL = (1 << 3), /*!< Channel support i/o interval configuration (read-only) */ - FTDM_CHANNEL_FEATURE_CALLERID = (1 << 4), /*!< Channel can detect caller id (read-only) */ - FTDM_CHANNEL_FEATURE_PROGRESS = (1 << 5), /*!< Channel can detect inband progress (read-only) */ - FTDM_CHANNEL_FEATURE_CALLWAITING = (1 << 6), /*!< Channel will allow call waiting (ie: FXS devices) (read/write) */ - FTDM_CHANNEL_FEATURE_HWEC = (1<<7), /*!< Channel has a hardware echo canceller */ - FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE = (1<<8), /*!< hardware echo canceller is disabled when there are no calls on this channel */ - FTDM_CHANNEL_FEATURE_IO_STATS = (1<<9), /*!< Channel supports IO statistics (HDLC channels only) */ - FTDM_CHANNEL_FEATURE_MF_GENERATE = (1<<10), /*!< Channel can generate R2 MF tones (read-only) */ -} ftdm_channel_feature_t; - -/*! \brief Channel IO pending flags */ -typedef enum { - FTDM_CHANNEL_IO_EVENT = (1 << 0), - FTDM_CHANNEL_IO_READ = (1 << 1), - FTDM_CHANNEL_IO_WRITE = (1 << 2), -} ftdm_channel_io_flags_t; - -/*!< Channel flags. This used to be an enum but we reached the 32bit limit for enums, is safer this way */ -#define FTDM_CHANNEL_CONFIGURED (1ULL << 0) -#define FTDM_CHANNEL_READY (1ULL << 1) -#define FTDM_CHANNEL_OPEN (1ULL << 2) -#define FTDM_CHANNEL_DTMF_DETECT (1ULL << 3) -#define FTDM_CHANNEL_SUPRESS_DTMF (1ULL << 4) -#define FTDM_CHANNEL_TRANSCODE (1ULL << 5) -#define FTDM_CHANNEL_BUFFER (1ULL << 6) -#define FTDM_CHANNEL_INTHREAD (1ULL << 8) -#define FTDM_CHANNEL_WINK (1ULL << 9) -#define FTDM_CHANNEL_FLASH (1ULL << 10) -#define FTDM_CHANNEL_STATE_CHANGE (1ULL << 11) -#define FTDM_CHANNEL_HOLD (1ULL << 12) -#define FTDM_CHANNEL_INUSE (1ULL << 13) -#define FTDM_CHANNEL_OFFHOOK (1ULL << 14) -#define FTDM_CHANNEL_RINGING (1ULL << 15) -#define FTDM_CHANNEL_PROGRESS_DETECT (1ULL << 16) -#define FTDM_CHANNEL_CALLERID_DETECT (1ULL << 17) -#define FTDM_CHANNEL_OUTBOUND (1ULL << 18) -#define FTDM_CHANNEL_SUSPENDED (1ULL << 19) -#define FTDM_CHANNEL_3WAY (1ULL << 20) -#define FTDM_CHANNEL_PROGRESS (1ULL << 21) -/*!< There is media on the channel already */ -#define FTDM_CHANNEL_MEDIA (1ULL << 22) -/*!< The channel was answered */ -#define FTDM_CHANNEL_ANSWERED (1ULL << 23) -#define FTDM_CHANNEL_MUTE (1ULL << 24) -#define FTDM_CHANNEL_USE_RX_GAIN (1ULL << 25) -#define FTDM_CHANNEL_USE_TX_GAIN (1ULL << 26) -#define FTDM_CHANNEL_IN_ALARM (1ULL << 27) -#define FTDM_CHANNEL_SIG_UP (1ULL << 28) -#define FTDM_CHANNEL_USER_HANGUP (1ULL << 29) -#define FTDM_CHANNEL_RX_DISABLED (1ULL << 30) -#define FTDM_CHANNEL_TX_DISABLED (1ULL << 31) -/*!< The user knows about a call in this channel */ -#define FTDM_CHANNEL_CALL_STARTED (1ULL << 32) -/*!< The user wants non-blocking operations in the channel */ -#define FTDM_CHANNEL_NONBLOCK (1ULL << 33) -/*!< There is a pending acknowledge for an indication */ -#define FTDM_CHANNEL_IND_ACK_PENDING (1ULL << 34) -/*!< There is someone blocking in the channel waiting for state completion */ -#define FTDM_CHANNEL_BLOCKING (1ULL << 35) -/*!< Media is digital */ -#define FTDM_CHANNEL_DIGITAL_MEDIA (1ULL << 36) -/*!< Native signaling bridge is enabled */ -#define FTDM_CHANNEL_NATIVE_SIGBRIDGE (1ULL << 37) -/*!< Native signaling DTMF detection */ -#define FTDM_CHANNEL_SIG_DTMF_DETECTION (1ULL << 38) - -/*!< This no more flags after this flag */ -#define FTDM_CHANNEL_MAX_FLAG (1ULL << 39) -/*! - * - * 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. - * - * $Id: g711.h,v 1.1 2006/06/07 15:46:39 steveu Exp $ - */ - -/*! \file */ - -/*! \page 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. -*/ - -#if !defined(_G711_H_) -#define _G711_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _MSC_VER -#ifndef __inline__ -#define __inline__ __inline -#endif - typedef unsigned __int8 uint8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef unsigned __int16 uint16_t; -#else -#include -#endif - -#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 __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 __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 __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 __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 __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 __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 __inline__ uint8_t linear_to_ulaw(int linear) - { - uint8_t u_val; - int mask; - int seg; - - /* Get the sign and the magnitude of the value. */ - if (linear < 0) - { - linear = ULAW_BIAS - linear; - 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 = (uint8_t) (0x7F ^ mask); - else - u_val = (uint8_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 __inline__ int16_t ulaw_to_linear(uint8_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 (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 __inline__ uint8_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 - 8; - } - - /* 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 (uint8_t) (0x7F ^ mask); - } - /* We must be just a tiny step below zero */ - return (uint8_t) (0x00 ^ mask); - } - /* Combine the sign, segment, and quantization bits. */ - return (uint8_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 __inline__ int16_t alaw_to_linear(uint8_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 (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. - */ - uint8_t alaw_to_ulaw(uint8_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. - */ - uint8_t ulaw_to_alaw(uint8_t ulaw); - -#ifdef __cplusplus -} -#endif - -#endif -/*- End of file ------------------------------------------------------------*/ - -/* 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/freetdm/src/include/private/hashtable.h b/libs/freetdm/src/include/private/hashtable.h deleted file mode 100644 index 5d029b5b85..0000000000 --- a/libs/freetdm/src/include/private/hashtable.h +++ /dev/null @@ -1,235 +0,0 @@ -/* Copyright (C) 2002 Christopher Clark */ - -#ifndef __HASHTABLE_CWC22_H__ -#define __HASHTABLE_CWC22_H__ -#ifdef _MSC_VER -#ifndef __inline__ -#define __inline__ __inline -#endif -#endif -#include "freetdm.h" - -#ifdef __cplusplus -extern "C" { -#endif -struct hashtable; -struct hashtable_iterator; - -/* Example of use: - * - * struct hashtable *h; - * struct some_key *k; - * struct some_value *v; - * - * static unsigned int hash_from_key_fn( void *k ); - * static int keys_equal_fn ( void *key1, void *key2 ); - * - * h = create_hashtable(16, hash_from_key_fn, keys_equal_fn); - * k = (struct some_key *) malloc(sizeof(struct some_key)); - * v = (struct some_value *) malloc(sizeof(struct some_value)); - * - * (initialise k and v to suitable values) - * - * if (! hashtable_insert(h,k,v) ) - * { exit(-1); } - * - * if (NULL == (found = hashtable_search(h,k) )) - * { printf("not found!"); } - * - * if (NULL == (found = hashtable_remove(h,k) )) - * { printf("Not found\n"); } - * - */ - -/* Macros may be used to define type-safe(r) hashtable access functions, with - * methods specialized to take known key and value types as parameters. - * - * Example: - * - * Insert this at the start of your file: - * - * DEFINE_HASHTABLE_INSERT(insert_some, struct some_key, struct some_value); - * DEFINE_HASHTABLE_SEARCH(search_some, struct some_key, struct some_value); - * DEFINE_HASHTABLE_REMOVE(remove_some, struct some_key, struct some_value); - * - * This defines the functions 'insert_some', 'search_some' and 'remove_some'. - * These operate just like hashtable_insert etc., with the same parameters, - * but their function signatures have 'struct some_key *' rather than - * 'void *', and hence can generate compile time errors if your program is - * supplying incorrect data as a key (and similarly for value). - * - * Note that the hash and key equality functions passed to create_hashtable - * still take 'void *' parameters instead of 'some key *'. This shouldn't be - * a difficult issue as they're only defined and passed once, and the other - * functions will ensure that only valid keys are supplied to them. - * - * The cost for this checking is increased code size and runtime overhead - * - if performance is important, it may be worth switching back to the - * unsafe methods once your program has been debugged with the safe methods. - * This just requires switching to some simple alternative defines - eg: - * #define insert_some hashtable_insert - * - */ - -/***************************************************************************** - * create_hashtable - - * @name create_hashtable - * @param minsize minimum initial size of hashtable - * @param hashfunction function for hashing keys - * @param key_eq_fn function for determining key equality - * @return newly created hashtable or NULL on failure - */ - -FT_DECLARE(struct hashtable *) -create_hashtable(unsigned int minsize, - unsigned int (*hashfunction) (void*), - int (*key_eq_fn) (void*,void*)); - -/***************************************************************************** - * hashtable_insert - - * @name hashtable_insert - * @param h the hashtable to insert into - * @param k the key - hashtable claims ownership and will free on removal - * @param v the value - does not claim ownership - * @return non-zero for successful insertion - * - * This function will cause the table to expand if the insertion would take - * the ratio of entries to table size over the maximum load factor. - * - * This function does not check for repeated insertions with a duplicate key. - * The value returned when using a duplicate key is undefined -- when - * the hashtable changes size, the order of retrieval of duplicate key - * entries is reversed. - * If in doubt, remove before insert. - */ - - -typedef enum { - HASHTABLE_FLAG_NONE = 0, - HASHTABLE_FLAG_FREE_KEY = (1 << 0), - HASHTABLE_FLAG_FREE_VALUE = (1 << 1) -} hashtable_flag_t; - -FT_DECLARE(int) -hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags); - -#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \ - int fnname (struct hashtable *h, keytype *k, valuetype *v) \ - { \ - return hashtable_insert(h,k,v); \ - } - -/***************************************************************************** - * hashtable_search - - * @name hashtable_search - * @param h the hashtable to search - * @param k the key to search for - does not claim ownership - * @return the value associated with the key, or NULL if none found - */ - -FT_DECLARE(void *) -hashtable_search(struct hashtable *h, void *k); - -#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \ - valuetype * fnname (struct hashtable *h, keytype *k) \ - { \ - return (valuetype *) (hashtable_search(h,k)); \ - } - -/***************************************************************************** - * hashtable_remove - - * @name hashtable_remove - * @param h the hashtable to remove the item from - * @param k the key to search for - does not claim ownership - * @return the value associated with the key, or NULL if none found - */ - -FT_DECLARE(void *) /* returns value */ -hashtable_remove(struct hashtable *h, void *k); - -#define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \ - valuetype * fnname (struct hashtable *h, keytype *k) \ - { \ - return (valuetype *) (hashtable_remove(h,k)); \ - } - - -/***************************************************************************** - * hashtable_count - - * @name hashtable_count - * @param h the hashtable - * @return the number of items stored in the hashtable - */ -FT_DECLARE(unsigned int) -hashtable_count(struct hashtable *h); - - -/***************************************************************************** - * hashtable_destroy - - * @name hashtable_destroy - * @param h the hashtable - * @param free_values whether to call 'free' on the remaining values - */ - -FT_DECLARE(void) -hashtable_destroy(struct hashtable *h); - -FT_DECLARE(struct hashtable_iterator*) hashtable_first(struct hashtable *h); -FT_DECLARE(struct hashtable_iterator*) hashtable_next(struct hashtable_iterator *i); -FT_DECLARE(void) hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val); - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* __HASHTABLE_CWC22_H__ */ - -/* - * Copyright (c) 2002, Christopher Clark - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* 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/freetdm/src/include/private/hashtable_itr.h b/libs/freetdm/src/include/private/hashtable_itr.h deleted file mode 100644 index bf0a6e19d0..0000000000 --- a/libs/freetdm/src/include/private/hashtable_itr.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright (C) 2002, 2004 Christopher Clark */ - -#ifndef __HASHTABLE_ITR_CWC22__ -#define __HASHTABLE_ITR_CWC22__ -#include "hashtable.h" -#include "hashtable_private.h" /* needed to enable inlining */ - -#ifdef __cplusplus -extern "C" { -#endif -/*****************************************************************************/ -/* This struct is only concrete here to allow the inlining of two of the - * accessor functions. */ -struct hashtable_itr -{ - struct hashtable *h; - struct entry *e; - struct entry *parent; - unsigned int index; -}; - - -/*****************************************************************************/ -/* hashtable_iterator - */ - -struct hashtable_itr * -hashtable_iterator(struct hashtable *h); - -/*****************************************************************************/ -/* hashtable_iterator_key - * - return the value of the (key,value) pair at the current position */ -extern __inline__ void * -hashtable_iterator_key(struct hashtable_itr *i); - -extern __inline__ void * -hashtable_iterator_key(struct hashtable_itr *i) -{ - return i->e->k; -} - -/*****************************************************************************/ -/* value - return the value of the (key,value) pair at the current position */ - -extern __inline__ void * -hashtable_iterator_value(struct hashtable_itr *i); - -extern __inline__ void * -hashtable_iterator_value(struct hashtable_itr *i) -{ - return i->e->v; -} - -/*****************************************************************************/ -/* advance - advance the iterator to the next element - * returns zero if advanced to end of table */ - -int -hashtable_iterator_advance(struct hashtable_itr *itr); - -/*****************************************************************************/ -/* remove - remove current element and advance the iterator to the next element - * NB: if you need the value to free it, read it before - * removing. ie: beware memory leaks! - * returns zero if advanced to end of table */ - -int -hashtable_iterator_remove(struct hashtable_itr *itr); - -/*****************************************************************************/ -/* search - overwrite the supplied iterator, to point to the entry - * matching the supplied key. - h points to the hashtable to be searched. - * returns zero if not found. */ -int -hashtable_iterator_search(struct hashtable_itr *itr, - struct hashtable *h, void *k); - -#define DEFINE_HASHTABLE_ITERATOR_SEARCH(fnname, keytype) \ - int fnname (struct hashtable_itr *i, struct hashtable *h, keytype *k) \ - { \ - return (hashtable_iterator_search(i,h,k)); \ - } - -#ifdef __cplusplus -} -#endif - -#endif /* __HASHTABLE_ITR_CWC22__*/ - -/* - * Copyright (c) 2002, 2004, Christopher Clark - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* 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/freetdm/src/include/private/hashtable_private.h b/libs/freetdm/src/include/private/hashtable_private.h deleted file mode 100644 index 35f22091ef..0000000000 --- a/libs/freetdm/src/include/private/hashtable_private.h +++ /dev/null @@ -1,110 +0,0 @@ -/* Copyright (C) 2002, 2004 Christopher Clark */ - -#ifndef __HASHTABLE_PRIVATE_CWC22_H__ -#define __HASHTABLE_PRIVATE_CWC22_H__ - -#include "hashtable.h" - -#ifdef __cplusplus -extern "C" { -#endif -/*****************************************************************************/ - -struct entry -{ - void *k, *v; - unsigned int h; - hashtable_flag_t flags; - struct entry *next; -}; - -struct hashtable_iterator { - unsigned int pos; - struct entry *e; - struct hashtable *h; -}; - -struct hashtable { - unsigned int tablelength; - struct entry **table; - unsigned int entrycount; - unsigned int loadlimit; - unsigned int primeindex; - unsigned int (*hashfn) (void *k); - int (*eqfn) (void *k1, void *k2); - struct hashtable_iterator iterator; -}; - -/*****************************************************************************/ -unsigned int -hash(struct hashtable *h, void *k); - -/*****************************************************************************/ -/* indexFor */ -static __inline__ unsigned int -indexFor(unsigned int tablelength, unsigned int hashvalue) { - return (hashvalue % tablelength); -} - -/* Only works if tablelength == 2^N */ -/*static inline unsigned int - indexFor(unsigned int tablelength, unsigned int hashvalue) - { - return (hashvalue & (tablelength - 1u)); - } -*/ - -/*****************************************************************************/ -#define freekey(X) free(X) -/*define freekey(X) ; */ - -#ifdef __cplusplus -} -#endif - -/*****************************************************************************/ - -#endif /* __HASHTABLE_PRIVATE_CWC22_H__*/ - -/* - * Copyright (c) 2002, Christopher Clark - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* 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/freetdm/src/include/private/libteletone.h b/libs/freetdm/src/include/private/libteletone.h deleted file mode 100644 index 060a226032..0000000000 --- a/libs/freetdm/src/include/private/libteletone.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * libteletone - * 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 libteletone - * - * 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 - * - * - * libteletone.h -- Tone Generator/Detector - * - * - * - * Exception: - * The author hereby grants the use of this source code under the - * following license if and only if the source code is distributed - * as part of the OpenZAP or FreeTDM library. Any use or distribution of this - * source code outside the scope of the OpenZAP or FreeTDM library will nullify the - * following license and reinact the MPL 1.1 as stated above. - * - * Copyright (c) 2007, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef LIBTELETONE_H -#define LIBTELETONE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define TELETONE_MAX_DTMF_DIGITS 128 -#define TELETONE_MAX_TONES 18 -#define TELETONE_TONE_RANGE 127 - -typedef double teletone_process_t; - -/*! \file libteletone.h - \brief Top level include file - - This file should be included by applications using the library -*/ - -/*! \brief An abstraction to store a tone mapping */ -typedef struct { - /*! An array of tone frequencies */ - teletone_process_t freqs[TELETONE_MAX_TONES]; -} teletone_tone_map_t; - -#if !defined(M_PI) -/* C99 systems may not define M_PI */ -#define M_PI 3.14159265358979323846264338327 -#endif - -#ifdef _MSC_VER -typedef __int16 int16_t; -#endif - -#if (_MSC_VER >= 1400) // VC8+ -#define teletone_assert(expr) assert(expr);__analysis_assume( expr ) -#else -#define teletone_assert(expr) assert(expr) -#endif - -#ifdef _MSC_VER -#if defined(TT_DECLARE_STATIC) -#define TELETONE_API(type) type __stdcall -#define TELETONE_API_NONSTD(type) type __cdecl -#define TELETONE_API_DATA -#elif defined(TELETONE_EXPORTS) -#define TELETONE_API(type) __declspec(dllexport) type __stdcall -#define TELETONE_API_NONSTD(type) __declspec(dllexport) type __cdecl -#define TELETONE_API_DATA __declspec(dllexport) -#else -#define TELETONE_API(type) __declspec(dllimport) type __stdcall -#define TELETONE_API_NONSTD(type) __declspec(dllimport) type __cdecl -#define TELETONE_API_DATA __declspec(dllimport) -#endif -#else -#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY) -#define TELETONE_API(type) __attribute__((visibility("default"))) type -#define TELETONE_API_NONSTD(type) __attribute__((visibility("default"))) type -#define TELETONE_API_DATA __attribute__((visibility("default"))) -#else -#define TELETONE_API(type) type -#define TELETONE_API_NONSTD(type) type -#define TELETONE_API_DATA -#endif -#endif - -#include "libteletone_generate.h" -#include "libteletone_detect.h" - -#ifdef HAVE_STRING_H -#include -#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/freetdm/src/include/private/libteletone_detect.h b/libs/freetdm/src/include/private/libteletone_detect.h deleted file mode 100644 index 646b03e1be..0000000000 --- a/libs/freetdm/src/include/private/libteletone_detect.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * libteletone - * 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 tone_detect.c - General telephony tone detection, and specific detection of DTMF. - * - * - * The Initial Developer of the Original Code is - * Stephen Underwood - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * The the original interface designed by Steve Underwood was preserved to retain - *the optimizations when considering DTMF tones though the names were changed in the interest - * of namespace. - * - * Much less efficient expansion interface was added to allow for the detection of - * a single arbitrary tone combination which may also exceed 2 simultaneous tones. - * (controlled by compile time constant TELETONE_MAX_TONES) - * - * Copyright (C) 2006 Anthony Minessale II - * - * - * libteletone_detect.c Tone Detection Code - * - * - ********************************************************************************* - * - * Derived from tone_detect.h - General telephony tone detection, and specific - * detection of DTMF. - * - * 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. - * - * - * Exception: - * The author hereby grants the use of this source code under the - * following license if and only if the source code is distributed - * as part of the OpenZAP or FreeTDM library. Any use or distribution of this - * source code outside the scope of the OpenZAP or FreeTDM library will nullify the - * following license and reinact the MPL 1.1 as stated above. - * - * Copyright (c) 2007, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef LIBTELETONE_DETECT_H -#define LIBTELETONE_DETECT_H - -#ifdef __cplusplus -extern "C" { -#endif -#include "libteletone.h" - - /*! \file libteletone_detect.h - \brief Tone Detection Routines - - This module is responsible for tone detection specifics - */ - -#ifndef FALSE -#define FALSE 0 -#ifndef TRUE -#define TRUE (!FALSE) -#endif -#endif - - /* Basic DTMF specs: - * - * Minimum tone on = 40ms - * Minimum tone off = 50ms - * Maximum digit rate = 10 per second - * Normal twist <= 8dB accepted - * Reverse twist <= 4dB accepted - * S/N >= 15dB will detect OK - * Attenuation <= 26dB will detect OK - * Frequency tolerance +- 1.5% will detect, +-3.5% will reject - */ - -#define DTMF_THRESHOLD 8.0e7 -#define DTMF_NORMAL_TWIST 6.3 /* 8dB */ -#define DTMF_REVERSE_TWIST 2.5 /* 4dB */ -#define DTMF_RELATIVE_PEAK_ROW 6.3 /* 8dB */ -#define DTMF_RELATIVE_PEAK_COL 6.3 /* 8dB */ -#define DTMF_2ND_HARMONIC_ROW 2.5 /* 4dB */ -#define DTMF_2ND_HARMONIC_COL 63.1 /* 18dB */ -#define GRID_FACTOR 4 -#define BLOCK_LEN 102 -#define M_TWO_PI 2.0*M_PI - - typedef enum { - TT_HIT_NONE = 0, - TT_HIT_BEGIN = 1, - TT_HIT_MIDDLE = 2, - TT_HIT_END = 3 - } teletone_hit_type_t; - - - /*! \brief A continer for the elements of a Goertzel Algorithm (The names are from his formula) */ - typedef struct { - float v2; - float v3; - double fac; - } teletone_goertzel_state_t; - - /*! \brief A container for a DTMF detection state.*/ - typedef struct { - int hit1; - int hit2; - int hit3; - int hit4; - int dur; - int zc; - - - teletone_goertzel_state_t row_out[GRID_FACTOR]; - teletone_goertzel_state_t col_out[GRID_FACTOR]; - teletone_goertzel_state_t row_out2nd[GRID_FACTOR]; - teletone_goertzel_state_t col_out2nd[GRID_FACTOR]; - float energy; - float lenergy; - - int current_sample; - char digit; - int current_digits; - int detected_digits; - int lost_digits; - int digit_hits[16]; - } teletone_dtmf_detect_state_t; - - /*! \brief An abstraction to store the coefficient of a tone frequency */ - typedef struct { - float fac; - } teletone_detection_descriptor_t; - - /*! \brief A container for a single multi-tone detection - TELETONE_MAX_TONES dictates the maximum simultaneous tones that can be present - in a multi-tone representation. - */ - typedef struct { - int sample_rate; - - teletone_detection_descriptor_t tdd[TELETONE_MAX_TONES]; - teletone_goertzel_state_t gs[TELETONE_MAX_TONES]; - teletone_goertzel_state_t gs2[TELETONE_MAX_TONES]; - int tone_count; - - float energy; - int current_sample; - - int min_samples; - int total_samples; - - int positives; - int negatives; - int hits; - - int positive_factor; - int negative_factor; - int hit_factor; - - } teletone_multi_tone_t; - - - /*! - \brief Initilize a multi-frequency tone detector - \param mt the multi-frequency tone descriptor - \param map a representation of the multi-frequency tone - */ -TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map); - - /*! - \brief Check a sample buffer for the presence of the mulit-frequency tone described by mt - \param mt the multi-frequency tone descriptor - \param sample_buffer an array aof 16 bit signed linear samples - \param samples the number of samples present in sample_buffer - \return true when the tone was detected or false when it is not - */ -TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt, - int16_t sample_buffer[], - int samples); - - /*! - \brief Initilize a DTMF detection state object - \param dtmf_detect_state the DTMF detection state to initilize - \param sample_rate the desired sample rate - */ -TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate); - - /*! - \brief Check a sample buffer for the presence of DTMF digits - \param dtmf_detect_state the detection state object to check - \param sample_buffer an array aof 16 bit signed linear samples - \param samples the number of samples present in sample_buffer - \return true when DTMF was detected or false when it is not - */ -TELETONE_API(teletone_hit_type_t) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state, - int16_t sample_buffer[], - int samples); - /*! - \brief retrieve any collected digits into a string buffer - \param dtmf_detect_state the detection state object to check - \param buf the string buffer to write to - \param max the maximum length of buf - \return the number of characters written to buf - */ -TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state, char *buf, unsigned int *dur); - - /*! - \brief Step through the Goertzel Algorithm for each sample in a buffer - \param goertzel_state the goertzel state to step the samples through - \param sample_buffer an array aof 16 bit signed linear samples - \param samples the number of samples present in sample_buffer - */ -TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state, - int16_t sample_buffer[], - int samples); - - - -#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/freetdm/src/include/private/libteletone_generate.h b/libs/freetdm/src/include/private/libteletone_generate.h deleted file mode 100644 index d5f0bf2e48..0000000000 --- a/libs/freetdm/src/include/private/libteletone_generate.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * libteletone - * 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 libteletone - * - * 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 - * - * - * libteletone.h -- Tone Generator - * - * - * - * Exception: - * The author hereby grants the use of this source code under the - * following license if and only if the source code is distributed - * as part of the OpenZAP or FreeTDM library. Any use or distribution of this - * source code outside the scope of the OpenZAP or FreeTDM library will nullify the - * following license and reinact the MPL 1.1 as stated above. - * - * Copyright (c) 2007, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef LIBTELETONE_GENERATE_H -#define LIBTELETONE_GENERATE_H -#ifdef __cplusplus -extern "C" { -#ifdef _doh -} -#endif -#endif - -#include -#include - -#if defined(__SUNPRO_C) || defined(__SUNPRO_CC) -#ifndef __inline__ -#define __inline__ inline -#endif -#endif - -#ifdef _MSC_VER -#ifndef __inline__ -#define __inline__ __inline -#endif - -typedef unsigned __int64 uint64_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int8 uint8_t; -typedef __int64 int64_t; -typedef __int32 int32_t; -typedef __int16 int16_t; -typedef __int8 int8_t; -#else -#include -#endif -#include -#include -#include -#include -#if !defined(powf) && !defined(_WIN64) -extern float powf (float, float); -#endif -#include -#include -#ifndef _MSC_VER -#include -#endif -#include -#include -#include "libteletone.h" - -#define TELETONE_VOL_DB_MAX 0 -#define TELETONE_VOL_DB_MIN -63 -#define MAX_PHASE_TONES 4 - -struct teletone_dds_state { - uint32_t phase_rate[MAX_PHASE_TONES]; - uint32_t scale_factor; - uint32_t phase_accumulator; - teletone_process_t tx_level; -}; -typedef struct teletone_dds_state teletone_dds_state_t; - -#define SINE_TABLE_MAX 128 -#define SINE_TABLE_LEN (SINE_TABLE_MAX - 1) -#define MAX_PHASE_ACCUMULATOR 0x10000 * 0x10000 -/* 3.14 == the max power on ulaw (alaw is 3.17) */ -/* 3.02 represents twice the power */ -#define DBM0_MAX_POWER (3.14f + 3.02f) - -TELETONE_API_DATA extern int16_t TELETONE_SINES[SINE_TABLE_MAX]; - -static __inline__ int32_t teletone_dds_phase_rate(teletone_process_t tone, uint32_t rate) -{ - return (int32_t) ((tone * MAX_PHASE_ACCUMULATOR) / rate); -} - -static __inline__ int16_t teletone_dds_state_modulate_sample(teletone_dds_state_t *dds, uint32_t pindex) -{ - int32_t bitmask = dds->phase_accumulator, sine_index = (bitmask >>= 23) & SINE_TABLE_LEN; - int16_t sample; - - if (pindex >= MAX_PHASE_TONES) { - pindex = 0; - } - - if (bitmask & SINE_TABLE_MAX) { - sine_index = SINE_TABLE_LEN - sine_index; - } - - sample = TELETONE_SINES[sine_index]; - - if (bitmask & (SINE_TABLE_MAX * 2)) { - sample *= -1; - } - - dds->phase_accumulator += dds->phase_rate[pindex]; - return (int16_t) (sample * dds->scale_factor >> 15); -} - -static __inline__ void teletone_dds_state_set_tx_level(teletone_dds_state_t *dds, float tx_level) -{ - dds->scale_factor = (int) (powf(10.0f, (tx_level - DBM0_MAX_POWER) / 20.0f) * (32767.0f * 1.414214f)); - dds->tx_level = tx_level; -} - -static __inline__ void teletone_dds_state_reset_accum(teletone_dds_state_t *dds) -{ - dds->phase_accumulator = 0; -} - -static __inline__ int teletone_dds_state_set_tone(teletone_dds_state_t *dds, teletone_process_t tone, uint32_t rate, uint32_t pindex) -{ - if (pindex < MAX_PHASE_TONES) { - dds->phase_rate[pindex] = teletone_dds_phase_rate(tone, rate); - return 0; - } - - return -1; -} - - - -/*! \file libteletone_generate.h - \brief Tone Generation Routines - - This module is responsible for tone generation specifics -*/ - -typedef int16_t teletone_audio_t; -struct teletone_generation_session; -typedef int (*tone_handler)(struct teletone_generation_session *ts, teletone_tone_map_t *map); - -/*! \brief An abstraction to store a tone generation session */ -struct teletone_generation_session { - /*! An array of tone mappings to character mappings */ - teletone_tone_map_t TONES[TELETONE_TONE_RANGE]; - /*! The number of channels the output audio should be in */ - int channels; - /*! The Rate in hz of the output audio */ - int rate; - /*! The duration (in samples) of the output audio */ - int duration; - /*! The duration of silence to append after the initial audio is generated */ - int wait; - /*! The duration (in samples) of the output audio (takes prescedence over actual duration value) */ - int tmp_duration; - /*! The duration of silence to append after the initial audio is generated (takes prescedence over actual wait value)*/ - int tmp_wait; - /*! Number of loops to repeat a single instruction*/ - int loops; - /*! Number of loops to repeat the entire set of instructions*/ - int LOOPS; - /*! Number to mutiply total samples by to determine when to begin ascent or decent e.g. 0=beginning 4=(last 25%) */ - float decay_factor; - /*! Direction to perform volume increase/decrease 1/-1*/ - int decay_direction; - /*! Number of samples between increase/decrease of volume */ - int decay_step; - /*! Volume factor of the tone */ - float volume; - /*! Debug on/off */ - int debug; - /*! FILE stream to write debug data to */ - FILE *debug_stream; - /*! Extra user data to attach to the session*/ - void *user_data; - /*! Buffer for storing sample data (dynamic) */ - teletone_audio_t *buffer; - /*! Size of the buffer */ - int datalen; - /*! In-Use size of the buffer */ - int samples; - /*! Callback function called during generation */ - int dynamic; - tone_handler handler; -}; - -typedef struct teletone_generation_session teletone_generation_session_t; - - -/*! - \brief Assign a set of tones to a tone_session indexed by a paticular index/character - \param ts the tone generation session - \param index the index to map the tone to - \param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0 - \return 0 -*/ -TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...); - -/*! - \brief Assign a set of tones to a single tone map - \param map the map to assign the tones to - \param ... up to TELETONE_MAX_TONES frequencies terminated by 0.0 - \return 0 -*/ -TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...); - -/*! - \brief Initilize a tone generation session - \param ts the tone generation session to initilize - \param buflen the size of the buffer(in samples) to dynamically allocate - \param handler a callback function to execute when a tone generation instruction is complete - \param user_data optional user data to send - \return 0 -*/ -TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data); - -/*! - \brief Free the buffer allocated by a tone generation session - \param ts the tone generation session to destroy - \return 0 -*/ -TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts); - -/*! - \brief Execute a single tone generation instruction - \param ts the tone generation session to consult for parameters - \param map the tone mapping to use for the frequencies - \return 0 -*/ -TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map); - -/*! - \brief Execute a tone generation script and call callbacks after each instruction - \param ts the tone generation session to execute on - \param cmd the script to execute - \return 0 -*/ -TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd); - -#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/freetdm/src/include/private/sangoma_tdm_api.h b/libs/freetdm/src/include/private/sangoma_tdm_api.h deleted file mode 100644 index 6880199110..0000000000 --- a/libs/freetdm/src/include/private/sangoma_tdm_api.h +++ /dev/null @@ -1,321 +0,0 @@ -/***************************************************************************** - * sangoma_tdm_api.h Sangoma TDM API Portability functions - * - * Author(s): Anthony Minessale II - * Nenad Corbic - * Michael Jerris - * David Rokhvarg - * - * Copyright: (c) 2006 Nenad Corbic - * Anthony Minessale II - * (c) 1984-2007 Sangoma Technologies Inc. - * - * ============================================================================ - */ - -#ifndef _SANGOMA_TDM_API_H -#define _SANGOMA_TDM_API_H - -/* This entire block of defines and includes from this line, through #define FNAME_LEN probably dont belong here */ -/* most of them probably belong in wanpipe_defines.h, then each header file listed included below properly included */ -/* in the header files that depend on them, leaving only the include for wanpipe_tdm_api.h left in this file or */ -/* possibly integrating the rest of this file diretly into wanpipe_tdm_api.h */ -#ifndef __WINDOWS__ -#if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) -#define __WINDOWS__ -#endif /* defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) */ -#endif /* ndef __WINDOWS__ */ - -#if defined(__WINDOWS__) -#if defined(_MSC_VER) -/* disable some warnings caused by wanpipe headers that will need to be fixed in those headers */ -#pragma warning(disable:4201 4214) - -/* sang_api.h(74) : warning C4201: nonstandard extension used : nameless struct/union */ - -/* wanpipe_defines.h(219) : warning C4214: nonstandard extension used : bit field types other than int */ -/* wanpipe_defines.h(220) : warning C4214: nonstandard extension used : bit field types other than int */ -/* this will break for any compilers that are strict ansi or strict c99 */ - -/* The following definition for that struct should resolve this warning and work for 32 and 64 bit */ -#if 0 -struct iphdr { - -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned ihl:4, - version:4; -#elif defined (__BIG_ENDIAN_BITFIELD) - unsigned version:4, - ihl:4; -#else -# error "unknown byteorder!" -#endif - unsigned tos:8; - unsigned tot_len:16; - unsigned id:16; - unsigned frag_off:16; - __u8 ttl; - __u8 protocol; - __u16 check; - __u32 saddr; - __u32 daddr; - /*The options start here. */ -}; -#endif /* #if 0 */ - -#define __inline__ __inline -#endif /* defined(_MSC_VER) */ -#include -/* do we like the name WP_INVALID_SOCKET or should it be changed? */ -#define WP_INVALID_SOCKET INVALID_HANDLE_VALUE -#else /* defined(__WINDOWS__) */ -#define WP_INVALID_SOCKET -1 -#include -#include -#include -#endif - -#include -#include -#include -#include -#ifdef __WINDOWS__ -#include -#include -#endif -#include - -#define FNAME_LEN 50 - - -#if defined(__WINDOWS__) -/* This might be broken on windows, as POLL_EVENT_TELEPHONY seems to be commented out in sang_api.h.. it should be added to POLLPRI */ -#define POLLPRI (POLL_EVENT_LINK_STATE | POLL_EVENT_LINK_CONNECT | POLL_EVENT_LINK_DISCONNECT) -#endif - -/* return -1 for error, 0 for timeout or 1 for success. *flags is set to the poll evetns POLLIN | POLLOUT | POLLPRI based on the result of the poll */ -/* on windows we actually have POLLPRI defined with several events, so we could theoretically poll */ -/* for specific events. Is there any way to do this on *nix as well? */ - -/* a cross platform way to poll on an actual pollset (span and/or list of spans) will probably also be needed for analog */ -/* so we can have one analong handler thread that will deal with all the idle analog channels for events */ -/* the alternative would be for the driver to provide one socket for all of the oob events for all analog channels */ -static __inline__ int tdmv_api_wait_socket(sng_fd_t fd, int timeout, int *flags) -{ -#if defined(__WINDOWS__) - DWORD ln; - API_POLL_STRUCT api_poll; - - memset(&api_poll, 0x00, sizeof(API_POLL_STRUCT)); - - api_poll.user_flags_bitmap = *flags; - api_poll.timeout = timeout; - - if (!DeviceIoControl( - fd, - IoctlApiPoll, - (LPVOID)NULL, - 0L, - (LPVOID)&api_poll, - sizeof(API_POLL_STRUCT), - (LPDWORD)(&ln), - (LPOVERLAPPED)NULL)) { - return -1; - } - - *flags = 0; - - switch(api_poll.operation_status) - { - case SANG_STATUS_RX_DATA_AVAILABLE: - break; - - case SANG_STATUS_RX_DATA_TIMEOUT: - return 0; - - default: - return -1; - } - - if (api_poll.poll_events_bitmap == 0){ - return -1; - } - - if (api_poll.poll_events_bitmap & POLL_EVENT_TIMEOUT) { - return 0; - } - - *flags = api_poll.poll_events_bitmap; - - return 1; -#else - struct pollfd pfds[1]; - int res; - - memset(&pfds[0], 0, sizeof(pfds[0])); - pfds[0].fd = fd; - pfds[0].events = *flags; - res = poll(pfds, 1, timeout); - *flags = 0; - - if (pfds[0].revents & POLLERR) { - res = -1; - } - - if (res > 0) { - *flags = pfds[0].revents; - } - - return res; -#endif -} - -/* on windows right now, there is no way to specify if we want to read events here or not, we allways get them here */ -/* we need some what to select if we are reading regular tdm msgs or events */ -/* need to either have 2 functions, 1 for events, 1 for regural read, or a flag on this function to choose */ -/* 2 functions preferred. Need implementation for the event function for both nix and windows that is threadsafe */ -static __inline__ int tdmv_api_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen) -{ - /* What do we need to do here to avoid having to do all */ - /* the memcpy's on windows and still maintain api compat with nix */ - int rx_len=0; -#if defined(__WINDOWS__) - static RX_DATA_STRUCT rx_data; - api_header_t *pri; - wp_tdm_api_rx_hdr_t *tdm_api_rx_hdr; - wp_tdm_api_rx_hdr_t *user_buf = (wp_tdm_api_rx_hdr_t*)hdrbuf; - DWORD ln; - - if (hdrlen != sizeof(wp_tdm_api_rx_hdr_t)){ - return -1; - } - - if (!DeviceIoControl( - fd, - IoctlReadCommand, - (LPVOID)NULL, - 0L, - (LPVOID)&rx_data, - sizeof(RX_DATA_STRUCT), - (LPDWORD)(&ln), - (LPOVERLAPPED)NULL - )){ - return -1; - } - - pri = &rx_data.api_header; - tdm_api_rx_hdr = (wp_tdm_api_rx_hdr_t*)rx_data.data; - - user_buf->wp_tdm_api_event_type = pri->operation_status; - - switch(pri->operation_status) - { - case SANG_STATUS_RX_DATA_AVAILABLE: - if (pri->data_length > datalen){ - break; - } - memcpy(databuf, rx_data.data, pri->data_length); - rx_len = pri->data_length; - break; - - default: - break; - } - -#else - struct msghdr msg; - struct iovec iov[2]; - - memset(&msg,0,sizeof(struct msghdr)); - - iov[0].iov_len=hdrlen; - iov[0].iov_base=hdrbuf; - - iov[1].iov_len=datalen; - iov[1].iov_base=databuf; - - msg.msg_iovlen=2; - msg.msg_iov=iov; - - rx_len = read(fd,&msg,datalen+hdrlen); - - if (rx_len <= sizeof(wp_tdm_api_rx_hdr_t)){ - return -EINVAL; - } - - rx_len-=sizeof(wp_tdm_api_rx_hdr_t); -#endif - return rx_len; -} - -static __inline__ int tdmv_api_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen) -{ - /* What do we need to do here to avoid having to do all */ - /* the memcpy's on windows and still maintain api compat with nix */ - int bsent = 0; -#if defined(__WINDOWS__) - static TX_DATA_STRUCT local_tx_data; - api_header_t *pri; - DWORD ln; - - /* Are these really not needed or used??? What about for nix?? */ - (void)hdrbuf; - (void)hdrlen; - - pri = &local_tx_data.api_header; - - pri->data_length = datalen; - memcpy(local_tx_data.data, databuf, pri->data_length); - - if (!DeviceIoControl( - fd, - IoctlWriteCommand, - (LPVOID)&local_tx_data, - (ULONG)sizeof(TX_DATA_STRUCT), - (LPVOID)&local_tx_data, - sizeof(TX_DATA_STRUCT), - (LPDWORD)(&ln), - (LPOVERLAPPED)NULL - )){ - return -1; - } - - if (local_tx_data.api_header.operation_status == SANG_STATUS_SUCCESS) { - bsent = datalen; - } -#else - struct msghdr msg; - struct iovec iov[2]; - - memset(&msg,0,sizeof(struct msghdr)); - - iov[0].iov_len = hdrlen; - iov[0].iov_base = hdrbuf; - - iov[1].iov_len = datalen; - iov[1].iov_base = databuf; - - msg.msg_iovlen = 2; - msg.msg_iov = iov; - - bsent = write(fd, &msg, datalen + hdrlen); - if (bsent > 0){ - bsent -= sizeof(wp_tdm_api_tx_hdr_t); - } -#endif - return bsent; -} - -#endif /* _SANGOMA_TDM_API_H */ - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ - diff --git a/libs/freetdm/src/include/private/uart.h b/libs/freetdm/src/include/private/uart.h deleted file mode 100644 index b1b04c09a4..0000000000 --- a/libs/freetdm/src/include/private/uart.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * uart.h - * - * Copyright (c) 2005 Robert Krten. 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 THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. - * - * This module contains the manifest constants and declarations for - * the UART module. - * - * 2005 06 19 R. Krten created -*/ - -#ifndef __UART_H__ -#define __UART_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*bytehandler_func_t) (void *, int); -typedef void (*bithandler_func_t) (void *, int); - - -typedef struct dsp_uart_attr_s -{ - bytehandler_func_t bytehandler; /* byte handler */ - void *bytehandler_arg; /* arbitrary ID passed to bytehandler as first argument */ -} dsp_uart_attr_t; - -typedef struct -{ - dsp_uart_attr_t attr; - int have_start; /* wait for start bit to show up */ - int data; /* data buffer */ - int nbits; /* number of bits accumulated so far */ -} dsp_uart_handle_t; - -/* - * Function prototypes - * - * General calling order is: - * a) create the attributes structure (dsp_uart_attr_init) - * b) initialize fields in the attributes structure (dsp_uart_attr_set_*) - * c) create a Bell-202 handle (dsp_uart_create) - * d) feed bits through dsp_uart_bit_handler -*/ - -void dsp_uart_attr_init(dsp_uart_attr_t *attributes); - -bytehandler_func_t dsp_uart_attr_get_bytehandler(dsp_uart_attr_t *attributes, void **bytehandler_arg); -void dsp_uart_attr_set_bytehandler(dsp_uart_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg); - -dsp_uart_handle_t * dsp_uart_create(dsp_uart_attr_t *attributes); -void dsp_uart_destroy(dsp_uart_handle_t **handle); - -void dsp_uart_bit_handler(void *handle, int bit); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/libs/freetdm/src/isdn/5ESSStateNT.c b/libs/freetdm/src/isdn/5ESSStateNT.c deleted file mode 100644 index 6d38f4582e..0000000000 --- a/libs/freetdm/src/isdn/5ESSStateNT.c +++ /dev/null @@ -1,132 +0,0 @@ -/***************************************************************************** - - FileName: 5ESSStateNT.c - - Contents: AT&T 5ESS ISDN State Engine for NT (Network Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Copyright (c) 2007, Michael S. Collins, All rights reserved. - email:mcollins@fcnetwork.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "5ESS.h" - -/***************************************************************************** - Function: ATT5ESSCreateNT - - Description: Will create the AT&T 5ESS ISDN NT as a Dialect in the stack. The first - bulk set up the message handlers, the second bulk the IE - encoders/coders, and the last bulk set up the state table. - - Parameters: i Dialect index -*****************************************************************************/ -void ATT5ESSCreateNT(L3UCHAR i) -{ - Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingNT, Q931Umes_Alerting, Q931Pmes_Alerting); - Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingNT, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); - Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectNT, Q931Umes_Connect, Q931Pmes_Connect); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckNT, Q931Umes_ConnectAck, Q931Pmes_ConnectAck); - Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressNT, Q931Umes_Progress, Q931Pmes_Progress); - Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupNT, Q931Umes_Setup, Q931Pmes_Setup); - Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckNT, Q931Umes_SetupAck, Q931Pmes_SetupAck); - Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeNT, Q931Umes_Resume, Q931Pmes_Resume); - Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckNT, Q931Umes_ResumeAck, Q931Pmes_ResumeAck); - Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectNT, Q931Umes_ResumeReject, Q931Pmes_ResumeReject); - Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendNT, Q931Umes_Suspend, Q931Pmes_Suspend); - Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckNT, Q931Umes_SuspendAck, Q931Pmes_SuspendAck); - Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectNT, Q931Umes_SuspendReject, Q931Pmes_SuspendReject); - Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationNT, Q931Umes_UserInformation, Q931Pmes_UserInformation); - Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectNT, Q931Umes_Disconnect, Q931Pmes_Disconnect); - Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseNT, Q931Umes_Release, Q931Pmes_Release); - Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteNT, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete); - Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartNT, Q931Umes_Restart, Q931Pmes_Restart); - Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckNT, Q931Umes_RestartAck, Q931Pmes_RestartAck); - Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl); - Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationNT, Q931Umes_Information, Q931Pmes_Information); - Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyNT, Q931Umes_Notify, Q931Pmes_Notify); - Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusNT, Q931Umes_Status, Q931Pmes_Status); - Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryNT, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry); - Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentNT, Q931Umes_Segment, Q931Pmes_Segment); - - Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityNT, Q932Umes_Facility, Q932Pmes_Facility); - Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldNT, Q932Umes_Hold, Q932Pmes_Hold); - Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckNT, Q932Umes_HoldAck, Q932Pmes_HoldAck); - Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectNT, Q932Umes_HoldReject, Q932Pmes_HoldReject); - Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterNT, Q932Umes_Register, Q932Pmes_Register); - Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveNT, Q932Umes_Retrieve, Q932Pmes_Retrieve); - Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck); - Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectNT, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject); - - /* Set up the IE encoder/decoder handle table.*/ - Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment); - Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap); - Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause); - Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID); - Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState); - Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID); - Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd); - Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac); - Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd); - Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display); - Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime); - Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac); - Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal); - Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum); - Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub); - Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum); - Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub); - Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd); - Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp); - Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp); - Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser); - Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits); - - Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic); - - /* The following define a state machine. The point is that the Message */ - /* procs can when search this to find out if the message/state */ - /* combination is legale. If not, the proc for unexpected message apply.*/ - - /* TODO define state table here */ -} diff --git a/libs/freetdm/src/isdn/5ESSStateTE.c b/libs/freetdm/src/isdn/5ESSStateTE.c deleted file mode 100644 index 6c31df88c7..0000000000 --- a/libs/freetdm/src/isdn/5ESSStateTE.c +++ /dev/null @@ -1,291 +0,0 @@ -/***************************************************************************** - - FileName: 5ESSStateTE.c - - Contents: AT&T 5ESS ISDN State Engine for TE (User Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - This reference implementation uses a process per message, - meaning that each message must check call states. This - is easier for dialect maintenance as each message proc - can be replaced individually. A new TE variant only - need to copy the Q931CreateTE and replace those procs or - need to override. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Copyright (c) 2007, Michael S. Collins, All rights reserved. - email:mcollins@fcnetwork.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "5ESS.h" -extern L3INT Q931L4HeaderSpace; - -/***************************************************************************** - Function: ATT5ESSCreateTE - - Description: Will create the AT&T 5ESS TE as a Dialect in the stack. The first - bulk set up the message handlers, the second bulk the IE - encoders/coders, and the last bulk set up the state table. - - Parameters: i Dialect index -*****************************************************************************/ -void ATT5ESSCreateTE(L3UCHAR i) -{ - Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting); - Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); - Q931SetMesProc(Q931mes_CONNECT, i, ATT5ESSProc0x07TE, ATT5ESSUmes_0x07, ATT5ESSPmes_0x07); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, ATT5ESSProc0x0fTE, ATT5ESSUmes_0x0f, ATT5ESSPmes_0x0f); - Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress); - Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupTE, ATT5ESSUmes_Setup, ATT5ESSPmes_Setup); - Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck); - Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeTE, Q931Umes_Resume, Q931Pmes_Resume); - Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckTE, Q931Umes_ResumeAck, Q931Pmes_ResumeAck); - Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectTE, Q931Umes_ResumeReject, Q931Pmes_ResumeReject); - Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendTE, Q931Umes_Suspend, Q931Pmes_Suspend); - Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckTE, Q931Umes_SuspendAck, Q931Pmes_SuspendAck); - Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectTE, Q931Umes_SuspendReject, Q931Pmes_SuspendReject); - Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationTE, Q931Umes_UserInformation, Q931Pmes_UserInformation); - Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectTE, Q931Umes_Disconnect, Q931Pmes_Disconnect); - Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseTE, Q931Umes_Release, Q931Pmes_Release); - Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteTE, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete); - Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartTE, Q931Umes_Restart, Q931Pmes_Restart); - Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckTE, Q931Umes_RestartAck, Q931Pmes_RestartAck); - Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlTE, Q931Umes_CongestionControl, Q931Pmes_CongestionControl); - Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationTE, Q931Umes_Information, Q931Pmes_Information); - Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyTE, Q931Umes_Notify, Q931Pmes_Notify); - Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusTE, Q931Umes_Status, Q931Pmes_Status); - Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryTE, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry); - Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentTE, Q931Umes_Segment, Q931Pmes_Segment); - - Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityTE, Q932Umes_Facility, Q932Pmes_Facility); - Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldTE, Q932Umes_Hold, Q932Pmes_Hold); - Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckTE, Q932Umes_HoldAck, Q932Pmes_HoldAck); - Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectTE, Q932Umes_HoldReject, Q932Pmes_HoldReject); - Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterTE, Q932Umes_Register, Q932Pmes_Register); - Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveTE, Q932Umes_Retrieve, Q932Pmes_Retrieve); - Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckTE, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck); - Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectTE, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject); - - /* Set up the IE encoder/decoder handle table.*/ - Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment); - Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap); - Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause); - Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID); - Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState); - Q931SetIEProc(Q931ie_CHANGE_STATUS, i, Q931Pie_ChangeStatus, Q931Uie_ChangeStatus); - Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID); - Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd); - Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac); - Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd); - Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display); - Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime); - Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac); - Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal); - Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum); - Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub); - Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum); - Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub); - Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd); - Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp); - Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp); - Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser); - Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits); - - Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic); - - /* The following define a state machine. The point is that the Message */ - /* procs can when search this to find out if the message/state */ - /* combination is legale. If not, the proc for unexpected message apply.*/ - - /* State 0 Idle */ - Q931AddStateEntry(i, Q931_U0, Q931mes_RESUME, 2); - Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 2); - Q931AddStateEntry(i, Q931_U0, Q931mes_STATUS, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE_COMPLETE, 4); - - /* State 1 Call Initiating */ - Q931AddStateEntry(i, Q931_U1, Q931mes_DISCONNECT, 2); - Q931AddStateEntry(i, Q931_U1, Q931mes_SETUP_ACKNOWLEDGE, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_RELEASE_COMPLETE, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_CALL_PROCEEDING, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_CONNECT, 4); - - /* State 2 Overlap Sending */ - Q931AddStateEntry(i, Q931_U2, Q931mes_INFORMATION, 2); - Q931AddStateEntry(i, Q931_U2, Q931mes_CALL_PROCEEDING, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_PROGRESS, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_CONNECT, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_RELEASE, 2); - - /* State 3 Outgoing Call Proceeding */ - Q931AddStateEntry(i, Q931_U3, Q931mes_PROGRESS, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_CONNECT, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_RELEASE, 2); - - /* State 4 Call Delivered */ - Q931AddStateEntry(i, Q931_U4, Q931mes_CONNECT, 4); - - /* State 6 Call Precent */ - Q931AddStateEntry(i, Q931_U6, Q931mes_INFORMATION, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_ALERTING, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_CALL_PROCEEDING, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_CONNECT, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE_COMPLETE, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U6, Q931mes_DISCONNECT, 4); - - /* State 7 Call Received */ - Q931AddStateEntry(i, Q931_U7, Q931mes_CONNECT, 2); - - /* State 8 Connect request */ - Q931AddStateEntry(i, Q931_U8, Q931mes_CONNECT_ACKNOWLEDGE, 4); - - /* State 9 Incoming Call Proceeding */ - Q931AddStateEntry(i, Q931_U9, Q931mes_CONNECT, 2); - Q931AddStateEntry(i, Q931_U9, Q931mes_ALERTING, 2); - Q931AddStateEntry(i, Q931_U9, Q931mes_PROGRESS, 2); - - /* State 10 Active */ - Q931AddStateEntry(i, Q931_U10, Q931mes_SUSPEND, 2); - Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 4); - Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 2); - - /* State 11 Disconnect Request */ - Q931AddStateEntry(i, Q931_U11, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U11, Q931mes_DISCONNECT, 4); - Q931AddStateEntry(i, Q931_U11, Q931mes_NOTIFY, 4); - - /* State 12 Disconnect Ind */ - Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 2); - - /* State 15 Suspend Request */ - Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_ACKNOWLEDGE, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_REJECT, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_DISCONNECT, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_RELEASE, 4); - -/* TODO - Q931AddStateEntry(i, Q931_U17, - Q931AddStateEntry(i, Q931_U19, - Q931AddStateEntry(i, Q931_U25, -*/ -} - -/***************************************************************************** - - Function: ATT5ESSProc0x0fTE - -*****************************************************************************/ -L3INT ATT5ESSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - if (pMes->ProtDisc == 8) { - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - } - if (iFrom == 4) { - /* TODO Add proc here*/ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom ==2) { - /* TODO Add proc here*/ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - - if (pMes->ProtDisc == 3 && pTrunk->autoServiceAck) { - printf("autoServiceAck is on, responding to Service Req from network...\n"); - Q931AckService(pTrunk, buf); - } - } - return ret; - -} - -/***************************************************************************** - - Function: ATT5ESSProc0x07TE - -*****************************************************************************/ -L3INT ATT5ESSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - if (pMes->ProtDisc == 8) { - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - } - if (iFrom == 4) { - /* TODO Add proc here*/ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here*/ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; - -} diff --git a/libs/freetdm/src/isdn/5ESSmes.c b/libs/freetdm/src/isdn/5ESSmes.c deleted file mode 100644 index 9d7e3b9030..0000000000 --- a/libs/freetdm/src/isdn/5ESSmes.c +++ /dev/null @@ -1,361 +0,0 @@ -/***************************************************************************** - - FileName: 5ESSmes.c - - Contents: Pack/Unpack functions. These functions will unpack a 5ESS ISDN - message from the bit packed original format into structs - that contains variables sized by the user. It will also pack - the struct back into a Q.931 message as required. - - See 5ESS.h for description. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Copyright (c) 2007, Michael S. Collins, All rights reserved. - email:mcollins@fcnetwork.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -*****************************************************************************/ - -#include "5ESS.h" - -/***************************************************************************** - - Function: ATT5ESSUmes_Setup - -*****************************************************************************/ -L3INT ATT5ESSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT ir = 0; - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - L3UCHAR last_codeset = 0, codeset = 0; - L3UCHAR shift_nolock = 1; - - while (IOff < Size) { - - if (shift_nolock) { - codeset = last_codeset; - } - - if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT) { - shift_nolock = (IBuf[IOff] & 0x08); - if (shift_nolock) { - last_codeset = codeset; - } - codeset = ((IBuf[IOff] & 0x07)); - IOff++; - } - - if (codeset == 0) { - switch (IBuf[IOff]) - { - case Q931ie_SENDING_COMPLETE: - case Q931ie_BEARER_CAPABILITY: - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_NETWORK_SPECIFIC_FACILITIES: - case Q931ie_DISPLAY: - case Q931ie_DATETIME: - case Q931ie_KEYPAD_FACILITY: - case Q931ie_SIGNAL: - case Q931ie_CALLING_PARTY_NUMBER: - case Q931ie_CALLING_PARTY_SUBADDRESS: - case Q931ie_CALLED_PARTY_NUMBER: - case Q931ie_CALLED_PARTY_SUBADDRESS: - case Q931ie_TRANSIT_NETWORK_SELECTION: - case Q931ie_LOW_LAYER_COMPATIBILITY: - case Q931ie_HIGH_LAYER_COMPATIBILITY: - case Q931ie_FACILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_REPEAT_INDICATOR: - if (ir < 2) { - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - ir++; - } else { - return Q931E_ILLEGAL_IE; - } - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } else if (codeset == 6) { - switch (IBuf[IOff]) - { - case Q931ie_GENERIC_DIGITS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } else if (codeset == 7) { - switch (IBuf[IOff]) - { - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } else { - return Q931E_ILLEGAL_IE; - } - } - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: ATT5ESSPmes_Setup - - Decription: Pack a Q931mes_Generic into a real Q.931 message. The user will - set up a SETUP message and issue this to the stack where it - is processed by Q931ProcSetup that processes and validates - it before it actually sends it out. This function is called - to compute the real Q.931 message. - - Parameters: IBuf[IN] Ptr to un-packed struct - ISize[IN] Size of input buffer (unpacked message). - OBuf[OUT] Ptr to packed 'octet' wise message. - OSize[OUT] Size of packed message. - - Called By: Q931ProcSetup - -*****************************************************************************/ -L3INT ATT5ESSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3INT rc = Q931E_NO_ERROR; - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Sending Complete */ - if (Q931IsIEPresent(pMes->SendComplete)) { - OBuf[Octet++] = (L3UCHAR)(pMes->SendComplete & 0x00ff); - } - - /* Repeat Indicator */ - if (Q931IsIEPresent(pMes->RepeatInd)) { - OBuf[Octet++] = (L3UCHAR)(pMes->RepeatInd & 0x00ff); - } - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet))!=0) - return rc; - } else { - rc = Q931E_BEARERCAP; - } - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Network specific facilities */ - if (Q931IsIEPresent(pMes->NetFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_NETWORK_SPECIFIC_FACILITIES](pTrunk, Q931GetIEPtr(pMes->NetFac,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Date/Time */ - if (Q931IsIEPresent(pMes->DateTime)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DATETIME](pTrunk, Q931GetIEPtr(pMes->DateTime,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Keypad Facility */ - if (Q931IsIEPresent(pMes->KeypadFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_KEYPAD_FACILITY](pTrunk, Q931GetIEPtr(pMes->KeypadFac,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Calling Party Number */ - if (Q931IsIEPresent(pMes->CallingNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CallingNum,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Calling Party Subaddress */ - if (Q931IsIEPresent(pMes->CallingSub)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CallingSub,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Called Party number */ - if (Q931IsIEPresent(pMes->CalledNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CalledNum,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Called party subaddress */ - if (Q931IsIEPresent(pMes->CalledSub)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CalledSub,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Transit network selection */ - if (Q931IsIEPresent(pMes->TransNetSel)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_TRANSIT_NETWORK_SELECTION](pTrunk, Q931GetIEPtr(pMes->TransNetSel,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* Repeat Indicator */ - if (Q931IsIEPresent(pMes->LLRepeatInd)) { - rc = Q931E_UNKNOWN_IE;/* TODO */ - } - - /* Low Layer Compatibility */ - if (Q931IsIEPresent(pMes->LLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_LOW_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->LLComp,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - /* High Layer Compatibility */ - if (Q931IsIEPresent(pMes->HLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet))!=0) - return rc; - } - - *OSize = Octet; - return rc; -} - - -/***************************************************************************** - - Function: ATT5ESSUmes_0x0f - -*****************************************************************************/ -L3INT ATT5ESSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - if (mes->ProtDisc == 8) { - return Q931Umes_ConnectAck(pTrunk, IBuf, mes, IOff, Size); - } - - if (mes->ProtDisc == 3) { - return Q931Umes_Service(pTrunk, IBuf, mes, IOff, Size); - } - - return Q931E_UNKNOWN_MESSAGE; -} - -/***************************************************************************** - - Function: ATT5ESSPmes_0x0f - -*****************************************************************************/ -L3INT ATT5ESSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *mes = (Q931mes_Generic *)IBuf; - - if (mes->ProtDisc == 8) { - return Q931Pmes_ConnectAck(pTrunk, IBuf, ISize, OBuf, OSize); - } - - if (mes->ProtDisc == 3) { - return Q931Pmes_Service(pTrunk, IBuf, ISize, OBuf, OSize); - } - - return Q931E_UNKNOWN_MESSAGE; -} - -/***************************************************************************** - - Function: ATT5ESSUmes_0x07 - -*****************************************************************************/ -L3INT ATT5ESSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - if (mes->ProtDisc == 8) { - return Q931Umes_Connect(pTrunk, IBuf, mes, IOff, Size); - } - - if (mes->ProtDisc == 3) { - return Q931Umes_ServiceAck(pTrunk, IBuf, mes, IOff, Size); - } - - return Q931E_UNKNOWN_MESSAGE; -} - -/***************************************************************************** - - Function: ATT5ESSPmes_0x07 - -*****************************************************************************/ -L3INT ATT5ESSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *mes = (Q931mes_Generic *)IBuf; - - if (mes->ProtDisc == 8) { - return Q931Pmes_Connect(pTrunk, IBuf, ISize, OBuf, OSize); - } - - if (mes->ProtDisc == 3) { - return Q931Pmes_ServiceAck(pTrunk, IBuf, ISize, OBuf, OSize); - } - - return Q931E_UNKNOWN_MESSAGE; -} diff --git a/libs/freetdm/src/isdn/DMSStateNT.c b/libs/freetdm/src/isdn/DMSStateNT.c deleted file mode 100644 index e8814ba8ef..0000000000 --- a/libs/freetdm/src/isdn/DMSStateNT.c +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - - FileName: DMSStateNT.c - - Contents: DMS-100 ISDN State Engine for NT (Network Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "DMS.h" - -/***************************************************************************** - Function: DMSCreateNT - - Description: Will create the National ISDN NT as a Dialect in the stack. The first - bulk set up the message handlers, the second bulk the IE - encoders/coders, and the last bulk set up the state table. - - Parameters: i Dialect index -*****************************************************************************/ -void DMSCreateNT(L3UCHAR i) -{ - Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingNT, Q931Umes_Alerting, Q931Pmes_Alerting); - Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingNT, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); - Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectNT, Q931Umes_Connect, Q931Pmes_Connect); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckNT, Q931Umes_ConnectAck, Q931Pmes_ConnectAck); - Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressNT, Q931Umes_Progress, Q931Pmes_Progress); - Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupNT, DMSUmes_Setup, DMSPmes_Setup); - Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckNT, Q931Umes_SetupAck, Q931Pmes_SetupAck); - Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeNT, Q931Umes_Resume, Q931Pmes_Resume); - Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckNT, Q931Umes_ResumeAck, Q931Pmes_ResumeAck); - Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectNT, Q931Umes_ResumeReject, Q931Pmes_ResumeReject); - Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendNT, Q931Umes_Suspend, Q931Pmes_Suspend); - Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckNT, Q931Umes_SuspendAck, Q931Pmes_SuspendAck); - Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectNT, Q931Umes_SuspendReject, Q931Pmes_SuspendReject); - Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationNT, Q931Umes_UserInformation, Q931Pmes_UserInformation); - Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectNT, Q931Umes_Disconnect, Q931Pmes_Disconnect); - Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseNT, Q931Umes_Release, Q931Pmes_Release); - Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteNT, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete); - Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartNT, Q931Umes_Restart, Q931Pmes_Restart); - Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckNT, Q931Umes_RestartAck, Q931Pmes_RestartAck); - Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl); - Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationNT, Q931Umes_Information, Q931Pmes_Information); - Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyNT, Q931Umes_Notify, Q931Pmes_Notify); - Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusNT, Q931Umes_Status, Q931Pmes_Status); - Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryNT, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry); - Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentNT, Q931Umes_Segment, Q931Pmes_Segment); - - Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityNT, Q932Umes_Facility, Q932Pmes_Facility); - Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldNT, Q932Umes_Hold, Q932Pmes_Hold); - Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckNT, Q932Umes_HoldAck, Q932Pmes_HoldAck); - Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectNT, Q932Umes_HoldReject, Q932Pmes_HoldReject); - Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterNT, Q932Umes_Register, Q932Pmes_Register); - Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveNT, Q932Umes_Retrieve, Q932Pmes_Retrieve); - Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck); - Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectNT, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject); - - /* Set up the IE encoder/decoder handle table.*/ - Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment); - Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap); - Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause); - Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID); - Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState); - Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID); - Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd); - Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac); - Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd); - Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display); - Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime); - Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac); - Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal); - Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum); - Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub); - Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum); - Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub); - Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd); - Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp); - Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp); - Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser); - Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits); - - /* The following define a state machine. The point is that the Message */ - /* procs can when search this to find out if the message/state */ - /* combination is legale. If not, the proc for unexpected message apply.*/ - - /* TODO define state table here */ -} diff --git a/libs/freetdm/src/isdn/DMSStateTE.c b/libs/freetdm/src/isdn/DMSStateTE.c deleted file mode 100644 index cb740d3c2f..0000000000 --- a/libs/freetdm/src/isdn/DMSStateTE.c +++ /dev/null @@ -1,284 +0,0 @@ -/***************************************************************************** - - FileName: DMSStateTE.c - - Contents: DMS-100 ISDN State Engine for TE (User Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - This reference implementation uses a process per message, - meaning that each message must check call states. This - is easier for dialect maintenance as each message proc - can be replaced individually. A new TE variant only - need to copy the Q931CreateTE and replace those procs or - need to override. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "DMS.h" -extern L3INT Q931L4HeaderSpace; - -/***************************************************************************** - Function: DMSCreateTE - - Description: Will create the National TE as a Dialect in the stack. The first - bulk set up the message handlers, the second bulk the IE - encoders/coders, and the last bulk set up the state table. - - Parameters: i Dialect index -*****************************************************************************/ -void DMSCreateTE(L3UCHAR i) -{ - Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting); - Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); - Q931SetMesProc(Q931mes_CONNECT, i, DMSProc0x07TE, DMSUmes_0x07, DMSPmes_0x07); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, DMSProc0x0fTE, DMSUmes_0x0f, DMSPmes_0x0f); - Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress); - Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupTE, DMSUmes_Setup, DMSPmes_Setup); - Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck); - Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeTE, Q931Umes_Resume, Q931Pmes_Resume); - Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckTE, Q931Umes_ResumeAck, Q931Pmes_ResumeAck); - Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectTE, Q931Umes_ResumeReject, Q931Pmes_ResumeReject); - Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendTE, Q931Umes_Suspend, Q931Pmes_Suspend); - Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckTE, Q931Umes_SuspendAck, Q931Pmes_SuspendAck); - Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectTE, Q931Umes_SuspendReject, Q931Pmes_SuspendReject); - Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationTE, Q931Umes_UserInformation, Q931Pmes_UserInformation); - Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectTE, Q931Umes_Disconnect, Q931Pmes_Disconnect); - Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseTE, Q931Umes_Release, Q931Pmes_Release); - Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteTE, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete); - Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartTE, Q931Umes_Restart, Q931Pmes_Restart); - Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckTE, Q931Umes_RestartAck, Q931Pmes_RestartAck); - Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlTE, Q931Umes_CongestionControl, Q931Pmes_CongestionControl); - Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationTE, Q931Umes_Information, Q931Pmes_Information); - Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyTE, Q931Umes_Notify, Q931Pmes_Notify); - Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusTE, Q931Umes_Status, Q931Pmes_Status); - Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryTE, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry); - Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentTE, Q931Umes_Segment, Q931Pmes_Segment); - - Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityTE, Q932Umes_Facility, Q932Pmes_Facility); - Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldTE, Q932Umes_Hold, Q932Pmes_Hold); - Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckTE, Q932Umes_HoldAck, Q932Pmes_HoldAck); - Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectTE, Q932Umes_HoldReject, Q932Pmes_HoldReject); - Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterTE, Q932Umes_Register, Q932Pmes_Register); - Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveTE, Q932Umes_Retrieve, Q932Pmes_Retrieve); - Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckTE, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck); - Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectTE, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject); - - /* Set up the IE encoder/decoder handle table.*/ - Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment); - Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap); - Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause); - Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID); - Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState); - Q931SetIEProc(Q931ie_CHANGE_STATUS, i, Q931Pie_ChangeStatus, Q931Uie_ChangeStatus); - Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID); - Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd); - Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac); - Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd); - Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display); - Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime); - Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac); - Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal); - Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum); - Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub); - Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum); - Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub); - Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd); - Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp); - Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp); - Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser); - Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits); - - /* The following define a state machine. The point is that the Message */ - /* procs can when search this to find out if the message/state */ - /* combination is legale. If not, the proc for unexpected message apply.*/ - - /* State 0 Idle */ - Q931AddStateEntry(i, Q931_U0, Q931mes_RESUME, 2); - Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 2); - Q931AddStateEntry(i, Q931_U0, Q931mes_STATUS, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE_COMPLETE, 4); - - /* State 1 Call Initiating */ - Q931AddStateEntry(i, Q931_U1, Q931mes_DISCONNECT, 2); - Q931AddStateEntry(i, Q931_U1, Q931mes_SETUP_ACKNOWLEDGE, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_RELEASE_COMPLETE, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_CALL_PROCEEDING, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_CONNECT, 4); - - /* State 2 Overlap Sending */ - Q931AddStateEntry(i, Q931_U2, Q931mes_INFORMATION, 2); - Q931AddStateEntry(i, Q931_U2, Q931mes_CALL_PROCEEDING, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_PROGRESS, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_CONNECT, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_RELEASE, 2); - - /* State 3 Outgoing Call Proceeding */ - Q931AddStateEntry(i, Q931_U3, Q931mes_PROGRESS, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_CONNECT, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_RELEASE, 2); - - /* State 4 Call Delivered */ - Q931AddStateEntry(i, Q931_U4, Q931mes_CONNECT, 4); - - /* State 6 Call Precent */ - Q931AddStateEntry(i, Q931_U6, Q931mes_INFORMATION, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_ALERTING, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_CALL_PROCEEDING, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_CONNECT, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE_COMPLETE, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U6, Q931mes_DISCONNECT, 4); - - /* State 7 Call Received */ - Q931AddStateEntry(i, Q931_U7, Q931mes_CONNECT, 2); - - /* State 8 Connect request */ - Q931AddStateEntry(i, Q931_U8, Q931mes_CONNECT_ACKNOWLEDGE, 4); - - /* State 9 Incoming Call Proceeding */ - Q931AddStateEntry(i, Q931_U9, Q931mes_CONNECT, 2); - Q931AddStateEntry(i, Q931_U9, Q931mes_ALERTING, 2); - Q931AddStateEntry(i, Q931_U9, Q931mes_PROGRESS, 2); - - /* State 10 Active */ - Q931AddStateEntry(i, Q931_U10, Q931mes_SUSPEND, 2); - Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 4); - Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 2); - - /* State 11 Disconnect Request */ - Q931AddStateEntry(i, Q931_U11, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U11, Q931mes_DISCONNECT, 4); - Q931AddStateEntry(i, Q931_U11, Q931mes_NOTIFY, 4); - - /* State 12 Disconnect Ind */ - Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 2); - - /* State 15 Suspend Request */ - Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_ACKNOWLEDGE, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_REJECT, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_DISCONNECT, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_RELEASE, 4); - -/* TODO - Q931AddStateEntry(i, Q931_U17, - Q931AddStateEntry(i, Q931_U19, - Q931AddStateEntry(i, Q931_U25, -*/ -} - -/***************************************************************************** - - Function: DMSProc0x0fTE - -*****************************************************************************/ -L3INT DMSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - if (pMes->ProtDisc == 8) { - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - } - if (iFrom == 4) { - /* TODO Add proc here*/ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here*/ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - - if (pMes->ProtDisc == 3 && pTrunk->autoServiceAck) { - Q931AckService(pTrunk, buf); - } - } - return ret; - -} - -/***************************************************************************** - - Function: DMSProc0x07TE - -*****************************************************************************/ -L3INT DMSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - if (pMes->ProtDisc == 8) { - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - } - if (iFrom == 4) { - /* TODO Add proc here*/ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here*/ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; - -} diff --git a/libs/freetdm/src/isdn/DMSmes.c b/libs/freetdm/src/isdn/DMSmes.c deleted file mode 100644 index 3ce82f2ded..0000000000 --- a/libs/freetdm/src/isdn/DMSmes.c +++ /dev/null @@ -1,344 +0,0 @@ -/***************************************************************************** - - FileName: DMSmes.c - - Contents: Pack/Unpack functions. These functions will unpack a DMS-100 ISDN - message from the bit packed original format into structs - that contains variables sized by the user. It will also pack - the struct back into a Q.931 message as required. - - See national.h for description. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -*****************************************************************************/ - -#include "DMS.h" - -/***************************************************************************** - - Function: DMSUmes_Setup - -*****************************************************************************/ -L3INT DMSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT ir = 0; - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - L3UCHAR last_codeset = 0, codeset = 0; - L3UCHAR shift_lock = 1; - - while (IOff < Size) { - if (!shift_lock) { - codeset = last_codeset; - } - - if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT ) { - shift_lock = (IBuf[IOff] & 0x08); - if (shift_lock) { - last_codeset = codeset; - } - codeset = ((IBuf[IOff] & 0x07)); - IOff++; - } - - if (codeset == 0) { - switch (IBuf[IOff]) { - case Q931ie_SENDING_COMPLETE: - case Q931ie_BEARER_CAPABILITY: - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_NETWORK_SPECIFIC_FACILITIES: - case Q931ie_DISPLAY: - case Q931ie_DATETIME: - case Q931ie_KEYPAD_FACILITY: - case Q931ie_SIGNAL: - case Q931ie_CALLING_PARTY_NUMBER: - case Q931ie_CALLING_PARTY_SUBADDRESS: - case Q931ie_CALLED_PARTY_NUMBER: - case Q931ie_CALLED_PARTY_SUBADDRESS: - case Q931ie_TRANSIT_NETWORK_SELECTION: - case Q931ie_LOW_LAYER_COMPATIBILITY: - case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_REPEAT_INDICATOR: - if (ir < 2) { - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - ir++; - } else { - return Q931E_ILLEGAL_IE; - } - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } else if (codeset == 6) { - switch (IBuf[IOff]) { - case Q931ie_GENERIC_DIGITS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - - } else { - return Q931E_ILLEGAL_IE; - } - } - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: DMSPmes_Setup - - Decription: Pack a Q931mes_Generic into a real Q.931 message. The user will - set up a SETUP message and issue this to the stack where it - is processed by Q931ProcSetup that processes and validates - it before it actually sends it out. This function is called - to compute the real Q.931 message. - - Parameters: IBuf[IN] Ptr to un-packed struct - ISize[IN] Size of input buffer (unpacked message). - OBuf[OUT] Ptr to packed 'octet' wise message. - OSize[OUT] Size of packed message. - - Called By: Q931ProcSetup - -*****************************************************************************/ -L3INT DMSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3INT rc = Q931E_NO_ERROR; - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Sending Complete */ - if (Q931IsIEPresent(pMes->SendComplete)) { - OBuf[Octet++] = (L3UCHAR)(pMes->SendComplete & 0x00ff); - } - - /* Repeat Indicator */ - if (Q931IsIEPresent(pMes->RepeatInd)) { - OBuf[Octet++] = (L3UCHAR)(pMes->RepeatInd & 0x00ff); - } - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } else { - rc = Q931E_BEARERCAP; - } - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Network spesific facilities */ - if (Q931IsIEPresent(pMes->NetFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_NETWORK_SPECIFIC_FACILITIES](pTrunk, Q931GetIEPtr(pMes->NetFac,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Date/Time */ - if (Q931IsIEPresent(pMes->DateTime)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DATETIME](pTrunk, Q931GetIEPtr(pMes->DateTime,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Keypad Facility */ - if (Q931IsIEPresent(pMes->KeypadFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_KEYPAD_FACILITY](pTrunk, Q931GetIEPtr(pMes->KeypadFac,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Calling Party Number */ - if (Q931IsIEPresent(pMes->CallingNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CallingNum,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Calling Party Subaddress */ - if (Q931IsIEPresent(pMes->CallingSub)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CallingSub,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Called Party number */ - if (Q931IsIEPresent(pMes->CalledNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CalledNum,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - - /* Called party subaddress */ - if (Q931IsIEPresent(pMes->CalledSub)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CalledSub,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Transit network selection */ - if (Q931IsIEPresent(pMes->TransNetSel)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_TRANSIT_NETWORK_SELECTION](pTrunk, Q931GetIEPtr(pMes->TransNetSel,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Repeat Indicator */ - if (Q931IsIEPresent(pMes->LLRepeatInd)) { - rc = Q931E_UNKNOWN_IE;/* TODO */ - } - - /* Low Layer Compatibility */ - if (Q931IsIEPresent(pMes->LLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_LOW_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->LLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* High Layer Compatibility */ - if (Q931IsIEPresent(pMes->HLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - - -/***************************************************************************** - - Function: DMSUmes_0x0f - -*****************************************************************************/ -L3INT DMSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - if (mes->ProtDisc == 8) { - return Q931Umes_ConnectAck(pTrunk, IBuf, mes, IOff, Size); - } - - if (mes->ProtDisc == 3) { - return Q931Umes_Service(pTrunk, IBuf, mes, IOff, Size); - } - - return Q931E_UNKNOWN_MESSAGE; -} - -/***************************************************************************** - - Function: DMSPmes_0x0f - -*****************************************************************************/ -L3INT DMSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *mes = (Q931mes_Generic *)IBuf; - - if (mes->ProtDisc == 8) { - return Q931Pmes_ConnectAck(pTrunk, IBuf, ISize, OBuf, OSize); - } - - if (mes->ProtDisc == 3) { - return Q931Pmes_Service(pTrunk, IBuf, ISize, OBuf, OSize); - } - - return Q931E_UNKNOWN_MESSAGE; -} - -/***************************************************************************** - - Function: DMSUmes_0x07 - -*****************************************************************************/ -L3INT DMSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - if (mes->ProtDisc == 8) { - return Q931Umes_Connect(pTrunk, IBuf, mes, IOff, Size); - } - - if (mes->ProtDisc == 3) { - return Q931Umes_ServiceAck(pTrunk, IBuf, mes, IOff, Size); - } - - return Q931E_UNKNOWN_MESSAGE; -} - -/***************************************************************************** - - Function: DMSPmes_0x07 - -*****************************************************************************/ -L3INT DMSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *mes = (Q931mes_Generic *)IBuf; - - if (mes->ProtDisc == 8) { - return Q931Pmes_Connect(pTrunk, IBuf, ISize, OBuf, OSize); - } - - if (mes->ProtDisc == 3) { - return Q931Pmes_ServiceAck(pTrunk, IBuf, ISize, OBuf, OSize); - } - - return Q931E_UNKNOWN_MESSAGE; -} diff --git a/libs/freetdm/src/isdn/EuroISDNStateNT.c b/libs/freetdm/src/isdn/EuroISDNStateNT.c deleted file mode 100644 index 6b26c91e04..0000000000 --- a/libs/freetdm/src/isdn/EuroISDNStateNT.c +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - - FileName: EuroISDNStateNT.c - - Contents: EuroISDN State Engine for NT (Network Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "Q931.h" diff --git a/libs/freetdm/src/isdn/EuroISDNStateTE.c b/libs/freetdm/src/isdn/EuroISDNStateTE.c deleted file mode 100644 index ef6b39e8e5..0000000000 --- a/libs/freetdm/src/isdn/EuroISDNStateTE.c +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - - FileName: EuroISDNStateTE.c - - Contents: EuroISDN State Engine for TE (User Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "Q931.h" - -/* - EuroISDN is a sub-set of Q.931. Q.931 is very generic as it embrase a lot, - while EuroISDN is more exact and make decitions on some of the - 'implementation options' in the original standard. EuroISDN will - however run smoothly under the generic space, so these functions are more - for show -*/ -#if 0 -static void EuroISDNCreateTE(L3UCHAR i) -{ - Q931CreateTE(i); -} -#endif diff --git a/libs/freetdm/src/isdn/Q921.c b/libs/freetdm/src/isdn/Q921.c deleted file mode 100644 index d1cbab6e6f..0000000000 --- a/libs/freetdm/src/isdn/Q921.c +++ /dev/null @@ -1,3518 +0,0 @@ -/***************************************************************************** - - FileName: q921.c - - Description: Contains the implementation of a Q.921 protocol - - Created: 27.dec.2000/JVB - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -*****************************************************************************/ - -/**************************************************************************** - * Changes: - * - * - June-August 2008: Stefan Knoblich : - * Add PTMP TEI management (NT + TE mode) - * Add timers - * Add retransmit counters - * Add logging - * Various cleanups - * Queues, retransmission of I frames - * PTMP NT mode - * - * - * TODO: - * - * - Cleanup queueing, test retransmission - * - * - Q921Start() /-Stop() TEI acquire + release - * (move everything related into these functions) - * - * - Q.921 '97 Appendix I (and maybe III, IV) - * - * - More complete Appendix II - * - * - Test PTP mode - * - * - PTMP NT mode (in progress) - * - * - NT mode TEI management: (ab)use T202 for TEI Check Request retransmission - * - * - General cleanup (move all non-public declarations into private header file) - * - * - Statistics, per-Frame type debug message filter - * - ****************************************************************************/ - -#include -#include -#include -#include - -#include "freetdm.h" -#include "Q921.h" -#include "Q921priv.h" -#include "mfifo.h" - -#ifdef WIN32 -#pragma warning(disable:4100 4244) -#endif - -/****************************************************************************************************** - * Actual code below this line - ******************************************************************************************************/ - - -/** - * Q921StateNames - * \brief Static array of state name / value mappings - */ -static struct Q921StateName { - Q921State_t value; - const char *name; -} Q921StateNames[10] = { - { Q921_STATE_STOPPED, "Stopped" }, - { Q921_STATE_TEI_UNASSIGNED, "TEI Unassigned" }, - { Q921_STATE_TEI_AWAITING, "TEI Awaiting Assignment" }, - { Q921_STATE_TEI_ESTABLISH, "TEI Awaiting Establishment" }, - { Q921_STATE_TEI_ASSIGNED, "TEI Assigned" }, - { Q921_STATE_AWAITING_ESTABLISHMENT, "Awaiting Establishment" }, - { Q921_STATE_AWAITING_RELEASE, "Awaiting Release" }, - { Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, "Multiple Frame Mode Established" }, - { Q921_STATE_TIMER_RECOVERY, "Timer Recovery" }, - { 0, 0 } -}; - -/** - * Q921State2Name - * \brief Convert state value to name - * \param[in] state the state value - * \return the state name or "Unknown" - * - * \author Stefan Knoblich - */ -static const char *Q921State2Name(Q921State_t state) -{ - struct Q921StateName *p = Q921StateNames; - - while(p->name) { - if(p->value == state) - return p->name; - p++; - } - - return "Unknown"; -} - - -/** - * Q921SendEnquiry - */ -static int Q921SendEnquiry(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - /* send enquiry: begin */ - if(Q921_CHECK_FLAG(link, Q921_FLAG_RECV_BUSY)) { - - Q921SendRNR(trunk, trunk->sapi, Q921_COMMAND(trunk), tei, 1); - } - else { - Q921SendRR(trunk, trunk->sapi, Q921_COMMAND(trunk), tei, 1); - } - - /* clear acknowledge pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - - /* "Start" T200 */ - Q921T200TimerReset(trunk, tei); - - /* send enquiry: end */ - return 1; -} - -/** - * Q921SendEnquiryResponse - */ -static int Q921SendEnquiryResponse(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - /* send enquiry: begin */ - if(Q921_CHECK_FLAG(link, Q921_FLAG_RECV_BUSY)) { - - Q921SendRNR(trunk, trunk->sapi, Q921_RESPONSE(trunk), tei, 1); - } - else { - Q921SendRR(trunk, trunk->sapi, Q921_RESPONSE(trunk), tei, 1); - - /* clear acknowledge pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - } - /* send enquiry: end */ - return 1; -} - -/** - * Q921ResetExceptionConditions - * \brief Reset Q.921 Exception conditions procedure - * \param trunk Q.921 data structure - * \param tei TEI - * \todo Do something - */ -static void Q921ResetExceptionConditions(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - /* Clear peer receiver busy */ - Q921_CLEAR_FLAG(link, Q921_FLAG_PEER_RECV_BUSY); - - /* Clear reject exception */ - Q921_CLEAR_FLAG(link, Q921_FLAG_REJECT); - - /* Clear own receiver busy */ - Q921_CLEAR_FLAG(link, Q921_FLAG_RECV_BUSY); - - /* Clear acknowledge pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - - return; -} - -/** - * Q921EstablishDataLink - * \brief Q.921 Establish data link procedure - * \param trunk Q.921 data structure - * \param tei TEI - * \return always 1 (success) - */ -static int Q921EstablishDataLink(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - /* reset exception conditions */ - Q921ResetExceptionConditions(trunk, tei); - - /* RC = 0 */ - link->N200 = 0; - - /* Send SABME */ - Q921SendSABME(trunk, trunk->sapi, Q921_COMMAND(trunk), tei, 1); - - /* Restart T200, stop T203 */ - Q921T200TimerReset(trunk, tei); - Q921T203TimerStop(trunk, tei); - - return 1; -} - -/** - * Q921NrErrorRecovery - * \brief NR(R) Error recovery procedure - * \param trunk Q.921 data structure - * \param tei TEI - * \return always 1 (success) - */ -static int Q921NrErrorRecovery(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - /* MDL Error indication (J) */ - - /* Establish datalink */ - Q921EstablishDataLink(trunk, tei); - - /* Clear L3 initiated */ - Q921_CLEAR_FLAG(link, Q921_FLAG_L3_INITIATED); - - return 1; -} - - -/** - * Q921InvokeRetransmission - * \brief I Frame retransmission procedure - * \param trunk Q.921 data structure - * \param tei TEI - * \param nr N(R) for retransmission - * \return always 1 (success) - */ -static int Q921InvokeRetransmission(L2TRUNK trunk, L2UCHAR tei, L2UCHAR nr) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - L2UCHAR *mes; - L2INT qpos, qnum, size = 0; - - qnum = MFIFOGetMesCount(link->IFrameResendQueue); - qpos = qnum - 1; - - /* - * slightly different than what is shown in the spec - * (Q.921 '97 Annex B, Figure B.9, page 104) - * - * what the above mentioned figure probably means is: - * "as long as V(S) != N(R), move the pointer marking - * the first frame to start resending at to the previous - * frame" - * - * if we actually implemented it as shown in the figure, we'd be - * resending frames in the wrong order (moving backwards in time) - * meaning we'd have to add an incoming queue to reorder the frames - * - */ - /* - * TODO: There's a "traditional" off-by-one error hidden in the original - * mfifo implementation + it's late, i'm tired and being lazy, - * so i'll probably have added another one :P - * - * wow, the first while loop sucks and can be removed - */ - while(link->vs != nr && qpos > 0) { /* ???? */ - /* V(S) = V(S) - 1 */ - Q921_DEC_COUNTER(link->vs); /* huh? backwards? */ - - /* next frame in queue (backtrack along I queue) ??? */ - qpos--; - } - - /* - * being lazy and trying to avoid mod 128 math this way... - */ - if(link->vs != nr && !qpos) { - /* fatal, we don't have enough history to resend all missing frames */ - /* TODO: how to handle this? */ - } - - /* - * resend frames in correct order (oldest missing frame first, - * contrary to what the spec figure shows) - */ - while(qpos < qnum) { - /* Grab frame's buffer ptr and size from queue */ - mes = MFIFOGetMesPtrOffset(link->IFrameResendQueue, &size, qpos); - if(mes) { - /* requeue frame (TODO: check queue full condition) */ - MFIFOWriteMes(link->IFrameQueue, mes, size); - - /* set I frame queued */ - } - - qpos++; - } - - return 1; -} - - -static int Q921AcknowledgePending(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - case Q921_STATE_TIMER_RECOVERY: - if(Q921_CHECK_FLAG(link, Q921_FLAG_ACK_PENDING)) { - /* clear acknowledge pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - - /* send RR */ - Q921SendRR(trunk, trunk->sapi, Q921_COMMAND(trunk), tei, 0); - - return 1; - } - break; - - default: - break; - } - - return 0; -} - -/***************************************************************************** - - Function: Q921_InitTrunk - - Decription: Initialize a Q.921 trunk so it is ready for use. This - function MUST be called before you call any other functions. - -*****************************************************************************/ -int Q921_InitTrunk(L2TRUNK trunk, - L2UCHAR sapi, - L2UCHAR tei, - Q921NetUser_t NetUser, - Q921NetType_t NetType, - L2INT hsize, - Q921Tx21CB_t cb21, - Q921Tx23CB_t cb23, - void *priv21, - void *priv23) -{ - int numlinks = 0; - - trunk->sapi = sapi; - trunk->tei = tei; - trunk->NetUser = NetUser; - trunk->NetType = NetType; - trunk->Q921Tx21Proc = cb21; - trunk->Q921Tx23Proc = cb23; - trunk->PrivateData21 = priv21; - trunk->PrivateData23 = priv23; - trunk->Q921HeaderSpace = hsize; - - numlinks = Q921_IS_PTMP_NT(trunk) ? Q921_TEI_MAX : 1; - - if (trunk->initialized != INITIALIZED_MAGIC) { - MFIFOCreate(trunk->HDLCInQueue, Q921MAXHDLCSPACE, 10); - - /* - * Allocate space for per-link context(s) - */ - trunk->context = ftdm_malloc(numlinks * sizeof(struct Q921_Link)); - if(!trunk->context) - return -1; - - trunk->initialized = INITIALIZED_MAGIC; - } - - /* timeout default values */ - trunk->T200Timeout = 1000; /* 1 second */ - trunk->T203Timeout = 10000; /* 10 seconds */ - trunk->T202Timeout = 2000; /* 2 seconds */ - trunk->T201Timeout = 200000; /* 200 seconds */ - trunk->TM01Timeout = 10000; /* 10 seconds */ - - /* octet / retransmit counter default limits */ - trunk->N200Limit = 3; /* 3 retransmits */ - trunk->N201Limit = 260; /* 260 octets */ - trunk->N202Limit = 3; /* 3 retransmits */ - trunk->k = 7; /* 7 outstanding ACKs */ - - /* reset counters, timers, etc. */ - trunk->T202 = 0; - trunk->N202 = 0; - - /* Reset per-link contexts */ - memset(trunk->context, 0, numlinks * sizeof(struct Q921_Link)); - - /* clear tei map */ - memset(trunk->tei_map, 0, Q921_TEI_MAX + 1); - - if(Q921_IS_PTMP(trunk)) { - /* - * We're either the Network side (NT, TEI = 0) - * or user-side equipment (TE) which will get it's TEI via - * dynamic assignment - */ - trunk->tei = 0; - } - - return 0; -} - - -/** - * Q921Tx21Proc - * \brief Submit frame to layer 1 (for sending) - * \param[in] trunk Pointer to trunk struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success; <= 0 on error - */ -static int Q921Tx21Proc(L2TRUNK trunk, L2UCHAR *Msg, L2INT size) -{ - Q921LogMesg(trunk, Q921_LOG_DEBUG, 0, Msg, size, "Sending frame"); - - return trunk->Q921Tx21Proc(trunk->PrivateData21, Msg, size); -} - - -/** - * Q921Tx23Proc - * \brief Submit frame to layer 3 - * \param[in] trunk Pointer to trunk struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success; <= 0 on error - */ -static int Q921Tx23Proc(L2TRUNK trunk, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *Msg, L2INT size) -{ - return trunk->Q921Tx23Proc(trunk->PrivateData23, ind, tei, Msg, size); -} - - -/** - * Q921LogProc - * \brief Used for logging, converts to string and submits to higher level log function via callback - * \param[in] trunk Pointer to trunk struct - * \param[in] level Q921 Loglevel - * \param[in] fmt format of logmessage - * \return >= 0 on success, < 0 on error - * - * \author Stefan Knoblich - */ -static int Q921Log(L2TRUNK trunk, Q921LogLevel_t level, const char *fmt, ...) -{ - char buf[Q921_LOGBUFSIZE]; - L2INT len; - va_list ap; - - if(!trunk->Q921LogProc) - return 0; - - if(trunk->loglevel < level) - return 0; - - va_start(ap, fmt); - - len = vsnprintf(buf, sizeof(buf)-1, fmt, ap); - if(len <= 0) { - /* TODO: error handling */ - return -1; - } - if(len >= sizeof(buf)) - len = sizeof(buf) - 1; - - buf[len] = '\0'; - - va_end(ap); - - return trunk->Q921LogProc(trunk->PrivateDataLog, level, buf, len); -} - - -static int print_hex(char *buf, int bsize, const unsigned char *in, const int len) -{ - static const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - int offset = 0; - int pos = 0; - int nr = 0; - - buf[pos++] = '['; - bsize -= 3; - - while((bsize - pos) > 0 && offset < len) { - buf[pos++] = hex[(in[offset] & 0xF0) >> 4]; - buf[pos++] = hex[(in[offset++] & 0x0F)]; - - if(++nr == 32 && offset < len && (bsize - pos) > 3) { - nr = 0; - buf[pos++] = ']'; - buf[pos++] = '\n'; - buf[pos++] = '['; - } - else if(offset < len) { - buf[pos++] = ' '; - } - } - - buf[pos++] = ']'; - buf[pos++] = '\n'; - buf[pos] = '\0'; - - return pos; -} - -#define APPEND_MSG(buf, off, lef, fmt, ...) \ - len = snprintf(buf + off, lef, fmt, ##__VA_ARGS__); \ - if(len > 0) { \ - off += len; \ - lef -= len; \ - } else { \ - goto out; \ - } - -/** - * Q921LogProcMesg - * \brief Used for logging, converts to string and submits to higher level log function via callback - * \param[in] trunk Pointer to trunk struct - * \param[in] level Q921 Loglevel - * \param[in] received direction of the message (received = 1, sending = 0) - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \param[in] fmt format of logmessage - * \return >= 0 on success, < 0 on error - * - * \author Stefan Knoblich - */ -static int Q921LogMesg(L2TRUNK trunk, Q921LogLevel_t level, L2UCHAR received, L2UCHAR *mes, L2INT size, const char *fmt, ...) -{ - char buf[Q921_LOGBUFSIZE]; - size_t len, left; - va_list ap; - - if(!trunk->Q921LogProc) - return 0; - - if(trunk->loglevel < level) - return 0; - - if(!mes) - return 0; - - memset(buf, 0, sizeof(buf)); - - left = sizeof(buf) - 1; - - va_start(ap, fmt); - - len = vsnprintf(buf, left, fmt, ap); - if(len > 0) - left -= len; - else { - /* TODO: error handling */ - return -1; - } - - va_end(ap); - - if(trunk->loglevel == Q921_LOG_DEBUG) { - char pbuf[1024]; - size_t pleft, poffset; - L2UCHAR sapi, tei, cr; - L2UCHAR *pmes = mes + trunk->Q921HeaderSpace; - struct Q921_Link *link; - - memset(pbuf, 0, sizeof(pbuf)); - - pleft = sizeof(pbuf); - poffset = 0; - - /* - * Decode packet - */ - sapi = (pmes[0] & 0xfc) >> 2; - cr = (pmes[0] & 0x02) >> 1; - tei = (pmes[1] & 0xfe) >> 1; - link = Q921_LINK_CONTEXT(trunk, tei); - - /* make cr actually useful */ - cr = (received) ? Q921_IS_COMMAND(trunk, cr) : Q921_IS_RESPONSE(trunk, cr); - - /* filter */ - if((pmes[2] & 0x01) == 0x00) { - ; - } - else if((pmes[2] & 0x03) == 0x01) { - ; //return 0; - } - else if((pmes[2] & 0x03) == 0x03) { - ; - } - - APPEND_MSG(pbuf, poffset, pleft, "\n----------------- Q.921 Packet [%s%s] ---------------\n", received ? "Incoming" : "Outgoing", - (tei == link->tei || tei == Q921_TEI_BCAST) ? "" : ", Ignored" ); - - /* common header */ - APPEND_MSG(pbuf, poffset, pleft, " SAPI: %u, TEI: %u, C/R: %s (%d)\n\n", sapi, tei, (cr) ? "Command" : "Response", (mes[0] & 0x02) >> 1 ); - - /* - * message specific - */ - if((pmes[2] & 0x01) == 0x00) { - /* - * I frame - */ - L2UCHAR pf = pmes[3] & 0x01; /* poll / final flag */ - L2UCHAR nr = pmes[3] >> 1; /* receive sequence number */ - L2UCHAR ns = pmes[2] >> 1; /* send sequence number */ - - APPEND_MSG(pbuf, poffset, pleft, " Type: I Frame\n P/F: %d, N(S): %d, N(R): %d [V(A): %d, V(R): %d, V(S): %d]\n", pf, ns, nr, - link->va, link->vr, link->vs); - - /* Dump content of I Frames for foreign TEIs */ - if(tei != link->tei) { - APPEND_MSG(pbuf, poffset, pleft, " CONTENT:\n"); - - len = print_hex(pbuf + poffset, (int)pleft, &pmes[4], size - (trunk->Q921HeaderSpace + 4)); - poffset += len; - pleft -= len; - } - } - else if((pmes[2] & 0x03) == 0x01) { - /* - * S frame - */ - L2UCHAR sv = (pmes[2] & 0x0c) >> 2; /* supervisory format id */ - L2UCHAR pf = pmes[3] & 0x01; /* poll / final flag */ - L2UCHAR nr = pmes[3] >> 1; /* receive sequence number */ - const char *type; - - switch(sv) { - case 0x00: /* RR : Receive Ready */ - type = "RR (Receive Ready)"; - break; - - case 0x02: /* RNR : Receive Not Ready */ - type = "RNR (Receiver Not Ready)"; - break; - - case 0x04: /* REJ : Reject */ - type = "REJ (Reject)"; - break; - - default: /* Invalid / Unknown */ - type = "Unknown"; - break; - } - - APPEND_MSG(pbuf, poffset, pleft, " Type: S Frame, SV: %s\n P/F: %d, N(R): %d [V(A): %d, V(R): %d, V(S): %d]\n", type, pf, nr, - link->va, link->vr, link->vs); - } - else if((pmes[2] & 0x03) == 0x03) { - /* - * U frame - */ - L2UCHAR m = (pmes[2] & 0xe0) >> 3 | (pmes[2] & 0x0c) >> 2; /* modifier function id */ - L2UCHAR pf = (pmes[2] & 0x10) >> 4; /* poll / final flag */ - const char *type; - - switch(m) { - case 0x00: - type = "UI (Unnumbered Information)"; - break; - - case 0x03: - type = "DM (Disconnected Mode)"; - break; - - case 0x08: - type = "DISC (Disconnect)"; - break; - - case 0x0c: - type = "UA (Unnumbered Acknowledgement)"; - break; - - case 0x0f: - type = "SABME"; - break; - - case 0x11: - type = "FRMR (Frame Reject)"; - break; - - case 0x17: - type = "XID (Exchange Identification)"; - break; - - default: - type = "Unknown"; - } - - - APPEND_MSG(pbuf, poffset, pleft, " Type: U Frame (%s)\n P/F: %d\n", type, pf); - - if(m == 0x00) { - switch(pmes[3]) { - case Q921_LAYER_ENT_ID_TEI: - type = "TEI Mgmt"; - break; - - case Q921_LAYER_ENT_ID_Q931: - type = "Q.931"; - break; - - default: - type = "Unknown"; - } - - if(pmes[3] == Q921_LAYER_ENT_ID_TEI) { - const char *command = ""; - - switch(pmes[6]) { - case Q921_TEI_ID_REQUEST: - command = "Request"; - break; - case Q921_TEI_ID_VERIFY: - command = "Verify"; - break; - case Q921_TEI_ID_CHECKREQ: - command = "Check req"; - break; - case Q921_TEI_ID_CHECKRESP: - command = "Check resp"; - break; - case Q921_TEI_ID_REMOVE: - command = "Remove"; - break; - case Q921_TEI_ID_ASSIGNED: - command = "Assign"; - break; - case Q921_TEI_ID_DENIED: - command = "Denied"; - break; - } - APPEND_MSG(pbuf, poffset, pleft, " ENT ID: %d (%s), COMMAND: %d (%s), RI: %#x, AI: %d\n", - pmes[3], type, pmes[6], command, (int)((pmes[4] << 8) | pmes[5]), pmes[7] >> 1); - } - else { - APPEND_MSG(pbuf, poffset, pleft, " ENT ID: %d (%s), MESSAGE CONTENT:\n", pmes[3], type); - - len = print_hex(pbuf + poffset, (int)pleft, &pmes[3], size - (trunk->Q921HeaderSpace + 3)); - poffset += len; - pleft -= len; - } - } - } - else { - /* - * Unknown - */ - strncat(pbuf + poffset, " -- unknown frame type --\n", pleft); - - len = (sizeof(pbuf) - poffset) - strlen(pbuf + poffset); - if(len > 0) { - poffset += len; - pleft -= len; - } else - goto out; - } - - APPEND_MSG(pbuf, poffset, pleft, "\n Q.921 state: \"%s\" (%d) [flags: %c%c%c%c]\n", Q921State2Name(link->state), link->state, - Q921_CHECK_FLAG(link, Q921_FLAG_ACK_PENDING) ? 'A' : '-', - Q921_CHECK_FLAG(link, Q921_FLAG_REJECT) ? 'R' : '-', - Q921_CHECK_FLAG(link, Q921_FLAG_PEER_RECV_BUSY) ? 'P' : '-', - Q921_CHECK_FLAG(link, Q921_FLAG_RECV_BUSY) ? 'B' : '-'); - - strncat(pbuf + poffset, "----------------------------------------------\n\n", pleft); - - len = (sizeof(pbuf) - poffset) - strlen(pbuf + poffset); - if(len > 0) { - poffset += len; - pleft -= len; - } else - goto out; - - - /* concat buffers together */ - len = strlen(pbuf); - if(len <= left) - strncat(buf, pbuf, left); - else - strncat(buf, "-- packet truncated --\n", left); - } - -out: - buf[sizeof(buf) - 1] = '\0'; - - return trunk->Q921LogProc(trunk->PrivateDataLog, level, buf, (int)strlen(buf)); -} - -/***************************************************************************** - - Function: Q921TimeTick - - Description: Called periodically from an external source to allow the - stack to process and maintain it's own timers. - - Return Value: none - -*****************************************************************************/ -static L2ULONG (*Q921GetTimeProc) (void) = NULL; /* callback for func reading time in ms */ -static L2ULONG tLast = {0}; - -static L2ULONG Q921GetTime(void) -{ - L2ULONG tNow = 0; - - if(Q921GetTimeProc) - { - tNow = Q921GetTimeProc(); - if(tNow < tLast) /* wrapped */ - { - /* TODO */ - } - tLast = tNow; - } - return tNow; -} - -/* - * T200 handling (per-TEI in PTMP NT mode, tei=0 otherwise) - */ -static void Q921T200TimerStart(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - if (!link->T200) { - link->T200 = Q921GetTime() + trunk->T200Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "T200 (timeout: %d msecs) started for TEI %d\n", trunk->T200Timeout, tei); - } -} - -static void Q921T200TimerStop(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - link->T200 = 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "T200 stopped for TEI %d\n", tei); -} - -static void Q921T200TimerReset(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - link->T200 = Q921GetTime() + trunk->T200Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "T200 (timeout: %d msecs) restarted for TEI %d\n", trunk->T200Timeout, tei); -} - -/* - * T203 handling (per-TEI in PTMP NT mode, tei=0 otherwise) - */ -static void Q921T203TimerStart(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - if (!link->T203) { - link->T203 = Q921GetTime() + trunk->T203Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "T203 (timeout: %d msecs) started for TEI %d\n", trunk->T203Timeout, tei); - } -} - -static void Q921T203TimerStop(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - link->T203 = 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "T203 stopped for TEI %d\n", tei); -} - -static void Q921T203TimerReset(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - link->T203 = Q921GetTime() + trunk->T203Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "T203 (timeout: %d msecs) restarted for TEI %d\n", trunk->T203Timeout, tei); -} - -/* - * T202 handling (TEI message timeout, TE mode only) - */ -static void Q921T202TimerStart(L2TRUNK trunk) -{ - if (!trunk->T202) { - trunk->T202 = Q921GetTime() + trunk->T202Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "T202 (timeout: %d msecs) started\n", trunk->T202Timeout); - } -} - -static void Q921T202TimerStop(L2TRUNK trunk) -{ - trunk->T202 = 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "T202 stopped\n"); -} - -static void Q921T202TimerReset(L2TRUNK trunk) -{ - trunk->T202 = Q921GetTime() + trunk->T202Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "T202 (timeout: %d msecs) restarted\n", trunk->T202Timeout); -} - -/* - * T201 handling (TEI management (NT side), per-TEI) - */ -static void Q921T201TimerStart(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - if (!link->T201) { - link->T201 = Q921GetTime() + trunk->T201Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "T201 (timeout: %d msecs) started for TEI %d\n", trunk->T201Timeout, tei); - } -} - -static void Q921T201TimerStop(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - link->T201 = 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "T201 stopped for TEI %d\n", tei); -} - -#ifdef __UNUSED_FOR_NOW__ -static void Q921T201TimerReset(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - link->T201 = Q921GetTime() + trunk->T201Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "T201 (timeout: %d msecs) restarted for TEI %d\n", trunk->T201Timeout, tei); -} -#endif - -/* - * TM01 handling (Datalink inactivity shutdown timer) - */ -static void Q921TM01TimerStart(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - if (!link->TM01) { - link->TM01 = Q921GetTime() + trunk->TM01Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "TM01 (timeout: %d msecs) started for TEI %d\n", trunk->TM01Timeout, tei); - } -} - -#ifdef __UNUSED_FOR_NOW__ -static void Q921TM01TimerStop(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - link->TM01 = 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "TM01 stopped for TEI %d\n", tei); -} -#endif - -static void Q921TM01TimerReset(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - link->TM01 = Q921GetTime() + trunk->TM01Timeout; - - Q921Log(trunk, Q921_LOG_DEBUG, "TM01 (timeout: %d msecs) restarted for TEI %d\n", trunk->TM01Timeout, tei); -} - -/* - * Expiry callbacks - */ -static void Q921T200TimerExpire(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - struct Q921_Link *trlink = Q921_TRUNK_CONTEXT(trunk); - - Q921Log(trunk, Q921_LOG_DEBUG, "T200 expired for TEI %d (trunk TEI %d)\n", tei, trlink->tei); - - /* Stop timer first */ - Q921T200TimerStop(trunk, tei); - - switch(link->state) { - case Q921_STATE_AWAITING_ESTABLISHMENT: - if(link->N200 >= trunk->N200Limit) { - /* Discard I queue */ - MFIFOClear(link->IFrameQueue); - - /* MDL-Error indication (G) */ - Q921Log(trunk, Q921_LOG_ERROR, "Failed to establish Q.921 link in %d retries\n", link->N200); - - /* DL-Release indication */ - Q921Tx23Proc(trunk, Q921_DL_RELEASE, tei, NULL, 0); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_TEI_ASSIGNED, tei); - } else { - /* Increment retry counter */ - link->N200++; - - /* Send SABME */ - Q921SendSABME(trunk, - trunk->sapi, - Q921_COMMAND(trunk), - tei, - 1); - - /* Start T200 */ - Q921T200TimerStart(trunk, tei); - } - break; - - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - link->N200 = 0; - - if(!Q921_CHECK_FLAG(link, Q921_FLAG_PEER_RECV_BUSY)) { - /* get last transmitted I frame */ - - /* V(S) = V(S) - 1 */ - Q921_DEC_COUNTER(link->vs); - - /* retransmit I frame */ - - /* V(S) = V(S) + 1 (done by Q921SendI() ) */ - //Q921_INC_COUNTER(link->vs); - - /* clear acknowledge pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - - /* Start T200 */ - Q921T200TimerStart(trunk, tei); - } else { - /* transmit enquiry */ - Q921SendEnquiry(trunk, tei); - } - - /* increment counter */ - link->N200++; - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_TIMER_RECOVERY, tei); - break; - - case Q921_STATE_TIMER_RECOVERY: - if(link->N200 == trunk->N200Limit) { - /* MDL Error indication (I) */ - - /* Establish data link */ - Q921EstablishDataLink(trunk, tei); - - /* Clear L3 initiated */ - Q921_CLEAR_FLAG(link, Q921_FLAG_L3_INITIATED); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } else { - if(link->vs == link->va) { - /* transmit enquiry */ - Q921SendEnquiry(trunk, tei); - - } else if(!Q921_CHECK_FLAG(link, Q921_FLAG_PEER_RECV_BUSY)) { - /* get last transmitted frame */ - - /* V(S) = V(S) - 1 */ - Q921_DEC_COUNTER(link->vs); - - /* retrans frame */ - - /* V(S) = V(S) + 1 (done by Q921SendI() ) */ - //Q921_INC_COUNTER(link->vs); - - /* clear acknowledge pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - - /* Start T200 */ - Q921T200TimerStart(trunk, tei); - } - - /* increment counter */ - link->N200++; - - /* no state change */ - } - break; - - default: - break; - } -} - -static void Q921T203TimerExpire(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - struct Q921_Link *trlink = Q921_TRUNK_CONTEXT(trunk); - - Q921Log(trunk, Q921_LOG_DEBUG, "T203 expired for TEI %d (trunk TEI %d)\n", tei, trlink->tei); - - /* Stop Timer first */ - Q921T203TimerStop(trunk, tei); - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - /* Send Enquiry */ - Q921SendEnquiry(trunk, tei); - - /* RC = 0 */ - link->N200 = 0; - - /* no state change */ - break; - - default: - break; - } -} - -static void Q921T202TimerExpire(L2TRUNK trunk) -{ - struct Q921_Link *link = Q921_TRUNK_CONTEXT(trunk); - - Q921T202TimerReset(trunk); - - Q921Log(trunk, Q921_LOG_DEBUG, "T202 expired for Q.921 trunk with TEI %d\n", link->tei); - - /* todo: implement resend counter */ - - switch(link->state) { - case Q921_STATE_TEI_ASSIGNED: /* Tei identity verify timeout */ - Q921TeiSendVerifyRequest(trunk); - break; - - default: /* Tei assignment request timeout (TODO: refine) */ - - if(trunk->N202 >= trunk->N202Limit) { - /* Too many retransmits, reset counter, stop timer and handle case (TODO) */ - trunk->N202 = 0; - - Q921T202TimerStop(trunk); - - return; - } - Q921TeiSendAssignRequest(trunk); - - trunk->N202++; - } -} - -static void Q921T201TimerExpire(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - struct Q921_Link *trlink = Q921_TRUNK_CONTEXT(trunk); - - Q921Log(trunk, Q921_LOG_DEBUG, "T201 expired for TEI %d (trunk TEI: %d)\n", tei, trlink->tei); - - Q921T201TimerStop(trunk, tei); - - /* NOTE: abusing N202 for this */ - if(link->N202 < trunk->N202Limit) { - /* send check request */ - Q921TeiSendCheckRequest(trunk, tei); - - /* increment counter */ - link->N202++; - } else { - /* put context in STOPPED state */ - Q921ChangeState(trunk, Q921_STATE_STOPPED, tei); - - /* NOTE: should we clear the link too? */ - memset(link, 0, sizeof(struct Q921_Link)); - - /* mark TEI free */ - trunk->tei_map[tei] = 0; - } -} - -#ifdef __UNUSED_FOR_NOW__ -static void Q921TM01TimerExpire(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - struct Q921_Link *trlink = Q921_TRUNK_CONTEXT(trunk); - - Q921Log(trunk, Q921_LOG_DEBUG, "TM01 expired for TEI %d (trunk TEI: %d)\n", tei, trlink->tei); - - /* Restart TM01 */ - Q921TM01TimerReset(trunk, tei); - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - case Q921_STATE_TIMER_RECOVERY: -/* - * NT-only, needs more support from L3 - */ -#if 0 - /* No activity, shutdown link */ - Q921SendDISC(trunk, trunk->sapi, Q921_COMMAND(trunk), tei, 1); - - /* clear I queue */ - MFIFOClear(link->IFrameQueue); - - /* change state */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_RELEASE, tei); -#endif - break; - - default: - break; - } -} -#endif - -/* - * Timer Tick function - */ -void Q921TimerTick(L2TRUNK trunk) -{ - struct Q921_Link *link; - L2ULONG tNow = Q921GetTime(); - int numlinks = Q921_IS_PTMP_NT(trunk) ? Q921_TEI_MAX : 1; - int x; - - for(x = 0; x <= numlinks; x++) { - link = Q921_LINK_CONTEXT(trunk, x); - - /* TODO: check if TEI is assigned and skip check if not (speedup!) */ - if(link->state == Q921_STATE_STOPPED) - continue; - - if (link->T200 && tNow > link->T200) { - Q921T200TimerExpire(trunk, link->tei); - } - if (link->T203 && tNow > link->T203) { - Q921T203TimerExpire(trunk, link->tei); - } - - if(Q921_IS_PTMP_NT(trunk) && link->tei) { - if (link->T201 && tNow > link->T201) { - Q921T201TimerExpire(trunk, link->tei); - } - } - - if(!Q921_IS_PTMP_NT(trunk)) { - if (trunk->T202 && tNow > trunk->T202) { - Q921T202TimerExpire(trunk); - } - } - - /* Send enqueued I frame, if available */ - Q921SendQueuedIFrame(trunk, link->tei); - - /* Send ack if pending */ - Q921AcknowledgePending(trunk, link->tei); - } - -} - -void Q921SetGetTimeCB(L2ULONG (*callback)(void)) -{ - Q921GetTimeProc = callback; -} - -/***************************************************************************** - - Function: Q921QueueHDLCFrame - - Description: Called to receive and queue an incoming HDLC frame. Will - queue this in Q921HDLCInQueue. The called must either call - Q921Rx12 directly afterwards or signal Q921Rx12 to be called - later. Q921Rx12 will read from the same queue and process - the frame. - - This function assumes that the message contains header - space. This is removed for internal Q921 processing, but - must be keept for I frames. - - Parameters: trunk trunk # - b ptr to frame; - size size of frame in bytes - -*****************************************************************************/ -int Q921QueueHDLCFrame(L2TRUNK trunk, L2UCHAR *b, L2INT size) -{ - return MFIFOWriteMes(trunk->HDLCInQueue, b, size); -} - -/** - * Q921EnqueueI - * \brief Put I frame into transmit queue - * - */ -static int Q921EnqueueI(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR *mes, L2INT size) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, Tei); - - /* I frame header */ - mes[trunk->Q921HeaderSpace+0] = ((Sapi << 2) & 0xfc) | ((cr << 1) & 0x02); - mes[trunk->Q921HeaderSpace+1] = (Tei << 1) | 0x01; - mes[trunk->Q921HeaderSpace+2] = 0x00; - mes[trunk->Q921HeaderSpace+3] = (pf & 0x01); - - Q921Log(trunk, Q921_LOG_DEBUG, "Enqueueing I frame for TEI %d [%d]\n", link->tei, Tei); - - /* transmit queue, (TODO: check for full condition!) */ - MFIFOWriteMes(link->IFrameQueue, mes, size); - - /* try to send queued frame */ - Q921SendQueuedIFrame(trunk, link->tei); - - return 1; -} - -/** - * Q921SendQueuedIFrame - * \brief Try to transmit queued I frame (if available) - */ -static int Q921SendQueuedIFrame(L2TRUNK trunk, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - L2INT size = 0; - L2UCHAR *mes; - - if(MFIFOGetMesCount(link->IFrameQueue) == 0) { - return 0; - } - - /* Link ready? */ - if(link->state != Q921_STATE_MULTIPLE_FRAME_ESTABLISHED) { - return 0; - } - - /* peer receiver busy? */ - if(Q921_CHECK_FLAG(link, Q921_FLAG_PEER_RECV_BUSY)) { - return 0; - } - - /* V(S) = V(A) + k? */ - if(link->vs == ((link->va + trunk->k) % 128)) { - Q921Log(trunk, Q921_LOG_WARNING, "Maximum number (%d) of outstanding I frames reached for TEI %d\n", trunk->k, tei); - return 0; - } - - mes = MFIFOGetMesPtr(link->IFrameQueue, &size); - if(mes) { - /* Fill in + update counter values */ - mes[trunk->Q921HeaderSpace+2] = link->vs << 1; - mes[trunk->Q921HeaderSpace+3] |= link->vr << 1; - - if(MFIFOGetMesCount(link->IFrameQueue) == 0) { - /* clear I frame queued */ - } - - /* Send I frame */ - Q921Tx21Proc(trunk, mes, size); - - /* V(S) = V(S) + 1 */ - Q921_INC_COUNTER(link->vs); - - /* clear acknowledge pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - - /* T200 running? */ - if(!link->T200) { - /* Stop T203, Start T200 */ - Q921T200TimerStart(trunk, tei); - Q921T203TimerStop(trunk, tei); - } - - /* put frame into resend queue */ - MFIFOWriteMesOverwrite(link->IFrameResendQueue, mes, size); - - /* dequeue frame */ - MFIFOKillNext(link->IFrameQueue); - - /* Restart TM01 */ - if(Q921_IS_NT(trunk)) { - Q921TM01TimerReset(trunk, tei); - } - - /* no state change */ - return 1; - } - - return 0; -} - -/** - * Q921SendS - * \brief Prepare and send S frame - */ -static int Q921SendS(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR sv, L2UCHAR *mes, L2INT size) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, Tei); - - if(!Q921_IS_READY(link)) { - /* don't even bother trying */ - Q921Log(trunk, Q921_LOG_DEBUG, "Link not ready, discarding S frame for TEI %d\n", Tei); - return 0; - } - - /* S frame header */ - mes[trunk->Q921HeaderSpace+0] = ((Sapi << 2) & 0xfc) | ((cr << 1) & 0x02); - mes[trunk->Q921HeaderSpace+1] = (Tei << 1) | 0x01; - mes[trunk->Q921HeaderSpace+2] = ((sv << 2) & 0x0c) | 0x01; - mes[trunk->Q921HeaderSpace+3] = (link->vr << 1) | (pf & 0x01); - - return Q921Tx21Proc(trunk, mes, size); -} - - -/** - * Q921SendU - * \brief Prepare and send U frame - */ -static int Q921SendU(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR m, L2UCHAR *mes, L2INT size) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, Tei); - - /* U frame header */ - mes[trunk->Q921HeaderSpace+0] = ((Sapi << 2) & 0xfc) | ((cr << 1) & 0x02); - mes[trunk->Q921HeaderSpace+1] = (Tei << 1) | 0x01; - mes[trunk->Q921HeaderSpace+2] = ((m << 3) & 0xe0) | ((pf << 4) & 0x10) | ((m << 2) & 0x0c) | 0x03; - - /* link not ready? enqueue non-TEI-mgmt UI (DL-UNIT DATA) frames */ - if(m == 0x00 && Sapi != Q921_SAPI_TEI && link->state < Q921_STATE_TEI_ASSIGNED) { - - /* write frame to queue */ - MFIFOWriteMes(link->UIFrameQueue, mes, size); - - Q921Log(trunk, Q921_LOG_DEBUG, "Link not ready, UI Frame of size %d bytes queued for TEI %d\n", size, Tei); - return 1; - } - - return Q921Tx21Proc(trunk, mes, size); -} - -/** - * TODO: NT mode handling? Need a way to get Link context from Q.931 - */ -int Q921Rx32(L2TRUNK trunk, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR * Mes, L2INT Size) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); /* TODO: need real link tei for NT mode */ - L2INT res = 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "Got frame from Q.931, type: %d, tei: %d, size: %d\n", ind, tei, Size); - - switch(ind) { - case Q921_DL_ESTABLISH: - /* - * Hmm... - */ - switch(link->state) { - case Q921_STATE_TEI_ASSIGNED: - if(!Q921_IS_NT(trunk)) { - /* establish data link */ - Q921EstablishDataLink(trunk, link->tei); - - /* Set layer 3 initiated */ - Q921_SET_FLAG(link, Q921_FLAG_L3_INITIATED); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, link->tei); - } - break; - - case Q921_STATE_AWAITING_ESTABLISHMENT: - if(!Q921_IS_NT(trunk)) { - /* Discard I queue */ - MFIFOClear(link->IFrameQueue); - - /* Set layer 3 initiated */ - Q921_SET_FLAG(link, Q921_FLAG_L3_INITIATED); - } - break; - - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - case Q921_STATE_TIMER_RECOVERY: - if(!Q921_IS_NT(trunk)) { - /* Discard I queue */ - MFIFOClear(link->IFrameQueue); - - /* establish data link */ - Q921EstablishDataLink(trunk, link->tei); - - /* Set layer 3 initiated */ - Q921_SET_FLAG(link, Q921_FLAG_L3_INITIATED); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, link->tei); - } - break; - - default: - break; - } - break; - - case Q921_DL_RELEASE: - switch(link->state) { - case Q921_STATE_TEI_ASSIGNED: - /* send DL-RELEASE confirm */ - Q921Tx23Proc(trunk, Q921_DL_RELEASE, tei, NULL, 0); - break; - - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - case Q921_STATE_TIMER_RECOVERY: - if(!Q921_IS_NT(trunk)) { - /* Discard I queue */ - MFIFOClear(link->IFrameQueue); - - /* RC = 0 */ - link->N200 = 0; - - /* send DISC command */ - Q921SendDISC(trunk, trunk->sapi, Q921_COMMAND(trunk), link->tei, 1); - - /* Stop T203, restart T200 */ - if(link->state == Q921_STATE_MULTIPLE_FRAME_ESTABLISHED) { - Q921T203TimerStop(trunk, link->tei); - } - Q921T200TimerReset(trunk, link->tei); - - /* change state */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_RELEASE, link->tei); - } - break; - - default: - break; - } - break; - - case Q921_DL_DATA: /* DL-DATA request */ - res = Q921EnqueueI(trunk, - trunk->sapi, - Q921_COMMAND(trunk), - link->tei, - 0, - Mes, - Size); - - if(link->state < Q921_STATE_MULTIPLE_FRAME_ESTABLISHED) { - /* Treat as implicit DL-ESTABLISH request */ - - /* establish data link */ - Q921EstablishDataLink(trunk, link->tei); - - /* Set layer 3 initiated */ - Q921_SET_FLAG(link, Q921_FLAG_L3_INITIATED); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, link->tei); - } - break; - - case Q921_DL_UNIT_DATA: /* DL-UNIT DATA request */ - res = Q921SendUN(trunk, - trunk->sapi, - Q921_COMMAND(trunk), - Q921_TEI_BCAST, - 0, - Mes, - Size); - /* NOTE: Let the other side initiate link establishment */ - break; - - default: - break; - } - - return res; -} -/***************************************************************************** - - Function: Q921SendRR - - Description: Compose and send Receive Ready. - - Parameters: trunk trunk # - Sapi Sapi - cr C/R field. - Tei Tei. - pf P/F fiels octet 5 - - Return Value: 0 if failed, 1 if Send. - -*****************************************************************************/ - -static int Q921SendRR(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf) -{ - L2UCHAR mes[25]; - - return Q921SendS(trunk, Sapi, cr, Tei, pf, 0x00, mes, trunk->Q921HeaderSpace+4); -} - -/***************************************************************************** - - Function: Q921SendRNR - - Description: Compose and send Receive Nor Ready - - Parameters: trunk trunk # - Sapi Sapi - cr C/R field. - Tei Tei. - pf P/F fiels octet 5 - - Return Value: 0 if failed, 1 if Send. - -*****************************************************************************/ -static int Q921SendRNR(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf) -{ - L2UCHAR mes[25]; - - return Q921SendS(trunk, Sapi, cr, Tei, pf, 0x01, mes, trunk->Q921HeaderSpace+4); -} - -/***************************************************************************** - - Function: Q921SendREJ - - Description: Compose and Send Reject. - - Parameters: trunk trunk # - Sapi Sapi - cr C/R field. - Tei Tei. - pf P/F fiels octet 5 - - Return Value: 0 if failed, 1 if Send. - -*****************************************************************************/ -static int Q921SendREJ(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf) -{ - L2UCHAR mes[25]; - - return Q921SendS(trunk, Sapi, cr, Tei, pf, 0x03, mes, trunk->Q921HeaderSpace+4); -} - -/***************************************************************************** - - Function: Q921SendSABME - - Description: Compose and send SABME - - Parameters: trunk trunk # - Sapi Sapi - cr C/R field. - Tei Tei. - pf P fiels octet 4 - - Return Value: 0 if failed, 1 if Send. - -*****************************************************************************/ -static int Q921SendSABME(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf) -{ - L2UCHAR mes[25]; - - return Q921SendU(trunk, Sapi, cr, Tei, pf, 0x0f, mes, trunk->Q921HeaderSpace+3); -} - - -/** - * Q921Start - * \brief Start trunk - * \param[in] trunk pointer to Q921 data struct - * \return > 0 on success; <= 0 on error - */ -int Q921Start(L2TRUNK trunk) -{ - int x, numlinks = Q921_IS_PTMP_NT(trunk) ? Q921_TEI_MAX : 1; - struct Q921_Link *link = Q921_TRUNK_CONTEXT(trunk); - - if(trunk->initialized != INITIALIZED_MAGIC) - return 0; - - memset(trunk->context, 0, numlinks * sizeof(struct Q921_Link)); - - /* Common init part */ - for(x = 0; x <= numlinks; x++) { - link = Q921_LINK_CONTEXT(trunk, x); - - link->state = Q921_STATE_TEI_UNASSIGNED; - link->tei = 0; - - /* Initialize per-TEI I + UI queues */ - MFIFOCreate(link->UIFrameQueue, Q921MAXHDLCSPACE, 10); - MFIFOCreate(link->IFrameQueue, Q921MAXHDLCSPACE, 10); - MFIFOCreate(link->IFrameResendQueue, Q921MAXHDLCSPACE, 10); - } - - if(Q921_IS_PTMP_TE(trunk)) { - link->state = Q921_STATE_TEI_UNASSIGNED; - link->tei = 0; - } - else if(Q921_IS_PTMP_NT(trunk)) { - link = Q921_TRUNK_CONTEXT(trunk); - - link->state = Q921_STATE_TEI_ASSIGNED; - link->tei = trunk->tei; - - /* clear tei map */ - memset(trunk->tei_map, 0, Q921_TEI_MAX + 1); - } - else { - link->state = Q921_STATE_TEI_ASSIGNED; - link->tei = trunk->tei; - } - - Q921Log(trunk, Q921_LOG_DEBUG, "Starting trunk %p (sapi: %d, tei: %d, mode: %s %s)\n", - trunk, - trunk->sapi, - link->tei, - Q921_IS_PTMP(trunk) ? "PTMP" : "PTP", - Q921_IS_TE(trunk) ? "TE" : "NT"); - - if(Q921_IS_PTP(trunk)) { - Q921Log(trunk, Q921_LOG_DEBUG, "Sending SABME\n"); - - return Q921SendSABME(trunk, - trunk->sapi, - Q921_COMMAND(trunk), - link->tei, - 1); - - } else if(Q921_IS_PTMP_NT(trunk)) { - - Q921Log(trunk, Q921_LOG_DEBUG, "Revoking all TEIs\n"); - - return Q921TeiSendRemoveRequest(trunk, Q921_TEI_BCAST); /* Revoke all TEIs in use */ - } else { - - Q921Log(trunk, Q921_LOG_DEBUG, "Requesting TEI\n"); - - return Q921TeiSendAssignRequest(trunk); - } -} - - -/** - * Q921Stop - * \brief Stop trunk - * \param[in] trunk pointer to Q921 data struct - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -int Q921Stop(L2TRUNK trunk) -{ - struct Q921_Link *link; - int x, numlinks; - - if(!trunk) - return -1; - - link = Q921_TRUNK_CONTEXT(trunk); - numlinks = Q921_IS_PTMP_NT(trunk) ? Q921_TEI_MAX : 1; - - if(Q921_IS_STOPPED(link)) - return 0; - - /* Release TEI */ - if(Q921_IS_PTMP_TE(trunk)) { - /* send verify request */ - Q921TeiSendVerifyRequest(trunk); - - /* drop TEI */ - link->tei = 0; - } - - /* Stop timers, stop link, flush queues */ - for(x = 0; x <= numlinks; x++) { - Q921T200TimerStop(trunk, x); - Q921T203TimerStop(trunk, x); - Q921T201TimerStop(trunk, x); - - /* Change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_STOPPED, x); - - /* Flush per-tei I/UI queues */ - MFIFOClear(link->UIFrameQueue); - MFIFOClear(link->IFrameQueue); - MFIFOClear(link->IFrameResendQueue); - } - Q921T202TimerStop(trunk); - - /* Flush HDLC queue */ - MFIFOClear(trunk->HDLCInQueue); - - return 0; -} - - -/***************************************************************************** - - Function: Q921SendDM - - Description: Compose and Send DM (Disconnected Mode) - - Parameters: trunk trunk # - Sapi Sapi - cr C/R field. - Tei Tei. - pf F fiels octet 4 - - Return Value: 0 if failed, 1 if Send. - -*****************************************************************************/ -static int Q921SendDM(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf) -{ - L2UCHAR mes[25]; - - return Q921SendU(trunk, Sapi, cr, Tei, pf, 0x03, mes, trunk->Q921HeaderSpace+3); -} - -/***************************************************************************** - - Function: Q921SendDISC - - Description: Compose and Send Disconnect - - Parameters: trunk trunk # - Sapi Sapi - cr C/R field. - Tei Tei. - pf P fiels octet 4 - - Return Value: 0 if failed, 1 if Send. - -*****************************************************************************/ -static int Q921SendDISC(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf) -{ - L2UCHAR mes[25]; - - return Q921SendU(trunk, Sapi, cr, Tei, pf, 0x08, mes, trunk->Q921HeaderSpace+3); -} - -/***************************************************************************** - - Function: Q921SendUA - - Description: Compose and Send UA - - Parameters: trunk trunk # - Sapi Sapi - cr C/R field. - Tei Tei. - pf F fiels octet 4 - - Return Value: 0 if failed, 1 if Send. - -*****************************************************************************/ -static int Q921SendUA(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf) -{ - L2UCHAR mes[25]; - - return Q921SendU(trunk, Sapi, cr, Tei, pf, 0x0c, mes, trunk->Q921HeaderSpace+3); -} - -static int Q921SendUN(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf, L2UCHAR *mes, L2INT size) -{ - return Q921SendU(trunk, Sapi, cr, Tei, pf, 0x00, mes, size+trunk->Q921HeaderSpace+3); -} - - -/** - * Q921ProcSABME - * \brief Handle incoming SABME - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success, <= 0 on error - */ -static int Q921ProcSABME(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR pf = (mes[2] & 0x10) >> 4; /* poll / final flag */ - L2UCHAR tei = (mes[1] & 0xfe) >> 1; - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_TEI_ASSIGNED: - /* send UA */ - Q921SendUA(trunk, - trunk->sapi, - Q921_RESPONSE(trunk), /* or command? */ - tei, pf); - - /* clear counters */ - link->vr=0; - link->vs=0; - link->va=0; - - /* TODO: send DL-Establish indication to Q.931 */ - Q921Tx23Proc(trunk, Q921_DL_ESTABLISH, tei, NULL, 0); - - /* start T203 */ - Q921T203TimerStart(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, tei); - break; - - case Q921_STATE_AWAITING_ESTABLISHMENT: - /* send UA */ - Q921SendUA(trunk, - trunk->sapi, - Q921_RESPONSE(trunk), - tei, pf); - - /* no state change */ - break; - - case Q921_STATE_AWAITING_RELEASE: - /* send DM */ - Q921SendDM(trunk, - trunk->sapi, - Q921_RESPONSE(trunk), - tei, pf); - - /* no state change */ - break; - - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - case Q921_STATE_TIMER_RECOVERY: - /* send UA */ - Q921SendUA(trunk, - trunk->sapi, - Q921_RESPONSE(trunk), - tei, pf); - - /* clear exception conditions */ - Q921ResetExceptionConditions(trunk, tei); - - /* send MDL-Error indication */ - - /* V(S) == V(A) ? */ - if(link->vs != link->va) { - /* clear I queue */ - MFIFOClear(link->IFrameQueue); - - /* DL-Establish indication */ - Q921Tx23Proc(trunk, Q921_DL_ESTABLISH, tei, NULL, 0); - } - - /* clear counters */ - link->vr=0; - link->vs=0; - link->va=0; - - /* Stop T200, start T203 */ - Q921T200TimerStop(trunk, tei); - Q921T203TimerStart(trunk, tei); - - /* state change only if in TIMER_RECOVERY state */ - if(link->state == Q921_STATE_TIMER_RECOVERY) - Q921ChangeState(trunk, Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, tei); - break; - - default: - break; - } - - return 1; -} - - -/** - * Q921ProcDM - * \brief Handle incoming DM - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success, <= 0 on error - */ -static int Q921ProcDM(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR pf = (mes[2] & 0x10) >> 4; /* poll / final flag */ - L2UCHAR tei = (mes[1] & 0xfe) >> 1; - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_TEI_ASSIGNED: - if(!pf) { - /* to next state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - case Q921_STATE_AWAITING_ESTABLISHMENT: - case Q921_STATE_AWAITING_RELEASE: - if(pf) { - if(link->state == Q921_STATE_AWAITING_ESTABLISHMENT) { - /* Discard I queue */ - MFIFOClear(link->IFrameQueue); - } - - /* Send DL-Release indication to Q.931 */ - Q921Tx23Proc(trunk, Q921_DL_RELEASE, tei, NULL, 0); - - /* Stop T200 */ - Q921T200TimerStop(trunk, tei); - - /* Change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_TEI_ASSIGNED, tei); - } - break; - - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - if(pf) { - /* MDL-Error indication (B) */ - - /* no state change */ - } else { - /* MDL-Error indication (E) */ - - /* establish data link */ - Q921EstablishDataLink(trunk, tei); - - /* clear L3 initiated */ - Q921_CLEAR_FLAG(link, Q921_FLAG_L3_INITIATED); - - /* change state (no action?) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - case Q921_STATE_TIMER_RECOVERY: - if(pf) { - /* MDL Error indication (B) */ - } else { - /* MDL Error indication (E) */ - } - - /* establish data link */ - Q921EstablishDataLink(trunk, tei); - - /* clear layer 3 initiated */ - Q921_CLEAR_FLAG(link, Q921_FLAG_L3_INITIATED); - - /* change state */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - break; - - default: - break; - } - - return 1; -} - -/** - * Q921ProcUA - * \brief Handle incoming UA - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success, <= 0 on error - */ -static int Q921ProcUA(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR pf = (mes[2] & 0x10) >> 4; /* poll / final flag */ - L2UCHAR tei = (mes[1] & 0xfe) >> 1; - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_TEI_ASSIGNED: - case Q921_STATE_TIMER_RECOVERY: - /* MDL Error indication (C, D) */ - Q921Log(trunk, Q921_LOG_ERROR, "Received UA frame in invalid state\n"); - break; - - case Q921_STATE_AWAITING_ESTABLISHMENT: - if(pf) { - /* TODO: other fancy stuff (see docs) */ - if(Q921_CHECK_FLAG(link, Q921_FLAG_L3_INITIATED)) { /* layer3 initiated */ - link->vr = 0; - - /* DL-Establish confirm */ - Q921Tx23Proc(trunk, Q921_DL_ESTABLISH_CONFIRM, tei, NULL, 0); - - } else if(link->vs != link->va) { - - /* discard I queue */ - MFIFOClear(link->IFrameQueue); - - /* DL-Establish indication */ - Q921Tx23Proc(trunk, Q921_DL_ESTABLISH, tei, NULL, 0); - } - - /* Stop T200, start T203 */ - Q921T200TimerStop(trunk, tei); - Q921T203TimerStart(trunk, tei); - - link->vs = 0; - link->va = 0; - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, tei); - } else { - /* MDL Error indication (C, D) */ - Q921Log(trunk, Q921_LOG_ERROR, "Received UA frame is not a response to a request\n"); - - /* no state change */ - } - break; - - case Q921_STATE_AWAITING_RELEASE: - if(pf) { - /* DL Release confirm */ - Q921Tx23Proc(trunk, Q921_DL_RELEASE_CONFIRM, tei, NULL, 0); - - /* Stop T200 */ - Q921T200TimerStop(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_TEI_ASSIGNED, tei); - } else { - /* MDL Error indication (D) */ - Q921Log(trunk, Q921_LOG_ERROR, "Received UA frame is not a response to a request\n"); - - /* no state change */ - } - break; - - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - /* MDL Error indication (C, D) */ - Q921Log(trunk, Q921_LOG_ERROR, "Received UA frame in invalid state\n"); - - /* no state change */ - break; - - default: - break; - } - - return 1; -} - - -/** - * Q921ProcDISC - * \brief Handle incoming DISC - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success, <= 0 on error - */ -static int Q921ProcDISC(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR pf = (mes[2] & 0x10) >> 4; /* poll / final flag */ - L2UCHAR tei = (mes[1] & 0xfe) >> 1; - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_TEI_ASSIGNED: - case Q921_STATE_AWAITING_ESTABLISHMENT: - /* Send DM */ - Q921SendDM(trunk, - trunk->sapi, - Q921_RESPONSE(trunk), - tei, pf); - - /* no state change */ - break; - - case Q921_STATE_AWAITING_RELEASE: - Q921SendUA(trunk, - trunk->sapi, - Q921_RESPONSE(trunk), - tei, pf); - - /* no state change */ - break; - - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - case Q921_STATE_TIMER_RECOVERY: - /* Discard I queue */ - MFIFOClear(link->IFrameQueue); - - /* send UA */ - Q921SendUA(trunk, - trunk->sapi, - Q921_RESPONSE(trunk), - tei, pf); - - /* DL Release indication */ - Q921Tx23Proc(trunk, Q921_DL_RELEASE, tei, NULL, 0); - - /* Stop T200 */ - Q921T200TimerStop(trunk, tei); - - if(link->state == Q921_STATE_MULTIPLE_FRAME_ESTABLISHED) { - /* Stop T203 */ - Q921T203TimerStop(trunk, tei); - } - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_TEI_ASSIGNED, tei); - break; - - default: - Q921Log(trunk, Q921_LOG_ERROR, "Invalid DISC received in state \"%s\" (%d)", Q921State2Name(link->state), link->state); - break; - } - - return 1; -} - - -/** - * Q921ProcRR - * \brief Handle incoming RR - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success, <= 0 on error - */ -static int Q921ProcRR(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR cr = (mes[0] & 0x02) >> 1; - L2UCHAR pf = mes[3] & 0x01; /* poll / final flag */ - L2UCHAR nr = (mes[3] >> 1); -// L2UCHAR sapi = (mes[0] & 0xfc) >> 2; - L2UCHAR tei = (mes[1] & 0xfe) >> 1; - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - /* clear receiver peer busy */ - Q921_CLEAR_FLAG(link, Q921_FLAG_PEER_RECV_BUSY); - - if (Q921_IS_COMMAND(trunk, cr)) { /* if this is a command */ - if(pf) { - /* Enquiry response */ - Q921SendEnquiryResponse(trunk, tei); - } - } else { - if(pf) { - /* MDL Error indication */ - } - } - - /* */ - if(link->va <= nr && nr <= link->vs) { - - if(nr == link->vs) { - /* V(A) = N(R) */ - link->va = nr; - - /* Stop T200, restart T203 */ - Q921T200TimerStop(trunk, tei); - Q921T203TimerReset(trunk, tei); - - } else if(nr == link->va) { - - /* do nothing */ - - } else { - /* V(A) = N(R) */ - link->va = nr; - - /* Restart T200 */ - Q921T200TimerReset(trunk, tei); - } - /* no state change */ - - } else { - /* N(R) Error recovery */ - Q921NrErrorRecovery(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - case Q921_STATE_TIMER_RECOVERY: - /* clear receiver peer busy */ - Q921_CLEAR_FLAG(link, Q921_FLAG_PEER_RECV_BUSY); - - /* command + P? */ - if(Q921_IS_COMMAND(trunk, cr) && pf) { - /* Enquiry response */ - Q921SendEnquiryResponse(trunk, tei); - } - - /* */ - if(link->va <= nr && nr <= link->vs) { - /* V(A) = N(R) */ - link->va = nr; - - if(!Q921_IS_COMMAND(trunk, cr) && pf) { - /* Stop T200, start T203 */ - Q921T200TimerStop(trunk, tei); - Q921T203TimerStart(trunk, tei); - - /* Invoke retransmission */ - Q921InvokeRetransmission(trunk, tei, nr); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, tei); - } - /* no state change otherwise */ - } else { - /* N(R) Error recovery */ - Q921NrErrorRecovery(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - default: - break; - } - return 1; -} - - -/** - * Q921ProcREJ - * \brief Handle incoming REJ - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success, <= 0 on error - */ -static int Q921ProcREJ(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR cr = (mes[0] & 0x02) >> 1; - L2UCHAR pf = mes[3] & 0x01; /* poll / final flag */ - L2UCHAR nr = (mes[3] >> 1); -// L2UCHAR sapi = (mes[0] & 0xfc) >> 2; - L2UCHAR tei = (mes[1] & 0xfe) >> 1; - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - /* clear receiver peer busy */ - Q921_CLEAR_FLAG(link, Q921_FLAG_PEER_RECV_BUSY); - - /* command? */ - if(Q921_IS_COMMAND(trunk, cr)) { - if(pf) { - /* Enquiry response */ - Q921SendEnquiryResponse(trunk, tei); - } - } else { - if(pf) { - /* MDL Error indication (A) */ - } - } - - /* */ - if(link->va <= nr && nr <= link->vs) { - - /* V(A) = N(R) */ - link->va = nr; - - /* Stop T200, start T203 */ - Q921T200TimerStop(trunk, tei); - Q921T203TimerStart(trunk, tei); - - /* Invoke retransmission of frame >N(R) (?) */ - Q921InvokeRetransmission(trunk, tei, nr); - - /* no state change */ - } else { - /* N(R) Error recovery */ - Q921NrErrorRecovery(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - case Q921_STATE_TIMER_RECOVERY: - /* clear receiver peer busy */ - Q921_CLEAR_FLAG(link, Q921_FLAG_PEER_RECV_BUSY); - - /* command + P ? */ - if(Q921_IS_COMMAND(trunk, cr) && pf) { - /* Enquiry response */ - Q921SendEnquiryResponse(trunk, tei); - } - - /* */ - if(link->va <= nr && nr <= link->vs) { - - /* V(A) = N(R) */ - link->va = nr; - - if(!Q921_IS_COMMAND(trunk, cr) && pf) { - /* Stop T200, start T203 */ - Q921T200TimerStop(trunk, tei); - Q921T203TimerStart(trunk, tei); - - /* Invoke retransmission */ - Q921InvokeRetransmission(trunk, tei, nr); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, tei); - } - /* no state change otherwise */ - } else { - /* N(R) Error recovery */ - Q921NrErrorRecovery(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - default: - break; - } - - return 1; -} - - -/** - * Q921ProcRNR - * \brief Handle incoming RNR - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success, <= 0 on error - */ -static int Q921ProcRNR(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR cr = (mes[0] & 0x02) >> 1; - L2UCHAR pf = mes[3] & 0x01; /* poll / final flag */ - L2UCHAR nr = (mes[3] >> 1); -// L2UCHAR sapi = (mes[0] & 0xfc) >> 2; - L2UCHAR tei = (mes[1] & 0xfe) >> 1; - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - /* set peer receiver busy */ - Q921_SET_FLAG(link, Q921_FLAG_PEER_RECV_BUSY); - - /* command? */ - if(Q921_IS_COMMAND(trunk, cr)) { - if(pf) { - /* Enquiry response */ - Q921SendEnquiryResponse(trunk, tei); - } - } else { - if(pf) { - /* MDL Error indication (A) */ - } - } - - /* */ - if(link->va <= nr && nr <= link->vs) { - - /* V(A) = N(R) */ - link->va = nr; - - /* Stop T203, restart T200 */ - Q921T200TimerReset(trunk, tei); - Q921T203TimerStop(trunk, tei); - - /* no state change */ - } else { - /* N(R) Error recovery */ - Q921NrErrorRecovery(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - case Q921_STATE_TIMER_RECOVERY: - /* set peer receiver busy */ - Q921_SET_FLAG(link, Q921_FLAG_PEER_RECV_BUSY); - - /* command + P? */ - if(Q921_IS_COMMAND(trunk, cr) && pf) { - /* Enquiry response */ - Q921SendEnquiryResponse(trunk, tei); - } - - /* */ - if(link->va <= nr && nr <= link->vs) { - - /* V(A) = N(R) */ - link->va = nr; - - if(!Q921_IS_COMMAND(trunk, cr) && pf) { - /* Restart T200 */ - Q921T200TimerReset(trunk, tei); - - /* Invoke retransmission */ - Q921InvokeRetransmission(trunk, tei, nr); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, tei); - } - /* no state change otherwise */ - } else { - /* N(R) Error recovery */ - Q921NrErrorRecovery(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - default: - break; - } - - return 1; -} - -#if 0 -static int Q921SetReceiverBusy(L2TRUNK trunk) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - if(!Q921_CHECK_FLAG(link, Q921_FLAG_RECV_BUSY)) { - /* set own receiver busy */ - Q921_SET_FLAG(link, Q921_FLAG_RECV_BUSY); - - /* send RR response */ - Q921SendRR(trunk, trunk->sapi, Q921_RESPONSE(trunk), link->tei, 0); - - /* clear ack pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - } - break; - - case Q921_STATE_TIMER_RECOVERY: - if(!Q921_CHECK_FLAG(link, Q921_FLAG_RECV_BUSY)) { - /* set own receiver busy */ - Q921_SET_FLAG(link, Q921_FLAG_RECV_BUSY); - - /* send RNR response */ - Q921SendRNR(trunk, trunk->sapi, Q921_RESPONSE(trunk), link->tei, 0); - - /* clear ack pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - } - break; - - default: - break; - } - - return 0; -} - -static int Q921ClearReceiverBusy(L2TRUNK trunk) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - case Q921_STATE_TIMER_RECOVERY: - if(Q921_CHECK_FLAG(link, Q921_FLAG_RECV_BUSY)) { - /* clear own receiver busy */ - Q921_CLEAR_FLAG(link, Q921_FLAG_RECV_BUSY); - - /* send RNR response */ - Q921SendRNR(trunk, trunk->sapi, Q921_RESPONSE(trunk), link->tei, 0); - - /* clear ack pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - } - break; - - default: - break; - } - - return 0; -} -#endif - -static int Q921ProcIFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - /* common fields: get sapi, tei and cr */ -// L2UCHAR sapi = (mes[0] & 0xfc) >> 2; -// L2UCHAR cr = (mes[0] & 0x02) >> 1; - L2UCHAR tei = (mes[1] & 0xfe) >> 1; - L2UCHAR pf = mes[3] & 0x01; /* poll / final flag */ - L2UCHAR nr = mes[3] >> 1; /* receive sequence number */ - L2UCHAR ns = mes[2] >> 1; /* send sequence number */ - L2UCHAR discard = 0; - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - /* Ignore I frames in earlier states */ - if(link->state < Q921_STATE_MULTIPLE_FRAME_ESTABLISHED) { - Q921Log(trunk, Q921_LOG_NOTICE, "I frame in invalid state ignored\n"); - return 0; - } - - /* Receiver busy? */ - if(Q921_CHECK_FLAG(link, Q921_FLAG_RECV_BUSY)) { - /* discard information */ - discard = 1; - - if(pf) { - /* send RNR Response */ - Q921SendRNR(trunk, trunk->sapi, Q921_RESPONSE(trunk), tei, 1); - - /* Clear ack pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - } - } - else { - if(ns != link->vr) { - /* discard information */ - discard = 1; - - if(Q921_CHECK_FLAG(link, Q921_FLAG_REJECT) && pf) { - - /* Send RR response */ - Q921SendRR(trunk, trunk->sapi, Q921_RESPONSE(trunk), tei, 1); - - /* clear ack pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - } - else if(!Q921_CHECK_FLAG(link, Q921_FLAG_REJECT)){ - - /* set reject exception */ - Q921_SET_FLAG(link, Q921_FLAG_REJECT); - - /* Send REJ response */ - Q921SendREJ(trunk, trunk->sapi, Q921_RESPONSE(trunk), tei, pf); - - /* clear ack pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - } - } - else { - /* V(R) = V(R) + 1 */ - Q921_INC_COUNTER(link->vr); - - /* clear reject exception */ - Q921_CLEAR_FLAG(link, Q921_FLAG_REJECT); - - /* DL-Data indication */ - Q921Tx23Proc(trunk, Q921_DL_DATA, tei, mes, size); - - if(pf) { - /* Send RR response */ - Q921SendRR(trunk, trunk->sapi, Q921_RESPONSE(trunk), tei, 1); - - /* clear ack pending */ - Q921_CLEAR_FLAG(link, Q921_FLAG_ACK_PENDING); - } - else if(!Q921_CHECK_FLAG(link, Q921_FLAG_ACK_PENDING)) { - /* ack pending */ - - /* Send RR response */ - Q921SendRR(trunk, trunk->sapi, Q921_RESPONSE(trunk), tei, 0); - - /* set ack pending*/ - Q921_SET_FLAG(link, Q921_FLAG_ACK_PENDING); - } - } - } - - - switch(link->state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - if(link->va <= nr && nr <= link->vs) { - if(Q921_CHECK_FLAG(link, Q921_FLAG_PEER_RECV_BUSY)) { - link->va = nr; - } - else if(nr == link->vs) { - /* V(A) = N(R) */ - link->va = nr; - - /* stop t200, restart t203 */ - Q921T200TimerStop(trunk, tei); - Q921T203TimerReset(trunk, tei); - } - else if(nr != link->va) { - /* V(A) = N(R) */ - link->va = nr; - - /* restart T200 */ - Q921T200TimerReset(trunk, tei); - } - - /* Restart TM01 */ - if(Q921_IS_NT(trunk)) { - Q921TM01TimerReset(trunk, tei); - } - } - else { - /* N(R) error recovery */ - Q921NrErrorRecovery(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - case Q921_STATE_TIMER_RECOVERY: - if(link->va <= nr && nr <= link->vs) { - /* V(A) = N(R) */ - link->va = nr; - - /* Restart TM01 */ - if(Q921_IS_NT(trunk)) { - Q921TM01TimerReset(trunk, tei); - } - } - else { - /* N(R) error recovery */ - Q921NrErrorRecovery(trunk, tei); - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_AWAITING_ESTABLISHMENT, tei); - } - break; - - default: - break; - } - - return 0; -} - - -static int Q921ProcSFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR sv = (mes[2] & 0x0c) >> 2; /* supervisory format id */ - //L2UCHAR pf = mes[3] & 0x01; /* poll / final flag */ - //L2UCHAR nr = mes[3] >> 1; /* receive sequence number */ - L2INT res = -1; - - switch(sv) { - case 0x00: /* RR : Receive Ready */ - res = Q921ProcRR(trunk, mes, size); - break; - - case 0x02: /* RNR : Receive Not Ready */ - res = Q921ProcRNR(trunk, mes, size); - break; - - case 0x04: /* REJ : Reject */ - res = Q921ProcREJ(trunk, mes, size); - break; - - default: /* Invalid / Unknown */ - Q921Log(trunk, Q921_LOG_ERROR, "Invalid S frame type %d\n", sv); - break; - } - - return res; -} - - - -static int Q921ProcUFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR m = (mes[2] & 0xe0) >> 3 | (mes[2] & 0x0c) >> 2; /* modifier function id */ -// L2UCHAR pf = (mes[2] & 0x10) >> 4; /* poll / final flag */ - L2INT res = -1; - - switch(m) { - case 0x00: /* UN : Unnumbered Information */ - if(mes[3] == Q921_LAYER_ENT_ID_TEI) - { - if(!Q921_IS_PTMP(trunk)) { - /* wtf? nice try */ - return res; - } - - switch(mes[6]) { - case Q921_TEI_ID_REQUEST: /* (TE ->) NT */ - res = Q921TeiProcAssignRequest(trunk, mes, size); - break; - - case Q921_TEI_ID_ASSIGNED: /* (NT ->) TE */ - case Q921_TEI_ID_DENIED: - res = Q921TeiProcAssignResponse(trunk, mes, size); - break; - - case Q921_TEI_ID_CHECKREQ: /* (NT ->) TE */ - res = Q921TeiProcCheckRequest(trunk, mes, size); - break; - - case Q921_TEI_ID_CHECKRESP: /* (TE ->) NT */ - res = Q921TeiProcCheckResponse(trunk, mes, size); - break; - - case Q921_TEI_ID_REMOVE: /* (NT ->) TE */ - res = Q921TeiProcRemoveRequest(trunk, mes, size); - break; - - case Q921_TEI_ID_VERIFY: /* (TE ->) NT */ - res = Q921TeiProcVerifyRequest(trunk, mes, size); - break; - - default: /* Invalid / Unknown */ - Q921Log(trunk, Q921_LOG_ERROR, "Invalid UN message from TEI management/endpoint\n"); - break; - } - } - else if(mes[3] == Q921_LAYER_ENT_ID_Q931) { - - Q921Log(trunk, Q921_LOG_DEBUG, "UI Frame for Layer 3 received\n"); - - res = Q921Tx23Proc(trunk, Q921_DL_UNIT_DATA, 0, mes, size); - } - break; - - case 0x03: /* DM : Disconnect Mode */ - res = Q921ProcDM(trunk, mes, size); - break; - - case 0x08: /* DISC : Disconnect */ - res = Q921ProcDISC(trunk, mes, size); - break; - - case 0x0c: /* UA : Unnumbered Acknowledgement */ - res = Q921ProcUA(trunk, mes, size); - break; - - case 0x0f: /* SABME : Set Asynchronous Balanced Mode Extend */ - res = Q921ProcSABME(trunk, mes, size); - break; - - case 0x11: /* FRMR : Frame Reject */ - case 0x17: /* XID : Exchange Identification */ - res = 0; - break; - - default: /* Unknown / Invalid */ - Q921Log(trunk, Q921_LOG_ERROR, "Invalid U frame type: %d\n", m); - break; - } - - return res; -} - - -/***************************************************************************** - - Function: Q921Rx12 - - Description: Called to process a message frame from layer 1. Will - identify the message and call the proper 'processor' for - layer 2 messages and forward I frames to the layer 3 entity. - - Q921Rx12 will check the input fifo for a message, and if a - message exist process one message before it exits. The caller - must either call Q921Rx12 polling or keep track on # - messages in the queue. - - Parameters: trunk trunk #. - - Return Value: # messages processed (always 1 or 0). - -*****************************************************************************/ -int Q921Rx12(L2TRUNK trunk) -{ - L2INT size; /* receive size & Q921 frame size*/ - L2UCHAR *smes = MFIFOGetMesPtr(trunk->HDLCInQueue, &size); - - if(smes) - { - struct Q921_Link *link; - L2UCHAR sapi, tei; - L2UCHAR *mes; - L2INT rs; - - rs = size - trunk->Q921HeaderSpace; - mes = &smes[trunk->Q921HeaderSpace]; - - Q921LogMesg(trunk, Q921_LOG_DEBUG, 1, mes, rs, "New packet received (%d bytes)", rs); - - /* common fields: get sapi, tei and cr */ - sapi = (mes[0] & 0xfc) >> 2; - tei = (mes[1] & 0xfe) >> 1; - link = Q921_LINK_CONTEXT(trunk, tei); - - if(Q921_IS_PTMP_TE(trunk) && ( - (link->state >= Q921_STATE_TEI_ASSIGNED && tei != link->tei && tei != Q921_TEI_BCAST) || /* Assigned TEI: Only BCAST and directed */ - (link->state == Q921_STATE_TEI_UNASSIGNED && tei != Q921_TEI_BCAST))) /* No assigned TEI: Only BCAST */ - { - /* Ignore Messages with foreign TEIs */ - goto out; - } - - if((mes[2] & 0x01) == 0x00) { /* I frame */ - Q921ProcIFrame(trunk, mes, rs); - } - else if((mes[2] & 0x03) == 0x01) { /* S frame */ - Q921ProcSFrame(trunk, mes, rs); - } - else if((mes[2] & 0x03) == 0x03) { /* U frame */ - Q921ProcUFrame(trunk, mes, rs); - } - else { - Q921Log(trunk, Q921_LOG_ERROR, "Invalid frame type: %d\n", (int)(mes[2] & 0x03)); - /* TODO: send FRMR or REJ */ - } - -out: - MFIFOKillNext(trunk->HDLCInQueue); - - return 1; - } - - return 0; -} - -/* - * Misc - */ -/** - * Q921SetLogCB - * \brief Set logging callback - * \param[in] trunk pointer to Q921 data struct - * \param[in] func pointer to logging callback function - * \param[in] priv pointer to private data - * - * \author Stefan Knoblich - */ -void Q921SetLogCB(L2TRUNK trunk, Q921LogCB_t func, void *priv) -{ - if(!trunk) - return; - - trunk->Q921LogProc = func; - trunk->PrivateDataLog = priv; -} - -/** - * Q921SetLogLevel - * \brief Set loglevel of Q.921 logging functions - * \param[in] trunk pointer to Q921 data struct - * \param[in] level new loglevel - * - * \author Stefan Knoblich - */ -void Q921SetLogLevel(L2TRUNK trunk, Q921LogLevel_t level) -{ - if(!trunk) - return; - - if (level < Q921_LOG_NONE) { - level = Q921_LOG_NONE; - } else if (level > Q921_LOG_DEBUG) { - level = Q921_LOG_DEBUG; - } - - trunk->loglevel = level; -} - - -/** - * Q921ChangeState - * \brief Change state, invoke neccessary actions - * \param[in] trunk pointer to Q921 data struct - * \param[in] state state to change to - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921ChangeState(L2TRUNK trunk, Q921State_t state, L2UCHAR tei) -{ - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - Q921State_t oldstate = link->state; - int res = 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "Changing state from \"%s\" (%d) to \"%s\" (%d) for TEI %d\n", - Q921State2Name(oldstate), oldstate, - Q921State2Name(state), state, - tei); - - /* - * generic actions (depending on the target state only) - */ - switch(state) { - case Q921_STATE_MULTIPLE_FRAME_ESTABLISHED: - /* Start TM01 */ - if(Q921_IS_NT(trunk)) { - Q921TM01TimerStart(trunk, tei); - } - break; - - default: - break; - } - - /* - * actions that depend on type of the old -> new state transition - */ - switch(oldstate) { - case Q921_STATE_STOPPED: - - switch(state) { - case Q921_STATE_TEI_UNASSIGNED: - if(Q921_IS_PTMP_TE(trunk)) { - res = Q921TeiSendAssignRequest(trunk); - } - break; - - case Q921_STATE_TEI_ASSIGNED: - if(Q921_IS_PTMP_NT(trunk)) { - res = Q921TeiSendRemoveRequest(trunk, Q921_TEI_BCAST); - } - break; - - default: - break; - } - break; - - default: - break; - } - - link->state = state; - - Q921Log(trunk, Q921_LOG_DEBUG, "Q921ChangeState() returns %d, new state is \"%s\" (%d) for TEI %d\n", res, Q921State2Name(state), state, tei); - - return res; -} - -/* - * TEI Management functions - * \note All TEI-mgmt UN frames are sent with cr = command! - */ -static int Q921TeiSend(L2TRUNK trunk, L2UCHAR type, L2USHORT ri, L2UCHAR ai) -{ - L2UCHAR mes[10]; - L2UCHAR offset = Q921_UFRAME_DATA_OFFSET(trunk); - - mes[offset++] = Q921_LAYER_ENT_ID_TEI; /* layer management entity identifier */ - mes[offset++] = (ri & 0xff00) >> 8; /* reference number upper part */ - mes[offset++] = ri & 0xff; /* reference number lower part */ - mes[offset++] = type; /* message type: Identity Request */ - mes[offset++] = ai << 1 | 0x01; /* action indicator: TEI */ - - return Q921SendU(trunk, Q921_SAPI_TEI, Q921_COMMAND(trunk), Q921_TEI_BCAST, 0, 0x00, mes, offset); -} - - -/** - * Q921TeiSendAssignRequest - * \brief Ask for new TEI (TE mode only) - * \param[in] trunk pointer to Q921 data struct - * \return > 0 on success, <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiSendAssignRequest(L2TRUNK trunk) -{ - struct Q921_Link *link = Q921_TRUNK_CONTEXT(trunk); - L2INT res; - - if (!Q921_IS_PTMP_TE(trunk)) /* only ptmp te mode*/ - return 0; - -#ifndef WIN32 - link->ri = (L2USHORT)(random() % 0xffff); -#else - link->ri = (L2USHORT)(rand() % 0xffff); //todo -#endif - - /* send TEI assign request */ - res = Q921TeiSend(trunk, Q921_TEI_ID_REQUEST, link->ri, Q921_TEI_BCAST); - - /* start T202 */ - Q921T202TimerStart(trunk); - - return res; -} - - -/** - * Q921TeiProcessAssignResponse - * \brief Process assign response (TE mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiProcAssignResponse(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - struct Q921_Link *link = Q921_TRUNK_CONTEXT(trunk); - L2UCHAR offset = Q921_UFRAME_DATA_OFFSET(trunk); - L2USHORT ri = 0; - - if (!Q921_IS_PTMP_TE(trunk)) /* PTMP TE only */ - return 0; - - ri = (mes[offset + 1] << 8) | mes[offset + 2]; - - if(ri != link->ri) { - /* hmmm ..., not our response i guess */ - return 0; - } - - switch(mes[offset + 3]) { - case Q921_TEI_ID_ASSIGNED: - /* Yay, use the new TEI and change state to assigned */ - link->tei = mes[offset + 4] >> 1; - - Q921Log(trunk, Q921_LOG_DEBUG, "Assigned TEI %d, setting state to TEI_ASSIGNED\n", link->tei); - - Q921ChangeState(trunk, Q921_STATE_TEI_ASSIGNED, link->tei); - break; - - case Q921_TEI_ID_DENIED: - /* oops, what to do now? */ - if ((mes[offset + 4] >> 1) == Q921_TEI_BCAST) { - /* No more free TEIs? this is bad */ - - //Q921TeiSendVerifyRequest(trunk, Q921_TEI_BCAST); /* TODO: does this work ?? */ - } else { - /* other reason, this is fatal, shutdown link */ - } - - Q921Log(trunk, Q921_LOG_DEBUG, "TEI assignment has been denied, reason: %s\n", - ((mes[offset +4] >> 1) == Q921_TEI_BCAST) ? "No free TEIs available" : "Unknown"); - - Q921ChangeState(trunk, Q921_STATE_TEI_UNASSIGNED, link->tei); - break; - - default: - return 0; - } - - /* stop T202 */ - Q921T202TimerStop(trunk); - - return 1; -} - - -/** - * Q921TeiSendVerifyRequest - * \brief Verify TEI (TE mode only) - * \param[in] trunk pointer to Q921 data struct - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiSendVerifyRequest(L2TRUNK trunk) -{ - struct Q921_Link *link = Q921_TRUNK_CONTEXT(trunk); - L2INT res; - - if (!Q921_IS_PTMP_TE(trunk)) /* only ptmp te mode*/ - return 0; - - /* Request running? */ - if (trunk->T202) - return 0; - - /* Send TEI verify request */ - res = Q921TeiSend(trunk, Q921_TEI_ID_VERIFY, link->ri, link->tei); - - /* start T202 */ - Q921T202TimerStart(trunk); - - return res; -} - - -/** - * Q921TeiProcCheckRequest - * \brief Process Check Request (TE mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiProcCheckRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - struct Q921_Link *link = Q921_TRUNK_CONTEXT(trunk); - L2UCHAR offset = Q921_UFRAME_DATA_OFFSET(trunk); - L2UCHAR tei = (mes[offset + 4] >> 1); /* action indicator => tei */ - L2INT res = 0; - - if (!Q921_IS_PTMP_TE(trunk)) /* ptmp te mode only */ - return 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "Received TEI Check request for TEI %d\n", tei); - - if (tei == Q921_TEI_BCAST || tei == link->tei) { - /* - * Broadcast TEI check or for our assigned TEI - */ - - /* send TEI check reponse */ - res = Q921TeiSend(trunk, Q921_TEI_ID_CHECKRESP, link->ri, link->tei); - - Q921T202TimerStop(trunk); - } - - return res; -} - - -/** - * Q921TeiProcRemoveRequest - * \brief Process remove Request (TE mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiProcRemoveRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - struct Q921_Link *link = Q921_TRUNK_CONTEXT(trunk); - L2UCHAR offset = Q921_UFRAME_DATA_OFFSET(trunk); - L2UCHAR tei = (mes[offset + 4] >> 1); /* action indicator => tei */ - L2INT res = 0; - - if (!Q921_IS_PTMP_TE(trunk)) /* ptmp te mode only */ - return 0; - - Q921Log(trunk, Q921_LOG_DEBUG, "Received TEI Remove request for TEI %d\n", tei); - - if (tei == Q921_TEI_BCAST || tei == link->tei) { - /* - * Broadcast TEI remove or for our assigned TEI - */ - - /* reset tei */ - link->tei = 0; - - /* change state (no action) */ - Q921ChangeState(trunk, Q921_STATE_TEI_UNASSIGNED, link->tei); - - /* TODO: hmm, request new one ? */ - res = Q921TeiSendAssignRequest(trunk); - } - return res; -} - - -/** - * Q921TeiProcAssignRequest - * \brief Process assign request from peer (NT mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiProcAssignRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR offset = Q921_UFRAME_DATA_OFFSET(trunk); - L2USHORT ri = 0; - L2UCHAR tei = 0; - - if (!Q921_IS_PTMP_NT(trunk)) /* PTMP NT only */ - return 0; - - ri = (mes[offset + 1] << 8) | mes[offset + 2]; - tei = mes[offset + 4] >> 1; - - if(tei == Q921_TEI_BCAST) { - int x; - - /* dynamically allocate TEI */ - for(x = Q921_TEI_DYN_MIN, tei = 0; x <= Q921_TEI_MAX; x++) { - if(!trunk->tei_map[x]) { - tei = x; - break; - } - } - } - else if(!(tei > 0 && tei < Q921_TEI_DYN_MIN)) { - /* reject TEIs that are not in the static area */ - Q921TeiSendDenyResponse(trunk, 0, ri); - - return 0; - } - - if(!tei) { - /* no free TEI found */ - Q921TeiSendDenyResponse(trunk, Q921_TEI_BCAST, ri); - } - else { - struct Q921_Link *link = Q921_LINK_CONTEXT(trunk, tei); - - /* mark used */ - trunk->tei_map[tei] = 1; - - /* assign tei */ - link->tei = tei; - - /* put context in TEI ASSIGNED state */ - Q921ChangeState(trunk, Q921_STATE_TEI_ASSIGNED, tei); - - /* send assign response */ - Q921TeiSendAssignedResponse(trunk, tei, ri); - - /* Start T201 */ - Q921T201TimerStart(trunk, tei); - } - return 0; -} - -/** - * Q921TeiSendCheckRequest - * \brief Send check request (NT mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] tei TEI to check - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiSendCheckRequest(L2TRUNK trunk, L2UCHAR tei) -{ - L2INT res = 0; - - if (!Q921_IS_PTMP_NT(trunk)) /* PTMP NT only */ - return 0; - - /* send TEI check request */ - res = Q921TeiSend(trunk, Q921_TEI_ID_CHECKREQ, 0, tei); - - /* (Re-)Start T201 timer */ - Q921T201TimerStart(trunk, tei); - - return res; -} - -/** - * Q921TeiProcCheckResponse - * \brief Process Check Response (NT mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiProcCheckResponse(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - struct Q921_Link *link; - L2UCHAR offset = Q921_UFRAME_DATA_OFFSET(trunk); - L2USHORT ri = 0; - L2UCHAR tei = 0; - - if (!Q921_IS_PTMP_NT(trunk)) /* PTMP NT mode only */ - return 0; - - ri = (mes[offset + 1] << 8) | mes[offset + 2]; - tei = mes[offset + 4] >> 1; - - /* restart T201 */ - Q921T201TimerStop(trunk, tei); - - /* reset counter */ - link = Q921_LINK_CONTEXT(trunk, tei); - link->N202 = 0; - - if(!(tei > 0 && tei < Q921_TEI_MAX) || !trunk->tei_map[tei]) { - /* TODO: Should we send a DISC first? */ - - /* TEI not assigned? Invalid TEI? */ - Q921TeiSendRemoveRequest(trunk, tei); - - /* change state */ - Q921ChangeState(trunk, Q921_STATE_STOPPED, tei); - - /* clear */ - memset(link, 0, sizeof(struct Q921_Link)); - } else { - /* Start T201 */ - Q921T201TimerStart(trunk, tei); - } - - return 0; -} - - -/** - * Q921TeiProcVerifyRequest - * \brief Process Verify Request (NT mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] mes pointer to message buffer - * \param[in] size size of message - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiProcVerifyRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size) -{ - L2UCHAR resp[25]; - L2UCHAR offset = Q921_UFRAME_DATA_OFFSET(trunk); - L2UCHAR tei = 0; - - if (!Q921_IS_PTMP_NT(trunk)) /* PTMP NT mode only */ - return 0; - - tei = mes[offset + 4] >> 1; - - /* todo: handle response... verify assigned TEI */ - resp[offset + 0] = 0; - - return 0; -} - -/** - * Q921TeiSendDenyResponse - * \brief Send Deny Response (NT mode only) - * \param[in] trunk pointer to Q921 data struct - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiSendDenyResponse(L2TRUNK trunk, L2UCHAR tei, L2USHORT ri) -{ - if (!Q921_IS_PTMP_NT(trunk)) /* PTMP NT only */ - return 0; - - return Q921TeiSend(trunk, Q921_TEI_ID_DENIED, ri, tei); -} - - -/** - * Q921TeiSendAssignedResponse - * \brief Send Assigned Response (NT mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] tei TEI to assign - * \param[in] ri RI of request - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiSendAssignedResponse(L2TRUNK trunk, L2UCHAR tei, L2USHORT ri) -{ - if (!Q921_IS_PTMP_NT(trunk)) /* PTMP NT only */ - return 0; - - return Q921TeiSend(trunk, Q921_TEI_ID_ASSIGNED, ri, tei); -} - -/** - * Q921TeiSendRemoveRequest - * \brief Send Remove Request (NT mode only) - * \param[in] trunk pointer to Q921 data struct - * \param[in] tei TEI to remove - * \return > 0 on success; <= 0 on error - * - * \author Stefan Knoblich - */ -static int Q921TeiSendRemoveRequest(L2TRUNK trunk, L2UCHAR tei) -{ - if (!Q921_IS_PTMP_NT(trunk)) /* PTMP NT only */ - return 0; - - return Q921TeiSend(trunk, Q921_TEI_ID_REMOVE, 0, tei); -} diff --git a/libs/freetdm/src/isdn/Q931.c b/libs/freetdm/src/isdn/Q931.c deleted file mode 100644 index b245c144d8..0000000000 --- a/libs/freetdm/src/isdn/Q931.c +++ /dev/null @@ -1,888 +0,0 @@ -/***************************************************************************** - - FileName: Q931.c - - Contents: Implementation of Q.931 stack main interface functions. - See q931.h for description. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "Q921.h" -#include "Q931.h" -#include "national.h" -#include "DMS.h" -#include "5ESS.h" - - -/***************************************************************************** - - Dialect function pointers tables. - - The following function pointer arrays define pack/unpack functions and - processing furnctions for the different Q.931 based dialects. - - The arrays are initialized with pointers to dummy functions and later - overrided with pointers to actual functions as new dialects are added. - - The initial Q.931 will as an example define 2 dialects as it treats User - and Network mode as separate ISDN dialects. - - The API messages Q931AddProc, Q931AddMes, Q931AddIE are used to initialize - these table entries during system inititialization of a stack. - -*****************************************************************************/ -q931proc_func_t *Q931Proc[Q931MAXDLCT][Q931MAXMES]; - -q931umes_func_t *Q931Umes[Q931MAXDLCT][Q931MAXMES]; -q931pmes_func_t *Q931Pmes[Q931MAXDLCT][Q931MAXMES]; - -q931uie_func_t *Q931Uie[Q931MAXDLCT][Q931MAXIE]; -q931pie_func_t *Q931Pie[Q931MAXDLCT][Q931MAXIE]; - -q931timeout_func_t *Q931Timeout[Q931MAXDLCT][Q931MAXTIMER]; -q931timer_t Q931Timer[Q931MAXDLCT][Q931MAXTIMER]; - -void (*Q931CreateDialectCB[Q931MAXDLCT])(L3UCHAR iDialect) = { NULL, NULL }; - -Q931State Q931st[Q931MAXSTATE]; - -/***************************************************************************** - - Core system tables and variables. - -*****************************************************************************/ - -L3INT Q931L4HeaderSpace = {0}; /* header space to be ignoder/inserted */ - /* at head of each message. */ - -L3INT Q931L2HeaderSpace = {4}; /* Q921 header space, sapi, tei etc */ - -/***************************************************************************** - - Main interface callback functions. - -*****************************************************************************/ - -Q931ErrorCB_t Q931ErrorProc; /* callback for error messages. */ -L3ULONG (*Q931GetTimeProc) (void) = NULL; /* callback for func reading time in ms */ - -/***************************************************************************** - - Function: Q931SetL4HeaderSpace - - Description: Set the # of bytes to be inserted/ignored at the head of - each message. Q931 will issue a message with space for header - and the user will use this to fill in whatever header info - is required to support the architecture used. - -*****************************************************************************/ -void Q931SetL4HeaderSpace(L3INT space) -{ - Q931L4HeaderSpace = space; -} - -/***************************************************************************** - - Function: Q931SetL2HeaderSpace - - Description: Set the # of bytes to be inserted/ignored at the head of - each message. Q931 will issue a message with space for header - and the user will use this to fill in whatever header info - is required to support the architecture used. - -*****************************************************************************/ -void Q931SetL2HeaderSpace(L3INT space) -{ - Q931L2HeaderSpace = space; -} - -/***************************************************************************** - - Function: Q931ProcDummy - - Description: Dummy function for message processing. - -*****************************************************************************/ -L3INT Q931ProcDummy(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b,L3INT c) -{ - return Q931E_INTERNAL; -} - -/***************************************************************************** - - Function: Q931UmesDummy - - Description: Dummy function for message processing - -*****************************************************************************/ -L3INT Q931UmesDummy(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size) -{ - return Q931E_UNKNOWN_MESSAGE; -} - -/***************************************************************************** - - Function: Q931UieDummy - - Description: Dummy function for message processing - -*****************************************************************************/ -L3INT Q931UieDummy(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - return Q931E_UNKNOWN_IE; -} - -/***************************************************************************** - - Function: Q931PmesDummy - - Description: Dummy function for message processing - -*****************************************************************************/ -L3INT Q931PmesDummy(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - return Q931E_UNKNOWN_MESSAGE; -} - -/***************************************************************************** - - Function: Q931PieDummy - - Description: Dummy function for message processing - -*****************************************************************************/ -L3INT Q931PieDummy(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - return Q931E_UNKNOWN_IE; -} - -/***************************************************************************** - - Function: Q931TxDummy - - Description: Dummy function for message processing - -*****************************************************************************/ -L3INT Q931TxDummy(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT n) -{ - return Q931E_MISSING_CB; -} - -/***************************************************************************** - - Function: Q931ErrorDummy - - Description: Dummy function for error processing - -*****************************************************************************/ -L3INT Q931ErrorDummy(void *priv, L3INT a, L3INT b, L3INT c) -{ - return 0; -} - -/***************************************************************************** - - Function: Q931Initialize - - Description: This function Initialize the stack. - - Will set up the trunk array, channel - arrays and initialize Q931 function arrays before it finally - set up EuroISDN processing with User as dialect 0 and - Network as dialect 1. - - Note: Initialization of other stacks should be inserted after - the initialization of EuroISDN. - -*****************************************************************************/ -void Q931Initialize() -{ - L3INT x,y; - - /* Secure the callbacks to default procs */ - Q931ErrorProc = Q931ErrorDummy; - - /* The user will only add the message handlers and IE handlers he need, - * so we need to initialize every single entry to a default function - * that will throw an appropriate error if they are ever called. - */ - for (x = 0; x < Q931MAXDLCT; x++) { - for (y = 0; y < Q931MAXMES; y++) { - Q931Proc[x][y] = Q931ProcDummy; - Q931Umes[x][y] = Q931UmesDummy; - Q931Pmes[x][y] = Q931PmesDummy; - } - for (y = 0; y < Q931MAXIE; y++) { - Q931Pie[x][y] = Q931PieDummy; - Q931Uie[x][y] = Q931UieDummy; - } - for (y = 0; y < Q931MAXTIMER; y++) { - Q931Timeout[x][y] = Q931TimeoutDummy; - Q931Timer[x][y] = 0; - } - } - - if (Q931CreateDialectCB[Q931_Dialect_Q931 + Q931_TE] == NULL) - Q931AddDialect(Q931_Dialect_Q931 + Q931_TE, Q931CreateTE); - - if (Q931CreateDialectCB[Q931_Dialect_Q931 + Q931_NT] == NULL) - Q931AddDialect(Q931_Dialect_Q931 + Q931_NT, Q931CreateNT); - - if (Q931CreateDialectCB[Q931_Dialect_National + Q931_TE] == NULL) - Q931AddDialect(Q931_Dialect_National + Q931_TE, nationalCreateTE); - - if (Q931CreateDialectCB[Q931_Dialect_National + Q931_NT] == NULL) - Q931AddDialect(Q931_Dialect_National + Q931_NT, nationalCreateNT); - - if (Q931CreateDialectCB[Q931_Dialect_DMS + Q931_TE] == NULL) - Q931AddDialect(Q931_Dialect_DMS + Q931_TE, DMSCreateTE); - - if (Q931CreateDialectCB[Q931_Dialect_DMS + Q931_NT] == NULL) - Q931AddDialect(Q931_Dialect_DMS + Q931_NT, DMSCreateNT); - - if (Q931CreateDialectCB[Q931_Dialect_5ESS + Q931_TE] == NULL) - Q931AddDialect(Q931_Dialect_5ESS + Q931_TE, ATT5ESSCreateTE); - - if (Q931CreateDialectCB[Q931_Dialect_5ESS + Q931_NT] == NULL) - Q931AddDialect(Q931_Dialect_5ESS + Q931_NT, ATT5ESSCreateNT); - - /* The last step we do is to call the callbacks to create the dialects */ - for (x = 0; x < Q931MAXDLCT; x++) { - if (Q931CreateDialectCB[x] != NULL) { - Q931CreateDialectCB[x]((L3UCHAR)x); - } - } -} - -/** - * Q931TimerTick - * \brief Periodically called to update and check for expired timers - * \param pTrunk Q.931 trunk - */ -void Q931TimerTick(Q931_TrunkInfo_t *pTrunk) -{ - struct Q931_Call *call = NULL; - L3ULONG now = 0; - L3INT x; - - /* TODO: Loop through all active calls, check timers and call timout procs - * if timers are expired. - * Implement a function array so each dialect can deal with their own - * timeouts. - */ - now = Q931GetTime(); - - for (x = 0; x < Q931MAXCALLPERTRUNK; x++) { - call = &pTrunk->call[x]; - - if (!call->InUse || !call->Timer || !call->TimerID) - continue; - - if (call->Timer <= now) { - /* Stop Timer */ - Q931StopTimer(pTrunk, x, call->TimerID); - - /* Invoke dialect timeout callback */ - Q931Timeout[pTrunk->Dialect][call->TimerID](pTrunk, x); - } - } -} - -/***************************************************************************** - - Function: Q931Rx23 - - Description: Receive message from layer 2 (LAPD). Receiving a message - is always done in 2 steps. First the message must be - interpreted and translated to a static struct. Secondly - the message is processed and responded to. - - The Q.931 message contains a static header that is - interpreted in this function. The rest is interpreted - in a sub function according to mestype. - - Parameters: pTrunk [IN] Ptr to trunk info. - buf [IN] Ptr to buffer containing message. - Size [IN] Size of message. - - Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning - see q931errors.h for details. - -*****************************************************************************/ -L3INT Q931Rx23(Q931_TrunkInfo_t *pTrunk, L3INT ind, L3UCHAR tei, L3UCHAR * buf, L3INT Size) -{ - L3UCHAR *Mes = NULL; - L3INT RetCode = Q931E_NO_ERROR; - Q931mes_Generic *m = (Q931mes_Generic *) pTrunk->L3Buf; - L3INT ISize; - L3INT IOff = 0; - L3INT L2HSize = Q931L2HeaderSpace; - - switch (ind) { - case Q921_DL_UNIT_DATA: /* DL-UNITDATA indication (UI frame, 3 byte header) */ - L2HSize = 3; - - case Q921_DL_DATA: /* DL-DATA indication (I frame, 4 byte header) */ - /* Reset our decode buffer */ - memset(pTrunk->L3Buf, 0, sizeof(pTrunk->L3Buf)); - - /* L2 Header Offset */ - Mes = &buf[L2HSize]; - - /* Protocol Discriminator */ - m->ProtDisc = Mes[IOff++]; - - /* CRV */ - m->CRVFlag = (Mes[IOff + 1] >> 7) & 0x01; - m->CRV = Q931Uie_CRV(pTrunk, Mes, m->buf, &IOff, &ISize); - - /* Message Type */ - m->MesType = Mes[IOff++]; - - /* Store tei */ - m->Tei = tei; - - /* d'oh a little ugly but this saves us from: - * a) doing Q.921 work in the lower levels (extracting the TEI ourselves) - * b) adding a tei parameter to _all_ Proc functions - */ - if (tei) { - L3INT callIndex = 0; - - /* Find the call using CRV */ - RetCode = Q931FindCRV(pTrunk, m->CRV, &callIndex); - if (RetCode == Q931E_NO_ERROR && !pTrunk->call[callIndex].Tei) { - pTrunk->call[callIndex].Tei = tei; - } - } - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Received message from Q.921 (ind %d, tei %d, size %d)\nMesType: %d, CRVFlag %d (%s), CRV %d (Dialect: %d)\n", ind, m->Tei, Size, - m->MesType, m->CRVFlag, m->CRVFlag ? "Terminator" : "Originator", m->CRV, pTrunk->Dialect); - - RetCode = Q931Umes[pTrunk->Dialect][m->MesType](pTrunk, Mes, (Q931mes_Generic *)pTrunk->L3Buf, IOff, Size - L2HSize); - if (RetCode >= Q931E_NO_ERROR) { - RetCode = Q931Proc[pTrunk->Dialect][m->MesType](pTrunk, pTrunk->L3Buf, 2); - } - break; - - default: - break; - } - - return RetCode; -} - -/***************************************************************************** - - Function: Q931Tx34 - - Description: Called from the stack to send a message to layer 4. - - Parameters: Mes[IN] Ptr to message buffer. - Size[IN] Message size in bytes. - - Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning - see q931errors.h for details. - -*****************************************************************************/ -L3INT Q931Tx34(Q931_TrunkInfo_t *pTrunk, L3UCHAR * Mes, L3INT Size) -{ - Q931Log(pTrunk, Q931_LOG_DEBUG, "Sending message to Layer4 (size: %d)\n", Size); - - if (pTrunk->Q931Tx34CBProc) { - return pTrunk->Q931Tx34CBProc(pTrunk->PrivateData34, Mes, Size); - } - return Q931E_MISSING_CB; -} - -/***************************************************************************** - - Function: Q931Rx43 - - Description: Receive message from Layer 4 (application). - - Parameters: pTrunk[IN] Trunk #. - buf[IN] Message Pointer. - Size[IN] Message size in bytes. - - Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning - see q931errors.h for details. - -*****************************************************************************/ -L3INT Q931Rx43(Q931_TrunkInfo_t *pTrunk,L3UCHAR * buf, L3INT Size) -{ - Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace]; - L3INT RetCode = Q931E_NO_ERROR; - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Receiving message from Layer4 (size: %d, type: %d)\n", Size, ptr->MesType); - - RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4); - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Q931Rx43 return code: %d\n", RetCode); - - return RetCode; -} - -/***************************************************************************** - - Function: Q931Tx32 - - Description: Called from the stack to send a message to L2. The input is - always a non-packed message so it will first make a proper - call to create a packed message before it transmits that - message to layer 2. - - Parameters: pTrunk[IN] Trunk # - buf[IN] Ptr to message buffer. - Size[IN] Message size in bytes. - - Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning - see q931errors.h for details. - -*****************************************************************************/ -L3INT Q931Tx32Data(Q931_TrunkInfo_t *pTrunk, L3UCHAR bcast, L3UCHAR * Mes, L3INT Size) -{ - Q931mes_Generic *ptr = (Q931mes_Generic*)Mes; - L3INT RetCode = Q931E_NO_ERROR; - L3INT iDialect = pTrunk->Dialect; - L3INT Offset = bcast ? (Q931L2HeaderSpace - 1) : Q931L2HeaderSpace; - L3INT OSize; - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Sending message to Q.921 (size: %d)\n", Size); - - memset(pTrunk->L2Buf, 0, sizeof(pTrunk->L2Buf)); - - /* Call pack function through table. */ - RetCode = Q931Pmes[iDialect][ptr->MesType](pTrunk, (Q931mes_Generic *)Mes, Size, &pTrunk->L2Buf[Offset], &OSize); - if (RetCode >= Q931E_NO_ERROR) { - L3INT callIndex; - L3UCHAR tei = 0; - - if (ptr->CRV) { - /* Find the call using CRV */ - RetCode = Q931FindCRV(pTrunk, ptr->CRV, &callIndex); - if (RetCode != Q931E_NO_ERROR) - return RetCode; - - tei = pTrunk->call[callIndex].Tei; - } - - if (pTrunk->Q931Tx32CBProc) { - RetCode = pTrunk->Q931Tx32CBProc(pTrunk->PrivateData32, bcast ? Q921_DL_UNIT_DATA : Q921_DL_DATA, tei, pTrunk->L2Buf, OSize + Offset); - } else { - RetCode = Q931E_MISSING_CB; - } - } - - return RetCode; -} - - -/***************************************************************************** - - Function: Q931SetError - - Description: Called from the stack to indicate an error. - - Parameters: ErrID ID of ie or message causing error. - ErrPar1 Error parameter 1 - ErrPar2 Error parameter 2. - - -*****************************************************************************/ -void Q931SetError(Q931_TrunkInfo_t *pTrunk,L3INT ErrID, L3INT ErrPar1, L3INT ErrPar2) -{ - if (pTrunk->Q931ErrorCBProc) { - pTrunk->Q931ErrorCBProc(pTrunk->PrivateData34, ErrID, ErrPar1, ErrPar2); - } else { - Q931ErrorProc(pTrunk->PrivateData34, ErrID, ErrPar1, ErrPar2); - } -} - -void Q931SetDefaultErrorCB(Q931ErrorCB_t Q931ErrorPar) -{ - Q931ErrorProc = Q931ErrorPar; -} - -/***************************************************************************** - - Function: Q931CreateCRV - - Description: Create a CRV entry and return it's index. The function will - locate a free entry in the call tables allocate it and - allocate a unique CRV value attached to it. - - Parameters: pTrunk [IN] Trunk number - callindex [OUT] return call table index. - - Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning - see q931errors.h for details. -****************************************************************************/ -L3INT Q931CreateCRV(Q931_TrunkInfo_t *pTrunk, L3INT * callIndex) -{ - L3INT CRV = Q931GetUniqueCRV(pTrunk); - - return Q931AllocateCRV(pTrunk, CRV, callIndex); -} - - -L3INT Q931ReleaseCRV(Q931_TrunkInfo_t *pTrunk, L3INT CRV) -{ - int callIndex; - - if ((Q931FindCRV(pTrunk, CRV, &callIndex)) == Q931E_NO_ERROR) { - pTrunk->call[callIndex].InUse = 0; - return Q931E_NO_ERROR; - } - - return Q931E_INVALID_CRV; -} - -/***************************************************************************** - - Function: Q931AllocateCRV - - Description: Allocate a call table entry and assigns the given CRV value - to it. - - Parameters: pTrunk [IN] Trunk number - iCRV [IN] Call Reference Value. - callindex [OUT] return call table index. - - Return Value: Error Code. 0 = No Error, < 0 :error, > 0 : Warning - see q931errors.h for details. - -*****************************************************************************/ -L3INT Q931AllocateCRV(Q931_TrunkInfo_t *pTrunk, L3INT iCRV, L3INT * callIndex) -{ - L3INT x; - for (x = 0; x < Q931MAXCALLPERTRUNK; x++) { - if (!pTrunk->call[x].InUse) { - pTrunk->call[x].CRV = iCRV; - pTrunk->call[x].BChan = 255; - pTrunk->call[x].State = 0; /* null state - idle */ - pTrunk->call[x].TimerID = 0; /* no timer running */ - pTrunk->call[x].Timer = 0; - pTrunk->call[x].InUse = 1; /* mark as used */ - *callIndex = x; - return Q931E_NO_ERROR; - } - } - return Q931E_TOMANYCALLS; -} - -/***************************************************************************** - - Function: Q931GetCallState - - Description: Look up CRV and return current call state. A non existing - CRV is the same as state zero (0). - - Parameters: pTrunk [IN] Trunk number. - iCRV [IN] CRV - - Return Value: Call State. - -*****************************************************************************/ -L3INT Q931GetCallState(Q931_TrunkInfo_t *pTrunk, L3INT iCRV) -{ - L3INT x; - for (x = 0; x < Q931MAXCALLPERTRUNK; x++) { - if (pTrunk->call[x].InUse) { - if (pTrunk->call[x].CRV == iCRV) { - return pTrunk->call[x].State; - } - } - } - return 0; /* assume state zero for non existing CRV's */ -} - -/** - * Q931StartTimer - * \brief Start a timer - * \param pTrunk Q.931 trunk - * \param callindex Index of the call - * \param iTimerID ID of timer - * \return always 0 - */ -L3INT Q931StartTimer(Q931_TrunkInfo_t *pTrunk, L3INT callIndex, L3USHORT iTimerID) -{ -#if 0 - L3ULONG duration = Q931Timer[pTrunk->Dialect][iTimerID]; - - if (duration) { - pTrunk->call[callIndex].Timer = Q931GetTime() + duration; - pTrunk->call[callIndex].TimerID = iTimerID; - } -#endif - return 0; -} - -/** - * Q931StopTimer - * \brief Stop a timer - * \param pTrunk Q.931 trunk - * \param callindex Index of the call - * \param iTimerID ID of timer - * \return always 0 - */ -L3INT Q931StopTimer(Q931_TrunkInfo_t *pTrunk, L3INT callindex, L3USHORT iTimerID) -{ - if (pTrunk->call[callindex].TimerID == iTimerID) - pTrunk->call[callindex].TimerID = 0; - - return 0; -} - -L3INT Q931SetState(Q931_TrunkInfo_t *pTrunk, L3INT callIndex, L3INT iState) -{ - pTrunk->call[callIndex].State = iState; - - return 0; -} - -L3ULONG Q931GetTime() -{ - L3ULONG tNow = 0; - static L3ULONG tLast = 0; - - if (Q931GetTimeProc != NULL) { - tNow = Q931GetTimeProc(); - if (tNow < tLast) { /* wrapped */ - /* TODO */ - } - tLast = tNow; - } - return tNow; -} - -void Q931SetGetTimeCB(L3ULONG (*callback)(void)) -{ - Q931GetTimeProc = callback; -} - -L3INT Q931FindCRV(Q931_TrunkInfo_t *pTrunk, L3INT crv, L3INT *callindex) -{ - L3INT x; - for (x = 0; x < Q931MAXCALLPERTRUNK; x++) { - if (pTrunk->call[x].InUse) { - if (pTrunk->call[x].CRV == crv) { - *callindex = x; - return Q931E_NO_ERROR; - } - } - } - return Q931E_INVALID_CRV; -} - - -void Q931AddDialect(L3UCHAR i, void (*callback)(L3UCHAR iD )) -{ - if (i < Q931MAXDLCT) { - Q931CreateDialectCB[i] = callback; - } -} - -/***************************************************************************** - Function: Q931AddStateEntry - - Description: Find an empty entry in the dialects state table and add this - entry. -*****************************************************************************/ -void Q931AddStateEntry(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir) -{ - int x; - for (x = 0; x < Q931MAXSTATE; x++) { - if (Q931st[x].Message == 0) { - Q931st[x].State = iState; - Q931st[x].Message = iMes; - Q931st[x].Direction = cDir; - /* TODO Sort table and use bsearch */ - return; - } - } -} - -/***************************************************************************** - Function: Q931IsEventLegal - - Description: Check state table for matching criteria to indicate if this - Message is legal in this state or not. - - Note: Someone write a bsearch or invent something smart here - please - sequential is ok for now. -*****************************************************************************/ -L3BOOL Q931IsEventLegal(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir) -{ - int x; - /* TODO Sort table and use bsearch */ - for (x = 0; x < Q931MAXSTATE; x++) { - if (Q931st[x].State == iState && Q931st[x].Message == iMes && - Q931st[x].Direction == cDir) { - return L3TRUE; - } - } - return L3FALSE; -} - -/***************************************************************************** - Function: q931_error_to_name() - - Description: Check state table for matching criteria to indicate if this - Message is legal in this state or not. - - Note: Someone write a bsearch or invent something smart here - please - sequential is ok for now. -*****************************************************************************/ -static const char *q931_error_names[] = { - "Q931E_NO_ERROR", /* 0 */ - - "Q931E_UNKNOWN_MESSAGE", /* -3001 */ - "Q931E_ILLEGAL_IE", /* -3002 */ - "Q931E_UNKNOWN_IE", /* -3003 */ - "Q931E_BEARERCAP", /* -3004 */ - "Q931E_HLCOMP", /* -3005 */ - "Q931E_LLCOMP", /* -3006 */ - "Q931E_INTERNAL", /* -3007 */ - "Q931E_MISSING_CB", /* -3008 */ - "Q931E_UNEXPECTED_MESSAGE", /* -3009 */ - "Q931E_ILLEGAL_MESSAGE", /* -3010 */ - "Q931E_TOMANYCALLS", /* -3011 */ - "Q931E_INVALID_CRV", /* -3012 */ - "Q931E_CALLID", /* -3013 */ - "Q931E_CALLSTATE", /* -3014 */ - "Q931E_CALLEDSUB", /* -3015 */ - "Q931E_CALLEDNUM", /* -3016 */ - "Q931E_CALLINGNUM", /* -3017 */ - "Q931E_CALLINGSUB", /* -3018 */ - "Q931E_CAUSE", /* -3019 */ - "Q931E_CHANID", /* -3020 */ - "Q931E_DATETIME", /* -3021 */ - "Q931E_DISPLAY", /* -3022 */ - "Q931E_KEYPADFAC", /* -3023 */ - "Q931E_NETFAC", /* -3024 */ - "Q931E_NOTIFIND", /* -3025 */ - "Q931E_PROGIND", /* -3026 */ - "Q931E_RESTARTIND", /* -3027 */ - "Q931E_SEGMENT", /* -3028 */ - "Q931E_SIGNAL", /* -3029 */ - "Q931E_GENERIC_DIGITS" /* -3030 */ - -}; - -#define Q931_MAX_ERROR 30 - -const char *q931_error_to_name(q931_error_t error) -{ - int index = 0; - if ((int)error < 0) { - index = (((int)error * -1) -3000); - } - if (index < 0 || index > Q931_MAX_ERROR) { - return ""; - } - return q931_error_names[index]; -} -/* - * Logging - */ -#include - -L3INT Q931Log(Q931_TrunkInfo_t *trunk, Q931LogLevel_t level, const char *fmt, ...) -{ - char buf[Q931_LOGBUFSIZE]; - L3INT len; - va_list ap; - - if (!trunk->Q931LogCBProc) - return 0; - - if (trunk->loglevel < level) - return 0; - - va_start(ap, fmt); - - len = vsnprintf(buf, sizeof(buf)-1, fmt, ap); - if (len <= 0) { - /* TODO: error handling */ - return -1; - } - if (len >= sizeof(buf)) - len = sizeof(buf) - 1; - - buf[len] = '\0'; - - va_end(ap); - - return trunk->Q931LogCBProc(trunk->PrivateDataLog, level, buf, len); -} - -/** - * Q921SetLogCB - * \brief Set Logging callback function and private data - */ -void Q931SetLogCB(Q931_TrunkInfo_t *trunk, Q931LogCB_t func, void *priv) -{ - trunk->Q931LogCBProc = func; - trunk->PrivateDataLog = priv; -} - -/** - * Q921SetLogLevel - * \brief Set Loglevel - */ -void Q931SetLogLevel(Q931_TrunkInfo_t *trunk, Q931LogLevel_t level) -{ - if(!trunk) - return; - - if (level < Q931_LOG_NONE) { - level = Q931_LOG_NONE; - } else if (level > Q931_LOG_DEBUG) { - level = Q931_LOG_DEBUG; - } - - trunk->loglevel = level; -} - -/** - * Q931TimeoutDummy - * \brief Dummy handler for timeouts - * \param pTrunk Q.931 trunk - * \param callIndex Index of call - */ -L3INT Q931TimeoutDummy(Q931_TrunkInfo_t *pTrunk, L3INT callIndex) -{ - Q931Log(pTrunk, Q931_LOG_DEBUG, "Timer %d of call %d (CRV: %d) timed out\n", pTrunk->call[callIndex].TimerID, callIndex, pTrunk->call[callIndex].CRV); - - return 0; -} diff --git a/libs/freetdm/src/isdn/Q931StateNT.c b/libs/freetdm/src/isdn/Q931StateNT.c deleted file mode 100644 index 8d05fb6d03..0000000000 --- a/libs/freetdm/src/isdn/Q931StateNT.c +++ /dev/null @@ -1,1218 +0,0 @@ -/***************************************************************************** - - FileName: q931StateNT.c - - Contents: Q.931 State Engine for NT (Network Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "Q931.h" - -extern L3INT Q931L4HeaderSpace; - -/***************************************************************************** - Function: Q931CreateNT - - Description: Will create the Q931 NT as a Dialect in the stack. The first - bulk set up the message handlers, the second bulk the IE - encoders/coders, and the last bulk set up the state table. - - Parameters: i Dialect index -*****************************************************************************/ -void Q931CreateNT(L3UCHAR i) -{ - Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingNT, Q931Umes_Alerting, Q931Pmes_Alerting); - Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingNT, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); - Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectNT, Q931Umes_Connect, Q931Pmes_Connect); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckNT, Q931Umes_ConnectAck, Q931Pmes_ConnectAck); - Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressNT, Q931Umes_Progress, Q931Pmes_Progress); - Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupNT, Q931Umes_Setup, Q931Pmes_Setup); - Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckNT, Q931Umes_SetupAck, Q931Pmes_SetupAck); - Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeNT, Q931Umes_Resume, Q931Pmes_Resume); - Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckNT, Q931Umes_ResumeAck, Q931Pmes_ResumeAck); - Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectNT, Q931Umes_ResumeReject, Q931Pmes_ResumeReject); - Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendNT, Q931Umes_Suspend, Q931Pmes_Suspend); - Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckNT, Q931Umes_SuspendAck, Q931Pmes_SuspendAck); - Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectNT, Q931Umes_SuspendReject, Q931Pmes_SuspendReject); - Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationNT, Q931Umes_UserInformation, Q931Pmes_UserInformation); - Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectNT, Q931Umes_Disconnect, Q931Pmes_Disconnect); - Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseNT, Q931Umes_Release, Q931Pmes_Release); - Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteNT, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete); - Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartNT, Q931Umes_Restart, Q931Pmes_Restart); - Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckNT, Q931Umes_RestartAck, Q931Pmes_RestartAck); - Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl); - Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationNT, Q931Umes_Information, Q931Pmes_Information); - Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyNT, Q931Umes_Notify, Q931Pmes_Notify); - Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusNT, Q931Umes_Status, Q931Pmes_Status); - Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryNT, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry); - Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentNT, Q931Umes_Segment, Q931Pmes_Segment); - - Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityNT, Q932Umes_Facility, Q932Pmes_Facility); - Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldNT, Q932Umes_Hold, Q932Pmes_Hold); - Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckNT, Q932Umes_HoldAck, Q932Pmes_HoldAck); - Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectNT, Q932Umes_HoldReject, Q932Pmes_HoldReject); - Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterNT, Q932Umes_Register, Q932Pmes_Register); - Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveNT, Q932Umes_Retrieve, Q932Pmes_Retrieve); - Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck); - Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectNT, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject); - - /* Set up the IE encoder/decoder handle table.*/ - Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment); - Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap); - Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause); - Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID); - Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState); - Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID); - Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd); - Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac); - Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd); - Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display); - Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime); - Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac); - Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal); - Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum); - Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub); - Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum); - Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub); - Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd); - Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp); - Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp); - Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser); - - Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_REDIRECTING_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - - /* The following define a state machine. The point is that the Message - * procs can when search this to find out if the message/state - * combination is legale. If not, the proc for unexpected message apply. - */ - - /* TODO define state table here */ - - /* Timer default values */ - Q931SetTimerDefault(i, Q931_TIMER_T301, 180000); /* T301: 180s */ - Q931SetTimerDefault(i, Q931_TIMER_T302, 15000); /* T302: 15s */ - Q931SetTimerDefault(i, Q931_TIMER_T303, 4000); /* T303: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T304, 20000); /* T304: 20s */ - Q931SetTimerDefault(i, Q931_TIMER_T305, 30000); /* T305: 30s */ - Q931SetTimerDefault(i, Q931_TIMER_T306, 30000); /* T306: 30s */ - Q931SetTimerDefault(i, Q931_TIMER_T307, 180000); /* T307: 180s */ - Q931SetTimerDefault(i, Q931_TIMER_T308, 4000); /* T308: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T309, 60000); /* T309: 60s */ - Q931SetTimerDefault(i, Q931_TIMER_T310, 10000); /* T310: 10s */ - Q931SetTimerDefault(i, Q931_TIMER_T312, 12000); /* T312: 12s */ - Q931SetTimerDefault(i, Q931_TIMER_T314, 4000); /* T314: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T316, 120000); /* T316: 120s */ - Q931SetTimerDefault(i, Q931_TIMER_T317, 90000); /* T317: 90s */ - Q931SetTimerDefault(i, Q931_TIMER_T320, 30000); /* T320: 30s */ - Q931SetTimerDefault(i, Q931_TIMER_T321, 30000); /* T321: 30s */ - Q931SetTimerDefault(i, Q931_TIMER_T322, 4000); /* T322: 4s */ -} - -/***************************************************************************** - - Function: Q931ProcAlertingNT - -*****************************************************************************/ -L3INT Q931ProcAlertingNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* Reset 4 sec timer. */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcCallProceedingNT - -*****************************************************************************/ -L3INT Q931ProcCallProceedingNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcConnectNT - -*****************************************************************************/ -L3INT Q931ProcConnectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcConnectAckNT - -*****************************************************************************/ -L3INT Q931ProcConnectAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcProgressNT - -*****************************************************************************/ -L3INT Q931ProcProgressNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSetupNT - - Description: Process a SETUP message. - - *****************************************************************************/ -L3INT Q931ProcSetupNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)&buf[Q931L4HeaderSpace]; - L3INT rc = 0; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Reject SETUP on existing calls */ - if (Q931GetCallState(pTrunk, pMes->CRV) != Q931_U0) { - Q931Disconnect(pTrunk, iFrom, pMes->CRV, 81); - return Q931E_UNEXPECTED_MESSAGE; - } - - /* outgoing call */ - if (iFrom == 4) { - ret = Q931CreateCRV(pTrunk, &callIndex); - if (ret) - return ret; - - pMes->CRV = pTrunk->call[callIndex].CRV; - - /* - * Outgoing SETUP message will be broadcasted in PTMP mode - */ - ret = Q931Tx32Data(pTrunk, Q931_IS_PTP(pTrunk) ? 0 : 1, buf, pMes->Size); - if (ret) - return ret; - - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - Q931SetState(pTrunk, callIndex, Q931_U1); - } - /* incoming call */ - else { - /* Locate free CRV entry and store info */ - ret = Q931AllocateCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) { - /* Not possible to allocate CRV entry, so must reject call */ - Q931Disconnect(pTrunk, iFrom, pMes->CRV, 42); - return ret; - } - - /* store TEI in call */ - pTrunk->call[callIndex].Tei = pMes->Tei; - - /* Send setup indication to user */ - ret = Q931Tx34(pTrunk, (L3UCHAR*)pMes, pMes->Size); - if (ret != Q931E_NO_ERROR) { - return ret; - } else { - /* Must be full queue, meaning we can't process the call */ - /* so we must disconnect */ - Q931Disconnect(pTrunk, iFrom, pMes->CRV, 81); - return ret; - } -#if 0 - /* TODO: Unreachable code??? */ - /* Set state U6 */ - Q931SetState(pTrunk, callIndex, Q931_U6); - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); -#endif - } - - return rc; -} - -/***************************************************************************** - - Function: Q931ProcSetupAckNT - - Description: Used to acknowedge a SETUP. Usually the first initial - response recevide back used to buy some time. - - Note that ChanID (B Channel Assignment) might come here from - NT side. - -*****************************************************************************/ -L3INT Q931ProcSetupAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcResumeNT - -*****************************************************************************/ -L3INT Q931ProcResumeNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcResumeAckNT - -*****************************************************************************/ -L3INT Q931ProcResumeAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcResumeRejectNT - -*****************************************************************************/ -L3INT Q931ProcResumeRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSuspendNT - -*****************************************************************************/ -L3INT Q931ProcSuspendNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSuspendAckNT - -*****************************************************************************/ -L3INT Q931ProcSuspendAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSuspendRejectNT - -*****************************************************************************/ -L3INT Q931ProcSuspendRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcInformationNT - -*****************************************************************************/ -L3INT Q931ProcUserInformationNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcDisconnectNT - -*****************************************************************************/ -L3INT Q931ProcDisconnectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcReleaseNT - -*****************************************************************************/ -L3INT Q931ProcReleaseNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcReleaseCompleteNT - -*****************************************************************************/ -L3INT Q931ProcReleaseCompleteNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcRestartNT - -*****************************************************************************/ -L3INT Q931ProcRestartNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcRestartAckNT - -*****************************************************************************/ -L3INT Q931ProcRestartAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcCongestionControlNT - -*****************************************************************************/ -L3INT Q931ProcCongestionControlNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcInformationNT - -*****************************************************************************/ -L3INT Q931ProcInformationNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcNotifyNT - -*****************************************************************************/ -L3INT Q931ProcNotifyNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcStatusNT - -*****************************************************************************/ -L3INT Q931ProcStatusNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcStatusEnquiryNT - -*****************************************************************************/ -L3INT Q931ProcStatusEnquiryNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSegmentNT - -*****************************************************************************/ -L3INT Q931ProcSegmentNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/****************************************************************************/ -/******************* Q.932 - Supplementary Services *************************/ -/****************************************************************************/ - -/***************************************************************************** - - Function: Q932ProcFacilityNT - -*****************************************************************************/ -L3INT Q932ProcFacilityNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcHoldNT - -*****************************************************************************/ -L3INT Q932ProcHoldNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcHoldAckNT - -*****************************************************************************/ -L3INT Q932ProcHoldAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcHoldRejectNT - -*****************************************************************************/ -L3INT Q932ProcHoldRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcRegisterTE - -*****************************************************************************/ -L3INT Q932ProcRegisterNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcRetrieveNT - -*****************************************************************************/ -L3INT Q932ProcRetrieveNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcRetrieveAckNT - -*****************************************************************************/ -L3INT Q932ProcRetrieveAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcRetrieveRejectNT - -*****************************************************************************/ -L3INT Q932ProcRetrieveRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here*/ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} diff --git a/libs/freetdm/src/isdn/Q931StateTE.c b/libs/freetdm/src/isdn/Q931StateTE.c deleted file mode 100644 index 562dd0b458..0000000000 --- a/libs/freetdm/src/isdn/Q931StateTE.c +++ /dev/null @@ -1,1310 +0,0 @@ -/***************************************************************************** - - FileName: q931StateTE.c - - Contents: Q.931 State Engine for TE (User Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - This reference implementation uses a process per message, - meaning that each message must check call states. This - is easier for dialect maintenance as each message proc - can be replaced individually. A new TE variant only - need to copy the Q931CreateTE and replace those procs or - need to override. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "Q931.h" - -extern L3INT Q931L4HeaderSpace; - -/***************************************************************************** - Function: Q931CreateTE - - Description: Will create the Q931 TE as a Dialect in the stack. The first - bulk set up the message handlers, the second bulk the IE - encoders/coders, and the last bulk set up the state table. - - Parameters: i Dialect index -*****************************************************************************/ -void Q931CreateTE(L3UCHAR i) -{ - Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting); - Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); - Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectTE, Q931Umes_Connect, Q931Pmes_Connect); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckTE, Q931Umes_ConnectAck, Q931Pmes_ConnectAck); - Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress); - Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupTE, Q931Umes_Setup, Q931Pmes_Setup); - Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck); - Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeTE, Q931Umes_Resume, Q931Pmes_Resume); - Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckTE, Q931Umes_ResumeAck, Q931Pmes_ResumeAck); - Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectTE, Q931Umes_ResumeReject, Q931Pmes_ResumeReject); - Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendTE, Q931Umes_Suspend, Q931Pmes_Suspend); - Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckTE, Q931Umes_SuspendAck, Q931Pmes_SuspendAck); - Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectTE, Q931Umes_SuspendReject, Q931Pmes_SuspendReject); - Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationTE, Q931Umes_UserInformation, Q931Pmes_UserInformation); - Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectTE, Q931Umes_Disconnect, Q931Pmes_Disconnect); - Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseTE, Q931Umes_Release, Q931Pmes_Release); - Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteTE, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete); - Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartTE, Q931Umes_Restart, Q931Pmes_Restart); - Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckTE, Q931Umes_RestartAck, Q931Pmes_RestartAck); - Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlTE, Q931Umes_CongestionControl, Q931Pmes_CongestionControl); - Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationTE, Q931Umes_Information, Q931Pmes_Information); - Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyTE, Q931Umes_Notify, Q931Pmes_Notify); - Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusTE, Q931Umes_Status, Q931Pmes_Status); - Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryTE, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry); - Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentTE, Q931Umes_Segment, Q931Pmes_Segment); - - Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityTE, Q932Umes_Facility, Q932Pmes_Facility); - Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldTE, Q932Umes_Hold, Q932Pmes_Hold); - Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckTE, Q932Umes_HoldAck, Q932Pmes_HoldAck); - Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectTE, Q932Umes_HoldReject, Q932Pmes_HoldReject); - Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterTE, Q932Umes_Register, Q932Pmes_Register); - Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveTE, Q932Umes_Retrieve, Q932Pmes_Retrieve); - Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckTE, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck); - Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectTE, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject); - - /* Set up the IE encoder/decoder handle table.*/ - Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment); - Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap); - Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause); - Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID); - Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState); - Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID); - Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd); - Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac); - Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd); - Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display); - Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime); - Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac); - Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal); - Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum); - Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub); - Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum); - Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub); - Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd); - Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp); - Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp); - Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser); - - Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_REDIRECTING_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - - /* The following define a state machine. The point is that the Message - * procs can when search this to find out if the message/state - * combination is legale. If not, the proc for unexpected message apply. - */ - - /* State 0 Idle */ - Q931AddStateEntry(i, Q931_U0, Q931mes_RESUME, 2); - Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 2); - Q931AddStateEntry(i, Q931_U0, Q931mes_STATUS, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE_COMPLETE, 4); - - /* State 1 Call Initiating */ - Q931AddStateEntry(i, Q931_U1, Q931mes_DISCONNECT, 2); - Q931AddStateEntry(i, Q931_U1, Q931mes_SETUP_ACKNOWLEDGE, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_RELEASE_COMPLETE, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_CALL_PROCEEDING, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_CONNECT, 4); - - /* State 2 Overlap Sending */ - Q931AddStateEntry(i, Q931_U2, Q931mes_INFORMATION, 2); - Q931AddStateEntry(i, Q931_U2, Q931mes_CALL_PROCEEDING, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_PROGRESS, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_CONNECT, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_RELEASE, 2); - - /* State 3 Outgoing Call Proceeding */ - Q931AddStateEntry(i, Q931_U3, Q931mes_PROGRESS, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_CONNECT, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_RELEASE, 2); - - /* State 4 Call Delivered */ - Q931AddStateEntry(i, Q931_U4, Q931mes_CONNECT, 4); - - /* State 6 Call Precent */ - Q931AddStateEntry(i, Q931_U6, Q931mes_INFORMATION, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_ALERTING, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_CALL_PROCEEDING, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_CONNECT, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE_COMPLETE, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U6, Q931mes_DISCONNECT, 4); - - /* State 7 Call Received */ - Q931AddStateEntry(i, Q931_U7, Q931mes_CONNECT, 2); - - /* State 8 Connect request */ - Q931AddStateEntry(i, Q931_U8, Q931mes_CONNECT_ACKNOWLEDGE, 4); - - /* State 9 Incoming Call Proceeding */ - Q931AddStateEntry(i, Q931_U9, Q931mes_CONNECT, 2); - Q931AddStateEntry(i, Q931_U9, Q931mes_ALERTING, 2); - Q931AddStateEntry(i, Q931_U9, Q931mes_PROGRESS, 2); - - /* State 10 Active */ - Q931AddStateEntry(i, Q931_U10, Q931mes_SUSPEND, 2); - Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 4); - Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 2); - - /* State 11 Disconnect Request */ - Q931AddStateEntry(i, Q931_U11, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U11, Q931mes_DISCONNECT, 4); - Q931AddStateEntry(i, Q931_U11, Q931mes_NOTIFY, 4); - - /* State 12 Disconnect Ind */ - Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 2); - - /* State 15 Suspend Request */ - Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_ACKNOWLEDGE, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_REJECT, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_DISCONNECT, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_RELEASE, 4); - -/* TODO - Q931AddStateEntry(i, Q931_U17, - Q931AddStateEntry(i, Q931_U19, - Q931AddStateEntry(i, Q931_U25, -*/ - - /* Timer default values */ - Q931SetTimerDefault(i, Q931_TIMER_T301, 180000); /* T301: 180s */ - Q931SetTimerDefault(i, Q931_TIMER_T302, 15000); /* T302: 15s */ - Q931SetTimerDefault(i, Q931_TIMER_T303, 4000); /* T303: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T304, 30000); /* T304: 30s */ - Q931SetTimerDefault(i, Q931_TIMER_T305, 30000); /* T305: 30s */ - Q931SetTimerDefault(i, Q931_TIMER_T308, 4000); /* T308: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T309, 60000); /* T309: 60s */ - Q931SetTimerDefault(i, Q931_TIMER_T310, 60000); /* T310: 60s */ - Q931SetTimerDefault(i, Q931_TIMER_T313, 4000); /* T313: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T314, 4000); /* T314: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T316, 120000); /* T316: 120s */ - Q931SetTimerDefault(i, Q931_TIMER_T317, 90000); /* T317: 90s */ - Q931SetTimerDefault(i, Q931_TIMER_T318, 4000); /* T318: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T319, 4000); /* T319: 4s */ - Q931SetTimerDefault(i, Q931_TIMER_T321, 30000); /* T321: 30s */ - Q931SetTimerDefault(i, Q931_TIMER_T322, 4000); /* T322: 4s */ -} - -/***************************************************************************** - - Function: Q931ProcAlertingTE - -*****************************************************************************/ -L3INT Q931ProcAlertingTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* Reset 4 sec timer. */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcCallProceedingTE - -*****************************************************************************/ -L3INT Q931ProcCallProceedingTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcConnectTE - -*****************************************************************************/ -L3INT Q931ProcConnectTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - if (pTrunk->autoConnectAck) { - Q931AckConnect(pTrunk, buf); - } - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcConnectAckTE - -*****************************************************************************/ -L3INT Q931ProcConnectAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcProgressTE - -*****************************************************************************/ -L3INT Q931ProcProgressTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSetupTE - -*****************************************************************************/ -L3INT Q931ProcSetupTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)&buf[Q931L4HeaderSpace]; - L3INT rc = 0; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Reject SETUP on existing calls */ - if (Q931GetCallState(pTrunk, pMes->CRV) != Q931_U0) { - Q931Disconnect(pTrunk, iFrom, pMes->CRV, 81); - return Q931E_UNEXPECTED_MESSAGE; - } - - /* outgoing call */ - if (iFrom == 4) { - ret = Q931CreateCRV(pTrunk, &callIndex); - if (ret) - return ret; - pMes->CRV = pTrunk->call[callIndex].CRV; - - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - if (ret) - return ret; - - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - - /* TODO: Add this back when we get the state stuff more filled out */ - /*Q931SetState(pTrunk, callIndex, Q931_U1);*/ - } - /* incoming call */ - else { - /* Locate free CRV entry and store info */ - ret = Q931AllocateCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) { - /* Not possible to allocate CRV entry, so must reject call */ - Q931Disconnect(pTrunk, iFrom, pMes->CRV, 42); - return ret; - } - - /* Send setup indication to user */ - ret = Q931Tx34(pTrunk, (L3UCHAR*)pMes, pMes->Size); - if (ret != Q931E_NO_ERROR) { - if (pTrunk->autoSetupAck) { - Q931AckSetup(pTrunk, buf); - } - return ret; - } else { - /* Must be full queue, meaning we can't process the call */ - /* so we must disconnect */ - Q931Disconnect(pTrunk, iFrom, pMes->CRV, 81); - return ret; - } -#if 0 - /* TODO: Unreachable code??? */ - /* Set state U6 */ - Q931SetState(pTrunk, callIndex, Q931_U6); - - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); -#endif - } - return rc; -} - -/***************************************************************************** - - Function: Q931ProcSetupAckTE - - Description: Used to acknowedge a SETUP. Usually the first initial - response recevide back used to buy some time. L4 sending this - should only be passed on. L2 sending this means that we set - a new timer (and pass it to L4). - - Note that ChanID (B Channel Assignment) might come here from - NT side. - -*****************************************************************************/ -L3INT Q931ProcSetupAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcResumeTE - -*****************************************************************************/ -L3INT Q931ProcResumeTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Generic * pMes = (Q931mes_Generic *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - if (Q931GetCallState(pTrunk, pMes->CRV) == Q931_U0 && iFrom ==4) { - /* Call reference selection */ - ret = Q931CreateCRV(pTrunk, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - pMes->CRV = pTrunk->call[callIndex].CRV; - - /* Send RESUME to network */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - if (ret != Q931E_NO_ERROR) - return ret; - - /* Start timer T318 */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T318); - - /* set state U17 */ - Q931SetState(pTrunk, callIndex, Q931_U17); - } else { - return Q931E_ILLEGAL_MESSAGE; - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcResumeAckTE - -*****************************************************************************/ -L3INT Q931ProcResumeAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcResumeRejectTE - -*****************************************************************************/ -L3INT Q931ProcResumeRejectTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSuspendTE - -*****************************************************************************/ -L3INT Q931ProcSuspendTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSuspendAckTE - -*****************************************************************************/ -L3INT Q931ProcSuspendAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSuspendRejectTE - -*****************************************************************************/ -L3INT Q931ProcSuspendRejectTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcInformationTE - -*****************************************************************************/ -L3INT Q931ProcUserInformationTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcDisconnectTE - -*****************************************************************************/ -L3INT Q931ProcDisconnectTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Processing DISCONNECT message from %s for CRV: %d (%#hx)\n", - iFrom == 4 ? "Local" : "Remote", pMes->CRV, pMes->CRV); - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcReleaseTE - -*****************************************************************************/ -L3INT Q931ProcReleaseTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT state = Q931GetCallState(pTrunk, pMes->CRV); - L3INT ret = Q931E_NO_ERROR; - - if (iFrom == 4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (state == Q931_U0 && iFrom == 2) { - Q931Tx34(pTrunk, buf, pMes->Size); - ret = Q931ReleaseComplete(pTrunk, buf); - } else { - ret = Q931ProcUnexpectedMessage(pTrunk, buf, iFrom); - } - if (pMes->CRV && iFrom == 2) { - /* Find the call using CRV */ - if ((Q931FindCRV(pTrunk, pMes->CRV, &callIndex)) != Q931E_NO_ERROR) - return ret; - pTrunk->call[callIndex].InUse = 0; - } - - return ret; -} - -/***************************************************************************** - - Function: Q931ProcReleaseCompleteTE - -*****************************************************************************/ -L3INT Q931ProcReleaseCompleteTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } else { - if (pMes->CRV) { - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - pTrunk->call[callIndex].InUse = 0; - - /* TODO: experimental, send RELEASE_COMPLETE message */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcRestartTE - -*****************************************************************************/ -L3INT Q931ProcRestartTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - if (pMes->CRV) { - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - } - - /* TODO chack against state table for illegal or unexpected message here */ - - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - - if (pTrunk->autoRestartAck) { - Q931AckRestart(pTrunk, buf); - } - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcRestartAckTE - -*****************************************************************************/ -L3INT Q931ProcRestartAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - if (pMes->CRV) { - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - } - - /* TODO chack against state table for illegal or unexpected message here */ - - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcCongestionControlTE - -*****************************************************************************/ -L3INT Q931ProcCongestionControlTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcInformationTE - -*****************************************************************************/ -L3INT Q931ProcInformationTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcNotifyTE - -*****************************************************************************/ -L3INT Q931ProcNotifyTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcStatusTE - -*****************************************************************************/ -L3INT Q931ProcStatusTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcStatusEnquiryTE - -*****************************************************************************/ -L3INT Q931ProcStatusEnquiryTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcSegmentTE - -*****************************************************************************/ -L3INT Q931ProcSegmentTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/****************************************************************************/ -/******************* Q.932 - Supplementary Services *************************/ -/****************************************************************************/ - -/***************************************************************************** - - Function: Q932ProcRetrieveTE - -*****************************************************************************/ -L3INT Q932ProcFacilityTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcRetrieveTE - -*****************************************************************************/ -L3INT Q932ProcHoldTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcRetrieveTE - -*****************************************************************************/ -L3INT Q932ProcHoldAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcRetrieveTE - -*****************************************************************************/ -L3INT Q932ProcHoldRejectTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcRegisterTE - -*****************************************************************************/ -L3INT Q932ProcRegisterTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q932ProcRetrieveTE - -*****************************************************************************/ -L3INT Q932ProcRetrieveTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcRetrieveAckTE - -*****************************************************************************/ -L3INT Q932ProcRetrieveAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} - -/***************************************************************************** - - Function: Q931ProcRetrieveRejectTE - -*****************************************************************************/ -L3INT Q932ProcRetrieveRejectTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) -{ - Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace]; - L3INT callIndex; - L3INT ret = Q931E_NO_ERROR; - - /* Find the call using CRV */ - ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex); - if (ret != Q931E_NO_ERROR) - return ret; - - /* TODO chack against state table for illegal or unexpected message here */ - - /* TODO - Set correct timer here */ - Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303); - if (iFrom ==4) { - /* TODO Add proc here */ - ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size); - } - else if (iFrom == 2) { - /* TODO Add proc here */ - ret = Q931Tx34(pTrunk, buf, pMes->Size); - } - return ret; -} diff --git a/libs/freetdm/src/isdn/Q931api.c b/libs/freetdm/src/isdn/Q931api.c deleted file mode 100644 index ed0d13836b..0000000000 --- a/libs/freetdm/src/isdn/Q931api.c +++ /dev/null @@ -1,598 +0,0 @@ -/***************************************************************************** - - FileName: Q931api.c - - Contents: api (Application Programming Interface) functions. - See q931.h for description. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "Q931.h" -#include "memory.h" - -extern L3INT Q931L4HeaderSpace; - -/* -L3INT Q931CreateMesIndex(L3INT mc) -{ - if(mc < 0 || mc > 127 ) - return Q931E_INTERNAL; - - if(Q931MesCount >127) - return Q931E_INTERNAL; - - Q931MesIndex[mc] = Q931MesCount ++; - - return Q931E_NO_ERROR; -} -*/ -/* -L3INT Q931CreateIEIndex(L3INT iec) -{ - if(iec < 0 || iec > 127 ) - return Q931E_INTERNAL; - - if(Q931IECount > 127) - return Q931E_INTERNAL; - - Q931IEIndex[iec] = Q931IECount ++; - - return Q931E_NO_ERROR; -} -*/ - -L3INT Q931Api_InitTrunk(Q931_TrunkInfo_t *pTrunk, - Q931Dialect_t Dialect, - Q931NetUser_t NetUser, - Q931_TrunkType_t TrunkType, - Q931Tx34CB_t Q931Tx34CBProc, - Q931Tx32CB_t Q931Tx32CBProc, - Q931ErrorCB_t Q931ErrorCBProc, - void *PrivateData32, - void *PrivateData34) -{ - int y, dchannel, maxchans, has_sync = 0; - - switch(TrunkType) - { - case Q931_TrType_E1: - dchannel = 16; - maxchans = 31; - has_sync = 1; - break; - - case Q931_TrType_T1: - case Q931_TrType_J1: - dchannel = 24; - maxchans = 24; - break; - - case Q931_TrType_BRI: - case Q931_TrType_BRI_PTMP: - dchannel = 3; - maxchans = 3; - break; - - default: - return 0; - } - - pTrunk->Q931Tx34CBProc = Q931Tx34CBProc; - pTrunk->Q931Tx32CBProc = Q931Tx32CBProc; - pTrunk->Q931ErrorCBProc = Q931ErrorCBProc; - pTrunk->PrivateData32 = PrivateData32; - pTrunk->PrivateData34 = PrivateData34; - - pTrunk->LastCRV = 0; - pTrunk->Dialect = Dialect + NetUser; - pTrunk->Enabled = 0; - pTrunk->TrunkType = TrunkType; - pTrunk->NetUser = NetUser; - pTrunk->TrunkState = 0; - pTrunk->autoRestartAck = 0; - for(y=0; y < Q931MAXCHPERTRUNK; y++) - { - pTrunk->ch[y].Available = 1; - - if(has_sync && y == 0) - { - pTrunk->ch[y].ChanType = Q931_ChType_Sync; - } - else if(y == dchannel) - { - pTrunk->ch[y].ChanType = Q931_ChType_D; - } - else if(y > maxchans) - { - pTrunk->ch[y].ChanType = Q931_ChType_NotUsed; - } - else - { - pTrunk->ch[y].ChanType = Q931_ChType_B; - } - } - - for(y=0; y < Q931MAXCALLPERTRUNK; y++) - { - pTrunk->call[y].InUse = 0; - - } - return 1; -} - -void Q931SetMesProc(L3UCHAR mes, L3UCHAR dialect, q931proc_func_t *Q931ProcFunc, q931umes_func_t *Q931UmesFunc, q931pmes_func_t *Q931PmesFunc) -{ - if(Q931ProcFunc != NULL) - Q931Proc[dialect][mes] = Q931ProcFunc; - if(Q931UmesFunc != NULL) - Q931Umes[dialect][mes] = Q931UmesFunc; - if(Q931PmesFunc != NULL) - Q931Pmes[dialect][mes] = Q931PmesFunc; -} - -void Q931SetIEProc(L3UCHAR iec, L3UCHAR dialect, q931pie_func_t *Q931PieProc, q931uie_func_t *Q931UieProc) -{ - if(Q931PieProc != NULL) - Q931Pie[dialect][iec] = Q931PieProc; - if(Q931UieProc != NULL) - Q931Uie[dialect][iec] = Q931UieProc; -} - -void Q931SetTimeoutProc(L3UCHAR dialect, L3UCHAR timer, q931timeout_func_t *Q931TimeoutProc) -{ - if(Q931Timeout != NULL) - Q931Timeout[dialect][timer] = Q931TimeoutProc; -} - -void Q931SetTimerDefault(L3UCHAR dialect, L3UCHAR timer, q931timer_t timeout) -{ - Q931Timer[dialect][timer] = timeout; -} - -L3INT Q931GetMesSize(Q931mes_Generic *pMes) -{ - - L3UCHAR *p = &pMes->buf[0]; - L3INT Size = (L3INT)(p - (L3UCHAR *)pMes); - return Size; -} - -/***************************************************************************** - - Function: q931AppendIE - - Description: Append IE to the message. - - Parameters: pm Ptr to message. - pi Ptr to information element - - Return Value ie setting - -*****************************************************************************/ - -ie Q931AppendIE( L3UCHAR *pm, L3UCHAR *pi) -{ - ie IE = 0; - Q931mes_Generic * pMes= (Q931mes_Generic *)pm; - Q931ie_BearerCap * pIE= (Q931ie_BearerCap *)pi; - L3INT iISize = pIE->Size; - - L3UCHAR *pBuf = &pMes->buf[0]; - L3INT Off = (L3INT)(pMes->Size - (pBuf - pm)); - IE = (ie)(Off | 0x8000); - - memcpy(&pm[pMes->Size], pi, iISize); - - pMes->Size += iISize; - - return IE; -} - -/***************************************************************************** -*****************************************************************************/ -static L3INT crv={1}; - -L3INT Q931GetUniqueCRV(Q931_TrunkInfo_t *pTrunk) -{ - L3INT max = (Q931_IS_BRI(pTrunk)) ? Q931_BRI_MAX_CRV : Q931_PRI_MAX_CRV; - - crv++; - crv = (crv <= max) ? crv : 1; - - return crv; -} - -L3INT Q931InitMesGeneric(Q931mes_Generic *pMes) -{ - memset(pMes, 0, sizeof(*pMes)); - pMes->ProtDisc = 0x08; - pMes->Size = Q931GetMesSize(pMes); - - return 0; -} - -L3INT Q931InitMesResume(Q931mes_Generic * pMes) -{ - pMes->ProtDisc = 0x08; - pMes->CRV = 0; /* CRV to be allocated, might be receive*/ - pMes->MesType = Q931mes_RESUME; - - pMes->Size = Q931GetMesSize(pMes); - pMes->CallID = 0; /* Channel Identification */ - return 0; -} - -L3INT Q931InitMesRestartAck(Q931mes_Generic * pMes) -{ - pMes->ProtDisc = 0x08; - pMes->CRV = 0; /* CRV to be allocated, might be receive*/ - pMes->MesType = Q931mes_RESTART_ACKNOWLEDGE; - - pMes->Size = Q931GetMesSize(pMes); - pMes->ChanID = 0; /* Channel Identification */ - pMes->Display = 0; - pMes->RestartInd = 0; - pMes->RestartWin = 0; - return 0; -} - -L3INT Q931InitIEBearerCap(Q931ie_BearerCap *pIE) -{ - pIE->IEId = Q931ie_BEARER_CAPABILITY; - pIE->Size = sizeof(Q931ie_BearerCap); - pIE->CodStand = 0; - pIE->ITC = 0; - pIE->TransMode = 0; - pIE->ITR = 0x10; - pIE->RateMul = 0; - - pIE->Layer1Ident = 0; - pIE->UIL1Prot = 0; /* User Information Layer 1 Protocol */ - pIE->SyncAsync = 0; /* Sync/Async */ - pIE->Negot = 0; - pIE->UserRate = 0; - pIE->InterRate = 0; /* Intermediate Rate */ - pIE->NIConTx = 0; - pIE->NIConRx = 0; - pIE->FlowCtlTx = 0; /* Flow control on Tx */ - pIE->FlowCtlRx = 0; /* Flow control on Rx */ - pIE->HDR = 0; - pIE->MultiFrame = 0; /* Multi frame support */ - pIE->Mode = 0; - pIE->LLInegot = 0; - pIE->Assignor = 0; /* Assignor/assignee */ - pIE->InBandNeg = 0; /* In-band/out-band negot. */ - pIE->NumStopBits = 0; /* Number of stop bits */ - pIE->NumDataBits = 0; /* Number of data bits. */ - pIE->Parity = 0; - pIE->DuplexMode = 0; - pIE->ModemType = 0; - pIE->Layer2Ident = 0; - pIE->UIL2Prot = 0; /* User Information Layer 2 Protocol */ - pIE->Layer3Ident = 0; - pIE->UIL3Prot = 0; /* User Information Layer 3 Protocol */ - pIE->AL3Info1 = 0; - pIE->AL3Info2 = 0; - - return 0; -} - -L3INT Q931InitIEChanID(Q931ie_ChanID *pIE) -{ - pIE->IEId = Q931ie_CHANNEL_IDENTIFICATION; - pIE->Size = sizeof(Q931ie_ChanID); - pIE->IntIDPresent = 0; /* Int. id. present */ - pIE->IntType = 0; /* Int. type */ - pIE->PrefExcl = 0; /* Pref./Excl. */ - pIE->DChanInd = 0; /* D-channel ind. */ - pIE->InfoChanSel = 0; /* Info. channel selection */ - pIE->InterfaceID = 0; /* Interface identifier */ - pIE->CodStand = 0; /* Code standard */ - pIE->NumMap = 0; /* Number/Map */ - pIE->ChanMapType = 0; /* Channel type/Map element type */ - pIE->ChanSlot = 0; /* Channel number/Slot map */ - - return 0; -} - -L3INT Q931InitIEProgInd(Q931ie_ProgInd * pIE) -{ - pIE->IEId = Q931ie_PROGRESS_INDICATOR; - pIE->Size = sizeof(Q931ie_ProgInd); - pIE->CodStand = 0; /* Coding standard */ - pIE->Location = 0; /* Location */ - pIE->ProgDesc = 0; /* Progress description */ - - return 0; -} - -L3INT Q931InitIENetFac(Q931ie_NetFac * pIE) -{ - pIE->IEId = Q931ie_NETWORK_SPECIFIC_FACILITIES; - pIE->Size = sizeof(Q931ie_NetFac); - pIE->LenNetID = 0; /* Length of network facilities id. */ - pIE->TypeNetID = 0; /* Type of network identification */ - pIE->NetIDPlan = 0; /* Network identification plan. */ - pIE->NetFac = 0; /* Network specific facility spec. */ - pIE->NetID[0] = 0; - return 0; -} - -L3INT Q931InitIEDisplay(Q931ie_Display * pIE) -{ - pIE->IEId = Q931ie_DISPLAY; - pIE->Size = sizeof(Q931ie_Display); - pIE->Display[0] = 0; - return 0; -} - -L3INT Q931InitIEDateTime(Q931ie_DateTime * pIE) -{ - pIE->IEId = Q931ie_DATETIME; - pIE->Size = sizeof(Q931ie_DateTime); - pIE->Year = 0; /* Year */ - pIE->Month = 0; /* Month */ - pIE->Day = 0; /* Day */ - pIE->Hour = 0; /* Hour */ - pIE->Minute = 0; /* Minute */ - pIE->Second = 0; /* Second */ - - return 0; -} - -L3INT Q931InitIEKeypadFac(Q931ie_KeypadFac * pIE) -{ - pIE->IEId = Q931ie_KEYPAD_FACILITY; - pIE->Size = sizeof(Q931ie_KeypadFac); - pIE->KeypadFac[0] = 0; - return 0; -} - -L3INT Q931InitIESignal(Q931ie_Signal * pIE) -{ - pIE->IEId = Q931ie_SIGNAL; - pIE->Size = sizeof(Q931ie_Signal); - pIE->Signal = 0; - return 0; -} - -L3INT Q931InitIECallingNum(Q931ie_CallingNum * pIE) -{ - pIE->IEId = Q931ie_CALLING_PARTY_NUMBER; - pIE->Size = sizeof(Q931ie_CallingNum); - pIE->TypNum = 0; /* Type of number */ - pIE->NumPlanID = 0; /* Numbering plan identification */ - pIE->PresInd = 0; /* Presentation indicator */ - pIE->ScreenInd = 0; /* Screening indicator */ - pIE->Digit[0] = 0; /* Number digits (IA5) */ - - return 0; -} - -L3INT Q931InitIECallingSub(Q931ie_CallingSub * pIE) -{ - pIE->IEId = Q931ie_CALLING_PARTY_SUBADDRESS; - pIE->Size = sizeof(Q931ie_CallingSub); - pIE->TypNum = 0; /* Type of subaddress */ - pIE->OddEvenInd = 0; /* Odd/Even indicator */ - pIE->Digit[0] = 0; /* Digits */ - - return 0; -} - -L3INT Q931InitIECalledNum(Q931ie_CalledNum * pIE) -{ - pIE->IEId = Q931ie_CALLED_PARTY_NUMBER; - pIE->Size = sizeof(Q931ie_CalledNum); - pIE->TypNum = 0; /* Type of Number */ - pIE->NumPlanID = 0; /* Numbering plan identification */ - pIE->Digit[0] = 0; /* Digit (IA5) */ - - return 0; -} - -L3INT Q931InitIECalledSub(Q931ie_CalledSub * pIE) -{ - pIE->IEId = Q931ie_CALLED_PARTY_SUBADDRESS; - pIE->Size = sizeof(Q931ie_CalledSub); - pIE->TypNum = 0; /* Type of subaddress */ - pIE->OddEvenInd = 0; /* Odd/Even indicator */ - pIE->Digit[0] = 0; /* Digits */ - - return 0; -} - -L3INT Q931InitIETransNetSel(Q931ie_TransNetSel * pIE) -{ - pIE->IEId = Q931ie_TRANSIT_NETWORK_SELECTION; - pIE->Size = sizeof(Q931ie_TransNetSel); - pIE->Type = 0; /* Type of network identifier */ - pIE->NetIDPlan = 0; /* Network idetification plan */ - pIE->NetID[0] = 0; /* Network identification(IA5) */ - - return 0; -} - -L3INT Q931InitIELLComp(Q931ie_LLComp * pIE) -{ - pIE->IEId = Q931ie_LOW_LAYER_COMPATIBILITY; - pIE->Size = sizeof(Q931ie_LLComp); - - pIE->CodStand = 0; /* Coding standard */ - pIE->ITransCap = 0; /* Information transfer capability */ - pIE->NegotInd = 0; /* Negot indic. */ - pIE->TransMode = 0; /* Transfer Mode */ - pIE->InfoRate = 0; /* Information transfer rate */ - pIE->RateMul = 0; /* Rate multiplier */ - pIE->Layer1Ident = 0; /* Layer 1 ident. */ - pIE->UIL1Prot = 0; /* User information layer 1 protocol */ - pIE->SyncAsync = 0; /* Synch/asynch */ - pIE->Negot = 0; /* Negot */ - pIE->UserRate = 0; /* User rate */ - pIE->InterRate = 0; /* Intermediate rate */ - pIE->NIConTx = 0; /* NIC on Tx */ - pIE->NIConRx = 0; /* NIC on Rx */ - pIE->FlowCtlTx = 0; /* Flow control on Tx */ - pIE->FlowCtlRx = 0; /* Flow control on Rx */ - pIE->HDR = 0; /* Hdr/no hdr */ - pIE->MultiFrame = 0; /* Multiframe */ - pIE->ModeL1 = 0; /* Mode L1 */ - pIE->NegotLLI = 0; /* Negot. LLI */ - pIE->Assignor = 0; /* Assignor/Assignor ee */ - pIE->InBandNeg = 0; /* In-band negot. */ - pIE->NumStopBits = 0; /* Number of stop bits */ - pIE->NumDataBits = 0; /* Number of data bits */ - pIE->Parity = 0; /* Parity */ - pIE->DuplexMode = 0; /* Duplex Mode */ - pIE->ModemType = 0; /* Modem type */ - pIE->Layer2Ident = 0; /* Layer 2 ident. */ - pIE->UIL2Prot = 0; /* User information layer 2 protocol */ - pIE->ModeL2 = 0; /* ModeL2 */ - pIE->Q933use = 0; /* Q.9333 use */ - pIE->UsrSpcL2Prot = 0; /* User specified layer 2 protocol info */ - pIE->WindowSize = 0; /* Window size (k) */ - pIE->Layer3Ident = 0; /* Layer 3 ident */ - pIE->OptL3Info = 0; /* Optional layer 3 protocol info. */ - pIE->ModeL3 = 0; /* Mode of operation */ -#if 0 - pIE->ModeX25op = 0; /* Mode of operation X.25 */ -#endif - pIE->DefPackSize = 0; /* Default packet size */ - pIE->PackWinSize = 0; /* Packet window size */ - pIE->AddL3Info = 0; /* Additional Layer 3 protocol info */ - - return 0; -} - -L3INT Q931InitIEHLComp(Q931ie_HLComp * pIE) -{ - pIE->IEId = Q931ie_HIGH_LAYER_COMPATIBILITY; - pIE->Size = sizeof(Q931ie_HLComp); - - return 0; -} - -L3INT Q931ProcUnknownMessage(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom) -{ - /* TODO: Unhandled paramaters */ - (void)pTrunk; - (void)b; - (void)iFrom; - - return 0; -} - -L3INT Q931ProcUnexpectedMessage(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom) -{ - /* TODO: Unhandled paramaters */ - (void)pTrunk; - (void)b; - (void)iFrom; - - return 0; -} - -L3INT Q931Disconnect(Q931_TrunkInfo_t *pTrunk, L3INT iTo, L3INT iCRV, L3INT iCause) -{ - /* TODO: Unhandled paramaters */ - (void)pTrunk; - (void)iTo; - (void)iCRV; - (void)iCause; - - return 0; -} - -L3INT Q931ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf) -{ - Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace]; - ptr->MesType = Q931mes_RELEASE_COMPLETE; - ptr->CRVFlag = !(ptr->CRVFlag); - return Q931Tx32Data(pTrunk,0,buf,ptr->Size); -} - -L3INT Q931AckRestart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf) -{ - L3INT RetCode; - - Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace]; - ptr->MesType = Q931mes_RESTART_ACKNOWLEDGE; - //if (ptr->CRV) { - ptr->CRVFlag = !(ptr->CRVFlag); - //} - - RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4); - - return RetCode; -} - -L3INT Q931AckSetup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf) -{ - L3INT RetCode; - - Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace]; - ptr->MesType = Q931mes_SETUP_ACKNOWLEDGE; - - RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4); - - return RetCode; -} - -L3INT Q931AckConnect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf) -{ - L3INT RetCode; - - Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace]; - ptr->MesType = Q931mes_CONNECT_ACKNOWLEDGE; - - RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4); - - return RetCode; -} - -L3INT Q931AckService(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf) -{ - L3INT RetCode; - - Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace]; - ptr->MesType = Q931mes_SERVICE_ACKNOWLEDGE; - if (ptr->CRV) { - ptr->CRVFlag = !(ptr->CRVFlag); - } - - RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4); - - return RetCode; -} - -Q931_ENUM_NAMES(DIALECT_TYPE_NAMES, DIALECT_STRINGS) -Q931_STR2ENUM(q931_str2Q931Dialect_type, q931_Q931Dialect_type2str, Q931Dialect_t, DIALECT_TYPE_NAMES, Q931_Dialect_Count) diff --git a/libs/freetdm/src/isdn/Q931ie.c b/libs/freetdm/src/isdn/Q931ie.c deleted file mode 100644 index 62312ee654..0000000000 --- a/libs/freetdm/src/isdn/Q931ie.c +++ /dev/null @@ -1,3074 +0,0 @@ -/***************************************************************************** - - FileName: Q931ie.c - - Contents: Information Element Pack/Unpack functions. - - These functions will pack out a Q931 message from the bit - packed original format into structs that are easier to process - and pack the same structs back into bit fields when sending - messages out. - - The messages contains a short for each possible IE. The MSB - bit flags the precense of an IE, while the remaining bits - are the offset into a buffer to find the actual IE. - - Each IE are supported by 3 functions: - - Q931Pie_XXX Pack struct into Q.931 IE - Q931Uie_XXX Unpack Q.931 IE into struct - Q931InitIEXXX Initialize IE (see Q931api.c). - - Dialect Note: This file will only contain standard DSS1 IE. Other IE as - used in QSIG, NI2, Q.932 etc are located in separate files. - - See q931.h for description. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "Q931.h" - -#ifdef _MSC_VER -#ifndef __inline__ -#define __inline__ __inline -#endif -#if (_MSC_VER >= 1400) /* VC8+ */ -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE -#endif -#endif -#ifndef strcasecmp -#define strcasecmp(s1, s2) _stricmp(s1, s2) -#endif -#ifndef strncasecmp -#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) -#endif -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - -/***************************************************************************** - - Macro: Q931MoreIE - - Description: Local helper macro detecting if there is more IE space left - based on the 3 standard parameters Octet, Off and IESpace. - This can be used to test if the IE is completed to avoid - that the header of the next IE is interpreted as a part of - the current IE. - -*****************************************************************************/ -#define Q931MoreIE() (Octet + Off - 2 < IESize) - -#define Q931IESizeTest(x) {\ - if (Octet + Off - 2 != IESize) {\ - Q931SetError(pTrunk, x, Octet, Off);\ - return x;\ - }\ -} - -/***************************************************************************** - - Function: Q931ReadExt - - Description: Many of the octets in the standard have an MSB 'ext.1'. This - means that the octet usually is the latest octet, but that a - futhure standard may extend the octet. A stack must be able - to handle such extensions by skipping the extension octets. - - This function will increase the offset counter with 1 for - each octet with an MSB of zero. This will allow the stack to - skip extensions wihout knowing anything about them. - - Parameters: IBuf ptr to octet array. - Off Starting offset counter - - Return Value: New offset value. - -*****************************************************************************/ - -L3INT Q931ReadExt(L3UCHAR * IBuf, L3INT Off) -{ - L3INT c = 0; - while ((IBuf[c] & 0x80) == 0) { - c++; - } - return Off + c; -} - -/***************************************************************************** - - Function: Q931Uie_BearerCap - - Description: Unpack a bearer capability ie. - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ - -L3INT Q931Uie_BearerCap(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_BearerCap *pie = (Q931ie_BearerCap*)OBuf; - ie *pIE = &pMsg->BearerCap; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - *pIE = 0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->CodStand = ieGetOctet((IBuf[Octet] & 0x60) >> 5); - pie->ITC = ieGetOctet(IBuf[Octet] & 0x1f); - Off = Q931ReadExt(&IBuf[Octet], Off); - Octet++; - - /* Octet 4 */ - pie->TransMode = ieGetOctet((IBuf[Octet + Off] & 0x60) >> 5); - pie->ITR = ieGetOctet(IBuf[Octet + Off] & 0x1f); - Off = Q931ReadExt(&IBuf[Octet + Off], Off); - Octet++; - - /* Octet 4.1. Rate multiplier is only present if ITR = Multirate */ - if (pie->ITR == 0x18) { - pie->RateMul = ieGetOctet(IBuf[Octet + Off] & 0x7f); - Off = Q931ReadExt(&IBuf[Octet + Off], Off); - Off ++; - } - - /* Octet 5 */ - if ((IBuf[Octet + Off] & 0x60) == 0x20 && Q931MoreIE()) { - pie->Layer1Ident = ieGetOctet((IBuf[Octet + Off] & 0x60) >> 5); - pie->UIL1Prot = ieGetOctet(IBuf[Octet + Off] & 0x1f); - Octet++; - - /* Octet 5a. The octet may be present if ITC is unrestrictd digital info - * and UIL1Prot is either V.110, I.460 and X.30 or V.120. It may also - * be present if ITC = 3.1 kHz audio and UIL1Prot is G.711. - * Bit 8 of Octet 5 = 0 indicates that 5a is present. - */ - - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - if (((pie->ITC == 0x08) && (pie->UIL1Prot == 0x01 || pie->UIL1Prot == 0x08)) - || ((pie->ITC == 0x10) && (pie->UIL1Prot == 0x02 || pie->UIL1Prot == 0x03))) { - pie->SyncAsync = ieGetOctet((IBuf[Octet + Off] & 0x40) >> 6); - pie->Negot = ieGetOctet((IBuf[Octet + Off] & 0x20) >> 5); - pie->UserRate = ieGetOctet(IBuf[Octet + Off] & 0x1f); - Off ++; - } - else { - /* We have detected bit 8 = 0, but no setting that require the */ - /* additional octets ??? */ - Q931SetError(pTrunk, Q931E_BEARERCAP, 5,Off); - return Q931E_BEARERCAP; - } - - /* Octet 5b. Two different structures used. */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - if (pie->UIL1Prot == 0x01) { /* ITU V.110, I.460 and X.30 */ - pie->InterRate = ieGetOctet((IBuf[Octet + Off] & 0x60) >> 5); - pie->NIConTx = ieGetOctet((IBuf[Octet + Off] & 0x10) >> 4); - pie->NIConRx = ieGetOctet((IBuf[Octet + Off] & 0x08) >> 3); - pie->FlowCtlTx = ieGetOctet((IBuf[Octet + Off] & 0x04) >> 2); - pie->FlowCtlRx = ieGetOctet((IBuf[Octet + Off] & 0x20) >> 1); - Off++; - } - else if (pie->UIL1Prot == 0x08) { /* ITU V.120 */ - pie->HDR = ieGetOctet((IBuf[Octet + Off] & 0x40) >> 6); - pie->MultiFrame = ieGetOctet((IBuf[Octet + Off] & 0x20) >> 5); - pie->Mode = ieGetOctet((IBuf[Octet + Off] & 0x10) >> 4); - pie->LLInegot = ieGetOctet((IBuf[Octet + Off] & 0x08) >> 3); - pie->Assignor = ieGetOctet((IBuf[Octet + Off] & 0x04) >> 2); - pie->InBandNeg = ieGetOctet((IBuf[Octet + Off] & 0x02) >> 1); - Off++; - } - else { - Q931SetError(pTrunk,Q931E_BEARERCAP, 5,Off); - return Q931E_BEARERCAP; - } - - /* Octet 5c */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->NumStopBits = ieGetOctet((IBuf[Octet + Off] & 0x60) >> 5); - pie->NumDataBits = ieGetOctet((IBuf[Octet + Off] & 0x18) >> 3); - pie->Parity = ieGetOctet(IBuf[Octet + Off] & 0x07); - Off++; - - /* Octet 5d */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->DuplexMode = ieGetOctet((IBuf[Octet + Off] & 0x40) >> 6); - pie->ModemType = ieGetOctet(IBuf[Octet + Off] & 0x3f); - Off ++; - } - } - } - } - } - - /* Octet 6 */ - if ((IBuf[Octet + Off] & 0x60) == 0x40 && Q931MoreIE()) { - pie->Layer2Ident = ieGetOctet((IBuf[Octet + Off] & 0x60) >> 5); - pie->UIL2Prot = ieGetOctet(IBuf[Octet + Off] & 0x1f); - - Off = Q931ReadExt(&IBuf[Octet + Off], Off); - Octet ++; - } - - /* Octet 7 */ - if ((IBuf[Octet + Off] & 0x60) == 0x60 && Q931MoreIE()) { - pie->Layer3Ident = ieGetOctet((IBuf[Octet + Off] & 0x60) >> 5); - pie->UIL3Prot = ieGetOctet(IBuf[Octet + Off] & 0x1f); - Octet++; - - /* Octet 7a */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - if (pie->UIL3Prot == 0x0c) { - pie->AL3Info1 = ieGetOctet(IBuf[Octet + Off] & 0x0f); - Off++; - - /* Octet 7b */ - if (IsQ931Ext(IBuf[Octet + Off])) { - pie->AL3Info2 = ieGetOctet(IBuf[Octet + Off] & 0x0f); - Off++; - } - } - else { - Q931SetError(pTrunk,Q931E_BEARERCAP, 7, Off); - return Q931E_BEARERCAP; - - } - } - } - - Q931IESizeTest(Q931E_BEARERCAP); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_BearerCap); - pie->Size = sizeof(Q931ie_BearerCap); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_BearerCap - - Description: Packing a Q.931 Bearer Capability element from a generic - struct into a packed octet structure in accordance with the - standard. - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ - -L3INT Q931Pie_BearerCap(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_BearerCap *pIE = (Q931ie_BearerCap*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; /* remember current offset */ - L3INT li; - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Encoding Bearer Capability IE\n"); - - OBuf[(*Octet)++] = Q931ie_BEARER_CAPABILITY ; - li = (*Octet)++; /* remember length position */ - - /* Octet 3 - Coding standard / Information transfer capability */ - OBuf[(*Octet)++] = 0x80 | ((pIE->CodStand << 5) & 0x60) | (pIE->ITC & 0x1f); - - /* Octet 4 - Transfer mode / Information transfer rate */ - OBuf[(*Octet)++] = 0x80 | ((pIE->TransMode << 5) & 0x60) | (pIE->ITR & 0x1f); - - if (pIE->ITR == 0x18) { - /* Octet 4.1 - Rate Multiplier */ - OBuf[(*Octet)++] = 0x80 | (pIE->RateMul & 0x7f); - } - - /* Octet 5 - Layer 1 Ident / User information layer 1 protocol */ - if (pIE->Layer1Ident == 0x01) { - if (((pIE->ITC == 0x08) && (pIE->UIL1Prot == 0x01 || pIE->UIL1Prot == 0x08)) || - ((pIE->ITC == 0x10) && (pIE->UIL1Prot == 0x02 || pIE->UIL1Prot == 0x03))) { - OBuf[(*Octet)++] = 0x00 | ((pIE->Layer1Ident << 5) & 0x60) | (pIE->UIL1Prot & 0x15); - - /* Octet 5a - SyncAsync/Negot/UserRate */ - OBuf[(*Octet)++] = 0x00 | ((pIE->SyncAsync << 6) & 0x40) | ((pIE->Negot << 5) & 0x20) | (pIE->UserRate & 0x1f); - - /* Octet 5b - one of two types */ - if (pIE->UIL1Prot == 0x01) { /* ITU V.110, I.460 and X.30 */ - /* Octet 5b - Intermed rate/ Nic on Tx/Nix on Rx/FlowCtlTx/FlowCtlRx */ - OBuf[(*Octet)++] = 0x00 - | ((pIE->InterRate << 6) & 0x60) - | ((pIE->NIConTx << 4) & 0x10) - | ((pIE->NIConRx << 3) & 0x08) - | ((pIE->FlowCtlTx << 2) & 0x04) - | ((pIE->FlowCtlRx << 1) & 0x02); - } - else if (pIE->UIL1Prot == 0x08) { /* ITU V.120 */ - /* Octet 5b - HDR/Multiframe/Mode/LLINegot/Assignor/Inbandneg*/ - OBuf[(*Octet)++] = 0x00 - | ((pIE->InterRate << 6) & 0x60) - | ((pIE->MultiFrame << 5) & 0x20) - | ((pIE->Mode << 4) & 0x10) - | ((pIE->LLInegot << 3) & 0x08) - | ((pIE->Assignor << 2) & 0x04) - | ((pIE->InBandNeg << 1) & 0x02); - } - - /* Octet 5c - NumStopBits/NumStartBits/Parity */ - OBuf[(*Octet)++] = 0x00 - | ((pIE->NumStopBits << 5) & 0x60) - | ((pIE->NumDataBits << 3) & 0x18) - | (pIE->Parity & 0x07); - - /* Octet 5d - Duplex Mode/Modem Type */ - OBuf[(*Octet)++] = 0x80 | ((pIE->DuplexMode << 6) & 0x40) | (pIE->ModemType & 0x3f); - } - else { - OBuf[(*Octet)++] = 0x80 | ((pIE->Layer1Ident << 5) & 0x60) | (pIE->UIL1Prot & 0x1f); - } - } - - /* Octet 6 - Layer2Ident/User information layer 2 prtocol */ - if (pIE->Layer2Ident == 0x02) { - OBuf[(*Octet)++] = 0x80 | ((pIE->Layer2Ident << 5) & 0x60) | (pIE->UIL2Prot & 0x1f); - } - - /* Octet 7 - Layer 3 Ident/ User information layer 3 protocol */ - if (pIE->Layer3Ident == 0x03) { - if (pIE->UIL3Prot == 0x0c) { - OBuf[(*Octet)++] = 0x00 | ((pIE->Layer3Ident << 5) & 0x60) | (pIE->UIL3Prot & 0x1f); - - /* Octet 7a - Additional information layer 3 msb */ - OBuf[(*Octet)++] = 0x00 | (pIE->AL3Info1 & 0x0f); - - /* Octet 7b - Additional information layer 3 lsb */ - OBuf[(*Octet)++] = 0x80 | (pIE->AL3Info2 & 0x0f); - } - else { - OBuf[(*Octet)++] = 0x80 | ((pIE->Layer3Ident << 5) & 0x60) | (pIE->UIL3Prot & 0x1f); - } - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_CallID - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_CallID(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_CallID *pie = (Q931ie_CallID*)OBuf; - ie *pIE = &pMsg->CallID; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x = 0; - L3INT IESize; - - *pIE = 0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - do { - pie->CallId[x] = IBuf[Octet + Off] & 0x7f; - Off++; - x++; - } while (Q931MoreIE()); - - Q931IESizeTest(Q931E_CALLID); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_CallID) + x - 1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_CallID) + x - 1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_CallID - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ - -L3INT Q931Pie_CallID(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_CallID *pIE = (Q931ie_CallID*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet;/* remember current offset */ - L3INT li; - L3INT sCI = pIE->Size - sizeof(Q931ie_CallID) + 1; - L3INT x; - - OBuf[(*Octet)++] = Q931ie_CALL_IDENTITY ; - li = (*Octet)++; /* remember length position */ - - for (x = 0; x < sCI; x++) { - OBuf[(*Octet)++] = pIE->CallId[x]; - } - - OBuf[(*Octet) - 1] |= 0x80; /* set complete flag at last octet*/ - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_CallState - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_CallState(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_CallState *pie = (Q931ie_CallState*)OBuf; - ie *pIE = &pMsg->CallState; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->CodStand = (IBuf[Octet + Off] >> 6) & 0x03; - pie->CallState = IBuf[Octet + Off] & 0x3f; - Octet++; - - Q931IESizeTest(Q931E_CALLSTATE); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_CallState); - pie->Size = sizeof(Q931ie_CallState); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_CallState - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_CallState(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_CallState *pIE = (Q931ie_CallState*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; /* remember current offset */ - L3INT li; - - OBuf[(*Octet)++] = Q931ie_CALL_STATE; - li = (*Octet)++; /* remember length position */ - - OBuf[(*Octet)++] = (pIE->CodStand << 6) | (pIE->CallState & 0x3f); - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_CalledSub - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_CalledSub(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_CalledSub *pie = (Q931ie_CalledSub*)OBuf; - ie *pIE = &pMsg->CalledSub; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x; - L3INT IESize; - - *pIE = 0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->TypNum = (IBuf[Octet + Off] >> 4) & 0x07; - pie->OddEvenInd = (IBuf[Octet + Off] >> 3) & 0x01; - Octet++; - - /* Octet 4 */ - x = 0; - do { - pie->Digit[x] = IBuf[Octet + Off] & 0x7f; - Off++; - x++; - } while (Q931MoreIE() && x < 20); - - Q931IESizeTest(Q931E_CALLEDSUB); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_CalledSub) + x - 1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_CalledSub) + x - 1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_CalledSub - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_CalledSub(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_CalledSub *pIE = (Q931ie_CalledSub*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - L3INT sN = pIE->Size - sizeof(Q931ie_CalledSub) + 1; - L3INT x; - - /* Octet 1 */ - OBuf[(*Octet)++] = Q931ie_CALLED_PARTY_SUBADDRESS; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x80 | (pIE->TypNum << 4) | (pIE->OddEvenInd << 3); - - /* Octet 4 */ - for (x = 0; xDigit[x]; - } - - OBuf[(*Octet) - 1] |= 0x80; /* Terminate bit */ - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_CalledNum - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_CalledNum(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_CalledNum *pie = (Q931ie_CalledNum*)OBuf; - ie *pIE = &pMsg->CalledNum; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x; - L3INT IESize; /* # digits in this case */ - - *pIE = 0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->TypNum = (IBuf[Octet + Off] >> 4) & 0x07; - pie->NumPlanID = IBuf[Octet + Off] & 0x0f; - Octet++; - - /* Octet 4*/ - x = 0; - do { - pie->Digit[x] = IBuf[Octet + Off] & 0x7f; - Off++; - x++; - } while ((IBuf[Octet + Off]&0x80) == 0 && Q931MoreIE()); - - pie->Digit[x] = '\0'; - - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_CalledNum) + x; - pie->Size = (L3UCHAR)(sizeof(Q931ie_CalledNum) + x); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_CalledNum - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_CalledNum(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_CalledNum *pIE = (Q931ie_CalledNum*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - L3INT sN = pIE->Size - sizeof(Q931ie_CalledNum); - L3INT x; - - /* Octet 1 */ - OBuf[(*Octet)++] = Q931ie_CALLED_PARTY_NUMBER; - - /* Octet 2 */ - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x80 | (pIE->TypNum << 4) | (pIE->NumPlanID); - - /* Octet 4 */ - for (x = 0; xDigit[x]; - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_CallingNum - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_CallingNum(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_CallingNum *pie = (Q931ie_CallingNum*)OBuf; - ie *pIE = &pMsg->CallingNum; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x; - L3INT IESize; - - *pIE = 0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->TypNum = (IBuf[Octet + Off] >> 4) & 0x07; - pie->NumPlanID = IBuf[Octet + Off] & 0x0f; - - /* Octet 3a */ - if ((IBuf[Octet + Off] & 0x80) == 0) { - Off++; - pie->PresInd = (IBuf[Octet + Off] >> 5) & 0x03; - pie->ScreenInd = IBuf[Octet + Off] & 0x03; - } - Octet++; - - /* Octet 4 */ - x = 0; - while (Q931MoreIE()) { - pie->Digit[x++] = IBuf[Octet + Off] & 0x7f; - - if ((IBuf[Octet + Off] & 0x80) != 0) { - break; - } - Off++; - } - pie->Digit[x] = '\0'; - - Q931IESizeTest(Q931E_CALLINGNUM); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_CallingNum) + x; - pie->Size = (L3UCHAR)(sizeof(Q931ie_CallingNum) + x); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_CallingNum - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_CallingNum(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_CallingNum *pIE = (Q931ie_CallingNum*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - L3INT sN = pIE->Size - sizeof(Q931ie_CallingNum); - L3INT x; - - /* Octet 1 */ - OBuf[(*Octet)++] = Q931ie_CALLING_PARTY_NUMBER; - - /* Octet 2 */ - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x00 | (pIE->TypNum << 4) | (pIE->NumPlanID); - - /* Octet 4 */ - OBuf[(*Octet)++] = 0x80; - - /* Octet 5 */ - for (x = 0; xDigit[x]; - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_CallingSub - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_CallingSub(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_CallingSub *pie = (Q931ie_CallingSub*)OBuf; - ie *pIE = &pMsg->CallingSub; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x; - L3INT IESize; - - *pIE = 0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->TypNum = (IBuf[Octet + Off] >> 4) & 0x07; - pie->OddEvenInd = (IBuf[Octet + Off] >> 3) & 0x01; - Octet++; - - /* Octet 4*/ - x = 0; - do { - pie->Digit[x] = IBuf[Octet + Off] & 0x7f; - Off++; - x++; - } while (Q931MoreIE() && x < 20); - - Q931IESizeTest(Q931E_CALLINGSUB); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_CallingSub) + x -1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_CallingSub) + x -1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_CallingSub - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_CallingSub(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_CallingSub *pIE = (Q931ie_CallingSub*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - L3INT sN = pIE->Size - sizeof(Q931ie_CallingSub) + 1; - L3INT x; - - /* Octet 1 */ - OBuf[(*Octet)++] = Q931ie_CALLING_PARTY_SUBADDRESS; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x80 | (pIE->TypNum << 4) | (pIE->OddEvenInd << 3); - - /* Octet 4 */ - for (x = 0; xDigit[x]; - } - - OBuf[(*Octet) - 1] |= 0x80; /* Terminate bit */ - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_Cause - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_Cause(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_Cause *pie = (Q931ie_Cause*)OBuf; - ie *pIE = &pMsg->Cause; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2*/ - IESize = IBuf[Octet++]; - - /* Octet 3*/ - pie->CodStand = (IBuf[Octet + Off]>>5) & 0x03; - pie->Location = IBuf[Octet + Off] & 0x0f; - - /* Octet 3a */ - if ((IBuf[Octet + Off] & 0x80) == 0) { - Off++; - pie->Recom = IBuf[Octet + Off] & 0x7f; - } - Octet++; - - /* Octet 4 */ - pie->Value = IBuf[Octet + Off] & 0x7f; - Octet++; - - /* Consume optional Diagnostic bytes */ - while (Q931MoreIE()) { - Off++; - }; - - Q931IESizeTest(Q931E_CAUSE); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_Cause); - pie->Size = sizeof(Q931ie_Cause); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_Cause - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_Cause(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_Cause *pIE = (Q931ie_Cause*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_CAUSE; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x80 | (pIE->CodStand<<5) | pIE->Location; - - /* Octet 3a - currently not supported in send */ - - /* Octet 4 */ - OBuf[(*Octet)++] = 0x80 | pIE->Value; - - /* Octet 5 - diagnostics not supported in send */ - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_CongLevel - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_CongLevel(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_CongLevel *pie = (Q931ie_CongLevel*)OBuf; - ie *pIE = &pMsg->CongestionLevel; - L3INT Off = 0; - L3INT Octet = 0; - - *pIE = 0; - - pie->IEId = IBuf[Octet] & 0xf0; - pie->CongLevel = IBuf[Octet] & 0x0f; - Octet ++; - - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_CongLevel); - pie->Size = sizeof(Q931ie_CongLevel); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_CongLevel - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_CongLevel(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_CongLevel *pIE = (Q931ie_CongLevel*)IBuf; - L3INT rc = 0; - /* L3INT Beg = *Octet; */ - - OBuf[(*Octet)++] = Q931ie_CONGESTION_LEVEL | pIE->CongLevel; - - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_ChanID - - Parameters: IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Uie_ChanID(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_ChanID *pie = (Q931ie_ChanID*)OBuf; - ie *pIE = &pMsg->ChanID; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; -//18 04 e1 80 83 01 - *pIE = 0; - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Decoding ChanID IE\n"); - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->IntIDPresent = (IBuf[Octet] >> 6) & 0x01; - pie->IntType = (IBuf[Octet] >> 5) & 0x01; - pie->PrefExcl = (IBuf[Octet] >> 3) & 0x01; - pie->DChanInd = (IBuf[Octet] >> 2) & 0x01; - pie->InfoChanSel = IBuf[Octet] & 0x03; - - Off = Q931ReadExt(&IBuf[Octet++], Off); - - /* Octet 3.1 */ - if (pie->IntIDPresent) { - pie->InterfaceID = IBuf[Octet + Off] & 0x7f; - - /* Temp fix. Interface id can be extended using the extension bit */ - /* this will read the octets, but do nothing with them. this is done */ - /* because the usage of this field is a little unclear */ - /* 30.jan.2001/JVB */ - Off = Q931ReadExt(&IBuf[Octet + Off], Off); - Off++; - } - - if ((Octet + Off - 2) != IESize) { - /* Octet 3.2 */ - if (pie->IntType == 1) { /* PRI etc */ - pie->CodStand = (IBuf[Octet + Off] >> 5) & 0x03; - pie->NumMap = (IBuf[Octet + Off] >> 4) & 0x01; - pie->ChanMapType = IBuf[Octet + Off] & 0x0f; - Off++; - - /* Octet 3.3 */ - /* Temp fix. Assume B channel. H channels not supported */ - pie->ChanSlot = IBuf[Octet + Off] & 0x7f; - - /* Some dialects don't follow the extension coding properly for this, but this should be safe for all */ - if ((Octet + Off - 1) != IESize) { - Off = Q931ReadExt(&IBuf[Octet + Off], Off); - } - Off++; - } - } - - Q931IESizeTest(Q931E_CHANID); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_ChanID); - pie->Size = sizeof(Q931ie_ChanID); - - if (pTrunk->loglevel == Q931_LOG_DEBUG) { - const char *iface; - char tmp[100] = ""; - - if (!pie->IntType) { - switch (pie->InfoChanSel) { - case 0x0: - iface = "None"; - break; - case 0x1: - iface = "B1"; - break; - case 0x2: - iface = "B2"; - break; - default: - iface = "Any Channel"; - } - - snprintf(tmp, sizeof(tmp)-1, "InfoChanSel: %d (%s)", pie->InfoChanSel, iface); - } - - Q931Log(pTrunk, Q931_LOG_DEBUG, - "\n-------------------------- Q.931 Channel ID ------------------------\n" - " Pref/Excl: %s, Interface Type: %s\n" - " %s\n" - "--------------------------------------------------------------------\n\n", - ((pie->PrefExcl) ? "Preferred" : "Exclusive"), - ((pie->IntType) ? "PRI/Other" : "BRI"), - tmp); - } - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_ChanID - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_ChanID(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_ChanID *pIE = (Q931ie_ChanID*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; /* remember current offset */ - L3INT li; - - OBuf[(*Octet)++] = Q931ie_CHANNEL_IDENTIFICATION; - li = (*Octet)++; /* remember length position */ - - /* Octet 3 flags & BRI chan # */ - OBuf[(*Octet)++] = 0x80 - | ((pIE->IntIDPresent << 6) & 0x40) - | ((pIE->IntType << 5) & 0x20) - | ((pIE->PrefExcl << 3) & 0x08) - | (pIE->InfoChanSel & 0x03); - - /* Octet 3.1 - Interface Identifier */ - if (pIE->IntIDPresent) { - OBuf[(*Octet)++] = 0x80 | (pIE->InterfaceID & 0x7f); - } - - /* Octet 3.2 & 3.3 - PRI */ - if (pIE->IntType) { - OBuf[(*Octet)++] = 0x80 - | ((pIE->CodStand << 5) & 0x60) - | ((pIE->NumMap << 4) & 0x10) - | (pIE->ChanMapType & 0x0f); /* TODO: support all possible channel map types */ - - /* Octet 3.3 Channel number */ - switch (pIE->ChanMapType) { - case 0x6: /* Slot map: H0 Channel Units */ /* unsupported, Octets 3.3.1 - 3.3.3 */ - return Q931E_CHANID; - - case 0x8: /* Slot map: H11 Channel Units */ - case 0x9: /* Slot map: H12 Channel Units */ - default: /* Channel number */ - OBuf[(*Octet)++] = 0x80 | (pIE->ChanSlot & 0x7f); - break; - } - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - - -/***************************************************************************** - - Function: Q931Uie_CRV - - Description: Reading CRV. - - The CRV is currently returned in the return value that - Q921Rx23 will assign to the CRV field in the unpacked - message. CRV is basically 2 bytes etc, but the spec allows - the use of longer CRV values. - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: CRV - -*****************************************************************************/ -L3USHORT Q931Uie_CRV(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff) -{ - L3USHORT CRV = 0; - L3INT Octet = *IOff; - L3INT l = IBuf[Octet++]; - - if (l == 1) { /* One octet CRV */ - CRV = IBuf[Octet++] & 0x7F; - } - else if (l == 2) { /* two octet CRV */ - CRV = (IBuf[Octet++] & 0x7f) << 8; - CRV |= IBuf[Octet++]; - } - else { - /* Long CRV is not used, so we skip this */ - /* TODO: is it right to set to 0 here? */ - CRV = 0; - Octet += l; - } - - *IOff = Octet; - return CRV; -} - -/***************************************************************************** - - Function: Q931Uie_DateTime - - Parameters: pTrunk [IN] Ptr to trunk information. - pIE [OUT] ptr to Information Element id. - IBuf [IN] ptr to a packed ie. - OBuf [OUT] ptr to buffer for Unpacked ie. - IOff [IN\OUT] Input buffer offset - OOff [IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_DateTime(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_DateTime * pie = (Q931ie_DateTime*)OBuf; - ie *pIE = &pMsg->DateTime; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize = 0; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 - Year */ - pie->Year = IBuf[Octet++]; - - /* Octet 4 - Month */ - pie->Month = IBuf[Octet++]; - - /* Octet 5 - Day */ - pie->Day = IBuf[Octet++]; - - /******************************************************************* - The remaining part of the IE are optioinal, but only the length - can now tell us wherever these fields are present or not - (always remember: IESize does not include ID and Size octet) - ********************************************************************/ - pie->Format = 0; - - /* Octet 6 - Hour (optional)*/ - if (IESize >= 4) { - pie->Format = 1; - pie->Hour = IBuf[Octet++]; - - /* Octet 7 - Minute (optional)*/ - if (IESize >= 5) { - pie->Format = 2; - pie->Minute = IBuf[Octet++]; - - /* Octet 8 - Second (optional)*/ - if (IESize >= 6) { - pie->Format = 3; - pie->Second = IBuf[Octet++]; - } - } - } - - Q931IESizeTest(Q931E_DATETIME); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_DateTime); - pie->Size = sizeof(Q931ie_DateTime); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_DateTime - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_DateTime(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_DateTime *pIE = (Q931ie_DateTime*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_DATETIME; - li = (*Octet)++; - - OBuf[(*Octet)++] = pIE->Year; - OBuf[(*Octet)++] = pIE->Month; - OBuf[(*Octet)++] = pIE->Day; - if (pIE->Format >= 1) { - OBuf[(*Octet)++] = pIE->Hour; - - if (pIE->Format >= 2) { - OBuf[(*Octet)++] = pIE->Minute; - - if (pIE->Format >= 3) { - OBuf[(*Octet)++] = pIE->Second; - } - } - } - - OBuf[li] = (L3UCHAR)((*Octet)-Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_Display - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_Display(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_Display *pie = (Q931ie_Display*)OBuf; - ie *pIE = &pMsg->Display; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - L3INT x; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - IESize = IBuf[Octet++]; - - for (x = 0; xDisplay[x] = IBuf[Octet + Off] & 0x7f; - Off++; - } - - Q931IESizeTest(Q931E_DISPLAY); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_Display) + x - 1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_Display) + x - 1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_Display - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_Display(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_Display *pIE = (Q931ie_Display*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - L3INT DSize; - L3INT x; - - OBuf[(*Octet)++] = Q931ie_DISPLAY; - li = (*Octet)++; - - DSize = pIE->Size - sizeof(Q931ie_Display); - - for (x = 0; x< DSize; x++) { - - OBuf[(*Octet)++] = pIE->Display[x]; - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_HLComp - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_HLComp(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_HLComp * pie = (Q931ie_HLComp*)OBuf; - ie *pIE = &pMsg->HLComp; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet */ - IESize = IBuf[Octet++]; - - /* Octet 3*/ - pie->CodStand = (IBuf[Octet + Off] >>5) & 0x03; - pie->Interpret = (IBuf[Octet + Off] >>2) & 0x07; - pie->PresMeth = IBuf[Octet + Off] & 0x03; - Octet++; - - /* Octet 4 */ - pie->HLCharID = IBuf[Octet + Off] & 0x7f; - Octet++; - - /* Octet 4a*/ - if ((IBuf[Octet + Off - 1] & 0x80) == 0 && Q931MoreIE()) { - if (pie->HLCharID == 0x5e || pie->HLCharID == 0x5f) { - pie->EHLCharID = IBuf[Octet + Off] & 0x7f; - Off++; - } - else if ( pie->HLCharID >= 0xc3 && pie->HLCharID <= 0xcf) { - pie->EVideoTlfCharID = IBuf[Octet + Off] & 0x7f; - Off++; - } - else { - /* error Octet 4a indicated, but invalid value in Octet 4. */ - Q931SetError(pTrunk,Q931E_HLCOMP, 4, Off); - return Q931E_HLCOMP; - } - Off = Q931ReadExt(&IBuf[Octet + Off], Off); - } - - Q931IESizeTest(Q931E_HLCOMP); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_HLComp); - pie->Size = sizeof(Q931ie_HLComp); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_HLComp - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_HLComp(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_HLComp *pIE = (Q931ie_HLComp*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_HIGH_LAYER_COMPATIBILITY; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x80 | ((pIE->CodStand << 5) & 0x60) | ((pIE->Interpret << 2) & 0x1c) | (pIE->PresMeth & 0x03); - - /* Octet 4 */ - OBuf[(*Octet)++] = pIE->HLCharID; - - /* Octet 4a */ - if (pIE->HLCharID == 0x5e || pIE->HLCharID == 0x5f) { - OBuf[(*Octet)++] = 0x80 | (pIE->EHLCharID & 0x7f); - } - else if ( pIE->HLCharID >= 0xc3 && pIE->HLCharID <= 0xcf) { - OBuf[(*Octet)++] = 0x80 | (pIE->EVideoTlfCharID & 0x7f); - } - else { - OBuf[(*Octet) - 1] |= 0x80; - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_KeypadFac - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_KeypadFac(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_KeypadFac *pie = (Q931ie_KeypadFac*)OBuf; - ie *pIE = &pMsg->KeypadFac; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - L3INT x; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - IESize = IBuf[Octet++]; - - for (x = 0; xKeypadFac[x] = IBuf[Octet + Off] & 0x7f; - Off++; - } - - Q931IESizeTest(Q931E_KEYPADFAC); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_KeypadFac) + x - 1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_KeypadFac) + x - 1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_KeypadFac - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_KeypadFac(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_KeypadFac *pIE = (Q931ie_KeypadFac*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - L3INT DSize; - L3INT x; - - OBuf[(*Octet)++] = Q931ie_KEYPAD_FACILITY; - li = (*Octet)++; - - DSize = pIE->Size - sizeof(Q931ie_KeypadFac) + 1; - - for (x = 0; x< DSize; x++) { - OBuf[(*Octet)++] = pIE->KeypadFac[x]; - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_LLComp - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_LLComp(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_LLComp *pie = (Q931ie_LLComp*)OBuf; - ie *pIE = &pMsg->LLComp; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->CodStand = (IBuf[Octet + Off] >> 5) & 0x03; - pie->ITransCap = IBuf[Octet + Off] & 0x1f; - Octet++; - - /* Octet 3a*/ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->NegotInd = (IBuf[Octet + Off] >> 6) & 0x01; - Off++; - } - - /* Octet 4 */ - pie->TransMode = (IBuf[Octet + Off] >> 5) & 0x03; - pie->InfoRate = IBuf[Octet + Off] & 0x1f; - - Octet++; - - /* Octet 4.1 */ - if (pie->InfoRate == 0x14) { /* Mutirate */ - pie->RateMul = IBuf[Octet + Off] & 0x7f; - Off++; - } - - /* Octet 5 - Layer 1 Ident */ - if ((IBuf[Octet + Off] & 0x60) == 0x20) { /* Layer 1 Ident ? */ - pie->Layer1Ident = (IBuf[Octet + Off] >> 5) & 0x03; - pie->UIL1Prot = IBuf[Octet + Off] & 0x1f; - Octet++; - - /* Octet 5a */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->SyncAsync = (IBuf[Octet + Off] >> 6) & 0x01; - pie->Negot = (IBuf[Octet + Off] >> 5) & 0x01; - pie->UserRate = IBuf[Octet + Off] & 0x1f; - Off++; - - /* Octet 5b - 2 options */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - if (pie->UIL1Prot == 0x01) { /* V.110, I.460 and X.30*/ - pie->InterRate = (IBuf[Octet + Off] >> 5) & 0x03; - pie->NIConTx = (IBuf[Octet + Off] >> 4) & 0x01; - pie->NIConRx = (IBuf[Octet + Off] >> 3) & 0x01; - pie->FlowCtlTx = (IBuf[Octet + Off] >> 2) & 0x01; - pie->FlowCtlRx = (IBuf[Octet + Off] >> 1) & 0x01; - Off++; - } - else if (pie->UIL1Prot == 0x80) { /* V.120 */ - pie->HDR = (IBuf[Octet + Off] >> 6) & 0x01; - pie->MultiFrame = (IBuf[Octet + Off] >> 5) & 0x01; - pie->ModeL1 = (IBuf[Octet + Off] >> 4) & 0x01; - pie->NegotLLI = (IBuf[Octet + Off] >> 3) & 0x01; - pie->Assignor = (IBuf[Octet + Off] >> 2) & 0x01; - pie->InBandNeg = (IBuf[Octet + Off] >> 1) & 0x01; - Off++; - } - else if (pie->UIL1Prot == 0x07) { /* non standard */ - Off = Q931ReadExt(&IBuf[Octet + Off], Off); - Off++; - } - else { - Q931SetError(pTrunk,Q931E_LLCOMP, 5,2); - return Q931E_LLCOMP; - } - - /* Octet 5c */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->NumStopBits = (IBuf[Octet + Off] >> 5) & 0x03; - pie->NumDataBits = (IBuf[Octet + Off] >> 3) & 0x03; - pie->Parity = IBuf[Octet + Off] & 0x07; - Off++; - - /* Octet 5d */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->DuplexMode = (IBuf[Octet + Off] >> 6) & 0x01; - pie->ModemType = IBuf[Octet + Off] & 0x3f; - Off = Q931ReadExt(&IBuf[Octet + Off], Off); - Off++; - } - } - } - } - } - - /* Octet 6 - Layer 2 Ident */ - if ((IBuf[Octet + Off] & 0x60) == 0x40) { /* Layer 1 Ident ? */ - pie->Layer2Ident = (IBuf[Octet + Off] >>5) & 0x03; - pie->UIL2Prot = IBuf[Octet + Off] & 0x1f; - Octet++; - - /* Octet 6a */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - if (pie->UIL2Prot == 0x10) { /* 2nd 6a */ - pie->UsrSpcL2Prot = IBuf[Octet + Off] & 0x7f; - Off++; - } - else { /* assume 1st 6a */ - pie->ModeL2 = (IBuf[Octet + Off] >> 5) & 0x03; - pie->Q933use = IBuf[Octet + Off] & 0x03; - Off++; - } - /* Octet 6b */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->WindowSize = IBuf[Octet + Off] & 0x7f; - Off++; - } - } - } - - /* Octet 7 - layer 3 Ident */ - if ((IBuf[Octet + Off] & 0x60) == 0x60) { /* Layer 3 Ident ? */ - pie->Layer3Ident = (IBuf[Octet + Off] >> 5) & 0x03; - pie->UIL3Prot = IBuf[Octet + Off] & 0x1f; - Octet++; - - /* Octet 7a */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - if (pie->UIL3Prot == 0x0b) { - /* Octet 7a + 7b AddL3Info */ - pie->AddL3Info = ((IBuf[Octet + Off] << 4) & 0xf0) - | (IBuf[Octet + Off + 1] & 0x0f); - Off += 2; - } - else { - if (pie->UIL3Prot == 0x1f) { - pie->ModeL3 = (IBuf[Octet + Off] >> 5) & 0x03; - Off++; - } - else { - pie->OptL3Info = IBuf[Octet + Off] & 0x7f; - Off++; - } - - /* Octet 7b*/ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->DefPackSize = IBuf[Octet + Off] & 0x0f; - Off++; - - /* Octet 7c */ - if (IsQ931Ext(IBuf[Octet + Off - 1])) { - pie->PackWinSize= IBuf[Octet + Off] & 0x7f; - } - } - } - } - } - - Q931IESizeTest(Q931E_LLCOMP); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_LLComp); - pie->Size = sizeof(Q931ie_LLComp); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_LLComp - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_LLComp(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_LLComp *pIE = (Q931ie_LLComp*)IBuf; - L3INT rc = 0; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_LOW_LAYER_COMPATIBILITY; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = (pIE->CodStand << 6) | pIE->ITransCap; - - /* Octet 3a */ - OBuf[(*Octet)++] = 0x80 | (pIE->NegotInd << 6); - - /* Octet 4 */ - OBuf[(*Octet)++] = 0x80 | (pIE->TransMode << 5) | pIE->InfoRate; - - /* Octet 4.1 */ - if (pIE->InfoRate == 0x18) { - OBuf[(*Octet)++] = 0x80 | pIE->RateMul; - } - - /* Octet 5 */ - if (pIE->Layer1Ident == 0x01) { - OBuf[(*Octet)++] = (pIE->Layer1Ident << 5) | pIE->UIL1Prot; - - /* Octet 5a */ - if ((pIE->ITransCap == 0x08 && (pIE->UIL1Prot == 0x01 || pIE->UIL1Prot == 0x08)) - || (pIE->ITransCap == 0x10 && (pIE->UIL1Prot == 0x02 || pIE->UIL1Prot == 0x03))) { - OBuf[(*Octet)++] = (pIE->SyncAsync<<6) | (pIE->Negot<<5) | pIE->UserRate; - - /* Octet 5b*/ - if (pIE->UIL1Prot == 0x01) { - OBuf[(*Octet)++] = (pIE->InterRate << 5) - | (pIE->NIConTx << 4) - | (pIE->NIConTx << 3) - | (pIE->FlowCtlTx << 2) - | (pIE->FlowCtlRx << 1); - } - else if (pIE->UIL1Prot == 0x08) { - OBuf[(*Octet)++] = (pIE->HDR << 6) - | (pIE->MultiFrame << 5) - | (pIE->ModeL1 << 4) - | (pIE->NegotLLI << 3) - | (pIE->Assignor << 2) - | (pIE->InBandNeg << 1); - } - else { - OBuf[(*Octet) - 1] |= 0x80; - } - - /* How to detect wherever 5c and 5d is to present is not clear - * but they have been inculded as 'standard' - * Octet 5c - */ - if (pIE->UIL1Prot == 0x01 || pIE->UIL1Prot == 0x08) { - OBuf[(*Octet)++] = (pIE->NumStopBits << 5) | (pIE->NumDataBits << 3) | pIE->Parity ; - - /* Octet 5d */ - OBuf[(*Octet)++] = 0x80 | (pIE->DuplexMode << 6) | pIE->ModemType; - } - } - else { - OBuf[(*Octet) - 1] |= 0x80; - } - } - - /* Octet 6 */ - if (pIE->Layer2Ident == 0x02) { - OBuf[(*Octet)++] = (pIE->Layer2Ident << 5) | pIE->UIL2Prot; - - /* Octet 6a*/ - if (pIE->UIL2Prot == 0x02 /* Q.921/I.441 */ - || pIE->UIL2Prot == 0x06 /* X.25 link layer */ - || pIE->UIL2Prot == 0x07 /* X.25 multilink */ - || pIE->UIL2Prot == 0x09 /* HDLC ARM */ - || pIE->UIL2Prot == 0x0a /* HDLC NRM */ - || pIE->UIL2Prot == 0x0b /* HDLC ABM */ - || pIE->UIL2Prot == 0x0d /* X.75 SLP */ - || pIE->UIL2Prot == 0x0e /* Q.922 */ - || pIE->UIL2Prot == 0x11) { /* ISO/ECE 7776 DTE-DCE */ - OBuf[(*Octet)++] = (pIE->ModeL2 << 5) | pIE->Q933use; - - /* Octet 6b */ - OBuf[(*Octet)++] = 0x80 | pIE->WindowSize; - } - else if (pIE->UIL2Prot == 0x10) { /* User Specific */ - OBuf[(*Octet)++] = 0x80 | pIE->UsrSpcL2Prot; - } - else { - OBuf[(*Octet) - 1] |= 0x80; - } - } - - /* Octet 7 */ - if (pIE->Layer3Ident == 0x03) { - OBuf[(*Octet)++] = (pIE->Layer3Ident << 5) | pIE->UIL3Prot; - - /* Octet 7a - 3 different ones */ - if (pIE->UIL3Prot == 0x10) { - OBuf[(*Octet++)] = 0x80 | pIE->OptL3Info; - } - else if (pIE->UIL3Prot == 0x06 - || pIE->UIL3Prot == 0x07 - || pIE->UIL3Prot == 0x08) { - OBuf[(*Octet)++] = pIE->ModeL3 << 5; - - /* Octet 7b note 7 */ - OBuf[(*Octet)++] = pIE->DefPackSize; - - /* Octet 7c note 7 */ - OBuf[(*Octet)++] = 0x80 | pIE->PackWinSize; - } - else if (pIE->UIL3Prot == 0x0b) { - OBuf[(*Octet)++] = (pIE->AddL3Info >> 4) & 0x0f; - OBuf[(*Octet)++] = 0x80 | (pIE->AddL3Info & 0x0f); - } - else { - OBuf[(*Octet) - 1] |= 0x80; - } - } - else { - Q931SetError(pTrunk,Q931E_LLCOMP, 7,0); - rc = Q931E_LLCOMP; - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_NetFac - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_NetFac(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_NetFac *pie = (Q931ie_NetFac*)OBuf; - ie *pIE = &pMsg->NetFac; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - pie->LenNetID = IBuf[Octet + Off]; /* full octet is used */ - Octet++; - - if (pie->LenNetID > 0) { - /* Octet 3.1 */ - pie->TypeNetID = (IBuf[Octet + Off] >> 4) & 0x0f; - pie->NetIDPlan = IBuf[Octet + Off] & 0x0f; - Off = Q931ReadExt(&IBuf[Octet], Off); - Off++; - - /* Octet 3.2*/ - for (x = 0; x < pie->LenNetID; x++) { - pie->NetID[x] = IBuf[Octet + Off] & 0x7f; - Off++; - } - } - - /* Octet 4*/ - pie->NetFac = IBuf[Octet + Off]; /* Full Octet is used */ - Octet++; - - Q931IESizeTest(Q931E_NETFAC); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_NetFac) + x - 1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_NetFac) + x - 1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_NetFac - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_NetFac(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_NetFac *pIE = (Q931ie_NetFac*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - L3INT x; - - OBuf[(*Octet)++] = Q931ie_NETWORK_SPECIFIC_FACILITIES; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = pIE->LenNetID; - - if (pIE->LenNetID > 0) { - /* Octet 3.1 */ - OBuf[(*Octet)++] = 0x80 | (pIE->TypeNetID << 4) | pIE->NetIDPlan; - - /* Octet 3.2 */ - for (x = 0; x LenNetID; x++) { - OBuf[(*Octet)++] = pIE->NetID[x]; - } - } - - /* Octet 4 */ - OBuf[(*Octet)++] = pIE->NetFac; - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_NotifInd - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_NotifInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_NotifInd *pie = (Q931ie_NotifInd*)OBuf; - ie *pIE = &pMsg->NotifInd; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2*/ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->Notification = IBuf[Octet + Off] & 0x7f; - - Off = Q931ReadExt(&IBuf[Octet], Off); - Octet++; - - Q931IESizeTest(Q931E_NOTIFIND); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_NotifInd); - pie->Size = sizeof(Q931ie_NotifInd); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_NotifInd - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_NotifInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_NotifInd *pIE = (Q931ie_NotifInd*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_NOTIFICATION_INDICATOR; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = pIE->Notification; - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_ProgInd - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_ProgInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_ProgInd *pie = (Q931ie_ProgInd*)OBuf; - ie *pIE = &pMsg->ProgInd; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->CodStand = (IBuf[Octet + Off] >> 5) & 0x03; - pie->Location = IBuf[Octet + Off] & 0x0f; - - Off = Q931ReadExt(&IBuf[Octet], Off); - Octet++; - - /* Octet 4 */ - pie->ProgDesc = IBuf[Octet + Off] & 0x7f; - Off = Q931ReadExt(&IBuf[Octet], Off); - Octet++; - - Q931IESizeTest(Q931E_PROGIND); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_ProgInd); - pie->Size = sizeof(Q931ie_ProgInd); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_ProgInd - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset L3INTo OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_ProgInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_ProgInd *pIE = (Q931ie_ProgInd*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_PROGRESS_INDICATOR; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x80 | (pIE->CodStand << 5) | pIE->Location; - - /* Octet 4 */ - OBuf[(*Octet)++] = 0x80 | pIE->ProgDesc; - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_RepeatInd - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_RepeatInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_RepeatInd *pie = (Q931ie_RepeatInd*)OBuf; - ie *pIE = &pMsg->RepeatInd; - L3INT Off = 0; - L3INT Octet = 0; - - *pIE = 0; - - pie->IEId = IBuf[Octet] & 0xf0; - pie->RepeatInd = IBuf[Octet] & 0x0f; - Octet ++; - - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_RepeatInd); - pie->Size = sizeof(Q931ie_RepeatInd); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_RepeatInd - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_RepeatInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_RepeatInd *pIE = (Q931ie_RepeatInd*)IBuf; - L3INT rc = 0; - /* L3INT Beg = *Octet; */ - - OBuf[(*Octet)++] = Q931ie_REPEAT_INDICATOR | pIE->RepeatInd; - - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_RevChargeInd - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - ie iE; - /* ie *pIE = &pMsg->RevChargeInd; */ - Q931SetIE(iE, *OOff); - - return iE; -} - -/***************************************************************************** - - Function: Q931Pie_RevChargeInd - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q931Uie_RestartInd - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_RestartInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_RestartInd *pie = (Q931ie_RestartInd*)OBuf; - ie *pIE = &pMsg->RestartInd; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->Class = IBuf[Octet + Off] & 0x07; - pie->Spare = IBuf[Octet + Off] & 0x78; - - Off = Q931ReadExt(&IBuf[Octet], Off); - Octet++; - - Q931IESizeTest(Q931E_RESTARTIND); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_RestartInd); - pie->Size = sizeof(Q931ie_RestartInd); - - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_RestartInd - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_RestartInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_RestartInd *pIE = (Q931ie_RestartInd*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_RESTART_INDICATOR; - li = (*Octet)++; - - /* Octet 3*/ - OBuf[(*Octet)++] = 0x80 | pIE->Class ; - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_Segment - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_Segment(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_Segment *pie = (Q931ie_Segment*)OBuf; - ie *pIE = &pMsg->Segment; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - Octet++; - - /* Octet 2*/ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->FSI = (IBuf[Octet + Off] & 0x80) >> 7; - pie->NumSegRem = IBuf[Octet + Off] & 0x7f; - Octet++; - - /* Octet 4 */ - pie->SegType = IBuf[Octet + Off] & 0x7f; - Octet++; - - Q931IESizeTest(Q931E_SEGMENT); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_Segment); - pie->Size = sizeof(Q931ie_Segment); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_Segment - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_Segment(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_Segment *pIE = (Q931ie_Segment*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_SEGMENTED_MESSAGE; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = (pIE->FSI << 7) | pIE->NumSegRem; - - /* Octet 4 */ - OBuf[(*Octet)++] = pIE->SegType; - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_SendComplete - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_SendComplete(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_SendComplete *pie = (Q931ie_SendComplete*)OBuf; - ie *pIE = &pMsg->SendComplete; - L3INT Off = 0; - L3INT Octet = 0; - - *pIE = 0; - Octet++; - - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_SendComplete); - pie->Size = sizeof(Q931ie_SendComplete); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_ProgInd - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_SendComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - /* Q931ie_SendComplete * pIE = (Q931ie_SendComplete*)IBuf; */ - L3INT rc = Q931E_NO_ERROR; - /* L3INT Beg = *Octet; */ - - OBuf[(*Octet)++] = 0x80 | (L3UCHAR)Q931ie_SENDING_COMPLETE; - - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_Signal - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_Signal(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_Signal *pie = (Q931ie_Signal*)OBuf; - ie *pIE = &pMsg->Signal; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->Signal = IBuf[Octet + Off]; - Octet++; - - Q931IESizeTest(Q931E_SIGNAL); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_Signal); - pie->Size = sizeof(Q931ie_Signal); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_Signal - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_Signal(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_Signal *pIE = (Q931ie_Signal*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_SIGNAL; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = pIE->Signal; - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_TransNetSel - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_TransNetSel(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_TransNetSel *pie = (Q931ie_TransNetSel*)OBuf; - ie *pIE = &pMsg->TransNetSel; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x = 0; - L3INT l; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - l = IBuf[Octet++] - 3; - - /* Octet 3 */ - pie->Type = (IBuf[Octet + Off] >> 4) & 0x07; - - Off = Q931ReadExt(&IBuf[Octet], Off); - Octet++; - - for (x = 0; x < l; x++) { - pie->NetID[x] = IBuf[Octet + Off] & 0x7f; - Off++; - } - - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_TransNetSel) + x - 1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_TransNetSel) + x - 1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_TransNetSel - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_TransNetSel(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_TransNetSel *pIE = (Q931ie_TransNetSel*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - L3INT x; - L3INT l; - - OBuf[(*Octet)++] = Q931ie_TRANSIT_NETWORK_SELECTION; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x80 | (pIE->Type << 4) | pIE->NetIDPlan; - - /* Octet 4 */ - l = pIE->Size - sizeof(Q931ie_TransNetSel) + 1; - for (x = 0; x < l; x++) { - OBuf[(*Octet)++] = pIE->NetID[x]; - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_UserUser - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_UserUser(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_UserUser *pie = (Q931ie_UserUser*)OBuf; - ie *pIE = &pMsg->UserUser; - L3INT Off = 0; - L3INT Octet = 0; - L3INT l; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - l = IBuf[Octet++] - 1; - - /* Octet 3 */ - pie->ProtDisc = IBuf[Octet++]; - - for (Off = 0; Off < l; Off++) { - pie->User[Off] = IBuf[Octet + Off]; - } - - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_UserUser) + Off - 1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_UserUser) + Off - 1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_UserUser - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_UserUser(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_UserUser *pIE = (Q931ie_UserUser*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - L3INT x; - L3INT l; - - OBuf[(*Octet)++] = Q931ie_USER_USER; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = pIE->ProtDisc; - - /* Octet 4 */ - l = pIE->Size - sizeof(Q931ie_UserUser) + 1; - for (x = 0; x < l; x++) { - OBuf[(*Octet)++] = pIE->User[x]; - } - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - -/***************************************************************************** - - Function: Q931Uie_GenericDigits - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_GenericDigits(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_GenericDigits *pie = (Q931ie_GenericDigits*)OBuf; - ie *pIE = &pMsg->GenericDigits; - L3INT Off = 0; - L3INT Octet = 0; - L3INT x; - L3INT IESize; - - *pIE = 0; - - /* Octet 1 */ - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->Type = (IBuf[Octet]) & 0x1F; - pie->Encoding = (IBuf[Octet] >> 5) & 0x07; - Octet++; - - /* Octet 4*/ - if (pie->Encoding == 0) { /* BCD Even */ - x = 0; - do { - pie->Digit[x++] = IBuf[Octet + Off] & 0x0f; - pie->Digit[x++] = (IBuf[Octet + Off] >> 4) & 0x0f; - Off++; - } while (Q931MoreIE()); - } else if (pie->Encoding == 1) { /* BCD Odd */ - x = 0; - do { - pie->Digit[x++] = IBuf[Octet + Off] & 0x0f; - if (Q931MoreIE()) { - pie->Digit[x] = (IBuf[Octet + Off] >> 4) & 0x0f; - } - x++; - Off++; - } while (Q931MoreIE()); - } else if (pie->Encoding == 2) { /* IA5 */ - x = 0; - do { - pie->Digit[x++] = IBuf[Octet + Off] & 0x7f; - Off++; - } while (Q931MoreIE()); - } else { - /* Binary encoding type unkown */ - Q931SetError(pTrunk, Q931E_GENERIC_DIGITS, Octet, Off); - return Q931E_GENERIC_DIGITS; - } - - Q931IESizeTest(Q931E_GENERIC_DIGITS); - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_CallingSub) + x - 1; - pie->Size = (L3UCHAR)(sizeof(Q931ie_CallingSub) + x - 1); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_GenericDigits - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ - -L3INT Q931Pie_GenericDigits(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - OBuf[(*Octet)++] = (Q931ie_GENERIC_DIGITS & 0xFF); - OBuf[(*Octet)++] = 0; - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Uie_ChangeStatus - - Parameters: pIE[OUT] ptr to Information Element id. - IBuf[IN] ptr to a packed ie. - OBuf[OUT] ptr to buffer for Unpacked ie. - IOff[IN\OUT] Input buffer offset - OOff[IN\OUT] Output buffer offset - - Ibuf and OBuf points directly to buffers. The IOff and OOff - must be updated, but are otherwise not used in the ie unpack. - - Return Value: Error Message - -*****************************************************************************/ -L3INT Q931Uie_ChangeStatus(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff) -{ - Q931ie_ChangeStatus *pie = (Q931ie_ChangeStatus*)OBuf; - ie *pIE = &pMsg->ChangeStatus; - L3INT Off = 0; - L3INT Octet = 0; - L3INT IESize; - - *pIE = 0; - - pie->IEId = IBuf[Octet++]; - - /* Octet 2 */ - IESize = IBuf[Octet++]; - - /* Octet 3 */ - pie->Preference = (IBuf[Octet + Off] >> 6) & 0x01; - pie->Spare = IBuf[Octet + Off] & 0x38; - pie->NewStatus = IBuf[Octet + Off] & 0x07; - Octet++; - - Q931SetIE(*pIE, *OOff); - - *IOff = (*IOff) + Octet + Off; - *OOff = (*OOff) + sizeof(Q931ie_ChangeStatus); - pie->Size = sizeof(Q931ie_ChangeStatus); - - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pie_ChangeStatus - - Parameters: IBuf[IN] Ptr to struct. - OBuf[OUT] Ptr tp packed output buffer. - Octet[IN/OUT] Offset into OBuf. - - Return Value: Error code, 0 = OK - -*****************************************************************************/ -L3INT Q931Pie_ChangeStatus(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - Q931ie_ChangeStatus *pIE = (Q931ie_ChangeStatus*)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Beg = *Octet; - L3INT li; - - OBuf[(*Octet)++] = Q931ie_CHANGE_STATUS; - li = (*Octet)++; - - /* Octet 3 */ - OBuf[(*Octet)++] = 0x80 | pIE->NewStatus | ((pIE->Preference & 0x01) << 6); - - OBuf[li] = (L3UCHAR)((*Octet) - Beg) - 2; - return rc; -} - - - -L3INT Q931Uie_Generic(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff) -{ - L3INT Octet = 0; - L3UCHAR id = 0; - - /* id */ - id = IBuf[Octet++]; - - /* Length */ - Octet += IBuf[Octet]; - Octet++; - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Discarding IE %#hhx with length %d\n", id, Octet - 2); - - *IOff += Octet; - return Q931E_NO_ERROR; -} - -L3INT Q931Pie_Generic(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet) -{ - /* do nothing */ - return Q931E_NO_ERROR; -} diff --git a/libs/freetdm/src/isdn/Q931mes.c b/libs/freetdm/src/isdn/Q931mes.c deleted file mode 100644 index 8e34a170e1..0000000000 --- a/libs/freetdm/src/isdn/Q931mes.c +++ /dev/null @@ -1,1870 +0,0 @@ -/***************************************************************************** - - FileName: Q931mes.c - - Contents: Pack/Unpack functions. These functions will unpack a Q931 - message from the bit packed original format into structs - that contains variables sized by the user. It will also pack - the struct back into a Q.931 message as required. - - See q931.h for description. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -*****************************************************************************/ - -#include "Q931.h" - -/** - * Q931MesgHeader - * \brief Create Q.931 Message header - */ -L3INT Q931MesgHeader(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *mes, L3UCHAR *OBuf, L3INT Size, L3INT *IOff) -{ - L3INT Octet = *IOff; - - Q931Log(pTrunk, Q931_LOG_DEBUG, "Creating Q.931 Message Header:\n ProtDisc %d (%#x), CRV %d (%#x), CRVflag: %d (%#x), MesType: %d (%#x)\n", - mes->ProtDisc, mes->ProtDisc, mes->CRV, mes->CRV, mes->CRVFlag, mes->CRVFlag, mes->MesType, mes->MesType); - - OBuf[Octet++] = mes->ProtDisc; /* Protocol discriminator */ - if (!Q931_IS_BRI(pTrunk)) { - OBuf[Octet++] = 2; /* length is 2 octets */ - OBuf[Octet++] = (L3UCHAR)((mes->CRV >> 8) & 0x7f) | ((mes->CRVFlag << 7) & 0x80); /* msb */ - OBuf[Octet++] = (L3UCHAR) (mes->CRV & 0xff); /* lsb */ - } else { - OBuf[Octet++] = 1; /* length is 1 octet */ - OBuf[Octet++] = (L3UCHAR) (mes->CRV & 0x7f) | ((mes->CRVFlag << 7) & 0x80); /* CRV & flag */ - } - OBuf[Octet++] = mes->MesType; /* message header */ - - *IOff = Octet; - return 0; -} - - -/***************************************************************************** - - Function: Q931Umes_Alerting - -*****************************************************************************/ - -L3INT Q931Umes_Alerting(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_BEARER_CAPABILITY: - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_DISPLAY: - case Q931ie_SIGNAL: - case Q931ie_HIGH_LAYER_COMPATIBILITY: - case Q931ie_USER_USER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Alerting - -*****************************************************************************/ -L3INT Q931Pmes_Alerting(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* High Layer Compatibility */ - if (Q931IsIEPresent(pMes->HLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_CallProceeding - -*****************************************************************************/ -L3INT Q931Umes_CallProceeding(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_BEARER_CAPABILITY: - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_DISPLAY: - case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_CallProceeding - -*****************************************************************************/ -L3INT Q931Pmes_CallProceeding(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* High Layer Compatibility */ - if (Q931IsIEPresent(pMes->HLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_CongestionControl - -*****************************************************************************/ -L3INT Q931Umes_CongestionControl(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(mes); - NoWarning(IBuf); - - return RetCode; -} - - -/***************************************************************************** - - Function: Q931Pmes_CongestionControl - -*****************************************************************************/ -L3INT Q931Pmes_CongestionControl(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - *OSize = 0; - return RetCode; -} - -/***************************************************************************** - - Function: Q931Umes_Connect - -*****************************************************************************/ -L3INT Q931Umes_Connect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_BEARER_CAPABILITY: - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_DISPLAY: - case Q931ie_DATETIME: - case Q931ie_SIGNAL: - case Q931ie_LOW_LAYER_COMPATIBILITY: - case Q931ie_HIGH_LAYER_COMPATIBILITY: - case Q931ie_CONNECTED_NUMBER: /* not actually used, seen while testing BRI PTMP TE */ - case Q931ie_USER_USER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - - default: - Q931Log(pTrunk, Q931_LOG_ERROR, "Illegal IE %#hhx in Connect Message\n", IBuf[IOff]); - - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Connect - -*****************************************************************************/ -L3INT Q931Pmes_Connect(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Date/Time */ - if (Q931IsIEPresent(pMes->DateTime)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DATETIME](pTrunk, Q931GetIEPtr(pMes->DateTime,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Low Layer Compatibility */ - if (Q931IsIEPresent(pMes->LLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_LOW_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->LLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* High Layer Compatibility */ - if (Q931IsIEPresent(pMes->HLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_ConnectAck - -*****************************************************************************/ -L3INT Q931Umes_ConnectAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_DISPLAY: - case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - - -/***************************************************************************** - - Function: Q931Pmes_ConnectAck - -*****************************************************************************/ -L3INT Q931Pmes_ConnectAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Disconnect - -*****************************************************************************/ -L3INT Q931Umes_Disconnect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CAUSE: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_DISPLAY: - case Q931ie_SIGNAL: - case Q931ie_FACILITY: - case Q931ie_USER_USER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Disconnect - -*****************************************************************************/ -L3INT Q931Pmes_Disconnect(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Cause */ - if (Q931IsIEPresent(pMes->Cause)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CAUSE](pTrunk, Q931GetIEPtr(pMes->Cause,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Information - -*****************************************************************************/ -L3INT Q931Umes_Information(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_SENDING_COMPLETE: - case Q931ie_DISPLAY: - case Q931ie_KEYPAD_FACILITY: - case Q931ie_CALLED_PARTY_NUMBER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Information - -*****************************************************************************/ -L3INT Q931Pmes_Information(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Sending Complete */ - if (Q931IsIEPresent(pMes->SendComplete)) { - OBuf[Octet++] = (L3UCHAR)(pMes->SendComplete & 0x00ff); - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Keypad Facility */ - if (Q931IsIEPresent(pMes->KeypadFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_KEYPAD_FACILITY](pTrunk, Q931GetIEPtr(pMes->KeypadFac,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Called Party number */ - if (Q931IsIEPresent(pMes->CalledNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CalledNum,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Notify - -*****************************************************************************/ -L3INT Q931Umes_Notify(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_BEARER_CAPABILITY: - case Q931ie_NOTIFICATION_INDICATOR: - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Notify - -*****************************************************************************/ -L3INT Q931Pmes_Notify(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Progress - -*****************************************************************************/ -L3INT Q931Umes_Progress(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_BEARER_CAPABILITY: - case Q931ie_CAUSE: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_DISPLAY: - case Q931ie_HIGH_LAYER_COMPATIBILITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Progress - -*****************************************************************************/ -L3INT Q931Pmes_Progress(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Cause */ - if (Q931IsIEPresent(pMes->Cause)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CAUSE](pTrunk, Q931GetIEPtr(pMes->Cause,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* High Layer Compatibility */ - if (Q931IsIEPresent(pMes->HLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Release - -*****************************************************************************/ -L3INT Q931Umes_Release(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CAUSE: - case Q931ie_DISPLAY: - case Q931ie_SIGNAL: - case Q931ie_USER_USER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Release - -*****************************************************************************/ -L3INT Q931Pmes_Release(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Cause */ - if (Q931IsIEPresent(pMes->Cause)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CAUSE](pTrunk, Q931GetIEPtr(pMes->Cause,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_ReleaseComplete - -*****************************************************************************/ -L3INT Q931Umes_ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CAUSE: - case Q931ie_DISPLAY: - case Q931ie_SIGNAL: - case Q931ie_USER_USER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_ReleaseComplete - -*****************************************************************************/ -L3INT Q931Pmes_ReleaseComplete(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Cause */ - if (Q931IsIEPresent(pMes->Cause)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CAUSE](pTrunk, Q931GetIEPtr(pMes->Cause,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Restart - -*****************************************************************************/ -L3INT Q931Umes_Restart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_DISPLAY: - case Q931ie_RESTART_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Restart - -*****************************************************************************/ -L3INT Q931Pmes_Restart(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* ChanID */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* RestartInd */ - if (Q931IsIEPresent(pMes->RestartInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_RESTART_INDICATOR](pTrunk, Q931GetIEPtr(pMes->RestartInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_RestartAck - -*****************************************************************************/ -L3INT Q931Umes_RestartAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size) -{ - Q931mes_Generic *mes = (Q931mes_Generic*)OBuf; - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_DISPLAY: - case Q931ie_RESTART_INDICATOR: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_RestartAck - -*****************************************************************************/ -L3INT Q931Pmes_RestartAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* ChanID */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* RestartInd */ - if (Q931IsIEPresent(pMes->RestartInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_RESTART_INDICATOR](pTrunk, Q931GetIEPtr(pMes->RestartInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Resume - -*****************************************************************************/ -L3INT Q931Umes_Resume(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CALL_IDENTITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Resume - -*****************************************************************************/ -L3INT Q931Pmes_Resume(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Call Identity */ - if (Q931IsIEPresent(pMes->CallID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALL_IDENTITY](pTrunk, Q931GetIEPtr(pMes->CallID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_ResumeAck - -*****************************************************************************/ -L3INT Q931Umes_ResumeAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - - -/***************************************************************************** - - Function: Q931Pmes_ResumeAck - -*****************************************************************************/ -L3INT Q931Pmes_ResumeAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_ResumeReject - -*****************************************************************************/ -L3INT Q931Umes_ResumeReject(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CAUSE: - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - - -/***************************************************************************** - - Function: Q931Pmes_ResumeReject - -*****************************************************************************/ -L3INT Q931Pmes_ResumeReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Cause */ - if (Q931IsIEPresent(pMes->Cause)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CAUSE](pTrunk, Q931GetIEPtr(pMes->Cause,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -L3INT Q931Umes_Segment(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT OOff) -{ - L3INT i = IOff; - - return IOff - i; -} - -L3INT Q931Pmes_Segment(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - *OSize = 0; - return RetCode; -} - -/***************************************************************************** - - Function: Q931Umes_Setup - -*****************************************************************************/ -L3INT Q931Umes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT ir = 0; - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_SENDING_COMPLETE: - IOff++; - break; - - case Q931ie_BEARER_CAPABILITY: - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_NETWORK_SPECIFIC_FACILITIES: - case Q931ie_DISPLAY: - case Q931ie_DATETIME: - case Q931ie_KEYPAD_FACILITY: - case Q931ie_SIGNAL: - case Q931ie_CALLING_PARTY_NUMBER: - case Q931ie_CALLING_PARTY_SUBADDRESS: - case Q931ie_CALLED_PARTY_NUMBER: - case Q931ie_CALLED_PARTY_SUBADDRESS: - case Q931ie_TRANSIT_NETWORK_SELECTION: - case Q931ie_LOW_LAYER_COMPATIBILITY: - case Q931ie_HIGH_LAYER_COMPATIBILITY: - case Q931ie_FACILITY: - case Q931ie_USER_USER: - case Q931ie_REDIRECTING_NUMBER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - - case Q931ie_REPEAT_INDICATOR: - if (ir < 2) { - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - ir++; - } else { - return Q931E_ILLEGAL_IE; - } - break; - - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Setup - - Decription: Pack a Q931mes_Generic into a real Q.931 message. The user will - set up a SETUP message and issue this to the stack where it - is processed by Q931ProcSetup that processes and validates - it before it actually sends it out. This function is called - to compute the real Q.931 message. - - Parameters: IBuf[IN] Ptr to un-packed struct - ISize[IN] Size of input buffer (unpacked message). - OBuf[OUT] Ptr to packed 'octet' wise message. - OSize[OUT] Size of packed message. - - Called By: Q931ProcSetup - -*****************************************************************************/ -L3INT Q931Pmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Sending Complete */ - if (Q931IsIEPresent(pMes->SendComplete)) { - OBuf[Octet++] = (L3UCHAR)Q931ie_SENDING_COMPLETE & 0xff; - } - - /* Repeat Indicator */ - if (Q931IsIEPresent(pMes->RepeatInd)) { - OBuf[Octet++] = (L3UCHAR)Q931ie_REPEAT_INDICATOR & 0xff; - } - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } else { - rc = Q931E_BEARERCAP; - } - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Network spesific facilities */ - if (Q931IsIEPresent(pMes->NetFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_NETWORK_SPECIFIC_FACILITIES](pTrunk, Q931GetIEPtr(pMes->NetFac,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Date/Time */ - if (Q931IsIEPresent(pMes->DateTime)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DATETIME](pTrunk, Q931GetIEPtr(pMes->DateTime,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Keypad Facility */ - if (Q931IsIEPresent(pMes->KeypadFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_KEYPAD_FACILITY](pTrunk, Q931GetIEPtr(pMes->KeypadFac,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Calling Party Number */ - if (Q931IsIEPresent(pMes->CallingNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CallingNum,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Calling Party Subaddress */ - if (Q931IsIEPresent(pMes->CallingSub)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CallingSub,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Called Party number */ - if (Q931IsIEPresent(pMes->CalledNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CalledNum,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Called party subaddress */ - if (Q931IsIEPresent(pMes->CalledSub)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CalledSub,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Transit network selection */ - if (Q931IsIEPresent(pMes->TransNetSel)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_TRANSIT_NETWORK_SELECTION](pTrunk, Q931GetIEPtr(pMes->TransNetSel,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Repeat Indicator */ - if (Q931IsIEPresent(pMes->LLRepeatInd)) { - rc = Q931E_UNKNOWN_IE;/* TODO */ - } - - /* Low Layer Compatibility */ - if (Q931IsIEPresent(pMes->LLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_LOW_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->LLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* High Layer Compatibility */ - if (Q931IsIEPresent(pMes->HLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_SetupAck - -*****************************************************************************/ -L3INT Q931Umes_SetupAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_DISPLAY: - case Q931ie_SIGNAL: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_SetupAck - -*****************************************************************************/ -L3INT Q931Pmes_SetupAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Status - -*****************************************************************************/ -L3INT Q931Umes_Status(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CAUSE: - case Q931ie_CALL_STATE: - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - - -/***************************************************************************** - - Function: Q931Pmes_Status - -*****************************************************************************/ -L3INT Q931Pmes_Status(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Cause */ - if (Q931IsIEPresent(pMes->Cause)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CAUSE](pTrunk, Q931GetIEPtr(pMes->Cause,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Call State */ - if (Q931IsIEPresent(pMes->CallState)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALL_STATE](pTrunk, Q931GetIEPtr(pMes->CallState,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_StatusEnquiry - -*****************************************************************************/ -L3INT Q931Umes_StatusEnquiry(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_StatusEnquiry - -*****************************************************************************/ -L3INT Q931Pmes_StatusEnquiry(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_Suspend - -*****************************************************************************/ -L3INT Q931Umes_Suspend(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CALL_IDENTITY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Suspend - -*****************************************************************************/ -L3INT Q931Pmes_Suspend(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Call Identity */ - if (Q931IsIEPresent(pMes->CallID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALL_IDENTITY](pTrunk, Q931GetIEPtr(pMes->CallID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_SuspendAck - -*****************************************************************************/ -L3INT Q931Umes_SuspendAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_SuspendAck - -*****************************************************************************/ -L3INT Q931Pmes_SuspendAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_SuspendReject - -*****************************************************************************/ -L3INT Q931Umes_SuspendReject(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CAUSE: - case Q931ie_DISPLAY: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_SuspendReject - -*****************************************************************************/ -L3INT Q931Pmes_SuspendReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Cause */ - if (Q931IsIEPresent(pMes->Cause)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CAUSE](pTrunk, Q931GetIEPtr(pMes->Cause,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_UserInformation - -*****************************************************************************/ -L3INT Q931Umes_UserInformation(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT I, L3INT O) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(mes); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q931Pmes_UserInformation - -*****************************************************************************/ -L3INT Q931Pmes_UserInformation(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - *OSize = 0; - - return RetCode; -} - -/***************************************************************************** - - Function: Q931Umes_Service - -*****************************************************************************/ -L3INT Q931Umes_Service(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CHANGE_STATUS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Service - -*****************************************************************************/ -L3INT Q931Pmes_Service(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Display */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - if (Q931IsIEPresent(pMes->ChangeStatus)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANGE_STATUS](pTrunk, Q931GetIEPtr(pMes->ChangeStatus,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} - -/***************************************************************************** - - Function: Q931Umes_ServiceAck - -*****************************************************************************/ -L3INT Q931Umes_ServiceAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - - while (IOff < Size) { - switch (IBuf[IOff]) { - case Q931ie_CHANNEL_IDENTIFICATION: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_CHANGE_STATUS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_ServiceAck - -*****************************************************************************/ -L3INT Q931Pmes_ServiceAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT rc = Q931E_NO_ERROR; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - if (Q931IsIEPresent(pMes->ChangeStatus)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANGE_STATUS](pTrunk, Q931GetIEPtr(pMes->ChangeStatus,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} diff --git a/libs/freetdm/src/isdn/Q932mes.c b/libs/freetdm/src/isdn/Q932mes.c deleted file mode 100644 index 574499a241..0000000000 --- a/libs/freetdm/src/isdn/Q932mes.c +++ /dev/null @@ -1,286 +0,0 @@ -/***************************************************************************** - - FileName: Q932mes.c - - Contents: Q.932 Message Encoders/Decoders - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "Q931.h" - -/***************************************************************************** - - Function: Q932Umes_Facility - -*****************************************************************************/ - -L3INT Q932Umes_Facility(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - - /* TODO */ - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Facility - -*****************************************************************************/ -L3INT Q932Pmes_Facility(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q932Umes_Hold - -*****************************************************************************/ - -L3INT Q932Umes_Hold(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - - /* TODO */ - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Hold - -*****************************************************************************/ -L3INT Q932Pmes_Hold(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q932Umes_HoldAck - -*****************************************************************************/ - -L3INT Q932Umes_HoldAck(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - - /* TODO */ - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_HoldAck - -*****************************************************************************/ -L3INT Q932Pmes_HoldAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q932Umes_HoldReject - -*****************************************************************************/ - -L3INT Q932Umes_HoldReject(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - - /* TODO */ - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_HoldReject - -*****************************************************************************/ -L3INT Q932Pmes_HoldReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q932Umes_Register - -*****************************************************************************/ - -L3INT Q932Umes_Register(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - - /* TODO */ - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Register - -*****************************************************************************/ -L3INT Q932Pmes_Register(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q932Umes_Retrieve - -*****************************************************************************/ - -L3INT Q932Umes_Retrieve(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - - /* TODO */ - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_Retrieve - -*****************************************************************************/ -L3INT Q932Pmes_Retrieve(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q932Umes_RetrieveAck - -*****************************************************************************/ - -L3INT Q932Umes_RetrieveAck(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - - /* TODO */ - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_RetrieveAck - -*****************************************************************************/ -L3INT Q932Pmes_RetrieveAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} - -/***************************************************************************** - - Function: Q932Umes_RetrieveReject - -*****************************************************************************/ - -L3INT Q932Umes_RetrieveReject(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT OOff = 0; - - /* TODO */ - - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: Q931Pmes_RetrieveReject - -*****************************************************************************/ -L3INT Q932Pmes_RetrieveReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3BOOL RetCode = L3FALSE; - - NoWarning(OBuf); - NoWarning(IBuf); - - return RetCode; -} diff --git a/libs/freetdm/src/isdn/include/5ESS.h b/libs/freetdm/src/isdn/include/5ESS.h deleted file mode 100644 index 882b257395..0000000000 --- a/libs/freetdm/src/isdn/include/5ESS.h +++ /dev/null @@ -1,103 +0,0 @@ -/****************************************************************************** - - FileName: 5ESS.h - - Contents: Header and definition for the AT&T 5ESS ISDN dialect. The - header contains the following parts: - - - Definition of codes - - Definition of information elements (5ESSie_). - - Definition of messages (5ESSmes_). - - Function prototypes. - - Description: The AT&T 5ESS ISDN dialect here covers ???? - - Related Files: 5ESS.h AT&T 5ESS ISDN Definitions - 5ESSie.c AT&T 5ESS ISDN IE encoders/coders (not extant yet) - See Q931ie.c for IE encoders/coders - 5ESSStateTE.c AT&T 5ESS ISDN TE State Engine - 5ESSStateNT.c AT&T 5ESS ISDN NT State Engine - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Copyright (c) 2007, Michael S. Collins, All rights reserved. - email:mcollins@fcnetwork.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -******************************************************************************/ - -#ifndef _5ESS_NL -#define _5ESS_NL - -#include "Q931.h" - -/***************************************************************************** - - Q.931 Message codes - Only 5ESS specific message and ie types - here the rest are inherited from Q931.h - -*****************************************************************************/ - - -/***************************************************************************** - - Q.931 Message Pack/Unpack functions. Implemented in 5ESSmes.c - Note: Because C variables may not begin with numeric digit, all identifiers - are prefixed with "ATT5ESS" instead of a bare "5ESS" - -*****************************************************************************/ -L3INT ATT5ESSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); -L3INT ATT5ESSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT ATT5ESSUmes_SetupAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); -L3INT ATT5ESSPmes_SetupAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); - -L3INT ATT5ESSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size); -L3INT ATT5ESSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT ATT5ESSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size); -L3INT ATT5ESSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); - - - -/***************************************************************************** - - Q.931 Process Function Prototyping. Implemented in 5ESSStateTE.c - -*****************************************************************************/ -L3INT ATT5ESSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom); -L3INT ATT5ESSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom); - - -void ATT5ESSCreateTE(L3UCHAR i); -void ATT5ESSCreateNT(L3UCHAR i); - -#endif /* _5ESS_NL */ diff --git a/libs/freetdm/src/isdn/include/DMS.h b/libs/freetdm/src/isdn/include/DMS.h deleted file mode 100644 index 605a61aa6e..0000000000 --- a/libs/freetdm/src/isdn/include/DMS.h +++ /dev/null @@ -1,91 +0,0 @@ -/****************************************************************************** - - FileName: national.h - - Contents: Header and definition for the National ISDN dialect. The - header contents the following parts: - - Definition of codes - - Definition of information elements (nationalie_). - - Definition of messages (nationalmes_). - - Function prototypes. - - Description: The National ISDN dialect here covers ???? - - Related Files: national.h National ISDN Definitions - nationalie.c National ISDN IE encoders/coders - nationalStateTE.c National ISDN TE State Engine - nationalStateNT.c National ISDN NT State Engine - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -******************************************************************************/ - -#ifndef _DMS_NL -#define _DMS_NL - -#include "Q931.h" - -/***************************************************************************** - - Q.931 Message codes - Only National specific message and ie types - here the rest are inherited from national.h - -*****************************************************************************/ - - -/***************************************************************************** - - Q.931 Message Pack/Unpack functions. Implemented in nationalmes.c - -*****************************************************************************/ -L3INT DMSUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); -L3INT DMSPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT DMSUmes_0x07(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size); -L3INT DMSPmes_0x07(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT DMSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size); -L3INT DMSPmes_0x0f(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); - -/***************************************************************************** - - Q.931 Process Function Prototyping. Implemented in nationalStateTE.c - -*****************************************************************************/ - -L3INT DMSProc0x0fTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom); -L3INT DMSProc0x07TE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom); - -void DMSCreateTE(L3UCHAR i); -void DMSCreateNT(L3UCHAR i); - -#endif /* _DMS_NL */ diff --git a/libs/freetdm/src/isdn/include/Q921.h b/libs/freetdm/src/isdn/include/Q921.h deleted file mode 100644 index cb21a157ea..0000000000 --- a/libs/freetdm/src/isdn/include/Q921.h +++ /dev/null @@ -1,227 +0,0 @@ -/***************************************************************************** - - FileName: q921.h - - Description: Contains headers of a Q.921 protocol. - - Note: This header file is the only include file that should be - acessed by users of the Q.921 stack. - - Interface: The Q.921 stack contains 2 layers. - - - One interface layer. - - One driver layer. - - The interface layer contains the interface functions required - for a layer 2 stack to be able to send and receive messages. - - The driver layer will simply feed bytes into the ship as - required and queue messages received out from the ship. - - Q921TimeTick The Q.921 like any other blackbox - modules contains no thread by it's own - and must therefore be called regularly - by an external 'thread' to do maintenance - etc. - - Q921Rx32 Receive message from layer 3. Called by - the layer 3 stack to send a message. - - - NOTE: The following are not yet implemented - - OnQ921Error Function called every if an error is - detected. - - OnQ921Log Function called if logging is active. - - - Maintenance/Configuration interface - Logging - DL_ message passing to layer 3 - Timers - Api commands to tell 921 to stop and start for a trunk - - Created: 27.dec.2000/JVB - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -*****************************************************************************/ - -/**************************************************************************** - * Changes: - * - * - June,July 2008: Stefan Knoblich : - * Add PTMP TEI management - * Add timers - * Add retransmit counters - * Add logging - * Various cleanups - * - ****************************************************************************/ - -#ifndef _Q921 -#define _Q921 - -#define Q921MAXHDLCSPACE 3000 -#define L2UCHAR unsigned char /* Min 8 bit */ -#define L2USHORT unsigned short /* 16 bit */ -#define L2INT int /* Min 16 bit signed */ -#define L2ULONG unsigned long /* Min 32 bit */ -#define L2TRUNK Q921Data_t * - -#define Q921_TEI_BCAST 127 -#define Q921_TEI_MAX Q921_TEI_BCAST - -#define Q921_TEI_DYN_MIN 64 -#define Q921_TEI_DYN_MAX 126 - - -typedef enum /* Network/User Mode */ -{ - Q921_TE=0, /* 0 : User Mode */ - Q921_NT=1 /* 1 : Network Mode */ -} Q921NetUser_t; - -typedef enum /* Type of connection */ -{ - Q921_PTP=0, /* 0 : Point-To-Point */ - Q921_PTMP=1 /* 1 : Point-To-Multipoint */ -} Q921NetType_t; - -typedef enum -{ - Q921_LOG_NONE = -1, - Q921_LOG_EMERG = 0, - Q921_LOG_ALERT, - Q921_LOG_CRIT, - Q921_LOG_ERROR, - Q921_LOG_WARNING, - Q921_LOG_NOTICE, - Q921_LOG_INFO, - Q921_LOG_DEBUG -} Q921LogLevel_t; - - -/* - * Messages for L2 <-> L3 communication - */ -typedef enum { - Q921_DL_ESTABLISH = 0, - Q921_DL_ESTABLISH_CONFIRM, - Q921_DL_RELEASE, - Q921_DL_RELEASE_CONFIRM, - Q921_DL_DATA, - Q921_DL_UNIT_DATA -} Q921DLMsg_t; - -typedef int (*Q921Tx21CB_t) (void *, L2UCHAR *, L2INT); -typedef int (*Q921Tx23CB_t) (void *, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *, L2INT); -typedef int (*Q921LogCB_t) (void *, Q921LogLevel_t, char *, L2INT); - -struct Q921_Link; - -typedef struct Q921Data -{ - L2INT initialized; - - L2UCHAR sapi; /*!< User assigned SAPI */ - L2UCHAR tei; /*!< User assigned TEI value */ - - L2INT Q921HeaderSpace; - Q921NetUser_t NetUser; - Q921NetType_t NetType; - - struct Q921_Link *context; /*!< per-TEI / link context space */ - - /* timers */ - L2ULONG T202; /*!< PTMP TE mode TEI retransmit timer */ - L2ULONG T200Timeout; - L2ULONG T201Timeout; - L2ULONG T202Timeout; - L2ULONG T203Timeout; - - L2ULONG TM01Timeout; - - /* counters */ - L2ULONG N200Limit; /*!< max retransmit */ - - L2ULONG N202; /*!< PTMP TE mode retransmit counter */ - L2ULONG N202Limit; /*!< PTMP TE mode max retransmit */ - - L2ULONG N201Limit; /*!< max number of octets */ - L2ULONG k; /*!< max number of unacknowledged I frames */ - - /* callbacks and callback data pointers */ - Q921Tx21CB_t Q921Tx21Proc; - Q921Tx23CB_t Q921Tx23Proc; - void *PrivateData21; - void *PrivateData23; - - /* logging */ - Q921LogLevel_t loglevel; /*!< trunk loglevel */ - Q921LogCB_t Q921LogProc; /*!< log callback procedure */ - void *PrivateDataLog; /*!< private data pointer for log proc */ - - /* tei mgmt */ - L2UCHAR tei_map[Q921_TEI_MAX]; /*!< */ - - L2UCHAR HDLCInQueue[Q921MAXHDLCSPACE]; /*!< HDLC input queue */ -} Q921Data_t; - -/* - * Public functions - */ -int Q921_InitTrunk(L2TRUNK trunk, - L2UCHAR sapi, - L2UCHAR tei, - Q921NetUser_t NetUser, - Q921NetType_t NetType, - L2INT hsize, - Q921Tx21CB_t cb21, - Q921Tx23CB_t cb23, - void *priv21, - void *priv23); -int Q921Start(L2TRUNK trunk); -int Q921Stop(L2TRUNK trunk); - -void Q921SetLogCB(L2TRUNK trunk, Q921LogCB_t func, void *priv); -void Q921SetLogLevel(L2TRUNK trunk, Q921LogLevel_t level); - -int Q921Rx12(L2TRUNK trunk); -int Q921Rx32(L2TRUNK trunk, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR * Mes, L2INT Size); - -int Q921QueueHDLCFrame(L2TRUNK trunk, L2UCHAR *b, L2INT size); - -void Q921SetGetTimeCB(L2ULONG (*callback)(void)); -void Q921TimerTick(L2TRUNK trunk); - -#endif diff --git a/libs/freetdm/src/isdn/include/Q921priv.h b/libs/freetdm/src/isdn/include/Q921priv.h deleted file mode 100644 index d2d838c399..0000000000 --- a/libs/freetdm/src/isdn/include/Q921priv.h +++ /dev/null @@ -1,321 +0,0 @@ -/***************************************************************************** - - FileName: Q921priv.h - - Description: Private declarations - - Created: 08.Aug.2008/STKN - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2008, Stefan Knoblich, axsentis GmbH. All rights reserved. - email:s.knoblich@axsentis.de - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -*****************************************************************************/ -#ifndef _Q921_PRIV_H_ -#define _Q921_PRIV_H_ - -#ifdef _MSC_VER -#ifndef __inline__ -#define __inline__ __inline -#endif -#if (_MSC_VER >= 1400) /* VC8+ */ -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE -#endif -#endif -#ifndef strcasecmp -#define strcasecmp(s1, s2) _stricmp(s1, s2) -#endif -#ifndef strncasecmp -#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n) -#endif -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - -typedef enum /* Q.921 States */ -{ - Q921_STATE_STOPPED = 0, /* Trunk stopped */ - Q921_STATE_TEI_UNASSIGNED = 1, /* TEI unassigned */ - Q921_STATE_TEI_AWAITING, /* Assign awaiting TEI */ - Q921_STATE_TEI_ESTABLISH, /* Establish awaiting TEI */ - Q921_STATE_TEI_ASSIGNED, /* TEI assigned */ - Q921_STATE_AWAITING_ESTABLISHMENT, /* Awaiting establishment */ - Q921_STATE_AWAITING_RELEASE, /* Awaiting release */ - Q921_STATE_MULTIPLE_FRAME_ESTABLISHED, /* Multiple frame established */ - Q921_STATE_TIMER_RECOVERY /* Timer recovery */ -} Q921State_t; - -/* - * Flags - */ -enum Q921_Flags { - Q921_FLAG_L3_INITIATED = (1 << 0), - - Q921_FLAG_UI_FRAME_QUEUED = (1 << 1), - Q921_FLAG_I_FRAME_QUEUED = (1 << 2), - - Q921_FLAG_ACK_PENDING = (1 << 3), - Q921_FLAG_REJECT = (1 << 4), - - Q921_FLAG_RECV_BUSY = (1 << 5), - Q921_FLAG_PEER_RECV_BUSY = (1 << 6) -}; - -#define Q921_SET_FLAG(x, f) ((x)->flags |= f) -#define Q921_CHECK_FLAG(x, f) ((x)->flags & f) -#define Q921_CLEAR_FLAG(x, f) ((x)->flags &= ~f) - - -/* - * dynamic TEI handling - */ -#define Q921_SAPI_TEI 63 /* SAPI for all TEI Messages */ -#define Q921_LAYER_ENT_ID_TEI 0x0f /* UN Layer Management Entity ID for TEI Mgmt */ -#define Q921_LAYER_ENT_ID_Q931 0x08 /* Q.931 Layer Management Entity ID */ - - -typedef enum { - Q921_TEI_ID_REQUEST = 1, - Q921_TEI_ID_ASSIGNED, - Q921_TEI_ID_DENIED, - Q921_TEI_ID_CHECKREQ, - Q921_TEI_ID_CHECKRESP, - Q921_TEI_ID_REMOVE, - Q921_TEI_ID_VERIFY -} Q921TeiMessageType_t; - - -/** - * Per-Datalink context - */ -struct Q921_Link { - L2UCHAR tei; /*!< This endpoint's TEI */ - - L2UCHAR va; - L2UCHAR vs; - L2UCHAR vr; - - L2INT flags; - Q921State_t state; - - L2ULONG N202; /*!< PTMP TE mode retransmit counter */ - L2ULONG N200; /*!< retransmit counter (per-TEI in PTMP NT mode) */ - - L2ULONG TM01; /*!< Datalink inactivity disconnect timer */ - - L2ULONG T200; - L2ULONG T201; /*!< PTMP NT mode timer */ - L2ULONG T203; - - L2USHORT ri; /*!< random id for TEI request mgmt */ - - /* I + UI Frame queue */ - L2UCHAR UIFrameQueue[Q921MAXHDLCSPACE]; - L2UCHAR IFrameQueue[Q921MAXHDLCSPACE]; - L2UCHAR IFrameResendQueue[Q921MAXHDLCSPACE]; -}; - - -#define Q921_LINK_CONTEXT(tr, tei) \ - (Q921_IS_PTMP_NT(tr) && tei != Q921_TEI_BCAST) ? ((struct Q921_Link *)&(tr)->context[tei]) : (tr)->context - -#define Q921_TRUNK_CONTEXT(tr) \ - (tr)->context - -#define Q921_LOGBUFSIZE 2000 -#define INITIALIZED_MAGIC 42 - -/* - * Helper macros - */ -#define Q921_INC_COUNTER(x) (x = (x + 1) % 128) -#define Q921_DEC_COUNTER(x) (x = (x) ? (x - 1) : 127) - -#define Q921_UFRAME_HEADER_SIZE 3 -#define Q921_UFRAME_DATA_OFFSET(tr) ((tr)->Q921HeaderSpace + Q921_UFRAME_HEADER_SIZE) - -#define Q921_SFRAME_HEADER_SIZE 4 -#define Q921_SFRAME_DATA_OFFSET(tr) ((tr)->Q921HeaderSpace + Q921_SFRAME_HEADER_SIZE) - -#define Q921_IFRAME_HEADER_SIZE 4 -#define Q921_IFRAME_DATA_OFFSET(tr) ((tr)->Q921HeaderSpace + Q921_IFRAME_HEADER_SIZE) - -#define Q921_IS_TE(x) ((x)->NetUser == Q921_TE) -#define Q921_IS_NT(x) ((x)->NetUser == Q921_NT) - -#define Q921_IS_STOPPED(tr) ((tr)->state == Q921_STATE_STOPPED) - -/* TODO: rework this one */ -#define Q921_IS_READY(tr) ((tr)->state >= Q921_STATE_TEI_ASSIGNED) - -#define Q921_IS_PTMP(x) ((x)->NetType == Q921_PTMP) -#define Q921_IS_PTMP_TE(x) ((x)->NetType == Q921_PTMP && (x)->NetUser == Q921_TE) -#define Q921_IS_PTMP_NT(x) ((x)->NetType == Q921_PTMP && (x)->NetUser == Q921_NT) - -#define Q921_IS_PTP(x) ((x)->NetType == Q921_PTP) -#define Q921_IS_PTP_TE(x) ((x)->NetType == Q921_PTP && (x)->NetUser == Q921_TE) -#define Q921_IS_PTP_NT(x) ((x)->NetType == Q921_PTP && (x)->NetUser == Q921_NT) - -/* Make life a little easier */ -#define Q921_COMMAND(x) ((x)->NetUser == Q921_TE ? 0 : 1) -#define Q921_RESPONSE(x) ((x)->NetUser == Q921_TE ? 1 : 0) - -#define Q921_IS_COMMAND(tr, x) ((x) == (Q921_IS_TE(tr) ? 1 : 0)) -#define Q921_IS_RESPONSE(tr, x) ((x) == (Q921_IS_TE(tr) ? 0 : 1)) - - -/******************************************************************************* - * Private functions - *******************************************************************************/ - -/* - * L1 / L2 Interface - */ -static int Q921Tx21Proc(L2TRUNK trunk, L2UCHAR *Msg, L2INT size); -static int Q921Tx23Proc(L2TRUNK trunk, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *Msg, L2INT size); - - -/* - * Timers - */ -static L2ULONG Q921GetTime(void); - -static void Q921T200TimerStart(L2TRUNK trunk, L2UCHAR tei); -static void Q921T200TimerStop(L2TRUNK trunk, L2UCHAR tei); -static void Q921T200TimerReset(L2TRUNK trunk, L2UCHAR tei); -static void Q921T200TimerExpire(L2TRUNK trunk, L2UCHAR tei); - -static void Q921T201TimerStart(L2TRUNK trunk, L2UCHAR tei); -static void Q921T201TimerStop(L2TRUNK trunk, L2UCHAR tei); -/* static void Q921T201TimerReset(L2TRUNK trunk, L2UCHAR tei); - Unused for now */ -static void Q921T201TimerExpire(L2TRUNK trunk, L2UCHAR tei); - -static void Q921T202TimerStart(L2TRUNK trunk); -static void Q921T202TimerStop(L2TRUNK trunk); -static void Q921T202TimerReset(L2TRUNK trunk); -static void Q921T202TimerExpire(L2TRUNK trunk); - -static void Q921T203TimerStart(L2TRUNK trunk, L2UCHAR tei); -static void Q921T203TimerStop(L2TRUNK trunk, L2UCHAR tei); -static void Q921T203TimerReset(L2TRUNK trunk, L2UCHAR tei); -static void Q921T203TimerExpire(L2TRUNK trunk, L2UCHAR tei); - -static void Q921TM01TimerStart(L2TRUNK trunk, L2UCHAR tei); -/* static void Q921TM01TimerStop(L2TRUNK trunk, L2UCHAR tei); - Unused for now */ -static void Q921TM01TimerReset(L2TRUNK trunk, L2UCHAR tei); -/* static void Q921TM01TimerExpire(L2TRUNK trunk, L2UCHAR tei); - Unused for now */ - -/* - * Frame encoding - */ -static int Q921SendS(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR sv, L2UCHAR *mes, L2INT size); -static int Q921SendU(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR m, L2UCHAR *mes, L2INT size); - -static int Q921SendRNR(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf); -static int Q921SendREJ(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf); -static int Q921SendSABME(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf); -static int Q921SendDM(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf); -static int Q921SendDISC(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf); -static int Q921SendUA(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf); -static int Q921SendUN(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf, L2UCHAR *mes, L2INT size); -static int Q921SendRR(L2TRUNK trunk, int Sapi, int cr, int Tei, int pf); - -/* - * Frame decoding - */ -static int Q921ProcIFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921ProcSFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921ProcUFrame(L2TRUNK trunk, L2UCHAR *mes, L2INT size); - -static int Q921ProcSABME(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921ProcDM(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921ProcUA(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921ProcDISC(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921ProcRR(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921ProcRNR(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921ProcREJ(L2TRUNK trunk, L2UCHAR *mes, L2INT size); - - -/* - * (Common) procedures defined in the Q.921 SDL - */ -static int Q921SendEnquiry(L2TRUNK trunk, L2UCHAR tei); -static int Q921SendEnquiryResponse(L2TRUNK trunk, L2UCHAR tei); -static void Q921ResetExceptionConditions(L2TRUNK trunk, L2UCHAR tei); -static int Q921EstablishDataLink(L2TRUNK trunk, L2UCHAR tei); -static int Q921NrErrorRecovery(L2TRUNK trunk, L2UCHAR tei); -static int Q921InvokeRetransmission(L2TRUNK trunk, L2UCHAR tei, L2UCHAR nr); -static int Q921AcknowledgePending(L2TRUNK trunk, L2UCHAR tei); -/* -static int Q921SetReceiverBusy(L2TRUNK trunk); -static int Q921ClearReceiverBusy(L2TRUNK trunk); -*/ - -/* - * Queueing - */ -static int Q921SendQueuedIFrame(L2TRUNK trunk, L2UCHAR tei); -static int Q921EnqueueI(L2TRUNK trunk, L2UCHAR Sapi, char cr, L2UCHAR Tei, char pf, L2UCHAR *mes, L2INT size); - -/* - * TEI management - */ -static int Q921TeiSendAssignRequest(L2TRUNK trunk); -static int Q921TeiProcAssignResponse(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921TeiSendVerifyRequest(L2TRUNK trunk); -static int Q921TeiProcCheckRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921TeiProcRemoveRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921TeiProcAssignRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921TeiProcCheckResponse(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921TeiProcVerifyRequest(L2TRUNK trunk, L2UCHAR *mes, L2INT size); -static int Q921TeiSendRemoveRequest(L2TRUNK trunk, L2UCHAR tei); -static int Q921TeiSendDenyResponse(L2TRUNK trunk, L2UCHAR tei, L2USHORT ri); -static int Q921TeiSendAssignedResponse(L2TRUNK trunk, L2UCHAR tei, L2USHORT ri); -static int Q921TeiSendCheckRequest(L2TRUNK trunk, L2UCHAR tei); - -/* - * Logging - */ -static int Q921Log(L2TRUNK trunk, Q921LogLevel_t level, const char *fmt, ...); -static int Q921LogMesg(L2TRUNK trunk, Q921LogLevel_t level, L2UCHAR received, L2UCHAR *mes, L2INT size, const char *fmt, ...); - -/* - * State handling - */ -static int Q921ChangeState(L2TRUNK trunk, Q921State_t state, L2UCHAR tei); - -#endif diff --git a/libs/freetdm/src/isdn/include/Q931.h b/libs/freetdm/src/isdn/include/Q931.h deleted file mode 100644 index 0dbafd9f11..0000000000 --- a/libs/freetdm/src/isdn/include/Q931.h +++ /dev/null @@ -1,1175 +0,0 @@ -/****************************************************************************** - - FileName: Q931.h - - Contents: Header and definition for the ITU-T Q.931 stack. The - header contents the following parts: - - - Definition of codes - - Definition of information elements (Q931ie_). - - Definition of messages (Q931mes_). - - Definitian of variables (var_). - - Function prototypes. - - Description: The Q.931 stack provided here covers ITU-T Q.931 w/Q.932 - supplementary services for both PRI, BRI and variants. - The stack is generic and designed to deal with variants as - needed. - - The stack uses the following interface functions: - - - Q931Initialize Initialize the Q.931 stack. - - Q931Rx23 Receive a message from layer 2 - - Q931Tx32 Send a message to layer 2 - - Q931Rx43 Receive a message from layer 4 or above. - - Q931Tx34 Send a message to layer 4 or above. - - Q931TimeTick Periodical timer processing. - - Q931ErrorProc Callback for stack error message. - - The protocol is a module with no external dependencies and - can easely be ported to any operating system like Windows, - Linux, rtos and others. - - Related Files: Q931.h Q.931 Definitions - Q931.c Q.931 Interface Functions. - Q931api.c Low level L4 API functions. - - Q932.h Q.932 Suplementary Services - Q932mes.c Q.932 encoders/coders - - Q931mes.c Q.931 Message encoders/coders - Q931ie.c Q.931 IE encoders/coders - Q931StateTE.c Generic Q.931 TE State Engine - Q931StateNT.c Generic Q.931 NT State Engine - - Design Note 1: For each variant please add separate files starting with - the variant short-name as follows: - - .h Spesific headers needed. - mes.c Message encoders/decores. - ie.c IE encoders/decoders. - StateTE.c TE side state engine. - StateNT.c NT side state engine. - - Design Note 2: The stack is deliberatly made non-threading. Use 1 - thread per Trunk, but lock access from the timertick - and rx, tx functions. And make sure the callbacks only - dump messages to a queue, no time-consuming processing - inside stack processing. - - All stack processing is async 'fire and forget', meaning - that there are not, and should not be any time-consuming - processing within the stack-time. The best way to thread - a stack is to use one single thread that signal 5 queues. - - - Incoming L2 queue. - - Incoming L4 queue. - - Outgoing L2 queue. - - Outgoing L4 queue. - - Error/Trace queue. - - Design Note 3: DSP optimization. The L3 (Rx23) can be called directly - from a HDLC receiver without usage of queues for optimized - processing. But keep in mind that Q.931 calls Tx34 or Tx32 - as part of receiving a message from Layer 2. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -******************************************************************************/ - -#ifndef _Q931_NL -#define _Q931_NL - -/* uncomment the #define below to add x.25 support to the Q.931 */ -/* #define Q931_X25_SUPPORT */ - -#include "stdio.h" - -#ifdef _MSC_VER -#pragma warning(disable:4100) -#ifndef strcasecmp -#define strcasecmp(s1, s2) _stricmp(s1, s2) -#endif -#endif -#include - - -/***************************************************************************** - - Enum helper macros - -*****************************************************************************/ -#define Q931_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL }; -#define Q931_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); -#define Q931_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ - _TYPE _FUNC1 (const char *name) \ - { \ - int i; \ - _TYPE t = _MAX ; \ - \ - for (i = 0; i < _MAX ; i++) { \ - if (!strcasecmp(name, _STRINGS[i])) { \ - t = (_TYPE) i; \ - break; \ - } \ - } \ - \ - return t; \ - } \ - const char * _FUNC2 (_TYPE type) \ - { \ - if (type > _MAX) { \ - type = _MAX; \ - } \ - return _STRINGS[(int)type]; \ - } \ - -/***************************************************************************** - - Error Codes - -*****************************************************************************/ -typedef enum { - Q931E_NO_ERROR = 0, - - Q931E_UNKNOWN_MESSAGE = -3001, - Q931E_ILLEGAL_IE = -3002, - Q931E_UNKNOWN_IE = -3003, - Q931E_BEARERCAP = -3004, - Q931E_HLCOMP = -3005, - Q931E_LLCOMP = -3006, - Q931E_INTERNAL = -3007, - Q931E_MISSING_CB = -3008, - Q931E_UNEXPECTED_MESSAGE = -3009, - Q931E_ILLEGAL_MESSAGE = -3010, - Q931E_TOMANYCALLS = -3011, - Q931E_INVALID_CRV = -3012, - Q931E_CALLID = -3013, - Q931E_CALLSTATE = -3014, - Q931E_CALLEDSUB = -3015, - Q931E_CALLEDNUM = -3016, - Q931E_CALLINGNUM = -3017, - Q931E_CALLINGSUB = -3018, - Q931E_CAUSE = -3019, - Q931E_CHANID = -3020, - Q931E_DATETIME = -3021, - Q931E_DISPLAY = -3022, - Q931E_KEYPADFAC = -3023, - Q931E_NETFAC = -3024, - Q931E_NOTIFIND = -3025, - Q931E_PROGIND = -3026, - Q931E_RESTARTIND = -3027, - Q931E_SEGMENT = -3028, - Q931E_SIGNAL = -3029, - Q931E_GENERIC_DIGITS = -3030 -} q931_error_t; - -/* The q931_error_t enum should be kept in sync with the q931_error_names array in Q931.c */ - -const char *q931_error_to_name(q931_error_t error); - -/***************************************************************************** - - Some speed optimization can be achieved by changing all variables to the - word size of your processor. A 32 bit processor has to do a lot of extra - work to read a packed 8 bit integer. Changing all fields to 32 bit integer - will result in usage of some extra space, but will speed up the stack. - - The stack has been designed to allow L3UCHAR etc. to be any size of 8 bit - or larger. - -*****************************************************************************/ - -#define L3UCHAR unsigned char /* Min 8 bit */ -#define L3USHORT unsigned short /* Min 16 bit unsigned */ -#define L3UINT unsigned int /* Min 16 bit unsigned */ -#define L3INT int /* Min 16 bit signed */ -#define L3ULONG unsigned long /* Min 32 bit */ -#define L3BOOL char /* Min 1 bit, valuse 0 & 1 only */ - -#define L3TRUE 1 -#define L3FALSE 0 - -/***************************************************************************** - - Global defines. - -*****************************************************************************/ - -typedef L3USHORT ie; /* Special data type to hold a dynamic */ - /* or optional information element as */ - /* part of a message struct. MSB = 1 */ - /* indicate that the ie is present, the */ - /* last 15 bits is an offset ( or the */ - /* value for single octet ) to the */ - /* struct holding the ie. Offset = 0 */ - /* is buf[1] etc. */ - /* ie == 0xffff indicates error */ - -/***************************************************************************** - - MAXTRUNKS sets how many physical trunks this system might have. This - number should be keept at a minimum since it will use global space. - - It is recommended that you leave MAXCHPERTRUNK as is - -*****************************************************************************/ - -#define Q931_LOGBUFSIZE 1024 /* size of logging buffer */ - -#define Q931L4BUF 1000 /* size of message buffer */ - -#define Q931L2BUF 300 /* size of message buffer */ - -#define Q931MAXTRUNKS 4 /* Total number of trunks that will be */ - /* processed by this instance of the */ - /* stack */ - -#define Q931MAXCHPERTRUNK 32 /* Number of channels per trunk. The */ - /* stack uses a static set of 32 */ - /* channels regardless if it is E1, T1 */ - /* or BRI that actually is used. */ - -#define Q931MAXCALLPERTRUNK (Q931MAXCHPERTRUNK * 2) - /* Number of max active CRV per trunk. */ - /* Q.931 can have more calls than there */ - /* are channels. */ - - -#define Q931_IS_BRI(x) ((x)->TrunkType == Q931_TrType_BRI || (x)->TrunkType == Q931_TrType_BRI_PTMP) -#define Q931_IS_PRI(x) (!Q931_IS_BRI(x)) - -#define Q931_IS_PTP(x) ((x)->TrunkType != Q931_TrType_BRI_PTMP) -#define Q931_IS_PTMP(X) ((x)->TrunkType == Q931_TrType_BRI_PTMP) - -#define Q931_BRI_MAX_CRV 127 -#define Q931_PRI_MAX_CRV 32767 - -/***************************************************************************** - - The following defines control the dialect switch tables and should only be - changed when a new dialect needs to be inserted into the stack. - - This stack uses an array of functions to know which function to call as - it receives a SETUP message etc. A new dialect can when choose to use - the proc etc. for standard Q.931 or insert a modified proc. - - This technique has also been used to distinguish between user and network - mode to make the code as easy to read and maintainable as possible. - - A message and IE index have been used to save space. These indexes allowes - the message or IE code to be used directly and will give back a new index - into the table. - -*****************************************************************************/ - -/* WARNING! Initialize Q931CreateDialectCB[] will NULL when increasing the */ -/* Q931MAXDLCT value to avoid Q931Initialize from crashing if one entry is */ -/* not used. */ -#define Q931MAXDLCT 8 /* Max dialects included in this */ - /* compile. User and Network count as */ - /* one dialect each. */ - -#define Q931MAXMES 128 /* Number of messages */ -#define Q931MAXIE 255 /* Number of IE */ -#define Q931MAXUSEDIE 50 /* Maximum number of ie types per Dialect */ -#define Q931MAXCODESETS 7 /* Maximum number of codests (by spec, 0-7) */ -#define Q931MAXSTATE 100 /* Size of state tables */ -#define Q931MAXTIMER 25 /* Maximum number of timers */ - -/***************************************************************************** - - Call States for ITU-T Q.931 TE (User Mode) - -*****************************************************************************/ - -#define Q931_U0 0 -#define Q931_U1 1 -#define Q931_U2 2 -#define Q931_U3 3 -#define Q931_U4 4 -#define Q931_U6 6 -#define Q931_U7 7 -#define Q931_U8 8 -#define Q931_U9 9 -#define Q931_U10 10 -#define Q931_U11 11 -#define Q931_U12 12 -#define Q931_U15 15 -#define Q931_U17 17 -#define Q931_U19 19 -#define Q931_U25 25 - -/***************************************************************************** - - Call States for ITU-T Q.931 NT (Network Mode) - -*****************************************************************************/ -#define Q931_N0 (0x0100 | 0) -#define Q931_N1 (0x0100 | 1) -#define Q931_N2 (0x0100 | 2) -#define Q931_N3 (0x0100 | 3) -#define Q931_N4 (0x0100 | 4) -#define Q931_N6 (0x0100 | 6) -#define Q931_N7 (0x0100 | 7) -#define Q931_N8 (0x0100 | 8) -#define Q931_N9 (0x0100 | 9) -#define Q931_N10 (0x0100 | 11) -#define Q931_N11 (0x0100 | 11) -#define Q931_N12 (0x0100 | 12) -#define Q931_N15 (0x0100 | 15) -#define Q931_N17 (0x0100 | 17) -#define Q931_N19 (0x0100 | 19) -#define Q931_N22 (0x0100 | 22) -#define Q931_N25 (0x0100 | 25) - -/***************************************************************************** - - Q.931 Message codes - -*****************************************************************************/ - -#define Q931mes_ALERTING 0x01 /* 0000 0001 */ -#define Q931mes_CALL_PROCEEDING 0x02 /* 0000 0010 */ -#define Q931mes_CONNECT 0x07 /* 0000 0111 */ -#define Q931mes_CONNECT_ACKNOWLEDGE 0x0f /* 0000 1111 */ -#define Q931mes_PROGRESS 0x03 /* 0000 0011 */ -#define Q931mes_SETUP 0x05 /* 0000 0101 */ -#define Q931mes_SETUP_ACKNOWLEDGE 0x0d /* 0000 1101 */ -#define Q931mes_RESUME 0x26 /* 0010 0110 */ -#define Q931mes_RESUME_ACKNOWLEDGE 0x2e /* 0010 1110 */ -#define Q931mes_RESUME_REJECT 0x22 /* 0010 0010 */ -#define Q931mes_SUSPEND 0x25 /* 0010 0101 */ -#define Q931mes_SUSPEND_ACKNOWLEDGE 0x2d /* 0010 1101 */ -#define Q931mes_SUSPEND_REJECT 0x21 /* 0010 0001 */ -#define Q931mes_USER_INFORMATION 0x20 /* 0010 0000 */ -#define Q931mes_DISCONNECT 0x45 /* 0100 0101 */ -#define Q931mes_RELEASE 0x4d /* 0100 1101 */ -#define Q931mes_RELEASE_COMPLETE 0x5a /* 0101 1010 */ -#define Q931mes_RESTART 0x46 /* 0100 0110 */ -#define Q931mes_RESTART_ACKNOWLEDGE 0x4e /* 0100 1110 */ -#define Q931mes_CONGESTION_CONTROL 0x79 /* 0111 1001 */ -#define Q931mes_INFORMATION 0x7b /* 0111 1011 */ -#define Q931mes_NOTIFY 0x6e /* 0110 1110 */ -#define Q931mes_STATUS 0x7d /* 0111 1101 */ -#define Q931mes_STATUS_ENQUIRY 0x75 /* 0111 0101 */ -#define Q931mes_SEGMENT 0x60 /* 0110 0000 */ - -#define Q931mes_SERVICE 0x0f /* 0000 1111 */ -#define Q931mes_SERVICE_ACKNOWLEDGE 0x07 /* 0000 0111 */ - - -/** - * Generic Q.931 Timers - */ -enum { - Q931_TIMER_T300 = 1, /* */ - Q931_TIMER_T301, - Q931_TIMER_T302, - Q931_TIMER_T303, - Q931_TIMER_T304, - Q931_TIMER_T305, - Q931_TIMER_T306, - Q931_TIMER_T307, - Q931_TIMER_T308, - Q931_TIMER_T309, - Q931_TIMER_T310, - Q931_TIMER_T311, - Q931_TIMER_T312, - Q931_TIMER_T313, - Q931_TIMER_T314, - Q931_TIMER_T315, - Q931_TIMER_T316, - Q931_TIMER_T317, - Q931_TIMER_T318, - Q931_TIMER_T319, - Q931_TIMER_T320, - Q931_TIMER_T321, - Q931_TIMER_T322, -}; - -/** - * Q.931 ToN - */ -enum { - Q931_TON_UNKNOWN = 0x00, - Q931_TON_INTERNATIONAL = 0x01, - Q931_TON_NATIONAL = 0x02, - Q931_TON_NETWORK_SPECIFIC = 0x03, - Q931_TON_SUBSCRIBER_NUMBER = 0x04, - Q931_TON_ABBREVIATED_NUMBER = 0x06, - Q931_TON_RESERVED = 0x07 -}; - -/** - * Q.931 Numbering Plan - */ -enum { - Q931_NUMPLAN_UNKNOWN = 0x00, - Q931_NUMPLAN_E164 = 0x01, - Q931_NUMPLAN_X121 = 0x03, - Q931_NUMPLAN_F69 = 0x04, - Q931_NUMPLAN_NATIONAL = 0x08, - Q931_NUMPLAN_PRIVATE = 0x09, - Q931_NUMPLAN_RESERVED = 0x0e -}; - -/** - * Q.931 Presentation Indicator - */ -enum { - Q931_PRES_ALLOWED = 0x00, - Q931_PRES_RESTRICTED = 0x01, - Q931_PRES_NOT_AVAILABLE = 0x02, - Q931_PRES_RESERVED = 0x03 -}; - -/** - * Q.931 Screening Indicator - */ -enum { - Q931_SCREEN_USER_NOT_SCREENED = 0x00, - Q931_SCREEN_USER_VERIFIED_PASSED = 0x01, - Q931_SCREEN_USER_VERIFIED_FAILED = 0x02, - Q931_SCREEN_NETWORK = 0x03 -}; - -/** - * Q.931 Coding Standard - */ -enum { - Q931_CODING_ITU = 0x00, - Q931_CODING_ISO = 0x01, - Q931_CODING_NATIONAL = 0x02, - Q931_CODING_NETWORK = 0x03 -}; - -/** - * Q.931 High layer characteristik id - */ -enum { - Q931_HLCHAR_TELEPHONY = 0x01, - Q931_HLCHAR_FAX_G23 = 0x04, - Q931_HLCHAR_FAX_G4 = 0x21, - Q931_HLCHAR_FAX_G4II = 0x24, - Q931_HLCHAR_T102 = 0x32, - Q931_HLCHAR_T101 = 0x33, - Q931_HLCHAR_F60 = 0x35, - Q931_HLCHAR_X400 = 0x38, - Q931_HLCHAR_X200 = 0x41 -}; - -/** - * Q.931 User information layer 1 protocol - */ -enum { - Q931_UIL1P_V110 = 0x01, - Q931_UIL1P_I460 = 0x01, - Q931_UIL1P_X30 = 0x01, - - Q931_UIL1P_G711U = 0x02, - Q931_UIL1P_G711A = 0x03, - Q931_UIL1P_G721 = 0x04, - - Q931_UIL1P_H221 = 0x05, - Q931_UIL1P_H242 = 0x05, - - Q931_UIL1P_H223 = 0x06, - Q931_UIL1P_H245 = 0x06, - - Q931_UIL1P_RATE_ADAP = 0x07, - - Q931_UIL1P_V120 = 0x08, - Q931_UIL1P_X31 = 0x09 -}; - -/** - * Q.931 Information Transfer Capability - */ -enum { - Q931_ITC_SPEECH = 0x00, - Q931_ITC_UNRESTRICTED = 0x08, - Q931_ITC_RESTRICTED = 0x09, - Q931_ITC_3K1_AUDIO = 0x10, - Q931_ITC_UNRESTRICTED_TONES = 0x11, - Q931_ITC_VIDEO = 0x18 -}; - -/** - * Q.931 Information transfer rate - */ -enum { - Q931_ITR_PACKET = 0x00, - Q931_ITR_64K = 0x10, - Q931_ITR_128K = 0x11, - Q931_ITR_384K = 0x13, - Q931_ITR_1536K = 0x15, - Q931_ITR_1920K = 0x17, - Q931_ITR_MULTI = 0x18 -}; - -/***************************************************************************** - - Struct: Q931mes_Header - - Description: Used to read the header & message code. - -*****************************************************************************/ -typedef struct { - L3UINT Size; /* Size of message in bytes */ - L3UCHAR ProtDisc; /* Protocol Discriminator */ - L3UCHAR MesType; /* Message type */ - L3UCHAR CRVFlag; /* Call reference value flag */ - L3INT CRV; /* Call reference value */ - -} Q931mes_Header; - -/***************************************************************************** - - Struct: Q931mes_Generic - - Description: Generic header containing all IE's. This is not used, but is - provided in case a proprietary variant needs it. - -*****************************************************************************/ -typedef struct { - L3UINT Size; /* Size of message in bytes */ - L3UCHAR ProtDisc; /* Protocol Discriminator */ - L3UCHAR MesType; /* Message type */ - L3UCHAR CRVFlag; /* Call reference value flag */ - L3INT CRV; /* Call reference value */ - - /* WARNING: don't touch anything above this line (TODO: use Q931mes_Header directly to make sure it's the same) */ - - L3UCHAR Tei; /* TEI */ - - ie Shift; - ie MoreData; - ie SendComplete; - ie CongestionLevel; - ie RepeatInd; - - ie Segment; /* Segmented message */ - ie BearerCap; /* Bearer Capability */ - ie Cause; /* Cause */ - ie CallState; /* Call State */ - ie CallID; /* Call Identity */ - ie ChanID; /* Channel Identification */ - ie ChangeStatus; /* Change Staus */ - ie ProgInd; /* Progress Indicator */ - ie NetFac; /* Network Spesific Facilities */ - ie NotifInd; /* Notification Indicator */ - ie Display; /* Display */ - ie DateTime; /* Date/Time */ - ie KeypadFac; /* Keypad Facility */ - ie Signal; /* Signal */ - ie InfoRate; /* Information rate */ - ie EndEndTxDelay; /* End to End Transmit Delay */ - ie TransDelSelInd; /* Transmit Delay Sel. and Ind. */ - ie PackParam; /* Packed Layer Binary parameters */ - ie PackWinSize; /* Packet Layer Window Size */ - ie PackSize; /* Packed Size */ - ie ClosedUserGrp; /* Closed User Group */ - ie RevChargeInd; /* Reverse Charging Indicator */ - ie CalledNum; /* Called Party Number */ - ie CalledSub; /* Called Party subaddress */ - ie CallingNum; /* Calling Party Number */ - ie CallingSub; /* Calling Party Subaddress */ - ie RedirNum; /* Redirection Number */ - ie TransNetSel; /* Transmit Network Selection */ - ie LLRepeatInd; /* Repeat Indicator 2 LLComp */ - ie RestartWin; /* Restart Window */ - ie RestartInd; /* Restart Indicator */ - ie LLComp; /* Low Layer Compatibility */ - ie HLComp; /* High Layer Compatibility */ - ie UserUser; /* User-user */ - ie Escape; /* Escape for extension */ - ie Switchhook; - ie FeatAct; - ie FeatInd; - ie GenericDigits; - - L3UCHAR buf[1]; /* Buffer for IE's */ - -} Q931mes_Generic; - - -/***************************************************************************** - - Struct: Q931_TrunkInfo - - Description: TrunkInfo is the struct entry used to store Q.931 related - information and state for E1/T1/J1 trunks and associated - channels in the system. - - The user should store this information outside this stack - and needs to feed the interface functions with a pointer to - the TrunkInfo entry. - -*****************************************************************************/ -typedef struct Q931_TrunkInfo Q931_TrunkInfo_t; - -typedef enum { - Q931_LOG_NONE = -1, - Q931_LOG_EMERG, - Q931_LOG_ALERT, - Q931_LOG_CRIT, - Q931_LOG_ERROR, - Q931_LOG_WARNING, - Q931_LOG_NOTICE, - Q931_LOG_INFO, - Q931_LOG_DEBUG -} Q931LogLevel_t; - -typedef L3INT (*Q931Tx34CB_t) (void *,L3UCHAR *, L3INT); -typedef L3INT (*Q931Tx32CB_t) (void *, L3INT, L3UCHAR, L3UCHAR *, L3INT); -typedef L3INT (*Q931ErrorCB_t) (void *,L3INT,L3INT,L3INT); -typedef L3INT (*Q931LogCB_t) (void *, Q931LogLevel_t, char *, L3INT); - -typedef enum { /* Network/User Mode. */ - Q931_TE=0, /* 0 : User Mode */ - Q931_NT=1 /* 1 : Network Mode */ -} Q931NetUser_t; - -typedef enum { /* Dialect enum */ - Q931_Dialect_Q931 = 0, - Q931_Dialect_National = 2, - Q931_Dialect_DMS = 4, - Q931_Dialect_5ESS = 6, /* Coming soon to a PRI stack near you! */ - - Q931_Dialect_Count -} Q931Dialect_t; -#define DIALECT_STRINGS "q931", "", "national", "", "dms", "", "5ess", "" -Q931_STR2ENUM_P(q931_str2Q931Dialect_type, q931_Q931Dialect_type2str, Q931Dialect_t) - -typedef enum { /* Trunk Line Type. */ - Q931_TrType_E1 = 0, /* 0 : E1 Trunk */ - Q931_TrType_T1 = 1, /* 1 : T1 Trunk */ - Q931_TrType_J1 = 2, /* 2 : J1 Trunk */ - Q931_TrType_BRI = 3, /* 3 : BRI Trunk */ - Q931_TrType_BRI_PTMP = 4 /* 4 : BRI PTMP Trunk */ -} Q931_TrunkType_t; - -typedef enum { /* Trunk State */ - Q931_TrState_NoAlignment=0, /* Trunk not aligned */ - Q931_TrState_Aligning=1, /* Aligning in progress */ - Q931_TrState_Aligned=2 /* Trunk Aligned */ -} Q931_TrunkState_t; - -typedef enum { - Q931_ChType_NotUsed=0, /* Unused Channel */ - Q931_ChType_B=1, /* B Channel (Voice) */ - Q931_ChType_D=2, /* D Channel (Signalling) */ - Q931_ChType_Sync=3 /* Sync Channel */ -} Q931_ChanType_t; - -struct Q931_Call -{ - L3UCHAR InUse; /* Indicate if entry is in use. */ - /* 0 = Not in Use */ - /* 1 = Active Call. */ - - L3UCHAR Tei; /* Associated TEI */ - - L3UCHAR BChan; /* Associated B Channel. */ - /* 0 - 31 valid B chan */ - /* 255 = Not allocated */ - - L3INT CRV; /* Associated CRV. */ - - L3UINT State; /* Call State. */ - /* 0 is Idle, but other values are */ - /* defined per dialect. */ - /* Default usage is 1-99 for TE and */ - /* 101 - 199 for NT. */ - - L3ULONG Timer; /* Timer in ms. The TimeTick will check */ - /* if this has exceeded the timeout, and */ - /* if so call the timers timeout proc. */ - - L3USHORT TimerID; /* Timer Identification/State */ - /* actual values defined by dialect */ - /* 0 : No timer running */ - /* ITU-T Q.931:301 - 322 Timer running */ -}; - -struct Q931_TrunkInfo -{ - Q931NetUser_t NetUser; /* Network/User Mode. */ - Q931_TrunkType_t TrunkType; /* Trunk Line Type. */ - Q931Dialect_t Dialect; /* Q.931 Based dialect index. */ - - Q931Tx34CB_t Q931Tx34CBProc; - Q931Tx32CB_t Q931Tx32CBProc; - Q931ErrorCB_t Q931ErrorCBProc; - Q931LogCB_t Q931LogCBProc; - void *PrivateData32; - void *PrivateData34; - void *PrivateDataLog; - - Q931LogLevel_t loglevel; - - L3UCHAR Enabled; /* Enabled/Disabled */ - /* 0 = Disabled */ - /* 1 = Enabled */ - - Q931_TrunkState_t TrunkState; - - L3INT LastCRV; /* Last used crv for the trunk. */ - - L3UCHAR L3Buf[Q931L4BUF]; /* message buffer for messages to be */ - /* send from Q.931 L4. */ - - L3UCHAR L2Buf[Q931L2BUF]; /* buffer for messages send to L2. */ - - /* The auto flags below switch on/off automatic Ack messages. SETUP ACK */ - /* as an example can be sent by the stack in response to SETUP to buy */ - /* time in processing on L4. Setting this to true will cause the stack */ - /* to automatically send this. */ - - L3BOOL autoSetupAck; /* Indicate if the stack should send */ - /* SETUP ACK or not. 0=No, 1 = Yes. */ - - L3BOOL autoConnectAck; /* Indicate if the stack should send */ - /* CONNECT ACT or not. 0=No, 1=Yes. */ - - L3BOOL autoRestartAck; /* Indicate if the stack should send */ - /* RESTART ACK or not. 0=No, 1=Yes. */ - - L3BOOL autoServiceAck; /* Indicate if the stack should send */ - /* SERVICE ACK or not. 0=No, 1=Yes. */ - - /* channel array holding info per channel. Usually defined to 32 */ - /* channels to fit an E1 since T1/J1 and BRI will fit inside a E1. */ - struct _charray - { - Q931_ChanType_t ChanType; /* Unused, B, D, Sync */ - - L3UCHAR Available; /* Channel Available Flag */ - /* 0 : Avaiabled */ - /* 1 : Used */ - - L3INT CRV; /* Associated CRV */ - - } ch[Q931MAXCHPERTRUNK]; - - /* Active Call information indentified by CRV. See Q931AllocateCRV for */ - /* initialization of call table. */ - struct Q931_Call call[Q931MAXCALLPERTRUNK]; -}; - -/***************************************************************************** - - Struct: Q931State - - Description: Define a Q931 State, legal events and next state for each - event. Used to simplify the state engine logic. Each state - engine defines its own state table and the logic need only - call a helper function to check if the message is legal - at this stage. - -*****************************************************************************/ -typedef struct -{ - L3INT State; - L3INT Message; - L3UCHAR Direction; -} Q931State; - -/***************************************************************************** - - Proc table external references. - - The proc tables are defined in Q931.c and initialized in Q931Initialize. - -*****************************************************************************/ -typedef L3INT (q931proc_func_t) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *, L3INT); - -typedef L3INT (q931umes_func_t) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); -typedef L3INT (q931pmes_func_t) (Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); - -typedef L3INT (q931uie_func_t) (Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -typedef L3INT (q931pie_func_t) (Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); - -typedef L3INT (q931timeout_func_t) (Q931_TrunkInfo_t *pTrunk, L3INT callIndex); -typedef L3ULONG q931timer_t; - -extern q931proc_func_t *Q931Proc[Q931MAXDLCT][Q931MAXMES]; - -extern q931umes_func_t *Q931Umes[Q931MAXDLCT][Q931MAXMES]; -extern q931pmes_func_t *Q931Pmes[Q931MAXDLCT][Q931MAXMES]; - -extern q931uie_func_t *Q931Uie[Q931MAXDLCT][Q931MAXIE]; -extern q931pie_func_t *Q931Pie[Q931MAXDLCT][Q931MAXIE]; - -extern q931timeout_func_t *Q931Timeout[Q931MAXDLCT][Q931MAXTIMER]; -extern q931timer_t Q931Timer[Q931MAXDLCT][Q931MAXTIMER]; - - -/***************************************************************************** - - Macro: GetIETotoSize - - Syntax: L3INT GetIETotSize(InfoElem ie); - - Description: Compute the total size in bytes of an info element including - size of 'header'. - -*****************************************************************************/ -#define Q931GetIETotSize(ie) (((ie.InfoID & 0x80) != 0) ? 1 : ie.LenIE) + 2) - -/***************************************************************************** - - Macro: IsIEPresent - - Syntax: BOOL IsIEPresent(ie InfoElement); - - Description: Return TRUE if the Information Element is included. - -*****************************************************************************/ -#define Q931IsIEPresent(x) ((x & 0x8000) != 0) - -/***************************************************************************** - - Macro: GetIEOffset and GetIEValue - - Syntax: L3INT GetIEOffset(ie InfoElement) - L3INT GetIEValue(ie InfoElement) - - Description: Returns the offset (or the value )to the Information Element. - - Note: GetIEValue assumes that the 15 lsb bit is the value of a - single octet information element. This macro can not be used - on a variable information element. - -*****************************************************************************/ -#define Q931GetIEOffset(x) (x & 0x7fff) -#define Q931GetIEValue(x) (x & 0x7fff) - -/***************************************************************************** - - Macro: Q931GetIEPtr - - Syntax: void * Q931GetIEPtr(ie InfoElement, L3UCHAR * Buf); - - Description: Compute a Ptr to the information element. - -*****************************************************************************/ -#define Q931GetIEPtr(ie,buf) ((void *)&buf[Q931GetIEOffset(ie)]) - -/***************************************************************************** - - Macro: SetIE - - Syntax: void SetIE(ie InfoElement, L3INT Offset); - - Description: Set an information element. - -*****************************************************************************/ -#define Q931SetIE(x,o) { x = (ie)(o) | 0x8000; } - -/***************************************************************************** - - Macro: IsQ931Ext - - Syntax BOOL IsQ931Ext(L3UCHAR c) - - Description: Return true Check if the msb (bit 8) is 0. This indicate - that the octet is extended. - -*****************************************************************************/ -#define IsQ931Ext(x) ((x & 0x80) == 0) - -/***************************************************************************** - - Macro: ieGetOctet - - Syntax: unsigned L3UCHAR ieGetOctet(L3INT e) - - Description: Macro to fetch one byte from an integer. Mostly used to - avoid warnings. - -*****************************************************************************/ -#define ieGetOctet(x) ((L3UCHAR)(x)) - -/***************************************************************************** - - Macro: NoWarning - - Syntax: void NoWarning(x) - - Description: Macro to suppress unreferenced formal parameter warnings - - Used during creation of the stack since the stack is - developed for Warning Level 4 and this creates a lot of - warning for the initial empty functions. - -*****************************************************************************/ -#define NoWarning(x) (x = x) - -/***************************************************************************** - - External references. See Q931.c for details. - -*****************************************************************************/ - -#include "Q931ie.h" - -#include "Q932.h" - -/***************************************************************************** - - Q.931 Message Pack/Unpack functions. Implemented in Q931mes.c - -*****************************************************************************/ -L3INT Q931Pmes_Alerting(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_CallProceeding(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Connect(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_ConnectAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Progress(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_SetupAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Resume(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_ResumeAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_ResumeReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Suspend(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_SuspendAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_SuspendReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_UserInformation(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Disconnect(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Release(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_ReleaseComplete(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Restart(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_RestartAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_CongestionControl(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Information(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Notify(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Segment(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Status(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_StatusEnquiry(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_Service(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931Pmes_ServiceAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); - - -L3INT Q931Umes_Alerting(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_CallProceeding(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Connect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_ConnectAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Progress(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_SetupAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Resume(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_ResumeAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_ResumeReject(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Suspend(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_SuspendAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_SuspendReject(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_UserInformation(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Disconnect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Release(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Restart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_RestartAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_CongestionControl(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Information(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Notify(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Segment(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Status(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_StatusEnquiry(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT I, L3INT O); -L3INT Q931Umes_Service(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size); -L3INT Q931Umes_ServiceAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size); - - -/***************************************************************************** - - Q.931 Process Function Prototyping. Implemented in Q931StateTE.c - -*****************************************************************************/ -L3INT Q931ProcAlertingTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcCallProceedingTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcConnectTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcConnectAckTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcProgressTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSetupTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSetupAckTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcResumeTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcResumeAckTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcResumeRejectTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSuspendTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSuspendAckTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSuspendRejectTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcUserInformationTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcDisconnectTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcReleaseTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcReleaseCompleteTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcRestartTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcRestartAckTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcCongestionControlTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcInformationTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcNotifyTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcStatusTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcStatusEnquiryTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSegmentTE(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); - -L3INT Q931ProcAlertingNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcCallProceedingNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcConnectNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcConnectAckNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcProgressNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSetupNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSetupAckNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcResumeNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcResumeAckNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcResumeRejectNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSuspendNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSuspendAckNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSuspendRejectNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcUserInformationNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcDisconnectNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcReleaseNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcReleaseCompleteNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcRestartNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcRestartAckNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcCongestionControlNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcInformationNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcNotifyNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcStatusNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcStatusEnquiryNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcSegmentNT(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); - -L3INT Q931ProcUnknownMessage(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); -L3INT Q931ProcUnexpectedMessage(Q931_TrunkInfo_t *pTrunk,L3UCHAR * b, L3INT iFrom); - -/***************************************************************************** - - Interface Function Prototypes. Implemented in Q931.c - -*****************************************************************************/ -void Q931TimerTick(Q931_TrunkInfo_t *pTrunk); -L3INT Q931Rx23(Q931_TrunkInfo_t *pTrunk, L3INT ind, L3UCHAR tei, L3UCHAR * Mes, L3INT Size); -L3INT Q931Tx32Data(Q931_TrunkInfo_t *pTrunk, L3UCHAR bcast, L3UCHAR * Mes, L3INT Size); -L3INT Q931Rx43(Q931_TrunkInfo_t *pTrunk, L3UCHAR * Mes, L3INT Size); -L3INT Q931Tx34(Q931_TrunkInfo_t *pTrunk, L3UCHAR * Mes, L3INT Size); -void Q931SetError(Q931_TrunkInfo_t *pTrunk,L3INT ErrID, L3INT ErrPar1, L3INT ErrPar2); - -void Q931SetDefaultErrorCB(Q931ErrorCB_t Q931ErrorPar); - -void Q931CreateTE(L3UCHAR i); -void Q931CreateNT(L3UCHAR i); -void Q931SetMesCreateCB(L3INT (*callback)(void)); -void Q931SetDialectCreateCB(L3INT (*callback)(L3INT)); -void Q931SetHeaderSpace(L3INT space); - -void Q931SetMesProc(L3UCHAR mes, L3UCHAR dialect, q931proc_func_t *Q931ProcFunc, q931umes_func_t *Q931UmesFunc, q931pmes_func_t *Q931PmesFunc); -void Q931SetIEProc(L3UCHAR iec, L3UCHAR dialect, q931pie_func_t *Q931PieProc, q931uie_func_t *Q931UieProc); -void Q931SetTimeoutProc(L3UCHAR dialect, L3UCHAR timer, q931timeout_func_t *Q931TimeoutProc); -void Q931SetTimerDefault(L3UCHAR dialect, L3UCHAR timer, q931timer_t timeout); - -void Q931Initialize(void); -void Q931AddDialect(L3UCHAR iDialect, void (*Q931CreateDialectCB)(L3UCHAR iDialect)); -L3INT Q931InitMesSetup(Q931mes_Generic *p); -L3INT Q931InitMesRestartAck(Q931mes_Generic * pMes); -L3INT Q931InitMesGeneric(Q931mes_Generic *pMes); - -L3INT Q931CreateCRV(Q931_TrunkInfo_t *pTrunk, L3INT * callIndex); -L3INT Q931ReleaseCRV(Q931_TrunkInfo_t *pTrunk, L3INT CRV); -L3INT Q931AllocateCRV(Q931_TrunkInfo_t *pTrunk, L3INT iCRV, L3INT * callIndex); -L3INT Q931FindCRV(Q931_TrunkInfo_t *pTrunk, L3INT crv, L3INT *callindex); -L3INT Q931GetCallState(Q931_TrunkInfo_t *pTrunk, L3INT iCRV); -L3INT Q931StartTimer(Q931_TrunkInfo_t *pTrunk, L3INT callIndex, L3USHORT iTimer); -L3INT Q931StopTimer(Q931_TrunkInfo_t *pTrunk, L3INT callindex, L3USHORT iTimer); -L3INT Q931SetState(Q931_TrunkInfo_t *pTrunk, L3INT callIndex, L3INT iState); -L3ULONG Q931GetTime(void); -void Q931SetGetTimeCB(L3ULONG (*callback)(void)); -void Q931AddStateEntry(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir); -L3BOOL Q931IsEventLegal(L3UCHAR iD, L3INT iState, L3INT iMes, L3UCHAR cDir); - -/***************************************************************************** - - Q.931 Low Level API Function Prototyping. Implemented in Q931API.c - -*****************************************************************************/ -ie Q931AppendIE(L3UCHAR *pm, L3UCHAR *pi); -L3INT Q931GetUniqueCRV(Q931_TrunkInfo_t *pTrunk); - -L3INT Q931InitIEBearerCap(Q931ie_BearerCap *p); -L3INT Q931InitIEChanID(Q931ie_ChanID *p); -L3INT Q931InitIEProgInd(Q931ie_ProgInd *p); -L3INT Q931InitIENetFac(Q931ie_NetFac * pIE); -L3INT Q931InitIEDisplay(Q931ie_Display * pIE); -L3INT Q931InitIEDateTime(Q931ie_DateTime * pIE); -L3INT Q931InitIEKeypadFac(Q931ie_KeypadFac * pIE); -L3INT Q931InitIESignal(Q931ie_Signal * pIE); -L3INT Q931InitIECallingNum(Q931ie_CallingNum * pIE); -L3INT Q931InitIECallingSub(Q931ie_CallingSub * pIE); -L3INT Q931InitIECalledNum(Q931ie_CalledNum * pIE); -L3INT Q931InitIECalledSub(Q931ie_CalledSub * pIE); -L3INT Q931InitIETransNetSel(Q931ie_TransNetSel * pIE); -L3INT Q931InitIELLComp(Q931ie_LLComp * pIE); -L3INT Q931InitIEHLComp(Q931ie_HLComp * pIE); - -L3INT Q931Disconnect(Q931_TrunkInfo_t *pTrunk, L3INT iTo, L3INT iCRV, L3INT iCause); -L3INT Q931ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf); -L3INT Q931AckRestart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf); -L3INT Q931AckConnect(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf); -L3INT Q931AckSetup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf); -L3INT Q931AckService(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf); - -L3INT Q931Api_InitTrunk(Q931_TrunkInfo_t *pTrunk, - Q931Dialect_t Dialect, - Q931NetUser_t NetUser, - Q931_TrunkType_t TrunkType, - Q931Tx34CB_t Q931Tx34CBProc, - Q931Tx32CB_t Q931Tx32CBProc, - Q931ErrorCB_t Q931ErrorCBProc, - void *PrivateData32, - void *PrivateData34); - -L3INT Q931GetMesSize(Q931mes_Generic *pMes); -L3INT Q931InitMesResume(Q931mes_Generic * pMes); - -L3INT Q931Log(Q931_TrunkInfo_t *trunk, Q931LogLevel_t level, const char *fmt, ...); -void Q931SetLogCB(Q931_TrunkInfo_t *trunk, Q931LogCB_t func, void *priv); -void Q931SetLogLevel(Q931_TrunkInfo_t *trunk, Q931LogLevel_t level); - -void Q931SetL4HeaderSpace(L3INT space); -void Q931SetL2HeaderSpace(L3INT space); -L3INT Q931ProcDummy(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b,L3INT c); -L3INT Q931UmesDummy(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); -L3INT Q931UieDummy(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931PmesDummy(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q931PieDummy(Q931_TrunkInfo_t *pTrunk,L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931TxDummy(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT n); -L3INT Q931ErrorDummy(void *priv, L3INT a, L3INT b, L3INT c); -L3INT Q931TimeoutDummy(Q931_TrunkInfo_t *pTrunk, L3INT callIndex); - -L3INT Q931MesgHeader(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *mes, L3UCHAR *OBuf, L3INT Size, L3INT *IOff); - -#endif /* _Q931_NL */ diff --git a/libs/freetdm/src/isdn/include/Q931ie.h b/libs/freetdm/src/isdn/include/Q931ie.h deleted file mode 100644 index 65dba4e261..0000000000 --- a/libs/freetdm/src/isdn/include/Q931ie.h +++ /dev/null @@ -1,1205 +0,0 @@ -/****************************************************************************** - - FileName: Q931ie.h - - Contents: Header and definition for the ITU-T Q.931 ie - structures and functions - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -******************************************************************************/ - -#ifndef _Q931IE_NL -#define _Q931IE_NL - -/* Codesets */ - -typedef enum { - - Q931_CODESET_0 = ( 0 ), - Q931_CODESET_1 = ( 1 << 8 ), - Q931_CODESET_2 = ( 2 << 8 ), - Q931_CODESET_3 = ( 3 << 8 ), - Q931_CODESET_4 = ( 4 << 8 ), - Q931_CODESET_5 = ( 5 << 8 ), - Q931_CODESET_6 = ( 6 << 8 ), - Q931_CODESET_7 = ( 7 << 8 ) - -} q931_codeset_t; - -/* Single octet information elements */ -#define Q931ie_SHIFT 0x90 /* 1001 ---- */ -#define Q931ie_MORE_DATA 0xa0 /* 1010 ---- */ -#define Q931ie_SENDING_COMPLETE 0xa1 /* 1010 0001 */ -#define Q931ie_CONGESTION_LEVEL 0xb0 /* 1011 ---- */ -#define Q931ie_REPEAT_INDICATOR 0xd0 /* 1101 ---- */ - -/* Variable Length Information Elements */ -#define Q931ie_SEGMENTED_MESSAGE 0x00 /* 0000 0000 */ -#define Q931ie_CHANGE_STATUS 0x01 /* 0000 0001 */ -#define Q931ie_BEARER_CAPABILITY 0x04 /* 0000 0100 */ -#define Q931ie_CAUSE 0x08 /* 0000 1000 */ -#define Q931ie_CALL_IDENTITY 0x10 /* 0001 0000 */ -#define Q931ie_CALL_STATE 0x14 /* 0001 0100 */ -#define Q931ie_CHANNEL_IDENTIFICATION 0x18 /* 0001 1000 */ -#define Q931ie_PROGRESS_INDICATOR 0x1e /* 0001 1110 */ -#define Q931ie_NETWORK_SPECIFIC_FACILITIES 0x20 /* 0010 0000 */ -#define Q931ie_NOTIFICATION_INDICATOR 0x27 /* 0010 0111 */ -#define Q931ie_DISPLAY 0x28 /* 0010 1000 */ -#define Q931ie_DATETIME 0x29 /* 0010 1001 */ -#define Q931ie_KEYPAD_FACILITY 0x2c /* 0010 1100 */ -#define Q931ie_SIGNAL 0x34 /* 0011 0100 */ -#define Q931ie_SWITCHOOK 0x36 /* 0011 0110 */ -#define Q931ie_FEATURE_ACTIVATION 0x38 /* 0011 1000 */ -#define Q931ie_FEATURE_INDICATION 0x39 /* 0011 1001 */ -#define Q931ie_INFORMATION_RATE 0x40 /* 0100 0000 */ -#define Q931ie_END_TO_END_TRANSIT_DELAY 0x42 /* 0100 0010 */ -#define Q931ie_TRANSIT_DELAY_SELECTION_AND_IND 0x43 /* 0100 0011 */ -#define Q931ie_PACKED_LAYER_BIMARY_PARAMETERS 0x44 /* 0100 0100 */ -#define Q931ie_PACKED_LAYER_WINDOW_SIZE 0x45 /* 0100 0101 */ -#define Q931ie_PACKED_SIZE 0x46 /* 0100 0110 */ -#define Q931ie_CALLING_PARTY_NUMBER 0x6c /* 0110 1100 */ -#define Q931ie_CALLING_PARTY_SUBADDRESS 0x6d /* 0110 1101 */ -#define Q931ie_CALLED_PARTY_NUMBER 0x70 /* 0111 0000 */ -#define Q931ie_CALLED_PARTY_SUBADDRESS 0x71 /* 0111 0001 */ -#define Q931ie_REDIRECTING_NUMBER 0x74 /* 0111 0100 */ -#define Q931ie_TRANSIT_NETWORK_SELECTION 0x78 /* 0111 1000 */ -#define Q931ie_RESTART_INDICATOR 0x79 /* 0111 1001 */ -#define Q931ie_LOW_LAYER_COMPATIBILITY 0x7c /* 0111 1100 */ -#define Q931ie_HIGH_LAYER_COMPATIBILITY 0x7d /* 0111 1101 */ -#define Q931ie_USER_USER 0x7e /* 0111 1110 */ -#define Q931ie_ESCAPE_FOR_EX 0x7f /* 0111 1111 */ - -/* Variable Length Codeset 6 Information Elements */ -#define Q931ie_GENERIC_DIGITS 0x37 /* 0011 0111 */ - -/* Variable Length Information Element to shut up BRI testing */ -#define Q931ie_CONNECTED_NUMBER 0x4c /* 0100 1101 */ -#define Q931ie_FACILITY 0x1c /* 0001 1101 */ - - -/***************************************************************************** - - Struct: Q931ie_BearerCap - - Description: Bearer Capability Information Element. - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00000100 for Bearer Capability */ - L3UCHAR Size; /* Length of Information Element */ - - L3UCHAR CodStand; /* Coding Standard. */ - /* 00 - ITU-T */ - /* 01 - ISO/IEC */ - /* 10 - National standard */ - /* 11 - Network side spesific */ - - L3UCHAR ITC; /* Information Transfer Capability */ - /* 00000 - Speech */ - /* 01000 - Unrestricted digital info */ - /* 01001 - Restricted digital info */ - /* 10000 - 3.1 kHz audio */ - /* 10001 - Unrestricted with tones */ - /* 11000 - Video */ - - L3UCHAR TransMode; /* Transfer Mode. */ - /* 00 - Circuit mode */ - /* 10 - Packet mode */ - - L3UCHAR ITR; /* Information Transfer Rate. */ - /* 00000 - Packed mode */ - /* 10000 - 64 kbit/s */ - /* 10001 - 2 x 64 kbit/s */ - /* 10011 - 384 kbit/s */ - /* 10101 - 1536 kbit/s */ - /* 10111 - 1920 kbit/s */ - /* 11000 - Multirat (64 kbit/s base) */ - - L3UCHAR RateMul; /* Rate Multiplier */ - - L3UCHAR Layer1Ident; /* Layer 1 Ident. */ - - L3UCHAR UIL1Prot; /* User Information Layer 1 Protocol */ - /* 00001 : ITU-T V.110, I.460 and X.30 */ - /* 00010 : G.711 my-law */ - /* 00011 : G.711 A-law */ - /* 00100 : G.721 */ - /* 00101 : H.221 and H.242 */ - /* 00110 : H.223 and H.245 */ - /* 00111 : Non ITU-T Standard */ - /* 01000 : ITU-T V.120 */ - /* 01001 : ITU-T X.31 HDLC flag stuff. */ - - L3UCHAR SyncAsync; /* Sync/Async */ - /* 0 : Syncronous data */ - /* 1 : Asyncronous data */ - - L3UCHAR Negot; /* Negotiation */ - /* 0 : In-band negotiation not possib. */ - /* 1 : In-band negotiation possible */ - - L3UCHAR UserRate; /* User rate */ - /* 00000 : I.460, V.110, X,30 */ - /* 00001 : 0.6 kbit/s x.1 */ - /* 00010 : 1.2 kbit/s */ - /* 00011 : 2.4 kbit/s */ - /* 00100 : 3.6 kbit/s */ - /* 00101 : 4.8 kbit/s */ - /* 00110 : 7.2 kbit/s */ - /* 00111 : 8 kbit/s I.460 */ - /* 01000 : 9.6 kbit/s */ - /* 01001 : 14.4 kbit/s */ - /* 01010 : 16 kbit/s */ - /* 01011 : 19.2 kbit/s */ - /* 01100 : 32 kbit/s */ - /* 01101 : 38.4 kbit/s */ - /* 01110 : 48 kbit/s */ - /* 01111 : 56 kbit/s */ - /* 10000 : 57.6 kbit/s */ - /* 10010 : 28.8 kbit/s */ - /* 10100 : 24 kbit/s */ - /* 10101 : 0.1345 kbit/s */ - /* 10110 : 0.100 kbit/s */ - /* 10111 : 0.075/1.2 kbit/s */ - /* 11000 : 1.2/0.075/kbit/s */ - /* 11001 : 0.050 kbit/s */ - /* 11010 : 0.075 kbit/s */ - /* 11011 : 0.110 kbit/s */ - /* 11100 : 0.150 kbit/s */ - /* 11101 : 0.200 kbit/s */ - /* 11110 : 0.300 kbit/s */ - /* 11111 : 12 kbit/s */ - - L3UCHAR InterRate; /* Intermediate Rate */ - /* 00 : Not used */ - /* 01 : 8 kbit/s */ - /* 10 : 16 kbit/s */ - /* 11 : 32 kbit/s */ - - L3UCHAR NIConTx; /* Network Indepentend Clock on transmit*/ - /* 0 : Not required to send data clc */ - /* 1 : Send data w/NIC clc */ - - L3UCHAR NIConRx; /* NIC on Rx */ - /* 0 : Cannot accept indep. clc */ - /* 1 : data with indep. clc accepted */ - - L3UCHAR FlowCtlTx; /* Flow control on Tx */ - /* 0 : Send Flow ctrl not required */ - /* 1 : Send flow ctrl required */ - - L3UCHAR FlowCtlRx; /* Flow control on Rx */ - /* 0 : cannot use receive flow ctrl */ - /* 1 : Receive flow ctrl accepted */ - L3UCHAR HDR; /* HDR/No HDR */ - L3UCHAR MultiFrame; /* Multi frame support */ - /* 0 : multiframe not supported */ - /* 1 : multiframe supported */ - - L3UCHAR Mode; /* Mode of operation */ - /* 0 : bit transparent mode of operat. */ - /* 1 : protocol sesitive mode of op. */ - - L3UCHAR LLInegot; /* Logical link id negotiation (oct. 5b)*/ - /* 0 : default LLI=256 only */ - /* 1 : Full protocol negotiation */ - - L3UCHAR Assignor; /* Assignor/assignee */ - /* 0 : Default Asignee */ - /* 1 : Assignor only */ - - L3UCHAR InBandNeg; /* In-band/out-band negot. */ - /* 0 : negot done w/ USER INFO mes */ - /* 1 : negot done in-band w/link zero */ - - L3UCHAR NumStopBits; /* Number of stop bits */ - /* 00 : Not used */ - /* 01 : 1 bit */ - /* 10 : 1.5 bits */ - /* 11 : 2 bits */ - - L3UCHAR NumDataBits; /* Number of data bits. */ - /* 00 : not used */ - /* 01 : 5 bits */ - /* 10 : 7 bits */ - /* 11 : 8 bits */ - - L3UCHAR Parity; /* Parity Information */ - /* 000 : Odd */ - /* 010 : Even */ - /* 011 : None */ - /* 100 : Forced to 0 */ - /* 101 : Forced to 1 */ - - L3UCHAR DuplexMode; /* Mode duplex */ - /* 0 : Half duplex */ - /* 1 : Full duplex */ - - L3UCHAR ModemType; /* Modem type, see Q.931 p 64 */ - - L3UCHAR Layer2Ident; /* Layer 2 Ident */ - - L3UCHAR UIL2Prot; /* User Information Layer 2 Protocol */ - /* 00010 : Q.921/I.441 */ - /* 00110 : X.25 */ - /* 01100 : LAN logical link */ - - L3UCHAR Layer3Ident; /* Layer 3 ident. */ - - L3UCHAR UIL3Prot; /* User Information Layer 3 Protocol */ - /* 00010 : Q.931 */ - /* 00110 : X.25 */ - /* 01011 : ISO/IEC TR 9577 */ - - L3UCHAR AL3Info1; /* additional layer 3 info 1 */ - - L3UCHAR AL3Info2; /* additional layer 3 info 2 */ - -} Q931ie_BearerCap; - -/***************************************************************************** - - Struct: Q931ie_CallID - - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00010000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR CallId[1]; /* Call identity */ - -} Q931ie_CallID; - -/***************************************************************************** - - Struct: Q931ie_CallState - - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00010100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR CodStand; /* Coding Standard */ - L3UCHAR CallState; /* Call State Value */ - -} Q931ie_CallState; - -/***************************************************************************** - - Struct: Q931ie_Cause - - Description: Cause IE as described in Q.850 - -*****************************************************************************/ -typedef struct { - - L3UCHAR IEId; /* 00010100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR CodStand; /* Coding Standard */ - L3UCHAR Location; /* Location */ - L3UCHAR Recom; /* Recommendation */ - L3UCHAR Value; /* Cause Value */ - L3UCHAR Diag[1]; /* Optional Diagnostics Field */ - -} Q931ie_Cause; - -/***************************************************************************** - - Struct: Q931ie_CalledNum - -*****************************************************************************/ -typedef struct { - - L3UCHAR IEId; /* 01110000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR TypNum; /* Type of Number */ - L3UCHAR NumPlanID; /* Numbering plan identification */ - L3UCHAR Digit[1]; /* Digit (IA5) */ - -} Q931ie_CalledNum; - -/***************************************************************************** - - Struct: Q931ie_CalledSub - - Description: Called party subaddress - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 01110001 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR TypNum; /* Type of subaddress */ - L3UCHAR OddEvenInd; /* Odd/Even indicator */ - L3UCHAR Digit[1]; /* digits */ - -} Q931ie_CalledSub; - -/***************************************************************************** - - Struct: Q931ie_CallingNum - - Description: Calling party number - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 01101100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR TypNum; /* Type of number */ - L3UCHAR NumPlanID; /* Numbering plan identification */ - L3UCHAR PresInd; /* Presentation indicator */ - L3UCHAR ScreenInd; /* Screening indicator */ - L3UCHAR Digit[1]; /* Number digits (IA5) */ - -} Q931ie_CallingNum; - -/***************************************************************************** - - Struct: Q931ie_CallingSub - - Description: Calling party subaddress - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 01101101 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR TypNum; /* Type of subaddress */ - L3UCHAR OddEvenInd; /* Odd/Even indicator */ - L3UCHAR Digit[1]; /* digits */ - -} Q931ie_CallingSub; - -/***************************************************************************** - - Struct: Q931ie_ChanID - - Description: Channel identification - - Channel Identificationis one of the IE elements that differ - between BRI and PRI. IntType = 1 = BRI and ChanSlot is used - for channel number, while InfoChanSel is used for BRI. - - ChanID is one of the most important IE as it is passed - either though SETUP or CALL PROCEEDING to select the channel - to be used. - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00011000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR IntIDPresent; /* Int. id. present */ - L3UCHAR IntType; /* Interface Type */ - /* 0 : Basic Interface (BRI) */ - /* 1 : Other interfaces, PRI etc. */ - - L3UCHAR PrefExcl; /* Pref./Excl. */ - /* 0 : Indicated channel is preffered */ - /* 1 : Exclusive, no other accepted */ - - L3UCHAR DChanInd; /* D-channel ind. */ - /* 0 : chan is NOT D chan. */ - /* 1 : chan is D chan */ - - L3UCHAR InfoChanSel; /* Info. channel selection */ - /* 00 : No channel */ - /* 01 : B1 channel */ - /* 10 : B2 channel */ - /* 11 : Any channel */ - - L3UCHAR InterfaceID; /* Interface identifier */ - - L3UCHAR CodStand; /* Code standard */ - /* 00 : ITU-T standardization coding */ - /* 01 : ISO/IEC Standard */ - /* 10 : National Standard */ - /* 11 : Standard def. by network. */ - - L3UCHAR NumMap; /* Number/Map */ - /* 0 : chan is in following octet */ - /* 1 : chan is indicated by slot map */ - - L3UCHAR ChanMapType; /* Channel type/Map element type */ - /* 0011 : B Channel units */ - /* 0110 : H0 channel units */ - /* 1000 : H11 channel units */ - /* 1001 : H12 channel units */ - - L3UCHAR ChanSlot; /* Channel number */ - -} Q931ie_ChanID; - -/***************************************************************************** - - Struct: Q931ie_DateTime - - Description: Date/time - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00101001 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR Year; /* Year */ - L3UCHAR Month; /* Month */ - L3UCHAR Day; /* Day */ - L3UCHAR Hour; /* Hour */ - L3UCHAR Minute; /* Minute */ - L3UCHAR Second; /* Second */ - L3UCHAR Format; /* Indicate presense of Hour, Min & sec */ - /* 0 : Only Date */ - /* 1 : Hour present */ - /* 2 : Hour and Minute present */ - /* 3 : Hour, Minute and Second present */ -} Q931ie_DateTime; - -/***************************************************************************** - - Struct: Q931ie_Display - - Description: Display - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00101000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR Display[1]; /* Display information (IA5) */ - -} Q931ie_Display; - -/***************************************************************************** - - Struct: Q931ie_HLComp - - Description: High layer compatibility - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 01111101 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR CodStand; /* Coding standard */ - L3UCHAR Interpret; /* Interpretation */ - L3UCHAR PresMeth; /* Presentation methor of prot. profile */ - L3UCHAR HLCharID; /* High layer characteristics id. */ - L3UCHAR EHLCharID; /* Extended high layer character. id. */ - L3UCHAR EVideoTlfCharID; /* Ext. videotelephony char. id. */ - -} Q931ie_HLComp; - -/***************************************************************************** - - Struct: Q931ie_KeypadFac - - Description: Keypad facility - -*****************************************************************************/ - -typedef struct { - L3UCHAR IEId; /* 00101100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR KeypadFac[1]; /* dynamic buffer */ - -} Q931ie_KeypadFac; - -/***************************************************************************** - - Struct: Q931ie_LLComp - - Description: Low layer compatibility - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 01111100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR CodStand; /* Coding standard */ - /* 00 - ITU-T */ - /* 01 - ISO/IEC */ - /* 10 - National standard */ - /* 11 - Network side spesific */ - - L3UCHAR ITransCap; /* Information transfer capability */ - /* 00000 - Speech */ - /* 01000 - Unrestricted digital info */ - /* 01001 - Restricted digital info */ - /* 10000 - 3.1 kHz audio */ - /* 10001 - Unrestricted with tones */ - /* 11000 - Video */ - - L3UCHAR NegotInd; /* Negot indic. */ - /* 0 : Out-band neg. not possib. */ - /* 1 : Out-band neg. possible */ - - L3UCHAR TransMode; /* Transfer Mode */ - /* 00 : Circuit Mode */ - /* 10 : Packed Mode */ - - L3UCHAR InfoRate; /* Information transfer rate */ - /* 00000 - Packed mode */ - /* 10000 - 64 kbit/s */ - /* 10001 - 2 x 64 kbit/s */ - /* 10011 - 384 kbit/s */ - /* 10101 - 1536 kbit/s */ - /* 10111 - 1920 kbit/s */ - /* 11000 - Multirat (64 kbit/s base) */ - - L3UCHAR RateMul; /* Rate multiplier */ - L3UCHAR Layer1Ident; /* Layer 1 ident. */ - L3UCHAR UIL1Prot; /* User information layer 1 protocol */ - /* 00001 : ITU-T V.110, I.460 and X.30 */ - /* 00010 : G.711 my-law */ - /* 00011 : G.711 A-law */ - /* 00100 : G.721 */ - /* 00101 : H.221 and H.242 */ - /* 00110 : H.223 and H.245 */ - /* 00111 : Non ITU-T Standard */ - /* 01000 : ITU-T V.120 */ - /* 01001 : ITU-T X.31 HDLC flag stuff. */ - - L3UCHAR SyncAsync; /* Synch/asynch */ - /* 0 : Syncronous data */ - /* 1 : Asyncronous data */ - - L3UCHAR Negot; /* Negot */ - /* 0 : In-band negotiation not possib. */ - /* 1 : In-band negotiation possible */ - - L3UCHAR UserRate; /* User rate */ - /* 00000 : I.460, V.110, X,30 */ - /* 00001 : 0.6 kbit/s x.1 */ - /* 00010 : 1.2 kbit/s */ - /* 00011 : 2.4 kbit/s */ - /* 00100 : 3.6 kbit/s */ - /* 00101 : 4.8 kbit/s */ - /* 00110 : 7.2 kbit/s */ - /* 00111 : 8 kbit/s I.460 */ - /* 01000 : 9.6 kbit/s */ - /* 01001 : 14.4 kbit/s */ - /* 01010 : 16 kbit/s */ - /* 01011 : 19.2 kbit/s */ - /* 01100 : 32 kbit/s */ - /* 01101 : 38.4 kbit/s */ - /* 01110 : 48 kbit/s */ - /* 01111 : 56 kbit/s */ - /* 10000 : 57.6 kbit/s */ - /* 10010 : 28.8 kbit/s */ - /* 10100 : 24 kbit/s */ - /* 10101 : 0.1345 kbit/s */ - /* 10110 : 0.100 kbit/s */ - /* 10111 : 0.075/1.2 kbit/s */ - /* 11000 : 1.2/0.075/kbit/s */ - /* 11001 : 0.050 kbit/s */ - /* 11010 : 0.075 kbit/s */ - /* 11011 : 0.110 kbit/s */ - /* 11100 : 0.150 kbit/s */ - /* 11101 : 0.200 kbit/s */ - /* 11110 : 0.300 kbit/s */ - /* 11111 : 12 kbit/s */ - - L3UCHAR InterRate; /* Intermediate rate */ - /* 00 : Not used */ - /* 01 : 8 kbit/s */ - /* 10 : 16 kbit/s */ - /* 11 : 32 kbit/s */ - - L3UCHAR NIConTx; /* Network Indepentend Clock on transmit*/ - /* 0 : Not required to send data clc */ - /* 1 : Send data w/NIC clc */ - - L3UCHAR NIConRx; /* NIC on Rx */ - /* 0 : Cannot accept indep. clc */ - /* 1 : data with indep. clc accepted */ - - L3UCHAR FlowCtlTx; /* Flow control on Tx */ - /* 0 : Send Flow ctrl not required */ - /* 1 : Send flow ctrl required */ - - L3UCHAR FlowCtlRx; /* Flow control on Rx */ - /* 0 : cannot use receive flow ctrl */ - /* 1 : Receive flow ctrl accepted */ - L3UCHAR HDR; /* HDR/No HDR */ - L3UCHAR MultiFrame; /* Multi frame support */ - /* 0 : multiframe not supported */ - /* 1 : multiframe supported */ - - L3UCHAR ModeL1; /* Mode L1 */ - /* 0 : bit transparent mode of operat. */ - /* 1 : protocol sesitive mode of op. */ - - L3UCHAR NegotLLI; /* Negot. LLI */ - /* 0 : default LLI=256 only */ - /* 1 : Full protocol negotiation */ - - L3UCHAR Assignor; /* Assignor/Assignor ee */ - /* 0 : Default Asignee */ - /* 1 : Assignor only */ - - L3UCHAR InBandNeg; /* In-band negot. */ - /* 0 : negot done w/ USER INFO mes */ - /* 1 : negot done in-band w/link zero */ - - L3UCHAR NumStopBits; /* Number of stop bits */ - /* 00 : Not used */ - /* 01 : 1 bit */ - /* 10 : 1.5 bits */ - /* 11 : 2 bits */ - - L3UCHAR NumDataBits; /* Number of data bits. */ - /* 00 : not used */ - /* 01 : 5 bits */ - /* 10 : 7 bits */ - /* 11 : 8 bits */ - - L3UCHAR Parity; /* Parity Information */ - /* 000 : Odd */ - /* 010 : Even */ - /* 011 : None */ - /* 100 : Forced to 0 */ - /* 101 : Forced to 1 */ - - L3UCHAR DuplexMode; /* Mode duplex */ - /* 0 : Half duplex */ - /* 1 : Full duplex */ - - L3UCHAR ModemType; /* Modem type, see Q.931 p 89 */ - - L3UCHAR Layer2Ident; /* Layer 2 ident. */ - - L3UCHAR UIL2Prot; /* User information layer 2 protocol */ - /* 00001 : Basic mode ISO 1745 */ - /* 00010 : Q.921/I.441 */ - /* 00110 : X.25 single link */ - /* 00111 : X.25 multilink */ - /* 01000 : Extended LAPB T.71 */ - /* 01001 : HDLC ARM */ - /* 01010 : HDLC NRM */ - /* 01011 : HDLC ABM */ - /* 01100 : LAN logical link */ - /* 01101 : X.75 SLP */ - /* 01110 : Q.922 */ - /* 01111 : Q.922 core aspect */ - /* 10000 : User specified */ - /* 10001 : ISO/IEC 7776 DTE-DCE */ - - L3UCHAR ModeL2; /* Mode */ - /* 01 : Normal Mode of operation */ - /* 10 : Extended mode of operation */ - - L3UCHAR Q933use; /* Q.9333 use */ - - L3UCHAR UsrSpcL2Prot; /* User specified layer 2 protocol info */ - - L3UCHAR WindowSize; /* Window size (k) */ - - L3UCHAR Layer3Ident; /* Layer 3 ident */ - - L3UCHAR UIL3Prot; /* User Information Layer 3 protocol */ - /* 00010 : Q.931 */ - /* 00110 : X.25 */ - /* 00111 : 8208 */ - /* 01000 : X.233 ... */ - /* 01001 : 6473 */ - /* 01010 : T.70 */ - /* 01011 : ISO/IEC TR 9577 */ - /* 10000 : User specified */ - L3UCHAR OptL3Info; /* Optional Leyer 3 info */ - - L3UCHAR ModeL3; /* Mode of operation */ - /* 01 : Normal packed seq. numbering */ - /* 10 : Extended packed seq. numbering */ - - L3UCHAR DefPackSize; /* Default packet size */ - - L3UCHAR PackWinSize; /* Packet window size */ - - L3UCHAR AddL3Info; /* Additional Layer 3 protocol info */ - -} Q931ie_LLComp; - -/***************************************************************************** - - Struct: Q931ie_NetFac; - - Description: Network-specific facilities - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00100000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR LenNetID; /* Length of network facilities id. */ - L3UCHAR TypeNetID; /* Type of network identification */ - L3UCHAR NetIDPlan; /* Network identification plan. */ - L3UCHAR NetFac; /* Network specific facility spec. */ - L3UCHAR NetID[1]; /* Network id. (IA5) */ - -} Q931ie_NetFac; - -/***************************************************************************** - - Struct: Q931ie_NotifInd; - - Description: Notification Indicator - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00100000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR Notification; /* Notification descriptor */ - -} Q931ie_NotifInd; - -/***************************************************************************** - - Struct: Q931ie_ProgInd - - Description: Progress indicator - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00011110 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR CodStand; /* Coding standard */ - L3UCHAR Location; /* Location */ - L3UCHAR ProgDesc; /* Progress description */ - -} Q931ie_ProgInd; - -/***************************************************************************** - - Struct; Q931ie_Segment - - Description: Segmented message - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00000000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR FSI; /* First segment indicator */ - L3UCHAR NumSegRem; /* Number of segments remaining */ - L3UCHAR SegType; /* Segment message type */ - -} Q931ie_Segment; - - -typedef struct { - - L3UCHAR IEId; /* 00000000 */ - L3UCHAR Size; /* Length of Information Element */ - -} Q931ie_SendComplete; - -/***************************************************************************** - - Struct: Q931ie_Signal - - Description: Signal - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00000000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR Signal; /* Signal value */ - /* 00000000 Dial tone on */ - /* 00000001 Ring back tone on */ - /* 00000010 Intercept tone on */ - /* 00000011 Network congestion on */ - /* 00000100 Busy tone on */ - /* 00000101 Confirm tone on */ - /* 00000110 Answer tone on */ - /* 00000111 Call waiting tone */ - /* 00001000 Off-hook warning tone */ - /* 00001001 Pre-emption tone on */ - /* 00111111 Tones off */ - /* 01000000 Alerting on - pattern 0 */ - /* 01000001 Alerting on - pattern 1 */ - /* 01000010 Alerting on - pattern 2 */ - /* 01000011 Alerting on - pattern 3 */ - /* 01000100 Alerting on - pattern 4 */ - /* 01000101 Alerting on - pattern 5 */ - /* 01000110 Alerting on - pattern 6 */ - /* 01000111 Alerting on - pattern 7 */ - /* 01001111 Alerting off */ -} Q931ie_Signal; - -/***************************************************************************** - - Struct: Q931ie_TransDelSelInd - - description: Transit delay selection and indication - -*****************************************************************************/ -#ifdef Q931_X25_SUPPORT -typedef struct { - - L3UCHAR IEId; /* 00000000 */ - L3UCHAR Size; /* Length of Information Element */ - L3ULONG TxDSIValue; /* Trans. delay sel. & ind. value */ - -} Q931ie_TransDelSelInd; -#endif - -/***************************************************************************** - - Struct: Q931ie_TransNetSel - - Description: Transit network selection - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 01111000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR Type; /* Type of network identifier */ - L3UCHAR NetIDPlan; /* Network idetification plan */ - L3UCHAR NetID[1]; /* Network identification(IA5) */ - -} Q931ie_TransNetSel; - -/***************************************************************************** - - Struct: Q931ie_UserUser - - Description: User-user - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 01111110 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR ProtDisc; /* Protocol discriminator */ - L3UCHAR User[1]; /* User information */ - -} Q931ie_UserUser; - -/***************************************************************************** - - Struct: Q931ie_ClosedUserGrp - - Description: Closed user group - -*****************************************************************************/ -#ifdef Q931_X25_SUPPORT -typedef struct { - - L3UCHAR IEId; /* 01000111 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR CUGInd; /* CUG indication */ - L3UCHAR CUG[1]; /* CUG index code (IA5) */ - -} Q931ie_ClosedUserGrp; -#endif - -/***************************************************************************** - - Struct: Q931ie_CongLevel - - Description: Congestion Level - -*****************************************************************************/ -typedef struct { - - L3UCHAR IEId; /* 01000111 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR CongLevel; /* Conguestion Level */ - -} Q931ie_CongLevel; - -/***************************************************************************** - - Struct: Q931ie_EndEndTxDelay - - Description: End to end transit delay - -*****************************************************************************/ -#ifdef Q931_X25_SUPPORT -typedef struct { - - L3UCHAR IEId; /* 01000010 */ - L3UCHAR Size; /* Length of Information Element */ - L3ULONG CumTxDelay; /* Cumulative transit delay value */ - L3ULONG ReqTxDelay; /* Requested end to end transit delay */ - L3ULONG MaxTxDelay; /* Maximum transit delay */ - -} Q931ie_EndEndTxDelay; -#endif - -/***************************************************************************** - - Struct: Q931ie_InfoRate - - Description: Information Rate - -*****************************************************************************/ -#ifdef Q931_X25_SUPPORT -typedef struct { - - L3UCHAR IEId; /* 01100000 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR InInfoRate; /* Incoming information rate */ - L3UCHAR OutInfoRate; /* Outgoing information rate */ - L3UCHAR MinInInfoRate; /* Minimum incoming information rate */ - L3UCHAR MinOutInfoRate; /* Minimum outgoing information rate */ - -} Q931ie_InfoRate; -#endif - -/***************************************************************************** - - Struct: Q931ie_PackParam - - Description: Packed layer binary parameters - -*****************************************************************************/ -#ifdef Q931_X25_SUPPORT -typedef struct { - - L3UCHAR IEId; /* 01000100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR FastSel; /* Fast selected */ - L3UCHAR ExpData; /* Exp. data */ - L3UCHAR DelConf; /* Delivery conf */ - L3UCHAR Modulus; /* Modulus */ - -} Q931ie_PackParam; -#endif - -/***************************************************************************** - - Struct: Q931ie_PackWinSize - - Description: Packed window size - -*****************************************************************************/ -#ifdef Q931_X25_SUPPORT -typedef struct { - - L3UCHAR IEId; /* 01000101 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR ForwardValue; /* Forward value */ - L3UCHAR BackwardValue; /* Backward value */ - -} Q931ie_PackWinSize; -#endif - -/***************************************************************************** - - Struct: Q931ie_PackSize - - Description: Packet size - -*****************************************************************************/ -#ifdef Q931_X25_SUPPORT -typedef struct { - - L3UCHAR IEId; /* 01000110 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR ForwardValue; /* Forward value */ - L3UCHAR BackwardValue; /* Backward value */ - -} Q931ie_PackSize; -#endif - -/***************************************************************************** - - Struct: Q931ie_RedirNum - - Description: Redirecting number - -*****************************************************************************/ -#ifdef Q931_X25_SUPPORT -typedef struct { - - L3UCHAR IEId; /* 01110100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR TypeNum; /* Type of number */ - L3UCHAR NumPlanID; /* Number plan identification */ - L3UCHAR PresInd; /* Presentation indicator */ - L3UCHAR ScreenInd; /* Screening indicator */ - L3UCHAR Reason; /* Reason for redirection */ - L3UCHAR Digit[1]; /* Number digits (IA5) */ - -} Q931ie_RedirNum; -#endif - -typedef struct { - - L3UCHAR IEId; /* 01110100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR RepeatInd; /* 0010 Prioritized list for selecting */ - /* one possible. */ -} Q931ie_RepeatInd; - -typedef struct { - - L3UCHAR IEId; /* 01110100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR Spare; /* Spare */ - L3UCHAR Class; /* Class */ - /* 000 Indicate channels */ - /* 110 Single interface */ - /* 111 All interfaces */ -} Q931ie_RestartInd; - -typedef struct { - - L3UCHAR IEId; /* 01110100 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR Preference; /* Preference 0 = reserved, 1 = channel */ - L3UCHAR Spare; /* Spare */ - L3UCHAR NewStatus; /* NewStatus */ - /* 000 In service */ - /* 001 Maintenance */ - /* 010 Out of service */ -} Q931ie_ChangeStatus; - -/***************************************************************************** - - Struct: Q931ie_GenericDigits - - -*****************************************************************************/ - -typedef struct { - - L3UCHAR IEId; /* 00110111 */ - L3UCHAR Size; /* Length of Information Element */ - L3UCHAR Type; /* Type of number */ - L3UCHAR Encoding; /* Encoding of number */ - L3UCHAR Digit[1]; /* Number digits (IA5) */ - -} Q931ie_GenericDigits; - - -/***************************************************************************** - - Q.931 Information Element Pack/Unpack functions. Implemented in Q931ie.c - -*****************************************************************************/ -q931pie_func_t Q931Pie_ChangeStatus; -q931pie_func_t Q931Pie_BearerCap; -q931pie_func_t Q931Pie_ChanID; -q931pie_func_t Q931Pie_ProgInd; -q931pie_func_t Q931Pie_Display; -q931pie_func_t Q931Pie_Signal; -q931pie_func_t Q931Pie_HLComp; -q931pie_func_t Q931Pie_Segment; -q931pie_func_t Q931Pie_DateTime; -q931pie_func_t Q931Pie_Cause; -q931pie_func_t Q931Pie_SendComplete; -q931pie_func_t Q931Pie_KeypadFac; -q931pie_func_t Q931Pie_NotifInd; -q931pie_func_t Q931Pie_CallID; -q931pie_func_t Q931Pie_RepeatInd; -q931pie_func_t Q931Pie_NetFac; -q931pie_func_t Q931Pie_CallingNum; -q931pie_func_t Q931Pie_CallingSub; -q931pie_func_t Q931Pie_CalledNum; -q931pie_func_t Q931Pie_CalledSub; -q931pie_func_t Q931Pie_CalledNum; -q931pie_func_t Q931Pie_TransNetSel; -q931pie_func_t Q931Pie_LLComp; -q931pie_func_t Q931Pie_CallState; -q931pie_func_t Q931Pie_RestartInd; -q931pie_func_t Q931Pie_UserUser; - -q931pie_func_t Q931Pie_GenericDigits; - -L3USHORT Q931Uie_CRV(Q931_TrunkInfo_t *pTrunk,L3UCHAR * IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff); - -q931uie_func_t Q931Uie_ChangeStatus; -q931uie_func_t Q931Uie_BearerCap; -q931uie_func_t Q931Uie_ChanID; -q931uie_func_t Q931Uie_ProgInd; -q931uie_func_t Q931Uie_Display; -q931uie_func_t Q931Uie_Signal; -q931uie_func_t Q931Uie_HLComp; -q931uie_func_t Q931Uie_Segment; -q931uie_func_t Q931Uie_DateTime; -q931uie_func_t Q931Uie_Cause; -q931uie_func_t Q931Uie_SendComplete; -q931uie_func_t Q931Uie_KeypadFac; -q931uie_func_t Q931Uie_NotifInd; -q931uie_func_t Q931Uie_CallID; -q931uie_func_t Q931Uie_RepeatInd; -q931uie_func_t Q931Uie_NetFac; -q931uie_func_t Q931Uie_CallingNum; -q931uie_func_t Q931Uie_CallingSub; -q931uie_func_t Q931Uie_CalledNum; -q931uie_func_t Q931Uie_CalledSub; -q931uie_func_t Q931Uie_TransNetSel; -q931uie_func_t Q931Uie_LLComp; -q931uie_func_t Q931Uie_CallState; -q931uie_func_t Q931Uie_RestartInd; -q931uie_func_t Q931Uie_UserUser; - -q931uie_func_t Q931Uie_GenericDigits; - - -L3INT Q931ReadExt(L3UCHAR * IBuf, L3INT Off); -L3INT Q931Uie_CongLevel(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Pie_CongLevel(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); -L3INT Q931Uie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR * IBuf, L3UCHAR * OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Pie_RevChargeInd(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); - -L3INT Q931Uie_Generic(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *IOff, L3INT *OOff); -L3INT Q931Pie_Generic(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, L3UCHAR *OBuf, L3INT *Octet); - -#endif /* _Q931IE_NL */ diff --git a/libs/freetdm/src/isdn/include/Q932.h b/libs/freetdm/src/isdn/include/Q932.h deleted file mode 100644 index 9b69a34a02..0000000000 --- a/libs/freetdm/src/isdn/include/Q932.h +++ /dev/null @@ -1,95 +0,0 @@ -/***************************************************************************** - - FileName: Q932.h - - Contents: Header w/structs for Q932 Suplementary Services. - - NB: Do NOT include this header directly, include Q931.h - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -/***************************************************************************** - Q.932 Additional Message codes -*****************************************************************************/ - -#define Q932mes_HOLD 0x24 /* 0010 0100 */ -#define Q932mes_HOLD_ACKNOWLEDGE 0x28 /* 0010 1000 */ -#define Q932mes_HOLD_REJECT 0x30 /* 0011 0000 */ -#define Q932mes_RETRIEVE 0x31 /* 0011 0001 */ -#define Q932mes_RETRIEVE_ACKNOWLEDGE 0x33 /* 0011 0011 */ -#define Q932mes_RETRIEVE_REJECT 0x37 /* 0011 0111 */ -#define Q932mes_FACILITY 0x62 /* 0110 0010 */ -#define Q932mes_REGISTER 0x64 /* 0110 0100 */ - -/***************************************************************************** - Q.932 Additional EI Codes -*****************************************************************************/ -#define Q932ie_FACILITY 0x1c /* 0001 1100 */ - -/***************************************************************************** - Function Prototypes. -*****************************************************************************/ -L3INT Q932ProcFacilityTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcHoldTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcHoldAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcHoldRejectTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcRegisterTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcRetrieveTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcRetrieveAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcRetrieveRejectTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); - -L3INT Q932ProcFacilityNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcHoldNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcHoldAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcHoldRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcRegisterNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcRetrieveNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcRetrieveAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); -L3INT Q932ProcRetrieveRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * b, L3INT iFrom); - -L3INT Q932Pmes_Facility(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q932Pmes_Hold(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q932Pmes_HoldAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q932Pmes_HoldReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q932Pmes_Register(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q932Pmes_Retrieve(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q932Pmes_RetrieveAck(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); -L3INT Q932Pmes_RetrieveReject(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); - -L3INT Q932Umes_Facility(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * OBuf, L3INT I, L3INT O); -L3INT Q932Umes_Hold(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * OBuf, L3INT I, L3INT O); -L3INT Q932Umes_HoldAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * OBuf, L3INT I, L3INT O); -L3INT Q932Umes_HoldReject(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * OBuf, L3INT I, L3INT O); -L3INT Q932Umes_Register(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * OBuf, L3INT I, L3INT O); -L3INT Q932Umes_Retrieve(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * OBuf, L3INT I, L3INT O); -L3INT Q932Umes_RetrieveAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * OBuf, L3INT I, L3INT O); -L3INT Q932Umes_RetrieveReject(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic * OBuf, L3INT I, L3INT O); diff --git a/libs/freetdm/src/isdn/include/mfifo.h b/libs/freetdm/src/isdn/include/mfifo.h deleted file mode 100644 index 4c1d850d81..0000000000 --- a/libs/freetdm/src/isdn/include/mfifo.h +++ /dev/null @@ -1,85 +0,0 @@ -/***************************************************************************** - - Filename: mfifo.h - - Contents: header for MFIFO - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ -#ifndef _MFIFO -#define _MFIFO - -/***************************************************************************** - - Struct: MINDEX - - Description: Message Index used to index a dynamic size Message FIFO. - -*****************************************************************************/ -typedef struct _mindex { - int offset; /* offset to message in buf */ - int size; /* size of message in bytes */ -} MINDEX; - -/***************************************************************************** - - Struct: MFIFO - - Description: Message FIFO. Provides a dynamic sized message based FIFO - queue. - -*****************************************************************************/ -typedef struct { - int first; /* first out */ - int last; /* last in + 1 */ - int bsize; /* buffer size */ - unsigned char *buf; /* ptr to start of buffer */ - int ixsize; /* index size */ - MINDEX ix[1]; /* message index */ -} MFIFO; - -/***************************************************************************** - Function prototypes. -*****************************************************************************/ -int MFIFOCreate(unsigned char *buf, int size, int index); -void MFIFOClear(unsigned char * buf); -int MFIFOGetLBOffset(unsigned char *buf); -int MFIFOGetFBOffset(unsigned char *buf); -void MFIFOWriteIX(unsigned char *buf, unsigned char *mes, int size, int ix, int off); -int MFIFOWriteMes(unsigned char *buf, unsigned char *mes, int size); -unsigned char * MFIFOGetMesPtr(unsigned char *buf, int *size); -void MFIFOKillNext(unsigned char *buf); - -unsigned char * MFIFOGetMesPtrOffset(unsigned char *buf, int *size, const int pos); -int MFIFOGetMesCount(unsigned char *buf); -int MFIFOWriteMesOverwrite(unsigned char *buf, unsigned char *mes, int size); - -#endif diff --git a/libs/freetdm/src/isdn/include/national.h b/libs/freetdm/src/isdn/include/national.h deleted file mode 100644 index cff26aa4a4..0000000000 --- a/libs/freetdm/src/isdn/include/national.h +++ /dev/null @@ -1,86 +0,0 @@ -/****************************************************************************** - - FileName: national.h - - Contents: Header and definition for the National ISDN dialect. The - header contents the following parts: - - Definition of codes - - Definition of information elements (nationalie_). - - Definition of messages (nationalmes_). - - Function prototypes. - - Description: The National ISDN dialect here covers ???? - - Related Files: national.h National ISDN Definitions - nationalie.c National ISDN IE encoders/coders - nationalStateTE.c National ISDN TE State Engine - nationalStateNT.c National ISDN NT State Engine - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -******************************************************************************/ - -#ifndef _national_NATIONAL_NL -#define _national_NATIONAL_NL - -#include "Q931.h" - -/***************************************************************************** - - Q.931 Message codes - Only National specific message and ie types - here the rest are inherited from national.h - -*****************************************************************************/ - - -/***************************************************************************** - - Q.931 Message Pack/Unpack functions. Implemented in nationalmes.c - -*****************************************************************************/ -L3INT nationalUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); -L3INT nationalPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); - -#include "DMS.h" - -/***************************************************************************** - - Q.931 Process Function Prototyping. Implemented in nationalStateTE.c - -*****************************************************************************/ - -void nationalCreateTE(L3UCHAR i); -void nationalCreateNT(L3UCHAR i); - -#endif /* _national_NATIONAL_NL */ diff --git a/libs/freetdm/src/isdn/mfifo.c b/libs/freetdm/src/isdn/mfifo.c deleted file mode 100644 index 28528f9b64..0000000000 --- a/libs/freetdm/src/isdn/mfifo.c +++ /dev/null @@ -1,399 +0,0 @@ -/***************************************************************************** - - Filename: mfifo.c - - Description: mfifo is a message orriented fifo system with support of - both message and byte per byte retriaval of messages. - - The fifo has been designed with two usages in mind: - - - Queueing of frames for hdlc and feeding out byte per byte - with the possibility of re-sending of frames etc. - - - fifo for messages of dynamic size. - - The fifo is allocated on top of any buffer and creates an - index of message in the queue. The user can write/read - messages or write messages and read the message one byte - at the time. - - Interface: - MFIFOCreate Create/reset/initialize fifo. - MFIFOClear Clear FIFO. - MFIFOWriteMes Write message into fifo - * MFIFOReadMes Read message from fifo. - MFIFOGetMesPtr Get ptr to next message. - MFIFOKillNext Kill next message. - - * currently not implemented. - - Note: The message will always be saved continuously. If there is not - sufficient space at the end of the buffer, the fifo will skip - the last bytes and save the message at the top of the buffer. - - This is required to allow direct ptr access to messages - stored in the queue. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "mfifo.h" -#include -#include - -/***************************************************************************** - - Function: MFIFOCreate - - Description: Creates a fifo on top of an existing buffer. - - Parameters: buf ptr to buffer. - size size of buffer in bytes. - index size of index entries (max no messages). - - Return value: 0 if failure, 1 if ok. - -*****************************************************************************/ -int MFIFOCreate(unsigned char *buf, int size, int index) -{ - MFIFO *mf = (MFIFO *)buf; - - mf->first = mf->last = 0; - mf->ixsize = index; - mf->buf = &buf[sizeof(MFIFO) + (sizeof(MINDEX) * index)]; - - if (mf->buf > &buf[size]) - return 0; - - mf->bsize = size - sizeof(MFIFO) - (sizeof(MINDEX) * index); - - return 1; -} - -/***************************************************************************** - - Function: MFIFOClear - - Description: Clear the FIFO - - Paremeters: buf ptr to fifo - - Return Value: none - -*****************************************************************************/ -void MFIFOClear(unsigned char * buf) -{ - MFIFO *mf = (MFIFO *)buf; - - mf->first = mf->last = 0; -} - -/***************************************************************************** - - Function: MFIFOGetLBOffset - - Description: Helper function caclulating offset to the 'first out' byte. - - Paremeters: buf ptr to fifo - - Return Value: offset. - -*****************************************************************************/ -int MFIFOGetLBOffset(unsigned char *buf) -{ - MFIFO *mf = (MFIFO *)buf; - - if (mf->last != mf->first) - return mf->ix[mf->last].offset; - - return 0; -} - -/***************************************************************************** - - Function: MFIFOGetFBOffset - - Description: Helper function calculating the offset to the 'first in' - byte in the buffer. This is the position the next byte - entering the fifo will occupy. - - Paremeters: buf ptr to fifo - - Return Value: offset - -*****************************************************************************/ -int MFIFOGetFBOffset(unsigned char *buf) -{ - MFIFO *mf = (MFIFO *)buf; - int x; - - if (mf->last == mf->first) - return 0; - - x = mf->first - 1; - - if (x < 0) - x = mf->ixsize - 1; - - return mf->ix[x].offset + mf->ix[x].size; -} - -/***************************************************************************** - - Function: MFIFOWriteIX - - Description: Helper function writing a calculated entry. The function - will perform a memcpy to move the message and set the index - values as well as increase the 'first in' index. - - Paremeters: buf ptr to fifo - mes ptr to message - size size of message in bytes. - ix index to index entry. - off offset to position to receive the message - - Return Value: none - -*****************************************************************************/ -void MFIFOWriteIX(unsigned char *buf, unsigned char *mes, int size, int ix, int off) -{ - MFIFO *mf = (MFIFO *)buf; - int x; - - memcpy(&mf->buf[off], mes, size); - mf->ix[ix].offset = off; - mf->ix[ix].size = size; - - x = mf->first + 1; - - if (x >= mf->ixsize) - x = 0; - - mf->first = x; -} - -/***************************************************************************** - - Function: MFIFOWriteMes - - Description: - - Paremeters: - - Return Value: - -*****************************************************************************/ -int MFIFOWriteMes(unsigned char *buf, unsigned char *mes, int size) -{ - MFIFO *mf = (MFIFO *)buf; - int of, ol, x; - - x = mf->first + 1; - - if (x >= mf->ixsize) - x = 0; - - if (x == mf->last) - return 0; /* full queue */ - - of = MFIFOGetFBOffset(buf); - ol = MFIFOGetLBOffset(buf); - if (mf->last == mf->first) { /* empty queue */ - mf->first = mf->last = 0; /* optimize */ - - MFIFOWriteIX(buf, mes, size, mf->first, 0); - return 1; - } - else if (of > ol) { - if (mf->bsize - of >= size) { - MFIFOWriteIX(buf, mes, size, mf->first, of); - return 1; - } - else if (ol > size) { - MFIFOWriteIX(buf, mes, size, mf->first, ol); - return 1; - } - } - else if (ol - of > size) { - MFIFOWriteIX(buf, mes, size, mf->first, of); - return 1; - } - - return 0; -} - -/***************************************************************************** - - Function: MFIFOGetMesPtr - - Description: - - Paremeters: - - Return Value: - -*****************************************************************************/ -unsigned char * MFIFOGetMesPtr(unsigned char *buf, int *size) -{ - MFIFO *mf = (MFIFO *)buf; - - if (mf->first == mf->last) { - return NULL; - } - - *size = mf->ix[mf->last].size; - return &mf->buf[mf->ix[mf->last].offset]; -} - -/***************************************************************************** - - Function: MFIFOKillNext - - Description: - - Paremeters: - - Return Value: - -*****************************************************************************/ -void MFIFOKillNext(unsigned char *buf) -{ - MFIFO *mf = (MFIFO *)buf; - int x; - - if (mf->first != mf->last) { - x = mf->last + 1; - if (x >= mf->ixsize) { - x = 0; - } - - mf->last = x; - } -} - - -/* - * Queue-style accessor functions - */ - -/** - * MFIFOGetMesPtrOffset - * \brief Get pointer to and size of message at position x - */ -unsigned char * MFIFOGetMesPtrOffset(unsigned char *buf, int *size, const int pos) -{ - MFIFO *mf = (MFIFO *)buf; - int x; - - if (mf->first == mf->last) { - return NULL; - } - - if (pos < 0 || pos >= mf->ixsize) { - return NULL; - } - - x = pos - mf->last; - if (x < 0) { - x += (mf->ixsize - 1); - } - - *size = mf->ix[x].size; - return &mf->buf[mf->ix[x].offset]; -} - - -/** - * MFIFOGetMesCount - * \brief How many messages are currently in the buffer? - */ -int MFIFOGetMesCount(unsigned char *buf) -{ - MFIFO *mf = (MFIFO *)buf; - - if (mf->first == mf->last) { - return 0; - } - else if (mf->first > mf->last) { - return mf->first - mf->last; - } - else { - return (mf->ixsize - mf->last) + mf->first; - } -} - -/** - * MFIFOWriteMesOverwrite - * \brief Same as MFIFOWriteMes but old frames will be overwritten if the fifo is full - */ -int MFIFOWriteMesOverwrite(unsigned char *buf, unsigned char *mes, int size) -{ - MFIFO *mf = (MFIFO *)buf; - int of, ol, x; - - x = mf->first + 1; - - if (x >= mf->ixsize) - x = 0; - - if (x == mf->last) { - /* advance last pointer */ - mf->last++; - - if (mf->last >= mf->ixsize) - mf->last = 0; - } - - of = MFIFOGetFBOffset(buf); - ol = MFIFOGetLBOffset(buf); - - if (mf->last == mf->first) { /* empty queue */ - mf->first = mf->last = 0; /* optimize */ - - MFIFOWriteIX(buf, mes, size, mf->first, 0); - return 1; - } - else if (of > ol) { - if (mf->bsize - of >= size) { - MFIFOWriteIX(buf, mes, size, mf->first, of); - return 1; - } - else if (ol > size) { - MFIFOWriteIX(buf, mes, size, mf->first, ol); - return 1; - } - } - else if (ol - of > size) { - MFIFOWriteIX(buf, mes, size, mf->first, of); - return 1; - } - return 0; -} diff --git a/libs/freetdm/src/isdn/nationalStateNT.c b/libs/freetdm/src/isdn/nationalStateNT.c deleted file mode 100644 index b150999650..0000000000 --- a/libs/freetdm/src/isdn/nationalStateNT.c +++ /dev/null @@ -1,130 +0,0 @@ -/***************************************************************************** - - FileName: nationalStateNT.c - - Contents: National ISDN State Engine for NT (Network Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "national.h" - -/***************************************************************************** - Function: nationalCreateNT - - Description: Will create the National ISDN NT as a Dialect in the stack. The first - bulk set up the message handlers, the second bulk the IE - encoders/coders, and the last bulk set up the state table. - - Parameters: i Dialect index -*****************************************************************************/ -void nationalCreateNT(L3UCHAR i) -{ - Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingNT, Q931Umes_Alerting, Q931Pmes_Alerting); - Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingNT, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); - Q931SetMesProc(Q931mes_CONNECT, i, Q931ProcConnectNT, Q931Umes_Connect, Q931Pmes_Connect); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, Q931ProcConnectAckNT, Q931Umes_ConnectAck, Q931Pmes_ConnectAck); - Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressNT, Q931Umes_Progress, Q931Pmes_Progress); - Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupNT, nationalUmes_Setup, nationalPmes_Setup); - Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckNT, Q931Umes_SetupAck, Q931Pmes_SetupAck); - Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeNT, Q931Umes_Resume, Q931Pmes_Resume); - Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckNT, Q931Umes_ResumeAck, Q931Pmes_ResumeAck); - Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectNT, Q931Umes_ResumeReject, Q931Pmes_ResumeReject); - Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendNT, Q931Umes_Suspend, Q931Pmes_Suspend); - Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckNT, Q931Umes_SuspendAck, Q931Pmes_SuspendAck); - Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectNT, Q931Umes_SuspendReject, Q931Pmes_SuspendReject); - Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationNT, Q931Umes_UserInformation, Q931Pmes_UserInformation); - Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectNT, Q931Umes_Disconnect, Q931Pmes_Disconnect); - Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseNT, Q931Umes_Release, Q931Pmes_Release); - Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteNT, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete); - Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartNT, Q931Umes_Restart, Q931Pmes_Restart); - Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckNT, Q931Umes_RestartAck, Q931Pmes_RestartAck); - Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl); - Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationNT, Q931Umes_Information, Q931Pmes_Information); - Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyNT, Q931Umes_Notify, Q931Pmes_Notify); - Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusNT, Q931Umes_Status, Q931Pmes_Status); - Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryNT, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry); - Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentNT, Q931Umes_Segment, Q931Pmes_Segment); - - Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityNT, Q932Umes_Facility, Q932Pmes_Facility); - Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldNT, Q932Umes_Hold, Q932Pmes_Hold); - Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckNT, Q932Umes_HoldAck, Q932Pmes_HoldAck); - Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectNT, Q932Umes_HoldReject, Q932Pmes_HoldReject); - Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterNT, Q932Umes_Register, Q932Pmes_Register); - Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveNT, Q932Umes_Retrieve, Q932Pmes_Retrieve); - Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck); - Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectNT, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject); - - /* Set up the IE encoder/decoder handle table.*/ - Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment); - Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap); - Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause); - Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID); - Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState); - Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID); - Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd); - Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac); - Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd); - Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display); - Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime); - Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac); - Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal); - Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum); - Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub); - Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum); - Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub); - Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd); - Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp); - Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp); - Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser); - Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits); - - Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_REDIRECTING_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - - /* The following define a state machine. The point is that the Message */ - /* procs can when search this to find out if the message/state */ - /* combination is legale. If not, the proc for unexpected message apply.*/ - - /* TODO define state table here */ -} diff --git a/libs/freetdm/src/isdn/nationalStateTE.c b/libs/freetdm/src/isdn/nationalStateTE.c deleted file mode 100644 index 46731d0910..0000000000 --- a/libs/freetdm/src/isdn/nationalStateTE.c +++ /dev/null @@ -1,217 +0,0 @@ -/***************************************************************************** - - FileName: nationalStateTE.c - - Contents: National ISDN State Engine for TE (User Mode). - - The controlling state engine for Q.931 is the state engine - on the NT side. The state engine on the TE side is a slave - of this. The TE side maintain it's own states as described in - ITU-T Q931, but will in raise conditions be overridden by - the NT side. - - This reference implementation uses a process per message, - meaning that each message must check call states. This - is easier for dialect maintenance as each message proc - can be replaced individually. A new TE variant only - need to copy the Q931CreateTE and replace those procs or - need to override. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*****************************************************************************/ - -#include "national.h" -extern L3INT Q931L4HeaderSpace; - -/***************************************************************************** - Function: nationalCreateTE - - Description: Will create the National TE as a Dialect in the stack. The first - bulk set up the message handlers, the second bulk the IE - encoders/coders, and the last bulk set up the state table. - - Parameters: i Dialect index -*****************************************************************************/ -void nationalCreateTE(L3UCHAR i) -{ - Q931SetMesProc(Q931mes_ALERTING, i, Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting); - Q931SetMesProc(Q931mes_CALL_PROCEEDING, i, Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); - Q931SetMesProc(Q931mes_CONNECT, i, DMSProc0x07TE, DMSUmes_0x07, DMSPmes_0x07); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i, DMSProc0x0fTE, DMSUmes_0x0f, DMSPmes_0x0f); - Q931SetMesProc(Q931mes_PROGRESS, i, Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress); - Q931SetMesProc(Q931mes_SETUP, i, Q931ProcSetupTE, nationalUmes_Setup, nationalPmes_Setup); - Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i, Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck); - Q931SetMesProc(Q931mes_RESUME, i, Q931ProcResumeTE, Q931Umes_Resume, Q931Pmes_Resume); - Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE, i, Q931ProcResumeAckTE, Q931Umes_ResumeAck, Q931Pmes_ResumeAck); - Q931SetMesProc(Q931mes_RESUME_REJECT, i, Q931ProcResumeRejectTE, Q931Umes_ResumeReject, Q931Pmes_ResumeReject); - Q931SetMesProc(Q931mes_SUSPEND, i, Q931ProcSuspendTE, Q931Umes_Suspend, Q931Pmes_Suspend); - Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE, i, Q931ProcSuspendAckTE, Q931Umes_SuspendAck, Q931Pmes_SuspendAck); - Q931SetMesProc(Q931mes_SUSPEND_REJECT, i, Q931ProcSuspendRejectTE, Q931Umes_SuspendReject, Q931Pmes_SuspendReject); - Q931SetMesProc(Q931mes_USER_INFORMATION, i, Q931ProcUserInformationTE, Q931Umes_UserInformation, Q931Pmes_UserInformation); - Q931SetMesProc(Q931mes_DISCONNECT, i, Q931ProcDisconnectTE, Q931Umes_Disconnect, Q931Pmes_Disconnect); - Q931SetMesProc(Q931mes_RELEASE, i, Q931ProcReleaseTE, Q931Umes_Release, Q931Pmes_Release); - Q931SetMesProc(Q931mes_RELEASE_COMPLETE, i, Q931ProcReleaseCompleteTE, Q931Umes_ReleaseComplete, Q931Pmes_ReleaseComplete); - Q931SetMesProc(Q931mes_RESTART, i, Q931ProcRestartTE, Q931Umes_Restart, Q931Pmes_Restart); - Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE, i, Q931ProcRestartAckTE, Q931Umes_RestartAck, Q931Pmes_RestartAck); - Q931SetMesProc(Q931mes_CONGESTION_CONTROL, i, Q931ProcCongestionControlTE, Q931Umes_CongestionControl, Q931Pmes_CongestionControl); - Q931SetMesProc(Q931mes_INFORMATION, i, Q931ProcInformationTE, Q931Umes_Information, Q931Pmes_Information); - Q931SetMesProc(Q931mes_NOTIFY, i, Q931ProcNotifyTE, Q931Umes_Notify, Q931Pmes_Notify); - Q931SetMesProc(Q931mes_STATUS, i, Q931ProcStatusTE, Q931Umes_Status, Q931Pmes_Status); - Q931SetMesProc(Q931mes_STATUS_ENQUIRY, i, Q931ProcStatusEnquiryTE, Q931Umes_StatusEnquiry, Q931Pmes_StatusEnquiry); - Q931SetMesProc(Q931mes_SEGMENT, i, Q931ProcSegmentTE, Q931Umes_Segment, Q931Pmes_Segment); - - Q931SetMesProc(Q932mes_FACILITY, i, Q932ProcFacilityTE, Q932Umes_Facility, Q932Pmes_Facility); - Q931SetMesProc(Q932mes_HOLD, i, Q932ProcHoldTE, Q932Umes_Hold, Q932Pmes_Hold); - Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE, i, Q932ProcHoldAckTE, Q932Umes_HoldAck, Q932Pmes_HoldAck); - Q931SetMesProc(Q932mes_HOLD_REJECT, i, Q932ProcHoldRejectTE, Q932Umes_HoldReject, Q932Pmes_HoldReject); - Q931SetMesProc(Q932mes_REGISTER, i, Q932ProcRegisterTE, Q932Umes_Register, Q932Pmes_Register); - Q931SetMesProc(Q932mes_RETRIEVE, i, Q932ProcRetrieveTE, Q932Umes_Retrieve, Q932Pmes_Retrieve); - Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckTE, Q932Umes_RetrieveAck, Q932Pmes_RetrieveAck); - Q931SetMesProc(Q932mes_RETRIEVE_REJECT, i, Q932ProcRetrieveRejectTE, Q932Umes_RetrieveReject, Q932Pmes_RetrieveReject); - - /* Set up the IE encoder/decoder handle table.*/ - Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE, i, Q931Pie_Segment, Q931Uie_Segment); - Q931SetIEProc(Q931ie_BEARER_CAPABILITY, i, Q931Pie_BearerCap, Q931Uie_BearerCap); - Q931SetIEProc(Q931ie_CAUSE, i, Q931Pie_Cause, Q931Uie_Cause); - Q931SetIEProc(Q931ie_CALL_IDENTITY, i, Q931Pie_CallID, Q931Uie_CallID); - Q931SetIEProc(Q931ie_CALL_STATE, i, Q931Pie_CallState, Q931Uie_CallState); - Q931SetIEProc(Q931ie_CHANGE_STATUS, i, Q931Pie_ChangeStatus, Q931Uie_ChangeStatus); - Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION, i, Q931Pie_ChanID, Q931Uie_ChanID); - Q931SetIEProc(Q931ie_PROGRESS_INDICATOR, i, Q931Pie_ProgInd, Q931Uie_ProgInd); - Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES, i, Q931Pie_NetFac, Q931Uie_NetFac); - Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR, i, Q931Pie_NotifInd, Q931Uie_NotifInd); - Q931SetIEProc(Q931ie_DISPLAY, i, Q931Pie_Display, Q931Uie_Display); - Q931SetIEProc(Q931ie_DATETIME, i, Q931Pie_DateTime, Q931Uie_DateTime); - Q931SetIEProc(Q931ie_KEYPAD_FACILITY, i, Q931Pie_KeypadFac, Q931Uie_KeypadFac); - Q931SetIEProc(Q931ie_SIGNAL, i, Q931Pie_Signal, Q931Uie_Signal); - Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER, i, Q931Pie_CallingNum, Q931Uie_CallingNum); - Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS, i, Q931Pie_CallingSub, Q931Uie_CallingSub); - Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER, i, Q931Pie_CalledNum, Q931Uie_CalledNum); - Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS, i, Q931Pie_CalledSub, Q931Uie_CalledSub); - Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION, i, Q931Pie_TransNetSel, Q931Uie_TransNetSel); - Q931SetIEProc(Q931ie_RESTART_INDICATOR, i, Q931Pie_RestartInd, Q931Uie_RestartInd); - Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY, i, Q931Pie_LLComp, Q931Uie_LLComp); - Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY, i, Q931Pie_HLComp, Q931Uie_HLComp); - Q931SetIEProc(Q931ie_USER_USER, i, Q931Pie_UserUser, Q931Uie_UserUser); - Q931SetIEProc(Q931ie_GENERIC_DIGITS, i, Q931Pie_GenericDigits, Q931Uie_GenericDigits); - - Q931SetIEProc(Q931ie_CONNECTED_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_FACILITY, i, Q931Pie_Generic, Q931Uie_Generic); - Q931SetIEProc(Q931ie_REDIRECTING_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic); - - /* The following define a state machine. The point is that the Message - * procs can when search this to find out if the message/state - * combination is legale. If not, the proc for unexpected message apply. - */ - - /* State 0 Idle */ - Q931AddStateEntry(i, Q931_U0, Q931mes_RESUME, 2); - Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_SETUP, 2); - Q931AddStateEntry(i, Q931_U0, Q931mes_STATUS, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U0, Q931mes_RELEASE_COMPLETE, 4); - - /* State 1 Call Initiating */ - Q931AddStateEntry(i, Q931_U1, Q931mes_DISCONNECT, 2); - Q931AddStateEntry(i, Q931_U1, Q931mes_SETUP_ACKNOWLEDGE, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_RELEASE_COMPLETE, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_CALL_PROCEEDING, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U1, Q931mes_CONNECT, 4); - - /* State 2 Overlap Sending */ - Q931AddStateEntry(i, Q931_U2, Q931mes_INFORMATION, 2); - Q931AddStateEntry(i, Q931_U2, Q931mes_CALL_PROCEEDING, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_PROGRESS, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_CONNECT, 4); - Q931AddStateEntry(i, Q931_U2, Q931mes_RELEASE, 2); - - /* State 3 Outgoing Call Proceeding */ - Q931AddStateEntry(i, Q931_U3, Q931mes_PROGRESS, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_ALERTING, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_CONNECT, 4); - Q931AddStateEntry(i, Q931_U3, Q931mes_RELEASE, 2); - - /* State 4 Call Delivered */ - Q931AddStateEntry(i, Q931_U4, Q931mes_CONNECT, 4); - - /* State 6 Call Precent */ - Q931AddStateEntry(i, Q931_U6, Q931mes_INFORMATION, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_ALERTING, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_CALL_PROCEEDING, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_CONNECT, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE_COMPLETE, 2); - Q931AddStateEntry(i, Q931_U6, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U6, Q931mes_DISCONNECT, 4); - - /* State 7 Call Received */ - Q931AddStateEntry(i, Q931_U7, Q931mes_CONNECT, 2); - - /* State 8 Connect request */ - Q931AddStateEntry(i, Q931_U8, Q931mes_CONNECT_ACKNOWLEDGE, 4); - - /* State 9 Incoming Call Proceeding */ - Q931AddStateEntry(i, Q931_U9, Q931mes_CONNECT, 2); - Q931AddStateEntry(i, Q931_U9, Q931mes_ALERTING, 2); - Q931AddStateEntry(i, Q931_U9, Q931mes_PROGRESS, 2); - - /* State 10 Active */ - Q931AddStateEntry(i, Q931_U10, Q931mes_SUSPEND, 2); - Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 4); - Q931AddStateEntry(i, Q931_U10, Q931mes_NOTIFY, 2); - - /* State 11 Disconnect Request */ - Q931AddStateEntry(i, Q931_U11, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U11, Q931mes_DISCONNECT, 4); - Q931AddStateEntry(i, Q931_U11, Q931mes_NOTIFY, 4); - - /* State 12 Disconnect Ind */ - Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 4); - Q931AddStateEntry(i, Q931_U12, Q931mes_RELEASE, 2); - - /* State 15 Suspend Request */ - Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_ACKNOWLEDGE, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_SUSPEND_REJECT, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_DISCONNECT, 4); - Q931AddStateEntry(i, Q931_U15, Q931mes_RELEASE, 4); - -/* TODO - Q931AddStateEntry(i, Q931_U17, - Q931AddStateEntry(i, Q931_U19, - Q931AddStateEntry(i, Q931_U25, -*/ -} diff --git a/libs/freetdm/src/isdn/nationalmes.c b/libs/freetdm/src/isdn/nationalmes.c deleted file mode 100644 index 6d8350fbcd..0000000000 --- a/libs/freetdm/src/isdn/nationalmes.c +++ /dev/null @@ -1,269 +0,0 @@ -/***************************************************************************** - - FileName: nationalmes.c - - Contents: Pack/Unpack functions. These functions will unpack a National ISDN - message from the bit packed original format into structs - that contains variables sized by the user. It will also pack - the struct back into a Q.931 message as required. - - See national.h for description. - - License/Copyright: - - Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved. - email:janvb@caselaboratories.com - - Copyright (c) 2007, Michael Jerris. All rights reserved. - email:mike@jerris.com - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the Case Labs, Ltd nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -*****************************************************************************/ - -#include "national.h" - -/***************************************************************************** - - Function: nationalUmes_Setup - -*****************************************************************************/ -L3INT nationalUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) -{ - L3INT ir = 0; - L3INT OOff = 0; - L3INT rc = Q931E_NO_ERROR; - L3UCHAR last_codeset = 0, codeset = 0; - L3UCHAR shift_lock = 1; - - while (IOff < Size) { - if (!shift_lock) { - codeset = last_codeset; - } - - if ((IBuf[IOff] & 0xF0) == Q931ie_SHIFT ) { - shift_lock = (IBuf[IOff] & 0x08); - if (shift_lock) { - last_codeset = codeset; - } - codeset = ((IBuf[IOff] & 0x07)); - IOff++; - } - - if (codeset == 0) { - switch (IBuf[IOff]) { - case Q931ie_SENDING_COMPLETE: - case Q931ie_BEARER_CAPABILITY: - case Q931ie_CHANNEL_IDENTIFICATION: - case Q931ie_PROGRESS_INDICATOR: - case Q931ie_NETWORK_SPECIFIC_FACILITIES: - case Q931ie_DISPLAY: - case Q931ie_DATETIME: - case Q931ie_KEYPAD_FACILITY: - case Q931ie_SIGNAL: - case Q931ie_CALLING_PARTY_NUMBER: - case Q931ie_CALLING_PARTY_SUBADDRESS: - case Q931ie_CALLED_PARTY_NUMBER: - case Q931ie_CALLED_PARTY_SUBADDRESS: - case Q931ie_TRANSIT_NETWORK_SELECTION: - case Q931ie_LOW_LAYER_COMPATIBILITY: - case Q931ie_HIGH_LAYER_COMPATIBILITY: - case Q931ie_FACILITY: - case Q931ie_REDIRECTING_NUMBER: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - case Q931ie_REPEAT_INDICATOR: - if (ir < 2) { - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - ir++; - } else { - return Q931E_ILLEGAL_IE; - } - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - } else if (codeset == 6) { - switch (IBuf[IOff]) { - case Q931ie_GENERIC_DIGITS: - rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); - if (rc != Q931E_NO_ERROR) - return rc; - break; - default: - return Q931E_ILLEGAL_IE; - break; - } - - } else { - return Q931E_ILLEGAL_IE; - } - } - mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; - return Q931E_NO_ERROR; -} - -/***************************************************************************** - - Function: nationalPmes_Setup - - Decription: Pack a Q931mes_Generic into a real Q.931 message. The user will - set up a SETUP message and issue this to the stack where it - is processed by Q931ProcSetup that processes and validates - it before it actually sends it out. This function is called - to compute the real Q.931 message. - - Parameters: IBuf[IN] Ptr to un-packed struct - ISize[IN] Size of input buffer (unpacked message). - OBuf[OUT] Ptr to packed 'octet' wise message. - OSize[OUT] Size of packed message. - - Called By: Q931ProcSetup - -*****************************************************************************/ -L3INT nationalPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) -{ - L3INT rc = Q931E_NO_ERROR; - Q931mes_Generic *pMes = (Q931mes_Generic *)IBuf; - L3INT Octet = 0; - - /* Q931 Message Header */ - Q931MesgHeader(pTrunk, pMes, OBuf, *OSize, &Octet); - - /* Sending Complete */ - if (Q931IsIEPresent(pMes->SendComplete)) { - OBuf[Octet++] = (L3UCHAR)(pMes->SendComplete & 0x00ff); - } - - /* Repeat Indicator */ - if (Q931IsIEPresent(pMes->RepeatInd)) { - OBuf[Octet++] = (L3UCHAR)(pMes->RepeatInd & 0x00ff); - } - - /* Bearer capability */ - if (Q931IsIEPresent(pMes->BearerCap)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_BEARER_CAPABILITY](pTrunk, Q931GetIEPtr(pMes->BearerCap,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - else { - rc = Q931E_BEARERCAP; - } - - /* Channel Identification */ - if (Q931IsIEPresent(pMes->ChanID)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CHANNEL_IDENTIFICATION](pTrunk, Q931GetIEPtr(pMes->ChanID,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Progress indicator */ - if (Q931IsIEPresent(pMes->ProgInd)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_PROGRESS_INDICATOR](pTrunk, Q931GetIEPtr(pMes->ProgInd,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Network spesific facilities */ - if (Q931IsIEPresent(pMes->NetFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_NETWORK_SPECIFIC_FACILITIES](pTrunk, Q931GetIEPtr(pMes->NetFac,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Display */ - if (Q931IsIEPresent(pMes->Display)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DISPLAY](pTrunk, Q931GetIEPtr(pMes->Display,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Date/Time */ - if (Q931IsIEPresent(pMes->DateTime)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_DATETIME](pTrunk, Q931GetIEPtr(pMes->DateTime,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Keypad Facility */ - if (Q931IsIEPresent(pMes->KeypadFac)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_KEYPAD_FACILITY](pTrunk, Q931GetIEPtr(pMes->KeypadFac,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Signal */ - if (Q931IsIEPresent(pMes->Signal)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_SIGNAL](pTrunk, Q931GetIEPtr(pMes->Signal,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Calling Party Number */ - if (Q931IsIEPresent(pMes->CallingNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CallingNum,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Calling Party Subaddress */ - if (Q931IsIEPresent(pMes->CallingSub)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLING_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CallingSub,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Called Party number */ - if (Q931IsIEPresent(pMes->CalledNum)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_NUMBER](pTrunk, Q931GetIEPtr(pMes->CalledNum,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Called party subaddress */ - if (Q931IsIEPresent(pMes->CalledSub)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_CALLED_PARTY_SUBADDRESS](pTrunk, Q931GetIEPtr(pMes->CalledSub,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Transit network selection */ - if (Q931IsIEPresent(pMes->TransNetSel)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_TRANSIT_NETWORK_SELECTION](pTrunk, Q931GetIEPtr(pMes->TransNetSel,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* Repeat Indicator */ - if (Q931IsIEPresent(pMes->LLRepeatInd)) { - rc = Q931E_UNKNOWN_IE;/* TODO */ - } - - /* Low Layer Compatibility */ - if (Q931IsIEPresent(pMes->LLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_LOW_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->LLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - /* High Layer Compatibility */ - if (Q931IsIEPresent(pMes->HLComp)) { - if ((rc = Q931Pie[pTrunk->Dialect][Q931ie_HIGH_LAYER_COMPATIBILITY](pTrunk, Q931GetIEPtr(pMes->HLComp,pMes->buf), OBuf, &Octet)) != 0) - return rc; - } - - *OSize = Octet; - return rc; -} diff --git a/libs/freetdm/src/libteletone_detect.c b/libs/freetdm/src/libteletone_detect.c deleted file mode 100644 index b89ea11645..0000000000 --- a/libs/freetdm/src/libteletone_detect.c +++ /dev/null @@ -1,485 +0,0 @@ -/* - * libteletone - * 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 tone_detect.c - General telephony tone detection, and specific detection of DTMF. - * - * - * The Initial Developer of the Original Code is - * Stephen Underwood - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * The the original interface designed by Steve Underwood was preserved to retain - *the optimizations when considering DTMF tones though the names were changed in the interest - * of namespace. - * - * Much less efficient expansion interface was added to allow for the detection of - * a single arbitrary tone combination which may also exceed 2 simultaneous tones. - * (controlled by compile time constant TELETONE_MAX_TONES) - * - * Copyright (C) 2006 Anthony Minessale II - * - * - * libteletone_detect.c Tone Detection Code - * - * - ********************************************************************************* - * - * Derived from tone_detect.c - General telephony tone detection, and specific - * detection of DTMF. - * - * 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. - * - * - * Exception: - * The author hereby grants the use of this source code under the - * following license if and only if the source code is distributed - * as part of the OpenZAP or FreeTDM library. Any use or distribution of this - * source code outside the scope of the OpenZAP or FreeTDM library will nullify the - * following license and reinact the MPL 1.1 as stated above. - * - * Copyright (c) 2007, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#ifndef _MSC_VER -#include -#endif -#include -#include -#include -#include - -#define LOW_ENG 10000000 -#define ZC 2 -static teletone_detection_descriptor_t dtmf_detect_row[GRID_FACTOR]; -static teletone_detection_descriptor_t dtmf_detect_col[GRID_FACTOR]; -static teletone_detection_descriptor_t dtmf_detect_row_2nd[GRID_FACTOR]; -static teletone_detection_descriptor_t dtmf_detect_col_2nd[GRID_FACTOR]; - -static float dtmf_row[] = {697.0f, 770.0f, 852.0f, 941.0f}; -static float dtmf_col[] = {1209.0f, 1336.0f, 1477.0f, 1633.0f}; - -static char dtmf_positions[] = "123A" "456B" "789C" "*0#D"; - -static void goertzel_init(teletone_goertzel_state_t *goertzel_state, teletone_detection_descriptor_t *tdesc) { - goertzel_state->v2 = goertzel_state->v3 = 0.0; - goertzel_state->fac = tdesc->fac; -} - -TELETONE_API(void) teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state, - int16_t sample_buffer[], - int samples) -{ - int i; - float v1; - - for (i = 0; i < samples; i++) { - v1 = goertzel_state->v2; - goertzel_state->v2 = goertzel_state->v3; - goertzel_state->v3 = (float)(goertzel_state->fac*goertzel_state->v2 - v1 + sample_buffer[i]); - } -} -#ifdef _MSC_VER -#pragma warning(disable:4244) -#endif - -#define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac)) - -TELETONE_API(void) teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate) -{ - int i; - float theta; - - dtmf_detect_state->hit1 = dtmf_detect_state->hit2 = 0; - - for (i = 0; i < GRID_FACTOR; i++) { - theta = (float)(M_TWO_PI*(dtmf_row[i]/(float)sample_rate)); - dtmf_detect_row[i].fac = (float)(2.0*cos(theta)); - - theta = (float)(M_TWO_PI*(dtmf_col[i]/(float)sample_rate)); - dtmf_detect_col[i].fac = (float)(2.0*cos(theta)); - - theta = (float)(M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate)); - dtmf_detect_row_2nd[i].fac = (float)(2.0*cos(theta)); - - theta = (float)(M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate)); - dtmf_detect_col_2nd[i].fac = (float)(2.0*cos(theta)); - - goertzel_init (&dtmf_detect_state->row_out[i], &dtmf_detect_row[i]); - goertzel_init (&dtmf_detect_state->col_out[i], &dtmf_detect_col[i]); - goertzel_init (&dtmf_detect_state->row_out2nd[i], &dtmf_detect_row_2nd[i]); - goertzel_init (&dtmf_detect_state->col_out2nd[i], &dtmf_detect_col_2nd[i]); - - dtmf_detect_state->energy = 0.0; - } - dtmf_detect_state->current_sample = 0; - dtmf_detect_state->detected_digits = 0; - dtmf_detect_state->lost_digits = 0; - dtmf_detect_state->digit = 0; - dtmf_detect_state->dur = 0; -} - -TELETONE_API(void) teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map) -{ - float theta = 0; - int x = 0; - - if (!mt->sample_rate) { - mt->sample_rate = 8000; - } - - if (!mt->min_samples) { - mt->min_samples = 102; - } - - mt->min_samples *= (mt->sample_rate / 8000); - - if (!mt->positive_factor) { - mt->positive_factor = 2; - } - - if(!mt->negative_factor) { - mt->negative_factor = 10; - } - - if (!mt->hit_factor) { - mt->hit_factor = 2; - } - - for(x = 0; x < TELETONE_MAX_TONES; x++) { - if ((int) map->freqs[x] == 0) { - break; - } - mt->tone_count++; - theta = (float)(M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate)); - mt->tdd[x].fac = (float)(2.0 * cos(theta)); - goertzel_init (&mt->gs[x], &mt->tdd[x]); - goertzel_init (&mt->gs2[x], &mt->tdd[x]); - } - -} - -TELETONE_API(int) teletone_multi_tone_detect (teletone_multi_tone_t *mt, - int16_t sample_buffer[], - int samples) -{ - int sample, limit = 0, j, x = 0; - float v1, famp; - float eng_sum = 0, eng_all[TELETONE_MAX_TONES] = {0.0}; - int gtest = 0, see_hit = 0; - - for (sample = 0; sample >= 0 && sample < samples; sample = limit) { - mt->total_samples++; - - if ((samples - sample) >= (mt->min_samples - mt->current_sample)) { - limit = sample + (mt->min_samples - mt->current_sample); - } else { - limit = samples; - } - if (limit < 0 || limit > samples) { - limit = samples; - } - - for (j = sample; j < limit; j++) { - famp = sample_buffer[j]; - - mt->energy += famp*famp; - - for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) { - v1 = mt->gs[x].v2; - mt->gs[x].v2 = mt->gs[x].v3; - mt->gs[x].v3 = (float)(mt->gs[x].fac * mt->gs[x].v2 - v1 + famp); - - v1 = mt->gs2[x].v2; - mt->gs2[x].v2 = mt->gs2[x].v3; - mt->gs2[x].v3 = (float)(mt->gs2[x].fac*mt->gs2[x].v2 - v1 + famp); - } - } - - mt->current_sample += (limit - sample); - if (mt->current_sample < mt->min_samples) { - continue; - } - - eng_sum = 0; - for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) { - eng_all[x] = (float)(teletone_goertzel_result (&mt->gs[x])); - eng_sum += eng_all[x]; - } - - gtest = 0; - for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) { - gtest += teletone_goertzel_result (&mt->gs2[x]) < eng_all[x] ? 1 : 0; - } - - if ((gtest >= 2 || gtest == mt->tone_count) && eng_sum > 42.0 * mt->energy) { - if(mt->negatives) { - mt->negatives--; - } - mt->positives++; - - if(mt->positives >= mt->positive_factor) { - mt->hits++; - } - if (mt->hits >= mt->hit_factor) { - see_hit++; - mt->positives = mt->negatives = mt->hits = 0; - } - } else { - mt->negatives++; - if(mt->positives) { - mt->positives--; - } - if(mt->negatives > mt->negative_factor) { - mt->positives = mt->hits = 0; - } - } - - /* Reinitialise the detector for the next block */ - for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) { - goertzel_init (&mt->gs[x], &mt->tdd[x]); - goertzel_init (&mt->gs2[x], &mt->tdd[x]); - } - - mt->energy = 0.0; - mt->current_sample = 0; - } - - return see_hit; -} - - -TELETONE_API(teletone_hit_type_t) teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state, - int16_t sample_buffer[], - int samples) -{ - float row_energy[GRID_FACTOR]; - float col_energy[GRID_FACTOR]; - float famp; - float v1; - int i; - int j; - int sample; - int best_row; - int best_col; - char hit; - int limit; - teletone_hit_type_t r = 0; - - hit = 0; - for (sample = 0; sample < samples; sample = limit) { - /* BLOCK_LEN is optimised to meet the DTMF specs. */ - if ((samples - sample) >= (BLOCK_LEN - dtmf_detect_state->current_sample)) { - limit = sample + (BLOCK_LEN - dtmf_detect_state->current_sample); - } else { - limit = samples; - } - - for (j = sample; j < limit; j++) { - int x = 0; - famp = sample_buffer[j]; - - dtmf_detect_state->energy += famp*famp; - - for(x = 0; x < GRID_FACTOR; x++) { - v1 = dtmf_detect_state->row_out[x].v2; - dtmf_detect_state->row_out[x].v2 = dtmf_detect_state->row_out[x].v3; - dtmf_detect_state->row_out[x].v3 = (float)(dtmf_detect_state->row_out[x].fac*dtmf_detect_state->row_out[x].v2 - v1 + famp); - - v1 = dtmf_detect_state->col_out[x].v2; - dtmf_detect_state->col_out[x].v2 = dtmf_detect_state->col_out[x].v3; - dtmf_detect_state->col_out[x].v3 = (float)(dtmf_detect_state->col_out[x].fac*dtmf_detect_state->col_out[x].v2 - v1 + famp); - - v1 = dtmf_detect_state->col_out2nd[x].v2; - dtmf_detect_state->col_out2nd[x].v2 = dtmf_detect_state->col_out2nd[x].v3; - dtmf_detect_state->col_out2nd[x].v3 = (float)(dtmf_detect_state->col_out2nd[x].fac*dtmf_detect_state->col_out2nd[x].v2 - v1 + famp); - - v1 = dtmf_detect_state->row_out2nd[x].v2; - dtmf_detect_state->row_out2nd[x].v2 = dtmf_detect_state->row_out2nd[x].v3; - dtmf_detect_state->row_out2nd[x].v3 = (float)(dtmf_detect_state->row_out2nd[x].fac*dtmf_detect_state->row_out2nd[x].v2 - v1 + famp); - } - - } - - if (dtmf_detect_state->zc > 0) { - if (dtmf_detect_state->energy < LOW_ENG && dtmf_detect_state->lenergy < LOW_ENG) { - if (!--dtmf_detect_state->zc) { - /* Reinitialise the detector for the next block */ - dtmf_detect_state->hit1 = dtmf_detect_state->hit2 = 0; - for (i = 0; i < GRID_FACTOR; i++) { - goertzel_init (&dtmf_detect_state->row_out[i], &dtmf_detect_row[i]); - goertzel_init (&dtmf_detect_state->col_out[i], &dtmf_detect_col[i]); - goertzel_init (&dtmf_detect_state->row_out2nd[i], &dtmf_detect_row_2nd[i]); - goertzel_init (&dtmf_detect_state->col_out2nd[i], &dtmf_detect_col_2nd[i]); - } - dtmf_detect_state->dur -= samples; - return TT_HIT_END; - } - } - - dtmf_detect_state->dur += samples; - dtmf_detect_state->lenergy = dtmf_detect_state->energy; - dtmf_detect_state->energy = 0.0; - dtmf_detect_state->current_sample = 0; - return TT_HIT_MIDDLE; - } else if (dtmf_detect_state->digit) { - return TT_HIT_END; - } - - - dtmf_detect_state->current_sample += (limit - sample); - if (dtmf_detect_state->current_sample < BLOCK_LEN) { - continue; - } - /* We are at the end of a DTMF detection block */ - /* Find the peak row and the peak column */ - row_energy[0] = teletone_goertzel_result (&dtmf_detect_state->row_out[0]); - col_energy[0] = teletone_goertzel_result (&dtmf_detect_state->col_out[0]); - - for (best_row = best_col = 0, i = 1; i < GRID_FACTOR; i++) { - row_energy[i] = teletone_goertzel_result (&dtmf_detect_state->row_out[i]); - if (row_energy[i] > row_energy[best_row]) { - best_row = i; - } - col_energy[i] = teletone_goertzel_result (&dtmf_detect_state->col_out[i]); - if (col_energy[i] > col_energy[best_col]) { - best_col = i; - } - } - hit = 0; - /* Basic signal level test and the twist test */ - if (row_energy[best_row] >= DTMF_THRESHOLD && - col_energy[best_col] >= DTMF_THRESHOLD && - col_energy[best_col] < row_energy[best_row]*DTMF_REVERSE_TWIST && - col_energy[best_col]*DTMF_NORMAL_TWIST > row_energy[best_row]) { - /* Relative peak test */ - for (i = 0; i < GRID_FACTOR; i++) { - if ((i != best_col && col_energy[i]*DTMF_RELATIVE_PEAK_COL > col_energy[best_col]) || - (i != best_row && row_energy[i]*DTMF_RELATIVE_PEAK_ROW > row_energy[best_row])) { - break; - } - } - /* ... and second harmonic test */ - if (i >= GRID_FACTOR && (row_energy[best_row] + col_energy[best_col]) > 42.0*dtmf_detect_state->energy && - teletone_goertzel_result (&dtmf_detect_state->col_out2nd[best_col])*DTMF_2ND_HARMONIC_COL < col_energy[best_col] && - teletone_goertzel_result (&dtmf_detect_state->row_out2nd[best_row])*DTMF_2ND_HARMONIC_ROW < row_energy[best_row]) { - hit = dtmf_positions[(best_row << 2) + best_col]; - /* Look for two successive similar results */ - /* The logic in the next test is: - We need two successive identical clean detects, with - something different preceeding it. This can work with - back to back differing digits. More importantly, it - can work with nasty phones that give a very wobbly start - to a digit. */ - if (! r && hit == dtmf_detect_state->hit3 && dtmf_detect_state->hit3 != dtmf_detect_state->hit2) { - dtmf_detect_state->digit_hits[(best_row << 2) + best_col]++; - dtmf_detect_state->detected_digits++; - if (dtmf_detect_state->current_digits < TELETONE_MAX_DTMF_DIGITS) { - dtmf_detect_state->digit = hit; - } else { - dtmf_detect_state->lost_digits++; - } - - if (!dtmf_detect_state->zc) { - dtmf_detect_state->zc = ZC; - dtmf_detect_state->dur = 0; - r = TT_HIT_BEGIN; - break; - } - - } - } - } - - dtmf_detect_state->hit1 = dtmf_detect_state->hit2; - dtmf_detect_state->hit2 = dtmf_detect_state->hit3; - dtmf_detect_state->hit3 = hit; - - dtmf_detect_state->energy = 0.0; - dtmf_detect_state->current_sample = 0; - - } - - return r; -} - - -TELETONE_API(int) teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state, char *buf, unsigned int *dur) -{ - if (!dtmf_detect_state->digit) { - return 0; - } - - *buf = dtmf_detect_state->digit; - - *dur = dtmf_detect_state->dur; - - if (!dtmf_detect_state->zc) { - dtmf_detect_state->dur = 0; - dtmf_detect_state->digit = 0; - } - - return 1; -} - -/* 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/freetdm/src/libteletone_generate.c b/libs/freetdm/src/libteletone_generate.c deleted file mode 100644 index 3638d94989..0000000000 --- a/libs/freetdm/src/libteletone_generate.c +++ /dev/null @@ -1,505 +0,0 @@ -/* - * libteletone - * 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 libteletone - * - * 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 - * - * - * libteletone.c -- Tone Generator - * - * - * - * Exception: - * The author hereby grants the use of this source code under the - * following license if and only if the source code is distributed - * as part of the OpenZAP or FreeTDM library. Any use or distribution of this - * source code outside the scope of the OpenZAP or FreeTDM library will nullify the - * following license and reinact the MPL 1.1 as stated above. - * - * Copyright (c) 2007, Anthony Minessale II - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#define SMAX 32767 -#define SMIN -32768 -#define normalize_to_16bit(n) if (n > SMAX) n = SMAX; else if (n < SMIN) n = SMIN; - -#ifdef _MSC_VER -#pragma warning(disable:4706) -#endif - -TELETONE_API_DATA int16_t TELETONE_SINES[SINE_TABLE_MAX] = { - 0x00c9, 0x025b, 0x03ed, 0x057f, 0x0711, 0x08a2, 0x0a33, 0x0bc4, - 0x0d54, 0x0ee4, 0x1073, 0x1201, 0x138f, 0x151c, 0x16a8, 0x1833, - 0x19be, 0x1b47, 0x1cd0, 0x1e57, 0x1fdd, 0x2162, 0x22e5, 0x2467, - 0x25e8, 0x2768, 0x28e5, 0x2a62, 0x2bdc, 0x2d55, 0x2ecc, 0x3042, - 0x31b5, 0x3327, 0x3497, 0x3604, 0x3770, 0x38d9, 0x3a40, 0x3ba5, - 0x3d08, 0x3e68, 0x3fc6, 0x4121, 0x427a, 0x43d1, 0x4524, 0x4675, - 0x47c4, 0x490f, 0x4a58, 0x4b9e, 0x4ce1, 0x4e21, 0x4f5e, 0x5098, - 0x51cf, 0x5303, 0x5433, 0x5560, 0x568a, 0x57b1, 0x58d4, 0x59f4, - 0x5b10, 0x5c29, 0x5d3e, 0x5e50, 0x5f5e, 0x6068, 0x616f, 0x6272, - 0x6371, 0x646c, 0x6564, 0x6657, 0x6747, 0x6832, 0x691a, 0x69fd, - 0x6add, 0x6bb8, 0x6c8f, 0x6d62, 0x6e31, 0x6efb, 0x6fc2, 0x7083, - 0x7141, 0x71fa, 0x72af, 0x735f, 0x740b, 0x74b3, 0x7556, 0x75f4, - 0x768e, 0x7723, 0x77b4, 0x7840, 0x78c8, 0x794a, 0x79c9, 0x7a42, - 0x7ab7, 0x7b27, 0x7b92, 0x7bf9, 0x7c5a, 0x7cb7, 0x7d0f, 0x7d63, - 0x7db1, 0x7dfb, 0x7e3f, 0x7e7f, 0x7eba, 0x7ef0, 0x7f22, 0x7f4e, - 0x7f75, 0x7f98, 0x7fb5, 0x7fce, 0x7fe2, 0x7ff1, 0x7ffa, 0x7fff -}; - - -TELETONE_API(int) teletone_set_tone(teletone_generation_session_t *ts, int index, ...) -{ - va_list ap; - int i = 0; - teletone_process_t x = 0; - - va_start(ap, index); - while (i < TELETONE_MAX_TONES && (x = va_arg(ap, teletone_process_t))) { - ts->TONES[index].freqs[i++] = x; - } - va_end(ap); - - return (i > TELETONE_MAX_TONES) ? -1 : 0; - -} - -TELETONE_API(int) teletone_set_map(teletone_tone_map_t *map, ...) -{ - va_list ap; - int i = 0; - teletone_process_t x = 0; - - va_start(ap, map); - while (i < TELETONE_MAX_TONES && (x = va_arg(ap, teletone_process_t))) { - map->freqs[i++] = x; - } - va_end(ap); - - return (i > TELETONE_MAX_TONES) ? -1 : 0; - -} - -TELETONE_API(int) teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data) -{ - memset(ts, 0, sizeof(*ts)); - ts->rate = 8000; - ts->channels = 1; - ts->duration = 2000; - ts->wait = 500; - ts->tmp_duration = -1; - ts->tmp_wait = -1; - ts->handler = handler; - ts->user_data = user_data; - ts->volume = -7; - ts->decay_step = 0; - ts->decay_factor = 1; - if (buflen) { - if ((ts->buffer = calloc(buflen, sizeof(teletone_audio_t))) == 0) { - return -1; - } - ts->datalen = buflen; - } else { - ts->dynamic = 1024; - } - /* Add Standard DTMF Tones */ - teletone_set_tone(ts, '1', 697.0, 1209.0, 0.0); - teletone_set_tone(ts, '2', 697.0, 1336.0, 0.0); - teletone_set_tone(ts, '3', 697.0, 1477.0, 0.0); - teletone_set_tone(ts, 'A', 697.0, 1633.0, 0.0); - teletone_set_tone(ts, '4', 770.0, 1209.0, 0.0); - teletone_set_tone(ts, '5', 770.0, 1336.0, 0.0); - teletone_set_tone(ts, '6', 770.0, 1477.0, 0.0); - teletone_set_tone(ts, 'B', 770.0, 1633.0, 0.0); - teletone_set_tone(ts, '7', 859.0, 1209.0, 0.0); - teletone_set_tone(ts, '8', 859.0, 1336.0, 0.0); - teletone_set_tone(ts, '9', 859.0, 1477.0, 0.0); - teletone_set_tone(ts, 'C', 859.0, 1633.0, 0.0); - teletone_set_tone(ts, '*', 941.0, 1209.0, 0.0); - teletone_set_tone(ts, '0', 941.0, 1336.0, 0.0); - teletone_set_tone(ts, '#', 941.0, 1477.0, 0.0); - teletone_set_tone(ts, 'D', 941.0, 1633.0, 0.0); - - return 0; -} - -TELETONE_API(int) teletone_destroy_session(teletone_generation_session_t *ts) -{ - if (ts->buffer) { - free(ts->buffer); - ts->buffer = NULL; - ts->samples = 0; - } - return 0; -} - -static int ensure_buffer(teletone_generation_session_t *ts, int need) -{ - need += ts->samples; - need *= sizeof(teletone_audio_t); - need *= ts->channels; - - if (need > ts->datalen) { - teletone_audio_t *tmp; - ts->datalen = need + ts->dynamic; - tmp = realloc(ts->buffer, ts->datalen); - if (!tmp) { - return -1; - } - ts->buffer = tmp; - } - - return 0; -} - -TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map) -{ - /*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/ - int i, c; - int freqlen = 0; - teletone_dds_state_t tones[TELETONE_MAX_TONES+1]; - //int decay = 0; - int duration; - int wait = 0; - int32_t sample; - int32_t dc = 0; - float vol = ts->volume; - ts->samples = 0; - memset(tones, 0, sizeof(tones[0]) * TELETONE_MAX_TONES); - duration = (ts->tmp_duration > -1) ? ts->tmp_duration : ts->duration; - wait = (ts->tmp_wait > -1) ? ts->tmp_wait : ts->wait; - - if (map->freqs[0] > 0) { - for (freqlen = 0; freqlen < TELETONE_MAX_TONES && map->freqs[freqlen]; freqlen++) { - teletone_dds_state_set_tone(&tones[freqlen], map->freqs[freqlen], ts->rate, 0); - teletone_dds_state_set_tx_level(&tones[freqlen], vol); - } - - if (ts->channels > 1) { - duration *= ts->channels; - } - - if (ts->dynamic) { - if (ensure_buffer(ts, duration)) { - return -1; - } - } - - for (ts->samples = 0; ts->samples < ts->datalen && ts->samples < duration; ts->samples++) { - if (ts->decay_direction && ++dc >= ts->decay_step) { - float nvol = vol + ts->decay_direction * ts->decay_factor; - int j; - - if (nvol <= TELETONE_VOL_DB_MAX && nvol >= TELETONE_VOL_DB_MIN) { - vol = nvol; - for (j = 0; j < TELETONE_MAX_TONES && map->freqs[j]; j++) { - teletone_dds_state_set_tx_level(&tones[j], vol); - } - dc = 0; - } - } - - sample = 128; - - for (i = 0; i < freqlen; i++) { - int32_t s = teletone_dds_state_modulate_sample(&tones[i], 0); - sample += s; - } - sample /= freqlen; - ts->buffer[ts->samples] = (teletone_audio_t)sample; - - for (c = 1; c < ts->channels; c++) { - ts->buffer[ts->samples+1] = ts->buffer[ts->samples]; - ts->samples++; - } - - } - } - if (ts->dynamic) { - if (ensure_buffer(ts, wait)) { - return -1; - } - } - for (c = 0; c < ts->channels; c++) { - for (i = 0; i < wait && ts->samples < ts->datalen; i++) { - ts->buffer[ts->samples++] = 0; - } - } - - if (ts->debug && ts->debug_stream) { - if (map->freqs[0] <= 0) { - fprintf(ts->debug_stream, "wait %d (%dms)\n", wait, wait / (ts->rate / 1000)); - } else { - fprintf(ts->debug_stream, "Generate: ("); - - for (i = 0; i < TELETONE_MAX_TONES && map->freqs[i]; i++) { - fprintf(ts->debug_stream, "%s%0.2f", i == 0 ? "" : "+",map->freqs[i]); - } - - fprintf(ts->debug_stream, - ") [volume %0.2fdB; samples %d(%dms) x %d channel%s; wait %d(%dms); decay_factor %0.2fdB; decay_step %d(%dms); wrote %d bytes]\n", - ts->volume, - duration, - duration / (ts->rate / 1000), - ts->channels, - ts->channels == 1 ? "" : "s", - wait, - wait / (ts->rate / 1000), - ts->decay_factor, - ts->decay_step, - ts->decay_step / (ts->rate / 1000), - ts->samples * 2); - } - } - return ts->samples / ts->channels; -} - -/* don't ask */ -static char *my_strdup (const char *s) -{ - size_t len = strlen (s) + 1; - void *new = malloc (len); - - if (new == NULL) { - return NULL; - } - - return (char *) memcpy (new, s, len); -} - -TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd) -{ - char *data = NULL, *cur = NULL, *end = NULL; - int LOOPING = 0; - - if (!cmd) { - return -1; - } - - do { - if (!(data = my_strdup(cmd))) { - return -1; - } - - cur = data; - - while (*cur) { - if (*cur == ' ' || *cur == '\r' || *cur == '\n') { - cur++; - continue; - } - - if ((end = strchr(cur, ';')) != 0) { - *end++ = '\0'; - } - - if (*(cur + 1) == '=') { - switch(*cur) { - case 'c': - ts->channels = atoi(cur + 2); - break; - case 'r': - ts->rate = atoi(cur + 2); - break; - case 'd': - ts->duration = atoi(cur + 2) * (ts->rate / 1000); - break; - case 'v': - { - float vol = (float)atof(cur + 2); - if (vol <= TELETONE_VOL_DB_MAX && vol >= TELETONE_VOL_DB_MIN) { - ts->volume = vol; - } - } - break; - case '>': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); - ts->decay_direction = -1; - break; - case '<': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); - ts->decay_direction = 1; - break; - case '+': - ts->decay_factor = (float)atof(cur + 2); - break; - case 'w': - ts->wait = atoi(cur + 2) * (ts->rate / 1000); - break; - case 'l': - ts->loops = atoi(cur + 2); - break; - case 'L': - if (!LOOPING) { - int L; - if ((L = atoi(cur + 2)) > 0) { - ts->LOOPS = L; - LOOPING++; - } - } - break; - } - } else { - while (*cur) { - char *p = NULL, *e = NULL; - teletone_tone_map_t mymap, *mapp = NULL; - - if (*cur == ' ' || *cur == '\r' || *cur == '\n') { - cur++; - continue; - } - - ts->tmp_duration = -1; - ts->tmp_wait = -1; - - memset(&mymap, 0, sizeof(mymap)); - - if (*(cur + 1) == '(') { - p = cur + 2; - if (*cur) { - char *next; - int i = 0; - if ((e = strchr(p, ')')) != 0) { - *e++ = '\0'; - } - do { - if (!p) { - break; - } - if ((next = strchr(p, ',')) != 0) { - *next++ = '\0'; - } - if (i == 0) { - ts->tmp_duration = atoi(p) * (ts->rate / 1000); - i++; - } else if (i == 1) { - ts->tmp_wait = atoi(p) * (ts->rate / 1000); - i++; - } else { - mymap.freqs[i++ - 2] = atof(p); - } - p = next; - - } while (next && (i-2) < TELETONE_MAX_TONES); - if (i > 2 && *cur == '%') { - mapp = &mymap; - } else if ((i != 2 || *cur == '%')) { - if (ts->debug && ts->debug_stream) { - fprintf(ts->debug_stream, "Syntax Error!\n"); - } - goto bottom; - } - } - } - - if (*cur && !mapp) { - if (*cur > 0 && *cur < TELETONE_TONE_RANGE) { - mapp = &ts->TONES[(int)*cur]; - } else if (ts->debug && ts->debug_stream) { - fprintf(ts->debug_stream, "Map [%c] Out Of Range!\n", *cur); - } - } - - if (mapp) { - if (mapp->freqs[0]) { - if (ts->handler) { - do { - ts->handler(ts, mapp); - if (ts->loops > 0) { - ts->loops--; - } - } while (ts->loops); - } - } else if (ts->debug && ts->debug_stream) { - fprintf(ts->debug_stream, "Ignoring Empty Map [%c]!\n", *cur); - } - } - - if (e) { - cur = e; - } else { - cur++; - } - } - } - - if (end) { - cur = end; - } else if (*cur){ - cur++; - } - } - bottom: - free(data); - data = NULL; - - if (ts->LOOPS > 0) { - ts->LOOPS--; - } - - } while (ts->LOOPS); - - return 0; -} - -/* 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/freetdm/src/priserver.c b/libs/freetdm/src/priserver.c deleted file mode 100644 index bbc1f2236e..0000000000 --- a/libs/freetdm/src/priserver.c +++ /dev/null @@ -1,328 +0,0 @@ -/***************************************************************************** - * priserver.c Refactoring of pritest.c - * - * Author(s): Anthony Minessale II - * Nenad Corbic - * - * Copyright: (c) 2005-2014 Anthony Minessale II - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * ============================================================================ - */ - -#include "freetdm.h" -#include -#include -#include -#include -#include -#include - -typedef struct { - int pid; - q931_call call; - void *pri; - int ready; -}call_info_t; - - -#define SANGOMA_MAX_CHAN_PER_SPAN 32 - -static call_info_t pidmap[SANGOMA_MAX_CHAN_PER_SPAN]; - -FIO_EVENT_CB_FUNCTION(my_ftdm_event_handler) -{ - if (event->e_type = FTDM_EVENT_DTMF) { - char *dtmf = event->data; - printf("DTMF %s\n", dtmf); - } -} - -/* Stupid runtime process to play a file to a b channel*/ -#define BYTES 320 -#define MAX_BYTES 1000 - -static int ready = 1; - -static void handle_SIGINT(int sig) -{ - if (sig) { - ready = 0; - } - - return; -} - -static void launch_channel(struct sangoma_pri *spri, int channo) -{ - pid_t pid; - int fd = 0, file = 0, inlen = 0, outlen = 0; - unsigned char inframe[MAX_BYTES], outframe[MAX_BYTES]; - fd_set readfds; - int mtu_mru=BYTES / 2; - int err; - ftdm_channel_t *chan; - ftdm_codec_t codec = FTDM_CODEC_SLIN; - unsigned ms = 20; - unsigned int lead = 50; - int ifd = -1; - ftdm_tone_type_t tt = FTDM_TONE_DTMF; - char dtmf[] = "1234567890"; - int loops = 0; - - pid = fork(); - - if (pid) { - pidmap[channo-1].pid = pid; - printf("-- Launching process %d to handle channel %d\n", pid, channo); - return; - } - - signal(SIGINT, handle_SIGINT); - - //ifd = open("/nfs/sounds/ptest.raw", O_WRONLY|O_CREAT|O_TRUNC, 777); - - memset(inframe, 0, MAX_BYTES); - memset(outframe, 0, MAX_BYTES); - - if (ftdm_channel_open(spri->span, channo, &chan) != FTDM_SUCCESS) { - printf("DEBUG cant open fd!\n"); - } - - - -#if 1 - if (ftdm_channel_command(chan, FTDM_COMMAND_SET_CODEC, &codec) != FTDM_SUCCESS) { - printf("Critical Error: Failed to set driver codec!\n"); - ftdm_channel_close(&chan); - exit(-1); - } -#endif - -#if 1 - if (ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_DTMF_DETECT, &tt) != FTDM_SUCCESS) { - printf("Critical Error: Failed to set dtmf detect!\n"); - ftdm_channel_close(&chan); - exit(-1); - } - ftdm_channel_set_event_callback(chan, my_ftdm_event_handler); -#endif - - - if (ftdm_channel_command(chan, FTDM_COMMAND_SET_INTERVAL, &ms) != FTDM_SUCCESS) { - printf("Critical Error: Failed to set codec interval!\n"); - ftdm_channel_close(&chan); - exit(-1); - } - - file = open("sound.raw", O_RDONLY); - if (file < 0){ - printf("Critical Error: Failed to open sound file!\n"); - ftdm_channel_close(&chan); - exit(-1); - } - - - while(ready) { - ftdm_wait_flag_t flags = FTDM_READ; - ftdm_size_t len; - loops++; - - if (lead) { - lead--; - } - - if (!lead && loops == 300) { -#if 1 - if (ftdm_channel_command(chan, FTDM_COMMAND_SEND_DTMF, dtmf) != FTDM_SUCCESS) { - printf("Critical Error: Failed to send dtmf\n"); - ftdm_channel_close(&chan); - exit(-1); - } -#endif - - } - - if (ftdm_channel_wait(chan, &flags, 2000) != FTDM_SUCCESS) { - printf("wait FAIL! [%s]\n", chan->last_error); - break; - } - - if (flags & FTDM_READ) { - len = MAX_BYTES; - if (ftdm_channel_read(chan, inframe, &len) == FTDM_SUCCESS) { - //printf("READ: %d\n", len); - //write(ifd, inframe, len); - if(!lead && (outlen = read(file, outframe, len)) <= 0) { - break; - } - - } else { - printf("READ FAIL! %d [%s]\n", len, chan->last_error); - break; - } - if (lead) { - continue; - } - ftdm_channel_write(chan, outframe, sizeof(outframe), &len); - } else { - printf("BREAK"); - break; - } - } - - printf("loop done\n"); - - //sangoma_get_full_cfg(fd, &tdm_api); - close(file); - //close(ifd); - - pri_hangup(spri->pri, channo, 16); - if (ftdm_channel_close(&chan) != FTDM_SUCCESS) { - printf("Critical Error: Failed to close channel [%s]\n", chan->last_error); - } - - printf("Call Handler: Process Finished\n"); - exit(0); -} - - -/* Event Handlers */ - -static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event) -{ - printf( "number is: %s\n", event->ring.callednum); - if(strlen(event->ring.callednum) > 3) { - printf( "final number is: %s\n", event->ring.callednum); - pri_answer(spri->pri, event->ring.call, 0, 1); - } - return 0; -} - -static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event) -{ - //pri_hangup(spri->pri, event->hangup.call, event->hangup.cause); - printf("-- Hanging up channel %d\n", event->hangup.channel); - if(pidmap[event->hangup.channel-1].pid) { - pri_hangup(spri->pri, event->hangup.call, 16); - pri_destroycall(spri->pri, event->hangup.call); - kill(pidmap[event->hangup.channel-1].pid, SIGINT); - pidmap[event->hangup.channel-1].pid = 0; - } - return 0; -} - -static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event) -{ - printf("-- Ring on channel %d (from %s to %s), answering...\n", event->ring.channel, event->ring.callingnum, event->ring.callednum); - pri_answer(spri->pri, event->ring.call, event->ring.channel, 1); - memcpy(&pidmap[event->ring.channel-1].call, event->ring.call, sizeof(q931_call)); - pidmap[event->ring.channel-1].pri=spri->pri; - pidmap[event->ring.channel-1].call = *event->ring.call; - launch_channel(spri, event->ring.channel); - return 0; -} - -static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event) -{ - printf("-- Restarting channel %d\n", event->restart.channel); - return 0; -} - -static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event) -{ - printf("%s: Caught Event %d (%s)\n", __FTDM_FUNC__, event_type, sangoma_pri_event_str(event_type)); - return 0; -} - -/* Generic Reaper */ -static void chan_ended(int sig) -{ - int status; - int x; - struct rusage rusage; - pid_t pid; - pid = wait4(-1, &status, WNOHANG, &rusage); - - printf("-- PID %d ended\n", pid); - - for (x=0;x -1) { - fprintf(stderr, "--!! Unknown PID %d exited\n", pid); - signal(SIGCHLD, chan_ended); - return; - } -} - -/* Our Program */ -int main(int argc, char *argv[]) -{ - struct sangoma_pri spri; - int debug = 0; - if (argv[1]) { - debug = atoi(argv[1]); - } - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - if (ftdm_global_init() != FTDM_SUCCESS) { - fprintf(stderr, "Error loading FreeTDM\n"); - exit(-1); - } - - printf("FreeTDM loaded\n"); - - - debug = PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE; - printf("WTF %d\n", debug); - - if (sangoma_init_pri(&spri, - 1, // span - 24, // dchan - SANGOMA_PRI_SWITCH_DMS100, - SANGOMA_PRI_CPE, - debug) < 0) { - return -1; - } - //spri.pri->debug = (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_STATE); - - //pri_set_debug(&spri.pri, (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_STATE)); - - SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_ANY, on_anything); - SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_RING, on_ring); - SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_HANGUP, on_hangup); - SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_HANGUP_REQ, on_hangup); - SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_INFO_RECEIVED, on_info); - SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_RESTART, on_restart); - - signal(SIGCHLD, chan_ended); - sangoma_run_pri(&spri); - return 0; -} - -/* 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/freetdm/src/sangoma_pri.c b/libs/freetdm/src/sangoma_pri.c deleted file mode 100644 index a6e79c9682..0000000000 --- a/libs/freetdm/src/sangoma_pri.c +++ /dev/null @@ -1,251 +0,0 @@ -/***************************************************************************** - * sangoma_pri.c libpri Sangoma integration - * - * Author(s): Anthony Minessale II - * Nenad Corbic - * - * Copyright: (c) 2005-2014 Anthony Minessale II - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * ============================================================================ - */ - -#include "freetdm.h" -#include -#ifndef HAVE_GETTIMEOFDAY - -#ifdef WIN32 -#include - -static __inline int gettimeofday(struct timeval *tp, void *nothing) -{ -#ifdef WITHOUT_MM_LIB - SYSTEMTIME st; - time_t tt; - struct tm tmtm; - /* mktime converts local to UTC */ - GetLocalTime (&st); - tmtm.tm_sec = st.wSecond; - tmtm.tm_min = st.wMinute; - tmtm.tm_hour = st.wHour; - tmtm.tm_mday = st.wDay; - tmtm.tm_mon = st.wMonth - 1; - tmtm.tm_year = st.wYear - 1900; tmtm.tm_isdst = -1; - tt = mktime (&tmtm); - tp->tv_sec = tt; - tp->tv_usec = st.wMilliseconds * 1000; -#else - /** - ** The earlier time calculations using GetLocalTime - ** had a time resolution of 10ms.The timeGetTime, part - ** of multimedia apis offer a better time resolution - ** of 1ms.Need to link against winmm.lib for this - **/ - unsigned long Ticks = 0; - unsigned long Sec =0; - unsigned long Usec = 0; - Ticks = timeGetTime(); - - Sec = Ticks/1000; - Usec = (Ticks - (Sec*1000))*1000; - tp->tv_sec = Sec; - tp->tv_usec = Usec; -#endif /* WITHOUT_MM_LIB */ - (void)nothing; - return 0; -} -#endif /* WIN32 */ -#endif /* HAVE_GETTIMEOFDAY */ - -static struct sangoma_pri_event_list SANGOMA_PRI_EVENT_LIST[] = { - {0, SANGOMA_PRI_EVENT_ANY, "ANY"}, - {1, SANGOMA_PRI_EVENT_DCHAN_UP, "DCHAN_UP"}, - {2, SANGOMA_PRI_EVENT_DCHAN_DOWN, "DCHAN_DOWN"}, - {3, SANGOMA_PRI_EVENT_RESTART, "RESTART"}, - {4, SANGOMA_PRI_EVENT_CONFIG_ERR, "CONFIG_ERR"}, - {5, SANGOMA_PRI_EVENT_RING, "RING"}, - {6, SANGOMA_PRI_EVENT_HANGUP, "HANGUP"}, - {7, SANGOMA_PRI_EVENT_RINGING, "RINGING"}, - {8, SANGOMA_PRI_EVENT_ANSWER, "ANSWER"}, - {9, SANGOMA_PRI_EVENT_HANGUP_ACK, "HANGUP_ACK"}, - {10, SANGOMA_PRI_EVENT_RESTART_ACK, "RESTART_ACK"}, - {11, SANGOMA_PRI_EVENT_FACNAME, "FACNAME"}, - {12, SANGOMA_PRI_EVENT_INFO_RECEIVED, "INFO_RECEIVED"}, - {13, SANGOMA_PRI_EVENT_PROCEEDING, "PROCEEDING"}, - {14, SANGOMA_PRI_EVENT_SETUP_ACK, "SETUP_ACK"}, - {15, SANGOMA_PRI_EVENT_HANGUP_REQ, "HANGUP_REQ"}, - {16, SANGOMA_PRI_EVENT_NOTIFY, "NOTIFY"}, - {17, SANGOMA_PRI_EVENT_PROGRESS, "PROGRESS"}, - {18, SANGOMA_PRI_EVENT_KEYPAD_DIGIT, "KEYPAD_DIGIT"} -}; - -#define LINE "--------------------------------------------------------------------------------" - -char *sangoma_pri_event_str(sangoma_pri_event_t event_id) -{ - return SANGOMA_PRI_EVENT_LIST[event_id].name; -} - -static int __pri_sangoma_read(struct pri *pri, void *buf, int buflen) -{ - struct sangoma_pri *spri = (struct sangoma_pri *) pri->userdata; - ftdm_size_t len = buflen; - int res; - char bb[4096] = ""; - - - if (ftdm_channel_read(spri->zdchan, buf, &len) != FTDM_SUCCESS) { - printf("D-READ FAIL! [%s]\n", spri->zdchan->last_error); - return 0; - } - res = (int)len; - memset(&((unsigned char*)buf)[res],0,2); - res+=2; - - //print_bits(buf, res-2, bb, sizeof(bb), 1, 0); - //ftdm_log(FTDM_LOG_DEBUG, "READ %d\n%s\n%s\n\n", res-2, LINE, bb); - - return res; -} - -static int __pri_sangoma_write(struct pri *pri, void *buf, int buflen) -{ - struct sangoma_pri *spri = (struct sangoma_pri *) pri->userdata; - int res; - ftdm_size_t len = buflen -2; - char bb[4096] = ""; - - if (ftdm_channel_write(spri->zdchan, buf, buflen, &len) != FTDM_SUCCESS) { - printf("D-WRITE FAIL! [%s]\n", spri->zdchan->last_error); - return 0; - } - - //print_bits(buf, (int)buflen-2, bb, sizeof(bb), 1, 0); - //ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n%s\n%s\n\n", (int)buflen-2, LINE, bb); - - return (int) buflen; -} - -int sangoma_init_pri(struct sangoma_pri *spri, int span, int dchan, int swtype, int node, int debug) -{ - int ret = -1; - ftdm_socket_t dfd = 0; - - memset(spri, 0, sizeof(struct sangoma_pri)); - - if (ftdm_channel_open(span, dchan, &spri->zdchan) != FTDM_SUCCESS) { - fprintf(stderr, "Unable to open DCHAN %d for span %d (%s)\n", dchan, span, strerror(errno)); - } else { - if ((spri->pri = pri_new_cb(spri->zdchan->sockfd, node, swtype, __pri_sangoma_read, __pri_sangoma_write, spri))){ - spri->span = span; - pri_set_debug(spri->pri, debug); - ret = 0; - } else { - fprintf(stderr, "Unable to create PRI\n"); - } - } - return ret; -} - - -int sangoma_one_loop(struct sangoma_pri *spri) -{ - fd_set rfds, efds; - struct timeval now = {0,0}, *next; - pri_event *event; - int sel; - - if (spri->on_loop) { - spri->on_loop(spri); - } - - FD_ZERO(&rfds); - FD_ZERO(&efds); - -#ifdef _MSC_VER - //Windows macro for FD_SET includes a warning C4127: conditional expression is constant -#pragma warning(push) -#pragma warning(disable:4127) -#endif - - FD_SET(spri->pri->fd, &rfds); - FD_SET(spri->pri->fd, &efds); - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - - if ((next = pri_schedule_next(spri->pri))) { - gettimeofday(&now, NULL); - now.tv_sec = next->tv_sec - now.tv_sec; - now.tv_usec = next->tv_usec - now.tv_usec; - if (now.tv_usec < 0) { - now.tv_usec += 1000000; - now.tv_sec -= 1; - } - if (now.tv_sec < 0) { - now.tv_sec = 0; - now.tv_usec = 0; - } - } - - sel = select(spri->pri->fd + 1, &rfds, NULL, &efds, next ? &now : NULL); - event = NULL; - - if (!sel) { - event = pri_schedule_run(spri->pri); - } else if (sel > 0) { - event = pri_check_event(spri->pri); - } - - if (event) { - event_handler handler; - /* 0 is catchall event handler */ - if ((handler = spri->eventmap[event->e] ? spri->eventmap[event->e] : spri->eventmap[0] ? spri->eventmap[0] : NULL)) { - handler(spri, event->e, event); - } else { - fprintf(stderr,"No event handler found for event %d.\n", event->e); - } - } - - return sel; -} - -int sangoma_run_pri(struct sangoma_pri *spri) -{ - int ret = 0; - - for (;;){ - ret=sangoma_one_loop(spri); - if (ret < 0){ - -#ifndef WIN32 //This needs to be adressed fror WIN32 still - if (errno == EINTR){ - /* Igonore an interrupted system call */ - continue; - } -#endif - printf("Error = %i\n",ret); - perror("Sangoma Run Pri: "); - break; - } - } - - return ret; - -} - -/* 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/freetdm/src/sangoma_pri.h b/libs/freetdm/src/sangoma_pri.h deleted file mode 100644 index 873aab8a27..0000000000 --- a/libs/freetdm/src/sangoma_pri.h +++ /dev/null @@ -1,100 +0,0 @@ -/***************************************************************************** - * libsangoma.c AFT T1/E1: HDLC API Code Library - * - * Author(s): Anthony Minessale II - * Nenad Corbic - * - * Copyright: (c) 2005-2014 Anthony Minessale II - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * ============================================================================ - */ - -#ifndef _SANGOMA_PRI_H -#define _SANGOMA_PRI_H -#include -#include - - -#define SANGOMA_MAX_CHAN_PER_SPAN 32 - -typedef enum { - SANGOMA_PRI_EVENT_ANY = 0, - SANGOMA_PRI_EVENT_DCHAN_UP = PRI_EVENT_DCHAN_UP, - SANGOMA_PRI_EVENT_DCHAN_DOWN = PRI_EVENT_DCHAN_DOWN, - SANGOMA_PRI_EVENT_RESTART = PRI_EVENT_RESTART, - SANGOMA_PRI_EVENT_CONFIG_ERR = PRI_EVENT_CONFIG_ERR, - SANGOMA_PRI_EVENT_RING = PRI_EVENT_RING, - SANGOMA_PRI_EVENT_HANGUP = PRI_EVENT_HANGUP, - SANGOMA_PRI_EVENT_RINGING = PRI_EVENT_RINGING, - SANGOMA_PRI_EVENT_ANSWER = PRI_EVENT_ANSWER, - SANGOMA_PRI_EVENT_HANGUP_ACK = PRI_EVENT_HANGUP_ACK, - SANGOMA_PRI_EVENT_RESTART_ACK = PRI_EVENT_RESTART_ACK, - SANGOMA_PRI_EVENT_FACNAME = PRI_EVENT_FACNAME, - SANGOMA_PRI_EVENT_INFO_RECEIVED = PRI_EVENT_INFO_RECEIVED, - SANGOMA_PRI_EVENT_PROCEEDING = PRI_EVENT_PROCEEDING, - SANGOMA_PRI_EVENT_SETUP_ACK = PRI_EVENT_SETUP_ACK, - SANGOMA_PRI_EVENT_HANGUP_REQ = PRI_EVENT_HANGUP_REQ, - SANGOMA_PRI_EVENT_NOTIFY = PRI_EVENT_NOTIFY, - SANGOMA_PRI_EVENT_PROGRESS = PRI_EVENT_PROGRESS, - SANGOMA_PRI_EVENT_KEYPAD_DIGIT = PRI_EVENT_KEYPAD_DIGIT -} sangoma_pri_event_t; - -typedef enum { - SANGOMA_PRI_NETWORK = PRI_NETWORK, - SANGOMA_PRI_CPE = PRI_CPE -} sangoma_pri_node_t; - -typedef enum { - SANGOMA_PRI_SWITCH_UNKNOWN = PRI_SWITCH_UNKNOWN, - SANGOMA_PRI_SWITCH_NI2 = PRI_SWITCH_NI2, - SANGOMA_PRI_SWITCH_DMS100 = PRI_SWITCH_DMS100, - SANGOMA_PRI_SWITCH_LUCENT5E = PRI_SWITCH_LUCENT5E, - SANGOMA_PRI_SWITCH_ATT4ESS = PRI_SWITCH_ATT4ESS, - SANGOMA_PRI_SWITCH_EUROISDN_E1 = PRI_SWITCH_EUROISDN_E1, - SANGOMA_PRI_SWITCH_EUROISDN_T1 = PRI_SWITCH_EUROISDN_T1, - SANGOMA_PRI_SWITCH_NI1 = PRI_SWITCH_NI1, - SANGOMA_PRI_SWITCH_GR303_EOC = PRI_SWITCH_GR303_EOC, - SANGOMA_PRI_SWITCH_GR303_TMC = PRI_SWITCH_GR303_TMC, - SANGOMA_PRI_SWITCH_QSIG = PRI_SWITCH_QSIG -} sangoma_pri_switch_t; - -typedef enum { - SANGOMA_PRI_READY = (1 << 0) -} sangoma_pri_flag_t; - -struct sangoma_pri; -typedef int (*event_handler)(struct sangoma_pri *, sangoma_pri_event_t, pri_event *); -typedef int (*loop_handler)(struct sangoma_pri *); -#define MAX_EVENT 18 - -struct sangoma_pri { - struct pri *pri; - int span; - int dchan; - unsigned int flags; - void *private_info; - event_handler eventmap[MAX_EVENT+1]; - loop_handler on_loop; - ftdm_channel_t *zdchan; -}; - -struct sangoma_pri_event_list { - int event_id; - int pri_event; - char *name; -}; - - - -#define SANGOMA_MAP_PRI_EVENT(spri, event, func) spri.eventmap[event] = func; - -char *sangoma_pri_event_str(sangoma_pri_event_t event_id); -int sangoma_one_loop(struct sangoma_pri *spri); -int sangoma_init_pri(struct sangoma_pri *spri, int span, int dchan, int swtype, int node, int debug); -int sangoma_run_pri(struct sangoma_pri *spri); - -#endif diff --git a/libs/freetdm/src/ss7/README b/libs/freetdm/src/ss7/README deleted file mode 100644 index 0efe94c94a..0000000000 --- a/libs/freetdm/src/ss7/README +++ /dev/null @@ -1,3 +0,0 @@ -SS7 Coming soon - --Shane Burrell- diff --git a/libs/freetdm/src/testanalog.c b/libs/freetdm/src/testanalog.c deleted file mode 100644 index 764c5d81d5..0000000000 --- a/libs/freetdm/src/testanalog.c +++ /dev/null @@ -1,138 +0,0 @@ -#include -#include -#include -#include "freetdm.h" - - -static void *test_call(ftdm_thread_t *me, void *obj) -{ - ftdm_channel_t *chan = (ftdm_channel_t *) obj; - uint8_t frame[1024]; - ftdm_size_t len; - char *number = ftdm_strdup("5551212"); - - ftdm_unused_arg(me); - - ftdm_sleep(10 * 1000); - - ftdm_log(FTDM_LOG_DEBUG, "answer call and start echo test\n"); - - ftdm_channel_call_answer(chan); - ftdm_channel_command(chan, FTDM_COMMAND_SEND_DTMF, number); - - while (ftdm_channel_call_check_answered(chan)) { - ftdm_wait_flag_t flags = FTDM_READ; - - if (ftdm_channel_wait(chan, &flags, -1) == FTDM_FAIL) { - break; - } - len = sizeof(frame); - if (flags & FTDM_READ) { - if (ftdm_channel_read(chan, frame, &len) == FTDM_SUCCESS) { - //ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n", len); - ftdm_channel_write(chan, frame, sizeof(frame), &len); - } else { - break; - } - } - } - - if (ftdm_channel_call_check_answered(chan)) { - ftdm_channel_call_indicate(chan, FTDM_CHANNEL_INDICATE_BUSY); - } - - ftdm_log(FTDM_LOG_DEBUG, "call over\n"); - ftdm_safe_free(number); - return NULL; -} - -static FIO_SIGNAL_CB_FUNCTION(on_signal) -{ - ftdm_log(FTDM_LOG_DEBUG, "got sig [%s]\n", ftdm_signal_event2str(sigmsg->event_id)); - - switch(sigmsg->event_id) { - case FTDM_SIGEVENT_START: - ftdm_channel_call_indicate(sigmsg->channel, FTDM_CHANNEL_INDICATE_RINGING); - ftdm_log(FTDM_LOG_DEBUG, "launching thread and indicating ring\n"); - ftdm_thread_create_detached(test_call, sigmsg->channel); - break; - default: - break; - } - - return FTDM_SUCCESS; -} - -static int R = 0; -#if 0 -static void handle_SIGINT(int sig) -{ - if (sig); - R = 0; - return; -} -#endif - -int main(int argc, char *argv[]) -{ - ftdm_span_t *span; - int span_id; - int digit_timeout = 2000; - int max_dialstr = 11; - - if (argc < 2) { - printf("usage %s \n", argv[0]); - exit(-1); - } - - span_id = atoi(argv[1]); - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - - if (ftdm_global_init() != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error loading FreeTDM\n"); - exit(-1); - } - - ftdm_log(FTDM_LOG_DEBUG, "FreeTDM loaded\n"); - - if (ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span\n"); - goto done; - } - - - if (ftdm_configure_span(span, "analog", on_signal, - "tonemap", "us", - "digit_timeout", &digit_timeout, - "max_dialstr", &max_dialstr, - FTDM_TAG_END - ) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM span\n"); - goto done; - } - ftdm_span_start(span); - - R = 1; - - while(ftdm_running() && R) { - ftdm_sleep(1 * 1000); - } - -done: - - ftdm_global_destroy(); - return 0; -} - -/* 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/freetdm/src/testapp.c b/libs/freetdm/src/testapp.c deleted file mode 100644 index 1d7a2cb8cb..0000000000 --- a/libs/freetdm/src/testapp.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "freetdm.h" -#include - -int main(int argc, char *argv[]) -{ - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - ftdm_channel_t *chan; - unsigned ms = 20; - ftdm_codec_t codec = FTDM_CODEC_SLIN; - unsigned runs = 1; - int spanid, chanid; - - ftdm_unused_arg(argc); - ftdm_unused_arg(argv); - - if (ftdm_global_init() != FTDM_SUCCESS) { - fprintf(stderr, "Error loading FreeTDM\n"); - exit(-1); - } - - printf("FreeTDM loaded\n"); - - top: - //if (ftdm_channel_open_any("wanpipe", 0, FTDM_HUNT_BOTTOM_UP, &chan) == FTDM_SUCCESS) { - if (ftdm_channel_open(1, 1, &chan) == FTDM_SUCCESS) { - int x = 0; - spanid = ftdm_channel_get_span_id(chan); - chanid = ftdm_channel_get_id(chan); - printf("opened channel %d:%d\n", spanid, chanid); - -#if 1 - if (ftdm_channel_command(chan, FTDM_COMMAND_SET_INTERVAL, &ms) == FTDM_SUCCESS) { - ms = 0; - ftdm_channel_command(chan, FTDM_COMMAND_GET_INTERVAL, &ms); - printf("interval set to %u\n", ms); - } else { - printf("set interval failed [%s]\n", ftdm_channel_get_last_error(chan)); - } -#endif - if (ftdm_channel_command(chan, FTDM_COMMAND_SET_CODEC, &codec) == FTDM_SUCCESS) { - codec = 1; - ftdm_channel_command(chan, FTDM_COMMAND_GET_CODEC, &codec); - printf("codec set to %u\n", codec); - } else { - printf("set codec failed [%s]\n", ftdm_channel_get_last_error(chan)); - } - - for(x = 0; x < 25; x++) { - unsigned char buf[2048]; - ftdm_size_t len = sizeof(buf); - ftdm_wait_flag_t flags = FTDM_READ; - - if (ftdm_channel_wait(chan, &flags, -1) == FTDM_FAIL) { - printf("wait FAIL! %u [%s]\n", (unsigned)len, ftdm_channel_get_last_error(chan)); - } - if (flags & FTDM_READ) { - if (ftdm_channel_read(chan, buf, &len) == FTDM_SUCCESS) { - printf("READ: %u\n", (unsigned)len); - } else { - printf("READ FAIL! %u [%s]\n", (unsigned)len, ftdm_channel_get_last_error(chan)); - break; - } - } else { - printf("wait fail [%s]\n", ftdm_channel_get_last_error(chan)); - } - } - ftdm_channel_close(&chan); - } else { - printf("open fail [%s]\n", ftdm_channel_get_last_error(chan)); - } - - if(--runs) { - goto top; - } - - ftdm_global_destroy(); - return 0; -} - -/* 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/freetdm/src/testcid.c b/libs/freetdm/src/testcid.c deleted file mode 100644 index e6a0116d4a..0000000000 --- a/libs/freetdm/src/testcid.c +++ /dev/null @@ -1,109 +0,0 @@ -#include "private/ftdm_core.h" - -ftdm_status_t my_write_sample(int16_t *buf, ftdm_size_t buflen, void *user_data); - -struct helper { - int fd; - int wrote; -}; - -ftdm_status_t my_write_sample(int16_t *buf, ftdm_size_t buflen, void *user_data) -{ - struct helper *foo = (struct helper *) user_data; - size_t len; - len = write(foo->fd, buf, buflen * 2); - if (!len) return FTDM_FAIL; - foo->wrote += buflen * 2; - return FTDM_SUCCESS; -} - -int main(int argc, char *argv[]) -{ - struct ftdm_fsk_modulator fsk_trans; - ftdm_fsk_data_state_t fsk_data = {0}; - int fd = -1; - int16_t buf[160] = {0}; - ssize_t len = 0; - size_t type, mlen; - char *sp; - char str[128] = ""; - char fbuf[256]; - uint8_t databuf[1024] = ""; - struct helper foo = {0}; - // int x, bytes, start_bits = 180, stop_bits = 5, sbits = 300; - char time_str[9]; - struct tm tm; - time_t now; - - if (argc < 2) { - int x; - const char *url = "sip:cool@rad.com"; - - if ((fd = open("tone.raw", O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR)) < 0) { - fprintf(stderr, "File Error! [%s]\n", strerror(errno)); - exit(-1); - } - - - time(&now); - localtime_r(&now, &tm); - strftime(time_str, sizeof(time_str), "%m%d%H%M", &tm); - - ftdm_fsk_data_init(&fsk_data, databuf, sizeof(databuf)); -#if 1 - - ftdm_fsk_data_add_mdmf(&fsk_data, MDMF_DATETIME, (uint8_t *)time_str, strlen(time_str)); - //ftdm_fsk_data_add_mdmf(&fsk_data, MDMF_DATETIME, "06091213", 8); - ftdm_fsk_data_add_mdmf(&fsk_data, MDMF_PHONE_NUM, (uint8_t *)"14149361212", 7); - ftdm_fsk_data_add_mdmf(&fsk_data, MDMF_PHONE_NAME, (uint8_t *)"Fred Smith", 10); - for(x = 0; x < 0; x++) - ftdm_fsk_data_add_mdmf(&fsk_data, MDMF_ALT_ROUTE, (uint8_t *)url, strlen(url)); -#else - ftdm_fsk_data_add_sdmf(&fsk_data, "06061234", "0"); - //ftdm_fsk_data_add_sdmf(&state, "06061234", "5551212"); -#endif - ftdm_fsk_data_add_checksum(&fsk_data); - - foo.fd = fd; - - - ftdm_fsk_modulator_init(&fsk_trans, FSK_BELL202, 8000, &fsk_data, -14, 180, 5, 300, my_write_sample, &foo); - ftdm_fsk_modulator_send_all((&fsk_trans)); - - printf("%u %d %d\n", (unsigned) fsk_data.dlen, foo.wrote, fsk_trans.est_bytes); - - if (fd > -1) { - close (fd); - } - - return 0; - } - - if (ftdm_fsk_demod_init(&fsk_data, 8000, (uint8_t *)fbuf, sizeof(fbuf))) { - printf("wtf\n"); - return 0; - } - - if ((fd = open(argv[1], O_RDONLY)) < 0) { - fprintf(stderr, "cant open file %s\n", argv[1]); - exit (-1); - } - - while((len = read(fd, buf, sizeof(buf))) > 0) { - if (ftdm_fsk_demod_feed(&fsk_data, buf, len / 2) != FTDM_SUCCESS) { - break; - } - } - - while(ftdm_fsk_data_parse(&fsk_data, &type, &sp, &mlen) == FTDM_SUCCESS) { - ftdm_copy_string(str, sp, mlen+1); - *(str+mlen) = '\0'; - ftdm_clean_string(str); - printf("TYPE %u (%s) LEN %u VAL [%s]\n", (unsigned)type, ftdm_mdmf_type2str(type), (unsigned)mlen, str); - } - - ftdm_fsk_demod_destroy(&fsk_data); - - close(fd); - return 0; -} diff --git a/libs/freetdm/src/testisdn.c b/libs/freetdm/src/testisdn.c deleted file mode 100644 index 13e14aedd2..0000000000 --- a/libs/freetdm/src/testisdn.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "freetdm.h" -#include - - -static FIO_SIGNAL_CB_FUNCTION(on_signal) -{ - return FTDM_FAIL; -} - -static int R = 0; -static void handle_SIGINT(int sig) -{ - if (sig); - R = 0; - return; -} - -int main(int argc, char *argv[]) -{ - ftdm_span_t *span; - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - - if (argc < 2) { - printf("umm no\n"); - exit(-1); - } - - if (ftdm_global_init() != FTDM_SUCCESS) { - fprintf(stderr, "Error loading FreeTDM\n"); - exit(-1); - } - - printf("FreeTDM loaded\n"); - - if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) { - fprintf(stderr, "Error finding FreeTDM span\n"); - goto done; - } - - if (ftdm_configure_span("isdn", span, on_signal, - "mode", "te", - "dialect", "national", - TAG_END) == FTDM_SUCCESS) { - ftdm_span_start(span); - } else { - fprintf(stderr, "Error starting ISDN D-Channel\n"); - goto done; - } - - signal(SIGINT, handle_SIGINT); - R = 1; - while(R) { - ftdm_sleep(1 * 1000); - } - - done: - - ftdm_global_destroy(); - - return 1; - -} - -/* 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/freetdm/src/testpri.c b/libs/freetdm/src/testpri.c deleted file mode 100644 index fb7c0bdd38..0000000000 --- a/libs/freetdm/src/testpri.c +++ /dev/null @@ -1,174 +0,0 @@ -#include "freetdm.h" -#include -#include -#include -#include -#include -#include -#include - -static int THREADS[4][31] = { {0} }; -static int R = 0; -static int T = 0; -static ftdm_mutex_t *mutex = NULL; - - -static void *channel_run(ftdm_thread_t *me, void *obj) -{ - ftdm_channel_t *ftdmchan = obj; - int fd = -1; - short buf[160]; - int spanid = ftdm_channel_get_span_id(ftdmchan); - int chanid = ftdm_channel_get_id(ftdmchan); - - ftdm_unused_arg(me); - - ftdm_mutex_lock(mutex); - T++; - ftdm_mutex_unlock(mutex); - - ftdm_channel_call_answer(ftdmchan); - - if ((fd = open("test.raw", O_RDONLY, 0)) < 0) { - goto end; - } - - while(R == 1 && THREADS[spanid][chanid] == 1) { - ssize_t bytes = read(fd, buf, sizeof(buf)); - size_t bbytes; - - if (bytes <= 0) { - break; - } - - bbytes = (size_t) bytes; - - fio_slin2alaw(buf, sizeof(buf), &bbytes); - - if (ftdm_channel_write(ftdmchan, buf, sizeof(buf), &bbytes) != FTDM_SUCCESS) { - break; - } - } - - close(fd); - - end: - - ftdm_channel_call_hangup(ftdmchan); - - THREADS[spanid][chanid] = 0; - - ftdm_mutex_lock(mutex); - T = 0; - ftdm_mutex_unlock(mutex); - - return NULL; -} - -static FIO_SIGNAL_CB_FUNCTION(on_signal) -{ - int spanid = ftdm_channel_get_span_id(sigmsg->channel); - int chanid = ftdm_channel_get_id(sigmsg->channel); - ftdm_log(FTDM_LOG_DEBUG, "got sig %d:%d [%s]\n", spanid, chanid, ftdm_signal_event2str(sigmsg->event_id)); - - switch(sigmsg->event_id) { - - case FTDM_SIGEVENT_STOP: - THREADS[spanid][chanid] = -1; - break; - - case FTDM_SIGEVENT_START: - if (!THREADS[spanid][chanid]) { - THREADS[spanid][chanid] = 1; - ftdm_thread_create_detached(channel_run, sigmsg->channel); - } - - break; - default: - break; - } - - return FTDM_SUCCESS; -} - - -static void handle_SIGINT(int sig) -{ - ftdm_unused_arg(sig); - - ftdm_mutex_lock(mutex); - R = 0; - ftdm_mutex_unlock(mutex); - - return; -} - -int main(int argc, char *argv[]) -{ - ftdm_span_t *span; - ftdm_mutex_create(&mutex); - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - - if (argc < 2) { - printf("umm no\n"); - exit(-1); - } - - if (ftdm_global_init() != FTDM_SUCCESS) { - fprintf(stderr, "Error loading FreeTDM\n"); - exit(-1); - } - - printf("FreeTDM loaded\n"); - - if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) { - fprintf(stderr, "Error finding FreeTDM span\n"); - goto done; - } - - - - if (ftdm_configure_span( - span, "libpri", on_signal, - "node", "cpe", - "switch", "euroisdn", - "dp", "unknown", - "l1", "alaw", - "debug", NULL, - "opts", 0, - FTDM_TAG_END) == FTDM_SUCCESS) { - - - ftdm_span_start(span); - } else { - fprintf(stderr, "Error starting ISDN D-Channel\n"); - goto done; - } - - signal(SIGINT, handle_SIGINT); - ftdm_mutex_lock(mutex); - R = 1; - ftdm_mutex_unlock(mutex); - while(R || T) { - ftdm_sleep(1 * 1000); - } - - done: - - ftdm_global_destroy(); - - return 1; - -} - -/* 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/freetdm/src/testr2.c b/libs/freetdm/src/testr2.c deleted file mode 100644 index ef6897fc29..0000000000 --- a/libs/freetdm/src/testr2.c +++ /dev/null @@ -1,169 +0,0 @@ -#include "freetdm.h" -#include -#include - -static volatile int running = 0; -static ftdm_mutex_t *the_mutex = NULL; -static ftdm_channel_t *fchan = NULL; -static ftdm_channel_indication_t indication = FTDM_CHANNEL_INDICATE_NONE; - -static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) -{ - int chanid = ftdm_channel_get_ph_id(sigmsg->channel); - ftdm_log(FTDM_LOG_DEBUG, "Got R2 channel sig [%s] in channel %d\n", ftdm_signal_event2str(sigmsg->event_id), chanid); - switch (sigmsg->event_id) { - case FTDM_SIGEVENT_START: - { - ftdm_mutex_lock(the_mutex); - if (!fchan) { - fchan = sigmsg->channel; - indication = FTDM_CHANNEL_INDICATE_PROCEED; - } - ftdm_mutex_unlock(the_mutex); - } - break; - case FTDM_SIGEVENT_INDICATION_COMPLETED: - { - ftdm_channel_indication_t ind = FTDM_CHANNEL_INDICATE_NONE; - if (sigmsg->ev_data.indication_completed.indication == FTDM_CHANNEL_INDICATE_PROCEED) { - ftdm_log(FTDM_LOG_DEBUG, "Proceed indication result = %d\n", sigmsg->ev_data.indication_completed.status); - ind = FTDM_CHANNEL_INDICATE_PROGRESS; - } else if (sigmsg->ev_data.indication_completed.indication == FTDM_CHANNEL_INDICATE_PROGRESS) { - ftdm_log(FTDM_LOG_DEBUG, "Progress indication result = %d\n", sigmsg->ev_data.indication_completed.status); - ind = FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA; - } else if (sigmsg->ev_data.indication_completed.indication == FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA) { - ftdm_log(FTDM_LOG_DEBUG, "Progress media indication result = %d\n", sigmsg->ev_data.indication_completed.status); - ind = FTDM_CHANNEL_INDICATE_ANSWER; - } else if (sigmsg->ev_data.indication_completed.indication == FTDM_CHANNEL_INDICATE_ANSWER) { - ftdm_log(FTDM_LOG_DEBUG, "Answer indication result = %d\n", sigmsg->ev_data.indication_completed.status); - } else { - ftdm_log(FTDM_LOG_DEBUG, "Unexpected indication, result = %d\n", sigmsg->ev_data.indication_completed.status); - exit(1); - } - ftdm_mutex_lock(the_mutex); - if (fchan) { - indication = ind; - } - ftdm_mutex_unlock(the_mutex); - } - break; - case FTDM_SIGEVENT_STOP: - { - ftdm_channel_call_hangup(sigmsg->channel); - } - break; - case FTDM_SIGEVENT_RELEASED: - { - ftdm_mutex_lock(the_mutex); - if (fchan && fchan == sigmsg->channel) { - fchan = NULL; - } - ftdm_mutex_unlock(the_mutex); - } - break; - default: - break; - } - return FTDM_SUCCESS; -} - -static void stop_test(int sig) -{ - ftdm_unused_arg(sig); - running = 0; -} - -int main(int argc, char *argv[]) -{ - ftdm_span_t *span; - ftdm_conf_parameter_t parameters[20]; - - ftdm_mutex_create(&the_mutex); - - if (argc < 2) { - printf("umm no\n"); - exit(1); - } - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - - if (ftdm_global_init() != FTDM_SUCCESS) { - fprintf(stderr, "Error loading FreeTDM\n"); - exit(1); - } - - ftdm_global_configuration(); - - printf("FreeTDM loaded\n"); - - if (ftdm_span_find_by_name(argv[1], &span) != FTDM_SUCCESS) { - fprintf(stderr, "Error finding FreeTDM span %s\n", argv[1]); - goto done; - } - - /* testing non-blocking operation */ - //ftdm_span_set_blocking_mode(span, FTDM_FALSE); - - parameters[0].var = "variant"; - parameters[0].val = "br"; - - parameters[1].var = "max_ani"; - parameters[1].val = "4"; - - parameters[2].var = "max_dnis"; - parameters[2].val = "4"; - - parameters[3].var = "logging"; - parameters[3].val = "all"; - - parameters[4].var = NULL; - parameters[4].val = NULL; - - if (ftdm_configure_span_signaling(span, "r2", on_r2_signal, parameters) == FTDM_SUCCESS) { - ftdm_span_start(span); - } else { - fprintf(stderr, "Error starting R2 span\n"); - goto done; - } - - running = 1; - signal(SIGINT, stop_test); - while(running) { - ftdm_sleep(20); - if (fchan && indication != FTDM_CHANNEL_INDICATE_NONE) { - ftdm_channel_t *lchan = NULL; - ftdm_channel_indication_t ind = FTDM_CHANNEL_INDICATE_NONE; - ftdm_time_t start, stop, diff; - - ftdm_mutex_lock(the_mutex); - ind = indication; - indication = FTDM_CHANNEL_INDICATE_NONE; - lchan = fchan; - ftdm_mutex_unlock(the_mutex); - - start = ftdm_current_time_in_ms(); - ftdm_channel_call_indicate(lchan, ind); - stop = ftdm_current_time_in_ms(); - diff = stop - start; - ftdm_log(FTDM_LOG_DEBUG, "Setting indication %s took %"FTDM_TIME_FMT" ms\n", - ftdm_channel_indication2str(ind), diff); - } - } - -done: - - ftdm_global_destroy(); - - return 0; -} - -/* 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/freetdm/src/testtones.c b/libs/freetdm/src/testtones.c deleted file mode 100644 index d5d5d548bf..0000000000 --- a/libs/freetdm/src/testtones.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "private/ftdm_core.h" - -struct ttmp { - int fd; -}; - -static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map) -{ - struct ttmp *tmp = ts->user_data; - int wrote; - size_t len; - - wrote = teletone_mux_tones(ts, map); - len = write(tmp->fd, ts->buffer, wrote * 2); - - if (!len) return -1; - - return 0; -} - -#if 1 -int main(int argc, char *argv[]) -{ - teletone_generation_session_t ts; - struct ttmp tmp; - - if (argc < 3) { - fprintf(stderr, "Arg Error! \n"); - exit(-1); - } - - if ((tmp.fd = open(argv[1], O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR)) < 0) { - fprintf(stderr, "File Error! [%s]\n", strerror(errno)); - exit(-1); - } - - teletone_init_session(&ts, 0, teletone_handler, &tmp); - ts.rate = 8000; - ts.debug = 1; - ts.debug_stream = stdout; - teletone_run(&ts, argv[2]); - close(tmp.fd); - - return 0; -} -#else -int32_t main(int argc, char *argv[]) -{ - int32_t j, i, fd = -1; - int32_t rate = 8000; - /* SIT tones and durations */ - float tones[] = { 913.8, 1370.6, 1776.7, 0 }; - int32_t durations[] = {274, 274, 380, 0}; - teletone_dds_state_t dds = {0}; - int16_t sample; - size_t len = 1; - - if (argc < 2 || (fd = open(argv[1], O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR)) < 0) { - fprintf(stderr, "File Error!\n", strerror(errno)); - exit(-1); - } - - for (j = 0; tones[j] && durations[j]; j++) { - - teletone_dds_state_set_tone(&dds, tones[j], rate, -50); - - for(i = 0; (i < durations[j] * rate / 1000) && len != 0; i++) { - sample = teletone_dds_modulate_sample(&dds) * 20; - len = write(fd, &sample, sizeof(sample)); - } - - } - - close(fd); -} -#endif diff --git a/libs/freetdm/src/uart.c b/libs/freetdm/src/uart.c deleted file mode 100644 index 7211d9c643..0000000000 --- a/libs/freetdm/src/uart.c +++ /dev/null @@ -1,125 +0,0 @@ - -/* - * uart.c - * - * Copyright (c) 2005 Robert Krten. 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 THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. - * - * This module contains a simple 8-bit UART, which performs a callback - * with the decoded byte value. - * - * 2005 06 11 R. Krten created -*/ - -#include -#include -#include -#include -#include - -#include "uart.h" - -/* - * dsp_uart_attr_init - * - * Initializes the attributes structure; this must be done before the - * attributes structure is used. -*/ - -void dsp_uart_attr_init (dsp_uart_attr_t *attr) -{ - memset (attr, 0, sizeof (*attr)); -} - -/* - * dsp_uart_attr_get_bytehandler - * dsp_uart_attr_set_bytehandler - * - * These functions get and set their respective elements from the - * attributes structure. If an error code is returned, it is just - * zero == ok, -1 == fail. -*/ - -bytehandler_func_t dsp_uart_attr_get_bytehandler(dsp_uart_attr_t *attr, void **bytehandler_arg) -{ - *bytehandler_arg = attr->bytehandler_arg; - return attr->bytehandler; -} - -void dsp_uart_attr_set_bytehandler(dsp_uart_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg) -{ - attr->bytehandler = bytehandler; - attr->bytehandler_arg = bytehandler_arg; -} - -dsp_uart_handle_t *dsp_uart_create(dsp_uart_attr_t *attr) -{ - dsp_uart_handle_t *handle; - - handle = ftdm_malloc(sizeof (*handle)); - if (handle) { - memset(handle, 0, sizeof (*handle)); - - /* fill the attributes member */ - memcpy(&handle->attr, attr, sizeof (*attr)); - } - return handle; -} - -void dsp_uart_destroy(dsp_uart_handle_t **handle) -{ - if (*handle) { - ftdm_safe_free(*handle); - *handle = NULL; - } -} - - -void dsp_uart_bit_handler(void *x, int bit) -{ - dsp_uart_handle_t *handle = (dsp_uart_handle_t *) x; - - if (!handle->have_start) { - if (bit) { - return; /* waiting for start bit (0) */ - } - handle->have_start = 1; - handle->data = 0; - handle->nbits = 0; - return; - } - - handle->data >>= 1; - handle->data |= 0x80 * !!bit; - handle->nbits++; - - if (handle->nbits == 8) { - handle->attr.bytehandler(handle->attr.bytehandler_arg, handle->data); - handle->nbits = 0; - handle->data = 0; - handle->have_start = 0; - } -/* might consider handling errors in the future... */ -} - From d2981ec0c88d4c1dd2d8286cb7d82c25139b1c20 Mon Sep 17 00:00:00 2001 From: dhruvecosmob <87171798+dhruvecosmob@users.noreply.github.com> Date: Fri, 23 Jul 2021 00:51:20 +0530 Subject: [PATCH 148/655] [mod_signalwire] add token-reset subcommand to the signalwire api. --- .../mod_signalwire/mod_signalwire.c | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_signalwire/mod_signalwire.c b/src/mod/applications/mod_signalwire/mod_signalwire.c index 445de3744b..cabdf4bcc1 100644 --- a/src/mod/applications/mod_signalwire/mod_signalwire.c +++ b/src/mod/applications/mod_signalwire/mod_signalwire.c @@ -46,6 +46,7 @@ int sslContextFunction(void* curl, void* sslctx, void* userdata); static int debug_level = 7; static int signalwire_gateway_exists(void); +static switch_status_t mod_signalwire_load_or_generate_token(void); /* Prototypes */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_signalwire_shutdown); @@ -459,7 +460,7 @@ done: return status; } -#define SIGNALWIRE_SYNTAX "token | adoption | adopted | reload | update | debug | kslog " +#define SIGNALWIRE_SYNTAX "token | token-reset | adoption | adopted | reload | update | debug | kslog " SWITCH_STANDARD_API(mod_signalwire_api_function) { int argc = 0; @@ -529,6 +530,42 @@ SWITCH_STANDARD_API(mod_signalwire_api_function) } else if (!strcmp(argv[0], "update")) { globals.profile_update = KS_TRUE; stream->write_function(stream, "+OK\n"); + goto done; + } else if (!strcmp(argv[0], "token-reset")) { + char tmp[1024]; + + switch_snprintf(tmp, sizeof(tmp), "%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, SWITCH_PATH_SEPARATOR, "adoption-token.dat"); + if (switch_file_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) { + if (unlink(tmp)) { + stream->write_function(stream, "-ERR Could not delete the old adoption-token.dat file. Token was not re-generated.\n"); + goto done; + } + } + + switch_snprintf(tmp, sizeof(tmp), "%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, SWITCH_PATH_SEPARATOR, "adoption-auth.dat"); + if (switch_file_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) { + if (unlink(tmp)) { + stream->write_function(stream, "-ERR Could not delete the old adoption-auth.dat file. Token was not re-generated.\n"); + goto done; + } + } + + switch_snprintf(tmp, sizeof(tmp), "%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, SWITCH_PATH_SEPARATOR, "signalwire-conf.dat"); + if (switch_file_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) { + if (unlink(tmp)) { + stream->write_function(stream, "-ERR Could not delete the old signalwire-conf.dat file. Token was not re-generated.\n"); + goto done; + } + } + + if (mod_signalwire_load_or_generate_token() != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Could not generate a new token.\n"); + } else { + globals.state = SW_STATE_ADOPTION; + globals.adoption_next = ks_time_now(); + stream->write_function(stream, "+OK\n"); + } + goto done; } } @@ -909,6 +946,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_signalwire_load) switch_console_set_complete("add signalwire kslog on"); switch_console_set_complete("add signalwire kslog off"); switch_console_set_complete("add signalwire token"); + switch_console_set_complete("add signalwire token-reset"); switch_console_set_complete("add signalwire adoption"); switch_console_set_complete("add signalwire adopted"); switch_console_set_complete("add signalwire update"); From 2b039a3c32aeab40e39ebab1fcd06dc93c33ca7f Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 25 Aug 2021 19:32:43 +0300 Subject: [PATCH 149/655] Bump sofia-sip library requirement to version 1.13.5 --- configure.ac | 2 +- debian/bootstrap.sh | 2 +- freeswitch.spec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index c6a634eb95..25f01e8f0b 100644 --- a/configure.ac +++ b/configure.ac @@ -725,7 +725,7 @@ PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[ AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent]) ]) -PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.4],[ +PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.5],[ AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[ AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent]) ]) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 53db0f9499..981e2c42eb 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -332,7 +332,7 @@ Build-Depends: uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev, # used by many modules libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, - bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.4), + bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.5), libspandsp3-dev, # used to format the private freeswitch apt-repo key properly gnupg, diff --git a/freeswitch.spec b/freeswitch.spec index c9c7a447f3..e4a0a178a3 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -140,7 +140,7 @@ BuildRequires: curl-devel >= 7.19 BuildRequires: gcc-c++ BuildRequires: libtool >= 1.5.17 BuildRequires: openssl-devel >= 1.0.1e -BuildRequires: sofia-sip-devel >= 1.13.4 +BuildRequires: sofia-sip-devel >= 1.13.5 BuildRequires: spandsp3-devel >= 3.0 BuildRequires: pcre-devel BuildRequires: speex-devel From 641fcd2b2615c226bba8b04d30bc7b5d964b7106 Mon Sep 17 00:00:00 2001 From: mahald Date: Fri, 27 Aug 2021 17:48:32 +0200 Subject: [PATCH 150/655] [mod_amqp] Increase max command size --- src/mod/event_handlers/mod_amqp/mod_amqp_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_command.c b/src/mod/event_handlers/mod_amqp/mod_amqp_command.c index f467001f3d..c98c123c07 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_command.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_command.c @@ -387,7 +387,7 @@ void * SWITCH_THREAD_FUNC mod_amqp_command_thread(switch_thread_t *thread, void amqp_rpc_reply_t res; amqp_envelope_t envelope; struct timeval timeout = {0}; - char command[1024]; + char command[10240]; enum ECommandFormat { COMMAND_FORMAT_UNKNOWN, COMMAND_FORMAT_PLAINTEXT From bddff9a2f14a2f834d78507ca8dc583a70837087 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 28 Aug 2021 14:19:05 +0300 Subject: [PATCH 151/655] [Build-System] Update libsrtp to 2.4.0 --- Makefile.am | 7 +- libs/srtp/.gitignore | 4 +- libs/srtp/.travis.yml | 415 ++++++++- libs/srtp/CHANGES | 86 +- libs/srtp/CMakeLists.txt | 348 ++++++++ libs/srtp/CODEOWNERS | 3 + libs/srtp/Makefile.am | 22 +- libs/srtp/README.md | 87 +- libs/srtp/cmake/FindMbedTLS.cmake | 38 + libs/srtp/cmake/FindNSS.cmake | 15 + libs/srtp/config.hw | 305 +++---- libs/srtp/{config.h_win32vc7 => config_in.h} | 118 ++- libs/srtp/config_in_cmake.h | 121 +++ libs/srtp/configure.ac | 17 +- libs/srtp/crypto/Makefile.in | 46 +- libs/srtp/crypto/cipher/aes.c | 24 +- libs/srtp/crypto/cipher/aes_gcm_mbedtls.c | 412 +++++++++ libs/srtp/crypto/cipher/aes_gcm_nss.c | 442 ++++++++++ libs/srtp/crypto/cipher/aes_gcm_ossl.c | 230 +---- libs/srtp/crypto/cipher/aes_icm.c | 99 +-- libs/srtp/crypto/cipher/aes_icm_mbedtls.c | 371 ++++++++ libs/srtp/crypto/cipher/aes_icm_nss.c | 404 +++++++++ libs/srtp/crypto/cipher/aes_icm_ossl.c | 171 +--- libs/srtp/crypto/cipher/cipher.c | 57 +- libs/srtp/crypto/cipher/cipher_test_cases.c | 365 ++++++++ libs/srtp/crypto/cipher/cipher_test_cases.h | 53 ++ libs/srtp/crypto/cipher/null_cipher.c | 2 +- libs/srtp/crypto/hash/auth.c | 6 + libs/srtp/crypto/hash/auth_test_cases.c | 70 ++ .../aes_gcm_ossl.h => hash/auth_test_cases.h} | 34 +- libs/srtp/crypto/hash/hmac.c | 36 +- libs/srtp/crypto/hash/hmac_mbedtls.c | 221 +++++ libs/srtp/crypto/hash/hmac_nss.c | 290 +++++++ libs/srtp/crypto/hash/hmac_ossl.c | 39 +- libs/srtp/crypto/hash/sha1.c | 23 +- libs/srtp/crypto/include/aes_gcm.h | 110 +++ .../include/{aes_icm_ossl.h => aes_icm_ext.h} | 38 + .../crypto/include/{stat.h => cipher_priv.h} | 34 +- libs/srtp/crypto/include/cipher_types.h | 11 +- libs/srtp/crypto/include/datatypes.h | 164 +--- libs/srtp/crypto/include/err.h | 5 + libs/srtp/crypto/include/key.h | 2 - libs/srtp/crypto/include/null_auth.h | 11 - libs/srtp/crypto/include/rdb.h | 2 - libs/srtp/crypto/include/sha1.h | 94 -- libs/srtp/crypto/kernel/alloc.c | 2 +- libs/srtp/crypto/kernel/crypto_kernel.c | 16 +- libs/srtp/crypto/kernel/err.c | 2 +- libs/srtp/crypto/kernel/key.c | 8 - libs/srtp/crypto/math/datatypes.c | 211 +---- libs/srtp/crypto/math/stat.c | 213 ----- libs/srtp/crypto/replay/rdb.c | 2 + libs/srtp/crypto/test/aes_calc.c | 43 +- libs/srtp/crypto/test/cipher_driver.c | 66 +- libs/srtp/crypto/test/datatypes_driver.c | 60 +- libs/srtp/crypto/test/kernel_driver.c | 12 - libs/srtp/crypto/test/meson.build | 41 + libs/srtp/crypto/test/stat_driver.c | 258 ------ libs/srtp/doc/Doxyfile.in | 2 +- libs/srtp/doc/Makefile.in | 2 +- libs/srtp/doc/meson.build | 22 + libs/srtp/include/ekt.h | 181 ---- libs/srtp/include/srtp.h | 88 +- libs/srtp/include/srtp2/meson.build | 8 + libs/srtp/include/srtp_priv.h | 4 +- libs/srtp/install-win.bat | 35 - libs/srtp/libsrtp.2017.vcxproj | 7 +- libs/srtp/libsrtp2.pc.in | 3 +- libs/srtp/meson.build | 297 +++++++ libs/srtp/meson_options.txt | 18 + libs/srtp/srtp.def | 32 +- libs/srtp/srtp/ekt.c | 281 ------ libs/srtp/srtp/srtp.c | 287 +++---- libs/srtp/srtp2.vcxproj | 808 +++++++++--------- libs/srtp/srtp2.vcxproj.filters | 369 ++++---- libs/srtp/test/Makefile.am | 33 - libs/srtp/test/dtls_srtp_driver.c | 261 ------ libs/srtp/test/getopt_s.c | 3 +- libs/srtp/{include => test}/getopt_s.h | 0 libs/srtp/test/meson.build | 77 ++ libs/srtp/test/rdbx_driver.c | 16 +- libs/srtp/test/replay_driver.c | 10 +- libs/srtp/test/roc_driver.c | 2 +- libs/srtp/test/rtp.c | 4 +- libs/srtp/test/rtp_decoder.c | 352 ++++++-- libs/srtp/test/rtp_decoder.h | 32 +- libs/srtp/test/rtpw.c | 13 +- libs/srtp/test/rtpw_test.sh | 16 +- libs/srtp/test/rtpw_test_gcm.sh | 16 +- libs/srtp/test/srtp_driver.c | 166 ++-- libs/srtp/test/test_srtp.c | 16 +- libs/srtp/{crypto/replay => test}/ut_sim.c | 5 +- libs/srtp/{include => test}/ut_sim.h | 0 libs/srtp/test/util.c | 6 +- libs/srtp/undos.sh | 10 - 95 files changed, 5998 insertions(+), 3870 deletions(-) create mode 100644 libs/srtp/CMakeLists.txt create mode 100644 libs/srtp/CODEOWNERS create mode 100644 libs/srtp/cmake/FindMbedTLS.cmake create mode 100644 libs/srtp/cmake/FindNSS.cmake rename libs/srtp/{config.h_win32vc7 => config_in.h} (63%) create mode 100644 libs/srtp/config_in_cmake.h create mode 100644 libs/srtp/crypto/cipher/aes_gcm_mbedtls.c create mode 100644 libs/srtp/crypto/cipher/aes_gcm_nss.c create mode 100644 libs/srtp/crypto/cipher/aes_icm_mbedtls.c create mode 100644 libs/srtp/crypto/cipher/aes_icm_nss.c create mode 100644 libs/srtp/crypto/cipher/cipher_test_cases.c create mode 100644 libs/srtp/crypto/cipher/cipher_test_cases.h create mode 100644 libs/srtp/crypto/hash/auth_test_cases.c rename libs/srtp/crypto/{include/aes_gcm_ossl.h => hash/auth_test_cases.h} (76%) create mode 100644 libs/srtp/crypto/hash/hmac_mbedtls.c create mode 100644 libs/srtp/crypto/hash/hmac_nss.c create mode 100644 libs/srtp/crypto/include/aes_gcm.h rename libs/srtp/crypto/include/{aes_icm_ossl.h => aes_icm_ext.h} (76%) rename libs/srtp/crypto/include/{stat.h => cipher_priv.h} (77%) delete mode 100644 libs/srtp/crypto/math/stat.c create mode 100644 libs/srtp/crypto/test/meson.build delete mode 100644 libs/srtp/crypto/test/stat_driver.c create mode 100644 libs/srtp/doc/meson.build delete mode 100644 libs/srtp/include/ekt.h create mode 100644 libs/srtp/include/srtp2/meson.build delete mode 100644 libs/srtp/install-win.bat create mode 100644 libs/srtp/meson.build create mode 100644 libs/srtp/meson_options.txt delete mode 100644 libs/srtp/srtp/ekt.c delete mode 100644 libs/srtp/test/Makefile.am delete mode 100644 libs/srtp/test/dtls_srtp_driver.c rename libs/srtp/{include => test}/getopt_s.h (100%) create mode 100644 libs/srtp/test/meson.build rename libs/srtp/{crypto/replay => test}/ut_sim.c (95%) rename libs/srtp/{include => test}/ut_sim.h (100%) delete mode 100755 libs/srtp/undos.sh diff --git a/Makefile.am b/Makefile.am index 984872c36d..8905f06729 100644 --- a/Makefile.am +++ b/Makefile.am @@ -599,14 +599,15 @@ libs/apr/libapr-1.la: libs/apr/Makefile libs/apr/.update libs/apr-util/libaprutil-1.la: libs/apr/libapr-1.la libs/apr-util libs/apr-util/.update @if [ $(MAKELEVEL) = 0 -o -z "`echo "$(MAKEARGS)" | grep "j"`" ] ; then touch $(switch_srcdir)/src/include/switch.h; cd libs/apr-util && $(MAKE) $(MFLAGS) && touch libaprutil-1.la; fi -SRTP_SRC = libs/srtp/srtp/srtp.c libs/srtp/srtp/ekt.c libs/srtp/crypto/cipher/cipher.c libs/srtp/crypto/cipher/null_cipher.c \ +SRTP_SRC = libs/srtp/srtp/srtp.c libs/srtp/crypto/cipher/cipher.c libs/srtp/crypto/cipher/null_cipher.c \ libs/srtp/crypto/cipher/aes.c libs/srtp/crypto/cipher/aes_icm.c \ libs/srtp/crypto/hash/null_auth.c libs/srtp/crypto/hash/sha1.c \ libs/srtp/crypto/hash/hmac.c libs/srtp/crypto/hash/auth.c \ - libs/srtp/crypto/math/datatypes.c libs/srtp/crypto/math/stat.c \ + libs/srtp/crypto/math/datatypes.c \ libs/srtp/crypto/kernel/crypto_kernel.c libs/srtp/crypto/kernel/alloc.c \ libs/srtp/crypto/kernel/key.c libs/srtp/crypto/kernel/err.c \ - libs/srtp/crypto/replay/rdb.c libs/srtp/crypto/replay/rdbx.c libs/srtp/crypto/replay/ut_sim.c + libs/srtp/crypto/replay/rdb.c libs/srtp/crypto/replay/rdbx.c \ + libs/srtp/crypto/cipher/cipher_test_cases.c libs/srtp/crypto/hash/auth_test_cases.c libs/srtp/libsrtp.la: libs/srtp libs/srtp/.update $(SRTP_SRC) touch $(switch_srcdir)/src/include/switch.h diff --git a/libs/srtp/.gitignore b/libs/srtp/.gitignore index a5ccf852db..270bd9e2b1 100644 --- a/libs/srtp/.gitignore +++ b/libs/srtp/.gitignore @@ -23,6 +23,7 @@ old? *.app # srtp things +build Debug Makefile Root @@ -35,12 +36,9 @@ crypto/test/cipher_driver crypto/test/datatypes_driver crypto/test/env crypto/test/kernel_driver -crypto/test/rand_gen crypto/test/sha1_driver crypto/test/stat_driver -crypto/test/rand_gen_soak tables/aes_tables -test/dtls_srtp_driver test/rdbx_driver test/replay_driver test/roc_driver diff --git a/libs/srtp/.travis.yml b/libs/srtp/.travis.yml index e0a7983de2..010fba072d 100644 --- a/libs/srtp/.travis.yml +++ b/libs/srtp/.travis.yml @@ -1,5 +1,4 @@ -dist: trusty -sudo: false +dist: xenial language: c env: @@ -9,58 +8,204 @@ env: matrix: include: - # default linux build with gcc + # linux build - os: linux env: - - TEST="linux gcc" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-6 - script: - - CC=gcc-6 EXTRA_CFLAGS=-Werror ./configure - - make - - make runtest - - # linux build with openssl and gcc - - os: linux - env: - - TEST="linux gcc (openssl)" + - TEST="linux (gcc)" addons: apt: sources: - ubuntu-toolchain-r-test packages: - gcc-6 + - valgrind + install: + - pyenv global 3.7.1 + - pip3 install meson ninja + script: + - CC=gcc-6 EXTRA_CFLAGS=-Werror ./configure + - make + - make runtest + - make runtest-valgrind + - make distclean + - mkdir build && cd build + - cmake -DBUILD_WITH_SANITIZERS=TRUE .. + - make + - CTEST_OUTPUT_ON_FAILURE=1 make test + - cd .. + - CC=gcc-6 meson setup --werror builddir + - meson compile -C builddir + - meson test -v -C builddir + + # linux build with openssl + - os: linux + env: + - TEST="linux openssl (gcc)" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-6 + - valgrind + install: + - pyenv global 3.7.1 + - pip3 install meson ninja script: - CC=gcc-6 EXTRA_CFLAGS=-Werror ./configure --enable-openssl - make - make runtest + - make runtest-valgrind + - make distclean + - mkdir build && cd build + - cmake -DENABLE_OPENSSL=ON -DBUILD_WITH_SANITIZERS=TRUE .. + - make + - CTEST_OUTPUT_ON_FAILURE=1 make test + - cd .. + - mkdir build_shared && cd build_shared + - cmake -DENABLE_OPENSSL=ON -DBUILD_SHARED_LIBS=ON .. + - make + - make test + - cd .. + - meson setup --werror -Dcrypto-library=openssl builddir + - meson compile -C builddir + - meson test -v -C builddir # linux build with openssl and clang - os: linux env: - - TEST="linux clang (openssl)" + - TEST="linux openssl (clang)" addons: apt: packages: - clang + install: + - pyenv global 3.7.1 + - pip3 install meson ninja script: - CC=clang EXTRA_CFLAGS=-Werror ./configure --enable-openssl - make - make runtest + - CC=clang meson setup --werror -Dcrypto-library=openssl builddir + - meson compile -C builddir + - meson test -v -C builddir - # default osx build with xcode (clang) + # linux build with nss + - os: linux + env: + - TEST="linux nss (gcc / valgrind)" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-6 + - valgrind + - libnss3-dev + install: + - pyenv global 3.7.1 + - pip3 install meson ninja + script: + - CC=gcc-6 EXTRA_CFLAGS=-Werror ./configure --enable-nss + - make + - make runtest + - make runtest-valgrind + - mkdir build && cd build + - cmake -DENABLE_NSS=ON -DBUILD_WITH_SANITIZERS=TRUE .. + - make + - CTEST_OUTPUT_ON_FAILURE=1 make test + - cd .. + - CC=gcc-6 meson setup --werror -Dcrypto-library=nss builddir + - meson compile -C builddir + - meson test -v -C builddir + + # linux build with mbedtls + - os: linux + env: + - TEST="linux mbedtls (gcc)" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-6 + - libmbedtls-dev + script: + - mkdir build && cd build + - cmake -DENABLE_MBEDTLS=ON -DBUILD_WITH_SANITIZERS=TRUE .. + - make + - CTEST_OUTPUT_ON_FAILURE=1 make test + - cd .. + + # default osx build - os: osx env: - - TEST="osx XCode 8.2" - osx_image: xcode8.2 + - TEST="osx" + before_install: + - pip3 install meson ninja script: - EXTRA_CFLAGS=-Werror ./configure - make - make runtest + - make distclean + - mkdir build && cd build + - cmake .. + - make + - make test + - cd .. + - meson setup --werror builddir + - meson compile -C builddir + - meson test -v -C builddir + + # osx build with openssl + - os: osx + osx_image: xcode11.2 + env: + - TEST="osx openssl" + before_install: + - pip3 install meson ninja + - brew install openssl@1.1 + script: + - PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig EXTRA_CFLAGS=-Werror ./configure --enable-openssl + - make + - make runtest + - make distclean + - mkdir build && cd build + - cmake -DOPENSSL_ROOT_DIR=$(brew --prefix openssl@1.1) -DENABLE_OPENSSL=ON .. + - make + - make test + - cd .. + - PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig meson setup --werror -Dcrypto-library=openssl builddir + - meson compile -C builddir + - meson test -v -C builddir + + # osx build with nss + - os: osx + osx_image: xcode11.2 + env: + - TEST="osx nss" + before_install: + - pip3 install meson ninja + script: + - PKG_CONFIG_PATH=$(brew --prefix nss)/lib/pkgconfig EXTRA_CFLAGS=-Werror ./configure --enable-nss + - make + - make runtest + - PKG_CONFIG_PATH=$(brew --prefix nss)/lib/pkgconfig meson setup --werror -Dcrypto-library=nss builddir + - meson compile -C builddir + - meson test -v -C builddir + + # osx build for Apple Silicon + - os: osx + osx_image: xcode12u + env: + - TEST="osx Apple Silicon" + script: + - mkdir build && cd build + - cmake "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" .. + - make + - lipo -info srtp_driver + - make test + # code format check - os: linux @@ -73,25 +218,8 @@ matrix: script: - CLANG_FORMAT=clang-format-3.9 ./format.sh -d - # valgrind - - os: linux - env: - - TEST="valgrind (openssl)" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-6 - - valgrind - script: - - CC=gcc-6 ./configure --enable-openssl - - make - - make runtest-valgrind - # big-endian - os: linux - sudo: true env: - TEST="big-endian" services: @@ -105,13 +233,48 @@ matrix: - sudo docker run --volume $(pwd):/src --workdir /src --name mipsX --tty --detach ubuntu:16.04 tail - sudo docker exec --tty mipsX apt-get update - sudo docker exec --tty mipsX apt-get install build-essential -y - - sudo docker exec --tty mipsX apt-get install gcc-mips-linux-gnu -y + - sudo docker exec --tty mipsX apt-get install qemu-user-static qemu-system-mips gcc-mips-linux-gnu python3-pip -y + - sudo docker exec --tty mipsX pip3 install meson==0.56.2 ninja script: - sudo docker exec --tty mipsX bash -c 'EXTRA_CFLAGS=-static CC=mips-linux-gnu-gcc ./configure --host=mips-linux-gnu' - sudo docker exec --tty mipsX make - - sudo docker kill mipsX - file test/srtp_driver - make runtest + - | + cat > mips-cross-file.txt < uwp-amd64-cross-file.txt < uwp-arm64-cross-file.txt < android-cross-file.txt < ios-cross-file.txt <= 3.52. + +#521 - Remove references to dtls from libsrtp. + +#520 - Use nss based hmac when nss enabled. + +#519 - Move selftest vectors form backends to common files. + +#515 - Extend cmake support. + +#514 - Fix gcc11 warning by defining output length. + +#502 - Remove visual studio build files. + +#501 - cmake: Set the VERSION property of the srtp2 library. + +#500 - Fixed issue #499 with buffer overflow. + +#498 - Feature/additional error checks. + +#496 - Rework check for OPENSSL_cleanse(). + +#492 - Avoid non-existing compiler flag -O4. + +#491 - Fix two-byte RTP header extension encryption. + +#478 - Modify cmake to install crypto_types.h instead of cipher_types.h + +2.3.0 + +Major changes + +A fuzzer was added to the project based on libFuzzer. This is run as part of Google oss-fuzz, the current status can be found at https://oss-fuzz-build-logs.storage.googleapis.com/index.html#libsrtp . Details available in PR #442 and issue #393. + +CMake support was added as an alternative build system. This was primarily added to replace the Visual Studio project files currently checked in but has been extend to support building on all platforms. Initial PR #449 and #455 but has been support has been continuously improved. + +NSS support for crypto backend was added. This is can be used as an alternative to openssl. Initial PR #413 but there has been numerous improvements. + +Other changes + +PR #474 - Add flag to disable pcap dependency when build test apps. + +PR #472 - Add ci builds for ios and android. + +PR #463 - problem on srtp_aes_icm_openssl_encrypt. + +PR #471 - Allow the pcap file to be read from a physical file. + +PR #457 - Fix docs crypto_policy_* -> srtp_crypto_policy_* . + +PR #452 - crypto/cipher: Reset the EVP_CIPHER_CTX structure before each test. + +PR #444 - Extend rtp_ecoder to support RTCP and multiplexed SSRC's. + +PR #443 - rtp_decoder avoid crash when no packets found. + +PR #429 - Rand for test only. + +PR #421 - Fix GCM IV logging. + +PR #415 - Fixes unaligned trailer access. + +PR #414 - Detect and handle broken "OPENSSL_cleanse". + +2.2.0 Major changes diff --git a/libs/srtp/CMakeLists.txt b/libs/srtp/CMakeLists.txt new file mode 100644 index 0000000000..f12b9f0adf --- /dev/null +++ b/libs/srtp/CMakeLists.txt @@ -0,0 +1,348 @@ +cmake_minimum_required(VERSION 3.12) + +project(libsrtp2 VERSION 2.4.0 LANGUAGES C) + +set(PACKAGE_VERSION ${CMAKE_PROJECT_VERSION}) +set(PACKAGE_STRING "${CMAKE_PROJECT_NAME} ${CMAKE_PROJECT_VERSION}") + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +include(TestBigEndian) +include(CheckIncludeFile) +include(CheckFunctionExists) +include(CheckTypeSize) +include(CheckCSourceCompiles) + +test_big_endian(WORDS_BIGENDIAN) + +if (NOT APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)") + set (HAVE_X86 TRUE) +else () + set (HAVE_X86 FALSE) +endif () + +check_include_file(arpa/inet.h HAVE_ARPA_INET_H) +check_include_file(byteswap.h HAVE_BYTESWAP_H) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(machine/types.h HAVE_MACHINE_TYPES_H) +check_include_file(netinet/in.h HAVE_NETINET_IN_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stdlib.h HAVE_STDLIB_H) +check_include_file(sys/int_types.h HAVE_SYS_INT_TYPES_H) +check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(windows.h HAVE_WINDOWS_H) +check_include_file(winsock2.h HAVE_WINSOCK2_H) + +check_function_exists(sigaction HAVE_SIGACTION) +check_function_exists(inet_aton HAVE_INET_ATON) +check_function_exists(usleep HAVE_USLEEP) + +check_type_size(uint8_t UINT8_T) +check_type_size(uint16_t UINT16_T) +check_type_size(uint32_t UINT32_T) +check_type_size(uint64_t UINT64_T) +check_type_size(int32_t INT32_T) +check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG) +check_type_size("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG) + +check_c_source_compiles("inline void func(); void func() { } int main() { func(); return 0; }" HAVE_INLINE) +if(NOT HAVE_INLINE) + check_c_source_compiles("__inline void func(); void func() { } int main() { func(); return 0; }" HAVE___INLINE) +endif() + +set(ENABLE_DEBUG_LOGGING OFF CACHE BOOL "Enable debug logging in all modules") +set(ERR_REPORTING_STDOUT OFF CACHE BOOL "Enable logging to stdout") +set(ERR_REPORTING_FILE "" CACHE FILEPATH "Use file for logging") +set(ENABLE_OPENSSL OFF CACHE BOOL "Enable OpenSSL crypto engine") +set(ENABLE_MBEDTLS OFF CACHE BOOL "Enable MbedTLS crypto engine") +set(ENABLE_NSS OFF CACHE BOOL "Enable NSS crypto engine") +set(TEST_APPS ON CACHE BOOL "Build test applications") +set(BUILD_WITH_SANITIZERS OFF CACHE BOOL "Adds sanitizer flags to compiler") +option(BUILD_SHARED_LIBS "Build shared library" OFF) + +if(ENABLE_OPENSSL OR ENABLE_MBEDTLS OR ENABLE_NSS) + set(USE_EXTERNAL_CRYPTO TRUE) +else() + set(USE_EXTERNAL_CRYPTO FALSE) +endif() + +if(ENABLE_OPENSSL) + if(ENABLE_NSS OR ENABLE_MBEDTLS) + message(FATAL_ERROR "ssl conflict. can not enable openssl and mbedtls or nss simultaneously.") + endif() + find_package(OpenSSL REQUIRED) + set(OPENSSL ${ENABLE_OPENSSL} CACHE BOOL INTERNAL) + set(GCM ${ENABLE_OPENSSL} CACHE BOOL INTERNAL) +endif() + +if(ENABLE_MBEDTLS) + if(ENABLE_OPENSSL OR ENABLE_NSS) + message(FATAL_ERROR "ssl conflict. can not enable mbedtls and openssl or nss simultaneously.") + endif() + find_package(MbedTLS REQUIRED) + set(MBEDTLS ${ENABLE_MBEDTLS} CACHE BOOL INTERNAL) + set(GCM ${ENABLE_MBEDTLS} CACHE BOOL INTERNAL) +endif() + +if(ENABLE_NSS) + if(ENABLE_OPENSSL OR ENABLE_MBEDTLS) + message(FATAL_ERROR "ssl conflict. can not enable nss and openssl or mbedtls simultaneously.") + endif() + find_package(NSS REQUIRED) + set(NSS ${ENABLE_NSS} CACHE BOOL INTERNAL) + set(GCM ${ENABLE_NSS} CACHE BOOL INTERNAL) +endif() + +set(CONFIG_FILE_DIR ${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CONFIG_FILE_DIR}) + +configure_file(config_in_cmake.h ${CONFIG_FILE_DIR}/config.h) +add_definitions(-DHAVE_CONFIG_H) + +if(BUILD_WITH_SANITIZERS AND NOT WIN32) + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(SANITIZERS address,undefined) + else() + set(SANITIZERS leak,address,undefined) + endif() + message(STATUS "Using sanitizers: ${SANITIZERS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=${SANITIZERS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=${SANITIZERS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=${SANITIZERS}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=${SANITIZERS}") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=${SANITIZERS}") +endif() + +set(SOURCES_C + srtp/srtp.c +) + +set(CIPHERS_SOURCES_C + crypto/cipher/cipher.c + crypto/cipher/cipher_test_cases.c + crypto/cipher/cipher_test_cases.h + crypto/cipher/null_cipher.c +) + +if(ENABLE_OPENSSL) + list(APPEND CIPHERS_SOURCES_C + crypto/cipher/aes_icm_ossl.c + crypto/cipher/aes_gcm_ossl.c + ) +elseif(ENABLE_MBEDTLS) + list(APPEND CIPHERS_SOURCES_C + crypto/cipher/aes_icm_mbedtls.c + crypto/cipher/aes_gcm_mbedtls.c + ) +elseif(ENABLE_NSS) + list(APPEND CIPHERS_SOURCES_C + crypto/cipher/aes_icm_nss.c + crypto/cipher/aes_gcm_nss.c + ) +else() + list(APPEND CIPHERS_SOURCES_C + crypto/cipher/aes.c + crypto/cipher/aes_icm.c + ) +endif() + +set(HASHES_SOURCES_C + crypto/hash/auth.c + crypto/hash/auth_test_cases.c + crypto/hash/auth_test_cases.h + crypto/hash/null_auth.c +) + +if(ENABLE_OPENSSL) + list(APPEND HASHES_SOURCES_C + crypto/hash/hmac_ossl.c + ) +elseif(ENABLE_MBEDTLS) + list(APPEND HASHES_SOURCES_C + crypto/hash/hmac_mbedtls.c + ) +elseif(ENABLE_NSS) + list(APPEND HASHES_SOURCES_C + crypto/hash/hmac_nss.c + ) +else() + list(APPEND HASHES_SOURCES_C + crypto/hash/hmac.c + crypto/hash/sha1.c + ) +endif() + +set(KERNEL_SOURCES_C + crypto/kernel/alloc.c + crypto/kernel/crypto_kernel.c + crypto/kernel/err.c + crypto/kernel/key.c +) + +set(MATH_SOURCES_C + crypto/math/datatypes.c +) + +set(REPLAY_SOURCES_C + crypto/replay/rdb.c + crypto/replay/rdbx.c +) + +set(SOURCES_H + crypto/include/aes.h + crypto/include/aes_icm.h + crypto/include/alloc.h + crypto/include/auth.h + crypto/include/cipher.h + crypto/include/cipher_types.h + crypto/include/crypto_kernel.h + crypto/include/crypto_types.h + crypto/include/datatypes.h + crypto/include/err.h + crypto/include/hmac.h + crypto/include/integers.h + crypto/include/key.h + crypto/include/null_auth.h + crypto/include/null_cipher.h + crypto/include/rdb.h + crypto/include/rdbx.h + crypto/include/sha1.h + include/srtp.h + include/srtp_priv.h + ${CONFIG_FILE_DIR}/config.h +) + +if(BUILD_SHARED_LIBS AND WIN32) + list(APPEND SOURCES_C + srtp.def + ) +endif() + +source_group("src" FILES ${SOURCES_C}) +source_group("src\\Ciphers" FILES ${CIPHERS_SOURCES_C}) +source_group("src\\Hashes" FILES ${HASHES_SOURCES_C}) +source_group("src\\Kernel" FILES ${KERNEL_SOURCES_C}) +source_group("src\\Math" FILES ${MATH_SOURCES_C}) +source_group("src\\Replay" FILES ${REPLAY_SOURCES_C}) +source_group("include" FILES ${SOURCES_H}) + +add_library(srtp2 + ${SOURCES_C} + ${CIPHERS_SOURCES_C} + ${HASHES_SOURCES_C} + ${KERNEL_SOURCES_C} + ${MATH_SOURCES_C} + ${REPLAY_SOURCES_C} + ${SOURCES_H} +) + +set_target_properties(srtp2 PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) + +target_include_directories(srtp2 PUBLIC crypto/include include) +if(ENABLE_OPENSSL) + target_include_directories(srtp2 PRIVATE ${OPENSSL_INCLUDE_DIR}) + target_link_libraries(srtp2 OpenSSL::Crypto) +elseif(ENABLE_MBEDTLS) + target_include_directories(srtp2 PRIVATE ${MBEDTLS_INCLUDE_DIRS}) + target_link_libraries(srtp2 ${MBEDTLS_LIBRARIES}) +elseif(ENABLE_NSS) + target_include_directories(srtp2 PRIVATE ${NSS_INCLUDE_DIRS}) + target_link_libraries(srtp2 ${NSS_LIBRARIES}) +endif() +if(WIN32) + target_link_libraries(srtp2 ws2_32) + target_compile_definitions(srtp2 PUBLIC _CRT_SECURE_NO_WARNINGS) +endif() + +install(TARGETS srtp2 DESTINATION lib) +install(FILES include/srtp.h crypto/include/auth.h + crypto/include/cipher.h + crypto/include/crypto_types.h + DESTINATION include/srtp2) + +if(TEST_APPS) + enable_testing() + + if(NOT (BUILD_SHARED_LIBS AND WIN32)) + if(NOT USE_EXTERNAL_CRYPTO) + add_executable(aes_calc crypto/test/aes_calc.c test/getopt_s.c test/util.c) + target_include_directories(aes_calc PRIVATE test) + target_link_libraries(aes_calc srtp2) + add_test(aes_calc_128 aes_calc 000102030405060708090a0b0c0d0e0f + 00112233445566778899aabbccddeeff + 69c4e0d86a7b0430d8cdb78070b4c55a) + add_test(aes_calc_256 aes_calc 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f + 00112233445566778899aabbccddeeff + 8ea2b7ca516745bfeafc49904b496089) + + add_executable(sha1_driver crypto/test/sha1_driver.c test/util.c) + target_include_directories(sha1_driver PRIVATE test) + target_link_libraries(sha1_driver srtp2) + add_test(sha1_driver sha1_driver -v) + endif() + + add_executable(datatypes_driver crypto/test/datatypes_driver.c test/util.c) + target_include_directories(datatypes_driver PRIVATE test) + target_link_libraries(datatypes_driver srtp2) + add_test(datatypes_driver datatypes_driver -v) + + add_executable(cipher_driver crypto/test/cipher_driver.c test/getopt_s.c) + target_include_directories(cipher_driver PRIVATE test) + target_link_libraries(cipher_driver srtp2) + add_test(cipher_driver cipher_driver -v) + + add_executable(kernel_driver crypto/test/kernel_driver.c test/getopt_s.c) + target_include_directories(kernel_driver PRIVATE test) + target_link_libraries(kernel_driver srtp2) + add_test(kernel_driver kernel_driver -v) + + add_executable(rdbx_driver test/rdbx_driver.c test/getopt_s.c test/ut_sim.c) + target_include_directories(rdbx_driver PRIVATE test) + target_link_libraries(rdbx_driver srtp2) + add_test(rdbx_driver rdbx_driver -v) + + add_executable(replay_driver test/replay_driver.c test/ut_sim.c) + target_include_directories(replay_driver PRIVATE test) + target_link_libraries(replay_driver srtp2) + add_test(replay_driver replay_driver -v) + + add_executable(roc_driver test/roc_driver.c test/ut_sim.c) + target_include_directories(roc_driver PRIVATE test) + target_link_libraries(roc_driver srtp2) + add_test(roc_driver roc_driver -v) + endif() + + add_executable(srtp_driver test/srtp_driver.c + test/util.c test/getopt_s.c) + target_link_libraries(srtp_driver srtp2) + add_test(srtp_driver srtp_driver -v) + + if(NOT (BUILD_SHARED_LIBS AND WIN32)) + add_executable(test_srtp test/test_srtp.c) + if(ENABLE_OPENSSL) + target_include_directories(test_srtp PRIVATE ${OPENSSL_INCLUDE_DIR}) + elseif(ENABLE_MBEDTLS) + target_include_directories(test_srtp PRIVATE ${MBEDTLS_INCLUDE_DIRS}) + elseif(ENABLE_NSS) + target_include_directories(test_srtp PRIVATE ${NSS_INCLUDE_DIRS}) + endif() + target_link_libraries(test_srtp srtp2) + add_test(test_srtp test_srtp) + endif() + + find_program(BASH_PROGRAM bash) + if(BASH_PROGRAM AND NOT WIN32) + add_executable(rtpw test/rtpw.c test/rtp.c test/util.c test/getopt_s.c) + target_link_libraries(rtpw srtp2) + add_test(NAME rtpw_test + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test/rtpw_test.sh -w ${CMAKE_CURRENT_SOURCE_DIR}/test/words.txt + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + if(GCM) + add_test(NAME rtpw_test_gcm + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test/rtpw_test_gcm.sh -w ${CMAKE_CURRENT_SOURCE_DIR}/test/words.txt + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + endif() + endif() +endif() diff --git a/libs/srtp/CODEOWNERS b/libs/srtp/CODEOWNERS new file mode 100644 index 0000000000..79fbd2c8c0 --- /dev/null +++ b/libs/srtp/CODEOWNERS @@ -0,0 +1,3 @@ +# Meson build file maintainers +meson.build @nirbheek @tp-m @xhaakon +meson_options.txt @nirbheek @tp-m @xhaakon diff --git a/libs/srtp/Makefile.am b/libs/srtp/Makefile.am index caff627c76..441f3ff9b1 100644 --- a/libs/srtp/Makefile.am +++ b/libs/srtp/Makefile.am @@ -9,18 +9,24 @@ HMAC_OBJS = @HMAC_OBJS@ AES_ICM_OBJS = @AES_ICM_OBJS@ lib_LTLIBRARIES = libsrtp.la -libsrtp_la_SOURCES = srtp/srtp.c srtp/ekt.c crypto/cipher/cipher.c crypto/cipher/null_cipher.c \ +libsrtp_la_SOURCES = srtp/srtp.c crypto/cipher/cipher.c crypto/cipher/null_cipher.c \ crypto/hash/null_auth.c crypto/hash/auth.c \ - crypto/math/datatypes.c crypto/math/stat.c \ + crypto/math/datatypes.c \ crypto/kernel/crypto_kernel.c crypto/kernel/alloc.c \ crypto/kernel/key.c \ crypto/kernel/err.c \ - crypto/replay/rdb.c crypto/replay/rdbx.c crypto/replay/ut_sim.c + crypto/replay/rdb.c crypto/replay/rdbx.c \ + crypto/cipher/cipher_test_cases.c crypto/hash/auth_test_cases.c -libsrtp_la_LDFLAGS = -version-info 1:42:1 +libsrtp_la_LDFLAGS = -version-info 2:4:0 EXTRA_DIST= +if GCM +AM_CPPFLAGS += -DGCM +AM_CFLAGS += -DGCM +endif + if ENABLE_OPENSSL libsrtp_la_SOURCES += crypto/cipher/aes_icm_ossl.c crypto/cipher/aes_gcm_ossl.c libsrtp_la_SOURCES += crypto/hash/hmac_ossl.c @@ -29,18 +35,14 @@ libsrtp_la_SOURCES += crypto/hash/sha1.c crypto/hash/hmac.c libsrtp_la_SOURCES += crypto/cipher/aes_icm.c crypto/cipher/aes.c endif -if GDOI -libsrtp_la_SOURCES += gdoi/srtp+gdoi.c -endif - library_includedir = $(prefix)/include/srtp -library_include_HEADERS = include/srtp.h include/ut_sim.h crypto/include/auth.h \ +library_include_HEADERS = include/srtp.h crypto/include/auth.h \ crypto/include/cipher_types.h \ crypto/include/datatypes.h crypto/include/integers.h crypto/include/null_cipher.h \ crypto/include/rdbx.h crypto/include/aes_icm.h crypto/include/cipher.h crypto/include/crypto_types.h \ crypto/include/err.h crypto/include/sha1.h \ crypto/include/aes.h crypto/include/config.h crypto/include/key.h \ - crypto/include/stat.h crypto/include/alloc.h crypto/include/crypto_kernel.h \ + crypto/include/alloc.h crypto/include/crypto_kernel.h \ crypto/include/hmac.h crypto/include/null_auth.h crypto/include/rdb.h pkgconfigdir = $(libdir)/pkgconfig diff --git a/libs/srtp/README.md b/libs/srtp/README.md index 3f1e5bbfde..b7072414b1 100644 --- a/libs/srtp/README.md +++ b/libs/srtp/README.md @@ -1,5 +1,7 @@ +[![CMake Build](https://github.com/cisco/libsrtp/actions/workflows/cmake.yml/badge.svg)](https://github.com/cisco/libsrtp/actions/workflows/cmake.yml) [![Build Status](https://travis-ci.org/cisco/libsrtp.svg?branch=master)](https://travis-ci.org/cisco/libsrtp) [![Coverity Scan Build Status](https://scan.coverity.com/projects/14274/badge.svg)](https://scan.coverity.com/projects/cisco-libsrtp) +[![OSS-Fuzz Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/systemd.svg)](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#libsrtp)
# Introduction to libSRTP @@ -12,10 +14,10 @@ and the library is in libsrtp2.a (after compilation). This document describes libSRTP, the Open Source Secure RTP library from Cisco Systems, Inc. RTP is the Real-time Transport Protocol, an IETF standard for the transport of real-time data such as telephony, -audio, and video, defined by [RFC 3550](https://www.ietf.org/rfc/rfc3550.txt). +audio, and video, defined by [RFC 3550](https://tools.ietf.org/html/rfc3550). Secure RTP (SRTP) is an RTP profile for providing confidentiality to RTP data and authentication to the RTP header and payload. SRTP is an IETF Standard, -defined in [RFC 3711](https://www.ietf.org/rfc/rfc3711.txt), and was developed +defined in [RFC 3711](https://tools.ietf.org/html/rfc3711), and was developed in the IETF Audio/Video Transport (AVT) Working Group. This library supports all of the mandatory features of SRTP, but not all of the optional features. See the [Supported Features](#supported-features) section for more detailed information. @@ -31,7 +33,7 @@ because it does its work behind the scenes. -------------------------------------------------------------------------------- - + # Contact Us - [libsrtp@lists.packetizer.com](mailto:libsrtp@lists.packetizer.com) general mailing list for news / announcements / discussions. This is an open list, see @@ -46,7 +48,7 @@ because it does its work behind the scenes. ## Contents - [Introduction to libSRTP](#introduction-to-libsrtp) - - [Contact Us](#contact) +- [Contact Us](#contact-us) - [Contents](#contents) - [License and Disclaimer](#license-and-disclaimer) - [libSRTP Overview](#libsrtp-overview) @@ -55,6 +57,7 @@ because it does its work behind the scenes. - [Implementation Notes](#implementation-notes) - [Installing and Building libSRTP](#installing-and-building-libsrtp) - [Changing Build Configuration](#changing-build-configuration) + - [Using Visual Studio](#using-visual-studio) - [Applications](#applications) - [Example Code](#example-code) - [Credits](#credits) @@ -137,16 +140,16 @@ can also be linked together to form an entire session policy. A linked list of `srtp_policy_t` structures is equivalent to a session policy. In such a policy, we refer to a single `srtp_policy_t` as an *element*. -An `srtp_policy_t` strucutre contains two `crypto_policy_t` structures +An `srtp_policy_t` structure contains two `srtp_crypto_policy_t` structures that describe the cryptograhic policies for RTP and RTCP, as well as the SRTP master key and the SSRC value. The SSRC describes what to -protect (e.g. which stream), and the `crypto_policy_t` structures +protect (e.g. which stream), and the `srtp_crypto_policy_t` structures describe how to protect it. The key is contained in a policy element because it simplifies the interface to the library. In many cases, it is desirable to use the same cryptographic policies across all of the streams in a session, but to use a distinct key for each stream. A -`crypto_policy_t` structure can be initialized by using either the -`crypto_policy_set_rtp_default()` or `crypto_policy_set_rtcp_default()` +`srtp_crypto_policy_t` structure can be initialized by using either the +`srtp_crypto_policy_set_rtp_default()` or `srtp_crypto_policy_set_rtcp_default()` functions, which set a crypto policy structure to the default policies for RTP and RTCP protection, respectively. @@ -195,7 +198,7 @@ in which a key is used for both inbound and outbound data. ## Supported Features This library supports all of the mandatory-to-implement features of -SRTP (as defined in [RFC 3711](https://www.ietf.org/rfc/rfc3711.txt)). Some of these +SRTP (as defined in [RFC 3711](https://tools.ietf.org/html/rfc3711)). Some of these features can be selected (or de-selected) at run time by setting an appropriate policy; this is done using the structure `srtp_policy_t`. Some other behaviors of the protocol can be adapted by defining an @@ -212,7 +215,7 @@ supported. This includes The user should be aware that it is possible to misuse this libary, and that the result may be that the security level it provides is inadequate. If you are implementing a feature using this library, you -will want to read the Security Considerations section of [RFC 3711](https://www.ietf.org/rfc/rfc3711.txt). +will want to read the Security Considerations section of [RFC 3711](https://tools.ietf.org/html/rfc3711#section-9). In addition, it is important that you read and understand the terms outlined in the [License and Disclaimer](#license-and-disclaimer) section. @@ -313,6 +316,56 @@ brew install automake pkgconfig autoremake -ivf ``` +-------------------------------------------------------------------------------- + +## Using Visual Studio + +On Windows one can use Visual Studio via CMake. CMake can be downloaded here: +https://cmake.org/ . To create Visual Studio build files, for example run the +following commands: + +``` +# Create build subdirectory +mkdir build +cd build + +# Make project files +cmake .. -G "Visual Studio 15 2017" + +# Or for 64 bit project files +cmake .. -G "Visual Studio 15 2017 Win64" +``` + +-------------------------------------------------------------------------------- + +## Using Meson + +On all platforms including Windows, one can build using [Meson](https://mesonbuild.org). +Steps to download Meson are here: https://mesonbuild.com/Getting-meson.html + +To build with Meson, you can do something like: + +``` +# Setup the build subdirectory +meson setup --prefix=/path/to/prefix builddir + +# Build the project +meson compile -C builddir + +# Run tests +meson test -C builddir + +# Optionally, install +meson install -C builddir +``` + +To build with Visual Studio, run the above commands from inside a Visual Studio +command prompt, or run `vcvarsall.bat` with the appropriate arguments inside +a Command Prompt. + +Note that you can also replace the above commands with the appropriate `ninja` +targets: `ninja -C build`, `ninja -C build test`, `ninja -C build install`. + -------------------------------------------------------------------------------- @@ -425,8 +478,8 @@ srtp_init(); memset(&policy, 0x0, sizeof(srtp_policy_t)); // set policy to describe a policy for an SRTP stream -crypto_policy_set_rtp_default(&policy.rtp); -crypto_policy_set_rtcp_default(&policy.rtcp); +srtp_crypto_policy_set_rtp_default(&policy.rtp); +srtp_crypto_policy_set_rtcp_default(&policy.rtcp); policy.ssrc = ssrc; policy.key = key; policy.next = NULL; @@ -475,13 +528,13 @@ Copyright 2001-2005 by David A. McGrew, Cisco Systems, Inc. SRTP and ICM References September, 2005 -Secure RTP is defined in [RFC 3711](https://www.ietf.org/rfc/rfc3711.txt). -The counter mode definition is in Section 4.1.1. +Secure RTP is defined in [RFC 3711](https://tools.ietf.org/html/rfc3711). +The counter mode definition is in [Section 4.1.1](https://tools.ietf.org/html/rfc3711#section-4.1.1). SHA-1 is defined in [FIPS PUB 180-4](http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf). -HMAC is defined in [RFC 2104](https://www.ietf.org/rfc/rfc2104.txt) +HMAC is defined in [RFC 2104](https://tools.ietf.org/html/rfc2104) and HMAC-SHA1 test vectors are available -in [RFC 2202](https://www.ietf.org/rfc/rfc2202.txt). +in [RFC 2202](https://tools.ietf.org/html/rfc2202#section-3). -AES-GCM usage in SRTP is defined in [RFC 7714](https://www.ietf.org/html/rfc7714) +AES-GCM usage in SRTP is defined in [RFC 7714](https://tools.ietf.org/html/rfc7714) diff --git a/libs/srtp/cmake/FindMbedTLS.cmake b/libs/srtp/cmake/FindMbedTLS.cmake new file mode 100644 index 0000000000..b3ed046b69 --- /dev/null +++ b/libs/srtp/cmake/FindMbedTLS.cmake @@ -0,0 +1,38 @@ +find_path(MBEDTLS_INCLUDE_DIRS mbedtls/ssl.h) + +find_library(MBEDTLS_LIBRARY mbedtls) +find_library(MBEDX509_LIBRARY mbedx509) +find_library(MBEDCRYPTO_LIBRARY mbedcrypto) + +set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MbedTLS DEFAULT_MSG + MBEDTLS_LIBRARY MBEDTLS_INCLUDE_DIRS MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY) + +mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY) + +if(NOT TARGET MbedTLS) + message("in mbedtls ${MBEDTLS_LIBRARY}") + add_library(MbedTLS UNKNOWN IMPORTED) + set_target_properties(MbedTLS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${MBEDTLS_LIBRARY}") +endif() + +if(NOT TARGET MbedCrypto) + add_library(MbedCrypto UNKNOWN IMPORTED) + set_target_properties(MbedCrypto PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${MBEDCRYPTO_LIBRARY}") +endif() + +if(NOT TARGET MbedX509) + add_library(MbedX509 UNKNOWN IMPORTED) + set_target_properties(MbedX509 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${MBEDX509_LIBRARY}") +endif() diff --git a/libs/srtp/cmake/FindNSS.cmake b/libs/srtp/cmake/FindNSS.cmake new file mode 100644 index 0000000000..716616bd01 --- /dev/null +++ b/libs/srtp/cmake/FindNSS.cmake @@ -0,0 +1,15 @@ +find_path(NSS_INCLUDE_DIR nss/nss.h) +find_path(NSPR_INCLUDE_DIR nspr/nspr.h) + +set(NSS_INCLUDE_DIRS "${NSS_INCLUDE_DIR}/nss" "${NSPR_INCLUDE_DIR}/nspr") + +find_library(NSS3_LIBRARY nss3) +find_library(NSPR4_LIBRARY nspr4) + +set(NSS_LIBRARIES "${NSS3_LIBRARY}" "${NSPR4_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NSS DEFAULT_MSG + NSS3_LIBRARY NSS_INCLUDE_DIR NSPR4_LIBRARY NSPR_INCLUDE_DIR) + +mark_as_advanced(NSS_INCLUDE_DIR NSPR_INCLUDE_DIR NSS3_LIBRARY NSPR4_LIBRARY) diff --git a/libs/srtp/config.hw b/libs/srtp/config.hw index 44dba2a2d5..f49618baa9 100644 --- a/libs/srtp/config.hw +++ b/libs/srtp/config.hw @@ -1,184 +1,121 @@ -/* crypto/include/config.h. Generated by configure. */ -/* config_in.h. Generated from configure.in by autoheader. */ - -#if (_MSC_VER >= 1400) -# define HAVE_RAND_S 1 -# define _CRT_RAND_S -#endif - -/* Define if building for a CISC machine (e.g. Intel). */ -#define CPU_CISC 1 - -/* Define if building for a RISC machine (assume slow byte access). */ -/* #undef CPU_RISC */ - -/* Define to enabled debug logging for all mudules. */ -#undef ENABLE_DEBUG_LOGGING - -/* Logging statments will be writen to this file. */ -/* #undef ERR_REPORTING_FILE */ - -/* Define to redirect logging to stdout. */ -#undef ERR_REPORTING_STDOUT - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ARPA_INET_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_BYTESWAP_H */ - -/* Define to 1 if you have the `inet_aton' function. */ -/* #undef HAVE_INET_ATON */ - -/* Define to 1 if the system has the type `int16_t'. */ -#define HAVE_INT16_T 1 - -/* Define to 1 if the system has the type `int32_t'. */ -#define HAVE_INT32_T 1 - -/* Define to 1 if the system has the type `int8_t'. */ -#define HAVE_INT8_T 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if you have the `socket' library (-lsocket). */ -/* #undef HAVE_LIBSOCKET */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MACHINE_TYPES_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_IN_H */ - -/* Define to 1 if you have the `socket' function. */ -/* #undef HAVE_SOCKET */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_INT_TYPES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SOCKET_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_UIO_H */ - -/* Define to 1 if the system has the type `uint16_t'. */ -#define HAVE_UINT16_T 1 - -/* Define to 1 if the system has the type `uint32_t'. */ -#define HAVE_UINT32_T 1 - -/* Define to 1 if the system has the type `uint64_t'. */ -#define HAVE_UINT64_T 1 - -/* Define to 1 if the system has the type `uint8_t'. */ -#define HAVE_UINT8_T 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_UNISTD_H */ - -/* Define to 1 if you have the `usleep' function. */ -/* #undef HAVE_USLEEP */ - -/* Define to 1 if you have the header file. */ -#define HAVE_WINDOWS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_WINSOCK2_H 1 - -/* Define to use X86 inlined assembly code */ -/* #undef HAVE_X86 */ - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* The size of a `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG 4 - -/* The size of a `unsigned long long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG_LONG 8 - -/* Define to use GDOI. */ -/* #undef SRTP_GDOI */ - -/* Define to compile for kernel contexts. */ -/* #undef SRTP_KERNEL */ - -/* Define to compile for Linux kernel context. */ -/* #undef SRTP_KERNEL_LINUX */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define 'inline' to nothing, since the MSVC compiler doesn't support it. */ -#ifndef inline -#define inline -#endif - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ - -#if (_MSC_VER >= 1400) // VC8+ -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE -#endif -#endif // VC8+ - -#ifndef 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; -#endif - -#ifdef _MSC_VER -#pragma warning(disable:4311) -#endif +/* clang-format off */ + +/* Define to the full name and version of this package. */ +#define PACKAGE_VERSION "2.4.0" + +/* Define to the version of this package. */ +#define PACKAGE_STRING "libsrtp2 2.4.0" + +/* Define to enabled debug logging for all mudules. */ +/* #undef ENABLE_DEBUG_LOGGING */ + +/* Logging statments will be writen to this file. */ +/* #undef ERR_REPORTING_FILE */ + +/* Define to redirect logging to stdout. */ +/* #undef ERR_REPORTING_STDOUT */ + +/* Define this to use OpenSSL crypto. */ +#define OPENSSL 1 + +/* Define this to use MBEDTLS. */ +/* #undef MBEDTLS */ + +/* Define this to use NSS crypto. */ +/* #undef NSS */ + +/* Define this to use AES-GCM. */ +#define GCM 1 + +/* Define if building for a CISC machine (e.g. Intel). */ +#define CPU_CISC 1 + +/* Define if building for a RISC machine (assume slow byte access). */ +/* #undef CPU_RISC */ + +/* Define to use X86 inlined assembly code */ +#define HAVE_X86 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_INET_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BYTESWAP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACHINE_TYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_IN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_INT_TYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define to 1 if you have the `inet_aton' function. */ +/* #undef HAVE_INET_ATON */ + +/* Define to 1 if you have the `sigaction' function. */ +/* #undef HAVE_SIGACTION */ + +/* Define to 1 if you have the `usleep' function. */ +/* #undef HAVE_USLEEP */ + +/* Define to 1 if the system has the type `uint8_t'. */ +#define HAVE_UINT8_T 1 + +/* Define to 1 if the system has the type `uint16_t'. */ +#define HAVE_UINT16_T 1 + +/* Define to 1 if the system has the type `uint32_t'. */ +#define HAVE_UINT32_T 1 + +/* Define to 1 if the system has the type `uint64_t'. */ +#define HAVE_UINT64_T 1 + +/* Define to 1 if the system has the type `int32_t'. */ +#define HAVE_INT32_T 1 + +/* The size of `unsigned long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG 4 + +/* The size of `unsigned long long', as computed by sizeof. */ +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +/* Define inline to what is supported by compiler */ +#define HAVE_INLINE 1 +/* #undef HAVE___INLINE */ +#ifndef HAVE_INLINE + #ifdef HAVE___INLINE + #define inline __inline + #else + #define inline + #endif +#endif diff --git a/libs/srtp/config.h_win32vc7 b/libs/srtp/config_in.h similarity index 63% rename from libs/srtp/config.h_win32vc7 rename to libs/srtp/config_in.h index 3b2a78c7b1..31e6ffe385 100644 --- a/libs/srtp/config.h_win32vc7 +++ b/libs/srtp/config_in.h @@ -1,18 +1,14 @@ -/* Hacked config.h for Windows XP 32-bit & VC7 */ +/* config_in.h. Generated from configure.ac by autoheader. */ -#ifdef (_MSC_VER >= 1400) -# define HAVE_RAND_S 1 -#endif +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD /* Define if building for a CISC machine (e.g. Intel). */ -#define CPU_CISC 1 +#undef CPU_CISC /* Define if building for a RISC machine (assume slow byte access). */ #undef CPU_RISC -/* Path to random device */ -#undef DEV_URANDOM - /* Define to enabled debug logging for all mudules. */ #undef ENABLE_DEBUG_LOGGING @@ -22,6 +18,9 @@ /* Define to redirect logging to stdout. */ #undef ERR_REPORTING_STDOUT +/* Define this to use AES-GCM. */ +#undef GCM + /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H @@ -29,7 +28,7 @@ #undef HAVE_BYTESWAP_H /* Define to 1 if you have the `inet_aton' function. */ -#define HAVE_INET_ATON 1 +#undef HAVE_INET_ATON /* Define to 1 if the system has the type `int16_t'. */ #undef HAVE_INT16_T @@ -43,32 +42,53 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `dl' library (-ldl). */ +#undef HAVE_LIBDL + +/* Define to 1 if you have the `nspr4' library (-lnspr4). */ +#undef HAVE_LIBNSPR4 + +/* Define to 1 if you have the `nss3' library (-lnss3). */ +#undef HAVE_LIBNSS3 + /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET +/* Define to 1 if you have the `z' library (-lz). */ +#undef HAVE_LIBZ + /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_TYPES_H /* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 +#undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NSS_H + +/* Define to 1 if you have the `winpcap' library (-lwpcap) */ +#undef HAVE_PCAP + +/* Define to 1 if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + /* Define to 1 if you have the `socket' function. */ -#define HAVE_SOCKET 1 +#undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 +#undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 +#undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 +#undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_INT_TYPES_H @@ -89,7 +109,7 @@ #undef HAVE_UINT16_T /* Define to 1 if the system has the type `uint32_t'. */ -#undef HAVE_UINT32_T +#undef HAVE_UINT32_T /* Define to 1 if the system has the type `uint64_t'. */ #undef HAVE_UINT64_T @@ -98,20 +118,32 @@ #undef HAVE_UINT8_T /* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 +#undef HAVE_UNISTD_H /* Define to 1 if you have the `usleep' function. */ -#define HAVE_USLEEP 1 +#undef HAVE_USLEEP /* Define to 1 if you have the header file. */ -#define HAVE_WINDOWS_H 1 +#undef HAVE_WINDOWS_H /* Define to 1 if you have the header file. */ -#define HAVE_WINSOCK2_H 1 +#undef HAVE_WINSOCK2_H /* Define to use X86 inlined assembly code */ #undef HAVE_X86 +/* Define this to use NSS crypto. */ +#undef NSS + +/* Define this to use OpenSSL crypto. */ +#undef OPENSSL + +/* Define this if OPENSSL_cleanse is broken. */ +#undef OPENSSL_CLEANSE_BROKEN + +/* Define this to use OpenSSL KDF for SRTP. */ +#undef OPENSSL_KDF + /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT @@ -124,39 +156,41 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of a `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG 4 +/* The size of `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG -/* The size of a `unsigned long long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG_LONG 8 - -/* Define to use GDOI. */ -#undef SRTP_GDOI - -/* Define to compile for kernel contexts. */ -#undef SRTP_KERNEL - -/* Define to compile for Linux kernel context. */ -#undef SRTP_KERNEL_LINUX +/* The size of `unsigned long long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG_LONG /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif /* Define to empty if `const' does not conform to ANSI C. */ -//#undef const +#undef const + /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ -//#ifndef __cplusplus -//#undef inline -//#endif -#define inline __inline +#ifndef __cplusplus +#undef inline +#endif -/* Define to `unsigned' if does not define. */ -//#undef size_t +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/libs/srtp/config_in_cmake.h b/libs/srtp/config_in_cmake.h new file mode 100644 index 0000000000..73113471a9 --- /dev/null +++ b/libs/srtp/config_in_cmake.h @@ -0,0 +1,121 @@ +/* clang-format off */ + +/* Define to the full name and version of this package. */ +#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" + +/* Define to the version of this package. */ +#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" + +/* Define to enabled debug logging for all mudules. */ +#cmakedefine ENABLE_DEBUG_LOGGING 1 + +/* Logging statments will be writen to this file. */ +#cmakedefine ERR_REPORTING_FILE "@ERR_REPORTING_FILE@" + +/* Define to redirect logging to stdout. */ +#cmakedefine ERR_REPORTING_STDOUT 1 + +/* Define this to use OpenSSL crypto. */ +#cmakedefine OPENSSL 1 + +/* Define this to use MBEDTLS. */ +#cmakedefine MBEDTLS 1 + +/* Define this to use NSS crypto. */ +#cmakedefine NSS 1 + +/* Define this to use AES-GCM. */ +#cmakedefine GCM 1 + +/* Define if building for a CISC machine (e.g. Intel). */ +#define CPU_CISC 1 + +/* Define if building for a RISC machine (assume slow byte access). */ +/* #undef CPU_RISC */ + +/* Define to use X86 inlined assembly code */ +#cmakedefine HAVE_X86 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#cmakedefine WORDS_BIGENDIAN 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_BYTESWAP_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MACHINE_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_INT_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINDOWS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINSOCK2_H 1 + +/* Define to 1 if you have the `inet_aton' function. */ +#cmakedefine HAVE_INET_ATON 1 + +/* Define to 1 if you have the `sigaction' function. */ +#cmakedefine HAVE_SIGACTION 1 + +/* Define to 1 if you have the `usleep' function. */ +#cmakedefine HAVE_USLEEP 1 + +/* Define to 1 if the system has the type `uint8_t'. */ +#cmakedefine HAVE_UINT8_T 1 + +/* Define to 1 if the system has the type `uint16_t'. */ +#cmakedefine HAVE_UINT16_T 1 + +/* Define to 1 if the system has the type `uint32_t'. */ +#cmakedefine HAVE_UINT32_T 1 + +/* Define to 1 if the system has the type `uint64_t'. */ +#cmakedefine HAVE_UINT64_T 1 + +/* Define to 1 if the system has the type `int32_t'. */ +#cmakedefine HAVE_INT32_T 1 + +/* The size of `unsigned long', as computed by sizeof. */ +@SIZEOF_UNSIGNED_LONG_CODE@ + +/* The size of `unsigned long long', as computed by sizeof. */ +@SIZEOF_UNSIGNED_LONG_LONG_CODE@ + +/* Define inline to what is supported by compiler */ +#cmakedefine HAVE_INLINE 1 +#cmakedefine HAVE___INLINE 1 +#ifndef HAVE_INLINE + #ifdef HAVE___INLINE + #define inline __inline + #else + #define inline + #endif +#endif diff --git a/libs/srtp/configure.ac b/libs/srtp/configure.ac index 288d0e970a..59a3b69437 100644 --- a/libs/srtp/configure.ac +++ b/libs/srtp/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.59) -AC_INIT(srtp, 1.4.2, mcgrew@cisco.com) +AC_INIT(srtp, 2.4.0, mcgrew@cisco.com) AC_CONFIG_AUX_DIR(build) AM_INIT_AUTOMAKE @@ -286,6 +286,7 @@ else HMAC_OBJS="crypto/hash/hmac.o crypto/hash/sha1.o" fi AM_CONDITIONAL([ENABLE_OPENSSL],[test "${enable_openssl}" = "yes"]) +AM_CONDITIONAL([GCM],[test "${enable_openssl}" = "yes"]) AC_SUBST(AES_ICM_OBJS) AC_SUBST(HMAC_OBJS) @@ -319,21 +320,9 @@ if test "$enable_console" = "yes"; then fi AC_MSG_RESULT($enable_console) -AC_MSG_CHECKING(whether to use GDOI key management) -AC_ARG_ENABLE(gdoi, - [AS_HELP_STRING([--enable-gdoi], [enable GDOI key management])], - [], enable_gdoi=no) -if test "$enable_gdoi" = "yes"; then - AC_DEFINE(SRTP_GDOI, 1, [Define to use GDOI.]) - GDOI_OBJS=gdoi/srtp+gdoi.o - AC_SUBST(GDOI_OBJS) -fi -AC_MSG_RESULT($enable_gdoi) -AM_CONDITIONAL([GDOI],[test "SRTP_GDOI" = "1"]) - AC_CONFIG_HEADERS(crypto/include/config.h:config_in.h) -AC_OUTPUT(Makefile crypto/Makefile doc/Makefile test/Makefile libsrtp2.pc) +AC_OUTPUT(Makefile crypto/Makefile doc/Makefile libsrtp2.pc) # This is needed when building outside the source dir. AS_MKDIR_P(crypto/cipher) diff --git a/libs/srtp/crypto/Makefile.in b/libs/srtp/crypto/Makefile.in index faaa991a09..8c2c4fabef 100644 --- a/libs/srtp/crypto/Makefile.in +++ b/libs/srtp/crypto/Makefile.in @@ -17,15 +17,34 @@ LIBS = @LIBS@ LDFLAGS = @LDFLAGS@ -L. -L.. COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) CRYPTOLIB = -lsrtp2 +CRYPTO_LIBDIR = @CRYPTO_LIBDIR@ RANLIB = @RANLIB@ +# Specify how tests should find shared libraries on macOS and Linux +# +# macOS purges DYLD_LIBRARY_PATH when spawning subprocesses, so it's +# not possible to pass this in from the outside; we have to specify +# it for any subprocesses we call. No support for dynamic linked +# tests on Windows. +ifneq ($(strip $(CRYPTO_LIBDIR)),) + ifneq ($(OS),Windows_NT) + UNAME_S = $(shell uname -s) + ifeq ($(UNAME_S),Linux) + FIND_LIBRARIES = LD_LIBRARY_PATH=$(CRYPTO_LIBDIR) + endif + ifeq ($(UNAME_S),Darwin) + FIND_LIBRARIES = DYLD_LIBRARY_PATH=$(CRYPTO_LIBDIR) + endif + endif +endif + # EXE defines the suffix on executables - it's .exe for cygwin, and # null on linux, bsd, and OS X and other OSes. we define this so that # `make clean` will work on the cygwin platform EXE = @EXE@ # Random source. -USE_OPENSSL = @USE_OPENSSL@ +USE_EXTERNAL_CRYPTO = @USE_EXTERNAL_CRYPTO@ ifdef ARCH DEFS += -D$(ARCH)=1 @@ -40,14 +59,14 @@ endif dummy : all runtest # test applications -ifneq (1, $(USE_OPENSSL)) +ifneq (1, $(USE_EXTERNAL_CRYPTO)) AES_CALC = test/aes_calc$(EXE) +SHA1_DRIVER = test/sha1_driver$(EXE) endif testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \ - test/stat_driver$(EXE) test/sha1_driver$(EXE) \ - test/kernel_driver$(EXE) $(AES_CALC) \ - test/env$(EXE) + $(SHA1_DRIVER) test/kernel_driver$(EXE) \ + $(AES_CALC) test/env$(EXE) # data values used to test the aes_calc application for AES-128 k128=000102030405060708090a0b0c0d0e0f @@ -62,17 +81,16 @@ c256=8ea2b7ca516745bfeafc49904b496089 runtest: $(testapp) - test/env$(EXE) # print out information on the build environment + $(FIND_LIBRARIES) test/env$(EXE) # print out information on the build environment @echo "running crypto test applications..." -ifneq (1, $(USE_OPENSSL)) - test `test/aes_calc $(k128) $(p128)` = $(c128) - test `test/aes_calc $(k256) $(p256)` = $(c256) +ifneq (1, $(USE_EXTERNAL_CRYPTO)) + $(FIND_LIBRARIES) test `test/aes_calc $(k128) $(p128)` = $(c128) + $(FIND_LIBRARIES) test `test/aes_calc $(k256) $(p256)` = $(c256) + $(FIND_LIBRARIES) test/sha1_driver$(EXE) -v >/dev/null endif - test/cipher_driver$(EXE) -v >/dev/null - test/datatypes_driver$(EXE) -v >/dev/null - test/stat_driver$(EXE) >/dev/null - test/sha1_driver$(EXE) -v >/dev/null - test/kernel_driver$(EXE) -v >/dev/null + $(FIND_LIBRARIES) test/cipher_driver$(EXE) -v >/dev/null + $(FIND_LIBRARIES) test/datatypes_driver$(EXE) -v >/dev/null + $(FIND_LIBRARIES) test/kernel_driver$(EXE) -v >/dev/null @echo "crypto test applications passed." diff --git a/libs/srtp/crypto/cipher/aes.c b/libs/srtp/crypto/cipher/aes.c index c9cd774201..a2060c53e8 100644 --- a/libs/srtp/crypto/cipher/aes.c +++ b/libs/srtp/crypto/cipher/aes.c @@ -1414,11 +1414,6 @@ static void aes_128_expand_encryption_key(const uint8_t *key, v128_copy_octet_string(&expanded_key->round[0], key); -#if 0 - debug_print(srtp_mod_aes_icm, - "expanded key[0]: %s", v128_hex_string(&expanded_key->round[0])); -#endif - /* loop over round keys */ for (i = 1; i < 11; i++) { /* munge first word of round key */ @@ -1445,11 +1440,6 @@ static void aes_128_expand_encryption_key(const uint8_t *key, expanded_key->round[i].v32[3] = expanded_key->round[i].v32[2] ^ expanded_key->round[i - 1].v32[3]; -#if 0 - debug_print2(srtp_mod_aes_icm, - "expanded key[%d]: %s", i, v128_hex_string(&expanded_key->round[i])); -#endif - /* modify round constant */ rc = gf2_8_shift(rc); } @@ -1469,13 +1459,6 @@ static void aes_256_expand_encryption_key(const unsigned char *key, v128_copy_octet_string(&expanded_key->round[0], key); v128_copy_octet_string(&expanded_key->round[1], key + 16); -#if 0 - debug_print(srtp_mod_aes_icm, - "expanded key[0]: %s", v128_hex_string(&expanded_key->round[0])); - debug_print(srtp_mod_aes_icm, - "expanded key[1]: %s", v128_hex_string(&expanded_key->round[1])); -#endif - /* loop over rest of round keys */ for (i = 2; i < 15; i++) { /* munge first word of round key */ @@ -1515,11 +1498,6 @@ static void aes_256_expand_encryption_key(const unsigned char *key, expanded_key->round[i].v32[3] = expanded_key->round[i].v32[2] ^ expanded_key->round[i - 2].v32[3]; - -#if 0 - debug_print2(srtp_mod_aes_icm, - "expanded key[%d]: %s", i, v128_hex_string(&expanded_key->round[i])); -#endif } } @@ -1796,7 +1774,7 @@ static inline void aes_inv_final_round(v128_t *state, const v128_t *round_key) v128_xor_eq(state, round_key); } -#elif CPU_RISC +#elif defined(CPU_RISC) static inline void aes_round(v128_t *state, const v128_t *round_key) { diff --git a/libs/srtp/crypto/cipher/aes_gcm_mbedtls.c b/libs/srtp/crypto/cipher/aes_gcm_mbedtls.c new file mode 100644 index 0000000000..d7d4b61cdf --- /dev/null +++ b/libs/srtp/crypto/cipher/aes_gcm_mbedtls.c @@ -0,0 +1,412 @@ +/* + * aes_gcm_mbedtls.c + * + * AES Galois Counter Mode + * + * YongCheng Yang + * + */ + +/* + * + * Copyright (c) 2013-2017, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "aes_gcm.h" +#include "alloc.h" +#include "err.h" /* for srtp_debug */ +#include "crypto_types.h" +#include "cipher_types.h" +#include "cipher_test_cases.h" + +srtp_debug_module_t srtp_mod_aes_gcm = { + 0, /* debugging is off by default */ + "aes gcm mbedtls" /* printable module name */ +}; + +/** + * SRTP IV Formation for AES-GCM + * https://tools.ietf.org/html/rfc7714#section-8.1 + * 0 0 0 0 0 0 0 0 0 0 1 1 + * 0 1 2 3 4 5 6 7 8 9 0 1 + * +--+--+--+--+--+--+--+--+--+--+--+--+ + * |00|00| SSRC | ROC | SEQ |---+ + * +--+--+--+--+--+--+--+--+--+--+--+--+ | + * | + * +--+--+--+--+--+--+--+--+--+--+--+--+ | + * | Encryption Salt |->(+) + * +--+--+--+--+--+--+--+--+--+--+--+--+ | + * | + * +--+--+--+--+--+--+--+--+--+--+--+--+ | + * | Initialization Vector |<--+ + * +--+--+--+--+--+--+--+--+--+--+--+--+ + * + * SRTCP IV Formation for AES-GCM + * https://tools.ietf.org/html/rfc7714#section-9.1 + * + */ + +/* + * For now we only support 8 and 16 octet tags. The spec allows for + * optional 12 byte tag, which may be supported in the future. + */ +#define GCM_IV_LEN 12 +#define GCM_AUTH_TAG_LEN 16 +#define GCM_AUTH_TAG_LEN_8 8 + +#define FUNC_ENTRY() debug_print(srtp_mod_aes_gcm, "%s entry", __func__); +/* + * This function allocates a new instance of this crypto engine. + * The key_len parameter should be one of 28 or 44 for + * AES-128-GCM or AES-256-GCM respectively. Note that the + * key length includes the 14 byte salt value that is used when + * initializing the KDF. + */ +static srtp_err_status_t srtp_aes_gcm_mbedtls_alloc(srtp_cipher_t **c, + int key_len, + int tlen) +{ + FUNC_ENTRY(); + srtp_aes_gcm_ctx_t *gcm; + + debug_print(srtp_mod_aes_gcm, "allocating cipher with key length %d", + key_len); + debug_print(srtp_mod_aes_gcm, "allocating cipher with tag length %d", tlen); + + /* + * Verify the key_len is valid for one of: AES-128/256 + */ + if (key_len != SRTP_AES_GCM_128_KEY_LEN_WSALT && + key_len != SRTP_AES_GCM_256_KEY_LEN_WSALT) { + return (srtp_err_status_bad_param); + } + + if (tlen != GCM_AUTH_TAG_LEN && tlen != GCM_AUTH_TAG_LEN_8) { + return (srtp_err_status_bad_param); + } + + /* allocate memory a cipher of type aes_gcm */ + *c = (srtp_cipher_t *)srtp_crypto_alloc(sizeof(srtp_cipher_t)); + if (*c == NULL) { + return (srtp_err_status_alloc_fail); + } + + gcm = (srtp_aes_gcm_ctx_t *)srtp_crypto_alloc(sizeof(srtp_aes_gcm_ctx_t)); + if (gcm == NULL) { + srtp_crypto_free(*c); + *c = NULL; + return (srtp_err_status_alloc_fail); + } + + gcm->ctx = + (mbedtls_gcm_context *)srtp_crypto_alloc(sizeof(mbedtls_gcm_context)); + if (gcm->ctx == NULL) { + srtp_crypto_free(gcm); + srtp_crypto_free(*c); + *c = NULL; + return srtp_err_status_alloc_fail; + } + mbedtls_gcm_init(gcm->ctx); + + /* set pointers */ + (*c)->state = gcm; + + /* setup cipher attributes */ + switch (key_len) { + case SRTP_AES_GCM_128_KEY_LEN_WSALT: + (*c)->type = &srtp_aes_gcm_128; + (*c)->algorithm = SRTP_AES_GCM_128; + gcm->key_size = SRTP_AES_128_KEY_LEN; + gcm->tag_len = tlen; + break; + case SRTP_AES_GCM_256_KEY_LEN_WSALT: + (*c)->type = &srtp_aes_gcm_256; + (*c)->algorithm = SRTP_AES_GCM_256; + gcm->key_size = SRTP_AES_256_KEY_LEN; + gcm->tag_len = tlen; + break; + } + + /* set key size */ + (*c)->key_len = key_len; + + return (srtp_err_status_ok); +} + +/* + * This function deallocates a GCM session + */ +static srtp_err_status_t srtp_aes_gcm_mbedtls_dealloc(srtp_cipher_t *c) +{ + srtp_aes_gcm_ctx_t *ctx; + FUNC_ENTRY(); + ctx = (srtp_aes_gcm_ctx_t *)c->state; + if (ctx) { + mbedtls_gcm_free(ctx->ctx); + srtp_crypto_free(ctx->ctx); + /* zeroize the key material */ + octet_string_set_to_zero(ctx, sizeof(srtp_aes_gcm_ctx_t)); + srtp_crypto_free(ctx); + } + + /* free memory */ + srtp_crypto_free(c); + + return (srtp_err_status_ok); +} + +static srtp_err_status_t srtp_aes_gcm_mbedtls_context_init(void *cv, + const uint8_t *key) +{ + FUNC_ENTRY(); + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + uint32_t key_len_in_bits; + int errCode = 0; + c->dir = srtp_direction_any; + c->aad_size = 0; + + debug_print(srtp_mod_aes_gcm, "key: %s", + srtp_octet_string_hex_string(key, c->key_size)); + key_len_in_bits = (c->key_size << 3); + switch (c->key_size) { + case SRTP_AES_256_KEY_LEN: + case SRTP_AES_128_KEY_LEN: + break; + default: + return (srtp_err_status_bad_param); + break; + } + + errCode = mbedtls_gcm_setkey(c->ctx, MBEDTLS_CIPHER_ID_AES, + (const unsigned char *)key, key_len_in_bits); + if (errCode != 0) { + debug_print(srtp_mod_aes_gcm, "mbedtls error code: %d", errCode); + return srtp_err_status_init_fail; + } + + return (srtp_err_status_ok); +} + +static srtp_err_status_t srtp_aes_gcm_mbedtls_set_iv( + void *cv, + uint8_t *iv, + srtp_cipher_direction_t direction) +{ + FUNC_ENTRY(); + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + + if (direction != srtp_direction_encrypt && + direction != srtp_direction_decrypt) { + return (srtp_err_status_bad_param); + } + c->dir = direction; + + debug_print(srtp_mod_aes_gcm, "setting iv: %s", + srtp_octet_string_hex_string(iv, GCM_IV_LEN)); + c->iv_len = GCM_IV_LEN; + memcpy(c->iv, iv, c->iv_len); + return (srtp_err_status_ok); +} + +/* + * This function processes the AAD + * + * Parameters: + * c Crypto context + * aad Additional data to process for AEAD cipher suites + * aad_len length of aad buffer + */ +static srtp_err_status_t srtp_aes_gcm_mbedtls_set_aad(void *cv, + const uint8_t *aad, + uint32_t aad_len) +{ + FUNC_ENTRY(); + int errCode = 0; + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + + debug_print(srtp_mod_aes_gcm, "setting AAD: %s", + srtp_octet_string_hex_string(aad, aad_len)); + + if (aad_len + c->aad_size > MAX_AD_SIZE) { + return srtp_err_status_bad_param; + } + + memcpy(c->aad + c->aad_size, aad, aad_len); + c->aad_size += aad_len; + + return (srtp_err_status_ok); +} + +/* + * This function encrypts a buffer using AES GCM mode + * + * Parameters: + * c Crypto context + * buf data to encrypt + * enc_len length of encrypt buffer + */ +static srtp_err_status_t srtp_aes_gcm_mbedtls_encrypt(void *cv, + unsigned char *buf, + unsigned int *enc_len) +{ + FUNC_ENTRY(); + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + int errCode = 0; + + if (c->dir != srtp_direction_encrypt && c->dir != srtp_direction_decrypt) { + return (srtp_err_status_bad_param); + } + + errCode = mbedtls_gcm_crypt_and_tag(c->ctx, MBEDTLS_GCM_ENCRYPT, *enc_len, + c->iv, c->iv_len, c->aad, c->aad_size, + buf, buf, c->tag_len, c->tag); + + c->aad_size = 0; + if (errCode != 0) { + debug_print(srtp_mod_aes_gcm, "mbedtls error code: %d", errCode); + return srtp_err_status_bad_param; + } + + return (srtp_err_status_ok); +} + +/* + * This function calculates and returns the GCM tag for a given context. + * This should be called after encrypting the data. The *len value + * is increased by the tag size. The caller must ensure that *buf has + * enough room to accept the appended tag. + * + * Parameters: + * c Crypto context + * buf data to encrypt + * len length of encrypt buffer + */ +static srtp_err_status_t srtp_aes_gcm_mbedtls_get_tag(void *cv, + uint8_t *buf, + uint32_t *len) +{ + FUNC_ENTRY(); + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + debug_print(srtp_mod_aes_gcm, "appended tag size: %d", c->tag_len); + *len = c->tag_len; + memcpy(buf, c->tag, c->tag_len); + return (srtp_err_status_ok); +} + +/* + * This function decrypts a buffer using AES GCM mode + * + * Parameters: + * c Crypto context + * buf data to encrypt + * enc_len length of encrypt buffer + */ +static srtp_err_status_t srtp_aes_gcm_mbedtls_decrypt(void *cv, + unsigned char *buf, + unsigned int *enc_len) +{ + FUNC_ENTRY(); + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + int errCode = 0; + int len = *enc_len; + + if (c->dir != srtp_direction_encrypt && c->dir != srtp_direction_decrypt) { + return (srtp_err_status_bad_param); + } + + debug_print(srtp_mod_aes_gcm, "AAD: %s", + srtp_octet_string_hex_string(c->aad, c->aad_size)); + + errCode = mbedtls_gcm_auth_decrypt( + c->ctx, (*enc_len - c->tag_len), c->iv, c->iv_len, c->aad, c->aad_size, + buf + (*enc_len - c->tag_len), c->tag_len, buf, buf); + c->aad_size = 0; + if (errCode != 0) { + return (srtp_err_status_auth_fail); + } + + /* + * Reduce the buffer size by the tag length since the tag + * is not part of the original payload + */ + *enc_len -= c->tag_len; + + return (srtp_err_status_ok); +} + +/* + * Name of this crypto engine + */ +static const char srtp_aes_gcm_128_mbedtls_description[] = + "AES-128 GCM using mbedtls"; +static const char srtp_aes_gcm_256_mbedtls_description[] = + "AES-256 GCM using mbedtls"; + +/* + * This is the vector function table for this crypto engine. + */ +const srtp_cipher_type_t srtp_aes_gcm_128 = { + srtp_aes_gcm_mbedtls_alloc, + srtp_aes_gcm_mbedtls_dealloc, + srtp_aes_gcm_mbedtls_context_init, + srtp_aes_gcm_mbedtls_set_aad, + srtp_aes_gcm_mbedtls_encrypt, + srtp_aes_gcm_mbedtls_decrypt, + srtp_aes_gcm_mbedtls_set_iv, + srtp_aes_gcm_mbedtls_get_tag, + srtp_aes_gcm_128_mbedtls_description, + &srtp_aes_gcm_128_test_case_0, + SRTP_AES_GCM_128 +}; + +/* + * This is the vector function table for this crypto engine. + */ +const srtp_cipher_type_t srtp_aes_gcm_256 = { + srtp_aes_gcm_mbedtls_alloc, + srtp_aes_gcm_mbedtls_dealloc, + srtp_aes_gcm_mbedtls_context_init, + srtp_aes_gcm_mbedtls_set_aad, + srtp_aes_gcm_mbedtls_encrypt, + srtp_aes_gcm_mbedtls_decrypt, + srtp_aes_gcm_mbedtls_set_iv, + srtp_aes_gcm_mbedtls_get_tag, + srtp_aes_gcm_256_mbedtls_description, + &srtp_aes_gcm_256_test_case_0, + SRTP_AES_GCM_256 +}; diff --git a/libs/srtp/crypto/cipher/aes_gcm_nss.c b/libs/srtp/crypto/cipher/aes_gcm_nss.c new file mode 100644 index 0000000000..23b6e0946a --- /dev/null +++ b/libs/srtp/crypto/cipher/aes_gcm_nss.c @@ -0,0 +1,442 @@ +/* + * aes_gcm_nss.c + * + * AES Galois Counter Mode + * + * Richard L. Barnes + * Cisco Systems, Inc. + * + */ + +/* + * + * Copyright (c) 2013-2017, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "aes_gcm.h" +#include "alloc.h" +#include "err.h" /* for srtp_debug */ +#include "crypto_types.h" +#include "cipher_types.h" +#include "cipher_test_cases.h" +#include +#include + +srtp_debug_module_t srtp_mod_aes_gcm = { + 0, /* debugging is off by default */ + "aes gcm nss" /* printable module name */ +}; + +/* + * For now we only support 8 and 16 octet tags. The spec allows for + * optional 12 byte tag, which may be supported in the future. + */ +#define GCM_IV_LEN 12 +#define GCM_AUTH_TAG_LEN 16 +#define GCM_AUTH_TAG_LEN_8 8 + +/* + * This function allocates a new instance of this crypto engine. + * The key_len parameter should be one of 28 or 44 for + * AES-128-GCM or AES-256-GCM respectively. Note that the + * key length includes the 14 byte salt value that is used when + * initializing the KDF. + */ +static srtp_err_status_t srtp_aes_gcm_nss_alloc(srtp_cipher_t **c, + int key_len, + int tlen) +{ + srtp_aes_gcm_ctx_t *gcm; + NSSInitContext *nss; + + debug_print(srtp_mod_aes_gcm, "allocating cipher with key length %d", + key_len); + debug_print(srtp_mod_aes_gcm, "allocating cipher with tag length %d", tlen); + + /* + * Verify the key_len is valid for one of: AES-128/256 + */ + if (key_len != SRTP_AES_GCM_128_KEY_LEN_WSALT && + key_len != SRTP_AES_GCM_256_KEY_LEN_WSALT) { + return (srtp_err_status_bad_param); + } + + if (tlen != GCM_AUTH_TAG_LEN && tlen != GCM_AUTH_TAG_LEN_8) { + return (srtp_err_status_bad_param); + } + + /* Initialize NSS equiv of NSS_NoDB_Init(NULL) */ + nss = NSS_InitContext("", "", "", "", NULL, + NSS_INIT_READONLY | NSS_INIT_NOCERTDB | + NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN | + NSS_INIT_OPTIMIZESPACE); + if (!nss) { + return (srtp_err_status_cipher_fail); + } + + /* allocate memory a cipher of type aes_gcm */ + *c = (srtp_cipher_t *)srtp_crypto_alloc(sizeof(srtp_cipher_t)); + if (*c == NULL) { + NSS_ShutdownContext(nss); + return (srtp_err_status_alloc_fail); + } + + gcm = (srtp_aes_gcm_ctx_t *)srtp_crypto_alloc(sizeof(srtp_aes_gcm_ctx_t)); + if (gcm == NULL) { + NSS_ShutdownContext(nss); + srtp_crypto_free(*c); + *c = NULL; + return (srtp_err_status_alloc_fail); + } + + gcm->nss = nss; + + /* set pointers */ + (*c)->state = gcm; + + /* setup cipher attributes */ + switch (key_len) { + case SRTP_AES_GCM_128_KEY_LEN_WSALT: + (*c)->type = &srtp_aes_gcm_128; + (*c)->algorithm = SRTP_AES_GCM_128; + gcm->key_size = SRTP_AES_128_KEY_LEN; + gcm->tag_size = tlen; + gcm->params.ulTagBits = 8 * tlen; + break; + case SRTP_AES_GCM_256_KEY_LEN_WSALT: + (*c)->type = &srtp_aes_gcm_256; + (*c)->algorithm = SRTP_AES_GCM_256; + gcm->key_size = SRTP_AES_256_KEY_LEN; + gcm->tag_size = tlen; + gcm->params.ulTagBits = 8 * tlen; + break; + default: + /* this should never hit, but to be sure... */ + return (srtp_err_status_bad_param); + } + + /* set key size and tag size*/ + (*c)->key_len = key_len; + + return (srtp_err_status_ok); +} + +/* + * This function deallocates a GCM session + */ +static srtp_err_status_t srtp_aes_gcm_nss_dealloc(srtp_cipher_t *c) +{ + srtp_aes_gcm_ctx_t *ctx; + + ctx = (srtp_aes_gcm_ctx_t *)c->state; + if (ctx) { + /* release NSS resources */ + if (ctx->key) { + PK11_FreeSymKey(ctx->key); + } + + if (ctx->nss) { + NSS_ShutdownContext(ctx->nss); + ctx->nss = NULL; + } + + /* zeroize the key material */ + octet_string_set_to_zero(ctx, sizeof(srtp_aes_gcm_ctx_t)); + srtp_crypto_free(ctx); + } + + /* free memory */ + srtp_crypto_free(c); + + return (srtp_err_status_ok); +} + +/* + * aes_gcm_nss_context_init(...) initializes the aes_gcm_context + * using the value in key[]. + * + * the key is the secret key + */ +static srtp_err_status_t srtp_aes_gcm_nss_context_init(void *cv, + const uint8_t *key) +{ + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + + c->dir = srtp_direction_any; + + debug_print(srtp_mod_aes_gcm, "key: %s", + srtp_octet_string_hex_string(key, c->key_size)); + + if (c->key) { + PK11_FreeSymKey(c->key); + c->key = NULL; + } + + PK11SlotInfo *slot = PK11_GetBestSlot(CKM_AES_GCM, NULL); + if (!slot) { + return (srtp_err_status_cipher_fail); + } + + SECItem key_item = { siBuffer, (unsigned char *)key, c->key_size }; + c->key = PK11_ImportSymKey(slot, CKM_AES_GCM, PK11_OriginUnwrap, + CKA_ENCRYPT, &key_item, NULL); + PK11_FreeSlot(slot); + + if (!c->key) { + return (srtp_err_status_cipher_fail); + } + + return (srtp_err_status_ok); +} + +/* + * aes_gcm_nss_set_iv(c, iv) sets the counter value to the exor of iv with + * the offset + */ +static srtp_err_status_t srtp_aes_gcm_nss_set_iv( + void *cv, + uint8_t *iv, + srtp_cipher_direction_t direction) +{ + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + + if (direction != srtp_direction_encrypt && + direction != srtp_direction_decrypt) { + return (srtp_err_status_bad_param); + } + c->dir = direction; + + debug_print(srtp_mod_aes_gcm, "setting iv: %s", + srtp_octet_string_hex_string(iv, GCM_IV_LEN)); + + memcpy(c->iv, iv, GCM_IV_LEN); + + return (srtp_err_status_ok); +} + +/* + * This function processes the AAD + * + * Parameters: + * c Crypto context + * aad Additional data to process for AEAD cipher suites + * aad_len length of aad buffer + */ +static srtp_err_status_t srtp_aes_gcm_nss_set_aad(void *cv, + const uint8_t *aad, + uint32_t aad_len) +{ + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + + debug_print(srtp_mod_aes_gcm, "setting AAD: %s", + srtp_octet_string_hex_string(aad, aad_len)); + + if (aad_len + c->aad_size > MAX_AD_SIZE) { + return srtp_err_status_bad_param; + } + + memcpy(c->aad + c->aad_size, aad, aad_len); + c->aad_size += aad_len; + + return (srtp_err_status_ok); +} + +static srtp_err_status_t srtp_aes_gcm_nss_do_crypto(void *cv, + int encrypt, + unsigned char *buf, + unsigned int *enc_len) +{ + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + + c->params.pIv = c->iv; + c->params.ulIvLen = GCM_IV_LEN; + c->params.pAAD = c->aad; + c->params.ulAADLen = c->aad_size; + + // Reset AAD + c->aad_size = 0; + + int rv; + SECItem param = { siBuffer, (unsigned char *)&c->params, + sizeof(CK_GCM_PARAMS) }; + if (encrypt) { + rv = PK11_Encrypt(c->key, CKM_AES_GCM, ¶m, buf, enc_len, + *enc_len + 16, buf, *enc_len); + } else { + rv = PK11_Decrypt(c->key, CKM_AES_GCM, ¶m, buf, enc_len, *enc_len, + buf, *enc_len); + } + + srtp_err_status_t status = (srtp_err_status_ok); + if (rv != SECSuccess) { + status = (srtp_err_status_cipher_fail); + } + + return status; +} + +/* + * This function encrypts a buffer using AES GCM mode + * + * XXX(rlb@ipv.sx): We're required to break off and cache the tag + * here, because the get_tag() method is separate and the tests expect + * encrypt() not to change the size of the plaintext. It might be + * good to update the calling API so that this is cleaner. + * + * Parameters: + * c Crypto context + * buf data to encrypt + * enc_len length of encrypt buffer + */ +static srtp_err_status_t srtp_aes_gcm_nss_encrypt(void *cv, + unsigned char *buf, + unsigned int *enc_len) +{ + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + + // When we get a non-NULL buffer, we know that the caller is + // prepared to also take the tag. When we get a NULL buffer, + // even though there's no data, we need to give NSS a buffer + // where it can write the tag. We can't just use c->tag because + // memcpy has undefined behavior on overlapping ranges. + unsigned char tagbuf[16]; + unsigned char *non_null_buf = buf; + if (!non_null_buf && (*enc_len == 0)) { + non_null_buf = tagbuf; + } else if (!non_null_buf) { + return srtp_err_status_bad_param; + } + + srtp_err_status_t status = + srtp_aes_gcm_nss_do_crypto(cv, 1, non_null_buf, enc_len); + if (status != srtp_err_status_ok) { + return status; + } + + memcpy(c->tag, non_null_buf + (*enc_len - c->tag_size), c->tag_size); + *enc_len -= c->tag_size; + return srtp_err_status_ok; +} + +/* + * This function calculates and returns the GCM tag for a given context. + * This should be called after encrypting the data. The *len value + * is increased by the tag size. The caller must ensure that *buf has + * enough room to accept the appended tag. + * + * Parameters: + * c Crypto context + * buf data to encrypt + * len length of encrypt buffer + */ +static srtp_err_status_t srtp_aes_gcm_nss_get_tag(void *cv, + uint8_t *buf, + uint32_t *len) +{ + srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; + *len = c->tag_size; + memcpy(buf, c->tag, c->tag_size); + return (srtp_err_status_ok); +} + +/* + * This function decrypts a buffer using AES GCM mode + * + * Parameters: + * c Crypto context + * buf data to encrypt + * enc_len length of encrypt buffer + */ +static srtp_err_status_t srtp_aes_gcm_nss_decrypt(void *cv, + unsigned char *buf, + unsigned int *enc_len) +{ + srtp_err_status_t status = srtp_aes_gcm_nss_do_crypto(cv, 0, buf, enc_len); + if (status != srtp_err_status_ok) { + int err = PR_GetError(); + if (err == SEC_ERROR_BAD_DATA) { + status = srtp_err_status_auth_fail; + } + } + + return status; +} + +/* + * Name of this crypto engine + */ +static const char srtp_aes_gcm_128_nss_description[] = "AES-128 GCM using NSS"; +static const char srtp_aes_gcm_256_nss_description[] = "AES-256 GCM using NSS"; + +/* + * This is the vector function table for this crypto engine. + */ +/* clang-format off */ +const srtp_cipher_type_t srtp_aes_gcm_128 = { + srtp_aes_gcm_nss_alloc, + srtp_aes_gcm_nss_dealloc, + srtp_aes_gcm_nss_context_init, + srtp_aes_gcm_nss_set_aad, + srtp_aes_gcm_nss_encrypt, + srtp_aes_gcm_nss_decrypt, + srtp_aes_gcm_nss_set_iv, + srtp_aes_gcm_nss_get_tag, + srtp_aes_gcm_128_nss_description, + &srtp_aes_gcm_128_test_case_0, + SRTP_AES_GCM_128 +}; +/* clang-format on */ + +/* + * This is the vector function table for this crypto engine. + */ +/* clang-format off */ +const srtp_cipher_type_t srtp_aes_gcm_256 = { + srtp_aes_gcm_nss_alloc, + srtp_aes_gcm_nss_dealloc, + srtp_aes_gcm_nss_context_init, + srtp_aes_gcm_nss_set_aad, + srtp_aes_gcm_nss_encrypt, + srtp_aes_gcm_nss_decrypt, + srtp_aes_gcm_nss_set_iv, + srtp_aes_gcm_nss_get_tag, + srtp_aes_gcm_256_nss_description, + &srtp_aes_gcm_256_test_case_0, + SRTP_AES_GCM_256 +}; +/* clang-format on */ diff --git a/libs/srtp/crypto/cipher/aes_gcm_ossl.c b/libs/srtp/crypto/cipher/aes_gcm_ossl.c index ef13a78240..3e2d6bb113 100644 --- a/libs/srtp/crypto/cipher/aes_gcm_ossl.c +++ b/libs/srtp/crypto/cipher/aes_gcm_ossl.c @@ -49,12 +49,12 @@ #endif #include -#include "aes_icm_ossl.h" -#include "aes_gcm_ossl.h" +#include "aes_gcm.h" #include "alloc.h" #include "err.h" /* for srtp_debug */ #include "crypto_types.h" #include "cipher_types.h" +#include "cipher_test_cases.h" srtp_debug_module_t srtp_mod_aes_gcm = { 0, /* debugging is off by default */ @@ -124,13 +124,13 @@ static srtp_err_status_t srtp_aes_gcm_openssl_alloc(srtp_cipher_t **c, /* setup cipher attributes */ switch (key_len) { case SRTP_AES_GCM_128_KEY_LEN_WSALT: - (*c)->type = &srtp_aes_gcm_128_openssl; + (*c)->type = &srtp_aes_gcm_128; (*c)->algorithm = SRTP_AES_GCM_128; gcm->key_size = SRTP_AES_128_KEY_LEN; gcm->tag_len = tlen; break; case SRTP_AES_GCM_256_KEY_LEN_WSALT: - (*c)->type = &srtp_aes_gcm_256_openssl; + (*c)->type = &srtp_aes_gcm_256; (*c)->algorithm = SRTP_AES_GCM_256; gcm->key_size = SRTP_AES_256_KEY_LEN; gcm->tag_len = tlen; @@ -193,6 +193,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_context_init(void *cv, break; } + EVP_CIPHER_CTX_cleanup(c->ctx); if (!EVP_CipherInit_ex(c->ctx, evp, NULL, key, NULL, 0)) { return (srtp_err_status_init_fail); } @@ -218,7 +219,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_set_iv( c->dir = direction; debug_print(srtp_mod_aes_gcm, "setting iv: %s", - v128_hex_string((v128_t *)iv)); + srtp_octet_string_hex_string(iv, 12)); if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_IVLEN, 12, 0)) { return (srtp_err_status_init_fail); @@ -247,20 +248,31 @@ static srtp_err_status_t srtp_aes_gcm_openssl_set_aad(void *cv, srtp_aes_gcm_ctx_t *c = (srtp_aes_gcm_ctx_t *)cv; int rv; - /* - * Set dummy tag, OpenSSL requires the Tag to be set before - * processing AAD - */ + debug_print(srtp_mod_aes_gcm, "setting AAD: %s", + srtp_octet_string_hex_string(aad, aad_len)); /* - * OpenSSL never write to address pointed by the last parameter of - * EVP_CIPHER_CTX_ctrl while EVP_CTRL_GCM_SET_TAG (in reality, - * OpenSSL copy its content to the context), so we can make - * aad read-only in this function and all its wrappers. + * EVP_CTRL_GCM_SET_TAG can only be used when decrypting */ - unsigned char dummy_tag[GCM_AUTH_TAG_LEN]; - memset(dummy_tag, 0x0, GCM_AUTH_TAG_LEN); - EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, &dummy_tag); + if (c->dir == srtp_direction_decrypt) { + /* + * Set dummy tag, OpenSSL requires the Tag to be set before + * processing AAD + */ + + /* + * OpenSSL never write to address pointed by the last parameter of + * EVP_CIPHER_CTX_ctrl while EVP_CTRL_GCM_SET_TAG (in reality, + * OpenSSL copy its content to the context), so we can make + * aad read-only in this function and all its wrappers. + */ + unsigned char dummy_tag[GCM_AUTH_TAG_LEN]; + memset(dummy_tag, 0x0, GCM_AUTH_TAG_LEN); + if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, + &dummy_tag)) { + return (srtp_err_status_algo_fail); + } + } rv = EVP_Cipher(c->ctx, NULL, aad, aad_len); if (rv != aad_len) { @@ -319,7 +331,9 @@ static srtp_err_status_t srtp_aes_gcm_openssl_get_tag(void *cv, /* * Retreive the tag */ - EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, c->tag_len, buf); + if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, c->tag_len, buf)) { + return (srtp_err_status_algo_fail); + } /* * Increase encryption length by desired tag size @@ -349,8 +363,10 @@ static srtp_err_status_t srtp_aes_gcm_openssl_decrypt(void *cv, /* * Set the tag before decrypting */ - EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, - buf + (*enc_len - c->tag_len)); + if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, + buf + (*enc_len - c->tag_len))) { + return (srtp_err_status_auth_fail); + } EVP_Cipher(c->ctx, buf, buf, *enc_len - c->tag_len); /* @@ -377,178 +393,10 @@ static const char srtp_aes_gcm_128_openssl_description[] = static const char srtp_aes_gcm_256_openssl_description[] = "AES-256 GCM using openssl"; -/* - * KAT values for AES self-test. These - * values we're derived from independent test code - * using OpenSSL. - */ -/* clang-format off */ -static const uint8_t srtp_aes_gcm_test_case_0_key[SRTP_AES_GCM_128_KEY_LEN_WSALT] = { - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, -}; -/* clang-format on */ - -/* clang-format off */ -static uint8_t srtp_aes_gcm_test_case_0_iv[12] = { - 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_gcm_test_case_0_plaintext[60] = { - 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, - 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, - 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, - 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, - 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, - 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, - 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, - 0xba, 0x63, 0x7b, 0x39 -}; - -/* clang-format off */ -static const uint8_t srtp_aes_gcm_test_case_0_aad[20] = { - 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, - 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, - 0xab, 0xad, 0xda, 0xd2 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_gcm_test_case_0_ciphertext[76] = { - 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, - 0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c, - 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0, - 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, - 0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, - 0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05, - 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97, - 0x3d, 0x58, 0xe0, 0x91, - /* the last 16 bytes are the tag */ - 0x5b, 0xc9, 0x4f, 0xbc, 0x32, 0x21, 0xa5, 0xdb, - 0x94, 0xfa, 0xe9, 0x5a, 0xe7, 0x12, 0x1a, 0x47, -}; -/* clang-format on */ - -static const srtp_cipher_test_case_t srtp_aes_gcm_test_case_0a = { - SRTP_AES_GCM_128_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_gcm_test_case_0_key, /* key */ - srtp_aes_gcm_test_case_0_iv, /* packet index */ - 60, /* octets in plaintext */ - srtp_aes_gcm_test_case_0_plaintext, /* plaintext */ - 68, /* octets in ciphertext */ - srtp_aes_gcm_test_case_0_ciphertext, /* ciphertext + tag */ - 20, /* octets in AAD */ - srtp_aes_gcm_test_case_0_aad, /* AAD */ - GCM_AUTH_TAG_LEN_8, /* */ - NULL /* pointer to next testcase */ -}; - -static const srtp_cipher_test_case_t srtp_aes_gcm_test_case_0 = { - SRTP_AES_GCM_128_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_gcm_test_case_0_key, /* key */ - srtp_aes_gcm_test_case_0_iv, /* packet index */ - 60, /* octets in plaintext */ - srtp_aes_gcm_test_case_0_plaintext, /* plaintext */ - 76, /* octets in ciphertext */ - srtp_aes_gcm_test_case_0_ciphertext, /* ciphertext + tag */ - 20, /* octets in AAD */ - srtp_aes_gcm_test_case_0_aad, /* AAD */ - GCM_AUTH_TAG_LEN, /* */ - &srtp_aes_gcm_test_case_0a /* pointer to next testcase */ -}; - -/* clang-format off */ -static const uint8_t srtp_aes_gcm_test_case_1_key[SRTP_AES_GCM_256_KEY_LEN_WSALT] = { - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - 0xa5, 0x59, 0x09, 0xc5, 0x54, 0x66, 0x93, 0x1c, - 0xaf, 0xf5, 0x26, 0x9a, 0x21, 0xd5, 0x14, 0xb2, - 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, -}; -/* clang-format on */ - -/* clang-format off */ -static uint8_t srtp_aes_gcm_test_case_1_iv[12] = { - 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_gcm_test_case_1_plaintext[60] = { - 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, - 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, - 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, - 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, - 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, - 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, - 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, - 0xba, 0x63, 0x7b, 0x39 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_gcm_test_case_1_aad[20] = { - 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, - 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, - 0xab, 0xad, 0xda, 0xd2 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_gcm_test_case_1_ciphertext[76] = { - 0x0b, 0x11, 0xcf, 0xaf, 0x68, 0x4d, 0xae, 0x46, - 0xc7, 0x90, 0xb8, 0x8e, 0xb7, 0x6a, 0x76, 0x2a, - 0x94, 0x82, 0xca, 0xab, 0x3e, 0x39, 0xd7, 0x86, - 0x1b, 0xc7, 0x93, 0xed, 0x75, 0x7f, 0x23, 0x5a, - 0xda, 0xfd, 0xd3, 0xe2, 0x0e, 0x80, 0x87, 0xa9, - 0x6d, 0xd7, 0xe2, 0x6a, 0x7d, 0x5f, 0xb4, 0x80, - 0xef, 0xef, 0xc5, 0x29, 0x12, 0xd1, 0xaa, 0x10, - 0x09, 0xc9, 0x86, 0xc1, - /* the last 16 bytes are the tag */ - 0x45, 0xbc, 0x03, 0xe6, 0xe1, 0xac, 0x0a, 0x9f, - 0x81, 0xcb, 0x8e, 0x5b, 0x46, 0x65, 0x63, 0x1d, -}; -/* clang-format on */ - -static const srtp_cipher_test_case_t srtp_aes_gcm_test_case_1a = { - SRTP_AES_GCM_256_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_gcm_test_case_1_key, /* key */ - srtp_aes_gcm_test_case_1_iv, /* packet index */ - 60, /* octets in plaintext */ - srtp_aes_gcm_test_case_1_plaintext, /* plaintext */ - 68, /* octets in ciphertext */ - srtp_aes_gcm_test_case_1_ciphertext, /* ciphertext + tag */ - 20, /* octets in AAD */ - srtp_aes_gcm_test_case_1_aad, /* AAD */ - GCM_AUTH_TAG_LEN_8, /* */ - NULL /* pointer to next testcase */ -}; - -static const srtp_cipher_test_case_t srtp_aes_gcm_test_case_1 = { - SRTP_AES_GCM_256_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_gcm_test_case_1_key, /* key */ - srtp_aes_gcm_test_case_1_iv, /* packet index */ - 60, /* octets in plaintext */ - srtp_aes_gcm_test_case_1_plaintext, /* plaintext */ - 76, /* octets in ciphertext */ - srtp_aes_gcm_test_case_1_ciphertext, /* ciphertext + tag */ - 20, /* octets in AAD */ - srtp_aes_gcm_test_case_1_aad, /* AAD */ - GCM_AUTH_TAG_LEN, /* */ - &srtp_aes_gcm_test_case_1a /* pointer to next testcase */ -}; - /* * This is the vector function table for this crypto engine. */ -const srtp_cipher_type_t srtp_aes_gcm_128_openssl = { +const srtp_cipher_type_t srtp_aes_gcm_128 = { srtp_aes_gcm_openssl_alloc, srtp_aes_gcm_openssl_dealloc, srtp_aes_gcm_openssl_context_init, @@ -558,14 +406,14 @@ const srtp_cipher_type_t srtp_aes_gcm_128_openssl = { srtp_aes_gcm_openssl_set_iv, srtp_aes_gcm_openssl_get_tag, srtp_aes_gcm_128_openssl_description, - &srtp_aes_gcm_test_case_0, + &srtp_aes_gcm_128_test_case_0, SRTP_AES_GCM_128 }; /* * This is the vector function table for this crypto engine. */ -const srtp_cipher_type_t srtp_aes_gcm_256_openssl = { +const srtp_cipher_type_t srtp_aes_gcm_256 = { srtp_aes_gcm_openssl_alloc, srtp_aes_gcm_openssl_dealloc, srtp_aes_gcm_openssl_context_init, @@ -575,6 +423,6 @@ const srtp_cipher_type_t srtp_aes_gcm_256_openssl = { srtp_aes_gcm_openssl_set_iv, srtp_aes_gcm_openssl_get_tag, srtp_aes_gcm_256_openssl_description, - &srtp_aes_gcm_test_case_1, + &srtp_aes_gcm_256_test_case_0, SRTP_AES_GCM_256 }; diff --git a/libs/srtp/crypto/cipher/aes_icm.c b/libs/srtp/crypto/cipher/aes_icm.c index 7551c75148..e05d9e45a3 100644 --- a/libs/srtp/crypto/cipher/aes_icm.c +++ b/libs/srtp/crypto/cipher/aes_icm.c @@ -52,6 +52,7 @@ #include "aes_icm.h" #include "alloc.h" #include "cipher_types.h" +#include "cipher_test_cases.h" srtp_debug_module_t srtp_mod_aes_icm = { 0, /* debugging is off by default */ @@ -399,104 +400,6 @@ static const char srtp_aes_icm_128_description[] = static const char srtp_aes_icm_256_description[] = "AES-256 integer counter mode"; -/* clang-format off */ -static const uint8_t srtp_aes_icm_128_test_case_0_key[SRTP_AES_ICM_128_KEY_LEN_WSALT] = { - 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 -}; -/* clang-format on */ - -/* clang-format off */ -static uint8_t srtp_aes_icm_128_test_case_0_nonce[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_128_test_case_0_plaintext[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, -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_128_test_case_0_ciphertext[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 -}; -/* clang-format on */ - -static const srtp_cipher_test_case_t srtp_aes_icm_128_test_case_0 = { - SRTP_AES_ICM_128_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_icm_128_test_case_0_key, /* key */ - srtp_aes_icm_128_test_case_0_nonce, /* packet index */ - 32, /* octets in plaintext */ - srtp_aes_icm_128_test_case_0_plaintext, /* plaintext */ - 32, /* octets in ciphertext */ - srtp_aes_icm_128_test_case_0_ciphertext, /* ciphertext */ - 0, /* */ - NULL, /* */ - 0, /* */ - NULL /* pointer to next testcase */ -}; - -/* clang-format off */ -static const uint8_t srtp_aes_icm_256_test_case_0_key[SRTP_AES_ICM_256_KEY_LEN_WSALT] = { - 0x57, 0xf8, 0x2f, 0xe3, 0x61, 0x3f, 0xd1, 0x70, - 0xa8, 0x5e, 0xc9, 0x3c, 0x40, 0xb1, 0xf0, 0x92, - 0x2e, 0xc4, 0xcb, 0x0d, 0xc0, 0x25, 0xb5, 0x82, - 0x72, 0x14, 0x7c, 0xc4, 0x38, 0x94, 0x4a, 0x98, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd -}; -/* clang-format on */ - -/* clang-format off */ -static uint8_t srtp_aes_icm_256_test_case_0_nonce[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_256_test_case_0_plaintext[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, -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_256_test_case_0_ciphertext[32] = { - 0x92, 0xbd, 0xd2, 0x8a, 0x93, 0xc3, 0xf5, 0x25, - 0x11, 0xc6, 0x77, 0xd0, 0x8b, 0x55, 0x15, 0xa4, - 0x9d, 0xa7, 0x1b, 0x23, 0x78, 0xa8, 0x54, 0xf6, - 0x70, 0x50, 0x75, 0x6d, 0xed, 0x16, 0x5b, 0xac -}; -/* clang-format on */ - -static const srtp_cipher_test_case_t srtp_aes_icm_256_test_case_0 = { - SRTP_AES_ICM_256_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_icm_256_test_case_0_key, /* key */ - srtp_aes_icm_256_test_case_0_nonce, /* packet index */ - 32, /* octets in plaintext */ - srtp_aes_icm_256_test_case_0_plaintext, /* plaintext */ - 32, /* octets in ciphertext */ - srtp_aes_icm_256_test_case_0_ciphertext, /* ciphertext */ - 0, /* */ - NULL, /* */ - 0, /* */ - NULL, /* pointer to next testcase */ -}; - /* * note: the encrypt function is identical to the decrypt function */ diff --git a/libs/srtp/crypto/cipher/aes_icm_mbedtls.c b/libs/srtp/crypto/cipher/aes_icm_mbedtls.c new file mode 100644 index 0000000000..9893ded702 --- /dev/null +++ b/libs/srtp/crypto/cipher/aes_icm_mbedtls.c @@ -0,0 +1,371 @@ +/* + * aes_icm_mbedtls.c + * + * AES Integer Counter Mode + * + * YongCheng Yang + */ + +/* + * + * Copyright (c) 2013-2017, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "aes_icm_ext.h" +#include "crypto_types.h" +#include "err.h" /* for srtp_debug */ +#include "alloc.h" +#include "cipher_types.h" +#include "cipher_test_cases.h" + +srtp_debug_module_t srtp_mod_aes_icm = { + 0, /* debugging is off by default */ + "aes icm mbedtls" /* printable module name */ +}; + +/* + * integer counter mode works as follows: + * + * https://tools.ietf.org/html/rfc3711#section-4.1.1 + * + * E(k, IV) || E(k, IV + 1 mod 2^128) || E(k, IV + 2 mod 2^128) ... + * IV = (k_s * 2^16) XOR (SSRC * 2^64) XOR (i * 2^16) + * + * IV SHALL be defined by the SSRC, the SRTP packet index i, + * and the SRTP session salting key k_s. + * + * SSRC: 32bits. + * Sequence number: 16bits. + * nonce is 64bits. . + * packet index = ROC || SEQ. (ROC: Rollover counter) + * + * 16 bits + * <-----> + * +------+------+------+------+------+------+------+------+ + * | nonce | packet index | ctr |---+ + * +------+------+------+------+------+------+------+------+ | + * | + * +------+------+------+------+------+------+------+------+ v + * | salt |000000|->(+) + * +------+------+------+------+------+------+------+------+ | + * | + * +---------+ + * | encrypt | + * +---------+ + * | + * +------+------+------+------+------+------+------+------+ | + * | keystream block |<--+ + * +------+------+------+------+------+------+------+------+ + * + * All fields are big-endian + * + * ctr is the block counter, which increments from zero for + * each packet (16 bits wide) + * + * packet index is distinct for each packet (48 bits wide) + * + * nonce can be distinct across many uses of the same key, or + * can be a fixed value per key, or can be per-packet randomness + * (64 bits) + * + */ + +/* + * This function allocates a new instance of this crypto engine. + * The key_len parameter should be one of 30, 38, or 46 for + * AES-128, AES-192, and AES-256 respectively. Note, this key_len + * value is inflated, as it also accounts for the 112 bit salt + * value. The tlen argument is for the AEAD tag length, which + * isn't used in counter mode. + */ +static srtp_err_status_t srtp_aes_icm_mbedtls_alloc(srtp_cipher_t **c, + int key_len, + int tlen) +{ + srtp_aes_icm_ctx_t *icm; + + debug_print(srtp_mod_aes_icm, "allocating cipher with key length %d", + key_len); + + /* + * Verify the key_len is valid for one of: AES-128/192/256 + */ + if (key_len != SRTP_AES_ICM_128_KEY_LEN_WSALT && + key_len != SRTP_AES_ICM_192_KEY_LEN_WSALT && + key_len != SRTP_AES_ICM_256_KEY_LEN_WSALT) { + return srtp_err_status_bad_param; + } + + /* allocate memory a cipher of type aes_icm */ + *c = (srtp_cipher_t *)srtp_crypto_alloc(sizeof(srtp_cipher_t)); + if (*c == NULL) { + return srtp_err_status_alloc_fail; + } + + icm = (srtp_aes_icm_ctx_t *)srtp_crypto_alloc(sizeof(srtp_aes_icm_ctx_t)); + if (icm == NULL) { + srtp_crypto_free(*c); + *c = NULL; + return srtp_err_status_alloc_fail; + } + + icm->ctx = + (mbedtls_aes_context *)srtp_crypto_alloc(sizeof(mbedtls_aes_context)); + if (icm->ctx == NULL) { + srtp_crypto_free(icm); + srtp_crypto_free(*c); + *c = NULL; + return srtp_err_status_alloc_fail; + } + + mbedtls_aes_init(icm->ctx); + + /* set pointers */ + (*c)->state = icm; + + /* setup cipher parameters */ + switch (key_len) { + case SRTP_AES_ICM_128_KEY_LEN_WSALT: + (*c)->algorithm = SRTP_AES_ICM_128; + (*c)->type = &srtp_aes_icm_128; + icm->key_size = SRTP_AES_128_KEY_LEN; + break; + case SRTP_AES_ICM_192_KEY_LEN_WSALT: + (*c)->algorithm = SRTP_AES_ICM_192; + (*c)->type = &srtp_aes_icm_192; + icm->key_size = SRTP_AES_192_KEY_LEN; + break; + case SRTP_AES_ICM_256_KEY_LEN_WSALT: + (*c)->algorithm = SRTP_AES_ICM_256; + (*c)->type = &srtp_aes_icm_256; + icm->key_size = SRTP_AES_256_KEY_LEN; + break; + } + + /* set key size */ + (*c)->key_len = key_len; + + return srtp_err_status_ok; +} + +/* + * This function deallocates an instance of this engine + */ +static srtp_err_status_t srtp_aes_icm_mbedtls_dealloc(srtp_cipher_t *c) +{ + srtp_aes_icm_ctx_t *ctx; + + if (c == NULL) { + return srtp_err_status_bad_param; + } + + /* + * Free the aes context + */ + ctx = (srtp_aes_icm_ctx_t *)c->state; + if (ctx != NULL) { + mbedtls_aes_free(ctx->ctx); + srtp_crypto_free(ctx->ctx); + /* zeroize the key material */ + octet_string_set_to_zero(ctx, sizeof(srtp_aes_icm_ctx_t)); + srtp_crypto_free(ctx); + } + + /* free memory */ + srtp_crypto_free(c); + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_aes_icm_mbedtls_context_init(void *cv, + const uint8_t *key) +{ + srtp_aes_icm_ctx_t *c = (srtp_aes_icm_ctx_t *)cv; + uint32_t key_size_in_bits = (c->key_size << 3); + int errcode = 0; + + /* + * set counter and initial values to 'offset' value, being careful not to + * go past the end of the key buffer + */ + v128_set_to_zero(&c->counter); + v128_set_to_zero(&c->offset); + memcpy(&c->counter, key + c->key_size, SRTP_SALT_LEN); + memcpy(&c->offset, key + c->key_size, SRTP_SALT_LEN); + + /* force last two octets of the offset to zero (for srtp compatibility) */ + c->offset.v8[SRTP_SALT_LEN] = c->offset.v8[SRTP_SALT_LEN + 1] = 0; + c->counter.v8[SRTP_SALT_LEN] = c->counter.v8[SRTP_SALT_LEN + 1] = 0; + debug_print(srtp_mod_aes_icm, "key: %s", + srtp_octet_string_hex_string(key, c->key_size)); + debug_print(srtp_mod_aes_icm, "offset: %s", v128_hex_string(&c->offset)); + + switch (c->key_size) { + case SRTP_AES_256_KEY_LEN: + case SRTP_AES_192_KEY_LEN: + case SRTP_AES_128_KEY_LEN: + break; + default: + return srtp_err_status_bad_param; + break; + } + + errcode = mbedtls_aes_setkey_enc(c->ctx, key, key_size_in_bits); + if (errcode != 0) { + debug_print(srtp_mod_aes_icm, "errCode: %d", errcode); + } + + return srtp_err_status_ok; +} + +/* + * aes_icm_set_iv(c, iv) sets the counter value to the exor of iv with + * the offset + */ +static srtp_err_status_t srtp_aes_icm_mbedtls_set_iv( + void *cv, + uint8_t *iv, + srtp_cipher_direction_t dir) +{ + srtp_aes_icm_ctx_t *c = (srtp_aes_icm_ctx_t *)cv; + v128_t nonce; + c->nc_off = 0; + /* set nonce (for alignment) */ + v128_copy_octet_string(&nonce, iv); + + debug_print(srtp_mod_aes_icm, "setting iv: %s", v128_hex_string(&nonce)); + + v128_xor(&c->counter, &c->offset, &nonce); + + debug_print(srtp_mod_aes_icm, "set_counter: %s", + v128_hex_string(&c->counter)); + + return srtp_err_status_ok; +} + +/* + * This function encrypts a buffer using AES CTR mode + * + * Parameters: + * c Crypto context + * buf data to encrypt + * enc_len length of encrypt buffer + */ +static srtp_err_status_t srtp_aes_icm_mbedtls_encrypt(void *cv, + unsigned char *buf, + unsigned int *enc_len) +{ + srtp_aes_icm_ctx_t *c = (srtp_aes_icm_ctx_t *)cv; + + int errCode = 0; + debug_print(srtp_mod_aes_icm, "rs0: %s", v128_hex_string(&c->counter)); + + errCode = + mbedtls_aes_crypt_ctr(c->ctx, *enc_len, &(c->nc_off), c->counter.v8, + c->stream_block.v8, buf, buf); + if (errCode != 0) { + debug_print(srtp_mod_aes_icm, "encrypt error: %d", errCode); + return srtp_err_status_cipher_fail; + } + + return srtp_err_status_ok; +} + +/* + * Name of this crypto engine + */ +static const char srtp_aes_icm_128_mbedtls_description[] = + "AES-128 counter mode using mbedtls"; +static const char srtp_aes_icm_192_mbedtls_description[] = + "AES-192 counter mode using mbedtls"; +static const char srtp_aes_icm_256_mbedtls_description[] = + "AES-256 counter mode using mbedtls"; + +/* + * This is the function table for this crypto engine. + * note: the encrypt function is identical to the decrypt function + */ +const srtp_cipher_type_t srtp_aes_icm_128 = { + srtp_aes_icm_mbedtls_alloc, /* */ + srtp_aes_icm_mbedtls_dealloc, /* */ + srtp_aes_icm_mbedtls_context_init, /* */ + 0, /* set_aad */ + srtp_aes_icm_mbedtls_encrypt, /* */ + srtp_aes_icm_mbedtls_encrypt, /* */ + srtp_aes_icm_mbedtls_set_iv, /* */ + 0, /* get_tag */ + srtp_aes_icm_128_mbedtls_description, /* */ + &srtp_aes_icm_128_test_case_0, /* */ + SRTP_AES_ICM_128 /* */ +}; + +/* + * This is the function table for this crypto engine. + * note: the encrypt function is identical to the decrypt function + */ +const srtp_cipher_type_t srtp_aes_icm_192 = { + srtp_aes_icm_mbedtls_alloc, /* */ + srtp_aes_icm_mbedtls_dealloc, /* */ + srtp_aes_icm_mbedtls_context_init, /* */ + 0, /* set_aad */ + srtp_aes_icm_mbedtls_encrypt, /* */ + srtp_aes_icm_mbedtls_encrypt, /* */ + srtp_aes_icm_mbedtls_set_iv, /* */ + 0, /* get_tag */ + srtp_aes_icm_192_mbedtls_description, /* */ + &srtp_aes_icm_192_test_case_0, /* */ + SRTP_AES_ICM_192 /* */ +}; + +/* + * This is the function table for this crypto engine. + * note: the encrypt function is identical to the decrypt function + */ +const srtp_cipher_type_t srtp_aes_icm_256 = { + srtp_aes_icm_mbedtls_alloc, /* */ + srtp_aes_icm_mbedtls_dealloc, /* */ + srtp_aes_icm_mbedtls_context_init, /* */ + 0, /* set_aad */ + srtp_aes_icm_mbedtls_encrypt, /* */ + srtp_aes_icm_mbedtls_encrypt, /* */ + srtp_aes_icm_mbedtls_set_iv, /* */ + 0, /* get_tag */ + srtp_aes_icm_256_mbedtls_description, /* */ + &srtp_aes_icm_256_test_case_0, /* */ + SRTP_AES_ICM_256 /* */ +}; diff --git a/libs/srtp/crypto/cipher/aes_icm_nss.c b/libs/srtp/crypto/cipher/aes_icm_nss.c new file mode 100644 index 0000000000..04323b4fef --- /dev/null +++ b/libs/srtp/crypto/cipher/aes_icm_nss.c @@ -0,0 +1,404 @@ +/* + * aes_icm_nss.c + * + * AES Integer Counter Mode + * + * Richard L. Barnes + * Cisco Systems, Inc. + */ + +/* + * + * Copyright (c) 2013-2017, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "aes_icm_ext.h" +#include "crypto_types.h" +#include "err.h" /* for srtp_debug */ +#include "alloc.h" +#include "cipher_types.h" +#include "cipher_test_cases.h" + +srtp_debug_module_t srtp_mod_aes_icm = { + 0, /* debugging is off by default */ + "aes icm nss" /* printable module name */ +}; + +/* + * integer counter mode works as follows: + * + * 16 bits + * <-----> + * +------+------+------+------+------+------+------+------+ + * | nonce | packet index | ctr |---+ + * +------+------+------+------+------+------+------+------+ | + * | + * +------+------+------+------+------+------+------+------+ v + * | salt |000000|->(+) + * +------+------+------+------+------+------+------+------+ | + * | + * +---------+ + * | encrypt | + * +---------+ + * | + * +------+------+------+------+------+------+------+------+ | + * | keystream block |<--+ + * +------+------+------+------+------+------+------+------+ + * + * All fields are big-endian + * + * ctr is the block counter, which increments from zero for + * each packet (16 bits wide) + * + * packet index is distinct for each packet (48 bits wide) + * + * nonce can be distinct across many uses of the same key, or + * can be a fixed value per key, or can be per-packet randomness + * (64 bits) + * + */ + +/* + * This function allocates a new instance of this crypto engine. + * The key_len parameter should be one of 30, 38, or 46 for + * AES-128, AES-192, and AES-256 respectively. Note, this key_len + * value is inflated, as it also accounts for the 112 bit salt + * value. The tlen argument is for the AEAD tag length, which + * isn't used in counter mode. + */ +static srtp_err_status_t srtp_aes_icm_nss_alloc(srtp_cipher_t **c, + int key_len, + int tlen) +{ + srtp_aes_icm_ctx_t *icm; + NSSInitContext *nss; + + debug_print(srtp_mod_aes_icm, "allocating cipher with key length %d", + key_len); + + /* + * Verify the key_len is valid for one of: AES-128/192/256 + */ + if (key_len != SRTP_AES_ICM_128_KEY_LEN_WSALT && + key_len != SRTP_AES_ICM_192_KEY_LEN_WSALT && + key_len != SRTP_AES_ICM_256_KEY_LEN_WSALT) { + return srtp_err_status_bad_param; + } + + /* Initialize NSS equiv of NSS_NoDB_Init(NULL) */ + nss = NSS_InitContext("", "", "", "", NULL, + NSS_INIT_READONLY | NSS_INIT_NOCERTDB | + NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN | + NSS_INIT_OPTIMIZESPACE); + if (!nss) { + return (srtp_err_status_cipher_fail); + } + + /* allocate memory a cipher of type aes_icm */ + *c = (srtp_cipher_t *)srtp_crypto_alloc(sizeof(srtp_cipher_t)); + if (*c == NULL) { + NSS_ShutdownContext(nss); + return srtp_err_status_alloc_fail; + } + + icm = (srtp_aes_icm_ctx_t *)srtp_crypto_alloc(sizeof(srtp_aes_icm_ctx_t)); + if (icm == NULL) { + NSS_ShutdownContext(nss); + srtp_crypto_free(*c); + *c = NULL; + return srtp_err_status_alloc_fail; + } + + icm->key = NULL; + icm->ctx = NULL; + icm->nss = nss; + + /* set pointers */ + (*c)->state = icm; + + /* setup cipher parameters */ + switch (key_len) { + case SRTP_AES_ICM_128_KEY_LEN_WSALT: + (*c)->algorithm = SRTP_AES_ICM_128; + (*c)->type = &srtp_aes_icm_128; + icm->key_size = SRTP_AES_128_KEY_LEN; + break; + case SRTP_AES_ICM_192_KEY_LEN_WSALT: + (*c)->algorithm = SRTP_AES_ICM_192; + (*c)->type = &srtp_aes_icm_192; + icm->key_size = SRTP_AES_192_KEY_LEN; + break; + case SRTP_AES_ICM_256_KEY_LEN_WSALT: + (*c)->algorithm = SRTP_AES_ICM_256; + (*c)->type = &srtp_aes_icm_256; + icm->key_size = SRTP_AES_256_KEY_LEN; + break; + } + + /* set key size */ + (*c)->key_len = key_len; + + return srtp_err_status_ok; +} + +/* + * This function deallocates an instance of this engine + */ +static srtp_err_status_t srtp_aes_icm_nss_dealloc(srtp_cipher_t *c) +{ + srtp_aes_icm_ctx_t *ctx; + + ctx = (srtp_aes_icm_ctx_t *)c->state; + if (ctx) { + /* free any PK11 values that have been created */ + if (ctx->key) { + PK11_FreeSymKey(ctx->key); + ctx->key = NULL; + } + + if (ctx->ctx) { + PK11_DestroyContext(ctx->ctx, PR_TRUE); + ctx->ctx = NULL; + } + + if (ctx->nss) { + NSS_ShutdownContext(ctx->nss); + ctx->nss = NULL; + } + + /* zeroize everything */ + octet_string_set_to_zero(ctx, sizeof(srtp_aes_icm_ctx_t)); + srtp_crypto_free(ctx); + } + + /* free memory */ + srtp_crypto_free(c); + + return (srtp_err_status_ok); +} + +/* + * aes_icm_nss_context_init(...) initializes the aes_icm_context + * using the value in key[]. + * + * the key is the secret key + * + * the salt is unpredictable (but not necessarily secret) data which + * randomizes the starting point in the keystream + */ +static srtp_err_status_t srtp_aes_icm_nss_context_init(void *cv, + const uint8_t *key) +{ + srtp_aes_icm_ctx_t *c = (srtp_aes_icm_ctx_t *)cv; + + /* + * set counter and initial values to 'offset' value, being careful not to + * go past the end of the key buffer + */ + v128_set_to_zero(&c->counter); + v128_set_to_zero(&c->offset); + memcpy(&c->counter, key + c->key_size, SRTP_SALT_LEN); + memcpy(&c->offset, key + c->key_size, SRTP_SALT_LEN); + + /* force last two octets of the offset to zero (for srtp compatibility) */ + c->offset.v8[SRTP_SALT_LEN] = c->offset.v8[SRTP_SALT_LEN + 1] = 0; + c->counter.v8[SRTP_SALT_LEN] = c->counter.v8[SRTP_SALT_LEN + 1] = 0; + + debug_print(srtp_mod_aes_icm, "key: %s", + srtp_octet_string_hex_string(key, c->key_size)); + debug_print(srtp_mod_aes_icm, "offset: %s", v128_hex_string(&c->offset)); + + if (c->key) { + PK11_FreeSymKey(c->key); + c->key = NULL; + } + + PK11SlotInfo *slot = PK11_GetBestSlot(CKM_AES_CTR, NULL); + if (!slot) { + return srtp_err_status_bad_param; + } + + SECItem keyItem = { siBuffer, (unsigned char *)key, c->key_size }; + c->key = PK11_ImportSymKey(slot, CKM_AES_CTR, PK11_OriginUnwrap, + CKA_ENCRYPT, &keyItem, NULL); + PK11_FreeSlot(slot); + + if (!c->key) { + return srtp_err_status_cipher_fail; + } + + return (srtp_err_status_ok); +} + +/* + * aes_icm_set_iv(c, iv) sets the counter value to the exor of iv with + * the offset + */ +static srtp_err_status_t srtp_aes_icm_nss_set_iv(void *cv, + uint8_t *iv, + srtp_cipher_direction_t dir) +{ + srtp_aes_icm_ctx_t *c = (srtp_aes_icm_ctx_t *)cv; + v128_t nonce; + + /* set nonce (for alignment) */ + v128_copy_octet_string(&nonce, iv); + + debug_print(srtp_mod_aes_icm, "setting iv: %s", v128_hex_string(&nonce)); + + v128_xor(&c->counter, &c->offset, &nonce); + + debug_print(srtp_mod_aes_icm, "set_counter: %s", + v128_hex_string(&c->counter)); + + /* set up the PK11 context now that we have all the info */ + CK_AES_CTR_PARAMS param; + param.ulCounterBits = 16; + memcpy(param.cb, &c->counter, 16); + + if (!c->key) { + return srtp_err_status_bad_param; + } + + if (c->ctx) { + PK11_DestroyContext(c->ctx, PR_TRUE); + } + + SECItem paramItem = { siBuffer, (unsigned char *)¶m, + sizeof(CK_AES_CTR_PARAMS) }; + c->ctx = PK11_CreateContextBySymKey(CKM_AES_CTR, CKA_ENCRYPT, c->key, + ¶mItem); + if (!c->ctx) { + return srtp_err_status_cipher_fail; + } + + return srtp_err_status_ok; +} + +/* + * This function encrypts a buffer using AES CTR mode + * + * Parameters: + * c Crypto context + * buf data to encrypt + * enc_len length of encrypt buffer + */ +static srtp_err_status_t srtp_aes_icm_nss_encrypt(void *cv, + unsigned char *buf, + unsigned int *enc_len) +{ + srtp_aes_icm_ctx_t *c = (srtp_aes_icm_ctx_t *)cv; + + if (!c->ctx) { + return srtp_err_status_bad_param; + } + + int rv = + PK11_CipherOp(c->ctx, buf, (int *)enc_len, *enc_len, buf, *enc_len); + + srtp_err_status_t status = (srtp_err_status_ok); + if (rv != SECSuccess) { + status = (srtp_err_status_cipher_fail); + } + + return status; +} + +/* + * Name of this crypto engine + */ +static const char srtp_aes_icm_128_nss_description[] = + "AES-128 counter mode using NSS"; +static const char srtp_aes_icm_192_nss_description[] = + "AES-192 counter mode using NSS"; +static const char srtp_aes_icm_256_nss_description[] = + "AES-256 counter mode using NSS"; + +/* + * This is the function table for this crypto engine. + * note: the encrypt function is identical to the decrypt function + */ +const srtp_cipher_type_t srtp_aes_icm_128 = { + srtp_aes_icm_nss_alloc, /* */ + srtp_aes_icm_nss_dealloc, /* */ + srtp_aes_icm_nss_context_init, /* */ + 0, /* set_aad */ + srtp_aes_icm_nss_encrypt, /* */ + srtp_aes_icm_nss_encrypt, /* */ + srtp_aes_icm_nss_set_iv, /* */ + 0, /* get_tag */ + srtp_aes_icm_128_nss_description, /* */ + &srtp_aes_icm_128_test_case_0, /* */ + SRTP_AES_ICM_128 /* */ +}; + +/* + * This is the function table for this crypto engine. + * note: the encrypt function is identical to the decrypt function + */ +const srtp_cipher_type_t srtp_aes_icm_192 = { + srtp_aes_icm_nss_alloc, /* */ + srtp_aes_icm_nss_dealloc, /* */ + srtp_aes_icm_nss_context_init, /* */ + 0, /* set_aad */ + srtp_aes_icm_nss_encrypt, /* */ + srtp_aes_icm_nss_encrypt, /* */ + srtp_aes_icm_nss_set_iv, /* */ + 0, /* get_tag */ + srtp_aes_icm_192_nss_description, /* */ + &srtp_aes_icm_192_test_case_0, /* */ + SRTP_AES_ICM_192 /* */ +}; + +/* + * This is the function table for this crypto engine. + * note: the encrypt function is identical to the decrypt function + */ +const srtp_cipher_type_t srtp_aes_icm_256 = { + srtp_aes_icm_nss_alloc, /* */ + srtp_aes_icm_nss_dealloc, /* */ + srtp_aes_icm_nss_context_init, /* */ + 0, /* set_aad */ + srtp_aes_icm_nss_encrypt, /* */ + srtp_aes_icm_nss_encrypt, /* */ + srtp_aes_icm_nss_set_iv, /* */ + 0, /* get_tag */ + srtp_aes_icm_256_nss_description, /* */ + &srtp_aes_icm_256_test_case_0, /* */ + SRTP_AES_ICM_256 /* */ +}; diff --git a/libs/srtp/crypto/cipher/aes_icm_ossl.c b/libs/srtp/crypto/cipher/aes_icm_ossl.c index b591897623..f960a33ecf 100644 --- a/libs/srtp/crypto/cipher/aes_icm_ossl.c +++ b/libs/srtp/crypto/cipher/aes_icm_ossl.c @@ -53,11 +53,12 @@ #endif #include -#include "aes_icm_ossl.h" +#include "aes_icm_ext.h" #include "crypto_types.h" #include "err.h" /* for srtp_debug */ #include "alloc.h" #include "cipher_types.h" +#include "cipher_test_cases.h" srtp_debug_module_t srtp_mod_aes_icm = { 0, /* debugging is off by default */ @@ -78,9 +79,9 @@ srtp_debug_module_t srtp_mod_aes_icm = { * +------+------+------+------+------+------+------+------+ | * | * +---------+ - * | encrypt | - * +---------+ - * | + * | encrypt | + * +---------+ + * | * +------+------+------+------+------+------+------+------+ | * | keystream block |<--+ * +------+------+------+------+------+------+------+------+ @@ -248,6 +249,7 @@ static srtp_err_status_t srtp_aes_icm_openssl_context_init(void *cv, break; } + EVP_CIPHER_CTX_cleanup(c->ctx); if (!EVP_EncryptInit_ex(c->ctx, evp, NULL, key, NULL)) { return srtp_err_status_fail; } else { @@ -308,7 +310,7 @@ static srtp_err_status_t srtp_aes_icm_openssl_encrypt(void *cv, } *enc_len = len; - if (!EVP_EncryptFinal_ex(c->ctx, buf, &len)) { + if (!EVP_EncryptFinal_ex(c->ctx, buf + len, &len)) { return srtp_err_status_cipher_fail; } *enc_len += len; @@ -326,165 +328,6 @@ static const char srtp_aes_icm_192_openssl_description[] = static const char srtp_aes_icm_256_openssl_description[] = "AES-256 counter mode using openssl"; -/* - * KAT values for AES self-test. These - * values came from the legacy libsrtp code. - */ -/* clang-format off */ -static const uint8_t srtp_aes_icm_128_test_case_0_key[SRTP_AES_ICM_128_KEY_LEN_WSALT] = { - 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 -}; -/* clang-format on */ - -/* clang-format off */ -static uint8_t srtp_aes_icm_128_test_case_0_nonce[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_128_test_case_0_plaintext[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, -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_128_test_case_0_ciphertext[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 -}; -/* clang-format on */ - -static const srtp_cipher_test_case_t srtp_aes_icm_128_test_case_0 = { - SRTP_AES_ICM_128_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_icm_128_test_case_0_key, /* key */ - srtp_aes_icm_128_test_case_0_nonce, /* packet index */ - 32, /* octets in plaintext */ - srtp_aes_icm_128_test_case_0_plaintext, /* plaintext */ - 32, /* octets in ciphertext */ - srtp_aes_icm_128_test_case_0_ciphertext, /* ciphertext */ - 0, /* */ - NULL, /* */ - 0, /* */ - NULL /* pointer to next testcase */ -}; - -/* - * KAT values for AES-192-CTR self-test. These - * values came from section 7 of RFC 6188. - */ -/* clang-format off */ -static const uint8_t srtp_aes_icm_192_test_case_0_key[SRTP_AES_ICM_192_KEY_LEN_WSALT] = { - 0xea, 0xb2, 0x34, 0x76, 0x4e, 0x51, 0x7b, 0x2d, - 0x3d, 0x16, 0x0d, 0x58, 0x7d, 0x8c, 0x86, 0x21, - 0x97, 0x40, 0xf6, 0x5f, 0x99, 0xb6, 0xbc, 0xf7, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd -}; -/* clang-format on */ - -/* clang-format off */ -static uint8_t srtp_aes_icm_192_test_case_0_nonce[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_192_test_case_0_plaintext[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, -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_192_test_case_0_ciphertext[32] = { - 0x35, 0x09, 0x6c, 0xba, 0x46, 0x10, 0x02, 0x8d, - 0xc1, 0xb5, 0x75, 0x03, 0x80, 0x4c, 0xe3, 0x7c, - 0x5d, 0xe9, 0x86, 0x29, 0x1d, 0xcc, 0xe1, 0x61, - 0xd5, 0x16, 0x5e, 0xc4, 0x56, 0x8f, 0x5c, 0x9a -}; -/* clang-format on */ - -static const srtp_cipher_test_case_t srtp_aes_icm_192_test_case_0 = { - SRTP_AES_ICM_192_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_icm_192_test_case_0_key, /* key */ - srtp_aes_icm_192_test_case_0_nonce, /* packet index */ - 32, /* octets in plaintext */ - srtp_aes_icm_192_test_case_0_plaintext, /* plaintext */ - 32, /* octets in ciphertext */ - srtp_aes_icm_192_test_case_0_ciphertext, /* ciphertext */ - 0, /* */ - NULL, /* */ - 0, /* */ - NULL /* pointer to next testcase */ -}; - -/* - * KAT values for AES-256-CTR self-test. These - * values came from section 7 of RFC 6188. - */ -/* clang-format off */ -static const uint8_t srtp_aes_icm_256_test_case_0_key[SRTP_AES_ICM_256_KEY_LEN_WSALT] = { - 0x57, 0xf8, 0x2f, 0xe3, 0x61, 0x3f, 0xd1, 0x70, - 0xa8, 0x5e, 0xc9, 0x3c, 0x40, 0xb1, 0xf0, 0x92, - 0x2e, 0xc4, 0xcb, 0x0d, 0xc0, 0x25, 0xb5, 0x82, - 0x72, 0x14, 0x7c, 0xc4, 0x38, 0x94, 0x4a, 0x98, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd -}; -/* clang-format on */ - -/* clang-format off */ -static uint8_t srtp_aes_icm_256_test_case_0_nonce[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_256_test_case_0_plaintext[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, -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_aes_icm_256_test_case_0_ciphertext[32] = { - 0x92, 0xbd, 0xd2, 0x8a, 0x93, 0xc3, 0xf5, 0x25, - 0x11, 0xc6, 0x77, 0xd0, 0x8b, 0x55, 0x15, 0xa4, - 0x9d, 0xa7, 0x1b, 0x23, 0x78, 0xa8, 0x54, 0xf6, - 0x70, 0x50, 0x75, 0x6d, 0xed, 0x16, 0x5b, 0xac -}; -/* clang-format on */ - -static const srtp_cipher_test_case_t srtp_aes_icm_256_test_case_0 = { - SRTP_AES_ICM_256_KEY_LEN_WSALT, /* octets in key */ - srtp_aes_icm_256_test_case_0_key, /* key */ - srtp_aes_icm_256_test_case_0_nonce, /* packet index */ - 32, /* octets in plaintext */ - srtp_aes_icm_256_test_case_0_plaintext, /* plaintext */ - 32, /* octets in ciphertext */ - srtp_aes_icm_256_test_case_0_ciphertext, /* ciphertext */ - 0, /* */ - NULL, /* */ - 0, /* */ - NULL /* pointer to next testcase */ -}; - /* * This is the function table for this crypto engine. * note: the encrypt function is identical to the decrypt function diff --git a/libs/srtp/crypto/cipher/cipher.c b/libs/srtp/crypto/cipher/cipher.c index 19f00abc55..de93bc90d8 100644 --- a/libs/srtp/crypto/cipher/cipher.c +++ b/libs/srtp/crypto/cipher/cipher.c @@ -49,6 +49,7 @@ #endif #include "cipher.h" +#include "cipher_priv.h" #include "crypto_types.h" #include "err.h" /* for srtp_debug */ #include "alloc.h" /* for crypto_alloc(), crypto_free() */ @@ -165,24 +166,11 @@ int srtp_cipher_get_key_length(const srtp_cipher_t *c) } /* - * A trivial platform independent random source. The random - * data is used for some of the cipher self-tests. + * A trivial platform independent random source. + * For use in test only. */ -static srtp_err_status_t srtp_cipher_rand(void *dest, uint32_t len) +void srtp_cipher_rand_for_tests(void *dest, uint32_t len) { -#if defined(HAVE_RAND_S) - uint8_t *dst = (uint8_t *)dest; - while (len) { - unsigned int val; - errno_t err = rand_s(&val); - - if (err != 0) - return srtp_err_status_fail; - - *dst++ = val & 0xff; - len--; - } -#else /* Generic C-library (rand()) version */ /* This is a random source of last resort */ uint8_t *dst = (uint8_t *)dest; @@ -194,8 +182,17 @@ static srtp_err_status_t srtp_cipher_rand(void *dest, uint32_t len) *dst++ = val & 0xff; len--; } -#endif - return srtp_err_status_ok; +} + +/* + * A trivial platform independent 32 bit random number. + * For use in test only. + */ +uint32_t srtp_cipher_rand_u32_for_tests(void) +{ + uint32_t r; + srtp_cipher_rand_for_tests(&r, sizeof(r)); + return r; } #define SELF_TEST_BUF_OCTETS 128 @@ -246,7 +243,7 @@ srtp_err_status_t srtp_cipher_type_test( /* * test the encrypt function */ - debug_print(srtp_mod_cipher, "testing encryption", NULL); + debug_print0(srtp_mod_cipher, "testing encryption"); /* initialize cipher */ status = srtp_cipher_init(c, test_case->key); @@ -350,7 +347,7 @@ srtp_err_status_t srtp_cipher_type_test( /* * test the decrypt function */ - debug_print(srtp_mod_cipher, "testing decryption", NULL); + debug_print0(srtp_mod_cipher, "testing decryption"); /* re-initialize cipher for decryption */ status = srtp_cipher_init(c, test_case->key); @@ -465,13 +462,9 @@ srtp_err_status_t srtp_cipher_type_test( uint8_t iv[MAX_KEY_LEN]; /* choose a length at random (leaving room for IV and padding) */ - length = rand() % (SELF_TEST_BUF_OCTETS - 64); + length = srtp_cipher_rand_u32_for_tests() % (SELF_TEST_BUF_OCTETS - 64); debug_print(srtp_mod_cipher, "random plaintext length %d\n", length); - status = srtp_cipher_rand(buffer, length); - if (status) { - srtp_cipher_dealloc(c); - return status; - } + srtp_cipher_rand_for_tests(buffer, length); debug_print(srtp_mod_cipher, "plaintext: %s", srtp_octet_string_hex_string(buffer, length)); @@ -486,18 +479,10 @@ srtp_err_status_t srtp_cipher_type_test( srtp_cipher_dealloc(c); return srtp_err_status_cant_check; } - status = srtp_cipher_rand(key, test_case->key_length_octets); - if (status) { - srtp_cipher_dealloc(c); - return status; - } + srtp_cipher_rand_for_tests(key, test_case->key_length_octets); /* chose a random initialization vector */ - status = srtp_cipher_rand(iv, MAX_KEY_LEN); - if (status) { - srtp_cipher_dealloc(c); - return status; - } + srtp_cipher_rand_for_tests(iv, MAX_KEY_LEN); /* initialize cipher */ status = srtp_cipher_init(c, key); diff --git a/libs/srtp/crypto/cipher/cipher_test_cases.c b/libs/srtp/crypto/cipher/cipher_test_cases.c new file mode 100644 index 0000000000..e4b8f0fcd8 --- /dev/null +++ b/libs/srtp/crypto/cipher/cipher_test_cases.c @@ -0,0 +1,365 @@ +/* + * + * Copyright (c) 2013-2021, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "cipher_test_cases.h" +#include + +/* + * KAT values for AES self-test. These + * values came from the legacy libsrtp code. + */ +/* clang-format off */ +static const uint8_t srtp_aes_icm_128_test_case_0_key[SRTP_AES_ICM_128_KEY_LEN_WSALT] = { + 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 +}; +/* clang-format on */ + +/* clang-format off */ +static uint8_t srtp_aes_icm_128_test_case_0_nonce[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_icm_128_test_case_0_plaintext[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, +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_icm_128_test_case_0_ciphertext[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 +}; +/* clang-format on */ + +const srtp_cipher_test_case_t srtp_aes_icm_128_test_case_0 = { + SRTP_AES_ICM_128_KEY_LEN_WSALT, /* octets in key */ + srtp_aes_icm_128_test_case_0_key, /* key */ + srtp_aes_icm_128_test_case_0_nonce, /* packet index */ + 32, /* octets in plaintext */ + srtp_aes_icm_128_test_case_0_plaintext, /* plaintext */ + 32, /* octets in ciphertext */ + srtp_aes_icm_128_test_case_0_ciphertext, /* ciphertext */ + 0, /* */ + NULL, /* */ + 0, /* */ + NULL /* pointer to next testcase */ +}; + +/* + * KAT values for AES-192-CTR self-test. These + * values came from section 7 of RFC 6188. + */ +/* clang-format off */ +static const uint8_t srtp_aes_icm_192_test_case_0_key[SRTP_AES_ICM_192_KEY_LEN_WSALT] = { + 0xea, 0xb2, 0x34, 0x76, 0x4e, 0x51, 0x7b, 0x2d, + 0x3d, 0x16, 0x0d, 0x58, 0x7d, 0x8c, 0x86, 0x21, + 0x97, 0x40, 0xf6, 0x5f, 0x99, 0xb6, 0xbc, 0xf7, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd +}; +/* clang-format on */ + +/* clang-format off */ +static uint8_t srtp_aes_icm_192_test_case_0_nonce[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_icm_192_test_case_0_plaintext[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, +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_icm_192_test_case_0_ciphertext[32] = { + 0x35, 0x09, 0x6c, 0xba, 0x46, 0x10, 0x02, 0x8d, + 0xc1, 0xb5, 0x75, 0x03, 0x80, 0x4c, 0xe3, 0x7c, + 0x5d, 0xe9, 0x86, 0x29, 0x1d, 0xcc, 0xe1, 0x61, + 0xd5, 0x16, 0x5e, 0xc4, 0x56, 0x8f, 0x5c, 0x9a +}; +/* clang-format on */ + +const srtp_cipher_test_case_t srtp_aes_icm_192_test_case_0 = { + SRTP_AES_ICM_192_KEY_LEN_WSALT, /* octets in key */ + srtp_aes_icm_192_test_case_0_key, /* key */ + srtp_aes_icm_192_test_case_0_nonce, /* packet index */ + 32, /* octets in plaintext */ + srtp_aes_icm_192_test_case_0_plaintext, /* plaintext */ + 32, /* octets in ciphertext */ + srtp_aes_icm_192_test_case_0_ciphertext, /* ciphertext */ + 0, /* */ + NULL, /* */ + 0, /* */ + NULL /* pointer to next testcase */ +}; + +/* + * KAT values for AES-256-CTR self-test. These + * values came from section 7 of RFC 6188. + */ +/* clang-format off */ +static const uint8_t srtp_aes_icm_256_test_case_0_key[SRTP_AES_ICM_256_KEY_LEN_WSALT] = { + 0x57, 0xf8, 0x2f, 0xe3, 0x61, 0x3f, 0xd1, 0x70, + 0xa8, 0x5e, 0xc9, 0x3c, 0x40, 0xb1, 0xf0, 0x92, + 0x2e, 0xc4, 0xcb, 0x0d, 0xc0, 0x25, 0xb5, 0x82, + 0x72, 0x14, 0x7c, 0xc4, 0x38, 0x94, 0x4a, 0x98, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd +}; +/* clang-format on */ + +/* clang-format off */ +static uint8_t srtp_aes_icm_256_test_case_0_nonce[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_icm_256_test_case_0_plaintext[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, +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_icm_256_test_case_0_ciphertext[32] = { + 0x92, 0xbd, 0xd2, 0x8a, 0x93, 0xc3, 0xf5, 0x25, + 0x11, 0xc6, 0x77, 0xd0, 0x8b, 0x55, 0x15, 0xa4, + 0x9d, 0xa7, 0x1b, 0x23, 0x78, 0xa8, 0x54, 0xf6, + 0x70, 0x50, 0x75, 0x6d, 0xed, 0x16, 0x5b, 0xac +}; +/* clang-format on */ + +const srtp_cipher_test_case_t srtp_aes_icm_256_test_case_0 = { + SRTP_AES_ICM_256_KEY_LEN_WSALT, /* octets in key */ + srtp_aes_icm_256_test_case_0_key, /* key */ + srtp_aes_icm_256_test_case_0_nonce, /* packet index */ + 32, /* octets in plaintext */ + srtp_aes_icm_256_test_case_0_plaintext, /* plaintext */ + 32, /* octets in ciphertext */ + srtp_aes_icm_256_test_case_0_ciphertext, /* ciphertext */ + 0, /* */ + NULL, /* */ + 0, /* */ + NULL /* pointer to next testcase */ +}; + +/* + * KAT values for AES self-test. These + * values we're derived from independent test code + * using OpenSSL. + */ +/* clang-format off */ +static const uint8_t srtp_aes_gcm_128_test_case_0_key[SRTP_AES_GCM_128_KEY_LEN_WSALT] = { + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, +}; +/* clang-format on */ + +/* clang-format off */ +static uint8_t srtp_aes_gcm_128_test_case_0_iv[12] = { + 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88 +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_gcm_128_test_case_0_plaintext[60] = { + 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, + 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, + 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, + 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, + 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, + 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, + 0xba, 0x63, 0x7b, 0x39 +}; + +/* clang-format off */ +static const uint8_t srtp_aes_gcm_128_test_case_0_aad[20] = { + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xab, 0xad, 0xda, 0xd2 +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_gcm_128_test_case_0_ciphertext[76] = { + 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, + 0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c, + 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0, + 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, + 0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, + 0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05, + 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97, + 0x3d, 0x58, 0xe0, 0x91, + /* the last 16 bytes are the tag */ + 0x5b, 0xc9, 0x4f, 0xbc, 0x32, 0x21, 0xa5, 0xdb, + 0x94, 0xfa, 0xe9, 0x5a, 0xe7, 0x12, 0x1a, 0x47, +}; +/* clang-format on */ + +static const srtp_cipher_test_case_t srtp_aes_gcm_128_test_case_0a = { + SRTP_AES_GCM_128_KEY_LEN_WSALT, /* octets in key */ + srtp_aes_gcm_128_test_case_0_key, /* key */ + srtp_aes_gcm_128_test_case_0_iv, /* packet index */ + 60, /* octets in plaintext */ + srtp_aes_gcm_128_test_case_0_plaintext, /* plaintext */ + 68, /* octets in ciphertext */ + srtp_aes_gcm_128_test_case_0_ciphertext, /* ciphertext + tag */ + 20, /* octets in AAD */ + srtp_aes_gcm_128_test_case_0_aad, /* AAD */ + 8, /* */ + NULL /* pointer to next testcase */ +}; + +const srtp_cipher_test_case_t srtp_aes_gcm_128_test_case_0 = { + SRTP_AES_GCM_128_KEY_LEN_WSALT, /* octets in key */ + srtp_aes_gcm_128_test_case_0_key, /* key */ + srtp_aes_gcm_128_test_case_0_iv, /* packet index */ + 60, /* octets in plaintext */ + srtp_aes_gcm_128_test_case_0_plaintext, /* plaintext */ + 76, /* octets in ciphertext */ + srtp_aes_gcm_128_test_case_0_ciphertext, /* ciphertext + tag */ + 20, /* octets in AAD */ + srtp_aes_gcm_128_test_case_0_aad, /* AAD */ + 16, /* */ + &srtp_aes_gcm_128_test_case_0a /* pointer to next testcase */ +}; + +/* clang-format off */ +static const uint8_t srtp_aes_gcm_256_test_case_0_key[SRTP_AES_GCM_256_KEY_LEN_WSALT] = { + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0xa5, 0x59, 0x09, 0xc5, 0x54, 0x66, 0x93, 0x1c, + 0xaf, 0xf5, 0x26, 0x9a, 0x21, 0xd5, 0x14, 0xb2, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, +}; +/* clang-format on */ + +/* clang-format off */ +static uint8_t srtp_aes_gcm_256_test_case_0_iv[12] = { + 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, + 0xde, 0xca, 0xf8, 0x88 +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_gcm_256_test_case_0_plaintext[60] = { + 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, + 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, + 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, + 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, + 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, + 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, + 0xba, 0x63, 0x7b, 0x39 +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_gcm_256_test_case_0_aad[20] = { + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xab, 0xad, 0xda, 0xd2 +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_aes_gcm_256_test_case_0_ciphertext[76] = { + 0x0b, 0x11, 0xcf, 0xaf, 0x68, 0x4d, 0xae, 0x46, + 0xc7, 0x90, 0xb8, 0x8e, 0xb7, 0x6a, 0x76, 0x2a, + 0x94, 0x82, 0xca, 0xab, 0x3e, 0x39, 0xd7, 0x86, + 0x1b, 0xc7, 0x93, 0xed, 0x75, 0x7f, 0x23, 0x5a, + 0xda, 0xfd, 0xd3, 0xe2, 0x0e, 0x80, 0x87, 0xa9, + 0x6d, 0xd7, 0xe2, 0x6a, 0x7d, 0x5f, 0xb4, 0x80, + 0xef, 0xef, 0xc5, 0x29, 0x12, 0xd1, 0xaa, 0x10, + 0x09, 0xc9, 0x86, 0xc1, + /* the last 16 bytes are the tag */ + 0x45, 0xbc, 0x03, 0xe6, 0xe1, 0xac, 0x0a, 0x9f, + 0x81, 0xcb, 0x8e, 0x5b, 0x46, 0x65, 0x63, 0x1d, +}; +/* clang-format on */ + +static const srtp_cipher_test_case_t srtp_aes_gcm_256_test_case_0a = { + SRTP_AES_GCM_256_KEY_LEN_WSALT, /* octets in key */ + srtp_aes_gcm_256_test_case_0_key, /* key */ + srtp_aes_gcm_256_test_case_0_iv, /* packet index */ + 60, /* octets in plaintext */ + srtp_aes_gcm_256_test_case_0_plaintext, /* plaintext */ + 68, /* octets in ciphertext */ + srtp_aes_gcm_256_test_case_0_ciphertext, /* ciphertext + tag */ + 20, /* octets in AAD */ + srtp_aes_gcm_256_test_case_0_aad, /* AAD */ + 8, /* */ + NULL /* pointer to next testcase */ +}; + +const srtp_cipher_test_case_t srtp_aes_gcm_256_test_case_0 = { + SRTP_AES_GCM_256_KEY_LEN_WSALT, /* octets in key */ + srtp_aes_gcm_256_test_case_0_key, /* key */ + srtp_aes_gcm_256_test_case_0_iv, /* packet index */ + 60, /* octets in plaintext */ + srtp_aes_gcm_256_test_case_0_plaintext, /* plaintext */ + 76, /* octets in ciphertext */ + srtp_aes_gcm_256_test_case_0_ciphertext, /* ciphertext + tag */ + 20, /* octets in AAD */ + srtp_aes_gcm_256_test_case_0_aad, /* AAD */ + 16, /* */ + &srtp_aes_gcm_256_test_case_0a /* pointer to next testcase */ +}; diff --git a/libs/srtp/crypto/cipher/cipher_test_cases.h b/libs/srtp/crypto/cipher/cipher_test_cases.h new file mode 100644 index 0000000000..c8a9284002 --- /dev/null +++ b/libs/srtp/crypto/cipher/cipher_test_cases.h @@ -0,0 +1,53 @@ +/* + * + * Copyright (c) 2013-2021, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef CHIPHER_TEST_CASES_H +#define CHIPHER_TEST_CASES_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "cipher.h" + +extern const srtp_cipher_test_case_t srtp_aes_icm_128_test_case_0; +extern const srtp_cipher_test_case_t srtp_aes_icm_192_test_case_0; +extern const srtp_cipher_test_case_t srtp_aes_icm_256_test_case_0; + +extern const srtp_cipher_test_case_t srtp_aes_gcm_128_test_case_0; +extern const srtp_cipher_test_case_t srtp_aes_gcm_256_test_case_0; + +#endif diff --git a/libs/srtp/crypto/cipher/null_cipher.c b/libs/srtp/crypto/cipher/null_cipher.c index 659add0d47..969724611c 100644 --- a/libs/srtp/crypto/cipher/null_cipher.c +++ b/libs/srtp/crypto/cipher/null_cipher.c @@ -97,7 +97,7 @@ static srtp_err_status_t srtp_null_cipher_init(void *cv, const uint8_t *key) { /* srtp_null_cipher_ctx_t *c = (srtp_null_cipher_ctx_t *)cv; */ - debug_print(srtp_mod_cipher, "initializing null cipher", NULL); + debug_print0(srtp_mod_cipher, "initializing null cipher"); return srtp_err_status_ok; } diff --git a/libs/srtp/crypto/hash/auth.c b/libs/srtp/crypto/hash/auth.c index f19327dc8e..9be0ccfd36 100644 --- a/libs/srtp/crypto/hash/auth.c +++ b/libs/srtp/crypto/hash/auth.c @@ -123,6 +123,12 @@ srtp_err_status_t srtp_auth_type_test(const srtp_auth_type_t *at, return status; } + status = srtp_auth_start(a); + if (status) { + srtp_auth_dealloc(a); + return status; + } + /* zeroize tag then compute */ octet_string_set_to_zero(tag, test_case->tag_length_octets); status = srtp_auth_compute(a, test_case->data, diff --git a/libs/srtp/crypto/hash/auth_test_cases.c b/libs/srtp/crypto/hash/auth_test_cases.c new file mode 100644 index 0000000000..22b9418434 --- /dev/null +++ b/libs/srtp/crypto/hash/auth_test_cases.c @@ -0,0 +1,70 @@ +/* + * + * Copyright (c) 2013-2021, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "auth_test_cases.h" +#include + +/* clang-format off */ +static const uint8_t srtp_hmac_test_case_0_key[20] = { + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_hmac_test_case_0_data[8] = { + 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 /* "Hi There" */ +}; +/* clang-format on */ + +/* clang-format off */ +static const uint8_t srtp_hmac_test_case_0_tag[20] = { + 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, + 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, + 0xf1, 0x46, 0xbe, 0x00 +}; +/* clang-format on */ + +const srtp_auth_test_case_t srtp_hmac_test_case_0 = { + sizeof(srtp_hmac_test_case_0_key), /* octets in key */ + srtp_hmac_test_case_0_key, /* key */ + sizeof(srtp_hmac_test_case_0_data), /* octets in data */ + srtp_hmac_test_case_0_data, /* data */ + sizeof(srtp_hmac_test_case_0_tag), /* octets in tag */ + srtp_hmac_test_case_0_tag, /* tag */ + NULL /* pointer to next testcase */ +}; diff --git a/libs/srtp/crypto/include/aes_gcm_ossl.h b/libs/srtp/crypto/hash/auth_test_cases.h similarity index 76% rename from libs/srtp/crypto/include/aes_gcm_ossl.h rename to libs/srtp/crypto/hash/auth_test_cases.h index d5b83eeeb0..9f37718205 100644 --- a/libs/srtp/crypto/include/aes_gcm_ossl.h +++ b/libs/srtp/crypto/hash/auth_test_cases.h @@ -1,15 +1,6 @@ -/* - * aes_gcm_ossl.h - * - * Header for AES Galois Counter Mode. - * - * John A. Foley - * Cisco Systems, Inc. - * - */ /* * - * Copyright (c) 2013-2017, Cisco Systems, Inc. + * Copyright (c) 2013-2021, Cisco Systems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,20 +34,15 @@ * */ -#ifndef AES_GCM_OSSL_H -#define AES_GCM_OSSL_H +#ifndef AUTH_TEST_CASES_H +#define AUTH_TEST_CASES_H -#include "cipher.h" -#include "srtp.h" -#include "datatypes.h" -#include -#include +#ifdef HAVE_CONFIG_H +#include +#endif -typedef struct { - int key_size; - int tag_len; - EVP_CIPHER_CTX *ctx; - srtp_cipher_direction_t dir; -} srtp_aes_gcm_ctx_t; +#include "auth.h" -#endif /* AES_GCM_OSSL_H */ +extern const srtp_auth_test_case_t srtp_hmac_test_case_0; + +#endif diff --git a/libs/srtp/crypto/hash/hmac.c b/libs/srtp/crypto/hash/hmac.c index 6e91468f36..269c3f6a71 100644 --- a/libs/srtp/crypto/hash/hmac.c +++ b/libs/srtp/crypto/hash/hmac.c @@ -49,6 +49,7 @@ #include "hmac.h" #include "alloc.h" #include "cipher_types.h" +#include "auth_test_cases.h" /* the debug module for authentiation */ @@ -228,41 +229,6 @@ static srtp_err_status_t srtp_hmac_compute(void *statev, return srtp_err_status_ok; } -/* begin test case 0 */ -/* clang-format off */ -static const uint8_t srtp_hmac_test_case_0_key[20] = { - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_hmac_test_case_0_data[8] = { - 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 /* "Hi There" */ -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_hmac_test_case_0_tag[20] = { - 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, - 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, - 0xf1, 0x46, 0xbe, 0x00 -}; -/* clang-format on */ - -static const srtp_auth_test_case_t srtp_hmac_test_case_0 = { - 20, /* octets in key */ - srtp_hmac_test_case_0_key, /* key */ - 8, /* octets in data */ - srtp_hmac_test_case_0_data, /* data */ - 20, /* octets in tag */ - srtp_hmac_test_case_0_tag, /* tag */ - NULL /* pointer to next testcase */ -}; - -/* end test case 0 */ - static const char srtp_hmac_description[] = "hmac sha-1 authentication function"; diff --git a/libs/srtp/crypto/hash/hmac_mbedtls.c b/libs/srtp/crypto/hash/hmac_mbedtls.c new file mode 100644 index 0000000000..f710be9c78 --- /dev/null +++ b/libs/srtp/crypto/hash/hmac_mbedtls.c @@ -0,0 +1,221 @@ +/* + * hmac_mbedtls.c + * + * Implementation of hmac srtp_auth_type_t that leverages Mbedtls + * + * YongCheng Yang + */ +/* + * + * Copyright(c) 2013-2017, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "auth.h" +#include "alloc.h" +#include "err.h" /* for srtp_debug */ +#include "auth_test_cases.h" +#include + +#define SHA1_DIGEST_SIZE 20 + +/* the debug module for authentiation */ + +srtp_debug_module_t srtp_mod_hmac = { + 0, /* debugging is off by default */ + "hmac sha-1 mbedtls" /* printable name for module */ +}; + +static srtp_err_status_t srtp_hmac_mbedtls_alloc(srtp_auth_t **a, + int key_len, + int out_len) +{ + extern const srtp_auth_type_t srtp_hmac; + + debug_print(srtp_mod_hmac, "allocating auth func with key length %d", + key_len); + debug_print(srtp_mod_hmac, " tag length %d", + out_len); + + /* check output length - should be less than 20 bytes */ + if (key_len > SHA1_DIGEST_SIZE) { + return srtp_err_status_bad_param; + } + /* check output length - should be less than 20 bytes */ + if (out_len > SHA1_DIGEST_SIZE) { + return srtp_err_status_bad_param; + } + + *a = (srtp_auth_t *)srtp_crypto_alloc(sizeof(srtp_auth_t)); + if (*a == NULL) { + return srtp_err_status_alloc_fail; + } + // allocate the buffer of mbedtls context. + (*a)->state = srtp_crypto_alloc(sizeof(mbedtls_md_context_t)); + if ((*a)->state == NULL) { + srtp_crypto_free(*a); + *a = NULL; + return srtp_err_status_alloc_fail; + } + mbedtls_md_init((mbedtls_md_context_t *)(*a)->state); + + /* set pointers */ + (*a)->type = &srtp_hmac; + (*a)->out_len = out_len; + (*a)->key_len = key_len; + (*a)->prefix_len = 0; + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_mbedtls_dealloc(srtp_auth_t *a) +{ + mbedtls_md_context_t *hmac_ctx; + hmac_ctx = (mbedtls_md_context_t *)a->state; + mbedtls_md_free(hmac_ctx); + srtp_crypto_free(hmac_ctx); + /* zeroize entire state*/ + octet_string_set_to_zero(a, sizeof(srtp_auth_t)); + + /* free memory */ + srtp_crypto_free(a); + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_mbedtls_start(void *statev) +{ + mbedtls_md_context_t *state = (mbedtls_md_context_t *)statev; + if (mbedtls_md_hmac_reset(state) != 0) + return srtp_err_status_auth_fail; + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_mbedtls_init(void *statev, + const uint8_t *key, + int key_len) +{ + mbedtls_md_context_t *state = (mbedtls_md_context_t *)statev; + const mbedtls_md_info_t *info = NULL; + + info = mbedtls_md_info_from_type(MBEDTLS_MD_SHA1); + if (info == NULL) + return srtp_err_status_auth_fail; + + if (mbedtls_md_setup(state, info, 1) != 0) + return srtp_err_status_auth_fail; + + debug_print(srtp_mod_hmac, "mbedtls setup, name: %s", + mbedtls_md_get_name(info)); + debug_print(srtp_mod_hmac, "mbedtls setup, size: %d", + mbedtls_md_get_size(info)); + + if (mbedtls_md_hmac_starts(state, key, key_len) != 0) + return srtp_err_status_auth_fail; + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_mbedtls_update(void *statev, + const uint8_t *message, + int msg_octets) +{ + mbedtls_md_context_t *state = (mbedtls_md_context_t *)statev; + + debug_print(srtp_mod_hmac, "input: %s", + srtp_octet_string_hex_string(message, msg_octets)); + + if (mbedtls_md_hmac_update(state, message, msg_octets) != 0) + return srtp_err_status_auth_fail; + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_mbedtls_compute(void *statev, + const uint8_t *message, + int msg_octets, + int tag_len, + uint8_t *result) +{ + mbedtls_md_context_t *state = (mbedtls_md_context_t *)statev; + uint8_t hash_value[SHA1_DIGEST_SIZE]; + int i; + + /* check tag length, return error if we can't provide the value expected */ + if (tag_len > SHA1_DIGEST_SIZE) { + return srtp_err_status_bad_param; + } + + /* hash message, copy output into H */ + if (mbedtls_md_hmac_update(statev, message, msg_octets) != 0) + return srtp_err_status_auth_fail; + + if (mbedtls_md_hmac_finish(state, hash_value) != 0) + return srtp_err_status_auth_fail; + + /* copy hash_value to *result */ + for (i = 0; i < tag_len; i++) { + result[i] = hash_value[i]; + } + + debug_print(srtp_mod_hmac, "output: %s", + srtp_octet_string_hex_string(hash_value, tag_len)); + + return srtp_err_status_ok; +} + +/* end test case 0 */ + +static const char srtp_hmac_mbedtls_description[] = + "hmac sha-1 authentication function using mbedtls"; + +/* + * srtp_auth_type_t hmac is the hmac metaobject + */ + +const srtp_auth_type_t srtp_hmac = { + srtp_hmac_mbedtls_alloc, /* */ + srtp_hmac_mbedtls_dealloc, /* */ + srtp_hmac_mbedtls_init, /* */ + srtp_hmac_mbedtls_compute, /* */ + srtp_hmac_mbedtls_update, /* */ + srtp_hmac_mbedtls_start, /* */ + srtp_hmac_mbedtls_description, /* */ + &srtp_hmac_test_case_0, /* */ + SRTP_HMAC_SHA1 /* */ +}; diff --git a/libs/srtp/crypto/hash/hmac_nss.c b/libs/srtp/crypto/hash/hmac_nss.c new file mode 100644 index 0000000000..8d1e42f620 --- /dev/null +++ b/libs/srtp/crypto/hash/hmac_nss.c @@ -0,0 +1,290 @@ +/* + * + * Copyright(c) 2013-2017, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "auth.h" +#include "alloc.h" +#include "err.h" /* for srtp_debug */ +#include "auth_test_cases.h" + +#define NSS_PKCS11_2_0_COMPAT 1 + +#include +#include + +#define SHA1_DIGEST_SIZE 20 + +/* the debug module for authentiation */ + +srtp_debug_module_t srtp_mod_hmac = { + 0, /* debugging is off by default */ + "hmac sha-1 nss" /* printable name for module */ +}; + +typedef struct { + NSSInitContext *nss; + PK11SymKey *key; + PK11Context *ctx; +} srtp_hmac_nss_ctx_t; + +static srtp_err_status_t srtp_hmac_alloc(srtp_auth_t **a, + int key_len, + int out_len) +{ + extern const srtp_auth_type_t srtp_hmac; + srtp_hmac_nss_ctx_t *hmac; + NSSInitContext *nss; + + debug_print(srtp_mod_hmac, "allocating auth func with key length %d", + key_len); + debug_print(srtp_mod_hmac, " tag length %d", + out_len); + + /* check output length - should be less than 20 bytes */ + if (out_len > SHA1_DIGEST_SIZE) { + return srtp_err_status_bad_param; + } + + /* Initialize NSS equiv of NSS_NoDB_Init(NULL) */ + nss = NSS_InitContext("", "", "", "", NULL, + NSS_INIT_READONLY | NSS_INIT_NOCERTDB | + NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN | + NSS_INIT_OPTIMIZESPACE); + if (!nss) { + return srtp_err_status_auth_fail; + } + + *a = (srtp_auth_t *)srtp_crypto_alloc(sizeof(srtp_auth_t)); + if (*a == NULL) { + NSS_ShutdownContext(nss); + return srtp_err_status_alloc_fail; + } + + hmac = + (srtp_hmac_nss_ctx_t *)srtp_crypto_alloc(sizeof(srtp_hmac_nss_ctx_t)); + if (hmac == NULL) { + NSS_ShutdownContext(nss); + srtp_crypto_free(*a); + *a = NULL; + return srtp_err_status_alloc_fail; + } + + hmac->nss = nss; + hmac->key = NULL; + hmac->ctx = NULL; + + /* set pointers */ + (*a)->state = hmac; + (*a)->type = &srtp_hmac; + (*a)->out_len = out_len; + (*a)->key_len = key_len; + (*a)->prefix_len = 0; + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_dealloc(srtp_auth_t *a) +{ + srtp_hmac_nss_ctx_t *hmac; + + hmac = (srtp_hmac_nss_ctx_t *)a->state; + if (hmac) { + /* free any PK11 values that have been created */ + if (hmac->key) { + PK11_FreeSymKey(hmac->key); + hmac->key = NULL; + } + + if (hmac->ctx) { + PK11_DestroyContext(hmac->ctx, PR_TRUE); + hmac->ctx = NULL; + } + + if (hmac->nss) { + NSS_ShutdownContext(hmac->nss); + hmac->nss = NULL; + } + + /* zeroize everything */ + octet_string_set_to_zero(hmac, sizeof(srtp_hmac_nss_ctx_t)); + srtp_crypto_free(hmac); + } + + /* free memory */ + srtp_crypto_free(a); + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_start(void *statev) +{ + srtp_hmac_nss_ctx_t *hmac; + hmac = (srtp_hmac_nss_ctx_t *)statev; + + if (PK11_DigestBegin(hmac->ctx) != SECSuccess) { + return srtp_err_status_auth_fail; + } + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_init(void *statev, + const uint8_t *key, + int key_len) +{ + srtp_hmac_nss_ctx_t *hmac; + hmac = (srtp_hmac_nss_ctx_t *)statev; + PK11SymKey *sym_key; + PK11Context *ctx; + + if (hmac->ctx) { + PK11_DestroyContext(hmac->ctx, PR_TRUE); + hmac->ctx = NULL; + } + + if (hmac->key) { + PK11_FreeSymKey(hmac->key); + hmac->key = NULL; + } + + PK11SlotInfo *slot = PK11_GetBestSlot(CKM_SHA_1_HMAC, NULL); + if (!slot) { + return srtp_err_status_bad_param; + } + + SECItem key_item = { siBuffer, (unsigned char *)key, key_len }; + sym_key = PK11_ImportSymKey(slot, CKM_SHA_1_HMAC, PK11_OriginUnwrap, + CKA_SIGN, &key_item, NULL); + PK11_FreeSlot(slot); + + if (!sym_key) { + return srtp_err_status_auth_fail; + } + + SECItem param_item = { siBuffer, NULL, 0 }; + ctx = PK11_CreateContextBySymKey(CKM_SHA_1_HMAC, CKA_SIGN, sym_key, + ¶m_item); + if (!ctx) { + PK11_FreeSymKey(sym_key); + return srtp_err_status_auth_fail; + } + + hmac->key = sym_key; + hmac->ctx = ctx; + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_update(void *statev, + const uint8_t *message, + int msg_octets) +{ + srtp_hmac_nss_ctx_t *hmac; + hmac = (srtp_hmac_nss_ctx_t *)statev; + + debug_print(srtp_mod_hmac, "input: %s", + srtp_octet_string_hex_string(message, msg_octets)); + + if (PK11_DigestOp(hmac->ctx, message, msg_octets) != SECSuccess) { + return srtp_err_status_auth_fail; + } + + return srtp_err_status_ok; +} + +static srtp_err_status_t srtp_hmac_compute(void *statev, + const uint8_t *message, + int msg_octets, + int tag_len, + uint8_t *result) +{ + srtp_hmac_nss_ctx_t *hmac; + hmac = (srtp_hmac_nss_ctx_t *)statev; + uint8_t hash_value[SHA1_DIGEST_SIZE]; + int i; + unsigned int len; + + debug_print(srtp_mod_hmac, "input: %s", + srtp_octet_string_hex_string(message, msg_octets)); + + /* check tag length, return error if we can't provide the value expected */ + if (tag_len > SHA1_DIGEST_SIZE) { + return srtp_err_status_bad_param; + } + + if (PK11_DigestOp(hmac->ctx, message, msg_octets) != SECSuccess) { + return srtp_err_status_auth_fail; + } + + if (PK11_DigestFinal(hmac->ctx, hash_value, &len, SHA1_DIGEST_SIZE) != + SECSuccess) { + return srtp_err_status_auth_fail; + } + + if (len < tag_len) + return srtp_err_status_auth_fail; + + /* copy hash_value to *result */ + for (i = 0; i < tag_len; i++) { + result[i] = hash_value[i]; + } + + debug_print(srtp_mod_hmac, "output: %s", + srtp_octet_string_hex_string(hash_value, tag_len)); + + return srtp_err_status_ok; +} + +static const char srtp_hmac_description[] = + "hmac sha-1 authentication function"; + +/* + * srtp_auth_type_t hmac is the hmac metaobject + */ + +const srtp_auth_type_t srtp_hmac = { + srtp_hmac_alloc, /* */ + srtp_hmac_dealloc, /* */ + srtp_hmac_init, /* */ + srtp_hmac_compute, /* */ + srtp_hmac_update, /* */ + srtp_hmac_start, /* */ + srtp_hmac_description, /* */ + &srtp_hmac_test_case_0, /* */ + SRTP_HMAC_SHA1 /* */ +}; diff --git a/libs/srtp/crypto/hash/hmac_ossl.c b/libs/srtp/crypto/hash/hmac_ossl.c index 8146438b05..ee6b0b5851 100644 --- a/libs/srtp/crypto/hash/hmac_ossl.c +++ b/libs/srtp/crypto/hash/hmac_ossl.c @@ -49,6 +49,7 @@ #include "auth.h" #include "alloc.h" #include "err.h" /* for srtp_debug */ +#include "auth_test_cases.h" #include #include @@ -192,6 +193,9 @@ static srtp_err_status_t srtp_hmac_compute(void *statev, int i; unsigned int len; + debug_print(srtp_mod_hmac, "input: %s", + srtp_octet_string_hex_string(message, msg_octets)); + /* check tag length, return error if we can't provide the value expected */ if (tag_len > SHA1_DIGEST_SIZE) { return srtp_err_status_bad_param; @@ -218,41 +222,6 @@ static srtp_err_status_t srtp_hmac_compute(void *statev, return srtp_err_status_ok; } -/* begin test case 0 */ -/* clang-format off */ -static const uint8_t srtp_hmac_test_case_0_key[SHA1_DIGEST_SIZE] = { - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_hmac_test_case_0_data[8] = { - 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 /* "Hi There" */ -}; -/* clang-format on */ - -/* clang-format off */ -static const uint8_t srtp_hmac_test_case_0_tag[SHA1_DIGEST_SIZE] = { - 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, - 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, - 0xf1, 0x46, 0xbe, 0x00 -}; -/* clang-format on */ - -static const srtp_auth_test_case_t srtp_hmac_test_case_0 = { - sizeof(srtp_hmac_test_case_0_key), /* octets in key */ - srtp_hmac_test_case_0_key, /* key */ - sizeof(srtp_hmac_test_case_0_data), /* octets in data */ - srtp_hmac_test_case_0_data, /* data */ - sizeof(srtp_hmac_test_case_0_tag), /* octets in tag */ - srtp_hmac_test_case_0_tag, /* tag */ - NULL /* pointer to next testcase */ -}; - -/* end test case 0 */ - static const char srtp_hmac_description[] = "hmac sha-1 authentication function"; diff --git a/libs/srtp/crypto/hash/sha1.c b/libs/srtp/crypto/hash/sha1.c index afd6381542..901a933250 100644 --- a/libs/srtp/crypto/hash/sha1.c +++ b/libs/srtp/crypto/hash/sha1.c @@ -76,15 +76,6 @@ uint32_t SHA_K1 = 0x6ED9EBA1; /* Kt for 20 <= t <= 39 */ uint32_t SHA_K2 = 0x8F1BBCDC; /* Kt for 40 <= t <= 59 */ uint32_t SHA_K3 = 0xCA62C1D6; /* Kt for 60 <= t <= 79 */ -void srtp_sha1(const uint8_t *msg, int octets_in_msg, uint32_t hash_value[5]) -{ - srtp_sha1_ctx_t ctx; - - srtp_sha1_init(&ctx); - srtp_sha1_update(&ctx, msg, octets_in_msg); - srtp_sha1_final(&ctx, hash_value); -} - /* * srtp_sha1_core(M, H) computes the core compression function, where M is * the next part of the message (in network byte order) and H is the @@ -261,14 +252,13 @@ void srtp_sha1_update(srtp_sha1_ctx_t *ctx, /* process a whole block */ - debug_print(srtp_mod_sha1, "(update) running srtp_sha1_core()", - NULL); + debug_print0(srtp_mod_sha1, "(update) running srtp_sha1_core()"); srtp_sha1_core(ctx->M, ctx->H); } else { - debug_print(srtp_mod_sha1, "(update) not running srtp_sha1_core()", - NULL); + debug_print0(srtp_mod_sha1, + "(update) not running srtp_sha1_core()"); for (i = ctx->octets_in_buffer; i < (ctx->octets_in_buffer + octets_in_msg); i++) { @@ -285,7 +275,7 @@ void srtp_sha1_update(srtp_sha1_ctx_t *ctx, * into the twenty octets located at *output */ -void srtp_sha1_final(srtp_sha1_ctx_t *ctx, uint32_t *output) +void srtp_sha1_final(srtp_sha1_ctx_t *ctx, uint32_t output[5]) { uint32_t A, B, C, D, E, TEMP; uint32_t W[80]; @@ -391,11 +381,10 @@ void srtp_sha1_final(srtp_sha1_ctx_t *ctx, uint32_t *output) ctx->H[4] += E; } - debug_print(srtp_mod_sha1, "(final) running srtp_sha1_core()", NULL); + debug_print0(srtp_mod_sha1, "(final) running srtp_sha1_core()"); if (ctx->octets_in_buffer >= 56) { - debug_print(srtp_mod_sha1, "(final) running srtp_sha1_core() again", - NULL); + debug_print0(srtp_mod_sha1, "(final) running srtp_sha1_core() again"); /* we need to do one final run of the compression algo */ diff --git a/libs/srtp/crypto/include/aes_gcm.h b/libs/srtp/crypto/include/aes_gcm.h new file mode 100644 index 0000000000..cd0dceed3e --- /dev/null +++ b/libs/srtp/crypto/include/aes_gcm.h @@ -0,0 +1,110 @@ +/* + * aes_gcm.h + * + * Header for AES Galois Counter Mode. + * + * John A. Foley + * Cisco Systems, Inc. + * + */ +/* + * + * Copyright (c) 2013-2017, Cisco Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * Neither the name of the Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef AES_GCM_H +#define AES_GCM_H + +#include "cipher.h" +#include "srtp.h" +#include "datatypes.h" + +#ifdef OPENSSL + +#include +#include + +typedef struct { + int key_size; + int tag_len; + EVP_CIPHER_CTX *ctx; + srtp_cipher_direction_t dir; +} srtp_aes_gcm_ctx_t; + +#endif /* OPENSSL */ + +#ifdef MBEDTLS +#define MAX_AD_SIZE 2048 +#include +#include + +typedef struct { + int key_size; + int tag_len; + int aad_size; + int iv_len; + uint8_t iv[12]; + uint8_t tag[16]; + uint8_t aad[MAX_AD_SIZE]; + mbedtls_gcm_context *ctx; + srtp_cipher_direction_t dir; +} srtp_aes_gcm_ctx_t; + +#endif /* MBEDTLS */ + +#ifdef NSS + +#define NSS_PKCS11_2_0_COMPAT 1 + +#include +#include + +#define MAX_AD_SIZE 2048 + +typedef struct { + int key_size; + int tag_size; + srtp_cipher_direction_t dir; + NSSInitContext *nss; + PK11SymKey *key; + uint8_t iv[12]; + uint8_t aad[MAX_AD_SIZE]; + int aad_size; + CK_GCM_PARAMS params; + uint8_t tag[16]; +} srtp_aes_gcm_ctx_t; + +#endif /* NSS */ + +#endif /* AES_GCM_H */ diff --git a/libs/srtp/crypto/include/aes_icm_ossl.h b/libs/srtp/crypto/include/aes_icm_ext.h similarity index 76% rename from libs/srtp/crypto/include/aes_icm_ossl.h rename to libs/srtp/crypto/include/aes_icm_ext.h index c4aae376e6..5b21c95dde 100644 --- a/libs/srtp/crypto/include/aes_icm_ossl.h +++ b/libs/srtp/crypto/include/aes_icm_ext.h @@ -48,6 +48,9 @@ #include "cipher.h" #include "datatypes.h" + +#ifdef OPENSSL + #include #include @@ -58,4 +61,39 @@ typedef struct { EVP_CIPHER_CTX *ctx; } srtp_aes_icm_ctx_t; +#endif /* OPENSSL */ + +#ifdef MBEDTLS + +#include +typedef struct { + v128_t counter; /* holds the counter value */ + v128_t offset; /* initial offset value */ + v128_t stream_block; + size_t nc_off; + int key_size; + mbedtls_aes_context *ctx; +} srtp_aes_icm_ctx_t; + +#endif /* MBEDTLS */ + +#ifdef NSS + +#define NSS_PKCS11_2_0_COMPAT 1 + +#include +#include + +typedef struct { + v128_t counter; + v128_t offset; + int key_size; + uint8_t iv[16]; + NSSInitContext *nss; + PK11SymKey *key; + PK11Context *ctx; +} srtp_aes_icm_ctx_t; + +#endif /* NSS */ + #endif /* AES_ICM_H */ diff --git a/libs/srtp/crypto/include/stat.h b/libs/srtp/crypto/include/cipher_priv.h similarity index 77% rename from libs/srtp/crypto/include/stat.h rename to libs/srtp/crypto/include/cipher_priv.h index 1894e041aa..46848ea7c6 100644 --- a/libs/srtp/crypto/include/stat.h +++ b/libs/srtp/crypto/include/cipher_priv.h @@ -1,15 +1,6 @@ -/* - * stats.h - * - * interface to statistical test functions - * - * David A. McGrew - * Cisco Systems, Inc. - */ - /* * - * Copyright(c) 2001-2017, Cisco Systems, Inc. + * Copyright(c) 2001-2017 Cisco Systems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,24 +34,29 @@ * */ -#ifndef STAT_H -#define STAT_H +#ifndef SRTP_CIHPER_PRIV_H +#define SRTP_CIHPER_PRIV_H -#include "datatypes.h" /* for uint8_t */ -#include "err.h" /* for srtp_err_status_t */ +#include "cipher.h" #ifdef __cplusplus extern "C" { #endif -srtp_err_status_t stat_test_monobit(uint8_t *data); +/* + * A trivial platform independent random source. + * For use in test only. + */ +void srtp_cipher_rand_for_tests(void *dest, uint32_t len); -srtp_err_status_t stat_test_poker(uint8_t *data); - -srtp_err_status_t stat_test_runs(uint8_t *data); +/* + * A trivial platform independent 32 bit random number. + * For use in test only. + */ +uint32_t srtp_cipher_rand_u32_for_tests(void); #ifdef __cplusplus } #endif -#endif /* STAT_H */ +#endif /* SRTP_CIPHER_PRIV_H */ diff --git a/libs/srtp/crypto/include/cipher_types.h b/libs/srtp/crypto/include/cipher_types.h index a543b5478b..28250d1624 100644 --- a/libs/srtp/crypto/include/cipher_types.h +++ b/libs/srtp/crypto/include/cipher_types.h @@ -47,10 +47,10 @@ extern const srtp_cipher_type_t srtp_null_cipher; extern const srtp_cipher_type_t srtp_aes_icm_128; extern const srtp_cipher_type_t srtp_aes_icm_256; -#ifdef OPENSSL +#ifdef GCM extern const srtp_cipher_type_t srtp_aes_icm_192; -extern const srtp_cipher_type_t srtp_aes_gcm_128_openssl; -extern const srtp_cipher_type_t srtp_aes_gcm_256_openssl; +extern const srtp_cipher_type_t srtp_aes_gcm_128; +extern const srtp_cipher_type_t srtp_aes_gcm_256; #endif /* @@ -66,16 +66,15 @@ extern const srtp_auth_type_t srtp_hmac; extern srtp_debug_module_t srtp_mod_auth; extern srtp_debug_module_t srtp_mod_cipher; -extern srtp_debug_module_t srtp_mod_stat; extern srtp_debug_module_t srtp_mod_alloc; /* debug modules for cipher types */ extern srtp_debug_module_t srtp_mod_aes_icm; -#ifdef OPENSSL + +#if defined(OPENSSL) || defined(MBEDTLS) || defined(NSS) extern srtp_debug_module_t srtp_mod_aes_gcm; #endif /* debug modules for auth types */ extern srtp_debug_module_t srtp_mod_hmac; - #endif diff --git a/libs/srtp/crypto/include/datatypes.h b/libs/srtp/crypto/include/datatypes.h index 182cca25b9..5164cf0021 100644 --- a/libs/srtp/crypto/include/datatypes.h +++ b/libs/srtp/crypto/include/datatypes.h @@ -66,27 +66,6 @@ extern "C" { #endif -/* if DATATYPES_USE_MACROS is defined, then little functions are macros */ -#define DATATYPES_USE_MACROS - -typedef union { - uint8_t v8[2]; - uint16_t value; -} v16_t; - -typedef union { - uint8_t v8[4]; - uint16_t v16[2]; - uint32_t value; -} v32_t; - -typedef union { - uint8_t v8[8]; - uint16_t v16[4]; - uint32_t v32[2]; - uint64_t value; -} v64_t; - typedef union { uint8_t v8[16]; uint16_t v16[8]; @@ -94,26 +73,6 @@ typedef union { uint64_t v64[2]; } v128_t; -typedef union { - uint8_t v8[32]; - uint16_t v16[16]; - uint32_t v32[8]; - uint64_t v64[4]; -} v256_t; - -/* some useful and simple math functions */ - -#define pow_2(X) ((unsigned int)1 << (X)) /* 2^X */ - -#define pow_minus_one(X) ((X) ? -1 : 1) /* (-1)^X */ - -/* - * octet_get_weight(x) returns the hamming weight (number of bits equal to - * one) in the octet x - */ - -int octet_get_weight(uint8_t octet); - #define MAX_PRINT_STRING_LEN 1024 char *srtp_octet_string_hex_string(const void *str, int length); @@ -126,56 +85,31 @@ void v128_copy_octet_string(v128_t *x, const uint8_t s[16]); void v128_left_shift(v128_t *x, int shift_index); -void v128_right_shift(v128_t *x, int shift_index); - /* * 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 _v128_set_to_zero(x) \ +#define v128_set_to_zero(x) \ ((x)->v32[0] = 0, (x)->v32[1] = 0, (x)->v32[2] = 0, (x)->v32[3] = 0) -#define _v128_copy(x, y) \ +#define v128_copy(x, y) \ ((x)->v32[0] = (y)->v32[0], (x)->v32[1] = (y)->v32[1], \ (x)->v32[2] = (y)->v32[2], (x)->v32[3] = (y)->v32[3]) -#define _v128_xor(z, x, y) \ +#define 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 _v128_and(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 _v128_or(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 _v128_complement(x) \ - ((x)->v32[0] = ~(x)->v32[0], (x)->v32[1] = ~(x)->v32[1], \ - (x)->v32[2] = ~(x)->v32[2], (x)->v32[3] = ~(x)->v32[3]) - /* ok for NO_64BIT_MATH if it can compare uint64_t's (even as structures) */ -#define _v128_is_eq(x, y) \ - (((x)->v64[0] == (y)->v64[0]) && ((x)->v64[1] == (y)->v64[1])) - #ifdef NO_64BIT_MATH -#define _v128_xor_eq(z, x) \ +#define v128_xor_eq(z, x) \ ((z)->v32[0] ^= (x)->v32[0], (z)->v32[1] ^= (x)->v32[1], \ (z)->v32[2] ^= (x)->v32[2], (z)->v32[3] ^= (x)->v32[3]) #else -#define _v128_xor_eq(z, x) \ +#define v128_xor_eq(z, x) \ ((z)->v64[0] ^= (x)->v64[0], (z)->v64[1] ^= (x)->v64[1]) #endif @@ -188,66 +122,22 @@ void v128_right_shift(v128_t *x, int shift_index); really care which bit is which. AES does care which bit is which, but doesn't use the 128-bit get/set or 128-bit shifts */ -#define _v128_get_bit(x, bit) (((((x)->v32[(bit) >> 5]) >> ((bit)&31)) & 1)) +#define v128_get_bit(x, bit) (((((x)->v32[(bit) >> 5]) >> ((bit)&31)) & 1)) -#define _v128_set_bit(x, bit) \ +#define v128_set_bit(x, bit) \ ((((x)->v32[(bit) >> 5]) |= ((uint32_t)1 << ((bit)&31)))) -#define _v128_clear_bit(x, bit) \ +#define v128_clear_bit(x, bit) \ ((((x)->v32[(bit) >> 5]) &= ~((uint32_t)1 << ((bit)&31)))) -#define _v128_set_bit_to(x, bit, value) \ - ((value) ? _v128_set_bit(x, bit) : _v128_clear_bit(x, bit)) - -#ifdef DATATYPES_USE_MACROS /* little functions are really macros */ - -#define v128_set_to_zero(z) _v128_set_to_zero(z) -#define v128_copy(z, x) _v128_copy(z, x) -#define v128_xor(z, x, y) _v128_xor(z, x, y) -#define v128_and(z, x, y) _v128_and(z, x, y) -#define v128_or(z, x, y) _v128_or(z, x, y) -#define v128_complement(x) _v128_complement(x) -#define v128_is_eq(x, y) _v128_is_eq(x, y) -#define v128_xor_eq(x, y) _v128_xor_eq(x, y) -#define v128_get_bit(x, i) _v128_get_bit(x, i) -#define v128_set_bit(x, i) _v128_set_bit(x, i) -#define v128_clear_bit(x, i) _v128_clear_bit(x, i) -#define v128_set_bit_to(x, i, y) _v128_set_bit_to(x, i, y) - -#else - -void v128_set_to_zero(v128_t *x); - -int v128_is_eq(const v128_t *x, const v128_t *y); - -void v128_copy(v128_t *x, const v128_t *y); - -void v128_xor(v128_t *z, v128_t *x, v128_t *y); - -void v128_and(v128_t *z, v128_t *x, v128_t *y); - -void v128_or(v128_t *z, v128_t *x, v128_t *y); - -void v128_complement(v128_t *x); - -int v128_get_bit(const v128_t *x, int i); - -void v128_set_bit(v128_t *x, int i); - -void v128_clear_bit(v128_t *x, int i); - -void v128_set_bit_to(v128_t *x, int i, int y); - -#endif /* DATATYPES_USE_MACROS */ - /* - * octet_string_is_eq(a, b, len) returns 1 if the length len strings a - * and b are not equal. It returns 0 otherwise. The running time of the + * srtp_octet_string_is_eq(a, b, len) returns 1 if the length len strings + * a and b are not equal. It returns 0 otherwise. The running time of the * comparison depends only on len, making this safe to use for (e.g.) * verifying authentication tags. */ -int octet_string_is_eq(uint8_t *a, uint8_t *b, int len); +int srtp_octet_string_is_eq(uint8_t *a, uint8_t *b, int len); /* * A portable way to zero out memory as recommended by @@ -278,7 +168,7 @@ void octet_string_set_to_zero(void *s, size_t len); #define be64_to_cpu(x) bswap_64((x)) #else /* WORDS_BIGENDIAN */ -#if defined(__GNUC__) && defined(HAVE_X86) +#if defined(__GNUC__) && (defined(HAVE_X86) || defined(__x86_64__)) /* Fall back. */ static inline uint32_t be32_to_cpu(uint32_t v) { @@ -331,35 +221,13 @@ typedef struct { uint32_t *word; } bitvector_t; -#define _bitvector_get_bit(v, bit_index) \ +#define bitvector_get_bit(v, bit_index) \ (((((v)->word[((bit_index) >> 5)]) >> ((bit_index)&31)) & 1)) -#define _bitvector_set_bit(v, bit_index) \ +#define bitvector_set_bit(v, bit_index) \ ((((v)->word[((bit_index) >> 5)] |= ((uint32_t)1 << ((bit_index)&31))))) -#define _bitvector_clear_bit(v, bit_index) \ - ((((v)->word[((bit_index) >> 5)] &= ~((uint32_t)1 << ((bit_index)&31))))) - -#define _bitvector_get_length(v) (((v)->length)) - -#ifdef DATATYPES_USE_MACROS /* little functions are really macros */ - -#define bitvector_get_bit(v, bit_index) _bitvector_get_bit(v, bit_index) -#define bitvector_set_bit(v, bit_index) _bitvector_set_bit(v, bit_index) -#define bitvector_clear_bit(v, bit_index) _bitvector_clear_bit(v, bit_index) -#define bitvector_get_length(v) _bitvector_get_length(v) - -#else - -int bitvector_get_bit(const bitvector_t *v, int bit_index); - -void bitvector_set_bit(bitvector_t *v, int bit_index); - -void bitvector_clear_bit(bitvector_t *v, int bit_index); - -unsigned long bitvector_get_length(const bitvector_t *v); - -#endif +#define bitvector_get_length(v) (((v)->length)) int bitvector_alloc(bitvector_t *v, unsigned long length); @@ -369,8 +237,6 @@ void bitvector_set_to_zero(bitvector_t *x); void bitvector_left_shift(bitvector_t *x, int index); -char *bitvector_bit_string(bitvector_t *x, char *buf, int len); - #ifdef __cplusplus } #endif diff --git a/libs/srtp/crypto/include/err.h b/libs/srtp/crypto/include/err.h index 66a1023ec8..326f5e96b7 100644 --- a/libs/srtp/crypto/include/err.h +++ b/libs/srtp/crypto/include/err.h @@ -109,6 +109,8 @@ typedef struct { #ifdef ENABLE_DEBUG_LOGGING +#define debug_print0(mod, format) \ + srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name) #define debug_print(mod, format, arg) \ srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, arg) #define debug_print2(mod, format, arg1, arg2) \ @@ -117,6 +119,9 @@ typedef struct { #else +#define debug_print0(mod, format) \ + if (mod.on) \ + srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name) #define debug_print(mod, format, arg) \ if (mod.on) \ srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, arg) diff --git a/libs/srtp/crypto/include/key.h b/libs/srtp/crypto/include/key.h index 3498114b05..4164722c7c 100644 --- a/libs/srtp/crypto/include/key.h +++ b/libs/srtp/crypto/include/key.h @@ -66,8 +66,6 @@ srtp_err_status_t srtp_key_limit_set(srtp_key_limit_t key, srtp_err_status_t srtp_key_limit_clone(srtp_key_limit_t original, srtp_key_limit_t *new_key); -srtp_err_status_t srtp_key_limit_check(const srtp_key_limit_t key); - srtp_key_event_t srtp_key_limit_update(srtp_key_limit_t key); typedef enum { diff --git a/libs/srtp/crypto/include/null_auth.h b/libs/srtp/crypto/include/null_auth.h index 490dd7bc0f..0e57d67061 100644 --- a/libs/srtp/crypto/include/null_auth.h +++ b/libs/srtp/crypto/include/null_auth.h @@ -55,17 +55,6 @@ typedef struct { char foo; } srtp_null_auth_ctx_t; -#if 0 -srtp_err_status_t srtp_null_auth_alloc(srtp_auth_t **a, int key_len, int out_len); - -srtp_err_status_t srtp_null_auth_dealloc(srtp_auth_t *a); - -srtp_err_status_t srtp_null_auth_init(srtp_null_auth_ctx_t *state, const uint8_t *key, int key_len); - -srtp_err_status_t srtp_null_auth_compute(srtp_null_auth_ctx_t *state, uint8_t *message, int msg_octets, int tag_len, uint8_t *result); - -#endif - #ifdef __cplusplus } #endif diff --git a/libs/srtp/crypto/include/rdb.h b/libs/srtp/crypto/include/rdb.h index 98314c1f3e..208dff3ff1 100644 --- a/libs/srtp/crypto/include/rdb.h +++ b/libs/srtp/crypto/include/rdb.h @@ -64,8 +64,6 @@ typedef struct { v128_t bitmask; } srtp_rdb_t; -#define rdb_bits_in_bitmask (8 * sizeof(v128_t)) - /* * srtp_rdb_init * diff --git a/libs/srtp/crypto/include/sha1.h b/libs/srtp/crypto/include/sha1.h index 933c1466a3..c9bf592dff 100644 --- a/libs/srtp/crypto/include/sha1.h +++ b/libs/srtp/crypto/include/sha1.h @@ -52,88 +52,12 @@ #endif #include "err.h" -#ifdef OPENSSL -#include -#include -#else #include "datatypes.h" -#endif #ifdef __cplusplus extern "C" { #endif -#ifdef OPENSSL - -/* - * srtp_sha1_init(&ctx) initializes the SHA1 context ctx - * - * srtp_sha1_update(&ctx, msg, len) hashes the len octets starting at msg - * into the SHA1 context - * - * srtp_sha1_final(&ctx, output) performs the final processing of the SHA1 - * context and writes the result to the 20 octets at output - * - * Return values are ignored on the EVP functions since all three - * of these functions return void. - * - */ - -/* OpenSSL 1.1.0 made EVP_MD_CTX an opaque structure, which must be allocated - using EVP_MD_CTX_new. But this function doesn't exist in OpenSSL 1.0.x. */ -#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER - -typedef EVP_MD_CTX srtp_sha1_ctx_t; - -static inline void srtp_sha1_init(srtp_sha1_ctx_t *ctx) -{ - EVP_MD_CTX_init(ctx); - EVP_DigestInit(ctx, EVP_sha1()); -} - -static inline void srtp_sha1_update(srtp_sha1_ctx_t *ctx, - const uint8_t *M, - int octets_in_msg) -{ - EVP_DigestUpdate(ctx, M, octets_in_msg); -} - -static inline void srtp_sha1_final(srtp_sha1_ctx_t *ctx, uint32_t *output) -{ - unsigned int len = 0; - - EVP_DigestFinal(ctx, (unsigned char *)output, &len); - EVP_MD_CTX_cleanup(ctx); -} - -#else - -typedef EVP_MD_CTX *srtp_sha1_ctx_t; - -static inline void srtp_sha1_init(srtp_sha1_ctx_t *ctx) -{ - *ctx = EVP_MD_CTX_new(); - EVP_DigestInit(*ctx, EVP_sha1()); -} - -static inline void srtp_sha1_update(srtp_sha1_ctx_t *ctx, - const uint8_t *M, - int octets_in_msg) -{ - EVP_DigestUpdate(*ctx, M, octets_in_msg); -} - -static inline void srtp_sha1_final(srtp_sha1_ctx_t *ctx, uint32_t *output) -{ - unsigned int len = 0; - - EVP_DigestFinal(*ctx, (unsigned char *)output, &len); - EVP_MD_CTX_free(*ctx); -} -#endif - -#else - typedef struct { uint32_t H[5]; /* state vector */ uint32_t M[16]; /* message buffer */ @@ -159,24 +83,6 @@ void srtp_sha1_update(srtp_sha1_ctx_t *ctx, void srtp_sha1_final(srtp_sha1_ctx_t *ctx, uint32_t output[5]); -/* - * The srtp_sha1_core function is INTERNAL to SHA-1, but it is declared - * here because it is also used by the cipher SEAL 3.0 in its key - * setup algorithm. - */ - -/* - * srtp_sha1_core(M, H) computes the core sha1 compression function, where M is - * the next part of the message and H is the intermediate state {H0, - * H1, ...} - * - * this function does not do any of the padding required in the - * complete sha1 function - */ -void srtp_sha1_core(const uint32_t M[16], uint32_t hash_value[5]); - -#endif /* else OPENSSL */ - #ifdef __cplusplus } #endif diff --git a/libs/srtp/crypto/kernel/alloc.c b/libs/srtp/crypto/kernel/alloc.c index dbe58266f4..3ebc315259 100644 --- a/libs/srtp/crypto/kernel/alloc.c +++ b/libs/srtp/crypto/kernel/alloc.c @@ -80,7 +80,7 @@ void *srtp_crypto_alloc(size_t size) if (ptr) { debug_print(srtp_mod_alloc, "(location: %p) allocated", ptr); } else { - debug_print(srtp_mod_alloc, "allocation failed (asked for %d bytes)\n", + debug_print(srtp_mod_alloc, "allocation failed (asked for %zu bytes)\n", size); } diff --git a/libs/srtp/crypto/kernel/crypto_kernel.c b/libs/srtp/crypto/kernel/crypto_kernel.c index ab4492e8a6..764e7ecfa0 100644 --- a/libs/srtp/crypto/kernel/crypto_kernel.c +++ b/libs/srtp/crypto/kernel/crypto_kernel.c @@ -101,10 +101,6 @@ srtp_err_status_t srtp_crypto_kernel_init() if (status) { return status; } - status = srtp_crypto_kernel_load_debug_module(&srtp_mod_stat); - if (status) { - return status; - } status = srtp_crypto_kernel_load_debug_module(&srtp_mod_alloc); if (status) { return status; @@ -130,18 +126,18 @@ srtp_err_status_t srtp_crypto_kernel_init() if (status) { return status; } -#ifdef OPENSSL +#ifdef GCM status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_icm_192, SRTP_AES_ICM_192); if (status) { return status; } - status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_gcm_128_openssl, + status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_gcm_128, SRTP_AES_GCM_128); if (status) { return status; } - status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_gcm_256_openssl, + status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_gcm_256, SRTP_AES_GCM_256); if (status) { return status; @@ -277,7 +273,8 @@ static inline srtp_err_status_t srtp_crypto_kernel_do_load_cipher_type( srtp_cipher_type_id_t id, int replace) { - srtp_kernel_cipher_type_t *ctype, *new_ctype; + srtp_kernel_cipher_type_t *ctype; + srtp_kernel_cipher_type_t *new_ctype = NULL; srtp_err_status_t status; /* defensive coding */ @@ -354,7 +351,8 @@ srtp_err_status_t srtp_crypto_kernel_do_load_auth_type( srtp_auth_type_id_t id, int replace) { - srtp_kernel_auth_type_t *atype, *new_atype; + srtp_kernel_auth_type_t *atype; + srtp_kernel_auth_type_t *new_atype = NULL; srtp_err_status_t status; /* defensive coding */ diff --git a/libs/srtp/crypto/kernel/err.c b/libs/srtp/crypto/kernel/err.c index f443549e5a..9db5bfb432 100644 --- a/libs/srtp/crypto/kernel/err.c +++ b/libs/srtp/crypto/kernel/err.c @@ -80,6 +80,7 @@ srtp_err_status_t srtp_install_err_report_handler( void srtp_err_report(srtp_err_reporting_level_t level, const char *format, ...) { + char msg[512]; va_list args; if (srtp_err_file != NULL) { va_start(args, format); @@ -88,7 +89,6 @@ void srtp_err_report(srtp_err_reporting_level_t level, const char *format, ...) } if (srtp_err_report_handler != NULL) { va_start(args, format); - char msg[512]; if (vsnprintf(msg, sizeof(msg), format, args) > 0) { /* strip trailing \n, callback should not have one */ size_t l = strlen(msg); diff --git a/libs/srtp/crypto/kernel/key.c b/libs/srtp/crypto/kernel/key.c index 0466195046..5e6a188726 100644 --- a/libs/srtp/crypto/kernel/key.c +++ b/libs/srtp/crypto/kernel/key.c @@ -77,14 +77,6 @@ srtp_err_status_t srtp_key_limit_clone(srtp_key_limit_t original, return srtp_err_status_ok; } -srtp_err_status_t srtp_key_limit_check(const srtp_key_limit_t key) -{ - if (key->state == srtp_key_state_expired) { - return srtp_err_status_key_expired; - } - return srtp_err_status_ok; -} - srtp_key_event_t srtp_key_limit_update(srtp_key_limit_t key) { #ifdef NO_64BIT_MATH diff --git a/libs/srtp/crypto/math/datatypes.c b/libs/srtp/crypto/math/datatypes.c index c0dfece659..0eb9d919b5 100644 --- a/libs/srtp/crypto/math/datatypes.c +++ b/libs/srtp/crypto/math/datatypes.c @@ -53,33 +53,14 @@ #include "datatypes.h" -static const int8_t octet_weight[256] = { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, - 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, - 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, - 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, - 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, - 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 -}; - -int octet_get_weight(uint8_t octet) -{ - return (int)octet_weight[octet]; -} - /* * bit_string is a buffer that is used to hold output strings, e.g. * for printing. */ /* the value MAX_PRINT_STRING_LEN is defined in datatypes.h */ - -char bit_string[MAX_PRINT_STRING_LEN]; +/* include space for null terminator */ +static char bit_string[MAX_PRINT_STRING_LEN + 1]; uint8_t srtp_nibble_to_hex_char(uint8_t nibble) { @@ -172,104 +153,6 @@ void v128_copy_octet_string(v128_t *x, const uint8_t s[16]) #endif } -#ifndef DATATYPES_USE_MACROS /* little functions are not macros */ - -void v128_set_to_zero(v128_t *x) -{ - _v128_set_to_zero(x); -} - -void v128_copy(v128_t *x, const v128_t *y) -{ - _v128_copy(x, y); -} - -void v128_xor(v128_t *z, v128_t *x, v128_t *y) -{ - _v128_xor(z, x, y); -} - -void v128_and(v128_t *z, v128_t *x, v128_t *y) -{ - _v128_and(z, x, y); -} - -void v128_or(v128_t *z, v128_t *x, v128_t *y) -{ - _v128_or(z, x, y); -} - -void v128_complement(v128_t *x) -{ - _v128_complement(x); -} - -int v128_is_eq(const v128_t *x, const v128_t *y) -{ - return _v128_is_eq(x, y); -} - -int v128_xor_eq(v128_t *x, const v128_t *y) -{ - return _v128_xor_eq(x, y); -} - -int v128_get_bit(const v128_t *x, int i) -{ - return _v128_get_bit(x, i); -} - -void v128_set_bit(v128_t *x, int i) -{ - _v128_set_bit(x, i); -} - -void v128_clear_bit(v128_t *x, int i) -{ - _v128_clear_bit(x, i); -} - -void v128_set_bit_to(v128_t *x, int i, int y) -{ - _v128_set_bit_to(x, i, y); -} - -#endif /* DATATYPES_USE_MACROS */ - -void v128_right_shift(v128_t *x, int shift) -{ - const int base_index = shift >> 5; - const int bit_index = shift & 31; - int i, from; - uint32_t b; - - if (shift > 127) { - v128_set_to_zero(x); - return; - } - - if (bit_index == 0) { - /* copy each word from left size to right side */ - x->v32[4 - 1] = x->v32[4 - 1 - base_index]; - for (i = 4 - 1; i > base_index; i--) - x->v32[i - 1] = x->v32[i - 1 - base_index]; - - } else { - /* set each word to the "or" of the two bit-shifted words */ - for (i = 4; i > base_index; i--) { - from = i - 1 - base_index; - b = x->v32[from] << bit_index; - if (from > 0) - b |= x->v32[from - 1] >> (32 - bit_index); - x->v32[i - 1] = b; - } - } - - /* now wrap up the final portion */ - for (i = 0; i < base_index; i++) - x->v32[i] = 0; -} - void v128_left_shift(v128_t *x, int shift) { int i; @@ -298,25 +181,6 @@ void v128_left_shift(v128_t *x, int shift) /* functions manipulating bitvector_t */ -#ifndef DATATYPES_USE_MACROS /* little functions are not macros */ - -int bitvector_get_bit(const bitvector_t *v, int bit_index) -{ - return _bitvector_get_bit(v, bit_index); -} - -void bitvector_set_bit(bitvector_t *v, int bit_index) -{ - _bitvector_set_bit(v, bit_index); -} - -void bitvector_clear_bit(bitvector_t *v, int bit_index) -{ - _bitvector_clear_bit(v, bit_index); -} - -#endif /* DATATYPES_USE_MACROS */ - int bitvector_alloc(bitvector_t *v, unsigned long length) { unsigned long l; @@ -361,27 +225,6 @@ void bitvector_set_to_zero(bitvector_t *x) memset(x->word, 0, x->length >> 3); } -char *bitvector_bit_string(bitvector_t *x, char *buf, int len) -{ - int j, i; - uint32_t mask; - - for (j = i = 0; j < (int)(x->length >> 5) && i < len - 1; j++) { - for (mask = 0x80000000; mask > 0; mask >>= 1) { - if (x->word[j] & mask) - buf[i] = '1'; - else - buf[i] = '0'; - ++i; - if (i >= len - 1) - break; - } - } - buf[i] = 0; /* null terminate string */ - - return buf; -} - void bitvector_left_shift(bitvector_t *x, int shift) { int i; @@ -410,7 +253,7 @@ void bitvector_left_shift(bitvector_t *x, int shift) x->word[i] = 0; } -int octet_string_is_eq(uint8_t *a, uint8_t *b, int len) +int srtp_octet_string_is_eq(uint8_t *a, uint8_t *b, int len) { uint8_t *end = b + len; uint8_t accumulator = 0; @@ -436,55 +279,9 @@ void srtp_cleanse(void *s, size_t len) void octet_string_set_to_zero(void *s, size_t len) { -#ifdef OPENSSL +#if defined(OPENSSL) && !defined(OPENSSL_CLEANSE_BROKEN) OPENSSL_cleanse(s, len); #else srtp_cleanse(s, len); #endif } - -#ifdef TESTAPP_SOURCE - -static const char b64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz0123456789+/"; - -static int base64_block_to_octet_triple(char *out, char *in) -{ - unsigned char sextets[4] = { 0 }; - int j = 0; - int i; - - for (i = 0; i < 4; i++) { - char *p = strchr(b64chars, in[i]); - if (p != NULL) - sextets[i] = p - b64chars; - else - j++; - } - - out[0] = (sextets[0] << 2) | (sextets[1] >> 4); - if (j < 2) - out[1] = (sextets[1] << 4) | (sextets[2] >> 2); - if (j < 1) - out[2] = (sextets[2] << 6) | sextets[3]; - return j; -} - -int base64_string_to_octet_string(char *out, int *pad, char *in, int len) -{ - int k = 0; - int i = 0; - int j = 0; - if (len % 4 != 0) - return 0; - - while (i < len && j == 0) { - j = base64_block_to_octet_triple(out + k, in + i); - k += 3; - i += 4; - } - *pad = j; - return i; -} - -#endif diff --git a/libs/srtp/crypto/math/stat.c b/libs/srtp/crypto/math/stat.c deleted file mode 100644 index 6dd332b0cf..0000000000 --- a/libs/srtp/crypto/math/stat.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * stats.c - * - * statistical tests - * - * David A. McGrew - * Cisco Systems, Inc. - */ - -/* - * - * Copyright (c) 2001-2017, Cisco Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * Neither the name of the Cisco Systems, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "stat.h" - -srtp_debug_module_t srtp_mod_stat = { - 0, /* debugging is off by default */ - (char *)"stat test" /* printable module name */ -}; - -/* - * each test assumes that 20,000 bits (2500 octets) of data is - * provided as input - */ - -#define STAT_TEST_DATA_LEN 2500 - -srtp_err_status_t stat_test_monobit(uint8_t *data) -{ - uint8_t *data_end = data + STAT_TEST_DATA_LEN; - uint16_t ones_count; - - ones_count = 0; - while (data < data_end) { - ones_count += octet_get_weight(*data); - data++; - } - - debug_print(srtp_mod_stat, "bit count: %d", ones_count); - - if ((ones_count < 9725) || (ones_count > 10275)) - return srtp_err_status_algo_fail; - - return srtp_err_status_ok; -} - -srtp_err_status_t stat_test_poker(uint8_t *data) -{ - int i; - uint8_t *data_end = data + STAT_TEST_DATA_LEN; - double poker; - uint16_t f[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - while (data < data_end) { - f[*data & 0x0f]++; /* increment freq. count for low nibble */ - f[(*data) >> 4]++; /* increment freq. count for high nibble */ - data++; - } - - poker = 0.0; - for (i = 0; i < 16; i++) - poker += (double)f[i] * f[i]; - - poker *= (16.0 / 5000.0); - poker -= 5000.0; - - debug_print(srtp_mod_stat, "poker test: %f\n", poker); - - if ((poker < 2.16) || (poker > 46.17)) - return srtp_err_status_algo_fail; - - return srtp_err_status_ok; -} - -/* - * runs[i] holds the number of runs of size (i-1) - */ - -srtp_err_status_t stat_test_runs(uint8_t *data) -{ - uint8_t *data_end = data + STAT_TEST_DATA_LEN; - uint16_t runs[6] = { 0, 0, 0, 0, 0, 0 }; - uint16_t gaps[6] = { 0, 0, 0, 0, 0, 0 }; - uint16_t lo_value[6] = { 2315, 1114, 527, 240, 103, 103 }; - uint16_t hi_value[6] = { 2685, 1386, 723, 384, 209, 209 }; - int state = 0; - uint16_t mask; - int i; - - /* - * the state variable holds the number of bits in the - * current run (or gap, if negative) - */ - - while (data < data_end) { - /* loop over the bits of this byte */ - for (mask = 1; mask < 256; mask <<= 1) { - if (*data & mask) { - /* next bit is a one */ - if (state > 0) { - /* prefix is a run, so increment the run-count */ - state++; - - /* check for long runs */ - if (state > 25) { - debug_print(srtp_mod_stat, ">25 runs: %d", state); - return srtp_err_status_algo_fail; - } - - } else if (state < 0) { - /* prefix is a gap */ - if (state < -25) { - debug_print(srtp_mod_stat, ">25 gaps: %d", state); - return srtp_err_status_algo_fail; /* long-runs test - failed */ - } - if (state < -6) { - state = -6; /* group together gaps > 5 */ - } - gaps[-1 - state]++; /* increment gap count */ - state = 1; /* set state at one set bit */ - } else { - /* state is zero; this happens only at initialization */ - state = 1; - } - } else { - /* next bit is a zero */ - if (state > 0) { - /* prefix is a run */ - if (state > 25) { - debug_print(srtp_mod_stat, ">25 runs (2): %d", state); - return srtp_err_status_algo_fail; /* long-runs test - failed */ - } - if (state > 6) { - state = 6; /* group together runs > 5 */ - } - runs[state - 1]++; /* increment run count */ - state = -1; /* set state at one zero bit */ - } else if (state < 0) { - /* prefix is a gap, so increment gap-count (decrement state) - */ - state--; - - /* check for long gaps */ - if (state < -25) { - debug_print(srtp_mod_stat, ">25 gaps (2): %d", state); - return srtp_err_status_algo_fail; - } - - } else { - /* state is zero; this happens only at initialization */ - state = -1; - } - } - } - - /* move along to next octet */ - data++; - } - - if (srtp_mod_stat.on) { - debug_print(srtp_mod_stat, "runs test", NULL); - for (i = 0; i < 6; i++) - debug_print(srtp_mod_stat, " runs[]: %d", runs[i]); - for (i = 0; i < 6; i++) - debug_print(srtp_mod_stat, " gaps[]: %d", gaps[i]); - } - - /* check run and gap counts against the fixed limits */ - for (i = 0; i < 6; i++) - if ((runs[i] < lo_value[i]) || (runs[i] > hi_value[i]) || - (gaps[i] < lo_value[i]) || (gaps[i] > hi_value[i])) - return srtp_err_status_algo_fail; - - return srtp_err_status_ok; -} diff --git a/libs/srtp/crypto/replay/rdb.c b/libs/srtp/crypto/replay/rdb.c index ab1c7b55b6..d8c2b3838e 100644 --- a/libs/srtp/crypto/replay/rdb.c +++ b/libs/srtp/crypto/replay/rdb.c @@ -49,6 +49,8 @@ #include "rdb.h" +#define rdb_bits_in_bitmask (8 * sizeof(v128_t)) + /* * this implementation of a replay database works as follows: * diff --git a/libs/srtp/crypto/test/aes_calc.c b/libs/srtp/crypto/test/aes_calc.c index b362fd57fc..3d0d5cf36b 100644 --- a/libs/srtp/crypto/test/aes_calc.c +++ b/libs/srtp/crypto/test/aes_calc.c @@ -67,7 +67,7 @@ void usage(char *prog_name) { - printf("usage: %s [-v]\n", prog_name); + printf("usage: %s <key> <plaintext> [<ciphertext>] [-v]\n", prog_name); exit(255); } @@ -75,6 +75,8 @@ void usage(char *prog_name) int main(int argc, char *argv[]) { + const char *expected_ciphertext = NULL; + const char *ciphertext = NULL; v128_t data; uint8_t key[AES_MAX_KEY_LEN]; srtp_aes_expanded_key_t exp_key; @@ -82,22 +84,26 @@ int main(int argc, char *argv[]) int verbose = 0; srtp_err_status_t status; - if (argc == 3) { - /* we're not in verbose mode */ - verbose = 0; - } else if (argc == 4) { - if (strncmp(argv[3], "-v", 2) == 0) { - /* we're in verbose mode */ - verbose = 1; - } else { - /* unrecognized flag, complain and exit */ - usage(argv[0]); - } - } else { + /* -v must be last if it's passed */ + if (argc > 0 && strncmp(argv[argc - 1], "-v", 2) == 0) { + /* we're in verbose mode */ + verbose = 1; + --argc; + } + + if (argc < 3 || argc > 4) { /* we've been fed the wrong number of arguments - compain and exit */ usage(argv[0]); } + if (argc == 4) { + /* we're being passed the ciphertext to check (in unit test mode) */ + expected_ciphertext = argv[3]; + if (strlen(expected_ciphertext) != 16 * 2) { + usage(argv[0]); + } + } + /* read in key, checking length */ if (strlen(argv[1]) > AES_MAX_KEY_LEN * 2) { fprintf(stderr, "error: too many digits in key " @@ -151,7 +157,16 @@ int main(int argc, char *argv[]) printf("key:\t\t%s\n", octet_string_hex_string(key, key_len)); printf("ciphertext:\t"); } - printf("%s\n", v128_hex_string(&data)); + + ciphertext = v128_hex_string(&data); + printf("%s\n", ciphertext); + + if (expected_ciphertext && strcmp(ciphertext, expected_ciphertext) != 0) { + fprintf(stderr, "error: calculated ciphertext %s does not match " + "expected ciphertext %s\n", + ciphertext, expected_ciphertext); + exit(1); + } return 0; } diff --git a/libs/srtp/crypto/test/cipher_driver.c b/libs/srtp/crypto/test/cipher_driver.c index e28f5f264f..4fbcd95e39 100644 --- a/libs/srtp/crypto/test/cipher_driver.c +++ b/libs/srtp/crypto/test/cipher_driver.c @@ -47,16 +47,11 @@ #include <config.h> #endif -#include <stdio.h> /* for printf() */ -#include <stdlib.h> /* for rand() */ +#include <stdio.h> /* for printf() */ #include "getopt_s.h" #include "cipher.h" -#ifdef OPENSSL -#include "aes_icm_ossl.h" -#include "aes_gcm_ossl.h" -#else -#include "aes_icm.h" -#endif +#include "cipher_priv.h" +#include "datatypes.h" #define PRINT_DEBUG 0 @@ -118,10 +113,10 @@ void check_status(srtp_err_status_t s) extern srtp_cipher_type_t srtp_null_cipher; extern srtp_cipher_type_t srtp_aes_icm_128; extern srtp_cipher_type_t srtp_aes_icm_256; -#ifdef OPENSSL +#ifdef GCM extern srtp_cipher_type_t srtp_aes_icm_192; -extern srtp_cipher_type_t srtp_aes_gcm_128_openssl; -extern srtp_cipher_type_t srtp_aes_gcm_256_openssl; +extern srtp_cipher_type_t srtp_aes_gcm_128; +extern srtp_cipher_type_t srtp_aes_gcm_256; #endif int main(int argc, char *argv[]) @@ -187,21 +182,19 @@ int main(int argc, char *argv[]) cipher_driver_test_array_throughput( &srtp_aes_icm_256, SRTP_AES_ICM_256_KEY_LEN_WSALT, num_cipher); -#ifdef OPENSSL +#ifdef GCM for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8) cipher_driver_test_array_throughput( &srtp_aes_icm_192, SRTP_AES_ICM_192_KEY_LEN_WSALT, num_cipher); for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8) { - cipher_driver_test_array_throughput(&srtp_aes_gcm_128_openssl, - SRTP_AES_GCM_128_KEY_LEN_WSALT, - num_cipher); + cipher_driver_test_array_throughput( + &srtp_aes_gcm_128, SRTP_AES_GCM_128_KEY_LEN_WSALT, num_cipher); } for (num_cipher = 1; num_cipher < max_num_cipher; num_cipher *= 8) { - cipher_driver_test_array_throughput(&srtp_aes_gcm_256_openssl, - SRTP_AES_GCM_256_KEY_LEN_WSALT, - num_cipher); + cipher_driver_test_array_throughput( + &srtp_aes_gcm_256, SRTP_AES_GCM_256_KEY_LEN_WSALT, num_cipher); } #endif } @@ -210,10 +203,10 @@ int main(int argc, char *argv[]) cipher_driver_self_test(&srtp_null_cipher); cipher_driver_self_test(&srtp_aes_icm_128); cipher_driver_self_test(&srtp_aes_icm_256); -#ifdef OPENSSL +#ifdef GCM cipher_driver_self_test(&srtp_aes_icm_192); - cipher_driver_self_test(&srtp_aes_gcm_128_openssl); - cipher_driver_self_test(&srtp_aes_gcm_256_openssl); + cipher_driver_self_test(&srtp_aes_gcm_128); + cipher_driver_self_test(&srtp_aes_gcm_256); #endif } @@ -277,9 +270,9 @@ int main(int argc, char *argv[]) status = srtp_cipher_dealloc(c); check_status(status); -#ifdef OPENSSL - /* run the throughput test on the aes_gcm_128_openssl cipher */ - status = srtp_cipher_type_alloc(&srtp_aes_gcm_128_openssl, &c, +#ifdef GCM + /* run the throughput test on the aes_gcm_128 cipher */ + status = srtp_cipher_type_alloc(&srtp_aes_gcm_128, &c, SRTP_AES_GCM_128_KEY_LEN_WSALT, 8); if (status) { fprintf(stderr, "error: can't allocate GCM 128 cipher\n"); @@ -291,15 +284,13 @@ int main(int argc, char *argv[]) cipher_driver_test_throughput(c); } - if (do_validation) { - status = cipher_driver_test_buffering(c); - check_status(status); - } + // GCM ciphers don't do buffering; they're "one shot" + status = srtp_cipher_dealloc(c); check_status(status); - /* run the throughput test on the aes_gcm_256_openssl cipher */ - status = srtp_cipher_type_alloc(&srtp_aes_gcm_256_openssl, &c, + /* run the throughput test on the aes_gcm_256 cipher */ + status = srtp_cipher_type_alloc(&srtp_aes_gcm_256, &c, SRTP_AES_GCM_256_KEY_LEN_WSALT, 16); if (status) { fprintf(stderr, "error: can't allocate GCM 256 cipher\n"); @@ -311,10 +302,8 @@ int main(int argc, char *argv[]) cipher_driver_test_throughput(c); } - if (do_validation) { - status = cipher_driver_test_buffering(c); - check_status(status); - } + // GCM ciphers don't do buffering; they're "one shot" + status = srtp_cipher_dealloc(c); check_status(status); #endif @@ -396,7 +385,7 @@ srtp_err_status_t cipher_driver_test_buffering(srtp_cipher_t *c) end = buffer1 + buflen; while (current < end) { /* choose a short length */ - len = rand() & 0x01f; + len = srtp_cipher_rand_u32_for_tests() & 0x01f; /* make sure that len doesn't cause us to overreach the buffer */ if (current + len > end) @@ -479,9 +468,8 @@ srtp_err_status_t cipher_array_alloc_init(srtp_cipher_t ***ca, return status; /* generate random key and initialize cipher */ - for (j = 0; j < klen; j++) - key[j] = (uint8_t)rand(); - for (; j < klen_pad; j++) + srtp_cipher_rand_for_tests(key, klen); + for (j = klen; j < klen_pad; j++) key[j] = 0; status = srtp_cipher_init(*cipher_array, key); if (status) @@ -535,7 +523,7 @@ uint64_t cipher_array_bits_per_second(srtp_cipher_t *cipher_array[], v128_t nonce; clock_t timer; unsigned char *enc_buf; - int cipher_index = rand() % num_cipher; + int cipher_index = srtp_cipher_rand_u32_for_tests() % num_cipher; /* Over-alloc, for NIST CBC padding */ enc_buf = srtp_crypto_alloc(octets_in_buffer + 17); diff --git a/libs/srtp/crypto/test/datatypes_driver.c b/libs/srtp/crypto/test/datatypes_driver.c index 2f78903eb8..db1be7f668 100644 --- a/libs/srtp/crypto/test/datatypes_driver.c +++ b/libs/srtp/crypto/test/datatypes_driver.c @@ -60,6 +60,8 @@ void print_string(char *s); void test_bswap(void); +void test_set_to_zero(void); + int main(void) { /* @@ -98,13 +100,6 @@ int main(void) } printf("%s\n", v128_bit_string(&x)); - printf("----------------------------------------------\n"); - v128_set_to_zero(&x); - v128_set_bit(&x, 0); - for (i = 0; i < 128; i++) { - printf("%s\n", v128_bit_string(&x)); - v128_right_shift(&x, 1); - } printf("----------------------------------------------\n"); v128_set_to_zero(&x); v128_set_bit(&x, 127); @@ -135,6 +130,7 @@ int main(void) printf(" } \n"); test_bswap(); + test_set_to_zero(); return 0; } @@ -145,33 +141,6 @@ void byte_order(void) { int i; v128_t e; -#if 0 - v16_t b; - v32_t c; - v64_t d; - - for (i=0; i < sizeof(b); i++) - b.octet[i] = i; - for (i=0; i < sizeof(c); i++) - c.octet[i] = i; - for (i=0; i < sizeof(d); i++) - d.octet[i] = i; - - printf("v128_t:\t%s\n", v128_hex_string(&e)); - printf("v64_t:\t%s\n", v64_hex_string(&d)); - printf("v32_t:\t%s\n", v32_hex_string(c)); - printf("v16_t:\t%s\n", v16_hex_string(b)); - - c.value = 0x01020304; - printf("v32_t:\t%s\n", v32_hex_string(c)); - b.value = 0x0102; - printf("v16_t:\t%s\n", v16_hex_string(b)); - - printf("uint16_t ordering:\n"); - - c.value = 0x00010002; - printf("v32_t:\t%x%x\n", c.v16[0], c.v16[1]); -#endif printf("byte ordering of crypto/math datatypes:\n"); for (i = 0; i < sizeof(e); i++) @@ -228,3 +197,26 @@ void test_bswap(void) printf("bswapped octet string: %s\n", octet_string_hex_string((uint8_t *)&y, 8)); } + +void test_set_to_zero(void) +{ +#define BUFFER_SIZE (16) + uint8_t buffer[BUFFER_SIZE]; + size_t i; + + for (i = 0; i < BUFFER_SIZE; i++) { + buffer[i] = i & 0xff; + } + printf("Buffer before: %s\n", octet_string_hex_string(buffer, BUFFER_SIZE)); + octet_string_set_to_zero(buffer, BUFFER_SIZE); + printf("Buffer after: %s\n", octet_string_hex_string(buffer, BUFFER_SIZE)); + for (i = 0; i < BUFFER_SIZE; i++) { + if (buffer[i]) { + fprintf(stderr, + "Buffer contents not zero at position %zu (is %d)\n", i, + buffer[i]); + abort(); + } + } +#undef BUFFER_SIZE +} diff --git a/libs/srtp/crypto/test/kernel_driver.c b/libs/srtp/crypto/test/kernel_driver.c index d29405a971..929a2470af 100644 --- a/libs/srtp/crypto/test/kernel_driver.c +++ b/libs/srtp/crypto/test/kernel_driver.c @@ -113,15 +113,3 @@ int main(int argc, char *argv[]) return 0; } - -/* - * crypto_kernel_cipher_test() is a test of the cipher interface - * of the crypto_kernel - */ - -srtp_err_status_t crypto_kernel_cipher_test(void) -{ - /* not implemented yet! */ - - return srtp_err_status_ok; -} diff --git a/libs/srtp/crypto/test/meson.build b/libs/srtp/crypto/test/meson.build new file mode 100644 index 0000000000..533431c54e --- /dev/null +++ b/libs/srtp/crypto/test/meson.build @@ -0,0 +1,41 @@ +# crypto test suite + +test_apps = [ + 'cipher_driver', + 'datatypes_driver', + 'kernel_driver', + 'env', +] + +if not use_openssl and not use_nss + test_apps += ['sha1_driver'] +endif + +foreach test_name : test_apps + test_exe = executable(test_name, + '@0@.c'.format(test_name), '../../test/getopt_s.c', '../../test/util.c', + include_directories: [config_incs, crypto_incs, srtp2_incs, test_incs], + dependencies: [srtp2_deps, syslibs], + link_with: libsrtp2_for_tests) + test(test_name, test_exe, args: ['-v']) +endforeach + +if not use_openssl and not use_nss + test_exe = executable('aes_calc', + 'aes_calc.c', '../../test/getopt_s.c', '../../test/util.c', + include_directories: [config_incs, crypto_incs, srtp2_incs, test_incs], + dependencies: [srtp2_deps, syslibs], + link_with: libsrtp2_for_tests) + + # data values used to test the aes_calc application for AES-128 + k128 = '000102030405060708090a0b0c0d0e0f' + p128 = '00112233445566778899aabbccddeeff' + c128 = '69c4e0d86a7b0430d8cdb78070b4c55a' + test('aes_calc_128', test_exe, args: [k128, p128, c128]) + + # data values used to test the aes_calc application for AES-256 + k256 = '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f' + p256 = '00112233445566778899aabbccddeeff' + c256 = '8ea2b7ca516745bfeafc49904b496089' + test('aes_calc_256', test_exe, args: [k256, p256, c256]) +endif diff --git a/libs/srtp/crypto/test/stat_driver.c b/libs/srtp/crypto/test/stat_driver.c deleted file mode 100644 index 4149447f74..0000000000 --- a/libs/srtp/crypto/test/stat_driver.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * stat-driver.c - * - * test driver for the stat_test functions - * - * David A. McGrew - * Cisco Systems, Inc. - */ - -/* - * - * Copyright (c) 2001-2017, Cisco Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * Neither the name of the Cisco Systems, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> /* for printf() */ - -#include "err.h" -#include "stat.h" -#include "srtp.h" - -#include "cipher.h" - -typedef struct { - void *state; -} random_source_t; - -srtp_err_status_t random_source_alloc(void); - -void err_check(srtp_err_status_t s) -{ - if (s) { - printf("error (code %d)\n", s); - exit(1); - } -} - -int main(int argc, char *argv[]) -{ - uint8_t buffer[2532]; - unsigned int buf_len = 2500; - int i, j; - extern srtp_cipher_type_t srtp_aes_icm_128; - extern srtp_cipher_type_t srtp_aes_icm_256; -#ifdef OPENSSL - extern srtp_cipher_type_t srtp_aes_gcm_128_openssl; - extern srtp_cipher_type_t srtp_aes_gcm_256_openssl; -#endif - srtp_cipher_t *c; - /* clang-format off */ - uint8_t key[46] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 - }; - /* clang-format on */ - v128_t nonce; - int num_trials = 500; - int num_fail; - - printf("statistical tests driver\n"); - - v128_set_to_zero(&nonce); - for (i = 0; i < 2500; i++) - buffer[i] = 0; - - /* run tests */ - printf("running stat_tests on all-null buffer, expecting failure\n"); - printf("monobit %d\n", stat_test_monobit(buffer)); - printf("poker %d\n", stat_test_poker(buffer)); - printf("runs %d\n", stat_test_runs(buffer)); - - for (i = 0; i < 2500; i++) - buffer[i] = rand(); - printf("running stat_tests on rand(), expecting success\n"); - printf("monobit %d\n", stat_test_monobit(buffer)); - printf("poker %d\n", stat_test_poker(buffer)); - printf("runs %d\n", stat_test_runs(buffer)); - - printf("running stat_tests on AES-128-ICM, expecting success\n"); - /* set buffer to cipher output */ - for (i = 0; i < 2500; i++) - buffer[i] = 0; - err_check(srtp_cipher_type_alloc(&srtp_aes_icm_128, &c, - SRTP_AES_ICM_128_KEY_LEN_WSALT, 0)); - err_check(srtp_cipher_init(c, key)); - err_check(srtp_cipher_set_iv(c, (uint8_t *)&nonce, srtp_direction_encrypt)); - err_check(srtp_cipher_encrypt(c, buffer, &buf_len)); - /* run tests on cipher outout */ - printf("monobit %d\n", stat_test_monobit(buffer)); - printf("poker %d\n", stat_test_poker(buffer)); - printf("runs %d\n", stat_test_runs(buffer)); - - printf("runs test (please be patient): "); - fflush(stdout); - num_fail = 0; - v128_set_to_zero(&nonce); - for (j = 0; j < num_trials; j++) { - for (i = 0; i < 2500; i++) - buffer[i] = 0; - nonce.v32[3] = i; - err_check( - srtp_cipher_set_iv(c, (uint8_t *)&nonce, srtp_direction_encrypt)); - err_check(srtp_cipher_encrypt(c, buffer, &buf_len)); - if (stat_test_runs(buffer)) { - num_fail++; - } - } - - printf("%d failures in %d tests\n", num_fail, num_trials); - printf("(nota bene: a small fraction of stat_test failures does not \n" - "indicate that the random source is invalid)\n"); - - err_check(srtp_cipher_dealloc(c)); - - printf("running stat_tests on AES-256-ICM, expecting success\n"); - /* set buffer to cipher output */ - for (i = 0; i < 2500; i++) - buffer[i] = 0; - err_check(srtp_cipher_type_alloc(&srtp_aes_icm_256, &c, - SRTP_AES_ICM_256_KEY_LEN_WSALT, 0)); - err_check(srtp_cipher_init(c, key)); - err_check(srtp_cipher_set_iv(c, (uint8_t *)&nonce, srtp_direction_encrypt)); - err_check(srtp_cipher_encrypt(c, buffer, &buf_len)); - /* run tests on cipher outout */ - printf("monobit %d\n", stat_test_monobit(buffer)); - printf("poker %d\n", stat_test_poker(buffer)); - printf("runs %d\n", stat_test_runs(buffer)); - - printf("runs test (please be patient): "); - fflush(stdout); - num_fail = 0; - v128_set_to_zero(&nonce); - for (j = 0; j < num_trials; j++) { - for (i = 0; i < 2500; i++) - buffer[i] = 0; - nonce.v32[3] = i; - err_check( - srtp_cipher_set_iv(c, (uint8_t *)&nonce, srtp_direction_encrypt)); - err_check(srtp_cipher_encrypt(c, buffer, &buf_len)); - if (stat_test_runs(buffer)) { - num_fail++; - } - } - -#ifdef OPENSSL - { - printf("running stat_tests on AES-128-GCM, expecting success\n"); - /* set buffer to cipher output */ - for (i = 0; i < 2500; i++) { - buffer[i] = 0; - } - err_check(srtp_cipher_type_alloc(&srtp_aes_gcm_128_openssl, &c, - SRTP_AES_GCM_128_KEY_LEN_WSALT, 8)); - err_check(srtp_cipher_init(c, key)); - err_check( - srtp_cipher_set_iv(c, (uint8_t *)&nonce, srtp_direction_encrypt)); - err_check(srtp_cipher_encrypt(c, buffer, &buf_len)); - /* run tests on cipher outout */ - printf("monobit %d\n", stat_test_monobit(buffer)); - printf("poker %d\n", stat_test_poker(buffer)); - printf("runs %d\n", stat_test_runs(buffer)); - fflush(stdout); - num_fail = 0; - v128_set_to_zero(&nonce); - for (j = 0; j < num_trials; j++) { - for (i = 0; i < 2500; i++) { - buffer[i] = 0; - } - nonce.v32[3] = i; - err_check(srtp_cipher_set_iv(c, (uint8_t *)&nonce, - srtp_direction_encrypt)); - err_check(srtp_cipher_encrypt(c, buffer, &buf_len)); - buf_len = 2500; - if (stat_test_runs(buffer)) { - num_fail++; - } - } - - printf("running stat_tests on AES-256-GCM, expecting success\n"); - /* set buffer to cipher output */ - for (i = 0; i < 2500; i++) { - buffer[i] = 0; - } - err_check(srtp_cipher_type_alloc(&srtp_aes_gcm_256_openssl, &c, - SRTP_AES_GCM_256_KEY_LEN_WSALT, 16)); - err_check(srtp_cipher_init(c, key)); - err_check( - srtp_cipher_set_iv(c, (uint8_t *)&nonce, srtp_direction_encrypt)); - err_check(srtp_cipher_encrypt(c, buffer, &buf_len)); - /* run tests on cipher outout */ - printf("monobit %d\n", stat_test_monobit(buffer)); - printf("poker %d\n", stat_test_poker(buffer)); - printf("runs %d\n", stat_test_runs(buffer)); - fflush(stdout); - num_fail = 0; - v128_set_to_zero(&nonce); - for (j = 0; j < num_trials; j++) { - for (i = 0; i < 2500; i++) { - buffer[i] = 0; - } - nonce.v32[3] = i; - err_check(srtp_cipher_set_iv(c, (uint8_t *)&nonce, - srtp_direction_encrypt)); - err_check(srtp_cipher_encrypt(c, buffer, &buf_len)); - buf_len = 2500; - if (stat_test_runs(buffer)) { - num_fail++; - } - } - } -#endif - - printf("%d failures in %d tests\n", num_fail, num_trials); - printf("(nota bene: a small fraction of stat_test failures does not \n" - "indicate that the random source is invalid)\n"); - - err_check(srtp_cipher_dealloc(c)); - - return 0; -} diff --git a/libs/srtp/doc/Doxyfile.in b/libs/srtp/doc/Doxyfile.in index 129a03d6db..69c6ef680e 100644 --- a/libs/srtp/doc/Doxyfile.in +++ b/libs/srtp/doc/Doxyfile.in @@ -38,7 +38,7 @@ PROJECT_NAME = libSRTP # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = LIBSRTPVERSIONNUMBER +PROJECT_NUMBER = @LIBSRTPVERSIONNUMBER@ # 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 diff --git a/libs/srtp/doc/Makefile.in b/libs/srtp/doc/Makefile.in index 830ccbbbda..523174ab42 100644 --- a/libs/srtp/doc/Makefile.in +++ b/libs/srtp/doc/Makefile.in @@ -21,7 +21,7 @@ libsrtpdoc: @if test ! -e Doxyfile.in; then \ echo "*** Sorry, can't build doc outside source dir"; exit 1; \ fi - sed 's/LIBSRTPVERSIONNUMBER/$(version)/' Doxyfile.in > Doxyfile + sed 's/@LIBSRTPVERSIONNUMBER@/$(version)/' Doxyfile.in > Doxyfile doxygen clean: diff --git a/libs/srtp/doc/meson.build b/libs/srtp/doc/meson.build new file mode 100644 index 0000000000..a693897e8c --- /dev/null +++ b/libs/srtp/doc/meson.build @@ -0,0 +1,22 @@ +# libSRTP documentation + +doxygen = find_program('doxygen', required: get_option('doc')) + +if not doxygen.found() + subdir_done() +endif + +doc_config = configuration_data() +doc_config.set('LIBSRTPVERSIONNUMBER', meson.project_version()) + +doxyfile = configure_file(input: 'Doxyfile.in', + output: 'Doxyfile', + configuration: doc_config) + +# can be built on demand with ninja -C builddir doc/html +doxygen_html_docs = custom_target('doc', + build_by_default: false, + command: [doxygen, doxyfile], + output: ['html']) + +alias_target('libsrtp2doc', doxygen_html_docs) diff --git a/libs/srtp/include/ekt.h b/libs/srtp/include/ekt.h deleted file mode 100644 index a289a53dab..0000000000 --- a/libs/srtp/include/ekt.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * ekt.h - * - * interface to Encrypted Key Transport for SRTP - * - * David McGrew - * Cisco Systems, Inc. - */ -/* - * - * Copyright (c) 2001-2017 Cisco Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * Neither the name of the Cisco Systems, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* - * EKT implementation strategy - * - * use stream_template approach - * - * in srtp_unprotect, when a new stream appears, check if template has - * EKT defined, and if it does, then apply EKT processing - * - * question: will we want to allow key-sharing templates in addition - * to EKT templates? could define a new ssrc_type_t that's associated - * with an EKT, e.g. ssrc_any_ekt. - * - * - */ - -#ifndef SRTP_EKT_H -#define SRTP_EKT_H - -// left in commented out as reminder to not include private headers -//#include "srtp_priv.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define SRTP_EKT_CIPHER_DEFAULT 1 -#define SRTP_EKT_CIPHER_AES_128_ECB 1 -#define SRTP_EKT_CIPHER_AES_192_KEY_WRAP 2 -#define SRTP_EKT_CIPHER_AES_256_KEY_WRAP 3 - -typedef uint16_t srtp_ekt_spi_t; - -unsigned srtp_ekt_octets_after_base_tag(srtp_ekt_stream_t ekt); - -/* - * an srtp_policy_t structure can contain a pointer to an - * srtp_ekt_policy_t structure - * - * this structure holds all of the high level EKT information, and it - * is passed into libsrtp to indicate what policy should be in effect - */ - -typedef struct srtp_ekt_policy_ctx_t { - srtp_ekt_spi_t spi; /* security parameter index */ - uint8_t ekt_cipher_type; - uint8_t *ekt_key; - struct srtp_ekt_policy_ctx_t *next_ekt_policy; -} srtp_ekt_policy_ctx_t; - -/* - * an srtp_ekt_data_t structure holds the data corresponding to an ekt key, - * spi, and so on - */ - -typedef struct srtp_ekt_data_t { - srtp_ekt_spi_t spi; - uint8_t ekt_cipher_type; - srtp_aes_expanded_key_t ekt_enc_key; - srtp_aes_expanded_key_t ekt_dec_key; - struct ekt_data_t *next_ekt_data; -} srtp_ekt_data_t; - -/* - * an srtp_stream_ctx_t can contain an srtp_ekt_stream_ctx_t - * - * an srtp_ekt_stream_ctx_t structure holds all of the EKT information for - * a specific SRTP stream - */ - -typedef struct srtp_ekt_stream_ctx_t { - srtp_ekt_data_t *data; - uint16_t isn; /* initial sequence number */ - uint8_t encrypted_master_key[SRTP_MAX_KEY_LEN]; -} srtp_ekt_stream_ctx_t; - -srtp_err_status_t srtp_ekt_alloc(srtp_ekt_stream_t *stream_data, - srtp_ekt_policy_t policy); - -srtp_err_status_t srtp_ekt_stream_init(srtp_ekt_stream_t e, - srtp_ekt_spi_t spi, - void *ekt_key, - unsigned ekt_cipher_type); - -srtp_err_status_t srtp_ekt_stream_init_from_policy(srtp_ekt_stream_t e, - srtp_ekt_policy_t p); - -srtp_err_status_t srtp_stream_init_from_ekt(srtp_stream_t stream, - const void *srtcp_hdr, - unsigned pkt_octet_len); - -void srtp_ekt_write_data(srtp_ekt_stream_t ekt, - uint8_t *base_tag, - unsigned base_tag_len, - int *packet_len, - srtp_xtd_seq_num_t pkt_index); - -/* - * We handle EKT by performing some additional steps before - * authentication (copying the auth tag into a temporary location, - * zeroizing the "base tag" field in the packet) - * - * With EKT, the tag_len parameter is actually the base tag - * length - */ -srtp_err_status_t srtp_ekt_tag_verification_preproces(uint8_t *pkt_tag, - uint8_t *pkt_tag_copy, - unsigned tag_len); - -srtp_err_status_t srtp_ekt_tag_verification_postproces(uint8_t *pkt_tag, - uint8_t *pkt_tag_copy, - unsigned tag_len); - -/* - * @brief EKT pre-processing for srtcp tag generation - * - * This function does the pre-processing of the SRTCP authentication - * tag format. When EKT is used, it consists of writing the Encrypted - * Master Key, the SRTP ROC, the Initial Sequence Number, and SPI - * fields. The Base Authentication Tag field is set to the all-zero - * value - * - * When EKT is not used, this function is a no-op. - * - */ -srtp_err_status_t srtp_stream_srtcp_auth_tag_generation_preprocess( - const srtp_stream_t *s, - uint8_t *pkt_tag, - unsigned pkt_octet_len); - -/* it's not clear that a tag_generation_postprocess function is needed */ -srtp_err_status_t srtcp_auth_tag_generation_postprocess(void); - -#ifdef __cplusplus -} -#endif - -#endif /* SRTP_EKT_H */ diff --git a/libs/srtp/include/srtp.h b/libs/srtp/include/srtp.h index 1fdd6c3aff..fa34daf641 100644 --- a/libs/srtp/include/srtp.h +++ b/libs/srtp/include/srtp.h @@ -86,7 +86,7 @@ extern "C" { /** * SRTP_MAX_TRAILER_LEN is the maximum length of the SRTP trailer * (authentication tag and MKI) supported by libSRTP. This value is - * the maixmum number of octets that will be added to an RTP packet by + * the maximum number of octets that will be added to an RTP packet by * srtp_protect(). * * @brief the maximum number of octets added by srtp_protect(). @@ -130,7 +130,7 @@ extern "C" { * * A srtp_cipher_type_id_t is an integer that represents a particular * cipher type, e.g. the Advanced Encryption Standard (AES). A - * SRTP_NULL_CIPHER is avaliable; this cipher leaves the data unchanged, + * SRTP_NULL_CIPHER is available; this cipher leaves the data unchanged, * and can be selected to indicate that no encryption is to take * place. * @@ -145,7 +145,7 @@ typedef uint32_t srtp_cipher_type_id_t; * * An srtp_auth_type_id_t is an integer that represents a particular * authentication function type, e.g. HMAC-SHA1. A SRTP_NULL_AUTH is - * avaliable; this authentication function performs no computation, + * available; this authentication function performs no computation, * and can be selected to indicate that no authentication is to take * place. * @@ -242,7 +242,7 @@ typedef struct srtp_crypto_policy_t { * @brief srtp_ssrc_type_t describes the type of an SSRC. * * An srtp_ssrc_type_t enumeration is used to indicate a type of SSRC. See - * @ref srtp_policy_t for more informataion. + * @ref srtp_policy_t for more information. */ typedef enum { ssrc_undefined = 0, /**< Indicates an undefined SSRC type. */ @@ -270,16 +270,6 @@ typedef struct { /**< wildcard */ } srtp_ssrc_t; -/** - * @brief points to an EKT policy - */ -typedef struct srtp_ekt_policy_ctx_t *srtp_ekt_policy_t; - -/** - * @brief points to EKT stream data - */ -typedef struct srtp_ekt_stream_ctx_t *srtp_ekt_stream_t; - /** * @brief srtp_master_key_t represents a master key. There will * be a Master Key Index and the Master Key associated with the @@ -329,8 +319,8 @@ typedef struct srtp_policy_t { /**< this stream. */ srtp_master_key_t **keys; /** Array of Master Key structures */ unsigned long num_master_keys; /** Number of master keys */ - srtp_ekt_policy_t ekt; /**< Pointer to the EKT policy structure */ - /**< for this stream (if any) */ + void *deprecated_ekt; /**< DEPRECATED: pointer to the EKT */ + /**< policy structure for this stream */ unsigned long window_size; /**< The window size to use for replay */ /**< protection. */ int allow_repeat_tx; /**< Whether retransmissions of */ @@ -350,7 +340,7 @@ typedef struct srtp_policy_t { * @brief An srtp_t points to an SRTP session structure. * * The typedef srtp_t is a pointer to a structure that represents - * an SRTP session. This datatype is intentially opaque in + * an SRTP session. This datatype is intentionally opaque in * order to separate the interface from the implementation. * * An SRTP session consists of all of the traffic sent to the RTP and @@ -581,7 +571,7 @@ srtp_err_status_t srtp_unprotect_mki(srtp_t ctx, * have its `next' field set to NULL. * * @return - * - srtp_err_status_ok if creation succeded. + * - srtp_err_status_ok if creation succeeded. * - srtp_err_status_alloc_fail if allocation failed. * - srtp_err_status_init_fail if initialization failed. */ @@ -597,7 +587,7 @@ srtp_err_status_t srtp_create(srtp_t *session, const srtp_policy_t *policy); * stream. * * @return values: - * - srtp_err_status_ok if stream creation succeded. + * - srtp_err_status_ok if stream creation succeeded. * - srtp_err_status_alloc_fail if stream allocation failed * - srtp_err_status_init_fail if stream initialization failed. */ @@ -620,18 +610,18 @@ srtp_err_status_t srtp_add_stream(srtp_t session, const srtp_policy_t *policy); * session. * * @return - * - srtp_err_status_ok if the stream deallocation succeded. + * - srtp_err_status_ok if the stream deallocation succeeded. * - [other] otherwise. * */ srtp_err_status_t srtp_remove_stream(srtp_t session, unsigned int ssrc); /** - * @brief srtp_update() udpates all streams in the session. + * @brief srtp_update() updates all streams in the session. * * The function call srtp_update(session, policy) updates * all the streams in the session applying the given policy - * and key. The exsisting ROC value of all streams will be + * and key. The existing ROC value of all streams will be * preserved. * * @param session is the SRTP session that contains the streams @@ -644,7 +634,7 @@ srtp_err_status_t srtp_remove_stream(srtp_t session, unsigned int ssrc); * have its `next' field set to NULL. * * @return - * - srtp_err_status_ok if stream creation succeded. + * - srtp_err_status_ok if stream creation succeed. * - srtp_err_status_alloc_fail if stream allocation failed * - srtp_err_status_init_fail if stream initialization failed. * - [other] otherwise. @@ -653,11 +643,11 @@ srtp_err_status_t srtp_remove_stream(srtp_t session, unsigned int ssrc); srtp_err_status_t srtp_update(srtp_t session, const srtp_policy_t *policy); /** - * @brief srtp_update_stream() udpates a SRTP stream. + * @brief srtp_update_stream() updates a SRTP stream. * * The function call srtp_update_stream(session, policy) updates * the stream(s) in the session that match applying the given - * policy and key. The exsisting ROC value of all stream(s) will + * policy and key. The existing ROC value of all stream(s) will * be preserved. * * @param session is the SRTP session that contains the streams @@ -667,7 +657,7 @@ srtp_err_status_t srtp_update(srtp_t session, const srtp_policy_t *policy); * for the session. * * @return - * - srtp_err_status_ok if stream creation succeded. + * - srtp_err_status_ok if stream creation succeeded. * - srtp_err_status_alloc_fail if stream allocation failed * - srtp_err_status_init_fail if stream initialization failed. * - [other] otherwise. @@ -682,14 +672,14 @@ srtp_err_status_t srtp_update_stream(srtp_t session, * * @param p is a pointer to the policy structure to be set * - * The function call crypto_policy_set_rtp_default(&p) sets the - * crypto_policy_t at location p to the SRTP default policy for RTP + * The function call srtp_crypto_policy_set_rtp_default(&p) sets the + * srtp_crypto_policy_t at location p to the SRTP default policy for RTP * protection, as defined in the specification. This function is a * convenience that helps to avoid dealing directly with the policy * data structure. You are encouraged to initialize policy elements * with this function call. Doing so may allow your code to be * forward compatible with later versions of libSRTP that include more - * elements in the crypto_policy_t datatype. + * elements in the srtp_crypto_policy_t datatype. * * @return void. * @@ -802,7 +792,7 @@ void srtp_crypto_policy_set_aes_cm_128_null_auth(srtp_crypto_policy_t *p); * sets the srtp_crypto_policy_t at location p to use HMAC-SHA1 with an 80 * bit authentication tag to provide message authentication, but to * use no encryption. This policy is NOT RECOMMENDED for SRTP unless - * there is a requirement to forego encryption. + * there is a requirement to forgo encryption. * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize @@ -811,7 +801,7 @@ void srtp_crypto_policy_set_aes_cm_128_null_auth(srtp_crypto_policy_t *p); * include more elements in the srtp_crypto_policy_t datatype. * * @warning This policy is NOT RECOMMENDED for SRTP unless there is a - * requirement to forego encryption. + * requirement to forgo encryption. * * @return void. * @@ -827,7 +817,7 @@ void srtp_crypto_policy_set_null_cipher_hmac_sha1_80(srtp_crypto_policy_t *p); * The function call srtp_crypto_policy_set_null_cipher_hmac_null(&p) * sets the srtp_crypto_policy_t at location p to use no encryption and * no authentication. This policy should only be used for testing and - * troubleshootingl. + * troubleshooting. * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize @@ -836,7 +826,7 @@ void srtp_crypto_policy_set_null_cipher_hmac_sha1_80(srtp_crypto_policy_t *p); * include more elements in the srtp_crypto_policy_t datatype. * * @warning This policy is NOT RECOMMENDED for SRTP unless there is a - * requirement to forego encryption and authentication. + * requirement to forgo encryption and authentication. * * @return void. * @@ -934,7 +924,7 @@ void srtp_crypto_policy_set_aes_cm_256_null_auth(srtp_crypto_policy_t *p); * @param p is a pointer to the policy structure to be set * * The function call srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80(&p) - * sets the crypto_policy_t at location p to use policy + * sets the srtp_crypto_policy_t at location p to use policy * AES_CM_192_HMAC_SHA1_80 as defined in RFC 6188. This policy uses AES-192 * Counter Mode encryption and HMAC-SHA1 authentication, with an 80 bit * authentication tag. @@ -943,7 +933,7 @@ void srtp_crypto_policy_set_aes_cm_256_null_auth(srtp_crypto_policy_t *p); * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your * code to be forward compatible with later versions of libSRTP that - * include more elements in the crypto_policy_t datatype. + * include more elements in the srtp_crypto_policy_t datatype. * * @return void. * @@ -958,7 +948,7 @@ void srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80(srtp_crypto_policy_t *p); * @param p is a pointer to the policy structure to be set * * The function call srtp_crypto_policy_set_aes_cm_192_hmac_sha1_32(&p) - * sets the crypto_policy_t at location p to use policy + * sets the srtp_crypto_policy_t at location p to use policy * AES_CM_192_HMAC_SHA1_32 as defined in RFC 6188. This policy uses AES-192 * Counter Mode encryption and HMAC-SHA1 authentication, with an * authentication tag that is only 32 bits long. This length is @@ -970,7 +960,7 @@ void srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80(srtp_crypto_policy_t *p); * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your * code to be forward compatible with later versions of libSRTP that - * include more elements in the crypto_policy_t datatype. + * include more elements in the srtp_crypto_policy_t datatype. * * @warning This crypto policy is intended for use in SRTP, but not in * SRTCP. It is recommended that a policy that uses longer @@ -989,7 +979,7 @@ void srtp_crypto_policy_set_aes_cm_192_hmac_sha1_32(srtp_crypto_policy_t *p); * @param p is a pointer to the policy structure to be set * * The function call srtp_crypto_policy_set_aes_cm_192_null_auth(&p) sets - * the crypto_policy_t at location p to use the SRTP default cipher + * the srtp_crypto_policy_t at location p to use the SRTP default cipher * (AES-192 Counter Mode), but to use no authentication method. This * policy is NOT RECOMMENDED unless it is unavoidable; see Section 7.5 * of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). @@ -998,7 +988,7 @@ void srtp_crypto_policy_set_aes_cm_192_hmac_sha1_32(srtp_crypto_policy_t *p); * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your * code to be forward compatible with later versions of libSRTP that - * include more elements in the crypto_policy_t datatype. + * include more elements in the srtp_crypto_policy_t datatype. * * @warning This policy is NOT RECOMMENDED for SRTP unless it is * unavoidable, and it is NOT RECOMMENDED at all for SRTCP; see @@ -1160,7 +1150,7 @@ void srtp_crypto_policy_set_aes_gcm_256_16_auth(srtp_crypto_policy_t *p); * * @return * - srtp_err_status_ok if there no problems. - * - srtp_err_status_dealloc_fail a memory deallocation failure occured. + * - srtp_err_status_dealloc_fail a memory deallocation failure occurred. */ srtp_err_status_t srtp_dealloc(srtp_t s); @@ -1168,9 +1158,7 @@ srtp_err_status_t srtp_dealloc(srtp_t s); * @brief identifies a particular SRTP profile * * An srtp_profile_t enumeration is used to identify a particular SRTP - * profile (that is, a set of algorithms and parameters). These profiles - * are defined for DTLS-SRTP: - * https://www.iana.org/assignments/srtp-protection/srtp-protection.xhtml + * profile (that is, a set of algorithms and parameters). */ typedef enum { srtp_profile_reserved = 0, @@ -1363,7 +1351,7 @@ srtp_err_status_t srtp_protect_rtcp(srtp_t ctx, * will * use the session keys identified by the mki_index * - * @param mki_index integer value specifying which set of session kesy should be + * @param mki_index integer value specifying which set of session keys should be * used if use_mki is set to true. * * @return @@ -1560,7 +1548,7 @@ void *srtp_get_user_data(srtp_t ctx); * latter case, all of the streams in the session will expire. */ typedef enum { - event_ssrc_collision, /**< An SSRC collision occured. */ + event_ssrc_collision, /**< An SSRC collision occurred. */ event_key_soft_limit, /**< An SRTP stream reached the soft key */ /**< usage limit and will expire soon. */ event_key_hard_limit, /**< An SRTP stream reached the hard */ @@ -1577,9 +1565,9 @@ typedef enum { * handler function. */ typedef struct srtp_event_data_t { - srtp_t session; /**< The session in which the event happend. */ + srtp_t session; /**< The session in which the event happened. */ uint32_t ssrc; /**< The ssrc in host order of the stream in which */ - /**< the event happend */ + /**< the event happened */ srtp_event_t event; /**< An enum indicating the type of event. */ } srtp_event_data_t; @@ -1603,7 +1591,7 @@ typedef void(srtp_event_handler_func_t)(srtp_event_data_t *data); * as an argument; in this case, events will be ignored rather than * handled. * - * @param func is a pointer to a fuction that takes an srtp_event_data_t + * @param func is a pointer to a function that takes an srtp_event_data_t * pointer as an argument and returns void. This function * will be used by libSRTP to handle events. */ @@ -1671,10 +1659,10 @@ typedef void(srtp_log_handler_func_t)(srtp_log_level_t level, * The function call srtp_install_log_handler(func) sets the log * handler function to the value func. The value NULL is acceptable * as an argument; in this case, log messages will be ignored. - * This function can be called before srtp_init() inorder to capture + * This function can be called before srtp_init() in order to capture * any logging during start up. * - * @param func is a pointer to a fuction of type srtp_log_handler_func_t. + * @param func is a pointer to a function of type srtp_log_handler_func_t. * This function will be used by libSRTP to output log messages. * @param data is a user pointer that will be returned as the data argument in * func. diff --git a/libs/srtp/include/srtp2/meson.build b/libs/srtp/include/srtp2/meson.build new file mode 100644 index 0000000000..88d068a338 --- /dev/null +++ b/libs/srtp/include/srtp2/meson.build @@ -0,0 +1,8 @@ +# Copy public headers scattered across the source tree into a single directory +# so that we can use it in declare_dependency() +foreach h : public_headers + configure_file(input: h, + output: '@BASENAME@.h', + copy: true) +endforeach +public_incs = include_directories('.') diff --git a/libs/srtp/include/srtp_priv.h b/libs/srtp/include/srtp_priv.h index 661a7f94ab..355277e137 100644 --- a/libs/srtp/include/srtp_priv.h +++ b/libs/srtp/include/srtp_priv.h @@ -55,7 +55,6 @@ #include "cipher.h" #include "auth.h" #include "aes.h" -#include "key.h" #include "crypto_kernel.h" #ifdef __cplusplus @@ -147,7 +146,6 @@ typedef struct srtp_stream_ctx_t_ { srtp_sec_serv_t rtcp_services; direction_t direction; int allow_repeat_tx; - srtp_ekt_stream_t ekt; int *enc_xtn_hdr; int enc_xtn_hdr_count; uint32_t pending_roc; @@ -219,7 +217,7 @@ typedef struct { * srtcp_hdr_t represents a secure rtcp header * * in this implementation, an srtcp header is assumed to be 32-bit - * alinged + * aligned */ #ifndef WORDS_BIGENDIAN diff --git a/libs/srtp/install-win.bat b/libs/srtp/install-win.bat deleted file mode 100644 index a4fc0eb7a8..0000000000 --- a/libs/srtp/install-win.bat +++ /dev/null @@ -1,35 +0,0 @@ -:: Installs from srtp windows build directory to directory specified on -:: command line - - -@if "%1"=="" ( - echo "Usage: %~nx0 destdir" - exit /b 1 -) else ( - set destdir=%1 -) - -@if not exist %destdir% ( - echo %destdir% not found - exit /b 1 -) - -@for %%d in (include\srtp.h crypto\include\cipher.h Debug\srtp2.lib Release\srtp2.lib x64\Debug\srtp2.lib x64\Release\srtp2.lib) do ( - if not exist "%%d" ( - echo "%%d not found: are you in the right directory?" - exit /b 1 - ) -) - -mkdir %destdir%\include -mkdir %destdir%\include\srtp2 -mkdir %destdir%\lib -mkdir %destdir%\lib\x64 - -@for %%d in (include\srtp.h include\ekt.h crypto\include\cipher.h crypto\include\auth.h crypto\include\crypto_types.h) do ( - copy %%d %destdir%\include\srtp2 -) -copy Release\srtp2.lib %destdir%\lib\srtp2.lib -copy Debug\srtp2.lib %destdir%\lib\srtp2d.lib -copy x64\Release\srtp2.lib %destdir%\lib\x64\srtp2.lib -copy x64\Debug\srtp2.lib %destdir%\lib\x64\srtp2d.lib diff --git a/libs/srtp/libsrtp.2017.vcxproj b/libs/srtp/libsrtp.2017.vcxproj index f3e0dac48a..80826653db 100644 --- a/libs/srtp/libsrtp.2017.vcxproj +++ b/libs/srtp/libsrtp.2017.vcxproj @@ -360,7 +360,6 @@ <ClCompile Include="crypto\cipher\aes_gcm_ossl.c" /> <ClCompile Include="crypto\cipher\aes_icm_ossl.c" /> <ClCompile Include="crypto\hash\hmac_ossl.c" /> - <ClCompile Include="srtp\ekt.c" /> <ClCompile Include="srtp\srtp.c" /> <ClCompile Include="crypto\kernel\alloc.c" /> <ClCompile Include="crypto\kernel\crypto_kernel.c" /> @@ -375,14 +374,14 @@ <FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'">false</FunctionLevelLinking> </ClCompile> <ClCompile Include="crypto\cipher\cipher.c" /> + <ClCompile Include="crypto\cipher\cipher_test_cases.c" /> <ClCompile Include="crypto\cipher\null_cipher.c" /> <ClCompile Include="crypto\hash\auth.c" /> + <ClCompile Include="crypto\hash\auth_test_cases.c" /> <ClCompile Include="crypto\hash\null_auth.c" /> <ClCompile Include="crypto\replay\rdb.c" /> <ClCompile Include="crypto\replay\rdbx.c" /> - <ClCompile Include="crypto\replay\ut_sim.c" /> <ClCompile Include="crypto\math\datatypes.c" /> - <ClCompile Include="crypto\math\stat.c" /> </ItemGroup> <ItemGroup> <ClInclude Include="crypto\include\aes.h" /> @@ -408,8 +407,6 @@ <ClInclude Include="include\rtp.h" /> <ClInclude Include="crypto\include\sha1.h" /> <ClInclude Include="include\srtp.h" /> - <ClInclude Include="crypto\include\stat.h" /> - <ClInclude Include="include\ut_sim.h" /> </ItemGroup> <ItemGroup> <None Include="srtp.def" /> diff --git a/libs/srtp/libsrtp2.pc.in b/libs/srtp/libsrtp2.pc.in index fcb86528c4..f2097a3a2d 100644 --- a/libs/srtp/libsrtp2.pc.in +++ b/libs/srtp/libsrtp2.pc.in @@ -7,5 +7,6 @@ Name: @PACKAGE_NAME@ Version: @PACKAGE_VERSION@ Description: Library for SRTP (Secure Realtime Transport Protocol) -Libs: -L${libdir} -lsrtp2 @LIBS@ +Libs: -L${libdir} -lsrtp2 +Libs.private: @LIBS@ Cflags: -I${includedir} diff --git a/libs/srtp/meson.build b/libs/srtp/meson.build new file mode 100644 index 0000000000..c70efd7fde --- /dev/null +++ b/libs/srtp/meson.build @@ -0,0 +1,297 @@ +project('libsrtp2', 'c', version: '2.4.0', + meson_version: '>= 0.52.0', + default_options: ['buildtype=debugoptimized']) + +soversion = 1 + +cc = meson.get_compiler('c') +host_system = host_machine.system() + +srtp2_deps = [] +syslibs = [] + +if host_system == 'windows' + syslibs += [cc.find_library('ws2_32')] # for socket +endif + +cdata = configuration_data() +cdata.set_quoted('PACKAGE_VERSION', meson.project_version()) +cdata.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.project_version())) + +check_headers = [ + 'arpa/inet.h', + 'byteswap.h', + 'inttypes.h', + 'machine/types.h', + 'netinet/in.h', + 'stdint.h', + 'stdlib.h', + 'sys/int_types.h', + 'sys/socket.h', + 'sys/types.h', + 'sys/uio.h', + 'unistd.h', +] + +if host_system == 'windows' + check_headers += ['windows.h', 'winsock2.h'] +endif + +foreach h : check_headers + if cc.has_header(h) + cdata.set('HAVE_' + h.to_upper().underscorify(), true) + endif +endforeach + +check_functions = [ + 'sigaction', + 'inet_aton', + 'usleep', + 'socket', +] + +foreach f : check_functions + if cc.has_function(f, dependencies: syslibs) + cdata.set('HAVE_' + f.to_upper().underscorify(), true) + endif +endforeach + +if host_machine.endian() == 'big' + cdata.set('WORDS_BIGENDIAN', true) +endif + +# This follows the checks in configure.ac, but is it up-to-date ?! +if host_machine.cpu_family() in ['x86', 'x86_64'] + cdata.set('CPU_CISC', true, description: 'Building for a CISC machine (e.g. Intel)') + cdata.set('HAVE_X86', true, description: 'Use x86 inlined assembly code') +else + cdata.set('CPU_RISC', true, description: 'Building for a RISC machine (assume slow byte access)') +endif + +# Pretty much all supported platforms have stdint.h nowadays +assert(cc.has_header('stdint.h'), 'stdint.h not available!') + +# we'll just assume these types are available via stdint.h +foreach type : ['int8_t', 'uint8_t', 'int16_t', 'uint16_t', 'int32_t', 'uint32_t', 'uint64_t'] + cdata.set('HAVE_' + type.to_upper().underscorify(), true) +endforeach + +size_t_prefix = ''' +#ifdef _WIN32 +#include <crtdefs.h> +#endif +#include <sys/types.h> +''' +if not cc.has_type('size_t', prefix: size_t_prefix) + cdata.set('size_t', 'unsigned int') +endif + +# check type availability and size +foreach type : ['unsigned long', 'unsigned long long'] + if cc.has_type(type) + cdata.set('HAVE_' + type.to_upper().underscorify(), true) + cdata.set('SIZEOF_' + type.to_upper().underscorify(), cc.sizeof(type)) + endif +endforeach + +if not cc.compiles('inline void func(); void func() { } int main() { func(); return 0; }', name: 'inline keyword check') + if cc.compiles('__inline void func(); void func() { } int main() { func(); return 0; }', name: '__inline keyword check') + cdata.set('inline', '__inline') + else + cdata.set('inline', '') + endif +endif + +if get_option('log-stdout') + cdata.set('ERR_REPORTING_STDOUT', true) +endif + +if get_option('log-file') != '' + cdata.set('ERR_REPORTING_FILE', get_option('log-file')) +endif + +if cdata.has('ERR_REPORTING_STDOUT') and cdata.has('ERR_REPORTING_FILE') + error('The log-stdout and log-file options are mutually exclusive!') +endif + +if get_option('debug-logging') + cdata.set('ENABLE_DEBUG_LOGGING', true) +endif + +use_openssl = false +use_nss = false + +crypto_library = get_option('crypto-library') +if crypto_library == 'openssl' + openssl_dep = dependency('openssl', version: '>= 1.0.1', required: true) + srtp2_deps += [openssl_dep] + cdata.set('GCM', true) + cdata.set('OPENSSL', true) + cdata.set('USE_EXTERNAL_CRYPTO', true) + use_openssl = true + # NOTE: This is not available in upstream OpenSSL yet. It's only in 'certain' + # forks of OpenSSL: https://github.com/cisco/libsrtp/issues/458 + if ( + openssl_dep.type_name() != 'internal' and + not get_option('crypto-library-kdf').disabled() and + cc.has_function('kdf_srtp', dependencies: openssl_dep) + ) + cdata.set('OPENSSL_KDF', true) + elif get_option('crypto-library-kdf').enabled() + error('KDF support has been enabled, but OpenSSL does not provide it') + endif +elif crypto_library == 'nss' + nss_dep = dependency('nss', version: '>= 1.0.1', required: true) + srtp2_deps += [nss_dep] + cdata.set('GCM', true) + cdata.set('NSS', true) + cdata.set('USE_EXTERNAL_CRYPTO', true) + use_nss = true + # TODO(RLB): Use NSS for KDF + if get_option('crypto-library-kdf').enabled() + error('KDF support has not been implemented for NSS') + endif +endif + +configure_file(output: 'config.h', configuration: cdata) + +add_project_arguments('-DHAVE_CONFIG_H', language: 'c') + +if get_option('buildtype') != 'plain' + w_args = ['-Wstrict-prototypes'] + add_project_arguments(cc.get_supported_arguments(w_args), language: 'c') +endif + +if get_option('optimization') not in ['0', 'g', 's'] + # -fexpensive-optimizations set already by default for -O2, -O3 + o_args = ['-funroll-loops'] + add_project_arguments(cc.get_supported_arguments(o_args), language: 'c') +endif + +sources = files( + 'srtp/srtp.c', + ) + +ciphers_sources = files( + 'crypto/cipher/cipher.c', + 'crypto/cipher/cipher_test_cases.c', + 'crypto/cipher/null_cipher.c', + ) + +if use_openssl + ciphers_sources += files( + 'crypto/cipher/aes_icm_ossl.c', + 'crypto/cipher/aes_gcm_ossl.c', + ) +elif use_nss + ciphers_sources += files( + 'crypto/cipher/aes_icm_nss.c', + 'crypto/cipher/aes_gcm_nss.c', + ) +else + ciphers_sources += files( + 'crypto/cipher/aes.c', + 'crypto/cipher/aes_icm.c', + ) +endif + +hashes_sources = files( + 'crypto/hash/auth.c', + 'crypto/hash/auth_test_cases.c', + 'crypto/hash/null_auth.c', + ) + +if use_openssl + hashes_sources += files( + 'crypto/hash/hmac_ossl.c', + ) +elif use_nss + hashes_sources += files( + 'crypto/hash/hmac_nss.c', + ) +else + hashes_sources += files( + 'crypto/hash/hmac.c', + 'crypto/hash/sha1.c', + ) +endif + +kernel_sources = files( + 'crypto/kernel/alloc.c', + 'crypto/kernel/crypto_kernel.c', + 'crypto/kernel/err.c', + 'crypto/kernel/key.c', +) + +math_sources = files( + 'crypto/math/datatypes.c', +) + +replay_sources = files( + 'crypto/replay/rdb.c', + 'crypto/replay/rdbx.c', +) + +public_headers = files( + 'include/srtp.h', + 'crypto/include/auth.h', + 'crypto/include/cipher.h', + 'crypto/include/crypto_types.h', +) +install_headers(public_headers, subdir : 'srtp2') + +config_incs = include_directories('.') +crypto_incs = include_directories('crypto/include') +srtp2_incs = include_directories('include') +test_incs = include_directories('test') + +default_library = get_option('default_library') + +libsrtp2_static = static_library('srtp2', sources, ciphers_sources, hashes_sources, + kernel_sources, math_sources, replay_sources, + dependencies: [srtp2_deps, syslibs], + include_directories: [crypto_incs, srtp2_incs], + install: default_library != 'shared') + +if default_library != 'static' + libsrtp2 = shared_library('srtp2', + dependencies: [srtp2_deps, syslibs], + soversion : soversion, + vs_module_defs: 'srtp.def', + link_whole: libsrtp2_static, + install: true) +else + libsrtp2 = libsrtp2_static +endif + +subdir('include/srtp2') # copies public_headers into the builddir and sets public_incs + +libsrtp2_dep = declare_dependency(link_with: libsrtp2, + include_directories: public_incs) + +if not get_option('tests').disabled() + # Tests use non-public API, and when building on Windows the only symbols we + # export are those in srtp.def, so link to the static library in that case. + if host_system == 'windows' + libsrtp2_for_tests = libsrtp2_static + else + libsrtp2_for_tests = libsrtp2 + endif + subdir('crypto/test') + subdir('test') +endif + +if not get_option('fuzzer').disabled() + subdir('fuzzer') +endif + +if not get_option('doc').disabled() + subdir('doc') +endif + +pkgconfig = import('pkgconfig') +pkgconfig.generate(libsrtp2, + filebase: meson.project_name(), + name: meson.project_name(), + version: meson.project_version(), + description: 'Library for SRTP (Secure Realtime Transport Protocol)') diff --git a/libs/srtp/meson_options.txt b/libs/srtp/meson_options.txt new file mode 100644 index 0000000000..1c39b9d881 --- /dev/null +++ b/libs/srtp/meson_options.txt @@ -0,0 +1,18 @@ +option('debug-logging', type : 'boolean', value : false, + description : 'Enable debug logging in all modules') +option('log-stdout', type : 'boolean', value : false, + description : 'Redirect logging to stdout') +option('log-file', type : 'string', value : '', + description : 'Write logging output into this file') +option('crypto-library', type: 'combo', choices : ['none', 'openssl', 'nss'], value : 'none', + description : 'What external crypto library to leverage, if any (OpenSSL or NSS)') +option('crypto-library-kdf', type : 'feature', value : 'auto', + description : 'Use the external crypto library for Key Derivation Function support') +option('fuzzer', type : 'feature', value : 'disabled', + description : 'Build libsrtp2 fuzzer (requires build with clang)') +option('tests', type : 'feature', value : 'auto', yield : true, + description : 'Build test applications') +option('pcap-tests', type : 'feature', value : 'auto', + description : 'Build test application that require libpcap') +option('doc', type : 'feature', value : 'auto', yield : true, + description : 'Generate API documentation with doxygen') diff --git a/libs/srtp/srtp.def b/libs/srtp/srtp.def index e22074057f..d418b1464b 100644 --- a/libs/srtp/srtp.def +++ b/libs/srtp/srtp.def @@ -2,12 +2,15 @@ EXPORTS srtp_init srtp_shutdown srtp_protect +srtp_protect_mki srtp_unprotect +srtp_unprotect_mki srtp_create srtp_add_stream srtp_remove_stream srtp_update srtp_update_stream +srtp_get_stream srtp_crypto_policy_set_rtp_default srtp_crypto_policy_set_rtcp_default srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32 @@ -17,32 +20,36 @@ srtp_crypto_policy_set_null_cipher_hmac_null srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80 srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32 srtp_crypto_policy_set_aes_cm_256_null_auth -; TODO - GCM module not yet supported on Win32 -; srtp_crypto_policy_set_aes_gcm_128_8_auth -; srtp_crypto_policy_set_aes_gcm_256_8_auth -; srtp_crypto_policy_set_aes_gcm_128_8_only_auth -; srtp_crypto_policy_set_aes_gcm_256_8_only_auth -; srtp_crypto_policy_set_aes_gcm_128_16_auth -; srtp_crypto_policy_set_aes_gcm_256_16_auth +srtp_crypto_policy_set_aes_gcm_128_8_auth +srtp_crypto_policy_set_aes_gcm_256_8_auth +srtp_crypto_policy_set_aes_gcm_128_8_only_auth +srtp_crypto_policy_set_aes_gcm_256_8_only_auth +srtp_crypto_policy_set_aes_gcm_128_16_auth +srtp_crypto_policy_set_aes_gcm_256_16_auth srtp_dealloc srtp_crypto_policy_set_from_profile_for_rtp srtp_crypto_policy_set_from_profile_for_rtcp srtp_profile_get_master_key_length srtp_profile_get_master_salt_length srtp_append_salt_to_key +srtp_get_protect_trailer_length +srtp_get_protect_rtcp_trailer_length srtp_protect_rtcp +srtp_protect_rtcp_mki srtp_unprotect_rtcp +srtp_unprotect_rtcp_mki +srtp_set_stream_roc srtp_set_user_data +srtp_get_stream_roc srtp_get_user_data srtp_install_event_handler srtp_get_version_string srtp_get_version srtp_set_debug_module srtp_list_debug_modules -srtp_ekt_octets_after_base_tag -srtp_ekt_alloc -srtp_ekt_stream_init_from_policy -srtp_ekt_write_data +srtp_install_log_handler +srtp_err_report +srtp_crypto_kernel_load_debug_module srtp_cipher_get_key_length srtp_cipher_type_self_test srtp_cipher_type_test @@ -63,3 +70,6 @@ srtp_auth_get_prefix_length srtp_auth_type_self_test srtp_auth_type_test srtp_replace_auth_type +srtp_octet_string_hex_string +srtp_octet_string_is_eq +srtp_rdbx_get_window_size diff --git a/libs/srtp/srtp/ekt.c b/libs/srtp/srtp/ekt.c deleted file mode 100644 index b54ecf64eb..0000000000 --- a/libs/srtp/srtp/ekt.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * ekt.c - * - * Encrypted Key Transport for SRTP - * - * David McGrew - * Cisco Systems, Inc. - */ -/* - * - * Copyright (c) 2001-2017 Cisco Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * Neither the name of the Cisco Systems, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "srtp_priv.h" -#include "err.h" -#include "ekt.h" - -extern srtp_debug_module_t mod_srtp; - -/* - * The EKT Authentication Tag format. - * - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * : Base Authentication Tag : - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * : Encrypted Master Key : - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Rollover Counter | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Initial Sequence Number | Security Parameter Index | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - */ - -#define EKT_OCTETS_AFTER_BASE_TAG 24 -#define EKT_OCTETS_AFTER_EMK 8 -#define EKT_OCTETS_AFTER_ROC 4 -#define EKT_SPI_LEN 2 - -unsigned srtp_ekt_octets_after_base_tag(srtp_ekt_stream_t ekt) -{ - /* - * if the pointer ekt is NULL, then EKT is not in effect, so we - * indicate this by returning zero - */ - if (!ekt) - return 0; - - switch (ekt->data->ekt_cipher_type) { - case SRTP_EKT_CIPHER_AES_128_ECB: - return 16 + EKT_OCTETS_AFTER_EMK; - break; - default: - break; - } - return 0; -} - -static inline srtp_ekt_spi_t srtcp_packet_get_ekt_spi( - const uint8_t *packet_start, - unsigned pkt_octet_len) -{ - const uint8_t *spi_location; - - spi_location = packet_start + (pkt_octet_len - EKT_SPI_LEN); - - return *((const srtp_ekt_spi_t *)spi_location); -} - -static inline uint32_t srtcp_packet_get_ekt_roc(const uint8_t *packet_start, - unsigned pkt_octet_len) -{ - const uint8_t *roc_location; - - roc_location = packet_start + (pkt_octet_len - EKT_OCTETS_AFTER_ROC); - - return *((const uint32_t *)roc_location); -} - -static inline const uint8_t *srtcp_packet_get_emk_location( - const uint8_t *packet_start, - unsigned pkt_octet_len) -{ - const uint8_t *location; - - location = packet_start + (pkt_octet_len - EKT_OCTETS_AFTER_BASE_TAG); - - return location; -} - -srtp_err_status_t srtp_ekt_alloc(srtp_ekt_stream_t *stream_data, - srtp_ekt_policy_t policy) -{ - /* - * if the policy pointer is NULL, then EKT is not in use - * so we just set the EKT stream data pointer to NULL - */ - if (!policy) { - *stream_data = NULL; - return srtp_err_status_ok; - } - - /* TODO */ - *stream_data = NULL; - - return srtp_err_status_ok; -} - -srtp_err_status_t srtp_ekt_stream_init_from_policy( - srtp_ekt_stream_t stream_data, - srtp_ekt_policy_t policy) -{ - if (!stream_data) - return srtp_err_status_ok; - - return srtp_err_status_ok; -} - -void aes_decrypt_with_raw_key(void *ciphertext, const void *key, int key_len) -{ -#ifndef OPENSSL - // FIXME: need to get this working through the crypto module interface - srtp_aes_expanded_key_t expanded_key; - - srtp_aes_expand_decryption_key(key, key_len, &expanded_key); - srtp_aes_decrypt(ciphertext, &expanded_key); -#endif -} - -/* - * The function srtp_stream_init_from_ekt() initializes a stream using - * the EKT data from an SRTCP trailer. - */ - -srtp_err_status_t srtp_stream_init_from_ekt(srtp_stream_t stream, - const void *srtcp_hdr, - unsigned pkt_octet_len) -{ - srtp_err_status_t err; - const uint8_t *master_key; - srtp_policy_t srtp_policy; - uint32_t roc; - - /* - * NOTE: at present, we only support a single ekt_policy at a time. - */ - if (stream->ekt->data->spi != - srtcp_packet_get_ekt_spi(srtcp_hdr, pkt_octet_len)) - return srtp_err_status_no_ctx; - - if (stream->ekt->data->ekt_cipher_type != SRTP_EKT_CIPHER_AES_128_ECB) - return srtp_err_status_bad_param; - - /* decrypt the Encrypted Master Key field */ - master_key = srtcp_packet_get_emk_location(srtcp_hdr, pkt_octet_len); - /* FIX!? This decrypts the master key in-place, and never uses it */ - /* FIX!? It's also passing to ekt_dec_key (which is an aes_expanded_key_t) - * to a function which expects a raw (unexpanded) key */ - aes_decrypt_with_raw_key((void *)master_key, - &stream->ekt->data->ekt_dec_key, 16); - - /* set the SRTP ROC */ - roc = srtcp_packet_get_ekt_roc(srtcp_hdr, pkt_octet_len); - err = srtp_rdbx_set_roc(&stream->rtp_rdbx, roc); - if (err) - return err; - - err = srtp_stream_init(stream, &srtp_policy); - if (err) - return err; - - return srtp_err_status_ok; -} - -void srtp_ekt_write_data(srtp_ekt_stream_t ekt, - uint8_t *base_tag, - unsigned base_tag_len, - int *packet_len, - srtp_xtd_seq_num_t pkt_index) -{ - uint32_t roc; - uint16_t isn; - unsigned emk_len; - uint8_t *packet; - - /* if the pointer ekt is NULL, then EKT is not in effect */ - if (!ekt) { - debug_print(mod_srtp, "EKT not in use", NULL); - return; - } - - /* write zeros into the location of the base tag */ - octet_string_set_to_zero(base_tag, base_tag_len); - packet = base_tag + base_tag_len; - - /* copy encrypted master key into packet */ - emk_len = srtp_ekt_octets_after_base_tag(ekt); - memcpy(packet, ekt->encrypted_master_key, emk_len); - debug_print(mod_srtp, "writing EKT EMK: %s,", - srtp_octet_string_hex_string(packet, emk_len)); - packet += emk_len; - - /* copy ROC into packet */ - roc = (uint32_t)(pkt_index >> 16); - *((uint32_t *)packet) = be32_to_cpu(roc); - debug_print(mod_srtp, "writing EKT ROC: %s,", - srtp_octet_string_hex_string(packet, sizeof(roc))); - packet += sizeof(roc); - - /* copy ISN into packet */ - isn = (uint16_t)pkt_index; - *((uint16_t *)packet) = htons(isn); - debug_print(mod_srtp, "writing EKT ISN: %s,", - srtp_octet_string_hex_string(packet, sizeof(isn))); - packet += sizeof(isn); - - /* copy SPI into packet */ - *((uint16_t *)packet) = htons(ekt->data->spi); - debug_print(mod_srtp, "writing EKT SPI: %s,", - srtp_octet_string_hex_string(packet, sizeof(ekt->data->spi))); - - /* increase packet length appropriately */ - *packet_len += EKT_OCTETS_AFTER_EMK + emk_len; -} - -/* - * The function call srtcp_ekt_trailer(ekt, auth_len, auth_tag ) - * - * If the pointer ekt is NULL, then the other inputs are unaffected. - * - * auth_tag is a pointer to the pointer to the location of the - * authentication tag in the packet. If EKT is in effect, then the - * auth_tag pointer is set to the location - */ - -void srtcp_ekt_trailer(srtp_ekt_stream_t ekt, - unsigned *auth_len, - void **auth_tag, - void *tag_copy) -{ - /* - * if there is no EKT policy, then the other inputs are unaffected - */ - if (!ekt) - return; - - /* copy auth_tag into temporary location */ -} diff --git a/libs/srtp/srtp/srtp.c b/libs/srtp/srtp/srtp.c index 966757e7ad..fb5574f4ca 100644 --- a/libs/srtp/srtp/srtp.c +++ b/libs/srtp/srtp/srtp.c @@ -48,15 +48,15 @@ #include "srtp_priv.h" #include "crypto_types.h" #include "err.h" -#include "ekt.h" /* for SRTP Encrypted Key Transport */ #include "alloc.h" /* for srtp_crypto_alloc() */ -#ifdef OPENSSL -#include "aes_gcm_ossl.h" /* for AES GCM mode */ +#ifdef GCM +#include "aes_gcm.h" /* for AES GCM mode */ +#endif + #ifdef OPENSSL_KDF #include <openssl/kdf.h> -#include "aes_icm_ossl.h" /* for AES GCM mode */ -#endif +#include "aes_icm_ext.h" #endif #include <limits.h> @@ -81,13 +81,14 @@ srtp_debug_module_t mod_srtp = { static srtp_err_status_t srtp_validate_rtp_header(void *rtp_hdr, int *pkt_octet_len) { + srtp_hdr_t *hdr = (srtp_hdr_t *)rtp_hdr; + int rtp_header_len; + if (*pkt_octet_len < octets_in_rtp_header) return srtp_err_status_bad_param; - srtp_hdr_t *hdr = (srtp_hdr_t *)rtp_hdr; - /* Check RTP header length */ - int rtp_header_len = octets_in_rtp_header + 4 * hdr->cc; + rtp_header_len = octets_in_rtp_header + 4 * hdr->cc; if (hdr->x == 1) rtp_header_len += octets_in_rtp_extn_hdr; @@ -264,8 +265,6 @@ srtp_err_status_t srtp_stream_dealloc(srtp_stream_ctx_t *stream, if (status) return status; - /* DAM - need to deallocate EKT here */ - if (stream_template && stream->enc_xtn_hdr == stream_template->enc_xtn_hdr) { /* do nothing */ @@ -279,6 +278,15 @@ srtp_err_status_t srtp_stream_dealloc(srtp_stream_ctx_t *stream, return srtp_err_status_ok; } +static srtp_err_status_t srtp_valid_policy(const srtp_policy_t *p) +{ + if (p != NULL && p->deprecated_ekt != NULL) { + return srtp_err_status_bad_param; + } + + return srtp_err_status_ok; +} + srtp_err_status_t srtp_stream_alloc(srtp_stream_ctx_t **str_ptr, const srtp_policy_t *p) { @@ -287,6 +295,11 @@ srtp_err_status_t srtp_stream_alloc(srtp_stream_ctx_t **str_ptr, unsigned int i = 0; srtp_session_keys_t *session_keys = NULL; + stat = srtp_valid_policy(p); + if (stat != srtp_err_status_ok) { + return stat; + } + /* * This function allocates the stream context, rtp and rtcp ciphers * and auth functions, and key limit structure. If there is a @@ -373,13 +386,6 @@ srtp_err_status_t srtp_stream_alloc(srtp_stream_ctx_t **str_ptr, } } - /* allocate ekt data associated with stream */ - stat = srtp_ekt_alloc(&str->ekt, p->ekt); - if (stat) { - srtp_stream_dealloc(str, NULL); - return stat; - } - if (p->enc_xtn_hdr && p->enc_xtn_hdr_count > 0) { srtp_cipher_type_id_t enc_xtn_hdr_cipher_type; int enc_xtn_hdr_cipher_key_len; @@ -539,9 +545,6 @@ srtp_err_status_t srtp_stream_clone(const srtp_stream_ctx_t *stream_template, str->rtp_services = stream_template->rtp_services; str->rtcp_services = stream_template->rtcp_services; - /* set pointer to EKT data associated with stream */ - str->ekt = stream_template->ekt; - /* copy information about extensions header encryption */ str->enc_xtn_hdr = stream_template->enc_xtn_hdr; str->enc_xtn_hdr_count = stream_template->enc_xtn_hdr_count; @@ -677,6 +680,8 @@ static srtp_err_status_t srtp_kdf_init(srtp_kdf_t *kdf, int key_len) { srtp_cipher_type_id_t cipher_id; + srtp_err_status_t stat; + switch (key_len) { case SRTP_AES_ICM_256_KEY_LEN_WSALT: cipher_id = SRTP_AES_ICM_256; @@ -692,7 +697,6 @@ static srtp_err_status_t srtp_kdf_init(srtp_kdf_t *kdf, break; } - srtp_err_status_t stat; stat = srtp_crypto_kernel_alloc_cipher(cipher_id, &kdf->cipher, key_len, 0); if (stat) return stat; @@ -959,7 +963,7 @@ srtp_err_status_t srtp_stream_init_keys(srtp_stream_ctx_t *srtp, * to generate the salt value */ if (rtp_salt_len > 0) { - debug_print(mod_srtp, "found rtp_salt_len > 0, generating salt", NULL); + debug_print0(mod_srtp, "found rtp_salt_len > 0, generating salt"); /* generate encryption salt, put after encryption key */ stat = srtp_kdf_generate(&kdf, label_rtp_salt, @@ -1067,9 +1071,8 @@ srtp_err_status_t srtp_stream_init_keys(srtp_stream_ctx_t *srtp, * to generate the salt value */ if (rtp_xtn_hdr_salt_len > 0) { - debug_print(mod_srtp, - "found rtp_xtn_hdr_salt_len > 0, generating salt", - NULL); + debug_print0(mod_srtp, + "found rtp_xtn_hdr_salt_len > 0, generating salt"); /* generate encryption salt, put after encryption key */ stat = srtp_kdf_generate(xtn_hdr_kdf, label_rtp_header_salt, @@ -1150,8 +1153,7 @@ srtp_err_status_t srtp_stream_init_keys(srtp_stream_ctx_t *srtp, * to generate the salt value */ if (rtcp_salt_len > 0) { - debug_print(mod_srtp, "found rtcp_salt_len > 0, generating rtcp salt", - NULL); + debug_print0(mod_srtp, "found rtcp_salt_len > 0, generating rtcp salt"); /* generate encryption salt, put after encryption key */ stat = srtp_kdf_generate(&kdf, label_rtcp_salt, @@ -1216,6 +1218,11 @@ srtp_err_status_t srtp_stream_init(srtp_stream_ctx_t *srtp, { srtp_err_status_t err; + err = srtp_valid_policy(p); + if (err != srtp_err_status_ok) { + return err; + } + debug_print(mod_srtp, "initializing stream (SSRC: 0x%08x)", p->ssrc.value); /* initialize replay database */ @@ -1275,16 +1282,6 @@ srtp_err_status_t srtp_stream_init(srtp_stream_ctx_t *srtp, return err; } - /* - * if EKT is in use, then initialize the EKT data associated with - * the stream - */ - err = srtp_ekt_stream_init_from_policy(srtp->ekt, p->ekt); - if (err) { - srtp_rdbx_dealloc(&srtp->rtp_rdbx); - return err; - } - return srtp_err_status_ok; } @@ -1421,7 +1418,7 @@ static srtp_err_status_t srtp_process_header_encryption( xtn_hdr_data++; } } - } else if ((ntohs(xtn_hdr->profile_specific) & 0x1fff) == 0x100) { + } else if ((ntohs(xtn_hdr->profile_specific) & 0xfff0) == 0x1000) { /* RFC 5285, section 4.3. Two-Byte Header */ while (xtn_hdr_data + 1 < xtn_hdr_end) { uint8_t xid = *xtn_hdr_data; @@ -1667,7 +1664,7 @@ static srtp_err_status_t srtp_get_est_pkt_index(srtp_hdr_t *hdr, debug_print2(mod_srtp, "estimated u_packet index: %08x%08x", high32(*est), low32(*est)); #else - debug_print(mod_srtp, "estimated u_packet index: %016llx", *est); + debug_print(mod_srtp, "estimated u_packet index: %016" PRIx64, *est); #endif return result; } @@ -1697,7 +1694,7 @@ static srtp_err_status_t srtp_protect_aead(srtp_ctx_t *ctx, unsigned int mki_size = 0; uint8_t *mki_location = NULL; - debug_print(mod_srtp, "function srtp_protect_aead", NULL); + debug_print0(mod_srtp, "function srtp_protect_aead"); /* * update the key usage limit, and check it to make sure that we @@ -1756,7 +1753,7 @@ static srtp_err_status_t srtp_protect_aead(srtp_ctx_t *ctx, debug_print2(mod_srtp, "estimated packet index: %08x%08x", high32(est), low32(est)); #else - debug_print(mod_srtp, "estimated packet index: %016llx", est); + debug_print(mod_srtp, "estimated packet index: %016" PRIx64, est); #endif /* @@ -1858,13 +1855,13 @@ static srtp_err_status_t srtp_unprotect_aead(srtp_ctx_t *ctx, unsigned int aad_len; srtp_hdr_xtnd_t *xtn_hdr = NULL; - debug_print(mod_srtp, "function srtp_unprotect_aead", NULL); + debug_print0(mod_srtp, "function srtp_unprotect_aead"); #ifdef NO_64BIT_MATH debug_print2(mod_srtp, "estimated u_packet index: %08x%08x", high32(est), low32(est)); #else - debug_print(mod_srtp, "estimated u_packet index: %016llx", est); + debug_print(mod_srtp, "estimated u_packet index: %016" PRIx64, est); #endif /* get tag length from stream */ @@ -2059,7 +2056,7 @@ srtp_err_status_t srtp_protect_mki(srtp_ctx_t *ctx, uint8_t *mki_location = NULL; int advance_packet_index = 0; - debug_print(mod_srtp, "function srtp_protect", NULL); + debug_print0(mod_srtp, "function srtp_protect"); /* we assume the hdr is 32-bit aligned to start */ @@ -2230,7 +2227,7 @@ srtp_err_status_t srtp_protect_mki(srtp_ctx_t *ctx, debug_print2(mod_srtp, "estimated packet index: %08x%08x", high32(est), low32(est)); #else - debug_print(mod_srtp, "estimated packet index: %016llx", est); + debug_print(mod_srtp, "estimated packet index: %016" PRIx64, est); #endif /* @@ -2336,7 +2333,7 @@ srtp_err_status_t srtp_protect_mki(srtp_ctx_t *ctx, return status; /* run auth func over ROC, put result into auth_tag */ - debug_print(mod_srtp, "estimated packet index: %016llx", est); + debug_print(mod_srtp, "estimated packet index: %016" PRIx64, est); status = srtp_auth_compute(session_keys->rtp_auth, (uint8_t *)&est, 4, auth_tag); debug_print(mod_srtp, "srtp auth tag: %s", @@ -2389,7 +2386,7 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx, uint32_t roc_to_set = 0; uint16_t seq_to_set = 0; - debug_print(mod_srtp, "function srtp_unprotect", NULL); + debug_print0(mod_srtp, "function srtp_unprotect"); /* we assume the hdr is 32-bit aligned to start */ @@ -2458,7 +2455,7 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx, debug_print2(mod_srtp, "estimated u_packet index: %08x%08x", high32(est), low32(est)); #else - debug_print(mod_srtp, "estimated u_packet index: %016llx", est); + debug_print(mod_srtp, "estimated u_packet index: %016" PRIx64, est); #endif /* Determine if MKI is being used and what session keys should be used */ @@ -2600,8 +2597,10 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx, return status; /* now compute auth function over packet */ - srtp_auth_update(session_keys->rtp_auth, (uint8_t *)auth_start, + status = srtp_auth_update(session_keys->rtp_auth, (uint8_t *)auth_start, *pkt_octet_len - tag_len - mki_size); + if (status) + return status; /* run auth func over ROC, then write tmp tag */ status = srtp_auth_compute(session_keys->rtp_auth, (uint8_t *)&est, 4, @@ -2614,7 +2613,7 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx, if (status) return srtp_err_status_auth_fail; - if (octet_string_is_eq(tmp_tag, auth_tag, tag_len)) + if (srtp_octet_string_is_eq(tmp_tag, auth_tag, tag_len)) return srtp_err_status_auth_fail; } @@ -2750,25 +2749,6 @@ srtp_err_status_t srtp_shutdown() return srtp_err_status_ok; } -/* - * The following code is under consideration for removal. See - * SRTP_MAX_TRAILER_LEN - */ -#if 0 - -/* - * srtp_get_trailer_length(&a) returns the number of octets that will - * be added to an RTP packet by the SRTP processing. This value - * is constant for a given srtp_stream_t (i.e. between initializations). - */ - -int -srtp_get_trailer_length(const srtp_stream_t s) { - return srtp_auth_get_tag_length(s->rtp_auth); -} - -#endif - /* * srtp_get_stream(ssrc) returns a pointer to the stream corresponding * to ssrc, or NULL if no stream exists for that ssrc @@ -2831,6 +2811,11 @@ srtp_err_status_t srtp_add_stream(srtp_t session, const srtp_policy_t *policy) srtp_err_status_t status; srtp_stream_t tmp; + status = srtp_valid_policy(policy); + if (status != srtp_err_status_ok) { + return status; + } + /* sanity check arguments */ if ((session == NULL) || (policy == NULL) || (!srtp_validate_policy_master_keys(policy))) @@ -2893,6 +2878,11 @@ srtp_err_status_t srtp_create(srtp_t *session, /* handle for session */ srtp_err_status_t stat; srtp_ctx_t *ctx; + stat = srtp_valid_policy(policy); + if (stat != srtp_err_status_ok) { + return stat; + } + /* sanity check arguments */ if (session == NULL) return srtp_err_status_bad_param; @@ -2963,6 +2953,11 @@ srtp_err_status_t srtp_update(srtp_t session, const srtp_policy_t *policy) { srtp_err_status_t stat; + stat = srtp_valid_policy(policy); + if (stat != srtp_err_status_ok) { + return stat; + } + /* sanity check arguments */ if ((session == NULL) || (policy == NULL) || (!srtp_validate_policy_master_keys(policy))) { @@ -2988,6 +2983,11 @@ static srtp_err_status_t update_template_streams(srtp_t session, srtp_stream_t new_stream_template; srtp_stream_t new_stream_list = NULL; + status = srtp_valid_policy(policy); + if (status != srtp_err_status_ok) { + return status; + } + if (session->stream_template == NULL) { return srtp_err_status_bad_param; } @@ -3086,6 +3086,11 @@ static srtp_err_status_t update_stream(srtp_t session, srtp_rdb_t old_rtcp_rdb; srtp_stream_t stream; + status = srtp_valid_policy(policy); + if (status != srtp_err_status_ok) { + return status; + } + stream = srtp_get_stream(session, htonl(policy->ssrc.value)); if (stream == NULL) { return srtp_err_status_bad_param; @@ -3122,6 +3127,11 @@ srtp_err_status_t srtp_update_stream(srtp_t session, { srtp_err_status_t status; + status = srtp_valid_policy(policy); + if (status != srtp_err_status_ok) { + return status; + } + /* sanity check arguments */ if ((session == NULL) || (policy == NULL) || (!srtp_validate_policy_master_keys(policy))) @@ -3285,7 +3295,6 @@ void srtp_crypto_policy_set_aes_cm_256_null_auth(srtp_crypto_policy_t *p) p->sec_serv = sec_serv_conf; } -#ifdef OPENSSL void srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80(srtp_crypto_policy_t *p) { /* @@ -3407,8 +3416,6 @@ void srtp_crypto_policy_set_aes_gcm_256_16_auth(srtp_crypto_policy_t *p) p->sec_serv = sec_serv_conf_and_auth; } -#endif - /* * secure rtcp functions */ @@ -3496,7 +3503,8 @@ static srtp_err_status_t srtp_protect_rtcp_aead( { srtcp_hdr_t *hdr = (srtcp_hdr_t *)rtcp_hdr; uint32_t *enc_start; /* pointer to start of encrypted portion */ - uint32_t *trailer; /* pointer to start of trailer */ + uint32_t *trailer_p; /* pointer to start of trailer */ + uint32_t trailer; /* trailer value */ unsigned int enc_octet_len = 0; /* number of octets in encrypted portion */ uint8_t *auth_tag = NULL; /* location of auth_tag within packet */ srtp_err_status_t status; @@ -3519,18 +3527,15 @@ static srtp_err_status_t srtp_protect_rtcp_aead( /* NOTE: hdr->length is not usable - it refers to only the first * RTCP report in the compound packet! */ - /* NOTE: trailer is 32-bit aligned because RTCP 'packets' are always - * multiples of 32-bits (RFC 3550 6.1) - */ - trailer = (uint32_t *)((char *)enc_start + enc_octet_len + tag_len); + trailer_p = (uint32_t *)((char *)enc_start + enc_octet_len + tag_len); if (stream->rtcp_services & sec_serv_conf) { - *trailer = htonl(SRTCP_E_BIT); /* set encrypt bit */ + trailer = htonl(SRTCP_E_BIT); /* set encrypt bit */ } else { enc_start = NULL; enc_octet_len = 0; /* 0 is network-order independant */ - *trailer = 0x00000000; /* set encrypt bit */ + trailer = 0x00000000; /* set encrypt bit */ } mki_size = srtp_inject_mki((uint8_t *)hdr + *pkt_octet_len + tag_len + @@ -3554,9 +3559,11 @@ static srtp_err_status_t srtp_protect_rtcp_aead( return status; } seq_num = srtp_rdb_get_value(&stream->rtcp_rdb); - *trailer |= htonl(seq_num); + trailer |= htonl(seq_num); debug_print(mod_srtp, "srtcp index: %x", seq_num); + memcpy(trailer_p, &trailer, sizeof(trailer)); + /* * Calculate and set the IV */ @@ -3598,7 +3605,7 @@ static srtp_err_status_t srtp_protect_rtcp_aead( /* * Process the sequence# as AAD */ - tseq = *trailer; + tseq = trailer; status = srtp_cipher_set_aad(session_keys->rtcp_cipher, (uint8_t *)&tseq, sizeof(srtcp_trailer_t)); if (status) { @@ -3667,7 +3674,8 @@ static srtp_err_status_t srtp_unprotect_rtcp_aead( { srtcp_hdr_t *hdr = (srtcp_hdr_t *)srtcp_hdr; uint32_t *enc_start; /* pointer to start of encrypted portion */ - uint32_t *trailer; /* pointer to start of trailer */ + uint32_t *trailer_p; /* pointer to start of trailer */ + uint32_t trailer; /* trailer value */ unsigned int enc_octet_len = 0; /* number of octets in encrypted portion */ uint8_t *auth_tag = NULL; /* location of auth_tag within packet */ srtp_err_status_t status; @@ -3693,12 +3701,10 @@ static srtp_err_status_t srtp_unprotect_rtcp_aead( */ /* This should point trailer to the word past the end of the normal data. */ /* This would need to be modified for optional mikey data */ - /* - * NOTE: trailer is 32-bit aligned because RTCP 'packets' are always - * multiples of 32-bits (RFC 3550 6.1) - */ - trailer = (uint32_t *)((char *)hdr + *pkt_octet_len - - sizeof(srtcp_trailer_t) - mki_size); + trailer_p = (uint32_t *)((char *)hdr + *pkt_octet_len - + sizeof(srtcp_trailer_t) - mki_size); + memcpy(&trailer, trailer_p, sizeof(trailer)); + /* * We pass the tag down to the cipher when doing GCM mode */ @@ -3707,7 +3713,7 @@ static srtp_err_status_t srtp_unprotect_rtcp_aead( auth_tag = (uint8_t *)hdr + *pkt_octet_len - tag_len - mki_size - sizeof(srtcp_trailer_t); - if (*((unsigned char *)trailer) & SRTCP_E_BYTE_BIT) { + if (*((unsigned char *)trailer_p) & SRTCP_E_BYTE_BIT) { enc_start = (uint32_t *)hdr + uint32s_in_rtcp_header; } else { enc_octet_len = 0; @@ -3718,7 +3724,7 @@ static srtp_err_status_t srtp_unprotect_rtcp_aead( * check the sequence number for replays */ /* this is easier than dealing with bitfield access */ - seq_num = ntohl(*trailer) & SRTCP_INDEX_MASK; + seq_num = ntohl(trailer) & SRTCP_INDEX_MASK; debug_print(mod_srtp, "srtcp index: %x", seq_num); status = srtp_rdb_check(&stream->rtcp_rdb, seq_num); if (status) { @@ -3768,7 +3774,7 @@ static srtp_err_status_t srtp_unprotect_rtcp_aead( /* * Process the sequence# as AAD */ - tseq = *trailer; + tseq = trailer; status = srtp_cipher_set_aad(session_keys->rtcp_cipher, (uint8_t *)&tseq, sizeof(srtcp_trailer_t)); if (status) { @@ -3866,7 +3872,8 @@ srtp_err_status_t srtp_protect_rtcp_mki(srtp_t ctx, srtcp_hdr_t *hdr = (srtcp_hdr_t *)rtcp_hdr; uint32_t *enc_start; /* pointer to start of encrypted portion */ uint32_t *auth_start; /* pointer to start of auth. portion */ - uint32_t *trailer; /* pointer to start of trailer */ + uint32_t *trailer_p; /* pointer to start of trailer */ + uint32_t trailer; /* trailer value */ unsigned int enc_octet_len = 0; /* number of octets in encrypted portion */ uint8_t *auth_tag = NULL; /* location of auth_tag within packet */ srtp_err_status_t status; @@ -3959,19 +3966,15 @@ srtp_err_status_t srtp_protect_rtcp_mki(srtp_t ctx, * NOTE: hdr->length is not usable - it refers to only the first RTCP report * in the compound packet! */ - /* - * NOTE: trailer is 32-bit aligned because RTCP 'packets' are always - * multiples of 32-bits (RFC 3550 6.1) - */ - trailer = (uint32_t *)((char *)enc_start + enc_octet_len); + trailer_p = (uint32_t *)((char *)enc_start + enc_octet_len); if (stream->rtcp_services & sec_serv_conf) { - *trailer = htonl(SRTCP_E_BIT); /* set encrypt bit */ + trailer = htonl(SRTCP_E_BIT); /* set encrypt bit */ } else { enc_start = NULL; enc_octet_len = 0; /* 0 is network-order independant */ - *trailer = 0x00000000; /* set encrypt bit */ + trailer = 0x00000000; /* set encrypt bit */ } mki_size = srtp_inject_mki((uint8_t *)hdr + *pkt_octet_len + @@ -3987,10 +3990,6 @@ srtp_err_status_t srtp_protect_rtcp_mki(srtp_t ctx, auth_tag = (uint8_t *)hdr + *pkt_octet_len + sizeof(srtcp_trailer_t) + mki_size; - /* perform EKT processing if needed */ - srtp_ekt_write_data(stream->ekt, auth_tag, tag_len, pkt_octet_len, - srtp_rdbx_get_packet_index(&stream->rtp_rdbx)); - /* * check sequence number for overruns, and copy it into the packet * if its value isn't too big @@ -3999,9 +3998,11 @@ srtp_err_status_t srtp_protect_rtcp_mki(srtp_t ctx, if (status) return status; seq_num = srtp_rdb_get_value(&stream->rtcp_rdb); - *trailer |= htonl(seq_num); + trailer |= htonl(seq_num); debug_print(mod_srtp, "srtcp index: %x", seq_num); + memcpy(trailer_p, &trailer, sizeof(trailer)); + /* * if we're using rindael counter mode, set nonce and seq */ @@ -4059,7 +4060,9 @@ srtp_err_status_t srtp_protect_rtcp_mki(srtp_t ctx, } /* initialize auth func context */ - srtp_auth_start(session_keys->rtcp_auth); + status = srtp_auth_start(session_keys->rtcp_auth); + if (status) + return status; /* * run auth func over packet (including trailer), and write the @@ -4097,11 +4100,11 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx, srtcp_hdr_t *hdr = (srtcp_hdr_t *)srtcp_hdr; uint32_t *enc_start; /* pointer to start of encrypted portion */ uint32_t *auth_start; /* pointer to start of auth. portion */ - uint32_t *trailer; /* pointer to start of trailer */ + uint32_t *trailer_p; /* pointer to start of trailer */ + uint32_t trailer; /* trailer value */ unsigned int enc_octet_len = 0; /* number of octets in encrypted portion */ uint8_t *auth_tag = NULL; /* location of auth_tag within packet */ uint8_t tmp_tag[SRTP_MAX_TAG_LEN]; - uint8_t tag_copy[SRTP_MAX_TAG_LEN]; srtp_err_status_t status; unsigned int auth_len; int tag_len; @@ -4139,23 +4142,6 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx, if (ctx->stream_template != NULL) { stream = ctx->stream_template; - /* - * check to see if stream_template has an EKT data structure, in - * which case we initialize the template using the EKT policy - * referenced by that data (which consists of decrypting the - * master key from the EKT field) - * - * this function initializes a *provisional* stream, and this - * stream should not be accepted until and unless the packet - * passes its authentication check - */ - if (stream->ekt != NULL) { - status = srtp_stream_init_from_ekt(stream, srtcp_hdr, - *pkt_octet_len); - if (status) - return status; - } - debug_print(mod_srtp, "srtcp using provisional stream (SSRC: 0x%08x)", ntohl(hdr->ssrc)); @@ -4215,14 +4201,12 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx, */ /* This should point trailer to the word past the end of the normal data. */ /* This would need to be modified for optional mikey data */ - /* - * NOTE: trailer is 32-bit aligned because RTCP 'packets' are always - * multiples of 32-bits (RFC 3550 6.1) - */ - trailer = (uint32_t *)((char *)hdr + *pkt_octet_len - - (tag_len + mki_size + sizeof(srtcp_trailer_t))); + trailer_p = (uint32_t *)((char *)hdr + *pkt_octet_len - + (tag_len + mki_size + sizeof(srtcp_trailer_t))); + memcpy(&trailer, trailer_p, sizeof(trailer)); + e_bit_in_packet = - (*((unsigned char *)trailer) & SRTCP_E_BYTE_BIT) == SRTCP_E_BYTE_BIT; + (*((unsigned char *)trailer_p) & SRTCP_E_BYTE_BIT) == SRTCP_E_BYTE_BIT; if (e_bit_in_packet != sec_serv_confidentiality) { return srtp_err_status_cant_check; } @@ -4247,26 +4231,11 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx, auth_len = *pkt_octet_len - tag_len - mki_size; auth_tag = (uint8_t *)hdr + auth_len + mki_size; - /* - * if EKT is in use, then we make a copy of the tag from the packet, - * and then zeroize the location of the base tag - * - * we first re-position the auth_tag pointer so that it points to - * the base tag - */ - if (stream->ekt) { - auth_tag -= srtp_ekt_octets_after_base_tag(stream->ekt); - memcpy(tag_copy, auth_tag, tag_len); - octet_string_set_to_zero(auth_tag, tag_len); - auth_tag = tag_copy; - auth_len += tag_len; - } - /* * check the sequence number for replays */ /* this is easier than dealing with bitfield access */ - seq_num = ntohl(*trailer) & SRTCP_INDEX_MASK; + seq_num = ntohl(trailer) & SRTCP_INDEX_MASK; debug_print(mod_srtp, "srtcp index: %x", seq_num); status = srtp_rdb_check(&stream->rtcp_rdb, seq_num); if (status) @@ -4302,7 +4271,9 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx, return srtp_err_status_cipher_fail; /* initialize auth func context */ - srtp_auth_start(session_keys->rtcp_auth); + status = srtp_auth_start(session_keys->rtcp_auth); + if (status) + return status; /* run auth func over packet, put result into tmp_tag */ status = srtp_auth_compute(session_keys->rtcp_auth, (uint8_t *)auth_start, @@ -4315,7 +4286,7 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx, /* compare the tag just computed with the one in the packet */ debug_print(mod_srtp, "srtcp tag from packet: %s", srtp_octet_string_hex_string(auth_tag, tag_len)); - if (octet_string_is_eq(tmp_tag, auth_tag, tag_len)) + if (srtp_octet_string_is_eq(tmp_tag, auth_tag, tag_len)) return srtp_err_status_auth_fail; /* @@ -4346,12 +4317,6 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx, /* decrease the packet length by the length of the mki_size */ *pkt_octet_len -= mki_size; - /* - * if EKT is in effect, subtract the EKT data out of the packet - * length - */ - *pkt_octet_len -= srtp_ekt_octets_after_base_tag(stream->ekt); - /* * verify that stream is for received traffic - this check will * detect SSRC collisions, since a stream that appears in both @@ -4418,10 +4383,6 @@ void *srtp_get_user_data(srtp_t ctx) return ctx->user_data; } -/* - * dtls keying for srtp - */ - srtp_err_status_t srtp_crypto_policy_set_from_profile_for_rtp( srtp_crypto_policy_t *policy, srtp_profile_t profile) @@ -4437,7 +4398,7 @@ srtp_err_status_t srtp_crypto_policy_set_from_profile_for_rtp( case srtp_profile_null_sha1_80: srtp_crypto_policy_set_null_cipher_hmac_sha1_80(policy); break; -#if defined(OPENSSL) +#ifdef GCM case srtp_profile_aead_aes_128_gcm: srtp_crypto_policy_set_aes_gcm_128_16_auth(policy); break; @@ -4471,7 +4432,7 @@ srtp_err_status_t srtp_crypto_policy_set_from_profile_for_rtcp( case srtp_profile_null_sha1_80: srtp_crypto_policy_set_null_cipher_hmac_sha1_80(policy); break; -#if defined(OPENSSL) +#ifdef GCM case srtp_profile_aead_aes_128_gcm: srtp_crypto_policy_set_aes_gcm_128_16_auth(policy); break; @@ -4552,10 +4513,10 @@ srtp_err_status_t stream_get_protect_trailer_length(srtp_stream_ctx_t *stream, uint32_t mki_index, uint32_t *length) { - *length = 0; - srtp_session_keys_t *session_key; + *length = 0; + if (use_mki) { if (mki_index >= stream->num_master_keys) { return srtp_err_status_bad_mki; diff --git a/libs/srtp/srtp2.vcxproj b/libs/srtp/srtp2.vcxproj index a6ac642546..2e2e8223dc 100644 --- a/libs/srtp/srtp2.vcxproj +++ b/libs/srtp/srtp2.vcxproj @@ -1,405 +1,403 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug Dll|Win32"> - <Configuration>Debug Dll</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug Dll|x64"> - <Configuration>Debug Dll</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release Dll|Win32"> - <Configuration>Release Dll</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release Dll|x64"> - <Configuration>Release Dll</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{EEF031CB-FED8-451E-A471-91EC8D4F6750}</ProjectGuid> - <RootNamespace>srtp2</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <OutDir>$(SolutionDir)$(Configuration)\</OutDir> - <IntDir>$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <OutDir>$(SolutionDir)$(Configuration)\</OutDir> - <IntDir>$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'"> - <OutDir>$(SolutionDir)$(Configuration)\</OutDir> - <IntDir>$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|Win32'"> - <OutDir>$(SolutionDir)$(Configuration)\</OutDir> - <IntDir>$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|x64'" /> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <PreBuildEvent> - <Message>Creating config.h from config.hw</Message> - <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> - </PreBuildEvent> - <CustomBuildStep> - <Message /> - <Command /> - </CustomBuildStep> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader /> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <PreBuildEvent> - <Message>Creating config.h from config.hw</Message> - <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> - </PreBuildEvent> - <CustomBuildStep> - <Message> - </Message> - <Command> - </Command> - </CustomBuildStep> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <PreBuildEvent> - <Message>Creating config.h from config.hw</Message> - <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> - </PreBuildEvent> - <CustomBuildStep> - <Message /> - <Command /> - </CustomBuildStep> - <ClCompile> - <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader /> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <PreBuildEvent> - <Message>Creating config.h from config.hw</Message> - <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> - </PreBuildEvent> - <CustomBuildStep> - <Message> - </Message> - <Command> - </Command> - </CustomBuildStep> - <ClCompile> - <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'"> - <PreBuildEvent> - <Message>Creating config.h from config.hw</Message> - <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> - </PreBuildEvent> - <CustomBuildStep> - <Message /> - <Command /> - </CustomBuildStep> - <ClCompile> - <Optimization>Disabled</Optimization> - <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader /> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - <FunctionLevelLinking>true</FunctionLevelLinking> - </ClCompile> - <Link> - <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <ModuleDefinitionFile>srtp.def</ModuleDefinitionFile> - <OptimizeReferences>false</OptimizeReferences> - <EnableCOMDATFolding>false</EnableCOMDATFolding> - <LinkTimeCodeGeneration /> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'"> - <PreBuildEvent> - <Message>Creating config.h from config.hw</Message> - <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> - </PreBuildEvent> - <CustomBuildStep> - <Message> - </Message> - <Command> - </Command> - </CustomBuildStep> - <ClCompile> - <Optimization>Disabled</Optimization> - <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <ModuleDefinitionFile>srtp.def</ModuleDefinitionFile> - <OptimizeReferences>false</OptimizeReferences> - <EnableCOMDATFolding>false</EnableCOMDATFolding> - <LinkTimeCodeGeneration> - </LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|Win32'"> - <PreBuildEvent> - <Message>Creating config.h from config.hw</Message> - <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> - </PreBuildEvent> - <CustomBuildStep> - <Message /> - <Command /> - </CustomBuildStep> - <ClCompile> - <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader /> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <ModuleDefinitionFile>srtp.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|x64'"> - <PreBuildEvent> - <Message>Creating config.h from config.hw</Message> - <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> - </PreBuildEvent> - <CustomBuildStep> - <Message> - </Message> - <Command> - </Command> - </CustomBuildStep> - <ClCompile> - <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <ModuleDefinitionFile>srtp.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="crypto\cipher\aes.c"> - <InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'">Default</InlineFunctionExpansion> - <InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'">Default</InlineFunctionExpansion> - <IntrinsicFunctions Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'">false</IntrinsicFunctions> - <IntrinsicFunctions Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'">false</IntrinsicFunctions> - <FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'">false</FunctionLevelLinking> - <FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'">false</FunctionLevelLinking> - </ClCompile> - <ClCompile Include="crypto\cipher\aes_icm.c" /> - <ClCompile Include="crypto\cipher\cipher.c" /> - <ClCompile Include="crypto\cipher\null_cipher.c" /> - <ClCompile Include="crypto\hash\auth.c" /> - <ClCompile Include="crypto\hash\hmac.c" /> - <ClCompile Include="crypto\hash\null_auth.c" /> - <ClCompile Include="crypto\hash\sha1.c" /> - <ClCompile Include="crypto\kernel\alloc.c" /> - <ClCompile Include="crypto\kernel\crypto_kernel.c" /> - <ClCompile Include="crypto\kernel\err.c" /> - <ClCompile Include="crypto\kernel\key.c" /> - <ClCompile Include="crypto\math\datatypes.c" /> - <ClCompile Include="crypto\math\stat.c" /> - <ClCompile Include="crypto\replay\rdb.c" /> - <ClCompile Include="crypto\replay\rdbx.c" /> - <ClCompile Include="crypto\replay\ut_sim.c" /> - <ClCompile Include="srtp\ekt.c" /> - <ClCompile Include="srtp\srtp.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="crypto\include\aes.h" /> - <ClInclude Include="crypto\include\aes_cbc.h" /> - <ClInclude Include="crypto\include\aes_icm.h" /> - <ClInclude Include="crypto\include\alloc.h" /> - <ClInclude Include="crypto\include\auth.h" /> - <ClInclude Include="crypto\include\cipher.h" /> - <ClInclude Include="crypto\include\cipher_types.h" /> - <ClInclude Include="crypto\include\config.h" /> - <ClInclude Include="crypto\include\crypto.h" /> - <ClInclude Include="crypto\include\cryptoalg.h" /> - <ClInclude Include="crypto\include\crypto_kernel.h" /> - <ClInclude Include="crypto\include\crypto_types.h" /> - <ClInclude Include="crypto\include\datatypes.h" /> - <ClInclude Include="crypto\include\err.h" /> - <ClInclude Include="crypto\include\gf2_8.h" /> - <ClInclude Include="crypto\include\hmac.h" /> - <ClInclude Include="crypto\include\integers.h" /> - <ClInclude Include="crypto\include\key.h" /> - <ClInclude Include="crypto\include\null_auth.h" /> - <ClInclude Include="crypto\include\null_cipher.h" /> - <ClInclude Include="crypto\include\prng.h" /> - <ClInclude Include="crypto\include\rand_source.h" /> - <ClInclude Include="crypto\include\rdb.h" /> - <ClInclude Include="crypto\include\rdbx.h" /> - <ClInclude Include="crypto\include\sha1.h" /> - <ClInclude Include="crypto\include\stat.h" /> - <ClInclude Include="include\ekt.h" /> - <ClInclude Include="include\srtp.h" /> - <ClInclude Include="include\srtp_priv.h" /> - <ClInclude Include="include\ut_sim.h" /> - </ItemGroup> - <ItemGroup> - <None Include="config.hw" /> - <None Include="srtp.def" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug Dll|Win32"> + <Configuration>Debug Dll</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug Dll|x64"> + <Configuration>Debug Dll</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release Dll|Win32"> + <Configuration>Release Dll</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release Dll|x64"> + <Configuration>Release Dll</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{EEF031CB-FED8-451E-A471-91EC8D4F6750}</ProjectGuid> + <RootNamespace>srtp2</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <Import Project="$(SolutionDir)\..\..\w32\openssl.props" Condition=" '$(OpensslPropsImported)' == '' " /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> + <IntDir>$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> + <IntDir>$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'"> + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> + <IntDir>$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|Win32'"> + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> + <IntDir>$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|x64'" /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <PreBuildEvent> + <Message>Creating config.h from config.hw</Message> + <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> + </PreBuildEvent> + <CustomBuildStep> + <Message /> + <Command /> + </CustomBuildStep> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <StructMemberAlignment>Default</StructMemberAlignment> + <PrecompiledHeader /> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <PreBuildEvent> + <Message>Creating config.h from config.hw</Message> + <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> + </PreBuildEvent> + <CustomBuildStep> + <Message> + </Message> + <Command> + </Command> + </CustomBuildStep> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <StructMemberAlignment>Default</StructMemberAlignment> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <PreBuildEvent> + <Message>Creating config.h from config.hw</Message> + <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> + </PreBuildEvent> + <CustomBuildStep> + <Message /> + <Command /> + </CustomBuildStep> + <ClCompile> + <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <StructMemberAlignment>Default</StructMemberAlignment> + <PrecompiledHeader /> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <PreBuildEvent> + <Message>Creating config.h from config.hw</Message> + <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> + </PreBuildEvent> + <CustomBuildStep> + <Message> + </Message> + <Command> + </Command> + </CustomBuildStep> + <ClCompile> + <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <StructMemberAlignment>Default</StructMemberAlignment> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'"> + <PreBuildEvent> + <Message>Creating config.h from config.hw</Message> + <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> + </PreBuildEvent> + <CustomBuildStep> + <Message /> + <Command /> + </CustomBuildStep> + <ClCompile> + <Optimization>Disabled</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <StructMemberAlignment>Default</StructMemberAlignment> + <PrecompiledHeader /> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <FunctionLevelLinking>true</FunctionLevelLinking> + </ClCompile> + <Link> + <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>srtp.def</ModuleDefinitionFile> + <OptimizeReferences>false</OptimizeReferences> + <EnableCOMDATFolding>false</EnableCOMDATFolding> + <LinkTimeCodeGeneration /> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'"> + <PreBuildEvent> + <Message>Creating config.h from config.hw</Message> + <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> + </PreBuildEvent> + <CustomBuildStep> + <Message> + </Message> + <Command> + </Command> + </CustomBuildStep> + <ClCompile> + <Optimization>Disabled</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <StructMemberAlignment>Default</StructMemberAlignment> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>srtp.def</ModuleDefinitionFile> + <OptimizeReferences>false</OptimizeReferences> + <EnableCOMDATFolding>false</EnableCOMDATFolding> + <LinkTimeCodeGeneration> + </LinkTimeCodeGeneration> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|Win32'"> + <PreBuildEvent> + <Message>Creating config.h from config.hw</Message> + <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> + </PreBuildEvent> + <CustomBuildStep> + <Message /> + <Command /> + </CustomBuildStep> + <ClCompile> + <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <StructMemberAlignment>Default</StructMemberAlignment> + <PrecompiledHeader /> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>srtp.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dll|x64'"> + <PreBuildEvent> + <Message>Creating config.h from config.hw</Message> + <Command>copy /Y "$(ProjectDir)config.hw" "$(ProjectDir)crypto\include\config.h" &gt; NUL</Command> + </PreBuildEvent> + <CustomBuildStep> + <Message> + </Message> + <Command> + </Command> + </CustomBuildStep> + <ClCompile> + <AdditionalIncludeDirectories>crypto/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <StructMemberAlignment>Default</StructMemberAlignment> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>srtp.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="crypto\cipher\aes.c"> + <InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'">Default</InlineFunctionExpansion> + <InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'">Default</InlineFunctionExpansion> + <IntrinsicFunctions Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'">false</IntrinsicFunctions> + <IntrinsicFunctions Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'">false</IntrinsicFunctions> + <FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Debug Dll|Win32'">false</FunctionLevelLinking> + <FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Debug Dll|x64'">false</FunctionLevelLinking> + </ClCompile> + <ClCompile Include="crypto\cipher\aes_icm.c" /> + <ClCompile Include="crypto\cipher\cipher.c" /> + <ClCompile Include="crypto\cipher\cipher_test_cases.c" /> + <ClCompile Include="crypto\cipher\null_cipher.c" /> + <ClCompile Include="crypto\hash\auth.c" /> + <ClCompile Include="crypto\hash\auth_test_cases.c" /> + <ClCompile Include="crypto\hash\hmac.c" /> + <ClCompile Include="crypto\hash\null_auth.c" /> + <ClCompile Include="crypto\hash\sha1.c" /> + <ClCompile Include="crypto\kernel\alloc.c" /> + <ClCompile Include="crypto\kernel\crypto_kernel.c" /> + <ClCompile Include="crypto\kernel\err.c" /> + <ClCompile Include="crypto\kernel\key.c" /> + <ClCompile Include="crypto\math\datatypes.c" /> + <ClCompile Include="crypto\replay\rdb.c" /> + <ClCompile Include="crypto\replay\rdbx.c" /> + <ClCompile Include="srtp\srtp.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="crypto\include\aes.h" /> + <ClInclude Include="crypto\include\aes_cbc.h" /> + <ClInclude Include="crypto\include\aes_icm.h" /> + <ClInclude Include="crypto\include\alloc.h" /> + <ClInclude Include="crypto\include\auth.h" /> + <ClInclude Include="crypto\include\cipher.h" /> + <ClInclude Include="crypto\include\cipher_types.h" /> + <ClInclude Include="crypto\include\config.h" /> + <ClInclude Include="crypto\include\crypto.h" /> + <ClInclude Include="crypto\include\cryptoalg.h" /> + <ClInclude Include="crypto\include\crypto_kernel.h" /> + <ClInclude Include="crypto\include\crypto_types.h" /> + <ClInclude Include="crypto\include\datatypes.h" /> + <ClInclude Include="crypto\include\err.h" /> + <ClInclude Include="crypto\include\gf2_8.h" /> + <ClInclude Include="crypto\include\hmac.h" /> + <ClInclude Include="crypto\include\integers.h" /> + <ClInclude Include="crypto\include\key.h" /> + <ClInclude Include="crypto\include\null_auth.h" /> + <ClInclude Include="crypto\include\null_cipher.h" /> + <ClInclude Include="crypto\include\prng.h" /> + <ClInclude Include="crypto\include\rand_source.h" /> + <ClInclude Include="crypto\include\rdb.h" /> + <ClInclude Include="crypto\include\rdbx.h" /> + <ClInclude Include="crypto\include\sha1.h" /> + <ClInclude Include="include\ekt.h" /> + <ClInclude Include="include\srtp.h" /> + <ClInclude Include="include\srtp_priv.h" /> + </ItemGroup> + <ItemGroup> + <None Include="config.hw" /> + <None Include="srtp.def" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/srtp/srtp2.vcxproj.filters b/libs/srtp/srtp2.vcxproj.filters index 24e040fb5b..7ac5887623 100644 --- a/libs/srtp/srtp2.vcxproj.filters +++ b/libs/srtp/srtp2.vcxproj.filters @@ -1,189 +1,180 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Source Files\Kernel"> - <UniqueIdentifier>{c23c2703-7a15-4b7e-be1c-0555b7d0f8e1}</UniqueIdentifier> - </Filter> - <Filter Include="Source Files\Ciphers"> - <UniqueIdentifier>{43e45f3f-795e-4f2a-8801-3e19b7801d07}</UniqueIdentifier> - </Filter> - <Filter Include="Source Files\Hashes"> - <UniqueIdentifier>{11a7bf2a-6706-4c35-8e91-f58bef0f8669}</UniqueIdentifier> - </Filter> - <Filter Include="Source Files\Replay"> - <UniqueIdentifier>{237501ce-7043-44c7-a895-df2ceae6c8cd}</UniqueIdentifier> - </Filter> - <Filter Include="Source Files\Math"> - <UniqueIdentifier>{2a11592a-e474-4a50-bb3a-e4f039633257}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="srtp\ekt.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="srtp\srtp.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="crypto\kernel\alloc.c"> - <Filter>Source Files\Kernel</Filter> - </ClCompile> - <ClCompile Include="crypto\kernel\crypto_kernel.c"> - <Filter>Source Files\Kernel</Filter> - </ClCompile> - <ClCompile Include="crypto\kernel\err.c"> - <Filter>Source Files\Kernel</Filter> - </ClCompile> - <ClCompile Include="crypto\kernel\key.c"> - <Filter>Source Files\Kernel</Filter> - </ClCompile> - <ClCompile Include="crypto\cipher\aes.c"> - <Filter>Source Files\Ciphers</Filter> - </ClCompile> - <ClCompile Include="crypto\cipher\aes_icm.c"> - <Filter>Source Files\Ciphers</Filter> - </ClCompile> - <ClCompile Include="crypto\cipher\cipher.c"> - <Filter>Source Files\Ciphers</Filter> - </ClCompile> - <ClCompile Include="crypto\cipher\null_cipher.c"> - <Filter>Source Files\Ciphers</Filter> - </ClCompile> - <ClCompile Include="crypto\hash\auth.c"> - <Filter>Source Files\Hashes</Filter> - </ClCompile> - <ClCompile Include="crypto\hash\hmac.c"> - <Filter>Source Files\Hashes</Filter> - </ClCompile> - <ClCompile Include="crypto\hash\null_auth.c"> - <Filter>Source Files\Hashes</Filter> - </ClCompile> - <ClCompile Include="crypto\hash\sha1.c"> - <Filter>Source Files\Hashes</Filter> - </ClCompile> - <ClCompile Include="crypto\replay\rdb.c"> - <Filter>Source Files\Replay</Filter> - </ClCompile> - <ClCompile Include="crypto\replay\rdbx.c"> - <Filter>Source Files\Replay</Filter> - </ClCompile> - <ClCompile Include="crypto\replay\ut_sim.c"> - <Filter>Source Files\Replay</Filter> - </ClCompile> - <ClCompile Include="crypto\math\datatypes.c"> - <Filter>Source Files\Math</Filter> - </ClCompile> - <ClCompile Include="crypto\math\stat.c"> - <Filter>Source Files\Math</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="crypto\include\aes.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\aes_cbc.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\aes_icm.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\alloc.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\auth.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\cipher.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\cipher_types.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\config.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\crypto.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\crypto_kernel.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\crypto_types.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\cryptoalg.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\datatypes.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="include\ekt.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\err.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\gf2_8.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\hmac.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\integers.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\key.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\null_auth.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\null_cipher.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\prng.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\rand_source.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\rdb.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\rdbx.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\sha1.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="include\srtp.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="include\srtp_priv.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="crypto\include\stat.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="include\ut_sim.h"> - <Filter>Header Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <None Include="config.hw" /> - <None Include="srtp.def"> - <Filter>Source Files</Filter> - </None> - </ItemGroup> -</Project> +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Source Files\Kernel"> + <UniqueIdentifier>{c23c2703-7a15-4b7e-be1c-0555b7d0f8e1}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\Ciphers"> + <UniqueIdentifier>{43e45f3f-795e-4f2a-8801-3e19b7801d07}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\Hashes"> + <UniqueIdentifier>{11a7bf2a-6706-4c35-8e91-f58bef0f8669}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\Replay"> + <UniqueIdentifier>{237501ce-7043-44c7-a895-df2ceae6c8cd}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\Math"> + <UniqueIdentifier>{2a11592a-e474-4a50-bb3a-e4f039633257}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="srtp\srtp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="crypto\kernel\alloc.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\kernel\crypto_kernel.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\kernel\err.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\kernel\key.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\aes.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\aes_icm.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\cipher.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\null_cipher.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\auth.c"> + <Filter>Source Files\Hashes</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\hmac.c"> + <Filter>Source Files\Hashes</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\null_auth.c"> + <Filter>Source Files\Hashes</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\sha1.c"> + <Filter>Source Files\Hashes</Filter> + </ClCompile> + <ClCompile Include="crypto\replay\rdb.c"> + <Filter>Source Files\Replay</Filter> + </ClCompile> + <ClCompile Include="crypto\replay\rdbx.c"> + <Filter>Source Files\Replay</Filter> + </ClCompile> + <ClCompile Include="crypto\math\datatypes.c"> + <Filter>Source Files\Math</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\cipher_test_cases.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\auth_test_cases.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="crypto\include\aes.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\aes_cbc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\aes_icm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\alloc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\auth.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\cipher.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\cipher_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\crypto.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\crypto_kernel.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\crypto_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\cryptoalg.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\datatypes.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\ekt.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\err.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\gf2_8.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\hmac.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\integers.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\key.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\null_auth.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\null_cipher.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\prng.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\rand_source.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\rdb.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\rdbx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\sha1.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\srtp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\srtp_priv.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="config.hw" /> + <None Include="srtp.def"> + <Filter>Source Files</Filter> + </None> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/srtp/test/Makefile.am b/libs/srtp/test/Makefile.am deleted file mode 100644 index 444f730431..0000000000 --- a/libs/srtp/test/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -AUTOMAKE_OPTIONS = gnu -AM_CFLAGS = $(new_AM_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir)/crypto/include -AM_CPPFLAGS = $(AM_CFLAGS) -AM_LDFLAGS = $(new_AM_LDFLAGS) -L$(srcdir) -lsrtp - -check_PROGRAMS = cipher_driver kernel_driver rdbx_driver srtp_driver roc_driver replay_driver \ - aes_calc datatypes_driver sha1_driver stat_driver rtpw - -cipher_driver_SOURCES = crypto/cipher_driver.c -kernel_driver_SOURCES = crypto/kernel_driver.c -aes_calc_SOURCES = crypto/aes_calc.c -datatypes_driver_SOURCES = crypto/datatypes_driver.c -sha1_driver_SOURCES = crypto/sha1_driver.c -stat_driver_SOURCES = crypto/stat_driver.c -rdbx_driver_SOURCES = rdbx_driver.c -srtp_driver_SOURCES = srtp_driver.c -roc_driver_SOURCES = roc_driver.c -replay_driver_SOURCES = replay_driver.c -rtpw_SOURCES = rtpw.c rtp.c -rtpw_LDADD = -lnsl -lsocket - -check-local: cipher_driver - ./cipher_driver -v - ./kernel_driver -v - ./rdbx_driver -v - ./srtp_driver -v - ./roc_driver -v - ./replay_driver -v - ./datatypes_driver -v - ./stat_driver - ./sha1_driver -v - ./kernel_driver -v - diff --git a/libs/srtp/test/dtls_srtp_driver.c b/libs/srtp/test/dtls_srtp_driver.c deleted file mode 100644 index 4f4d0a39b3..0000000000 --- a/libs/srtp/test/dtls_srtp_driver.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * dtls_srtp_driver.c - * - * test driver for DTLS-SRTP functions - * - * David McGrew - * Cisco Systems, Inc. - */ -/* - * - * Copyright (c) 2001-2017 Cisco Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * Neither the name of the Cisco Systems, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <stdio.h> /* for printf() */ -#include "getopt_s.h" /* for local getopt() */ -#include "srtp_priv.h" - -srtp_err_status_t test_dtls_srtp(void); - -srtp_hdr_t *srtp_create_test_packet(int pkt_octet_len, uint32_t ssrc); - -void usage(char *prog_name) -{ - printf("usage: %s [ -t ][ -c ][ -v ][-d <debug_module> ]* [ -l ]\n" - " -d <mod> turn on debugging module <mod>\n" - " -l list debugging modules\n", - prog_name); - exit(1); -} - -int main(int argc, char *argv[]) -{ - unsigned do_list_mods = 0; - int q; - srtp_err_status_t err; - - printf("dtls_srtp_driver\n"); - - /* initialize srtp library */ - err = srtp_init(); - if (err) { - printf("error: srtp init failed with error code %d\n", err); - exit(1); - } - - /* process input arguments */ - while (1) { - q = getopt_s(argc, argv, "ld:"); - if (q == -1) - break; - switch (q) { - case 'l': - do_list_mods = 1; - break; - case 'd': - err = srtp_crypto_kernel_set_debug_module(optarg_s, 1); - if (err) { - printf("error: set debug module (%s) failed\n", optarg_s); - exit(1); - } - break; - default: - usage(argv[0]); - } - } - - if (do_list_mods) { - err = srtp_crypto_kernel_list_debug_modules(); - if (err) { - printf("error: list of debug modules failed\n"); - exit(1); - } - } - - printf("testing dtls_srtp..."); - err = test_dtls_srtp(); - if (err) { - printf("\nerror (code %d)\n", err); - exit(1); - } - printf("passed\n"); - - /* shut down srtp library */ - err = srtp_shutdown(); - if (err) { - printf("error: srtp shutdown failed with error code %d\n", err); - exit(1); - } - - return 0; -} - -srtp_err_status_t test_dtls_srtp(void) -{ - srtp_hdr_t *test_packet; - int test_packet_len = 80; - srtp_t s; - srtp_policy_t policy; - uint8_t key[SRTP_MAX_KEY_LEN]; - uint8_t salt[SRTP_MAX_KEY_LEN]; - unsigned int key_len, salt_len; - srtp_profile_t profile; - srtp_err_status_t err; - - memset(&policy, 0x0, sizeof(srtp_policy_t)); - - /* create a 'null' SRTP session */ - err = srtp_create(&s, NULL); - if (err) - return err; - - /* - * verify that packet-processing functions behave properly - we - * expect that these functions will return srtp_err_status_no_ctx - */ - test_packet = srtp_create_test_packet(80, 0xa5a5a5a5); - if (test_packet == NULL) - return srtp_err_status_alloc_fail; - - err = srtp_protect(s, test_packet, &test_packet_len); - if (err != srtp_err_status_no_ctx) { - printf("wrong return value from srtp_protect() (got code %d)\n", err); - return srtp_err_status_fail; - } - - err = srtp_unprotect(s, test_packet, &test_packet_len); - if (err != srtp_err_status_no_ctx) { - printf("wrong return value from srtp_unprotect() (got code %d)\n", err); - return srtp_err_status_fail; - } - - err = srtp_protect_rtcp(s, test_packet, &test_packet_len); - if (err != srtp_err_status_no_ctx) { - printf("wrong return value from srtp_protect_rtcp() (got code %d)\n", - err); - return srtp_err_status_fail; - } - - err = srtp_unprotect_rtcp(s, test_packet, &test_packet_len); - if (err != srtp_err_status_no_ctx) { - printf("wrong return value from srtp_unprotect_rtcp() (got code %d)\n", - err); - return srtp_err_status_fail; - } - - /* - * set keys to known values for testing - */ - profile = srtp_profile_aes128_cm_sha1_80; - key_len = srtp_profile_get_master_key_length(profile); - salt_len = srtp_profile_get_master_salt_length(profile); - memset(key, 0xff, key_len); - memset(salt, 0xee, salt_len); - srtp_append_salt_to_key(key, key_len, salt, salt_len); - policy.key = key; - - /* initialize SRTP policy from profile */ - err = srtp_crypto_policy_set_from_profile_for_rtp(&policy.rtp, profile); - if (err) - return err; - err = srtp_crypto_policy_set_from_profile_for_rtcp(&policy.rtcp, profile); - if (err) - return err; - policy.ssrc.type = ssrc_any_inbound; - policy.ekt = NULL; - policy.window_size = 128; - policy.allow_repeat_tx = 0; - policy.next = NULL; - - err = srtp_add_stream(s, &policy); - if (err) - return err; - - err = srtp_dealloc(s); - if (err) - return err; - - free(test_packet); - - return srtp_err_status_ok; -} - -/* - * srtp_create_test_packet(len, ssrc) returns a pointer to a - * (malloced) example RTP packet whose data field has the length given - * by pkt_octet_len and the SSRC value ssrc. The total length of the - * packet is twelve octets longer, since the header is at the - * beginning. There is room at the end of the packet for a trailer, - * and the four octets following the packet are filled with 0xff - * values to enable testing for overwrites. - * - * note that the location of the test packet can (and should) be - * deallocated with the free() call once it is no longer needed. - */ - -srtp_hdr_t *srtp_create_test_packet(int pkt_octet_len, uint32_t ssrc) -{ - int i; - uint8_t *buffer; - srtp_hdr_t *hdr; - int bytes_in_hdr = 12; - - /* allocate memory for test packet */ - hdr = malloc(pkt_octet_len + bytes_in_hdr + SRTP_MAX_TRAILER_LEN + 4); - if (!hdr) - return NULL; - - hdr->version = 2; /* RTP version two */ - hdr->p = 0; /* no padding needed */ - hdr->x = 0; /* no header extension */ - hdr->cc = 0; /* no CSRCs */ - hdr->m = 0; /* marker bit */ - hdr->pt = 0xf; /* payload type */ - hdr->seq = htons(0x1234); /* sequence number */ - hdr->ts = htonl(0xdecafbad); /* timestamp */ - hdr->ssrc = htonl(ssrc); /* synch. source */ - - buffer = (uint8_t *)hdr; - buffer += bytes_in_hdr; - - /* set RTP data to 0xab */ - for (i = 0; i < pkt_octet_len; i++) - *buffer++ = 0xab; - - /* set post-data value to 0xffff to enable overrun checking */ - for (i = 0; i < SRTP_MAX_TRAILER_LEN + 4; i++) - *buffer++ = 0xff; - - return hdr; -} diff --git a/libs/srtp/test/getopt_s.c b/libs/srtp/test/getopt_s.c index ab631878a4..e0bd7f77ed 100644 --- a/libs/srtp/test/getopt_s.c +++ b/libs/srtp/test/getopt_s.c @@ -58,8 +58,9 @@ static int getopt_check_character(char c, const char *string) while (*string != 0) { if (max_string_len == 0) { - return '?'; + return GETOPT_NOT_FOUND; } + max_string_len--; if (*string++ == c) { if (*string == ':') { return GETOPT_FOUND_WITH_ARGUMENT; diff --git a/libs/srtp/include/getopt_s.h b/libs/srtp/test/getopt_s.h similarity index 100% rename from libs/srtp/include/getopt_s.h rename to libs/srtp/test/getopt_s.h diff --git a/libs/srtp/test/meson.build b/libs/srtp/test/meson.build new file mode 100644 index 0000000000..4a67912ebb --- /dev/null +++ b/libs/srtp/test/meson.build @@ -0,0 +1,77 @@ +# test suite + +# XXX: Makefile only runs test_srtp and srtp_driver with valgrind +add_test_setup('valgrind', + exe_wrapper: ['valgrind', '--leak-check=full'], + timeout_multiplier: 10) + +test_apps = [ + ['srtp_driver', {'extra_sources': 'util.c', 'run_args': '-v'}], + ['replay_driver', {'extra_sources': 'ut_sim.c', 'run_args': '-v'}], + ['roc_driver', {'extra_sources': 'ut_sim.c', 'run_args': '-v'}], + ['rdbx_driver', {'extra_sources': 'ut_sim.c', 'run_args': '-v'}], + ['test_srtp', {'run_args': '-v'}], + ['rtpw', {'extra_sources': ['rtp.c', 'util.c', '../crypto/math/datatypes.c'], 'define_test': false}], +] + +foreach t : test_apps + test_name = t.get(0) + test_dict = t.get(1, {}) + test_extra_sources = test_dict.get('extra_sources', []) + test_run_args = test_dict.get('run_args', []) + + test_exe = executable(test_name, + '@0@.c'.format(test_name), 'getopt_s.c', test_extra_sources, + include_directories: [config_incs, crypto_incs, srtp2_incs, test_incs], + dependencies: [srtp2_deps, syslibs], + link_with: libsrtp2_for_tests) + + if test_dict.get('define_test', true) + test(test_name, test_exe, args: test_run_args) + else + set_variable(test_name + '_exe', test_exe) + endif +endforeach + +# rtpw test needs to be run using shell scripts +can_run_rtpw = find_program('sh', 'bash', required: false).found() + +# Meson only passes the exe_wrapper to shell scripts starting 0.55 +if meson.is_cross_build() and meson.version().version_compare('<0.55') + can_run_rtpw = false +endif + +if can_run_rtpw + words_txt = files('words.txt') + + rtpw_test_sh = find_program('rtpw_test.sh', required: false) + if rtpw_test_sh.found() + test('rtpw_test', rtpw_test_sh, + args: ['-w', words_txt], + depends: rtpw_exe, + is_parallel: false, + workdir: meson.current_build_dir()) + endif + + rtpw_test_gcm_sh = find_program('rtpw_test_gcm.sh', required: false) + if (use_openssl or use_nss) and rtpw_test_gcm_sh.found() + test('rtpw_test_gcm', rtpw_test_gcm_sh, + args: ['-w', words_txt], + depends: rtpw_exe, + is_parallel: false, + workdir: meson.current_build_dir()) + endif +endif + +# rtp_decoder +pcap_dep = dependency('libpcap', required: get_option('pcap-tests')) + +if pcap_dep.found() + executable('rtp_decoder', + 'rtp_decoder.c', 'getopt_s.c', 'rtp.c', 'util.c', 'getopt_s.c', + '../crypto/math/datatypes.c', + include_directories: [config_incs, crypto_incs, srtp2_incs, test_incs], + dependencies: [srtp2_deps, pcap_dep, syslibs], + link_with: libsrtp2, + install: false) +endif diff --git a/libs/srtp/test/rdbx_driver.c b/libs/srtp/test/rdbx_driver.c index 609ce9c8e4..430e28389a 100644 --- a/libs/srtp/test/rdbx_driver.c +++ b/libs/srtp/test/rdbx_driver.c @@ -50,6 +50,7 @@ #include "getopt_s.h" /* for local getopt() */ #include "rdbx.h" +#include "cipher_priv.h" #ifdef ROC_TEST #error "srtp_rdbx_t won't work with ROC_TEST - bitmask same size as seq_median" @@ -129,13 +130,6 @@ int main(int argc, char *argv[]) return 0; } -void print_rdbx(srtp_rdbx_t *rdbx) -{ - char buf[2048]; - printf("rdbx: {%llu, %s}\n", (unsigned long long)(rdbx->index), - bitvector_bit_string(&rdbx->bitmask, buf, sizeof(buf))); -} - /* * rdbx_check_add(rdbx, idx) checks a known-to-be-good idx against * rdbx, then adds it. if a failure is detected (i.e., the check @@ -305,7 +299,7 @@ srtp_err_status_t test_replay_dbx(int num_trials, unsigned long ws) */ printf("\ttesting insertion with large gaps..."); for (idx = 0, ircvd = 0; (int)idx < num_trials; - idx++, ircvd += (1 << (rand() % 12))) { + idx++, ircvd += (1 << (srtp_cipher_rand_u32_for_tests() % 12))) { status = rdbx_check_add(&rdbx, ircvd); if (status) return status; @@ -320,8 +314,7 @@ srtp_err_status_t test_replay_dbx(int num_trials, unsigned long ws) return srtp_err_status_ok; } -#include <time.h> /* for clock() */ -#include <stdlib.h> /* for random() */ +#include <time.h> /* for clock() */ double rdbx_check_adds_per_second(int num_trials, unsigned long ws) { @@ -348,6 +341,9 @@ double rdbx_check_adds_per_second(int num_trials, unsigned long ws) ++failures; } timer = clock() - timer; + if (timer < 1) { + timer = 1; + } printf("number of failures: %d \n", failures); diff --git a/libs/srtp/test/replay_driver.c b/libs/srtp/test/replay_driver.c index a88224684f..9807e50c12 100644 --- a/libs/srtp/test/replay_driver.c +++ b/libs/srtp/test/replay_driver.c @@ -52,6 +52,8 @@ #include "rdb.h" #include "ut_sim.h" +#include "cipher_priv.h" + /* * num_trials defines the number of trials that are used in the * validation functions below @@ -80,12 +82,6 @@ int main(void) return 0; } -void print_rdb(srtp_rdb_t *rdb) -{ - printf("rdb: {%u, %s}\n", rdb->window_start, - v128_bit_string(&rdb->bitmask)); -} - srtp_err_status_t rdb_check_add(srtp_rdb_t *rdb, uint32_t idx) { if (srtp_rdb_check(rdb, idx) != srtp_err_status_ok) { @@ -189,7 +185,7 @@ srtp_err_status_t test_rdb_db() /* test insertion with large gaps */ for (idx = 0, ircvd = 0; idx < num_trials; - idx++, ircvd += (1 << (rand() % 10))) { + idx++, ircvd += (1 << (srtp_cipher_rand_u32_for_tests() % 10))) { err = rdb_check_add(&rdb, ircvd); if (err) return err; diff --git a/libs/srtp/test/roc_driver.c b/libs/srtp/test/roc_driver.c index d61ba8ef24..439862039a 100644 --- a/libs/srtp/test/roc_driver.c +++ b/libs/srtp/test/roc_driver.c @@ -97,7 +97,7 @@ srtp_err_status_t roc_test(int num_trials) printf("\n\ttesting sequential insertion..."); for (i = 0; i < 2048; i++) { - delta = srtp_index_guess(&local, &est, (uint16_t)ref); + srtp_index_guess(&local, &est, (uint16_t)ref); #if ROC_VERBOSE printf("%lld, %lld, %d\n", ref, est, i); #endif diff --git a/libs/srtp/test/rtp.c b/libs/srtp/test/rtp.c index f60a9b11b2..70248ee2b5 100644 --- a/libs/srtp/test/rtp.c +++ b/libs/srtp/test/rtp.c @@ -53,6 +53,8 @@ #include <sys/socket.h> #endif +#include "cipher_priv.h" + #define PRINT_DEBUG 0 /* set to 1 to print out debugging data */ #define VERBOSE_DEBUG 0 /* set to 1 to print out more data */ @@ -148,7 +150,7 @@ int rtp_sender_init(rtp_sender_t sender, /* set header values */ sender->message.header.ssrc = htonl(ssrc); sender->message.header.ts = 0; - sender->message.header.seq = (uint16_t)rand(); + sender->message.header.seq = (uint16_t)srtp_cipher_rand_u32_for_tests(); sender->message.header.m = 0; sender->message.header.pt = 0x1; sender->message.header.version = 2; diff --git a/libs/srtp/test/rtp_decoder.c b/libs/srtp/test/rtp_decoder.c index d718a2b3ad..137e7e6b39 100644 --- a/libs/srtp/test/rtp_decoder.c +++ b/libs/srtp/test/rtp_decoder.c @@ -83,23 +83,76 @@ #define MAX_KEY_LEN 96 #define MAX_FILTER 256 +#define MAX_FILE 255 struct srtp_crypto_suite { const char *can_name; + int gcm_on; int key_size; int tag_size; }; static struct srtp_crypto_suite srtp_crypto_suites[] = { - {.can_name = "AES_CM_128_HMAC_SHA1_32", .key_size = 128, .tag_size = 4 }, #if 0 - {.can_name = "F8_128_HMAC_SHA1_32", .key_size = 128, .tag_size = 4}, + {.can_name = "F8_128_HMAC_SHA1_32", .gcm_on = 0, .key_size = 128, .tag_size = 4}, #endif - {.can_name = "AES_CM_128_HMAC_SHA1_32", .key_size = 128, .tag_size = 4 }, - {.can_name = "AES_CM_128_HMAC_SHA1_80", .key_size = 128, .tag_size = 10 }, + {.can_name = "AES_CM_128_HMAC_SHA1_32", + .gcm_on = 0, + .key_size = 128, + .tag_size = 4 }, + {.can_name = "AES_CM_128_HMAC_SHA1_80", + .gcm_on = 0, + .key_size = 128, + .tag_size = 10 }, + {.can_name = "AES_192_CM_HMAC_SHA1_32", + .gcm_on = 0, + .key_size = 192, + .tag_size = 4 }, + {.can_name = "AES_192_CM_HMAC_SHA1_80", + .gcm_on = 0, + .key_size = 192, + .tag_size = 10 }, + {.can_name = "AES_256_CM_HMAC_SHA1_32", + .gcm_on = 0, + .key_size = 256, + .tag_size = 4 }, + {.can_name = "AES_256_CM_HMAC_SHA1_80", + .gcm_on = 0, + .key_size = 256, + .tag_size = 10 }, + {.can_name = "AEAD_AES_128_GCM", + .gcm_on = 1, + .key_size = 128, + .tag_size = 16 }, + {.can_name = "AEAD_AES_256_GCM", + .gcm_on = 1, + .key_size = 256, + .tag_size = 16 }, {.can_name = NULL } }; +void rtp_decoder_srtp_log_handler(srtp_log_level_t level, + const char *msg, + void *data) +{ + char level_char = '?'; + switch (level) { + case srtp_log_level_error: + level_char = 'e'; + break; + case srtp_log_level_warning: + level_char = 'w'; + break; + case srtp_log_level_info: + level_char = 'i'; + break; + case srtp_log_level_debug: + level_char = 'd'; + break; + } + fprintf(stderr, "SRTP-LOG [%c]: %s\n", level_char, msg); +} + int main(int argc, char *argv[]) { char errbuf[PCAP_ERRBUF_SIZE]; @@ -112,15 +165,18 @@ int main(int argc, char *argv[]) int c; struct srtp_crypto_suite scs, *i_scsp; scs.key_size = 128; - scs.tag_size = 8; + scs.tag_size = 0; int gcm_on = 0; char *input_key = NULL; int b64_input = 0; char key[MAX_KEY_LEN]; struct bpf_program fp; char filter_exp[MAX_FILTER] = ""; + char pcap_file[MAX_FILE] = "-"; + int rtp_packet_offset = DEFAULT_RTP_OFFSET; rtp_decoder_t dec; - srtp_policy_t policy; + srtp_policy_t policy = { { 0 } }; + rtp_decoder_mode_t mode = mode_rtp; srtp_err_status_t status; int len; int expected_len; @@ -138,9 +194,15 @@ int main(int argc, char *argv[]) exit(1); } + status = srtp_install_log_handler(rtp_decoder_srtp_log_handler, NULL); + if (status) { + fprintf(stderr, "error: install log handler failed\n"); + exit(1); + } + /* check args */ while (1) { - c = getopt_s(argc, argv, "b:k:gt:ae:ld:f:s:"); + c = getopt_s(argc, argv, "b:k:gt:ae:ld:f:s:m:p:o:"); if (c == -1) { break; } @@ -153,10 +215,12 @@ int main(int argc, char *argv[]) break; case 'e': scs.key_size = atoi(optarg_s); - if (scs.key_size != 128 && scs.key_size != 256) { - fprintf(stderr, - "error: encryption key size must be 128 or 256 (%d)\n", - scs.key_size); + if (scs.key_size != 128 && scs.key_size != 192 && + scs.key_size != 256) { + fprintf( + stderr, + "error: encryption key size must be 128, 192 or 256 (%d)\n", + scs.key_size); exit(1); } input_key = malloc(scs.key_size); @@ -173,7 +237,7 @@ int main(int argc, char *argv[]) sec_servs |= sec_serv_auth; break; case 'd': - status = srtp_crypto_kernel_set_debug_module(optarg_s, 1); + status = srtp_set_debug_module(optarg_s, 1); if (status) { fprintf(stderr, "error: set debug module (%s) failed\n", optarg_s); @@ -207,20 +271,59 @@ int main(int argc, char *argv[]) scs = *i_scsp; input_key = malloc(scs.key_size); sec_servs |= sec_serv_conf | sec_serv_auth; + gcm_on = scs.gcm_on; + break; + case 'm': + if (strcasecmp("rtp", optarg_s) == 0) { + mode = mode_rtp; + } else if (strcasecmp("rtcp", optarg_s) == 0) { + mode = mode_rtcp; + } else if (strcasecmp("rtcp-mux", optarg_s) == 0) { + mode = mode_rtcp_mux; + } else { + fprintf(stderr, "Unknown/unsupported mode %s\n", optarg_s); + exit(1); + } + break; + case 'p': + if (strlen(optarg_s) > MAX_FILE) { + fprintf(stderr, + "error: pcap file path bigger than %d characters\n", + MAX_FILE); + exit(1); + } + strcpy(pcap_file, optarg_s); + break; + case 'o': + rtp_packet_offset = atoi(optarg_s); break; default: usage(argv[0]); } } + if (scs.tag_size == 0) { + if (gcm_on) { + scs.tag_size = 16; + } else { + scs.tag_size = 10; + } + } + if (gcm_on && scs.tag_size != 8 && scs.tag_size != 16) { fprintf(stderr, "error: GCM tag size must be 8 or 16 (%d)\n", scs.tag_size); - // exit(1); + exit(1); + } + + if (!gcm_on && scs.tag_size != 4 && scs.tag_size != 10) { + fprintf(stderr, "error: non GCM tag size must be 4 or 10 (%d)\n", + scs.tag_size); + exit(1); } if (do_list_mods) { - status = srtp_crypto_kernel_list_debug_modules(); + status = srtp_list_debug_modules(); if (status) { fprintf(stderr, "error: list of debug modules failed\n"); exit(1); @@ -266,12 +369,24 @@ int main(int argc, char *argv[]) #ifdef OPENSSL switch (scs.key_size) { case 128: - srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp); - srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp); + if (scs.tag_size == 16) { + srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy.rtp); + srtp_crypto_policy_set_aes_gcm_128_16_auth( + &policy.rtcp); + } else { + srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp); + srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtcp); + } break; case 256: - srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtp); - srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtcp); + if (scs.tag_size == 16) { + srtp_crypto_policy_set_aes_gcm_256_16_auth(&policy.rtp); + srtp_crypto_policy_set_aes_gcm_256_16_auth( + &policy.rtcp); + } else { + srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtp); + srtp_crypto_policy_set_aes_gcm_256_8_auth(&policy.rtcp); + } break; } #else @@ -282,12 +397,51 @@ int main(int argc, char *argv[]) } else { switch (scs.key_size) { case 128: - srtp_crypto_policy_set_rtp_default(&policy.rtp); - srtp_crypto_policy_set_rtcp_default(&policy.rtcp); + if (scs.tag_size == 4) { + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32( + &policy.rtp); + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80( + &policy.rtcp); + } else { + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80( + &policy.rtp); + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80( + &policy.rtcp); + } + break; + case 192: +#ifdef OPENSSL + if (scs.tag_size == 4) { + srtp_crypto_policy_set_aes_cm_192_hmac_sha1_32( + &policy.rtp); + srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80( + &policy.rtcp); + } else { + srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80( + &policy.rtp); + srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80( + &policy.rtcp); + } +#else + fprintf(stderr, + "error: AES 192 mode only supported when using the " + "OpenSSL crypto engine.\n"); + return 0; + +#endif break; case 256: - srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80(&policy.rtp); - srtp_crypto_policy_set_rtcp_default(&policy.rtcp); + if (scs.tag_size == 4) { + srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32( + &policy.rtp); + srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80( + &policy.rtcp); + } else { + srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80( + &policy.rtp); + srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80( + &policy.rtcp); + } break; } } @@ -302,11 +456,26 @@ int main(int argc, char *argv[]) switch (scs.key_size) { case 128: srtp_crypto_policy_set_aes_cm_128_null_auth(&policy.rtp); - srtp_crypto_policy_set_rtcp_default(&policy.rtcp); + srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80( + &policy.rtcp); + break; + case 192: +#ifdef OPENSSL + srtp_crypto_policy_set_aes_cm_192_null_auth(&policy.rtp); + srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80( + &policy.rtcp); +#else + fprintf(stderr, + "error: AES 192 mode only supported when using the " + "OpenSSL crypto engine.\n"); + return 0; + +#endif break; case 256: srtp_crypto_policy_set_aes_cm_256_null_auth(&policy.rtp); - srtp_crypto_policy_set_rtcp_default(&policy.rtcp); + srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80( + &policy.rtcp); break; } } @@ -342,7 +511,6 @@ int main(int argc, char *argv[]) } policy.key = (uint8_t *)key; - policy.ekt = NULL; policy.next = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; @@ -353,7 +521,7 @@ int main(int argc, char *argv[]) policy.rtp.auth_tag_len = scs.tag_size; if (gcm_on && scs.tag_size != 8) { - fprintf(stderr, "setted tag len %d\n", scs.tag_size); + fprintf(stderr, "set tag len %d\n", scs.tag_size); policy.rtp.auth_tag_len = scs.tag_size; } @@ -365,11 +533,7 @@ int main(int argc, char *argv[]) int pad; expected_len = policy.rtp.cipher_key_len * 4 / 3; len = base64_string_to_octet_string(key, &pad, input_key, - expected_len); - if (pad != 0) { - fprintf(stderr, "error: padding in base64 unexpected\n"); - exit(1); - } + strlen(input_key)); } else { expected_len = policy.rtp.cipher_key_len * 2; len = hex_string_to_octet_string(key, input_key, expected_len); @@ -388,17 +552,20 @@ int main(int argc, char *argv[]) exit(1); } + int key_octets = (scs.key_size / 8); + int salt_octets = policy.rtp.cipher_key_len - key_octets; fprintf(stderr, "set master key/salt to %s/", - octet_string_hex_string(key, 16)); - fprintf(stderr, "%s\n", octet_string_hex_string(key + 16, 14)); + octet_string_hex_string(key, key_octets)); + fprintf(stderr, "%s\n", + octet_string_hex_string(key + key_octets, salt_octets)); } else { fprintf(stderr, - "error: neither encryption or authentication were selected"); + "error: neither encryption or authentication were selected\n"); exit(1); } - pcap_handle = pcap_open_offline("-", errbuf); + pcap_handle = pcap_open_offline(pcap_file, errbuf); if (!pcap_handle) { fprintf(stderr, "libpcap failed to open file '%s'\n", errbuf); @@ -421,11 +588,22 @@ int main(int argc, char *argv[]) exit(1); } fprintf(stderr, "Starting decoder\n"); - rtp_decoder_init(dec, policy); + if (rtp_decoder_init(dec, policy, mode, rtp_packet_offset)) { + fprintf(stderr, "error: init failed\n"); + exit(1); + } pcap_loop(pcap_handle, 0, rtp_decoder_handle_pkt, (u_char *)dec); - rtp_decoder_deinit_srtp(dec); + if (dec->mode == mode_rtp || dec->mode == mode_rtcp_mux) { + fprintf(stderr, "RTP packets decoded: %d\n", dec->rtp_cnt); + } + if (dec->mode == mode_rtcp || dec->mode == mode_rtcp_mux) { + fprintf(stderr, "RTCP packets decoded: %d\n", dec->rtcp_cnt); + } + fprintf(stderr, "Packet decode errors: %d\n", dec->error_cnt); + + rtp_decoder_deinit(dec); rtp_decoder_dealloc(dec); status = srtp_shutdown(); @@ -442,7 +620,8 @@ void usage(char *string) { fprintf( stderr, - "usage: %s [-d <debug>]* [[-k][-b] <key> [-a][-e]]\n" + "usage: %s [-d <debug>]* [[-k][-b] <key>] [-a][-t][-e] [-s " + "<srtp-crypto-suite>] [-m <mode>]\n" "or %s -l\n" "where -a use message authentication\n" " -e <key size> use encryption (use 128 or 256 for key size)\n" @@ -454,7 +633,10 @@ void usage(char *string) " -f \"<pcap filter>\" to filter only the desired SRTP packets\n" " -d <debug> turn on debugging for module <debug>\n" " -s \"<srtp-crypto-suite>\" to set both key and tag size based\n" - " on RFC4568-style crypto suite specification\n", + " on RFC4568-style crypto suite specification\n" + " -m <mode> set the mode to be one of [rtp]|rtcp|rtcp-mux\n" + " -p <pcap file> path to pcap file (defaults to stdin)\n" + " -o byte offset of RTP packet in capture (defaults to 42)\n", string, string); exit(1); } @@ -469,27 +651,34 @@ void rtp_decoder_dealloc(rtp_decoder_t rtp_ctx) free(rtp_ctx); } -srtp_err_status_t rtp_decoder_init_srtp(rtp_decoder_t decoder, - unsigned int ssrc) +int rtp_decoder_deinit(rtp_decoder_t decoder) { - decoder->policy.ssrc.value = htonl(ssrc); - return srtp_create(&decoder->srtp_ctx, &decoder->policy); + if (decoder->srtp_ctx) { + return srtp_dealloc(decoder->srtp_ctx); + } + return 0; } -int rtp_decoder_deinit_srtp(rtp_decoder_t decoder) +int rtp_decoder_init(rtp_decoder_t dcdr, + srtp_policy_t policy, + rtp_decoder_mode_t mode, + int rtp_packet_offset) { - return srtp_dealloc(decoder->srtp_ctx); -} - -int rtp_decoder_init(rtp_decoder_t dcdr, srtp_policy_t policy) -{ - dcdr->rtp_offset = DEFAULT_RTP_OFFSET; + dcdr->rtp_offset = rtp_packet_offset; dcdr->srtp_ctx = NULL; dcdr->start_tv.tv_usec = 0; dcdr->start_tv.tv_sec = 0; dcdr->frame_nr = -1; + dcdr->error_cnt = 0; + dcdr->rtp_cnt = 0; + dcdr->rtcp_cnt = 0; + dcdr->mode = mode; dcdr->policy = policy; - dcdr->policy.ssrc.type = ssrc_specific; + dcdr->policy.ssrc.type = ssrc_any_inbound; + + if (srtp_create(&dcdr->srtp_ctx, &dcdr->policy)) { + return 1; + } return 0; } @@ -516,6 +705,8 @@ void rtp_decoder_handle_pkt(u_char *arg, const u_char *bytes) { rtp_decoder_t dcdr = (rtp_decoder_t)arg; + rtp_msg_t message; + int rtp; int pktsize; struct timeval delta; int octets_recvd; @@ -531,7 +722,7 @@ void rtp_decoder_handle_pkt(u_char *arg, } const void *rtp_packet = bytes + dcdr->rtp_offset; - memcpy((void *)&dcdr->message, rtp_packet, hdr->caplen - dcdr->rtp_offset); + memcpy((void *)&message, rtp_packet, hdr->caplen - dcdr->rtp_offset); pktsize = hdr->caplen - dcdr->rtp_offset; octets_recvd = pktsize; @@ -539,36 +730,41 @@ void rtp_decoder_handle_pkt(u_char *arg, return; } - /* verify rtp header */ - if (dcdr->message.header.version != 2) { - return; - } - if (dcdr->srtp_ctx == NULL) { - status = rtp_decoder_init_srtp(dcdr, dcdr->message.header.ssrc); - if (status) { - exit(1); + if (dcdr->mode == mode_rtp) { + rtp = 1; + } else if (dcdr->mode == mode_rtcp) { + rtp = 0; + } else { + rtp = 1; + if (octets_recvd >= 2) { + /* rfc5761 */ + u_char payload_type = *(bytes + dcdr->rtp_offset + 1) & 0x7f; + rtp = payload_type < 64 || payload_type > 95; } } - status = srtp_unprotect(dcdr->srtp_ctx, &dcdr->message, &octets_recvd); - if (status) { - return; + + if (rtp) { + /* verify rtp header */ + if (message.header.version != 2) { + return; + } + + status = srtp_unprotect(dcdr->srtp_ctx, &message, &octets_recvd); + if (status) { + dcdr->error_cnt++; + return; + } + dcdr->rtp_cnt++; + } else { + status = srtp_unprotect_rtcp(dcdr->srtp_ctx, &message, &octets_recvd); + if (status) { + dcdr->error_cnt++; + return; + } + dcdr->rtcp_cnt++; } timersub(&hdr->ts, &dcdr->start_tv, &delta); fprintf(stdout, "%02ld:%02ld.%06ld\n", delta.tv_sec / 60, delta.tv_sec % 60, (long)delta.tv_usec); - hexdump(&dcdr->message, octets_recvd); -} - -void rtp_print_error(srtp_err_status_t status, char *message) -{ - // clang-format off - fprintf(stderr, - "error: %s %d%s\n", message, status, - status == srtp_err_status_replay_fail ? " (replay check failed)" : - status == srtp_err_status_bad_param ? " (bad param)" : - status == srtp_err_status_no_ctx ? " (no context)" : - status == srtp_err_status_cipher_fail ? " (cipher failed)" : - status == srtp_err_status_key_expired ? " (key expired)" : - status == srtp_err_status_auth_fail ? " (auth check failed)" : ""); - // clang-format on + hexdump(&message, octets_recvd); } diff --git a/libs/srtp/test/rtp_decoder.h b/libs/srtp/test/rtp_decoder.h index c8c31dd773..955caf640e 100644 --- a/libs/srtp/test/rtp_decoder.h +++ b/libs/srtp/test/rtp_decoder.h @@ -52,22 +52,26 @@ #define DEFAULT_RTP_OFFSET 42 +typedef enum { + mode_rtp = 0, + mode_rtcp, + mode_rtcp_mux, +} rtp_decoder_mode_t; + typedef struct rtp_decoder_ctx_t { srtp_policy_t policy; srtp_ctx_t *srtp_ctx; + rtp_decoder_mode_t mode; int rtp_offset; struct timeval start_tv; int frame_nr; - rtp_msg_t message; + int error_cnt; + int rtp_cnt; + int rtcp_cnt; } rtp_decoder_ctx_t; typedef struct rtp_decoder_ctx_t *rtp_decoder_t; -/* - * error to string - */ -void rtp_print_error(srtp_err_status_t status, char *message); - /* * prints the output of a random buffer in hexadecimal */ @@ -95,11 +99,19 @@ rtp_decoder_t rtp_decoder_alloc(void); void rtp_decoder_dealloc(rtp_decoder_t rtp_ctx); -int rtp_decoder_init(rtp_decoder_t dcdr, srtp_policy_t policy); +int rtp_decoder_init(rtp_decoder_t dcdr, + srtp_policy_t policy, + rtp_decoder_mode_t mode, + int rtp_packet_offset); -srtp_err_status_t rtp_decoder_init_srtp(rtp_decoder_t decoder, - unsigned int ssrc); +int rtp_decoder_deinit(rtp_decoder_t decoder); -int rtp_decoder_deinit_srtp(rtp_decoder_t decoder); +void rtp_decoder_srtp_log_handler(srtp_log_level_t level, + const char *msg, + void *data); + +void rtp_decoder_srtp_log_handler(srtp_log_level_t level, + const char *msg, + void *data); #endif /* RTP_DECODER_H */ diff --git a/libs/srtp/test/rtpw.c b/libs/srtp/test/rtpw.c index 6e7416c7f5..ad84448298 100644 --- a/libs/srtp/test/rtpw.c +++ b/libs/srtp/test/rtpw.c @@ -96,7 +96,7 @@ #ifndef HAVE_USLEEP #ifdef HAVE_WINDOWS_H -#define usleep(us) Sleep((us) / 1000) +#define usleep(us) Sleep(((DWORD)us) / 1000) #else #define usleep(us) sleep((us) / 1000000) #endif @@ -317,6 +317,7 @@ int main(int argc, char *argv[]) exit(1); } + memset(&name, 0, sizeof(struct sockaddr_in)); name.sin_addr = rcvr_addr; name.sin_family = PF_INET; name.sin_port = htons(port); @@ -364,7 +365,7 @@ int main(int argc, char *argv[]) switch (sec_servs) { case sec_serv_conf_and_auth: if (gcm_on) { -#ifdef OPENSSL +#ifdef GCM switch (key_size) { case 128: srtp_crypto_policy_set_aes_gcm_128_8_auth(&policy.rtp); @@ -377,7 +378,7 @@ int main(int argc, char *argv[]) } #else printf("error: GCM mode only supported when using the OpenSSL " - "crypto engine.\n"); + "or NSS crypto engine.\n"); return 0; #endif } else { @@ -413,7 +414,7 @@ int main(int argc, char *argv[]) break; case sec_serv_auth: if (gcm_on) { -#ifdef OPENSSL +#ifdef GCM switch (key_size) { case 128: srtp_crypto_policy_set_aes_gcm_128_8_only_auth(&policy.rtp); @@ -443,7 +444,6 @@ int main(int argc, char *argv[]) policy.ssrc.type = ssrc_specific; policy.ssrc.value = ssrc; policy.key = (uint8_t *)key; - policy.ekt = NULL; policy.next = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; @@ -505,7 +505,6 @@ int main(int argc, char *argv[]) policy.ssrc.value = ssrc; policy.window_size = 0; policy.allow_repeat_tx = 0; - policy.ekt = NULL; policy.next = NULL; } @@ -670,7 +669,7 @@ void handle_signal(int signum) int setup_signal_handler(char *name) { -#if HAVE_SIGACTION +#ifdef HAVE_SIGACTION struct sigaction act; memset(&act, 0, sizeof(act)); diff --git a/libs/srtp/test/rtpw_test.sh b/libs/srtp/test/rtpw_test.sh index 238ec93c5d..8fcb35f363 100755 --- a/libs/srtp/test/rtpw_test.sh +++ b/libs/srtp/test/rtpw_test.sh @@ -41,12 +41,24 @@ case $(uname -s) in *CYGWIN*|*MINGW*) EXE=".exe" ;; - *) + *Linux*) EXE="" + if [ -n "$CRYPTO_LIBDIR" ] + then + export LD_LIBRARY_PATH="$CRYPTO_LIBDIR" + fi + ;; + *Darwin*) + EXE="" + if [ -n "$CRYPTO_LIBDIR" ] + then + export DYLD_LIBRARY_PATH="$CRYPTO_LIBDIR" + fi ;; esac RTPW=./rtpw$EXE +[ -n "$MESON_EXE_WRAPPER" ] && RTPW="$MESON_EXE_WRAPPER $RTPW" DEST_PORT=9999 DURATION=3 @@ -62,7 +74,7 @@ ARGS="-b $key -a -e 128" killall rtpw 2>/dev/null -if test -x $RTPW; then +if test -n $MESON_EXE_WRAPPER || test -x $RTPW; then echo $0 ": starting rtpw receiver process... " diff --git a/libs/srtp/test/rtpw_test_gcm.sh b/libs/srtp/test/rtpw_test_gcm.sh index 773400562c..1722f44ea7 100755 --- a/libs/srtp/test/rtpw_test_gcm.sh +++ b/libs/srtp/test/rtpw_test_gcm.sh @@ -41,12 +41,24 @@ case $(uname -s) in *CYGWIN*|*MINGW*) EXE=".exe" ;; - *) + *Linux*) EXE="" + if [ -n "$CRYPTO_LIBDIR" ] + then + export LD_LIBRARY_PATH="$CRYPTO_LIBDIR" + fi + ;; + *Darwin*) + EXE="" + if [ -n "$CRYPTO_LIBDIR" ] + then + export DYLD_LIBRARY_PATH="$CRYPTO_LIBDIR" + fi ;; esac RTPW=./rtpw$EXE +[ -n "$MESON_EXE_WRAPPER" ] && RTPW="$MESON_EXE_WRAPPER $RTPW" DEST_PORT=9999 DURATION=3 @@ -58,7 +70,7 @@ DURATION=3 killall rtpw 2>/dev/null -if test -x $RTPW; then +if test -n $MESON_EXE_WRAPPER || test -x $RTPW; then GCMARGS128="-k 01234567890123456789012345678901234567890123456789012345 -g -e 128" echo $0 ": starting GCM mode 128-bit rtpw receiver process... " diff --git a/libs/srtp/test/srtp_driver.c b/libs/srtp/test/srtp_driver.c index 4ea8fe5302..4355022b66 100644 --- a/libs/srtp/test/srtp_driver.c +++ b/libs/srtp/test/srtp_driver.c @@ -61,13 +61,13 @@ srtp_err_status_t srtp_validate(void); -#ifdef OPENSSL +#ifdef GCM srtp_err_status_t srtp_validate_gcm(void); #endif srtp_err_status_t srtp_validate_encrypted_extensions_headers(void); -#ifdef OPENSSL +#ifdef GCM srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm(void); #endif @@ -79,7 +79,7 @@ srtp_err_status_t srtp_dealloc_big_policy(srtp_policy_t *list); srtp_err_status_t srtp_test_empty_payload(void); -#ifdef OPENSSL +#ifdef GCM srtp_err_status_t srtp_test_empty_payload_gcm(void); #endif @@ -181,11 +181,12 @@ void log_handler(srtp_log_level_t level, const char *msg, void *data) } /* - * The policy_array is a null-terminated array of policy structs. it - * is declared at the end of this file + * The policy_array and invalid_policy_array are null-terminated arrays of + * policy structs. They is declared at the end of this file. */ extern const srtp_policy_t *policy_array[]; +extern const srtp_policy_t *invalid_policy_array[]; /* the wildcard_policy is declared below; it has a wildcard ssrc */ @@ -302,6 +303,7 @@ int main(int argc, char *argv[]) if (do_validation) { const srtp_policy_t **policy = policy_array; srtp_policy_t *big_policy; + srtp_t srtp_sender; /* loop over policy array, testing srtp and srtcp for each policy */ while (*policy != NULL) { @@ -364,6 +366,21 @@ int main(int argc, char *argv[]) policy++; } + /* loop over invalid policy array, testing that an SRTP context cannot + * be created with the policy */ + policy = invalid_policy_array; + while (*policy != NULL) { + printf("testing srtp_create fails with invalid policy\n"); + if (srtp_create(&srtp_sender, *policy) != srtp_err_status_ok) { + printf("passed\n\n"); + } else { + printf("failed\n"); + exit(1); + } + + policy++; + } + /* create a big policy list and run tests on it */ status = srtp_create_big_policy(&big_policy); if (status) { @@ -422,7 +439,7 @@ int main(int argc, char *argv[]) exit(1); } -#ifdef OPENSSL +#ifdef GCM printf("testing srtp_protect and srtp_unprotect against " "reference packet using GCM\n"); if (srtp_validate_gcm() == srtp_err_status_ok) { @@ -442,7 +459,7 @@ int main(int argc, char *argv[]) exit(1); } -#ifdef OPENSSL +#ifdef GCM printf("testing srtp_protect and srtp_unprotect against " "reference packet with encrypted extension headers (GCM)\n"); if (srtp_validate_encrypted_extensions_headers_gcm() == @@ -478,7 +495,7 @@ int main(int argc, char *argv[]) printf("failed\n"); exit(1); } -#ifdef OPENSSL +#ifdef GCM printf("testing srtp_protect and srtp_unprotect against " "packet with empty payload (GCM)\n"); if (srtp_test_empty_payload_gcm() == srtp_err_status_ok) { @@ -589,7 +606,7 @@ int main(int argc, char *argv[]) policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xdecafbad; policy.key = test_key; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -928,12 +945,10 @@ double srtp_rejections_per_second(int msg_len_octets, void err_check(srtp_err_status_t s) { - if (s == srtp_err_status_ok) { - return; - } else { + if (s != srtp_err_status_ok) { fprintf(stderr, "error: unexpected srtp failure (code %d)\n", s); + exit(1); } - exit(1); } srtp_err_status_t srtp_test_call_protect(srtp_t srtp_sender, @@ -1341,6 +1356,8 @@ srtp_err_status_t srtcp_test(const srtp_policy_t *policy, int mki_index) */ rcvr_policy = (srtp_policy_t *)malloc(sizeof(srtp_policy_t)); if (rcvr_policy == NULL) { + free(hdr); + free(hdr2); return srtp_err_status_alloc_fail; } memcpy(rcvr_policy, policy, sizeof(srtp_policy_t)); @@ -1606,6 +1623,9 @@ double mips_estimate(int num_trials, int *ignore) sum += i; } t = clock() - t; + if (t < 1) { + t = 1; + } /* printf("%d\n", sum); */ *ignore = sum; @@ -1678,7 +1698,7 @@ srtp_err_status_t srtp_validate() policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xcafebabe; policy.key = test_key; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -1702,7 +1722,7 @@ srtp_err_status_t srtp_validate() debug_print(mod_driver, "ciphertext reference:\n %s", octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) { + if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) { return srtp_err_status_fail; } @@ -1720,7 +1740,7 @@ srtp_err_status_t srtp_validate() debug_print(mod_driver, "srtcp ciphertext reference:\n %s", octet_string_hex_string(srtcp_ciphertext, len)); - if (octet_string_is_eq(rtcp_plaintext, srtcp_ciphertext, len)) { + if (srtp_octet_string_is_eq(rtcp_plaintext, srtcp_ciphertext, len)) { return srtp_err_status_fail; } @@ -1742,7 +1762,7 @@ srtp_err_status_t srtp_validate() return status; } - if (octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -1755,7 +1775,7 @@ srtp_err_status_t srtp_validate() return status; } - if (octet_string_is_eq(srtcp_ciphertext, rtcp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtcp_ciphertext, rtcp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -1772,7 +1792,7 @@ srtp_err_status_t srtp_validate() return srtp_err_status_ok; } -#ifdef OPENSSL +#ifdef GCM /* * srtp_validate_gcm() verifies the correctness of libsrtp by comparing * an computed packet against the known ciphertext for the plaintext. @@ -1846,7 +1866,7 @@ srtp_err_status_t srtp_validate_gcm() policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xcafebabe; policy.key = test_key_gcm; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -1870,7 +1890,7 @@ srtp_err_status_t srtp_validate_gcm() debug_print(mod_driver, "srtp ciphertext reference:\n %s", octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(rtp_plaintext, srtp_ciphertext, len)) { + if (srtp_octet_string_is_eq(rtp_plaintext, srtp_ciphertext, len)) { return srtp_err_status_fail; } @@ -1888,7 +1908,7 @@ srtp_err_status_t srtp_validate_gcm() debug_print(mod_driver, "srtcp ciphertext reference:\n %s", octet_string_hex_string(srtcp_ciphertext, len)); - if (octet_string_is_eq(rtcp_plaintext, srtcp_ciphertext, len)) { + if (srtp_octet_string_is_eq(rtcp_plaintext, srtcp_ciphertext, len)) { return srtp_err_status_fail; } @@ -1911,7 +1931,7 @@ srtp_err_status_t srtp_validate_gcm() return status; } - if (octet_string_is_eq(srtp_ciphertext, rtp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtp_ciphertext, rtp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -1924,7 +1944,7 @@ srtp_err_status_t srtp_validate_gcm() return status; } - if (octet_string_is_eq(srtcp_ciphertext, rtcp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtcp_ciphertext, rtcp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -2003,7 +2023,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers() policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xcafebabe; policy.key = test_key_ext_headers; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.enc_xtn_hdr = headers; @@ -2027,7 +2047,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers() debug_print(mod_driver, "ciphertext reference:\n %s", srtp_octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) + if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) return srtp_err_status_fail; /* @@ -2049,7 +2069,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers() return srtp_err_status_fail; } - if (octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) + if (srtp_octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) return srtp_err_status_fail; status = srtp_dealloc(srtp_snd); @@ -2063,7 +2083,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers() return srtp_err_status_ok; } -#ifdef OPENSSL +#ifdef GCM /* * Headers of test vectors taken from RFC 6904, Appendix A @@ -2124,7 +2144,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm() policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xcafebabe; policy.key = test_key_ext_headers; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.enc_xtn_hdr = headers; @@ -2148,7 +2168,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm() debug_print(mod_driver, "ciphertext reference:\n %s", srtp_octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) + if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) return srtp_err_status_fail; /* @@ -2170,7 +2190,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm() return srtp_err_status_fail; } - if (octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) + if (srtp_octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) return srtp_err_status_fail; status = srtp_dealloc(srtp_snd); @@ -2240,7 +2260,7 @@ srtp_err_status_t srtp_validate_aes_256() policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xcafebabe; policy.key = aes_256_test_key; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -2264,7 +2284,7 @@ srtp_err_status_t srtp_validate_aes_256() debug_print(mod_driver, "ciphertext reference:\n %s", octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) { + if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) { return srtp_err_status_fail; } @@ -2286,7 +2306,7 @@ srtp_err_status_t srtp_validate_aes_256() return status; } - if (octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -2306,7 +2326,8 @@ srtp_err_status_t srtp_validate_aes_256() srtp_err_status_t srtp_create_big_policy(srtp_policy_t **list) { extern const srtp_policy_t *policy_array[]; - srtp_policy_t *p, *tmp; + srtp_policy_t *p = NULL; + srtp_policy_t *tmp; int i = 0; uint32_t ssrc = 0; @@ -2367,7 +2388,7 @@ srtp_err_status_t srtp_test_empty_payload() policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xcafebabe; policy.key = test_key; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -2424,7 +2445,7 @@ srtp_err_status_t srtp_test_empty_payload() return srtp_err_status_ok; } -#ifdef OPENSSL +#ifdef GCM srtp_err_status_t srtp_test_empty_payload_gcm() { srtp_t srtp_snd, srtp_recv; @@ -2443,7 +2464,7 @@ srtp_err_status_t srtp_test_empty_payload_gcm() policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xcafebabe; policy.key = test_key; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -2499,7 +2520,7 @@ srtp_err_status_t srtp_test_empty_payload_gcm() return srtp_err_status_ok; } -#endif // OPENSSL +#endif // GCM srtp_err_status_t srtp_test_remove_stream() { @@ -2568,7 +2589,7 @@ srtp_err_status_t srtp_test_remove_stream() policy.ssrc.type = ssrc_specific; policy.ssrc.value = 0xcafebabe; policy.key = test_key; - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -2627,7 +2648,7 @@ srtp_err_status_t srtp_test_update() memset(&policy, 0, sizeof(policy)); srtp_crypto_policy_set_rtp_default(&policy.rtp); srtp_crypto_policy_set_rtcp_default(&policy.rtcp); - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -2783,15 +2804,15 @@ srtp_err_status_t srtp_test_setup_protect_trailer_streams( srtp_policy_t policy; srtp_policy_t policy_mki; -#ifdef OPENSSL +#ifdef GCM srtp_policy_t policy_aes_gcm; srtp_policy_t policy_aes_gcm_mki; -#endif // OPENSSL +#endif // GCM memset(&policy, 0, sizeof(policy)); srtp_crypto_policy_set_rtp_default(&policy.rtp); srtp_crypto_policy_set_rtcp_default(&policy.rtcp); - policy.ekt = NULL; + policy.deprecated_ekt = NULL; policy.window_size = 128; policy.allow_repeat_tx = 0; policy.next = NULL; @@ -2801,7 +2822,7 @@ srtp_err_status_t srtp_test_setup_protect_trailer_streams( memset(&policy_mki, 0, sizeof(policy_mki)); srtp_crypto_policy_set_rtp_default(&policy_mki.rtp); srtp_crypto_policy_set_rtcp_default(&policy_mki.rtcp); - policy_mki.ekt = NULL; + policy_mki.deprecated_ekt = NULL; policy_mki.window_size = 128; policy_mki.allow_repeat_tx = 0; policy_mki.next = NULL; @@ -2810,11 +2831,11 @@ srtp_err_status_t srtp_test_setup_protect_trailer_streams( policy_mki.keys = test_keys; policy_mki.num_master_keys = 2; -#ifdef OPENSSL +#ifdef GCM memset(&policy_aes_gcm, 0, sizeof(policy_aes_gcm)); srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy_aes_gcm.rtp); srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy_aes_gcm.rtcp); - policy_aes_gcm.ekt = NULL; + policy_aes_gcm.deprecated_ekt = NULL; policy_aes_gcm.window_size = 128; policy_aes_gcm.allow_repeat_tx = 0; policy_aes_gcm.next = NULL; @@ -2824,7 +2845,7 @@ srtp_err_status_t srtp_test_setup_protect_trailer_streams( memset(&policy_aes_gcm_mki, 0, sizeof(policy_aes_gcm_mki)); srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy_aes_gcm_mki.rtp); srtp_crypto_policy_set_aes_gcm_128_16_auth(&policy_aes_gcm_mki.rtcp); - policy_aes_gcm_mki.ekt = NULL; + policy_aes_gcm_mki.deprecated_ekt = NULL; policy_aes_gcm_mki.window_size = 128; policy_aes_gcm_mki.allow_repeat_tx = 0; policy_aes_gcm_mki.next = NULL; @@ -2832,7 +2853,7 @@ srtp_err_status_t srtp_test_setup_protect_trailer_streams( policy_aes_gcm_mki.key = NULL; policy_aes_gcm_mki.keys = test_keys; policy_aes_gcm_mki.num_master_keys = 2; -#endif +#endif // GCM /* create a send ctx with defualt profile and test_key */ status = srtp_create(srtp_send, &policy); @@ -2843,7 +2864,7 @@ srtp_err_status_t srtp_test_setup_protect_trailer_streams( if (status) return status; -#ifdef OPENSSL +#ifdef GCM status = srtp_create(srtp_send_aes_gcm, &policy_aes_gcm); if (status) return status; @@ -2851,7 +2872,7 @@ srtp_err_status_t srtp_test_setup_protect_trailer_streams( status = srtp_create(srtp_send_aes_gcm_mki, &policy_aes_gcm_mki); if (status) return status; -#endif // OPENSSL +#endif // GCM return srtp_err_status_ok; } @@ -2884,7 +2905,7 @@ srtp_err_status_t srtp_test_protect_trailer_length() if (length != 14) return srtp_err_status_fail; -#ifdef OPENSSL +#ifdef GCM status = srtp_get_protect_trailer_length(srtp_send_aes_gcm, 0, 0, &length); if (status) return status; @@ -2901,11 +2922,11 @@ srtp_err_status_t srtp_test_protect_trailer_length() /* TAG Length: 16 bytes + MKI length: 4 bytes*/ if (length != 20) return srtp_err_status_fail; -#endif // OPENSSL +#endif // GCM srtp_dealloc(srtp_send); srtp_dealloc(srtp_send_mki); -#ifdef OPENSSL +#ifdef GCM srtp_dealloc(srtp_send_aes_gcm); srtp_dealloc(srtp_send_aes_gcm_mki); #endif @@ -2941,7 +2962,7 @@ srtp_err_status_t srtp_test_protect_rtcp_trailer_length() if (length != 18) return srtp_err_status_fail; -#ifdef OPENSSL +#ifdef GCM status = srtp_get_protect_rtcp_trailer_length(srtp_send_aes_gcm, 0, 0, &length); if (status) @@ -2959,11 +2980,11 @@ srtp_err_status_t srtp_test_protect_rtcp_trailer_length() /* TAG Length: 16 bytes + SRTCP Trailer 4 bytes + MKI 4 bytes*/ if (length != 24) return srtp_err_status_fail; -#endif // OPENSSL +#endif // GCM srtp_dealloc(srtp_send); srtp_dealloc(srtp_send_mki); -#ifdef OPENSSL +#ifdef GCM srtp_dealloc(srtp_send_aes_gcm); srtp_dealloc(srtp_send_aes_gcm_mki); #endif @@ -3088,6 +3109,7 @@ static srtp_err_status_t test_set_receiver_roc(uint32_t packets, if (status) { return status; } + seq++; ts++; } @@ -3500,7 +3522,7 @@ const srtp_policy_t hmac_only_policy = { NULL }; -#ifdef OPENSSL +#ifdef GCM const srtp_policy_t aes128_gcm_8_policy = { { ssrc_any_outbound, 0 }, /* SSRC */ { @@ -3724,23 +3746,7 @@ const srtp_policy_t aes_256_hmac_policy = { NULL }; -// clang-format off -uint8_t ekt_test_key[16] = { - 0x77, 0x26, 0x9d, 0xac, 0x16, 0xa3, 0x28, 0xca, - 0x8e, 0xc9, 0x68, 0x4b, 0xcc, 0xc4, 0xd2, 0x1b -}; -// clang-format on - -#include "ekt.h" - -// clang-format off -srtp_ekt_policy_ctx_t ekt_test_policy = { - 0xa5a5, /* SPI */ - SRTP_EKT_CIPHER_AES_128_ECB, - ekt_test_key, - NULL -}; -// clang-format on +char ekt_test_policy = 'x'; const srtp_policy_t hmac_only_with_ekt_policy = { { ssrc_any_outbound, 0 }, /* SSRC */ @@ -3763,7 +3769,7 @@ const srtp_policy_t hmac_only_with_ekt_policy = { NULL, (srtp_master_key_t **)test_keys, 2, /* indicates the number of Master keys */ - &ekt_test_policy, /* indicates that EKT is not in use */ + &ekt_test_policy, /* requests deprecated EKT functionality */ 128, /* replay window size */ 0, /* retransmission not allowed */ NULL, /* no encrypted extension headers */ @@ -3786,7 +3792,7 @@ const srtp_policy_t *policy_array[] = { &hmac_only_policy, &aes_only_policy, &default_policy, -#ifdef OPENSSL +#ifdef GCM &aes128_gcm_8_policy, &aes128_gcm_8_cauth_policy, &aes256_gcm_8_policy, @@ -3794,6 +3800,12 @@ const srtp_policy_t *policy_array[] = { #endif &null_policy, &aes_256_hmac_policy, + NULL +}; +// clang-format on + +// clang-format off +const srtp_policy_t *invalid_policy_array[] = { &hmac_only_with_ekt_policy, NULL }; diff --git a/libs/srtp/test/test_srtp.c b/libs/srtp/test/test_srtp.c index cdc9b5d5b7..0cea1f3c37 100644 --- a/libs/srtp/test/test_srtp.c +++ b/libs/srtp/test/test_srtp.c @@ -43,16 +43,16 @@ * */ -/* - * Test specific. - */ -#include "cutest.h" - /* * libSRTP specific. */ #include "../srtp/srtp.c" // Get access to static functions +/* + * Test specific. + */ +#include "cutest.h" + /* * Standard library. */ @@ -152,14 +152,15 @@ void srtp_calc_aead_iv_srtcp_distinct_iv_per_sequence_number() srtp_session_keys_t session_keys; srtcp_hdr_t header; v128_t output_iv[SAMPLE_COUNT]; - memset(&output_iv, 0, SAMPLE_COUNT * sizeof(v128_t)); uint32_t sequence_num[SAMPLE_COUNT]; + v128_t final_iv[SAMPLE_COUNT]; + size_t i = 0; + memset(&output_iv, 0, SAMPLE_COUNT * sizeof(v128_t)); sequence_num[0] = 0xFF; sequence_num[1] = 0xFF00; sequence_num[2] = 0xFF0000; // Postconditions - v128_t final_iv[SAMPLE_COUNT]; memset(&final_iv, 0, SAMPLE_COUNT * sizeof(v128_t)); final_iv[0].v8[11] = 0xFF; final_iv[1].v8[10] = 0xFF; @@ -170,7 +171,6 @@ void srtp_calc_aead_iv_srtcp_distinct_iv_per_sequence_number() memset(&header, 0, sizeof(srtcp_hdr_t)); // When - size_t i = 0; for (i = 0; i < SAMPLE_COUNT; i++) { TEST_CHECK(srtp_calc_aead_iv_srtcp(&session_keys, &output_iv[i], sequence_num[i], diff --git a/libs/srtp/crypto/replay/ut_sim.c b/libs/srtp/test/ut_sim.c similarity index 95% rename from libs/srtp/crypto/replay/ut_sim.c rename to libs/srtp/test/ut_sim.c index c621c0e9f2..2825b68df9 100644 --- a/libs/srtp/crypto/replay/ut_sim.c +++ b/libs/srtp/test/ut_sim.c @@ -49,10 +49,13 @@ #endif #include "ut_sim.h" +#include "cipher_priv.h" int ut_compar(const void *a, const void *b) { - return rand() > (RAND_MAX / 2) ? -1 : 1; + uint8_t r; + srtp_cipher_rand_for_tests(&r, sizeof(r)); + return r > (UINT8_MAX / 2) ? -1 : 1; } void ut_init(ut_connection *utc) diff --git a/libs/srtp/include/ut_sim.h b/libs/srtp/test/ut_sim.h similarity index 100% rename from libs/srtp/include/ut_sim.h rename to libs/srtp/test/ut_sim.h diff --git a/libs/srtp/test/util.c b/libs/srtp/test/util.c index eb203f4c4a..c0f7614903 100644 --- a/libs/srtp/test/util.c +++ b/libs/srtp/test/util.c @@ -42,12 +42,14 @@ * */ +#include "config.h" #include "util.h" #include <string.h> #include <stdint.h> -char bit_string[MAX_PRINT_STRING_LEN]; +/* include space for null terminator */ +static char bit_string[MAX_PRINT_STRING_LEN + 1]; static inline int hex_char_to_nibble(uint8_t c) { @@ -151,7 +153,7 @@ char *octet_string_hex_string(const void *s, int length) /* truncate string if it would be too long */ if (length > MAX_PRINT_STRING_LEN) { - length = MAX_PRINT_STRING_LEN - 1; + length = MAX_PRINT_STRING_LEN; } for (i = 0; i < length; i += 2) { diff --git a/libs/srtp/undos.sh b/libs/srtp/undos.sh deleted file mode 100755 index db12064968..0000000000 --- a/libs/srtp/undos.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# usage: undos <file> -# -# strips CRs from a file - useful when moving DOS-created files -# onto UN*X machines - -cat $1 | tr -d "\r" > $1.tmp -mv $1.tmp $1 - From ee06958df61dc0154c5bfdde77cd1b84e77034f4 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 30 Aug 2021 21:19:19 +0300 Subject: [PATCH 152/655] [Build-System] Windows: Update OpenSSL to 1.1.1l, libpq to 10.18, curl to 7.78.0, libks to 1.7.0, signalwire-c to 1.3.0, rabbitmq-c to 0.11.0 --- libs/iksemel/src/stream.c | 1 + w32/curl-version.props | 2 +- w32/curl.props | 2 +- w32/libks-version.props | 2 +- w32/libpq-version.props | 2 +- w32/openssl-version.props | 2 +- w32/openssl.props | 3 +-- w32/rabbitmq-c-version.props | 2 +- w32/signalwire-client-c-version.props | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libs/iksemel/src/stream.c b/libs/iksemel/src/stream.c index a35f29223a..e05e5d06ef 100644 --- a/libs/iksemel/src/stream.c +++ b/libs/iksemel/src/stream.c @@ -23,6 +23,7 @@ #include <openssl/ssl.h> #include <openssl/err.h> #ifdef WIN32 +#include "Winsock2.h" typedef unsigned __int32 uint32_t; #else #ifdef HAVE_SYS_SELECT_H diff --git a/w32/curl-version.props b/w32/curl-version.props index f42593d627..fe37b46801 100644 --- a/w32/curl-version.props +++ b/w32/curl-version.props @@ -2,7 +2,7 @@ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros"> - <curlVersion>7.61.0</curlVersion> + <curlVersion>7.78.0</curlVersion> </PropertyGroup> <PropertyGroup> <curlVersionImported>true</curlVersionImported> diff --git a/w32/curl.props b/w32/curl.props index 3136e3589c..ea86ea4bd6 100644 --- a/w32/curl.props +++ b/w32/curl.props @@ -65,7 +65,7 @@ </ClCompile> <Link> <AdditionalLibraryDirectories>$(curlLibDir)\binaries\$(Platform)\$(LibraryConfiguration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>curl.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>curl.lib;Wldap32.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> diff --git a/w32/libks-version.props b/w32/libks-version.props index db4eb626b8..d3880e33c1 100644 --- a/w32/libks-version.props +++ b/w32/libks-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <libksVersion>1.3.0</libksVersion> + <libksVersion>1.7.0</libksVersion> </PropertyGroup> <PropertyGroup> <libksVersionImported>true</libksVersionImported> diff --git a/w32/libpq-version.props b/w32/libpq-version.props index 7d92fe6980..2bd87afc9e 100644 --- a/w32/libpq-version.props +++ b/w32/libpq-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <libpqVersion>10.3</libpqVersion> + <libpqVersion>10.18</libpqVersion> </PropertyGroup> <PropertyGroup> <libpqVersionImported>true</libpqVersionImported> diff --git a/w32/openssl-version.props b/w32/openssl-version.props index 21e8ca66e6..f0147f9baf 100644 --- a/w32/openssl-version.props +++ b/w32/openssl-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <OpenSSLVersion>1.0.2k</OpenSSLVersion> + <OpenSSLVersion>1.1.1l</OpenSSLVersion> <OpenSSLLibDir>$(BaseDir)libs\openssl-$(OpenSSLVersion)</OpenSSLLibDir> </PropertyGroup> <PropertyGroup> diff --git a/w32/openssl.props b/w32/openssl.props index 4ba5878305..c3eaa3632b 100644 --- a/w32/openssl.props +++ b/w32/openssl.props @@ -72,8 +72,7 @@ </ClCompile> <Link> <AdditionalLibraryDirectories>$(OpenSSLLibDir)\binaries\$(Platform)\$(LibraryConfiguration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies Condition="'$(Platform)'=='Win32'">ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalDependencies Condition="'$(Platform)'=='x64'">ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;crypt32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> </Project> \ No newline at end of file diff --git a/w32/rabbitmq-c-version.props b/w32/rabbitmq-c-version.props index cea5739846..0688988cfb 100644 --- a/w32/rabbitmq-c-version.props +++ b/w32/rabbitmq-c-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <rabbitmq_cVersion>0.8.0</rabbitmq_cVersion> + <rabbitmq_cVersion>0.11.0</rabbitmq_cVersion> </PropertyGroup> <PropertyGroup> <rabbitmq_cVersionImported>true</rabbitmq_cVersionImported> diff --git a/w32/signalwire-client-c-version.props b/w32/signalwire-client-c-version.props index c62174b6a7..56b4dc5545 100644 --- a/w32/signalwire-client-c-version.props +++ b/w32/signalwire-client-c-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <signalwire-client-cVersion>1.2.0</signalwire-client-cVersion> + <signalwire-client-cVersion>1.3.0</signalwire-client-cVersion> </PropertyGroup> <PropertyGroup> <signalwire-client-cVersionImported>true</signalwire-client-cVersionImported> From ee9214c6fb6bc01a2798dea3ca0153e3c85e8f97 Mon Sep 17 00:00:00 2001 From: Sharath K Shetty <1905589+TelephonyMan@users.noreply.github.com> Date: Wed, 1 Sep 2021 20:18:42 +0530 Subject: [PATCH 153/655] [mod_dptools] Fix silence_ms misspelling typo in vad_test command --- src/mod/applications/mod_dptools/mod_dptools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 43329eb006..f35c3cb8f8 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -6285,7 +6285,7 @@ SWITCH_STANDARD_APP(vad_test_function) if ((var = switch_channel_get_variable(channel, "vad_silence_ms"))) { tmp = atoi(var); - if (tmp > 0) switch_vad_set_param(vad, "sicence_ms", tmp); + if (tmp > 0) switch_vad_set_param(vad, "silence_ms", tmp); } if ((var = switch_channel_get_variable(channel, "vad_thresh"))) { From 69cdaac60b89d1f71649efba6ba404bf2ce31775 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 8 Sep 2021 18:20:20 +0300 Subject: [PATCH 154/655] [mod_sofia] more fixes around md5 hash infoleak (tricky cfg). * [mod_sofia] md5 hash infoleak fixes: (explictly allow host set in gw params 'register_proxy' and 'outbound_proxy' to challenge too). "We have tightened security for digest authentication on gateways. If you have gateways configured using dns and not an ip address, you may need to configure gw-auth-acl in gateway configuration to specify the IP addresses you can send auth challenges to for this gateway. This is meant to better secure who we will send auth challenges." (Mike Jerris) [mod_sofia] add REGISTER/401 unit-tests (sipp based) [mod_sofia] add INVITE/407 unit-test (sipp-based) * Cleanup spacing Co-authored-by: Andrey Volk <andywolk@gmail.com> --- src/mod/endpoints/mod_sofia/mod_sofia.h | 4 + src/mod/endpoints/mod_sofia/sofia.c | 4 + src/mod/endpoints/mod_sofia/sofia_glue.c | 36 ++++ src/mod/endpoints/mod_sofia/sofia_reg.c | 50 +++-- .../mod_sofia/test/conf-sipp/freeswitch.xml | 36 +++- .../mod_sofia/test/sipp-based-tests.c | 202 +++++++++++++++++- .../mod_sofia/test/sipp-scenarios/uas_407.xml | 72 +++++++ .../test/sipp-scenarios/uas_register.xml | 43 ++++ .../test/sipp-scenarios/uas_register_403.xml | 42 ++++ .../uas_register_no_challange.xml | 58 +++++ 10 files changed, 520 insertions(+), 27 deletions(-) create mode 100644 src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_407.xml create mode 100644 src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register.xml create mode 100644 src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register_403.xml create mode 100644 src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register_no_challange.xml diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 63697dbbda..1ffd39dc6e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -527,6 +527,9 @@ struct sofia_gateway { char *register_proxy; char *register_sticky_proxy; char *outbound_sticky_proxy; + char *register_proxy_host_cfg; /* hold only the IP or the hostname, no port, no "sip:" or "sips:" prefix */ + char *outbound_proxy_host_cfg; + char *proxy_host_cfg; char *register_context; char *expires_str; char *register_url; @@ -1258,6 +1261,7 @@ void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep); char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool); +char *sofia_glue_get_host_from_cfg(const char *str, switch_memory_pool_t *pool); void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now); void sofia_msg_thread_start(int idx); void crtp_init(switch_loadable_module_interface_t *module_interface); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 54d0dbdfe8..a752a4a8f4 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3950,8 +3950,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag, contact_host = val; } else if (!strcmp(var, "register-proxy")) { register_proxy = val; + gateway->register_proxy_host_cfg = sofia_glue_get_host_from_cfg(register_proxy, gateway->pool); } else if (!strcmp(var, "outbound-proxy")) { outbound_proxy = val; + gateway->outbound_proxy_host_cfg = sofia_glue_get_host_from_cfg(outbound_proxy, gateway->pool); } else if (!strcmp(var, "distinct-to")) { distinct_to = switch_true(val); } else if (!strcmp(var, "destination-prefix")) { @@ -4025,6 +4027,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag, proxy = realm; } + gateway->proxy_host_cfg = sofia_glue_get_host_from_cfg(proxy, gateway->pool); + if (!switch_true(register_str)) { gateway->state = REG_STATE_NOREG; gateway->status = SOFIA_GATEWAY_UP; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 10282383d2..1f2afef85c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3539,6 +3539,42 @@ char *sofia_glue_get_profile_url(sofia_profile_t *profile, char *remote_ip, cons return url; } +/* gets the IP or HOST from a sip uri or from x.x.x.x:port format */ +char *sofia_glue_get_host_from_cfg(const char *uri, switch_memory_pool_t *pool) +{ + char *host = NULL; + const char *s; + char *p = NULL; + + if (zstr(uri)) { + return NULL; + } + + if ((s = switch_stristr("sip:", uri)) && s == uri) { + s += 4; + } else if ((s = switch_stristr("sips:", uri)) && s == uri) { + s += 5; + } + + if (!s) { + s = uri; + } + + host = switch_core_strdup(pool, s); + + if ((p = strchr(host, ']'))) { + if (*(p + 1) == ':') { + *(p + 1) = '\0'; + } + } else { + if ((p = strrchr(host, ':'))) { + *p = '\0'; + } + } + + return host; +} + /* For Emacs: * Local Variables: * mode:c diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 03cb0fb6d0..49dc8feeda 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2508,12 +2508,11 @@ switch_bool_t sip_resolve_compare(const char *domainname, const char *ip, sofia_ if (strchr(ip, ':')) { ipv6 = SWITCH_TRUE; } + ret = dig_all_srvs_simple(dig, domainname, ip, ipv6); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "verify 1\n"); if (!ret) { answers = dig_addr_simple(dig, host, ipv6?sres_type_aaaa:sres_type_a); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "verify 2\n"); ret = verify_ip(answers, ip, ipv6); } @@ -2524,6 +2523,36 @@ out: return ret; } +static switch_bool_t is_host_from_gateway(const char *remote_ip, sofia_gateway_t *gateway) +{ + switch_bool_t ret = SWITCH_FALSE; + char *hosts[3]; /* check the 3 places where we keep IP/hostname */ + int i; + + hosts[0] = gateway->proxy_host_cfg; + hosts[1] = gateway->register_proxy_host_cfg; + hosts[2] = gateway->outbound_proxy_host_cfg; + + for (i = 0; i < 3; i++) { + if (zstr(hosts[i])) { + continue; + } + + if (host_is_ip_address(hosts[i])) { + if (!strcmp(hosts[i], remote_ip)) { + ret = SWITCH_TRUE; + } + + if (ret) break; + } else { + ret = sip_resolve_compare(hosts[i], remote_ip, gateway->register_transport); + if (ret) break; + } + } + + return ret; +} + static switch_bool_t is_legitimate_gateway(sofia_dispatch_event_t *de, sofia_gateway_t *gateway) { char remote_ip[80] = { 0 }; @@ -2531,27 +2560,16 @@ static switch_bool_t is_legitimate_gateway(sofia_dispatch_event_t *de, sofia_gat sofia_glue_get_addr(de->data->e_msg, remote_ip, sizeof(remote_ip), NULL); + /* setting param "gw-auth-acl" supersedes everything */ if (gateway->gw_auth_acl) { ret = switch_check_network_list_ip(remote_ip, gateway->gw_auth_acl); if (!ret) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Challange from [%s] denied by gw-auth-acl.\n", remote_ip); } + return ret; } else { - char *register_host = sofia_glue_get_register_host(gateway->register_proxy); - const char *host = sofia_glue_strip_proto(register_host); - - if (host_is_ip_address(host)) { - if (host && !strcmp(host, remote_ip)) { - ret = SWITCH_TRUE; - } - switch_safe_free(register_host); - return ret; - } else { - ret = sip_resolve_compare(host, remote_ip, gateway->register_transport); - switch_safe_free(register_host); - return ret; - } + return is_host_from_gateway(remote_ip, gateway); } } diff --git a/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml index 088a7a545c..dee105561b 100644 --- a/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml +++ b/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml @@ -322,11 +322,41 @@ <param name="username" value="not-used"/> <param name="password" value="not-used"/> <param name="proxy" value="127.0.0.1:5080"/> + <param name="realm" value="no.local"/> <param name="register" value="false"/> <param name="retry-seconds" value="30"/> <param name="dtmf-type" value="rfc2833"/> - <variables> - <variable name="rtp_secure_media" value="false" direction="outbound"/> + <variables> + <variable name="rtp_secure_media" value="false" direction="outbound"/> + </variables> + </gateway> + + <gateway name="testgw"> + <param name="username" value="1001"/> + <param name="password" value="1234"/> + <param name="proxy" value="$${local_ip_v4}:6080"/> + <param name="register" value="true"/> + <param name="realm" value="unresolvable.local"/> + <param name="outbound_proxy" value="$${local_ip_v4}:6080"/> + <param name="register_proxy" value="127.0.0.1:6080"/> + <param name="retry-seconds" value="30"/> + <param name="dtmf-type" value="rfc2833"/> + <variables> + <variable name="rtp_secure_media" value="false" direction="outbound"/> + </variables> + </gateway> + <gateway name="testgw-noreg"> + <param name="username" value="1001"/> + <param name="password" value="1234"/> + <param name="proxy" value="$${local_ip_v4}:6080"/> + <param name="register" value="false"/> + <param name="realm" value="freeswitch.org"/> + <param name="outbound_proxy" value="$${local_ip_v4}:6080"/> + <param name="register_proxy" value="127.0.0.1:6080"/> + <param name="retry-seconds" value="30"/> + <param name="dtmf-type" value="rfc2833"/> + <variables> + <variable name="rtp_secure_media" value="false" direction="outbound"/> </variables> </gateway> </gateways> @@ -365,7 +395,7 @@ <param name="rtp-hold-timeout-sec" value="1800"/> <param name="session-timeout" value="600"/> <param name="minimum-session-expires" value="90"/> - <param name="tls" value="false"/> + <param name="tls" value="false"/> </settings> </profile> 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 382dbc2970..03a0e4a654 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -57,6 +57,22 @@ static switch_bool_t has_ipv6() return SWITCH_TRUE; } +static void register_gw() +{ + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("sofia", "profile external register testgw", NULL, &stream); + switch_safe_free(stream.data); +} + +static void unregister_gw() +{ + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("sofia", "profile external unregister testgw", NULL, &stream); + switch_safe_free(stream.data); +} + static int start_sipp_uac(const char *ip, int remote_port,const char *scenario_uac, const char *extra) { char *cmd = switch_mprintf("sipp %s:%d -nr -p 5062 -m 1 -s 1001 -recv_timeout 10000 -timeout 10s -sf %s -bg %s", ip, remote_port, scenario_uac, extra); @@ -65,24 +81,29 @@ static int start_sipp_uac(const char *ip, int remote_port,const char *scenario_u printf("%s\n", cmd); switch_safe_free(cmd); switch_sleep(1000 * 1000); + return sys_ret; } +static int start_sipp_uas(const char *ip, int listen_port, const char *scenario_uas, const char *extra) +{ + char *cmd = switch_mprintf("sipp %s -p %d -nr -m 1 -s 1001 -recv_timeout 10000 -timeout 10s -sf %s -bg %s", ip, listen_port, scenario_uas, extra); + int sys_ret = switch_system(cmd, SWITCH_TRUE); + + printf("%s\n", cmd); + switch_safe_free(cmd); + switch_sleep(1000 * 1000); + + return sys_ret; +} static void kill_sipp(void) { switch_system("pkill -x sipp", SWITCH_TRUE); switch_sleep(1000 * 1000); } -static void event_handler(switch_event_t *event) -{ - const char *new_ev = switch_event_get_header(event, "Event-Subclass"); +static void show_event(switch_event_t *event) { char *str; - - if (new_ev && !strcmp(new_ev, "sofia::gateway_invalid_digest_req")) { - test_success = 1; - } - /*print the event*/ switch_event_serialize_json(event, &str); if (str) { @@ -91,6 +112,45 @@ static void event_handler(switch_event_t *event) } } +static void event_handler(switch_event_t *event) +{ + const char *new_ev = switch_event_get_header(event, "Event-Subclass"); + + if (new_ev && !strcmp(new_ev, "sofia::gateway_invalid_digest_req")) { + test_success = 1; + } + + show_event(event); +} + +static void event_handler_reg_ok(switch_event_t *event) +{ + const char *new_ev = switch_event_get_header(event, "Event-Subclass"); + + if (new_ev && !strcmp(new_ev, "sofia::gateway_state")) { + const char *state = switch_event_get_header(event, "State"); + if (state && !strcmp(state, "REGED")) { + test_success++; + } + } + + show_event(event); +} + +static void event_handler_reg_fail(switch_event_t *event) +{ + const char *new_ev = switch_event_get_header(event, "Event-Subclass"); + + if (new_ev && !strcmp(new_ev, "sofia::gateway_state")) { + const char *state = switch_event_get_header(event, "State"); + if (state && !strcmp(state, "FAIL_WAIT")) { + test_success++; + } + } + + show_event(event); +} + FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) { FST_MODULE_BEGIN(mod_sofia, uac-uas) @@ -289,6 +349,132 @@ skiptest: } FST_TEST_END() + FST_TEST_BEGIN(register_ok) + { + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + int sipp_ret; + + switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler_reg_ok, NULL); + + sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uas_register.xml", ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + + switch_sleep(1000 * 1000); + + register_gw(); + + switch_sleep(5000 * 1000); + + switch_event_unbind_callback(event_handler_reg_ok); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); + test_success = 0; + } + FST_TEST_END() + + FST_TEST_BEGIN(register_403) + { + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + int sipp_ret; + + switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler_reg_fail, NULL); + + sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uas_register_403.xml", ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + + switch_sleep(1000 * 1000); + + register_gw(); + + switch_sleep(5000 * 1000); + + switch_event_unbind_callback(event_handler_reg_fail); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); + test_success = 0; + } + FST_TEST_END() + + FST_TEST_BEGIN(register_no_challange) + { + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + int sipp_ret; + + switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler_reg_ok, NULL); + + sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uas_register_no_challange.xml", ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + + switch_sleep(1000 * 1000); + + register_gw(); + + switch_sleep(5000 * 1000); + + /*the REGISTER with Expires 0 */ + unregister_gw(); + + switch_sleep(1000 * 1000); + + register_gw(); + + switch_sleep(1000 * 1000); + + switch_event_unbind_callback(event_handler_reg_ok); + + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); + test_success = 0; + } + FST_TEST_END() + + FST_TEST_BEGIN(invite_407) + { + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + int sipp_ret; + switch_core_session_t *session; + switch_call_cause_t cause; + switch_status_t status; + switch_channel_t *channel; + char *to; + const int inv_sipp_port = 6082; + + sipp_ret = start_sipp_uas(local_ip_v4, inv_sipp_port, "sipp-scenarios/uas_407.xml", ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + + switch_sleep(1000 * 1000); + to = switch_mprintf("sofia/gateway/testgw-noreg/sipp@%s:%d", local_ip_v4, inv_sipp_port); + /*originate will fail if the 407 we get from sipp is dropped due to wrong IP.*/ + status = switch_ivr_originate(NULL, &session, &cause, to, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + + /*test is considered PASSED if we get a session*/ + if (!session) { + fst_requires(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(); + } + FST_TEST_END() + } FST_MODULE_END() } diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_407.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_407.xml new file mode 100644 index 0000000000..62ac17babc --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_407.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE scenario SYSTEM "sipp.dtd"> + +<scenario name="UAS 407"> + +<recv request="INVITE" /> + <send><![CDATA[ + + SIP/2.0 407 Authorization Required + [last_Via:] + [last_From:] + [last_To:];tag=[pid]SIPpTag01[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + Proxy-Authenticate: Digest realm="freeswitch.org", nonce="47ebe028cda119c35d4877b383027d28da013815" + Content-Length: [len] + + ]]> + </send> + <recv request="ACK" timeout="1000"> + </recv> + + <recv request="INVITE" timeout="1000"> + </recv> + <send> + <![CDATA[ + + SIP/2.0 180 Ringing + [last_Via:] + [last_From:] + [last_To:];tag=[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + Content-Length: 0 + + ]]> + </send> + <pause milliseconds="1000"/> + <send> + <![CDATA[ + + SIP/2.0 200 OK + [last_Via:] + [last_From:] + [last_To:];tag=[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip] + s=- + c=IN IP[media_ip_type] [media_ip] + t=0 0 + m=audio [media_port] RTP/AVP 0 + a=rtpmap:0 PCMU/8000 + + ]]> + </send> + <recv request="ACK" timeout="1000"> + </recv> + + <!-- definition of the response time repartition table (unit is ms) --> + <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> + <!-- definition of the call length repartition table (unit is ms) --> + <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> +</scenario> + diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register.xml new file mode 100644 index 0000000000..ae9681663d --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE scenario SYSTEM "sipp.dtd"> + +<scenario name="UAS Registrar"> + +<recv request="REGISTER" /> + <send><![CDATA[ + + SIP/2.0 401 Authorization Required + [last_Via:] + [last_From:] + [last_To:];tag=[pid]SIPpTag01[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + WWW-Authenticate: Digest realm="freeswitch.org", nonce="47ebe028cda119c35d4877b383027d28da013815" + Content-Length: [len] + + ]]> + </send> + <recv request="REGISTER" > + </recv> + <send> + <![CDATA[ + + SIP/2.0 200 OK + [last_Via:] + [last_From:] + [last_To:];tag=[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + Content-Length: 0 + Expires: 60 + + ]]> + </send> + <!-- definition of the response time repartition table (unit is ms) --> + <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> + <!-- definition of the call length repartition table (unit is ms) --> + <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> +</scenario> + diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register_403.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register_403.xml new file mode 100644 index 0000000000..9a42f1a7a4 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register_403.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE scenario SYSTEM "sipp.dtd"> + +<scenario name="UAS Registrar"> + +<recv request="REGISTER" /> + <send><![CDATA[ + + SIP/2.0 401 Authorization Required + [last_Via:] + [last_From:] + [last_To:];tag=[pid]SIPpTag01[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + WWW-Authenticate: Digest realm="freeswitch.org", nonce="81dc9bdb52d04dc20036dbd8313ed055" + Content-Length: [len] + + ]]> + </send> + <recv request="REGISTER" > + </recv> + <send> + <![CDATA[ + + SIP/2.0 403 Forbidden + [last_Via:] + [last_From:] + [last_To:];tag=[pid]SIPpTag01[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + Content-Length: 0 + + ]]> + </send> + <!-- definition of the response time repartition table (unit is ms) --> + <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> + <!-- definition of the call length repartition table (unit is ms) --> + <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> +</scenario> + diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register_no_challange.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register_no_challange.xml new file mode 100644 index 0000000000..175149a026 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uas_register_no_challange.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> + +<scenario name="Basic UAS responder"> + <!-- By adding rrs="true" (Record Route Sets), the route sets --> + <!-- are saved and used for following messages sent. Useful to test --> + <!-- against stateful SIP proxies/B2BUAs. --> + <recv request="REGISTER" crlf="true"> + </recv> + + <send retrans="500"> + <![CDATA[ + SIP/2.0 200 OK + [last_Via:] + [last_From:] + [last_To:];tag=[pid]SIPpTag01[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + ]]> + </send> + + <recv request="REGISTER" crlf="true"> + </recv> + + <send retrans="500"> + <![CDATA[ + SIP/2.0 200 OK + [last_Via:] + [last_From:] + [last_To:];tag=[pid]SIPpTag01[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + ]]> + </send> + + <recv request="REGISTER" crlf="true"> + </recv> + + <send retrans="500"> + <![CDATA[ + SIP/2.0 200 OK + [last_Via:] + [last_From:] + [last_To:];tag=[pid]SIPpTag01[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + ]]> + </send> + + <!-- definition of the response time repartition table (unit is ms) --> + <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> + + <!-- definition of the call length repartition table (unit is ms) --> + <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> + +</scenario> From 9eb20d7b54a1abf77ecef37b45ab25d08e49a0fe Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Mon, 30 Aug 2021 09:44:26 +0000 Subject: [PATCH 155/655] [mod_sofia] fix memleak on gw registration timeout or 403 --- src/mod/endpoints/mod_sofia/sofia.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index a752a4a8f4..4af8d3d451 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3500,10 +3500,24 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } } - /* Do gateway cleanups */ + /* Gateway cleanup start */ + /* Mark all gateways as deleted and set REG_STATE_UNREGISTER state on REG gateways */ sofia_glue_del_every_gateway(profile); + /* First call will unregister and set state to DOWN so a gateway is ready for deletion */ sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); sofia_sub_check_gateway(profile, switch_epoch_time_now(NULL)); + /* + * The gateway life cycle requires a gateway to go though different states before it's destroyed. + * Normally sofia_reg_check_gateway() is called periodically + * but it's not the case on profile shutdown. + * + * All REG gateways should be DOWN now and can be finally deleted. + * Calling sofia_reg_check_gateway() second time. + */ + sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); + sofia_sub_check_gateway(profile, switch_epoch_time_now(NULL)); + /* Gateway cleanup end */ + sofia_glue_fire_events(profile); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n"); From 6827c663739e268e92d0e99572295f37dd40f23f Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 14 Sep 2021 14:24:42 -0400 Subject: [PATCH 156/655] [mod_verto] Handle short read from websocket. This fixes an interop problem with iOS 15. --- src/mod/endpoints/mod_verto/ws.c | 53 ++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index be2fd8296c..122b6433c0 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -418,6 +418,23 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block) return r; } +/* + * Blocking read until bytes have been received, failure, or too many retries. + */ +static ssize_t ws_raw_read_blocking(wsh_t *wsh, char *data, size_t max_bytes, int max_retries) +{ + ssize_t total_bytes_read = 0; + while (total_bytes_read < max_bytes && max_retries-- > 0) { + ssize_t bytes_read = ws_raw_read(wsh, data + total_bytes_read, max_bytes - total_bytes_read, WS_BLOCK); + if (bytes_read < 0) { + break; + } + total_bytes_read += bytes_read; + } + return total_bytes_read; +} + + ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) { ssize_t r; @@ -820,8 +837,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) if (wsh->datalen < need) { ssize_t bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, 9 - wsh->datalen, WS_BLOCK); - - if (bytes < 0 || (wsh->datalen + bytes) < need) { + if (bytes < 0 || (wsh->datalen += bytes) < need) { /* too small - protocol err */ return ws_close(wsh, WS_NONE); } @@ -857,9 +873,12 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) need += 4; if (need > wsh->datalen) { - /* too small - protocol err */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_NONE); + ssize_t bytes = ws_raw_read_blocking(wsh, wsh->buffer + wsh->datalen, need - wsh->datalen, 10); + if (bytes < 0 || (wsh->datalen += bytes) < need) { + /* too small - protocol err */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_NONE); + } } } @@ -868,25 +887,16 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) if (wsh->plen == 127) { uint64_t *u64; - int more = 0; need += 8; if (need > wsh->datalen) { - /* too small - protocol err */ - //*oc = WSOC_CLOSE; - //return ws_close(wsh, WS_PROTO_ERR); - - more = ws_raw_read(wsh, wsh->buffer + wsh->datalen, need - wsh->datalen, WS_BLOCK); - - if (more < 0 || more < need - wsh->datalen) { + ssize_t bytes = ws_raw_read_blocking(wsh, wsh->buffer + wsh->datalen, need - wsh->datalen, 10); + if (bytes < 0 || (wsh->datalen += bytes) < need) { + /* too small - protocol err */ *oc = WSOC_CLOSE; return ws_close(wsh, WS_NONE); - } else { - wsh->datalen += more; } - - } u64 = (uint64_t *) wsh->payload; @@ -898,9 +908,12 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) need += 2; if (need > wsh->datalen) { - /* too small - protocol err */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_NONE); + ssize_t bytes = ws_raw_read_blocking(wsh, wsh->buffer + wsh->datalen, need - wsh->datalen, 10); + if (bytes < 0 || (wsh->datalen += bytes) < need) { + /* too small - protocol err */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_NONE); + } } u16 = (uint16_t *) wsh->payload; From 5aacf41f142d2e17045724828ddff599546d6784 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Sat, 25 Sep 2021 11:33:16 +0000 Subject: [PATCH 157/655] [core] add core media getter (it gets the RTP session, handy for unit-testing). --- src/include/switch_core_media.h | 1 + src/switch_core_media.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index cb454c4983..19a923e64e 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -207,6 +207,7 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio SWITCH_DECLARE(uint32_t) switch_core_media_get_video_fps(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_media_set_rtp_session(switch_core_session_t *session, switch_media_type_t type, switch_rtp_t *rtp_session); +SWITCH_DECLARE(switch_rtp_t *) switch_core_media_get_rtp_session(switch_core_session_t *session, switch_media_type_t type); SWITCH_DECLARE(const char *)switch_core_media_get_codec_string(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_media_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 686bc344f7..bfacc704df 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -1612,6 +1612,12 @@ SWITCH_DECLARE(void) switch_core_media_set_rtp_session(switch_core_session_t *se engine->type = type; } +SWITCH_DECLARE(switch_rtp_t *) switch_core_media_get_rtp_session(switch_core_session_t *session, switch_media_type_t type) +{ + switch_assert(session); + if (!session->media_handle) return NULL; + return session->media_handle->engines[type].rtp_session; +} static void switch_core_session_get_recovery_crypto_key(switch_core_session_t *session, switch_media_type_t type) { From bb7bf86bb9c95697e67fe94cab85fb3a12ce686e Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Sat, 25 Sep 2021 11:11:46 +0000 Subject: [PATCH 158/655] [core] print SRTP lib version at init. --- src/switch_rtp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index d4e3f10218..d3f43faef1 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1533,7 +1533,14 @@ SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool) } #endif #ifdef ENABLE_SRTP - srtp_init(); + { + srtp_err_status_t stat = srtp_init(); + if (stat == srtp_err_status_ok) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SRTP (%s) initialized.\n", srtp_get_version_string()); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initializing SRTP (%d).\n", stat); + } + } #endif switch_mutex_init(&port_lock, SWITCH_MUTEX_NESTED, pool); switch_rtp_dtls_init(); From d1220d1818ba4cc13441336e5548aec9a0c6c204 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 30 Sep 2021 17:13:21 +0300 Subject: [PATCH 159/655] [libsrtp] Fix build on MAC OS --- libs/srtp/crypto/include/datatypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/srtp/crypto/include/datatypes.h b/libs/srtp/crypto/include/datatypes.h index 5164cf0021..55bcd73855 100644 --- a/libs/srtp/crypto/include/datatypes.h +++ b/libs/srtp/crypto/include/datatypes.h @@ -168,7 +168,7 @@ void octet_string_set_to_zero(void *s, size_t len); #define be64_to_cpu(x) bswap_64((x)) #else /* WORDS_BIGENDIAN */ -#if defined(__GNUC__) && (defined(HAVE_X86) || defined(__x86_64__)) +#if defined(__GNUC__) && defined(HAVE_X86) /* Fall back. */ static inline uint32_t be32_to_cpu(uint32_t v) { From 0924fed31da410760b50b4c3ddc08bded889e50c Mon Sep 17 00:00:00 2001 From: Dhruv Gupta <87171798+dhruvecosmob@users.noreply.github.com> Date: Fri, 1 Oct 2021 03:07:03 +0530 Subject: [PATCH 160/655] [mod_sofia] Deprecate the auth-subscriptions profile param by setting it to be enabled by default and introducing the new disable-auth-subscriptions param with a higher priority when set. --- .../endpoints/mod_sofia/conf/sofia.conf.xml | 8 +++ src/mod/endpoints/mod_sofia/sofia.c | 24 +++++++-- .../mod_sofia/test/conf-sipp/freeswitch.xml | 2 +- .../mod_sofia/test/sipp-based-tests.c | 53 ++++++++++++++++++- .../sipp-scenarios/uac_407_subscriber.xml | 50 +++++++++++++++++ .../test/sipp-scenarios/uac_subscriber.xml | 28 ++++++++++ 6 files changed, 158 insertions(+), 7 deletions(-) create mode 100644 src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_407_subscriber.xml create mode 100644 src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_subscriber.xml diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 3166094a27..37e0937aeb 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -330,6 +330,14 @@ disable-auth-messages param has higher priority than the deprecated auth-messages param. --> <!-- <param name="disable-auth-messages" value="true"/> --> + <!-- NOTICE: auth-subscriptions was deprecated and authentication is enabled by default now. + See disable-auth-subscriptions param for more details. --> + <!-- <param name="auth-subscriptions" value="false"/> --> + <!-- Uncomment to stop authentication on subscriptions packets. + By default authentication is enabled. + disable-auth-subscriptions param has higher priority than the deprecated auth-subscriptions param. --> + <!-- <param name="disable-auth-subscriptions" value="true"/> --> + <!-- external_sip_ip Used as the public IP address for SDP. Can be an one of: diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4af8d3d451..b5051dda76 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4591,7 +4591,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else { switch_memory_pool_t *pool = NULL; char *auth_messages_value = NULL; - uint8_t disable_auth_flag = 0; + char *auth_subscriptions_value = NULL; + uint8_t disable_message_auth_flag = 0; + uint8_t disable_subscription_auth_flag = 0; if (!xprofilename) { xprofilename = "unnamed"; @@ -5593,13 +5595,17 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) sofia_set_pflag(profile, PFLAG_AUTH_MESSAGES); } - disable_auth_flag = 1; + disable_message_auth_flag = 1; } else if (!strcasecmp(var, "auth-subscriptions")) { + auth_subscriptions_value = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "disable-auth-subscriptions")) { if (switch_true(val)) { - sofia_set_pflag(profile, PFLAG_AUTH_SUBSCRIPTIONS); - } else { sofia_clear_pflag(profile, PFLAG_AUTH_SUBSCRIPTIONS); + } else { + sofia_set_pflag(profile, PFLAG_AUTH_SUBSCRIPTIONS); } + + disable_subscription_auth_flag = 1; } else if (!strcasecmp(var, "extended-info-parsing")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_EXTENDED_INFO_PARSING); @@ -6104,7 +6110,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } - if (!disable_auth_flag) { + if (!disable_message_auth_flag) { if (!auth_messages_value || switch_true(auth_messages_value)) { sofia_set_pflag(profile, PFLAG_AUTH_MESSAGES); } else { @@ -6112,6 +6118,14 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } + if (!disable_subscription_auth_flag) { + if (!auth_subscriptions_value || switch_true(auth_subscriptions_value)) { + sofia_set_pflag(profile, PFLAG_AUTH_SUBSCRIPTIONS); + } else { + sofia_clear_pflag(profile, PFLAG_AUTH_SUBSCRIPTIONS); + } + } + if (sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) && !sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ZRTP passthrough implictly enables inbound-late-negotiation\n"); sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); diff --git a/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml index dee105561b..f75764a5f0 100644 --- a/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml +++ b/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml @@ -424,7 +424,7 @@ <param name="outbound-codec-prefs" value="PCMU"/> <param name="rtp-timer-name" value="soft"/> <param name="local-network-acl" value="localnet.auto"/> - <param name="manage-presence" value="false"/> + <param name="manage-presence" value="true"/> <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> 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 03a0e4a654..5f24da0fa8 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -96,6 +96,18 @@ static int start_sipp_uas(const char *ip, int listen_port, const char *scenario_ return sys_ret; } +static int run_sipp(const char *ip, int remote_port, int listen_port, const char *dialed_number, const char *scenario_uac, const char *auth_password, const char *extra) +{ + char *cmd = switch_mprintf("sipp %s:%d -nr -p %d -m 1 -s %s -recv_timeout 10000 -timeout 10s -sf %s -au %s -ap %s -bg %s", ip, remote_port, listen_port, dialed_number, scenario_uac, dialed_number, auth_password, extra); + int sys_ret = switch_system(cmd, SWITCH_TRUE); + + printf("%s\n", cmd); + switch_safe_free(cmd); + switch_sleep(1000 * 1000); + + return sys_ret; +} + static void kill_sipp(void) { switch_system("pkill -x sipp", SWITCH_TRUE); @@ -382,7 +394,7 @@ skiptest: switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler_reg_fail, NULL); - sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uas_register_403.xml", ""); + sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uac_407_subscriber.xml", "-inf data.csv"); if (sipp_ret < 0 || sipp_ret == 127) { fst_requires(0); /* sipp not found */ } @@ -401,6 +413,45 @@ skiptest: } FST_TEST_END() + FST_TEST_BEGIN(subscribe_auth_check) + { + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + const char *auth_password = switch_core_get_variable("default_password"); + switch_cache_db_handle_t *dbh = NULL; + char *dsn = "sofia_reg_internal"; + char count[20]=""; + char count1[20]=""; + int sipp_ret; + + /* check without 407 Proxy Authentication. If count not 0 fail case. */ + sipp_ret = run_sipp(local_ip_v4, 5060, 6091, "1001", "sipp-scenarios/uac_subscriber.xml", auth_password, ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + switch_sleep(100 * 1000); + + if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) == SWITCH_STATUS_SUCCESS) { + switch_cache_db_execute_sql2str(dbh, "select count(*) from sip_subscriptions where contact like \"%1001%6091%\";", (char *)&count1, 20, NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Count : %s\n", count1); + } + fst_check_string_equals(count1, "0"); + + /* check with 407 Proxy Authentication Required. If count not 1 fail case. */ + sipp_ret = run_sipp(local_ip_v4, 5060, 6090, "1001", "sipp-scenarios/uac_407_subscriber.xml", auth_password, ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + switch_sleep(100 * 1000); + + switch_cache_db_execute_sql2str(dbh, "select count(*) from sip_subscriptions where contact like \"%1001%6090%\";", (char *)&count, 20, NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Count : %s\n", count); + fst_check_string_equals(count, "1"); + + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + } + FST_TEST_END() + FST_TEST_BEGIN(register_no_challange) { const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_407_subscriber.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_407_subscriber.xml new file mode 100644 index 0000000000..9e484fb9d2 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_407_subscriber.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<scenario name="UAC with challenge subscribe"> + + <send retrans="500"> + <![CDATA[ + + SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]> + Call-ID: [call_id] + CSeq: 1 SUBSCRIBE + Contact: sip:[service]@[local_ip]:[local_port] + Max-Forwards: 70 + Event: presence + Allow: SUBSCRIBE + Expires: 120 + Accept: application/simple-message-summary + Allow-Events: presence, kpml + Content-Length: 0 + + ]]> + </send> + + <recv response="407" rtd="true" auth="true"/> + + <send retrans="500"> + <![CDATA[ + + SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]> + Call-ID: [call_id] + CSeq: 2 SUBSCRIBE + Contact: sip:[service]@[local_ip]:[local_port] + Max-Forwards: 70 + Event: presence + Expires: 120 + Allow: SUBSCRIBE + Accept: application/simple-message-summary + Allow-Events: presence, kpml + Content-Length: 0 + [authentication] + + ]]> + </send> + +</scenario> + diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_subscriber.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_subscriber.xml new file mode 100644 index 0000000000..69107bd39d --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_subscriber.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<scenario name="UAC with subscribe only"> + + <send retrans="500"> + <![CDATA[ + + SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]> + Call-ID: [call_id] + CSeq: 1 SUBSCRIBE + Contact: sip:[service]@[local_ip]:[local_port] + Max-Forwards: 70 + Event: presence + Allow: SUBSCRIBE + Expires: 120 + Accept: application/simple-message-summary + Allow-Events: presence, kpml + Content-Length: 0 + + ]]> + </send> + + <recv response="202" timeout="2000"> + </recv> + +</scenario> From d24280c700fc8201211e27693741a2d4cf7f417d Mon Sep 17 00:00:00 2001 From: Noah Mehl <noahmehl@tinyhomeconsultingllc.com> Date: Thu, 18 Jun 2020 09:53:49 -0400 Subject: [PATCH 161/655] [core] Add SEND_RTCP_MESSAGE We utilize: https://github.com/sipcapture/hepipe.js to monitor RTCP for our calls. As such, it's super helpful to get the sent RTCP data along with the received RTCP data. The new: SEND_RTCP_MESSAGE basically mirrors the existing RECV_RTCP_MESSAGE. --- libs/esl/src/esl_event.c | 1 + libs/esl/src/include/esl_event.h | 1 + src/include/switch_types.h | 3 ++ src/switch_core_media.c | 4 ++ src/switch_event.c | 1 + src/switch_rtp.c | 91 ++++++++++++++++++++++++++++++-- 6 files changed, 98 insertions(+), 3 deletions(-) diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 68e0688114..8a88395ec2 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -132,6 +132,7 @@ static const char *EVENT_NAMES[] = { "SEND_INFO", "RECV_INFO", "RECV_RTCP_MESSAGE", + "SEND_RTCP_MESSAGE", "CALL_SECURE", "NAT", "RECORD_START", diff --git a/libs/esl/src/include/esl_event.h b/libs/esl/src/include/esl_event.h index de070ad723..01e7ada07e 100644 --- a/libs/esl/src/include/esl_event.h +++ b/libs/esl/src/include/esl_event.h @@ -120,6 +120,7 @@ typedef enum { ESL_EVENT_SEND_INFO, ESL_EVENT_RECV_INFO, ESL_EVENT_RECV_RTCP_MESSAGE, + ESL_EVENT_SEND_RTCP_MESSAGE, ESL_EVENT_CALL_SECURE, ESL_EVENT_NAT, ESL_EVENT_RECORD_START, diff --git a/src/include/switch_types.h b/src/include/switch_types.h index fafc508823..958f2b136a 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -843,6 +843,7 @@ typedef enum { SWITCH_RTP_FLAG_PASSTHRU, SWITCH_RTP_FLAG_SECURE_SEND_MKI, SWITCH_RTP_FLAG_SECURE_RECV_MKI, + SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT, SWITCH_RTP_FLAG_INVALID } switch_rtp_flag_t; @@ -2037,6 +2038,7 @@ typedef uint32_t switch_io_flag_t; SWITCH_EVENT_SEND_INFO SWITCH_EVENT_RECV_INFO SWITCH_EVENT_RECV_RTCP_MESSAGE + SWITCH_EVENT_SEND_RTCP_MESSAGE SWITCH_EVENT_CALL_SECURE SWITCH_EVENT_NAT - NAT Management (new/del/status) SWITCH_EVENT_RECORD_START @@ -2132,6 +2134,7 @@ typedef enum { SWITCH_EVENT_SEND_INFO, SWITCH_EVENT_RECV_INFO, SWITCH_EVENT_RECV_RTCP_MESSAGE, + SWITCH_EVENT_SEND_RTCP_MESSAGE, SWITCH_EVENT_CALL_SECURE, SWITCH_EVENT_NAT, SWITCH_EVENT_RECORD_START, diff --git a/src/switch_core_media.c b/src/switch_core_media.c index bfacc704df..57273d96f1 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -9510,6 +9510,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi if (v_engine->tmmbr) { flags[SWITCH_RTP_FLAG_TMMBR]++; } + + if (switch_channel_var_true(session->channel, "enable_send_rtcp_message_event_video")) { + flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] = 1; + } v_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip, v_engine->local_sdp_port, diff --git a/src/switch_event.c b/src/switch_event.c index 709ea95e7e..0a0e4b3c6c 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -207,6 +207,7 @@ static char *EVENT_NAMES[] = { "SEND_INFO", "RECV_INFO", "RECV_RTCP_MESSAGE", + "SEND_RTCP_MESSAGE", "CALL_SECURE", "NAT", "RECORD_START", diff --git a/src/switch_rtp.c b/src/switch_rtp.c index d3f43faef1..59882a122a 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -26,6 +26,7 @@ * Anthony Minessale II <anthm@freeswitch.org> * Marcel Barbulescu <marcelbarbulescu@gmail.com> * Seven Du <dujinfang@gmail.com> + * Noah Mehl - Open Telecom Foundation <https://opentelecom.foundation> * * switch_rtp.c -- RTP * @@ -1816,10 +1817,10 @@ static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_r sr->oc = htonl(rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t)); switch_time_exp_gmt(&now_hr,now); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] stats_ssrc[%u]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] stats_ssrc[%u] packet_count[%u] OC[%u]\n", 1900 + now_hr.tm_year, now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec, (ntohl(sr->ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->ntp_msw)&0x0000ffff)<<16, - ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->stats.rtcp.ssrc + ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->stats.rtcp.ssrc, ntohl(sr->pc), ntohl(sr->oc) ); } @@ -1895,7 +1896,13 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ } rtcp_report_block->lsr = stats->last_recv_lsr_peer; rtcp_report_block->dlsr = htonl(dlsr); - rtcp_report_block->ssrc = htonl(rtp_session->stats.rtcp.peer_ssrc); + if (rtp_session->stats.rtcp.peer_ssrc) { + rtcp_report_block->ssrc = htonl(rtp_session->stats.rtcp.peer_ssrc); + } else { + /* if remote is not sending rtcp reports, take ssrc as assigned from rtp */ + rtcp_report_block->ssrc = htonl(rtp_session->remote_ssrc); + } + stats->rtcp_rtp_count++; } @@ -2057,6 +2064,79 @@ static int using_ice(switch_rtp_t *rtp_session) return 0; } +static void switch_send_rtcp_event(switch_rtp_t *rtp_session ,struct switch_rtcp_sender_report *sr,struct switch_rtcp_report_block *rtcp_report_block) +{ + if (sr && rtcp_report_block) { + switch_event_t *event; + + if (switch_event_create(&event, SWITCH_EVENT_SEND_RTCP_MESSAGE) == SWITCH_STATUS_SUCCESS) { + char value[30]; + char header[50]; + uint32_t tmpLost; + char *uuid = switch_core_session_get_uuid(rtp_session->session); + if (uuid) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(rtp_session->session)); + } + + snprintf(value, sizeof(value), "%.8x", rtp_session->stats.rtcp.ssrc); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SSRC", value); + + snprintf(value, sizeof(value), "%u", ntohl(sr->sender_info.ntp_msw)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "NTP-Most-Significant-Word", value); + + snprintf(value, sizeof(value), "%u", ntohl(sr->sender_info.ntp_lsw)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "NTP-Least-Significant-Word", value); + + snprintf(value, sizeof(value), "%u", ntohl(sr->sender_info.ts)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "RTP-Timestamp", value); + + snprintf(value, sizeof(value), "%u", ntohl(sr->sender_info.pc)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Sender-Packet-Count", value); + + snprintf(value, sizeof(value), "%u", ntohl(sr->sender_info.oc)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Octect-Packet-Count", value); + + snprintf(value, sizeof(value), "%u", ntohl(sr->sender_info.ts)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Last-RTP-Timestamp", value); + + snprintf(value, sizeof(value), "%" SWITCH_TIME_T_FMT, switch_time_now()); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Capture-Time", value); + + /* Add sources info */ + snprintf(header, sizeof(header), "Source-SSRC"); + snprintf(value, sizeof(value), "%.8x", rtp_session->stats.rtcp.peer_ssrc); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value); + snprintf(header, sizeof(header), "Source-Fraction"); + snprintf(value, sizeof(value), "%u", (uint8_t)rtcp_report_block->fraction); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value); + snprintf(header, sizeof(header), "Source-Lost"); +#if SWITCH_BYTE_ORDER == __BIG_ENDIAN + tmpLost = report->lost; /* signed 24bit will extended signess to int32_t automatically */ +#else + tmpLost = ntohl(rtcp_report_block->lost)>>8; + tmpLost = tmpLost | ((tmpLost & 0x00800000) ? 0xff000000 : 0x00000000); /* ...and signess compensation */ +#endif + snprintf(value, sizeof(value), "%u", tmpLost); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value); + snprintf(header, sizeof(header), "Source-Highest-Sequence-Number-Received"); + snprintf(value, sizeof(value), "%u", ntohl(rtcp_report_block->highest_sequence_number_received)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value); + snprintf(header, sizeof(header), "Source-Jitter"); + snprintf(value, sizeof(value), "%u", ntohl(rtcp_report_block->jitter)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value); + snprintf(header, sizeof(header), "Source-LSR"); + snprintf(value, sizeof(value), "%u", ntohl(rtcp_report_block->lsr)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value); + snprintf(header, sizeof(header), "Source-DLSR"); + snprintf(value, sizeof(value), "%u", ntohl(rtcp_report_block->dlsr)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value); + + switch_event_fire(&event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10, "Dispatched RTCP SEND event\n"); + } + } +} + #define MAX_NACK 10 static int check_rtcp_and_ice(switch_rtp_t *rtp_session) { @@ -2206,6 +2286,11 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rtcp_generate_report_block(rtp_session, rtcp_report_block, nack_dup); rtp_session->rtcp_send_msg.header.count = 1; /* reception report block count */ stats->sent_pkt_count = 0; + /* send event for audio, or video if flag set */ + if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] || + !(rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] || rtp_session->flags[SWITCH_RTP_FLAG_TEXT])) { + switch_send_rtcp_event(rtp_session, sr, rtcp_report_block); + } } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP SR (ssrc=%u)\n", rtp_session->ssrc); } From 607f5db1406f3c0eca0a0473ebcbfc0b283402ba Mon Sep 17 00:00:00 2001 From: Ryan Mitchell <rjm@tcl.net> Date: Thu, 16 Sep 2021 20:17:28 -0700 Subject: [PATCH 162/655] [core] add SEND_RTCP_MESSAGE: toggle send rtcp events off fire_rtcp_events. eval most common path first when checking flags. --- src/include/switch_types.h | 1 + src/switch_core_media.c | 8 ++++++-- src/switch_rtp.c | 5 ++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 958f2b136a..059023e450 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -843,6 +843,7 @@ typedef enum { SWITCH_RTP_FLAG_PASSTHRU, SWITCH_RTP_FLAG_SECURE_SEND_MKI, SWITCH_RTP_FLAG_SECURE_RECV_MKI, + SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT, SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT, SWITCH_RTP_FLAG_INVALID } switch_rtp_flag_t; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 57273d96f1..40180edc38 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -8775,6 +8775,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi switch_channel_set_variable(session->channel, "rtp_use_timer_name", timer_name); + if (switch_channel_var_true(session->channel, "fire_rtcp_events")) { + flags[SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT] = 1; + } a_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip, a_engine->local_sdp_port, @@ -9511,8 +9514,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi flags[SWITCH_RTP_FLAG_TMMBR]++; } - if (switch_channel_var_true(session->channel, "enable_send_rtcp_message_event_video")) { - flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] = 1; + if (switch_channel_var_true(session->channel, "fire_rtcp_events") && + switch_channel_var_true(session->channel, "enable_send_rtcp_message_event_video")) { + flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] = 1; } v_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip, diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 59882a122a..e2fcf45419 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2286,9 +2286,8 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) rtcp_generate_report_block(rtp_session, rtcp_report_block, nack_dup); rtp_session->rtcp_send_msg.header.count = 1; /* reception report block count */ stats->sent_pkt_count = 0; - /* send event for audio, or video if flag set */ - if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] || - !(rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] || rtp_session->flags[SWITCH_RTP_FLAG_TEXT])) { + if ((!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->flags[SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT]) || + (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT])) { switch_send_rtcp_event(rtp_session, sr, rtcp_report_block); } } From acbe88d18d8a8e6c03ba05d43a4473c9dcf22a33 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Thu, 30 Sep 2021 11:39:39 +0000 Subject: [PATCH 163/655] [core] polish SEND_RTCP_MESSAGE --- src/switch_core_media.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 40180edc38..0e94724249 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -8596,6 +8596,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi goto end; } + if (switch_channel_var_true(session->channel, "fire_rtcp_events")) { + flags[SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT] = 1; + if (switch_channel_test_flag(session->channel, CF_VIDEO_POSSIBLE) && + switch_channel_var_true(session->channel, "rtp_video_send_rtcp_message_event")) { + flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] = 1; + } + } + if (!is_reinvite) { if (switch_rtp_ready(a_engine->rtp_session)) { if (switch_channel_test_flag(session->channel, CF_TEXT_POSSIBLE) && !switch_rtp_ready(t_engine->rtp_session)) { @@ -8774,11 +8782,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi if (switch_channel_up(session->channel)) { switch_channel_set_variable(session->channel, "rtp_use_timer_name", timer_name); - - if (switch_channel_var_true(session->channel, "fire_rtcp_events")) { - flags[SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT] = 1; - } - a_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip, a_engine->local_sdp_port, a_engine->cur_payload_map->remote_sdp_ip, @@ -9513,11 +9516,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi if (v_engine->tmmbr) { flags[SWITCH_RTP_FLAG_TMMBR]++; } - - if (switch_channel_var_true(session->channel, "fire_rtcp_events") && - switch_channel_var_true(session->channel, "enable_send_rtcp_message_event_video")) { - flags[SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT] = 1; - } v_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip, v_engine->local_sdp_port, From 79980f07677da8a8e73fe6fa54c240c0b40a0949 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Fri, 1 Oct 2021 18:17:51 +0000 Subject: [PATCH 164/655] [unit-tests] add SEND_RTCP_MESSAGE event/rtcp unit-test. --- tests/unit/conf/freeswitch.xml | 18 ++++ tests/unit/switch_rtp.c | 178 ++++++++++++++++++++++++++++++++- 2 files changed, 195 insertions(+), 1 deletion(-) diff --git a/tests/unit/conf/freeswitch.xml b/tests/unit/conf/freeswitch.xml index 3dcb33198b..99609824b5 100644 --- a/tests/unit/conf/freeswitch.xml +++ b/tests/unit/conf/freeswitch.xml @@ -5,6 +5,7 @@ <X-PRE-PROCESS cmd="exec-set" data="shell_exec_set_test=ls / | grep usr"/> <X-PRE-PROCESS cmd="set" data="spawn_instead_of_system=false"/> <X-PRE-PROCESS cmd="set" data="default_password=$${test}"/> + <X-PRE-PROCESS cmd="set" data="rtp_timer_name=soft" /> <section name="configuration" description="Various Configuration"> <configuration name="modules.conf" description="Modules"> <modules> @@ -23,6 +24,23 @@ </modules> </configuration> +<configuration name="switch.conf" description="Core Configuration"> + + <default-ptimes> + </default-ptimes> + + <settings> + + <param name="colorize-console" value="false"/> + <param name="dialplan-timestamps" value="false"/> + <param name="loglevel" value="debug"/> + <param name="rtp-start-port" value="1234"/> + <param name="rtp-end-port" value="1234"/> + <param name="rtp-enable-zrtp" value="false"/> + + </settings> + + </configuration> <configuration name="console.conf" description="Console Logger"> <mappings> <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/> diff --git a/tests/unit/switch_rtp.c b/tests/unit/switch_rtp.c index d411fe20fc..35de9d8630 100644 --- a/tests/unit/switch_rtp.c +++ b/tests/unit/switch_rtp.c @@ -3,7 +3,7 @@ #include <test/switch_test.h> static const char *rx_host = "127.0.0.1"; -static switch_port_t rx_port = 12346; +static switch_port_t rx_port = 1234; static const char *tx_host = "127.0.0.1"; static switch_port_t tx_port = 54320; static switch_memory_pool_t *pool = NULL; @@ -15,6 +15,28 @@ switch_rtp_packet_t rtp_packet; switch_frame_flag_t *frame_flags; switch_io_flag_t io_flags; switch_payload_t read_pt; +int send_rtcp_test_success = 0; + +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 send_rtcp_event_handler(switch_event_t *event) +{ + const char *new_ev = switch_event_get_header(event, "Event-Name"); + + if (new_ev && !strcmp(new_ev, "SEND_RTCP_MESSAGE")) { + send_rtcp_test_success = 1; + } + + show_event(event); +} FST_CORE_BEGIN("./conf") { @@ -97,6 +119,160 @@ FST_TEARDOWN_END() switch_core_destroy_memory_pool(&pool); } FST_TEST_END() + FST_TEST_BEGIN(test_send_rtcp_event_audio) + { + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + switch_stream_handle_t stream = { 0 }; + const unsigned char packet[]="\x80\x00\xcd\x15\xfd\x86\x00\x00\x61\x5a\xe1\x37"; + uint32_t plen = 12; + char rpacket[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_payload_t pt = { 0 }; + switch_frame_flag_t frameflags = { 0 }; + static switch_port_t audio_rx_port = 1234; + switch_media_handle_t *media_handle; + switch_core_media_params_t *mparams; + char *r_sdp; + uint8_t match = 0, p = 0; + struct sockaddr_in sin; + socklen_t len = sizeof(sin); + int x; + struct sockaddr_in servaddr_rtp; + int sockfd_rtp; + struct hostent *server; + int ret; + switch_frame_t *read_frame, *write_frame; + + switch_event_bind("", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, send_rtcp_event_handler, NULL); + + status = switch_ivr_originate(NULL, &session, &cause, "null/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session); + fst_check(status == SWITCH_STATUS_SUCCESS); + + channel = switch_core_session_get_channel(session); + fst_requires(channel); + mparams = switch_core_session_alloc(session, sizeof(switch_core_media_params_t)); + mparams->num_codecs = 1; + 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); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + switch_channel_set_variable(channel, "absolute_codec_string", "PCMU"); + switch_channel_set_variable(channel, "fire_rtcp_events", "true"); + switch_channel_set_variable(channel, "send_silence_when_idle", "-1"); + + 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:11115\n", + tx_host, tx_host); + + switch_core_media_prepare_codecs(session, SWITCH_FALSE); + + match = switch_core_media_negotiate_sdp(session, r_sdp, &p, SDP_TYPE_REQUEST); + fst_requires(match == 1); + + status = switch_core_media_choose_ports(session, SWITCH_TRUE, SWITCH_FALSE); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + status = switch_core_media_activate_rtp(session); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + 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_core_media_set_rtp_flag(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT); + switch_core_media_set_rtp_flag(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_RTP_FLAG_ENABLE_RTCP); + + + switch_frame_alloc(&write_frame, SWITCH_RECOMMENDED_BUFFER_SIZE); + write_frame->codec = switch_core_session_get_write_codec(session); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("fsctl", "debug_level 9", session, &stream); + switch_safe_free(stream.data); + + if ((sockfd_rtp = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("socket creation failed"); + fst_requires(0); /*exit*/ + } + + memset(&servaddr_rtp, 0, sizeof(servaddr_rtp)); + + servaddr_rtp.sin_family = AF_INET; + servaddr_rtp.sin_port = htons(audio_rx_port); + server = gethostbyname(rx_host); + bcopy((char *)server->h_addr, (char *)&servaddr_rtp.sin_addr.s_addr, server->h_length); + + /*get local UDP port (tx side) to trick FS into accepting our packets*/ + ret = sendto(sockfd_rtp, NULL, 0, MSG_CONFIRM, (const struct sockaddr *) &servaddr_rtp, sizeof(servaddr_rtp)); + if (ret < 0){ + perror("sendto"); + fst_requires(0); + } + + rtp_session = switch_core_media_get_rtp_session(session, SWITCH_MEDIA_TYPE_AUDIO); + len = sizeof(sin); + if (getsockname(sockfd_rtp, (struct sockaddr *)&sin, &len) == -1) { + perror("getsockname"); + fst_requires(0); + } else { + switch_rtp_set_remote_address(rtp_session, tx_host, ntohs(sin.sin_port), 0, SWITCH_FALSE, &err); + switch_rtp_reset(rtp_session); + } + + write_frame->datalen = plen; + memcpy(write_frame->data, &packet, plen); + + switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_PAUSE); + + for (x = 0; x < 3; x++) { + + switch_rtp_write_frame(rtp_session, write_frame); /* rtp_session->stats.rtcp.sent_pkt_count++; */ + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sent RTP. Packet size = [%u]\n", plen); + ret = sendto(sockfd_rtp, (const char *) &packet, plen, MSG_CONFIRM, (const struct sockaddr *) &servaddr_rtp, sizeof(servaddr_rtp)); + if (ret < 0){ + perror("sendto"); + fst_requires(0); + } + + status = switch_rtp_read(rtp_session, (void *)&rpacket, &plen, &pt, &frameflags, io_flags); + fst_requires(status == SWITCH_STATUS_SUCCESS); + plen = 12; + if (pt == SWITCH_RTP_CNG_PAYLOAD /*timeout*/) continue; + + status = switch_core_session_read_frame(session, &read_frame, frameflags, 0); + fst_requires(status == SWITCH_STATUS_SUCCESS); + } + switch_sleep(3000 * 1000); + + fst_requires(send_rtcp_test_success); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + + if (write_frame) switch_frame_free(&write_frame); + + switch_rtp_destroy(&rtp_session); + + switch_media_handle_destroy(session); + + switch_core_session_rwunlock(session); + } + FST_TEST_END() + } FST_SUITE_END() } From dae624441ba3c0c38401020db58aaa534b0e9fa0 Mon Sep 17 00:00:00 2001 From: Edson Lopes Filho <47820627+inoutglobal@users.noreply.github.com> Date: Wed, 13 Oct 2021 13:13:09 -0300 Subject: [PATCH 165/655] [daylight saving]- Fixs wrong daylight saving Fix wrong daylight saving on America/Sao_Paulo Timezone. There is no more Daylight Savings in Sao Paulo. --- conf/vanilla/autoload_configs/timezones.conf.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/vanilla/autoload_configs/timezones.conf.xml b/conf/vanilla/autoload_configs/timezones.conf.xml index 50bd7f3760..48206d1ce4 100644 --- a/conf/vanilla/autoload_configs/timezones.conf.xml +++ b/conf/vanilla/autoload_configs/timezones.conf.xml @@ -197,7 +197,7 @@ <zone name="America/Santarem" value="BRT3" /> <zone name="America/Santiago" value="CLT3" /> <zone name="America/Santo_Domingo" value="AST4" /> - <zone name="America/Sao_Paulo" value="BRT3BRST,M10.3.0/0,M2.3.0/0" /> + <zone name="America/Sao_Paulo" value="BRT3" /> <zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" /> <zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" /> <zone name="America/Sitka" value="AKST9AKDT,M3.2.0,M11.1.0" /> From e44fd2ea3849f4c215fbbdfc07c4b90e21c76969 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sun, 26 Sep 2021 13:23:46 +0300 Subject: [PATCH 166/655] [mod_python3, ESL py3mod] Add Python3 support. --- .gitignore | 1 + Makefile.am | 6 +- build/modules.conf.in | 1 + build/modules.conf.most | 2 +- build/swigall.sh | 5 + .../autoload_configs/modules.conf.xml | 1 + .../vanilla/autoload_configs/modules.conf.xml | 1 + configure.ac | 124 +- debian/bootstrap.sh | 6 +- debian/control-modules | 5 + debian/freeswitch-mod-python3.install.tmpl | 1 + debian/rules | 4 +- libs/esl/Makefile.am | 14 +- libs/esl/python/Makefile | 6 +- libs/esl/python3/ESL.py | 132 + libs/esl/python3/Makefile | 28 + libs/esl/python3/esl_wrap.cpp | 6128 ++++++++ libs/esl/python3/events.py | 20 + libs/esl/python3/python-config | 55 + libs/esl/python3/server.py | 29 + libs/esl/python3/single_command.py | 43 + src/mod/languages/mod_python/README.md | 6 + src/mod/languages/mod_python3/.gitattributes | 2 + src/mod/languages/mod_python3/Makefile.am | 30 + src/mod/languages/mod_python3/README.md | 6 + src/mod/languages/mod_python3/freeswitch.py | 702 + .../mod_python3/freeswitch_python.cpp | 342 + .../languages/mod_python3/freeswitch_python.h | 49 + src/mod/languages/mod_python3/hack.diff | 117 + src/mod/languages/mod_python3/mod_python.i | 36 + src/mod/languages/mod_python3/mod_python3.c | 674 + .../languages/mod_python3/mod_python_extra.c | 56 + .../languages/mod_python3/mod_python_extra.h | 9 + .../languages/mod_python3/mod_python_wrap.cpp | 11530 ++++++++++++++++ .../languages/mod_python3/python_example.py | 90 + 35 files changed, 20248 insertions(+), 13 deletions(-) create mode 100644 debian/freeswitch-mod-python3.install.tmpl create mode 100644 libs/esl/python3/ESL.py create mode 100644 libs/esl/python3/Makefile create mode 100644 libs/esl/python3/esl_wrap.cpp create mode 100644 libs/esl/python3/events.py create mode 100644 libs/esl/python3/python-config create mode 100644 libs/esl/python3/server.py create mode 100644 libs/esl/python3/single_command.py create mode 100644 src/mod/languages/mod_python/README.md create mode 100644 src/mod/languages/mod_python3/.gitattributes create mode 100644 src/mod/languages/mod_python3/Makefile.am create mode 100644 src/mod/languages/mod_python3/README.md create mode 100644 src/mod/languages/mod_python3/freeswitch.py create mode 100644 src/mod/languages/mod_python3/freeswitch_python.cpp create mode 100644 src/mod/languages/mod_python3/freeswitch_python.h create mode 100644 src/mod/languages/mod_python3/hack.diff create mode 100644 src/mod/languages/mod_python3/mod_python.i create mode 100644 src/mod/languages/mod_python3/mod_python3.c create mode 100644 src/mod/languages/mod_python3/mod_python_extra.c create mode 100644 src/mod/languages/mod_python3/mod_python_extra.h create mode 100644 src/mod/languages/mod_python3/mod_python_wrap.cpp create mode 100644 src/mod/languages/mod_python3/python_example.py diff --git a/.gitignore b/.gitignore index a6cbd8cb92..e8168cabef 100644 --- a/.gitignore +++ b/.gitignore @@ -156,6 +156,7 @@ Release/ /src/mod/languages/mod_lua/mod_lua_wrap.cpp.orig /src/mod/languages/mod_perl/mod_perl_wrap.cpp.orig /src/mod/languages/mod_python/mod_python_wrap.cpp.orig +/src/mod/languages/mod_python3/mod_python_wrap.cpp.orig /src/mod/say/mod_say_de/Makefile /src/mod/say/mod_say_es/Makefile /src/mod/say/mod_say_fr/Makefile diff --git a/Makefile.am b/Makefile.am index 8905f06729..ac15c3d7a3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -742,7 +742,7 @@ pristine: git clean -fdx git reset --hard -update-clean: clean python-reconf +update-clean: clean python-reconf python3-reconf cd libs/esl && $(MAKE) clean cd libs/srtp && $(MAKE) clean @@ -759,6 +759,10 @@ python-reconf: rm -f src/mod/languages/mod_python/Makefile ./config.status +python3-reconf: + rm -f src/mod/languages/mod_python3/Makefile + ./config.status + reconf: rm config.cache sh ./config.status --recheck diff --git a/build/modules.conf.in b/build/modules.conf.in index b38900047b..700e86b29e 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -134,6 +134,7 @@ languages/mod_lua #languages/mod_managed #languages/mod_perl #languages/mod_python +#languages/mod_python3 #languages/mod_v8 #languages/mod_yaml loggers/mod_console diff --git a/build/modules.conf.most b/build/modules.conf.most index 6f976dca38..f4188b7dc3 100644 --- a/build/modules.conf.most +++ b/build/modules.conf.most @@ -127,7 +127,7 @@ languages/mod_java languages/mod_lua languages/mod_managed languages/mod_perl -languages/mod_python +languages/mod_python3 #languages/mod_v8 languages/mod_yaml loggers/mod_console diff --git a/build/swigall.sh b/build/swigall.sh index ee7abf19cd..44b05b633b 100755 --- a/build/swigall.sh +++ b/build/swigall.sh @@ -13,6 +13,11 @@ make swigclean make mod_python_wrap.cpp cd ../../../.. +cd src/mod/languages/mod_python3 +make swigclean +make mod_python_wrap.cpp +cd ../../../.. + cd src/mod/languages/mod_java make reswig cd ../../../.. diff --git a/conf/insideout/autoload_configs/modules.conf.xml b/conf/insideout/autoload_configs/modules.conf.xml index 5078503489..9408bcd29f 100644 --- a/conf/insideout/autoload_configs/modules.conf.xml +++ b/conf/insideout/autoload_configs/modules.conf.xml @@ -81,6 +81,7 @@ <load module="mod_v8"/> <!-- <load module="mod_perl"/> --> <!-- <load module="mod_python"/> --> + <!-- <load module="mod_python3"/> --> <!-- <load module="mod_java"/> --> <load module="mod_lua"/> diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml index 8eff5fe263..b5a58d1580 100644 --- a/conf/vanilla/autoload_configs/modules.conf.xml +++ b/conf/vanilla/autoload_configs/modules.conf.xml @@ -122,6 +122,7 @@ <!-- <load module="mod_v8"/> --> <!-- <load module="mod_perl"/> --> <!-- <load module="mod_python"/> --> + <!-- <load module="mod_python3"/> --> <!-- <load module="mod_java"/> --> <load module="mod_lua"/> diff --git a/configure.ac b/configure.ac index 25f01e8f0b..ab3192e597 100644 --- a/configure.ac +++ b/configure.ac @@ -1702,7 +1702,7 @@ if test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"; then fi # -# Python checks for mod_python +# Python checks for mod_python (scroll down to see python3 checks for mod_python3) # AC_ARG_WITH( [python], @@ -1822,6 +1822,127 @@ else AC_MSG_WARN([python support disabled, building mod_python will fail!]) fi +# +# Python3 checks for mod_python3 +# +AC_ARG_WITH( + [python3], + [AS_HELP_STRING([--with-python3], [Use system provided version of python3 (default: try)])], + [with_python3="$withval"], + [with_python3="try"] +) + +if test "$with_python3" != "no" +then + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + + if test "$with_python3" != "yes" -a "$with_python3" != "try" ; then + AC_MSG_CHECKING([for python3]) + if test ! -x "$with_python3" ; then + AC_MSG_ERROR([Specified python3 does not exist or is not executable: $with_python3]) + fi + AC_MSG_RESULT([$with_python3]) + AC_SUBST([PYTHON3], ["$with_python3"]) + else + AC_PATH_PROG([PYTHON3], ["python3"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"]) + fi + + if test "$PYTHON3" != "no" ; then + AC_MSG_CHECKING([python3 version]) + PYTHON3_VER="`$PYTHON3 -V 2>&1 | cut -d' ' -f2`" + + if test -z "$PYTHON3_VER" ; then + AC_MSG_ERROR([Unable to detect python3 version]) + fi + AC_MSG_RESULT([$PYTHON3_VER]) + + AC_MSG_CHECKING([for python3 distutils]) + python3_result="`$PYTHON3 -c 'import distutils;' 2>&1`" + if test -z "$python3_result" ; then + python3_has_distutils="yes" + else + python3_has_distutils="no" + fi + AC_MSG_RESULT([$python3_has_distutils]) + + if test "$python3_has_distutils" != "no" ; then + AC_MSG_CHECKING([location of python3 site-packages]) + + PYTHON3_SITE_DIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`" + + if test -z "$PYTHON3_SITE_DIR" ; then + AC_MSG_ERROR([Unable to detect python3 site-packages path]) + elif test ! -d "$PYTHON3_SITE_DIR" ; then + AC_MSG_ERROR([Path $PYTHON3_SITE_DIR returned by python3 does not exist!]) + fi + AC_MSG_RESULT([$PYTHON3_SITE_DIR]) + AC_SUBST([PYTHON3_SITE_DIR], [$PYTHON3_SITE_DIR]) + + # + # python3 distutils found, get settings from python3 directly + # + PYTHON3_CFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's/-arch i386//g;s/-arch x86_64//g'`" + PYTHON3_LDFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]); print(\" \".join(libs));'`" + PYTHON3_LIB="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); print(\"python\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]);'`" + PYTHON3_LIBDIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`" + + # handle python3 being installed into /usr/local + AC_MSG_CHECKING([python3 libdir]) + if test -z "`echo $PYTHON3_LIBDIR | grep "/usr/lib"`" ; then + PYTHON3_LDFLAGS="-L$PYTHON3_LIBDIR $PYTHON3_LDFLAGS" + LIBS="-L$PYTHON3_LIBDIR $LIBS" + fi + AC_MSG_RESULT([$PYTHON3_LIBDIR]) + + # check libpython3 + AC_CHECK_LIB([$PYTHON3_LIB], [main], [has_libpython3="yes"], [has_libpython3="no"]) + + if test "$has_libpython3" = "no" ; then + AS_IF([test "$with_python3" = "try"], + [AC_MSG_WARN([$PYTHON3_LIB is unusable])], + [AC_MSG_ERROR([$PYTHON3_LIB is unusable])] + ) + fi + + # check whether system libpython3 is usable and has threads support + CFLAGS="$PYTHON3_CFLAGS" + LIBS="$PYTHON3_LDFLAGS" + AC_CHECK_FUNC([PyThread_init_thread], [python3_has_threads="yes"], [python3_has_threads="no"]) + + if test "$python3_has_threads" = "no"; then + AS_IF([test "$with_python3" = "try"], + [AC_MSG_WARN([Your python3 lacks threads support, can not build mod_python3])], + [AC_MSG_ERROR([Your python3 lacks threads support, can not build mod_python3])] + ) + else + AC_MSG_NOTICE([Your python3 seems OK, do not forget to enable mod_python3 in modules.conf]) + AC_SUBST([PYTHON3_CFLAGS], [$PYTHON3_CFLAGS]) + AC_SUBST([PYTHON3_LDFLAGS], [$PYTHON3_LDFLAGS]) + fi + else + AS_IF([test "$with_python3" = "try"], + [AC_MSG_WARN([Could not find or use python3 distutils module: $python3_result])], + [AC_MSG_ERROR([Could not find or use python3 distutils module: $python3_result])] + ) + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + unset python3_has_threads + unset python3_has_distutils + unset python3_result + else + AS_IF([test "$with_python3" = "try"], + [AC_MSG_WARN([Could not find python3, mod_python3 will not build, use --with-python3 to specify the location])], + [AC_MSG_ERROR([Could not find python3, use --with-python3 to specify the location])] + ) + fi +else + AC_MSG_WARN([python3 support disabled, building mod_python3 will fail!]) +fi + # # SNMP checks for mod_snmp # @@ -2012,6 +2133,7 @@ AC_CONFIG_FILES([Makefile src/mod/languages/mod_managed/Makefile src/mod/languages/mod_perl/Makefile src/mod/languages/mod_python/Makefile + src/mod/languages/mod_python3/Makefile src/mod/languages/mod_v8/Makefile src/mod/languages/mod_yaml/Makefile src/mod/languages/mod_basic/Makefile diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 981e2c42eb..b566bc26d9 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -325,7 +325,7 @@ Build-Depends: # configure options libssl1.0-dev | libssl-dev, unixodbc-dev, libpq-dev, libncurses5-dev, libjpeg62-turbo-dev | libjpeg-turbo8-dev | libjpeg62-dev | libjpeg8-dev, - python-dev, python-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5), + python-dev, python3-dev, python-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5), # documentation doxygen, # for APR (not essential for build) @@ -683,7 +683,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-java (= \${binary:Version}), freeswitch-mod-lua (= \${binary:Version}), freeswitch-mod-perl (= \${binary:Version}), - freeswitch-mod-python (= \${binary:Version}), + freeswitch-mod-python3 (= \${binary:Version}), freeswitch-mod-yaml (= \${binary:Version}), freeswitch-mod-console (= \${binary:Version}), freeswitch-mod-logfile (= \${binary:Version}), @@ -922,7 +922,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-java-dbg (= \${binary:Version}), freeswitch-mod-lua-dbg (= \${binary:Version}), freeswitch-mod-perl-dbg (= \${binary:Version}), - freeswitch-mod-python-dbg (= \${binary:Version}), + freeswitch-mod-python3-dbg (= \${binary:Version}), freeswitch-mod-yaml-dbg (= \${binary:Version}), freeswitch-mod-console-dbg (= \${binary:Version}), freeswitch-mod-logfile-dbg (= \${binary:Version}), diff --git a/debian/control-modules b/debian/control-modules index 56772fa780..24c89d3e39 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -671,6 +671,11 @@ Description: mod_python Adds mod_python. Build-Depends: python-dev +Module: languages/mod_python3 +Description: mod_python3 + Adds mod_python3. +Build-Depends: python3-dev + Module: languages/mod_v8 Description: mod_v8 Adds mod_v8. diff --git a/debian/freeswitch-mod-python3.install.tmpl b/debian/freeswitch-mod-python3.install.tmpl new file mode 100644 index 0000000000..7f855822a1 --- /dev/null +++ b/debian/freeswitch-mod-python3.install.tmpl @@ -0,0 +1 @@ +/usr/lib/python*/*-packages/freeswitch.py diff --git a/debian/rules b/debian/rules index 3cdf7b4ff3..c11f733e8c 100755 --- a/debian/rules +++ b/debian/rules @@ -73,7 +73,7 @@ override_dh_auto_clean: ./configure -C --enable-portable-binary --disable-dependency-tracking \ --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr --localstatedir=/var --sysconfdir=/etc \ - --with-gnu-ld --with-python --with-erlang --with-openssl \ + --with-gnu-ld --with-python --with-python3 --with-erlang --with-openssl \ --enable-core-odbc-support --enable-zrtp touch $@ @@ -85,6 +85,7 @@ override_dh_auto_configure: .stamp-configure make iksemel-dep make -j$(NJOBS) make -C libs/esl pymod + make -C libs/esl py3mod make -C libs/esl perlmod touch $@ @@ -99,6 +100,7 @@ override_dh_strip: override_dh_auto_install: dh_auto_install dh_auto_install -- -C libs/esl pymod-install + dh_auto_install -- -C libs/esl py3mod-install dh_auto_install -- -C libs/esl perlmod-install rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING diff --git a/libs/esl/Makefile.am b/libs/esl/Makefile.am index b946712311..695d9af841 100644 --- a/libs/esl/Makefile.am +++ b/libs/esl/Makefile.am @@ -54,6 +54,7 @@ reswig: swigclean $(MAKE) -C php reswig $(MAKE) -C lua reswig $(MAKE) -C python reswig + $(MAKE) -C python3 reswig $(MAKE) -C ruby reswig $(MAKE) -C java reswig $(MAKE) -C managed reswig @@ -63,6 +64,7 @@ swigclean: clean $(MAKE) -C php swigclean $(MAKE) -C lua swigclean $(MAKE) -C python swigclean + $(MAKE) -C python3 swigclean $(MAKE) -C ruby swigclean $(MAKE) -C java swigclean $(MAKE) -C managed swigclean @@ -77,7 +79,10 @@ luamod: $(MYLIB) $(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" LUA_CFLAGS="$(LUA_CFLAGS)" LUA_LIBS="$(LUA_LIBS)" -C lua pymod: $(MYLIB) - $(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python + $(MAKE) PYTHON=$(PYTHON) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python + +py3mod: $(MYLIB) + $(MAKE) PYTHON3=$(PYTHON3) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python3 tclmod: $(MYLIB) $(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C tcl @@ -98,9 +103,12 @@ phpmod-install: phpmod $(MAKE) -C php install pymod-install: pymod - $(MAKE) -C python install + $(MAKE) PYTHON=$(PYTHON) -C python install + +py3mod-install: py3mod + $(MAKE) PYTHON3=$(PYTHON3) -C python3 install rubymod-install: rubymod $(MAKE) -C ruby install -everymod: perlmod phpmod luamod pymod rubymod javamod managedmod +everymod: perlmod phpmod luamod pymod py3mod rubymod javamod managedmod diff --git a/libs/esl/python/Makefile b/libs/esl/python/Makefile index 71396dd4ba..824d3afe7f 100644 --- a/libs/esl/python/Makefile +++ b/libs/esl/python/Makefile @@ -1,6 +1,6 @@ -LOCAL_CFLAGS=`python ./python-config --includes` -LOCAL_LDFLAGS=`python ./python-config --ldflags` -SITE_DIR=$(DESTDIR)/`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)"` +LOCAL_CFLAGS=`$(PYTHON) ./python-config --includes` +LOCAL_LDFLAGS=`$(PYTHON) ./python-config --ldflags` +SITE_DIR=$(DESTDIR)/`$(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)"` all: _ESL.so diff --git a/libs/esl/python3/ESL.py b/libs/esl/python3/ESL.py new file mode 100644 index 0000000000..cd9b7c4f3f --- /dev/null +++ b/libs/esl/python3/ESL.py @@ -0,0 +1,132 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 3.0.2 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + + + + + +from sys import version_info +if version_info >= (2,6,0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_ESL', [dirname(__file__)]) + except ImportError: + import _ESL + return _ESL + if fp is not None: + try: + _mod = imp.load_module('_ESL', fp, pathname, description) + finally: + fp.close() + return _mod + _ESL = swig_import_helper() + del swig_import_helper +else: + import _ESL +del version_info +def _swig_setattr_nondynamic(self,class_type,name,value,static=1): + if (name == "thisown"): return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name,None) + if method: return method(self,value) + if (not static): + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + +def _swig_setattr(self,class_type,name,value): + return _swig_setattr_nondynamic(self,class_type,name,value,0) + +def _swig_getattr(self,class_type,name): + if (name == "thisown"): return self.this.own() + method = class_type.__swig_getmethods__.get(name,None) + if method: return method(self) + raise AttributeError(name) + +def _swig_repr(self): + try: strthis = "proxy of " + self.this.__repr__() + except: strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +class ESLevent: + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, ESLevent, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, ESLevent, name) + __repr__ = _swig_repr + __swig_setmethods__["event"] = _ESL.ESLevent_event_set + __swig_getmethods__["event"] = _ESL.ESLevent_event_get + __swig_setmethods__["serialized_string"] = _ESL.ESLevent_serialized_string_set + __swig_getmethods__["serialized_string"] = _ESL.ESLevent_serialized_string_get + __swig_setmethods__["mine"] = _ESL.ESLevent_mine_set + __swig_getmethods__["mine"] = _ESL.ESLevent_mine_get + def __init__(self, *args): + this = _ESL.new_ESLevent(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _ESL.delete_ESLevent + __del__ = lambda self : None; + def serialize(self, format=None): return _ESL.ESLevent_serialize(self, format) + def setPriority(self, *args): return _ESL.ESLevent_setPriority(self, *args) + def getHeader(self, *args): return _ESL.ESLevent_getHeader(self, *args) + def getBody(self): return _ESL.ESLevent_getBody(self) + def getType(self): return _ESL.ESLevent_getType(self) + def addBody(self, *args): return _ESL.ESLevent_addBody(self, *args) + def addHeader(self, *args): return _ESL.ESLevent_addHeader(self, *args) + def pushHeader(self, *args): return _ESL.ESLevent_pushHeader(self, *args) + def unshiftHeader(self, *args): return _ESL.ESLevent_unshiftHeader(self, *args) + def delHeader(self, *args): return _ESL.ESLevent_delHeader(self, *args) + def firstHeader(self): return _ESL.ESLevent_firstHeader(self) + def nextHeader(self): return _ESL.ESLevent_nextHeader(self) +ESLevent_swigregister = _ESL.ESLevent_swigregister +ESLevent_swigregister(ESLevent) + +class ESLconnection: + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, ESLconnection, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, ESLconnection, name) + __repr__ = _swig_repr + def __init__(self, *args): + this = _ESL.new_ESLconnection(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _ESL.delete_ESLconnection + __del__ = lambda self : None; + def socketDescriptor(self): return _ESL.ESLconnection_socketDescriptor(self) + def connected(self): return _ESL.ESLconnection_connected(self) + def getInfo(self): return _ESL.ESLconnection_getInfo(self) + def send(self, *args): return _ESL.ESLconnection_send(self, *args) + def sendRecv(self, *args): return _ESL.ESLconnection_sendRecv(self, *args) + def api(self, *args): return _ESL.ESLconnection_api(self, *args) + def bgapi(self, *args): return _ESL.ESLconnection_bgapi(self, *args) + def sendEvent(self, *args): return _ESL.ESLconnection_sendEvent(self, *args) + def sendMSG(self, *args): return _ESL.ESLconnection_sendMSG(self, *args) + def recvEvent(self): return _ESL.ESLconnection_recvEvent(self) + def recvEventTimed(self, *args): return _ESL.ESLconnection_recvEventTimed(self, *args) + def filter(self, *args): return _ESL.ESLconnection_filter(self, *args) + def events(self, *args): return _ESL.ESLconnection_events(self, *args) + def execute(self, *args): return _ESL.ESLconnection_execute(self, *args) + def executeAsync(self, *args): return _ESL.ESLconnection_executeAsync(self, *args) + def setAsyncExecute(self, *args): return _ESL.ESLconnection_setAsyncExecute(self, *args) + def setEventLock(self, *args): return _ESL.ESLconnection_setEventLock(self, *args) + def disconnect(self): return _ESL.ESLconnection_disconnect(self) +ESLconnection_swigregister = _ESL.ESLconnection_swigregister +ESLconnection_swigregister(ESLconnection) + + +def eslSetLogLevel(*args): + return _ESL.eslSetLogLevel(*args) +eslSetLogLevel = _ESL.eslSetLogLevel +# This file is compatible with both classic and new-style classes. + + diff --git a/libs/esl/python3/Makefile b/libs/esl/python3/Makefile new file mode 100644 index 0000000000..1c838534fd --- /dev/null +++ b/libs/esl/python3/Makefile @@ -0,0 +1,28 @@ +LOCAL_CFLAGS=`$(PYTHON3) ./python-config --includes` +LOCAL_LDFLAGS=`$(PYTHON3) ./python-config --ldflags` +SITE_DIR=$(DESTDIR)/`$(PYTHON3) -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))"` + +all: _ESL.so + +esl_wrap.cpp: + swig3.0 -module ESL -classic -python -c++ -DMULTIPLICITY -threads -I../src/include -o esl_wrap.cpp ../ESL.i + +esl_wrap.o: esl_wrap.cpp + $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) -c esl_wrap.cpp -o esl_wrap.o + +_ESL.so: esl_wrap.o + $(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o _ESL.so -L. $(LIBS) + +install: _ESL.so + mkdir -p $(SITE_DIR) + install -m 755 _ESL.so $(SITE_DIR) + install -m 755 ESL.py $(SITE_DIR) + +clean: + rm -f *.o *.so *~ + +swigclean: + rm -f esl_wrap.* ESL.so + +reswig: swigclean esl_wrap.cpp + diff --git a/libs/esl/python3/esl_wrap.cpp b/libs/esl/python3/esl_wrap.cpp new file mode 100644 index 0000000000..b67be5488a --- /dev/null +++ b/libs/esl/python3/esl_wrap.cpp @@ -0,0 +1,6128 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.2 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#define SWIGPYTHON +#define SWIG_PYTHON_THREADS +#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIG_PYTHON_CLASSIC + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template<typename T> class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); + SwigValueWrapper(const SwigValueWrapper<T>& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template <typename T> T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) +/* Use debug wrappers with the Python release dll */ +# undef _DEBUG +# include <Python.h> +# define _DEBUG +#else +# include <Python.h> +#endif + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic C API SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. + + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The SWIG conversion methods, as ConvertPtr, return an integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old versions of SWIG, code such as the following was usually written: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + which is the same really, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + also requires SWIG_ConvertPtr to return new result values, such as + + int SWIG_ConvertPtr(obj, ptr,...) { + if (<obj is ok>) { + if (<need new object>) { + *ptr = <ptr to new allocated object>; + return SWIG_NEWOBJ; + } else { + *ptr = <ptr to old object>; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + SWIG errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() +*/ + +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast(r) (r) +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class<int>" == "Class<int >", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (equiv != 0 && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = SWIG_TypeNameComp(nb, ne, tb, te); + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; +} + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + size_t l = 0; + size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + char d = *(c++); + unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = ((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = ((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +/* Compatibility macros for Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + +#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) +#define PyInt_Check(x) PyLong_Check(x) +#define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_FromLong(x) PyLong_FromLong(x) +#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) +#define PyString_Check(name) PyBytes_Check(name) +#define PyString_FromString(x) PyUnicode_FromString(x) +#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) +#define PyString_AsString(str) PyBytes_AsString(str) +#define PyString_Size(str) PyBytes_Size(str) +#define PyString_InternFromString(key) PyUnicode_InternFromString(key) +#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE +#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) +#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) + +#endif + +#ifndef Py_TYPE +# define Py_TYPE(op) ((op)->ob_type) +#endif + +/* SWIG APIs for compatibility of both Python 2 & 3 */ + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_FromFormat PyUnicode_FromFormat +#else +# define SWIG_Python_str_FromFormat PyString_FromFormat +#endif + + +/* Warning: This function will allocate a new string in Python 3, + * so please call SWIG_Python_str_DelForPy3(x) to free the space. + */ +SWIGINTERN char* +SWIG_Python_str_AsChar(PyObject *str) +{ +#if PY_VERSION_HEX >= 0x03000000 + char *cstr; + char *newstr; + Py_ssize_t len; + str = PyUnicode_AsUTF8String(str); + PyBytes_AsStringAndSize(str, &cstr, &len); + newstr = (char *) malloc(len+1); + memcpy(newstr, cstr, len+1); + Py_XDECREF(str); + return newstr; +#else + return PyString_AsString(str); +#endif +} + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) +#else +# define SWIG_Python_str_DelForPy3(x) +#endif + + +SWIGINTERN PyObject* +SWIG_Python_str_FromChar(const char *c) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromString(c); +#else + return PyString_FromString(c); +#endif +} + +/* Add PyOS_snprintf for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) +# define PyOS_snprintf _snprintf +# else +# define PyOS_snprintf snprintf +# endif +#endif + +/* A crude PyString_FromFormat implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 + +#ifndef SWIG_PYBUFFER_SIZE +# define SWIG_PYBUFFER_SIZE 1024 +#endif + +static PyObject * +PyString_FromFormat(const char *fmt, ...) { + va_list ap; + char buf[SWIG_PYBUFFER_SIZE * 2]; + int res; + va_start(ap, fmt); + res = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); +} +#endif + +/* Add PyObject_Del for old Pythons */ +#if PY_VERSION_HEX < 0x01060000 +# define PyObject_Del(op) PyMem_DEL((op)) +#endif +#ifndef PyObject_DEL +# define PyObject_DEL PyObject_Del +#endif + +/* A crude PyExc_StopIteration exception for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# ifndef PyExc_StopIteration +# define PyExc_StopIteration PyExc_RuntimeError +# endif +# ifndef PyObject_GenericGetAttr +# define PyObject_GenericGetAttr 0 +# endif +#endif + +/* Py_NotImplemented is defined in 2.1 and up. */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef Py_NotImplemented +# define Py_NotImplemented PyExc_RuntimeError +# endif +#endif + +/* A crude PyString_AsStringAndSize implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef PyString_AsStringAndSize +# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} +# endif +#endif + +/* PySequence_Size for old Pythons */ +#if PY_VERSION_HEX < 0x02000000 +# ifndef PySequence_Size +# define PySequence_Size PySequence_Length +# endif +#endif + +/* PyBool_FromLong for old Pythons */ +#if PY_VERSION_HEX < 0x02030000 +static +PyObject *PyBool_FromLong(long ok) +{ + PyObject *result = ok ? Py_True : Py_False; + Py_INCREF(result); + return result; +} +#endif + +/* Py_ssize_t for old Pythons */ +/* This code is as recommended by: */ +/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) +typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +typedef inquiry lenfunc; +typedef intargfunc ssizeargfunc; +typedef intintargfunc ssizessizeargfunc; +typedef intobjargproc ssizeobjargproc; +typedef intintobjargproc ssizessizeobjargproc; +typedef getreadbufferproc readbufferproc; +typedef getwritebufferproc writebufferproc; +typedef getsegcountproc segcountproc; +typedef getcharbufferproc charbufferproc; +static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) +{ + long result = 0; + PyObject *i = PyNumber_Int(x); + if (i) { + result = PyInt_AsLong(i); + Py_DECREF(i); + } + return result; +} +#endif + +#if PY_VERSION_HEX < 0x02050000 +#define PyInt_FromSize_t(x) PyInt_FromLong((long)x) +#endif + +#if PY_VERSION_HEX < 0x02040000 +#define Py_VISIT(op) \ + do { \ + if (op) { \ + int vret = visit((op), arg); \ + if (vret) \ + return vret; \ + } \ + } while (0) +#endif + +#if PY_VERSION_HEX < 0x02030000 +typedef struct { + PyTypeObject type; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; + PyBufferProcs as_buffer; + PyObject *name, *slots; +} PyHeapTypeObject; +#endif + +#if PY_VERSION_HEX < 0x02030000 +typedef destructor freefunc; +#endif + +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \ + (PY_MAJOR_VERSION > 3)) +# define SWIGPY_USE_CAPSULE +# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif + +#if PY_VERSION_HEX < 0x03020000 +#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) +#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIME PyObject* +SWIG_Python_ErrorType(int code) { + PyObject* type = 0; + switch(code) { + case SWIG_MemoryError: + type = PyExc_MemoryError; + break; + case SWIG_IOError: + type = PyExc_IOError; + break; + case SWIG_RuntimeError: + type = PyExc_RuntimeError; + break; + case SWIG_IndexError: + type = PyExc_IndexError; + break; + case SWIG_TypeError: + type = PyExc_TypeError; + break; + case SWIG_DivisionByZero: + type = PyExc_ZeroDivisionError; + break; + case SWIG_OverflowError: + type = PyExc_OverflowError; + break; + case SWIG_SyntaxError: + type = PyExc_SyntaxError; + break; + case SWIG_ValueError: + type = PyExc_ValueError; + break; + case SWIG_SystemError: + type = PyExc_SystemError; + break; + case SWIG_AttributeError: + type = PyExc_AttributeError; + break; + default: + type = PyExc_RuntimeError; + } + return type; +} + + +SWIGRUNTIME void +SWIG_Python_AddErrorMsg(const char* mesg) +{ + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + + if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + PyErr_Clear(); + Py_XINCREF(type); + + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + Py_DECREF(value); + } else { + PyErr_SetString(PyExc_RuntimeError, mesg); + } +} + +#if defined(SWIG_PYTHON_NO_THREADS) +# if defined(SWIG_PYTHON_THREADS) +# undef SWIG_PYTHON_THREADS +# endif +#endif +#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ +# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) +# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ +# define SWIG_PYTHON_USE_GIL +# endif +# endif +# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ +# ifndef SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# endif +# ifdef __cplusplus /* C++ code */ + class SWIG_Python_Thread_Block { + bool status; + PyGILState_STATE state; + public: + void end() { if (status) { PyGILState_Release(state); status = false;} } + SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} + ~SWIG_Python_Thread_Block() { end(); } + }; + class SWIG_Python_Thread_Allow { + bool status; + PyThreadState *save; + public: + void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} + ~SWIG_Python_Thread_Allow() { end(); } + }; +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block +# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow +# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() +# else /* C code */ +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() +# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() +# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) +# endif +# else /* Old thread way, not implemented, user must provide it */ +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) +# define SWIG_PYTHON_THREAD_END_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# endif +# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) +# define SWIG_PYTHON_THREAD_END_ALLOW +# endif +# endif +#else /* No thread support */ +# define SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# define SWIG_PYTHON_THREAD_END_BLOCK +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# define SWIG_PYTHON_THREAD_END_ALLOW +#endif + +/* ----------------------------------------------------------------------------- + * Python API portion that goes into the runtime + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ----------------------------------------------------------------------------- + * Constant declarations + * ----------------------------------------------------------------------------- */ + +/* Constant Types */ +#define SWIG_PY_POINTER 4 +#define SWIG_PY_BINARY 5 + +/* Constant information structure */ +typedef struct swig_const_info { + int type; + char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_const_info; + + +/* ----------------------------------------------------------------------------- + * Wrapper of PyInstanceMethod_New() used in Python 3 + * It is exported to the generated module, used for -fastproxy + * ----------------------------------------------------------------------------- */ +#if PY_VERSION_HEX >= 0x03000000 +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) +{ + return PyInstanceMethod_New(func); +} +#else +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func)) +{ + return NULL; +} +#endif + +#ifdef __cplusplus +} +#endif + + +/* ----------------------------------------------------------------------------- + * pyrun.swg + * + * This file contains the runtime support for Python modules + * and includes code for managing global variables and pointer + * type checking. + * + * ----------------------------------------------------------------------------- */ + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) + +#ifdef SWIGPYTHON_BUILTIN +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) +#else +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) +#endif + +#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) + +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) +#define swig_owntype int + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) +#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) + +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + + +/* Runtime API implementation */ + +/* Error manipulation */ + +SWIGINTERN void +SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetObject(errtype, obj); + Py_DECREF(obj); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +SWIGINTERN void +SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(errtype, msg); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) + +/* Set a constant value */ + +#if defined(SWIGPYTHON_BUILTIN) + +SWIGINTERN void +SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { + PyObject *s = PyString_InternFromString(key); + PyList_Append(seq, s); + Py_DECREF(s); +} + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { +#if PY_VERSION_HEX < 0x02030000 + PyDict_SetItemString(d, (char *)name, obj); +#else + PyDict_SetItemString(d, name, obj); +#endif + Py_DECREF(obj); + if (public_interface) + SwigPyBuiltin_AddPublicSymbol(public_interface, name); +} + +#else + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { +#if PY_VERSION_HEX < 0x02030000 + PyDict_SetItemString(d, (char *)name, obj); +#else + PyDict_SetItemString(d, name, obj); +#endif + Py_DECREF(obj); +} + +#endif + +/* Append a value to the result obj */ + +SWIGINTERN PyObject* +SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { +#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyList_Check(result)) { + PyObject *o2 = result; + result = PyList_New(1); + PyList_SetItem(result, 0, o2); + } + PyList_Append(result,obj); + Py_DECREF(obj); + } + return result; +#else + PyObject* o2; + PyObject* o3; + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyTuple_Check(result)) { + o2 = result; + result = PyTuple_New(1); + PyTuple_SET_ITEM(result, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SET_ITEM(o3, 0, obj); + o2 = result; + result = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return result; +#endif +} + +/* Unpack the argument tuple */ + +SWIGINTERN int +SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) +{ + if (!args) { + if (!min && !max) { + return 1; + } else { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + name, (min == max ? "" : "at least "), (int)min); + return 0; + } + } + if (!PyTuple_Check(args)) { + if (min <= 1 && max >= 1) { + int i; + objs[0] = args; + for (i = 1; i < max; ++i) { + objs[i] = 0; + } + return 2; + } + PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); + return 0; + } else { + Py_ssize_t l = PyTuple_GET_SIZE(args); + if (l < min) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at least "), (int)min, (int)l); + return 0; + } else if (l > max) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at most "), (int)max, (int)l); + return 0; + } else { + int i; + for (i = 0; i < l; ++i) { + objs[i] = PyTuple_GET_ITEM(args, i); + } + for (; l < max; ++l) { + objs[l] = 0; + } + return i + 1; + } + } +} + +/* A functor is a function object with one single object argument */ +#if PY_VERSION_HEX >= 0x02020000 +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); +#else +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); +#endif + +/* + Helper for static pointer initialization for both C and C++ code, for example + static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); +*/ +#ifdef __cplusplus +#define SWIG_STATIC_POINTER(var) var +#else +#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var +#endif + +/* ----------------------------------------------------------------------------- + * Pointer declarations + * ----------------------------------------------------------------------------- */ + +/* Flags for new pointer objects */ +#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) +#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) + +#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) + +#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) +#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) + +#ifdef __cplusplus +extern "C" { +#endif + +/* How to access Py_None */ +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# ifndef SWIG_PYTHON_NO_BUILD_NONE +# ifndef SWIG_PYTHON_BUILD_NONE +# define SWIG_PYTHON_BUILD_NONE +# endif +# endif +#endif + +#ifdef SWIG_PYTHON_BUILD_NONE +# ifdef Py_None +# undef Py_None +# define Py_None SWIG_Py_None() +# endif +SWIGRUNTIMEINLINE PyObject * +_SWIG_Py_None(void) +{ + PyObject *none = Py_BuildValue((char*)""); + Py_DECREF(none); + return none; +} +SWIGRUNTIME PyObject * +SWIG_Py_None(void) +{ + static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); + return none; +} +#endif + +/* The python void return value */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Py_Void(void) +{ + PyObject *none = Py_None; + Py_INCREF(none); + return none; +} + +/* SwigPyClientData */ + +typedef struct { + PyObject *klass; + PyObject *newraw; + PyObject *newargs; + PyObject *destroy; + int delargs; + int implicitconv; + PyTypeObject *pytype; +} SwigPyClientData; + +SWIGRUNTIMEINLINE int +SWIG_Python_CheckImplicit(swig_type_info *ty) +{ + SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; + return data ? data->implicitconv : 0; +} + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_ExceptionType(swig_type_info *desc) { + SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; + PyObject *klass = data ? data->klass : 0; + return (klass ? klass : PyExc_RuntimeError); +} + + +SWIGRUNTIME SwigPyClientData * +SwigPyClientData_New(PyObject* obj) +{ + if (!obj) { + return 0; + } else { + SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); + /* the klass element */ + data->klass = obj; + Py_INCREF(data->klass); + /* the newraw method and newargs arguments used to create a new raw instance */ + if (PyClass_Check(obj)) { + data->newraw = 0; + data->newargs = obj; + Py_INCREF(obj); + } else { +#if (PY_VERSION_HEX < 0x02020000) + data->newraw = 0; +#else + data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); +#endif + if (data->newraw) { + Py_INCREF(data->newraw); + data->newargs = PyTuple_New(1); + PyTuple_SetItem(data->newargs, 0, obj); + } else { + data->newargs = obj; + } + Py_INCREF(data->newargs); + } + /* the destroy method, aka as the C++ delete method */ + data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); + if (PyErr_Occurred()) { + PyErr_Clear(); + data->destroy = 0; + } + if (data->destroy) { + int flags; + Py_INCREF(data->destroy); + flags = PyCFunction_GET_FLAGS(data->destroy); +#ifdef METH_O + data->delargs = !(flags & (METH_O)); +#else + data->delargs = 0; +#endif + } else { + data->delargs = 0; + } + data->implicitconv = 0; + data->pytype = 0; + return data; + } +} + +SWIGRUNTIME void +SwigPyClientData_Del(SwigPyClientData *data) { + Py_XDECREF(data->newraw); + Py_XDECREF(data->newargs); + Py_XDECREF(data->destroy); +} + +/* =============== SwigPyObject =====================*/ + +typedef struct { + PyObject_HEAD + void *ptr; + swig_type_info *ty; + int own; + PyObject *next; +#ifdef SWIGPYTHON_BUILTIN + PyObject *dict; +#endif +} SwigPyObject; + +SWIGRUNTIME PyObject * +SwigPyObject_long(SwigPyObject *v) +{ + return PyLong_FromVoidPtr(v->ptr); +} + +SWIGRUNTIME PyObject * +SwigPyObject_format(const char* fmt, SwigPyObject *v) +{ + PyObject *res = NULL; + PyObject *args = PyTuple_New(1); + if (args) { + if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { + PyObject *ofmt = SWIG_Python_str_FromChar(fmt); + if (ofmt) { +#if PY_VERSION_HEX >= 0x03000000 + res = PyUnicode_Format(ofmt,args); +#else + res = PyString_Format(ofmt,args); +#endif + Py_DECREF(ofmt); + } + Py_DECREF(args); + } + } + return res; +} + +SWIGRUNTIME PyObject * +SwigPyObject_oct(SwigPyObject *v) +{ + return SwigPyObject_format("%o",v); +} + +SWIGRUNTIME PyObject * +SwigPyObject_hex(SwigPyObject *v) +{ + return SwigPyObject_format("%x",v); +} + +SWIGRUNTIME PyObject * +#ifdef METH_NOARGS +SwigPyObject_repr(SwigPyObject *v) +#else +SwigPyObject_repr(SwigPyObject *v, PyObject *args) +#endif +{ + const char *name = SWIG_TypePrettyName(v->ty); + PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v); + if (v->next) { +# ifdef METH_NOARGS + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); +# else + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); +# endif +# if PY_VERSION_HEX >= 0x03000000 + PyObject *joined = PyUnicode_Concat(repr, nrep); + Py_DecRef(repr); + Py_DecRef(nrep); + repr = joined; +# else + PyString_ConcatAndDel(&repr,nrep); +# endif + } + return repr; +} + +SWIGRUNTIME int +SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +{ + void *i = v->ptr; + void *j = w->ptr; + return (i < j) ? -1 : ((i > j) ? 1 : 0); +} + +/* Added for Python 3.x, would it also be useful for Python 2.x? */ +SWIGRUNTIME PyObject* +SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +{ + PyObject* res; + if( op != Py_EQ && op != Py_NE ) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); + return res; +} + + +SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); + +#ifdef SWIGPYTHON_BUILTIN +static swig_type_info *SwigPyObject_stype = 0; +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + SwigPyClientData *cd; + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + assert(cd); + assert(cd->pytype); + return cd->pytype; +} +#else +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); + return type; +} +#endif + +SWIGRUNTIMEINLINE int +SwigPyObject_Check(PyObject *op) { +#ifdef SWIGPYTHON_BUILTIN + PyTypeObject *target_tp = SwigPyObject_type(); + if (PyType_IsSubtype(op->ob_type, target_tp)) + return 1; + return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); +#else + return (Py_TYPE(op) == SwigPyObject_type()) + || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); +#endif +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own); + +SWIGRUNTIME void +SwigPyObject_dealloc(PyObject *v) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + PyObject *next = sobj->next; + if (sobj->own == SWIG_POINTER_OWN) { + swig_type_info *ty = sobj->ty; + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + PyObject *destroy = data ? data->destroy : 0; + if (destroy) { + /* destroy is always a VARARGS method */ + PyObject *res; + if (data->delargs) { + /* we need to create a temporary object to carry the destroy operation */ + PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); + } else { + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); + } + Py_XDECREF(res); + } +#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); + } +#endif + } + Py_XDECREF(next); + PyObject_DEL(v); +} + +SWIGRUNTIME PyObject* +SwigPyObject_append(PyObject* v, PyObject* next) +{ + SwigPyObject *sobj = (SwigPyObject *) v; +#ifndef METH_O + PyObject *tmp = 0; + if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; + next = tmp; +#endif + if (!SwigPyObject_Check(next)) { + return NULL; + } + sobj->next = next; + Py_INCREF(next); + return SWIG_Py_Void(); +} + +SWIGRUNTIME PyObject* +#ifdef METH_NOARGS +SwigPyObject_next(PyObject* v) +#else +SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *) v; + if (sobj->next) { + Py_INCREF(sobj->next); + return sobj->next; + } else { + return SWIG_Py_Void(); + } +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_disown(PyObject *v) +#else +SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = 0; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_acquire(PyObject *v) +#else +SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = SWIG_POINTER_OWN; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +SwigPyObject_own(PyObject *v, PyObject *args) +{ + PyObject *val = 0; +#if (PY_VERSION_HEX < 0x02020000) + if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) +#elif (PY_VERSION_HEX < 0x02050000) + if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) +#else + if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) +#endif + { + return NULL; + } + else + { + SwigPyObject *sobj = (SwigPyObject *)v; + PyObject *obj = PyBool_FromLong(sobj->own); + if (val) { +#ifdef METH_NOARGS + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v); + } else { + SwigPyObject_disown(v); + } +#else + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v,args); + } else { + SwigPyObject_disown(v,args); + } +#endif + } + return obj; + } +} + +#ifdef METH_O +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#else +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#endif + +#if PY_VERSION_HEX < 0x02020000 +SWIGINTERN PyObject * +SwigPyObject_getattr(SwigPyObject *sobj,char *name) +{ + return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); +} +#endif + +SWIGRUNTIME PyTypeObject* +SwigPyObject_TypeOnce(void) { + static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + + static PyNumberMethods SwigPyObject_as_number = { + (binaryfunc)0, /*nb_add*/ + (binaryfunc)0, /*nb_subtract*/ + (binaryfunc)0, /*nb_multiply*/ + /* nb_divide removed in Python 3 */ +#if PY_VERSION_HEX < 0x03000000 + (binaryfunc)0, /*nb_divide*/ +#endif + (binaryfunc)0, /*nb_remainder*/ + (binaryfunc)0, /*nb_divmod*/ + (ternaryfunc)0,/*nb_power*/ + (unaryfunc)0, /*nb_negative*/ + (unaryfunc)0, /*nb_positive*/ + (unaryfunc)0, /*nb_absolute*/ + (inquiry)0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ +#if PY_VERSION_HEX < 0x03000000 + 0, /*nb_coerce*/ +#endif + (unaryfunc)SwigPyObject_long, /*nb_int*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_long, /*nb_long*/ +#else + 0, /*nb_reserved*/ +#endif + (unaryfunc)0, /*nb_float*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_oct, /*nb_oct*/ + (unaryfunc)SwigPyObject_hex, /*nb_hex*/ +#endif +#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ +#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ +#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ +#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ + 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ +#endif + }; + + static PyTypeObject swigpyobject_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { + /* PyObject header changed in Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyObject", /* tp_name */ + sizeof(SwigPyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyObject_dealloc, /* tp_dealloc */ + 0, /* tp_print */ +#if PY_VERSION_HEX < 0x02020000 + (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ +#else + (getattrfunc)0, /* tp_getattr */ +#endif + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX >= 0x03000000 + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ +#else + (cmpfunc)SwigPyObject_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyObject_repr, /* tp_repr */ + &SwigPyObject_as_number, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigobject_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + swigobject_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + swigpyobject_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpyobject_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpyobject_type) < 0) + return NULL; +#endif + } + return &swigpyobject_type; +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own) +{ + SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); + if (sobj) { + sobj->ptr = ptr; + sobj->ty = ty; + sobj->own = own; + sobj->next = 0; + } + return (PyObject *)sobj; +} + +/* ----------------------------------------------------------------------------- + * Implements a simple Swig Packed type, and use it instead of string + * ----------------------------------------------------------------------------- */ + +typedef struct { + PyObject_HEAD + void *pack; + swig_type_info *ty; + size_t size; +} SwigPyPacked; + +SWIGRUNTIME int +SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +{ + char result[SWIG_BUFFER_SIZE]; + fputs("<Swig Packed ", fp); + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + fputs("at ", fp); + fputs(result, fp); + } + fputs(v->ty->name,fp); + fputs(">", fp); + return 0; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_repr(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); + } else { + return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); + } +} + +SWIGRUNTIME PyObject * +SwigPyPacked_str(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ + return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); + } else { + return SWIG_Python_str_FromChar(v->ty->name); + } +} + +SWIGRUNTIME int +SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) +{ + size_t i = v->size; + size_t j = w->size; + int s = (i < j) ? -1 : ((i > j) ? 1 : 0); + return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); +} + +SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); + return type; +} + +SWIGRUNTIMEINLINE int +SwigPyPacked_Check(PyObject *op) { + return ((op)->ob_type == SwigPyPacked_TypeOnce()) + || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); +} + +SWIGRUNTIME void +SwigPyPacked_dealloc(PyObject *v) +{ + if (SwigPyPacked_Check(v)) { + SwigPyPacked *sobj = (SwigPyPacked *) v; + free(sobj->pack); + } + PyObject_DEL(v); +} + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_TypeOnce(void) { + static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static PyTypeObject swigpypacked_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { + /* PyObject header changed in Python 3 */ +#if PY_VERSION_HEX>=0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyPacked", /* tp_name */ + sizeof(SwigPyPacked), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ + (printfunc)SwigPyPacked_print, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX>=0x03000000 + 0, /* tp_reserved in 3.0.1 */ +#else + (cmpfunc)SwigPyPacked_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyPacked_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)SwigPyPacked_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigpacked_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + swigpypacked_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpypacked_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpypacked_type) < 0) + return NULL; +#endif + } + return &swigpypacked_type; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) +{ + SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); + if (sobj) { + void *pack = malloc(size); + if (pack) { + memcpy(pack, ptr, size); + sobj->pack = pack; + sobj->ty = ty; + sobj->size = size; + } else { + PyObject_DEL((PyObject *) sobj); + sobj = 0; + } + } + return (PyObject *) sobj; +} + +SWIGRUNTIME swig_type_info * +SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) +{ + if (SwigPyPacked_Check(obj)) { + SwigPyPacked *sobj = (SwigPyPacked *)obj; + if (sobj->size != size) return 0; + memcpy(ptr, sobj->pack, size); + return sobj->ty; + } else { + return 0; + } +} + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIMEINLINE PyObject * +_SWIG_This(void) +{ + return SWIG_Python_str_FromChar("this"); +} + +static PyObject *swig_this = NULL; + +SWIGRUNTIME PyObject * +SWIG_This(void) +{ + if (swig_this == NULL) + swig_this = _SWIG_This(); + return swig_this; +} + +/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ + +/* TODO: I don't know how to implement the fast getset in Python 3 right now */ +#if PY_VERSION_HEX>=0x03000000 +#define SWIG_PYTHON_SLOW_GETSET_THIS +#endif + +SWIGRUNTIME SwigPyObject * +SWIG_Python_GetSwigThis(PyObject *pyobj) +{ + PyObject *obj; + + if (SwigPyObject_Check(pyobj)) + return (SwigPyObject *) pyobj; + +#ifdef SWIGPYTHON_BUILTIN + (void)obj; +# ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + pyobj = PyWeakref_GET_OBJECT(pyobj); + if (pyobj && SwigPyObject_Check(pyobj)) + return (SwigPyObject*) pyobj; + } +# endif + return NULL; +#else + + obj = 0; + +#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) + if (PyInstance_Check(pyobj)) { + obj = _PyInstance_Lookup(pyobj, SWIG_This()); + } else { + PyObject **dictptr = _PyObject_GetDictPtr(pyobj); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; + } else { +#ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; + } +#endif + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } + } + } +#else + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } +#endif + if (obj && !SwigPyObject_Check(obj)) { + /* a PyObject is called 'this', try to get the 'real this' + SwigPyObject from it */ + return SWIG_Python_GetSwigThis(obj); + } + return (SwigPyObject *)obj; +#endif +} + +/* Acquire a pointer value */ + +SWIGRUNTIME int +SWIG_Python_AcquirePtr(PyObject *obj, int own) { + if (own == SWIG_POINTER_OWN) { + SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); + if (sobj) { + int oldown = sobj->own; + sobj->own = own; + return oldown; + } + } + return 0; +} + +/* Convert a pointer value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { + int res; + SwigPyObject *sobj; + int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; + + if (!obj) + return SWIG_ERROR; + if (obj == Py_None && !implicit_conv) { + if (ptr) + *ptr = 0; + return SWIG_OK; + } + + res = SWIG_ERROR; + + sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; + while (sobj) { + void *vptr = sobj->ptr; + if (ty) { + swig_type_info *to = sobj->ty; + if (to == ty) { + /* no type cast needed */ + if (ptr) *ptr = vptr; + break; + } else { + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) { + sobj = (SwigPyObject *)sobj->next; + } else { + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } + break; + } + } + } else { + if (ptr) *ptr = vptr; + break; + } + } + if (sobj) { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + res = SWIG_OK; + } else { + if (implicit_conv) { + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + if (data && !data->implicitconv) { + PyObject *klass = data->klass; + if (klass) { + PyObject *impconv; + data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ + impconv = SWIG_Python_CallFunctor(klass, obj); + data->implicitconv = 0; + if (PyErr_Occurred()) { + PyErr_Clear(); + impconv = 0; + } + if (impconv) { + SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { + void *vptr; + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); + if (SWIG_IsOK(res)) { + if (ptr) { + *ptr = vptr; + /* transfer the ownership to 'ptr' */ + iobj->own = 0; + res = SWIG_AddCast(res); + res = SWIG_AddNewMask(res); + } else { + res = SWIG_AddCast(res); + } + } + } + Py_DECREF(impconv); + } + } + } + } + if (!SWIG_IsOK(res) && obj == Py_None) { + if (ptr) + *ptr = 0; + if (PyErr_Occurred()) + PyErr_Clear(); + res = SWIG_OK; + } + } + return res; +} + +/* Convert a function ptr value */ + +SWIGRUNTIME int +SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { + if (!PyCFunction_Check(obj)) { + return SWIG_ConvertPtr(obj, ptr, ty, 0); + } else { + void *vptr = 0; + + /* here we get the method pointer for callbacks */ + const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); + const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; + if (desc) + desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; + if (!desc) + return SWIG_ERROR; + if (ty) { + swig_cast_info *tc = SWIG_TypeCheck(desc,ty); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } + } else { + *ptr = vptr; + } + return SWIG_OK; + } +} + +/* Convert a packed value value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +/* ----------------------------------------------------------------------------- + * Create a new pointer object + * ----------------------------------------------------------------------------- */ + +/* + Create a new instance object, without calling __init__, and set the + 'this' attribute. +*/ + +SWIGRUNTIME PyObject* +SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) +{ +#if (PY_VERSION_HEX >= 0x02020000) + PyObject *inst = 0; + PyObject *newraw = data->newraw; + if (newraw) { + inst = PyObject_Call(newraw, data->newargs, NULL); + if (inst) { +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + PyDict_SetItem(dict, SWIG_This(), swig_this); + } + } +#else + PyObject *key = SWIG_This(); + PyObject_SetAttr(inst, key, swig_this); +#endif + } + } else { +#if PY_VERSION_HEX >= 0x03000000 + inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); + if (inst) { + PyObject_SetAttr(inst, SWIG_This(), swig_this); + Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + } +#else + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } +#endif + } + return inst; +#else +#if (PY_VERSION_HEX >= 0x02010000) + PyObject *inst = 0; + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } + return (PyObject *) inst; +#else + PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); + if (inst == NULL) { + return NULL; + } + inst->in_class = (PyClassObject *)data->newargs; + Py_INCREF(inst->in_class); + inst->in_dict = PyDict_New(); + if (inst->in_dict == NULL) { + Py_DECREF(inst); + return NULL; + } +#ifdef Py_TPFLAGS_HAVE_WEAKREFS + inst->in_weakreflist = NULL; +#endif +#ifdef Py_TPFLAGS_GC + PyObject_GC_Init(inst); +#endif + PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); + return (PyObject *) inst; +#endif +#endif +} + +SWIGRUNTIME void +SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) +{ + PyObject *dict; +#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + PyDict_SetItem(dict, SWIG_This(), swig_this); + return; + } +#endif + dict = PyObject_GetAttrString(inst, (char*)"__dict__"); + PyDict_SetItem(dict, SWIG_This(), swig_this); + Py_DECREF(dict); +} + + +SWIGINTERN PyObject * +SWIG_Python_InitShadowInstance(PyObject *args) { + PyObject *obj[2]; + if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { + return NULL; + } else { + SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); + if (sthis) { + SwigPyObject_append((PyObject*) sthis, obj[1]); + } else { + SWIG_Python_SetSwigThis(obj[0], obj[1]); + } + return SWIG_Py_Void(); + } +} + +/* Create a new pointer object */ + +SWIGRUNTIME PyObject * +SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { + SwigPyClientData *clientdata; + PyObject * robj; + int own; + + if (!ptr) + return SWIG_Py_Void(); + + clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; + own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (clientdata && clientdata->pytype) { + SwigPyObject *newobj; + if (flags & SWIG_BUILTIN_TP_INIT) { + newobj = (SwigPyObject*) self; + if (newobj->ptr) { + PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); + while (newobj->next) + newobj = (SwigPyObject *) newobj->next; + newobj->next = next_self; + newobj = (SwigPyObject *)next_self; + } + } else { + newobj = PyObject_New(SwigPyObject, clientdata->pytype); + } + if (newobj) { + newobj->ptr = ptr; + newobj->ty = type; + newobj->own = own; + newobj->next = 0; +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif + return (PyObject*) newobj; + } + return SWIG_Py_Void(); + } + + assert(!(flags & SWIG_BUILTIN_TP_INIT)); + + robj = SwigPyObject_New(ptr, type, own); + if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { + PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); + Py_DECREF(robj); + robj = inst; + } + return robj; +} + +/* Create a new packed object */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { + return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); +} + +/* -----------------------------------------------------------------------------* + * Get type list + * -----------------------------------------------------------------------------*/ + +#ifdef SWIG_LINK_RUNTIME +void *SWIG_ReturnGlobalTypeList(void *); +#endif + +SWIGRUNTIME swig_module_info * +SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { + static void *type_pointer = (void *)0; + /* first check if module already created */ + if (!type_pointer) { +#ifdef SWIG_LINK_RUNTIME + type_pointer = SWIG_ReturnGlobalTypeList((void *)0); +#else +# ifdef SWIGPY_USE_CAPSULE + type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); +# else + type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, + (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +# endif + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif + } + return (swig_module_info *) type_pointer; +} + +#if PY_MAJOR_VERSION < 2 +/* PyModule_AddObject function was introduced in Python 2.0. The following function + is copied out of Python/modsupport.c in python version 2.3.4 */ +SWIGINTERN int +PyModule_AddObject(PyObject *m, char *name, PyObject *o) +{ + PyObject *dict; + if (!PyModule_Check(m)) { + PyErr_SetString(PyExc_TypeError, + "PyModule_AddObject() needs module as first arg"); + return SWIG_ERROR; + } + if (!o) { + PyErr_SetString(PyExc_TypeError, + "PyModule_AddObject() needs non-NULL value"); + return SWIG_ERROR; + } + + dict = PyModule_GetDict(m); + if (dict == NULL) { + /* Internal error -- modules must have a dict! */ + PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", + PyModule_GetName(m)); + return SWIG_ERROR; + } + if (PyDict_SetItemString(dict, name, o)) + return SWIG_ERROR; + Py_DECREF(o); + return SWIG_OK; +} +#endif + +SWIGRUNTIME void +#ifdef SWIGPY_USE_CAPSULE +SWIG_Python_DestroyModule(PyObject *obj) +#else +SWIG_Python_DestroyModule(void *vptr) +#endif +{ +#ifdef SWIGPY_USE_CAPSULE + swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); +#else + swig_module_info *swig_module = (swig_module_info *) vptr; +#endif + swig_type_info **types = swig_module->types; + size_t i; + for (i =0; i < swig_module->size; ++i) { + swig_type_info *ty = types[i]; + if (ty->owndata) { + SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; + if (data) SwigPyClientData_Del(data); + } + } + Py_DECREF(SWIG_This()); + swig_this = NULL; +} + +SWIGRUNTIME void +SWIG_Python_SetModule(swig_module_info *swig_module) { +#if PY_VERSION_HEX >= 0x03000000 + /* Add a dummy module object into sys.modules */ + PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); +#endif +#ifdef SWIGPY_USE_CAPSULE + PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +#else + PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +#endif +} + +/* The python cached type query */ +SWIGRUNTIME PyObject * +SWIG_Python_TypeCache(void) { + static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); + return cache; +} + +SWIGRUNTIME swig_type_info * +SWIG_Python_TypeQuery(const char *type) +{ + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *obj = PyDict_GetItem(cache, key); + swig_type_info *descriptor; + if (obj) { +#ifdef SWIGPY_USE_CAPSULE + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); +#else + descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif + } else { + swig_module_info *swig_module = SWIG_GetModule(0); + descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); + if (descriptor) { +#ifdef SWIGPY_USE_CAPSULE + obj = PyCapsule_New((void*) descriptor, NULL, NULL); +#else + obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif + PyDict_SetItem(cache, key, obj); + Py_DECREF(obj); + } + } + Py_DECREF(key); + return descriptor; +} + +/* + For backward compatibility only +*/ +#define SWIG_POINTER_EXCEPTION 0 +#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) +#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) + +SWIGRUNTIME int +SWIG_Python_AddErrMesg(const char* mesg, int infront) +{ + if (PyErr_Occurred()) { + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + Py_XINCREF(type); + PyErr_Clear(); + if (infront) { + PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); + } else { + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + } + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + } + return 1; + } else { + return 0; + } +} + +SWIGRUNTIME int +SWIG_Python_ArgFail(int argnum) +{ + if (PyErr_Occurred()) { + /* add information about failing argument */ + char mesg[256]; + PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); + return SWIG_Python_AddErrMesg(mesg, 1); + } else { + return 0; + } +} + +SWIGRUNTIMEINLINE const char * +SwigPyObject_GetDesc(PyObject *self) +{ + SwigPyObject *v = (SwigPyObject *)self; + swig_type_info *ty = v ? v->ty : 0; + return ty ? ty->str : ""; +} + +SWIGRUNTIME void +SWIG_Python_TypeError(const char *type, PyObject *obj) +{ + if (type) { +#if defined(SWIG_COBJECT_TYPES) + if (obj && SwigPyObject_Check(obj)) { + const char *otype = (const char *) SwigPyObject_GetDesc(obj); + if (otype) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", + type, otype); + return; + } + } else +#endif + { + const char *otype = (obj ? obj->ob_type->tp_name : 0); + if (otype) { + PyObject *str = PyObject_Str(obj); + const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; + if (cstr) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", + type, otype, cstr); + SWIG_Python_str_DelForPy3(cstr); + } else { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", + type, otype); + } + Py_XDECREF(str); + return; + } + } + PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); + } else { + PyErr_Format(PyExc_TypeError, "unexpected type is received"); + } +} + + +/* Convert a pointer value, signal an exception on a type mismatch */ +SWIGRUNTIME void * +SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { + void *result; + if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { + PyErr_Clear(); +#if SWIG_POINTER_EXCEPTION + if (flags) { + SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + SWIG_Python_ArgFail(argnum); + } +#endif + } + return result; +} + +#ifdef SWIGPYTHON_BUILTIN +SWIGRUNTIME int +SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { + PyTypeObject *tp = obj->ob_type; + PyObject *descr; + PyObject *encoded_name; + descrsetfunc f; + int res = -1; + +# ifdef Py_USING_UNICODE + if (PyString_Check(name)) { + name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); + if (!name) + return -1; + } else if (!PyUnicode_Check(name)) +# else + if (!PyString_Check(name)) +# endif + { + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); + return -1; + } else { + Py_INCREF(name); + } + + if (!tp->tp_dict) { + if (PyType_Ready(tp) < 0) + goto done; + } + + descr = _PyType_Lookup(tp, name); + f = NULL; + if (descr != NULL) + f = descr->ob_type->tp_descr_set; + if (!f) { + if (PyString_Check(name)) { + encoded_name = name; + Py_INCREF(name); + } else { + encoded_name = PyUnicode_AsUTF8String(name); + } + PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); + Py_DECREF(encoded_name); + } else { + res = f(descr, obj, value); + } + + done: + Py_DECREF(name); + return res; +} +#endif + + +#ifdef __cplusplus +} +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_ESLconnection swig_types[0] +#define SWIGTYPE_p_ESLevent swig_types[1] +#define SWIGTYPE_p_char swig_types[2] +#define SWIGTYPE_p_esl_event_t swig_types[3] +#define SWIGTYPE_p_esl_priority_t swig_types[4] +static swig_type_info *swig_types[6]; +static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#if (PY_VERSION_HEX <= 0x02000000) +# if !defined(SWIG_PYTHON_CLASSIC) +# error "This python version requires swig to be run with the '-classic' option" +# endif +#endif + +/*----------------------------------------------- + @(target):= _ESL.so + ------------------------------------------------*/ +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_init PyInit__ESL + +#else +# define SWIG_init init_ESL + +#endif +#define SWIG_name "_ESL" + +#define SWIGVERSION 0x030002 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include <stdexcept> + + +namespace swig { + class SwigPtr_PyObject { + protected: + PyObject *_obj; + + public: + SwigPtr_PyObject() :_obj(0) + { + } + + SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) + { + Py_XINCREF(_obj); + } + + SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) + { + if (initial_ref) { + Py_XINCREF(_obj); + } + } + + SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) + { + Py_XINCREF(item._obj); + Py_XDECREF(_obj); + _obj = item._obj; + return *this; + } + + ~SwigPtr_PyObject() + { + Py_XDECREF(_obj); + } + + operator PyObject *() const + { + return _obj; + } + + PyObject *operator->() const + { + return _obj; + } + }; +} + + +namespace swig { + struct SwigVar_PyObject : SwigPtr_PyObject { + SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } + + SwigVar_PyObject & operator = (PyObject* obj) + { + Py_XDECREF(_obj); + _obj = obj; + return *this; + } + }; +} + + +#include "esl.h" +#include "esl_oop.h" + + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +{ +#if PY_VERSION_HEX>=0x03000000 + if (PyUnicode_Check(obj)) +#else + if (PyString_Check(obj)) +#endif + { + char *cstr; Py_ssize_t len; +#if PY_VERSION_HEX>=0x03000000 + if (!alloc && cptr) { + /* We can't allow converting without allocation, since the internal + representation of string in Python 3 is UCS-2/UCS-4 but we require + a UTF-8 representation. + TODO(bhy) More detailed explanation */ + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + PyBytes_AsStringAndSize(obj, &cstr, &len); + if(alloc) *alloc = SWIG_NEWOBJ; +#else + PyString_AsStringAndSize(obj, &cstr, &len); +#endif + if (cptr) { + if (alloc) { + /* + In python the user should not be able to modify the inner + string representation. To warranty that, if you define + SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string + buffer is always returned. + + The default behavior is just to return the pointer value, + so, be careful. + */ +#if defined(SWIG_PYTHON_SAFE_CSTRINGS) + if (*alloc != SWIG_OLDOBJ) +#else + if (*alloc == SWIG_NEWOBJ) +#endif + { + *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); + *alloc = SWIG_NEWOBJ; + } + else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } else { + #if PY_VERSION_HEX>=0x03000000 + assert(0); /* Should never reach here in Python 3 */ + #endif + *cptr = SWIG_Python_str_AsChar(obj); + } + } + if (psize) *psize = len + 1; +#if PY_VERSION_HEX>=0x03000000 + Py_XDECREF(obj); +#endif + return SWIG_OK; + } else { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + + + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + return pchar_descriptor ? + SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); + } else { +#if PY_VERSION_HEX >= 0x03000000 +#if PY_VERSION_HEX >= 0x03010000 + return PyUnicode_DecodeUTF8(carray, static_cast< int >(size), "surrogateescape"); +#else + return PyUnicode_FromStringAndSize(carray, static_cast< int >(size)); +#endif +#else + return PyString_FromStringAndSize(carray, static_cast< int >(size)); +#endif + } + } else { + return SWIG_Py_Void(); + } +} + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + + +#include <limits.h> +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +SWIGINTERN int +SWIG_AsVal_double (PyObject *obj, double *val) +{ + int res = SWIG_TypeError; + if (PyFloat_Check(obj)) { + if (val) *val = PyFloat_AsDouble(obj); + return SWIG_OK; + } else if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else if (PyLong_Check(obj)) { + double v = PyLong_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + double d = PyFloat_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = d; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); + } else { + PyErr_Clear(); + } + } + } +#endif + return res; +} + + +#include <float.h> + + +#include <math.h> + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_long (PyObject *obj, long* val) +{ + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_int (PyObject * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_int (int value) +{ + return PyInt_FromLong((long) value); +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_bool (bool value) +{ + return PyBool_FromLong(value ? 1 : 0); +} + +#ifdef __cplusplus +extern "C" { +#endif +SWIGINTERN PyObject *_wrap_ESLevent_event_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + esl_event_t *arg2 = (esl_event_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_event_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_set" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_esl_event_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_event_set" "', argument " "2"" of type '" "esl_event_t *""'"); + } + arg2 = reinterpret_cast< esl_event_t * >(argp2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + if (arg1) (arg1)->event = arg2; + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_event_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + esl_event_t *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_event_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_get" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (esl_event_t *) ((arg1)->event); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_esl_event_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_serialized_string_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_serialized_string_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_set" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + if (arg1->serialized_string) delete[] arg1->serialized_string; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->serialized_string = 0; + } + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_serialized_string_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_serialized_string_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_get" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (char *) ((arg1)->serialized_string); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_mine_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_mine_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_set" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLevent_mine_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + if (arg1) (arg1)->mine = arg2; + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_mine_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_mine_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_get" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int) ((arg1)->mine); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLevent__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) NULL ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|O:new_ESLevent",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + if (obj1) { + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLevent__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + esl_event_t *arg1 = (esl_event_t *) 0 ; + int arg2 = (int) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|O:new_ESLevent",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_esl_event_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "esl_event_t *""'"); + } + arg1 = reinterpret_cast< esl_event_t * >(argp1); + if (obj1) { + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)new ESLevent(arg1,arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLevent__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_ESLevent",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)new ESLevent(arg1); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLevent(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? (int)PyObject_Length(args) : 0; + for (ii = 0; (ii < 2) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if ((argc >= 1) && (argc <= 2)) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_esl_event_t, 0); + _v = SWIG_CheckState(res); + if (_v) { + if (argc <= 1) { + return _wrap_new_ESLevent__SWIG_1(self, args); + } + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_ESLevent__SWIG_1(self, args); + } + } + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ESLevent, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ESLevent__SWIG_2(self, args); + } + } + if ((argc >= 1) && (argc <= 2)) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + if (argc <= 1) { + return _wrap_new_ESLevent__SWIG_0(self, args); + } + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ESLevent__SWIG_0(self, args); + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ESLevent'.\n" + " Possible C/C++ prototypes are:\n" + " ESLevent::ESLevent(char const *,char const *)\n" + " ESLevent::ESLevent(esl_event_t *,int)\n" + " ESLevent::ESLevent(ESLevent *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_ESLevent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_ESLevent",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + delete arg1; + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_serialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|O:ESLevent_serialize",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialize" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + if (obj1) { + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (char *)(arg1)->serialize((char const *)arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_setPriority(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O|O:ESLevent_setPriority",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_setPriority" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + if (obj1) { + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_esl_priority_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'"); + } else { + esl_priority_t * temp = reinterpret_cast< esl_priority_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (bool)(arg1)->setPriority(arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_getHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 = (int) -1 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:ESLevent_getHeader",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ESLevent_getHeader" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (char *)(arg1)->getHeader((char const *)arg2,arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_getBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_getBody",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getBody" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (char *)(arg1)->getBody(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_getType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_getType",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getType" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (char *)(arg1)->getType(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_addBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_addBody",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addBody" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (bool)(arg1)->addBody((char const *)arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_addHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OOO:ESLevent_addHeader",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_pushHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OOO:ESLevent_pushHeader",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_pushHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_pushHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_pushHeader" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_unshiftHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OOO:ESLevent_unshiftHeader",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_unshiftHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_unshiftHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_unshiftHeader" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_delHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_delHeader",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_delHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (bool)(arg1)->delHeader((char const *)arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_firstHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_firstHeader",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_firstHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (char *)(arg1)->firstHeader(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLevent_nextHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLevent_nextHeader",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_nextHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (char *)(arg1)->nextHeader(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *ESLevent_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ESLevent, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int arg2 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + ESLconnection *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:new_ESLconnection",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_ESLconnection" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int arg2 ; + char *arg3 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + ESLconnection *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:new_ESLconnection",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLconnection *)new ESLconnection((char const *)arg1,arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + ESLconnection *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:new_ESLconnection",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_ESLconnection" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + ESLconnection *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:new_ESLconnection",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + ESLconnection *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_ESLconnection",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLconnection *)new ESLconnection(arg1); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ESLconnection(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[5]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? (int)PyObject_Length(args) : 0; + for (ii = 0; (ii < 4) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 1) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_ESLconnection__SWIG_4(self, args); + } + } + if (argc == 3) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ESLconnection__SWIG_1(self, args); + } + } + } + } + if (argc == 3) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ESLconnection__SWIG_3(self, args); + } + } + } + } + if (argc == 4) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ESLconnection__SWIG_0(self, args); + } + } + } + } + } + if (argc == 4) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_ESLconnection__SWIG_2(self, args); + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_ESLconnection'.\n" + " Possible C/C++ prototypes are:\n" + " ESLconnection::ESLconnection(char const *,int const,char const *,char const *)\n" + " ESLconnection::ESLconnection(char const *,int const,char const *)\n" + " ESLconnection::ESLconnection(char const *,char const *,char const *,char const *)\n" + " ESLconnection::ESLconnection(char const *,char const *,char const *)\n" + " ESLconnection::ESLconnection(int)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_ESLconnection(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_ESLconnection",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLconnection" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + delete arg1; + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_socketDescriptor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_socketDescriptor",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_socketDescriptor" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int)(arg1)->socketDescriptor(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_connected(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_connected",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_connected" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int)(arg1)->connected(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_getInfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_getInfo",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_getInfo" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->getInfo(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_send(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_send",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_send" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int)(arg1)->send((char const *)arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_sendRecv(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_sendRecv",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendRecv" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->sendRecv((char const *)arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_api(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:ESLconnection_api",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_bgapi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|OO:ESLconnection_bgapi",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_bgapi" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3,(char const *)arg4); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + ESLevent *arg2 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_sendEvent",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendEvent" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendEvent" "', argument " "2"" of type '" "ESLevent *""'"); + } + arg2 = reinterpret_cast< ESLevent * >(argp2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->sendEvent(arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_sendMSG(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + ESLevent *arg2 = (ESLevent *) 0 ; + char *arg3 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:ESLconnection_sendMSG",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendMSG" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendMSG" "', argument " "2"" of type '" "ESLevent *""'"); + } + arg2 = reinterpret_cast< ESLevent * >(argp2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_sendMSG" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int)(arg1)->sendMSG(arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_recvEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_recvEvent",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEvent" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->recvEvent(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_recvEventTimed(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_recvEventTimed",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEventTimed" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLconnection_recvEventTimed" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->recvEventTimed(arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_filter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:ESLconnection_filter",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_filter" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_events(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OOO:ESLconnection_events",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_events" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int)(arg1)->events((char const *)arg2,(char const *)arg3); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|OO:ESLconnection_execute",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_execute" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_executeAsync(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + ESLevent *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|OO:ESLconnection_executeAsync",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_executeAsync" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_executeAsync" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_executeAsync" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_executeAsync" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_setAsyncExecute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_setAsyncExecute",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setAsyncExecute" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setAsyncExecute" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int)(arg1)->setAsyncExecute((char const *)arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_setEventLock(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_setEventLock",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setEventLock" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int)(arg1)->setEventLock((char const *)arg2); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_disconnect(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:ESLconnection_disconnect",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_disconnect" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + result = (int)(arg1)->disconnect(); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *ESLconnection_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ESLconnection, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_eslSetLogLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:eslSetLogLevel",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "eslSetLogLevel" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + { + SWIG_PYTHON_THREAD_BEGIN_ALLOW; + eslSetLogLevel(arg1); + SWIG_PYTHON_THREAD_END_ALLOW; + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +static PyMethodDef SwigMethods[] = { + { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL}, + { (char *)"ESLevent_event_set", _wrap_ESLevent_event_set, METH_VARARGS, NULL}, + { (char *)"ESLevent_event_get", _wrap_ESLevent_event_get, METH_VARARGS, NULL}, + { (char *)"ESLevent_serialized_string_set", _wrap_ESLevent_serialized_string_set, METH_VARARGS, NULL}, + { (char *)"ESLevent_serialized_string_get", _wrap_ESLevent_serialized_string_get, METH_VARARGS, NULL}, + { (char *)"ESLevent_mine_set", _wrap_ESLevent_mine_set, METH_VARARGS, NULL}, + { (char *)"ESLevent_mine_get", _wrap_ESLevent_mine_get, METH_VARARGS, NULL}, + { (char *)"new_ESLevent", _wrap_new_ESLevent, METH_VARARGS, NULL}, + { (char *)"delete_ESLevent", _wrap_delete_ESLevent, METH_VARARGS, NULL}, + { (char *)"ESLevent_serialize", _wrap_ESLevent_serialize, METH_VARARGS, NULL}, + { (char *)"ESLevent_setPriority", _wrap_ESLevent_setPriority, METH_VARARGS, NULL}, + { (char *)"ESLevent_getHeader", _wrap_ESLevent_getHeader, METH_VARARGS, NULL}, + { (char *)"ESLevent_getBody", _wrap_ESLevent_getBody, METH_VARARGS, NULL}, + { (char *)"ESLevent_getType", _wrap_ESLevent_getType, METH_VARARGS, NULL}, + { (char *)"ESLevent_addBody", _wrap_ESLevent_addBody, METH_VARARGS, NULL}, + { (char *)"ESLevent_addHeader", _wrap_ESLevent_addHeader, METH_VARARGS, NULL}, + { (char *)"ESLevent_pushHeader", _wrap_ESLevent_pushHeader, METH_VARARGS, NULL}, + { (char *)"ESLevent_unshiftHeader", _wrap_ESLevent_unshiftHeader, METH_VARARGS, NULL}, + { (char *)"ESLevent_delHeader", _wrap_ESLevent_delHeader, METH_VARARGS, NULL}, + { (char *)"ESLevent_firstHeader", _wrap_ESLevent_firstHeader, METH_VARARGS, NULL}, + { (char *)"ESLevent_nextHeader", _wrap_ESLevent_nextHeader, METH_VARARGS, NULL}, + { (char *)"ESLevent_swigregister", ESLevent_swigregister, METH_VARARGS, NULL}, + { (char *)"new_ESLconnection", _wrap_new_ESLconnection, METH_VARARGS, NULL}, + { (char *)"delete_ESLconnection", _wrap_delete_ESLconnection, METH_VARARGS, NULL}, + { (char *)"ESLconnection_socketDescriptor", _wrap_ESLconnection_socketDescriptor, METH_VARARGS, NULL}, + { (char *)"ESLconnection_connected", _wrap_ESLconnection_connected, METH_VARARGS, NULL}, + { (char *)"ESLconnection_getInfo", _wrap_ESLconnection_getInfo, METH_VARARGS, NULL}, + { (char *)"ESLconnection_send", _wrap_ESLconnection_send, METH_VARARGS, NULL}, + { (char *)"ESLconnection_sendRecv", _wrap_ESLconnection_sendRecv, METH_VARARGS, NULL}, + { (char *)"ESLconnection_api", _wrap_ESLconnection_api, METH_VARARGS, NULL}, + { (char *)"ESLconnection_bgapi", _wrap_ESLconnection_bgapi, METH_VARARGS, NULL}, + { (char *)"ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent, METH_VARARGS, NULL}, + { (char *)"ESLconnection_sendMSG", _wrap_ESLconnection_sendMSG, METH_VARARGS, NULL}, + { (char *)"ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent, METH_VARARGS, NULL}, + { (char *)"ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed, METH_VARARGS, NULL}, + { (char *)"ESLconnection_filter", _wrap_ESLconnection_filter, METH_VARARGS, NULL}, + { (char *)"ESLconnection_events", _wrap_ESLconnection_events, METH_VARARGS, NULL}, + { (char *)"ESLconnection_execute", _wrap_ESLconnection_execute, METH_VARARGS, NULL}, + { (char *)"ESLconnection_executeAsync", _wrap_ESLconnection_executeAsync, METH_VARARGS, NULL}, + { (char *)"ESLconnection_setAsyncExecute", _wrap_ESLconnection_setAsyncExecute, METH_VARARGS, NULL}, + { (char *)"ESLconnection_setEventLock", _wrap_ESLconnection_setEventLock, METH_VARARGS, NULL}, + { (char *)"ESLconnection_disconnect", _wrap_ESLconnection_disconnect, METH_VARARGS, NULL}, + { (char *)"ESLconnection_swigregister", ESLconnection_swigregister, METH_VARARGS, NULL}, + { (char *)"eslSetLogLevel", _wrap_eslSetLogLevel, METH_VARARGS, NULL}, + { NULL, NULL, 0, NULL } +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_ESLconnection, + &_swigt__p_ESLevent, + &_swigt__p_char, + &_swigt__p_esl_event_t, + &_swigt__p_esl_priority_t, +}; + +static swig_cast_info _swigc__p_ESLconnection[] = { {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ESLevent[] = { {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_esl_event_t[] = { {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_esl_priority_t[] = { {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_ESLconnection, + _swigc__p_ESLevent, + _swigc__p_char, + _swigc__p_esl_event_t, + _swigc__p_esl_priority_t, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +static swig_const_info swig_const_table[] = { +{0, 0, 0, 0.0, 0, 0}}; + +#ifdef __cplusplus +} +#endif +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned statically to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int found, init; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + module_head = &swig_module; + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + found=0; + iter=module_head; + do { + if (iter==&swig_module) { + found=1; + break; + } + iter=iter->next; + } while (iter!= module_head); + + /* if the is found in the list, then all is done and we may leave */ + if (found) return; + /* otherwise we must add out module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpreters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + /* Python-specific SWIG API */ +#define SWIG_newvarlink() SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) + + /* ----------------------------------------------------------------------------- + * global variable support code. + * ----------------------------------------------------------------------------- */ + + typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; + } swig_globalvar; + + typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; + } swig_varlinkobject; + + SWIGINTERN PyObject * + swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_InternFromString("<Swig global variables>"); +#else + return PyString_FromString("<Swig global variables>"); +#endif + } + + SWIGINTERN PyObject * + swig_varlink_str(swig_varlinkobject *v) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *str = PyUnicode_InternFromString("("); + PyObject *tail; + PyObject *joined; + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + tail = PyUnicode_FromString(var->name); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + if (var->next) { + tail = PyUnicode_InternFromString(", "); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + } + } + tail = PyUnicode_InternFromString(")"); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; +#else + PyObject *str = PyString_FromString("("); + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + PyString_ConcatAndDel(&str,PyString_FromString(var->name)); + if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); + } + PyString_ConcatAndDel(&str,PyString_FromString(")")); +#endif + return str; + } + + SWIGINTERN int + swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { + char *tmp; + PyObject *str = swig_varlink_str(v); + fprintf(fp,"Swig global variables "); + fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(str); + return 0; + } + + SWIGINTERN void + swig_varlink_dealloc(swig_varlinkobject *v) { + swig_globalvar *var = v->vars; + while (var) { + swig_globalvar *n = var->next; + free(var->name); + free(var); + var = n; + } + } + + SWIGINTERN PyObject * + swig_varlink_getattr(swig_varlinkobject *v, char *n) { + PyObject *res = NULL; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->get_attr)(); + break; + } + var = var->next; + } + if (res == NULL && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN int + swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { + int res = 1; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->set_attr)(p); + break; + } + var = var->next; + } + if (res == 1 && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN PyTypeObject* + swig_varlink_type(void) { + static char varlink__doc__[] = "Swig var link object"; + static PyTypeObject varlink_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { + /* PyObject header changed in Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"swigvarlink", /* tp_name */ + sizeof(swig_varlinkobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (printfunc) swig_varlink_print, /* tp_print */ + (getattrfunc) swig_varlink_getattr, /* tp_getattr */ + (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc) swig_varlink_str, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + varlink__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + varlink_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + varlink_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&varlink_type) < 0) + return NULL; +#endif + } + return &varlink_type; + } + + /* Create a variable linking object for use later */ + SWIGINTERN PyObject * + SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); + if (result) { + result->vars = 0; + } + return ((PyObject*) result); + } + + SWIGINTERN void + SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v = (swig_varlinkobject *) p; + swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + if (gv) { + size_t size = strlen(name)+1; + gv->name = (char *)malloc(size); + if (gv->name) { + strncpy(gv->name,name,size); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + } + } + v->vars = gv; + } + + SWIGINTERN PyObject * + SWIG_globals(void) { + static PyObject *_SWIG_globals = 0; + if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); + return _SWIG_globals; + } + + /* ----------------------------------------------------------------------------- + * constants/methods manipulation + * ----------------------------------------------------------------------------- */ + + /* Install Constants */ + SWIGINTERN void + SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { + PyObject *obj = 0; + size_t i; + for (i = 0; constants[i].type; ++i) { + switch(constants[i].type) { + case SWIG_PY_POINTER: + obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); + break; + case SWIG_PY_BINARY: + obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); + break; + default: + obj = 0; + break; + } + if (obj) { + PyDict_SetItemString(d, constants[i].name, obj); + Py_DECREF(obj); + } + } + } + + /* -----------------------------------------------------------------------------*/ + /* Fix SwigMethods to carry the callback ptrs when needed */ + /* -----------------------------------------------------------------------------*/ + + SWIGINTERN void + SWIG_Python_FixMethods(PyMethodDef *methods, + swig_const_info *const_table, + swig_type_info **types, + swig_type_info **types_initial) { + size_t i; + for (i = 0; methods[i].ml_name; ++i) { + const char *c = methods[i].ml_doc; + if (c && (c = strstr(c, "swig_ptr: "))) { + int j; + swig_const_info *ci = 0; + const char *name = c + 10; + for (j = 0; const_table[j].type; ++j) { + if (strncmp(const_table[j].name, name, + strlen(const_table[j].name)) == 0) { + ci = &(const_table[j]); + break; + } + } + if (ci) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; + strncpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; + strncpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; + } + } + } + } + } + } + +#ifdef __cplusplus +} +#endif + +/* -----------------------------------------------------------------------------* + * Partial Init method + * -----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" +#endif + +SWIGEXPORT +#if PY_VERSION_HEX >= 0x03000000 +PyObject* +#else +void +#endif +SWIG_init(void) { + PyObject *m, *d, *md; +#if PY_VERSION_HEX >= 0x03000000 + static struct PyModuleDef SWIG_module = { +# if PY_VERSION_HEX >= 0x03020000 + PyModuleDef_HEAD_INIT, +# else + { + PyObject_HEAD_INIT(NULL) + NULL, /* m_init */ + 0, /* m_index */ + NULL, /* m_copy */ + }, +# endif + (char *) SWIG_name, + NULL, + -1, + SwigMethods, + NULL, + NULL, + NULL, + NULL + }; +#endif + +#if defined(SWIGPYTHON_BUILTIN) + static SwigPyClientData SwigPyObject_clientdata = { + 0, 0, 0, 0, 0, 0, 0 + }; + static PyGetSetDef this_getset_def = { + (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL + }; + static SwigPyGetSet thisown_getset_closure = { + (PyCFunction) SwigPyObject_own, + (PyCFunction) SwigPyObject_own + }; + static PyGetSetDef thisown_getset_def = { + (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure + }; + PyObject *metatype_args; + PyTypeObject *builtin_pytype; + int builtin_base_count; + swig_type_info *builtin_basetype; + PyObject *tuple; + PyGetSetDescrObject *static_getset; + PyTypeObject *metatype; + SwigPyClientData *cd; + PyObject *public_interface, *public_symbol; + PyObject *this_descr; + PyObject *thisown_descr; + int i; + + (void)builtin_pytype; + (void)builtin_base_count; + (void)builtin_basetype; + (void)tuple; + (void)static_getset; + + /* metatype is used to implement static member variables. */ + metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type); + assert(metatype_args); + metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL); + assert(metatype); + Py_DECREF(metatype_args); + metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro; + assert(PyType_Ready(metatype) >= 0); +#endif + + /* Fix SwigMethods to carry the callback ptrs when needed */ + SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); + +#if PY_VERSION_HEX >= 0x03000000 + m = PyModule_Create(&SWIG_module); +#else + m = Py_InitModule((char *) SWIG_name, SwigMethods); +#endif + md = d = PyModule_GetDict(m); + (void)md; + + SWIG_InitializeModule(0); + +#ifdef SWIGPYTHON_BUILTIN + SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + if (!cd) { + SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; + SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce(); + } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) { + PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); +# if PY_VERSION_HEX >= 0x03000000 + return NULL; +# else + return; +# endif + } + + /* All objects have a 'this' attribute */ + this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + (void)this_descr; + + /* All objects have a 'thisown' attribute */ + thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + (void)thisown_descr; + + public_interface = PyList_New(0); + public_symbol = 0; + (void)public_symbol; + + PyDict_SetItemString(md, "__all__", public_interface); + Py_DECREF(public_interface); + for (i = 0; SwigMethods[i].ml_name != NULL; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); + for (i = 0; swig_const_table[i].name != 0; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); +#endif + + SWIG_InstallConstants(d,swig_const_table); + + + /* Initialize threading */ + SWIG_PYTHON_INITIALIZE_THREADS; +#if PY_VERSION_HEX >= 0x03000000 + return m; +#else + return; +#endif +} + diff --git a/libs/esl/python3/events.py b/libs/esl/python3/events.py new file mode 100644 index 0000000000..2c59043447 --- /dev/null +++ b/libs/esl/python3/events.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import string +import sys + +from ESL import * + +con = ESLconnection("localhost","8021","ClueCon") +#are we connected? + +if con.connected: + + con.events("plain", "all"); + + while 1: + #my $e = $con->recvEventTimed(100); + e = con.recvEvent() + + if e: + print e.serialize() diff --git a/libs/esl/python3/python-config b/libs/esl/python3/python-config new file mode 100644 index 0000000000..cb4a6eff0a --- /dev/null +++ b/libs/esl/python3/python-config @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +from __future__ import print_function +import sys +import os +import getopt +from distutils import sysconfig + +valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', + 'ldflags', 'help'] + +def exit_with_usage(code=1): + print("Usage: %s [%s]" % (sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr) + sys.exit(code) + +try: + opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) +except getopt.error: + exit_with_usage() + +if not opts: + exit_with_usage() + +opt = opts[0][0] + +pyver = sysconfig.get_config_var('LDVERSION') +if pyver == None: + pyver = sysconfig.get_config_var('VERSION') +getvar = sysconfig.get_config_var + +if opt == '--help': + exit_with_usage(0) + +elif opt == '--prefix': + print(sysconfig.PREFIX) + +elif opt == '--exec-prefix': + print(sysconfig.EXEC_PREFIX) + +elif opt in ('--includes', '--cflags'): + flags = ['-I' + sysconfig.get_python_inc(), + '-I' + sysconfig.get_python_inc(plat_specific=True)] + if opt == '--cflags': + flags.extend(getvar('CFLAGS').split()) + print(' '.join(flags)) + +elif opt in ('--libs', '--ldflags'): + libs = getvar('LIBS').split() + getvar('SYSLIBS').split() + libs.append('-lpython'+pyver) + # add the prefix/lib/pythonX.Y/config dir, but only if there is no + # shared library in prefix/lib/. + if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'): + libs.insert(0, '-L' + getvar('LIBPL')) + print(' '.join(libs)) + diff --git a/libs/esl/python3/server.py b/libs/esl/python3/server.py new file mode 100644 index 0000000000..deba5f2ab9 --- /dev/null +++ b/libs/esl/python3/server.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import SocketServer +from ESL import * + +class ESLRequestHandler(SocketServer.BaseRequestHandler ): + def setup(self): + print self.client_address, 'connected!' + + fd = self.request.fileno() + print fd + + con = ESLconnection(fd) + print "Connected: " + print con.connected() + if con.connected(): + + info = con.getInfo() + + uuid = info.getHeader("unique-id") + print uuid + con.execute("answer", "", uuid) + con.execute("playback", "/ram/swimp.raw", uuid); + +#server host is a tuple ('host', port) +server = SocketServer.ThreadingTCPServer(('', 8040), ESLRequestHandler) +server.serve_forever() + + diff --git a/libs/esl/python3/single_command.py b/libs/esl/python3/single_command.py new file mode 100644 index 0000000000..c47c57c13c --- /dev/null +++ b/libs/esl/python3/single_command.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import string +import sys +from optparse import OptionParser +from ESL import * + +def main(argv): + + try: + + parser = OptionParser() + parser.add_option("-a", "--auth", dest="auth", default="ClueCon", + help="ESL password") + parser.add_option("-s", "--server", dest="server", default="127.0.0.1", + help="FreeSWITCH server IP address") + parser.add_option("-p", "--port", dest="port", default="8021", + help="FreeSWITCH server event socket port") + parser.add_option("-c", "--command", dest="command", + help="command to run, surround mutli word commands in \"\'s") + + (options, args) = parser.parse_args() + + + con = ESLconnection(options.server, options.port, options.auth) + #are we connected? + + if con.connected(): + #run command + e = con.api(options.command) + print e.getBody() + + else: + + print "Not Connected" + sys.exit(2) + + except: + + print parser.get_usage() + +if __name__ == "__main__": + main(sys.argv[1:]) \ No newline at end of file diff --git a/src/mod/languages/mod_python/README.md b/src/mod/languages/mod_python/README.md new file mode 100644 index 0000000000..ad0281863c --- /dev/null +++ b/src/mod/languages/mod_python/README.md @@ -0,0 +1,6 @@ +## WARNING: new default module is mod_python3 + +`freeswitch-mod-python` debian package is NOT going to be installed by default. +`freeswitch-mod-python3` will be installed instead. + +You should remove `freeswitch-mod-python3` package and install `freeswitch-mod-python` manually if you want. diff --git a/src/mod/languages/mod_python3/.gitattributes b/src/mod/languages/mod_python3/.gitattributes new file mode 100644 index 0000000000..98d05d51d6 --- /dev/null +++ b/src/mod/languages/mod_python3/.gitattributes @@ -0,0 +1,2 @@ +mod_python_wrap.cpp -diff +freeswitch.py -diff diff --git a/src/mod/languages/mod_python3/Makefile.am b/src/mod/languages/mod_python3/Makefile.am new file mode 100644 index 0000000000..796f672234 --- /dev/null +++ b/src/mod/languages/mod_python3/Makefile.am @@ -0,0 +1,30 @@ +include $(top_srcdir)/build/modmake.rulesam +MODNAME=mod_python3 + +PYMOD=freeswitch +PYTHON3_SITE_DIR=@PYTHON3_SITE_DIR@ + +SWIGCFILE=../../../switch_swig.c +SWIGIFILE=../../../switch_swig.i + +mod_LTLIBRARIES = mod_python3.la +mod_python3_la_SOURCES = mod_python3.c freeswitch_python.cpp mod_python_wrap.cpp +mod_python3_la_CFLAGS = $(SWITCH_AM_CFLAGS) +mod_python3_la_CPPFLAGS = @PYTHON3_CFLAGS@ -I$(switch_srcdir)/libs/libteletone/src/ $(SWITCH_AM_CPPFLAGS) +mod_python3_la_LIBADD = $(switch_builddir)/libfreeswitch.la +mod_python3_la_LDFLAGS = -avoid-version -module -no-undefined -shared @PYTHON3_LDFLAGS@ + +reswig: swigclean mod_python_wrap.cpp + +swigclean: clean + rm -f mod_python_wrap.* freeswitch.py + +mod_python_wrap.cpp: mod_python_extra.c hack.diff + swig3.0 -python -c++ -I../../../../src/include -oh mod_python_wrap.h -o mod_python_wrap.cpp mod_python.i + echo "#include \"mod_python_extra.c\"" >> mod_python_wrap.cpp + patch -s -p0 -i hack.diff + +install-data-local: + mkdir -m755 -p $(DESTDIR)$(PYTHON3_SITE_DIR) + cp -f freeswitch.py $(DESTDIR)$(PYTHON3_SITE_DIR) + diff --git a/src/mod/languages/mod_python3/README.md b/src/mod/languages/mod_python3/README.md new file mode 100644 index 0000000000..ad0281863c --- /dev/null +++ b/src/mod/languages/mod_python3/README.md @@ -0,0 +1,6 @@ +## WARNING: new default module is mod_python3 + +`freeswitch-mod-python` debian package is NOT going to be installed by default. +`freeswitch-mod-python3` will be installed instead. + +You should remove `freeswitch-mod-python3` package and install `freeswitch-mod-python` manually if you want. diff --git a/src/mod/languages/mod_python3/freeswitch.py b/src/mod/languages/mod_python3/freeswitch.py new file mode 100644 index 0000000000..48ccf472f1 --- /dev/null +++ b/src/mod/languages/mod_python3/freeswitch.py @@ -0,0 +1,702 @@ +# 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. + +from sys import version_info as _swig_python_version_info +if _swig_python_version_info >= (2, 7, 0): + def swig_import_helper(): + import importlib + pkg = __name__.rpartition('.')[0] + mname = '.'.join((pkg, '_freeswitch')).lstrip('.') + try: + return importlib.import_module(mname) + except ImportError: + return importlib.import_module('_freeswitch') + _freeswitch = swig_import_helper() + del swig_import_helper +elif _swig_python_version_info >= (2, 6, 0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_freeswitch', [dirname(__file__)]) + except ImportError: + import _freeswitch + return _freeswitch + try: + _mod = imp.load_module('_freeswitch', fp, pathname, description) + finally: + if fp is not None: + fp.close() + return _mod + _freeswitch = swig_import_helper() + del swig_import_helper +else: + import _freeswitch +del _swig_python_version_info + +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. + +try: + import builtins as __builtin__ +except ImportError: + import __builtin__ + +def _swig_setattr_nondynamic(self, class_type, name, value, static=1): + if (name == "thisown"): + return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name, None) + if method: + return method(self, value) + if (not static): + if _newclass: + object.__setattr__(self, name, value) + else: + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + + +def _swig_setattr(self, class_type, name, value): + return _swig_setattr_nondynamic(self, class_type, name, value, 0) + + +def _swig_getattr(self, class_type, name): + if (name == "thisown"): + return self.this.own() + method = class_type.__swig_getmethods__.get(name, None) + if method: + return method(self) + raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) + + +def _swig_repr(self): + try: + strthis = "proxy of " + self.this.__repr__() + except __builtin__.Exception: + strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +try: + _object = object + _newclass = 1 +except __builtin__.Exception: + class _object: + pass + _newclass = 0 + + +def setGlobalVariable(var_name, var_val): + return _freeswitch.setGlobalVariable(var_name, var_val) +setGlobalVariable = _freeswitch.setGlobalVariable + +def getGlobalVariable(var_name): + return _freeswitch.getGlobalVariable(var_name) +getGlobalVariable = _freeswitch.getGlobalVariable + +def consoleLog(level_str, msg): + return _freeswitch.consoleLog(level_str, msg) +consoleLog = _freeswitch.consoleLog + +def consoleLog2(level_str, file, func, line, msg): + return _freeswitch.consoleLog2(level_str, file, func, line, msg) +consoleLog2 = _freeswitch.consoleLog2 + +def consoleCleanLog(msg): + return _freeswitch.consoleCleanLog(msg) +consoleCleanLog = _freeswitch.consoleCleanLog + +def running(): + return _freeswitch.running() +running = _freeswitch.running + +def email(to, arg2, headers=None, body=None, file=None, convert_cmd=None, convert_ext=None): + return _freeswitch.email(to, arg2, headers, body, file, convert_cmd, convert_ext) +email = _freeswitch.email +class IVRMenu(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, IVRMenu, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, IVRMenu, name) + __repr__ = _swig_repr + + def __init__(self, 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): + this = _freeswitch.new_IVRMenu(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) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _freeswitch.delete_IVRMenu + __del__ = lambda self: None + + def bindAction(self, action, arg, bind): + return _freeswitch.IVRMenu_bindAction(self, action, arg, bind) + + def execute(self, session, name): + return _freeswitch.IVRMenu_execute(self, session, name) +IVRMenu_swigregister = _freeswitch.IVRMenu_swigregister +IVRMenu_swigregister(IVRMenu) + +class API(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, API, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, API, name) + __repr__ = _swig_repr + + def __init__(self, s=None): + this = _freeswitch.new_API(s) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _freeswitch.delete_API + __del__ = lambda self: None + + def execute(self, command, data=None): + return _freeswitch.API_execute(self, command, data) + + def executeString(self, command): + return _freeswitch.API_executeString(self, command) + + def getTime(self): + return _freeswitch.API_getTime(self) +API_swigregister = _freeswitch.API_swigregister +API_swigregister(API) + +class input_callback_state_t(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, input_callback_state_t, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, input_callback_state_t, name) + __repr__ = _swig_repr + __swig_setmethods__["function"] = _freeswitch.input_callback_state_t_function_set + __swig_getmethods__["function"] = _freeswitch.input_callback_state_t_function_get + if _newclass: + function = _swig_property(_freeswitch.input_callback_state_t_function_get, _freeswitch.input_callback_state_t_function_set) + __swig_setmethods__["threadState"] = _freeswitch.input_callback_state_t_threadState_set + __swig_getmethods__["threadState"] = _freeswitch.input_callback_state_t_threadState_get + if _newclass: + threadState = _swig_property(_freeswitch.input_callback_state_t_threadState_get, _freeswitch.input_callback_state_t_threadState_set) + __swig_setmethods__["extra"] = _freeswitch.input_callback_state_t_extra_set + __swig_getmethods__["extra"] = _freeswitch.input_callback_state_t_extra_get + if _newclass: + extra = _swig_property(_freeswitch.input_callback_state_t_extra_get, _freeswitch.input_callback_state_t_extra_set) + __swig_setmethods__["funcargs"] = _freeswitch.input_callback_state_t_funcargs_set + __swig_getmethods__["funcargs"] = _freeswitch.input_callback_state_t_funcargs_get + if _newclass: + funcargs = _swig_property(_freeswitch.input_callback_state_t_funcargs_get, _freeswitch.input_callback_state_t_funcargs_set) + + def __init__(self): + this = _freeswitch.new_input_callback_state_t() + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _freeswitch.delete_input_callback_state_t + __del__ = lambda self: None +input_callback_state_t_swigregister = _freeswitch.input_callback_state_t_swigregister +input_callback_state_t_swigregister(input_callback_state_t) + +S_HUP = _freeswitch.S_HUP +S_FREE = _freeswitch.S_FREE +S_RDLOCK = _freeswitch.S_RDLOCK +class DTMF(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, DTMF, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, DTMF, name) + __repr__ = _swig_repr + __swig_setmethods__["digit"] = _freeswitch.DTMF_digit_set + __swig_getmethods__["digit"] = _freeswitch.DTMF_digit_get + if _newclass: + digit = _swig_property(_freeswitch.DTMF_digit_get, _freeswitch.DTMF_digit_set) + __swig_setmethods__["duration"] = _freeswitch.DTMF_duration_set + __swig_getmethods__["duration"] = _freeswitch.DTMF_duration_get + if _newclass: + duration = _swig_property(_freeswitch.DTMF_duration_get, _freeswitch.DTMF_duration_set) + + def __init__(self, *args): + this = _freeswitch.new_DTMF(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _freeswitch.delete_DTMF + __del__ = lambda self: None +DTMF_swigregister = _freeswitch.DTMF_swigregister +DTMF_swigregister(DTMF) + +class Stream(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Stream, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Stream, name) + __repr__ = _swig_repr + + def __init__(self, *args): + this = _freeswitch.new_Stream(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _freeswitch.delete_Stream + __del__ = lambda self: None + + def read(self, len): + return _freeswitch.Stream_read(self, len) + + def write(self, data): + return _freeswitch.Stream_write(self, data) + + def raw_write(self, data, len): + return _freeswitch.Stream_raw_write(self, data, len) + + def get_data(self): + return _freeswitch.Stream_get_data(self) +Stream_swigregister = _freeswitch.Stream_swigregister +Stream_swigregister(Stream) + +class Event(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Event, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Event, name) + __repr__ = _swig_repr + __swig_setmethods__["event"] = _freeswitch.Event_event_set + __swig_getmethods__["event"] = _freeswitch.Event_event_get + if _newclass: + event = _swig_property(_freeswitch.Event_event_get, _freeswitch.Event_event_set) + __swig_setmethods__["serialized_string"] = _freeswitch.Event_serialized_string_set + __swig_getmethods__["serialized_string"] = _freeswitch.Event_serialized_string_get + if _newclass: + serialized_string = _swig_property(_freeswitch.Event_serialized_string_get, _freeswitch.Event_serialized_string_set) + __swig_setmethods__["mine"] = _freeswitch.Event_mine_set + __swig_getmethods__["mine"] = _freeswitch.Event_mine_get + if _newclass: + mine = _swig_property(_freeswitch.Event_mine_get, _freeswitch.Event_mine_set) + + def __init__(self, *args): + this = _freeswitch.new_Event(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _freeswitch.delete_Event + __del__ = lambda self: None + + def chat_execute(self, app, data=None): + return _freeswitch.Event_chat_execute(self, app, data) + + def chat_send(self, dest_proto=None): + return _freeswitch.Event_chat_send(self, dest_proto) + + def serialize(self, format=None): + return _freeswitch.Event_serialize(self, format) + + def setPriority(self, *args): + return _freeswitch.Event_setPriority(self, *args) + + def getHeader(self, header_name): + return _freeswitch.Event_getHeader(self, header_name) + + def getBody(self): + return _freeswitch.Event_getBody(self) + + def getType(self): + return _freeswitch.Event_getType(self) + + def addBody(self, value): + return _freeswitch.Event_addBody(self, value) + + def addHeader(self, header_name, value): + return _freeswitch.Event_addHeader(self, header_name, value) + + def delHeader(self, header_name): + return _freeswitch.Event_delHeader(self, header_name) + + def fire(self): + return _freeswitch.Event_fire(self) + + def merge(self, to_merge): + return _freeswitch.Event_merge(self, to_merge) +Event_swigregister = _freeswitch.Event_swigregister +Event_swigregister(Event) + +class EventConsumer(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, EventConsumer, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, EventConsumer, name) + __repr__ = _swig_repr + __swig_setmethods__["events"] = _freeswitch.EventConsumer_events_set + __swig_getmethods__["events"] = _freeswitch.EventConsumer_events_get + if _newclass: + events = _swig_property(_freeswitch.EventConsumer_events_get, _freeswitch.EventConsumer_events_set) + __swig_setmethods__["e_event_id"] = _freeswitch.EventConsumer_e_event_id_set + __swig_getmethods__["e_event_id"] = _freeswitch.EventConsumer_e_event_id_get + if _newclass: + e_event_id = _swig_property(_freeswitch.EventConsumer_e_event_id_get, _freeswitch.EventConsumer_e_event_id_set) + __swig_setmethods__["e_callback"] = _freeswitch.EventConsumer_e_callback_set + __swig_getmethods__["e_callback"] = _freeswitch.EventConsumer_e_callback_get + if _newclass: + e_callback = _swig_property(_freeswitch.EventConsumer_e_callback_get, _freeswitch.EventConsumer_e_callback_set) + __swig_setmethods__["e_subclass_name"] = _freeswitch.EventConsumer_e_subclass_name_set + __swig_getmethods__["e_subclass_name"] = _freeswitch.EventConsumer_e_subclass_name_get + if _newclass: + e_subclass_name = _swig_property(_freeswitch.EventConsumer_e_subclass_name_get, _freeswitch.EventConsumer_e_subclass_name_set) + __swig_setmethods__["e_cb_arg"] = _freeswitch.EventConsumer_e_cb_arg_set + __swig_getmethods__["e_cb_arg"] = _freeswitch.EventConsumer_e_cb_arg_get + if _newclass: + e_cb_arg = _swig_property(_freeswitch.EventConsumer_e_cb_arg_get, _freeswitch.EventConsumer_e_cb_arg_set) + __swig_setmethods__["enodes"] = _freeswitch.EventConsumer_enodes_set + __swig_getmethods__["enodes"] = _freeswitch.EventConsumer_enodes_get + if _newclass: + enodes = _swig_property(_freeswitch.EventConsumer_enodes_get, _freeswitch.EventConsumer_enodes_set) + __swig_setmethods__["node_index"] = _freeswitch.EventConsumer_node_index_set + __swig_getmethods__["node_index"] = _freeswitch.EventConsumer_node_index_get + if _newclass: + node_index = _swig_property(_freeswitch.EventConsumer_node_index_get, _freeswitch.EventConsumer_node_index_set) + + def __init__(self, *args): + this = _freeswitch.new_EventConsumer(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _freeswitch.delete_EventConsumer + __del__ = lambda self: None + + def bind(self, *args): + return _freeswitch.EventConsumer_bind(self, *args) + + def pop(self, block=0, timeout=0): + return _freeswitch.EventConsumer_pop(self, block, timeout) + + def cleanup(self): + return _freeswitch.EventConsumer_cleanup(self) +EventConsumer_swigregister = _freeswitch.EventConsumer_swigregister +EventConsumer_swigregister(EventConsumer) + +class CoreSession(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, CoreSession, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, CoreSession, name) + + def __init__(self, *args, **kwargs): + raise AttributeError("No constructor defined - class is abstract") + __repr__ = _swig_repr + __swig_destroy__ = _freeswitch.delete_CoreSession + __del__ = lambda self: None + __swig_setmethods__["session"] = _freeswitch.CoreSession_session_set + __swig_getmethods__["session"] = _freeswitch.CoreSession_session_get + if _newclass: + session = _swig_property(_freeswitch.CoreSession_session_get, _freeswitch.CoreSession_session_set) + __swig_setmethods__["channel"] = _freeswitch.CoreSession_channel_set + __swig_getmethods__["channel"] = _freeswitch.CoreSession_channel_get + if _newclass: + channel = _swig_property(_freeswitch.CoreSession_channel_get, _freeswitch.CoreSession_channel_set) + __swig_setmethods__["flags"] = _freeswitch.CoreSession_flags_set + __swig_getmethods__["flags"] = _freeswitch.CoreSession_flags_get + if _newclass: + flags = _swig_property(_freeswitch.CoreSession_flags_get, _freeswitch.CoreSession_flags_set) + __swig_setmethods__["allocated"] = _freeswitch.CoreSession_allocated_set + __swig_getmethods__["allocated"] = _freeswitch.CoreSession_allocated_get + if _newclass: + allocated = _swig_property(_freeswitch.CoreSession_allocated_get, _freeswitch.CoreSession_allocated_set) + __swig_setmethods__["cb_state"] = _freeswitch.CoreSession_cb_state_set + __swig_getmethods__["cb_state"] = _freeswitch.CoreSession_cb_state_get + if _newclass: + cb_state = _swig_property(_freeswitch.CoreSession_cb_state_get, _freeswitch.CoreSession_cb_state_set) + __swig_setmethods__["hook_state"] = _freeswitch.CoreSession_hook_state_set + __swig_getmethods__["hook_state"] = _freeswitch.CoreSession_hook_state_get + if _newclass: + hook_state = _swig_property(_freeswitch.CoreSession_hook_state_get, _freeswitch.CoreSession_hook_state_set) + __swig_setmethods__["cause"] = _freeswitch.CoreSession_cause_set + __swig_getmethods__["cause"] = _freeswitch.CoreSession_cause_get + if _newclass: + cause = _swig_property(_freeswitch.CoreSession_cause_get, _freeswitch.CoreSession_cause_set) + __swig_setmethods__["uuid"] = _freeswitch.CoreSession_uuid_set + __swig_getmethods__["uuid"] = _freeswitch.CoreSession_uuid_get + if _newclass: + uuid = _swig_property(_freeswitch.CoreSession_uuid_get, _freeswitch.CoreSession_uuid_set) + __swig_setmethods__["tts_name"] = _freeswitch.CoreSession_tts_name_set + __swig_getmethods__["tts_name"] = _freeswitch.CoreSession_tts_name_get + if _newclass: + tts_name = _swig_property(_freeswitch.CoreSession_tts_name_get, _freeswitch.CoreSession_tts_name_set) + __swig_setmethods__["voice_name"] = _freeswitch.CoreSession_voice_name_set + __swig_getmethods__["voice_name"] = _freeswitch.CoreSession_voice_name_get + if _newclass: + voice_name = _swig_property(_freeswitch.CoreSession_voice_name_get, _freeswitch.CoreSession_voice_name_set) + + def insertFile(self, file, insert_file, sample_point): + return _freeswitch.CoreSession_insertFile(self, file, insert_file, sample_point) + + def answer(self): + return _freeswitch.CoreSession_answer(self) + + def _print(self, txt): + return _freeswitch.CoreSession__print(self, txt) + + def preAnswer(self): + return _freeswitch.CoreSession_preAnswer(self) + + def hangup(self, *args): + return _freeswitch.CoreSession_hangup(self, *args) + + def hangupState(self): + return _freeswitch.CoreSession_hangupState(self) + + def setVariable(self, var, val): + return _freeswitch.CoreSession_setVariable(self, var, val) + + def setPrivate(self, var, val): + return _freeswitch.CoreSession_setPrivate(self, var, val) + + def getPrivate(self, var): + return _freeswitch.CoreSession_getPrivate(self, var) + + def getVariable(self, var): + return _freeswitch.CoreSession_getVariable(self, var) + + def process_callback_result(self, result): + return _freeswitch.CoreSession_process_callback_result(self, result) + + def say(self, tosay, module_name, say_type, say_method, say_gender=None): + return _freeswitch.CoreSession_say(self, tosay, module_name, say_type, say_method, say_gender) + + def sayPhrase(self, *args): + return _freeswitch.CoreSession_sayPhrase(self, *args) + + def hangupCause(self): + return _freeswitch.CoreSession_hangupCause(self) + + def getState(self): + return _freeswitch.CoreSession_getState(self) + + def recordFile(self, file_name, time_limit=0, silence_threshold=0, silence_hits=0): + return _freeswitch.CoreSession_recordFile(self, file_name, time_limit, silence_threshold, silence_hits) + + def originate(self, a_leg_session, dest, timeout=60, handlers=None): + return _freeswitch.CoreSession_originate(self, a_leg_session, dest, timeout, handlers) + + def destroy(self): + return _freeswitch.CoreSession_destroy(self) + + def setDTMFCallback(self, cbfunc, funcargs): + return _freeswitch.CoreSession_setDTMFCallback(self, cbfunc, funcargs) + + def speak(self, text): + return _freeswitch.CoreSession_speak(self, text) + + def set_tts_parms(self, tts_name, voice_name): + return _freeswitch.CoreSession_set_tts_parms(self, tts_name, voice_name) + + def set_tts_params(self, tts_name, voice_name): + return _freeswitch.CoreSession_set_tts_params(self, tts_name, voice_name) + + def collectDigits(self, *args): + return _freeswitch.CoreSession_collectDigits(self, *args) + + def getDigits(self, *args): + return _freeswitch.CoreSession_getDigits(self, *args) + + def transfer(self, extension, dialplan=None, context=None): + return _freeswitch.CoreSession_transfer(self, extension, dialplan, context) + + def read(self, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators, digit_timeout=0): + return _freeswitch.CoreSession_read(self, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators, digit_timeout) + + def detectSpeech(self, arg0, arg1=None, arg2=None, arg3=None): + return _freeswitch.CoreSession_detectSpeech(self, arg0, arg1, arg2, arg3) + + def playAndGetDigits(self, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name=None, digit_timeout=0, transfer_on_failure=None): + return _freeswitch.CoreSession_playAndGetDigits(self, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name, digit_timeout, transfer_on_failure) + + def playAndDetectSpeech(self, file, engine, grammar): + return _freeswitch.CoreSession_playAndDetectSpeech(self, file, engine, grammar) + + def streamFile(self, file, starting_sample_count=0): + return _freeswitch.CoreSession_streamFile(self, file, starting_sample_count) + + def sleep(self, ms, sync=0): + return _freeswitch.CoreSession_sleep(self, ms, sync) + + def flushEvents(self): + return _freeswitch.CoreSession_flushEvents(self) + + def flushDigits(self): + return _freeswitch.CoreSession_flushDigits(self) + + def setAutoHangup(self, val): + return _freeswitch.CoreSession_setAutoHangup(self, val) + + def setHangupHook(self, hangup_func): + return _freeswitch.CoreSession_setHangupHook(self, hangup_func) + + def ready(self): + return _freeswitch.CoreSession_ready(self) + + def bridged(self): + return _freeswitch.CoreSession_bridged(self) + + def answered(self): + return _freeswitch.CoreSession_answered(self) + + def mediaReady(self): + return _freeswitch.CoreSession_mediaReady(self) + + def waitForAnswer(self, calling_session): + return _freeswitch.CoreSession_waitForAnswer(self, calling_session) + + def execute(self, app, data=None): + return _freeswitch.CoreSession_execute(self, app, data) + + def sendEvent(self, sendME): + return _freeswitch.CoreSession_sendEvent(self, sendME) + + def setEventData(self, e): + return _freeswitch.CoreSession_setEventData(self, e) + + def getXMLCDR(self): + return _freeswitch.CoreSession_getXMLCDR(self) + + def begin_allow_threads(self): + return _freeswitch.CoreSession_begin_allow_threads(self) + + def end_allow_threads(self): + return _freeswitch.CoreSession_end_allow_threads(self) + + def get_uuid(self): + return _freeswitch.CoreSession_get_uuid(self) + + def get_cb_args(self): + return _freeswitch.CoreSession_get_cb_args(self) + + def check_hangup_hook(self): + return _freeswitch.CoreSession_check_hangup_hook(self) + + def run_dtmf_callback(self, input, itype): + return _freeswitch.CoreSession_run_dtmf_callback(self, input, itype) + + def consoleLog(self, level_str, msg): + return _freeswitch.CoreSession_consoleLog(self, level_str, msg) + + def consoleLog2(self, level_str, file, func, line, msg): + return _freeswitch.CoreSession_consoleLog2(self, level_str, file, func, line, msg) +CoreSession_swigregister = _freeswitch.CoreSession_swigregister +CoreSession_swigregister(CoreSession) + + +def console_log(level_str, msg): + return _freeswitch.console_log(level_str, msg) +console_log = _freeswitch.console_log + +def console_log2(level_str, file, func, line, msg): + return _freeswitch.console_log2(level_str, file, func, line, msg) +console_log2 = _freeswitch.console_log2 + +def console_clean_log(msg): + return _freeswitch.console_clean_log(msg) +console_clean_log = _freeswitch.console_clean_log + +def msleep(ms): + return _freeswitch.msleep(ms) +msleep = _freeswitch.msleep + +def bridge(session_a, session_b): + return _freeswitch.bridge(session_a, session_b) +bridge = _freeswitch.bridge + +def hanguphook(session): + return _freeswitch.hanguphook(session) +hanguphook = _freeswitch.hanguphook + +def dtmf_callback(session, input, itype, buf, buflen): + return _freeswitch.dtmf_callback(session, input, itype, buf, buflen) +dtmf_callback = _freeswitch.dtmf_callback +class Session(CoreSession): + __swig_setmethods__ = {} + for _s in [CoreSession]: + __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) + __setattr__ = lambda self, name, value: _swig_setattr(self, Session, name, value) + __swig_getmethods__ = {} + for _s in [CoreSession]: + __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) + __getattr__ = lambda self, name: _swig_getattr(self, Session, name) + __repr__ = _swig_repr + + def __init__(self, *args): + this = _freeswitch.new_Session(*args) + try: + self.this.append(this) + except __builtin__.Exception: + self.this = this + __swig_destroy__ = _freeswitch.delete_Session + __del__ = lambda self: None + + def begin_allow_threads(self): + return _freeswitch.Session_begin_allow_threads(self) + + def end_allow_threads(self): + return _freeswitch.Session_end_allow_threads(self) + + def check_hangup_hook(self): + return _freeswitch.Session_check_hangup_hook(self) + + def destroy(self): + return _freeswitch.Session_destroy(self) + + def run_dtmf_callback(self, input, itype): + return _freeswitch.Session_run_dtmf_callback(self, input, itype) + + def setInputCallback(self, cbfunc, funcargs=None): + return _freeswitch.Session_setInputCallback(self, cbfunc, funcargs) + + def unsetInputCallback(self): + return _freeswitch.Session_unsetInputCallback(self) + + def setHangupHook(self, pyfunc, arg=None): + return _freeswitch.Session_setHangupHook(self, pyfunc, arg) + + def ready(self): + return _freeswitch.Session_ready(self) + __swig_setmethods__["cb_function"] = _freeswitch.Session_cb_function_set + __swig_getmethods__["cb_function"] = _freeswitch.Session_cb_function_get + if _newclass: + cb_function = _swig_property(_freeswitch.Session_cb_function_get, _freeswitch.Session_cb_function_set) + __swig_setmethods__["cb_arg"] = _freeswitch.Session_cb_arg_set + __swig_getmethods__["cb_arg"] = _freeswitch.Session_cb_arg_get + if _newclass: + cb_arg = _swig_property(_freeswitch.Session_cb_arg_get, _freeswitch.Session_cb_arg_set) + __swig_setmethods__["hangup_func"] = _freeswitch.Session_hangup_func_set + __swig_getmethods__["hangup_func"] = _freeswitch.Session_hangup_func_get + if _newclass: + hangup_func = _swig_property(_freeswitch.Session_hangup_func_get, _freeswitch.Session_hangup_func_set) + __swig_setmethods__["hangup_func_arg"] = _freeswitch.Session_hangup_func_arg_set + __swig_getmethods__["hangup_func_arg"] = _freeswitch.Session_hangup_func_arg_get + if _newclass: + hangup_func_arg = _swig_property(_freeswitch.Session_hangup_func_arg_get, _freeswitch.Session_hangup_func_arg_set) + + def setPython(self, state): + return _freeswitch.Session_setPython(self, state) + + def setSelf(self, state): + return _freeswitch.Session_setSelf(self, state) +Session_swigregister = _freeswitch.Session_swigregister +Session_swigregister(Session) + +# This file is compatible with both classic and new-style classes. + + diff --git a/src/mod/languages/mod_python3/freeswitch_python.cpp b/src/mod/languages/mod_python3/freeswitch_python.cpp new file mode 100644 index 0000000000..0893c47c91 --- /dev/null +++ b/src/mod/languages/mod_python3/freeswitch_python.cpp @@ -0,0 +1,342 @@ + +#include <switch.h> +#include "freeswitch_python.h" +using namespace PYTHON; + +#define py_init_vars() cb_function = cb_arg = hangup_func = hangup_func_arg = NULL; hh = mark = 0; TS = NULL + +#define PyString_AsString PyUnicode_AsUTF8 +#define PyString_Check PyUnicode_Check + +Session::Session():CoreSession() +{ + py_init_vars(); +} + +Session::Session(char *nuuid, CoreSession *a_leg):CoreSession(nuuid, a_leg) +{ + py_init_vars(); +} + +Session::Session(switch_core_session_t *new_session):CoreSession(new_session) +{ + py_init_vars(); +} +static switch_status_t python_hanguphook(switch_core_session_t *session_hungup); + +void Session::destroy(void) +{ + + if (!allocated) { + return; + } + + if (session) { + if (!channel) { + channel = switch_core_session_get_channel(session); + } + switch_channel_set_private(channel, "CoreSession", NULL); + switch_core_event_hook_remove_state_change(session, python_hanguphook); + } + + if (hangup_func) { + Py_DECREF(hangup_func); + hangup_func = NULL; + } + + if (hangup_func_arg) { + Py_DECREF(hangup_func_arg); + hangup_func_arg = NULL; + } + + if (cb_function) { + Py_DECREF(cb_function); + cb_function = NULL; + } + + if (cb_arg) { + Py_DECREF(cb_arg); + cb_arg = NULL; + } + + CoreSession::destroy(); +} + +Session::~Session() +{ + destroy(); +} + +bool Session::begin_allow_threads() +{ + + do_hangup_hook(); + + if (!TS) { + TS = PyEval_SaveThread(); + if (channel) { + switch_channel_set_private(channel, "SwapInThreadState", TS); + } + return true; + } + + return false; +} + +bool Session::end_allow_threads() +{ + + if (!TS) { + return false; + } + + PyEval_RestoreThread(TS); + TS = NULL; + + if (channel) { + switch_channel_set_private(channel, "SwapInThreadState", NULL); + } + + do_hangup_hook(); + + return true; +} + +void Session::setPython(PyObject *state) +{ + Py = state; +} + +void Session::setSelf(PyObject *state) +{ + Self = state; +} + +PyObject *Session::getPython() +{ + return Py; +} + + +bool Session::ready() +{ + bool r; + + sanity_check(false); + r = switch_channel_ready(channel) != 0; + + /*! this is called every time ready is called as a workaround to + make it threadsafe. it sets a flag, and all the places where it + comes in and out of threadswap, check it. so the end result is + you still get the hangup hook executed pretty soon after you + hangup. */ + do_hangup_hook(); + + return r; +} + +void Session::check_hangup_hook() +{ + if (hangup_func && (hook_state == CS_HANGUP || hook_state == CS_ROUTING)) { + hh++; + } +} + +void Session::do_hangup_hook() +{ + PyObject *result, *arglist; + const char *what = hook_state == CS_HANGUP ? "hangup" : "transfer"; + + if (hh && !mark) { + mark++; + + if (hangup_func) { + + if (!PyCallable_Check(hangup_func)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n"); + return; + } + + if (!Self) { + mod_python_conjure_session(NULL, session); + } + + if (hangup_func_arg) { + arglist = Py_BuildValue("(OsO)", Self, what, hangup_func_arg); + } else { + arglist = Py_BuildValue("(Os)", Self, what); + } + + if (!(result = PyEval_CallObject(hangup_func, arglist))) { + PyErr_Print(); + } + + Py_XDECREF(arglist); + Py_XDECREF(hangup_func_arg); + } + } + +} + +static switch_status_t python_hanguphook(switch_core_session_t *session_hungup) +{ + switch_channel_t *channel = switch_core_session_get_channel(session_hungup); + CoreSession *coresession = NULL; + switch_channel_state_t state = switch_channel_get_state(channel); + + if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) { + if (coresession->hook_state != state) { + coresession->hook_state = state; + coresession->check_hangup_hook(); + } + } + + return SWITCH_STATUS_SUCCESS; +} + + +void Session::setHangupHook(PyObject *pyfunc, PyObject *arg) +{ + + if (!PyCallable_Check(pyfunc)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n"); + return; + } + + if (hangup_func) { + if (session) { + switch_core_event_hook_remove_state_change(session, python_hanguphook); + } + Py_XDECREF(hangup_func); + hangup_func = NULL; + } + + if (hangup_func_arg) { + Py_XDECREF(hangup_func_arg); + hangup_func_arg = NULL; + } + + hangup_func = pyfunc; + hangup_func_arg = arg; + + Py_XINCREF(hangup_func); + + if (hangup_func_arg) { + Py_XINCREF(hangup_func_arg); + } + + switch_channel_set_private(channel, "CoreSession", this); + hook_state = switch_channel_get_state(channel); + switch_core_event_hook_add_state_change(session, python_hanguphook); + +} + +void Session::unsetInputCallback(void) +{ + if (cb_function) { + Py_XDECREF(cb_function); + cb_function = NULL; + } + + if (cb_arg) { + Py_XDECREF(cb_arg); + cb_arg = NULL; + } + + args.input_callback = NULL; + ap = NULL; + +} + +void Session::setInputCallback(PyObject *cbfunc, PyObject *funcargs) +{ + + if (!PyCallable_Check(cbfunc)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n"); + return; + } + + if (cb_function) { + Py_XDECREF(cb_function); + cb_function = NULL; + } + + if (cb_arg) { + Py_XDECREF(cb_arg); + cb_arg = NULL; + } + + cb_function = cbfunc; + cb_arg = funcargs; + args.buf = this; + switch_channel_set_private(channel, "CoreSession", this); + + Py_XINCREF(cb_function); + + if (cb_arg) { + Py_XINCREF(cb_arg); + } + + args.input_callback = dtmf_callback; + ap = &args; + +} + +switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype) +{ + + PyObject *pyresult, *arglist, *io = NULL; + int ts = 0; + char *str = NULL, *what = ""; + + if (TS) { + ts++; + end_allow_threads(); + } + + if (!PyCallable_Check(cb_function)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n"); + return SWITCH_STATUS_FALSE; + } + + if (itype == SWITCH_INPUT_TYPE_DTMF) { + switch_dtmf_t *dtmf = (switch_dtmf_t *) input; + io = mod_python_conjure_DTMF(dtmf->digit, dtmf->duration); + what = "dtmf"; + } else if (itype == SWITCH_INPUT_TYPE_EVENT){ + what = "event"; + io = mod_python_conjure_event((switch_event_t *) input); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unsupported type!\n"); + return SWITCH_STATUS_FALSE; + } + + if (!Self) { + mod_python_conjure_session(NULL, session); + } + + if (cb_arg) { + arglist = Py_BuildValue("(OsOO)", Self, what, io, cb_arg); + } else { + arglist = Py_BuildValue("(OsO)", Self, what, io); + } + + if ((pyresult = PyEval_CallObject(cb_function, arglist))) { + str = (char *) PyString_AsString(pyresult); + } else { + PyErr_Print(); + } + + Py_XDECREF(arglist); + Py_XDECREF(io); + + if (ts) { + begin_allow_threads(); + } + + if (str) { + return process_callback_result(str); + } + + return SWITCH_STATUS_FALSE; +} diff --git a/src/mod/languages/mod_python3/freeswitch_python.h b/src/mod/languages/mod_python3/freeswitch_python.h new file mode 100644 index 0000000000..6c9dacd410 --- /dev/null +++ b/src/mod/languages/mod_python3/freeswitch_python.h @@ -0,0 +1,49 @@ +#ifndef FREESWITCH_PYTHON_H +#define FREESWITCH_PYTHON_H + +extern "C" { +#include <Python.h> +#include "mod_python_extra.h" +} +#include <switch_cpp.h> +namespace PYTHON { + class Session:public CoreSession { + private: + virtual void do_hangup_hook(); + PyObject *getPython(); + PyObject *Py; + PyObject *Self; + int hh; + int mark; + PyThreadState *TS; + public: + Session(); + Session(char *nuuid, CoreSession * a_leg = NULL); + Session(switch_core_session_t *session); + virtual ~ Session(); + + virtual bool begin_allow_threads(); + virtual bool end_allow_threads(); + virtual void check_hangup_hook(); + virtual void destroy(void); + + virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype); + void setInputCallback(PyObject * cbfunc, PyObject * funcargs = NULL); + void unsetInputCallback(void); + void setHangupHook(PyObject * pyfunc, PyObject * arg = NULL); + bool ready(); + + PyObject *cb_function; + PyObject *cb_arg; + PyObject *hangup_func; + PyObject *hangup_func_arg; + + /* keep a pointer to parent module, internal use only */ + void setPython(PyObject * state); + + /* keeps the PyObject * version of the Session so it can be used as args to the callback */ + void setSelf(PyObject * state); + + }; +} +#endif diff --git a/src/mod/languages/mod_python3/hack.diff b/src/mod/languages/mod_python3/hack.diff new file mode 100644 index 0000000000..5732630bba --- /dev/null +++ b/src/mod/languages/mod_python3/hack.diff @@ -0,0 +1,117 @@ +--- mod_python_wrap.cpp.old 2015-06-16 12:56:23.868000000 -0500 ++++ mod_python_wrap.cpp 2015-06-16 12:56:32.268000000 -0500 +@@ -3500,7 +3500,9 @@ SWIG_AsCharArray(PyObject * obj, char *val, size_t size) + if (csize <= size) { + if (val) { + if (csize) memcpy(val, cptr, csize*sizeof(char)); ++#ifndef __clang_analyzer__ + if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); ++#endif + } + if (alloc == SWIG_NEWOBJ) { + delete[] cptr; +@@ -4677,7 +4677,7 @@ SWIGINTERN PyObject *_wrap_DTMF_digit_set(PyObject *SWIGUNUSEDPARM(self), PyObje + char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; +- char val2 ; ++ char val2 = '\0'; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; +@@ -4787,7 +4787,7 @@ SWIGINTERN PyObject *_wrap_new_DTMF(PyObject *SWIGUNUSEDPARM(self), PyObject *ar + PyObject *resultobj = 0; + char arg1 ; + uint32_t arg2 = (uint32_t) SWITCH_DEFAULT_DTMF_DURATION ; +- char val1 ; ++ char val1 = '\0'; + int ecode1 = 0 ; + void *argp2 ; + int res2 = 0 ; +@@ -6198,7 +6198,9 @@ + } + arg3 = static_cast< int >(val3); + } ++ Py_BEGIN_ALLOW_THREADS; + result = (Event *)(arg1)->pop(arg2,arg3); ++ Py_END_ALLOW_THREADS; + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN | 0 ); + return resultobj; + fail: +@@ -9264,20 +9266,20 @@ + } + + +-SWIGINTERN PyObject *_wrap_new_Session__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { ++SWIGINTERN PyObject *_wrap_new_Session__SWIG_0(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_Session")) SWIG_fail; + result = (PYTHON::Session *)new PYTHON::Session(); +- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); ++ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); result->setPython(self); + return resultobj; + fail: + return NULL; + } + + +-SWIGINTERN PyObject *_wrap_new_Session__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { ++SWIGINTERN PyObject *_wrap_new_Session__SWIG_1(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + CoreSession *arg2 = (CoreSession *) 0 ; +@@ -9302,7 +9304,7 @@ + } + arg2 = reinterpret_cast< CoreSession * >(argp2); + result = (PYTHON::Session *)new PYTHON::Session(arg1,arg2); +- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); ++ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); result->setPython(self); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; + fail: +@@ -9311,7 +9313,7 @@ + } + + +-SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { ++SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int res1 ; +@@ -9327,7 +9329,7 @@ + } + arg1 = reinterpret_cast< char * >(buf1); + result = (PYTHON::Session *)new PYTHON::Session(arg1); +- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); ++ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); result->setPython(self); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; + fail: +@@ -9336,7 +9338,7 @@ + } + + +-SWIGINTERN PyObject *_wrap_new_Session__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { ++SWIGINTERN PyObject *_wrap_new_Session__SWIG_3(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + void *argp1 = 0 ; +@@ -9351,7 +9353,7 @@ + } + arg1 = reinterpret_cast< switch_core_session_t * >(argp1); + result = (PYTHON::Session *)new PYTHON::Session(arg1); +- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); ++ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); result->setPython(self); + return resultobj; + fail: + return NULL; +@@ -10492,6 +10492,7 @@ SWIGINTERN PyObject *_wrap_Session_setSelf(PyObject *SWIGUNUSEDPARM(self), PyObj + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setSelf" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); ++ if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "Session_setSelf" "', argument " "1"" is NULL"); + arg2 = obj1; + (arg1)->setSelf(arg2); + resultobj = SWIG_Py_Void(); diff --git a/src/mod/languages/mod_python3/mod_python.i b/src/mod/languages/mod_python3/mod_python.i new file mode 100644 index 0000000000..0e8be465ee --- /dev/null +++ b/src/mod/languages/mod_python3/mod_python.i @@ -0,0 +1,36 @@ +%module freeswitch +%include "cstring.i" +%include ../../../../swig_common.i +/** + * tell swig to treat these variables as mutable so they + * can be used to return values. + * See http://www.swig.org/Doc1.3/Library.html + */ +%cstring_bounded_mutable(char *dtmf_buf, 128); +%cstring_bounded_mutable(char *terminator, 8); + +%newobject EventConsumer::pop; +%newobject Session; +%newobject CoreSession; +%newobject Event; +%newobject Stream; +%newobject API::execute; +%newobject API::executeString; +%newobject CoreSession::playAndDetectSpeech; + +/** insert the following includes into generated code so it compiles */ +%{ +#include "switch_cpp.h" +#include "freeswitch_python.h" +%} + + +%ignore SwitchToMempool; + +/** + * tell swig to grok everything defined in these header files and + * build all sorts of c wrappers and python shadows of the c wrappers. + */ +%include switch_swigable_cpp.h +%include freeswitch_python.h + diff --git a/src/mod/languages/mod_python3/mod_python3.c b/src/mod/languages/mod_python3/mod_python3.c new file mode 100644 index 0000000000..17136e8453 --- /dev/null +++ b/src/mod/languages/mod_python3/mod_python3.c @@ -0,0 +1,674 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Brian Fertig <brian.fertig@convergencetek.com> + * Johny Kadarisman <jkr888@gmail.com> + * Traun Leyden <tleyden@branchcut.com> + * Heimo Stieg <heimo.stieg@nextiraone.eu> + * + * mod_python.c -- Python Module + * + */ + +#include <Python.h> +#include <frameobject.h> + +#ifndef _REENTRANT +#define _REENTRANT +#endif + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include <switch.h> +#include "mod_python_extra.h" +#include <string.h> + +#define PyString_AsString PyUnicode_AsUTF8 +#define PyString_Check PyUnicode_Check + +PyThreadState *mainThreadState = NULL; + +PyMODINIT_FUNC PyInit__freeswitch(void); +int py_thread(const char *text); +static void set_max_recursion_depth(void); +static switch_api_interface_t python_run_interface; +static void print_python_error(const char * script); + +SWITCH_MODULE_LOAD_FUNCTION(mod_python_load); +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown); +SWITCH_MODULE_DEFINITION_EX(mod_python, mod_python_load, mod_python_shutdown, NULL, SMODF_GLOBAL_SYMBOLS); + +static struct { + switch_memory_pool_t *pool; + char *xml_handler; +} globals; + +struct switch_py_thread { + struct switch_py_thread *prev, *next; + char *cmd; + char *args; + switch_memory_pool_t *pool; + PyThreadState *tstate; +}; +struct switch_py_thread *thread_pool_head = NULL; +static switch_mutex_t *THREAD_POOL_LOCK = NULL; + + + +/** +* This function is similiar to PyErr_Print. It uses the freeswitch print/log mechanism instead of the python sys.stderr +*/ +static void print_python_error(const char * script) +{ + PyObject *pyType = NULL, *pyValue = NULL, *pyTraceback = NULL, *pyString = NULL; + PyObject *pyModule=NULL, *pyFunction = NULL, *pyResult = NULL; + char * buffer = (char*) malloc( 20 * 1024 * sizeof(char)); + /* Variables for the traceback */ + PyTracebackObject * pyTB = NULL/*, *pyTB2 = NULL*/; + char sTemp[256]; + + if (buffer == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough Memory to create the error buffer"); + return; + } + + /* just for security that we will always have a string terminater */ + memset(buffer, 0, 20 * 1024 * sizeof(char) ); + + /*Get the errordata*/ + PyErr_Fetch(&pyType, &pyValue, &pyTraceback); + PyErr_NormalizeException(&pyType, &pyValue, &pyTraceback); + + + /* Printing header*/ + sprintf(buffer, "Python Error by calling script \"%s\": ", script ); + + if (pyType != NULL && (pyString=PyObject_Str(pyType))!=NULL && (PyString_Check(pyString))) { + strcat(buffer, PyString_AsString(pyString)); + } else { + strcat(buffer, "<unknown exception type> "); + } + Py_XDECREF(pyString); + + + /*Print error message*/ + if (pyValue != NULL && (pyString=PyObject_Str(pyValue))!=NULL && (PyString_Check(pyString))) { + strcat(buffer, "\nMessage: "); + strcat(buffer, PyString_AsString(pyString)); + } else { + strcat(buffer, "\nMessage: <unknown exception date> "); + } + Py_XDECREF(pyString); + + + /* Print the traceback */ + if (pyTraceback != NULL && PyTraceBack_Check(pyTraceback)) { + + /*loading traceback module to create the exception data*/ + pyModule = PyImport_ImportModule("traceback"); + if (pyModule) { + strcat(buffer, "\nException: "); + pyFunction = PyObject_GetAttrString(pyModule, "format_exc"); + if (pyFunction) { + pyResult = PyObject_CallObject(pyFunction, NULL); + if (pyResult && PyString_Check(pyResult)) { + strcat(buffer, PyString_AsString(pyResult)); + } else { + strcat(buffer, "<exception not available>"); + } + Py_XDECREF(pyFunction); + + } + Py_XDECREF(pyModule); + + } + + /* Print traceback header */ + strcat(buffer, "\nTraceback (most recent call last)"); + pyTB = (PyTracebackObject*) pyTraceback; + + /* Traceback */ + do { + sprintf((char*)sTemp, "\n\tFile: \"%s\", line %i, in %s", + PyString_AsString(pyTB->tb_frame->f_code->co_filename), + pyTB->tb_lineno, + PyString_AsString(pyTB->tb_frame->f_code->co_name) ); + strcat(buffer, (char*)sTemp); + + pyTB=pyTB->tb_next; + } while(pyTB != NULL); + } + + PyErr_Restore(pyType,pyValue,pyTraceback); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", buffer); + + /* free the resources, we dont need memory leaks here */ + free(buffer); +} + + +static void eval_some_python(const char *funcname, char *args, switch_core_session_t *session, switch_stream_handle_t *stream, switch_event_t *params, + char **str, struct switch_py_thread *pt) +{ + 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; + PyObject *arg = NULL; + PyObject *result = NULL; + char *p; + + if (str) { + *str = NULL; + } + + if (args) { + dupargs = strdup(args); + } else { + return; + } + + assert(dupargs != NULL); + + if (!(argc = 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; + } + + script = strdup(switch_str_nil(argv[0])); + + if ((p = strstr(script, "::"))) { + *p = '\0'; + p += 2; + if (p) { + funcname = p; + } + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Invoking py module: %s\n", script); + + tstate = PyThreadState_New(mainThreadState->interp); + if (!tstate) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n"); + goto done; + } + + /* Save state in thread struct so we can terminate it later if needed */ + if (pt) + pt->tstate = tstate; + + // swap in thread state + PyEval_AcquireThread(tstate); + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *add_path = switch_channel_get_variable(channel, "python_script_path"); + + if (!zstr(add_path)) { + char *buffer = (char*) malloc( 20 * 1024 * sizeof(char)); + if (buffer == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough Memory to create the error buffer\n"); + } + + PyRun_SimpleString("import sys"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LOADING path %s", add_path); + + sprintf(buffer, "sys.path.append(\"%s\");", add_path ); + + PyRun_SimpleString(buffer); + + switch_safe_free(buffer); + } + } + + // import the module + module_o = PyImport_ImportModule((char *) script); + if (!module_o) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error importing module\n"); + print_python_error(script); + PyErr_Clear(); + goto done_swap_out; + } + // reload the module + module = PyImport_ReloadModule(module_o); + if (!module) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reloading module\n"); + print_python_error(script); + PyErr_Clear(); + goto done_swap_out; + } + // get the handler function to be called + function = PyObject_GetAttrString(module, (char *) funcname); + if (!function) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define %s\n", funcname); + print_python_error(script); + PyErr_Clear(); + goto done_swap_out; + } + + PyRun_SimpleString("import freeswitch"); + + if (session) { + sp = mod_python_conjure_session(module, session); + } + + if (params) { + eve = mod_python_conjure_event(params); + } + + if (stream) { + stp = mod_python_conjure_stream(stream); + if (stream->param_event) { + Py_XDECREF(eve); + eve = mod_python_conjure_event(stream->param_event); + } + } + + if (sp && eve && stp) { + arg = Py_BuildValue("(OOOs)", sp, stp, eve, switch_str_nil(argv[1])); + } else if (eve && stp) { + arg = Py_BuildValue("(sOOs)", "na", stp, eve, switch_str_nil(argv[1])); + } else if (eve) { + arg = Py_BuildValue("(Os)", eve, switch_str_nil(argv[1])); + } else if (sp) { + arg = Py_BuildValue("(Os)", sp, switch_str_nil(argv[1])); + } else { + arg = Py_BuildValue("(s)", switch_str_nil(argv[1])); + } + + // invoke the handler + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n"); + result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Finished calling python script \n"); + + // check the result and print out any errors + if (result) { + if (str) { + *str = strdup((char *) PyString_AsString(result)); + } + } else if (!PyErr_ExceptionMatches(PyExc_SystemExit)) { + // Print error, but ignore SystemExit + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n"); + print_python_error(script); + PyErr_Clear(); + PyRun_SimpleString("python_makes_sense"); + PyGC_Collect(); + } + + done_swap_out: + + + Py_XDECREF(result); + Py_XDECREF(arg); + Py_XDECREF(function); + Py_XDECREF(module); + Py_XDECREF(module_o); + Py_XDECREF(stp); + Py_XDECREF(eve); + Py_XDECREF(sp); + + if (tstate) { + // thread state must be cleared explicitly or we'll get memory leaks + PyThreadState_Clear(tstate); + PyEval_ReleaseThread(tstate); + PyThreadState_Delete(tstate); + } + + done: + + switch_safe_free(dupargs); + switch_safe_free(script); +} + + +static switch_xml_t python_fetch(const char *section, + const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data) +{ + + switch_xml_t xml = NULL; + char *str = NULL; + + if (!zstr(globals.xml_handler)) { + char *mycmd = strdup(globals.xml_handler); + + switch_assert(mycmd); + + eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str, NULL); + + if (str) { + if (zstr(str)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n"); + } else if (!(xml = switch_xml_parse_str((char *) str, strlen(str)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n"); + } + switch_safe_free(str); + } + + free(mycmd); + } + + return xml; +} + +static switch_status_t do_config(void) +{ + char *cf = "python.conf"; + switch_xml_t cfg, xml, settings, param; + + 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 (!strcmp(var, "xml-handler-script")) { + globals.xml_handler = switch_core_strdup(globals.pool, val); + } else if (!strcmp(var, "xml-handler-bindings")) { + if (!zstr(globals.xml_handler)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val); + switch_xml_bind_search_function(python_fetch, switch_xml_parse_section_string(val), NULL); + } + } else if (!strcmp(var, "startup-script")) { + if (val) { + py_thread(val); + } + } + } + } + + switch_xml_free(xml); + + return SWITCH_STATUS_SUCCESS; +} + + +/** + * As freeswitch runs with a smaller than normal stack size (240K instead of the usual value .. 1 or 2 MB), + * we must decrease the default python recursion limit accordingly. Otherwise, python can easily blow + * up the stack and the whole switch crashes. See modlang-134 + */ +static void set_max_recursion_depth(void) +{ + + // assume that a stack frame is approximately 1K, so divide thread stack size (eg, 240K) by + // 1K to get the approx number of stack frames we can hold before blowing up. + int newMaxRecursionDepth = SWITCH_THREAD_STACKSIZE / 1024; + + PyObject *sysModule = PyImport_ImportModule("sys"); + PyObject *setRecursionLimit = PyObject_GetAttrString(sysModule, "setrecursionlimit"); + PyObject *recLimit = Py_BuildValue("(i)", newMaxRecursionDepth); + PyObject *setrecursion_result = PyEval_CallObjectWithKeywords(setRecursionLimit, recLimit, (PyObject *) NULL); + if (setrecursion_result) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set python recursion limit to %d\n", newMaxRecursionDepth); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set recursion limit to %d\n", newMaxRecursionDepth); + print_python_error("_freeswitch"); + PyErr_Clear(); + PyRun_SimpleString("python_makes_sense"); + PyGC_Collect(); + } + + +} + +SWITCH_STANDARD_APP(python_function) +{ + eval_some_python("handler", (char *) data, session, NULL, NULL, NULL, NULL); + +} + +static void *SWITCH_THREAD_FUNC py_thread_run(switch_thread_t *thread, void *obj) +{ + switch_memory_pool_t *pool; + struct switch_py_thread *pt = (struct switch_py_thread *) obj; + + /* Put thread in pool so we keep track of our threads */ + switch_mutex_lock(THREAD_POOL_LOCK); + pt->next = thread_pool_head; + pt->prev = NULL; + if (pt->next) + pt->next->prev = pt; + thread_pool_head = pt; + switch_mutex_unlock(THREAD_POOL_LOCK); + + /* Run the python script */ + eval_some_python("runtime", pt->args, NULL, NULL, NULL, NULL, pt); + + /* Thread is dead, remove from pool */ + switch_mutex_lock(THREAD_POOL_LOCK); + if (pt->next) + pt->next->prev = pt->prev; + if (pt->prev) + pt->prev->next = pt->next; + if (thread_pool_head == pt) + thread_pool_head = pt->next; + switch_mutex_unlock(THREAD_POOL_LOCK); + + pool = pt->pool; + switch_core_destroy_memory_pool(&pool); + + return NULL; +} + +SWITCH_STANDARD_API(api_python) +{ + + eval_some_python("fsapi", (char *) cmd, session, stream, NULL, NULL, NULL); + + return SWITCH_STATUS_SUCCESS; +} + +int py_thread(const char *text) +{ + switch_thread_t *thread; + switch_threadattr_t *thd_attr = NULL; + switch_memory_pool_t *pool; + struct switch_py_thread *pt; + + switch_core_new_memory_pool(&pool); + assert(pool != NULL); + + pt = switch_core_alloc(pool, sizeof(*pt)); + assert(pt != NULL); + + pt->pool = pool; + pt->args = switch_core_strdup(pt->pool, text); + + switch_threadattr_create(&thd_attr, pt->pool); + switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&thread, thd_attr, py_thread_run, pt, pt->pool); + + return 0; +} + +SWITCH_STANDARD_API(launch_python) +{ + + if (zstr(cmd)) { + stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax); + return SWITCH_STATUS_SUCCESS; + } + + py_thread(cmd); + stream->write_function(stream, "OK\n"); + return SWITCH_STATUS_SUCCESS; +} + + +SWITCH_STANDARD_CHAT_APP(python_chat_function) +{ + eval_some_python("chat", (char *) data, NULL, NULL, message, NULL, NULL); + return SWITCH_STATUS_SUCCESS; + +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_python_load) +{ + switch_api_interface_t *api_interface; + switch_application_interface_t *app_interface; + switch_chat_application_interface_t *chat_app_interface; + + char *pp = getenv("PYTHONPATH"); + + if (pp) { + char *path = switch_mprintf("%s:%s", pp, SWITCH_GLOBAL_dirs.script_dir); + setenv("PYTHONPATH", path, 1); + free(path); + } else { + setenv("PYTHONPATH", SWITCH_GLOBAL_dirs.script_dir, 1); + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n"); + + globals.pool = pool; + + if (!Py_IsInitialized()) { + + /* Add a built-in module, before Py_Initialize */ + if (PyImport_AppendInittab("_freeswitch", PyInit__freeswitch) == -1) { + fprintf(stderr, "Error: could not extend in-built modules table\n"); + } + + // initialize python system + Py_Initialize(); + + // create GIL and a threadstate + PyEval_InitThreads(); + + // save threadstate since it's interp field will be needed + // to create new threadstates, and will be needed for shutdown + mainThreadState = PyThreadState_Get(); + + // set the maximum recursion depth + set_max_recursion_depth(); + + // swap out threadstate since the call threads will create + // their own and swap in their threadstate + PyThreadState_Swap(NULL); + + // release GIL + PyEval_ReleaseLock(); + } + + switch_mutex_init(&THREAD_POOL_LOCK, SWITCH_MUTEX_NESTED, pool); + + do_config(); + + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + SWITCH_ADD_API(api_interface, "pyrun", "run a python script", launch_python, "python </path/to/script>"); + SWITCH_ADD_API(api_interface, "python", "run a python script", api_python, "python </path/to/script>"); + SWITCH_ADD_APP(app_interface, "python", "Launch python ivr", "Run a python ivr on a channel", python_function, "<script> [additional_vars [...]]", + SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_CHAT_APP(chat_app_interface, "python", "execute a python script", "execute a python script", python_chat_function, "<script>", SCAF_NONE); + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_NOUNLOAD; +} + +/* + Called when the system shuts down*/ +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown) +{ + PyInterpreterState *mainInterpreterState; + PyThreadState *myThreadState; + int thread_cnt = 0; + struct switch_py_thread *pt = NULL; + struct switch_py_thread *nextpt; + int i; + + /* Kill all remaining threads */ + pt = thread_pool_head; + while (pt) { + thread_cnt++; + nextpt = pt->next; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Forcibly terminating script [%s]\n", pt->args); + + /* Kill python script */ + PyThreadState_Swap(pt->tstate); + PyThreadState_SetAsyncExc(pt->tstate->thread_id, PyExc_SystemExit); + + pt = nextpt; + } + PyThreadState_Swap(mainThreadState); + PyEval_ReleaseLock(); + switch_yield(1000000); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt); + + /* Give threads a few seconds to terminate. + Not using switch_thread_join() since if threads refuse to die + then freeswitch will hang */ + for (i = 0; i < 10 && thread_pool_head; i++) { + switch_yield(1000000); + } + if (thread_pool_head) { + /* Not all threads died in time */ + pt = thread_pool_head; + while (pt) { + nextpt = pt->next; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Script [%s] didn't exit in time\n", pt->args); + pt = nextpt; + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Forcing python shutdown. This might cause freeswitch to crash!\n"); + } + + + mainInterpreterState = mainThreadState->interp; + myThreadState = PyThreadState_New(mainInterpreterState); + PyThreadState_Swap(myThreadState); + PyEval_ReleaseLock(); + + Py_Finalize(); + PyEval_ReleaseLock(); + + return SWITCH_STATUS_UNLOAD; + +} + +/* Return the number of arguments of the application command line */ + +/* 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/languages/mod_python3/mod_python_extra.c b/src/mod/languages/mod_python3/mod_python_extra.c new file mode 100644 index 0000000000..16cc8b0973 --- /dev/null +++ b/src/mod/languages/mod_python3/mod_python_extra.c @@ -0,0 +1,56 @@ +SWITCH_BEGIN_EXTERN_C PyObject * mod_python_conjure_event(switch_event_t *event) +{ + PyObject *obj; + Event *result = new Event(event, 0); + + obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN); + + return obj; +} + + +PyObject *mod_python_conjure_stream(switch_stream_handle_t *stream) +{ + PyObject *obj; + Stream *result = new Stream(stream); + + obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_OWN); + + return obj; +} + +PyObject *mod_python_conjure_session(PyObject * module, switch_core_session_t *session) +{ + PyObject *obj; + + PYTHON::Session * result = new PYTHON::Session(session); + obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_OWN); + + result->setPython(module); + result->setSelf(obj); + +#if 0 + if (module && name) { + PyDict_SetItem(PyModule_GetDict(module), Py_BuildValue("s", name), obj); + Py_DECREF(obj); + } +#endif + + return obj; + +} + +PyObject *mod_python_conjure_DTMF(char digit, int32_t duration) +{ + PyObject *obj; + + DTMF *result = new DTMF(digit, duration); + obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_POINTER_OWN); + + return obj; + +} + + + +SWITCH_END_EXTERN_C diff --git a/src/mod/languages/mod_python3/mod_python_extra.h b/src/mod/languages/mod_python3/mod_python_extra.h new file mode 100644 index 0000000000..d65c2f9a49 --- /dev/null +++ b/src/mod/languages/mod_python3/mod_python_extra.h @@ -0,0 +1,9 @@ +#ifndef MOD_PYTHON_EXTRA +#define MOD_PYTHON_EXTRA +SWITCH_BEGIN_EXTERN_C PyObject * mod_python_conjure_event(switch_event_t *event); +PyObject *mod_python_conjure_stream(switch_stream_handle_t *stream); +PyObject *mod_python_conjure_session(PyObject * module, switch_core_session_t *session); +PyObject *mod_python_conjure_DTMF(char digit, int32_t duration); + +SWITCH_END_EXTERN_C +#endif diff --git a/src/mod/languages/mod_python3/mod_python_wrap.cpp b/src/mod/languages/mod_python3/mod_python_wrap.cpp new file mode 100644 index 0000000000..bd4985bbbe --- /dev/null +++ b/src/mod/languages/mod_python3/mod_python_wrap.cpp @@ -0,0 +1,11530 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.12 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifndef SWIGPYTHON +#define SWIGPYTHON +#endif + +#define SWIG_PYTHON_DIRECTOR_NO_VTABLE + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template<typename T> class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); + SwigValueWrapper(const SwigValueWrapper<T>& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template <typename T> T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + + +#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) +/* Use debug wrappers with the Python release dll */ +# undef _DEBUG +# include <Python.h> +# define _DEBUG +#else +# include <Python.h> +#endif + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic C API SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. + + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The SWIG conversion methods, as ConvertPtr, return an integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old versions of SWIG, code such as the following was usually written: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + which is the same really, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + also requires SWIG_ConvertPtr to return new result values, such as + + int SWIG_ConvertPtr(obj, ptr,...) { + if (<obj is ok>) { + if (<need new object>) { + *ptr = <ptr to new allocated object>; + return SWIG_NEWOBJ; + } else { + *ptr = <ptr to old object>; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + SWIG errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() +*/ + +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast(r) (r) +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class<int>" == "Class<int >", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (equiv != 0 && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = SWIG_TypeNameComp(nb, ne, tb, te); + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like <name1>|<name2>|... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; +} + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + size_t l = 0; + size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + char d = *(c++); + unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = (unsigned char)((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = (unsigned char)((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (unsigned char)(d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (unsigned char)(d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +/* Compatibility macros for Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + +#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) +#define PyInt_Check(x) PyLong_Check(x) +#define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_FromLong(x) PyLong_FromLong(x) +#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) +#define PyString_Check(name) PyBytes_Check(name) +#define PyString_FromString(x) PyUnicode_FromString(x) +#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) +#define PyString_AsString(str) PyBytes_AsString(str) +#define PyString_Size(str) PyBytes_Size(str) +#define PyString_InternFromString(key) PyUnicode_InternFromString(key) +#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE +#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) +#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) + +#endif + +#ifndef Py_TYPE +# define Py_TYPE(op) ((op)->ob_type) +#endif + +/* SWIG APIs for compatibility of both Python 2 & 3 */ + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_FromFormat PyUnicode_FromFormat +#else +# define SWIG_Python_str_FromFormat PyString_FromFormat +#endif + + +/* Warning: This function will allocate a new string in Python 3, + * so please call SWIG_Python_str_DelForPy3(x) to free the space. + */ +SWIGINTERN char* +SWIG_Python_str_AsChar(PyObject *str) +{ +#if PY_VERSION_HEX >= 0x03000000 + char *cstr; + char *newstr; + Py_ssize_t len; + str = PyUnicode_AsUTF8String(str); + PyBytes_AsStringAndSize(str, &cstr, &len); + newstr = (char *) malloc(len+1); + memcpy(newstr, cstr, len+1); + Py_XDECREF(str); + return newstr; +#else + return PyString_AsString(str); +#endif +} + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) +#else +# define SWIG_Python_str_DelForPy3(x) +#endif + + +SWIGINTERN PyObject* +SWIG_Python_str_FromChar(const char *c) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromString(c); +#else + return PyString_FromString(c); +#endif +} + +/* Add PyOS_snprintf for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) +# define PyOS_snprintf _snprintf +# else +# define PyOS_snprintf snprintf +# endif +#endif + +/* A crude PyString_FromFormat implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 + +#ifndef SWIG_PYBUFFER_SIZE +# define SWIG_PYBUFFER_SIZE 1024 +#endif + +static PyObject * +PyString_FromFormat(const char *fmt, ...) { + va_list ap; + char buf[SWIG_PYBUFFER_SIZE * 2]; + int res; + va_start(ap, fmt); + res = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); +} +#endif + +#ifndef PyObject_DEL +# define PyObject_DEL PyObject_Del +#endif + +/* A crude PyExc_StopIteration exception for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# ifndef PyExc_StopIteration +# define PyExc_StopIteration PyExc_RuntimeError +# endif +# ifndef PyObject_GenericGetAttr +# define PyObject_GenericGetAttr 0 +# endif +#endif + +/* Py_NotImplemented is defined in 2.1 and up. */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef Py_NotImplemented +# define Py_NotImplemented PyExc_RuntimeError +# endif +#endif + +/* A crude PyString_AsStringAndSize implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef PyString_AsStringAndSize +# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} +# endif +#endif + +/* PySequence_Size for old Pythons */ +#if PY_VERSION_HEX < 0x02000000 +# ifndef PySequence_Size +# define PySequence_Size PySequence_Length +# endif +#endif + +/* PyBool_FromLong for old Pythons */ +#if PY_VERSION_HEX < 0x02030000 +static +PyObject *PyBool_FromLong(long ok) +{ + PyObject *result = ok ? Py_True : Py_False; + Py_INCREF(result); + return result; +} +#endif + +/* Py_ssize_t for old Pythons */ +/* This code is as recommended by: */ +/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) +typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +typedef inquiry lenfunc; +typedef intargfunc ssizeargfunc; +typedef intintargfunc ssizessizeargfunc; +typedef intobjargproc ssizeobjargproc; +typedef intintobjargproc ssizessizeobjargproc; +typedef getreadbufferproc readbufferproc; +typedef getwritebufferproc writebufferproc; +typedef getsegcountproc segcountproc; +typedef getcharbufferproc charbufferproc; +static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc)) +{ + long result = 0; + PyObject *i = PyNumber_Int(x); + if (i) { + result = PyInt_AsLong(i); + Py_DECREF(i); + } + return result; +} +#endif + +#if PY_VERSION_HEX < 0x02050000 +#define PyInt_FromSize_t(x) PyInt_FromLong((long)x) +#endif + +#if PY_VERSION_HEX < 0x02040000 +#define Py_VISIT(op) \ + do { \ + if (op) { \ + int vret = visit((op), arg); \ + if (vret) \ + return vret; \ + } \ + } while (0) +#endif + +#if PY_VERSION_HEX < 0x02030000 +typedef struct { + PyTypeObject type; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; + PyBufferProcs as_buffer; + PyObject *name, *slots; +} PyHeapTypeObject; +#endif + +#if PY_VERSION_HEX < 0x02030000 +typedef destructor freefunc; +#endif + +#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \ + (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \ + (PY_MAJOR_VERSION > 3)) +# define SWIGPY_USE_CAPSULE +# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) +#endif + +#if PY_VERSION_HEX < 0x03020000 +#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) +#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) +#define Py_hash_t long +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIME PyObject* +SWIG_Python_ErrorType(int code) { + PyObject* type = 0; + switch(code) { + case SWIG_MemoryError: + type = PyExc_MemoryError; + break; + case SWIG_IOError: + type = PyExc_IOError; + break; + case SWIG_RuntimeError: + type = PyExc_RuntimeError; + break; + case SWIG_IndexError: + type = PyExc_IndexError; + break; + case SWIG_TypeError: + type = PyExc_TypeError; + break; + case SWIG_DivisionByZero: + type = PyExc_ZeroDivisionError; + break; + case SWIG_OverflowError: + type = PyExc_OverflowError; + break; + case SWIG_SyntaxError: + type = PyExc_SyntaxError; + break; + case SWIG_ValueError: + type = PyExc_ValueError; + break; + case SWIG_SystemError: + type = PyExc_SystemError; + break; + case SWIG_AttributeError: + type = PyExc_AttributeError; + break; + default: + type = PyExc_RuntimeError; + } + return type; +} + + +SWIGRUNTIME void +SWIG_Python_AddErrorMsg(const char* mesg) +{ + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + + if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + PyErr_Clear(); + Py_XINCREF(type); + + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + Py_DECREF(value); + } else { + PyErr_SetString(PyExc_RuntimeError, mesg); + } +} + +#if defined(SWIG_PYTHON_NO_THREADS) +# if defined(SWIG_PYTHON_THREADS) +# undef SWIG_PYTHON_THREADS +# endif +#endif +#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ +# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) +# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ +# define SWIG_PYTHON_USE_GIL +# endif +# endif +# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ +# ifndef SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# endif +# ifdef __cplusplus /* C++ code */ + class SWIG_Python_Thread_Block { + bool status; + PyGILState_STATE state; + public: + void end() { if (status) { PyGILState_Release(state); status = false;} } + SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} + ~SWIG_Python_Thread_Block() { end(); } + }; + class SWIG_Python_Thread_Allow { + bool status; + PyThreadState *save; + public: + void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} + ~SWIG_Python_Thread_Allow() { end(); } + }; +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block +# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow +# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() +# else /* C code */ +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() +# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() +# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) +# endif +# else /* Old thread way, not implemented, user must provide it */ +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) +# define SWIG_PYTHON_THREAD_END_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# endif +# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) +# define SWIG_PYTHON_THREAD_END_ALLOW +# endif +# endif +#else /* No thread support */ +# define SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# define SWIG_PYTHON_THREAD_END_BLOCK +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# define SWIG_PYTHON_THREAD_END_ALLOW +#endif + +/* ----------------------------------------------------------------------------- + * Python API portion that goes into the runtime + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ----------------------------------------------------------------------------- + * Constant declarations + * ----------------------------------------------------------------------------- */ + +/* Constant Types */ +#define SWIG_PY_POINTER 4 +#define SWIG_PY_BINARY 5 + +/* Constant information structure */ +typedef struct swig_const_info { + int type; + char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_const_info; + + +/* ----------------------------------------------------------------------------- + * Wrapper of PyInstanceMethod_New() used in Python 3 + * It is exported to the generated module, used for -fastproxy + * ----------------------------------------------------------------------------- */ +#if PY_VERSION_HEX >= 0x03000000 +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) +{ + return PyInstanceMethod_New(func); +} +#else +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func)) +{ + return NULL; +} +#endif + +#ifdef __cplusplus +} +#endif + + +/* ----------------------------------------------------------------------------- + * pyrun.swg + * + * This file contains the runtime support for Python modules + * and includes code for managing global variables and pointer + * type checking. + * + * ----------------------------------------------------------------------------- */ + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) + +#ifdef SWIGPYTHON_BUILTIN +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) +#else +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) +#endif + +#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) + +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) +#define swig_owntype int + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) +#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) + +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + + +/* Runtime API implementation */ + +/* Error manipulation */ + +SWIGINTERN void +SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetObject(errtype, obj); + Py_DECREF(obj); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +SWIGINTERN void +SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(errtype, msg); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) + +/* Set a constant value */ + +#if defined(SWIGPYTHON_BUILTIN) + +SWIGINTERN void +SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { + PyObject *s = PyString_InternFromString(key); + PyList_Append(seq, s); + Py_DECREF(s); +} + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { +#if PY_VERSION_HEX < 0x02030000 + PyDict_SetItemString(d, (char *)name, obj); +#else + PyDict_SetItemString(d, name, obj); +#endif + Py_DECREF(obj); + if (public_interface) + SwigPyBuiltin_AddPublicSymbol(public_interface, name); +} + +#else + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { +#if PY_VERSION_HEX < 0x02030000 + PyDict_SetItemString(d, (char *)name, obj); +#else + PyDict_SetItemString(d, name, obj); +#endif + Py_DECREF(obj); +} + +#endif + +/* Append a value to the result obj */ + +SWIGINTERN PyObject* +SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { +#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyList_Check(result)) { + PyObject *o2 = result; + result = PyList_New(1); + PyList_SetItem(result, 0, o2); + } + PyList_Append(result,obj); + Py_DECREF(obj); + } + return result; +#else + PyObject* o2; + PyObject* o3; + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyTuple_Check(result)) { + o2 = result; + result = PyTuple_New(1); + PyTuple_SET_ITEM(result, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SET_ITEM(o3, 0, obj); + o2 = result; + result = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return result; +#endif +} + +/* Unpack the argument tuple */ + +SWIGINTERN Py_ssize_t +SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) +{ + if (!args) { + if (!min && !max) { + return 1; + } else { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + name, (min == max ? "" : "at least "), (int)min); + return 0; + } + } + if (!PyTuple_Check(args)) { + if (min <= 1 && max >= 1) { + Py_ssize_t i; + objs[0] = args; + for (i = 1; i < max; ++i) { + objs[i] = 0; + } + return 2; + } + PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); + return 0; + } else { + Py_ssize_t l = PyTuple_GET_SIZE(args); + if (l < min) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at least "), (int)min, (int)l); + return 0; + } else if (l > max) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at most "), (int)max, (int)l); + return 0; + } else { + Py_ssize_t i; + for (i = 0; i < l; ++i) { + objs[i] = PyTuple_GET_ITEM(args, i); + } + for (; l < max; ++l) { + objs[l] = 0; + } + return i + 1; + } + } +} + +/* A functor is a function object with one single object argument */ +#if PY_VERSION_HEX >= 0x02020000 +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); +#else +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); +#endif + +/* + Helper for static pointer initialization for both C and C++ code, for example + static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); +*/ +#ifdef __cplusplus +#define SWIG_STATIC_POINTER(var) var +#else +#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var +#endif + +/* ----------------------------------------------------------------------------- + * Pointer declarations + * ----------------------------------------------------------------------------- */ + +/* Flags for new pointer objects */ +#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) +#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) + +#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) + +#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) +#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) + +#ifdef __cplusplus +extern "C" { +#endif + +/* How to access Py_None */ +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# ifndef SWIG_PYTHON_NO_BUILD_NONE +# ifndef SWIG_PYTHON_BUILD_NONE +# define SWIG_PYTHON_BUILD_NONE +# endif +# endif +#endif + +#ifdef SWIG_PYTHON_BUILD_NONE +# ifdef Py_None +# undef Py_None +# define Py_None SWIG_Py_None() +# endif +SWIGRUNTIMEINLINE PyObject * +_SWIG_Py_None(void) +{ + PyObject *none = Py_BuildValue((char*)""); + Py_DECREF(none); + return none; +} +SWIGRUNTIME PyObject * +SWIG_Py_None(void) +{ + static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); + return none; +} +#endif + +/* The python void return value */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Py_Void(void) +{ + PyObject *none = Py_None; + Py_INCREF(none); + return none; +} + +/* SwigPyClientData */ + +typedef struct { + PyObject *klass; + PyObject *newraw; + PyObject *newargs; + PyObject *destroy; + int delargs; + int implicitconv; + PyTypeObject *pytype; +} SwigPyClientData; + +SWIGRUNTIMEINLINE int +SWIG_Python_CheckImplicit(swig_type_info *ty) +{ + SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; + return data ? data->implicitconv : 0; +} + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_ExceptionType(swig_type_info *desc) { + SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; + PyObject *klass = data ? data->klass : 0; + return (klass ? klass : PyExc_RuntimeError); +} + + +SWIGRUNTIME SwigPyClientData * +SwigPyClientData_New(PyObject* obj) +{ + if (!obj) { + return 0; + } else { + SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); + /* the klass element */ + data->klass = obj; + Py_INCREF(data->klass); + /* the newraw method and newargs arguments used to create a new raw instance */ + if (PyClass_Check(obj)) { + data->newraw = 0; + data->newargs = obj; + Py_INCREF(obj); + } else { +#if (PY_VERSION_HEX < 0x02020000) + data->newraw = 0; +#else + data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); +#endif + if (data->newraw) { + Py_INCREF(data->newraw); + data->newargs = PyTuple_New(1); + PyTuple_SetItem(data->newargs, 0, obj); + } else { + data->newargs = obj; + } + Py_INCREF(data->newargs); + } + /* the destroy method, aka as the C++ delete method */ + data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); + if (PyErr_Occurred()) { + PyErr_Clear(); + data->destroy = 0; + } + if (data->destroy) { + int flags; + Py_INCREF(data->destroy); + flags = PyCFunction_GET_FLAGS(data->destroy); +#ifdef METH_O + data->delargs = !(flags & (METH_O)); +#else + data->delargs = 0; +#endif + } else { + data->delargs = 0; + } + data->implicitconv = 0; + data->pytype = 0; + return data; + } +} + +SWIGRUNTIME void +SwigPyClientData_Del(SwigPyClientData *data) { + Py_XDECREF(data->newraw); + Py_XDECREF(data->newargs); + Py_XDECREF(data->destroy); +} + +/* =============== SwigPyObject =====================*/ + +typedef struct { + PyObject_HEAD + void *ptr; + swig_type_info *ty; + int own; + PyObject *next; +#ifdef SWIGPYTHON_BUILTIN + PyObject *dict; +#endif +} SwigPyObject; + + +#ifdef SWIGPYTHON_BUILTIN + +SWIGRUNTIME PyObject * +SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *)v; + + if (!sobj->dict) + sobj->dict = PyDict_New(); + + Py_INCREF(sobj->dict); + return sobj->dict; +} + +#endif + +SWIGRUNTIME PyObject * +SwigPyObject_long(SwigPyObject *v) +{ + return PyLong_FromVoidPtr(v->ptr); +} + +SWIGRUNTIME PyObject * +SwigPyObject_format(const char* fmt, SwigPyObject *v) +{ + PyObject *res = NULL; + PyObject *args = PyTuple_New(1); + if (args) { + if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { + PyObject *ofmt = SWIG_Python_str_FromChar(fmt); + if (ofmt) { +#if PY_VERSION_HEX >= 0x03000000 + res = PyUnicode_Format(ofmt,args); +#else + res = PyString_Format(ofmt,args); +#endif + Py_DECREF(ofmt); + } + Py_DECREF(args); + } + } + return res; +} + +SWIGRUNTIME PyObject * +SwigPyObject_oct(SwigPyObject *v) +{ + return SwigPyObject_format("%o",v); +} + +SWIGRUNTIME PyObject * +SwigPyObject_hex(SwigPyObject *v) +{ + return SwigPyObject_format("%x",v); +} + +SWIGRUNTIME PyObject * +#ifdef METH_NOARGS +SwigPyObject_repr(SwigPyObject *v) +#else +SwigPyObject_repr(SwigPyObject *v, PyObject *args) +#endif +{ + const char *name = SWIG_TypePrettyName(v->ty); + PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v); + if (v->next) { +# ifdef METH_NOARGS + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); +# else + PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args); +# endif +# if PY_VERSION_HEX >= 0x03000000 + PyObject *joined = PyUnicode_Concat(repr, nrep); + Py_DecRef(repr); + Py_DecRef(nrep); + repr = joined; +# else + PyString_ConcatAndDel(&repr,nrep); +# endif + } + return repr; +} + +/* We need a version taking two PyObject* parameters so it's a valid + * PyCFunction to use in swigobject_methods[]. */ +SWIGRUNTIME PyObject * +SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) +{ + return SwigPyObject_repr((SwigPyObject*)v); +} + +SWIGRUNTIME int +SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) +{ + void *i = v->ptr; + void *j = w->ptr; + return (i < j) ? -1 : ((i > j) ? 1 : 0); +} + +/* Added for Python 3.x, would it also be useful for Python 2.x? */ +SWIGRUNTIME PyObject* +SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) +{ + PyObject* res; + if( op != Py_EQ && op != Py_NE ) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); + return res; +} + + +SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); + +#ifdef SWIGPYTHON_BUILTIN +static swig_type_info *SwigPyObject_stype = 0; +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + SwigPyClientData *cd; + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + assert(cd); + assert(cd->pytype); + return cd->pytype; +} +#else +SWIGRUNTIME PyTypeObject* +SwigPyObject_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); + return type; +} +#endif + +SWIGRUNTIMEINLINE int +SwigPyObject_Check(PyObject *op) { +#ifdef SWIGPYTHON_BUILTIN + PyTypeObject *target_tp = SwigPyObject_type(); + if (PyType_IsSubtype(op->ob_type, target_tp)) + return 1; + return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); +#else + return (Py_TYPE(op) == SwigPyObject_type()) + || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); +#endif +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own); + +SWIGRUNTIME void +SwigPyObject_dealloc(PyObject *v) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + PyObject *next = sobj->next; + if (sobj->own == SWIG_POINTER_OWN) { + swig_type_info *ty = sobj->ty; + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + PyObject *destroy = data ? data->destroy : 0; + if (destroy) { + /* destroy is always a VARARGS method */ + PyObject *res; + + /* PyObject_CallFunction() has the potential to silently drop + the active active exception. In cases of unnamed temporary + variable or where we just finished iterating over a generator + StopIteration will be active right now, and this needs to + remain true upon return from SwigPyObject_dealloc. So save + and restore. */ + + PyObject *val = NULL, *type = NULL, *tb = NULL; + PyErr_Fetch(&val, &type, &tb); + + if (data->delargs) { + /* we need to create a temporary object to carry the destroy operation */ + PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); + } else { + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); + } + if (!res) + PyErr_WriteUnraisable(destroy); + + PyErr_Restore(val, type, tb); + + Py_XDECREF(res); + } +#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); + } +#endif + } + Py_XDECREF(next); + PyObject_DEL(v); +} + +SWIGRUNTIME PyObject* +SwigPyObject_append(PyObject* v, PyObject* next) +{ + SwigPyObject *sobj = (SwigPyObject *) v; +#ifndef METH_O + PyObject *tmp = 0; + if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; + next = tmp; +#endif + if (!SwigPyObject_Check(next)) { + PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); + return NULL; + } + sobj->next = next; + Py_INCREF(next); + return SWIG_Py_Void(); +} + +SWIGRUNTIME PyObject* +SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *) v; + if (sobj->next) { + Py_INCREF(sobj->next); + return sobj->next; + } else { + return SWIG_Py_Void(); + } +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_disown(PyObject *v) +#else +SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = 0; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +SwigPyObject_acquire(PyObject *v) +#else +SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + SwigPyObject *sobj = (SwigPyObject *)v; + sobj->own = SWIG_POINTER_OWN; + return SWIG_Py_Void(); +} + +#ifdef METH_NOARGS +static PyObject* +SwigPyObject_disown2(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +{ + return SwigPyObject_disown(v); +} + +static PyObject* +SwigPyObject_acquire2(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +{ + return SwigPyObject_acquire(v); +} +#endif + +SWIGINTERN PyObject* +SwigPyObject_own(PyObject *v, PyObject *args) +{ + PyObject *val = 0; +#if (PY_VERSION_HEX < 0x02020000) + if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) +#elif (PY_VERSION_HEX < 0x02050000) + if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) +#else + if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) +#endif + { + return NULL; + } + else + { + SwigPyObject *sobj = (SwigPyObject *)v; + PyObject *obj = PyBool_FromLong(sobj->own); + if (val) { +#ifdef METH_NOARGS + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v); + } else { + SwigPyObject_disown(v); + } +#else + if (PyObject_IsTrue(val)) { + SwigPyObject_acquire(v,args); + } else { + SwigPyObject_disown(v,args); + } +#endif + } + return obj; + } +} + +#ifdef METH_O +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown2, METH_NOARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire2,METH_NOARGS, (char *)"acquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr2, METH_NOARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#else +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"acquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#endif + +#if PY_VERSION_HEX < 0x02020000 +SWIGINTERN PyObject * +SwigPyObject_getattr(SwigPyObject *sobj,char *name) +{ + return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); +} +#endif + +SWIGRUNTIME PyTypeObject* +SwigPyObject_TypeOnce(void) { + static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + + static PyNumberMethods SwigPyObject_as_number = { + (binaryfunc)0, /*nb_add*/ + (binaryfunc)0, /*nb_subtract*/ + (binaryfunc)0, /*nb_multiply*/ + /* nb_divide removed in Python 3 */ +#if PY_VERSION_HEX < 0x03000000 + (binaryfunc)0, /*nb_divide*/ +#endif + (binaryfunc)0, /*nb_remainder*/ + (binaryfunc)0, /*nb_divmod*/ + (ternaryfunc)0,/*nb_power*/ + (unaryfunc)0, /*nb_negative*/ + (unaryfunc)0, /*nb_positive*/ + (unaryfunc)0, /*nb_absolute*/ + (inquiry)0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ +#if PY_VERSION_HEX < 0x03000000 + 0, /*nb_coerce*/ +#endif + (unaryfunc)SwigPyObject_long, /*nb_int*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_long, /*nb_long*/ +#else + 0, /*nb_reserved*/ +#endif + (unaryfunc)0, /*nb_float*/ +#if PY_VERSION_HEX < 0x03000000 + (unaryfunc)SwigPyObject_oct, /*nb_oct*/ + (unaryfunc)SwigPyObject_hex, /*nb_hex*/ +#endif +#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ +#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ +#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ +#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ +#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ + 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ +#endif + }; + + static PyTypeObject swigpyobject_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyObject", /* tp_name */ + sizeof(SwigPyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyObject_dealloc, /* tp_dealloc */ + 0, /* tp_print */ +#if PY_VERSION_HEX < 0x02020000 + (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ +#else + (getattrfunc)0, /* tp_getattr */ +#endif + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX >= 0x03000000 + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ +#else + (cmpfunc)SwigPyObject_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyObject_repr, /* tp_repr */ + &SwigPyObject_as_number, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigobject_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + swigobject_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + swigpyobject_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpyobject_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpyobject_type) < 0) + return NULL; +#endif + } + return &swigpyobject_type; +} + +SWIGRUNTIME PyObject * +SwigPyObject_New(void *ptr, swig_type_info *ty, int own) +{ + SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); + if (sobj) { + sobj->ptr = ptr; + sobj->ty = ty; + sobj->own = own; + sobj->next = 0; + } + return (PyObject *)sobj; +} + +/* ----------------------------------------------------------------------------- + * Implements a simple Swig Packed type, and use it instead of string + * ----------------------------------------------------------------------------- */ + +typedef struct { + PyObject_HEAD + void *pack; + swig_type_info *ty; + size_t size; +} SwigPyPacked; + +SWIGRUNTIME int +SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +{ + char result[SWIG_BUFFER_SIZE]; + fputs("<Swig Packed ", fp); + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + fputs("at ", fp); + fputs(result, fp); + } + fputs(v->ty->name,fp); + fputs(">", fp); + return 0; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_repr(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); + } else { + return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); + } +} + +SWIGRUNTIME PyObject * +SwigPyPacked_str(SwigPyPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ + return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); + } else { + return SWIG_Python_str_FromChar(v->ty->name); + } +} + +SWIGRUNTIME int +SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) +{ + size_t i = v->size; + size_t j = w->size; + int s = (i < j) ? -1 : ((i > j) ? 1 : 0); + return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); +} + +SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); + return type; +} + +SWIGRUNTIMEINLINE int +SwigPyPacked_Check(PyObject *op) { + return ((op)->ob_type == SwigPyPacked_TypeOnce()) + || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); +} + +SWIGRUNTIME void +SwigPyPacked_dealloc(PyObject *v) +{ + if (SwigPyPacked_Check(v)) { + SwigPyPacked *sobj = (SwigPyPacked *) v; + free(sobj->pack); + } + PyObject_DEL(v); +} + +SWIGRUNTIME PyTypeObject* +SwigPyPacked_TypeOnce(void) { + static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static PyTypeObject swigpypacked_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX>=0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"SwigPyPacked", /* tp_name */ + sizeof(SwigPyPacked), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ + (printfunc)SwigPyPacked_print, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ +#if PY_VERSION_HEX>=0x03000000 + 0, /* tp_reserved in 3.0.1 */ +#else + (cmpfunc)SwigPyPacked_compare, /* tp_compare */ +#endif + (reprfunc)SwigPyPacked_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)SwigPyPacked_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigpacked_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + swigpypacked_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpypacked_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpypacked_type) < 0) + return NULL; +#endif + } + return &swigpypacked_type; +} + +SWIGRUNTIME PyObject * +SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) +{ + SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); + if (sobj) { + void *pack = malloc(size); + if (pack) { + memcpy(pack, ptr, size); + sobj->pack = pack; + sobj->ty = ty; + sobj->size = size; + } else { + PyObject_DEL((PyObject *) sobj); + sobj = 0; + } + } + return (PyObject *) sobj; +} + +SWIGRUNTIME swig_type_info * +SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) +{ + if (SwigPyPacked_Check(obj)) { + SwigPyPacked *sobj = (SwigPyPacked *)obj; + if (sobj->size != size) return 0; + memcpy(ptr, sobj->pack, size); + return sobj->ty; + } else { + return 0; + } +} + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIMEINLINE PyObject * +_SWIG_This(void) +{ + return SWIG_Python_str_FromChar("this"); +} + +static PyObject *swig_this = NULL; + +SWIGRUNTIME PyObject * +SWIG_This(void) +{ + if (swig_this == NULL) + swig_this = _SWIG_This(); + return swig_this; +} + +/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ + +/* TODO: I don't know how to implement the fast getset in Python 3 right now */ +#if PY_VERSION_HEX>=0x03000000 +#define SWIG_PYTHON_SLOW_GETSET_THIS +#endif + +SWIGRUNTIME SwigPyObject * +SWIG_Python_GetSwigThis(PyObject *pyobj) +{ + PyObject *obj; + + if (SwigPyObject_Check(pyobj)) + return (SwigPyObject *) pyobj; + +#ifdef SWIGPYTHON_BUILTIN + (void)obj; +# ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + pyobj = PyWeakref_GET_OBJECT(pyobj); + if (pyobj && SwigPyObject_Check(pyobj)) + return (SwigPyObject*) pyobj; + } +# endif + return NULL; +#else + + obj = 0; + +#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) + if (PyInstance_Check(pyobj)) { + obj = _PyInstance_Lookup(pyobj, SWIG_This()); + } else { + PyObject **dictptr = _PyObject_GetDictPtr(pyobj); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; + } else { +#ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; + } +#endif + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } + } + } +#else + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } +#endif + if (obj && !SwigPyObject_Check(obj)) { + /* a PyObject is called 'this', try to get the 'real this' + SwigPyObject from it */ + return SWIG_Python_GetSwigThis(obj); + } + return (SwigPyObject *)obj; +#endif +} + +/* Acquire a pointer value */ + +SWIGRUNTIME int +SWIG_Python_AcquirePtr(PyObject *obj, int own) { + if (own == SWIG_POINTER_OWN) { + SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); + if (sobj) { + int oldown = sobj->own; + sobj->own = own; + return oldown; + } + } + return 0; +} + +/* Convert a pointer value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { + int res; + SwigPyObject *sobj; + int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; + + if (!obj) + return SWIG_ERROR; + if (obj == Py_None && !implicit_conv) { + if (ptr) + *ptr = 0; + return SWIG_OK; + } + + res = SWIG_ERROR; + + sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; + while (sobj) { + void *vptr = sobj->ptr; + if (ty) { + swig_type_info *to = sobj->ty; + if (to == ty) { + /* no type cast needed */ + if (ptr) *ptr = vptr; + break; + } else { + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) { + sobj = (SwigPyObject *)sobj->next; + } else { + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } + break; + } + } + } else { + if (ptr) *ptr = vptr; + break; + } + } + if (sobj) { + if (own) + *own = *own | sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + res = SWIG_OK; + } else { + if (implicit_conv) { + SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; + if (data && !data->implicitconv) { + PyObject *klass = data->klass; + if (klass) { + PyObject *impconv; + data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ + impconv = SWIG_Python_CallFunctor(klass, obj); + data->implicitconv = 0; + if (PyErr_Occurred()) { + PyErr_Clear(); + impconv = 0; + } + if (impconv) { + SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { + void *vptr; + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); + if (SWIG_IsOK(res)) { + if (ptr) { + *ptr = vptr; + /* transfer the ownership to 'ptr' */ + iobj->own = 0; + res = SWIG_AddCast(res); + res = SWIG_AddNewMask(res); + } else { + res = SWIG_AddCast(res); + } + } + } + Py_DECREF(impconv); + } + } + } + } + if (!SWIG_IsOK(res) && obj == Py_None) { + if (ptr) + *ptr = 0; + if (PyErr_Occurred()) + PyErr_Clear(); + res = SWIG_OK; + } + } + return res; +} + +/* Convert a function ptr value */ + +SWIGRUNTIME int +SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { + if (!PyCFunction_Check(obj)) { + return SWIG_ConvertPtr(obj, ptr, ty, 0); + } else { + void *vptr = 0; + + /* here we get the method pointer for callbacks */ + const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); + const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; + if (desc) + desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; + if (!desc) + return SWIG_ERROR; + if (ty) { + swig_cast_info *tc = SWIG_TypeCheck(desc,ty); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } + } else { + *ptr = vptr; + } + return SWIG_OK; + } +} + +/* Convert a packed value value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +/* ----------------------------------------------------------------------------- + * Create a new pointer object + * ----------------------------------------------------------------------------- */ + +/* + Create a new instance object, without calling __init__, and set the + 'this' attribute. +*/ + +SWIGRUNTIME PyObject* +SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) +{ +#if (PY_VERSION_HEX >= 0x02020000) + PyObject *inst = 0; + PyObject *newraw = data->newraw; + if (newraw) { + inst = PyObject_Call(newraw, data->newargs, NULL); + if (inst) { +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + PyDict_SetItem(dict, SWIG_This(), swig_this); + } + } +#else + PyObject *key = SWIG_This(); + PyObject_SetAttr(inst, key, swig_this); +#endif + } + } else { +#if PY_VERSION_HEX >= 0x03000000 + inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); + if (inst) { + PyObject_SetAttr(inst, SWIG_This(), swig_this); + Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; + } +#else + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } +#endif + } + return inst; +#else +#if (PY_VERSION_HEX >= 0x02010000) + PyObject *inst = 0; + PyObject *dict = PyDict_New(); + if (dict) { + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } + return (PyObject *) inst; +#else + PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); + if (inst == NULL) { + return NULL; + } + inst->in_class = (PyClassObject *)data->newargs; + Py_INCREF(inst->in_class); + inst->in_dict = PyDict_New(); + if (inst->in_dict == NULL) { + Py_DECREF(inst); + return NULL; + } +#ifdef Py_TPFLAGS_HAVE_WEAKREFS + inst->in_weakreflist = NULL; +#endif +#ifdef Py_TPFLAGS_GC + PyObject_GC_Init(inst); +#endif + PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); + return (PyObject *) inst; +#endif +#endif +} + +SWIGRUNTIME void +SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) +{ + PyObject *dict; +#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + PyDict_SetItem(dict, SWIG_This(), swig_this); + return; + } +#endif + dict = PyObject_GetAttrString(inst, (char*)"__dict__"); + PyDict_SetItem(dict, SWIG_This(), swig_this); + Py_DECREF(dict); +} + + +SWIGINTERN PyObject * +SWIG_Python_InitShadowInstance(PyObject *args) { + PyObject *obj[2]; + if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { + return NULL; + } else { + SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); + if (sthis) { + SwigPyObject_append((PyObject*) sthis, obj[1]); + } else { + SWIG_Python_SetSwigThis(obj[0], obj[1]); + } + return SWIG_Py_Void(); + } +} + +/* Create a new pointer object */ + +SWIGRUNTIME PyObject * +SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { + SwigPyClientData *clientdata; + PyObject * robj; + int own; + + if (!ptr) + return SWIG_Py_Void(); + + clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; + own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + if (clientdata && clientdata->pytype) { + SwigPyObject *newobj; + if (flags & SWIG_BUILTIN_TP_INIT) { + newobj = (SwigPyObject*) self; + if (newobj->ptr) { + PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); + while (newobj->next) + newobj = (SwigPyObject *) newobj->next; + newobj->next = next_self; + newobj = (SwigPyObject *)next_self; +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif + } + } else { + newobj = PyObject_New(SwigPyObject, clientdata->pytype); +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif + } + if (newobj) { + newobj->ptr = ptr; + newobj->ty = type; + newobj->own = own; + newobj->next = 0; + return (PyObject*) newobj; + } + return SWIG_Py_Void(); + } + + assert(!(flags & SWIG_BUILTIN_TP_INIT)); + + robj = SwigPyObject_New(ptr, type, own); + if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { + PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); + Py_DECREF(robj); + robj = inst; + } + return robj; +} + +/* Create a new packed object */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { + return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); +} + +/* -----------------------------------------------------------------------------* + * Get type list + * -----------------------------------------------------------------------------*/ + +#ifdef SWIG_LINK_RUNTIME +void *SWIG_ReturnGlobalTypeList(void *); +#endif + +SWIGRUNTIME swig_module_info * +SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { + static void *type_pointer = (void *)0; + /* first check if module already created */ + if (!type_pointer) { +#ifdef SWIG_LINK_RUNTIME + type_pointer = SWIG_ReturnGlobalTypeList((void *)0); +#else +# ifdef SWIGPY_USE_CAPSULE + type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); +# else + type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, + (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); +# endif + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif + } + return (swig_module_info *) type_pointer; +} + +#if PY_MAJOR_VERSION < 2 +/* PyModule_AddObject function was introduced in Python 2.0. The following function + is copied out of Python/modsupport.c in python version 2.3.4 */ +SWIGINTERN int +PyModule_AddObject(PyObject *m, char *name, PyObject *o) +{ + PyObject *dict; + if (!PyModule_Check(m)) { + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); + return SWIG_ERROR; + } + if (!o) { + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); + return SWIG_ERROR; + } + + dict = PyModule_GetDict(m); + if (dict == NULL) { + /* Internal error -- modules must have a dict! */ + PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", + PyModule_GetName(m)); + return SWIG_ERROR; + } + if (PyDict_SetItemString(dict, name, o)) + return SWIG_ERROR; + Py_DECREF(o); + return SWIG_OK; +} +#endif + +SWIGRUNTIME void +#ifdef SWIGPY_USE_CAPSULE +SWIG_Python_DestroyModule(PyObject *obj) +#else +SWIG_Python_DestroyModule(void *vptr) +#endif +{ +#ifdef SWIGPY_USE_CAPSULE + swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); +#else + swig_module_info *swig_module = (swig_module_info *) vptr; +#endif + swig_type_info **types = swig_module->types; + size_t i; + for (i =0; i < swig_module->size; ++i) { + swig_type_info *ty = types[i]; + if (ty->owndata) { + SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; + if (data) SwigPyClientData_Del(data); + } + } + Py_DECREF(SWIG_This()); + swig_this = NULL; +} + +SWIGRUNTIME void +SWIG_Python_SetModule(swig_module_info *swig_module) { +#if PY_VERSION_HEX >= 0x03000000 + /* Add a dummy module object into sys.modules */ + PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); +#else + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ + PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); +#endif +#ifdef SWIGPY_USE_CAPSULE + PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +#else + PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +#endif +} + +/* The python cached type query */ +SWIGRUNTIME PyObject * +SWIG_Python_TypeCache(void) { + static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); + return cache; +} + +SWIGRUNTIME swig_type_info * +SWIG_Python_TypeQuery(const char *type) +{ + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *key = SWIG_Python_str_FromChar(type); + PyObject *obj = PyDict_GetItem(cache, key); + swig_type_info *descriptor; + if (obj) { +#ifdef SWIGPY_USE_CAPSULE + descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); +#else + descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); +#endif + } else { + swig_module_info *swig_module = SWIG_GetModule(0); + descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); + if (descriptor) { +#ifdef SWIGPY_USE_CAPSULE + obj = PyCapsule_New((void*) descriptor, NULL, NULL); +#else + obj = PyCObject_FromVoidPtr(descriptor, NULL); +#endif + PyDict_SetItem(cache, key, obj); + Py_DECREF(obj); + } + } + Py_DECREF(key); + return descriptor; +} + +/* + For backward compatibility only +*/ +#define SWIG_POINTER_EXCEPTION 0 +#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) +#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) + +SWIGRUNTIME int +SWIG_Python_AddErrMesg(const char* mesg, int infront) +{ + if (PyErr_Occurred()) { + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + PyErr_Fetch(&type, &value, &traceback); + if (value) { + char *tmp; + PyObject *old_str = PyObject_Str(value); + Py_XINCREF(type); + PyErr_Clear(); + if (infront) { + PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str)); + } else { + PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg); + } + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(old_str); + } + return 1; + } else { + return 0; + } +} + +SWIGRUNTIME int +SWIG_Python_ArgFail(int argnum) +{ + if (PyErr_Occurred()) { + /* add information about failing argument */ + char mesg[256]; + PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); + return SWIG_Python_AddErrMesg(mesg, 1); + } else { + return 0; + } +} + +SWIGRUNTIMEINLINE const char * +SwigPyObject_GetDesc(PyObject *self) +{ + SwigPyObject *v = (SwigPyObject *)self; + swig_type_info *ty = v ? v->ty : 0; + return ty ? ty->str : ""; +} + +SWIGRUNTIME void +SWIG_Python_TypeError(const char *type, PyObject *obj) +{ + if (type) { +#if defined(SWIG_COBJECT_TYPES) + if (obj && SwigPyObject_Check(obj)) { + const char *otype = (const char *) SwigPyObject_GetDesc(obj); + if (otype) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", + type, otype); + return; + } + } else +#endif + { + const char *otype = (obj ? obj->ob_type->tp_name : 0); + if (otype) { + PyObject *str = PyObject_Str(obj); + const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; + if (cstr) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", + type, otype, cstr); + SWIG_Python_str_DelForPy3(cstr); + } else { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", + type, otype); + } + Py_XDECREF(str); + return; + } + } + PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); + } else { + PyErr_Format(PyExc_TypeError, "unexpected type is received"); + } +} + + +/* Convert a pointer value, signal an exception on a type mismatch */ +SWIGRUNTIME void * +SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { + void *result; + if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { + PyErr_Clear(); +#if SWIG_POINTER_EXCEPTION + if (flags) { + SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + SWIG_Python_ArgFail(argnum); + } +#endif + } + return result; +} + +#ifdef SWIGPYTHON_BUILTIN +SWIGRUNTIME int +SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { + PyTypeObject *tp = obj->ob_type; + PyObject *descr; + PyObject *encoded_name; + descrsetfunc f; + int res = -1; + +# ifdef Py_USING_UNICODE + if (PyString_Check(name)) { + name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); + if (!name) + return -1; + } else if (!PyUnicode_Check(name)) +# else + if (!PyString_Check(name)) +# endif + { + PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); + return -1; + } else { + Py_INCREF(name); + } + + if (!tp->tp_dict) { + if (PyType_Ready(tp) < 0) + goto done; + } + + descr = _PyType_Lookup(tp, name); + f = NULL; + if (descr != NULL) + f = descr->ob_type->tp_descr_set; + if (!f) { + if (PyString_Check(name)) { + encoded_name = name; + Py_INCREF(name); + } else { + encoded_name = PyUnicode_AsUTF8String(name); + } + PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); + Py_DECREF(encoded_name); + } else { + res = f(descr, obj, value); + } + + done: + Py_DECREF(name); + return res; +} +#endif + + +#ifdef __cplusplus +} +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_API swig_types[0] +#define SWIGTYPE_p_CoreSession swig_types[1] +#define SWIGTYPE_p_DTMF swig_types[2] +#define SWIGTYPE_p_Event swig_types[3] +#define SWIGTYPE_p_EventConsumer swig_types[4] +#define SWIGTYPE_p_IVRMenu swig_types[5] +#define SWIGTYPE_p_PYTHON__Session swig_types[6] +#define SWIGTYPE_p_Stream swig_types[7] +#define SWIGTYPE_p_char swig_types[8] +#define SWIGTYPE_p_input_callback_state swig_types[9] +#define SWIGTYPE_p_int swig_types[10] +#define SWIGTYPE_p_p_switch_event_node_t swig_types[11] +#define SWIGTYPE_p_session_flag_t swig_types[12] +#define SWIGTYPE_p_switch_call_cause_t swig_types[13] +#define SWIGTYPE_p_switch_channel_state_t swig_types[14] +#define SWIGTYPE_p_switch_channel_t swig_types[15] +#define SWIGTYPE_p_switch_core_session_t swig_types[16] +#define SWIGTYPE_p_switch_event_t swig_types[17] +#define SWIGTYPE_p_switch_event_types_t swig_types[18] +#define SWIGTYPE_p_switch_input_args_t swig_types[19] +#define SWIGTYPE_p_switch_input_type_t swig_types[20] +#define SWIGTYPE_p_switch_priority_t swig_types[21] +#define SWIGTYPE_p_switch_queue_t swig_types[22] +#define SWIGTYPE_p_switch_state_handler_table_t swig_types[23] +#define SWIGTYPE_p_switch_status_t swig_types[24] +#define SWIGTYPE_p_switch_stream_handle_t swig_types[25] +#define SWIGTYPE_p_uint32_t swig_types[26] +#define SWIGTYPE_p_void swig_types[27] +static swig_type_info *swig_types[29]; +static swig_module_info swig_module = {swig_types, 28, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#if (PY_VERSION_HEX <= 0x02000000) +# if !defined(SWIG_PYTHON_CLASSIC) +# error "This python version requires swig to be run with the '-classic' option" +# endif +#endif + +/*----------------------------------------------- + @(target):= _freeswitch.so + ------------------------------------------------*/ +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_init PyInit__freeswitch + +#else +# define SWIG_init init_freeswitch + +#endif +#define SWIG_name "_freeswitch" + +#define SWIGVERSION 0x030012 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include <stdexcept> + + +namespace swig { + class SwigPtr_PyObject { + protected: + PyObject *_obj; + + public: + SwigPtr_PyObject() :_obj(0) + { + } + + SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + + SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) + { + if (initial_ref) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + } + + SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XINCREF(item._obj); + Py_XDECREF(_obj); + _obj = item._obj; + SWIG_PYTHON_THREAD_END_BLOCK; + return *this; + } + + ~SwigPtr_PyObject() + { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_XDECREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; + } + + operator PyObject *() const + { + return _obj; + } + + PyObject *operator->() const + { + return _obj; + } + }; +} + + +namespace swig { + struct SwigVar_PyObject : SwigPtr_PyObject { + SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } + + SwigVar_PyObject & operator = (PyObject* obj) + { + Py_XDECREF(_obj); + _obj = obj; + return *this; + } + }; +} + + +#include "switch_cpp.h" +#include "freeswitch_python.h" + + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +{ +#if PY_VERSION_HEX>=0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + if (PyBytes_Check(obj)) +#else + if (PyUnicode_Check(obj)) +#endif +#else + if (PyString_Check(obj)) +#endif + { + char *cstr; Py_ssize_t len; +#if PY_VERSION_HEX>=0x03000000 +#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + if (!alloc && cptr) { + /* We can't allow converting without allocation, since the internal + representation of string in Python 3 is UCS-2/UCS-4 but we require + a UTF-8 representation. + TODO(bhy) More detailed explanation */ + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + if(alloc) *alloc = SWIG_NEWOBJ; +#endif + PyBytes_AsStringAndSize(obj, &cstr, &len); +#else + PyString_AsStringAndSize(obj, &cstr, &len); +#endif + if (cptr) { + if (alloc) { + /* + In python the user should not be able to modify the inner + string representation. To warranty that, if you define + SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string + buffer is always returned. + + The default behavior is just to return the pointer value, + so, be careful. + */ +#if defined(SWIG_PYTHON_SAFE_CSTRINGS) + if (*alloc != SWIG_OLDOBJ) +#else + if (*alloc == SWIG_NEWOBJ) +#endif + { + *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); + *alloc = SWIG_NEWOBJ; + } else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } else { +#if PY_VERSION_HEX>=0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + *cptr = PyBytes_AsString(obj); +#else + assert(0); /* Should never reach here with Unicode strings in Python 3 */ +#endif +#else + *cptr = SWIG_Python_str_AsChar(obj); +#endif + } + } + if (psize) *psize = len + 1; +#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + Py_XDECREF(obj); +#endif + return SWIG_OK; + } else { +#if defined(SWIG_PYTHON_2_UNICODE) +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" +#endif +#if PY_VERSION_HEX<0x03000000 + if (PyUnicode_Check(obj)) { + char *cstr; Py_ssize_t len; + if (!alloc && cptr) { + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { + if (cptr) { + if (alloc) *alloc = SWIG_NEWOBJ; + *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); + } + if (psize) *psize = len + 1; + + Py_XDECREF(obj); + return SWIG_OK; + } else { + Py_XDECREF(obj); + } + } +#endif +#endif + + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + + + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + return pchar_descriptor ? + SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); + } else { +#if PY_VERSION_HEX >= 0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); +#else +#if PY_VERSION_HEX >= 0x03010000 + return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape"); +#else + return PyUnicode_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); +#endif +#endif +#else + return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); +#endif + } + } else { + return SWIG_Py_Void(); + } +} + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + + +#include <limits.h> +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +SWIGINTERN int +SWIG_AsVal_double (PyObject *obj, double *val) +{ + int res = SWIG_TypeError; + if (PyFloat_Check(obj)) { + if (val) *val = PyFloat_AsDouble(obj); + return SWIG_OK; +#if PY_VERSION_HEX < 0x03000000 + } else if (PyInt_Check(obj)) { + if (val) *val = (double) PyInt_AsLong(obj); + return SWIG_OK; +#endif + } else if (PyLong_Check(obj)) { + double v = PyLong_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + double d = PyFloat_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = d; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); + } else { + PyErr_Clear(); + } + } + } +#endif + return res; +} + + +#include <float.h> + + +#include <math.h> + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_long (PyObject *obj, long* val) +{ +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else +#endif + if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + return SWIG_OverflowError; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_int (PyObject * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_bool (bool value) +{ + return PyBool_FromLong(value ? 1 : 0); +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_int (int value) +{ + return PyInt_FromLong((long) value); +} + + +SWIGINTERN int +SWIG_AsCharArray(PyObject * obj, char *val, size_t size) +{ + char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; + int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); + if (SWIG_IsOK(res)) { + /* special case of single char conversion when we don't need space for NUL */ + if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; + if (csize <= size) { + if (val) { + if (csize) memcpy(val, cptr, csize*sizeof(char)); +#ifndef __clang_analyzer__ + if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); +#endif + } + if (alloc == SWIG_NEWOBJ) { + delete[] cptr; + res = SWIG_DelNewMask(res); + } + return res; + } + if (alloc == SWIG_NEWOBJ) delete[] cptr; + } + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_char (PyObject * obj, char *val) +{ + int res = SWIG_AsCharArray(obj, val, 1); + if (!SWIG_IsOK(res)) { + long v; + res = SWIG_AddCast(SWIG_AsVal_long (obj, &v)); + if (SWIG_IsOK(res)) { + if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) { + if (val) *val = static_cast< char >(v); + } else { + res = SWIG_OverflowError; + } + } + } + return res; +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_char (char c) +{ + return SWIG_FromCharPtrAndSize(&c,1); +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) +{ +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) { + long v = PyInt_AsLong(obj); + if (v >= 0) { + if (val) *val = v; + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else +#endif + if (PyLong_Check(obj)) { + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + return SWIG_OverflowError; + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { + if (val) *val = (unsigned long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v > UINT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< unsigned int >(v); + } + } + return res; +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_unsigned_SS_int (unsigned int value) +{ + return PyInt_FromSize_t((size_t) value); +} + + +SWIGINTERN int +SWIG_AsVal_bool (PyObject *obj, bool *val) +{ + int r; + if (!PyBool_Check(obj)) + return SWIG_ERROR; + r = PyObject_IsTrue(obj); + if (r == -1) + return SWIG_ERROR; + if (val) *val = r ? true : false; + return SWIG_OK; +} + +#ifdef __cplusplus +extern "C" { +#endif +SWIGINTERN PyObject *_wrap_setGlobalVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:setGlobalVariable",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setGlobalVariable" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "setGlobalVariable" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + setGlobalVariable(arg1,arg2); + resultobj = SWIG_Py_Void(); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_getGlobalVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:getGlobalVariable",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getGlobalVariable" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + result = (char *)getGlobalVariable(arg1); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + free(result); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_consoleLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:consoleLog",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + consoleLog(arg1,arg2); + resultobj = SWIG_Py_Void(); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_consoleLog2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + char *arg5 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int res5 ; + char *buf5 = 0 ; + int alloc5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOO:consoleLog2",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog2" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog2" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "consoleLog2" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "consoleLog2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "consoleLog2" "', argument " "5"" of type '" "char *""'"); + } + arg5 = reinterpret_cast< char * >(buf5); + consoleLog2(arg1,arg2,arg3,arg4,arg5); + resultobj = SWIG_Py_Void(); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_consoleCleanLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:consoleCleanLog",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + consoleCleanLog(arg1); + resultobj = SWIG_Py_Void(); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_running(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + bool result; + + if (!PyArg_ParseTuple(args,(char *)":running")) SWIG_fail; + result = (bool)running(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_email(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + char *arg5 = (char *) NULL ; + char *arg6 = (char *) NULL ; + char *arg7 = (char *) NULL ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int res5 ; + char *buf5 = 0 ; + int alloc5 = 0 ; + int res6 ; + char *buf6 = 0 ; + int alloc6 = 0 ; + int res7 ; + char *buf7 = 0 ; + int alloc7 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OO|OOOOO:email",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "email" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "email" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "email" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "email" "', argument " "4"" of type '" "char *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + if (obj4) { + res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "email" "', argument " "5"" of type '" "char *""'"); + } + arg5 = reinterpret_cast< char * >(buf5); + } + if (obj5) { + res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "email" "', argument " "6"" of type '" "char *""'"); + } + arg6 = reinterpret_cast< char * >(buf6); + } + if (obj6) { + res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7); + if (!SWIG_IsOK(res7)) { + SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "email" "', argument " "7"" of type '" "char *""'"); + } + arg7 = reinterpret_cast< char * >(buf7); + } + result = (bool)email(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + if (alloc7 == SWIG_NEWOBJ) delete[] buf7; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + if (alloc7 == SWIG_NEWOBJ) delete[] buf7; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IVRMenu *arg1 = (IVRMenu *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + char *arg5 = (char *) 0 ; + char *arg6 = (char *) 0 ; + char *arg7 = (char *) 0 ; + char *arg8 = (char *) 0 ; + char *arg9 = (char *) 0 ; + char *arg10 = (char *) 0 ; + char *arg11 = (char *) 0 ; + int arg12 ; + int arg13 ; + int arg14 ; + int arg15 ; + int arg16 ; + int arg17 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int res5 ; + char *buf5 = 0 ; + int alloc5 = 0 ; + int res6 ; + char *buf6 = 0 ; + int alloc6 = 0 ; + int res7 ; + char *buf7 = 0 ; + int alloc7 = 0 ; + int res8 ; + char *buf8 = 0 ; + int alloc8 = 0 ; + int res9 ; + char *buf9 = 0 ; + int alloc9 = 0 ; + int res10 ; + char *buf10 = 0 ; + int alloc10 = 0 ; + int res11 ; + char *buf11 = 0 ; + int alloc11 = 0 ; + int val12 ; + int ecode12 = 0 ; + int val13 ; + int ecode13 = 0 ; + int val14 ; + int ecode14 = 0 ; + int val15 ; + int ecode15 = 0 ; + int val16 ; + int ecode16 = 0 ; + int val17 ; + int ecode17 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + PyObject * obj12 = 0 ; + PyObject * obj13 = 0 ; + PyObject * obj14 = 0 ; + PyObject * obj15 = 0 ; + PyObject * obj16 = 0 ; + IVRMenu *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13,&obj14,&obj15,&obj16)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); + } + arg1 = reinterpret_cast< IVRMenu * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'"); + } + arg5 = reinterpret_cast< char * >(buf5); + res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'"); + } + arg6 = reinterpret_cast< char * >(buf6); + res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7); + if (!SWIG_IsOK(res7)) { + SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'"); + } + arg7 = reinterpret_cast< char * >(buf7); + res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8); + if (!SWIG_IsOK(res8)) { + SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'"); + } + arg8 = reinterpret_cast< char * >(buf8); + res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9); + if (!SWIG_IsOK(res9)) { + SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "char const *""'"); + } + arg9 = reinterpret_cast< char * >(buf9); + res10 = SWIG_AsCharPtrAndSize(obj9, &buf10, NULL, &alloc10); + if (!SWIG_IsOK(res10)) { + SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "char const *""'"); + } + arg10 = reinterpret_cast< char * >(buf10); + res11 = SWIG_AsCharPtrAndSize(obj10, &buf11, NULL, &alloc11); + if (!SWIG_IsOK(res11)) { + SWIG_exception_fail(SWIG_ArgError(res11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "char const *""'"); + } + arg11 = reinterpret_cast< char * >(buf11); + ecode12 = SWIG_AsVal_int(obj11, &val12); + if (!SWIG_IsOK(ecode12)) { + SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'"); + } + arg12 = static_cast< int >(val12); + ecode13 = SWIG_AsVal_int(obj12, &val13); + if (!SWIG_IsOK(ecode13)) { + SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'"); + } + arg13 = static_cast< int >(val13); + ecode14 = SWIG_AsVal_int(obj13, &val14); + if (!SWIG_IsOK(ecode14)) { + SWIG_exception_fail(SWIG_ArgError(ecode14), "in method '" "new_IVRMenu" "', argument " "14"" of type '" "int""'"); + } + arg14 = static_cast< int >(val14); + ecode15 = SWIG_AsVal_int(obj14, &val15); + if (!SWIG_IsOK(ecode15)) { + SWIG_exception_fail(SWIG_ArgError(ecode15), "in method '" "new_IVRMenu" "', argument " "15"" of type '" "int""'"); + } + arg15 = static_cast< int >(val15); + ecode16 = SWIG_AsVal_int(obj15, &val16); + if (!SWIG_IsOK(ecode16)) { + SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "new_IVRMenu" "', argument " "16"" of type '" "int""'"); + } + arg16 = static_cast< int >(val16); + ecode17 = SWIG_AsVal_int(obj16, &val17); + if (!SWIG_IsOK(ecode17)) { + SWIG_exception_fail(SWIG_ArgError(ecode17), "in method '" "new_IVRMenu" "', argument " "17"" of type '" "int""'"); + } + arg17 = static_cast< int >(val17); + result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + if (alloc7 == SWIG_NEWOBJ) delete[] buf7; + if (alloc8 == SWIG_NEWOBJ) delete[] buf8; + if (alloc9 == SWIG_NEWOBJ) delete[] buf9; + if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + if (alloc11 == SWIG_NEWOBJ) delete[] buf11; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + if (alloc7 == SWIG_NEWOBJ) delete[] buf7; + if (alloc8 == SWIG_NEWOBJ) delete[] buf8; + if (alloc9 == SWIG_NEWOBJ) delete[] buf9; + if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + if (alloc11 == SWIG_NEWOBJ) delete[] buf11; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IVRMenu *arg1 = (IVRMenu *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_IVRMenu",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); + } + arg1 = reinterpret_cast< IVRMenu * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IVRMenu_bindAction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IVRMenu *arg1 = (IVRMenu *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:IVRMenu_bindAction",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'"); + } + arg1 = reinterpret_cast< IVRMenu * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_IVRMenu_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + IVRMenu *arg1 = (IVRMenu *) 0 ; + CoreSession *arg2 = (CoreSession *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:IVRMenu_execute",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'"); + } + arg1 = reinterpret_cast< IVRMenu * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'"); + } + arg2 = reinterpret_cast< CoreSession * >(argp2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + (arg1)->execute(arg2,(char const *)arg3); + resultobj = SWIG_Py_Void(); + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *IVRMenu_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_IVRMenu, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_new_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + API *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"|O:new_API",&obj0)) SWIG_fail; + if (obj0) { + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_API" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + } + result = (API *)new API(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + API *arg1 = (API *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_API",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'"); + } + arg1 = reinterpret_cast< API * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_API_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + API *arg1 = (API *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:API_execute",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1"" of type '" "API *""'"); + } + arg1 = reinterpret_cast< API * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + free(result); + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_API_executeString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + API *arg1 = (API *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:API_executeString",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1"" of type '" "API *""'"); + } + arg1 = reinterpret_cast< API * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (char *)(arg1)->executeString((char const *)arg2); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + free(result); + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_API_getTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + API *arg1 = (API *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:API_getTime",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_getTime" "', argument " "1"" of type '" "API *""'"); + } + arg1 = reinterpret_cast< API * >(argp1); + result = (char *)(arg1)->getTime(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + void *arg2 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_function_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_set" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2"" of type '" "void *""'"); + } + if (arg1) (arg1)->function = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_input_callback_state_t_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + void *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_function_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_get" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + result = (void *) ((arg1)->function); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + void *arg2 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_threadState_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_set" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2"" of type '" "void *""'"); + } + if (arg1) (arg1)->threadState = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + void *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_threadState_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_get" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + result = (void *) ((arg1)->threadState); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + void *arg2 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_extra_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_set" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2"" of type '" "void *""'"); + } + if (arg1) (arg1)->extra = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + void *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_extra_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_get" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + result = (void *) ((arg1)->extra); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_funcargs_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_set" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->funcargs) delete[] arg1->funcargs; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->funcargs = (char *)reinterpret_cast< char* >(memcpy(new char[size], reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->funcargs = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_funcargs_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_get" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + result = (char *) ((arg1)->funcargs); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_input_callback_state_t")) SWIG_fail; + result = (input_callback_state *)new input_callback_state(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + input_callback_state *arg1 = (input_callback_state *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_input_callback_state_t",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state_t" "', argument " "1"" of type '" "input_callback_state *""'"); + } + arg1 = reinterpret_cast< input_callback_state * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_DTMF_digit_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DTMF *arg1 = (DTMF *) 0 ; + char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + char val2 = '\0'; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DTMF_digit_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_set" "', argument " "1"" of type '" "DTMF *""'"); + } + arg1 = reinterpret_cast< DTMF * >(argp1); + ecode2 = SWIG_AsVal_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DTMF_digit_set" "', argument " "2"" of type '" "char""'"); + } + arg2 = static_cast< char >(val2); + if (arg1) (arg1)->digit = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DTMF_digit_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DTMF *arg1 = (DTMF *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char result; + + if (!PyArg_ParseTuple(args,(char *)"O:DTMF_digit_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_get" "', argument " "1"" of type '" "DTMF *""'"); + } + arg1 = reinterpret_cast< DTMF * >(argp1); + result = (char) ((arg1)->digit); + resultobj = SWIG_From_char(static_cast< char >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DTMF_duration_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DTMF *arg1 = (DTMF *) 0 ; + uint32_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DTMF_duration_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_set" "', argument " "1"" of type '" "DTMF *""'"); + } + arg1 = reinterpret_cast< DTMF * >(argp1); + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_uint32_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'"); + } else { + uint32_t * temp = reinterpret_cast< uint32_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + if (arg1) (arg1)->duration = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DTMF_duration_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DTMF *arg1 = (DTMF *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + uint32_t result; + + if (!PyArg_ParseTuple(args,(char *)"O:DTMF_duration_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_get" "', argument " "1"" of type '" "DTMF *""'"); + } + arg1 = reinterpret_cast< DTMF * >(argp1); + result = ((arg1)->duration); + resultobj = SWIG_NewPointerObj((new uint32_t(static_cast< const uint32_t& >(result))), SWIGTYPE_p_uint32_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DTMF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char arg1 ; + uint32_t arg2 = (uint32_t) SWITCH_DEFAULT_DTMF_DURATION ; + char val1 = '\0'; + int ecode1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + DTMF *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|O:new_DTMF",&obj0,&obj1)) SWIG_fail; + ecode1 = SWIG_AsVal_char(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'"); + } + arg1 = static_cast< char >(val1); + if (obj1) { + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_uint32_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'"); + } else { + uint32_t * temp = reinterpret_cast< uint32_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + } + result = (DTMF *)new DTMF(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_DTMF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DTMF *arg1 = (DTMF *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_DTMF",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DTMF" "', argument " "1"" of type '" "DTMF *""'"); + } + arg1 = reinterpret_cast< DTMF * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *DTMF_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_DTMF, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_new_Stream__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Stream *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_Stream")) SWIG_fail; + result = (Stream *)new Stream(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Stream__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + Stream *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_Stream",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_stream_handle_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1"" of type '" "switch_stream_handle_t *""'"); + } + arg1 = reinterpret_cast< switch_stream_handle_t * >(argp1); + result = (Stream *)new Stream(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Stream(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[2] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 1) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 0) { + return _wrap_new_Stream__SWIG_0(self, args); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_stream_handle_t, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_Stream__SWIG_1(self, args); + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_Stream'.\n" + " Possible C/C++ prototypes are:\n" + " Stream::Stream()\n" + " Stream::Stream(switch_stream_handle_t *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_Stream(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Stream *arg1 = (Stream *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_Stream",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1"" of type '" "Stream *""'"); + } + arg1 = reinterpret_cast< Stream * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Stream_read(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Stream *arg1 = (Stream *) 0 ; + int *arg2 = (int *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Stream_read",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_read" "', argument " "1"" of type '" "Stream *""'"); + } + arg1 = reinterpret_cast< Stream * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_read" "', argument " "2"" of type '" "int *""'"); + } + arg2 = reinterpret_cast< int * >(argp2); + result = (char *)(arg1)->read(arg2); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Stream_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Stream *arg1 = (Stream *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Stream_write",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1"" of type '" "Stream *""'"); + } + arg1 = reinterpret_cast< Stream * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + (arg1)->write((char const *)arg2); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Stream_raw_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Stream *arg1 = (Stream *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Stream_raw_write",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_raw_write" "', argument " "1"" of type '" "Stream *""'"); + } + arg1 = reinterpret_cast< Stream * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_raw_write" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Stream_raw_write" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + (arg1)->raw_write((char const *)arg2,arg3); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Stream_get_data(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Stream *arg1 = (Stream *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Stream_get_data",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1"" of type '" "Stream *""'"); + } + arg1 = reinterpret_cast< Stream * >(argp1); + result = (char *)(arg1)->get_data(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Stream_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_Event_event_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + switch_event_t *arg2 = (switch_event_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Event_event_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2"" of type '" "switch_event_t *""'"); + } + arg2 = reinterpret_cast< switch_event_t * >(argp2); + if (arg1) (arg1)->event = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_event_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_event_t *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Event_event_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + result = (switch_event_t *) ((arg1)->event); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_serialized_string_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Event_serialized_string_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->serialized_string) delete[] arg1->serialized_string; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy(new char[size], reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->serialized_string = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_serialized_string_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Event_serialized_string_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + result = (char *) ((arg1)->serialized_string); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_mine_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Event_mine_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->mine = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_mine_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:Event_mine_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + result = (int) ((arg1)->mine); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Event__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) NULL ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + Event *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|O:new_Event",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + if (obj1) { + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + result = (Event *)new Event((char const *)arg1,(char const *)arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Event__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + switch_event_t *arg1 = (switch_event_t *) 0 ; + int arg2 = (int) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + Event *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|O:new_Event",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_event_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); + } + arg1 = reinterpret_cast< switch_event_t * >(argp1); + if (obj1) { + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + } + result = (Event *)new Event(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Event(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 2) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if ((argc >= 1) && (argc <= 2)) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0); + _v = SWIG_CheckState(res); + if (_v) { + if (argc <= 1) { + return _wrap_new_Event__SWIG_1(self, args); + } + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_Event__SWIG_1(self, args); + } + } + } + if ((argc >= 1) && (argc <= 2)) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + if (argc <= 1) { + return _wrap_new_Event__SWIG_0(self, args); + } + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_Event__SWIG_0(self, args); + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_Event'.\n" + " Possible C/C++ prototypes are:\n" + " Event::Event(char const *,char const *)\n" + " Event::Event(switch_event_t *,int)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_Event(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_Event",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_chat_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:Event_chat_execute",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_chat_execute" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_chat_execute" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_chat_execute" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + result = (int)(arg1)->chat_execute((char const *)arg2,(char const *)arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_chat_send(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + char *arg2 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O|O:Event_chat_send",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_chat_send" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + if (obj1) { + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_chat_send" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + result = (int)(arg1)->chat_send((char const *)arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_serialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + char *arg2 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|O:Event_serialize",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + if (obj1) { + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + result = (char *)(arg1)->serialize((char const *)arg2); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_setPriority(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + switch_priority_t arg2 = (switch_priority_t) SWITCH_PRIORITY_NORMAL ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O|O:Event_setPriority",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + if (obj1) { + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_priority_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'"); + } else { + switch_priority_t * temp = reinterpret_cast< switch_priority_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + } + result = (bool)(arg1)->setPriority(arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_getHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Event_getHeader",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (char *)(arg1)->getHeader((char const *)arg2); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_getBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Event_getBody",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + result = (char *)(arg1)->getBody(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_getType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Event_getType",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + result = (char *)(arg1)->getType(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_addBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OO:Event_addBody",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (bool)(arg1)->addBody((char const *)arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_addHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Event_addHeader",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_delHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OO:Event_delHeader",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (bool)(arg1)->delHeader((char const *)arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_fire(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:Event_fire",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + result = (bool)(arg1)->fire(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Event_merge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Event *arg1 = (Event *) 0 ; + Event *arg2 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"OO:Event_merge",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_merge" "', argument " "1"" of type '" "Event *""'"); + } + arg1 = reinterpret_cast< Event * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_merge" "', argument " "2"" of type '" "Event *""'"); + } + arg2 = reinterpret_cast< Event * >(argp2); + result = (bool)(arg1)->merge(arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Event_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_EventConsumer_events_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *arg2 = (switch_queue_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_events_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_queue_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_events_set" "', argument " "2"" of type '" "switch_queue_t *""'"); + } + arg2 = reinterpret_cast< switch_queue_t * >(argp2); + if (arg1) (arg1)->events = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_events_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_queue_t *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_events_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (switch_queue_t *) ((arg1)->events); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_queue_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_event_id_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_event_id_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_event_types_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'"); + } else { + switch_event_types_t * temp = reinterpret_cast< switch_event_types_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + if (arg1) (arg1)->e_event_id = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_event_id_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_event_types_t result; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_event_id_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = ((arg1)->e_event_id); + resultobj = SWIG_NewPointerObj((new switch_event_types_t(static_cast< const switch_event_types_t& >(result))), SWIGTYPE_p_switch_event_types_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_callback_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_callback_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_callback_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_callback) delete[] arg1->e_callback; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_callback = (char *)reinterpret_cast< char* >(memcpy(new char[size], reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_callback = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_callback_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_callback_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_callback); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_subclass_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_subclass_name_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_subclass_name) delete[] arg1->e_subclass_name; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_subclass_name = (char *)reinterpret_cast< char* >(memcpy(new char[size], reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_subclass_name = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_subclass_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_subclass_name_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_subclass_name); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_cb_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_cb_arg_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_cb_arg) delete[] arg1->e_cb_arg; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_cb_arg = (char *)reinterpret_cast< char* >(memcpy(new char[size], reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_cb_arg = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_cb_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_cb_arg_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_cb_arg); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_enodes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t **arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_enodes_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_enodes_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_switch_event_node_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_enodes_set" "', argument " "2"" of type '" "switch_event_node_t *[SWITCH_EVENT_ALL+1]""'"); + } + arg2 = reinterpret_cast< switch_event_node_t ** >(argp2); + { + if (arg2) { + size_t ii = 0; + for (; ii < (size_t)SWITCH_EVENT_ALL+1; ++ii) *(switch_event_node_t * *)&arg1->enodes[ii] = *((switch_event_node_t * *)arg2 + ii); + } else { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""enodes""' of type '""switch_event_node_t *[SWITCH_EVENT_ALL+1]""'"); + } + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_enodes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_event_node_t **result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_enodes_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_enodes_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (switch_event_node_t **)(switch_event_node_t **) ((arg1)->enodes); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_switch_event_node_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_node_index_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + uint32_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_node_index_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_index_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_uint32_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_node_index_set" "', argument " "2"" of type '" "uint32_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EventConsumer_node_index_set" "', argument " "2"" of type '" "uint32_t""'"); + } else { + uint32_t * temp = reinterpret_cast< uint32_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + if (arg1) (arg1)->node_index = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_node_index_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + uint32_t result; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_node_index_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_index_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = ((arg1)->node_index); + resultobj = SWIG_NewPointerObj((new uint32_t(static_cast< const uint32_t& >(result))), SWIGTYPE_p_uint32_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_EventConsumer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) NULL ; + char *arg2 = (char *) "" ; + int arg3 = (int) 5000 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + EventConsumer *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"|OOO:new_EventConsumer",&obj0,&obj1,&obj2)) SWIG_fail; + if (obj0) { + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + } + if (obj1) { + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_EventConsumer" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_EventConsumer" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2,arg3); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_EventConsumer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_EventConsumer",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EventConsumer" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_bind(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) "" ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:EventConsumer_bind",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_bind" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_bind" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "EventConsumer_bind" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + result = (int)(arg1)->bind((char const *)arg2,(char const *)arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + int arg2 = (int) 0 ; + int arg3 = (int) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + Event *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|OO:EventConsumer_pop",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + if (obj1) { + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EventConsumer_pop" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + } + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EventConsumer_pop" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + Py_BEGIN_ALLOW_THREADS; + result = (Event *)(arg1)->pop(arg2,arg3); + Py_END_ALLOW_THREADS; + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_cleanup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_cleanup",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_cleanup" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + (arg1)->cleanup(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *EventConsumer_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_EventConsumer, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_CoreSession",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + switch_core_session_t *arg2 = (switch_core_session_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_session_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'"); + } + arg2 = reinterpret_cast< switch_core_session_t * >(argp2); + if (arg1) (arg1)->session = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_core_session_t *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_session_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (switch_core_session_t *) ((arg1)->session); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + switch_channel_t *arg2 = (switch_channel_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_channel_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'"); + } + arg2 = reinterpret_cast< switch_channel_t * >(argp2); + if (arg1) (arg1)->channel = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_channel_t *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_channel_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (switch_channel_t *) ((arg1)->channel); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_flags_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + unsigned int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_flags_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2"" of type '" "unsigned int""'"); + } + arg2 = static_cast< unsigned int >(val2); + if (arg1) (arg1)->flags = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_flags_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + unsigned int result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flags_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (unsigned int) ((arg1)->flags); + resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_allocated_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_allocated_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->allocated = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_allocated_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_allocated_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (int) ((arg1)->allocated); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_cb_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + input_callback_state *arg2 = (input_callback_state *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_cb_state_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_input_callback_state, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cb_state_set" "', argument " "2"" of type '" "input_callback_state *""'"); + } + arg2 = reinterpret_cast< input_callback_state * >(argp2); + if (arg1) (arg1)->cb_state = *arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_cb_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + input_callback_state *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_cb_state_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (input_callback_state *)& ((arg1)->cb_state); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_hook_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + switch_channel_state_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hook_state_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_state_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'"); + } else { + switch_channel_state_t * temp = reinterpret_cast< switch_channel_state_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + if (arg1) (arg1)->hook_state = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_hook_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_channel_state_t result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hook_state_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = ((arg1)->hook_state); + resultobj = SWIG_NewPointerObj((new switch_channel_state_t(static_cast< const switch_channel_state_t& >(result))), SWIGTYPE_p_switch_channel_state_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_cause_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + switch_call_cause_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_cause_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cause_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_call_cause_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cause_set" "', argument " "2"" of type '" "switch_call_cause_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_cause_set" "', argument " "2"" of type '" "switch_call_cause_t""'"); + } else { + switch_call_cause_t * temp = reinterpret_cast< switch_call_cause_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + if (arg1) (arg1)->cause = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_cause_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_call_cause_t result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_cause_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cause_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = ((arg1)->cause); + resultobj = SWIG_NewPointerObj((new switch_call_cause_t(static_cast< const switch_call_cause_t& >(result))), SWIGTYPE_p_switch_call_cause_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_uuid_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_uuid_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_uuid_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_uuid_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->uuid) delete[] arg1->uuid; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->uuid = (char *)reinterpret_cast< char* >(memcpy(new char[size], reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->uuid = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_uuid_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_uuid_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_uuid_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (char *) ((arg1)->uuid); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_tts_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_tts_name_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_tts_name_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_tts_name_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->tts_name) delete[] arg1->tts_name; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->tts_name = (char *)reinterpret_cast< char* >(memcpy(new char[size], reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->tts_name = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_tts_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_tts_name_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_tts_name_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (char *) ((arg1)->tts_name); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_voice_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_voice_name_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_voice_name_set" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_voice_name_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->voice_name) delete[] arg1->voice_name; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->voice_name = (char *)reinterpret_cast< char* >(memcpy(new char[size], reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->voice_name = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_voice_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_voice_name_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_voice_name_get" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (char *) ((arg1)->voice_name); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_insertFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_insertFile",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_insertFile" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_insertFile" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_insertFile" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_insertFile" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + result = (int)(arg1)->insertFile((char const *)arg2,(char const *)arg3,arg4); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answer",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (int)(arg1)->answer(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession__print(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession__print",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession__print" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession__print" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (int)(arg1)->print(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_preAnswer",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (int)(arg1)->preAnswer(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) "normal_clearing" ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O|O:CoreSession_hangup",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + if (obj1) { + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + (arg1)->hangup((char const *)arg2); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_hangupState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hangupState",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangupState" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + (arg1)->hangupState(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setVariable",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + (arg1)->setVariable(arg2,arg3); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_setPrivate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *arg3 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setPrivate",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3"" of type '" "void *""'"); + } + (arg1)->setPrivate(arg2,arg3); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_getPrivate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + void *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getPrivate",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (void *)(arg1)->getPrivate(arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getVariable",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (char *)(arg1)->getVariable(arg2); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_process_callback_result(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + switch_status_t result; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_process_callback_result",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_process_callback_result" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (arg1)->process_callback_result(arg2); + resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 ); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + char *arg5 = (char *) 0 ; + char *arg6 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int res5 ; + char *buf5 = 0 ; + int alloc5 = 0 ; + int res6 ; + char *buf6 = 0 ; + int alloc6 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOO|O:CoreSession_say",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'"); + } + arg5 = reinterpret_cast< char * >(buf5); + if (obj5) { + res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_say" "', argument " "6"" of type '" "char const *""'"); + } + arg6 = reinterpret_cast< char * >(buf6); + } + (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) "" ; + char *arg4 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|OO:CoreSession_sayPhrase",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_hangupCause(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hangupCause",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangupCause" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (char *)(arg1)->hangupCause(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_getState(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_getState",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getState" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (char *)(arg1)->getState(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_recordFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 = (int) 0 ; + int arg4 = (int) 0 ; + int arg5 = (int) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO|OOO:CoreSession_recordFile",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + if (obj3) { + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + } + if (obj4) { + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + } + result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_originate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + CoreSession *arg2 = (CoreSession *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 = (int) 60 ; + switch_state_handler_table_t *arg5 = (switch_state_handler_table_t *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + void *argp5 = 0 ; + int res5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OOO|OO:CoreSession_originate",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); + } + arg2 = reinterpret_cast< CoreSession * >(argp2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + if (obj3) { + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + } + if (obj4) { + res5 = SWIG_ConvertPtr(obj4, &argp5,SWIGTYPE_p_switch_state_handler_table_t, 0 | 0 ); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_originate" "', argument " "5"" of type '" "switch_state_handler_table_t *""'"); + } + arg5 = reinterpret_cast< switch_state_handler_table_t * >(argp5); + } + result = (int)(arg1)->originate(arg2,arg3,arg4,arg5); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_destroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_destroy",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_destroy" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + (arg1)->destroy(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *arg2 = (void *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setDTMFCallback",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "void *""'"); + } + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + (arg1)->setDTMFCallback(arg2,arg3); + resultobj = SWIG_Py_Void(); + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_speak(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_speak",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (int)(arg1)->speak(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_set_tts_parms",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + (arg1)->set_tts_parms(arg2,arg3); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_set_tts_params(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_set_tts_params",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_params" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_params" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_params" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + (arg1)->set_tts_params(arg2,arg3); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_collectDigits__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_collectDigits",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (int)(arg1)->collectDigits(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_collectDigits__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + int arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_collectDigits",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_collectDigits" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + result = (int)(arg1)->collectDigits(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 3) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CoreSession_collectDigits__SWIG_0(self, args); + } + } + } + if (argc == 3) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CoreSession_collectDigits__SWIG_1(self, args); + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'CoreSession_collectDigits'.\n" + " Possible C/C++ prototypes are:\n" + " CoreSession::collectDigits(int)\n" + " CoreSession::collectDigits(int,int)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_getDigits__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + char *arg3 = (char *) 0 ; + int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + result = (char *)(arg1)->getDigits(arg2,arg3,arg4); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_getDigits__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int arg5 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_getDigits__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int arg5 ; + int arg6 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + int val6 ; + int ecode6 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + ecode6 = SWIG_AsVal_int(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "CoreSession_getDigits" "', argument " "6"" of type '" "int""'"); + } + arg6 = static_cast< int >(val6); + result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[7] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 6) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 4) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CoreSession_getDigits__SWIG_0(self, args); + } + } + } + } + } + if (argc == 5) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CoreSession_getDigits__SWIG_1(self, args); + } + } + } + } + } + } + if (argc == 6) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[5], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_CoreSession_getDigits__SWIG_2(self, args); + } + } + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'CoreSession_getDigits'.\n" + " Possible C/C++ prototypes are:\n" + " CoreSession::getDigits(int,char *,int)\n" + " CoreSession::getDigits(int,char *,int,int)\n" + " CoreSession::getDigits(int,char *,int,int,int)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO|OO:CoreSession_transfer",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + result = (int)(arg1)->transfer(arg2,arg3,arg4); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + int arg3 ; + char *arg4 = (char *) 0 ; + int arg5 ; + char *arg6 = (char *) 0 ; + int arg7 = (int) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int val5 ; + int ecode5 = 0 ; + int res6 ; + char *buf6 = 0 ; + int alloc6 = 0 ; + int val7 ; + int ecode7 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOO|O:CoreSession_read",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'"); + } + arg6 = reinterpret_cast< char * >(buf6); + if (obj6) { + ecode7 = SWIG_AsVal_int(obj6, &val7); + if (!SWIG_IsOK(ecode7)) { + SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "CoreSession_read" "', argument " "7"" of type '" "int""'"); + } + arg7 = static_cast< int >(val7); + } + result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6,arg7); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + return resultobj; +fail: + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_detectSpeech(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + char *arg5 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int res5 ; + char *buf5 = 0 ; + int alloc5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|OOO:CoreSession_detectSpeech",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_detectSpeech" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_detectSpeech" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_detectSpeech" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_detectSpeech" "', argument " "4"" of type '" "char *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + if (obj4) { + res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_detectSpeech" "', argument " "5"" of type '" "char *""'"); + } + arg5 = reinterpret_cast< char * >(buf5); + } + (arg1)->detectSpeech(arg2,arg3,arg4,arg5); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + int arg3 ; + int arg4 ; + int arg5 ; + char *arg6 = (char *) 0 ; + char *arg7 = (char *) 0 ; + char *arg8 = (char *) 0 ; + char *arg9 = (char *) 0 ; + char *arg10 = (char *) NULL ; + int arg11 = (int) 0 ; + char *arg12 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + int res6 ; + char *buf6 = 0 ; + int alloc6 = 0 ; + int res7 ; + char *buf7 = 0 ; + int alloc7 = 0 ; + int res8 ; + char *buf8 = 0 ; + int alloc8 = 0 ; + int res9 ; + char *buf9 = 0 ; + int alloc9 = 0 ; + int res10 ; + char *buf10 = 0 ; + int alloc10 = 0 ; + int val11 ; + int ecode11 = 0 ; + int res12 ; + char *buf12 = 0 ; + int alloc12 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + PyObject * obj7 = 0 ; + PyObject * obj8 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + PyObject * obj11 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO|OOO:CoreSession_playAndGetDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'"); + } + arg6 = reinterpret_cast< char * >(buf6); + res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7); + if (!SWIG_IsOK(res7)) { + SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'"); + } + arg7 = reinterpret_cast< char * >(buf7); + res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8); + if (!SWIG_IsOK(res8)) { + SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'"); + } + arg8 = reinterpret_cast< char * >(buf8); + res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9); + if (!SWIG_IsOK(res9)) { + SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *""'"); + } + arg9 = reinterpret_cast< char * >(buf9); + if (obj9) { + res10 = SWIG_AsCharPtrAndSize(obj9, &buf10, NULL, &alloc10); + if (!SWIG_IsOK(res10)) { + SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "CoreSession_playAndGetDigits" "', argument " "10"" of type '" "char const *""'"); + } + arg10 = reinterpret_cast< char * >(buf10); + } + if (obj10) { + ecode11 = SWIG_AsVal_int(obj10, &val11); + if (!SWIG_IsOK(ecode11)) { + SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "CoreSession_playAndGetDigits" "', argument " "11"" of type '" "int""'"); + } + arg11 = static_cast< int >(val11); + } + if (obj11) { + res12 = SWIG_AsCharPtrAndSize(obj11, &buf12, NULL, &alloc12); + if (!SWIG_IsOK(res12)) { + SWIG_exception_fail(SWIG_ArgError(res12), "in method '" "CoreSession_playAndGetDigits" "', argument " "12"" of type '" "char const *""'"); + } + arg12 = reinterpret_cast< char * >(buf12); + } + result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10,arg11,(char const *)arg12); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + if (alloc7 == SWIG_NEWOBJ) delete[] buf7; + if (alloc8 == SWIG_NEWOBJ) delete[] buf8; + if (alloc9 == SWIG_NEWOBJ) delete[] buf9; + if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + if (alloc12 == SWIG_NEWOBJ) delete[] buf12; + return resultobj; +fail: + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + if (alloc7 == SWIG_NEWOBJ) delete[] buf7; + if (alloc8 == SWIG_NEWOBJ) delete[] buf8; + if (alloc9 == SWIG_NEWOBJ) delete[] buf9; + if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + if (alloc12 == SWIG_NEWOBJ) delete[] buf12; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_playAndDetectSpeech(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_playAndDetectSpeech",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndDetectSpeech" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_playAndDetectSpeech" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_playAndDetectSpeech" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_playAndDetectSpeech" "', argument " "4"" of type '" "char *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + result = (char *)(arg1)->playAndDetectSpeech(arg2,arg3,arg4); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + free(result); + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_streamFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 = (int) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:CoreSession_streamFile",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + result = (int)(arg1)->streamFile(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_sleep(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + int arg3 = (int) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:CoreSession_sleep",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sleep" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_sleep" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (obj2) { + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_sleep" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + result = (int)(arg1)->sleep(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_flushEvents(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flushEvents",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (int)(arg1)->flushEvents(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_flushDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flushDigits",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (int)(arg1)->flushDigits(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_setAutoHangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + int result; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setAutoHangup",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + result = (int)(arg1)->setAutoHangup(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_setHangupHook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *arg2 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setHangupHook",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2"" of type '" "void *""'"); + } + (arg1)->setHangupHook(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_ready(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_ready",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (bool)(arg1)->ready(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_bridged(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_bridged",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_bridged" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (bool)(arg1)->bridged(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_answered(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answered",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answered" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (bool)(arg1)->answered(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_mediaReady(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_mediaReady",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_mediaReady" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (bool)(arg1)->mediaReady(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_waitForAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + CoreSession *arg2 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_waitForAnswer",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_waitForAnswer" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_waitForAnswer" "', argument " "2"" of type '" "CoreSession *""'"); + } + arg2 = reinterpret_cast< CoreSession * >(argp2); + (arg1)->waitForAnswer(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|O:CoreSession_execute",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + (arg1)->execute((char const *)arg2,(char const *)arg3); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + Event *arg2 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sendEvent",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2"" of type '" "Event *""'"); + } + arg2 = reinterpret_cast< Event * >(argp2); + (arg1)->sendEvent(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_setEventData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + Event *arg2 = (Event *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setEventData",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2"" of type '" "Event *""'"); + } + arg2 = reinterpret_cast< Event * >(argp2); + (arg1)->setEventData(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_getXMLCDR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_getXMLCDR",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (char *)(arg1)->getXMLCDR(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_begin_allow_threads",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (bool)(arg1)->begin_allow_threads(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_end_allow_threads",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (bool)(arg1)->end_allow_threads(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_get_uuid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_uuid",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1"" of type '" "CoreSession const *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (char *)((CoreSession const *)arg1)->get_uuid(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_get_cb_args(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_input_args_t *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_cb_args",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1"" of type '" "CoreSession const *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + result = (switch_input_args_t *) &((CoreSession const *)arg1)->get_cb_args(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_check_hangup_hook",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + (arg1)->check_hangup_hook(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + void *arg2 = (void *) 0 ; + switch_input_type_t arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + void *argp3 ; + int res3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + switch_status_t result; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); + } + { + res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); + } else { + switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3); + arg3 = *temp; + if (SWIG_IsNewObj(res3)) delete temp; + } + } + result = (arg1)->run_dtmf_callback(arg2,arg3); + resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_consoleLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_consoleLog",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_consoleLog" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_consoleLog" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_consoleLog" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + (arg1)->consoleLog(arg2,arg3); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_CoreSession_consoleLog2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + int arg5 ; + char *arg6 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int val5 ; + int ecode5 = 0 ; + int res6 ; + char *buf6 = 0 ; + int alloc6 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_consoleLog2",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_consoleLog2" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_consoleLog2" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_consoleLog2" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_consoleLog2" "', argument " "4"" of type '" "char *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_consoleLog2" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_consoleLog2" "', argument " "6"" of type '" "char *""'"); + } + arg6 = reinterpret_cast< char * >(buf6); + (arg1)->consoleLog2(arg2,arg3,arg4,arg5,arg6); + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + return NULL; +} + + +SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_console_log(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:console_log",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + console_log(arg1,arg2); + resultobj = SWIG_Py_Void(); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_console_log2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + char *arg5 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int res5 ; + char *buf5 = 0 ; + int alloc5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOO:console_log2",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log2" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log2" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "console_log2" "', argument " "3"" of type '" "char *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "console_log2" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "console_log2" "', argument " "5"" of type '" "char *""'"); + } + arg5 = reinterpret_cast< char * >(buf5); + console_log2(arg1,arg2,arg3,arg4,arg5); + resultobj = SWIG_Py_Void(); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc5 == SWIG_NEWOBJ) delete[] buf5; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_console_clean_log(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:console_clean_log",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + console_clean_log(arg1); + resultobj = SWIG_Py_Void(); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_msleep(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + unsigned int arg1 ; + unsigned int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:msleep",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "msleep" "', argument " "1"" of type '" "unsigned int""'"); + } + arg1 = static_cast< unsigned int >(val1); + switch_msleep(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_bridge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = 0 ; + CoreSession *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:bridge",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); + } + arg2 = reinterpret_cast< CoreSession * >(argp2); + bridge(*arg1,*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_hanguphook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + switch_status_t result; + + if (!PyArg_ParseTuple(args,(char *)"O:hanguphook",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1"" of type '" "switch_core_session_t *""'"); + } + arg1 = reinterpret_cast< switch_core_session_t * >(argp1); + result = hanguphook(arg1); + resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + void *arg2 = (void *) 0 ; + switch_input_type_t arg3 ; + void *arg4 = (void *) 0 ; + unsigned int arg5 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + void *argp3 ; + int res3 = 0 ; + int res4 ; + unsigned int val5 ; + int ecode5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + switch_status_t result; + + if (!PyArg_ParseTuple(args,(char *)"OOOOO:dtmf_callback",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1"" of type '" "switch_core_session_t *""'"); + } + arg1 = reinterpret_cast< switch_core_session_t * >(argp1); + res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2"" of type '" "void *""'"); + } + { + res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); + } else { + switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3); + arg3 = *temp; + if (SWIG_IsNewObj(res3)) delete temp; + } + } + res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4"" of type '" "void *""'"); + } + ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5"" of type '" "unsigned int""'"); + } + arg5 = static_cast< unsigned int >(val5); + result = dtmf_callback(arg1,arg2,arg3,arg4,arg5); + resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Session__SWIG_0(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_Session")) SWIG_fail; + result = (PYTHON::Session *)new PYTHON::Session(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); result->setPython(self); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Session__SWIG_1(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + CoreSession *arg2 = (CoreSession *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PYTHON::Session *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:new_Session",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Session" "', argument " "2"" of type '" "CoreSession *""'"); + } + arg2 = reinterpret_cast< CoreSession * >(argp2); + result = (PYTHON::Session *)new PYTHON::Session(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); result->setPython(self); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + PYTHON::Session *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_Session",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + result = (PYTHON::Session *)new PYTHON::Session(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); result->setPython(self); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Session__SWIG_3(PyObject *self, PyObject *args) { + PyObject *resultobj = 0; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PYTHON::Session *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_Session",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'"); + } + arg1 = reinterpret_cast< switch_core_session_t * >(argp1); + result = (PYTHON::Session *)new PYTHON::Session(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW | 0 ); result->setPython(self); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Session(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[3] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 2) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 0) { + return _wrap_new_Session__SWIG_0(self, args); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_Session__SWIG_3(self, args); + } + } + if (argc == 1) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_Session__SWIG_2(self, args); + } + } + if (argc == 2) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_Session__SWIG_1(self, args); + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_Session'.\n" + " Possible C/C++ prototypes are:\n" + " PYTHON::Session::Session()\n" + " PYTHON::Session::Session(char *,CoreSession *)\n" + " PYTHON::Session::Session(char *)\n" + " PYTHON::Session::Session(switch_core_session_t *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_delete_Session(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_Session",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + delete arg1; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_begin_allow_threads",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_begin_allow_threads" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + result = (bool)(arg1)->begin_allow_threads(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_end_allow_threads",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + result = (bool)(arg1)->end_allow_threads(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_check_hangup_hook",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + (arg1)->check_hangup_hook(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_destroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_destroy",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_destroy" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + (arg1)->destroy(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *arg2 = (void *) 0 ; + switch_input_type_t arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + void *argp3 ; + int res3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + switch_status_t result; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Session_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); + } + { + res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); + } else { + switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3); + arg3 = *temp; + if (SWIG_IsNewObj(res3)) delete temp; + } + } + result = (arg1)->run_dtmf_callback(arg2,arg3); + resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_setInputCallback__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + PyObject *arg3 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Session_setInputCallback",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + arg3 = obj2; + (arg1)->setInputCallback(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_setInputCallback__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Session_setInputCallback",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + (arg1)->setInputCallback(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_setInputCallback(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 3) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + return _wrap_Session_setInputCallback__SWIG_1(self, args); + } + } + } + if (argc == 3) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + _v = (argv[2] != 0); + if (_v) { + return _wrap_Session_setInputCallback__SWIG_0(self, args); + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Session_setInputCallback'.\n" + " Possible C/C++ prototypes are:\n" + " PYTHON::Session::setInputCallback(PyObject *,PyObject *)\n" + " PYTHON::Session::setInputCallback(PyObject *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_Session_unsetInputCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_unsetInputCallback",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_unsetInputCallback" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + (arg1)->unsetInputCallback(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_setHangupHook__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + PyObject *arg3 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Session_setHangupHook",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + arg3 = obj2; + (arg1)->setHangupHook(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_setHangupHook__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Session_setHangupHook",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + (arg1)->setHangupHook(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_setHangupHook(PyObject *self, PyObject *args) { + Py_ssize_t argc; + PyObject *argv[4] = { + 0 + }; + Py_ssize_t ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = args ? PyObject_Length(args) : 0; + for (ii = 0; (ii < 3) && (ii < argc); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + return _wrap_Session_setHangupHook__SWIG_1(self, args); + } + } + } + if (argc == 3) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0); + _v = SWIG_CheckState(res); + if (_v) { + _v = (argv[1] != 0); + if (_v) { + _v = (argv[2] != 0); + if (_v) { + return _wrap_Session_setHangupHook__SWIG_0(self, args); + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'Session_setHangupHook'.\n" + " Possible C/C++ prototypes are:\n" + " PYTHON::Session::setHangupHook(PyObject *,PyObject *)\n" + " PYTHON::Session::setHangupHook(PyObject *)\n"); + return 0; +} + + +SWIGINTERN PyObject *_wrap_Session_ready(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + bool result; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_ready",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + result = (bool)(arg1)->ready(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_cb_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Session_cb_function_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + if (arg1) (arg1)->cb_function = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_cb_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_cb_function_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + result = (PyObject *) ((arg1)->cb_function); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_cb_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Session_cb_arg_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + if (arg1) (arg1)->cb_arg = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_cb_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_cb_arg_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + result = (PyObject *) ((arg1)->cb_arg); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_hangup_func_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Session_hangup_func_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + if (arg1) (arg1)->hangup_func = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_hangup_func_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_hangup_func_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + result = (PyObject *) ((arg1)->hangup_func); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_hangup_func_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Session_hangup_func_arg_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + if (arg1) (arg1)->hangup_func_arg = arg2; + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_hangup_func_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Session_hangup_func_arg_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + result = (PyObject *) ((arg1)->hangup_func_arg); + resultobj = result; + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_setPython(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Session_setPython",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPython" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + arg2 = obj1; + (arg1)->setPython(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Session_setSelf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + PYTHON::Session *arg1 = (PYTHON::Session *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Session_setSelf",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setSelf" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "Session_setSelf" "', argument " "1"" is NULL"); + arg2 = obj1; + (arg1)->setSelf(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Session_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_PYTHON__Session, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +static PyMethodDef SwigMethods[] = { + { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL}, + { "setGlobalVariable", _wrap_setGlobalVariable, METH_VARARGS, NULL}, + { "getGlobalVariable", _wrap_getGlobalVariable, METH_VARARGS, NULL}, + { "consoleLog", _wrap_consoleLog, METH_VARARGS, NULL}, + { "consoleLog2", _wrap_consoleLog2, METH_VARARGS, NULL}, + { "consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL}, + { "running", _wrap_running, METH_VARARGS, NULL}, + { "email", _wrap_email, METH_VARARGS, NULL}, + { "new_IVRMenu", _wrap_new_IVRMenu, METH_VARARGS, NULL}, + { "delete_IVRMenu", _wrap_delete_IVRMenu, METH_VARARGS, NULL}, + { "IVRMenu_bindAction", _wrap_IVRMenu_bindAction, METH_VARARGS, NULL}, + { "IVRMenu_execute", _wrap_IVRMenu_execute, METH_VARARGS, NULL}, + { "IVRMenu_swigregister", IVRMenu_swigregister, METH_VARARGS, NULL}, + { "new_API", _wrap_new_API, METH_VARARGS, NULL}, + { "delete_API", _wrap_delete_API, METH_VARARGS, NULL}, + { "API_execute", _wrap_API_execute, METH_VARARGS, NULL}, + { "API_executeString", _wrap_API_executeString, METH_VARARGS, NULL}, + { "API_getTime", _wrap_API_getTime, METH_VARARGS, NULL}, + { "API_swigregister", API_swigregister, METH_VARARGS, NULL}, + { "input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL}, + { "input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL}, + { "input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL}, + { "input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get, METH_VARARGS, NULL}, + { "input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set, METH_VARARGS, NULL}, + { "input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get, METH_VARARGS, NULL}, + { "input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set, METH_VARARGS, NULL}, + { "input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get, METH_VARARGS, NULL}, + { "new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL}, + { "delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL}, + { "input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL}, + { "DTMF_digit_set", _wrap_DTMF_digit_set, METH_VARARGS, NULL}, + { "DTMF_digit_get", _wrap_DTMF_digit_get, METH_VARARGS, NULL}, + { "DTMF_duration_set", _wrap_DTMF_duration_set, METH_VARARGS, NULL}, + { "DTMF_duration_get", _wrap_DTMF_duration_get, METH_VARARGS, NULL}, + { "new_DTMF", _wrap_new_DTMF, METH_VARARGS, NULL}, + { "delete_DTMF", _wrap_delete_DTMF, METH_VARARGS, NULL}, + { "DTMF_swigregister", DTMF_swigregister, METH_VARARGS, NULL}, + { "new_Stream", _wrap_new_Stream, METH_VARARGS, NULL}, + { "delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL}, + { "Stream_read", _wrap_Stream_read, METH_VARARGS, NULL}, + { "Stream_write", _wrap_Stream_write, METH_VARARGS, NULL}, + { "Stream_raw_write", _wrap_Stream_raw_write, METH_VARARGS, NULL}, + { "Stream_get_data", _wrap_Stream_get_data, METH_VARARGS, NULL}, + { "Stream_swigregister", Stream_swigregister, METH_VARARGS, NULL}, + { "Event_event_set", _wrap_Event_event_set, METH_VARARGS, NULL}, + { "Event_event_get", _wrap_Event_event_get, METH_VARARGS, NULL}, + { "Event_serialized_string_set", _wrap_Event_serialized_string_set, METH_VARARGS, NULL}, + { "Event_serialized_string_get", _wrap_Event_serialized_string_get, METH_VARARGS, NULL}, + { "Event_mine_set", _wrap_Event_mine_set, METH_VARARGS, NULL}, + { "Event_mine_get", _wrap_Event_mine_get, METH_VARARGS, NULL}, + { "new_Event", _wrap_new_Event, METH_VARARGS, NULL}, + { "delete_Event", _wrap_delete_Event, METH_VARARGS, NULL}, + { "Event_chat_execute", _wrap_Event_chat_execute, METH_VARARGS, NULL}, + { "Event_chat_send", _wrap_Event_chat_send, METH_VARARGS, NULL}, + { "Event_serialize", _wrap_Event_serialize, METH_VARARGS, NULL}, + { "Event_setPriority", _wrap_Event_setPriority, METH_VARARGS, NULL}, + { "Event_getHeader", _wrap_Event_getHeader, METH_VARARGS, NULL}, + { "Event_getBody", _wrap_Event_getBody, METH_VARARGS, NULL}, + { "Event_getType", _wrap_Event_getType, METH_VARARGS, NULL}, + { "Event_addBody", _wrap_Event_addBody, METH_VARARGS, NULL}, + { "Event_addHeader", _wrap_Event_addHeader, METH_VARARGS, NULL}, + { "Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL}, + { "Event_fire", _wrap_Event_fire, METH_VARARGS, NULL}, + { "Event_merge", _wrap_Event_merge, METH_VARARGS, NULL}, + { "Event_swigregister", Event_swigregister, METH_VARARGS, NULL}, + { "EventConsumer_events_set", _wrap_EventConsumer_events_set, METH_VARARGS, NULL}, + { "EventConsumer_events_get", _wrap_EventConsumer_events_get, METH_VARARGS, NULL}, + { "EventConsumer_e_event_id_set", _wrap_EventConsumer_e_event_id_set, METH_VARARGS, NULL}, + { "EventConsumer_e_event_id_get", _wrap_EventConsumer_e_event_id_get, METH_VARARGS, NULL}, + { "EventConsumer_e_callback_set", _wrap_EventConsumer_e_callback_set, METH_VARARGS, NULL}, + { "EventConsumer_e_callback_get", _wrap_EventConsumer_e_callback_get, METH_VARARGS, NULL}, + { "EventConsumer_e_subclass_name_set", _wrap_EventConsumer_e_subclass_name_set, METH_VARARGS, NULL}, + { "EventConsumer_e_subclass_name_get", _wrap_EventConsumer_e_subclass_name_get, METH_VARARGS, NULL}, + { "EventConsumer_e_cb_arg_set", _wrap_EventConsumer_e_cb_arg_set, METH_VARARGS, NULL}, + { "EventConsumer_e_cb_arg_get", _wrap_EventConsumer_e_cb_arg_get, METH_VARARGS, NULL}, + { "EventConsumer_enodes_set", _wrap_EventConsumer_enodes_set, METH_VARARGS, NULL}, + { "EventConsumer_enodes_get", _wrap_EventConsumer_enodes_get, METH_VARARGS, NULL}, + { "EventConsumer_node_index_set", _wrap_EventConsumer_node_index_set, METH_VARARGS, NULL}, + { "EventConsumer_node_index_get", _wrap_EventConsumer_node_index_get, METH_VARARGS, NULL}, + { "new_EventConsumer", _wrap_new_EventConsumer, METH_VARARGS, NULL}, + { "delete_EventConsumer", _wrap_delete_EventConsumer, METH_VARARGS, NULL}, + { "EventConsumer_bind", _wrap_EventConsumer_bind, METH_VARARGS, NULL}, + { "EventConsumer_pop", _wrap_EventConsumer_pop, METH_VARARGS, NULL}, + { "EventConsumer_cleanup", _wrap_EventConsumer_cleanup, METH_VARARGS, NULL}, + { "EventConsumer_swigregister", EventConsumer_swigregister, METH_VARARGS, NULL}, + { "delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL}, + { "CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL}, + { "CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL}, + { "CoreSession_channel_set", _wrap_CoreSession_channel_set, METH_VARARGS, NULL}, + { "CoreSession_channel_get", _wrap_CoreSession_channel_get, METH_VARARGS, NULL}, + { "CoreSession_flags_set", _wrap_CoreSession_flags_set, METH_VARARGS, NULL}, + { "CoreSession_flags_get", _wrap_CoreSession_flags_get, METH_VARARGS, NULL}, + { "CoreSession_allocated_set", _wrap_CoreSession_allocated_set, METH_VARARGS, NULL}, + { "CoreSession_allocated_get", _wrap_CoreSession_allocated_get, METH_VARARGS, NULL}, + { "CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set, METH_VARARGS, NULL}, + { "CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get, METH_VARARGS, NULL}, + { "CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set, METH_VARARGS, NULL}, + { "CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get, METH_VARARGS, NULL}, + { "CoreSession_cause_set", _wrap_CoreSession_cause_set, METH_VARARGS, NULL}, + { "CoreSession_cause_get", _wrap_CoreSession_cause_get, METH_VARARGS, NULL}, + { "CoreSession_uuid_set", _wrap_CoreSession_uuid_set, METH_VARARGS, NULL}, + { "CoreSession_uuid_get", _wrap_CoreSession_uuid_get, METH_VARARGS, NULL}, + { "CoreSession_tts_name_set", _wrap_CoreSession_tts_name_set, METH_VARARGS, NULL}, + { "CoreSession_tts_name_get", _wrap_CoreSession_tts_name_get, METH_VARARGS, NULL}, + { "CoreSession_voice_name_set", _wrap_CoreSession_voice_name_set, METH_VARARGS, NULL}, + { "CoreSession_voice_name_get", _wrap_CoreSession_voice_name_get, METH_VARARGS, NULL}, + { "CoreSession_insertFile", _wrap_CoreSession_insertFile, METH_VARARGS, NULL}, + { "CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL}, + { "CoreSession__print", _wrap_CoreSession__print, METH_VARARGS, NULL}, + { "CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL}, + { "CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL}, + { "CoreSession_hangupState", _wrap_CoreSession_hangupState, METH_VARARGS, NULL}, + { "CoreSession_setVariable", _wrap_CoreSession_setVariable, METH_VARARGS, NULL}, + { "CoreSession_setPrivate", _wrap_CoreSession_setPrivate, METH_VARARGS, NULL}, + { "CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL}, + { "CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL}, + { "CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL}, + { "CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL}, + { "CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL}, + { "CoreSession_hangupCause", _wrap_CoreSession_hangupCause, METH_VARARGS, NULL}, + { "CoreSession_getState", _wrap_CoreSession_getState, METH_VARARGS, NULL}, + { "CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL}, + { "CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL}, + { "CoreSession_destroy", _wrap_CoreSession_destroy, METH_VARARGS, NULL}, + { "CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL}, + { "CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL}, + { "CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL}, + { "CoreSession_set_tts_params", _wrap_CoreSession_set_tts_params, METH_VARARGS, NULL}, + { "CoreSession_collectDigits", _wrap_CoreSession_collectDigits, METH_VARARGS, NULL}, + { "CoreSession_getDigits", _wrap_CoreSession_getDigits, METH_VARARGS, NULL}, + { "CoreSession_transfer", _wrap_CoreSession_transfer, METH_VARARGS, NULL}, + { "CoreSession_read", _wrap_CoreSession_read, METH_VARARGS, NULL}, + { "CoreSession_detectSpeech", _wrap_CoreSession_detectSpeech, METH_VARARGS, NULL}, + { "CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL}, + { "CoreSession_playAndDetectSpeech", _wrap_CoreSession_playAndDetectSpeech, METH_VARARGS, NULL}, + { "CoreSession_streamFile", _wrap_CoreSession_streamFile, METH_VARARGS, NULL}, + { "CoreSession_sleep", _wrap_CoreSession_sleep, METH_VARARGS, NULL}, + { "CoreSession_flushEvents", _wrap_CoreSession_flushEvents, METH_VARARGS, NULL}, + { "CoreSession_flushDigits", _wrap_CoreSession_flushDigits, METH_VARARGS, NULL}, + { "CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL}, + { "CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook, METH_VARARGS, NULL}, + { "CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL}, + { "CoreSession_bridged", _wrap_CoreSession_bridged, METH_VARARGS, NULL}, + { "CoreSession_answered", _wrap_CoreSession_answered, METH_VARARGS, NULL}, + { "CoreSession_mediaReady", _wrap_CoreSession_mediaReady, METH_VARARGS, NULL}, + { "CoreSession_waitForAnswer", _wrap_CoreSession_waitForAnswer, METH_VARARGS, NULL}, + { "CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL}, + { "CoreSession_sendEvent", _wrap_CoreSession_sendEvent, METH_VARARGS, NULL}, + { "CoreSession_setEventData", _wrap_CoreSession_setEventData, METH_VARARGS, NULL}, + { "CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR, METH_VARARGS, NULL}, + { "CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL}, + { "CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL}, + { "CoreSession_get_uuid", _wrap_CoreSession_get_uuid, METH_VARARGS, NULL}, + { "CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL}, + { "CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook, METH_VARARGS, NULL}, + { "CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback, METH_VARARGS, NULL}, + { "CoreSession_consoleLog", _wrap_CoreSession_consoleLog, METH_VARARGS, NULL}, + { "CoreSession_consoleLog2", _wrap_CoreSession_consoleLog2, METH_VARARGS, NULL}, + { "CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL}, + { "console_log", _wrap_console_log, METH_VARARGS, NULL}, + { "console_log2", _wrap_console_log2, METH_VARARGS, NULL}, + { "console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL}, + { "msleep", _wrap_msleep, METH_VARARGS, NULL}, + { "bridge", _wrap_bridge, METH_VARARGS, NULL}, + { "hanguphook", _wrap_hanguphook, METH_VARARGS, NULL}, + { "dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL}, + { "new_Session", _wrap_new_Session, METH_VARARGS, NULL}, + { "delete_Session", _wrap_delete_Session, METH_VARARGS, NULL}, + { "Session_begin_allow_threads", _wrap_Session_begin_allow_threads, METH_VARARGS, NULL}, + { "Session_end_allow_threads", _wrap_Session_end_allow_threads, METH_VARARGS, NULL}, + { "Session_check_hangup_hook", _wrap_Session_check_hangup_hook, METH_VARARGS, NULL}, + { "Session_destroy", _wrap_Session_destroy, METH_VARARGS, NULL}, + { "Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback, METH_VARARGS, NULL}, + { "Session_setInputCallback", _wrap_Session_setInputCallback, METH_VARARGS, NULL}, + { "Session_unsetInputCallback", _wrap_Session_unsetInputCallback, METH_VARARGS, NULL}, + { "Session_setHangupHook", _wrap_Session_setHangupHook, METH_VARARGS, NULL}, + { "Session_ready", _wrap_Session_ready, METH_VARARGS, NULL}, + { "Session_cb_function_set", _wrap_Session_cb_function_set, METH_VARARGS, NULL}, + { "Session_cb_function_get", _wrap_Session_cb_function_get, METH_VARARGS, NULL}, + { "Session_cb_arg_set", _wrap_Session_cb_arg_set, METH_VARARGS, NULL}, + { "Session_cb_arg_get", _wrap_Session_cb_arg_get, METH_VARARGS, NULL}, + { "Session_hangup_func_set", _wrap_Session_hangup_func_set, METH_VARARGS, NULL}, + { "Session_hangup_func_get", _wrap_Session_hangup_func_get, METH_VARARGS, NULL}, + { "Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set, METH_VARARGS, NULL}, + { "Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get, METH_VARARGS, NULL}, + { "Session_setPython", _wrap_Session_setPython, METH_VARARGS, NULL}, + { "Session_setSelf", _wrap_Session_setSelf, METH_VARARGS, NULL}, + { "Session_swigregister", Session_swigregister, METH_VARARGS, NULL}, + { NULL, NULL, 0, NULL } +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static void *_p_PYTHON__SessionTo_p_CoreSession(void *x, int *SWIGUNUSEDPARM(newmemory)) { + return (void *)((CoreSession *) ((PYTHON::Session *) x)); +} +static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_PYTHON__Session = {"_p_PYTHON__Session", "PYTHON::Session *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_switch_event_node_t = {"_p_p_switch_event_node_t", "switch_event_node_t **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_call_cause_t = {"_p_switch_call_cause_t", "switch_call_cause_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_event_types_t = {"_p_switch_event_types_t", "switch_event_types_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_state_handler_table_t = {"_p_switch_state_handler_table_t", "switch_state_handler_table_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_API, + &_swigt__p_CoreSession, + &_swigt__p_DTMF, + &_swigt__p_Event, + &_swigt__p_EventConsumer, + &_swigt__p_IVRMenu, + &_swigt__p_PYTHON__Session, + &_swigt__p_Stream, + &_swigt__p_char, + &_swigt__p_input_callback_state, + &_swigt__p_int, + &_swigt__p_p_switch_event_node_t, + &_swigt__p_session_flag_t, + &_swigt__p_switch_call_cause_t, + &_swigt__p_switch_channel_state_t, + &_swigt__p_switch_channel_t, + &_swigt__p_switch_core_session_t, + &_swigt__p_switch_event_t, + &_swigt__p_switch_event_types_t, + &_swigt__p_switch_input_args_t, + &_swigt__p_switch_input_type_t, + &_swigt__p_switch_priority_t, + &_swigt__p_switch_queue_t, + &_swigt__p_switch_state_handler_table_t, + &_swigt__p_switch_status_t, + &_swigt__p_switch_stream_handle_t, + &_swigt__p_uint32_t, + &_swigt__p_void, +}; + +static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PYTHON__Session, _p_PYTHON__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_DTMF[] = { {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_EventConsumer[] = { {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_PYTHON__Session[] = { {&_swigt__p_PYTHON__Session, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_switch_event_node_t[] = { {&_swigt__p_p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_call_cause_t[] = { {&_swigt__p_switch_call_cause_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_event_types_t[] = { {&_swigt__p_switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_queue_t[] = { {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_state_handler_table_t[] = { {&_swigt__p_switch_state_handler_table_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_API, + _swigc__p_CoreSession, + _swigc__p_DTMF, + _swigc__p_Event, + _swigc__p_EventConsumer, + _swigc__p_IVRMenu, + _swigc__p_PYTHON__Session, + _swigc__p_Stream, + _swigc__p_char, + _swigc__p_input_callback_state, + _swigc__p_int, + _swigc__p_p_switch_event_node_t, + _swigc__p_session_flag_t, + _swigc__p_switch_call_cause_t, + _swigc__p_switch_channel_state_t, + _swigc__p_switch_channel_t, + _swigc__p_switch_core_session_t, + _swigc__p_switch_event_t, + _swigc__p_switch_event_types_t, + _swigc__p_switch_input_args_t, + _swigc__p_switch_input_type_t, + _swigc__p_switch_priority_t, + _swigc__p_switch_queue_t, + _swigc__p_switch_state_handler_table_t, + _swigc__p_switch_status_t, + _swigc__p_switch_stream_handle_t, + _swigc__p_uint32_t, + _swigc__p_void, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +static swig_const_info swig_const_table[] = { +{0, 0, 0, 0.0, 0, 0}}; + +#ifdef __cplusplus +} +#endif +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned statically to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int init; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + iter=module_head; + do { + if (iter==&swig_module) { + /* Our module is already in the list, so there's nothing more to do. */ + return; + } + iter=iter->next; + } while (iter!= module_head); + + /* otherwise we must add our module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpreters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + /* Python-specific SWIG API */ +#define SWIG_newvarlink() SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) + + /* ----------------------------------------------------------------------------- + * global variable support code. + * ----------------------------------------------------------------------------- */ + + typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; + } swig_globalvar; + + typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; + } swig_varlinkobject; + + SWIGINTERN PyObject * + swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_InternFromString("<Swig global variables>"); +#else + return PyString_FromString("<Swig global variables>"); +#endif + } + + SWIGINTERN PyObject * + swig_varlink_str(swig_varlinkobject *v) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *str = PyUnicode_InternFromString("("); + PyObject *tail; + PyObject *joined; + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + tail = PyUnicode_FromString(var->name); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + if (var->next) { + tail = PyUnicode_InternFromString(", "); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + } + } + tail = PyUnicode_InternFromString(")"); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; +#else + PyObject *str = PyString_FromString("("); + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + PyString_ConcatAndDel(&str,PyString_FromString(var->name)); + if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); + } + PyString_ConcatAndDel(&str,PyString_FromString(")")); +#endif + return str; + } + + SWIGINTERN int + swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { + char *tmp; + PyObject *str = swig_varlink_str(v); + fprintf(fp,"Swig global variables "); + fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str)); + SWIG_Python_str_DelForPy3(tmp); + Py_DECREF(str); + return 0; + } + + SWIGINTERN void + swig_varlink_dealloc(swig_varlinkobject *v) { + swig_globalvar *var = v->vars; + while (var) { + swig_globalvar *n = var->next; + free(var->name); + free(var); + var = n; + } + } + + SWIGINTERN PyObject * + swig_varlink_getattr(swig_varlinkobject *v, char *n) { + PyObject *res = NULL; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->get_attr)(); + break; + } + var = var->next; + } + if (res == NULL && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN int + swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { + int res = 1; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->set_attr)(p); + break; + } + var = var->next; + } + if (res == 1 && !PyErr_Occurred()) { + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); + } + return res; + } + + SWIGINTERN PyTypeObject* + swig_varlink_type(void) { + static char varlink__doc__[] = "Swig var link object"; + static PyTypeObject varlink_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif + (char *)"swigvarlink", /* tp_name */ + sizeof(swig_varlinkobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor) swig_varlink_dealloc, /* tp_dealloc */ + (printfunc) swig_varlink_print, /* tp_print */ + (getattrfunc) swig_varlink_getattr, /* tp_getattr */ + (setattrfunc) swig_varlink_setattr, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc) swig_varlink_str, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + varlink__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + varlink_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + varlink_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&varlink_type) < 0) + return NULL; +#endif + } + return &varlink_type; + } + + /* Create a variable linking object for use later */ + SWIGINTERN PyObject * + SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); + if (result) { + result->vars = 0; + } + return ((PyObject*) result); + } + + SWIGINTERN void + SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v = (swig_varlinkobject *) p; + swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + if (gv) { + size_t size = strlen(name)+1; + gv->name = (char *)malloc(size); + if (gv->name) { + strncpy(gv->name,name,size); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + } + } + v->vars = gv; + } + + SWIGINTERN PyObject * + SWIG_globals(void) { + static PyObject *_SWIG_globals = 0; + if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); + return _SWIG_globals; + } + + /* ----------------------------------------------------------------------------- + * constants/methods manipulation + * ----------------------------------------------------------------------------- */ + + /* Install Constants */ + SWIGINTERN void + SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { + PyObject *obj = 0; + size_t i; + for (i = 0; constants[i].type; ++i) { + switch(constants[i].type) { + case SWIG_PY_POINTER: + obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); + break; + case SWIG_PY_BINARY: + obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); + break; + default: + obj = 0; + break; + } + if (obj) { + PyDict_SetItemString(d, constants[i].name, obj); + Py_DECREF(obj); + } + } + } + + /* -----------------------------------------------------------------------------*/ + /* Fix SwigMethods to carry the callback ptrs when needed */ + /* -----------------------------------------------------------------------------*/ + + SWIGINTERN void + SWIG_Python_FixMethods(PyMethodDef *methods, + swig_const_info *const_table, + swig_type_info **types, + swig_type_info **types_initial) { + size_t i; + for (i = 0; methods[i].ml_name; ++i) { + const char *c = methods[i].ml_doc; + if (!c) continue; + c = strstr(c, "swig_ptr: "); + if (c) { + int j; + swig_const_info *ci = 0; + const char *name = c + 10; + for (j = 0; const_table[j].type; ++j) { + if (strncmp(const_table[j].name, name, + strlen(const_table[j].name)) == 0) { + ci = &(const_table[j]); + break; + } + } + if (ci) { + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; + memcpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; + memcpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; + } + } + } + } + } + } + +#ifdef __cplusplus +} +#endif + +/* -----------------------------------------------------------------------------* + * Partial Init method + * -----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" +#endif + +SWIGEXPORT +#if PY_VERSION_HEX >= 0x03000000 +PyObject* +#else +void +#endif +SWIG_init(void) { + PyObject *m, *d, *md; +#if PY_VERSION_HEX >= 0x03000000 + static struct PyModuleDef SWIG_module = { +# if PY_VERSION_HEX >= 0x03020000 + PyModuleDef_HEAD_INIT, +# else + { + PyObject_HEAD_INIT(NULL) + NULL, /* m_init */ + 0, /* m_index */ + NULL, /* m_copy */ + }, +# endif + (char *) SWIG_name, + NULL, + -1, + SwigMethods, + NULL, + NULL, + NULL, + NULL + }; +#endif + +#if defined(SWIGPYTHON_BUILTIN) + static SwigPyClientData SwigPyObject_clientdata = { + 0, 0, 0, 0, 0, 0, 0 + }; + static PyGetSetDef this_getset_def = { + (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL + }; + static SwigPyGetSet thisown_getset_closure = { + SwigPyObject_own, + SwigPyObject_own + }; + static PyGetSetDef thisown_getset_def = { + (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure + }; + PyTypeObject *builtin_pytype; + int builtin_base_count; + swig_type_info *builtin_basetype; + PyObject *tuple; + PyGetSetDescrObject *static_getset; + PyTypeObject *metatype; + PyTypeObject *swigpyobject; + SwigPyClientData *cd; + PyObject *public_interface, *public_symbol; + PyObject *this_descr; + PyObject *thisown_descr; + PyObject *self = 0; + int i; + + (void)builtin_pytype; + (void)builtin_base_count; + (void)builtin_basetype; + (void)tuple; + (void)static_getset; + (void)self; + + /* Metaclass is used to implement static member variables */ + metatype = SwigPyObjectType(); + assert(metatype); +#endif + + /* Fix SwigMethods to carry the callback ptrs when needed */ + SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); + +#if PY_VERSION_HEX >= 0x03000000 + m = PyModule_Create(&SWIG_module); +#else + m = Py_InitModule((char *) SWIG_name, SwigMethods); +#endif + + md = d = PyModule_GetDict(m); + (void)md; + + SWIG_InitializeModule(0); + +#ifdef SWIGPYTHON_BUILTIN + swigpyobject = SwigPyObject_TypeOnce(); + + SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); + assert(SwigPyObject_stype); + cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; + if (!cd) { + SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; + SwigPyObject_clientdata.pytype = swigpyobject; + } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { + PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); +# if PY_VERSION_HEX >= 0x03000000 + return NULL; +# else + return; +# endif + } + + /* All objects have a 'this' attribute */ + this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); + (void)this_descr; + + /* All objects have a 'thisown' attribute */ + thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); + (void)thisown_descr; + + public_interface = PyList_New(0); + public_symbol = 0; + (void)public_symbol; + + PyDict_SetItemString(md, "__all__", public_interface); + Py_DECREF(public_interface); + for (i = 0; SwigMethods[i].ml_name != NULL; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); + for (i = 0; swig_const_table[i].name != 0; ++i) + SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); +#endif + + SWIG_InstallConstants(d,swig_const_table); + + SWIG_Python_SetConstant(d, "S_HUP",SWIG_From_int(static_cast< int >(S_HUP))); + SWIG_Python_SetConstant(d, "S_FREE",SWIG_From_int(static_cast< int >(S_FREE))); + SWIG_Python_SetConstant(d, "S_RDLOCK",SWIG_From_int(static_cast< int >(S_RDLOCK))); +#if PY_VERSION_HEX >= 0x03000000 + return m; +#else + return; +#endif +} + +#include "mod_python_extra.c" diff --git a/src/mod/languages/mod_python3/python_example.py b/src/mod/languages/mod_python3/python_example.py new file mode 100644 index 0000000000..a4f059a4ab --- /dev/null +++ b/src/mod/languages/mod_python3/python_example.py @@ -0,0 +1,90 @@ +import os +from freeswitch import * + +# HANGUP HOOK +# +# session is a session object +# what is "hangup" or "transfer" +# if you pass an extra arg to setInputCallback then append 'arg' to get that value +# def hangup_hook(session, what, arg): +def hangup_hook(session, what): + + consoleLog("info","hangup hook for %s!!\n\n" % what) + return + + +# INPUT CALLBACK +# +# session is a session object +# what is "dtmf" or "event" +# obj is a dtmf object or an event object depending on the 'what' var. +# if you pass an extra arg to setInputCallback then append 'arg' to get that value +# def input_callback(session, what, obj, arg): +def input_callback(session, what, obj): + + if (what == "dtmf"): + consoleLog("info", what + " " + obj.digit + "\n") + else: + consoleLog("info", what + " " + obj.serialize() + "\n") + return "pause" + +# APPLICATION +# +# default name for apps is "handler" it can be overridden with <modname>::<function> +# session is a session object +# args is all the args passed after the module name +def handler(session, args): + + session.answer() + session.setHangupHook(hangup_hook) + session.setInputCallback(input_callback) + session.execute("playback", session.getVariable("hold_music")) + +# FSAPI CALL FROM CLI, DP HTTP etc +# +# default name for python FSAPI is "fsapi" it can be overridden with <modname>::<function> +# stream is a switch_stream, anything written with stream.write() is returned to the caller +# env is a switch_event +# args is all the args passed after the module name +# session is a session object when called from the dial plan or the string "na" when not. +def fsapi(session, stream, env, args): + + stream.write("w00t!\n" + env.serialize()) + + +# RUN A FUNCTION IN A THREAD +# +# default name for pyrun is "runtime" it can be overridden with <modname>::<function> +# args is all the args passed after the module name +def runtime(args): + + print args + "\n" + +# BIND TO AN XML LOOKUP +# +# default name for binding to an XML lookup is "xml_fetch" it can be overridden with <modname>::<function> +# params a switch_event with all the relevant data about what is being searched for in the XML registry. +# +def xml_fetch(params): + + xml = ''' +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="freeswitch/xml"> + <section name="dialplan" description="RE Dial Plan For FreeSWITCH"> + <context name="default"> + <extension name="generated"> + <condition> + <action application="answer"/> + <action application="playback" data="${hold_music}"/> + </condition> + </extension> + </context> + </section> +</document> +''' + + return xml + + + + From 54becc8d288948f94b0bd4f573b24a0547c0a599 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 28 Sep 2021 20:37:46 +0300 Subject: [PATCH 167/655] [mod_python3] Remove deprecated calls. --- src/mod/languages/mod_python3/mod_python3.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/mod/languages/mod_python3/mod_python3.c b/src/mod/languages/mod_python3/mod_python3.c index 17136e8453..c61c5bb73d 100644 --- a/src/mod/languages/mod_python3/mod_python3.c +++ b/src/mod/languages/mod_python3/mod_python3.c @@ -306,7 +306,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi // invoke the handler switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n"); - result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL); + result = PyObject_CallObject(function, arg); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Finished calling python script \n"); // check the result and print out any errors @@ -429,7 +429,7 @@ static void set_max_recursion_depth(void) PyObject *sysModule = PyImport_ImportModule("sys"); PyObject *setRecursionLimit = PyObject_GetAttrString(sysModule, "setrecursionlimit"); PyObject *recLimit = Py_BuildValue("(i)", newMaxRecursionDepth); - PyObject *setrecursion_result = PyEval_CallObjectWithKeywords(setRecursionLimit, recLimit, (PyObject *) NULL); + PyObject *setrecursion_result = PyObject_CallObject(setRecursionLimit, recLimit); if (setrecursion_result) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set python recursion limit to %d\n", newMaxRecursionDepth); } else { @@ -565,9 +565,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_python_load) // initialize python system Py_Initialize(); - // create GIL and a threadstate - PyEval_InitThreads(); - // save threadstate since it's interp field will be needed // to create new threadstates, and will be needed for shutdown mainThreadState = PyThreadState_Get(); @@ -578,9 +575,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_python_load) // swap out threadstate since the call threads will create // their own and swap in their threadstate PyThreadState_Swap(NULL); - - // release GIL - PyEval_ReleaseLock(); } switch_mutex_init(&THREAD_POOL_LOCK, SWITCH_MUTEX_NESTED, pool); @@ -625,7 +619,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown) pt = nextpt; } PyThreadState_Swap(mainThreadState); - PyEval_ReleaseLock(); switch_yield(1000000); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt); @@ -651,10 +644,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown) mainInterpreterState = mainThreadState->interp; myThreadState = PyThreadState_New(mainInterpreterState); PyThreadState_Swap(myThreadState); - PyEval_ReleaseLock(); Py_Finalize(); - PyEval_ReleaseLock(); return SWITCH_STATUS_UNLOAD; From a4603c7cb8e2768cf1c4a253239f1339e91fb70e Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 6 Oct 2021 21:32:23 +0300 Subject: [PATCH 168/655] [Packaging] Fix a conflict between freeswitch-mod-python and freeswitch-mod-python3 Debian packages --- debian/freeswitch-mod-python.install.tmpl | 2 +- debian/freeswitch-mod-python3.install.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/freeswitch-mod-python.install.tmpl b/debian/freeswitch-mod-python.install.tmpl index 7f855822a1..9aef46eea1 100644 --- a/debian/freeswitch-mod-python.install.tmpl +++ b/debian/freeswitch-mod-python.install.tmpl @@ -1 +1 @@ -/usr/lib/python*/*-packages/freeswitch.py +/usr/lib/python2*/*-packages/freeswitch.py diff --git a/debian/freeswitch-mod-python3.install.tmpl b/debian/freeswitch-mod-python3.install.tmpl index 7f855822a1..9eae642fb6 100644 --- a/debian/freeswitch-mod-python3.install.tmpl +++ b/debian/freeswitch-mod-python3.install.tmpl @@ -1 +1 @@ -/usr/lib/python*/*-packages/freeswitch.py +/usr/lib/python3*/*-packages/freeswitch.py From 46efa0cdb8e1f61458a62a1d181df2c2bb360258 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 21 Sep 2021 22:49:04 +0300 Subject: [PATCH 169/655] [Build-System] Add Bullseye to the Debian packaging --- debian/bootstrap.sh | 6 +++--- debian/control-modules | 4 +++- debian/util.sh | 12 ++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index b566bc26d9..61098cb11a 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -29,7 +29,7 @@ conf_dir="../conf" lang_dir="../conf/vanilla/lang" fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media." mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="." -supported_debian_distros="wheezy jessie stretch buster sid" +supported_debian_distros="wheezy jessie stretch buster bullseye sid" supported_ubuntu_distros="trusty utopic xenial" supported_distros="$supported_debian_distros $supported_ubuntu_distros" avoid_mods=( @@ -299,7 +299,7 @@ print_source_control () { esac local debhelper_dep="debhelper (>= 8.0.0)" if [ ${use_sysvinit} = "false" ]; then - debhelper_dep=${debhelper_dep}", dh-systemd" + debhelper_dep=${debhelper_dep}", dh-systemd | debhelper (>= 8.0.0)" fi cat <<EOF Source: freeswitch @@ -325,7 +325,7 @@ Build-Depends: # configure options libssl1.0-dev | libssl-dev, unixodbc-dev, libpq-dev, libncurses5-dev, libjpeg62-turbo-dev | libjpeg-turbo8-dev | libjpeg62-dev | libjpeg8-dev, - python-dev, python3-dev, python-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5), + python-dev | python-dev-is-python2, python3-dev, python-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5), # documentation doxygen, # for APR (not essential for build) diff --git a/debian/control-modules b/debian/control-modules index 24c89d3e39..a3b53790a4 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -492,6 +492,7 @@ Description: Adds mod_verto. Adds mod_verto. Build-Depends: libperl-dev Build-Depends-Buster: libperl-dev, libgdbm-compat-dev +Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev ## mod/event_handlers @@ -665,11 +666,12 @@ Description: mod_perl Adds mod_perl. Build-Depends: libperl-dev Build-Depends-Buster: libperl-dev, libgdbm-compat-dev +Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev Module: languages/mod_python Description: mod_python Adds mod_python. -Build-Depends: python-dev +Build-Depends: python-dev | python-dev-is-python2 Module: languages/mod_python3 Description: mod_python3 diff --git a/debian/util.sh b/debian/util.sh index 88cee7949b..6a5d8f27da 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -46,9 +46,9 @@ find_distro () { case "$1" in experimental) echo "sid";; unstable) echo "sid";; - testing) echo "buster";; - stable) echo "stretch";; - oldstable) echo "jessie";; + testing) echo "bullseye";; + stable) echo "buster";; + oldstable) echo "stretch";; *) echo "$1";; esac } @@ -56,9 +56,9 @@ find_distro () { find_suite () { case "$1" in sid) echo "unstable";; - buster) echo "testing";; - stretch) echo "stable";; - jessie) echo "oldstable";; + bullseye) echo "testing";; + buster) echo "stable";; + stretch) echo "oldstable";; *) echo "$1";; esac } From 2505b45134f2a45403c41ff1a910f32061d1874e Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 22 Sep 2021 20:14:53 +0300 Subject: [PATCH 170/655] [mod_skinny, mod_cdr_mongodb, mod_rayo] Fix Debian 11 build warnings. --- src/mod/endpoints/mod_skinny/mod_skinny.c | 2 +- src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c | 2 +- src/mod/event_handlers/mod_rayo/Makefile.am | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 0274912ad2..3df1290047 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -2414,7 +2414,7 @@ static switch_status_t load_skinny_config(void) char *val = (char *) switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "firmware-version")) { - strncpy(params->firmware_version, val, 16); + snprintf(params->firmware_version, 16, "%s", val); } } /* param */ switch_core_hash_insert(profile->device_type_params_hash, id_str, params); diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c index 77870b3dc2..19110f2e66 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c @@ -438,7 +438,7 @@ static void mongo_replset_add_node( mongo_host_port **list, const char *host, in mongo_host_port *host_port = bson_malloc( sizeof( mongo_host_port ) ); host_port->port = port; host_port->next = NULL; - strncpy( host_port->host, host, sizeof(host_port->host) - 1 ); + snprintf(host_port->host, sizeof(host_port->host), "%s", host); if( *list == NULL ) *list = host_port; diff --git a/src/mod/event_handlers/mod_rayo/Makefile.am b/src/mod/event_handlers/mod_rayo/Makefile.am index f2b7178094..a9ca95d51b 100644 --- a/src/mod/event_handlers/mod_rayo/Makefile.am +++ b/src/mod/event_handlers/mod_rayo/Makefile.am @@ -27,17 +27,17 @@ noinst_PROGRAMS = test/test_iks test/test_nlsml test/test_srgs test_test_iks_SOURCES = test/test_iks.c test_test_iks_CFLAGS = $(AM_CFLAGS) -I. -I$(switch_builddir)/libs/iksemel/include $(PCRE_CFLAGS) -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" test_test_iks_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) -test_test_iks_LDADD = librayomod.la $(IKS_LA) $(PCRE_LIBS) +test_test_iks_LDADD = librayomod.la $(IKS_LA) $(PCRE_LIBS) $(switch_builddir)/libfreeswitch.la test_test_nlsml_SOURCES = test/test_nlsml.c test_test_nlsml_CFLAGS = $(AM_CFLAGS) -I. -I$(switch_builddir)/libs/iksemel/include $(PCRE_CFLAGS) -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" test_test_nlsml_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) -test_test_nlsml_LDADD = librayomod.la $(IKS_LA) $(PCRE_LIBS) +test_test_nlsml_LDADD = librayomod.la $(IKS_LA) $(PCRE_LIBS) $(switch_builddir)/libfreeswitch.la test_test_srgs_SOURCES = test/test_srgs.c test_test_srgs_CFLAGS = $(AM_CFLAGS) -I. -I$(switch_builddir)/libs/iksemel/include $(PCRE_CFLAGS) -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" test_test_srgs_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) -test_test_srgs_LDADD = librayomod.la $(IKS_LA) $(PCRE_LIBS) +test_test_srgs_LDADD = librayomod.la $(IKS_LA) $(PCRE_LIBS) $(switch_builddir)/libfreeswitch.la TESTS = $(noinst_PROGRAMS) From e9fde845de5b8885282bf5e70f4be3645c5c3e9b Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 22 Sep 2021 19:13:24 +0300 Subject: [PATCH 171/655] [mod_cv] Replace deprecated definitions and update configure.ac to check renamed opencv4.pc on Debian Bullseye. --- configure.ac | 4 +++- src/mod/applications/mod_cv/mod_cv.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index ab3192e597..150773412d 100644 --- a/configure.ac +++ b/configure.ac @@ -1408,7 +1408,9 @@ PKG_CHECK_MODULES([VLC], [libvlc >= 2.1.0],[ PKG_CHECK_MODULES([OPENCV], [opencv >= 2.4.5],[ AM_CONDITIONAL([HAVE_OPENCV],[true])],[ - AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPENCV],[false])]) + PKG_CHECK_MODULES([OPENCV], [opencv4 >= 2.4.5],[ + AM_CONDITIONAL([HAVE_OPENCV],[true])],[ + AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPENCV],[false])])]) PKG_CHECK_MODULES([OPUSFILE_DECODE], [opusfile >= 0.5],[ AM_CONDITIONAL([HAVE_OPUSFILE_DECODE],[true])],[ diff --git a/src/mod/applications/mod_cv/mod_cv.cpp b/src/mod/applications/mod_cv/mod_cv.cpp index 582f925abf..800452dd9a 100644 --- a/src/mod/applications/mod_cv/mod_cv.cpp +++ b/src/mod/applications/mod_cv/mod_cv.cpp @@ -37,7 +37,7 @@ #include <switch.h> -#include "highgui.h" +#include "opencv2/highgui/highgui_c.h" #include <stdio.h> #include <stdlib.h> #include <ctype.h> @@ -596,9 +596,9 @@ void detectAndDraw(cv_context_t *context) context->cascade->detectMultiScale( smallImg, detectedObjs, context->search_scale, context->neighbors, 0 - |CV_HAAR_FIND_BIGGEST_OBJECT - |CV_HAAR_DO_ROUGH_SEARCH - |CV_HAAR_SCALE_IMAGE + |CASCADE_FIND_BIGGEST_OBJECT + |CASCADE_DO_ROUGH_SEARCH + |CASCADE_SCALE_IMAGE , Size(context->max_search_w, context->max_search_h) ); @@ -679,7 +679,7 @@ void detectAndDraw(cv_context_t *context) //|CV_HAAR_FIND_BIGGEST_OBJECT //|CV_HAAR_DO_ROUGH_SEARCH //|CV_HAAR_DO_CANNY_PRUNING - |CV_HAAR_SCALE_IMAGE + |CASCADE_SCALE_IMAGE , Size(30, 30) ); @@ -690,7 +690,7 @@ void detectAndDraw(cv_context_t *context) //printf("WTF %d\n", object_neighbors); //cout << "Detected " << object_neighbors << " object neighbors" << endl; const int rect_height = cvRound((float)img.rows * object_neighbors / max_neighbors); - CvScalar col = CV_RGB((float)255 * object_neighbors / max_neighbors, 0, 0); + cv:Scalar col = CV_RGB((float)255 * object_neighbors / max_neighbors, 0, 0); rectangle(img, cvPoint(0, img.rows), cvPoint(img.cols/10, img.rows - rect_height), col, -1); parse_stats(&context->nestDetected, nestedObjects.size(), context->skip); From f8d8e740cc890b8bb211b7e7ef9b85a79c18ee85 Mon Sep 17 00:00:00 2001 From: Kevin Garabedian <55750465+kevingarabedian2@users.noreply.github.com> Date: Thu, 14 Oct 2021 15:56:54 -0400 Subject: [PATCH 172/655] [core] play_and_collect_input() - suppress digit timer if start of speech is detected --- src/switch_ivr_play_say.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index a8cb5fd4a1..e8beea1153 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -3191,6 +3191,7 @@ typedef struct { const char *terminators; char terminator; switch_time_t last_digit_time; + switch_bool_t is_speech; } switch_collect_input_state_t; static switch_status_t switch_collect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *data, unsigned int len) @@ -3239,18 +3240,21 @@ static switch_status_t switch_collect_input_callback(switch_core_session_t *sess if (!strcasecmp(speech_type, "begin-speaking")) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "(%s) START OF SPEECH\n", switch_channel_get_name(channel)); + state->is_speech = SWITCH_TRUE; if (switch_test_flag(state, SWITCH_COLLECT_INPUT_PROMPT)) { /* barge in on prompt */ return SWITCH_STATUS_BREAK; } } - } if (switch_test_flag(state, SWITCH_COLLECT_INPUT_DIGITS) && input_type == SWITCH_INPUT_TYPE_DTMF) { switch_dtmf_t *dtmf = (switch_dtmf_t *) input; state->last_digit_time = switch_micro_time_now(); + state->is_speech = SWITCH_FALSE; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = false; SWITCH_INPUT_TYPE_DTMF; last_digit_time=%lu\n", state->last_digit_time); if (!zstr(state->terminators) && strchr(state->terminators, dtmf->digit)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) ACCEPT TERMINATOR %c\n", @@ -3426,18 +3430,27 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_se continue; } - sleep_time = (switch_micro_time_now() - state.last_digit_time) / 1000; - if (sleep_time >= digit_timeout) { - // too much time since last digit - if (!switch_test_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) INTER-DIGIT TIMEOUT\n", switch_channel_get_name(channel)); - switch_set_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE); + if (state.is_speech == SWITCH_FALSE) { + + // calculating how much time has elapsed since the last digit was collected + sleep_time = (switch_micro_time_now() - state.last_digit_time) / 1000; + + if (sleep_time >= digit_timeout) { + // too much time since last digit + if (!switch_test_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, " (%s) INTER-DIGIT TIMEOUT is_speech = false; sleep_time >= digit_timeout; sleep_time=%i; last_digit_time=%lu; digit_timeout=%lu \n", switch_channel_get_name(channel), sleep_time, state.last_digit_time, (unsigned long)digit_timeout); + switch_set_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = false; sleep_time >= digit_timeout; sleep_time=%i; last_digit_time=%lu; digit_timeout=%lu \n", sleep_time, state.last_digit_time, (unsigned long)digit_timeout); + } + status = SWITCH_STATUS_SUCCESS; + sleep_time = digit_timeout; + } else { + // woke up early, sleep for remaining digit timeout + sleep_time = digit_timeout - sleep_time; } - status = SWITCH_STATUS_SUCCESS; - sleep_time = digit_timeout; } else { - // woke up early, sleep for remaining digit timeout - sleep_time = digit_timeout - sleep_time; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = true; sleep_time < digit_timeout; sleep_time=%i; last_digit_time=%lu; digit_timeout=%lu \n", sleep_time, state.last_digit_time, (unsigned long)digit_timeout); } if (status != SWITCH_STATUS_BREAK && status != SWITCH_STATUS_SUCCESS) { From 37ab323c13ca95a2abefc7e1af863402d5a4307f Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Thu, 12 Mar 2020 14:41:31 +0000 Subject: [PATCH 173/655] [mod_opusfile] add ogg/opus streams, fix Makefile for encoding. [mod_opusfile] add stats, opusctl [mod_opusfile] add unit-test using teletone --- src/mod/formats/mod_opusfile/Makefile.am | 6 + src/mod/formats/mod_opusfile/mod_opusfile.c | 725 +++++++++++++++++- .../formats/mod_opusfile/test/freeswitch.xml | 1 + .../audiocheck.net_sin_1000Hz_-3dBFS_6s.opus | Bin 0 -> 74858 bytes .../audiocheck.net_sin_1000Hz_-3dBFS_6s.wav | Bin 0 -> 576046 bytes .../test/sounds/opusfile-test-ogg.bitstream | Bin 0 -> 31381 bytes .../formats/mod_opusfile/test/test_opusfile.c | 193 +++++ 7 files changed, 905 insertions(+), 20 deletions(-) create mode 100644 src/mod/formats/mod_opusfile/test/sounds/audiocheck.net_sin_1000Hz_-3dBFS_6s.opus create mode 100644 src/mod/formats/mod_opusfile/test/sounds/audiocheck.net_sin_1000Hz_-3dBFS_6s.wav create mode 100644 src/mod/formats/mod_opusfile/test/sounds/opusfile-test-ogg.bitstream diff --git a/src/mod/formats/mod_opusfile/Makefile.am b/src/mod/formats/mod_opusfile/Makefile.am index 7c776f9d56..6f4919c5b2 100644 --- a/src/mod/formats/mod_opusfile/Makefile.am +++ b/src/mod/formats/mod_opusfile/Makefile.am @@ -22,6 +22,12 @@ noinst_PROGRAMS = test/test_opusfile test_test_opusfile_SOURCES = test/test_opusfile.c test_test_opusfile_CFLAGS = $(AM_CFLAGS) -I./ -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(OPUSFILE_DECODE_CFLAGS) test_test_opusfile_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) $(OPUSFILE_DECODE_LIBS) + +if HAVE_OPUSFILE_ENCODE +test_test_opusfile_CFLAGS += $(OPUSFILE_ENCODE_CFLAGS) -DHAVE_OPUSFILE_ENCODE +test_test_opusfile_LDFLAGS += $(OPUSFILE_ENCODE_LIBS) +endif + test_test_opusfile_LDADD = libopusfilemod.la $(switch_builddir)/libfreeswitch.la TESTS = $(noinst_PROGRAMS) diff --git a/src/mod/formats/mod_opusfile/mod_opusfile.c b/src/mod/formats/mod_opusfile/mod_opusfile.c index 25246a7ced..ea932ed0ff 100644 --- a/src/mod/formats/mod_opusfile/mod_opusfile.c +++ b/src/mod/formats/mod_opusfile/mod_opusfile.c @@ -42,6 +42,18 @@ #define DEFAULT_RATE 48000 /* default fullband */ #define OPUS_MAX_PCM 5760 /* opus recommended max output buf */ +#define OPUSSTREAM_MAX 64*1024 +#define OGG_MIN_PAGE_SIZE 2400 // this much data buffered before trying to open the incoming stream +#define OGG_MAX_PAGE_SIZE 65307 // a bit less than 64k, standard ogg + +#define PAGES_PER_SEC 4 + +//#define LIMIT_DROP + +#ifdef LIMIT_DROP +#define MIN_OGG_PAYLOAD 40 // drop incoming frames smaller than this (decoder) +#endif + //#undef HAVE_OPUSFILE_ENCODE /*don't encode anything */ SWITCH_MODULE_LOAD_FUNCTION(mod_opusfile_load); @@ -87,6 +99,53 @@ struct opus_file_context { typedef struct opus_file_context opus_file_context; +struct opus_stream_context { + switch_file_t *fd; + OggOpusFile *of; + ogg_int64_t duration; + int output_seekable; + ogg_int64_t pcm_offset; + ogg_int64_t pcm_print_offset; + ogg_int64_t next_pcm_offset; + opus_int64 raw_offset; + ogg_int64_t nsamples; + opus_int32 bitrate; + int li; + int prev_li; + switch_mutex_t *audio_mutex; + switch_buffer_t *audio_buffer; + switch_mutex_t *ogg_mutex; + switch_buffer_t *ogg_buffer; + unsigned char ogg_data[OGG_MAX_PAGE_SIZE * 2]; + unsigned int ogg_data_len; + switch_bool_t read_stream; + switch_bool_t dec_page_ready; + opus_int16 decode_buf[OPUS_MAX_PCM]; + switch_bool_t eof; + switch_thread_rwlock_t *rwlock; + switch_file_handle_t *handle; + size_t samplerate; + int frame_size; + int dec_channels; + size_t err; + opus_int16 *opusbuf; + switch_size_t opusbuflen; +#ifdef HAVE_OPUSFILE_ENCODE + OggOpusEnc *enc; + OggOpusComments *comments; + unsigned char encode_buf[OPUSSTREAM_MAX]; + int encoded_buflen; + size_t samples_encode; + int enc_channels; + unsigned int enc_pagecount; +#endif + unsigned int dec_count; + switch_thread_t *read_stream_thread; + switch_memory_pool_t *pool; +}; + +typedef struct opus_stream_context opus_stream_context_t; + static struct { int debug; } globals; @@ -169,7 +228,6 @@ static switch_status_t switch_opusfile_open(switch_file_handle_t *handle, const { opus_file_context *context; char *ext; - unsigned int flags = 0; int ret; if ((ext = strrchr(path, '.')) == 0) { @@ -190,22 +248,11 @@ static switch_status_t switch_opusfile_open(switch_file_handle_t *handle, const switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->pool); - if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { - flags |= SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE; - if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND) || switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) { - flags |= SWITCH_FOPEN_READ; - } else { - flags |= SWITCH_FOPEN_TRUNCATE; - } - } - if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) { if (switch_buffer_create_dynamic(&context->audio_buffer, TC_BUFFER_SIZE, TC_BUFFER_SIZE * 2, 0) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); goto err; } - - flags |= SWITCH_FOPEN_READ; } handle->samples = 0; @@ -289,9 +336,9 @@ static switch_status_t switch_opusfile_open(switch_file_handle_t *handle, const ogg_int64_t duration; opus_int64 size; duration = op_pcm_total(context->of, context->li); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO , "[OGG/OPUS File] Duration (samples): %u", (unsigned int)duration); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO , "[OGG/OPUS File] Duration (samples): %u\n", (unsigned int)duration); size = op_raw_total(context->of, context->li); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,"[OGG/OPUS File] Size (bytes): %u", (unsigned int)size); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,"[OGG/OPUS File] Size (bytes): %u\n", (unsigned int)size); } tags = op_tags(context->of, context->li); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS File] Encoded by: %s\n", tags->vendor); @@ -343,7 +390,7 @@ static switch_status_t switch_opusfile_seek(switch_file_handle_t *handle, unsign switch_buffer_zero(context->audio_buffer); ret = op_pcm_seek(context->of, samples); if (globals.debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"[OGG/OPUS File] seek samples: [%u]", (unsigned int)samples); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"[OGG/OPUS File] seek samples: [%u]\n", (unsigned int)samples); } if (ret == 0) { handle->pos = *cur_sample = samples; @@ -416,7 +463,7 @@ static switch_status_t switch_opusfile_write(switch_file_handle_t *handle, void int err; int mapping_family = 0; - opus_file_context *context = handle->private_info; + opus_file_context *context; if (!handle) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error no handle\n"); @@ -443,17 +490,19 @@ static switch_status_t switch_opusfile_write(switch_file_handle_t *handle, void } if (globals.debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"[OGG/OPUS File] write nsamples: [%d]", (int)nsamples); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"[OGG/OPUS File] write nsamples: [%d]\n", (int)nsamples); } err = ope_encoder_write(context->enc, (opus_int16 *)data, nsamples); if (err != OPE_OK) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS File] Can't encode. err: [%d] [%s]", err, ope_strerror(err)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS File] Can't encode. err: [%d] [%s]\n", err, ope_strerror(err)); return SWITCH_STATUS_FALSE; } handle->sample_count += *len; +#else + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "[OGG/OPUS File] Encoding support not built-in, build the module with libopusenc!\n"); #endif return SWITCH_STATUS_SUCCESS; } @@ -479,7 +528,7 @@ SWITCH_STANDARD_API(mod_opusfile_debug) globals.debug = 1; stream->write_function(stream, "OPUSFILE Debug: on\n"); #ifdef HAVE_OPUSFILE_ENCODE - stream->write_function(stream, "Library version (encoding): %s\n", ope_get_version_string()); + stream->write_function(stream, "Library version (encoding): %s ABI: %s\n", ope_get_version_string(), ope_get_abi_version()); #endif } else if (!strcasecmp(cmd, "off")) { globals.debug = 0; @@ -491,6 +540,603 @@ SWITCH_STANDARD_API(mod_opusfile_debug) return SWITCH_STATUS_SUCCESS; } +static switch_status_t switch_opusstream_set_initial(opus_stream_context_t *context) +{ + /* https://www.opus-codec.org/docs/opusfile_api-0.5/group__stream__info.html#ga9272a4a6ac9e01fbc549008f5ff58b4c */ + + if (context->of) { + int ret; + /* docs: "Obtain the PCM offset of the next sample to be read. " */ + ret = op_pcm_tell(context->of); + if (ret != OP_EINVAL) { + context->pcm_offset = ret; + } + context->pcm_print_offset = context->pcm_offset - context->samplerate; + + /* docs: "Obtain the current value of the position indicator for _of." */ + ret = op_raw_tell(context->of); + if (ret != OP_EINVAL) { + context->raw_offset = ret; + } + + /* docs: "Get the channel count of the given link in a (possibly-chained) Ogg Opus stream. " */ + context->dec_channels = op_channel_count(context->of, -1); + if (context->dec_channels == 0) { + context->dec_channels = 1; + } + + context->samplerate = DEFAULT_RATE; + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + +static switch_status_t switch_opusstream_stream_info(opus_stream_context_t *context) +{ + const OpusHead *head; + const OpusTags *tags; + opus_int32 bitrate; + + if (context->of) { + + /* docs: "Get the serial number of the given link in a (possibly-chained) Ogg Opus stream. "*/ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS Stream Decode] SerialNO: [%u]\n", op_serialno(context->of, -1)); + bitrate = op_bitrate_instant(context->of); + if (bitrate > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS Stream Decode] Bitrate: [%d]\n", bitrate); + } + + if(context->pcm_offset!=0){ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] Non-zero starting PCM offset: [%li]\n", + (long)context->pcm_offset); + } + + /* docs: "Retrieve the index of the current link." */ + context->li = op_current_link(context->of); + + /* docs: "Get the ID header information for the given link in a (possibly chained) Ogg Opus stream. " */ + head = op_head(context->of, context->li); + if (head) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS Stream Decode] Channels: [%i]\n", head->channel_count); + if (head->input_sample_rate) { + context->samplerate = head->input_sample_rate; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS Stream Decode] Original sampling rate: [%lu] Hz\n", + (unsigned long)head->input_sample_rate); + } + } + /*docs: "Returns whether or not the data source being read is seekable."*/ + if (op_seekable(context->of)) { + opus_int64 size; + context->duration = op_pcm_total(context->of, context->li); // page duration + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO , "[OGG/OPUS Stream Decode] Duration (samples): [%u]\n", (unsigned int)context->duration); + size = op_raw_total(context->of, context->li); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,"[OGG/OPUS Stream Decode] Size (bytes): [%u]\n", (unsigned int)size); + } + /* docs: "Get the comment header information for the given link in a (possibly chained) Ogg Opus stream." */ + tags = op_tags(context->of, context->li); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS Stream Decode] Encoded by: [%s]\n", tags->vendor); + return SWITCH_STATUS_FALSE; + } + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t switch_opusstream_stream_decode(opus_stream_context_t *context, void *data, int channels) +{ + int ret; + size_t buf_inuse; + switch_status_t status = SWITCH_STATUS_SUCCESS; + + if (!context->of) { + return SWITCH_STATUS_FALSE; + } + memset(context->decode_buf, 0, sizeof(context->decode_buf)); + switch_mutex_lock(context->audio_mutex); + while (!(context->eof)) { + + if (channels == 1) { + ret = op_read(context->of, (opus_int16 *)context->decode_buf, OPUS_MAX_PCM, NULL); + } else if (channels > 1) { + ret = op_read_stereo(context->of, (opus_int16 *)context->decode_buf, OPUS_MAX_PCM); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Stream] Invalid number of channels!\n"); + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + + if (ret < 0) { + switch(ret) { + case OP_HOLE: /* There was a hole in the data, and some samples may have been skipped. Call this function again to continue decoding past the hole.*/ + if (!context->dec_page_ready) { + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Decoder]: incomplete ogg page, will retry\n"); + } + switch_goto_status(SWITCH_STATUS_SUCCESS, end); + } + case OP_EREAD: /*An underlying read operation failed. This may signal a truncation attack from an <https:> source.*/ + + case OP_EFAULT: /* An internal memory allocation failed. */ + + case OP_EIMPL: /*An unseekable stream encountered a new link that used a feature that is not implemented, such as an unsupported channel family.*/ + + case OP_EINVAL: /* The stream was only partially open. */ + + case OP_ENOTFORMAT: /* An unseekable stream encountered a new link that did not have any logical Opus streams in it. */ + + case OP_EBADHEADER: /*An unseekable stream encountered a new link with a required header packet that was not properly formatted, contained illegal values, or was missing altogether.*/ + + case OP_EVERSION: /*An unseekable stream encountered a new link with an ID header that contained an unrecognized version number.*/ + + case OP_EBADPACKET: /*Failed to properly decode the next packet.*/ + + case OP_EBADLINK: /*We failed to find data we had seen before.*/ + + case OP_EBADTIMESTAMP: /*An unseekable stream encountered a new link with a starting timestamp that failed basic validity checks.*/ + + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Decoder]: error decoding stream: [%d]\n", ret); + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + } else if (ret == 0) { + /*The number of samples returned may be 0 if the buffer was too small to store even a single sample for both channels, or if end-of-file was reached*/ + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Decoder]: EOF reached [%d]\n", ret); + } + + context->eof = TRUE; + break; + } else /* (ret > 0)*/ { + /*The number of samples read per channel on success*/ + switch_buffer_write(context->audio_buffer, (opus_int16 *)context->decode_buf, ret * sizeof(opus_int16) * channels); + buf_inuse = switch_buffer_inuse(context->audio_buffer); + + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "[OGG/OPUS Decoder]: Read samples: %d. Wrote bytes to buffer: [%d] bytes in use: [%u] byte pos stream: [%lu]\n", + ret, (int)(ret * sizeof(int16_t) * channels), (unsigned int)buf_inuse, (long unsigned int)op_raw_tell(context->of)); + } + } + } + +end: + context->eof = FALSE; // for next page + + switch_mutex_unlock(context->audio_mutex); + + return status; +} + +static switch_status_t switch_opusstream_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) +{ + struct opus_stream_context *context = NULL; + int encoding, decoding; +#ifdef HAVE_OPUSFILE_ENCODE + int err; +#endif + + encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); + decoding = (flags & SWITCH_CODEC_FLAG_DECODE); + + if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(struct opus_stream_context))))) { + return SWITCH_STATUS_FALSE; + } else { + + memset(context, 0, sizeof(struct opus_stream_context)); + codec->private_info = context; + context->pool = codec->memory_pool; + + switch_thread_rwlock_create(&(context->rwlock), context->pool); + + switch_thread_rwlock_rdlock(context->rwlock); + + switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->pool); + switch_mutex_init(&context->ogg_mutex, SWITCH_MUTEX_NESTED, context->pool); + + if (switch_buffer_create_dynamic(&context->audio_buffer, TC_BUFFER_SIZE, TC_BUFFER_SIZE * 2, 0) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); + switch_thread_rwlock_unlock(context->rwlock); + return SWITCH_STATUS_MEMERR; + } + + if (switch_buffer_create_dynamic(&context->ogg_buffer, TC_BUFFER_SIZE, TC_BUFFER_SIZE * 2, 0) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); + switch_thread_rwlock_unlock(context->rwlock); + return SWITCH_STATUS_MEMERR; + } + + context->samplerate = codec->implementation->actual_samples_per_second; + context->frame_size = codec->implementation->actual_samples_per_second * (codec->implementation->microseconds_per_packet / 1000) / 1000; + + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream] frame_size: [%d]\n", (int)context->frame_size); + } +#ifdef HAVE_OPUSFILE_ENCODE + if (encoding) { + if (!context->comments) { + context->comments = ope_comments_create(); + ope_comments_add(context->comments, "METADATA", "Freeswitch/mod_opusfile"); + } + if (!context->enc) { + int mapping_family = 0; + // opus_multistream_surround_encoder_get_size() in libopus will check these + if ((context->enc_channels > 2) && (context->enc_channels <= 8)) { + mapping_family = 1; + } else if ((context->enc_channels > 8) && (context->enc_channels <= 255)) { + // multichannel/multistream mapping family . https://people.xiph.org/~giles/2013/draft-ietf-codec-oggopus.html#rfc.section.5.1.1 + mapping_family = 255; + } + context->enc = ope_encoder_create_pull(context->comments, !context->samplerate?DEFAULT_RATE:context->samplerate, !context->enc_channels?1:context->enc_channels, mapping_family, &err); + + if (!context->enc) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Stream Encode] Can't create stream. err: [%d] [%s]\n", err, ope_strerror(err)); + switch_thread_rwlock_unlock(context->rwlock); + return SWITCH_STATUS_FALSE; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS Stream Encode] Stream opened for encoding\n"); + } + ope_encoder_ctl(context->enc, OPUS_SET_COMPLEXITY_REQUEST, 5); + ope_encoder_ctl(context->enc, OPUS_SET_APPLICATION_REQUEST, OPUS_APPLICATION_VOIP); + } + } +#endif + switch_thread_rwlock_unlock(context->rwlock); + return SWITCH_STATUS_SUCCESS; + } +} + +static switch_status_t switch_opusstream_destroy(switch_codec_t *codec) +{ + struct opus_stream_context *context = codec->private_info; + switch_status_t st; + + switch_thread_rwlock_rdlock(context->rwlock); + + if (context->read_stream_thread) { + switch_thread_join(&st, context->read_stream_thread); + if (st == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Encode/Decode] Joined decoding thread\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Encode/Decode] Can't join decoding thread\n"); + } + } + + if (context->of) { + op_free(context->of); + } + +#ifdef HAVE_OPUSFILE_ENCODE + if (context->enc) { + ope_encoder_destroy(context->enc); + } + if (context->comments) { + ope_comments_destroy(context->comments); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Encode/Decode] Encoded pages: [%u]\n", context->enc_pagecount); +#endif + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Encode/Decode] Decoded chunks: [%u]\n", context->dec_count); + if (context->audio_buffer) { + switch_buffer_destroy(&context->audio_buffer); + } + if (context->ogg_buffer) { + switch_buffer_destroy(&context->ogg_buffer); + } + switch_thread_rwlock_unlock(context->rwlock); + codec->private_info = NULL; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Encode/Decode] Stopped processing\n"); + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t switch_opusstream_encode(switch_codec_t *codec, + switch_codec_t *other_codec, + void *decoded_data, + uint32_t decoded_data_len, + uint32_t decoded_rate, + void *encoded_data, + uint32_t *encoded_data_len, + uint32_t *encoded_rate, + unsigned int *flag) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; +#ifdef HAVE_OPUSFILE_ENCODE + struct opus_stream_context *context = codec->private_info; + size_t nsamples = (int)decoded_data_len / sizeof(int16_t); + int err, ret; + int len = 0; int thres; + unsigned char *decode_buf = decoded_data; + + if (!context) { + return SWITCH_STATUS_FALSE; + } + + globals.debug = 0; + switch_thread_rwlock_rdlock(context->rwlock); + + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "[OGG/OPUS Stream Encode] : switch_opusfile_stream_encode() decoded_data [%x][%x][%x][%x] nsamples: [%d]\n", + decode_buf[0], decode_buf[1], decode_buf[2], decode_buf[3], (int)nsamples); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Encode] stream write nsamples: [%d]\n", (int)nsamples); + } + if (context->enc_channels == 0) { + context->enc_channels = 1; + } + if (!context->samplerate) { + context->samplerate = DEFAULT_RATE; + } + + if (context->enc) { + // we reach here every 20 ms. + // decoded_data - this can be an interleaved buffer, to do multistream. we’ll need the exact number of channels too. + err = ope_encoder_write(context->enc, (opus_int16 *)decoded_data, nsamples / context->enc_channels); + if (err != OPE_OK) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Stream Encode] can't encode, ret: [%d] [%s]\n", err, ope_strerror(err)); + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + context->samples_encode += nsamples; + } + + thres = context->samplerate/PAGES_PER_SEC; + + if (!(context->samples_encode % thres) && context->samples_encode > context->samplerate) { + if (context->enc) { + unsigned char *vb = context->encode_buf; + int req_flush = 1; + /* OPE_EXPORT int ope_encoder_get_page(OggOpusEnc *enc, unsigned char **page, opus_int32 *len, int flush); */ + ret = ope_encoder_get_page(context->enc, &vb, &len, req_flush); + if (ret == 0) { + /* ope_encoder_get_page(): ret is 1 if there is a page available, 0 if not. */ + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Encode] can't retrieve encoded page, page not ready. ret: [%d]\n", ret); + } + switch_goto_status(SWITCH_STATUS_SUCCESS, end); + } else { + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Encode] retrieved page from encoder. ret [%d] len: [%d] [%p]\n", + ret, len, context->encode_buf); + } + if (len > OGG_MAX_PAGE_SIZE) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Stream Encode] retrieved page bigger than ogg max size!\n"); + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + memcpy(encoded_data, vb, len); + *encoded_data_len = len; + context->enc_pagecount++; + switch_thread_rwlock_unlock(context->rwlock); + return SWITCH_STATUS_SUCCESS; + } + } else { + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + } +end: + *encoded_data_len = 0; + switch_thread_rwlock_unlock(context->rwlock); +#else + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "[OGG/OPUS Stream Encode] Encoding support not built-in, build the module with libopusenc!\n"); +#endif + return status; +} + +// decode_stream_cb(): nbytes is OP_READ_SIZE (builtin limit - libopusfile). +// this is being called by op_read() or op_read_stereo() - we’re giving chunks of pages to be decoded. +static int decode_stream_cb(void *dcontext, unsigned char *data, int nbytes) +{ + opus_stream_context_t *context = (opus_stream_context_t *)dcontext; + unsigned int ret = 0; + + if (!context) { + return 0; + } + + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode CB called: context: %p data: %p packet_len: %d\n", + (void *)context, data, nbytes); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode_stream_cb(): switch_thread_self(): %lx\n", switch_thread_self()); + } + + switch_mutex_lock(context->ogg_mutex); + ret = switch_buffer_read(context->ogg_buffer, context->ogg_data, nbytes); + if (ret == 0) { + data = NULL; + switch_mutex_unlock(context->ogg_mutex); + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] No data. Wanted: [%d] bytes\n", nbytes); + } + return ret; + } + context->dec_count++; + memcpy(data, context->ogg_data, ret); + + if (switch_buffer_inuse(context->ogg_buffer)) { + context->dec_page_ready = 0; + } else { + context->dec_page_ready = 1; + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] buffer is empty, all pages passed to the decoder\n"); + } + + } + switch_mutex_unlock(context->ogg_mutex); + + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode_stream_cb(): ret: %u\n", ret); + } + return ret; +} + +const OpusFileCallbacks cb={decode_stream_cb, NULL, NULL, NULL}; + +static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj) +{ + opus_stream_context_t *context = (opus_stream_context_t *) obj; + int err = 0; + OggOpusFile *temp_of = NULL; + int buffered_ogg_bytes; + + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] read_stream_thread(): switch_thread_self(): 0x%lx\n", switch_thread_self()); + } + switch_thread_rwlock_rdlock(context->rwlock); + + if ((buffered_ogg_bytes = switch_buffer_inuse(context->ogg_buffer))) { + if (buffered_ogg_bytes <= OGG_MAX_PAGE_SIZE) { + switch_buffer_peek(context->ogg_buffer, context->ogg_data, buffered_ogg_bytes); + context->ogg_data_len = buffered_ogg_bytes; + } + } + + /* https://mf4.xiph.org/jenkins/view/opus/job/opusfile-unix/ws/doc/html/group__stream__open__close.html#gad183ecf5fbec5add3a5ccf1e3b1d2593 */ + /* docs: "Open a stream using the given set of callbacks to access it." */ + temp_of = op_open_callbacks(context, &cb, (const unsigned char *)context->ogg_data, context->ogg_data_len, &err); + if (temp_of && (err == 0)) { + context->dec_page_ready = 1; + context->of = temp_of; + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS Stream Decode] Opened stream, installed decoding callback!\n"); + } + switch_opusstream_set_initial(context); + switch_opusstream_stream_info(context); + } else if (err != 0) { + switch (err) { + case OP_EREAD: + // An underlying read, seek, or tell operation failed when it should have succeeded, or we failed to find data in the stream we had seen before. + case OP_EFAULT: + // There was a memory allocation failure, or an internal library error. + case OP_EIMPL: + // The stream used a feature that is not implemented, such as an unsupported channel family. + case OP_EINVAL: + // seek() was implemented and succeeded on this source, but tell() did not, or the starting position indicator was not equal to _initial_bytes. + case OP_ENOTFORMAT: + // The stream contained a link that did not have any logical Opus streams in it. + case OP_EBADHEADER: + // A required header packet was not properly formatted, contained illegal values, or was missing altogether. + case OP_EVERSION: + // An ID header contained an unrecognized version number. + case OP_EBADLINK: + // We failed to find data we had seen before after seeking. + case OP_EBADTIMESTAMP: + // The first or last timestamp in a link failed basic validity checks + default: + context->dec_page_ready = 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Stream Decode] error opening stream: [%d]\n", err); + } + } + + switch_thread_rwlock_unlock(context->rwlock); + return NULL; +} + +static void launch_read_stream_thread(opus_stream_context_t *context) +{ + switch_threadattr_t *thd_attr = NULL; + + switch_threadattr_create(&thd_attr, context->pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&context->read_stream_thread, thd_attr, read_stream_thread, context, context->pool); +} + +static switch_status_t switch_opusstream_decode(switch_codec_t *codec, + switch_codec_t *other_codec, + void *encoded_data, + uint32_t encoded_data_len, + uint32_t encoded_rate, + void *decoded_data, + uint32_t *decoded_data_len, + uint32_t *decoded_rate, + unsigned int *flag) +{ + struct opus_stream_context *context = codec->private_info; + size_t bytes = 0; + int ogg_bytes = OGG_MIN_PAGE_SIZE; // min page size before trying to open the incoming stream + size_t rb = 0; + unsigned char *encode_buf = encoded_data; + size_t buffered_ogg_bytes = 0; + switch_status_t status = SWITCH_STATUS_SUCCESS; + + if (!context) { + return SWITCH_STATUS_FALSE; + } + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "[OGG/OPUS Stream Decode] : switch_opusstream_decode() encoded_data [%x][%x][%x][%x] encoded_data_len: [%u]\n", + encode_buf[0], encode_buf[1], encode_buf[2], encode_buf[3], encoded_data_len); + } +#ifdef LIMIT_DROP + if ((encoded_data_len <= MIN_OGG_PAYLOAD) && (encoded_data_len > 0)) { + *decoded_data_len = 0; + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] switch_opusstream_decode(): drop [%u]", (unsigned int)encoded_data_len); + } + return SWITCH_STATUS_SUCCESS; + } +#endif + + switch_thread_rwlock_rdlock(context->rwlock); + memset(context->ogg_data, 0, sizeof(context->ogg_data)); + if (encoded_data_len <= SWITCH_RECOMMENDED_BUFFER_SIZE) { + switch_mutex_lock(context->ogg_mutex); + switch_buffer_write(context->ogg_buffer, encode_buf, encoded_data_len); + + if ((buffered_ogg_bytes = switch_buffer_inuse(context->ogg_buffer)) >= ogg_bytes) { + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "[OGG/OPUS Stream Decode] switch_opusstream_decode() encoded_data [%x][%x][%x][%x] encoded_data_len: %u buffered_ogg_bytes: [%u]\n", + encode_buf[0], encode_buf[1], encode_buf[2], encode_buf[3], encoded_data_len, (unsigned int)buffered_ogg_bytes); + } + if (buffered_ogg_bytes <= OGG_MAX_PAGE_SIZE) { + switch_buffer_peek(context->ogg_buffer, context->ogg_data, buffered_ogg_bytes); + context->ogg_data_len = buffered_ogg_bytes; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Stream Decode] buffered ogg data bigger than max OGG page size, will flush\n"); + *decoded_data_len = 0; + switch_buffer_zero(context->ogg_buffer); + switch_mutex_unlock(context->ogg_mutex); + switch_goto_status(SWITCH_STATUS_SUCCESS, end); + } + } + + switch_mutex_unlock(context->ogg_mutex); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "[OGG/OPUS Stream Decode] too much data to buffer, flushing buffer!\n"); + *decoded_data_len = 0; + switch_buffer_zero(context->ogg_buffer); + switch_goto_status(SWITCH_STATUS_SUCCESS, end); + } + + if ((buffered_ogg_bytes >= ogg_bytes) && encoded_data_len) { + + if (!(op_test(NULL, context->ogg_data, buffered_ogg_bytes))) { + if (!context->read_stream && buffered_ogg_bytes > OGG_MIN_PAGE_SIZE) { + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] launching decoding thread\n"); + } + launch_read_stream_thread(context); + context->read_stream = 1; // mark thread started + } + } + } + if (context->of) { + if (switch_opusstream_stream_decode(context, context->ogg_data, context->dec_channels) == SWITCH_STATUS_FALSE) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Stream Decode] Cannot decode stream\n"); + *decoded_data_len = 0; + switch_goto_status(SWITCH_STATUS_FALSE, end); + } + } + switch_mutex_lock(context->audio_mutex); + bytes = switch_buffer_inuse(context->audio_buffer); + rb = switch_buffer_read(context->audio_buffer, decoded_data, context->frame_size * sizeof(int16_t)); + switch_mutex_unlock(context->audio_mutex); + + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] rb (read from audio_buffer): [%d] bytes in audio buffer: [%d]\n", (int)rb, (int)bytes); + } + + *decoded_data_len = rb ; // bytes +end: + + switch_thread_rwlock_unlock(context->rwlock); + return status; +} + /* Registration */ static char *supported_formats[SWITCH_MAX_CODECS] = { 0 }; @@ -499,6 +1145,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opusfile_load) { switch_file_interface_t *file_interface; switch_api_interface_t *commands_api_interface; + switch_codec_interface_t *codec_interface; + int mpf = 10000, spf = 80, bpf = 160, count = 2; + int RATES[] = {8000, 16000, 24000, 48000}; + int i; supported_formats[0] = "opus"; @@ -522,13 +1172,48 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opusfile_load) file_interface->file_set_string = switch_opusfile_set_string; file_interface->file_get_string = switch_opusfile_get_string; - + SWITCH_ADD_CODEC(codec_interface, "OPUSSTREAM"); + + for (i = 0; i < sizeof(RATES) / sizeof(RATES[0]); i++) { +// mono + switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, + 98, /* the IANA code number */ // does not matter + "OPUSSTREAM", /* the IANA code name */ // we just say OPUSSTREAM is an ogg/opus stream + NULL, /* default fmtp to send (can be overridden by the init function) */ + RATES[i], /* samples transferred per second */ // 48000 ! + RATES[i], /* actual samples transferred per second */ + 16 * RATES[i] / 8000, /* bits transferred per second */ + mpf * count, /* number of microseconds per frame */ + spf * RATES[i] / 8000, /* number of samples per frame */ + bpf * RATES[i] / 8000, /* number of bytes per frame decompressed */ + 0, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + 1, /* number of frames per network packet */ + switch_opusstream_init, switch_opusstream_encode, switch_opusstream_decode, switch_opusstream_destroy); +// stereo + switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, + 98, /* the IANA code number */ // does not matter + "OPUSSTREAM", /* the IANA code name */ // we just say OPUSSTREAM is an ogg/opus stream + NULL, /* default fmtp to send (can be overridden by the init function) */ + RATES[i], /* samples transferred per second */ + RATES[i], /* actual samples transferred per second */ + 16 * RATES[i] / 8000 * 2, /* bits transferred per second */ + mpf * count, /* number of microseconds per frame */ + spf * RATES[i] / 8000 * 2, /* number of samples per frame */ + bpf * RATES[i] / 8000 * 2, /* number of bytes per frame decompressed */ + 0, /* number of bytes per frame compressed */ + 2, /* number of channels represented */ + 1, /* number of frames per network packet */ + switch_opusstream_init, switch_opusstream_encode, switch_opusstream_decode, switch_opusstream_destroy); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "mod_opusfile loaded\n"); /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } + /* For Emacs: * Local Variables: * mode:c diff --git a/src/mod/formats/mod_opusfile/test/freeswitch.xml b/src/mod/formats/mod_opusfile/test/freeswitch.xml index 80591e86ac..c1fa064524 100644 --- a/src/mod/formats/mod_opusfile/test/freeswitch.xml +++ b/src/mod/formats/mod_opusfile/test/freeswitch.xml @@ -5,6 +5,7 @@ <modules> <load module="mod_loopback"/> <load module="mod_opusfile"/> + <load module="mod_sndfile"/> </modules> </configuration> </section> diff --git a/src/mod/formats/mod_opusfile/test/sounds/audiocheck.net_sin_1000Hz_-3dBFS_6s.opus b/src/mod/formats/mod_opusfile/test/sounds/audiocheck.net_sin_1000Hz_-3dBFS_6s.opus new file mode 100644 index 0000000000000000000000000000000000000000..e18be2ec6d5567cc6a29505acc50b5b2605c9532 GIT binary patch literal 74858 zcmeEv1zc8nw>8};A>Az<g3@IG(k0zef`oK~fQU3A-5}lF-Cfes-GX#|&jadUO}uwr z=lk8cXB@{F7-#nRuf6wLYwvR&aa~<$5HOHW7oH!n2=JG_<=eQRsNyCTW`f!pk3m6M zL7mGlzC|4P?O!h7w}S%y?kUBK5m0X6x65egnjr%IiHL@!4$B=nmfLiU42-~U!2|rM zZKP%VSo;|l;EP&-FWzPbev!~nU(*=yZ(jb+pZ+r-z~348e+37gQTOnisIIZGx#jd6 zXLt~Bo#TA|WAe(c=f;N4@y`iHM$d`I#?ML4Nzcj7S+~wXPnRaoDb8<Bol~7tO&`R( z4BzD3?MO%D2wFRQ=U<rwkqn(2@Gixmni^s@f=@br6(`$I-4=)D<K6XC4^2or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r>}}hjzMd4cWa8icQ|qM(nH(0o{_RVot1nRS&Ab8*&C3h zFZeCmcfqk3qs==xq?@pX3|=D$ja%tR6Gtct>hKQEd$s3Qi?**fq5^fPseWBzAy*iE zR!<{gONiHBzDo5sG*|t@#hBj4L8D%w!F1VXiwS36isiE>=9b|M;m0c9G*^inf;4EI z?0_4djmorjpSZh3@VsALY|aZEy@@j)?sQ1s9ZQCV7BAhEa_%_KM?Th^JH42DGIT0Q zem!xCBB9sZ_T8w&A(JK&t9jgDj=hA<gHGr^w@v|;fO}TS-3rd;>;Z&v_T{O%ZnrJ< zgtP<$B3H3@^!}}7BOUyT5pR(g5|*9y?D1MJLDMq_up7f*V=LG1NfSc#?6~PJ9byzC zrG2t?vg-k|+xkb>11+)ZfrAmLw2UB+PqMOL7jY;sJ>TCh4tvk$Fr04tiZd#M$sfl( zDB6mHpZa8Fy-$6d&YMBWhB?i;7ekk^Ciq>bxR{F%{BG0x2*Z6nXy>S)@gj_?3N}rl zxZgI!PTUz`6!_#o2)sMr<JqN9WLf*LnW$U71KO|(fs(FW2C3Mww|b28L1z@S)Qm5! z**Nv^NT4i-%&9R9uVju-^9C1WwIze>%Gj*sYVnT-;({#n`^{JIM!ppjrMr7M?wn!8 zA*JY=6N-~<9CN<*OEaig3Jtd=M{Z{M$gh-Wm(ZVT!HL5vjKBmwd!Xyy?rw{b|L18b zG=PyVNR%lpFtaS^nw2bc<6kr{UG_9Uy9?;t*S(Bra}~!Ao)Nb3P_10TIZj&?NB2zG Yx%2F0wwUZy##$NhT-~mc)A>680mp%U-~a#s literal 0 HcmV?d00001 diff --git a/src/mod/formats/mod_opusfile/test/sounds/audiocheck.net_sin_1000Hz_-3dBFS_6s.wav b/src/mod/formats/mod_opusfile/test/sounds/audiocheck.net_sin_1000Hz_-3dBFS_6s.wav new file mode 100644 index 0000000000000000000000000000000000000000..98d4181e47931b5d0cee4ab08a0f023e026b0984 GIT binary patch literal 576046 zcmeI$>vs?49RTo0BtIb{K}u-RWEg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oY84b+}YULm}^lXbZH)Q?d^udx}qyZHOZIPSFfmQs9apRq_VYg zZB=1)^yT+!@~+IOeW$*pab(j+%^~DQy%)VcvMTo19YV+Z;~(iXAYny9dBU-TR}(IG zx}{TM{NcE~4##5C+RcsmsO^C^A&hPL>-CtX_pjd9n9(q?{!ew0y29GO)qYajSo?Hc zm->?W&l-vvE3fuwnsWW^=KU=p3}}-TmDRR?bWL<YOlsuy$o@!Gq%yKE^2f;V$c~sh zW0pjR=xJ>~j{3e$PMbv`gr{1oTb^s_)l%GC(EQux**D@h&F?gCZNAbxwB@OmwJo(R T8Lj!Pi(5Z$t!Ta08p8hoW3;s; literal 0 HcmV?d00001 diff --git a/src/mod/formats/mod_opusfile/test/sounds/opusfile-test-ogg.bitstream b/src/mod/formats/mod_opusfile/test/sounds/opusfile-test-ogg.bitstream new file mode 100644 index 0000000000000000000000000000000000000000..65c3889027c1a98fb155fc352e4564c887c5cc47 GIT binary patch literal 31381 zcmeFZWms146E#XVDBaTC-5?;+-QC?F-Q6YK9nv5mlG5GM(nurHrEmyE`04+B&&TuO zJX~Hra6PbR&wbC#T5IOsl7@z|06+l0UOJ9nm~P+Va-jqPB1&4>*$U}v>j46?0(#cp zeMIv1;}5Ufj|1L(=emf80DOIYb^8l)+J?3?H$O8o*0H?#7MG5i-d)?w%1E1@68G27 z^euF8X{qU{>8R+b4B2#b=vZ`_Z~qML%|CGgIo?;ia=cuxZS?hR9gN@T8qt_r>S^Bo zEdygS{hN>c|F8ew1OMOiz^}+qxwq^#GH#=4UW$YYt<c87!O_9d$-&9V$=S)t(Z%kK zgR4Vwx}%R-QZ=kliTfN_bc)drV1^kE;dlP5xu=cr*=^bI%dbPx*+mlY-Ajw|QF!5u zdH|F~N^(K*iwtEUx}_k{K}N?<Sx0<>&W^+<PP&lch35DoF9r2d605$4QsNSWFjLZ{ zH=5=lkfhnxQB_&<MaEg-wQ_l0>1-{cU{7v)-u&tdsylPR2NtdAIkN!OWku_bpRI2o zGXf6i9?n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_%OM%3DHr z<z#{gg@zZy>AuMvo&G7zV8c(tT*Yp*#JMIZquln6orDc+eWtsay@Tmm@xGrRrIF5e z3rn8Lmn%9@!@B&%p?@=nyZZw0`Ty)#-$AvAq7)qAXSOXnRz={u+ol0@^il$w?guOi z13fO$i-8;ccIGa~&3=@f+OC<24hnRF`82f2@`!lBR!yve-AJo#QqR+l+z`qSvIxq} zTaPm~mvFy?DEW>)<0iu({4fs|TSK)r$%E*={#RMQ6M+B1+kgQt-&Xy%B{=!sH~fkg z`X3QfK}r)lZ+A{|H~2Q63djZVe5w^vR?C8OuDK8zi4{vEsZrRAa)^E05VI%xw$&*l zhqS-yJ6OSy>w=EN2GNZkCuQWAduvfJ=CSPcQq@<TW$ZU#WzFt-T7Tg*Afp#BdIX5j z2w5kO;Ajn=$sS_+=F7UqArhsQ*-o7L6;5$WOu;pDY`fuX`-<zqddw#9QOB1=M~1Fz zdfOb@?@d=En!`hM;nk00MK-6K*LSFoUfoXz`+pA{>~L3fS@DM(h<s{4IVAi}Z2xli zi9Ik7y8mO*eDR-IM*p!`&}p77pc<hrX8viY`?JU9#d_5pdnw-yNwd;2?RaxG@iR0L zO+v&;3<_IV9kHTMj+@fruQ)AfJS(wuIJg}K4)N+Ylr)h!@-3g;1QOo7x7g|N`MOm& zkO@_v=fHMRG0l#-&FS4Hs306@iS=;b1Ci1{_7Hfv?v!4=Zw+{wPlDz+P?ATdp`Kgi zVTySo!7@I|k<ukW9G8HV<`HpM))*2e44_gtWA<)6vP0OoT?KhIne;l0$=kwUDeiXC wetsj3V2L_OW;!2BYev55D&*E}1#hnZQb@o-CF1>}m%riP*F)YHVALq^KSq`uUH||9 literal 0 HcmV?d00001 diff --git a/src/mod/formats/mod_opusfile/test/test_opusfile.c b/src/mod/formats/mod_opusfile/test/test_opusfile.c index 0cb5e8b00b..f21738bdb7 100644 --- a/src/mod/formats/mod_opusfile/test/test_opusfile.c +++ b/src/mod/formats/mod_opusfile/test/test_opusfile.c @@ -32,7 +32,42 @@ #include <stdlib.h> #include <test/switch_test.h> +#include <libteletone_detect.h> +#include <libteletone.h> +//#undef HAVE_OPUSFILE_ENCODE + +#define OGG_MIN_PAGE_SIZE 2400 + +static switch_status_t test_detect_tone_in_file(const char *filepath, int rate, int freq) { + teletone_multi_tone_t mt; + teletone_tone_map_t map; + int16_t data[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + size_t len = rate * 2 / 100; // in samples + switch_status_t status; + switch_file_handle_t fh = { 0 }; + + status = switch_core_file_open(&fh, filepath, 1, rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL); + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open file [%s]\n", filepath); + return SWITCH_STATUS_FALSE; + } + + mt.sample_rate = rate; + map.freqs[0] = (teletone_process_t)freq; + + teletone_multi_tone_init(&mt, &map); + + while (switch_core_file_read(&fh, &data, &len) == SWITCH_STATUS_SUCCESS) { + if (teletone_multi_tone_detect(&mt, data, len)) { + switch_core_file_close(&fh); + return SWITCH_STATUS_SUCCESS; + } + } + + switch_core_file_close(&fh); + return SWITCH_STATUS_FALSE; +} FST_CORE_BEGIN(".") { @@ -42,6 +77,7 @@ FST_CORE_BEGIN(".") { fst_requires_module("mod_loopback"); fst_requires_module("mod_opusfile"); + fst_requires_module("mod_sndfile"); } FST_SETUP_END() @@ -115,6 +151,163 @@ FST_CORE_BEGIN(".") switch_sleep(1000000); } + FST_TEST_END() + + FST_TEST_BEGIN(opusfile_stream) + { + switch_codec_t read_codec = { 0 }; + switch_status_t status; + switch_codec_settings_t codec_settings = {{ 0 }}; + unsigned char buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + switch_file_handle_t fhw = { 0 }; + uint32_t flags = 0; + uint32_t rate; + static char tmp_filename[] = "/tmp/opusfile-stream-unit_test.wav"; + char path[4096]; + uint32_t filerate = 48000; + uint32_t torate = 8000; + /*decode*/ + uint32_t decoded_len; + size_t write_len; + unsigned char decbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; +#ifdef HAVE_OPUSFILE_ENCODE + switch_file_handle_t fh = { 0 }; + unsigned char encbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + switch_codec_t write_codec = { 0 }; + switch_size_t len = 960; + uint32_t encoded_len; + unsigned int pages = 0; + /* + General + Complete name : sounds/audiocheck.net_sin_1000Hz_-3dBFS_6s.wav + Format : Wave + File size : 563 KiB + Duration : 6 s 0 ms + Overall bit rate mode : Constant + Overall bit rate : 768 kb/s + + Audio + Format : PCM + Format settings, Endianness : Little + Format settings, Sign : Signed + Codec ID : 1 + Duration : 6 s 0 ms + Bit rate mode : Constant + Bit rate : 768 kb/s + Channel(s) : 1 channel + Sampling rate : 48.0 kHz + Bit depth : 16 bits + Stream size : 563 KiB (100%) + */ + static char filename[] = "sounds/audiocheck.net_sin_1000Hz_-3dBFS_6s.wav"; +#else + static char opus_filename[] = "sounds/opusfile-test-ogg.bitstream"; + switch_file_t *fd; + switch_size_t flen; +#endif + + status = switch_core_codec_init(&read_codec, + "OPUSSTREAM", + "mod_opusfile", + NULL, + filerate, + 20, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + &codec_settings, fst_pool); + fst_check(status == SWITCH_STATUS_SUCCESS); + +#ifdef HAVE_OPUSFILE_ENCODE + status = switch_core_codec_init(&write_codec, + "OPUSSTREAM", + "mod_opusfile", + NULL, + filerate, + 20, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + &codec_settings, fst_pool); + fst_check(status == SWITCH_STATUS_SUCCESS); + + sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, filename); + + status = switch_core_file_open(&fh, path, 1, filerate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + status = switch_core_file_open(&fhw, tmp_filename, 1, torate, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + fhw.native_rate = filerate; // make sure we resample to 8000 Hz, because teletone wants this rate + + while (switch_core_file_read(&fh, &buf, &len) == SWITCH_STATUS_SUCCESS) { + + status = switch_core_codec_encode(&write_codec, NULL, &buf, len * sizeof(int16_t), filerate, &encbuf, &encoded_len, &rate, &flags); + fst_check(status == SWITCH_STATUS_SUCCESS); + + if (encoded_len) { + pages++; + status = switch_core_codec_decode(&read_codec, NULL, &encbuf, encoded_len, filerate, &decbuf, &decoded_len, &rate, &flags); + fst_check(status == SWITCH_STATUS_SUCCESS); + write_len = decoded_len / sizeof(int16_t); + if (write_len) switch_core_file_write(&fhw, &decbuf, &write_len); + } + } + + // continue reading, encoded pages are buffered + while (switch_core_codec_decode(&read_codec, NULL, &encbuf, 0, filerate, &decbuf, &decoded_len, &rate, &flags) == SWITCH_STATUS_SUCCESS && decoded_len) { + write_len = decoded_len / sizeof(int16_t); + status = switch_core_file_write(&fhw, &decbuf, &write_len); + fst_check(status == SWITCH_STATUS_SUCCESS); + } + + switch_core_codec_destroy(&write_codec); + + status = switch_core_file_close(&fh); + fst_check(status == SWITCH_STATUS_SUCCESS); + +#else + // the test will perform only decoding + + sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, opus_filename); + + // open the file raw and buffer data to the decoder + status = switch_file_open(&fd, path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD, fst_pool); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + status = switch_core_file_open(&fhw, tmp_filename, 1, torate, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + fhw.native_rate = filerate; + + flen = OGG_MIN_PAGE_SIZE; + while (switch_file_read(fd, &buf, &flen) == SWITCH_STATUS_SUCCESS || flen != 0) { + status = SWITCH_STATUS_SUCCESS; + while (status == SWITCH_STATUS_SUCCESS) { + status = switch_core_codec_decode(&read_codec, NULL, &buf, flen, filerate, &decbuf, &decoded_len, &rate, &flags); + fst_requires(status == SWITCH_STATUS_SUCCESS); + write_len = decoded_len / sizeof(int16_t); + if (write_len) switch_core_file_write(&fhw, &decbuf, &write_len); + else break; + } + } +#endif + + // continue reading, encoded pages are buffered + while (switch_core_codec_decode(&read_codec, NULL, &buf, 0, filerate, &decbuf, &decoded_len, &rate, &flags) == SWITCH_STATUS_SUCCESS && decoded_len) { + write_len = decoded_len / sizeof(int16_t); + status = switch_core_file_write(&fhw, &decbuf, &write_len); + fst_check(status == SWITCH_STATUS_SUCCESS); + } + + status = switch_core_file_close(&fhw); + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_core_codec_destroy(&read_codec); + + // final test + status = test_detect_tone_in_file(tmp_filename, torate, 1000 /*Hz*/); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + unlink(tmp_filename); + } FST_TEST_END() } From 97a0b0fbaea0e98e973e0e3ca69ebdea0a0f61e8 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Fri, 13 Mar 2020 18:42:43 +0000 Subject: [PATCH 174/655] [mod_opusfile] protect ogg data buff --- src/mod/formats/mod_opusfile/mod_opusfile.c | 7 ++++--- src/mod/formats/mod_opusfile/test/test_opusfile.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/mod/formats/mod_opusfile/mod_opusfile.c b/src/mod/formats/mod_opusfile/mod_opusfile.c index ea932ed0ff..38f5d1f442 100644 --- a/src/mod/formats/mod_opusfile/mod_opusfile.c +++ b/src/mod/formats/mod_opusfile/mod_opusfile.c @@ -976,6 +976,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] read_stream_thread(): switch_thread_self(): 0x%lx\n", switch_thread_self()); } switch_thread_rwlock_rdlock(context->rwlock); + switch_mutex_lock(context->ogg_mutex); if ((buffered_ogg_bytes = switch_buffer_inuse(context->ogg_buffer))) { if (buffered_ogg_bytes <= OGG_MAX_PAGE_SIZE) { @@ -1021,6 +1022,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void } } + switch_mutex_unlock(context->ogg_mutex); switch_thread_rwlock_unlock(context->rwlock); return NULL; } @@ -1071,9 +1073,9 @@ static switch_status_t switch_opusstream_decode(switch_codec_t *codec, #endif switch_thread_rwlock_rdlock(context->rwlock); + switch_mutex_lock(context->ogg_mutex); memset(context->ogg_data, 0, sizeof(context->ogg_data)); if (encoded_data_len <= SWITCH_RECOMMENDED_BUFFER_SIZE) { - switch_mutex_lock(context->ogg_mutex); switch_buffer_write(context->ogg_buffer, encode_buf, encoded_data_len); if ((buffered_ogg_bytes = switch_buffer_inuse(context->ogg_buffer)) >= ogg_bytes) { @@ -1089,12 +1091,10 @@ static switch_status_t switch_opusstream_decode(switch_codec_t *codec, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS Stream Decode] buffered ogg data bigger than max OGG page size, will flush\n"); *decoded_data_len = 0; switch_buffer_zero(context->ogg_buffer); - switch_mutex_unlock(context->ogg_mutex); switch_goto_status(SWITCH_STATUS_SUCCESS, end); } } - switch_mutex_unlock(context->ogg_mutex); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "[OGG/OPUS Stream Decode] too much data to buffer, flushing buffer!\n"); *decoded_data_len = 0; @@ -1134,6 +1134,7 @@ static switch_status_t switch_opusstream_decode(switch_codec_t *codec, end: switch_thread_rwlock_unlock(context->rwlock); + switch_mutex_unlock(context->ogg_mutex); return status; } diff --git a/src/mod/formats/mod_opusfile/test/test_opusfile.c b/src/mod/formats/mod_opusfile/test/test_opusfile.c index f21738bdb7..feb74619e5 100644 --- a/src/mod/formats/mod_opusfile/test/test_opusfile.c +++ b/src/mod/formats/mod_opusfile/test/test_opusfile.c @@ -170,6 +170,7 @@ FST_CORE_BEGIN(".") uint32_t decoded_len; size_t write_len; unsigned char decbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + switch_stream_handle_t stream = { 0 }; #ifdef HAVE_OPUSFILE_ENCODE switch_file_handle_t fh = { 0 }; unsigned char encbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; @@ -216,6 +217,12 @@ FST_CORE_BEGIN(".") &codec_settings, fst_pool); fst_check(status == SWITCH_STATUS_SUCCESS); + SWITCH_STANDARD_STREAM(stream); + + switch_api_execute("opusfile_debug", "on", NULL, &stream); + + switch_safe_free(stream.data); + #ifdef HAVE_OPUSFILE_ENCODE status = switch_core_codec_init(&write_codec, "OPUSSTREAM", @@ -277,12 +284,12 @@ FST_CORE_BEGIN(".") fhw.native_rate = filerate; - flen = OGG_MIN_PAGE_SIZE; + flen = 4096; while (switch_file_read(fd, &buf, &flen) == SWITCH_STATUS_SUCCESS || flen != 0) { status = SWITCH_STATUS_SUCCESS; while (status == SWITCH_STATUS_SUCCESS) { status = switch_core_codec_decode(&read_codec, NULL, &buf, flen, filerate, &decbuf, &decoded_len, &rate, &flags); - fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_check(status == SWITCH_STATUS_SUCCESS); write_len = decoded_len / sizeof(int16_t); if (write_len) switch_core_file_write(&fhw, &decbuf, &write_len); else break; From 0cf323c339c788f71bde4d1b2ecc115e61ccbb1d Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 15 Apr 2020 11:34:10 +0000 Subject: [PATCH 175/655] [mod_opusfile] unit-tests: add timer to fix random failures due to the fact that the decoding callback is not installed immediatelly --- src/mod/formats/mod_opusfile/test/test_opusfile.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mod/formats/mod_opusfile/test/test_opusfile.c b/src/mod/formats/mod_opusfile/test/test_opusfile.c index feb74619e5..339047c576 100644 --- a/src/mod/formats/mod_opusfile/test/test_opusfile.c +++ b/src/mod/formats/mod_opusfile/test/test_opusfile.c @@ -171,6 +171,7 @@ FST_CORE_BEGIN(".") size_t write_len; unsigned char decbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; switch_stream_handle_t stream = { 0 }; + switch_timer_t timer; #ifdef HAVE_OPUSFILE_ENCODE switch_file_handle_t fh = { 0 }; unsigned char encbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; @@ -223,6 +224,8 @@ FST_CORE_BEGIN(".") switch_safe_free(stream.data); + switch_core_timer_init(&timer, "soft", 20, 960, fst_pool); + #ifdef HAVE_OPUSFILE_ENCODE status = switch_core_codec_init(&write_codec, "OPUSSTREAM", @@ -252,6 +255,7 @@ FST_CORE_BEGIN(".") if (encoded_len) { pages++; status = switch_core_codec_decode(&read_codec, NULL, &encbuf, encoded_len, filerate, &decbuf, &decoded_len, &rate, &flags); + switch_core_timer_next(&timer); fst_check(status == SWITCH_STATUS_SUCCESS); write_len = decoded_len / sizeof(int16_t); if (write_len) switch_core_file_write(&fhw, &decbuf, &write_len); @@ -260,6 +264,7 @@ FST_CORE_BEGIN(".") // continue reading, encoded pages are buffered while (switch_core_codec_decode(&read_codec, NULL, &encbuf, 0, filerate, &decbuf, &decoded_len, &rate, &flags) == SWITCH_STATUS_SUCCESS && decoded_len) { + switch_core_timer_next(&timer); write_len = decoded_len / sizeof(int16_t); status = switch_core_file_write(&fhw, &decbuf, &write_len); fst_check(status == SWITCH_STATUS_SUCCESS); @@ -288,6 +293,7 @@ FST_CORE_BEGIN(".") while (switch_file_read(fd, &buf, &flen) == SWITCH_STATUS_SUCCESS || flen != 0) { status = SWITCH_STATUS_SUCCESS; while (status == SWITCH_STATUS_SUCCESS) { + switch_core_timer_next(&timer); status = switch_core_codec_decode(&read_codec, NULL, &buf, flen, filerate, &decbuf, &decoded_len, &rate, &flags); fst_check(status == SWITCH_STATUS_SUCCESS); write_len = decoded_len / sizeof(int16_t); @@ -296,14 +302,14 @@ FST_CORE_BEGIN(".") } } #endif - // continue reading, encoded pages are buffered while (switch_core_codec_decode(&read_codec, NULL, &buf, 0, filerate, &decbuf, &decoded_len, &rate, &flags) == SWITCH_STATUS_SUCCESS && decoded_len) { + switch_core_timer_next(&timer); write_len = decoded_len / sizeof(int16_t); status = switch_core_file_write(&fhw, &decbuf, &write_len); fst_check(status == SWITCH_STATUS_SUCCESS); } - + status = switch_core_file_close(&fhw); fst_check(status == SWITCH_STATUS_SUCCESS); @@ -313,6 +319,8 @@ FST_CORE_BEGIN(".") status = test_detect_tone_in_file(tmp_filename, torate, 1000 /*Hz*/); fst_requires(status == SWITCH_STATUS_SUCCESS); + switch_core_timer_destroy(&timer); + unlink(tmp_filename); } From fa0e61659203a718ef01edd81a9905a782b840ee Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 22 Apr 2021 17:50:49 +0300 Subject: [PATCH 176/655] [libyuv] Disable scan-build warnings. --- libs/libyuv/source/scale.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/libyuv/source/scale.cc b/libs/libyuv/source/scale.cc index ab08549637..30066d5b34 100644 --- a/libs/libyuv/source/scale.cc +++ b/libs/libyuv/source/scale.cc @@ -736,6 +736,9 @@ static void ScaleAddCols2_C(int dst_width, int dx, const uint16_t* src_ptr, uint8_t* dst_ptr) { +#ifdef __clang_analyzer__ + *dst_ptr = 0; +#else int i; int scaletbl[2]; int minboxwidth = dx >> 16; @@ -750,6 +753,7 @@ static void ScaleAddCols2_C(int dst_width, SumPixels(boxwidth, src_ptr + ix) * scaletbl[boxwidth - minboxwidth] >> 16; } +#endif } static void ScaleAddCols2_16_C(int dst_width, @@ -758,6 +762,9 @@ static void ScaleAddCols2_16_C(int dst_width, int dx, const uint32_t* src_ptr, uint16_t* dst_ptr) { +#ifdef __clang_analyzer__ + * dst_ptr = 0; +#else int i; int scaletbl[2]; int minboxwidth = dx >> 16; @@ -772,6 +779,7 @@ static void ScaleAddCols2_16_C(int dst_width, scaletbl[boxwidth - minboxwidth] >> 16; } +#endif } static void ScaleAddCols0_C(int dst_width, From cba582cf4a99cf91c7b361ca09a954ab51c9918e Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 20 Apr 2021 01:34:33 +0300 Subject: [PATCH 177/655] [mod_sofia] Fix multiple issues in sofia_presence.c found by scan-build. --- src/mod/endpoints/mod_sofia/sofia_presence.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index e27b0495ff..43564731d8 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, *user; + char *account, *dup_account, *yn, *host = NULL, *user; char *sql; sofia_profile_t *profile = NULL; switch_stream_handle_t stream = { 0 }; @@ -514,8 +514,8 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) dup_account = strdup(account); - switch_assert(dup_account != NULL); switch_split_user_domain(dup_account, &user, &host); + switch_assert(host != NULL); if ((pname = switch_event_get_header(event, "sofia-profile"))) { @@ -523,7 +523,7 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) } if (!profile) { - if (!host || !(profile = sofia_glue_find_profile(host))) { + if (!(profile = sofia_glue_find_profile(host))) { char *sql; char buf[512] = ""; switch_console_callback_match_t *matches; @@ -4024,7 +4024,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, if (np.is_nat) { char params[128] = ""; - if (contact->m_url->url_params) { + if (contact && contact->m_url->url_params) { switch_snprintf(params, sizeof(params), ";%s", contact->m_url->url_params); } ipv6 = strchr(np.network_ip, ':'); @@ -4039,8 +4039,10 @@ void sofia_presence_handle_sip_i_subscribe(int status, if (sip->sip_via) { transport = sofia_glue_via2transport(sip->sip_via); - } else { + } else if (contact){ transport = sofia_glue_url2transport(contact->m_url); + } else { + transport = SOFIA_TRANSPORT_UNKNOWN; } if (transport == SOFIA_TRANSPORT_TCP) { @@ -4739,7 +4741,7 @@ void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip) { url_t *to = sip->sip_to->a_url; url_t *from = sip->sip_from->a_url; - switch_snprintf(hash_key, len, "%s%s%s", from->url_user, from->url_host, to->url_user); + switch_snprintf(hash_key, len, "%s%s%s", (from && from->url_user) ? from->url_user : "", (from && from->url_host) ? from->url_host : "", (to && to->url_user) ? to->url_user : ""); } void sofia_presence_handle_sip_i_message(int status, From d6884d6871e84d894a40490d2c23d3d0ad534e34 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 19 Apr 2021 23:27:14 +0300 Subject: [PATCH 178/655] [apr] scan-build: Dereference of null pointer in apr_hash_merge() --- libs/apr/tables/apr_hash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/apr/tables/apr_hash.c b/libs/apr/tables/apr_hash.c index 5cac297af9..0e707601f5 100644 --- a/libs/apr/tables/apr_hash.c +++ b/libs/apr/tables/apr_hash.c @@ -28,6 +28,8 @@ #include <string.h> #endif +#include <assert.h> /* assert() */ + #if APR_POOL_DEBUG && APR_HAVE_STDIO_H #include <stdio.h> #endif @@ -433,6 +435,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p, for (k = 0; k <= base->max; k++) { for (iter = base->array[k]; iter; iter = iter->next) { i = iter->hash & res->max; + assert(new_vals); new_vals[j].klen = iter->klen; new_vals[j].key = iter->key; new_vals[j].val = iter->val; From b59c28bdbd33f2a119c0f353d6d4376736bd6602 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sun, 25 Apr 2021 04:12:50 +0300 Subject: [PATCH 179/655] [Core] scan-build: fix false-positive use-after-free in switch_xml_internal_dtd() --- src/switch_xml.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index b05358741c..94268da358 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -839,6 +839,8 @@ static short switch_xml_internal_dtd(switch_xml_root_t root, char *s, switch_siz if (!*s) break; else if (!strncmp(s, "<!ENTITY", 8)) { /* parse entity definitions */ + int use_pe; + c = s += strspn(s + 8, SWITCH_XML_WS) + 8; /* skip white space separator */ n = s + strspn(s, SWITCH_XML_WS "%"); /* find name */ *(s = n + strcspn(n, SWITCH_XML_WS)) = ';'; /* append ; to name */ @@ -849,10 +851,11 @@ static short switch_xml_internal_dtd(switch_xml_root_t root, char *s, switch_siz continue; } - for (i = 0, ent = (*c == '%') ? pe : root->ent; ent[i]; i++); + use_pe = (*c == '%'); + for (i = 0, ent = (use_pe) ? pe : root->ent; ent[i]; i++); sstmp = (char **) switch_must_realloc(ent, (i + 3) * sizeof(char *)); /* space for next ent */ ent = sstmp; - if (*c == '%') + if (use_pe) pe = ent; else root->ent = ent; From 65bc81d239463649ce8378356da4565bd01c36d1 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 23 Apr 2021 15:00:21 +0300 Subject: [PATCH 180/655] [libvpx] scan-build: fix false-positive dereference of null pointer --- libs/libvpx/vp8/encoder/pickinter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/libvpx/vp8/encoder/pickinter.c b/libs/libvpx/vp8/encoder/pickinter.c index dc72eed88c..6f8a173582 100644 --- a/libs/libvpx/vp8/encoder/pickinter.c +++ b/libs/libvpx/vp8/encoder/pickinter.c @@ -631,16 +631,16 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, } #endif assert(plane[LAST_FRAME][0] != NULL); - dot_artifact_candidate = check_dot_artifact_candidate( + if (plane[LAST_FRAME][0]) dot_artifact_candidate = check_dot_artifact_candidate( cpi, x, target_y, stride, plane[LAST_FRAME][0], mb_row, mb_col, 0); // If not found in Y channel, check UV channel. if (!dot_artifact_candidate) { assert(plane[LAST_FRAME][1] != NULL); - dot_artifact_candidate = check_dot_artifact_candidate( + if (plane[LAST_FRAME][1]) dot_artifact_candidate = check_dot_artifact_candidate( cpi, x, target_u, stride_uv, plane[LAST_FRAME][1], mb_row, mb_col, 1); if (!dot_artifact_candidate) { assert(plane[LAST_FRAME][2] != NULL); - dot_artifact_candidate = check_dot_artifact_candidate( + if (plane[LAST_FRAME][2]) dot_artifact_candidate = check_dot_artifact_candidate( cpi, x, target_v, stride_uv, plane[LAST_FRAME][2], mb_row, mb_col, 2); } From 95fb8c7773edfe634edbaa1df86dd36834ff5cb7 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sun, 25 Apr 2021 03:29:56 +0300 Subject: [PATCH 181/655] [Core] Fix crash on removing xml attributes. Add unit test. --- src/switch_xml.c | 29 +++++++++++++++++++++-------- tests/unit/switch_core.c | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index 94268da358..13ac47d8a5 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2998,12 +2998,16 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr(switch_xml_t xml, const char *n strcpy(xml->attr[l + 3] + c, " "); /* set name/value as not malloced */ if (xml->flags & SWITCH_XML_DUP) xml->attr[l + 3][c] = SWITCH_XML_NAMEM; - } else if (xml->flags & SWITCH_XML_DUP) - free((char *) name); /* name was strduped */ + c = l + 2; /* end of attribute list */ + } else { + for (c = l; xml->attr[c]; c += 2); /* find end of attribute list */ + + if (xml->flags & SWITCH_XML_DUP) + free((char*)name); /* name was strduped */ + if (xml->attr[c + 1][l / 2] & SWITCH_XML_TXTM) + free(xml->attr[l + 1]); /* old val */ + } - for (c = l; xml->attr[c]; c += 2); /* find end of attribute list */ - if (xml->attr[c + 1][l / 2] & SWITCH_XML_TXTM) - free(xml->attr[l + 1]); /* old val */ if (xml->flags & SWITCH_XML_DUP) xml->attr[c + 1][l / 2] |= SWITCH_XML_TXTM; else @@ -3014,9 +3018,18 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr(switch_xml_t xml, const char *n else { /* remove attribute */ if (xml->attr[c + 1][l / 2] & SWITCH_XML_NAMEM) free(xml->attr[l]); - memmove(xml->attr + l, xml->attr + l + 2, (c - l + 2) * sizeof(char *)); - xml->attr = (char **) switch_must_realloc(xml->attr, (c + 2) * sizeof(char *)); - memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1, (c / 2) - (l / 2)); /* fix list of which name/vals are malloced */ + c -= 2; + if (c > 0) { + memmove(xml->attr + l, xml->attr + l + 2, (c - l + 2) * sizeof(char*)); + xml->attr = (char**)switch_must_realloc(xml->attr, (c + 2) * sizeof(char*)); + memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1, (c / 2) - (l / 2)); /* fix list of which name/vals are malloced */ + xml->attr[c + 1][c / 2] = '\0'; + } else { + /* last attribute removed, reset attribute list */ + free(xml->attr[3]); + free(xml->attr); + xml->attr = SWITCH_XML_NIL; + } } xml->flags &= ~SWITCH_XML_DUP; /* clear strdup() flag */ diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index ed84e39c06..56a700c0fb 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -53,6 +53,24 @@ FST_CORE_BEGIN("./conf") } FST_TEARDOWN_END() + FST_TEST_BEGIN(test_xml_set_attr) + { + switch_xml_t parent_xml = switch_xml_new("xml"); + switch_xml_t xml = switch_xml_add_child_d(parent_xml, "test", 1); + switch_xml_set_attr_d(xml, "test1", "1"); + switch_xml_set_attr(xml, "a1", "v1"); + switch_xml_set_attr_d(xml, "a2", "v2"); + switch_xml_set_attr(xml, "test1", NULL); + switch_xml_set_attr_d(xml, "test2", "2"); + switch_xml_set_attr_d(xml, "a3", "v3"); + switch_xml_set_attr(xml, "test2", NULL); + switch_xml_set_attr(xml, "a1", NULL); + switch_xml_set_attr(xml, "a2", NULL); + switch_xml_set_attr(xml, "a3", NULL); + switch_xml_free(parent_xml); + } + FST_TEST_END() + #ifdef HAVE_OPENSSL FST_TEST_BEGIN(test_md5) { From e42ebbb33f0408d7c69ea12f348151d2c1ba44e9 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sun, 25 Apr 2021 03:52:33 +0300 Subject: [PATCH 182/655] [Core] scan-build: Fix false-positive use-after-free in switch_xml_free_attr(). Add unit test. --- src/switch_xml.c | 10 +++++----- tests/unit/switch_core.c | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index 13ac47d8a5..407a81767f 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1000,15 +1000,15 @@ static char *switch_xml_str2utf8(char **s, switch_size_t *len) /* frees a tag attribute list */ static void switch_xml_free_attr(char **attr) { - int i = 0; + int i, c = 0; char *m; if (!attr || attr == SWITCH_XML_NIL) return; /* nothing to free */ - while (attr[i]) - i += 2; /* find end of attribute list */ - m = attr[i + 1]; /* list of which names and values are malloced */ - for (i = 0; m[i]; i++) { + while (attr[c]) + c += 2; /* find end of attribute list */ + m = attr[c + 1]; /* list of which names and values are malloced */ + for (i = c / 2 - 1; i >= 0 ; i--) { if (m[i] & SWITCH_XML_NAMEM) free(attr[i * 2]); if (m[i] & SWITCH_XML_TXTM) diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index 56a700c0fb..0e914fa070 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -53,6 +53,16 @@ FST_CORE_BEGIN("./conf") } FST_TEARDOWN_END() + FST_TEST_BEGIN(test_xml_free_attr) + { + switch_xml_t parent_xml = switch_xml_new("xml"); + switch_xml_t xml = switch_xml_add_child_d(parent_xml, "test", 1); + switch_xml_set_attr(xml, "a1", "v1"); + switch_xml_set_attr_d(xml, "a2", "v2"); + switch_xml_free(parent_xml); + } + FST_TEST_END() + FST_TEST_BEGIN(test_xml_set_attr) { switch_xml_t parent_xml = switch_xml_new("xml"); From e4ec2e10438204b2ec8bd2f6db91224f017b9a35 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 26 Feb 2021 21:44:30 +0300 Subject: [PATCH 183/655] [mod_spandsp] scan-build: Argument with 'nonnull' attribute passed null in modem_init() --- src/mod/applications/mod_spandsp/mod_spandsp_modem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index 5613b4aa4c..560a78be44 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -279,11 +279,11 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl modem->stty = ptsname(modem->master); if (modem->stty == NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to obtain slave pty filename\n"); - } - - modem->slave = open(modem->stty, O_RDWR); - if (modem->slave < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to open slave pty %s\n", modem->stty); + } else { + modem->slave = open(modem->stty, O_RDWR); + if (modem->slave < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to open slave pty %s\n", modem->stty); + } } #endif From bb150bc4863e4df7a81827b1f09af581916623c0 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 1 Apr 2021 16:14:06 +0300 Subject: [PATCH 184/655] [mod_spandsp] scan-build: Argument with 'nonnull' attribute passed null in udptl_rx_packet() --- src/mod/applications/mod_spandsp/udptl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_spandsp/udptl.c b/src/mod/applications/mod_spandsp/udptl.c index 50a996903a..aa82f953d0 100644 --- a/src/mod/applications/mod_spandsp/udptl.c +++ b/src/mod/applications/mod_spandsp/udptl.c @@ -296,7 +296,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len) return -1; /* Save the new FEC data */ - if (s->rx[x].fec_len[i]) + if (s->rx[x].fec_len[i] && data) memcpy(s->rx[x].fec[i], data, s->rx[x].fec_len[i]); #if 0 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FEC: "); From 322191a2f47d56e786ee73be1dc820fafd51b2fb Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 6 Apr 2021 19:43:57 +0300 Subject: [PATCH 185/655] [mod_dialplan_xml] Fix possible use after free in parse_exten() --- src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index 005276dcd3..f85a9855bb 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -361,6 +361,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * switch_regex_safe_free(re); switch_safe_free(field_expanded); + if (expression == expression_expanded) expression = NULL; switch_safe_free(expression_expanded); } @@ -375,6 +376,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * } switch_safe_free(field_expanded); + if (expression == expression_expanded) expression = NULL; switch_safe_free(expression_expanded); } else { if ((xexpression = switch_xml_child(xcond, "expression"))) { @@ -502,7 +504,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * proceed = 1; } } else { - if (field && strchr(expression, '(')) { + if (field && expression && strchr(expression, '(')) { switch_channel_set_variable(channel, "DP_MATCH", NULL); switch_capture_regex(re, proceed, field_data, ovector, "DP_MATCH", switch_regex_set_var_callback, session); } @@ -524,7 +526,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * data = (char *) switch_xml_attr_soft(xaction, "data"); } - if (field && strchr(expression, '(')) { + if (field && expression && strchr(expression, '(')) { len = (uint32_t) (strlen(data) + strlen(field_data) + 10) * proceed; if (!(substituted = malloc(len))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Memory Error!\n"); From 7713a2470d5843687b1bdaa8cf3ab8922b302cc1 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 6 Apr 2021 19:16:23 +0300 Subject: [PATCH 186/655] [libdingaling] Fix memory leaks --- libs/libdingaling/src/libdingaling.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 6fbedfda6e..ee08f041c0 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -1297,6 +1297,8 @@ static int on_subscribe(void *user_data, ikspak *pak) handle->session_callback(handle, NULL, LDL_SIGNAL_SUBSCRIBE, to, from, NULL, NULL); } + if (id) free(id); + return IKS_FILTER_EAT; } @@ -2325,6 +2327,9 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char if (strchr(my_body, '<')) { len = (int) strlen(my_body); if (!(bdup = malloc(len))) { + if (my_body_base) { + free(my_body_base); + } return; } From f82c1f04c51a823eedcbbe3baabb722f2f977405 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 19 Apr 2021 23:33:43 +0300 Subject: [PATCH 187/655] [iksemel] Fix memory leak --- libs/iksemel/tools/iksroster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/iksemel/tools/iksroster.c b/libs/iksemel/tools/iksroster.c index 144f3de189..e97f81cd15 100644 --- a/libs/iksemel/tools/iksroster.c +++ b/libs/iksemel/tools/iksroster.c @@ -374,6 +374,6 @@ main (int argc, char *argv[]) #ifdef _WIN32 WSACleanup (); #endif - + if (file) free(file); return 0; } From 31c10fac222f070f288dfa91cd4a7517396fa5f0 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 1 Apr 2021 16:25:10 +0300 Subject: [PATCH 188/655] [mod_kazoo] scan-build: Argument with 'nonnull' attribute passed null in kz_endpoint_outgoing_channel() --- src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c b/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c index cb2b28cb26..4ddfeddae4 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_endpoints.c @@ -222,20 +222,20 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s } if (!call_fwd_is_valid) { - dest = strdup(endpoint_dial); + dest = endpoint_dial ? strdup(endpoint_dial) : strdup(""); } else if (call_fwd_is_failover) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting failover => %s\n", callforward_dial); - dest = strdup(endpoint_dial); + dest = endpoint_dial ? strdup(endpoint_dial) : strdup(""); failover_dial = callforward_dial; } else if (call_fwd_is_substitute) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd substitute => %s\n", callforward_dial); - dest = strdup(callforward_dial); + dest = callforward_dial ? strdup(callforward_dial) : strdup(""); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd substitute => %s\n", dest); } else { dest = switch_mprintf("%s%s%s", endpoint_dial ? endpoint_dial : "", (endpoint_dial ? endpoint_separator ? endpoint_separator : "," : ""), callforward_dial); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd append => %s => %s\n", callforward_dial, dest); } } else { - dest = strdup(endpoint_dial); + dest = endpoint_dial ? strdup(endpoint_dial) : strdup(""); } dialed_user = (char *)switch_xml_attr(x_user, "id"); From ccd2174fb53a659325ffd1d02bfb2a76d63c59d2 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 1 Apr 2021 17:30:33 +0300 Subject: [PATCH 189/655] [mod_kazoo] Remove wrong usage of switch_safe_strdup() causing leaks in kazoo_tweaks --- src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c b/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c index bb7c792b88..e647871855 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_tweaks.c @@ -226,7 +226,6 @@ static void kz_tweaks_channel_transferor_event_handler(switch_event_t *event) switch_event_fire(&evt); } switch_core_session_rwunlock(session); - switch_safe_strdup(prv_interaction_id); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TRANSFEROR NO UUID SESSION: %s , %s , %s \n", uuid, dest_call_id, dest_peer_uuid); } @@ -240,7 +239,6 @@ static void kz_tweaks_channel_transferor_event_handler(switch_event_t *event) switch_event_fire(&evt); } switch_core_session_rwunlock(session); - switch_safe_strdup(prv_interaction_id); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TRANSFEROR NO PEER SESSION: %s , %s , %s \n", uuid, dest_call_id, dest_peer_uuid); } @@ -254,11 +252,9 @@ static void kz_tweaks_channel_transferor_event_handler(switch_event_t *event) switch_event_fire(&evt); } switch_core_session_rwunlock(session); - switch_safe_strdup(prv_interaction_id); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TRANSFEROR NO PEER SESSION: %s , %s , %s \n", uuid, dest_call_id, dest_peer_uuid); } - switch_safe_strdup(interaction_id); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TRANSFEROR ID = NULL : %s , %s , %s \n", uuid, dest_call_id, dest_peer_uuid); } @@ -441,7 +437,6 @@ static switch_status_t kz_tweaks_handle_replaces_call_id(switch_core_session_t * for(i = 0; bridge_variables[i] != NULL; i++) { const char *val = switch_channel_get_variable_dup(replaced_call_channel, bridge_variables[i], SWITCH_TRUE, -1); switch_channel_set_variable(channel, bridge_variables[i], val); - switch_safe_strdup(val); } if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); From 3abccb4b4f3715af3fc25a80ad091252b5d3bff2 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 1 Apr 2021 17:33:50 +0300 Subject: [PATCH 190/655] [mod_kazoo] Fix leaking stream in kz_event_expand_headers_check() --- src/mod/event_handlers/mod_kazoo/kazoo_utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_utils.c b/src/mod/event_handlers/mod_kazoo/kazoo_utils.c index 1986f81717..951707d179 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_utils.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_utils.c @@ -337,12 +337,9 @@ SWITCH_DECLARE(char *) kz_event_expand_headers_check(switch_event_t *event, cons switch_safe_free(expanded); } else { - switch_stream_handle_t stream = { 0 }; char *expanded = NULL; char *expanded_vname = NULL; - SWITCH_STANDARD_STREAM(stream); - if ((expanded_vname = kz_event_expand_headers_check(event, (char *) vname, var_list, api_list, recur+1)) == vname) { expanded_vname = NULL; } else { @@ -359,6 +356,9 @@ SWITCH_DECLARE(char *) kz_event_expand_headers_check(switch_event_t *event, cons func_val = NULL; sub_val = "<API execute Permission Denied>"; } else { + switch_stream_handle_t stream = { 0 }; + + SWITCH_STANDARD_STREAM(stream); stream.param_event = event; if (kz_expand_api_execute(vname, vval, NULL, &stream) == SWITCH_STATUS_SUCCESS) { func_val = stream.data; From 0e96038d21434cd41c9d6f1b045b251d259126dd Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 26 Feb 2021 23:34:25 +0300 Subject: [PATCH 191/655] [mod_lua] scan-build: Called C++ object pointer is null (Dbh_test_reactive) --- src/mod/languages/mod_lua/hack.diff | 16 ++++++++++++++++ src/mod/languages/mod_lua/mod_lua_wrap.cpp | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/mod/languages/mod_lua/hack.diff b/src/mod/languages/mod_lua/hack.diff index 907efb0d7e..95ec620feb 100644 --- a/src/mod/languages/mod_lua/hack.diff +++ b/src/mod/languages/mod_lua/hack.diff @@ -53,6 +53,22 @@ result = (bool)(arg1)->test_reactive(arg2,arg3,arg4); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; +@@ -9516,6 +9516,7 @@ static int _wrap_Dbh_test_reactive__SWIG_1(lua_State* L) { + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); ++ switch_assert(arg1); + result = (bool)(arg1)->test_reactive(arg2,arg3); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; +@@ -9543,6 +9544,7 @@ static int _wrap_Dbh_test_reactive__SWIG_2(lua_State* L) { + } + + arg2 = (char *)lua_tostring(L, 2); ++ switch_assert(arg1); + result = (bool)(arg1)->test_reactive(arg2); + lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; + return SWIG_arg; @@ -9672,6 +9673,7 @@ static int _wrap_Dbh_query(lua_State* L) { (&arg3)->idx = 3; } diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 7d91ba33ba..93ba825557 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -9548,6 +9548,7 @@ static int _wrap_Dbh_test_reactive__SWIG_1(lua_State* L) { arg2 = (char *)lua_tostring(L, 2); arg3 = (char *)lua_tostring(L, 3); + switch_assert(arg1); result = (bool)(arg1)->test_reactive(arg2,arg3); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; @@ -9575,6 +9576,7 @@ static int _wrap_Dbh_test_reactive__SWIG_2(lua_State* L) { } arg2 = (char *)lua_tostring(L, 2); + switch_assert(arg1); result = (bool)(arg1)->test_reactive(arg2); lua_pushboolean(L,(int)(result!=0)); SWIG_arg++; return SWIG_arg; From 4ab8936a0e049b10ad096517c580890f2cc9aec3 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 6 Apr 2021 20:06:10 +0300 Subject: [PATCH 192/655] [mod_v8] Fix false-positive memory leak detected in process_status_function() by scan-build --- src/mod/languages/mod_v8/mod_v8.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/languages/mod_v8/mod_v8.cpp b/src/mod/languages/mod_v8/mod_v8.cpp index c059915291..b297fa39e1 100644 --- a/src/mod/languages/mod_v8/mod_v8.cpp +++ b/src/mod/languages/mod_v8/mod_v8.cpp @@ -1376,7 +1376,7 @@ SWITCH_STANDARD_API(process_status_function) } switch_snprintf(tmp_str, sizeof(tmp_str), "%d", rows); - switch_xml_set_attr(switch_xml_set_flag(xml_row, SWITCH_XML_DUP), strdup("row_id"), strdup(tmp_str)); + switch_xml_set_attr_d(xml_row, "row_id", tmp_str); if (!(xml_field = switch_xml_add_child_d(xml_row, "task_id", f_off++))) { goto end; From 9a491fb8f8c002eff047b9c8c3a41e2e3a7d38fc Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 3 Apr 2021 20:38:30 +0300 Subject: [PATCH 193/655] [mod_say_pl] Fix potential memory leak in pl_say_ip() --- src/mod/say/mod_say_pl/mod_say_pl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 02fb4e15a3..4030b96391 100644 --- a/src/mod/say/mod_say_pl/mod_say_pl.c +++ b/src/mod/say/mod_say_pl/mod_say_pl.c @@ -65,7 +65,7 @@ SWITCH_MODULE_DEFINITION(mod_say_pl, mod_say_pl_load, NULL, NULL); if ((tstatus = \ pl_say_general_count(_sh, tmp, say_args)) \ != SWITCH_STATUS_SUCCESS) { \ - return tstatus; \ + switch_goto_status(tstatus, end); \ } \ say_args->method = smeth; say_args->type = stype; \ say_args->gender = sgen; \ @@ -206,6 +206,7 @@ static switch_status_t pl_say_time(switch_say_file_handle_t *sh, char *tosay, sw switch_time_exp_t tm, tm_now; uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0; const char *tz = NULL; + switch_status_t status = SWITCH_STATUS_SUCCESS; tz = switch_say_file_handle_get_variable(sh, "timezone"); @@ -304,7 +305,7 @@ static switch_status_t pl_say_time(switch_say_file_handle_t *sh, char *tosay, sw switch_say_file(sh, "time/t_sekund"); } - return SWITCH_STATUS_SUCCESS; + switch_goto_status(SWITCH_STATUS_SUCCESS, end); } if ((t = atol(tosay)) > 0) { @@ -409,7 +410,8 @@ static switch_status_t pl_say_time(switch_say_file_handle_t *sh, char *tosay, sw /* switch_say_file(sh, "digits/t_minut");*/ } - return SWITCH_STATUS_SUCCESS; +end: + return status; } From f92368d2f2fc23ccaacf07cfdd5283a37a6fc793 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 3 Apr 2021 15:23:27 +0300 Subject: [PATCH 194/655] [mod_xml_ldap] Move all memory allocations into the mod's pool so it does not leak on shutdown. Fix leaking xml_ldap_search(). --- src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c | 156 ++++++++++---------- 1 file changed, 81 insertions(+), 75 deletions(-) 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 1d5cb16531..eecdb49549 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 @@ -32,8 +32,6 @@ * */ #include <switch.h> -#include <stdlib.h> -#include <string.h> #include <lber.h> #include <ldap.h> @@ -126,6 +124,10 @@ struct xml_ldap_attribute { xml_ldap_attribute_t *next; }; +static struct { + switch_memory_pool_t *pool; +} globals; + SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_ldap_shutdown); SWITCH_MODULE_DEFINITION(mod_xml_ldap, mod_xml_ldap_load, mod_xml_ldap_shutdown, NULL); @@ -153,6 +155,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load) /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); + memset(&globals, 0, sizeof(globals)); + globals.pool = pool; + SWITCH_ADD_API(xml_ldap_api_interface, "xml_ldap", "XML LDAP", xml_ldap_function, XML_LDAP_SYNTAX); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "XML LDAP module loading...\n"); @@ -189,10 +194,11 @@ static switch_status_t do_config(void) for (binding_tag = switch_xml_child(bindings_tag, "binding"); binding_tag; binding_tag = binding_tag->next) { char *bname = (char *) switch_xml_attr_soft(binding_tag, "name"); - if (!(binding = malloc(sizeof(*binding)))) { - goto done; - } - memset(binding, 0, sizeof(*binding)); + if (!(binding = switch_core_alloc(globals.pool, sizeof(*binding)))) { + goto done; + } + + memset(binding, 0, sizeof(*binding)); binding->attr_list = attr_list; for (param = switch_xml_child(binding_tag, "param"); param; param = param->next) { @@ -215,22 +221,22 @@ static switch_status_t do_config(void) } if (val) { - binding->filter = strdup(val); + binding->filter = switch_core_strdup(globals.pool, val); printf("binding filter %s to %s\n", binding->filter, binding->bindings); } } else if (!strncasecmp(var, "basedn", strlen(val))) { - binding->basedn = strdup(val); + binding->basedn = switch_core_strdup(globals.pool, val); } else if (!strncasecmp(var, "binddn", strlen(val))) { - binding->binddn = strdup(val); + binding->binddn = switch_core_strdup(globals.pool, val); } else if (!strncasecmp(var, "bindpass", strlen(val))) { - binding->bindpass = strdup(val); + binding->bindpass = switch_core_strdup(globals.pool, val); } else if (!strncasecmp(var, "url", strlen(val))) { - binding->url = strdup(val); + binding->url = switch_core_strdup(globals.pool, val); } } if (binding && binding->bt == XML_LDAP_DIRECTORY) { - attr_list = malloc(sizeof(*attr_list)); + attr_list = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list = memset(attr_list, 0, sizeof(*attr_list)); binding->attr_list = attr_list; @@ -243,212 +249,212 @@ static switch_status_t do_config(void) if (!strncasecmp("id", n, strlen(n))) { attr_list->type = LDAP_EXTEN_ID; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("cidr", n, strlen(n))) { attr_list->type = LDAP_EXTEN_CIDR; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("number-alias", n, strlen(n))) { attr_list->type = LDAP_EXTEN_NUMBER_ALIAS; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("dial-string", n, strlen(n))) { attr_list->type = LDAP_EXTEN_DIAL_STRING; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("password", n, strlen(n))) { attr_list->type = LDAP_EXTEN_PASSWORD; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("reverse-auth-user", n, strlen(n))) { attr_list->type = LDAP_EXTEN_REV_AUTH_USER; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("reverse-auth-pass", n, strlen(n))) { attr_list->type = LDAP_EXTEN_REV_AUTH_PASS; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("a1-hash", n, strlen(n))) { attr_list->type = LDAP_EXTEN_A1_HASH; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-password", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_PASSWORD; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-enabled", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_ENABLED; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-mailfrom", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_MAILFROM; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-mailto", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_MAILTO; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-notify-mailto", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_NOTIFY_MAILTO; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-attach-file", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_ATTACH_FILE; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-message-ext", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_MESSAGE_EXT; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-email-all-messages", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_EMAIL_ALL_MSGS; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-keep-local-after-mail", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_KEEP_LOCAL_AFTER_MAIL; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-notify-email-all-messages", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_NOTIFY_EMAIL_ALL_MSGS; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-skip-instructions", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_SKIP_INSTRUCTIONS; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-cc", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_CC; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm-disk-quota", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_DISK_QUOTA; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; /* Variables */ } else if (!strncasecmp("accountcode", n, strlen(n))) { attr_list->type = LDAP_EXTEN_ACCOUNTCODE; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("user_context", n, strlen(n))) { attr_list->type = LDAP_EXTEN_USER_CONTEXT; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("vm_mailbox", n, strlen(n))) { attr_list->type = LDAP_EXTEN_VM_MAILBOX; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("callgroup", n, strlen(n))) { attr_list->type = LDAP_EXTEN_CALLGROUP; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("toll_allow", n, strlen(n))) { attr_list->type = LDAP_EXTEN_TOLL_ALLOW; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("effective_caller_id_number", n, strlen(n))) { attr_list->type = LDAP_EXTEN_EFF_CLIDNUM; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("effective_caller_id_name", n, strlen(n))) { attr_list->type = LDAP_EXTEN_EFF_CLIDNAME; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("outbound_caller_id_number", n, strlen(n))) { attr_list->type = LDAP_EXTEN_OUT_CLIDNUM; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } else if (!strncasecmp("outbound_caller_id_name", n, strlen(n))) { attr_list->type = LDAP_EXTEN_OUT_CLIDNAME; attr_list->len = strlen(m); - attr_list->val = strdup(m); - attr_list->next = malloc(sizeof(*attr_list)); + attr_list->val = switch_core_strdup(globals.pool, m); + attr_list->next = switch_core_alloc(globals.pool, sizeof(*attr_list)); attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list)); attr_list = attr_list->next; } @@ -574,9 +580,7 @@ static switch_status_t trydir(switch_xml_t *pxml, int *xoff, LDAP * ld, char *di cleanup: switch_safe_free(filter); - switch_safe_free(basedn) - switch_safe_free(dir_exten); - switch_safe_free(dir_domain); + switch_safe_free(basedn); return ret; } @@ -764,6 +768,8 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, c switch_xml_toxml_buf(xml, buf, 0, 0, 1); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"XML providing:\n%s\n", buf); switch_safe_free(buf); + switch_safe_free(dir_exten); + switch_safe_free(dir_domain); if (ret != SWITCH_STATUS_SUCCESS) { switch_xml_free(xml); From 1b048a8a9743bbce961d1dfb4e10a82250c2a876 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 27 Jan 2021 02:53:16 +0300 Subject: [PATCH 195/655] [Core, mod_hash] Add two APIs switch_core_hash_insert_alloc_destructor and switch_core_hash_insert_dup_destructor. Code cleanup in mod_hash. Add unit-tests. --- src/include/switch_core.h | 22 +++++++++++ src/mod/applications/mod_hash/mod_hash.c | 21 +++-------- src/switch_core_hash.c | 39 ++++++++++++++++++++ tests/unit/switch_core.c | 47 ++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 16 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 4f172a928e..9c9f6c490c 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1457,6 +1457,28 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data, hashtable_destructor_t destructor); #define switch_core_hash_insert(_h, _k, _d) switch_core_hash_insert_destructor(_h, _k, _d, NULL) +/*! + \brief Allocate memory and insert into a hash + \param hash the hash to add data to + \param key the name of the key to add the data to + \param size the size in bytes to allocate + \return pointer to the allocated memory + \note the string key must be a constant or a dynamic string +*/ +SWITCH_DECLARE(void *) switch_core_hash_insert_alloc_destructor(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ size_t size, hashtable_destructor_t destructor); +#define switch_core_hash_insert_alloc(_h, _k, _s) switch_core_hash_insert_alloc_destructor(_h, _k, _s, NULL) + +/*! + \brief Insert strdup(data) into a hash + \param hash the hash to add data to + \param key the name of the key to add the data to + \param data string to strdup and add + \return SWITCH_STATUS_SUCCESS if the data is added + \note the string key must be a constant or a dynamic string +*/ +SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup_destructor(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const char *str, hashtable_destructor_t destructor); +#define switch_core_hash_insert_dup(_h, _k, _d) switch_core_hash_insert_dup_destructor(_h, _k, _d, NULL) + /*! \brief Insert data into a hash diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index 6899922ab6..70bffd18e1 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -144,10 +144,7 @@ SWITCH_LIMIT_INCR(limit_incr_hash) if (!(item = (limit_hash_item_t *) switch_core_hash_find(globals.limit_hash, hashkey))) { /* No, create an empty structure and add it, then continue like as if it existed */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "Creating new limit structure: key: %s\n", hashkey); - item = (limit_hash_item_t *) malloc(sizeof(limit_hash_item_t)); - switch_assert(item); - memset(item, 0, sizeof(limit_hash_item_t)); - switch_core_hash_insert(globals.limit_hash, hashkey, item); + item = (limit_hash_item_t *)switch_core_hash_insert_alloc(globals.limit_hash, hashkey, sizeof(limit_hash_item_t)); } if (!(pvt = switch_channel_get_private(channel, "limit_hash"))) { @@ -433,17 +430,13 @@ SWITCH_STANDARD_APP(hash_function) free(value); switch_core_hash_delete(globals.db_hash, hash_key); } - value = strdup(argv[3]); - switch_assert(value); - switch_core_hash_insert(globals.db_hash, hash_key, value); + switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]); } else if (!strcasecmp(argv[0], "insert_ifempty")) { if (argc < 4) { goto usage; } if (!(value = switch_core_hash_find(globals.db_hash, hash_key))) { - value = strdup(argv[3]); - switch_assert(value); - switch_core_hash_insert(globals.db_hash, hash_key, value); + switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]); } } else if (!strcasecmp(argv[0], "delete")) { @@ -506,9 +499,7 @@ SWITCH_STANDARD_API(hash_api_function) switch_safe_free(value); switch_core_hash_delete(globals.db_hash, hash_key); } - value = strdup(argv[3]); - switch_assert(value); - switch_core_hash_insert(globals.db_hash, hash_key, value); + switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]); stream->write_function(stream, "+OK\n"); switch_thread_rwlock_unlock(globals.db_hash_rwlock); } else if (!strcasecmp(argv[0], "insert_ifempty")) { @@ -519,9 +510,7 @@ SWITCH_STANDARD_API(hash_api_function) if ((value = switch_core_hash_find(globals.db_hash, hash_key))) { stream->write_function(stream, "-ERR key already exists\n"); } else { - value = strdup(argv[3]); - switch_assert(value); - switch_core_hash_insert(globals.db_hash, hash_key, value); + switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]); stream->write_function(stream, "+OK\n"); } switch_thread_rwlock_unlock(globals.db_hash_rwlock); diff --git a/src/switch_core_hash.c b/src/switch_core_hash.c index 70102ce957..06d0475852 100644 --- a/src/switch_core_hash.c +++ b/src/switch_core_hash.c @@ -68,6 +68,45 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t return SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(void *) switch_core_hash_insert_alloc_destructor(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ size_t size, hashtable_destructor_t destructor) { + char *dkey; + void *data; + + if (!size) return NULL; + + dkey = strdup(key); + data = malloc(size); + + assert(data); + + if (switch_hashtable_insert_destructor(hash, dkey, data, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_DUP_CHECK, destructor)) { + memset(data, 0, size); + return data; + } + + free(data); + switch_safe_free(dkey); + + return NULL; +} + +SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup_destructor(switch_hash_t *hash, const char *key, const char *str, hashtable_destructor_t destructor) +{ + char *dkey = strdup(key); + char *dup = strdup(str); + + assert(dup); + + if (switch_hashtable_insert_destructor(hash, dkey, (void *)dup, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_DUP_CHECK, destructor)) { + return SWITCH_STATUS_SUCCESS; + } + + switch_safe_free(dup); + switch_safe_free(dkey); + + return SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(switch_hash_t *hash, const char *key, const void *data, hashtable_destructor_t destructor) { char *dkey = strdup(key); diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index 0e914fa070..af52ab9495 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -267,6 +267,53 @@ FST_CORE_BEGIN("./conf") fst_check_int_equals(switch_safe_atoll(0, 3), 3); } FST_TEST_END() + + FST_TEST_BEGIN(test_switch_core_hash_insert_dup) + { + char *magicnumber = malloc(9); + switch_hash_index_t *hi; + switch_hash_t *hash = NULL; + void *hash_val; + switch_core_hash_init(&hash); + fst_requires(hash); + + snprintf(magicnumber, 9, "%s", "DEADBEEF"); + switch_core_hash_insert_dup(hash, "test", (const char *)magicnumber); + snprintf(magicnumber, 9, "%s", "BAADF00D"); + + hi = switch_core_hash_first(hash); + switch_core_hash_this(hi, NULL, NULL, &hash_val); + fst_check_string_equals(hash_val, "DEADBEEF"); + switch_safe_free(hash_val); + free(magicnumber); + free(hi); + switch_core_hash_destroy(&hash); + fst_requires(hash == NULL); + } + FST_TEST_END() + + FST_TEST_BEGIN(test_switch_core_hash_insert_alloc) + { + char *item; + switch_hash_index_t *hi; + switch_hash_t *hash = NULL; + void *hash_val; + switch_core_hash_init(&hash); + fst_requires(hash); + + item = switch_core_hash_insert_alloc(hash, "test", 10); + fst_requires(item); + snprintf(item, 9, "%s", "DEADBEEF"); + + hi = switch_core_hash_first(hash); + switch_core_hash_this(hi, NULL, NULL, &hash_val); + fst_check_string_equals(hash_val, "DEADBEEF"); + free(hi); + switch_core_hash_destroy(&hash); + fst_requires(hash == NULL); + free(item); + } + FST_TEST_END() } FST_SUITE_END() } From 92a55cf85a2130e57ca5ba4732973e8777182ffa Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 20 Apr 2021 01:33:29 +0300 Subject: [PATCH 196/655] [Core] scan-build: Argument with 'nonnull' attribute passed null in switch_loadable_module_load_module_ex() --- src/switch_loadable_module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 174644faff..268b76f1c4 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1843,11 +1843,11 @@ static switch_status_t switch_loadable_module_load_module_ex(const char *dir, co if ((dot = strchr(file, '.'))) { *dot = '\0'; } - len = strlen(dir); + len = strlen(switch_str_nil(dir)); len += strlen(file); len += 8; path = (char *) switch_core_alloc(loadable_modules.pool, len); - switch_snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext); + switch_snprintf(path, len, "%s%s%s%s", switch_str_nil(dir), SWITCH_PATH_SEPARATOR, file, ext); } From 51ef2f261ae942aa57ecf257cd11f6df2538480d Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 23 Apr 2021 14:46:06 +0300 Subject: [PATCH 197/655] [libvpx] scan-build: Assigned value is garbage or undefined --- libs/libvpx/vp9/encoder/vp9_subexp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libvpx/vp9/encoder/vp9_subexp.c b/libs/libvpx/vp9/encoder/vp9_subexp.c index 19bbd5373f..cf17fcdfce 100644 --- a/libs/libvpx/vp9/encoder/vp9_subexp.c +++ b/libs/libvpx/vp9/encoder/vp9_subexp.c @@ -72,7 +72,7 @@ static int remap_prob(int v, int m) { i = recenter_nonneg(MAX_PROB - 1 - v, MAX_PROB - 1 - m) - 1; assert(i >= 0 && (size_t)i < sizeof(map_table)); - i = map_table[i]; + if (i >= 0 && (size_t)i < sizeof(map_table)) i = map_table[i]; return i; } From 86a075da5659ce6668241dc4bb12b3a339a47f71 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 26 Feb 2021 20:54:27 +0300 Subject: [PATCH 198/655] [mod_sofia] scan-build: Fix dereference of null pointer in sofia_outgoing_channel(). --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 79a3c06795..4b6c463261 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4797,7 +4797,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session *dest++ = '\0'; - if (!(gateway_ptr = sofia_reg_find_gateway(gw))) { + if (!(gateway_ptr = sofia_reg_find_gateway(gw)) || !gateway_ptr->profile) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Gateway \'%s\'\n", gw); cause = SWITCH_CAUSE_INVALID_GATEWAY; goto error; From ac1a3dc5653e55e5e77680a28e21989d979a3ad5 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 1 Apr 2021 13:20:02 +0300 Subject: [PATCH 199/655] [mod_sofia] scan-build: Argument with 'nonnull' attribute passed null --- src/mod/endpoints/mod_sofia/sofia.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b5051dda76..c66f315816 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4552,12 +4552,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) "deprecated and will be removed - let FS devs know if you think it should stay\n"); } } else if (!strcasecmp(var, "rewrite-multicasted-fs-path")) { - if( (!strcasecmp(val, "to_host")) || (!strcasecmp(val, "1")) ) { + if(val && (!strcasecmp(val, "to_host") || !strcasecmp(val, "1")) ) { /* old behaviour */ mod_sofia_globals.rewrite_multicasted_fs_path = 1; - } else if (!strcasecmp(val, "original_server_host")) { + } else if (val && !strcasecmp(val, "original_server_host")) { mod_sofia_globals.rewrite_multicasted_fs_path = 2; - } else if (!strcasecmp(val, "original_hostname")) { + } else if (val && !strcasecmp(val, "original_hostname")) { mod_sofia_globals.rewrite_multicasted_fs_path = 3; } else { mod_sofia_globals.rewrite_multicasted_fs_path = SWITCH_FALSE; From 6726922e346672c08c94e0d4ba3774a8e04fdcab Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 2 Apr 2021 00:27:59 +0300 Subject: [PATCH 200/655] [mod_sofia] scan-build: Dereference of null pointer in sofia_handle_sip_i_bye(), sofia_handle_sip_i_invite() and our_sofia_event_callback() --- src/mod/endpoints/mod_sofia/sofia.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c66f315816..e5ba5ce046 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -960,7 +960,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, char st[80] = ""; #endif - if (!session) { + if (!session || !sip) { return; } @@ -1615,7 +1615,7 @@ static void our_sofia_event_callback(nua_event_t event, authorization = sip->sip_proxy_authorization; } - if (authorization) { + if (authorization && sip->sip_request) { char network_ip[80] = ""; int network_port; sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port); @@ -10694,8 +10694,9 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } } - - tech_pvt->from_user = switch_core_session_strdup(session, sip->sip_from->a_url->url_user); + if (sip->sip_from && sip->sip_from->a_url) { + tech_pvt->from_user = switch_core_session_strdup(session, sip->sip_from->a_url->url_user); + } tech_pvt->mparams.remote_ip = switch_core_session_strdup(session, network_ip); tech_pvt->mparams.remote_port = network_port; @@ -11268,7 +11269,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (profile->pres_type) { const char *presence_id = switch_channel_get_variable(channel, "presence_id"); - if (zstr(presence_id)) { + if (zstr(presence_id) && sip->sip_from && sip->sip_from->a_url) { const char *user = switch_str_nil(sip->sip_from->a_url->url_user); const char *host = switch_str_nil(sip->sip_from->a_url->url_host); char *tmp = switch_mprintf("%s@%s", user, host); From e30c62f8ec9245c25962f8ee171b48e572cdc679 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 20 Apr 2021 02:05:20 +0300 Subject: [PATCH 201/655] [Core] scan-build: Argument with 'nonnull' attribute passed null in switch_xml_internal_dtd() --- 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 407a81767f..97ed4b563d 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -882,7 +882,7 @@ static short switch_xml_internal_dtd(switch_xml_root_t root, char *s, switch_siz continue; else *s = '\0'; /* null terminate tag name */ - for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++); + for (i = 0; root->attr[i] && n && strcmp(n, root->attr[i][0]); i++); //while (*(n = ++s + strspn(s, SWITCH_XML_WS)) && *n != '>') { // gcc 4.4 you are a creep From 781180ff48b65d308063ecbaf49ccfd8f964b884 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 23 Apr 2021 00:23:39 +0300 Subject: [PATCH 202/655] [Core] scan-build: memory leak in switch_xml_user_cache() --- src/switch_xml.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index 97ed4b563d..b70f6bfe74 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2095,10 +2095,9 @@ static void switch_xml_user_cache(const char *key, const char *user_name, const switch_safe_free(expires_lookup); } if (expires) { - char *expires_val = switch_must_malloc(1024); - if (sprintf(expires_val, "%ld", (long)expires)) { - switch_core_hash_insert(CACHE_EXPIRES_HASH, mega_key, expires_val); - } else { + char *expires_val = (char *)switch_core_hash_insert_alloc(CACHE_EXPIRES_HASH, mega_key, 22); + if (!snprintf(expires_val, 22, "%ld", (long)expires)) { + switch_core_hash_delete(CACHE_EXPIRES_HASH, mega_key); switch_safe_free(expires_val); } } From c35a3bb4db6af4f7faa7bc23209f33f513c2a99a Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 23 Apr 2021 20:03:36 +0300 Subject: [PATCH 203/655] [Core] scan-build: fix false-positive memory leak in switch_xml_set_attr_d and switch_xml_set_attr_d_buf --- src/include/switch_core.h | 8 -------- src/include/switch_utils.h | 2 ++ src/switch_utils.c | 7 +++++++ src/switch_xml.c | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 9c9f6c490c..7592362c5c 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -243,14 +243,6 @@ static inline void *switch_must_realloc(void *_b, size_t _z) return m; } -static inline char *switch_must_strdup(const char *_s) -{ - char *s = strdup(_s); - switch_assert(s); - return s; -} - - /*! \defgroup core1 Core Library \ingroup FREESWITCH diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 24c6151331..89983f3920 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1487,6 +1487,8 @@ SWITCH_DECLARE(unsigned long) switch_getpid(void); SWITCH_DECLARE(switch_status_t) switch_digest(const char *digest_name, unsigned char **digest, const void *input, switch_size_t inputLen, unsigned int *outputlen); SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, char **digest_str, const void *input, switch_size_t inputLen, unsigned int *outputlen); +char *switch_must_strdup(const char *_s); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/switch_utils.c b/src/switch_utils.c index 85e12f0488..9b02ecc870 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -4639,6 +4639,13 @@ SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, ch return status; } +char *switch_must_strdup(const char *_s) +{ + char *s = strdup(_s); + switch_assert(s); + return s; +} + /* For Emacs: * Local Variables: * mode:c diff --git a/src/switch_xml.c b/src/switch_xml.c index b70f6bfe74..a48f9ab96d 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -3040,7 +3040,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr(switch_xml_t xml, const char *n SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr_d(switch_xml_t xml, const char *name, const char *value) { if (!xml) return NULL; - return switch_xml_set_attr(switch_xml_set_flag(xml, SWITCH_XML_DUP), strdup(name), strdup(switch_str_nil(value))); + return switch_xml_set_attr(switch_xml_set_flag(xml, SWITCH_XML_DUP), switch_must_strdup(name), switch_must_strdup(switch_str_nil(value))); } /* Sets the given tag attribute or adds a new attribute if not found. A value @@ -3048,7 +3048,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr_d(switch_xml_t xml, const char SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr_d_buf(switch_xml_t xml, const char *name, const char *value) { if (!xml) return NULL; - return switch_xml_set_attr(switch_xml_set_flag(xml, SWITCH_XML_DUP), strdup(name), strdup(value)); + return switch_xml_set_attr(switch_xml_set_flag(xml, SWITCH_XML_DUP), switch_must_strdup(name), switch_must_strdup(value)); } /* sets a flag for the given tag and returns the tag */ From dca7940fb98d6e16ee23491cff3b17b32a6a13e0 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 23 Apr 2021 01:40:33 +0300 Subject: [PATCH 204/655] [Core] scan-build: Use of zero allocated in switch_xml_str2utf8() --- src/switch_xml.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/switch_xml.c b/src/switch_xml.c index a48f9ab96d..cee1a4b833 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -968,6 +968,9 @@ static char *switch_xml_str2utf8(char **s, switch_size_t *len) if (be == -1) return NULL; /* not UTF-16 */ + if (*len <= 3) + return NULL; + u = (char *) switch_must_malloc(max); for (sl = 2; sl < *len - 1; sl += 2) { c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF) /* UTF-16BE */ From 77c8557aa72474f6b835fe1802d6de4d8aaced9f Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 26 Apr 2021 21:41:36 +0300 Subject: [PATCH 205/655] [mod_managed] Fix Windows build --- src/include/switch_utils.h | 2 +- src/switch_utils.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 89983f3920..9877829824 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1487,7 +1487,7 @@ SWITCH_DECLARE(unsigned long) switch_getpid(void); SWITCH_DECLARE(switch_status_t) switch_digest(const char *digest_name, unsigned char **digest, const void *input, switch_size_t inputLen, unsigned int *outputlen); SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, char **digest_str, const void *input, switch_size_t inputLen, unsigned int *outputlen); -char *switch_must_strdup(const char *_s); +SWITCH_DECLARE(char *) switch_must_strdup(const char *_s); SWITCH_END_EXTERN_C #endif diff --git a/src/switch_utils.c b/src/switch_utils.c index 9b02ecc870..f59f502d62 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -4639,7 +4639,7 @@ SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, ch return status; } -char *switch_must_strdup(const char *_s) +SWITCH_DECLARE(char *) switch_must_strdup(const char *_s) { char *s = strdup(_s); switch_assert(s); From af095ebb68877c162ffa8a6bc8469fa3c90f2cde Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Thu, 1 Apr 2021 16:18:18 +0000 Subject: [PATCH 206/655] [core] scan-build: Dereference of null pointer (loaded from variable 'flags') --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e2fcf45419..199c9e95f7 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -8503,7 +8503,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { - int external = (*flags & SFF_EXTERNAL); + int external = (flags && *flags & SFF_EXTERNAL); /* Normalize the timestamps to our own base by generating a made up starting point then adding the measured deltas to that base so if the timestamps and ssrc of the source change, it will not break the other end's jitter bufffer / decoder etc *cough* CHROME *cough* */ From 4b03a47a7fce86d8bb2bd6235675f0864f7720bf Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 1 Apr 2021 23:53:57 +0300 Subject: [PATCH 207/655] [Core] Fix dereference of null pointer in switch_ivr_wait_for_answer() --- src/switch_ivr_originate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 9785d0b7aa..31ce629d40 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1145,6 +1145,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t if (read_frame && !pass) { + if (!write_frame.codec) { + status = SWITCH_STATUS_FALSE; + break; + } + if (ringback.fh) { switch_size_t mlen, olen; unsigned int pos = 0; From 67048377c423bde62df096611d09b591de4ae3f2 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 19 Apr 2021 21:16:28 +0300 Subject: [PATCH 208/655] [Core] Fix possible dereference of null pointer in switch_ivr_originate() and switch_ivr_enterprise_originate() --- src/switch_ivr_originate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 31ce629d40..698b7425ea 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1673,7 +1673,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess getcause = 0; switch_goto_status(SWITCH_STATUS_FALSE, end); } - } else { + } else if (hl) { x_argc = hl->handle_idx; } @@ -3487,7 +3487,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } } else { - if (switch_buffer_inuse(early_state.buffer) >= write_frame.codec->implementation->decoded_bytes_per_packet) { + if (write_frame.codec && switch_buffer_inuse(early_state.buffer) >= write_frame.codec->implementation->decoded_bytes_per_packet) { write_frame.datalen = (uint32_t)switch_buffer_read(early_state.buffer, write_frame.data, write_frame.codec->implementation->decoded_bytes_per_packet); } From e14df00aa6155f523f5911c5b8e1031cc13d8cf6 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 3 Apr 2021 20:14:29 +0300 Subject: [PATCH 209/655] [Core] scan-build: Argument with 'nonnull' attribute passed null in switch_html_strip() --- src/switch_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index f59f502d62..932e9d963c 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -4538,7 +4538,7 @@ SWITCH_DECLARE(char *)switch_html_strip(const char *str) text = (char *)stream.data; #else switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Support for html parser is not compiled.\n"); - text = strdup(html); + text = switch_safe_strdup(html); #endif return text; From bd7b76bacf0f1c8027e2676b007fbc281dd82f80 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 22 Jan 2021 16:46:04 +0300 Subject: [PATCH 210/655] [Core] Add new switch_core_hash_insert_pointer(switch_hash_t *hash, const void *data) API to be able to insert data into a hash with an auto-generated key based on the data pointer. Cleanup switch_loadable_module_process() to not generate hash keys for stored events itself. Add unit-test. --- src/include/switch_core.h | 8 ++++ src/switch_core_hash.c | 17 ++++++++ src/switch_loadable_module.c | 83 ++++++++---------------------------- tests/unit/switch_core.c | 31 ++++++++++++++ 4 files changed, 74 insertions(+), 65 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 7592362c5c..b6b3efbd90 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1428,6 +1428,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(_Out_ switch_hash_t * */ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t **hash); +/*! + \brief Insert data into a hash with an auto-generated key based on the data pointer + \param hash the hash to add data to + \param data unique pointer to add + \return SWITCH_STATUS_SUCCESS if the data is added +*/ +SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_pointer(switch_hash_t *hash, const void *data); + /*! \brief Insert data into a hash and set flags so the value is automatically freed on delete \param hash the hash to add data to diff --git a/src/switch_core_hash.c b/src/switch_core_hash.c index 06d0475852..1f13a44a6f 100644 --- a/src/switch_core_hash.c +++ b/src/switch_core_hash.c @@ -55,6 +55,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t **hash) return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_pointer(switch_hash_t *hash, const void *data) +{ + size_t bytes_required = snprintf(NULL, 0, "%p", data) + 1; + char *dkey = malloc(bytes_required); + size_t bytes_written = snprintf(dkey, bytes_required, "%p", data); + + if (bytes_written > 0 && bytes_written < bytes_required) { + if (switch_hashtable_insert_destructor(hash, dkey, (void *)data, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_DUP_CHECK, NULL)) { + return SWITCH_STATUS_SUCCESS; + } + } + + switch_safe_free(dkey); + + return SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t *hash, const char *key, const void *data) { char *dkey = strdup(key); diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 268b76f1c4..5442cca03a 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -156,25 +156,8 @@ static void switch_loadable_module_runtime(void) static switch_status_t switch_loadable_module_process(char *key, switch_loadable_module_t *new_module, switch_hash_t *event_hash) { switch_event_t *event; - int *event_num = NULL; - char str_event_num[12]; - void *val; int added = 0; - if (event_hash) { - if ((val = switch_core_hash_find(event_hash, "0"))) { - event_num = (int*)val; - } else { - if (!(event_num = malloc(sizeof(int)))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Allocation error.\n"); - return SWITCH_STATUS_MEMERR; - } - - *event_num = 0; - switch_core_hash_insert(event_hash, "0", (const void*)event_num); - } - } - new_module->key = switch_core_strdup(new_module->pool, key); switch_mutex_lock(loadable_modules.mutex); @@ -197,8 +180,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable if (!event_hash) { switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -271,8 +253,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -300,8 +281,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -329,8 +309,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -360,8 +339,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -391,8 +369,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -422,8 +399,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -453,8 +429,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -489,8 +464,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -535,8 +509,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -572,8 +545,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -601,8 +573,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -630,8 +601,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -659,8 +629,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -688,8 +657,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -723,8 +691,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -758,8 +725,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -781,8 +747,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable switch_event_fire(&event); } else { - sprintf(str_event_num, "%i", ++*event_num); - switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event); + switch_core_hash_insert_pointer(event_hash, (const void*)event); } added++; @@ -2211,10 +2176,6 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo if (switch_loadable_module_load_module_ex((char *)path, (char *)val, SWITCH_FALSE, global, &err, SWITCH_LOADABLE_MODULE_TYPE_PRELOAD, event_hash) == SWITCH_STATUS_GENERR) { if (critical && switch_true(critical)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load critical module '%s', abort()\n", val); - - if ((hash_val = switch_core_hash_find(event_hash, "0"))) { - switch_safe_free(hash_val); - } switch_core_hash_destroy(&event_hash); abort(); @@ -2233,19 +2194,11 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo if (switch_core_sqldb_init(&err) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Loading modules interrupted. [Error: %s]\n", err); - if ((hash_val = switch_core_hash_find(event_hash, "0"))) { - switch_safe_free(hash_val); - } switch_core_hash_destroy(&event_hash); return SWITCH_STATUS_GENERR; } /* sqldb is ready. Fire holding events! */ - if ((hash_val = switch_core_hash_find(event_hash, "0"))) { - switch_safe_free(hash_val); - switch_core_hash_delete(event_hash, "0"); - } - for (hi = switch_core_hash_first(event_hash); hi; hi = switch_core_hash_next(&hi)) { switch_core_hash_this(hi, NULL, NULL, &hash_val); event = (switch_event_t *)hash_val; diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index af52ab9495..c8c268387b 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -314,6 +314,37 @@ FST_CORE_BEGIN("./conf") free(item); } FST_TEST_END() + + FST_TEST_BEGIN(test_switch_core_hash_insert_pointer) + { + int i, sum = 0; + switch_hash_index_t *hi; + switch_hash_t *hash = NULL; + switch_core_hash_init(&hash); + fst_requires(hash); + + for (i = 0; i < 10; i++) { + int *num = malloc(sizeof(int)); + *num = i; + fst_check_int_equals(switch_core_hash_insert_pointer(hash, (void*)num), SWITCH_STATUS_SUCCESS); + } + + i = 0; + for (hi = switch_core_hash_first(hash); hi; hi = switch_core_hash_next(&hi)) { + void *hash_val; + switch_core_hash_this(hi, NULL, NULL, &hash_val); + sum += *(int*)hash_val; + free(hash_val); + i++; + } + + fst_check_int_equals(i, 10); + fst_check_int_equals(sum, 45); + + switch_core_hash_destroy(&hash); + fst_requires(hash == NULL); + } + FST_TEST_END() } FST_SUITE_END() } From f21da2885b7882fce5953555b960a3bc8199b802 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 27 Feb 2021 01:10:12 +0300 Subject: [PATCH 211/655] [mod_verto] Add hack.diff to mcast's swig --- src/mod/endpoints/mod_verto/Makefile.am | 2 +- src/mod/endpoints/mod_verto/mcast/hack.diff | 29 +++++++++++++++++++ .../endpoints/mod_verto/mcast/mcast_wrap.cpp | 3 ++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/mod/endpoints/mod_verto/mcast/hack.diff diff --git a/src/mod/endpoints/mod_verto/Makefile.am b/src/mod/endpoints/mod_verto/Makefile.am index dd54a32ee4..2c8f4f2334 100644 --- a/src/mod/endpoints/mod_verto/Makefile.am +++ b/src/mod/endpoints/mod_verto/Makefile.am @@ -25,7 +25,7 @@ MCAST_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(PERL_LDFLAGS endif mcast/mcast_wrap.cpp: - cd mcast && swig -module MCAST -shadow -perl5 -c++ -DMULTIPLICITY -I../src/include -o mcast_wrap.cpp MCAST.i + cd mcast && swig -module MCAST -shadow -perl5 -c++ -DMULTIPLICITY -I../src/include -o mcast_wrap.cpp MCAST.i && patch -s -p0 -i hack.diff mcast/perlxsi.c: $(PERL) -MExtUtils::Embed -e xsinit -- -o mcast/perlxsi.c diff --git a/src/mod/endpoints/mod_verto/mcast/hack.diff b/src/mod/endpoints/mod_verto/mcast/hack.diff new file mode 100644 index 0000000000..578a60bd90 --- /dev/null +++ b/src/mod/endpoints/mod_verto/mcast/hack.diff @@ -0,0 +1,29 @@ +--- mcast_wrap.cpp.old 2015-06-16 12:27:19.024000000 -0500 ++++ mcast_wrap.cpp 2015-06-16 12:34:51.540000000 -0500 +@@ -1965,7 +1965,7 @@ XS(_wrap_McastHandle_send) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "McastHandle_send" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); +- assert(arg1); ++ if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "McastHandle_send" "', argument " "1"" is NULL"); + result = (int)(arg1)->send((char const *)arg2); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + +@@ -2006,7 +2006,7 @@ XS(_wrap_McastHandle_recv) { + } + arg2 = static_cast< int >(val2); + } +- assert(arg1); ++ if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "McastHandle_recv" "', argument " "1"" is NULL"); + result = (char *)(arg1)->recv(arg2); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + +@@ -2037,7 +2037,7 @@ XS(_wrap_McastHandle_filenum) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "McastHandle_filenum" "', argument " "1"" of type '" "McastHandle *""'"); + } + arg1 = reinterpret_cast< McastHandle * >(argp1); +- assert(arg1); ++ if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "McastHandle_filenum" "', argument " "1"" is NULL"); + result = (arg1)->filenum(); + ST(argvi) = SWIG_NewPointerObj((new mcast_socket_t(static_cast< const mcast_socket_t& >(result))), SWIGTYPE_p_mcast_socket_t, SWIG_POINTER_OWN | 0); argvi++ ; + diff --git a/src/mod/endpoints/mod_verto/mcast/mcast_wrap.cpp b/src/mod/endpoints/mod_verto/mcast/mcast_wrap.cpp index 5473788de7..7a1eb92c89 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast_wrap.cpp +++ b/src/mod/endpoints/mod_verto/mcast/mcast_wrap.cpp @@ -1965,6 +1965,7 @@ XS(_wrap_McastHandle_send) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "McastHandle_send" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); + if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "McastHandle_send" "', argument " "1"" is NULL"); result = (int)(arg1)->send((char const *)arg2); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; @@ -2005,6 +2006,7 @@ XS(_wrap_McastHandle_recv) { } arg2 = static_cast< int >(val2); } + if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "McastHandle_recv" "', argument " "1"" is NULL"); result = (char *)(arg1)->recv(arg2); ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; @@ -2035,6 +2037,7 @@ XS(_wrap_McastHandle_filenum) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "McastHandle_filenum" "', argument " "1"" of type '" "McastHandle *""'"); } arg1 = reinterpret_cast< McastHandle * >(argp1); + if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "McastHandle_filenum" "', argument " "1"" is NULL"); result = (arg1)->filenum(); ST(argvi) = SWIG_NewPointerObj((new mcast_socket_t(static_cast< const mcast_socket_t& >(result))), SWIGTYPE_p_mcast_socket_t, SWIG_POINTER_OWN | 0); argvi++ ; From 0b0f5fff65e28fe815648644a13b12eace15c255 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 6 Apr 2021 20:00:13 +0300 Subject: [PATCH 212/655] [mod_sofia] Cleanup sofia_glue_get_host() and make the pool arg be required. --- src/mod/endpoints/mod_sofia/sofia_glue.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 1f2afef85c..c00c439600 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3454,17 +3454,15 @@ char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool) { char *s, *p; + switch_assert(pool != NULL); + if ((p = strchr(str, '@'))) { p++; } else { return NULL; } - if (pool) { - s = switch_core_strdup(pool, p); - } else { - s = strdup(p); - } + s = switch_core_strdup(pool, p); for (p = s; p && *p; p++) { if ((*p == ';') || (*p == '>')) { From 58abf91d1d325b706ee5446983025add193e63bf Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 2 Apr 2021 16:26:08 +0300 Subject: [PATCH 213/655] [Core] Add new switch_core_hash_insert_dup_auto_free() API --- src/include/switch_core.h | 18 ++++++++++++++---- src/mod/endpoints/mod_sofia/sofia.c | 7 +------ src/switch_core_hash.c | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index b6b3efbd90..a0c91ec6fd 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1446,6 +1446,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_pointer(switch_hash_t *h */ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t *hash, const char *key, const void *data); +/*! + \brief Insert strdup(str) into a hash and set flags so the value is automatically freed on delete + \param hash the hash to add str to + \param key the name of the key to add the str to + \param str string to strdup and add + \return SWITCH_STATUS_SUCCESS if the data is added + \note the string key must be a constant or a dynamic string +*/ +SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup_auto_free(switch_hash_t *hash, const char *key, const char *str); + /*! \brief Insert data into a hash \param hash the hash to add data to @@ -1469,10 +1479,10 @@ SWITCH_DECLARE(void *) switch_core_hash_insert_alloc_destructor(_In_ switch_hash #define switch_core_hash_insert_alloc(_h, _k, _s) switch_core_hash_insert_alloc_destructor(_h, _k, _s, NULL) /*! - \brief Insert strdup(data) into a hash - \param hash the hash to add data to - \param key the name of the key to add the data to - \param data string to strdup and add + \brief Insert strdup(str) into a hash + \param hash the hash to add str to + \param key the name of the key to add the str to + \param str string to strdup and add \return SWITCH_STATUS_SUCCESS if the data is added \note the string key must be a constant or a dynamic string */ diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e5ba5ce046..fec5997f08 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2441,16 +2441,11 @@ void sofia_event_callback(nua_event_t event, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "detaching session %s\n", sofia_private->uuid); if (!zstr(tech_pvt->call_id)) { - char *uuid = strdup(switch_core_session_get_uuid(session)); tech_pvt->sofia_private = NULL; tech_pvt->nh = NULL; sofia_set_flag(tech_pvt, TFLAG_BYE); switch_mutex_lock(profile->flag_mutex); - - if (switch_core_hash_insert_auto_free(profile->chat_hash, tech_pvt->call_id, uuid) != SWITCH_STATUS_SUCCESS) { - switch_safe_free(uuid); - } - + switch_core_hash_insert_dup_auto_free(profile->chat_hash, tech_pvt->call_id, switch_core_session_get_uuid(session)); switch_mutex_unlock(profile->flag_mutex); nua_handle_destroy(nh); } else { diff --git a/src/switch_core_hash.c b/src/switch_core_hash.c index 1f13a44a6f..3009ec4824 100644 --- a/src/switch_core_hash.c +++ b/src/switch_core_hash.c @@ -85,6 +85,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t return SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup_auto_free(switch_hash_t *hash, const char *key, const char *str) +{ + char *dkey = strdup(key); + char *dup = strdup(str); + + assert(dup); + + if (switch_hashtable_insert_destructor(hash, dkey, (void *)dup, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE | HASHTABLE_DUP_CHECK, NULL)) { + return SWITCH_STATUS_SUCCESS; + } + + switch_safe_free(dup); + switch_safe_free(dkey); + + return SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(void *) switch_core_hash_insert_alloc_destructor(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ size_t size, hashtable_destructor_t destructor) { char *dkey; void *data; From 21952f26c1861c140d703d5e503d3732bd0e9e7f Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 6 Apr 2021 01:19:57 +0300 Subject: [PATCH 214/655] [freeswitch] Argument with 'nonnull' attribute passed null in reincarnate_protect() --- src/switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch.c b/src/switch.c index abb66ef86f..d10994c4c2 100644 --- a/src/switch.c +++ b/src/switch.c @@ -390,13 +390,13 @@ static void reincarnate_protect(char **argv) { sigaction(SIGTERM, &sa15_prev, NULL); sigaction(SIGCHLD, &sa17_prev, NULL); if (argv) { - if (execv(argv[0], argv) == -1) { + if (argv[0] && execv(argv[0], argv) == -1) { char buf[256]; fprintf(stderr, "Reincarnate execv() failed: %d %s\n", errno, switch_strerror_r(errno, buf, sizeof(buf))); } fprintf(stderr, "Trying reincarnate-reexec plan B...\n"); - if (execvp(argv[0], argv) == -1) { + if (argv[0] && execvp(argv[0], argv) == -1) { char buf[256]; fprintf(stderr, "Reincarnate execvp() failed: %d %s\n", errno, switch_strerror_r(errno, buf, sizeof(buf))); From 8201f54a2c07fd3873a7f2a7446b889676550a66 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 6 Apr 2021 23:06:45 +0300 Subject: [PATCH 215/655] [Core] Fix possible memory leak in switch_console_complete() --- src/switch_console.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_console.c b/src/switch_console.c index ec891d44b4..2de5ac27ab 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -722,6 +722,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n"); + switch_safe_free(dup); return CC_ERROR; } From 36ac71f6217d0c6e75a1546867a52c9b42ed526b Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 6 Apr 2021 02:23:44 +0300 Subject: [PATCH 216/655] [Core] Fix false-positive memory leak in switch_core_set_variable() detected by scan-build --- src/switch_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_core.c b/src/switch_core.c index 2589d276a4..cacff3cdeb 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -446,7 +446,8 @@ SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *v if (value) { char *v = strdup(value); switch_string_var_check(v, SWITCH_TRUE); - switch_event_add_header_string(runtime.global_vars, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, varname, v); + switch_event_add_header_string(runtime.global_vars, SWITCH_STACK_BOTTOM, varname, v); + free(v); } else { switch_event_del_header(runtime.global_vars, varname); } From c1b00d945bbfeeef2348e32531df94c9868d7600 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 6 Apr 2021 21:31:44 +0300 Subject: [PATCH 217/655] [mod_verto] Fix memory leak and a deadlock on verto endpoint interface in verto_outgoing_channel() --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 342ed8b26e..dba9d63208 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -5496,7 +5496,7 @@ static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session free(dial_str); } - return cause; + goto end; } else { const char *dialed_user = switch_event_get_header(var_event, "dialed_user"); const char *dialed_domain = switch_event_get_header(var_event, "dialed_domain"); From c58b659f3f989584d5d7fcf1517793d7165bde19 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 1 Apr 2021 03:37:10 +0300 Subject: [PATCH 218/655] [Core] Add new switch_channel_set_variable_strip_quotes API, cleanup mod_sofia. --- src/include/switch_channel.h | 3 +++ src/mod/endpoints/mod_sofia/sofia.c | 32 ++-------------------- src/switch_channel.c | 42 +++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 3786d4583c..6692ceaa7f 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -278,6 +278,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_get_log_tags(switch_channel_t *ch SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check); +SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_strip_quotes_var_check(switch_channel_t *channel, + const char *varname, const char *value, switch_bool_t var_check); SWITCH_DECLARE(switch_status_t) switch_channel_add_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check, switch_stack_t stack); SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...); @@ -295,6 +297,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_transfer_variable_prefix(switch_c #define switch_channel_set_variable_safe(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_FALSE) #define switch_channel_set_variable(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_TRUE) +#define switch_channel_set_variable_strip_quotes(_channel, _var, _val) switch_channel_set_variable_strip_quotes_var_check(_channel, _var, _val, SWITCH_TRUE) #define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index fec5997f08..82b912341b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -201,24 +201,6 @@ static const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, return uri; } -static char *strip_quotes(const char *in) -{ - char *t = (char *) in; - char *r = (char *) in; - - if (t && *t == '"') { - t++; - - if (end_of(t) == '"') { - r = strdup(t); - switch_assert(r); - end_of(r) = '\0'; - } - } - - return r; -} - static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip, switch_core_session_t *session, nua_handle_t *nh) { @@ -324,12 +306,8 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip, } if (sip->sip_from) { - char *p = strip_quotes(sip->sip_from->a_display); + switch_channel_set_variable_strip_quotes(channel, "sip_from_display", sip->sip_from->a_display); - if (p) { - switch_channel_set_variable(channel, "sip_from_display", p); - } - if (p != sip->sip_from->a_display) free(p); if ((full = sip_header_as_string(nua_handle_get_home(nh), (void *) sip->sip_from))) { switch_channel_set_variable(channel, "sip_full_from", full); su_free(nua_handle_get_home(nh), full); @@ -337,13 +315,7 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip, } if (sip->sip_to) { - char *p = strip_quotes(sip->sip_to->a_display); - - if (p) { - switch_channel_set_variable(channel, "sip_to_display", p); - } - - if (p != sip->sip_to->a_display) free(p); + switch_channel_set_variable_strip_quotes(channel, "sip_to_display", sip->sip_to->a_display); if ((full = sip_header_as_string(nua_handle_get_home(nh), (void *) sip->sip_to))) { switch_channel_set_variable(channel, "sip_full_to", full); diff --git a/src/switch_channel.c b/src/switch_channel.c index 1beeaef4c4..9ce2fdc52e 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1496,6 +1496,48 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_cha return status; } +SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_strip_quotes_var_check(switch_channel_t *channel, + const char *varname, const char *value, switch_bool_t var_check) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + + switch_assert(channel != NULL); + + switch_mutex_lock(channel->profile_mutex); + if (channel->variables && !zstr(varname)) { + if (zstr(value)) { + switch_event_del_header(channel->variables, varname); + } else { + int ok = 1; + char *t = (char *)value; + char *r = (char *)value; + + if (t && *t == '"') { + t++; + if (end_of(t) == '"') { + r = strdup(t); + switch_assert(r); + end_of(r) = '\0'; + } + } + + if (var_check) { + ok = !switch_string_var_check_const(r); + } + if (ok) { + switch_event_add_header_string(channel->variables, SWITCH_STACK_BOTTOM, varname, r); + } else { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT, "Invalid data (${%s} contains a variable)\n", varname); + } + + if (r != value) free(r); + } + status = SWITCH_STATUS_SUCCESS; + } + switch_mutex_unlock(channel->profile_mutex); + + return status; +} SWITCH_DECLARE(switch_status_t) switch_channel_add_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check, switch_stack_t stack) From b9fdf00f6f464c6c76b8739ccbf1d18f10409199 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 5 Apr 2021 23:23:37 +0300 Subject: [PATCH 219/655] [Core] Fix a false-positive memory leak detected by scan-build in switch_channel_set_variable_strip_quotes_var_check() --- src/switch_channel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 9ce2fdc52e..8aa36aec88 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1511,11 +1511,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_strip_quotes_var_che int ok = 1; char *t = (char *)value; char *r = (char *)value; + char *tmp = NULL; if (t && *t == '"') { t++; if (end_of(t) == '"') { - r = strdup(t); + r = tmp = strdup(t); switch_assert(r); end_of(r) = '\0'; } @@ -1530,7 +1531,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_strip_quotes_var_che switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT, "Invalid data (${%s} contains a variable)\n", varname); } - if (r != value) free(r); + switch_safe_free(tmp); } status = SWITCH_STATUS_SUCCESS; } From 3f958d37246f2143ec6ded2f9b9da4270176d68f Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 19 Oct 2021 03:03:55 +0300 Subject: [PATCH 220/655] [mod_verto] scan-build: fix false-positive Argument with 'nonnull' attribute passed null in check_auth --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index dba9d63208..06cb6c7652 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1050,7 +1050,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * } - if (zstr(use_passwd) || strcmp(a1_hash ? a1_hash : passwd, use_passwd)) { + if (!use_passwd || zstr(use_passwd) || strcmp(a1_hash ? a1_hash : passwd, use_passwd)) { r = SWITCH_FALSE; *code = CODE_AUTH_FAILED; switch_snprintf(message, mlen, "Authentication Failure"); From b90a38c8dd78349613830ce808a0aea899c687c1 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 18 Oct 2021 18:07:19 +0300 Subject: [PATCH 221/655] [Testing] Enable scan-build 7 on Drone CI --- .drone.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index d7bcb8a7d9..acdc0b51c0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -79,13 +79,13 @@ name: scan-build steps: - name: bootstrap - image: signalwire/freeswitch-public-base:stretch + image: signalwire/freeswitch-public-base pull: always commands: - ./bootstrap.sh -j - name: configure - image: signalwire/freeswitch-public-base:stretch + image: signalwire/freeswitch-public-base pull: always commands: - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev @@ -116,13 +116,13 @@ steps: - ./configure - name: scan-build - image: signalwire/freeswitch-public-base:stretch + image: signalwire/freeswitch-public-base pull: always commands: - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev - mkdir -p scan-build - - echo '#!/bin/bash\nscan-build-4.0 -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-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 - chmod +x scan.sh - ./scan.sh - exitstatus=`cat ./scan-build-status.txt` @@ -148,6 +148,6 @@ trigger: --- kind: signature -hmac: 5d5cfb225053294d7cf1a4fed88eaf9a3a53c99a7bad4dc7164eece336c8861a +hmac: 500b43fb74a889e2a75e115a4d64c579a6bc48b9521e260908859d7359f2d46b ... From 3c4a8d33f5e94713ada4bdb100da27364d0771e6 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 13 Oct 2021 20:26:21 +0300 Subject: [PATCH 222/655] [Packaging] Require specific libsofia-sip-ua0 version when installing FreeSWITCH binary packages. --- debian/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 61098cb11a..65830c8cb8 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -371,7 +371,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: libfreeswitch1 Architecture: amd64 armhf -Depends: \${shlibs:Depends}, \${misc:Depends} +Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.5) Recommends: Suggests: libfreeswitch1-dbg Conflicts: freeswitch-all (<= 1.6.7) From 30eaf2c736829d1e364a672e4791dd235bcc4113 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 19 Oct 2021 21:23:32 +0300 Subject: [PATCH 223/655] Bump sofia-sip library requirement to version 1.13.6 --- configure.ac | 2 +- debian/bootstrap.sh | 4 ++-- freeswitch.spec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 150773412d..b5dfe74909 100644 --- a/configure.ac +++ b/configure.ac @@ -725,7 +725,7 @@ PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[ AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent]) ]) -PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.5],[ +PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.6],[ AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[ AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent]) ]) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 65830c8cb8..fd5ff75cf0 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -332,7 +332,7 @@ Build-Depends: uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev, # used by many modules libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, - bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.5), + bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.6), libspandsp3-dev, # used to format the private freeswitch apt-repo key properly gnupg, @@ -371,7 +371,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: libfreeswitch1 Architecture: amd64 armhf -Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.5) +Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.6) Recommends: Suggests: libfreeswitch1-dbg Conflicts: freeswitch-all (<= 1.6.7) diff --git a/freeswitch.spec b/freeswitch.spec index e4a0a178a3..19a7dd5516 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -140,7 +140,7 @@ BuildRequires: curl-devel >= 7.19 BuildRequires: gcc-c++ BuildRequires: libtool >= 1.5.17 BuildRequires: openssl-devel >= 1.0.1e -BuildRequires: sofia-sip-devel >= 1.13.5 +BuildRequires: sofia-sip-devel >= 1.13.6 BuildRequires: spandsp3-devel >= 3.0 BuildRequires: pcre-devel BuildRequires: speex-devel From b8be418fb813f0ca2732e983cd19e639033af3f5 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 17 Jul 2021 22:34:43 +0300 Subject: [PATCH 224/655] [Core, mod_commands] Implement memory allocation statistics by adding the "memory" API command. --- src/include/switch_utils.h | 1 + .../applications/mod_commands/mod_commands.c | 13 ++ src/switch_utils.c | 137 ++++++++++++++++++ 3 files changed, 151 insertions(+) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 9877829824..649ad926b3 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1488,6 +1488,7 @@ SWITCH_DECLARE(switch_status_t) switch_digest(const char *digest_name, unsigned SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, char **digest_str, const void *input, switch_size_t inputLen, unsigned int *outputlen); SWITCH_DECLARE(char *) switch_must_strdup(const char *_s); +SWITCH_DECLARE(const char *) switch_memory_usage_stream(switch_stream_handle_t *stream); SWITCH_END_EXTERN_C #endif diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index ad5bd51ce9..aec3097e45 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -7485,6 +7485,18 @@ SWITCH_STANDARD_API(json_function) return SWITCH_STATUS_SUCCESS; } +SWITCH_STANDARD_API(memory_function) +{ + const char *err; + if (!(err = switch_memory_usage_stream(stream))) { + stream->write_function(stream, "+OK\n"); + } else { + stream->write_function(stream, "-ERR %s\n", err); + } + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) { switch_api_interface_t *commands_api_interface; @@ -7652,6 +7664,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "file_exists", "Check if a file exists on server", file_exists_function, "<file>"); SWITCH_ADD_API(commands_api_interface, "getcputime", "Gets CPU time in milliseconds (user,kernel)", getcputime_function, GETCPUTIME_SYNTAX); SWITCH_ADD_API(commands_api_interface, "json", "JSON API", json_function, "JSON"); + SWITCH_ADD_API(commands_api_interface, "memory", "Memory usage statistics", memory_function, "memory"); SWITCH_ADD_JSON_API(json_api_interface, "mediaStats", "JSON Media Stats", json_stats_function, ""); diff --git a/src/switch_utils.c b/src/switch_utils.c index 932e9d963c..c19a4c6b60 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -42,6 +42,7 @@ #include <sys/types.h> #include <unistd.h> #else +#include <intsafe.h> /* SIZETMult() */ /* process.h is required for _getpid() */ #include <process.h> #endif @@ -55,6 +56,10 @@ #include <openssl/evp.h> #endif +#ifdef __GLIBC__ +#include <malloc.h> /* mallinfo() */ +#endif + struct switch_network_node { ip_t ip; ip_t mask; @@ -4646,6 +4651,138 @@ SWITCH_DECLARE(char *) switch_must_strdup(const char *_s) return s; } +SWITCH_DECLARE(const char *) switch_memory_usage_stream(switch_stream_handle_t *stream) +{ + const char *status = NULL; +#ifdef __GLIBC__ +/* + * The mallinfo2() function was added in glibc 2.33. + * https://man7.org/linux/man-pages/man3/mallinfo.3.html + */ +#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 33) + struct mallinfo2 mi; + + mi = mallinfo2(); + + stream->write_function(stream, "Total non-mmapped bytes (arena): %" SWITCH_SIZE_T_FMT "\n", mi.arena); + stream->write_function(stream, "# of free chunks (ordblks): %" SWITCH_SIZE_T_FMT "\n", mi.ordblks); + stream->write_function(stream, "# of free fastbin blocks (smblks): %" SWITCH_SIZE_T_FMT "\n", mi.smblks); + stream->write_function(stream, "# of mapped regions (hblks): %" SWITCH_SIZE_T_FMT "\n", mi.hblks); + stream->write_function(stream, "Bytes in mapped regions (hblkhd): %" SWITCH_SIZE_T_FMT "\n", mi.hblkhd); + stream->write_function(stream, "Max. total allocated space (usmblks): %" SWITCH_SIZE_T_FMT "\n", mi.usmblks); + stream->write_function(stream, "Free bytes held in fastbins (fsmblks): %" SWITCH_SIZE_T_FMT "\n", mi.fsmblks); + stream->write_function(stream, "Total allocated space (uordblks): %" SWITCH_SIZE_T_FMT "\n", mi.uordblks); + stream->write_function(stream, "Total free space (fordblks): %" SWITCH_SIZE_T_FMT "\n", mi.fordblks); + stream->write_function(stream, "Topmost releasable block (keepcost): %" SWITCH_SIZE_T_FMT "\n", mi.keepcost); +#else + struct mallinfo mi; + + mi = mallinfo(); + + stream->write_function(stream, "Total non-mmapped bytes (arena): %u\n", mi.arena); + stream->write_function(stream, "# of free chunks (ordblks): %u\n", mi.ordblks); + stream->write_function(stream, "# of free fastbin blocks (smblks): %u\n", mi.smblks); + stream->write_function(stream, "# of mapped regions (hblks): %u\n", mi.hblks); + stream->write_function(stream, "Bytes in mapped regions (hblkhd): %u\n", mi.hblkhd); + stream->write_function(stream, "Max. total allocated space (usmblks): %u\n", mi.usmblks); + stream->write_function(stream, "Free bytes held in fastbins (fsmblks): %u\n", mi.fsmblks); + stream->write_function(stream, "Total allocated space (uordblks): %u\n", mi.uordblks); + stream->write_function(stream, "Total free space (fordblks): %u\n", mi.fordblks); + stream->write_function(stream, "Topmost releasable block (keepcost): %u\n", mi.keepcost); + +#endif + + switch_goto_status(NULL, done); +#else +#ifdef WIN32 + /* Based on: https://docs.microsoft.com/en-us/windows/win32/memory/enumerating-a-heap and https://docs.microsoft.com/en-us/windows/win32/memory/getting-process-heaps */ + PHANDLE aHeaps; + SIZE_T BytesToAllocate; + DWORD HeapsIndex; + DWORD HeapsLength; + DWORD NumberOfHeaps; + HRESULT Result; + HANDLE hDefaultProcessHeap; + size_t CommittedSizeTotal = 0; + size_t UnCommittedSizeTotal = 0; + size_t SizeTotal = 0; + size_t OverheadTotal = 0; + + NumberOfHeaps = GetProcessHeaps(0, NULL); + Result = SIZETMult(NumberOfHeaps, sizeof(*aHeaps), &BytesToAllocate); + if (Result != S_OK) { + switch_goto_status("SIZETMult failed.", done); + } + + hDefaultProcessHeap = GetProcessHeap(); + if (hDefaultProcessHeap == NULL) { + switch_goto_status("Failed to retrieve the default process heap", done); + } + + aHeaps = (PHANDLE)HeapAlloc(hDefaultProcessHeap, 0, BytesToAllocate); + if (aHeaps == NULL) { + switch_goto_status("HeapAlloc failed to allocate space for heaps", done); + } + + HeapsLength = NumberOfHeaps; + NumberOfHeaps = GetProcessHeaps(HeapsLength, aHeaps); + + if (NumberOfHeaps == 0) { + switch_goto_status("Failed to retrieve heaps", cleanup); + } else if (NumberOfHeaps > HeapsLength) { + /* + * Compare the latest number of heaps with the original number of heaps. + * If the latest number is larger than the original number, another + * component has created a new heap and the buffer is too small. + */ + switch_goto_status("Another component created a heap between calls.", cleanup); + } + + stream->write_function(stream, "Process has %d heaps.\n", HeapsLength); + for (HeapsIndex = 0; HeapsIndex < HeapsLength; ++HeapsIndex) { + PROCESS_HEAP_ENTRY Entry; + HANDLE hHeap = aHeaps[HeapsIndex]; + + stream->write_function(stream, "Heap %d at address: %#p.\n", HeapsIndex, aHeaps[HeapsIndex]); + + /* Lock the heap to prevent other threads from accessing the heap during enumeration. */ + if (HeapLock(hHeap) == FALSE) { + switch_goto_status("Failed to lock heap.", cleanup); + } + + Entry.lpData = NULL; + while (HeapWalk(hHeap, &Entry) != FALSE) { + if ((Entry.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) { + } else if ((Entry.wFlags & PROCESS_HEAP_REGION) != 0) { + CommittedSizeTotal += Entry.Region.dwCommittedSize; + UnCommittedSizeTotal += Entry.Region.dwUnCommittedSize; + } + + SizeTotal += Entry.cbData; + OverheadTotal += Entry.cbOverhead; + } + + /* Unlock the heap to allow other threads to access the heap after enumeration has completed. */ + if (HeapUnlock(hHeap) == FALSE) { + abort(); + } + } + + stream->write_function(stream, "Committed bytes: %" SWITCH_SIZE_T_FMT "\n", CommittedSizeTotal); + stream->write_function(stream, "Uncommited bytes: %" SWITCH_SIZE_T_FMT "\n", UnCommittedSizeTotal); + stream->write_function(stream, "Size: %" SWITCH_SIZE_T_FMT "\n", SizeTotal); + stream->write_function(stream, "Overhead: %" SWITCH_SIZE_T_FMT"\n", OverheadTotal); + +cleanup: + HeapFree(hDefaultProcessHeap, 0, aHeaps); +#else + switch_goto_status("Memory usage statistics is not implemented on the current platform.", done); +#endif +#endif +done: + return status; +} + /* For Emacs: * Local Variables: * mode:c From 24958e51c2d75367f3f921edc6970a86ae083991 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 20 Oct 2021 19:49:51 +0300 Subject: [PATCH 225/655] [mod_python3] Fix switch module definition preventing mod_python3 from loading. --- src/mod/languages/mod_python3/mod_python3.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/languages/mod_python3/mod_python3.c b/src/mod/languages/mod_python3/mod_python3.c index c61c5bb73d..6fd8f08f76 100644 --- a/src/mod/languages/mod_python3/mod_python3.c +++ b/src/mod/languages/mod_python3/mod_python3.c @@ -58,9 +58,9 @@ static void set_max_recursion_depth(void); static switch_api_interface_t python_run_interface; static void print_python_error(const char * script); -SWITCH_MODULE_LOAD_FUNCTION(mod_python_load); -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown); -SWITCH_MODULE_DEFINITION_EX(mod_python, mod_python_load, mod_python_shutdown, NULL, SMODF_GLOBAL_SYMBOLS); +SWITCH_MODULE_LOAD_FUNCTION(mod_python3_load); +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python3_shutdown); +SWITCH_MODULE_DEFINITION_EX(mod_python3, mod_python3_load, mod_python3_shutdown, NULL, SMODF_GLOBAL_SYMBOLS); static struct { switch_memory_pool_t *pool; @@ -535,7 +535,7 @@ SWITCH_STANDARD_CHAT_APP(python_chat_function) } -SWITCH_MODULE_LOAD_FUNCTION(mod_python_load) +SWITCH_MODULE_LOAD_FUNCTION(mod_python3_load) { switch_api_interface_t *api_interface; switch_application_interface_t *app_interface; @@ -595,7 +595,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_python_load) /* Called when the system shuts down*/ -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown) +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python3_shutdown) { PyInterpreterState *mainInterpreterState; PyThreadState *myThreadState; From 578024ed861226eee58706a393a891e1bb41afec Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed, 20 Oct 2021 20:16:39 -0400 Subject: [PATCH 226/655] [mod_python3] Replace previously removed deprecated calls --- src/mod/languages/mod_python3/mod_python3.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mod/languages/mod_python3/mod_python3.c b/src/mod/languages/mod_python3/mod_python3.c index 6fd8f08f76..d0c7c20df5 100644 --- a/src/mod/languages/mod_python3/mod_python3.c +++ b/src/mod/languages/mod_python3/mod_python3.c @@ -574,7 +574,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_python3_load) // swap out threadstate since the call threads will create // their own and swap in their threadstate - PyThreadState_Swap(NULL); + // and release the global interpreter lock + PyEval_SaveThread(); + } switch_mutex_init(&THREAD_POOL_LOCK, SWITCH_MUTEX_NESTED, pool); @@ -619,6 +621,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python3_shutdown) pt = nextpt; } PyThreadState_Swap(mainThreadState); + PyEval_ReleaseThread(mainThreadState); switch_yield(1000000); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt); @@ -644,9 +647,13 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python3_shutdown) mainInterpreterState = mainThreadState->interp; myThreadState = PyThreadState_New(mainInterpreterState); PyThreadState_Swap(myThreadState); + PyEval_ReleaseThread(myThreadState); Py_Finalize(); + // Release the global interpreter lock + PyEval_SaveThread(); + return SWITCH_STATUS_UNLOAD; } From 42a65664808681468739746fd85dde8b5809d417 Mon Sep 17 00:00:00 2001 From: "Fernando S. Santos" <fernandojdk@gmail.com> Date: Thu, 21 Oct 2021 13:35:10 -0300 Subject: [PATCH 227/655] =?UTF-8?q?[Configuration]=20Fix=20Brazil=20daylig?= =?UTF-8?q?ht=E2=80=99s=20in=20xml=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/curl/autoload_configs/timezones.conf.xml | 2 +- conf/insideout/autoload_configs/timezones.conf.xml | 2 +- conf/minimal/autoload_configs/timezones.conf.xml | 2 +- conf/rayo/autoload_configs/timezones.conf.xml | 2 +- conf/sbc/autoload_configs/timezones.conf.xml | 2 +- conf/testing/autoload_configs/timezones.conf.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/curl/autoload_configs/timezones.conf.xml b/conf/curl/autoload_configs/timezones.conf.xml index 397e9a979f..14f87f8c67 100644 --- a/conf/curl/autoload_configs/timezones.conf.xml +++ b/conf/curl/autoload_configs/timezones.conf.xml @@ -184,7 +184,7 @@ <zone name="America/Rosario" value="ART3ARST,M10.1.0/0,M3.3.0/0" /> <zone name="America/Santiago" value="CLST" /> <zone name="America/Santo_Domingo" value="AST4" /> - <zone name="America/Sao_Paulo" value="BRT3BRST,M10.2.0/0,M2.3.0/0" /> + <zone name="America/Sao_Paulo" value="BRT3" /> <zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" /> <zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" /> <zone name="America/St_Barthelemy" value="AST4" /> diff --git a/conf/insideout/autoload_configs/timezones.conf.xml b/conf/insideout/autoload_configs/timezones.conf.xml index 397e9a979f..14f87f8c67 100644 --- a/conf/insideout/autoload_configs/timezones.conf.xml +++ b/conf/insideout/autoload_configs/timezones.conf.xml @@ -184,7 +184,7 @@ <zone name="America/Rosario" value="ART3ARST,M10.1.0/0,M3.3.0/0" /> <zone name="America/Santiago" value="CLST" /> <zone name="America/Santo_Domingo" value="AST4" /> - <zone name="America/Sao_Paulo" value="BRT3BRST,M10.2.0/0,M2.3.0/0" /> + <zone name="America/Sao_Paulo" value="BRT3" /> <zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" /> <zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" /> <zone name="America/St_Barthelemy" value="AST4" /> diff --git a/conf/minimal/autoload_configs/timezones.conf.xml b/conf/minimal/autoload_configs/timezones.conf.xml index 757d16c19d..0af4c77d7f 100644 --- a/conf/minimal/autoload_configs/timezones.conf.xml +++ b/conf/minimal/autoload_configs/timezones.conf.xml @@ -196,7 +196,7 @@ <zone name="America/Santarem" value="BRT3" /> <zone name="America/Santiago" value="CLST" /> <zone name="America/Santo_Domingo" value="AST4" /> - <zone name="America/Sao_Paulo" value="BRT3BRST,M10.3.0/0,M2.3.0/0" /> + <zone name="America/Sao_Paulo" value="BRT3" /> <zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" /> <zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" /> <zone name="America/Sitka" value="AKST9AKDT,M3.2.0,M11.1.0" /> diff --git a/conf/rayo/autoload_configs/timezones.conf.xml b/conf/rayo/autoload_configs/timezones.conf.xml index 397e9a979f..14f87f8c67 100644 --- a/conf/rayo/autoload_configs/timezones.conf.xml +++ b/conf/rayo/autoload_configs/timezones.conf.xml @@ -184,7 +184,7 @@ <zone name="America/Rosario" value="ART3ARST,M10.1.0/0,M3.3.0/0" /> <zone name="America/Santiago" value="CLST" /> <zone name="America/Santo_Domingo" value="AST4" /> - <zone name="America/Sao_Paulo" value="BRT3BRST,M10.2.0/0,M2.3.0/0" /> + <zone name="America/Sao_Paulo" value="BRT3" /> <zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" /> <zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" /> <zone name="America/St_Barthelemy" value="AST4" /> diff --git a/conf/sbc/autoload_configs/timezones.conf.xml b/conf/sbc/autoload_configs/timezones.conf.xml index 397e9a979f..14f87f8c67 100644 --- a/conf/sbc/autoload_configs/timezones.conf.xml +++ b/conf/sbc/autoload_configs/timezones.conf.xml @@ -184,7 +184,7 @@ <zone name="America/Rosario" value="ART3ARST,M10.1.0/0,M3.3.0/0" /> <zone name="America/Santiago" value="CLST" /> <zone name="America/Santo_Domingo" value="AST4" /> - <zone name="America/Sao_Paulo" value="BRT3BRST,M10.2.0/0,M2.3.0/0" /> + <zone name="America/Sao_Paulo" value="BRT3" /> <zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" /> <zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" /> <zone name="America/St_Barthelemy" value="AST4" /> diff --git a/conf/testing/autoload_configs/timezones.conf.xml b/conf/testing/autoload_configs/timezones.conf.xml index 757d16c19d..0af4c77d7f 100644 --- a/conf/testing/autoload_configs/timezones.conf.xml +++ b/conf/testing/autoload_configs/timezones.conf.xml @@ -196,7 +196,7 @@ <zone name="America/Santarem" value="BRT3" /> <zone name="America/Santiago" value="CLST" /> <zone name="America/Santo_Domingo" value="AST4" /> - <zone name="America/Sao_Paulo" value="BRT3BRST,M10.3.0/0,M2.3.0/0" /> + <zone name="America/Sao_Paulo" value="BRT3" /> <zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" /> <zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" /> <zone name="America/Sitka" value="AKST9AKDT,M3.2.0,M11.1.0" /> From 01fe8b36faa8c68c81f1192861c26ecfa6581d68 Mon Sep 17 00:00:00 2001 From: nrensen <nathanael@polymorpheus.com> Date: Fri, 22 Oct 2021 00:36:59 +0800 Subject: [PATCH 228/655] [Core] Fix portability for logging last_digit_time in switch_ivr_play_say.c --- src/switch_ivr_play_say.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index e8beea1153..091c76f982 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -3254,7 +3254,7 @@ static switch_status_t switch_collect_input_callback(switch_core_session_t *sess state->last_digit_time = switch_micro_time_now(); state->is_speech = SWITCH_FALSE; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = false; SWITCH_INPUT_TYPE_DTMF; last_digit_time=%lu\n", state->last_digit_time); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = false; SWITCH_INPUT_TYPE_DTMF; last_digit_time=%" SWITCH_INT64_T_FMT "\n", state->last_digit_time); if (!zstr(state->terminators) && strchr(state->terminators, dtmf->digit)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) ACCEPT TERMINATOR %c\n", @@ -3438,10 +3438,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_se if (sleep_time >= digit_timeout) { // too much time since last digit if (!switch_test_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, " (%s) INTER-DIGIT TIMEOUT is_speech = false; sleep_time >= digit_timeout; sleep_time=%i; last_digit_time=%lu; digit_timeout=%lu \n", switch_channel_get_name(channel), sleep_time, state.last_digit_time, (unsigned long)digit_timeout); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, " (%s) INTER-DIGIT TIMEOUT is_speech = false; sleep_time >= digit_timeout; sleep_time=%i; last_digit_time=%" SWITCH_INT64_T_FMT "; digit_timeout=%lu \n", switch_channel_get_name(channel), sleep_time, state.last_digit_time, (unsigned long)digit_timeout); switch_set_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = false; sleep_time >= digit_timeout; sleep_time=%i; last_digit_time=%lu; digit_timeout=%lu \n", sleep_time, state.last_digit_time, (unsigned long)digit_timeout); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = false; sleep_time >= digit_timeout; sleep_time=%i; last_digit_time=%" SWITCH_INT64_T_FMT "; digit_timeout=%lu \n", sleep_time, state.last_digit_time, (unsigned long)digit_timeout); } status = SWITCH_STATUS_SUCCESS; sleep_time = digit_timeout; @@ -3450,7 +3450,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_se sleep_time = digit_timeout - sleep_time; } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = true; sleep_time < digit_timeout; sleep_time=%i; last_digit_time=%lu; digit_timeout=%lu \n", sleep_time, state.last_digit_time, (unsigned long)digit_timeout); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nis_speech = true; sleep_time < digit_timeout; sleep_time=%i; last_digit_time=%" SWITCH_INT64_T_FMT "; digit_timeout=%lu \n", sleep_time, state.last_digit_time, (unsigned long)digit_timeout); } if (status != SWITCH_STATUS_BREAK && status != SWITCH_STATUS_SUCCESS) { From ce87856c91c01394d973fdcbfd4a9a45b210bba1 Mon Sep 17 00:00:00 2001 From: nrensen <nathanael@polymorpheus.com> Date: Fri, 22 Oct 2021 00:39:19 +0800 Subject: [PATCH 229/655] [mod_sofia] Remove redundant sip_from->a_url checks --- src/mod/endpoints/mod_sofia/sofia.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 82b912341b..491b9c6444 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -10661,7 +10661,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } } - if (sip->sip_from && sip->sip_from->a_url) { + if (sip->sip_from) { tech_pvt->from_user = switch_core_session_strdup(session, sip->sip_from->a_url->url_user); } tech_pvt->mparams.remote_ip = switch_core_session_strdup(session, network_ip); @@ -11236,7 +11236,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (profile->pres_type) { const char *presence_id = switch_channel_get_variable(channel, "presence_id"); - if (zstr(presence_id) && sip->sip_from && sip->sip_from->a_url) { + if (zstr(presence_id) && sip->sip_from) { const char *user = switch_str_nil(sip->sip_from->a_url->url_user); const char *host = switch_str_nil(sip->sip_from->a_url->url_host); char *tmp = switch_mprintf("%s@%s", user, host); From 8e2bba1d9d8151c3109aeb188bb428a1b81dcabc Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Sat, 12 Oct 2019 10:39:48 +0800 Subject: [PATCH 230/655] [mod_conference] make conference breakable --- src/mod/applications/mod_conference/conference_loop.c | 7 +++++++ src/mod/applications/mod_conference/conference_utils.c | 2 ++ src/mod/applications/mod_conference/mod_conference.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index 5d284fab97..25b418c55d 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -839,6 +839,13 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob continue; } + if (conference_utils_test_flag(member->conference, CFLAG_BREAKABLE) && + switch_channel_test_flag(channel, CF_BREAK)) { + switch_channel_clear_flag(channel, CF_BREAK); + status = SWITCH_STATUS_BREAK; + break; + } + /* Read a frame. */ status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); diff --git a/src/mod/applications/mod_conference/conference_utils.c b/src/mod/applications/mod_conference/conference_utils.c index 48716cc269..eb482b9165 100644 --- a/src/mod/applications/mod_conference/conference_utils.c +++ b/src/mod/applications/mod_conference/conference_utils.c @@ -216,6 +216,8 @@ void conference_utils_set_cflags(const char *flags, conference_flag_t *f) f[CFLAG_PERSONAL_CANVAS] = 1; } else if (!strcasecmp(argv[i], "ded-vid-layer-audio-floor")) { f[CFLAG_DED_VID_LAYER_AUDIO_FLOOR] = 1; + } else if (!strcasecmp(argv[i], "breakable")) { + f[CFLAG_BREAKABLE] = 1; } } diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index e551a4d053..f63838ecf6 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -255,6 +255,7 @@ typedef enum { CFLAG_VIDEO_MUTE_EXIT_CANVAS, CFLAG_NO_MOH, CFLAG_DED_VID_LAYER_AUDIO_FLOOR, + CFLAG_BREAKABLE, ///////////////////////////////// CFLAG_MAX } conference_flag_t; From b1714199cea82dae1fff190122a60f7520c33b4d Mon Sep 17 00:00:00 2001 From: Liyang <liyang@x-y-t.cn> Date: Mon, 20 May 2019 19:56:42 +0800 Subject: [PATCH 231/655] FS-11855: [Core] Offer all negotiated codecs in 200 OK when receiving re-INVITE without SDP --- src/include/switch_types.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 4 ++++ src/switch_core_media.c | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 059023e450..73c91d961e 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1564,6 +1564,7 @@ typedef enum { CF_T38_PASSTHRU, CF_DROP_DTMF, CF_REINVITE, + CF_NOSDP_REINVITE, CF_AUTOFLUSH_DURING_BRIDGE, CF_RTP_NOTIMER_DURING_BRIDGE, CF_AVPF, diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 491b9c6444..293199f07a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8028,6 +8028,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, goto done; } + switch_channel_set_flag(channel, CF_NOSDP_REINVITE); + if (switch_channel_var_true(channel, "sip_unhold_nosdp")) { switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, "sendrecv", zstr(tech_pvt->mparams.local_sdp_str) || !switch_channel_test_flag(channel, CF_PROXY_MODE)); @@ -8036,6 +8038,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, zstr(tech_pvt->mparams.local_sdp_str) || !switch_channel_test_flag(channel, CF_PROXY_MODE)); } + switch_channel_clear_flag(channel, CF_NOSDP_REINVITE); + if (zstr(tech_pvt->mparams.local_sdp_str)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot find a SDP\n"); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 0e94724249..a32781ad99 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -10582,10 +10582,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", a_engine->cur_payload_map->pt); - if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO)) { + if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO) || switch_channel_test_flag(session->channel, CF_NOSDP_REINVITE)) { switch_mutex_lock(smh->sdp_mutex); for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) { - if (pmap->pt != a_engine->cur_payload_map->pt) { + if (pmap->pt != a_engine->cur_payload_map->pt && pmap->pt != smh->mparams->te) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", pmap->pt); } } @@ -10621,10 +10621,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\r\n", a_engine->cur_payload_map->pt, fmtp_out); } - if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO)) { + if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO) || switch_channel_test_flag(session->channel, CF_NOSDP_REINVITE)) { switch_mutex_lock(smh->sdp_mutex); for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) { - if (pmap->pt != a_engine->cur_payload_map->pt) { + if (pmap->pt != a_engine->cur_payload_map->pt && pmap->pt != smh->mparams->te) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%ld\r\n", pmap->pt, pmap->iananame, pmap->rate); From 623fecd59971b9f9142eb32436cbf9dbd9815688 Mon Sep 17 00:00:00 2001 From: Seven Du <seven@signalwire.com> Date: Thu, 13 Feb 2020 00:34:59 +0800 Subject: [PATCH 232/655] [Core] Add partial Asr support --- src/mod/applications/mod_test/mod_test.c | 13 ++- src/switch_cpp.cpp | 6 +- src/switch_ivr_async.c | 45 ++++++--- src/switch_ivr_play_say.c | 49 ++++++---- tests/unit/switch_ivr_play_say.c | 115 +++++++++++++++++++++-- 5 files changed, 181 insertions(+), 47 deletions(-) diff --git a/src/mod/applications/mod_test/mod_test.c b/src/mod/applications/mod_test/mod_test.c index 9791d7a611..02292a7a3b 100644 --- a/src/mod/applications/mod_test/mod_test.c +++ b/src/mod/applications/mod_test/mod_test.c @@ -68,6 +68,7 @@ typedef struct { char *grammar; char *channel_uuid; switch_vad_t *vad; + int partial; } test_asr_t; @@ -268,12 +269,17 @@ static switch_status_t test_asr_get_results(switch_asr_handle_t *ah, char **resu } if (switch_test_flag(context, ASRFLAG_RESULT)) { + int is_partial = context->partial-- > 0 ? 1 : 0; *resultstr = switch_mprintf("{\"grammar\": \"%s\", \"text\": \"%s\", \"confidence\": %f}", context->grammar, context->result_text, context->result_confidence); - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_ERROR, "Result: %s\n", *resultstr); + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_NOTICE, "%sResult: %s\n", is_partial ? "Partial " : "Final ", *resultstr); - status = SWITCH_STATUS_SUCCESS; + if (is_partial) { + status = SWITCH_STATUS_MORE_DATA; + } else { + status = SWITCH_STATUS_SUCCESS; + } } else if (switch_test_flag(context, ASRFLAG_NOINPUT_TIMEOUT)) { switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "Result: NO INPUT\n"); @@ -361,6 +367,9 @@ static void test_asr_text_param(switch_asr_handle_t *ah, char *param, const char } else if (!strcasecmp("confidence", param) && fval >= 0.0) { context->result_confidence = fval; switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "confidence = %f\n", fval); + } else if (!strcasecmp("partial", param) && switch_true(val)) { + context->partial = 3; + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "partial = %d\n", context->partial); } } } diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index c412f2b7dc..fe71a6400a 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -1055,7 +1055,7 @@ SWITCH_DECLARE(char *) CoreSession::playAndDetectSpeech(char *file, char *engine char *result = NULL; - switch_status_t status = switch_ivr_play_and_detect_speech(session, file, engine, grammar, &result, 0, NULL); + switch_status_t status = switch_ivr_play_and_detect_speech(session, file, engine, grammar, &result, 0, ap); if (status == SWITCH_STATUS_SUCCESS) { // good } else if (status == SWITCH_STATUS_GENERR) { @@ -1063,12 +1063,12 @@ SWITCH_DECLARE(char *) CoreSession::playAndDetectSpeech(char *file, char *engine } else if (status == SWITCH_STATUS_NOT_INITALIZED) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "ASR INIT ERROR\n"); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "ERROR\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "ERROR status = %d\n", status); } end_allow_threads(); - return result; // remeber to free me + return result ? strdup(result) : NULL; // remeber to free me } SWITCH_DECLARE(void) CoreSession::say(const char *tosay, const char *module_name, const char *say_type, const char *say_method, const char *say_gender) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 07f28a36e8..a08223393c 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -4696,8 +4696,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se typedef struct { int done; char *result; + switch_input_args_t *original_args; } play_and_detect_speech_state_t; +static void deliver_asr_event(switch_core_session_t *session, switch_event_t *event, switch_input_args_t *args) +{ + if (args && args->input_callback) { + args->input_callback(session, (void *)event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); + } +} + static switch_status_t play_and_detect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *data, unsigned int len) { play_and_detect_speech_state_t *state = (play_and_detect_speech_state_t *)data; @@ -4708,7 +4716,10 @@ static switch_status_t play_and_detect_input_callback(switch_core_session_t *ses event = (switch_event_t *)input; if (event->event_id == SWITCH_EVENT_DETECTED_SPEECH) { const char *speech_type = switch_event_get_header(event, "Speech-Type"); + if (!zstr(speech_type)) { + deliver_asr_event(session, event, state->original_args); + if (!strcasecmp(speech_type, "detected-speech")) { const char *result; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "(%s) DETECTED SPEECH\n", switch_channel_get_name(channel)); @@ -4718,8 +4729,11 @@ static switch_status_t play_and_detect_input_callback(switch_core_session_t *ses } else { state->result = ""; } + state->original_args = NULL; state->done = PLAY_AND_DETECT_DONE_RECOGNIZING; return SWITCH_STATUS_BREAK; + } else if (!strcasecmp(speech_type, "detected-partial-speech")) { + // ok } else if (!strcasecmp(speech_type, "begin-speaking")) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "(%s) START OF SPEECH\n", switch_channel_get_name(channel)); return SWITCH_STATUS_BREAK; @@ -4727,6 +4741,8 @@ static switch_status_t play_and_detect_input_callback(switch_core_session_t *ses state->done = PLAY_AND_DETECT_DONE_RECOGNIZING; state->result = ""; return SWITCH_STATUS_BREAK; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unhandled speech type %s\n", speech_type); } } } @@ -4765,7 +4781,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se switch_status_t status = SWITCH_STATUS_FALSE; int recognizing = 0; switch_input_args_t myargs = { 0 }; - play_and_detect_speech_state_t state = { 0, "" }; + play_and_detect_speech_state_t state = { 0, "", NULL }; switch_channel_t *channel = switch_core_session_get_channel(session); arg_recursion_check_start(args); @@ -4776,10 +4792,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se if (!input_timeout) input_timeout = 5000; - if (!args) { - args = &myargs; - } - /* start speech detection */ if ((status = switch_ivr_detect_speech(session, mod_name, grammar, "", NULL, NULL)) != SWITCH_STATUS_SUCCESS) { /* map SWITCH_STATUS_FALSE to SWITCH_STATUS_GENERR to indicate grammar load failed @@ -4792,12 +4804,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se recognizing = 1; /* play the prompt, looking for detection result */ - args->input_callback = play_and_detect_input_callback; - args->buf = &state; - args->buflen = sizeof(state); - status = switch_ivr_play_file(session, NULL, file, args); - if (args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { + if (args) { + state.original_args = args; + myargs.dmachine = args->dmachine; + } + + myargs.input_callback = play_and_detect_input_callback; + myargs.buf = &state; + myargs.buflen = sizeof(state); + + status = switch_ivr_play_file(session, NULL, file, &myargs); + + if (args && args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { state.done |= PLAY_AND_DETECT_DONE; goto done; } @@ -4812,9 +4831,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se switch_ivr_detect_speech_start_input_timers(session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "(%s) WAITING FOR RESULT\n", switch_channel_get_name(channel)); while (!state.done && switch_channel_ready(channel)) { - status = switch_ivr_sleep(session, input_timeout, SWITCH_FALSE, args); + status = switch_ivr_sleep(session, input_timeout, SWITCH_FALSE, &myargs); - if (args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { + if (args && args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { state.done |= PLAY_AND_DETECT_DONE; goto done; } @@ -4826,8 +4845,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se } } - - done: if (recognizing && !(state.done & PLAY_AND_DETECT_DONE_RECOGNIZING)) { switch_ivr_pause_detect_speech(session); diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 091c76f982..b27a56bda4 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -3192,8 +3192,16 @@ typedef struct { char terminator; switch_time_t last_digit_time; switch_bool_t is_speech; + switch_input_args_t *original_args; } switch_collect_input_state_t; +static void deliver_asr_event(switch_core_session_t *session, switch_event_t *event, switch_input_args_t *args) +{ + if (args && args->input_callback) { + args->input_callback(session, (void *)event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); + } +} + static switch_status_t switch_collect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *data, unsigned int len) { switch_collect_input_state_t *state = (switch_collect_input_state_t *)data; @@ -3209,13 +3217,15 @@ static switch_status_t switch_collect_input_callback(switch_core_session_t *sess if (zstr(speech_type)) return SWITCH_STATUS_SUCCESS; + deliver_asr_event(session, event, state->original_args); + if (!strcasecmp(speech_type, "detected-speech")) { const char *result = switch_event_get_body(event); /* stop waiting for speech */ switch_set_flag(state, SWITCH_COLLECT_INPUT_SPEECH_DONE); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "(%s) DETECTED SPEECH\n", switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "(%s) DETECTED SPEECH %s\n", switch_channel_get_name(channel), speech_type); if (!zstr(result)) { state->recognition_result = cJSON_Parse(result); @@ -3230,15 +3240,12 @@ static switch_status_t switch_collect_input_callback(switch_core_session_t *sess } } return SWITCH_STATUS_BREAK; - } - - if (!strcasecmp("closed", speech_type)) { + } else if (!strcasecmp(speech_type, "detected-partial-speech")) { + } else if (!strcasecmp("closed", speech_type)) { /* stop waiting for speech */ switch_set_flag(state, SWITCH_COLLECT_INPUT_SPEECH_DONE); return SWITCH_STATUS_BREAK; - } - - if (!strcasecmp(speech_type, "begin-speaking")) { + } else if (!strcasecmp(speech_type, "begin-speaking")) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "(%s) START OF SPEECH\n", switch_channel_get_name(channel)); state->is_speech = SWITCH_TRUE; @@ -3246,6 +3253,8 @@ static switch_status_t switch_collect_input_callback(switch_core_session_t *sess /* barge in on prompt */ return SWITCH_STATUS_BREAK; } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Unhandled Speech-Type %s\n", speech_type); } } @@ -3360,10 +3369,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_se } } - if (!args) { - args = &myargs; - } - /* start speech recognition, if enabled */ if (recognizer_grammar && recognizer_mod_name) { if ((status = switch_ivr_detect_speech(session, recognizer_mod_name, recognizer_grammar, "", NULL, NULL)) != SWITCH_STATUS_SUCCESS) { @@ -3380,14 +3385,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_se } /* play the prompt, looking for input result */ - args->input_callback = switch_collect_input_callback; - args->buf = &state; - args->buflen = sizeof(state); + + if (args) { + state.original_args = args; + myargs.dmachine = args->dmachine; + } + + myargs.input_callback = switch_collect_input_callback; + myargs.buf = &state; + myargs.buflen = sizeof(state); + + switch_set_flag(&state, SWITCH_COLLECT_INPUT_PROMPT); - status = switch_ivr_play_file(session, NULL, prompt, args); + status = switch_ivr_play_file(session, NULL, prompt, &myargs); switch_clear_flag(&state, SWITCH_COLLECT_INPUT_PROMPT); - if (args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { + if (args && args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { switch_set_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE); switch_set_flag(&state, SWITCH_COLLECT_INPUT_SPEECH_DONE); status = SWITCH_STATUS_SUCCESS; @@ -3412,9 +3425,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_se while ((!switch_test_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE) || !switch_test_flag(&state, SWITCH_COLLECT_INPUT_SPEECH_DONE)) && switch_channel_ready(channel)) { - status = switch_ivr_sleep(session, sleep_time, SWITCH_FALSE, args); + status = switch_ivr_sleep(session, sleep_time, SWITCH_FALSE, &myargs); - if (args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { + if (args && args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { // dmachine done switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) DMACHINE DONE\n", switch_channel_get_name(channel)); switch_set_flag(&state, SWITCH_COLLECT_INPUT_DIGITS_DONE); diff --git a/tests/unit/switch_ivr_play_say.c b/tests/unit/switch_ivr_play_say.c index 6dd1c524f5..1d0bab84f1 100644 --- a/tests/unit/switch_ivr_play_say.c +++ b/tests/unit/switch_ivr_play_say.c @@ -33,6 +33,34 @@ #include <test/switch_test.h> +static switch_status_t partial_play_and_collect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *data, __attribute__((unused))unsigned int len) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + int *count = (int *)data; + + if (input_type == SWITCH_INPUT_TYPE_EVENT) { + switch_event_t *event = (switch_event_t *)input; + + if (event->event_id == SWITCH_EVENT_DETECTED_SPEECH) { + const char *speech_type = switch_event_get_header(event, "Speech-Type"); + + if (zstr(speech_type) || strcmp(speech_type, "detected-partial-speech")) { + return status; + } + + (*count)++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "partial events count: %d\n", *count); + + char *body = switch_event_get_body(event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "body=[%s]\n", body); + } + } else if (input_type == SWITCH_INPUT_TYPE_DTMF) { + // never mind + } + + return status; +} + FST_CORE_BEGIN("./conf_playsay") { FST_SUITE_BEGIN(switch_ivr_play_say) @@ -77,15 +105,16 @@ FST_CORE_BEGIN("./conf_playsay") fst_sched_recv_dtmf("+2", "2"); fst_sched_recv_dtmf("+3", "3"); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_check(recognition_result == NULL); fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? fst_check_string_equals(cJSON_GetObjectCstr(recognition_result, "text"), NULL); fst_check_string_equals(digits_collected, "123"); fst_check(terminator_collected == 0); + cJSON_Delete(recognition_result); } FST_SESSION_END() - FST_SESSION_BEGIN(play_and_collect_input) + FST_SESSION_BEGIN(play_and_collect_input_success) { char terminator_collected = 0; char *digits_collected = NULL; @@ -113,7 +142,7 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; fst_time_mark(); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_check(recognition_result == NULL); // check results fst_check_duration(2500, 1000); // should return immediately when term digit is received fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? @@ -145,7 +174,7 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; fst_time_mark(); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_check(recognition_result == NULL); // check results fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? fst_check_duration(7000, 1000); // should return after timeout when prompt finishes playing @@ -161,7 +190,7 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; fst_time_mark(); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_check(recognition_result == NULL); // check results fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? fst_check_duration(2500, 1000); // should return after timeout when prompt finishes playing @@ -182,7 +211,7 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; fst_time_mark(); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_check(recognition_result == NULL); // check results fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? fst_check_duration(10000, 1000); // should return when dtmf terminator is pressed @@ -201,7 +230,7 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; fst_time_mark(); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_requires(recognition_result); // check results fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? fst_check_duration(2500, 1000); // returns when utterance is done @@ -218,7 +247,7 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; fst_time_mark(); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_check(recognition_result == NULL); // check results fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? fst_check_duration(2500, 1000); // returns when single digit is pressed @@ -236,7 +265,7 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; fst_time_mark(); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_check(recognition_result == NULL); // check results fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? fst_check_duration(2000, 1000); // returns when single digit is pressed @@ -254,7 +283,7 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; fst_time_mark(); status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); - + fst_requires(recognition_result); // check results fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? fst_check_duration(7000, 1000); // inter-digit timeout after 2nd digit pressed @@ -265,6 +294,72 @@ FST_CORE_BEGIN("./conf_playsay") recognition_result = NULL; } FST_SESSION_END() + + FST_SESSION_BEGIN(play_and_collect_input_partial) + { + char terminator_collected = 0; + char *digits_collected = NULL; + cJSON *recognition_result = NULL; + + // args + const char *play_files = "silence_stream://1000"; + const char *speech_engine = "test"; + const char *terminators = "#"; + int min_digits = 1; + int max_digits = 99; + int digit_timeout = 500; + int no_input_timeout = digit_timeout; + int speech_complete_timeout = digit_timeout; + int speech_recognition_timeout = 60000; + char *speech_grammar_args = switch_core_session_sprintf(fst_session, "{start-input-timers=false,no-input-timeout=%d,vad-silence-ms=%d,speech-timeout=%d,language=en-US,partial=true}default", + no_input_timeout, speech_complete_timeout, speech_recognition_timeout); + switch_status_t status; + + switch_ivr_displace_session(fst_session, "file_string://silence_stream://500,0!tone_stream://%%(2000,0,350,440)", 0, "r"); + terminator_collected = 0; + digits_collected = NULL; + if (recognition_result) cJSON_Delete(recognition_result); + recognition_result = NULL; + fst_time_mark(); + status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, NULL); + fst_requires(recognition_result); + // check results + fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? + fst_check_duration(2500, 1000); // returns when utterance is done + fst_check_string_equals(cJSON_GetObjectCstr(recognition_result, "text"), "agent"); + fst_check_string_equals(digits_collected, NULL); + fst_check(terminator_collected == 0); + + + switch_ivr_displace_session(fst_session, "file_string://silence_stream://500,0!tone_stream://%%(2000,0,350,440)", 0, "r"); + terminator_collected = 0; + digits_collected = NULL; + if (recognition_result) cJSON_Delete(recognition_result); + recognition_result = NULL; + + switch_input_args_t collect_input_args = { 0 }; + switch_input_args_t *args = NULL; + int count = 0; + + args = &collect_input_args; + args->input_callback = partial_play_and_collect_input_callback; + args->buf = &count; + args->buflen = sizeof(int); + + fst_time_mark(); + status = switch_ivr_play_and_collect_input(fst_session, play_files, speech_engine, speech_grammar_args, min_digits, max_digits, terminators, digit_timeout, &recognition_result, &digits_collected, &terminator_collected, args); + fst_requires(recognition_result); + // check results + fst_check(status == SWITCH_STATUS_SUCCESS); // might be break? + fst_check_duration(2500, 1000); // returns when utterance is done + fst_check_string_equals(cJSON_GetObjectCstr(recognition_result, "text"), "agent"); + fst_check_string_equals(digits_collected, NULL); + fst_check(terminator_collected == 0); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "xxx count = %d\n", count); + fst_check(count == 3); // 3 partial results + cJSON_Delete(recognition_result); + } + FST_SESSION_END() } FST_SUITE_END() } From e51bbea7cab3781ca62083a1fc29465c15840ea4 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 15 Oct 2019 20:55:34 +0400 Subject: [PATCH 233/655] [mod_dptools]: wait_for_silence does not allow the listen_hits parameter to be a value of 0 --- src/mod/applications/mod_dptools/mod_dptools.c | 2 +- src/switch_ivr_play_say.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f35c3cb8f8..b365fc685b 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -4591,7 +4591,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function) timeout_ms = switch_atoui(argv[3]); } - if (thresh > 0 && silence_hits > 0 && listen_hits > 0) { + if (thresh > 0 && silence_hits > 0 && listen_hits >= 0) { switch_ivr_wait_for_silence(session, thresh, silence_hits, listen_hits, timeout_ms, argv[4]); return; } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index b27a56bda4..a03ab9ab5f 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -2063,6 +2063,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_ while (switch_channel_ready(channel)) { + /* reinitialize energy value per loop */ + energy = 0; + status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { @@ -2102,6 +2105,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_ if (countdown) { if (!--countdown) { switch_channel_set_variable(channel, "wait_for_silence_timeout", "false"); + switch_channel_set_variable_printf(channel, "wait_for_silence_listenhits", "%d", listening); + switch_channel_set_variable_printf(channel, "wait_for_silence_silence_hits", "%d", silence_hits); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "switch_ivr_wait_for_silence: SILENCE DETECTED\n"); break; } else { @@ -2111,9 +2116,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_ data = (int16_t *) read_frame->data; - for (energy = 0, j = 0, count = 0; count < read_frame->samples; count++) { - energy += abs(data[j++]); - j += channels; + /* Need to check if the read_frame is valid before attempting to get "energy" value from it */ + if (read_frame->seq) { + for (energy = 0, j = 0, count = 0; count < read_frame->samples; count++) { + energy += abs(data[j++]); + j += channels; + } } score = (uint32_t) (energy / (read_frame->samples / divisor)); @@ -2122,7 +2130,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_ listening++; } - if (listening > listen_hits && score < thresh) { + if (((listen_hits == 0) || (listening > listen_hits)) && (score < thresh)) { if (!--silence_hits) { countdown = 25; } From 829676e4d3f44b181f8688ac6753ba80eb095a2d Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Tue, 22 Oct 2019 09:32:18 -0600 Subject: [PATCH 234/655] FS-11856: [Core] Offer all negotiated codecs in 200 OK when receiving re-INVITE without SDP --- src/switch_core_media.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index a32781ad99..065ad0566f 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -10573,7 +10573,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=msid-semantic: WMS %s\r\n", smh->msid); } - if (a_engine->codec_negotiated) { + if (a_engine->codec_negotiated && !switch_channel_test_flag(session->channel, CF_NOSDP_REINVITE)) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=audio %d %s", port, get_media_profile_name(session, !a_engine->no_crypto && (switch_channel_test_flag(session->channel, CF_DTLS) || a_engine->crypto_type != CRYPTO_INVALID))); @@ -10582,10 +10582,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", a_engine->cur_payload_map->pt); - if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO) || switch_channel_test_flag(session->channel, CF_NOSDP_REINVITE)) { + if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO)) { switch_mutex_lock(smh->sdp_mutex); for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) { - if (pmap->pt != a_engine->cur_payload_map->pt && pmap->pt != smh->mparams->te) { + if (pmap->pt != a_engine->cur_payload_map->pt) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", pmap->pt); } } @@ -10621,10 +10621,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\r\n", a_engine->cur_payload_map->pt, fmtp_out); } - if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO) || switch_channel_test_flag(session->channel, CF_NOSDP_REINVITE)) { + if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO)) { switch_mutex_lock(smh->sdp_mutex); for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) { - if (pmap->pt != a_engine->cur_payload_map->pt && pmap->pt != smh->mparams->te) { + if (pmap->pt != a_engine->cur_payload_map->pt) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%ld\r\n", pmap->pt, pmap->iananame, pmap->rate); From 205bf55c8f63c0117c819b010bd9426e775bc44c Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 22 Oct 2019 16:41:45 -0400 Subject: [PATCH 235/655] [mod_spandsp] Use single log for fax negotiation and page reports. --- .../mod_spandsp/mod_spandsp_fax.c | 167 +++++++++++------- 1 file changed, 108 insertions(+), 59 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 62b7ce99a1..3ec1e022e4 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -307,6 +307,7 @@ static int phase_b_handler(void *user_data, int result) char *fax_document_total_pages = NULL; pvt_t *pvt; switch_event_t *event; + const char *total_pages_str = ""; pvt = (pvt_t *) user_data; switch_assert(pvt); @@ -343,20 +344,30 @@ static int phase_b_handler(void *user_data, int result) switch_channel_set_variable(channel, "fax_remote_model", switch_str_nil(t30_get_rx_model(pvt->t30))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "=== Negotiation Result =======================================================\n"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote station id: %s\n", far_ident); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local station id: %s\n", local_ident); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Transfer Rate: %i\n", t30_stats.bit_rate); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ECM status %s\n", (t30_stats.error_correcting_mode) ? "on" : "off"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38 status %s\n", get_t38_status(pvt->t38_mode)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote country: %s\n", switch_str_nil(t30_get_rx_country(pvt->t30))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor: %s\n", switch_str_nil(t30_get_rx_vendor(pvt->t30))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model: %s\n", switch_str_nil(t30_get_rx_model(pvt->t30))); if (pvt->app_mode == FUNCTION_TX) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Total fax pages: %s\n", fax_document_total_pages); + total_pages_str = switch_core_session_sprintf(session, "Total fax pages: %s\n", fax_document_total_pages); } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, + "=== Negotiation Result =======================================================\n" + "Remote station id: %s\n" + "Local station id: %s\n" + "Transfer Rate: %i\n" + "ECM status %s\n" + "T38 status %s\n" + "remote country: %s\n" + "remote vendor: %s\n" + "remote model: %s\n" + "%s" + "==============================================================================\n", + far_ident, + local_ident, + t30_stats.bit_rate, + (t30_stats.error_correcting_mode) ? "on" : "off", + get_t38_status(pvt->t38_mode), + switch_str_nil(t30_get_rx_country(pvt->t30)), + switch_str_nil(t30_get_rx_vendor(pvt->t30)), + switch_str_nil(t30_get_rx_model(pvt->t30)), + total_pages_str); switch_channel_execute_on(channel, "execute_on_fax_phase_b"); @@ -396,6 +407,7 @@ static int phase_d_handler(void *user_data, int msg) char *fax_longest_bad_row_run = NULL; char *fax_document_transferred_pages = NULL; char *fax_document_total_pages = NULL; + const char *total_pages_str = ""; switch_core_session_t *session; switch_channel_t *channel; pvt_t *pvt; @@ -468,19 +480,31 @@ static int phase_d_handler(void *user_data, int msg) } } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==== Page %s===========================================================\n", pvt->app_mode == FUNCTION_TX ? "Sent ====": "Received "); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Page no = %d\n", (pvt->app_mode == FUNCTION_TX) ? t30_stats.pages_tx : t30_stats.pages_rx); if (pvt->app_mode == FUNCTION_TX) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Total fax pages: %s\n", fax_document_total_pages); + total_pages_str = switch_core_session_sprintf(session, "Total fax pages: %s\n", fax_document_total_pages); } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image type = %s (%s in the file)\n", t4_image_type_to_str(t30_stats.type), t4_image_type_to_str(t30_stats.image_type)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image size = %d x %d pixels (%d x %d pixels in the file)\n", t30_stats.width, t30_stats.length, t30_stats.image_width, t30_stats.image_length); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image resolution = %d/m x %d/m (%d/m x %d/m in the file)\n", t30_stats.x_resolution, t30_stats.y_resolution, t30_stats.image_x_resolution, t30_stats.image_y_resolution); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Compression = %s (%d)\n", t4_compression_to_str(t30_stats.compression), t30_stats.compression); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Compressed image size = %d bytes\n", t30_stats.image_size); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Bad rows = %d\n", t30_stats.bad_rows); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Longest bad row run = %d\n", t30_stats.longest_bad_row_run); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, + "==== Page %s===========================================================\n" + "Page no = %d\n" + "%s" + "Image type = %s (%s in the file)\n" + "Image size = %d x %d pixels (%d x %d pixels in the file)\n" + "Image resolution = %d/m x %d/m (%d/m x %d/m in the file)\n" + "Compression = %s (%d)\n" + "Compressed image size = %d bytes\n" + "Bad rows = %d\n" + "Longest bad row run = %d\n" + "==============================================================================\n", + pvt->app_mode == FUNCTION_TX ? "Sent ====": "Received ", + (pvt->app_mode == FUNCTION_TX) ? t30_stats.pages_tx : t30_stats.pages_rx, + total_pages_str, + t4_image_type_to_str(t30_stats.type), t4_image_type_to_str(t30_stats.image_type), + t30_stats.width, t30_stats.length, t30_stats.image_width, t30_stats.image_length, + t30_stats.x_resolution, t30_stats.y_resolution, t30_stats.image_x_resolution, t30_stats.image_y_resolution, + t4_compression_to_str(t30_stats.compression), t30_stats.compression, + t30_stats.image_size, + t30_stats.bad_rows, + t30_stats.longest_bad_row_run); switch_channel_execute_on(channel, "execute_on_fax_phase_d"); @@ -528,6 +552,7 @@ static void phase_e_handler(void *user_data, int result) switch_event_t *event; const char *var; char *expanded; + const char *fax_result_str = ""; pvt = (pvt_t *) user_data; switch_assert(pvt); @@ -542,38 +567,49 @@ static void phase_e_handler(void *user_data, int result) local_ident = switch_str_nil(t30_get_tx_ident(pvt->t30)); far_ident = switch_str_nil(t30_get_rx_ident(pvt->t30)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n"); if (result == T30_ERR_OK) { if (pvt->app_mode == FUNCTION_TX) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax successfully sent.\n"); + fax_result_str = switch_core_session_sprintf(session, "Fax successfully sent.\n"); } else if (pvt->app_mode == FUNCTION_RX) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax successfully received.\n"); + fax_result_str = switch_core_session_sprintf(session, "Fax successfully received.\n"); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax successfully managed. How ?\n"); + fax_result_str = switch_core_session_sprintf(session, "Fax successfully managed. How ?\n"); } switch_channel_set_variable(channel, "fax_success", "1"); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax processing not successful - result (%d) %s.\n", result, + fax_result_str = switch_core_session_sprintf(session, "Fax processing not successful - result (%d) %s.\n", result, t30_completion_code_to_str(result)); switch_channel_set_variable(channel, "fax_success", "0"); } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote station id: %s\n", far_ident); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local station id: %s\n", local_ident); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Pages transferred: %i\n", - pvt->app_mode == FUNCTION_TX ? t.pages_tx : t.pages_rx); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Total fax pages: %i\n", t.pages_in_file); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image resolution: %ix%i\n", t.x_resolution, t.y_resolution); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Transfer Rate: %i\n", t.bit_rate); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ECM status %s\n", (t.error_correcting_mode) ? "on" : "off"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38 status %s\n", get_t38_status(pvt->t38_mode)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote country: %s\n", switch_str_nil(t30_get_rx_country(pvt->t30))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor: %s\n", switch_str_nil(t30_get_rx_vendor(pvt->t30))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model: %s\n", switch_str_nil(t30_get_rx_model(pvt->t30))); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, + "==============================================================================\n" + "%s" + "Remote station id: %s\n" + "Local station id: %s\n" + "Pages transferred: %i\n" + "Total fax pages: %i\n" + "Image resolution: %ix%i\n" + "Transfer Rate: %i\n" + "ECM status %s\n" + "T38 status %s\n" + "remote country: %s\n" + "remote vendor: %s\n" + "remote model: %s\n" + "==============================================================================\n", + fax_result_str, + far_ident, + local_ident, + pvt->app_mode == FUNCTION_TX ? t.pages_tx : t.pages_rx, + t.pages_in_file, + t.x_resolution, t.y_resolution, + t.bit_rate, + (t.error_correcting_mode) ? "on" : "off", + get_t38_status(pvt->t38_mode), + switch_str_nil(t30_get_rx_country(pvt->t30)), + switch_str_nil(t30_get_rx_vendor(pvt->t30)), + switch_str_nil(t30_get_rx_model(pvt->t30))); /* Set our channel variables, variables are also used in event @@ -1092,20 +1128,33 @@ static t38_mode_t negotiate_t38(pvt_t *pvt) pvt->t38_mode = T38_MODE_NEGOTIATED; switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38 SDP Origin = %s\n", t38_options->sdp_o_line); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxVersion = %d\n", t38_options->T38FaxVersion); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38MaxBitRate = %d\n", t38_options->T38MaxBitRate); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxFillBitRemoval = %d\n", t38_options->T38FaxFillBitRemoval); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxTranscodingMMR = %d\n", t38_options->T38FaxTranscodingMMR); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxTranscodingJBIG = %d\n", t38_options->T38FaxTranscodingJBIG); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxRateManagement = '%s'\n", t38_options->T38FaxRateManagement); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxBuffer = %d\n", t38_options->T38FaxMaxBuffer); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxDatagram = %d\n", t38_options->T38FaxMaxDatagram); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxUdpEC = '%s'\n", t38_options->T38FaxUdpEC); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38VendorInfo = '%s'\n", switch_str_nil(t38_options->T38VendorInfo)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ip = '%s'\n", - t38_options->remote_ip ? t38_options->remote_ip : "Not specified"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "port = %d\n", t38_options->remote_port); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, + "T38 SDP Origin = %s\n" + "T38FaxVersion = %d\n" + "T38MaxBitRate = %d\n" + "T38FaxFillBitRemoval = %d\n" + "T38FaxTranscodingMMR = %d\n" + "T38FaxTranscodingJBIG = %d\n" + "T38FaxRateManagement = '%s'\n" + "T38FaxMaxBuffer = %d\n" + "T38FaxMaxDatagram = %d\n" + "T38FaxUdpEC = '%s'\n" + "T38VendorInfo = '%s'\n" + "ip = '%s'\n" + "port = %d\n", + t38_options->sdp_o_line, + t38_options->T38FaxVersion, + t38_options->T38MaxBitRate, + t38_options->T38FaxFillBitRemoval, + t38_options->T38FaxTranscodingMMR, + t38_options->T38FaxTranscodingJBIG, + t38_options->T38FaxRateManagement, + t38_options->T38FaxMaxBuffer, + t38_options->T38FaxMaxDatagram, + t38_options->T38FaxUdpEC, + switch_str_nil(t38_options->T38VendorInfo), + t38_options->remote_ip ? t38_options->remote_ip : "Not specified", + t38_options->remote_port); /* Time to practice our negotiating skills, by editing the t38_options */ @@ -2141,7 +2190,7 @@ switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, switch_channel_set_variable(peer ? channel : other_channel, "t38_gateway_format", "audio"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s starting gateway mode to %s\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s starting gateway mode to %s\n", switch_channel_get_name(peer ? channel : other_channel), switch_channel_get_name(peer ? other_channel : channel)); @@ -2274,7 +2323,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da if (cont->hits) { switch_event_t *event; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_INFO, "Fax Tone Detected. [%s][%s]\n", cont->app, switch_str_nil(cont->data)); if (cont->callback) { From 260d1a40e382da5458043e8883eeaa93b5c1dcde Mon Sep 17 00:00:00 2001 From: Seven Du <seven@signalwire.com> Date: Fri, 6 Dec 2019 16:40:29 +0800 Subject: [PATCH 236/655] [mod_sofia] add contact header in REFER --- 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 4b6c463261..9ec1083cd3 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1548,6 +1548,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi nua_refer(tech_pvt->nh, SIPTAG_REFER_TO_STR(ref_to), SIPTAG_REFERRED_BY_STR(tech_pvt->contact_url), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(!zstr(session_id_header), SIPTAG_HEADER_STR(session_id_header)), + SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END()); if (msg->string_array_arg[0]) { From 0283c9e2e7955ef9b66fb269396692a160fda347 Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Thu, 12 Dec 2019 12:35:14 -0700 Subject: [PATCH 237/655] [mod_sofia] add 'sip_destination_prefix' var to prefix user portion of request uri with a value (note this will not affect calls to registered endpoints) --- src/mod/endpoints/mod_sofia/mod_sofia.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 9ec1083cd3..e3bfa3870b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4909,6 +4909,8 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } } else { + const char *sip_destination_prefix = switch_str_nil(switch_channel_get_variable(o_channel, "sip_destination_prefix")); + if (!(dest = strchr(profile_name, '/'))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid URL\n"); cause = SWITCH_CAUSE_INVALID_URL; @@ -4932,13 +4934,12 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session profile_name = profile->domain_name; } - if (!strncasecmp(dest, "sip:", 4) || !strncasecmp(dest, "sips:", 5)) { - char *c; - tech_pvt->dest = switch_core_session_strdup(nsession, dest); - if ((c = strchr(tech_pvt->dest, ':'))) { - c++; - tech_pvt->e_dest = switch_core_session_strdup(nsession, c); - } + if (!strncasecmp(dest, "sip:", 4)) { + tech_pvt->e_dest = switch_core_session_strdup(nsession, dest + 4); + tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s%s", sip_destination_prefix, tech_pvt->e_dest); + } else if (!strncasecmp(dest, "sips:", 5)) { + tech_pvt->e_dest = switch_core_session_strdup(nsession, dest + 5); + tech_pvt->dest = switch_core_session_sprintf(nsession, "sips:%s%s", sip_destination_prefix, tech_pvt->e_dest); } else if (!mod && !strchr(dest, '@') && (host = strchr(dest, '%'))) { char buf[1024]; *host = '@'; @@ -4984,9 +4985,8 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } } - tech_pvt->dest = switch_core_session_alloc(nsession, strlen(dest) + 5); + tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s%s", sip_destination_prefix, dest); tech_pvt->e_dest = switch_core_session_strdup(nsession, dest); - switch_snprintf(tech_pvt->dest, strlen(dest) + 5, "sip:%s", dest); } } From 9163b7569a9a032d5725b9b421ec85222d285e3f Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@jerris.com> Date: Thu, 12 Dec 2019 18:12:45 -0700 Subject: [PATCH 238/655] [mod_sofia] add 'sip_destination_prefix' var to prefix user portion of request uri with a value (note this will not affect calls to registered endpoints) (#70) --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index e3bfa3870b..835717e7e9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4909,7 +4909,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } } else { - const char *sip_destination_prefix = switch_str_nil(switch_channel_get_variable(o_channel, "sip_destination_prefix")); + const char *sip_destination_prefix = switch_str_nil(switch_event_get_header(var_event, "sip_destination_prefix")); if (!(dest = strchr(profile_name, '/'))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid URL\n"); From dfb6e3a3efb0c024e5ae6123b96705db8697d76a Mon Sep 17 00:00:00 2001 From: Nick Lemberger <nick.lemberger@cerner.com> Date: Wed, 15 Jul 2020 11:47:27 -0500 Subject: [PATCH 239/655] [mod_event_multicast] Normalize whitespace/tabs --- .../mod_event_multicast/mod_event_multicast.c | 118 +++++++++--------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index f9fa8ff02b..49a651a2fc 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -178,10 +178,10 @@ static void event_handler(switch_event_t *event) } if (event->subclass_name && (!strcmp(event->subclass_name, MULTICAST_EVENT) || - !strcmp(event->subclass_name, MULTICAST_PEERUP) || !strcmp(event->subclass_name, MULTICAST_PEERDOWN))) { + !strcmp(event->subclass_name, MULTICAST_PEERUP) || !strcmp(event->subclass_name, MULTICAST_PEERDOWN))) { char *event_name, *sender; if ((event_name = switch_event_get_header(event, "orig-event-name")) && - !strcasecmp(event_name, "HEARTBEAT") && (sender = switch_event_get_header(event, "orig-multicast-sender"))) { + !strcasecmp(event_name, "HEARTBEAT") && (sender = switch_event_get_header(event, "orig-multicast-sender"))) { struct peer_status *p; time_t now = switch_epoch_time_now(NULL); @@ -282,78 +282,78 @@ static void event_handler(switch_event_t *event) char *packet; switch (event->event_id) { - case SWITCH_EVENT_LOG: - return; - default: - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Multicast-Sender", switch_core_get_switchname()); - if (switch_event_serialize(event, &packet, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { - size_t len; - char *buf; + case SWITCH_EVENT_LOG: + return; + default: + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Multicast-Sender", switch_core_get_switchname()); + if (switch_event_serialize(event, &packet, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + size_t len; + char *buf; #ifdef HAVE_OPENSSL - int outlen, tmplen; + int outlen, tmplen; #if OPENSSL_VERSION_NUMBER >= 0x10100000 - EVP_CIPHER_CTX *ctx; + EVP_CIPHER_CTX *ctx; #else - EVP_CIPHER_CTX ctx; + EVP_CIPHER_CTX ctx; #endif - char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; - switch_uuid_t uuid; + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; + switch_uuid_t uuid; - switch_uuid_get(&uuid); - switch_uuid_format(uuid_str, &uuid); - len = strlen(packet) + SWITCH_UUID_FORMATTED_LENGTH + EVP_MAX_IV_LENGTH + strlen((char *) MAGIC); + switch_uuid_get(&uuid); + switch_uuid_format(uuid_str, &uuid); + len = strlen(packet) + SWITCH_UUID_FORMATTED_LENGTH + EVP_MAX_IV_LENGTH + strlen((char *) MAGIC); #else - len = strlen(packet) + strlen((char *) MAGIC); + len = strlen(packet) + strlen((char *) MAGIC); #endif - buf = malloc(len + 1); - memset(buf, 0, len + 1); - switch_assert(buf); + buf = malloc(len + 1); + memset(buf, 0, len + 1); + switch_assert(buf); #ifdef HAVE_OPENSSL - if (globals.psk) { - switch_copy_string(buf, uuid_str, SWITCH_UUID_FORMATTED_LENGTH); + if (globals.psk) { + switch_copy_string(buf, uuid_str, SWITCH_UUID_FORMATTED_LENGTH); #if OPENSSL_VERSION_NUMBER >= 0x10100000 - ctx = EVP_CIPHER_CTX_new(); - EVP_EncryptInit(ctx, EVP_bf_cbc(), NULL, NULL); - EVP_CIPHER_CTX_set_key_length(ctx, strlen(globals.psk)); - EVP_EncryptInit(ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); - EVP_EncryptUpdate(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH, - &outlen, (unsigned char *) packet, (int) strlen(packet)); - EVP_EncryptUpdate(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, - &tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC)); - outlen += tmplen; - EVP_EncryptFinal(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen); - EVP_CIPHER_CTX_free(ctx); + ctx = EVP_CIPHER_CTX_new(); + EVP_EncryptInit(ctx, EVP_bf_cbc(), NULL, NULL); + EVP_CIPHER_CTX_set_key_length(ctx, strlen(globals.psk)); + EVP_EncryptInit(ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); + EVP_EncryptUpdate(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH, + &outlen, (unsigned char *) packet, (int) strlen(packet)); + EVP_EncryptUpdate(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, + &tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC)); + outlen += tmplen; + EVP_EncryptFinal(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen); + EVP_CIPHER_CTX_free(ctx); #else - EVP_CIPHER_CTX_init(&ctx); - EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL); - EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk)); - EVP_EncryptInit(&ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); - EVP_EncryptUpdate(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH, - &outlen, (unsigned char *) packet, (int) strlen(packet)); - EVP_EncryptUpdate(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, - &tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC)); - outlen += tmplen; - EVP_EncryptFinal(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen); - EVP_CIPHER_CTX_cleanup(&ctx); + EVP_CIPHER_CTX_init(&ctx); + EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL); + EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk)); + EVP_EncryptInit(&ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); + EVP_EncryptUpdate(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH, + &outlen, (unsigned char *) packet, (int) strlen(packet)); + EVP_EncryptUpdate(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, + &tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC)); + outlen += tmplen; + EVP_EncryptFinal(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen); + EVP_CIPHER_CTX_cleanup(&ctx); #endif - outlen += tmplen; - len = (size_t) outlen + SWITCH_UUID_FORMATTED_LENGTH; - *(buf + SWITCH_UUID_FORMATTED_LENGTH + outlen) = '\0'; - } else { + outlen += tmplen; + len = (size_t) outlen + SWITCH_UUID_FORMATTED_LENGTH; + *(buf + SWITCH_UUID_FORMATTED_LENGTH + outlen) = '\0'; + } else { #endif - switch_copy_string(buf, packet, len); - switch_copy_string(buf + strlen(packet), (char *) MAGIC, strlen((char *) MAGIC) + 1); + switch_copy_string(buf, packet, len); + switch_copy_string(buf + strlen(packet), (char *) MAGIC, strlen((char *) MAGIC) + 1); #ifdef HAVE_OPENSSL + } +#endif + + switch_socket_sendto(globals.udp_socket, globals.addr, 0, buf, &len); + switch_safe_free(packet); + switch_safe_free(buf); } -#endif - - switch_socket_sendto(globals.udp_socket, globals.addr, 0, buf, &len); - switch_safe_free(packet); - switch_safe_free(buf); - } - break; + break; } } return; @@ -473,7 +473,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load) return SWITCH_STATUS_SUCCESS; - fail: +fail: if (globals.udp_socket) { switch_socket_close(globals.udp_socket); From 9f0656a6babbe601338b33a6767dbc56e4aca3da Mon Sep 17 00:00:00 2001 From: cerner-cac-solution-partner <59845643+cerner-cac-solution-partner@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:24:53 -0600 Subject: [PATCH 240/655] [mod_event_multicast] Add unicast and IPv6 support, enhanced reloadxml support. --- .../mod_event_multicast/mod_event_multicast.c | 747 +++++++++++++----- 1 file changed, 543 insertions(+), 204 deletions(-) diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 49a651a2fc..206824baf3 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -24,6 +24,7 @@ * Contributor(s): * * Anthony Minessale II <anthm@freeswitch.org> + * Nick Lemberger <nlemberger@gmail.com> * * * mod_event_multicast.c -- Multicast Events @@ -35,6 +36,7 @@ #endif #define MULTICAST_BUFFSIZE 65536 +#define MAX_DST_HOSTS 16 /* magic byte sequence */ static unsigned char MAGIC[] = { 226, 132, 177, 197, 152, 198, 142, 211, 172, 197, 158, 208, 169, 208, 135, 197, 166, 207, 154, 196, 166 }; @@ -46,22 +48,50 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime); SWITCH_MODULE_DEFINITION(mod_event_multicast, mod_event_multicast_load, mod_event_multicast_shutdown, mod_event_multicast_runtime); static switch_memory_pool_t *module_pool = NULL; +static char *addr_type_names[] = { "IPv4 unicast", "IPv4 multicast", "IPv6 unicast", "IPv6 multicast", "Unknown" }; + +typedef enum { + IPV4_UNICAST, + IPV4_MULTICAST, + IPV6_UNICAST, + IPV6_MULTICAST, + IP_UNKOWN_TYPE +} addr_type_t; + +typedef struct { + char *ipaddr; + switch_sockaddr_t *sockaddr; + addr_type_t addrtype; +} dst_sockaddr_t; static struct { - char *address; + char *src_addr; + char *src_addr6; + char *dst_addrs; char *bindings; uint32_t key_count; switch_port_t port; - switch_sockaddr_t *addr; + int has_udp; + int has_udp6; + switch_sockaddr_t *src_sockaddr; + switch_sockaddr_t *src_sockaddr6; switch_socket_t *udp_socket; + switch_socket_t *udp_socket6; switch_hash_t *event_hash; uint8_t event_list[SWITCH_EVENT_ALL + 1]; int running; + int runtime_thread_has_to_finish; + int runtime_processing; + int num_dst_addrs; + dst_sockaddr_t dst_sockaddrs[MAX_DST_HOSTS]; uint8_t ttl; char *psk; switch_mutex_t *mutex; + switch_thread_rwlock_t *runtime_rwlock; switch_hash_t *peer_hash; - int loopback; + uint8_t loopback; + uint8_t loopback6; + char configuration_md5[SWITCH_MD5_DIGEST_STRING_SIZE]; } globals; struct peer_status { @@ -69,41 +99,70 @@ struct peer_status { time_t lastseen; }; -SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_address, globals.address); +SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_src_addr, globals.src_addr); +SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_src_addr6, globals.src_addr6); +SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dst_addrs, globals.dst_addrs); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings); #ifdef HAVE_OPENSSL SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_psk, globals.psk); #endif +#define CONF_FILE "event_multicast.conf" #define MULTICAST_EVENT "multicast::event" #define MULTICAST_PEERUP "multicast::peerup" #define MULTICAST_PEERDOWN "multicast::peerdown" -static switch_status_t load_config(void) + +static switch_xml_t open_config_file(const char *file_path, switch_xml_t *cfg, char *md5) { + char *configText; + switch_xml_t xml; + + if (!(xml = switch_xml_open_cfg(CONF_FILE, cfg, NULL))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", CONF_FILE); + } else if (*cfg) { + configText = switch_xml_toxml(*cfg, SWITCH_FALSE); + switch_md5_string(md5, configText, strlen(configText)); + switch_safe_free(configText); + } else { + switch_xml_free(xml); + xml = NULL; + } + + return xml; +} + +static switch_status_t load_config(switch_xml_t input_cfg) { switch_status_t status = SWITCH_STATUS_SUCCESS; - char *cf = "event_multicast.conf"; - switch_xml_t cfg, xml, settings, param; + switch_xml_t cfg, xml = NULL, settings, param; char *next, *cur; uint32_t count = 0; uint8_t custom = 0; - globals.ttl = 1; globals.key_count = 0; globals.loopback = 0; + globals.port = 0; + globals.num_dst_addrs = 0; - 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 (input_cfg) { + cfg = input_cfg; + } else { + if (!(xml = open_config_file(CONF_FILE, &cfg, globals.configuration_md5))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", CONF_FILE); + 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, "address")) { - set_global_address(val); + set_global_dst_addrs(switch_strip_whitespace(val)); + } else if (!strcasecmp(var, "source_address")) { + set_global_src_addr(switch_strip_whitespace(val)); + } else if (!strcasecmp(var, "source_address_ipv6")) { + set_global_src_addr6(switch_strip_whitespace(val)); } else if (!strcasecmp(var, "bindings")) { set_global_bindings(val); } else if (!strcasecmp(var, "port")) { @@ -124,7 +183,6 @@ static switch_status_t load_config(void) } else if (!strcasecmp(var, "loopback")) { globals.loopback = switch_true(val); } - } } @@ -161,12 +219,250 @@ static switch_status_t load_config(void) } } + if (zstr(globals.src_addr)) { + set_global_src_addr("0.0.0.0"); + } + + if (zstr(globals.src_addr6)) { + set_global_src_addr6("::"); + } + if (!globals.key_count) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "No Bindings\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "No Event Bindings\n"); } return status; +} +static void cleanup() +{ + /* Clean up sockets */ + if (globals.udp_socket) { + switch_socket_shutdown(globals.udp_socket, SWITCH_SHUTDOWN_READWRITE); + switch_socket_close(globals.udp_socket); + globals.udp_socket = NULL; + } + + if (globals.udp_socket6) { + switch_socket_shutdown(globals.udp_socket6, SWITCH_SHUTDOWN_READWRITE); + switch_socket_close(globals.udp_socket6); + globals.udp_socket6 = NULL; + } + + if (globals.event_hash) { + switch_core_hash_destroy(&globals.event_hash); + } + + if (globals.peer_hash) { + switch_core_hash_destroy(&globals.peer_hash); + } + + switch_safe_free(globals.src_addr); + switch_safe_free(globals.src_addr6); + switch_safe_free(globals.dst_addrs); + switch_safe_free(globals.bindings); + switch_safe_free(globals.psk); + + memset(globals.event_list, 0, SWITCH_EVENT_ALL + 1); +} + +static switch_status_t initialize_sockets(switch_xml_t input_cfg) +{ + switch_status_t status; + int i, dst_host_count = 0; + char *dst_hosts[MAX_DST_HOSTS] = { 0 }; + switch_sockaddr_t *local_ip_sockaddr; + switch_sockaddr_t *local_ip6_sockaddr; + + switch_core_hash_init(&globals.event_hash); + switch_core_hash_init(&globals.peer_hash); + + if (load_config(input_cfg) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Configure\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + /* to attempt to avoid unicasting to ourself we need to know our IP address */ + switch_sockaddr_info_get(&local_ip_sockaddr, switch_core_get_variable("local_ip_v4"), SWITCH_INET, globals.port, 0, module_pool); + switch_sockaddr_info_get(&local_ip6_sockaddr, switch_core_get_variable("local_ip_v6"), SWITCH_INET6, globals.port, 0, module_pool); + + /* set up the destination sockaddrs */ + dst_host_count = switch_separate_string(globals.dst_addrs, ',', dst_hosts, MAX_DST_HOSTS); + for (i = 0; i < dst_host_count; i++) { + char *ip_addr_groups[8] = { 0 }; + char host_string[sizeof(dst_hosts[i])]; + char ipv6_first_octet[3]; + + memset(&globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, 0, sizeof(dst_sockaddr_t)); + + if (globals.num_dst_addrs > MAX_DST_HOSTS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot add destination address: %s, exceeded maximum of %d\n", dst_hosts[i], MAX_DST_HOSTS); + continue; + } + + if (switch_sockaddr_info_get(&globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, dst_hosts[i], SWITCH_UNSPEC, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find address: %s\n", dst_hosts[i]); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + /* best effort attempt to avoid unicasting to ourself */ + if (switch_cmp_addr(globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, local_ip_sockaddr, SWITCH_FALSE) || switch_cmp_addr(globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, local_ip6_sockaddr, SWITCH_FALSE)) { + /* this address is on this box, cancel the destination sockaddr setup and move on to the next address */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local IP, not adding as peer: %s\n", dst_hosts[i]); + globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr = NULL; + globals.dst_sockaddrs[globals.num_dst_addrs].ipaddr = NULL; + continue; + } + + /* flag this address with the address type */ + strcpy(host_string, dst_hosts[i]); + if (switch_sockaddr_get_family(globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr) == SWITCH_INET) { + globals.has_udp = 1; + switch_separate_string(host_string, '.', ip_addr_groups, sizeof(ip_addr_groups) / sizeof(ip_addr_groups[0])); + + /* IPv4 multicast addresses start with numbers between 224 & 239 inclusive */ + if (switch_safe_atoi(ip_addr_groups[0], 0) >= 224 && switch_safe_atoi(ip_addr_groups[0], 0) <= 239) { + globals.dst_sockaddrs[globals.num_dst_addrs].addrtype = IPV4_MULTICAST; + } else { + globals.dst_sockaddrs[globals.num_dst_addrs].addrtype = IPV4_UNICAST; + } + } else if (switch_sockaddr_get_family(globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr) == SWITCH_INET6) { + globals.has_udp6 = 1; + switch_separate_string(host_string, ':', ip_addr_groups, 8); + + /* IPv6 multicast addresses have FF as the first octet */ + memcpy(ipv6_first_octet, ip_addr_groups[0], 2); + ipv6_first_octet[2] = '\0'; + if (strcasecmp(ipv6_first_octet, "FF") == 0) { + globals.dst_sockaddrs[globals.num_dst_addrs].addrtype = IPV6_MULTICAST; + } else { + globals.dst_sockaddrs[globals.num_dst_addrs].addrtype = IPV6_UNICAST; + } + } else { + globals.dst_sockaddrs[globals.num_dst_addrs].addrtype = IP_UNKOWN_TYPE; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unkown address family for peer: %s\n", dst_hosts[i]); + } + + /* store this address in our list of peers */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Added %s peer: %s", addr_type_names[globals.dst_sockaddrs[globals.num_dst_addrs].addrtype], dst_hosts[i]); + globals.dst_sockaddrs[globals.num_dst_addrs].ipaddr = switch_core_strdup(module_pool, dst_hosts[i]); + globals.num_dst_addrs++; + } + + /* create IPv4 source socket */ + if (globals.has_udp == 1) { + /* create IPv4 listen sockaddr*/ + if (switch_sockaddr_info_get(&globals.src_sockaddr, globals.src_addr, SWITCH_INET, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set IPv4 source address: %s\n", globals.src_addr); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + /* create IPv4 socket */ + if (switch_socket_create(&globals.udp_socket, AF_INET, SOCK_DGRAM, 0, module_pool) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create IPv4 Socket\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + if (switch_socket_opt_set(globals.udp_socket, SWITCH_SO_REUSEADDR, 1) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "IPv4 unable to resue socket\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + if (switch_socket_opt_set(globals.udp_socket, SWITCH_SO_NONBLOCK, TRUE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "IPv4 unable to set nonblocking mode on socket\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + /* no harm in doing this even without multicast destinations */ + if (switch_mcast_hops(globals.udp_socket, globals.ttl) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set IPv4 multicast ttl to '%d'\n", globals.ttl); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + if (switch_mcast_loopback(globals.udp_socket, globals.loopback) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set IPv4 multicast loopback to '%d'\n", globals.loopback); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + /* start listening on this IPv4 socket */ + if (switch_socket_bind(globals.udp_socket, globals.src_sockaddr) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to bind IPv4 Socket\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IPv4 source set to: %s\n", globals.src_addr); + } + } + + /* create IPv6 source socket */ + if (globals.has_udp6 == 1) { + /* create IPv6 listen sockaddr */ + if (switch_sockaddr_info_get(&globals.src_sockaddr6, globals.src_addr6, SWITCH_INET6, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set IPv6 source address: %s\n", globals.src_addr6); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + /* create IPv6 socket */ + if (switch_socket_create(&globals.udp_socket6, AF_INET6, SOCK_DGRAM, 0, module_pool) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create IPv6 Socket\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + if (switch_socket_opt_set(globals.udp_socket6, SWITCH_SO_REUSEADDR, 1) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "IPv6 unable to reuse socket\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + if (switch_socket_opt_set(globals.udp_socket6, SWITCH_SO_NONBLOCK, TRUE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "IPv6 unable to set nonblocking mode on socket\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + /* no harm in doing this even without multicast destinations */ + /* Bug in APR < v1.2.13, cannot set TTL on IPv6 multicast sockets */ + /* + if (switch_mcast_hops(globals.udp_socket6, globals.ttl) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set IPv6 multicast ttl to '%d'\n", globals.ttl); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + */ + + if (switch_mcast_loopback(globals.udp_socket6, globals.loopback6) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set IPv6 multicast loopback to '%d'\n", globals.loopback6); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + + /* start listening on this IPv6 socket */ + if (switch_socket_bind(globals.udp_socket6, globals.src_sockaddr6) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to bind IPv6 Socket\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IPv6 source set to: %s\n", globals.src_addr6); + } + } + + /* join multicast destinations */ + for (i = 0; i < globals.num_dst_addrs; i++) { + if (globals.dst_sockaddrs[i].addrtype == IPV4_MULTICAST) { + if (switch_mcast_join(globals.udp_socket, globals.dst_sockaddrs[i].sockaddr, NULL, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Multicast Error\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + } + + if (globals.dst_sockaddrs[i].addrtype == IPV6_MULTICAST) { + if (switch_mcast_join(globals.udp_socket6, globals.dst_sockaddrs[i].sockaddr, NULL, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Multicast Error\n"); + switch_goto_status(SWITCH_STATUS_TERM, fail); + } + } + } + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; + +fail: + cleanup(); + + return status; } static void event_handler(switch_event_t *event) @@ -221,21 +517,42 @@ static void event_handler(switch_event_t *event) } if (event->event_id == SWITCH_EVENT_RELOADXML) { + switch_bool_t config_changed = SWITCH_FALSE; + char tempMD5[SWITCH_MD5_DIGEST_STRING_SIZE]; + switch_xml_t xml, cfg; + + if (!(xml = open_config_file(CONF_FILE, &cfg, tempMD5))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", CONF_FILE); + return; + } + switch_mutex_lock(globals.mutex); - switch_core_hash_destroy(&globals.event_hash); - globals.event_hash = NULL; - if (globals.psk) { - switch_safe_free(globals.psk); - globals.psk = NULL; - } - switch_core_hash_init(&globals.event_hash); - memset(globals.event_list, 0, SWITCH_EVENT_ALL + 1); - if (load_config() != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to reload config file\n"); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Event Multicast Reloaded\n"); + + config_changed = strcmp(globals.configuration_md5, tempMD5) ? SWITCH_TRUE : SWITCH_FALSE; + /* If the config has changed, reload the configuration */ + if (config_changed) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Configuration changed, reloading\n"); + switch_thread_rwlock_wrlock(globals.runtime_rwlock); + + cleanup(); + + /* Re-initialize the module */ + if (initialize_sockets(cfg) != SWITCH_STATUS_SUCCESS) { + globals.runtime_processing = 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to reinitialize sockets.\n"); + /* Invalidate current configuration md5 */ + switch_md5_string(globals.configuration_md5, "", strlen("")); + } else { + switch_md5_string(globals.configuration_md5, tempMD5, strlen(tempMD5)); + globals.runtime_processing = 1; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Reloaded\n"); + } + + switch_thread_rwlock_unlock(globals.runtime_rwlock); } + switch_mutex_unlock(globals.mutex); + switch_xml_free(xml); } if (event->event_id == SWITCH_EVENT_HEARTBEAT) { @@ -289,6 +606,8 @@ static void event_handler(switch_event_t *event) if (switch_event_serialize(event, &packet, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { size_t len; char *buf; + int i; + #ifdef HAVE_OPENSSL int outlen, tmplen; #if OPENSSL_VERSION_NUMBER >= 0x10100000 @@ -349,7 +668,19 @@ static void event_handler(switch_event_t *event) } #endif - switch_socket_sendto(globals.udp_socket, globals.addr, 0, buf, &len); + for (i = 0; i < globals.num_dst_addrs; i++) { + /* Send to IPv4 */ + if (globals.dst_sockaddrs[i].addrtype == IPV4_UNICAST || globals.dst_sockaddrs[i].addrtype == IPV4_MULTICAST) { + switch_socket_sendto(globals.udp_socket, globals.dst_sockaddrs[i].sockaddr, 0, buf, &len); + } + + /* Send to IPv4 */ + if (globals.dst_sockaddrs[i].addrtype == IPV6_UNICAST || globals.dst_sockaddrs[i].addrtype == IPV6_MULTICAST) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to IPv6: %s\n", globals.dst_sockaddrs[i].ipaddr); + switch_socket_sendto(globals.udp_socket6, globals.dst_sockaddrs[i].sockaddr, 0, buf, &len); + } + } + switch_safe_free(packet); switch_safe_free(buf); } @@ -359,6 +690,108 @@ static void event_handler(switch_event_t *event) return; } +static switch_status_t process_packet(char* packet, size_t len) +{ + char *m; + switch_event_t *local_event; + +#ifdef HAVE_OPENSSL + if (globals.psk) { + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; + char *tmp; + int outl, tmplen; +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + EVP_CIPHER_CTX *ctx; +#else + EVP_CIPHER_CTX ctx; +#endif + + len -= SWITCH_UUID_FORMATTED_LENGTH; + + tmp = malloc(len); + + memset(tmp, 0, len); + + switch_copy_string(uuid_str, packet, SWITCH_UUID_FORMATTED_LENGTH); + packet += SWITCH_UUID_FORMATTED_LENGTH; + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + ctx = EVP_CIPHER_CTX_new(); + EVP_DecryptInit(ctx, EVP_bf_cbc(), NULL, NULL); + EVP_CIPHER_CTX_set_key_length(ctx, strlen(globals.psk)); + EVP_DecryptInit(ctx, NULL, (unsigned char *)globals.psk, (unsigned char *)uuid_str); + EVP_DecryptUpdate(ctx, (unsigned char *)tmp, &outl, (unsigned char *)packet, (int)len); + EVP_DecryptFinal(ctx, (unsigned char *)tmp + outl, &tmplen); + EVP_CIPHER_CTX_free(ctx); +#else + EVP_CIPHER_CTX_init(&ctx); + EVP_DecryptInit(&ctx, EVP_bf_cbc(), NULL, NULL); + EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk)); + EVP_DecryptInit(&ctx, NULL, (unsigned char *)globals.psk, (unsigned char *)uuid_str); + EVP_DecryptUpdate(&ctx, (unsigned char *)tmp, &outl, (unsigned char *)packet, (int)len); + EVP_DecryptFinal(&ctx, (unsigned char *)tmp + outl, &tmplen); + EVP_CIPHER_CTX_cleanup(&ctx); +#endif + + *(tmp + outl + tmplen) = '\0'; + + /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "decrypted event as %s\n----------\n of actual length %d (%d) %d\n", tmp, outl + tmplen, (int) len, (int) strlen(tmp)); */ + packet = tmp; + + } +#endif + + if ((m = strchr(packet, (int)MAGIC[0])) != 0) { + /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found start of magic string\n"); */ + if (!strncmp((char *)MAGIC, m, strlen((char *)MAGIC))) { + /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found entire magic string\n"); */ + *m = '\0'; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Inbound event packet is missing the complete validation string.\n"); + return SWITCH_STATUS_NOOP; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to validate inbound event packet, is your PSK correctly configured?\n"); + return SWITCH_STATUS_NOOP; + } + + /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT %d\n--------------------------------\n%s\n", (int) len, packet); */ + if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT) == SWITCH_STATUS_SUCCESS) { + char *var, *val, *term = NULL, tmpname[128]; + switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Multicast", "yes"); + var = packet; + while (var && *var) { + if ((val = strchr(var, ':')) != 0) { + *val++ = '\0'; + while (*val == ' ') { + val++; + } + if ((term = strchr(val, '\r')) != 0 || (term = strchr(val, '\n')) != 0) { + *term = '\0'; + while (*term == '\r' || *term == '\n') { + term++; + } + } + switch_url_decode(val); + switch_snprintf(tmpname, sizeof(tmpname), "Orig-%s", var); + switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, tmpname, val); + var = term + 1; + } else { + /* This should be our magic packet, done processing incoming headers */ + break; + } + } + + if (var && strlen(var) > 1) { + switch_event_add_body(local_event, "%s", var); + } + + return switch_event_fire(&local_event); + } + + return SWITCH_STATUS_NOOP; +} + SWITCH_STANDARD_API(multicast_peers) { switch_hash_index_t *cur; @@ -368,8 +801,26 @@ SWITCH_STANDARD_API(multicast_peers) time_t now = switch_epoch_time_now(NULL); struct peer_status *last; char *host; - int i = 0; + int i; + switch_mutex_lock(globals.mutex); + + /* Output current module state */ + stream->write_function(stream, "Module state: "); + if (globals.running == 1 && globals.runtime_processing == 1) { + stream->write_function(stream, "Active\n\n"); + } else { + stream->write_function(stream, "Inactive\n\n"); + } + + stream->write_function(stream, "Configured peers:\n"); + for (i = 0; i < globals.num_dst_addrs; i++) { + stream->write_function(stream, "\t%s: %s\n", addr_type_names[globals.dst_sockaddrs[i].addrtype], globals.dst_sockaddrs[i].ipaddr); + } + + stream->write_function(stream, "\n\n"); + + i = 0; for (cur = switch_core_hash_first(globals.peer_hash); cur; cur = switch_core_hash_next(&cur)) { switch_core_hash_this(cur, &key, &keylen, &value); host = (char *) key; @@ -383,6 +834,8 @@ SWITCH_STANDARD_API(multicast_peers) stream->write_function(stream, "No multicast peers seen\n"); } + switch_mutex_unlock(globals.mutex); + return SWITCH_STATUS_SUCCESS; } @@ -396,51 +849,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load) switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, pool); module_pool = pool; - switch_core_hash_init(&globals.event_hash); - switch_core_hash_init(&globals.peer_hash); + switch_thread_rwlock_create(&globals.runtime_rwlock, pool); - globals.key_count = 0; - - if (load_config() != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Configure\n"); - switch_goto_status(SWITCH_STATUS_TERM, fail); - } - - if (switch_sockaddr_info_get(&globals.addr, globals.address, SWITCH_UNSPEC, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find address\n"); - switch_goto_status(SWITCH_STATUS_TERM, fail); - } - - if (switch_socket_create(&globals.udp_socket, AF_INET, SOCK_DGRAM, 0, module_pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error\n"); - switch_goto_status(SWITCH_STATUS_TERM, fail); - } - - if (switch_socket_opt_set(globals.udp_socket, SWITCH_SO_REUSEADDR, 1) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Option Error\n"); - switch_goto_status(SWITCH_STATUS_TERM, fail); - } - - if (switch_mcast_join(globals.udp_socket, globals.addr, NULL, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Multicast Error\n"); - switch_goto_status(SWITCH_STATUS_TERM, fail); - } - - if (switch_mcast_hops(globals.udp_socket, globals.ttl) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set ttl to '%d'\n", globals.ttl); - switch_goto_status(SWITCH_STATUS_TERM, fail); - } - - if (switch_mcast_loopback(globals.udp_socket, (uint8_t)globals.loopback) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set loopback to '%d'\n", globals.loopback); - switch_goto_status(SWITCH_STATUS_TERM, fail); - } - - if (switch_socket_bind(globals.udp_socket, globals.addr) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error\n"); - switch_goto_status(SWITCH_STATUS_TERM, fail); + if (initialize_sockets(NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to initialize sockets."); + switch_goto_status(SWITCH_STATUS_GENERR, fail); } + /* Reserve the module specific events */ if (switch_event_reserve_subclass(MULTICAST_EVENT) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MULTICAST_EVENT); switch_goto_status(SWITCH_STATUS_GENERR, fail); @@ -456,13 +872,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load) switch_goto_status(SWITCH_STATUS_GENERR, fail); } + /* Bind to the event bus */ if (switch_event_bind(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind to event bus!\n"); switch_goto_status(SWITCH_STATUS_GENERR, fail); } -#ifdef USE_NONBLOCK - switch_socket_opt_set(globals.udp_socket, SWITCH_SO_NONBLOCK, TRUE); -#endif /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -475,42 +889,31 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load) fail: - if (globals.udp_socket) { - switch_socket_close(globals.udp_socket); - } - switch_event_free_subclass(MULTICAST_EVENT); switch_event_free_subclass(MULTICAST_PEERUP); switch_event_free_subclass(MULTICAST_PEERDOWN); return status; - } - SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown) { globals.running = 0; switch_event_unbind_callback(event_handler); - switch_mutex_lock(globals.mutex); - if (globals.udp_socket) { - switch_socket_shutdown(globals.udp_socket, 2); + while (globals.runtime_thread_has_to_finish) { + switch_yield(100 * 1000); } + switch_mutex_lock(globals.mutex); + switch_event_free_subclass(MULTICAST_EVENT); switch_event_free_subclass(MULTICAST_PEERUP); switch_event_free_subclass(MULTICAST_PEERDOWN); - if (globals.event_hash) { - switch_core_hash_destroy(&globals.event_hash); - } - if (globals.peer_hash) { - switch_core_hash_destroy(&globals.peer_hash); - } + cleanup(); - switch_safe_free(globals.address); - switch_safe_free(globals.bindings); + switch_thread_rwlock_destroy(globals.runtime_rwlock); switch_mutex_unlock(globals.mutex); return SWITCH_STATUS_SUCCESS; @@ -518,141 +921,77 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown) SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime) { - switch_event_t *local_event; - char *buf, *m; - switch_sockaddr_t *addr; + char *buf; + + globals.runtime_thread_has_to_finish = 1; buf = (char *) malloc(MULTICAST_BUFFSIZE); switch_assert(buf); - switch_sockaddr_info_get(&addr, NULL, SWITCH_UNSPEC, 0, 0, module_pool); globals.running = 1; + globals.runtime_processing = 1; while (globals.running == 1) { - char *myaddr; + int rxdata = 0; size_t len = MULTICAST_BUFFSIZE - 1; - char *packet; switch_status_t status; - memset(buf, 0, len + 1); - switch_sockaddr_ip_get(&myaddr, globals.addr); - if ((status = switch_socket_recvfrom(addr, globals.udp_socket, 0, buf, &len)) != SWITCH_STATUS_SUCCESS || !len || !globals.running) { + switch_thread_rwlock_rdlock(globals.runtime_rwlock); + + if (globals.running != 1) { + switch_thread_rwlock_unlock(globals.runtime_rwlock); break; - } -#ifdef USE_NONBLOCK - if (!len) { - if (SWITCH_STATUS_IS_BREAK(status)) { - switch_yield(100000); - continue; - } - - break; - } -#endif - - packet = buf; - -#ifdef HAVE_OPENSSL - if (globals.psk) { - char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; - char *tmp; - int outl, tmplen; -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - EVP_CIPHER_CTX *ctx; -#else - EVP_CIPHER_CTX ctx; -#endif - - len -= SWITCH_UUID_FORMATTED_LENGTH; - - tmp = malloc(len); - - memset(tmp, 0, len); - - switch_copy_string(uuid_str, packet, SWITCH_UUID_FORMATTED_LENGTH); - packet += SWITCH_UUID_FORMATTED_LENGTH; - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - ctx = EVP_CIPHER_CTX_new(); - EVP_DecryptInit(ctx, EVP_bf_cbc(), NULL, NULL); - EVP_CIPHER_CTX_set_key_length(ctx, strlen(globals.psk)); - EVP_DecryptInit(ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); - EVP_DecryptUpdate(ctx, (unsigned char *) tmp, &outl, (unsigned char *) packet, (int) len); - EVP_DecryptFinal(ctx, (unsigned char *) tmp + outl, &tmplen); - EVP_CIPHER_CTX_free(ctx); -#else - EVP_CIPHER_CTX_init(&ctx); - EVP_DecryptInit(&ctx, EVP_bf_cbc(), NULL, NULL); - EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk)); - EVP_DecryptInit(&ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); - EVP_DecryptUpdate(&ctx, (unsigned char *) tmp, &outl, (unsigned char *) packet, (int) len); - EVP_DecryptFinal(&ctx, (unsigned char *) tmp + outl, &tmplen); - EVP_CIPHER_CTX_cleanup(&ctx); -#endif - - *(tmp + outl + tmplen) = '\0'; - - /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "decrypted event as %s\n----------\n of actual length %d (%d) %d\n", tmp, outl + tmplen, (int) len, (int) strlen(tmp)); */ - packet = tmp; - - } -#endif - if ((m = strchr(packet, (int) MAGIC[0])) != 0) { - /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found start of magic string\n"); */ - if (!strncmp((char *) MAGIC, m, strlen((char *) MAGIC))) { - /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found entire magic string\n"); */ - *m = '\0'; - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to find entire magic string\n"); - continue; - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to find start of magic string\n"); + } else if (globals.runtime_processing != 1) { + switch_thread_rwlock_unlock(globals.runtime_rwlock); + switch_yield(100 * 1000); continue; } - /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT %d\n--------------------------------\n%s\n", (int) len, packet); */ - if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT) == SWITCH_STATUS_SUCCESS) { - char *var, *val, *term = NULL, tmpname[128]; - switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Multicast", "yes"); - var = packet; - while (var && *var) { - if ((val = strchr(var, ':')) != 0) { - *val++ = '\0'; - while (*val == ' ') { - val++; - } - if ((term = strchr(val, '\r')) != 0 || (term = strchr(val, '\n')) != 0) { - *term = '\0'; - while (*term == '\r' || *term == '\n') { - term++; - } - } - switch_url_decode(val); - switch_snprintf(tmpname, sizeof(tmpname), "Orig-%s", var); - switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, tmpname, val); - var = term + 1; - } else { - break; - } + memset(buf, 0, len + 1); + + /* If there's data in the IPv4 packet, process it */ + if (globals.has_udp == 1) { + status = switch_socket_recv(globals.udp_socket, buf, &len); + if (globals.running == 0 || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) { + switch_thread_rwlock_unlock(globals.runtime_rwlock); + break; } - if (var && strlen(var) > 1) { - switch_event_add_body(local_event, "%s", var); + /* Did we get data? */ + if (len && len > SWITCH_UUID_FORMATTED_LENGTH) { + rxdata = 1; + process_packet(buf, len); } - - switch_event_fire(&local_event); - } - } + /* If there's data in the IPv6 packet, process it */ + len = MULTICAST_BUFFSIZE - 1; + memset(buf, 0, len + 1); + if (globals.has_udp6 == 1) { + status = switch_socket_recv(globals.udp_socket6, buf, &len); + if (globals.running == 0 || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) { + switch_thread_rwlock_unlock(globals.runtime_rwlock); + break; + } + /* Did we get data? */ + if (len && len > SWITCH_UUID_FORMATTED_LENGTH) { + rxdata = 1; + process_packet(buf, len); + } + } - if (globals.udp_socket) { - switch_socket_close(globals.udp_socket); - globals.udp_socket = NULL; + /* Nonblocking sockets are required, re-run loop if we got data, else yield */ + if (rxdata == 1) { + switch_thread_rwlock_unlock(globals.runtime_rwlock); + continue; + } + + switch_thread_rwlock_unlock(globals.runtime_rwlock); + switch_yield(500000); } globals.running = 0; free(buf); + globals.runtime_thread_has_to_finish = 0; return SWITCH_STATUS_TERM; } From d6de1d9af7e97ad72198dc665fb6ef9a2634d0c4 Mon Sep 17 00:00:00 2001 From: VCC Live/Core <56296664+vcc-core@users.noreply.github.com> Date: Thu, 30 Apr 2020 16:55:28 +0200 Subject: [PATCH 241/655] [Core] Add systemd sd_notify support --- Makefile.am | 2 +- build/freeswitch.service | 4 ++++ configure.ac | 11 +++++++++++ src/switch_core.c | 12 ++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ac15c3d7a3..09d500a4d7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -248,7 +248,7 @@ endif lib_LTLIBRARIES = libfreeswitch.la libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(GUMBO_CFLAGS) $(FVAD_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS) $(SOFIA_SIP_CFLAGS) $(AM_CFLAGS) $(TPL_CFLAGS) libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_LDFLAGS) -no-undefined -libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(GUMBO_LIBS) $(FVAD_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) $(TPL_LIBS) $(SPANDSP_LIBS) $(SOFIA_SIP_LIBS) +libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(GUMBO_LIBS) $(FVAD_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(SYSTEMD_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) $(TPL_LIBS) $(SPANDSP_LIBS) $(SOFIA_SIP_LIBS) libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES) if HAVE_PNG diff --git a/build/freeswitch.service b/build/freeswitch.service index ae6921b4df..2b0a035723 100644 --- a/build/freeswitch.service +++ b/build/freeswitch.service @@ -4,6 +4,10 @@ After=syslog.target network.target After=postgresql.service postgresql-9.3.service postgresql-9.4.service mysqld.service httpd.service [Service] +# You can use Type=notify only if you compile FreeSWITCH with --enable-systemd configure option +# In this case you have to run FreeSWITCH in foreground mode (-nf option)! +#Type=notify +#NotifyAccess=main User=freeswitch EnvironmentFile=-/etc/sysconfig/freeswitch # RuntimeDirectory is not yet supported in CentOS 7. A workaround is to use /etc/tmpfiles.d/freeswitch.conf diff --git a/configure.ac b/configure.ac index b5dfe74909..eb65a4765d 100644 --- a/configure.ac +++ b/configure.ac @@ -1578,6 +1578,17 @@ AS_IF([test "x$enable_core_libedit_support" != "xno"],[ AC_MSG_ERROR([You need to either install libedit-dev (>= 2.11) or configure with --disable-core-libedit-support]) ])])]) +AC_ARG_ENABLE(systemd, + [AS_HELP_STRING([--enable-systemd], [Compile with systemd notify support])]) + +AS_IF([test "x$enable_systemd" = "xyes"],[ + PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 219], [ + AC_DEFINE([HAVE_SYSTEMD], [1], [Define to 1 if systemd is available])]) +]) + +AC_SUBST(SYSTEMD_LIBS) + + dnl --------------------------------------------------------------------------- dnl - OpenLDAP SDK dnl --------------------------------------------------------------------------- diff --git a/src/switch_core.c b/src/switch_core.c index cacff3cdeb..ac6001c612 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -73,6 +73,10 @@ #define pclose _pclose #endif +#ifdef HAVE_SYSTEMD +#include <systemd/sd-daemon.h> +#endif + SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs = { 0 }; SWITCH_DECLARE_DATA switch_filenames SWITCH_GLOBAL_filenames = { 0 }; @@ -2558,6 +2562,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t free(cmd); } +#ifdef HAVE_SYSTEMD + sd_notifyf(0, "READY=1\n" + "MAINPID=%lu\n", (unsigned long) getpid()); +#endif + return SWITCH_STATUS_SUCCESS; } @@ -2880,6 +2889,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void * switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Restarting\n"); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Shutting down\n"); +#ifdef HAVE_SYSTEMD + sd_notifyf(0, "STOPPING=1\n"); +#endif #ifdef _MSC_VER fclose(stdin); #endif From 61089e8f24e6344d0306a12f1d0d3c976cec03a2 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 22 Oct 2021 20:37:42 +0300 Subject: [PATCH 242/655] [core] Improve session recording thread performance. --- src/switch_ivr_async.c | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index a08223393c..357ea3f07a 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1157,6 +1157,8 @@ struct record_helper { const char *completion_cause; int start_event_sent; switch_event_t *variables; + switch_mutex_t *cond_mutex; + switch_thread_cond_t *cond; }; static switch_status_t record_helper_destroy(struct record_helper **rh, switch_core_session_t *session); @@ -1261,17 +1263,21 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void * } rh = switch_core_media_bug_get_user_data(bug); - switch_buffer_create_dynamic(&rh->thread_buffer, 1024 * 512, 1024 * 64, 0); + switch_buffer_create_dynamic(&rh->thread_buffer, SWITCH_RECOMMENDED_BUFFER_SIZE, SWITCH_RECOMMENDED_BUFFER_SIZE, 0); rh->thread_ready = 1; channels = switch_core_media_bug_test_flag(bug, SMBF_STEREO) ? 2 : rh->read_impl.number_of_channels; data = switch_core_alloc(rh->helper_pool, SWITCH_RECOMMENDED_BUFFER_SIZE); + switch_mutex_lock(rh->cond_mutex); + while(switch_test_flag(rh->fh, SWITCH_FILE_OPEN)) { if (rh->thread_needs_transfer) { assert(session != rh->recording_session); if (switch_core_session_read_lock(rh->recording_session) != SWITCH_STATUS_SUCCESS) { + /* Wait until recording is reverted to the original session */ + switch_thread_cond_wait(rh->cond, rh->cond_mutex); continue; } @@ -1298,15 +1304,19 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void * switch_mutex_lock(rh->buffer_mutex); inuse = switch_buffer_inuse(rh->thread_buffer); - if (rh->thread_ready && switch_channel_up_nosig(channel) && inuse < bsize) { - switch_mutex_unlock(rh->buffer_mutex); - switch_yield(20000); - continue; - } else if ((!rh->thread_ready || switch_channel_down_nosig(channel)) && !inuse) { + if ((!rh->thread_ready || switch_channel_down_nosig(channel)) && !inuse) { switch_mutex_unlock(rh->buffer_mutex); break; } + if (!inuse) { + switch_mutex_unlock(rh->buffer_mutex); + if (rh->thread_ready) { + switch_thread_cond_wait(rh->cond, rh->cond_mutex); + } + continue; + } + samples = switch_buffer_read(rh->thread_buffer, data, bsize) / 2 / channels; switch_mutex_unlock(rh->buffer_mutex); @@ -1321,6 +1331,8 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void * } } + switch_mutex_unlock(rh->cond_mutex); + switch_core_session_rwunlock(session); return NULL; @@ -1362,6 +1374,10 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s rh->bug = bug; rh->thread_needs_transfer = 1; + switch_mutex_lock(rh->cond_mutex); + switch_thread_cond_signal(rh->cond); + switch_mutex_unlock(rh->cond_mutex); + while (--sanity > 0 && rh->thread_needs_transfer) { switch_yield(10000); } @@ -1399,8 +1415,11 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s int sanity = 200; switch_mutex_init(&rh->buffer_mutex, SWITCH_MUTEX_NESTED, rh->helper_pool); + switch_mutex_init(&rh->cond_mutex, SWITCH_MUTEX_NESTED, rh->helper_pool); + switch_thread_cond_create(&rh->cond, rh->helper_pool); switch_threadattr_create(&thd_attr, rh->helper_pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_set(thd_attr, SWITCH_PRI_LOW); switch_thread_create(&rh->thread, thd_attr, recording_thread, bug, rh->helper_pool); while(--sanity > 0 && !rh->thread_ready) { @@ -1535,6 +1554,11 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_status_t st; rh->thread_ready = 0; + + switch_mutex_lock(rh->cond_mutex); + switch_thread_cond_signal(rh->cond); + switch_mutex_unlock(rh->cond_mutex); + switch_thread_join(&st, rh->thread); } @@ -1542,7 +1566,6 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_buffer_destroy(&rh->thread_buffer); } - frame.data = data; frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; @@ -1663,6 +1686,10 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_mutex_lock(rh->buffer_mutex); switch_buffer_write(rh->thread_buffer, mask ? null_data : data, frame.datalen); switch_mutex_unlock(rh->buffer_mutex); + if (switch_mutex_trylock(rh->cond_mutex) == SWITCH_STATUS_SUCCESS) { + switch_thread_cond_signal(rh->cond); + switch_mutex_unlock(rh->cond_mutex); + } } else if (switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); /* File write failed */ From 6a099f74f9869161a785e4e27c96d1133a943007 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Thu, 12 Mar 2020 16:20:01 -0400 Subject: [PATCH 243/655] [mod_spandsp] Protect spandsp data from t38 timer thread and call session thread simultaneous access. --- .../mod_spandsp/mod_spandsp_fax.c | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 3ec1e022e4..1f63eb1aed 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -89,6 +89,7 @@ struct pvt_s { t38_terminal_state_t *t38_state; t38_gateway_state_t *t38_gateway_state; t38_core_state_t *t38_core; + switch_mutex_t *mutex; udptl_state_t *udptl_state; @@ -224,7 +225,9 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * for (pvt = t38_state_list.head; pvt; pvt = pvt->next) { if (pvt->udptl_state && pvt->session && switch_channel_ready(switch_core_session_get_channel(pvt->session))) { + switch_mutex_lock(pvt->mutex); t38_terminal_send_timeout(pvt->t38_state, samples); + switch_mutex_unlock(pvt->mutex); } } @@ -819,11 +822,12 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) case T38_MODE: { switch_core_session_message_t msg = { 0 }; - + switch_mutex_lock(pvt->mutex); if (pvt->t38_state == NULL) { pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); } if (pvt->t38_state == NULL) { + switch_mutex_unlock(pvt->mutex); return SWITCH_STATUS_FALSE; } if (pvt->udptl_state == NULL) { @@ -832,6 +836,7 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) if (pvt->udptl_state == NULL) { t38_terminal_free(pvt->t38_state); pvt->t38_state = NULL; + switch_mutex_unlock(pvt->mutex); return SWITCH_STATUS_FALSE; } @@ -842,6 +847,7 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) memset(t38, 0, sizeof(t38_terminal_state_t)); if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { + switch_mutex_unlock(pvt->mutex); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); return SWITCH_STATUS_FALSE; } @@ -850,6 +856,7 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { + switch_mutex_unlock(pvt->mutex); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); return SWITCH_STATUS_FALSE; } @@ -858,11 +865,6 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; switch_core_session_receive_message(pvt->session, &msg); - /* add to timer thread processing */ - if (!add_pvt(pvt)) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - } - span_log_set_message_handler(t38_terminal_get_logging_state(t38), mod_spandsp_log_message, pvt->session); span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, pvt->session); @@ -870,6 +872,13 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) span_log_set_level(t38_terminal_get_logging_state(t38), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_level(t30_get_logging_state(t30), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); } + + switch_mutex_unlock(pvt->mutex); + + /* add to timer thread processing */ + if (!add_pvt(pvt)) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } } break; case T38_GATEWAY_MODE: @@ -1434,6 +1443,8 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati } } + switch_mutex_init(&pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); + return pvt; } @@ -1642,7 +1653,9 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat pvt->t38_mode = T38_MODE_NEGOTIATED; switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); spanfax_init(pvt, T38_MODE); + switch_mutex_lock(pvt->mutex); configure_t38(pvt); + switch_mutex_unlock(pvt->mutex); /* This will change the rtp stack to udptl mode */ msg.from = __FILE__; @@ -1683,7 +1696,9 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat /* now we know we can cast frame->packet to a udptl structure */ //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "READ %d udptl bytes\n", read_frame->packetlen); + switch_mutex_lock(pvt->mutex); udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); + switch_mutex_unlock(pvt->mutex); } } continue; @@ -1691,16 +1706,19 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat break; } + switch_mutex_lock(pvt->mutex); if (switch_test_flag(read_frame, SFF_CNG)) { /* We have no real signal data for the FAX software, but we have a space in time if we have a CNG indication. Do a fill-in operation in the FAX machine, to keep things rolling along. */ if (fax_rx_fillin(pvt->fax_state, read_impl.samples_per_packet)) { + switch_mutex_unlock(pvt->mutex); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx_fillin reported an error\n"); continue; } } else { /* Pass the new incoming audio frame to the fax_rx function */ if (fax_rx(pvt->fax_state, (int16_t *) read_frame->data, read_frame->samples)) { + switch_mutex_unlock(pvt->mutex); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx reported an error\n"); switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "fax_rx reported an error"); goto done; @@ -1708,10 +1726,12 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat } if ((tx = fax_tx(pvt->fax_state, buf, write_codec.implementation->samples_per_packet)) < 0) { + switch_mutex_unlock(pvt->mutex); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_tx reported an error\n"); switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "fax_tx reported an error"); goto done; } + switch_mutex_unlock(pvt->mutex); if (!tx) { /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No audio samples to send\n"); */ From 53b459a6879cfdec16ca88ea68bfc4b464926c6c Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@jerris.com> Date: Thu, 12 Mar 2020 17:07:37 -0400 Subject: [PATCH 244/655] [core] add support for resolving (and ignoring) mdns style .local addresses in ice candidates --- src/include/switch_core_media.h | 5 +- src/include/switch_types.h | 3 +- .../applications/mod_commands/mod_commands.c | 23 ++++++++- src/switch_core.c | 5 ++ src/switch_core_media.c | 47 +++++++++++++++++-- 5 files changed, 76 insertions(+), 7 deletions(-) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 19a923e64e..105cd50f97 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -390,7 +390,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_printf(switch_core_session_t SWITCH_DECLARE(switch_msrp_session_t *) switch_core_media_get_msrp_session(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_media_set_smode(switch_core_session_t *session, switch_media_type_t type, switch_media_flow_t smode, switch_sdp_type_t sdp_type); - + +SWITCH_DECLARE(void) switch_core_media_set_resolveice(switch_bool_t resolve_ice); +SWITCH_DECLARE(switch_bool_t) switch_core_media_has_resolveice(void); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 73c91d961e..4757ed1c3a 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -2291,7 +2291,8 @@ typedef enum { SCSC_SPS_PEAK, SCSC_SPS_PEAK_FIVEMIN, SCSC_SESSIONS_PEAK, - SCSC_SESSIONS_PEAK_FIVEMIN + SCSC_SESSIONS_PEAK_FIVEMIN, + SCSC_MDNS_RESOLVE } switch_session_ctl_t; typedef enum { diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index aec3097e45..5d8313e5c5 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2417,7 +2417,7 @@ SWITCH_STANDARD_API(uptime_function) return SWITCH_STATUS_SUCCESS; } -#define CTL_SYNTAX "[recover|send_sighup|hupall|pause [inbound|outbound]|resume [inbound|outbound]|shutdown [cancel|elegant|asap|now|restart]|sps|sps_peak_reset|sync_clock|sync_clock_when_idle|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|min_idle_cpu|loglevel [level]|debug_level [level]]" +#define CTL_SYNTAX "[recover|send_sighup|hupall|pause [inbound|outbound]|resume [inbound|outbound]|shutdown [cancel|elegant|asap|now|restart]|sps|sps_peak_reset|sync_clock|sync_clock_when_idle|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|min_idle_cpu|loglevel [level]|debug_level [level]|mdns_resolve [enable|disable]]" SWITCH_STANDARD_API(ctl_function) { int argc; @@ -2673,6 +2673,25 @@ SWITCH_STANDARD_API(ctl_function) } else { stream->write_function(stream, "+OK clock will synchronize when there are no more calls\n"); } + } else if (!strcasecmp(argv[0], "mdns_resolve")) { + switch_bool_t set = 0; + if (argv[1]) { + if (!strcasecmp(argv[1], "enable")) { + arg = 1; + set = 1; + } else if (!strcasecmp(argv[1], "disable")) { + arg = 0; + set = 1; + } + } + if (set) { + switch_core_session_ctl(SCSC_MDNS_RESOLVE, &arg); + stream->write_function(stream, "+OK\n"); + arg = 0; + } else { + stream->write_function(stream, "-ERR Invalid command\nUSAGE: fsctl %s\n", CTL_SYNTAX); + goto end; + } } else { stream->write_function(stream, "-ERR Invalid command\nUSAGE: fsctl %s\n", CTL_SYNTAX); goto end; @@ -7733,6 +7752,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add fsctl flush_db_handles"); switch_console_set_complete("add fsctl min_idle_cpu"); switch_console_set_complete("add fsctl send_sighup"); + switch_console_set_complete("add fsctl mdns_resolve disable"); + switch_console_set_complete("add fsctl mdns_resolve enable"); switch_console_set_complete("add interface_ip auto ::console::list_interfaces"); switch_console_set_complete("add interface_ip ipv4 ::console::list_interfaces"); switch_console_set_complete("add interface_ip ipv6 ::console::list_interfaces"); diff --git a/src/switch_core.c b/src/switch_core.c index ac6001c612..81b6de762b 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2348,6 +2348,8 @@ static void switch_load_core_config(const char *file) } else { runtime.timer_affinity = atoi(val); } + } else if (!strcasecmp(var, "ice-resolve-candidate")) { + switch_core_media_set_resolveice(switch_true(val)); } else if (!strcasecmp(var, "rtp-start-port") && !zstr(val)) { switch_rtp_set_start_port((switch_port_t) atoi(val)); } else if (!strcasecmp(var, "rtp-end-port") && !zstr(val)) { @@ -3008,6 +3010,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void * switch_core_memory_reclaim_all(); newintval = 0; break; + case SCSC_MDNS_RESOLVE: + switch_core_media_set_resolveice(!!oldintval); + break; } if (intval) { diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 065ad0566f..71c02aa6a9 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -291,6 +291,19 @@ switch_srtp_crypto_suite_t SUITES[CRYPTO_INVALID] = { { "AES_CM_128_NULL_AUTH", "", AES_CM_128_NULL_AUTH, 30, 14} }; +static switch_bool_t ice_resolve_candidate = 0; + +SWITCH_DECLARE(void) switch_core_media_set_resolveice(switch_bool_t resolve_ice) +{ + ice_resolve_candidate = resolve_ice; +} + +SWITCH_DECLARE(switch_bool_t) switch_core_media_has_resolveice(void) +{ + return ice_resolve_candidate; +} + + SWITCH_DECLARE(switch_rtp_crypto_key_type_t) switch_core_media_crypto_str2type(const char *str) { int i; @@ -4153,6 +4166,9 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t int i = 0, got_rtcp_mux = 0; const char *val; int ice_seen = 0, cid = 0, ai = 0, attr_idx = 0, cand_seen = 0, relay_ok = 0; + char con_addr[256]; + int ice_resolve = 0; + ip_t ip; if (switch_true(switch_channel_get_variable_dup(smh->session->channel, "ignore_sdp_ice", SWITCH_FALSE, -1))) { return SWITCH_STATUS_BREAK; @@ -4177,6 +4193,8 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t attrs[0] = sdp->sdp_attributes; } + ice_resolve = switch_core_media_has_resolveice(); + for (attr_idx = 0; attr_idx < 2 && !(ice_seen && cand_seen); attr_idx++) { for (attr = attrs[attr_idx]; attr; attr = attr->a_next) { char *data; @@ -4291,17 +4309,38 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG1, "CAND %d [%s]\n", i, fields[i]); } - if (!ip_possible(smh, fields[4])) { + if (fields[4] && (switch_inet_pton(AF_INET, fields[4], &ip) || switch_inet_pton(AF_INET6, fields[4], &ip))) { + switch_copy_string(con_addr, fields[4], sizeof(con_addr)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG1, "Is an IP address: %s\n", con_addr); + } else if (fields[4] && ice_resolve) { + if (switch_resolve_host(fields[4], con_addr, sizeof(con_addr)) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Resolved %s to %s\n", fields[4], con_addr); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, + "Drop %s Candidate cid: %d proto: %s type: %s addr: %s:%s (cannot resolve)\n", + type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio", + cid+1, fields[2], fields[7], fields[4], fields[5]); + continue; + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, + "Drop %s Candidate cid: %d proto: %s type: %s addr: %s:%s (not an IP address)\n", + type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio", + cid+1, fields[2], fields[7], fields[4] ? fields[4] : "(null)", fields[5]); + continue; + } + + if (!ip_possible(smh, con_addr)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "Drop %s Candidate cid: %d proto: %s type: %s addr: %s:%s (no network path)\n", type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio", - cid+1, fields[2], fields[7] ? fields[7] : "N/A", fields[4], fields[5]); + cid+1, fields[2], fields[7] ? fields[7] : "N/A", con_addr, fields[5]); continue; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "Save %s Candidate cid: %d proto: %s type: %s addr: %s:%s\n", type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio", - cid+1, fields[2], fields[7] ? fields[7] : "N/A", fields[4], fields[5]); + cid+1, fields[2], fields[7] ? fields[7] : "N/A", con_addr, fields[5]); } @@ -4309,7 +4348,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].component_id = atoi(fields[1]); engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].transport = switch_core_session_strdup(smh->session, fields[2]); engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].priority = atol(fields[3]); - engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].con_addr = switch_core_session_strdup(smh->session, fields[4]); + engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].con_addr = switch_core_session_strdup(smh->session, con_addr); engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].con_port = (switch_port_t)atoi(fields[5]); j = 6; From 7770359e8abd67e220eaca719eedae265f45caae Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 3 Apr 2020 21:58:30 -0400 Subject: [PATCH 245/655] [mod_av] Don't require .ext for streaming rtmp:// and rtsp:// formats --- src/mod/applications/mod_av/avformat.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index d45f584b2d..c979e8cce6 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1601,11 +1601,11 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa disable_write_buffer = 1; } - if ((ext = strrchr((char *)path, '.')) == 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n"); - return SWITCH_STATUS_GENERR; - } else if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) { + if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) { format = "flv"; + if ((ext = strrchr((char *)path, '.')) == 0) { + ext = ".flv"; + } // meh really silly format for the user / pass libav..... if (handle->mm.auth_username && handle->mm.auth_password) { @@ -1616,8 +1616,14 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa } else if (handle->stream_name && !strcasecmp(handle->stream_name, "rtsp")) { format = "rtsp"; + if ((ext = strrchr((char *)path, '.')) == 0) { + ext = ".rtsp"; + } switch_snprintf(file, sizeof(file), "rtsp://%s", path); disable_write_buffer = 1; + } else if ((ext = strrchr((char *)path, '.')) == 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n"); + return SWITCH_STATUS_GENERR; } From e8bbe933ac19f26c03026db2ac9bf11fef5a8cc0 Mon Sep 17 00:00:00 2001 From: phonecomwire <62449660+phonecomwire@users.noreply.github.com> Date: Fri, 24 Apr 2020 15:13:12 -0700 Subject: [PATCH 246/655] [mod_valet_parking] Add valet_parking_orbit_exit_key option --- .../mod_valet_parking/mod_valet_parking.c | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index 0c95c16265..9d8f9e6938 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -86,6 +86,34 @@ static switch_status_t valet_on_dtmf(switch_core_session_t *session, void *input case SWITCH_INPUT_TYPE_DTMF: { switch_dtmf_t *dtmf = (switch_dtmf_t *) input; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_dtmf_t *exit_key_pvt = (switch_dtmf_t *) switch_channel_get_private(channel, "_orbit_exit_key_"); + + if (dtmf->digit == exit_key_pvt->digit) { + const char *dp; + const char *exten; + const char *context; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "valet_on_dtmf() - digit pressed '%d' matched valet_parking_orbit_exit_key '%d'\n", dtmf->digit, exit_key_pvt->digit); + + dp = switch_channel_get_variable(channel, "valet_parking_orbin_dialplan"); + if (zstr(dp)) { + dp = switch_channel_get_variable(channel, "XML"); + } + + context = switch_channel_get_variable(channel, "valet_parking_orbit_context"); + if (zstr(context)) { + context = switch_channel_get_variable(channel, "context"); + } + + exten = switch_channel_get_variable(channel, "valet_parking_orbit_exten"); + if (!zstr(exten)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "valet_on_dtmf() - transferring session to '%s %s %s'\n", exten, dp, context); + switch_ivr_session_transfer(session, exten, dp, context); + } + + return SWITCH_STATUS_BREAK; + } if (dtmf->digit == '#') { return SWITCH_STATUS_BREAK; @@ -433,8 +461,8 @@ SWITCH_STANDARD_APP(valet_parking_function) char *dest; int in = -1; - const char *timeout, *orbit_exten, *orbit_dialplan, *orbit_context; - char *timeout_str = "", *orbit_exten_str = "", *orbit_dialplan_str = "", *orbit_context_str = ""; + const char *timeout, *orbit_exten, *orbit_dialplan, *orbit_context, *orbit_exit_key; + char *timeout_str = "", *orbit_exten_str = "", *orbit_dialplan_str = "", *orbit_context_str = "", *orbit_exit_key_str = ""; lot = valet_find_lot(lot_name, SWITCH_TRUE); switch_assert(lot); @@ -606,16 +634,23 @@ SWITCH_STANDARD_APP(valet_parking_function) orbit_context_str = switch_core_session_sprintf(session, "set:valet_parking_orbit_context=%s,", orbit_context); } + if ((orbit_exit_key = switch_channel_get_variable(channel, "valet_parking_orbit_exit_key"))) { + orbit_exit_key_str = switch_core_session_sprintf(session, "set:valet_parking_orbit_exit_key=%s,", orbit_exit_key); + + switch_channel_set_private(channel, "_orbit_exit_key_", orbit_exit_key); + } + if ((timeout = switch_channel_get_variable(channel, "valet_parking_timeout"))) { timeout_str = switch_core_session_sprintf(session, "set:valet_parking_timeout=%s,", timeout); } - dest = switch_core_session_sprintf(session, "%s%s%s%s" + dest = switch_core_session_sprintf(session, "%s%s%s%s%s" "set:valet_ticket=%s,set:valet_hold_music='%s',sleep:1000,valet_park:%s %s", timeout_str, orbit_exten_str, orbit_dialplan_str, orbit_context_str, + orbit_exit_key_str, token->uuid, music, lot_name, ext); switch_channel_set_variable(channel, "inline_destination", dest); From 3fca63e8217f727ac6ddcd1f59a8ce8e52b69cdb Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 17 Apr 2020 14:25:31 +0000 Subject: [PATCH 247/655] [mod_conference] Add conference::maintenance conference-heartbeat. Enable with heartbeat-period-sec configuration, minimum 20 seconds, 0 to disable. --- .../mod_conference/mod_conference.c | 18 ++++++++++++++++++ .../mod_conference/mod_conference.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 498de9fefc..670d6ac9de 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -220,6 +220,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob uint32_t x = 0; int32_t z = 0; conference_cdr_node_t *np; + switch_time_t last_heartbeat_time = switch_epoch_time_now(NULL); file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE); async_file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE); @@ -239,6 +240,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob conference->record_count = 0; while (conference_globals.running && !conference_utils_test_flag(conference, CFLAG_DESTRUCT)) { + switch_time_t now = switch_epoch_time_now(NULL); switch_size_t file_sample_len = samples; switch_size_t file_data_len = samples * 2 * conference->channels; int has_file_data = 0, members_with_video = 0, members_with_avatar = 0, members_seeing_video = 0; @@ -257,6 +259,15 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob floor_holder = conference->floor_holder; + if (conference->heartbeat_period_sec > 0 && (now - last_heartbeat_time) >= conference->heartbeat_period_sec) { + switch_event_t *heartbeat_event = NULL; + last_heartbeat_time = now; + switch_event_create_subclass(&heartbeat_event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); + conference_event_add_data(conference, heartbeat_event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "conference-heartbeat"); + switch_event_fire(&heartbeat_event); + } + for (imember = conference->members; imember; imember = imember->next) { if (!zstr(imember->text_framedata)) { switch_frame_t frame = { 0 }; @@ -2767,6 +2778,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co char *scale_h264_canvas_bandwidth = NULL; char *video_codec_config_profile_name = NULL; int tmp; + int heartbeat_period_sec = 0; /* Validate the conference name */ if (zstr(name)) { @@ -3130,6 +3142,8 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co scale_h264_canvas_bandwidth = val; } else if (!strcasecmp(var, "video-codec-config-profile-name") && !zstr(val)) { video_codec_config_profile_name = val; + } else if (!strcasecmp(var, "heartbeat-period-sec") && !zstr(val)) { + heartbeat_period_sec = atoi(val); } } @@ -3649,6 +3663,10 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co conference->verbose_events = 1; } + if (heartbeat_period_sec >= 20 || heartbeat_period_sec == 0) { + conference->heartbeat_period_sec = heartbeat_period_sec; + } + /* Create the conference unique identifier */ switch_uuid_get(&uuid); switch_uuid_format(uuid_str, &uuid); diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index f63838ecf6..a5e5c1f0e8 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -761,6 +761,7 @@ typedef struct conference_obj { char *default_layout_name; int mux_paused; char *video_codec_config_profile_name; + int heartbeat_period_sec; } conference_obj_t; /* Relationship with another member */ From 28e7353769b486c5b936bd6262ab0fa88290f514 Mon Sep 17 00:00:00 2001 From: surendrasignalwire <56929670+surendrasignalwire@users.noreply.github.com> Date: Tue, 28 Apr 2020 21:39:19 +0530 Subject: [PATCH 248/655] [mod_sofia] Adding custom header to refer --- src/mod/endpoints/mod_sofia/sofia.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 293199f07a..3682bc454a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8871,7 +8871,7 @@ nua_handle_t *sofia_global_nua_handle_by_replaces(sip_replaces_t *replaces) } -static switch_status_t sofia_process_proxy_refer(switch_core_session_t *session, const char *refer_to) +static switch_status_t sofia_process_proxy_refer(switch_core_session_t *session, const char *refer_to, sip_t const *sip) { switch_core_session_t *other_session; private_object_t *tech_pvt = switch_core_session_get_private(session); @@ -8880,6 +8880,7 @@ static switch_status_t sofia_process_proxy_refer(switch_core_session_t *session, switch_core_session_message_t *msg; tech_pvt->proxy_refer_uuid = switch_core_session_strdup(session, switch_core_session_get_uuid(other_session)); + sofia_glue_set_extra_headers(other_session, sip, SOFIA_SIP_HEADER_PREFIX); msg = switch_core_session_alloc(other_session, sizeof(*msg)); MESSAGE_STAMP_FFL(msg); msg->message_id = SWITCH_MESSAGE_INDICATE_DEFLECT; @@ -8931,7 +8932,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t } if (full_ref_to && sofia_test_pflag(profile, PFLAG_PROXY_REFER)) { - if (sofia_process_proxy_refer(session, full_ref_to) == SWITCH_STATUS_SUCCESS) { + if (sofia_process_proxy_refer(session, full_ref_to, sip) == SWITCH_STATUS_SUCCESS) { if (tech_pvt->proxy_refer_msg) { msg_ref_destroy(tech_pvt->proxy_refer_msg); tech_pvt->proxy_refer_msg = NULL; From 885c05f01b37763355cc83818d8d2ba3f20c405a Mon Sep 17 00:00:00 2001 From: phonecomwire <62449660+phonecomwire@users.noreply.github.com> Date: Fri, 24 Apr 2020 15:39:27 -0700 Subject: [PATCH 249/655] [mod_fifo] adding 'noans' and 'early' call status options and dtmf '0' disable config settings option --- src/mod/applications/mod_fifo/mod_fifo.c | 139 +++++++++++++---------- 1 file changed, 78 insertions(+), 61 deletions(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 0f9d1b299d..724d1dd24f 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -458,62 +458,6 @@ static int sql2str_callback(void *pArg, int argc, char **argv, char **columnName return 0; } -/*!\brief Handler for consumer DTMF - * - * When `fifo_consumer_exit_key` is pressed by the consumer we hangup - * on the caller (unless we've put the caller on hold). The default - * exit key is '*'. - * - * When the consumer presses '0' we put both legs on hold and play - * hold music as follows. To the caller we play `fifo_music` or the - * default hold music for the channel. To the consumer we play - * `fifo_hold_music`, or `fifo_music`, or the default hold music for - * the channel. The consumer can press '0' again to pick up the - * caller from hold. - */ -static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) -{ - switch_core_session_t *bleg = (switch_core_session_t *) buf; - - switch (itype) { - case SWITCH_INPUT_TYPE_DTMF: - { - switch_dtmf_t *dtmf = (switch_dtmf_t *) input; - switch_channel_t *bchan = switch_core_session_get_channel(bleg); - switch_channel_t *channel = switch_core_session_get_channel(session); - - if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_BRIDGE_ORIGINATOR)) { - const char *consumer_exit_key = switch_channel_get_variable(channel, "fifo_consumer_exit_key"); - if (!consumer_exit_key) consumer_exit_key = "*"; - if (dtmf->digit == *consumer_exit_key) { - switch_channel_hangup(bchan, SWITCH_CAUSE_NORMAL_CLEARING); - return SWITCH_STATUS_BREAK; - } else if (dtmf->digit == '0') { - const char *moh_a = NULL, *moh_b = NULL; - - if (!(moh_b = switch_channel_get_variable(bchan, "fifo_music"))) { - moh_b = switch_channel_get_hold_music(bchan); - } - - if (!(moh_a = switch_channel_get_variable(channel, "fifo_hold_music"))) { - if (!(moh_a = switch_channel_get_variable(channel, "fifo_music"))) { - moh_a = switch_channel_get_hold_music(channel); - } - } - - switch_ivr_soft_hold(session, "0", moh_a, moh_b); - return SWITCH_STATUS_IGNORE; - } - } - } - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - /*!\brief Handler for caller DTMF * * The channel variable `fifo_caller_exit_key` can be set to one or @@ -723,8 +667,66 @@ static struct { int allow_transcoding; switch_bool_t delete_all_members_on_startup; outbound_strategy_t default_strategy; + int disable_dtmf_moh_key; } globals; + +/*!\brief Handler for consumer DTMF + * + * When `fifo_consumer_exit_key` is pressed by the consumer we hangup + * on the caller (unless we've put the caller on hold). The default + * exit key is '*'. + * + * When the consumer presses '0' we put both legs on hold and play + * hold music as follows. To the caller we play `fifo_music` or the + * default hold music for the channel. To the consumer we play + * `fifo_hold_music`, or `fifo_music`, or the default hold music for + * the channel. The consumer can press '0' again to pick up the + * caller from hold. + */ +static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) +{ + switch_core_session_t *bleg = (switch_core_session_t *) buf; + + switch (itype) { + case SWITCH_INPUT_TYPE_DTMF: + { + switch_dtmf_t *dtmf = (switch_dtmf_t *) input; + switch_channel_t *bchan = switch_core_session_get_channel(bleg); + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_BRIDGE_ORIGINATOR)) { + const char *consumer_exit_key = switch_channel_get_variable(channel, "fifo_consumer_exit_key"); + if (!consumer_exit_key) consumer_exit_key = "*"; + if (dtmf->digit == *consumer_exit_key) { + switch_channel_hangup(bchan, SWITCH_CAUSE_NORMAL_CLEARING); + return SWITCH_STATUS_BREAK; + } else if (dtmf->digit == '0' && !globals.disable_dtmf_moh_key) { + const char *moh_a = NULL, *moh_b = NULL; + + if (!(moh_b = switch_channel_get_variable(bchan, "fifo_music"))) { + moh_b = switch_channel_get_hold_music(bchan); + } + + if (!(moh_a = switch_channel_get_variable(channel, "fifo_hold_music"))) { + if (!(moh_a = switch_channel_get_variable(channel, "fifo_music"))) { + moh_a = switch_channel_get_hold_music(channel); + } + } + + switch_ivr_soft_hold(session, "0", moh_a, moh_b); + return SWITCH_STATUS_IGNORE; + } + } + } + break; + default: + break; + } + + return SWITCH_STATUS_SUCCESS; +} + static int fifo_dec_use_count(const char *outbound_id) { int r = 0, *count; @@ -2550,7 +2552,7 @@ typedef enum { #define MAX_NODES_PER_CONSUMER 25 #define FIFO_DESC "Fifo for stacking parked calls." -#define FIFO_USAGE "<fifo name>[!<importance_number>] [in [<announce file>|undef] [<music file>|undef] | out [wait|nowait] [<announce file>|undef] [<music file>|undef]]" +#define FIFO_USAGE "<fifo name>[!<importance_number>] [in [<announce file>|undef] [<music file>|undef] [early|noans] | out [wait|nowait] [<announce file>|undef] [<music file>|undef]]" SWITCH_STANDARD_APP(fifo_function) { int argc; @@ -2568,7 +2570,7 @@ SWITCH_STANDARD_APP(fifo_function) char *list_string; int nlist_count; char *nlist[MAX_NODES_PER_CONSUMER]; - int consumer = 0, in_table = 0; + int consumer = 0, in_table = 0, answer = 0; const char *arg_fifo_name = NULL; const char *arg_inout = NULL; const char *serviced_uuid = NULL; @@ -2658,6 +2660,13 @@ SWITCH_STANDARD_APP(fifo_function) if (argc > 3) { moh = argv[3]; } + if (argc > 4) { + if (!strcasecmp(argv[4], "noans")) { + answer = 1; + } else if (!strcasecmp(argv[4], "early")) { + answer = 2; + } + } } if (moh && !strcasecmp(moh, "silence")) { @@ -2714,7 +2723,9 @@ SWITCH_STANDARD_APP(fifo_function) } } - switch_channel_answer(channel); + if (answer == 0) { + switch_channel_answer(channel); + } switch_mutex_lock(node->update_mutex); @@ -2965,7 +2976,9 @@ SWITCH_STANDARD_APP(fifo_function) switch_core_hash_insert(node->consumer_hash, switch_core_session_get_uuid(session), session); switch_mutex_unlock(node->mutex); } - switch_channel_answer(channel); + if( answer == 0 ) { + switch_channel_answer(channel); + } } if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { @@ -3295,7 +3308,9 @@ SWITCH_STANDARD_APP(fifo_function) break; } - switch_channel_answer(channel); + if (answer == 0 || answer == 2) { + switch_channel_answer(channel); + } if (switch_channel_inbound_display(other_channel)) { if (switch_channel_direction(other_channel) == SWITCH_CALL_DIRECTION_INBOUND) { @@ -4405,6 +4420,8 @@ static switch_status_t read_config_file(switch_xml_t *xml, switch_xml_t *cfg) { globals.inner_post_trans_execute = switch_core_strdup(globals.pool, val); } else if (!strcasecmp(var, "delete-all-outbound-member-on-startup")) { globals.delete_all_members_on_startup = switch_true(val); + } else if (!strcasecmp(var, "disable-dtmf-moh-key") && !zstr(val)) { + globals.disable_dtmf_moh_key = switch_true(val); } } } From 53807da088d10c474c75663f4a86c450fe0c2e44 Mon Sep 17 00:00:00 2001 From: Ken <krice@tollfreegateway.com> Date: Tue, 28 Apr 2020 16:23:07 -0500 Subject: [PATCH 250/655] [mod_sofia] Include isup-oli parameter on outbound invite when we have value in caller profile --- src/mod/endpoints/mod_sofia/sofia_glue.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index c00c439600..074e233aee 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1202,10 +1202,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (!zstr(invite_domain)) { sipip = invite_domain; } - - format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s]>" : "\"%s\" <sip:%s%s%s>"; - - tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, format, cid_name, use_cid_num, !zstr(cid_num) ? "@" : "", sipip); + + if (zstr(tech_pvt->caller_profile->aniii)){ + format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s]>" : "\"%s\" <sip:%s%s%s>"; + tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, format, cid_name, use_cid_num, !zstr(cid_num) ? "@" : "", sipip); + } else { + format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s];isup-oli=%s>" : "\"%s\" <sip:%s%s%s;isup-oli=%s>"; + tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, format, cid_name, use_cid_num, !zstr(cid_num) ? "@" : "", + sipip, tech_pvt->caller_profile->aniii); + } } if (from_var) { From d1d777df6cb68389d67638a0a2beb8a202321e70 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Wed, 6 May 2020 11:46:57 -0400 Subject: [PATCH 251/655] [core] add SCSC_SHUTDOWN_CAUSE --- src/include/private/switch_core_pvt.h | 1 + src/include/switch_types.h | 3 ++- src/switch_core.c | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 388813701f..a69c3173cc 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -305,6 +305,7 @@ struct switch_runtime { uint32_t port_alloc_flags; char *event_channel_key_separator; uint32_t max_audio_channels; + switch_call_cause_t shutdown_cause; }; extern struct switch_runtime runtime; diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 4757ed1c3a..7217a207a4 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -2292,7 +2292,8 @@ typedef enum { SCSC_SPS_PEAK_FIVEMIN, SCSC_SESSIONS_PEAK, SCSC_SESSIONS_PEAK_FIVEMIN, - SCSC_MDNS_RESOLVE + SCSC_MDNS_RESOLVE, + SCSC_SHUTDOWN_CAUSE } switch_session_ctl_t; typedef enum { diff --git a/src/switch_core.c b/src/switch_core.c index 81b6de762b..c3ddc5124e 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1857,6 +1857,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc memset(&runtime, 0, sizeof(runtime)); gethostname(runtime.hostname, sizeof(runtime.hostname)); + runtime.shutdown_cause = SWITCH_CAUSE_SYSTEM_SHUTDOWN; runtime.max_db_handles = 50; runtime.db_handle_timeout = 5000000; runtime.event_heartbeat_interval = 20; @@ -3013,6 +3014,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void * case SCSC_MDNS_RESOLVE: switch_core_media_set_resolveice(!!oldintval); break; + case SCSC_SHUTDOWN_CAUSE: + runtime.shutdown_cause = oldintval; + break; } if (intval) { @@ -3068,7 +3072,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void) switch_set_flag((&runtime), SCF_SHUTTING_DOWN); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n"); - switch_core_session_hupall(SWITCH_CAUSE_SYSTEM_SHUTDOWN); + switch_core_session_hupall(runtime.shutdown_cause); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n"); switch_loadable_module_shutdown(); From 01b92f00bbb7b911c4666a9e2fb0088f3965ed80 Mon Sep 17 00:00:00 2001 From: Seven Du <seven@signalwire.com> Date: Wed, 13 May 2020 02:56:30 +0800 Subject: [PATCH 252/655] [core] add peer uuid to originate log --- src/switch_ivr_originate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 698b7425ea..627f43ead6 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3889,8 +3889,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", - switch_channel_get_name(peer_channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s] Peer UUID: %s\n", + switch_channel_get_name(peer_channel), switch_channel_get_uuid(peer_channel)); *cause = SWITCH_CAUSE_SUCCESS; } else { From ec7ec190b03a8d9dc24cda189d358044e430c88c Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 12 May 2020 19:30:48 +0400 Subject: [PATCH 253/655] [mod_sofia] Add TLS v1.3 support. --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 1ffd39dc6e..9a739088df 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -461,6 +461,7 @@ typedef enum { SOFIA_TLS_VERSION_TLSv1 = (1 << 2), SOFIA_TLS_VERSION_TLSv1_1 = (1 << 3), SOFIA_TLS_VERSION_TLSv1_2 = (1 << 4), + SOFIA_TLS_VERSION_TLSv1_3 = (1 << 5), } sofia_tls_version_t; typedef enum { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 3682bc454a..bcf72e2b7d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4633,6 +4633,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) profile->tls_version = SOFIA_TLS_VERSION_TLSv1; profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_1; profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_2; + profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_3; profile->tls_timeout = 300; profile->mflags = MFLAG_REFER | MFLAG_REGISTER; profile->server_rport_level = 1; @@ -5878,6 +5879,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_1; if (n==7 && !strncasecmp(ps, "tlsv1.2", n)) profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_2; + if (n==7 && !strncasecmp(ps, "tlsv1.3", n)) + profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_3; ps=pe+1; } } else if (!strcasecmp(var, "tls-timeout") && !zstr(val)) { From 6a2661b608671e2a00e52862afad695f24fdf2fe Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Wed, 13 May 2020 17:36:11 -0400 Subject: [PATCH 254/655] [mod_conference] Members are searchable by var in more APIs --- .../mod_conference/conference_api.c | 53 +++++++++---------- .../mod_conference/conference_member.c | 26 +++++++++ .../mod_conference/mod_conference.h | 1 + 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index ee74f2a371..fd51d294cb 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -138,17 +138,17 @@ switch_status_t conference_api_sub_pause_play(conference_obj_t *conference, swit } if (argc == 3) { - uint32_t id = atoi(argv[2]); + const char * id = argv[2]; conference_member_t *member; - if ((member = conference_member_get(conference, id))) { + if ((member = conference_member_get_by_str(conference, id))) { switch_mutex_lock(member->fnode_mutex); conference_fnode_toggle_pause(member->fnode, stream); switch_mutex_unlock(member->fnode_mutex); switch_thread_rwlock_unlock(member->rwlock); return SWITCH_STATUS_SUCCESS; } else { - stream->write_function(stream, "-ERR Member: %u not found.\n", id); + stream->write_function(stream, "-ERR Member: %s not found.\n", id); } } @@ -166,17 +166,17 @@ switch_status_t conference_api_sub_play_status(conference_obj_t *conference, swi } if (argc == 3) { - uint32_t id = atoi(argv[2]); + const char *id = argv[2]; conference_member_t *member; - if ((member = conference_member_get(conference, id))) { + if ((member = conference_member_get_by_str(conference, id))) { switch_mutex_lock(member->fnode_mutex); conference_fnode_check_status(member->fnode, stream); switch_mutex_unlock(member->fnode_mutex); switch_thread_rwlock_unlock(member->rwlock); return SWITCH_STATUS_SUCCESS; } else { - stream->write_function(stream, "-ERR Member: %u not found.\n", id); + stream->write_function(stream, "-ERR Member: %s not found.\n", id); } } @@ -2518,7 +2518,6 @@ static void clear_role_id(conference_obj_t *conference, conference_member_t *mem switch_status_t conference_api_sub_vid_res_id(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { uint8_t all = 0, clear = 0, force = 0; - uint32_t member_id; char *res_id = NULL; conference_member_t *member; @@ -2538,7 +2537,7 @@ switch_status_t conference_api_sub_vid_res_id(conference_obj_t *conference, swit if (argc > 4) force = strcasecmp(argv[4], "force") ? 0 : 1; - if (!(member_id = atoi(argv[2]))) { + if (!atoi(argv[2])) { all = strcasecmp(argv[2], "all") ? 0 : 1; } @@ -2550,13 +2549,11 @@ switch_status_t conference_api_sub_vid_res_id(conference_obj_t *conference, swit } } switch_mutex_unlock(conference->member_mutex); - } else if (member_id) { - if (!(member = conference_member_get(conference, member_id))) + } else { + if (!(member = conference_member_get_by_str(conference, argv[2]))) return SWITCH_STATUS_GENERR; conference_api_sub_vid_res_id_member(member, stream, res_id, clear, force); switch_thread_rwlock_unlock(member->rwlock); - } else { - return SWITCH_STATUS_GENERR; } return SWITCH_STATUS_SUCCESS; @@ -2735,10 +2732,10 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc } if (argc == 4) { - uint32_t id = atoi(argv[3]); - conference_member_t *member = conference_member_get(conference, id); + const char *id = argv[3]; + conference_member_t *member = conference_member_get_by_str(conference, id); if (member == NULL) { - stream->write_function(stream, "-ERR Member: %u not found.\n", id); + stream->write_function(stream, "-ERR Member: %s not found.\n", id); return SWITCH_STATUS_GENERR; } @@ -2833,7 +2830,7 @@ switch_status_t conference_api_sub_play(conference_obj_t *conference, switch_str } ret_status = SWITCH_STATUS_SUCCESS; } else if (argc >= 4) { - uint32_t id = atoi(argv[3]); + const char *id = argv[3]; conference_member_t *member; switch_bool_t mux = SWITCH_TRUE; @@ -2841,9 +2838,9 @@ switch_status_t conference_api_sub_play(conference_obj_t *conference, switch_str mux = SWITCH_FALSE; } - if ((member = conference_member_get(conference, id))) { + if ((member = conference_member_get_by_str(conference, id))) { if (conference_member_play_file(member, argv[2], 0, mux) == SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "+OK (play) Playing file %s to member %u\n", argv[2], id); + stream->write_function(stream, "+OK (play) Playing file %s to member %u\n", argv[2], member->id); if (test_eflag(conference, EFLAG_PLAY_FILE_MEMBER) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { conference_member_add_event_data(member, event); @@ -2899,7 +2896,7 @@ switch_status_t conference_api_sub_saymember(conference_obj_t *conference, switc char *expanded = NULL; char *start_text = NULL; char *workspace = NULL; - uint32_t id = 0; + const char *id = NULL; conference_member_t *member = NULL; switch_event_t *event; @@ -2918,15 +2915,15 @@ switch_status_t conference_api_sub_saymember(conference_obj_t *conference, switc text = start_text; } - id = atoi(workspace); + id = workspace; if (!id || zstr(text)) { stream->write_function(stream, "-ERR (saymember) No Text!\n"); goto done; } - if (!(member = conference_member_get(conference, id))) { - stream->write_function(stream, "-ERR (saymember) Unknown Member %u!\n", id); + if (!(member = conference_member_get_by_str(conference, id))) { + stream->write_function(stream, "-ERR (saymember) Unknown Member %s!\n", id); goto done; } @@ -3236,15 +3233,15 @@ switch_status_t conference_api_sub_stop(conference_obj_t *conference, switch_str return SWITCH_STATUS_GENERR; if (argc == 4) { - uint32_t id = atoi(argv[3]); + const char *id = argv[3]; conference_member_t *member; - if ((member = conference_member_get(conference, id))) { + if ((member = conference_member_get_by_str(conference, id))) { uint32_t stopped = conference_member_stop_file(member, async ? FILE_STOP_ASYNC : current ? FILE_STOP_CURRENT : FILE_STOP_ALL); stream->write_function(stream, "+OK Stopped %u files.\n", stopped); switch_thread_rwlock_unlock(member->rwlock); } else { - stream->write_function(stream, "-ERR Member: %u not found.\n", id); + stream->write_function(stream, "-ERR Member: %s not found.\n", id); } } else { uint32_t stopped = conference_file_stop(conference, async ? FILE_STOP_ASYNC : current ? FILE_STOP_CURRENT : FILE_STOP_ALL); @@ -3659,13 +3656,13 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch for (x = 3; x < argc; x++) { conference_member_t *member = NULL; - uint32_t id = atoi(argv[x]); + const char *id = argv[x]; switch_channel_t *channel; switch_event_t *event; char *xdest = NULL; - if (!id || !(member = conference_member_get(conference, id))) { - stream->write_function(stream, "-ERR No Member %u in conference %s.\n", id, conference->name); + if (!id || !(member = conference_member_get_by_str(conference, id))) { + stream->write_function(stream, "-ERR No Member %s in conference %s.\n", id, conference->name); continue; } diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index 4eebd7a37e..74264b0677 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -442,6 +442,32 @@ conference_member_t *conference_member_get_by_var(conference_obj_t *conference, return member; } +/* traverse the conference member list for the specified member id or variable and return its pointer */ +conference_member_t *conference_member_get_by_str(conference_obj_t *conference, const char *id_str) +{ + conference_member_t *member = NULL; + + switch_assert(conference != NULL); + if (!id_str) { + return NULL; + } + if (strchr(id_str, '=')) { + char *var, *val; + + var = strdup(id_str); + switch_assert(var); + + if ((val = strchr(var, '='))) { + *val++ = '\0'; + } + member = conference_member_get_by_var(conference, var, val); + free(var); + } else { + member = conference_member_get(conference, atoi(id_str)); + } + return member; +} + /* traverse the conference member list for the specified member with role and return it's pointer */ conference_member_t *conference_member_get_by_role(conference_obj_t *conference, const char *role_id) diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index a5e5c1f0e8..e44d9589b6 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -1099,6 +1099,7 @@ void conference_member_set_score_iir(conference_member_t *member, uint32_t score conference_relationship_t *conference_member_add_relationship(conference_member_t *member, uint32_t id); conference_member_t *conference_member_get(conference_obj_t *conference, uint32_t id); +conference_member_t *conference_member_get_by_str(conference_obj_t *conference, const char *id_str); conference_member_t *conference_member_get_by_var(conference_obj_t *conference, const char *var, const char *val); conference_member_t *conference_member_get_by_role(conference_obj_t *conference, const char *role_id); switch_status_t conference_member_del_relationship(conference_member_t *member, uint32_t id); From 6fb9a69fca68229a7c4241f652afe2f62c155333 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Wed, 20 May 2020 02:20:22 +0000 Subject: [PATCH 255/655] [core] Remove 255 byte limit to core ASR param stored in module name --- src/switch_core_asr.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c index 6f63302042..dd0df4302e 100644 --- a/src/switch_core_asr.c +++ b/src/switch_core_asr.c @@ -42,14 +42,22 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool) { switch_status_t status; - char buf[256] = ""; + char *module_name_dup = NULL; char *param = NULL; + int free_pool = 0; + + if (!pool) { + if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) { + return status; + } + free_pool = 1; + } if (strchr(module_name, ':')) { - switch_set_string(buf, module_name); - if ((param = strchr(buf, ':'))) { + module_name_dup = switch_core_strdup(pool, module_name); + if ((param = strchr(module_name_dup, ':'))) { *param++ = '\0'; - module_name = buf; + module_name = module_name_dup; } } @@ -57,23 +65,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah, if ((ah->asr_interface = switch_loadable_module_get_asr_interface(module_name)) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ASR module [%s]!\n", module_name); + if (free_pool) { + switch_core_destroy_memory_pool(&pool); + } return SWITCH_STATUS_GENERR; } ah->flags = *flags; - if (pool) { - ah->memory_pool = pool; - } else { - if ((status = switch_core_new_memory_pool(&ah->memory_pool)) != SWITCH_STATUS_SUCCESS) { - UNPROTECT_INTERFACE(ah->asr_interface); - return status; - } + ah->memory_pool = pool; + if (free_pool) { switch_set_flag(ah, SWITCH_ASR_FLAG_FREE_POOL); } - if (param) { - ah->param = switch_core_strdup(ah->memory_pool, param); + ah->param = param; } ah->rate = rate; ah->name = switch_core_strdup(ah->memory_pool, module_name); @@ -83,6 +88,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah, status = ah->asr_interface->asr_open(ah, codec, rate, dest, flags); if (status != SWITCH_STATUS_SUCCESS) { + if (switch_test_flag(ah, SWITCH_ASR_FLAG_FREE_POOL)) { + switch_core_destroy_memory_pool(&ah->memory_pool); + } UNPROTECT_INTERFACE(ah->asr_interface); } From 2c7f97a6063a295eee1600662f663f379ffeb1d8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sat, 25 Apr 2020 01:35:59 +0000 Subject: [PATCH 256/655] [mod_verto] allow vars from dp to pass to verto dialog --- src/include/switch_channel.h | 2 +- src/mod/endpoints/mod_verto/mod_verto.c | 31 +++++++++++++++++++++---- src/switch_channel.c | 23 ++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 6692ceaa7f..965575e783 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -326,7 +326,7 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *c #define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE, -1) SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event); - +SWITCH_DECLARE(switch_status_t) switch_channel_get_variables_prefix(switch_channel_t *channel, const char *prefix, switch_event_t **event); SWITCH_DECLARE(switch_status_t) switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel); static inline int switch_channel_var_false(switch_channel_t *channel, const char *variable) { diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 06cb6c7652..e12cc99677 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1194,6 +1194,22 @@ static int attach_wake(void) return 0; } +static void add_variables(verto_pvt_t *tech_pvt, cJSON *params) +{ + cJSON *jvariables = NULL; + switch_event_header_t *hi; + switch_event_t *variables; + + jvariables = cJSON_CreateObject(); + switch_channel_get_variables_prefix(tech_pvt->channel, "verto_svar_", &variables); + for (hi = variables->headers; hi; hi = hi->next) { + cJSON_AddItemToObject(jvariables, hi->name, cJSON_CreateString(hi->value)); + } + cJSON_AddItemToObject(params, "variables", jvariables); + switch_event_destroy(&variables); +} + + static void tech_reattach(verto_pvt_t *tech_pvt, jsock_t *jsock) { cJSON *params = NULL; @@ -1205,6 +1221,8 @@ static void tech_reattach(verto_pvt_t *tech_pvt, jsock_t *jsock) switch_set_flag(tech_pvt, TFLAG_ATTACH_REQ); msg = jrpc_new_req("verto.attach", tech_pvt->call_id, &params); + add_variables(tech_pvt, params); + switch_channel_set_flag(tech_pvt->channel, CF_REINVITE); switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING); switch_core_media_gen_local_sdp(tech_pvt->session, SDP_TYPE_REQUEST, NULL, 0, NULL, 0); @@ -2206,7 +2224,7 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char switch_status_t status = SWITCH_STATUS_SUCCESS; jsock_t *jsock = NULL; verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); - + if (!(jsock = get_jsock(tech_pvt->jsock_uuid))) { status = SWITCH_STATUS_BREAK; } else { @@ -2214,7 +2232,7 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char cJSON *msg = NULL; const char *var = NULL; switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(tech_pvt->channel); - switch_event_header_t *hp; + switch_event_header_t *hi; //DUMP_EVENT(jsock->params); @@ -2224,8 +2242,8 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char switch_channel_set_variable(tech_pvt->channel, "chat_proto", VERTO_CHAT_PROTO); switch_channel_set_variable(tech_pvt->channel, "verto_host", jsock->domain); - for (hp = jsock->user_vars->headers; hp; hp = hp->next) { - switch_channel_set_variable(tech_pvt->channel, hp->name, hp->value); + for (hi = jsock->user_vars->headers; hi; hi = hi->next) { + switch_channel_set_variable(tech_pvt->channel, hi->name, hi->value); } if ((var = switch_event_get_header(jsock->params, "caller-id-name"))) { @@ -2267,6 +2285,8 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char msg = jrpc_new_req(method, tech_pvt->call_id, &params); + add_variables(tech_pvt, params); + if (tech_pvt->mparams->local_sdp_str) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local %s SDP %s:\n%s\n", method, @@ -2551,10 +2571,13 @@ static switch_status_t verto_send_media_indication(switch_core_session_t *sessio } else { cJSON *params = NULL; cJSON *msg = jrpc_new_req(method, tech_pvt->call_id, &params); + if (!switch_test_flag(tech_pvt, TFLAG_SENT_MEDIA)) { cJSON_AddItemToObject(params, "sdp", cJSON_CreateString(tech_pvt->mparams->local_sdp_str)); } + add_variables(tech_pvt, params); + switch_set_flag(tech_pvt, TFLAG_SENT_MEDIA); if (jsock_queue_event(jsock, &msg, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { diff --git a/src/switch_channel.c b/src/switch_channel.c index 8aa36aec88..d2b10ed15d 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -4457,6 +4457,29 @@ SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *c return status; } +SWITCH_DECLARE(switch_status_t) switch_channel_get_variables_prefix(switch_channel_t *channel, const char *prefix, switch_event_t **event) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_event_t *vars; + + switch_event_create(&vars, SWITCH_EVENT_CHANNEL_DATA); + + switch_mutex_lock(channel->profile_mutex); + if (channel->variables) { + switch_event_header_t *hi; + + for (hi = channel->variables->headers; hi; hi = hi->next) { + if (!strncmp(hi->name, prefix, strlen(prefix))) { + switch_event_add_header_string(vars, SWITCH_STACK_BOTTOM, hi->name, hi->value); + } + } + } + switch_mutex_unlock(channel->profile_mutex); + + *event = vars; + return status; +} + SWITCH_DECLARE(switch_core_session_t *) switch_channel_get_session(switch_channel_t *channel) { switch_assert(channel); From efff71f2f066ad1af45f3eaf0d853871575144a2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Tue, 11 Jun 2019 19:22:43 +0000 Subject: [PATCH 257/655] [core] add switch_thread_pool_wait --- src/include/switch_core.h | 4 +++- src/switch_core_session.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index a0c91ec6fd..263c1f7ff7 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -67,6 +67,7 @@ typedef struct switch_thread_data_s { switch_thread_start_t func; void *obj; int alloc; + int running; switch_memory_pool_t *pool; } switch_thread_data_t; @@ -851,7 +852,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(_In_ switch_co SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_data_t **tdp); SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session); - +SWITCH_DECLARE(switch_status_t) switch_thread_pool_wait(switch_thread_data_t *td, int ms); + /*! \brief Retrieve a pointer to the channel object associated with a given session \param session the session to retrieve from diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 323adfc482..2258824159 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1779,8 +1779,10 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_worker(switch_th #ifdef DEBUG_THREAD_POOL switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Processing\n", (long) (intptr_t) thread); #endif + td->running = 1; td->func(thread, td->obj); - + td->running = 0; + if (td->pool) { switch_memory_pool_t *pool = td->pool; td = NULL; @@ -1896,6 +1898,15 @@ SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_d return status; } +SWITCH_DECLARE(switch_status_t) switch_thread_pool_wait(switch_thread_data_t *td, int ms) +{ + while(!td->running && --ms > 0) { + switch_cond_next(); + } + + return ms > 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_TIMEOUT; +} + SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session) { switch_status_t status = SWITCH_STATUS_INUSE; @@ -1920,7 +1931,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_co return status; } - SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_session_t *session) { switch_status_t status = SWITCH_STATUS_FALSE; From ffbe8500ec7f6f42280036a849a0b174b702f9a6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Tue, 1 Oct 2019 20:30:29 +0000 Subject: [PATCH 258/655] [core] add new function to theorize the dimensions of an image if it were to be resizedto fit inside another image --- src/include/switch_core_video.h | 1 + src/switch_core_video.c | 60 ++++++++++++++++++++------------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/include/switch_core_video.h b/src/include/switch_core_video.h index e152922675..340d1fa30a 100644 --- a/src/include/switch_core_video.h +++ b/src/include/switch_core_video.h @@ -410,6 +410,7 @@ SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img SWITCH_DECLARE(switch_status_t) switch_img_mirror(switch_image_t *src, switch_image_t **destP); SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_image_t **destP, int width, int height); SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width, int height, switch_img_fit_t fit); +SWITCH_DECLARE(void) switch_img_calc_fit(switch_image_t *src, int width, int height, int *new_wP, int *new_hP); SWITCH_DECLARE(switch_img_position_t) parse_img_position(const char *name); SWITCH_DECLARE(switch_img_fit_t) parse_img_fit(const char *name); SWITCH_DECLARE(void) switch_img_find_position(switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP); diff --git a/src/switch_core_video.c b/src/switch_core_video.c index e486a22702..1b39ce46a3 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -1872,7 +1872,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_txt_handle_create(switch_img_txt_hand new_handle->free_pool = free_pool; if (zstr(font_family)) { - font_family = switch_core_sprintf(new_handle->pool, "%s%s%s",SWITCH_GLOBAL_dirs.fonts_dir, SWITCH_PATH_SEPARATOR, "FreeMono.ttf"); + font_family = switch_core_sprintf(new_handle->pool, "%s%s%s",SWITCH_GLOBAL_dirs.fonts_dir, SWITCH_PATH_SEPARATOR, "FreeSans.ttf"); } if (!switch_is_file_path(font_family)) { @@ -3110,31 +3110,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width, int height, switch_img_fit_t fit) +SWITCH_DECLARE(void) switch_img_calc_fit(switch_image_t *src, int width, int height, int *new_wP, int *new_hP) { - switch_image_t *src, *tmp = NULL; - int new_w = 0, new_h = 0; - - switch_assert(srcP); - switch_assert(width && height); - - src = *srcP; - - if (!src || (src->d_w == width && src->d_h == height)) { - return SWITCH_STATUS_SUCCESS; - } - - if (fit == SWITCH_FIT_NECESSARY && src->d_w <= width && src->d_h < height) { - return SWITCH_STATUS_SUCCESS; - } - - if (fit == SWITCH_FIT_SCALE) { - switch_img_scale(src, &tmp, width, height); - switch_img_free(&src); - *srcP = tmp; - return SWITCH_STATUS_SUCCESS; - } + int new_w, new_h; + switch_assert(src); + new_w = src->d_w; new_h = src->d_h; @@ -3163,6 +3144,37 @@ SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width, } } + *new_wP = new_w; + *new_hP = new_h; +} + +SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width, int height, switch_img_fit_t fit) +{ + switch_image_t *src, *tmp = NULL; + int new_w = 0, new_h = 0; + + switch_assert(srcP); + switch_assert(width && height); + + src = *srcP; + + if (!src || (src->d_w == width && src->d_h == height)) { + return SWITCH_STATUS_SUCCESS; + } + + if (fit == SWITCH_FIT_NECESSARY && src->d_w <= width && src->d_h < height) { + return SWITCH_STATUS_SUCCESS; + } + + if (fit == SWITCH_FIT_SCALE) { + switch_img_scale(src, &tmp, width, height); + switch_img_free(&src); + *srcP = tmp; + return SWITCH_STATUS_SUCCESS; + } + + switch_img_calc_fit(src, width, height, &new_w, &new_h); + if (new_w && new_h) { if (switch_img_scale(src, &tmp, new_w, new_h) == SWITCH_STATUS_SUCCESS) { switch_img_free(&src); From b18ea498df69483d3fef2fe9e1e7bfd435ffc775 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 10 Apr 2020 16:48:24 +0000 Subject: [PATCH 259/655] [core] add new prompt functionality to ask for pin over dialogbox --- src/include/switch_ivr.h | 3 ++- src/include/switch_types.h | 1 + src/mod/endpoints/mod_verto/mod_verto.c | 34 +++++++++++++++++++++++++ src/switch_core_session.c | 2 ++ src/switch_ivr.c | 16 ++++++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 09577152b4..318ce26214 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -1069,7 +1069,8 @@ SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var(switch_dial_handle_l SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var_printf(switch_dial_handle_list_t *hl, const char *var, const char *fmt, ...); SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_list_t *hl, switch_call_cause_t *cause); SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause); - +SWITCH_DECLARE(switch_status_t) switch_ivr_send_prompt(switch_core_session_t *session, const char *type, const char *text, const char *regex); + SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_session_t *session, const char *prompt, const char *recognizer_mod_name, diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 7217a207a4..69e87f4aff 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1173,6 +1173,7 @@ typedef enum { SWITCH_MESSAGE_RESAMPLE_EVENT, SWITCH_MESSAGE_HEARTBEAT_EVENT, SWITCH_MESSAGE_INDICATE_SESSION_ID, + SWITCH_MESSAGE_INDICATE_PROMPT, SWITCH_MESSAGE_INVALID } switch_core_session_message_types_t; diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index e12cc99677..230d0ff615 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -2623,6 +2623,40 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ } break; + case SWITCH_MESSAGE_INDICATE_PROMPT: + { + const char *type = NULL, *text = NULL, *regex = NULL; + cJSON *jmsg = NULL, *params = NULL; + jsock_t *jsock = NULL; + + if ((jsock = get_jsock(tech_pvt->jsock_uuid))) { + + type = msg->string_array_arg[0]; + text = msg->string_array_arg[1]; + regex = msg->string_array_arg[2]; + + if (type && (!strcasecmp(type, "dtmf") || !strcasecmp(type, "message")) && text) { + jmsg = jrpc_new_req("verto.prompt", tech_pvt->call_id, &params); + + cJSON_AddItemToObject(params, "type", cJSON_CreateString(type)); + cJSON_AddItemToObject(params, "text", cJSON_CreateString(text)); + + if (regex) { + cJSON_AddItemToObject(params, "regex", cJSON_CreateString(regex)); + } + + jsock_queue_event(jsock, &jmsg, SWITCH_TRUE); + + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Parsing Media Params\n"); + r = SWITCH_STATUS_FALSE; + } + + + switch_thread_rwlock_unlock(jsock->rwlock); + } + } + break; case SWITCH_MESSAGE_INDICATE_MEDIA_RENEG: { jsock_t *jsock = NULL; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 2258824159..4440da639d 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -827,6 +827,8 @@ static const char *message_names[] = { "RING_EVENT", "RESAMPLE_EVENT", "HEARTBEAT_EVENT", + "SESSION_ID", + "PROMPT", "INVALID" }; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 97bece7c36..ba292376f0 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1506,6 +1506,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess return status; } + +SWITCH_DECLARE(switch_status_t) switch_ivr_send_prompt(switch_core_session_t *session, const char *type, const char *text, const char *regex) +{ + switch_core_session_message_t msg = { 0 }; + + msg.message_id = SWITCH_MESSAGE_INDICATE_PROMPT; + msg.string_array_arg[0] = type; + msg.string_array_arg[1] = text; + msg.string_array_arg[2] = regex; + msg.from = __FILE__; + + switch_core_session_receive_message(session, &msg); + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, const char *message, switch_bool_t moh) { switch_core_session_message_t msg = { 0 }; From 96562bcc48183f04f06ba1da3f751c6c40996719 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@x-y-t.cn> Date: Sat, 25 Apr 2020 17:50:31 +0800 Subject: [PATCH 260/655] [core] add switch_img_read_png_from_memory --- src/include/switch_core_video.h | 1 + src/switch_core_video.c | 73 ++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 23 deletions(-) diff --git a/src/include/switch_core_video.h b/src/include/switch_core_video.h index 340d1fa30a..21e6b77414 100644 --- a/src/include/switch_core_video.h +++ b/src/include/switch_core_video.h @@ -390,6 +390,7 @@ SWITCH_DECLARE(void) switch_img_patch_hole(switch_image_t *IMG, switch_image_t * SWITCH_DECLARE(switch_status_t) switch_png_patch_img(switch_png_t *use_png, switch_image_t *img, int x, int y); SWITCH_DECLARE(switch_image_t *) switch_img_read_png(const char *file_name, switch_img_fmt_t img_fmt); +SWITCH_DECLARE(switch_image_t *) switch_img_read_png_from_memory(void *mem, size_t size, switch_img_fmt_t img_fmt); SWITCH_DECLARE(switch_status_t) switch_img_write_png(switch_image_t *img, char *file_name); SWITCH_DECLARE(switch_status_t) switch_png_open(switch_png_t **pngP, const char *file_name); SWITCH_DECLARE(void) switch_png_free(switch_png_t **pngP); diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 1b39ce46a3..e5b1688db7 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -2412,66 +2412,88 @@ SWITCH_DECLARE(switch_status_t) switch_png_patch_img(switch_png_t *use_png, swit #ifdef PNG_SIMPLIFIED_READ_SUPPORTED /* available from libpng 1.6.0 */ -SWITCH_DECLARE(switch_image_t *) switch_img_read_png(const char* file_name, switch_img_fmt_t img_fmt) +static switch_image_t *png2img(png_image *png, switch_img_fmt_t img_fmt) { - png_image png = { 0 }; png_bytep buffer = NULL; switch_image_t *img = NULL; - png.version = PNG_IMAGE_VERSION; - - if (!png_image_begin_read_from_file(&png, file_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error open png: %s\n", file_name); - goto err; - } + png->version = PNG_IMAGE_VERSION; if (img_fmt == SWITCH_IMG_FMT_I420) { - png.format = PNG_FORMAT_RGB; + png->format = PNG_FORMAT_RGB; } else if (img_fmt == SWITCH_IMG_FMT_ARGB) { #if SWITCH_BYTE_ORDER == __BIG_ENDIAN - png.format = PNG_FORMAT_ARGB; + png->format = PNG_FORMAT_ARGB; #else - png.format = PNG_FORMAT_BGRA; + png->format = PNG_FORMAT_BGRA; #endif } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unsupported image format: %x\n", img_fmt); goto err; } - buffer = malloc(PNG_IMAGE_SIZE(png)); + buffer = malloc(PNG_IMAGE_SIZE(*png)); switch_assert(buffer); - if (!png_image_finish_read(&png, NULL/*background*/, buffer, 0, NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error read png: %s\n", file_name); + if (!png_image_finish_read(png, NULL/*background*/, buffer, 0, NULL)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error read png\n"); goto err; } - if (png.width > SWITCH_IMG_MAX_WIDTH || png.height > SWITCH_IMG_MAX_HEIGHT) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PNG is too large! %dx%d\n", png.width, png.height); + if (png->width > SWITCH_IMG_MAX_WIDTH || png->height > SWITCH_IMG_MAX_HEIGHT) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PNG is too large! %dx%d\n", png->width, png->height); goto err; } - img = switch_img_alloc(NULL, img_fmt, png.width, png.height, 1); + img = switch_img_alloc(NULL, img_fmt, png->width, png->height, 1); switch_assert(img); if (img_fmt == SWITCH_IMG_FMT_I420) { - RAWToI420(buffer, png.width * 3, + RAWToI420(buffer, png->width * 3, img->planes[SWITCH_PLANE_Y], img->stride[SWITCH_PLANE_Y], img->planes[SWITCH_PLANE_U], img->stride[SWITCH_PLANE_U], img->planes[SWITCH_PLANE_V], img->stride[SWITCH_PLANE_V], - png.width, png.height); + png->width, png->height); } else if (img_fmt == SWITCH_IMG_FMT_ARGB){ - ARGBCopy(buffer, png.width * 4, - img->planes[SWITCH_PLANE_PACKED], png.width * 4, - png.width, png.height); + ARGBCopy(buffer, png->width * 4, + img->planes[SWITCH_PLANE_PACKED], png->width * 4, + png->width, png->height); } err: - png_image_free(&png); + png_image_free(png); switch_safe_free(buffer); return img; } +SWITCH_DECLARE(switch_image_t *) switch_img_read_png(const char* file_name, switch_img_fmt_t img_fmt) +{ + png_image png = { 0 }; + + png.version = PNG_IMAGE_VERSION; + + if (!png_image_begin_read_from_file(&png, file_name)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error open png: %s\n", file_name); + return NULL; + } + + return png2img(&png, img_fmt); +} + +SWITCH_DECLARE(switch_image_t *) switch_img_read_png_from_memory(void *mem, size_t size, switch_img_fmt_t img_fmt) +{ + png_image png = { 0 }; + + png.version = PNG_IMAGE_VERSION; + + if (!png_image_begin_read_from_memory(&png, mem, size)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error open png from memory\n"); + return NULL; + } + + return png2img(&png, img_fmt); +} + #else /* libpng < 1.6.0 */ // ref: most are out-dated, man libpng :) @@ -2734,6 +2756,11 @@ end: return img; } +SWITCH_DECLARE(switch_image_t *) switch_img_read_png_from_memory(void *mem, size_t size, switch_img_fmt_t img_fmt) +{ + return NULL; +} + #endif static void my_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) From 01ffc4493ca3430ecad7769cc2d9f2b862736f29 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Mon, 11 May 2020 22:44:32 +0800 Subject: [PATCH 261/655] [core] fix patch alpha on alpna image --- src/switch_core_video.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/switch_core_video.c b/src/switch_core_video.c index e5b1688db7..540edf0ae9 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -325,7 +325,7 @@ static void switch_img_patch_rgb_noalpha(switch_image_t *IMG, switch_image_t *im int max_w = MIN(img->d_w, IMG->d_w - abs(x)); int max_h = MIN(img->d_h, IMG->d_h - abs(y)); int j; - uint8_t alpha, alphadiff; + uint8_t alpha; switch_rgb_color_t *rgb, *RGB; for (i = 0; i < max_h; i++) { @@ -334,19 +334,27 @@ static void switch_img_patch_rgb_noalpha(switch_image_t *IMG, switch_image_t *im RGB = (switch_rgb_color_t *)(IMG->planes[SWITCH_PLANE_PACKED] + (y + i) * IMG->stride[SWITCH_PLANE_PACKED] + (x + j) * 4); alpha = rgb->a; - - if (RGB->a != 0) { + + if (RGB->a == 0) { + *RGB = *rgb; continue; } if (alpha == 255) { *RGB = *rgb; - } else if (alpha != 0) { - alphadiff = 255 - alpha; - RGB->a = 255; - RGB->r = ((RGB->r * alphadiff) + (rgb->r * alpha)) >> 8; - RGB->g = ((RGB->g * alphadiff) + (rgb->g * alpha)) >> 8; - RGB->b = ((RGB->b * alphadiff) + (rgb->b * alpha)) >> 8; + continue; + } + + if (alpha > 0) { + uint8_t delta1, delta2, delta; + + delta1 = 255 - RGB->a; + delta2 = 255 - rgb->a; + delta = (delta1 * delta2) >> 8; + RGB->r = ((RGB->r * RGB->a) + (rgb->r * rgb->a)) / (RGB->a + rgb->a); + RGB->g = ((RGB->g * RGB->a) + (rgb->g * rgb->a)) / (RGB->a + rgb->a); + RGB->b = ((RGB->b * RGB->a) + (rgb->b * rgb->a)) / (RGB->a + rgb->a); + RGB->a = 255 - delta; } } } @@ -394,7 +402,7 @@ SWITCH_DECLARE(void) switch_img_patch_rgb(switch_image_t *IMG, switch_image_t *i int height = MIN(img->d_h, IMG->d_h - abs(y)); void (*ARGBBlendRow)(const uint8_t* src_argb, const uint8_t* src_argb1, uint8_t* dst_argb, int width) = GetARGBBlend(); - switch_img_attenuate(img); + // switch_img_attenuate(img); // Coalesce rows. we have same size images, treat as a single row if (src_stride_argb0 == width * 4 && From 6761e8767e5dc5397676e78e008df717c415a576 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Mon, 11 May 2020 23:14:45 +0800 Subject: [PATCH 262/655] [core] and core video alpha patch test code --- conf/FreeMono.ttf | Bin 0 -> 592632 bytes tests/unit/images/banner.png | Bin 0 -> 36077 bytes tests/unit/images/signalwire.png | Bin 0 -> 6474 bytes tests/unit/switch_core_video.c | 119 ++++++++++++++++++++++++++++++- 4 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 conf/FreeMono.ttf create mode 100644 tests/unit/images/banner.png create mode 100644 tests/unit/images/signalwire.png diff --git a/conf/FreeMono.ttf b/conf/FreeMono.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c4200565a7c71b5cc833fd4668e0989ae838e090 GIT binary patch literal 592632 zcmeF)4_Kw++W7tR{@ZG%nQ2Uj$+S|M%rql}5JE->AvA=B5E?=VA$CSa2!k*PA!J(! zA$IIR?9e8JY@wN1wh+ebsG0Tqo~w0xdOG~s`+0xId%VZ-K92oyUHA3pyw3Z&?{%-W zGSe1AL^k1Hw)ht<Dm?huFLv2aqNnuJny`QFev9HhbV|hcVVQ{8v46p#M?`;BaH;rK zuN2v4&;5@$a-Xf1O?zH^{V5{RRfit2-42g!f6Azc(Zc+ala?;2Fc*FEoXEb}BGb1# z>HJE+x!PPVQb@NXoKkV>(iv^rJt%Tm5%Etxb;-FEGDjA$9>)@UYWany%p6E-7rD7q zqAplfcJh)^W1G5U;-}NUa~TchD>E87F6B6-Y-wfHF^x@E6U!&EcV_unCoS2#_NPJC zOW-(f>5{67nLqjNV0<0p{bw#&dUE+;OB%&DElp(87c0&>x3c-8d!~wS>!8TfXI7kZ zaz*j$&tE8VL?`2Ogl#fb?l$9%^#|^C!i?-6&ATnei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#R(X)(-#k~=~0iW<;cr1$hkB-Ung2dSVvo<uKvkdL+&|P=HevAV#XB?>q zW9-i;j_7Fw4H(acZlM@q85|c9<CspmGTtrsiS8sZnB4P8OuplgIOhIPgmmKd1_4im zT-yRjeuTi`d86kV*n`KSHIg`-C+NQMy|6p)JM@!t{U{jw7Oy=X<M$oRC-HgmakX<^ zU7x!aJXf5a?~sqT2m2HAqj&)2>TGBZyiMXr4xi1{0aSw#dABYw4n%7l^5nGMV|4z1 z`mxQ}o+z#(_P`$lNA^bSxA=TGFD_Uf+ezZH_OBuP@p}P@ajnJYKYn+{=R1kdlaKT< z(7fdR@H;TFIp$p$_e0|JxOo_PPj~B@ItagazdvtDpOE;he<J?J{PT3i#|7(*@<-5~ z6Ab+hG8W^00(T>uF~2>={<!@L?P=w(-@>o(KGT;^QNAyI)l|B###c)Pe09FBsgK<+ zxu`$-7JQ4;SH5q2|E9Wq>%MjBPkyiew^XnH_x`V_BmZ9%)uSqo;&|FYS0efXo<iTg zv*@dL5q<Bj!8gJbe6vNtS6d$VZi}L-fNBBP!`}@+%|I>i?>3-Lz}-N7Kyb>#_goZw z(M7>GT^{(Vi=w98Jr#F!V(wpqh+pJBLs$l3{4Rp!Vf5*KjK|{Lo!sNY{9Hn^2*$xk Z_p$WZu=@);_4Vc#|8f8R$KP|?{|lqW!MOkc literal 0 HcmV?d00001 diff --git a/tests/unit/images/banner.png b/tests/unit/images/banner.png new file mode 100644 index 0000000000000000000000000000000000000000..ea47062429c84c55158adf3b0dead0c902a45a17 GIT binary patch literal 36077 zcmcG#c|4ojw>aD$r?fS7MAgvNX;lrO1kvD}YB{Z<XbECW)ev)}5`wmhwuZD-Ly0Jg znx_Ua&#5uS#8gv65K}}-P+sTzz4v$T=kt5td;fZ$=krNc_Fil6wbxqD&Kmaf=Ap5H z;7Re5M~)m3y!ZDVvm-}%Xos-Hao)qvFK~mXBS(%py6NdXgzFjTd3$*Knfo}xobR|H zd^{Y{4^@vGx&9vJ;9z!7;re$+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1ffrZzqe=3iAvg)P{JE0?1P6cf_^(0HzPl`Ze@sk*t~s(9k?u;@Rq3#C zFoScC;oXzGDqog$azUP*wDw9*&NrXnwS~<;ci?doW&9BU)B(Cy)zec*?|f8kt@uLs zNNw4eD{B|WIj=riQT9|@96SHNLJ1f<KE8+gdu3(E;^WQ^#e1G&1J<XqiN7guROS<j zU~Mr4_4&h_r9P33Qbd^nkxKnc0ORos&wim4zv3j;Z230|FQu$@rpNkPRu8QI33iT= zD`1OLU@5?AOs|58JaU?BMgW04RU_?&3;<z+G%m|NeI?EByZ=X67gJPPbiBhI#-*y7 PP3q<D>g7^<G9dMD^0pPH literal 0 HcmV?d00001 diff --git a/tests/unit/images/signalwire.png b/tests/unit/images/signalwire.png new file mode 100644 index 0000000000000000000000000000000000000000..a5db03960bad97cffb76d15284e0ed2cfdf06251 GIT binary patch literal 6474 zcmbtYXH-+$w%#d3N|4Y42t<@BC3J}(p({nYpn?RD5?YWVJqdymK?G5hDo7KR;z212 zLcpMS06{^jNRcBTHPp~w@Z9(AedE6S>+P|}*mKXe=KAJpbKSB!XTr%Y%nkqm=h-uc zHUI!(k|2N;#{4)1m3lINT=515R=x%%1_VDskZqu=yN4k@IMB~E!b%kYWbV4-a5iV< zW!hX_ak#e56SC|<VKx-XZ5te^je0n~0qzE8zxA<|<qimR8Y>A$3-d?Uzo)VmD9v8) zz(}fBpRK-3?RP6#`kGW}n2r8g2vpqfow$P9Jw&m+$B}4?L?Ug;et#{eff4nPHUU{M zhP~|(#O;Z}fCzT(IO{g6qs5t2)zlbB+xat}&Oo!88IZQVv-&)iCT<4vETDjg9TV4c zXr?y+cW{Ly<bKil`(*E_o$G%VbgbUyVKKqU6w8JGl$@QBK?)(WRMF&?BL!Q*sFU(S zt)Eb|tVLDyz`{QB35d_=C&F$fV{@HOak~i%z~R@w!Qs-^1da<xUcZqMn<1-^96R0< z1cQA)1A~ooV0AvX;@=zNB8<hPVX(fa{e9ATCQx}D)TOYN{rx7v-TnPAWvdl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_core_video.c +++ b/tests/unit/switch_core_video.c @@ -60,7 +60,7 @@ FST_CORE_BEGIN("./conf") switch_img_fill(img, 0, 0, img->d_w, img->d_h, &color); switch_img_add_text(img->planes[0], img->d_w, 10, 10, "-1234567890"); - switch_img_write_png(img, "test-rgb.png"); + switch_img_write_png(img, "images/test-rgb.png"); switch_img_data_url_png(img, &data_url); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "I420: %s\n", data_url); @@ -74,7 +74,7 @@ FST_CORE_BEGIN("./conf") switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d %d %d %d\n", *p, *(p+1), *(p+2), *(p+3)); } - switch_img_write_png(argb_img, "test-argb.png"); + switch_img_write_png(argb_img, "images/test-argb.png"); switch_img_data_url_png(argb_img, &data_url); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ARGB: %s\n", data_url); free(data_url); @@ -84,6 +84,121 @@ FST_CORE_BEGIN("./conf") switch_img_free(&argb_img); } FST_TEST_END() + + FST_TEST_BEGIN(img_patch) + { + int width = 320; + int height = 240; + + switch_image_t *timg = switch_img_write_text_img(width, height, SWITCH_FALSE, "#ffffff:transparent:FreeMono.ttf:24:This is a test!"); + fst_requires(timg != NULL); + switch_status_t status = switch_img_write_png(timg, "images/test_text.png"); + fst_check(status == SWITCH_STATUS_SUCCESS); + + width *=2; + height *=2; + + switch_rgb_color_t bgcolor = {0, 0, 0}; // red + bgcolor.b = 255; + + switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1); + fst_requires(img); + switch_img_fill(img, 0, 0, width, height, &bgcolor); + status = switch_img_write_png(img, "images/test.png"); + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_img_patch(img, timg, 0, 0); + + status = switch_img_write_png(img, "images/test_patched.png"); + + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_img_free(&img); + switch_img_free(&timg); + } + FST_TEST_END() + + FST_TEST_BEGIN(img_patch_alpha) + { + switch_image_t *timg = switch_img_read_png("images/test_text.png", SWITCH_IMG_FMT_ARGB); + fst_requires(timg != NULL); + + switch_image_t *img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + fst_requires(img); + switch_img_patch(img, timg, 0, 0); + switch_status_t status = switch_img_write_png(img, "images/test_patched_alpha.png"); + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_img_free(&img); + img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + switch_img_patch_rgb(img, timg, 0, 0, SWITCH_TRUE); + status = switch_img_write_png(img, "images/test_patched_noalpha.png"); + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_img_free(&img); + switch_img_free(&timg); + } + FST_TEST_END() + + FST_TEST_BEGIN(img_patch_banner_alpha) + { + switch_status_t status; + switch_image_t *img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + switch_image_t *img2 = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + fst_requires(img); + fst_requires(img2); + switch_img_patch(img, img2, 80, 20); + status = switch_img_write_png(img, "images/test_patched_banner_alpha.png"); + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_img_free(&img); + img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + switch_img_patch_rgb(img, img2, 80, 20, SWITCH_TRUE); + status = switch_img_write_png(img, "images/test_patched_banner_noalpha.png"); + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_img_free(&img); + switch_img_free(&img2); + } + FST_TEST_END() + + FST_TEST_BEGIN(img_patch_signalwire_alpha) + { + switch_image_t *timg_small = NULL; + switch_image_t *timg = switch_img_read_png("images/signalwire.png", SWITCH_IMG_FMT_ARGB); + fst_requires(timg != NULL); + + switch_image_t *img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + fst_requires(img); + switch_img_scale(timg, &timg_small, timg->d_w / 5, timg->d_h / 5); + switch_img_patch(img, timg_small, 80, 20); + switch_status_t status = switch_img_write_png(img, "images/test_patched_signalwire_alpha.png"); + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_img_free(&img); + switch_img_free(&timg); + switch_img_free(&timg_small); + } + FST_TEST_END() + + FST_TEST_BEGIN(img_patch_signalwire_no_alpha) + { + switch_image_t *timg_small = NULL; + switch_image_t *timg = switch_img_read_png("images/signalwire.png", SWITCH_IMG_FMT_ARGB); + fst_requires(timg != NULL); + + switch_image_t *img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + fst_requires(img); + switch_img_scale(timg, &timg_small, timg->d_w / 5, timg->d_h / 5); + switch_img_patch_rgb(img, timg_small, 80, 20, SWITCH_TRUE); + switch_status_t status = switch_img_write_png(img, "images/test_patched_signalwire_no_alpha.png"); + fst_check(status == SWITCH_STATUS_SUCCESS); + + switch_img_free(&img); + switch_img_free(&timg); + switch_img_free(&timg_small); + } + FST_TEST_END() } FST_SUITE_END() } From 7b46c01e9e3df0ce6926ce7898ab21e6a6e95a84 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Mon, 30 Mar 2020 16:33:39 +0800 Subject: [PATCH 263/655] [mod_fsv] add video read support to fsv file format --- src/mod/applications/mod_fsv/mod_fsv.c | 146 ++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 8a21e0721d..87cee4bda4 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -786,15 +786,24 @@ struct fsv_file_context { switch_file_t *fd; char *path; switch_mutex_t *mutex; + switch_queue_t *video_queue; + switch_codec_t video_codec; + switch_image_t *last_img; }; typedef struct fsv_file_context fsv_file_context; +typedef struct fsv_file_video_packet_s { + uint8_t *data; + uint32_t len; +} fsv_file_video_packet_t; + static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *path) { fsv_file_context *context; char *ext; unsigned int flags = 0; + const char *video_codec = NULL; if ((ext = strrchr(path, '.')) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n"); @@ -827,6 +836,8 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p return SWITCH_STATUS_GENERR; } + switch_queue_create(&context->video_queue, 500, handle->memory_pool); + context->path = switch_core_strdup(handle->memory_pool, path); if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) { @@ -855,7 +866,9 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p h.version = VERSION; h.created = switch_micro_time_now(); - switch_set_string(h.video_codec_name, "H264"); /* FIXME: hard coded */ + video_codec = switch_event_get_header(handle->params, "video_codec_name"); + if (zstr(video_codec)) video_codec = "VP8"; + switch_set_string(h.video_codec_name, video_codec); h.audio_rate = handle->samplerate; h.audio_ptime = 20; /* FIXME: hard coded */ @@ -879,6 +892,22 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p } handle->samplerate = h.audio_rate; + video_codec = switch_core_strdup(handle->memory_pool, h.video_codec_name); + } + + if (video_codec) { + if (switch_core_codec_init(&context->video_codec, + video_codec, + NULL, + NULL, + 90000, + 0, + 0, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, handle->memory_pool) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Video Codec Activation Failed\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Video Codec [%s] ready\n", video_codec); + } } return SWITCH_STATUS_SUCCESS; @@ -908,6 +937,20 @@ static switch_status_t fsv_file_close(switch_file_handle_t *handle) context->fd = NULL; } + if (switch_test_flag(&context->video_codec, SWITCH_CODEC_FLAG_READY)) { + switch_core_codec_destroy(&context->video_codec); + } + + if (context->video_queue) { + void *pop; + + while (switch_queue_trypop(context->video_queue, &pop) == SWITCH_STATUS_SUCCESS) { + free(pop); + } + } + + switch_img_free(&context->last_img); + return SWITCH_STATUS_SUCCESS; } @@ -934,15 +977,30 @@ again: } if (size & VID_BIT) { /* video */ - *len = size & ~VID_BIT; - /* TODO: read video data */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "discarding video data %d\n", (int)*len); - status = switch_file_read(context->fd, data, len); + uint8_t *video_data = malloc(sizeof(size) + size); + switch_size_t read_size; - if (status != SWITCH_STATUS_SUCCESS) { + switch_assert(video_data); + size &= ~VID_BIT; + read_size = size; + *(uint32_t *)video_data = size; + + status = switch_file_read(context->fd, video_data + sizeof(size), &read_size); + + if (status != SWITCH_STATUS_SUCCESS || read_size != size) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "read error status=%d size=%u read_size=%" SWITCH_SIZE_T_FMT "\n", + status, size, read_size); goto end; } + switch_mutex_lock(context->mutex); + if (switch_queue_trypush(context->video_queue, video_data) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "queue overflow!!\n"); + free(video_data); + } + switch_mutex_unlock(context->mutex); + handle->pos += *len + bytes; goto again; } @@ -963,6 +1021,81 @@ end: return status; } +static switch_status_t fsv_file_read_video(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags) +{ + fsv_file_context *context = handle->private_info; + switch_image_t *dup = NULL; + switch_status_t status = SWITCH_STATUS_SUCCESS; + void *video_packet = NULL; + switch_time_t start = switch_time_now(); + switch_status_t decode_status = SWITCH_STATUS_MORE_DATA; + int new_img = 0; + + if ((flags & SVR_CHECK)) { + switch_goto_status(SWITCH_STATUS_BREAK, end); + } + + while (!new_img) { + while (decode_status == SWITCH_STATUS_MORE_DATA || decode_status == SWITCH_STATUS_SUCCESS) { + switch_frame_t rtp_frame = { 0 }; + uint32_t size; + switch_rtp_hdr_t *rtp; + + switch_mutex_lock(context->mutex); + status = switch_queue_trypop(context->video_queue, &video_packet); + switch_mutex_unlock(context->mutex); + + if (status != SWITCH_STATUS_SUCCESS || !video_packet) break; + + size = *(uint32_t *)video_packet; + rtp = (switch_rtp_hdr_t *)((uint8_t *)video_packet + sizeof(uint32_t)); + + rtp_frame.packet = rtp; + rtp_frame.packetlen = size; + rtp_frame.data = (uint8_t *)rtp_frame.packet + 12; + rtp_frame.datalen = size - 12; + rtp_frame.m = rtp->m; + rtp_frame.timestamp = ntohl(rtp->ts); + decode_status = switch_core_codec_decode_video(&context->video_codec, &rtp_frame); + rtp_frame.packet = NULL; + rtp_frame.data = NULL; + rtp_frame.datalen = 0; + rtp_frame.packetlen = 0; + free(video_packet); + + if (rtp_frame.img) { + switch_img_copy(rtp_frame.img, &context->last_img); + new_img = 1; + break; + } else if (rtp_frame.m) { + break; + } + } + + if (!(flags & SVR_BLOCK)) { + break; + } + + if (switch_time_now() - start < 33000) { + switch_yield(10000); + } else { + break; + } + } + + if (context->last_img) { + switch_img_copy(context->last_img, &dup); + frame->img = dup; + status = SWITCH_STATUS_SUCCESS; + } else { + status = SWITCH_STATUS_BREAK; + } + + end: + + return status; +} + static switch_status_t fsv_file_write(switch_file_handle_t *handle, void *data, size_t *len) { uint32_t datalen = (uint32_t)(*len * sizeof(int16_t)); @@ -1071,6 +1204,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fsv_load) file_interface->file_close = fsv_file_close; file_interface->file_truncate = fsv_file_truncate; file_interface->file_read = fsv_file_read; + file_interface->file_read_video = fsv_file_read_video; file_interface->file_write = fsv_file_write; #if 0 file_interface->file_write_video = fsv_file_write_video; From 3a1a2b3831b5620a29ff917acd5fa56478cec185 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Mon, 30 Mar 2020 16:46:01 +0800 Subject: [PATCH 264/655] [mod_fsv] fix channels regression from 94eb8ac0a --- src/mod/applications/mod_fsv/mod_fsv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 87cee4bda4..2e53922918 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -847,8 +847,6 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p } handle->samples = 0; - // handle->samplerate = 8000; - // handle->channels = 1; handle->format = 0; handle->sections = 0; handle->seekable = 0; @@ -892,6 +890,7 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p } handle->samplerate = h.audio_rate; + handle->channels = h.channels; video_codec = switch_core_strdup(handle->memory_pool, h.video_codec_name); } @@ -910,6 +909,8 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p } } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "File opened [%s] %dhz [%d] channels\n", path, handle->samplerate, handle->channels); + return SWITCH_STATUS_SUCCESS; } @@ -963,7 +964,7 @@ static switch_status_t fsv_file_seek(switch_file_handle_t *handle, unsigned int static switch_status_t fsv_file_read(switch_file_handle_t *handle, void *data, size_t *len) { switch_status_t status; - size_t need = *len; + size_t need = *len * 2; uint32_t size; size_t bytes = sizeof(size); fsv_file_context *context = handle->private_info; From 0db19ecdf835195a186ce3454a9336eab4539d40 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Mon, 30 Mar 2020 22:18:40 +0800 Subject: [PATCH 265/655] [mod_fsv] add no_video_decode to support read video rtp packets without decode --- src/mod/applications/mod_fsv/mod_fsv.c | 54 +++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 2e53922918..6ff6533ddd 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -789,6 +789,8 @@ struct fsv_file_context { switch_queue_t *video_queue; switch_codec_t video_codec; switch_image_t *last_img; + switch_bool_t no_video_decode; + uint8_t video_packet_buffer[SWITCH_RECOMMENDED_BUFFER_SIZE]; }; typedef struct fsv_file_context fsv_file_context; @@ -855,6 +857,8 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p handle->private_info = context; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening File [%s] %dhz\n", path, handle->samplerate); + context->no_video_decode = switch_true(switch_event_get_header(handle->params, "no_video_decode")); + if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { struct file_header h; size_t len = sizeof(h); @@ -894,7 +898,7 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p video_codec = switch_core_strdup(handle->memory_pool, h.video_codec_name); } - if (video_codec) { + if (video_codec && !context->no_video_decode) { if (switch_core_codec_init(&context->video_codec, video_codec, NULL, @@ -909,7 +913,8 @@ static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *p } } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "File opened [%s] %dhz [%d] channels\n", path, handle->samplerate, handle->channels); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "File opened [%s] %dhz [%d] channels, no_video_decode=%s\n", + path, handle->samplerate, handle->channels, context->no_video_decode ? "true" : "false"); return SWITCH_STATUS_SUCCESS; } @@ -1036,6 +1041,51 @@ static switch_status_t fsv_file_read_video(switch_file_handle_t *handle, switch_ switch_goto_status(SWITCH_STATUS_BREAK, end); } + if (context->no_video_decode) { // read video without decode + uint32_t size; + switch_rtp_hdr_t *rtp; + + while (1) { + switch_mutex_lock(context->mutex); + status = switch_queue_trypop(context->video_queue, &video_packet); + switch_mutex_unlock(context->mutex); + + if (status != SWITCH_STATUS_SUCCESS || !video_packet) { + switch_safe_free(video_packet); + if (flags & SVR_BLOCK) { + if (switch_time_now() - start < 33000) { + switch_yield(10000); + continue; + } + } + return SWITCH_STATUS_BREAK; + } + + break; + } + + size = *(uint32_t *)video_packet; + if (size > sizeof(context->video_packet_buffer)) { + free(video_packet); + return SWITCH_STATUS_BREAK; + } + + memcpy(context->video_packet_buffer, (uint8_t *)video_packet + sizeof(uint32_t), size); + free(video_packet); + video_packet = NULL; + + rtp = (switch_rtp_hdr_t *)context->video_packet_buffer; + frame->packet = context->video_packet_buffer; + frame->packetlen = size; + frame->data = context->video_packet_buffer + 12; + frame->datalen = size - 12; + frame->m = rtp->m; + frame->timestamp = ntohl(rtp->ts); + frame->flags = SFF_RAW_RTP | SFF_RTP_HEADER | SFF_ENCODED; + + return SWITCH_STATUS_SUCCESS; + } + while (!new_img) { while (decode_status == SWITCH_STATUS_MORE_DATA || decode_status == SWITCH_STATUS_SUCCESS) { switch_frame_t rtp_frame = { 0 }; From 9d2cb8b1906a345d132025164050f4aa271f4c62 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@x-y-t.cn> Date: Fri, 3 Apr 2020 15:23:45 +0800 Subject: [PATCH 266/655] [mod_av] play video without decode --- src/mod/applications/mod_av/.gitignore | 3 + src/mod/applications/mod_av/Makefile.am | 7 +- src/mod/applications/mod_av/avformat.c | 145 ++++++- .../applications/mod_av/switch_packetizer.c | 394 ++++++++++++++++++ .../applications/mod_av/switch_packetizer.h | 62 +++ .../applications/mod_av/test/test_avformat.c | 33 ++ .../mod_av/test/test_packetizer.c | 256 ++++++++++++ 7 files changed, 896 insertions(+), 4 deletions(-) create mode 100644 src/mod/applications/mod_av/.gitignore create mode 100644 src/mod/applications/mod_av/switch_packetizer.c create mode 100644 src/mod/applications/mod_av/switch_packetizer.h create mode 100644 src/mod/applications/mod_av/test/test_packetizer.c diff --git a/src/mod/applications/mod_av/.gitignore b/src/mod/applications/mod_av/.gitignore new file mode 100644 index 0000000000..35829e418c --- /dev/null +++ b/src/mod/applications/mod_av/.gitignore @@ -0,0 +1,3 @@ +test/test_BT7.mp4 +test/test_RGB.mp4 +test/test_packetizer diff --git a/src/mod/applications/mod_av/Makefile.am b/src/mod/applications/mod_av/Makefile.am index ebf4c93929..39cb581611 100644 --- a/src/mod/applications/mod_av/Makefile.am +++ b/src/mod/applications/mod_av/Makefile.am @@ -13,7 +13,7 @@ endif noinst_LTLIBRARIES = libavmod.la -libavmod_la_SOURCES = mod_av.c avformat.c avcodec.c +libavmod_la_SOURCES = mod_av.c avformat.c avcodec.c switch_packetizer.c libavmod_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) mod_LTLIBRARIES = mod_av.la @@ -22,13 +22,16 @@ mod_av_la_LIBADD = libavmod.la $(switch_builddir)/libfreeswitch.la $(AVFORMAT_ mod_av_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz -noinst_PROGRAMS = test/test_mod_av test/test_avformat +noinst_PROGRAMS = test/test_mod_av test/test_avformat test/test_packetizer test_test_mod_av_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) test_test_mod_av_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) test_test_mod_av_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la test_test_avformat_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) test_test_avformat_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) test_test_avformat_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la +test_test_packetizer_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) +test_test_packetizer_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) +test_test_packetizer_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la TESTS = $(noinst_PROGRAMS) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index c979e8cce6..b8ed73321f 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -54,6 +54,9 @@ GCC_DIAG_OFF(deprecated-declarations) #include <libswresample/swresample.h> #endif +#include <switch_packetizer.h> +#define SLICE_SIZE (SWITCH_DEFAULT_VIDEO_SIZE + 100) + GCC_DIAG_ON(deprecated-declarations) #define SCALE_FLAGS SWS_BICUBIC #define DFT_RECORD_OFFSET 0 @@ -116,8 +119,6 @@ typedef struct record_helper_s { uint64_t last_ts; } record_helper_t; - - /* file interface */ struct av_file_context { @@ -161,6 +162,11 @@ struct av_file_context { switch_time_t last_vid_write; int audio_timer; + + switch_bool_t no_video_decode; + switch_queue_t *video_pkt_queue; + switch_packetizer_t *packetizer; + AVPacket *last_read_pkt; }; typedef struct av_file_context av_file_context_t; @@ -772,6 +778,15 @@ static int flush_video_queue(switch_queue_t *q, int min) return switch_queue_size(q); } +static void flush_video_pkt_queue(switch_queue_t *q) +{ + AVPacket *pkt; + + while (switch_queue_trypop(q, (void **)&pkt) == SWITCH_STATUS_SUCCESS) { + av_packet_unref(pkt); + } +} + static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *obj) { av_file_context_t *context = (av_file_context_t *) obj; @@ -1387,6 +1402,34 @@ GCC_DIAG_ON(deprecated-declarations) if (context->has_video && pkt.stream_index == context->video_st.st->index) { AVFrame *vframe; switch_image_t *img; + + if (context->no_video_decode) { + if (eof) { + break; + } else { + switch_status_t status; + AVPacket *new_pkt = malloc(sizeof(AVPacket)); + + if (0) { // debug + uint8_t *p = pkt.data; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %u %x %x %x %x %x %x\n", pkt.size, *p, *(p+1), *(p+2), *(p+3), *(p+4), *(p+5)); + } + + av_init_packet(new_pkt); + av_packet_ref(new_pkt, &pkt); + status = switch_queue_push(context->video_pkt_queue, new_pkt); + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %4u flag=%x pts=%" SWITCH_INT64_T_FMT " dts=%" SWITCH_INT64_T_FMT "\n", pkt.size, pkt.flags, pkt.pts, pkt.dts); + + context->vid_ready = 1; + if (status != SWITCH_STATUS_SUCCESS) { + av_packet_unref(new_pkt); + free(new_pkt); + } + av_packet_unref(&pkt); + continue; + } + } + if (!sync) { switch_buffer_zero(context->audio_buffer); sync = 1; @@ -1680,6 +1723,11 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa if (context->has_video) { switch_queue_create(&context->eh.video_queue, context->read_fps, handle->memory_pool); + context->no_video_decode = handle->params && switch_true(switch_event_get_header(handle->params, "no_video_decode")); + if (context->no_video_decode) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening video in no decode mode\n"); + switch_queue_create(&context->video_pkt_queue, 120 * 5, handle->memory_pool); + } switch_mutex_init(&context->eh.mutex, SWITCH_MUTEX_NESTED, handle->memory_pool); switch_core_timer_init(&context->video_timer, "soft", (int)(1000.0f / context->read_fps), 1, context->pool); } @@ -2177,6 +2225,15 @@ static switch_status_t av_file_close(switch_file_handle_t *handle) context->file_read_thread_running = 0; } + if (context->video_pkt_queue) { + flush_video_pkt_queue(context->video_pkt_queue); + switch_queue_term(context->video_pkt_queue); + } + + if (context->packetizer) { + switch_packetizer_close(&context->packetizer); + } + if (context->file_read_thread) { switch_thread_join(&status, context->file_read_thread); context->file_read_thread = NULL; @@ -2249,6 +2306,7 @@ static switch_status_t av_file_read(switch_file_handle_t *handle, void *data, si } switch_mutex_lock(context->mutex); + while (!context->file_read_thread_started) { switch_thread_cond_wait(context->cond, context->mutex); } @@ -2334,6 +2392,82 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f } #else +static switch_status_t no_video_decode_packets(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags) +{ + av_file_context_t *context = (av_file_context_t *)handle->private_info; + MediaStream *mst = &context->video_st; + AVStream *st = mst->st; + // AVCodecContext *ctx = st->codec; + // int ticks = 0; + // int64_t max_delta = 1 * AV_TIME_BASE; // 1 second + switch_status_t status = SWITCH_STATUS_SUCCESS; + AVPacket *pkt; + int64_t pts; + + + if (!context->packetizer) { + // uint8_t *p = st->codecpar->extradata; + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %u %x %x %x %x %x %x\n", st->codecpar->extradata_size, *p, *(p+1), *(p+2), *(p+3), *(p+4), *(p+5)); + + context->packetizer = switch_packetizer_create(SPT_H264_SIZED_BITSTREAM, SLICE_SIZE); + if (!context->packetizer) return SWITCH_STATUS_FALSE; + + switch_packetizer_feed_extradata(context->packetizer, st->codecpar->extradata, st->codecpar->extradata_size); + } + + if (context->last_read_pkt) { + status = switch_packetizer_read(context->packetizer, frame); + if (status == SWITCH_STATUS_SUCCESS) { + av_packet_unref(context->last_read_pkt); + free(context->last_read_pkt); + context->last_read_pkt = NULL; + } + return status; + } + + status = switch_queue_trypop(context->video_pkt_queue, (void **)&pkt); + + if (status != SWITCH_STATUS_SUCCESS || !pkt) { + switch_cond_next(); + return SWITCH_STATUS_BREAK; + } + + context->last_read_pkt = pkt; + status = switch_packetizer_feed(context->packetizer, pkt->data, pkt->size); + status = switch_packetizer_read(context->packetizer, frame); + pts = av_rescale_q(pkt->pts, st->time_base, AV_TIME_BASE_Q); + frame->timestamp = pts * 9 / 100; // scale to sample 900000 + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "pts=%" SWITCH_INT64_T_FMT " status = %d\n", pts, status); + + if (status == SWITCH_STATUS_SUCCESS) { + av_packet_unref(context->last_read_pkt); + free(context->last_read_pkt); + context->last_read_pkt = NULL; + } + + + if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_MORE_DATA) { + if (!context->video_start_time) { + context->video_start_time = switch_time_now() - pts; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "set start time: %" SWITCH_INT64_T_FMT " now: %" SWITCH_INT64_T_FMT " pts: %" SWITCH_INT64_T_FMT "\n", context->video_start_time, switch_time_now(), pts); + } else if (flags & SVR_BLOCK) { + int64_t sleep = pts - (switch_time_now() - context->video_start_time); + if (sleep > 0) { + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "zzZ... %" SWITCH_INT64_T_FMT "\n", sleep); + if (sleep > 1000000) { + sleep = 1000000; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "but zzZ... %" SWITCH_INT64_T_FMT " at most\n", sleep); + } + switch_yield(sleep); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "video is late %" SWITCH_INT64_T_FMT "\n", sleep); + } + } + } + + return status; +} + static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags) { av_file_context_t *context = (av_file_context_t *)handle->private_info; @@ -2353,6 +2487,13 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f return SWITCH_STATUS_BREAK; } + if (context->no_video_decode) { + switch_set_flag(frame, SFF_ENCODED); + status = no_video_decode_packets(handle, frame, flags); + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "return len=%4u nalu=%02x m=%d ts=%u\n", frame->datalen, *(uint8_t *)frame->data, frame->m, frame->timestamp); + return status; + } + if (handle->mm.fps > 0 && handle->mm.fps < smaller_ts) { smaller_ts = handle->mm.fps; } diff --git a/src/mod/applications/mod_av/switch_packetizer.c b/src/mod/applications/mod_av/switch_packetizer.c new file mode 100644 index 0000000000..e539bd9b59 --- /dev/null +++ b/src/mod/applications/mod_av/switch_packetizer.c @@ -0,0 +1,394 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 + * Seven Du <dujinfang@gmail.com> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Seven Du <dujinfang@gmail.com> + * + * switch_packetizer H264 packetizer + * + */ + +#include <switch_packetizer.h> +#define MAX_NALUS 256 + +typedef struct our_h264_nalu_s { + const uint8_t *start; + const uint8_t *eat; + uint32_t len; +} our_h264_nalu_t; + +typedef struct h264_packetizer_s { + switch_packetizer_bitstream_t type; + uint32_t slice_size; + int nalu_current_index; + our_h264_nalu_t nalus[MAX_NALUS]; + uint8_t *extradata; + uint32_t extradata_size; + uint8_t *sps; + uint8_t *pps; + uint32_t sps_len; + uint32_t pps_len; + int sps_sent; + int pps_sent; +} h264_packetizer_t; + +/* ff_avc_find_startcode is not exposed in the ffmpeg lib but you can use it + Either include the avc.h which available in the ffmpeg source, or + just add the declaration like we does following to avoid include that whole avc.h + The function is implemented in avc.h, guess we'll get rid of this later if we can directly use libx264 + +#include <libavformat/avc.h> +*/ + +const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end); + +static const uint8_t *fs_avc_find_startcode_internal(const uint8_t *p, const uint8_t *end) +{ + const uint8_t *a = p + 4 - ((intptr_t)p & 3); + + for (end -= 3; p < a && p < end; p++) { + if (p[0] == 0 && p[1] == 0 && p[2] == 1) + return p; + } + + for (end -= 3; p < end; p += 4) { + uint32_t x = *(const uint32_t*)p; + if ((x - 0x01010101) & (~x) & 0x80808080) { + if (p[1] == 0) { + if (p[0] == 0 && p[2] == 1) + return p; + if (p[2] == 0 && p[3] == 1) + return p+1; + } + if (p[3] == 0) { + if (p[2] == 0 && p[4] == 1) + return p+2; + if (p[4] == 0 && p[5] == 1) + return p+3; + } + } + } + + for (end += 3; p < end; p++) { + if (p[0] == 0 && p[1] == 0 && p[2] == 1) + return p; + } + + return end + 3; +} + +static const uint8_t *fs_avc_find_startcode(const uint8_t *p, const uint8_t *end) +{ + const uint8_t *out= fs_avc_find_startcode_internal(p, end); + + if (p < out && out < end && !out[-1]) { + out--; + } + + return out; +} + +SWITCH_DECLARE(switch_packetizer_t *) switch_packetizer_create(switch_packetizer_bitstream_t type, uint32_t slice_size) +{ + h264_packetizer_t *context = malloc(sizeof(h264_packetizer_t)); + memset(context, 0, sizeof(h264_packetizer_t)); + context->slice_size = slice_size; + context->type = type; + return (switch_packetizer_t *)context; +} + +// for H264 +SWITCH_DECLARE(switch_status_t) switch_packetizer_feed_extradata(switch_packetizer_t *packetizer, void *data, uint32_t size) +{ + h264_packetizer_t *context = (h264_packetizer_t *)packetizer; + uint8_t *p; + int left = size; + int n_sps = 0; + int n_pps = 0; + int sps_len; + int pps_len; + int i; + + if (left < 10) return SWITCH_STATUS_FALSE; + + if (context->extradata) { + context->sps = NULL; + context->pps = NULL; + context->sps_len = 0; + context->pps_len = 0; + free(context->extradata); + context->extradata = NULL; + } + + context->extradata = malloc(size); + if (!context->extradata) return SWITCH_STATUS_MEMERR; + memcpy(context->extradata, data, size); + +/* +0x0000 | 01 64 00 1E FF E1 00 1F 67 64 00 1E AC C8 60 33 // E1: 1SPS 00 1F: SPS 31byte +0x0010 | 0E F9 E6 FF C1 C6 01 C4 44 00 00 03 00 04 00 00 +0x0020 | 03 00 B8 3C 58 B6 68 01 00 05 68 E9 78 47 2C // 01: 1PPS 00 05: PPS 5byte +*/ + + p = context->extradata; + + if (*p != 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NOT supported version: %d\n", *p); + return SWITCH_STATUS_FALSE; + } + p += 5; + left -= 5; + + if (left < 0) return SWITCH_STATUS_FALSE; + + //sps + n_sps = *p & 0x1f; + p += 1; + left -= 1; + + for (i = 0; i < n_sps; i++) { + sps_len = ntohs(*(uint16_t *)p); + p += sizeof(uint16_t); + left -= sizeof(uint16_t); + + if (left < sps_len) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "corrupted data %d < %u\n", left, sps_len); + return SWITCH_STATUS_FALSE; + } + + if (!context->sps) { // we only need the first one + context->sps = p; + context->sps_len = sps_len; + } + + p += sps_len; + left -= sps_len; + } + + if (left < 0) return SWITCH_STATUS_FALSE; + + n_pps = *p & 0x1f; + p += 1; + left -= 1; + + for (i = 0; i < n_pps; i++) { + pps_len = ntohs(*(uint16_t *)p); + p += sizeof(uint16_t); + left -= sizeof(uint16_t); + + if (left < pps_len) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "corrupted data %d < %u\n", left, pps_len); + return SWITCH_STATUS_FALSE; + } + + if (!context->pps) { // we only need the first one + context->pps = p; + context->pps_len = pps_len; + } + p += pps_len; + left -= pps_len; + } + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_DECLARE(switch_status_t) switch_packetizer_feed(switch_packetizer_t *packetizer, void *data, uint32_t size) +{ + h264_packetizer_t *context = (h264_packetizer_t *)packetizer; + const uint8_t *p = data; + const uint8_t *end = p + size; + int i = 0; + + // reset everytime + memset(context->nalus, 0, MAX_NALUS * sizeof(our_h264_nalu_t)); + context->nalu_current_index = 0; + + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %u %x %x %x %x %x\n", size, *p, *(p+1), *(p+2), *(p+3), *(p+4)); + + if (context->type == SPT_H264_SIZED_BITSTREAM) { + int left = size; + uint32_t len; + + while (left > 0) { + if (left < sizeof(uint32_t)) return SWITCH_STATUS_MORE_DATA; + len = htonl(*(uint32_t *)p); + left -= sizeof(uint32_t); + left -= len; + if (left < 0) return SWITCH_STATUS_MORE_DATA; + p += sizeof(uint32_t); + + context->nalus[i].start = p; + context->nalus[i].eat = p; + context->nalus[i].len = len; + + p += len; + + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "#%d %x len=%u\n", i, *context->nalus[i].start, context->nalus[i].len); + i++; + } + + return SWITCH_STATUS_SUCCESS; + } + + if (context->type == SPT_H264_SIGNALE_NALU) { + context->nalus[0].start = data; + context->nalus[0].eat = data; + context->nalus[0].len = size; + + return SWITCH_STATUS_SUCCESS; + } + + // SPT_H264_BITSTREAM + while ((p = fs_avc_find_startcode(p, end)) < end) { + if (!context->nalus[i].start) { + while (!(*p++)) ; /* eat the sync bytes, what ever 0 0 1 or 0 0 0 1 */ + context->nalus[i].start = p; + context->nalus[i].eat = p; + } else { + context->nalus[i].len = p - context->nalus[i].start; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "#%d %x len=%u\n", i, *context->nalus[i].start, context->nalus[i].len); + while (!(*p++)) ; /* eat the sync bytes, what ever 0 0 1 or 0 0 0 1 */ + i++; + context->nalus[i].start = p; + context->nalus[i].eat = p; + } + if (i >= MAX_NALUS - 2) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "TOO MANY SLICES!\n"); + break; + } + + } + + context->nalus[i].len = p - context->nalus[i].start; + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_DECLARE(switch_status_t) switch_packetizer_read(switch_packetizer_t *packetizer, switch_frame_t *frame) +{ + h264_packetizer_t *context = (h264_packetizer_t *)packetizer; + uint32_t slice_size = context->slice_size; + our_h264_nalu_t *nalu = &context->nalus[context->nalu_current_index]; + uint8_t nalu_hdr = 0; + uint8_t nalu_type = 0; + uint8_t nri = 0; + int left = nalu->len - (nalu->eat - nalu->start); + uint8_t *p = frame->data; + uint8_t start = nalu->start == nalu->eat ? 0x80 : 0; + int n = nalu->len / slice_size + 1; + int real_slice_size = nalu->len / n + 1 + 2; + + if (nalu->start == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID BITSTREAM\n"); + return SWITCH_STATUS_FALSE; + } + + nalu_hdr = *(uint8_t *)(nalu->start); + nalu_type = nalu_hdr & 0x1f; + nri = nalu_hdr & 0x60; + + if (real_slice_size > slice_size) real_slice_size = slice_size; + if (frame->buflen < slice_size) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "frame buffer too small %u < %u\n", frame->buflen, slice_size); + return SWITCH_STATUS_FALSE; + } + + if (context->type == SPT_H264_BITSTREAM || SPT_H264_SIZED_BITSTREAM) { + if (nalu_type == 0x05) { + // insert SPS/PPS before + if (context->sps && !context->sps_sent) { + memcpy(frame->data, context->sps, context->sps_len); + frame->datalen = context->sps_len; + frame->m = 0; + context->sps_sent = 1; + return SWITCH_STATUS_MORE_DATA; + } else if (context->pps && !context->pps_sent) { + memcpy(frame->data, context->pps, context->pps_len); + frame->datalen = context->pps_len; + frame->m = 0; + context->pps_sent = 1; + return SWITCH_STATUS_MORE_DATA; + } + } else if (nalu_type == 0x07) { + context->sps_sent = 1; + } else if (nalu_type == 0x08) { + context->pps_sent = 1; + } + } + + if (nalu->len <= slice_size) { + memcpy(frame->data, nalu->start, nalu->len); + frame->datalen = nalu->len; + context->nalu_current_index++; + + switch_clear_flag(frame, SFF_CNG); + + if (context->nalus[context->nalu_current_index].len) { + frame->m = 0; + return SWITCH_STATUS_MORE_DATA; + } + + frame->m = 1; + + if (nalu_type == 0x05) { + context->sps_sent = 0; + context->pps_sent = 0; + } + + return SWITCH_STATUS_SUCCESS; + } + + if (left <= (real_slice_size - 2)) { + p[0] = nri | 28; // FU-A + p[1] = 0x40 | nalu_type; + memcpy(p+2, nalu->eat, left); + nalu->eat += left; + frame->datalen = left + 2; + context->nalu_current_index++; + + if (!context->nalus[context->nalu_current_index].len) { + frame->m = 1; + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_MORE_DATA; + } + + p[0] = nri | 28; // FU-A + p[1] = start | nalu_type; + if (start) nalu->eat++; + memcpy(p+2, nalu->eat, real_slice_size - 2); + nalu->eat += (real_slice_size - 2); + frame->datalen = real_slice_size; + frame->m = 0; + return SWITCH_STATUS_MORE_DATA; +} + +SWITCH_DECLARE(void) switch_packetizer_close(switch_packetizer_t **packetizer) +{ + h264_packetizer_t *context = (h264_packetizer_t *)(*packetizer); + if (context->extradata) free(context->extradata); + free(context); + *packetizer = NULL; +} diff --git a/src/mod/applications/mod_av/switch_packetizer.h b/src/mod/applications/mod_av/switch_packetizer.h new file mode 100644 index 0000000000..39cdf4f4d6 --- /dev/null +++ b/src/mod/applications/mod_av/switch_packetizer.h @@ -0,0 +1,62 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 + * Seven Du <dujinfang@gmail.com> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Seven Du <dujinfang@gmail.com> + * + * switch_packetizer H264 packetizer + * + */ + +#include <switch.h> + +#ifndef SWITCH_PACKETIZER_H +#define SWITCH_PACKETIZER_H + +typedef void switch_packetizer_t; + +typedef enum { + SPT_H264_BITSTREAM, // with separator 0 0 0 1 or 0 0 1 + SPT_H264_SIZED_BITSTREAM, + SPT_H264_SIGNALE_NALU, + SPT_VP8_BITSTREAM, + SPT_VP9_BITSTREAM, + + // no more beyond this line + SPT_INVALID_STREAM +} switch_packetizer_bitstream_t; + +/* + + create a packetizer and feed data, to avoid data copy, data MUST be valid before the next feed, or before close. + + */ + +SWITCH_DECLARE(switch_packetizer_t *) switch_packetizer_create(switch_packetizer_bitstream_t type, uint32_t slice_size); +SWITCH_DECLARE(switch_status_t) switch_packetizer_feed(switch_packetizer_t *packetizer, void *data, uint32_t size); +SWITCH_DECLARE(switch_status_t) switch_packetizer_feed_extradata(switch_packetizer_t *packetizer, void *data, uint32_t size); +SWITCH_DECLARE(switch_status_t) switch_packetizer_read(switch_packetizer_t *packetizer, switch_frame_t *frame); +SWITCH_DECLARE(void) switch_packetizer_close(switch_packetizer_t **packetizer); + +#endif diff --git a/src/mod/applications/mod_av/test/test_avformat.c b/src/mod/applications/mod_av/test/test_avformat.c index af364afd66..8520a558e6 100644 --- a/src/mod/applications/mod_av/test/test_avformat.c +++ b/src/mod/applications/mod_av/test/test_avformat.c @@ -162,6 +162,39 @@ FST_CORE_BEGIN("conf") } FST_TEST_END() + FST_TEST_BEGIN(avformat_test_play_no_decode) + { + char path[1024]; + switch_status_t status; + switch_file_handle_t fh = { 0 }; + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + switch_frame_t frame = { 0 }; + switch_size_t len = SAMPLES; + uint32_t flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO; + int i = 0; + + sprintf(path, "{no_video_decode=true}%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../test_RGB.mp4"); + // switch_set_string(path, "{no_video_decode=true}/usr/local/freeswitch/storage/bingbing.mp4"); + status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN)); + frame.data = data; + + do { + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_core_file_read(&fh, data, &len); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "status: %d len: %d\n", status, (int)len); + fst_check(frame.img == NULL); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_core_file_read_video(&fh, &frame, 0); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "status: %d len: %d %02x\n", status, frame.datalen, *(uint8_t *)frame.data); + } while (status == SWITCH_STATUS_MORE_DATA); + + switch_core_file_close(&fh); + } + FST_TEST_END() + + FST_TEARDOWN_BEGIN() { //const char *err = NULL; diff --git a/src/mod/applications/mod_av/test/test_packetizer.c b/src/mod/applications/mod_av/test/test_packetizer.c new file mode 100644 index 0000000000..9d34f98d51 --- /dev/null +++ b/src/mod/applications/mod_av/test/test_packetizer.c @@ -0,0 +1,256 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2018, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 + * Seven Du <seven@signalwire.com> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * + * test_avformat -- avformat tests + * + */ + +#include <test/switch_test.h> +#include <switch_packetizer.h> + +#define SLICE_SIZE 4 + +FST_CORE_BEGIN("conf") +{ + FST_MODULE_BEGIN(mod_av, mod_av_test) + { + FST_SETUP_BEGIN() + { + fst_requires_module("mod_av"); + } + FST_SETUP_END() + + FST_TEST_BEGIN(test_packetizer_bitstream) + { + switch_packetizer_t *packetizer = switch_packetizer_create(SPT_H264_BITSTREAM, SLICE_SIZE); + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_frame_t frame = {0}; + switch_status_t status; + uint8_t h264data[] = {0, 0, 0, 1, 0x67, 1, 2, 0, 0, 0, 1, 0x68, 1, 2, 0, 0, 0, 1, 0x65, 1, 2, 3, 4, 5, 6}; + + frame.data = data; + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + switch_set_flag(&frame, SFF_ENCODED); + + status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data)); + fst_requires(status == SWITCH_STATUS_SUCCESS); + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 4); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 4); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(frame.datalen == 4); + switch_packetizer_close(&packetizer); + } + FST_TEST_END() + + FST_TEST_BEGIN(test_packetizer_sized_bitstream_has_sps_pps) + { + switch_packetizer_t *packetizer = switch_packetizer_create(SPT_H264_SIZED_BITSTREAM, SLICE_SIZE); + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_frame_t frame = {0}; + switch_status_t status; + uint8_t h264data[] = {0, 0, 0, 3, 0x67, 1, 2, 0, 0, 0, 3, 0x68, 1, 2, 0, 0, 0, 7, 0x65, 1, 2, 3, 4, 5, 6}; + + frame.data = data; + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + switch_set_flag(&frame, SFF_ENCODED); + + status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data)); + fst_requires(status == SWITCH_STATUS_SUCCESS); + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 4); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 4); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(frame.datalen == 4); + fst_check(frame.m == 1); + switch_packetizer_close(&packetizer); + } + FST_TEST_END() + + FST_TEST_BEGIN(test_packetizer_sized_bitstream_no_sps_pps) + { + switch_packetizer_t *packetizer = switch_packetizer_create(SPT_H264_SIZED_BITSTREAM, SLICE_SIZE); + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_frame_t frame = {0}; + switch_status_t status; + uint8_t h264data[] = {0, 0, 0, 3, 0x06, 1, 2, 0, 0, 0, 3, 0x09, 1, 2, 0, 0, 0, 7, 0x65, 1, 2, 3, 4, 5, 6}; + uint8_t extradata[] = {0x01, 0x64, 0x00, 0x1e, 0xff, 0xe1, 0x00, 0x03, 0x67, 0x64, 0x00, 0xe1, 0x00, 0x03, 0x68, 0x01, 0x02}; +// 1 fps 3 bytes 1pps 3 bytes + frame.data = data; + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + switch_set_flag(&frame, SFF_ENCODED); + + status = switch_packetizer_feed_extradata(packetizer, extradata, sizeof(extradata)); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data)); + fst_requires(status == SWITCH_STATUS_SUCCESS); + + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + fst_check((*(uint8_t *)frame.data & 0x1f) == 0x06); + + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + fst_check((*(uint8_t *)frame.data & 0x1f) == 0x09); + + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + fst_check((*(uint8_t *)frame.data & 0x1f) == 0x07); + + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + fst_check((*(uint8_t *)frame.data & 0x1f) == 0x08); + + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 4); + fst_check((*(uint8_t *)frame.data & 0x1f) == 0x1c); + fst_check(frame.m == 0); + + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 4); + fst_check((*(uint8_t *)frame.data & 0x1f) == 0x1c); + fst_check(frame.m == 0); + + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(frame.datalen == 4); + fst_check((*(uint8_t *)frame.data & 0x1f) == 0x1c); + fst_check(frame.m == 1); + switch_packetizer_close(&packetizer); + } + FST_TEST_END() + + FST_TEST_BEGIN(test_packetizer_invalid) + { + switch_packetizer_t *packetizer = switch_packetizer_create(SPT_H264_BITSTREAM, SLICE_SIZE); + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_frame_t frame = {0}; + switch_status_t status; + uint8_t h264data[] = {0, 0, 2, 9, 0x67, 1, 2, 0, 0, 0, 0, 0x68, 1, 2, 0, 0, 0, 0, 0x65, 1, 2, 3, 4, 5, 6}; + + frame.data = data; + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + switch_set_flag(&frame, SFF_ENCODED); + + status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data)); + fst_requires(status == SWITCH_STATUS_SUCCESS); + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 3); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 4); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_MORE_DATA); + fst_requires(frame.datalen == 4); + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + status = switch_packetizer_read(packetizer, &frame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(frame.datalen == 4); + switch_packetizer_close(&packetizer); + } + FST_TEST_END() + + FST_TEARDOWN_BEGIN() + { + //const char *err = NULL; + switch_sleep(1000000); + //fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_av", SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS); + } + FST_TEARDOWN_END() + } + FST_MODULE_END() +} +FST_CORE_END() From 58d5442dc557016464fea9f0f5736d17b23efb1c Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Wed, 6 Mar 2019 09:48:20 +0800 Subject: [PATCH 267/655] [core] add stb_image to read more supported picture formats --- images/cluecon.jpg | Bin 0 -> 50243 bytes images/cluecon.png | Bin 0 -> 115565 bytes libs/stb/stb_image.h | 7547 +++++++++++++++++++++++++++++++ src/include/switch_core_video.h | 3 + src/switch_core_video.c | 48 + tests/unit/switch_core_video.c | 21 + 6 files changed, 7619 insertions(+) create mode 100644 images/cluecon.jpg create mode 100644 images/cluecon.png create mode 100644 libs/stb/stb_image.h diff --git a/images/cluecon.jpg b/images/cluecon.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a6e89751ea740a812fe188a25c30c870a9eb7056 GIT binary patch literal 50243 zcmeFYbyQnlw>BC|@dCviN`c}~+@XcyRssZv;w88{v=n!DC%B}z1S#%rh2ZY)dilNY zcg`K>J7e5?zCZ4NcV>@0cCz+fdnJ2i&SyUJS<io;R{(G2q-3Q42neqLbT2Q!GaMiR zKz#L&{j*1WvDe72|1nf#WF%xXRCIJSR5Ud7H`s5`F|aVu&@gc@v9RC1#d(YV1{V+a zE#AxV+kZMi_~%N**QhTSzQsVpc=`1I(4PMQa8Lnvud)ykZ~(7x5D;+?p1S~)00h7* zL<GRg_8*3dhJ=jr`V}JjKke>s0SJh%UT%ztgoXJsL>vIZE5z4;mosp1QSqqJ@ZWO~ zd{!ak<TtD$BB9~pvv+cK`59ALT}w>I&BH4WGIB`BshOgckOn#i1je>^k57D{7m!jn z@q=`9GDw>K@{h|cSUoxYA|tD+reXZuH7KdBt7m#`<K@=m2>%+|%l<zN83o}r65=b= zmsZJ_FY(V%kkAp4UnBo(_%Cm9UL#Q><8pk)Q!%u!e9y`4@G~Z-ef$IkpNob^9N4i+ z5Ib>7NGoCF==ZB?E%$jI@aE;pS2&0`05L#G3Bo4^BtSO)s~=y{|Nq1PPksj{Ve07H zgwV|%$}O`$ej7E?F(2e`C;onBTv{>hrnW?rtKAXY`6Rfn$0Dj83Z>iNhMFz2!G(D3 zIN<V0-*VXJ8Rdo{6-T$skO|oSYS(eH^iNdaCL{dmW1~WF!G#=km(BZ*OHz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U9w8^s3(P-gKZA<@4M1oQ%Jf;i z96}v0C7z=|{;lpl{$I-vrT406q)h+K82X#2^)Hmue|`7=ef<A!r2hpk@BeouG5;+6 EKOBqTyZ`_I literal 0 HcmV?d00001 diff --git a/images/cluecon.png b/images/cluecon.png new file mode 100644 index 0000000000000000000000000000000000000000..7b0c4ced2b6e9288ccc1a38f0af8080386bbd9b8 GIT binary patch literal 115565 zcmZ^~Ra6|`6E!+`Z~_FEkl?O^1}6k}2+j|8cLsMS3=-Vk-7UDgJA=E+U?2ax)_2!^ zxewia`l<Vzs@i8))jr{h@{;H%L?{3N0A1>rxH13$oAoh<enR}XAILKfeLRrue`z`a z02qD$yI>L-Fo*$wuK+1=5moo}-43fbszDdB$GyB`!RLD?Pon6|9s^baG+`_N1%Q%5 zP#7kkHvU_7gK@<I!*Fb3N0N!nZ`I#1iq=!{>Kjv)^;#a^f$CbT3^IDW#nqI`Wd(%T zBB_{vzDe|O>cfg)5n&((4hVR9LLJCm%Ge(y*H?9Q!LeW$yGg$j9JX1t6q-q1kLz?W z4M*8AEP&-zY@0=3uiq0t2Dv$JV}61Pr{Ju9>*p2WP3|FO!hZdgE(BXNYh*O|qV9)E z%H*3aC++p>%U}qx=pX_`r_{C#p&33))?3l=sCX9rB<I&YS87tHtO=dQ)7c*q@}*Tl zLq;duE-}|nBoh1dH>zr{vUU1`EuvL6&a`*9o2U&U^mgP`agAzFi5`}P&^|J0#vCYk za-o>V7&;dd!h;ixH-9KQf{t$AX@%mW2?Pt|z$q6V{o_8e*0Q0Y%L>8|#^_g<eN1S? zB~+wmSzLZgGO3*gz81h!OWUK?IHc*WxGxVZ&y!1+XAdbM3=T#fCs)2Lfo3FF@+YWb zCl5fbmbq?uqu#G|M*&*4x%vw|l(#lUwh)<`KUloFd#c`w4x$6qYZKx{V<)Tw0^*y@ zFIc=K?XtJJ?V?Ary&8qQ%xm*(+JkhWDTk{5QmdQht!i8Il%t$ms|`ZTgAd!}h--{L zR$!F~2i<IXSvFLlJ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001 diff --git a/libs/stb/stb_image.h b/libs/stb/stb_image.h new file mode 100644 index 0000000000..5405380c11 --- /dev/null +++ b/libs/stb/stb_image.h @@ -0,0 +1,7547 @@ +/* stb_image - v2.22 - public domain image loader - http://nothings.org/stb + no warranty implied; use at your own risk + + Do this: + #define STB_IMAGE_IMPLEMENTATION + before you include this file in *one* C or C++ file to create the implementation. + + // i.e. it should look like this: + #include ... + #include ... + #include ... + #define STB_IMAGE_IMPLEMENTATION + #include "stb_image.h" + + You can #define STBI_ASSERT(x) before the #include to avoid using assert.h. + And #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free + + + QUICK NOTES: + Primarily of interest to game developers and other people who can + avoid problematic images and only need the trivial interface + + JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib) + PNG 1/2/4/8/16-bit-per-channel + + TGA (not sure what subset, if a subset) + BMP non-1bpp, non-RLE + PSD (composited view only, no extra channels, 8/16 bit-per-channel) + + GIF (*comp always reports as 4-channel) + HDR (radiance rgbE format) + PIC (Softimage PIC) + PNM (PPM and PGM binary only) + + Animated GIF still needs a proper API, but here's one way to do it: + http://gist.github.com/urraka/685d9a6340b26b830d49 + + - decode from memory or through FILE (define STBI_NO_STDIO to remove code) + - decode from arbitrary I/O callbacks + - SIMD acceleration on x86/x64 (SSE2) and ARM (NEON) + + Full documentation under "DOCUMENTATION" below. + + +LICENSE + + See end of file for license information. + +RECENT REVISION HISTORY: + + 2.22 (2019-03-04) gif fixes, fix warnings + 2.21 (2019-02-25) fix typo in comment + 2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs + 2.19 (2018-02-11) fix warning + 2.18 (2018-01-30) fix warnings + 2.17 (2018-01-29) bugfix, 1-bit BMP, 16-bitness query, fix warnings + 2.16 (2017-07-23) all functions have 16-bit variants; optimizations; bugfixes + 2.15 (2017-03-18) fix png-1,2,4; all Imagenet JPGs; no runtime SSE detection on GCC + 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs + 2.13 (2016-12-04) experimental 16-bit API, only for PNG so far; fixes + 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes + 2.11 (2016-04-02) 16-bit PNGS; enable SSE2 in non-gcc x64 + RGB-format JPEG; remove white matting in PSD; + allocate large structures on the stack; + correct channel count for PNG & BMP + 2.10 (2016-01-22) avoid warning introduced in 2.09 + 2.09 (2016-01-16) 16-bit TGA; comments in PNM files; STBI_REALLOC_SIZED + + See end of file for full revision history. + + + ============================ Contributors ========================= + + Image formats Extensions, features + Sean Barrett (jpeg, png, bmp) Jetro Lauha (stbi_info) + Nicolas Schulz (hdr, psd) Martin "SpartanJ" Golini (stbi_info) + Jonathan Dummer (tga) James "moose2000" Brown (iPhone PNG) + Jean-Marc Lienher (gif) Ben "Disch" Wenger (io callbacks) + Tom Seddon (pic) Omar Cornut (1/2/4-bit PNG) + Thatcher Ulrich (psd) Nicolas Guillemot (vertical flip) + Ken Miller (pgm, ppm) Richard Mitton (16-bit PSD) + github:urraka (animated gif) Junggon Kim (PNM comments) + Christopher Forseth (animated gif) Daniel Gibson (16-bit TGA) + socks-the-fox (16-bit PNG) + Jeremy Sawicki (handle all ImageNet JPGs) + Optimizations & bugfixes Mikhail Morozov (1-bit BMP) + Fabian "ryg" Giesen Anael Seghezzi (is-16-bit query) + Arseny Kapoulkine + John-Mark Allen + Carmelo J Fdez-Aguera + + Bug & warning fixes + Marc LeBlanc David Woo Guillaume George Martins Mozeiko + Christpher Lloyd Jerry Jansson Joseph Thomson Phil Jordan + Dave Moore Roy Eltham Hayaki Saito Nathan Reed + Won Chun Luke Graham Johan Duparc Nick Verigakis + the Horde3D community Thomas Ruf Ronny Chevalier github:rlyeh + Janez Zemva John Bartholomew Michal Cichon github:romigrou + Jonathan Blow Ken Hamada Tero Hanninen github:svdijk + Laurent Gomila Cort Stratton Sergio Gonzalez github:snagar + Aruelien Pocheville Thibault Reuille Cass Everitt github:Zelex + Ryamond Barbiero Paul Du Bois Engin Manap github:grim210 + Aldo Culquicondor Philipp Wiesemann Dale Weiler github:sammyhw + Oriol Ferrer Mesia Josh Tobin Matthew Gregan github:phprus + Julian Raschke Gregory Mullen Baldur Karlsson github:poppolopoppo + Christian Floisand Kevin Schmidt JR Smith github:darealshinji + Blazej Dariusz Roszkowski github:Michaelangel007 +*/ + +#ifndef STBI_INCLUDE_STB_IMAGE_H +#define STBI_INCLUDE_STB_IMAGE_H + +// DOCUMENTATION +// +// Limitations: +// - no 12-bit-per-channel JPEG +// - no JPEGs with arithmetic coding +// - GIF always returns *comp=4 +// +// Basic usage (see HDR discussion below for HDR usage): +// int x,y,n; +// unsigned char *data = stbi_load(filename, &x, &y, &n, 0); +// // ... process data if not NULL ... +// // ... x = width, y = height, n = # 8-bit components per pixel ... +// // ... replace '0' with '1'..'4' to force that many components per pixel +// // ... but 'n' will always be the number that it would have been if you said 0 +// stbi_image_free(data) +// +// Standard parameters: +// int *x -- outputs image width in pixels +// int *y -- outputs image height in pixels +// int *channels_in_file -- outputs # of image components in image file +// int desired_channels -- if non-zero, # of image components requested in result +// +// The return value from an image loader is an 'unsigned char *' which points +// to the pixel data, or NULL on an allocation failure or if the image is +// corrupt or invalid. The pixel data consists of *y scanlines of *x pixels, +// with each pixel consisting of N interleaved 8-bit components; the first +// pixel pointed to is top-left-most in the image. There is no padding between +// image scanlines or between pixels, regardless of format. The number of +// components N is 'desired_channels' if desired_channels is non-zero, or +// *channels_in_file otherwise. If desired_channels is non-zero, +// *channels_in_file has the number of components that _would_ have been +// output otherwise. E.g. if you set desired_channels to 4, you will always +// get RGBA output, but you can check *channels_in_file to see if it's trivially +// opaque because e.g. there were only 3 channels in the source image. +// +// An output image with N components has the following components interleaved +// in this order in each pixel: +// +// N=#comp components +// 1 grey +// 2 grey, alpha +// 3 red, green, blue +// 4 red, green, blue, alpha +// +// If image loading fails for any reason, the return value will be NULL, +// and *x, *y, *channels_in_file will be unchanged. The function +// stbi_failure_reason() can be queried for an extremely brief, end-user +// unfriendly explanation of why the load failed. Define STBI_NO_FAILURE_STRINGS +// to avoid compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly +// more user-friendly ones. +// +// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized. +// +// =========================================================================== +// +// UNICODE: +// +// If compiling for Windows and you wish to use Unicode filenames, compile +// with +// #define STBI_WINDOWS_UTF8 +// and pass utf8-encoded filenames. Call stbi_convert_wchar_to_utf8 to convert +// Windows wchar_t filenames to utf8. +// +// =========================================================================== +// +// Philosophy +// +// stb libraries are designed with the following priorities: +// +// 1. easy to use +// 2. easy to maintain +// 3. good performance +// +// Sometimes I let "good performance" creep up in priority over "easy to maintain", +// and for best performance I may provide less-easy-to-use APIs that give higher +// performance, in addition to the easy-to-use ones. Nevertheless, it's important +// to keep in mind that from the standpoint of you, a client of this library, +// all you care about is #1 and #3, and stb libraries DO NOT emphasize #3 above all. +// +// Some secondary priorities arise directly from the first two, some of which +// provide more explicit reasons why performance can't be emphasized. +// +// - Portable ("ease of use") +// - Small source code footprint ("easy to maintain") +// - No dependencies ("ease of use") +// +// =========================================================================== +// +// I/O callbacks +// +// I/O callbacks allow you to read from arbitrary sources, like packaged +// files or some other source. Data read from callbacks are processed +// through a small internal buffer (currently 128 bytes) to try to reduce +// overhead. +// +// The three functions you must define are "read" (reads some bytes of data), +// "skip" (skips some bytes of data), "eof" (reports if the stream is at the end). +// +// =========================================================================== +// +// SIMD support +// +// The JPEG decoder will try to automatically use SIMD kernels on x86 when +// supported by the compiler. For ARM Neon support, you must explicitly +// request it. +// +// (The old do-it-yourself SIMD API is no longer supported in the current +// code.) +// +// On x86, SSE2 will automatically be used when available based on a run-time +// test; if not, the generic C versions are used as a fall-back. On ARM targets, +// the typical path is to have separate builds for NEON and non-NEON devices +// (at least this is true for iOS and Android). Therefore, the NEON support is +// toggled by a build flag: define STBI_NEON to get NEON loops. +// +// If for some reason you do not want to use any of SIMD code, or if +// you have issues compiling it, you can disable it entirely by +// defining STBI_NO_SIMD. +// +// =========================================================================== +// +// HDR image support (disable by defining STBI_NO_HDR) +// +// stb_image supports loading HDR images in general, and currently the Radiance +// .HDR file format specifically. You can still load any file through the existing +// interface; if you attempt to load an HDR file, it will be automatically remapped +// to LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1; +// both of these constants can be reconfigured through this interface: +// +// stbi_hdr_to_ldr_gamma(2.2f); +// stbi_hdr_to_ldr_scale(1.0f); +// +// (note, do not use _inverse_ constants; stbi_image will invert them +// appropriately). +// +// Additionally, there is a new, parallel interface for loading files as +// (linear) floats to preserve the full dynamic range: +// +// float *data = stbi_loadf(filename, &x, &y, &n, 0); +// +// If you load LDR images through this interface, those images will +// be promoted to floating point values, run through the inverse of +// constants corresponding to the above: +// +// stbi_ldr_to_hdr_scale(1.0f); +// stbi_ldr_to_hdr_gamma(2.2f); +// +// Finally, given a filename (or an open file or memory block--see header +// file for details) containing image data, you can query for the "most +// appropriate" interface to use (that is, whether the image is HDR or +// not), using: +// +// stbi_is_hdr(char *filename); +// +// =========================================================================== +// +// iPhone PNG support: +// +// By default we convert iphone-formatted PNGs back to RGB, even though +// they are internally encoded differently. You can disable this conversion +// by calling stbi_convert_iphone_png_to_rgb(0), in which case +// you will always just get the native iphone "format" through (which +// is BGR stored in RGB). +// +// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per +// pixel to remove any premultiplied alpha *only* if the image file explicitly +// says there's premultiplied data (currently only happens in iPhone images, +// and only if iPhone convert-to-rgb processing is on). +// +// =========================================================================== +// +// ADDITIONAL CONFIGURATION +// +// - You can suppress implementation of any of the decoders to reduce +// your code footprint by #defining one or more of the following +// symbols before creating the implementation. +// +// STBI_NO_JPEG +// STBI_NO_PNG +// STBI_NO_BMP +// STBI_NO_PSD +// STBI_NO_TGA +// STBI_NO_GIF +// STBI_NO_HDR +// STBI_NO_PIC +// STBI_NO_PNM (.ppm and .pgm) +// +// - You can request *only* certain decoders and suppress all other ones +// (this will be more forward-compatible, as addition of new decoders +// doesn't require you to disable them explicitly): +// +// STBI_ONLY_JPEG +// STBI_ONLY_PNG +// STBI_ONLY_BMP +// STBI_ONLY_PSD +// STBI_ONLY_TGA +// STBI_ONLY_GIF +// STBI_ONLY_HDR +// STBI_ONLY_PIC +// STBI_ONLY_PNM (.ppm and .pgm) +// +// - If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still +// want the zlib decoder to be available, #define STBI_SUPPORT_ZLIB +// + + +#ifndef STBI_NO_STDIO +#include <stdio.h> +#endif // STBI_NO_STDIO + +#define STBI_VERSION 1 + +enum +{ + STBI_default = 0, // only used for desired_channels + + STBI_grey = 1, + STBI_grey_alpha = 2, + STBI_rgb = 3, + STBI_rgb_alpha = 4 +}; + +#include <stdlib.h> +typedef unsigned char stbi_uc; +typedef unsigned short stbi_us; + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef STBIDEF +#ifdef STB_IMAGE_STATIC +#define STBIDEF static +#else +#define STBIDEF extern +#endif +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// PRIMARY API - works on images of any type +// + +// +// load image by filename, open file, or memory buffer +// + +typedef struct +{ + int (*read) (void *user,char *data,int size); // fill 'data' with 'size' bytes. return number of bytes actually read + void (*skip) (void *user,int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative + int (*eof) (void *user); // returns nonzero if we are at end of file/data +} stbi_io_callbacks; + +//////////////////////////////////// +// +// 8-bits-per-channel interface +// + +STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels); +STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *channels_in_file, int desired_channels); + +#ifndef STBI_NO_STDIO +STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); +STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); +// for stbi_load_from_file, file pointer is left pointing immediately after image +#endif + +#ifndef STBI_NO_GIF +STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp); +#endif + +#ifdef STBI_WINDOWS_UTF8 +STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input); +#endif + +//////////////////////////////////// +// +// 16-bits-per-channel interface +// + +STBIDEF stbi_us *stbi_load_16_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels); +STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels); + +#ifndef STBI_NO_STDIO +STBIDEF stbi_us *stbi_load_16 (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); +STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); +#endif + +//////////////////////////////////// +// +// float-per-channel interface +// +#ifndef STBI_NO_LINEAR + STBIDEF float *stbi_loadf_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels); + STBIDEF float *stbi_loadf_from_callbacks (stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels); + + #ifndef STBI_NO_STDIO + STBIDEF float *stbi_loadf (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); + STBIDEF float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); + #endif +#endif + +#ifndef STBI_NO_HDR + STBIDEF void stbi_hdr_to_ldr_gamma(float gamma); + STBIDEF void stbi_hdr_to_ldr_scale(float scale); +#endif // STBI_NO_HDR + +#ifndef STBI_NO_LINEAR + STBIDEF void stbi_ldr_to_hdr_gamma(float gamma); + STBIDEF void stbi_ldr_to_hdr_scale(float scale); +#endif // STBI_NO_LINEAR + +// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR +STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user); +STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len); +#ifndef STBI_NO_STDIO +STBIDEF int stbi_is_hdr (char const *filename); +STBIDEF int stbi_is_hdr_from_file(FILE *f); +#endif // STBI_NO_STDIO + + +// get a VERY brief reason for failure +// NOT THREADSAFE +STBIDEF const char *stbi_failure_reason (void); + +// free the loaded image -- this is just free() +STBIDEF void stbi_image_free (void *retval_from_stbi_load); + +// get image dimensions & components without fully decoding +STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); +STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp); +STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len); +STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *clbk, void *user); + +#ifndef STBI_NO_STDIO +STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp); +STBIDEF int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); +STBIDEF int stbi_is_16_bit (char const *filename); +STBIDEF int stbi_is_16_bit_from_file(FILE *f); +#endif + + + +// for image formats that explicitly notate that they have premultiplied alpha, +// we just return the colors as stored in the file. set this flag to force +// unpremultiplication. results are undefined if the unpremultiply overflow. +STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply); + +// indicate whether we should process iphone images back to canonical format, +// or just pass them through "as-is" +STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert); + +// flip the image vertically, so the first pixel in the output array is the bottom left +STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip); + +// ZLIB client - used by PNG, available for other purposes + +STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen); +STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header); +STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen); +STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); + +STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen); +STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); + + +#ifdef __cplusplus +} +#endif + +// +// +//// end header file ///////////////////////////////////////////////////// +#endif // STBI_INCLUDE_STB_IMAGE_H + +#ifdef STB_IMAGE_IMPLEMENTATION + +#if defined(STBI_ONLY_JPEG) || defined(STBI_ONLY_PNG) || defined(STBI_ONLY_BMP) \ + || defined(STBI_ONLY_TGA) || defined(STBI_ONLY_GIF) || defined(STBI_ONLY_PSD) \ + || defined(STBI_ONLY_HDR) || defined(STBI_ONLY_PIC) || defined(STBI_ONLY_PNM) \ + || defined(STBI_ONLY_ZLIB) + #ifndef STBI_ONLY_JPEG + #define STBI_NO_JPEG + #endif + #ifndef STBI_ONLY_PNG + #define STBI_NO_PNG + #endif + #ifndef STBI_ONLY_BMP + #define STBI_NO_BMP + #endif + #ifndef STBI_ONLY_PSD + #define STBI_NO_PSD + #endif + #ifndef STBI_ONLY_TGA + #define STBI_NO_TGA + #endif + #ifndef STBI_ONLY_GIF + #define STBI_NO_GIF + #endif + #ifndef STBI_ONLY_HDR + #define STBI_NO_HDR + #endif + #ifndef STBI_ONLY_PIC + #define STBI_NO_PIC + #endif + #ifndef STBI_ONLY_PNM + #define STBI_NO_PNM + #endif +#endif + +#if defined(STBI_NO_PNG) && !defined(STBI_SUPPORT_ZLIB) && !defined(STBI_NO_ZLIB) +#define STBI_NO_ZLIB +#endif + + +#include <stdarg.h> +#include <stddef.h> // ptrdiff_t on osx +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) +#include <math.h> // ldexp, pow +#endif + +#ifndef STBI_NO_STDIO +#include <stdio.h> +#endif + +#ifndef STBI_ASSERT +#include <assert.h> +#define STBI_ASSERT(x) assert(x) +#endif + +#ifdef __cplusplus +#define STBI_EXTERN extern "C" +#else +#define STBI_EXTERN extern +#endif + + +#ifndef _MSC_VER + #ifdef __cplusplus + #define stbi_inline inline + #else + #define stbi_inline + #endif +#else + #define stbi_inline __forceinline +#endif + + +#ifdef _MSC_VER +typedef unsigned short stbi__uint16; +typedef signed short stbi__int16; +typedef unsigned int stbi__uint32; +typedef signed int stbi__int32; +#else +#include <stdint.h> +typedef uint16_t stbi__uint16; +typedef int16_t stbi__int16; +typedef uint32_t stbi__uint32; +typedef int32_t stbi__int32; +#endif + +// should produce compiler error if size is wrong +typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1]; + +#ifdef _MSC_VER +#define STBI_NOTUSED(v) (void)(v) +#else +#define STBI_NOTUSED(v) (void)sizeof(v) +#endif + +#ifdef _MSC_VER +#define STBI_HAS_LROTL +#endif + +#ifdef STBI_HAS_LROTL + #define stbi_lrot(x,y) _lrotl(x,y) +#else + #define stbi_lrot(x,y) (((x) << (y)) | ((x) >> (32 - (y)))) +#endif + +#if defined(STBI_MALLOC) && defined(STBI_FREE) && (defined(STBI_REALLOC) || defined(STBI_REALLOC_SIZED)) +// ok +#elif !defined(STBI_MALLOC) && !defined(STBI_FREE) && !defined(STBI_REALLOC) && !defined(STBI_REALLOC_SIZED) +// ok +#else +#error "Must define all or none of STBI_MALLOC, STBI_FREE, and STBI_REALLOC (or STBI_REALLOC_SIZED)." +#endif + +#ifndef STBI_MALLOC +#define STBI_MALLOC(sz) malloc(sz) +#define STBI_REALLOC(p,newsz) realloc(p,newsz) +#define STBI_FREE(p) free(p) +#endif + +#ifndef STBI_REALLOC_SIZED +#define STBI_REALLOC_SIZED(p,oldsz,newsz) STBI_REALLOC(p,newsz) +#endif + +// x86/x64 detection +#if defined(__x86_64__) || defined(_M_X64) +#define STBI__X64_TARGET +#elif defined(__i386) || defined(_M_IX86) +#define STBI__X86_TARGET +#endif + +#if defined(__GNUC__) && defined(STBI__X86_TARGET) && !defined(__SSE2__) && !defined(STBI_NO_SIMD) +// gcc doesn't support sse2 intrinsics unless you compile with -msse2, +// which in turn means it gets to use SSE2 everywhere. This is unfortunate, +// but previous attempts to provide the SSE2 functions with runtime +// detection caused numerous issues. The way architecture extensions are +// exposed in GCC/Clang is, sadly, not really suited for one-file libs. +// New behavior: if compiled with -msse2, we use SSE2 without any +// detection; if not, we don't use it at all. +#define STBI_NO_SIMD +#endif + +#if defined(__MINGW32__) && defined(STBI__X86_TARGET) && !defined(STBI_MINGW_ENABLE_SSE2) && !defined(STBI_NO_SIMD) +// Note that __MINGW32__ doesn't actually mean 32-bit, so we have to avoid STBI__X64_TARGET +// +// 32-bit MinGW wants ESP to be 16-byte aligned, but this is not in the +// Windows ABI and VC++ as well as Windows DLLs don't maintain that invariant. +// As a result, enabling SSE2 on 32-bit MinGW is dangerous when not +// simultaneously enabling "-mstackrealign". +// +// See https://github.com/nothings/stb/issues/81 for more information. +// +// So default to no SSE2 on 32-bit MinGW. If you've read this far and added +// -mstackrealign to your build settings, feel free to #define STBI_MINGW_ENABLE_SSE2. +#define STBI_NO_SIMD +#endif + +#if !defined(STBI_NO_SIMD) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET)) +#define STBI_SSE2 +#include <emmintrin.h> + +#ifdef _MSC_VER + +#if _MSC_VER >= 1400 // not VC6 +#include <intrin.h> // __cpuid +static int stbi__cpuid3(void) +{ + int info[4]; + __cpuid(info,1); + return info[3]; +} +#else +static int stbi__cpuid3(void) +{ + int res; + __asm { + mov eax,1 + cpuid + mov res,edx + } + return res; +} +#endif + +#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name + +#if !defined(STBI_NO_JPEG) && defined(STBI_SSE2) +static int stbi__sse2_available(void) +{ + int info3 = stbi__cpuid3(); + return ((info3 >> 26) & 1) != 0; +} +#endif + +#else // assume GCC-style if not VC++ +#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16))) + +#if !defined(STBI_NO_JPEG) && defined(STBI_SSE2) +static int stbi__sse2_available(void) +{ + // If we're even attempting to compile this on GCC/Clang, that means + // -msse2 is on, which means the compiler is allowed to use SSE2 + // instructions at will, and so are we. + return 1; +} +#endif + +#endif +#endif + +// ARM NEON +#if defined(STBI_NO_SIMD) && defined(STBI_NEON) +#undef STBI_NEON +#endif + +#ifdef STBI_NEON +#include <arm_neon.h> +// assume GCC or Clang on ARM targets +#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16))) +#endif + +#ifndef STBI_SIMD_ALIGN +#define STBI_SIMD_ALIGN(type, name) type name +#endif + +/////////////////////////////////////////////// +// +// stbi__context struct and start_xxx functions + +// stbi__context structure is our basic context used by all images, so it +// contains all the IO context, plus some basic image information +typedef struct +{ + stbi__uint32 img_x, img_y; + int img_n, img_out_n; + + stbi_io_callbacks io; + void *io_user_data; + + int read_from_callbacks; + int buflen; + stbi_uc buffer_start[128]; + + stbi_uc *img_buffer, *img_buffer_end; + stbi_uc *img_buffer_original, *img_buffer_original_end; +} stbi__context; + + +static void stbi__refill_buffer(stbi__context *s); + +// initialize a memory-decode context +static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len) +{ + s->io.read = NULL; + s->read_from_callbacks = 0; + s->img_buffer = s->img_buffer_original = (stbi_uc *) buffer; + s->img_buffer_end = s->img_buffer_original_end = (stbi_uc *) buffer+len; +} + +// initialize a callback-based context +static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user) +{ + s->io = *c; + s->io_user_data = user; + s->buflen = sizeof(s->buffer_start); + s->read_from_callbacks = 1; + s->img_buffer_original = s->buffer_start; + stbi__refill_buffer(s); + s->img_buffer_original_end = s->img_buffer_end; +} + +#ifndef STBI_NO_STDIO + +static int stbi__stdio_read(void *user, char *data, int size) +{ + return (int) fread(data,1,size,(FILE*) user); +} + +static void stbi__stdio_skip(void *user, int n) +{ + fseek((FILE*) user, n, SEEK_CUR); +} + +static int stbi__stdio_eof(void *user) +{ + return feof((FILE*) user); +} + +static stbi_io_callbacks stbi__stdio_callbacks = +{ + stbi__stdio_read, + stbi__stdio_skip, + stbi__stdio_eof, +}; + +static void stbi__start_file(stbi__context *s, FILE *f) +{ + stbi__start_callbacks(s, &stbi__stdio_callbacks, (void *) f); +} + +//static void stop_file(stbi__context *s) { } + +#endif // !STBI_NO_STDIO + +static void stbi__rewind(stbi__context *s) +{ + // conceptually rewind SHOULD rewind to the beginning of the stream, + // but we just rewind to the beginning of the initial buffer, because + // we only use it after doing 'test', which only ever looks at at most 92 bytes + s->img_buffer = s->img_buffer_original; + s->img_buffer_end = s->img_buffer_original_end; +} + +enum +{ + STBI_ORDER_RGB, + STBI_ORDER_BGR +}; + +typedef struct +{ + int bits_per_channel; + int num_channels; + int channel_order; +} stbi__result_info; + +#ifndef STBI_NO_JPEG +static int stbi__jpeg_test(stbi__context *s); +static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_PNG +static int stbi__png_test(stbi__context *s); +static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp); +static int stbi__png_is16(stbi__context *s); +#endif + +#ifndef STBI_NO_BMP +static int stbi__bmp_test(stbi__context *s); +static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_TGA +static int stbi__tga_test(stbi__context *s); +static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_PSD +static int stbi__psd_test(stbi__context *s); +static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc); +static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp); +static int stbi__psd_is16(stbi__context *s); +#endif + +#ifndef STBI_NO_HDR +static int stbi__hdr_test(stbi__context *s); +static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_PIC +static int stbi__pic_test(stbi__context *s); +static void *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_GIF +static int stbi__gif_test(stbi__context *s); +static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, int *z, int *comp, int req_comp); +static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_PNM +static int stbi__pnm_test(stbi__context *s); +static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +// this is not threadsafe +static const char *stbi__g_failure_reason; + +STBIDEF const char *stbi_failure_reason(void) +{ + return stbi__g_failure_reason; +} + +static int stbi__err(const char *str) +{ + stbi__g_failure_reason = str; + return 0; +} + +static void *stbi__malloc(size_t size) +{ + return STBI_MALLOC(size); +} + +// stb_image uses ints pervasively, including for offset calculations. +// therefore the largest decoded image size we can support with the +// current code, even on 64-bit targets, is INT_MAX. this is not a +// significant limitation for the intended use case. +// +// we do, however, need to make sure our size calculations don't +// overflow. hence a few helper functions for size calculations that +// multiply integers together, making sure that they're non-negative +// and no overflow occurs. + +// return 1 if the sum is valid, 0 on overflow. +// negative terms are considered invalid. +static int stbi__addsizes_valid(int a, int b) +{ + if (b < 0) return 0; + // now 0 <= b <= INT_MAX, hence also + // 0 <= INT_MAX - b <= INTMAX. + // And "a + b <= INT_MAX" (which might overflow) is the + // same as a <= INT_MAX - b (no overflow) + return a <= INT_MAX - b; +} + +// returns 1 if the product is valid, 0 on overflow. +// negative factors are considered invalid. +static int stbi__mul2sizes_valid(int a, int b) +{ + if (a < 0 || b < 0) return 0; + if (b == 0) return 1; // mul-by-0 is always safe + // portable way to check for no overflows in a*b + return a <= INT_MAX/b; +} + +// returns 1 if "a*b + add" has no negative terms/factors and doesn't overflow +static int stbi__mad2sizes_valid(int a, int b, int add) +{ + return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add); +} + +// returns 1 if "a*b*c + add" has no negative terms/factors and doesn't overflow +static int stbi__mad3sizes_valid(int a, int b, int c, int add) +{ + return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && + stbi__addsizes_valid(a*b*c, add); +} + +// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow +#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) +static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add) +{ + return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && + stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add); +} +#endif + +// mallocs with size overflow checking +static void *stbi__malloc_mad2(int a, int b, int add) +{ + if (!stbi__mad2sizes_valid(a, b, add)) return NULL; + return stbi__malloc(a*b + add); +} + +static void *stbi__malloc_mad3(int a, int b, int c, int add) +{ + if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL; + return stbi__malloc(a*b*c + add); +} + +#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) +static void *stbi__malloc_mad4(int a, int b, int c, int d, int add) +{ + if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL; + return stbi__malloc(a*b*c*d + add); +} +#endif + +// stbi__err - error +// stbi__errpf - error returning pointer to float +// stbi__errpuc - error returning pointer to unsigned char + +#ifdef STBI_NO_FAILURE_STRINGS + #define stbi__err(x,y) 0 +#elif defined(STBI_FAILURE_USERMSG) + #define stbi__err(x,y) stbi__err(y) +#else + #define stbi__err(x,y) stbi__err(x) +#endif + +#define stbi__errpf(x,y) ((float *)(size_t) (stbi__err(x,y)?NULL:NULL)) +#define stbi__errpuc(x,y) ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL)) + +STBIDEF void stbi_image_free(void *retval_from_stbi_load) +{ + STBI_FREE(retval_from_stbi_load); +} + +#ifndef STBI_NO_LINEAR +static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp); +#endif + +#ifndef STBI_NO_HDR +static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp); +#endif + +static int stbi__vertically_flip_on_load = 0; + +STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip) +{ + stbi__vertically_flip_on_load = flag_true_if_should_flip; +} + +static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) +{ + memset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields + ri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed + ri->channel_order = STBI_ORDER_RGB; // all current input & output are this, but this is here so we can add BGR order + ri->num_channels = 0; + + #ifndef STBI_NO_JPEG + if (stbi__jpeg_test(s)) return stbi__jpeg_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_PNG + if (stbi__png_test(s)) return stbi__png_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_BMP + if (stbi__bmp_test(s)) return stbi__bmp_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_GIF + if (stbi__gif_test(s)) return stbi__gif_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_PSD + if (stbi__psd_test(s)) return stbi__psd_load(s,x,y,comp,req_comp, ri, bpc); + #endif + #ifndef STBI_NO_PIC + if (stbi__pic_test(s)) return stbi__pic_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_PNM + if (stbi__pnm_test(s)) return stbi__pnm_load(s,x,y,comp,req_comp, ri); + #endif + + #ifndef STBI_NO_HDR + if (stbi__hdr_test(s)) { + float *hdr = stbi__hdr_load(s, x,y,comp,req_comp, ri); + return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); + } + #endif + + #ifndef STBI_NO_TGA + // test tga last because it's a crappy test! + if (stbi__tga_test(s)) + return stbi__tga_load(s,x,y,comp,req_comp, ri); + #endif + + return stbi__errpuc("unknown image type", "Image not of any known type, or corrupt"); +} + +static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, int channels) +{ + int i; + int img_len = w * h * channels; + stbi_uc *reduced; + + reduced = (stbi_uc *) stbi__malloc(img_len); + if (reduced == NULL) return stbi__errpuc("outofmem", "Out of memory"); + + for (i = 0; i < img_len; ++i) + reduced[i] = (stbi_uc)((orig[i] >> 8) & 0xFF); // top half of each byte is sufficient approx of 16->8 bit scaling + + STBI_FREE(orig); + return reduced; +} + +static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels) +{ + int i; + int img_len = w * h * channels; + stbi__uint16 *enlarged; + + enlarged = (stbi__uint16 *) stbi__malloc(img_len*2); + if (enlarged == NULL) return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory"); + + for (i = 0; i < img_len; ++i) + enlarged[i] = (stbi__uint16)((orig[i] << 8) + orig[i]); // replicate to high and low byte, maps 0->0, 255->0xffff + + STBI_FREE(orig); + return enlarged; +} + +static void stbi__vertical_flip(void *image, int w, int h, int bytes_per_pixel) +{ + int row; + size_t bytes_per_row = (size_t)w * bytes_per_pixel; + stbi_uc temp[2048]; + stbi_uc *bytes = (stbi_uc *)image; + + for (row = 0; row < (h>>1); row++) { + stbi_uc *row0 = bytes + row*bytes_per_row; + stbi_uc *row1 = bytes + (h - row - 1)*bytes_per_row; + // swap row0 with row1 + size_t bytes_left = bytes_per_row; + while (bytes_left) { + size_t bytes_copy = (bytes_left < sizeof(temp)) ? bytes_left : sizeof(temp); + memcpy(temp, row0, bytes_copy); + memcpy(row0, row1, bytes_copy); + memcpy(row1, temp, bytes_copy); + row0 += bytes_copy; + row1 += bytes_copy; + bytes_left -= bytes_copy; + } + } +} + +#ifndef STBI_NO_GIF +static void stbi__vertical_flip_slices(void *image, int w, int h, int z, int bytes_per_pixel) +{ + int slice; + int slice_size = w * h * bytes_per_pixel; + + stbi_uc *bytes = (stbi_uc *)image; + for (slice = 0; slice < z; ++slice) { + stbi__vertical_flip(bytes, w, h, bytes_per_pixel); + bytes += slice_size; + } +} +#endif + +static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp) +{ + stbi__result_info ri; + void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8); + + if (result == NULL) + return NULL; + + if (ri.bits_per_channel != 8) { + STBI_ASSERT(ri.bits_per_channel == 16); + result = stbi__convert_16_to_8((stbi__uint16 *) result, *x, *y, req_comp == 0 ? *comp : req_comp); + ri.bits_per_channel = 8; + } + + // @TODO: move stbi__convert_format to here + + if (stbi__vertically_flip_on_load) { + int channels = req_comp ? req_comp : *comp; + stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi_uc)); + } + + return (unsigned char *) result; +} + +static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp) +{ + stbi__result_info ri; + void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 16); + + if (result == NULL) + return NULL; + + if (ri.bits_per_channel != 16) { + STBI_ASSERT(ri.bits_per_channel == 8); + result = stbi__convert_8_to_16((stbi_uc *) result, *x, *y, req_comp == 0 ? *comp : req_comp); + ri.bits_per_channel = 16; + } + + // @TODO: move stbi__convert_format16 to here + // @TODO: special case RGB-to-Y (and RGBA-to-YA) for 8-bit-to-16-bit case to keep more precision + + if (stbi__vertically_flip_on_load) { + int channels = req_comp ? req_comp : *comp; + stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi__uint16)); + } + + return (stbi__uint16 *) result; +} + +#if !defined(STBI_NO_HDR) && !defined(STBI_NO_LINEAR) +static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp) +{ + if (stbi__vertically_flip_on_load && result != NULL) { + int channels = req_comp ? req_comp : *comp; + stbi__vertical_flip(result, *x, *y, channels * sizeof(float)); + } +} +#endif + +#ifndef STBI_NO_STDIO + +#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) +STBI_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); +STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); +#endif + +#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) +STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) +{ + return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); +} +#endif + +static FILE *stbi__fopen(char const *filename, char const *mode) +{ + FILE *f; +#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) + wchar_t wMode[64]; + wchar_t wFilename[1024]; + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename))) + return 0; + + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode))) + return 0; + +#if _MSC_VER >= 1400 + if (0 != _wfopen_s(&f, wFilename, wMode)) + f = 0; +#else + f = _wfopen(wFilename, wMode); +#endif + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + if (0 != fopen_s(&f, filename, mode)) + f=0; +#else + f = fopen(filename, mode); +#endif + return f; +} + + +STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + FILE *f = stbi__fopen(filename, "rb"); + unsigned char *result; + if (!f) return stbi__errpuc("can't fopen", "Unable to open file"); + result = stbi_load_from_file(f,x,y,comp,req_comp); + fclose(f); + return result; +} + +STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *result; + stbi__context s; + stbi__start_file(&s,f); + result = stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); + if (result) { + // need to 'unget' all the characters in the IO buffer + fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR); + } + return result; +} + +STBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + stbi__uint16 *result; + stbi__context s; + stbi__start_file(&s,f); + result = stbi__load_and_postprocess_16bit(&s,x,y,comp,req_comp); + if (result) { + // need to 'unget' all the characters in the IO buffer + fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR); + } + return result; +} + +STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + FILE *f = stbi__fopen(filename, "rb"); + stbi__uint16 *result; + if (!f) return (stbi_us *) stbi__errpuc("can't fopen", "Unable to open file"); + result = stbi_load_from_file_16(f,x,y,comp,req_comp); + fclose(f); + return result; +} + + +#endif //!STBI_NO_STDIO + +STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels); +} + +STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user); + return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels); +} + +STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); +} + +STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); + return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); +} + +#ifndef STBI_NO_GIF +STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp) +{ + unsigned char *result; + stbi__context s; + stbi__start_mem(&s,buffer,len); + + result = (unsigned char*) stbi__load_gif_main(&s, delays, x, y, z, comp, req_comp); + if (stbi__vertically_flip_on_load) { + stbi__vertical_flip_slices( result, *x, *y, *z, *comp ); + } + + return result; +} +#endif + +#ifndef STBI_NO_LINEAR +static float *stbi__loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *data; + #ifndef STBI_NO_HDR + if (stbi__hdr_test(s)) { + stbi__result_info ri; + float *hdr_data = stbi__hdr_load(s,x,y,comp,req_comp, &ri); + if (hdr_data) + stbi__float_postprocess(hdr_data,x,y,comp,req_comp); + return hdr_data; + } + #endif + data = stbi__load_and_postprocess_8bit(s, x, y, comp, req_comp); + if (data) + return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); + return stbi__errpf("unknown image type", "Image not of any known type, or corrupt"); +} + +STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__loadf_main(&s,x,y,comp,req_comp); +} + +STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); + return stbi__loadf_main(&s,x,y,comp,req_comp); +} + +#ifndef STBI_NO_STDIO +STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + float *result; + FILE *f = stbi__fopen(filename, "rb"); + if (!f) return stbi__errpf("can't fopen", "Unable to open file"); + result = stbi_loadf_from_file(f,x,y,comp,req_comp); + fclose(f); + return result; +} + +STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_file(&s,f); + return stbi__loadf_main(&s,x,y,comp,req_comp); +} +#endif // !STBI_NO_STDIO + +#endif // !STBI_NO_LINEAR + +// these is-hdr-or-not is defined independent of whether STBI_NO_LINEAR is +// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always +// reports false! + +STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len) +{ + #ifndef STBI_NO_HDR + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__hdr_test(&s); + #else + STBI_NOTUSED(buffer); + STBI_NOTUSED(len); + return 0; + #endif +} + +#ifndef STBI_NO_STDIO +STBIDEF int stbi_is_hdr (char const *filename) +{ + FILE *f = stbi__fopen(filename, "rb"); + int result=0; + if (f) { + result = stbi_is_hdr_from_file(f); + fclose(f); + } + return result; +} + +STBIDEF int stbi_is_hdr_from_file(FILE *f) +{ + #ifndef STBI_NO_HDR + long pos = ftell(f); + int res; + stbi__context s; + stbi__start_file(&s,f); + res = stbi__hdr_test(&s); + fseek(f, pos, SEEK_SET); + return res; + #else + STBI_NOTUSED(f); + return 0; + #endif +} +#endif // !STBI_NO_STDIO + +STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user) +{ + #ifndef STBI_NO_HDR + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); + return stbi__hdr_test(&s); + #else + STBI_NOTUSED(clbk); + STBI_NOTUSED(user); + return 0; + #endif +} + +#ifndef STBI_NO_LINEAR +static float stbi__l2h_gamma=2.2f, stbi__l2h_scale=1.0f; + +STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; } +STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; } +#endif + +static float stbi__h2l_gamma_i=1.0f/2.2f, stbi__h2l_scale_i=1.0f; + +STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; } +STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; } + + +////////////////////////////////////////////////////////////////////////////// +// +// Common code used by all image loaders +// + +enum +{ + STBI__SCAN_load=0, + STBI__SCAN_type, + STBI__SCAN_header +}; + +static void stbi__refill_buffer(stbi__context *s) +{ + int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen); + if (n == 0) { + // at end of file, treat same as if from memory, but need to handle case + // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file + s->read_from_callbacks = 0; + s->img_buffer = s->buffer_start; + s->img_buffer_end = s->buffer_start+1; + *s->img_buffer = 0; + } else { + s->img_buffer = s->buffer_start; + s->img_buffer_end = s->buffer_start + n; + } +} + +stbi_inline static stbi_uc stbi__get8(stbi__context *s) +{ + if (s->img_buffer < s->img_buffer_end) + return *s->img_buffer++; + if (s->read_from_callbacks) { + stbi__refill_buffer(s); + return *s->img_buffer++; + } + return 0; +} + +stbi_inline static int stbi__at_eof(stbi__context *s) +{ + if (s->io.read) { + if (!(s->io.eof)(s->io_user_data)) return 0; + // if feof() is true, check if buffer = end + // special case: we've only got the special 0 character at the end + if (s->read_from_callbacks == 0) return 1; + } + + return s->img_buffer >= s->img_buffer_end; +} + +static void stbi__skip(stbi__context *s, int n) +{ + if (n < 0) { + s->img_buffer = s->img_buffer_end; + return; + } + if (s->io.read) { + int blen = (int) (s->img_buffer_end - s->img_buffer); + if (blen < n) { + s->img_buffer = s->img_buffer_end; + (s->io.skip)(s->io_user_data, n - blen); + return; + } + } + s->img_buffer += n; +} + +static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) +{ + if (s->io.read) { + int blen = (int) (s->img_buffer_end - s->img_buffer); + if (blen < n) { + int res, count; + + memcpy(buffer, s->img_buffer, blen); + + count = (s->io.read)(s->io_user_data, (char*) buffer + blen, n - blen); + res = (count == (n-blen)); + s->img_buffer = s->img_buffer_end; + return res; + } + } + + if (s->img_buffer+n <= s->img_buffer_end) { + memcpy(buffer, s->img_buffer, n); + s->img_buffer += n; + return 1; + } else + return 0; +} + +static int stbi__get16be(stbi__context *s) +{ + int z = stbi__get8(s); + return (z << 8) + stbi__get8(s); +} + +static stbi__uint32 stbi__get32be(stbi__context *s) +{ + stbi__uint32 z = stbi__get16be(s); + return (z << 16) + stbi__get16be(s); +} + +#if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) +// nothing +#else +static int stbi__get16le(stbi__context *s) +{ + int z = stbi__get8(s); + return z + (stbi__get8(s) << 8); +} +#endif + +#ifndef STBI_NO_BMP +static stbi__uint32 stbi__get32le(stbi__context *s) +{ + stbi__uint32 z = stbi__get16le(s); + return z + (stbi__get16le(s) << 16); +} +#endif + +#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings + + +////////////////////////////////////////////////////////////////////////////// +// +// generic converter from built-in img_n to req_comp +// individual types do this automatically as much as possible (e.g. jpeg +// does all cases internally since it needs to colorspace convert anyway, +// and it never has alpha, so very few cases ). png can automatically +// interleave an alpha=255 channel, but falls back to this for other cases +// +// assume data buffer is malloced, so malloc a new one and free that one +// only failure mode is malloc failing + +static stbi_uc stbi__compute_y(int r, int g, int b) +{ + return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8); +} + +static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y) +{ + int i,j; + unsigned char *good; + + if (req_comp == img_n) return data; + STBI_ASSERT(req_comp >= 1 && req_comp <= 4); + + good = (unsigned char *) stbi__malloc_mad3(req_comp, x, y, 0); + if (good == NULL) { + STBI_FREE(data); + return stbi__errpuc("outofmem", "Out of memory"); + } + + for (j=0; j < (int) y; ++j) { + unsigned char *src = data + j * x * img_n ; + unsigned char *dest = good + j * x * req_comp; + + #define STBI__COMBO(a,b) ((a)*8+(b)) + #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) + // convert source image with img_n components to one with req_comp components; + // avoid switch per pixel, so use switch per scanline and massive macros + switch (STBI__COMBO(img_n, req_comp)) { + STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=255; } break; + STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; + STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=255; } break; + STBI__CASE(2,1) { dest[0]=src[0]; } break; + STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; + STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break; + STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=255; } break; + STBI__CASE(3,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break; + STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = 255; } break; + STBI__CASE(4,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break; + STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = src[3]; } break; + STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break; + default: STBI_ASSERT(0); + } + #undef STBI__CASE + } + + STBI_FREE(data); + return good; +} + +static stbi__uint16 stbi__compute_y_16(int r, int g, int b) +{ + return (stbi__uint16) (((r*77) + (g*150) + (29*b)) >> 8); +} + +static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y) +{ + int i,j; + stbi__uint16 *good; + + if (req_comp == img_n) return data; + STBI_ASSERT(req_comp >= 1 && req_comp <= 4); + + good = (stbi__uint16 *) stbi__malloc(req_comp * x * y * 2); + if (good == NULL) { + STBI_FREE(data); + return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory"); + } + + for (j=0; j < (int) y; ++j) { + stbi__uint16 *src = data + j * x * img_n ; + stbi__uint16 *dest = good + j * x * req_comp; + + #define STBI__COMBO(a,b) ((a)*8+(b)) + #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) + // convert source image with img_n components to one with req_comp components; + // avoid switch per pixel, so use switch per scanline and massive macros + switch (STBI__COMBO(img_n, req_comp)) { + STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=0xffff; } break; + STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; + STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=0xffff; } break; + STBI__CASE(2,1) { dest[0]=src[0]; } break; + STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; + STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break; + STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=0xffff; } break; + STBI__CASE(3,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break; + STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = 0xffff; } break; + STBI__CASE(4,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break; + STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = src[3]; } break; + STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break; + default: STBI_ASSERT(0); + } + #undef STBI__CASE + } + + STBI_FREE(data); + return good; +} + +#ifndef STBI_NO_LINEAR +static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp) +{ + int i,k,n; + float *output; + if (!data) return NULL; + output = (float *) stbi__malloc_mad4(x, y, comp, sizeof(float), 0); + if (output == NULL) { STBI_FREE(data); return stbi__errpf("outofmem", "Out of memory"); } + // compute number of non-alpha components + if (comp & 1) n = comp; else n = comp-1; + for (i=0; i < x*y; ++i) { + for (k=0; k < n; ++k) { + output[i*comp + k] = (float) (pow(data[i*comp+k]/255.0f, stbi__l2h_gamma) * stbi__l2h_scale); + } + } + if (n < comp) { + for (i=0; i < x*y; ++i) { + output[i*comp + n] = data[i*comp + n]/255.0f; + } + } + STBI_FREE(data); + return output; +} +#endif + +#ifndef STBI_NO_HDR +#define stbi__float2int(x) ((int) (x)) +static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp) +{ + int i,k,n; + stbi_uc *output; + if (!data) return NULL; + output = (stbi_uc *) stbi__malloc_mad3(x, y, comp, 0); + if (output == NULL) { STBI_FREE(data); return stbi__errpuc("outofmem", "Out of memory"); } + // compute number of non-alpha components + if (comp & 1) n = comp; else n = comp-1; + for (i=0; i < x*y; ++i) { + for (k=0; k < n; ++k) { + float z = (float) pow(data[i*comp+k]*stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f; + if (z < 0) z = 0; + if (z > 255) z = 255; + output[i*comp + k] = (stbi_uc) stbi__float2int(z); + } + if (k < comp) { + float z = data[i*comp+k] * 255 + 0.5f; + if (z < 0) z = 0; + if (z > 255) z = 255; + output[i*comp + k] = (stbi_uc) stbi__float2int(z); + } + } + STBI_FREE(data); + return output; +} +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// "baseline" JPEG/JFIF decoder +// +// simple implementation +// - doesn't support delayed output of y-dimension +// - simple interface (only one output format: 8-bit interleaved RGB) +// - doesn't try to recover corrupt jpegs +// - doesn't allow partial loading, loading multiple at once +// - still fast on x86 (copying globals into locals doesn't help x86) +// - allocates lots of intermediate memory (full size of all components) +// - non-interleaved case requires this anyway +// - allows good upsampling (see next) +// high-quality +// - upsampled channels are bilinearly interpolated, even across blocks +// - quality integer IDCT derived from IJG's 'slow' +// performance +// - fast huffman; reasonable integer IDCT +// - some SIMD kernels for common paths on targets with SSE2/NEON +// - uses a lot of intermediate memory, could cache poorly + +#ifndef STBI_NO_JPEG + +// huffman decoding acceleration +#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache + +typedef struct +{ + stbi_uc fast[1 << FAST_BITS]; + // weirdly, repacking this into AoS is a 10% speed loss, instead of a win + stbi__uint16 code[256]; + stbi_uc values[256]; + stbi_uc size[257]; + unsigned int maxcode[18]; + int delta[17]; // old 'firstsymbol' - old 'firstcode' +} stbi__huffman; + +typedef struct +{ + stbi__context *s; + stbi__huffman huff_dc[4]; + stbi__huffman huff_ac[4]; + stbi__uint16 dequant[4][64]; + stbi__int16 fast_ac[4][1 << FAST_BITS]; + +// sizes for components, interleaved MCUs + int img_h_max, img_v_max; + int img_mcu_x, img_mcu_y; + int img_mcu_w, img_mcu_h; + +// definition of jpeg image component + struct + { + int id; + int h,v; + int tq; + int hd,ha; + int dc_pred; + + int x,y,w2,h2; + stbi_uc *data; + void *raw_data, *raw_coeff; + stbi_uc *linebuf; + short *coeff; // progressive only + int coeff_w, coeff_h; // number of 8x8 coefficient blocks + } img_comp[4]; + + stbi__uint32 code_buffer; // jpeg entropy-coded buffer + int code_bits; // number of valid bits + unsigned char marker; // marker seen while filling entropy buffer + int nomore; // flag if we saw a marker so must stop + + int progressive; + int spec_start; + int spec_end; + int succ_high; + int succ_low; + int eob_run; + int jfif; + int app14_color_transform; // Adobe APP14 tag + int rgb; + + int scan_n, order[4]; + int restart_interval, todo; + +// kernels + void (*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]); + void (*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step); + stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs); +} stbi__jpeg; + +static int stbi__build_huffman(stbi__huffman *h, int *count) +{ + int i,j,k=0; + unsigned int code; + // build size list for each symbol (from JPEG spec) + for (i=0; i < 16; ++i) + for (j=0; j < count[i]; ++j) + h->size[k++] = (stbi_uc) (i+1); + h->size[k] = 0; + + // compute actual symbols (from jpeg spec) + code = 0; + k = 0; + for(j=1; j <= 16; ++j) { + // compute delta to add to code to compute symbol id + h->delta[j] = k - code; + if (h->size[k] == j) { + while (h->size[k] == j) + h->code[k++] = (stbi__uint16) (code++); + if (code-1 >= (1u << j)) return stbi__err("bad code lengths","Corrupt JPEG"); + } + // compute largest code + 1 for this size, preshifted as needed later + h->maxcode[j] = code << (16-j); + code <<= 1; + } + h->maxcode[j] = 0xffffffff; + + // build non-spec acceleration table; 255 is flag for not-accelerated + memset(h->fast, 255, 1 << FAST_BITS); + for (i=0; i < k; ++i) { + int s = h->size[i]; + if (s <= FAST_BITS) { + int c = h->code[i] << (FAST_BITS-s); + int m = 1 << (FAST_BITS-s); + for (j=0; j < m; ++j) { + h->fast[c+j] = (stbi_uc) i; + } + } + } + return 1; +} + +// build a table that decodes both magnitude and value of small ACs in +// one go. +static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h) +{ + int i; + for (i=0; i < (1 << FAST_BITS); ++i) { + stbi_uc fast = h->fast[i]; + fast_ac[i] = 0; + if (fast < 255) { + int rs = h->values[fast]; + int run = (rs >> 4) & 15; + int magbits = rs & 15; + int len = h->size[fast]; + + if (magbits && len + magbits <= FAST_BITS) { + // magnitude code followed by receive_extend code + int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits); + int m = 1 << (magbits - 1); + if (k < m) k += (~0U << magbits) + 1; + // if the result is small enough, we can fit it in fast_ac table + if (k >= -128 && k <= 127) + fast_ac[i] = (stbi__int16) ((k * 256) + (run * 16) + (len + magbits)); + } + } + } +} + +static void stbi__grow_buffer_unsafe(stbi__jpeg *j) +{ + do { + unsigned int b = j->nomore ? 0 : stbi__get8(j->s); + if (b == 0xff) { + int c = stbi__get8(j->s); + while (c == 0xff) c = stbi__get8(j->s); // consume fill bytes + if (c != 0) { + j->marker = (unsigned char) c; + j->nomore = 1; + return; + } + } + j->code_buffer |= b << (24 - j->code_bits); + j->code_bits += 8; + } while (j->code_bits <= 24); +} + +// (1 << n) - 1 +static const stbi__uint32 stbi__bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535}; + +// decode a jpeg huffman value from the bitstream +stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h) +{ + unsigned int temp; + int c,k; + + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + + // look at the top FAST_BITS and determine what symbol ID it is, + // if the code is <= FAST_BITS + c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); + k = h->fast[c]; + if (k < 255) { + int s = h->size[k]; + if (s > j->code_bits) + return -1; + j->code_buffer <<= s; + j->code_bits -= s; + return h->values[k]; + } + + // naive test is to shift the code_buffer down so k bits are + // valid, then test against maxcode. To speed this up, we've + // preshifted maxcode left so that it has (16-k) 0s at the + // end; in other words, regardless of the number of bits, it + // wants to be compared against something shifted to have 16; + // that way we don't need to shift inside the loop. + temp = j->code_buffer >> 16; + for (k=FAST_BITS+1 ; ; ++k) + if (temp < h->maxcode[k]) + break; + if (k == 17) { + // error! code not found + j->code_bits -= 16; + return -1; + } + + if (k > j->code_bits) + return -1; + + // convert the huffman code to the symbol id + c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k]; + STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]); + + // convert the id to a symbol + j->code_bits -= k; + j->code_buffer <<= k; + return h->values[c]; +} + +// bias[n] = (-1<<n) + 1 +static const int stbi__jbias[16] = {0,-1,-3,-7,-15,-31,-63,-127,-255,-511,-1023,-2047,-4095,-8191,-16383,-32767}; + +// combined JPEG 'receive' and JPEG 'extend', since baseline +// always extends everything it receives. +stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n) +{ + unsigned int k; + int sgn; + if (j->code_bits < n) stbi__grow_buffer_unsafe(j); + + sgn = (stbi__int32)j->code_buffer >> 31; // sign bit is always in MSB + k = stbi_lrot(j->code_buffer, n); + STBI_ASSERT(n >= 0 && n < (int) (sizeof(stbi__bmask)/sizeof(*stbi__bmask))); + j->code_buffer = k & ~stbi__bmask[n]; + k &= stbi__bmask[n]; + j->code_bits -= n; + return k + (stbi__jbias[n] & ~sgn); +} + +// get some unsigned bits +stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n) +{ + unsigned int k; + if (j->code_bits < n) stbi__grow_buffer_unsafe(j); + k = stbi_lrot(j->code_buffer, n); + j->code_buffer = k & ~stbi__bmask[n]; + k &= stbi__bmask[n]; + j->code_bits -= n; + return k; +} + +stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j) +{ + unsigned int k; + if (j->code_bits < 1) stbi__grow_buffer_unsafe(j); + k = j->code_buffer; + j->code_buffer <<= 1; + --j->code_bits; + return k & 0x80000000; +} + +// given a value that's at position X in the zigzag stream, +// where does it appear in the 8x8 matrix coded as row-major? +static const stbi_uc stbi__jpeg_dezigzag[64+15] = +{ + 0, 1, 8, 16, 9, 2, 3, 10, + 17, 24, 32, 25, 18, 11, 4, 5, + 12, 19, 26, 33, 40, 48, 41, 34, + 27, 20, 13, 6, 7, 14, 21, 28, + 35, 42, 49, 56, 57, 50, 43, 36, + 29, 22, 15, 23, 30, 37, 44, 51, + 58, 59, 52, 45, 38, 31, 39, 46, + 53, 60, 61, 54, 47, 55, 62, 63, + // let corrupt input sample past end + 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63 +}; + +// decode one 64-entry block-- +static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi__uint16 *dequant) +{ + int diff,dc,k; + int t; + + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + t = stbi__jpeg_huff_decode(j, hdc); + if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG"); + + // 0 all the ac values now so we can do it 32-bits at a time + memset(data,0,64*sizeof(data[0])); + + diff = t ? stbi__extend_receive(j, t) : 0; + dc = j->img_comp[b].dc_pred + diff; + j->img_comp[b].dc_pred = dc; + data[0] = (short) (dc * dequant[0]); + + // decode AC components, see JPEG spec + k = 1; + do { + unsigned int zig; + int c,r,s; + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); + r = fac[c]; + if (r) { // fast-AC path + k += (r >> 4) & 15; // run + s = r & 15; // combined length + j->code_buffer <<= s; + j->code_bits -= s; + // decode into unzigzag'd location + zig = stbi__jpeg_dezigzag[k++]; + data[zig] = (short) ((r >> 8) * dequant[zig]); + } else { + int rs = stbi__jpeg_huff_decode(j, hac); + if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); + s = rs & 15; + r = rs >> 4; + if (s == 0) { + if (rs != 0xf0) break; // end block + k += 16; + } else { + k += r; + // decode into unzigzag'd location + zig = stbi__jpeg_dezigzag[k++]; + data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]); + } + } + } while (k < 64); + return 1; +} + +static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b) +{ + int diff,dc; + int t; + if (j->spec_end != 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); + + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + + if (j->succ_high == 0) { + // first scan for DC coefficient, must be first + memset(data,0,64*sizeof(data[0])); // 0 all the ac values now + t = stbi__jpeg_huff_decode(j, hdc); + diff = t ? stbi__extend_receive(j, t) : 0; + + dc = j->img_comp[b].dc_pred + diff; + j->img_comp[b].dc_pred = dc; + data[0] = (short) (dc << j->succ_low); + } else { + // refinement scan for DC coefficient + if (stbi__jpeg_get_bit(j)) + data[0] += (short) (1 << j->succ_low); + } + return 1; +} + +// @OPTIMIZE: store non-zigzagged during the decode passes, +// and only de-zigzag when dequantizing +static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac) +{ + int k; + if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); + + if (j->succ_high == 0) { + int shift = j->succ_low; + + if (j->eob_run) { + --j->eob_run; + return 1; + } + + k = j->spec_start; + do { + unsigned int zig; + int c,r,s; + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); + r = fac[c]; + if (r) { // fast-AC path + k += (r >> 4) & 15; // run + s = r & 15; // combined length + j->code_buffer <<= s; + j->code_bits -= s; + zig = stbi__jpeg_dezigzag[k++]; + data[zig] = (short) ((r >> 8) << shift); + } else { + int rs = stbi__jpeg_huff_decode(j, hac); + if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); + s = rs & 15; + r = rs >> 4; + if (s == 0) { + if (r < 15) { + j->eob_run = (1 << r); + if (r) + j->eob_run += stbi__jpeg_get_bits(j, r); + --j->eob_run; + break; + } + k += 16; + } else { + k += r; + zig = stbi__jpeg_dezigzag[k++]; + data[zig] = (short) (stbi__extend_receive(j,s) << shift); + } + } + } while (k <= j->spec_end); + } else { + // refinement scan for these AC coefficients + + short bit = (short) (1 << j->succ_low); + + if (j->eob_run) { + --j->eob_run; + for (k = j->spec_start; k <= j->spec_end; ++k) { + short *p = &data[stbi__jpeg_dezigzag[k]]; + if (*p != 0) + if (stbi__jpeg_get_bit(j)) + if ((*p & bit)==0) { + if (*p > 0) + *p += bit; + else + *p -= bit; + } + } + } else { + k = j->spec_start; + do { + int r,s; + int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh + if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); + s = rs & 15; + r = rs >> 4; + if (s == 0) { + if (r < 15) { + j->eob_run = (1 << r) - 1; + if (r) + j->eob_run += stbi__jpeg_get_bits(j, r); + r = 64; // force end of block + } else { + // r=15 s=0 should write 16 0s, so we just do + // a run of 15 0s and then write s (which is 0), + // so we don't have to do anything special here + } + } else { + if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG"); + // sign bit + if (stbi__jpeg_get_bit(j)) + s = bit; + else + s = -bit; + } + + // advance by r + while (k <= j->spec_end) { + short *p = &data[stbi__jpeg_dezigzag[k++]]; + if (*p != 0) { + if (stbi__jpeg_get_bit(j)) + if ((*p & bit)==0) { + if (*p > 0) + *p += bit; + else + *p -= bit; + } + } else { + if (r == 0) { + *p = (short) s; + break; + } + --r; + } + } + } while (k <= j->spec_end); + } + } + return 1; +} + +// take a -128..127 value and stbi__clamp it and convert to 0..255 +stbi_inline static stbi_uc stbi__clamp(int x) +{ + // trick to use a single test to catch both cases + if ((unsigned int) x > 255) { + if (x < 0) return 0; + if (x > 255) return 255; + } + return (stbi_uc) x; +} + +#define stbi__f2f(x) ((int) (((x) * 4096 + 0.5))) +#define stbi__fsh(x) ((x) * 4096) + +// derived from jidctint -- DCT_ISLOW +#define STBI__IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \ + int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \ + p2 = s2; \ + p3 = s6; \ + p1 = (p2+p3) * stbi__f2f(0.5411961f); \ + t2 = p1 + p3*stbi__f2f(-1.847759065f); \ + t3 = p1 + p2*stbi__f2f( 0.765366865f); \ + p2 = s0; \ + p3 = s4; \ + t0 = stbi__fsh(p2+p3); \ + t1 = stbi__fsh(p2-p3); \ + x0 = t0+t3; \ + x3 = t0-t3; \ + x1 = t1+t2; \ + x2 = t1-t2; \ + t0 = s7; \ + t1 = s5; \ + t2 = s3; \ + t3 = s1; \ + p3 = t0+t2; \ + p4 = t1+t3; \ + p1 = t0+t3; \ + p2 = t1+t2; \ + p5 = (p3+p4)*stbi__f2f( 1.175875602f); \ + t0 = t0*stbi__f2f( 0.298631336f); \ + t1 = t1*stbi__f2f( 2.053119869f); \ + t2 = t2*stbi__f2f( 3.072711026f); \ + t3 = t3*stbi__f2f( 1.501321110f); \ + p1 = p5 + p1*stbi__f2f(-0.899976223f); \ + p2 = p5 + p2*stbi__f2f(-2.562915447f); \ + p3 = p3*stbi__f2f(-1.961570560f); \ + p4 = p4*stbi__f2f(-0.390180644f); \ + t3 += p1+p4; \ + t2 += p2+p3; \ + t1 += p2+p4; \ + t0 += p1+p3; + +static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64]) +{ + int i,val[64],*v=val; + stbi_uc *o; + short *d = data; + + // columns + for (i=0; i < 8; ++i,++d, ++v) { + // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing + if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 + && d[40]==0 && d[48]==0 && d[56]==0) { + // no shortcut 0 seconds + // (1|2|3|4|5|6|7)==0 0 seconds + // all separate -0.047 seconds + // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds + int dcterm = d[0]*4; + v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; + } else { + STBI__IDCT_1D(d[ 0],d[ 8],d[16],d[24],d[32],d[40],d[48],d[56]) + // constants scaled things up by 1<<12; let's bring them back + // down, but keep 2 extra bits of precision + x0 += 512; x1 += 512; x2 += 512; x3 += 512; + v[ 0] = (x0+t3) >> 10; + v[56] = (x0-t3) >> 10; + v[ 8] = (x1+t2) >> 10; + v[48] = (x1-t2) >> 10; + v[16] = (x2+t1) >> 10; + v[40] = (x2-t1) >> 10; + v[24] = (x3+t0) >> 10; + v[32] = (x3-t0) >> 10; + } + } + + for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { + // no fast case since the first 1D IDCT spread components out + STBI__IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) + // constants scaled things up by 1<<12, plus we had 1<<2 from first + // loop, plus horizontal and vertical each scale by sqrt(8) so together + // we've got an extra 1<<3, so 1<<17 total we need to remove. + // so we want to round that, which means adding 0.5 * 1<<17, + // aka 65536. Also, we'll end up with -128 to 127 that we want + // to encode as 0..255 by adding 128, so we'll add that before the shift + x0 += 65536 + (128<<17); + x1 += 65536 + (128<<17); + x2 += 65536 + (128<<17); + x3 += 65536 + (128<<17); + // tried computing the shifts into temps, or'ing the temps to see + // if any were out of range, but that was slower + o[0] = stbi__clamp((x0+t3) >> 17); + o[7] = stbi__clamp((x0-t3) >> 17); + o[1] = stbi__clamp((x1+t2) >> 17); + o[6] = stbi__clamp((x1-t2) >> 17); + o[2] = stbi__clamp((x2+t1) >> 17); + o[5] = stbi__clamp((x2-t1) >> 17); + o[3] = stbi__clamp((x3+t0) >> 17); + o[4] = stbi__clamp((x3-t0) >> 17); + } +} + +#ifdef STBI_SSE2 +// sse2 integer IDCT. not the fastest possible implementation but it +// produces bit-identical results to the generic C version so it's +// fully "transparent". +static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) +{ + // This is constructed to match our regular (generic) integer IDCT exactly. + __m128i row0, row1, row2, row3, row4, row5, row6, row7; + __m128i tmp; + + // dot product constant: even elems=x, odd elems=y + #define dct_const(x,y) _mm_setr_epi16((x),(y),(x),(y),(x),(y),(x),(y)) + + // out(0) = c0[even]*x + c0[odd]*y (c0, x, y 16-bit, out 32-bit) + // out(1) = c1[even]*x + c1[odd]*y + #define dct_rot(out0,out1, x,y,c0,c1) \ + __m128i c0##lo = _mm_unpacklo_epi16((x),(y)); \ + __m128i c0##hi = _mm_unpackhi_epi16((x),(y)); \ + __m128i out0##_l = _mm_madd_epi16(c0##lo, c0); \ + __m128i out0##_h = _mm_madd_epi16(c0##hi, c0); \ + __m128i out1##_l = _mm_madd_epi16(c0##lo, c1); \ + __m128i out1##_h = _mm_madd_epi16(c0##hi, c1) + + // out = in << 12 (in 16-bit, out 32-bit) + #define dct_widen(out, in) \ + __m128i out##_l = _mm_srai_epi32(_mm_unpacklo_epi16(_mm_setzero_si128(), (in)), 4); \ + __m128i out##_h = _mm_srai_epi32(_mm_unpackhi_epi16(_mm_setzero_si128(), (in)), 4) + + // wide add + #define dct_wadd(out, a, b) \ + __m128i out##_l = _mm_add_epi32(a##_l, b##_l); \ + __m128i out##_h = _mm_add_epi32(a##_h, b##_h) + + // wide sub + #define dct_wsub(out, a, b) \ + __m128i out##_l = _mm_sub_epi32(a##_l, b##_l); \ + __m128i out##_h = _mm_sub_epi32(a##_h, b##_h) + + // butterfly a/b, add bias, then shift by "s" and pack + #define dct_bfly32o(out0, out1, a,b,bias,s) \ + { \ + __m128i abiased_l = _mm_add_epi32(a##_l, bias); \ + __m128i abiased_h = _mm_add_epi32(a##_h, bias); \ + dct_wadd(sum, abiased, b); \ + dct_wsub(dif, abiased, b); \ + out0 = _mm_packs_epi32(_mm_srai_epi32(sum_l, s), _mm_srai_epi32(sum_h, s)); \ + out1 = _mm_packs_epi32(_mm_srai_epi32(dif_l, s), _mm_srai_epi32(dif_h, s)); \ + } + + // 8-bit interleave step (for transposes) + #define dct_interleave8(a, b) \ + tmp = a; \ + a = _mm_unpacklo_epi8(a, b); \ + b = _mm_unpackhi_epi8(tmp, b) + + // 16-bit interleave step (for transposes) + #define dct_interleave16(a, b) \ + tmp = a; \ + a = _mm_unpacklo_epi16(a, b); \ + b = _mm_unpackhi_epi16(tmp, b) + + #define dct_pass(bias,shift) \ + { \ + /* even part */ \ + dct_rot(t2e,t3e, row2,row6, rot0_0,rot0_1); \ + __m128i sum04 = _mm_add_epi16(row0, row4); \ + __m128i dif04 = _mm_sub_epi16(row0, row4); \ + dct_widen(t0e, sum04); \ + dct_widen(t1e, dif04); \ + dct_wadd(x0, t0e, t3e); \ + dct_wsub(x3, t0e, t3e); \ + dct_wadd(x1, t1e, t2e); \ + dct_wsub(x2, t1e, t2e); \ + /* odd part */ \ + dct_rot(y0o,y2o, row7,row3, rot2_0,rot2_1); \ + dct_rot(y1o,y3o, row5,row1, rot3_0,rot3_1); \ + __m128i sum17 = _mm_add_epi16(row1, row7); \ + __m128i sum35 = _mm_add_epi16(row3, row5); \ + dct_rot(y4o,y5o, sum17,sum35, rot1_0,rot1_1); \ + dct_wadd(x4, y0o, y4o); \ + dct_wadd(x5, y1o, y5o); \ + dct_wadd(x6, y2o, y5o); \ + dct_wadd(x7, y3o, y4o); \ + dct_bfly32o(row0,row7, x0,x7,bias,shift); \ + dct_bfly32o(row1,row6, x1,x6,bias,shift); \ + dct_bfly32o(row2,row5, x2,x5,bias,shift); \ + dct_bfly32o(row3,row4, x3,x4,bias,shift); \ + } + + __m128i rot0_0 = dct_const(stbi__f2f(0.5411961f), stbi__f2f(0.5411961f) + stbi__f2f(-1.847759065f)); + __m128i rot0_1 = dct_const(stbi__f2f(0.5411961f) + stbi__f2f( 0.765366865f), stbi__f2f(0.5411961f)); + __m128i rot1_0 = dct_const(stbi__f2f(1.175875602f) + stbi__f2f(-0.899976223f), stbi__f2f(1.175875602f)); + __m128i rot1_1 = dct_const(stbi__f2f(1.175875602f), stbi__f2f(1.175875602f) + stbi__f2f(-2.562915447f)); + __m128i rot2_0 = dct_const(stbi__f2f(-1.961570560f) + stbi__f2f( 0.298631336f), stbi__f2f(-1.961570560f)); + __m128i rot2_1 = dct_const(stbi__f2f(-1.961570560f), stbi__f2f(-1.961570560f) + stbi__f2f( 3.072711026f)); + __m128i rot3_0 = dct_const(stbi__f2f(-0.390180644f) + stbi__f2f( 2.053119869f), stbi__f2f(-0.390180644f)); + __m128i rot3_1 = dct_const(stbi__f2f(-0.390180644f), stbi__f2f(-0.390180644f) + stbi__f2f( 1.501321110f)); + + // rounding biases in column/row passes, see stbi__idct_block for explanation. + __m128i bias_0 = _mm_set1_epi32(512); + __m128i bias_1 = _mm_set1_epi32(65536 + (128<<17)); + + // load + row0 = _mm_load_si128((const __m128i *) (data + 0*8)); + row1 = _mm_load_si128((const __m128i *) (data + 1*8)); + row2 = _mm_load_si128((const __m128i *) (data + 2*8)); + row3 = _mm_load_si128((const __m128i *) (data + 3*8)); + row4 = _mm_load_si128((const __m128i *) (data + 4*8)); + row5 = _mm_load_si128((const __m128i *) (data + 5*8)); + row6 = _mm_load_si128((const __m128i *) (data + 6*8)); + row7 = _mm_load_si128((const __m128i *) (data + 7*8)); + + // column pass + dct_pass(bias_0, 10); + + { + // 16bit 8x8 transpose pass 1 + dct_interleave16(row0, row4); + dct_interleave16(row1, row5); + dct_interleave16(row2, row6); + dct_interleave16(row3, row7); + + // transpose pass 2 + dct_interleave16(row0, row2); + dct_interleave16(row1, row3); + dct_interleave16(row4, row6); + dct_interleave16(row5, row7); + + // transpose pass 3 + dct_interleave16(row0, row1); + dct_interleave16(row2, row3); + dct_interleave16(row4, row5); + dct_interleave16(row6, row7); + } + + // row pass + dct_pass(bias_1, 17); + + { + // pack + __m128i p0 = _mm_packus_epi16(row0, row1); // a0a1a2a3...a7b0b1b2b3...b7 + __m128i p1 = _mm_packus_epi16(row2, row3); + __m128i p2 = _mm_packus_epi16(row4, row5); + __m128i p3 = _mm_packus_epi16(row6, row7); + + // 8bit 8x8 transpose pass 1 + dct_interleave8(p0, p2); // a0e0a1e1... + dct_interleave8(p1, p3); // c0g0c1g1... + + // transpose pass 2 + dct_interleave8(p0, p1); // a0c0e0g0... + dct_interleave8(p2, p3); // b0d0f0h0... + + // transpose pass 3 + dct_interleave8(p0, p2); // a0b0c0d0... + dct_interleave8(p1, p3); // a4b4c4d4... + + // store + _mm_storel_epi64((__m128i *) out, p0); out += out_stride; + _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p0, 0x4e)); out += out_stride; + _mm_storel_epi64((__m128i *) out, p2); out += out_stride; + _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p2, 0x4e)); out += out_stride; + _mm_storel_epi64((__m128i *) out, p1); out += out_stride; + _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p1, 0x4e)); out += out_stride; + _mm_storel_epi64((__m128i *) out, p3); out += out_stride; + _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p3, 0x4e)); + } + +#undef dct_const +#undef dct_rot +#undef dct_widen +#undef dct_wadd +#undef dct_wsub +#undef dct_bfly32o +#undef dct_interleave8 +#undef dct_interleave16 +#undef dct_pass +} + +#endif // STBI_SSE2 + +#ifdef STBI_NEON + +// NEON integer IDCT. should produce bit-identical +// results to the generic C version. +static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) +{ + int16x8_t row0, row1, row2, row3, row4, row5, row6, row7; + + int16x4_t rot0_0 = vdup_n_s16(stbi__f2f(0.5411961f)); + int16x4_t rot0_1 = vdup_n_s16(stbi__f2f(-1.847759065f)); + int16x4_t rot0_2 = vdup_n_s16(stbi__f2f( 0.765366865f)); + int16x4_t rot1_0 = vdup_n_s16(stbi__f2f( 1.175875602f)); + int16x4_t rot1_1 = vdup_n_s16(stbi__f2f(-0.899976223f)); + int16x4_t rot1_2 = vdup_n_s16(stbi__f2f(-2.562915447f)); + int16x4_t rot2_0 = vdup_n_s16(stbi__f2f(-1.961570560f)); + int16x4_t rot2_1 = vdup_n_s16(stbi__f2f(-0.390180644f)); + int16x4_t rot3_0 = vdup_n_s16(stbi__f2f( 0.298631336f)); + int16x4_t rot3_1 = vdup_n_s16(stbi__f2f( 2.053119869f)); + int16x4_t rot3_2 = vdup_n_s16(stbi__f2f( 3.072711026f)); + int16x4_t rot3_3 = vdup_n_s16(stbi__f2f( 1.501321110f)); + +#define dct_long_mul(out, inq, coeff) \ + int32x4_t out##_l = vmull_s16(vget_low_s16(inq), coeff); \ + int32x4_t out##_h = vmull_s16(vget_high_s16(inq), coeff) + +#define dct_long_mac(out, acc, inq, coeff) \ + int32x4_t out##_l = vmlal_s16(acc##_l, vget_low_s16(inq), coeff); \ + int32x4_t out##_h = vmlal_s16(acc##_h, vget_high_s16(inq), coeff) + +#define dct_widen(out, inq) \ + int32x4_t out##_l = vshll_n_s16(vget_low_s16(inq), 12); \ + int32x4_t out##_h = vshll_n_s16(vget_high_s16(inq), 12) + +// wide add +#define dct_wadd(out, a, b) \ + int32x4_t out##_l = vaddq_s32(a##_l, b##_l); \ + int32x4_t out##_h = vaddq_s32(a##_h, b##_h) + +// wide sub +#define dct_wsub(out, a, b) \ + int32x4_t out##_l = vsubq_s32(a##_l, b##_l); \ + int32x4_t out##_h = vsubq_s32(a##_h, b##_h) + +// butterfly a/b, then shift using "shiftop" by "s" and pack +#define dct_bfly32o(out0,out1, a,b,shiftop,s) \ + { \ + dct_wadd(sum, a, b); \ + dct_wsub(dif, a, b); \ + out0 = vcombine_s16(shiftop(sum_l, s), shiftop(sum_h, s)); \ + out1 = vcombine_s16(shiftop(dif_l, s), shiftop(dif_h, s)); \ + } + +#define dct_pass(shiftop, shift) \ + { \ + /* even part */ \ + int16x8_t sum26 = vaddq_s16(row2, row6); \ + dct_long_mul(p1e, sum26, rot0_0); \ + dct_long_mac(t2e, p1e, row6, rot0_1); \ + dct_long_mac(t3e, p1e, row2, rot0_2); \ + int16x8_t sum04 = vaddq_s16(row0, row4); \ + int16x8_t dif04 = vsubq_s16(row0, row4); \ + dct_widen(t0e, sum04); \ + dct_widen(t1e, dif04); \ + dct_wadd(x0, t0e, t3e); \ + dct_wsub(x3, t0e, t3e); \ + dct_wadd(x1, t1e, t2e); \ + dct_wsub(x2, t1e, t2e); \ + /* odd part */ \ + int16x8_t sum15 = vaddq_s16(row1, row5); \ + int16x8_t sum17 = vaddq_s16(row1, row7); \ + int16x8_t sum35 = vaddq_s16(row3, row5); \ + int16x8_t sum37 = vaddq_s16(row3, row7); \ + int16x8_t sumodd = vaddq_s16(sum17, sum35); \ + dct_long_mul(p5o, sumodd, rot1_0); \ + dct_long_mac(p1o, p5o, sum17, rot1_1); \ + dct_long_mac(p2o, p5o, sum35, rot1_2); \ + dct_long_mul(p3o, sum37, rot2_0); \ + dct_long_mul(p4o, sum15, rot2_1); \ + dct_wadd(sump13o, p1o, p3o); \ + dct_wadd(sump24o, p2o, p4o); \ + dct_wadd(sump23o, p2o, p3o); \ + dct_wadd(sump14o, p1o, p4o); \ + dct_long_mac(x4, sump13o, row7, rot3_0); \ + dct_long_mac(x5, sump24o, row5, rot3_1); \ + dct_long_mac(x6, sump23o, row3, rot3_2); \ + dct_long_mac(x7, sump14o, row1, rot3_3); \ + dct_bfly32o(row0,row7, x0,x7,shiftop,shift); \ + dct_bfly32o(row1,row6, x1,x6,shiftop,shift); \ + dct_bfly32o(row2,row5, x2,x5,shiftop,shift); \ + dct_bfly32o(row3,row4, x3,x4,shiftop,shift); \ + } + + // load + row0 = vld1q_s16(data + 0*8); + row1 = vld1q_s16(data + 1*8); + row2 = vld1q_s16(data + 2*8); + row3 = vld1q_s16(data + 3*8); + row4 = vld1q_s16(data + 4*8); + row5 = vld1q_s16(data + 5*8); + row6 = vld1q_s16(data + 6*8); + row7 = vld1q_s16(data + 7*8); + + // add DC bias + row0 = vaddq_s16(row0, vsetq_lane_s16(1024, vdupq_n_s16(0), 0)); + + // column pass + dct_pass(vrshrn_n_s32, 10); + + // 16bit 8x8 transpose + { +// these three map to a single VTRN.16, VTRN.32, and VSWP, respectively. +// whether compilers actually get this is another story, sadly. +#define dct_trn16(x, y) { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; } +#define dct_trn32(x, y) { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); } +#define dct_trn64(x, y) { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); } + + // pass 1 + dct_trn16(row0, row1); // a0b0a2b2a4b4a6b6 + dct_trn16(row2, row3); + dct_trn16(row4, row5); + dct_trn16(row6, row7); + + // pass 2 + dct_trn32(row0, row2); // a0b0c0d0a4b4c4d4 + dct_trn32(row1, row3); + dct_trn32(row4, row6); + dct_trn32(row5, row7); + + // pass 3 + dct_trn64(row0, row4); // a0b0c0d0e0f0g0h0 + dct_trn64(row1, row5); + dct_trn64(row2, row6); + dct_trn64(row3, row7); + +#undef dct_trn16 +#undef dct_trn32 +#undef dct_trn64 + } + + // row pass + // vrshrn_n_s32 only supports shifts up to 16, we need + // 17. so do a non-rounding shift of 16 first then follow + // up with a rounding shift by 1. + dct_pass(vshrn_n_s32, 16); + + { + // pack and round + uint8x8_t p0 = vqrshrun_n_s16(row0, 1); + uint8x8_t p1 = vqrshrun_n_s16(row1, 1); + uint8x8_t p2 = vqrshrun_n_s16(row2, 1); + uint8x8_t p3 = vqrshrun_n_s16(row3, 1); + uint8x8_t p4 = vqrshrun_n_s16(row4, 1); + uint8x8_t p5 = vqrshrun_n_s16(row5, 1); + uint8x8_t p6 = vqrshrun_n_s16(row6, 1); + uint8x8_t p7 = vqrshrun_n_s16(row7, 1); + + // again, these can translate into one instruction, but often don't. +#define dct_trn8_8(x, y) { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; } +#define dct_trn8_16(x, y) { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); } +#define dct_trn8_32(x, y) { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); } + + // sadly can't use interleaved stores here since we only write + // 8 bytes to each scan line! + + // 8x8 8-bit transpose pass 1 + dct_trn8_8(p0, p1); + dct_trn8_8(p2, p3); + dct_trn8_8(p4, p5); + dct_trn8_8(p6, p7); + + // pass 2 + dct_trn8_16(p0, p2); + dct_trn8_16(p1, p3); + dct_trn8_16(p4, p6); + dct_trn8_16(p5, p7); + + // pass 3 + dct_trn8_32(p0, p4); + dct_trn8_32(p1, p5); + dct_trn8_32(p2, p6); + dct_trn8_32(p3, p7); + + // store + vst1_u8(out, p0); out += out_stride; + vst1_u8(out, p1); out += out_stride; + vst1_u8(out, p2); out += out_stride; + vst1_u8(out, p3); out += out_stride; + vst1_u8(out, p4); out += out_stride; + vst1_u8(out, p5); out += out_stride; + vst1_u8(out, p6); out += out_stride; + vst1_u8(out, p7); + +#undef dct_trn8_8 +#undef dct_trn8_16 +#undef dct_trn8_32 + } + +#undef dct_long_mul +#undef dct_long_mac +#undef dct_widen +#undef dct_wadd +#undef dct_wsub +#undef dct_bfly32o +#undef dct_pass +} + +#endif // STBI_NEON + +#define STBI__MARKER_none 0xff +// if there's a pending marker from the entropy stream, return that +// otherwise, fetch from the stream and get a marker. if there's no +// marker, return 0xff, which is never a valid marker value +static stbi_uc stbi__get_marker(stbi__jpeg *j) +{ + stbi_uc x; + if (j->marker != STBI__MARKER_none) { x = j->marker; j->marker = STBI__MARKER_none; return x; } + x = stbi__get8(j->s); + if (x != 0xff) return STBI__MARKER_none; + while (x == 0xff) + x = stbi__get8(j->s); // consume repeated 0xff fill bytes + return x; +} + +// in each scan, we'll have scan_n components, and the order +// of the components is specified by order[] +#define STBI__RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7) + +// after a restart interval, stbi__jpeg_reset the entropy decoder and +// the dc prediction +static void stbi__jpeg_reset(stbi__jpeg *j) +{ + j->code_bits = 0; + j->code_buffer = 0; + j->nomore = 0; + j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = j->img_comp[3].dc_pred = 0; + j->marker = STBI__MARKER_none; + j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff; + j->eob_run = 0; + // no more than 1<<31 MCUs if no restart_interal? that's plenty safe, + // since we don't even allow 1<<30 pixels +} + +static int stbi__parse_entropy_coded_data(stbi__jpeg *z) +{ + stbi__jpeg_reset(z); + if (!z->progressive) { + if (z->scan_n == 1) { + int i,j; + STBI_SIMD_ALIGN(short, data[64]); + int n = z->order[0]; + // non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = (z->img_comp[n].x+7) >> 3; + int h = (z->img_comp[n].y+7) >> 3; + for (j=0; j < h; ++j) { + for (i=0; i < w; ++i) { + int ha = z->img_comp[n].ha; + if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0; + z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data); + // every data block is an MCU, so countdown the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); + // if it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!STBI__RESTART(z->marker)) return 1; + stbi__jpeg_reset(z); + } + } + } + return 1; + } else { // interleaved + int i,j,k,x,y; + STBI_SIMD_ALIGN(short, data[64]); + for (j=0; j < z->img_mcu_y; ++j) { + for (i=0; i < z->img_mcu_x; ++i) { + // scan an interleaved mcu... process scan_n components in order + for (k=0; k < z->scan_n; ++k) { + int n = z->order[k]; + // scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (y=0; y < z->img_comp[n].v; ++y) { + for (x=0; x < z->img_comp[n].h; ++x) { + int x2 = (i*z->img_comp[n].h + x)*8; + int y2 = (j*z->img_comp[n].v + y)*8; + int ha = z->img_comp[n].ha; + if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0; + z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data); + } + } + } + // after all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); + if (!STBI__RESTART(z->marker)) return 1; + stbi__jpeg_reset(z); + } + } + } + return 1; + } + } else { + if (z->scan_n == 1) { + int i,j; + int n = z->order[0]; + // non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = (z->img_comp[n].x+7) >> 3; + int h = (z->img_comp[n].y+7) >> 3; + for (j=0; j < h; ++j) { + for (i=0; i < w; ++i) { + short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w); + if (z->spec_start == 0) { + if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) + return 0; + } else { + int ha = z->img_comp[n].ha; + if (!stbi__jpeg_decode_block_prog_ac(z, data, &z->huff_ac[ha], z->fast_ac[ha])) + return 0; + } + // every data block is an MCU, so countdown the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); + if (!STBI__RESTART(z->marker)) return 1; + stbi__jpeg_reset(z); + } + } + } + return 1; + } else { // interleaved + int i,j,k,x,y; + for (j=0; j < z->img_mcu_y; ++j) { + for (i=0; i < z->img_mcu_x; ++i) { + // scan an interleaved mcu... process scan_n components in order + for (k=0; k < z->scan_n; ++k) { + int n = z->order[k]; + // scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (y=0; y < z->img_comp[n].v; ++y) { + for (x=0; x < z->img_comp[n].h; ++x) { + int x2 = (i*z->img_comp[n].h + x); + int y2 = (j*z->img_comp[n].v + y); + short *data = z->img_comp[n].coeff + 64 * (x2 + y2 * z->img_comp[n].coeff_w); + if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) + return 0; + } + } + } + // after all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); + if (!STBI__RESTART(z->marker)) return 1; + stbi__jpeg_reset(z); + } + } + } + return 1; + } + } +} + +static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant) +{ + int i; + for (i=0; i < 64; ++i) + data[i] *= dequant[i]; +} + +static void stbi__jpeg_finish(stbi__jpeg *z) +{ + if (z->progressive) { + // dequantize and idct the data + int i,j,n; + for (n=0; n < z->s->img_n; ++n) { + int w = (z->img_comp[n].x+7) >> 3; + int h = (z->img_comp[n].y+7) >> 3; + for (j=0; j < h; ++j) { + for (i=0; i < w; ++i) { + short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w); + stbi__jpeg_dequantize(data, z->dequant[z->img_comp[n].tq]); + z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data); + } + } + } + } +} + +static int stbi__process_marker(stbi__jpeg *z, int m) +{ + int L; + switch (m) { + case STBI__MARKER_none: // no marker found + return stbi__err("expected marker","Corrupt JPEG"); + + case 0xDD: // DRI - specify restart interval + if (stbi__get16be(z->s) != 4) return stbi__err("bad DRI len","Corrupt JPEG"); + z->restart_interval = stbi__get16be(z->s); + return 1; + + case 0xDB: // DQT - define quantization table + L = stbi__get16be(z->s)-2; + while (L > 0) { + int q = stbi__get8(z->s); + int p = q >> 4, sixteen = (p != 0); + int t = q & 15,i; + if (p != 0 && p != 1) return stbi__err("bad DQT type","Corrupt JPEG"); + if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG"); + + for (i=0; i < 64; ++i) + z->dequant[t][stbi__jpeg_dezigzag[i]] = (stbi__uint16)(sixteen ? stbi__get16be(z->s) : stbi__get8(z->s)); + L -= (sixteen ? 129 : 65); + } + return L==0; + + case 0xC4: // DHT - define huffman table + L = stbi__get16be(z->s)-2; + while (L > 0) { + stbi_uc *v; + int sizes[16],i,n=0; + int q = stbi__get8(z->s); + int tc = q >> 4; + int th = q & 15; + if (tc > 1 || th > 3) return stbi__err("bad DHT header","Corrupt JPEG"); + for (i=0; i < 16; ++i) { + sizes[i] = stbi__get8(z->s); + n += sizes[i]; + } + L -= 17; + if (tc == 0) { + if (!stbi__build_huffman(z->huff_dc+th, sizes)) return 0; + v = z->huff_dc[th].values; + } else { + if (!stbi__build_huffman(z->huff_ac+th, sizes)) return 0; + v = z->huff_ac[th].values; + } + for (i=0; i < n; ++i) + v[i] = stbi__get8(z->s); + if (tc != 0) + stbi__build_fast_ac(z->fast_ac[th], z->huff_ac + th); + L -= n; + } + return L==0; + } + + // check for comment block or APP blocks + if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) { + L = stbi__get16be(z->s); + if (L < 2) { + if (m == 0xFE) + return stbi__err("bad COM len","Corrupt JPEG"); + else + return stbi__err("bad APP len","Corrupt JPEG"); + } + L -= 2; + + if (m == 0xE0 && L >= 5) { // JFIF APP0 segment + static const unsigned char tag[5] = {'J','F','I','F','\0'}; + int ok = 1; + int i; + for (i=0; i < 5; ++i) + if (stbi__get8(z->s) != tag[i]) + ok = 0; + L -= 5; + if (ok) + z->jfif = 1; + } else if (m == 0xEE && L >= 12) { // Adobe APP14 segment + static const unsigned char tag[6] = {'A','d','o','b','e','\0'}; + int ok = 1; + int i; + for (i=0; i < 6; ++i) + if (stbi__get8(z->s) != tag[i]) + ok = 0; + L -= 6; + if (ok) { + stbi__get8(z->s); // version + stbi__get16be(z->s); // flags0 + stbi__get16be(z->s); // flags1 + z->app14_color_transform = stbi__get8(z->s); // color transform + L -= 6; + } + } + + stbi__skip(z->s, L); + return 1; + } + + return stbi__err("unknown marker","Corrupt JPEG"); +} + +// after we see SOS +static int stbi__process_scan_header(stbi__jpeg *z) +{ + int i; + int Ls = stbi__get16be(z->s); + z->scan_n = stbi__get8(z->s); + if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n) return stbi__err("bad SOS component count","Corrupt JPEG"); + if (Ls != 6+2*z->scan_n) return stbi__err("bad SOS len","Corrupt JPEG"); + for (i=0; i < z->scan_n; ++i) { + int id = stbi__get8(z->s), which; + int q = stbi__get8(z->s); + for (which = 0; which < z->s->img_n; ++which) + if (z->img_comp[which].id == id) + break; + if (which == z->s->img_n) return 0; // no match + z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return stbi__err("bad DC huff","Corrupt JPEG"); + z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return stbi__err("bad AC huff","Corrupt JPEG"); + z->order[i] = which; + } + + { + int aa; + z->spec_start = stbi__get8(z->s); + z->spec_end = stbi__get8(z->s); // should be 63, but might be 0 + aa = stbi__get8(z->s); + z->succ_high = (aa >> 4); + z->succ_low = (aa & 15); + if (z->progressive) { + if (z->spec_start > 63 || z->spec_end > 63 || z->spec_start > z->spec_end || z->succ_high > 13 || z->succ_low > 13) + return stbi__err("bad SOS", "Corrupt JPEG"); + } else { + if (z->spec_start != 0) return stbi__err("bad SOS","Corrupt JPEG"); + if (z->succ_high != 0 || z->succ_low != 0) return stbi__err("bad SOS","Corrupt JPEG"); + z->spec_end = 63; + } + } + + return 1; +} + +static int stbi__free_jpeg_components(stbi__jpeg *z, int ncomp, int why) +{ + int i; + for (i=0; i < ncomp; ++i) { + if (z->img_comp[i].raw_data) { + STBI_FREE(z->img_comp[i].raw_data); + z->img_comp[i].raw_data = NULL; + z->img_comp[i].data = NULL; + } + if (z->img_comp[i].raw_coeff) { + STBI_FREE(z->img_comp[i].raw_coeff); + z->img_comp[i].raw_coeff = 0; + z->img_comp[i].coeff = 0; + } + if (z->img_comp[i].linebuf) { + STBI_FREE(z->img_comp[i].linebuf); + z->img_comp[i].linebuf = NULL; + } + } + return why; +} + +static int stbi__process_frame_header(stbi__jpeg *z, int scan) +{ + stbi__context *s = z->s; + int Lf,p,i,q, h_max=1,v_max=1,c; + Lf = stbi__get16be(s); if (Lf < 11) return stbi__err("bad SOF len","Corrupt JPEG"); // JPEG + p = stbi__get8(s); if (p != 8) return stbi__err("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline + s->img_y = stbi__get16be(s); if (s->img_y == 0) return stbi__err("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG + s->img_x = stbi__get16be(s); if (s->img_x == 0) return stbi__err("0 width","Corrupt JPEG"); // JPEG requires + c = stbi__get8(s); + if (c != 3 && c != 1 && c != 4) return stbi__err("bad component count","Corrupt JPEG"); + s->img_n = c; + for (i=0; i < c; ++i) { + z->img_comp[i].data = NULL; + z->img_comp[i].linebuf = NULL; + } + + if (Lf != 8+3*s->img_n) return stbi__err("bad SOF len","Corrupt JPEG"); + + z->rgb = 0; + for (i=0; i < s->img_n; ++i) { + static const unsigned char rgb[3] = { 'R', 'G', 'B' }; + z->img_comp[i].id = stbi__get8(s); + if (s->img_n == 3 && z->img_comp[i].id == rgb[i]) + ++z->rgb; + q = stbi__get8(s); + z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return stbi__err("bad H","Corrupt JPEG"); + z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return stbi__err("bad V","Corrupt JPEG"); + z->img_comp[i].tq = stbi__get8(s); if (z->img_comp[i].tq > 3) return stbi__err("bad TQ","Corrupt JPEG"); + } + + if (scan != STBI__SCAN_load) return 1; + + if (!stbi__mad3sizes_valid(s->img_x, s->img_y, s->img_n, 0)) return stbi__err("too large", "Image too large to decode"); + + for (i=0; i < s->img_n; ++i) { + if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h; + if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v; + } + + // compute interleaved mcu info + z->img_h_max = h_max; + z->img_v_max = v_max; + z->img_mcu_w = h_max * 8; + z->img_mcu_h = v_max * 8; + // these sizes can't be more than 17 bits + z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w; + z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h; + + for (i=0; i < s->img_n; ++i) { + // number of effective pixels (e.g. for non-interleaved MCU) + z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max; + z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max; + // to simplify generation, we'll allocate enough memory to decode + // the bogus oversized data from using interleaved MCUs and their + // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't + // discard the extra data until colorspace conversion + // + // img_mcu_x, img_mcu_y: <=17 bits; comp[i].h and .v are <=4 (checked earlier) + // so these muls can't overflow with 32-bit ints (which we require) + z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8; + z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8; + z->img_comp[i].coeff = 0; + z->img_comp[i].raw_coeff = 0; + z->img_comp[i].linebuf = NULL; + z->img_comp[i].raw_data = stbi__malloc_mad2(z->img_comp[i].w2, z->img_comp[i].h2, 15); + if (z->img_comp[i].raw_data == NULL) + return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory")); + // align blocks for idct using mmx/sse + z->img_comp[i].data = (stbi_uc*) (((size_t) z->img_comp[i].raw_data + 15) & ~15); + if (z->progressive) { + // w2, h2 are multiples of 8 (see above) + z->img_comp[i].coeff_w = z->img_comp[i].w2 / 8; + z->img_comp[i].coeff_h = z->img_comp[i].h2 / 8; + z->img_comp[i].raw_coeff = stbi__malloc_mad3(z->img_comp[i].w2, z->img_comp[i].h2, sizeof(short), 15); + if (z->img_comp[i].raw_coeff == NULL) + return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory")); + z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15); + } + } + + return 1; +} + +// use comparisons since in some cases we handle more than one case (e.g. SOF) +#define stbi__DNL(x) ((x) == 0xdc) +#define stbi__SOI(x) ((x) == 0xd8) +#define stbi__EOI(x) ((x) == 0xd9) +#define stbi__SOF(x) ((x) == 0xc0 || (x) == 0xc1 || (x) == 0xc2) +#define stbi__SOS(x) ((x) == 0xda) + +#define stbi__SOF_progressive(x) ((x) == 0xc2) + +static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan) +{ + int m; + z->jfif = 0; + z->app14_color_transform = -1; // valid values are 0,1,2 + z->marker = STBI__MARKER_none; // initialize cached marker to empty + m = stbi__get_marker(z); + if (!stbi__SOI(m)) return stbi__err("no SOI","Corrupt JPEG"); + if (scan == STBI__SCAN_type) return 1; + m = stbi__get_marker(z); + while (!stbi__SOF(m)) { + if (!stbi__process_marker(z,m)) return 0; + m = stbi__get_marker(z); + while (m == STBI__MARKER_none) { + // some files have extra padding after their blocks, so ok, we'll scan + if (stbi__at_eof(z->s)) return stbi__err("no SOF", "Corrupt JPEG"); + m = stbi__get_marker(z); + } + } + z->progressive = stbi__SOF_progressive(m); + if (!stbi__process_frame_header(z, scan)) return 0; + return 1; +} + +// decode image to YCbCr format +static int stbi__decode_jpeg_image(stbi__jpeg *j) +{ + int m; + for (m = 0; m < 4; m++) { + j->img_comp[m].raw_data = NULL; + j->img_comp[m].raw_coeff = NULL; + } + j->restart_interval = 0; + if (!stbi__decode_jpeg_header(j, STBI__SCAN_load)) return 0; + m = stbi__get_marker(j); + while (!stbi__EOI(m)) { + if (stbi__SOS(m)) { + if (!stbi__process_scan_header(j)) return 0; + if (!stbi__parse_entropy_coded_data(j)) return 0; + if (j->marker == STBI__MARKER_none ) { + // handle 0s at the end of image data from IP Kamera 9060 + while (!stbi__at_eof(j->s)) { + int x = stbi__get8(j->s); + if (x == 255) { + j->marker = stbi__get8(j->s); + break; + } + } + // if we reach eof without hitting a marker, stbi__get_marker() below will fail and we'll eventually return 0 + } + } else if (stbi__DNL(m)) { + int Ld = stbi__get16be(j->s); + stbi__uint32 NL = stbi__get16be(j->s); + if (Ld != 4) return stbi__err("bad DNL len", "Corrupt JPEG"); + if (NL != j->s->img_y) return stbi__err("bad DNL height", "Corrupt JPEG"); + } else { + if (!stbi__process_marker(j, m)) return 0; + } + m = stbi__get_marker(j); + } + if (j->progressive) + stbi__jpeg_finish(j); + return 1; +} + +// static jfif-centered resampling (across block boundaries) + +typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_uc *in1, + int w, int hs); + +#define stbi__div4(x) ((stbi_uc) ((x) >> 2)) + +static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + STBI_NOTUSED(out); + STBI_NOTUSED(in_far); + STBI_NOTUSED(w); + STBI_NOTUSED(hs); + return in_near; +} + +static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // need to generate two samples vertically for every one in input + int i; + STBI_NOTUSED(hs); + for (i=0; i < w; ++i) + out[i] = stbi__div4(3*in_near[i] + in_far[i] + 2); + return out; +} + +static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // need to generate two samples horizontally for every one in input + int i; + stbi_uc *input = in_near; + + if (w == 1) { + // if only one sample, can't do any interpolation + out[0] = out[1] = input[0]; + return out; + } + + out[0] = input[0]; + out[1] = stbi__div4(input[0]*3 + input[1] + 2); + for (i=1; i < w-1; ++i) { + int n = 3*input[i]+2; + out[i*2+0] = stbi__div4(n+input[i-1]); + out[i*2+1] = stbi__div4(n+input[i+1]); + } + out[i*2+0] = stbi__div4(input[w-2]*3 + input[w-1] + 2); + out[i*2+1] = input[w-1]; + + STBI_NOTUSED(in_far); + STBI_NOTUSED(hs); + + return out; +} + +#define stbi__div16(x) ((stbi_uc) ((x) >> 4)) + +static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // need to generate 2x2 samples for every one in input + int i,t0,t1; + if (w == 1) { + out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2); + return out; + } + + t1 = 3*in_near[0] + in_far[0]; + out[0] = stbi__div4(t1+2); + for (i=1; i < w; ++i) { + t0 = t1; + t1 = 3*in_near[i]+in_far[i]; + out[i*2-1] = stbi__div16(3*t0 + t1 + 8); + out[i*2 ] = stbi__div16(3*t1 + t0 + 8); + } + out[w*2-1] = stbi__div4(t1+2); + + STBI_NOTUSED(hs); + + return out; +} + +#if defined(STBI_SSE2) || defined(STBI_NEON) +static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // need to generate 2x2 samples for every one in input + int i=0,t0,t1; + + if (w == 1) { + out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2); + return out; + } + + t1 = 3*in_near[0] + in_far[0]; + // process groups of 8 pixels for as long as we can. + // note we can't handle the last pixel in a row in this loop + // because we need to handle the filter boundary conditions. + for (; i < ((w-1) & ~7); i += 8) { +#if defined(STBI_SSE2) + // load and perform the vertical filtering pass + // this uses 3*x + y = 4*x + (y - x) + __m128i zero = _mm_setzero_si128(); + __m128i farb = _mm_loadl_epi64((__m128i *) (in_far + i)); + __m128i nearb = _mm_loadl_epi64((__m128i *) (in_near + i)); + __m128i farw = _mm_unpacklo_epi8(farb, zero); + __m128i nearw = _mm_unpacklo_epi8(nearb, zero); + __m128i diff = _mm_sub_epi16(farw, nearw); + __m128i nears = _mm_slli_epi16(nearw, 2); + __m128i curr = _mm_add_epi16(nears, diff); // current row + + // horizontal filter works the same based on shifted vers of current + // row. "prev" is current row shifted right by 1 pixel; we need to + // insert the previous pixel value (from t1). + // "next" is current row shifted left by 1 pixel, with first pixel + // of next block of 8 pixels added in. + __m128i prv0 = _mm_slli_si128(curr, 2); + __m128i nxt0 = _mm_srli_si128(curr, 2); + __m128i prev = _mm_insert_epi16(prv0, t1, 0); + __m128i next = _mm_insert_epi16(nxt0, 3*in_near[i+8] + in_far[i+8], 7); + + // horizontal filter, polyphase implementation since it's convenient: + // even pixels = 3*cur + prev = cur*4 + (prev - cur) + // odd pixels = 3*cur + next = cur*4 + (next - cur) + // note the shared term. + __m128i bias = _mm_set1_epi16(8); + __m128i curs = _mm_slli_epi16(curr, 2); + __m128i prvd = _mm_sub_epi16(prev, curr); + __m128i nxtd = _mm_sub_epi16(next, curr); + __m128i curb = _mm_add_epi16(curs, bias); + __m128i even = _mm_add_epi16(prvd, curb); + __m128i odd = _mm_add_epi16(nxtd, curb); + + // interleave even and odd pixels, then undo scaling. + __m128i int0 = _mm_unpacklo_epi16(even, odd); + __m128i int1 = _mm_unpackhi_epi16(even, odd); + __m128i de0 = _mm_srli_epi16(int0, 4); + __m128i de1 = _mm_srli_epi16(int1, 4); + + // pack and write output + __m128i outv = _mm_packus_epi16(de0, de1); + _mm_storeu_si128((__m128i *) (out + i*2), outv); +#elif defined(STBI_NEON) + // load and perform the vertical filtering pass + // this uses 3*x + y = 4*x + (y - x) + uint8x8_t farb = vld1_u8(in_far + i); + uint8x8_t nearb = vld1_u8(in_near + i); + int16x8_t diff = vreinterpretq_s16_u16(vsubl_u8(farb, nearb)); + int16x8_t nears = vreinterpretq_s16_u16(vshll_n_u8(nearb, 2)); + int16x8_t curr = vaddq_s16(nears, diff); // current row + + // horizontal filter works the same based on shifted vers of current + // row. "prev" is current row shifted right by 1 pixel; we need to + // insert the previous pixel value (from t1). + // "next" is current row shifted left by 1 pixel, with first pixel + // of next block of 8 pixels added in. + int16x8_t prv0 = vextq_s16(curr, curr, 7); + int16x8_t nxt0 = vextq_s16(curr, curr, 1); + int16x8_t prev = vsetq_lane_s16(t1, prv0, 0); + int16x8_t next = vsetq_lane_s16(3*in_near[i+8] + in_far[i+8], nxt0, 7); + + // horizontal filter, polyphase implementation since it's convenient: + // even pixels = 3*cur + prev = cur*4 + (prev - cur) + // odd pixels = 3*cur + next = cur*4 + (next - cur) + // note the shared term. + int16x8_t curs = vshlq_n_s16(curr, 2); + int16x8_t prvd = vsubq_s16(prev, curr); + int16x8_t nxtd = vsubq_s16(next, curr); + int16x8_t even = vaddq_s16(curs, prvd); + int16x8_t odd = vaddq_s16(curs, nxtd); + + // undo scaling and round, then store with even/odd phases interleaved + uint8x8x2_t o; + o.val[0] = vqrshrun_n_s16(even, 4); + o.val[1] = vqrshrun_n_s16(odd, 4); + vst2_u8(out + i*2, o); +#endif + + // "previous" value for next iter + t1 = 3*in_near[i+7] + in_far[i+7]; + } + + t0 = t1; + t1 = 3*in_near[i] + in_far[i]; + out[i*2] = stbi__div16(3*t1 + t0 + 8); + + for (++i; i < w; ++i) { + t0 = t1; + t1 = 3*in_near[i]+in_far[i]; + out[i*2-1] = stbi__div16(3*t0 + t1 + 8); + out[i*2 ] = stbi__div16(3*t1 + t0 + 8); + } + out[w*2-1] = stbi__div4(t1+2); + + STBI_NOTUSED(hs); + + return out; +} +#endif + +static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // resample with nearest-neighbor + int i,j; + STBI_NOTUSED(in_far); + for (i=0; i < w; ++i) + for (j=0; j < hs; ++j) + out[i*hs+j] = in_near[i]; + return out; +} + +// this is a reduced-precision calculation of YCbCr-to-RGB introduced +// to make sure the code produces the same results in both SIMD and scalar +#define stbi__float2fixed(x) (((int) ((x) * 4096.0f + 0.5f)) << 8) +static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step) +{ + int i; + for (i=0; i < count; ++i) { + int y_fixed = (y[i] << 20) + (1<<19); // rounding + int r,g,b; + int cr = pcr[i] - 128; + int cb = pcb[i] - 128; + r = y_fixed + cr* stbi__float2fixed(1.40200f); + g = y_fixed + (cr*-stbi__float2fixed(0.71414f)) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); + b = y_fixed + cb* stbi__float2fixed(1.77200f); + r >>= 20; + g >>= 20; + b >>= 20; + if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } + if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } + if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } + out[0] = (stbi_uc)r; + out[1] = (stbi_uc)g; + out[2] = (stbi_uc)b; + out[3] = 255; + out += step; + } +} + +#if defined(STBI_SSE2) || defined(STBI_NEON) +static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi_uc const *pcb, stbi_uc const *pcr, int count, int step) +{ + int i = 0; + +#ifdef STBI_SSE2 + // step == 3 is pretty ugly on the final interleave, and i'm not convinced + // it's useful in practice (you wouldn't use it for textures, for example). + // so just accelerate step == 4 case. + if (step == 4) { + // this is a fairly straightforward implementation and not super-optimized. + __m128i signflip = _mm_set1_epi8(-0x80); + __m128i cr_const0 = _mm_set1_epi16( (short) ( 1.40200f*4096.0f+0.5f)); + __m128i cr_const1 = _mm_set1_epi16( - (short) ( 0.71414f*4096.0f+0.5f)); + __m128i cb_const0 = _mm_set1_epi16( - (short) ( 0.34414f*4096.0f+0.5f)); + __m128i cb_const1 = _mm_set1_epi16( (short) ( 1.77200f*4096.0f+0.5f)); + __m128i y_bias = _mm_set1_epi8((char) (unsigned char) 128); + __m128i xw = _mm_set1_epi16(255); // alpha channel + + for (; i+7 < count; i += 8) { + // load + __m128i y_bytes = _mm_loadl_epi64((__m128i *) (y+i)); + __m128i cr_bytes = _mm_loadl_epi64((__m128i *) (pcr+i)); + __m128i cb_bytes = _mm_loadl_epi64((__m128i *) (pcb+i)); + __m128i cr_biased = _mm_xor_si128(cr_bytes, signflip); // -128 + __m128i cb_biased = _mm_xor_si128(cb_bytes, signflip); // -128 + + // unpack to short (and left-shift cr, cb by 8) + __m128i yw = _mm_unpacklo_epi8(y_bias, y_bytes); + __m128i crw = _mm_unpacklo_epi8(_mm_setzero_si128(), cr_biased); + __m128i cbw = _mm_unpacklo_epi8(_mm_setzero_si128(), cb_biased); + + // color transform + __m128i yws = _mm_srli_epi16(yw, 4); + __m128i cr0 = _mm_mulhi_epi16(cr_const0, crw); + __m128i cb0 = _mm_mulhi_epi16(cb_const0, cbw); + __m128i cb1 = _mm_mulhi_epi16(cbw, cb_const1); + __m128i cr1 = _mm_mulhi_epi16(crw, cr_const1); + __m128i rws = _mm_add_epi16(cr0, yws); + __m128i gwt = _mm_add_epi16(cb0, yws); + __m128i bws = _mm_add_epi16(yws, cb1); + __m128i gws = _mm_add_epi16(gwt, cr1); + + // descale + __m128i rw = _mm_srai_epi16(rws, 4); + __m128i bw = _mm_srai_epi16(bws, 4); + __m128i gw = _mm_srai_epi16(gws, 4); + + // back to byte, set up for transpose + __m128i brb = _mm_packus_epi16(rw, bw); + __m128i gxb = _mm_packus_epi16(gw, xw); + + // transpose to interleave channels + __m128i t0 = _mm_unpacklo_epi8(brb, gxb); + __m128i t1 = _mm_unpackhi_epi8(brb, gxb); + __m128i o0 = _mm_unpacklo_epi16(t0, t1); + __m128i o1 = _mm_unpackhi_epi16(t0, t1); + + // store + _mm_storeu_si128((__m128i *) (out + 0), o0); + _mm_storeu_si128((__m128i *) (out + 16), o1); + out += 32; + } + } +#endif + +#ifdef STBI_NEON + // in this version, step=3 support would be easy to add. but is there demand? + if (step == 4) { + // this is a fairly straightforward implementation and not super-optimized. + uint8x8_t signflip = vdup_n_u8(0x80); + int16x8_t cr_const0 = vdupq_n_s16( (short) ( 1.40200f*4096.0f+0.5f)); + int16x8_t cr_const1 = vdupq_n_s16( - (short) ( 0.71414f*4096.0f+0.5f)); + int16x8_t cb_const0 = vdupq_n_s16( - (short) ( 0.34414f*4096.0f+0.5f)); + int16x8_t cb_const1 = vdupq_n_s16( (short) ( 1.77200f*4096.0f+0.5f)); + + for (; i+7 < count; i += 8) { + // load + uint8x8_t y_bytes = vld1_u8(y + i); + uint8x8_t cr_bytes = vld1_u8(pcr + i); + uint8x8_t cb_bytes = vld1_u8(pcb + i); + int8x8_t cr_biased = vreinterpret_s8_u8(vsub_u8(cr_bytes, signflip)); + int8x8_t cb_biased = vreinterpret_s8_u8(vsub_u8(cb_bytes, signflip)); + + // expand to s16 + int16x8_t yws = vreinterpretq_s16_u16(vshll_n_u8(y_bytes, 4)); + int16x8_t crw = vshll_n_s8(cr_biased, 7); + int16x8_t cbw = vshll_n_s8(cb_biased, 7); + + // color transform + int16x8_t cr0 = vqdmulhq_s16(crw, cr_const0); + int16x8_t cb0 = vqdmulhq_s16(cbw, cb_const0); + int16x8_t cr1 = vqdmulhq_s16(crw, cr_const1); + int16x8_t cb1 = vqdmulhq_s16(cbw, cb_const1); + int16x8_t rws = vaddq_s16(yws, cr0); + int16x8_t gws = vaddq_s16(vaddq_s16(yws, cb0), cr1); + int16x8_t bws = vaddq_s16(yws, cb1); + + // undo scaling, round, convert to byte + uint8x8x4_t o; + o.val[0] = vqrshrun_n_s16(rws, 4); + o.val[1] = vqrshrun_n_s16(gws, 4); + o.val[2] = vqrshrun_n_s16(bws, 4); + o.val[3] = vdup_n_u8(255); + + // store, interleaving r/g/b/a + vst4_u8(out, o); + out += 8*4; + } + } +#endif + + for (; i < count; ++i) { + int y_fixed = (y[i] << 20) + (1<<19); // rounding + int r,g,b; + int cr = pcr[i] - 128; + int cb = pcb[i] - 128; + r = y_fixed + cr* stbi__float2fixed(1.40200f); + g = y_fixed + cr*-stbi__float2fixed(0.71414f) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); + b = y_fixed + cb* stbi__float2fixed(1.77200f); + r >>= 20; + g >>= 20; + b >>= 20; + if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } + if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } + if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } + out[0] = (stbi_uc)r; + out[1] = (stbi_uc)g; + out[2] = (stbi_uc)b; + out[3] = 255; + out += step; + } +} +#endif + +// set up the kernels +static void stbi__setup_jpeg(stbi__jpeg *j) +{ + j->idct_block_kernel = stbi__idct_block; + j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_row; + j->resample_row_hv_2_kernel = stbi__resample_row_hv_2; + +#ifdef STBI_SSE2 + if (stbi__sse2_available()) { + j->idct_block_kernel = stbi__idct_simd; + j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd; + j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd; + } +#endif + +#ifdef STBI_NEON + j->idct_block_kernel = stbi__idct_simd; + j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd; + j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd; +#endif +} + +// clean up the temporary component buffers +static void stbi__cleanup_jpeg(stbi__jpeg *j) +{ + stbi__free_jpeg_components(j, j->s->img_n, 0); +} + +typedef struct +{ + resample_row_func resample; + stbi_uc *line0,*line1; + int hs,vs; // expansion factor in each axis + int w_lores; // horizontal pixels pre-expansion + int ystep; // how far through vertical expansion we are + int ypos; // which pre-expansion row we're on +} stbi__resample; + +// fast 0..255 * 0..255 => 0..255 rounded multiplication +static stbi_uc stbi__blinn_8x8(stbi_uc x, stbi_uc y) +{ + unsigned int t = x*y + 128; + return (stbi_uc) ((t + (t >>8)) >> 8); +} + +static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp, int req_comp) +{ + int n, decode_n, is_rgb; + z->s->img_n = 0; // make stbi__cleanup_jpeg safe + + // validate req_comp + if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); + + // load a jpeg image from whichever source, but leave in YCbCr format + if (!stbi__decode_jpeg_image(z)) { stbi__cleanup_jpeg(z); return NULL; } + + // determine actual number of components to generate + n = req_comp ? req_comp : z->s->img_n >= 3 ? 3 : 1; + + is_rgb = z->s->img_n == 3 && (z->rgb == 3 || (z->app14_color_transform == 0 && !z->jfif)); + + if (z->s->img_n == 3 && n < 3 && !is_rgb) + decode_n = 1; + else + decode_n = z->s->img_n; + + // resample and color-convert + { + int k; + unsigned int i,j; + stbi_uc *output; + stbi_uc *coutput[4] = { NULL, NULL, NULL, NULL }; + + stbi__resample res_comp[4]; + + for (k=0; k < decode_n; ++k) { + stbi__resample *r = &res_comp[k]; + + // allocate line buffer big enough for upsampling off the edges + // with upsample factor of 4 + z->img_comp[k].linebuf = (stbi_uc *) stbi__malloc(z->s->img_x + 3); + if (!z->img_comp[k].linebuf) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); } + + r->hs = z->img_h_max / z->img_comp[k].h; + r->vs = z->img_v_max / z->img_comp[k].v; + r->ystep = r->vs >> 1; + r->w_lores = (z->s->img_x + r->hs-1) / r->hs; + r->ypos = 0; + r->line0 = r->line1 = z->img_comp[k].data; + + if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1; + else if (r->hs == 1 && r->vs == 2) r->resample = stbi__resample_row_v_2; + else if (r->hs == 2 && r->vs == 1) r->resample = stbi__resample_row_h_2; + else if (r->hs == 2 && r->vs == 2) r->resample = z->resample_row_hv_2_kernel; + else r->resample = stbi__resample_row_generic; + } + + // can't error after this so, this is safe + output = (stbi_uc *) stbi__malloc_mad3(n, z->s->img_x, z->s->img_y, 1); + if (!output) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); } + + // now go ahead and resample + for (j=0; j < z->s->img_y; ++j) { + stbi_uc *out = output + n * z->s->img_x * j; + for (k=0; k < decode_n; ++k) { + stbi__resample *r = &res_comp[k]; + int y_bot = r->ystep >= (r->vs >> 1); + coutput[k] = r->resample(z->img_comp[k].linebuf, + y_bot ? r->line1 : r->line0, + y_bot ? r->line0 : r->line1, + r->w_lores, r->hs); + if (++r->ystep >= r->vs) { + r->ystep = 0; + r->line0 = r->line1; + if (++r->ypos < z->img_comp[k].y) + r->line1 += z->img_comp[k].w2; + } + } + if (n >= 3) { + stbi_uc *y = coutput[0]; + if (z->s->img_n == 3) { + if (is_rgb) { + for (i=0; i < z->s->img_x; ++i) { + out[0] = y[i]; + out[1] = coutput[1][i]; + out[2] = coutput[2][i]; + out[3] = 255; + out += n; + } + } else { + z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); + } + } else if (z->s->img_n == 4) { + if (z->app14_color_transform == 0) { // CMYK + for (i=0; i < z->s->img_x; ++i) { + stbi_uc m = coutput[3][i]; + out[0] = stbi__blinn_8x8(coutput[0][i], m); + out[1] = stbi__blinn_8x8(coutput[1][i], m); + out[2] = stbi__blinn_8x8(coutput[2][i], m); + out[3] = 255; + out += n; + } + } else if (z->app14_color_transform == 2) { // YCCK + z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); + for (i=0; i < z->s->img_x; ++i) { + stbi_uc m = coutput[3][i]; + out[0] = stbi__blinn_8x8(255 - out[0], m); + out[1] = stbi__blinn_8x8(255 - out[1], m); + out[2] = stbi__blinn_8x8(255 - out[2], m); + out += n; + } + } else { // YCbCr + alpha? Ignore the fourth channel for now + z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); + } + } else + for (i=0; i < z->s->img_x; ++i) { + out[0] = out[1] = out[2] = y[i]; + out[3] = 255; // not used if n==3 + out += n; + } + } else { + if (is_rgb) { + if (n == 1) + for (i=0; i < z->s->img_x; ++i) + *out++ = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]); + else { + for (i=0; i < z->s->img_x; ++i, out += 2) { + out[0] = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]); + out[1] = 255; + } + } + } else if (z->s->img_n == 4 && z->app14_color_transform == 0) { + for (i=0; i < z->s->img_x; ++i) { + stbi_uc m = coutput[3][i]; + stbi_uc r = stbi__blinn_8x8(coutput[0][i], m); + stbi_uc g = stbi__blinn_8x8(coutput[1][i], m); + stbi_uc b = stbi__blinn_8x8(coutput[2][i], m); + out[0] = stbi__compute_y(r, g, b); + out[1] = 255; + out += n; + } + } else if (z->s->img_n == 4 && z->app14_color_transform == 2) { + for (i=0; i < z->s->img_x; ++i) { + out[0] = stbi__blinn_8x8(255 - coutput[0][i], coutput[3][i]); + out[1] = 255; + out += n; + } + } else { + stbi_uc *y = coutput[0]; + if (n == 1) + for (i=0; i < z->s->img_x; ++i) out[i] = y[i]; + else + for (i=0; i < z->s->img_x; ++i) { *out++ = y[i]; *out++ = 255; } + } + } + } + stbi__cleanup_jpeg(z); + *out_x = z->s->img_x; + *out_y = z->s->img_y; + if (comp) *comp = z->s->img_n >= 3 ? 3 : 1; // report original components, not output + return output; + } +} + +static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + unsigned char* result; + stbi__jpeg* j = (stbi__jpeg*) stbi__malloc(sizeof(stbi__jpeg)); + STBI_NOTUSED(ri); + j->s = s; + stbi__setup_jpeg(j); + result = load_jpeg_image(j, x,y,comp,req_comp); + STBI_FREE(j); + return result; +} + +static int stbi__jpeg_test(stbi__context *s) +{ + int r; + stbi__jpeg* j = (stbi__jpeg*)stbi__malloc(sizeof(stbi__jpeg)); + j->s = s; + stbi__setup_jpeg(j); + r = stbi__decode_jpeg_header(j, STBI__SCAN_type); + stbi__rewind(s); + STBI_FREE(j); + return r; +} + +static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp) +{ + if (!stbi__decode_jpeg_header(j, STBI__SCAN_header)) { + stbi__rewind( j->s ); + return 0; + } + if (x) *x = j->s->img_x; + if (y) *y = j->s->img_y; + if (comp) *comp = j->s->img_n >= 3 ? 3 : 1; + return 1; +} + +static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp) +{ + int result; + stbi__jpeg* j = (stbi__jpeg*) (stbi__malloc(sizeof(stbi__jpeg))); + j->s = s; + result = stbi__jpeg_info_raw(j, x, y, comp); + STBI_FREE(j); + return result; +} +#endif + +// public domain zlib decode v0.2 Sean Barrett 2006-11-18 +// simple implementation +// - all input must be provided in an upfront buffer +// - all output is written to a single output buffer (can malloc/realloc) +// performance +// - fast huffman + +#ifndef STBI_NO_ZLIB + +// fast-way is faster to check than jpeg huffman, but slow way is slower +#define STBI__ZFAST_BITS 9 // accelerate all cases in default tables +#define STBI__ZFAST_MASK ((1 << STBI__ZFAST_BITS) - 1) + +// zlib-style huffman encoding +// (jpegs packs from left, zlib from right, so can't share code) +typedef struct +{ + stbi__uint16 fast[1 << STBI__ZFAST_BITS]; + stbi__uint16 firstcode[16]; + int maxcode[17]; + stbi__uint16 firstsymbol[16]; + stbi_uc size[288]; + stbi__uint16 value[288]; +} stbi__zhuffman; + +stbi_inline static int stbi__bitreverse16(int n) +{ + n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1); + n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2); + n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4); + n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8); + return n; +} + +stbi_inline static int stbi__bit_reverse(int v, int bits) +{ + STBI_ASSERT(bits <= 16); + // to bit reverse n bits, reverse 16 and shift + // e.g. 11 bits, bit reverse and shift away 5 + return stbi__bitreverse16(v) >> (16-bits); +} + +static int stbi__zbuild_huffman(stbi__zhuffman *z, const stbi_uc *sizelist, int num) +{ + int i,k=0; + int code, next_code[16], sizes[17]; + + // DEFLATE spec for generating codes + memset(sizes, 0, sizeof(sizes)); + memset(z->fast, 0, sizeof(z->fast)); + for (i=0; i < num; ++i) + ++sizes[sizelist[i]]; + sizes[0] = 0; + for (i=1; i < 16; ++i) + if (sizes[i] > (1 << i)) + return stbi__err("bad sizes", "Corrupt PNG"); + code = 0; + for (i=1; i < 16; ++i) { + next_code[i] = code; + z->firstcode[i] = (stbi__uint16) code; + z->firstsymbol[i] = (stbi__uint16) k; + code = (code + sizes[i]); + if (sizes[i]) + if (code-1 >= (1 << i)) return stbi__err("bad codelengths","Corrupt PNG"); + z->maxcode[i] = code << (16-i); // preshift for inner loop + code <<= 1; + k += sizes[i]; + } + z->maxcode[16] = 0x10000; // sentinel + for (i=0; i < num; ++i) { + int s = sizelist[i]; + if (s) { + int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s]; + stbi__uint16 fastv = (stbi__uint16) ((s << 9) | i); + z->size [c] = (stbi_uc ) s; + z->value[c] = (stbi__uint16) i; + if (s <= STBI__ZFAST_BITS) { + int j = stbi__bit_reverse(next_code[s],s); + while (j < (1 << STBI__ZFAST_BITS)) { + z->fast[j] = fastv; + j += (1 << s); + } + } + ++next_code[s]; + } + } + return 1; +} + +// zlib-from-memory implementation for PNG reading +// because PNG allows splitting the zlib stream arbitrarily, +// and it's annoying structurally to have PNG call ZLIB call PNG, +// we require PNG read all the IDATs and combine them into a single +// memory buffer + +typedef struct +{ + stbi_uc *zbuffer, *zbuffer_end; + int num_bits; + stbi__uint32 code_buffer; + + char *zout; + char *zout_start; + char *zout_end; + int z_expandable; + + stbi__zhuffman z_length, z_distance; +} stbi__zbuf; + +stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z) +{ + if (z->zbuffer >= z->zbuffer_end) return 0; + return *z->zbuffer++; +} + +static void stbi__fill_bits(stbi__zbuf *z) +{ + do { + STBI_ASSERT(z->code_buffer < (1U << z->num_bits)); + z->code_buffer |= (unsigned int) stbi__zget8(z) << z->num_bits; + z->num_bits += 8; + } while (z->num_bits <= 24); +} + +stbi_inline static unsigned int stbi__zreceive(stbi__zbuf *z, int n) +{ + unsigned int k; + if (z->num_bits < n) stbi__fill_bits(z); + k = z->code_buffer & ((1 << n) - 1); + z->code_buffer >>= n; + z->num_bits -= n; + return k; +} + +static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z) +{ + int b,s,k; + // not resolved by fast table, so compute it the slow way + // use jpeg approach, which requires MSbits at top + k = stbi__bit_reverse(a->code_buffer, 16); + for (s=STBI__ZFAST_BITS+1; ; ++s) + if (k < z->maxcode[s]) + break; + if (s == 16) return -1; // invalid code! + // code size is s, so: + b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s]; + STBI_ASSERT(z->size[b] == s); + a->code_buffer >>= s; + a->num_bits -= s; + return z->value[b]; +} + +stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffman *z) +{ + int b,s; + if (a->num_bits < 16) stbi__fill_bits(a); + b = z->fast[a->code_buffer & STBI__ZFAST_MASK]; + if (b) { + s = b >> 9; + a->code_buffer >>= s; + a->num_bits -= s; + return b & 511; + } + return stbi__zhuffman_decode_slowpath(a, z); +} + +static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) // need to make room for n bytes +{ + char *q; + int cur, limit, old_limit; + z->zout = zout; + if (!z->z_expandable) return stbi__err("output buffer limit","Corrupt PNG"); + cur = (int) (z->zout - z->zout_start); + limit = old_limit = (int) (z->zout_end - z->zout_start); + while (cur + n > limit) + limit *= 2; + q = (char *) STBI_REALLOC_SIZED(z->zout_start, old_limit, limit); + STBI_NOTUSED(old_limit); + if (q == NULL) return stbi__err("outofmem", "Out of memory"); + z->zout_start = q; + z->zout = q + cur; + z->zout_end = q + limit; + return 1; +} + +static const int stbi__zlength_base[31] = { + 3,4,5,6,7,8,9,10,11,13, + 15,17,19,23,27,31,35,43,51,59, + 67,83,99,115,131,163,195,227,258,0,0 }; + +static const int stbi__zlength_extra[31]= +{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; + +static const int stbi__zdist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, +257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; + +static const int stbi__zdist_extra[32] = +{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +static int stbi__parse_huffman_block(stbi__zbuf *a) +{ + char *zout = a->zout; + for(;;) { + int z = stbi__zhuffman_decode(a, &a->z_length); + if (z < 256) { + if (z < 0) return stbi__err("bad huffman code","Corrupt PNG"); // error in huffman codes + if (zout >= a->zout_end) { + if (!stbi__zexpand(a, zout, 1)) return 0; + zout = a->zout; + } + *zout++ = (char) z; + } else { + stbi_uc *p; + int len,dist; + if (z == 256) { + a->zout = zout; + return 1; + } + z -= 257; + len = stbi__zlength_base[z]; + if (stbi__zlength_extra[z]) len += stbi__zreceive(a, stbi__zlength_extra[z]); + z = stbi__zhuffman_decode(a, &a->z_distance); + if (z < 0) return stbi__err("bad huffman code","Corrupt PNG"); + dist = stbi__zdist_base[z]; + if (stbi__zdist_extra[z]) dist += stbi__zreceive(a, stbi__zdist_extra[z]); + if (zout - a->zout_start < dist) return stbi__err("bad dist","Corrupt PNG"); + if (zout + len > a->zout_end) { + if (!stbi__zexpand(a, zout, len)) return 0; + zout = a->zout; + } + p = (stbi_uc *) (zout - dist); + if (dist == 1) { // run of one byte; common in images. + stbi_uc v = *p; + if (len) { do *zout++ = v; while (--len); } + } else { + if (len) { do *zout++ = *p++; while (--len); } + } + } + } +} + +static int stbi__compute_huffman_codes(stbi__zbuf *a) +{ + static const stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; + stbi__zhuffman z_codelength; + stbi_uc lencodes[286+32+137];//padding for maximum single op + stbi_uc codelength_sizes[19]; + int i,n; + + int hlit = stbi__zreceive(a,5) + 257; + int hdist = stbi__zreceive(a,5) + 1; + int hclen = stbi__zreceive(a,4) + 4; + int ntot = hlit + hdist; + + memset(codelength_sizes, 0, sizeof(codelength_sizes)); + for (i=0; i < hclen; ++i) { + int s = stbi__zreceive(a,3); + codelength_sizes[length_dezigzag[i]] = (stbi_uc) s; + } + if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; + + n = 0; + while (n < ntot) { + int c = stbi__zhuffman_decode(a, &z_codelength); + if (c < 0 || c >= 19) return stbi__err("bad codelengths", "Corrupt PNG"); + if (c < 16) + lencodes[n++] = (stbi_uc) c; + else { + stbi_uc fill = 0; + if (c == 16) { + c = stbi__zreceive(a,2)+3; + if (n == 0) return stbi__err("bad codelengths", "Corrupt PNG"); + fill = lencodes[n-1]; + } else if (c == 17) + c = stbi__zreceive(a,3)+3; + else { + STBI_ASSERT(c == 18); + c = stbi__zreceive(a,7)+11; + } + if (ntot - n < c) return stbi__err("bad codelengths", "Corrupt PNG"); + memset(lencodes+n, fill, c); + n += c; + } + } + if (n != ntot) return stbi__err("bad codelengths","Corrupt PNG"); + if (!stbi__zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; + if (!stbi__zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; + return 1; +} + +static int stbi__parse_uncompressed_block(stbi__zbuf *a) +{ + stbi_uc header[4]; + int len,nlen,k; + if (a->num_bits & 7) + stbi__zreceive(a, a->num_bits & 7); // discard + // drain the bit-packed data into header + k = 0; + while (a->num_bits > 0) { + header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check + a->code_buffer >>= 8; + a->num_bits -= 8; + } + STBI_ASSERT(a->num_bits == 0); + // now fill header the normal way + while (k < 4) + header[k++] = stbi__zget8(a); + len = header[1] * 256 + header[0]; + nlen = header[3] * 256 + header[2]; + if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG"); + if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG"); + if (a->zout + len > a->zout_end) + if (!stbi__zexpand(a, a->zout, len)) return 0; + memcpy(a->zout, a->zbuffer, len); + a->zbuffer += len; + a->zout += len; + return 1; +} + +static int stbi__parse_zlib_header(stbi__zbuf *a) +{ + int cmf = stbi__zget8(a); + int cm = cmf & 15; + /* int cinfo = cmf >> 4; */ + int flg = stbi__zget8(a); + if ((cmf*256+flg) % 31 != 0) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec + if (flg & 32) return stbi__err("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png + if (cm != 8) return stbi__err("bad compression","Corrupt PNG"); // DEFLATE required for png + // window = 1 << (8 + cinfo)... but who cares, we fully buffer output + return 1; +} + +static const stbi_uc stbi__zdefault_length[288] = +{ + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8 +}; +static const stbi_uc stbi__zdefault_distance[32] = +{ + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 +}; +/* +Init algorithm: +{ + int i; // use <= to match clearly with spec + for (i=0; i <= 143; ++i) stbi__zdefault_length[i] = 8; + for ( ; i <= 255; ++i) stbi__zdefault_length[i] = 9; + for ( ; i <= 279; ++i) stbi__zdefault_length[i] = 7; + for ( ; i <= 287; ++i) stbi__zdefault_length[i] = 8; + + for (i=0; i <= 31; ++i) stbi__zdefault_distance[i] = 5; +} +*/ + +static int stbi__parse_zlib(stbi__zbuf *a, int parse_header) +{ + int final, type; + if (parse_header) + if (!stbi__parse_zlib_header(a)) return 0; + a->num_bits = 0; + a->code_buffer = 0; + do { + final = stbi__zreceive(a,1); + type = stbi__zreceive(a,2); + if (type == 0) { + if (!stbi__parse_uncompressed_block(a)) return 0; + } else if (type == 3) { + return 0; + } else { + if (type == 1) { + // use fixed code lengths + if (!stbi__zbuild_huffman(&a->z_length , stbi__zdefault_length , 288)) return 0; + if (!stbi__zbuild_huffman(&a->z_distance, stbi__zdefault_distance, 32)) return 0; + } else { + if (!stbi__compute_huffman_codes(a)) return 0; + } + if (!stbi__parse_huffman_block(a)) return 0; + } + } while (!final); + return 1; +} + +static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, int parse_header) +{ + a->zout_start = obuf; + a->zout = obuf; + a->zout_end = obuf + olen; + a->z_expandable = exp; + + return stbi__parse_zlib(a, parse_header); +} + +STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen) +{ + stbi__zbuf a; + char *p = (char *) stbi__malloc(initial_size); + if (p == NULL) return NULL; + a.zbuffer = (stbi_uc *) buffer; + a.zbuffer_end = (stbi_uc *) buffer + len; + if (stbi__do_zlib(&a, p, initial_size, 1, 1)) { + if (outlen) *outlen = (int) (a.zout - a.zout_start); + return a.zout_start; + } else { + STBI_FREE(a.zout_start); + return NULL; + } +} + +STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen) +{ + return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen); +} + +STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header) +{ + stbi__zbuf a; + char *p = (char *) stbi__malloc(initial_size); + if (p == NULL) return NULL; + a.zbuffer = (stbi_uc *) buffer; + a.zbuffer_end = (stbi_uc *) buffer + len; + if (stbi__do_zlib(&a, p, initial_size, 1, parse_header)) { + if (outlen) *outlen = (int) (a.zout - a.zout_start); + return a.zout_start; + } else { + STBI_FREE(a.zout_start); + return NULL; + } +} + +STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen) +{ + stbi__zbuf a; + a.zbuffer = (stbi_uc *) ibuffer; + a.zbuffer_end = (stbi_uc *) ibuffer + ilen; + if (stbi__do_zlib(&a, obuffer, olen, 0, 1)) + return (int) (a.zout - a.zout_start); + else + return -1; +} + +STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen) +{ + stbi__zbuf a; + char *p = (char *) stbi__malloc(16384); + if (p == NULL) return NULL; + a.zbuffer = (stbi_uc *) buffer; + a.zbuffer_end = (stbi_uc *) buffer+len; + if (stbi__do_zlib(&a, p, 16384, 1, 0)) { + if (outlen) *outlen = (int) (a.zout - a.zout_start); + return a.zout_start; + } else { + STBI_FREE(a.zout_start); + return NULL; + } +} + +STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen) +{ + stbi__zbuf a; + a.zbuffer = (stbi_uc *) ibuffer; + a.zbuffer_end = (stbi_uc *) ibuffer + ilen; + if (stbi__do_zlib(&a, obuffer, olen, 0, 0)) + return (int) (a.zout - a.zout_start); + else + return -1; +} +#endif + +// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18 +// simple implementation +// - only 8-bit samples +// - no CRC checking +// - allocates lots of intermediate memory +// - avoids problem of streaming data between subsystems +// - avoids explicit window management +// performance +// - uses stb_zlib, a PD zlib implementation with fast huffman decoding + +#ifndef STBI_NO_PNG +typedef struct +{ + stbi__uint32 length; + stbi__uint32 type; +} stbi__pngchunk; + +static stbi__pngchunk stbi__get_chunk_header(stbi__context *s) +{ + stbi__pngchunk c; + c.length = stbi__get32be(s); + c.type = stbi__get32be(s); + return c; +} + +static int stbi__check_png_header(stbi__context *s) +{ + static const stbi_uc png_sig[8] = { 137,80,78,71,13,10,26,10 }; + int i; + for (i=0; i < 8; ++i) + if (stbi__get8(s) != png_sig[i]) return stbi__err("bad png sig","Not a PNG"); + return 1; +} + +typedef struct +{ + stbi__context *s; + stbi_uc *idata, *expanded, *out; + int depth; +} stbi__png; + + +enum { + STBI__F_none=0, + STBI__F_sub=1, + STBI__F_up=2, + STBI__F_avg=3, + STBI__F_paeth=4, + // synthetic filters used for first scanline to avoid needing a dummy row of 0s + STBI__F_avg_first, + STBI__F_paeth_first +}; + +static stbi_uc first_row_filter[5] = +{ + STBI__F_none, + STBI__F_sub, + STBI__F_none, + STBI__F_avg_first, + STBI__F_paeth_first +}; + +static int stbi__paeth(int a, int b, int c) +{ + int p = a + b - c; + int pa = abs(p-a); + int pb = abs(p-b); + int pc = abs(p-c); + if (pa <= pb && pa <= pc) return a; + if (pb <= pc) return b; + return c; +} + +static const stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 }; + +// create the png data from post-deflated data +static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color) +{ + int bytes = (depth == 16? 2 : 1); + stbi__context *s = a->s; + stbi__uint32 i,j,stride = x*out_n*bytes; + stbi__uint32 img_len, img_width_bytes; + int k; + int img_n = s->img_n; // copy it into a local for later + + int output_bytes = out_n*bytes; + int filter_bytes = img_n*bytes; + int width = x; + + STBI_ASSERT(out_n == s->img_n || out_n == s->img_n+1); + a->out = (stbi_uc *) stbi__malloc_mad3(x, y, output_bytes, 0); // extra bytes to write off the end into + if (!a->out) return stbi__err("outofmem", "Out of memory"); + + if (!stbi__mad3sizes_valid(img_n, x, depth, 7)) return stbi__err("too large", "Corrupt PNG"); + img_width_bytes = (((img_n * x * depth) + 7) >> 3); + img_len = (img_width_bytes + 1) * y; + + // we used to check for exact match between raw_len and img_len on non-interlaced PNGs, + // but issue #276 reported a PNG in the wild that had extra data at the end (all zeros), + // so just check for raw_len < img_len always. + if (raw_len < img_len) return stbi__err("not enough pixels","Corrupt PNG"); + + for (j=0; j < y; ++j) { + stbi_uc *cur = a->out + stride*j; + stbi_uc *prior; + int filter = *raw++; + + if (filter > 4) + return stbi__err("invalid filter","Corrupt PNG"); + + if (depth < 8) { + STBI_ASSERT(img_width_bytes <= x); + cur += x*out_n - img_width_bytes; // store output to the rightmost img_len bytes, so we can decode in place + filter_bytes = 1; + width = img_width_bytes; + } + prior = cur - stride; // bugfix: need to compute this after 'cur +=' computation above + + // if first row, use special filter that doesn't sample previous row + if (j == 0) filter = first_row_filter[filter]; + + // handle first byte explicitly + for (k=0; k < filter_bytes; ++k) { + switch (filter) { + case STBI__F_none : cur[k] = raw[k]; break; + case STBI__F_sub : cur[k] = raw[k]; break; + case STBI__F_up : cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break; + case STBI__F_avg : cur[k] = STBI__BYTECAST(raw[k] + (prior[k]>>1)); break; + case STBI__F_paeth : cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(0,prior[k],0)); break; + case STBI__F_avg_first : cur[k] = raw[k]; break; + case STBI__F_paeth_first: cur[k] = raw[k]; break; + } + } + + if (depth == 8) { + if (img_n != out_n) + cur[img_n] = 255; // first pixel + raw += img_n; + cur += out_n; + prior += out_n; + } else if (depth == 16) { + if (img_n != out_n) { + cur[filter_bytes] = 255; // first pixel top byte + cur[filter_bytes+1] = 255; // first pixel bottom byte + } + raw += filter_bytes; + cur += output_bytes; + prior += output_bytes; + } else { + raw += 1; + cur += 1; + prior += 1; + } + + // this is a little gross, so that we don't switch per-pixel or per-component + if (depth < 8 || img_n == out_n) { + int nk = (width - 1)*filter_bytes; + #define STBI__CASE(f) \ + case f: \ + for (k=0; k < nk; ++k) + switch (filter) { + // "none" filter turns into a memcpy here; make that explicit. + case STBI__F_none: memcpy(cur, raw, nk); break; + STBI__CASE(STBI__F_sub) { cur[k] = STBI__BYTECAST(raw[k] + cur[k-filter_bytes]); } break; + STBI__CASE(STBI__F_up) { cur[k] = STBI__BYTECAST(raw[k] + prior[k]); } break; + STBI__CASE(STBI__F_avg) { cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-filter_bytes])>>1)); } break; + STBI__CASE(STBI__F_paeth) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],prior[k],prior[k-filter_bytes])); } break; + STBI__CASE(STBI__F_avg_first) { cur[k] = STBI__BYTECAST(raw[k] + (cur[k-filter_bytes] >> 1)); } break; + STBI__CASE(STBI__F_paeth_first) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],0,0)); } break; + } + #undef STBI__CASE + raw += nk; + } else { + STBI_ASSERT(img_n+1 == out_n); + #define STBI__CASE(f) \ + case f: \ + for (i=x-1; i >= 1; --i, cur[filter_bytes]=255,raw+=filter_bytes,cur+=output_bytes,prior+=output_bytes) \ + for (k=0; k < filter_bytes; ++k) + switch (filter) { + STBI__CASE(STBI__F_none) { cur[k] = raw[k]; } break; + STBI__CASE(STBI__F_sub) { cur[k] = STBI__BYTECAST(raw[k] + cur[k- output_bytes]); } break; + STBI__CASE(STBI__F_up) { cur[k] = STBI__BYTECAST(raw[k] + prior[k]); } break; + STBI__CASE(STBI__F_avg) { cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k- output_bytes])>>1)); } break; + STBI__CASE(STBI__F_paeth) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k- output_bytes],prior[k],prior[k- output_bytes])); } break; + STBI__CASE(STBI__F_avg_first) { cur[k] = STBI__BYTECAST(raw[k] + (cur[k- output_bytes] >> 1)); } break; + STBI__CASE(STBI__F_paeth_first) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k- output_bytes],0,0)); } break; + } + #undef STBI__CASE + + // the loop above sets the high byte of the pixels' alpha, but for + // 16 bit png files we also need the low byte set. we'll do that here. + if (depth == 16) { + cur = a->out + stride*j; // start at the beginning of the row again + for (i=0; i < x; ++i,cur+=output_bytes) { + cur[filter_bytes+1] = 255; + } + } + } + } + + // we make a separate pass to expand bits to pixels; for performance, + // this could run two scanlines behind the above code, so it won't + // intefere with filtering but will still be in the cache. + if (depth < 8) { + for (j=0; j < y; ++j) { + stbi_uc *cur = a->out + stride*j; + stbi_uc *in = a->out + stride*j + x*out_n - img_width_bytes; + // unpack 1/2/4-bit into a 8-bit buffer. allows us to keep the common 8-bit path optimal at minimal cost for 1/2/4-bit + // png guarante byte alignment, if width is not multiple of 8/4/2 we'll decode dummy trailing data that will be skipped in the later loop + stbi_uc scale = (color == 0) ? stbi__depth_scale_table[depth] : 1; // scale grayscale values to 0..255 range + + // note that the final byte might overshoot and write more data than desired. + // we can allocate enough data that this never writes out of memory, but it + // could also overwrite the next scanline. can it overwrite non-empty data + // on the next scanline? yes, consider 1-pixel-wide scanlines with 1-bit-per-pixel. + // so we need to explicitly clamp the final ones + + if (depth == 4) { + for (k=x*img_n; k >= 2; k-=2, ++in) { + *cur++ = scale * ((*in >> 4) ); + *cur++ = scale * ((*in ) & 0x0f); + } + if (k > 0) *cur++ = scale * ((*in >> 4) ); + } else if (depth == 2) { + for (k=x*img_n; k >= 4; k-=4, ++in) { + *cur++ = scale * ((*in >> 6) ); + *cur++ = scale * ((*in >> 4) & 0x03); + *cur++ = scale * ((*in >> 2) & 0x03); + *cur++ = scale * ((*in ) & 0x03); + } + if (k > 0) *cur++ = scale * ((*in >> 6) ); + if (k > 1) *cur++ = scale * ((*in >> 4) & 0x03); + if (k > 2) *cur++ = scale * ((*in >> 2) & 0x03); + } else if (depth == 1) { + for (k=x*img_n; k >= 8; k-=8, ++in) { + *cur++ = scale * ((*in >> 7) ); + *cur++ = scale * ((*in >> 6) & 0x01); + *cur++ = scale * ((*in >> 5) & 0x01); + *cur++ = scale * ((*in >> 4) & 0x01); + *cur++ = scale * ((*in >> 3) & 0x01); + *cur++ = scale * ((*in >> 2) & 0x01); + *cur++ = scale * ((*in >> 1) & 0x01); + *cur++ = scale * ((*in ) & 0x01); + } + if (k > 0) *cur++ = scale * ((*in >> 7) ); + if (k > 1) *cur++ = scale * ((*in >> 6) & 0x01); + if (k > 2) *cur++ = scale * ((*in >> 5) & 0x01); + if (k > 3) *cur++ = scale * ((*in >> 4) & 0x01); + if (k > 4) *cur++ = scale * ((*in >> 3) & 0x01); + if (k > 5) *cur++ = scale * ((*in >> 2) & 0x01); + if (k > 6) *cur++ = scale * ((*in >> 1) & 0x01); + } + if (img_n != out_n) { + int q; + // insert alpha = 255 + cur = a->out + stride*j; + if (img_n == 1) { + for (q=x-1; q >= 0; --q) { + cur[q*2+1] = 255; + cur[q*2+0] = cur[q]; + } + } else { + STBI_ASSERT(img_n == 3); + for (q=x-1; q >= 0; --q) { + cur[q*4+3] = 255; + cur[q*4+2] = cur[q*3+2]; + cur[q*4+1] = cur[q*3+1]; + cur[q*4+0] = cur[q*3+0]; + } + } + } + } + } else if (depth == 16) { + // force the image data from big-endian to platform-native. + // this is done in a separate pass due to the decoding relying + // on the data being untouched, but could probably be done + // per-line during decode if care is taken. + stbi_uc *cur = a->out; + stbi__uint16 *cur16 = (stbi__uint16*)cur; + + for(i=0; i < x*y*out_n; ++i,cur16++,cur+=2) { + *cur16 = (cur[0] << 8) | cur[1]; + } + } + + return 1; +} + +static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stbi__uint32 image_data_len, int out_n, int depth, int color, int interlaced) +{ + int bytes = (depth == 16 ? 2 : 1); + int out_bytes = out_n * bytes; + stbi_uc *final; + int p; + if (!interlaced) + return stbi__create_png_image_raw(a, image_data, image_data_len, out_n, a->s->img_x, a->s->img_y, depth, color); + + // de-interlacing + final = (stbi_uc *) stbi__malloc_mad3(a->s->img_x, a->s->img_y, out_bytes, 0); + for (p=0; p < 7; ++p) { + int xorig[] = { 0,4,0,2,0,1,0 }; + int yorig[] = { 0,0,4,0,2,0,1 }; + int xspc[] = { 8,8,4,4,2,2,1 }; + int yspc[] = { 8,8,8,4,4,2,2 }; + int i,j,x,y; + // pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1 + x = (a->s->img_x - xorig[p] + xspc[p]-1) / xspc[p]; + y = (a->s->img_y - yorig[p] + yspc[p]-1) / yspc[p]; + if (x && y) { + stbi__uint32 img_len = ((((a->s->img_n * x * depth) + 7) >> 3) + 1) * y; + if (!stbi__create_png_image_raw(a, image_data, image_data_len, out_n, x, y, depth, color)) { + STBI_FREE(final); + return 0; + } + for (j=0; j < y; ++j) { + for (i=0; i < x; ++i) { + int out_y = j*yspc[p]+yorig[p]; + int out_x = i*xspc[p]+xorig[p]; + memcpy(final + out_y*a->s->img_x*out_bytes + out_x*out_bytes, + a->out + (j*x+i)*out_bytes, out_bytes); + } + } + STBI_FREE(a->out); + image_data += img_len; + image_data_len -= img_len; + } + } + a->out = final; + + return 1; +} + +static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int out_n) +{ + stbi__context *s = z->s; + stbi__uint32 i, pixel_count = s->img_x * s->img_y; + stbi_uc *p = z->out; + + // compute color-based transparency, assuming we've + // already got 255 as the alpha value in the output + STBI_ASSERT(out_n == 2 || out_n == 4); + + if (out_n == 2) { + for (i=0; i < pixel_count; ++i) { + p[1] = (p[0] == tc[0] ? 0 : 255); + p += 2; + } + } else { + for (i=0; i < pixel_count; ++i) { + if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) + p[3] = 0; + p += 4; + } + } + return 1; +} + +static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], int out_n) +{ + stbi__context *s = z->s; + stbi__uint32 i, pixel_count = s->img_x * s->img_y; + stbi__uint16 *p = (stbi__uint16*) z->out; + + // compute color-based transparency, assuming we've + // already got 65535 as the alpha value in the output + STBI_ASSERT(out_n == 2 || out_n == 4); + + if (out_n == 2) { + for (i = 0; i < pixel_count; ++i) { + p[1] = (p[0] == tc[0] ? 0 : 65535); + p += 2; + } + } else { + for (i = 0; i < pixel_count; ++i) { + if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) + p[3] = 0; + p += 4; + } + } + return 1; +} + +static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n) +{ + stbi__uint32 i, pixel_count = a->s->img_x * a->s->img_y; + stbi_uc *p, *temp_out, *orig = a->out; + + p = (stbi_uc *) stbi__malloc_mad2(pixel_count, pal_img_n, 0); + if (p == NULL) return stbi__err("outofmem", "Out of memory"); + + // between here and free(out) below, exitting would leak + temp_out = p; + + if (pal_img_n == 3) { + for (i=0; i < pixel_count; ++i) { + int n = orig[i]*4; + p[0] = palette[n ]; + p[1] = palette[n+1]; + p[2] = palette[n+2]; + p += 3; + } + } else { + for (i=0; i < pixel_count; ++i) { + int n = orig[i]*4; + p[0] = palette[n ]; + p[1] = palette[n+1]; + p[2] = palette[n+2]; + p[3] = palette[n+3]; + p += 4; + } + } + STBI_FREE(a->out); + a->out = temp_out; + + STBI_NOTUSED(len); + + return 1; +} + +static int stbi__unpremultiply_on_load = 0; +static int stbi__de_iphone_flag = 0; + +STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply) +{ + stbi__unpremultiply_on_load = flag_true_if_should_unpremultiply; +} + +STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert) +{ + stbi__de_iphone_flag = flag_true_if_should_convert; +} + +static void stbi__de_iphone(stbi__png *z) +{ + stbi__context *s = z->s; + stbi__uint32 i, pixel_count = s->img_x * s->img_y; + stbi_uc *p = z->out; + + if (s->img_out_n == 3) { // convert bgr to rgb + for (i=0; i < pixel_count; ++i) { + stbi_uc t = p[0]; + p[0] = p[2]; + p[2] = t; + p += 3; + } + } else { + STBI_ASSERT(s->img_out_n == 4); + if (stbi__unpremultiply_on_load) { + // convert bgr to rgb and unpremultiply + for (i=0; i < pixel_count; ++i) { + stbi_uc a = p[3]; + stbi_uc t = p[0]; + if (a) { + stbi_uc half = a / 2; + p[0] = (p[2] * 255 + half) / a; + p[1] = (p[1] * 255 + half) / a; + p[2] = ( t * 255 + half) / a; + } else { + p[0] = p[2]; + p[2] = t; + } + p += 4; + } + } else { + // convert bgr to rgb + for (i=0; i < pixel_count; ++i) { + stbi_uc t = p[0]; + p[0] = p[2]; + p[2] = t; + p += 4; + } + } + } +} + +#define STBI__PNG_TYPE(a,b,c,d) (((unsigned) (a) << 24) + ((unsigned) (b) << 16) + ((unsigned) (c) << 8) + (unsigned) (d)) + +static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp) +{ + stbi_uc palette[1024], pal_img_n=0; + stbi_uc has_trans=0, tc[3]={0}; + stbi__uint16 tc16[3]; + stbi__uint32 ioff=0, idata_limit=0, i, pal_len=0; + int first=1,k,interlace=0, color=0, is_iphone=0; + stbi__context *s = z->s; + + z->expanded = NULL; + z->idata = NULL; + z->out = NULL; + + if (!stbi__check_png_header(s)) return 0; + + if (scan == STBI__SCAN_type) return 1; + + for (;;) { + stbi__pngchunk c = stbi__get_chunk_header(s); + switch (c.type) { + case STBI__PNG_TYPE('C','g','B','I'): + is_iphone = 1; + stbi__skip(s, c.length); + break; + case STBI__PNG_TYPE('I','H','D','R'): { + int comp,filter; + if (!first) return stbi__err("multiple IHDR","Corrupt PNG"); + first = 0; + if (c.length != 13) return stbi__err("bad IHDR len","Corrupt PNG"); + s->img_x = stbi__get32be(s); if (s->img_x > (1 << 24)) return stbi__err("too large","Very large image (corrupt?)"); + s->img_y = stbi__get32be(s); if (s->img_y > (1 << 24)) return stbi__err("too large","Very large image (corrupt?)"); + z->depth = stbi__get8(s); if (z->depth != 1 && z->depth != 2 && z->depth != 4 && z->depth != 8 && z->depth != 16) return stbi__err("1/2/4/8/16-bit only","PNG not supported: 1/2/4/8/16-bit only"); + color = stbi__get8(s); if (color > 6) return stbi__err("bad ctype","Corrupt PNG"); + if (color == 3 && z->depth == 16) return stbi__err("bad ctype","Corrupt PNG"); + if (color == 3) pal_img_n = 3; else if (color & 1) return stbi__err("bad ctype","Corrupt PNG"); + comp = stbi__get8(s); if (comp) return stbi__err("bad comp method","Corrupt PNG"); + filter= stbi__get8(s); if (filter) return stbi__err("bad filter method","Corrupt PNG"); + interlace = stbi__get8(s); if (interlace>1) return stbi__err("bad interlace method","Corrupt PNG"); + if (!s->img_x || !s->img_y) return stbi__err("0-pixel image","Corrupt PNG"); + if (!pal_img_n) { + s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0); + if ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err("too large", "Image too large to decode"); + if (scan == STBI__SCAN_header) return 1; + } else { + // if paletted, then pal_n is our final components, and + // img_n is # components to decompress/filter. + s->img_n = 1; + if ((1 << 30) / s->img_x / 4 < s->img_y) return stbi__err("too large","Corrupt PNG"); + // if SCAN_header, have to scan to see if we have a tRNS + } + break; + } + + case STBI__PNG_TYPE('P','L','T','E'): { + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (c.length > 256*3) return stbi__err("invalid PLTE","Corrupt PNG"); + pal_len = c.length / 3; + if (pal_len * 3 != c.length) return stbi__err("invalid PLTE","Corrupt PNG"); + for (i=0; i < pal_len; ++i) { + palette[i*4+0] = stbi__get8(s); + palette[i*4+1] = stbi__get8(s); + palette[i*4+2] = stbi__get8(s); + palette[i*4+3] = 255; + } + break; + } + + case STBI__PNG_TYPE('t','R','N','S'): { + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (z->idata) return stbi__err("tRNS after IDAT","Corrupt PNG"); + if (pal_img_n) { + if (scan == STBI__SCAN_header) { s->img_n = 4; return 1; } + if (pal_len == 0) return stbi__err("tRNS before PLTE","Corrupt PNG"); + if (c.length > pal_len) return stbi__err("bad tRNS len","Corrupt PNG"); + pal_img_n = 4; + for (i=0; i < c.length; ++i) + palette[i*4+3] = stbi__get8(s); + } else { + if (!(s->img_n & 1)) return stbi__err("tRNS with alpha","Corrupt PNG"); + if (c.length != (stbi__uint32) s->img_n*2) return stbi__err("bad tRNS len","Corrupt PNG"); + has_trans = 1; + if (z->depth == 16) { + for (k = 0; k < s->img_n; ++k) tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is + } else { + for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger + } + } + break; + } + + case STBI__PNG_TYPE('I','D','A','T'): { + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG"); + if (scan == STBI__SCAN_header) { s->img_n = pal_img_n; return 1; } + if ((int)(ioff + c.length) < (int)ioff) return 0; + if (ioff + c.length > idata_limit) { + stbi__uint32 idata_limit_old = idata_limit; + stbi_uc *p; + if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096; + while (ioff + c.length > idata_limit) + idata_limit *= 2; + STBI_NOTUSED(idata_limit_old); + p = (stbi_uc *) STBI_REALLOC_SIZED(z->idata, idata_limit_old, idata_limit); if (p == NULL) return stbi__err("outofmem", "Out of memory"); + z->idata = p; + } + if (!stbi__getn(s, z->idata+ioff,c.length)) return stbi__err("outofdata","Corrupt PNG"); + ioff += c.length; + break; + } + + case STBI__PNG_TYPE('I','E','N','D'): { + stbi__uint32 raw_len, bpl; + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (scan != STBI__SCAN_load) return 1; + if (z->idata == NULL) return stbi__err("no IDAT","Corrupt PNG"); + // initial guess for decoded data size to avoid unnecessary reallocs + bpl = (s->img_x * z->depth + 7) / 8; // bytes per line, per component + raw_len = bpl * s->img_y * s->img_n /* pixels */ + s->img_y /* filter mode per row */; + z->expanded = (stbi_uc *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, raw_len, (int *) &raw_len, !is_iphone); + if (z->expanded == NULL) return 0; // zlib should set error + STBI_FREE(z->idata); z->idata = NULL; + if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans) + s->img_out_n = s->img_n+1; + else + s->img_out_n = s->img_n; + if (!stbi__create_png_image(z, z->expanded, raw_len, s->img_out_n, z->depth, color, interlace)) return 0; + if (has_trans) { + if (z->depth == 16) { + if (!stbi__compute_transparency16(z, tc16, s->img_out_n)) return 0; + } else { + if (!stbi__compute_transparency(z, tc, s->img_out_n)) return 0; + } + } + if (is_iphone && stbi__de_iphone_flag && s->img_out_n > 2) + stbi__de_iphone(z); + if (pal_img_n) { + // pal_img_n == 3 or 4 + s->img_n = pal_img_n; // record the actual colors we had + s->img_out_n = pal_img_n; + if (req_comp >= 3) s->img_out_n = req_comp; + if (!stbi__expand_png_palette(z, palette, pal_len, s->img_out_n)) + return 0; + } else if (has_trans) { + // non-paletted image with tRNS -> source image has (constant) alpha + ++s->img_n; + } + STBI_FREE(z->expanded); z->expanded = NULL; + return 1; + } + + default: + // if critical, fail + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if ((c.type & (1 << 29)) == 0) { + #ifndef STBI_NO_FAILURE_STRINGS + // not threadsafe + static char invalid_chunk[] = "XXXX PNG chunk not known"; + invalid_chunk[0] = STBI__BYTECAST(c.type >> 24); + invalid_chunk[1] = STBI__BYTECAST(c.type >> 16); + invalid_chunk[2] = STBI__BYTECAST(c.type >> 8); + invalid_chunk[3] = STBI__BYTECAST(c.type >> 0); + #endif + return stbi__err(invalid_chunk, "PNG not supported: unknown PNG chunk type"); + } + stbi__skip(s, c.length); + break; + } + // end of PNG chunk, read and skip CRC + stbi__get32be(s); + } +} + +static void *stbi__do_png(stbi__png *p, int *x, int *y, int *n, int req_comp, stbi__result_info *ri) +{ + void *result=NULL; + if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); + if (stbi__parse_png_file(p, STBI__SCAN_load, req_comp)) { + if (p->depth < 8) + ri->bits_per_channel = 8; + else + ri->bits_per_channel = p->depth; + result = p->out; + p->out = NULL; + if (req_comp && req_comp != p->s->img_out_n) { + if (ri->bits_per_channel == 8) + result = stbi__convert_format((unsigned char *) result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y); + else + result = stbi__convert_format16((stbi__uint16 *) result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y); + p->s->img_out_n = req_comp; + if (result == NULL) return result; + } + *x = p->s->img_x; + *y = p->s->img_y; + if (n) *n = p->s->img_n; + } + STBI_FREE(p->out); p->out = NULL; + STBI_FREE(p->expanded); p->expanded = NULL; + STBI_FREE(p->idata); p->idata = NULL; + + return result; +} + +static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + stbi__png p; + p.s = s; + return stbi__do_png(&p, x,y,comp,req_comp, ri); +} + +static int stbi__png_test(stbi__context *s) +{ + int r; + r = stbi__check_png_header(s); + stbi__rewind(s); + return r; +} + +static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp) +{ + if (!stbi__parse_png_file(p, STBI__SCAN_header, 0)) { + stbi__rewind( p->s ); + return 0; + } + if (x) *x = p->s->img_x; + if (y) *y = p->s->img_y; + if (comp) *comp = p->s->img_n; + return 1; +} + +static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp) +{ + stbi__png p; + p.s = s; + return stbi__png_info_raw(&p, x, y, comp); +} + +static int stbi__png_is16(stbi__context *s) +{ + stbi__png p; + p.s = s; + if (!stbi__png_info_raw(&p, NULL, NULL, NULL)) + return 0; + if (p.depth != 16) { + stbi__rewind(p.s); + return 0; + } + return 1; +} +#endif + +// Microsoft/Windows BMP image + +#ifndef STBI_NO_BMP +static int stbi__bmp_test_raw(stbi__context *s) +{ + int r; + int sz; + if (stbi__get8(s) != 'B') return 0; + if (stbi__get8(s) != 'M') return 0; + stbi__get32le(s); // discard filesize + stbi__get16le(s); // discard reserved + stbi__get16le(s); // discard reserved + stbi__get32le(s); // discard data offset + sz = stbi__get32le(s); + r = (sz == 12 || sz == 40 || sz == 56 || sz == 108 || sz == 124); + return r; +} + +static int stbi__bmp_test(stbi__context *s) +{ + int r = stbi__bmp_test_raw(s); + stbi__rewind(s); + return r; +} + + +// returns 0..31 for the highest set bit +static int stbi__high_bit(unsigned int z) +{ + int n=0; + if (z == 0) return -1; + if (z >= 0x10000) { n += 16; z >>= 16; } + if (z >= 0x00100) { n += 8; z >>= 8; } + if (z >= 0x00010) { n += 4; z >>= 4; } + if (z >= 0x00004) { n += 2; z >>= 2; } + if (z >= 0x00002) { n += 1; z >>= 1; } + return n; +} + +static int stbi__bitcount(unsigned int a) +{ + a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2 + a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4 + a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits + a = (a + (a >> 8)); // max 16 per 8 bits + a = (a + (a >> 16)); // max 32 per 8 bits + return a & 0xff; +} + +// extract an arbitrarily-aligned N-bit value (N=bits) +// from v, and then make it 8-bits long and fractionally +// extend it to full full range. +static int stbi__shiftsigned(unsigned int v, int shift, int bits) +{ + static unsigned int mul_table[9] = { + 0, + 0xff/*0b11111111*/, 0x55/*0b01010101*/, 0x49/*0b01001001*/, 0x11/*0b00010001*/, + 0x21/*0b00100001*/, 0x41/*0b01000001*/, 0x81/*0b10000001*/, 0x01/*0b00000001*/, + }; + static unsigned int shift_table[9] = { + 0, 0,0,1,0,2,4,6,0, + }; + if (shift < 0) + v <<= -shift; + else + v >>= shift; + STBI_ASSERT(v >= 0 && v < 256); + v >>= (8-bits); + STBI_ASSERT(bits >= 0 && bits <= 8); + return (int) ((unsigned) v * mul_table[bits]) >> shift_table[bits]; +} + +typedef struct +{ + int bpp, offset, hsz; + unsigned int mr,mg,mb,ma, all_a; +} stbi__bmp_data; + +static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) +{ + int hsz; + if (stbi__get8(s) != 'B' || stbi__get8(s) != 'M') return stbi__errpuc("not BMP", "Corrupt BMP"); + stbi__get32le(s); // discard filesize + stbi__get16le(s); // discard reserved + stbi__get16le(s); // discard reserved + info->offset = stbi__get32le(s); + info->hsz = hsz = stbi__get32le(s); + info->mr = info->mg = info->mb = info->ma = 0; + + if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) return stbi__errpuc("unknown BMP", "BMP type not supported: unknown"); + if (hsz == 12) { + s->img_x = stbi__get16le(s); + s->img_y = stbi__get16le(s); + } else { + s->img_x = stbi__get32le(s); + s->img_y = stbi__get32le(s); + } + if (stbi__get16le(s) != 1) return stbi__errpuc("bad BMP", "bad BMP"); + info->bpp = stbi__get16le(s); + if (hsz != 12) { + int compress = stbi__get32le(s); + if (compress == 1 || compress == 2) return stbi__errpuc("BMP RLE", "BMP type not supported: RLE"); + stbi__get32le(s); // discard sizeof + stbi__get32le(s); // discard hres + stbi__get32le(s); // discard vres + stbi__get32le(s); // discard colorsused + stbi__get32le(s); // discard max important + if (hsz == 40 || hsz == 56) { + if (hsz == 56) { + stbi__get32le(s); + stbi__get32le(s); + stbi__get32le(s); + stbi__get32le(s); + } + if (info->bpp == 16 || info->bpp == 32) { + if (compress == 0) { + if (info->bpp == 32) { + info->mr = 0xffu << 16; + info->mg = 0xffu << 8; + info->mb = 0xffu << 0; + info->ma = 0xffu << 24; + info->all_a = 0; // if all_a is 0 at end, then we loaded alpha channel but it was all 0 + } else { + info->mr = 31u << 10; + info->mg = 31u << 5; + info->mb = 31u << 0; + } + } else if (compress == 3) { + info->mr = stbi__get32le(s); + info->mg = stbi__get32le(s); + info->mb = stbi__get32le(s); + // not documented, but generated by photoshop and handled by mspaint + if (info->mr == info->mg && info->mg == info->mb) { + // ?!?!? + return stbi__errpuc("bad BMP", "bad BMP"); + } + } else + return stbi__errpuc("bad BMP", "bad BMP"); + } + } else { + int i; + if (hsz != 108 && hsz != 124) + return stbi__errpuc("bad BMP", "bad BMP"); + info->mr = stbi__get32le(s); + info->mg = stbi__get32le(s); + info->mb = stbi__get32le(s); + info->ma = stbi__get32le(s); + stbi__get32le(s); // discard color space + for (i=0; i < 12; ++i) + stbi__get32le(s); // discard color space parameters + if (hsz == 124) { + stbi__get32le(s); // discard rendering intent + stbi__get32le(s); // discard offset of profile data + stbi__get32le(s); // discard size of profile data + stbi__get32le(s); // discard reserved + } + } + } + return (void *) 1; +} + + +static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + stbi_uc *out; + unsigned int mr=0,mg=0,mb=0,ma=0, all_a; + stbi_uc pal[256][4]; + int psize=0,i,j,width; + int flip_vertically, pad, target; + stbi__bmp_data info; + STBI_NOTUSED(ri); + + info.all_a = 255; + if (stbi__bmp_parse_header(s, &info) == NULL) + return NULL; // error code already set + + flip_vertically = ((int) s->img_y) > 0; + s->img_y = abs((int) s->img_y); + + mr = info.mr; + mg = info.mg; + mb = info.mb; + ma = info.ma; + all_a = info.all_a; + + if (info.hsz == 12) { + if (info.bpp < 24) + psize = (info.offset - 14 - 24) / 3; + } else { + if (info.bpp < 16) + psize = (info.offset - 14 - info.hsz) >> 2; + } + + s->img_n = ma ? 4 : 3; + if (req_comp && req_comp >= 3) // we can directly decode 3 or 4 + target = req_comp; + else + target = s->img_n; // if they want monochrome, we'll post-convert + + // sanity-check size + if (!stbi__mad3sizes_valid(target, s->img_x, s->img_y, 0)) + return stbi__errpuc("too large", "Corrupt BMP"); + + out = (stbi_uc *) stbi__malloc_mad3(target, s->img_x, s->img_y, 0); + if (!out) return stbi__errpuc("outofmem", "Out of memory"); + if (info.bpp < 16) { + int z=0; + if (psize == 0 || psize > 256) { STBI_FREE(out); return stbi__errpuc("invalid", "Corrupt BMP"); } + for (i=0; i < psize; ++i) { + pal[i][2] = stbi__get8(s); + pal[i][1] = stbi__get8(s); + pal[i][0] = stbi__get8(s); + if (info.hsz != 12) stbi__get8(s); + pal[i][3] = 255; + } + stbi__skip(s, info.offset - 14 - info.hsz - psize * (info.hsz == 12 ? 3 : 4)); + if (info.bpp == 1) width = (s->img_x + 7) >> 3; + else if (info.bpp == 4) width = (s->img_x + 1) >> 1; + else if (info.bpp == 8) width = s->img_x; + else { STBI_FREE(out); return stbi__errpuc("bad bpp", "Corrupt BMP"); } + pad = (-width)&3; + if (info.bpp == 1) { + for (j=0; j < (int) s->img_y; ++j) { + int bit_offset = 7, v = stbi__get8(s); + for (i=0; i < (int) s->img_x; ++i) { + int color = (v>>bit_offset)&0x1; + out[z++] = pal[color][0]; + out[z++] = pal[color][1]; + out[z++] = pal[color][2]; + if (target == 4) out[z++] = 255; + if (i+1 == (int) s->img_x) break; + if((--bit_offset) < 0) { + bit_offset = 7; + v = stbi__get8(s); + } + } + stbi__skip(s, pad); + } + } else { + for (j=0; j < (int) s->img_y; ++j) { + for (i=0; i < (int) s->img_x; i += 2) { + int v=stbi__get8(s),v2=0; + if (info.bpp == 4) { + v2 = v & 15; + v >>= 4; + } + out[z++] = pal[v][0]; + out[z++] = pal[v][1]; + out[z++] = pal[v][2]; + if (target == 4) out[z++] = 255; + if (i+1 == (int) s->img_x) break; + v = (info.bpp == 8) ? stbi__get8(s) : v2; + out[z++] = pal[v][0]; + out[z++] = pal[v][1]; + out[z++] = pal[v][2]; + if (target == 4) out[z++] = 255; + } + stbi__skip(s, pad); + } + } + } else { + int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0; + int z = 0; + int easy=0; + stbi__skip(s, info.offset - 14 - info.hsz); + if (info.bpp == 24) width = 3 * s->img_x; + else if (info.bpp == 16) width = 2*s->img_x; + else /* bpp = 32 and pad = 0 */ width=0; + pad = (-width) & 3; + if (info.bpp == 24) { + easy = 1; + } else if (info.bpp == 32) { + if (mb == 0xff && mg == 0xff00 && mr == 0x00ff0000 && ma == 0xff000000) + easy = 2; + } + if (!easy) { + if (!mr || !mg || !mb) { STBI_FREE(out); return stbi__errpuc("bad masks", "Corrupt BMP"); } + // right shift amt to put high bit in position #7 + rshift = stbi__high_bit(mr)-7; rcount = stbi__bitcount(mr); + gshift = stbi__high_bit(mg)-7; gcount = stbi__bitcount(mg); + bshift = stbi__high_bit(mb)-7; bcount = stbi__bitcount(mb); + ashift = stbi__high_bit(ma)-7; acount = stbi__bitcount(ma); + } + for (j=0; j < (int) s->img_y; ++j) { + if (easy) { + for (i=0; i < (int) s->img_x; ++i) { + unsigned char a; + out[z+2] = stbi__get8(s); + out[z+1] = stbi__get8(s); + out[z+0] = stbi__get8(s); + z += 3; + a = (easy == 2 ? stbi__get8(s) : 255); + all_a |= a; + if (target == 4) out[z++] = a; + } + } else { + int bpp = info.bpp; + for (i=0; i < (int) s->img_x; ++i) { + stbi__uint32 v = (bpp == 16 ? (stbi__uint32) stbi__get16le(s) : stbi__get32le(s)); + unsigned int a; + out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mr, rshift, rcount)); + out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mg, gshift, gcount)); + out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mb, bshift, bcount)); + a = (ma ? stbi__shiftsigned(v & ma, ashift, acount) : 255); + all_a |= a; + if (target == 4) out[z++] = STBI__BYTECAST(a); + } + } + stbi__skip(s, pad); + } + } + + // if alpha channel is all 0s, replace with all 255s + if (target == 4 && all_a == 0) + for (i=4*s->img_x*s->img_y-1; i >= 0; i -= 4) + out[i] = 255; + + if (flip_vertically) { + stbi_uc t; + for (j=0; j < (int) s->img_y>>1; ++j) { + stbi_uc *p1 = out + j *s->img_x*target; + stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target; + for (i=0; i < (int) s->img_x*target; ++i) { + t = p1[i]; p1[i] = p2[i]; p2[i] = t; + } + } + } + + if (req_comp && req_comp != target) { + out = stbi__convert_format(out, target, req_comp, s->img_x, s->img_y); + if (out == NULL) return out; // stbi__convert_format frees input on failure + } + + *x = s->img_x; + *y = s->img_y; + if (comp) *comp = s->img_n; + return out; +} +#endif + +// Targa Truevision - TGA +// by Jonathan Dummer +#ifndef STBI_NO_TGA +// returns STBI_rgb or whatever, 0 on error +static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16) +{ + // only RGB or RGBA (incl. 16bit) or grey allowed + if (is_rgb16) *is_rgb16 = 0; + switch(bits_per_pixel) { + case 8: return STBI_grey; + case 16: if(is_grey) return STBI_grey_alpha; + // fallthrough + case 15: if(is_rgb16) *is_rgb16 = 1; + return STBI_rgb; + case 24: // fallthrough + case 32: return bits_per_pixel/8; + default: return 0; + } +} + +static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp) +{ + int tga_w, tga_h, tga_comp, tga_image_type, tga_bits_per_pixel, tga_colormap_bpp; + int sz, tga_colormap_type; + stbi__get8(s); // discard Offset + tga_colormap_type = stbi__get8(s); // colormap type + if( tga_colormap_type > 1 ) { + stbi__rewind(s); + return 0; // only RGB or indexed allowed + } + tga_image_type = stbi__get8(s); // image type + if ( tga_colormap_type == 1 ) { // colormapped (paletted) image + if (tga_image_type != 1 && tga_image_type != 9) { + stbi__rewind(s); + return 0; + } + stbi__skip(s,4); // skip index of first colormap entry and number of entries + sz = stbi__get8(s); // check bits per palette color entry + if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) { + stbi__rewind(s); + return 0; + } + stbi__skip(s,4); // skip image x and y origin + tga_colormap_bpp = sz; + } else { // "normal" image w/o colormap - only RGB or grey allowed, +/- RLE + if ( (tga_image_type != 2) && (tga_image_type != 3) && (tga_image_type != 10) && (tga_image_type != 11) ) { + stbi__rewind(s); + return 0; // only RGB or grey allowed, +/- RLE + } + stbi__skip(s,9); // skip colormap specification and image x/y origin + tga_colormap_bpp = 0; + } + tga_w = stbi__get16le(s); + if( tga_w < 1 ) { + stbi__rewind(s); + return 0; // test width + } + tga_h = stbi__get16le(s); + if( tga_h < 1 ) { + stbi__rewind(s); + return 0; // test height + } + tga_bits_per_pixel = stbi__get8(s); // bits per pixel + stbi__get8(s); // ignore alpha bits + if (tga_colormap_bpp != 0) { + if((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16)) { + // when using a colormap, tga_bits_per_pixel is the size of the indexes + // I don't think anything but 8 or 16bit indexes makes sense + stbi__rewind(s); + return 0; + } + tga_comp = stbi__tga_get_comp(tga_colormap_bpp, 0, NULL); + } else { + tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3) || (tga_image_type == 11), NULL); + } + if(!tga_comp) { + stbi__rewind(s); + return 0; + } + if (x) *x = tga_w; + if (y) *y = tga_h; + if (comp) *comp = tga_comp; + return 1; // seems to have passed everything +} + +static int stbi__tga_test(stbi__context *s) +{ + int res = 0; + int sz, tga_color_type; + stbi__get8(s); // discard Offset + tga_color_type = stbi__get8(s); // color type + if ( tga_color_type > 1 ) goto errorEnd; // only RGB or indexed allowed + sz = stbi__get8(s); // image type + if ( tga_color_type == 1 ) { // colormapped (paletted) image + if (sz != 1 && sz != 9) goto errorEnd; // colortype 1 demands image type 1 or 9 + stbi__skip(s,4); // skip index of first colormap entry and number of entries + sz = stbi__get8(s); // check bits per palette color entry + if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd; + stbi__skip(s,4); // skip image x and y origin + } else { // "normal" image w/o colormap + if ( (sz != 2) && (sz != 3) && (sz != 10) && (sz != 11) ) goto errorEnd; // only RGB or grey allowed, +/- RLE + stbi__skip(s,9); // skip colormap specification and image x/y origin + } + if ( stbi__get16le(s) < 1 ) goto errorEnd; // test width + if ( stbi__get16le(s) < 1 ) goto errorEnd; // test height + sz = stbi__get8(s); // bits per pixel + if ( (tga_color_type == 1) && (sz != 8) && (sz != 16) ) goto errorEnd; // for colormapped images, bpp is size of an index + if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd; + + res = 1; // if we got this far, everything's good and we can return 1 instead of 0 + +errorEnd: + stbi__rewind(s); + return res; +} + +// read 16bit value and convert to 24bit RGB +static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out) +{ + stbi__uint16 px = (stbi__uint16)stbi__get16le(s); + stbi__uint16 fiveBitMask = 31; + // we have 3 channels with 5bits each + int r = (px >> 10) & fiveBitMask; + int g = (px >> 5) & fiveBitMask; + int b = px & fiveBitMask; + // Note that this saves the data in RGB(A) order, so it doesn't need to be swapped later + out[0] = (stbi_uc)((r * 255)/31); + out[1] = (stbi_uc)((g * 255)/31); + out[2] = (stbi_uc)((b * 255)/31); + + // some people claim that the most significant bit might be used for alpha + // (possibly if an alpha-bit is set in the "image descriptor byte") + // but that only made 16bit test images completely translucent.. + // so let's treat all 15 and 16bit TGAs as RGB with no alpha. +} + +static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + // read in the TGA header stuff + int tga_offset = stbi__get8(s); + int tga_indexed = stbi__get8(s); + int tga_image_type = stbi__get8(s); + int tga_is_RLE = 0; + int tga_palette_start = stbi__get16le(s); + int tga_palette_len = stbi__get16le(s); + int tga_palette_bits = stbi__get8(s); + int tga_x_origin = stbi__get16le(s); + int tga_y_origin = stbi__get16le(s); + int tga_width = stbi__get16le(s); + int tga_height = stbi__get16le(s); + int tga_bits_per_pixel = stbi__get8(s); + int tga_comp, tga_rgb16=0; + int tga_inverted = stbi__get8(s); + // int tga_alpha_bits = tga_inverted & 15; // the 4 lowest bits - unused (useless?) + // image data + unsigned char *tga_data; + unsigned char *tga_palette = NULL; + int i, j; + unsigned char raw_data[4] = {0}; + int RLE_count = 0; + int RLE_repeating = 0; + int read_next_pixel = 1; + STBI_NOTUSED(ri); + + // do a tiny bit of precessing + if ( tga_image_type >= 8 ) + { + tga_image_type -= 8; + tga_is_RLE = 1; + } + tga_inverted = 1 - ((tga_inverted >> 5) & 1); + + // If I'm paletted, then I'll use the number of bits from the palette + if ( tga_indexed ) tga_comp = stbi__tga_get_comp(tga_palette_bits, 0, &tga_rgb16); + else tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3), &tga_rgb16); + + if(!tga_comp) // shouldn't really happen, stbi__tga_test() should have ensured basic consistency + return stbi__errpuc("bad format", "Can't find out TGA pixelformat"); + + // tga info + *x = tga_width; + *y = tga_height; + if (comp) *comp = tga_comp; + + if (!stbi__mad3sizes_valid(tga_width, tga_height, tga_comp, 0)) + return stbi__errpuc("too large", "Corrupt TGA"); + + tga_data = (unsigned char*)stbi__malloc_mad3(tga_width, tga_height, tga_comp, 0); + if (!tga_data) return stbi__errpuc("outofmem", "Out of memory"); + + // skip to the data's starting position (offset usually = 0) + stbi__skip(s, tga_offset ); + + if ( !tga_indexed && !tga_is_RLE && !tga_rgb16 ) { + for (i=0; i < tga_height; ++i) { + int row = tga_inverted ? tga_height -i - 1 : i; + stbi_uc *tga_row = tga_data + row*tga_width*tga_comp; + stbi__getn(s, tga_row, tga_width * tga_comp); + } + } else { + // do I need to load a palette? + if ( tga_indexed) + { + // any data to skip? (offset usually = 0) + stbi__skip(s, tga_palette_start ); + // load the palette + tga_palette = (unsigned char*)stbi__malloc_mad2(tga_palette_len, tga_comp, 0); + if (!tga_palette) { + STBI_FREE(tga_data); + return stbi__errpuc("outofmem", "Out of memory"); + } + if (tga_rgb16) { + stbi_uc *pal_entry = tga_palette; + STBI_ASSERT(tga_comp == STBI_rgb); + for (i=0; i < tga_palette_len; ++i) { + stbi__tga_read_rgb16(s, pal_entry); + pal_entry += tga_comp; + } + } else if (!stbi__getn(s, tga_palette, tga_palette_len * tga_comp)) { + STBI_FREE(tga_data); + STBI_FREE(tga_palette); + return stbi__errpuc("bad palette", "Corrupt TGA"); + } + } + // load the data + for (i=0; i < tga_width * tga_height; ++i) + { + // if I'm in RLE mode, do I need to get a RLE stbi__pngchunk? + if ( tga_is_RLE ) + { + if ( RLE_count == 0 ) + { + // yep, get the next byte as a RLE command + int RLE_cmd = stbi__get8(s); + RLE_count = 1 + (RLE_cmd & 127); + RLE_repeating = RLE_cmd >> 7; + read_next_pixel = 1; + } else if ( !RLE_repeating ) + { + read_next_pixel = 1; + } + } else + { + read_next_pixel = 1; + } + // OK, if I need to read a pixel, do it now + if ( read_next_pixel ) + { + // load however much data we did have + if ( tga_indexed ) + { + // read in index, then perform the lookup + int pal_idx = (tga_bits_per_pixel == 8) ? stbi__get8(s) : stbi__get16le(s); + if ( pal_idx >= tga_palette_len ) { + // invalid index + pal_idx = 0; + } + pal_idx *= tga_comp; + for (j = 0; j < tga_comp; ++j) { + raw_data[j] = tga_palette[pal_idx+j]; + } + } else if(tga_rgb16) { + STBI_ASSERT(tga_comp == STBI_rgb); + stbi__tga_read_rgb16(s, raw_data); + } else { + // read in the data raw + for (j = 0; j < tga_comp; ++j) { + raw_data[j] = stbi__get8(s); + } + } + // clear the reading flag for the next pixel + read_next_pixel = 0; + } // end of reading a pixel + + // copy data + for (j = 0; j < tga_comp; ++j) + tga_data[i*tga_comp+j] = raw_data[j]; + + // in case we're in RLE mode, keep counting down + --RLE_count; + } + // do I need to invert the image? + if ( tga_inverted ) + { + for (j = 0; j*2 < tga_height; ++j) + { + int index1 = j * tga_width * tga_comp; + int index2 = (tga_height - 1 - j) * tga_width * tga_comp; + for (i = tga_width * tga_comp; i > 0; --i) + { + unsigned char temp = tga_data[index1]; + tga_data[index1] = tga_data[index2]; + tga_data[index2] = temp; + ++index1; + ++index2; + } + } + } + // clear my palette, if I had one + if ( tga_palette != NULL ) + { + STBI_FREE( tga_palette ); + } + } + + // swap RGB - if the source data was RGB16, it already is in the right order + if (tga_comp >= 3 && !tga_rgb16) + { + unsigned char* tga_pixel = tga_data; + for (i=0; i < tga_width * tga_height; ++i) + { + unsigned char temp = tga_pixel[0]; + tga_pixel[0] = tga_pixel[2]; + tga_pixel[2] = temp; + tga_pixel += tga_comp; + } + } + + // convert to target component count + if (req_comp && req_comp != tga_comp) + tga_data = stbi__convert_format(tga_data, tga_comp, req_comp, tga_width, tga_height); + + // the things I do to get rid of an error message, and yet keep + // Microsoft's C compilers happy... [8^( + tga_palette_start = tga_palette_len = tga_palette_bits = + tga_x_origin = tga_y_origin = 0; + // OK, done + return tga_data; +} +#endif + +// ************************************************************************************************* +// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicolas Schulz, tweaked by STB + +#ifndef STBI_NO_PSD +static int stbi__psd_test(stbi__context *s) +{ + int r = (stbi__get32be(s) == 0x38425053); + stbi__rewind(s); + return r; +} + +static int stbi__psd_decode_rle(stbi__context *s, stbi_uc *p, int pixelCount) +{ + int count, nleft, len; + + count = 0; + while ((nleft = pixelCount - count) > 0) { + len = stbi__get8(s); + if (len == 128) { + // No-op. + } else if (len < 128) { + // Copy next len+1 bytes literally. + len++; + if (len > nleft) return 0; // corrupt data + count += len; + while (len) { + *p = stbi__get8(s); + p += 4; + len--; + } + } else if (len > 128) { + stbi_uc val; + // Next -len+1 bytes in the dest are replicated from next source byte. + // (Interpret len as a negative 8-bit int.) + len = 257 - len; + if (len > nleft) return 0; // corrupt data + val = stbi__get8(s); + count += len; + while (len) { + *p = val; + p += 4; + len--; + } + } + } + + return 1; +} + +static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) +{ + int pixelCount; + int channelCount, compression; + int channel, i; + int bitdepth; + int w,h; + stbi_uc *out; + STBI_NOTUSED(ri); + + // Check identifier + if (stbi__get32be(s) != 0x38425053) // "8BPS" + return stbi__errpuc("not PSD", "Corrupt PSD image"); + + // Check file type version. + if (stbi__get16be(s) != 1) + return stbi__errpuc("wrong version", "Unsupported version of PSD image"); + + // Skip 6 reserved bytes. + stbi__skip(s, 6 ); + + // Read the number of channels (R, G, B, A, etc). + channelCount = stbi__get16be(s); + if (channelCount < 0 || channelCount > 16) + return stbi__errpuc("wrong channel count", "Unsupported number of channels in PSD image"); + + // Read the rows and columns of the image. + h = stbi__get32be(s); + w = stbi__get32be(s); + + // Make sure the depth is 8 bits. + bitdepth = stbi__get16be(s); + if (bitdepth != 8 && bitdepth != 16) + return stbi__errpuc("unsupported bit depth", "PSD bit depth is not 8 or 16 bit"); + + // Make sure the color mode is RGB. + // Valid options are: + // 0: Bitmap + // 1: Grayscale + // 2: Indexed color + // 3: RGB color + // 4: CMYK color + // 7: Multichannel + // 8: Duotone + // 9: Lab color + if (stbi__get16be(s) != 3) + return stbi__errpuc("wrong color format", "PSD is not in RGB color format"); + + // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.) + stbi__skip(s,stbi__get32be(s) ); + + // Skip the image resources. (resolution, pen tool paths, etc) + stbi__skip(s, stbi__get32be(s) ); + + // Skip the reserved data. + stbi__skip(s, stbi__get32be(s) ); + + // Find out if the data is compressed. + // Known values: + // 0: no compression + // 1: RLE compressed + compression = stbi__get16be(s); + if (compression > 1) + return stbi__errpuc("bad compression", "PSD has an unknown compression format"); + + // Check size + if (!stbi__mad3sizes_valid(4, w, h, 0)) + return stbi__errpuc("too large", "Corrupt PSD"); + + // Create the destination image. + + if (!compression && bitdepth == 16 && bpc == 16) { + out = (stbi_uc *) stbi__malloc_mad3(8, w, h, 0); + ri->bits_per_channel = 16; + } else + out = (stbi_uc *) stbi__malloc(4 * w*h); + + if (!out) return stbi__errpuc("outofmem", "Out of memory"); + pixelCount = w*h; + + // Initialize the data to zero. + //memset( out, 0, pixelCount * 4 ); + + // Finally, the image data. + if (compression) { + // RLE as used by .PSD and .TIFF + // Loop until you get the number of unpacked bytes you are expecting: + // Read the next source byte into n. + // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. + // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times. + // Else if n is 128, noop. + // Endloop + + // The RLE-compressed data is preceded by a 2-byte data count for each row in the data, + // which we're going to just skip. + stbi__skip(s, h * channelCount * 2 ); + + // Read the RLE data by channel. + for (channel = 0; channel < 4; channel++) { + stbi_uc *p; + + p = out+channel; + if (channel >= channelCount) { + // Fill this channel with default data. + for (i = 0; i < pixelCount; i++, p += 4) + *p = (channel == 3 ? 255 : 0); + } else { + // Read the RLE data. + if (!stbi__psd_decode_rle(s, p, pixelCount)) { + STBI_FREE(out); + return stbi__errpuc("corrupt", "bad RLE data"); + } + } + } + + } else { + // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...) + // where each channel consists of an 8-bit (or 16-bit) value for each pixel in the image. + + // Read the data by channel. + for (channel = 0; channel < 4; channel++) { + if (channel >= channelCount) { + // Fill this channel with default data. + if (bitdepth == 16 && bpc == 16) { + stbi__uint16 *q = ((stbi__uint16 *) out) + channel; + stbi__uint16 val = channel == 3 ? 65535 : 0; + for (i = 0; i < pixelCount; i++, q += 4) + *q = val; + } else { + stbi_uc *p = out+channel; + stbi_uc val = channel == 3 ? 255 : 0; + for (i = 0; i < pixelCount; i++, p += 4) + *p = val; + } + } else { + if (ri->bits_per_channel == 16) { // output bpc + stbi__uint16 *q = ((stbi__uint16 *) out) + channel; + for (i = 0; i < pixelCount; i++, q += 4) + *q = (stbi__uint16) stbi__get16be(s); + } else { + stbi_uc *p = out+channel; + if (bitdepth == 16) { // input bpc + for (i = 0; i < pixelCount; i++, p += 4) + *p = (stbi_uc) (stbi__get16be(s) >> 8); + } else { + for (i = 0; i < pixelCount; i++, p += 4) + *p = stbi__get8(s); + } + } + } + } + } + + // remove weird white matte from PSD + if (channelCount >= 4) { + if (ri->bits_per_channel == 16) { + for (i=0; i < w*h; ++i) { + stbi__uint16 *pixel = (stbi__uint16 *) out + 4*i; + if (pixel[3] != 0 && pixel[3] != 65535) { + float a = pixel[3] / 65535.0f; + float ra = 1.0f / a; + float inv_a = 65535.0f * (1 - ra); + pixel[0] = (stbi__uint16) (pixel[0]*ra + inv_a); + pixel[1] = (stbi__uint16) (pixel[1]*ra + inv_a); + pixel[2] = (stbi__uint16) (pixel[2]*ra + inv_a); + } + } + } else { + for (i=0; i < w*h; ++i) { + unsigned char *pixel = out + 4*i; + if (pixel[3] != 0 && pixel[3] != 255) { + float a = pixel[3] / 255.0f; + float ra = 1.0f / a; + float inv_a = 255.0f * (1 - ra); + pixel[0] = (unsigned char) (pixel[0]*ra + inv_a); + pixel[1] = (unsigned char) (pixel[1]*ra + inv_a); + pixel[2] = (unsigned char) (pixel[2]*ra + inv_a); + } + } + } + } + + // convert to desired output format + if (req_comp && req_comp != 4) { + if (ri->bits_per_channel == 16) + out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, 4, req_comp, w, h); + else + out = stbi__convert_format(out, 4, req_comp, w, h); + if (out == NULL) return out; // stbi__convert_format frees input on failure + } + + if (comp) *comp = 4; + *y = h; + *x = w; + + return out; +} +#endif + +// ************************************************************************************************* +// Softimage PIC loader +// by Tom Seddon +// +// See http://softimage.wiki.softimage.com/index.php/INFO:_PIC_file_format +// See http://ozviz.wasp.uwa.edu.au/~pbourke/dataformats/softimagepic/ + +#ifndef STBI_NO_PIC +static int stbi__pic_is4(stbi__context *s,const char *str) +{ + int i; + for (i=0; i<4; ++i) + if (stbi__get8(s) != (stbi_uc)str[i]) + return 0; + + return 1; +} + +static int stbi__pic_test_core(stbi__context *s) +{ + int i; + + if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) + return 0; + + for(i=0;i<84;++i) + stbi__get8(s); + + if (!stbi__pic_is4(s,"PICT")) + return 0; + + return 1; +} + +typedef struct +{ + stbi_uc size,type,channel; +} stbi__pic_packet; + +static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest) +{ + int mask=0x80, i; + + for (i=0; i<4; ++i, mask>>=1) { + if (channel & mask) { + if (stbi__at_eof(s)) return stbi__errpuc("bad file","PIC file too short"); + dest[i]=stbi__get8(s); + } + } + + return dest; +} + +static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src) +{ + int mask=0x80,i; + + for (i=0;i<4; ++i, mask>>=1) + if (channel&mask) + dest[i]=src[i]; +} + +static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int height,int *comp, stbi_uc *result) +{ + int act_comp=0,num_packets=0,y,chained; + stbi__pic_packet packets[10]; + + // this will (should...) cater for even some bizarre stuff like having data + // for the same channel in multiple packets. + do { + stbi__pic_packet *packet; + + if (num_packets==sizeof(packets)/sizeof(packets[0])) + return stbi__errpuc("bad format","too many packets"); + + packet = &packets[num_packets++]; + + chained = stbi__get8(s); + packet->size = stbi__get8(s); + packet->type = stbi__get8(s); + packet->channel = stbi__get8(s); + + act_comp |= packet->channel; + + if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (reading packets)"); + if (packet->size != 8) return stbi__errpuc("bad format","packet isn't 8bpp"); + } while (chained); + + *comp = (act_comp & 0x10 ? 4 : 3); // has alpha channel? + + for(y=0; y<height; ++y) { + int packet_idx; + + for(packet_idx=0; packet_idx < num_packets; ++packet_idx) { + stbi__pic_packet *packet = &packets[packet_idx]; + stbi_uc *dest = result+y*width*4; + + switch (packet->type) { + default: + return stbi__errpuc("bad format","packet has bad compression type"); + + case 0: {//uncompressed + int x; + + for(x=0;x<width;++x, dest+=4) + if (!stbi__readval(s,packet->channel,dest)) + return 0; + break; + } + + case 1://Pure RLE + { + int left=width, i; + + while (left>0) { + stbi_uc count,value[4]; + + count=stbi__get8(s); + if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pure read count)"); + + if (count > left) + count = (stbi_uc) left; + + if (!stbi__readval(s,packet->channel,value)) return 0; + + for(i=0; i<count; ++i,dest+=4) + stbi__copyval(packet->channel,dest,value); + left -= count; + } + } + break; + + case 2: {//Mixed RLE + int left=width; + while (left>0) { + int count = stbi__get8(s), i; + if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (mixed read count)"); + + if (count >= 128) { // Repeated + stbi_uc value[4]; + + if (count==128) + count = stbi__get16be(s); + else + count -= 127; + if (count > left) + return stbi__errpuc("bad file","scanline overrun"); + + if (!stbi__readval(s,packet->channel,value)) + return 0; + + for(i=0;i<count;++i, dest += 4) + stbi__copyval(packet->channel,dest,value); + } else { // Raw + ++count; + if (count>left) return stbi__errpuc("bad file","scanline overrun"); + + for(i=0;i<count;++i, dest+=4) + if (!stbi__readval(s,packet->channel,dest)) + return 0; + } + left-=count; + } + break; + } + } + } + } + + return result; +} + +static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp, stbi__result_info *ri) +{ + stbi_uc *result; + int i, x,y, internal_comp; + STBI_NOTUSED(ri); + + if (!comp) comp = &internal_comp; + + for (i=0; i<92; ++i) + stbi__get8(s); + + x = stbi__get16be(s); + y = stbi__get16be(s); + if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pic header)"); + if (!stbi__mad3sizes_valid(x, y, 4, 0)) return stbi__errpuc("too large", "PIC image too large to decode"); + + stbi__get32be(s); //skip `ratio' + stbi__get16be(s); //skip `fields' + stbi__get16be(s); //skip `pad' + + // intermediate buffer is RGBA + result = (stbi_uc *) stbi__malloc_mad3(x, y, 4, 0); + memset(result, 0xff, x*y*4); + + if (!stbi__pic_load_core(s,x,y,comp, result)) { + STBI_FREE(result); + result=0; + } + *px = x; + *py = y; + if (req_comp == 0) req_comp = *comp; + result=stbi__convert_format(result,4,req_comp,x,y); + + return result; +} + +static int stbi__pic_test(stbi__context *s) +{ + int r = stbi__pic_test_core(s); + stbi__rewind(s); + return r; +} +#endif + +// ************************************************************************************************* +// GIF loader -- public domain by Jean-Marc Lienher -- simplified/shrunk by stb + +#ifndef STBI_NO_GIF +typedef struct +{ + stbi__int16 prefix; + stbi_uc first; + stbi_uc suffix; +} stbi__gif_lzw; + +typedef struct +{ + int w,h; + stbi_uc *out; // output buffer (always 4 components) + stbi_uc *background; // The current "background" as far as a gif is concerned + stbi_uc *history; + int flags, bgindex, ratio, transparent, eflags; + stbi_uc pal[256][4]; + stbi_uc lpal[256][4]; + stbi__gif_lzw codes[8192]; + stbi_uc *color_table; + int parse, step; + int lflags; + int start_x, start_y; + int max_x, max_y; + int cur_x, cur_y; + int line_size; + int delay; +} stbi__gif; + +static int stbi__gif_test_raw(stbi__context *s) +{ + int sz; + if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') return 0; + sz = stbi__get8(s); + if (sz != '9' && sz != '7') return 0; + if (stbi__get8(s) != 'a') return 0; + return 1; +} + +static int stbi__gif_test(stbi__context *s) +{ + int r = stbi__gif_test_raw(s); + stbi__rewind(s); + return r; +} + +static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256][4], int num_entries, int transp) +{ + int i; + for (i=0; i < num_entries; ++i) { + pal[i][2] = stbi__get8(s); + pal[i][1] = stbi__get8(s); + pal[i][0] = stbi__get8(s); + pal[i][3] = transp == i ? 0 : 255; + } +} + +static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info) +{ + stbi_uc version; + if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') + return stbi__err("not GIF", "Corrupt GIF"); + + version = stbi__get8(s); + if (version != '7' && version != '9') return stbi__err("not GIF", "Corrupt GIF"); + if (stbi__get8(s) != 'a') return stbi__err("not GIF", "Corrupt GIF"); + + stbi__g_failure_reason = ""; + g->w = stbi__get16le(s); + g->h = stbi__get16le(s); + g->flags = stbi__get8(s); + g->bgindex = stbi__get8(s); + g->ratio = stbi__get8(s); + g->transparent = -1; + + if (comp != 0) *comp = 4; // can't actually tell whether it's 3 or 4 until we parse the comments + + if (is_info) return 1; + + if (g->flags & 0x80) + stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1); + + return 1; +} + +static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp) +{ + stbi__gif* g = (stbi__gif*) stbi__malloc(sizeof(stbi__gif)); + if (!stbi__gif_header(s, g, comp, 1)) { + STBI_FREE(g); + stbi__rewind( s ); + return 0; + } + if (x) *x = g->w; + if (y) *y = g->h; + STBI_FREE(g); + return 1; +} + +static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code) +{ + stbi_uc *p, *c; + int idx; + + // recurse to decode the prefixes, since the linked-list is backwards, + // and working backwards through an interleaved image would be nasty + if (g->codes[code].prefix >= 0) + stbi__out_gif_code(g, g->codes[code].prefix); + + if (g->cur_y >= g->max_y) return; + + idx = g->cur_x + g->cur_y; + p = &g->out[idx]; + g->history[idx / 4] = 1; + + c = &g->color_table[g->codes[code].suffix * 4]; + if (c[3] > 128) { // don't render transparent pixels; + p[0] = c[2]; + p[1] = c[1]; + p[2] = c[0]; + p[3] = c[3]; + } + g->cur_x += 4; + + if (g->cur_x >= g->max_x) { + g->cur_x = g->start_x; + g->cur_y += g->step; + + while (g->cur_y >= g->max_y && g->parse > 0) { + g->step = (1 << g->parse) * g->line_size; + g->cur_y = g->start_y + (g->step >> 1); + --g->parse; + } + } +} + +static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) +{ + stbi_uc lzw_cs; + stbi__int32 len, init_code; + stbi__uint32 first; + stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear; + stbi__gif_lzw *p; + + lzw_cs = stbi__get8(s); + if (lzw_cs > 12) return NULL; + clear = 1 << lzw_cs; + first = 1; + codesize = lzw_cs + 1; + codemask = (1 << codesize) - 1; + bits = 0; + valid_bits = 0; + for (init_code = 0; init_code < clear; init_code++) { + g->codes[init_code].prefix = -1; + g->codes[init_code].first = (stbi_uc) init_code; + g->codes[init_code].suffix = (stbi_uc) init_code; + } + + // support no starting clear code + avail = clear+2; + oldcode = -1; + + len = 0; + for(;;) { + if (valid_bits < codesize) { + if (len == 0) { + len = stbi__get8(s); // start new block + if (len == 0) + return g->out; + } + --len; + bits |= (stbi__int32) stbi__get8(s) << valid_bits; + valid_bits += 8; + } else { + stbi__int32 code = bits & codemask; + bits >>= codesize; + valid_bits -= codesize; + // @OPTIMIZE: is there some way we can accelerate the non-clear path? + if (code == clear) { // clear code + codesize = lzw_cs + 1; + codemask = (1 << codesize) - 1; + avail = clear + 2; + oldcode = -1; + first = 0; + } else if (code == clear + 1) { // end of stream code + stbi__skip(s, len); + while ((len = stbi__get8(s)) > 0) + stbi__skip(s,len); + return g->out; + } else if (code <= avail) { + if (first) { + return stbi__errpuc("no clear code", "Corrupt GIF"); + } + + if (oldcode >= 0) { + p = &g->codes[avail++]; + if (avail > 8192) { + return stbi__errpuc("too many codes", "Corrupt GIF"); + } + + p->prefix = (stbi__int16) oldcode; + p->first = g->codes[oldcode].first; + p->suffix = (code == avail) ? p->first : g->codes[code].first; + } else if (code == avail) + return stbi__errpuc("illegal code in raster", "Corrupt GIF"); + + stbi__out_gif_code(g, (stbi__uint16) code); + + if ((avail & codemask) == 0 && avail <= 0x0FFF) { + codesize++; + codemask = (1 << codesize) - 1; + } + + oldcode = code; + } else { + return stbi__errpuc("illegal code in raster", "Corrupt GIF"); + } + } + } +} + +// this function is designed to support animated gifs, although stb_image doesn't support it +// two back is the image from two frames ago, used for a very specific disposal format +static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp, stbi_uc *two_back) +{ + int dispose; + int first_frame; + int pi; + int pcount; + STBI_NOTUSED(req_comp); + + // on first frame, any non-written pixels get the background colour (non-transparent) + first_frame = 0; + if (g->out == 0) { + if (!stbi__gif_header(s, g, comp,0)) return 0; // stbi__g_failure_reason set by stbi__gif_header + if (!stbi__mad3sizes_valid(4, g->w, g->h, 0)) + return stbi__errpuc("too large", "GIF image is too large"); + pcount = g->w * g->h; + g->out = (stbi_uc *) stbi__malloc(4 * pcount); + g->background = (stbi_uc *) stbi__malloc(4 * pcount); + g->history = (stbi_uc *) stbi__malloc(pcount); + if (!g->out || !g->background || !g->history) + return stbi__errpuc("outofmem", "Out of memory"); + + // image is treated as "transparent" at the start - ie, nothing overwrites the current background; + // background colour is only used for pixels that are not rendered first frame, after that "background" + // color refers to the color that was there the previous frame. + memset(g->out, 0x00, 4 * pcount); + memset(g->background, 0x00, 4 * pcount); // state of the background (starts transparent) + memset(g->history, 0x00, pcount); // pixels that were affected previous frame + first_frame = 1; + } else { + // second frame - how do we dispoase of the previous one? + dispose = (g->eflags & 0x1C) >> 2; + pcount = g->w * g->h; + + if ((dispose == 3) && (two_back == 0)) { + dispose = 2; // if I don't have an image to revert back to, default to the old background + } + + if (dispose == 3) { // use previous graphic + for (pi = 0; pi < pcount; ++pi) { + if (g->history[pi]) { + memcpy( &g->out[pi * 4], &two_back[pi * 4], 4 ); + } + } + } else if (dispose == 2) { + // restore what was changed last frame to background before that frame; + for (pi = 0; pi < pcount; ++pi) { + if (g->history[pi]) { + memcpy( &g->out[pi * 4], &g->background[pi * 4], 4 ); + } + } + } else { + // This is a non-disposal case eithe way, so just + // leave the pixels as is, and they will become the new background + // 1: do not dispose + // 0: not specified. + } + + // background is what out is after the undoing of the previou frame; + memcpy( g->background, g->out, 4 * g->w * g->h ); + } + + // clear my history; + memset( g->history, 0x00, g->w * g->h ); // pixels that were affected previous frame + + for (;;) { + int tag = stbi__get8(s); + switch (tag) { + case 0x2C: /* Image Descriptor */ + { + stbi__int32 x, y, w, h; + stbi_uc *o; + + x = stbi__get16le(s); + y = stbi__get16le(s); + w = stbi__get16le(s); + h = stbi__get16le(s); + if (((x + w) > (g->w)) || ((y + h) > (g->h))) + return stbi__errpuc("bad Image Descriptor", "Corrupt GIF"); + + g->line_size = g->w * 4; + g->start_x = x * 4; + g->start_y = y * g->line_size; + g->max_x = g->start_x + w * 4; + g->max_y = g->start_y + h * g->line_size; + g->cur_x = g->start_x; + g->cur_y = g->start_y; + + // if the width of the specified rectangle is 0, that means + // we may not see *any* pixels or the image is malformed; + // to make sure this is caught, move the current y down to + // max_y (which is what out_gif_code checks). + if (w == 0) + g->cur_y = g->max_y; + + g->lflags = stbi__get8(s); + + if (g->lflags & 0x40) { + g->step = 8 * g->line_size; // first interlaced spacing + g->parse = 3; + } else { + g->step = g->line_size; + g->parse = 0; + } + + if (g->lflags & 0x80) { + stbi__gif_parse_colortable(s,g->lpal, 2 << (g->lflags & 7), g->eflags & 0x01 ? g->transparent : -1); + g->color_table = (stbi_uc *) g->lpal; + } else if (g->flags & 0x80) { + g->color_table = (stbi_uc *) g->pal; + } else + return stbi__errpuc("missing color table", "Corrupt GIF"); + + o = stbi__process_gif_raster(s, g); + if (!o) return NULL; + + // if this was the first frame, + pcount = g->w * g->h; + if (first_frame && (g->bgindex > 0)) { + // if first frame, any pixel not drawn to gets the background color + for (pi = 0; pi < pcount; ++pi) { + if (g->history[pi] == 0) { + g->pal[g->bgindex][3] = 255; // just in case it was made transparent, undo that; It will be reset next frame if need be; + memcpy( &g->out[pi * 4], &g->pal[g->bgindex], 4 ); + } + } + } + + return o; + } + + case 0x21: // Comment Extension. + { + int len; + int ext = stbi__get8(s); + if (ext == 0xF9) { // Graphic Control Extension. + len = stbi__get8(s); + if (len == 4) { + g->eflags = stbi__get8(s); + g->delay = 10 * stbi__get16le(s); // delay - 1/100th of a second, saving as 1/1000ths. + + // unset old transparent + if (g->transparent >= 0) { + g->pal[g->transparent][3] = 255; + } + if (g->eflags & 0x01) { + g->transparent = stbi__get8(s); + if (g->transparent >= 0) { + g->pal[g->transparent][3] = 0; + } + } else { + // don't need transparent + stbi__skip(s, 1); + g->transparent = -1; + } + } else { + stbi__skip(s, len); + break; + } + } + while ((len = stbi__get8(s)) != 0) { + stbi__skip(s, len); + } + break; + } + + case 0x3B: // gif stream termination code + return (stbi_uc *) s; // using '1' causes warning on some compilers + + default: + return stbi__errpuc("unknown code", "Corrupt GIF"); + } + } +} + +static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, int *z, int *comp, int req_comp) +{ + if (stbi__gif_test(s)) { + int layers = 0; + stbi_uc *u = 0; + stbi_uc *out = 0; + stbi_uc *two_back = 0; + stbi__gif g; + int stride; + memset(&g, 0, sizeof(g)); + if (delays) { + *delays = 0; + } + + do { + u = stbi__gif_load_next(s, &g, comp, req_comp, two_back); + if (u == (stbi_uc *) s) u = 0; // end of animated gif marker + + if (u) { + *x = g.w; + *y = g.h; + ++layers; + stride = g.w * g.h * 4; + + if (out) { + out = (stbi_uc*) STBI_REALLOC( out, layers * stride ); + if (delays) { + *delays = (int*) STBI_REALLOC( *delays, sizeof(int) * layers ); + } + } else { + out = (stbi_uc*)stbi__malloc( layers * stride ); + if (delays) { + *delays = (int*) stbi__malloc( layers * sizeof(int) ); + } + } + memcpy( out + ((layers - 1) * stride), u, stride ); + if (layers >= 2) { + two_back = out - 2 * stride; + } + + if (delays) { + (*delays)[layers - 1U] = g.delay; + } + } + } while (u != 0); + + // free temp buffer; + STBI_FREE(g.out); + STBI_FREE(g.history); + STBI_FREE(g.background); + + // do the final conversion after loading everything; + if (req_comp && req_comp != 4) + out = stbi__convert_format(out, 4, req_comp, layers * g.w, g.h); + + *z = layers; + return out; + } else { + return stbi__errpuc("not GIF", "Image was not as a gif type."); + } +} + +static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + stbi_uc *u = 0; + stbi__gif g; + memset(&g, 0, sizeof(g)); + STBI_NOTUSED(ri); + + u = stbi__gif_load_next(s, &g, comp, req_comp, 0); + if (u == (stbi_uc *) s) u = 0; // end of animated gif marker + if (u) { + *x = g.w; + *y = g.h; + + // moved conversion to after successful load so that the same + // can be done for multiple frames. + if (req_comp && req_comp != 4) + u = stbi__convert_format(u, 4, req_comp, g.w, g.h); + } else if (g.out) { + // if there was an error and we allocated an image buffer, free it! + STBI_FREE(g.out); + } + + // free buffers needed for multiple frame loading; + STBI_FREE(g.history); + STBI_FREE(g.background); + + return u; +} + +static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp) +{ + return stbi__gif_info_raw(s,x,y,comp); +} +#endif + +// ************************************************************************************************* +// Radiance RGBE HDR loader +// originally by Nicolas Schulz +#ifndef STBI_NO_HDR +static int stbi__hdr_test_core(stbi__context *s, const char *signature) +{ + int i; + for (i=0; signature[i]; ++i) + if (stbi__get8(s) != signature[i]) + return 0; + stbi__rewind(s); + return 1; +} + +static int stbi__hdr_test(stbi__context* s) +{ + int r = stbi__hdr_test_core(s, "#?RADIANCE\n"); + stbi__rewind(s); + if(!r) { + r = stbi__hdr_test_core(s, "#?RGBE\n"); + stbi__rewind(s); + } + return r; +} + +#define STBI__HDR_BUFLEN 1024 +static char *stbi__hdr_gettoken(stbi__context *z, char *buffer) +{ + int len=0; + char c = '\0'; + + c = (char) stbi__get8(z); + + while (!stbi__at_eof(z) && c != '\n') { + buffer[len++] = c; + if (len == STBI__HDR_BUFLEN-1) { + // flush to end of line + while (!stbi__at_eof(z) && stbi__get8(z) != '\n') + ; + break; + } + c = (char) stbi__get8(z); + } + + buffer[len] = 0; + return buffer; +} + +static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp) +{ + if ( input[3] != 0 ) { + float f1; + // Exponent + f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8)); + if (req_comp <= 2) + output[0] = (input[0] + input[1] + input[2]) * f1 / 3; + else { + output[0] = input[0] * f1; + output[1] = input[1] * f1; + output[2] = input[2] * f1; + } + if (req_comp == 2) output[1] = 1; + if (req_comp == 4) output[3] = 1; + } else { + switch (req_comp) { + case 4: output[3] = 1; /* fallthrough */ + case 3: output[0] = output[1] = output[2] = 0; + break; + case 2: output[1] = 1; /* fallthrough */ + case 1: output[0] = 0; + break; + } + } +} + +static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + char buffer[STBI__HDR_BUFLEN]; + char *token; + int valid = 0; + int width, height; + stbi_uc *scanline; + float *hdr_data; + int len; + unsigned char count, value; + int i, j, k, c1,c2, z; + const char *headerToken; + STBI_NOTUSED(ri); + + // Check identifier + headerToken = stbi__hdr_gettoken(s,buffer); + if (strcmp(headerToken, "#?RADIANCE") != 0 && strcmp(headerToken, "#?RGBE") != 0) + return stbi__errpf("not HDR", "Corrupt HDR image"); + + // Parse header + for(;;) { + token = stbi__hdr_gettoken(s,buffer); + if (token[0] == 0) break; + if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; + } + + if (!valid) return stbi__errpf("unsupported format", "Unsupported HDR format"); + + // Parse width and height + // can't use sscanf() if we're not using stdio! + token = stbi__hdr_gettoken(s,buffer); + if (strncmp(token, "-Y ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format"); + token += 3; + height = (int) strtol(token, &token, 10); + while (*token == ' ') ++token; + if (strncmp(token, "+X ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format"); + token += 3; + width = (int) strtol(token, NULL, 10); + + *x = width; + *y = height; + + if (comp) *comp = 3; + if (req_comp == 0) req_comp = 3; + + if (!stbi__mad4sizes_valid(width, height, req_comp, sizeof(float), 0)) + return stbi__errpf("too large", "HDR image is too large"); + + // Read data + hdr_data = (float *) stbi__malloc_mad4(width, height, req_comp, sizeof(float), 0); + if (!hdr_data) + return stbi__errpf("outofmem", "Out of memory"); + + // Load image data + // image data is stored as some number of sca + if ( width < 8 || width >= 32768) { + // Read flat data + for (j=0; j < height; ++j) { + for (i=0; i < width; ++i) { + stbi_uc rgbe[4]; + main_decode_loop: + stbi__getn(s, rgbe, 4); + stbi__hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp); + } + } + } else { + // Read RLE-encoded data + scanline = NULL; + + for (j = 0; j < height; ++j) { + c1 = stbi__get8(s); + c2 = stbi__get8(s); + len = stbi__get8(s); + if (c1 != 2 || c2 != 2 || (len & 0x80)) { + // not run-length encoded, so we have to actually use THIS data as a decoded + // pixel (note this can't be a valid pixel--one of RGB must be >= 128) + stbi_uc rgbe[4]; + rgbe[0] = (stbi_uc) c1; + rgbe[1] = (stbi_uc) c2; + rgbe[2] = (stbi_uc) len; + rgbe[3] = (stbi_uc) stbi__get8(s); + stbi__hdr_convert(hdr_data, rgbe, req_comp); + i = 1; + j = 0; + STBI_FREE(scanline); + goto main_decode_loop; // yes, this makes no sense + } + len <<= 8; + len |= stbi__get8(s); + if (len != width) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("invalid decoded scanline length", "corrupt HDR"); } + if (scanline == NULL) { + scanline = (stbi_uc *) stbi__malloc_mad2(width, 4, 0); + if (!scanline) { + STBI_FREE(hdr_data); + return stbi__errpf("outofmem", "Out of memory"); + } + } + + for (k = 0; k < 4; ++k) { + int nleft; + i = 0; + while ((nleft = width - i) > 0) { + count = stbi__get8(s); + if (count > 128) { + // Run + value = stbi__get8(s); + count -= 128; + if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); } + for (z = 0; z < count; ++z) + scanline[i++ * 4 + k] = value; + } else { + // Dump + if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); } + for (z = 0; z < count; ++z) + scanline[i++ * 4 + k] = stbi__get8(s); + } + } + } + for (i=0; i < width; ++i) + stbi__hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp); + } + if (scanline) + STBI_FREE(scanline); + } + + return hdr_data; +} + +static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp) +{ + char buffer[STBI__HDR_BUFLEN]; + char *token; + int valid = 0; + int dummy; + + if (!x) x = &dummy; + if (!y) y = &dummy; + if (!comp) comp = &dummy; + + if (stbi__hdr_test(s) == 0) { + stbi__rewind( s ); + return 0; + } + + for(;;) { + token = stbi__hdr_gettoken(s,buffer); + if (token[0] == 0) break; + if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; + } + + if (!valid) { + stbi__rewind( s ); + return 0; + } + token = stbi__hdr_gettoken(s,buffer); + if (strncmp(token, "-Y ", 3)) { + stbi__rewind( s ); + return 0; + } + token += 3; + *y = (int) strtol(token, &token, 10); + while (*token == ' ') ++token; + if (strncmp(token, "+X ", 3)) { + stbi__rewind( s ); + return 0; + } + token += 3; + *x = (int) strtol(token, NULL, 10); + *comp = 3; + return 1; +} +#endif // STBI_NO_HDR + +#ifndef STBI_NO_BMP +static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp) +{ + void *p; + stbi__bmp_data info; + + info.all_a = 255; + p = stbi__bmp_parse_header(s, &info); + stbi__rewind( s ); + if (p == NULL) + return 0; + if (x) *x = s->img_x; + if (y) *y = s->img_y; + if (comp) *comp = info.ma ? 4 : 3; + return 1; +} +#endif + +#ifndef STBI_NO_PSD +static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp) +{ + int channelCount, dummy, depth; + if (!x) x = &dummy; + if (!y) y = &dummy; + if (!comp) comp = &dummy; + if (stbi__get32be(s) != 0x38425053) { + stbi__rewind( s ); + return 0; + } + if (stbi__get16be(s) != 1) { + stbi__rewind( s ); + return 0; + } + stbi__skip(s, 6); + channelCount = stbi__get16be(s); + if (channelCount < 0 || channelCount > 16) { + stbi__rewind( s ); + return 0; + } + *y = stbi__get32be(s); + *x = stbi__get32be(s); + depth = stbi__get16be(s); + if (depth != 8 && depth != 16) { + stbi__rewind( s ); + return 0; + } + if (stbi__get16be(s) != 3) { + stbi__rewind( s ); + return 0; + } + *comp = 4; + return 1; +} + +static int stbi__psd_is16(stbi__context *s) +{ + int channelCount, depth; + if (stbi__get32be(s) != 0x38425053) { + stbi__rewind( s ); + return 0; + } + if (stbi__get16be(s) != 1) { + stbi__rewind( s ); + return 0; + } + stbi__skip(s, 6); + channelCount = stbi__get16be(s); + if (channelCount < 0 || channelCount > 16) { + stbi__rewind( s ); + return 0; + } + (void) stbi__get32be(s); + (void) stbi__get32be(s); + depth = stbi__get16be(s); + if (depth != 16) { + stbi__rewind( s ); + return 0; + } + return 1; +} +#endif + +#ifndef STBI_NO_PIC +static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp) +{ + int act_comp=0,num_packets=0,chained,dummy; + stbi__pic_packet packets[10]; + + if (!x) x = &dummy; + if (!y) y = &dummy; + if (!comp) comp = &dummy; + + if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) { + stbi__rewind(s); + return 0; + } + + stbi__skip(s, 88); + + *x = stbi__get16be(s); + *y = stbi__get16be(s); + if (stbi__at_eof(s)) { + stbi__rewind( s); + return 0; + } + if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) { + stbi__rewind( s ); + return 0; + } + + stbi__skip(s, 8); + + do { + stbi__pic_packet *packet; + + if (num_packets==sizeof(packets)/sizeof(packets[0])) + return 0; + + packet = &packets[num_packets++]; + chained = stbi__get8(s); + packet->size = stbi__get8(s); + packet->type = stbi__get8(s); + packet->channel = stbi__get8(s); + act_comp |= packet->channel; + + if (stbi__at_eof(s)) { + stbi__rewind( s ); + return 0; + } + if (packet->size != 8) { + stbi__rewind( s ); + return 0; + } + } while (chained); + + *comp = (act_comp & 0x10 ? 4 : 3); + + return 1; +} +#endif + +// ************************************************************************************************* +// Portable Gray Map and Portable Pixel Map loader +// by Ken Miller +// +// PGM: http://netpbm.sourceforge.net/doc/pgm.html +// PPM: http://netpbm.sourceforge.net/doc/ppm.html +// +// Known limitations: +// Does not support comments in the header section +// Does not support ASCII image data (formats P2 and P3) +// Does not support 16-bit-per-channel + +#ifndef STBI_NO_PNM + +static int stbi__pnm_test(stbi__context *s) +{ + char p, t; + p = (char) stbi__get8(s); + t = (char) stbi__get8(s); + if (p != 'P' || (t != '5' && t != '6')) { + stbi__rewind( s ); + return 0; + } + return 1; +} + +static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + stbi_uc *out; + STBI_NOTUSED(ri); + + if (!stbi__pnm_info(s, (int *)&s->img_x, (int *)&s->img_y, (int *)&s->img_n)) + return 0; + + *x = s->img_x; + *y = s->img_y; + if (comp) *comp = s->img_n; + + if (!stbi__mad3sizes_valid(s->img_n, s->img_x, s->img_y, 0)) + return stbi__errpuc("too large", "PNM too large"); + + out = (stbi_uc *) stbi__malloc_mad3(s->img_n, s->img_x, s->img_y, 0); + if (!out) return stbi__errpuc("outofmem", "Out of memory"); + stbi__getn(s, out, s->img_n * s->img_x * s->img_y); + + if (req_comp && req_comp != s->img_n) { + out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y); + if (out == NULL) return out; // stbi__convert_format frees input on failure + } + return out; +} + +static int stbi__pnm_isspace(char c) +{ + return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r'; +} + +static void stbi__pnm_skip_whitespace(stbi__context *s, char *c) +{ + for (;;) { + while (!stbi__at_eof(s) && stbi__pnm_isspace(*c)) + *c = (char) stbi__get8(s); + + if (stbi__at_eof(s) || *c != '#') + break; + + while (!stbi__at_eof(s) && *c != '\n' && *c != '\r' ) + *c = (char) stbi__get8(s); + } +} + +static int stbi__pnm_isdigit(char c) +{ + return c >= '0' && c <= '9'; +} + +static int stbi__pnm_getinteger(stbi__context *s, char *c) +{ + int value = 0; + + while (!stbi__at_eof(s) && stbi__pnm_isdigit(*c)) { + value = value*10 + (*c - '0'); + *c = (char) stbi__get8(s); + } + + return value; +} + +static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp) +{ + int maxv, dummy; + char c, p, t; + + if (!x) x = &dummy; + if (!y) y = &dummy; + if (!comp) comp = &dummy; + + stbi__rewind(s); + + // Get identifier + p = (char) stbi__get8(s); + t = (char) stbi__get8(s); + if (p != 'P' || (t != '5' && t != '6')) { + stbi__rewind(s); + return 0; + } + + *comp = (t == '6') ? 3 : 1; // '5' is 1-component .pgm; '6' is 3-component .ppm + + c = (char) stbi__get8(s); + stbi__pnm_skip_whitespace(s, &c); + + *x = stbi__pnm_getinteger(s, &c); // read width + stbi__pnm_skip_whitespace(s, &c); + + *y = stbi__pnm_getinteger(s, &c); // read height + stbi__pnm_skip_whitespace(s, &c); + + maxv = stbi__pnm_getinteger(s, &c); // read max value + + if (maxv > 255) + return stbi__err("max value > 255", "PPM image not 8-bit"); + else + return 1; +} +#endif + +static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp) +{ + #ifndef STBI_NO_JPEG + if (stbi__jpeg_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PNG + if (stbi__png_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_GIF + if (stbi__gif_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_BMP + if (stbi__bmp_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PSD + if (stbi__psd_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PIC + if (stbi__pic_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PNM + if (stbi__pnm_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_HDR + if (stbi__hdr_info(s, x, y, comp)) return 1; + #endif + + // test tga last because it's a crappy test! + #ifndef STBI_NO_TGA + if (stbi__tga_info(s, x, y, comp)) + return 1; + #endif + return stbi__err("unknown image type", "Image not of any known type, or corrupt"); +} + +static int stbi__is_16_main(stbi__context *s) +{ + #ifndef STBI_NO_PNG + if (stbi__png_is16(s)) return 1; + #endif + + #ifndef STBI_NO_PSD + if (stbi__psd_is16(s)) return 1; + #endif + + return 0; +} + +#ifndef STBI_NO_STDIO +STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp) +{ + FILE *f = stbi__fopen(filename, "rb"); + int result; + if (!f) return stbi__err("can't fopen", "Unable to open file"); + result = stbi_info_from_file(f, x, y, comp); + fclose(f); + return result; +} + +STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp) +{ + int r; + stbi__context s; + long pos = ftell(f); + stbi__start_file(&s, f); + r = stbi__info_main(&s,x,y,comp); + fseek(f,pos,SEEK_SET); + return r; +} + +STBIDEF int stbi_is_16_bit(char const *filename) +{ + FILE *f = stbi__fopen(filename, "rb"); + int result; + if (!f) return stbi__err("can't fopen", "Unable to open file"); + result = stbi_is_16_bit_from_file(f); + fclose(f); + return result; +} + +STBIDEF int stbi_is_16_bit_from_file(FILE *f) +{ + int r; + stbi__context s; + long pos = ftell(f); + stbi__start_file(&s, f); + r = stbi__is_16_main(&s); + fseek(f,pos,SEEK_SET); + return r; +} +#endif // !STBI_NO_STDIO + +STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__info_main(&s,x,y,comp); +} + +STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int *x, int *y, int *comp) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user); + return stbi__info_main(&s,x,y,comp); +} + +STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__is_16_main(&s); +} + +STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, void *user) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user); + return stbi__is_16_main(&s); +} + +#endif // STB_IMAGE_IMPLEMENTATION + +/* + revision history: + 2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs + 2.19 (2018-02-11) fix warning + 2.18 (2018-01-30) fix warnings + 2.17 (2018-01-29) change sbti__shiftsigned to avoid clang -O2 bug + 1-bit BMP + *_is_16_bit api + avoid warnings + 2.16 (2017-07-23) all functions have 16-bit variants; + STBI_NO_STDIO works again; + compilation fixes; + fix rounding in unpremultiply; + optimize vertical flip; + disable raw_len validation; + documentation fixes + 2.15 (2017-03-18) fix png-1,2,4 bug; now all Imagenet JPGs decode; + warning fixes; disable run-time SSE detection on gcc; + uniform handling of optional "return" values; + thread-safe initialization of zlib tables + 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs + 2.13 (2016-11-29) add 16-bit API, only supported for PNG right now + 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes + 2.11 (2016-04-02) allocate large structures on the stack + remove white matting for transparent PSD + fix reported channel count for PNG & BMP + re-enable SSE2 in non-gcc 64-bit + support RGB-formatted JPEG + read 16-bit PNGs (only as 8-bit) + 2.10 (2016-01-22) avoid warning introduced in 2.09 by STBI_REALLOC_SIZED + 2.09 (2016-01-16) allow comments in PNM files + 16-bit-per-pixel TGA (not bit-per-component) + info() for TGA could break due to .hdr handling + info() for BMP to shares code instead of sloppy parse + can use STBI_REALLOC_SIZED if allocator doesn't support realloc + code cleanup + 2.08 (2015-09-13) fix to 2.07 cleanup, reading RGB PSD as RGBA + 2.07 (2015-09-13) fix compiler warnings + partial animated GIF support + limited 16-bpc PSD support + #ifdef unused functions + bug with < 92 byte PIC,PNM,HDR,TGA + 2.06 (2015-04-19) fix bug where PSD returns wrong '*comp' value + 2.05 (2015-04-19) fix bug in progressive JPEG handling, fix warning + 2.04 (2015-04-15) try to re-enable SIMD on MinGW 64-bit + 2.03 (2015-04-12) extra corruption checking (mmozeiko) + stbi_set_flip_vertically_on_load (nguillemot) + fix NEON support; fix mingw support + 2.02 (2015-01-19) fix incorrect assert, fix warning + 2.01 (2015-01-17) fix various warnings; suppress SIMD on gcc 32-bit without -msse2 + 2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG + 2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg) + progressive JPEG (stb) + PGM/PPM support (Ken Miller) + STBI_MALLOC,STBI_REALLOC,STBI_FREE + GIF bugfix -- seemingly never worked + STBI_NO_*, STBI_ONLY_* + 1.48 (2014-12-14) fix incorrectly-named assert() + 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb) + optimize PNG (ryg) + fix bug in interlaced PNG with user-specified channel count (stb) + 1.46 (2014-08-26) + fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG + 1.45 (2014-08-16) + fix MSVC-ARM internal compiler error by wrapping malloc + 1.44 (2014-08-07) + various warning fixes from Ronny Chevalier + 1.43 (2014-07-15) + fix MSVC-only compiler problem in code changed in 1.42 + 1.42 (2014-07-09) + don't define _CRT_SECURE_NO_WARNINGS (affects user code) + fixes to stbi__cleanup_jpeg path + added STBI_ASSERT to avoid requiring assert.h + 1.41 (2014-06-25) + fix search&replace from 1.36 that messed up comments/error messages + 1.40 (2014-06-22) + fix gcc struct-initialization warning + 1.39 (2014-06-15) + fix to TGA optimization when req_comp != number of components in TGA; + fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite) + add support for BMP version 5 (more ignored fields) + 1.38 (2014-06-06) + suppress MSVC warnings on integer casts truncating values + fix accidental rename of 'skip' field of I/O + 1.37 (2014-06-04) + remove duplicate typedef + 1.36 (2014-06-03) + convert to header file single-file library + if de-iphone isn't set, load iphone images color-swapped instead of returning NULL + 1.35 (2014-05-27) + various warnings + fix broken STBI_SIMD path + fix bug where stbi_load_from_file no longer left file pointer in correct place + fix broken non-easy path for 32-bit BMP (possibly never used) + TGA optimization by Arseny Kapoulkine + 1.34 (unknown) + use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case + 1.33 (2011-07-14) + make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements + 1.32 (2011-07-13) + support for "info" function for all supported filetypes (SpartanJ) + 1.31 (2011-06-20) + a few more leak fixes, bug in PNG handling (SpartanJ) + 1.30 (2011-06-11) + added ability to load files via callbacks to accomidate custom input streams (Ben Wenger) + removed deprecated format-specific test/load functions + removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway + error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha) + fix inefficiency in decoding 32-bit BMP (David Woo) + 1.29 (2010-08-16) + various warning fixes from Aurelien Pocheville + 1.28 (2010-08-01) + fix bug in GIF palette transparency (SpartanJ) + 1.27 (2010-08-01) + cast-to-stbi_uc to fix warnings + 1.26 (2010-07-24) + fix bug in file buffering for PNG reported by SpartanJ + 1.25 (2010-07-17) + refix trans_data warning (Won Chun) + 1.24 (2010-07-12) + perf improvements reading from files on platforms with lock-heavy fgetc() + minor perf improvements for jpeg + deprecated type-specific functions so we'll get feedback if they're needed + attempt to fix trans_data warning (Won Chun) + 1.23 fixed bug in iPhone support + 1.22 (2010-07-10) + removed image *writing* support + stbi_info support from Jetro Lauha + GIF support from Jean-Marc Lienher + iPhone PNG-extensions from James Brown + warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva) + 1.21 fix use of 'stbi_uc' in header (reported by jon blow) + 1.20 added support for Softimage PIC, by Tom Seddon + 1.19 bug in interlaced PNG corruption check (found by ryg) + 1.18 (2008-08-02) + fix a threading bug (local mutable static) + 1.17 support interlaced PNG + 1.16 major bugfix - stbi__convert_format converted one too many pixels + 1.15 initialize some fields for thread safety + 1.14 fix threadsafe conversion bug + header-file-only version (#define STBI_HEADER_FILE_ONLY before including) + 1.13 threadsafe + 1.12 const qualifiers in the API + 1.11 Support installable IDCT, colorspace conversion routines + 1.10 Fixes for 64-bit (don't use "unsigned long") + optimized upsampling by Fabian "ryg" Giesen + 1.09 Fix format-conversion for PSD code (bad global variables!) + 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz + 1.07 attempt to fix C++ warning/errors again + 1.06 attempt to fix C++ warning/errors again + 1.05 fix TGA loading to return correct *comp and use good luminance calc + 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free + 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR + 1.02 support for (subset of) HDR files, float interface for preferred access to them + 1.01 fix bug: possible bug in handling right-side up bmps... not sure + fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all + 1.00 interface to zlib that skips zlib header + 0.99 correct handling of alpha in palette + 0.98 TGA loader by lonesock; dynamically add loaders (untested) + 0.97 jpeg errors on too large a file; also catch another malloc failure + 0.96 fix detection of invalid v value - particleman@mollyrocket forum + 0.95 during header scan, seek to markers in case of padding + 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same + 0.93 handle jpegtran output; verbose errors + 0.92 read 4,8,16,24,32-bit BMP files of several formats + 0.91 output 24-bit Windows 3.0 BMP files + 0.90 fix a few more warnings; bump version number to approach 1.0 + 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd + 0.60 fix compiling as c++ + 0.59 fix warnings: merge Dave Moore's -Wall fixes + 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian + 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available + 0.56 fix bug: zlib uncompressed mode len vs. nlen + 0.55 fix bug: restart_interval not initialized to 0 + 0.54 allow NULL for 'int *comp' + 0.53 fix bug in png 3->4; speedup png decoding + 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments + 0.51 obey req_comp requests, 1-component jpegs return as 1-component, + on 'test' only check type, not whether we support this variant + 0.50 (2006-11-19) + first released version +*/ + + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +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. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +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 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/src/include/switch_core_video.h b/src/include/switch_core_video.h index 21e6b77414..23d1356b78 100644 --- a/src/include/switch_core_video.h +++ b/src/include/switch_core_video.h @@ -395,6 +395,9 @@ SWITCH_DECLARE(switch_status_t) switch_img_write_png(switch_image_t *img, char * SWITCH_DECLARE(switch_status_t) switch_png_open(switch_png_t **pngP, const char *file_name); SWITCH_DECLARE(void) switch_png_free(switch_png_t **pngP); SWITCH_DECLARE(switch_status_t) switch_img_data_url_png(switch_image_t *img, char **urlP); + +/*!\brief Read an image file to switch_image_t */ +SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char *file_name, switch_img_fmt_t img_fmt); /*!\brief put a small img over a big IMG at position x,y, with alpha transparency * diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 540edf0ae9..dcdbe67332 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -48,6 +48,9 @@ #include <gd.h> #endif +#define STB_IMAGE_IMPLEMENTATION +#include "../libs/stb/stb_image.h" + #ifdef SWITCH_HAVE_YUV static inline void switch_img_get_yuv_pixel(switch_image_t *img, switch_yuv_color_t *yuv, int x, int y); #endif @@ -3100,6 +3103,51 @@ SWITCH_DECLARE(switch_status_t) switch_img_data_url_png(switch_image_t *img, cha #endif +SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name, switch_img_fmt_t img_fmt) +{ + int width = 0, height = 0, channels = 8; + int comp = STBI_rgb; + unsigned char *data = NULL; + + if (img_fmt == SWITCH_IMG_FMT_I420) { + comp = STBI_rgb; + } else if (img_fmt == SWITCH_IMG_FMT_ARGB) { + comp = STBI_rgb_alpha; + } else { + return NULL; + } + + data = stbi_load(file_name, &width, &height, &channels, comp); + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%dx%d channels=%d\n", width, height, channels); + + if (data && width > 0 && height > 0) { + switch_image_t *img = switch_img_alloc(NULL, img_fmt, width, height, 1); + switch_assert(img); + + if (img_fmt == SWITCH_IMG_FMT_I420) { + RAWToI420(data, width * 3, + img->planes[SWITCH_PLANE_Y], img->stride[SWITCH_PLANE_Y], + img->planes[SWITCH_PLANE_U], img->stride[SWITCH_PLANE_U], + img->planes[SWITCH_PLANE_V], img->stride[SWITCH_PLANE_V], + width, height); + } else if (img_fmt == SWITCH_IMG_FMT_ARGB) { +#if SWITCH_BYTE_ORDER == __BIG_ENDIAN + RGBAToARGB(data, width * 4, img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], width, height); +#else + ABGRToARGB(data, width * 4, img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], width, height); +#endif + } + + stbi_image_free(data); + + return img; + } else if (data) { + stbi_image_free(data); + } + + return NULL; +} + SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color) { int img_w = 0, img_h = 0; diff --git a/tests/unit/switch_core_video.c b/tests/unit/switch_core_video.c index 7d42eaae1f..cafa075337 100644 --- a/tests/unit/switch_core_video.c +++ b/tests/unit/switch_core_video.c @@ -199,6 +199,27 @@ FST_CORE_BEGIN("./conf") switch_img_free(&timg_small); } FST_TEST_END() + + FST_TEST_BEGIN(read_from_file) + { + switch_image_t *img; + + img = switch_img_read_from_file("../../images/cluecon.png", SWITCH_IMG_FMT_I420); + fst_requires(img); + switch_img_write_png(img, "cluecon-rgb.png"); + switch_img_free(&img); + + img = switch_img_read_from_file("../../images/cluecon.png", SWITCH_IMG_FMT_ARGB); + fst_requires(img); + switch_img_write_png(img, "cluecon-argb.png"); + switch_img_free(&img); + + img = switch_img_read_from_file("../../images/cluecon.jpg", SWITCH_IMG_FMT_I420); + fst_requires(img); + switch_img_write_png(img, "cluecon-jpg.png"); + switch_img_free(&img); + } + FST_TEST_END() } FST_SUITE_END() } From 2a87e7b98c37a1adf554804c5ff349fc498aac22 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Wed, 6 Mar 2019 10:28:40 +0800 Subject: [PATCH 268/655] [core] add stb_image_write supported image write --- libs/stb/stb_image_write.h | 1622 +++++++++++++++++++++++++++++++ src/include/switch_core_video.h | 8 +- src/switch_core_video.c | 65 +- tests/unit/switch_core_video.c | 25 + 4 files changed, 1718 insertions(+), 2 deletions(-) create mode 100644 libs/stb/stb_image_write.h diff --git a/libs/stb/stb_image_write.h b/libs/stb/stb_image_write.h new file mode 100644 index 0000000000..09522e8121 --- /dev/null +++ b/libs/stb/stb_image_write.h @@ -0,0 +1,1622 @@ +/* stb_image_write - v1.13 - public domain - http://nothings.org/stb/stb_image_write.h + writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015 + no warranty implied; use at your own risk + + Before #including, + + #define STB_IMAGE_WRITE_IMPLEMENTATION + + in the file that you want to have the implementation. + + Will probably not work correctly with strict-aliasing optimizations. + + If using a modern Microsoft Compiler, non-safe versions of CRT calls may cause + compilation warnings or even errors. To avoid this, also before #including, + + #define STBI_MSC_SECURE_CRT + +ABOUT: + + This header file is a library for writing images to C stdio or a callback. + + The PNG output is not optimal; it is 20-50% larger than the file + written by a decent optimizing implementation; though providing a custom + zlib compress function (see STBIW_ZLIB_COMPRESS) can mitigate that. + This library is designed for source code compactness and simplicity, + not optimal image file size or run-time performance. + +BUILDING: + + You can #define STBIW_ASSERT(x) before the #include to avoid using assert.h. + You can #define STBIW_MALLOC(), STBIW_REALLOC(), and STBIW_FREE() to replace + malloc,realloc,free. + You can #define STBIW_MEMMOVE() to replace memmove() + You can #define STBIW_ZLIB_COMPRESS to use a custom zlib-style compress function + for PNG compression (instead of the builtin one), it must have the following signature: + unsigned char * my_compress(unsigned char *data, int data_len, int *out_len, int quality); + The returned data will be freed with STBIW_FREE() (free() by default), + so it must be heap allocated with STBIW_MALLOC() (malloc() by default), + +UNICODE: + + If compiling for Windows and you wish to use Unicode filenames, compile + with + #define STBIW_WINDOWS_UTF8 + and pass utf8-encoded filenames. Call stbiw_convert_wchar_to_utf8 to convert + Windows wchar_t filenames to utf8. + +USAGE: + + There are five functions, one for each image file format: + + int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes); + int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); + int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); + int stbi_write_jpg(char const *filename, int w, int h, int comp, const void *data, int quality); + int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); + + void stbi_flip_vertically_on_write(int flag); // flag is non-zero to flip data vertically + + There are also five equivalent functions that use an arbitrary write function. You are + expected to open/close your file-equivalent before and after calling these: + + int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data, int stride_in_bytes); + int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); + int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); + int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); + int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality); + + where the callback is: + void stbi_write_func(void *context, void *data, int size); + + You can configure it with these global variables: + int stbi_write_tga_with_rle; // defaults to true; set to 0 to disable RLE + int stbi_write_png_compression_level; // defaults to 8; set to higher for more compression + int stbi_write_force_png_filter; // defaults to -1; set to 0..5 to force a filter mode + + + You can define STBI_WRITE_NO_STDIO to disable the file variant of these + functions, so the library will not use stdio.h at all. However, this will + also disable HDR writing, because it requires stdio for formatted output. + + Each function returns 0 on failure and non-0 on success. + + The functions create an image file defined by the parameters. The image + is a rectangle of pixels stored from left-to-right, top-to-bottom. + Each pixel contains 'comp' channels of data stored interleaved with 8-bits + per channel, in the following order: 1=Y, 2=YA, 3=RGB, 4=RGBA. (Y is + monochrome color.) The rectangle is 'w' pixels wide and 'h' pixels tall. + The *data pointer points to the first byte of the top-left-most pixel. + For PNG, "stride_in_bytes" is the distance in bytes from the first byte of + a row of pixels to the first byte of the next row of pixels. + + PNG creates output files with the same number of components as the input. + The BMP format expands Y to RGB in the file format and does not + output alpha. + + PNG supports writing rectangles of data even when the bytes storing rows of + data are not consecutive in memory (e.g. sub-rectangles of a larger image), + by supplying the stride between the beginning of adjacent rows. The other + formats do not. (Thus you cannot write a native-format BMP through the BMP + writer, both because it is in BGR order and because it may have padding + at the end of the line.) + + PNG allows you to set the deflate compression level by setting the global + variable 'stbi_write_png_compression_level' (it defaults to 8). + + HDR expects linear float data. Since the format is always 32-bit rgb(e) + data, alpha (if provided) is discarded, and for monochrome data it is + replicated across all three channels. + + TGA supports RLE or non-RLE compressed data. To use non-RLE-compressed + data, set the global variable 'stbi_write_tga_with_rle' to 0. + + JPEG does ignore alpha channels in input data; quality is between 1 and 100. + Higher quality looks better but results in a bigger image. + JPEG baseline (no JPEG progressive). + +CREDITS: + + + Sean Barrett - PNG/BMP/TGA + Baldur Karlsson - HDR + Jean-Sebastien Guay - TGA monochrome + Tim Kelsey - misc enhancements + Alan Hickman - TGA RLE + Emmanuel Julien - initial file IO callback implementation + Jon Olick - original jo_jpeg.cpp code + Daniel Gibson - integrate JPEG, allow external zlib + Aarni Koskela - allow choosing PNG filter + + bugfixes: + github:Chribba + Guillaume Chereau + github:jry2 + github:romigrou + Sergio Gonzalez + Jonas Karlsson + Filip Wasil + Thatcher Ulrich + github:poppolopoppo + Patrick Boettcher + github:xeekworx + Cap Petschulat + Simon Rodriguez + Ivan Tikhonov + github:ignotion + Adam Schackart + +LICENSE + + See end of file for license information. + +*/ + +#ifndef INCLUDE_STB_IMAGE_WRITE_H +#define INCLUDE_STB_IMAGE_WRITE_H + +#include <stdlib.h> + +// if STB_IMAGE_WRITE_STATIC causes problems, try defining STBIWDEF to 'inline' or 'static inline' +#ifndef STBIWDEF +#ifdef STB_IMAGE_WRITE_STATIC +#define STBIWDEF static +#else +#ifdef __cplusplus +#define STBIWDEF extern "C" +#else +#define STBIWDEF extern +#endif +#endif +#endif + +#ifndef STB_IMAGE_WRITE_STATIC // C++ forbids static forward declarations +extern int stbi_write_tga_with_rle; +extern int stbi_write_png_compression_level; +extern int stbi_write_force_png_filter; +#endif + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes); +STBIWDEF int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data); +STBIWDEF int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data); +STBIWDEF int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data); +STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality); + +#ifdef STBI_WINDOWS_UTF8 +STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input); +#endif +#endif + +typedef void stbi_write_func(void *context, void *data, int size); + +STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data, int stride_in_bytes); +STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); +STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data); +STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data); +STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality); + +STBIWDEF void stbi_flip_vertically_on_write(int flip_boolean); + +#endif//INCLUDE_STB_IMAGE_WRITE_H + +#ifdef STB_IMAGE_WRITE_IMPLEMENTATION + +#ifdef _WIN32 + #ifndef _CRT_SECURE_NO_WARNINGS + #define _CRT_SECURE_NO_WARNINGS + #endif + #ifndef _CRT_NONSTDC_NO_DEPRECATE + #define _CRT_NONSTDC_NO_DEPRECATE + #endif +#endif + +#ifndef STBI_WRITE_NO_STDIO +#include <stdio.h> +#endif // STBI_WRITE_NO_STDIO + +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#if defined(STBIW_MALLOC) && defined(STBIW_FREE) && (defined(STBIW_REALLOC) || defined(STBIW_REALLOC_SIZED)) +// ok +#elif !defined(STBIW_MALLOC) && !defined(STBIW_FREE) && !defined(STBIW_REALLOC) && !defined(STBIW_REALLOC_SIZED) +// ok +#else +#error "Must define all or none of STBIW_MALLOC, STBIW_FREE, and STBIW_REALLOC (or STBIW_REALLOC_SIZED)." +#endif + +#ifndef STBIW_MALLOC +#define STBIW_MALLOC(sz) malloc(sz) +#define STBIW_REALLOC(p,newsz) realloc(p,newsz) +#define STBIW_FREE(p) free(p) +#endif + +#ifndef STBIW_REALLOC_SIZED +#define STBIW_REALLOC_SIZED(p,oldsz,newsz) STBIW_REALLOC(p,newsz) +#endif + + +#ifndef STBIW_MEMMOVE +#define STBIW_MEMMOVE(a,b,sz) memmove(a,b,sz) +#endif + + +#ifndef STBIW_ASSERT +#include <assert.h> +#define STBIW_ASSERT(x) assert(x) +#endif + +#define STBIW_UCHAR(x) (unsigned char) ((x) & 0xff) + +#ifdef STB_IMAGE_WRITE_STATIC +static int stbi__flip_vertically_on_write=0; +static int stbi_write_png_compression_level = 8; +static int stbi_write_tga_with_rle = 1; +static int stbi_write_force_png_filter = -1; +#else +int stbi_write_png_compression_level = 8; +int stbi__flip_vertically_on_write=0; +int stbi_write_tga_with_rle = 1; +int stbi_write_force_png_filter = -1; +#endif + +STBIWDEF void stbi_flip_vertically_on_write(int flag) +{ + stbi__flip_vertically_on_write = flag; +} + +typedef struct +{ + stbi_write_func *func; + void *context; +} stbi__write_context; + +// initialize a callback-based context +static void stbi__start_write_callbacks(stbi__write_context *s, stbi_write_func *c, void *context) +{ + s->func = c; + s->context = context; +} + +#ifndef STBI_WRITE_NO_STDIO + +static void stbi__stdio_write(void *context, void *data, int size) +{ + fwrite(data,1,size,(FILE*) context); +} + +#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) +#ifdef __cplusplus +#define STBIW_EXTERN extern "C" +#else +#define STBIW_EXTERN extern +#endif +STBIW_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); +STBIW_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); + +STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) +{ + return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); +} +#endif + +static FILE *stbiw__fopen(char const *filename, char const *mode) +{ + FILE *f; +#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) + wchar_t wMode[64]; + wchar_t wFilename[1024]; + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename))) + return 0; + + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode))) + return 0; + +#if _MSC_VER >= 1400 + if (0 != _wfopen_s(&f, wFilename, wMode)) + f = 0; +#else + f = _wfopen(wFilename, wMode); +#endif + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + if (0 != fopen_s(&f, filename, mode)) + f=0; +#else + f = fopen(filename, mode); +#endif + return f; +} + +static int stbi__start_write_file(stbi__write_context *s, const char *filename) +{ + FILE *f = stbiw__fopen(filename, "wb"); + stbi__start_write_callbacks(s, stbi__stdio_write, (void *) f); + return f != NULL; +} + +static void stbi__end_write_file(stbi__write_context *s) +{ + fclose((FILE *)s->context); +} + +#endif // !STBI_WRITE_NO_STDIO + +typedef unsigned int stbiw_uint32; +typedef int stb_image_write_test[sizeof(stbiw_uint32)==4 ? 1 : -1]; + +static void stbiw__writefv(stbi__write_context *s, const char *fmt, va_list v) +{ + while (*fmt) { + switch (*fmt++) { + case ' ': break; + case '1': { unsigned char x = STBIW_UCHAR(va_arg(v, int)); + s->func(s->context,&x,1); + break; } + case '2': { int x = va_arg(v,int); + unsigned char b[2]; + b[0] = STBIW_UCHAR(x); + b[1] = STBIW_UCHAR(x>>8); + s->func(s->context,b,2); + break; } + case '4': { stbiw_uint32 x = va_arg(v,int); + unsigned char b[4]; + b[0]=STBIW_UCHAR(x); + b[1]=STBIW_UCHAR(x>>8); + b[2]=STBIW_UCHAR(x>>16); + b[3]=STBIW_UCHAR(x>>24); + s->func(s->context,b,4); + break; } + default: + STBIW_ASSERT(0); + return; + } + } +} + +static void stbiw__writef(stbi__write_context *s, const char *fmt, ...) +{ + va_list v; + va_start(v, fmt); + stbiw__writefv(s, fmt, v); + va_end(v); +} + +static void stbiw__putc(stbi__write_context *s, unsigned char c) +{ + s->func(s->context, &c, 1); +} + +static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c) +{ + unsigned char arr[3]; + arr[0] = a; arr[1] = b; arr[2] = c; + s->func(s->context, arr, 3); +} + +static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, int write_alpha, int expand_mono, unsigned char *d) +{ + unsigned char bg[3] = { 255, 0, 255}, px[3]; + int k; + + if (write_alpha < 0) + s->func(s->context, &d[comp - 1], 1); + + switch (comp) { + case 2: // 2 pixels = mono + alpha, alpha is written separately, so same as 1-channel case + case 1: + if (expand_mono) + stbiw__write3(s, d[0], d[0], d[0]); // monochrome bmp + else + s->func(s->context, d, 1); // monochrome TGA + break; + case 4: + if (!write_alpha) { + // composite against pink background + for (k = 0; k < 3; ++k) + px[k] = bg[k] + ((d[k] - bg[k]) * d[3]) / 255; + stbiw__write3(s, px[1 - rgb_dir], px[1], px[1 + rgb_dir]); + break; + } + /* FALLTHROUGH */ + case 3: + stbiw__write3(s, d[1 - rgb_dir], d[1], d[1 + rgb_dir]); + break; + } + if (write_alpha > 0) + s->func(s->context, &d[comp - 1], 1); +} + +static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad, int expand_mono) +{ + stbiw_uint32 zero = 0; + int i,j, j_end; + + if (y <= 0) + return; + + if (stbi__flip_vertically_on_write) + vdir *= -1; + + if (vdir < 0) { + j_end = -1; j = y-1; + } else { + j_end = y; j = 0; + } + + for (; j != j_end; j += vdir) { + for (i=0; i < x; ++i) { + unsigned char *d = (unsigned char *) data + (j*x+i)*comp; + stbiw__write_pixel(s, rgb_dir, comp, write_alpha, expand_mono, d); + } + s->func(s->context, &zero, scanline_pad); + } +} + +static int stbiw__outfile(stbi__write_context *s, int rgb_dir, int vdir, int x, int y, int comp, int expand_mono, void *data, int alpha, int pad, const char *fmt, ...) +{ + if (y < 0 || x < 0) { + return 0; + } else { + va_list v; + va_start(v, fmt); + stbiw__writefv(s, fmt, v); + va_end(v); + stbiw__write_pixels(s,rgb_dir,vdir,x,y,comp,data,alpha,pad, expand_mono); + return 1; + } +} + +static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, const void *data) +{ + int pad = (-x*3) & 3; + return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad, + "11 4 22 4" "4 44 22 444444", + 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header + 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header +} + +STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) +{ + stbi__write_context s; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_bmp_core(&s, x, y, comp, data); +} + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data) +{ + stbi__write_context s; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_bmp_core(&s, x, y, comp, data); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif //!STBI_WRITE_NO_STDIO + +static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, void *data) +{ + int has_alpha = (comp == 2 || comp == 4); + int colorbytes = has_alpha ? comp-1 : comp; + int format = colorbytes < 2 ? 3 : 2; // 3 color channels (RGB/RGBA) = 2, 1 color channel (Y/YA) = 3 + + if (y < 0 || x < 0) + return 0; + + if (!stbi_write_tga_with_rle) { + return stbiw__outfile(s, -1, -1, x, y, comp, 0, (void *) data, has_alpha, 0, + "111 221 2222 11", 0, 0, format, 0, 0, 0, 0, 0, x, y, (colorbytes + has_alpha) * 8, has_alpha * 8); + } else { + int i,j,k; + int jend, jdir; + + stbiw__writef(s, "111 221 2222 11", 0,0,format+8, 0,0,0, 0,0,x,y, (colorbytes + has_alpha) * 8, has_alpha * 8); + + if (stbi__flip_vertically_on_write) { + j = 0; + jend = y; + jdir = 1; + } else { + j = y-1; + jend = -1; + jdir = -1; + } + for (; j != jend; j += jdir) { + unsigned char *row = (unsigned char *) data + j * x * comp; + int len; + + for (i = 0; i < x; i += len) { + unsigned char *begin = row + i * comp; + int diff = 1; + len = 1; + + if (i < x - 1) { + ++len; + diff = memcmp(begin, row + (i + 1) * comp, comp); + if (diff) { + const unsigned char *prev = begin; + for (k = i + 2; k < x && len < 128; ++k) { + if (memcmp(prev, row + k * comp, comp)) { + prev += comp; + ++len; + } else { + --len; + break; + } + } + } else { + for (k = i + 2; k < x && len < 128; ++k) { + if (!memcmp(begin, row + k * comp, comp)) { + ++len; + } else { + break; + } + } + } + } + + if (diff) { + unsigned char header = STBIW_UCHAR(len - 1); + s->func(s->context, &header, 1); + for (k = 0; k < len; ++k) { + stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin + k * comp); + } + } else { + unsigned char header = STBIW_UCHAR(len - 129); + s->func(s->context, &header, 1); + stbiw__write_pixel(s, -1, comp, has_alpha, 0, begin); + } + } + } + } + return 1; +} + +STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data) +{ + stbi__write_context s; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_tga_core(&s, x, y, comp, (void *) data); +} + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data) +{ + stbi__write_context s; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_tga_core(&s, x, y, comp, (void *) data); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif + +// ************************************************************************************************* +// Radiance RGBE HDR writer +// by Baldur Karlsson + +#define stbiw__max(a, b) ((a) > (b) ? (a) : (b)) + +static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear) +{ + int exponent; + float maxcomp = stbiw__max(linear[0], stbiw__max(linear[1], linear[2])); + + if (maxcomp < 1e-32f) { + rgbe[0] = rgbe[1] = rgbe[2] = rgbe[3] = 0; + } else { + float normalize = (float) frexp(maxcomp, &exponent) * 256.0f/maxcomp; + + rgbe[0] = (unsigned char)(linear[0] * normalize); + rgbe[1] = (unsigned char)(linear[1] * normalize); + rgbe[2] = (unsigned char)(linear[2] * normalize); + rgbe[3] = (unsigned char)(exponent + 128); + } +} + +static void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte) +{ + unsigned char lengthbyte = STBIW_UCHAR(length+128); + STBIW_ASSERT(length+128 <= 255); + s->func(s->context, &lengthbyte, 1); + s->func(s->context, &databyte, 1); +} + +static void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *data) +{ + unsigned char lengthbyte = STBIW_UCHAR(length); + STBIW_ASSERT(length <= 128); // inconsistent with spec but consistent with official code + s->func(s->context, &lengthbyte, 1); + s->func(s->context, data, length); +} + +static void stbiw__write_hdr_scanline(stbi__write_context *s, int width, int ncomp, unsigned char *scratch, float *scanline) +{ + unsigned char scanlineheader[4] = { 2, 2, 0, 0 }; + unsigned char rgbe[4]; + float linear[3]; + int x; + + scanlineheader[2] = (width&0xff00)>>8; + scanlineheader[3] = (width&0x00ff); + + /* skip RLE for images too small or large */ + if (width < 8 || width >= 32768) { + for (x=0; x < width; x++) { + switch (ncomp) { + case 4: /* fallthrough */ + case 3: linear[2] = scanline[x*ncomp + 2]; + linear[1] = scanline[x*ncomp + 1]; + linear[0] = scanline[x*ncomp + 0]; + break; + default: + linear[0] = linear[1] = linear[2] = scanline[x*ncomp + 0]; + break; + } + stbiw__linear_to_rgbe(rgbe, linear); + s->func(s->context, rgbe, 4); + } + } else { + int c,r; + /* encode into scratch buffer */ + for (x=0; x < width; x++) { + switch(ncomp) { + case 4: /* fallthrough */ + case 3: linear[2] = scanline[x*ncomp + 2]; + linear[1] = scanline[x*ncomp + 1]; + linear[0] = scanline[x*ncomp + 0]; + break; + default: + linear[0] = linear[1] = linear[2] = scanline[x*ncomp + 0]; + break; + } + stbiw__linear_to_rgbe(rgbe, linear); + scratch[x + width*0] = rgbe[0]; + scratch[x + width*1] = rgbe[1]; + scratch[x + width*2] = rgbe[2]; + scratch[x + width*3] = rgbe[3]; + } + + s->func(s->context, scanlineheader, 4); + + /* RLE each component separately */ + for (c=0; c < 4; c++) { + unsigned char *comp = &scratch[width*c]; + + x = 0; + while (x < width) { + // find first run + r = x; + while (r+2 < width) { + if (comp[r] == comp[r+1] && comp[r] == comp[r+2]) + break; + ++r; + } + if (r+2 >= width) + r = width; + // dump up to first run + while (x < r) { + int len = r-x; + if (len > 128) len = 128; + stbiw__write_dump_data(s, len, &comp[x]); + x += len; + } + // if there's a run, output it + if (r+2 < width) { // same test as what we break out of in search loop, so only true if we break'd + // find next byte after run + while (r < width && comp[r] == comp[x]) + ++r; + // output run up to r + while (x < r) { + int len = r-x; + if (len > 127) len = 127; + stbiw__write_run_data(s, len, comp[x]); + x += len; + } + } + } + } + } +} + +static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, float *data) +{ + if (y <= 0 || x <= 0 || data == NULL) + return 0; + else { + // Each component is stored separately. Allocate scratch space for full output scanline. + unsigned char *scratch = (unsigned char *) STBIW_MALLOC(x*4); + int i, len; + char buffer[128]; + char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n"; + s->func(s->context, header, sizeof(header)-1); + +#ifdef __STDC_WANT_SECURE_LIB__ + len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); +#else + len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); +#endif + s->func(s->context, buffer, len); + + for(i=0; i < y; i++) + stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*x*(stbi__flip_vertically_on_write ? y-1-i : i)); + STBIW_FREE(scratch); + return 1; + } +} + +STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data) +{ + stbi__write_context s; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_hdr_core(&s, x, y, comp, (float *) data); +} + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data) +{ + stbi__write_context s; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_hdr_core(&s, x, y, comp, (float *) data); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif // STBI_WRITE_NO_STDIO + + +////////////////////////////////////////////////////////////////////////////// +// +// PNG writer +// + +#ifndef STBIW_ZLIB_COMPRESS +// stretchy buffer; stbiw__sbpush() == vector<>::push_back() -- stbiw__sbcount() == vector<>::size() +#define stbiw__sbraw(a) ((int *) (a) - 2) +#define stbiw__sbm(a) stbiw__sbraw(a)[0] +#define stbiw__sbn(a) stbiw__sbraw(a)[1] + +#define stbiw__sbneedgrow(a,n) ((a)==0 || stbiw__sbn(a)+n >= stbiw__sbm(a)) +#define stbiw__sbmaybegrow(a,n) (stbiw__sbneedgrow(a,(n)) ? stbiw__sbgrow(a,n) : 0) +#define stbiw__sbgrow(a,n) stbiw__sbgrowf((void **) &(a), (n), sizeof(*(a))) + +#define stbiw__sbpush(a, v) (stbiw__sbmaybegrow(a,1), (a)[stbiw__sbn(a)++] = (v)) +#define stbiw__sbcount(a) ((a) ? stbiw__sbn(a) : 0) +#define stbiw__sbfree(a) ((a) ? STBIW_FREE(stbiw__sbraw(a)),0 : 0) + +static void *stbiw__sbgrowf(void **arr, int increment, int itemsize) +{ + int m = *arr ? 2*stbiw__sbm(*arr)+increment : increment+1; + void *p = STBIW_REALLOC_SIZED(*arr ? stbiw__sbraw(*arr) : 0, *arr ? (stbiw__sbm(*arr)*itemsize + sizeof(int)*2) : 0, itemsize * m + sizeof(int)*2); + STBIW_ASSERT(p); + if (p) { + if (!*arr) ((int *) p)[1] = 0; + *arr = (void *) ((int *) p + 2); + stbiw__sbm(*arr) = m; + } + return *arr; +} + +static unsigned char *stbiw__zlib_flushf(unsigned char *data, unsigned int *bitbuffer, int *bitcount) +{ + while (*bitcount >= 8) { + stbiw__sbpush(data, STBIW_UCHAR(*bitbuffer)); + *bitbuffer >>= 8; + *bitcount -= 8; + } + return data; +} + +static int stbiw__zlib_bitrev(int code, int codebits) +{ + int res=0; + while (codebits--) { + res = (res << 1) | (code & 1); + code >>= 1; + } + return res; +} + +static unsigned int stbiw__zlib_countm(unsigned char *a, unsigned char *b, int limit) +{ + int i; + for (i=0; i < limit && i < 258; ++i) + if (a[i] != b[i]) break; + return i; +} + +static unsigned int stbiw__zhash(unsigned char *data) +{ + stbiw_uint32 hash = data[0] + (data[1] << 8) + (data[2] << 16); + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 4; + hash += hash >> 17; + hash ^= hash << 25; + hash += hash >> 6; + return hash; +} + +#define stbiw__zlib_flush() (out = stbiw__zlib_flushf(out, &bitbuf, &bitcount)) +#define stbiw__zlib_add(code,codebits) \ + (bitbuf |= (code) << bitcount, bitcount += (codebits), stbiw__zlib_flush()) +#define stbiw__zlib_huffa(b,c) stbiw__zlib_add(stbiw__zlib_bitrev(b,c),c) +// default huffman tables +#define stbiw__zlib_huff1(n) stbiw__zlib_huffa(0x30 + (n), 8) +#define stbiw__zlib_huff2(n) stbiw__zlib_huffa(0x190 + (n)-144, 9) +#define stbiw__zlib_huff3(n) stbiw__zlib_huffa(0 + (n)-256,7) +#define stbiw__zlib_huff4(n) stbiw__zlib_huffa(0xc0 + (n)-280,8) +#define stbiw__zlib_huff(n) ((n) <= 143 ? stbiw__zlib_huff1(n) : (n) <= 255 ? stbiw__zlib_huff2(n) : (n) <= 279 ? stbiw__zlib_huff3(n) : stbiw__zlib_huff4(n)) +#define stbiw__zlib_huffb(n) ((n) <= 143 ? stbiw__zlib_huff1(n) : stbiw__zlib_huff2(n)) + +#define stbiw__ZHASH 16384 + +#endif // STBIW_ZLIB_COMPRESS + +STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_len, int quality) +{ +#ifdef STBIW_ZLIB_COMPRESS + // user provided a zlib compress implementation, use that + return STBIW_ZLIB_COMPRESS(data, data_len, out_len, quality); +#else // use builtin + static unsigned short lengthc[] = { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258, 259 }; + static unsigned char lengtheb[]= { 0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 }; + static unsigned short distc[] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 32768 }; + static unsigned char disteb[] = { 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13 }; + unsigned int bitbuf=0; + int i,j, bitcount=0; + unsigned char *out = NULL; + unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(char**)); + if (hash_table == NULL) + return NULL; + if (quality < 5) quality = 5; + + stbiw__sbpush(out, 0x78); // DEFLATE 32K window + stbiw__sbpush(out, 0x5e); // FLEVEL = 1 + stbiw__zlib_add(1,1); // BFINAL = 1 + stbiw__zlib_add(1,2); // BTYPE = 1 -- fixed huffman + + for (i=0; i < stbiw__ZHASH; ++i) + hash_table[i] = NULL; + + i=0; + while (i < data_len-3) { + // hash next 3 bytes of data to be compressed + int h = stbiw__zhash(data+i)&(stbiw__ZHASH-1), best=3; + unsigned char *bestloc = 0; + unsigned char **hlist = hash_table[h]; + int n = stbiw__sbcount(hlist); + for (j=0; j < n; ++j) { + if (hlist[j]-data > i-32768) { // if entry lies within window + int d = stbiw__zlib_countm(hlist[j], data+i, data_len-i); + if (d >= best) { best=d; bestloc=hlist[j]; } + } + } + // when hash table entry is too long, delete half the entries + if (hash_table[h] && stbiw__sbn(hash_table[h]) == 2*quality) { + STBIW_MEMMOVE(hash_table[h], hash_table[h]+quality, sizeof(hash_table[h][0])*quality); + stbiw__sbn(hash_table[h]) = quality; + } + stbiw__sbpush(hash_table[h],data+i); + + if (bestloc) { + // "lazy matching" - check match at *next* byte, and if it's better, do cur byte as literal + h = stbiw__zhash(data+i+1)&(stbiw__ZHASH-1); + hlist = hash_table[h]; + n = stbiw__sbcount(hlist); + for (j=0; j < n; ++j) { + if (hlist[j]-data > i-32767) { + int e = stbiw__zlib_countm(hlist[j], data+i+1, data_len-i-1); + if (e > best) { // if next match is better, bail on current match + bestloc = NULL; + break; + } + } + } + } + + if (bestloc) { + int d = (int) (data+i - bestloc); // distance back + STBIW_ASSERT(d <= 32767 && best <= 258); + for (j=0; best > lengthc[j+1]-1; ++j); + stbiw__zlib_huff(j+257); + if (lengtheb[j]) stbiw__zlib_add(best - lengthc[j], lengtheb[j]); + for (j=0; d > distc[j+1]-1; ++j); + stbiw__zlib_add(stbiw__zlib_bitrev(j,5),5); + if (disteb[j]) stbiw__zlib_add(d - distc[j], disteb[j]); + i += best; + } else { + stbiw__zlib_huffb(data[i]); + ++i; + } + } + // write out final bytes + for (;i < data_len; ++i) + stbiw__zlib_huffb(data[i]); + stbiw__zlib_huff(256); // end of block + // pad with 0 bits to byte boundary + while (bitcount) + stbiw__zlib_add(0,1); + + for (i=0; i < stbiw__ZHASH; ++i) + (void) stbiw__sbfree(hash_table[i]); + STBIW_FREE(hash_table); + + { + // compute adler32 on input + unsigned int s1=1, s2=0; + int blocklen = (int) (data_len % 5552); + j=0; + while (j < data_len) { + for (i=0; i < blocklen; ++i) { s1 += data[j+i]; s2 += s1; } + s1 %= 65521; s2 %= 65521; + j += blocklen; + blocklen = 5552; + } + stbiw__sbpush(out, STBIW_UCHAR(s2 >> 8)); + stbiw__sbpush(out, STBIW_UCHAR(s2)); + stbiw__sbpush(out, STBIW_UCHAR(s1 >> 8)); + stbiw__sbpush(out, STBIW_UCHAR(s1)); + } + *out_len = stbiw__sbn(out); + // make returned pointer freeable + STBIW_MEMMOVE(stbiw__sbraw(out), out, *out_len); + return (unsigned char *) stbiw__sbraw(out); +#endif // STBIW_ZLIB_COMPRESS +} + +static unsigned int stbiw__crc32(unsigned char *buffer, int len) +{ +#ifdef STBIW_CRC32 + return STBIW_CRC32(buffer, len); +#else + static unsigned int crc_table[256] = + { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0eDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D + }; + + unsigned int crc = ~0u; + int i; + for (i=0; i < len; ++i) + crc = (crc >> 8) ^ crc_table[buffer[i] ^ (crc & 0xff)]; + return ~crc; +#endif +} + +#define stbiw__wpng4(o,a,b,c,d) ((o)[0]=STBIW_UCHAR(a),(o)[1]=STBIW_UCHAR(b),(o)[2]=STBIW_UCHAR(c),(o)[3]=STBIW_UCHAR(d),(o)+=4) +#define stbiw__wp32(data,v) stbiw__wpng4(data, (v)>>24,(v)>>16,(v)>>8,(v)); +#define stbiw__wptag(data,s) stbiw__wpng4(data, s[0],s[1],s[2],s[3]) + +static void stbiw__wpcrc(unsigned char **data, int len) +{ + unsigned int crc = stbiw__crc32(*data - len - 4, len+4); + stbiw__wp32(*data, crc); +} + +static unsigned char stbiw__paeth(int a, int b, int c) +{ + int p = a + b - c, pa = abs(p-a), pb = abs(p-b), pc = abs(p-c); + if (pa <= pb && pa <= pc) return STBIW_UCHAR(a); + if (pb <= pc) return STBIW_UCHAR(b); + return STBIW_UCHAR(c); +} + +// @OPTIMIZE: provide an option that always forces left-predict or paeth predict +static void stbiw__encode_png_line(unsigned char *pixels, int stride_bytes, int width, int height, int y, int n, int filter_type, signed char *line_buffer) +{ + static int mapping[] = { 0,1,2,3,4 }; + static int firstmap[] = { 0,1,0,5,6 }; + int *mymap = (y != 0) ? mapping : firstmap; + int i; + int type = mymap[filter_type]; + unsigned char *z = pixels + stride_bytes * (stbi__flip_vertically_on_write ? height-1-y : y); + int signed_stride = stbi__flip_vertically_on_write ? -stride_bytes : stride_bytes; + + if (type==0) { + memcpy(line_buffer, z, width*n); + return; + } + + // first loop isn't optimized since it's just one pixel + for (i = 0; i < n; ++i) { + switch (type) { + case 1: line_buffer[i] = z[i]; break; + case 2: line_buffer[i] = z[i] - z[i-signed_stride]; break; + case 3: line_buffer[i] = z[i] - (z[i-signed_stride]>>1); break; + case 4: line_buffer[i] = (signed char) (z[i] - stbiw__paeth(0,z[i-signed_stride],0)); break; + case 5: line_buffer[i] = z[i]; break; + case 6: line_buffer[i] = z[i]; break; + } + } + switch (type) { + case 1: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - z[i-n]; break; + case 2: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - z[i-signed_stride]; break; + case 3: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - ((z[i-n] + z[i-signed_stride])>>1); break; + case 4: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - stbiw__paeth(z[i-n], z[i-signed_stride], z[i-signed_stride-n]); break; + case 5: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - (z[i-n]>>1); break; + case 6: for (i=n; i < width*n; ++i) line_buffer[i] = z[i] - stbiw__paeth(z[i-n], 0,0); break; + } +} + +STBIWDEF unsigned char *stbi_write_png_to_mem(const unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len) +{ + int force_filter = stbi_write_force_png_filter; + int ctype[5] = { -1, 0, 4, 2, 6 }; + unsigned char sig[8] = { 137,80,78,71,13,10,26,10 }; + unsigned char *out,*o, *filt, *zlib; + signed char *line_buffer; + int j,zlen; + + if (stride_bytes == 0) + stride_bytes = x * n; + + if (force_filter >= 5) { + force_filter = -1; + } + + filt = (unsigned char *) STBIW_MALLOC((x*n+1) * y); if (!filt) return 0; + line_buffer = (signed char *) STBIW_MALLOC(x * n); if (!line_buffer) { STBIW_FREE(filt); return 0; } + for (j=0; j < y; ++j) { + int filter_type; + if (force_filter > -1) { + filter_type = force_filter; + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, force_filter, line_buffer); + } else { // Estimate the best filter by running through all of them: + int best_filter = 0, best_filter_val = 0x7fffffff, est, i; + for (filter_type = 0; filter_type < 5; filter_type++) { + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, filter_type, line_buffer); + + // Estimate the entropy of the line using this filter; the less, the better. + est = 0; + for (i = 0; i < x*n; ++i) { + est += abs((signed char) line_buffer[i]); + } + if (est < best_filter_val) { + best_filter_val = est; + best_filter = filter_type; + } + } + if (filter_type != best_filter) { // If the last iteration already got us the best filter, don't redo it + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, best_filter, line_buffer); + filter_type = best_filter; + } + } + // when we get here, filter_type contains the filter type, and line_buffer contains the data + filt[j*(x*n+1)] = (unsigned char) filter_type; + STBIW_MEMMOVE(filt+j*(x*n+1)+1, line_buffer, x*n); + } + STBIW_FREE(line_buffer); + zlib = stbi_zlib_compress(filt, y*( x*n+1), &zlen, stbi_write_png_compression_level); + STBIW_FREE(filt); + if (!zlib) return 0; + + // each tag requires 12 bytes of overhead + out = (unsigned char *) STBIW_MALLOC(8 + 12+13 + 12+zlen + 12); + if (!out) return 0; + *out_len = 8 + 12+13 + 12+zlen + 12; + + o=out; + STBIW_MEMMOVE(o,sig,8); o+= 8; + stbiw__wp32(o, 13); // header length + stbiw__wptag(o, "IHDR"); + stbiw__wp32(o, x); + stbiw__wp32(o, y); + *o++ = 8; + *o++ = STBIW_UCHAR(ctype[n]); + *o++ = 0; + *o++ = 0; + *o++ = 0; + stbiw__wpcrc(&o,13); + + stbiw__wp32(o, zlen); + stbiw__wptag(o, "IDAT"); + STBIW_MEMMOVE(o, zlib, zlen); + o += zlen; + STBIW_FREE(zlib); + stbiw__wpcrc(&o, zlen); + + stbiw__wp32(o,0); + stbiw__wptag(o, "IEND"); + stbiw__wpcrc(&o,0); + + STBIW_ASSERT(o == out + *out_len); + + return out; +} + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const void *data, int stride_bytes) +{ + FILE *f; + int len; + unsigned char *png = stbi_write_png_to_mem((const unsigned char *) data, stride_bytes, x, y, comp, &len); + if (png == NULL) return 0; + + f = stbiw__fopen(filename, "wb"); + if (!f) { STBIW_FREE(png); return 0; } + fwrite(png, 1, len, f); + fclose(f); + STBIW_FREE(png); + return 1; +} +#endif + +STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int stride_bytes) +{ + int len; + unsigned char *png = stbi_write_png_to_mem((const unsigned char *) data, stride_bytes, x, y, comp, &len); + if (png == NULL) return 0; + func(context, png, len); + STBIW_FREE(png); + return 1; +} + + +/* *************************************************************************** + * + * JPEG writer + * + * This is based on Jon Olick's jo_jpeg.cpp: + * public domain Simple, Minimalistic JPEG writer - http://www.jonolick.com/code.html + */ + +static const unsigned char stbiw__jpg_ZigZag[] = { 0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18, + 24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63 }; + +static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, int *bitCntP, const unsigned short *bs) { + int bitBuf = *bitBufP, bitCnt = *bitCntP; + bitCnt += bs[1]; + bitBuf |= bs[0] << (24 - bitCnt); + while(bitCnt >= 8) { + unsigned char c = (bitBuf >> 16) & 255; + stbiw__putc(s, c); + if(c == 255) { + stbiw__putc(s, 0); + } + bitBuf <<= 8; + bitCnt -= 8; + } + *bitBufP = bitBuf; + *bitCntP = bitCnt; +} + +static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float *d4p, float *d5p, float *d6p, float *d7p) { + float d0 = *d0p, d1 = *d1p, d2 = *d2p, d3 = *d3p, d4 = *d4p, d5 = *d5p, d6 = *d6p, d7 = *d7p; + float z1, z2, z3, z4, z5, z11, z13; + + float tmp0 = d0 + d7; + float tmp7 = d0 - d7; + float tmp1 = d1 + d6; + float tmp6 = d1 - d6; + float tmp2 = d2 + d5; + float tmp5 = d2 - d5; + float tmp3 = d3 + d4; + float tmp4 = d3 - d4; + + // Even part + float tmp10 = tmp0 + tmp3; // phase 2 + float tmp13 = tmp0 - tmp3; + float tmp11 = tmp1 + tmp2; + float tmp12 = tmp1 - tmp2; + + d0 = tmp10 + tmp11; // phase 3 + d4 = tmp10 - tmp11; + + z1 = (tmp12 + tmp13) * 0.707106781f; // c4 + d2 = tmp13 + z1; // phase 5 + d6 = tmp13 - z1; + + // Odd part + tmp10 = tmp4 + tmp5; // phase 2 + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + // The rotator is modified from fig 4-8 to avoid extra negations. + z5 = (tmp10 - tmp12) * 0.382683433f; // c6 + z2 = tmp10 * 0.541196100f + z5; // c2-c6 + z4 = tmp12 * 1.306562965f + z5; // c2+c6 + z3 = tmp11 * 0.707106781f; // c4 + + z11 = tmp7 + z3; // phase 5 + z13 = tmp7 - z3; + + *d5p = z13 + z2; // phase 6 + *d3p = z13 - z2; + *d1p = z11 + z4; + *d7p = z11 - z4; + + *d0p = d0; *d2p = d2; *d4p = d4; *d6p = d6; +} + +static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) { + int tmp1 = val < 0 ? -val : val; + val = val < 0 ? val-1 : val; + bits[1] = 1; + while(tmp1 >>= 1) { + ++bits[1]; + } + bits[0] = val & ((1<<bits[1])-1); +} + +static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt, float *CDU, float *fdtbl, int DC, const unsigned short HTDC[256][2], const unsigned short HTAC[256][2]) { + const unsigned short EOB[2] = { HTAC[0x00][0], HTAC[0x00][1] }; + const unsigned short M16zeroes[2] = { HTAC[0xF0][0], HTAC[0xF0][1] }; + int dataOff, i, diff, end0pos; + int DU[64]; + + // DCT rows + for(dataOff=0; dataOff<64; dataOff+=8) { + stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+1], &CDU[dataOff+2], &CDU[dataOff+3], &CDU[dataOff+4], &CDU[dataOff+5], &CDU[dataOff+6], &CDU[dataOff+7]); + } + // DCT columns + for(dataOff=0; dataOff<8; ++dataOff) { + stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+8], &CDU[dataOff+16], &CDU[dataOff+24], &CDU[dataOff+32], &CDU[dataOff+40], &CDU[dataOff+48], &CDU[dataOff+56]); + } + // Quantize/descale/zigzag the coefficients + for(i=0; i<64; ++i) { + float v = CDU[i]*fdtbl[i]; + // DU[stbiw__jpg_ZigZag[i]] = (int)(v < 0 ? ceilf(v - 0.5f) : floorf(v + 0.5f)); + // ceilf() and floorf() are C99, not C89, but I /think/ they're not needed here anyway? + DU[stbiw__jpg_ZigZag[i]] = (int)(v < 0 ? v - 0.5f : v + 0.5f); + } + + // Encode DC + diff = DU[0] - DC; + if (diff == 0) { + stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[0]); + } else { + unsigned short bits[2]; + stbiw__jpg_calcBits(diff, bits); + stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[bits[1]]); + stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits); + } + // Encode ACs + end0pos = 63; + for(; (end0pos>0)&&(DU[end0pos]==0); --end0pos) { + } + // end0pos = first element in reverse order !=0 + if(end0pos == 0) { + stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB); + return DU[0]; + } + for(i = 1; i <= end0pos; ++i) { + int startpos = i; + int nrzeroes; + unsigned short bits[2]; + for (; DU[i]==0 && i<=end0pos; ++i) { + } + nrzeroes = i-startpos; + if ( nrzeroes >= 16 ) { + int lng = nrzeroes>>4; + int nrmarker; + for (nrmarker=1; nrmarker <= lng; ++nrmarker) + stbiw__jpg_writeBits(s, bitBuf, bitCnt, M16zeroes); + nrzeroes &= 15; + } + stbiw__jpg_calcBits(DU[i], bits); + stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTAC[(nrzeroes<<4)+bits[1]]); + stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits); + } + if(end0pos != 63) { + stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB); + } + return DU[0]; +} + +static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, int comp, const void* data, int quality) { + // Constants that don't pollute global namespace + static const unsigned char std_dc_luminance_nrcodes[] = {0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0}; + static const unsigned char std_dc_luminance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; + static const unsigned char std_ac_luminance_nrcodes[] = {0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d}; + static const unsigned char std_ac_luminance_values[] = { + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa + }; + static const unsigned char std_dc_chrominance_nrcodes[] = {0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0}; + static const unsigned char std_dc_chrominance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11}; + static const unsigned char std_ac_chrominance_nrcodes[] = {0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77}; + static const unsigned char std_ac_chrominance_values[] = { + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa + }; + // Huffman tables + static const unsigned short YDC_HT[256][2] = { {0,2},{2,3},{3,3},{4,3},{5,3},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9}}; + static const unsigned short UVDC_HT[256][2] = { {0,2},{1,2},{2,2},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9},{1022,10},{2046,11}}; + static const unsigned short YAC_HT[256][2] = { + {10,4},{0,2},{1,2},{4,3},{11,4},{26,5},{120,7},{248,8},{1014,10},{65410,16},{65411,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {12,4},{27,5},{121,7},{502,9},{2038,11},{65412,16},{65413,16},{65414,16},{65415,16},{65416,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {28,5},{249,8},{1015,10},{4084,12},{65417,16},{65418,16},{65419,16},{65420,16},{65421,16},{65422,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {58,6},{503,9},{4085,12},{65423,16},{65424,16},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {59,6},{1016,10},{65430,16},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {122,7},{2039,11},{65438,16},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {123,7},{4086,12},{65446,16},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {250,8},{4087,12},{65454,16},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {504,9},{32704,15},{65462,16},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {505,9},{65470,16},{65471,16},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {506,9},{65479,16},{65480,16},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1017,10},{65488,16},{65489,16},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1018,10},{65497,16},{65498,16},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2040,11},{65506,16},{65507,16},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {65515,16},{65516,16},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2041,11},{65525,16},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0} + }; + static const unsigned short UVAC_HT[256][2] = { + {0,2},{1,2},{4,3},{10,4},{24,5},{25,5},{56,6},{120,7},{500,9},{1014,10},{4084,12},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {11,4},{57,6},{246,8},{501,9},{2038,11},{4085,12},{65416,16},{65417,16},{65418,16},{65419,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {26,5},{247,8},{1015,10},{4086,12},{32706,15},{65420,16},{65421,16},{65422,16},{65423,16},{65424,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {27,5},{248,8},{1016,10},{4087,12},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{65430,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {58,6},{502,9},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{65438,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {59,6},{1017,10},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{65446,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {121,7},{2039,11},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{65454,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {122,7},{2040,11},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{65462,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {249,8},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{65470,16},{65471,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {503,9},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{65479,16},{65480,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {504,9},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{65488,16},{65489,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {505,9},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{65497,16},{65498,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {506,9},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{65506,16},{65507,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {2041,11},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{65515,16},{65516,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, + {16352,14},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{65525,16},{0,0},{0,0},{0,0},{0,0},{0,0}, + {1018,10},{32707,15},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0} + }; + static const int YQT[] = {16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22, + 37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99}; + static const int UVQT[] = {17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99, + 99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99}; + static const float aasf[] = { 1.0f * 2.828427125f, 1.387039845f * 2.828427125f, 1.306562965f * 2.828427125f, 1.175875602f * 2.828427125f, + 1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f }; + + int row, col, i, k; + float fdtbl_Y[64], fdtbl_UV[64]; + unsigned char YTable[64], UVTable[64]; + + if(!data || !width || !height || comp > 4 || comp < 1) { + return 0; + } + + quality = quality ? quality : 90; + quality = quality < 1 ? 1 : quality > 100 ? 100 : quality; + quality = quality < 50 ? 5000 / quality : 200 - quality * 2; + + for(i = 0; i < 64; ++i) { + int uvti, yti = (YQT[i]*quality+50)/100; + YTable[stbiw__jpg_ZigZag[i]] = (unsigned char) (yti < 1 ? 1 : yti > 255 ? 255 : yti); + uvti = (UVQT[i]*quality+50)/100; + UVTable[stbiw__jpg_ZigZag[i]] = (unsigned char) (uvti < 1 ? 1 : uvti > 255 ? 255 : uvti); + } + + for(row = 0, k = 0; row < 8; ++row) { + for(col = 0; col < 8; ++col, ++k) { + fdtbl_Y[k] = 1 / (YTable [stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]); + fdtbl_UV[k] = 1 / (UVTable[stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]); + } + } + + // Write Headers + { + static const unsigned char head0[] = { 0xFF,0xD8,0xFF,0xE0,0,0x10,'J','F','I','F',0,1,1,0,0,1,0,1,0,0,0xFF,0xDB,0,0x84,0 }; + static const unsigned char head2[] = { 0xFF,0xDA,0,0xC,3,1,0,2,0x11,3,0x11,0,0x3F,0 }; + const unsigned char head1[] = { 0xFF,0xC0,0,0x11,8,(unsigned char)(height>>8),STBIW_UCHAR(height),(unsigned char)(width>>8),STBIW_UCHAR(width), + 3,1,0x11,0,2,0x11,1,3,0x11,1,0xFF,0xC4,0x01,0xA2,0 }; + s->func(s->context, (void*)head0, sizeof(head0)); + s->func(s->context, (void*)YTable, sizeof(YTable)); + stbiw__putc(s, 1); + s->func(s->context, UVTable, sizeof(UVTable)); + s->func(s->context, (void*)head1, sizeof(head1)); + s->func(s->context, (void*)(std_dc_luminance_nrcodes+1), sizeof(std_dc_luminance_nrcodes)-1); + s->func(s->context, (void*)std_dc_luminance_values, sizeof(std_dc_luminance_values)); + stbiw__putc(s, 0x10); // HTYACinfo + s->func(s->context, (void*)(std_ac_luminance_nrcodes+1), sizeof(std_ac_luminance_nrcodes)-1); + s->func(s->context, (void*)std_ac_luminance_values, sizeof(std_ac_luminance_values)); + stbiw__putc(s, 1); // HTUDCinfo + s->func(s->context, (void*)(std_dc_chrominance_nrcodes+1), sizeof(std_dc_chrominance_nrcodes)-1); + s->func(s->context, (void*)std_dc_chrominance_values, sizeof(std_dc_chrominance_values)); + stbiw__putc(s, 0x11); // HTUACinfo + s->func(s->context, (void*)(std_ac_chrominance_nrcodes+1), sizeof(std_ac_chrominance_nrcodes)-1); + s->func(s->context, (void*)std_ac_chrominance_values, sizeof(std_ac_chrominance_values)); + s->func(s->context, (void*)head2, sizeof(head2)); + } + + // Encode 8x8 macroblocks + { + static const unsigned short fillBits[] = {0x7F, 7}; + const unsigned char *imageData = (const unsigned char *)data; + int DCY=0, DCU=0, DCV=0; + int bitBuf=0, bitCnt=0; + // comp == 2 is grey+alpha (alpha is ignored) + int ofsG = comp > 2 ? 1 : 0, ofsB = comp > 2 ? 2 : 0; + int x, y, pos; + for(y = 0; y < height; y += 8) { + for(x = 0; x < width; x += 8) { + float YDU[64], UDU[64], VDU[64]; + for(row = y, pos = 0; row < y+8; ++row) { + // row >= height => use last input row + int clamped_row = (row < height) ? row : height - 1; + int base_p = (stbi__flip_vertically_on_write ? (height-1-clamped_row) : clamped_row)*width*comp; + for(col = x; col < x+8; ++col, ++pos) { + float r, g, b; + // if col >= width => use pixel from last input column + int p = base_p + ((col < width) ? col : (width-1))*comp; + + r = imageData[p+0]; + g = imageData[p+ofsG]; + b = imageData[p+ofsB]; + YDU[pos]=+0.29900f*r+0.58700f*g+0.11400f*b-128; + UDU[pos]=-0.16874f*r-0.33126f*g+0.50000f*b; + VDU[pos]=+0.50000f*r-0.41869f*g-0.08131f*b; + } + } + + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + } + } + + // Do the bit alignment of the EOI marker + stbiw__jpg_writeBits(s, &bitBuf, &bitCnt, fillBits); + } + + // EOI + stbiw__putc(s, 0xFF); + stbiw__putc(s, 0xD9); + + return 1; +} + +STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality) +{ + stbi__write_context s; + stbi__start_write_callbacks(&s, func, context); + return stbi_write_jpg_core(&s, x, y, comp, (void *) data, quality); +} + + +#ifndef STBI_WRITE_NO_STDIO +STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality) +{ + stbi__write_context s; + if (stbi__start_write_file(&s,filename)) { + int r = stbi_write_jpg_core(&s, x, y, comp, data, quality); + stbi__end_write_file(&s); + return r; + } else + return 0; +} +#endif + +#endif // STB_IMAGE_WRITE_IMPLEMENTATION + +/* Revision history + 1.10 (2019-02-07) + support utf8 filenames in Windows; fix warnings and platform ifdefs + 1.09 (2018-02-11) + fix typo in zlib quality API, improve STB_I_W_STATIC in C++ + 1.08 (2018-01-29) + add stbi__flip_vertically_on_write, external zlib, zlib quality, choose PNG filter + 1.07 (2017-07-24) + doc fix + 1.06 (2017-07-23) + writing JPEG (using Jon Olick's code) + 1.05 ??? + 1.04 (2017-03-03) + monochrome BMP expansion + 1.03 ??? + 1.02 (2016-04-02) + avoid allocating large structures on the stack + 1.01 (2016-01-16) + STBIW_REALLOC_SIZED: support allocators with no realloc support + avoid race-condition in crc initialization + minor compile issues + 1.00 (2015-09-14) + installable file IO function + 0.99 (2015-09-13) + warning fixes; TGA rle support + 0.98 (2015-04-08) + added STBIW_MALLOC, STBIW_ASSERT etc + 0.97 (2015-01-18) + fixed HDR asserts, rewrote HDR rle logic + 0.96 (2015-01-17) + add HDR output + fix monochrome BMP + 0.95 (2014-08-17) + add monochrome TGA output + 0.94 (2014-05-31) + rename private functions to avoid conflicts with stb_image.h + 0.93 (2014-05-27) + warning fixes + 0.92 (2010-08-01) + casts to unsigned char to fix warnings + 0.91 (2010-07-17) + first public release + 0.90 first internal release +*/ + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +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. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +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 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/src/include/switch_core_video.h b/src/include/switch_core_video.h index 23d1356b78..4fb7d824c0 100644 --- a/src/include/switch_core_video.h +++ b/src/include/switch_core_video.h @@ -398,7 +398,13 @@ SWITCH_DECLARE(switch_status_t) switch_img_data_url_png(switch_image_t *img, cha /*!\brief Read an image file to switch_image_t */ SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char *file_name, switch_img_fmt_t img_fmt); - +/*!\brief Write an image file, supported formats png,jpg,bmp,tga,hdr +* \param[in] img The image descriptor +* \param[in] file_name The file_name to write +* \param[in] quality Only used in jpg, 0 ~ 100 +*/ +SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality); + /*!\brief put a small img over a big IMG at position x,y, with alpha transparency * * Both IMG and img must be non-NULL diff --git a/src/switch_core_video.c b/src/switch_core_video.c index dcdbe67332..ee44223f64 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -51,6 +51,9 @@ #define STB_IMAGE_IMPLEMENTATION #include "../libs/stb/stb_image.h" +#define STB_IMAGE_WRITE_IMPLEMENTATION +#include "../libs/stb/stb_image_write.h" + #ifdef SWITCH_HAVE_YUV static inline void switch_img_get_yuv_pixel(switch_image_t *img, switch_yuv_color_t *yuv, int x, int y); #endif @@ -3105,7 +3108,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_data_url_png(switch_image_t *img, cha SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name, switch_img_fmt_t img_fmt) { - int width = 0, height = 0, channels = 8; + int width = 0, height = 0, channels = 0; int comp = STBI_rgb; unsigned char *data = NULL; @@ -3148,6 +3151,66 @@ SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name return NULL; } +SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality) +{ + int comp = STBI_rgb; + unsigned char *data = NULL; + const char *ext = strrchr(file_name, '.'); + int stride_in_bytes = 0; + int ret = 0; + + if (!ext) return SWITCH_STATUS_FALSE; + + ext++; + + if (img->fmt == SWITCH_IMG_FMT_I420) { + comp = STBI_rgb; + stride_in_bytes = img->d_w * 3; + + data = malloc(stride_in_bytes * img->d_h); + switch_assert(data); + + I420ToRAW(img->planes[SWITCH_PLANE_Y], img->stride[SWITCH_PLANE_Y], + img->planes[SWITCH_PLANE_U], img->stride[SWITCH_PLANE_U], + img->planes[SWITCH_PLANE_V], img->stride[SWITCH_PLANE_V], + data, stride_in_bytes, + img->d_w, img->d_h); + } else if (img->fmt == SWITCH_IMG_FMT_ARGB) { + comp = STBI_rgb_alpha; + stride_in_bytes = img->d_w * 4; + + data = malloc(stride_in_bytes * img->d_h); + switch_assert(data); + +#if SWITCH_BYTE_ORDER == __BIG_ENDIAN + ARGBToRGBA(img->planes[SWITCH_PLANE_PACKED], stride_in_bytes, data, stride_in_bytes, img->d_w, img->d_h); +#else + ARGBToABGR(img->planes[SWITCH_PLANE_PACKED], stride_in_bytes, data, stride_in_bytes, img->d_w, img->d_h); +#endif + } else { + return SWITCH_STATUS_FALSE; + } + + if (!strcasecmp(ext, "png")) { + ret = stbi_write_png(file_name, img->d_w, img->d_h, comp, (const void *)data, stride_in_bytes); + } else if (!strcasecmp(ext, "jpg") || !strcasecmp(ext, "jpeg")) { + ret = stbi_write_jpg(file_name, img->d_w, img->d_h, comp, (const void *)data, quality); + } else if (!strcasecmp(ext, "bmp")) { + ret = stbi_write_bmp(file_name, img->d_w, img->d_h, comp, (const void *)data); + } else if (!strcasecmp(ext, "tga")) { + ret = stbi_write_tga(file_name, img->d_w, img->d_h, comp, (const void *)data); + } else if (!strcasecmp(ext, "hdr")) { + ret = stbi_write_hdr(file_name, img->d_w, img->d_h, comp, (const float *)data); + } else { + ret = 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unsupported file format [%s]", ext); + } + + free(data); + + return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color) { int img_w = 0, img_h = 0; diff --git a/tests/unit/switch_core_video.c b/tests/unit/switch_core_video.c index cafa075337..219a0acb63 100644 --- a/tests/unit/switch_core_video.c +++ b/tests/unit/switch_core_video.c @@ -220,6 +220,31 @@ FST_CORE_BEGIN("./conf") switch_img_free(&img); } FST_TEST_END() + + FST_TEST_BEGIN(write_to_file) + { + switch_image_t *img; + switch_status_t status; + + img = switch_img_read_from_file("../../images/cluecon.png", SWITCH_IMG_FMT_I420); + fst_requires(img); + status = switch_img_write_to_file(img, "cluecon-rgb-write.png", 0); + switch_img_free(&img); + fst_check(status == SWITCH_STATUS_SUCCESS); + + img = switch_img_read_from_file("../../images/cluecon.png", SWITCH_IMG_FMT_ARGB); + fst_requires(img); + status = switch_img_write_to_file(img, "cluecon-argb-write.png", 0); + switch_img_free(&img); + fst_check(status == SWITCH_STATUS_SUCCESS); + + img = switch_img_read_from_file("../../images/cluecon.jpg", SWITCH_IMG_FMT_I420); + fst_requires(img); + status = switch_img_write_to_file(img, "cluecon-jpg-write.jpg", 100); + switch_img_free(&img); + fst_check(status == SWITCH_STATUS_SUCCESS); + } + FST_TEST_END() } FST_SUITE_END() } From 2448d32c0fc63f1971acdb397f23b12787f5e7e3 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Wed, 6 Mar 2019 12:00:15 +0800 Subject: [PATCH 269/655] [core] add jpg data_url support with stb_image --- src/include/switch_core_video.h | 3 +- src/switch_core_video.c | 84 +++++++++++++++++++++++++++++++++ tests/unit/switch_core_video.c | 26 ++++++++++ 3 files changed, 112 insertions(+), 1 deletion(-) diff --git a/src/include/switch_core_video.h b/src/include/switch_core_video.h index 4fb7d824c0..1af0dec7ac 100644 --- a/src/include/switch_core_video.h +++ b/src/include/switch_core_video.h @@ -395,13 +395,14 @@ SWITCH_DECLARE(switch_status_t) switch_img_write_png(switch_image_t *img, char * SWITCH_DECLARE(switch_status_t) switch_png_open(switch_png_t **pngP, const char *file_name); SWITCH_DECLARE(void) switch_png_free(switch_png_t **pngP); SWITCH_DECLARE(switch_status_t) switch_img_data_url_png(switch_image_t *img, char **urlP); +SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality); /*!\brief Read an image file to switch_image_t */ SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char *file_name, switch_img_fmt_t img_fmt); /*!\brief Write an image file, supported formats png,jpg,bmp,tga,hdr * \param[in] img The image descriptor * \param[in] file_name The file_name to write -* \param[in] quality Only used in jpg, 0 ~ 100 +* \param[in] quality Only used in jpg, 1 ~ 100 */ SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality); diff --git a/src/switch_core_video.c b/src/switch_core_video.c index ee44223f64..6a9351cdaa 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -3211,6 +3211,90 @@ SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, co return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } +typedef struct data_url_context_s { + const char *type; + char **urlP; +} data_url_context_t; + +static void data_url_write_func(void *context, void *data, int size) +{ + switch_buffer_t *buffer = (switch_buffer_t *)context; + switch_buffer_write(buffer, data, size); +} + +SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality) +{ + int comp = STBI_rgb; + unsigned char *data = NULL; + int stride_in_bytes = 0; + int ret = 0; + switch_buffer_t *buffer = NULL; + const char *header = NULL; + int header_len = 0; + + if (!type) return SWITCH_STATUS_FALSE; + + if (img->fmt == SWITCH_IMG_FMT_I420) { + comp = STBI_rgb; + stride_in_bytes = img->d_w * 3; + + data = malloc(stride_in_bytes * img->d_h); + switch_assert(data); + + I420ToRAW(img->planes[SWITCH_PLANE_Y], img->stride[SWITCH_PLANE_Y], + img->planes[SWITCH_PLANE_U], img->stride[SWITCH_PLANE_U], + img->planes[SWITCH_PLANE_V], img->stride[SWITCH_PLANE_V], + data, stride_in_bytes, + img->d_w, img->d_h); + } else if (img->fmt == SWITCH_IMG_FMT_ARGB) { + comp = STBI_rgb_alpha; + stride_in_bytes = img->d_w * 4; + + data = malloc(stride_in_bytes * img->d_h); + switch_assert(data); + +#if SWITCH_BYTE_ORDER == __BIG_ENDIAN + ARGBToRGBA(img->planes[SWITCH_PLANE_PACKED], stride_in_bytes, data, stride_in_bytes, img->d_w, img->d_h); +#else + ARGBToABGR(img->planes[SWITCH_PLANE_PACKED], stride_in_bytes, data, stride_in_bytes, img->d_w, img->d_h); +#endif + } else { + return SWITCH_STATUS_FALSE; + } + + switch_buffer_create_dynamic(&buffer, 1024, 1024, 0); + + if (!strcmp(type, "png")) { + header = "data:image/png;base64,"; + ret = stbi_write_png_to_func(data_url_write_func, (void *)buffer, img->d_w, img->d_h, comp, (const void *)data, stride_in_bytes); + } else if (!strcmp(type, "jpeg") || !strcmp(type, "jpeg")) { + header = "data:image/jpeg;base64,"; + ret = stbi_write_jpg_to_func(data_url_write_func, (void *)buffer, img->d_w, img->d_h, comp, (const void *)data, quality); + } else { + ret = 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unsupported file format [%s]\n", type); + } + + if (ret && switch_buffer_inuse(buffer) > 0) { + switch_size_t blen = switch_buffer_inuse(buffer); + switch_size_t olen = blen * 4 + strlen(header) + 1; + uint8_t *data = switch_buffer_get_head_pointer(buffer); + unsigned char *out = NULL; + + switch_zmalloc(out, olen); + header_len = strlen(header); + memcpy(out, header, header_len); + switch_b64_encode(data, blen, out + header_len, olen - header_len); + *urlP = (char *)out; + } + + free(data); + switch_buffer_destroy(&buffer); + + return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +} + + SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color) { int img_w = 0, img_h = 0; diff --git a/tests/unit/switch_core_video.c b/tests/unit/switch_core_video.c index 219a0acb63..ec30a43a05 100644 --- a/tests/unit/switch_core_video.c +++ b/tests/unit/switch_core_video.c @@ -200,6 +200,32 @@ FST_CORE_BEGIN("./conf") } FST_TEST_END() + FST_TEST_BEGIN(stb_data_url) + { + switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1); + switch_image_t *argb_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, 120, 60, 1); + switch_rgb_color_t color = { 0 }; + color.r = 255; + // color.g = 255; + // color.b = 255; + char *data_url = NULL; + + switch_img_fill(img, 0, 0, img->d_w, img->d_h, &color); + switch_img_add_text(img->planes[0], img->d_w, 10, 10, "-1234567890"); + + switch_img_data_url(img, &data_url, "png", 0); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "PNG: %s\n", data_url); + free(data_url); + data_url = NULL; + + switch_img_data_url(img, &data_url, "jpeg", 50); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "JPG: %s\n", data_url); + + free(data_url); + switch_img_free(&img); + } + FST_TEST_END() + FST_TEST_BEGIN(read_from_file) { switch_image_t *img; From 48e3a37587b518798f84be71d1b14cd0332baca4 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Mon, 1 Jun 2020 22:26:32 +0800 Subject: [PATCH 270/655] [core] fix leak in unit test --- tests/unit/switch_core_video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/switch_core_video.c b/tests/unit/switch_core_video.c index ec30a43a05..5c3731eb7f 100644 --- a/tests/unit/switch_core_video.c +++ b/tests/unit/switch_core_video.c @@ -203,7 +203,6 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(stb_data_url) { switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1); - switch_image_t *argb_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, 120, 60, 1); switch_rgb_color_t color = { 0 }; color.r = 255; // color.g = 255; From 23640d06b128d455d464e7fcaffa44ca398b0d2b Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Mon, 1 Jun 2020 22:28:15 +0800 Subject: [PATCH 271/655] [mod_av] fix value never read --- src/mod/applications/mod_av/avformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index b8ed73321f..74e3a8ea1a 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -2433,7 +2433,7 @@ static switch_status_t no_video_decode_packets(switch_file_handle_t *handle, swi } context->last_read_pkt = pkt; - status = switch_packetizer_feed(context->packetizer, pkt->data, pkt->size); + switch_packetizer_feed(context->packetizer, pkt->data, pkt->size); status = switch_packetizer_read(context->packetizer, frame); pts = av_rescale_q(pkt->pts, st->time_base, AV_TIME_BASE_Q); frame->timestamp = pts * 9 / 100; // scale to sample 900000 From 7874d2eb7ea07501476d84fda032d98138507a46 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Mon, 1 Jun 2020 22:33:33 +0800 Subject: [PATCH 272/655] [core] update stb image lib to latest master --- libs/stb/stb_image.h | 143 ++++++++++++++++++++++++++++++++----- libs/stb/stb_image_write.h | 128 ++++++++++++++++++++++----------- 2 files changed, 212 insertions(+), 59 deletions(-) diff --git a/libs/stb/stb_image.h b/libs/stb/stb_image.h index 5405380c11..2857f05d38 100644 --- a/libs/stb/stb_image.h +++ b/libs/stb/stb_image.h @@ -1,4 +1,4 @@ -/* stb_image - v2.22 - public domain image loader - http://nothings.org/stb +/* stb_image - v2.25 - public domain image loader - http://nothings.org/stb no warranty implied; use at your own risk Do this: @@ -48,6 +48,9 @@ LICENSE RECENT REVISION HISTORY: + 2.25 (2020-02-02) fix warnings + 2.24 (2020-02-02) fix warnings; thread-local failure_reason and flip_vertically + 2.23 (2019-08-11) fix clang static analysis warning 2.22 (2019-03-04) gif fixes, fix warnings 2.21 (2019-02-25) fix typo in comment 2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs @@ -104,7 +107,8 @@ RECENT REVISION HISTORY: Oriol Ferrer Mesia Josh Tobin Matthew Gregan github:phprus Julian Raschke Gregory Mullen Baldur Karlsson github:poppolopoppo Christian Floisand Kevin Schmidt JR Smith github:darealshinji - Blazej Dariusz Roszkowski github:Michaelangel007 + Brad Weinberger Matvey Cherevko github:Michaelangel007 + Blazej Dariusz Roszkowski Alexander Veselov */ #ifndef STBI_INCLUDE_STB_IMAGE_H @@ -433,7 +437,7 @@ STBIDEF int stbi_is_hdr_from_file(FILE *f); // get a VERY brief reason for failure -// NOT THREADSAFE +// on most compilers (and ALL modern mainstream compilers) this is threadsafe STBIDEF const char *stbi_failure_reason (void); // free the loaded image -- this is just free() @@ -466,6 +470,11 @@ STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert); // flip the image vertically, so the first pixel in the output array is the bottom left STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip); +// as above, but only applies to images loaded on the thread that calls the function +// this function is only available if your compiler supports thread-local variables; +// calling it will fail to link if your compiler doesn't +STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip); + // ZLIB client - used by PNG, available for other purposes STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen); @@ -562,6 +571,17 @@ STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const ch #define stbi_inline __forceinline #endif +#ifndef STBI_NO_THREAD_LOCALS + #if defined(__cplusplus) && __cplusplus >= 201103L + #define STBI_THREAD_LOCAL thread_local + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + #define STBI_THREAD_LOCAL _Thread_local + #elif defined(__GNUC__) + #define STBI_THREAD_LOCAL __thread + #elif defined(_MSC_VER) + #define STBI_THREAD_LOCAL __declspec(thread) +#endif +#endif #ifdef _MSC_VER typedef unsigned short stbi__uint16; @@ -872,19 +892,24 @@ static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp); #endif -// this is not threadsafe -static const char *stbi__g_failure_reason; +static +#ifdef STBI_THREAD_LOCAL +STBI_THREAD_LOCAL +#endif +const char *stbi__g_failure_reason; STBIDEF const char *stbi_failure_reason(void) { return stbi__g_failure_reason; } +#ifndef STBI_NO_FAILURE_STRINGS static int stbi__err(const char *str) { stbi__g_failure_reason = str; return 0; } +#endif static void *stbi__malloc(size_t size) { @@ -923,11 +948,13 @@ static int stbi__mul2sizes_valid(int a, int b) return a <= INT_MAX/b; } +#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR) // returns 1 if "a*b + add" has no negative terms/factors and doesn't overflow static int stbi__mad2sizes_valid(int a, int b, int add) { return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add); } +#endif // returns 1 if "a*b*c + add" has no negative terms/factors and doesn't overflow static int stbi__mad3sizes_valid(int a, int b, int c, int add) @@ -945,12 +972,14 @@ static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add) } #endif +#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR) // mallocs with size overflow checking static void *stbi__malloc_mad2(int a, int b, int add) { if (!stbi__mad2sizes_valid(a, b, add)) return NULL; return stbi__malloc(a*b + add); } +#endif static void *stbi__malloc_mad3(int a, int b, int c, int add) { @@ -994,13 +1023,29 @@ static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp); static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp); #endif -static int stbi__vertically_flip_on_load = 0; +static int stbi__vertically_flip_on_load_global = 0; STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip) { - stbi__vertically_flip_on_load = flag_true_if_should_flip; + stbi__vertically_flip_on_load_global = flag_true_if_should_flip; } +#ifndef STBI_THREAD_LOCAL +#define stbi__vertically_flip_on_load stbi__vertically_flip_on_load_global +#else +static STBI_THREAD_LOCAL int stbi__vertically_flip_on_load_local, stbi__vertically_flip_on_load_set; + +STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip) +{ + stbi__vertically_flip_on_load_local = flag_true_if_should_flip; + stbi__vertically_flip_on_load_set = 1; +} + +#define stbi__vertically_flip_on_load (stbi__vertically_flip_on_load_set \ + ? stbi__vertically_flip_on_load_local \ + : stbi__vertically_flip_on_load_global) +#endif // STBI_THREAD_LOCAL + static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) { memset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields @@ -1022,6 +1067,8 @@ static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int re #endif #ifndef STBI_NO_PSD if (stbi__psd_test(s)) return stbi__psd_load(s,x,y,comp,req_comp, ri, bpc); + #else + STBI_NOTUSED(bpc); #endif #ifndef STBI_NO_PIC if (stbi__pic_test(s)) return stbi__pic_load(s,x,y,comp,req_comp, ri); @@ -1476,6 +1523,9 @@ stbi_inline static stbi_uc stbi__get8(stbi__context *s) return 0; } +#if defined(STBI_NO_JPEG) && defined(STBI_NO_HDR) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) +// nothing +#else stbi_inline static int stbi__at_eof(stbi__context *s) { if (s->io.read) { @@ -1487,7 +1537,11 @@ stbi_inline static int stbi__at_eof(stbi__context *s) return s->img_buffer >= s->img_buffer_end; } +#endif +#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) +// nothing +#else static void stbi__skip(stbi__context *s, int n) { if (n < 0) { @@ -1504,7 +1558,11 @@ static void stbi__skip(stbi__context *s, int n) } s->img_buffer += n; } +#endif +#if defined(STBI_NO_PNG) && defined(STBI_NO_TGA) && defined(STBI_NO_HDR) && defined(STBI_NO_PNM) +// nothing +#else static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) { if (s->io.read) { @@ -1528,18 +1586,27 @@ static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) } else return 0; } +#endif +#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC) +// nothing +#else static int stbi__get16be(stbi__context *s) { int z = stbi__get8(s); return (z << 8) + stbi__get8(s); } +#endif +#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC) +// nothing +#else static stbi__uint32 stbi__get32be(stbi__context *s) { stbi__uint32 z = stbi__get16be(s); return (z << 16) + stbi__get16be(s); } +#endif #if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) // nothing @@ -1561,7 +1628,9 @@ static stbi__uint32 stbi__get32le(stbi__context *s) #define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings - +#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) +// nothing +#else ////////////////////////////////////////////////////////////////////////////// // // generic converter from built-in img_n to req_comp @@ -1577,7 +1646,11 @@ static stbi_uc stbi__compute_y(int r, int g, int b) { return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8); } +#endif +#if defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) +// nothing +#else static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y) { int i,j; @@ -1621,12 +1694,20 @@ static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int r STBI_FREE(data); return good; } +#endif +#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) +// nothing +#else static stbi__uint16 stbi__compute_y_16(int r, int g, int b) { return (stbi__uint16) (((r*77) + (g*150) + (29*b)) >> 8); } +#endif +#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) +// nothing +#else static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y) { int i,j; @@ -1670,6 +1751,7 @@ static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int r STBI_FREE(data); return good; } +#endif #ifndef STBI_NO_LINEAR static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp) @@ -4941,6 +5023,8 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp) ++s->img_n; } STBI_FREE(z->expanded); z->expanded = NULL; + // end of PNG chunk, read and skip CRC + stbi__get32be(s); return 1; } @@ -5079,7 +5163,7 @@ static int stbi__high_bit(unsigned int z) if (z >= 0x00100) { n += 8; z >>= 8; } if (z >= 0x00010) { n += 4; z >>= 4; } if (z >= 0x00004) { n += 2; z >>= 2; } - if (z >= 0x00002) { n += 1; z >>= 1; } + if (z >= 0x00002) { n += 1;/* >>= 1;*/ } return n; } @@ -5110,7 +5194,7 @@ static int stbi__shiftsigned(unsigned int v, int shift, int bits) v <<= -shift; else v >>= shift; - STBI_ASSERT(v >= 0 && v < 256); + STBI_ASSERT(v < 256); v >>= (8-bits); STBI_ASSERT(bits >= 0 && bits <= 8); return (int) ((unsigned) v * mul_table[bits]) >> shift_table[bits]; @@ -5120,6 +5204,7 @@ typedef struct { int bpp, offset, hsz; unsigned int mr,mg,mb,ma, all_a; + int extra_read; } stbi__bmp_data; static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) @@ -5132,6 +5217,7 @@ static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) info->offset = stbi__get32le(s); info->hsz = hsz = stbi__get32le(s); info->mr = info->mg = info->mb = info->ma = 0; + info->extra_read = 14; if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) return stbi__errpuc("unknown BMP", "BMP type not supported: unknown"); if (hsz == 12) { @@ -5175,6 +5261,7 @@ static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) info->mr = stbi__get32le(s); info->mg = stbi__get32le(s); info->mb = stbi__get32le(s); + info->extra_read += 12; // not documented, but generated by photoshop and handled by mspaint if (info->mr == info->mg && info->mg == info->mb) { // ?!?!? @@ -5231,13 +5318,19 @@ static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req if (info.hsz == 12) { if (info.bpp < 24) - psize = (info.offset - 14 - 24) / 3; + psize = (info.offset - info.extra_read - 24) / 3; } else { if (info.bpp < 16) - psize = (info.offset - 14 - info.hsz) >> 2; + psize = (info.offset - info.extra_read - info.hsz) >> 2; + } + if (psize == 0) { + STBI_ASSERT(info.offset == (s->img_buffer - s->buffer_start)); } - s->img_n = ma ? 4 : 3; + if (info.bpp == 24 && ma == 0xff000000) + s->img_n = 3; + else + s->img_n = ma ? 4 : 3; if (req_comp && req_comp >= 3) // we can directly decode 3 or 4 target = req_comp; else @@ -5259,7 +5352,7 @@ static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req if (info.hsz != 12) stbi__get8(s); pal[i][3] = 255; } - stbi__skip(s, info.offset - 14 - info.hsz - psize * (info.hsz == 12 ? 3 : 4)); + stbi__skip(s, info.offset - info.extra_read - info.hsz - psize * (info.hsz == 12 ? 3 : 4)); if (info.bpp == 1) width = (s->img_x + 7) >> 3; else if (info.bpp == 4) width = (s->img_x + 1) >> 1; else if (info.bpp == 8) width = s->img_x; @@ -5308,7 +5401,7 @@ static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0; int z = 0; int easy=0; - stbi__skip(s, info.offset - 14 - info.hsz); + stbi__skip(s, info.offset - info.extra_read - info.hsz); if (info.bpp == 24) width = 3 * s->img_x; else if (info.bpp == 16) width = 2*s->img_x; else /* bpp = 32 and pad = 0 */ width=0; @@ -5547,6 +5640,8 @@ static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req int RLE_repeating = 0; int read_next_pixel = 1; STBI_NOTUSED(ri); + STBI_NOTUSED(tga_x_origin); // @TODO + STBI_NOTUSED(tga_y_origin); // @TODO // do a tiny bit of precessing if ( tga_image_type >= 8 ) @@ -5710,6 +5805,7 @@ static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req // Microsoft's C compilers happy... [8^( tga_palette_start = tga_palette_len = tga_palette_bits = tga_x_origin = tga_y_origin = 0; + STBI_NOTUSED(tga_palette_start); // OK, done return tga_data; } @@ -6603,7 +6699,15 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, stride = g.w * g.h * 4; if (out) { - out = (stbi_uc*) STBI_REALLOC( out, layers * stride ); + void *tmp = (stbi_uc*) STBI_REALLOC( out, layers * stride ); + if (NULL == tmp) { + STBI_FREE(g.out); + STBI_FREE(g.history); + STBI_FREE(g.background); + return stbi__errpuc("outofmem", "Out of memory"); + } + else + out = (stbi_uc*) tmp; if (delays) { *delays = (int*) STBI_REALLOC( *delays, sizeof(int) * layers ); } @@ -6936,7 +7040,12 @@ static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp) return 0; if (x) *x = s->img_x; if (y) *y = s->img_y; - if (comp) *comp = info.ma ? 4 : 3; + if (comp) { + if (info.bpp == 24 && info.ma == 0xff000000) + *comp = 3; + else + *comp = info.ma ? 4 : 3; + } return 1; } #endif diff --git a/libs/stb/stb_image_write.h b/libs/stb/stb_image_write.h index 09522e8121..cffd473c1f 100644 --- a/libs/stb/stb_image_write.h +++ b/libs/stb/stb_image_write.h @@ -1,4 +1,4 @@ -/* stb_image_write - v1.13 - public domain - http://nothings.org/stb/stb_image_write.h +/* stb_image_write - v1.14 - public domain - http://nothings.org/stb writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015 no warranty implied; use at your own risk @@ -10,11 +10,6 @@ Will probably not work correctly with strict-aliasing optimizations. - If using a modern Microsoft Compiler, non-safe versions of CRT calls may cause - compilation warnings or even errors. To avoid this, also before #including, - - #define STBI_MSC_SECURE_CRT - ABOUT: This header file is a library for writing images to C stdio or a callback. @@ -252,17 +247,17 @@ STBIWDEF void stbi_flip_vertically_on_write(int flip_boolean); #define STBIW_UCHAR(x) (unsigned char) ((x) & 0xff) #ifdef STB_IMAGE_WRITE_STATIC -static int stbi__flip_vertically_on_write=0; static int stbi_write_png_compression_level = 8; static int stbi_write_tga_with_rle = 1; static int stbi_write_force_png_filter = -1; #else int stbi_write_png_compression_level = 8; -int stbi__flip_vertically_on_write=0; int stbi_write_tga_with_rle = 1; int stbi_write_force_png_filter = -1; #endif +static int stbi__flip_vertically_on_write = 0; + STBIWDEF void stbi_flip_vertically_on_write(int flag) { stbi__flip_vertically_on_write = flag; @@ -779,7 +774,7 @@ STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const #ifndef STBIW_ZLIB_COMPRESS // stretchy buffer; stbiw__sbpush() == vector<>::push_back() -- stbiw__sbcount() == vector<>::size() -#define stbiw__sbraw(a) ((int *) (a) - 2) +#define stbiw__sbraw(a) ((int *) (void *) (a) - 2) #define stbiw__sbm(a) stbiw__sbraw(a)[0] #define stbiw__sbn(a) stbiw__sbraw(a)[1] @@ -873,7 +868,7 @@ STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, i unsigned int bitbuf=0; int i,j, bitcount=0; unsigned char *out = NULL; - unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(char**)); + unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(unsigned char**)); if (hash_table == NULL) return NULL; if (quality < 5) quality = 5; @@ -1276,26 +1271,31 @@ static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) { bits[0] = val & ((1<<bits[1])-1); } -static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt, float *CDU, float *fdtbl, int DC, const unsigned short HTDC[256][2], const unsigned short HTAC[256][2]) { +static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt, float *CDU, int du_stride, float *fdtbl, int DC, const unsigned short HTDC[256][2], const unsigned short HTAC[256][2]) { const unsigned short EOB[2] = { HTAC[0x00][0], HTAC[0x00][1] }; const unsigned short M16zeroes[2] = { HTAC[0xF0][0], HTAC[0xF0][1] }; - int dataOff, i, diff, end0pos; + int dataOff, i, j, n, diff, end0pos, x, y; int DU[64]; // DCT rows - for(dataOff=0; dataOff<64; dataOff+=8) { + for(dataOff=0, n=du_stride*8; dataOff<n; dataOff+=du_stride) { stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+1], &CDU[dataOff+2], &CDU[dataOff+3], &CDU[dataOff+4], &CDU[dataOff+5], &CDU[dataOff+6], &CDU[dataOff+7]); } // DCT columns for(dataOff=0; dataOff<8; ++dataOff) { - stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+8], &CDU[dataOff+16], &CDU[dataOff+24], &CDU[dataOff+32], &CDU[dataOff+40], &CDU[dataOff+48], &CDU[dataOff+56]); + stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+du_stride], &CDU[dataOff+du_stride*2], &CDU[dataOff+du_stride*3], &CDU[dataOff+du_stride*4], + &CDU[dataOff+du_stride*5], &CDU[dataOff+du_stride*6], &CDU[dataOff+du_stride*7]); } // Quantize/descale/zigzag the coefficients - for(i=0; i<64; ++i) { - float v = CDU[i]*fdtbl[i]; - // DU[stbiw__jpg_ZigZag[i]] = (int)(v < 0 ? ceilf(v - 0.5f) : floorf(v + 0.5f)); - // ceilf() and floorf() are C99, not C89, but I /think/ they're not needed here anyway? - DU[stbiw__jpg_ZigZag[i]] = (int)(v < 0 ? v - 0.5f : v + 0.5f); + for(y = 0, j=0; y < 8; ++y) { + for(x = 0; x < 8; ++x,++j) { + float v; + i = y*du_stride+x; + v = CDU[i]*fdtbl[j]; + // DU[stbiw__jpg_ZigZag[j]] = (int)(v < 0 ? ceilf(v - 0.5f) : floorf(v + 0.5f)); + // ceilf() and floorf() are C99, not C89, but I /think/ they're not needed here anyway? + DU[stbiw__jpg_ZigZag[j]] = (int)(v < 0 ? v - 0.5f : v + 0.5f); + } } // Encode DC @@ -1413,7 +1413,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in static const float aasf[] = { 1.0f * 2.828427125f, 1.387039845f * 2.828427125f, 1.306562965f * 2.828427125f, 1.175875602f * 2.828427125f, 1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f }; - int row, col, i, k; + int row, col, i, k, subsample; float fdtbl_Y[64], fdtbl_UV[64]; unsigned char YTable[64], UVTable[64]; @@ -1422,6 +1422,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in } quality = quality ? quality : 90; + subsample = quality <= 90 ? 1 : 0; quality = quality < 1 ? 1 : quality > 100 ? 100 : quality; quality = quality < 50 ? 5000 / quality : 200 - quality * 2; @@ -1444,7 +1445,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in static const unsigned char head0[] = { 0xFF,0xD8,0xFF,0xE0,0,0x10,'J','F','I','F',0,1,1,0,0,1,0,1,0,0,0xFF,0xDB,0,0x84,0 }; static const unsigned char head2[] = { 0xFF,0xDA,0,0xC,3,1,0,2,0x11,3,0x11,0,0x3F,0 }; const unsigned char head1[] = { 0xFF,0xC0,0,0x11,8,(unsigned char)(height>>8),STBIW_UCHAR(height),(unsigned char)(width>>8),STBIW_UCHAR(width), - 3,1,0x11,0,2,0x11,1,3,0x11,1,0xFF,0xC4,0x01,0xA2,0 }; + 3,1,(unsigned char)(subsample?0x22:0x11),0,2,0x11,1,3,0x11,1,0xFF,0xC4,0x01,0xA2,0 }; s->func(s->context, (void*)head0, sizeof(head0)); s->func(s->context, (void*)YTable, sizeof(YTable)); stbiw__putc(s, 1); @@ -1467,36 +1468,74 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in // Encode 8x8 macroblocks { static const unsigned short fillBits[] = {0x7F, 7}; - const unsigned char *imageData = (const unsigned char *)data; int DCY=0, DCU=0, DCV=0; int bitBuf=0, bitCnt=0; // comp == 2 is grey+alpha (alpha is ignored) int ofsG = comp > 2 ? 1 : 0, ofsB = comp > 2 ? 2 : 0; + const unsigned char *dataR = (const unsigned char *)data; + const unsigned char *dataG = dataR + ofsG; + const unsigned char *dataB = dataR + ofsB; int x, y, pos; - for(y = 0; y < height; y += 8) { - for(x = 0; x < width; x += 8) { - float YDU[64], UDU[64], VDU[64]; - for(row = y, pos = 0; row < y+8; ++row) { - // row >= height => use last input row - int clamped_row = (row < height) ? row : height - 1; - int base_p = (stbi__flip_vertically_on_write ? (height-1-clamped_row) : clamped_row)*width*comp; - for(col = x; col < x+8; ++col, ++pos) { - float r, g, b; - // if col >= width => use pixel from last input column - int p = base_p + ((col < width) ? col : (width-1))*comp; + if(subsample) { + for(y = 0; y < height; y += 16) { + for(x = 0; x < width; x += 16) { + float Y[256], U[256], V[256]; + for(row = y, pos = 0; row < y+16; ++row) { + // row >= height => use last input row + int clamped_row = (row < height) ? row : height - 1; + int base_p = (stbi__flip_vertically_on_write ? (height-1-clamped_row) : clamped_row)*width*comp; + for(col = x; col < x+16; ++col, ++pos) { + // if col >= width => use pixel from last input column + int p = base_p + ((col < width) ? col : (width-1))*comp; + float r = dataR[p], g = dataG[p], b = dataB[p]; + Y[pos]= +0.29900f*r + 0.58700f*g + 0.11400f*b - 128; + U[pos]= -0.16874f*r - 0.33126f*g + 0.50000f*b; + V[pos]= +0.50000f*r - 0.41869f*g - 0.08131f*b; + } + } + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+0, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+8, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+128, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y+136, 16, fdtbl_Y, DCY, YDC_HT, YAC_HT); - r = imageData[p+0]; - g = imageData[p+ofsG]; - b = imageData[p+ofsB]; - YDU[pos]=+0.29900f*r+0.58700f*g+0.11400f*b-128; - UDU[pos]=-0.16874f*r-0.33126f*g+0.50000f*b; - VDU[pos]=+0.50000f*r-0.41869f*g-0.08131f*b; + // subsample U,V + { + float subU[64], subV[64]; + int yy, xx; + for(yy = 0, pos = 0; yy < 8; ++yy) { + for(xx = 0; xx < 8; ++xx, ++pos) { + int j = yy*32+xx*2; + subU[pos] = (U[j+0] + U[j+1] + U[j+16] + U[j+17]) * 0.25f; + subV[pos] = (V[j+0] + V[j+1] + V[j+16] + V[j+17]) * 0.25f; + } + } + DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, subU, 8, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, subV, 8, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); } } + } + } else { + for(y = 0; y < height; y += 8) { + for(x = 0; x < width; x += 8) { + float Y[64], U[64], V[64]; + for(row = y, pos = 0; row < y+8; ++row) { + // row >= height => use last input row + int clamped_row = (row < height) ? row : height - 1; + int base_p = (stbi__flip_vertically_on_write ? (height-1-clamped_row) : clamped_row)*width*comp; + for(col = x; col < x+8; ++col, ++pos) { + // if col >= width => use pixel from last input column + int p = base_p + ((col < width) ? col : (width-1))*comp; + float r = dataR[p], g = dataG[p], b = dataB[p]; + Y[pos]= +0.29900f*r + 0.58700f*g + 0.11400f*b - 128; + U[pos]= -0.16874f*r - 0.33126f*g + 0.50000f*b; + V[pos]= +0.50000f*r - 0.41869f*g - 0.08131f*b; + } + } - DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); - DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); - DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, Y, 8, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, U, 8, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, V, 8, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + } } } @@ -1535,6 +1574,11 @@ STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const #endif // STB_IMAGE_WRITE_IMPLEMENTATION /* Revision history + 1.14 (2020-02-02) updated JPEG writer to downsample chroma channels + 1.13 + 1.12 + 1.11 (2019-08-11) + 1.10 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs 1.09 (2018-02-11) From 64aebc31ed8edbc0b96c3cf2781cac445bb40905 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Wed, 3 Jun 2020 08:58:35 +0800 Subject: [PATCH 273/655] [core] fix memeory leak when font not found --- src/switch_core_video.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 6a9351cdaa..2f7b07d4bd 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -1897,6 +1897,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_txt_handle_create(switch_img_txt_hand if (switch_file_exists(new_handle->font_family, new_handle->pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Font %s does not exist\n", new_handle->font_family); +#if SWITCH_HAVE_FREETYPE + if (new_handle->library) { + FT_Done_FreeType(new_handle->library); + new_handle->library = NULL; + } +#endif if (free_pool) { switch_core_destroy_memory_pool(&pool); } From 5243fbd3c5feb3bbc2a04c7c7a501e088b0e70c5 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Wed, 13 May 2020 09:18:44 +0800 Subject: [PATCH 274/655] [core, mod_av] move switch_packetizer to core --- Makefile.am | 1 + .../mod_av => include}/switch_packetizer.h | 0 src/mod/applications/mod_av/Makefile.am | 7 +- .../mod_av => }/switch_packetizer.c | 0 tests/unit/Makefile.am | 2 +- .../unit/switch_packetizer.c | 79 +++++++------------ 6 files changed, 31 insertions(+), 58 deletions(-) rename src/{mod/applications/mod_av => include}/switch_packetizer.h (100%) rename src/{mod/applications/mod_av => }/switch_packetizer.c (100%) rename src/mod/applications/mod_av/test/test_packetizer.c => tests/unit/switch_packetizer.c (69%) diff --git a/Makefile.am b/Makefile.am index 09d500a4d7..e9fb74c646 100644 --- a/Makefile.am +++ b/Makefile.am @@ -364,6 +364,7 @@ libfreeswitch_la_SOURCES = \ src/switch_version.c \ src/switch_core_media.c \ src/switch_core_video.c \ + src/switch_packetizer.c \ src/switch_sdp.c \ src/switch_scheduler.c \ src/switch_core_db.c \ diff --git a/src/mod/applications/mod_av/switch_packetizer.h b/src/include/switch_packetizer.h similarity index 100% rename from src/mod/applications/mod_av/switch_packetizer.h rename to src/include/switch_packetizer.h diff --git a/src/mod/applications/mod_av/Makefile.am b/src/mod/applications/mod_av/Makefile.am index 39cb581611..ebf4c93929 100644 --- a/src/mod/applications/mod_av/Makefile.am +++ b/src/mod/applications/mod_av/Makefile.am @@ -13,7 +13,7 @@ endif noinst_LTLIBRARIES = libavmod.la -libavmod_la_SOURCES = mod_av.c avformat.c avcodec.c switch_packetizer.c +libavmod_la_SOURCES = mod_av.c avformat.c avcodec.c libavmod_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) mod_LTLIBRARIES = mod_av.la @@ -22,16 +22,13 @@ mod_av_la_LIBADD = libavmod.la $(switch_builddir)/libfreeswitch.la $(AVFORMAT_ mod_av_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz -noinst_PROGRAMS = test/test_mod_av test/test_avformat test/test_packetizer +noinst_PROGRAMS = test/test_mod_av test/test_avformat test_test_mod_av_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) test_test_mod_av_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) test_test_mod_av_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la test_test_avformat_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) test_test_avformat_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) test_test_avformat_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la -test_test_packetizer_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) -test_test_packetizer_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) -test_test_packetizer_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la TESTS = $(noinst_PROGRAMS) diff --git a/src/mod/applications/mod_av/switch_packetizer.c b/src/switch_packetizer.c similarity index 100% rename from src/mod/applications/mod_av/switch_packetizer.c rename to src/switch_packetizer.c diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 231225c5aa..212c54b2bf 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ switch_ivr_play_say switch_core_codec switch_rtp switch_xml -noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_core_asr test_sofia +noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_packetizer test_sofia switch_core_asr 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/src/mod/applications/mod_av/test/test_packetizer.c b/tests/unit/switch_packetizer.c similarity index 69% rename from src/mod/applications/mod_av/test/test_packetizer.c rename to tests/unit/switch_packetizer.c index 9d34f98d51..242ca6ae33 100644 --- a/src/mod/applications/mod_av/test/test_packetizer.c +++ b/tests/unit/switch_packetizer.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2018, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -24,7 +24,7 @@ * Contributor(s): * * - * test_avformat -- avformat tests + * switch_packetizer.c unit test * */ @@ -35,11 +35,10 @@ FST_CORE_BEGIN("conf") { - FST_MODULE_BEGIN(mod_av, mod_av_test) + FST_SUITE_BEGIN(switch_packetizer) { FST_SETUP_BEGIN() { - fst_requires_module("mod_av"); } FST_SETUP_END() @@ -52,33 +51,33 @@ FST_CORE_BEGIN("conf") uint8_t h264data[] = {0, 0, 0, 1, 0x67, 1, 2, 0, 0, 0, 1, 0x68, 1, 2, 0, 0, 0, 1, 0x65, 1, 2, 3, 4, 5, 6}; frame.data = data; - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; switch_set_flag(&frame, SFF_ENCODED); status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data)); fst_requires(status == SWITCH_STATUS_SUCCESS); status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 3); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 3); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 4); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 4); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_SUCCESS); fst_requires(frame.datalen == 4); switch_packetizer_close(&packetizer); @@ -94,33 +93,33 @@ FST_CORE_BEGIN("conf") uint8_t h264data[] = {0, 0, 0, 3, 0x67, 1, 2, 0, 0, 0, 3, 0x68, 1, 2, 0, 0, 0, 7, 0x65, 1, 2, 3, 4, 5, 6}; frame.data = data; - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; switch_set_flag(&frame, SFF_ENCODED); status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data)); fst_requires(status == SWITCH_STATUS_SUCCESS); status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 3); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 3); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 4); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 4); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_SUCCESS); fst_requires(frame.datalen == 4); fst_check(frame.m == 1); @@ -138,7 +137,7 @@ FST_CORE_BEGIN("conf") uint8_t extradata[] = {0x01, 0x64, 0x00, 0x1e, 0xff, 0xe1, 0x00, 0x03, 0x67, 0x64, 0x00, 0xe1, 0x00, 0x03, 0x68, 0x01, 0x02}; // 1 fps 3 bytes 1pps 3 bytes frame.data = data; - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; switch_set_flag(&frame, SFF_ENCODED); status = switch_packetizer_feed_extradata(packetizer, extradata, sizeof(extradata)); @@ -148,35 +147,35 @@ FST_CORE_BEGIN("conf") fst_requires(status == SWITCH_STATUS_SUCCESS); status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u\n", frame.datalen); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 3); fst_check((*(uint8_t *)frame.data & 0x1f) == 0x06); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 3); fst_check((*(uint8_t *)frame.data & 0x1f) == 0x09); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 3); fst_check((*(uint8_t *)frame.data & 0x1f) == 0x07); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 3); fst_check((*(uint8_t *)frame.data & 0x1f) == 0x08); frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 4); fst_check((*(uint8_t *)frame.data & 0x1f) == 0x1c); @@ -184,7 +183,7 @@ FST_CORE_BEGIN("conf") frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); fst_requires(status == SWITCH_STATUS_MORE_DATA); fst_requires(frame.datalen == 4); fst_check((*(uint8_t *)frame.data & 0x1f) == 0x1c); @@ -192,7 +191,7 @@ FST_CORE_BEGIN("conf") frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u %x\n", frame.datalen, *(uint8_t *)frame.data); fst_requires(status == SWITCH_STATUS_SUCCESS); fst_requires(frame.datalen == 4); fst_check((*(uint8_t *)frame.data & 0x1f) == 0x1c); @@ -210,47 +209,23 @@ FST_CORE_BEGIN("conf") uint8_t h264data[] = {0, 0, 2, 9, 0x67, 1, 2, 0, 0, 0, 0, 0x68, 1, 2, 0, 0, 0, 0, 0x65, 1, 2, 3, 4, 5, 6}; frame.data = data; - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; switch_set_flag(&frame, SFF_ENCODED); status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data)); fst_requires(status == SWITCH_STATUS_SUCCESS); status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); - fst_requires(status == SWITCH_STATUS_MORE_DATA); - fst_requires(frame.datalen == 3); - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; - status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); - fst_requires(status == SWITCH_STATUS_MORE_DATA); - fst_requires(frame.datalen == 3); - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; - status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); - fst_requires(status == SWITCH_STATUS_MORE_DATA); - fst_requires(frame.datalen == 4); - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; - status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); - fst_requires(status == SWITCH_STATUS_MORE_DATA); - fst_requires(frame.datalen == 4); - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; - status = switch_packetizer_read(packetizer, &frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%u\n", frame.datalen); - fst_requires(status == SWITCH_STATUS_SUCCESS); - fst_requires(frame.datalen == 4); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "status = %d datalen = %u\n", status, frame.datalen); + fst_requires(status == SWITCH_STATUS_FALSE); switch_packetizer_close(&packetizer); } FST_TEST_END() FST_TEARDOWN_BEGIN() { - //const char *err = NULL; - switch_sleep(1000000); - //fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_av", SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS); } FST_TEARDOWN_END() } - FST_MODULE_END() + FST_SUITE_END() } FST_CORE_END() From 97276035dcf13fbd555d10ceb799300514633ee9 Mon Sep 17 00:00:00 2001 From: Seven Du <seven@signalwire.com> Date: Thu, 4 Jun 2020 07:27:48 +0800 Subject: [PATCH 275/655] [mod_av] fix leak (#211) --- src/mod/applications/mod_av/avformat.c | 1 + src/mod/applications/mod_av/test/test_avformat.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 74e3a8ea1a..96684d3d28 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -784,6 +784,7 @@ static void flush_video_pkt_queue(switch_queue_t *q) while (switch_queue_trypop(q, (void **)&pkt) == SWITCH_STATUS_SUCCESS) { av_packet_unref(pkt); + free(pkt); } } diff --git a/src/mod/applications/mod_av/test/test_avformat.c b/src/mod/applications/mod_av/test/test_avformat.c index 8520a558e6..2304ca8c59 100644 --- a/src/mod/applications/mod_av/test/test_avformat.c +++ b/src/mod/applications/mod_av/test/test_avformat.c @@ -178,15 +178,18 @@ FST_CORE_BEGIN("conf") status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool); fst_requires(status == SWITCH_STATUS_SUCCESS); fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN)); - frame.data = data; + frame.packet = data; + frame.data = data + 12; + frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; do { - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12; status = switch_core_file_read(&fh, data, &len); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "status: %d len: %d\n", status, (int)len); fst_check(frame.img == NULL); - frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; + frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12; status = switch_core_file_read_video(&fh, &frame, 0); + fst_check(frame.img == NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "status: %d len: %d %02x\n", status, frame.datalen, *(uint8_t *)frame.data); } while (status == SWITCH_STATUS_MORE_DATA); From 53059f298a78c0b2b50963a708b37a937807faca Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@signalwire.com> Date: Fri, 5 Jun 2020 22:05:34 +0000 Subject: [PATCH 276/655] [core] fix stbi scan-build warning --- libs/stb/stb_image.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/stb/stb_image.h b/libs/stb/stb_image.h index 2857f05d38..0ea47afd9f 100644 --- a/libs/stb/stb_image.h +++ b/libs/stb/stb_image.h @@ -602,7 +602,7 @@ typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1]; #ifdef _MSC_VER #define STBI_NOTUSED(v) (void)(v) #else -#define STBI_NOTUSED(v) (void)sizeof(v) +#define STBI_NOTUSED(v) (void)(v) #endif #ifdef _MSC_VER From 22e35ffa7baf30b5bdb3291211f3b1411b445288 Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@signalwire.com> Date: Fri, 5 Jun 2020 22:27:51 +0000 Subject: [PATCH 277/655] [test] add missing file for test --- tests/unit/conf/FreeMono.ttf | Bin 0 -> 592632 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/conf/FreeMono.ttf diff --git a/tests/unit/conf/FreeMono.ttf b/tests/unit/conf/FreeMono.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c4200565a7c71b5cc833fd4668e0989ae838e090 GIT binary patch literal 592632 zcmeF)4_Kw++W7tR{@ZG%nQ2Uj$+S|M%rql}5JE->AvA=B5E?=VA$CSa2!k*PA!J(! zA$IIR?9e8JY@wN1wh+ebsG0Tqo~w0xdOG~s`+0xId%VZ-K92oy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Hn^2*$xk Z_p$WZu=@);_4Vc#|8f8R$KP|?{|lqW!MOkc literal 0 HcmV?d00001 From 959e154623c6dedde37b7e6aa40fefa7d2bb7932 Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@signalwire.com> Date: Fri, 5 Jun 2020 22:28:08 +0000 Subject: [PATCH 278/655] .gitignore --- tests/unit/.gitignore | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore index f6d7de8008..6f51971040 100644 --- a/tests/unit/.gitignore +++ b/tests/unit/.gitignore @@ -1,7 +1,5 @@ -* !/**/ !/*.* - *.o *~ \#* @@ -10,7 +8,45 @@ perf.data perf.data.old Makefile.in - freeswitch.xml.fsxml.tmp test-argb.png test-rgb.png +images/test_patched_banner_alpha.png +images/test_patched_banner_noalpha.png +images/test_patched_signalwire_alpha.png +images/test_patched_signalwire_no_alpha.png +switch_console +switch_core +switch_core_codec +switch_core_db +switch_core_file +switch_core_video +switch_event +switch_hash +switch_ivr_originate +switch_ivr_play_say +switch_packetizer +switch_red +switch_rtp +switch_ulp +switch_ulp_jb +switch_ulp_recover1 +switch_ulp_recover2 +switch_ulp_recover3 +switch_ulp_recover4 +switch_utils +switch_vad +switch_vpx +switch_xml +.deps/ +Makefile +cluecon-argb-write.png +cluecon-argb.png +cluecon-jpg-write.jpg +cluecon-jpg.png +cluecon-rgb-write.png +cluecon-rgb.png +conf/20553/ +conf/20636/ +conf/20683/ +conf/5374/ From 465344e8e3cb41509da1e567dd568ea7e3661b73 Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Mon, 8 Jun 2020 11:07:48 -0600 Subject: [PATCH 279/655] [mod_fsv] fix leak in read failure scenario --- src/mod/applications/mod_fsv/mod_fsv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 6ff6533ddd..90d64972ad 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -997,6 +997,7 @@ again: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read error status=%d size=%u read_size=%" SWITCH_SIZE_T_FMT "\n", status, size, read_size); + free(video_data); goto end; } From 07884e20a2a8fad6820f00081215abd990f022f8 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 8 Jun 2020 22:34:55 +0400 Subject: [PATCH 280/655] [Build-System] Fix switch_packetizer headers and add it to the build. --- Makefile.am | 1 + src/include/switch.h | 1 + src/include/switch_packetizer.h | 2 -- src/mod/applications/mod_av/avformat.c | 1 - src/switch_packetizer.c | 2 +- w32/Library/FreeSwitchCore.2017.vcxproj | 2 ++ 6 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index e9fb74c646..3bf9cbd048 100644 --- a/Makefile.am +++ b/Makefile.am @@ -300,6 +300,7 @@ library_include_HEADERS = \ src/include/switch_dso.h \ src/include/switch_loadable_module.h \ src/include/switch_module_interfaces.h \ + src/include/switch_packetizer.h \ src/include/switch_platform.h \ src/include/switch_resample.h \ src/include/switch_regex.h \ diff --git a/src/include/switch.h b/src/include/switch.h index 9fdbf12aa6..461914c93b 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -136,6 +136,7 @@ #include "switch_core_event_hook.h" #include "switch_scheduler.h" #include "switch_config.h" +#include "switch_packetizer.h" #include "switch_nat.h" #include "switch_odbc.h" #include "switch_json.h" diff --git a/src/include/switch_packetizer.h b/src/include/switch_packetizer.h index 39cdf4f4d6..b6079d6c08 100644 --- a/src/include/switch_packetizer.h +++ b/src/include/switch_packetizer.h @@ -29,8 +29,6 @@ * */ -#include <switch.h> - #ifndef SWITCH_PACKETIZER_H #define SWITCH_PACKETIZER_H diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 96684d3d28..4ae98a1594 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -54,7 +54,6 @@ GCC_DIAG_OFF(deprecated-declarations) #include <libswresample/swresample.h> #endif -#include <switch_packetizer.h> #define SLICE_SIZE (SWITCH_DEFAULT_VIDEO_SIZE + 100) GCC_DIAG_ON(deprecated-declarations) diff --git a/src/switch_packetizer.c b/src/switch_packetizer.c index e539bd9b59..05688f8a86 100644 --- a/src/switch_packetizer.c +++ b/src/switch_packetizer.c @@ -29,7 +29,7 @@ * */ -#include <switch_packetizer.h> +#include <switch.h> #define MAX_NALUS 256 typedef struct our_h264_nalu_s { diff --git a/w32/Library/FreeSwitchCore.2017.vcxproj b/w32/Library/FreeSwitchCore.2017.vcxproj index a21da723cc..9d7098ee5e 100644 --- a/w32/Library/FreeSwitchCore.2017.vcxproj +++ b/w32/Library/FreeSwitchCore.2017.vcxproj @@ -400,6 +400,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <ClCompile Include="..\..\src\switch_odbc.c" /> <ClCompile Include="..\..\src\switch_pcm.c" /> <ClCompile Include="..\..\src\switch_speex.c" /> + <ClCompile Include="..\..\src\switch_packetizer.c" /> <ClCompile Include="..\..\src\switch_profile.c" /> <ClCompile Include="..\..\src\switch_regex.c" /> <ClCompile Include="..\..\src\switch_resample.c" /> @@ -735,6 +736,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <ClInclude Include="..\..\src\include\switch_module_interfaces.h" /> <ClInclude Include="..\..\src\include\switch_mprintf.h" /> <ClInclude Include="..\..\src\include\switch_odbc.h" /> + <ClInclude Include="..\..\src\include\switch_packetizer.h" /> <ClInclude Include="..\..\src\include\switch_platform.h" /> <ClInclude Include="..\..\src\include\switch_regex.h" /> <ClInclude Include="..\..\src\include\switch_resample.h" /> From 4ad2e71f95bf2b923f7c02de7e08ed232f3741af Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Tue, 19 May 2020 23:33:11 +0000 Subject: [PATCH 281/655] [mod_imagick] [mod_png] small tweaks for pdf --- src/mod/formats/mod_imagick/mod_imagick.c | 2 +- src/mod/formats/mod_png/mod_png.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/formats/mod_imagick/mod_imagick.c b/src/mod/formats/mod_imagick/mod_imagick.c index 64ee6762e9..ee702fa259 100644 --- a/src/mod/formats/mod_imagick/mod_imagick.c +++ b/src/mod/formats/mod_imagick/mod_imagick.c @@ -176,7 +176,7 @@ static switch_status_t imagick_file_open(switch_file_handle_t *handle, const cha context->autoplay = 1; } - context->max = 10000; + context->max = 86400000; context->exception = AcquireExceptionInfo(); context->image_info = AcquireImageInfo(); diff --git a/src/mod/formats/mod_png/mod_png.c b/src/mod/formats/mod_png/mod_png.c index 7508dc4fd7..36e38e9c83 100644 --- a/src/mod/formats/mod_png/mod_png.c +++ b/src/mod/formats/mod_png/mod_png.c @@ -76,7 +76,7 @@ static switch_status_t png_file_open(switch_file_handle_t *handle, const char *p } memset(context, 0, sizeof(png_file_context_t)); - context->max = 10000; + context->max = 86400000;; switch_mutex_init(&context->mutex, SWITCH_MUTEX_NESTED, handle->memory_pool); if (handle->params) { From bb02989f421dbd63aec7ce7c50156ab470168cf4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Thu, 28 May 2020 21:35:00 +0000 Subject: [PATCH 282/655] [core] use the more efficient mult-byte tolower/toupper in the helper func --- src/include/switch_utils.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 649ad926b3..41b2436538 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -888,13 +888,10 @@ static inline char *switch_safe_strdup(const char *it) static inline char *switch_lc_strdup(const char *it) { char *dup; - char *p; if (it) { dup = strdup(it); - for (p = dup; p && *p; p++) { - *p = (char) switch_tolower(*p); - } + switch_tolower_max(dup); return dup; } @@ -905,13 +902,10 @@ static inline char *switch_lc_strdup(const char *it) static inline char *switch_uc_strdup(const char *it) { char *dup; - char *p; if (it) { dup = strdup(it); - for (p = dup; p && *p; p++) { - *p = (char) switch_toupper(*p); - } + switch_toupper_max(dup); return dup; } From b2a8f9ce9fc6bbff5928b016654bfd1b4836ca44 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Mon, 1 Jun 2020 11:41:36 +0000 Subject: [PATCH 283/655] [core] change estimator CUSUM design params for loss to reduce oscillations. rename var. --- src/switch_estimators.c | 6 +++--- src/switch_rtp.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/switch_estimators.c b/src/switch_estimators.c index 2aedf8cc6e..61552644b1 100644 --- a/src/switch_estimators.c +++ b/src/switch_estimators.c @@ -139,7 +139,7 @@ SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t * return TRUE; } -SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_detector_t * detector, float measurement, float rtt_avg) +SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_detector_t * detector, float measurement, float avg) { float K=0; float P=0; @@ -153,8 +153,8 @@ SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_de detector->N++; current_average = detector->last_average + (measurement - detector->last_average)/detector->N ; - if (rtt_avg > current_average) { - current_average = rtt_avg; + if (avg > current_average) { + current_average = avg; } current_q = detector-> last_q + (measurement - detector->last_average) * (measurement - current_average); if (detector->N != 0) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 199c9e95f7..aa25ea1c79 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1953,7 +1953,7 @@ static void rtcp_stats_init(switch_rtp_t *rtp_session) rtp_session->detectors[EST_RTT] = switch_core_alloc(rtp_session->pool, sizeof(*detectors[0])); switch_kalman_cusum_init(rtp_session->detectors[EST_RTT],0.005,0.5); rtp_session->detectors[EST_LOSS] = switch_core_alloc(rtp_session->pool, sizeof(*detectors[0])); - switch_kalman_cusum_init(rtp_session->detectors[EST_LOSS],0.005,0.5); + switch_kalman_cusum_init(rtp_session->detectors[EST_LOSS], 0.5, 1); } } From 7428752a864b46ffe891e2d9a40061040d52417f Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Fri, 22 May 2020 15:02:00 -0600 Subject: [PATCH 284/655] .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e8168cabef..0445d4ca01 100644 --- a/.gitignore +++ b/.gitignore @@ -102,6 +102,7 @@ Release/ /build/config/ltmain.sh /build/config/missing /build/freeswitch.pc +/build/standalone_module/freeswitch.pc /build/getlib.sh /build/getg729.sh /build/getsounds.sh From 761d5310fd13bd6f1ad74fe545627cfaff0482ae Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 15 Apr 2020 19:03:21 +0000 Subject: [PATCH 285/655] [core] make auto mean cpu * 3 / 2 --- src/include/switch_utils.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 41b2436538..ec361a9885 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1144,10 +1144,7 @@ static inline uint32_t switch_parse_cpu_string(const char *cpu) if (!cpu) return 1; if (!strcasecmp(cpu, "auto")) { - if (cpu_count > 4) return 4; - if (cpu_count <= 2) return 1; - - return (uint32_t)(cpu_count / 2); + return (uint32_t)((cpu_count * 3) / 2); } if (!strncasecmp(cpu, "cpu/", 4)) { /* cpu/2 or cpu/2/<max> */ From f74e2a962c922bca5e1624e3a7e497d14bfa5538 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 10 Apr 2020 18:44:25 +0000 Subject: [PATCH 286/655] [core] add switch_filecmp --- src/include/switch_utils.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index ec361a9885..e5a794282a 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1280,6 +1280,31 @@ static inline switch_bool_t switch_is_file_path(const char *file) return r ? SWITCH_TRUE : SWITCH_FALSE; } +static inline int switch_filecmp(const char *a, const char *b) +{ + const char *e; + + if (zstr(a) || zstr(b)) { + return -1; + } + + while(*a == '{') { + if ((e = switch_find_end_paren(a, '{', '}'))) { + a = e + 1; + while(*a == ' ') a++; + } + } + + while(*b == '{') { + if ((e = switch_find_end_paren(b, '{', '}'))) { + b = e + 1; + while(*b == ' ') b++; + } + } + + return strcmp(a, b); +} + static inline const char *switch_parse_audio_col(switch_audio_col_t col) { From fd747684a499fbca96c8cf444ccf662733530b68 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Mon, 13 Apr 2020 23:15:47 +0000 Subject: [PATCH 287/655] [mod_av] fix interrupt callback is not passed down to the hls context in the first open_input --- src/mod/applications/mod_av/avformat.c | 48 ++++++++++++++++++++------ 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 4ae98a1594..2f80fb0952 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -342,12 +342,27 @@ static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt) } } +static int interrupt_cb(void *cp) +{ + av_file_context_t *context = (av_file_context_t *) cp; + + if (context->closed) { + return 1; + } + + return 0; +} + + static int mod_avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat, - const char *format, const char *filename) + const char *format, const char *filename, av_file_context_t *context) { AVFormatContext *s = avformat_alloc_context(); int ret = 0; + s->interrupt_callback.callback = interrupt_cb; + s->interrupt_callback.opaque = context; + *avctx = NULL; if (!s) goto nomem; @@ -1122,16 +1137,31 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h int error; int i, idx = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; - + // av_dict_set(&opts, "c:v", "libvpx", 0); /** Open the input file to read from it. */ - if ((error = avformat_open_input(&context->fc, filename, NULL, NULL)) < 0) { - char ebuf[255] = ""; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open input file '%s' (error '%s')\n", filename, get_error_text(error, ebuf, sizeof(ebuf))); + + if (!context->fc) { + context->fc = avformat_alloc_context(); + } + + if (!context->fc) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open input file '%s' (error '%s')\n", filename, "NO MEM"); switch_goto_status(SWITCH_STATUS_FALSE, err); } + context->fc->interrupt_callback.callback = interrupt_cb; + context->fc->interrupt_callback.opaque = context; + + if ((error = avformat_open_input(&context->fc, filename, NULL, NULL)) < 0) { + char ebuf[255] = ""; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open input file '%s' (error '%s')\n", filename, get_error_text(error, ebuf, sizeof(ebuf))); + avformat_free_context(context->fc); + context->fc = NULL; + switch_goto_status(SWITCH_STATUS_FALSE, err); + } + handle->seekable = context->fc->iformat->read_seek2 ? 1 : (context->fc->iformat->read_seek ? 1 : 0); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "file %s is %sseekable\n", filename, handle->seekable ? "" : "not "); @@ -1324,7 +1354,7 @@ static void *SWITCH_THREAD_FUNC file_read_thread_run(switch_thread_t *thread, vo int error; int sync = 0; int eof = 0; - + switch_mutex_lock(context->mutex); context->file_read_thread_started = 1; context->file_read_thread_running = 1; @@ -1542,9 +1572,6 @@ GCC_DIAG_ON(deprecated-declarations) context->vid_ready = 1; switch_queue_push(context->eh.video_queue, img); context->last_vid_push = switch_time_now(); - - - } } } @@ -1743,7 +1770,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa return SWITCH_STATUS_SUCCESS; } - mod_avformat_alloc_output_context2(&context->fc, NULL, format, (char *)file); + mod_avformat_alloc_output_context2(&context->fc, NULL, format, (char *)file, context); if (!context->fc) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not deduce output format from file extension\n"); @@ -2581,6 +2608,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f context->vid_ready = 1; return SWITCH_STATUS_SUCCESS; } + return SWITCH_STATUS_BREAK; } } From 2ceec0b7f841b7171e73954d73ac141629ea2c67 Mon Sep 17 00:00:00 2001 From: wangxiaoli <wangxiaoli@x-y-t.cn> Date: Fri, 12 Apr 2019 13:50:47 +0800 Subject: [PATCH 288/655] [mod_av] print I-frame --- src/mod/applications/mod_av/mod_av.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_av/mod_av.c b/src/mod/applications/mod_av/mod_av.c index 4716b60804..5d93d9adc7 100644 --- a/src/mod/applications/mod_av/mod_av.c +++ b/src/mod/applications/mod_av/mod_av.c @@ -119,7 +119,21 @@ static void log_callback(void *ptr, int level, const char *fmt, va_list vl) } // switch_level = SWITCH_LOG_ERROR; // hardcoded for debug - switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, switch_level, fmt, vl); + if (mod_av_globals.debug < 7) { + switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, switch_level, fmt, vl); + } else { + char buffer[1024] = {0}; + char *s = NULL; + vsprintf(buffer, fmt, vl); + s = strstr(buffer, "nal_unit_type"); + if (!zstr(s) && *(s+15) == '7') { + switch_log_printf(SWITCH_CHANNEL_LOG, switch_level, "Read SPS\n"); + } else if (!zstr(s) && *(s+15) == '8') { + switch_log_printf(SWITCH_CHANNEL_LOG, switch_level, "Read PPS\n"); + } else if (!zstr(s) && *(s+15) == '5') { + switch_log_printf(SWITCH_CHANNEL_LOG, switch_level, "Read I-frame\n"); + } + } } From 243fc44f45e4f472beba77269772f9b9f10bdbf7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 22 May 2020 00:36:03 +0000 Subject: [PATCH 289/655] [mod_httapi, mod_http_cache] pass through seek values tracked in handle on proxy file handles --- src/mod/applications/mod_httapi/mod_httapi.c | 12 +++++++++-- .../mod_http_cache/mod_http_cache.c | 21 +++++++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index cc2c857a58..86a05bb258 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2885,13 +2885,21 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char static switch_status_t http_file_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) { http_file_context_t *context = handle->private_info; - + switch_status_t status; + if (!handle->seekable) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); return SWITCH_STATUS_NOTIMPL; } - return switch_core_file_seek(&context->fh, cur_sample, samples, whence); + if ((status = switch_core_file_seek(&context->fh, cur_sample, samples, whence)) == SWITCH_STATUS_SUCCESS) { + handle->pos = context->fh.pos; + handle->offset_pos = context->fh.offset_pos; + handle->samples_in = context->fh.samples_in; + handle->samples_out = context->fh.samples_out; + } + + return status; } static switch_status_t file_open(switch_file_handle_t *handle, const char *path, int is_https) 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 dcf1d7bff5..3e6d1b0fa8 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -1936,13 +1936,22 @@ static switch_status_t http_file_close(switch_file_handle_t *handle) static switch_status_t http_cache_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) { - struct http_context *context = (struct http_context *)handle->private_info; + struct http_context *context = (struct http_context *)handle->private_info; + switch_status_t status; + + if (!handle->seekable) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); + return SWITCH_STATUS_NOTIMPL; + } - if (!handle->seekable) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); - return SWITCH_STATUS_NOTIMPL; - } - return switch_core_file_seek(&context->fh, cur_sample, samples, whence); + if ((status = switch_core_file_seek(&context->fh, cur_sample, samples, whence)) == SWITCH_STATUS_SUCCESS) { + handle->pos = context->fh.pos; + handle->offset_pos = context->fh.offset_pos; + handle->samples_in = context->fh.samples_in; + handle->samples_out = context->fh.samples_out; + } + + return status; } static char *http_supported_formats[] = { "http", NULL }; From 182a9cd1d50dfd9970fc01581340b05bee729edd Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 22 May 2020 00:35:27 +0000 Subject: [PATCH 290/655] [mod_imagick] improve log line --- src/mod/formats/mod_imagick/mod_imagick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/formats/mod_imagick/mod_imagick.c b/src/mod/formats/mod_imagick/mod_imagick.c index ee702fa259..ce789637cf 100644 --- a/src/mod/formats/mod_imagick/mod_imagick.c +++ b/src/mod/formats/mod_imagick/mod_imagick.c @@ -273,9 +273,9 @@ static switch_status_t imagick_file_open(switch_file_handle_t *handle, const cha } if (context->lazy) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening File %s, read the first %d page(s)", path, context->lazy); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening File %s, read the first %d page(s)\n", path, context->lazy); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening File %s", path); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening File %s\n", path); } return SWITCH_STATUS_SUCCESS; From e2a53bdcb8b6cd179045b0ee958a5c2bff2890fd Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 1 Apr 2020 03:00:54 +0000 Subject: [PATCH 291/655] [mod_signalwire] add configurable stun port --- .../mod_signalwire/mod_signalwire.c | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_signalwire/mod_signalwire.c b/src/mod/applications/mod_signalwire/mod_signalwire.c index cabdf4bcc1..466adfa745 100644 --- a/src/mod/applications/mod_signalwire/mod_signalwire.c +++ b/src/mod/applications/mod_signalwire/mod_signalwire.c @@ -76,6 +76,7 @@ static struct { char blade_bootstrap[1024]; char adoption_service[1024]; char stun_server[1024]; + switch_port_t stun_port; char adoption_token[64]; char override_context[64]; ks_size_t adoption_backoff; @@ -319,7 +320,7 @@ static ks_status_t mod_signalwire_adoption_post(void) external_ip = globals.adoption_data_local_ip; external_port = local_port; - if (switch_stun_lookup(&external_ip, &external_port, globals.stun_server, SWITCH_STUN_DEFAULT_PORT, &error, pool) != SWITCH_STATUS_SUCCESS) { + if (switch_stun_lookup(&external_ip, &external_port, globals.stun_server, globals.stun_port, &error, pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SignalWire adoption failed: stun [%s] lookup error: %s\n", globals.stun_server, error); status = KS_STATUS_FAIL; goto done; @@ -714,7 +715,8 @@ static switch_status_t load_config() switch_set_string(globals.blade_bootstrap, "edge.<space>.signalwire.com/api/relay/wss"); switch_set_string(globals.adoption_service, "https://adopt.signalwire.com/adoption"); switch_set_string(globals.stun_server, "stun.freeswitch.org"); - + globals.stun_port = SWITCH_STUN_DEFAULT_PORT; + if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "open of %s failed\n", cf); // don't need the config @@ -736,7 +738,20 @@ static switch_status_t load_config() } else if (!strcasecmp(var, "adoption-service") && !ks_zstr(val)) { switch_set_string(globals.adoption_service, val); } else if (!strcasecmp(var, "stun-server") && !ks_zstr(val)) { - switch_set_string(globals.stun_server, val); + char *p, *ss = strdup(val); + + if ((p = strchr(ss, ':'))) { + int port; + *p++ = '\0'; + + port = atoi(p); + if (port > 0 && port < 65536) { + globals.stun_port = port; + } + } + + switch_set_string(globals.stun_server, ss); + switch_safe_free(ss); } else if (!strcasecmp(var, "ssl-verify")) { globals.ssl_verify = switch_true(val) ? 1 : 0; } else if (!strcasecmp(var, "override-context") && !ks_zstr(val)) { @@ -1181,7 +1196,7 @@ static void mod_signalwire_state_configure(void) external_ip = local_ip; external_port = local_port; - if (switch_stun_lookup(&external_ip, &external_port, globals.stun_server, SWITCH_STUN_DEFAULT_PORT, &error, pool) != SWITCH_STATUS_SUCCESS) { + if (switch_stun_lookup(&external_ip, &external_port, globals.stun_server, globals.stun_port, &error, pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SignalWire configure failed: stun [%s] lookup error: %s\n", globals.stun_server, error); ks_sleep_ms(4000); goto done; From 1cbb2e6fc38309da27128aea2827afca92d8234d Mon Sep 17 00:00:00 2001 From: wangxiaoli <wangxiaoli@x-y-t.cn> Date: Thu, 11 Apr 2019 17:09:52 +0800 Subject: [PATCH 292/655] [mod_openh264, mod_av] add avcodec and openh264 debug --- src/mod/applications/mod_av/avcodec.c | 6 ++++++ src/mod/codecs/mod_openh264/mod_openh264.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index 01c862cf11..827df4df6b 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -1764,6 +1764,12 @@ static switch_status_t switch_h264_control(switch_codec_t *codec, h264_codec_context_t *context = (h264_codec_context_t *)codec->private_info; switch(cmd) { + case SCC_DEBUG: + { + int32_t level = *((uint32_t *) cmd_data); + mod_av_globals.debug = level; + } + break; case SCC_VIDEO_GEN_KEYFRAME: context->need_key_frame = 1; break; diff --git a/src/mod/codecs/mod_openh264/mod_openh264.cpp b/src/mod/codecs/mod_openh264/mod_openh264.cpp index 8770a71818..be92f63b7f 100644 --- a/src/mod/codecs/mod_openh264/mod_openh264.cpp +++ b/src/mod/codecs/mod_openh264/mod_openh264.cpp @@ -77,6 +77,7 @@ typedef struct h264_codec_context_s { switch_bool_t last_received_complete_picture; switch_codec_settings_t codec_settings; unsigned int bandwidth; + int32_t debug; } h264_codec_context_t; int FillSpecificParameters(h264_codec_context_t *context) { @@ -745,6 +746,12 @@ static switch_status_t switch_h264_control(switch_codec_t *codec, h264_codec_context_t *context = (h264_codec_context_t *)codec->private_info; switch(cmd) { + case SCC_DEBUG: + { + int32_t level = *((uint32_t *) cmd_data); + context->debug = level; + } + break; case SCC_VIDEO_GEN_KEYFRAME: context->need_key_frame = 1; break; From cc68179d2b8847b99050317b9ab7bee116dbacff Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Thu, 4 Jun 2020 02:14:51 +0000 Subject: [PATCH 293/655] [mod_sofia] add sip_ignore_remote_cid var to ignore remote display update --- src/mod/endpoints/mod_sofia/sofia.c | 35 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index bcf72e2b7d..f31367a04c 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1230,30 +1230,33 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro number = (char *) switch_channel_get_variable(channel, num_var); name = (char *) switch_channel_get_variable(channel, name_var); - if (zstr(number) && sip->sip_to) { number = sip->sip_to->a_url->url_user; } - if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Display-Number"))) { - number = val; + if (switch_channel_var_true(channel, "sip_ignore_remote_cid")) { fs++; - } + } else { + if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Display-Number"))) { + number = val; + fs++; + } - if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Display-Name"))) { - name = (char *) val; - check_decode(name, session); - fs++; - } + if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Display-Name"))) { + name = (char *) val; + check_decode(name, session); + fs++; + } - if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Lazy-Attended-Transfer"))) { - lazy = switch_true(val); - fs++; - } + if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Lazy-Attended-Transfer"))) { + lazy = switch_true(val); + fs++; + } - if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Attended-Transfer"))) { - att = switch_true(val); - fs++; + if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Attended-Transfer"))) { + att = switch_true(val); + fs++; + } } if (!fs) { From 6e68da49302978a293ba3b58c5a3a726354c006c Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Fri, 14 Dec 2018 20:54:03 +0000 Subject: [PATCH 294/655] [core] reduce waits in sqldb --- src/switch_core_sqldb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 19f80aaf9f..7bf612b7d5 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1630,6 +1630,7 @@ struct switch_sql_queue_manager { uint32_t max_trans; uint32_t confirm; uint8_t paused; + int skip_wait; }; static int qm_wake(switch_sql_queue_manager_t *qm) @@ -1647,6 +1648,7 @@ static int qm_wake(switch_sql_queue_manager_t *qm) return 1; } else { if (switch_mutex_trylock(qm->cond2_mutex) == SWITCH_STATUS_SUCCESS) { + qm->skip_wait++; switch_mutex_unlock(qm->cond2_mutex); } else { if (++tries < 10) { @@ -2351,7 +2353,11 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, if ((lc = qm_ttl(qm)) == 0) { switch_mutex_lock(qm->cond2_mutex); - switch_thread_cond_wait(qm->cond, qm->cond_mutex); + if (qm->skip_wait > 0) { + qm->skip_wait--; + } else { + switch_thread_cond_wait(qm->cond, qm->cond_mutex); + } switch_mutex_unlock(qm->cond2_mutex); } From 531f2f013517b8c8ba02679f537bed2c4eafd5e7 Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Fri, 3 Apr 2020 12:53:58 -0600 Subject: [PATCH 295/655] [core] url decode video render text --- src/switch_core_video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 2f7b07d4bd..7dbd685d6e 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -2204,6 +2204,8 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_ font_size = atoi(fontsz); } + switch_url_decode(txt); + while (*txt == ' ') txt++; while (end_of(txt) == ' ') end_of(txt) = '\0'; From 2ba85b8555cfe345ef51f618c483b91061446bd7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Tue, 3 Dec 2019 20:10:50 +0000 Subject: [PATCH 296/655] [core] add idle cpu to log lines --- src/switch_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_log.c b/src/switch_log.c index ad74862f6d..93fcc5ec37 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -559,8 +559,8 @@ SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const cha switch_time_exp_t tm; switch_time_exp_lt(&tm, now); - switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.6d", - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec); + switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.6d %0.2f%%", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, switch_core_idle_cpu()); //switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); From 3dbf6ebee3e50b1cf921350eaa827777b153f4d3 Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Tue, 9 Jun 2020 19:17:30 -0600 Subject: [PATCH 297/655] .gitignore --- tests/unit/.gitignore | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore index 6f51971040..630dbd1775 100644 --- a/tests/unit/.gitignore +++ b/tests/unit/.gitignore @@ -38,6 +38,8 @@ switch_utils switch_vad switch_vpx switch_xml +switch_estimators +switch_jitter_buffer .deps/ Makefile cluecon-argb-write.png @@ -46,7 +48,5 @@ cluecon-jpg-write.jpg cluecon-jpg.png cluecon-rgb-write.png cluecon-rgb.png -conf/20553/ -conf/20636/ -conf/20683/ -conf/5374/ +conf/*/ +conf_playsay/*/ From c4b8f1a8d10c2b628a63e83478ea0b188e252b9d Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Tue, 9 Jun 2020 19:18:24 -0600 Subject: [PATCH 298/655] .gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 0445d4ca01..3ad88ef734 100644 --- a/.gitignore +++ b/.gitignore @@ -272,3 +272,8 @@ src/mod/*/*/test/[0-9]*/* test-suite.log src/mod/applications/mod_av/test/test_BT7.mp4 src/mod/applications/mod_av/test/test_RGB.mp4 +images/test-argb.png +images/test-rgb.png +images/test.png +images/test_patched.png +images/test_text.png From fc8d4318790a5528e7f27279ac1a350ac622cd1b Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Wed, 10 Jun 2020 11:11:55 -0600 Subject: [PATCH 299/655] [mod_av] dont leak avformat context in error cases --- src/mod/applications/mod_av/avformat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 2f80fb0952..94dd545c6f 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1157,8 +1157,6 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h if ((error = avformat_open_input(&context->fc, filename, NULL, NULL)) < 0) { char ebuf[255] = ""; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open input file '%s' (error '%s')\n", filename, get_error_text(error, ebuf, sizeof(ebuf))); - avformat_free_context(context->fc); - context->fc = NULL; switch_goto_status(SWITCH_STATUS_FALSE, err); } @@ -1334,6 +1332,11 @@ GCC_DIAG_ON(deprecated-declarations) return status; err: + if (context->fc) { + avformat_free_context(context->fc); + context->fc = NULL; + } + /* if (context->has_video) close_stream(context->fc, &context->video_st); if (context->has_audio) close_stream(context->fc, &context->audio_st); From 1984e88f6adf74cc4872c74f0c4b1ca94a46605a Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 10 Jun 2020 04:34:49 +0400 Subject: [PATCH 300/655] [Build-System] Sign FreeSWITCH MSI Package with the Code Signing Certificate on Windows. --- w32/Setup/Setup.2017.wixproj | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/w32/Setup/Setup.2017.wixproj b/w32/Setup/Setup.2017.wixproj index 5f77b94298..8b91ec3e37 100644 --- a/w32/Setup/Setup.2017.wixproj +++ b/w32/Setup/Setup.2017.wixproj @@ -13,6 +13,10 @@ <SchemaVersion>2.0</SchemaVersion> <OutputName>FreeSWITCH</OutputName> <OutputType>Package</OutputType> + <CertificateThumbprint>bf386393c880967b00adbc438aee534de6211774</CertificateThumbprint> + <TimestampUrl>http://timestamp.comodoca.com</TimestampUrl> + <SignToolPath Condition=" Exists('$(WindowsSDK80Path)bin\x86\signtool.exe') and '$(SignToolPath)'=='' and '$(PROCESSOR_ARCHITECTURE)'=='x86' ">$(WindowsSDK80Path)bin\x86\signtool.exe</SignToolPath> + <SignToolPath Condition=" Exists('$(WindowsSDK80Path)bin\x64\signtool.exe') and '$(SignToolPath)'=='' and '$(PROCESSOR_ARCHITECTURE)'=='AMD64' ">$(WindowsSDK80Path)bin\x64\signtool.exe</SignToolPath> <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> </PropertyGroup> @@ -1005,8 +1009,30 @@ <Message Importance="High" Text="Deleting previously created MSI files." /> <Delete Files="$(OutputPath)$(OutputName).msi" /> <Delete Files="$(DestinationFileName)" /> - - <HeatDirectory + <CreateItem Include="$(SolutionDir)$(UserFriendlyPlatform)\$(Configuration)\f*.exe"> + <Output ItemName="ExeFiles" TaskParameter="Include" /> + </CreateItem> + <CreateItem Include="$(SolutionDir)$(UserFriendlyPlatform)\$(Configuration)\mod\*.dll"> + <Output ItemName="Modules" TaskParameter="Include" /> + </CreateItem> + <Message Importance="High" Text="Signing FreeSWITCH Core Library" /> + <SignFile ContinueOnError="WarnAndContinue" + CertificateThumbprint="$(CertificateThumbprint)" + TimestampUrl="$(TimestampUrl)" + SigningTarget="$(SolutionDir)$(UserFriendlyPlatform)\$(Configuration)\FreeSwitch.dll" + TargetFrameworkVersion="v4.5" /> + <Message Importance="High" Text="Signing FreeSWITCH Executables" /> + <SignFile ContinueOnError="WarnAndContinue" + CertificateThumbprint="$(CertificateThumbprint)" + TimestampUrl="$(TimestampUrl)" + SigningTarget="%(ExeFiles.Identity)" + TargetFrameworkVersion="v4.5" /> + <Message Importance="High" Text="Signing FreeSWITCH Modules" /> + <SignFile ContinueOnError="WarnAndContinue" + CertificateThumbprint="$(CertificateThumbprint)" + SigningTarget="%(Modules.Identity)" + TargetFrameworkVersion="v4.5" /> + <HeatDirectory ToolPath="$(WixToolPath)" OutputFile="$(ProjectDir)Fragments\FreeSWITCHConfFiles.wxs" Directory="$(ProjectDir)..\..\conf\vanilla" @@ -1101,6 +1127,10 @@ </Target> <Target Name="AfterBuild"> <Copy SourceFiles="$(OutputPath)$(OutputName).msi" DestinationFiles="$(DestinationFileName)" /> + <Message Importance="High" Text="Signing FreeSWITCH MSI Package" /> + <Exec ContinueOnError="WarnAndContinue" + Command="&quot;$(SignToolPath)&quot; sign /fd sha256 /sha1 $(CertificateThumbprint) /t &quot;$(TimestampUrl)&quot; &quot;$(DestinationFileName)&quot;" + StandardOutputImportance="high" /> <Message Importance="High" Condition="Exists('$(DestinationFileName)')" Text="Success. An output MSI has been copied to $(DestinationFileName)" /> </Target> </Project> \ No newline at end of file From e173578a788284365986542a7c33a7bc778ec638 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 12 Jun 2020 14:12:46 +0400 Subject: [PATCH 301/655] [Build-System] Sign FreeSWITCH modules with timestamp on Windows when new version is released. --- w32/Setup/Setup.2017.wixproj | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/w32/Setup/Setup.2017.wixproj b/w32/Setup/Setup.2017.wixproj index 8b91ec3e37..8b6b616b2d 100644 --- a/w32/Setup/Setup.2017.wixproj +++ b/w32/Setup/Setup.2017.wixproj @@ -1028,10 +1028,15 @@ SigningTarget="%(ExeFiles.Identity)" TargetFrameworkVersion="v4.5" /> <Message Importance="High" Text="Signing FreeSWITCH Modules" /> - <SignFile ContinueOnError="WarnAndContinue" + <SignFile Condition="'$(GitCommits)' != '0'" ContinueOnError="WarnAndContinue" CertificateThumbprint="$(CertificateThumbprint)" SigningTarget="%(Modules.Identity)" TargetFrameworkVersion="v4.5" /> + <SignFile Condition="'$(GitCommits)' == '0'" ContinueOnError="WarnAndContinue" + CertificateThumbprint="$(CertificateThumbprint)" + TimestampUrl="$(TimestampUrl)" + SigningTarget="%(Modules.Identity)" + TargetFrameworkVersion="v4.5" /> <HeatDirectory ToolPath="$(WixToolPath)" OutputFile="$(ProjectDir)Fragments\FreeSWITCHConfFiles.wxs" @@ -1045,7 +1050,7 @@ SuppressFragments="true" PreprocessorVariable="var.FreeSWITCHConfFilesDir"> </HeatDirectory> - <HeatDirectory + <HeatDirectory ToolPath="$(WixToolPath)" OutputFile="$(ProjectDir)Fragments\FreeSWITCHSoundFiles8.wxs" Directory="$(SoundsDir)" @@ -1058,7 +1063,7 @@ SuppressFragments="true" PreprocessorVariable="var.FreeSWITCHSoundFilesDir"> </HeatDirectory> - <HeatDirectory + <HeatDirectory ToolPath="$(WixToolPath)" OutputFile="$(ProjectDir)Fragments\FreeSWITCHhtdocsFilesDir.wxs" Directory="$(ProjectDir)..\..\htdocs" @@ -1071,7 +1076,7 @@ SuppressFragments="true" PreprocessorVariable="var.FreeSWITCHhtdocsFilesDir"> </HeatDirectory> - <HeatDirectory + <HeatDirectory ToolPath="$(WixToolPath)" OutputFile="$(ProjectDir)Fragments\FreeSWITCHimagesFilesDir.wxs" Directory="$(ProjectDir)..\..\images" @@ -1084,7 +1089,7 @@ SuppressFragments="true" PreprocessorVariable="var.FreeSWITCHimagesFilesDir"> </HeatDirectory> - <HeatDirectory + <HeatDirectory ToolPath="$(WixToolPath)" OutputFile="$(ProjectDir)Fragments\FreeSWITCHfontsFilesDir.wxs" Directory="$(ProjectDir)..\..\fonts" @@ -1097,7 +1102,7 @@ SuppressFragments="true" PreprocessorVariable="var.FreeSWITCHfontsFilesDir"> </HeatDirectory> - <HeatDirectory + <HeatDirectory ToolPath="$(WixToolPath)" OutputFile="$(ProjectDir)Fragments\FreeSWITCHgrammarFilesDir.wxs" Directory="$(SolutionDir)$(UserFriendlyPlatform)\$(Configuration)\grammar" @@ -1110,7 +1115,7 @@ SuppressFragments="true" PreprocessorVariable="var.FreeSWITCHgrammarFilesDir"> </HeatDirectory> - <HeatDirectory + <HeatDirectory ToolPath="$(WixToolPath)" OutputFile="$(ProjectDir)Fragments\FreeSWITCHBaseFiles.wxs" Directory="$(SolutionDir)$(UserFriendlyPlatform)\$(Configuration)" From e237d08073d8220ed7bd639b501c48416d75e77c Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@x-y-t.cn> Date: Wed, 1 Apr 2020 15:31:42 +0800 Subject: [PATCH 302/655] [mod_dptools] add debug_media app --- .../applications/mod_dptools/mod_dptools.c | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index b365fc685b..079487f9e7 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -6328,6 +6328,52 @@ SWITCH_STANDARD_APP(vad_test_function) switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); } +#define DEBUG_MEDIA_SYNTAX "<read|write|both|vread|vwrite|vboth|all> <on|off>" +SWITCH_STANDARD_APP(debug_media_function) +{ + char *mycmd = NULL, *argv[2] = { 0 }; + int argc = 0; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (!zstr(data) && (mycmd = strdup(data))) { + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (zstr(data) || argc < 2 || zstr(argv[0]) || zstr(argv[1])) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "USAGE: %s\n", DEBUG_MEDIA_SYNTAX); + goto done; + } else { + switch_core_session_message_t msg = { 0 }; + + msg.message_id = SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA; + msg.string_array_arg[0] = argv[0]; + msg.string_array_arg[1] = argv[1]; + msg.from = __FILE__; + + if (!strcasecmp(argv[0], "all")) { + msg.string_array_arg[0] = "both"; + } + + again: + status = switch_core_session_receive_message(session, &msg); + + if (status == SWITCH_STATUS_SUCCESS && !strcasecmp(argv[0], "all") && !strcmp(msg.string_array_arg[0], "both")) { + msg.string_array_arg[0] = "vboth"; + goto again; + } + } + + if (status == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "media debug on\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "error to turn on media debug status=%d\n", status); + } + + done: + + switch_safe_free(mycmd); +} + #define SPEAK_DESC "Speak text to a channel via the tts interface" #define DISPLACE_DESC "Displace audio from a file to the channels input" #define SESS_REC_DESC "Starts a background recording of the entire session" @@ -6669,6 +6715,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "deduplicate_dtmf", "Prevent duplicate inband + 2833 dtmf", "", deduplicate_dtmf_app_function, "[only_rtp]", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "vad_test", "VAD test", "VAD test, mode = -1(default), 0, 1, 2, 3", vad_test_function, "[mode]", SAF_NONE); + SWITCH_ADD_APP(app_interface, "debug_media", "Debug Media", "Debug Media", debug_media_function, DEBUG_MEDIA_SYNTAX, SAF_SUPPORT_NOMEDIA); SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt); From ed9851666615d283effb76edc7028cc08b07eff9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Wed, 25 Mar 2020 03:49:19 +0400 Subject: [PATCH 303/655] [mod_verto] move websocket implementation to libks --- conf/vanilla/autoload_configs/verto.conf.xml | 1 + src/mod/endpoints/mod_verto/Makefile.am | 6 +- .../mod_verto/mod_verto.2017.vcxproj | 7 +- src/mod/endpoints/mod_verto/mod_verto.c | 352 +++--- src/mod/endpoints/mod_verto/mod_verto.h | 12 +- src/mod/endpoints/mod_verto/ws.c | 1097 ----------------- src/mod/endpoints/mod_verto/ws.h | 143 --- w32/libks.props | 2 +- 8 files changed, 195 insertions(+), 1425 deletions(-) delete mode 100644 src/mod/endpoints/mod_verto/ws.c delete mode 100644 src/mod/endpoints/mod_verto/ws.h diff --git a/conf/vanilla/autoload_configs/verto.conf.xml b/conf/vanilla/autoload_configs/verto.conf.xml index 899aaeb6c2..91f75f11e9 100644 --- a/conf/vanilla/autoload_configs/verto.conf.xml +++ b/conf/vanilla/autoload_configs/verto.conf.xml @@ -2,6 +2,7 @@ <settings> <param name="debug" value="0"/> + <!-- <param name="kslog" value="true"/> --> <!-- seconds to wait before hanging up a disconnected channel --> <!-- <param name="detach-timeout-sec" value="120"/> --> <!-- enable broadcasting all FreeSWITCH events in Verto --> diff --git a/src/mod/endpoints/mod_verto/Makefile.am b/src/mod/endpoints/mod_verto/Makefile.am index 2c8f4f2334..6eeac1e6a8 100644 --- a/src/mod/endpoints/mod_verto/Makefile.am +++ b/src/mod/endpoints/mod_verto/Makefile.am @@ -2,10 +2,10 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_verto mod_LTLIBRARIES = mod_verto.la -mod_verto_la_SOURCES = mod_verto.c ws.c mcast/mcast.c -mod_verto_la_CFLAGS = -D__EXTENSIONS__ -D_GNU_SOURCE $(AM_CFLAGS) +mod_verto_la_SOURCES = mod_verto.c mcast/mcast.c +mod_verto_la_CFLAGS = -D__EXTENSIONS__ -D_GNU_SOURCE $(AM_CFLAGS) $(KS_CFLAGS) mod_verto_la_CPPFLAGS = -I. -I$(switch_srcdir)/src/mod/endpoints/mod_verto/mcast -mod_verto_la_LIBADD = $(switch_builddir)/libfreeswitch.la +mod_verto_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(KS_LIBS) mod_verto_la_LDFLAGS = -avoid-version -module -no-undefined -shared if HAVE_PERL diff --git a/src/mod/endpoints/mod_verto/mod_verto.2017.vcxproj b/src/mod/endpoints/mod_verto/mod_verto.2017.vcxproj index 3b82a87672..ff3b53037f 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.2017.vcxproj +++ b/src/mod/endpoints/mod_verto/mod_verto.2017.vcxproj @@ -47,6 +47,7 @@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="..\..\..\..\w32\openssl.props" /> + <Import Project="$(SolutionDir)\w32\libks.props" Condition=" '$(libksPropsImported)' == '' " /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> @@ -135,12 +136,6 @@ </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="mod_verto.c" /> - <ClCompile Include="ws.c"> - <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">6386;4267;4244;6031;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">6386;4267;4244;6031;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">6386;4267;4244;6031;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings> - <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">6386;4267;4244;6031;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> <ClCompile Include="mcast\mcast.c" /> <ClCompile Include="mcast\mcast_cpp.cpp" /> </ItemGroup> diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 230d0ff615..0e350bf16f 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -33,7 +33,6 @@ #include <switch_json.h> #include <switch_stun.h> - /* Prototypes */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_verto_shutdown); SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load); @@ -41,11 +40,11 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_verto_runtime); SWITCH_MODULE_DEFINITION(mod_verto, mod_verto_load, mod_verto_shutdown, mod_verto_runtime); +#define HTTP_CHUNK_SIZE 1024 * 32 #define EP_NAME "verto.rtc" //#define WSS_STANDALONE 1 -#include "ws.h" +#include "ks.h" -////////////////////////// #include <mod_verto.h> #ifndef WIN32 #include <sys/param.h> @@ -151,21 +150,21 @@ static void verto_deinit_ssl(verto_profile_t *profile) } } -static void close_file(ws_socket_t *sock) +static void close_file(ks_socket_t *sock) { - if (*sock != ws_sock_invalid) { + if (*sock != KS_SOCK_INVALID) { #ifndef WIN32 close(*sock); #else closesocket(*sock); #endif - *sock = ws_sock_invalid; + *sock = KS_SOCK_INVALID; } } -static void close_socket(ws_socket_t *sock) +static void close_socket(ks_socket_t *sock) { - if (*sock != ws_sock_invalid) { + if (*sock != KS_SOCK_INVALID) { shutdown(*sock, 2); close_file(sock); } @@ -608,7 +607,7 @@ static switch_ssize_t ws_write_json(jsock_t *jsock, cJSON **json, switch_bool_t free(log_text); } switch_mutex_lock(jsock->write_mutex); - r = ws_write_frame(&jsock->ws, WSOC_TEXT, json_text, strlen(json_text)); + r = kws_write_frame(jsock->ws, WSOC_TEXT, json_text, strlen(json_text)); switch_mutex_unlock(jsock->write_mutex); switch_safe_free(json_text); } @@ -1480,52 +1479,36 @@ static void jsock_check_event_queue(jsock_t *jsock) /* DO NOT use this unless you know what you are doing, you are WARNNED!!! */ static uint8_t *http_stream_read(switch_stream_handle_t *handle, int *len) { - switch_http_request_t *r = (switch_http_request_t *) handle->data; + kws_request_t *r = (kws_request_t *) handle->data; jsock_t *jsock = r->user_data; - wsh_t *wsh = &jsock->ws; + kws_t *wsh = jsock->ws; + uint8_t *buffer = NULL; if (!jsock->profile->running) { *len = 0; return NULL; } - *len = (int)(r->bytes_buffered - r->bytes_read); - - if (*len > 0) { // we already read part of the body - uint8_t *data = (uint8_t *)wsh->buffer + r->bytes_read; - r->bytes_read = r->bytes_buffered; - return data; - } - - if (r->content_length && (r->bytes_read - r->bytes_header) >= r->content_length) { + *len = HTTP_CHUNK_SIZE; + if ((*len = (int)kws_read_buffer(wsh, &buffer, *len, 1)) < 0) { *len = 0; return NULL; } - *len = (int)(r->content_length - (r->bytes_read - r->bytes_header)); - *len = *len > sizeof(wsh->buffer) ? wsh->buflen : *len; - - if ((*len = (int)ws_raw_read(wsh, wsh->buffer, *len, wsh->block)) < 0) { - *len = 0; - return NULL; - } - - r->bytes_read += *len; - - return (uint8_t *)wsh->buffer; + return buffer; } static switch_status_t http_stream_raw_write(switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen) { - switch_http_request_t *r = (switch_http_request_t *) handle->data; + kws_request_t *r = (kws_request_t *) handle->data; jsock_t *jsock = r->user_data; - return ws_raw_write(&jsock->ws, data, (uint32_t)datalen) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; + return kws_raw_write(jsock->ws, data, (uint32_t)datalen) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } static switch_status_t http_stream_write(switch_stream_handle_t *handle, const char *fmt, ...) { - switch_http_request_t *r = (switch_http_request_t *) handle->data; + kws_request_t *r = (kws_request_t *) handle->data; jsock_t *jsock = r->user_data; int ret = 1; char *data; @@ -1537,7 +1520,7 @@ static switch_status_t http_stream_write(switch_stream_handle_t *handle, const c if (data) { if (ret) { - ret =(int) ws_raw_write(&jsock->ws, data, (uint32_t)strlen(data)); + ret =(int) kws_raw_write(jsock->ws, data, (uint32_t)strlen(data)); } switch_safe_free(data); } @@ -1545,7 +1528,7 @@ static switch_status_t http_stream_write(switch_stream_handle_t *handle, const c return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } -static void http_static_handler(switch_http_request_t *request, verto_vhost_t *vhost) +static void http_static_handler(kws_request_t *request, verto_vhost_t *vhost) { jsock_t *jsock = request->user_data; char path[512]; @@ -1553,11 +1536,16 @@ static void http_static_handler(switch_http_request_t *request, verto_vhost_t *v char *ext; uint8_t chunk[4096]; const char *mime_type = "text/html", *new_type; + switch_time_exp_t tm; + char date[80] = ""; + switch_time_t ts = switch_micro_time_now(); + switch_time_exp_lt(&tm, ts); + switch_rfc822_date(date, ts); if (strncmp(request->method, "GET", 3) && strncmp(request->method, "HEAD", 4)) { char *data = "HTTP/1.1 415 Method Not Allowed\r\n" "Content-Length: 0\r\n\r\n"; - ws_raw_write(&jsock->ws, data, strlen(data)); + kws_raw_write(jsock->ws, data, strlen(data)); return; } @@ -1587,12 +1575,12 @@ static void http_static_handler(switch_http_request_t *request, verto_vhost_t *v "Server: FreeSWITCH-%s-mod_verto\r\n" "Content-Type: %s\r\n" "Content-Length: %" SWITCH_SIZE_T_FMT "\r\n\r\n", - switch_event_get_header(request->headers, "Event-Date-GMT"), + date, switch_version_full(), mime_type, flen); - ws_raw_write(&jsock->ws, chunk, strlen((char *)chunk)); + kws_raw_write(jsock->ws, chunk, strlen((char *)chunk)); for (;;) { switch_status_t status; @@ -1604,42 +1592,49 @@ static void http_static_handler(switch_http_request_t *request, verto_vhost_t *v break; } - ws_raw_write(&jsock->ws, chunk, flen); + kws_raw_write(jsock->ws, chunk, flen); } switch_file_close(fd); } else { char *data = "HTTP/1.1 404 Not Found\r\n" "Content-Length: 0\r\n\r\n"; - ws_raw_write(&jsock->ws, data, strlen(data)); + kws_raw_write(jsock->ws, data, strlen(data)); + } +} + +static void request_headers_to_event(switch_event_t *event, kws_request_t *request) +{ + int i; + + for (i = 0; i < KWS_MAX_HEADERS; i++) { + if (!request->headers_k[i]) break; + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, request->headers_k[i], request->headers_v[i]); } } static void http_run(jsock_t *jsock) { - switch_http_request_t request = { 0 }; + kws_request_t *request = NULL; switch_stream_handle_t stream = { 0 }; char *err = NULL; char *ext; verto_vhost_t *vhost; - switch_bool_t keepalive; + ks_bool_t keepalive; new_req: - - request.user_data = jsock; - if (switch_event_create(&stream.param_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) { goto err; } - request.headers = stream.param_event; - if (switch_http_parse_header(jsock->ws.buffer, (uint32_t)jsock->ws.datalen, &request) != SWITCH_STATUS_SUCCESS) { - switch_event_destroy(&stream.param_event); + if (kws_parse_header(jsock->ws, &request) != KS_STATUS_SUCCESS) { goto err; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s [%4" SWITCH_SIZE_T_FMT "] %s\n", jsock->name, jsock->ws.datalen, request.uri); + request->user_data = jsock; - if (!strncmp(request.method, "OPTIONS", 7)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s %s\n", jsock->name, request->uri); + + if (!strncmp(request->method, "OPTIONS", 7)) { char data[512]; switch_snprintf(data, sizeof(data), "HTTP/1.1 200 OK\r\n" @@ -1647,23 +1642,32 @@ new_req: "Date: %s\r\n" "Allow: HEAD,GET,POST,PUT,DELETE,PATCH,OPTIONS\r\n" "Server: FreeSWITCH-%s-mod_verto\r\n\r\n", - switch_event_get_header(request.headers, "Event-Date-GMT"), + switch_event_get_header(stream.param_event, "Event-Date-GMT"), switch_version_full()); - ws_raw_write(&jsock->ws, data, strlen(data)); + kws_raw_write(jsock->ws, data, strlen(data)); goto done; } - if (!strncmp(request.method, "POST", 4) && request.content_length && request.content_type && - !strncmp(request.content_type, "application/x-www-form-urlencoded", 33)) { + if (request->content_length && request->content_length > 5l * 1024 * 1024 * 1024 - 1) { + char *data = "HTTP/1.1 413 Request Entity Too Large\r\n" + "Content-Length: 0\r\n\r\n"; + kws_raw_write(jsock->ws, data, strlen(data)); + request->keepalive = 0; + goto done; + } + + if (!strncmp(request->method, "POST", 4) && request->content_length && request->content_type && + !strncmp(request->content_type, "application/x-www-form-urlencoded", 33)) { char *buffer = NULL; switch_ssize_t len = 0, bytes = 0; - if (request.content_length > 2 * 1024 * 1024 - 1) { + if (request->content_length && request->content_length > 10 * 1024 * 1024 - 1) { char *data = "HTTP/1.1 413 Request Entity Too Large\r\n" "Content-Length: 0\r\n\r\n"; - ws_raw_write(&jsock->ws, data, strlen(data)); + kws_raw_write(jsock->ws, data, strlen(data)); + request->keepalive = 0; goto done; } @@ -1671,14 +1675,12 @@ new_req: goto request_err; } - if ((bytes = request.bytes_buffered - request.bytes_read) > 0) { - memcpy(buffer, jsock->ws.buffer + request.bytes_read, bytes); - } + while(bytes < (switch_ssize_t)request->content_length) { + len = request->content_length - bytes; - while(bytes < (switch_ssize_t)request.content_length) { - len = request.content_length - bytes; +#define WS_BLOCK 1 - if ((len = ws_raw_read(&jsock->ws, buffer + bytes, len, jsock->ws.block)) < 0) { + if ((len = kws_raw_read(jsock->ws, buffer + bytes, len, WS_BLOCK)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error %" SWITCH_SSIZE_T_FMT"\n", len); goto done; } @@ -1688,19 +1690,20 @@ new_req: *(buffer + bytes) = '\0'; - switch_http_parse_qs(&request, buffer); + kws_parse_qs(request, buffer); free(buffer); } - // switch_http_dump_request(&request); + // kws_request_dump(request); - stream.data = &request; + stream.data = request; stream.read_function = http_stream_read; stream.write_function = http_stream_write; stream.raw_write_function = http_stream_raw_write; + request_headers_to_event(stream.param_event, request); - switch_event_add_header_string(request.headers, SWITCH_STACK_BOTTOM, "Request-Method", request.method); - switch_event_add_header_string(request.headers, SWITCH_STACK_BOTTOM, "HTTP-Request-URI", request.uri); + switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "Request-Method", request->method); + switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-Request-URI", request->uri); if (!jsock->profile->vhosts) goto err; @@ -1711,11 +1714,11 @@ new_req: int code = CODE_AUTH_REQUIRED; char message[128] = "Authentication Required"; cJSON *params = NULL; - char *www_auth; + const char *www_auth; char auth_buffer[512]; char *auth_user = NULL, *auth_pass = NULL; - www_auth = switch_event_get_header(request.headers, "Authorization"); + www_auth = request->authorization; if (zstr(www_auth)) { switch_snprintf(auth_buffer, sizeof(auth_buffer), @@ -1723,7 +1726,7 @@ new_req: "WWW-Authenticate: Basic realm=\"%s\"\r\n" "Content-Length: 0\r\n\r\n", vhost->auth_realm); - ws_raw_write(&jsock->ws, auth_buffer, strlen(auth_buffer)); + kws_raw_write(jsock->ws, auth_buffer, strlen(auth_buffer)); goto done; } @@ -1758,7 +1761,7 @@ new_req: "WWW-Authenticate: Basic realm=\"%s\"\r\n" "Content-Length: 0\r\n\r\n", vhost->auth_realm); - ws_raw_write(&jsock->ws, auth_buffer, strlen(auth_buffer)); + kws_raw_write(jsock->ws, auth_buffer, strlen(auth_buffer)); cJSON_Delete(params); goto done; } else { @@ -1767,7 +1770,7 @@ new_req: authed: switch_set_flag(jsock, JPFLAG_AUTHED); - switch_event_add_header_string(request.headers, SWITCH_STACK_BOTTOM, "HTTP-USER", auth_user); + switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-USER", auth_user); } if (vhost->rewrites) { @@ -1779,10 +1782,10 @@ authed: while(rule) { char *expression = rule->name; - if ((proceed = switch_regex_perform(request.uri, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + if ((proceed = switch_regex_perform(request->uri, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "%d request [%s] matched expr [%s]\n", proceed, request.uri, expression); - request.uri = rule->value; + "%d request [%s] matched expr [%s]\n", proceed, request->uri, expression); + request->uri = rule->value; break; } @@ -1790,79 +1793,48 @@ authed: } } - switch_event_add_header_string(request.headers, SWITCH_STACK_BOTTOM, "HTTP-URI", request.uri); + switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-URI", request->uri); - if ((ext = strrchr(request.uri, '.'))) { + if ((ext = strrchr(request->uri, '.'))) { char path[1024]; if (!strncmp(ext, ".lua", 4)) { - switch_snprintf(path, sizeof(path), "%s%s", vhost->script_root, request.uri); + switch_snprintf(path, sizeof(path), "%s%s", vhost->script_root, request->uri); switch_api_execute("lua", path, NULL, &stream); } else { - http_static_handler(&request, vhost); + http_static_handler(request, vhost); } - } else { - http_static_handler(&request, vhost); + http_static_handler(request, vhost); } done: - keepalive = request.keepalive; - switch_http_free_request(&request); + keepalive = request->keepalive; + kws_request_free(&request); if (keepalive) { - wsh_t *wsh = &jsock->ws; - - memset(&request, 0, sizeof(request)); - wsh->datalen = 0; - *wsh->buffer = '\0'; + kws_t *wsh = jsock->ws; while(jsock->profile->running) { - int pflags; - - if (wsh->ssl && SSL_pending(wsh->ssl) > 0) { - pflags = SWITCH_POLL_READ; - } else { - pflags = switch_wait_sock(jsock->client_socket, 3000, SWITCH_POLL_READ | SWITCH_POLL_ERROR | SWITCH_POLL_HUP); - } + int pflags = kws_wait_sock(wsh, 3000, KS_POLL_READ | KS_POLL_ERROR | KS_POLL_HUP); if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); } if (pflags < 0 && (errno != EINTR)) { die_errnof("%s POLL FAILED with %d", jsock->name, pflags); } if (pflags == 0) { /* keepalive socket poll timeout */ break; } - if (pflags > 0 && (pflags & SWITCH_POLL_HUP)) { log_and_exit(SWITCH_LOG_INFO, "%s POLL HANGUP DETECTED (peer closed its end of socket)\n", jsock->name); } - if (pflags > 0 && (pflags & SWITCH_POLL_ERROR)) { die("%s POLL ERROR\n", jsock->name); } - if (pflags > 0 && (pflags & SWITCH_POLL_INVALID)) { die("%s POLL INVALID SOCKET (not opened or already closed)\n", jsock->name); } - if (pflags > 0 && (pflags & SWITCH_POLL_READ)) { - ssize_t bytes; - - bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen - 1, wsh->block); - - if (bytes < 0) { - die("%s BAD READ %" SWITCH_SIZE_T_FMT "\n", jsock->name, bytes); - break; - } - - if (bytes == 0) { - bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen - 1, wsh->block); - - if (bytes < 0) { - die("%s BAD READ %" SWITCH_SIZE_T_FMT "\n", jsock->name, bytes); - break; - } - - if (bytes == 0) { // socket broken ? - break; - } - } - - wsh->datalen += bytes; - *(wsh->buffer + wsh->datalen) = '\0'; - - if (strstr(wsh->buffer, "\r\n\r\n") || strstr(wsh->buffer, "\n\n")) { + if (pflags > 0 && (pflags & KS_POLL_HUP)) { log_and_exit(SWITCH_LOG_INFO, "%s POLL HANGUP DETECTED (peer closed its end of socket)\n", jsock->name); } + if (pflags > 0 && (pflags & KS_POLL_ERROR)) { die("%s POLL ERROR\n", jsock->name); } + if (pflags > 0 && (pflags & KS_POLL_INVALID)) { die("%s POLL INVALID SOCKET (not opened or already closed)\n", jsock->name); } + if (pflags > 0 && (pflags & KS_POLL_READ)) { + if (kws_keepalive(wsh) == KS_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "socket %s is going to handle a new request\n", jsock->name); goto new_req; + } else { + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Read Error\n"); + break; } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "unhandled flag: %d\n", pflags); } } } @@ -1870,12 +1842,12 @@ done: return; request_err: - switch_http_free_request(&request); + kws_request_free(&request); err: err = "HTTP/1.1 500 Internal Server Error\r\n" "Content-Length: 0\r\n\r\n"; - ws_raw_write(&jsock->ws, err, strlen(err)); + kws_raw_write(jsock->ws, err, strlen(err)); error: return; @@ -1883,40 +1855,46 @@ error: static void client_run(jsock_t *jsock) { - if (ws_init(&jsock->ws, jsock->client_socket, (jsock->ptype & PTYPE_CLIENT_SSL) ? jsock->profile->ssl_ctx : NULL, 0, 1, !!jsock->profile->vhosts) < 0) { - if (jsock->profile->vhosts) { - http_run(jsock); - ws_close(&jsock->ws, WS_NONE); - goto error; - } else { - log_and_exit(SWITCH_LOG_NOTICE, "%s WS SETUP FAILED\n", jsock->name); - } + int flags = KWS_BLOCK; + + if (jsock->profile->vhosts) { + flags |= KWS_STAY_OPEN; + flags |= KWS_HTTP; + } + + ks_pool_open(&jsock->kpool); + if (kws_init(&jsock->ws, jsock->client_socket, (jsock->ptype & PTYPE_CLIENT_SSL) ? jsock->profile->ssl_ctx : NULL, 0, flags, jsock->kpool) != KS_STATUS_SUCCESS) { + log_and_exit(SWITCH_LOG_NOTICE, "%s WS SETUP FAILED\n", jsock->name); + } + + if (kws_test_flag(jsock->ws, KWS_HTTP)) { + http_run(jsock); + kws_close(jsock->ws, WS_NONE); + goto end; } while(jsock->profile->running) { int pflags; - if (jsock->ws.ssl && SSL_pending(jsock->ws.ssl) > 0) { - pflags = SWITCH_POLL_READ; - } else { - pflags = switch_wait_sock(jsock->client_socket, 50, SWITCH_POLL_READ | SWITCH_POLL_ERROR | SWITCH_POLL_HUP); - } + if (!jsock->ws) { die("%s Setup Error\n", jsock->name); } + + pflags = kws_wait_sock(jsock->ws, 50, KS_POLL_READ | KS_POLL_ERROR | KS_POLL_HUP); if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); } if (pflags < 0 && (errno != EINTR)) { die_errnof("%s POLL FAILED with %d", jsock->name, pflags); } if (pflags == 0) {/* socket poll timeout */ jsock_check_event_queue(jsock); } - if (pflags > 0 && (pflags & SWITCH_POLL_HUP)) { log_and_exit(SWITCH_LOG_INFO, "%s POLL HANGUP DETECTED (peer closed its end of socket)\n", jsock->name); } - if (pflags > 0 && (pflags & SWITCH_POLL_ERROR)) { die("%s POLL ERROR\n", jsock->name); } - if (pflags > 0 && (pflags & SWITCH_POLL_INVALID)) { die("%s POLL INVALID SOCKET (not opened or already closed)\n", jsock->name); } - if (pflags > 0 && (pflags & SWITCH_POLL_READ)) { + if (pflags > 0 && (pflags & KS_POLL_HUP)) { log_and_exit(SWITCH_LOG_INFO, "%s POLL HANGUP DETECTED (peer closed its end of socket)\n", jsock->name); } + if (pflags > 0 && (pflags & KS_POLL_ERROR)) { die("%s POLL ERROR\n", jsock->name); } + if (pflags > 0 && (pflags & KS_POLL_INVALID)) { die("%s POLL INVALID SOCKET (not opened or already closed)\n", jsock->name); } + if (pflags > 0 && (pflags & KS_POLL_READ)) { switch_ssize_t bytes; - ws_opcode_t oc; + kws_opcode_t oc; uint8_t *data; - bytes = ws_read_frame(&jsock->ws, &oc, &data); + bytes = kws_read_frame(jsock->ws, &oc, &data); if (bytes < 0) { - if (bytes == -WS_RECV_CLOSE) { + if (bytes == -1000) { log_and_exit(SWITCH_LOG_INFO, "%s Client sent close request\n", jsock->name); } else { die("%s BAD READ %" SWITCH_SSIZE_T_FMT "\n", jsock->name, bytes); @@ -1945,7 +1923,7 @@ static void client_run(jsock_t *jsock) a = switch_time_now(); do { - bytes = ws_read_frame(&jsock->ws, &oc, &data); + bytes = kws_read_frame(jsock->ws, &oc, &data); s = (char *) data; } while (bytes && data && s[0] == '#' && s[3] == 'B'); b = switch_time_now(); @@ -1955,7 +1933,7 @@ static void client_run(jsock_t *jsock) if (s[0] != '#') goto nm; switch_snprintf(repl, sizeof(repl), "#SPU %ld", (long)((b - a) / 1000)); - ws_write_frame(&jsock->ws, WSOC_TEXT, repl, strlen(repl)); + kws_write_frame(jsock->ws, WSOC_TEXT, repl, strlen(repl)); loops = size / 1024; rem = size % 1024; switch_snprintf(repl, sizeof(repl), "#SPB "); @@ -1965,10 +1943,10 @@ static void client_run(jsock_t *jsock) int ddur = 0; a = switch_time_now(); for (i = 0; i < loops; i++) { - ws_write_frame(&jsock->ws, WSOC_TEXT, repl, 1024); + kws_write_frame(jsock->ws, WSOC_TEXT, repl, 1024); } if (rem) { - ws_write_frame(&jsock->ws, WSOC_TEXT, repl, rem); + kws_write_frame(jsock->ws, WSOC_TEXT, repl, rem); } b = switch_time_now(); ddur += (int)((b - a) / 1000); @@ -1979,7 +1957,7 @@ static void client_run(jsock_t *jsock) dur /= j+1; switch_snprintf(repl, sizeof(repl), "#SPD %d", dur); - ws_write_frame(&jsock->ws, WSOC_TEXT, repl, strlen(repl)); + kws_write_frame(jsock->ws, WSOC_TEXT, repl, strlen(repl)); } } @@ -2001,10 +1979,10 @@ static void client_run(jsock_t *jsock) } error: - + end: detach_jsock(jsock); - ws_destroy(&jsock->ws); - + kws_destroy(&jsock->ws); + ks_pool_close(&jsock->kpool); return; } @@ -2049,7 +2027,7 @@ static void *SWITCH_THREAD_FUNC client_thread(switch_thread_t *thread, void *obj switch_event_destroy(&jsock->vars); switch_event_destroy(&jsock->user_vars); - if (jsock->client_socket != ws_sock_invalid) { + if (jsock->client_socket != KS_SOCK_INVALID) { close_socket(&jsock->client_socket); } @@ -4105,7 +4083,7 @@ static switch_bool_t verto__broadcast_func(const char *method, cJSON *params, js switch_event_channel_broadcast(event_channel, &jevent, modname, verto_globals.event_channel_id); } - if (jsock->profile->mcast_pub.sock != ws_sock_invalid) { + if (jsock->profile->mcast_pub.sock != KS_SOCK_INVALID) { if ((json_text = cJSON_PrintUnformatted(params))) { if (mcast_socket_send(&jsock->profile->mcast_pub, json_text, strlen(json_text) + 1) <= 0) { @@ -4257,7 +4235,7 @@ static void jrpc_init(void) -static int start_jsock(verto_profile_t *profile, ws_socket_t sock, int family) +static int start_jsock(verto_profile_t *profile, ks_socket_t sock, int family) { jsock_t *jsock = NULL; int flag = 1; @@ -4369,7 +4347,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock, int family) error: if (jsock) { - if (jsock->client_socket != ws_sock_invalid) { + if (jsock->client_socket != KS_SOCK_INVALID) { close_socket(&jsock->client_socket); } @@ -4379,9 +4357,9 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock, int family) return -1; } -static ws_socket_t prepare_socket(ips_t *ips) +static ks_socket_t prepare_socket(ips_t *ips) { - ws_socket_t sock = ws_sock_invalid; + ks_socket_t sock = KS_SOCK_INVALID; #ifndef WIN32 int reuse_addr = 1; #else @@ -4435,14 +4413,14 @@ static ws_socket_t prepare_socket(ips_t *ips) close_file(&sock); - return ws_sock_invalid; + return KS_SOCK_INVALID; } static void handle_mcast_sub(verto_profile_t *profile) { int bytes; - if (profile->mcast_sub.sock == ws_sock_invalid) { + if (profile->mcast_sub.sock == KS_SOCK_INVALID) { return; } @@ -4580,7 +4558,7 @@ static void runtime(verto_profile_t *profile) for (i = 0; i < profile->i; i++) { //if ((profile->server_socket[i] = prepare_socket(profile->ip[i].local_ip_addr, profile->ip[i].local_port)) < 0) { - if ((profile->server_socket[i] = prepare_socket(&profile->ip[i])) != ws_sock_invalid) { + if ((profile->server_socket[i] = prepare_socket(&profile->ip[i])) != KS_SOCK_INVALID) { listeners++; } } @@ -4617,11 +4595,11 @@ static void runtime(verto_profile_t *profile) error: - if (profile->mcast_sub.sock != ws_sock_invalid) { + if (profile->mcast_sub.sock != KS_SOCK_INVALID) { mcast_socket_close(&profile->mcast_sub); } - if (profile->mcast_pub.sock != ws_sock_invalid) { + if (profile->mcast_pub.sock != KS_SOCK_INVALID) { mcast_socket_close(&profile->mcast_pub); } @@ -4805,8 +4783,8 @@ static switch_status_t parse_config(const char *cf) profile->local_network = "localnet.auto"; - profile->mcast_sub.sock = ws_sock_invalid; - profile->mcast_pub.sock = ws_sock_invalid; + profile->mcast_sub.sock = KS_SOCK_INVALID; + profile->mcast_pub.sock = KS_SOCK_INVALID; for (param = switch_xml_child(xprofile, "param"); param; param = param->next) { @@ -5053,6 +5031,10 @@ static switch_status_t parse_config(const char *cf) if (tmp > 0) { verto_globals.detach_timeout = tmp; } + } else if (!strcasecmp(var, "kslog")) { + if (val) { + verto_globals.kslog_on = switch_true(val); + } } } } @@ -5119,7 +5101,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t for (i = 0; i < profile->i; i++) { char *tmpurl = switch_mprintf(strchr(profile->ip[i].local_ip, ':') ? "%s:[%s]:%d" : "%s:%s:%d", (profile->ip[i].secure == 1) ? "wss" : "ws", profile->ip[i].local_ip, profile->ip[i].local_port); - stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", profile->name, "profile", tmpurl, (profile->server_socket[i] != ws_sock_invalid) ? "RUNNING" : "DOWN"); + stream->write_function(stream, "%25s\t%s\t %40s\t%s\n", profile->name, "profile", tmpurl, (profile->server_socket[i] != KS_SOCK_INVALID) ? "RUNNING" : "DOWN"); switch_safe_free(tmpurl); } cp++; @@ -6178,6 +6160,25 @@ static void event_handler(switch_event_t *event) } +static void mod_verto_ks_logger(const char *file, const char *func, int line, int level, const char *fmt, ...) +{ + char fmt_buf[32768]; + va_list ap; + size_t len; + va_start(ap, fmt); + + len = snprintf(fmt_buf, sizeof(fmt_buf), "%s\n", fmt); // add return that is missing + + if (level == SWITCH_LOG_DEBUG) level = SWITCH_LOG_DEBUG1; + + if (len < sizeof(fmt_buf)) { + switch_log_vprintf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, fmt_buf, ap); + } else { + switch_log_vprintf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, fmt, ap); + } + va_end(ap); +} + /* Macro expands to: switch_status_t mod_verto_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) { @@ -6188,6 +6189,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) switch_cache_db_handle_t *dbh; //switch_application_interface_t *app_interface = NULL; + ks_ssl_init_skip(KS_TRUE); + ks_init(); if (switch_event_reserve_subclass(MY_EVENT_LOGIN) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_LOGIN); @@ -6251,6 +6254,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) if (r) return SWITCH_STATUS_TERM; + if (verto_globals.kslog_on == SWITCH_TRUE) { + ks_global_set_logger(mod_verto_ks_logger); + ks_log(KS_LOG_INFO, "ks log registered in mod_verto\n"); + } + jrpc_init(); /* connect my internal structure to the blank pointer passed to me */ @@ -6315,6 +6323,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_verto_shutdown) switch_core_hash_destroy(&verto_globals.event_channel_hash); switch_core_hash_destroy(&verto_globals.jsock_hash); + ks_global_set_logger(NULL); + ks_shutdown(); + return SWITCH_STATUS_SUCCESS; } @@ -6340,7 +6351,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_verto_runtime) return SWITCH_STATUS_TERM; } - /* For Emacs: * Local Variables: * mode:c diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index 1bf8d0cdb5..c82f813da4 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -62,6 +62,8 @@ #include <openssl/ssl.h> #include "mcast.h" +#include "ks.h" + #define MAX_QUEUE_LEN 100000 #define MAX_MISSED 500 @@ -99,10 +101,11 @@ typedef enum { struct verto_profile_s; struct jsock_s { - ws_socket_t client_socket; + ks_socket_t client_socket; switch_memory_pool_t *pool; switch_thread_t *thread; - wsh_t ws; + ks_pool_t *kpool; + kws_t *ws; unsigned char buf[65535]; char *name; jsock_type_t ptype; @@ -114,7 +117,7 @@ struct jsock_s { uint8_t drop; uint8_t nodelete; - ws_socket_t local_sock; + ks_socket_t local_sock; SSL *ssl; jpflag_t flags; @@ -230,7 +233,7 @@ struct verto_profile_s { jsock_t *jsock_head; int jsock_count; - ws_socket_t server_socket[MAX_BIND]; + ks_socket_t server_socket[MAX_BIND]; int running; int ssl_ready; @@ -307,6 +310,7 @@ struct globals_s { int profile_threads; int enable_presence; int enable_fs_events; + switch_bool_t kslog_on; switch_hash_t *jsock_hash; switch_mutex_t *jsock_mutex; diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c deleted file mode 100644 index 122b6433c0..0000000000 --- a/src/mod/endpoints/mod_verto/ws.c +++ /dev/null @@ -1,1097 +0,0 @@ -#include <switch.h> -#include "ws.h" -#include <pthread.h> - -#ifndef _MSC_VER -#include <fcntl.h> -#endif - -#if defined(__linux__) || defined(__GLIBC__) -#include <byteswap.h> -#endif - -#ifndef _MSC_VER -#define ms_sleep(x) usleep( x * 1000); -#else -#define ms_sleep(x) Sleep( x ); -#endif - -#ifdef _MSC_VER -/* warning C4706: assignment within conditional expression*/ -#pragma warning(disable: 4706) -#endif - -#define WS_BLOCK 1 -#define WS_NOBLOCK 0 - -#define WS_INIT_SANITY 5000 -#define WS_WRITE_SANITY 200 - -#define SHA1_HASH_SIZE 20 -static struct ws_globals_s ws_globals; - -#ifndef WSS_STANDALONE - -void init_ssl(void) -{ - // SSL_library_init(); -} -void deinit_ssl(void) -{ - return; -} - -#else -static void pthreads_thread_id(CRYPTO_THREADID *id); -static void pthreads_locking_callback(int mode, int type, const char *file, int line); - -static pthread_mutex_t *lock_cs; -static long *lock_count; - - - -static void thread_setup(void) -{ - int i; - - lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); - lock_count = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); - - for (i = 0; i < CRYPTO_num_locks(); i++) { - lock_count[i] = 0; - pthread_mutex_init(&(lock_cs[i]), NULL); - } - - CRYPTO_THREADID_set_callback(pthreads_thread_id); - CRYPTO_set_locking_callback(pthreads_locking_callback); -} - -static void thread_cleanup(void) -{ - int i; - - CRYPTO_set_locking_callback(NULL); - - for (i=0; i<CRYPTO_num_locks(); i++) { - pthread_mutex_destroy(&(lock_cs[i])); - } - OPENSSL_free(lock_cs); - OPENSSL_free(lock_count); - -} - -static void pthreads_locking_callback(int mode, int type, const char *file, int line) -{ - - if (mode & CRYPTO_LOCK) { - pthread_mutex_lock(&(lock_cs[type])); - lock_count[type]++; - } else { - pthread_mutex_unlock(&(lock_cs[type])); - } -} - - - -static void pthreads_thread_id(CRYPTO_THREADID *id) -{ - CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self()); -} - - -void init_ssl(void) { - SSL_library_init(); - - - OpenSSL_add_all_algorithms(); /* load & register cryptos */ - SSL_load_error_strings(); /* load all error messages */ - ws_globals.ssl_method = SSLv23_server_method(); /* create server instance */ - ws_globals.ssl_ctx = SSL_CTX_new(ws_globals.ssl_method); /* create context */ - assert(ws_globals.ssl_ctx); - - /* Disable SSLv2 */ - SSL_CTX_set_options(ws_globals.ssl_ctx, SSL_OP_NO_SSLv2); - /* Disable SSLv3 */ - SSL_CTX_set_options(ws_globals.ssl_ctx, SSL_OP_NO_SSLv3); - /* Disable TLSv1 */ - SSL_CTX_set_options(ws_globals.ssl_ctx, SSL_OP_NO_TLSv1); - /* Disable Compression CRIME (Compression Ratio Info-leak Made Easy) */ - SSL_CTX_set_options(ws_globals.ssl_ctx, SSL_OP_NO_COMPRESSION); - /* set the local certificate from CertFile */ - SSL_CTX_use_certificate_file(ws_globals.ssl_ctx, ws_globals.cert, SSL_FILETYPE_PEM); - /* set the private key from KeyFile */ - SSL_CTX_use_PrivateKey_file(ws_globals.ssl_ctx, ws_globals.key, SSL_FILETYPE_PEM); - /* verify private key */ - if ( !SSL_CTX_check_private_key(ws_globals.ssl_ctx) ) { - abort(); - } - - SSL_CTX_set_cipher_list(ws_globals.ssl_ctx, "HIGH:!DSS:!aNULL@STRENGTH"); - - thread_setup(); -} - - -void deinit_ssl(void) { - thread_cleanup(); -} - -#endif - -static const char c64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - -static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen) -{ - char *p=data; - - /* the old way didnt make sure that variable values were used for the name hunt - * and didnt ensure that only a full match of the variable name was used - */ - - do { - if(!strncasecmp(p,name,strlen(name)) && *(p+strlen(name))==':') break; - } while((p = (strstr(p,"\n")+1))!=(char *)1); - - - if (p && p != (char *)1 && *p!='\0') { - char *v, *e = 0; - - v = strchr(p, ':'); - if (v) { - v++; - while(v && *v == ' ') { - v++; - } - if (v) { - e = strchr(v, '\r'); - if (!e) { - e = strchr(v, '\n'); - } - } - - if (v && e) { - int cplen; - size_t len = e - v; - - if (len > buflen - 1) { - cplen = buflen -1; - } else { - cplen = len; - } - - strncpy(buf, v, cplen); - *(buf+cplen) = '\0'; - return 1; - } - - } - } - return 0; -} - -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; - - if(olen) { - } - - for(x=0;x<ilen;x++) { - b = (b<<8) + in[x]; - l += 8; - while (l >= 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; -} - -#ifdef NO_OPENSSL -static void sha1_digest(char *digest, unsigned char *in) -{ - SHA1Context sha; - char *p; - int x; - - - SHA1Init(&sha); - SHA1Update(&sha, in, strlen(in)); - SHA1Final(&sha, digest); -} -#else - -static void sha1_digest(unsigned char *digest, char *in) -{ - SHA_CTX sha; - - SHA1_Init(&sha); - SHA1_Update(&sha, in, strlen(in)); - SHA1_Final(digest, &sha); - -} - -#endif - -int ws_handshake(wsh_t *wsh) -{ - char key[256] = ""; - char version[5] = ""; - char proto[256] = ""; - char proto_buf[384] = ""; - char input[512] = ""; - unsigned char output[SHA1_HASH_SIZE] = ""; - char b64[256] = ""; - char respond[1024] = ""; - ssize_t bytes; - char *p, *e = 0; - - if (wsh->sock == ws_sock_invalid) { - return -3; - } - - while((bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen, WS_BLOCK)) > 0) { - wsh->datalen += bytes; - if (strstr(wsh->buffer, "\r\n\r\n") || strstr(wsh->buffer, "\n\n")) { - break; - } - } - - if (bytes < 0 || bytes > wsh->buflen -1) { - goto err; - } - - *(wsh->buffer + wsh->datalen) = '\0'; - - if (strncasecmp(wsh->buffer, "GET ", 4)) { - goto err; - } - - p = wsh->buffer + 4; - - e = strchr(p, ' '); - if (!e) { - goto err; - } - - wsh->uri = malloc((e-p) + 1); - - if (!wsh->uri) goto err; - - strncpy(wsh->uri, p, e-p); - *(wsh->uri + (e-p)) = '\0'; - - cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key)); - cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version)); - cheezy_get_var(wsh->buffer, "Sec-WebSocket-Protocol", proto, sizeof(proto)); - - if (!*key) { - goto err; - } - - snprintf(input, sizeof(input), "%s%s", key, WEBSOCKET_GUID); - sha1_digest(output, input); - b64encode((unsigned char *)output, SHA1_HASH_SIZE, (unsigned char *)b64, sizeof(b64)); - - if (*proto) { - snprintf(proto_buf, sizeof(proto_buf), "Sec-WebSocket-Protocol: %s\r\n", proto); - } - - snprintf(respond, sizeof(respond), - "HTTP/1.1 101 Switching Protocols\r\n" - "Upgrade: websocket\r\n" - "Connection: Upgrade\r\n" - "Sec-WebSocket-Accept: %s\r\n" - "%s\r\n", - b64, - proto_buf); - respond[511] = 0; - - if (ws_raw_write(wsh, respond, strlen(respond)) != (ssize_t)strlen(respond)) { - goto err; - } - - wsh->handshake = 1; - - return 0; - - err: - - if (!wsh->stay_open) { - - if (bytes > 0) { - snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n" - "Sec-WebSocket-Version: 13\r\n\r\n"); - respond[511] = 0; - - ws_raw_write(wsh, respond, strlen(respond)); - } - - ws_close(wsh, WS_NONE); - } - - return -1; - -} - -#define SSL_WANT_READ_WRITE(err) (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) - -ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block) -{ - ssize_t r; - int ssl_err = 0; - - wsh->x++; - if (wsh->x > 250) ms_sleep(1); - - if (wsh->ssl) { - do { - r = SSL_read(wsh->ssl, data, bytes); - - if (r < 0) { - ssl_err = SSL_get_error(wsh->ssl, r); - - if (SSL_WANT_READ_WRITE(ssl_err)) { - if (!block) { - r = -2; - goto end; - } - wsh->x++; - ms_sleep(10); - } else { - r = -1; - goto end; - } - } - - } while (r < 0 && SSL_WANT_READ_WRITE(ssl_err) && wsh->x < 1000); - - goto end; - } - - do { - - r = recv(wsh->sock, data, bytes, 0); - - if (r == -1) { - if (!block && xp_is_blocking(xp_errno())) { - r = -2; - goto end; - } - - if (block) { - wsh->x++; - ms_sleep(10); - } - } - } while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 1000); - - end: - - if (wsh->x >= 10000 || (block && wsh->x >= 1000)) { - r = -1; - } - - if (r > 0) { - *((char *)data + r) = '\0'; - } - - if (r >= 0) { - wsh->x = 0; - } - - return r; -} - -/* - * Blocking read until bytes have been received, failure, or too many retries. - */ -static ssize_t ws_raw_read_blocking(wsh_t *wsh, char *data, size_t max_bytes, int max_retries) -{ - ssize_t total_bytes_read = 0; - while (total_bytes_read < max_bytes && max_retries-- > 0) { - ssize_t bytes_read = ws_raw_read(wsh, data + total_bytes_read, max_bytes - total_bytes_read, WS_BLOCK); - if (bytes_read < 0) { - break; - } - total_bytes_read += bytes_read; - } - return total_bytes_read; -} - - -ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) -{ - ssize_t r; - int sanity = WS_WRITE_SANITY; - int ssl_err = 0; - size_t wrote = 0; - - if (wsh->ssl) { - do { - r = SSL_write(wsh->ssl, (void *)((unsigned char *)data + wrote), bytes - wrote); - - if (r == 0) { - ssl_err = 42; - break; - } - - if (r > 0) { - wrote += r; - } - - if (sanity < WS_WRITE_SANITY) { - int ms = 1; - - if (wsh->block) { - if (sanity < WS_WRITE_SANITY / 2) { - ms = 25; - } else if (sanity < WS_WRITE_SANITY * 3 / 4) { - ms = 50; - } - } - ms_sleep(ms); - } - - if (r < 0) { - ssl_err = SSL_get_error(wsh->ssl, r); - - if (!SSL_WANT_READ_WRITE(ssl_err)) { - break; - } - ssl_err = 0; - } - - } while (--sanity > 0 && wrote < bytes); - - if (!sanity) ssl_err = 56; - - if (ssl_err) { - r = ssl_err * -1; - } - - return r; - } - - do { - r = send(wsh->sock, (void *)((unsigned char *)data + wrote), bytes - wrote, 0); - - if (r > 0) { - wrote += r; - } - - if (sanity < WS_WRITE_SANITY) { - int ms = 1; - - if (wsh->block) { - if (sanity < WS_WRITE_SANITY / 2) { - ms = 25; - } else if (sanity < WS_WRITE_SANITY * 3 / 4) { - ms = 50; - } - } - ms_sleep(ms); - } - - if (r == -1) { - if (!xp_is_blocking(xp_errno())) { - break; - } - } - - } while (--sanity > 0 && wrote < bytes); - - //if (r<0) { - //printf("wRITE FAIL: %s\n", strerror(errno)); - //} - - return r < 0 ? r : wrote; -} - -#ifdef _MSC_VER -static int setup_socket(ws_socket_t sock) -{ - unsigned long v = 1; - - if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) { - return -1; - } - - return 0; - -} - -static int restore_socket(ws_socket_t sock) -{ - unsigned long v = 0; - - if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) { - return -1; - } - - return 0; - -} - -#else - -static int setup_socket(ws_socket_t sock) -{ - int flags = fcntl(sock, F_GETFL, 0); - return fcntl(sock, F_SETFL, flags | O_NONBLOCK); -} - -static int restore_socket(ws_socket_t sock) -{ - int flags = fcntl(sock, F_GETFL, 0); - - flags &= ~O_NONBLOCK; - - return fcntl(sock, F_SETFL, flags); - -} - -#endif - - -int establish_logical_layer(wsh_t *wsh) -{ - - if (!wsh->sanity) { - return -1; - } - - if (wsh->logical_established) { - return 0; - } - - if (wsh->secure && !wsh->secure_established) { - int code; - - if (!wsh->ssl) { - wsh->ssl = SSL_new(wsh->ssl_ctx); - assert(wsh->ssl); - - SSL_set_fd(wsh->ssl, wsh->sock); - } - - do { - code = SSL_accept(wsh->ssl); - - if (code == 1) { - wsh->secure_established = 1; - break; - } - - if (code == 0) { - return -1; - } - - if (code < 0) { - int ssl_err = SSL_get_error(wsh->ssl, code); - if (!SSL_WANT_READ_WRITE(ssl_err)) { - return -1; - } - } - - if (wsh->block) { - ms_sleep(10); - } else { - ms_sleep(1); - } - - wsh->sanity--; - - if (!wsh->block) { - return -2; - } - - } while (wsh->sanity > 0); - - if (!wsh->sanity) { - return -1; - } - - } - - while (!wsh->down && !wsh->handshake) { - int r = ws_handshake(wsh); - - if (r < 0) { - wsh->down = 1; - return -1; - } - - if (!wsh->handshake && !wsh->block) { - return -2; - } - - } - - wsh->logical_established = 1; - - return 0; -} - - -int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block, int stay_open) -{ - memset(wsh, 0, sizeof(*wsh)); - - wsh->sock = sock; - wsh->block = block; - wsh->sanity = WS_INIT_SANITY; - wsh->ssl_ctx = ssl_ctx; - wsh->stay_open = stay_open; - - if (!ssl_ctx) { - ssl_ctx = ws_globals.ssl_ctx; - } - - if (close_sock) { - wsh->close_sock = 1; - } - - wsh->buflen = 1024 * 64; - wsh->bbuflen = wsh->buflen; - - wsh->buffer = malloc(wsh->buflen); - wsh->bbuffer = malloc(wsh->bbuflen); - //printf("init %p %ld\n", (void *) wsh->bbuffer, wsh->bbuflen); - //memset(wsh->buffer, 0, wsh->buflen); - //memset(wsh->bbuffer, 0, wsh->bbuflen); - - wsh->secure = ssl_ctx ? 1 : 0; - - setup_socket(sock); - - if (establish_logical_layer(wsh) == -1) { - return -1; - } - - if (wsh->down) { - return -1; - } - - return 0; -} - -void ws_destroy(wsh_t *wsh) -{ - - if (!wsh) { - return; - } - - if (!wsh->down) { - ws_close(wsh, WS_NONE); - } - - if (wsh->down > 1) { - return; - } - - wsh->down = 2; - - if (wsh->write_buffer) { - free(wsh->write_buffer); - wsh->write_buffer = NULL; - wsh->write_buffer_len = 0; - } - - if (wsh->ssl) { - SSL_free(wsh->ssl); - wsh->ssl = NULL; - } - - if (wsh->buffer) free(wsh->buffer); - if (wsh->bbuffer) free(wsh->bbuffer); - - wsh->buffer = wsh->bbuffer = NULL; - -} - -ssize_t ws_close(wsh_t *wsh, int16_t reason) -{ - - if (wsh->down) { - return -1; - } - - wsh->down = 1; - - if (wsh->uri) { - free(wsh->uri); - wsh->uri = NULL; - } - - if (reason && wsh->sock != ws_sock_invalid) { - uint16_t *u16; - uint8_t fr[4] = {WSOC_CLOSE | 0x80, 2, 0}; - - u16 = (uint16_t *) &fr[2]; - *u16 = htons((int16_t)reason); - ws_raw_write(wsh, fr, 4); - } - - if (wsh->ssl && wsh->sock != ws_sock_invalid) { - /* first invocation of SSL_shutdown() would normally return 0 and just try to send SSL protocol close request. - we just slightly polite, since we want to close socket fast and - not bother waiting for SSL protocol close response before closing socket, - since we want cleanup to be done fast for scenarios like: - client change NAT (like jump from one WiFi to another) and now unreachable from old ip:port, however - immidiately reconnect with new ip:port but old session id (and thus should replace the old session/channel) - */ - SSL_shutdown(wsh->ssl); - } - - /* restore to blocking here, so any further read/writes will block */ - restore_socket(wsh->sock); - - if (wsh->close_sock && wsh->sock != ws_sock_invalid) { - /* signal socket to shutdown() before close(): FIN-ACK-FIN-ACK insead of RST-RST - do not really handle errors here since it all going to die anyway. - all buffered writes if any(like SSL_shutdown() ones) will still be sent. - */ -#ifndef WIN32 - shutdown(wsh->sock, SHUT_RDWR); - close(wsh->sock); -#else - shutdown(wsh->sock, SD_BOTH); - closesocket(wsh->sock); -#endif - } - - wsh->sock = ws_sock_invalid; - - return reason * -1; - -} - - -uint64_t hton64(uint64_t val) -{ - if (__BYTE_ORDER == __BIG_ENDIAN) return (val); - else return __bswap_64(val); -} - -uint64_t ntoh64(uint64_t val) -{ - if (__BYTE_ORDER == __BIG_ENDIAN) return (val); - else return __bswap_64(val); -} - - -ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) -{ - - ssize_t need = 2; - char *maskp; - int ll = 0; - int frag = 0; - int blen; - - wsh->body = wsh->bbuffer; - wsh->packetlen = 0; - - again: - need = 2; - maskp = NULL; - *data = NULL; - - ll = establish_logical_layer(wsh); - - if (ll < 0) { - return ll; - } - - if (wsh->down) { - return -1; - } - - if (!wsh->handshake) { - return ws_close(wsh, WS_NONE); - } - - if ((wsh->datalen = ws_raw_read(wsh, wsh->buffer, 9, wsh->block)) < 0) { - if (wsh->datalen == -2) { - return -2; - } - return ws_close(wsh, WS_NONE); - } - - if (wsh->datalen < need) { - ssize_t bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, 9 - wsh->datalen, WS_BLOCK); - if (bytes < 0 || (wsh->datalen += bytes) < need) { - /* too small - protocol err */ - return ws_close(wsh, WS_NONE); - } - } - - *oc = *wsh->buffer & 0xf; - - switch(*oc) { - case WSOC_CLOSE: - { - wsh->plen = wsh->buffer[1] & 0x7f; - *data = (uint8_t *) &wsh->buffer[2]; - return ws_close(wsh, WS_RECV_CLOSE); - } - break; - case WSOC_CONTINUATION: - case WSOC_TEXT: - case WSOC_BINARY: - case WSOC_PING: - case WSOC_PONG: - { - int fin = (wsh->buffer[0] >> 7) & 1; - int mask = (wsh->buffer[1] >> 7) & 1; - - - if (!fin && *oc != WSOC_CONTINUATION) { - frag = 1; - } else if (fin && *oc == WSOC_CONTINUATION) { - frag = 0; - } - - if (mask) { - need += 4; - - if (need > wsh->datalen) { - ssize_t bytes = ws_raw_read_blocking(wsh, wsh->buffer + wsh->datalen, need - wsh->datalen, 10); - if (bytes < 0 || (wsh->datalen += bytes) < need) { - /* too small - protocol err */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_NONE); - } - } - } - - wsh->plen = wsh->buffer[1] & 0x7f; - wsh->payload = &wsh->buffer[2]; - - if (wsh->plen == 127) { - uint64_t *u64; - - need += 8; - - if (need > wsh->datalen) { - ssize_t bytes = ws_raw_read_blocking(wsh, wsh->buffer + wsh->datalen, need - wsh->datalen, 10); - if (bytes < 0 || (wsh->datalen += bytes) < need) { - /* too small - protocol err */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_NONE); - } - } - - u64 = (uint64_t *) wsh->payload; - wsh->payload += 8; - wsh->plen = ntoh64(*u64); - } else if (wsh->plen == 126) { - uint16_t *u16; - - need += 2; - - if (need > wsh->datalen) { - ssize_t bytes = ws_raw_read_blocking(wsh, wsh->buffer + wsh->datalen, need - wsh->datalen, 10); - if (bytes < 0 || (wsh->datalen += bytes) < need) { - /* too small - protocol err */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_NONE); - } - } - - u16 = (uint16_t *) wsh->payload; - wsh->payload += 2; - wsh->plen = ntohs(*u16); - } - - if (mask) { - maskp = (char *)wsh->payload; - wsh->payload += 4; - } - - need = (wsh->plen - (wsh->datalen - need)); - - if (need < 0) { - /* invalid read - protocol err .. */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_NONE); - } - - blen = wsh->body - wsh->bbuffer; - - if (need + blen > (ssize_t)wsh->bbuflen) { - void *tmp; - - wsh->bbuflen = need + blen + wsh->rplen; - - if ((tmp = realloc(wsh->bbuffer, wsh->bbuflen))) { - wsh->bbuffer = tmp; - } else { - abort(); - } - - wsh->body = wsh->bbuffer + blen; - } - - wsh->rplen = wsh->plen - need; - - if (wsh->rplen) { - memcpy(wsh->body, wsh->payload, wsh->rplen); - } - - while(need) { - ssize_t r = ws_raw_read(wsh, wsh->body + wsh->rplen, need, WS_BLOCK); - - if (r < 1) { - /* invalid read - protocol err .. */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_NONE); - } - - wsh->datalen += r; - wsh->rplen += r; - need -= r; - } - - if (mask && maskp) { - ssize_t i; - - for (i = 0; i < wsh->datalen; i++) { - wsh->body[i] ^= maskp[i % 4]; - } - } - - - if (*oc == WSOC_PING) { - ws_write_frame(wsh, WSOC_PONG, wsh->body, wsh->rplen); - goto again; - } - - *(wsh->body+wsh->rplen) = '\0'; - wsh->packetlen += wsh->rplen; - wsh->body += wsh->rplen; - - if (frag) { - goto again; - } - - *data = (uint8_t *)wsh->bbuffer; - - //printf("READ[%ld][%d]-----------------------------:\n[%s]\n-------------------------------\n", wsh->packetlen, *oc, (char *)*data); - - - return wsh->packetlen; - } - break; - default: - { - /* invalid op code - protocol err .. */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_PROTO_ERR); - } - break; - } -} - -ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) -{ - uint8_t hdr[14] = { 0 }; - size_t hlen = 2; - uint8_t *bp; - ssize_t raw_ret = 0; - - if (wsh->down) { - return -1; - } - - //printf("WRITE[%ld]-----------------------------:\n[%s]\n-----------------------------------\n", bytes, (char *) data); - - hdr[0] = (uint8_t)(oc | 0x80); - - if (bytes < 126) { - hdr[1] = (uint8_t)bytes; - } else if (bytes < 0x10000) { - uint16_t *u16; - - hdr[1] = 126; - hlen += 2; - - u16 = (uint16_t *) &hdr[2]; - *u16 = htons((uint16_t) bytes); - - } else { - uint64_t *u64; - - hdr[1] = 127; - hlen += 8; - - u64 = (uint64_t *) &hdr[2]; - *u64 = hton64(bytes); - } - - if (wsh->write_buffer_len < (hlen + bytes + 1)) { - void *tmp; - - wsh->write_buffer_len = hlen + bytes + 1; - if ((tmp = realloc(wsh->write_buffer, wsh->write_buffer_len))) { - wsh->write_buffer = tmp; - } else { - abort(); - } - } - - bp = (uint8_t *) wsh->write_buffer; - memcpy(bp, (void *) &hdr[0], hlen); - memcpy(bp + hlen, data, bytes); - - raw_ret = ws_raw_write(wsh, bp, (hlen + bytes)); - - if (raw_ret != (ssize_t) (hlen + bytes)) { - return raw_ret; - } - - return bytes; -} - -#ifdef _MSC_VER - -int xp_errno(void) -{ - return WSAGetLastError(); -} - -int xp_is_blocking(int errcode) -{ - return errcode == WSAEWOULDBLOCK || errcode == WSAEINPROGRESS; -} - -#else - -int xp_errno(void) -{ - return errno; -} - -int xp_is_blocking(int errcode) -{ - return errcode == EAGAIN || errcode == EWOULDBLOCK || errcode == EINPROGRESS || errcode == EINTR || errcode == ETIMEDOUT; -} - -#endif diff --git a/src/mod/endpoints/mod_verto/ws.h b/src/mod/endpoints/mod_verto/ws.h deleted file mode 100644 index 84127cfb2c..0000000000 --- a/src/mod/endpoints/mod_verto/ws.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef _WS_H -#define _WS_H - -//#define WSS_STANDALONE 1 - -#define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" -#define B64BUFFLEN 1024 - -#include <sys/types.h> -#ifndef _MSC_VER -#include <arpa/inet.h> -#include <sys/wait.h> -#include <sys/socket.h> -#include <unistd.h> -#else -#pragma warning(disable:4996) -#endif -#include <string.h> -#include <string.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> -#include <errno.h> -//#include "sha1.h" -#include <openssl/ssl.h> - -#if defined(_MSC_VER) || defined(__APPLE__) || defined(__FreeBSD__) || (defined(__SVR4) && defined(__sun)) -#define __bswap_64(x) \ - x = (x>>56) | \ - ((x<<40) & 0x00FF000000000000) | \ - ((x<<24) & 0x0000FF0000000000) | \ - ((x<<8) & 0x000000FF00000000) | \ - ((x>>8) & 0x00000000FF000000) | \ - ((x>>24) & 0x0000000000FF0000) | \ - ((x>>40) & 0x000000000000FF00) | \ - (x<<56) -#endif -#ifdef _MSC_VER -#ifndef strncasecmp -#define strncasecmp _strnicmp -#endif -#ifdef _WIN64 -#define WS_SSIZE_T __int64 -#elif _MSC_VER >= 1400 -#define WS_SSIZE_T __int32 __w64 -#else -#define WS_SSIZE_T __int32 -#endif -typedef WS_SSIZE_T ssize_t; -#endif - - -struct ws_globals_s { - const SSL_METHOD *ssl_method; - SSL_CTX *ssl_ctx; - char cert[512]; - char key[512]; -}; - -//extern struct ws_globals_s ws_globals; - -#ifndef WIN32 -typedef int ws_socket_t; -#else -typedef SOCKET ws_socket_t; -#endif -#define ws_sock_invalid (ws_socket_t)-1 - - -typedef enum { - WS_NONE = 0, - WS_RECV_CLOSE = 1000, - WS_PROTO_ERR = 1002, - WS_DATA_TOO_BIG = 1009 -} ws_cause_t; - -typedef enum { - WSOC_CONTINUATION = 0x0, - WSOC_TEXT = 0x1, - WSOC_BINARY = 0x2, - WSOC_CLOSE = 0x8, - WSOC_PING = 0x9, - WSOC_PONG = 0xA -} ws_opcode_t; - -typedef struct wsh_s { - ws_socket_t sock; - char *buffer; - char *bbuffer; - char *body; - char *uri; - size_t buflen; - size_t bbuflen; - ssize_t datalen; - ssize_t wdatalen; - char *payload; - ssize_t plen; - ssize_t rplen; - ssize_t packetlen; - SSL *ssl; - int handshake; - uint8_t down; - int secure; - uint8_t close_sock; - SSL_CTX *ssl_ctx; - int block; - int sanity; - int secure_established; - int logical_established; - int stay_open; - int x; - void *write_buffer; - size_t write_buffer_len; -} wsh_t; - -ssize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc); -ssize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes); - - -ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block); -ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes); -ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); -ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); -int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block, int stay_open); -ssize_t ws_close(wsh_t *wsh, int16_t reason); -void ws_destroy(wsh_t *wsh); -void init_ssl(void); -void deinit_ssl(void); -int xp_errno(void); -int xp_is_blocking(int errcode); - - - -#ifndef _MSC_VER -static inline uint64_t get_unaligned_uint64(const void *p) -{ - const struct { uint64_t d; } __attribute__((packed)) *pp = p; - return pp->d; -} -#endif - -#endif diff --git a/w32/libks.props b/w32/libks.props index c2e2565172..4bc05b2af0 100644 --- a/w32/libks.props +++ b/w32/libks.props @@ -67,7 +67,7 @@ <ItemDefinitionGroup> <ClCompile> - <AdditionalIncludeDirectories>$(libksDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(libksDir)\src\include;$(libksDir)\src\include\libks;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>__PRETTY_FUNCTION__=__FUNCSIG__;WIN32;_WINDOWS;SWCLT_VERSION_MAJOR=1;SWCLT_VERSION_MINOR=0;SWCLT_VERSION_REVISION=0;_WIN32_WINNT=0x0600;_WINSOCK_DEPRECATED_NO_WARNINGS=1;WIN32_LEAN_AND_MEAN=1;KS_PLAT_WIN=1;NOMAXMIN=1;_CRT_SECURE_NO_WARNINGS=1;SWCLT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <Link> From da8e3b04db883b2b49b34d614f82028b516ce65d Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 15 Jun 2020 15:13:39 +0400 Subject: [PATCH 304/655] [mod_verto] Fix content length overflow on 32bit --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 0e350bf16f..5d930b4df2 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1649,7 +1649,7 @@ new_req: goto done; } - if (request->content_length && request->content_length > 5l * 1024 * 1024 * 1024 - 1) { + if (request->content_length && request->content_length > INT32_MAX) { char *data = "HTTP/1.1 413 Request Entity Too Large\r\n" "Content-Length: 0\r\n\r\n"; kws_raw_write(jsock->ws, data, strlen(data)); From dc4bef79ecd3231fabf551916837c6f1e07d0d33 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Thu, 21 Feb 2019 23:19:52 +0000 Subject: [PATCH 305/655] [core]speed up call setup --- src/include/switch_utils.h | 2 +- src/mod/endpoints/mod_verto/mod_verto.c | 4 ++++ src/switch_rtp.c | 10 +++++----- src/switch_utils.c | 16 ++++++++++------ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index e5a794282a..62f3fcd97e 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -590,7 +590,7 @@ SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *s SWITCH_DECLARE(char *) get_addr6(char *buf, switch_size_t len, struct sockaddr_in6 *sa, socklen_t salen); SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa); -SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2); +SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2, switch_bool_t ip_only); SWITCH_DECLARE(int) switch_cp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2); /*! diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 5d930b4df2..bc8d017305 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -2648,10 +2648,14 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ } break; case SWITCH_MESSAGE_INDICATE_ANSWER: + switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ANSWERED"); + switch_channel_mark_pre_answered(tech_pvt->channel); r = verto_send_media_indication(session, "verto.answer"); break; case SWITCH_MESSAGE_INDICATE_PROGRESS: r = verto_send_media_indication(session, "verto.media"); + switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA"); + switch_channel_mark_pre_answered(tech_pvt->channel); break; default: break; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index aa25ea1c79..1c51c9f2b4 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1256,7 +1256,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d port = switch_sockaddr_get_port(from_addr); host2 = switch_get_addr(buf2, sizeof(buf2), ice->addr); port2 = switch_sockaddr_get_port(ice->addr); - cmp = switch_cmp_addr(from_addr, ice->addr); + cmp = switch_cmp_addr(from_addr, ice->addr, SWITCH_FALSE); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG4, "STUN from %s:%d %s\n", host, port, cmp ? "EXPECTED" : "IGNORED"); @@ -1266,7 +1266,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d rtp_session->wrong_addrs = 0; } else { if (((rtp_session->dtls && rtp_session->dtls->state != DS_READY) || !ice->ready || !ice->rready) && - rtp_session->wrong_addrs > 2 && rtp_session->ice_adj == 0) { + (rtp_session->wrong_addrs > 2 || switch_cmp_addr(from_addr, ice->addr, SWITCH_TRUE)) && rtp_session->ice_adj == 0) { do_adj++; rtp_session->ice_adj = 1; rtp_session->wrong_addrs = 0; @@ -7250,7 +7250,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t /* RTCP Auto ADJ */ if (*bytes && rtp_session->flags[SWITCH_RTP_FLAG_RTCP_AUTOADJ] && switch_sockaddr_get_port(rtp_session->rtcp_from_addr)) { - if (!switch_cmp_addr(rtp_session->rtcp_from_addr, rtp_session->rtcp_remote_addr)) { + if (!switch_cmp_addr(rtp_session->rtcp_from_addr, rtp_session->rtcp_remote_addr, SWITCH_FALSE)) { if (++rtp_session->rtcp_autoadj_tally >= rtp_session->rtcp_autoadj_threshold) { const char *err; uint32_t old = rtp_session->remote_rtcp_port; @@ -7827,13 +7827,13 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ goto recvfrom; } - } else if (!(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PACKETS) && !switch_cmp_addr(rtp_session->rtp_from_addr, rtp_session->remote_addr)) { + } else if (!(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PACKETS) && !switch_cmp_addr(rtp_session->rtp_from_addr, rtp_session->remote_addr, SWITCH_FALSE)) { goto recvfrom; } } if (bytes && rtp_session->flags[SWITCH_RTP_FLAG_AUTOADJ] && switch_sockaddr_get_port(rtp_session->rtp_from_addr)) { - if (!switch_cmp_addr(rtp_session->rtp_from_addr, rtp_session->remote_addr)) { + if (!switch_cmp_addr(rtp_session->rtp_from_addr, rtp_session->remote_addr, SWITCH_FALSE)) { if (++rtp_session->autoadj_tally >= rtp_session->autoadj_threshold) { const char *err; uint32_t old = rtp_session->remote_port; diff --git a/src/switch_utils.c b/src/switch_utils.c index c19a4c6b60..1d590d24f4 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2349,7 +2349,7 @@ SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa) return ntohs((unsigned short) s->sin_addr.s_addr); } -SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2) +SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2, switch_bool_t ip_only) { struct sockaddr_in *s1; struct sockaddr_in *s2; @@ -2377,17 +2377,21 @@ SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *s switch (ss1->sa_family) { case AF_INET: - return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port); + if (ip_only) { + return (s1->sin_addr.s_addr == s2->sin_addr.s_addr); + } else { + return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port); + } case AF_INET6: if (s16->sin6_addr.s6_addr && s26->sin6_addr.s6_addr) { int i; - if (s16->sin6_port != s26->sin6_port) - return 0; + if (!ip_only) { + if (s16->sin6_port != s26->sin6_port) return 0; + } for (i = 0; i < 4; i++) { - if (*((int32_t *) s16->sin6_addr.s6_addr + i) != *((int32_t *) s26->sin6_addr.s6_addr + i)) - return 0; + if (*((int32_t *) s16->sin6_addr.s6_addr + i) != *((int32_t *) s26->sin6_addr.s6_addr + i)) return 0; } return 1; From 2d5df53009f4ab6dbd4c85e55d68e2d0105e259d Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Mon, 4 Mar 2019 18:39:20 +0000 Subject: [PATCH 306/655] [mod_verto] new changes for verto video features --- src/include/switch_types.h | 1 + src/mod/endpoints/mod_verto/mod_verto.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 69e87f4aff..bfbdb9c3ce 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1627,6 +1627,7 @@ typedef enum { CF_STATE_REPEAT, CF_WANT_DTLSv1_2, CF_RFC7329_COMPAT, + CF_REATTACHED, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index bc8d017305..182786d5f7 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1222,6 +1222,7 @@ static void tech_reattach(verto_pvt_t *tech_pvt, jsock_t *jsock) add_variables(tech_pvt, params); + switch_channel_set_flag(tech_pvt->channel, CF_REATTACHED); switch_channel_set_flag(tech_pvt->channel, CF_REINVITE); switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING); switch_core_media_gen_local_sdp(tech_pvt->session, SDP_TYPE_REQUEST, NULL, 0, NULL, 0); From 1793c8cb7a3da08a20755726af4048cef715bad0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Fri, 21 Feb 2020 18:52:35 +0000 Subject: [PATCH 307/655] [mod_verto] add new verto command construct basics --- src/mod/endpoints/mod_verto/mod_verto.c | 39 ++++++++++++++++++++----- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 182786d5f7..9aea22c9a2 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3431,7 +3431,7 @@ static void parse_user_vars(cJSON *obj, switch_core_session_t *session) static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { - cJSON *msg = NULL, *dialog = NULL, *txt = NULL; + cJSON *msg = NULL, *dialog = NULL, *txt = NULL, *jevent = NULL; const char *call_id = NULL, *dtmf = NULL; switch_bool_t r = SWITCH_TRUE; char *proto = VERTO_CHAT_PROTO; @@ -3449,17 +3449,42 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t switch_core_session_t *session = NULL; if ((session = switch_core_session_locate(call_id))) { + verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); + + if (!tech_pvt) { + cJSON_AddItemToObject(*response, "message", cJSON_CreateString("Invalid channel")); + switch_core_session_rwunlock(session); + err = 1; goto cleanup; + } parse_user_vars(dialog, session); - if ((dtmf = cJSON_GetObjectCstr(params, "dtmf"))) { - verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); - char *send; + if ((jevent = cJSON_GetObjectItem(params, "command"))) { + switch_event_t *event = NULL; - if (!tech_pvt) { - cJSON_AddItemToObject(*response, "message", cJSON_CreateString("Invalid channel")); - err = 1; goto cleanup; + if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { + char *json_text; + + json_text = cJSON_PrintUnformatted(jevent); + switch_assert(json_text); + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "content-type", "text/json"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "content-source", "verto"); + switch_event_add_body(event, "%s", json_text); + + switch_safe_free(json_text); + + if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + cJSON_AddItemToObject(*response, "message", cJSON_CreateString("Unexpected Error")); + switch_core_session_rwunlock(session); + err = 1; goto cleanup; + } } + } + + if ((dtmf = cJSON_GetObjectCstr(params, "dtmf"))) { + char *send; send = switch_mprintf("~%s", dtmf); From a33062c9d853090b0b4e045ae2ba15b0d727e553 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Wed, 18 Mar 2020 23:58:33 +0000 Subject: [PATCH 308/655] [mod_verto] verto re-invites part 1 --- src/mod/endpoints/mod_verto/mod_verto.c | 81 ++++++++++++++++++++++--- src/switch_rtp.c | 4 +- 2 files changed, 76 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 9aea22c9a2..c5f2a1afb5 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3204,8 +3204,9 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock switch_core_session_t *session; cJSON *dialog = NULL; const char *call_id = NULL, *destination = NULL, *action = NULL; - int err = 0; - + int err = 0, is_reinvite = 0; + verto_pvt_t *tech_pvt = NULL; + *response = obj; if (!params) { @@ -3228,14 +3229,66 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock err = 1; goto cleanup; } + + cJSON_AddItemToObject(obj, "callID", cJSON_CreateString(call_id)); cJSON_AddItemToObject(obj, "action", cJSON_CreateString(action)); if ((session = switch_core_session_locate(call_id))) { - verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); + tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); + + if (!strcasecmp(action, "updateMedia")) { + const char *sdp = NULL; + uint8_t match = 0, p = 0; - if (!strcasecmp(action, "transfer")) { + if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) { + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + cJSON_AddItemToObject(obj, "message", cJSON_CreateString("Cannot update a call that has not been answered.")); + err = 1; goto rwunlock; + } + + is_reinvite = 1; + + if (!(sdp = cJSON_GetObjectCstr(params, "sdp"))) { + cJSON_AddItemToObject(obj, "message", cJSON_CreateString("SDP missing")); + err = 1; goto rwunlock; + } + + tech_pvt->r_sdp = switch_core_session_strdup(session, sdp); + + + switch_channel_set_variable(tech_pvt->channel, SWITCH_R_SDP_VARIABLE, tech_pvt->r_sdp); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "updateMedia: Remote SDP %s:\n%s\n", + switch_channel_get_name(tech_pvt->channel), tech_pvt->r_sdp); + + switch_core_media_clear_ice(tech_pvt->session); + switch_channel_set_flag(tech_pvt->channel, CF_REINVITE); + //switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING); + + //switch_channel_audio_sync(tech_pvt->channel); + //switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK); + //switch_core_session_kill_channel(tech_pvt->session, SWITCH_SIG_BREAK); + + if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_REQUEST))) { + switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0); + + if (switch_core_media_activate_rtp(tech_pvt->session) != SWITCH_STATUS_SUCCESS) { + switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "MEDIA ERROR"); + cJSON_AddItemToObject(obj, "message", cJSON_CreateString("MEDIA ERROR")); + err = 1; goto rwunlock; + } + + cJSON_AddItemToObject(obj, "sdp", cJSON_CreateString(tech_pvt->mparams->local_sdp_str)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "updateMedia: Local SDP %s:\n%s\n", + switch_channel_get_name(tech_pvt->channel), tech_pvt->mparams->local_sdp_str); + } else { + switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); + cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CODEC NEGOTIATION ERROR")); + err = 1; goto rwunlock; + } + + } else if (!strcasecmp(action, "transfer")) { switch_core_session_t *other_session = NULL; if (!(destination = cJSON_GetObjectCstr(params, "destination"))) { @@ -3293,6 +3346,15 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock cleanup: + if (tech_pvt && is_reinvite) { + switch_channel_clear_flag(tech_pvt->channel, CF_REINVITE); + //switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING); + switch_clear_flag(tech_pvt, TFLAG_ATTACH_REQ); + if (switch_channel_test_flag(tech_pvt->channel, CF_CONFERENCE)) { + switch_channel_set_flag(tech_pvt->channel, CF_CONFERENCE_ADV); + } + } + if (!err) return SWITCH_TRUE; @@ -3357,18 +3419,23 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock switch_core_media_clear_ice(tech_pvt->session); switch_channel_set_flag(tech_pvt->channel, CF_REINVITE); - switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING); + //switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING); //switch_channel_audio_sync(tech_pvt->channel); //switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK); //switch_core_session_kill_channel(tech_pvt->session, SWITCH_SIG_BREAK); - if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_RESPONSE))) { + if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_REQUEST))) { + switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0); + if (switch_core_media_activate_rtp(tech_pvt->session) != SWITCH_STATUS_SUCCESS) { switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "MEDIA ERROR"); cJSON_AddItemToObject(obj, "message", cJSON_CreateString("MEDIA ERROR")); err = 1; goto cleanup; } + + cJSON_AddItemToObject(obj, "sdp", cJSON_CreateString(tech_pvt->mparams->local_sdp_str)); + } else { switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CODEC NEGOTIATION ERROR")); @@ -3379,7 +3446,7 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock if (tech_pvt) { switch_channel_clear_flag(tech_pvt->channel, CF_REINVITE); - switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING); + //switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING); switch_clear_flag(tech_pvt, TFLAG_ATTACH_REQ); if (switch_channel_test_flag(tech_pvt->channel, CF_CONFERENCE)) { switch_channel_set_flag(tech_pvt->channel, CF_CONFERENCE_ADV); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1c51c9f2b4..f2c5bf7405 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3043,8 +3043,8 @@ SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session) return; } - rtp_session->seq = (uint16_t) rand(); - rtp_session->ts = 0; + //rtp_session->seq = (uint16_t) rand(); + //rtp_session->ts = 0; memset(&rtp_session->ts_norm, 0, sizeof(rtp_session->ts_norm)); rtp_session->last_stun = rtp_session->first_stun = 0; From fb2250df8e7bff1ab83289ecacb33a79ee35fb7a Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Sun, 29 Mar 2020 20:01:03 -0500 Subject: [PATCH 309/655] [mod_verto] indicate video fps and size of current layer to client --- src/include/switch_core_media.h | 2 + src/include/switch_types.h | 2 + .../applications/mod_commands/mod_commands.c | 42 +++++ src/mod/endpoints/mod_verto/mod_verto.c | 27 ++++ src/switch_core_media.c | 143 ++++++++++++++++++ 5 files changed, 216 insertions(+) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 105cd50f97..c84416c86e 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -249,6 +249,8 @@ SWITCH_DECLARE(switch_core_media_params_t *) switch_core_media_get_mparams(switc SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force); SWITCH_DECLARE(void) switch_core_media_start_udptl(switch_core_session_t *session, switch_t38_options_t *t38_options); SWITCH_DECLARE(void) switch_core_media_hard_mute(switch_core_session_t *session, switch_bool_t on); +SWITCH_DECLARE(cJSON *) switch_core_media_gen_json_constraint(float min, float ideal, float max); +SWITCH_DECLARE(switch_status_t) switch_core_media_media_params(switch_core_session_t *session, const char *json); SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index bfbdb9c3ce..2baddf0101 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1137,6 +1137,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_DEFLECT, SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ, SWITCH_MESSAGE_INDICATE_DISPLAY, + SWITCH_MESSAGE_INDICATE_MEDIA_PARAMS, SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY, SWITCH_MESSAGE_INDICATE_AUDIO_SYNC, SWITCH_MESSAGE_INDICATE_VIDEO_SYNC, @@ -1532,6 +1533,7 @@ typedef enum { CF_INTERCEPTED, CF_VIDEO_REFRESH_REQ, CF_MANUAL_VID_REFRESH, + CF_MANUAL_MEDIA_PARAMS, CF_SERVICE_AUDIO, CF_SERVICE_VIDEO, CF_ZRTP_PASSTHRU_REQ, diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 5d8313e5c5..960268cd4f 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4041,6 +4041,46 @@ SWITCH_STANDARD_API(uuid_display_function) return SWITCH_STATUS_SUCCESS; } +#define MEDIA_PARAMS_SYNTAX "<uuid> <json>" +SWITCH_STANDARD_API(uuid_media_params_function) +{ + char *mycmd = NULL, *argv[2] = { 0 }; + int argc = 0; + switch_status_t status = SWITCH_STATUS_FALSE; + switch_core_session_t *tsession = NULL; + + if (!zstr(cmd) && (mycmd = strdup(cmd))) { + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (zstr(cmd) || argc < 2 || zstr(argv[0]) || zstr(argv[1])) { + stream->write_function(stream, "-USAGE: %s\n", MEDIA_PARAMS_SYNTAX); + goto end; + } else { + if ((tsession = switch_core_session_locate(argv[0]))) { + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (switch_false(argv[1])) { + switch_channel_clear_flag(channel, CF_MANUAL_MEDIA_PARAMS); + } else if ((status = switch_core_media_media_params(tsession, argv[1])) == SWITCH_STATUS_SUCCESS) { + switch_channel_set_flag(channel, CF_MANUAL_MEDIA_PARAMS); + } + switch_core_session_rwunlock(tsession); + } + } + + if (status == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK Success\n"); + } else { + stream->write_function(stream, "-ERR Operation failed\n"); + } + + end: + + switch_safe_free(mycmd); + return SWITCH_STATUS_SUCCESS; +} + #define BUGLIST_SYNTAX "<uuid>" SWITCH_STANDARD_API(uuid_buglist_function) { @@ -7636,6 +7676,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_displace", "Displace audio", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]"); SWITCH_ADD_API(commands_api_interface, "uuid_display", "Update phone display", uuid_display_function, DISPLAY_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_media_params", "Update remote vid params", uuid_media_params_function, MEDIA_PARAMS_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_drop_dtmf", "Drop all DTMF or replace it with a mask", uuid_drop_dtmf, UUID_DROP_DTMF_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_dump", "Dump session vars", uuid_dump_function, DUMP_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_exists", "Check if a uuid exists", uuid_exists_function, EXISTS_SYNTAX); @@ -7827,6 +7868,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_deflect ::console::list_uuid"); switch_console_set_complete("add uuid_displace ::console::list_uuid"); switch_console_set_complete("add uuid_display ::console::list_uuid"); + switch_console_set_complete("add uuid_media_params ::console::list_uuid"); switch_console_set_complete("add uuid_drop_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_dump ::console::list_uuid"); switch_console_set_complete("add uuid_answer ::console::list_uuid"); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index c5f2a1afb5..4420f86a21 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -2636,6 +2636,33 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ } } break; + case SWITCH_MESSAGE_INDICATE_MEDIA_PARAMS: + { + const char *json_text; + cJSON *jmsg = NULL, *params = NULL, *vparams = NULL; + jsock_t *jsock = NULL; + + if ((jsock = get_jsock(tech_pvt->jsock_uuid))) { + + json_text = msg->string_arg; + + if (json_text) { + jmsg = jrpc_new_req("verto.mediaParams", tech_pvt->call_id, &params); + if ((vparams = cJSON_Parse((char *)json_text))) { + cJSON_AddItemToObject(params, "mediaParams", vparams); + jsock_queue_event(jsock, &jmsg, SWITCH_TRUE); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Parsing Media Params\n"); + r = SWITCH_STATUS_FALSE; + cJSON_Delete(jmsg); + } + } + + switch_thread_rwlock_unlock(jsock->rwlock); + } + + } + break; case SWITCH_MESSAGE_INDICATE_MEDIA_RENEG: { jsock_t *jsock = NULL; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 71c02aa6a9..b6cb4b6670 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -12429,6 +12429,149 @@ SWITCH_DECLARE(void) switch_core_media_hard_mute(switch_core_session_t *session, switch_core_session_receive_message(session, &msg); } +SWITCH_DECLARE(cJSON *) switch_core_media_gen_json_constraint(float min, float ideal, float max) +{ + cJSON *ret = NULL, *n = NULL; + + if ((!ideal && !max)) { + ret = cJSON_CreateNumber(min); + } else { + ret = cJSON_CreateObject(); + n = cJSON_CreateNumber(min); + cJSON_AddItemToObject(ret, "min", n); + + if (ideal) { + n = cJSON_CreateNumber(ideal); + cJSON_AddItemToObject(ret, "ideal", n); + } + + if (max) { + n = cJSON_CreateNumber(max); + cJSON_AddItemToObject(ret, "max", n); + } + } + + return ret; +} + +static cJSON *parse_val(char *str) { + char *argv[3]; + int argc = 0; + float min = 0, ideal = 0, max = 0; + + argc = switch_separate_string(str, ':', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc > 0) { + min = atof(argv[0]); + } + + if (argc > 1) { + ideal = atof(argv[1]); + } + + if (argc > 2) { + max = atof(argv[2]); + } + + return switch_core_media_gen_json_constraint(min, ideal, max); + +} + +SWITCH_DECLARE(switch_status_t) switch_core_media_media_params(switch_core_session_t *session, const char *json) +{ + switch_core_session_message_t msg = { 0 }; + char *parse = NULL; + char *argv[25]; + int argc = 0, i; + switch_status_t r = SWITCH_STATUS_SUCCESS; + cJSON *obj = NULL; + char *aspect = NULL, *fps = NULL, *width = NULL, *height = NULL, *jtmp = NULL; + + + if (switch_channel_test_flag(session->channel, CF_MANUAL_MEDIA_PARAMS)) { + return SWITCH_STATUS_INUSE; + } + + if (switch_stristr("=", json)) { + char *name, *val; + cJSON *video, *p; + int vid = 0; + + parse = strdup(json); + argc = switch_separate_string(parse, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + + for(i = 0; i < argc; i++) { + name = argv[i]; + if ((val = strchr(name, '='))) { + *val++ = '\0'; + } + + if (name && val) { + if (!strcmp(name, "aspect")) { + aspect = val; + vid++; + } else if (!strcmp(name, "fps")) { + fps = val; + vid++; + } else if (!strcmp(name, "width")) { + width = val; + vid++; + } else if (!strcmp(name, "height")) { + height = val; + vid++; + } + } + } + + obj = cJSON_CreateObject(); + + if (vid) { + video = cJSON_CreateObject(); + + if (fps) { + p = parse_val(fps); + cJSON_AddItemToObject(video, "frameRate", p); + } + + if (width) { + p = parse_val(width); + cJSON_AddItemToObject(video, "width", p); + } + + if (height) { + p = parse_val(height); + cJSON_AddItemToObject(video, "height", p); + } + + if (aspect) { + p = cJSON_CreateNumber(atof(aspect)); + cJSON_AddItemToObject(video, "aspectRatio", p); + } + + cJSON_AddItemToObject(obj, "video", video); + } + + jtmp = cJSON_PrintUnformatted(obj); + json = jtmp; + } + + + + msg.from = __FILE__; + + msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_PARAMS; + msg.string_arg = json; + r = switch_core_session_receive_message(session, &msg); + + switch_safe_free(parse); + switch_safe_free(jtmp); + if (obj) { + cJSON_Delete(obj); + } + + return r; +} + static int check_engine(switch_rtp_engine_t *engine) { dtls_state_t dtls_state = switch_rtp_dtls_state(engine->rtp_session, DTLS_TYPE_RTP); From 902fa2c3da3e39f8f3cda4b57397d019f12b3bee Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 1 Apr 2020 00:31:23 +0000 Subject: [PATCH 310/655] [mod_verto] add debug controls for verto --- src/mod/endpoints/mod_verto/mod_verto.c | 32 ++++++++++++++++++++----- src/mod/endpoints/mod_verto/mod_verto.h | 3 +++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 4420f86a21..b92693870a 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -293,7 +293,7 @@ static uint32_t jsock_unsub_head(jsock_t *jsock, jsock_sub_node_head_t *head) } if (thisnp->jsock->profile->debug || verto_globals.debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "UNSUBBING %s [%s]\n", thisnp->jsock->name, thisnp->head->event_channel); + switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "UNSUBBING %s [%s]\n", thisnp->jsock->name, thisnp->head->event_channel); } thisnp->jsock = NULL; @@ -603,7 +603,7 @@ static switch_ssize_t ws_write_json(jsock_t *jsock, cJSON **json, switch_bool_t if ((json_text = cJSON_PrintUnformatted(*json))) { if (jsock->profile->debug || verto_globals.debug) { char *log_text = cJSON_Print(*json); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WRITE %s [%s]\n", jsock->name, log_text); + switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "WRITE %s [%s]\n", jsock->name, log_text); free(log_text); } switch_mutex_lock(jsock->write_mutex); @@ -1429,7 +1429,7 @@ static switch_status_t process_input(jsock_t *jsock, uint8_t *data, switch_ssize if (jsock->profile->debug || verto_globals.debug) { char *log_text = cJSON_Print(json); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "READ %s [%s]\n", jsock->name, log_text); + switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "READ %s [%s]\n", jsock->name, log_text); free(log_text); } @@ -4218,7 +4218,7 @@ static switch_bool_t verto__broadcast_func(const char *method, cJSON *params, js //r = SWITCH_TRUE; //cJSON_AddItemToObject(*response, "message", cJSON_CreateString("MCAST Data Sent")); if (verto_globals.debug > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MCAST Data Sent: %s\n",json_text); + switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "MCAST Data Sent: %s\n",json_text); } } free(json_text); @@ -5301,6 +5301,7 @@ SWITCH_STANDARD_API(verto_function) "--------------------------------------------------------------------------------\n" "verto [status|xmlstatus]\n" "verto help\n" + "verto debug [0-10]\n" "--------------------------------------------------------------------------------\n"; if (zstr(cmd)) { @@ -5325,6 +5326,22 @@ SWITCH_STANDARD_API(verto_function) func = cmd_status; } else if (!strcasecmp(argv[0], "xmlstatus")) { func = cmd_xml_status; + } else if (!strcasecmp(argv[0], "debug")) { + if (argv[1]) { + int tmp = atoi(argv[1]); + + if (tmp >= 0 && tmp <= 10) { + verto_globals.debug = tmp; + } + } + stream->write_function(stream, "Debug Level: %d\n", verto_globals.debug); + goto done; + } else if (!strcasecmp(argv[0], "debug-level")) { + if (argv[1]) { + verto_globals.debug_level = switch_log_str2level(argv[1]); + } + stream->write_function(stream, "Debug Level: %s\n", switch_log_level2str(verto_globals.debug_level)); + goto done; } if (func) { @@ -5740,7 +5757,7 @@ void verto_broadcast(const char *event_channel, cJSON *json, const char *key, sw if (verto_globals.debug > 9) { char *json_text; if ((json_text = cJSON_Print(json))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EVENT BROADCAST %s %s\n", event_channel, json_text); + switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "EVENT BROADCAST %s %s\n", event_channel, json_text); free(json_text); } } @@ -6338,7 +6355,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) #endif verto_globals.enable_presence = SWITCH_TRUE; verto_globals.enable_fs_events = SWITCH_FALSE; - + verto_globals.debug_level = SWITCH_LOG_INFO; + switch_mutex_init(&verto_globals.mutex, SWITCH_MUTEX_NESTED, verto_globals.pool); switch_mutex_init(&verto_globals.method_mutex, SWITCH_MUTEX_NESTED, verto_globals.pool); @@ -6391,6 +6409,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) SWITCH_ADD_API(api_interface, "verto", "Verto API", verto_function, "syntax"); SWITCH_ADD_API(api_interface, "verto_contact", "Generate a verto endpoint dialstring", verto_contact_function, "user@domain"); switch_console_set_complete("add verto help"); + switch_console_set_complete("add verto debug"); + switch_console_set_complete("add verto debug-level"); switch_console_set_complete("add verto status"); switch_console_set_complete("add verto xmlstatus"); diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index c82f813da4..bbf0114503 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -326,6 +326,9 @@ struct globals_s { uint32_t detach_timeout; switch_event_channel_id_t event_channel_id; + + switch_log_level_t debug_level; + }; From ff48868dc410077e027b5b7706c7101548fc8e38 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sun, 5 Apr 2020 20:15:12 +0000 Subject: [PATCH 311/655] [mod_verto] add param to have verto send pass over xml_curl --- src/mod/endpoints/mod_verto/mod_verto.c | 8 ++++++++ src/mod/endpoints/mod_verto/mod_verto.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index b92693870a..4d02fee4f8 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -984,6 +984,10 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * } } + if (jsock->profile->send_passwd || verto_globals.send_passwd) { + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "user_supplied_pass", passwd); + } + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "action", "jsonrpc-authenticate"); if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, req_params) != SWITCH_STATUS_SUCCESS && !jsock->profile->blind_reg) { @@ -4953,6 +4957,8 @@ static switch_status_t parse_config(const char *cf) profile->userauth = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "root-password") && !zstr(val)) { profile->root_passwd = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "send-auth-password") && !zstr(val)) { + profile->send_passwd = switch_true(val); } else if (!strcasecmp(var, "context") && !zstr(val)) { profile->context = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "dialplan") && !zstr(val)) { @@ -5148,6 +5154,8 @@ static switch_status_t parse_config(const char *cf) } } else if (!strcasecmp(var, "enable-presence") && val) { verto_globals.enable_presence = switch_true(val); + } else if (!strcasecmp(var, "send-auth-password") && !zstr(val)) { + verto_globals.send_passwd = switch_true(val); } else if (!strcasecmp(var, "enable-fs-events") && val) { verto_globals.enable_fs_events = switch_true(val); } else if (!strcasecmp(var, "detach-timeout-sec") && val) { diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index bbf0114503..9018f6ce95 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -246,6 +246,8 @@ struct verto_profile_s { char *userauth; char *root_passwd; + int send_passwd; + char *context; char *dialplan; @@ -307,6 +309,7 @@ struct globals_s { int debug; int ready; + int send_passwd; int profile_threads; int enable_presence; int enable_fs_events; From 91c037904140d53c146c5c4f2b73885721fec290 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 10 Apr 2020 21:36:37 +0000 Subject: [PATCH 312/655] [mod_verto] get the conference to send a keyframe when you reload/attach so the video shows up faster --- .../mod_conference/conference_video.c | 3 ++- src/mod/endpoints/mod_verto/mod_verto.c | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 357f30a560..e94b835c3d 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -3344,7 +3344,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (imember->watching_canvas_id == canvas->canvas_id && switch_channel_test_flag(imember->channel, CF_VIDEO_REFRESH_REQ)) { switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ); - send_keyframe = SWITCH_TRUE; + canvas->send_keyframe = 30; + send_keyframe = 1; } if (conference_utils_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING) && diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 4d02fee4f8..a5c0c1c841 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1239,6 +1239,8 @@ static void tech_reattach(verto_pvt_t *tech_pvt, jsock_t *jsock) switch_channel_get_name(tech_pvt->channel), tech_pvt->mparams->local_sdp_str); set_call_params(params, tech_pvt); + switch_core_media_gen_key_frame(tech_pvt->session); + switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); jsock_queue_event(jsock, &msg, SWITCH_TRUE); } @@ -3484,6 +3486,17 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock } } + if (tech_pvt) { + if (err) { + if (tech_pvt->channel) { + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL); + } + } else { + switch_core_media_gen_key_frame(tech_pvt->session); + switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); + } + } + if (session) { switch_core_session_rwunlock(session); } @@ -3492,11 +3505,6 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock return SWITCH_TRUE; } - if (tech_pvt && tech_pvt->channel) { - switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL); - } - - cJSON_AddItemToObject(obj, "code", cJSON_CreateNumber(CODE_SESSION_ERROR)); return SWITCH_FALSE; From 993e778fccccc59168d3b8d22b6febe871483699 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Mon, 13 Apr 2020 23:17:37 +0000 Subject: [PATCH 313/655] [mod_verto] fix reattach on reopen --- src/mod/endpoints/mod_verto/mod_verto.c | 36 ++++++++++++++++++++----- src/mod/endpoints/mod_verto/mod_verto.h | 4 ++- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index a5c0c1c841..4ce7b82b7c 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1040,7 +1040,9 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * const char *var = switch_xml_attr_soft(x_param, "name"); const char *val = switch_xml_attr_soft(x_param, "value"); + switch_mutex_lock(jsock->flag_mutex); switch_event_add_header_string(jsock->vars, SWITCH_STACK_BOTTOM, var, val); + switch_mutex_unlock(jsock->flag_mutex); } } @@ -1127,6 +1129,8 @@ static jsock_t *get_jsock(const char *uuid) return jsock; } +static void tech_reattach(verto_pvt_t *tech_pvt, jsock_t *jsock); + static void attach_jsock(jsock_t *jsock) { jsock_t *jp; @@ -1146,9 +1150,11 @@ static void attach_jsock(jsock_t *jsock) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "New connection for session %s dropping previous connection.\n", jsock->uuid_str); switch_core_hash_delete(verto_globals.jsock_hash, jsock->uuid_str); ws_write_json(jp, &msg, SWITCH_TRUE); + detach_calls(jp); cJSON_Delete(msg); jp->nodelete = 1; jp->drop = 1; + jsock->attach_timer = 5; } } @@ -1890,6 +1896,13 @@ static void client_run(jsock_t *jsock) if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); } if (pflags < 0 && (errno != EINTR)) { die_errnof("%s POLL FAILED with %d", jsock->name, pflags); } if (pflags == 0) {/* socket poll timeout */ jsock_check_event_queue(jsock); } + + if ((!switch_test_flag(jsock, JPFLAG_CHECK_ATTACH) || (jsock->attach_timer > 0 && jsock->attach_timer-- == 0)) && + switch_test_flag(jsock, JPFLAG_AUTHED)) { + attach_calls(jsock); + switch_set_flag(jsock, JPFLAG_CHECK_ATTACH); + } + if (pflags > 0 && (pflags & KS_POLL_HUP)) { log_and_exit(SWITCH_LOG_INFO, "%s POLL HANGUP DETECTED (peer closed its end of socket)\n", jsock->name); } if (pflags > 0 && (pflags & KS_POLL_ERROR)) { die("%s POLL ERROR\n", jsock->name); } if (pflags > 0 && (pflags & KS_POLL_INVALID)) { die("%s POLL INVALID SOCKET (not opened or already closed)\n", jsock->name); } @@ -1976,11 +1989,6 @@ static void client_run(jsock_t *jsock) if (process_input(jsock, data, bytes) != SWITCH_STATUS_SUCCESS) { die("%s Input Error\n", jsock->name); } - - if (!switch_test_flag(jsock, JPFLAG_CHECK_ATTACH) && switch_test_flag(jsock, JPFLAG_AUTHED)) { - attach_calls(jsock); - switch_set_flag(jsock, JPFLAG_CHECK_ATTACH); - } } } } @@ -3929,10 +3937,12 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock } } + switch_mutex_lock(jsock->flag_mutex); if (!(context = switch_event_get_header(jsock->vars, "user_context"))) { context = switch_either(jsock->context, jsock->profile->context); } - + switch_mutex_unlock(jsock->flag_mutex); + if ((caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), jsock->uid, switch_either(jsock->dialplan, jsock->profile->dialplan), @@ -4247,9 +4257,22 @@ static switch_bool_t verto__broadcast_func(const char *method, cJSON *params, js static switch_bool_t login_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { + const char *var; *response = cJSON_CreateObject(); cJSON_AddItemToObject(*response, "message", cJSON_CreateString("logged in")); + switch_mutex_lock(jsock->flag_mutex); + if ((var = switch_event_get_header(jsock->vars, "moderator")) && switch_true(var)) { + cJSON_AddItemToObject(*response, "moderator", cJSON_CreateTrue()); + switch_event_add_header_string(jsock->vars, SWITCH_STACK_BOTTOM, "conf_mvar_moderator", "true"); + } + + if ((var = switch_event_get_header(jsock->vars, "superuser")) && switch_true(var)) { + switch_event_add_header_string(jsock->vars, SWITCH_STACK_BOTTOM, "conf_mvar_superuser", "true"); + cJSON_AddItemToObject(*response, "superuser", cJSON_CreateTrue()); + } + switch_mutex_unlock(jsock->flag_mutex); + login_fire_custom_event(jsock, params, 1, "Logged in"); return SWITCH_TRUE; @@ -4474,6 +4497,7 @@ static int start_jsock(verto_profile_t *profile, ks_socket_t sock, int family) switch_mutex_init(&jsock->write_mutex, SWITCH_MUTEX_NESTED, jsock->pool); switch_mutex_init(&jsock->filter_mutex, SWITCH_MUTEX_NESTED, jsock->pool); + switch_mutex_init(&jsock->flag_mutex, SWITCH_MUTEX_NESTED, jsock->pool); switch_queue_create(&jsock->event_queue, MAX_QUEUE_LEN, jsock->pool); switch_thread_rwlock_create(&jsock->rwlock, jsock->pool); switch_thread_pool_launch_thread(&td); diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index 9018f6ce95..c9087e5ada 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -114,7 +114,8 @@ struct jsock_s { #ifndef WIN32 struct passwd pw; #endif - + uint32_t attach_timer; + uint8_t drop; uint8_t nodelete; ks_socket_t local_sock; @@ -145,6 +146,7 @@ struct jsock_s { switch_mutex_t *write_mutex; switch_mutex_t *filter_mutex; + switch_mutex_t *flag_mutex; switch_event_t *params; switch_event_t *vars; From 4220e4659a7b5d0a393f52373329933723dcc265 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sat, 18 Apr 2020 02:13:19 +0000 Subject: [PATCH 314/655] [mod_verto] make verto.attach always an answer and never an offer --- src/mod/endpoints/mod_verto/mod_verto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 4ce7b82b7c..ead2835448 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3460,22 +3460,22 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock switch_core_media_clear_ice(tech_pvt->session); switch_channel_set_flag(tech_pvt->channel, CF_REINVITE); - //switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING); + switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING); //switch_channel_audio_sync(tech_pvt->channel); //switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK); //switch_core_session_kill_channel(tech_pvt->session, SWITCH_SIG_BREAK); - if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_REQUEST))) { - switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0); + if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_RESPONSE))) { + //switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0); if (switch_core_media_activate_rtp(tech_pvt->session) != SWITCH_STATUS_SUCCESS) { switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "MEDIA ERROR"); cJSON_AddItemToObject(obj, "message", cJSON_CreateString("MEDIA ERROR")); err = 1; goto cleanup; } - - cJSON_AddItemToObject(obj, "sdp", cJSON_CreateString(tech_pvt->mparams->local_sdp_str)); + + //cJSON_AddItemToObject(obj, "sdp", cJSON_CreateString(tech_pvt->mparams->local_sdp_str)); } else { switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); From 249718e934c30059d33ee941bd88584f0470fa91 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 22 Apr 2020 03:20:24 +0000 Subject: [PATCH 315/655] [mod_verto] add log line to detect incorrect login --- src/mod/endpoints/mod_verto/mod_verto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index ead2835448..0735be4e95 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -994,6 +994,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * *code = CODE_AUTH_FAILED; switch_snprintf(message, mlen, "Login Incorrect"); login_fire_custom_event(jsock, params, 0, "Login Incorrect"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Login incorrect for user: %s domain: %s\n", id, domain ? domain : "N/A"); } else { switch_xml_t x_param, x_params; const char *use_passwd = NULL, *verto_context = NULL, *verto_dialplan = NULL; From c20cffdf61f1eb7ce2d63f8926f3f39fcbdf8cd5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Thu, 23 Apr 2020 21:25:21 +0000 Subject: [PATCH 316/655] [mod_verto] add jsonlist --- src/mod/endpoints/mod_verto/mod_verto.c | 85 +++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 0735be4e95..c9d3275817 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3392,9 +3392,9 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock switch_channel_clear_flag(tech_pvt->channel, CF_REINVITE); //switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING); switch_clear_flag(tech_pvt, TFLAG_ATTACH_REQ); - if (switch_channel_test_flag(tech_pvt->channel, CF_CONFERENCE)) { - switch_channel_set_flag(tech_pvt->channel, CF_CONFERENCE_ADV); - } + //if (switch_channel_test_flag(tech_pvt->channel, CF_CONFERENCE)) { + // switch_channel_set_flag(tech_pvt->channel, CF_CONFERENCE_ADV); + //} } @@ -5330,6 +5330,81 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl return SWITCH_STATUS_SUCCESS; } +static cJSON *json_status() +{ + cJSON *obj, *profiles, *jprofile, *users, *user; + verto_profile_t *profile = NULL; + jsock_t *jsock; + int i; + + obj = cJSON_CreateObject(); + profiles = cJSON_CreateArray(); + + cJSON_AddItemToObject(obj, "profiles", profiles); + + switch_mutex_lock(verto_globals.mutex); + for(profile = verto_globals.profile_head; profile; profile = profile->next) { + for (i = 0; i < profile->i; i++) { + char *tmpurl = switch_mprintf(strchr(profile->ip[i].local_ip, ':') ? "%s:[%s]:%d" : "%s:%s:%d", + (profile->ip[i].secure == 1) ? "wss" : "ws", profile->ip[i].local_ip, profile->ip[i].local_port); + jprofile = cJSON_CreateObject(); + + cJSON_AddItemToObject(jprofile, "name", cJSON_CreateString(profile->name)); + cJSON_AddItemToObject(jprofile, "id", cJSON_CreateString(tmpurl)); + cJSON_AddItemToObject(jprofile, "type", cJSON_CreateString(profile->ip[i].secure == 1 ? "SECURE" : "BASIC")); + cJSON_AddItemToObject(jprofile, "state", cJSON_CreateString((profile->running) ? "RUNNING" : "DOWN")); + cJSON_AddItemToArray(profiles, jprofile); + switch_safe_free(tmpurl); + + users = cJSON_CreateArray(); + cJSON_AddItemToObject(jprofile, "users", users); + + switch_mutex_lock(profile->mutex); + for(jsock = profile->jsock_head; jsock; jsock = jsock->next) { + char *tmpname = switch_mprintf("%s@%s", jsock->id, jsock->domain); + + if (!!profile->ip[i].secure != !!(jsock->ptype & PTYPE_CLIENT_SSL)) { + continue; + } + + user = cJSON_CreateObject(); + cJSON_AddItemToObject(user, "user", cJSON_CreateString(jsock->id)); + cJSON_AddItemToObject(user, "domain", cJSON_CreateString(jsock->domain)); + cJSON_AddItemToObject(user, "entity", cJSON_CreateString(tmpname)); + cJSON_AddItemToObject(user, "type", cJSON_CreateString((jsock->ptype & PTYPE_CLIENT_SSL) ? "WSS": "WS")); + + cJSON_AddItemToObject(user, "remoteHost", cJSON_CreateString(jsock->name)); + cJSON_AddItemToObject(user, "state", cJSON_CreateString((!zstr(jsock->uid)) ? "CONN_REG" : "CONN_NO_REG")); + cJSON_AddItemToArray(users, user); + switch_safe_free(tmpname); + } + switch_mutex_unlock(profile->mutex); + } + + + } + switch_mutex_unlock(verto_globals.mutex); + + return obj; +} + +static switch_status_t cmd_json_status(char **argv, int argc, switch_stream_handle_t *stream) +{ + cJSON *record; + char *json; + + record = json_status(); + json = cJSON_Print(record); + //json = cJSON_PrintUnformatted(record); + + stream->write_function(stream, "%s\n", json); + + switch_safe_free(json); + + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_STANDARD_API(verto_function) { char *argv[1024] = { 0 }; @@ -5340,7 +5415,7 @@ SWITCH_STANDARD_API(verto_function) int lead = 1; static const char usage_string[] = "USAGE:\n" "--------------------------------------------------------------------------------\n" - "verto [status|xmlstatus]\n" + "verto [status|xmlstatus|jsonstatus]\n" "verto help\n" "verto debug [0-10]\n" "--------------------------------------------------------------------------------\n"; @@ -5367,6 +5442,8 @@ SWITCH_STANDARD_API(verto_function) func = cmd_status; } else if (!strcasecmp(argv[0], "xmlstatus")) { func = cmd_xml_status; + } else if (!strcasecmp(argv[0], "jsonstatus")) { + func = cmd_json_status; } else if (!strcasecmp(argv[0], "debug")) { if (argv[1]) { int tmp = atoi(argv[1]); From ebe1fb38747e68ef9b41da4e8f475adeecb56c4a Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 8 May 2020 01:20:14 +0000 Subject: [PATCH 317/655] [mod_verto] add verto perms commands --- src/mod/endpoints/mod_verto/mod_verto.c | 69 +++++++++++++++++++++---- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index c9d3275817..f0dd9bf8c9 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -788,7 +788,7 @@ static void jrpc_add_func(const char *method, jrpc_func_t func) static char *MARKER = "X"; -static void set_perm(const char *str, switch_event_t **event) +static void set_perm(const char *str, switch_event_t **event, switch_bool_t add) { char delim = ','; char *cur, *next; @@ -801,8 +801,10 @@ static void set_perm(const char *str, switch_event_t **event) } } - switch_event_create(event, SWITCH_EVENT_REQUEST_PARAMS); - + if (event && !*event) { + switch_event_create(event, SWITCH_EVENT_REQUEST_PARAMS); + } + if (!zstr(str)) { edup = strdup(str); switch_assert(edup); @@ -816,8 +818,12 @@ static void set_perm(const char *str, switch_event_t **event) *next++ = '\0'; } - switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, cur, MARKER); - + if (add) { + switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, cur, MARKER); + } else { + switch_event_del_header(*event, cur); + } + cur = next; } @@ -859,15 +865,41 @@ static void check_permissions(jsock_t *jsock, switch_xml_t x_user, cJSON *params } - set_perm(allowed_methods, &jsock->allowed_methods); - set_perm(allowed_jsapi, &jsock->allowed_jsapi); - set_perm(allowed_fsapi, &jsock->allowed_fsapi); - set_perm(allowed_event_channels, &jsock->allowed_event_channels); + set_perm(allowed_methods, &jsock->allowed_methods, SWITCH_TRUE); + set_perm(allowed_jsapi, &jsock->allowed_jsapi, SWITCH_TRUE); + set_perm(allowed_fsapi, &jsock->allowed_fsapi, SWITCH_TRUE); + set_perm(allowed_event_channels, &jsock->allowed_event_channels, SWITCH_TRUE); switch_event_add_header_string(jsock->allowed_methods, SWITCH_STACK_BOTTOM, "login", MARKER); } +static switch_status_t add_perm(const char *sessid, const char *type, const char *value, switch_bool_t add) +{ + jsock_t *jsock = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (type && value && (jsock = get_jsock(sessid))) { + status = SWITCH_STATUS_SUCCESS; + + if (!strcmp(type, "methods")) { + set_perm(value, &jsock->allowed_methods, add); + } else if (!strcmp(type, "jsapi")) { + set_perm(value, &jsock->allowed_jsapi, add); + } else if (!strcmp(type, "fsapi")) { + set_perm(value, &jsock->allowed_fsapi, add); + } else if (!strcmp(type, "event_channels")) { + set_perm(value, &jsock->allowed_event_channels, add); + } else { + status = SWITCH_STATUS_FALSE; + } + + switch_thread_rwlock_unlock(jsock->rwlock); + } + + return status; +} + static void login_fire_custom_event(jsock_t *jsock, cJSON *params, int success, const char *result_txt) { switch_event_t *s_event; @@ -5418,6 +5450,7 @@ SWITCH_STANDARD_API(verto_function) "verto [status|xmlstatus|jsonstatus]\n" "verto help\n" "verto debug [0-10]\n" + "verto perm <sessid> <type> <value>\n" "--------------------------------------------------------------------------------\n"; if (zstr(cmd)) { @@ -5438,6 +5471,24 @@ SWITCH_STANDARD_API(verto_function) if (!strcasecmp(argv[0], "help")) { stream->write_function(stream, "%s", usage_string); goto done; + } else if (!strcasecmp(argv[0], "perm")) { + status = add_perm(argv[1], argv[2], argv[3], SWITCH_TRUE); + if (status == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK"); + } else { + stream->write_function(stream, "-ERR"); + } + status = SWITCH_STATUS_SUCCESS; + goto done; + } else if (!strcasecmp(argv[0], "noperm")) { + status = add_perm(argv[1], argv[2], argv[3], SWITCH_FALSE); + if (status == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK"); + } else { + stream->write_function(stream, "-ERR"); + } + status = SWITCH_STATUS_SUCCESS; + goto done; } else if (!strcasecmp(argv[0], "status")) { func = cmd_status; } else if (!strcasecmp(argv[0], "xmlstatus")) { From 3b26bc65ae7daefdbe073227626adcf0ad12d93c Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sat, 9 May 2020 02:03:19 +0000 Subject: [PATCH 318/655] [mod_verto] verto auth stuff --- src/mod/endpoints/mod_verto/mod_verto.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index f0dd9bf8c9..3e9e494759 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -5451,6 +5451,7 @@ SWITCH_STANDARD_API(verto_function) "verto help\n" "verto debug [0-10]\n" "verto perm <sessid> <type> <value>\n" + "verto noperm <sessid> <type> <value>\n" "--------------------------------------------------------------------------------\n"; if (zstr(cmd)) { @@ -6579,6 +6580,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) SWITCH_ADD_API(api_interface, "verto_contact", "Generate a verto endpoint dialstring", verto_contact_function, "user@domain"); switch_console_set_complete("add verto help"); switch_console_set_complete("add verto debug"); + switch_console_set_complete("add verto perm"); + switch_console_set_complete("add verto noperm"); switch_console_set_complete("add verto debug-level"); switch_console_set_complete("add verto status"); switch_console_set_complete("add verto xmlstatus"); From ce6426052b1504c420ba4d5c353eebbe29ce8075 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sun, 10 May 2020 21:32:13 +0000 Subject: [PATCH 319/655] [mod_verto] add verto.ping --- src/mod/endpoints/mod_verto/mod_verto.c | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 3e9e494759..dfcdde25f3 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1902,7 +1902,8 @@ error: static void client_run(jsock_t *jsock) { int flags = KWS_BLOCK; - + int idle = 0; + if (jsock->profile->vhosts) { flags |= KWS_STAY_OPEN; flags |= KWS_HTTP; @@ -1920,16 +1921,25 @@ static void client_run(jsock_t *jsock) } while(jsock->profile->running) { - int pflags; + int pflags, poll_time = 50; if (!jsock->ws) { die("%s Setup Error\n", jsock->name); } - pflags = kws_wait_sock(jsock->ws, 50, KS_POLL_READ | KS_POLL_ERROR | KS_POLL_HUP); + pflags = kws_wait_sock(jsock->ws, poll_time, KS_POLL_READ | KS_POLL_ERROR | KS_POLL_HUP); if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); } if (pflags < 0 && (errno != EINTR)) { die_errnof("%s POLL FAILED with %d", jsock->name, pflags); } - if (pflags == 0) {/* socket poll timeout */ jsock_check_event_queue(jsock); } + if (pflags == 0) {/* socket poll timeout */ jsock_check_event_queue(jsock); idle += poll_time;} else {idle = 0;} + if (idle >= 30000) { + cJSON *params = NULL; + cJSON *msg = jrpc_new_req("verto.ping", 0, &params); + + cJSON_AddItemToObject(params, "serno", cJSON_CreateNumber(switch_epoch_time_now(NULL))); + jsock_queue_event(jsock, &msg, SWITCH_TRUE); + idle = 0; + } + if ((!switch_test_flag(jsock, JPFLAG_CHECK_ATTACH) || (jsock->attach_timer > 0 && jsock->attach_timer-- == 0)) && switch_test_flag(jsock, JPFLAG_AUTHED)) { attach_calls(jsock); @@ -3576,6 +3586,13 @@ static void parse_user_vars(cJSON *obj, switch_core_session_t *session) } } +static switch_bool_t verto__ping_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) +{ + *response = cJSON_CreateObject(); + cJSON_AddItemToObject(*response, "message", cJSON_CreateString("PONG")); + return SWITCH_TRUE; +} + static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { cJSON *msg = NULL, *dialog = NULL, *txt = NULL, *jevent = NULL; @@ -4413,6 +4430,7 @@ static void jrpc_init(void) jrpc_add_func("login", login_func); jrpc_add_func("verto.invite", verto__invite_func); + jrpc_add_func("verto.ping", verto__ping_func); jrpc_add_func("verto.info", verto__info_func); jrpc_add_func("verto.attach", verto__attach_func); jrpc_add_func("verto.bye", verto__bye_func); From d84bf06bb1ded82b242d57baba2cca32c67f7569 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 22 May 2020 00:37:09 +0000 Subject: [PATCH 320/655] [mod_verto] send last known display info on re-attach --- src/mod/endpoints/mod_verto/mod_verto.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index dfcdde25f3..a91c484f1b 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3553,6 +3553,19 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock } if (!err) { + const char *cid_name, *cid_num; + switch_core_session_message_t msg = { 0 }; + + cid_name = switch_channel_get_variable(tech_pvt->channel, "last_sent_display_name"); + cid_num = switch_channel_get_variable(tech_pvt->channel, "last_sent_display_number"); + + msg.from = __FILE__; + msg.string_array_arg[0] = cid_name; + msg.string_array_arg[1] = cid_num; + + msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY; + switch_core_session_receive_message(session, &msg); + return SWITCH_TRUE; } From 34fa5c7dfe7eb203834cc99d6ade8a1900f684ce Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 3 Jun 2020 21:50:29 +0000 Subject: [PATCH 321/655] [mod_verto] add subscribed channel in events so you can see what subscription string you used --- src/mod/endpoints/mod_verto/mod_verto.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index a91c484f1b..09e5043605 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -676,7 +676,9 @@ static void write_event(const char *event_channel, jsock_t *use_jsock, cJSON *ev if (!use_jsock || use_jsock == np->jsock) { params = cJSON_Duplicate(event, 1); cJSON_AddItemToObject(params, "eventSerno", cJSON_CreateNumber(np->serno++)); + cJSON_AddItemToObject(params, "subscribedChannel", cJSON_CreateString(head->event_channel)); msg = jrpc_new_req("verto.event", NULL, &params); + jsock_queue_event(np->jsock, &msg, SWITCH_TRUE); } } @@ -4330,6 +4332,10 @@ static switch_bool_t login_func(const char *method, cJSON *params, jsock_t *jsoc switch_event_add_header_string(jsock->vars, SWITCH_STACK_BOTTOM, "conf_mvar_moderator", "true"); } + if ((var = switch_event_get_header(jsock->vars, "stereo_audio")) && switch_true(var)) { + cJSON_AddItemToObject(*response, "stereoAudio", cJSON_CreateTrue()); + } + if ((var = switch_event_get_header(jsock->vars, "superuser")) && switch_true(var)) { switch_event_add_header_string(jsock->vars, SWITCH_STACK_BOTTOM, "conf_mvar_superuser", "true"); cJSON_AddItemToObject(*response, "superuser", cJSON_CreateTrue()); From d197db060169772b6249b2f97cc8924a2e757ccd Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Thu, 11 Jun 2020 23:24:43 +0000 Subject: [PATCH 322/655] [mod_verto] verto.announce --- src/mod/endpoints/mod_verto/mod_verto.c | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 09e5043605..3a94f112c8 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -5363,6 +5363,38 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t return SWITCH_STATUS_SUCCESS; } +static switch_status_t cmd_announce(char **argv, int argc, switch_stream_handle_t *stream) +{ + verto_profile_t *profile = NULL; + jsock_t *jsock; + + switch_mutex_lock(verto_globals.mutex); + for(profile = verto_globals.profile_head; profile; profile = profile->next) { + + switch_mutex_lock(profile->mutex); + for (jsock = profile->jsock_head; jsock; jsock = jsock->next) { + cJSON *params = NULL; + cJSON *array, *msg = jrpc_new_req("verto.announce", 0, &params); + int i; + + array = cJSON_CreateArray(); + + for (i = 0; i < argc; i++) { + cJSON_AddItemToArray(array, cJSON_CreateString(argv[i])); + } + + cJSON_AddItemToObject(params, "msg", array); + jsock_queue_event(jsock, &msg, SWITCH_TRUE); + } + switch_mutex_unlock(profile->mutex); + } + switch_mutex_unlock(verto_globals.mutex); + + stream->write_function(stream, "+OK\n"); + + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handle_t *stream) { verto_profile_t *profile = NULL; @@ -5527,6 +5559,8 @@ SWITCH_STANDARD_API(verto_function) } status = SWITCH_STATUS_SUCCESS; goto done; + } else if (!strcasecmp(argv[0], "announce")) { + func = cmd_announce; } else if (!strcasecmp(argv[0], "status")) { func = cmd_status; } else if (!strcasecmp(argv[0], "xmlstatus")) { From 6da4f147de3cd6b9ee1da0858a816a398dec8c8e Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 22 Oct 2021 23:43:42 +0300 Subject: [PATCH 323/655] [Unit-Tests] Fix switch_core_video test to use temporary path for generated files and clean them up. Ignore test runtime dirs. --- tests/unit/.gitignore | 15 +---- tests/unit/switch_core.c | 2 - tests/unit/switch_core_video.c | 105 ++++++++++++++++++++++++--------- 3 files changed, 81 insertions(+), 41 deletions(-) diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore index 630dbd1775..b3689b97ab 100644 --- a/tests/unit/.gitignore +++ b/tests/unit/.gitignore @@ -5,16 +5,13 @@ \#* *.log *.trs +[0-9]*/** +conf_sofia/[0-9]*/** +.libs/ perf.data perf.data.old Makefile.in freeswitch.xml.fsxml.tmp -test-argb.png -test-rgb.png -images/test_patched_banner_alpha.png -images/test_patched_banner_noalpha.png -images/test_patched_signalwire_alpha.png -images/test_patched_signalwire_no_alpha.png switch_console switch_core switch_core_codec @@ -42,11 +39,5 @@ switch_estimators switch_jitter_buffer .deps/ Makefile -cluecon-argb-write.png -cluecon-argb.png -cluecon-jpg-write.jpg -cluecon-jpg.png -cluecon-rgb-write.png -cluecon-rgb.png conf/*/ conf_playsay/*/ diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index c8c268387b..126921997c 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -30,8 +30,6 @@ * */ #include <switch.h> -#include <stdlib.h> - #include <test/switch_test.h> #if defined(HAVE_OPENSSL) diff --git a/tests/unit/switch_core_video.c b/tests/unit/switch_core_video.c index 5c3731eb7f..27c9610292 100644 --- a/tests/unit/switch_core_video.c +++ b/tests/unit/switch_core_video.c @@ -36,7 +36,7 @@ FST_CORE_BEGIN("./conf") { - FST_SUITE_BEGIN(switch_ivr_originate) + FST_SUITE_BEGIN(switch_core_video) { FST_SETUP_BEGIN() { @@ -51,6 +51,8 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(data_url_test) { char *data_url = NULL; + char *rgb_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test-rgb.png", SWITCH_GLOBAL_dirs.temp_dir); + char *argb_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test-argb.png", SWITCH_GLOBAL_dirs.temp_dir); switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1); switch_image_t *argb_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, 120, 60, 1); switch_rgb_color_t color = { 0 }; @@ -60,7 +62,7 @@ FST_CORE_BEGIN("./conf") switch_img_fill(img, 0, 0, img->d_w, img->d_h, &color); switch_img_add_text(img->planes[0], img->d_w, 10, 10, "-1234567890"); - switch_img_write_png(img, "images/test-rgb.png"); + switch_img_write_png(img, rgb_filename); switch_img_data_url_png(img, &data_url); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "I420: %s\n", data_url); @@ -74,7 +76,7 @@ FST_CORE_BEGIN("./conf") switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d %d %d %d\n", *p, *(p+1), *(p+2), *(p+3)); } - switch_img_write_png(argb_img, "images/test-argb.png"); + switch_img_write_png(argb_img, argb_filename); switch_img_data_url_png(argb_img, &data_url); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ARGB: %s\n", data_url); free(data_url); @@ -82,36 +84,46 @@ FST_CORE_BEGIN("./conf") switch_img_free(&img); switch_img_free(&argb_img); + unlink(rgb_filename); + unlink(argb_filename); } FST_TEST_END() FST_TEST_BEGIN(img_patch) { + char *filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test.png", SWITCH_GLOBAL_dirs.temp_dir); + char *text_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_text.png", SWITCH_GLOBAL_dirs.temp_dir); + char *patch_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_patched.png", SWITCH_GLOBAL_dirs.temp_dir); int width = 320; int height = 240; + switch_status_t status; + switch_image_t *img = NULL; + switch_rgb_color_t bgcolor = {0, 0, 0}; // red switch_image_t *timg = switch_img_write_text_img(width, height, SWITCH_FALSE, "#ffffff:transparent:FreeMono.ttf:24:This is a test!"); fst_requires(timg != NULL); - switch_status_t status = switch_img_write_png(timg, "images/test_text.png"); + status = switch_img_write_png(timg, text_filename); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(text_filename); width *=2; height *=2; - switch_rgb_color_t bgcolor = {0, 0, 0}; // red bgcolor.b = 255; - switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1); + img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1); fst_requires(img); switch_img_fill(img, 0, 0, width, height, &bgcolor); - status = switch_img_write_png(img, "images/test.png"); + status = switch_img_write_png(img, filename); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(filename); switch_img_patch(img, timg, 0, 0); - status = switch_img_write_png(img, "images/test_patched.png"); + status = switch_img_write_png(img, patch_filename); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(patch_filename); switch_img_free(&img); switch_img_free(&timg); @@ -120,20 +132,37 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(img_patch_alpha) { - switch_image_t *timg = switch_img_read_png("images/test_text.png", SWITCH_IMG_FMT_ARGB); + char *text_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_text.png", SWITCH_GLOBAL_dirs.temp_dir); + char *patch_filename_alpha = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_patched_alpha.png", SWITCH_GLOBAL_dirs.temp_dir); + char *patch_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_patched_noalpha.png", SWITCH_GLOBAL_dirs.temp_dir); + int width = 320; + int height = 240; + switch_image_t *img = NULL; + switch_status_t status; + + switch_image_t *timg = switch_img_write_text_img(width, height, SWITCH_FALSE, "#ffffff:transparent:FreeMono.ttf:24:This is a test!"); + fst_requires(timg != NULL); + status = switch_img_write_png(timg, text_filename); + fst_check(status == SWITCH_STATUS_SUCCESS); + switch_img_free(&timg); + + timg = switch_img_read_png(text_filename, SWITCH_IMG_FMT_ARGB); + unlink(text_filename); fst_requires(timg != NULL); - switch_image_t *img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); fst_requires(img); switch_img_patch(img, timg, 0, 0); - switch_status_t status = switch_img_write_png(img, "images/test_patched_alpha.png"); + status = switch_img_write_png(img, patch_filename_alpha); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(patch_filename_alpha); switch_img_free(&img); img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); switch_img_patch_rgb(img, timg, 0, 0, SWITCH_TRUE); - status = switch_img_write_png(img, "images/test_patched_noalpha.png"); + status = switch_img_write_png(img, patch_filename); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(patch_filename); switch_img_free(&img); switch_img_free(&timg); @@ -142,20 +171,24 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(img_patch_banner_alpha) { + char *patch_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_patched_banner_noalpha.png", SWITCH_GLOBAL_dirs.temp_dir); + char *patch_filename_alpha = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_patched_banner_alpha.png", SWITCH_GLOBAL_dirs.temp_dir); switch_status_t status; switch_image_t *img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); switch_image_t *img2 = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); fst_requires(img); fst_requires(img2); switch_img_patch(img, img2, 80, 20); - status = switch_img_write_png(img, "images/test_patched_banner_alpha.png"); + status = switch_img_write_png(img, patch_filename_alpha); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(patch_filename_alpha); switch_img_free(&img); img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); switch_img_patch_rgb(img, img2, 80, 20, SWITCH_TRUE); - status = switch_img_write_png(img, "images/test_patched_banner_noalpha.png"); + status = switch_img_write_png(img, patch_filename); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(patch_filename); switch_img_free(&img); switch_img_free(&img2); @@ -164,50 +197,56 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(img_patch_signalwire_alpha) { + char *patch_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_patched_signalwire_alpha.png", SWITCH_GLOBAL_dirs.temp_dir); switch_image_t *timg_small = NULL; switch_image_t *timg = switch_img_read_png("images/signalwire.png", SWITCH_IMG_FMT_ARGB); - fst_requires(timg != NULL); - switch_image_t *img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + switch_status_t status; + + fst_requires(timg != NULL); fst_requires(img); switch_img_scale(timg, &timg_small, timg->d_w / 5, timg->d_h / 5); switch_img_patch(img, timg_small, 80, 20); - switch_status_t status = switch_img_write_png(img, "images/test_patched_signalwire_alpha.png"); + status = switch_img_write_png(img, patch_filename); fst_check(status == SWITCH_STATUS_SUCCESS); switch_img_free(&img); switch_img_free(&timg); switch_img_free(&timg_small); + unlink(patch_filename); } FST_TEST_END() FST_TEST_BEGIN(img_patch_signalwire_no_alpha) { + char *patch_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "test_patched_signalwire_no_alpha.png", SWITCH_GLOBAL_dirs.temp_dir); switch_image_t *timg_small = NULL; switch_image_t *timg = switch_img_read_png("images/signalwire.png", SWITCH_IMG_FMT_ARGB); - fst_requires(timg != NULL); - switch_image_t *img = switch_img_read_png("images/banner.png", SWITCH_IMG_FMT_ARGB); + switch_status_t status; + + fst_requires(timg != NULL); fst_requires(img); switch_img_scale(timg, &timg_small, timg->d_w / 5, timg->d_h / 5); switch_img_patch_rgb(img, timg_small, 80, 20, SWITCH_TRUE); - switch_status_t status = switch_img_write_png(img, "images/test_patched_signalwire_no_alpha.png"); + status = switch_img_write_png(img, patch_filename); fst_check(status == SWITCH_STATUS_SUCCESS); switch_img_free(&img); switch_img_free(&timg); switch_img_free(&timg_small); + unlink(patch_filename); } FST_TEST_END() FST_TEST_BEGIN(stb_data_url) { switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1); + char *data_url = NULL; switch_rgb_color_t color = { 0 }; color.r = 255; // color.g = 255; // color.b = 255; - char *data_url = NULL; switch_img_fill(img, 0, 0, img->d_w, img->d_h, &color); switch_img_add_text(img->planes[0], img->d_w, 10, 10, "-1234567890"); @@ -228,21 +267,27 @@ FST_CORE_BEGIN("./conf") FST_TEST_BEGIN(read_from_file) { switch_image_t *img; + char *rgb_write_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "cluecon-rgb.png", SWITCH_GLOBAL_dirs.temp_dir); + char *argb_write_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "cluecon-argb.png", SWITCH_GLOBAL_dirs.temp_dir); + char *jpg_write_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "cluecon-jpg.png", SWITCH_GLOBAL_dirs.temp_dir); img = switch_img_read_from_file("../../images/cluecon.png", SWITCH_IMG_FMT_I420); fst_requires(img); - switch_img_write_png(img, "cluecon-rgb.png"); + switch_img_write_png(img, rgb_write_filename); switch_img_free(&img); + unlink(rgb_write_filename); img = switch_img_read_from_file("../../images/cluecon.png", SWITCH_IMG_FMT_ARGB); fst_requires(img); - switch_img_write_png(img, "cluecon-argb.png"); + switch_img_write_png(img, argb_write_filename); switch_img_free(&img); + unlink(argb_write_filename); img = switch_img_read_from_file("../../images/cluecon.jpg", SWITCH_IMG_FMT_I420); fst_requires(img); - switch_img_write_png(img, "cluecon-jpg.png"); + switch_img_write_png(img, jpg_write_filename); switch_img_free(&img); + unlink(jpg_write_filename); } FST_TEST_END() @@ -250,24 +295,30 @@ FST_CORE_BEGIN("./conf") { switch_image_t *img; switch_status_t status; + char *rgb_write_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "cluecon-rgb-write.png", SWITCH_GLOBAL_dirs.temp_dir); + char *argb_write_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "cluecon-argb-write.png", SWITCH_GLOBAL_dirs.temp_dir); + char *jpg_write_filename = switch_core_sprintf(fst_pool, "%s" SWITCH_PATH_SEPARATOR "cluecon-jpg-write.png", SWITCH_GLOBAL_dirs.temp_dir); img = switch_img_read_from_file("../../images/cluecon.png", SWITCH_IMG_FMT_I420); fst_requires(img); - status = switch_img_write_to_file(img, "cluecon-rgb-write.png", 0); + status = switch_img_write_to_file(img, rgb_write_filename, 0); switch_img_free(&img); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(rgb_write_filename); img = switch_img_read_from_file("../../images/cluecon.png", SWITCH_IMG_FMT_ARGB); fst_requires(img); - status = switch_img_write_to_file(img, "cluecon-argb-write.png", 0); + status = switch_img_write_to_file(img, argb_write_filename, 0); switch_img_free(&img); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(argb_write_filename); img = switch_img_read_from_file("../../images/cluecon.jpg", SWITCH_IMG_FMT_I420); fst_requires(img); - status = switch_img_write_to_file(img, "cluecon-jpg-write.jpg", 100); + status = switch_img_write_to_file(img, jpg_write_filename, 100); switch_img_free(&img); fst_check(status == SWITCH_STATUS_SUCCESS); + unlink(jpg_write_filename); } FST_TEST_END() } From c2e240d6dca09e2ccfcd626ef0fd456d4095649b Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 23 Jun 2020 17:50:18 -0400 Subject: [PATCH 324/655] [core] Add switch_core_session_set_external_id() which lets you define an additional identifier that you can use in switch_core_session_locate(). --- src/include/private/switch_core_pvt.h | 1 + src/include/switch_core.h | 11 +++- src/switch_channel.c | 3 +- src/switch_core_session.c | 48 +++++++++++++++++ tests/unit/Makefile.am | 2 +- tests/unit/switch_core_session.c | 75 +++++++++++++++++++++++++++ tests/unit/switch_ivr_originate.c | 47 +++++++++++++++++ 7 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 tests/unit/switch_core_session.c diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index a69c3173cc..aece2e7e17 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -189,6 +189,7 @@ struct switch_core_session { switch_buffer_t *text_buffer; switch_buffer_t *text_line_buffer; switch_mutex_t *text_mutex; + const char *external_id; }; struct switch_media_bug { diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 263c1f7ff7..e4c615941d 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -804,6 +804,8 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ sw SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(_In_ switch_core_session_t *session, _In_z_ const char *use_uuid); +SWITCH_DECLARE(switch_status_t) switch_core_session_set_external_id(_In_ switch_core_session_t *session, _In_z_ const char *use_external_id); + SWITCH_DECLARE(void) switch_core_session_perform_destroy(_Inout_ switch_core_session_t **session, _In_z_ const char *file, _In_z_ const char *func, _In_ int line); @@ -875,6 +877,13 @@ SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_se */ SWITCH_DECLARE(char *) switch_core_session_get_uuid(_In_ switch_core_session_t *session); +/*! + \brief Retrieve the unique external identifier from a session + \param session the session to retrieve the uuid from + \return a string representing the uuid +*/ +SWITCH_DECLARE(const char *) switch_core_session_get_external_id(_In_ switch_core_session_t *session); + /*! \brief Sets the log level for a session diff --git a/src/switch_channel.c b/src/switch_channel.c index d2b10ed15d..d6c0e64883 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -2655,6 +2655,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", state_num); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Name", switch_channel_get_name(channel)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(channel->session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Session-External-ID", switch_core_session_get_external_id(channel->session)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Direction", channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 4440da639d..23c787fb23 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -625,6 +625,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ switch_event_t *event; switch_channel_t *peer_channel = switch_core_session_get_channel(*new_session); const char *use_uuid; + const char *use_external_id; switch_core_session_t *other_session = NULL; switch_assert(peer_channel); @@ -646,6 +647,17 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } } + if ((use_external_id = switch_event_get_header(var_event, "origination_external_id"))) { + if (switch_core_session_set_external_id(*new_session, use_external_id) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "%s set external_id=%s\n", switch_channel_get_name(peer_channel), + use_external_id); + switch_event_del_header(var_event, "origination_external_id"); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "%s set external_id=%s FAILED\n", + switch_channel_get_name(peer_channel), use_external_id); + } + } + if (!channel && var_event) { const char *other_uuid; @@ -1558,6 +1570,9 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t * switch_mutex_lock(runtime.session_hash_mutex); switch_core_hash_delete(session_manager.session_table, (*session)->uuid_str); + if ((*session)->external_id) { + switch_core_hash_delete(session_manager.session_table, (*session)->external_id); + } if (session_manager.session_count) { session_manager.session_count--; if (session_manager.session_count == 0) { @@ -2055,6 +2070,34 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_status_t) switch_core_session_set_external_id(switch_core_session_t *session, const char *use_external_id) +{ + switch_assert(use_external_id); + + if (session->external_id && !strcmp(use_external_id, session->external_id)) { + return SWITCH_STATUS_SUCCESS; + } + + + switch_mutex_lock(runtime.session_hash_mutex); + if (switch_core_hash_find(session_manager.session_table, use_external_id)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Duplicate External ID!\n"); + switch_mutex_unlock(runtime.session_hash_mutex); + return SWITCH_STATUS_FALSE; + } + + switch_channel_set_variable(session->channel, "session_external_id", use_external_id); + + if (session->external_id) { + switch_core_hash_delete(session_manager.session_table, session->external_id); + } + session->external_id = switch_core_session_strdup(session, use_external_id); + switch_core_hash_insert(session_manager.session_table, session->external_id, session); + switch_mutex_unlock(runtime.session_hash_mutex); + + return SWITCH_STATUS_SUCCESS; +} + static char *xml_find_var(switch_xml_t vars, const char *name) { switch_xml_t var; @@ -2540,6 +2583,11 @@ SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session_t *sessi return session->uuid_str; } +SWITCH_DECLARE(const char *) switch_core_session_get_external_id(switch_core_session_t *session) +{ + if (!session) return NULL; + return session->external_id; +} SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit) { diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 212c54b2bf..10660c7dbd 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ switch_ivr_play_say switch_core_codec switch_rtp switch_xml -noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_packetizer test_sofia switch_core_asr +noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_packetizer test_sofia switch_core_asr switch_core_session 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/switch_core_session.c b/tests/unit/switch_core_session.c new file mode 100644 index 0000000000..0319683000 --- /dev/null +++ b/tests/unit/switch_core_session.c @@ -0,0 +1,75 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Chris Rienzo <chris@signalwire.com> + * + * + * switch_core_session.c -- tests sessions + * + */ +#include <switch.h> +#include <test/switch_test.h> + + +FST_CORE_BEGIN("./conf") +{ + FST_SUITE_BEGIN(switch_core_session) + { + FST_SETUP_BEGIN() + { + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_SESSION_BEGIN(session_external_id) + { + fst_check(switch_core_session_set_external_id(fst_session, switch_core_session_get_uuid(fst_session)) != SWITCH_STATUS_SUCCESS); + fst_check(switch_core_session_set_external_id(fst_session, "foo") == SWITCH_STATUS_SUCCESS); + switch_core_session_t *session = switch_core_session_locate("foo"); + fst_requires(session); + fst_check_string_equals(switch_core_session_get_uuid(session), switch_core_session_get_uuid(fst_session)); + fst_check_string_equals(switch_core_session_get_external_id(session), "foo"); + fst_check(switch_core_session_set_external_id(fst_session, "bar") == SWITCH_STATUS_SUCCESS); + fst_check_string_equals(switch_core_session_get_external_id(session), "bar"); + fst_requires(switch_core_session_locate("foo") == NULL); + switch_core_session_rwunlock(session); + session = switch_core_session_locate("bar"); + fst_requires(session); + switch_core_session_rwunlock(session); + session = switch_core_session_locate(switch_core_session_get_uuid(fst_session)); + fst_requires(session); + switch_core_session_rwunlock(session); + switch_channel_hangup(fst_channel, SWITCH_CAUSE_NORMAL_CLEARING); + session = switch_core_session_locate("bar"); + fst_check(session == NULL); + } + FST_SESSION_END() + } + FST_SUITE_END() +} +FST_CORE_END() diff --git a/tests/unit/switch_ivr_originate.c b/tests/unit/switch_ivr_originate.c index 6c34fcc1e8..b6ffe7cf51 100644 --- a/tests/unit/switch_ivr_originate.c +++ b/tests/unit/switch_ivr_originate.c @@ -55,6 +55,20 @@ static switch_status_t my_on_destroy(switch_core_session_t *session) return SWITCH_STATUS_SUCCESS; } + +const char *external_id_to_match = NULL; +static int got_external_id_in_event = 0; + +static void on_hangup_event(switch_event_t *event) +{ + if (external_id_to_match) { + const char *external_id = switch_event_get_header(event, "Session-External-ID"); + if (external_id && !strcmp(external_id_to_match, external_id)) { + got_external_id_in_event = 1; + } + } +} + static switch_state_handler_table_t state_handlers = { /*.on_init */ NULL, /*.on_routing */ NULL, @@ -89,6 +103,8 @@ FST_CORE_BEGIN("./conf") { fst_requires_module("mod_loopback"); application_hit = 0; + external_id_to_match = NULL; + got_external_id_in_event = 0; } FST_SETUP_END() @@ -97,6 +113,37 @@ FST_CORE_BEGIN("./conf") } FST_TEARDOWN_END() + FST_TEST_BEGIN(originate_test_external_id) + { + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + switch_event_t *ovars = NULL; + switch_event_create(&ovars, SWITCH_EVENT_CLONE); + switch_event_add_header_string(ovars, SWITCH_STACK_BOTTOM, "origination_external_id", "zzzz"); + status = switch_ivr_originate(NULL, &session, &cause, "null/+15553334444", 2, NULL, NULL, NULL, NULL, ovars, SOF_NONE, NULL, NULL); + fst_requires(session); + fst_check(status == SWITCH_STATUS_SUCCESS); + switch_event_destroy(&ovars); + switch_core_session_rwunlock(session); + + session = switch_core_session_locate("zzzz"); + fst_requires(session); + + channel = switch_core_session_get_channel(session); + fst_requires(channel); + + external_id_to_match = "zzzz"; + switch_event_bind("originate_test_external_id", SWITCH_EVENT_CHANNEL_HANGUP, SWITCH_EVENT_SUBCLASS_ANY, on_hangup_event, NULL); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_yield(1000 * 1000); + fst_check(got_external_id_in_event == 1); + switch_event_unbind_callback(on_hangup_event); + } + FST_TEST_END() + FST_TEST_BEGIN(originate_test_early_state_handler) { switch_core_session_t *session = NULL; From 6b6b721c1060b3dcbe292f2ec6dea74103048759 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Wed, 24 Jun 2020 02:31:09 +0000 Subject: [PATCH 325/655] [core] allow external ID to be same as the session UUID --- src/switch_core_session.c | 10 +++++++--- tests/unit/switch_core_session.c | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 23c787fb23..acda5eaf7b 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2080,7 +2080,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_external_id(switch_core_ switch_mutex_lock(runtime.session_hash_mutex); - if (switch_core_hash_find(session_manager.session_table, use_external_id)) { + if (strcmp(use_external_id, session->uuid_str) && switch_core_hash_find(session_manager.session_table, use_external_id)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Duplicate External ID!\n"); switch_mutex_unlock(runtime.session_hash_mutex); return SWITCH_STATUS_FALSE; @@ -2088,11 +2088,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_external_id(switch_core_ switch_channel_set_variable(session->channel, "session_external_id", use_external_id); - if (session->external_id) { + if (session->external_id && strcmp(session->external_id, session->uuid_str)) { switch_core_hash_delete(session_manager.session_table, session->external_id); } + session->external_id = switch_core_session_strdup(session, use_external_id); - switch_core_hash_insert(session_manager.session_table, session->external_id, session); + + if (strcmp(session->external_id, session->uuid_str)) { + switch_core_hash_insert(session_manager.session_table, session->external_id, session); + } switch_mutex_unlock(runtime.session_hash_mutex); return SWITCH_STATUS_SUCCESS; diff --git a/tests/unit/switch_core_session.c b/tests/unit/switch_core_session.c index 0319683000..57beea3bee 100644 --- a/tests/unit/switch_core_session.c +++ b/tests/unit/switch_core_session.c @@ -48,7 +48,8 @@ FST_CORE_BEGIN("./conf") FST_SESSION_BEGIN(session_external_id) { - fst_check(switch_core_session_set_external_id(fst_session, switch_core_session_get_uuid(fst_session)) != SWITCH_STATUS_SUCCESS); + fst_check(switch_core_session_set_external_id(fst_session, switch_core_session_get_uuid(fst_session)) == SWITCH_STATUS_SUCCESS); + fst_check_string_equals(switch_core_session_get_external_id(fst_session), switch_core_session_get_uuid(fst_session)); fst_check(switch_core_session_set_external_id(fst_session, "foo") == SWITCH_STATUS_SUCCESS); switch_core_session_t *session = switch_core_session_locate("foo"); fst_requires(session); From 35f1afa1449e55b1191002a00f2d33dc76a78573 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Wed, 4 Dec 2019 23:51:57 +0000 Subject: [PATCH 326/655] [build] improve configure test for openal --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index eb65a4765d..db82222e0d 100644 --- a/configure.ac +++ b/configure.ac @@ -598,7 +598,7 @@ AC_ARG_ENABLE(srtp, AM_CONDITIONAL([ENABLE_SRTP],[test "${enable_srtp}" = "yes"]) have_openal=no -AC_CHECK_LIB(openal, alMidiGainSOFT, [have_openal="yes"]) +AC_CHECK_LIB(openal, alcLoopbackOpenDeviceSOFT, [have_openal="yes"]) AM_CONDITIONAL([HAVE_OPENAL],[test "${have_openal}" = "yes"]) AC_ARG_ENABLE(zrtp, From 0d463a2b42249ffc212974f671fef45a62609757 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sun, 19 Apr 2020 22:59:42 +0000 Subject: [PATCH 327/655] [core] expand vars on execute_on and api_on --- src/switch_channel.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index d6c0e64883..5a901ec199 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3699,6 +3699,7 @@ static void do_api_on(switch_channel_t *channel, const char *variable) { char *app; char *arg = NULL; + char *expanded = NULL; switch_stream_handle_t stream = { 0 }; app = switch_core_session_strdup(channel->session, variable); @@ -3707,10 +3708,21 @@ static void do_api_on(switch_channel_t *channel, const char *variable) *arg++ = '\0'; } + if (zstr(arg)) { + expanded = arg; + } else { + expanded = switch_channel_expand_variables(channel, arg); + } + SWITCH_STANDARD_STREAM(stream); + switch_api_execute(app, expanded, NULL, &stream); switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s process %s: %s(%s)\n%s\n", - channel->name, variable, app, switch_str_nil(arg), (char *) stream.data); - switch_api_execute(app, arg, NULL, &stream); + channel->name, variable, app, switch_str_nil(expanded), (char *) stream.data); + + if (expanded && expanded != arg) { + free(expanded); + } + free(stream.data); } @@ -3753,7 +3765,8 @@ static void do_execute_on(switch_channel_t *channel, const char *variable) char *p; int bg = 0; char *app; - + char *expanded = NULL; + app = switch_core_session_strdup(channel->session, variable); for(p = app; p && *p; p++) { @@ -3772,11 +3785,21 @@ static void do_execute_on(switch_channel_t *channel, const char *variable) bg++; } + if (zstr(arg)) { + expanded = arg; + } else { + expanded = switch_channel_expand_variables(channel, arg); + } + if (bg) { switch_core_session_execute_application_async(channel->session, app, arg); } else { switch_core_session_execute_application(channel->session, app, arg); } + + if (expanded && expanded != arg) { + free(expanded); + } } SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix) From 8f26613c80d61c8479f4c735955a813c0d92ff3a Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sat, 11 Apr 2020 22:40:53 +0000 Subject: [PATCH 328/655] [core] add unlockable youtube resolver in the core. use global variable ${youtube_resolver} to set a cgi that takes url= param to translate youtube urls into real stream urls --- src/switch_core_file.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/switch_core_file.c b/src/switch_core_file.c index 5398372a21..bc99a451ef 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -274,6 +274,45 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, goto fail; } + if (!strncasecmp(file_path, "https://", 8) && (switch_stristr("youtube", file_path) || switch_stristr("youtu.be", file_path))) { + char *youtube_root = NULL; + + if ((youtube_root = switch_core_get_variable_pdup("youtube_resolver", fh->memory_pool))) { + char *resolve_url, *encoded, *url_buf; + switch_size_t url_buflen = 0; + switch_stream_handle_t stream = { 0 }; + const char *video = NULL, *format = "best"; + + url_buflen = strlen(file_path) * 4; + url_buf = switch_core_alloc(fh->memory_pool, url_buflen); + encoded = switch_url_encode(file_path, url_buf, url_buflen); + + if (fh->params && (video = switch_event_get_header(fh->params, "video")) && switch_false(video)) { + format = "bestaudio"; + } + + resolve_url = switch_core_sprintf(fh->memory_pool, "%s?url=%s&format=%s", youtube_root, encoded, format); + + SWITCH_STANDARD_STREAM(stream); + + //Depends on mod_curl *shrug* + switch_api_execute("curl", resolve_url, NULL, &stream); + + if (stream.data && !strncasecmp("https://", (char *)stream.data, 8)) { + char *url = (char *) stream.data; + while (end_of_p(url) > url && (end_of(url) == '\n' || end_of(url) == '\r')) { + end_of(url) = '\0'; + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "resolved url to: %s\n", url); + file_path = switch_core_sprintf(fh->memory_pool, "av://%s", url); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "YOUTUBE RESOLVER FAIL: %s\n", (char *) stream.data); + } + + switch_safe_free(stream.data); + } + } + if ((rhs = strstr(file_path, SWITCH_URL_SEPARATOR))) { switch_copy_string(stream_name, file_path, (rhs + 1) - file_path); ext = stream_name; From 2bdefa3532cded8c4e4ad695c475c1394b01de00 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Wed, 24 Jul 2019 15:28:04 +0000 Subject: [PATCH 329/655] [core] add a flag to tell when video media bugs that touch the write stream are active --- src/include/switch_types.h | 2 ++ src/switch_core_media_bug.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 2baddf0101..674de974d0 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1630,6 +1630,8 @@ typedef enum { CF_WANT_DTLSv1_2, CF_RFC7329_COMPAT, CF_REATTACHED, + CF_VIDEO_READ_TAPPED, + CF_VIDEO_WRITE_TAPPED, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 4e92c2d9e6..eca4c495d2 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -918,6 +918,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t if (switch_test_flag(bug, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bug, SMBF_WRITE_VIDEO_STREAM) || switch_test_flag(bug, SMBF_READ_VIDEO_PING) || switch_test_flag(bug, SMBF_WRITE_VIDEO_PING)) { switch_channel_set_flag_recursive(session->channel, CF_VIDEO_DECODED_READ); + + if (switch_test_flag(bug, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bug, SMBF_READ_VIDEO_PING)) { + switch_channel_set_flag_recursive(session->channel, CF_VIDEO_READ_TAPPED); + } + + if (switch_test_flag(bug, SMBF_WRITE_VIDEO_STREAM) || switch_test_flag(bug, SMBF_WRITE_VIDEO_PING)) { + switch_channel_set_flag_recursive(session->channel, CF_VIDEO_WRITE_TAPPED); + } } if (switch_test_flag(bug, SMBF_SPY_VIDEO_STREAM) || switch_core_media_bug_test_flag(bug, SMBF_SPY_VIDEO_STREAM_BLEG)) { @@ -1297,6 +1305,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t * if (switch_test_flag(bp, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bp, SMBF_WRITE_VIDEO_STREAM) || switch_test_flag(bp, SMBF_READ_VIDEO_PING) || switch_test_flag(bp, SMBF_WRITE_VIDEO_PING)) { switch_channel_clear_flag_recursive(bp->session->channel, CF_VIDEO_DECODED_READ); + + if (switch_test_flag(bp, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bp, SMBF_READ_VIDEO_PING)) { + switch_channel_clear_flag_recursive(bp->session->channel, CF_VIDEO_READ_TAPPED); + } + + if (switch_test_flag(bp, SMBF_WRITE_VIDEO_STREAM) || switch_test_flag(bp, SMBF_WRITE_VIDEO_PING)) { + switch_channel_clear_flag_recursive(bp->session->channel, CF_VIDEO_WRITE_TAPPED); + } } bp->ready = 0; From 3ce9a9a3930f5a59442af87d4ac31d0829f337ce Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Tue, 23 Jun 2020 05:49:50 +0000 Subject: [PATCH 330/655] [core] fix long sql stmts may be skipped, introduced in 2e88c67c9de5452c7e442d8e7fd35ca0172ad569 in 2009 --- src/switch_core_sqldb.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 7bf612b7d5..3ce7fae8fb 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -790,12 +790,8 @@ static switch_status_t switch_cache_db_execute_sql_chunked(switch_cache_db_handl p--; } - if (p <= s) - break; - - status = switch_cache_db_execute_sql_real(dbh, s, err); - if (status != SWITCH_STATUS_SUCCESS || (err && *err)) { + if (p <= s || status != SWITCH_STATUS_SUCCESS || (err && *err)) { break; } From badd59d609b5d5583c01d543e0d6b3a9cb365df1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Tue, 14 Apr 2020 19:52:38 +0000 Subject: [PATCH 331/655] [core, mod_verto] remove CF_VIDEO_ONLY and pay attention to the streams instead and add CF_NO_RECOVER flag for verto --- src/include/switch_types.h | 2 +- .../mod_conference/conference_event.c | 2 +- .../mod_conference/conference_member.c | 2 +- .../mod_conference/mod_conference.c | 28 +++++++++---------- src/mod/endpoints/mod_verto/mod_verto.c | 17 +++++++---- src/switch_core_media.c | 8 ++++-- 6 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 674de974d0..a1bc0204ec 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1595,7 +1595,7 @@ typedef enum { CF_VIDEO_DECODED_READ, CF_VIDEO_DEBUG_READ, CF_VIDEO_DEBUG_WRITE, - CF_VIDEO_ONLY, + CF_NO_RECOVER, CF_VIDEO_READY, CF_VIDEO_MIRROR_INPUT, CF_VIDEO_READ_FILE_ATTACHED, diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index 806dfc95ed..23adb127a8 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -634,7 +634,7 @@ void conference_event_adv_la(conference_obj_t *conference, conference_member_t * switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ); switch_core_media_gen_key_frame(member->session); - if (conference && conference->la && member->session && !switch_channel_test_flag(member->channel, CF_VIDEO_ONLY)) { + if (conference && conference->la && member->session) { cJSON *msg, *data; const char *uuid = switch_core_session_get_uuid(member->session); const char *cookie = switch_channel_get_variable(member->channel, "event_channel_cookie"); diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index 74264b0677..f9c036baec 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -186,7 +186,7 @@ void conference_member_update_status_field(conference_member_t *member) cJSON_AddItemToObject(video, "visible", cJSON_CreateFalse()); } - cJSON_AddItemToObject(video, "videoOnly", cJSON_CreateBool(switch_channel_test_flag(member->channel, CF_VIDEO_ONLY))); + cJSON_AddItemToObject(video, "noRecover", cJSON_CreateBool(switch_channel_test_flag(member->channel, CF_NO_RECOVER))); if (switch_true(switch_channel_get_variable_dup(member->channel, "video_screen_share", SWITCH_FALSE, -1))) { cJSON_AddItemToObject(video, "screenShare", cJSON_CreateTrue()); } diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 670d6ac9de..875d0f9731 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2474,21 +2474,21 @@ SWITCH_STANDARD_APP(conference_function) switch_core_session_set_video_read_callback(session, conference_video_thread_callback, (void *)&member); switch_core_session_set_text_read_callback(session, conference_text_thread_callback, (void *)&member); - if (switch_channel_test_flag(channel, CF_VIDEO_ONLY) || !switch_channel_test_flag(channel, CF_AUDIO)) { - while(conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) { - switch_frame_t *read_frame; - if (switch_channel_test_flag(channel, CF_AUDIO)) { - switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - } - switch_yield(100000); - } - } else { - - /* Run the conference loop */ - do { + /* Run the conference loop */ + do { + switch_media_flow_t audio_flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO); + + if (switch_channel_test_flag(channel, CF_AUDIO) && (audio_flow == SWITCH_MEDIA_FLOW_SENDRECV || audio_flow == SWITCH_MEDIA_FLOW_RECVONLY)) { conference_loop_output(&member); - } while (member.loop_loop); - } + } else { + if (conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) { + switch_yield(100000); + member.loop_loop = 1; + } else { + break; + } + } + } while (member.loop_loop); switch_core_session_video_reset(session); switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 3a94f112c8..b5dcce2269 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1347,7 +1347,7 @@ static void detach_calls(jsock_t *jsock) continue; } - if (switch_channel_test_flag(tech_pvt->channel, CF_VIDEO_ONLY)) { + if (switch_channel_test_flag(tech_pvt->channel, CF_NO_RECOVER)) { switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_NORMAL_CLEARING); continue; } @@ -2762,7 +2762,7 @@ static int verto_recover_callback(switch_core_session_t *session) const char *profile_name = NULL, *jsock_uuid_str = NULL; switch_channel_t *channel = switch_core_session_get_channel(session); - if (switch_channel_test_flag(channel, CF_VIDEO_ONLY)) { + if (switch_channel_test_flag(channel, CF_NO_RECOVER)) { return 0; } @@ -3817,7 +3817,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { - cJSON *obj = cJSON_CreateObject(), *screenShare = NULL, *dedEnc = NULL, *mirrorInput, *bandwidth = NULL, *canvas = NULL; + cJSON *obj = cJSON_CreateObject(), *vobj = NULL, *dedEnc = NULL, *mirrorInput, *bandwidth = NULL, *canvas = NULL; switch_core_session_t *session = NULL; switch_channel_t *channel; switch_event_t *var_event; @@ -3899,9 +3899,16 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock err = 1; goto cleanup; } - if ((screenShare = cJSON_GetObjectItem(dialog, "screenShare")) && screenShare->type == cJSON_True) { + if ((vobj = cJSON_GetObjectItem(dialog, "screenShare")) && vobj->type == cJSON_True) { switch_channel_set_variable(channel, "video_screen_share", "true"); - switch_channel_set_flag(channel, CF_VIDEO_ONLY); + } + + if ((vobj = cJSON_GetObjectItem(dialog, "secondSource")) && vobj->type == cJSON_True) { + switch_channel_set_variable(channel, "video_second_source", "true"); + } + + if ((vobj = cJSON_GetObjectItem(dialog, "recoverCall")) && vobj->type == cJSON_False) { + switch_channel_set_flag(channel, CF_NO_RECOVER); } if ((dedEnc = cJSON_GetObjectItem(dialog, "dedEnc")) && dedEnc->type == cJSON_True) { diff --git a/src/switch_core_media.c b/src/switch_core_media.c index b6cb4b6670..bfaff77289 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3459,8 +3459,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_sessio } } - if (switch_channel_test_flag(session->channel, CF_VIDEO_ONLY) && type == SWITCH_MEDIA_TYPE_AUDIO) { - return SWITCH_STATUS_SUCCESS; + if (type == SWITCH_MEDIA_TYPE_AUDIO) { + switch_media_flow_t audio_flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO); + + if (audio_flow != SWITCH_MEDIA_FLOW_SENDRECV && audio_flow != SWITCH_MEDIA_FLOW_SENDONLY) { + return SWITCH_STATUS_SUCCESS; + } } if (type != SWITCH_MEDIA_TYPE_TEXT) { From f8004e1d664b838d15e2d8b47369abac39013def Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sun, 19 Apr 2020 04:03:41 +0000 Subject: [PATCH 332/655] [core] fix possible looping recover --- src/switch_channel.c | 10 ++++++---- src/switch_core_state_machine.c | 8 +------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 5a901ec199..baca416c9e 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2190,7 +2190,7 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch switch_core_session_wake_video_thread(channel->session); } - if (flag == CF_RECOVERING && !channel->hangup_cause) { + if (flag == CF_RECOVERING && !channel->hangup_cause && !switch_channel_test_flag(channel, CF_NO_RECOVER)) { switch_core_recovery_track(channel->session); } @@ -3931,9 +3931,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_channel_presence(channel, "unknown", "answered", NULL); //switch_channel_audio_sync(channel); - - switch_core_recovery_track(channel->session); - + + if (!switch_channel_test_flag(channel, CF_NO_RECOVER)) { + switch_core_recovery_track(channel->session); + } + switch_channel_set_callstate(channel, CCS_ACTIVE); send_ind(channel, SWITCH_MESSAGE_ANSWER_EVENT, file, func, line); diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 57ba3bfeb2..7a8e2e5ab7 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -55,7 +55,6 @@ static void switch_core_standard_on_init(switch_core_session_t *session) static void switch_core_standard_on_hangup(switch_core_session_t *session) { switch_caller_extension_t *extension; - int rec; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s\n", switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel))); @@ -131,13 +130,8 @@ static void switch_core_standard_on_hangup(switch_core_session_t *session) } } - rec = switch_channel_test_flag(session->channel, CF_RECOVERING); switch_channel_clear_flag(session->channel, CF_RECOVERING); - - if (!rec) { - switch_core_recovery_untrack(session, SWITCH_TRUE); - } - + switch_core_recovery_untrack(session, SWITCH_TRUE); if (!switch_channel_test_flag(session->channel, CF_ZOMBIE_EXEC)) { return; From 8a6a6fca4776acfda1a0276fda6cfe1860e78a83 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Tue, 23 Jun 2020 05:52:53 +0000 Subject: [PATCH 333/655] [core] flush all the rtp on transfers --- src/switch_core_media.c | 4 ++-- src/switch_core_state_machine.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index bfaff77289..340d9c2924 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -13101,15 +13101,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se goto end; case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC: if (switch_rtp_ready(a_engine->rtp_session)) { + switch_rtp_reset_jb(a_engine->rtp_session); rtp_flush_read_buffer(a_engine->rtp_session, SWITCH_RTP_FLUSH_ONCE); - //switch_rtp_reset_jb(a_engine->rtp_session); } goto end; case SWITCH_MESSAGE_INDICATE_VIDEO_SYNC: if (switch_rtp_ready(v_engine->rtp_session)) { + switch_rtp_reset_jb(v_engine->rtp_session); switch_rtp_flush(v_engine->rtp_session); - //switch_rtp_reset_jb(v_engine->rtp_session); } goto end; case SWITCH_MESSAGE_INDICATE_3P_MEDIA: diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 7a8e2e5ab7..ce47a6cd68 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -334,7 +334,9 @@ static void switch_core_standard_on_execute(switch_core_session_t *session) switch_channel_clear_flag(session->channel, CF_RESET); switch_core_session_video_reset(session); - + switch_channel_audio_sync(session->channel); + switch_channel_video_sync(session->channel); + if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) { switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING); return; From 1c37daba4c3312a304c26ea7a90ff33c1c5e3648 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Fri, 19 Jul 2019 23:28:48 +0000 Subject: [PATCH 334/655] [mod_video_filter] fix some keyframe stuff and add read:sound and write:sound options --- .../mod_video_filter/mod_video_filter.c | 98 +++++++++++++++---- src/switch_ivr_async.c | 1 + 2 files changed, 80 insertions(+), 19 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 613f8d9195..2f4d5d5bf7 100644 --- a/src/mod/applications/mod_video_filter/mod_video_filter.c +++ b/src/mod/applications/mod_video_filter/mod_video_filter.c @@ -74,6 +74,7 @@ typedef struct video_replace_context_s { switch_image_t *rp_img; switch_file_handle_t vfh; switch_core_session_t *session; + int sound; } video_replace_context_t; @@ -227,7 +228,6 @@ static void parse_params(chromakey_context_t *context, int start, int argc, char if (n > 2 && argv[i]) { if (context->child_bug) { - printf("WTF CLOSE IT\n"); switch_core_media_bug_close(&context->child_bug, SWITCH_TRUE); context->child_uuid = NULL; } @@ -575,6 +575,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi if (context->vfh.params) { const char *loopstr = switch_event_get_header(context->vfh.params, "loop"); + if (switch_true(loopstr)) { uint32_t pos = 0; switch_core_file_seek(&context->vfh, &pos, 0, SEEK_SET); @@ -612,7 +613,6 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi status = switch_core_file_read_video(&context->fg_vfh, &file_frame, SVR_FLUSH); switch_core_file_command(&context->fg_vfh, SCFC_FLUSH_AUDIO); - if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { int close = 1; @@ -840,41 +840,51 @@ static switch_status_t video_replace_thread_callback(switch_core_session_t *sess if (switch_test_flag(&context->vfh, SWITCH_FILE_OPEN)) { switch_status_t status = SWITCH_STATUS_FALSE; - if (type == SWITCH_ABC_TYPE_READ_VIDEO_PING || (context->vfh.params && switch_true(switch_event_get_header(context->vfh.params, "scale")))) { - context->vfh.mm.scale_w = frame->img->d_w; - context->vfh.mm.scale_h = frame->img->d_h; - } + //if (type == SWITCH_ABC_TYPE_READ_VIDEO_PING || (context->vfh.params && switch_true(switch_event_get_header(context->vfh.params, "scale")))) { + //context->vfh.mm.scale_w = frame->img->d_w; + //context->vfh.mm.scale_h = frame->img->d_h; + //} status = switch_core_file_read_video(&context->vfh, &file_frame, SVR_FLUSH); - switch_core_file_command(&context->vfh, SCFC_FLUSH_AUDIO); - + if (!context->sound) { + switch_core_file_command(&context->vfh, SCFC_FLUSH_AUDIO); + } + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { int close = 1; - + if (context->vfh.params) { const char *loopstr = switch_event_get_header(context->vfh.params, "loop"); if (switch_true(loopstr)) { uint32_t pos = 0; - if (switch_core_file_seek(&context->vfh, &pos, 0, SEEK_SET) == SWITCH_STATUS_SUCCESS) close = 0; + switch_core_file_seek(&context->vfh, &pos, 0, SEEK_SET); + close = 0; } } if (close) { switch_core_file_close(&context->vfh); + switch_core_session_request_video_refresh(session); } } if (file_frame.img) { switch_img_free(&(context->rp_img)); - context->rp_img = file_frame.img; + + if (frame->img && (frame->img->d_w != file_frame.img->d_w || frame->img->d_h != file_frame.img->d_h)) { + switch_img_letterbox(file_frame.img, &context->rp_img, frame->img->d_w, frame->img->d_h, "#0000000"); + switch_img_free(&file_frame.img); + } else { + context->rp_img = file_frame.img; + } } if (context->rp_img) { if (context->rp_img->d_w != frame->img->d_w || context->rp_img->d_h != frame->img->d_h ) { frame->img = NULL; } - + switch_img_copy(context->rp_img, &frame->img); } } @@ -891,10 +901,17 @@ static switch_bool_t video_replace_bug_callback(switch_media_bug_t *bug, void *u switch (type) { case SWITCH_ABC_TYPE_INIT: { + switch_core_session_request_video_refresh(session); + switch_channel_set_flag(channel, CF_VIDEO_REFRESH_REQ); + switch_core_media_gen_key_frame(session); } break; case SWITCH_ABC_TYPE_CLOSE: { + switch_core_session_request_video_refresh(session); + switch_channel_set_flag(channel, CF_VIDEO_REFRESH_REQ); + switch_core_media_gen_key_frame(session); + switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); switch_img_free(&context->rp_img); @@ -904,6 +921,33 @@ static switch_bool_t video_replace_bug_callback(switch_media_bug_t *bug, void *u } } break; + case SWITCH_ABC_TYPE_WRITE_REPLACE: + case SWITCH_ABC_TYPE_READ_REPLACE: + { + switch_frame_t *rframe = NULL; + switch_size_t len; + + if (type == SWITCH_ABC_TYPE_WRITE_REPLACE) { + rframe = switch_core_media_bug_get_write_replace_frame(bug); + } else { + rframe = switch_core_media_bug_get_read_replace_frame(bug); + } + + if (rframe) { + len = rframe->samples; + + if (switch_test_flag(&context->vfh, SWITCH_FILE_OPEN)) { + switch_core_file_read(&context->vfh, rframe->data, &len); + + if (len < rframe->samples) { + memset((char *)rframe->data + (len * 2 * context->vfh.channels), 0, (rframe->samples - len) * 2 * context->vfh.channels); + } + + rframe->datalen = rframe->samples * 2 * context->vfh.channels; + } + } + } + break; case SWITCH_ABC_TYPE_READ_VIDEO_PING: case SWITCH_ABC_TYPE_WRITE_VIDEO_PING: { @@ -936,7 +980,8 @@ SWITCH_STANDARD_APP(video_replace_start_function) char *argv[2] = { 0 }; char *direction = NULL; char *file = NULL; - + switch_codec_implementation_t read_impl = { 0 }; + if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_video_replace_bug_"))) { if (!zstr(data) && !strcasecmp(data, "stop")) { switch_channel_set_private(channel, "_video_replace_bug_", NULL); @@ -979,7 +1024,9 @@ SWITCH_STANDARD_APP(video_replace_start_function) switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock); - if (switch_core_file_open(&context->vfh, file, 1, 8000, + switch_core_session_get_read_impl(session, &read_impl); + + if (switch_core_file_open(&context->vfh, file, read_impl.number_of_channels, read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening video file\n"); @@ -1014,7 +1061,9 @@ SWITCH_STANDARD_API(video_replace_api_function) char *direction = NULL; switch_media_bug_flag_t flags = 0; const char *function = "video_replace"; - + switch_codec_implementation_t read_impl = { 0 }; + int sound = 0; + if (zstr(cmd)) { goto usage; } @@ -1060,10 +1109,18 @@ SWITCH_STANDARD_API(video_replace_api_function) if (zstr(direction) || zstr(file)) goto usage; - if (!strcasecmp(direction, "read")) { + if (!strncasecmp(direction, "read", 4)) { flags = SMBF_READ_VIDEO_PING; - } else if (!strcasecmp(direction, "write")) { + if (switch_stristr(":sound", direction)) { + flags |= SMBF_READ_REPLACE; + sound = 1; + } + } else if (!strncasecmp(direction, "write", 5)) { flags = SMBF_WRITE_VIDEO_PING; + if (switch_stristr(":sound", direction)) { + flags |= SMBF_WRITE_REPLACE; + sound = 1; + } } else { goto usage; } @@ -1079,10 +1136,13 @@ SWITCH_STANDARD_API(video_replace_api_function) context = (video_replace_context_t *) switch_core_session_alloc(rsession, sizeof(*context)); switch_assert(context != NULL); context->session = rsession; - + context->sound = sound; switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock); - if (switch_core_file_open(&context->vfh, file, 1, 8000, + + switch_core_session_get_read_impl(rsession, &read_impl); + + if (switch_core_file_open(&context->vfh, file, read_impl.number_of_channels, read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO, switch_core_session_get_pool(rsession)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening video file\n"); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 357ea3f07a..726073c7a3 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1447,6 +1447,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s rh->fh->native_rate = rh->read_impl.actual_samples_per_second; if (switch_core_file_has_video(rh->fh, SWITCH_TRUE)) { switch_core_media_bug_set_media_params(bug, &rh->fh->mm); + switch_core_session_request_video_refresh(session); } } } From a7c3c95beffe932687116daa17802e18039273f4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Wed, 24 Jul 2019 16:29:41 +0000 Subject: [PATCH 335/655] [core] gen keyframe on new recording --- src/switch_ivr_async.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 726073c7a3..d0e8a9e054 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1448,6 +1448,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s if (switch_core_file_has_video(rh->fh, SWITCH_TRUE)) { switch_core_media_bug_set_media_params(bug, &rh->fh->mm); switch_core_session_request_video_refresh(session); + switch_core_media_gen_key_frame(session); } } } From 5111b6ef73d0f4c8e37e88d6fb52f10e196b4ff9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Mon, 15 Jun 2020 19:43:46 +0000 Subject: [PATCH 336/655] [core] don't decode strings with no encoding in them --- src/switch_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index 1d590d24f4..107d1a8643 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -3508,7 +3508,7 @@ SWITCH_DECLARE(char *) switch_url_decode(char *s) char *o; unsigned int tmp; - if (zstr(s)) { + if (zstr(s) || !strchr(s, '%')) { return s; } From d2ccb93f3ebe32774de8efd2bbcc511c5ebca641 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Mon, 13 Apr 2020 23:16:27 +0000 Subject: [PATCH 337/655] [mod_sofia] don't auto unhold via media format for non-sip --- src/include/switch_types.h | 1 + src/mod/endpoints/mod_sofia/sofia_glue.c | 1 + src/switch_ivr.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index a1bc0204ec..e978d33f2d 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1454,6 +1454,7 @@ typedef enum { CC_IO_OVERRIDE, CC_RTP_RTT, CC_MSRP, + CC_MUTE_VIA_MEDIA_STREAM, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CC_FLAG_MAX } switch_channel_cap_t; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 074e233aee..68125879ce 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -160,6 +160,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * switch_channel_set_cap(tech_pvt->channel, CC_FS_RTP); switch_channel_set_cap(tech_pvt->channel, CC_RTP_RTT); switch_channel_set_cap(tech_pvt->channel, CC_MSRP); + switch_channel_set_cap(tech_pvt->channel, CC_MUTE_VIA_MEDIA_STREAM); switch_channel_set_cap(tech_pvt->channel, CC_QUEUEABLE_DTMF_DELAY); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index ba292376f0..51875e4c25 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2114,7 +2114,7 @@ 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) && + 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_message_t msg = { 0 }; From d3ca238b05cc5d2fa9cca6307e7f8d8bd893ad8c Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Wed, 20 Feb 2019 13:15:13 -0600 Subject: [PATCH 338/655] [core] some mods for file playback to get proper bitrate and timing --- src/include/switch_types.h | 1 + src/mod/applications/mod_av/avformat.c | 5 +++ src/switch_core_media.c | 44 +++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index e978d33f2d..47a50869d8 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -2816,6 +2816,7 @@ typedef struct switch_mm_s { int cbr; float fps; float source_fps; + int source_kps; int vbuf; switch_video_profile_t vprofile; switch_video_encode_speed_t vencspd; diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 94dd545c6f..5ffd12d923 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1188,6 +1188,11 @@ GCC_DIAG_ON(deprecated-declarations) handle->duration = av_rescale_q(context->video_st.st->duration != AV_NOPTS_VALUE ? context->video_st.st->duration : context->fc->duration / AV_TIME_BASE * 1000, context->video_st.st->time_base, AV_TIME_BASE_Q); } + + if (context->fc->bit_rate) { + handle->mm.source_kps = context->fc->bit_rate / 1024; + } + if (context->video_st.st->avg_frame_rate.num) { handle->mm.source_fps = ceil(av_q2d(context->video_st.st->avg_frame_rate)); } else { diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 340d9c2924..ec0b5978a1 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6840,12 +6840,13 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void switch_rtp_engine_t *v_engine; int buflen = SWITCH_RTP_MAX_BUF_LEN; switch_timer_t timer = { 0 }; - switch_video_read_flag_t read_flags = SVR_BLOCK; + switch_video_read_flag_t read_flags = SVR_FLUSH; switch_core_session_t *b_session = NULL; switch_fps_t fps_data = { 0 }; float fps; switch_image_t *last_frame = NULL; - + int last_w = 0, last_h = 0, kps = 0; + if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { return NULL; } @@ -6888,11 +6889,36 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void switch_core_timer_init(&timer, "soft", fps_data.ms, fps_data.samples, switch_core_session_get_pool(session)); + if (smh->video_write_fh && smh->video_write_fh->mm.source_kps) { + int min = 0, max = 10000000; + const char *var; + + kps = smh->video_write_fh->mm.source_kps; + + if ((var = switch_channel_get_variable(session->channel, "video_file_min_kps"))) { + min = atoi(var); + if (min < 0) min = 0; + } + + if ((var = switch_channel_get_variable(session->channel, "video_file_max_kps"))) { + max = atoi(var); + if (max < 0) max = 10000000; + } + + if (min && kps < min) kps = min; + if (max != 10000000 && kps > max) kps = max; + + switch_core_media_set_outgoing_bitrate(session, SWITCH_MEDIA_TYPE_VIDEO, kps); + } + while (smh->video_write_thread_running > 0 && switch_channel_up_nosig(session->channel) && smh->video_write_fh && switch_test_flag(smh->video_write_fh, SWITCH_FILE_OPEN)) { switch_status_t wstatus = SWITCH_STATUS_FALSE; + + switch_core_timer_next(&timer); + switch_mutex_lock(v_engine->mh.file_write_mutex); //if (smh->video_write_fh && smh->video_write_fh->mm.source_fps && smh->video_write_fh->mm.source_fps != fps) { @@ -6903,15 +6929,25 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void if (smh->video_write_fh && !switch_test_flag(smh->video_write_fh, SWITCH_FILE_FLAG_VIDEO_EOF)) { wstatus = switch_core_file_read_video(smh->video_write_fh, &fr, read_flags); + if (wstatus == SWITCH_STATUS_BREAK) { + switch_core_timer_sync(&timer); + } if (wstatus == SWITCH_STATUS_SUCCESS) { + if (!kps && fr.img && (last_w != fr.img->d_w || last_h != fr.img->d_h)) { + kps = switch_calc_bitrate(fr.img->d_w, fr.img->d_h, 1, fps); + switch_core_media_set_outgoing_bitrate(session, SWITCH_MEDIA_TYPE_VIDEO, kps); + last_w = fr.img->d_w; + last_h = fr.img->d_h; + } + fr.timestamp = timer.samplecount; fr.flags = SFF_USE_VIDEO_TIMESTAMP|SFF_RAW_RTP|SFF_RAW_RTP_PARSE_FRAME; - if (smh->vid_params.d_width && smh->vid_params.d_height) { + if (fr.img && smh->vid_params.d_width && smh->vid_params.d_height) { switch_img_fit(&fr.img, smh->vid_params.d_width, smh->vid_params.d_height, SWITCH_FIT_SIZE); } - + switch_core_session_write_video_frame(session, &fr, SWITCH_IO_FLAG_FORCE, 0); switch_img_free(&last_frame); From 128d4776f84a8d84592f9dc4992d0c542f603bd3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Wed, 6 Mar 2019 23:17:47 +0000 Subject: [PATCH 339/655] [core] some more hardening work --- src/mod/applications/mod_av/avformat.c | 13 ++++++++--- .../mod_local_stream/mod_local_stream.c | 23 +++++++++++-------- src/switch_core_media.c | 13 +++++++---- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 5ffd12d923..6036580d64 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -822,7 +822,12 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * top: switch_assert(context->eh.video_queue); - + while(switch_queue_size(context->eh.video_queue) > 1) { + switch_image_t *tmp_img; + switch_queue_pop(context->eh.video_queue, &pop); + tmp_img = (switch_image_t *) pop; + switch_img_free(&tmp_img); + } if (switch_queue_pop(context->eh.video_queue, &pop) == SWITCH_STATUS_SUCCESS) { switch_img_free(&img); @@ -910,7 +915,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * } else { uint64_t delta_tmp; - switch_core_timer_sync(context->eh.video_timer); + switch_core_timer_next(context->eh.video_timer); delta_tmp = (context->eh.video_timer->samplecount * 90) - context->eh.last_ts; if (delta_tmp != 0) { @@ -1757,6 +1762,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa } if (context->has_video) { + switch_fps_t fps_data = { 0 }; switch_queue_create(&context->eh.video_queue, context->read_fps, handle->memory_pool); context->no_video_decode = handle->params && switch_true(switch_event_get_header(handle->params, "no_video_decode")); if (context->no_video_decode) { @@ -1764,7 +1770,8 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa switch_queue_create(&context->video_pkt_queue, 120 * 5, handle->memory_pool); } switch_mutex_init(&context->eh.mutex, SWITCH_MUTEX_NESTED, handle->memory_pool); - switch_core_timer_init(&context->video_timer, "soft", (int)(1000.0f / context->read_fps), 1, context->pool); + switch_calc_video_fps(&fps_data, context->read_fps); + switch_core_timer_init(&context->video_timer, "soft", fps_data.ms, fps_data.samples, context->pool); } { 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 c70d77410c..a38411e954 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -131,6 +131,7 @@ struct local_stream_source { uint8_t logo_opacity; uint8_t text_opacity; switch_mm_t mm; + int sync; }; typedef struct local_stream_source local_stream_source_t; @@ -362,6 +363,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void continue; } + source->sync = 0; switch_buffer_zero(audio_buffer); if (switch_core_file_has_video(&fh, SWITCH_FALSE)) { @@ -907,7 +909,7 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons handle->private_info = context; handle->interval = source->interval; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening Stream [%s] %dhz\n", path, handle->samplerate); - + handle->mm.source_fps = source->mm.source_fps; switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->pool); if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); @@ -999,14 +1001,19 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle local_stream_context_t *context = handle->private_info; switch_status_t status; switch_time_t now; - unsigned int fps = (unsigned int)ceil(handle->mm.fps); - unsigned int min_qsize = fps / 2; - unsigned int buf_qsize = 5; + unsigned int min_qsize = 1; + unsigned int buf_qsize = 1; + + handle->mm.source_fps = context->source->mm.source_fps; if (!(context->ready && context->source->ready)) { return SWITCH_STATUS_FALSE; } + if (!context->source->sync) { + return SWITCH_STATUS_BREAK; + } + if (!context->source->has_video) { if (frame) { switch_image_t *src_img = context->source->cover_art; @@ -1040,11 +1047,6 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle return SWITCH_STATUS_BREAK; } - if (handle->mm.fps >= context->source->mm.source_fps) { - min_qsize = 1; - buf_qsize = 1; - } - while(context->ready && context->source->ready && switch_queue_size(context->video_q) > min_qsize) { if (switch_queue_trypop(context->video_q, &pop) == SWITCH_STATUS_SUCCESS) { switch_image_t *img = (switch_image_t *) pop; @@ -1170,9 +1172,12 @@ static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void if ((bytes = switch_buffer_read(context->audio_buffer, data, need))) { *len = bytes / 2 / context->source->channels; + context->source->sync = 1; } else { size_t blank; + context->source->sync = 0; + switch_assert(handle->samplerate <= 48000); switch_assert(handle->real_channels <= 2); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index ec0b5978a1..5c4e19ad49 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6843,7 +6843,7 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void switch_video_read_flag_t read_flags = SVR_FLUSH; switch_core_session_t *b_session = NULL; switch_fps_t fps_data = { 0 }; - float fps; + float fps = 15.0f; switch_image_t *last_frame = NULL; int last_w = 0, last_h = 0, kps = 0; @@ -6878,12 +6878,14 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void switch_core_media_gen_key_frame(session); - if (smh->video_write_fh && smh->video_write_fh->mm.source_fps) { - fps = smh->video_write_fh->mm.source_fps; + if (smh->video_write_fh) { + if (smh->video_write_fh->mm.fps) { + fps = smh->video_write_fh->mm.fps; + } else if (smh->video_write_fh->mm.source_fps) { + fps = smh->video_write_fh->mm.source_fps; + } } else if (video_globals.fps) { fps = video_globals.fps; - } else { - fps = 15; } switch_calc_video_fps(&fps_data, fps); @@ -6929,6 +6931,7 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void if (smh->video_write_fh && !switch_test_flag(smh->video_write_fh, SWITCH_FILE_FLAG_VIDEO_EOF)) { wstatus = switch_core_file_read_video(smh->video_write_fh, &fr, read_flags); + if (wstatus == SWITCH_STATUS_BREAK) { switch_core_timer_sync(&timer); } From 7cd3bf5af2648e21fc3facf2d15178363b602eae Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Sat, 16 Nov 2019 16:43:47 +0800 Subject: [PATCH 340/655] [mod_av] make key_frame_min_freq work to prevent generate key frames too frequently --- src/mod/applications/mod_av/avcodec.c | 21 ++++++++++++----- .../applications/mod_av/test/test_mod_av.c | 23 +++++++++++++++++-- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index 827df4df6b..573b8baaa1 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -385,6 +385,7 @@ typedef struct h264_codec_context_s { switch_image_t *img; switch_image_t *encimg; int need_key_frame; + switch_time_t last_keyframe_request; switch_bool_t nalu_28_start; int change_bandwidth; @@ -420,7 +421,7 @@ struct avcodec_globals { int debug; uint32_t max_bitrate; uint32_t rtp_slice_size; - uint32_t key_frame_min_freq; + uint32_t key_frame_min_freq; // in ms uint32_t enc_threads; uint32_t dec_threads; @@ -1567,10 +1568,14 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t avframe->pts = context->pts++; - if (context->need_key_frame) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5, "Send AV KEYFRAME\n"); + if (context->need_key_frame && (context->last_keyframe_request + avcodec_globals.key_frame_min_freq) < switch_time_now()) { + if (avcodec_globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Generate/Send AV KEYFRAME\n"); + } + avframe->pict_type = AV_PICTURE_TYPE_I; avframe->key_frame = 1; + context->last_keyframe_request = switch_time_now(); } /* encode the image */ @@ -1585,7 +1590,7 @@ GCC_DIAG_ON(deprecated-declarations) goto error; } - if (context->need_key_frame) { + if (context->need_key_frame && avframe->key_frame == 1) { avframe->pict_type = 0; avframe->key_frame = 0; context->need_key_frame = 0; @@ -1633,8 +1638,12 @@ GCC_DIAG_ON(deprecated-declarations) context->nalus[i].start = p; context->nalus[i].eat = p; - if (mod_av_globals.debug && (*p & 0x1f) == 7) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "KEY FRAME GENERATED\n"); + if ((*p & 0x1f) == 7) { // Got Keyframe + // prevent to generate key frame too frequently + context->last_keyframe_request = switch_time_now(); + if (mod_av_globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "KEY FRAME GENERATED\n"); + } } } else { context->nalus[i].len = p - context->nalus[i].start; diff --git a/src/mod/applications/mod_av/test/test_mod_av.c b/src/mod/applications/mod_av/test/test_mod_av.c index a058aa63fd..69468dbda2 100644 --- a/src/mod/applications/mod_av/test/test_mod_av.c +++ b/src/mod/applications/mod_av/test/test_mod_av.c @@ -50,7 +50,7 @@ static fctcl_init_t my_cl_options[] = { FST_CORE_BEGIN("conf") { - const char *loop_; + const char *loop_; fctcl_install(my_cl_options); loop_ = fctcl_val("--loop"); @@ -73,7 +73,11 @@ FST_CORE_BEGIN("conf") uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12]; switch_frame_t frame = { 0 }; int packets = 0; + int frames = 0; + int last_key_frame = 0; + int key_frames = 0; switch_status_t encode_status; + int debug_level = 9; switch_set_string(codec_settings.video.config_profile_name, "conference"); @@ -105,6 +109,8 @@ FST_CORE_BEGIN("conf") frame.timestamp = 0; frame.img = img; + switch_core_codec_control(&codec, SCC_DEBUG, SCCT_NONE, &debug_level, SCCT_INT, NULL, NULL, NULL); + do { frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE; encode_status = switch_core_codec_encode_video(&codec, &frame); @@ -120,8 +126,21 @@ FST_CORE_BEGIN("conf") if (frame.datalen == 0) break; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[%d]: %02x %02x | m=%d | %d\n", loop, buf[12], buf[13], frame.m, frame.datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[%d]: %02x %02x | m=%d | %d\n", frames, buf[12], buf[13], frame.m, frame.datalen); packets++; + + if (frame.m) frames++; + + if (frames % 20 == 2) { + switch_core_codec_control(&codec, SCC_VIDEO_GEN_KEYFRAME, SCCT_NONE, NULL, SCCT_NONE, NULL, NULL, NULL); + } + + if (buf[12] == 0x67) { + key_frames++; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Key Frame %d last=%d diff=%d\n", + key_frames, last_key_frame, frames - last_key_frame); + last_key_frame = frames; + } } } while(encode_status == SWITCH_STATUS_MORE_DATA || loop-- > 1); From 565550f2180ed818855713e89aa980dd11641122 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Thu, 14 May 2020 12:11:41 +0800 Subject: [PATCH 341/655] [mod_av] fix interrupt callback is not passed down to the hls context in the first open_input --- src/mod/applications/mod_av/avformat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 6036580d64..398bd14d7e 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1162,6 +1162,8 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h if ((error = avformat_open_input(&context->fc, filename, NULL, NULL)) < 0) { char ebuf[255] = ""; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open input file '%s' (error '%s')\n", filename, get_error_text(error, ebuf, sizeof(ebuf))); + avformat_free_context(context->fc); + context->fc = NULL; switch_goto_status(SWITCH_STATUS_FALSE, err); } From f8150ead2c7fb97c108d8cd9238ce49a45fd53c6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sat, 27 Jun 2020 19:27:14 +0000 Subject: [PATCH 342/655] [mod_av] don't exit on decode errs just continue --- src/mod/applications/mod_av/avformat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 398bd14d7e..e8c83fa2ce 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1439,7 +1439,7 @@ GCC_DIAG_ON(deprecated-declarations) } else { char ebuf[255] = ""; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not read frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); - break; + continue; } } @@ -1491,7 +1491,7 @@ GCC_DIAG_ON(deprecated-declarations) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not decode frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); av_packet_unref(&pkt); av_frame_free(&vframe); - break; + continue; } // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pkt: %d, pts: %lld dts: %lld\n", pkt.size, pkt.pts, pkt.dts); @@ -1608,9 +1608,9 @@ GCC_DIAG_OFF(deprecated-declarations) if ((error = avcodec_decode_audio4(context->audio_st[0].st->codec, &in_frame, &got_data, &pkt)) < 0) { GCC_DIAG_ON(deprecated-declarations) char ebuf[255] = ""; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not decode frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not decode frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); av_packet_unref(&pkt); - break; + continue; } // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pkt: %d, decodedddd: %d pts: %lld dts: %lld\n", pkt.size, error, pkt.pts, pkt.dts); From 5331850fc0659148d7e83005a6629d5b30884729 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 9 Jul 2020 23:06:47 +0400 Subject: [PATCH 343/655] [mod_verto] Fix use of libks websockets on Windows. POLLHUP is ignored in poll events on Linux but fails on Windows so should be avoided. --- src/mod/endpoints/mod_verto/mod_verto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index b5dcce2269..804f612ff0 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1865,7 +1865,7 @@ done: kws_t *wsh = jsock->ws; while(jsock->profile->running) { - int pflags = kws_wait_sock(wsh, 3000, KS_POLL_READ | KS_POLL_ERROR | KS_POLL_HUP); + int pflags = kws_wait_sock(wsh, 3000, KS_POLL_READ); if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); } if (pflags < 0 && (errno != EINTR)) { die_errnof("%s POLL FAILED with %d", jsock->name, pflags); } @@ -1927,7 +1927,7 @@ static void client_run(jsock_t *jsock) if (!jsock->ws) { die("%s Setup Error\n", jsock->name); } - pflags = kws_wait_sock(jsock->ws, poll_time, KS_POLL_READ | KS_POLL_ERROR | KS_POLL_HUP); + pflags = kws_wait_sock(jsock->ws, poll_time, KS_POLL_READ); if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); } if (pflags < 0 && (errno != EINTR)) { die_errnof("%s POLL FAILED with %d", jsock->name, pflags); } From 31fdf1b74682a5c188a7747f528b50033d11d261 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 28 Jul 2020 15:56:07 -0400 Subject: [PATCH 344/655] [core] Do not log ERROR in switch_ivr_record_session() if media bug failed due to hangup --- src/switch_ivr_async.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index d0e8a9e054..953d49ed7d 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -3238,7 +3238,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess if ((status = switch_core_media_bug_add(session, "session_record", file, record_callback, rh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file); + if (switch_channel_ready(channel)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Error adding media bug for file %s\n", file); + } switch_goto_status(status, err); } From cd041b768c7294718e1f624dc33f6137ad63e7d4 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Thu, 30 Jul 2020 21:54:56 +0000 Subject: [PATCH 345/655] [mod_spandsp] Add verbose-log-level configuration. --- .../vanilla/autoload_configs/spandsp.conf.xml | 1 + .../applications/mod_spandsp/mod_spandsp.c | 6 +++ .../applications/mod_spandsp/mod_spandsp.h | 7 +++ .../mod_spandsp/mod_spandsp_dsp.c | 7 ++- .../mod_spandsp/mod_spandsp_fax.c | 44 +++++++++++++++---- 5 files changed, 55 insertions(+), 10 deletions(-) diff --git a/conf/vanilla/autoload_configs/spandsp.conf.xml b/conf/vanilla/autoload_configs/spandsp.conf.xml index 2471ca52ce..6345512908 100644 --- a/conf/vanilla/autoload_configs/spandsp.conf.xml +++ b/conf/vanilla/autoload_configs/spandsp.conf.xml @@ -28,6 +28,7 @@ <fax-settings> <param name="use-ecm" value="true"/> <param name="verbose" value="false"/> + <!--param name="verbose-log-level" value="INFO"/--> <param name="disable-v17" value="false"/> <param name="ident" value="SpanDSP Fax Ident"/> <param name="header" value="SpanDSP Fax Header"/> diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 35d0cb585f..3f69b9746a 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -516,6 +516,7 @@ switch_status_t load_configuration(switch_bool_t reload) spandsp_globals.enable_tep = 0; spandsp_globals.total_sessions = 0; spandsp_globals.verbose = 0; + spandsp_globals.verbose_log_level = SWITCH_LOG_DEBUG; spandsp_globals.use_ecm = 1; spandsp_globals.disable_v17 = 0; spandsp_globals.prepend_string = switch_core_strdup(spandsp_globals.config_pool, "fax"); @@ -591,6 +592,11 @@ switch_status_t load_configuration(switch_bool_t reload) spandsp_globals.verbose = 1; else spandsp_globals.verbose = 0; + } else if (!strcmp(name, "verbose-log-level")) { + switch_log_level_t verbose_log_level = switch_log_str2level(value); + if (verbose_log_level != SWITCH_LOG_INVALID) { + spandsp_globals.verbose_log_level = verbose_log_level; + } } else if (!strcmp(name, "disable-v17")) { if (switch_true(value)) spandsp_globals.disable_v17 = 1; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 0863831b3c..216895dd29 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -70,6 +70,7 @@ struct spandsp_globals { short int use_ecm; short int verbose; + switch_log_level_t verbose_log_level; short int disable_v17; short int enable_tep; short int enable_colour_fax; @@ -106,6 +107,12 @@ typedef enum { FUNCTION_GW } mod_spandsp_fax_application_mode_t; +struct mod_spandsp_log_data { + switch_log_level_t verbose_log_level; + switch_core_session_t *session; +}; +typedef struct mod_spandsp_log_data mod_spandsp_log_data_t; + /****************************************************************************** * TONE DETECTION WITH CADENCE */ diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index fca74635e8..836808a48d 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -406,7 +406,12 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da switch (type) { case SWITCH_ABC_TYPE_INIT: { pvt->dtmf_detect = dtmf_rx_init(NULL, NULL, NULL); - span_log_set_message_handler(dtmf_rx_get_logging_state(pvt->dtmf_detect), mod_spandsp_log_message, pvt->session); + { + mod_spandsp_log_data_t *log_data = switch_core_session_alloc(pvt->session, sizeof(*log_data)); + log_data->session = pvt->session; + log_data->verbose_log_level = spandsp_globals.verbose_log_level; + span_log_set_message_handler(dtmf_rx_get_logging_state(pvt->dtmf_detect), mod_spandsp_log_message, log_data); + } if (pvt->verbose) { span_log_set_level(dtmf_rx_get_logging_state(pvt->dtmf_detect), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); } diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 1f63eb1aed..14c2bb253b 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -106,6 +106,7 @@ struct pvt_s { int enable_colour_to_bilevel; int enable_grayscale_to_bilevel; int verbose; + switch_log_level_t verbose_log_level; int caller; int tx_page_start; @@ -273,7 +274,9 @@ static void counter_increment(void) void mod_spandsp_log_message(void *user_data, int level, const char *msg) { int fs_log_level; - switch_core_session_t *session = (switch_core_session_t *)user_data; + mod_spandsp_log_data_t *log_data = (mod_spandsp_log_data_t *)user_data; + switch_core_session_t *session = log_data ? log_data->session : NULL; + switch_log_level_t verbose_log_level = log_data ? log_data->verbose_log_level : spandsp_globals.verbose_log_level; switch (level) { case SPAN_LOG_NONE: @@ -290,12 +293,12 @@ void mod_spandsp_log_message(void *user_data, int level, const char *msg) case SPAN_LOG_FLOW_2: case SPAN_LOG_FLOW_3: default: /* SPAN_LOG_DEBUG, SPAN_LOG_DEBUG_2, SPAN_LOG_DEBUG_3 */ - fs_log_level = SWITCH_LOG_DEBUG; + fs_log_level = verbose_log_level; break; } if (!zstr(msg)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), fs_log_level, "%s", msg); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), fs_log_level, "%s", msg); } } @@ -811,8 +814,13 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) fax_set_transmit_on_idle(fax, TRUE); - span_log_set_message_handler(fax_get_logging_state(fax), mod_spandsp_log_message, pvt->session); - span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, pvt->session); + { + mod_spandsp_log_data_t *log_data = switch_core_session_alloc(pvt->session, sizeof(*log_data)); + log_data->session = pvt->session; + log_data->verbose_log_level = pvt->verbose_log_level; + span_log_set_message_handler(fax_get_logging_state(fax), mod_spandsp_log_message, log_data); + span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, log_data); + } if (pvt->verbose) { span_log_set_level(fax_get_logging_state(fax), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); @@ -865,8 +873,13 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; switch_core_session_receive_message(pvt->session, &msg); - span_log_set_message_handler(t38_terminal_get_logging_state(t38), mod_spandsp_log_message, pvt->session); - span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, pvt->session); + { + mod_spandsp_log_data_t *log_data = switch_core_session_alloc(pvt->session, sizeof(*log_data)); + log_data->session = pvt->session; + log_data->verbose_log_level = pvt->verbose_log_level; + span_log_set_message_handler(t38_terminal_get_logging_state(t38), mod_spandsp_log_message, log_data); + span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, log_data); + } if (pvt->verbose) { span_log_set_level(t38_terminal_get_logging_state(t38), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); @@ -922,8 +935,13 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) t38_gateway_set_ecm_capability(pvt->t38_gateway_state, pvt->use_ecm); switch_channel_set_variable(channel, "fax_ecm_requested", pvt->use_ecm ? "true" : "false"); - span_log_set_message_handler(t38_gateway_get_logging_state(pvt->t38_gateway_state), mod_spandsp_log_message, pvt->session); - span_log_set_message_handler(t38_core_get_logging_state(pvt->t38_core), mod_spandsp_log_message, pvt->session); + { + mod_spandsp_log_data_t *log_data = switch_core_session_alloc(pvt->session, sizeof(*log_data)); + log_data->session = pvt->session; + log_data->verbose_log_level = pvt->verbose_log_level; + span_log_set_message_handler(t38_gateway_get_logging_state(pvt->t38_gateway_state), mod_spandsp_log_message, log_data); + span_log_set_message_handler(t38_core_get_logging_state(pvt->t38_core), mod_spandsp_log_message, log_data); + } if (pvt->verbose) { span_log_set_level(t38_gateway_get_logging_state(pvt->t38_gateway_state), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); @@ -1377,6 +1395,14 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati pvt->verbose = spandsp_globals.verbose; } + pvt->verbose_log_level = spandsp_globals.verbose_log_level; + if ((tmp = switch_channel_get_variable(channel, "fax_verbose_log_level"))) { + switch_log_level_t verbose_log_level = switch_log_str2level(tmp); + if (verbose_log_level != SWITCH_LOG_INVALID) { + pvt->verbose_log_level = verbose_log_level; + } + } + if ((tmp = switch_channel_get_variable(channel, "fax_force_caller"))) { if (switch_true(tmp)) { pvt->caller = 1; From 2c3dcbde71d0f8b5785f25edbc669361dc7db23e Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Thu, 30 Jul 2020 22:18:45 +0000 Subject: [PATCH 346/655] [core, mod_console, mod_graylog2] Add sequence to logs to preserve order when timestamp is not precise enough. --- src/include/switch_log.h | 3 +++ src/mod/loggers/mod_console/mod_console.c | 5 ++++- src/mod/loggers/mod_graylog2/mod_graylog2.c | 1 + src/switch_log.c | 6 ++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/include/switch_log.h b/src/include/switch_log.h index 8fb0beae2a..40725a6cca 100644 --- a/src/include/switch_log.h +++ b/src/include/switch_log.h @@ -66,6 +66,8 @@ SWITCH_BEGIN_EXTERN_C switch_text_channel_t channel; switch_log_level_t slevel; switch_event_t *tags; + /* Log sequence */ + int64_t sequence; } switch_log_node_t; ///\{ @@ -94,6 +96,7 @@ typedef struct { switch_log_json_format_item_t short_message; const char *custom_field_prefix; double timestamp_divisor; + switch_log_json_format_item_t sequence; } switch_log_json_format_t; typedef switch_status_t (*switch_log_function_t) (const switch_log_node_t *node, switch_log_level_t level); diff --git a/src/mod/loggers/mod_console/mod_console.c b/src/mod/loggers/mod_console/mod_console.c index 48647f8725..420bf795ab 100644 --- a/src/mod/loggers/mod_console/mod_console.c +++ b/src/mod/loggers/mod_console/mod_console.c @@ -77,7 +77,8 @@ static switch_log_json_format_t json_format = { { "message", NULL }, // full_message { NULL, NULL }, // short_message "", // custom_field_prefix - 0.0 // timestamp_divisor + 0.0, // timestamp_divisor + { "sequence", NULL } // sequence }; static char *to_json_string(const switch_log_node_t *node) @@ -177,6 +178,8 @@ static switch_status_t config_logger(void) json_format.full_message.name = zstr(val) ? NULL : switch_core_strdup(module_pool, val); } else if (!strcasecmp(var, "short-message")) { json_format.short_message.name = zstr(val) ? NULL : switch_core_strdup(module_pool, val); + } else if (!strcasecmp(var, "sequence")) { + json_format.sequence.name = zstr(val) ? NULL : switch_core_strdup(module_pool, val); } } for (param = switch_xml_child(settings, "config"); param; param = param->next) { diff --git a/src/mod/loggers/mod_graylog2/mod_graylog2.c b/src/mod/loggers/mod_graylog2/mod_graylog2.c index 7f46584a38..59fe1202a8 100644 --- a/src/mod/loggers/mod_graylog2/mod_graylog2.c +++ b/src/mod/loggers/mod_graylog2/mod_graylog2.c @@ -333,6 +333,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_graylog2_load) globals.gelf_format.full_message.name = "full_message"; globals.gelf_format.short_message.name = "short_message"; globals.gelf_format.custom_field_prefix = "_"; + globals.gelf_format.sequence.name = "_sequence"; switch_event_create_plain(&globals.session_fields, SWITCH_EVENT_CHANNEL_DATA); diff --git a/src/switch_log.c b/src/switch_log.c index 93fcc5ec37..054e728768 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -68,6 +68,8 @@ static int mods_loaded = 0; static int console_mods_loaded = 0; static switch_bool_t COLORIZE = SWITCH_FALSE; +static int64_t log_sequence = 0; + #ifdef WIN32 static HANDLE hStdout; static WORD wOldColorAttrs; @@ -144,6 +146,9 @@ SWITCH_DECLARE(cJSON *) switch_log_node_to_json(const switch_log_node_t *node, i if (json_format->function.name && !zstr_buf(node->func)) { cJSON_AddItemToObject(json, json_format->function.name, cJSON_CreateString(node->func)); } + if (json_format->sequence.name) { + cJSON_AddItemToObject(json, json_format->sequence.name, cJSON_CreateNumber(node->sequence)); + } /* skip initial space and new line */ if (*full_message == ' ') { @@ -478,6 +483,7 @@ static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj) node = (switch_log_node_t *) pop; switch_mutex_lock(BINDLOCK); + node->sequence = ++log_sequence; for (binding = BINDINGS; binding; binding = binding->next) { if (binding->level >= node->level) { binding->function(node, node->level); From a9629e72d4806af95e4b0dadc6a706fa67ab74d2 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 31 Jul 2020 13:43:29 +0000 Subject: [PATCH 347/655] [mod_spandsp] add fax_trace_dir channel variable. When set, it will write spandsp fax trace to one file per fax. --- .../applications/mod_spandsp/mod_spandsp.h | 1 + .../mod_spandsp/mod_spandsp_fax.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 216895dd29..01f79e254d 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -110,6 +110,7 @@ typedef enum { struct mod_spandsp_log_data { switch_log_level_t verbose_log_level; switch_core_session_t *session; + FILE *trace_file; }; typedef struct mod_spandsp_log_data mod_spandsp_log_data_t; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 14c2bb253b..4f5d825a36 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -107,6 +107,7 @@ struct pvt_s { int enable_grayscale_to_bilevel; int verbose; switch_log_level_t verbose_log_level; + FILE *trace_file; int caller; int tx_page_start; @@ -299,6 +300,9 @@ void mod_spandsp_log_message(void *user_data, int level, const char *msg) if (!zstr(msg)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), fs_log_level, "%s", msg); + if (log_data && log_data->trace_file) { + fwrite(msg, strlen(msg) * sizeof(const char), 1, log_data->trace_file); + } } } @@ -818,6 +822,7 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) mod_spandsp_log_data_t *log_data = switch_core_session_alloc(pvt->session, sizeof(*log_data)); log_data->session = pvt->session; log_data->verbose_log_level = pvt->verbose_log_level; + log_data->trace_file = pvt->trace_file; span_log_set_message_handler(fax_get_logging_state(fax), mod_spandsp_log_message, log_data); span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, log_data); } @@ -877,6 +882,7 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) mod_spandsp_log_data_t *log_data = switch_core_session_alloc(pvt->session, sizeof(*log_data)); log_data->session = pvt->session; log_data->verbose_log_level = pvt->verbose_log_level; + log_data->trace_file = pvt->trace_file; span_log_set_message_handler(t38_terminal_get_logging_state(t38), mod_spandsp_log_message, log_data); span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, log_data); } @@ -939,6 +945,7 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) mod_spandsp_log_data_t *log_data = switch_core_session_alloc(pvt->session, sizeof(*log_data)); log_data->session = pvt->session; log_data->verbose_log_level = pvt->verbose_log_level; + log_data->trace_file = pvt->trace_file; span_log_set_message_handler(t38_gateway_get_logging_state(pvt->t38_gateway_state), mod_spandsp_log_message, log_data); span_log_set_message_handler(t38_core_get_logging_state(pvt->t38_core), mod_spandsp_log_message, log_data); } @@ -1083,6 +1090,12 @@ static switch_status_t spanfax_destroy(pvt_t *pvt) if (pvt->udptl_state) { udptl_release(pvt->udptl_state); } + + if (pvt->trace_file) { + fclose(pvt->trace_file); + pvt->trace_file = NULL; + } + return SWITCH_STATUS_SUCCESS; } @@ -1403,6 +1416,12 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati } } + if ((tmp = switch_channel_get_variable(channel, "fax_trace_dir"))) { + const char *trace_filename = switch_core_session_sprintf(session, "%s"SWITCH_PATH_SEPARATOR"fax-%s.log", tmp, switch_core_session_get_uuid(session)); + switch_dir_make_recursive(tmp, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)); + pvt->trace_file = fopen(trace_filename, "w"); + } + if ((tmp = switch_channel_get_variable(channel, "fax_force_caller"))) { if (switch_true(tmp)) { pvt->caller = 1; From be8535341aaf7a1e2a134b2c6604d69341007ced Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 31 Jul 2020 14:06:06 +0000 Subject: [PATCH 348/655] [mod_spandsp] set fax_trace_file channel var if a trace file is opened --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 4f5d825a36..7997c6752d 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1420,6 +1420,9 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati const char *trace_filename = switch_core_session_sprintf(session, "%s"SWITCH_PATH_SEPARATOR"fax-%s.log", tmp, switch_core_session_get_uuid(session)); switch_dir_make_recursive(tmp, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)); pvt->trace_file = fopen(trace_filename, "w"); + if (pvt->trace_file) { + switch_channel_set_variable(channel, "fax_trace_file", trace_filename); + } } if ((tmp = switch_channel_get_variable(channel, "fax_force_caller"))) { From 6b3cd2e41fe75bf3e84e50747c2047cece1f06e2 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@x-y-t.cn> Date: Mon, 7 Sep 2020 23:24:24 +0800 Subject: [PATCH 349/655] [mod_av] support rtmps --- src/mod/applications/mod_av/avformat.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index e8c83fa2ce..7c82913d55 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1686,17 +1686,21 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa disable_write_buffer = 1; } - if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) { + if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "rtmps") || !strcasecmp(handle->stream_name, "youtube"))) { + char *secure = ""; + format = "flv"; if ((ext = strrchr((char *)path, '.')) == 0) { ext = ".flv"; } + if (!strcasecmp(handle->stream_name, "rtmps")) secure = "s"; + // meh really silly format for the user / pass libav..... if (handle->mm.auth_username && handle->mm.auth_password) { - switch_snprintf(file, sizeof(file), "rtmp://%s pubUser=%s pubPasswd=%s flashver=FMLE/3.0", path, handle->mm.auth_username, handle->mm.auth_password); + switch_snprintf(file, sizeof(file), "rtmp%s://%s pubUser=%s pubPasswd=%s flashver=FMLE/3.0", secure, path, handle->mm.auth_username, handle->mm.auth_password); } else { - switch_snprintf(file, sizeof(file), "rtmp://%s", path); + switch_snprintf(file, sizeof(file), "rtmp%s://%s", secure, path); } } else if (handle->stream_name && !strcasecmp(handle->stream_name, "rtsp")) { @@ -1859,7 +1863,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && fmt->video_codec != AV_CODEC_ID_NONE) { const AVCodecDescriptor *desc; - if ((handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube")))) { + if ((handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "rtmps") || !strcasecmp(handle->stream_name, "youtube")))) { if (fmt->video_codec != AV_CODEC_ID_H264 ) { fmt->video_codec = AV_CODEC_ID_H264; // force H264 @@ -2895,6 +2899,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load) supported_formats[i++] = "av"; supported_formats[i++] = "rtmp"; + supported_formats[i++] = "rtmps"; supported_formats[i++] = "rtsp"; supported_formats[i++] = "mp4"; supported_formats[i++] = "m4a"; From 734e9776e0cabf65f0dea77c9a49c8cf3de14256 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sun, 4 Oct 2020 19:24:30 +0400 Subject: [PATCH 350/655] [Unit-tests] Add --enable-fake-dlclose configure flag so modules are not unloaded and ASAN could give more info and not just <unknown module>. --- configure.ac | 10 ++++++++++ src/switch_dso.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index db82222e0d..5a7b9f0cbc 100644 --- a/configure.ac +++ b/configure.ac @@ -1986,6 +1986,16 @@ if test "${enable_address_sanitizer}" = "yes"; then APR_ADDTO(LDFLAGS, -fsanitize=address) fi +# Enable fake dlclose +AC_ARG_ENABLE(fake_dlclose, + [AC_HELP_STRING([--enable-fake-dlclose],[Do not unload dynamic libraries])], + [enable_fake_dlclose="$enable_fake_dlclose"], + [enable_fake_dlclose="no"]) + +if test "${enable_fake_dlclose}" = "yes"; then + APR_ADDTO(SWITCH_AM_CFLAGS, -DHAVE_FAKE_DLCLOSE) +fi + AC_ARG_ENABLE(, [AC_HELP_STRING([--enable-pool-sanitizer],[build with sanitizer friendly pool behavior])], [enable_pool_sanitizer="$enable_pool_sanitizer"], diff --git a/src/switch_dso.c b/src/switch_dso.c index a78bba2f8c..86ffb0f419 100644 --- a/src/switch_dso.c +++ b/src/switch_dso.c @@ -91,7 +91,9 @@ SWITCH_DECLARE(void *) switch_dso_data_sym(switch_dso_lib_t lib, const char *sym void switch_dso_destroy(switch_dso_lib_t *lib) { if (lib && *lib) { +#ifndef HAVE_FAKE_DLCLOSE dlclose(*lib); +#endif *lib = NULL; } } From 66a92063b6526636e0f4cd92680fe2bd97eb5a5d Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 28 Oct 2020 02:26:04 +0400 Subject: [PATCH 351/655] [mod_sofia] Add tls-orq-connect-timeout profile parameter so SIP engine could try again sending an outgoing request and when possible - using an alternative address (DNS failover). Add sip_call_tls_orq_connect_timeout channel variable per call to override profile's timeout. --- conf/testing/sip_profiles/internal.xml | 8 ++++++++ conf/vanilla/sip_profiles/internal.xml | 8 ++++++++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 11 +++++++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 5 +++++ 5 files changed, 33 insertions(+) diff --git a/conf/testing/sip_profiles/internal.xml b/conf/testing/sip_profiles/internal.xml index 2a3564ebb4..d7b2ef893d 100644 --- a/conf/testing/sip_profiles/internal.xml +++ b/conf/testing/sip_profiles/internal.xml @@ -216,6 +216,14 @@ <!-- TLS ciphers default: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH --> <param name="tls-ciphers" value="$${sip_tls_ciphers}"/> + <!-- + Connect timeout for outgoing requests using TLS (in milliseconds). + Set the timeout and SIP engine will try again sending an outgoing request + and when possible - using an alternative address (DNS failover). + Default - 0 (disabled) + --> + <!-- <param name="tls-orq-connect-timeout" value="3000" /> --> + <!-- turn on auto-flush during bridge (skip timer sleep when the socket already has data) (reduces delay on latent connections default true, must be disabled explicitly)--> <!--<param name="rtp-autoflush-during-bridge" value="false"/>--> diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index 58350e827b..85692fa631 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -216,6 +216,14 @@ <!-- TLS ciphers default: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH --> <param name="tls-ciphers" value="$${sip_tls_ciphers}"/> + <!-- + Connect timeout for outgoing requests using TLS (in milliseconds). + Set the timeout and SIP engine will try again sending an outgoing request + and when possible - using an alternative address (DNS failover). + Default - 0 (disabled) + --> + <!-- <param name="tls-orq-connect-timeout" value="3000" /> --> + <!-- turn on auto-flush during bridge (skip timer sleep when the socket already has data) (reduces delay on latent connections default true, must be disabled explicitly)--> <!--<param name="rtp-autoflush-during-bridge" value="false"/>--> diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 9a739088df..9d0d150354 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -761,6 +761,7 @@ struct sofia_profile { uint32_t timer_t1x64; uint32_t timer_t2; uint32_t timer_t4; + uint32_t tls_orq_connect_timeout; char *contact_user; char *local_network; uint32_t trans_timeout; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f31367a04c..a71678dd10 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3220,6 +3220,10 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TPTAG_PONG2PING(1), NTATAG_TCP_RPORT(0), NTATAG_TLS_RPORT(0), +#ifdef NTATAG_TLS_ORQ_CONNECT_TIMEOUT + TAG_IF(profile->tls_orq_connect_timeout, + NTATAG_TLS_ORQ_CONNECT_TIMEOUT(profile->tls_orq_connect_timeout)), /* Profile based timeout */ +#endif NUTAG_RETRY_AFTER_ENABLE(0), NUTAG_AUTO_INVITE_100(0), TAG_IF(!strchr(profile->sipip, ':'), @@ -5917,6 +5921,13 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else { profile->timer_t4 = 4000; } + } else if (!strcasecmp(var, "tls-orq-connect-timeout") && !zstr(val)) { + int v = atoi(val); + if (v > 0) { + profile->tls_orq_connect_timeout = v; + } else { + profile->tls_orq_connect_timeout = 0; + } } else if (!strcasecmp(var, "sip-options-respond-503-on-busy")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_OPTIONS_RESPOND_503_ON_BUSY); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 68125879ce..9a6a7acbd9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1068,6 +1068,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) const char *stir_shaken_attest = NULL; char *identity_to_free = NULL; const char *date = NULL; + const char *sip_call_tls_orq_connect_timeout = switch_channel_get_variable(tech_pvt->channel, "sip_call_tls_orq_connect_timeout"); if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD_INACTIVE) || @@ -1400,6 +1401,10 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) NUTAG_URL(url_str), TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), TAG_IF(!zstr(record_route), SIPTAG_HEADER_STR(record_route)), +#ifdef NUTAG_CALL_TLS_ORQ_CONNECT_TIMEOUT + /* Per call tls outgoing request connect timeout */ + TAG_IF(sip_call_tls_orq_connect_timeout, NUTAG_CALL_TLS_ORQ_CONNECT_TIMEOUT(atoi(sip_call_tls_orq_connect_timeout))), +#endif SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END()))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, From d2e8a775b04090f1745442c2fe9e7c3a513bfb67 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 27 Oct 2020 20:14:51 +0400 Subject: [PATCH 352/655] [mod_sofia] Set sip_100_uepoch channel variable on initial 100 trying response. --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 9d0d150354..6e118e1fe3 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -363,6 +363,7 @@ typedef enum { TFLAG_PASS_ACK, TFLAG_KEEPALIVE, TFLAG_SKIP_EARLY, + TFLAG_100_UEPOCH_SET, /* No new flags below this line */ TFLAG_MAX } TFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index a71678dd10..bb5b969552 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6597,6 +6597,22 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status switch_caller_profile_t *caller_profile = NULL; int has_t38 = 0; + if (status == 100 && !sofia_test_flag(tech_pvt, TFLAG_100_UEPOCH_SET)) { + sofia_set_flag(tech_pvt, TFLAG_100_UEPOCH_SET); + switch_channel_set_variable_printf(channel, "sip_100_uepoch", "%" SWITCH_TIME_T_FMT, switch_time_now()); + } + + if (de && de->data && de->data->e_msg) { + sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port); + + switch_channel_set_variable_printf(channel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip); + switch_channel_set_variable(channel, "sip_reply_host", network_ip); + switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port); + + switch_channel_set_variable_printf(channel, "sip_network_ip", "%s", network_ip); + switch_channel_set_variable_printf(channel, "sip_network_port", "%d", network_port); + } + switch_channel_clear_flag(channel, CF_REQ_MEDIA); if (status < 200) { @@ -6644,15 +6660,6 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote Reason: %d\n", tech_pvt->q850_cause); } - sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port); - - switch_channel_set_variable_printf(channel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip); - switch_channel_set_variable(channel, "sip_reply_host", network_ip); - switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port); - - switch_channel_set_variable_printf(channel, "sip_network_ip", "%s", network_ip); - switch_channel_set_variable_printf(channel, "sip_network_port", "%d", network_port); - if ((caller_profile = switch_channel_get_caller_profile(channel)) && !zstr(network_ip) && (zstr(caller_profile->network_addr) || strcmp(caller_profile->network_addr, network_ip))) { caller_profile->network_addr = switch_core_strdup(caller_profile->pool, network_ip); From a162cf86e86f4fc22f322f4a6c532cb2d704930d Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 17 Nov 2020 00:57:10 +0400 Subject: [PATCH 353/655] [Core] Add check for recovery_skip_announcement_type_applications channel variable, change default behavior to not skip announcement type apps on recovery. --- src/switch_core_sqldb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 3ce7fae8fb..e9334eb52d 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -3288,11 +3288,12 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName } if ((callflow = switch_xml_child(xml, "callflow")) && (x_extension = switch_xml_child(callflow, "extension"))) { + int recovery_skip_announcement_type_applications = switch_channel_var_true(channel, "recovery_skip_announcement_type_applications"); for (param = switch_xml_child(x_extension, "application"); param; param = param->next) { const char *var = switch_xml_attr_soft(param, "app_name"); const char *val = switch_xml_attr_soft(param, "app_data"); /* skip announcement type apps */ - if (strcasecmp(var, "speak") && strcasecmp(var, "playback") && strcasecmp(var, "gentones") && strcasecmp(var, "say")) { + if (!recovery_skip_announcement_type_applications || (strcasecmp(var, "speak") && strcasecmp(var, "playback") && strcasecmp(var, "gentones") && strcasecmp(var, "say"))) { switch_caller_extension_add_application(session, extension, var, val); } } From 60c4b62254c3c8b7cf43a890f1701c1f34d3c935 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 11 Dec 2020 18:20:33 -0500 Subject: [PATCH 354/655] [core] Add SMBF_PAUSE media bug flag to pause an individual media bug. * [core] Add SMBF_PAUSE media bug flag to pause an individual media bug. [core] Add switch_ivr_record_session_pause() to pause a session recording. [mod_dptools] Add record_session_pause and record_session_resume dialplan APPs. [mod_commands] Add pause/resume sub-commands to uuid_record API. --- src/include/switch_ivr.h | 1 + src/include/switch_types.h | 3 +- .../applications/mod_commands/mod_commands.c | 12 ++ .../applications/mod_dptools/mod_dptools.c | 16 ++- src/switch_core_io.c | 10 +- src/switch_core_media.c | 10 +- src/switch_ivr_async.c | 16 +++ tests/unit/.gitignore | 5 + tests/unit/Makefile.am | 2 +- tests/unit/conf_async/freeswitch.xml | 47 +++++++ tests/unit/switch_ivr_async.c | 124 ++++++++++++++++++ 11 files changed, 232 insertions(+), 14 deletions(-) create mode 100644 tests/unit/conf_async/freeswitch.xml create mode 100644 tests/unit/switch_ivr_async.c diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 318ce26214..1e76848dc9 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -1031,6 +1031,7 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name, SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_call_cause_t cause); SWITCH_DECLARE(switch_status_t) switch_ivr_blind_transfer_ack(switch_core_session_t *session, switch_bool_t success); SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_mask(switch_core_session_t *session, const char *file, switch_bool_t on); +SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_pause(switch_core_session_t *session, const char *file, switch_bool_t on); SWITCH_DECLARE(switch_status_t) switch_ivr_stop_video_write_overlay_session(switch_core_session_t *session); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 47a50869d8..b9ae217472 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1910,7 +1910,8 @@ typedef enum { SMBF_SPY_VIDEO_STREAM_BLEG = (1 << 23), SMBF_READ_VIDEO_PATCH = (1 << 24), SMBF_READ_TEXT_STREAM = (1 << 25), - SMBF_FIRST = (1 << 26) + SMBF_FIRST = (1 << 26), + SMBF_PAUSE = (1 << 27) } switch_media_bug_flag_enum_t; typedef uint32_t switch_media_bug_flag_t; diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 960268cd4f..8c185bcb12 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4781,6 +4781,18 @@ SWITCH_STANDARD_API(session_record_function) } else { stream->write_function(stream, "+OK Success\n"); } + } else if (!strcasecmp(action, "pause")) { + if (switch_ivr_record_session_pause(rsession, path, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Cannot pause recording session!\n"); + } else { + stream->write_function(stream, "+OK Success\n"); + } + } else if (!strcasecmp(action, "resume")) { + if (switch_ivr_record_session_pause(rsession, path, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Cannot resume recording session!\n"); + } else { + stream->write_function(stream, "+OK Success\n"); + } } else if (!strcasecmp(action, "mask")) { if (switch_ivr_record_session_mask(rsession, path, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Cannot mask recording session!\n"); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 079487f9e7..d755640c35 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -3317,6 +3317,16 @@ SWITCH_STANDARD_APP(record_session_unmask_function) switch_ivr_record_session_mask(session, (char *) data, SWITCH_FALSE); } +SWITCH_STANDARD_APP(record_session_pause_function) +{ + switch_ivr_record_session_pause(session, (char *) data, SWITCH_TRUE); +} + +SWITCH_STANDARD_APP(record_session_resume_function) +{ + switch_ivr_record_session_pause(session, (char *) data, SWITCH_FALSE); +} + SWITCH_STANDARD_APP(record_session_function) { char *array[5] = {0}; @@ -6679,7 +6689,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE); SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path> [+<timeout>]", SAF_MEDIA_TAP); SWITCH_ADD_APP(app_interface, "record_session_mask", "Mask audio in recording", SESS_REC_MASK_DESC, record_session_mask_function, "<path>", SAF_MEDIA_TAP); - SWITCH_ADD_APP(app_interface, "record_session_unmask", "Resume recording", SESS_REC_UNMASK_DESC, record_session_unmask_function, "<path>", SAF_MEDIA_TAP); + SWITCH_ADD_APP(app_interface, "record_session_unmask", "Stop masking audio in recording", SESS_REC_UNMASK_DESC, record_session_unmask_function, "<path>", SAF_MEDIA_TAP); + SWITCH_ADD_APP(app_interface, "record_session_pause", "Pause recording", "Temporarily pause writing call recording audio to file", record_session_pause_function, "<path>", SAF_MEDIA_TAP); + SWITCH_ADD_APP(app_interface, "record_session_resume", "Resume paused recording", "Resume writing call recording audio to file", record_session_resume_function, "<path>", SAF_MEDIA_TAP); SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function, "<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]", SAF_NONE); SWITCH_ADD_APP(app_interface, "preprocess", "pre-process", "pre-process", preprocess_session_function, "", SAF_NONE); diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 1d5ff7510b..13054b5b08 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -242,7 +242,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi for (bp = session->bugs; bp; bp = bp->next) { ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } @@ -303,7 +303,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi for (bp = session->bugs; bp; bp = bp->next) { ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } @@ -652,7 +652,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi for (bp = session->bugs; bp; bp = bp->next) { ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } @@ -703,7 +703,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi for (bp = session->bugs; bp; bp = bp->next) { ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } @@ -883,7 +883,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi for (bp = session->bugs; bp; bp = bp->next) { ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 5c4e19ad49..0db5a7c95d 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -7224,7 +7224,7 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram for (bp = session->bugs; bp; bp = bp->next) { ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } @@ -14871,7 +14871,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor for (bp = session->bugs; bp; bp = bp->next) { switch_bool_t ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } @@ -15252,7 +15252,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core for (bp = session->bugs; bp; bp = bp->next) { switch_bool_t ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } @@ -15516,7 +15516,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_ for (bp = session->bugs; bp; bp = bp->next) { switch_bool_t ok = SWITCH_TRUE; - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } @@ -16199,7 +16199,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess continue; } - if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) { continue; } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 953d49ed7d..bcf5f17499 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1869,6 +1869,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_mask(switch_core_sessi return SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_pause(switch_core_session_t *session, const char *file, switch_bool_t on) +{ + switch_media_bug_t *bug; + switch_channel_t *channel = switch_core_session_get_channel(session); + + if ((bug = switch_channel_get_private(channel, file))) { + if (on) { + switch_core_media_bug_set_flag(bug, SMBF_PAUSE); + } else { + switch_core_media_bug_clear_flag(bug, SMBF_PAUSE); + } + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_session_t *session, const char *file) { switch_media_bug_t *bug; diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore index b3689b97ab..a9c5b8eb8f 100644 --- a/tests/unit/.gitignore +++ b/tests/unit/.gitignore @@ -17,9 +17,12 @@ switch_core switch_core_codec switch_core_db switch_core_file +switch_core_session switch_core_video +switch_eavesdrop switch_event switch_hash +switch_ivr_async switch_ivr_originate switch_ivr_play_say switch_packetizer @@ -37,7 +40,9 @@ switch_vpx switch_xml switch_estimators switch_jitter_buffer +test_sofia .deps/ Makefile conf/*/ conf_playsay/*/ +conf_async/*/ diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 10660c7dbd..9d57dbe589 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ switch_ivr_play_say switch_core_codec switch_rtp switch_xml -noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_packetizer test_sofia switch_core_asr switch_core_session +noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_packetizer test_sofia switch_ivr_async switch_core_asr switch_core_session 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_async/freeswitch.xml b/tests/unit/conf_async/freeswitch.xml new file mode 100644 index 0000000000..3e870470ea --- /dev/null +++ b/tests/unit/conf_async/freeswitch.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<document type="freeswitch/xml"> + <X-PRE-PROCESS cmd="exec-set" data="test=echo 1234"/> + <X-PRE-PROCESS cmd="set" data="default_password=$${test}"/> + <section name="configuration" description="Various Configuration"> + <configuration name="modules.conf" description="Modules"> + <modules> + <load module="mod_console"/> + <load module="mod_loopback"/> + <load module="mod_opus"/> + <load module="mod_commands"/> + <load module="mod_sndfile"/> + <load module="mod_dptools"/> + <load module="mod_tone_stream"/> + <load module="mod_test"/> + </modules> + </configuration> + + <configuration name="console.conf" description="Console Logger"> + <mappings> + <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/> + </mappings> + <settings> + <param name="colorize" value="true"/> + <param name="loglevel" value="debug"/> + </settings> + </configuration> + + <configuration name="timezones.conf" description="Timezones"> + <timezones> + <zone name="GMT" value="GMT0" /> + </timezones> + </configuration> + + <X-PRE-PROCESS cmd="include" data="vpx.conf.xml"/> + </section> + + <section name="dialplan" description="Regex/XML Dialplan"> + <context name="default"> + <extension name="sample"> + <condition> + <action application="info"/> + </condition> + </extension> + </context> + </section> +</document> diff --git a/tests/unit/switch_ivr_async.c b/tests/unit/switch_ivr_async.c new file mode 100644 index 0000000000..3cf8a8a52e --- /dev/null +++ b/tests/unit/switch_ivr_async.c @@ -0,0 +1,124 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Chris Rienzo <chris@signalwire.com> + * + * + * switch_ivr_async.c -- Async IVR tests + * + */ +#include <switch.h> +#include <stdlib.h> + +#include <test/switch_test.h> + +static switch_status_t partial_play_and_collect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *data, __attribute__((unused))unsigned int len) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + int *count = (int *)data; + + if (input_type == SWITCH_INPUT_TYPE_EVENT) { + switch_event_t *event = (switch_event_t *)input; + + if (event->event_id == SWITCH_EVENT_DETECTED_SPEECH) { + const char *speech_type = switch_event_get_header(event, "Speech-Type"); + + if (zstr(speech_type) || strcmp(speech_type, "detected-partial-speech")) { + return status; + } + + (*count)++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "partial events count: %d\n", *count); + + char *body = switch_event_get_body(event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "body=[%s]\n", body); + } + } else if (input_type == SWITCH_INPUT_TYPE_DTMF) { + // never mind + } + + return status; +} + +FST_CORE_BEGIN("./conf_async") +{ + FST_SUITE_BEGIN(switch_ivr_play_async) + { + FST_SETUP_BEGIN() + { + fst_requires_module("mod_tone_stream"); + fst_requires_module("mod_sndfile"); + fst_requires_module("mod_dptools"); + fst_requires_module("mod_test"); + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_SESSION_BEGIN(session_record_pause) + { + const char *record_filename = switch_core_session_sprintf(fst_session, "%s%s%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(fst_session)); + + switch_status_t status; + status = switch_ivr_record_session_event(fst_session, record_filename, 0, NULL, NULL); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session() to return SWITCH_STATUS_SUCCESS"); + + status = switch_ivr_play_file(fst_session, NULL, "tone_stream://%(400,200,400,450);%(400,2000,400,450)", NULL); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_play_file() to return SWITCH_STATUS_SUCCESS"); + + status = switch_ivr_record_session_pause(fst_session, record_filename, SWITCH_TRUE); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session_pause(SWITCH_TRUE) to return SWITCH_STATUS_SUCCESS"); + + switch_ivr_play_file(fst_session, NULL, "silence_stream://1000,0", NULL); + + status = switch_ivr_record_session_pause(fst_session, record_filename, SWITCH_FALSE); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session_pause(SWITCH_FALSE) to return SWITCH_STATUS_SUCCESS"); + + status = switch_ivr_play_file(fst_session, NULL, "tone_stream://%(400,200,400,450)", NULL); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_play_file() to return SWITCH_STATUS_SUCCESS"); + + status = switch_ivr_stop_record_session(fst_session, record_filename); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_stop_record_session() to return SWITCH_STATUS_SUCCESS"); + + switch_ivr_play_file(fst_session, NULL, "silence_stream://100,0", NULL); + + fst_xcheck(switch_file_exists(record_filename, fst_pool) == SWITCH_STATUS_SUCCESS, "Expect recording file to exist"); + + unlink(record_filename); + + const char *duration_ms_str = switch_channel_get_variable(fst_channel, "record_ms"); + fst_requires(duration_ms_str != NULL); + int duration_ms = atoi(duration_ms_str); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_NOTICE, "Recording duration is %s ms\n", duration_ms_str); + fst_xcheck(duration_ms > 3500 && duration_ms < 3700, "Expect recording to be between 3500 and 3700 ms"); + } + FST_SESSION_END() + } + FST_SUITE_END() +} +FST_CORE_END() + From 90db5a903269064e731b8adb0af0297f88243dac Mon Sep 17 00:00:00 2001 From: Seven Du <seven@signalwire.com> Date: Wed, 16 Dec 2020 22:55:12 +0800 Subject: [PATCH 355/655] [mod_loopback] Add video support to null endpoint * [mod_loopback] add video support to null channel * [core test] add video session support * [core] add video channel test case --- src/include/test/switch_test.h | 8 +- src/mod/endpoints/mod_loopback/mod_loopback.c | 141 +++++++++++++++++- tests/unit/switch_ivr_originate.c | 22 +++ 3 files changed, 166 insertions(+), 5 deletions(-) diff --git a/src/include/test/switch_test.h b/src/include/test/switch_test.h index 3413884145..936c709bb1 100644 --- a/src/include/test/switch_test.h +++ b/src/include/test/switch_test.h @@ -484,9 +484,10 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char * * @param name the name of this test * @param rate the rate of the channel + * @param video_codec the rate of the channel */ -#define FST_SESSION_BEGIN_RATE(name, rate) \ +#define FST_SESSION_BEGIN_RATE_VIDEO(name, rate, video_codec) \ FCT_TEST_BGN(name) \ { \ if (fst_core) { \ @@ -513,7 +514,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char fst_requires(switch_event_create_plain(&fst_originate_vars, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS); \ switch_event_add_header_string(fst_originate_vars, SWITCH_STACK_BOTTOM, "origination_caller_id_number", "+15551112222"); \ switch_event_add_header(fst_originate_vars, SWITCH_STACK_BOTTOM, "rate", "%d", rate); \ - if (switch_ivr_originate(NULL, &fst_session, &fst_cause, "null/+15553334444", 2, NULL, NULL, NULL, NULL, fst_originate_vars, SOF_NONE, NULL, NULL) == SWITCH_STATUS_SUCCESS && fst_session) { \ + if (switch_ivr_originate(NULL, &fst_session, &fst_cause, "{null_video_codec=" video_codec "}null/+15553334444", 2, NULL, NULL, NULL, NULL, fst_originate_vars, SOF_NONE, NULL, NULL) == SWITCH_STATUS_SUCCESS && fst_session) { \ switch_memory_pool_t *fst_session_pool = switch_core_session_get_pool(fst_session); \ switch_channel_t *fst_channel = switch_core_session_get_channel(fst_session); \ switch_channel_set_state(fst_channel, CS_SOFT_EXECUTE); \ @@ -525,10 +526,11 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char /** * Define a session test in a test suite. This can be used to test IVR functions. - * See FST_SESSION_BEGIN_RATE + * See FST_SESSION_BEGIN_RATE_VIDEO */ #define FST_SESSION_BEGIN(name) FST_SESSION_BEGIN_RATE(name, 8000) +#define FST_SESSION_BEGIN_RATE(name, rate) FST_SESSION_BEGIN_RATE_VIDEO(name, rate, "") /* BODY OF TEST CASE HERE */ diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 6fa0d4fbd4..456936562a 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -25,6 +25,7 @@ * * Anthony Minessale II <anthm@freeswitch.org> * Emmanuel Schmidbauer <e.schmidbauer@gmail.com> + * Seven Du <dujinfang@gmail.com> * * * mod_loopback.c -- Loopback Endpoint Module @@ -1302,6 +1303,9 @@ struct null_private_object { switch_codec_t read_codec; switch_codec_t write_codec; switch_timer_t timer; + switch_codec_t video_read_codec; + switch_codec_t video_write_codec; + switch_timer_t video_timer; switch_caller_profile_t *caller_profile; switch_frame_t read_frame; int16_t *null_buf; @@ -1312,6 +1316,12 @@ struct null_private_object { int enable_auto_answer; /* auto_answer_delay (0 ms by default) */ int auto_answer_delay; + char *video_codec_name; + switch_frame_t video_read_frame; + uint8_t video_data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_image_t *img; + switch_media_handle_t *media_handle; + switch_core_media_params_t mparams; }; typedef struct null_private_object null_private_t; @@ -1324,9 +1334,31 @@ static switch_call_cause_t null_channel_outgoing_channel(switch_core_session_t * switch_call_cause_t *cancel_cause); static switch_status_t null_channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); static switch_status_t null_channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); +static switch_status_t null_channel_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); +static switch_status_t null_channel_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); static switch_status_t null_channel_kill_channel(switch_core_session_t *session, int sig); +static void set_mparams(null_private_t *tech_pvt) +{ + switch_core_media_params_t *mparams = &tech_pvt->mparams; + mparams->inbound_codec_string = "L16"; + mparams->outbound_codec_string = "L16"; + mparams->timer_name = "soft"; + mparams->extsipip = "10.0.0.1"; + mparams->extrtpip = "10.0.0.2"; + mparams->local_network = "127.0.0.1"; + mparams->sipip = "127.0.0.1"; + mparams->rtpip = "127.0.0.1"; + mparams->jb_msec = "60"; + mparams->rtcp_audio_interval_msec = "5000"; + mparams->rtcp_video_interval_msec = "5000"; + mparams->sdp_username = "FreeSWITCH"; + mparams->cng_pt = 13; + mparams->rtp_timeout_sec = 300; + mparams->rtp_hold_timeout_sec = 3600; + mparams->external_video_source = 1; +} static switch_status_t null_tech_init(null_private_t *tech_pvt, switch_core_session_t *session) { @@ -1364,6 +1396,43 @@ static switch_status_t null_tech_init(null_private_t *tech_pvt, switch_core_sess switch_core_session_set_read_codec(session, &tech_pvt->read_codec); switch_core_session_set_write_codec(session, &tech_pvt->write_codec); + if (!zstr(tech_pvt->video_codec_name)) { + status = switch_core_codec_init(&tech_pvt->video_read_codec, + tech_pvt->video_codec_name, + NULL, + NULL, + 90000, 0, 0, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)); + + if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->video_read_codec.implementation || !switch_core_codec_ready(&tech_pvt->video_read_codec)) { + goto end; + } + + status = switch_core_codec_init(&tech_pvt->video_write_codec, + tech_pvt->video_codec_name, + NULL, + NULL, + 90000, 0, 0, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)); + + + if (status != SWITCH_STATUS_SUCCESS) { + switch_core_codec_destroy(&tech_pvt->video_read_codec); + goto end; + } + + switch_channel_set_flag(switch_core_session_get_channel(session), CF_VIDEO); + switch_core_session_set_video_read_codec(session, &tech_pvt->read_codec); + switch_core_session_set_video_write_codec(session, &tech_pvt->write_codec); + switch_core_timer_init(&tech_pvt->video_timer, "soft", 100, 900, switch_core_session_get_pool(session)); + set_mparams(tech_pvt); + switch_media_handle_create(&tech_pvt->media_handle, session, &tech_pvt->mparams); + // switch_core_media_prepare_codecs(session, SWITCH_TRUE); + // switch_core_media_check_video_codecs(session); + // switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_AUDIO, 0); + // switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_VIDEO, 0); + // switch_core_media_gen_local_sdp(session, SDP_TYPE_REQUEST, "127.0.0.1", 2000, NULL, 0); + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", mparams.local_sdp_str); + } + read_impl = tech_pvt->read_codec.implementation; switch_core_timer_init(&tech_pvt->timer, "soft", @@ -1419,8 +1488,20 @@ static switch_status_t null_channel_on_destroy(switch_core_session_t *session) if (switch_core_codec_ready(&tech_pvt->write_codec)) { switch_core_codec_destroy(&tech_pvt->write_codec); } + + if (switch_core_codec_ready(&tech_pvt->video_read_codec)) { + switch_core_codec_destroy(&tech_pvt->video_read_codec); + } + + if (switch_core_codec_ready(&tech_pvt->video_write_codec)) { + switch_core_codec_destroy(&tech_pvt->video_write_codec); + } + + switch_img_free(&tech_pvt->img); } + switch_media_handle_destroy(session); + return SWITCH_STATUS_SUCCESS; } @@ -1558,6 +1639,50 @@ static switch_status_t null_channel_write_frame(switch_core_session_t *session, return SWITCH_STATUS_SUCCESS; } +static switch_status_t null_channel_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) +{ + switch_channel_t *channel = NULL; + null_private_t *tech_pvt = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + + channel = switch_core_session_get_channel(session); + switch_assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + switch_assert(tech_pvt != NULL); + + *frame = NULL; + + if (!switch_channel_ready(channel)) { + return SWITCH_STATUS_FALSE; + } + + switch_core_timer_next(&tech_pvt->video_timer); + + tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec; + tech_pvt->video_read_frame.datalen = 0; + tech_pvt->video_read_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + tech_pvt->video_read_frame.samples = 0; + tech_pvt->video_read_frame.data = tech_pvt->video_data; + if (!tech_pvt->img) { + tech_pvt->img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 0); + } + tech_pvt->video_read_frame.img = tech_pvt->img; + *frame = &tech_pvt->video_read_frame; + + if (*frame) { + status = SWITCH_STATUS_SUCCESS; + } else { + status = SWITCH_STATUS_FALSE; + } + + return status; +} +static switch_status_t null_channel_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) +{ + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t null_channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) { switch_channel_t *channel; @@ -1638,6 +1763,7 @@ static switch_call_cause_t null_channel_outgoing_channel(switch_core_session_t * if ((tech_pvt = (null_private_t *) switch_core_session_alloc(*new_session, sizeof(null_private_t))) != 0) { const char *rate_ = switch_event_get_header(var_event, "rate"); + const char *video_codec = switch_event_get_header(var_event, "null_video_codec"); int rate = 0; if (rate_) { @@ -1649,9 +1775,12 @@ static switch_call_cause_t null_channel_outgoing_channel(switch_core_session_t * } tech_pvt->rate = rate; - tech_pvt->pre_answer = switch_true(pre_answer); + if (video_codec) { + tech_pvt->video_codec_name = switch_core_session_strdup(*new_session, video_codec); + } + if (!enable_auto_answer) { /* if not set - enabled by default */ tech_pvt->enable_auto_answer = SWITCH_TRUE; @@ -1733,7 +1862,15 @@ static switch_io_routines_t null_channel_io_routines = { /*.write_frame */ null_channel_write_frame, /*.kill_channel */ null_channel_kill_channel, /*.send_dtmf */ null_channel_send_dtmf, - /*.receive_message */ null_channel_receive_message + /*.receive_message */ null_channel_receive_message, + /*.receive_event */ NULL, + /*.state_change */ NULL, + /*.read_video_frame */ null_channel_read_video_frame, + /*.write_video_frame */ null_channel_write_video_frame, + /*.read_text_frame */ NULL, + /*.write_text_frame */ NULL, + /*.state_run*/ NULL, + /*.get_jb*/ NULL }; switch_status_t load_loopback_configuration(switch_bool_t reload) diff --git a/tests/unit/switch_ivr_originate.c b/tests/unit/switch_ivr_originate.c index b6ffe7cf51..4cf9695275 100644 --- a/tests/unit/switch_ivr_originate.c +++ b/tests/unit/switch_ivr_originate.c @@ -763,6 +763,28 @@ FST_CORE_BEGIN("./conf") } FST_TEST_END() + FST_TEST_BEGIN(originate_test_video) + { + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_call_cause_t cause; + + status = switch_ivr_originate(NULL, &session, &cause, "{null_video_codec=VP8}null/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session); + fst_check(status == SWITCH_STATUS_SUCCESS); + + channel = switch_core_session_get_channel(session); + fst_requires(channel); + fst_check(switch_channel_test_flag(channel, CF_VIDEO)); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + fst_check(!switch_channel_ready(channel)); + + switch_core_session_rwunlock(session); + switch_sleep(1000000); + } + FST_TEST_END() + FST_TEST_BEGIN(enterprise_originate_test_group_confirm_two_handles) { switch_core_session_t *session = NULL; From a7fa9bfedc127547c7eaa5645a73cc5796a4ea39 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 16 Dec 2020 04:10:45 +0400 Subject: [PATCH 356/655] [Core] Prevent write after free into heap when calling switch_core_destroy_memory_pool() --- src/switch_core_memory.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index 86b54ce02e..3685956257 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -465,38 +465,42 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m { char *tmp; const char *tag; + switch_memory_pool_t *tmp_pool = NULL; switch_assert(pool != NULL); /* In tag we store who calls the pool creation. Now we append it with who calls the pool destroy. */ if (*pool) { - tag = apr_pool_tag(*pool, NULL); - tmp = switch_core_sprintf(*pool, "%s,%s:%d", (tag ? tag : ""), file, line); - apr_pool_tag(*pool, tmp); + tmp_pool = *pool; + *pool = NULL; + + tag = apr_pool_tag(tmp_pool, NULL); + tmp = switch_core_sprintf(tmp_pool, "%s,%s:%d", (tag ? tag : ""), file, line); + apr_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 *) *pool, apr_pool_tag(*pool, NULL)); + 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)); #endif #ifdef INSTANTLY_DESTROY_POOLS #ifdef USE_MEM_LOCK switch_mutex_lock(memory_manager.mem_lock); #endif - apr_pool_destroy(*pool); + apr_pool_destroy(tmp_pool); #ifdef USE_MEM_LOCK switch_mutex_unlock(memory_manager.mem_lock); #endif #else - if ((memory_manager.pool_thread_running != 1) || (switch_queue_push(memory_manager.pool_queue, *pool) != SWITCH_STATUS_SUCCESS)) { + if ((memory_manager.pool_thread_running != 1) || (switch_queue_push(memory_manager.pool_queue, tmp_pool) != SWITCH_STATUS_SUCCESS)) { #ifdef USE_MEM_LOCK switch_mutex_lock(memory_manager.mem_lock); #endif #if APR_POOL_DEBUG - apr_pool_destroy_debug(*pool, func); + apr_pool_destroy_debug(tmp_pool, func); #else - apr_pool_destroy(*pool); + apr_pool_destroy(tmp_pool); #endif #ifdef USE_MEM_LOCK switch_mutex_unlock(memory_manager.mem_lock); @@ -504,8 +508,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m } #endif - *pool = NULL; - return SWITCH_STATUS_SUCCESS; } From 60faf1a1b195b8f9d42eba2c88f220e52eff02df Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 22 Dec 2020 15:32:48 -0500 Subject: [PATCH 357/655] [core] Update switch_ivr_record_session_event() to check event vars for RECORD_STEREO, etc --- src/include/switch_channel.h | 1 + src/include/test/switch_test.h | 1 + src/switch_channel.c | 15 ++-- src/switch_ivr_async.c | 159 +++++++++++++++++++++------------ tests/unit/switch_ivr_async.c | 39 ++++++++ 5 files changed, 153 insertions(+), 62 deletions(-) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 965575e783..5ee73c41fa 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -685,6 +685,7 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_ /** @} */ SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix); +SWITCH_DECLARE(switch_status_t) switch_channel_execute_on_value(switch_channel_t *channel, const char *variable_value); SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel, const char *variable_prefix); SWITCH_DECLARE(void) switch_channel_process_device_hangup(switch_channel_t *channel); SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_queued_extension(switch_channel_t *channel); diff --git a/src/include/test/switch_test.h b/src/include/test/switch_test.h index 936c709bb1..7839a6c736 100644 --- a/src/include/test/switch_test.h +++ b/src/include/test/switch_test.h @@ -522,6 +522,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char switch_channel_set_variable(fst_channel, "send_silence_when_idle", "-1"); \ switch_channel_set_variable(fst_channel, "RECORD_STEREO", "true"); \ switch_ivr_record_session(fst_session, (char *)"/tmp/"#name".wav", 0, NULL); \ + switch_channel_set_variable(fst_channel, "RECORD_STEREO", NULL); \ for(;;) { /** diff --git a/src/switch_channel.c b/src/switch_channel.c index baca416c9e..9a57466042 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3759,15 +3759,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel, return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } -static void do_execute_on(switch_channel_t *channel, const char *variable) +SWITCH_DECLARE(switch_status_t) switch_channel_execute_on_value(switch_channel_t *channel, const char *variable_value) { + switch_status_t status; char *arg = NULL; char *p; int bg = 0; char *app; char *expanded = NULL; - app = switch_core_session_strdup(channel->session, variable); + app = switch_core_session_strdup(channel->session, variable_value); for(p = app; p && *p; p++) { if (*p == ' ' || (*p == ':' && (*(p+1) != ':'))) { @@ -3792,14 +3793,16 @@ static void do_execute_on(switch_channel_t *channel, const char *variable) } if (bg) { - switch_core_session_execute_application_async(channel->session, app, arg); + status = switch_core_session_execute_application_async(channel->session, app, arg); } else { - switch_core_session_execute_application(channel->session, app, arg); + status = switch_core_session_execute_application(channel->session, app, arg); } if (expanded && expanded != arg) { free(expanded); } + + return status; } SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix) @@ -3821,11 +3824,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *chan int i; for (i = 0; i < hp->idx; i++) { x++; - do_execute_on(channel, hp->array[i]); + switch_channel_execute_on_value(channel, hp->array[i]); } } else { x++; - do_execute_on(channel, val); + switch_channel_execute_on_value(channel, val); } } } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index bcf5f17499..82e62cf90f 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -86,6 +86,8 @@ struct switch_ivr_dmachine { uint8_t pinging; }; +static const char *get_recording_var(switch_channel_t *channel, switch_event_t *vars, const char *name); +static int recording_var_true(switch_channel_t *channel, switch_event_t *vars, const char *name); static switch_status_t speech_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_last_ping(switch_ivr_dmachine_t *dmachine) @@ -1222,7 +1224,6 @@ static void send_record_stop_event(switch_channel_t *channel, switch_codec_imple { switch_event_t *event; - rh->start_event_sent = 0; if (rh->fh) { switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); if (read_impl->actual_samples_per_second) { @@ -1243,8 +1244,21 @@ static void send_record_stop_event(switch_channel_t *channel, switch_codec_imple switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-Completion-Cause", rh->completion_cause); } switch_event_fire(&event); - switch_event_safe_destroy(rh->variables); } + + if (rh->start_event_sent) { + if (rh->variables) { + const char *exec_app = NULL; + exec_app = switch_event_get_header(rh->variables, "execute_on_record_stop"); + if (exec_app) { + switch_channel_execute_on_value(channel, exec_app); + } + } + switch_channel_execute_on(channel, "execute_on_record_stop"); + switch_channel_api_on(channel, "api_on_record_stop"); + } + + rh->start_event_sent = 0; } static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *obj) @@ -1338,6 +1352,40 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void * return NULL; } +static void record_helper_post_process(struct record_helper *rh, switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *var = NULL; + const char *post_process_exec = NULL; + if (rh->variables && (post_process_exec = switch_event_get_header(rh->variables, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE))) { + switch_channel_execute_on_value(channel, post_process_exec); + } + switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE); + + if ((var = switch_channel_get_variable(channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE))) { + char *cmd = switch_core_session_strdup(session, var); + char *data, *expanded = NULL; + switch_stream_handle_t stream = { 0 }; + + SWITCH_STANDARD_STREAM(stream); + + if ((data = strchr(cmd, ':'))) { + *data++ = '\0'; + expanded = switch_channel_expand_variables(channel, data); + } + + switch_api_execute(cmd, expanded, session, &stream); + + if (expanded && expanded != data) { + free(expanded); + } + + switch_safe_free(stream.data); + + } + +} + static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { switch_core_session_t *session = switch_core_media_bug_get_session(bug); @@ -1357,7 +1405,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch (type) { case SWITCH_ABC_TYPE_INIT: { - const char *var = switch_channel_get_variable(channel, "RECORD_USE_THREAD"); + const char *var = get_recording_var(channel, rh->variables, "RECORD_USE_THREAD"); switch_core_session_get_read_impl(session, &rh->read_impl); @@ -1435,6 +1483,15 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s merge_recording_variables(rh, event); switch_event_fire(&event); } + if (rh->variables) { + const char *exec_app = NULL; + exec_app = switch_event_get_header(rh->variables, "execute_on_record_start"); + if (exec_app) { + switch_channel_execute_on_value(channel, exec_app); + } + } + switch_channel_execute_on(channel, "execute_on_record_start"); + switch_channel_api_on(channel, "api_on_record_start"); } rh->silence_time = switch_micro_time_now(); @@ -1533,8 +1590,6 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s break; case SWITCH_ABC_TYPE_CLOSE: { - const char *var; - switch_codec_implementation_t read_impl = { 0 }; switch_core_session_get_read_impl(session, &read_impl); @@ -1635,31 +1690,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s } send_record_stop_event(channel, &read_impl, rh); - - switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE); - - if ((var = switch_channel_get_variable(channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE))) { - char *cmd = switch_core_session_strdup(session, var); - char *data, *expanded = NULL; - switch_stream_handle_t stream = { 0 }; - - SWITCH_STANDARD_STREAM(stream); - - if ((data = strchr(cmd, ':'))) { - *data++ = '\0'; - expanded = switch_channel_expand_variables(channel, data); - } - - switch_api_execute(cmd, expanded, session, &stream); - - if (expanded && expanded != data) { - free(expanded); - } - - switch_safe_free(stream.data); - - } - + record_helper_post_process(rh, session); record_helper_destroy(&rh, session); } @@ -2868,6 +2899,8 @@ static switch_status_t record_helper_destroy(struct record_helper **rh, switch_c switch_core_file_close((*rh)->fh); } + switch_event_safe_destroy((*rh)->variables); + pool = (*rh)->helper_pool; switch_core_destroy_memory_pool(&pool); *rh = NULL; @@ -2875,6 +2908,20 @@ static switch_status_t record_helper_destroy(struct record_helper **rh, switch_c return SWITCH_STATUS_SUCCESS; } +static const char *get_recording_var(switch_channel_t *channel, switch_event_t *vars, const char *name) +{ + const char *val = NULL; + if (vars && !(val = switch_event_get_header(vars, name))) { + val = switch_channel_get_variable(channel, name); + } + return val; +} + +static int recording_var_true(switch_channel_t *channel, switch_event_t *vars, const char *name) +{ + return switch_true(get_recording_var(channel, vars, name)); +} + SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_session_t *session, const char *file, uint32_t limit, switch_file_handle_t *fh, switch_event_t *vars) { switch_channel_t *channel = switch_core_session_get_channel(session); @@ -2893,7 +2940,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess char *ext; char *in_file = NULL, *out_file = NULL; - if ((p = switch_channel_get_variable(channel, "RECORD_HANGUP_ON_ERROR"))) { + if ((p = get_recording_var(channel, vars, "RECORD_HANGUP_ON_ERROR"))) { hangup_on_error = switch_true(p); } @@ -2910,7 +2957,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess channels = read_impl.number_of_channels; if ((bug = switch_channel_get_private(channel, file))) { - if (switch_channel_var_true(channel, "RECORD_TOGGLE_ON_REPEAT")) { + if (recording_var_true(channel, vars, "RECORD_TOGGLE_ON_REPEAT")) { return switch_ivr_stop_record_session(session, file); } @@ -2919,7 +2966,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess } - if (switch_channel_var_true(channel, "RECORD_CHECK_BRIDGE")) { + if (recording_var_true(channel, vars, "RECORD_CHECK_BRIDGE")) { switch_core_session_t *other_session; int exist = 0; switch_status_t rstatus = SWITCH_STATUS_SUCCESS; @@ -2960,44 +3007,44 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess } } - if (switch_channel_var_true(channel, "RECORD_WRITE_ONLY")) { + if (recording_var_true(channel, vars, "RECORD_WRITE_ONLY")) { flags &= ~SMBF_READ_STREAM; flags |= SMBF_WRITE_STREAM; } - if (switch_channel_var_true(channel, "RECORD_READ_ONLY")) { + if (recording_var_true(channel, vars, "RECORD_READ_ONLY")) { flags &= ~SMBF_WRITE_STREAM; flags |= SMBF_READ_STREAM; } if (channels == 1) { /* if leg is already stereo this feature is not available */ - if (switch_channel_var_true(channel, "RECORD_STEREO")) { + if (recording_var_true(channel, vars, "RECORD_STEREO")) { flags |= SMBF_STEREO; flags &= ~SMBF_STEREO_SWAP; channels = 2; } - if (switch_channel_var_true(channel, "RECORD_STEREO_SWAP")) { + if (recording_var_true(channel, vars, "RECORD_STEREO_SWAP")) { flags |= SMBF_STEREO; flags |= SMBF_STEREO_SWAP; channels = 2; } } - if (switch_channel_var_true(channel, "RECORD_ANSWER_REQ")) { + if (recording_var_true(channel, vars, "RECORD_ANSWER_REQ")) { flags |= SMBF_ANSWER_REQ; } - if (switch_channel_var_true(channel, "RECORD_BRIDGE_REQ")) { + if (recording_var_true(channel, vars, "RECORD_BRIDGE_REQ")) { flags |= SMBF_BRIDGE_REQ; } - if (switch_channel_var_true(channel, "RECORD_APPEND")) { + if (recording_var_true(channel, vars, "RECORD_APPEND")) { file_flags |= SWITCH_FILE_WRITE_APPEND; } fh->samplerate = 0; - if ((vval = switch_channel_get_variable(channel, "record_sample_rate"))) { + if ((vval = get_recording_var(channel, vars, "record_sample_rate"))) { int tmp = 0; tmp = atoi(vval); @@ -3013,7 +3060,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess fh->channels = channels; - if ((vval = switch_channel_get_variable(channel, "enable_file_write_buffering"))) { + if ((vval = get_recording_var(channel, vars, "enable_file_write_buffering"))) { int tmp = atoi(vval); if (tmp > 0) { @@ -3031,7 +3078,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess char *e; const char *prefix; - prefix = switch_channel_get_variable(channel, "sound_prefix"); + prefix = get_recording_var(channel, vars, "sound_prefix"); if (!prefix) { prefix = SWITCH_GLOBAL_dirs.base_dir; @@ -3109,10 +3156,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess //switch_core_media_set_video_file(session, fh, SWITCH_RW_READ); //switch_channel_set_flag_recursive(session->channel, CF_VIDEO_DECODED_READ); - if (switch_channel_var_true(channel, "record_concat_video")) { + if (recording_var_true(channel, vars, "record_concat_video")) { flags |= SMBF_READ_VIDEO_STREAM; flags |= SMBF_WRITE_VIDEO_STREAM; - } else if (switch_channel_var_true(channel, "record_bleg_video")) { + } else if (recording_var_true(channel, vars, "record_bleg_video")) { flags |= SMBF_WRITE_VIDEO_STREAM; } else { flags |= SMBF_READ_VIDEO_STREAM; @@ -3168,37 +3215,37 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess flags = tflags; } - if ((p = switch_channel_get_variable(channel, "RECORD_TITLE"))) { + if ((p = get_recording_var(channel, vars, "RECORD_TITLE"))) { vval = (const char *) switch_core_strdup(rh->helper_pool, p); if (fh) switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_TITLE, vval); switch_channel_set_variable(channel, "RECORD_TITLE", NULL); } - if ((p = switch_channel_get_variable(channel, "RECORD_COPYRIGHT"))) { + if ((p = get_recording_var(channel, vars, "RECORD_COPYRIGHT"))) { vval = (const char *) switch_core_strdup(rh->helper_pool, p); if (fh) switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, vval); switch_channel_set_variable(channel, "RECORD_COPYRIGHT", NULL); } - if ((p = switch_channel_get_variable(channel, "RECORD_SOFTWARE"))) { + if ((p = get_recording_var(channel, vars, "RECORD_SOFTWARE"))) { vval = (const char *) switch_core_strdup(rh->helper_pool, p); if (fh) switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, vval); switch_channel_set_variable(channel, "RECORD_SOFTWARE", NULL); } - if ((p = switch_channel_get_variable(channel, "RECORD_ARTIST"))) { + if ((p = get_recording_var(channel, vars, "RECORD_ARTIST"))) { vval = (const char *) switch_core_strdup(rh->helper_pool, p); if (fh) switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, vval); switch_channel_set_variable(channel, "RECORD_ARTIST", NULL); } - if ((p = switch_channel_get_variable(channel, "RECORD_COMMENT"))) { + if ((p = get_recording_var(channel, vars, "RECORD_COMMENT"))) { vval = (const char *) switch_core_strdup(rh->helper_pool, p); if (fh) switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, vval); switch_channel_set_variable(channel, "RECORD_COMMENT", NULL); } - if ((p = switch_channel_get_variable(channel, "RECORD_DATE"))) { + if ((p = get_recording_var(channel, vars, "RECORD_DATE"))) { vval = (const char *) switch_core_strdup(rh->helper_pool, p); if (fh) switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_DATE, vval); switch_channel_set_variable(channel, "RECORD_DATE", NULL); @@ -3216,14 +3263,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess rh->min_sec = 3; } - if ((p = switch_channel_get_variable(channel, "RECORD_MIN_SEC"))) { + if ((p = get_recording_var(channel, vars, "RECORD_MIN_SEC"))) { int tmp = atoi(p); if (tmp >= 0) { rh->min_sec = tmp; } } - if ((p = switch_channel_get_variable(channel, "RECORD_INITIAL_TIMEOUT_MS"))) { + if ((p = get_recording_var(channel, vars, "RECORD_INITIAL_TIMEOUT_MS"))) { int tmp = atoi(p); if (tmp >= 0) { rh->initial_timeout_ms = tmp; @@ -3231,7 +3278,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess } } - if ((p = switch_channel_get_variable(channel, "RECORD_FINAL_TIMEOUT_MS"))) { + if ((p = get_recording_var(channel, vars, "RECORD_FINAL_TIMEOUT_MS"))) { int tmp = atoi(p); if (tmp >= 0) { rh->final_timeout_ms = tmp; @@ -3239,7 +3286,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess } } - if ((p = switch_channel_get_variable(channel, "RECORD_SILENCE_THRESHOLD"))) { + if ((p = get_recording_var(channel, vars, "RECORD_SILENCE_THRESHOLD"))) { int tmp = atoi(p); if (tmp >= 0) { rh->silence_threshold = tmp; @@ -3262,7 +3309,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess switch_goto_status(status, err); } - if ((p = switch_channel_get_variable(channel, "RECORD_PRE_BUFFER_FRAMES"))) { + if ((p = get_recording_var(channel, vars, "RECORD_PRE_BUFFER_FRAMES"))) { int tmp = atoi(p); if (tmp > 0) { diff --git a/tests/unit/switch_ivr_async.c b/tests/unit/switch_ivr_async.c index 3cf8a8a52e..affd47587c 100644 --- a/tests/unit/switch_ivr_async.c +++ b/tests/unit/switch_ivr_async.c @@ -117,6 +117,45 @@ FST_CORE_BEGIN("./conf_async") fst_xcheck(duration_ms > 3500 && duration_ms < 3700, "Expect recording to be between 3500 and 3700 ms"); } FST_SESSION_END() + + FST_SESSION_BEGIN(session_record_event_vars) + { + const char *record_filename = switch_core_session_sprintf(fst_session, "%s%s%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(fst_session)); + switch_event_t *rec_vars = NULL; + switch_status_t status; + + switch_event_create_subclass(&rec_vars, SWITCH_EVENT_CLONE, SWITCH_EVENT_SUBCLASS_ANY); + fst_requires(rec_vars != NULL); + + // record READ stream only- should be complete silence which will trigger the initial timeout. + // Min seconds set to 2, which will cause the recording to be discarded. + // Expect the record_start_test_pass and record_stop_test_pass variables set to true + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "execute_on_record_start", "set record_start_test_pass=true"); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "execute_on_record_stop", "set record_stop_test_pass=true"); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE, "set record_post_process_test_pass=true"); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "RECORD_READ_ONLY", "true"); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "RECORD_INITIAL_TIMEOUT_MS", "500"); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "RECORD_MIN_SEC", "2"); + + status = switch_ivr_record_session_event(fst_session, record_filename, 0, NULL, rec_vars); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session() to return SWITCH_STATUS_SUCCESS"); + + status = switch_ivr_play_file(fst_session, NULL, "tone_stream://%(400,200,400,450);%(400,2000,400,450)", NULL); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_play_file() to return SWITCH_STATUS_SUCCESS"); + + status = switch_ivr_record_session_pause(fst_session, record_filename, SWITCH_TRUE); + fst_xcheck(status != SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session_pause(SWITCH_TRUE) not to return SWITCH_STATUS_SUCCESS because the recording has already stopped"); + + fst_xcheck(switch_file_exists(record_filename, fst_pool) != SWITCH_STATUS_SUCCESS, "Expect recording file not to exist since it was less than 2 seconds in duration"); + + fst_xcheck(switch_channel_var_true(fst_channel, "record_start_test_pass"), "Expect record_start_test_pass channel variable set to true"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_stop_test_pass"), "Expect record_stop_test_pass channel variable set to true"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_post_process_test_pass"), "Expect record_post_process_test_pass channel variable set to true"); + + unlink(record_filename); + switch_event_destroy(&rec_vars); + } + FST_SESSION_END() } FST_SUITE_END() } From 594963a3ca6ba6a5893cc384a436a7d87707bc24 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 22 Dec 2020 18:23:35 -0500 Subject: [PATCH 358/655] [core] Add switch_ivr_record_file_event() and handle execute_on_record_start/execute_on_record_stop --- src/include/switch_ivr.h | 14 +++- src/switch_ivr_async.c | 2 +- src/switch_ivr_play_say.c | 116 +++++++++++++++++++++++++------ tests/unit/switch_ivr_async.c | 34 +++++++++ tests/unit/switch_ivr_play_say.c | 115 +++++++++++++++++++++++++++++- 5 files changed, 255 insertions(+), 26 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 1e76848dc9..33fd297da8 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -438,7 +438,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(_In_ switch_core_session_t *session, _In_ switch_file_handle_t *fh, _In_z_ const char *file, _In_opt_ switch_input_args_t *args, _In_ uint32_t limit); - +/*! + \brief record a file from the session to a file + \param session the session to record from + \param fh file handle to use + \param file the path to the file + \param args arguements to pass for callbacks etc + \param limit max limit to record for (0 for infinite) + \param vars vars to add to RECORD_START and RECORD_STOP automatically prefixed with Recording-Variable- + \return SWITCH_STATUS_SUCCESS if all is well +*/ +SWITCH_DECLARE(switch_status_t) switch_ivr_record_file_event(_In_ switch_core_session_t *session, + _In_ switch_file_handle_t *fh, + _In_z_ const char *file, _In_opt_ switch_input_args_t *args, _In_ uint32_t limit, switch_event_t *vars); /*! \brief Play a sound and gather digits with the number of retries specified if the user doesn't give digits in the set time diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 82e62cf90f..95bdec7352 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2911,7 +2911,7 @@ static switch_status_t record_helper_destroy(struct record_helper **rh, switch_c static const char *get_recording_var(switch_channel_t *channel, switch_event_t *vars, const char *name) { const char *val = NULL; - if (vars && !(val = switch_event_get_header(vars, name))) { + if (!vars || !(val = switch_event_get_header(vars, name))) { val = switch_channel_get_variable(channel, name); } return val; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index a03ab9ab5f..49b5445b89 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -353,8 +353,46 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio return status; } -SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session, - switch_file_handle_t *fh, const char *file, switch_input_args_t *args, uint32_t limit) +static void merge_recording_variables(switch_event_t *vars, switch_event_t *event) +{ + switch_event_header_t *hi; + if (vars) { + for (hi = vars->headers; hi; hi = hi->next) { + char buf[1024]; + char *vvar = NULL, *vval = NULL; + + vvar = (char *) hi->name; + vval = (char *) hi->value; + + switch_assert(vvar && vval); + switch_snprintf(buf, sizeof(buf), "Recording-Variable-%s", vvar); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, vval); + } + } +} + +static const char *get_recording_var(switch_channel_t *channel, switch_event_t *vars, switch_file_handle_t *fh, const char *name) +{ + const char *val = NULL; + if (vars) { + val = switch_event_get_header(vars, name); + } + if (!val && fh && fh->params) { + val = switch_event_get_header(fh->params, name); + } + if (!val) { + val = switch_channel_get_variable(channel, name); + } + return val; +} + +static int recording_var_true(switch_channel_t *channel, switch_event_t *vars, switch_file_handle_t *fh, const char *name) +{ + return switch_true(get_recording_var(channel, vars, fh, name)); +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_record_file_event(switch_core_session_t *session, + switch_file_handle_t *fh, const char *file, switch_input_args_t *args, uint32_t limit, switch_event_t *vars) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_dtmf_t dtmf = { 0 }; @@ -394,7 +432,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se return SWITCH_STATUS_FALSE; } - prefix = switch_channel_get_variable(channel, "sound_prefix"); + prefix = get_recording_var(channel, vars, fh, "sound_prefix"); if (!prefix) { prefix = SWITCH_GLOBAL_dirs.sounds_dir; @@ -425,7 +463,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se } - if ((p = switch_channel_get_variable(channel, "record_sample_rate"))) { + if ((p = get_recording_var(channel, vars, fh, "record_sample_rate"))) { int tmp = 0; tmp = atoi(p); @@ -476,16 +514,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se } - vval = switch_channel_get_variable(channel, "enable_file_write_buffering"); + vval = get_recording_var(channel, vars, fh, "enable_file_write_buffering"); if (!vval || switch_true(vval)) { fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN; } - if (switch_test_flag(fh, SWITCH_FILE_WRITE_APPEND) || ((p = switch_channel_get_variable(channel, "RECORD_APPEND")) && switch_true(p))) { + if (switch_test_flag(fh, SWITCH_FILE_WRITE_APPEND) || recording_var_true(channel, vars, fh, "RECORD_APPEND")) { file_flags |= SWITCH_FILE_WRITE_APPEND; } - if (switch_test_flag(fh, SWITCH_FILE_WRITE_OVER) || ((p = switch_channel_get_variable(channel, "RECORD_WRITE_OVER")) && switch_true(p))) { + if (switch_test_flag(fh, SWITCH_FILE_WRITE_OVER) || recording_var_true(channel, vars, fh, "RECORD_WRITE_OVER")) { file_flags |= SWITCH_FILE_WRITE_OVER; } @@ -520,7 +558,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se } - if ((p = switch_channel_get_variable(channel, "record_fill_cng")) || (fh->params && (p = switch_event_get_header(fh->params, "record_fill_cng")))) { + if ((p = get_recording_var(channel, vars, fh, "record_fill_cng"))) { if (!strcasecmp(p, "true")) { fill_cng = 1400; } else { @@ -542,8 +580,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se } } - if ((p = switch_channel_get_variable(channel, "record_waste_resources")) || - (fh->params && (p = switch_event_get_header(fh->params, "record_waste_resources")))) { + if ((p = get_recording_var(channel, vars, fh, "record_waste_resources"))) { if (!strcasecmp(p, "true")) { waste_resources = 1400; @@ -581,9 +618,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se if (switch_core_file_has_video(fh, SWITCH_TRUE)) { switch_core_session_request_video_refresh(session); - if ((p = switch_channel_get_variable(channel, "record_play_video")) || - - (fh->params && (p = switch_event_get_header(fh->params, "record_play_video")))) { + if ((p = get_recording_var(channel, vars, fh, "record_play_video"))) { video_file = switch_core_session_strdup(session, p); @@ -626,39 +661,39 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se asis = 1; } - restart_limit_on_dtmf = switch_true(switch_channel_get_variable(channel, "record_restart_limit_on_dtmf")); + restart_limit_on_dtmf = recording_var_true(channel, vars, fh, "record_restart_limit_on_dtmf"); - if ((p = switch_channel_get_variable(channel, "record_title")) || (fh->params && (p = switch_event_get_header(fh->params, "record_title")))) { + if ((p = get_recording_var(channel, vars, fh, "record_title"))) { vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_TITLE, vval); switch_channel_set_variable(channel, "record_title", NULL); } - if ((p = switch_channel_get_variable(channel, "record_copyright")) || (fh->params && (p = switch_event_get_header(fh->params, "record_copyright")))) { + if ((p = get_recording_var(channel, vars, fh, "record_copyright"))) { vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, vval); switch_channel_set_variable(channel, "record_copyright", NULL); } - if ((p = switch_channel_get_variable(channel, "record_software")) || (fh->params && (p = switch_event_get_header(fh->params, "record_software")))) { + if ((p = get_recording_var(channel, vars, fh, "record_software"))) { vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, vval); switch_channel_set_variable(channel, "record_software", NULL); } - if ((p = switch_channel_get_variable(channel, "record_artist")) || (fh->params && (p = switch_event_get_header(fh->params, "record_artist")))) { + if ((p = get_recording_var(channel, vars, fh, "record_artist"))) { vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, vval); switch_channel_set_variable(channel, "record_artist", NULL); } - if ((p = switch_channel_get_variable(channel, "record_comment")) || (fh->params && (p = switch_event_get_header(fh->params, "record_comment")))) { + if ((p = get_recording_var(channel, vars, fh, "record_comment"))) { vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, vval); switch_channel_set_variable(channel, "record_comment", NULL); } - if ((p = switch_channel_get_variable(channel, "record_date")) || (fh->params && (p = switch_event_get_header(fh->params, "record_date")))) { + if ((p = get_recording_var(channel, vars, fh, "record_date"))) { vval = switch_core_session_strdup(session, p); switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_DATE, vval); switch_channel_set_variable(channel, "record_date", NULL); @@ -722,9 +757,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", file); + merge_recording_variables(vars, event); switch_event_fire(&event); } + { + const char *app_exec = NULL; + if (vars && (app_exec = switch_event_get_header(vars, "execute_on_record_start"))) { + switch_channel_execute_on_value(channel, app_exec); + } + switch_channel_execute_on(channel, "execute_on_record_start"); + switch_channel_api_on(channel, "api_on_record_start"); + } + for (;;) { switch_size_t len; @@ -927,9 +972,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_FILE_SIZE, &file_size); switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_FILE_TRIMMED, &file_trimmed); switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_FILE_TRIMMED_MS, &file_trimmed_ms); - if (file_trimmed_ms) switch_channel_set_variable(channel, "record_record_trimmed_ms", file_trimmed_ms); - if (file_size) switch_channel_set_variable(channel, "record_record_file_size", file_size); - if (file_trimmed) switch_channel_set_variable(channel, "record_record_trimmed", file_trimmed); + if (file_trimmed_ms) { + switch_channel_set_variable(channel, "record_record_trimmed_ms", file_trimmed_ms); + switch_channel_set_variable(channel, "record_trimmed_ms", file_trimmed_ms); + } + if (file_size) { + switch_channel_set_variable(channel, "record_record_file_size", file_size); + switch_channel_set_variable(channel, "record_file_size", file_size); + } + if (file_trimmed) { + switch_channel_set_variable(channel, "record_record_trimmed", file_trimmed); + switch_channel_set_variable(channel, "record_trimmed", file_trimmed); + } switch_core_file_close(fh); @@ -966,15 +1020,31 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", file); + merge_recording_variables(vars, event); switch_event_fire(&event); } + { + const char *app_exec = NULL; + if (vars && (app_exec = switch_event_get_header(vars, "execute_on_record_stop"))) { + switch_channel_execute_on_value(channel, app_exec); + } + switch_channel_execute_on(channel, "execute_on_record_stop"); + switch_channel_api_on(channel, "api_on_record_stop"); + } + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); arg_recursion_check_stop(args); return status; } +SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session, + switch_file_handle_t *fh, const char *file, switch_input_args_t *args, uint32_t limit) +{ + return switch_ivr_record_file_event(session, fh, file, args, limit, NULL); +} + static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map) { switch_buffer_t *audio_buffer = ts->user_data; diff --git a/tests/unit/switch_ivr_async.c b/tests/unit/switch_ivr_async.c index affd47587c..dedf026dd5 100644 --- a/tests/unit/switch_ivr_async.c +++ b/tests/unit/switch_ivr_async.c @@ -156,6 +156,40 @@ FST_CORE_BEGIN("./conf_async") switch_event_destroy(&rec_vars); } FST_SESSION_END() + + FST_SESSION_BEGIN(session_record_chan_vars) + { + const char *record_filename = switch_core_session_sprintf(fst_session, "%s%s%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(fst_session)); + switch_status_t status; + + // record READ stream only- should be complete silence which will trigger the initial timeout. + // Min seconds set to 2, which will cause the recording to be discarded. + // Expect the record_start_test_pass and record_stop_test_pass variables set to true + switch_channel_set_variable(fst_channel, "execute_on_record_start", "set record_start_test_pass=true"); + switch_channel_set_variable(fst_channel, "execute_on_record_stop", "set record_stop_test_pass=true"); + switch_channel_set_variable(fst_channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE, "set record_post_process_test_pass=true"); + switch_channel_set_variable(fst_channel, "RECORD_READ_ONLY", "true"); + switch_channel_set_variable(fst_channel, "RECORD_INITIAL_TIMEOUT_MS", "500"); + switch_channel_set_variable(fst_channel, "RECORD_MIN_SEC", "2"); + + status = switch_ivr_record_session_event(fst_session, record_filename, 0, NULL, NULL); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session() to return SWITCH_STATUS_SUCCESS"); + + status = switch_ivr_play_file(fst_session, NULL, "tone_stream://%(400,200,400,450);%(400,2000,400,450)", NULL); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_play_file() to return SWITCH_STATUS_SUCCESS"); + + status = switch_ivr_record_session_pause(fst_session, record_filename, SWITCH_TRUE); + fst_xcheck(status != SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session_pause(SWITCH_TRUE) not to return SWITCH_STATUS_SUCCESS because the recording has already stopped"); + + fst_xcheck(switch_file_exists(record_filename, fst_pool) != SWITCH_STATUS_SUCCESS, "Expect recording file not to exist since it was less than 2 seconds in duration"); + + fst_xcheck(switch_channel_var_true(fst_channel, "record_start_test_pass"), "Expect record_start_test_pass channel variable set to true"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_stop_test_pass"), "Expect record_stop_test_pass channel variable set to true"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_post_process_test_pass"), "Expect record_post_process_test_pass channel variable set to true"); + + unlink(record_filename); + } + FST_SESSION_END() } FST_SUITE_END() } diff --git a/tests/unit/switch_ivr_play_say.c b/tests/unit/switch_ivr_play_say.c index 1d0bab84f1..3e2ded6aff 100644 --- a/tests/unit/switch_ivr_play_say.c +++ b/tests/unit/switch_ivr_play_say.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2019, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -33,6 +33,46 @@ #include <test/switch_test.h> +static void on_record_start(switch_event_t *event) +{ + char *str = NULL; + switch_event_serialize(event, &str, SWITCH_FALSE); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s", str); + switch_safe_free(str); + const char *uuid = switch_event_get_header(event, "Unique-ID"); + if (uuid) { + switch_core_session_t *session = switch_core_session_locate(uuid); + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *recording_id = switch_event_get_header_nil(event, "Recording-Variable-ID"); + if (!strcmp(recording_id, "foo")) { + switch_channel_set_variable(channel, "record_start_event_test_pass", "true"); + } + switch_core_session_rwunlock(session); + } + } +} + +static void on_record_stop(switch_event_t *event) +{ + char *str = NULL; + switch_event_serialize(event, &str, SWITCH_FALSE); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s", str); + switch_safe_free(str); + const char *uuid = switch_event_get_header(event, "Unique-ID"); + if (uuid) { + switch_core_session_t *session = switch_core_session_locate(uuid); + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *recording_id = switch_event_get_header_nil(event, "Recording-Variable-ID"); + if (!strcmp(recording_id, "foo")) { + switch_channel_set_variable(channel, "record_stop_event_test_pass", "true"); + } + switch_core_session_rwunlock(session); + } + } +} + static switch_status_t partial_play_and_collect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *data, __attribute__((unused))unsigned int len) { switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -360,6 +400,79 @@ FST_CORE_BEGIN("./conf_playsay") cJSON_Delete(recognition_result); } FST_SESSION_END() + + FST_SESSION_BEGIN(record_file_event_vars) + { + const char *record_filename = switch_core_session_sprintf(fst_session, "%s" SWITCH_PATH_SEPARATOR "record_file_event_vars-tmp-%s.wav", SWITCH_GLOBAL_dirs.temp_dir, switch_core_session_get_uuid(fst_session)); + switch_event_t *rec_vars = NULL; + switch_status_t status; + switch_event_create_subclass(&rec_vars, SWITCH_EVENT_CLONE, SWITCH_EVENT_SUBCLASS_ANY); + fst_requires(rec_vars); + switch_event_bind("record_file_event", SWITCH_EVENT_RECORD_START, SWITCH_EVENT_SUBCLASS_ANY, on_record_start, NULL); + switch_event_bind("record_file_event", SWITCH_EVENT_RECORD_STOP, SWITCH_EVENT_SUBCLASS_ANY, on_record_stop, NULL); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "execute_on_record_start", "set record_start_test_pass=true"); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "execute_on_record_stop", "set record_stop_test_pass=true"); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "ID", "foo"); + switch_ivr_displace_session(fst_session, "file_string://silence_stream://500,0!tone_stream://%%(2000,0,350,440)", 0, "r"); + status = switch_ivr_record_file_event(fst_session, NULL, record_filename, NULL, 4, rec_vars); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_xcheck(switch_channel_var_true(fst_channel, "record_start_test_pass"), "Expect record_start_test_pass channel variable set to true"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_stop_test_pass"), "Expect record_stop_test_pass channel variable set to true"); + switch_sleep(1000 * 1000); + fst_xcheck(switch_channel_var_true(fst_channel, "record_start_event_test_pass"), "Expect RECORD_START event received with Recording-Variable-ID set"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_stop_event_test_pass"), "Expect RECORD_STOP event received with Recording-Variable-ID set"); + switch_event_unbind_callback(on_record_start); + switch_event_unbind_callback(on_record_stop); + switch_event_destroy(&rec_vars); + fst_xcheck(switch_file_exists(record_filename, fst_pool) == SWITCH_STATUS_SUCCESS, "Expect recording file to exist"); + unlink(record_filename); + } + FST_SESSION_END() + + FST_SESSION_BEGIN(record_file_event_chan_vars) + { + const char *record_filename = switch_core_session_sprintf(fst_session, "%s" SWITCH_PATH_SEPARATOR "record_file_event_chan_vars-tmp-%s.wav", SWITCH_GLOBAL_dirs.temp_dir, switch_core_session_get_uuid(fst_session)); + switch_event_t *rec_vars = NULL; + switch_status_t status; + switch_event_create_subclass(&rec_vars, SWITCH_EVENT_CLONE, SWITCH_EVENT_SUBCLASS_ANY); + fst_requires(rec_vars); + switch_event_bind("record_file_event", SWITCH_EVENT_RECORD_START, SWITCH_EVENT_SUBCLASS_ANY, on_record_start, NULL); + switch_event_bind("record_file_event", SWITCH_EVENT_RECORD_STOP, SWITCH_EVENT_SUBCLASS_ANY, on_record_stop, NULL); + switch_channel_set_variable(fst_channel, "execute_on_record_start_1", "set record_start_test_pass=true"); + switch_channel_set_variable(fst_channel, "execute_on_record_stop_1", "set record_stop_test_pass=true"); + switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "ID", "foo"); + switch_ivr_displace_session(fst_session, "file_string://silence_stream://500,0!tone_stream://%%(2000,0,350,440)", 0, "r"); + status = switch_ivr_record_file_event(fst_session, NULL, record_filename, NULL, 4, rec_vars); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_xcheck(switch_channel_var_true(fst_channel, "record_start_test_pass"), "Expect record_start_test_pass channel variable set to true"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_stop_test_pass"), "Expect record_stop_test_pass channel variable set to true"); + switch_sleep(1000 * 1000); + fst_xcheck(switch_channel_var_true(fst_channel, "record_start_event_test_pass"), "Expect RECORD_START event received with Recording-Variable-ID set"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_stop_event_test_pass"), "Expect RECORD_STOP event received with Recording-Variable-ID set"); + switch_event_unbind_callback(on_record_start); + switch_event_unbind_callback(on_record_stop); + switch_event_destroy(&rec_vars); + fst_xcheck(switch_file_exists(record_filename, fst_pool) == SWITCH_STATUS_SUCCESS, "Expect recording file to exist"); + unlink(record_filename); + } + FST_SESSION_END() + + FST_SESSION_BEGIN(record_file_event_chan_vars_only) + { + const char *record_filename = switch_core_session_sprintf(fst_session, "%s" SWITCH_PATH_SEPARATOR "record_file_event_chan_vars-tmp-%s.wav", SWITCH_GLOBAL_dirs.temp_dir, switch_core_session_get_uuid(fst_session)); + switch_status_t status; + switch_channel_set_variable(fst_channel, "execute_on_record_start_1", "set record_start_test_pass=true"); + switch_channel_set_variable(fst_channel, "execute_on_record_stop_1", "set record_stop_test_pass=true"); + switch_ivr_displace_session(fst_session, "file_string://silence_stream://500,0!tone_stream://%%(2000,0,350,440)", 0, "r"); + status = switch_ivr_record_file_event(fst_session, NULL, record_filename, NULL, 4, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + fst_xcheck(switch_channel_var_true(fst_channel, "record_start_test_pass"), "Expect record_start_test_pass channel variable set to true"); + fst_xcheck(switch_channel_var_true(fst_channel, "record_stop_test_pass"), "Expect record_stop_test_pass channel variable set to true"); + switch_sleep(1000 * 1000); + fst_xcheck(switch_file_exists(record_filename, fst_pool) == SWITCH_STATUS_SUCCESS, "Expect recording file to exist"); + unlink(record_filename); + } + FST_SESSION_END() } FST_SUITE_END() } From e6cd6391ff78c0c5cd9710ce372689640536a047 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 15 Jan 2021 08:37:09 -0500 Subject: [PATCH 359/655] [core] Add app_disable_expand_variables channel variable. When true, application args are not expanded by FreeSWITCH and are passed to the application unchanged. --- src/switch_core_session.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index acda5eaf7b..147900e784 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2849,6 +2849,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * int scope = 0; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; char *app_uuid = uuid_str; + switch_bool_t expand_variables = !switch_true(switch_channel_get_variable(session->channel, "app_disable_expand_variables")); if ((app_uuid_var = switch_channel_get_variable(channel, "app_uuid"))) { app_uuid = (char *)app_uuid_var; @@ -2866,10 +2867,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * app = application_interface->interface_name; if (arg) { - expanded = switch_channel_expand_variables(session->channel, arg); + if (expand_variables) { + expanded = switch_channel_expand_variables(session->channel, arg); + } else { + expanded = (char *)arg; + } } - if (expanded && *expanded == '%' && (*(expanded+1) == '[' || *(expanded+2) == '[')) { + if (expand_variables && expanded && *expanded == '%' && (*(expanded+1) == '[' || *(expanded+2) == '[')) { char *p, *dup; switch_event_t *ovars = NULL; From 451900b3532d94aa62c5eed6e9acca99316a8244 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Sun, 17 Jan 2021 14:41:10 -0500 Subject: [PATCH 360/655] [Unit-tests] Report test failure details as they happen. Fix issue where fst_xcheck definition did not allow its use inside conditional statements. --- src/include/test/switch_fct.h | 4 ++++ src/include/test/switch_test.h | 8 ++++---- tests/unit/switch_rtp.c | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/include/test/switch_fct.h b/src/include/test/switch_fct.h index f88821b49c..8cb07cc20f 100644 --- a/src/include/test/switch_fct.h +++ b/src/include/test/switch_fct.h @@ -2858,6 +2858,10 @@ fct_standard_logger__on_chk( /* Only record failures. */ if ( !fctchk__is_pass(e->chk) ) { + printf("\nTEST FAIL: %s(%d): %s\n", + fctchk__file(e->chk), + fctchk__lineno(e->chk), + fctchk__msg(e->chk)); fct_logger_record_failure(e->chk, &(logger->failed_cndtns_list)); } } diff --git a/src/include/test/switch_test.h b/src/include/test/switch_test.h index 7839a6c736..db5f4f7a7d 100644 --- a/src/include/test/switch_test.h +++ b/src/include/test/switch_test.h @@ -203,13 +203,13 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char * Check a test /w error message */ #define fst_xcheck(expr, error_msg) \ - fct_xchk(expr, "%s", error_msg); + (fct_xchk(expr, "%s", error_msg)) /** * Fail a test */ #define fst_fail(error_msg) \ - fct_xchk(0, "%s", error_msg); + (fct_xchk(0, "%s", error_msg)) /** * Check duration relative to test start, last marked time, or last check. @@ -236,7 +236,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char (actual), \ (expected), \ (precision) \ - ); + ) /** * Check if double-precision number is in range @@ -248,7 +248,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char (actual), \ (expected), \ (precision) \ - ); + ) /** * Run test without loading FS core diff --git a/tests/unit/switch_rtp.c b/tests/unit/switch_rtp.c index 35de9d8630..ebe307ad29 100644 --- a/tests/unit/switch_rtp.c +++ b/tests/unit/switch_rtp.c @@ -63,7 +63,7 @@ FST_TEARDOWN_END() fst_requires(switch_rtp_ready(rtp_session)); switch_rtp_activate_rtcp(rtp_session, 5, rx_port + 1, 0); switch_rtp_set_default_payload(rtp_session, TEST_PT); - fst_xcheck(switch_rtp_get_default_payload(rtp_session) == TEST_PT, "get Payload Type") + fst_xcheck(switch_rtp_get_default_payload(rtp_session) == TEST_PT, "get Payload Type"); switch_rtp_set_ssrc(rtp_session, 0xabcd); switch_rtp_set_remote_ssrc(rtp_session, 0xcdef); fst_xcheck(switch_rtp_get_ssrc(rtp_session) == 0xabcd, "get SSRC"); @@ -105,9 +105,9 @@ FST_TEARDOWN_END() session = switch_rtp_get_core_session(rtp_session); fst_requires(session); status = switch_rtp_activate_jitter_buffer(rtp_session, 1, 10, 80, 8000); - fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_activate_jitter_buffer()") + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_activate_jitter_buffer()"); status = switch_rtp_debug_jitter_buffer(rtp_session, "debug"); - fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_debug_jitter_buffer()") + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_debug_jitter_buffer()"); fst_requires(switch_rtp_get_jitter_buffer(rtp_session)); status = switch_rtp_pause_jitter_buffer(rtp_session, SWITCH_TRUE); fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_pause_jitter_buffer()"); From a26d0c39b0d23325f1c63c4fbd8966a11d8ebba4 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 29 Jan 2021 22:03:56 +0000 Subject: [PATCH 361/655] [core] Add switch_log_meta_printf() and switch_log_meta_vprintf() to allow JSON metadata to tag along with the log message. --- src/include/switch_log.h | 35 +++++++ src/switch_log.c | 61 ++++++++++-- tests/unit/.gitignore | 1 + tests/unit/Makefile.am | 2 +- tests/unit/switch_log.c | 197 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 289 insertions(+), 7 deletions(-) create mode 100644 tests/unit/switch_log.c diff --git a/src/include/switch_log.h b/src/include/switch_log.h index 40725a6cca..ee8f0d02ae 100644 --- a/src/include/switch_log.h +++ b/src/include/switch_log.h @@ -68,6 +68,8 @@ SWITCH_BEGIN_EXTERN_C switch_event_t *tags; /* Log sequence */ int64_t sequence; + /* Optional extra log metadata */ + cJSON *meta; } switch_log_node_t; ///\{ @@ -157,7 +159,40 @@ SWITCH_DECLARE(void) switch_log_printf(_In_ switch_text_channel_t channel, _In_z SWITCH_DECLARE(void) switch_log_vprintf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, const char *fmt, va_list ap); +/*! + \brief Write log data to the logging engine w/ optional JSON metadata + \param channel the log channel to write to + \param file the current file + \param func the current function + \param line the current line + \param userdata ununsed + \param level the current log level + \param meta log metadata - consumed by this function + \param fmt desired format + \param ... variable args + \note there are channel macros to supply the first 4 parameters (SWITCH_CHANNEL_LOG, SWITCH_CHANNEL_LOG_CLEAN, ...) + \see switch_types.h +*/ +SWITCH_DECLARE(void) switch_log_meta_printf(switch_text_channel_t channel, const char *file, const char *func, int line, + const char *userdata, switch_log_level_t level, cJSON **meta, const char *fmt, ...) PRINTF_FUNCTION(8, 9); +/*! + \brief Write log data to the logging engine w/ optional JSON metadata + \param channel the log channel to write to + \param file the current file + \param func the current function + \param line the current line + \param userdata ununsed + \param level the current log level + \param meta log metadata - consumed by this function + \param fmt desired format + \param ap variable args + \note there are channel macros to supply the first 4 parameters (SWITCH_CHANNEL_LOG, SWITCH_CHANNEL_LOG_CLEAN, ...) + \see switch_types.h +*/ +SWITCH_DECLARE(void) switch_log_meta_vprintf(_In_ switch_text_channel_t channel, _In_z_ const char *file, + _In_z_ const char *func, _In_ int line, + _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, cJSON **meta, const char *fmt, va_list ap); #endif /*! \brief Shut down the logging engine diff --git a/src/switch_log.c b/src/switch_log.c index 054e728768..c7a18c1a52 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -90,7 +90,7 @@ SWITCH_SEQ_FYELLOW }; SWITCH_DECLARE(cJSON *) switch_log_node_to_json(const switch_log_node_t *node, int log_level, switch_log_json_format_t *json_format, switch_event_t *chan_vars) { - cJSON *json = cJSON_CreateObject(); + cJSON *json = NULL; char *hostname; char *full_message = node->content; char *parsed_full_message = NULL; @@ -98,6 +98,24 @@ SWITCH_DECLARE(cJSON *) switch_log_node_to_json(const switch_log_node_t *node, i switch_event_t *log_fields = NULL; switch_core_session_t *session = NULL; + if (node->meta && cJSON_IsObject(node->meta)) { + if (json_format->custom_field_prefix) { + cJSON *field = NULL; + json = cJSON_CreateObject(); + for (field = node->meta->child; field; field = field->next) { + if (!zstr(field->string)) { + char *field_name = switch_mprintf("%s%s", json_format->custom_field_prefix, field->string); + cJSON_AddItemToObject(json, field_name, cJSON_Duplicate(field, cJSON_True)); + free(field_name); + } + } + } else { + json = cJSON_Duplicate(node->meta, cJSON_True); + } + } else { + json = cJSON_CreateObject(); + } + if (json_format->version.name && json_format->version.value) { cJSON_AddItemToObject(json, json_format->version.name, cJSON_CreateString(json_format->version.value)); } @@ -272,6 +290,10 @@ SWITCH_DECLARE(switch_log_node_t *) switch_log_node_dup(const switch_log_node_t switch_event_dup(&newnode->tags, node->tags); } + if (node->meta) { + newnode->meta = cJSON_Duplicate(node->meta, cJSON_True); + } + return newnode; } @@ -291,6 +313,10 @@ SWITCH_DECLARE(void) switch_log_node_free(switch_log_node_t **pnode) if (node->tags) { switch_event_destroy(&node->tags); } + if (node->meta) { + cJSON_Delete(node->meta); + node->meta = NULL; + } #ifdef SWITCH_LOG_RECYCLE if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) { free(node); @@ -500,13 +526,22 @@ static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj) return NULL; } +SWITCH_DECLARE(void) switch_log_meta_printf(switch_text_channel_t channel, const char *file, const char *func, int line, + const char *userdata, switch_log_level_t level, cJSON **meta, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + switch_log_meta_vprintf(channel, file, func, line, userdata, level, meta, fmt, ap); + va_end(ap); +} + SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line, const char *userdata, switch_log_level_t level, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - switch_log_vprintf(channel, file, func, line, userdata, level, fmt, ap); + switch_log_meta_vprintf(channel, file, func, line, userdata, level, NULL, fmt, ap); va_end(ap); } @@ -514,6 +549,12 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const char *file, const char *func, int line, const char *userdata, switch_log_level_t level, const char *fmt, va_list ap) { + switch_log_meta_vprintf(channel, file, func, line, userdata, level, NULL, fmt, ap); +} +SWITCH_DECLARE(void) switch_log_meta_vprintf(switch_text_channel_t channel, const char *file, const char *func, int line, + const char *userdata, switch_log_level_t level, cJSON **meta, const char *fmt, va_list ap) +{ + cJSON *log_meta = NULL; char *data = NULL; char *new_fmt = NULL; int ret = 0; @@ -531,8 +572,13 @@ SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const cha switch_log_level_t limit_level = runtime.hard_log_level; switch_log_level_t special_level = SWITCH_LOG_UNINIT; + if (meta && *meta) { + log_meta = *meta; + *meta = NULL; + } + if (limit_level == SWITCH_LOG_DISABLE) { - return; + goto end; } if (channel == SWITCH_CHANNEL_ID_SESSION && userdata) { @@ -545,14 +591,14 @@ SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const cha if (level > 100) { if ((uint32_t) (level - 100) > runtime.debug_level) { - return; + goto end; } level = 1; } if (level > limit_level) { - return; + goto end; } switch_assert(level < SWITCH_LOG_INVALID); @@ -671,6 +717,8 @@ SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const cha node->timestamp = now; node->channel = channel; node->tags = NULL; + node->meta = log_meta; + log_meta = NULL; if (channel == SWITCH_CHANNEL_ID_SESSION) { switch_core_session_t *session = (switch_core_session_t *) userdata; node->userdata = userdata ? strdup(switch_core_session_get_uuid(session)) : NULL; @@ -688,6 +736,7 @@ SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const cha end: + cJSON_Delete(log_meta); switch_safe_free(data); switch_safe_free(new_fmt); diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore index a9c5b8eb8f..66ea66aa06 100644 --- a/tests/unit/.gitignore +++ b/tests/unit/.gitignore @@ -25,6 +25,7 @@ switch_hash switch_ivr_async switch_ivr_originate switch_ivr_play_say +switch_log switch_packetizer switch_red switch_rtp diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 9d57dbe589..ee2e92b175 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/build/modmake.rulesam noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \ switch_ivr_play_say switch_core_codec switch_rtp switch_xml -noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_packetizer test_sofia switch_ivr_async switch_core_asr switch_core_session +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 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/switch_log.c b/tests/unit/switch_log.c new file mode 100644 index 0000000000..a56612fc28 --- /dev/null +++ b/tests/unit/switch_log.c @@ -0,0 +1,197 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2021, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Chris Rienzo <chris@signalwire.com> + * + * + * switch_log.c -- tests core logging + * + */ +#include <switch.h> +#include <stdlib.h> + +#include <test/switch_test.h> + +switch_memory_pool_t *pool = NULL; +static switch_mutex_t *mutex = NULL; +switch_thread_cond_t *cond = NULL; +static cJSON *last_alert_log = NULL; + +static switch_log_json_format_t json_format = { + { NULL, NULL }, // version + { NULL, NULL }, // host + { NULL, NULL }, // timestamp + { "level", NULL }, // level + { NULL, NULL }, // ident + { NULL, NULL }, // pid + { NULL, NULL }, // uuid + { NULL, NULL }, // file + { NULL, NULL }, // line + { NULL, NULL }, // function + { "message", NULL }, // full_message + { NULL, NULL }, // short_message + NULL, // custom_field_prefix + 0.0, // timestamp_divisor + { NULL, NULL } // sequence +}; + +static switch_status_t test_logger(const switch_log_node_t *node, switch_log_level_t level) +{ + switch_mutex_lock(mutex); + if (level == SWITCH_LOG_ALERT && !last_alert_log && node->content && strstr(node->content, "switch_log test: ")) { + last_alert_log = switch_log_node_to_json(node, level, &json_format, NULL); + switch_thread_cond_signal(cond); + } + switch_mutex_unlock(mutex); + return SWITCH_STATUS_SUCCESS; +} + +static char *wait_for_log(switch_interval_time_t timeout_ms) +{ + char *log_str = NULL; + cJSON *log = NULL; + switch_time_t now = switch_time_now(); + switch_time_t expiration = now + (timeout_ms * 1000); + switch_mutex_lock(mutex); + while (!last_alert_log && (now = switch_time_now()) < expiration) { + switch_interval_time_t timeout = expiration - now; + switch_thread_cond_timedwait(cond, mutex, timeout); + } + log = last_alert_log; + last_alert_log = NULL; + switch_mutex_unlock(mutex); + if (log) { + log_str = cJSON_PrintUnformatted(log); + cJSON_Delete(log); + } + return log_str; +} + +FST_CORE_BEGIN("./conf") +{ + switch_core_new_memory_pool(&pool); + switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, pool); + switch_thread_cond_create(&cond, pool); + + FST_SUITE_BEGIN(switch_log) + { + FST_SETUP_BEGIN() + { + json_format.custom_field_prefix = NULL; + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_SESSION_BEGIN(switch_log_meta_printf) + { + cJSON *item = NULL; + cJSON *meta = NULL; + char *log = NULL; + + switch_log_bind_logger(test_logger, SWITCH_LOG_ALERT, SWITCH_FALSE); + + switch_log_meta_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, NULL, "switch_log test: Plain channel log %d\n", 0); + log = wait_for_log(1000); + fst_check_string_equals(log, "{\"level\":1,\"message\":\"switch_log test: Plain channel log 0\\n\"}"); + switch_safe_free(log); + + switch_log_meta_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_ALERT, NULL, "switch_log test: Plain session log %d\n", 1); + log = wait_for_log(1000); + fst_check_string_equals(log, "{\"level\":1,\"message\":\"switch_log test: Plain session log 1\\n\"}"); + switch_safe_free(log); + + switch_log_meta_printf(SWITCH_CHANNEL_UUID_LOG(switch_core_session_get_uuid(fst_session)), SWITCH_LOG_ALERT, NULL, "switch_log test: Plain uuid log %d\n", 2); + log = wait_for_log(1000); + fst_check_string_equals(log, "{\"level\":1,\"message\":\"switch_log test: Plain uuid log 2\\n\"}"); + switch_safe_free(log); + + meta = cJSON_CreateObject(); + cJSON_AddStringToObject(meta, "foo", "bar"); + cJSON_AddNumberToObject(meta, "measure", 3.14159); + switch_log_meta_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, &meta, "switch_log test: channel log with metadata %d\n", 3); + fst_xcheck(meta == NULL, "Expect logging meta data to be consumed by switch_log_meta_printf()"); + log = wait_for_log(1000); + fst_check_string_equals(log, "{\"foo\":\"bar\",\"measure\":3.14159,\"level\":1,\"message\":\"switch_log test: channel log with metadata 3\\n\"}"); + switch_safe_free(log); + + meta = cJSON_CreateObject(); + cJSON_AddStringToObject(meta, "foo", "bar"); + cJSON_AddNumberToObject(meta, "measure", 3.14159); + switch_log_meta_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_ALERT, &meta, "switch_log test: Session log with metadata %d\n", 4); + fst_xcheck(meta == NULL, "Expect logging meta data to be consumed by switch_log_meta_printf()"); + log = wait_for_log(1000); + fst_check_string_equals(log, "{\"foo\":\"bar\",\"measure\":3.14159,\"level\":1,\"message\":\"switch_log test: Session log with metadata 4\\n\"}"); + switch_safe_free(log); + + meta = cJSON_CreateObject(); + cJSON_AddStringToObject(meta, "foo", "bar"); + cJSON_AddNumberToObject(meta, "measure", 3.14159); + switch_log_meta_printf(SWITCH_CHANNEL_UUID_LOG(switch_core_session_get_uuid(fst_session)), SWITCH_LOG_ALERT, &meta, "switch_log test: uuid log with metadata %d\n", 5); + fst_xcheck(meta == NULL, "Expect logging meta data to be consumed by switch_log_meta_printf()"); + log = wait_for_log(1000); + fst_check_string_equals(log, "{\"foo\":\"bar\",\"measure\":3.14159,\"level\":1,\"message\":\"switch_log test: uuid log with metadata 5\\n\"}"); + switch_safe_free(log); + + meta = cJSON_CreateObject(); + item = cJSON_AddObjectToObject(meta, "nested"); + cJSON_AddStringToObject(item, "stringval", "1234"); + item = cJSON_AddArrayToObject(item, "array"); + cJSON_AddItemToArray(item, cJSON_CreateString("12")); + item = cJSON_AddArrayToObject(meta, "array2"); + cJSON_AddItemToArray(item, cJSON_CreateString("34")); + switch_log_meta_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_ALERT, &meta, "switch_log test: session log with complex metadata %d\n", 6); + fst_xcheck(meta == NULL, "Expect logging meta data to be consumed by switch_log_meta_printf()"); + log = wait_for_log(1000); + fst_check_string_equals(log, "{\"nested\":{\"stringval\":\"1234\",\"array\":[\"12\"]},\"array2\":[\"34\"],\"level\":1,\"message\":\"switch_log test: session log with complex metadata 6\\n\"}"); + switch_safe_free(log); + + meta = cJSON_CreateObject(); + item = cJSON_AddObjectToObject(meta, "nested"); + cJSON_AddStringToObject(item, "stringval", "1234"); + item = cJSON_AddArrayToObject(item, "array"); + cJSON_AddItemToArray(item, cJSON_CreateString("12")); + item = cJSON_AddArrayToObject(meta, "array2"); + cJSON_AddItemToArray(item, cJSON_CreateString("34")); + json_format.custom_field_prefix = "prefix."; + switch_log_meta_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_ALERT, &meta, "switch_log test: session log with prefixed complex metadata %d\n", 7); + fst_xcheck(meta == NULL, "Expect logging meta data to be consumed by switch_log_meta_printf()"); + log = wait_for_log(1000); + fst_check_string_equals(log, "{\"prefix.nested\":{\"stringval\":\"1234\",\"array\":[\"12\"]},\"prefix.array2\":[\"34\"],\"level\":1,\"message\":\"switch_log test: session log with prefixed complex metadata 7\\n\"}"); + switch_safe_free(log); + + cJSON_Delete(last_alert_log); + last_alert_log = NULL; + switch_log_unbind_logger(test_logger); + } + FST_SESSION_END() + } + FST_SUITE_END() + + switch_core_destroy_memory_pool(&pool); +} +FST_CORE_END() From 1adcebb309cba22a2558012d8a800ba2a8cd2308 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Wed, 10 Feb 2021 21:16:41 -0500 Subject: [PATCH 362/655] [mod_sofia] add sip_refer_continue_after_reply channel variable. Set to true to prevent hangup when response to REFER request is received. Added sip_refer_target_status_code and sip_refer_target_provisional_status_code channel variables to store responses from NOTIFY sipfrags. --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 835717e7e9..5de26b1d00 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1553,7 +1553,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (msg->string_array_arg[0]) { tech_pvt->proxy_refer_uuid = (char *)msg->string_array_arg[0]; - } else { + } else if (!switch_channel_var_true(tech_pvt->channel, "sip_refer_continue_after_reply")) { switch_mutex_unlock(tech_pvt->sofia_mutex); sofia_wait_for_reply(tech_pvt, 9999, 10); switch_mutex_lock(tech_pvt->sofia_mutex); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index bb5b969552..6e6bce2827 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -679,13 +679,16 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, status_val = atoi(p); } if (!status_val || status_val >= 200) { + switch_channel_set_variable_printf(channel, "sip_refer_target_status_code", "%d", status_val); switch_channel_set_variable(channel, "sip_refer_reply", sip->sip_payload->pl_data); - if (status_val == 200) { + if (status_val == 200 && !switch_channel_var_true(channel, "sip_refer_continue_after_reply")) { switch_channel_hangup(channel, SWITCH_CAUSE_BLIND_TRANSFER); } if ((int)tech_pvt->want_event == 9999) { tech_pvt->want_event = 0; } + } else if (status_val < 200) { + switch_channel_set_variable_printf(channel, "sip_refer_target_provisional_status_code", "%d", status_val); } } } From 97d585465515ee7e17a6ef0fedc3371db2258e2f Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Mon, 1 Mar 2021 18:47:54 +0000 Subject: [PATCH 363/655] [mod_ssml] Add channel-uuid parameter to the tts:// file format and forward it to the core speech handle as a parameter. --- .gitignore | 1 + src/mod/applications/mod_test/mod_test.c | 14 +++- src/mod/formats/mod_ssml/Makefile.am | 13 ++++ src/mod/formats/mod_ssml/mod_ssml.c | 6 ++ src/mod/formats/mod_ssml/test/freeswitch.xml | 36 ++++++++++ .../formats/mod_ssml/test/test_tts_format.c | 66 +++++++++++++++++++ 6 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 src/mod/formats/mod_ssml/test/freeswitch.xml create mode 100644 src/mod/formats/mod_ssml/test/test_tts_format.c diff --git a/.gitignore b/.gitignore index 3ad88ef734..7041de0494 100644 --- a/.gitignore +++ b/.gitignore @@ -266,6 +266,7 @@ src/mod/applications/mod_http_cache/test/test_aws.log src/mod/applications/mod_http_cache/test/test_aws.trs src/mod/formats/mod_sndfile/test/test_sndfile src/mod/formats/mod_sndfile/test/test_sndfile_conf +src/mod/formats/mod_ssml/test/test_tts_format src/mod/*/*/test/*.log src/mod/*/*/test/*.trs src/mod/*/*/test/[0-9]*/* diff --git a/src/mod/applications/mod_test/mod_test.c b/src/mod/applications/mod_test/mod_test.c index 02292a7a3b..55729548f7 100644 --- a/src/mod/applications/mod_test/mod_test.c +++ b/src/mod/applications/mod_test/mod_test.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -41,6 +41,7 @@ SWITCH_MODULE_DEFINITION(mod_test, mod_test_load, mod_test_shutdown, mod_test_ru typedef struct { char *text; int samples; + const char *channel_uuid; } test_tts_t; typedef enum { @@ -393,6 +394,10 @@ static switch_status_t test_speech_feed_tts(switch_speech_handle_t *sh, char *te { test_tts_t *context = (test_tts_t *)sh->private_info; + if (switch_true(switch_core_get_variable("mod_test_tts_must_have_channel_uuid")) && zstr(context->channel_uuid)) { + return SWITCH_STATUS_FALSE; + } + if (!zstr(text)) { char *p = strstr(text, "silence://"); @@ -431,6 +436,13 @@ static void test_speech_flush_tts(switch_speech_handle_t *sh) static void test_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val) { + test_tts_t *context = (test_tts_t *)sh->private_info; + if (!zstr(param) && !zstr(val)) { + if (!strcasecmp("channel-uuid", param)) { + context->channel_uuid = switch_core_strdup(sh->memory_pool, val); + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "channel-uuid = %s\n", val); + } + } } static void test_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val) diff --git a/src/mod/formats/mod_ssml/Makefile.am b/src/mod/formats/mod_ssml/Makefile.am index ad91a27f29..9a54b5e710 100644 --- a/src/mod/formats/mod_ssml/Makefile.am +++ b/src/mod/formats/mod_ssml/Makefile.am @@ -5,12 +5,25 @@ IKS_DIR=$(switch_srcdir)/libs/iksemel IKS_BUILDDIR=$(switch_builddir)/libs/iksemel IKS_LA=$(IKS_BUILDDIR)/src/libiksemel.la +noinst_LTLIBRARIES = libssmlmod.la +libssmlmod_la_SOURCES = mod_ssml.c +libssmlmod_la_CFLAGS = $(AM_CFLAGS) -I$(IKS_DIR)/include + mod_LTLIBRARIES = mod_ssml.la mod_ssml_la_SOURCES = mod_ssml.c mod_ssml_la_CFLAGS = $(AM_CFLAGS) -I$(IKS_DIR)/include mod_ssml_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(IKS_LA) mod_ssml_la_LDFLAGS = -avoid-version -module -no-undefined -shared +noinst_PROGRAMS = test/test_tts_format + +test_test_tts_format_SOURCES = test/test_tts_format.c +test_test_tts_format_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" +test_test_tts_format_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) +test_test_tts_format_LDADD = libssmlmod.la $(IKS_LA) + +TESTS = $(noinst_PROGRAMS) + BUILT_SOURCES=$(IKS_LA) $(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update diff --git a/src/mod/formats/mod_ssml/mod_ssml.c b/src/mod/formats/mod_ssml/mod_ssml.c index 85f5ec0556..633b08dd07 100644 --- a/src/mod/formats/mod_ssml/mod_ssml.c +++ b/src/mod/formats/mod_ssml/mod_ssml.c @@ -941,6 +941,12 @@ static switch_status_t tts_file_open(switch_file_handle_t *handle, const char *p memset(context, 0, sizeof(*context)); context->flags = SWITCH_SPEECH_FLAG_NONE; if ((status = switch_core_speech_open(&context->sh, module, voice, handle->samplerate, handle->interval, handle->channels, &context->flags, NULL)) == SWITCH_STATUS_SUCCESS) { + if (handle->params) { + const char *channel_uuid = switch_event_get_header(handle->params, "channel-uuid"); + if (!zstr(channel_uuid)) { + switch_core_speech_text_param_tts(&context->sh, "channel-uuid", channel_uuid); + } + } if ((status = switch_core_speech_feed_tts(&context->sh, document, &context->flags)) == SWITCH_STATUS_SUCCESS) { handle->channels = 1; handle->samples = 0; diff --git a/src/mod/formats/mod_ssml/test/freeswitch.xml b/src/mod/formats/mod_ssml/test/freeswitch.xml new file mode 100644 index 0000000000..eb2f8bda7e --- /dev/null +++ b/src/mod/formats/mod_ssml/test/freeswitch.xml @@ -0,0 +1,36 @@ +<document type="freeswitch/xml"> + + <section name="configuration" description="Various Configuration"> + <configuration name="modules.conf" description="Modules"> + <modules> + <load module="mod_console"/> + <load module="mod_loopback"/> + <load module="mod_tone_stream"/> + <load module="mod_dptools"/> + <load module="mod_sndfile"/> + <load module="mod_test"/> + </modules> + </configuration> + + <configuration name="console.conf" description="Console Logger"> + <mappings> + <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/> + </mappings> + <settings> + <param name="colorize" value="true"/> + <param name="loglevel" value="debug"/> + <param name="uuid" value="true"/> + </settings> + </configuration> + </section> + + <section name="dialplan" description="Regex/XML Dialplan"> + <context name="default"> + <extension name="sample"> + <condition> + <action application="info"/> + </condition> + </extension> + </context> + </section> +</document> diff --git a/src/mod/formats/mod_ssml/test/test_tts_format.c b/src/mod/formats/mod_ssml/test/test_tts_format.c new file mode 100644 index 0000000000..d3edaf6300 --- /dev/null +++ b/src/mod/formats/mod_ssml/test/test_tts_format.c @@ -0,0 +1,66 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Chris Rienzo <chris@signalwire.com> + * + * + * test_tts_format.c -- tests for tts:// file format + * + */ +#include <switch.h> +#include <test/switch_test.h> + +FST_CORE_BEGIN(".") + +FST_MODULE_BEGIN(mod_ssml, test_tts_format) + +FST_SETUP_BEGIN() +{ + fst_requires_module("mod_test"); +} +FST_SETUP_END() + +FST_TEARDOWN_BEGIN() +{ + switch_core_set_variable("mod_test_tts_must_have_channel_uuid", "false"); +} +FST_TEARDOWN_END() + +FST_SESSION_BEGIN(tts_channel_uuid) +{ + char *tts_without_channel_uuid = "tts://test||This is a test"; + char *tts_with_channel_uuid = switch_core_session_sprintf(fst_session, "{channel-uuid=%s}tts://test||This is a test", switch_core_session_get_uuid(fst_session)); + switch_status_t status; + switch_core_set_variable("mod_test_tts_must_have_channel_uuid", "true"); + status = switch_ivr_play_file(fst_session, NULL, tts_without_channel_uuid, NULL); + fst_xcheck(status != SWITCH_STATUS_SUCCESS, "Expect channel UUID not to be delivered to TTS module"); + + status = switch_ivr_play_file(fst_session, NULL, tts_with_channel_uuid, NULL); + fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect channel UUID to be delivered to TTS module"); +} +FST_SESSION_END() + +FST_MODULE_END() + +FST_CORE_END() From f2897211472dec5d75f49103ccec024e2f875854 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 4 Mar 2021 01:29:10 +0300 Subject: [PATCH 364/655] [Core] Add exclude-error-log-from-xml-cdr config parameter and exclude_error_log_from_xml_cdr global variable. --- src/switch_core.c | 7 +++++++ src/switch_ivr.c | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/switch_core.c b/src/switch_core.c index c3ddc5124e..50ce348c95 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2309,6 +2309,13 @@ static void switch_load_core_config(const char *file) switch_core_set_variable("spawn_instead_of_system", "false"); } #endif + } else if (!strcasecmp(var, "exclude-error-log-from-xml-cdr") && !zstr(val)) { + int v = switch_true(val); + if (v) { + switch_core_set_variable("exclude_error_log_from_xml_cdr", "true"); + } else { + switch_core_set_variable("exclude_error_log_from_xml_cdr", "false"); + } } else if (!strcasecmp(var, "min-idle-cpu") && !zstr(val)) { switch_core_min_idle_cpu(atof(val)); } else if (!strcasecmp(var, "tipping-point") && !zstr(val)) { diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 51875e4c25..4f9d2d0cbd 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2690,6 +2690,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_ int loff = 0; switch_rtp_stats_t *stats = switch_core_media_get_stats(session, type, NULL); char var_val[35] = ""; + switch_bool_t exclude_error_log_from_xml_cdr = switch_true(switch_core_get_variable("exclude_error_log_from_xml_cdr")); if (!stats) return off; @@ -2727,7 +2728,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_ add_stat_double(x_in, stats->inbound.mos, "mos"); - if (stats->inbound.error_log) { + if (stats->inbound.error_log && !exclude_error_log_from_xml_cdr) { switch_xml_t x_err_log, x_err; switch_error_period_t *ep; int eoff = 0; From fa78235baf7c27cd10ec31cb05c4e988ccead070 Mon Sep 17 00:00:00 2001 From: aslgithub <63076808+aslgithub@users.noreply.github.com> Date: Mon, 10 May 2021 23:56:36 +0100 Subject: [PATCH 365/655] [mod_verto] clientReady - reattached_sessions array Make mod_verto clientReady reattached_sessions array send channel IDs that have been reattached, rather than the same connection ID repeatedly. Co-authored-by: davidp <davidp@cyfas.co.uk> --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 804f612ff0..32480ac9cc 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1320,7 +1320,7 @@ static void attach_calls(jsock_t *jsock) } tech_reattach(tech_pvt, jsock); - cJSON_AddItemToArray(reattached_sessions, cJSON_CreateString(jsock->uuid_str)); + cJSON_AddItemToArray(reattached_sessions, cJSON_CreateString(switch_core_session_get_uuid(tech_pvt->session))); } } switch_thread_rwlock_unlock(verto_globals.tech_rwlock); From c86e3827f94f4dff1e0910922aeb3ba96a1d1154 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 14 Apr 2021 10:15:04 +0000 Subject: [PATCH 366/655] [mod_sofia] rfc8760: use different nonce per auth algorithm. [mod_sofia] keep unconsumed nonce in the db for 32 seconds (timer_t1x64) + nonce_ttl. [mod_sofia] add #ifdef condition on using sha512: OPENSSL_VERSION_NUMBER >= 0x10101000L --- src/mod/endpoints/mod_sofia/sofia_glue.c | 5 ++- src/mod/endpoints/mod_sofia/sofia_reg.c | 55 ++++++++++++++++-------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 9a6a7acbd9..644848a010 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2533,7 +2533,8 @@ int sofia_glue_init_sql(sofia_profile_t *profile) " expires BIGINT," " profile_name VARCHAR(255),\n" " hostname VARCHAR(255),\n" - " last_nc INTEGER\n" + " last_nc INTEGER,\n" + " algorithm INTEGER DEFAULT 1 NOT NULL\n" ");\n"; /* should we move this glue to sofia_sla or keep it here where all db init happens? XXX MTK */ @@ -2700,7 +2701,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile) switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_presence", pres_sql); free(test_sql); - test_sql = switch_mprintf("delete from sip_authentication where hostname='%q' or last_nc >= 0", mod_sofia_globals.hostname); + test_sql = switch_mprintf("delete from sip_authentication where hostname='%q' or last_nc >= 0 or algorithm >= 0", mod_sofia_globals.hostname); switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_authentication", auth_sql); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 49dc8feeda..ae301e9e50 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1129,8 +1129,10 @@ static char * sofia_alg_to_str(sofia_auth_algs_t alg) { if (alg == ALG_SHA256) return "SHA-256"; +#if OPENSSL_VERSION_NUMBER >= 0x10101000L if (alg == ALG_SHA512) return "SHA-512-256"; +#endif return "MD5"; } @@ -1148,25 +1150,37 @@ void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_ msg = de->data->e_msg; } - switch_uuid_get(&uuid); - switch_uuid_format(uuid_str, &uuid); - - sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname, last_nc) " - "values('%q', %ld, '%q', '%q', 0)", uuid_str, - (long) switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL) + exptime, - profile->name, mod_sofia_globals.hostname); - switch_assert(sql != NULL); - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - if (!profile->rfc8760_algs_count) { + switch_uuid_get(&uuid); + switch_uuid_format(uuid_str, &uuid); + + sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname, last_nc) " + "values('%q', %ld, '%q', '%q', 0)", uuid_str, + (long) switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL) + profile->timer_t1x64 / 1000, + profile->name, mod_sofia_globals.hostname); + switch_assert(sql != NULL); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + auth_str = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=true," : ""); } else { int i; - for (i = 0 ; i < profile->rfc8760_algs_count; i++) { - if (profile->auth_algs[i] != ALG_NONE) { - auth_str_rfc8760[i] = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=%s, qop=\"auth\"", realm, uuid_str, stale ? " stale=true," : "", sofia_alg_to_str(profile->auth_algs[i])); - } + char *sql_build; + switch_stream_handle_t stream = { 0 }; + + SWITCH_STANDARD_STREAM(stream); + for (i = 0; i < profile->rfc8760_algs_count; i++) { + switch_uuid_get(&uuid); + switch_uuid_format(uuid_str, &uuid); + sql_build = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname, last_nc, algorithm) " + "values('%s', %ld, '%q', '%q', 0, %d)", uuid_str, + (long) switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL) + profile->timer_t1x64 / 1000, + profile->name, mod_sofia_globals.hostname, profile->auth_algs[i]); + + auth_str_rfc8760[i] = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=%s, qop=\"auth\"", realm, uuid_str, stale ? " stale=true," : "", sofia_alg_to_str(profile->auth_algs[i])); + stream.write_function(&stream, "%s%s", i ? ";" : "", sql_build); + switch_safe_free(sql_build); } + sofia_glue_execute_sql_now(profile, (char **)&stream.data, SWITCH_TRUE); } if (regtype == REG_REGISTER) { @@ -2931,11 +2945,12 @@ sofia_auth_algs_t sofia_alg_str2id(char *algorithm, switch_bool_t permissive) if (!strcasecmp(algorithm, "SHA-256") || (permissive && !strcasecmp(algorithm, "SHA256"))) { return ALG_SHA256; } +#if OPENSSL_VERSION_NUMBER >= 0x10101000L if (!strcasecmp(algorithm, "SHA-512-256") || (permissive && !strcasecmp(algorithm, "SHA512")) || (permissive && !strcasecmp(algorithm, "SHA512-256")) || (permissive && !strcasecmp(algorithm, "SHA-512"))) { return ALG_SHA512; } - +#endif return ALG_NONE; } @@ -2949,9 +2964,11 @@ switch_status_t sofia_make_digest(sofia_auth_algs_t use_alg, char **digest, cons case ALG_SHA256: 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); break; +#endif default: return SWITCH_STATUS_FALSE; } @@ -3536,7 +3553,11 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, end: - if (nc && cnonce && qop) { + if (nc && cnonce && qop && ret == AUTH_OK) { + ret = AUTH_RENEWED; + } + + if (((ret == AUTH_OK) || (ret == AUTH_RENEWED)) && nc) { ncl = strtoul(nc, 0, 16); sql = switch_mprintf("update sip_authentication set expires='%ld',last_nc=%lu where nonce='%q'", @@ -3545,8 +3566,6 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, switch_assert(sql != NULL); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - if (ret == AUTH_OK) - ret = AUTH_RENEWED; } switch_event_destroy(&params); From 79127d94e50994adf3eee04121cc44ca1a9c5bf0 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 16 Apr 2021 20:02:21 +0300 Subject: [PATCH 367/655] [Core] Cleanup sqldb: remove unimplemented io_mutex from switch_cache_db_handle and sql_manager structures --- src/switch_core_sqldb.c | 65 ----------------------------------------- 1 file changed, 65 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index e9334eb52d..38bfa9448f 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -46,7 +46,6 @@ struct switch_cache_db_handle { switch_cache_db_native_handle_t native_handle; time_t last_used; switch_mutex_t *mutex; - switch_mutex_t *io_mutex; switch_memory_pool_t *pool; int32_t flags; unsigned long hash; @@ -63,7 +62,6 @@ static struct { switch_thread_t *db_thread; int db_thread_running; switch_bool_t manage; - switch_mutex_t *io_mutex; switch_mutex_t *dbh_mutex; switch_mutex_t *ctl_mutex; switch_cache_db_handle_t *handle_pool; @@ -364,8 +362,6 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t switch_mutex_lock(sql_manager.dbh_mutex); (*dbh)->last_used = switch_epoch_time_now(NULL); - (*dbh)->io_mutex = NULL; - if ((*dbh)->use_count) { --(*dbh)->use_count; } @@ -687,9 +683,6 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t char *errmsg = NULL; char *tmp = NULL; char *type = NULL; - switch_mutex_t *io_mutex = dbh->io_mutex; - - if (io_mutex) switch_mutex_lock(io_mutex); if (err) { *err = NULL; @@ -738,9 +731,6 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t } } - - if (io_mutex) switch_mutex_unlock(io_mutex); - return status; } @@ -807,9 +797,6 @@ static switch_status_t switch_cache_db_execute_sql_chunked(switch_cache_db_handl SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_handle_t *dbh, char *sql, char **err) { switch_status_t status = SWITCH_STATUS_FALSE; - switch_mutex_t *io_mutex = dbh->io_mutex; - - if (io_mutex) switch_mutex_lock(io_mutex); switch (dbh->type) { default: @@ -819,10 +806,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand break; } - if (io_mutex) switch_mutex_unlock(io_mutex); - return status; - } @@ -878,9 +862,6 @@ SWITCH_DECLARE(int) switch_cache_db_load_extension(switch_cache_db_handle_t *dbh SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t *dbh, char *sql, char *str, size_t len, char **err) { switch_status_t status = SWITCH_STATUS_FALSE; - switch_mutex_t *io_mutex = dbh->io_mutex; - - if (io_mutex) switch_mutex_lock(io_mutex); memset(str, 0, len); @@ -935,8 +916,6 @@ SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t end: - if (io_mutex) switch_mutex_unlock(io_mutex); - return status == SWITCH_STATUS_SUCCESS ? str : NULL; } @@ -946,7 +925,6 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_ char *errmsg = NULL; switch_status_t status = SWITCH_STATUS_FALSE; uint8_t forever = 0; - switch_mutex_t *io_mutex = dbh->io_mutex; if (!retries) { forever = 1; @@ -955,10 +933,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_ while (retries > 0) { - if (io_mutex) switch_mutex_lock(io_mutex); switch_cache_db_execute_sql_real(dbh, sql, &errmsg); - if (io_mutex) switch_mutex_unlock(io_mutex); - if (errmsg) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR [%s]\n", errmsg); @@ -991,15 +966,12 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans_full(sw uint8_t forever = 0; unsigned begin_retries = 100; uint8_t again = 0; - switch_mutex_t *io_mutex = dbh->io_mutex; if (!retries) { forever = 1; retries = 1000; } - if (io_mutex) switch_mutex_lock(io_mutex); - if (!zstr(pre_trans_execute)) { switch_cache_db_execute_sql_real(dbh, pre_trans_execute, &errmsg); if (errmsg) { @@ -1166,8 +1138,6 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans_full(sw } } - if (io_mutex) switch_mutex_unlock(io_mutex); - return status; } @@ -1196,16 +1166,12 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback(switc { switch_status_t status = SWITCH_STATUS_FALSE; char *errmsg = NULL; - switch_mutex_t *io_mutex = dbh->io_mutex; struct helper h = {0}; - if (err) { *err = NULL; } - if (io_mutex) switch_mutex_lock(io_mutex); - h.callback = callback; h.pdata = pdata; @@ -1244,8 +1210,6 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback(switc break; } - if (io_mutex) switch_mutex_unlock(io_mutex); - return status; } @@ -1256,7 +1220,6 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback_err(s { switch_status_t status = SWITCH_STATUS_FALSE; char *errmsg = NULL; - switch_mutex_t *io_mutex = dbh->io_mutex; struct helper h; @@ -1264,8 +1227,6 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback_err(s *err = NULL; } - if (io_mutex) switch_mutex_lock(io_mutex); - h.callback = callback; h.pdata = pdata; @@ -1316,7 +1277,6 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback_err(s break; } - if (io_mutex) switch_mutex_unlock(io_mutex); return status; } @@ -1326,15 +1286,11 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach { switch_status_t status = SWITCH_STATUS_FALSE; char *errmsg = NULL; - switch_mutex_t *io_mutex = dbh->io_mutex; if (err) { *err = NULL; } - if (io_mutex) switch_mutex_lock(io_mutex); - - switch (dbh->type) { case SCDB_TYPE_DATABASE_INTERFACE: { @@ -1370,8 +1326,6 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach break; } - if (io_mutex) switch_mutex_unlock(io_mutex); - return status; } @@ -1381,15 +1335,11 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback_err(switch_ { switch_status_t status = SWITCH_STATUS_FALSE; char *errmsg = NULL; - switch_mutex_t *io_mutex = dbh->io_mutex; if (err) { *err = NULL; } - if (io_mutex) switch_mutex_lock(io_mutex); - - switch (dbh->type) { case SCDB_TYPE_DATABASE_INTERFACE: { @@ -1437,8 +1387,6 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback_err(switch_ break; } - if (io_mutex) switch_mutex_unlock(io_mutex); - return status; } @@ -1480,7 +1428,6 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive_ex(switch_cache_db_h const char *test_sql, const char *drop_sql, const char *reactive_sql, const char *row_size_limited_reactive_sql) { switch_bool_t r = SWITCH_TRUE; - switch_mutex_t *io_mutex = dbh->io_mutex; switch_assert(test_sql != NULL); switch_assert(reactive_sql != NULL); @@ -1495,8 +1442,6 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive_ex(switch_cache_db_h return (status == SWITCH_STATUS_SUCCESS) ? SWITCH_TRUE : SWITCH_FALSE; } - if (io_mutex) switch_mutex_lock(io_mutex); - switch (dbh->type) { case SCDB_TYPE_DATABASE_INTERFACE: { @@ -1570,9 +1515,6 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive_ex(switch_cache_db_h break; } - - if (io_mutex) switch_mutex_unlock(io_mutex); - return r; } @@ -2121,11 +2063,8 @@ static uint32_t do_trans(switch_sql_queue_manager_t *qm) void *pop; switch_status_t status; uint32_t ttl = 0; - switch_mutex_t *io_mutex = qm->event_db->io_mutex; uint32_t i; - if (io_mutex) switch_mutex_lock(io_mutex); - if (!zstr(qm->pre_trans_execute)) { switch_cache_db_execute_sql_real(qm->event_db, qm->pre_trans_execute, &errmsg); if (errmsg) { @@ -2257,9 +2196,6 @@ static uint32_t do_trans(switch_sql_queue_manager_t *qm) } switch_mutex_unlock(qm->mutex); - - if (io_mutex) switch_mutex_unlock(io_mutex); - return ttl; } @@ -3628,7 +3564,6 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ sql_manager.manage = manage; switch_mutex_init(&sql_manager.dbh_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); - switch_mutex_init(&sql_manager.io_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); switch_mutex_init(&sql_manager.ctl_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); if (!sql_manager.manage) goto skip; From 69b8c080f69821d9a0a3359d167a9bf81c57caba Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 17 Apr 2021 01:06:21 +0300 Subject: [PATCH 368/655] [Core] Fix wrong lock order in switch_user_sql_thread() --- src/switch_core_sqldb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 38bfa9448f..8d9eaf152c 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -2287,10 +2287,11 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, switch_mutex_lock(qm->cond2_mutex); if (qm->skip_wait > 0) { qm->skip_wait--; + switch_mutex_unlock(qm->cond2_mutex); } else { + switch_mutex_unlock(qm->cond2_mutex); switch_thread_cond_wait(qm->cond, qm->cond_mutex); } - switch_mutex_unlock(qm->cond2_mutex); } i = 40; From 58f7c2d64ee334e311e6c5cc07e9237642ea9d66 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 17 Apr 2021 01:47:05 +0300 Subject: [PATCH 369/655] [Core] sqldb: Fix wrong lock order in switch_cache_db_release_db_handle() --- src/switch_core_sqldb.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 8d9eaf152c..061a5ed15e 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -106,6 +106,7 @@ static void add_handle(switch_cache_db_handle_t *dbh, const char *db_str, const switch_ssize_t hlen = -1; switch_mutex_lock(sql_manager.dbh_mutex); + switch_mutex_lock(dbh->mutex); switch_set_string(dbh->creator, db_callsite_str); @@ -115,12 +116,11 @@ static void add_handle(switch_cache_db_handle_t *dbh, const char *db_str, const dbh->use_count++; dbh->total_used_count++; - sql_manager.total_used_handles++; dbh->next = sql_manager.handle_pool; sql_manager.handle_pool = dbh; sql_manager.total_handles++; - switch_mutex_lock(dbh->mutex); + sql_manager.total_used_handles++; switch_mutex_unlock(sql_manager.dbh_mutex); } @@ -359,15 +359,16 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t break; } - switch_mutex_lock(sql_manager.dbh_mutex); (*dbh)->last_used = switch_epoch_time_now(NULL); - if ((*dbh)->use_count) { --(*dbh)->use_count; } + switch_mutex_unlock((*dbh)->mutex); - sql_manager.total_used_handles--; *dbh = NULL; + + switch_mutex_lock(sql_manager.dbh_mutex); + sql_manager.total_used_handles--; switch_mutex_unlock(sql_manager.dbh_mutex); } } From 94337b33fb534ede81c0390f8e8c60a7814ef203 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sun, 18 Apr 2021 02:09:57 +0300 Subject: [PATCH 370/655] [Core] Fix database handles infinitely locked in switch_cache_db_database_interface_flush_handles() --- src/switch_core_sqldb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 061a5ed15e..0f6ecd5841 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -156,10 +156,12 @@ top: for (dbh_ptr = sql_manager.handle_pool; dbh_ptr; dbh_ptr = dbh_ptr->next) { if (switch_mutex_trylock(dbh_ptr->mutex) == SWITCH_STATUS_SUCCESS) { if (dbh_ptr->type != SCDB_TYPE_DATABASE_INTERFACE) { + switch_mutex_unlock(dbh_ptr->mutex); continue; } if (dbh_ptr->native_handle.database_interface_dbh->connection_options.database_interface != database_interface) { + switch_mutex_unlock(dbh_ptr->mutex); continue; } From 0d105c5683b6407b439a449a7a3f3219165b88ce Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 19 Apr 2021 21:48:35 +0300 Subject: [PATCH 371/655] [mod_python] scan-build: Called C++ object pointer is null --- src/mod/languages/mod_python/hack.diff | 8 ++++++++ src/mod/languages/mod_python/mod_python_wrap.cpp | 1 + 2 files changed, 9 insertions(+) diff --git a/src/mod/languages/mod_python/hack.diff b/src/mod/languages/mod_python/hack.diff index 27bbe275e2..771be152d0 100644 --- a/src/mod/languages/mod_python/hack.diff +++ b/src/mod/languages/mod_python/hack.diff @@ -79,3 +79,11 @@ return resultobj; fail: return NULL; +@@ -10492,6 +10492,7 @@ SWIGINTERN PyObject *_wrap_Session_setSelf(PyObject *SWIGUNUSEDPARM(self), PyObj + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setSelf" "', argument " "1"" of type '" "PYTHON::Session *""'"); + } + arg1 = reinterpret_cast< PYTHON::Session * >(argp1); ++ if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "Session_setSelf" "', argument " "1"" is NULL"); + arg2 = obj1; + (arg1)->setSelf(arg2); + resultobj = SWIG_Py_Void(); diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index 227b441b59..e8db10c7c0 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -10492,6 +10492,7 @@ SWIGINTERN PyObject *_wrap_Session_setSelf(PyObject *SWIGUNUSEDPARM(self), PyObj SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setSelf" "', argument " "1"" of type '" "PYTHON::Session *""'"); } arg1 = reinterpret_cast< PYTHON::Session * >(argp1); + if (!arg1) SWIG_exception_fail(SWIG_ValueError, "in method '" "Session_setSelf" "', argument " "1"" is NULL"); arg2 = obj1; (arg1)->setSelf(arg2); resultobj = SWIG_Py_Void(); From cd9a44799be93ed195af8adf2dc56e1495bf4a94 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 20 Apr 2021 12:54:36 +0300 Subject: [PATCH 372/655] [mod_python] scan-build: Assigned value is garbage or undefined --- src/mod/languages/mod_python/hack.diff | 28 +++++++++++++++++++ .../languages/mod_python/mod_python_wrap.cpp | 6 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/mod/languages/mod_python/hack.diff b/src/mod/languages/mod_python/hack.diff index 771be152d0..5732630bba 100644 --- a/src/mod/languages/mod_python/hack.diff +++ b/src/mod/languages/mod_python/hack.diff @@ -1,5 +1,33 @@ --- mod_python_wrap.cpp.old 2015-06-16 12:56:23.868000000 -0500 +++ mod_python_wrap.cpp 2015-06-16 12:56:32.268000000 -0500 +@@ -3500,7 +3500,9 @@ SWIG_AsCharArray(PyObject * obj, char *val, size_t size) + if (csize <= size) { + if (val) { + if (csize) memcpy(val, cptr, csize*sizeof(char)); ++#ifndef __clang_analyzer__ + if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); ++#endif + } + if (alloc == SWIG_NEWOBJ) { + delete[] cptr; +@@ -4677,7 +4677,7 @@ SWIGINTERN PyObject *_wrap_DTMF_digit_set(PyObject *SWIGUNUSEDPARM(self), PyObje + char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; +- char val2 ; ++ char val2 = '\0'; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; +@@ -4787,7 +4787,7 @@ SWIGINTERN PyObject *_wrap_new_DTMF(PyObject *SWIGUNUSEDPARM(self), PyObject *ar + PyObject *resultobj = 0; + char arg1 ; + uint32_t arg2 = (uint32_t) SWITCH_DEFAULT_DTMF_DURATION ; +- char val1 ; ++ char val1 = '\0'; + int ecode1 = 0 ; + void *argp2 ; + int res2 = 0 ; @@ -6198,7 +6198,9 @@ } arg3 = static_cast< int >(val3); diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index e8db10c7c0..bd4985bbbe 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -3500,7 +3500,9 @@ SWIG_AsCharArray(PyObject * obj, char *val, size_t size) if (csize <= size) { if (val) { if (csize) memcpy(val, cptr, csize*sizeof(char)); +#ifndef __clang_analyzer__ if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); +#endif } if (alloc == SWIG_NEWOBJ) { delete[] cptr; @@ -4677,7 +4679,7 @@ SWIGINTERN PyObject *_wrap_DTMF_digit_set(PyObject *SWIGUNUSEDPARM(self), PyObje char arg2 ; void *argp1 = 0 ; int res1 = 0 ; - char val2 ; + char val2 = '\0'; int ecode2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -4787,7 +4789,7 @@ SWIGINTERN PyObject *_wrap_new_DTMF(PyObject *SWIGUNUSEDPARM(self), PyObject *ar PyObject *resultobj = 0; char arg1 ; uint32_t arg2 = (uint32_t) SWITCH_DEFAULT_DTMF_DURATION ; - char val1 ; + char val1 = '\0'; int ecode1 = 0 ; void *argp2 ; int res2 = 0 ; From 3447daea46a0d17a04b1c98dbdfeb3c2f3e7e449 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 22 Apr 2021 23:33:01 +0300 Subject: [PATCH 373/655] [mod_sofia] Destroy session after relaying notify result on proxy refer. --- 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 5de26b1d00..1637cff924 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1429,6 +1429,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi SIPTAG_PAYLOAD_STR(msg->string_arg), TAG_IF(!zstr(session_id_header), SIPTAG_HEADER_STR(session_id_header)), SIPTAG_EVENT_STR("refer"), TAG_END()); + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BLIND_TRANSFER); goto end; } From 90b85ce4cdc05b1e906c53c1916d98912f460847 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 30 Apr 2021 15:38:41 +0300 Subject: [PATCH 374/655] [mod_commands] Fix leak of a timer object in timer_test --- src/mod/applications/mod_commands/mod_commands.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 8c185bcb12..955f80ae33 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -967,6 +967,10 @@ SWITCH_STANDARD_API(timer_test_function) stream->write_function(stream, "Avg: %0.3fms Total Time: %0.3fms\n", (float) ((float) (total / (x - 1)) / 1000), (float) ((float) (end - start) / 1000)); + if (switch_core_timer_destroy(&timer) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "Timer Destroy Error!\n"); + } + end: switch_core_destroy_memory_pool(&pool); From c8413bb77c104711a52cc4da0ce54581fed5c983 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Fri, 30 Apr 2021 14:13:15 +0000 Subject: [PATCH 375/655] [mod_http_cache] fix race cond at shutdown --- src/mod/applications/mod_http_cache/mod_http_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 3e6d1b0fa8..d6f4fb6ed8 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -781,7 +781,7 @@ static char *url_cache_get(url_cache_t *cache, http_profile_t *profile, switch_c switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Waiting for URL %s to be available\n", url); u->waiters++; url_cache_unlock(cache, session); - while(u->status == CACHED_URL_RX_IN_PROGRESS && switch_time_now() < (u->download_time + download_timeout_ns)) { + while(!gcache.shutdown && u->status == CACHED_URL_RX_IN_PROGRESS && switch_time_now() < (u->download_time + download_timeout_ns)) { switch_sleep(10 * 1000); /* 10 ms */ } url_cache_lock(cache, session); From 3764871c1a391fc45cef18929591e3ec8e575e7f Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Mon, 10 May 2021 20:10:24 +0300 Subject: [PATCH 376/655] [mod_conference] json: MFLAG_DIST_DTMF --- src/mod/applications/mod_conference/mod_conference.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 875d0f9731..1a8aa09e88 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1456,6 +1456,7 @@ void conference_jlist(conference_obj_t *conference, cJSON *json_conferences) ADDBOOL(json_conference_member_flags, "has_floor", member->id == member->conference->floor_holder); ADDBOOL(json_conference_member_flags, "is_moderator", conference_utils_member_test_flag(member, MFLAG_MOD)); ADDBOOL(json_conference_member_flags, "end_conference", conference_utils_member_test_flag(member, MFLAG_ENDCONF)); + ADDBOOL(json_conference_member_flags, "pass_digits", conference_utils_member_test_flag(member, MFLAG_DIST_DTMF)); } switch_mutex_unlock(conference->member_mutex); } From 326edd6b6c7652c2ca45f511a867f08bca8fb471 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 11 May 2021 16:42:23 -0400 Subject: [PATCH 377/655] [mod_ssml] replace strncpy() with snprintf() to fix errors reported by newer compilers. --- src/mod/formats/mod_ssml/mod_ssml.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/mod/formats/mod_ssml/mod_ssml.c b/src/mod/formats/mod_ssml/mod_ssml.c index 633b08dd07..90df8ba8c2 100644 --- a/src/mod/formats/mod_ssml/mod_ssml.c +++ b/src/mod/formats/mod_ssml/mod_ssml.c @@ -472,8 +472,7 @@ static int process_xml_lang(struct ssml_parser *parsed_data, char **atts) while (atts[i]) { if (!strcmp("xml:lang", atts[i])) { if (!zstr(atts[i + 1])) { - strncpy(cur_node->language, atts[i + 1], LANGUAGE_LEN); - cur_node->language[LANGUAGE_LEN - 1] = '\0'; + snprintf(cur_node->language, LANGUAGE_LEN, "%s", atts[i + 1]); } } i += 2; @@ -494,18 +493,15 @@ static int process_voice(struct ssml_parser *parsed_data, char **atts) while (atts[i]) { if (!strcmp("xml:lang", atts[i])) { if (!zstr(atts[i + 1])) { - strncpy(cur_node->language, atts[i + 1], LANGUAGE_LEN); - cur_node->language[LANGUAGE_LEN - 1] = '\0'; + snprintf(cur_node->language, LANGUAGE_LEN, "%s", atts[i + 1]); } } else if (!strcmp("name", atts[i])) { if (!zstr(atts[i + 1])) { - strncpy(cur_node->name, atts[i + 1], NAME_LEN); - cur_node->name[NAME_LEN - 1] = '\0'; + snprintf(cur_node->name, NAME_LEN, "%s", atts[i + 1]); } } else if (!strcmp("gender", atts[i])) { if (!zstr(atts[i + 1])) { - strncpy(cur_node->gender, atts[i + 1], GENDER_LEN); - cur_node->gender[GENDER_LEN - 1] = '\0'; + snprintf(cur_node->gender, GENDER_LEN, "%s", atts[i + 1]); } } i += 2; @@ -633,8 +629,7 @@ static int tag_hook(void *user_data, char *name, char **atts, int type) } new_node->tts_voice = NULL; new_node->say_macro = NULL; - strncpy(new_node->tag_name, name, TAG_LEN); - new_node->tag_name[TAG_LEN - 1] = '\0'; + snprintf(new_node->tag_name, TAG_LEN, "%s", name); parsed_data->cur_node = new_node; result = process_tag(parsed_data, name, atts); } @@ -743,8 +738,7 @@ static int process_cdata_tts(struct ssml_parser *parsed_data, char *data, size_t /* try macro */ to_say = malloc(len + 1); switch_assert(to_say); - strncpy(to_say, data, len); - to_say[len] = '\0'; + snprintf(to_say, len + 1, "%s", data); if (!cur_node->say_macro || !get_file_from_macro(parsed_data, to_say)) { /* use voice instead */ if (!get_file_from_voice(parsed_data, to_say)) { From 729992d5ae6c593e17afb17410ad3db392a61260 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 21 May 2021 01:00:35 +0300 Subject: [PATCH 378/655] [mod_httapi] Avoid using CURLOPT_WRITEFUNCTION for headers --- src/mod/applications/mod_httapi/mod_httapi.c | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 86a05bb258..0b89fd35a7 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2430,6 +2430,13 @@ static char *load_cache_data(http_file_context_t *context, const char *url) return context->cache_file; } +static size_t dummy_save_file_callback(void* ptr, size_t size, size_t nmemb, void* data) +{ + (void)ptr; + (void)data; + return (size * nmemb); +} + static size_t save_file_callback(void *ptr, size_t size, size_t nmemb, void *data) { register unsigned int realsize = (unsigned int) (size * nmemb); @@ -2616,19 +2623,20 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char } else { switch_curl_easy_setopt(curl_handle, CURLOPT_HEADER, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_NOBODY, 1); + + /* Prevent writing the data (headers in this case) to stdout */ + switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, dummy_save_file_callback); + switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, 0); } if (headers) { if (!client->headers) { switch_event_create(&client->headers, SWITCH_EVENT_CLONE); } - if (save_path) { - switch_curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, get_header_callback); - switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, (void *) client); - } else { - switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, get_header_callback); - switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) client); - } + + /* CURLOPT_HEADERFUNCTION guarantees to call the callback for each complete header line, CURLOPT_WRITEFUNCTION does not! */ + switch_curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, get_header_callback); + switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, (void *) client); } if (!zstr(dup_creds)) { From 331e50a77b26ecdf98bed104e713459db418f9bd Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 15 Jun 2021 18:56:19 +0300 Subject: [PATCH 379/655] [Core] Fix MSRP relaying. --- src/switch_core_media.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 0db5a7c95d..d276bc4f1e 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -15754,13 +15754,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT]; - if (!t_engine || !t_engine->tf) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "text engine not available for processing\n"); - switch_goto_status(SWITCH_STATUS_BREAK, done); - } - if (!is_msrp && switch_channel_test_cap(session->channel, CC_RTP_RTT)) { + if (!t_engine || !t_engine->tf) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "text engine not available for processing\n"); + switch_goto_status(SWITCH_STATUS_BREAK, done); + } + if (frame) { char *str = (char *) frame->data; switch_buffer_write(t_engine->tf->write_buffer, str, frame->datalen); @@ -15824,6 +15824,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core if (!is_msrp && switch_channel_test_cap(session->channel, CC_RTP_RTT)) { + if (!t_engine || (t_engine->red_pt && !t_engine->tf)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "text engine not available for processing\n"); + switch_goto_status(SWITCH_STATUS_BREAK, done); + } + if (t_engine->red_pt) { t_engine->tf->red_pos++; if (t_engine->tf->red_pos == t_engine->tf->red_max) { From 68e6ddf82896a0b745cec94e6e2d4338096892b4 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 5 Jun 2021 02:37:58 +0300 Subject: [PATCH 380/655] [Build-System] Add --enable-heap-profiler and --enable-cpu-profiler configure flags. --- configure.ac | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/configure.ac b/configure.ac index 5a7b9f0cbc..73e322a6ca 100644 --- a/configure.ac +++ b/configure.ac @@ -1986,6 +1986,45 @@ if test "${enable_address_sanitizer}" = "yes"; then APR_ADDTO(LDFLAGS, -fsanitize=address) fi +# Enable HEAP profiler (requires libgoogle-perftools-dev package) +AC_ARG_ENABLE(heap_profiler, + [AC_HELP_STRING([--enable-heap-profiler],[build with google heap profiler])], + [enable_heap_profiler="$enable_heap_profiler"], + [enable_heap_profiler="no"]) + +# Enable CPU profiler (requires libgoogle-perftools-dev package) +AC_ARG_ENABLE(cpu_profiler, + [AC_HELP_STRING([--enable-cpu-profiler],[build with google cpu profiler])], + [enable_cpu_profiler="$enable_cpu_profiler"], + [enable_cpu_profiler="no"]) + +PKG_CHECK_MODULES([TCMALLOC], [libtcmalloc], [have_tcmalloc=yes], [have_tcmalloc=no]) + +if test "${enable_heap_profiler}" = "yes" || test "${enable_cpu_profiler}" = "yes"; then + if test "x$have_tcmalloc" != "xyes" ; then + AC_MSG_ERROR([You must install libgoogle-perftools-dev in order to use heap or cpu profiler]) + fi +fi + +# WARNING: When both enabled you can NOT link them statically and MUST use the special library +if test "${enable_heap_profiler}" = "yes" && test "${enable_cpu_profiler}" = "yes"; then + APR_ADDTO(CFLAGS, -ltcmalloc_and_profiler) + APR_ADDTO(CXXFLAGS, -ltcmalloc_and_profiler) + APR_ADDTO(LDFLAGS, -ltcmalloc_and_profiler) +else + if test "${enable_heap_profiler}" = "yes"; then + APR_ADDTO(CFLAGS, -ltcmalloc) + APR_ADDTO(CXXFLAGS, -ltcmalloc) + APR_ADDTO(LDFLAGS, -ltcmalloc) + fi + + if test "${enable_cpu_profiler}" = "yes"; then + APR_ADDTO(CFLAGS, -lprofiler) + APR_ADDTO(CXXFLAGS, -lprofiler) + APR_ADDTO(LDFLAGS, -lprofiler) + fi +fi + # Enable fake dlclose AC_ARG_ENABLE(fake_dlclose, [AC_HELP_STRING([--enable-fake-dlclose],[Do not unload dynamic libraries])], From ea74d2a5d6800c4697abeba41cbe8b9c923972ba Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 23 Jun 2021 00:06:37 +0300 Subject: [PATCH 381/655] [Core] Don't flip CID on recover if that's done already. --- src/switch_channel.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/switch_channel.c b/src/switch_channel.c index 9a57466042..7c5ae934b3 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3220,6 +3220,12 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel) const char *tmp = NULL; switch_mutex_lock(channel->profile_mutex); + + if (switch_channel_test_flag(channel, CF_RECOVERING) && switch_true(switch_channel_get_variable(channel, "channel_cid_flipped"))) { + switch_mutex_unlock(channel->profile_mutex); + return; + } + if (channel->caller_profile->callee_id_name) { tmp = channel->caller_profile->caller_id_name; switch_channel_set_variable(channel, "pre_transfer_caller_id_name", channel->caller_profile->caller_id_name); @@ -3244,6 +3250,8 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel) channel->caller_profile->callee_id_number = tmp; } + switch_channel_set_variable(channel, "channel_cid_flipped", "yes"); + switch_mutex_unlock(channel->profile_mutex); From 392bc26a43995efbe2134cc89a10661603a79e18 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Mon, 28 Jun 2021 14:28:31 +0000 Subject: [PATCH 382/655] [mod_sofia] fix memleak with invalid hostname as gw/proxy --- 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 ae301e9e50..ba9d4d0c71 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -203,12 +203,14 @@ void sofia_reg_unregister(sofia_profile_t *profile) if (gateway_ptr->state == REG_STATE_REGED) { sofia_reg_kill_reg(gateway_ptr); } + sofia_private_free(gateway_ptr->sofia_private); for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) { if (gw_sub_ptr->state == SUB_STATE_SUBED) { sofia_reg_kill_sub(gw_sub_ptr); } + sofia_private_free(gw_sub_ptr->sofia_private); } gateway_ptr->subscriptions = NULL; From 94f437aefc4fe0df002bbfd05c91cc3d486f3c7f Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 30 Jun 2021 20:01:11 +0300 Subject: [PATCH 383/655] [Core] Deprecate RFC 2833 Line flash event code 16 according to RFC 4733 --- src/switch_core_media.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d276bc4f1e..8201c1d86c 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -10011,7 +10011,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", smh->dtmf_ianacodes[i], smh->rates[i]); } else { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-16\r\n", + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-15\r\n", smh->dtmf_ianacodes[i], smh->rates[i], smh->dtmf_ianacodes[i]); } } @@ -10728,7 +10728,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", smh->mparams->te, smh->mparams->te_rate); } else { - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-16\r\n", + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-15\r\n", smh->mparams->te, smh->mparams->te_rate, smh->mparams->te); } } From da15a518f7a040038d50af5f6780e6e09c5ffdb7 Mon Sep 17 00:00:00 2001 From: Brian West <brian@freeswitch.org> Date: Thu, 1 Jul 2021 15:33:01 -0500 Subject: [PATCH 384/655] [mod_conference] Skip dtmf dist to members with skip-dtmf --- src/mod/applications/mod_conference/conference_member.c | 4 ++++ src/mod/applications/mod_conference/conference_utils.c | 2 ++ src/mod/applications/mod_conference/mod_conference.h | 1 + 3 files changed, 7 insertions(+) diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index f9c036baec..6df96fca97 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -1399,6 +1399,10 @@ void conference_member_send_all_dtmf(conference_member_t *member, conference_obj if (imember->id == member->id) { continue; } + if (conference_utils_member_test_flag(imember, MFLAG_SKIP_DTMF)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Skipping dist-dtmf to member due to skip-dtmf flag.\n"); + continue; + } if (imember->session) { const char *p; for (p = dtmf; p && *p; p++) { diff --git a/src/mod/applications/mod_conference/conference_utils.c b/src/mod/applications/mod_conference/conference_utils.c index eb482b9165..c8dd0fd4e9 100644 --- a/src/mod/applications/mod_conference/conference_utils.c +++ b/src/mod/applications/mod_conference/conference_utils.c @@ -124,6 +124,8 @@ void conference_utils_set_mflags(const char *flags, member_flag_t *f) f[MFLAG_MUTE_DETECT] = 1; } else if (!strcasecmp(argv[i], "dist-dtmf")) { f[MFLAG_DIST_DTMF] = 1; + } else if (!strcasecmp(argv[i], "skip-dtmf")) { + f[MFLAG_SKIP_DTMF] = 1; } else if (!strcasecmp(argv[i], "moderator")) { f[MFLAG_MOD] = 1; } else if (!strcasecmp(argv[i], "nomoh")) { diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index e44d9589b6..2131df99c3 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -214,6 +214,7 @@ typedef enum { MFLAG_VIDEO_JOIN, MFLAG_DED_VID_LAYER, MFLAG_HOLD, + MFLAG_SKIP_DTMF, /////////////////////////// MFLAG_MAX } member_flag_t; From 31970d51fde57944be94b334fdc0df234efffc93 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 7 Jul 2021 12:47:33 +0000 Subject: [PATCH 385/655] [core] MSRP: fix memleak (ssl) --- src/switch_msrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_msrp.c b/src/switch_msrp.c index 6a75945874..b76a043261 100644 --- a/src/switch_msrp.c +++ b/src/switch_msrp.c @@ -1413,7 +1413,7 @@ end: if (!client_mode) switch_core_destroy_memory_pool(&pool); - if (client_mode && ssl) SSL_free(ssl); + if (ssl) SSL_free(ssl); if (msrp_session) msrp_session->running = 0; From 8eaf6911dc5cb58ceae14510093b7b478f66f495 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Fri, 9 Jul 2021 14:38:36 +0000 Subject: [PATCH 386/655] [mod_sofia] unit-tests fix - don't run shaken tests if lib not installed. --- src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c | 2 ++ 1 file changed, 2 insertions(+) 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 e769057363..9d1a7d3fee 100644 --- a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c +++ b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c @@ -112,6 +112,7 @@ FST_TEST_BEGIN(originate_test) } FST_TEST_END() +#if HAVE_STIRSHAKEN FST_TEST_BEGIN(sofia_verify_identity_test_no_identity) { switch_core_session_t *session = NULL; @@ -255,6 +256,7 @@ FST_TEST_BEGIN(sofia_auth_identity_test_attest_a_date) switch_sleep(10 * 1000 * 1000); } FST_TEST_END() +#endif FST_MODULE_END() From a065460e5f4c7407729d712d934b868f37c350ed Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 14 Jul 2021 23:05:59 +0300 Subject: [PATCH 387/655] [Core] Fix possible deadlock of an rtp_session in handle_ice() --- src/switch_rtp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index f2c5bf7405..36bd904e77 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1151,8 +1151,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d if (!host || !port) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error setting remote host!\n"); - switch_mutex_unlock(rtp_session->ice_mutex); - return; + goto end; } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, @@ -1176,8 +1175,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d if (switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !ice->addr) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error setting remote host!\n"); - switch_mutex_unlock(rtp_session->ice_mutex); - return; + goto end; } if ((rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST)) { From 76e8c5cc5793190fe58e968379259209d5819292 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 26 Jul 2021 17:09:53 +0300 Subject: [PATCH 388/655] [mod_sofia] Fix possible nua handle leak in sofia_handle_sip_i_refer() --- src/mod/endpoints/mod_sofia/sofia.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 6e6bce2827..25e3278c97 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -9047,6 +9047,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t int deny_refer_requests = 0; if (!(b_session = switch_core_session_locate(b_private->uuid))) { + nua_handle_unref_user(bnh); goto done; } b_tech_pvt = (private_object_t *) switch_core_session_get_private(b_session); @@ -9402,7 +9403,6 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t } switch_core_session_rwunlock(b_session); } - nua_handle_unref_user(bnh); } else { /* the other channel is on a different box, we have to go find them */ if (exten && (br_a = switch_channel_get_partner_uuid(channel_a))) { switch_core_session_t *a_session; @@ -9592,6 +9592,8 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t TAG_END()); } } + + if (bnh) nua_handle_unref_user(bnh); goto done; } From 6040f3bf487eac8dd3bee042cc69a20caa466561 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@freeswitch.org> Date: Sat, 23 Feb 2019 02:40:28 +0300 Subject: [PATCH 389/655] [Core] Fix ICE and media delay. --- src/switch_rtp.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 36bd904e77..12360c522c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -266,6 +266,7 @@ typedef struct { uint8_t sending; uint8_t ready; uint8_t rready; + uint8_t init; int missed_count; char last_sent_id[13]; switch_time_t last_ok; @@ -965,7 +966,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d rtp_session->first_stun = rtp_session->last_stun; } - if (ice->last_ok) { + if (ice->last_ok && (!rtp_session->dtls || rtp_session->dtls->state == DS_READY)) { ref_point = ice->last_ok; } else { ref_point = rtp_session->first_stun; @@ -1256,19 +1257,29 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d port2 = switch_sockaddr_get_port(ice->addr); cmp = switch_cmp_addr(from_addr, ice->addr, SWITCH_FALSE); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG4, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG2, "STUN from %s:%d %s\n", host, port, cmp ? "EXPECTED" : "IGNORED"); + if (ice->init && !cmp && switch_cmp_addr(from_addr, ice->addr, SWITCH_TRUE)) { + do_adj++; + rtp_session->ice_adj++; + rtp_session->wrong_addrs = 0; + ice->init = 0; + } + if (cmp) { ice->last_ok = now; rtp_session->wrong_addrs = 0; } else { - if (((rtp_session->dtls && rtp_session->dtls->state != DS_READY) || !ice->ready || !ice->rready) && - (rtp_session->wrong_addrs > 2 || switch_cmp_addr(from_addr, ice->addr, SWITCH_TRUE)) && rtp_session->ice_adj == 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10, "ICE %d dt:%d i:%d i2:%d w:%d cmp:%d adj:%d\n", elapsed, (rtp_session->dtls && rtp_session->dtls->state != DS_READY), !ice->ready, !ice->rready, rtp_session->wrong_addrs, switch_cmp_addr(from_addr, ice->addr, SWITCH_TRUE), rtp_session->ice_adj); + + if ((rtp_session->dtls && rtp_session->dtls->state != DS_READY) || + ((!ice->ready || !ice->rready) && (rtp_session->wrong_addrs > 2 || switch_cmp_addr(from_addr, ice->addr, SWITCH_TRUE)) && + rtp_session->ice_adj < 10)) { do_adj++; - rtp_session->ice_adj = 1; + rtp_session->ice_adj++; rtp_session->wrong_addrs = 0; - } else if (rtp_session->wrong_addrs > 10 || elapsed >= 10000) { + } else if (rtp_session->wrong_addrs > 10 || elapsed >= 5000) { do_adj++; } @@ -5040,6 +5051,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio ice->pass = ""; ice->rpass = ""; ice->next_run = switch_micro_time_now(); + ice->init = 1; if (password) { ice->pass = switch_core_strdup(rtp_session->pool, password); From fcaaf20c7dd8ac946dc0dda314e2c77f672f98e9 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 12 Aug 2021 18:02:41 +0300 Subject: [PATCH 390/655] [Core] switch_ivr: Restrict the misuse of uuid_hold API. Add switch_hold unit-test. --- .../applications/mod_commands/mod_commands.c | 2 + src/switch_ivr.c | 39 ++++- tests/unit/.gitignore | 1 + tests/unit/Makefile.am | 1 + tests/unit/conf_hold/freeswitch.xml | 157 ++++++++++++++++++ tests/unit/conf_hold/gw/holdtest.xml | 14 ++ tests/unit/switch_hold.c | 105 ++++++++++++ 7 files changed, 311 insertions(+), 8 deletions(-) create mode 100644 tests/unit/conf_hold/freeswitch.xml create mode 100644 tests/unit/conf_hold/gw/holdtest.xml create mode 100644 tests/unit/switch_hold.c diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 955f80ae33..b5f7f5ff8e 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -7896,6 +7896,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_getvar ::console::list_uuid"); switch_console_set_complete("add uuid_hold ::console::list_uuid"); + switch_console_set_complete("add uuid_hold off ::console::list_uuid"); + switch_console_set_complete("add uuid_hold toggle ::console::list_uuid"); switch_console_set_complete("add uuid_send_info ::console::list_uuid"); switch_console_set_complete("add uuid_jitterbuffer ::console::list_uuid"); switch_console_set_complete("add uuid_kill ::console::list_uuid"); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 4f9d2d0cbd..ddd3a8e529 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1530,6 +1530,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, const char *other_uuid; switch_event_t *event; + if (channel) { + switch_channel_callstate_t callstate; + + callstate = switch_channel_get_callstate(channel); + if (callstate == CCS_HELD) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Call is already on hold. No need to hold again.\n"); + return SWITCH_STATUS_FALSE; + } + } + msg.message_id = SWITCH_MESSAGE_INDICATE_HOLD; msg.string_arg = message; msg.from = __FILE__; @@ -1557,13 +1567,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const char *message, switch_bool_t moh) { switch_core_session_t *session; + switch_status_t status = SWITCH_STATUS_SUCCESS; if ((session = switch_core_session_locate(uuid))) { - switch_ivr_hold(session, message, moh); + status = switch_ivr_hold(session, message, moh); switch_core_session_rwunlock(session); } - return SWITCH_STATUS_SUCCESS; + return status; } SWITCH_DECLARE(switch_status_t) switch_ivr_hold_toggle_uuid(const char *uuid, const char *message, switch_bool_t moh) @@ -1571,21 +1582,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold_toggle_uuid(const char *uuid, co switch_core_session_t *session; switch_channel_t *channel; switch_channel_callstate_t callstate; + switch_status_t status = SWITCH_STATUS_SUCCESS; if ((session = switch_core_session_locate(uuid))) { if ((channel = switch_core_session_get_channel(session))) { callstate = switch_channel_get_callstate(channel); - if (callstate == CCS_ACTIVE) { - switch_ivr_hold(session, message, moh); + if (callstate == CCS_ACTIVE || callstate == CCS_UNHELD) { + status = switch_ivr_hold(session, message, moh); } else if (callstate == CCS_HELD) { - switch_ivr_unhold(session); + status = switch_ivr_unhold(session); } } switch_core_session_rwunlock(session); } - return SWITCH_STATUS_SUCCESS; + return status; } SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session) @@ -1596,6 +1608,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session switch_core_session_t *b_session; switch_event_t *event; + if (channel) { + switch_channel_callstate_t callstate; + + callstate = switch_channel_get_callstate(channel); + if (callstate != CCS_HELD) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Call is not on hold. No need to unhold.\n"); + return SWITCH_STATUS_FALSE; + } + } + msg.message_id = SWITCH_MESSAGE_INDICATE_UNHOLD; msg.from = __FILE__; @@ -1624,13 +1646,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session SWITCH_DECLARE(switch_status_t) switch_ivr_unhold_uuid(const char *uuid) { switch_core_session_t *session; + switch_status_t status = SWITCH_STATUS_SUCCESS; if ((session = switch_core_session_locate(uuid))) { - switch_ivr_unhold(session); + status = switch_ivr_unhold(session); switch_core_session_rwunlock(session); } - return SWITCH_STATUS_SUCCESS; + return status; } diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore index 66ea66aa06..4c7b7466c4 100644 --- a/tests/unit/.gitignore +++ b/tests/unit/.gitignore @@ -22,6 +22,7 @@ switch_core_video switch_eavesdrop switch_event switch_hash +switch_hold switch_ivr_async switch_ivr_originate switch_ivr_play_say diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index ee2e92b175..3f41d71dda 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -4,6 +4,7 @@ noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils swi switch_ivr_play_say switch_core_codec switch_rtp switch_xml 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 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_hold/freeswitch.xml b/tests/unit/conf_hold/freeswitch.xml new file mode 100644 index 0000000000..883e3846e1 --- /dev/null +++ b/tests/unit/conf_hold/freeswitch.xml @@ -0,0 +1,157 @@ +<?xml version="1.0"?> +<document type="freeswitch/xml"> + <X-PRE-PROCESS cmd="exec-set" data="test=echo 1234"/> + <X-PRE-PROCESS cmd="set" data="default_password=$${test}"/> + <X-PRE-PROCESS cmd="set" data="core_video_blank_image=$${conf_dir}/freeswitch-logo.png"/> + <section name="configuration" description="Various Configuration"> + <configuration name="modules.conf" description="Modules"> + <modules> + <load module="mod_sofia"/> + <load module="mod_console"/> + <load module="mod_loopback"/> + <load module="mod_commands"/> + <load module="mod_dptools"/> + <load module="mod_dialplan_xml"/> + <load module="mod_tone_stream"/> + <load module="mod_commands"/> + <load module="mod_sndfile"/> + </modules> + </configuration> + + <configuration name="console.conf" description="Console Logger"> + <mappings> + <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/> + </mappings> + <settings> + <param name="colorize" value="true"/> + <param name="loglevel" value="debug"/> + </settings> + </configuration> + + <configuration name="timezones.conf" description="Timezones"> + <timezones> + <zone name="GMT" value="GMT0" /> + </timezones> + </configuration> + + <configuration name="sofia.conf" description="SofiaSIP"> + <profiles> + <profile name="external"> + <gateways> + + <gateway name="hold_unhold_test"> + <param name="username" value="not-used"/> + <param name="password" value="not-used"/> + <param name="proxy" value="$${local_ip_v4}:61068"/> + <param name="register" value="false"/> + <param name="retry-seconds" value="30"/> + <param name="dtmf-type" value="rfc2833"/> + <variables> + <variable name="rtp_secure_media" value="false" direction="outbound"/> + </variables> + </gateway> + </gateways> + + <domains> + <domain name="all" alias="false" parse="true"/> + </domains> + + <settings> + <param name="debug" value="1"/> + <param name="shutdown-on-fail" value="true"/> + <param name="p-asserted-id-parse" value="verbatim"/> + <param name="username" value="SignalWire-STACK"/> + <param name="user-agent-string" value="SignalWire STACK Unit Test"/> + <param name="sip-trace" value="yes"/> + <param name="sip-capture" value="no"/> + <param name="rfc2833-pt" value="101"/> + <param name="sip-port" value="61068"/> + <param name="dialplan" value="XML"/> + <param name="context" value="default"/> + <param name="dtmf-duration" value="2000"/> + <param name="inbound-codec-prefs" value="PCMU"/> + <param name="outbound-codec-prefs" value="PCMU"/> + <param name="rtp-timer-name" value="soft"/> + <param name="local-network-acl" value="localnet.auto"/> + <param name="manage-presence" value="false"/> + <param name="inbound-codec-negotiation" value="generous"/> + <param name="nonce-ttl" value="60"/> + <param name="inbound-late-negotiation" value="true"/> + <param name="inbound-zrtp-passthru" value="false"/> + <param name="rtp-ip" value="$${local_ip_v4}"/> + <param name="sip-ip" value="$${local_ip_v4}"/> + <param name="ext-rtp-ip" value="$${local_ip_v4}"/> + <param name="ext-sip-ip" value="$${local_ip_v4}"/> + <param name="rtp-timeout-sec" value="300"/> + <param name="rtp-hold-timeout-sec" value="1800"/> + <param name="session-timeout" value="600"/> + <param name="minimum-session-expires" value="90"/> + <param name="tls" value="false"/> + </settings> + </profile> + + <profile name="internal"> + <gateways> + </gateways> + + <domains> + <domain name="all" alias="false" parse="true"/> + </domains> + + <settings> + <param name="debug" value="1"/> + <param name="shutdown-on-fail" value="true"/> + <param name="p-asserted-id-parse" value="verbatim"/> + <param name="username" value="SignalWire-STACK"/> + <param name="user-agent-string" value="SignalWire STACK Unit Test"/> + <param name="sip-trace" value="yes"/> + <param name="sip-capture" value="no"/> + <param name="rfc2833-pt" value="101"/> + <param name="sip-port" value="61069"/> + <param name="dialplan" value="XML"/> + <param name="context" value="default"/> + <param name="dtmf-duration" value="2000"/> + <param name="inbound-codec-prefs" value="PCMU"/> + <param name="outbound-codec-prefs" value="PCMU"/> + <param name="rtp-timer-name" value="soft"/> + <param name="local-network-acl" value="localnet.auto"/> + <param name="manage-presence" value="false"/> + <param name="inbound-codec-negotiation" value="generous"/> + <param name="nonce-ttl" value="60"/> + <param name="inbound-late-negotiation" value="true"/> + <param name="inbound-zrtp-passthru" value="false"/> + <param name="rtp-ip" value="$${local_ip_v4}"/> + <param name="sip-ip" value="$${local_ip_v4}"/> + <param name="ext-rtp-ip" value="$${local_ip_v4}"/> + <param name="ext-sip-ip" value="$${local_ip_v4}"/> + <param name="rtp-timeout-sec" value="300"/> + <param name="rtp-hold-timeout-sec" value="1800"/> + <param name="session-timeout" value="600"/> + <param name="minimum-session-expires" value="90"/> + <param name="tls" value="false"/> + </settings> + </profile> + + </profiles> + </configuration> + + <configuration name="switch.conf" description="Switch"> + <param name="rtp-start-port" value="20000"/> + <param name="rtp-end-port" value="30000"/> + <param name="threaded-system-exec" value="true"/> + </configuration> + </section> + + <section name="dialplan" description="Regex/XML Dialplan"> + <context name="default"> + <extension name="one"> + <condition field="destination_number" expression="^\+15553332900$"> + <action application="set" data="absolute_codec_string=PCMU@20i"/> + <action application="info"/> + <action application="answer"/> + <action application="park""/> + </condition> + </extension> + </context> + </section> +</document> diff --git a/tests/unit/conf_hold/gw/holdtest.xml b/tests/unit/conf_hold/gw/holdtest.xml new file mode 100644 index 0000000000..d919ddb2d4 --- /dev/null +++ b/tests/unit/conf_hold/gw/holdtest.xml @@ -0,0 +1,14 @@ +<include/> + <gateway name="hold_unhold_test"> + <param name="username" value="not-used"/> + <param name="password" value="not-used"/> + <param name="proxy" value="127.0.0.1"/> + <param name="register" value="false"/> + <param name="retry-seconds" value="30"/> + <param name="dtmf-type" value="rfc2833"/> + <variables> + <variable name="rtp_secure_media" value="false" direction="outbound"/> + </variables> + </gateway> +</include> + diff --git a/tests/unit/switch_hold.c b/tests/unit/switch_hold.c new file mode 100644 index 0000000000..9da8ccfc94 --- /dev/null +++ b/tests/unit/switch_hold.c @@ -0,0 +1,105 @@ +#include <switch.h> +#include <test/switch_test.h> + +FST_CORE_DB_BEGIN("./conf_hold") +{ +FST_SUITE_BEGIN(switch_hold) +{ + FST_SETUP_BEGIN() + { + fst_requires_module("mod_sofia"); + fst_requires_module("mod_commands"); + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(hold_unhold_restriction) + { + switch_core_session_t *session = NULL; + switch_status_t status; + switch_call_cause_t cause; + + status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/hold_unhold_test/+15553332900", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_requires(session); + fst_check(status == SWITCH_STATUS_SUCCESS); + + if (session) { + const char *uuid = switch_core_session_get_uuid(session); + switch_channel_t *channel = NULL; + + channel = switch_core_session_get_channel(session); + fst_requires(channel); + + if (uuid) { + char *off_uuid = switch_mprintf("off %s", uuid); + char *toggle_uuid = switch_mprintf("toggle %s", uuid); + + switch_stream_handle_t stream = { 0 }; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "firing the api.\n"); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_hold", off_uuid, NULL, &stream); + fst_check_string_equals(stream.data, "-ERR Operation failed\n"); + switch_safe_free(stream.data); + switch_sleep(200000); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_hold", uuid, NULL, &stream); + fst_check_string_equals(stream.data, "+OK Success\n"); + switch_safe_free(stream.data); + switch_sleep(200000); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_hold", uuid, NULL, &stream); + fst_check_string_equals(stream.data, "-ERR Operation failed\n"); + switch_safe_free(stream.data); + switch_sleep(200000); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_hold", uuid, NULL, &stream); + fst_check_string_equals(stream.data, "-ERR Operation failed\n"); + switch_safe_free(stream.data); + switch_sleep(200000); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_hold", toggle_uuid, NULL, &stream); + fst_check_string_equals(stream.data, "+OK Success\n"); + switch_safe_free(stream.data); + switch_sleep(200000); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_hold", off_uuid, NULL, &stream); + fst_check_string_equals(stream.data, "-ERR Operation failed\n"); + switch_safe_free(stream.data); + switch_sleep(200000); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_hold", toggle_uuid, NULL, &stream); + fst_check_string_equals(stream.data, "+OK Success\n"); + switch_safe_free(stream.data); + switch_sleep(200000); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("uuid_hold", uuid, NULL, &stream); + fst_check_string_equals(stream.data, "-ERR Operation failed\n"); + switch_safe_free(stream.data); + switch_sleep(200000); + + switch_safe_free(off_uuid); + switch_safe_free(toggle_uuid); + } + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + } + } + FST_TEST_END() +} +FST_SUITE_END() +} +FST_CORE_END() + From 01d805d5a0328402bad573b479252551b4ae8ab0 Mon Sep 17 00:00:00 2001 From: Brian West <brian@freeswitch.org> Date: Wed, 18 Aug 2021 15:16:55 +0000 Subject: [PATCH 391/655] [mod_sofia] Map 607 to CAUSE_UNWANTED and add 608 to CALL_REJECTED --- src/mod/endpoints/mod_sofia/sofia_glue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 644848a010..9fd0cea4e9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1813,8 +1813,10 @@ switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status) case 403: case 407: case 603: - case 607: + case 608: return SWITCH_CAUSE_CALL_REJECTED; + case 607: + return SWITCH_CAUSE_UNWANTED; case 404: return SWITCH_CAUSE_UNALLOCATED_NUMBER; case 485: From f283b1227e22298c569252d779beed9fca898207 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 11 Jan 2021 23:51:43 +0300 Subject: [PATCH 392/655] [Core] switch_core_media: copy telephony event over on 3rd party response. --- src/switch_core_media.c | 54 ++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 8201c1d86c..69b0fc4cef 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -9916,13 +9916,26 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, } if (smh->mparams->dtmf_type == DTMF_2833 && smh->mparams->te > 95) { - int i; - for (i = 0; i < smh->num_rates; i++) { - if (smh->dtmf_ianacodes[i]) { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->dtmf_ianacodes[i]); + if (sdp_type == SDP_TYPE_RESPONSE) { + switch_rtp_engine_t *a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; + if (a_engine) { + payload_map_t *pmap; + for (pmap = a_engine->payload_map; pmap; pmap = pmap->next) { + if (!strncasecmp(pmap->iananame, "telephone-event", 15)) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", pmap->pt); + } + } } - if (smh->cng_ianacodes[i] && !switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && cng_type && use_cng) { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->cng_ianacodes[i]); + } else { + int i; + + for (i = 0; i < smh->num_rates; i++) { + if (smh->dtmf_ianacodes[i]) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->dtmf_ianacodes[i]); + } + if (smh->cng_ianacodes[i] && !switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && cng_type && use_cng) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->cng_ianacodes[i]); + } } } } @@ -10005,14 +10018,27 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, if ((smh->mparams->dtmf_type == DTMF_2833 || switch_channel_test_flag(session->channel, CF_LIBERAL_DTMF)) && smh->mparams->te > 95) { - - for (i = 0; i < smh->num_rates; i++) { - if (switch_channel_test_flag(session->channel, CF_AVPF)) { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", - smh->dtmf_ianacodes[i], smh->rates[i]); - } else { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-15\r\n", - smh->dtmf_ianacodes[i], smh->rates[i], smh->dtmf_ianacodes[i]); + if (smh->mparams->dtmf_type == DTMF_2833 && sdp_type == SDP_TYPE_RESPONSE) { + switch_rtp_engine_t *a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; + if (a_engine) { + payload_map_t *pmap; + for (pmap = a_engine->payload_map; pmap; pmap = pmap->next) { + if (!strncasecmp(pmap->iananame, "telephone-event", 15)) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", + pmap->pt, pmap->rate); + } + } + } + } else { + for (i = 0; i < smh->num_rates; i++) { + if (switch_channel_test_flag(session->channel, CF_AVPF)) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", + smh->dtmf_ianacodes[i], smh->rates[i]); + } + else { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-15\r\n", + smh->dtmf_ianacodes[i], smh->rates[i], smh->dtmf_ianacodes[i]); + } } } } From f2bb1aba6686b73ae8f6393c92adbe71948aa950 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 30 Jun 2021 19:48:34 +0300 Subject: [PATCH 393/655] [Core] Fix duplicates in SDP --- src/switch_core_media.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 69b0fc4cef..24497b7df1 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -9903,15 +9903,11 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, } } - if (smh->ianacodes[i] < 128) { - if (already_did[smh->ianacodes[i]]) { - continue; - } - - already_did[smh->ianacodes[i]] = 1; + if (smh->ianacodes[i] >= 128 || already_did[smh->ianacodes[i]]) { + continue; } - + already_did[smh->ianacodes[i]] = 1; switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->ianacodes[i]); } @@ -9921,8 +9917,13 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, if (a_engine) { payload_map_t *pmap; for (pmap = a_engine->payload_map; pmap; pmap = pmap->next) { + if (pmap->pt >= 128 || already_did[pmap->pt]) { + continue; + } + if (!strncasecmp(pmap->iananame, "telephone-event", 15)) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", pmap->pt); + already_did[pmap->pt] = 1; } } } @@ -9930,11 +9931,13 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, int i; for (i = 0; i < smh->num_rates; i++) { - if (smh->dtmf_ianacodes[i]) { + if (smh->dtmf_ianacodes[i] < 128 && !already_did[smh->dtmf_ianacodes[i]]) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->dtmf_ianacodes[i]); + already_did[smh->dtmf_ianacodes[i]] = 1; } - if (smh->cng_ianacodes[i] && !switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && cng_type && use_cng) { + if (smh->cng_ianacodes[i] < 128 && !already_did[smh->cng_ianacodes[i]] && !switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && cng_type && use_cng) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->cng_ianacodes[i]); + already_did[smh->cng_ianacodes[i]] = 1; } } } @@ -9975,14 +9978,11 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, } } - if (smh->ianacodes[i] < 128) { - if (already_did[smh->ianacodes[i]]) { - continue; - } - - already_did[smh->ianacodes[i]] = 1; + if (smh->ianacodes[i] >= 128 || already_did[smh->ianacodes[i]]) { + continue; } + already_did[smh->ianacodes[i]] = 1; rate = imp->samples_per_second; if (map) { From d17863274863c4f219cc6b803bf79c4f6a5ec503 Mon Sep 17 00:00:00 2001 From: dhruvecosmob <dhruv.gupta@ecosmob.com> Date: Fri, 27 Aug 2021 13:44:49 +0300 Subject: [PATCH 394/655] [mod_sofia] Add a unit-test for the 3pcc telephone event. --- .../mod_sofia/test/conf-sipp/freeswitch.xml | 7 + .../mod_sofia/test/sipp-based-tests.c | 124 +++++++++++++- .../sipp-scenarios/uac_telephone_event.xml | 159 ++++++++++++++++++ 3 files changed, 281 insertions(+), 9 deletions(-) create mode 100644 src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_telephone_event.xml diff --git a/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml index f75764a5f0..d20625f77f 100644 --- a/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml +++ b/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml @@ -584,6 +584,13 @@ </condition> </extension> + <extension name="sipp_telephone_check"> + <condition field="destination_number" expression="^1212121212$"> + <action application="answer"/> + <action application="set" data="park_after_bridge=true"/> + <action application="park"/> + </condition> + </extension> <extension name="sipp"> <condition> 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 5f24da0fa8..3f591754fe 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -37,6 +37,23 @@ int test_success = 0; int test_sofia_debug = 1; +static const char *test_wait_for_chan_var(switch_channel_t *channel, const char *seq) +{ + int loop_count = 50; + const char *var=NULL; + do { + if (!strcmp(switch_channel_get_variable(channel, "sip_cseq"),seq)){ + switch_sleep(100 * 1000); + var = switch_channel_get_variable(channel, "rtp_local_sdp_str"); + break; + } + + switch_sleep(100 * 1000); + } while(loop_count--); + + return var; +} + static switch_bool_t has_ipv6() { switch_stream_handle_t stream = { 0 }; @@ -73,9 +90,9 @@ static void unregister_gw() switch_safe_free(stream.data); } -static int start_sipp_uac(const char *ip, int remote_port,const char *scenario_uac, const char *extra) +static int start_sipp_uac(const char *ip, int remote_port, const char *dialed_number, const char *scenario_uac, const char *extra) { - char *cmd = switch_mprintf("sipp %s:%d -nr -p 5062 -m 1 -s 1001 -recv_timeout 10000 -timeout 10s -sf %s -bg %s", ip, remote_port, scenario_uac, extra); + char *cmd = switch_mprintf("sipp %s:%d -nr -p 5062 -m 1 -s %s -recv_timeout 10000 -timeout 10s -sf %s -bg %s", ip, remote_port, dialed_number, scenario_uac, extra); int sys_ret = switch_system(cmd, SWITCH_TRUE); printf("%s\n", cmd); @@ -199,9 +216,98 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) } FST_TEARDOWN_END() + FST_TEST_BEGIN(uac_telephone_event_check) + { + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + char *channel_data = NULL; + char uuid[100] = ""; + int sipp_ret; + int sdp_count = 0 , loop_count =50; + switch_stream_handle_t stream = { 0 }; + + sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1212121212", "sipp-scenarios/uac_telephone_event.xml", ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } + + do { + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("show", "channels", NULL, &stream); + if (!strncmp((char *)stream.data, "uuid,", 5)) { + channel_data = switch_mprintf("%s", (char *)stream.data); + switch_safe_free(stream.data); + break; + } + + switch_safe_free(stream.data); + switch_sleep(100 * 1000); + } while (loop_count--); + + if (channel_data) { + char *temp = NULL; + int i; + + if ((temp = strchr(channel_data, '\n'))) { + temp++; + for (i = 0; temp[i] != ',' && i < 99; i++){ + uuid[i] = temp[i]; + } + uuid[i] = '\0'; + } + + if (!zstr(uuid)) { + switch_core_session_t *session = switch_core_session_locate(uuid); + switch_channel_t *channel; + const char *sdp_str1 = NULL, *sdp_str2 = NULL; + + fst_requires(session); + channel = switch_core_session_get_channel(session); + + sdp_str1 = test_wait_for_chan_var(channel,"1"); + sdp_str2 = test_wait_for_chan_var(channel,"2"); + + if (sdp_str1 && sdp_str2 && (strstr(sdp_str1,"telephone-event")) && (strstr(sdp_str2,"telephone-event"))){ + temp = NULL; + sdp_count = 1; + + if ((temp = strstr(sdp_str2,"RTP/AVP"))) { + int count = 0; + + for (i = 7; temp[i] != '\n' && i < 99; i++) { + /* checking for payload-type 101.*/ + if(temp[i++] == '1' && temp[i++] == '0' && temp[i++] == '1') { + count++; + } + } + + if (count > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Duplicate entry of payload in SDP.\n"); + sdp_count = 0; + } + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Telephone-event missing in SDP.\n"); + } + + switch_core_session_rwunlock(session); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Uuid not found in Channel Data.\n"); + } + + free(channel_data); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find Channel Data.\n"); + } + + fst_check(sdp_count == 1); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + } + FST_TEST_END() + FST_TEST_BEGIN(uac_digest_leak_udp) { - switch_core_session_t *session; + switch_core_session_t *session; switch_call_cause_t cause; switch_status_t status; switch_channel_t *channel; @@ -211,7 +317,7 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler, NULL); status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); - sipp_ret = start_sipp_uac(local_ip_v4, 5080, "sipp-scenarios/uac_digest_leak.xml", ""); + sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1001", "sipp-scenarios/uac_digest_leak.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { fst_requires(0); /* sipp not found */ } @@ -250,7 +356,7 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) FST_TEST_BEGIN(uac_digest_leak_tcp) { - switch_core_session_t *session; + switch_core_session_t *session; switch_call_cause_t cause; switch_status_t status; switch_channel_t *channel; @@ -260,7 +366,7 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler, NULL); status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); - sipp_ret = start_sipp_uac(local_ip_v4, 5080, "sipp-scenarios/uac_digest_leak-tcp.xml", "-t t1"); + sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1001", "sipp-scenarios/uac_digest_leak-tcp.xml", "-t t1"); if (sipp_ret < 0 || sipp_ret == 127) { fst_requires(0); /* sipp not found */ } @@ -299,7 +405,7 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) FST_TEST_BEGIN(uac_digest_leak_udp_ipv6) { - switch_core_session_t *session; + switch_core_session_t *session; switch_call_cause_t cause; switch_status_t status; switch_channel_t *channel; @@ -318,9 +424,9 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); if (!ipv6) { - sipp_ret = start_sipp_uac(local_ip_v6, 6060, "sipp-scenarios/uac_digest_leak-ipv6.xml", "-i [::1]"); + sipp_ret = start_sipp_uac(local_ip_v6, 6060, "1001", "sipp-scenarios/uac_digest_leak-ipv6.xml", "-i [::1]"); } else { - sipp_ret = start_sipp_uac(ipv6, 6060, "sipp-scenarios/uac_digest_leak-ipv6.xml", "-i [::1] -mi [::1]"); + sipp_ret = start_sipp_uac(ipv6, 6060, "1001", "sipp-scenarios/uac_digest_leak-ipv6.xml", "-i [::1] -mi [::1]"); } if (sipp_ret < 0 || sipp_ret == 127) { diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_telephone_event.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_telephone_event.xml new file mode 100644 index 0000000000..c3e905de93 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_telephone_event.xml @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<scenario name="UAC with media"> + <!-- In client mode (sipp placing calls), the Call-ID MUST be --> + <!-- generated by sipp. To do so, use [call_id] keyword. --> + <send retrans="500"> + <![CDATA[ + + INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: t_sipp <sip:t_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]> + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:t_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 IP[local_ip_type] [local_ip] + s=- + c=IN IP[local_ip_type] [local_ip] + t=0 0 + m=audio [auto_media_port] RTP/AVP 8 0 18 101 + a=rtpmap:8 PCMA/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:18 G729/8000 + a=fmtp:18 annexb=no + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-11,16 + a=sendrecv + a=ptime:20 + ]]> + </send> + + <recv response="100" optional="true"> + </recv> + + <recv response="180" optional="true"> + </recv> + + <!-- By adding rrs="true" (Record Route Sets), the route sets --> + <!-- are saved and used for following messages sent. Useful to test --> + <!-- against stateful SIP proxies/B2BUAs. --> + <recv response="200" rtd="true" crlf="true"> + </recv> + + <!-- Packet lost can be simulated in any send/recv message by --> + <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --> + <send> + <![CDATA[ + + ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: t_sipp <sip:t_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:t_sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Length: 0 + + ]]> + </send> + + <pause milliseconds="1500"/> + + <send retrans="500"> + <![CDATA[ + + INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: t_sipp <sip:t_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]> + Call-ID: [call_id] + CSeq: 2 INVITE + Contact: sip:t_sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Length: [len] + + ]]> + </send> + + + <recv response="100" optional="true"> + </recv> + <recv response="200" rtd="true" crlf="true"> + <!--<action> + <ereg regexp="m=audio.*[0-9][1-5].*101.*" + <ereg regexp="101 telephone-event" + search_in="body" + check_it="true" + assign_to="5"/> + </action>--> + </recv> + + <send> + <![CDATA[ + + ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: t_sipp <sip:t_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param] + Call-ID: [call_id] + CSeq: 2 ACK + Contact: sip:t_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 IP[local_ip_type] [local_ip] + s= + c=IN IP[local_ip_type] [local_ip] + t=0 0 + m=audio [auto_media_port] RTP/AVP 8 0 101 + a=rtpmap:8 PCMA/8000 + a=rtpmap:0 PCMU/8000 + a=rtpmap:101 telephone-event/8000 + a=fmtp:101 0-15 + a=sendrecv + a=ptime:20 + + ]]> + </send> + + <send retrans="500"> + <![CDATA[ + + BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: t_sipp <sip:t_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param] + Call-ID: [call_id] + CSeq: 3 BYE + Contact: sip:t_sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Length: 0 + + ]]> + </send> + + <recv response="200" crlf="true"> + </recv> + + + <!-- definition of the response time repartition table (unit is ms) --> + <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> + + <!-- definition of the call length repartition table (unit is ms) --> + <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> + +</scenario> + From 8a2ad233d6a1bcd81f170655c5069807851b27b5 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 30 Jul 2021 00:14:29 +0300 Subject: [PATCH 395/655] [Core] Do not generate SDP media Descriptions with RTP/SAVP transport protocol when no crypto attribute. --- src/include/switch_core_media.h | 6 +++++ src/switch_core_media.c | 39 ++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index c84416c86e..f57e1ce974 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -49,6 +49,12 @@ typedef enum { DTMF_NONE } switch_core_media_dtmf_t; +typedef enum { + AVP_NO_SECURE, + AVP_SECURE, + AVP_UNDEFINED +} switch_core_media_avp_secure_t; + typedef enum { SM_NDLB_ALLOW_BAD_IANANAME = (1 << 0), SM_NDLB_ALLOW_NONDUP_SDP = (1 << 1), diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 24497b7df1..d08b24559e 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -9806,7 +9806,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi } -static const char *get_media_profile_name(switch_core_session_t *session, int secure) +static const char *get_media_profile_name(switch_core_session_t *session, int secure, switch_core_media_avp_secure_t avp) { switch_assert(session); @@ -9827,7 +9827,15 @@ static const char *get_media_profile_name(switch_core_session_t *session, int se } if (secure) { - return "RTP/SAVP"; + switch (avp) { + case AVP_NO_SECURE: + break; + case AVP_SECURE: + case AVP_UNDEFINED: + return "RTP/SAVP"; + default: + break; + } } return "RTP/AVP"; @@ -9862,6 +9870,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, switch_media_handle_t *smh; switch_rtp_engine_t *a_engine; int include_external; + switch_core_media_avp_secure_t avp_secure = AVP_NO_SECURE; switch_assert(session); @@ -9874,8 +9883,22 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, //switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d RTP/%sAVP%s", //port, secure ? "S" : "", switch_channel_test_flag(session->channel, CF_AVPF) ? "F" : ""); + /* Check if there is a crypto */ + if (secure && !switch_channel_test_flag(session->channel, CF_DTLS)) { + int i; + + for (i = 0; smh->crypto_suite_order[i] != CRYPTO_INVALID; i++) { + switch_rtp_crypto_key_type_t j = SUITES[smh->crypto_suite_order[i]].type; + + if ((a_engine->crypto_type == j || a_engine->crypto_type == CRYPTO_INVALID) && !zstr(a_engine->ssec[j].local_crypto_key)) { + avp_secure = AVP_SECURE; + break; + } + } + } + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d %s", port, - get_media_profile_name(session, secure || a_engine->crypto_type != CRYPTO_INVALID)); + get_media_profile_name(session, secure || a_engine->crypto_type != CRYPTO_INVALID, avp_secure)); include_external = switch_channel_var_true(session->channel, "include_external_ip"); @@ -10684,7 +10707,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess if (a_engine->codec_negotiated && !switch_channel_test_flag(session->channel, CF_NOSDP_REINVITE)) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=audio %d %s", port, get_media_profile_name(session, !a_engine->no_crypto && - (switch_channel_test_flag(session->channel, CF_DTLS) || a_engine->crypto_type != CRYPTO_INVALID))); + (switch_channel_test_flag(session->channel, CF_DTLS) || a_engine->crypto_type != CRYPTO_INVALID), AVP_UNDEFINED)); switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", a_engine->cur_payload_map->pt); @@ -11017,7 +11040,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess get_media_profile_name(session, (switch_channel_test_flag(session->channel, CF_SECURE) && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) || - a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS))); + a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS), AVP_UNDEFINED)); } } else { if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_INBOUND) { @@ -11051,7 +11074,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess get_media_profile_name(session, (loops == 0 && switch_channel_test_flag(session->channel, CF_SECURE) && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) || - a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS))); + a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS), AVP_UNDEFINED)); @@ -11564,7 +11587,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess get_media_profile_name(session, (switch_channel_test_flag(session->channel, CF_SECURE) && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) || - a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS))); + a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS), AVP_UNDEFINED)); } } else if ((switch_channel_test_flag(session->channel, CF_WANT_RTT) || switch_channel_test_flag(session->channel, CF_RTT) || switch_channel_var_true(session->channel, "rtp_enable_text")) && @@ -11629,7 +11652,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess get_media_profile_name(session, (loops == 0 && switch_channel_test_flag(session->channel, CF_SECURE) && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) || - a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS))); + a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS), AVP_UNDEFINED)); /*****************************/ From 047c3c721790036ef2c5c7b521163c48ce47d3af Mon Sep 17 00:00:00 2001 From: dhruvecosmob <dhruv.gupta@ecosmob.com> Date: Wed, 15 Sep 2021 13:21:54 +0530 Subject: [PATCH 396/655] [Core] Add Unit test script for Check RTP/SAVP transport protocol with crypto attribute. --- .../mod_sofia/test/sipp-based-tests.c | 153 ++++++++++++------ .../test/sipp-scenarios/uac_savp_check.xml | 148 +++++++++++++++++ 2 files changed, 252 insertions(+), 49 deletions(-) create mode 100644 src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_savp_check.xml 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 3f591754fe..0ae1ff51c3 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -37,6 +37,39 @@ int test_success = 0; int test_sofia_debug = 1; +static void test_wait_for_uuid(char *uuid) +{ + switch_stream_handle_t stream = { 0 }; + int loop_count = 50; + char *channel_data=NULL; + + do { + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("show", "channels", NULL, &stream); + + if (!strncmp((char *)stream.data, "uuid,", 5)) { + channel_data = switch_mprintf("%s", (char *)stream.data); + switch_safe_free(stream.data); + break; + } + switch_safe_free(stream.data); + switch_sleep(100 * 1000); + } while (loop_count--); + + if (channel_data) { + char *temp = NULL; + int i; + + if ((temp = strchr(channel_data, '\n'))) { + temp++; + for (i = 0; temp[i] != ',' && i < 99; i++) { + uuid[i] = temp[i]; + } + } + free(channel_data); + } +} + static const char *test_wait_for_chan_var(switch_channel_t *channel, const char *seq) { int loop_count = 50; @@ -219,84 +252,106 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) FST_TEST_BEGIN(uac_telephone_event_check) { const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - char *channel_data = NULL; char uuid[100] = ""; int sipp_ret; - int sdp_count = 0 , loop_count =50; - switch_stream_handle_t stream = { 0 }; + int sdp_count = 0; sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1212121212", "sipp-scenarios/uac_telephone_event.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { fst_requires(0); /* sipp not found */ } - do { - SWITCH_STANDARD_STREAM(stream); - switch_api_execute("show", "channels", NULL, &stream); - if (!strncmp((char *)stream.data, "uuid,", 5)) { - channel_data = switch_mprintf("%s", (char *)stream.data); - switch_safe_free(stream.data); - break; - } + test_wait_for_uuid(uuid); + if (!zstr(uuid)) { + const char *sdp_str1 = NULL, *sdp_str2 = NULL; + switch_core_session_t *session = switch_core_session_locate(uuid); + switch_channel_t *channel = switch_core_session_get_channel(session); + fst_requires(channel); - switch_safe_free(stream.data); - switch_sleep(100 * 1000); - } while (loop_count--); + sdp_str1 = test_wait_for_chan_var(channel,"1"); + sdp_str2 = test_wait_for_chan_var(channel,"2"); - if (channel_data) { - char *temp = NULL; - int i; + if (sdp_str1 && sdp_str2 && (strstr(sdp_str1,"telephone-event")) && (strstr(sdp_str2,"telephone-event"))){ + char *temp = NULL; + sdp_count = 1; - if ((temp = strchr(channel_data, '\n'))) { - temp++; - for (i = 0; temp[i] != ',' && i < 99; i++){ - uuid[i] = temp[i]; + if ((temp = strstr(sdp_str2,"RTP/AVP"))) { + int count = 0, i; + + for (i = 7; temp[i] != '\n' && i < 99; i++) { + /* checking for payload-type 101.*/ + if(temp[i++] == '1' && temp[i++] == '0' && temp[i++] == '1') + count++; + } + if (count > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Duplicate entry of payload in SDP.\n"); + sdp_count = 0; + } } - uuid[i] = '\0'; + + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Telephone-event missing in SDP.\n"); } + switch_core_session_rwunlock(session); - if (!zstr(uuid)) { - switch_core_session_t *session = switch_core_session_locate(uuid); - switch_channel_t *channel; - const char *sdp_str1 = NULL, *sdp_str2 = NULL; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Uuid not found in Channel Data.\n"); + } - fst_requires(session); - channel = switch_core_session_get_channel(session); + fst_check(sdp_count == 1); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + } + FST_TEST_END() - sdp_str1 = test_wait_for_chan_var(channel,"1"); - sdp_str2 = test_wait_for_chan_var(channel,"2"); + FST_TEST_BEGIN(uac_savp_check) + { + const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); + char uuid[100] = ""; + int sipp_ret; + int sdp_count = 0; - if (sdp_str1 && sdp_str2 && (strstr(sdp_str1,"telephone-event")) && (strstr(sdp_str2,"telephone-event"))){ - temp = NULL; - sdp_count = 1; + sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1212121212", "sipp-scenarios/uac_savp_check.xml", ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_requires(0); /* sipp not found */ + } - if ((temp = strstr(sdp_str2,"RTP/AVP"))) { - int count = 0; + test_wait_for_uuid(uuid); + if (!zstr(uuid)) { + const char *sdp_str1 = NULL, *sdp_str2 = NULL; + const char *temp = NULL, *temp1 = NULL; + switch_core_session_t *session = switch_core_session_locate(uuid); + switch_channel_t *channel = switch_core_session_get_channel(session); + fst_requires(channel); - for (i = 7; temp[i] != '\n' && i < 99; i++) { - /* checking for payload-type 101.*/ - if(temp[i++] == '1' && temp[i++] == '0' && temp[i++] == '1') { - count++; - } - } + sdp_str1 = test_wait_for_chan_var(channel,"1"); + sdp_str2 = test_wait_for_chan_var(channel,"2"); - if (count > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Duplicate entry of payload in SDP.\n"); + if (sdp_str1 && sdp_str2 && (temp = strstr(sdp_str2,"RTP/SAVP")) && (temp1 = strstr(temp,"crypto"))) { + int i = 0; + + sdp_count = 1; + for (i = 0; temp1[i]; i++) { + + if ((temp = strstr(temp1,"RTP/SAVP"))) { + if ((temp1 = strstr(temp,"crypto"))) { + i = 0; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fail due to no crypto found with SAVP.\n"); sdp_count = 0; + break; } } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Telephone-event missing in SDP.\n"); + } - switch_core_session_rwunlock(session); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Uuid not found in Channel Data.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SAVP not found in SDP.\n"); } + switch_core_session_rwunlock(session); - free(channel_data); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find Channel Data.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Uuid not found in Channel Data.\n"); } fst_check(sdp_count == 1); diff --git a/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_savp_check.xml b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_savp_check.xml new file mode 100644 index 0000000000..253f3ff2be --- /dev/null +++ b/src/mod/endpoints/mod_sofia/test/sipp-scenarios/uac_savp_check.xml @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<scenario name="UAC with media"> +<!-- In client mode (sipp placing calls), the Call-ID MUST be --> +<!-- generated by sipp. To do so, use [call_id] keyword. --> + + + <send retrans="500"> + <![CDATA[ + + INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: s_sipp <sip:s_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]> + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:s_sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=CiscoSystemsCCM-SIP 1195507 1 IN IP[local_ip_type] [local_ip] + s=SIP Call + c=IN IP[local_ip_type] [local_ip] + b=TIAS:64000 + b=AS:80 + t=0 0 + m=audio [auto_media_port] RTP/SAVP 18 0 8 100 + a=rtpmap:0 PCMU/8000 + a=rtpmap:8 PCMA/8000 + a=rtpmap:18 G729/8000 + a=fmtp:18 annexb=no + a=rtpmap:100 telephone-event/8000 + a=fmtp:100 0-15 + a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:mSPPjYxzAEWkICVXidkYXFdsHr/J2NhpkqQepffH + + ]]> + </send> + + + <recv response="100" optional="true"> + </recv> + + <recv response="180" optional="true"> + </recv> + <recv response="183" optional="true"> + </recv> + + <!-- By adding rrs="true" (Record Route Sets), the route sets --> + <!-- are saved and used for following messages sent. Useful to test --> + <!-- against stateful SIP proxies/B2BUAs. --> + <recv response="200" rtd="true" crlf="true"> + </recv> + + <!-- Packet lost can be simulated in any send/recv message by --> + <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --> + <send> + <![CDATA[ + + ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: s_sipp <sip:s_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:s_sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Length: 0 + + ]]> + </send> + + <pause milliseconds="1000"/> + + <send retrans="500"> + <![CDATA[ + + INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: s_sipp <sip:s_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]> + Call-ID: [call_id] + CSeq: 2 INVITE + Contact: sip:s_sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Length: [len] + + ]]> + </send> + + + <recv response="100" optional="true"> + </recv> + <recv response="200" rtd="true" crlf="true"> + </recv> + + <send> + <![CDATA[ + + ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: s_sipp <sip:s_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param] + Call-ID: [call_id] + CSeq: 2 ACK + Contact: sip:s_sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Type: application/sdp + Content-Length: [len] + + + ]]> + </send> + + + <send retrans="500"> + <![CDATA[ + + BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: s_sipp <sip:s_sipp@[local_ip]:[local_port]>;tag=[call_number] + To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param] + Call-ID: [call_id] + CSeq: 3 BYE + Contact: sip:s_sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Performance Test + Content-Length: 0 + + ]]> + </send> + + <recv response="200" crlf="true"> + </recv> + + + <!-- definition of the response time repartition table (unit is ms) --> + <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> + + <!-- definition of the call length repartition table (unit is ms) --> + <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> + +</scenario> + From 8e17dca00d914f3daaaeeb4b7983032ef9d92f03 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Wed, 15 Sep 2021 04:30:46 +0000 Subject: [PATCH 397/655] [core] Save position of XML opening tag '>' and XML closing tag '<' in switch_xml_parse_str(). --- src/include/switch_xml.h | 4 ++++ src/switch_xml.c | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index fab9d981ef..9a308813a7 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -102,6 +102,10 @@ struct switch_xml { /*! is_switch_xml_root bool */ switch_bool_t is_switch_xml_root_t; uint32_t refs; + /*! pointer to end of opening tag, '>', in the original parsed text */ + const char *open; + /*! pointer to start of closing tag, '<', in the original parsed text */ + const char *close; }; /*! diff --git a/src/switch_xml.c b/src/switch_xml.c index cee1a4b833..bd0e7c8c38 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -684,7 +684,7 @@ static char *switch_xml_decode(char *s, char **ent, char t) } /* called when parser finds start of new tag */ -static void switch_xml_open_tag(switch_xml_root_t root, char *name, char **attr) +static void switch_xml_open_tag(switch_xml_root_t root, char *name, char *open_pos, char **attr) { switch_xml_t xml; @@ -701,6 +701,7 @@ static void switch_xml_open_tag(switch_xml_root_t root, char *name, char **attr) xml->attr = attr; root->cur = xml; /* update tag insertion point */ + root->cur->open = open_pos; } /* called when parser finds character content between open and closing tag */ @@ -742,11 +743,12 @@ static void switch_xml_char_content(switch_xml_root_t root, char *s, switch_size } /* called when parser finds closing tag */ -static switch_xml_t switch_xml_close_tag(switch_xml_root_t root, char *name, char *s) +static switch_xml_t switch_xml_close_tag(switch_xml_root_t root, char *name, char *s, char *close_pos) { if (!root || !root->cur || !root->cur->name || strcmp(name, root->cur->name)) return switch_xml_err(root, s, "unexpected closing tag </%s>", name); + root->cur->close = close_pos; root->cur = root->cur->parent; return NULL; } @@ -1118,11 +1120,11 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len) switch_xml_free_attr(attr); return switch_xml_err(root, d, "missing >"); } - switch_xml_open_tag(root, d, attr); - switch_xml_close_tag(root, d, s); + switch_xml_open_tag(root, d, s + 1, attr); + switch_xml_close_tag(root, d, s, NULL); } else if ((q = *s) == '>' || (!*s && e == '>')) { /* open tag */ *s = '\0'; /* temporarily null terminate tag name */ - switch_xml_open_tag(root, d, attr); + switch_xml_open_tag(root, d, s, attr); *s = q; } else { if (l) @@ -1130,11 +1132,12 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len) return switch_xml_err(root, d, "missing >"); } } else if (*s == '/') { /* close tag */ + char *close_pos = d - 1; s += strcspn(d = s + 1, SWITCH_XML_WS ">") + 1; if (!(q = *s) && e != '>') return switch_xml_err(root, d, "missing >"); *s = '\0'; /* temporarily null terminate tag name */ - if (switch_xml_close_tag(root, d, s)) + if (switch_xml_close_tag(root, d, s, close_pos)) return &root->xml; if (isspace((int) (*s = q))) s += strspn(s, SWITCH_XML_WS); From ce9905cdf48908ed72c2b094c041922b447ed04f Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 15 Sep 2021 10:58:53 +0000 Subject: [PATCH 398/655] [core] don't hangup call on SRTP errors (new default behaviour) --- src/include/switch_types.h | 1 + src/switch_rtp.c | 41 ++++++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b9ae217472..0435a9f81f 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -843,6 +843,7 @@ typedef enum { SWITCH_RTP_FLAG_PASSTHRU, SWITCH_RTP_FLAG_SECURE_SEND_MKI, SWITCH_RTP_FLAG_SECURE_RECV_MKI, + SWITCH_RTP_FLAG_SRTP_HANGUP_ON_ERROR, SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT, SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT, SWITCH_RTP_FLAG_INVALID diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 12360c522c..cac610b203 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1501,6 +1501,41 @@ static void zrtp_logger(int level, const char *data, int len, int offset) } #endif +#ifdef ENABLE_SRTP +SWITCH_DECLARE(void) switch_srtp_err_to_txt(srtp_err_status_t stat, char **msg) +{ + if (stat == srtp_err_status_replay_fail) *msg="replay check failed"; + else if (stat == srtp_err_status_auth_fail) *msg="auth check failed"; + else if (stat == srtp_err_status_fail) *msg="unspecified failure"; + else if (stat == srtp_err_status_bad_param) *msg="unsupported parameter"; + else if (stat == srtp_err_status_alloc_fail) *msg="couldn't allocate memory"; + else if (stat == srtp_err_status_dealloc_fail) *msg="couldn't deallocate properly"; + else if (stat == srtp_err_status_init_fail) *msg="couldn't initialize"; + else if (stat == srtp_err_status_terminus) *msg="can't process as much data as requested"; + else if (stat == srtp_err_status_cipher_fail) *msg="cipher failure"; + else if (stat == srtp_err_status_replay_old) *msg="replay check failed"; + else if (stat == srtp_err_status_algo_fail) *msg="algorithm failed test routine"; + else if (stat == srtp_err_status_no_such_op) *msg="unsupported operation"; + else if (stat == srtp_err_status_no_ctx) *msg="no appropriate context found"; + else if (stat == srtp_err_status_cant_check) *msg="auth check failed"; + else if (stat == srtp_err_status_key_expired) *msg="can't use key any more"; + else if (stat == srtp_err_status_socket_err) *msg="error in use of socket"; + else if (stat == srtp_err_status_signal_err) *msg="error in use POSIX signals"; + else if (stat == srtp_err_status_nonce_bad) *msg="nonce check failed"; + else if (stat == srtp_err_status_read_fail) *msg="couldn't read data"; + else if (stat == srtp_err_status_write_fail) *msg="couldn't write data"; + else if (stat == srtp_err_status_parse_err) *msg="error parsing data"; + else if (stat == srtp_err_status_write_fail) *msg="couldn't read data"; + else if (stat == srtp_err_status_encode_err) *msg="error encoding data"; + else if (stat == srtp_err_status_semaphore_err) *msg="error while using semaphores"; + else if (stat == srtp_err_status_pfkey_err) *msg="error while using pfkey "; + else if (stat == srtp_err_status_bad_mki) *msg="error MKI present in packet is invalid"; + else if (stat == srtp_err_status_pkt_idx_old) *msg="packet index is too old to consider"; + else if (stat == srtp_err_status_pkt_idx_adv) *msg="packet index advanced, reset needed"; + else *msg=""; +} +#endif + SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool) { #ifdef ENABLE_ZRTP @@ -6419,11 +6454,9 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t if (stat && rtp_session->recv_msg.header.pt != rtp_session->recv_te && rtp_session->recv_msg.header.pt != rtp_session->cng_pt) { int errs = ++rtp_session->srtp_errs[rtp_session->srtp_idx_rtp]; - if (stat != 10) { + if (rtp_session->flags[SWITCH_RTP_FLAG_SRTP_HANGUP_ON_ERROR] && stat != srtp_err_status_replay_old) { char *msg; - if (stat == srtp_err_status_replay_fail) msg="replay check failed"; - else if (stat == srtp_err_status_auth_fail) msg="auth check failed"; - else msg=""; + switch_srtp_err_to_txt(stat, &msg); if (errs >= MAX_SRTP_ERRS) { switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, From a5a1fb9dd8c01ffa470fd27518a3dc5210f0afb2 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 15 Sep 2021 15:47:18 +0000 Subject: [PATCH 399/655] [mod_sofia] fix memleak (presence) --- src/mod/endpoints/mod_sofia/sofia_presence.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 43564731d8..ce04b2b46f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1414,6 +1414,7 @@ static switch_event_t *actual_sofia_presence_event_handler(switch_event_t *event if (zstr(call_id) && (dh.hits && presence_source && (!strcasecmp(presence_source, "register") || switch_stristr("register", status)))) { + switch_console_free_matches(&matches); sofia_glue_release_profile(profile); goto done; } From 7bfc9a514fff7d16df8d9a8bfdeec3074d70d59d Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Wed, 15 Sep 2021 19:25:00 -0400 Subject: [PATCH 400/655] [build] remove generated libs/srtp/config_in.h file and add some git ignores --- .gitignore | 3 + libs/srtp/config_in.h | 196 ------------------------------------------ 2 files changed, 3 insertions(+), 196 deletions(-) delete mode 100644 libs/srtp/config_in.h diff --git a/.gitignore b/.gitignore index 7041de0494..0461c273de 100644 --- a/.gitignore +++ b/.gitignore @@ -278,3 +278,6 @@ images/test-rgb.png images/test.png images/test_patched.png images/test_text.png + +src/mod/codecs/mod_amrwb/test/test_amrwb +src/mod/endpoints/mod_sofia/test/sipp-based-tests diff --git a/libs/srtp/config_in.h b/libs/srtp/config_in.h deleted file mode 100644 index 31e6ffe385..0000000000 --- a/libs/srtp/config_in.h +++ /dev/null @@ -1,196 +0,0 @@ -/* config_in.h. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define if building for a CISC machine (e.g. Intel). */ -#undef CPU_CISC - -/* Define if building for a RISC machine (assume slow byte access). */ -#undef CPU_RISC - -/* Define to enabled debug logging for all mudules. */ -#undef ENABLE_DEBUG_LOGGING - -/* Logging statments will be writen to this file. */ -#undef ERR_REPORTING_FILE - -/* Define to redirect logging to stdout. */ -#undef ERR_REPORTING_STDOUT - -/* Define this to use AES-GCM. */ -#undef GCM - -/* Define to 1 if you have the <arpa/inet.h> header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the <byteswap.h> header file. */ -#undef HAVE_BYTESWAP_H - -/* Define to 1 if you have the `inet_aton' function. */ -#undef HAVE_INET_ATON - -/* Define to 1 if the system has the type `int16_t'. */ -#undef HAVE_INT16_T - -/* Define to 1 if the system has the type `int32_t'. */ -#undef HAVE_INT32_T - -/* Define to 1 if the system has the type `int8_t'. */ -#undef HAVE_INT8_T - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `dl' library (-ldl). */ -#undef HAVE_LIBDL - -/* Define to 1 if you have the `nspr4' library (-lnspr4). */ -#undef HAVE_LIBNSPR4 - -/* Define to 1 if you have the `nss3' library (-lnss3). */ -#undef HAVE_LIBNSS3 - -/* Define to 1 if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET - -/* Define to 1 if you have the `z' library (-lz). */ -#undef HAVE_LIBZ - -/* Define to 1 if you have the <machine/types.h> header file. */ -#undef HAVE_MACHINE_TYPES_H - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the <netinet/in.h> header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the <nss.h> header file. */ -#undef HAVE_NSS_H - -/* Define to 1 if you have the `winpcap' library (-lwpcap) */ -#undef HAVE_PCAP - -/* Define to 1 if you have the `sigaction' function. */ -#undef HAVE_SIGACTION - -/* Define to 1 if you have the `socket' function. */ -#undef HAVE_SOCKET - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the <sys/int_types.h> header file. */ -#undef HAVE_SYS_INT_TYPES_H - -/* Define to 1 if you have the <sys/socket.h> header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <sys/uio.h> header file. */ -#undef HAVE_SYS_UIO_H - -/* Define to 1 if the system has the type `uint16_t'. */ -#undef HAVE_UINT16_T - -/* Define to 1 if the system has the type `uint32_t'. */ -#undef HAVE_UINT32_T - -/* Define to 1 if the system has the type `uint64_t'. */ -#undef HAVE_UINT64_T - -/* Define to 1 if the system has the type `uint8_t'. */ -#undef HAVE_UINT8_T - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `usleep' function. */ -#undef HAVE_USLEEP - -/* Define to 1 if you have the <windows.h> header file. */ -#undef HAVE_WINDOWS_H - -/* Define to 1 if you have the <winsock2.h> header file. */ -#undef HAVE_WINSOCK2_H - -/* Define to use X86 inlined assembly code */ -#undef HAVE_X86 - -/* Define this to use NSS crypto. */ -#undef NSS - -/* Define this to use OpenSSL crypto. */ -#undef OPENSSL - -/* Define this if OPENSSL_cleanse is broken. */ -#undef OPENSSL_CLEANSE_BROKEN - -/* Define this to use OpenSSL KDF for SRTP. */ -#undef OPENSSL_KDF - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* The size of `unsigned long', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_LONG - -/* The size of `unsigned long long', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED_LONG_LONG - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `unsigned int' if <sys/types.h> does not define. */ -#undef size_t From 715f9e4d289ee040ecd1508586612b145cf9c787 Mon Sep 17 00:00:00 2001 From: dhruvecosmob <dhruv.gupta@ecosmob.com> Date: Mon, 20 Sep 2021 09:39:28 +0300 Subject: [PATCH 401/655] [Unit-tests] Add a unit-test for the compact form and full form of the Identity header. --- tests/unit/Makefile.am | 2 +- .../{conf_hold => conf_test}/freeswitch.xml | 17 +++- .../gw/test_gateway.xml} | 2 +- tests/unit/switch_hold.c | 4 +- tests/unit/switch_sip.c | 95 +++++++++++++++++++ 5 files changed, 112 insertions(+), 8 deletions(-) rename tests/unit/{conf_hold => conf_test}/freeswitch.xml (92%) rename tests/unit/{conf_hold/gw/holdtest.xml => conf_test/gw/test_gateway.xml} (92%) create mode 100644 tests/unit/switch_sip.c diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 3f41d71dda..d24e30f62b 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -4,7 +4,7 @@ noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils swi switch_ivr_play_say switch_core_codec switch_rtp switch_xml 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 +noinst_PROGRAMS+= switch_hold switch_sip 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_hold/freeswitch.xml b/tests/unit/conf_test/freeswitch.xml similarity index 92% rename from tests/unit/conf_hold/freeswitch.xml rename to tests/unit/conf_test/freeswitch.xml index 883e3846e1..80216bbe7d 100644 --- a/tests/unit/conf_hold/freeswitch.xml +++ b/tests/unit/conf_test/freeswitch.xml @@ -15,6 +15,7 @@ <load module="mod_tone_stream"/> <load module="mod_commands"/> <load module="mod_sndfile"/> + <load module="mod_hash"/> </modules> </configuration> @@ -39,7 +40,7 @@ <profile name="external"> <gateways> - <gateway name="hold_unhold_test"> + <gateway name="test_gateway"> <param name="username" value="not-used"/> <param name="password" value="not-used"/> <param name="proxy" value="$${local_ip_v4}:61068"/> @@ -62,7 +63,7 @@ <param name="p-asserted-id-parse" value="verbatim"/> <param name="username" value="SignalWire-STACK"/> <param name="user-agent-string" value="SignalWire STACK Unit Test"/> - <param name="sip-trace" value="yes"/> + <param name="sip-trace" value="no"/> <param name="sip-capture" value="no"/> <param name="rfc2833-pt" value="101"/> <param name="sip-port" value="61068"/> @@ -104,7 +105,7 @@ <param name="p-asserted-id-parse" value="verbatim"/> <param name="username" value="SignalWire-STACK"/> <param name="user-agent-string" value="SignalWire STACK Unit Test"/> - <param name="sip-trace" value="yes"/> + <param name="sip-trace" value="no"/> <param name="sip-capture" value="no"/> <param name="rfc2833-pt" value="101"/> <param name="sip-port" value="61069"/> @@ -144,12 +145,20 @@ <section name="dialplan" description="Regex/XML Dialplan"> <context name="default"> + <extension name="two"> + <condition field="destination_number" expression="^\+15553332901$"> + <action application="log" data="${sip_h_identity}"/> + <action application="hash" data="insert/realm/identity_check/${sip_h_identity}"/> + <action application="answer"/> + <action application="park"/> + </condition> + </extension> <extension name="one"> <condition field="destination_number" expression="^\+15553332900$"> <action application="set" data="absolute_codec_string=PCMU@20i"/> <action application="info"/> <action application="answer"/> - <action application="park""/> + <action application="park"/> </condition> </extension> </context> diff --git a/tests/unit/conf_hold/gw/holdtest.xml b/tests/unit/conf_test/gw/test_gateway.xml similarity index 92% rename from tests/unit/conf_hold/gw/holdtest.xml rename to tests/unit/conf_test/gw/test_gateway.xml index d919ddb2d4..8e8e0ac075 100644 --- a/tests/unit/conf_hold/gw/holdtest.xml +++ b/tests/unit/conf_test/gw/test_gateway.xml @@ -1,5 +1,5 @@ <include/> - <gateway name="hold_unhold_test"> + <gateway name="test_gateway"> <param name="username" value="not-used"/> <param name="password" value="not-used"/> <param name="proxy" value="127.0.0.1"/> diff --git a/tests/unit/switch_hold.c b/tests/unit/switch_hold.c index 9da8ccfc94..e48865155b 100644 --- a/tests/unit/switch_hold.c +++ b/tests/unit/switch_hold.c @@ -1,7 +1,7 @@ #include <switch.h> #include <test/switch_test.h> -FST_CORE_DB_BEGIN("./conf_hold") +FST_CORE_DB_BEGIN("./conf_test") { FST_SUITE_BEGIN(switch_hold) { @@ -23,7 +23,7 @@ FST_SUITE_BEGIN(switch_hold) switch_status_t status; switch_call_cause_t cause; - status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/hold_unhold_test/+15553332900", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/test_gateway/+15553332900", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_requires(session); fst_check(status == SWITCH_STATUS_SUCCESS); diff --git a/tests/unit/switch_sip.c b/tests/unit/switch_sip.c new file mode 100644 index 0000000000..238f00a4d5 --- /dev/null +++ b/tests/unit/switch_sip.c @@ -0,0 +1,95 @@ +#include <switch.h> +#include <test/switch_test.h> + +FST_CORE_DB_BEGIN("./conf_test") +{ +FST_SUITE_BEGIN(switch_sip) +{ + FST_SETUP_BEGIN() + { + fst_requires_module("mod_sofia"); + fst_requires_module("mod_hash"); + } + FST_SETUP_END() + + FST_TEARDOWN_BEGIN() + { + } + FST_TEARDOWN_END() + + FST_TEST_BEGIN(identity_compact_check) + { + switch_core_session_t *session = NULL; + switch_call_cause_t cause; + const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>"; + char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data); + + switch_ivr_originate(NULL, &session, &cause, originate_str, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + switch_safe_free(originate_str); + fst_requires(session); + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *uuid = switch_core_session_get_uuid(session); + + fst_requires(channel); + if (uuid) { + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + + switch_api_execute("hash", "select/realm/identity_check", NULL, &stream); + fst_check_string_equals(stream.data, data); + switch_safe_free(stream.data); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("hash", "delete/realm/identity_check", NULL, &stream); + switch_safe_free(stream.data); + } + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + } + + } + FST_TEST_END() + + FST_TEST_BEGIN(identity_full_check) + { + switch_core_session_t *session = NULL; + switch_call_cause_t cause; + const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>;alg=ES256;ppt=shaken"; + char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data); + + switch_ivr_originate(NULL, &session, &cause, originate_str, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + switch_safe_free(originate_str); + fst_requires(session); + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *uuid = switch_core_session_get_uuid(session); + + fst_requires(channel); + if (uuid) { + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + + switch_api_execute("hash", "select/realm/identity_check", NULL, &stream); + fst_check_string_equals(stream.data, data); + switch_safe_free(stream.data); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("hash", "delete/realm/identity_check", NULL, &stream); + switch_safe_free(stream.data); + } + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + } + + } + FST_TEST_END() +} +FST_SUITE_END() +} +FST_CORE_END() + From 013894ac339e8a70d41e94f2c2322e86a5ad9551 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Fri, 24 Sep 2021 20:38:09 +0000 Subject: [PATCH 402/655] [core] RTP: remove redundant condition when checking payload type of incoming packets. --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index cac610b203..02b79362e7 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -6110,7 +6110,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->last_rtp_hdr = rtp_session->recv_msg.header; - if (bytes && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] && + if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] && rtp_session->last_rtp_hdr.pt != 13 && rtp_session->last_rtp_hdr.pt != rtp_session->recv_te && rtp_session->last_rtp_hdr.pt != rtp_session->cng_pt) { From f0e42fe8dbeb855185147feb15e8c5f439622791 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 8 Oct 2021 17:40:54 +0300 Subject: [PATCH 403/655] [Core] Implement NDLB_line_flash_16 channel variable. Set to true to enable deprecated 0-16 back (rfc4733) --- src/switch_core_media.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d08b24559e..087a151570 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -10053,14 +10053,16 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, } } } else { + uint8_t NDLB_line_flash_16 = switch_channel_var_true(session->channel, "NDLB_line_flash_16"); + for (i = 0; i < smh->num_rates; i++) { if (switch_channel_test_flag(session->channel, CF_AVPF)) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", smh->dtmf_ianacodes[i], smh->rates[i]); } else { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-15\r\n", - smh->dtmf_ianacodes[i], smh->rates[i], smh->dtmf_ianacodes[i]); + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-%d\r\n", + smh->dtmf_ianacodes[i], smh->rates[i], smh->dtmf_ianacodes[i], (NDLB_line_flash_16 ? 16 : 15)); } } } @@ -10777,8 +10779,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", smh->mparams->te, smh->mparams->te_rate); } else { - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-15\r\n", - smh->mparams->te, smh->mparams->te_rate, smh->mparams->te); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-%d\r\n", + smh->mparams->te, smh->mparams->te_rate, smh->mparams->te, (switch_channel_var_true(session->channel, "NDLB_line_flash_16") ? 16 : 15)); } } From 4c8e7d86e355cc02a87685882f9d11d6bb5138e0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Tue, 23 Jun 2020 05:52:14 +0000 Subject: [PATCH 404/655] [core, mod_verto] check for camera change and trigger new constraints --- src/include/switch_types.h | 1 + src/mod/endpoints/mod_verto/mod_verto.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 0435a9f81f..a4e4059176 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1634,6 +1634,7 @@ typedef enum { CF_REATTACHED, CF_VIDEO_READ_TAPPED, CF_VIDEO_WRITE_TAPPED, + CF_DEVICES_CHANGED, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 32480ac9cc..3fdf01b186 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3611,7 +3611,7 @@ static switch_bool_t verto__ping_func(const char *method, cJSON *params, jsock_t static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { cJSON *msg = NULL, *dialog = NULL, *txt = NULL, *jevent = NULL; - const char *call_id = NULL, *dtmf = NULL; + const char *call_id = NULL, *dtmf = NULL, *type = NULL; switch_bool_t r = SWITCH_TRUE; char *proto = VERTO_CHAT_PROTO; char *pproto = NULL; @@ -3624,9 +3624,12 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t err = 1; goto cleanup; } + type = cJSON_GetObjectCstr(params, "type"); + if ((dialog = cJSON_GetObjectItem(params, "dialogParams")) && (call_id = cJSON_GetObjectCstr(dialog, "callID"))) { switch_core_session_t *session = NULL; - + switch_channel_t *channel = NULL; + if ((session = switch_core_session_locate(call_id))) { verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); @@ -3636,8 +3639,13 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t err = 1; goto cleanup; } + channel = switch_core_session_get_channel(session); parse_user_vars(dialog, session); + if (type && !strcasecmp(type, "mediaSettings")) { + switch_channel_set_flag(channel, CF_DEVICES_CHANGED); + } + if ((jevent = cJSON_GetObjectItem(params, "command"))) { switch_event_t *event = NULL; From db765890b6ffbb7ce7e330883ca94dcc2b6fb1be Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 26 Jun 2020 21:54:40 +0000 Subject: [PATCH 405/655] [mod_verto] smaller jb --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 3fdf01b186..0b96e04b28 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -5142,7 +5142,7 @@ static switch_status_t parse_config(const char *cf) } if (zstr(profile->jb_msec)) { - profile->jb_msec = "1p:50p"; + profile->jb_msec = "1p:20p"; } if (zstr(profile->timer_name)) { From 0dc234e1d48960cee086cd9d682f6cac4f3bc20e Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sat, 18 Jul 2020 01:05:24 +0000 Subject: [PATCH 406/655] [mod_verto] gen keyframe both ways on re-invite --- src/mod/endpoints/mod_verto/mod_verto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 0b96e04b28..31b5dda71c 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3368,12 +3368,14 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock cJSON_AddItemToObject(obj, "sdp", cJSON_CreateString(tech_pvt->mparams->local_sdp_str)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "updateMedia: Local SDP %s:\n%s\n", switch_channel_get_name(tech_pvt->channel), tech_pvt->mparams->local_sdp_str); + switch_core_media_gen_key_frame(tech_pvt->session); + switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); } else { switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CODEC NEGOTIATION ERROR")); err = 1; goto rwunlock; } - + } else if (!strcasecmp(action, "transfer")) { switch_core_session_t *other_session = NULL; From 651d80afa1e4a742796f5a1bafe52560c4fb702e Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Tue, 28 Jul 2020 02:40:48 +0000 Subject: [PATCH 407/655] [mod_verto] add reattach flag on reconnect to trigger mcu key frame --- src/mod/endpoints/mod_verto/mod_verto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 31b5dda71c..4e065b933d 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3370,6 +3370,7 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock switch_channel_get_name(tech_pvt->channel), tech_pvt->mparams->local_sdp_str); switch_core_media_gen_key_frame(tech_pvt->session); switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); + switch_channel_set_flag(tech_pvt->channel, CF_REATTACHED); } else { switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CODEC NEGOTIATION ERROR")); @@ -3549,6 +3550,7 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock } else { switch_core_media_gen_key_frame(tech_pvt->session); switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); + switch_channel_set_flag(tech_pvt->channel, CF_REATTACHED); } } From cf15e7ddd9f83b1b253dddac106d3d10b926777a Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Mon, 3 Aug 2020 17:57:59 +0000 Subject: [PATCH 408/655] [mod_verto] add some data about the identity of the requestor to json_api requests --- src/mod/endpoints/mod_verto/mod_verto.c | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 4e065b933d..fb5c26bd50 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -4383,6 +4383,10 @@ static switch_bool_t echo_func(const char *method, cJSON *params, jsock_t *jsock static switch_bool_t jsapi_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { + switch_event_header_t *hi = NULL; + cJSON *obj; + const char *var; + if (jsock->allowed_jsapi) { const char *function; @@ -4408,6 +4412,30 @@ static switch_bool_t jsapi_func(const char *method, cJSON *params, jsock_t *jsoc } } + obj = cJSON_CreateObject(); + cJSON_AddItemToObject(obj, "verto_id", cJSON_CreateString((char *)jsock->id)); + cJSON_AddItemToObject(obj, "verto_domain", cJSON_CreateString((char *)jsock->domain)); + cJSON_AddItemToObject(obj, "verto_user", cJSON_CreateString((char *)jsock->uid)); + cJSON_AddItemToObject(obj, "presence_id", cJSON_CreateString((char *)jsock->uid)); + cJSON_AddItemToObject(obj, "verto_client_address", cJSON_CreateString((char *)jsock->name)); + cJSON_AddItemToObject(obj, "chat_proto", cJSON_CreateString((char *)VERTO_CHAT_PROTO)); + cJSON_AddItemToObject(obj, "verto_host", cJSON_CreateString((char *)jsock->domain)); + + for (hi = jsock->user_vars->headers; hi; hi = hi->next) { + cJSON_AddItemToObject(obj, hi->name, cJSON_CreateString((char *)hi->value)); + } + + if ((var = switch_event_get_header(jsock->params, "caller-id-name"))) { + cJSON_AddItemToObject(obj, "caller-id-name", cJSON_CreateString((char *)var)); + } + + if ((var = switch_event_get_header(jsock->params, "caller-id-number"))) { + cJSON_AddItemToObject(obj, "caller-id-number", cJSON_CreateString((char *)var)); + } + + cJSON_AddItemToObject(params, "sockData", obj); + + switch_json_api_execute(params, NULL, response); return *response ? SWITCH_TRUE : SWITCH_FALSE; From 8c351a46672733e1ef7bb2d90a951534dff3421e Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 5 Aug 2020 01:39:11 +0000 Subject: [PATCH 409/655] [core, mod_verto] double udp buffer for audio, add verto command for video refresh --- src/mod/endpoints/mod_verto/mod_verto.c | 7 +++++-- src/switch_rtp.c | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index fb5c26bd50..8f8c1ca926 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3323,8 +3323,11 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock if ((session = switch_core_session_locate(call_id))) { tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); - - if (!strcasecmp(action, "updateMedia")) { + + if (!strcasecmp(action, "videoRefresh")) { + switch_core_media_gen_key_frame(tech_pvt->session); + switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); + } else if (!strcasecmp(action, "updateMedia")) { const char *sdp = NULL; uint8_t match = 0, p = 0; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 02b79362e7..1880bbb19c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2921,10 +2921,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s goto done; } - //if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { - // switch_socket_opt_set(new_sock, SWITCH_SO_RCVBUF, 1572864); - // switch_socket_opt_set(new_sock, SWITCH_SO_SNDBUF, 1572864); - //} + if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { + switch_socket_opt_set(new_sock, SWITCH_SO_RCVBUF, 1572864); + switch_socket_opt_set(new_sock, SWITCH_SO_SNDBUF, 1572864); + } else { + switch_socket_opt_set(new_sock, SWITCH_SO_RCVBUF, 851968); + switch_socket_opt_set(new_sock, SWITCH_SO_SNDBUF, 851968); + } if (switch_socket_bind(new_sock, rtp_session->local_addr) != SWITCH_STATUS_SUCCESS) { char *em = switch_core_sprintf(rtp_session->pool, "Bind Error! %s:%d", host, port); From 46903fb13e5fd5f2152d694bc4bcff727f4b92b6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Thu, 13 Aug 2020 21:08:32 +0000 Subject: [PATCH 410/655] [mod_verto] add chop-domain undocumented feature to allow FS to ignore @ in username --- src/mod/endpoints/mod_verto/mod_verto.c | 8 +++++--- src/mod/endpoints/mod_verto/mod_verto.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 8f8c1ca926..505b9892ee 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -970,10 +970,10 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * } else if (switch_true(jsock->profile->userauth)) { id = switch_core_strdup(jsock->pool, login); - if ((domain = strchr(id, '@'))) { + if (jsock->profile->chop_domain && (domain = strchr(id, '@'))) { *domain++ = '\0'; } - + } if (jsock->profile->register_domain) { @@ -5065,7 +5065,7 @@ static switch_status_t parse_config(const char *cf) profile->mcast_sub.sock = KS_SOCK_INVALID; profile->mcast_pub.sock = KS_SOCK_INVALID; - + profile->chop_domain = SWITCH_TRUE; for (param = switch_xml_child(xprofile, "param"); param; param = param->next) { char *var = NULL; @@ -5107,6 +5107,8 @@ static switch_status_t parse_config(const char *cf) profile->blind_reg = switch_true(val); } else if (!strcasecmp(var, "userauth") && !zstr(val)) { profile->userauth = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "chop-domain") && !zstr(val)) { + profile->chop_domain = switch_true(val); } else if (!strcasecmp(var, "root-password") && !zstr(val)) { profile->root_passwd = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "send-auth-password") && !zstr(val)) { diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index c9087e5ada..112fb09ae6 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -241,7 +241,8 @@ struct verto_profile_s { int ssl_ready; int ready; int debug; - + int chop_domain; + int in_thread; int blind_reg; From 4e84b34d30c64fc8458e0a3e99983a7eb0fe023e Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Tue, 25 Aug 2020 23:51:38 +0000 Subject: [PATCH 411/655] [core, mod_verto] add visibility filter to verto --- src/mod/endpoints/mod_verto/mod_verto.c | 18 +++++++++++++++++- src/switch_event.c | 7 +++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 505b9892ee..e5b46da344 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -672,8 +672,24 @@ static void write_event(const char *event_channel, jsock_t *use_jsock, cJSON *ev for(np = head->node; np; np = np->next) { cJSON *msg = NULL, *params; - + if (!use_jsock || use_jsock == np->jsock) { + const char *visibility; + //char *tmp; + + if ((visibility = cJSON_GetObjectCstr(event, "contentVisibility"))) { + if (strcasecmp(visibility, "public") && + ((use_jsock && use_jsock->id && !strncasecmp(use_jsock->id, "guest", 5)) || + (np->jsock->id && !strncasecmp(np->jsock->id, "guest", 5)))) { + + continue; + } + } + //tmp = cJSON_Print(event); + //printf("%s\n", tmp); + //free(tmp); + + params = cJSON_Duplicate(event, 1); cJSON_AddItemToObject(params, "eventSerno", cJSON_CreateNumber(np->serno++)); cJSON_AddItemToObject(params, "subscribedChannel", cJSON_CreateString(head->event_channel)); diff --git a/src/switch_event.c b/src/switch_event.c index 0a0e4b3c6c..3e5b05ae32 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -3608,7 +3608,8 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, c switch_status_t status = SWITCH_STATUS_SUCCESS; const char *action = "add"; cJSON *msg = NULL, *data = NULL; - + const char *visibility = NULL; + switch_mutex_lock(la->mutex); if ((node = switch_core_hash_find(la->hash, name))) { @@ -3675,7 +3676,9 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, c msg = cJSON_CreateObject(); data = json_add_child_obj(msg, "data", NULL); - + if ((visibility = cJSON_GetObjectCstr(node->obj, "contentVisibility"))) { + cJSON_AddItemToObject(msg, "contentVisibility", cJSON_CreateString(visibility)); + } cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel)); cJSON_AddItemToObject(data, "action", cJSON_CreateString(action)); From 6789eedd5b207a4fa01ad6399e4b644c977c830a Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Thu, 27 Aug 2020 01:41:40 +0000 Subject: [PATCH 412/655] [mod_verto] regression from fix for guest seeing non-public rooms --- src/mod/endpoints/mod_verto/mod_verto.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index e5b46da344..7ff6b1e799 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -681,8 +681,10 @@ static void write_event(const char *event_channel, jsock_t *use_jsock, cJSON *ev if (strcasecmp(visibility, "public") && ((use_jsock && use_jsock->id && !strncasecmp(use_jsock->id, "guest", 5)) || (np->jsock->id && !strncasecmp(np->jsock->id, "guest", 5)))) { - - continue; + + if (!switch_event_channel_permission_verify(np->jsock->uuid_str, event_channel)) { + continue; + } } } //tmp = cJSON_Print(event); From 7ad249974edabd68b199d0e34b45de46ff51d0c0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sat, 26 Sep 2020 02:09:34 +0000 Subject: [PATCH 413/655] [core] don't double set caller-id --- src/mod/endpoints/mod_verto/mod_verto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 7ff6b1e799..b08f06ae65 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -4033,7 +4033,9 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock caller_id_name = var; } } else if (caller_id_name) { - switch_event_add_header_string(jsock->params, SWITCH_STACK_BOTTOM, "caller-id-name", caller_id_name); + if (!switch_event_get_header(jsock->params, "caller-id-name")) { + switch_event_add_header_string(jsock->params, SWITCH_STACK_BOTTOM, "caller-id-name", caller_id_name); + } } if (zstr(caller_id_number)) { From f540bbbbe3595a7d92c030291452d7834043e34e Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Thu, 22 Oct 2020 19:25:29 +0000 Subject: [PATCH 414/655] [mod_verto] check permissions on the more specific event channel for guest users to allow them to subscribe to global events but still get send/don't send permission control on specific conferences --- src/mod/endpoints/mod_verto/mod_verto.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index b08f06ae65..d145dcaac0 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -663,7 +663,7 @@ static switch_status_t jsock_queue_event(jsock_t *jsock, cJSON **json, switch_bo return status; } -static void write_event(const char *event_channel, jsock_t *use_jsock, cJSON *event) +static void write_event(const char *event_channel, const char *super_channel, jsock_t *use_jsock, cJSON *event) { jsock_sub_node_head_t *head; @@ -676,13 +676,18 @@ static void write_event(const char *event_channel, jsock_t *use_jsock, cJSON *ev if (!use_jsock || use_jsock == np->jsock) { const char *visibility; //char *tmp; - + if ((visibility = cJSON_GetObjectCstr(event, "contentVisibility"))) { - if (strcasecmp(visibility, "public") && - ((use_jsock && use_jsock->id && !strncasecmp(use_jsock->id, "guest", 5)) || - (np->jsock->id && !strncasecmp(np->jsock->id, "guest", 5)))) { + if (strcasecmp(visibility, "public") && (np->jsock->id && !strncasecmp(np->jsock->id, "guest", 5))) { + int perm = 0; + + perm = switch_event_channel_permission_verify(np->jsock->uuid_str, event_channel); + + if (!perm && super_channel) { + perm = switch_event_channel_permission_verify(np->jsock->uuid_str, super_channel); + } - if (!switch_event_channel_permission_verify(np->jsock->uuid_str, event_channel)) { + if (!perm) { continue; } } @@ -690,7 +695,6 @@ static void write_event(const char *event_channel, jsock_t *use_jsock, cJSON *ev //tmp = cJSON_Print(event); //printf("%s\n", tmp); //free(tmp); - params = cJSON_Duplicate(event, 1); cJSON_AddItemToObject(params, "eventSerno", cJSON_CreateNumber(np->serno++)); @@ -744,14 +748,14 @@ static void jsock_send_event(cJSON *event) } switch_thread_rwlock_rdlock(verto_globals.event_channel_rwlock); - write_event(event_channel, use_jsock, event); + write_event(event_channel, NULL, use_jsock, event); if (strchr(event_channel, '.')) { char *main_channel = strdup(event_channel); char *p; switch_assert(main_channel); p = strchr(main_channel, '.'); if (p) *p = '\0'; - write_event(main_channel, use_jsock, event); + write_event(main_channel, event_channel, use_jsock, event); free(main_channel); } switch_thread_rwlock_unlock(verto_globals.event_channel_rwlock); @@ -4331,7 +4335,7 @@ static switch_bool_t verto__broadcast_func(const char *method, cJSON *params, js broadcast = cJSON_GetObjectItem(params, "localBroadcast"); if (broadcast && broadcast->type == cJSON_True) { - write_event(event_channel, NULL, jevent); + write_event(event_channel, NULL, NULL, jevent); } else { switch_event_channel_broadcast(event_channel, &jevent, modname, verto_globals.event_channel_id); } From 39b3caacb5cbe3c47a60b5e1e3c190c392144e79 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Mon, 9 Nov 2020 03:49:30 +0000 Subject: [PATCH 415/655] [core, mod_commands, mod_verto] small tweaks to cache stuff to allow clear from verto and allow no domain to imply the default domain --- src/mod/applications/mod_commands/mod_commands.c | 2 +- src/mod/endpoints/mod_verto/mod_verto.c | 1 + src/switch_xml.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index b5f7f5ff8e..a86cea3538 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -6742,7 +6742,7 @@ SWITCH_STANDARD_API(xml_flush_function) argc = switch_split(mycmd, ' ', argv); } - if (argc == 3) { + if (argc > 1) { r = switch_xml_clear_user_cache(argv[0], argv[1], argv[2]); } else { r = switch_xml_clear_user_cache(NULL, NULL, NULL); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index d145dcaac0..dc352bcb0c 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1118,6 +1118,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_snprintf(message, mlen, "Authentication Failure"); jsock->uid = NULL; login_fire_custom_event(jsock, params, 0, "Authentication Failure"); + switch_xml_clear_user_cache("id", id, domain); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"auth using %s\n",a1_hash ? "a1-hash" : "username & password"); r = SWITCH_TRUE; diff --git a/src/switch_xml.c b/src/switch_xml.c index bd0e7c8c38..6467758b72 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2010,6 +2010,10 @@ SWITCH_DECLARE(uint32_t) switch_xml_clear_user_cache(const char *key, const char switch_mutex_lock(CACHE_MUTEX); + if (key && user_name && !domain_name) { + domain_name = switch_core_get_variable("domain"); + } + if (key && user_name && domain_name) { switch_snprintf(mega_key, sizeof(mega_key), "%s%s%s", key, user_name, domain_name); From 3eddfc66a1f7ecab5e22e5e8d6b734848e98d150 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Mon, 7 Dec 2020 23:09:52 +0000 Subject: [PATCH 416/655] [mod_verto] pass in audio flags --- src/mod/endpoints/mod_verto/mod_verto.c | 30 ++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index dc352bcb0c..2b702911fc 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3606,16 +3606,40 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock return SWITCH_FALSE; } + static void parse_user_vars(cJSON *obj, switch_core_session_t *session) { - cJSON *json_ptr; - + cJSON *json_ptr, *var; + switch_channel_t *channel; + switch_assert(obj); switch_assert(session); + channel = switch_core_session_get_channel(session); + + + if ((json_ptr = cJSON_GetObjectItem(obj, "audio"))) { + if ((var = cJSON_GetObjectItem(json_ptr, "echoCancellation")) && var->type == cJSON_True) { + switch_channel_set_variable(channel, "verto_echoCancellation", "true"); + } else { + switch_channel_set_variable(channel, "verto_echoCancellation", "false"); + } + + if ((var = cJSON_GetObjectItem(json_ptr, "noiseSuppression")) && var->type == cJSON_True) { + switch_channel_set_variable(channel, "verto_noiseSuppression", "true"); + } else { + switch_channel_set_variable(channel, "verto_noiseSuppression", "false"); + } + + if ((var = cJSON_GetObjectItem(json_ptr, "autoGainControl")) && var->type == cJSON_True) { + switch_channel_set_variable(channel, "verto_autoGainControl", "true"); + } else { + switch_channel_set_variable(channel, "verto_autoGainControl", "false"); + } + } + if ((json_ptr = cJSON_GetObjectItem(obj, "userVariables"))) { cJSON * i; - switch_channel_t *channel = switch_core_session_get_channel(session); for(i = json_ptr->child; i; i = i->next) { char *varname = switch_core_session_sprintf(session, "verto_dvar_%s", i->string); From 6a893d499025562453a72a489bcba12ec260ebf4 Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@signalwire.com> Date: Sun, 24 Jan 2021 19:08:44 +0000 Subject: [PATCH 417/655] [mod_verto] put vars frorm user lookup into user_vars and protect user_vars --- src/mod/endpoints/mod_verto/mod_verto.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 2b702911fc..8174690fd1 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1028,7 +1028,8 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * if ((json_ptr = cJSON_GetObjectItem(params, "userVariables"))) { cJSON * i; - + + switch_mutex_lock(jsock->flag_mutex); for(i = json_ptr->child; i; i = i->next) { if (i->type == cJSON_True) { switch_event_add_header_string(jsock->user_vars, SWITCH_STACK_BOTTOM, i->string, "true"); @@ -1038,6 +1039,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_event_add_header_string(jsock->user_vars, SWITCH_STACK_BOTTOM, i->string, i->valuestring); } } + switch_mutex_unlock(jsock->flag_mutex); } if (jsock->profile->send_passwd || verto_globals.send_passwd) { @@ -1099,6 +1101,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_mutex_lock(jsock->flag_mutex); switch_event_add_header_string(jsock->vars, SWITCH_STACK_BOTTOM, var, val); + switch_event_add_header_string(jsock->user_vars, SWITCH_STACK_BOTTOM, var, val); switch_mutex_unlock(jsock->flag_mutex); } } @@ -2303,10 +2306,12 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char switch_channel_set_variable(tech_pvt->channel, "chat_proto", VERTO_CHAT_PROTO); switch_channel_set_variable(tech_pvt->channel, "verto_host", jsock->domain); + switch_mutex_lock(jsock->flag_mutex); for (hi = jsock->user_vars->headers; hi; hi = hi->next) { switch_channel_set_variable(tech_pvt->channel, hi->name, hi->value); } - + switch_mutex_unlock(jsock->flag_mutex); + if ((var = switch_event_get_header(jsock->params, "caller-id-name"))) { caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, var); } @@ -4098,10 +4103,11 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock switch_ivr_set_user(session, jsock->uid); + switch_mutex_lock(jsock->flag_mutex); for (hp = jsock->user_vars->headers; hp; hp = hp->next) { switch_channel_set_variable(channel, hp->name, hp->value); } - + switch_mutex_unlock(jsock->flag_mutex); switch_channel_set_profile_var(channel, "callee_id_name", remote_caller_id_name); switch_channel_set_profile_var(channel, "callee_id_number", remote_caller_id_number); @@ -4473,9 +4479,11 @@ static switch_bool_t jsapi_func(const char *method, cJSON *params, jsock_t *jsoc cJSON_AddItemToObject(obj, "chat_proto", cJSON_CreateString((char *)VERTO_CHAT_PROTO)); cJSON_AddItemToObject(obj, "verto_host", cJSON_CreateString((char *)jsock->domain)); + switch_mutex_lock(jsock->flag_mutex); for (hi = jsock->user_vars->headers; hi; hi = hi->next) { cJSON_AddItemToObject(obj, hi->name, cJSON_CreateString((char *)hi->value)); } + switch_mutex_unlock(jsock->flag_mutex); if ((var = switch_event_get_header(jsock->params, "caller-id-name"))) { cJSON_AddItemToObject(obj, "caller-id-name", cJSON_CreateString((char *)var)); From 79110fc71978777c867a6f498cb14e1a4a75f60b Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 3 Feb 2021 21:18:07 +0000 Subject: [PATCH 418/655] [mod_verto] auth-expires --- src/mod/endpoints/mod_verto/mod_verto.c | 28 +++++++++++++++++++++++++ src/mod/endpoints/mod_verto/mod_verto.h | 3 ++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 8174690fd1..f387e6ee8d 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1056,7 +1056,9 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * } else { switch_xml_t x_param, x_params; const char *use_passwd = NULL, *verto_context = NULL, *verto_dialplan = NULL; + time_t now = switch_epoch_time_now(NULL); + jsock->logintime = now; jsock->id = switch_core_strdup(jsock->pool, id); jsock->domain = switch_core_strdup(jsock->pool, domain); jsock->uid = switch_core_sprintf(jsock->pool, "%s@%s", id, domain); @@ -1103,6 +1105,18 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_event_add_header_string(jsock->vars, SWITCH_STACK_BOTTOM, var, val); switch_event_add_header_string(jsock->user_vars, SWITCH_STACK_BOTTOM, var, val); switch_mutex_unlock(jsock->flag_mutex); + + if (!strcmp(var, "login-expires")) { + uint32_t tmp = atol(val); + + if (tmp > now) { + jsock->exptime = tmp; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Login expire time for %s set to %ld seconds\n", jsock->uid, tmp - now); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid expire time for %s. Defaulting to 300 sec\n", jsock->uid); + jsock->exptime = now + 300; + } + } } } @@ -1950,11 +1964,21 @@ static void client_run(jsock_t *jsock) while(jsock->profile->running) { int pflags, poll_time = 50; + time_t now; if (!jsock->ws) { die("%s Setup Error\n", jsock->name); } pflags = kws_wait_sock(jsock->ws, poll_time, KS_POLL_READ); + if (jsock->exptime) { + now = switch_epoch_time_now(NULL); + + if (now >= jsock->exptime) { + die("%s Authentication Expired\n", jsock->uid); + } + + } + if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); } if (pflags < 0 && (errno != EINTR)) { die_errnof("%s POLL FAILED with %d", jsock->name, pflags); } if (pflags == 0) {/* socket poll timeout */ jsock_check_event_queue(jsock); idle += poll_time;} else {idle = 0;} @@ -4403,6 +4427,10 @@ static switch_bool_t login_func(const char *method, cJSON *params, jsock_t *jsoc *response = cJSON_CreateObject(); cJSON_AddItemToObject(*response, "message", cJSON_CreateString("logged in")); + if (jsock->exptime) { + cJSON_AddItemToObject(*response, "auth-expires", cJSON_CreateNumber(jsock->exptime)); + } + switch_mutex_lock(jsock->flag_mutex); if ((var = switch_event_get_header(jsock->vars, "moderator")) && switch_true(var)) { cJSON_AddItemToObject(*response, "moderator", cJSON_CreateTrue()); diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index 112fb09ae6..6d48a922c3 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -140,7 +140,8 @@ struct jsock_s { char remote_host[256]; int remote_port; int family; - + time_t exptime; + time_t logintime; struct verto_profile_s *profile; switch_thread_rwlock_t *rwlock; From 65ad502caff990978d3e4a0d6ec85443eb7c110f Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@signalwire.com> Date: Fri, 5 Feb 2021 21:31:17 +0000 Subject: [PATCH 419/655] [mod_verto] add verto_skip_set_user var to skip set_user in mod_verto --- src/mod/endpoints/mod_verto/mod_verto.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index f387e6ee8d..a8572f7a76 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -2930,7 +2930,9 @@ static switch_bool_t verto__answer_func(const char *method, cJSON *params, jsock switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP %s:\n%s\n", switch_channel_get_name(tech_pvt->channel), sdp); switch_core_media_set_sdp_codec_string(session, sdp, SDP_TYPE_RESPONSE); - switch_ivr_set_user(session, jsock->uid); + if (!switch_channel_var_true(switch_core_session_get_channel(session),"verto_skip_set_user")) { + switch_ivr_set_user(session, jsock->uid); + } if (switch_core_session_get_partner(tech_pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) { switch_channel_t *other_channel = switch_core_session_get_channel(other_session); @@ -4125,7 +4127,9 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock } - switch_ivr_set_user(session, jsock->uid); + if (!switch_channel_var_true(channel,"verto_skip_set_user")) { + switch_ivr_set_user(session, jsock->uid); + } switch_mutex_lock(jsock->flag_mutex); for (hp = jsock->user_vars->headers; hp; hp = hp->next) { From 0fcdeffb0d616dc3865d395b52b4b2e13dd21820 Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@signalwire.com> Date: Tue, 9 Feb 2021 19:34:37 +0000 Subject: [PATCH 420/655] [mod_verto] allow re-auth via verto.login --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index a8572f7a76..3ae8913d04 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1460,7 +1460,7 @@ static cJSON *process_jrpc(jsock_t *jsock, cJSON *json) jrpc_add_id(reply, id, "", 0); - if (!switch_test_flag(jsock, JPFLAG_AUTHED) && (jsock->profile->userauth || jsock->profile->root_passwd)) { + if ((!switch_test_flag(jsock, JPFLAG_AUTHED) || (method && !strcmp(method, "login"))) && (jsock->profile->userauth || jsock->profile->root_passwd)) { int code = CODE_AUTH_REQUIRED; char message[128] = "Authentication Required"; From 8c9d0ecd9e97a3dc5ed78de194385ba380e16913 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 5 Mar 2021 01:46:01 +0000 Subject: [PATCH 421/655] [mod_verto] add a way to broadcast an event to one session --- src/mod/endpoints/mod_verto/mod_verto.c | 39 +++++++++++++------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 3ae8913d04..2faf77455e 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -710,7 +710,7 @@ static void write_event(const char *event_channel, const char *super_channel, js static void jsock_send_event(cJSON *event) { - const char *event_channel, *session_uuid = NULL; + const char *event_channel, *session_uuid = NULL, *direct_id = NULL; jsock_t *use_jsock = NULL; switch_core_session_t *session = NULL; @@ -719,17 +719,27 @@ static void jsock_send_event(cJSON *event) return; } - - if ((session = switch_core_session_locate(event_channel))) { - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *jsock_uuid_str = switch_channel_get_variable(channel, "jsock_uuid_str"); - if (jsock_uuid_str) { - use_jsock = get_jsock(jsock_uuid_str); - } - switch_core_session_rwunlock(session); + if (!(direct_id = cJSON_GetObjectCstr(event, "eventChannelSessid"))) { + direct_id = event_channel; } - if (use_jsock || (use_jsock = get_jsock(event_channel))) { /* implicit subscription to channel identical to the connection uuid or session uuid */ + if ((session_uuid = cJSON_GetObjectCstr(event, "sessid"))) { + if (!(use_jsock = get_jsock(session_uuid))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Socket %s not connected\n", session_uuid); + return; + } + } else { + if ((session = switch_core_session_locate(direct_id))) { + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *jsock_uuid_str = switch_channel_get_variable(channel, "jsock_uuid_str"); + if (jsock_uuid_str) { + use_jsock = get_jsock(jsock_uuid_str); + } + switch_core_session_rwunlock(session); + } + } + + if (use_jsock || (use_jsock = get_jsock(direct_id))) { /* implicit subscription to channel identical to the connection uuid or session uuid */ cJSON *msg = NULL, *params; params = cJSON_Duplicate(event, 1); msg = jrpc_new_req("verto.event", NULL, &params); @@ -739,14 +749,6 @@ static void jsock_send_event(cJSON *event) return; } - - if ((session_uuid = cJSON_GetObjectCstr(event, "sessid"))) { - if (!(use_jsock = get_jsock(session_uuid))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Socket %s not connected\n", session_uuid); - return; - } - } - switch_thread_rwlock_rdlock(verto_globals.event_channel_rwlock); write_event(event_channel, NULL, use_jsock, event); if (strchr(event_channel, '.')) { @@ -4383,6 +4385,7 @@ static switch_bool_t verto__broadcast_func(const char *method, cJSON *params, js cJSON_AddItemToObject(params, "userid", cJSON_CreateString(jsock->uid)); + cJSON_AddItemToObject(params, "sessid", cJSON_CreateString(jsock->uuid_str)); display = switch_event_get_header(jsock->params, "caller-id-name"); if (display) { From d5f9155f902d3ad5261bea7339075a129414dcd7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Sun, 14 Mar 2021 19:21:01 +0000 Subject: [PATCH 422/655] [mod_verto] more perms checks --- src/mod/endpoints/mod_verto/mod_verto.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 2faf77455e..610ec131c9 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -663,6 +663,7 @@ static switch_status_t jsock_queue_event(jsock_t *jsock, cJSON **json, switch_bo return status; } +static switch_bool_t event_channel_check_auth(jsock_t *jsock, const char *event_channel); static void write_event(const char *event_channel, const char *super_channel, jsock_t *use_jsock, cJSON *event) { jsock_sub_node_head_t *head; @@ -680,13 +681,21 @@ static void write_event(const char *event_channel, const char *super_channel, js if ((visibility = cJSON_GetObjectCstr(event, "contentVisibility"))) { if (strcasecmp(visibility, "public") && (np->jsock->id && !strncasecmp(np->jsock->id, "guest", 5))) { int perm = 0; + + perm = event_channel_check_auth(np->jsock, event_channel); + + if (!perm && super_channel) { + perm = event_channel_check_auth(np->jsock, super_channel); + } - perm = switch_event_channel_permission_verify(np->jsock->uuid_str, event_channel); + if (!perm) { + perm = switch_event_channel_permission_verify(np->jsock->uuid_str, event_channel); + } if (!perm && super_channel) { perm = switch_event_channel_permission_verify(np->jsock->uuid_str, super_channel); } - + if (!perm) { continue; } From 6c4bc433b4bbe64fc68fb4d45c93382f4977d0e8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 31 Mar 2021 20:13:38 +0000 Subject: [PATCH 423/655] [mod_verto] add exptime to ping and pong and log any hangups as a result of auth expiring --- src/mod/endpoints/mod_verto/mod_verto.c | 23 ++++++++++++++++++++++- src/mod/endpoints/mod_verto/mod_verto.h | 3 ++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 610ec131c9..85d1f3e49c 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1117,6 +1117,8 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_event_add_header_string(jsock->user_vars, SWITCH_STACK_BOTTOM, var, val); switch_mutex_unlock(jsock->flag_mutex); + switch_clear_flag(jsock, JPFLAG_AUTH_EXPIRED); + if (!strcmp(var, "login-expires")) { uint32_t tmp = atol(val); @@ -1348,7 +1350,16 @@ static void drop_detached(void) } if (tech_pvt->detach_time && (now - tech_pvt->detach_time) > verto_globals.detach_timeout) { - switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE); + jsock_t *jsock = NULL; + + if ((jsock = get_jsock(tech_pvt->jsock_uuid))) { + if (switch_test_flag(jsock, JPFLAG_AUTH_EXPIRED)) { + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTAUTH); + } + switch_thread_rwlock_unlock(jsock->rwlock); + } else { + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE); + } } } switch_thread_rwlock_unlock(verto_globals.tech_rwlock); @@ -1985,6 +1996,7 @@ static void client_run(jsock_t *jsock) now = switch_epoch_time_now(NULL); if (now >= jsock->exptime) { + switch_set_flag(jsock, JPFLAG_AUTH_EXPIRED); die("%s Authentication Expired\n", jsock->uid); } @@ -1998,6 +2010,10 @@ static void client_run(jsock_t *jsock) cJSON *params = NULL; cJSON *msg = jrpc_new_req("verto.ping", 0, &params); + if (jsock->exptime) { + cJSON_AddItemToObject(params, "auth-expires", cJSON_CreateNumber(jsock->exptime)); + } + cJSON_AddItemToObject(params, "serno", cJSON_CreateNumber(switch_epoch_time_now(NULL))); jsock_queue_event(jsock, &msg, SWITCH_TRUE); idle = 0; @@ -3700,6 +3716,11 @@ static void parse_user_vars(cJSON *obj, switch_core_session_t *session) static switch_bool_t verto__ping_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { *response = cJSON_CreateObject(); + + if (jsock->exptime) { + cJSON_AddItemToObject(*response, "auth-expires", cJSON_CreateNumber(jsock->exptime)); + } + cJSON_AddItemToObject(*response, "message", cJSON_CreateString("PONG")); return SWITCH_TRUE; } diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index 6d48a922c3..f3326f605d 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -95,7 +95,8 @@ typedef enum { JPFLAG_CHECK_ATTACH = (1 << 2), JPFLAG_EVENTS = (1 << 3), JPFLAG_AUTH_EVENTS = (1 << 4), - JPFLAG_ALL_EVENTS_AUTHED = (1 << 5) + JPFLAG_ALL_EVENTS_AUTHED = (1 << 5), + JPFLAG_AUTH_EXPIRED = (1 << 6) } jpflag_t; struct verto_profile_s; From 756d62137abdfaf9b0461c4c0dec337eb4769d31 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Fri, 2 Apr 2021 23:02:38 +0000 Subject: [PATCH 424/655] [mod_verto] add some more log lines --- src/mod/endpoints/mod_verto/mod_verto.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 85d1f3e49c..610523cf39 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1069,6 +1069,8 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * const char *use_passwd = NULL, *verto_context = NULL, *verto_dialplan = NULL; time_t now = switch_epoch_time_now(NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Login sucessful for user: %s domain: %s\n", id, domain ? domain : "N/A"); + jsock->logintime = now; jsock->id = switch_core_strdup(jsock->pool, id); jsock->domain = switch_core_strdup(jsock->pool, domain); @@ -1124,7 +1126,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * if (tmp > now) { jsock->exptime = tmp; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Login expire time for %s set to %ld seconds\n", jsock->uid, tmp - now); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Login expire time for %s set to %ld seconds [%ld] [%ld]\n", jsock->uid, tmp - now, jsock->exptime, now); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid expire time for %s. Defaulting to 300 sec\n", jsock->uid); jsock->exptime = now + 300; @@ -1997,7 +1999,7 @@ static void client_run(jsock_t *jsock) if (now >= jsock->exptime) { switch_set_flag(jsock, JPFLAG_AUTH_EXPIRED); - die("%s Authentication Expired\n", jsock->uid); + die("%s Authentication Expired [%ld] >= [%ld]\n", jsock->uid, now, jsock->exptime); } } From a3c6e70f56aa27aafaf27e5dd4c51ea7b67ec648 Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 12 May 2021 04:09:54 +0000 Subject: [PATCH 425/655] [mod_verto] print json debug compact --- src/mod/endpoints/mod_verto/mod_verto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 610523cf39..152229c32d 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -602,9 +602,9 @@ static switch_ssize_t ws_write_json(jsock_t *jsock, cJSON **json, switch_bool_t if ((json_text = cJSON_PrintUnformatted(*json))) { if (jsock->profile->debug || verto_globals.debug) { - char *log_text = cJSON_Print(*json); - switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "WRITE %s [%s]\n", jsock->name, log_text); - free(log_text); + //char *log_text = cJSON_Prin(*json); + switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "WRITE %s [%s]\n", jsock->name, json_text); + //free(log_text); } switch_mutex_lock(jsock->write_mutex); r = kws_write_frame(jsock->ws, WSOC_TEXT, json_text, strlen(json_text)); @@ -1539,7 +1539,7 @@ static switch_status_t process_input(jsock_t *jsock, uint8_t *data, switch_ssize if (json) { if (jsock->profile->debug || verto_globals.debug) { - char *log_text = cJSON_Print(json); + char *log_text = cJSON_PrintUnformatted(json); switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "READ %s [%s]\n", jsock->name, log_text); free(log_text); } @@ -6173,7 +6173,7 @@ void verto_broadcast(const char *event_channel, cJSON *json, const char *key, sw { if (verto_globals.debug > 9) { char *json_text; - if ((json_text = cJSON_Print(json))) { + if ((json_text = cJSON_PrintUnformatted(json))) { switch_log_printf(SWITCH_CHANNEL_LOG, verto_globals.debug_level, "EVENT BROADCAST %s %s\n", event_channel, json_text); free(json_text); } From 7ed2a99eb55df82538bb03be171afe9dd556019e Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 13 Oct 2021 18:21:52 +0300 Subject: [PATCH 426/655] [mod_sofia] Implement maximum receiving requests per second max-recv-requests-per-second profile parameter. (Warning: Behaviour change. New default is 1000 requests per second) --- conf/vanilla/sip_profiles/internal-ipv6.xml | 2 ++ conf/vanilla/sip_profiles/internal.xml | 2 ++ src/mod/endpoints/mod_sofia/conf/sofia.conf.xml | 2 ++ src/mod/endpoints/mod_sofia/mod_sofia.c | 2 ++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 12 ++++++++++++ 6 files changed, 21 insertions(+) diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml index 21bb1f1e77..f067ae7482 100644 --- a/conf/vanilla/sip_profiles/internal-ipv6.xml +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml @@ -36,6 +36,8 @@ <!-- <param name="bitpacking" value="aal2"/> --> <!--max number of open dialogs in proceeding --> <!--<param name="max-proceeding" value="1000"/>--> + <!--max number of receiving requests per second (Default: 1000, 0 - unlimited) --> + <!--<param name="max-recv-requests-per-second" value="0"/>--> <!--session timers for all call to expire after the specified seconds --> <!--<param name="session-timeout" value="1800"/>--> <!--<param name="multiple-registrations" value="true"/>--> diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index 85692fa631..749e4b0687 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -172,6 +172,8 @@ <!-- <param name="bitpacking" value="aal2"/> --> <!--max number of open dialogs in proceeding --> <!--<param name="max-proceeding" value="1000"/>--> + <!--max number of receiving requests per second (Default: 1000, 0 - unlimited) --> + <!--<param name="max-recv-requests-per-second" value="0"/> --> <!--session timers for all call to expire after the specified seconds --> <!--<param name="session-timeout" value="1800"/>--> <!-- Can be 'true' or 'contact' --> diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 37e0937aeb..0f5db4468f 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -205,6 +205,8 @@ <!-- <param name="bitpacking" value="aal2"/> --> <!-- max number of open dialogs in proceeding --> <!-- <param name="max-proceeding" value="1000"/> --> + <!-- max number of receiving requests per second (Default: 1000, 0 - unlimited) --> + <!-- <param name="max-recv-requests-per-second" value="0"/> --> <!-- session timers for all call to expire after the specified seconds --> <!-- <param name="session-timeout" value="1800"/> --> <!-- Can be 'true' or 'contact' --> diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 1637cff924..a3a6cd8e91 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3061,6 +3061,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t stream->write_function(stream, "CNG \t%d\n", profile->cng_pt); stream->write_function(stream, "SESSION-TO \t%d\n", profile->session_timeout); stream->write_function(stream, "MAX-DIALOG \t%d\n", profile->max_proceeding); + stream->write_function(stream, "MAX-RECV-RPS \t%d\n", profile->max_recv_requests_per_second); stream->write_function(stream, "NOMEDIA \t%s\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false"); stream->write_function(stream, "LATE-NEG \t%s\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false"); stream->write_function(stream, "PROXY-MEDIA \t%s\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false"); @@ -3363,6 +3364,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl stream->write_function(stream, " <cng>%d</cng>\n", profile->cng_pt); stream->write_function(stream, " <session-to>%d</session-to>\n", profile->session_timeout); stream->write_function(stream, " <max-dialog>%d</max-dialog>\n", profile->max_proceeding); + stream->write_function(stream, " <max-recv-rps>%d</max-recv-rps>\n", profile->max_recv_requests_per_second); stream->write_function(stream, " <nomedia>%s</nomedia>\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false"); stream->write_function(stream, " <late-neg>%s</late-neg>\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false"); stream->write_function(stream, " <proxy-media>%s</proxy-media>\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 6e118e1fe3..3408b7ca0b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -722,6 +722,7 @@ struct sofia_profile { uint32_t session_timeout; uint32_t minimum_session_expires; uint32_t max_proceeding; + uint32_t max_recv_requests_per_second; uint32_t rtp_timeout_sec; uint32_t rtp_hold_timeout_sec; char *odbc_dsn; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 25e3278c97..36f3087db1 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3345,6 +3345,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TAG_IF(profile->session_timeout && profile->minimum_session_expires, NUTAG_MIN_SE(profile->minimum_session_expires)), NUTAG_SESSION_TIMER(profile->session_timeout), NTATAG_MAX_PROCEEDING(profile->max_proceeding), + NTATAG_MAX_RECV_REQUESTS_PER_SECOND(profile->max_recv_requests_per_second), TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")), TAG_IF(profile->pres_type, NUTAG_ALLOW("SUBSCRIBE")), TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)), @@ -4571,6 +4572,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) char *auth_subscriptions_value = NULL; uint8_t disable_message_auth_flag = 0; uint8_t disable_subscription_auth_flag = 0; + uint8_t max_recv_requests_per_second_initialized = 0; if (!xprofilename) { xprofilename = "unnamed"; @@ -5307,6 +5309,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) if (v_max_proceeding >= 0) { profile->max_proceeding = v_max_proceeding; } + } else if (!strcasecmp(var, "max-recv-requests-per-second") && !zstr(val)) { + int v_max_recv_requests_per_second = atoi(val); + if (v_max_recv_requests_per_second >= 0) { + profile->max_recv_requests_per_second = v_max_recv_requests_per_second; + max_recv_requests_per_second_initialized = 1; + } } else if (!strcasecmp(var, "rtp-timeout-sec") && !zstr(val)) { int v = atoi(val); if (v >= 0) { @@ -6097,6 +6105,10 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } + if (!max_recv_requests_per_second_initialized) { + profile->max_recv_requests_per_second = 1000; + } + if (!disable_message_auth_flag) { if (!auth_messages_value || switch_true(auth_messages_value)) { sofia_set_pflag(profile, PFLAG_AUTH_MESSAGES); From b7f908e8907a143bac52cbd2903c17a98e450d0c Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 8 Oct 2021 20:24:43 +0300 Subject: [PATCH 427/655] [mod_sofia] Destroy nua handles to avoid memory pool swell when system is unavailable (busy, paused or reached internal limits) --- src/mod/endpoints/mod_sofia/sofia.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 36f3087db1..5066a13ef8 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2462,17 +2462,20 @@ void sofia_event_callback(nua_event_t event, if (!sofia_private) { if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready_inbound()) { nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), NUTAG_WITH_THIS(nua), TAG_END()); + nua_handle_destroy(nh); goto end; } if (switch_queue_size(mod_sofia_globals.msg_queue) > (unsigned int)critical) { nua_respond(nh, 503, "System Busy", SIPTAG_RETRY_AFTER_STR("300"), NUTAG_WITH_THIS(nua), TAG_END()); + nua_handle_destroy(nh); goto end; } if (sofia_test_pflag(profile, PFLAG_STANDBY)) { nua_respond(nh, 503, "System Paused", NUTAG_WITH_THIS(nua), TAG_END()); + nua_handle_destroy(nh); goto end; } } From 35c2af75ce6c75a348146aa76c0a51df0eb8202f Mon Sep 17 00:00:00 2001 From: Dhruv Gupta <87171798+dhruvecosmob@users.noreply.github.com> Date: Tue, 19 Oct 2021 19:19:08 +0530 Subject: [PATCH 428/655] [Unit-tests] Fix-up usage of sipp in the register_403 unit-test of mod_sofia --- src/mod/endpoints/mod_sofia/test/sipp-based-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0ae1ff51c3..a7a380588f 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -555,7 +555,7 @@ skiptest: switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler_reg_fail, NULL); - sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uac_407_subscriber.xml", "-inf data.csv"); + sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uas_register_403.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { fst_requires(0); /* sipp not found */ } From 3c85fd34d76c760d65d443b6097fa35d89fc522c Mon Sep 17 00:00:00 2001 From: Len <Len-PGH@users.noreply.github.com> Date: Thu, 21 Oct 2021 10:58:11 -0400 Subject: [PATCH 429/655] [mod_valet_parking] Fix typo in valet_parking_orbit_dialplan channel variable. --- src/mod/applications/mod_valet_parking/mod_valet_parking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index 9d8f9e6938..1b088ec957 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -96,7 +96,7 @@ static switch_status_t valet_on_dtmf(switch_core_session_t *session, void *input switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "valet_on_dtmf() - digit pressed '%d' matched valet_parking_orbit_exit_key '%d'\n", dtmf->digit, exit_key_pvt->digit); - dp = switch_channel_get_variable(channel, "valet_parking_orbin_dialplan"); + dp = switch_channel_get_variable(channel, "valet_parking_orbit_dialplan"); if (zstr(dp)) { dp = switch_channel_get_variable(channel, "XML"); } From f31c73a11d3500966b724110b0aaa8a2ef5c3cdb Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Thu, 21 Oct 2021 16:09:34 +0000 Subject: [PATCH 430/655] [core] Add type checking for SWITCH_CHANNEL_SESSION_LOG and SWITCH_CHANNEL_UUID_LOG macros. --- src/include/switch_types.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index a4e4059176..bb06cfa0ea 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1329,13 +1329,17 @@ typedef enum { } switch_core_session_message_flag_enum_t; typedef uint32_t switch_core_session_message_flag_t; +typedef struct switch_core_session switch_core_session_t; +static inline switch_core_session_t *switch_core_session_type_check(switch_core_session_t *session) { return session; } +static inline const char *switch_const_char_type_check(const char *str) { return str; } + #define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL #define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL #define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, switch_core_session_get_uuid((x)) #define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL -#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)(x) +#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_core_session_type_check(x) #define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_channel_get_session(x) -#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, (x) +#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, switch_const_char_type_check(x) typedef enum { CCS_DOWN, @@ -2336,7 +2340,6 @@ typedef struct switch_rtcp_frame switch_rtcp_frame_t; typedef struct switch_channel switch_channel_t; typedef struct switch_sql_queue_manager switch_sql_queue_manager_t; typedef struct switch_file_handle switch_file_handle_t; -typedef struct switch_core_session switch_core_session_t; typedef struct switch_caller_profile switch_caller_profile_t; typedef struct switch_caller_extension switch_caller_extension_t; typedef struct switch_caller_application switch_caller_application_t; From 24ff01518fb678e350f3621f4231e72b50b5a5cd Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 23 Oct 2021 01:24:17 +0300 Subject: [PATCH 431/655] [Unit-tests] Fix build of various unit-tests. --- tests/unit/switch_core_session.c | 3 ++- tests/unit/switch_ivr_async.c | 13 +++++++++---- tests/unit/switch_ivr_play_say.c | 14 ++++++-------- tests/unit/switch_log.c | 8 ++++---- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/tests/unit/switch_core_session.c b/tests/unit/switch_core_session.c index 57beea3bee..f5f6f51ba7 100644 --- a/tests/unit/switch_core_session.c +++ b/tests/unit/switch_core_session.c @@ -48,10 +48,11 @@ FST_CORE_BEGIN("./conf") FST_SESSION_BEGIN(session_external_id) { + switch_core_session_t *session; fst_check(switch_core_session_set_external_id(fst_session, switch_core_session_get_uuid(fst_session)) == SWITCH_STATUS_SUCCESS); fst_check_string_equals(switch_core_session_get_external_id(fst_session), switch_core_session_get_uuid(fst_session)); fst_check(switch_core_session_set_external_id(fst_session, "foo") == SWITCH_STATUS_SUCCESS); - switch_core_session_t *session = switch_core_session_locate("foo"); + session = switch_core_session_locate("foo"); fst_requires(session); fst_check_string_equals(switch_core_session_get_uuid(session), switch_core_session_get_uuid(fst_session)); fst_check_string_equals(switch_core_session_get_external_id(session), "foo"); diff --git a/tests/unit/switch_ivr_async.c b/tests/unit/switch_ivr_async.c index dedf026dd5..7b6a5e86c8 100644 --- a/tests/unit/switch_ivr_async.c +++ b/tests/unit/switch_ivr_async.c @@ -43,6 +43,7 @@ static switch_status_t partial_play_and_collect_input_callback(switch_core_sessi if (event->event_id == SWITCH_EVENT_DETECTED_SPEECH) { const char *speech_type = switch_event_get_header(event, "Speech-Type"); + char *body; if (zstr(speech_type) || strcmp(speech_type, "detected-partial-speech")) { return status; @@ -51,7 +52,7 @@ static switch_status_t partial_play_and_collect_input_callback(switch_core_sessi (*count)++; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "partial events count: %d\n", *count); - char *body = switch_event_get_body(event); + body = switch_event_get_body(event); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "body=[%s]\n", body); } } else if (input_type == SWITCH_INPUT_TYPE_DTMF) { @@ -67,6 +68,9 @@ FST_CORE_BEGIN("./conf_async") { FST_SETUP_BEGIN() { + if (0) { + partial_play_and_collect_input_callback(NULL, NULL, 0, NULL, 0); + } fst_requires_module("mod_tone_stream"); fst_requires_module("mod_sndfile"); fst_requires_module("mod_dptools"); @@ -82,7 +86,8 @@ FST_CORE_BEGIN("./conf_async") FST_SESSION_BEGIN(session_record_pause) { const char *record_filename = switch_core_session_sprintf(fst_session, "%s%s%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(fst_session)); - + const char *duration_ms_str; + int duration_ms; switch_status_t status; status = switch_ivr_record_session_event(fst_session, record_filename, 0, NULL, NULL); fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session() to return SWITCH_STATUS_SUCCESS"); @@ -110,9 +115,9 @@ FST_CORE_BEGIN("./conf_async") unlink(record_filename); - const char *duration_ms_str = switch_channel_get_variable(fst_channel, "record_ms"); + duration_ms_str = switch_channel_get_variable(fst_channel, "record_ms"); fst_requires(duration_ms_str != NULL); - int duration_ms = atoi(duration_ms_str); + duration_ms = atoi(duration_ms_str); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_NOTICE, "Recording duration is %s ms\n", duration_ms_str); fst_xcheck(duration_ms > 3500 && duration_ms < 3700, "Expect recording to be between 3500 and 3700 ms"); } diff --git a/tests/unit/switch_ivr_play_say.c b/tests/unit/switch_ivr_play_say.c index 3e2ded6aff..c23a2d3332 100644 --- a/tests/unit/switch_ivr_play_say.c +++ b/tests/unit/switch_ivr_play_say.c @@ -36,10 +36,10 @@ static void on_record_start(switch_event_t *event) { char *str = NULL; + const char *uuid = switch_event_get_header(event, "Unique-ID"); switch_event_serialize(event, &str, SWITCH_FALSE); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s", str); switch_safe_free(str); - const char *uuid = switch_event_get_header(event, "Unique-ID"); if (uuid) { switch_core_session_t *session = switch_core_session_locate(uuid); if (session) { @@ -56,10 +56,10 @@ static void on_record_start(switch_event_t *event) static void on_record_stop(switch_event_t *event) { char *str = NULL; + const char *uuid = switch_event_get_header(event, "Unique-ID"); switch_event_serialize(event, &str, SWITCH_FALSE); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s", str); switch_safe_free(str); - const char *uuid = switch_event_get_header(event, "Unique-ID"); if (uuid) { switch_core_session_t *session = switch_core_session_locate(uuid); if (session) { @@ -83,6 +83,7 @@ static switch_status_t partial_play_and_collect_input_callback(switch_core_sessi if (event->event_id == SWITCH_EVENT_DETECTED_SPEECH) { const char *speech_type = switch_event_get_header(event, "Speech-Type"); + char *body = switch_event_get_body(event); if (zstr(speech_type) || strcmp(speech_type, "detected-partial-speech")) { return status; @@ -90,8 +91,6 @@ static switch_status_t partial_play_and_collect_input_callback(switch_core_sessi (*count)++; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "partial events count: %d\n", *count); - - char *body = switch_event_get_body(event); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "body=[%s]\n", body); } } else if (input_type == SWITCH_INPUT_TYPE_DTMF) { @@ -354,6 +353,9 @@ FST_CORE_BEGIN("./conf_playsay") char *speech_grammar_args = switch_core_session_sprintf(fst_session, "{start-input-timers=false,no-input-timeout=%d,vad-silence-ms=%d,speech-timeout=%d,language=en-US,partial=true}default", no_input_timeout, speech_complete_timeout, speech_recognition_timeout); switch_status_t status; + switch_input_args_t collect_input_args = { 0 }; + switch_input_args_t *args = NULL; + int count = 0; switch_ivr_displace_session(fst_session, "file_string://silence_stream://500,0!tone_stream://%%(2000,0,350,440)", 0, "r"); terminator_collected = 0; @@ -377,10 +379,6 @@ FST_CORE_BEGIN("./conf_playsay") if (recognition_result) cJSON_Delete(recognition_result); recognition_result = NULL; - switch_input_args_t collect_input_args = { 0 }; - switch_input_args_t *args = NULL; - int count = 0; - args = &collect_input_args; args->input_callback = partial_play_and_collect_input_callback; args->buf = &count; diff --git a/tests/unit/switch_log.c b/tests/unit/switch_log.c index a56612fc28..ee4783f283 100644 --- a/tests/unit/switch_log.c +++ b/tests/unit/switch_log.c @@ -90,12 +90,12 @@ static char *wait_for_log(switch_interval_time_t timeout_ms) FST_CORE_BEGIN("./conf") { - switch_core_new_memory_pool(&pool); - switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, pool); - switch_thread_cond_create(&cond, pool); - FST_SUITE_BEGIN(switch_log) { + switch_core_new_memory_pool(&pool); + switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, pool); + switch_thread_cond_create(&cond, pool); + FST_SETUP_BEGIN() { json_format.custom_field_prefix = NULL; From fe34509bc594da147c7c1dffa1acb74e356a45f6 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Thu, 30 Jan 2020 22:37:08 +0000 Subject: [PATCH 432/655] [mod_conference] scan-build: Value stored to 'status' is never read - conference_loop_input() --- src/mod/applications/mod_conference/conference_loop.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index 25b418c55d..8c3804ef8c 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -842,7 +842,6 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob if (conference_utils_test_flag(member->conference, CFLAG_BREAKABLE) && switch_channel_test_flag(channel, CF_BREAK)) { switch_channel_clear_flag(channel, CF_BREAK); - status = SWITCH_STATUS_BREAK; break; } From a617d5857c5c33e390436106f9b45905522620c7 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Sat, 18 Apr 2020 16:13:38 +0000 Subject: [PATCH 433/655] [mod_conference] fix crash when using conference heartbeat --- src/mod/applications/mod_conference/mod_conference.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 1a8aa09e88..71fd17532c 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -264,7 +264,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob last_heartbeat_time = now; switch_event_create_subclass(&heartbeat_event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); conference_event_add_data(conference, heartbeat_event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "conference-heartbeat"); + switch_event_add_header_string(heartbeat_event, SWITCH_STACK_BOTTOM, "Action", "conference-heartbeat"); switch_event_fire(&heartbeat_event); } From cada5c37dc3f74229e510d434ea15df4d89c0d2c Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 17 Apr 2020 23:09:40 +0000 Subject: [PATCH 434/655] [core] Fix regression in play_and_collect_input and play_and_detect_speech - read_frame_callback and user_data from input args was not preserved. --- src/switch_ivr_async.c | 2 ++ src/switch_ivr_play_say.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 95bdec7352..6d404fd5b4 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -4904,6 +4904,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se if (args) { state.original_args = args; myargs.dmachine = args->dmachine; + myargs.read_frame_callback = args->read_frame_callback; + myargs.user_data = args->user_data; } myargs.input_callback = play_and_detect_input_callback; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 49b5445b89..9f5574d39b 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -3467,13 +3467,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_se if (args) { state.original_args = args; myargs.dmachine = args->dmachine; + myargs.read_frame_callback = args->read_frame_callback; + myargs.user_data = args->user_data; } myargs.input_callback = switch_collect_input_callback; myargs.buf = &state; myargs.buflen = sizeof(state); - switch_set_flag(&state, SWITCH_COLLECT_INPUT_PROMPT); status = switch_ivr_play_file(session, NULL, prompt, &myargs); switch_clear_flag(&state, SWITCH_COLLECT_INPUT_PROMPT); From a6178e88fb0d4dca8f62c2d8de3260e7f9ad0dae Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 28 Oct 2020 17:46:52 +0400 Subject: [PATCH 435/655] [mod_sofia] Fix use of NUTAG_CALL_TLS_ORQ_CONNECT_TIMEOUT when sip_call_tls_orq_connect_timeout channel variable is undefined. --- src/mod/endpoints/mod_sofia/sofia_glue.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 9fd0cea4e9..5b937ecc63 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1065,10 +1065,11 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) uint8_t is_t38 = 0; const char *hold_char = "*"; const char *session_id_header = sofia_glue_session_id_header(session, tech_pvt->profile); + const char *sip_call_tls_orq_connect_timeout_str = switch_channel_get_variable(tech_pvt->channel, "sip_call_tls_orq_connect_timeout"); + uint32_t sip_call_tls_orq_connect_timeout = (sip_call_tls_orq_connect_timeout_str) ? atoi(sip_call_tls_orq_connect_timeout_str) : 0; const char *stir_shaken_attest = NULL; char *identity_to_free = NULL; const char *date = NULL; - const char *sip_call_tls_orq_connect_timeout = switch_channel_get_variable(tech_pvt->channel, "sip_call_tls_orq_connect_timeout"); if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD_INACTIVE) || @@ -1403,7 +1404,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) TAG_IF(!zstr(record_route), SIPTAG_HEADER_STR(record_route)), #ifdef NUTAG_CALL_TLS_ORQ_CONNECT_TIMEOUT /* Per call tls outgoing request connect timeout */ - TAG_IF(sip_call_tls_orq_connect_timeout, NUTAG_CALL_TLS_ORQ_CONNECT_TIMEOUT(atoi(sip_call_tls_orq_connect_timeout))), + TAG_IF(sip_call_tls_orq_connect_timeout_str, NUTAG_CALL_TLS_ORQ_CONNECT_TIMEOUT(sip_call_tls_orq_connect_timeout)), #endif SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END()))) { From a5365eb0805a6857938cb9b2c3bf7c3d2e8b95b0 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 10 Nov 2020 20:33:03 +0400 Subject: [PATCH 436/655] [mod_sofia] Fix build on older sofia-sip when NUTAG_CALL_TLS_ORQ_CONNECT_TIMEOUT tag is undefined. --- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 5b937ecc63..d385732ddb 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1065,8 +1065,10 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) uint8_t is_t38 = 0; const char *hold_char = "*"; const char *session_id_header = sofia_glue_session_id_header(session, tech_pvt->profile); +#ifdef NUTAG_CALL_TLS_ORQ_CONNECT_TIMEOUT const char *sip_call_tls_orq_connect_timeout_str = switch_channel_get_variable(tech_pvt->channel, "sip_call_tls_orq_connect_timeout"); uint32_t sip_call_tls_orq_connect_timeout = (sip_call_tls_orq_connect_timeout_str) ? atoi(sip_call_tls_orq_connect_timeout_str) : 0; +#endif const char *stir_shaken_attest = NULL; char *identity_to_free = NULL; const char *date = NULL; From 7b86eff6d2dae6679f31b9b4923306cccf603458 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Thu, 11 Jun 2020 10:04:05 +0800 Subject: [PATCH 437/655] [mod_av] fix some leaks in error cases --- src/mod/applications/mod_av/avformat.c | 18 ++++--- .../applications/mod_av/test/test_avformat.c | 52 +++++++++++++++++++ 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 7c82913d55..f748968202 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1173,7 +1173,7 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h /** Get information on the input file (number of streams etc.). */ if ((error = avformat_find_stream_info(context->fc, opts ? &opts : NULL)) < 0) { char ebuf[255] = ""; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open find stream info (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf))); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find stream info in file: %s, error = %s)\n", filename, get_error_text(error, ebuf, sizeof(ebuf))); if (opts) av_dict_free(&opts); switch_goto_status(SWITCH_STATUS_FALSE, err); } @@ -1345,16 +1345,20 @@ GCC_DIAG_ON(deprecated-declarations) err: if (context->fc) { + int nb_streams = context->fc->nb_streams; + + if (nb_streams > 2) nb_streams = 2; + + if (context->has_video) close_stream(context->fc, &context->video_st); + + for (i = 0; i < nb_streams; i++) { + close_stream(context->fc, &context->audio_st[i]); + } + avformat_free_context(context->fc); context->fc = NULL; } - /* - if (context->has_video) close_stream(context->fc, &context->video_st); - if (context->has_audio) close_stream(context->fc, &context->audio_st); - - if (context->fc) avformat_close_input(&context->fc); - */ return status; } diff --git a/src/mod/applications/mod_av/test/test_avformat.c b/src/mod/applications/mod_av/test/test_avformat.c index 2304ca8c59..2c8949472f 100644 --- a/src/mod/applications/mod_av/test/test_avformat.c +++ b/src/mod/applications/mod_av/test/test_avformat.c @@ -197,6 +197,58 @@ FST_CORE_BEGIN("conf") } FST_TEST_END() + FST_TEST_BEGIN(avformat_test_read_err) + { + char *path = "$$-non-exist-file.mp4"; + switch_status_t status; + switch_file_handle_t fh = { 0 }; + uint32_t flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO; + + status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool); + fst_check(status == SWITCH_STATUS_GENERR); + } + FST_TEST_END() + + FST_TEST_BEGIN(avformat_test_read_ok) + { + char path[1024]; + switch_status_t status; + switch_file_handle_t fh = { 0 }; + uint8_t data[SAMPLES * 2] = { 0 }; + switch_frame_t frame = { 0 }; + switch_size_t len = SAMPLES; + uint32_t flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO; + + frame.data = data; + + sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../test_RGB.mp4"); + status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN)); + + while (1) { + status = switch_core_file_read(&fh, data, &len); + if (status != SWITCH_STATUS_SUCCESS) break; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d\n", len); + // fst_check(len == SAMPLES); + status = switch_core_file_read_video(&fh, &frame, SVR_FLUSH); + + if (status == SWITCH_STATUS_BREAK) { + switch_yield(20000); + continue; + } + + if (status != SWITCH_STATUS_SUCCESS) { + break; + } + + switch_img_free(&frame.img); + switch_yield(20000); + } + + switch_core_file_close(&fh); + } + FST_TEST_END() FST_TEARDOWN_BEGIN() { From b3e53bdb6c389f77ae32addb97fb92e7b865bc39 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Fri, 12 Jun 2020 17:26:58 +0000 Subject: [PATCH 438/655] [core] fix log format string. --- src/switch_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_log.c b/src/switch_log.c index c7a18c1a52..74a5713635 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -611,7 +611,7 @@ SWITCH_DECLARE(void) switch_log_meta_vprintf(switch_text_channel_t channel, cons switch_time_exp_t tm; switch_time_exp_lt(&tm, now); - switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.6d %0.2f%%", + switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.6d %0.2f%%%%", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, switch_core_idle_cpu()); //switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); From 8478a523a99aa49444407aca5b15e5831e62df91 Mon Sep 17 00:00:00 2001 From: Brian West <brian@freeswitch.org> Date: Thu, 3 Sep 2020 13:07:15 -0500 Subject: [PATCH 439/655] [mod_valet_parking] Do not crash when exit key is not defined --- src/mod/applications/mod_valet_parking/mod_valet_parking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index 1b088ec957..c304cad824 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -89,7 +89,7 @@ static switch_status_t valet_on_dtmf(switch_core_session_t *session, void *input switch_channel_t *channel = switch_core_session_get_channel(session); switch_dtmf_t *exit_key_pvt = (switch_dtmf_t *) switch_channel_get_private(channel, "_orbit_exit_key_"); - if (dtmf->digit == exit_key_pvt->digit) { + if (exit_key_pvt && dtmf->digit == exit_key_pvt->digit) { const char *dp; const char *exten; const char *context; From 256ac7c2dd8c7f17a8ed60275cbe4d777e31b6e5 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Mon, 8 Feb 2021 22:25:02 +0000 Subject: [PATCH 440/655] [mod_spandsp] Fix t.38 fax initialization not to add it to the timer thread until after configuration has completed. --- .../mod_spandsp/mod_spandsp_fax.c | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 7997c6752d..2af4babf08 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -835,12 +835,10 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) case T38_MODE: { switch_core_session_message_t msg = { 0 }; - switch_mutex_lock(pvt->mutex); if (pvt->t38_state == NULL) { pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); } if (pvt->t38_state == NULL) { - switch_mutex_unlock(pvt->mutex); return SWITCH_STATUS_FALSE; } if (pvt->udptl_state == NULL) { @@ -849,7 +847,6 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) if (pvt->udptl_state == NULL) { t38_terminal_free(pvt->t38_state); pvt->t38_state = NULL; - switch_mutex_unlock(pvt->mutex); return SWITCH_STATUS_FALSE; } @@ -860,7 +857,6 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) memset(t38, 0, sizeof(t38_terminal_state_t)); if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { - switch_mutex_unlock(pvt->mutex); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); return SWITCH_STATUS_FALSE; } @@ -869,7 +865,6 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { - switch_mutex_unlock(pvt->mutex); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); return SWITCH_STATUS_FALSE; } @@ -891,13 +886,6 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) span_log_set_level(t38_terminal_get_logging_state(t38), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_level(t30_get_logging_state(t30), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); } - - switch_mutex_unlock(pvt->mutex); - - /* add to timer thread processing */ - if (!add_pvt(pvt)) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - } } break; case T38_GATEWAY_MODE: @@ -1700,10 +1688,17 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat switch_core_session_message_t msg = { 0 }; pvt->t38_mode = T38_MODE_NEGOTIATED; switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); - spanfax_init(pvt, T38_MODE); - switch_mutex_lock(pvt->mutex); - configure_t38(pvt); - switch_mutex_unlock(pvt->mutex); + if (spanfax_init(pvt, T38_MODE) == SWITCH_STATUS_SUCCESS) { + configure_t38(pvt); + /* add to timer thread processing */ + if (!add_pvt(pvt)) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize Fax engine for T.38\n"); + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "Cannot initialize Fax engine for T.38"); + goto done; + } /* This will change the rtp stack to udptl mode */ msg.from = __FILE__; @@ -1726,7 +1721,16 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat if (negotiate_t38(pvt) == T38_MODE_NEGOTIATED) { /* is is safe to call this again, it was already called above in AUDIO_MODE */ /* but this is the only way to set up the t38 stuff */ - spanfax_init(pvt, T38_MODE); + if (spanfax_init(pvt, T38_MODE) == SWITCH_STATUS_SUCCESS) { + /* add to timer thread processing */ + if (!add_pvt(pvt)) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize Fax engine for T.38\n"); + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "Cannot initialize Fax engine for T.38"); + goto done; + } continue; } } From bf62bd8a7fd01339f4251cc23311b95ed768b109 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 23 Oct 2021 19:27:17 +0300 Subject: [PATCH 441/655] [Unit-test] Use unique port numbers when running mod_sofia tests. --- tests/unit/conf_sip/freeswitch.xml | 166 ++++++++++++++++++++++++++++ tests/unit/conf_test/freeswitch.xml | 4 +- tests/unit/switch_sip.c | 2 +- 3 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 tests/unit/conf_sip/freeswitch.xml diff --git a/tests/unit/conf_sip/freeswitch.xml b/tests/unit/conf_sip/freeswitch.xml new file mode 100644 index 0000000000..df7d638124 --- /dev/null +++ b/tests/unit/conf_sip/freeswitch.xml @@ -0,0 +1,166 @@ +<?xml version="1.0"?> +<document type="freeswitch/xml"> + <X-PRE-PROCESS cmd="exec-set" data="test=echo 1234"/> + <X-PRE-PROCESS cmd="set" data="default_password=$${test}"/> + <X-PRE-PROCESS cmd="set" data="core_video_blank_image=$${conf_dir}/freeswitch-logo.png"/> + <section name="configuration" description="Various Configuration"> + <configuration name="modules.conf" description="Modules"> + <modules> + <load module="mod_sofia"/> + <load module="mod_console"/> + <load module="mod_loopback"/> + <load module="mod_commands"/> + <load module="mod_dptools"/> + <load module="mod_dialplan_xml"/> + <load module="mod_tone_stream"/> + <load module="mod_commands"/> + <load module="mod_sndfile"/> + <load module="mod_hash"/> + </modules> + </configuration> + + <configuration name="console.conf" description="Console Logger"> + <mappings> + <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/> + </mappings> + <settings> + <param name="colorize" value="true"/> + <param name="loglevel" value="debug"/> + </settings> + </configuration> + + <configuration name="timezones.conf" description="Timezones"> + <timezones> + <zone name="GMT" value="GMT0" /> + </timezones> + </configuration> + + <configuration name="sofia.conf" description="SofiaSIP"> + <profiles> + <profile name="external"> + <gateways> + + <gateway name="test_gateway"> + <param name="username" value="not-used"/> + <param name="password" value="not-used"/> + <param name="proxy" value="$${local_ip_v4}:63068"/> + <param name="register" value="false"/> + <param name="retry-seconds" value="30"/> + <param name="dtmf-type" value="rfc2833"/> + <variables> + <variable name="rtp_secure_media" value="false" direction="outbound"/> + </variables> + </gateway> + </gateways> + + <domains> + <domain name="all" alias="false" parse="true"/> + </domains> + + <settings> + <param name="debug" value="1"/> + <param name="shutdown-on-fail" value="true"/> + <param name="p-asserted-id-parse" value="verbatim"/> + <param name="username" value="SignalWire-STACK"/> + <param name="user-agent-string" value="SignalWire STACK Unit Test"/> + <param name="sip-trace" value="no"/> + <param name="sip-capture" value="no"/> + <param name="rfc2833-pt" value="101"/> + <param name="sip-port" value="63068"/> + <param name="dialplan" value="XML"/> + <param name="context" value="default"/> + <param name="dtmf-duration" value="2000"/> + <param name="inbound-codec-prefs" value="PCMU"/> + <param name="outbound-codec-prefs" value="PCMU"/> + <param name="rtp-timer-name" value="soft"/> + <param name="local-network-acl" value="localnet.auto"/> + <param name="manage-presence" value="false"/> + <param name="inbound-codec-negotiation" value="generous"/> + <param name="nonce-ttl" value="60"/> + <param name="inbound-late-negotiation" value="true"/> + <param name="inbound-zrtp-passthru" value="false"/> + <param name="rtp-ip" value="$${local_ip_v4}"/> + <param name="sip-ip" value="$${local_ip_v4}"/> + <param name="ext-rtp-ip" value="$${local_ip_v4}"/> + <param name="ext-sip-ip" value="$${local_ip_v4}"/> + <param name="rtp-timeout-sec" value="300"/> + <param name="rtp-hold-timeout-sec" value="1800"/> + <param name="session-timeout" value="600"/> + <param name="minimum-session-expires" value="90"/> + <param name="tls" value="false"/> + </settings> + </profile> + + <profile name="internal"> + <gateways> + </gateways> + + <domains> + <domain name="all" alias="false" parse="true"/> + </domains> + + <settings> + <param name="debug" value="1"/> + <param name="shutdown-on-fail" value="true"/> + <param name="p-asserted-id-parse" value="verbatim"/> + <param name="username" value="SignalWire-STACK"/> + <param name="user-agent-string" value="SignalWire STACK Unit Test"/> + <param name="sip-trace" value="no"/> + <param name="sip-capture" value="no"/> + <param name="rfc2833-pt" value="101"/> + <param name="sip-port" value="61069"/> + <param name="dialplan" value="XML"/> + <param name="context" value="default"/> + <param name="dtmf-duration" value="2000"/> + <param name="inbound-codec-prefs" value="PCMU"/> + <param name="outbound-codec-prefs" value="PCMU"/> + <param name="rtp-timer-name" value="soft"/> + <param name="local-network-acl" value="localnet.auto"/> + <param name="manage-presence" value="false"/> + <param name="inbound-codec-negotiation" value="generous"/> + <param name="nonce-ttl" value="60"/> + <param name="inbound-late-negotiation" value="true"/> + <param name="inbound-zrtp-passthru" value="false"/> + <param name="rtp-ip" value="$${local_ip_v4}"/> + <param name="sip-ip" value="$${local_ip_v4}"/> + <param name="ext-rtp-ip" value="$${local_ip_v4}"/> + <param name="ext-sip-ip" value="$${local_ip_v4}"/> + <param name="rtp-timeout-sec" value="300"/> + <param name="rtp-hold-timeout-sec" value="1800"/> + <param name="session-timeout" value="600"/> + <param name="minimum-session-expires" value="90"/> + <param name="tls" value="false"/> + </settings> + </profile> + + </profiles> + </configuration> + + <configuration name="switch.conf" description="Switch"> + <param name="rtp-start-port" value="20000"/> + <param name="rtp-end-port" value="30000"/> + <param name="threaded-system-exec" value="true"/> + </configuration> + </section> + + <section name="dialplan" description="Regex/XML Dialplan"> + <context name="default"> + <extension name="two"> + <condition field="destination_number" expression="^\+15553332901$"> + <action application="log" data="${sip_h_identity}"/> + <action application="hash" data="insert/realm/identity_check/${sip_h_identity}"/> + <action application="answer"/> + <action application="park"/> + </condition> + </extension> + <extension name="one"> + <condition field="destination_number" expression="^\+15553332900$"> + <action application="set" data="absolute_codec_string=PCMU@20i"/> + <action application="info"/> + <action application="answer"/> + <action application="park"/> + </condition> + </extension> + </context> + </section> +</document> diff --git a/tests/unit/conf_test/freeswitch.xml b/tests/unit/conf_test/freeswitch.xml index 80216bbe7d..a68c7c56e6 100644 --- a/tests/unit/conf_test/freeswitch.xml +++ b/tests/unit/conf_test/freeswitch.xml @@ -43,7 +43,7 @@ <gateway name="test_gateway"> <param name="username" value="not-used"/> <param name="password" value="not-used"/> - <param name="proxy" value="$${local_ip_v4}:61068"/> + <param name="proxy" value="$${local_ip_v4}:62068"/> <param name="register" value="false"/> <param name="retry-seconds" value="30"/> <param name="dtmf-type" value="rfc2833"/> @@ -66,7 +66,7 @@ <param name="sip-trace" value="no"/> <param name="sip-capture" value="no"/> <param name="rfc2833-pt" value="101"/> - <param name="sip-port" value="61068"/> + <param name="sip-port" value="62068"/> <param name="dialplan" value="XML"/> <param name="context" value="default"/> <param name="dtmf-duration" value="2000"/> diff --git a/tests/unit/switch_sip.c b/tests/unit/switch_sip.c index 238f00a4d5..bcb00eac2b 100644 --- a/tests/unit/switch_sip.c +++ b/tests/unit/switch_sip.c @@ -1,7 +1,7 @@ #include <switch.h> #include <test/switch_test.h> -FST_CORE_DB_BEGIN("./conf_test") +FST_CORE_DB_BEGIN("./conf_sip") { FST_SUITE_BEGIN(switch_sip) { From fb0cad4c564f1366e561d19647a0cd3957b42083 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 23 Oct 2021 19:14:38 +0000 Subject: [PATCH 442/655] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 486 +++++++++++++++++- src/mod/languages/mod_managed/managed/swig.cs | 312 ++++++++++- 2 files changed, 770 insertions(+), 28 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 3ada536f66..7443ed5232 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -5947,6 +5947,30 @@ SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_delete_switch_t38_options_t } +SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_type_check___(void * jarg1) { + void * jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_core_session_t *result = 0 ; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_core_session_t *)switch_core_session_type_check(arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_const_char_type_check___(char * jarg1) { + char * jresult ; + char *arg1 = (char *) 0 ; + char *result = 0 ; + + arg1 = (char *)jarg1; + result = (char *)switch_const_char_type_check((char const *)arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_vid_params_t_width_set___(void * jarg1, unsigned long jarg2) { switch_vid_params_s *arg1 = (switch_vid_params_s *) 0 ; uint32_t arg2 ; @@ -7831,6 +7855,28 @@ SWIGEXPORT float SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_mm_t_source_fps_get } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_mm_t_source_kps_set___(void * jarg1, int jarg2) { + switch_mm_s *arg1 = (switch_mm_s *) 0 ; + int arg2 ; + + arg1 = (switch_mm_s *)jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->source_kps = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_mm_t_source_kps_get___(void * jarg1) { + int jresult ; + switch_mm_s *arg1 = (switch_mm_s *) 0 ; + int result; + + arg1 = (switch_mm_s *)jarg1; + result = (int) ((arg1)->source_kps); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_mm_t_vbuf_set___(void * jarg1, int jarg2) { switch_mm_s *arg1 = (switch_mm_s *) 0 ; int arg2 ; @@ -9781,6 +9827,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_thread_data_t_alloc_g } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_thread_data_t_running_set___(void * jarg1, int jarg2) { + switch_thread_data_s *arg1 = (switch_thread_data_s *) 0 ; + int arg2 ; + + arg1 = (switch_thread_data_s *)jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->running = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_thread_data_t_running_get___(void * jarg1) { + int jresult ; + switch_thread_data_s *arg1 = (switch_thread_data_s *) 0 ; + int result; + + arg1 = (switch_thread_data_s *)jarg1; + result = (int) ((arg1)->running); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_thread_data_t_pool_set___(void * jarg1, void * jarg2) { switch_thread_data_s *arg1 = (switch_thread_data_s *) 0 ; switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ; @@ -12069,18 +12137,6 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_must_realloc___(vo } -SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_must_strdup___(char * jarg1) { - char * jresult ; - char *arg1 = (char *) 0 ; - char *result = 0 ; - - arg1 = (char *)jarg1; - result = (char *)switch_must_strdup((char const *)arg1); - jresult = SWIG_csharp_string_callback((const char *)result); - return jresult; -} - - SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_screen_size___(void * jarg1, void * jarg2) { int *arg1 = (int *) 0 ; int *arg2 = (int *) 0 ; @@ -13263,6 +13319,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_set_uuid } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_set_external_id___(void * jarg1, char * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_core_session_set_external_id(arg1,(char const *)arg2); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_perform_destroy___(void * jarg1, char * jarg2, char * jarg3, int jarg4) { switch_core_session_t **arg1 = (switch_core_session_t **) 0 ; char *arg2 = (char *) 0 ; @@ -13397,6 +13467,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_thread_p } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_thread_pool_wait___(void * jarg1, int jarg2) { + int jresult ; + switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ; + int arg2 ; + switch_status_t result; + + arg1 = (switch_thread_data_t *)jarg1; + arg2 = (int)jarg2; + result = (switch_status_t)switch_thread_pool_wait(arg1,arg2); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_get_channel___(void * jarg1) { void * jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -13453,6 +13537,18 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_get_u } +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_get_external_id___(void * jarg1) { + char * jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_core_session_t *)jarg1; + result = (char *)switch_core_session_get_external_id(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_set_loglevel___(void * jarg1, int jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -14673,6 +14769,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_destroy___( } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_pointer___(void * jarg1, void * jarg2) { + int jresult ; + switch_hash_t *arg1 = (switch_hash_t *) 0 ; + void *arg2 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_hash_t *)jarg1; + arg2 = (void *)jarg2; + result = (switch_status_t)switch_core_hash_insert_pointer(arg1,(void const *)arg2); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_auto_free___(void * jarg1, char * jarg2, void * jarg3) { int jresult ; switch_hash_t *arg1 = (switch_hash_t *) 0 ; @@ -14689,6 +14799,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_auto } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_dup_auto_free___(void * jarg1, char * jarg2, char * jarg3) { + int jresult ; + switch_hash_t *arg1 = (switch_hash_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_hash_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + result = (switch_status_t)switch_core_hash_insert_dup_auto_free(arg1,(char const *)arg2,(char const *)arg3); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_destructor___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { int jresult ; switch_hash_t *arg1 = (switch_hash_t *) 0 ; @@ -14707,6 +14833,42 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_dest } +SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_alloc_destructor___(void * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) { + void * jresult ; + switch_hash_t *arg1 = (switch_hash_t *) 0 ; + char *arg2 = (char *) 0 ; + size_t arg3 ; + hashtable_destructor_t arg4 = (hashtable_destructor_t) 0 ; + void *result = 0 ; + + arg1 = (switch_hash_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (size_t)jarg3; + arg4 = (hashtable_destructor_t)jarg4; + result = (void *)switch_core_hash_insert_alloc_destructor(arg1,(char const *)arg2,arg3,arg4); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_dup_destructor___(void * jarg1, char * jarg2, char * jarg3, void * jarg4) { + int jresult ; + switch_hash_t *arg1 = (switch_hash_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + hashtable_destructor_t arg4 = (hashtable_destructor_t) 0 ; + switch_status_t result; + + arg1 = (switch_hash_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (hashtable_destructor_t)jarg4; + result = (switch_status_t)switch_core_hash_insert_dup_destructor(arg1,(char const *)arg2,(char const *)arg3,arg4); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_locked___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { int jresult ; switch_hash_t *arg1 = (switch_hash_t *) 0 ; @@ -21127,15 +21289,17 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_get_addr_int___(void * jarg1 } -SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cmp_addr___(void * jarg1, void * jarg2) { +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_cmp_addr___(void * jarg1, void * jarg2, int jarg3) { int jresult ; switch_sockaddr_t *arg1 = (switch_sockaddr_t *) 0 ; switch_sockaddr_t *arg2 = (switch_sockaddr_t *) 0 ; + switch_bool_t arg3 ; int result; arg1 = (switch_sockaddr_t *)jarg1; arg2 = (switch_sockaddr_t *)jarg2; - result = (int)switch_cmp_addr(arg1,arg2); + arg3 = (switch_bool_t)jarg3; + result = (int)switch_cmp_addr(arg1,arg2,arg3); jresult = result; return jresult; } @@ -21331,6 +21495,34 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_safe_atoi___(char * j } +SWIGEXPORT long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_safe_atol___(char * jarg1, long jarg2) { + long jresult ; + char *arg1 = (char *) 0 ; + long arg2 ; + long result; + + arg1 = (char *)jarg1; + arg2 = (long)jarg2; + result = (long)switch_safe_atol((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT long long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_safe_atoll___(char * jarg1, long long jarg2) { + long long jresult ; + char *arg1 = (char *) 0 ; + long long arg2 ; + long long result; + + arg1 = (char *)jarg1; + arg2 = (long long)jarg2; + result = (long long)switch_safe_atoll((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_safe_strdup___(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -21974,6 +22166,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_is_file_path___(char } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_filecmp___(char * jarg1, char * jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + result = (int)switch_filecmp((char const *)arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_parse_audio_col___(int jarg1) { char * jresult ; switch_audio_col_t arg1 ; @@ -23285,6 +23491,30 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_digest_string___(char } +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_must_strdup___(char * jarg1) { + char * jresult ; + char *arg1 = (char *) 0 ; + char *result = 0 ; + + arg1 = (char *)jarg1; + result = (char *)switch_must_strdup((char const *)arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_memory_usage_stream___(void * jarg1) { + char * jresult ; + switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_stream_handle_t *)jarg1; + result = (char *)switch_memory_usage_stream(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_profile_node_t_var_set___(void * jarg1, char * jarg2) { profile_node_s *arg1 = (profile_node_s *) 0 ; char *arg2 = (char *) 0 ; @@ -36307,6 +36537,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_set_variable_ } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_set_variable_strip_quotes_var_check___(void * jarg1, char * jarg2, char * jarg3, int jarg4) { + int jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_bool_t arg4 ; + switch_status_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (switch_bool_t)jarg4; + result = (switch_status_t)switch_channel_set_variable_strip_quotes_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_add_variable_var_check___(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -36556,6 +36804,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variables } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variables_prefix___(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_event_t **arg3 = (switch_event_t **) 0 ; + switch_status_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_event_t **)jarg3; + result = (switch_status_t)switch_channel_get_variables_prefix(arg1,(char const *)arg2,arg3); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_pass_callee_id___(void * jarg1, void * jarg2) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -37620,6 +37884,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_execute_on___ } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_execute_on_value___(void * jarg1, char * jarg2) { + int jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_channel_execute_on_value(arg1,(char const *)arg2); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_api_on___(void * jarg1, char * jarg2) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -41909,6 +42187,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_record_file___(vo } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_record_file_event___(void * jarg1, void * jarg2, char * jarg3, void * jarg4, unsigned long jarg5, void * jarg6) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ; + char *arg3 = (char *) 0 ; + switch_input_args_t *arg4 = (switch_input_args_t *) 0 ; + uint32_t arg5 ; + switch_event_t *arg6 = (switch_event_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_file_handle_t *)jarg2; + arg3 = (char *)jarg3; + arg4 = (switch_input_args_t *)jarg4; + arg5 = (uint32_t)jarg5; + arg6 = (switch_event_t *)jarg6; + result = (switch_status_t)switch_ivr_record_file_event(arg1,arg2,(char const *)arg3,arg4,arg5,arg6); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_play_and_get_digits___(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, unsigned long jarg11, char * jarg12, unsigned long jarg13, char * jarg14) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -43529,6 +43829,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_record_session_ma } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_record_session_pause___(void * jarg1, char * jarg2, int jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_bool_t arg3 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_bool_t)jarg3; + result = (switch_status_t)switch_ivr_record_session_pause(arg1,(char const *)arg2,arg3); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_stop_video_write_overlay_session___(void * jarg1) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -43985,6 +44301,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge__ } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_send_prompt___(void * jarg1, char * jarg2, char * jarg3, char * jarg4) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + result = (switch_status_t)switch_ivr_send_prompt(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_play_and_collect_input___(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5, int jarg6, char * jarg7, unsigned long jarg8, void * jarg9, void * jarg10, char * jarg11, void * jarg12) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -46422,6 +46756,50 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_log_node_t_tags_ge } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_log_node_t_sequence_set___(void * jarg1, long long jarg2) { + switch_log_node_t *arg1 = (switch_log_node_t *) 0 ; + int64_t arg2 ; + + arg1 = (switch_log_node_t *)jarg1; + arg2 = (int64_t)jarg2; + if (arg1) (arg1)->sequence = arg2; +} + + +SWIGEXPORT long long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_log_node_t_sequence_get___(void * jarg1) { + long long jresult ; + switch_log_node_t *arg1 = (switch_log_node_t *) 0 ; + int64_t result; + + arg1 = (switch_log_node_t *)jarg1; + result = (int64_t) ((arg1)->sequence); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_log_node_t_meta_set___(void * jarg1, void * jarg2) { + switch_log_node_t *arg1 = (switch_log_node_t *) 0 ; + cJSON *arg2 = (cJSON *) 0 ; + + arg1 = (switch_log_node_t *)jarg1; + arg2 = (cJSON *)jarg2; + if (arg1) (arg1)->meta = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_log_node_t_meta_get___(void * jarg1) { + void * jresult ; + switch_log_node_t *arg1 = (switch_log_node_t *) 0 ; + cJSON *result = 0 ; + + arg1 = (switch_log_node_t *)jarg1; + result = (cJSON *) ((arg1)->meta); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_new_switch_log_node_t___() { void * jresult ; switch_log_node_t *result = 0 ; @@ -46831,6 +47209,28 @@ SWIGEXPORT double SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_log_json_format_t_ } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_log_json_format_t_sequence_set___(void * jarg1, void * jarg2) { + switch_log_json_format_t *arg1 = (switch_log_json_format_t *) 0 ; + switch_log_json_format_item_t *arg2 = (switch_log_json_format_item_t *) 0 ; + + arg1 = (switch_log_json_format_t *)jarg1; + arg2 = (switch_log_json_format_item_t *)jarg2; + if (arg1) (arg1)->sequence = *arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_log_json_format_t_sequence_get___(void * jarg1) { + void * jresult ; + switch_log_json_format_t *arg1 = (switch_log_json_format_t *) 0 ; + switch_log_json_format_item_t *result = 0 ; + + arg1 = (switch_log_json_format_t *)jarg1; + result = (switch_log_json_format_item_t *)& ((arg1)->sequence); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_new_switch_log_json_format_t___() { void * jresult ; switch_log_json_format_t *result = 0 ; @@ -47301,6 +47701,64 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_xml_refs_ge } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_xml_open_set___(void * jarg1, char * jarg2) { + switch_xml *arg1 = (switch_xml *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_xml *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->open = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->open, (const char *)arg2); + } else { + arg1->open = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_xml_open_get___(void * jarg1) { + char * jresult ; + switch_xml *arg1 = (switch_xml *) 0 ; + char *result = 0 ; + + arg1 = (switch_xml *)jarg1; + result = (char *) ((arg1)->open); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_xml_close_set___(void * jarg1, char * jarg2) { + switch_xml *arg1 = (switch_xml *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_xml *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->close = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->close, (const char *)arg2); + } else { + arg1->close = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_xml_close_get___(void * jarg1) { + char * jresult ; + switch_xml *arg1 = (switch_xml *) 0 ; + char *result = 0 ; + + arg1 = (switch_xml *)jarg1; + result = (char *) ((arg1)->close); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_new_switch_xml___() { void * jresult ; switch_xml *result = 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 025c93a74d..901476e9f1 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -7843,6 +7843,17 @@ public class freeswitch { } } + public static SWIGTYPE_p_switch_core_session switch_core_session_type_check(SWIGTYPE_p_switch_core_session session) { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_type_check(SWIGTYPE_p_switch_core_session.getCPtr(session)); + SWIGTYPE_p_switch_core_session ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false); + return ret; + } + + public static string switch_const_char_type_check(string str) { + string ret = freeswitchPINVOKE.switch_const_char_type_check(str); + return ret; + } + public static int switch_core_db_close(SWIGTYPE_p_sqlite3 db) { int ret = freeswitchPINVOKE.switch_core_db_close(SWIGTYPE_p_sqlite3.getCPtr(db)); return ret; @@ -8032,11 +8043,6 @@ else return ret; } - public static string switch_must_strdup(string _s) { - string ret = freeswitchPINVOKE.switch_must_strdup(_s); - return ret; - } - public static void switch_core_screen_size(SWIGTYPE_p_int x, SWIGTYPE_p_int y) { freeswitchPINVOKE.switch_core_screen_size(SWIGTYPE_p_int.getCPtr(x), SWIGTYPE_p_int.getCPtr(y)); } @@ -8489,6 +8495,11 @@ else return ret; } + public static switch_status_t switch_core_session_set_external_id(SWIGTYPE_p_switch_core_session session, string use_external_id) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_external_id(SWIGTYPE_p_switch_core_session.getCPtr(session), use_external_id); + return ret; + } + public static void switch_core_session_perform_destroy(SWIGTYPE_p_p_switch_core_session session, string file, string func, int line) { freeswitchPINVOKE.switch_core_session_perform_destroy(SWIGTYPE_p_p_switch_core_session.getCPtr(session), file, func, line); } @@ -8546,6 +8557,11 @@ else return ret; } + public static switch_status_t switch_thread_pool_wait(switch_thread_data_t td, int ms) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_thread_pool_wait(switch_thread_data_t.getCPtr(td), ms); + return ret; + } + public static SWIGTYPE_p_switch_channel switch_core_session_get_channel(SWIGTYPE_p_switch_core_session session) { global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_channel(SWIGTYPE_p_switch_core_session.getCPtr(session)); SWIGTYPE_p_switch_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_switch_channel(cPtr, false); @@ -8572,6 +8588,11 @@ else return ret; } + public static string switch_core_session_get_external_id(SWIGTYPE_p_switch_core_session session) { + string ret = freeswitchPINVOKE.switch_core_session_get_external_id(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + public static switch_status_t switch_core_session_set_loglevel(SWIGTYPE_p_switch_core_session session, switch_log_level_t loglevel) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_loglevel(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)loglevel); return ret; @@ -9010,16 +9031,37 @@ else return ret; } + public static switch_status_t switch_core_hash_insert_pointer(SWIGTYPE_p_switch_hashtable hash, SWIGTYPE_p_void data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_pointer(SWIGTYPE_p_switch_hashtable.getCPtr(hash), SWIGTYPE_p_void.getCPtr(data)); + return ret; + } + public static switch_status_t switch_core_hash_insert_auto_free(SWIGTYPE_p_switch_hashtable hash, string key, SWIGTYPE_p_void data) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_auto_free(SWIGTYPE_p_switch_hashtable.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data)); return ret; } + public static switch_status_t switch_core_hash_insert_dup_auto_free(SWIGTYPE_p_switch_hashtable hash, string key, string str) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_dup_auto_free(SWIGTYPE_p_switch_hashtable.getCPtr(hash), key, str); + return ret; + } + public static switch_status_t switch_core_hash_insert_destructor(SWIGTYPE_p_switch_hashtable hash, string key, SWIGTYPE_p_void data, SWIGTYPE_p_f_p_void__void destructor) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_destructor(SWIGTYPE_p_switch_hashtable.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_f_p_void__void.getCPtr(destructor)); return ret; } + public static SWIGTYPE_p_void switch_core_hash_insert_alloc_destructor(SWIGTYPE_p_switch_hashtable hash, string key, uint size, SWIGTYPE_p_f_p_void__void destructor) { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_hash_insert_alloc_destructor(SWIGTYPE_p_switch_hashtable.getCPtr(hash), key, size, SWIGTYPE_p_f_p_void__void.getCPtr(destructor)); + SWIGTYPE_p_void ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + + public static switch_status_t switch_core_hash_insert_dup_destructor(SWIGTYPE_p_switch_hashtable hash, string key, string str, SWIGTYPE_p_f_p_void__void destructor) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_dup_destructor(SWIGTYPE_p_switch_hashtable.getCPtr(hash), key, str, SWIGTYPE_p_f_p_void__void.getCPtr(destructor)); + return ret; + } + public static switch_status_t switch_core_hash_insert_locked(SWIGTYPE_p_switch_hashtable hash, string key, SWIGTYPE_p_void data, SWIGTYPE_p_switch_mutex_t mutex) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_locked(SWIGTYPE_p_switch_hashtable.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_mutex_t.getCPtr(mutex)); return ret; @@ -10952,8 +10994,8 @@ else return ret; } - public static int switch_cmp_addr(SWIGTYPE_p_switch_sockaddr_t sa1, SWIGTYPE_p_switch_sockaddr_t sa2) { - int ret = freeswitchPINVOKE.switch_cmp_addr(SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa1), SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa2)); + public static int switch_cmp_addr(SWIGTYPE_p_switch_sockaddr_t sa1, SWIGTYPE_p_switch_sockaddr_t sa2, switch_bool_t ip_only) { + int ret = freeswitchPINVOKE.switch_cmp_addr(SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa1), SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa2), (int)ip_only); return ret; } @@ -11028,6 +11070,16 @@ else return ret; } + public static int switch_safe_atol(string nptr, int dft) { + int ret = freeswitchPINVOKE.switch_safe_atol(nptr, dft); + return ret; + } + + public static long switch_safe_atoll(string nptr, long dft) { + long ret = freeswitchPINVOKE.switch_safe_atoll(nptr, dft); + return ret; + } + public static string switch_safe_strdup(string it) { string ret = freeswitchPINVOKE.switch_safe_strdup(it); return ret; @@ -11244,6 +11296,11 @@ else return ret; } + public static int switch_filecmp(string a, string b) { + int ret = freeswitchPINVOKE.switch_filecmp(a, b); + return ret; + } + public static string switch_parse_audio_col(switch_audio_col_t col) { string ret = freeswitchPINVOKE.switch_parse_audio_col((int)col); return ret; @@ -11513,6 +11570,16 @@ else return ret; } + public static string switch_must_strdup(string _s) { + string ret = freeswitchPINVOKE.switch_must_strdup(_s); + return ret; + } + + public static string switch_memory_usage_stream(switch_stream_handle stream) { + string ret = freeswitchPINVOKE.switch_memory_usage_stream(switch_stream_handle.getCPtr(stream)); + return ret; + } + public static switch_caller_extension switch_caller_extension_new(SWIGTYPE_p_switch_core_session session, string extension_name, string extension_number) { global::System.IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_new(SWIGTYPE_p_switch_core_session.getCPtr(session), extension_name, extension_number); switch_caller_extension ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false); @@ -11739,6 +11806,11 @@ else return ret; } + public static switch_status_t switch_channel_set_variable_strip_quotes_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_strip_quotes_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check); + return ret; + } + public static switch_status_t switch_channel_add_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check, switch_stack_t stack) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_add_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check, (int)stack); return ret; @@ -11817,6 +11889,11 @@ else return ret; } + public static switch_status_t switch_channel_get_variables_prefix(SWIGTYPE_p_switch_channel channel, string prefix, SWIGTYPE_p_p_switch_event arg2) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_get_variables_prefix(SWIGTYPE_p_switch_channel.getCPtr(channel), prefix, SWIGTYPE_p_p_switch_event.getCPtr(arg2)); + return ret; + } + public static switch_status_t switch_channel_pass_callee_id(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_channel other_channel) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_pass_callee_id(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel)); return ret; @@ -12208,6 +12285,11 @@ else return ret; } + public static switch_status_t switch_channel_execute_on_value(SWIGTYPE_p_switch_channel channel, string variable_value) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_execute_on_value(SWIGTYPE_p_switch_channel.getCPtr(channel), variable_value); + return ret; + } + public static switch_status_t switch_channel_api_on(SWIGTYPE_p_switch_channel channel, string variable_prefix) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_api_on(SWIGTYPE_p_switch_channel.getCPtr(channel), variable_prefix); return ret; @@ -13152,6 +13234,11 @@ else return ret; } + public static switch_status_t switch_ivr_record_file_event(SWIGTYPE_p_switch_core_session session, switch_file_handle fh, string file, switch_input_args_t args, uint limit, switch_event vars) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_record_file_event(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_file_handle.getCPtr(fh), file, switch_input_args_t.getCPtr(args), limit, switch_event.getCPtr(vars)); + return ret; + } + public static switch_status_t switch_play_and_get_digits(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, uint max_tries, uint timeout, string valid_terminators, string audio_file, string bad_input_audio_file, string var_name, string digit_buffer, uint digit_buffer_length, string digits_regex, uint digit_timeout, string transfer_on_failure) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_play_and_get_digits(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, max_tries, timeout, valid_terminators, audio_file, bad_input_audio_file, var_name, digit_buffer, digit_buffer_length, digits_regex, digit_timeout, transfer_on_failure); return ret; @@ -13642,6 +13729,11 @@ else return ret; } + public static switch_status_t switch_ivr_record_session_pause(SWIGTYPE_p_switch_core_session session, string file, switch_bool_t on) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_record_session_pause(SWIGTYPE_p_switch_core_session.getCPtr(session), file, (int)on); + return ret; + } + public static switch_status_t switch_ivr_stop_video_write_overlay_session(SWIGTYPE_p_switch_core_session session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_video_write_overlay_session(SWIGTYPE_p_switch_core_session.getCPtr(session)); return ret; @@ -13801,6 +13893,11 @@ else return ret; } + public static switch_status_t switch_ivr_send_prompt(SWIGTYPE_p_switch_core_session session, string type, string text, string regex) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_send_prompt(SWIGTYPE_p_switch_core_session.getCPtr(session), type, text, regex); + return ret; + } + public static switch_status_t switch_ivr_play_and_collect_input(SWIGTYPE_p_switch_core_session session, string prompt, string recognizer_mod_name, string recognizer_grammar, int min_digits, int max_digits, string terminators, uint digit_timeout, SWIGTYPE_p_p_cJSON recognition_result, ref string digits_collected, string terminator_collected, switch_input_args_t args) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_play_and_collect_input(SWIGTYPE_p_switch_core_session.getCPtr(session), prompt, recognizer_mod_name, recognizer_grammar, min_digits, max_digits, terminators, digit_timeout, SWIGTYPE_p_p_cJSON.getCPtr(recognition_result), ref digits_collected, terminator_collected, switch_input_args_t.getCPtr(args)); return ret; @@ -16845,6 +16942,12 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_delete_switch_t38_options_t___")] public static extern void delete_switch_t38_options_t(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_type_check___")] + public static extern global::System.IntPtr switch_core_session_type_check(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_const_char_type_check___")] + public static extern string switch_const_char_type_check(string jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_vid_params_t_width_set___")] public static extern void switch_vid_params_t_width_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); @@ -17352,6 +17455,12 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_mm_t_source_fps_get___")] public static extern float switch_mm_t_source_fps_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_mm_t_source_kps_set___")] + public static extern void switch_mm_t_source_kps_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_mm_t_source_kps_get___")] + public static extern int switch_mm_t_source_kps_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_mm_t_vbuf_set___")] public static extern void switch_mm_t_vbuf_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); @@ -17841,6 +17950,12 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_thread_data_t_alloc_get___")] public static extern int switch_thread_data_t_alloc_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_thread_data_t_running_set___")] + public static extern void switch_thread_data_t_running_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_thread_data_t_running_get___")] + public static extern int switch_thread_data_t_running_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_thread_data_t_pool_set___")] public static extern void switch_thread_data_t_pool_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -18423,9 +18538,6 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_must_realloc___")] public static extern global::System.IntPtr switch_must_realloc(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_must_strdup___")] - public static extern string switch_must_strdup(string jarg1); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_screen_size___")] public static extern void switch_core_screen_size(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -18690,6 +18802,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_set_uuid___")] public static extern int switch_core_session_set_uuid(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_set_external_id___")] + public static extern int switch_core_session_set_external_id(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_perform_destroy___")] public static extern void switch_core_session_perform_destroy(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, int jarg4); @@ -18726,6 +18841,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_thread_pool_launch___")] public static extern int switch_core_session_thread_pool_launch(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_thread_pool_wait___")] + public static extern int switch_thread_pool_wait(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_get_channel___")] public static extern global::System.IntPtr switch_core_session_get_channel(global::System.Runtime.InteropServices.HandleRef jarg1); @@ -18741,6 +18859,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_get_uuid___")] public static extern string switch_core_session_get_uuid(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_get_external_id___")] + public static extern string switch_core_session_get_external_id(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_session_set_loglevel___")] public static extern int switch_core_session_set_loglevel(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); @@ -19008,12 +19129,24 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_destroy___")] public static extern int switch_core_hash_destroy(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_pointer___")] + public static extern int switch_core_hash_insert_pointer(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_auto_free___")] public static extern int switch_core_hash_insert_auto_free(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_dup_auto_free___")] + public static extern int switch_core_hash_insert_dup_auto_free(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_destructor___")] public static extern int switch_core_hash_insert_destructor(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_alloc_destructor___")] + public static extern global::System.IntPtr switch_core_hash_insert_alloc_destructor(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, uint jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_dup_destructor___")] + public static extern int switch_core_hash_insert_dup_destructor(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_core_hash_insert_locked___")] public static extern int switch_core_hash_insert_locked(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); @@ -20482,7 +20615,7 @@ class freeswitchPINVOKE { public static extern int get_addr_int(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_cmp_addr___")] - public static extern int switch_cmp_addr(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + public static extern int switch_cmp_addr(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_cp_addr___")] public static extern int switch_cp_addr(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -20526,6 +20659,12 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_safe_atoi___")] public static extern int switch_safe_atoi(string jarg1, int jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_safe_atol___")] + public static extern int switch_safe_atol(string jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_safe_atoll___")] + public static extern long switch_safe_atoll(string jarg1, long jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_safe_strdup___")] public static extern string switch_safe_strdup(string jarg1); @@ -20655,6 +20794,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_is_file_path___")] public static extern int switch_is_file_path(string jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_filecmp___")] + public static extern int switch_filecmp(string jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_parse_audio_col___")] public static extern string switch_parse_audio_col(int jarg1); @@ -20934,6 +21076,12 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_digest_string___")] public static extern int switch_digest_string(string jarg1, ref string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_must_strdup___")] + public static extern string switch_must_strdup(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_memory_usage_stream___")] + public static extern string switch_memory_usage_stream(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_profile_node_t_var_set___")] public static extern void profile_node_t_var_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); @@ -24288,6 +24436,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_set_variable_var_check___")] public static extern int switch_channel_set_variable_var_check(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, int jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_set_variable_strip_quotes_var_check___")] + public static extern int switch_channel_set_variable_strip_quotes_var_check(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, int jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_add_variable_var_check___")] public static extern int switch_channel_add_variable_var_check(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5); @@ -24336,6 +24487,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variables___")] public static extern int switch_channel_get_variables(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variables_prefix___")] + public static extern int switch_channel_get_variables_prefix(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_pass_callee_id___")] public static extern int switch_channel_pass_callee_id(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -24585,6 +24739,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_execute_on___")] public static extern int switch_channel_execute_on(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_execute_on_value___")] + public static extern int switch_channel_execute_on_value(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_api_on___")] public static extern int switch_channel_api_on(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); @@ -25521,6 +25678,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_record_file___")] public static extern int switch_ivr_record_file(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, uint jarg5); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_record_file_event___")] + public static extern int switch_ivr_record_file_event(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, uint jarg5, global::System.Runtime.InteropServices.HandleRef jarg6); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_play_and_get_digits___")] public static extern int switch_play_and_get_digits(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, uint jarg11, string jarg12, uint jarg13, string jarg14); @@ -25818,6 +25978,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_record_session_mask___")] public static extern int switch_ivr_record_session_mask(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_record_session_pause___")] + public static extern int switch_ivr_record_session_pause(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_stop_video_write_overlay_session___")] public static extern int switch_ivr_stop_video_write_overlay_session(global::System.Runtime.InteropServices.HandleRef jarg1); @@ -25917,6 +26080,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge___")] public static extern int switch_ivr_orig_and_bridge(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_send_prompt___")] + public static extern int switch_ivr_send_prompt(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, string jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_ivr_play_and_collect_input___")] public static extern int switch_ivr_play_and_collect_input(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5, int jarg6, string jarg7, uint jarg8, global::System.Runtime.InteropServices.HandleRef jarg9, ref string jarg10, string jarg11, global::System.Runtime.InteropServices.HandleRef jarg12); @@ -26481,6 +26647,18 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_log_node_t_tags_get___")] public static extern global::System.IntPtr switch_log_node_t_tags_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_log_node_t_sequence_set___")] + public static extern void switch_log_node_t_sequence_set(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_log_node_t_sequence_get___")] + public static extern long switch_log_node_t_sequence_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_log_node_t_meta_set___")] + public static extern void switch_log_node_t_meta_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_log_node_t_meta_get___")] + public static extern global::System.IntPtr switch_log_node_t_meta_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_new_switch_log_node_t___")] public static extern global::System.IntPtr new_switch_log_node_t(); @@ -26589,6 +26767,12 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_log_json_format_t_timestamp_divisor_get___")] public static extern double switch_log_json_format_t_timestamp_divisor_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_log_json_format_t_sequence_set___")] + public static extern void switch_log_json_format_t_sequence_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_log_json_format_t_sequence_get___")] + public static extern global::System.IntPtr switch_log_json_format_t_sequence_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_new_switch_log_json_format_t___")] public static extern global::System.IntPtr new_switch_log_json_format_t(); @@ -26706,6 +26890,18 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_xml_refs_get___")] public static extern uint switch_xml_refs_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_xml_open_set___")] + public static extern void switch_xml_open_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_xml_open_get___")] + public static extern string switch_xml_open_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_xml_close_set___")] + public static extern void switch_xml_close_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_xml_close_get___")] + public static extern string switch_xml_close_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_new_switch_xml___")] public static extern global::System.IntPtr new_switch_xml(); @@ -31671,6 +31867,7 @@ public enum switch_channel_cap_t { CC_IO_OVERRIDE, CC_RTP_RTT, CC_MSRP, + CC_MUTE_VIA_MEDIA_STREAM, CC_FLAG_MAX } @@ -31762,6 +31959,7 @@ public enum switch_channel_flag_t { CF_INTERCEPTED, CF_VIDEO_REFRESH_REQ, CF_MANUAL_VID_REFRESH, + CF_MANUAL_MEDIA_PARAMS, CF_SERVICE_AUDIO, CF_SERVICE_VIDEO, CF_ZRTP_PASSTHRU_REQ, @@ -31795,6 +31993,7 @@ public enum switch_channel_flag_t { CF_T38_PASSTHRU, CF_DROP_DTMF, CF_REINVITE, + CF_NOSDP_REINVITE, CF_AUTOFLUSH_DURING_BRIDGE, CF_RTP_NOTIMER_DURING_BRIDGE, CF_AVPF, @@ -31822,7 +32021,7 @@ public enum switch_channel_flag_t { CF_VIDEO_DECODED_READ, CF_VIDEO_DEBUG_READ, CF_VIDEO_DEBUG_WRITE, - CF_VIDEO_ONLY, + CF_NO_RECOVER, CF_VIDEO_READY, CF_VIDEO_MIRROR_INPUT, CF_VIDEO_READ_FILE_ATTACHED, @@ -31856,6 +32055,10 @@ public enum switch_channel_flag_t { CF_STATE_REPEAT, CF_WANT_DTLSv1_2, CF_RFC7329_COMPAT, + CF_REATTACHED, + CF_VIDEO_READ_TAPPED, + CF_VIDEO_WRITE_TAPPED, + CF_DEVICES_CHANGED, CF_FLAG_MAX } @@ -33932,6 +34135,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_DEFLECT, SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ, SWITCH_MESSAGE_INDICATE_DISPLAY, + SWITCH_MESSAGE_INDICATE_MEDIA_PARAMS, SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY, SWITCH_MESSAGE_INDICATE_AUDIO_SYNC, SWITCH_MESSAGE_INDICATE_VIDEO_SYNC, @@ -33968,6 +34172,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_RESAMPLE_EVENT, SWITCH_MESSAGE_HEARTBEAT_EVENT, SWITCH_MESSAGE_INDICATE_SESSION_ID, + SWITCH_MESSAGE_INDICATE_PROMPT, SWITCH_MESSAGE_INVALID } @@ -36971,6 +37176,7 @@ public enum switch_event_types_t { SWITCH_EVENT_SEND_INFO, SWITCH_EVENT_RECV_INFO, SWITCH_EVENT_RECV_RTCP_MESSAGE, + SWITCH_EVENT_SEND_RTCP_MESSAGE, SWITCH_EVENT_CALL_SECURE, SWITCH_EVENT_NAT, SWITCH_EVENT_RECORD_START, @@ -41563,6 +41769,17 @@ public class switch_log_json_format_t : global::System.IDisposable { } } + public switch_log_json_format_item_t sequence { + set { + freeswitchPINVOKE.switch_log_json_format_t_sequence_set(swigCPtr, switch_log_json_format_item_t.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_log_json_format_t_sequence_get(swigCPtr); + switch_log_json_format_item_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_log_json_format_item_t(cPtr, false); + return ret; + } + } + public switch_log_json_format_t() : this(freeswitchPINVOKE.new_switch_log_json_format_t(), true) { } @@ -41761,6 +41978,27 @@ public class switch_log_node_t : global::System.IDisposable { } } + public long sequence { + set { + freeswitchPINVOKE.switch_log_node_t_sequence_set(swigCPtr, value); + } + get { + long ret = freeswitchPINVOKE.switch_log_node_t_sequence_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_cJSON meta { + set { + freeswitchPINVOKE.switch_log_node_t_meta_set(swigCPtr, SWIGTYPE_p_cJSON.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_log_node_t_meta_get(swigCPtr); + SWIGTYPE_p_cJSON ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_cJSON(cPtr, false); + return ret; + } + } + public switch_log_node_t() : this(freeswitchPINVOKE.new_switch_log_node_t(), true) { } @@ -41949,7 +42187,8 @@ namespace FreeSWITCH.Native { SMBF_SPY_VIDEO_STREAM_BLEG = (1 << 23), SMBF_READ_VIDEO_PATCH = (1 << 24), SMBF_READ_TEXT_STREAM = (1 << 25), - SMBF_FIRST = (1 << 26) + SMBF_FIRST = (1 << 26), + SMBF_PAUSE = (1 << 27) } } @@ -42163,6 +42402,16 @@ public class switch_mm_t : global::System.IDisposable { } } + public int source_kps { + set { + freeswitchPINVOKE.switch_mm_t_source_kps_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_mm_t_source_kps_get(swigCPtr); + return ret; + } + } + public int vbuf { set { freeswitchPINVOKE.switch_mm_t_vbuf_set(swigCPtr, value); @@ -43413,6 +43662,9 @@ public enum switch_rtp_flag_t { SWITCH_RTP_FLAG_PASSTHRU, SWITCH_RTP_FLAG_SECURE_SEND_MKI, SWITCH_RTP_FLAG_SECURE_RECV_MKI, + SWITCH_RTP_FLAG_SRTP_HANGUP_ON_ERROR, + SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT, + SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT, SWITCH_RTP_FLAG_INVALID } @@ -45075,7 +45327,9 @@ public enum switch_session_ctl_t { SCSC_SPS_PEAK, SCSC_SPS_PEAK_FIVEMIN, SCSC_SESSIONS_PEAK, - SCSC_SESSIONS_PEAK_FIVEMIN + SCSC_SESSIONS_PEAK_FIVEMIN, + SCSC_MDNS_RESOLVE, + SCSC_SHUTDOWN_CAUSE } } @@ -46523,6 +46777,16 @@ public class switch_thread_data_t : global::System.IDisposable { } } + public int running { + set { + freeswitchPINVOKE.switch_thread_data_t_running_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_thread_data_t_running_get(swigCPtr); + return ret; + } + } + public SWIGTYPE_p_apr_pool_t pool { set { freeswitchPINVOKE.switch_thread_data_t_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value)); @@ -47788,6 +48052,26 @@ public class switch_xml : global::System.IDisposable { } } + public string open { + set { + freeswitchPINVOKE.switch_xml_open_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_xml_open_get(swigCPtr); + return ret; + } + } + + public string close { + set { + freeswitchPINVOKE.switch_xml_close_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_xml_close_get(swigCPtr); + return ret; + } + } + public switch_xml() : this(freeswitchPINVOKE.new_switch_xml(), true) { } From 712f05578bbba91f9be8066f5d23e5fd98d00e84 Mon Sep 17 00:00:00 2001 From: s3rj1k <evasive.gyron@gmail.com> Date: Mon, 1 Mar 2021 21:45:20 +0200 Subject: [PATCH 443/655] [Build-System] Enable applications/mod_test build by default. --- .drone.yml | 3 +-- build/modules.conf.in | 1 + build/modules.conf.most | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index acdc0b51c0..947424b302 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,7 +18,6 @@ steps: - DEBIAN_FRONTEND=noninteractive apt-get -yq install libspandsp3-dev - git clone https://github.com/freeswitch/sofia-sip.git - cd sofia-sip && ./autogen.sh && ./configure.gnu && make -j`nproc` && make install && cd .. - - echo "applications/mod_test" >> modules.conf - echo 'codecs/mod_openh264' >> modules.conf - sed -i '/applications\\/mod_http_cache/s/^#//g' modules.conf - sed -i '/event_handlers\\/mod_rayo/s/^#//g' modules.conf @@ -148,6 +147,6 @@ trigger: --- kind: signature -hmac: 500b43fb74a889e2a75e115a4d64c579a6bc48b9521e260908859d7359f2d46b +hmac: a85b0db203d2c9a71c3e4a63a46b5513fbdb3b8f5135e21d0fe0992f33626824 ... diff --git a/build/modules.conf.in b/build/modules.conf.in index 700e86b29e..feb902994b 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -49,6 +49,7 @@ applications/mod_sms applications/mod_spandsp #applications/mod_spy #applications/mod_stress +applications/mod_test #applications/mod_translate applications/mod_valet_parking #applications/mod_video_filter diff --git a/build/modules.conf.most b/build/modules.conf.most index f4188b7dc3..a981c273db 100644 --- a/build/modules.conf.most +++ b/build/modules.conf.most @@ -47,6 +47,7 @@ applications/mod_soundtouch applications/mod_spandsp applications/mod_spy applications/mod_stress +applications/mod_test applications/mod_translate applications/mod_valet_parking applications/mod_video_filter From 408480bae03cf34323af9dd0b77f61d4569e16e6 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Sun, 24 Oct 2021 20:36:52 +0800 Subject: [PATCH 444/655] [Unit-tests] Fix mac build * [core] fix build err on Mac * [mod_av] fix build on macOS --- src/mod/applications/mod_av/test/test_avformat.c | 2 +- tests/unit/switch_rtp.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_av/test/test_avformat.c b/src/mod/applications/mod_av/test/test_avformat.c index 2c8949472f..5a0043e6cc 100644 --- a/src/mod/applications/mod_av/test/test_avformat.c +++ b/src/mod/applications/mod_av/test/test_avformat.c @@ -229,7 +229,7 @@ FST_CORE_BEGIN("conf") while (1) { status = switch_core_file_read(&fh, data, &len); if (status != SWITCH_STATUS_SUCCESS) break; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d\n", len); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "read: %" SWITCH_SIZE_T_FMT "\n", len); // fst_check(len == SAMPLES); status = switch_core_file_read_video(&fh, &frame, SVR_FLUSH); diff --git a/tests/unit/switch_rtp.c b/tests/unit/switch_rtp.c index ebe307ad29..48c0f80d6b 100644 --- a/tests/unit/switch_rtp.c +++ b/tests/unit/switch_rtp.c @@ -2,6 +2,10 @@ #include <switch.h> #include <test/switch_test.h> +#ifndef MSG_CONFIRM +#define MSG_CONFIRM 0 +#endif + static const char *rx_host = "127.0.0.1"; static switch_port_t rx_port = 1234; static const char *tx_host = "127.0.0.1"; From f9994c00f981d4faba6949a90c3ca087ae19be96 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Sun, 24 Oct 2021 20:39:56 +0800 Subject: [PATCH 445/655] [mod_verto] Fix leak in http_run. --- src/mod/endpoints/mod_verto/mod_verto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 152229c32d..8b69519f6f 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1924,6 +1924,7 @@ done: keepalive = request->keepalive; kws_request_free(&request); + if (stream.param_event) switch_event_destroy(&stream.param_event); if (keepalive) { kws_t *wsh = jsock->ws; From 4555731ee37880545df3ea62b4a762551b7bfad6 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sun, 24 Oct 2021 21:49:18 +0300 Subject: [PATCH 446/655] 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 ef3ef34409..924b6af807 100644 --- a/build/next-release.txt +++ b/build/next-release.txt @@ -1 +1 @@ -1.10.7-dev +1.10.8-dev diff --git a/configure.ac b/configure.ac index 73e322a6ca..898f48b4e8 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.7-dev], bugs@freeswitch.org) +AC_INIT([freeswitch], [1.10.8-dev], bugs@freeswitch.org) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [10]) -AC_SUBST(SWITCH_VERSION_MICRO, [7-dev]) +AC_SUBST(SWITCH_VERSION_MICRO, [8-dev]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, []) From 68039d344d8e826e8b403c9cd0284fd07b4495ac Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Tue, 26 Oct 2021 08:42:58 +0000 Subject: [PATCH 447/655] [core] fix build SWITCH_BYTE_ORDER == __BIG_ENDIAN --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1880bbb19c..843ee81381 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2155,7 +2155,7 @@ static void switch_send_rtcp_event(switch_rtp_t *rtp_session ,struct switch_rtcp switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header, value); snprintf(header, sizeof(header), "Source-Lost"); #if SWITCH_BYTE_ORDER == __BIG_ENDIAN - tmpLost = report->lost; /* signed 24bit will extended signess to int32_t automatically */ + tmpLost = rtcp_report_block->lost; /* signed 24bit will extended signess to int32_t automatically */ #else tmpLost = ntohl(rtcp_report_block->lost)>>8; tmpLost = tmpLost | ((tmpLost & 0x00800000) ? 0xff000000 : 0x00000000); /* ...and signess compensation */ From cfb4c3ca807b01c3ff119524f61d81b3a0f0709e Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Tue, 26 Oct 2021 14:27:14 +0000 Subject: [PATCH 448/655] [mod_http_cache][unit-tests] remove timestamp unit-test --- src/mod/applications/mod_http_cache/test/test_aws.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mod/applications/mod_http_cache/test/test_aws.c b/src/mod/applications/mod_http_cache/test/test_aws.c index bc857af067..d1844f9160 100644 --- a/src/mod/applications/mod_http_cache/test/test_aws.c +++ b/src/mod/applications/mod_http_cache/test/test_aws.c @@ -184,9 +184,7 @@ FST_TEST_END() FST_TEST_BEGIN(get_time) { - char time_stamp[TIME_STAMP_LENGTH]; char date_stamp[DATE_STAMP_LENGTH]; - char time_stamp_test[TIME_STAMP_LENGTH]; char date_stamp_test[DATE_STAMP_LENGTH]; // Get date and time for test case @@ -197,16 +195,13 @@ FST_TEST_BEGIN(get_time) // Get date and time to test get_time("%Y%m%d", date_stamp, DATE_STAMP_LENGTH); - get_time("%Y%m%dT%H%M%SZ", time_stamp, TIME_STAMP_LENGTH); // https://fresh2refresh.com/c-programming/c-time-related-functions/ // https://stackoverflow.com/questions/5141960/get-the-current-time-in-c/5142028 // https://linux.die.net/man/3/ctime // https://stackoverflow.com/questions/153890/printing-leading-0s-in-c switch_snprintf(date_stamp_test, DATE_STAMP_LENGTH, "%d%02d%02d", timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday); - switch_snprintf(time_stamp_test, TIME_STAMP_LENGTH, "%d%02d%02dT%02d%02d%02dZ", timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); - fst_check_string_equals(time_stamp_test, time_stamp); fst_check_string_equals(date_stamp_test, date_stamp); } FST_TEST_END() From 9f26a15220b8b8b09c4debe41fe395d25d4cfeec Mon Sep 17 00:00:00 2001 From: shaunjstokes <shaun@sysconfig.cloud> Date: Tue, 26 Oct 2021 18:25:14 +0200 Subject: [PATCH 449/655] [mod_pgsql] Add support for postgresql 14 --- src/mod/databases/mod_pgsql/mod_pgsql.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c index 8c24cf9fce..b638a4feae 100644 --- a/src/mod/databases/mod_pgsql/mod_pgsql.c +++ b/src/mod/databases/mod_pgsql/mod_pgsql.c @@ -774,6 +774,11 @@ switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pg case PGRES_COPY_IN: case PGRES_COMMAND_OK: break; +#if POSTGRESQL_MAJOR_VERSION >= 14 + case PGRES_PIPELINE_ABORTED: + case PGRES_PIPELINE_SYNC: + break; +#endif case PGRES_EMPTY_QUERY: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Query (%s) returned PGRES_EMPTY_QUERY\n", handle->sql); case PGRES_BAD_RESPONSE: From d13ee2573559f6225c988578d6274f4bd5f94b96 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed, 27 Oct 2021 12:41:31 -0400 Subject: [PATCH 450/655] [mod_sofia] Provide retry time for failed and waiting registration --- src/mod/endpoints/mod_sofia/mod_sofia.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index a3a6cd8e91..1f4d89b11b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2936,9 +2936,9 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t gp->ib_failed_calls, gp->ib_calls, gp->ob_failed_calls, gp->ob_calls); free(pkey); - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_FAIL_WAIT || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->reg_timeout > now) { + if (gp->reg_timeout >= now) { stream->write_function(stream, " (retry: %ds)", gp->reg_timeout - now); } else { stream->write_function(stream, " (retry: NEVER)"); @@ -3186,9 +3186,9 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t stream->write_function(stream, "%25s\t%s\t %40s\t%s", pkey, "gateway", gp->register_to, sofia_state_names[gp->state]); free(pkey); - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_FAIL_WAIT || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->retry > now) { + if (gp->retry >= now) { stream->write_function(stream, " (retry: %ds)", gp->retry - now); } else { stream->write_function(stream, " (retry: NEVER)"); @@ -3240,9 +3240,9 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre stream->write_function(stream, " <failed-calls-in>%u</failed-calls-in>\n", gp->ib_failed_calls); stream->write_function(stream, " <failed-calls-out>%u</failed-calls-out>\n", gp->ob_failed_calls); - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_FAIL_WAIT || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->retry > now) { + if (gp->retry >= now) { stream->write_function(stream, " <retry>%ds</retry>\n", gp->retry - now); } else { stream->write_function(stream, " <retry>NEVER</retry>\n"); @@ -3503,9 +3503,9 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl switch_assert(gp->state < REG_STATE_LAST); stream->write_function(stream, "<gateway>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</gateway>\n", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]); - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_FAIL_WAIT || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->retry > now) { + if (gp->retry >= now) { stream->write_function(stream, " (retry: %ds)", gp->retry - now); } else { stream->write_function(stream, " (retry: NEVER)"); From fe296e4fa3a856c14ac9f38b283f7deae7449a6d Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@gmail.com> Date: Tue, 21 May 2019 17:12:36 +0800 Subject: [PATCH 451/655] [mod_lua] fix json encoding of lua number string --- src/mod/languages/mod_lua/freeswitch_lua.cpp | 6 +++--- src/mod/languages/mod_lua/test/test_json.lua | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index 50d0778336..5d89aa28f9 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -568,11 +568,11 @@ void JSON::LuaTable2cJSON(lua_State *L, int index, cJSON **json) switch_assert(*json); - if (lua_isnumber(L, -2)) { + if (lua_type(L, -2) == LUA_TNUMBER) { ADDITEM(*json, key, cJSON_CreateNumber(lua_tonumber(L, -2))); - } else if (lua_isstring(L, -2)) { + } else if (lua_type(L, -2) == LUA_TSTRING) { ADDITEM(*json, key, cJSON_CreateString(lua_tostring(L, -2))); - } else if (lua_isboolean(L, -2)) { + } else if (lua_type(L, -2) == LUA_TBOOLEAN) { ADDITEM(*json, key, cJSON_CreateBool(lua_toboolean(L, -2))); } else if (lua_isnil(L, -2)) { ADDITEM(*json, key, cJSON_CreateNull()); diff --git a/src/mod/languages/mod_lua/test/test_json.lua b/src/mod/languages/mod_lua/test/test_json.lua index b8f358f816..9ac2c06284 100644 --- a/src/mod/languages/mod_lua/test/test_json.lua +++ b/src/mod/languages/mod_lua/test/test_json.lua @@ -108,5 +108,11 @@ freeswitch.consoleLog("INFO", ret .. "\n") ret = json:execute2(json:encode(cmd)) freeswitch.consoleLog("INFO", ret .. "\n") +sn = json:encode({s = "1001", n = 1002}) +freeswitch.consoleLog("INFO", sn .. "\n") +ret = json:decode(sn) +assert(ret.s == "1001") +assert(ret.n == 1002) + -- assert(false) stream:write("+OK") From 3128afeae7cadafd9838569af21e4f2a454893bb Mon Sep 17 00:00:00 2001 From: Sebastian Kemper <sebastian_ml@gmx.net> Date: Mon, 1 Nov 2021 09:48:15 +0100 Subject: [PATCH 452/655] [mod_opusfile] fix type errors Since the last round of changes it fails to compile: mod_opusfile.c: In function 'decode_stream_cb': mod_opusfile.c:933:143: error: format '%lx' expects argument of type 'long unsigned int', but argument 8 has type 'switch_thread_id_t' {aka 'struct __pthread *'} [-Werror=format=] 933 | switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode_stream_cb(): switch_thread_self(): %lx\n", switch_thread_self()); | ~~^ ~~~~~~~~~~~~~~~~~~~~ | | | | | switch_thread_id_t {aka struct __pthread *} | long unsigned int Address this by applying the same casts that are also used in src/mod/formats/mod_sndfile/test/test_sndfile.c already. Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net> --- src/mod/formats/mod_opusfile/mod_opusfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/formats/mod_opusfile/mod_opusfile.c b/src/mod/formats/mod_opusfile/mod_opusfile.c index 38f5d1f442..72add5e8b3 100644 --- a/src/mod/formats/mod_opusfile/mod_opusfile.c +++ b/src/mod/formats/mod_opusfile/mod_opusfile.c @@ -930,7 +930,7 @@ static int decode_stream_cb(void *dcontext, unsigned char *data, int nbytes) if (globals.debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode CB called: context: %p data: %p packet_len: %d\n", (void *)context, data, nbytes); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode_stream_cb(): switch_thread_self(): %lx\n", switch_thread_self()); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] decode_stream_cb(): switch_thread_self(): %lx\n", (unsigned long)(intptr_t)switch_thread_self()); } switch_mutex_lock(context->ogg_mutex); @@ -973,7 +973,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void int buffered_ogg_bytes; if (globals.debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] read_stream_thread(): switch_thread_self(): 0x%lx\n", switch_thread_self()); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Stream Decode] read_stream_thread(): switch_thread_self(): 0x%lx\n", (unsigned long)(intptr_t)switch_thread_self()); } switch_thread_rwlock_rdlock(context->rwlock); switch_mutex_lock(context->ogg_mutex); From 5cd8a53ae80685a79938831d82f7caa4c3dbd7de Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Mon, 1 Nov 2021 13:50:26 +0000 Subject: [PATCH 453/655] [mod_voicemail_ivr] Fix array overflow --- src/mod/applications/mod_voicemail_ivr/menu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_voicemail_ivr/menu.c b/src/mod/applications/mod_voicemail_ivr/menu.c index 79aa16b56e..8a21353c93 100644 --- a/src/mod/applications/mod_voicemail_ivr/menu.c +++ b/src/mod/applications/mod_voicemail_ivr/menu.c @@ -730,13 +730,15 @@ char *vmivr_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t * for (retry = menu->ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) { int i; + int dtmfa_array_length = 0; menu_instance_init(menu); switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, "IVR-Retry-Left", "%d", retry); /* Find the last entry and append this one to it */ - for (i=0; i < 16 && menu->dtmfa[i]; i++){ + dtmfa_array_length = sizeof(menu->dtmfa) / sizeof(menu->dtmfa[0]); + for (i = 0; i < (dtmfa_array_length - 1) && menu->dtmfa[i]; i++){ } menu->dtmfa[i] = (char *) input_mask; From 62dcdff8d9db2c057207590a65d62b9249624e3c Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Mon, 1 Nov 2021 13:59:36 +0000 Subject: [PATCH 454/655] [mod_unicall] Fix array overflow --- src/mod/endpoints/mod_unicall/mod_unicall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_unicall/mod_unicall.c b/src/mod/endpoints/mod_unicall/mod_unicall.c index 92dee3f2cf..ee4d65e9ef 100644 --- a/src/mod/endpoints/mod_unicall/mod_unicall.c +++ b/src/mod/endpoints/mod_unicall/mod_unicall.c @@ -1771,7 +1771,7 @@ static switch_status_t config_unicall(int reload) for (i = min_span; i <= max_span; i++) { current_span = i; - if (current_span <= 0 || current_span > MAX_SPANS) { + if (current_span <= 0 || current_span >= MAX_SPANS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid SPAN %d!\n", current_span); current_span = 0; continue; From a2ce46c6fde38d6ac54a8a2ee1a5b391e2ed2071 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper <sebastian_ml@gmx.net> Date: Mon, 1 Nov 2021 09:59:09 +0100 Subject: [PATCH 455/655] [core] fix "--disable-libyuv" Recent changes made it impossible to compile freeswitch without libyuv support. src/switch_core_video.c: In function 'switch_img_read_from_file': src/switch_core_video.c:3139:4: error: implicit declaration of function 'RAWToI420' [-Werror=implicit-function-declaration] RAWToI420(data, width * 3, ^ src/switch_core_video.c:3148:4: error: implicit declaration of function 'ABGRToARGB' [-Werror=implicit-function-declaration] ABGRToARGB(data, width * 4, img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], width, height); ^ Fix this my adding/moving the checks for "SWITCH_HAVE_YUV". Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net> --- src/switch_core_video.c | 12 ++++++++++++ tests/unit/switch_core_video.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 7dbd685d6e..0d377f9c3e 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -3116,6 +3116,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_data_url_png(switch_image_t *img, cha SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name, switch_img_fmt_t img_fmt) { +#ifdef SWITCH_HAVE_YUV int width = 0, height = 0, channels = 0; int comp = STBI_rgb; unsigned char *data = NULL; @@ -3155,12 +3156,16 @@ SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name } else if (data) { stbi_image_free(data); } +#endif return NULL; } SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality) { +#ifndef SWITCH_HAVE_YUV + return SWITCH_STATUS_FALSE; +#else int comp = STBI_rgb; unsigned char *data = NULL; const char *ext = strrchr(file_name, '.'); @@ -3217,6 +3222,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, co free(data); return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +#endif } typedef struct data_url_context_s { @@ -3224,14 +3230,19 @@ typedef struct data_url_context_s { char **urlP; } data_url_context_t; +#ifdef SWITCH_HAVE_YUV static void data_url_write_func(void *context, void *data, int size) { switch_buffer_t *buffer = (switch_buffer_t *)context; switch_buffer_write(buffer, data, size); } +#endif SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality) { +#ifndef SWITCH_HAVE_YUV + return SWITCH_STATUS_FALSE; +#else int comp = STBI_rgb; unsigned char *data = NULL; int stride_in_bytes = 0; @@ -3300,6 +3311,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char ** switch_buffer_destroy(&buffer); return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +#endif /* SWITCH_HAVE_YUV */ } diff --git a/tests/unit/switch_core_video.c b/tests/unit/switch_core_video.c index 27c9610292..e395db474d 100644 --- a/tests/unit/switch_core_video.c +++ b/tests/unit/switch_core_video.c @@ -48,6 +48,7 @@ FST_CORE_BEGIN("./conf") } FST_TEARDOWN_END() +#ifdef SWITCH_HAVE_YUV FST_TEST_BEGIN(data_url_test) { char *data_url = NULL; @@ -88,6 +89,7 @@ FST_CORE_BEGIN("./conf") unlink(argb_filename); } FST_TEST_END() +#endif /* SWITCH_HAVE_YUV */ FST_TEST_BEGIN(img_patch) { @@ -239,6 +241,7 @@ FST_CORE_BEGIN("./conf") } FST_TEST_END() +#ifdef SWITCH_HAVE_YUV FST_TEST_BEGIN(stb_data_url) { switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1); @@ -321,6 +324,7 @@ FST_CORE_BEGIN("./conf") unlink(jpg_write_filename); } FST_TEST_END() +#endif /* SWITCH_HAVE_YUV */ } FST_SUITE_END() } From b4a7cf40597a7746e10d11e5bc6b3b6ee3fb0af6 Mon Sep 17 00:00:00 2001 From: Clarence <xjh.azzbcc@gmail.com> Date: Tue, 2 Nov 2021 11:28:58 +0800 Subject: [PATCH 456/655] [core] fix compile error with gcc 11.1 --- src/include/switch_core_media.h | 2 +- src/include/switch_rtp.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index f57e1ce974..8722e05a1f 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -203,7 +203,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_media_handle_ready(switch_co SWITCH_DECLARE(void) switch_media_handle_set_media_flag(switch_media_handle_t *smh, switch_core_media_flag_t flag); SWITCH_DECLARE(void) switch_media_handle_clear_media_flag(switch_media_handle_t *smh, switch_core_media_flag_t flag); SWITCH_DECLARE(int32_t) switch_media_handle_test_media_flag(switch_media_handle_t *smh, switch_core_media_flag_t flag); -SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[]); +SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[SCMF_MAX]); SWITCH_DECLARE(void) switch_core_session_check_outgoing_crypto(switch_core_session_t *session); SWITCH_DECLARE(const char *) switch_core_session_local_crypto_key(switch_core_session_t *session, switch_media_type_t type); SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session, diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index 96ea2135f3..633e8e6f7e 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -234,7 +234,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session switch_payload_t payload, uint32_t samples_per_interval, uint32_t ms_per_packet, - switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool); + switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool); /*! @@ -260,7 +260,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host, switch_payload_t payload, uint32_t samples_per_interval, uint32_t ms_per_packet, - switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool, switch_port_t bundle_internal_ports, switch_port_t bundle_external_port); + switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool, switch_port_t bundle_internal_ports, switch_port_t bundle_external_port); /*! From 0c8ff2fbcf3b1334ab23fb8a6f4861b7a518f9fc Mon Sep 17 00:00:00 2001 From: dhruvecosmob <dhruv.gupta@ecosmob.com> Date: Tue, 2 Nov 2021 10:59:56 +0530 Subject: [PATCH 457/655] [mod_test] Increasing the precision time of fst_check_duration in the tts_time function of the unit-test. --- src/mod/applications/mod_test/test/test_tts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_test/test/test_tts.c b/src/mod/applications/mod_test/test/test_tts.c index f1e4205f68..e5ec1aa254 100644 --- a/src/mod/applications/mod_test/test/test_tts.c +++ b/src/mod/applications/mod_test/test/test_tts.c @@ -146,7 +146,7 @@ FST_TEST_BEGIN(tts_time) } while (status == SWITCH_STATUS_SUCCESS); fst_check(read = sample_rate / interval * 3); // samples of 3 second - fst_check_duration(3000, 500); + fst_check_duration(3000, 750); switch_core_speech_close(&sh, &flags); } FST_TEST_END() From 0fdd5b67277706e8dccacb98ac7790c24cd22062 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 3 Nov 2021 17:00:08 +0300 Subject: [PATCH 458/655] [Core] Fix switch_event_base_add_header leaking memory when headers are with indexes. Add a unit-test. * [Unit-tests] Add a test provoking switch_event_add_header to memory leak. * [Core] Fix switch_event_base_add_header leaking memory when headers are with indexes. --- libs/esl/src/esl_event.c | 3 +++ src/switch_event.c | 3 +++ tests/unit/switch_core.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 8a88395ec2..cca7899d80 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -484,11 +484,14 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st exists = 1; } + FREE(data); goto redraw; } } else if (tmp_header) { free_header(&tmp_header); } + + FREE(data); goto end; } else { if ((stack & ESL_STACK_PUSH) || (stack & ESL_STACK_UNSHIFT)) { diff --git a/src/switch_event.c b/src/switch_event.c index 3e5b05ae32..a24bee0126 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1062,11 +1062,14 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc exists = 1; } + FREE(data); goto redraw; } } else if (tmp_header) { free_header(&tmp_header); } + + FREE(data); goto end; } else { if ((stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT)) { diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index 126921997c..5689513cbc 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -51,6 +51,22 @@ FST_CORE_BEGIN("./conf") } FST_TEARDOWN_END() + FST_TEST_BEGIN(test_switch_event_add_header_leak) + { + switch_event_t* event; + + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_CALLSTATE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Call-State-Number[0]", "1"); + switch_event_fire(&event); + } + + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_CALLSTATE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Call-State-Number[5000]", "12"); + switch_event_fire(&event); + } + } + FST_TEST_END() + FST_TEST_BEGIN(test_xml_free_attr) { switch_xml_t parent_xml = switch_xml_new("xml"); From 266387295344c883e60120a86c442545b8226cd0 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 3 Nov 2021 22:48:44 +0300 Subject: [PATCH 459/655] [Build-System] Add better error reporting to configure when libks or signalwire-client are missing and mod_verto or mod_signalwire enabled. --- configure.ac | 18 ++++++++++++++++-- src/mod/endpoints/mod_verto/Makefile.am | 8 ++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 898f48b4e8..990a59db2a 100644 --- a/configure.ac +++ b/configure.ac @@ -1531,11 +1531,25 @@ PKG_CHECK_MODULES([V8FS_STATIC], [v8-6.1_static >= 6.1.298],[ PKG_CHECK_MODULES([KS], [libks >= 1.1.0],[ AM_CONDITIONAL([HAVE_KS],[true])],[ - AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false])]) + if module_enabled mod_verto; then + AC_MSG_ERROR([You need to either install libks or disable mod_verto in modules.conf]) + else + if module_enabled mod_signalwire; then + AC_MSG_ERROR([You need to either install libks or disable mod_signalwire in modules.conf]) + else + AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false]) + fi + fi +]) PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client >= 1.0.0],[ AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[true])],[ - AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[false])]) + if module_enabled mod_signalwire; then + AC_MSG_ERROR([You need to either install signalwire-client-c or disable mod_signalwire in modules.conf]) + else + AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[false]) + fi +]) PKG_CHECK_MODULES([AMQP], [librabbitmq >= 0.5.2],[ AM_CONDITIONAL([HAVE_AMQP],[true])],[ diff --git a/src/mod/endpoints/mod_verto/Makefile.am b/src/mod/endpoints/mod_verto/Makefile.am index 6eeac1e6a8..8951fe5e54 100644 --- a/src/mod/endpoints/mod_verto/Makefile.am +++ b/src/mod/endpoints/mod_verto/Makefile.am @@ -1,6 +1,7 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_verto +if HAVE_KS mod_LTLIBRARIES = mod_verto.la mod_verto_la_SOURCES = mod_verto.c mcast/mcast.c mod_verto_la_CFLAGS = -D__EXTENSIONS__ -D_GNU_SOURCE $(AM_CFLAGS) $(KS_CFLAGS) @@ -37,3 +38,10 @@ swigclean: rm -f mcast/mcast_wrap.* mcast/MCAST.so mcast/MCAST.pm mcast/perlxsi.* reswig: swigclean mcast/mcast_wrap.cpp mcast/perlxsi.c +else +install: error +all: error +error: + $(error You must install libks to build mod_verto) +endif + From f2a7891f14d9ad7390c8c27a2a0cd6b515b5d4ff Mon Sep 17 00:00:00 2001 From: Ken <krice@freeswitch.org> Date: Wed, 3 Nov 2021 08:14:25 -0500 Subject: [PATCH 460/655] [mod_dptools] Implement disable_system_app_commands global variable to make system and bgsystem dialplan apps disabled at run time. adds a check on startup for global variable disable_system_app_commands. if the global variable is set to true, the system and bgsystem dialplan apps will not have their app_interface loaded via SWITCH_ADD_APP() leaving them effectively disabled at run time. --- src/mod/applications/mod_dptools/mod_dptools.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index d755640c35..b9ef0708d8 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -6427,6 +6427,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) switch_dialplan_interface_t *dp_interface; switch_chat_interface_t *chat_interface; switch_file_interface_t *file_interface; + int use_system_commands = 1; + + if (switch_true(switch_core_get_variable("disable_system_app_commands"))) { + use_system_commands = 0; + } if (switch_event_reserve_subclass(FILE_STRING_CLOSE) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", FILE_STRING_CLOSE); @@ -6704,10 +6709,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SAF_NONE); SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>", SAF_SUPPORT_NOMEDIA|SAF_SUPPORT_TEXT_ONLY); - SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>", - SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); - SWITCH_ADD_APP(app_interface, "bgsystem", "Execute a system command in the background", "Execute a background system command", bgsystem_session_function, "<command>", - SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); + if (use_system_commands) { + SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>", + SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); + SWITCH_ADD_APP(app_interface, "bgsystem", "Execute a system command in the background", "Execute a background system command", bgsystem_session_function, "<command>", + SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); + } SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE); SWITCH_ADD_APP(app_interface, "detect_audio", "detect_audio", "detect_audio", detect_audio_function, DETECT_AUDIO_SYNTAX, From c4bc0bfbb4acda94c7327b8d0bc1bc17a3f0ac97 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Sat, 6 Nov 2021 00:11:32 +0000 Subject: [PATCH 461/655] [mod_avmd] fix formatting to match coding standards --- .../applications/mod_avmd/avmd_amplitude.c | 8 +- .../applications/mod_avmd/avmd_amplitude.h | 2 +- src/mod/applications/mod_avmd/avmd_buffer.c | 20 +- src/mod/applications/mod_avmd/avmd_buffer.h | 62 +- src/mod/applications/mod_avmd/avmd_desa2.c | 74 +- src/mod/applications/mod_avmd/avmd_desa2.h | 2 +- .../mod_avmd/avmd_desa2_tweaked.c | 78 +- .../mod_avmd/avmd_desa2_tweaked.h | 2 +- .../applications/mod_avmd/avmd_fast_acosf.c | 366 +- .../applications/mod_avmd/avmd_fast_acosf.h | 2 +- src/mod/applications/mod_avmd/avmd_fir.h | 6 +- src/mod/applications/mod_avmd/avmd_goertzel.c | 30 +- src/mod/applications/mod_avmd/avmd_goertzel.h | 6 +- src/mod/applications/mod_avmd/avmd_options.h | 2 +- src/mod/applications/mod_avmd/avmd_psi.h | 2 +- src/mod/applications/mod_avmd/avmd_sma_buf.h | 48 +- .../conf/autoload_configs/avmd.conf.xml | 104 +- .../mod_avmd/conf/avmd_test_dialplan.xml | 1664 ++++----- src/mod/applications/mod_avmd/mod_avmd.c | 3098 ++++++++--------- .../mod_avmd/scripts/avmd_get_events.pl | 34 +- .../mod_avmd/scripts/avmd_originate.pl | 72 +- .../scripts/avmd_originate_multiple.pl | 64 +- .../avmd_originate_multiple_loopback.pl | 56 +- .../mod_avmd/scripts/avmd_test.pl | 390 +-- 24 files changed, 3096 insertions(+), 3096 deletions(-) diff --git a/src/mod/applications/mod_avmd/avmd_amplitude.c b/src/mod/applications/mod_avmd/avmd_amplitude.c index 86523fad4b..e4cd3745e3 100644 --- a/src/mod/applications/mod_avmd/avmd_amplitude.c +++ b/src/mod/applications/mod_avmd/avmd_amplitude.c @@ -2,7 +2,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ @@ -12,7 +12,7 @@ double avmd_amplitude(circ_buffer_t *b, size_t i, double f) { - double result; - result = sqrt(PSI(b, i) / sin(f * f)); - return result; + double result; + result = sqrt(PSI(b, i) / sin(f * f)); + return result; } diff --git a/src/mod/applications/mod_avmd/avmd_amplitude.h b/src/mod/applications/mod_avmd/avmd_amplitude.h index da98d083e5..1ada729011 100644 --- a/src/mod/applications/mod_avmd/avmd_amplitude.h +++ b/src/mod/applications/mod_avmd/avmd_amplitude.h @@ -4,7 +4,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ diff --git a/src/mod/applications/mod_avmd/avmd_buffer.c b/src/mod/applications/mod_avmd/avmd_buffer.c index f05f0deb4c..f673a8d31b 100644 --- a/src/mod/applications/mod_avmd/avmd_buffer.c +++ b/src/mod/applications/mod_avmd/avmd_buffer.c @@ -11,20 +11,20 @@ extern size_t next_power_of_2(size_t v) { - size_t prev; - size_t tmp = 1; + size_t prev; + size_t tmp = 1; - v++; + v++; - do { - prev = v; - v &= ~tmp; - tmp <<= 1; - } while (v != 0); + do { + prev = v; + v &= ~tmp; + tmp <<= 1; + } while (v != 0); - prev <<= 1; + prev <<= 1; - return prev; + return prev; } diff --git a/src/mod/applications/mod_avmd/avmd_buffer.h b/src/mod/applications/mod_avmd/avmd_buffer.h index 11d874b5dd..416072caf9 100644 --- a/src/mod/applications/mod_avmd/avmd_buffer.h +++ b/src/mod/applications/mod_avmd/avmd_buffer.h @@ -4,7 +4,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ @@ -15,89 +15,89 @@ #include <stdlib.h> #ifdef WIN32 - #include <float.h> - #include <inttypes.h> + #include <float.h> + #include <inttypes.h> #endif #ifndef INT16_MIN -#define INT16_MIN (-32767-1) +#define INT16_MIN (-32767-1) #endif #ifndef INT16_MAX -#define INT16_MAX (32767) +#define INT16_MAX (32767) #endif #define BUFF_TYPE double typedef struct { - size_t pos; - size_t lpos; - BUFF_TYPE *buf; - size_t buf_len; - size_t mask; - size_t i; - size_t backlog; + size_t pos; + size_t lpos; + BUFF_TYPE *buf; + size_t buf_len; + size_t mask; + size_t i; + size_t backlog; } circ_buffer_t; extern size_t next_power_of_2(size_t v); #define INC_POS(b) \ - { \ + { \ (b)->pos++; \ (b)->pos &= (b)->mask; \ (b)->lpos + 1 < 2 * (b)->buf_len ? (b)->lpos++ : (b)->lpos = (b)->buf_len; \ if ((b)->backlog < (b)->buf_len) (b)->backlog++; \ - } + } #define DEC_POS(b) \ - { \ + { \ (b)->pos--; \ (b)->pos &= (b)->mask; \ (b)->lpos--; \ if (((b)->backlog - 1) < (b)->backlog) (b)->backlog--; \ - } + } #define GET_SAMPLE(b, i) ((b)->buf[(i) & (b)->mask]) #define SET_SAMPLE(b, i, v) ((b)->buf[(i) & (b)->mask] = (v)) #define INSERT_FRAME(b, f, l) \ - do { \ + do { \ for ((b)->i = 0; (b)->i < (l); (b)->i++) { \ - SET_SAMPLE((b), ((b)->i + (b)->pos), (f)[(b)->i]); \ + SET_SAMPLE((b), ((b)->i + (b)->pos), (f)[(b)->i]); \ } \ (b)->pos += (l); \ (b)->lpos += (l); \ (b)->pos %= (b)->buf_len; \ (b)->backlog += (l); \ if ((b)->backlog > (b)->buf_len) (b)->backlog = (b)->buf_len; \ - } while (0) + } while (0) -/* ((f)[(b)->i] >= 0) ? \ - ((BUFF_TYPE)(f)[(b)->i] / (BUFF_TYPE)INT16_MAX): \ - (0.0 - ((BUFF_TYPE)(f)[(b)->i] / (BUFF_TYPE)INT16_MIN)) \ */ +/* ((f)[(b)->i] >= 0) ? \ + ((BUFF_TYPE)(f)[(b)->i] / (BUFF_TYPE)INT16_MAX): \ + (0.0 - ((BUFF_TYPE)(f)[(b)->i] / (BUFF_TYPE)INT16_MIN)) \ */ #define INSERT_INT16_FRAME(b, f, l) \ - { \ + { \ for ((b)->i = 0; (b)->i < (l); (b)->i++) { \ - SET_SAMPLE( \ + SET_SAMPLE( \ (b), \ ((b)->i + (b)->pos), \ ( \ - (BUFF_TYPE)(f)[(b)->i] \ + (BUFF_TYPE)(f)[(b)->i] \ ) \ - ); \ + ); \ } \ (b)->pos += (l); \ (b)->lpos += (l); \ (b)->pos &= (b)->mask; \ (b)->backlog += (l); \ if ((b)->backlog > (b)->buf_len) (b)->backlog = (b)->buf_len; \ - } + } #define CALC_BUFF_LEN(fl, bl) (((fl) >= (bl))? next_power_of_2((fl) << 1): next_power_of_2((bl) << 1)) #define INIT_CIRC_BUFFER(bf, bl, fl, s) \ - { \ + { \ (bf)->buf_len = CALC_BUFF_LEN((fl), (bl)); \ (bf)->mask = (bf)->buf_len - 1; \ (bf)->buf = (BUFF_TYPE *) switch_core_session_alloc(s, (bf)->buf_len * sizeof(BUFF_TYPE)); \ @@ -105,7 +105,7 @@ extern size_t next_power_of_2(size_t v); (bf)->lpos = 0; \ (bf)->backlog = 0; \ (bf)->i = 0; \ - } + } //#define DESTROY_CIRC_BUFFER(b) free((b)->buf) #define GET_BACKLOG_POS(b) ((b)->lpos - (b)->backlog) @@ -114,9 +114,9 @@ extern size_t next_power_of_2(size_t v); #define GET_CURRENT_SAMPLE(b) GET_SAMPLE((b), GET_CURRENT_LPOS((b))) #define ADD_SAMPLE(b, s) \ - do { \ + do { \ INC_POS((b)); \ SET_SAMPLE((b), GET_CURRENT_LPOS((b)), (s)); \ - } while (0) + } while (0) #endif /* __AVMD_BUFFER_H__ */ diff --git a/src/mod/applications/mod_avmd/avmd_desa2.c b/src/mod/applications/mod_avmd/avmd_desa2.c index f6b62785d1..72e347fffd 100644 --- a/src/mod/applications/mod_avmd/avmd_desa2.c +++ b/src/mod/applications/mod_avmd/avmd_desa2.c @@ -2,15 +2,15 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ #include <stdio.h> #ifdef WIN32 - #include <float.h> - #define ISNAN(x) (!!(_isnan(x))) - #define ISINF(x) (isinf(x)) + #include <float.h> + #define ISNAN(x) (!!(_isnan(x))) + #define ISINF(x) (isinf(x)) #endif #include "avmd_buffer.h" @@ -18,50 +18,50 @@ #include "avmd_options.h" #ifdef AVMD_FAST_MATH - #include "avmd_fast_acosf.h" + #include "avmd_fast_acosf.h" #endif double avmd_desa2(circ_buffer_t *b, size_t i, double *amplitude) { - double d; - double n; - double x0; - double x1; - double x2; - double x3; - double x4; - double x2sq; - double result; - double PSI_Xn, PSI_Yn, NEEDED; + double d; + double n; + double x0; + double x1; + double x2; + double x3; + double x4; + double x2sq; + double result; + double PSI_Xn, PSI_Yn, NEEDED; - x0 = GET_SAMPLE((b), (i)); - x1 = GET_SAMPLE((b), ((i) + 1)); - x2 = GET_SAMPLE((b), ((i) + 2)); - x3 = GET_SAMPLE((b), ((i) + 3)); - x4 = GET_SAMPLE((b), ((i) + 4)); + x0 = GET_SAMPLE((b), (i)); + x1 = GET_SAMPLE((b), ((i) + 1)); + x2 = GET_SAMPLE((b), ((i) + 2)); + x3 = GET_SAMPLE((b), ((i) + 3)); + x4 = GET_SAMPLE((b), ((i) + 4)); - x2sq = x2 * x2; - d = 2.0 * ((x2sq) - (x1 * x3)); - if (d == 0.0) { - *amplitude = 0.0; - return 0.0; - } - PSI_Xn = ((x2sq) - (x0 * x4)); - NEEDED = ((x1 * x1) - (x0 * x2)) + ((x3 * x3) - (x2 * x4)); - n = ((x2sq) - (x0 * x4)) - NEEDED; - PSI_Yn = NEEDED + PSI_Xn; + x2sq = x2 * x2; + d = 2.0 * ((x2sq) - (x1 * x3)); + if (d == 0.0) { + *amplitude = 0.0; + return 0.0; + } + PSI_Xn = ((x2sq) - (x0 * x4)); + NEEDED = ((x1 * x1) - (x0 * x2)) + ((x3 * x3) - (x2 * x4)); + n = ((x2sq) - (x0 * x4)) - NEEDED; + PSI_Yn = NEEDED + PSI_Xn; #ifdef AVMD_FAST_MATH - result = 0.5 * (double)fast_acosf((float)n/d); + result = 0.5 * (double)fast_acosf((float)n/d); #else - result = 0.5 * acos(n/d); + result = 0.5 * acos(n/d); #endif - if (ISNAN(result)) { - result = 0.0; - } - *amplitude = 2.0 * PSI_Xn / sqrt(PSI_Yn); + if (ISNAN(result)) { + result = 0.0; + } + *amplitude = 2.0 * PSI_Xn / sqrt(PSI_Yn); - return result; + return result; } diff --git a/src/mod/applications/mod_avmd/avmd_desa2.h b/src/mod/applications/mod_avmd/avmd_desa2.h index 6e8f6e58a7..83541ed38d 100644 --- a/src/mod/applications/mod_avmd/avmd_desa2.h +++ b/src/mod/applications/mod_avmd/avmd_desa2.h @@ -4,7 +4,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ diff --git a/src/mod/applications/mod_avmd/avmd_desa2_tweaked.c b/src/mod/applications/mod_avmd/avmd_desa2_tweaked.c index a6dab2be28..9aadbb9dac 100644 --- a/src/mod/applications/mod_avmd/avmd_desa2_tweaked.c +++ b/src/mod/applications/mod_avmd/avmd_desa2_tweaked.c @@ -1,71 +1,71 @@ /* * Contributor(s): * - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ #ifndef __AVMD_DESA2_TWEAKED_H__ - #include "avmd_desa2_tweaked.h" + #include "avmd_desa2_tweaked.h" #endif #include <switch.h> #include <stdio.h> #ifdef WIN32 - #include <float.h> - #define ISNAN(x) (!!(_isnan(x))) - #define ISINF(x) (isinf(x)) + #include <float.h> + #define ISNAN(x) (!!(_isnan(x))) + #define ISINF(x) (isinf(x)) #endif #include "avmd_buffer.h" #include "avmd_options.h" #ifndef AVMD_FAST_MATH - #include "avmd_fast_acosf.h" + #include "avmd_fast_acosf.h" #endif double avmd_desa2_tweaked(circ_buffer_t *b, size_t i, double *amplitude) { - double n, d; - double x0; - double x1; - double x2; - double x3; - double x4; - double x2sq; - double result; - double PSI_Xn, PSI_Yn, NEEDED; + double n, d; + double x0; + double x1; + double x2; + double x3; + double x4; + double x2sq; + double result; + double PSI_Xn, PSI_Yn, NEEDED; - x0 = GET_SAMPLE((b), (i)); - x1 = GET_SAMPLE((b), ((i) + 1)); - x2 = GET_SAMPLE((b), ((i) + 2)); - x3 = GET_SAMPLE((b), ((i) + 3)); - x4 = GET_SAMPLE((b), ((i) + 4)); - x2sq = x2 * x2; - d = 2.0 * ((x2sq) - (x1 * x3)); - PSI_Xn = ((x2sq) - (x0 * x4)); - NEEDED = ((x1 * x1) - (x0 * x2)) + ((x3 * x3) - (x2 * x4)); - n = ((x2sq) - (x0 * x4)) - NEEDED; - PSI_Yn = NEEDED + PSI_Xn; + x0 = GET_SAMPLE((b), (i)); + x1 = GET_SAMPLE((b), ((i) + 1)); + x2 = GET_SAMPLE((b), ((i) + 2)); + x3 = GET_SAMPLE((b), ((i) + 3)); + x4 = GET_SAMPLE((b), ((i) + 4)); + x2sq = x2 * x2; + d = 2.0 * ((x2sq) - (x1 * x3)); + PSI_Xn = ((x2sq) - (x0 * x4)); + NEEDED = ((x1 * x1) - (x0 * x2)) + ((x3 * x3) - (x2 * x4)); + n = ((x2sq) - (x0 * x4)) - NEEDED; + PSI_Yn = NEEDED + PSI_Xn; /* instead of #ifdef FASTMATH - result = 0.5 * (double)fast_acosf((float)n/d); + result = 0.5 * (double)fast_acosf((float)n/d); #else - result = 0.5 * acos(n/d); + result = 0.5 * acos(n/d); #endif we do simplified, modified for speed version : */ - result = n/d; -/* if (ISINF(result)) { - *amplitude = 0.0; - if (n < 0.0) { - return -10.0; - } else { - return 10.0; - } - }*/ - *amplitude = 2.0 * PSI_Xn / sqrt(PSI_Yn); - return result; + result = n/d; +/* if (ISINF(result)) { + *amplitude = 0.0; + if (n < 0.0) { + return -10.0; + } else { + return 10.0; + } + }*/ + *amplitude = 2.0 * PSI_Xn / sqrt(PSI_Yn); + return result; } diff --git a/src/mod/applications/mod_avmd/avmd_desa2_tweaked.h b/src/mod/applications/mod_avmd/avmd_desa2_tweaked.h index ac6d6fc4d8..38d788cde4 100644 --- a/src/mod/applications/mod_avmd/avmd_desa2_tweaked.h +++ b/src/mod/applications/mod_avmd/avmd_desa2_tweaked.h @@ -10,7 +10,7 @@ * * Contributor(s): * - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> * * @date 20 Mar 2016 */ diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.c b/src/mod/applications/mod_avmd/avmd_fast_acosf.c index b0d8655d6e..572c6a84f9 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.c +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.c @@ -2,7 +2,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ @@ -14,7 +14,7 @@ #include <stdlib.h> #ifndef _MSC_VER - #include <stdint.h> + #include <stdint.h> #endif #include <sys/types.h> @@ -22,7 +22,7 @@ #include <fcntl.h> #ifndef _MSC_VER - #include <sys/mman.h> + #include <sys/mman.h> #endif #include <assert.h> @@ -31,7 +31,7 @@ #include <string.h> #ifndef _MSC_VER - #include <unistd.h> + #include <unistd.h> #endif #include "avmd_fast_acosf.h" @@ -39,8 +39,8 @@ typedef union { - uint32_t i; - float f; + uint32_t i; + float f; } float_conv_t; /* @@ -58,14 +58,14 @@ typedef union { #define ACOS_TABLE_CONST_EXPONENT_BITS (3) #define ACOS_TABLE_DISCARDED_BITS (3) /* rosolution: - 3: 15 728 640 indices spreading range [0.0, 1.0], table size on disk 134 217 728 bytes (default) - 4: 7 364 320 indices spreading range [0.0, 1.0], table size on disk 67 108 864 bytes - 5: 3 932 160 indices spreading range [0.0, 1.0], table size on disk 33 554 432 bytes - 12: 30 720 indices spreading range [0.0, 1.0], table size on disk 262 144 bytes - 16: 1 920 indices spreading range [0.0, 1.0], table size on disk 16 384 bytes - 20: 120 indices spreading range [0.0, 1.0], table size on disk 1 024 bytes - 24: 7 indices spreading range [0.0, 1.0], table size on disk 64 bytes - 26: 1 indices spreading range [0.0, 1.0], table size on disk 16 bytes + 3: 15 728 640 indices spreading range [0.0, 1.0], table size on disk 134 217 728 bytes (default) + 4: 7 364 320 indices spreading range [0.0, 1.0], table size on disk 67 108 864 bytes + 5: 3 932 160 indices spreading range [0.0, 1.0], table size on disk 33 554 432 bytes + 12: 30 720 indices spreading range [0.0, 1.0], table size on disk 262 144 bytes + 16: 1 920 indices spreading range [0.0, 1.0], table size on disk 16 384 bytes + 20: 120 indices spreading range [0.0, 1.0], table size on disk 1 024 bytes + 24: 7 indices spreading range [0.0, 1.0], table size on disk 64 bytes + 26: 1 indices spreading range [0.0, 1.0], table size on disk 16 bytes */ #define ACOS_TABLE_FREE_EXPONENT_BITS (7 - ACOS_TABLE_CONST_EXPONENT_BITS) #define ACOS_TABLE_DATA_BITS (31 - ACOS_TABLE_CONST_EXPONENT_BITS - ACOS_TABLE_DISCARDED_BITS) @@ -73,7 +73,7 @@ typedef union { #define VARIA_DATA_MASK (0x87FFFFFF & ~((1 << ACOS_TABLE_DISCARDED_BITS) - 1)) #define CONST_DATA_MASK (((1 << ACOS_TABLE_CONST_EXPONENT_BITS) - 1) \ - << (ACOS_TABLE_DATA_BITS - 1 + ACOS_TABLE_DISCARDED_BITS)) + << (ACOS_TABLE_DATA_BITS - 1 + ACOS_TABLE_DISCARDED_BITS)) #define SIGN_UNPACK_MASK (1 << (ACOS_TABLE_DATA_BITS - 1)) #define DATA_UNPACK_MASK ((1 << (ACOS_TABLE_DATA_BITS - 1)) - 1) @@ -105,107 +105,107 @@ dump_table_summary(void); extern int compute_table(void) { - uint32_t i; - float f; - FILE *acos_table_file; - size_t res; + uint32_t i; + float f; + FILE *acos_table_file; + size_t res; - acos_table_file = fopen(ACOS_TABLE_FILENAME, "w"); + acos_table_file = fopen(ACOS_TABLE_FILENAME, "w"); - for (i = 0; i < ACOS_TABLE_LENGTH; i++) { - f = acosf(float_from_index(i)); - res = fwrite(&f, sizeof(f), 1, acos_table_file); - if (res != 1) { - goto fail; - } - } + for (i = 0; i < ACOS_TABLE_LENGTH; i++) { + f = acosf(float_from_index(i)); + res = fwrite(&f, sizeof(f), 1, acos_table_file); + if (res != 1) { + goto fail; + } + } - res = fclose(acos_table_file); - if (res != 0) { - return -2; - } - return 0; + res = fclose(acos_table_file); + if (res != 0) { + return -2; + } + return 0; fail: - fclose(acos_table_file); - return -1; + fclose(acos_table_file); + return -1; } extern int init_fast_acosf(void) { - int ret, errsv; - FILE *acos_fp; - char err[150]; + int ret, errsv; + FILE *acos_fp; + char err[150]; - if (acos_table == NULL) { - ret = access(ACOS_TABLE_FILENAME, F_OK); - if (ret == -1) { - /* file doesn't exist, bad permissions, - * or some other error occured */ - errsv = errno; - strerror_r(errsv, err, 150); - if (errsv != ENOENT) return -1; - else { - switch_log_printf( - SWITCH_CHANNEL_LOG, - SWITCH_LOG_NOTICE, - "File [%s] doesn't exist. Creating file...\n", ACOS_TABLE_FILENAME - ); - ret = compute_table(); - if (ret != 0) return -2; - } - } else { - switch_log_printf( - SWITCH_CHANNEL_LOG, - SWITCH_LOG_INFO, - "Using previously created file [%s]\n", ACOS_TABLE_FILENAME - ); - } - } + if (acos_table == NULL) { + ret = access(ACOS_TABLE_FILENAME, F_OK); + if (ret == -1) { + /* file doesn't exist, bad permissions, + * or some other error occured */ + errsv = errno; + strerror_r(errsv, err, 150); + if (errsv != ENOENT) return -1; + else { + switch_log_printf( + SWITCH_CHANNEL_LOG, + SWITCH_LOG_NOTICE, + "File [%s] doesn't exist. Creating file...\n", ACOS_TABLE_FILENAME + ); + ret = compute_table(); + if (ret != 0) return -2; + } + } else { + switch_log_printf( + SWITCH_CHANNEL_LOG, + SWITCH_LOG_INFO, + "Using previously created file [%s]\n", ACOS_TABLE_FILENAME + ); + } + } - acos_fp = fopen(ACOS_TABLE_FILENAME, "r"); - if (acos_fp == NULL) return -3; - /* can't fail */ - acos_fd = fileno(acos_fp); - acos_table = (float *) mmap( - NULL, /* kernel chooses the address at which to create the mapping */ - ACOS_TABLE_LENGTH * sizeof(float), PROT_READ, MAP_SHARED, acos_fd, 0); - if (acos_table == MAP_FAILED) return -4; + acos_fp = fopen(ACOS_TABLE_FILENAME, "r"); + if (acos_fp == NULL) return -3; + /* can't fail */ + acos_fd = fileno(acos_fp); + acos_table = (float *) mmap( + NULL, /* kernel chooses the address at which to create the mapping */ + ACOS_TABLE_LENGTH * sizeof(float), PROT_READ, MAP_SHARED, acos_fd, 0); + if (acos_table == MAP_FAILED) return -4; - return 0; + return 0; } extern int destroy_fast_acosf(void) { - if (munmap(acos_table, ACOS_TABLE_LENGTH) == -1) return -1; - if (acos_fd != -1) { - if (close(acos_fd) == -1) return -2; - } - /* disable use of fast arc cosine file */ - acos_table = NULL; + if (munmap(acos_table, ACOS_TABLE_LENGTH) == -1) return -1; + if (acos_fd != -1) { + if (close(acos_fd) == -1) return -2; + } + /* disable use of fast arc cosine file */ + acos_table = NULL; - return 0; + return 0; } extern float fast_acosf(float x) { - return acos_table[index_from_float(x)]; + return acos_table[index_from_float(x)]; } static uint32_t index_from_float(float f) { - float_conv_t d; - d.f = f; - return ((d.i & SIGN_MASK) >> (32 - ACOS_TABLE_DATA_BITS)) | - ((d.i & DATA_MASK) >> ACOS_TABLE_DISCARDED_BITS); + float_conv_t d; + d.f = f; + return ((d.i & SIGN_MASK) >> (32 - ACOS_TABLE_DATA_BITS)) | + ((d.i & DATA_MASK) >> ACOS_TABLE_DISCARDED_BITS); } static float float_from_index(uint32_t d) { - float_conv_t f; - f.i = ((d & SIGN_UNPACK_MASK) << (32 - ACOS_TABLE_DATA_BITS)) | - ((d & DATA_UNPACK_MASK) << ACOS_TABLE_DISCARDED_BITS) | CONST_DATA_MASK; - return f.f; + float_conv_t f; + f.i = ((d & SIGN_UNPACK_MASK) << (32 - ACOS_TABLE_DATA_BITS)) | + ((d & DATA_UNPACK_MASK) << ACOS_TABLE_DISCARDED_BITS) | CONST_DATA_MASK; + return f.f; } #ifdef FAST_ACOSF_TESTING @@ -216,111 +216,111 @@ static float float_from_index(uint32_t d) static void debug_print(void) { - INF(ACOS_TABLE_CONST_EXPONENT); - INF(ACOS_TABLE_CONST_EXPONENT_BITS); - INF(ACOS_TABLE_FREE_EXPONENT_BITS); - INF(ACOS_TABLE_DISCARDED_BITS); - INF(ACOS_TABLE_DATA_BITS); - INF(ACOS_TABLE_LENGTH); - INFX(VARIA_DATA_MASK); - INFX(CONST_DATA_MASK); - INFX(SIGN_UNPACK_MASK); - INFX(DATA_UNPACK_MASK); - INFX(SIGN_MASK); - INFX(DATA_MASK); + INF(ACOS_TABLE_CONST_EXPONENT); + INF(ACOS_TABLE_CONST_EXPONENT_BITS); + INF(ACOS_TABLE_FREE_EXPONENT_BITS); + INF(ACOS_TABLE_DISCARDED_BITS); + INF(ACOS_TABLE_DATA_BITS); + INF(ACOS_TABLE_LENGTH); + INFX(VARIA_DATA_MASK); + INFX(CONST_DATA_MASK); + INFX(SIGN_UNPACK_MASK); + INFX(DATA_UNPACK_MASK); + INFX(SIGN_MASK); + INFX(DATA_MASK); } static void dump_table_summary(void) { - uint32_t i, i_0, i_1, di; - float f; + uint32_t i, i_0, i_1, di; + float f; - i = 1; - i_0 = index_from_float(0.0); - i_1 = index_from_float(1.0); - di = (i_1 - i_0)/100; - if (di == 0) di = 1; + i = 1; + i_0 = index_from_float(0.0); + i_1 = index_from_float(1.0); + di = (i_1 - i_0)/100; + if (di == 0) di = 1; - for (; i < ACOS_TABLE_LENGTH; i += di ) - { - f = float_from_index(i); - printf("-01i[%.10u] : ffi[%f] fa[%f] acos[%f]\n", - i, f, fast_acosf(f), acos(f)); - } + for (; i < ACOS_TABLE_LENGTH; i += di ) + { + f = float_from_index(i); + printf("-01i[%.10u] : ffi[%f] fa[%f] acos[%f]\n", + i, f, fast_acosf(f), acos(f)); + } - i = 1; - for (; i < ACOS_TABLE_LENGTH; i = (i << 1)) - { - f = fast_acosf(float_from_index(i)); - printf("--i[%.10u] : fa[%f] ffi[%f]\n", - i, f, float_from_index(i)); - } + i = 1; + for (; i < ACOS_TABLE_LENGTH; i = (i << 1)) + { + f = fast_acosf(float_from_index(i)); + printf("--i[%.10u] : fa[%f] ffi[%f]\n", + i, f, float_from_index(i)); + } - f = 0.0; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.1; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.2; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.3; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.4; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.5; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.6; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.7; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 7.5; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.8; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.9; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.95; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.99; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 1.0; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 1.1; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 1.2; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = 0.0; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.1; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.2; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.3; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.4; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.5; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.6; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.7; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -7.5; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.8; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.9; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.95; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -0.99; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -1.0; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -1.1; - printf("i [%d] from float [%f]\n", index_from_float(f), f); - f = -1.2; - printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.0; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.1; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.2; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.3; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.4; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.5; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.6; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.7; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 7.5; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.8; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.9; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.95; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.99; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 1.0; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 1.1; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 1.2; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = 0.0; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.1; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.2; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.3; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.4; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.5; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.6; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.7; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -7.5; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.8; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.9; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.95; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -0.99; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -1.0; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -1.1; + printf("i [%d] from float [%f]\n", index_from_float(f), f); + f = -1.2; + printf("i [%d] from float [%f]\n", index_from_float(f), f); } #endif /* FAST_ACOSF_TESTING */ diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.h b/src/mod/applications/mod_avmd/avmd_fast_acosf.h index 8de7954def..93e43ba438 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.h +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.h @@ -5,7 +5,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ diff --git a/src/mod/applications/mod_avmd/avmd_fir.h b/src/mod/applications/mod_avmd/avmd_fir.h index 25a2c23bb3..12dd1019ae 100644 --- a/src/mod/applications/mod_avmd/avmd_fir.h +++ b/src/mod/applications/mod_avmd/avmd_fir.h @@ -3,9 +3,9 @@ * * Contributor(s): * - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> * - * @date 23 Mar 2016 + * @date 23 Mar 2016 */ @@ -15,7 +15,7 @@ #define AVMD_MAX(a, b) (a) > (b) ? (a) : (b) #define AVMD_MEDIAN_FILTER(a, b, c) (a) > (b) ? ((a) > (c) ? \ - AVMD_MAX((b), (c)) : a) : ((b) > (c) ? AVMD_MAX((a), (c)) : (b)) + AVMD_MAX((b), (c)) : a) : ((b) > (c) ? AVMD_MAX((a), (c)) : (b)) #endif diff --git a/src/mod/applications/mod_avmd/avmd_goertzel.c b/src/mod/applications/mod_avmd/avmd_goertzel.c index 5f05c00b22..15650397bc 100644 --- a/src/mod/applications/mod_avmd/avmd_goertzel.c +++ b/src/mod/applications/mod_avmd/avmd_goertzel.c @@ -8,30 +8,30 @@ #include <math.h> #ifndef __AVMD_GOERTZEL_H__ - #include "avmd_goertzel.h" + #include "avmd_goertzel.h" #endif #ifndef __AVMD_BUFFER_H__ - #include "avmd_buffer.h" + #include "avmd_buffer.h" #endif extern double avmd_goertzel(circ_buffer_t *b, size_t pos, double f, size_t num) { - double s = 0.0; - double p = 0.0; - double p2 = 0.0; - double coeff; - size_t i; + double s = 0.0; + double p = 0.0; + double p2 = 0.0; + double coeff; + size_t i; - coeff = 2.0 * cos(2.0 * M_PI * f); + coeff = 2.0 * cos(2.0 * M_PI * f); - for (i = 0; i < num; i++) { - /* TODO: optimize to avoid GET_SAMPLE when possible */ - s = GET_SAMPLE(b, i + pos) + (coeff * p) - p2; - p2 = p; - p = s; - } + for (i = 0; i < num; i++) { + /* TODO: optimize to avoid GET_SAMPLE when possible */ + s = GET_SAMPLE(b, i + pos) + (coeff * p) - p2; + p2 = p; + p = s; + } - return (p2 * p2) + (p * p) - (coeff * p2 * p); + return (p2 * p2) + (p * p) - (coeff * p2 * p); } diff --git a/src/mod/applications/mod_avmd/avmd_goertzel.h b/src/mod/applications/mod_avmd/avmd_goertzel.h index 21ba3f5154..be7920c933 100644 --- a/src/mod/applications/mod_avmd/avmd_goertzel.h +++ b/src/mod/applications/mod_avmd/avmd_goertzel.h @@ -12,14 +12,14 @@ #ifndef _MSC_VER - #include <stdint.h> + #include <stdint.h> #endif #include "avmd_buffer.h" #if !defined(M_PI) - /* C99 systems may not define M_PI */ - #define M_PI 3.14159265358979323846264338327 + /* C99 systems may not define M_PI */ + #define M_PI 3.14159265358979323846264338327 #endif diff --git a/src/mod/applications/mod_avmd/avmd_options.h b/src/mod/applications/mod_avmd/avmd_options.h index a580af811e..f1c23dcc55 100644 --- a/src/mod/applications/mod_avmd/avmd_options.h +++ b/src/mod/applications/mod_avmd/avmd_options.h @@ -5,7 +5,7 @@ * * Contributor(s): * - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ diff --git a/src/mod/applications/mod_avmd/avmd_psi.h b/src/mod/applications/mod_avmd/avmd_psi.h index dbbf401282..49f22090a9 100644 --- a/src/mod/applications/mod_avmd/avmd_psi.h +++ b/src/mod/applications/mod_avmd/avmd_psi.h @@ -2,7 +2,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ diff --git a/src/mod/applications/mod_avmd/avmd_sma_buf.h b/src/mod/applications/mod_avmd/avmd_sma_buf.h index e3051c9731..0ee1aa5a9e 100644 --- a/src/mod/applications/mod_avmd/avmd_sma_buf.h +++ b/src/mod/applications/mod_avmd/avmd_sma_buf.h @@ -4,7 +4,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> */ @@ -22,22 +22,22 @@ #include "avmd_buffer.h" typedef struct { - size_t len; - BUFF_TYPE *data; - BUFF_TYPE sma; - size_t pos; - size_t lpos; + size_t len; + BUFF_TYPE *data; + BUFF_TYPE sma; + size_t pos; + size_t lpos; } sma_buffer_t; #define INIT_SMA_BUFFER(b, l, s) \ - { \ + { \ (void)memset((b), 0, sizeof(sma_buffer_t)); \ (b)->len = (l); \ (b)->data = (BUFF_TYPE *)switch_core_session_alloc((s), sizeof(BUFF_TYPE) * (l)); \ (b)->sma = 0.0; \ (b)->pos = 0; \ (b)->lpos = 0; \ - } + } #define GET_SMA_SAMPLE(b, p) ((b)->data[(p) % (b)->len]) #define SET_SMA_SAMPLE(b, p, v) ((b)->data[(p) % (b)->len] = (v)) @@ -45,33 +45,33 @@ typedef struct { #define GET_CURRENT_SMA_LPOS(b) ((b)->lpos) #define INC_SMA_POS(b) \ - { \ + { \ ((b)->lpos + 1 < 2 * (b)->len) ? ((b)->lpos++) : ((b)->lpos = (b)->len); \ (b)->pos = (b)->lpos % (b)->len; \ - } + } #define APPEND_SMA_VAL(b, v) \ - { \ + { \ (b)->sma -= ((b)->data[(b)->pos] / (BUFF_TYPE)(b)->len); \ (b)->data[(b)->pos] = (v); \ (((b)->lpos) >= ((b)->len)) ? ((b)->sma += ((b)->data[(b)->pos] / (BUFF_TYPE)(b)->len)) : \ - ((b)->sma = ((((b)->sma)*((b)->pos)) + ((b)->data[(b)->pos])) / ((BUFF_TYPE)(((b)->pos) + 1))) ; \ + ((b)->sma = ((((b)->sma)*((b)->pos)) + ((b)->data[(b)->pos])) / ((BUFF_TYPE)(((b)->pos) + 1))) ; \ INC_SMA_POS(b); \ - } + } #define RESET_SMA_BUFFER(b) \ - { \ + { \ (b)->sma = 0.0; \ (void)memset((b)->data, 0, sizeof(BUFF_TYPE) * (b)->len); \ (b)->pos = 0; \ (b)->lpos = 0; \ - } + } /* #define DESTROY_SMA_BUFFER(b) \ - do{ \ + do{ \ free((b)->data); \ - }while(0); + }while(0); */ @@ -83,19 +83,19 @@ typedef struct { int main(void) { - int i; - sma_buffer_t b; + int i; + sma_buffer_t b; - INIT_SMA_BUFFER(&b, 100); + INIT_SMA_BUFFER(&b, 100); - for(i = 0; i < 20; i++){ + for(i = 0; i < 20; i++){ APPEND_SMA_VAL(&b, 100.0); printf("SMA = %lf\n", b.sma); - } + } - DESTROY_SMA_BUFFER(&b); + DESTROY_SMA_BUFFER(&b); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } */ diff --git a/src/mod/applications/mod_avmd/conf/autoload_configs/avmd.conf.xml b/src/mod/applications/mod_avmd/conf/autoload_configs/avmd.conf.xml index 86b2500bad..cfd710f530 100644 --- a/src/mod/applications/mod_avmd/conf/autoload_configs/avmd.conf.xml +++ b/src/mod/applications/mod_avmd/conf/autoload_configs/avmd.conf.xml @@ -1,74 +1,74 @@ <configuration name="avmd.conf" description="AVMD config"> - <settings> + <settings> - <!-- Edit these settings to change default behaviour - of each avmd session. Settings can be overwritten - by values passed dynamically per each session --> + <!-- Edit these settings to change default behaviour + of each avmd session. Settings can be overwritten + by values passed dynamically per each session --> - <!-- Global settings --> + <!-- Global settings --> - <!-- define/undefine this to enable/disable logging of avmd - intermediate computations to log --> - <param name="debug" value="0"/> + <!-- define/undefine this to enable/disable logging of avmd + intermediate computations to log --> + <param name="debug" value="0"/> - <!-- define/undef this to enable/disable verbose logging (and reporting to the console) - of detection status and other diagnostics like parameters avmd session has been started with, - change of configuration parameters, beep detection status after session ended - (stop event is fired independently of this setting and beep status included there) --> - <param name="report_status" value="1"/> + <!-- define/undef this to enable/disable verbose logging (and reporting to the console) + of detection status and other diagnostics like parameters avmd session has been started with, + change of configuration parameters, beep detection status after session ended + (stop event is fired independently of this setting and beep status included there) --> + <param name="report_status" value="1"/> - <!-- define/undefine this to enable/disable faster computation - of arcus cosine - table will be created mapping floats - to integers and returning arc cos values given these integer - indices into table --> - <param name="fast_math" value="0"/> - <!-- Global settings end --> + <!-- define/undefine this to enable/disable faster computation + of arcus cosine - table will be created mapping floats + to integers and returning arc cos values given these integer + indices into table --> + <param name="fast_math" value="0"/> + <!-- Global settings end --> - <!-- Per call (session) settings. These settings can be overwritten - with custom/different values per each avmd session --> + <!-- Per call (session) settings. These settings can be overwritten + with custom/different values per each avmd session --> - <!-- define/undefine this to classify avmd beep detection as valid - only when there is required number of consecutive elements - in the SMA buffer without reset --> - <param name="require_continuous_streak" value="1"/> + <!-- define/undefine this to classify avmd beep detection as valid + only when there is required number of consecutive elements + in the SMA buffer without reset --> + <param name="require_continuous_streak" value="1"/> - <!-- required number of consecutive elements in the SMA buffer - without reset. This parameter helps to avoid false beeps, bigger this value is - smaller the probability of getting false detection --> - <param name="sample_n_continuous_streak" value="3"/> + <!-- required number of consecutive elements in the SMA buffer + without reset. This parameter helps to avoid false beeps, bigger this value is + smaller the probability of getting false detection --> + <param name="sample_n_continuous_streak" value="3"/> - <!-- define number of samples to skip starting from the beginning - of the frame and/or after reset has happened. This serves the purpose of skipping first few - estimations on each frame, as these estimations may be inaccurate. This parameter also helps - to give more robust detections when it's value is increased (up to scertain limit of about 60). --> - <param name="sample_n_to_skip" value="0"/> + <!-- define number of samples to skip starting from the beginning + of the frame and/or after reset has happened. This serves the purpose of skipping first few + estimations on each frame, as these estimations may be inaccurate. This parameter also helps + to give more robust detections when it's value is increased (up to scertain limit of about 60). --> + <param name="sample_n_to_skip" value="0"/> - <param name="require_continuous_streak_amp" value="1"/> - <param name="sample_n_continuous_streak_amp" value="3"/> + <param name="require_continuous_streak_amp" value="1"/> + <param name="sample_n_continuous_streak_amp" value="3"/> - <!-- define/undefine this to enable/disable simplified estimation - of frequency based on approximation of sin(x) with (x) - in the range x=[0,PI/2] --> - <param name="simplified_estimation" value="1"/> + <!-- define/undefine this to enable/disable simplified estimation + of frequency based on approximation of sin(x) with (x) + in the range x=[0,PI/2] --> + <param name="simplified_estimation" value="1"/> - <!-- define/undefine to enable/disable avmd on internal channel --> - <param name="inbound_channel" value="0"/> + <!-- define/undefine to enable/disable avmd on internal channel --> + <param name="inbound_channel" value="0"/> - <!-- define/undefine to enable/disable avmd on external channel --> - <param name="outbound_channel" value="1"/> + <!-- define/undefine to enable/disable avmd on external channel --> + <param name="outbound_channel" value="1"/> - <!-- determines the mode of detection, default is both amplitude and frequency --> - <param name="detection_mode" value="2"/> + <!-- determines the mode of detection, default is both amplitude and frequency --> + <param name="detection_mode" value="2"/> - <!-- number of detection threads running per each avmd session --> - <param name="detectors_n" value="36"/> + <!-- number of detection threads running per each avmd session --> + <param name="detectors_n" value="36"/> - <!-- number of lagged detection threads running per each avmd session --> - <param name="detectors_lagged_n" value="1"/> + <!-- number of lagged detection threads running per each avmd session --> + <param name="detectors_lagged_n" value="1"/> - <!-- Per call settings end --> - </settings> + <!-- Per call settings end --> + </settings> </configuration> diff --git a/src/mod/applications/mod_avmd/conf/avmd_test_dialplan.xml b/src/mod/applications/mod_avmd/conf/avmd_test_dialplan.xml index de567a8350..2a85ec7a60 100644 --- a/src/mod/applications/mod_avmd/conf/avmd_test_dialplan.xml +++ b/src/mod/applications/mod_avmd/conf/avmd_test_dialplan.xml @@ -1,840 +1,840 @@ - <extension name="1701"> - <condition field="destination_number" expression="^1701$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="voicemail/sin1000hz.raw"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="1702"> - <condition field="destination_number" expression="^1702$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="voicemail/sin1200hz.raw"/> - <action application="hangup"/> - <action application="avmd" data="stop"/> - </condition> - </extension> - <extension name="1703"> - <condition field="destination_number" expression="^1703$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="voicemail/sin1400hz.raw"/> - <action application="hangup"/> - <action application="avmd_stop"/> - </condition> - </extension> - <extension name="1704"> - <condition field="destination_number" expression="^1704$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="voicemail/8000/sin1600hz.raw"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> + <extension name="1701"> + <condition field="destination_number" expression="^1701$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="voicemail/sin1000hz.raw"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="1702"> + <condition field="destination_number" expression="^1702$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="voicemail/sin1200hz.raw"/> + <action application="hangup"/> + <action application="avmd" data="stop"/> + </condition> + </extension> + <extension name="1703"> + <condition field="destination_number" expression="^1703$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="voicemail/sin1400hz.raw"/> + <action application="hangup"/> + <action application="avmd_stop"/> + </condition> + </extension> + <extension name="1704"> + <condition field="destination_number" expression="^1704$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="voicemail/8000/sin1600hz.raw"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> - <extension name="503"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(503)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,400,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="504"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(504)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,500,600)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="505"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(505)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,600,700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="506"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(506)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,700,800)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="507"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(507)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,800,900)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="508"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(508)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,900,1000)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="509"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(509)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1100)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="510"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(510)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1100,1200)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="511"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(511)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1200,1300)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="512"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(512)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1300,1400)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="513"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(513)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1400,1500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="514"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(514)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,1600)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="515"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(515)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1600,1700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="516"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(516)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1700,1800)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="517"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(517)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1800,1900)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="518"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(518)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1900,1950)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="519"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(519)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,200,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="520"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(520)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,500,700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="521"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(521)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,100,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="522"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(522)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="523"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(523)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,2000)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> + <extension name="503"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(503)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,400,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="504"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(504)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,500,600)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="505"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(505)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,600,700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="506"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(506)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,700,800)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="507"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(507)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,800,900)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="508"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(508)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,900,1000)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="509"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(509)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1100)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="510"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(510)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1100,1200)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="511"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(511)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1200,1300)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="512"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(512)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1300,1400)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="513"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(513)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1400,1500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="514"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(514)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,1600)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="515"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(515)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1600,1700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="516"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(516)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1700,1800)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="517"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(517)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1800,1900)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="518"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(518)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1900,1950)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="519"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(519)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,200,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="520"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(520)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,500,700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="521"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(521)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,100,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="522"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(522)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="523"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(523)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=0"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,2000)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> - <extension name="603"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(603)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,400,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="604"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(604)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,500,600)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="605"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(605)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,600,700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="606"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(606)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,700,800)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="607"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(607)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,800,900)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="608"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(608)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,900,1000)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="609"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(609)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1100)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="610"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(610)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1100,1200)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="611"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(611)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1200,1300)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="612"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(612)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1300,1400)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="613"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(613)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1400,1500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="614"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(614)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,1600)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="615"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(615)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1600,1700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="616"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(616)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1700,1800)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="617"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(617)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1800,1900)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="618"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(618)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1900,1950)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="619"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(619)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,200,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="620"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(620)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,500,700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="621"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(621)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,100,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="622"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(622)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="623"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(623)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,2000)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> + <extension name="603"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(603)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,400,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="604"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(604)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,500,600)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="605"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(605)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,600,700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="606"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(606)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,700,800)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="607"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(607)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,800,900)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="608"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(608)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,900,1000)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="609"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(609)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1100)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="610"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(610)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1100,1200)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="611"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(611)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1200,1300)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="612"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(612)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1300,1400)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="613"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(613)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1400,1500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="614"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(614)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,1600)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="615"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(615)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1600,1700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="616"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(616)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1700,1800)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="617"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(617)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1800,1900)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="618"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(618)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1900,1950)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="619"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(619)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,200,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="620"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(620)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,500,700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="621"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(621)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,100,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="622"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(622)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="623"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(623)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=1"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,2000)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> - <extension name="703"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(703)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,400,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="704"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(704)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,500,600)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="705"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(705)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,600,700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="706"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(706)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,700,800)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="707"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(707)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,800,900)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="708"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(708)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,900,1000)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="709"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(709)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1100)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="710"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(710)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1100,1200)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="711"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(711)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1200,1300)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="712"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(712)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1300,1400)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="713"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(713)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1400,1500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="714"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(714)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,1600)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="715"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(715)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1600,1700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="716"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(716)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1700,1800)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="717"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(717)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1800,1900)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="718"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(718)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1900,1950)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="719"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(719)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,200,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="720"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(720)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,500,700)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="721"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(721)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,100,500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="722"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(722)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1500)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="723"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> - <condition field="destination_number" expression="^(723)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> - <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,2000)" /> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> + <extension name="703"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(703)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,400,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="704"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(704)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,500,600)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="705"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(705)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,600,700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="706"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(706)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,700,800)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="707"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(707)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,800,900)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="708"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(708)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,900,1000)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="709"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(709)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1100)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="710"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(710)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1100,1200)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="711"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(711)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1200,1300)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="712"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(712)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1300,1400)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="713"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(713)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1400,1500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="714"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(714)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,1600)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="715"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(715)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1600,1700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="716"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(716)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1700,1800)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="717"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(717)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1800,1900)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="718"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(718)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1900,1950)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="719"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(719)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,200,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="720"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(720)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,500,700)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="721"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(721)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,100,500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="722"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(722)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1000,1500)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="723"><!-- this BEEP must be DETECETD in detection_mode 1 (FREQ), NOTDETECTED in detection_mode 0 (AMP) and 2 (BOTH) --> + <condition field="destination_number" expression="^(723)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,debug=0,detection_mode=2"/> + <action application="playback" data="tone_stream://L=1;%(1850,1000,1500,2000)" /> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> - <extension name="840531000"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531000)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/2086613157-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531001"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531001)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/2179185111-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531002"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531002)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/2539488697-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531003"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531003)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/2565910163-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531004"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531004)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/2679091031-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531005"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531005)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/2815939138-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531006"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531006)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/2819127763-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531007"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531007)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/3157668346-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531008"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531008)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/4064659099-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531009"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531009)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/6062255782-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531010"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531010)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/8477910425-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531011"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531011)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2"/> - <action application="playback" data="voicemail/8000/8508497121-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531012"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531012)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/8635280270-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531013"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531013)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2"/> - <action application="playback" data="voicemail/8000/9106390422-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531014"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531014)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2"/> - <action application="playback" data="voicemail/8000/9156332150-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> + <extension name="840531000"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531000)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/2086613157-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531001"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531001)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/2179185111-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531002"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531002)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/2539488697-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531003"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531003)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/2565910163-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531004"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531004)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/2679091031-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531005"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531005)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/2815939138-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531006"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531006)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/2819127763-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531007"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531007)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/3157668346-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531008"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531008)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/4064659099-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531009"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531009)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/6062255782-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531010"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531010)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/8477910425-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531011"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531011)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2"/> + <action application="playback" data="voicemail/8000/8508497121-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531012"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531012)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/8635280270-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531013"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531013)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2"/> + <action application="playback" data="voicemail/8000/9106390422-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531014"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531014)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2"/> + <action application="playback" data="voicemail/8000/9156332150-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> - <extension name="840531200"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531200)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/2086613157-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531201"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531201)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/2179185111-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531202"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531202)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/2539488697-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531203"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531203)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/2565910163-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531204"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531204)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/2679091031-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531205"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531205)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/2815939138-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531206"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531206)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/2819127763-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531207"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531207)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/3157668346-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531208"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531208)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/4064659099-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531209"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531209)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/6062255782-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531210"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531210)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/8477910425-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531211"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531211)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/8508497121-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531212"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531212)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/8635280270-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531213"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531213)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/9106390422-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531214"><!-- obscure voicemail --> - <condition field="destination_number" expression="^(840531214)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> - <action application="playback" data="voicemail/8000/9156332150-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> + <extension name="840531200"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531200)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/2086613157-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531201"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531201)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/2179185111-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531202"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531202)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/2539488697-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531203"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531203)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/2565910163-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531204"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531204)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/2679091031-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531205"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531205)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/2815939138-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531206"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531206)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/2819127763-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531207"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531207)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/3157668346-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531208"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531208)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/4064659099-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531209"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531209)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/6062255782-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531210"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531210)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/8477910425-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531211"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531211)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/8508497121-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531212"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531212)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/8635280270-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531213"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531213)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/9106390422-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531214"><!-- obscure voicemail --> + <condition field="destination_number" expression="^(840531214)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=1,debug=0"/> + <action application="playback" data="voicemail/8000/9156332150-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> - <extension name="840531400"><!-- obscure voicemail pack 2 --> - <condition field="destination_number" expression="^(840531400)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/2764944714-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531401"><!-- obscure voicemail pack 2 --> - <condition field="destination_number" expression="^(840531401)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/3054957758-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531402"><!-- obscure voicemail pack 2 --> - <condition field="destination_number" expression="^(840531402)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/5044810548-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531403"><!-- obscure voicemail pack 2 --> - <condition field="destination_number" expression="^(840531403)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/5852842171-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531404"><!-- obscure voicemail pack 2 --> - <condition field="destination_number" expression="^(840531404)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/5857330628-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> - <extension name="840531405"><!-- obscure voicemail pack 2 --> - <condition field="destination_number" expression="^(840531405)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/8702463704-18-15-bad.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> + <extension name="840531400"><!-- obscure voicemail pack 2 --> + <condition field="destination_number" expression="^(840531400)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/2764944714-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531401"><!-- obscure voicemail pack 2 --> + <condition field="destination_number" expression="^(840531401)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/3054957758-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531402"><!-- obscure voicemail pack 2 --> + <condition field="destination_number" expression="^(840531402)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/5044810548-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531403"><!-- obscure voicemail pack 2 --> + <condition field="destination_number" expression="^(840531403)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/5852842171-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531404"><!-- obscure voicemail pack 2 --> + <condition field="destination_number" expression="^(840531404)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/5857330628-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> + <extension name="840531405"><!-- obscure voicemail pack 2 --> + <condition field="destination_number" expression="^(840531405)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/8702463704-18-15-bad.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> - <extension name="840531051"><!-- fragment of "Save tonight" by Eagle-Eye Cherry covered by D-Lete-Funk-K --> - <condition field="destination_number" expression="^(840531051)$"> - <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> - <action application="playback" data="voicemail/8000/save_tonight_8000.wav"/> - <action application="avmd_stop"/> - <action application="hangup"/> - </condition> - </extension> + <extension name="840531051"><!-- fragment of "Save tonight" by Eagle-Eye Cherry covered by D-Lete-Funk-K --> + <condition field="destination_number" expression="^(840531051)$"> + <action application="avmd_start" data="inbound_channel=1,outbound_channel=0,detection_mode=2,debug=0"/> + <action application="playback" data="voicemail/8000/save_tonight_8000.wav"/> + <action application="avmd_stop"/> + <action application="hangup"/> + </condition> + </extension> diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index ea1c5f483a..dde3dfbf93 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -20,7 +20,7 @@ * Contributor(s): * * Eric des Courtis <eric.des.courtis@benbria.com> - * Piotr Gregor <piotrgregor@rsyncme.org> + * Piotr Gregor <piotrgregor@rsyncme.org> * * mod_avmd.c -- Advanced Voicemail Detection Module * @@ -39,14 +39,14 @@ #include <float.h> #ifdef WIN32 - #include <float.h> - #define ISNAN(x) (!!(_isnan(x))) - #define ISINF(x) (isinf(x)) + #include <float.h> + #define ISNAN(x) (!!(_isnan(x))) + #define ISINF(x) (isinf(x)) #else - int __isnan(double); + int __isnan(double); int __isinf(double); - #define ISNAN(x) (__isnan(x)) - #define ISINF(x) (__isinf(x)) + #define ISNAN(x) (__isnan(x)) + #define ISINF(x) (__isinf(x)) #endif #include "avmd_buffer.h" @@ -119,16 +119,16 @@ /* don't forget to update avmd_events_str table if you modify this */ enum avmd_event { - AVMD_EVENT_BEEP = 0, - AVMD_EVENT_SESSION_START = 1, - AVMD_EVENT_SESSION_STOP = 2 + AVMD_EVENT_BEEP = 0, + AVMD_EVENT_SESSION_START = 1, + AVMD_EVENT_SESSION_STOP = 2 }; /* This array MUST be NULL terminated! */ const char* avmd_events_str[] = { - [AVMD_EVENT_BEEP] = "avmd::beep", - [AVMD_EVENT_SESSION_START] = "avmd::start", - [AVMD_EVENT_SESSION_STOP] = "avmd::stop", - NULL /* MUST be last and always here */ + [AVMD_EVENT_BEEP] = "avmd::beep", + [AVMD_EVENT_SESSION_START] = "avmd::start", + [AVMD_EVENT_SESSION_STOP] = "avmd::stop", + NULL /* MUST be last and always here */ }; #define AVMD_CHAR_BUF_LEN 20u @@ -136,17 +136,17 @@ const char* avmd_events_str[] = { enum avmd_app { - AVMD_APP_START_APP = 0, - AVMD_APP_STOP_APP = 1, - AVMD_APP_START_FUNCTION = 2 /* deprecated since version 1.6.8 */ + AVMD_APP_START_APP = 0, + AVMD_APP_STOP_APP = 1, + AVMD_APP_START_FUNCTION = 2 /* deprecated since version 1.6.8 */ }; enum avmd_detection_mode { - AVMD_DETECT_AMP = 0, - AVMD_DETECT_FREQ = 1, - AVMD_DETECT_BOTH = 2, - AVMD_DETECT_NONE = 3 + AVMD_DETECT_AMP = 0, + AVMD_DETECT_FREQ = 1, + AVMD_DETECT_BOTH = 2, + AVMD_DETECT_NONE = 3 }; /* Prototypes */ @@ -159,92 +159,92 @@ SWITCH_STANDARD_APP(avmd_stop_app); SWITCH_STANDARD_APP(avmd_start_function); struct avmd_settings { - uint8_t debug; - uint8_t report_status; - uint8_t fast_math; - uint8_t require_continuous_streak; - uint16_t sample_n_continuous_streak; - uint16_t sample_n_to_skip; - uint8_t require_continuous_streak_amp; - uint16_t sample_n_continuous_streak_amp; - uint8_t simplified_estimation; - uint8_t inbound_channnel; - uint8_t outbound_channnel; - enum avmd_detection_mode mode; - uint8_t detectors_n; - uint8_t detectors_lagged_n; + uint8_t debug; + uint8_t report_status; + uint8_t fast_math; + uint8_t require_continuous_streak; + uint16_t sample_n_continuous_streak; + uint16_t sample_n_to_skip; + uint8_t require_continuous_streak_amp; + uint16_t sample_n_continuous_streak_amp; + uint8_t simplified_estimation; + uint8_t inbound_channnel; + uint8_t outbound_channnel; + enum avmd_detection_mode mode; + uint8_t detectors_n; + uint8_t detectors_lagged_n; }; /*! Status of the beep detection */ typedef enum { - BEEP_DETECTED, - BEEP_NOTDETECTED + BEEP_DETECTED, + BEEP_NOTDETECTED } avmd_beep_state_t; /*! Data related to the current status of the beep */ typedef struct { - avmd_beep_state_t beep_state; - size_t last_beep; + avmd_beep_state_t beep_state; + size_t last_beep; } avmd_state_t; struct avmd_session; typedef struct avmd_session avmd_session_t; struct avmd_buffer { - sma_buffer_t sma_b; - sma_buffer_t sqa_b; + sma_buffer_t sma_b; + sma_buffer_t sqa_b; - sma_buffer_t sma_b_fir; - sma_buffer_t sqa_b_fir; + sma_buffer_t sma_b_fir; + sma_buffer_t sqa_b_fir; - sma_buffer_t sma_amp_b; - sma_buffer_t sqa_amp_b; + sma_buffer_t sma_amp_b; + sma_buffer_t sqa_amp_b; - uint8_t resolution; - uint8_t offset; - double amplitude_max; - size_t samples_streak, samples_streak_amp; /* number of DESA samples in single streak without reset needed to validate SMA estimator */ + uint8_t resolution; + uint8_t offset; + double amplitude_max; + size_t samples_streak, samples_streak_amp; /* number of DESA samples in single streak without reset needed to validate SMA estimator */ }; struct avmd_detector { - switch_thread_t *thread; - switch_mutex_t *mutex; - uint8_t flag_processing_done; - uint8_t flag_should_exit; - enum avmd_detection_mode result; - switch_thread_cond_t *cond_start_processing; - struct avmd_buffer buffer; - avmd_session_t *s; - size_t samples; - uint8_t idx; - uint8_t lagged, lag; + switch_thread_t *thread; + switch_mutex_t *mutex; + uint8_t flag_processing_done; + uint8_t flag_should_exit; + enum avmd_detection_mode result; + switch_thread_cond_t *cond_start_processing; + struct avmd_buffer buffer; + avmd_session_t *s; + size_t samples; + uint8_t idx; + uint8_t lagged, lag; }; /*! Type that holds avmd detection session information. */ struct avmd_session { - switch_core_session_t *session; - switch_mutex_t *mutex; - struct avmd_settings settings; - uint32_t rate; - circ_buffer_t b; - size_t pos; - double f; - avmd_state_t state; - switch_time_t start_time, stop_time, detection_start_time, detection_stop_time; - size_t frame_n; - uint8_t frame_n_to_skip; + switch_core_session_t *session; + switch_mutex_t *mutex; + struct avmd_settings settings; + uint32_t rate; + circ_buffer_t b; + size_t pos; + double f; + avmd_state_t state; + switch_time_t start_time, stop_time, detection_start_time, detection_stop_time; + size_t frame_n; + uint8_t frame_n_to_skip; - switch_mutex_t *mutex_detectors_done; - switch_thread_cond_t *cond_detectors_done; - struct avmd_detector *detectors; + switch_mutex_t *mutex_detectors_done; + switch_thread_cond_t *cond_detectors_done; + struct avmd_detector *detectors; }; static struct avmd_globals { - switch_mutex_t *mutex; - struct avmd_settings settings; - switch_memory_pool_t *pool; - size_t session_n; + switch_mutex_t *mutex; + struct avmd_settings settings; + switch_memory_pool_t *pool; + size_t session_n; } avmd_globals; static void avmd_process(avmd_session_t *session, switch_frame_t *frame, uint8_t direction); @@ -255,7 +255,7 @@ static switch_status_t avmd_register_all_events(void); static void avmd_unregister_all_events(void); static void avmd_fire_event(enum avmd_event type, switch_core_session_t *fs_s, double freq, double v_freq, double amp, double v_amp, avmd_beep_state_t beep_status, uint8_t info, - switch_time_t detection_start_time, switch_time_t detection_stop_time, switch_time_t start_time, switch_time_t stop_time, uint8_t resolution, uint8_t offset, uint8_t idx); + switch_time_t detection_start_time, switch_time_t detection_stop_time, switch_time_t start_time, switch_time_t stop_time, uint8_t resolution, uint8_t offset, uint8_t idx); static enum avmd_detection_mode avmd_process_sample(avmd_session_t *s, circ_buffer_t *b, size_t sample_n, size_t pos, struct avmd_detector *d); @@ -286,9 +286,9 @@ static uint8_t avmd_detection_in_progress(avmd_session_t *s); static switch_status_t avmd_launch_threads(avmd_session_t *s) { - uint8_t idx; - struct avmd_detector *d; - switch_threadattr_t *thd_attr = NULL; + uint8_t idx; + struct avmd_detector *d; + switch_threadattr_t *thd_attr = NULL; idx = 0; while (idx < s->settings.detectors_n) { @@ -336,226 +336,226 @@ static switch_status_t avmd_launch_threads(avmd_session_t *s) { } static void avmd_join_threads(avmd_session_t *s) { - uint8_t idx; - struct avmd_detector *d; - switch_status_t status; + uint8_t idx; + struct avmd_detector *d; + switch_status_t status; - idx = 0; - while (idx < s->settings.detectors_n) { - d = &s->detectors[idx]; - switch_mutex_lock(d->mutex); - if (d->thread != NULL) { - d->flag_should_exit = 1; - d->samples = 0; - switch_thread_cond_signal(d->cond_start_processing); - switch_mutex_unlock(d->mutex); - switch_thread_join(&status, d->thread); - d->thread = NULL; - switch_mutex_destroy(d->mutex); - switch_thread_cond_destroy(d->cond_start_processing); - } else { - switch_mutex_unlock(d->mutex); - } - ++idx; - } - idx = 0; - while (idx < s->settings.detectors_lagged_n) { - d = &s->detectors[s->settings.detectors_n + idx]; - switch_mutex_lock(d->mutex); - if (d->thread != NULL) { - d->flag_should_exit = 1; - d->samples = 0; - switch_thread_cond_signal(d->cond_start_processing); - switch_mutex_unlock(d->mutex); - switch_thread_join(&status, d->thread); - d->thread = NULL; - switch_mutex_destroy(d->mutex); - switch_thread_cond_destroy(d->cond_start_processing); - } else { - switch_mutex_unlock(d->mutex); - } - ++idx; - } + idx = 0; + while (idx < s->settings.detectors_n) { + d = &s->detectors[idx]; + switch_mutex_lock(d->mutex); + if (d->thread != NULL) { + d->flag_should_exit = 1; + d->samples = 0; + switch_thread_cond_signal(d->cond_start_processing); + switch_mutex_unlock(d->mutex); + switch_thread_join(&status, d->thread); + d->thread = NULL; + switch_mutex_destroy(d->mutex); + switch_thread_cond_destroy(d->cond_start_processing); + } else { + switch_mutex_unlock(d->mutex); + } + ++idx; + } + idx = 0; + while (idx < s->settings.detectors_lagged_n) { + d = &s->detectors[s->settings.detectors_n + idx]; + switch_mutex_lock(d->mutex); + if (d->thread != NULL) { + d->flag_should_exit = 1; + d->samples = 0; + switch_thread_cond_signal(d->cond_start_processing); + switch_mutex_unlock(d->mutex); + switch_thread_join(&status, d->thread); + d->thread = NULL; + switch_mutex_destroy(d->mutex); + switch_thread_cond_destroy(d->cond_start_processing); + } else { + switch_mutex_unlock(d->mutex); + } + ++idx; + } } static switch_status_t avmd_init_buffer(struct avmd_buffer *b, size_t buf_sz, uint8_t resolution, uint8_t offset, switch_core_session_t *fs_session) { - INIT_SMA_BUFFER(&b->sma_b, buf_sz, fs_session); - if (b->sma_b.data == NULL) { - return SWITCH_STATUS_FALSE; - } - memset(b->sma_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); + INIT_SMA_BUFFER(&b->sma_b, buf_sz, fs_session); + if (b->sma_b.data == NULL) { + return SWITCH_STATUS_FALSE; + } + memset(b->sma_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); - INIT_SMA_BUFFER(&b->sqa_b, buf_sz, fs_session); - if (b->sqa_b.data == NULL) { - return SWITCH_STATUS_FALSE; - } - memset(b->sqa_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); + INIT_SMA_BUFFER(&b->sqa_b, buf_sz, fs_session); + if (b->sqa_b.data == NULL) { + return SWITCH_STATUS_FALSE; + } + memset(b->sqa_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); - INIT_SMA_BUFFER(&b->sma_b_fir, buf_sz, fs_session); - if (b->sma_b_fir.data == NULL) { - return SWITCH_STATUS_FALSE; - } - memset(b->sma_b_fir.data, 0, sizeof(BUFF_TYPE) * buf_sz); + INIT_SMA_BUFFER(&b->sma_b_fir, buf_sz, fs_session); + if (b->sma_b_fir.data == NULL) { + return SWITCH_STATUS_FALSE; + } + memset(b->sma_b_fir.data, 0, sizeof(BUFF_TYPE) * buf_sz); - INIT_SMA_BUFFER(&b->sqa_b_fir, buf_sz, fs_session); - if (b->sqa_b_fir.data == NULL) { - return SWITCH_STATUS_FALSE; - } - memset(b->sqa_b_fir.data, 0, sizeof(BUFF_TYPE) * buf_sz); + INIT_SMA_BUFFER(&b->sqa_b_fir, buf_sz, fs_session); + if (b->sqa_b_fir.data == NULL) { + return SWITCH_STATUS_FALSE; + } + memset(b->sqa_b_fir.data, 0, sizeof(BUFF_TYPE) * buf_sz); - INIT_SMA_BUFFER(&b->sma_amp_b, buf_sz, fs_session); - if (b->sma_amp_b.data == NULL) { - return SWITCH_STATUS_FALSE; - } - memset(b->sma_amp_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); + INIT_SMA_BUFFER(&b->sma_amp_b, buf_sz, fs_session); + if (b->sma_amp_b.data == NULL) { + return SWITCH_STATUS_FALSE; + } + memset(b->sma_amp_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); - INIT_SMA_BUFFER(&b->sqa_amp_b, buf_sz, fs_session); - if (b->sqa_amp_b.data == NULL) { - return SWITCH_STATUS_FALSE; - } - memset(b->sqa_amp_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); + INIT_SMA_BUFFER(&b->sqa_amp_b, buf_sz, fs_session); + if (b->sqa_amp_b.data == NULL) { + return SWITCH_STATUS_FALSE; + } + memset(b->sqa_amp_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); - b->amplitude_max = 0.0; - b->samples_streak = 0; - b->samples_streak_amp = 0; - b->resolution = resolution; - b->offset = offset; + b->amplitude_max = 0.0; + b->samples_streak = 0; + b->samples_streak_amp = 0; + b->resolution = resolution; + b->offset = offset; - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_SUCCESS; } -/*! \brief The avmd session data initialization function. - * @param avmd_session A reference to a avmd session. - * @param fs_session A reference to a FreeSWITCH session. +/*! \brief The avmd session data initialization function. + * @param avmd_session A reference to a avmd session. + * @param fs_session A reference to a FreeSWITCH session. * @details Avmd globals mutex must be locked. */ static switch_status_t init_avmd_session_data(avmd_session_t *avmd_session, switch_core_session_t *fs_session, switch_mutex_t *mutex) { - uint8_t idx, resolution, offset; - size_t buf_sz; - struct avmd_detector *d; - switch_status_t status = SWITCH_STATUS_SUCCESS; + uint8_t idx, resolution, offset; + size_t buf_sz; + struct avmd_detector *d; + switch_status_t status = SWITCH_STATUS_SUCCESS; - if (mutex != NULL) - { - switch_mutex_lock(mutex); - } + if (mutex != NULL) + { + switch_mutex_lock(mutex); + } - /*! This is a worst case sample rate estimate */ - avmd_session->rate = 48000; - INIT_CIRC_BUFFER(&avmd_session->b, (size_t) AVMD_BEEP_LEN(avmd_session->rate), (size_t) AVMD_FRAME_LEN(avmd_session->rate), fs_session); - if (avmd_session->b.buf == NULL) { - status = SWITCH_STATUS_MEMERR; - goto end; - } - avmd_session->session = fs_session; - avmd_session->pos = 0; - avmd_session->f = 0.0; - avmd_session->state.last_beep = 0; - avmd_session->state.beep_state = BEEP_NOTDETECTED; - switch_mutex_init(&avmd_session->mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(fs_session)); - avmd_session->frame_n = 0; - avmd_session->detection_start_time = 0; - avmd_session->detection_stop_time = 0; - avmd_session->frame_n_to_skip = 0; + /*! This is a worst case sample rate estimate */ + avmd_session->rate = 48000; + INIT_CIRC_BUFFER(&avmd_session->b, (size_t) AVMD_BEEP_LEN(avmd_session->rate), (size_t) AVMD_FRAME_LEN(avmd_session->rate), fs_session); + if (avmd_session->b.buf == NULL) { + status = SWITCH_STATUS_MEMERR; + goto end; + } + avmd_session->session = fs_session; + avmd_session->pos = 0; + avmd_session->f = 0.0; + avmd_session->state.last_beep = 0; + avmd_session->state.beep_state = BEEP_NOTDETECTED; + switch_mutex_init(&avmd_session->mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(fs_session)); + avmd_session->frame_n = 0; + avmd_session->detection_start_time = 0; + avmd_session->detection_stop_time = 0; + avmd_session->frame_n_to_skip = 0; - buf_sz = AVMD_BEEP_LEN((uint32_t)avmd_session->rate) / (uint32_t) AVMD_SINE_LEN(avmd_session->rate); - if (buf_sz < 1) { - status = SWITCH_STATUS_MORE_DATA; - goto end; - } - avmd_session->detectors = (struct avmd_detector*) switch_core_session_alloc(fs_session, (avmd_session->settings.detectors_n + avmd_session->settings.detectors_lagged_n) * sizeof(struct avmd_detector)); - if (avmd_session->detectors == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Can't allocate memory for avmd detectors!\n"); - status = SWITCH_STATUS_NOT_INITALIZED; - goto end; - } - idx = 0; - resolution = 0; - while (idx < avmd_session->settings.detectors_n) { - ++resolution; - offset = 0; - while ((offset < resolution) && (idx < avmd_session->settings.detectors_n)) { - d = &avmd_session->detectors[idx]; - if (avmd_init_buffer(&d->buffer, buf_sz, resolution, offset, fs_session) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto end; - } - d->s = avmd_session; - d->flag_processing_done = 1; - d->flag_should_exit = 1; - d->idx = idx; - d->thread = NULL; - switch_mutex_init(&d->mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(fs_session)); - switch_thread_cond_create(&d->cond_start_processing, switch_core_session_get_pool(fs_session)); - ++offset; - ++idx; - } - } - idx = 0; - resolution = 1; - offset = 0; - while (idx < avmd_session->settings.detectors_lagged_n) { - d = &avmd_session->detectors[avmd_session->settings.detectors_n + idx]; - if (avmd_init_buffer(&d->buffer, buf_sz, resolution, offset, fs_session) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto end; - } - d->s = avmd_session; - d->flag_processing_done = 1; - d->flag_should_exit = 1; - d->idx = avmd_session->settings.detectors_n + idx; - d->thread = NULL; - switch_mutex_init(&d->mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(fs_session)); - switch_thread_cond_create(&d->cond_start_processing, switch_core_session_get_pool(fs_session)); - ++idx; - } - switch_mutex_init(&avmd_session->mutex_detectors_done, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(fs_session)); - switch_thread_cond_create(&avmd_session->cond_detectors_done, switch_core_session_get_pool(fs_session)); + buf_sz = AVMD_BEEP_LEN((uint32_t)avmd_session->rate) / (uint32_t) AVMD_SINE_LEN(avmd_session->rate); + if (buf_sz < 1) { + status = SWITCH_STATUS_MORE_DATA; + goto end; + } + avmd_session->detectors = (struct avmd_detector*) switch_core_session_alloc(fs_session, (avmd_session->settings.detectors_n + avmd_session->settings.detectors_lagged_n) * sizeof(struct avmd_detector)); + if (avmd_session->detectors == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Can't allocate memory for avmd detectors!\n"); + status = SWITCH_STATUS_NOT_INITALIZED; + goto end; + } + idx = 0; + resolution = 0; + while (idx < avmd_session->settings.detectors_n) { + ++resolution; + offset = 0; + while ((offset < resolution) && (idx < avmd_session->settings.detectors_n)) { + d = &avmd_session->detectors[idx]; + if (avmd_init_buffer(&d->buffer, buf_sz, resolution, offset, fs_session) != SWITCH_STATUS_SUCCESS) { + status = SWITCH_STATUS_FALSE; + goto end; + } + d->s = avmd_session; + d->flag_processing_done = 1; + d->flag_should_exit = 1; + d->idx = idx; + d->thread = NULL; + switch_mutex_init(&d->mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(fs_session)); + switch_thread_cond_create(&d->cond_start_processing, switch_core_session_get_pool(fs_session)); + ++offset; + ++idx; + } + } + idx = 0; + resolution = 1; + offset = 0; + while (idx < avmd_session->settings.detectors_lagged_n) { + d = &avmd_session->detectors[avmd_session->settings.detectors_n + idx]; + if (avmd_init_buffer(&d->buffer, buf_sz, resolution, offset, fs_session) != SWITCH_STATUS_SUCCESS) { + status = SWITCH_STATUS_FALSE; + goto end; + } + d->s = avmd_session; + d->flag_processing_done = 1; + d->flag_should_exit = 1; + d->idx = avmd_session->settings.detectors_n + idx; + d->thread = NULL; + switch_mutex_init(&d->mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(fs_session)); + switch_thread_cond_create(&d->cond_start_processing, switch_core_session_get_pool(fs_session)); + ++idx; + } + switch_mutex_init(&avmd_session->mutex_detectors_done, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(fs_session)); + switch_thread_cond_create(&avmd_session->cond_detectors_done, switch_core_session_get_pool(fs_session)); end: - if (mutex != NULL) - { - switch_mutex_unlock(mutex); - } - return status; + if (mutex != NULL) + { + switch_mutex_unlock(mutex); + } + return status; } static void avmd_session_close(avmd_session_t *s) { - uint8_t idx; - struct avmd_detector *d; - switch_status_t status; + uint8_t idx; + struct avmd_detector *d; + switch_status_t status; - switch_mutex_lock(s->mutex); + switch_mutex_lock(s->mutex); - switch_mutex_lock(s->mutex_detectors_done); - while (avmd_detection_in_progress(s) == 1) { - switch_thread_cond_wait(s->cond_detectors_done, s->mutex_detectors_done); - } - switch_mutex_unlock(s->mutex_detectors_done); + switch_mutex_lock(s->mutex_detectors_done); + while (avmd_detection_in_progress(s) == 1) { + switch_thread_cond_wait(s->cond_detectors_done, s->mutex_detectors_done); + } + switch_mutex_unlock(s->mutex_detectors_done); - idx = 0; - while (idx < (s->settings.detectors_n + s->settings.detectors_lagged_n)) { - d = &s->detectors[idx]; - switch_mutex_lock(d->mutex); - d = &s->detectors[idx]; - d->flag_processing_done = 0; - d->flag_should_exit = 1; - d->samples = 0; - switch_thread_cond_signal(d->cond_start_processing); - switch_mutex_unlock(d->mutex); + idx = 0; + while (idx < (s->settings.detectors_n + s->settings.detectors_lagged_n)) { + d = &s->detectors[idx]; + switch_mutex_lock(d->mutex); + d = &s->detectors[idx]; + d->flag_processing_done = 0; + d->flag_should_exit = 1; + d->samples = 0; + switch_thread_cond_signal(d->cond_start_processing); + switch_mutex_unlock(d->mutex); - switch_thread_join(&status, d->thread); - d->thread = NULL; + switch_thread_join(&status, d->thread); + d->thread = NULL; - switch_mutex_destroy(d->mutex); - switch_thread_cond_destroy(d->cond_start_processing); - ++idx; - } - switch_mutex_unlock(s->mutex); - switch_mutex_destroy(s->mutex_detectors_done); - switch_thread_cond_destroy(s->cond_detectors_done); - switch_mutex_destroy(s->mutex); + switch_mutex_destroy(d->mutex); + switch_thread_cond_destroy(d->cond_start_processing); + ++idx; + } + switch_mutex_unlock(s->mutex); + switch_mutex_destroy(s->mutex_detectors_done); + switch_thread_cond_destroy(s->cond_detectors_done); + switch_mutex_destroy(s->mutex); } /*! \brief The callback function that is called when new audio data becomes available. @@ -565,321 +565,321 @@ static void avmd_session_close(avmd_session_t *s) { * @return The success or failure of the function. */ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, switch_abc_type_t type) { - avmd_session_t *avmd_session; - switch_codec_t *read_codec; - switch_codec_t *write_codec; - switch_frame_t *frame; - switch_core_session_t *fs_session; - switch_channel_t *channel = NULL; + avmd_session_t *avmd_session; + switch_codec_t *read_codec; + switch_codec_t *write_codec; + switch_frame_t *frame; + switch_core_session_t *fs_session; + switch_channel_t *channel = NULL; - avmd_session = (avmd_session_t *) user_data; - if (avmd_session == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No avmd session assigned!\n"); - return SWITCH_FALSE; - } - if ((type != SWITCH_ABC_TYPE_INIT) && (type != SWITCH_ABC_TYPE_CLOSE)) { - switch_mutex_lock(avmd_session->mutex); - } - fs_session = avmd_session->session; - if (fs_session == NULL) { - if (type != SWITCH_ABC_TYPE_INIT) { - switch_mutex_unlock(avmd_session->mutex); - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No FreeSWITCH session assigned!\n"); - return SWITCH_FALSE; - } + avmd_session = (avmd_session_t *) user_data; + if (avmd_session == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No avmd session assigned!\n"); + return SWITCH_FALSE; + } + if ((type != SWITCH_ABC_TYPE_INIT) && (type != SWITCH_ABC_TYPE_CLOSE)) { + switch_mutex_lock(avmd_session->mutex); + } + fs_session = avmd_session->session; + if (fs_session == NULL) { + if (type != SWITCH_ABC_TYPE_INIT) { + switch_mutex_unlock(avmd_session->mutex); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No FreeSWITCH session assigned!\n"); + return SWITCH_FALSE; + } - channel = switch_core_session_get_channel(fs_session); - if (channel == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No channel for FreeSWITCH session!\n"); - return SWITCH_FALSE; - } + channel = switch_core_session_get_channel(fs_session); + if (channel == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No channel for FreeSWITCH session!\n"); + return SWITCH_FALSE; + } - switch (type) { + switch (type) { - case SWITCH_ABC_TYPE_INIT: - if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_session->settings.outbound_channnel == 1)) { - read_codec = switch_core_session_get_read_codec(fs_session); - if (read_codec == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, "No read codec assigned, default session rate to 8000 samples/s\n"); - avmd_session->rate = 8000; - } else { - if (read_codec->implementation == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, "No read codec implementation assigned, default session rate to 8000 samples/s\n"); - avmd_session->rate = 8000; - } else { - avmd_session->rate = read_codec->implementation->samples_per_second; - } - } - } - if ((SWITCH_CALL_DIRECTION_INBOUND == switch_channel_direction(channel)) && (avmd_session->settings.inbound_channnel == 1)) { - write_codec = switch_core_session_get_write_codec(fs_session); - if (write_codec == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, "No write codec assigned, default session rate to 8000 samples/s\n"); - avmd_session->rate = 8000; - } else { - if (write_codec->implementation == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, "No write codec implementation assigned, default session rate to 8000 samples/s\n"); - avmd_session->rate = 8000; - } else { - avmd_session->rate = write_codec->implementation->samples_per_second; - } - } - } - avmd_session->start_time = switch_micro_time_now(); - /* avmd_session->vmd_codec.channels = read_codec->implementation->number_of_channels; */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session),SWITCH_LOG_INFO, "Avmd session initialized, [%u] samples/s\n", avmd_session->rate); - break; + case SWITCH_ABC_TYPE_INIT: + if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_session->settings.outbound_channnel == 1)) { + read_codec = switch_core_session_get_read_codec(fs_session); + if (read_codec == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, "No read codec assigned, default session rate to 8000 samples/s\n"); + avmd_session->rate = 8000; + } else { + if (read_codec->implementation == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, "No read codec implementation assigned, default session rate to 8000 samples/s\n"); + avmd_session->rate = 8000; + } else { + avmd_session->rate = read_codec->implementation->samples_per_second; + } + } + } + if ((SWITCH_CALL_DIRECTION_INBOUND == switch_channel_direction(channel)) && (avmd_session->settings.inbound_channnel == 1)) { + write_codec = switch_core_session_get_write_codec(fs_session); + if (write_codec == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, "No write codec assigned, default session rate to 8000 samples/s\n"); + avmd_session->rate = 8000; + } else { + if (write_codec->implementation == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, "No write codec implementation assigned, default session rate to 8000 samples/s\n"); + avmd_session->rate = 8000; + } else { + avmd_session->rate = write_codec->implementation->samples_per_second; + } + } + } + avmd_session->start_time = switch_micro_time_now(); + /* avmd_session->vmd_codec.channels = read_codec->implementation->number_of_channels; */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session),SWITCH_LOG_INFO, "Avmd session initialized, [%u] samples/s\n", avmd_session->rate); + break; - case SWITCH_ABC_TYPE_READ_REPLACE: - frame = switch_core_media_bug_get_read_replace_frame(bug); - avmd_process(avmd_session, frame, AVMD_READ_REPLACE); - break; + case SWITCH_ABC_TYPE_READ_REPLACE: + frame = switch_core_media_bug_get_read_replace_frame(bug); + avmd_process(avmd_session, frame, AVMD_READ_REPLACE); + break; - case SWITCH_ABC_TYPE_WRITE_REPLACE: - frame = switch_core_media_bug_get_write_replace_frame(bug); - avmd_process(avmd_session, frame, AVMD_WRITE_REPLACE); - break; + case SWITCH_ABC_TYPE_WRITE_REPLACE: + frame = switch_core_media_bug_get_write_replace_frame(bug); + avmd_process(avmd_session, frame, AVMD_WRITE_REPLACE); + break; - case SWITCH_ABC_TYPE_CLOSE: - avmd_session_close(avmd_session); + case SWITCH_ABC_TYPE_CLOSE: + avmd_session_close(avmd_session); switch_mutex_lock(avmd_globals.mutex); - if (avmd_globals.session_n > 0) { - --avmd_globals.session_n; - } + if (avmd_globals.session_n > 0) { + --avmd_globals.session_n; + } switch_mutex_unlock(avmd_globals.mutex); - break; + break; - default: - break; - } + default: + break; + } - if ((type != SWITCH_ABC_TYPE_INIT) && (type != SWITCH_ABC_TYPE_CLOSE)) { - switch_mutex_unlock(avmd_session->mutex); - } - return SWITCH_TRUE; + if ((type != SWITCH_ABC_TYPE_INIT) && (type != SWITCH_ABC_TYPE_CLOSE)) { + switch_mutex_unlock(avmd_session->mutex); + } + return SWITCH_TRUE; } static switch_status_t avmd_register_all_events(void) { - size_t idx = 0; - const char *e = avmd_events_str[0]; - while (e != NULL) - { - if (switch_event_reserve_subclass(e) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass [%s]!\n", e); - return SWITCH_STATUS_TERM; - } - ++idx; - e = avmd_events_str[idx]; - } - return SWITCH_STATUS_SUCCESS; + size_t idx = 0; + const char *e = avmd_events_str[0]; + while (e != NULL) + { + if (switch_event_reserve_subclass(e) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass [%s]!\n", e); + return SWITCH_STATUS_TERM; + } + ++idx; + e = avmd_events_str[idx]; + } + return SWITCH_STATUS_SUCCESS; } static void avmd_unregister_all_events(void) { - size_t idx = 0; - const char *e = avmd_events_str[0]; - while (e != NULL) - { - switch_event_free_subclass(e); - ++idx; - e = avmd_events_str[idx]; - } - return; + size_t idx = 0; + const char *e = avmd_events_str[0]; + while (e != NULL) + { + switch_event_free_subclass(e); + ++idx; + e = avmd_events_str[idx]; + } + return; } static void avmd_fire_event(enum avmd_event type, switch_core_session_t *fs_s, double freq, double v_freq, double amp, double v_amp, avmd_beep_state_t beep_status, uint8_t info, - switch_time_t detection_start_time, switch_time_t detection_stop_time, switch_time_t start_time, switch_time_t stop_time, uint8_t resolution, uint8_t offset, uint8_t idx) { - int res; - switch_event_t *event; - switch_time_t detection_time, total_time; - switch_status_t status; - switch_event_t *event_copy; - char buf[AVMD_CHAR_BUF_LEN]; + switch_time_t detection_start_time, switch_time_t detection_stop_time, switch_time_t start_time, switch_time_t stop_time, uint8_t resolution, uint8_t offset, uint8_t idx) { + int res; + switch_event_t *event; + switch_time_t detection_time, total_time; + switch_status_t status; + switch_event_t *event_copy; + char buf[AVMD_CHAR_BUF_LEN]; - status = switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, avmd_events_str[type]); - if (status != SWITCH_STATUS_SUCCESS) { - return; - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(fs_s)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-command", "avmd"); - switch (type) - { - case AVMD_EVENT_BEEP: - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", "DETECTED"); - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%f", freq); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Frequency truncated [%s], [%d] attempted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Frequency", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Frequency", buf); + status = switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, avmd_events_str[type]); + if (status != SWITCH_STATUS_SUCCESS) { + return; + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(fs_s)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-command", "avmd"); + switch (type) + { + case AVMD_EVENT_BEEP: + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", "DETECTED"); + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%f", freq); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Frequency truncated [%s], [%d] attempted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Frequency", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Frequency", buf); - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%f", v_freq); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Frequency-variance", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Frequency-variance", buf); + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%f", v_freq); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Frequency-variance", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Frequency-variance", buf); - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%f", amp); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Amplitude truncated [%s], [%d] attempted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Amplitude", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Amplitude", buf); + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%f", amp); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Amplitude truncated [%s], [%d] attempted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Amplitude", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Amplitude", buf); - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%f", v_amp); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Amplitude-variance", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Amplitude-variance", buf); + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%f", v_amp); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Amplitude-variance", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Amplitude-variance", buf); - detection_time = detection_stop_time - detection_start_time; - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%" PRId64 "", detection_time); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Detection time truncated [%s], [%d] attempted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detection-time", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detection-time", buf); + detection_time = detection_stop_time - detection_start_time; + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%" PRId64 "", detection_time); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Detection time truncated [%s], [%d] attempted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detection-time", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detection-time", buf); - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%u", resolution); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-resolution", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-resolution", buf); + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%u", resolution); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-resolution", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-resolution", buf); - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%u", offset); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-offset", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-offset", buf); + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%u", offset); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-offset", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-offset", buf); - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%u", idx); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-index", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-index", buf); - break; + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%u", idx); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-index", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-index", buf); + break; - case AVMD_EVENT_SESSION_START: - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%" PRId64 "", start_time); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Start time truncated [%s], [%d] attempted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Start-time", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Start-time", buf); - break; + case AVMD_EVENT_SESSION_START: + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%" PRId64 "", start_time); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Start time truncated [%s], [%d] attempted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Start-time", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Start-time", buf); + break; - case AVMD_EVENT_SESSION_STOP: - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", beep_status == BEEP_DETECTED ? "DETECTED" : "NOTDETECTED"); - if (info == 0) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Stop-status", "ERROR (AVMD SESSION OBJECT NOT FOUND IN MEDIA BUG)"); - } - total_time = stop_time - start_time; - res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%" PRId64 "", total_time); - if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Total time truncated [%s], [%d] attempted!\n", buf, res); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Total-time", "ERROR (TRUNCATED)"); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Total-time", buf); - break; + case AVMD_EVENT_SESSION_STOP: + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", beep_status == BEEP_DETECTED ? "DETECTED" : "NOTDETECTED"); + if (info == 0) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Stop-status", "ERROR (AVMD SESSION OBJECT NOT FOUND IN MEDIA BUG)"); + } + total_time = stop_time - start_time; + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%" PRId64 "", total_time); + if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Total time truncated [%s], [%d] attempted!\n", buf, res); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Total-time", "ERROR (TRUNCATED)"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Total-time", buf); + break; - default: - switch_event_destroy(&event); - return; - } + default: + switch_event_destroy(&event); + return; + } - if ((switch_event_dup(&event_copy, event)) != SWITCH_STATUS_SUCCESS) { - return; - } + if ((switch_event_dup(&event_copy, event)) != SWITCH_STATUS_SUCCESS) { + return; + } - switch_core_session_queue_event(fs_s, &event); - switch_event_fire(&event_copy); - return; + switch_core_session_queue_event(fs_s, &event); + switch_event_fire(&event_copy); + return; } int avmd_parse_u8_user_input(const char *input, uint8_t *output, uint8_t min, uint8_t max) { - char *pCh; - unsigned long helper; - helper = strtoul(input, &pCh, 10); - if (helper < min || helper > UINT8_MAX || helper > max || (pCh == input) || (*pCh != '\0')) { - return -1; - } - *output = (uint8_t) helper; - return 0; + char *pCh; + unsigned long helper; + helper = strtoul(input, &pCh, 10); + if (helper < min || helper > UINT8_MAX || helper > max || (pCh == input) || (*pCh != '\0')) { + return -1; + } + *output = (uint8_t) helper; + return 0; } int avmd_parse_u16_user_input(const char *input, uint16_t *output, uint16_t min, uint16_t max) { - char *pCh; - unsigned long helper; - if (min > max) { - return -1; - } - helper = strtoul(input, &pCh, 10); - if (helper < min || helper > UINT16_MAX || helper > max || (pCh == input) || (*pCh != '\0')) { - return -1; - } - *output = (uint16_t) helper; - return 0; + char *pCh; + unsigned long helper; + if (min > max) { + return -1; + } + helper = strtoul(input, &pCh, 10); + if (helper < min || helper > UINT16_MAX || helper > max || (pCh == input) || (*pCh != '\0')) { + return -1; + } + *output = (uint16_t) helper; + return 0; } static void avmd_set_xml_default_configuration(switch_mutex_t *mutex) { - if (mutex != NULL) { - switch_mutex_lock(mutex); - } + if (mutex != NULL) { + switch_mutex_lock(mutex); + } - avmd_globals.settings.debug = 0; - avmd_globals.settings.report_status = 1; - avmd_globals.settings.fast_math = 0; - avmd_globals.settings.require_continuous_streak = 1; - avmd_globals.settings.sample_n_continuous_streak = 3; - avmd_globals.settings.sample_n_to_skip = 0; - avmd_globals.settings.require_continuous_streak_amp = 1; - avmd_globals.settings.sample_n_continuous_streak_amp = 3; - avmd_globals.settings.simplified_estimation = 1; - avmd_globals.settings.inbound_channnel = 0; - avmd_globals.settings.outbound_channnel = 1; - avmd_globals.settings.mode = AVMD_DETECT_BOTH; - avmd_globals.settings.detectors_n = 36; - avmd_globals.settings.detectors_lagged_n = 1; + avmd_globals.settings.debug = 0; + avmd_globals.settings.report_status = 1; + avmd_globals.settings.fast_math = 0; + avmd_globals.settings.require_continuous_streak = 1; + avmd_globals.settings.sample_n_continuous_streak = 3; + avmd_globals.settings.sample_n_to_skip = 0; + avmd_globals.settings.require_continuous_streak_amp = 1; + avmd_globals.settings.sample_n_continuous_streak_amp = 3; + avmd_globals.settings.simplified_estimation = 1; + avmd_globals.settings.inbound_channnel = 0; + avmd_globals.settings.outbound_channnel = 1; + avmd_globals.settings.mode = AVMD_DETECT_BOTH; + avmd_globals.settings.detectors_n = 36; + avmd_globals.settings.detectors_lagged_n = 1; - if (mutex != NULL) { - switch_mutex_unlock(avmd_globals.mutex); - } - return; + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return; } static void avmd_set_xml_inbound_configuration(switch_mutex_t *mutex) { - if (mutex != NULL) { - switch_mutex_lock(mutex); - } + if (mutex != NULL) { + switch_mutex_lock(mutex); + } - avmd_globals.settings.inbound_channnel = 1; - avmd_globals.settings.outbound_channnel = 0; + avmd_globals.settings.inbound_channnel = 1; + avmd_globals.settings.outbound_channnel = 0; - if (mutex != NULL) { - switch_mutex_unlock(avmd_globals.mutex); - } - return; + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return; } static void avmd_set_xml_outbound_configuration(switch_mutex_t *mutex) { - if (mutex != NULL) { - switch_mutex_lock(mutex); - } + if (mutex != NULL) { + switch_mutex_lock(mutex); + } - avmd_globals.settings.inbound_channnel = 0; - avmd_globals.settings.outbound_channnel = 1; + avmd_globals.settings.inbound_channnel = 0; + avmd_globals.settings.outbound_channnel = 1; - if (mutex != NULL) { - switch_mutex_unlock(avmd_globals.mutex); - } - return; + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return; } static switch_status_t avmd_load_xml_configuration(switch_mutex_t *mutex) { @@ -1060,249 +1060,249 @@ static switch_status_t avmd_load_xml_configuration(switch_mutex_t *mutex) { } static switch_status_t avmd_load_xml_inbound_configuration(switch_mutex_t *mutex) { - if (avmd_load_xml_configuration(mutex) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_TERM; - } + if (avmd_load_xml_configuration(mutex) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_TERM; + } - if (mutex != NULL) { - switch_mutex_lock(mutex); - } + if (mutex != NULL) { + switch_mutex_lock(mutex); + } - avmd_globals.settings.inbound_channnel = 1; - avmd_globals.settings.outbound_channnel = 0; + avmd_globals.settings.inbound_channnel = 1; + avmd_globals.settings.outbound_channnel = 0; - if (mutex != NULL) { - switch_mutex_unlock(avmd_globals.mutex); - } - return SWITCH_STATUS_SUCCESS; + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return SWITCH_STATUS_SUCCESS; } static switch_status_t avmd_load_xml_outbound_configuration(switch_mutex_t *mutex) { - if (avmd_load_xml_configuration(mutex) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_TERM; - } + if (avmd_load_xml_configuration(mutex) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_TERM; + } - if (mutex != NULL) { - switch_mutex_lock(mutex); - } + if (mutex != NULL) { + switch_mutex_lock(mutex); + } - avmd_globals.settings.inbound_channnel = 0; - avmd_globals.settings.outbound_channnel = 1; + avmd_globals.settings.inbound_channnel = 0; + avmd_globals.settings.outbound_channnel = 1; - if (mutex != NULL) { - switch_mutex_unlock(avmd_globals.mutex); - } - return SWITCH_STATUS_SUCCESS; + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return SWITCH_STATUS_SUCCESS; } static void avmd_show(switch_stream_handle_t *stream, switch_mutex_t *mutex) { - const char *line = "================================================================================================="; - if (stream == NULL) { - return; - } + const char *line = "================================================================================================="; + if (stream == NULL) { + return; + } - if (mutex != NULL) { - switch_mutex_lock(mutex); - } + if (mutex != NULL) { + switch_mutex_lock(mutex); + } - stream->write_function(stream, "\n\n"); - stream->write_function(stream, "%s\n\n", line); - stream->write_function(stream, "%s\n", "Avmd global settings\n\n"); - stream->write_function(stream, "debug \t%u\n", avmd_globals.settings.debug); - stream->write_function(stream, "report status \t%u\n", avmd_globals.settings.report_status); - stream->write_function(stream, "fast_math \t%u\n", avmd_globals.settings.fast_math); - stream->write_function(stream, "require continuous streak \t%u\n", avmd_globals.settings.require_continuous_streak); - stream->write_function(stream, "sample n continuous streak \t%u\n", avmd_globals.settings.sample_n_continuous_streak); - stream->write_function(stream, "sample n to skip \t%u\n", avmd_globals.settings.sample_n_to_skip); - stream->write_function(stream, "require continuous streak amp \t%u\n", avmd_globals.settings.require_continuous_streak_amp); - stream->write_function(stream, "sample n continuous streak amp \t%u\n", avmd_globals.settings.sample_n_continuous_streak_amp); - stream->write_function(stream, "simplified estimation \t%u\n", avmd_globals.settings.simplified_estimation); - stream->write_function(stream, "inbound channel \t%u\n", avmd_globals.settings.inbound_channnel); - stream->write_function(stream, "outbound channel \t%u\n", avmd_globals.settings.outbound_channnel); - stream->write_function(stream, "detection mode \t%u\n", avmd_globals.settings.mode); - stream->write_function(stream, "sessions \t%"PRId64"\n", avmd_globals.session_n); - stream->write_function(stream, "detectors n \t%u\n", avmd_globals.settings.detectors_n); - stream->write_function(stream, "detectors lagged n \t%u\n", avmd_globals.settings.detectors_lagged_n); - stream->write_function(stream, "\n\n"); + stream->write_function(stream, "\n\n"); + stream->write_function(stream, "%s\n\n", line); + stream->write_function(stream, "%s\n", "Avmd global settings\n\n"); + stream->write_function(stream, "debug \t%u\n", avmd_globals.settings.debug); + stream->write_function(stream, "report status \t%u\n", avmd_globals.settings.report_status); + stream->write_function(stream, "fast_math \t%u\n", avmd_globals.settings.fast_math); + stream->write_function(stream, "require continuous streak \t%u\n", avmd_globals.settings.require_continuous_streak); + stream->write_function(stream, "sample n continuous streak \t%u\n", avmd_globals.settings.sample_n_continuous_streak); + stream->write_function(stream, "sample n to skip \t%u\n", avmd_globals.settings.sample_n_to_skip); + stream->write_function(stream, "require continuous streak amp \t%u\n", avmd_globals.settings.require_continuous_streak_amp); + stream->write_function(stream, "sample n continuous streak amp \t%u\n", avmd_globals.settings.sample_n_continuous_streak_amp); + stream->write_function(stream, "simplified estimation \t%u\n", avmd_globals.settings.simplified_estimation); + stream->write_function(stream, "inbound channel \t%u\n", avmd_globals.settings.inbound_channnel); + stream->write_function(stream, "outbound channel \t%u\n", avmd_globals.settings.outbound_channnel); + stream->write_function(stream, "detection mode \t%u\n", avmd_globals.settings.mode); + stream->write_function(stream, "sessions \t%"PRId64"\n", avmd_globals.session_n); + stream->write_function(stream, "detectors n \t%u\n", avmd_globals.settings.detectors_n); + stream->write_function(stream, "detectors lagged n \t%u\n", avmd_globals.settings.detectors_lagged_n); + stream->write_function(stream, "\n\n"); - if (mutex != NULL) { - switch_mutex_unlock(mutex); - } + if (mutex != NULL) { + switch_mutex_unlock(mutex); + } } SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) { #ifndef WIN32 - char err[150]; - int ret; + char err[150]; + int ret; #endif - switch_application_interface_t *app_interface; - switch_api_interface_t *api_interface; - /* connect my internal structure to the blank pointer passed to me */ - *module_interface = switch_loadable_module_create_module_interface(pool, modname); + switch_application_interface_t *app_interface; + switch_api_interface_t *api_interface; + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); - if (avmd_register_all_events() != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register avmd events!\n"); - return SWITCH_STATUS_TERM; - } + if (avmd_register_all_events() != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register avmd events!\n"); + return SWITCH_STATUS_TERM; + } - memset(&avmd_globals, 0, sizeof(avmd_globals)); - if (pool == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No memory pool assigned!\n"); - return SWITCH_STATUS_TERM; - } - switch_mutex_init(&avmd_globals.mutex, SWITCH_MUTEX_NESTED, pool); - avmd_globals.pool = pool; + memset(&avmd_globals, 0, sizeof(avmd_globals)); + if (pool == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No memory pool assigned!\n"); + return SWITCH_STATUS_TERM; + } + switch_mutex_init(&avmd_globals.mutex, SWITCH_MUTEX_NESTED, pool); + avmd_globals.pool = pool; - if (avmd_load_xml_configuration(NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load XML configuration! Loading default settings\n"); - avmd_set_xml_default_configuration(NULL); - } + if (avmd_load_xml_configuration(NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load XML configuration! Loading default settings\n"); + avmd_set_xml_default_configuration(NULL); + } - if ((switch_event_bind(modname, SWITCH_EVENT_RELOADXML, NULL, avmd_reloadxml_event_handler, NULL) != SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our reloadxml handler! Module will not react to changes made in XML configuration\n"); - /* Not so severe to prevent further loading, well - it depends, anyway */ - } + if ((switch_event_bind(modname, SWITCH_EVENT_RELOADXML, NULL, avmd_reloadxml_event_handler, NULL) != SWITCH_STATUS_SUCCESS)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our reloadxml handler! Module will not react to changes made in XML configuration\n"); + /* Not so severe to prevent further loading, well - it depends, anyway */ + } #ifndef WIN32 - if (avmd_globals.settings.fast_math == 1) { - ret = init_fast_acosf(); - if (ret != 0) { - strerror_r(errno, err, 150); - switch (ret) { + if (avmd_globals.settings.fast_math == 1) { + ret = init_fast_acosf(); + if (ret != 0) { + strerror_r(errno, err, 150); + switch (ret) { - case -1: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't access file [%s], error [%s]\n", ACOS_TABLE_FILENAME, err); - break; - case -2: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating file [%s], error [%s]\n", ACOS_TABLE_FILENAME, err); - break; - case -3: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Access rights are OK but can't open file [%s], error [%s]\n", ACOS_TABLE_FILENAME, err); - break; - case -4: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Access rights are OK but can't mmap file [%s], error [%s]\n",ACOS_TABLE_FILENAME, err); - break; - default: - switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Unknown error [%d] while initializing fast cos table [%s], errno [%s]\n", ret, ACOS_TABLE_FILENAME, err); - return SWITCH_STATUS_TERM; - } - return SWITCH_STATUS_TERM; - } else - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Advanced voicemail detection: fast math enabled, arc cosine table is [%s]\n", ACOS_TABLE_FILENAME); - } + case -1: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't access file [%s], error [%s]\n", ACOS_TABLE_FILENAME, err); + break; + case -2: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating file [%s], error [%s]\n", ACOS_TABLE_FILENAME, err); + break; + case -3: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Access rights are OK but can't open file [%s], error [%s]\n", ACOS_TABLE_FILENAME, err); + break; + case -4: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Access rights are OK but can't mmap file [%s], error [%s]\n",ACOS_TABLE_FILENAME, err); + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Unknown error [%d] while initializing fast cos table [%s], errno [%s]\n", ret, ACOS_TABLE_FILENAME, err); + return SWITCH_STATUS_TERM; + } + return SWITCH_STATUS_TERM; + } else + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Advanced voicemail detection: fast math enabled, arc cosine table is [%s]\n", ACOS_TABLE_FILENAME); + } #endif - SWITCH_ADD_APP(app_interface, "avmd_start","Start avmd detection", "Start avmd detection", avmd_start_app, "", SAF_NONE); - SWITCH_ADD_APP(app_interface, "avmd_stop","Stop avmd detection", "Stop avmd detection", avmd_stop_app, "", SAF_NONE); - SWITCH_ADD_APP(app_interface, "avmd","Beep detection", "Advanced detection of voicemail beeps", avmd_start_function, AVMD_SYNTAX, SAF_NONE); + SWITCH_ADD_APP(app_interface, "avmd_start","Start avmd detection", "Start avmd detection", avmd_start_app, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "avmd_stop","Stop avmd detection", "Stop avmd detection", avmd_stop_app, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "avmd","Beep detection", "Advanced detection of voicemail beeps", avmd_start_function, AVMD_SYNTAX, SAF_NONE); - SWITCH_ADD_API(api_interface, "avmd", "Voicemail beep detection", avmd_api_main, AVMD_SYNTAX); + SWITCH_ADD_API(api_interface, "avmd", "Voicemail beep detection", avmd_api_main, AVMD_SYNTAX); - switch_console_set_complete("add avmd ::console::list_uuid ::[start:stop"); - switch_console_set_complete("add avmd set inbound"); /* set inbound = 1, outbound = 0 */ - switch_console_set_complete("add avmd set outbound"); /* set inbound = 0, outbound = 1 */ - switch_console_set_complete("add avmd set default"); /* restore to factory settings */ - switch_console_set_complete("add avmd load inbound"); /* reload + set inbound */ - switch_console_set_complete("add avmd load outbound"); /* reload + set outbound */ - switch_console_set_complete("add avmd reload"); /* reload XML (it loads from FS installation - * folder, not module's conf/autoload_configs */ - switch_console_set_complete("add avmd show"); + switch_console_set_complete("add avmd ::console::list_uuid ::[start:stop"); + switch_console_set_complete("add avmd set inbound"); /* set inbound = 1, outbound = 0 */ + switch_console_set_complete("add avmd set outbound"); /* set inbound = 0, outbound = 1 */ + switch_console_set_complete("add avmd set default"); /* restore to factory settings */ + switch_console_set_complete("add avmd load inbound"); /* reload + set inbound */ + switch_console_set_complete("add avmd load outbound"); /* reload + set outbound */ + switch_console_set_complete("add avmd reload"); /* reload XML (it loads from FS installation + * folder, not module's conf/autoload_configs */ + switch_console_set_complete("add avmd show"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Advanced voicemail detection enabled\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Advanced voicemail detection enabled\n"); - return SWITCH_STATUS_SUCCESS; /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; /* indicate that the module should continue to be loaded */ } void avmd_config_dump(avmd_session_t *s) { - struct avmd_settings *settings; + struct avmd_settings *settings; - if (s == NULL) { - return; - } - settings = &s->settings; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "Avmd dynamic configuration: debug [%u], report_status [%u], fast_math [%u]," - " require_continuous_streak [%u], sample_n_continuous_streak [%u], sample_n_to_skip [%u], require_continuous_streak_amp [%u], sample_n_continuous_streak_amp [%u]," - " simplified_estimation [%u], inbound_channel [%u], outbound_channel [%u], detection_mode [%u], detectors_n [%u], detectors_lagged_n [%u]\n", - settings->debug, settings->report_status, settings->fast_math, settings->require_continuous_streak, settings->sample_n_continuous_streak, - settings->sample_n_to_skip, settings->require_continuous_streak_amp, settings->sample_n_continuous_streak_amp, - settings->simplified_estimation, settings->inbound_channnel, settings->outbound_channnel, settings->mode, settings->detectors_n, settings->detectors_lagged_n); - return; + if (s == NULL) { + return; + } + settings = &s->settings; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "Avmd dynamic configuration: debug [%u], report_status [%u], fast_math [%u]," + " require_continuous_streak [%u], sample_n_continuous_streak [%u], sample_n_to_skip [%u], require_continuous_streak_amp [%u], sample_n_continuous_streak_amp [%u]," + " simplified_estimation [%u], inbound_channel [%u], outbound_channel [%u], detection_mode [%u], detectors_n [%u], detectors_lagged_n [%u]\n", + settings->debug, settings->report_status, settings->fast_math, settings->require_continuous_streak, settings->sample_n_continuous_streak, + settings->sample_n_to_skip, settings->require_continuous_streak_amp, settings->sample_n_continuous_streak_amp, + settings->simplified_estimation, settings->inbound_channnel, settings->outbound_channnel, settings->mode, settings->detectors_n, settings->detectors_lagged_n); + return; } static switch_status_t avmd_parse_cmd_data_one_entry(char *candidate, struct avmd_settings *settings) { - char *candidate_parsed[3]; - int argc; - const char *key; - const char *val; + char *candidate_parsed[3]; + int argc; + const char *key; + const char *val; - if (settings == NULL) { - return SWITCH_STATUS_TERM; - } - if (candidate == NULL) { - return SWITCH_STATUS_NOOP; - } + if (settings == NULL) { + return SWITCH_STATUS_TERM; + } + if (candidate == NULL) { + return SWITCH_STATUS_NOOP; + } - argc = switch_separate_string(candidate, '=', candidate_parsed, (sizeof(candidate_parsed) / sizeof(candidate_parsed[0]))); - if (argc > 2) { /* currently we accept only option=value syntax */ - return SWITCH_STATUS_IGNORE; - } + argc = switch_separate_string(candidate, '=', candidate_parsed, (sizeof(candidate_parsed) / sizeof(candidate_parsed[0]))); + if (argc > 2) { /* currently we accept only option=value syntax */ + return SWITCH_STATUS_IGNORE; + } - /* this may be option parameter if valid */ - key = candidate_parsed[0]; /* option name */ - if (zstr(key)) { /* empty key */ - return SWITCH_STATUS_NOT_INITALIZED; - } - val = candidate_parsed[1]; /* value of the option: whole string starting at 1 past the '=' */ - if (zstr(val)) { /* nothing after "=" found, empty value */ - return SWITCH_STATUS_MORE_DATA; - } - /* candidate string has "=" somewhere in the middle and some value, - * try to find what option it is by comparing at most given number of bytes */ - if (!strcmp(key, "debug")) { - settings->debug = (uint8_t) switch_true(val); - } else if (!strcmp(key, "report_status")) { - settings->report_status = (uint8_t) switch_true(val); - } else if (!strcmp(key, "fast_math")) { - settings->fast_math = (uint8_t) switch_true(val); - } else if (!strcmp(key, "require_continuous_streak")) { - settings->require_continuous_streak = (uint8_t) switch_true(val); - } else if (!strcmp(key, "sample_n_continuous_streak")) { - if(avmd_parse_u16_user_input(val, &settings->sample_n_continuous_streak, 0, UINT16_MAX) == -1) { - return SWITCH_STATUS_FALSE; - } - } else if (!strcmp(key, "sample_n_to_skip")) { - if(avmd_parse_u16_user_input(val, &settings->sample_n_to_skip, 0, UINT16_MAX) == -1) { - return SWITCH_STATUS_FALSE; - } - } else if (!strcmp(key, "require_continuous_streak_amp")) { - settings->require_continuous_streak_amp = (uint8_t) switch_true(val); - } else if (!strcmp(key, "sample_n_continuous_streak_amp")) { - if(avmd_parse_u16_user_input(val, &settings->sample_n_continuous_streak_amp, 0, UINT16_MAX) == -1) { - return SWITCH_STATUS_FALSE; - } - } else if (!strcmp(key, "simplified_estimation")) { - settings->simplified_estimation = (uint8_t) switch_true(val); - } else if (!strcmp(key, "inbound_channel")) { - settings->inbound_channnel = (uint8_t) switch_true(val); - } else if (!strcmp(key, "outbound_channel")) { - settings->outbound_channnel = (uint8_t) switch_true(val); - } else if (!strcmp(key, "detection_mode")) { - if(avmd_parse_u8_user_input(val, (uint8_t*)&settings->mode, 0, 2) == -1) { - return SWITCH_STATUS_FALSE; - } - } else if (!strcmp(key, "detectors_n")) { - if(avmd_parse_u8_user_input(val, &settings->detectors_n, 0, UINT8_MAX) == -1) { - return SWITCH_STATUS_FALSE; - } - } else if (!strcmp(key, "detectors_lagged_n")) { - if(avmd_parse_u8_user_input(val, &settings->detectors_lagged_n, 0, UINT8_MAX) == -1) { - return SWITCH_STATUS_FALSE; - } - } else { - return SWITCH_STATUS_NOTFOUND; - } - return SWITCH_STATUS_SUCCESS; + /* this may be option parameter if valid */ + key = candidate_parsed[0]; /* option name */ + if (zstr(key)) { /* empty key */ + return SWITCH_STATUS_NOT_INITALIZED; + } + val = candidate_parsed[1]; /* value of the option: whole string starting at 1 past the '=' */ + if (zstr(val)) { /* nothing after "=" found, empty value */ + return SWITCH_STATUS_MORE_DATA; + } + /* candidate string has "=" somewhere in the middle and some value, + * try to find what option it is by comparing at most given number of bytes */ + if (!strcmp(key, "debug")) { + settings->debug = (uint8_t) switch_true(val); + } else if (!strcmp(key, "report_status")) { + settings->report_status = (uint8_t) switch_true(val); + } else if (!strcmp(key, "fast_math")) { + settings->fast_math = (uint8_t) switch_true(val); + } else if (!strcmp(key, "require_continuous_streak")) { + settings->require_continuous_streak = (uint8_t) switch_true(val); + } else if (!strcmp(key, "sample_n_continuous_streak")) { + if(avmd_parse_u16_user_input(val, &settings->sample_n_continuous_streak, 0, UINT16_MAX) == -1) { + return SWITCH_STATUS_FALSE; + } + } else if (!strcmp(key, "sample_n_to_skip")) { + if(avmd_parse_u16_user_input(val, &settings->sample_n_to_skip, 0, UINT16_MAX) == -1) { + return SWITCH_STATUS_FALSE; + } + } else if (!strcmp(key, "require_continuous_streak_amp")) { + settings->require_continuous_streak_amp = (uint8_t) switch_true(val); + } else if (!strcmp(key, "sample_n_continuous_streak_amp")) { + if(avmd_parse_u16_user_input(val, &settings->sample_n_continuous_streak_amp, 0, UINT16_MAX) == -1) { + return SWITCH_STATUS_FALSE; + } + } else if (!strcmp(key, "simplified_estimation")) { + settings->simplified_estimation = (uint8_t) switch_true(val); + } else if (!strcmp(key, "inbound_channel")) { + settings->inbound_channnel = (uint8_t) switch_true(val); + } else if (!strcmp(key, "outbound_channel")) { + settings->outbound_channnel = (uint8_t) switch_true(val); + } else if (!strcmp(key, "detection_mode")) { + if(avmd_parse_u8_user_input(val, (uint8_t*)&settings->mode, 0, 2) == -1) { + return SWITCH_STATUS_FALSE; + } + } else if (!strcmp(key, "detectors_n")) { + if(avmd_parse_u8_user_input(val, &settings->detectors_n, 0, UINT8_MAX) == -1) { + return SWITCH_STATUS_FALSE; + } + } else if (!strcmp(key, "detectors_lagged_n")) { + if(avmd_parse_u8_user_input(val, &settings->detectors_lagged_n, 0, UINT8_MAX) == -1) { + return SWITCH_STATUS_FALSE; + } + } else { + return SWITCH_STATUS_NOTFOUND; + } + return SWITCH_STATUS_SUCCESS; } /* RCU style: reads, copies and then updates only if everything is fine, @@ -1310,740 +1310,740 @@ static switch_status_t avmd_parse_cmd_data_one_entry(char *candidate, struct avm * are updated accordingly to @cmd_data, if SWITCH_STATUS_FALSE then * parsing error occurred and avmd session is left untouched */ static switch_status_t avmd_parse_cmd_data(avmd_session_t *s, const char *cmd_data, enum avmd_app app) { - char *mydata; - struct avmd_settings settings; - int argc = 0, idx; - char *argv[AVMD_PARAMS_APP_MAX * 2] = { 0 }; - switch_status_t status = SWITCH_STATUS_SUCCESS; + char *mydata; + struct avmd_settings settings; + int argc = 0, idx; + char *argv[AVMD_PARAMS_APP_MAX * 2] = { 0 }; + switch_status_t status = SWITCH_STATUS_SUCCESS; - if (s == NULL) { - return SWITCH_STATUS_NOOP; - } + if (s == NULL) { + return SWITCH_STATUS_NOOP; + } - memcpy(&settings, &avmd_globals.settings, sizeof (struct avmd_settings)); /* copy globally set settings first */ - if (zstr(cmd_data)) { - goto end_copy; - } + memcpy(&settings, &avmd_globals.settings, sizeof (struct avmd_settings)); /* copy globally set settings first */ + if (zstr(cmd_data)) { + goto end_copy; + } - switch (app) { + switch (app) { - case AVMD_APP_START_APP: - /* try to parse settings */ - mydata = switch_core_session_strdup(s->session, cmd_data); - argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); - if (argc < AVMD_PARAMS_APP_START_MIN || argc > AVMD_PARAMS_APP_START_MAX) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "Syntax Error, avmd_start APP takes [%u] to [%u] parameters\n", - AVMD_PARAMS_APP_START_MIN, AVMD_PARAMS_APP_START_MAX); - switch_goto_status(SWITCH_STATUS_MORE_DATA, fail); - } - /* iterate over params, check if they mean something to us, set */ - idx = 0; - while (idx < argc) { - switch_assert(argv[idx]); - status = avmd_parse_cmd_data_one_entry(argv[idx], &settings); - if (status != SWITCH_STATUS_SUCCESS) { - if (argv[idx]) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "Error parsing option [%d] [%s]\n", idx + 1, argv[idx]); /* idx + 1 to report option 0 as 1 for users convenience */ - } - switch (status) - { - case SWITCH_STATUS_TERM: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "NULL settings struct passed to parser\n"); - break; - case SWITCH_STATUS_NOOP: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "NULL settings string passed to parser\n"); - break; - case SWITCH_STATUS_IGNORE: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "Syntax error. Currently we accept only option=value syntax\n"); - break; - case SWITCH_STATUS_NOT_INITALIZED: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "Syntax error. No key specified\n"); - break; - case SWITCH_STATUS_MORE_DATA: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "Syntax error. No value for the key? Currently we accept only option=value syntax\n"); - break; - case SWITCH_STATUS_FALSE: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "Bad value for this option\n"); - break; - case SWITCH_STATUS_NOTFOUND: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, - "Option not found. Please check option name is correct\n"); - break; - default: - break; - } - status = SWITCH_STATUS_FALSE; - goto fail; - } - ++idx; - } - /* OK */ - goto end_copy; - default: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, "There is no app with index [%u] for avmd\n", app); - switch_goto_status(SWITCH_STATUS_NOTFOUND, fail); - } + case AVMD_APP_START_APP: + /* try to parse settings */ + mydata = switch_core_session_strdup(s->session, cmd_data); + argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + if (argc < AVMD_PARAMS_APP_START_MIN || argc > AVMD_PARAMS_APP_START_MAX) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "Syntax Error, avmd_start APP takes [%u] to [%u] parameters\n", + AVMD_PARAMS_APP_START_MIN, AVMD_PARAMS_APP_START_MAX); + switch_goto_status(SWITCH_STATUS_MORE_DATA, fail); + } + /* iterate over params, check if they mean something to us, set */ + idx = 0; + while (idx < argc) { + switch_assert(argv[idx]); + status = avmd_parse_cmd_data_one_entry(argv[idx], &settings); + if (status != SWITCH_STATUS_SUCCESS) { + if (argv[idx]) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "Error parsing option [%d] [%s]\n", idx + 1, argv[idx]); /* idx + 1 to report option 0 as 1 for users convenience */ + } + switch (status) + { + case SWITCH_STATUS_TERM: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "NULL settings struct passed to parser\n"); + break; + case SWITCH_STATUS_NOOP: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "NULL settings string passed to parser\n"); + break; + case SWITCH_STATUS_IGNORE: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "Syntax error. Currently we accept only option=value syntax\n"); + break; + case SWITCH_STATUS_NOT_INITALIZED: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "Syntax error. No key specified\n"); + break; + case SWITCH_STATUS_MORE_DATA: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "Syntax error. No value for the key? Currently we accept only option=value syntax\n"); + break; + case SWITCH_STATUS_FALSE: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "Bad value for this option\n"); + break; + case SWITCH_STATUS_NOTFOUND: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, + "Option not found. Please check option name is correct\n"); + break; + default: + break; + } + status = SWITCH_STATUS_FALSE; + goto fail; + } + ++idx; + } + /* OK */ + goto end_copy; + default: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_ERROR, "There is no app with index [%u] for avmd\n", app); + switch_goto_status(SWITCH_STATUS_NOTFOUND, fail); + } end_copy: - memcpy(&s->settings, &settings, sizeof (struct avmd_settings)); /* commit the change */ - return SWITCH_STATUS_SUCCESS; + memcpy(&s->settings, &settings, sizeof (struct avmd_settings)); /* commit the change */ + return SWITCH_STATUS_SUCCESS; fail: - return status; + return status; } SWITCH_STANDARD_APP(avmd_start_app) { - switch_media_bug_t *bug = NULL; - switch_status_t status = SWITCH_STATUS_FALSE; - switch_channel_t *channel = NULL; - avmd_session_t *avmd_session = NULL; - switch_core_media_flag_t flags = 0; + switch_media_bug_t *bug = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + switch_channel_t *channel = NULL; + avmd_session_t *avmd_session = NULL; + switch_core_media_flag_t flags = 0; const char *direction = "NO DIRECTION"; uint8_t report = 0; - if (session == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "BUGGG. FreeSWITCH session is NULL! Please report to developers\n"); - return; - } + if (session == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "BUGGG. FreeSWITCH session is NULL! Please report to developers\n"); + return; + } - /* Get current channel of the session to tag the session. This indicates that our module is present - * At this moment this cannot return NULL, it will either succeed or assert failed, but we make ourself secure anyway */ - channel = switch_core_session_get_channel(session); - if (channel == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "BUGGG. No channel for FreeSWITCH session! Please report this to the developers.\n"); - goto end; - } + /* Get current channel of the session to tag the session. This indicates that our module is present + * At this moment this cannot return NULL, it will either succeed or assert failed, but we make ourself secure anyway */ + channel = switch_core_session_get_channel(session); + if (channel == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "BUGGG. No channel for FreeSWITCH session! Please report this to the developers.\n"); + goto end; + } - bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_avmd_"); /* Is this channel already set? */ - if (bug != NULL) { /* We have already started */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Avmd already started!\n"); - return; - } + bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_avmd_"); /* Is this channel already set? */ + if (bug != NULL) { /* We have already started */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Avmd already started!\n"); + return; + } - /* Allocate memory attached to this FreeSWITCH session for use in the callback routine and to store state information */ - avmd_session = (avmd_session_t *) switch_core_session_alloc(session, sizeof(avmd_session_t)); - if (avmd_session == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't allocate memory for avmd session!\n"); - status = SWITCH_STATUS_FALSE; - goto end; - } - avmd_session->session = session; + /* Allocate memory attached to this FreeSWITCH session for use in the callback routine and to store state information */ + avmd_session = (avmd_session_t *) switch_core_session_alloc(session, sizeof(avmd_session_t)); + if (avmd_session == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't allocate memory for avmd session!\n"); + status = SWITCH_STATUS_FALSE; + goto end; + } + avmd_session->session = session; - status = avmd_parse_cmd_data(avmd_session, data, AVMD_APP_START_APP); /* dynamic configuation */ - switch (status) { - case SWITCH_STATUS_SUCCESS: - break; - case SWITCH_STATUS_NOOP: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to set dynamic parameters for avmd session. Session is NULL!\n"); - goto end; - case SWITCH_STATUS_FALSE: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to set dynamic parameters for avmd session. Parsing error, please check the parameters passed to this APP.\n"); - goto end; - default: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to set dynamic parameteres for avmd session. Unknown error\n"); - goto end; - } + status = avmd_parse_cmd_data(avmd_session, data, AVMD_APP_START_APP); /* dynamic configuation */ + switch (status) { + case SWITCH_STATUS_SUCCESS: + break; + case SWITCH_STATUS_NOOP: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to set dynamic parameters for avmd session. Session is NULL!\n"); + goto end; + case SWITCH_STATUS_FALSE: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to set dynamic parameters for avmd session. Parsing error, please check the parameters passed to this APP.\n"); + goto end; + default: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to set dynamic parameteres for avmd session. Unknown error\n"); + goto end; + } report = avmd_session->settings.report_status; - status = init_avmd_session_data(avmd_session, session, avmd_globals.mutex); - if (status != SWITCH_STATUS_SUCCESS) { - switch (status) { - case SWITCH_STATUS_MEMERR: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to init avmd session. Buffer error!\n"); - break; - case SWITCH_STATUS_MORE_DATA: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to init avmd session. SMA buffer size is 0!\n"); - break; - case SWITCH_STATUS_FALSE: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to init avmd session. SMA buffers error\n"); - break; - default: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to init avmd session. Unknown error\n"); - break; - } - goto end; - } + status = init_avmd_session_data(avmd_session, session, avmd_globals.mutex); + if (status != SWITCH_STATUS_SUCCESS) { + switch (status) { + case SWITCH_STATUS_MEMERR: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to init avmd session. Buffer error!\n"); + break; + case SWITCH_STATUS_MORE_DATA: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to init avmd session. SMA buffer size is 0!\n"); + break; + case SWITCH_STATUS_FALSE: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to init avmd session. SMA buffers error\n"); + break; + default: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to init avmd session. Unknown error\n"); + break; + } + goto end; + } - switch_mutex_lock(avmd_session->mutex); - if (avmd_session->settings.report_status == 1) { /* dump dynamic parameters */ - avmd_config_dump(avmd_session); - } - if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_session->settings.outbound_channnel == 1)) { - flags |= SMBF_READ_REPLACE; + switch_mutex_lock(avmd_session->mutex); + if (avmd_session->settings.report_status == 1) { /* dump dynamic parameters */ + avmd_config_dump(avmd_session); + } + if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_session->settings.outbound_channnel == 1)) { + flags |= SMBF_READ_REPLACE; direction = "READ_REPLACE"; - } - if ((SWITCH_CALL_DIRECTION_INBOUND == switch_channel_direction(channel)) && (avmd_session->settings.inbound_channnel == 1)) { - flags |= SMBF_WRITE_REPLACE; + } + if ((SWITCH_CALL_DIRECTION_INBOUND == switch_channel_direction(channel)) && (avmd_session->settings.inbound_channnel == 1)) { + flags |= SMBF_WRITE_REPLACE; if (!strcmp(direction, "READ_REPLACE")) { direction = "READ_REPLACE | WRITE_REPLACE"; } else { direction = "WRITE_REPLACE"; } - } + } - if (flags == 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't set direction for channel [%s]\n", switch_channel_get_name(channel)); - status = SWITCH_STATUS_FALSE; - goto end_unlock; - } + if (flags == 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't set direction for channel [%s]\n", switch_channel_get_name(channel)); + status = SWITCH_STATUS_FALSE; + goto end_unlock; + } - if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_session->settings.outbound_channnel == 1)) { - if (switch_channel_test_flag(channel, CF_MEDIA_SET) == 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel [%s] has no codec assigned yet. Please try again\n", switch_channel_get_name(channel)); - status = SWITCH_STATUS_FALSE; - goto end_unlock; - } - } + if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_session->settings.outbound_channnel == 1)) { + if (switch_channel_test_flag(channel, CF_MEDIA_SET) == 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel [%s] has no codec assigned yet. Please try again\n", switch_channel_get_name(channel)); + status = SWITCH_STATUS_FALSE; + goto end_unlock; + } + } - status = avmd_launch_threads(avmd_session); - if (status != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to start detection threads\n"); - avmd_join_threads(avmd_session); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Joined detection threads\n"); - goto end_unlock; - } + status = avmd_launch_threads(avmd_session); + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to start detection threads\n"); + avmd_join_threads(avmd_session); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Joined detection threads\n"); + goto end_unlock; + } - status = switch_core_media_bug_add(session, "avmd", NULL, avmd_callback, avmd_session, 0, flags, &bug); /* Add a media bug that allows me to intercept the audio stream */ - if (status != SWITCH_STATUS_SUCCESS) { /* If adding a media bug fails exit */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to add media bug!\n"); + status = switch_core_media_bug_add(session, "avmd", NULL, avmd_callback, avmd_session, 0, flags, &bug); /* Add a media bug that allows me to intercept the audio stream */ + if (status != SWITCH_STATUS_SUCCESS) { /* If adding a media bug fails exit */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to add media bug!\n"); switch_mutex_unlock(avmd_session->mutex); avmd_session_close(avmd_session); - goto end; - } + goto end; + } - switch_mutex_lock(avmd_globals.mutex); - ++avmd_globals.session_n; - switch_mutex_unlock(avmd_globals.mutex); + switch_mutex_lock(avmd_globals.mutex); + ++avmd_globals.session_n; + switch_mutex_unlock(avmd_globals.mutex); - switch_channel_set_private(channel, "_avmd_", bug); /* Set the avmd tag to detect an existing avmd media bug */ - avmd_fire_event(AVMD_EVENT_SESSION_START, session, 0, 0, 0, 0, 0, 0, 0, 0, avmd_session->start_time, 0, 0, 0, 0); - if (avmd_session->settings.report_status == 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Avmd on channel [%s] started! direction=%s\n", switch_channel_get_name(channel), direction); - } + switch_channel_set_private(channel, "_avmd_", bug); /* Set the avmd tag to detect an existing avmd media bug */ + avmd_fire_event(AVMD_EVENT_SESSION_START, session, 0, 0, 0, 0, 0, 0, 0, 0, avmd_session->start_time, 0, 0, 0, 0); + if (avmd_session->settings.report_status == 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Avmd on channel [%s] started! direction=%s\n", switch_channel_get_name(channel), direction); + } end_unlock: - switch_mutex_unlock(avmd_session->mutex); + switch_mutex_unlock(avmd_session->mutex); end: - if (status != SWITCH_STATUS_SUCCESS) { - if (avmd_session == NULL || report) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Avmd on channel [%s] NOT started\n", switch_channel_get_name(channel)); - } - } - return; + if (status != SWITCH_STATUS_SUCCESS) { + if (avmd_session == NULL || report) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Avmd on channel [%s] NOT started\n", switch_channel_get_name(channel)); + } + } + return; } SWITCH_STANDARD_APP(avmd_stop_app) { - switch_media_bug_t *bug; - switch_channel_t *channel; - avmd_session_t *avmd_session; - switch_time_t start_time, stop_time, total_time; - uint8_t report_status = 0; - avmd_beep_state_t beep_status = BEEP_NOTDETECTED; + switch_media_bug_t *bug; + switch_channel_t *channel; + avmd_session_t *avmd_session; + switch_time_t start_time, stop_time, total_time; + uint8_t report_status = 0; + avmd_beep_state_t beep_status = BEEP_NOTDETECTED; - if (session == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "FreeSWITCH is NULL! Please report to developers\n"); - return; - } + if (session == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "FreeSWITCH is NULL! Please report to developers\n"); + return; + } - /* Get current channel of the session to tag the session. This indicates that our module is present - * At this moment this cannot return NULL, it will either succeed or assert failed, but we make ourself secure anyway */ - channel = switch_core_session_get_channel(session); - if (channel == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No channel for FreeSWITCH session! Please report this to the developers.\n"); - return; - } + /* Get current channel of the session to tag the session. This indicates that our module is present + * At this moment this cannot return NULL, it will either succeed or assert failed, but we make ourself secure anyway */ + channel = switch_core_session_get_channel(session); + if (channel == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No channel for FreeSWITCH session! Please report this to the developers.\n"); + return; + } - bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_avmd_"); - if (bug == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Stop failed - no avmd session running on this channel [%s]!\n", switch_channel_get_name(channel)); - return; - } + bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_avmd_"); + if (bug == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Stop failed - no avmd session running on this channel [%s]!\n", switch_channel_get_name(channel)); + return; + } - avmd_session = switch_core_media_bug_get_user_data(bug); - if (avmd_session == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Stop failed - no avmd session object, stop event not fired on this channel [%s]!\n", switch_channel_get_name(channel)); - } else { - switch_mutex_lock(avmd_session->mutex); - report_status = avmd_session->settings.report_status; - beep_status = avmd_session->state.beep_state; - avmd_session->stop_time = switch_micro_time_now(); - start_time = avmd_session->start_time; - stop_time = avmd_session->stop_time; - total_time = stop_time - start_time; - switch_mutex_unlock(avmd_session->mutex); - avmd_fire_event(AVMD_EVENT_SESSION_STOP, session, 0, 0, 0, 0, beep_status, 1, 0, 0, start_time, stop_time, 0, 0, 0); - if (report_status == 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Avmd on channel [%s] stopped, beep status: [%s], total running time [%" PRId64 "] [us]\n", switch_channel_get_name(channel), beep_status == BEEP_DETECTED ? "DETECTED" : "NOTDETECTED", total_time); - } - } - switch_channel_set_private(channel, "_avmd_", NULL); - switch_core_media_bug_remove(session, &bug); + avmd_session = switch_core_media_bug_get_user_data(bug); + if (avmd_session == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Stop failed - no avmd session object, stop event not fired on this channel [%s]!\n", switch_channel_get_name(channel)); + } else { + switch_mutex_lock(avmd_session->mutex); + report_status = avmd_session->settings.report_status; + beep_status = avmd_session->state.beep_state; + avmd_session->stop_time = switch_micro_time_now(); + start_time = avmd_session->start_time; + stop_time = avmd_session->stop_time; + total_time = stop_time - start_time; + switch_mutex_unlock(avmd_session->mutex); + avmd_fire_event(AVMD_EVENT_SESSION_STOP, session, 0, 0, 0, 0, beep_status, 1, 0, 0, start_time, stop_time, 0, 0, 0); + if (report_status == 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Avmd on channel [%s] stopped, beep status: [%s], total running time [%" PRId64 "] [us]\n", switch_channel_get_name(channel), beep_status == BEEP_DETECTED ? "DETECTED" : "NOTDETECTED", total_time); + } + } + switch_channel_set_private(channel, "_avmd_", NULL); + switch_core_media_bug_remove(session, &bug); - return; + return; } /*! \brief FreeSWITCH application handler function. * This handles calls made from applications such as LUA and the dialplan. */ SWITCH_STANDARD_APP(avmd_start_function) { - switch_media_bug_t *bug; - switch_channel_t *channel; + switch_media_bug_t *bug; + switch_channel_t *channel; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "YOU ARE USING DEPRECATED APP INTERFACE. Please read documentation about new syntax\n"); - if (session == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No FreeSWITCH session assigned!\n"); - return; - } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "YOU ARE USING DEPRECATED APP INTERFACE. Please read documentation about new syntax\n"); + if (session == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No FreeSWITCH session assigned!\n"); + return; + } - channel = switch_core_session_get_channel(session); + channel = switch_core_session_get_channel(session); - bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_avmd_"); - if (bug != NULL) { - if (strcasecmp(data, "stop") == 0) { - switch_channel_set_private(channel, "_avmd_", NULL); - switch_core_media_bug_remove(session, &bug); - return; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n"); - return; - } - avmd_start_app(session, NULL); + bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_avmd_"); + if (bug != NULL) { + if (strcasecmp(data, "stop") == 0) { + switch_channel_set_private(channel, "_avmd_", NULL); + switch_core_media_bug_remove(session, &bug); + return; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n"); + return; + } + avmd_start_app(session, NULL); } SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown) { - size_t session_n; + size_t session_n; #ifndef WIN32 - int res; + int res; #endif - switch_mutex_lock(avmd_globals.mutex); + switch_mutex_lock(avmd_globals.mutex); - session_n = avmd_globals.session_n; - if (session_n > 0) { - switch_mutex_unlock(avmd_globals.mutex); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PLEASE DO NOT RELOAD MODULE WHILE SESSIONS ARE RUNNING\n"); - } + session_n = avmd_globals.session_n; + if (session_n > 0) { + switch_mutex_unlock(avmd_globals.mutex); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PLEASE DO NOT RELOAD MODULE WHILE SESSIONS ARE RUNNING\n"); + } - avmd_unregister_all_events(); + avmd_unregister_all_events(); #ifndef WIN32 - if (avmd_globals.settings.fast_math == 1) { - res = destroy_fast_acosf(); - if (res != 0) { - switch (res) { - case -1: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed unmap arc cosine table\n"); - break; - case -2: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed closing arc cosine table\n"); - break; - default: - break; - } - } - } + if (avmd_globals.settings.fast_math == 1) { + res = destroy_fast_acosf(); + if (res != 0) { + switch (res) { + case -1: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed unmap arc cosine table\n"); + break; + case -2: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed closing arc cosine table\n"); + break; + default: + break; + } + } + } #endif - switch_event_unbind_callback(avmd_reloadxml_event_handler); - switch_mutex_unlock(avmd_globals.mutex); - switch_mutex_destroy(avmd_globals.mutex); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Advanced voicemail detection disabled\n"); - return SWITCH_STATUS_SUCCESS; + switch_event_unbind_callback(avmd_reloadxml_event_handler); + switch_mutex_unlock(avmd_globals.mutex); + switch_mutex_destroy(avmd_globals.mutex); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Advanced voicemail detection disabled\n"); + return SWITCH_STATUS_SUCCESS; } /*! \brief FreeSWITCH API handler function. */ SWITCH_STANDARD_API(avmd_api_main) { - switch_media_bug_t *bug = NULL; - avmd_session_t *avmd_session = NULL; - switch_channel_t *channel = NULL; - int argc; - const char *uuid = NULL, *uuid_dup = NULL; - const char *command = NULL; - char *dupped = NULL, *argv[AVMD_PARAMS_API_MAX + 1] = { 0 }; - switch_core_media_flag_t flags = 0; - switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_core_session_t *fs_session = NULL; + switch_media_bug_t *bug = NULL; + avmd_session_t *avmd_session = NULL; + switch_channel_t *channel = NULL; + int argc; + const char *uuid = NULL, *uuid_dup = NULL; + const char *command = NULL; + char *dupped = NULL, *argv[AVMD_PARAMS_API_MAX + 1] = { 0 }; + switch_core_media_flag_t flags = 0; + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_core_session_t *fs_session = NULL; - switch_mutex_lock(avmd_globals.mutex); + switch_mutex_lock(avmd_globals.mutex); - if (zstr(cmd)) { - stream->write_function(stream, "-ERR, bad command!\n-USAGE: %s\n\n", AVMD_SYNTAX); - goto end; - } + if (zstr(cmd)) { + stream->write_function(stream, "-ERR, bad command!\n-USAGE: %s\n\n", AVMD_SYNTAX); + goto end; + } - dupped = strdup(cmd); - switch_assert(dupped); - argc = switch_separate_string((char*)dupped, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + dupped = strdup(cmd); + switch_assert(dupped); + argc = switch_separate_string((char*)dupped, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - if (argc < AVMD_PARAMS_API_MIN) { - stream->write_function(stream, "-ERR, avmd takes [%u] min and [%u] max parameters!\n-USAGE: %s\n\n", AVMD_PARAMS_API_MIN, AVMD_PARAMS_API_MAX, AVMD_SYNTAX); - goto end; - } + if (argc < AVMD_PARAMS_API_MIN) { + stream->write_function(stream, "-ERR, avmd takes [%u] min and [%u] max parameters!\n-USAGE: %s\n\n", AVMD_PARAMS_API_MIN, AVMD_PARAMS_API_MAX, AVMD_SYNTAX); + goto end; + } - command = argv[0]; - if (strcasecmp(command, "reload") == 0) { - status = avmd_load_xml_configuration(NULL); - if (avmd_globals.settings.report_status == 1) { - if (status != SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "-ERR, couldn't reload XML configuration\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't reload XML configuration\n"); - } else { - stream->write_function(stream, "+OK\n XML reloaded\n\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "XML reloaded\n"); - } - goto end; - } - } - if (strcasecmp(command, "load") == 0) { - if (argc != 2) { - stream->write_function(stream, "-ERR, load command takes 1 parameter!\n-USAGE: %s\n\n", AVMD_SYNTAX); - goto end; - } - command = argv[1]; - if (strcasecmp(command, "inbound") == 0) { - status = avmd_load_xml_inbound_configuration(NULL); - if (avmd_globals.settings.report_status == 1) { - if (status != SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "-ERR, couldn't load XML configuration\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load XML configuration\n"); - } else { - stream->write_function(stream, "+OK\n inbound XML configuration loaded\n\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Inbound XML configuration loaded\n"); - } - goto end; - } - } else if (strcasecmp(command, "outbound") == 0) { - status = avmd_load_xml_outbound_configuration(NULL); - if (avmd_globals.settings.report_status == 1) { - if (status != SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "-ERR, couldn't load XML configuration\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load XML configuration\n"); - } else { - stream->write_function(stream, "+OK\n outbound XML configuration loaded\n\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Outbound XML configuration loaded\n"); - } - goto end; - } - } else { - stream->write_function(stream, "-ERR, load command: bad syntax!\n-USAGE: %s\n\n", AVMD_SYNTAX); - } - goto end; - } - if (strcasecmp(command, "set") == 0) { - if (argc != 2) { - stream->write_function(stream, "-ERR, set command takes 1 parameter!\n-USAGE: %s\n\n", AVMD_SYNTAX); - goto end; - } - command = argv[1]; - if (strcasecmp(command, "inbound") == 0) { - avmd_set_xml_inbound_configuration(NULL); - if (avmd_globals.settings.report_status == 1) { - stream->write_function(stream, "+OK\n inbound XML configuration loaded\n\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Inbound XML configuration loaded\n"); - } - } else if (strcasecmp(command, "outbound") == 0) { - avmd_set_xml_outbound_configuration(NULL); - if (avmd_globals.settings.report_status == 1) { - stream->write_function(stream, "+OK\n outbound XML configuration loaded\n\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Outbound XML configuration loaded\n"); - } - } else if (strcasecmp(command, "default") == 0) { - avmd_set_xml_default_configuration(NULL); - if (avmd_globals.settings.report_status == 1) { - stream->write_function(stream, "+OK\n reset to factory settings\n\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Reset to factory settings\n"); - } - } else { - stream->write_function(stream, "-ERR, set command: bad syntax!\n-USAGE: %s\n\n", AVMD_SYNTAX); - } - goto end; - } - if (strcasecmp(command, "show") == 0) { - avmd_show(stream, NULL); - if (avmd_globals.settings.report_status == 1) { - stream->write_function(stream, "+OK\n show\n\n"); - } - goto end; - } + command = argv[0]; + if (strcasecmp(command, "reload") == 0) { + status = avmd_load_xml_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + if (status != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR, couldn't reload XML configuration\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't reload XML configuration\n"); + } else { + stream->write_function(stream, "+OK\n XML reloaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "XML reloaded\n"); + } + goto end; + } + } + if (strcasecmp(command, "load") == 0) { + if (argc != 2) { + stream->write_function(stream, "-ERR, load command takes 1 parameter!\n-USAGE: %s\n\n", AVMD_SYNTAX); + goto end; + } + command = argv[1]; + if (strcasecmp(command, "inbound") == 0) { + status = avmd_load_xml_inbound_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + if (status != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR, couldn't load XML configuration\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load XML configuration\n"); + } else { + stream->write_function(stream, "+OK\n inbound XML configuration loaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Inbound XML configuration loaded\n"); + } + goto end; + } + } else if (strcasecmp(command, "outbound") == 0) { + status = avmd_load_xml_outbound_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + if (status != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR, couldn't load XML configuration\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load XML configuration\n"); + } else { + stream->write_function(stream, "+OK\n outbound XML configuration loaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Outbound XML configuration loaded\n"); + } + goto end; + } + } else { + stream->write_function(stream, "-ERR, load command: bad syntax!\n-USAGE: %s\n\n", AVMD_SYNTAX); + } + goto end; + } + if (strcasecmp(command, "set") == 0) { + if (argc != 2) { + stream->write_function(stream, "-ERR, set command takes 1 parameter!\n-USAGE: %s\n\n", AVMD_SYNTAX); + goto end; + } + command = argv[1]; + if (strcasecmp(command, "inbound") == 0) { + avmd_set_xml_inbound_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n inbound XML configuration loaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Inbound XML configuration loaded\n"); + } + } else if (strcasecmp(command, "outbound") == 0) { + avmd_set_xml_outbound_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n outbound XML configuration loaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Outbound XML configuration loaded\n"); + } + } else if (strcasecmp(command, "default") == 0) { + avmd_set_xml_default_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n reset to factory settings\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Reset to factory settings\n"); + } + } else { + stream->write_function(stream, "-ERR, set command: bad syntax!\n-USAGE: %s\n\n", AVMD_SYNTAX); + } + goto end; + } + if (strcasecmp(command, "show") == 0) { + avmd_show(stream, NULL); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n show\n\n"); + } + goto end; + } - uuid = argv[0]; - command = argv[1]; + uuid = argv[0]; + command = argv[1]; - fs_session = switch_core_session_locate(uuid); /* using uuid locate a reference to the FreeSWITCH session */ - if (fs_session == NULL) { - stream->write_function(stream, "-ERR, no FreeSWITCH session for uuid [%s]!\n-USAGE: %s\n\n", uuid, AVMD_SYNTAX); - goto end; - } + fs_session = switch_core_session_locate(uuid); /* using uuid locate a reference to the FreeSWITCH session */ + if (fs_session == NULL) { + stream->write_function(stream, "-ERR, no FreeSWITCH session for uuid [%s]!\n-USAGE: %s\n\n", uuid, AVMD_SYNTAX); + goto end; + } - /* Get current channel of the session to tag the session. This indicates that our module is present - * At this moment this cannot return NULL, it will either succeed or assert failed, but we make ourself secure anyway */ - channel = switch_core_session_get_channel(fs_session); - if (channel == NULL) { - stream->write_function(stream, "-ERR, no channel for FreeSWITCH session [%s]!\n Please report this to the developers\n\n", uuid); - goto end; - } + /* Get current channel of the session to tag the session. This indicates that our module is present + * At this moment this cannot return NULL, it will either succeed or assert failed, but we make ourself secure anyway */ + channel = switch_core_session_get_channel(fs_session); + if (channel == NULL) { + stream->write_function(stream, "-ERR, no channel for FreeSWITCH session [%s]!\n Please report this to the developers\n\n", uuid); + goto end; + } - bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_avmd_"); - if (bug != NULL) { - if (strcasecmp(command, "stop") == 0) { - avmd_session = (avmd_session_t*) switch_core_media_bug_get_user_data(bug); - if (avmd_session == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Stop failed - no avmd session object on this channel [%s]!\n", switch_channel_get_name(channel)); - goto end; - } - uuid_dup = switch_core_strdup(switch_core_session_get_pool(fs_session), uuid); - switch_channel_set_private(channel, "_avmd_", NULL); - switch_core_media_bug_remove(fs_session, &bug); - avmd_fire_event(AVMD_EVENT_SESSION_STOP, fs_session, 0, 0, 0, 0, 0, 0, 0, 0, avmd_session->start_time, avmd_session->stop_time, 0, 0, 0); - if (avmd_globals.settings.report_status == 1) { - stream->write_function(stream, "+OK\n [%s] [%s] stopped\n\n", uuid_dup, switch_channel_get_name(channel)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, "Avmd on channel [%s] stopped!\n", switch_channel_get_name(channel)); - } - goto end; - } - if (avmd_globals.settings.report_status == 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Avmd already started!\n"); - stream->write_function(stream, "-ERR, avmd for FreeSWITCH session [%s]\n already started\n\n", uuid); - } - goto end; - } + bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_avmd_"); + if (bug != NULL) { + if (strcasecmp(command, "stop") == 0) { + avmd_session = (avmd_session_t*) switch_core_media_bug_get_user_data(bug); + if (avmd_session == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Stop failed - no avmd session object on this channel [%s]!\n", switch_channel_get_name(channel)); + goto end; + } + uuid_dup = switch_core_strdup(switch_core_session_get_pool(fs_session), uuid); + switch_channel_set_private(channel, "_avmd_", NULL); + switch_core_media_bug_remove(fs_session, &bug); + avmd_fire_event(AVMD_EVENT_SESSION_STOP, fs_session, 0, 0, 0, 0, 0, 0, 0, 0, avmd_session->start_time, avmd_session->stop_time, 0, 0, 0); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n [%s] [%s] stopped\n\n", uuid_dup, switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, "Avmd on channel [%s] stopped!\n", switch_channel_get_name(channel)); + } + goto end; + } + if (avmd_globals.settings.report_status == 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Avmd already started!\n"); + stream->write_function(stream, "-ERR, avmd for FreeSWITCH session [%s]\n already started\n\n", uuid); + } + goto end; + } - if (strcasecmp(command, "stop") == 0) { - uuid_dup = switch_core_strdup(switch_core_session_get_pool(fs_session), uuid); - stream->write_function(stream, "+ERR, avmd has not yet been started on\n [%s] [%s]\n\n", uuid_dup, switch_channel_get_name(channel)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Stop failed - avmd has not yet been started on channel [%s]!\n", switch_channel_get_name(channel)); - goto end; - } - if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_globals.settings.outbound_channnel == 1)) { - flags |= SMBF_READ_REPLACE; - } - if ((SWITCH_CALL_DIRECTION_INBOUND == switch_channel_direction(channel)) && (avmd_globals.settings.inbound_channnel == 1)) { - flags |= SMBF_WRITE_REPLACE; - } - if (flags == 0) { - stream->write_function(stream, "-ERR, can't set direction for channel [%s]\n for FreeSWITCH session [%s]. Please check avmd configuration\n\n", switch_channel_get_name(channel), uuid); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Can't set direction for channel [%s]\n", switch_channel_get_name(channel)); - status = SWITCH_STATUS_FALSE; - goto end; - } - if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_globals.settings.outbound_channnel == 1)) { - if (switch_channel_test_flag(channel, CF_MEDIA_SET) == 0) { - stream->write_function(stream, "-ERR, channel [%s] for FreeSWITCH session [%s]\n has no read codec assigned yet. Please try again.\n\n", switch_channel_get_name(channel), uuid); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Channel [%s] has no codec assigned yet. Please try again\n", switch_channel_get_name(channel)); - status = SWITCH_STATUS_FALSE; - goto end; - } - } - if (strcasecmp(command, "start") != 0) { /* If we don't see the expected start exit */ - stream->write_function(stream, "-ERR, did you mean\n api avmd %s start ?\n-USAGE: %s\n\n", uuid, AVMD_SYNTAX); - goto end; - } + if (strcasecmp(command, "stop") == 0) { + uuid_dup = switch_core_strdup(switch_core_session_get_pool(fs_session), uuid); + stream->write_function(stream, "+ERR, avmd has not yet been started on\n [%s] [%s]\n\n", uuid_dup, switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Stop failed - avmd has not yet been started on channel [%s]!\n", switch_channel_get_name(channel)); + goto end; + } + if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_globals.settings.outbound_channnel == 1)) { + flags |= SMBF_READ_REPLACE; + } + if ((SWITCH_CALL_DIRECTION_INBOUND == switch_channel_direction(channel)) && (avmd_globals.settings.inbound_channnel == 1)) { + flags |= SMBF_WRITE_REPLACE; + } + if (flags == 0) { + stream->write_function(stream, "-ERR, can't set direction for channel [%s]\n for FreeSWITCH session [%s]. Please check avmd configuration\n\n", switch_channel_get_name(channel), uuid); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Can't set direction for channel [%s]\n", switch_channel_get_name(channel)); + status = SWITCH_STATUS_FALSE; + goto end; + } + if ((SWITCH_CALL_DIRECTION_OUTBOUND == switch_channel_direction(channel)) && (avmd_globals.settings.outbound_channnel == 1)) { + if (switch_channel_test_flag(channel, CF_MEDIA_SET) == 0) { + stream->write_function(stream, "-ERR, channel [%s] for FreeSWITCH session [%s]\n has no read codec assigned yet. Please try again.\n\n", switch_channel_get_name(channel), uuid); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Channel [%s] has no codec assigned yet. Please try again\n", switch_channel_get_name(channel)); + status = SWITCH_STATUS_FALSE; + goto end; + } + } + if (strcasecmp(command, "start") != 0) { /* If we don't see the expected start exit */ + stream->write_function(stream, "-ERR, did you mean\n api avmd %s start ?\n-USAGE: %s\n\n", uuid, AVMD_SYNTAX); + goto end; + } - avmd_session = (avmd_session_t *) switch_core_session_alloc(fs_session, sizeof(avmd_session_t)); /* Allocate memory attached to this FreeSWITCH session for use in the callback routine and to store state information */ - status = init_avmd_session_data(avmd_session, fs_session, NULL); - if (status != SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "-ERR, failed to initialize avmd session\n for FreeSWITCH session [%s]\n", uuid); - switch (status) { - case SWITCH_STATUS_MEMERR: - stream->write_function(stream, "-ERR, buffer error\n\n"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to init avmd session. Buffer error!\n"); - break; - case SWITCH_STATUS_MORE_DATA: - stream->write_function(stream, "-ERR, SMA buffer size is 0\n\n"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to init avmd session. SMA buffer size is 0!\n"); - break; - case SWITCH_STATUS_FALSE: - stream->write_function(stream, "-ERR, SMA buffer error\n\n"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to init avmd session. SMA buffers error\n"); - break; - default: - stream->write_function(stream, "-ERR, unknown error\n\n"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to init avmd session. Unknown error\n"); - break; - } - goto end; - } + avmd_session = (avmd_session_t *) switch_core_session_alloc(fs_session, sizeof(avmd_session_t)); /* Allocate memory attached to this FreeSWITCH session for use in the callback routine and to store state information */ + status = init_avmd_session_data(avmd_session, fs_session, NULL); + if (status != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR, failed to initialize avmd session\n for FreeSWITCH session [%s]\n", uuid); + switch (status) { + case SWITCH_STATUS_MEMERR: + stream->write_function(stream, "-ERR, buffer error\n\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to init avmd session. Buffer error!\n"); + break; + case SWITCH_STATUS_MORE_DATA: + stream->write_function(stream, "-ERR, SMA buffer size is 0\n\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to init avmd session. SMA buffer size is 0!\n"); + break; + case SWITCH_STATUS_FALSE: + stream->write_function(stream, "-ERR, SMA buffer error\n\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to init avmd session. SMA buffers error\n"); + break; + default: + stream->write_function(stream, "-ERR, unknown error\n\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to init avmd session. Unknown error\n"); + break; + } + goto end; + } - status = switch_core_media_bug_add(fs_session, "avmd", NULL, avmd_callback, avmd_session, 0, flags, &bug); /* Add a media bug that allows me to intercept the reading leg of the audio stream */ + status = switch_core_media_bug_add(fs_session, "avmd", NULL, avmd_callback, avmd_session, 0, flags, &bug); /* Add a media bug that allows me to intercept the reading leg of the audio stream */ - if (status != SWITCH_STATUS_SUCCESS) { /* If adding a media bug fails exit */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to add media bug!\n"); - stream->write_function(stream, "-ERR, [%s] failed to add media bug!\n\n", uuid); - goto end; - } + if (status != SWITCH_STATUS_SUCCESS) { /* If adding a media bug fails exit */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, "Failed to add media bug!\n"); + stream->write_function(stream, "-ERR, [%s] failed to add media bug!\n\n", uuid); + goto end; + } - switch_channel_set_private(channel, "_avmd_", bug); /* Set the vmd tag to detect an existing vmd media bug */ + switch_channel_set_private(channel, "_avmd_", bug); /* Set the vmd tag to detect an existing vmd media bug */ - avmd_fire_event(AVMD_EVENT_SESSION_START, fs_session, 0, 0, 0, 0, 0, 0, 0, 0, avmd_session->start_time, 0, 0, 0, 0); - if (avmd_globals.settings.report_status == 1) { - stream->write_function(stream, "+OK\n [%s] [%s] started!\n\n", uuid, switch_channel_get_name(channel)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, "Avmd on channel [%s] started!\n", switch_channel_get_name(channel)); - switch_assert(status == SWITCH_STATUS_SUCCESS); - } + avmd_fire_event(AVMD_EVENT_SESSION_START, fs_session, 0, 0, 0, 0, 0, 0, 0, 0, avmd_session->start_time, 0, 0, 0, 0); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n [%s] [%s] started!\n\n", uuid, switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, "Avmd on channel [%s] started!\n", switch_channel_get_name(channel)); + switch_assert(status == SWITCH_STATUS_SUCCESS); + } end: - if (status != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, "AVMD session NOT started\n"); - if (avmd_globals.settings.report_status == 1) { - if ((uuid != NULL) && (channel != NULL)) { - stream->write_function(stream, "+ERR\n [%s] [%s] NOT started!\n\n", uuid, switch_channel_get_name(channel)); - } else { - stream->write_function(stream, "+ERR\n AVMD session NOT started!\n\n", switch_channel_get_name(channel)); - } - } - } - if (fs_session) { - switch_core_session_rwunlock(fs_session); - } + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, "AVMD session NOT started\n"); + if (avmd_globals.settings.report_status == 1) { + if ((uuid != NULL) && (channel != NULL)) { + stream->write_function(stream, "+ERR\n [%s] [%s] NOT started!\n\n", uuid, switch_channel_get_name(channel)); + } else { + stream->write_function(stream, "+ERR\n AVMD session NOT started!\n\n", switch_channel_get_name(channel)); + } + } + } + if (fs_session) { + switch_core_session_rwunlock(fs_session); + } - switch_safe_free(dupped); + switch_safe_free(dupped); - switch_mutex_unlock(avmd_globals.mutex); + switch_mutex_unlock(avmd_globals.mutex); - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_SUCCESS; } static int avmd_decision_amplitude(const avmd_session_t *s, const struct avmd_buffer *b, double v, double rsd_threshold) { - double a, rsd; - size_t lpos; + double a, rsd; + size_t lpos; - lpos = b->sma_b.lpos; - if ((lpos >= AVMD_BEEP_LEN(s->rate) / b->resolution) && ((s->settings.require_continuous_streak_amp == 1 && (b->sma_amp_b.lpos > s->settings.sample_n_continuous_streak_amp) && (b->samples_streak_amp == 0)) - || (s->settings.require_continuous_streak_amp == 0 && (b->sma_amp_b.lpos > 1)))) { - a = fabs(b->sma_amp_b.sma); - if (a < AVMD_MIN_AMP) { - return 0; - } - rsd = sqrt(v) / a; - if (rsd < rsd_threshold) { - return 1; - } - } - return 0; + lpos = b->sma_b.lpos; + if ((lpos >= AVMD_BEEP_LEN(s->rate) / b->resolution) && ((s->settings.require_continuous_streak_amp == 1 && (b->sma_amp_b.lpos > s->settings.sample_n_continuous_streak_amp) && (b->samples_streak_amp == 0)) + || (s->settings.require_continuous_streak_amp == 0 && (b->sma_amp_b.lpos > 1)))) { + a = fabs(b->sma_amp_b.sma); + if (a < AVMD_MIN_AMP) { + return 0; + } + rsd = sqrt(v) / a; + if (rsd < rsd_threshold) { + return 1; + } + } + return 0; } static int avmd_decision_freq(const avmd_session_t *s, const struct avmd_buffer *b, double v, double rsd_threshold) { - double f, rsd; - size_t lpos; - f = AVMD_TO_HZ(s->rate, fabs(b->sma_b_fir.sma)); - if ((f < AVMD_MIN_FREQUENCY) || (f > AVMD_MAX_FREQUENCY)) { - return 0; - } - lpos = b->sma_b.lpos; - if ((lpos >= AVMD_BEEP_LEN(s->rate) / b->resolution) && ((s->settings.require_continuous_streak == 1 && (b->sma_b.lpos > s->settings.sample_n_continuous_streak) && (b->samples_streak == 0)) - || (s->settings.require_continuous_streak == 0 && (b->sma_b.lpos > 1)))) { - rsd = sqrt(v) / f; - if ((rsd < 0.3 * rsd_threshold) && (b->sma_amp_b.sma >= 0.005 * b->amplitude_max)) { - return 1; - } - if ((rsd < 0.6 * rsd_threshold) && (b->sma_amp_b.sma >= 0.01 * b->amplitude_max)) { - return 1; - } - if ((rsd < rsd_threshold) && (b->sma_amp_b.sma >= 0.015 * b->amplitude_max)) { - return 1; - } - } - return 0; + double f, rsd; + size_t lpos; + f = AVMD_TO_HZ(s->rate, fabs(b->sma_b_fir.sma)); + if ((f < AVMD_MIN_FREQUENCY) || (f > AVMD_MAX_FREQUENCY)) { + return 0; + } + lpos = b->sma_b.lpos; + if ((lpos >= AVMD_BEEP_LEN(s->rate) / b->resolution) && ((s->settings.require_continuous_streak == 1 && (b->sma_b.lpos > s->settings.sample_n_continuous_streak) && (b->samples_streak == 0)) + || (s->settings.require_continuous_streak == 0 && (b->sma_b.lpos > 1)))) { + rsd = sqrt(v) / f; + if ((rsd < 0.3 * rsd_threshold) && (b->sma_amp_b.sma >= 0.005 * b->amplitude_max)) { + return 1; + } + if ((rsd < 0.6 * rsd_threshold) && (b->sma_amp_b.sma >= 0.01 * b->amplitude_max)) { + return 1; + } + if ((rsd < rsd_threshold) && (b->sma_amp_b.sma >= 0.015 * b->amplitude_max)) { + return 1; + } + } + return 0; } static void avmd_report_detection(avmd_session_t *s, enum avmd_detection_mode mode, const struct avmd_detector *d) { - switch_channel_t *channel; - switch_time_t detection_time; - double f_sma = 0.0; - double v_amp = 9999.9, v_fir = 9999.9; + switch_channel_t *channel; + switch_time_t detection_time; + double f_sma = 0.0; + double v_amp = 9999.9, v_fir = 9999.9; - const struct avmd_buffer *b = &d->buffer; - const sma_buffer_t *sma_b_fir = &b->sma_b_fir; - const sma_buffer_t *sqa_b_fir = &b->sqa_b_fir; + const struct avmd_buffer *b = &d->buffer; + const sma_buffer_t *sma_b_fir = &b->sma_b_fir; + const sma_buffer_t *sqa_b_fir = &b->sqa_b_fir; - const sma_buffer_t *sma_amp_b = &b->sma_amp_b; - const sma_buffer_t *sqa_amp_b = &b->sqa_amp_b; + const sma_buffer_t *sma_amp_b = &b->sma_amp_b; + const sma_buffer_t *sqa_amp_b = &b->sqa_amp_b; - channel = switch_core_session_get_channel(s->session); + channel = switch_core_session_get_channel(s->session); - s->detection_stop_time = switch_micro_time_now(); /* stop detection timer */ - detection_time = s->detection_stop_time - s->detection_start_time; /* detection time length */ - switch_channel_set_variable_printf(channel, "avmd_total_time", "[%" PRId64 "]", detection_time / 1000); - switch_channel_execute_on(channel, "execute_on_avmd_beep"); - switch_channel_set_variable(channel, "avmd_detect", "TRUE"); - switch (mode) { + s->detection_stop_time = switch_micro_time_now(); /* stop detection timer */ + detection_time = s->detection_stop_time - s->detection_start_time; /* detection time length */ + switch_channel_set_variable_printf(channel, "avmd_total_time", "[%" PRId64 "]", detection_time / 1000); + switch_channel_execute_on(channel, "execute_on_avmd_beep"); + switch_channel_set_variable(channel, "avmd_detect", "TRUE"); + switch (mode) { - case AVMD_DETECT_AMP: - v_amp = sqa_amp_b->sma - (sma_amp_b->sma * sma_amp_b->sma); /* calculate variance of amplitude (biased estimator) */ - avmd_fire_event(AVMD_EVENT_BEEP, s->session, 0, 0, sma_amp_b->sma, v_amp, 0, 0, s->detection_start_time, s->detection_stop_time, 0, 0, b->resolution, b->offset, d->idx); - if (s->settings.report_status == 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: amplitude = [%f](max [%f]) variance = [%f], detection time [%" PRId64 "] [us] >>>\n", - mode, b->resolution, b->offset, d->idx, sma_amp_b->sma, b->amplitude_max, v_amp, detection_time); - } - break; + case AVMD_DETECT_AMP: + v_amp = sqa_amp_b->sma - (sma_amp_b->sma * sma_amp_b->sma); /* calculate variance of amplitude (biased estimator) */ + avmd_fire_event(AVMD_EVENT_BEEP, s->session, 0, 0, sma_amp_b->sma, v_amp, 0, 0, s->detection_start_time, s->detection_stop_time, 0, 0, b->resolution, b->offset, d->idx); + if (s->settings.report_status == 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: amplitude = [%f](max [%f]) variance = [%f], detection time [%" PRId64 "] [us] >>>\n", + mode, b->resolution, b->offset, d->idx, sma_amp_b->sma, b->amplitude_max, v_amp, detection_time); + } + break; - case AVMD_DETECT_FREQ: - f_sma = sma_b_fir->sma; - v_fir = sqa_b_fir->sma - (sma_b_fir->sma * sma_b_fir->sma); /* calculate variance of filtered samples */ - avmd_fire_event(AVMD_EVENT_BEEP, s->session, AVMD_TO_HZ(s->rate, f_sma), v_fir, 0, 0, 0, 0, s->detection_start_time, s->detection_stop_time, 0, 0, b->resolution, b->offset, d->idx); - if (s->settings.report_status == 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: f = [%f] variance = [%f], detection time [%" PRId64 "] [us] >>>\n", - mode, b->resolution, b->offset, d->idx, AVMD_TO_HZ(s->rate, f_sma), v_fir, detection_time); - } - break; + case AVMD_DETECT_FREQ: + f_sma = sma_b_fir->sma; + v_fir = sqa_b_fir->sma - (sma_b_fir->sma * sma_b_fir->sma); /* calculate variance of filtered samples */ + avmd_fire_event(AVMD_EVENT_BEEP, s->session, AVMD_TO_HZ(s->rate, f_sma), v_fir, 0, 0, 0, 0, s->detection_start_time, s->detection_stop_time, 0, 0, b->resolution, b->offset, d->idx); + if (s->settings.report_status == 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: f = [%f] variance = [%f], detection time [%" PRId64 "] [us] >>>\n", + mode, b->resolution, b->offset, d->idx, AVMD_TO_HZ(s->rate, f_sma), v_fir, detection_time); + } + break; - case AVMD_DETECT_BOTH: - v_amp = sqa_amp_b->sma - (sma_amp_b->sma * sma_amp_b->sma); /* calculate variance of amplitude (biased estimator) */ - f_sma = sma_b_fir->sma; - v_fir = sqa_b_fir->sma - (sma_b_fir->sma * sma_b_fir->sma); /* calculate variance of filtered samples */ - avmd_fire_event(AVMD_EVENT_BEEP, s->session, AVMD_TO_HZ(s->rate, f_sma), v_fir, sma_amp_b->sma, v_amp, 0, 0, s->detection_start_time, s->detection_stop_time, 0, 0, b->resolution, b->offset, d->idx); - if (s->settings.report_status == 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: f = [%f] variance = [%f], amplitude = [%f](max [%f]) variance = [%f], detection time [%" PRId64 "] [us] >>>\n", - mode, b->resolution, b->offset, d->idx, AVMD_TO_HZ(s->rate, f_sma), v_fir, sma_amp_b->sma, b->amplitude_max, v_amp, detection_time); - } - break; + case AVMD_DETECT_BOTH: + v_amp = sqa_amp_b->sma - (sma_amp_b->sma * sma_amp_b->sma); /* calculate variance of amplitude (biased estimator) */ + f_sma = sma_b_fir->sma; + v_fir = sqa_b_fir->sma - (sma_b_fir->sma * sma_b_fir->sma); /* calculate variance of filtered samples */ + avmd_fire_event(AVMD_EVENT_BEEP, s->session, AVMD_TO_HZ(s->rate, f_sma), v_fir, sma_amp_b->sma, v_amp, 0, 0, s->detection_start_time, s->detection_stop_time, 0, 0, b->resolution, b->offset, d->idx); + if (s->settings.report_status == 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: f = [%f] variance = [%f], amplitude = [%f](max [%f]) variance = [%f], detection time [%" PRId64 "] [us] >>>\n", + mode, b->resolution, b->offset, d->idx, AVMD_TO_HZ(s->rate, f_sma), v_fir, sma_amp_b->sma, b->amplitude_max, v_amp, detection_time); + } + break; - default: - break; - } - s->state.beep_state = BEEP_DETECTED; + default: + break; + } + s->state.beep_state = BEEP_DETECTED; } static uint8_t avmd_detection_in_progress(avmd_session_t *s) { - uint8_t idx = 0; - while (idx < (s->settings.detectors_n + s->settings.detectors_lagged_n)) { - switch_mutex_lock(s->detectors[idx].mutex); - if (s->detectors[idx].flag_processing_done == 0) { - switch_mutex_unlock(s->detectors[idx].mutex); - return 1; - } - switch_mutex_unlock(s->detectors[idx].mutex); - ++idx; - } - return 0; + uint8_t idx = 0; + while (idx < (s->settings.detectors_n + s->settings.detectors_lagged_n)) { + switch_mutex_lock(s->detectors[idx].mutex); + if (s->detectors[idx].flag_processing_done == 0) { + switch_mutex_unlock(s->detectors[idx].mutex); + return 1; + } + switch_mutex_unlock(s->detectors[idx].mutex); + ++idx; + } + return 0; } static enum avmd_detection_mode avmd_detection_result(avmd_session_t *s) { - enum avmd_detection_mode res; - uint8_t idx = 0; - while (idx < (s->settings.detectors_n + s->settings.detectors_lagged_n)) { - res = s->detectors[idx].result; - if (res != AVMD_DETECT_NONE) { - avmd_report_detection(s, res, &s->detectors[idx]); - return res; - } - ++idx; - } - return AVMD_DETECT_NONE; + enum avmd_detection_mode res; + uint8_t idx = 0; + while (idx < (s->settings.detectors_n + s->settings.detectors_lagged_n)) { + res = s->detectors[idx].result; + if (res != AVMD_DETECT_NONE) { + avmd_report_detection(s, res, &s->detectors[idx]); + return res; + } + ++idx; + } + return AVMD_DETECT_NONE; } /*! \brief Process one frame of data with avmd algorithm. @@ -2051,258 +2051,258 @@ avmd_detection_result(avmd_session_t *s) { * @param frame An audio frame. */ static void avmd_process(avmd_session_t *s, switch_frame_t *frame, uint8_t direction) { - circ_buffer_t *b; - uint8_t idx; - struct avmd_detector *d; + circ_buffer_t *b; + uint8_t idx; + struct avmd_detector *d; - b = &s->b; + b = &s->b; - switch_mutex_lock(s->mutex_detectors_done); - while (avmd_detection_in_progress(s) == 1) { - switch_thread_cond_wait(s->cond_detectors_done, s->mutex_detectors_done); - } - switch_mutex_unlock(s->mutex_detectors_done); + switch_mutex_lock(s->mutex_detectors_done); + while (avmd_detection_in_progress(s) == 1) { + switch_thread_cond_wait(s->cond_detectors_done, s->mutex_detectors_done); + } + switch_mutex_unlock(s->mutex_detectors_done); - if (s->state.beep_state == BEEP_DETECTED) { /* If beep has already been detected skip the CPU heavy stuff */ - return; - } + if (s->state.beep_state == BEEP_DETECTED) { /* If beep has already been detected skip the CPU heavy stuff */ + return; + } - if (s->frame_n_to_skip > 0) { - s->frame_n_to_skip--; - return; - } + if (s->frame_n_to_skip > 0) { + s->frame_n_to_skip--; + return; + } if (s->settings.debug) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "AVMD: processing frame [%zu], direction=%s\n", s->frame_n, direction == AVMD_READ_REPLACE ? "READ" : "WRITE"); } - if (s->detection_start_time == 0) { - s->detection_start_time = switch_micro_time_now(); /* start detection timer */ - } + if (s->detection_start_time == 0) { + s->detection_start_time = switch_micro_time_now(); /* start detection timer */ + } - INSERT_INT16_FRAME(b, (int16_t *)(frame->data), frame->samples); /* Insert frame of 16 bit samples into buffer */ + INSERT_INT16_FRAME(b, (int16_t *)(frame->data), frame->samples); /* Insert frame of 16 bit samples into buffer */ - idx = 0; - while (idx < (s->settings.detectors_n + s->settings.detectors_lagged_n)) { - d = &s->detectors[idx]; - switch_mutex_lock(d->mutex); - d = &s->detectors[idx]; - if (d->result == AVMD_DETECT_NONE) { - d->flag_processing_done = 0; - d->flag_should_exit = 0; - d->samples = (s->frame_n == 0 ? frame->samples - AVMD_P : frame->samples); - switch_thread_cond_signal(d->cond_start_processing); - } - switch_mutex_unlock(d->mutex); - ++idx; - } + idx = 0; + while (idx < (s->settings.detectors_n + s->settings.detectors_lagged_n)) { + d = &s->detectors[idx]; + switch_mutex_lock(d->mutex); + d = &s->detectors[idx]; + if (d->result == AVMD_DETECT_NONE) { + d->flag_processing_done = 0; + d->flag_should_exit = 0; + d->samples = (s->frame_n == 0 ? frame->samples - AVMD_P : frame->samples); + switch_thread_cond_signal(d->cond_start_processing); + } + switch_mutex_unlock(d->mutex); + ++idx; + } - switch_mutex_lock(s->mutex_detectors_done); - while (avmd_detection_in_progress(s) == 1) { - switch_thread_cond_wait(s->cond_detectors_done, s->mutex_detectors_done); - } - avmd_detection_result(s); - switch_mutex_unlock(s->mutex_detectors_done); + switch_mutex_lock(s->mutex_detectors_done); + while (avmd_detection_in_progress(s) == 1) { + switch_thread_cond_wait(s->cond_detectors_done, s->mutex_detectors_done); + } + avmd_detection_result(s); + switch_mutex_unlock(s->mutex_detectors_done); - ++s->frame_n; - if (s->frame_n == 1) { - s->pos += frame->samples - AVMD_P; - } else { - s->pos += frame->samples; - } - s->pos &= b->mask; + ++s->frame_n; + if (s->frame_n == 1) { + s->pos += frame->samples - AVMD_P; + } else { + s->pos += frame->samples; + } + s->pos &= b->mask; - return; + return; } static void avmd_reloadxml_event_handler(switch_event_t *event) { - avmd_load_xml_configuration(avmd_globals.mutex); + avmd_load_xml_configuration(avmd_globals.mutex); } static enum avmd_detection_mode avmd_process_sample(avmd_session_t *s, circ_buffer_t *b, size_t sample_n, size_t pos, struct avmd_detector *d) { - struct avmd_buffer *buffer = &d->buffer; - uint16_t sample_to_skip_n = s->settings.sample_n_to_skip; - enum avmd_detection_mode mode = s->settings.mode; - uint8_t valid_amplitude = 1, valid_omega = 1; - double omega = 0.0, amplitude = 0.0; - double f = 0.0, f_fir = 0.0; - double v_amp = 9999.9, v_fir = 9999.9; + struct avmd_buffer *buffer = &d->buffer; + uint16_t sample_to_skip_n = s->settings.sample_n_to_skip; + enum avmd_detection_mode mode = s->settings.mode; + uint8_t valid_amplitude = 1, valid_omega = 1; + double omega = 0.0, amplitude = 0.0; + double f = 0.0, f_fir = 0.0; + double v_amp = 9999.9, v_fir = 9999.9; - sma_buffer_t *sma_b = &buffer->sma_b; - sma_buffer_t *sqa_b = &buffer->sqa_b; + sma_buffer_t *sma_b = &buffer->sma_b; + sma_buffer_t *sqa_b = &buffer->sqa_b; - sma_buffer_t *sma_b_fir = &buffer->sma_b_fir; - sma_buffer_t *sqa_b_fir = &buffer->sqa_b_fir; + sma_buffer_t *sma_b_fir = &buffer->sma_b_fir; + sma_buffer_t *sqa_b_fir = &buffer->sqa_b_fir; - sma_buffer_t *sma_amp_b = &buffer->sma_amp_b; - sma_buffer_t *sqa_amp_b = &buffer->sqa_amp_b; + sma_buffer_t *sma_amp_b = &buffer->sma_amp_b; + sma_buffer_t *sqa_amp_b = &buffer->sqa_amp_b; - if (sample_to_skip_n > 0) { - sample_to_skip_n--; - valid_amplitude = 0; - valid_omega = 0; - return AVMD_DETECT_NONE; - } + if (sample_to_skip_n > 0) { + sample_to_skip_n--; + valid_amplitude = 0; + valid_omega = 0; + return AVMD_DETECT_NONE; + } - omega = avmd_desa2_tweaked(b, pos + sample_n, &amplitude); + omega = avmd_desa2_tweaked(b, pos + sample_n, &amplitude); - if (mode == AVMD_DETECT_AMP || mode == AVMD_DETECT_BOTH) { - if (ISNAN(amplitude) || ISINF(amplitude)) { - valid_amplitude = 0; - if (s->settings.require_continuous_streak_amp == 1) { - RESET_SMA_BUFFER(sma_amp_b); - RESET_SMA_BUFFER(sqa_amp_b); - buffer->samples_streak_amp = s->settings.sample_n_continuous_streak_amp; - sample_to_skip_n = s->settings.sample_n_to_skip; - } - } else { - if (ISINF(amplitude)) { - amplitude = buffer->amplitude_max; - } - if (valid_amplitude == 1) { - APPEND_SMA_VAL(sma_amp_b, amplitude); /* append amplitude */ - APPEND_SMA_VAL(sqa_amp_b, amplitude * amplitude); - if (s->settings.require_continuous_streak_amp == 1) { - if (buffer->samples_streak_amp > 0) { - --buffer->samples_streak_amp; - valid_amplitude = 0; - } - } - } - if (sma_amp_b->sma > buffer->amplitude_max) { - buffer->amplitude_max = sma_amp_b->sma; - } - } - } + if (mode == AVMD_DETECT_AMP || mode == AVMD_DETECT_BOTH) { + if (ISNAN(amplitude) || ISINF(amplitude)) { + valid_amplitude = 0; + if (s->settings.require_continuous_streak_amp == 1) { + RESET_SMA_BUFFER(sma_amp_b); + RESET_SMA_BUFFER(sqa_amp_b); + buffer->samples_streak_amp = s->settings.sample_n_continuous_streak_amp; + sample_to_skip_n = s->settings.sample_n_to_skip; + } + } else { + if (ISINF(amplitude)) { + amplitude = buffer->amplitude_max; + } + if (valid_amplitude == 1) { + APPEND_SMA_VAL(sma_amp_b, amplitude); /* append amplitude */ + APPEND_SMA_VAL(sqa_amp_b, amplitude * amplitude); + if (s->settings.require_continuous_streak_amp == 1) { + if (buffer->samples_streak_amp > 0) { + --buffer->samples_streak_amp; + valid_amplitude = 0; + } + } + } + if (sma_amp_b->sma > buffer->amplitude_max) { + buffer->amplitude_max = sma_amp_b->sma; + } + } + } - if (mode == AVMD_DETECT_FREQ || mode == AVMD_DETECT_BOTH) { - if (ISNAN(omega)) { - valid_omega = 0; - if (s->settings.require_continuous_streak == 1) { - RESET_SMA_BUFFER(sma_b); - RESET_SMA_BUFFER(sqa_b); - RESET_SMA_BUFFER(sma_b_fir); - RESET_SMA_BUFFER(sqa_b_fir); - buffer->samples_streak = s->settings.sample_n_continuous_streak; - sample_to_skip_n = s->settings.sample_n_to_skip; - } - sample_to_skip_n = s->settings.sample_n_to_skip; - } else if (omega < -0.99999 || omega > 0.99999) { - valid_omega = 0; - if (s->settings.require_continuous_streak == 1) { - RESET_SMA_BUFFER(sma_b); - RESET_SMA_BUFFER(sqa_b); - RESET_SMA_BUFFER(sma_b_fir); - RESET_SMA_BUFFER(sqa_b_fir); - buffer->samples_streak = s->settings.sample_n_continuous_streak; - sample_to_skip_n = s->settings.sample_n_to_skip; - } - } else { - if (valid_omega) { + if (mode == AVMD_DETECT_FREQ || mode == AVMD_DETECT_BOTH) { + if (ISNAN(omega)) { + valid_omega = 0; + if (s->settings.require_continuous_streak == 1) { + RESET_SMA_BUFFER(sma_b); + RESET_SMA_BUFFER(sqa_b); + RESET_SMA_BUFFER(sma_b_fir); + RESET_SMA_BUFFER(sqa_b_fir); + buffer->samples_streak = s->settings.sample_n_continuous_streak; + sample_to_skip_n = s->settings.sample_n_to_skip; + } + sample_to_skip_n = s->settings.sample_n_to_skip; + } else if (omega < -0.99999 || omega > 0.99999) { + valid_omega = 0; + if (s->settings.require_continuous_streak == 1) { + RESET_SMA_BUFFER(sma_b); + RESET_SMA_BUFFER(sqa_b); + RESET_SMA_BUFFER(sma_b_fir); + RESET_SMA_BUFFER(sqa_b_fir); + buffer->samples_streak = s->settings.sample_n_continuous_streak; + sample_to_skip_n = s->settings.sample_n_to_skip; + } + } else { + if (valid_omega) { #if !defined(WIN32) && defined(AVMD_FAST_MATH) - f = 0.5 * (double) fast_acosf((float)omega); + f = 0.5 * (double) fast_acosf((float)omega); #else - f = 0.5 * acos(omega); + f = 0.5 * acos(omega); #endif /* !WIN32 && AVMD_FAST_MATH */ - f_fir = sma_b->pos > 1 ? (AVMD_MEDIAN_FILTER(sma_b->data[sma_b->pos - 2], sma_b->data[sma_b->pos - 1], f)) : f; + f_fir = sma_b->pos > 1 ? (AVMD_MEDIAN_FILTER(sma_b->data[sma_b->pos - 2], sma_b->data[sma_b->pos - 1], f)) : f; - APPEND_SMA_VAL(sma_b, f); /* append frequency */ - APPEND_SMA_VAL(sqa_b, f * f); - APPEND_SMA_VAL(sma_b_fir, f_fir); /* append filtered frequency */ - APPEND_SMA_VAL(sqa_b_fir, f_fir * f_fir); - if (s->settings.require_continuous_streak == 1) { - if (buffer->samples_streak > 0) { - --buffer->samples_streak; - valid_omega = 0; - } - } - } - } - } + APPEND_SMA_VAL(sma_b, f); /* append frequency */ + APPEND_SMA_VAL(sqa_b, f * f); + APPEND_SMA_VAL(sma_b_fir, f_fir); /* append filtered frequency */ + APPEND_SMA_VAL(sqa_b_fir, f_fir * f_fir); + if (s->settings.require_continuous_streak == 1) { + if (buffer->samples_streak > 0) { + --buffer->samples_streak; + valid_omega = 0; + } + } + } + } + } - if (((mode == AVMD_DETECT_AMP) || (mode == AVMD_DETECT_BOTH)) && (valid_amplitude == 1)) { - v_amp = sqa_amp_b->sma - (sma_amp_b->sma * sma_amp_b->sma); /* calculate variance of amplitude (biased estimator) */ - if ((mode == AVMD_DETECT_AMP) && (avmd_decision_amplitude(s, buffer, v_amp, AVMD_AMPLITUDE_RSD_THRESHOLD) == 1)) { - return AVMD_DETECT_AMP; - } - } - if (((mode == AVMD_DETECT_FREQ) || (mode == AVMD_DETECT_BOTH)) && (valid_omega == 1)) { - v_fir = sqa_b_fir->sma - (sma_b_fir->sma * sma_b_fir->sma); /* calculate variance of filtered samples */ - if ((mode == AVMD_DETECT_FREQ) && (avmd_decision_freq(s, buffer, v_fir, AVMD_VARIANCE_RSD_THRESHOLD) == 1)) { - return AVMD_DETECT_FREQ; - } - if (mode == AVMD_DETECT_BOTH) { - if ((avmd_decision_amplitude(s, buffer, v_amp, AVMD_AMPLITUDE_RSD_THRESHOLD) == 1) && (avmd_decision_freq(s, buffer, v_fir, AVMD_VARIANCE_RSD_THRESHOLD) == 1)) { - return AVMD_DETECT_BOTH; - } - } - } - return AVMD_DETECT_NONE; + if (((mode == AVMD_DETECT_AMP) || (mode == AVMD_DETECT_BOTH)) && (valid_amplitude == 1)) { + v_amp = sqa_amp_b->sma - (sma_amp_b->sma * sma_amp_b->sma); /* calculate variance of amplitude (biased estimator) */ + if ((mode == AVMD_DETECT_AMP) && (avmd_decision_amplitude(s, buffer, v_amp, AVMD_AMPLITUDE_RSD_THRESHOLD) == 1)) { + return AVMD_DETECT_AMP; + } + } + if (((mode == AVMD_DETECT_FREQ) || (mode == AVMD_DETECT_BOTH)) && (valid_omega == 1)) { + v_fir = sqa_b_fir->sma - (sma_b_fir->sma * sma_b_fir->sma); /* calculate variance of filtered samples */ + if ((mode == AVMD_DETECT_FREQ) && (avmd_decision_freq(s, buffer, v_fir, AVMD_VARIANCE_RSD_THRESHOLD) == 1)) { + return AVMD_DETECT_FREQ; + } + if (mode == AVMD_DETECT_BOTH) { + if ((avmd_decision_amplitude(s, buffer, v_amp, AVMD_AMPLITUDE_RSD_THRESHOLD) == 1) && (avmd_decision_freq(s, buffer, v_fir, AVMD_VARIANCE_RSD_THRESHOLD) == 1)) { + return AVMD_DETECT_BOTH; + } + } + } + return AVMD_DETECT_NONE; } static void* SWITCH_THREAD_FUNC avmd_detector_func(switch_thread_t *thread, void *arg) { - size_t sample_n = 0, samples = AVMD_P; - size_t pos; - uint8_t resolution, offset; - avmd_session_t *s; - enum avmd_detection_mode res = AVMD_DETECT_NONE; - struct avmd_detector *d; + size_t sample_n = 0, samples = AVMD_P; + size_t pos; + uint8_t resolution, offset; + avmd_session_t *s; + enum avmd_detection_mode res = AVMD_DETECT_NONE; + struct avmd_detector *d; - d = (struct avmd_detector*) arg; - s = d->s; - pos = s->pos; - while (1) { - switch_mutex_lock(d->mutex); - while ((d->flag_processing_done == 1) && (d->flag_should_exit == 0)) { - switch_thread_cond_wait(d->cond_start_processing, d->mutex); - } - /* master set processing_done flag to 0 or thread should exit */ - if (d->flag_should_exit == 1) { - d->flag_processing_done = 1; - goto end; - } - resolution = d->buffer.resolution; - offset = d->buffer.offset; - samples = d->samples; + d = (struct avmd_detector*) arg; + s = d->s; + pos = s->pos; + while (1) { + switch_mutex_lock(d->mutex); + while ((d->flag_processing_done == 1) && (d->flag_should_exit == 0)) { + switch_thread_cond_wait(d->cond_start_processing, d->mutex); + } + /* master set processing_done flag to 0 or thread should exit */ + if (d->flag_should_exit == 1) { + d->flag_processing_done = 1; + goto end; + } + resolution = d->buffer.resolution; + offset = d->buffer.offset; + samples = d->samples; - if (d->lagged == 1) { - if (d->lag > 0) { - --d->lag; - goto done; - } - pos += AVMD_P; - } + if (d->lagged == 1) { + if (d->lag > 0) { + --d->lag; + goto done; + } + pos += AVMD_P; + } - switch_mutex_unlock(d->mutex); - sample_n = 1; - while (sample_n <= samples) { - if (((sample_n + offset) % resolution) == 0) { - res = avmd_process_sample(d->s, &s->b, sample_n, pos, d); - if (res != AVMD_DETECT_NONE) { - break; - } - } - ++sample_n; - } - switch_mutex_lock(d->mutex); + switch_mutex_unlock(d->mutex); + sample_n = 1; + while (sample_n <= samples) { + if (((sample_n + offset) % resolution) == 0) { + res = avmd_process_sample(d->s, &s->b, sample_n, pos, d); + if (res != AVMD_DETECT_NONE) { + break; + } + } + ++sample_n; + } + switch_mutex_lock(d->mutex); done: - d->flag_processing_done = 1; - d->result = res; - switch_mutex_unlock(d->mutex); + d->flag_processing_done = 1; + d->result = res; + switch_mutex_unlock(d->mutex); - switch_mutex_lock(s->mutex_detectors_done); - switch_thread_cond_signal(s->cond_detectors_done); - switch_mutex_unlock(s->mutex_detectors_done); - } - return NULL; + switch_mutex_lock(s->mutex_detectors_done); + switch_thread_cond_signal(s->cond_detectors_done); + switch_mutex_unlock(s->mutex_detectors_done); + } + return NULL; end: - switch_mutex_unlock(d->mutex); - return NULL; + switch_mutex_unlock(d->mutex); + return NULL; } diff --git a/src/mod/applications/mod_avmd/scripts/avmd_get_events.pl b/src/mod/applications/mod_avmd/scripts/avmd_get_events.pl index 80d0caeb6d..f66f41a6d8 100644 --- a/src/mod/applications/mod_avmd/scripts/avmd_get_events.pl +++ b/src/mod/applications/mod_avmd/scripts/avmd_get_events.pl @@ -19,18 +19,18 @@ my $pass = "ClueCon"; my $format = "plain"; if ($#ARGV + 1 eq 1) { - $format = $ARGV[0]; - print "Using format: [" .$format ."]\n"; + $format = $ARGV[0]; + print "Using format: [" .$format ."]\n"; } -my $con = new ESL::ESLconnection($host, $port, $pass); +my $con = new ESL::ESLconnection($host, $port, $pass); if (!$con) { - die "Unable to establish connection to $host:$port\n"; + die "Unable to establish connection to $host:$port\n"; } if ($con->connected()) { - print "OK, Connected.\n"; + print "OK, Connected.\n"; } else { - die "Conenction failure.\n"; + die "Conenction failure.\n"; } print "Subscribing to avmd events...\n"; @@ -40,17 +40,17 @@ $con->events("plain", "CUSTOM avmd::beep"); print "Waiting for the events...\n"; while($con->connected()) { - my $e = $con->recvEvent(); - my $avmd_event_type = ""; - $avmd_event_type = $e->getHeader("Event-Subclass"); - if ($avmd_event_type eq 'avmd::start') { # mark nicely the start of new session and event streak - most likely there will be other events from this session coming after this one - print "\n--------------------\n\n"; - } - if ($e) { - my $body = $e->serialize($format); - print $body; - print "\n\n"; - } + my $e = $con->recvEvent(); + my $avmd_event_type = ""; + $avmd_event_type = $e->getHeader("Event-Subclass"); + if ($avmd_event_type eq 'avmd::start') { # mark nicely the start of new session and event streak - most likely there will be other events from this session coming after this one + print "\n--------------------\n\n"; + } + if ($e) { + my $body = $e->serialize($format); + print $body; + print "\n\n"; + } } print "Disconnected.\n\n"; diff --git a/src/mod/applications/mod_avmd/scripts/avmd_originate.pl b/src/mod/applications/mod_avmd/scripts/avmd_originate.pl index 9cbc98ea5e..2906e4af41 100644 --- a/src/mod/applications/mod_avmd/scripts/avmd_originate.pl +++ b/src/mod/applications/mod_avmd/scripts/avmd_originate.pl @@ -25,21 +25,21 @@ my $callerid; if ($#ARGV + 1 eq 2) { - $dest = $ARGV[0]; - $callerid = $ARGV[1]; - print "Dialing [" .$dest ."] as " .$callerid ."]\n"; + $dest = $ARGV[0]; + $callerid = $ARGV[1]; + print "Dialing [" .$dest ."] as " .$callerid ."]\n"; } else { - die "Please specify destination number and caller id\n"; + die "Please specify destination number and caller id\n"; } my $con = new ESL::ESLconnection($host, $port, $pass); if (!$con) { - die "Unable to establish connection to $host:$port\n"; + die "Unable to establish connection to $host:$port\n"; } if ($con->connected()) { - print "OK, Connected.\n"; + print "OK, Connected.\n"; } else { - die "Connection failure.\n"; + die "Connection failure.\n"; } print "Subscribing to avmd events...\n"; @@ -48,42 +48,42 @@ $con->events("plain", "CUSTOM avmd::stop"); $con->events("plain", "CUSTOM avmd::beep"); while($con->connected()) { - test_once($dest, $callerid); - return 0; + test_once($dest, $callerid); + return 0; } print "Disconnected.\n\n"; sub test_once { - my ($dest, $callerid) = @_; - my $originate_string = - 'originate ' . - '{ignore_early_media=true,' . - 'origination_uuid=%s,' . - 'originate_timeout=60,' . - 'origination_caller_id_number=' . $callerid . ',' . - 'origination_caller_id_name=' . $callerid . '}'; + my ($dest, $callerid) = @_; + my $originate_string = + 'originate ' . + '{ignore_early_media=true,' . + 'origination_uuid=%s,' . + 'originate_timeout=60,' . + 'origination_caller_id_number=' . $callerid . ',' . + 'origination_caller_id_name=' . $callerid . '}'; - if(defined($endpoint)) { - $originate_string .= $endpoint; - } else { - $originate_string .= 'loopback/' . $dest . '/' . $context; - } - $originate_string .= ' ' . '&playback(' . $playback . ')'; + if(defined($endpoint)) { + $originate_string .= $endpoint; + } else { + $originate_string .= 'loopback/' . $dest . '/' . $context; + } + $originate_string .= ' ' . '&playback(' . $playback . ')'; - my $uuid = $con->api('create_uuid')->getBody(); - my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday(); - printf("Calling with uuid [%s] [%s]... [%s]\n", $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $originate_string); + my $uuid = $con->api('create_uuid')->getBody(); + my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday(); + printf("Calling with uuid [%s] [%s]... [%s]\n", $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $originate_string); - $con->bgapi(sprintf($originate_string, $uuid)); + $con->bgapi(sprintf($originate_string, $uuid)); - print "Waiting for the events...\n\n"; - while($con->connected()) { - my $e = $con->recvEvent(); - if ($e) { - my $body = $e->serialize('plain'); - print $body; - print "\n\n"; - } - } + print "Waiting for the events...\n\n"; + while($con->connected()) { + my $e = $con->recvEvent(); + if ($e) { + my $body = $e->serialize('plain'); + print $body; + print "\n\n"; + } + } } diff --git a/src/mod/applications/mod_avmd/scripts/avmd_originate_multiple.pl b/src/mod/applications/mod_avmd/scripts/avmd_originate_multiple.pl index 223cedc557..758c89deb1 100644 --- a/src/mod/applications/mod_avmd/scripts/avmd_originate_multiple.pl +++ b/src/mod/applications/mod_avmd/scripts/avmd_originate_multiple.pl @@ -32,55 +32,55 @@ my $idx = 0; if ($#ARGV + 1 eq 3) { - $dest = $ARGV[0]; - $callerid = $ARGV[1]; - $thread_n = $ARGV[2]; - print "Dialing [" .$thread_n ."] calls simultaneously to[" .$dest ."] as [" .$callerid ."]\n"; + $dest = $ARGV[0]; + $callerid = $ARGV[1]; + $thread_n = $ARGV[2]; + print "Dialing [" .$thread_n ."] calls simultaneously to[" .$dest ."] as [" .$callerid ."]\n"; } else { - die "Please specify destination number, caller id and number of calls to make\n\nExample:\n./avmd_originate_multiple.pl EXTENSION CALLER NUMBER_OF_CALLS"; + die "Please specify destination number, caller id and number of calls to make\n\nExample:\n./avmd_originate_multiple.pl EXTENSION CALLER NUMBER_OF_CALLS"; } my $con = new ESL::ESLconnection($host, $port, $pass); if (!$con) { - die "Unable to establish connection to $host:$port\n"; + die "Unable to establish connection to $host:$port\n"; } if ($con->connected()) { - print "OK, Connected.\n"; + print "OK, Connected.\n"; } else { - die "Connection failure.\n"; + die "Connection failure.\n"; } while($con->connected() && ($idx < $thread_n)) { - call_once($dest, $callerid, $idx); - $idx++; - Time::HiRes::sleep(0.11); # avoid switch_core_session.c:2265 Throttle Error! 33, switch_time.c:1227 Over Session Rate of 30! + call_once($dest, $callerid, $idx); + $idx++; + Time::HiRes::sleep(0.11); # avoid switch_core_session.c:2265 Throttle Error! 33, switch_time.c:1227 Over Session Rate of 30! } print "Disconnected.\n\n"; sub call_once { - my ($dest, $callerid, $idx) = @_; - my $originate_string = - 'originate ' . - '{ignore_early_media=true,' . - 'originator_codec=PCMA,' . - 'origination_uuid=%s,' . - 'originate_timeout=60,' . - 'origination_caller_id_number=' . $callerid . ',' . - 'origination_caller_id_name=' . $callerid . '}'; + my ($dest, $callerid, $idx) = @_; + my $originate_string = + 'originate ' . + '{ignore_early_media=true,' . + 'originator_codec=PCMA,' . + 'origination_uuid=%s,' . + 'originate_timeout=60,' . + 'origination_caller_id_number=' . $callerid . ',' . + 'origination_caller_id_name=' . $callerid . '}'; - if(defined($endpoint)) { - $originate_string = ''; - $originate_string .= $endpoint; - } else { - $originate_string .= 'loopback/' . $dest . '/' . $context; - $originate_string .= ' ' . '&playback(' . $playback . ')'; - } + if(defined($endpoint)) { + $originate_string = ''; + $originate_string .= $endpoint; + } else { + $originate_string .= 'loopback/' . $dest . '/' . $context; + $originate_string .= ' ' . '&playback(' . $playback . ')'; + } - my $uuid = $con->api('create_uuid')->getBody(); - my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday(); - printf("[%s]\tCalling with uuid [%s] [%s]... [%s]\n", $idx + 1, $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $originate_string); + my $uuid = $con->api('create_uuid')->getBody(); + my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday(); + printf("[%s]\tCalling with uuid [%s] [%s]... [%s]\n", $idx + 1, $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $originate_string); - $con->bgapi(sprintf($originate_string, $uuid)); - $con->api('uuid_setvar ' . $uuid .' execute_on_answer avmd_start'); + $con->bgapi(sprintf($originate_string, $uuid)); + $con->api('uuid_setvar ' . $uuid .' execute_on_answer avmd_start'); } diff --git a/src/mod/applications/mod_avmd/scripts/avmd_originate_multiple_loopback.pl b/src/mod/applications/mod_avmd/scripts/avmd_originate_multiple_loopback.pl index 8eb791d13c..1831d09d5f 100644 --- a/src/mod/applications/mod_avmd/scripts/avmd_originate_multiple_loopback.pl +++ b/src/mod/applications/mod_avmd/scripts/avmd_originate_multiple_loopback.pl @@ -27,51 +27,51 @@ my $idx = 0; if ($#ARGV + 1 eq 3) { - $dest = $ARGV[0]; - $callerid = $ARGV[1]; - $thread_n = $ARGV[2]; - print "Dialing [" .$thread_n ."] calls simultaneously to [loopback][" .$dest ."] as [" .$callerid ."]\n"; + $dest = $ARGV[0]; + $callerid = $ARGV[1]; + $thread_n = $ARGV[2]; + print "Dialing [" .$thread_n ."] calls simultaneously to [loopback][" .$dest ."] as [" .$callerid ."]\n"; } else { - die "Please specify destination number, caller id and number of calls to make\n"; + die "Please specify destination number, caller id and number of calls to make\n"; } my $con = new ESL::ESLconnection($host, $port, $pass); if (!$con) { - die "Unable to establish connection to $host:$port\n"; + die "Unable to establish connection to $host:$port\n"; } if ($con->connected()) { - print "OK, Connected.\n"; + print "OK, Connected.\n"; } else { - die "Connection failure.\n"; + die "Connection failure.\n"; } while($con->connected() && ($idx < $thread_n)) { - call_once($dest, $callerid, $idx); - $idx++; - Time::HiRes::sleep(0.11); # avoid switch_core_session.c:2265 Throttle Error! 33, switch_time.c:1227 Over Session Rate of 30! + call_once($dest, $callerid, $idx); + $idx++; + Time::HiRes::sleep(0.11); # avoid switch_core_session.c:2265 Throttle Error! 33, switch_time.c:1227 Over Session Rate of 30! } print "Disconnected.\n\n"; sub call_once { - my ($dest, $callerid, $idx) = @_; - my $uuid = - my $originate_string = - 'originate ' . - '{ignore_early_media=true,' . - 'originator_codec=PCMA,' . - 'origination_uuid=%s,' . - 'originate_timeout=60,' . - 'origination_caller_id_number=' . $callerid . ',' . - 'origination_caller_id_name=' . $callerid . '}'; + my ($dest, $callerid, $idx) = @_; + my $uuid = + my $originate_string = + 'originate ' . + '{ignore_early_media=true,' . + 'originator_codec=PCMA,' . + 'origination_uuid=%s,' . + 'originate_timeout=60,' . + 'origination_caller_id_number=' . $callerid . ',' . + 'origination_caller_id_name=' . $callerid . '}'; - $originate_string .= 'loopback/' . $dest . '/' . $context; - $originate_string .= ' ' . '&playback(' . $playback . ')'; + $originate_string .= 'loopback/' . $dest . '/' . $context; + $originate_string .= ' ' . '&playback(' . $playback . ')'; - my $uuid = $con->api('create_uuid')->getBody(); - my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday(); - printf("[%s]\tCalling with uuid [%s] [%s]... [%s]\n", $idx + 1, $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $originate_string); + my $uuid = $con->api('create_uuid')->getBody(); + my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday(); + printf("[%s]\tCalling with uuid [%s] [%s]... [%s]\n", $idx + 1, $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $originate_string); - $con->bgapi(sprintf($originate_string, $uuid)); - $con->api('uuid_setvar ' . $uuid .' execute_on_answer avmd_start'); + $con->bgapi(sprintf($originate_string, $uuid)); + $con->api('uuid_setvar ' . $uuid .' execute_on_answer avmd_start'); } diff --git a/src/mod/applications/mod_avmd/scripts/avmd_test.pl b/src/mod/applications/mod_avmd/scripts/avmd_test.pl index c6f63e1c09..a32bf03a53 100755 --- a/src/mod/applications/mod_avmd/scripts/avmd_test.pl +++ b/src/mod/applications/mod_avmd/scripts/avmd_test.pl @@ -1,14 +1,14 @@ #!/usr/bin/perl -w -#brief Test module avmd by calling voicemails from avmd test suite -# and print detection results to the console. -#author Piotr Gregor <piotr@dataandsignal.com> -#details If you are testing serving voicemails from dialplan then avmd -# must be set to inbound mode, either globally (by avmd set inbound -# in fs_cli) or in dialplan settings (<action application="avmd_start" -# data="inbound_channel=1,outbound_channel=0") or dynamically per call. -#date 15 Sept 2016 03:00 PM +#brief Test module avmd by calling voicemails from avmd test suite +# and print detection results to the console. +#author Piotr Gregor <piotr@dataandsignal.com> +#details If you are testing serving voicemails from dialplan then avmd +# must be set to inbound mode, either globally (by avmd set inbound +# in fs_cli) or in dialplan settings (<action application="avmd_start" +# data="inbound_channel=1,outbound_channel=0") or dynamically per call. +#date 15 Sept 2016 03:00 PM $|++; # turn on autoflush @@ -21,106 +21,106 @@ use Time::HiRes; # Hashtable of <destination number : test result expectation> pairs my %numbers = ( - 503 => "NOTDETECTED", # dual frequency (similar to single freq with varying amplitude), mode [0] AVMD_DETECT_AMP - 504 => "NOTDETECTED", - 505 => "NOTDETECTED", - 506 => "NOTDETECTED", - 507 => "NOTDETECTED", - 508 => "NOTDETECTED", - 509 => "NOTDETECTED", - 510 => "NOTDETECTED", - 511 => "NOTDETECTED", - 512 => "NOTDETECTED", - 513 => "NOTDETECTED", - 514 => "NOTDETECTED", - 515 => "NOTDETECTED", - 516 => "NOTDETECTED", - 517 => "NOTDETECTED", - 518 => "NOTDETECTED", - 519 => "NOTDETECTED", - 520 => "NOTDETECTED", - 521 => "NOTDETECTED", - 522 => "NOTDETECTED", - 523 => "NOTDETECTED", - 603 => "DETECTED", # dual frequency (similar to single freq with varying amplitude), mode [1] AVMD_DETECT_FREQ - 604 => "DETECTED", - 605 => "DETECTED", - 606 => "DETECTED", - 607 => "DETECTED", - 608 => "DETECTED", - 609 => "DETECTED", - 610 => "DETECTED", - 611 => "DETECTED", - 612 => "DETECTED", - 613 => "DETECTED", - 614 => "DETECTED", - 615 => "DETECTED", - 616 => "DETECTED", - 617 => "DETECTED", - 618 => "DETECTED", - 619 => "DETECTED", - 620 => "DETECTED", - 621 => "DETECTED", - 622 => "DETECTED", - 623 => "DETECTED", - 703 => "NOTDETECTED", # dual frequency (similar to single freq with varying amplitude), mode [2] AVMD_DETECT_BOTH - 704 => "NOTDETECTED", - 705 => "NOTDETECTED", - 706 => "NOTDETECTED", - 707 => "NOTDETECTED", - 708 => "NOTDETECTED", - 709 => "NOTDETECTED", - 710 => "NOTDETECTED", - 711 => "NOTDETECTED", - 712 => "NOTDETECTED", - 713 => "NOTDETECTED", - 714 => "NOTDETECTED", - 715 => "NOTDETECTED", - 716 => "NOTDETECTED", - 717 => "NOTDETECTED", - 718 => "NOTDETECTED", - 719 => "NOTDETECTED", - 720 => "NOTDETECTED", - 721 => "NOTDETECTED", - 722 => "NOTDETECTED", - 723 => "NOTDETECTED", - 840531000 => "DETECTED", # obscure voicemails, mode AVMD_DETECT_BOTH - 840531001 => "DETECTED", - 840531002 => "DETECTED", - 840531003 => "DETECTED", - 840531004 => "DETECTED", - 840531005 => "DETECTED", - 840531006 => "DETECTED", - 840531007 => "DETECTED", - 840531008 => "DETECTED", - 840531009 => "DETECTED", - 840531010 => "DETECTED", - 840531011 => "DETECTED", - 840531012 => "DETECTED", - 840531013 => "DETECTED", - 840531014 => "DETECTED", - 840531200 => "DETECTED", # obscure voicemails, mode AVMD_DETECT_FREQ - 840531201 => "DETECTED", - 840531202 => "DETECTED", - 840531203 => "DETECTED", - 840531204 => "DETECTED", - 840531205 => "DETECTED", - 840531206 => "DETECTED", - 840531207 => "DETECTED", - 840531208 => "DETECTED", - 840531209 => "DETECTED", - 840531210 => "DETECTED", - 840531211 => "DETECTED", - 840531212 => "DETECTED", - 840531213 => "DETECTED", - 840531214 => "DETECTED", - 840531400 => "DETECTED", # obscure voicemails ATT pack - 840531401 => "DETECTED", - 840531402 => "DETECTED", - 840531403 => "DETECTED", - 840531404 => "DETECTED", - 840531405 => "DETECTED", - 840531051 => "NOTDETECTED", # fragment of "Save tonight" by Eagle-Eye Cherry covered by D-Lete-Funk-K + 503 => "NOTDETECTED", # dual frequency (similar to single freq with varying amplitude), mode [0] AVMD_DETECT_AMP + 504 => "NOTDETECTED", + 505 => "NOTDETECTED", + 506 => "NOTDETECTED", + 507 => "NOTDETECTED", + 508 => "NOTDETECTED", + 509 => "NOTDETECTED", + 510 => "NOTDETECTED", + 511 => "NOTDETECTED", + 512 => "NOTDETECTED", + 513 => "NOTDETECTED", + 514 => "NOTDETECTED", + 515 => "NOTDETECTED", + 516 => "NOTDETECTED", + 517 => "NOTDETECTED", + 518 => "NOTDETECTED", + 519 => "NOTDETECTED", + 520 => "NOTDETECTED", + 521 => "NOTDETECTED", + 522 => "NOTDETECTED", + 523 => "NOTDETECTED", + 603 => "DETECTED", # dual frequency (similar to single freq with varying amplitude), mode [1] AVMD_DETECT_FREQ + 604 => "DETECTED", + 605 => "DETECTED", + 606 => "DETECTED", + 607 => "DETECTED", + 608 => "DETECTED", + 609 => "DETECTED", + 610 => "DETECTED", + 611 => "DETECTED", + 612 => "DETECTED", + 613 => "DETECTED", + 614 => "DETECTED", + 615 => "DETECTED", + 616 => "DETECTED", + 617 => "DETECTED", + 618 => "DETECTED", + 619 => "DETECTED", + 620 => "DETECTED", + 621 => "DETECTED", + 622 => "DETECTED", + 623 => "DETECTED", + 703 => "NOTDETECTED", # dual frequency (similar to single freq with varying amplitude), mode [2] AVMD_DETECT_BOTH + 704 => "NOTDETECTED", + 705 => "NOTDETECTED", + 706 => "NOTDETECTED", + 707 => "NOTDETECTED", + 708 => "NOTDETECTED", + 709 => "NOTDETECTED", + 710 => "NOTDETECTED", + 711 => "NOTDETECTED", + 712 => "NOTDETECTED", + 713 => "NOTDETECTED", + 714 => "NOTDETECTED", + 715 => "NOTDETECTED", + 716 => "NOTDETECTED", + 717 => "NOTDETECTED", + 718 => "NOTDETECTED", + 719 => "NOTDETECTED", + 720 => "NOTDETECTED", + 721 => "NOTDETECTED", + 722 => "NOTDETECTED", + 723 => "NOTDETECTED", + 840531000 => "DETECTED", # obscure voicemails, mode AVMD_DETECT_BOTH + 840531001 => "DETECTED", + 840531002 => "DETECTED", + 840531003 => "DETECTED", + 840531004 => "DETECTED", + 840531005 => "DETECTED", + 840531006 => "DETECTED", + 840531007 => "DETECTED", + 840531008 => "DETECTED", + 840531009 => "DETECTED", + 840531010 => "DETECTED", + 840531011 => "DETECTED", + 840531012 => "DETECTED", + 840531013 => "DETECTED", + 840531014 => "DETECTED", + 840531200 => "DETECTED", # obscure voicemails, mode AVMD_DETECT_FREQ + 840531201 => "DETECTED", + 840531202 => "DETECTED", + 840531203 => "DETECTED", + 840531204 => "DETECTED", + 840531205 => "DETECTED", + 840531206 => "DETECTED", + 840531207 => "DETECTED", + 840531208 => "DETECTED", + 840531209 => "DETECTED", + 840531210 => "DETECTED", + 840531211 => "DETECTED", + 840531212 => "DETECTED", + 840531213 => "DETECTED", + 840531214 => "DETECTED", + 840531400 => "DETECTED", # obscure voicemails ATT pack + 840531401 => "DETECTED", + 840531402 => "DETECTED", + 840531403 => "DETECTED", + 840531404 => "DETECTED", + 840531405 => "DETECTED", + 840531051 => "NOTDETECTED", # fragment of "Save tonight" by Eagle-Eye Cherry covered by D-Lete-Funk-K ); my $host = "127.0.0.1"; @@ -140,24 +140,24 @@ my $hanguped = 0; if ($#ARGV + 1 eq 1) { - $callerid = $ARGV[0]; - print "\nDialing as [" .$callerid ."]\n"; + $callerid = $ARGV[0]; + print "\nDialing as [" .$callerid ."]\n"; } elsif ($#ARGV + 1 > 1) { - die "Please specify single caller id.\n"; + die "Please specify single caller id.\n"; } else { - die "Please specify caller id.\n"; + die "Please specify caller id.\n"; } print "Connecting...\t"; my $con = new ESL::ESLconnection($host, $port, $pass); if (!$con) { - die "Unable to establish connection to $host:$port\n"; + die "Unable to establish connection to $host:$port\n"; } if ($con->connected()) { - print "OK.\n"; + print "OK.\n"; } else { - die "Connection failure.\n"; + die "Connection failure.\n"; } print "Subscribing to avmd events...\t"; @@ -171,95 +171,95 @@ printf("\nRunning [" .keys(%numbers) ."] tests.\n\n"); printf("outbound uuid | destination number | timestamp | expectation | test result | freq | f-variance | amplitude | a-variance | resolution | offset | idx\n\n"); foreach $dest (sort keys %numbers) { - if (!$con->connected()) { - last; - } - $expectation = $numbers{$dest}; - test_once($dest, $callerid, $expectation); + if (!$con->connected()) { + last; + } + $expectation = $numbers{$dest}; + test_once($dest, $callerid, $expectation); } print "Disconnected.\n\n"; if (($failed == 0) && ($hanguped == 0)) { - printf("\n\nOK. All PASS [%s]\n\n", $passed); + printf("\n\nOK. All PASS [%s]\n\n", $passed); } else { - printf("PASS [%s], FAIL [%s], HANGUP [%s]\n\n", $passed, $failed, $hanguped); + printf("PASS [%s], FAIL [%s], HANGUP [%s]\n\n", $passed, $failed, $hanguped); } sub test_once { - my ($dest, $callerid, $expectation) = @_; - my $originate_string = - 'originate ' . - '{ignore_early_media=true,' . - 'origination_uuid=%s,' . - 'originate_timeout=60,' . - 'origination_caller_id_number=' . $callerid . ',' . - 'origination_caller_id_name=' . $callerid . '}'; - my $outcome = ""; - my $result = ""; - my $event_uuid = "N/A"; - my $uuid_in = ""; - my $freq = "N/A"; - my $freq_var = "N/A"; - my $amp = "N/A"; - my $amp_var = "N/A"; - my $resolution = "N/A"; - my $offset = "N/A"; - my $idx = "N/A"; + my ($dest, $callerid, $expectation) = @_; + my $originate_string = + 'originate ' . + '{ignore_early_media=true,' . + 'origination_uuid=%s,' . + 'originate_timeout=60,' . + 'origination_caller_id_number=' . $callerid . ',' . + 'origination_caller_id_name=' . $callerid . '}'; + my $outcome = ""; + my $result = ""; + my $event_uuid = "N/A"; + my $uuid_in = ""; + my $freq = "N/A"; + my $freq_var = "N/A"; + my $amp = "N/A"; + my $amp_var = "N/A"; + my $resolution = "N/A"; + my $offset = "N/A"; + my $idx = "N/A"; - if(defined($endpoint)) { - $originate_string .= $endpoint; - } else { - $originate_string .= 'loopback/' . $dest . '/' . $context; - } - $originate_string .= ' ' . '&playback(' . $playback . ')'; + if(defined($endpoint)) { + $originate_string .= $endpoint; + } else { + $originate_string .= 'loopback/' . $dest . '/' . $context; + } + $originate_string .= ' ' . '&playback(' . $playback . ')'; - my $uuid_out = $con->api('create_uuid')->getBody(); - my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday(); + my $uuid_out = $con->api('create_uuid')->getBody(); + my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday(); - printf("[%s] [%s]", $uuid_out, $dest); - $con->bgapi(sprintf($originate_string, $uuid_out)); + printf("[%s] [%s]", $uuid_out, $dest); + $con->bgapi(sprintf($originate_string, $uuid_out)); - while($con->connected()) { - my $e = $con->recvEvent(); - if ($e) { - my $event_name = $e->getHeader("Event-Name"); - if ($event_name eq 'CUSTOM') { - my $avmd_event_type = $e->getHeader("Event-Subclass"); - if ($avmd_event_type eq 'avmd::start') { - $uuid_in = $e->getHeader("Unique-ID"); - } elsif (!($uuid_in eq "") && (($avmd_event_type eq 'avmd::beep') || ($avmd_event_type eq 'avmd::stop'))) { - $event_uuid = $e->getHeader("Unique-ID"); - if ($event_uuid eq $uuid_in) { - if ($avmd_event_type eq 'avmd::beep') { - $freq = $e->getHeader("Frequency"); - $freq_var = $e->getHeader("Frequency-variance"); - $amp = $e->getHeader("Amplitude"); - $amp_var = $e->getHeader("Amplitude-variance"); - $resolution = $e->getHeader("Detector-resolution"); - $offset = $e->getHeader("Detector-offset"); - $idx = $e->getHeader("Detector-index"); - } - $outcome = $e->getHeader("Beep-Status"); - if ($outcome eq $expectation) { - $result = "PASS"; - $passed++; - } else { - $result = "FAIL"; - $failed++; - } - last; - } - } - } elsif ($event_name eq 'CHANNEL_HANGUP') { - $event_uuid = $e->getHeader("variable_origination_uuid"); - if ((defined $event_uuid) && ($event_uuid eq $uuid_out)) { - $outcome = "HANGUP"; - $result = "HANGUP"; - $hanguped++; - last; - } - } - } - } - printf("\t[%s]\t[%s]\t\t[%s]\t[%s]HZ\t[%s]\t[%s]\t[%s]\t[%s][%s][%s]\n", POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $expectation, $result, $freq, $freq_var, $amp, $amp_var, $resolution, $offset, $idx); - Time::HiRes::sleep(0.5); # avoid switch_core_session.c:2265 Throttle Error! 33, switch_time.c:1227 Over Session Rate of 30! + while($con->connected()) { + my $e = $con->recvEvent(); + if ($e) { + my $event_name = $e->getHeader("Event-Name"); + if ($event_name eq 'CUSTOM') { + my $avmd_event_type = $e->getHeader("Event-Subclass"); + if ($avmd_event_type eq 'avmd::start') { + $uuid_in = $e->getHeader("Unique-ID"); + } elsif (!($uuid_in eq "") && (($avmd_event_type eq 'avmd::beep') || ($avmd_event_type eq 'avmd::stop'))) { + $event_uuid = $e->getHeader("Unique-ID"); + if ($event_uuid eq $uuid_in) { + if ($avmd_event_type eq 'avmd::beep') { + $freq = $e->getHeader("Frequency"); + $freq_var = $e->getHeader("Frequency-variance"); + $amp = $e->getHeader("Amplitude"); + $amp_var = $e->getHeader("Amplitude-variance"); + $resolution = $e->getHeader("Detector-resolution"); + $offset = $e->getHeader("Detector-offset"); + $idx = $e->getHeader("Detector-index"); + } + $outcome = $e->getHeader("Beep-Status"); + if ($outcome eq $expectation) { + $result = "PASS"; + $passed++; + } else { + $result = "FAIL"; + $failed++; + } + last; + } + } + } elsif ($event_name eq 'CHANNEL_HANGUP') { + $event_uuid = $e->getHeader("variable_origination_uuid"); + if ((defined $event_uuid) && ($event_uuid eq $uuid_out)) { + $outcome = "HANGUP"; + $result = "HANGUP"; + $hanguped++; + last; + } + } + } + } + printf("\t[%s]\t[%s]\t\t[%s]\t[%s]HZ\t[%s]\t[%s]\t[%s]\t[%s][%s][%s]\n", POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $expectation, $result, $freq, $freq_var, $amp, $amp_var, $resolution, $offset, $idx); + Time::HiRes::sleep(0.5); # avoid switch_core_session.c:2265 Throttle Error! 33, switch_time.c:1227 Over Session Rate of 30! } From 89cb571af9aaa1eb3a18bd4e9e17fa42f0d5c388 Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@x-y-t.cn> Date: Tue, 9 Nov 2021 16:10:07 +0800 Subject: [PATCH 462/655] [mod_vmd] fix shutdown function not being called --- src/mod/applications/mod_vmd/mod_vmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_vmd/mod_vmd.c b/src/mod/applications/mod_vmd/mod_vmd.c index 71a2dc3bc9..a4a0917404 100644 --- a/src/mod/applications/mod_vmd/mod_vmd.c +++ b/src/mod/applications/mod_vmd/mod_vmd.c @@ -123,7 +123,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_vmd_shutdown); SWITCH_STANDARD_API(vmd_api_main); SWITCH_MODULE_LOAD_FUNCTION(mod_vmd_load); -SWITCH_MODULE_DEFINITION(mod_vmd, mod_vmd_load, NULL, NULL); +SWITCH_MODULE_DEFINITION(mod_vmd, mod_vmd_load, mod_vmd_shutdown, NULL); SWITCH_STANDARD_APP(vmd_start_function); /*! Type that holds state information about the beep. */ From 78da062bd94c76362c7872ab81bd992ed4d49476 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 9 Nov 2021 19:39:13 +0300 Subject: [PATCH 463/655] [Build-System] Windows: Fix APR build dependency in unimrcp and pthread dependency in libshout. --- libs/unimrcp/libs/mpf/mpf.2017.vcxproj | 395 +++++++++--------- .../libs/mrcp-client/mrcpclient.2017.vcxproj | 255 +++++------ .../mrcp-signaling/mrcpsignaling.2017.vcxproj | 253 +++++------ libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj | 319 +++++++------- .../mrcpv2transport.2017.vcxproj | 261 ++++++------ .../libs/uni-rtsp/unirtsp.2017.vcxproj | 275 ++++++------ libs/win32/libshout/libshout.2017.vcxproj | 379 ++++++++--------- 7 files changed, 1085 insertions(+), 1052 deletions(-) diff --git a/libs/unimrcp/libs/mpf/mpf.2017.vcxproj b/libs/unimrcp/libs/mpf/mpf.2017.vcxproj index 578280ea27..4cd900b2df 100644 --- a/libs/unimrcp/libs/mpf/mpf.2017.vcxproj +++ b/libs/unimrcp/libs/mpf/mpf.2017.vcxproj @@ -1,196 +1,201 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mpf</ProjectName> - <ProjectGuid>{B5A00BFA-6083-4FAE-A097-71642D6473B5}</ProjectGuid> - <RootNamespace>mpf</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <TreatWarningAsError>false</TreatWarningAsError> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <TreatWarningAsError>false</TreatWarningAsError> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="codecs\g711\g711.c" /> - <ClCompile Include="src\mpf_activity_detector.c" /> - <ClCompile Include="src\mpf_audio_file_stream.c" /> - <ClCompile Include="src\mpf_bridge.c" /> - <ClCompile Include="src\mpf_buffer.c" /> - <ClCompile Include="src\mpf_codec_descriptor.c" /> - <ClCompile Include="src\mpf_codec_g711.c" /> - <ClCompile Include="src\mpf_codec_linear.c" /> - <ClCompile Include="src\mpf_codec_manager.c" /> - <ClCompile Include="src\mpf_context.c" /> - <ClCompile Include="src\mpf_decoder.c" /> - <ClCompile Include="src\mpf_dtmf_detector.c" /> - <ClCompile Include="src\mpf_dtmf_generator.c" /> - <ClCompile Include="src\mpf_encoder.c" /> - <ClCompile Include="src\mpf_engine.c" /> - <ClCompile Include="src\mpf_engine_factory.c" /> - <ClCompile Include="src\mpf_file_termination_factory.c" /> - <ClCompile Include="src\mpf_frame_buffer.c" /> - <ClCompile Include="src\mpf_jitter_buffer.c" /> - <ClCompile Include="src\mpf_mixer.c" /> - <ClCompile Include="src\mpf_multiplier.c" /> - <ClCompile Include="src\mpf_named_event.c" /> - <ClCompile Include="src\mpf_resampler.c" /> - <ClCompile Include="src\mpf_rtp_attribs.c" /> - <ClCompile Include="src\mpf_rtp_stream.c" /> - <ClCompile Include="src\mpf_rtp_termination_factory.c" /> - <ClCompile Include="src\mpf_scheduler.c" /> - <ClCompile Include="src\mpf_stream.c" /> - <ClCompile Include="src\mpf_termination.c" /> - <ClCompile Include="src\mpf_termination_factory.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="codecs\g711\g711.h" /> - <ClInclude Include="include\mpf.h" /> - <ClInclude Include="include\mpf_activity_detector.h" /> - <ClInclude Include="include\mpf_audio_file_descriptor.h" /> - <ClInclude Include="include\mpf_audio_file_stream.h" /> - <ClInclude Include="include\mpf_bridge.h" /> - <ClInclude Include="include\mpf_buffer.h" /> - <ClInclude Include="include\mpf_codec.h" /> - <ClInclude Include="include\mpf_codec_descriptor.h" /> - <ClInclude Include="include\mpf_codec_manager.h" /> - <ClInclude Include="include\mpf_context.h" /> - <ClInclude Include="include\mpf_decoder.h" /> - <ClInclude Include="include\mpf_dtmf_detector.h" /> - <ClInclude Include="include\mpf_dtmf_generator.h" /> - <ClInclude Include="include\mpf_encoder.h" /> - <ClInclude Include="include\mpf_engine.h" /> - <ClInclude Include="include\mpf_file_termination_factory.h" /> - <ClInclude Include="include\mpf_frame.h" /> - <ClInclude Include="include\mpf_frame_buffer.h" /> - <ClInclude Include="include\mpf_jitter_buffer.h" /> - <ClInclude Include="include\mpf_message.h" /> - <ClInclude Include="include\mpf_mixer.h" /> - <ClInclude Include="include\mpf_multiplier.h" /> - <ClInclude Include="include\mpf_named_event.h" /> - <ClInclude Include="include\mpf_object.h" /> - <ClInclude Include="include\mpf_resampler.h" /> - <ClInclude Include="include\mpf_rtcp_packet.h" /> - <ClInclude Include="include\mpf_rtp_attribs.h" /> - <ClInclude Include="include\mpf_rtp_defs.h" /> - <ClInclude Include="include\mpf_rtp_descriptor.h" /> - <ClInclude Include="include\mpf_rtp_header.h" /> - <ClInclude Include="include\mpf_rtp_pt.h" /> - <ClInclude Include="include\mpf_rtp_stat.h" /> - <ClInclude Include="include\mpf_rtp_stream.h" /> - <ClInclude Include="include\mpf_rtp_termination_factory.h" /> - <ClInclude Include="include\mpf_scheduler.h" /> - <ClInclude Include="include\mpf_stream.h" /> - <ClInclude Include="include\mpf_stream_descriptor.h" /> - <ClInclude Include="include\mpf_termination.h" /> - <ClInclude Include="include\mpf_termination_factory.h" /> - <ClInclude Include="include\mpf_types.h" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mpf</ProjectName> + <ProjectGuid>{B5A00BFA-6083-4FAE-A097-71642D6473B5}</ProjectGuid> + <RootNamespace>mpf</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <TreatWarningAsError>false</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <TreatWarningAsError>false</TreatWarningAsError> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="codecs\g711\g711.c" /> + <ClCompile Include="src\mpf_activity_detector.c" /> + <ClCompile Include="src\mpf_audio_file_stream.c" /> + <ClCompile Include="src\mpf_bridge.c" /> + <ClCompile Include="src\mpf_buffer.c" /> + <ClCompile Include="src\mpf_codec_descriptor.c" /> + <ClCompile Include="src\mpf_codec_g711.c" /> + <ClCompile Include="src\mpf_codec_linear.c" /> + <ClCompile Include="src\mpf_codec_manager.c" /> + <ClCompile Include="src\mpf_context.c" /> + <ClCompile Include="src\mpf_decoder.c" /> + <ClCompile Include="src\mpf_dtmf_detector.c" /> + <ClCompile Include="src\mpf_dtmf_generator.c" /> + <ClCompile Include="src\mpf_encoder.c" /> + <ClCompile Include="src\mpf_engine.c" /> + <ClCompile Include="src\mpf_engine_factory.c" /> + <ClCompile Include="src\mpf_file_termination_factory.c" /> + <ClCompile Include="src\mpf_frame_buffer.c" /> + <ClCompile Include="src\mpf_jitter_buffer.c" /> + <ClCompile Include="src\mpf_mixer.c" /> + <ClCompile Include="src\mpf_multiplier.c" /> + <ClCompile Include="src\mpf_named_event.c" /> + <ClCompile Include="src\mpf_resampler.c" /> + <ClCompile Include="src\mpf_rtp_attribs.c" /> + <ClCompile Include="src\mpf_rtp_stream.c" /> + <ClCompile Include="src\mpf_rtp_termination_factory.c" /> + <ClCompile Include="src\mpf_scheduler.c" /> + <ClCompile Include="src\mpf_stream.c" /> + <ClCompile Include="src\mpf_termination.c" /> + <ClCompile Include="src\mpf_termination_factory.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="codecs\g711\g711.h" /> + <ClInclude Include="include\mpf.h" /> + <ClInclude Include="include\mpf_activity_detector.h" /> + <ClInclude Include="include\mpf_audio_file_descriptor.h" /> + <ClInclude Include="include\mpf_audio_file_stream.h" /> + <ClInclude Include="include\mpf_bridge.h" /> + <ClInclude Include="include\mpf_buffer.h" /> + <ClInclude Include="include\mpf_codec.h" /> + <ClInclude Include="include\mpf_codec_descriptor.h" /> + <ClInclude Include="include\mpf_codec_manager.h" /> + <ClInclude Include="include\mpf_context.h" /> + <ClInclude Include="include\mpf_decoder.h" /> + <ClInclude Include="include\mpf_dtmf_detector.h" /> + <ClInclude Include="include\mpf_dtmf_generator.h" /> + <ClInclude Include="include\mpf_encoder.h" /> + <ClInclude Include="include\mpf_engine.h" /> + <ClInclude Include="include\mpf_file_termination_factory.h" /> + <ClInclude Include="include\mpf_frame.h" /> + <ClInclude Include="include\mpf_frame_buffer.h" /> + <ClInclude Include="include\mpf_jitter_buffer.h" /> + <ClInclude Include="include\mpf_message.h" /> + <ClInclude Include="include\mpf_mixer.h" /> + <ClInclude Include="include\mpf_multiplier.h" /> + <ClInclude Include="include\mpf_named_event.h" /> + <ClInclude Include="include\mpf_object.h" /> + <ClInclude Include="include\mpf_resampler.h" /> + <ClInclude Include="include\mpf_rtcp_packet.h" /> + <ClInclude Include="include\mpf_rtp_attribs.h" /> + <ClInclude Include="include\mpf_rtp_defs.h" /> + <ClInclude Include="include\mpf_rtp_descriptor.h" /> + <ClInclude Include="include\mpf_rtp_header.h" /> + <ClInclude Include="include\mpf_rtp_pt.h" /> + <ClInclude Include="include\mpf_rtp_stat.h" /> + <ClInclude Include="include\mpf_rtp_stream.h" /> + <ClInclude Include="include\mpf_rtp_termination_factory.h" /> + <ClInclude Include="include\mpf_scheduler.h" /> + <ClInclude Include="include\mpf_stream.h" /> + <ClInclude Include="include\mpf_stream_descriptor.h" /> + <ClInclude Include="include\mpf_termination.h" /> + <ClInclude Include="include\mpf_termination_factory.h" /> + <ClInclude Include="include\mpf_types.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> + <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> </Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj index d00e3d66dc..e5cfaa0b33 100644 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj @@ -1,126 +1,131 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcpclient</ProjectName> - <ProjectGuid>{72782932-37CC-46AE-8C7F-9A7B1A6EE108}</ProjectGuid> - <RootNamespace>mrcpclient</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_application.h" /> - <ClInclude Include="include\mrcp_client.h" /> - <ClInclude Include="include\mrcp_client_session.h" /> - <ClInclude Include="include\mrcp_client_types.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_application.c" /> - <ClCompile Include="src\mrcp_client.c" /> - <ClCompile Include="src\mrcp_client_session.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mrcpclient</ProjectName> + <ProjectGuid>{72782932-37CC-46AE-8C7F-9A7B1A6EE108}</ProjectGuid> + <RootNamespace>mrcpclient</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="include\mrcp_application.h" /> + <ClInclude Include="include\mrcp_client.h" /> + <ClInclude Include="include\mrcp_client_session.h" /> + <ClInclude Include="include\mrcp_client_types.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\mrcp_application.c" /> + <ClCompile Include="src\mrcp_client.c" /> + <ClCompile Include="src\mrcp_client_session.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> + <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> </Project> \ 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 index 8325ee4df4..d8f8525d72 100644 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj @@ -1,125 +1,130 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcpsignaling</ProjectName> - <ProjectGuid>{12A49562-BAB9-43A3-A21D-15B60BBB4C31}</ProjectGuid> - <RootNamespace>mrcpsignaling</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_session.h" /> - <ClInclude Include="include\mrcp_session_descriptor.h" /> - <ClInclude Include="include\mrcp_sig_agent.h" /> - <ClInclude Include="include\mrcp_sig_types.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_session_descriptor.c" /> - <ClCompile Include="src\mrcp_sig_agent.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mrcpsignaling</ProjectName> + <ProjectGuid>{12A49562-BAB9-43A3-A21D-15B60BBB4C31}</ProjectGuid> + <RootNamespace>mrcpsignaling</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="include\mrcp_session.h" /> + <ClInclude Include="include\mrcp_session_descriptor.h" /> + <ClInclude Include="include\mrcp_sig_agent.h" /> + <ClInclude Include="include\mrcp_sig_types.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\mrcp_session_descriptor.c" /> + <ClCompile Include="src\mrcp_sig_agent.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> + <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> </Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj index 0e1d64d533..d2420fde7c 100644 --- a/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj +++ b/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj @@ -1,158 +1,163 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcp</ProjectName> - <ProjectGuid>{1C320193-46A6-4B34-9C56-8AB584FC1B56}</ProjectGuid> - <RootNamespace>mrcp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp.h" /> - <ClInclude Include="include\mrcp_types.h" /> - <ClInclude Include="message\include\mrcp_generic_header.h" /> - <ClInclude Include="message\include\mrcp__header.h" /> - <ClInclude Include="message\include\mrcp_header_accessor.h" /> - <ClInclude Include="message\include\mrcp_message.h" /> - <ClInclude Include="message\include\mrcp_start_line.h" /> - <ClInclude Include="control\include\mrcp_resource.h" /> - <ClInclude Include="control\include\mrcp_resource_factory.h" /> - <ClInclude Include="control\include\mrcp_resource_loader.h" /> - <ClInclude Include="control\include\mrcp_stream.h" /> - <ClInclude Include="resources\include\mrcp_recog_header.h" /> - <ClInclude Include="resources\include\mrcp_recog_resource.h" /> - <ClInclude Include="resources\include\mrcp_recorder_header.h" /> - <ClInclude Include="resources\include\mrcp_recorder_resource.h" /> - <ClInclude Include="resources\include\mrcp_synth_header.h" /> - <ClInclude Include="resources\include\mrcp_synth_resource.h" /> - <ClInclude Include="resources\include\mrcp_verifier_header.h" /> - <ClInclude Include="resources\include\mrcp_verifier_resource.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="message\src\mrcp_generic_header.c" /> - <ClCompile Include="message\src\mrcp_header.c" /> - <ClCompile Include="message\src\mrcp_header_accessor.c" /> - <ClCompile Include="message\src\mrcp_message.c" /> - <ClCompile Include="message\src\mrcp_start_line.c" /> - <ClCompile Include="control\src\mrcp_resource_factory.c" /> - <ClCompile Include="control\src\mrcp_resource_loader.c" /> - <ClCompile Include="control\src\mrcp_stream.c" /> - <ClCompile Include="resources\src\mrcp_recog_header.c" /> - <ClCompile Include="resources\src\mrcp_recog_resource.c" /> - <ClCompile Include="resources\src\mrcp_recorder_header.c" /> - <ClCompile Include="resources\src\mrcp_recorder_resource.c" /> - <ClCompile Include="resources\src\mrcp_synth_header.c" /> - <ClCompile Include="resources\src\mrcp_synth_resource.c" /> - <ClCompile Include="resources\src\mrcp_verifier_header.c" /> - <ClCompile Include="resources\src\mrcp_verifier_resource.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mrcp</ProjectName> + <ProjectGuid>{1C320193-46A6-4B34-9C56-8AB584FC1B56}</ProjectGuid> + <RootNamespace>mrcp</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="include\mrcp.h" /> + <ClInclude Include="include\mrcp_types.h" /> + <ClInclude Include="message\include\mrcp_generic_header.h" /> + <ClInclude Include="message\include\mrcp__header.h" /> + <ClInclude Include="message\include\mrcp_header_accessor.h" /> + <ClInclude Include="message\include\mrcp_message.h" /> + <ClInclude Include="message\include\mrcp_start_line.h" /> + <ClInclude Include="control\include\mrcp_resource.h" /> + <ClInclude Include="control\include\mrcp_resource_factory.h" /> + <ClInclude Include="control\include\mrcp_resource_loader.h" /> + <ClInclude Include="control\include\mrcp_stream.h" /> + <ClInclude Include="resources\include\mrcp_recog_header.h" /> + <ClInclude Include="resources\include\mrcp_recog_resource.h" /> + <ClInclude Include="resources\include\mrcp_recorder_header.h" /> + <ClInclude Include="resources\include\mrcp_recorder_resource.h" /> + <ClInclude Include="resources\include\mrcp_synth_header.h" /> + <ClInclude Include="resources\include\mrcp_synth_resource.h" /> + <ClInclude Include="resources\include\mrcp_verifier_header.h" /> + <ClInclude Include="resources\include\mrcp_verifier_resource.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="message\src\mrcp_generic_header.c" /> + <ClCompile Include="message\src\mrcp_header.c" /> + <ClCompile Include="message\src\mrcp_header_accessor.c" /> + <ClCompile Include="message\src\mrcp_message.c" /> + <ClCompile Include="message\src\mrcp_start_line.c" /> + <ClCompile Include="control\src\mrcp_resource_factory.c" /> + <ClCompile Include="control\src\mrcp_resource_loader.c" /> + <ClCompile Include="control\src\mrcp_stream.c" /> + <ClCompile Include="resources\src\mrcp_recog_header.c" /> + <ClCompile Include="resources\src\mrcp_recog_resource.c" /> + <ClCompile Include="resources\src\mrcp_recorder_header.c" /> + <ClCompile Include="resources\src\mrcp_recorder_resource.c" /> + <ClCompile Include="resources\src\mrcp_synth_header.c" /> + <ClCompile Include="resources\src\mrcp_synth_resource.c" /> + <ClCompile Include="resources\src\mrcp_verifier_header.c" /> + <ClCompile Include="resources\src\mrcp_verifier_resource.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> + <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> </Project> \ 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 index a694094969..40a20105bf 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj @@ -1,129 +1,134 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcpv2transport</ProjectName> - <ProjectGuid>{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}</ProjectGuid> - <RootNamespace>mrcpv2transport</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_client_connection.h" /> - <ClInclude Include="include\mrcp_connection.h" /> - <ClInclude Include="include\mrcp_connection_types.h" /> - <ClInclude Include="include\mrcp_control_descriptor.h" /> - <ClInclude Include="include\mrcp_server_connection.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_ca_factory.c" /> - <ClCompile Include="src\mrcp_client_connection.c" /> - <ClCompile Include="src\mrcp_connection.c" /> - <ClCompile Include="src\mrcp_control_descriptor.c" /> - <ClCompile Include="src\mrcp_server_connection.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mrcpv2transport</ProjectName> + <ProjectGuid>{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}</ProjectGuid> + <RootNamespace>mrcpv2transport</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="include\mrcp_client_connection.h" /> + <ClInclude Include="include\mrcp_connection.h" /> + <ClInclude Include="include\mrcp_connection_types.h" /> + <ClInclude Include="include\mrcp_control_descriptor.h" /> + <ClInclude Include="include\mrcp_server_connection.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\mrcp_ca_factory.c" /> + <ClCompile Include="src\mrcp_client_connection.c" /> + <ClCompile Include="src\mrcp_connection.c" /> + <ClCompile Include="src\mrcp_control_descriptor.c" /> + <ClCompile Include="src\mrcp_server_connection.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> + <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> </Project> \ 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 index 1ae73fcb7f..1b368a09e6 100644 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj @@ -1,136 +1,141 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>unirtsp</ProjectName> - <ProjectGuid>{504B3154-7A4F-459D-9877-B951021C3F1F}</ProjectGuid> - <RootNamespace>unirtsp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\rtsp.h" /> - <ClInclude Include="include\rtsp_client.h" /> - <ClInclude Include="include\rtsp_header.h" /> - <ClInclude Include="include\rtsp_message.h" /> - <ClInclude Include="include\rtsp_server.h" /> - <ClInclude Include="include\rtsp_start_line.h" /> - <ClInclude Include="include\rtsp_stream.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\rtsp_client.c" /> - <ClCompile Include="src\rtsp_header.c" /> - <ClCompile Include="src\rtsp_message.c" /> - <ClCompile Include="src\rtsp_server.c" /> - <ClCompile Include="src\rtsp_start_line.c" /> - <ClCompile Include="src\rtsp_stream.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>unirtsp</ProjectName> + <ProjectGuid>{504B3154-7A4F-459D-9877-B951021C3F1F}</ProjectGuid> + <RootNamespace>unirtsp</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> + <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> + <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="include\rtsp.h" /> + <ClInclude Include="include\rtsp_client.h" /> + <ClInclude Include="include\rtsp_header.h" /> + <ClInclude Include="include\rtsp_message.h" /> + <ClInclude Include="include\rtsp_server.h" /> + <ClInclude Include="include\rtsp_start_line.h" /> + <ClInclude Include="include\rtsp_stream.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\rtsp_client.c" /> + <ClCompile Include="src\rtsp_header.c" /> + <ClCompile Include="src\rtsp_message.c" /> + <ClCompile Include="src\rtsp_server.c" /> + <ClCompile Include="src\rtsp_start_line.c" /> + <ClCompile Include="src\rtsp_stream.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> + <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> </Project> \ No newline at end of file diff --git a/libs/win32/libshout/libshout.2017.vcxproj b/libs/win32/libshout/libshout.2017.vcxproj index bf298a4238..c7790e7f0f 100644 --- a/libs/win32/libshout/libshout.2017.vcxproj +++ b/libs/win32/libshout/libshout.2017.vcxproj @@ -1,189 +1,192 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}</ProjectGuid> - <RootNamespace>libshout</RootNamespace> - <ProjectName>libshout</ProjectName> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <Import Project="$(SolutionDir)\w32\download_libshout.props" Condition=" '$(downloadlibshoutPropsImported)' == '' " /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extlib.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <AdditionalIncludeDirectories>.\;..\..\libshout-2.2.2\src;..\..\libshout-2.2.2\include;..\..\libogg-1.1.3\include;..\..\pthreads-w32-2-9-1;..\..\libshout-2.2.2\win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_TIMESPEC_DEFINED;WIN32;_LIB;_WIN32;VERSION="2.0.0";LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <FunctionLevelLinking>true</FunctionLevelLinking> - <WarningLevel>TurnOffAllWarnings</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - </ResourceCompile> - <Lib> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Lib> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <AdditionalIncludeDirectories>.\;..\..\libshout-2.2.2\src;..\..\libshout-2.2.2\include;..\..\libogg-1.1.3\include;..\..\pthreads-w32-2-9-1;..\..\libshout-2.2.2\win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_TIMESPEC_DEFINED;WIN32;_LIB;_WIN32;VERSION="2.0.0";LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <FunctionLevelLinking>true</FunctionLevelLinking> - <WarningLevel>TurnOffAllWarnings</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - </ResourceCompile> - <Lib> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Lib> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>.\;..\..\libshout-2.2.2\src;..\..\libshout-2.2.2\include;..\..\libogg-1.1.3\include;..\..\pthreads-w32-2-9-1;..\..\libshout-2.2.2\win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_TIMESPEC_DEFINED;WIN32;_DEBUG;_LIB;_WIN32;VERSION="2.0.0";LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <WarningLevel>TurnOffAllWarnings</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - </ResourceCompile> - <Lib> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Lib> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>.\;..\..\libshout-2.2.2\src;..\..\libshout-2.2.2\include;..\..\libogg-1.1.3\include;..\..\pthreads-w32-2-9-1;..\..\libshout-2.2.2\win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_TIMESPEC_DEFINED;WIN32;_DEBUG;_LIB;_WIN32;VERSION="2.0.0";LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <WarningLevel>TurnOffAllWarnings</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - </ResourceCompile> - <Lib> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Lib> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\libshout-2.2.2\src\avl\avl.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\httpp\httpp.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\mp3.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\ogg.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\net\resolver.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\shout.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\net\sock.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\thread\thread.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\timing\timing.c" /> - <ClCompile Include="..\..\libshout-2.2.2\src\util.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\libshout-2.2.2\src\avl\avl.h" /> - <ClInclude Include="..\..\libshout-2.2.2\src\httpp\httpp.h" /> - <ClInclude Include="..\..\libshout-2.2.2\src\net\resolver.h" /> - <ClInclude Include="..\..\libshout-2.2.2\src\shout_ogg.h" /> - <ClInclude Include="..\..\libshout-2.2.2\src\shout_private.h" /> - <ClInclude Include="..\..\libshout-2.2.2\src\net\sock.h" /> - <ClInclude Include="..\..\libshout-2.2.2\src\thread\thread.h" /> - <ClInclude Include="..\..\libshout-2.2.2\src\timing\timing.h" /> - <ClInclude Include="..\..\libshout-2.2.2\src\util.h" /> - <ClInclude Include="..\..\libshout-2.2.2\include\os.h" /> - <ClInclude Include="shout\shout.h" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\libogg\libogg.2017.vcxproj"> - <Project>{0feeaec6-4399-4c46-b7db-62ece80d15b4}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}</ProjectGuid> + <RootNamespace>libshout</RootNamespace> + <ProjectName>libshout</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <Import Project="$(SolutionDir)\w32\download_libshout.props" Condition=" '$(downloadlibshoutPropsImported)' == '' " /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extlib.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extlib.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extlib.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extlib.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <AdditionalIncludeDirectories>.\;..\..\libshout-2.2.2\src;..\..\libshout-2.2.2\include;..\..\libogg-1.1.3\include;..\..\pthreads-w32-2-9-1;..\..\libshout-2.2.2\win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_TIMESPEC_DEFINED;WIN32;_LIB;_WIN32;VERSION="2.0.0";LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Lib> + <SuppressStartupBanner>true</SuppressStartupBanner> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <AdditionalIncludeDirectories>.\;..\..\libshout-2.2.2\src;..\..\libshout-2.2.2\include;..\..\libogg-1.1.3\include;..\..\pthreads-w32-2-9-1;..\..\libshout-2.2.2\win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_TIMESPEC_DEFINED;WIN32;_LIB;_WIN32;VERSION="2.0.0";LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Lib> + <SuppressStartupBanner>true</SuppressStartupBanner> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.\;..\..\libshout-2.2.2\src;..\..\libshout-2.2.2\include;..\..\libogg-1.1.3\include;..\..\pthreads-w32-2-9-1;..\..\libshout-2.2.2\win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_TIMESPEC_DEFINED;WIN32;_DEBUG;_LIB;_WIN32;VERSION="2.0.0";LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Lib> + <SuppressStartupBanner>true</SuppressStartupBanner> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.\;..\..\libshout-2.2.2\src;..\..\libshout-2.2.2\include;..\..\libogg-1.1.3\include;..\..\pthreads-w32-2-9-1;..\..\libshout-2.2.2\win32\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_TIMESPEC_DEFINED;WIN32;_DEBUG;_LIB;_WIN32;VERSION="2.0.0";LIBSHOUT_MAJOR=2;LIBSHOUT_MINOR=0;LIBSHOUT_MICRO=0;HAVE_WINSOCK2_H;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>TurnOffAllWarnings</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Lib> + <SuppressStartupBanner>true</SuppressStartupBanner> + </Lib> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\libshout-2.2.2\src\avl\avl.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\httpp\httpp.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\mp3.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\ogg.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\net\resolver.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\shout.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\net\sock.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\thread\thread.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\timing\timing.c" /> + <ClCompile Include="..\..\libshout-2.2.2\src\util.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\libshout-2.2.2\src\avl\avl.h" /> + <ClInclude Include="..\..\libshout-2.2.2\src\httpp\httpp.h" /> + <ClInclude Include="..\..\libshout-2.2.2\src\net\resolver.h" /> + <ClInclude Include="..\..\libshout-2.2.2\src\shout_ogg.h" /> + <ClInclude Include="..\..\libshout-2.2.2\src\shout_private.h" /> + <ClInclude Include="..\..\libshout-2.2.2\src\net\sock.h" /> + <ClInclude Include="..\..\libshout-2.2.2\src\thread\thread.h" /> + <ClInclude Include="..\..\libshout-2.2.2\src\timing\timing.h" /> + <ClInclude Include="..\..\libshout-2.2.2\src\util.h" /> + <ClInclude Include="..\..\libshout-2.2.2\include\os.h" /> + <ClInclude Include="shout\shout.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\libogg\libogg.2017.vcxproj"> + <Project>{0feeaec6-4399-4c46-b7db-62ece80d15b4}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\pthread\pthread.2017.vcxproj"> + <Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> </Project> \ No newline at end of file From fbf2da44d9ba7980bf057c8fc8f4e1603ea1257d Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 5 Nov 2021 23:59:57 +0300 Subject: [PATCH 464/655] [Core] Fix use of private headers. --- Makefile.am | 2 + build/modmake.rules.in | 6 ++- libs/.gitignore | 3 +- src/include/private/switch_apr_pvt.h | 66 +++++++++++++++++++++++++ src/include/private/switch_core_pvt.h | 22 +-------- src/include/switch.h | 1 + src/include/switch_spandsp.h | 54 ++++++++++++++++++++ src/include/switch_types.h | 1 + src/switch.c | 1 + src/switch_core.c | 1 + src/switch_core_io.c | 8 +-- src/switch_core_media.c | 2 + src/switch_core_memory.c | 1 + src/switch_core_session.c | 2 +- src/switch_spandsp.c | 65 ++++++++++++++++++++++++ src/switch_time.c | 1 + src/switch_utils.c | 1 + tests/unit/.gitignore | 3 ++ w32/Library/FreeSwitchCore.2017.vcxproj | 2 + 19 files changed, 213 insertions(+), 29 deletions(-) create mode 100644 src/include/private/switch_apr_pvt.h create mode 100644 src/include/switch_spandsp.h create mode 100644 src/switch_spandsp.c diff --git a/Makefile.am b/Makefile.am index 3bf9cbd048..739bd29ecb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -310,6 +310,7 @@ library_include_HEADERS = \ src/include/switch_jitterbuffer.h \ src/include/switch_estimators.h \ src/include/switch_rtcp_frame.h \ + src/include/switch_spandsp.h \ src/include/switch_stun.h \ src/include/switch_nat.h \ src/include/switch_log.h \ @@ -385,6 +386,7 @@ libfreeswitch_la_SOURCES = \ src/switch_ivr_say.c \ src/switch_ivr_menu.c \ src/switch_ivr.c \ + src/switch_spandsp.c \ src/switch_stun.c \ src/switch_nat.c \ src/switch_log.c \ diff --git a/build/modmake.rules.in b/build/modmake.rules.in index dbce9bd48e..7f880b86f9 100644 --- a/build/modmake.rules.in +++ b/build/modmake.rules.in @@ -188,7 +188,7 @@ $(MODNAME).o: $(MODDIR)/$(SOURCEFILE) \ $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \ $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \ $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \ - $(switch_srcdir)/src/include/switch_xml.h + $(switch_srcdir)/src/include/switch_xml.h $(switch_srcdir)/src/include/switch_spandsp.h @echo Compiling $<... if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \ if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\ @@ -211,7 +211,7 @@ $(MODNAME).lo: $(MODDIR)/$(SOURCEFILE) \ $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \ $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \ $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \ - $(switch_srcdir)/src/include/switch_xml.h + $(switch_srcdir)/src/include/switch_xml.h $(switch_srcdir)/src/include/switch_spandsp.h @echo Compiling $<... if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \ if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\ @@ -261,6 +261,8 @@ $(switch_srcdir)/src/include/switch_ivr.h: $(switch_srcdir)/src/include/switch_rtp.h: +$(switch_srcdir)/src/include/switch_spandsp.h: + $(switch_srcdir)/src/include/switch_stun.h: $(switch_srcdir)/src/include/switch_log.h: diff --git a/libs/.gitignore b/libs/.gitignore index 5a83438d92..355bae9a6d 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -793,4 +793,5 @@ mariadb-connector-c-*/ mariadb-connector-c-* /spandsp*/ /spandsp* -win32/spandsp/spandsp.h \ No newline at end of file +win32/spandsp/spandsp.h +win32/spandsp/win32 \ No newline at end of file diff --git a/src/include/private/switch_apr_pvt.h b/src/include/private/switch_apr_pvt.h new file mode 100644 index 0000000000..ae4dc9c995 --- /dev/null +++ b/src/include/private/switch_apr_pvt.h @@ -0,0 +1,66 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II <anthm@freeswitch.org> + * Andrey Volk <andywolk@gmail.com> + * + * + * switch_apr_pvt.h - APR + * + */ + +#ifndef __SWITCH_APR_PVT_H__ +#define __SWITCH_APR_PVT_H__ + +/* for apr_pool_create and apr_pool_destroy */ +/* functions only used in this file so not exposed */ +#include <apr_pools.h> + +/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */ +/* functions only used in this file so not exposed */ +#include <apr_hash.h> + +/* for apr_pvsprintf */ +/* function only used in this file so not exposed */ +#include <apr_strings.h> + +/* for apr_initialize and apr_terminate */ +/* function only used in this file so not exposed */ +#include <apr_general.h> + +#include <apr_portable.h> + +#endif // __SWITCH_APR_PVT_H__ + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: + */ diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index aece2e7e17..af6a4f53bd 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -32,32 +32,12 @@ * this file does not exist!!!! * */ -#define SPANDSP_NO_TIFF 1 -#include "spandsp.h" #include "switch_profile.h" #ifndef WIN32 #include <switch_private.h> #endif -/* for apr_pool_create and apr_pool_destroy */ -/* functions only used in this file so not exposed */ -#include <apr_pools.h> - -/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */ -/* functions only used in this file so not exposed */ -#include <apr_hash.h> - -/* for apr_pvsprintf */ -/* function only used in this file so not exposed */ -#include <apr_strings.h> - -/* for apr_initialize and apr_terminate */ -/* function only used in this file so not exposed */ -#include <apr_general.h> - -#include <apr_portable.h> - #ifdef HAVE_MLOCKALL #include <sys/mman.h> #endif @@ -175,7 +155,7 @@ struct switch_core_session { switch_log_level_t loglevel; uint32_t soft_lock; switch_ivr_dmachine_t *dmachine[2]; - plc_state_t *plc; + switch_plc_state_t *plc; switch_media_handle_t *media_handle; uint32_t decoder_errors; diff --git a/src/include/switch.h b/src/include/switch.h index 461914c93b..b7bae46c0e 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -112,6 +112,7 @@ #include "switch_platform.h" #include "switch_types.h" #include "switch_apr.h" +#include "switch_spandsp.h" #include "switch_mprintf.h" #include "switch_core_db.h" #include "switch_dso.h" diff --git a/src/include/switch_spandsp.h b/src/include/switch_spandsp.h new file mode 100644 index 0000000000..1818a00825 --- /dev/null +++ b/src/include/switch_spandsp.h @@ -0,0 +1,54 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org> + * + * 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 <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II <anthm@freeswitch.org> + * Andrey Volk <andrey@signalwire.com> + * + * switch_spandsp.h -- SpanDSP includes header + * + */ +#ifndef SWITCH_SPANDSP_H +#define SWITCH_SPANDSP_H + +SWITCH_BEGIN_EXTERN_C + +SWITCH_DECLARE(switch_plc_state_t *) switch_plc_init(switch_plc_state_t *s); +SWITCH_DECLARE(int) switch_plc_free(switch_plc_state_t *s); +SWITCH_DECLARE(int) switch_plc_rx(switch_plc_state_t *s, int16_t amp[], int len); +SWITCH_DECLARE(int) switch_plc_fillin(switch_plc_state_t *s, int16_t amp[], int len); + +SWITCH_END_EXTERN_C +#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/src/include/switch_types.h b/src/include/switch_types.h index bb06cfa0ea..b8405511d8 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -2324,6 +2324,7 @@ typedef int switch_os_socket_t; #endif typedef struct apr_pool_t switch_memory_pool_t; +typedef void* switch_plc_state_t; typedef uint16_t switch_port_t; typedef uint8_t switch_payload_t; typedef struct switch_app_log switch_app_log_t; diff --git a/src/switch.c b/src/switch.c index d10994c4c2..2f5274099e 100644 --- a/src/switch.c +++ b/src/switch.c @@ -49,6 +49,7 @@ #endif #include <switch.h> +#include "private/switch_apr_pvt.h" #include "private/switch_core_pvt.h" /* pid filename: Stores the process id of the freeswitch process */ diff --git a/src/switch_core.c b/src/switch_core.c index 50ce348c95..4953964a38 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -41,6 +41,7 @@ #include <switch_ssl.h> #include <switch_stun.h> #include <switch_nat.h> +#include "private/switch_apr_pvt.h" #include "private/switch_core_pvt.h" #include <switch_curl.h> #include <switch_msrp.h> diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 13054b5b08..9931f0f3ef 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -422,7 +422,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (is_cng) { if (session->plc) { - plc_fillin(session->plc, session->raw_read_frame.data, read_frame->codec->implementation->decoded_bytes_per_packet / 2); + switch_plc_fillin(session->plc, session->raw_read_frame.data, read_frame->codec->implementation->decoded_bytes_per_packet / 2); is_cng = 0; flag &= ~SFF_CNG; } else { @@ -470,7 +470,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (!switch_test_flag(read_frame->codec, SWITCH_CODEC_FLAG_HAS_PLC) && (switch_channel_test_flag(session->channel, CF_JITTERBUFFER_PLC) || switch_channel_test_flag(session->channel, CF_CNG_PLC)) && !session->plc) { - session->plc = plc_init(NULL); + session->plc = switch_plc_init(NULL); } if (!switch_test_flag(read_frame->codec, SWITCH_CODEC_FLAG_HAS_PLC) && session->plc && switch_test_flag(read_frame, SFF_PLC)) { @@ -519,10 +519,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (status == SWITCH_STATUS_SUCCESS && session->read_impl.number_of_channels == 1) { if (session->plc) { if (switch_test_flag(read_frame, SFF_PLC)) { - plc_fillin(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2); + switch_plc_fillin(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2); switch_clear_flag(read_frame, SFF_PLC); } else { - plc_rx(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2); + switch_plc_rx(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2); } } } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 087a151570..0b337082b8 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -40,6 +40,8 @@ #include <sofia-sip/sdp.h> #include <sofia-sip/su.h> +#include <stdbool.h> + static switch_t38_options_t * switch_core_media_process_udptl(switch_core_session_t *session, sdp_session_t *sdp, sdp_media_t *m); static void switch_core_media_find_zrtp_hash(switch_core_session_t *session, sdp_session_t *sdp); static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp, switch_sdp_type_t sdp_type); diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index 3685956257..f005a9245e 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -33,6 +33,7 @@ */ #include <switch.h> +#include "private/switch_apr_pvt.h" #include "private/switch_core_pvt.h" //#define DEBUG_ALLOC diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 147900e784..32139ac98a 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1585,7 +1585,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t * switch_mutex_unlock(runtime.session_hash_mutex); if ((*session)->plc) { - plc_free((*session)->plc); + switch_plc_free((*session)->plc); (*session)->plc = NULL; } diff --git a/src/switch_spandsp.c b/src/switch_spandsp.c new file mode 100644 index 0000000000..397717da93 --- /dev/null +++ b/src/switch_spandsp.c @@ -0,0 +1,65 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org> + * + * 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/F + * + * 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 + * Michael Jerris <mike@jerris.com> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Michael Jerris <mike@jerris.com> + * Andrey Volk <andrey@signalwrie.com> + * + * switch_spandsp.c -- spandsp wrappers and extensions + * + */ + +#include <switch.h> + +#define SPANDSP_NO_TIFF 1 +#include "spandsp.h" + +SWITCH_DECLARE(switch_plc_state_t *) switch_plc_init(switch_plc_state_t *s) { + return (switch_plc_state_t *)plc_init((plc_state_t *)s); +} + +SWITCH_DECLARE(int) switch_plc_free(switch_plc_state_t *s) { + return plc_free((plc_state_t *)s); +} + +SWITCH_DECLARE(int) switch_plc_fillin(switch_plc_state_t *s, int16_t amp[], int len) { + return plc_fillin((plc_state_t *)s, amp, len); +} + +SWITCH_DECLARE(int) switch_plc_rx(switch_plc_state_t* s, int16_t amp[], int len) +{ + return plc_rx((plc_state_t*)s, amp, len); +} + + +/* 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/switch_time.c b/src/switch_time.c index fc94b48ee4..182d9ad6bd 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -33,6 +33,7 @@ #include <switch.h> #include <stdio.h> +#include "private/switch_apr_pvt.h" #include "private/switch_core_pvt.h" #ifdef HAVE_TIMERFD_CREATE diff --git a/src/switch_utils.c b/src/switch_utils.c index 107d1a8643..d869ddfda4 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -33,6 +33,7 @@ */ #include <switch.h> +#include "private/switch_apr_pvt.h" #ifndef WIN32 #include <arpa/inet.h> #if defined(HAVE_SYS_TIME_H) && defined(HAVE_SYS_RESOURCE_H) diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore index 4c7b7466c4..470c5ded12 100644 --- a/tests/unit/.gitignore +++ b/tests/unit/.gitignore @@ -48,3 +48,6 @@ Makefile conf/*/ conf_playsay/*/ conf_async/*/ +x64 +win32 +*.vcxproj.user \ No newline at end of file diff --git a/w32/Library/FreeSwitchCore.2017.vcxproj b/w32/Library/FreeSwitchCore.2017.vcxproj index 9d7098ee5e..68450d79dd 100644 --- a/w32/Library/FreeSwitchCore.2017.vcxproj +++ b/w32/Library/FreeSwitchCore.2017.vcxproj @@ -407,6 +407,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <ClCompile Include="..\..\src\switch_rtp.c" /> <ClCompile Include="..\..\src\switch_scheduler.c" /> <ClCompile Include="..\..\src\switch_sdp.c" /> + <ClCompile Include="..\..\src\switch_spandsp.c" /> <ClCompile Include="..\..\src\switch_stun.c" /> <ClCompile Include="..\..\src\switch_time.c" /> <ClCompile Include="..\..\src\switch_utils.c" /> @@ -742,6 +743,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <ClInclude Include="..\..\src\include\switch_resample.h" /> <ClInclude Include="..\..\src\include\switch_rtp.h" /> <ClInclude Include="..\..\src\include\switch_scheduler.h" /> + <ClInclude Include="..\..\src\include\switch_spandsp.h" /> <ClInclude Include="..\..\src\include\switch_stun.h" /> <ClInclude Include="..\..\src\include\switch_types.h" /> <ClInclude Include="..\..\src\include\switch_utils.h" /> From c9fba5cf3906e9d5eeada37896a2ce44f0f4a27d Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Mon, 15 Nov 2021 13:18:29 -0500 Subject: [PATCH 465/655] [mod_sofia] Fix regression in RFC-8760. SHA-512/256 was not offered because OPENSSL_VERSION_NUMBER was not defined in sofia_reg.c --- src/mod/endpoints/mod_sofia/sofia_reg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index ba9d4d0c71..10073c902d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -40,6 +40,7 @@ #include "mod_sofia.h" #include "sofia-sip/hostdomain.h" #include "sip-dig.h" +#include "switch_ssl.h" static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach) { From 51904df21a918d3e8148bd0e5ea5f5b9ce30e5d6 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 11 Aug 2020 23:32:21 +0000 Subject: [PATCH 466/655] [core] Fix jitter buffer- it is not truncating frames properly. It is also overflowing the node packet body and is copying the packet body twice. Remove magic numbers and replace with constant. --- src/include/switch_rtp.h | 2 ++ src/switch_jitterbuffer.c | 17 ++++++----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index 96ea2135f3..3da7254e91 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -41,9 +41,11 @@ SWITCH_BEGIN_EXTERN_C +#define SWITCH_RTP_HEADER_LEN sizeof(switch_rtp_hdr_t) #define SWITCH_RTP_MAX_BUF_LEN 16384 #define SWITCH_RTCP_MAX_BUF_LEN 16384 #define SWITCH_RTP_MAX_BUF_LEN_WORDS 4094 /* (max / 4) - 2 */ +#define SWITCH_RTP_MAX_PACKET_LEN (SWITCH_RTP_MAX_BUF_LEN + SWITCH_RTP_HEADER_LEN) //#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" diff --git a/src/switch_jitterbuffer.c b/src/switch_jitterbuffer.c index 54e9fc1c5e..d68b269024 100644 --- a/src/switch_jitterbuffer.c +++ b/src/switch_jitterbuffer.c @@ -640,7 +640,6 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch node->packet = *packet; node->len = len; - memcpy(node->packet.body, packet->body, len); switch_core_inthash_insert(jb->node_hash, node->packet.header.seq, node); @@ -1006,10 +1005,10 @@ SWITCH_DECLARE(switch_status_t) switch_jb_peek_frame(switch_jb_t *jb, uint32_t t frame->seq = ntohs(node->packet.header.seq); frame->timestamp = ntohl(node->packet.header.ts); frame->m = node->packet.header.m; - frame->datalen = node->len - 12; + frame->datalen = node->len - SWITCH_RTP_HEADER_LEN; - if (frame->data && frame->buflen > node->len - 12) { - memcpy(frame->data, node->packet.body, node->len - 12); + if (frame->data && frame->buflen > node->len - SWITCH_RTP_HEADER_LEN) { + memcpy(frame->data, node->packet.body, node->len - SWITCH_RTP_HEADER_LEN); } return SWITCH_STATUS_SUCCESS; } @@ -1221,9 +1220,9 @@ SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp uint32_t i; uint16_t want = ntohs(jb->next_seq), got = ntohs(packet->header.seq); - if (len >= sizeof(switch_rtp_packet_t)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "trying to put %" SWITCH_SIZE_T_FMT " bytes exceeding buffer, truncate to %" SWITCH_SIZE_T_FMT "\n", len, sizeof(switch_rtp_packet_t)); - len = sizeof(switch_rtp_packet_t); + if (len >= SWITCH_RTP_MAX_PACKET_LEN) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "trying to put %" SWITCH_SIZE_T_FMT " bytes exceeding buffer, truncate to %" SWITCH_SIZE_T_FMT "\n", len, SWITCH_RTP_MAX_PACKET_LEN); + len = SWITCH_RTP_MAX_PACKET_LEN; } switch_mutex_lock(jb->mutex); @@ -1279,7 +1278,6 @@ SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp } } - add_node(jb, packet, len); if (switch_test_flag(jb, SJB_QUEUE_ONLY) && jb->max_packet_len && jb->max_frame_len * 2 > jb->max_packet_len && @@ -1307,7 +1305,6 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet_by_seq(switch_jb_t *jb, uin jb_debug(jb, 2, "Found buffered seq: %u\n", ntohs(seq)); *packet = node->packet; *len = node->len; - memcpy(packet->body, node->packet.body, node->len); packet->header.version = 2; status = SWITCH_STATUS_SUCCESS; } else { @@ -1461,7 +1458,6 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp *packet = node->packet; *len = node->len; jb->last_len = *len; - memcpy(packet->body, node->packet.body, node->len); packet->header.version = 2; hide_node(node, SWITCH_TRUE); @@ -1505,7 +1501,6 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp return status; } - /* For Emacs: * Local Variables: * mode:c From d7c985afc7851bfce29b1781d156f2f480f079c5 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 16 Nov 2021 18:10:59 -0500 Subject: [PATCH 467/655] [mod_sofia] fail set up of STIR/SHAKEN verification service if configured CA directory fails to load --- src/mod/endpoints/mod_sofia/mod_sofia.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index a3a6cd8e91..13d689fe93 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -6140,7 +6140,12 @@ static switch_status_t sofia_stir_shaken_vs_create(stir_shaken_context_t *contex return SWITCH_STATUS_FALSE; } if (mod_sofia_globals.stir_shaken_vs_ca_dir) { - stir_shaken_vs_load_ca_dir(context, sofia_stir_shaken_vs, mod_sofia_globals.stir_shaken_vs_ca_dir); + if (stir_shaken_vs_load_ca_dir(context, sofia_stir_shaken_vs, mod_sofia_globals.stir_shaken_vs_ca_dir) != STIR_SHAKEN_STATUS_OK) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load trusted root certificates from %s\n", mod_sofia_globals.stir_shaken_vs_ca_dir); + return SWITCH_STATUS_FALSE; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loaded trusted root certificates from %s\n", mod_sofia_globals.stir_shaken_vs_ca_dir); + } } stir_shaken_vs_set_x509_cert_path_check(context, sofia_stir_shaken_vs, mod_sofia_globals.stir_shaken_vs_cert_path_check); stir_shaken_vs_set_connect_timeout(context, sofia_stir_shaken_vs, 3); From 594e42544b5ce98fb8157456e741cb53dfccdfed Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 17 Nov 2021 18:17:46 +0300 Subject: [PATCH 468/655] [mod_sofia] Put more comments into the code explaining that we include switch_ssl.h into sofia_reg.c because of SHA-512-256 (RFC-8760) --- src/mod/endpoints/mod_sofia/sofia_reg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 10073c902d..d553f36d1e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -40,6 +40,9 @@ #include "mod_sofia.h" #include "sofia-sip/hostdomain.h" #include "sip-dig.h" +/* This include defines OPENSSL_VERSION_NUMBER required for SHA-512-256 (RFC-8760) + Do NOT remove this line even if mod_sofia builds without it. +*/ #include "switch_ssl.h" static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach) From 5b8e1dd88a0aa29627bd40c6f59cb5559d08348c Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Fri, 19 Nov 2021 01:54:26 +0200 Subject: [PATCH 469/655] [mod_event_socket] fix strcmp crash --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index d60db15112..0b01e55e66 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 @@ -377,7 +377,7 @@ static void event_handler(switch_event_t *event) if (!uuid || (l->session && strcmp(uuid, switch_core_session_get_uuid(l->session)))) { send = 0; } - if (!strcmp(switch_core_session_get_uuid(l->session), switch_event_get_header_nil(event, "Job-Owner-UUID"))) { + if (l->session && !strcmp(switch_core_session_get_uuid(l->session), switch_event_get_header_nil(event, "Job-Owner-UUID"))) { send = 1; } } From 4c781e2b5fbfac52154a6ecbf7069439492083e0 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Tue, 16 Nov 2021 00:37:27 +0000 Subject: [PATCH 470/655] [mod_conference] Add APIs to set/get conference variables --- .../mod_conference/conference_api.c | 26 +++++++++++++++++++ .../mod_conference/mod_conference.c | 20 ++++++++------ .../mod_conference/mod_conference.h | 6 +++-- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index fd51d294cb..bd24484928 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -89,6 +89,8 @@ api_command_t conference_api_sub_commands[] = { {"undeaf", (void_fn_t) & conference_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "undeaf", "<[member_id|all]|last|non_moderator>"}, {"vid-filter", (void_fn_t) & conference_api_sub_video_filter, CONF_API_SUB_MEMBER_TARGET, "vid-filter", "<[member_id|all]|last|non_moderator> <string>"}, {"relate", (void_fn_t) & conference_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "relate", "<member_id>[,<member_id>] <other_member_id>[,<other_member_id>] [nospeak|nohear|clear]"}, + {"getvar", (void_fn_t) & conference_api_sub_getvar, CONF_API_SUB_ARGS_SPLIT, "getvar", "<varname>"}, + {"setvar", (void_fn_t) & conference_api_sub_setvar, CONF_API_SUB_ARGS_SPLIT, "setvar", "<varname> <value>"}, {"lock", (void_fn_t) & conference_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "lock", ""}, {"unlock", (void_fn_t) & conference_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "unlock", ""}, {"dial", (void_fn_t) & conference_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "dial", "<endpoint_module_name>/<destination> <callerid number> <callerid name>"}, @@ -3433,6 +3435,30 @@ switch_status_t conference_api_sub_relate(conference_obj_t *conference, switch_s return SWITCH_STATUS_SUCCESS; } +switch_status_t conference_api_sub_getvar(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + const char *val = NULL; + const char *var = argv[2]; + + if (var) val = conference_get_variable(conference, var); + + stream_write(stream, "%s", switch_str_nil(val)); + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t conference_api_sub_setvar(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + const char *val = argv[3]; + const char *var = argv[2]; + + if (var) conference_set_variable(conference, var, val); + + stream_write(stream, "+OK\n", VA_NONE); + + return SWITCH_STATUS_SUCCESS; +} + switch_status_t conference_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { switch_event_t *event; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 71fd17532c..4ed7a595c3 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2656,24 +2656,28 @@ conference_obj_t *conference_find(char *name, char *domain) void conference_set_variable(conference_obj_t *conference, const char *var, const char *val) { + switch_assert(var); switch_mutex_lock(conference->flag_mutex); - switch_event_add_header_string(conference->variables, SWITCH_STACK_BOTTOM, var, val); + + if (!val) { + switch_event_del_header(conference->variables, var); + } else { + switch_event_add_header_string(conference->variables, SWITCH_STACK_BOTTOM, var, val); + } switch_mutex_unlock(conference->flag_mutex); } const char *conference_get_variable(conference_obj_t *conference, const char *var) { - const char *val; + const char *val = NULL, *rval = NULL; switch_mutex_lock(conference->flag_mutex); - val = switch_event_get_header(conference->variables, var); + if ((val = switch_event_get_header(conference->variables, var))) { + rval = switch_core_strdup(conference->pool, val); + } switch_mutex_unlock(conference->flag_mutex); - if (val) { - return switch_core_strdup(conference->pool, val); - } - - return NULL; + return rval; } /* create a new conferene with a specific profile */ diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index 2131df99c3..f6f932fc07 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -1218,6 +1218,8 @@ switch_status_t conference_api_sub_hold(conference_member_t *member, switch_stre switch_status_t conference_api_sub_unhold(conference_member_t *member, switch_stream_handle_t *stream, void *data); switch_status_t conference_api_sub_pauserec(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); switch_status_t conference_api_sub_volume_out(conference_member_t *member, switch_stream_handle_t *stream, void *data); +switch_status_t conference_api_sub_getvar(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); +switch_status_t conference_api_sub_setvar(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); switch_status_t conference_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); switch_status_t conference_api_sub_unlock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); switch_status_t conference_api_sub_relate(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv); @@ -1311,8 +1313,8 @@ const char *conference_get_variable(conference_obj_t *conference, const char *va /* Entries in this list should be kept in sync with the enum above */ extern api_command_t conference_api_sub_commands[]; extern struct _mapping control_mappings[]; - - +#define stream_write(__stream, __fmt, ...) if (__stream)__stream->write_function(__stream, __fmt, __VA_ARGS__) +#define VA_NONE "%s", "" #endif /* MOD_CONFERENCE_H */ /* For Emacs: From 4f123c46828d29d8d571f0cdf03fa35381e4ea0d Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Tue, 23 Nov 2021 12:21:55 +0000 Subject: [PATCH 471/655] [mod_conference] Set conference vars from core/channel variables --- .../mod_conference/mod_conference.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 4ed7a595c3..ec1cd5c8f7 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2680,6 +2680,22 @@ const char *conference_get_variable(conference_obj_t *conference, const char *va return rval; } +static void check_var_event(conference_obj_t *conference, switch_event_t *var_event) +{ + switch_event_header_t *hi = NULL; + + for (hi = var_event->headers; hi; hi = hi->next) { + char *vvar = hi->name; + char *vval = hi->value; + if (vvar && vval && !strncasecmp(vvar, "confvar_", 8)) { + vvar += 8; + if (vvar) { + conference_set_variable(conference, vvar, vval); + } + } + } +} + /* create a new conferene with a specific profile */ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_core_session_t *session, switch_memory_pool_t *pool) { @@ -2784,6 +2800,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co char *video_codec_config_profile_name = NULL; int tmp; int heartbeat_period_sec = 0; + switch_event_t *var_event = NULL; /* Validate the conference name */ if (zstr(name)) { @@ -3689,6 +3706,14 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool); switch_mutex_init(&conference->canvas_mutex, SWITCH_MUTEX_NESTED, conference->pool); + switch_core_get_variables(&var_event); + check_var_event(conference, var_event); + switch_event_destroy(&var_event); + + switch_channel_get_variables(channel, &var_event); + check_var_event(conference, var_event); + switch_event_destroy(&var_event); + switch_mutex_lock(conference_globals.hash_mutex); conference_utils_set_flag(conference, CFLAG_INHASH); switch_core_hash_insert(conference_globals.conference_hash, conference->name, conference); From 1bab462f19e98a5de9976e591ec30e4a2103f678 Mon Sep 17 00:00:00 2001 From: Alexander Udovichenko <udovichenko48@gmail.com> Date: Fri, 26 Nov 2021 15:18:23 +0300 Subject: [PATCH 472/655] [mod_sofia] Add autocomplete options to status profile command --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 13d689fe93..d07a394b41 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -6800,7 +6800,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>"); SWITCH_ADD_API(api_interface, "sofia_gateway_data", "Get data from a sofia gateway", sofia_gateway_data_function, "<gateway_name> [ivar|ovar|var] <name>"); switch_console_set_complete("add sofia ::[help:status"); - switch_console_set_complete("add sofia status profile ::sofia::list_profiles reg"); + switch_console_set_complete("add sofia status profile ::sofia::list_profiles ::[reg:user:pres"); switch_console_set_complete("add sofia status gateway ::sofia::list_gateways"); switch_console_set_complete("add sofia loglevel ::[all:default:tport:iptsec:nea:nta:nth_client:nth_server:nua:soa:sresolv:stun ::[0:1:2:3:4:5:6:7:8:9"); From 6ece47e17fb781e4f47359a2bfbd8a6c9d6127b8 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca> Date: Fri, 26 Nov 2021 11:50:11 -0500 Subject: [PATCH 473/655] [build] skip checking unused execinfo.h since 380fd060ef719b1d8f8781422e84d2a32066351d, execinfo.h is not used anymore, so there is no need to check for it. --- configure.ac | 2 +- src/include/switch_private.h.cmake | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 990a59db2a..baec8b2b83 100644 --- a/configure.ac +++ b/configure.ac @@ -883,7 +883,7 @@ AC_SUBST(LIBTOOL_LIB_EXTEN) # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/prctl.h sys/select.h netdb.h execinfo.h sys/time.h]) +AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/prctl.h sys/select.h netdb.h sys/time.h]) # Solaris 11 privilege management AS_CASE([$host], diff --git a/src/include/switch_private.h.cmake b/src/include/switch_private.h.cmake index dc94b73a88..d55a8d4169 100644 --- a/src/include/switch_private.h.cmake +++ b/src/include/switch_private.h.cmake @@ -22,9 +22,6 @@ /* Define to 1 if you have the <dlfcn.h> header file. */ #cmakedefine HAVE_DLFCN_H -/* Define to 1 if you have the <execinfo.h> header file. */ -#cmakedefine HAVE_EXECINFO_H - /* Define to 1 if you have the `gethostname' function. */ #cmakedefine HAVE_GETHOSTNAME From f3604557e52ff14ae98f7f5080472ba2543ef1ac Mon Sep 17 00:00:00 2001 From: Minh <hnimminh@outlook.com> Date: Thu, 2 Dec 2021 00:48:29 +0700 Subject: [PATCH 474/655] [mod_distributor] Reload message should be same as others (+OK instead of +ok) --- src/mod/applications/mod_distributor/mod_distributor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_distributor/mod_distributor.c b/src/mod/applications/mod_distributor/mod_distributor.c index a653514f89..47f97f9421 100644 --- a/src/mod/applications/mod_distributor/mod_distributor.c +++ b/src/mod/applications/mod_distributor/mod_distributor.c @@ -403,7 +403,7 @@ SWITCH_STANDARD_API(distributor_ctl_function) if (argc > 0) { if (!strcasecmp(argv[0], "reload")) { if (load_config(SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "+ok reloaded.\n"); + stream->write_function(stream, "+OK reloaded.\n"); err = NULL; } } else if (!strcasecmp(argv[0], "dump")) { From e632759ae8aa57e2591b4fdf925a827cc57af0db Mon Sep 17 00:00:00 2001 From: Clarence <xjh.azzbcc@gmail.com> Date: Sun, 5 Dec 2021 17:55:51 +0800 Subject: [PATCH 475/655] [mod_amqp] Fix memory leaks on command queue name and parsing configure file --- src/mod/event_handlers/mod_amqp/mod_amqp_command.c | 2 +- src/mod/event_handlers/mod_amqp/mod_amqp_utils.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_command.c b/src/mod/event_handlers/mod_amqp/mod_amqp_command.c index c98c123c07..2789a6e252 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_command.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_command.c @@ -274,11 +274,11 @@ static void mod_amqp_command_response(mod_amqp_command_profile_t *profile, char void * SWITCH_THREAD_FUNC mod_amqp_command_thread(switch_thread_t *thread, void *data) { + amqp_bytes_t queueName = { 0, NULL }; mod_amqp_command_profile_t *profile = (mod_amqp_command_profile_t *) data; while (profile->running) { amqp_queue_declare_ok_t *recv_queue; - amqp_bytes_t queueName = { 0, NULL }; /* Ensure we have an AMQP connection */ if (!profile->conn_active) { diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_utils.c b/src/mod/event_handlers/mod_amqp/mod_amqp_utils.c index 7ebcff6e3f..03a0f262c0 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_utils.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_utils.c @@ -193,6 +193,7 @@ switch_status_t mod_amqp_do_config(switch_bool_t reload) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to locate logging section for mod_amqp\n" ); } + switch_xml_free(xml); return SWITCH_STATUS_SUCCESS; } From 77481b327c53a2a3b91559d71fe302e9def0d884 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Thu, 9 Dec 2021 11:36:09 +0200 Subject: [PATCH 476/655] [core] extend count of acl entries (per SOFIA_MAX_ACL). --- src/switch_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core.c b/src/switch_core.c index 4953964a38..48903eee95 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1405,7 +1405,7 @@ SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_port_token(const char } else if (strchr(list_name, '/')) { if (strchr(list_name, ',')) { char *list_name_dup = strdup(list_name); - char *argv[32]; + char *argv[100]; /* MAX ACL */ int argc; switch_assert(list_name_dup); From 6c87ed491597fb5e30935d8309aa7e0c3aa9e18f Mon Sep 17 00:00:00 2001 From: Michael Jerris <mike@jerris.com> Date: Fri, 17 Dec 2021 13:55:11 -0700 Subject: [PATCH 477/655] [Core] RFC 3264 says once we assign a payload number to a dynamic codec, we are stuck with it. 8.3.1 Modifying Address, Port or Transport The port number for a stream MAY be changed. To do this, the offerer creates a new media description, with the port number in the m line different from the corresponding stream in the previous SDP. If only the port number is to be changed, the rest of the media stream description SHOULD remain unchanged. The offerer MUST be prepared to receive media on both the old and new ports as soon as the offer is sent. The offerer SHOULD NOT cease listening for media on the old port until the answer is received and media arrives on the new port. Doing so could result in loss of media during the transition. Co-authored-by: Anthony Minessale <anthm@signalwire.com> --- src/switch_core_media.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 0b337082b8..1b7f392761 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -9907,7 +9907,8 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, for (i = 0; i < smh->mparams->num_codecs; i++) { const switch_codec_implementation_t *imp = smh->codecs[i]; int this_ptime = (imp->microseconds_per_packet / 1000); - + payload_map_t *pmap; + if (!strcasecmp(imp->iananame, "ilbc") || !strcasecmp(imp->iananame, "isac") ) { this_ptime = 20; } @@ -9932,7 +9933,18 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, continue; } + + switch_mutex_lock(smh->sdp_mutex); + for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) { + if (pmap->negotiated && !strcasecmp(imp->iananame, pmap->iananame)) { + smh->ianacodes[i] = pmap->pt; + break; + } + } + switch_mutex_unlock(smh->sdp_mutex); + already_did[smh->ianacodes[i]] = 1; + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->ianacodes[i]); } @@ -11114,13 +11126,21 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess continue; } - if (smh->ianacodes[i] < 128) { - if (already_did[smh->ianacodes[i]]) { - continue; - } - already_did[smh->ianacodes[i]] = 1; + if (smh->ianacodes[i] >= 128 || already_did[smh->ianacodes[i]]) { + continue; } + switch_mutex_lock(smh->sdp_mutex); + for (pmap = v_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) { + if (pmap->negotiated && !strcasecmp(imp->iananame, pmap->iananame)) { + smh->ianacodes[i] = pmap->pt; + break; + } + } + switch_mutex_unlock(smh->sdp_mutex); + + already_did[smh->ianacodes[i]] = 1; + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", smh->ianacodes[i]); if (!ptime) { From b995b221648bc39d90e70d7951a79b467fe8be3b Mon Sep 17 00:00:00 2001 From: Alexander Traud <pabstraud@compuserve.com> Date: Tue, 21 Dec 2021 21:20:47 +0100 Subject: [PATCH 478/655] [Build-System] Add libswscale-dev debian package to the debian_min_build.sh --- scripts/debian_min_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/debian_min_build.sh b/scripts/debian_min_build.sh index 953f3840ad..b585c1921e 100755 --- a/scripts/debian_min_build.sh +++ b/scripts/debian_min_build.sh @@ -8,7 +8,7 @@ wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list -apt-get update && apt-get install -y libtool libjpeg62-turbo-dev ntpdate libfreetype6-dev git-buildpackage doxygen yasm gdb git build-essential automake autoconf wget uuid-dev zlib1g-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison pkg-config ccache libpng16-dev libpng12-dev libopenal-dev libbroadvoice-dev libcodec2-dev libflite-dev libg7221-dev libilbc-dev libsilk-dev liblua5.2-dev libopus-dev libsndfile-dev libavformat-dev libavcodec-extra libx264-dev libperl-dev unixodbc-dev libpq-dev libsctp-dev +apt-get update && apt-get install -y libtool libjpeg62-turbo-dev ntpdate libfreetype6-dev git-buildpackage doxygen yasm gdb git build-essential automake autoconf wget uuid-dev zlib1g-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison pkg-config ccache libpng16-dev libpng12-dev libopenal-dev libbroadvoice-dev libcodec2-dev libflite-dev libg7221-dev libilbc-dev libsilk-dev liblua5.2-dev libopus-dev libsndfile-dev libavformat-dev libavcodec-extra libswscale-dev libx264-dev libperl-dev unixodbc-dev libpq-dev libsctp-dev cd /usr/src From cbc610db26d28d3a115ef1bfcca249872202364e Mon Sep 17 00:00:00 2001 From: ros-tel <vladvladow@yandex.ru> Date: Wed, 22 Dec 2021 17:32:59 +0500 Subject: [PATCH 479/655] [mod_av] FIX parse config param "profile" and "level" --- src/mod/applications/mod_av/avcodec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index 573b8baaa1..703dc1b2ce 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -1979,6 +1979,9 @@ static void parse_profile(avcodec_profile_t *aprofile, switch_xml_t profile) ctx = &aprofile->ctx; + ctx->profile = FF_PROFILE_H264_BASELINE; + ctx->level = 31; + for (param = switch_xml_child(profile, "param"); param; param = param->next) { const char *name = switch_xml_attr(param, "name"); const char *value = switch_xml_attr(param, "value"); @@ -1990,9 +1993,6 @@ static void parse_profile(avcodec_profile_t *aprofile, switch_xml_t profile) val = atoi(value); - ctx->profile = FF_PROFILE_H264_BASELINE; - ctx->level = 31; - if (!strcmp(name, "dec-threads")) { aprofile->decoder_thread_count = switch_parse_cpu_string(value); } else if (!strcmp(name, "enc-threads")) { From e3f031fc7c56c6fb2296cba163c70f83ab6e164b Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 22 Dec 2021 16:17:08 -0600 Subject: [PATCH 480/655] Update LICENSE --- LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 6745df1f35..8d2aa962f4 100644 --- a/LICENSE +++ b/LICENSE @@ -3,8 +3,8 @@ Upstream-Name: freeswitch Source: https://freeswitch.org/ Files: * -Copyright: 2005-2014 Anthony Minessale II <anthm@freeswitch.org> - 2005-2014 Anthony Minessale II +Copyright: 2005-2022 Anthony Minessale II <anthm@freeswitch.org> + 2005-2022 Anthony Minessale II License: MPL-1.1 MOZILLA PUBLIC LICENSE Version 1.1 From a92eee4e9313f422850ae5fb9b143c8e6ddcc394 Mon Sep 17 00:00:00 2001 From: wmasilva <asilva@wirelessmundi.com> Date: Wed, 22 Dec 2021 22:55:29 +0000 Subject: [PATCH 481/655] [mod_voicemail] add option to skip goodbye --- .../applications/mod_voicemail/mod_voicemail.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index dd3a74a463..8f8384fab1 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1196,7 +1196,7 @@ static switch_status_t create_file(switch_core_session_t *session, vm_profile_t switch_cc_t cc = { 0 }; switch_codec_implementation_t read_impl = { 0 }; int got_file = 0; - switch_bool_t skip_record_check = switch_true(switch_channel_get_variable(channel, "skip_record_check")); + switch_bool_t skip_record_check = switch_channel_var_true(channel, "skip_record_check"); switch_core_session_get_read_impl(session, &read_impl); @@ -1605,7 +1605,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t cid_buf, switch_channel_get_name(channel)); switch_core_session_receive_message(session, &msg); - if (!zstr(cbt->cid_number) && (switch_true(switch_channel_get_variable(channel, "vm_announce_cid")))) { + if (!zstr(cbt->cid_number) && (switch_channel_var_true(channel, "vm_announce_cid"))) { TRY_CODE(switch_ivr_phrase_macro(session, VM_SAY_PHONE_NUMBER_MACRO, cbt->cid_number, NULL, NULL)); } @@ -2002,7 +2002,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p auth_only = 1; auth = 0; } else { - auth_only = switch_true(switch_channel_get_variable(channel, "vm_auth_only")); + auth_only = switch_channel_var_true(channel, "vm_auth_only"); } timeout = profile->digit_timeout; @@ -3399,14 +3399,16 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p switch_event_t *vars = NULL; const char *vtmp, *vm_ext = NULL; int disk_quota = 0; - switch_bool_t skip_greeting = switch_true(switch_channel_get_variable(channel, "skip_greeting")); - switch_bool_t skip_instructions = switch_true(switch_channel_get_variable(channel, "skip_instructions")); - switch_bool_t skip_record_urgent_check = switch_true(switch_channel_get_variable(channel, "skip_record_urgent_check")); + switch_bool_t skip_greeting = switch_channel_var_true(channel, "skip_greeting"); + switch_bool_t skip_instructions = switch_channel_var_true(channel, "skip_instructions"); + switch_bool_t skip_record_urgent_check = switch_channel_var_true(channel, "skip_record_urgent_check"); + switch_bool_t voicemail_skip_goodbye = switch_channel_var_true(channel, "voicemail_skip_goodbye"); switch_bool_t vm_enabled = SWITCH_TRUE; switch_channel_set_variable(channel, "skip_greeting", NULL); switch_channel_set_variable(channel, "skip_instructions", NULL); switch_channel_set_variable(channel, "skip_record_urgent_check", NULL); + switch_channel_set_variable(channel, "voicemail_skip_goodbye", NULL); memset(&cbt, 0, sizeof(cbt)); @@ -3700,7 +3702,9 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p switch_safe_free(file_path); if (switch_channel_ready(channel) && vm_enabled) { - status = switch_ivr_phrase_macro(session, VM_GOODBYE_MACRO, NULL, NULL, NULL); + if (!voicemail_skip_goodbye) { + status = switch_ivr_phrase_macro(session, VM_GOODBYE_MACRO, NULL, NULL, NULL); + } } return status; From e743e8ab3cf629a6337f508b2733d1a7ec3084ab Mon Sep 17 00:00:00 2001 From: Seven Du <dujinfang@x-y-t.cn> Date: Tue, 28 Dec 2021 08:15:23 +0800 Subject: [PATCH 482/655] [core] fix macOS build when missing CRYPTO_mem_ctrl https://github.com/signalwire/freeswitch/issues/1461 https://github.com/signalwire/libks/commit/3493e9c952964c80e402aa0497891d57dc5f8d40 --- src/switch_core_cert.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_cert.c b/src/switch_core_cert.c index 565f548e51..c4fdd84210 100644 --- a/src/switch_core_cert.c +++ b/src/switch_core_cert.c @@ -281,7 +281,9 @@ SWITCH_DECLARE(int) switch_core_gen_certs(const char *prefix) } } +#ifdef CRYPTO_MEM_CHECK_ON CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); +#endif //bio_err=BIO_new_fp(stderr, BIO_NOCLOSE); From 083a9ab1c31b44fb79fdb924e7038653cf24793e Mon Sep 17 00:00:00 2001 From: Martin Paterson <61424351+MartinJPaterson@users.noreply.github.com> Date: Tue, 28 Dec 2021 16:02:02 +0000 Subject: [PATCH 483/655] [mod_voicemail] Fix voicemail ignoring vm-a1-hash --- 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 8f8384fab1..1768f59585 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2583,7 +2583,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p if (!auth) { if (!zstr(cbt.password) && !strcmp(cbt.password, mypass)) { auth++; - } else if (!thepass && profile->allow_empty_password_auth) { + } else if (!thehash && !thepass && profile->allow_empty_password_auth) { auth++; } From f55cc1993ad0cbd68d78306d8d88ff93d3e2f87b Mon Sep 17 00:00:00 2001 From: MarioG-X <20360699+MarioG-X@users.noreply.github.com> Date: Tue, 28 Dec 2021 12:02:15 -0800 Subject: [PATCH 484/655] [libvpx] configure.sh erroneous make warnings starting with macOS 11.5.1 --- libs/libvpx/build/make/configure.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/libvpx/build/make/configure.sh b/libs/libvpx/build/make/configure.sh index 728c3e2568..b1f7804a59 100644 --- a/libs/libvpx/build/make/configure.sh +++ b/libs/libvpx/build/make/configure.sh @@ -865,7 +865,11 @@ process_common_toolchain() { case ${toolchain} in *-darwin-*) mvmin=$(sw_vers -productVersion) - mvmin="-mmacosx-version-min="${mvmin%.*} + if [[ $mvmin == 10.* ]]; then + mvmin="-mmacosx-version-min=""${mvmin%.*}" + else + mvmin="-mmacosx-version-min=""${mvmin%%.*}" + fi add_cflags $mvmin add_ldflags $mvmin ;; From f9bb8940c29f55c89fa1e0697e8e614b355bfff2 Mon Sep 17 00:00:00 2001 From: xbipin <bipin@xbipin.com> Date: Thu, 30 Dec 2021 00:30:18 +0400 Subject: [PATCH 485/655] [mod_sofia] Caller ID name in contact. Introduce sip_caller_id_name_in_contact channel variable. --- src/mod/endpoints/mod_sofia/sofia_glue.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index d385732ddb..4d37fc97f9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1322,7 +1322,11 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) } url_str = sofia_overcome_sip_uri_weakness(session, url, tech_pvt->transport, SWITCH_TRUE, invite_params, invite_tel_params); - invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, invite_contact_params, NULL); + if (switch_channel_var_true(tech_pvt->channel, "sip_caller_id_name_in_contact")) { + invite_contact = switch_core_session_sprintf(session, "\"%s\" %s", tech_pvt->caller_profile->caller_id_name, sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, invite_contact_params, NULL)); + } else { + invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, invite_contact_params, NULL); + } from_str = sofia_overcome_sip_uri_weakness(session, invite_from_uri ? invite_from_uri : use_from_str, 0, SWITCH_TRUE, invite_from_params, NULL); to_str = sofia_overcome_sip_uri_weakness(session, invite_to_uri ? invite_to_uri : tech_pvt->dest_to, 0, SWITCH_FALSE, invite_to_params, NULL); From 92d2e0b1366297b8b8fe584cd398641edbf3e803 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 31 Dec 2021 00:33:41 +0300 Subject: [PATCH 486/655] [mod_pgsql] Fix build by using PG_VERSION_NUM provided by libpq instead of using POSTGRESQL_MAJOR_VERSION detected by freeswitch configure. --- src/mod/databases/mod_pgsql/mod_pgsql.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c index b638a4feae..575252223b 100644 --- a/src/mod/databases/mod_pgsql/mod_pgsql.c +++ b/src/mod/databases/mod_pgsql/mod_pgsql.c @@ -36,6 +36,7 @@ #include <switch.h> #include <libpq-fe.h> +#include <pg_config.h> #ifndef _WIN32 #include <poll.h> @@ -597,7 +598,7 @@ switch_status_t database_handle_exec_string(switch_database_interface_handle_t * goto done; } else { switch (result->status) { -#if POSTGRESQL_MAJOR_VERSION >= 9 && POSTGRESQL_MINOR_VERSION >= 2 +#if PG_VERSION_NUM >= 90002 case PGRES_SINGLE_TUPLE: /* Added in PostgreSQL 9.2 */ #endif @@ -756,25 +757,25 @@ switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pg *result_out = res; res->status = PQresultStatus(res->result); switch (res->status) { -//#if (POSTGRESQL_MAJOR_VERSION == 9 && POSTGRESQL_MINOR_VERSION >= 2) || POSTGRESQL_MAJOR_VERSION > 9 +#if PG_VERSION_NUM >= 90002 case PGRES_SINGLE_TUPLE: /* Added in PostgreSQL 9.2 */ -//#endif +#endif case PGRES_TUPLES_OK: { res->rows = PQntuples(res->result); res->cols = PQnfields(res->result); } break; -//#if (POSTGRESQL_MAJOR_VERSION == 9 && POSTGRESQL_MINOR_VERSION >= 1) || POSTGRESQL_MAJOR_VERSION > 9 +#if PG_VERSION_NUM >= 90001 case PGRES_COPY_BOTH: /* Added in PostgreSQL 9.1 */ -//#endif +#endif case PGRES_COPY_OUT: case PGRES_COPY_IN: case PGRES_COMMAND_OK: break; -#if POSTGRESQL_MAJOR_VERSION >= 14 +#if PG_VERSION_NUM >= 140001 case PGRES_PIPELINE_ABORTED: case PGRES_PIPELINE_SYNC: break; From b9875d1ac9853ae708eb09cdf4ae5b2fda257929 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 25 Jan 2022 18:59:29 +0300 Subject: [PATCH 487/655] [Unit-tests] Replace fst_requires with fst_check in mod_sofia unit tests. Increase timeout. --- .../mod_sofia/test/sipp-based-tests.c | 472 +++++++++--------- .../mod_sofia/test/test_sofia_funcs.c | 82 +-- 2 files changed, 288 insertions(+), 266 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 a7a380588f..33259f043f 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -36,6 +36,7 @@ int test_success = 0; int test_sofia_debug = 1; +static int timeout_sec = 10; static void test_wait_for_uuid(char *uuid) { @@ -258,53 +259,53 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1212121212", "sipp-scenarios/uac_telephone_event.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ - } + fst_check(!"sipp not found"); + } else { + test_wait_for_uuid(uuid); + if (!zstr(uuid)) { + const char *sdp_str1 = NULL, *sdp_str2 = NULL; + switch_core_session_t *session = switch_core_session_locate(uuid); + switch_channel_t *channel = switch_core_session_get_channel(session); + fst_check(channel); - test_wait_for_uuid(uuid); - if (!zstr(uuid)) { - const char *sdp_str1 = NULL, *sdp_str2 = NULL; - switch_core_session_t *session = switch_core_session_locate(uuid); - switch_channel_t *channel = switch_core_session_get_channel(session); - fst_requires(channel); + sdp_str1 = test_wait_for_chan_var(channel,"1"); + sdp_str2 = test_wait_for_chan_var(channel,"2"); - sdp_str1 = test_wait_for_chan_var(channel,"1"); - sdp_str2 = test_wait_for_chan_var(channel,"2"); + if (sdp_str1 && sdp_str2 && (strstr(sdp_str1,"telephone-event")) && (strstr(sdp_str2,"telephone-event"))){ + char *temp = NULL; + sdp_count = 1; - if (sdp_str1 && sdp_str2 && (strstr(sdp_str1,"telephone-event")) && (strstr(sdp_str2,"telephone-event"))){ - char *temp = NULL; - sdp_count = 1; + if ((temp = strstr(sdp_str2,"RTP/AVP"))) { + int count = 0, i; - if ((temp = strstr(sdp_str2,"RTP/AVP"))) { - int count = 0, i; - - for (i = 7; temp[i] != '\n' && i < 99; i++) { - /* checking for payload-type 101.*/ - if(temp[i++] == '1' && temp[i++] == '0' && temp[i++] == '1') - count++; - } - if (count > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Duplicate entry of payload in SDP.\n"); - sdp_count = 0; + for (i = 7; temp[i] != '\n' && i < 99; i++) { + /* checking for payload-type 101.*/ + if(temp[i++] == '1' && temp[i++] == '0' && temp[i++] == '1') + count++; + } + if (count > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Duplicate entry of payload in SDP.\n"); + sdp_count = 0; + } } + + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Telephone-event missing in SDP.\n"); } + switch_core_session_rwunlock(session); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Telephone-event missing in SDP.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Uuid not found in Channel Data.\n"); } - switch_core_session_rwunlock(session); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Uuid not found in Channel Data.\n"); + fst_check(sdp_count == 1); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); } - - fst_check(sdp_count == 1); - /* sipp should timeout, attempt kill, just in case.*/ - kill_sipp(); } FST_TEST_END() - FST_TEST_BEGIN(uac_savp_check) + FST_TEST_BEGIN(uac_savp_check) { const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); char uuid[100] = ""; @@ -313,50 +314,50 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1212121212", "sipp-scenarios/uac_savp_check.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ - } + fst_check(!"sipp not found"); + } else { + test_wait_for_uuid(uuid); + if (!zstr(uuid)) { + const char *sdp_str1 = NULL, *sdp_str2 = NULL; + const char *temp = NULL, *temp1 = NULL; + switch_core_session_t *session = switch_core_session_locate(uuid); + switch_channel_t *channel = switch_core_session_get_channel(session); + fst_check(channel); - test_wait_for_uuid(uuid); - if (!zstr(uuid)) { - const char *sdp_str1 = NULL, *sdp_str2 = NULL; - const char *temp = NULL, *temp1 = NULL; - switch_core_session_t *session = switch_core_session_locate(uuid); - switch_channel_t *channel = switch_core_session_get_channel(session); - fst_requires(channel); + sdp_str1 = test_wait_for_chan_var(channel,"1"); + sdp_str2 = test_wait_for_chan_var(channel,"2"); - sdp_str1 = test_wait_for_chan_var(channel,"1"); - sdp_str2 = test_wait_for_chan_var(channel,"2"); + if (sdp_str1 && sdp_str2 && (temp = strstr(sdp_str2,"RTP/SAVP")) && (temp1 = strstr(temp,"crypto"))) { + int i = 0; - if (sdp_str1 && sdp_str2 && (temp = strstr(sdp_str2,"RTP/SAVP")) && (temp1 = strstr(temp,"crypto"))) { - int i = 0; + sdp_count = 1; + for (i = 0; temp1[i]; i++) { - sdp_count = 1; - for (i = 0; temp1[i]; i++) { - - if ((temp = strstr(temp1,"RTP/SAVP"))) { - if ((temp1 = strstr(temp,"crypto"))) { - i = 0; - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fail due to no crypto found with SAVP.\n"); - sdp_count = 0; - break; + if ((temp = strstr(temp1,"RTP/SAVP"))) { + if ((temp1 = strstr(temp,"crypto"))) { + i = 0; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fail due to no crypto found with SAVP.\n"); + sdp_count = 0; + break; + } } + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SAVP not found in SDP.\n"); } + switch_core_session_rwunlock(session); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SAVP not found in SDP.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Uuid not found in Channel Data.\n"); } - switch_core_session_rwunlock(session); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Uuid not found in Channel Data.\n"); + fst_check(sdp_count == 1); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); } - - fst_check(sdp_count == 1); - /* sipp should timeout, attempt kill, just in case.*/ - kill_sipp(); } FST_TEST_END() @@ -371,40 +372,42 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler, NULL); - status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1001", "sipp-scenarios/uac_digest_leak.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ - } + fst_check(!"sipp not found"); + } else { - fst_check(status == SWITCH_STATUS_SUCCESS); - if (!session) { - fst_requires(session); - } + fst_check(status == SWITCH_STATUS_SUCCESS); + if (!session) { + fst_check(!"no session"); + } else { + channel = switch_core_session_get_channel(session); + fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); - channel = switch_core_session_get_channel(session); - fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); + while (1) { + int ret; + switch_sleep(1000 * 1000); + ret = switch_system("pidof sipp", SWITCH_TRUE); + if (!ret) { + break; + } + } - while (1) { - int ret; - switch_sleep(1000 * 1000); - ret = switch_system("pidof sipp", SWITCH_TRUE); - if (!ret) { - break; + switch_sleep(5000 * 1000); + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session); + switch_sleep(1000 * 1000); + + switch_event_unbind_callback(event_handler); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); } } - switch_sleep(5000 * 1000); - - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - - switch_core_session_rwunlock(session); - switch_sleep(1000 * 1000); - - switch_event_unbind_callback(event_handler); - /* sipp should timeout, attempt kill, just in case.*/ - kill_sipp(); - fst_check(test_success); test_success = 0; } FST_TEST_END() @@ -420,40 +423,41 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) switch_event_bind("sofia", SWITCH_EVENT_CUSTOM, NULL, event_handler, NULL); - status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); sipp_ret = start_sipp_uac(local_ip_v4, 5080, "1001", "sipp-scenarios/uac_digest_leak-tcp.xml", "-t t1"); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ - } - - fst_check(status == SWITCH_STATUS_SUCCESS); - if (!session) { - fst_requires(session); - } - - channel = switch_core_session_get_channel(session); - fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); - - while (1) { - int ret; - switch_sleep(1000 * 1000); - ret = switch_system("pidof sipp", SWITCH_TRUE); - if (!ret) { - break; + fst_check(!"sipp not found"); + } else { + fst_check(status == SWITCH_STATUS_SUCCESS); + if (!session) { + fst_check(!"no session"); } + + channel = switch_core_session_get_channel(session); + fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); + + while (1) { + int ret; + switch_sleep(1000 * 1000); + ret = switch_system("pidof sipp", SWITCH_TRUE); + if (!ret) { + break; + } + } + + switch_sleep(5000 * 1000); + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session); + switch_sleep(1000 * 1000); + + switch_event_unbind_callback(event_handler); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); } - switch_sleep(5000 * 1000); - - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - - switch_core_session_rwunlock(session); - switch_sleep(1000 * 1000); - - switch_event_unbind_callback(event_handler); - /* sipp should timeout, attempt kill, just in case.*/ - kill_sipp(); - fst_check(test_success); test_success = 0; } FST_TEST_END() @@ -476,7 +480,7 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) if (!strchr(local_ip_v6,'[')) { ipv6 = switch_mprintf("[%s]", local_ip_v6); } - status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, "loopback/+15553334444", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); if (!ipv6) { sipp_ret = start_sipp_uac(local_ip_v6, 6060, "1001", "sipp-scenarios/uac_digest_leak-ipv6.xml", "-i [::1]"); @@ -485,38 +489,38 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) } if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ - } - - fst_check(status == SWITCH_STATUS_SUCCESS); - if (!session) { - fst_requires(session); - } - - channel = switch_core_session_get_channel(session); - fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); - - while (1) { - int ret; - switch_sleep(1000 * 1000); - ret = switch_system("pidof sipp", SWITCH_TRUE); - if (!ret) { - break; + fst_check(!"sipp not found"); + } else { + fst_check(status == SWITCH_STATUS_SUCCESS); + if (!session) { + fst_check(!"no session"); } + + channel = switch_core_session_get_channel(session); + fst_xcheck(switch_channel_get_state(channel) < CS_HANGUP, "Expect call not to be hung up"); + + while (1) { + int ret; + switch_sleep(1000 * 1000); + ret = switch_system("pidof sipp", SWITCH_TRUE); + if (!ret) { + break; + } + } + + switch_sleep(5000 * 1000); + + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + + switch_core_session_rwunlock(session); + switch_sleep(1000 * 1000); + + switch_event_unbind_callback(event_handler); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + switch_safe_free(ipv6); + fst_check(test_success); } - - switch_sleep(5000 * 1000); - - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - - switch_core_session_rwunlock(session); - switch_sleep(1000 * 1000); - - switch_event_unbind_callback(event_handler); - /* sipp should timeout, attempt kill, just in case.*/ - kill_sipp(); - switch_safe_free(ipv6); - fst_check(test_success); skiptest: test_success = 0; } @@ -531,19 +535,20 @@ skiptest: sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uas_register.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ + fst_check(!"sipp not found"); + } else { + switch_sleep(1000 * 1000); + + register_gw(); + + switch_sleep(5000 * 1000); + + switch_event_unbind_callback(event_handler_reg_ok); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); } - switch_sleep(1000 * 1000); - - register_gw(); - - switch_sleep(5000 * 1000); - - switch_event_unbind_callback(event_handler_reg_ok); - /* sipp should timeout, attempt kill, just in case.*/ - kill_sipp(); - fst_check(test_success); test_success = 0; } FST_TEST_END() @@ -557,19 +562,20 @@ skiptest: sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uas_register_403.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ + fst_check(!"sipp not found"); + } else { + switch_sleep(1000 * 1000); + + register_gw(); + + switch_sleep(5000 * 1000); + + switch_event_unbind_callback(event_handler_reg_fail); + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); } - switch_sleep(1000 * 1000); - - register_gw(); - - switch_sleep(5000 * 1000); - - switch_event_unbind_callback(event_handler_reg_fail); - /* sipp should timeout, attempt kill, just in case.*/ - kill_sipp(); - fst_check(test_success); test_success = 0; } FST_TEST_END() @@ -587,26 +593,29 @@ skiptest: /* check without 407 Proxy Authentication. If count not 0 fail case. */ sipp_ret = run_sipp(local_ip_v4, 5060, 6091, "1001", "sipp-scenarios/uac_subscriber.xml", auth_password, ""); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ - } - switch_sleep(100 * 1000); + fst_check(!"sipp not found"); + } else { + switch_sleep(100 * 1000); - if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) == SWITCH_STATUS_SUCCESS) { - switch_cache_db_execute_sql2str(dbh, "select count(*) from sip_subscriptions where contact like \"%1001%6091%\";", (char *)&count1, 20, NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Count : %s\n", count1); - } - fst_check_string_equals(count1, "0"); + if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) == SWITCH_STATUS_SUCCESS) { + switch_cache_db_execute_sql2str(dbh, "select count(*) from sip_subscriptions where contact like \"%1001%6091%\";", (char *)&count1, 20, NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Count : %s\n", count1); + } + fst_check_string_equals(count1, "0"); - /* check with 407 Proxy Authentication Required. If count not 1 fail case. */ - sipp_ret = run_sipp(local_ip_v4, 5060, 6090, "1001", "sipp-scenarios/uac_407_subscriber.xml", auth_password, ""); - if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ - } - switch_sleep(100 * 1000); + /* check with 407 Proxy Authentication Required. If count not 1 fail case. */ + sipp_ret = run_sipp(local_ip_v4, 5060, 6090, "1001", "sipp-scenarios/uac_407_subscriber.xml", auth_password, ""); + if (sipp_ret < 0 || sipp_ret == 127) { + fst_check(!"sipp not found"); + } else { + switch_sleep(100 * 1000); - switch_cache_db_execute_sql2str(dbh, "select count(*) from sip_subscriptions where contact like \"%1001%6090%\";", (char *)&count, 20, NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Count : %s\n", count); - fst_check_string_equals(count, "1"); + switch_cache_db_execute_sql2str(dbh, "select count(*) from sip_subscriptions where contact like \"%1001%6090%\";", (char *)&count, 20, NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Count : %s\n", count); + fst_check_string_equals(count, "1"); + + } + } /* sipp should timeout, attempt kill, just in case.*/ kill_sipp(); @@ -622,29 +631,30 @@ skiptest: sipp_ret = start_sipp_uas(local_ip_v4, 6080, "sipp-scenarios/uas_register_no_challange.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ + fst_check(!"sipp not found"); + } else { + switch_sleep(1000 * 1000); + + register_gw(); + + switch_sleep(5000 * 1000); + + /*the REGISTER with Expires 0 */ + unregister_gw(); + + switch_sleep(1000 * 1000); + + register_gw(); + + switch_sleep(1000 * 1000); + + switch_event_unbind_callback(event_handler_reg_ok); + + /* sipp should timeout, attempt kill, just in case.*/ + kill_sipp(); + fst_check(test_success); } - switch_sleep(1000 * 1000); - - register_gw(); - - switch_sleep(5000 * 1000); - - /*the REGISTER with Expires 0 */ - unregister_gw(); - - switch_sleep(1000 * 1000); - - register_gw(); - - switch_sleep(1000 * 1000); - - switch_event_unbind_callback(event_handler_reg_ok); - - /* sipp should timeout, attempt kill, just in case.*/ - kill_sipp(); - fst_check(test_success); test_success = 0; } FST_TEST_END() @@ -662,28 +672,28 @@ skiptest: sipp_ret = start_sipp_uas(local_ip_v4, inv_sipp_port, "sipp-scenarios/uas_407.xml", ""); if (sipp_ret < 0 || sipp_ret == 127) { - fst_requires(0); /* sipp not found */ + fst_check(!"sipp not found"); + } else { + switch_sleep(1000 * 1000); + to = switch_mprintf("sofia/gateway/testgw-noreg/sipp@%s:%d", local_ip_v4, inv_sipp_port); + /*originate will fail if the 407 we get from sipp is dropped due to wrong IP.*/ + status = switch_ivr_originate(NULL, &session, &cause, to, timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(status == SWITCH_STATUS_SUCCESS); + + /*test is considered PASSED if we get a session*/ + if (!session) { + fst_requires(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(); } - - switch_sleep(1000 * 1000); - to = switch_mprintf("sofia/gateway/testgw-noreg/sipp@%s:%d", local_ip_v4, inv_sipp_port); - /*originate will fail if the 407 we get from sipp is dropped due to wrong IP.*/ - status = switch_ivr_originate(NULL, &session, &cause, to, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); - fst_check(status == SWITCH_STATUS_SUCCESS); - - /*test is considered PASSED if we get a session*/ - if (!session) { - fst_requires(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(); } FST_TEST_END() 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 9d1a7d3fee..7ea194f6e4 100644 --- a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c +++ b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c @@ -33,6 +33,8 @@ #include <test/switch_test.h> #include "../mod_sofia.c" +static int timeout_sec = 10; + FST_CORE_EX_BEGIN("./conf", SCF_VG | SCF_USE_SQL) FST_MODULE_BEGIN(mod_sofia, sofia) @@ -101,14 +103,16 @@ FST_TEST_BEGIN(originate_test) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true}sofia/internal/park@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); - fst_requires(session); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true}sofia/internal/park@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + fst_check(session); fst_check(status == SWITCH_STATUS_SUCCESS); - 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); + 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); + } } FST_TEST_END() @@ -120,7 +124,7 @@ FST_TEST_BEGIN(sofia_verify_identity_test_no_identity) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true}sofia/internal/verifyidentity@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true}sofia/internal/verifyidentity@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_check(status != SWITCH_STATUS_SUCCESS); fst_check(cause == SWITCH_CAUSE_NO_IDENTITY); if (session) { @@ -139,7 +143,7 @@ FST_TEST_BEGIN(sofia_verify_identity_test_bad_identity) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true,sip_h_identity=foo;info=bar}sofia/internal/verifyidentity@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true,sip_h_identity=foo;info=bar}sofia/internal/verifyidentity@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_check(status != SWITCH_STATUS_SUCCESS); fst_check(cause == SWITCH_CAUSE_INVALID_IDENTITY); if (session) { @@ -158,7 +162,7 @@ FST_TEST_BEGIN(sofia_verify_identity_test_valid_identity_no_cert_available) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_h_identity=eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cDovLzEyNy4wLjAuMS80MDQucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxNTU1MzIxNDMyMSJdfSwiaWF0IjoxNjE4Mjc5OTYzLCJvcmlnIjp7InRuIjoiMTU1NTEyMzEyMzQifSwib3JpZ2lkIjoiMTMxMzEzMTMifQ.Cm34sISkFWYB6ohtjjJEO71Hyz4TQ5qrTDyYmCXBj-ni5Fe7IbNjmMyvY_lD_Go0u2csWQNe8n03fHSO7Z7nNw;info=<http://127.0.0.1/404.pem>;alg=ES256;ppt=shaken}sofia/internal/+15553214321@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_h_identity=eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cDovLzEyNy4wLjAuMS80MDQucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxNTU1MzIxNDMyMSJdfSwiaWF0IjoxNjE4Mjc5OTYzLCJvcmlnIjp7InRuIjoiMTU1NTEyMzEyMzQifSwib3JpZ2lkIjoiMTMxMzEzMTMifQ.Cm34sISkFWYB6ohtjjJEO71Hyz4TQ5qrTDyYmCXBj-ni5Fe7IbNjmMyvY_lD_Go0u2csWQNe8n03fHSO7Z7nNw;info=<http://127.0.0.1/404.pem>;alg=ES256;ppt=shaken}sofia/internal/+15553214321@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_check(status != SWITCH_STATUS_SUCCESS); fst_check(cause == SWITCH_CAUSE_INVALID_IDENTITY); if (session) { @@ -177,13 +181,15 @@ FST_TEST_BEGIN(sofia_auth_identity_test_attest_a) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=A}sofia/internal/+15553214322@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=A}sofia/internal/+15553214322@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_check(status == SWITCH_STATUS_SUCCESS); - fst_requires(session); - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(session); - switch_sleep(1 * 1000 * 1000); + fst_check(session); + if (session) { + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); + } } FST_TEST_END() @@ -194,13 +200,15 @@ FST_TEST_BEGIN(sofia_auth_identity_test_attest_b) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=B}sofia/internal/+15553214322@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=B}sofia/internal/+15553214322@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_check(status == SWITCH_STATUS_SUCCESS); - fst_requires(session); - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(session); - switch_sleep(1 * 1000 * 1000); + fst_check(session); + if (session) { + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); + } } FST_TEST_END() @@ -211,13 +219,15 @@ FST_TEST_BEGIN(sofia_auth_identity_test_attest_c) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=C}sofia/internal/+15553214322@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_stir_shaken_attest=C}sofia/internal/+15553214322@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_check(status == SWITCH_STATUS_SUCCESS); - fst_requires(session); - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(session); - switch_sleep(1 * 1000 * 1000); + fst_check(session); + if (session) { + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(1 * 1000 * 1000); + } } FST_TEST_END() @@ -228,7 +238,7 @@ FST_TEST_BEGIN(sofia_verify_identity_test_verified_attest_a_expired) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_h_identity=eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cDovLzEyNy4wLjAuMTo4MDgwL2NlcnQucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxNTU1MzIxNDMyMiJdfSwiaWF0IjoxNjE4MzczMTc0LCJvcmlnIjp7InRuIjoiMTU1NTEyMzEyMzQifSwib3JpZ2lkIjoiMzliZDYzZDQtOTE1Mi00MzU0LWFkNjctNjg5NjQ2NmI4ZDI3In0.mUaikwHSOb8RVPwwMZTsqBe57MZY29CgbIqmiiEmyq9DzKZO-y4qShiIVT3serg-xHgC9SCMjUOBWaDfeXnEvA;info=<http://127.0.0.1:8080/cert.pem>;alg=ES256;ppt=shaken}sofia/internal/+15553214322@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231234,ignore_early_media=true,sip_h_identity=eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cDovLzEyNy4wLjAuMTo4MDgwL2NlcnQucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxNTU1MzIxNDMyMiJdfSwiaWF0IjoxNjE4MzczMTc0LCJvcmlnIjp7InRuIjoiMTU1NTEyMzEyMzQifSwib3JpZ2lkIjoiMzliZDYzZDQtOTE1Mi00MzU0LWFkNjctNjg5NjQ2NmI4ZDI3In0.mUaikwHSOb8RVPwwMZTsqBe57MZY29CgbIqmiiEmyq9DzKZO-y4qShiIVT3serg-xHgC9SCMjUOBWaDfeXnEvA;info=<http://127.0.0.1:8080/cert.pem>;alg=ES256;ppt=shaken}sofia/internal/+15553214322@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_check(status != SWITCH_STATUS_SUCCESS); fst_check(cause == SWITCH_CAUSE_CALL_REJECTED); if (session) { @@ -247,13 +257,15 @@ FST_TEST_BEGIN(sofia_auth_identity_test_attest_a_date) switch_status_t status; switch_call_cause_t cause; const char *local_ip_v4 = switch_core_get_variable("local_ip_v4"); - status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231235,ignore_early_media=true,sip_stir_shaken_attest=A}sofia/internal/+15553214323@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{origination_caller_id_number=+15551231235,ignore_early_media=true,sip_stir_shaken_attest=A}sofia/internal/+15553214323@%s:53060", local_ip_v4), timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_check(status == SWITCH_STATUS_SUCCESS); - fst_requires(session); - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(session); - switch_sleep(10 * 1000 * 1000); + fst_check(session); + if (session) { + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); + switch_sleep(10 * 1000 * 1000); + } } FST_TEST_END() #endif From de487b0ada5712aedcaee722e31c4ecda4862933 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed, 19 Jan 2022 00:42:16 -0500 Subject: [PATCH 488/655] [core] Add support to phrase play-file to set a volume attribute --- src/include/switch_module_interfaces.h | 1 + src/switch_ivr_play_say.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index d347b1c7fb..7c54ed67df 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -356,6 +356,7 @@ struct switch_file_handle { switch_size_t samples_in; switch_size_t samples_out; int32_t vol; + int32_t volgranular; switch_audio_resampler_t *resampler; switch_buffer_t *buffer; switch_byte_t *dbuf; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 9f5574d39b..7f8a44eeeb 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -251,7 +251,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio module_name); if (!strcasecmp(func, "play-file")) { - status = switch_ivr_play_file(session, NULL, odata, args); + char *volume_str = (char *) switch_xml_attr_soft(action, "volume"); + switch_file_handle_t pfh = { 0 }; + if (volume_str && switch_is_number(volume_str)) { + int32_t volume = atoi(volume_str); + + 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); + } + status = switch_ivr_play_file(session, &pfh, odata, args); } else if (!strcasecmp(func, "phrase")) { char *name = (char *) switch_xml_attr_soft(action, "phrase"); status = switch_ivr_phrase_macro(session, name, odata, chan_lang, args); @@ -1957,8 +1967,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } #endif #endif - if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->vol) { - switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol); + if (!switch_test_flag(fh, SWITCH_FILE_NATIVE)) { + if (fh->volgranular) { + switch_change_sln_volume_granular(write_frame.data, write_frame.datalen / 2, fh->volgranular); + } else if (fh->vol) { /* deprecated 2022-Q1 */ + switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol); + } } /* write silence while dmachine is in reading state */ From 989097080d48f6e8b28c73ff52f806723d52d580 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 25 Jan 2022 15:29:08 +0300 Subject: [PATCH 489/655] [mod_event_multicast] Fix buffer overflow on module load. --- .../mod_event_multicast/mod_event_multicast.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 206824baf3..1ebf5cb7fe 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -290,7 +290,7 @@ static switch_status_t initialize_sockets(switch_xml_t input_cfg) dst_host_count = switch_separate_string(globals.dst_addrs, ',', dst_hosts, MAX_DST_HOSTS); for (i = 0; i < dst_host_count; i++) { char *ip_addr_groups[8] = { 0 }; - char host_string[sizeof(dst_hosts[i])]; + char *host_string; char ipv6_first_octet[3]; memset(&globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, 0, sizeof(dst_sockaddr_t)); @@ -315,7 +315,8 @@ static switch_status_t initialize_sockets(switch_xml_t input_cfg) } /* flag this address with the address type */ - strcpy(host_string, dst_hosts[i]); + host_string = strdup(dst_hosts[i]); + if (switch_sockaddr_get_family(globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr) == SWITCH_INET) { globals.has_udp = 1; switch_separate_string(host_string, '.', ip_addr_groups, sizeof(ip_addr_groups) / sizeof(ip_addr_groups[0])); @@ -347,6 +348,7 @@ static switch_status_t initialize_sockets(switch_xml_t input_cfg) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Added %s peer: %s", addr_type_names[globals.dst_sockaddrs[globals.num_dst_addrs].addrtype], dst_hosts[i]); globals.dst_sockaddrs[globals.num_dst_addrs].ipaddr = switch_core_strdup(module_pool, dst_hosts[i]); globals.num_dst_addrs++; + switch_safe_free(host_string); } /* create IPv4 source socket */ From 6113db7bd7060a41f4b9b38e6c17dfeaebad4c7a Mon Sep 17 00:00:00 2001 From: Emmanuel Schmidbauer <eschmidbauer@gmail.com> Date: Thu, 27 Jan 2022 08:25:38 -0500 Subject: [PATCH 490/655] [mod_amqp] add support for ssl connections --- src/mod/event_handlers/mod_amqp/mod_amqp.h | 3 +++ .../mod_amqp/mod_amqp_connection.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp.h b/src/mod/event_handlers/mod_amqp/mod_amqp.h index 53ea03836c..0717876040 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp.h +++ b/src/mod/event_handlers/mod_amqp/mod_amqp.h @@ -43,6 +43,7 @@ #include <amqp.h> #include <amqp_framing.h> #include <amqp_tcp_socket.h> +#include <amqp_ssl_socket.h> #ifndef _MSC_VER #include <strings.h> @@ -74,6 +75,8 @@ typedef struct mod_amqp_connection_s { char *password; unsigned int port; unsigned int heartbeat; /* in seconds */ + amqp_boolean_t ssl_on; + amqp_boolean_t ssl_verify_peer; amqp_connection_state_t state; struct mod_amqp_connection_s *next; diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c b/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c index 1da96328f9..91feec93d5 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c @@ -116,6 +116,14 @@ switch_status_t mod_amqp_connection_open(mod_amqp_connection_t *connections, mod amqp_status = -1; while (connection_attempt && amqp_status){ + if (connection_attempt->ssl_on == 1) { + amqp_set_initialize_ssl_library(connection_attempt->ssl_on); + if (!(socket = amqp_ssl_socket_new(newConnection))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not create SSL socket\n"); + goto err; + } + amqp_ssl_socket_set_verify_peer(socket, connection_attempt->ssl_verify_peer); + } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile[%s] trying to connect to AMQP broker %s:%d\n", profile_name, connection_attempt->hostname, connection_attempt->port); @@ -191,6 +199,8 @@ switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_ char *name = (char *) switch_xml_attr_soft(cfg, "name"); char *hostname = NULL, *virtualhost = NULL, *username = NULL, *password = NULL; unsigned int port = 0, heartbeat = 0; + amqp_boolean_t ssl_on = 0; + amqp_boolean_t ssl_verify_peer = 1; if (zstr(name)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Connection missing name attribute\n%s\n", switch_xml_toxml(cfg, 1)); @@ -233,6 +243,10 @@ switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_ if (interval && interval > 0) { heartbeat = interval; } + } else if (!strncmp(var, "ssl_on", 3) && switch_true(val) == SWITCH_TRUE) { + ssl_on = 1; + } else if (!strncmp(var, "ssl_verify_peer", 15) && switch_true(val) == SWITCH_FALSE) { + ssl_verify_peer = 0; } } @@ -242,6 +256,8 @@ switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_ new_con->password = password ? password : "guest"; new_con->port = port ? port : 5672; new_con->heartbeat = heartbeat ? heartbeat : 0; + new_con->ssl_on = ssl_on; + new_con->ssl_verify_peer = ssl_verify_peer; *conn = new_con; return SWITCH_STATUS_SUCCESS; From d249fb8017d6836c407df4d022ba34f0dfe7c5ac Mon Sep 17 00:00:00 2001 From: Hailin Zhou <26061625+zhouhailin@users.noreply.github.com> Date: Thu, 27 Jan 2022 21:28:09 +0800 Subject: [PATCH 491/655] [mod_json_cdr] add timeout param. --- .../conf/autoload_configs/json_cdr.conf.xml | 2 ++ src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml b/src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml index 1862656277..af30c67c07 100644 --- a/src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml +++ b/src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml @@ -23,6 +23,8 @@ <!-- HTTP(S) logging --> <!-- URL where to POST JSON CDRs. Leave empty for no URL logging. Up to 20 URLs may be specified. --> <param name="url" value=""/> + <!-- optional timeout : second --> + <param name="timeout" value="5"/> <!-- Authentication scheme for the above URL. May be one of basic|digest|NTLM|GSS-NEGOTIATE|any--> <param name="auth-scheme" value="basic"/> <!-- Credentials in the form username:password if auth-scheme is used. Leave empty for no authentication. --> diff --git a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c index fc4794a482..7f66aa425a 100644 --- a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c +++ b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c @@ -70,6 +70,7 @@ static struct { int disable100continue; int rotate; long auth_scheme; + int timeout; switch_memory_pool_t *pool; switch_event_node_t *node; int encode_values; @@ -361,8 +362,10 @@ static void process_cdr(cdr_data_t *data) switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file); } + // tcp timeout + switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.timeout); + /* these were used for testing, optionally they may be enabled if someone desires - switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level */ @@ -607,6 +610,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load) globals.log_http_and_disk = switch_true(val); } else if (!strcasecmp(var, "log-errors-to-disk")) { globals.log_errors_to_disk = !switch_false(val); + } else if (!strcasecmp(var, "timeout")) { + int tmp = atoi(val); + if (tmp >= 0) { + globals.timeout = tmp; + } else { + globals.timeout = 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set a negative timeout!\n"); + } } else if (!strcasecmp(var, "delay") && !zstr(val)) { globals.delay = (uint32_t) atoi(val); } else if (!strcasecmp(var, "log-b-leg")) { From 90dd5bb88ec0131693a2cfe21d358b40d820699a Mon Sep 17 00:00:00 2001 From: Nadin Zajimovic <Nadin.Zajimovic@infobip.com> Date: Thu, 3 Feb 2022 18:15:23 +0100 Subject: [PATCH 492/655] [core] set completion cause upon failed recording --- src/switch_ivr_async.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 6d404fd5b4..707f8672dd 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -3114,6 +3114,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess if (switch_dir_make_recursive(path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error creating %s\n", path); + set_completion_cause(rh, "uri-failure"); switch_goto_status(SWITCH_STATUS_GENERR, err); } @@ -3136,6 +3137,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); } + set_completion_cause(rh, "uri-failure"); switch_goto_status(SWITCH_STATUS_GENERR, err); } @@ -3188,6 +3190,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); } + set_completion_cause(rh, "uri-failure"); switch_goto_status(SWITCH_STATUS_GENERR, err); } @@ -3198,6 +3201,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); } + set_completion_cause(rh, "uri-failure"); switch_goto_status(SWITCH_STATUS_GENERR, err); } @@ -3333,6 +3337,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess return SWITCH_STATUS_SUCCESS; err: + if (!zstr(rh->completion_cause)) { + switch_channel_set_variable_printf(channel, "record_completion_cause", "%s", rh->completion_cause); + } record_helper_destroy(&rh, session); return status; From 0072db0dbbfc74f03682df9ee828fa0e049bf074 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 9 Feb 2022 15:20:16 +0300 Subject: [PATCH 493/655] [Build-System] Update libks to 1.8.0 on Windows. --- w32/libks-version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w32/libks-version.props b/w32/libks-version.props index d3880e33c1..c6845777cc 100644 --- a/w32/libks-version.props +++ b/w32/libks-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <libksVersion>1.7.0</libksVersion> + <libksVersion>1.8.0</libksVersion> </PropertyGroup> <PropertyGroup> <libksVersionImported>true</libksVersionImported> From ae272359f4507e314c9ba14d0d8352275a82fece Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Mon, 21 Feb 2022 15:18:45 +0200 Subject: [PATCH 494/655] [core] Handling RTCP MUX resulting in gaps (fix proposed by Leon de Rooij) --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 843ee81381..5398138c99 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -7809,7 +7809,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ switch_core_timer_sync(&rtp_session->timer); reset_jitter_seq(rtp_session); } - goto recvfrom; + continue; } } } From 7fb158ae6a45f60c3019fbae90e07b735ba805b1 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Mon, 21 Feb 2022 15:00:49 +0200 Subject: [PATCH 495/655] [core] RTP: remove unfulfillable conditions involving timer. add missing LF to DEBUG log line. --- src/switch_rtp.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 5398138c99..a7bd2f8d83 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3042,7 +3042,7 @@ SWITCH_DECLARE(void) switch_rtp_set_media_timeout(switch_rtp_t *rtp_session, uin } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, - "%s MEDIA TIMEOUT %s set to %u", switch_core_session_get_name(rtp_session->session), rtp_type(rtp_session), ms); + "%s MEDIA TIMEOUT %s set to %u\n", switch_core_session_get_name(rtp_session->session), rtp_type(rtp_session), ms); rtp_session->media_timeout = ms; switch_rtp_reset_media_timer(rtp_session); } @@ -6610,11 +6610,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t if (rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session)) { - if (!rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] && rtp_session->timer.interval) { - switch_core_timer_sync(&rtp_session->timer); - reset_jitter_seq(rtp_session); - } - status = switch_jb_put_packet(rtp_session->jb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes); if (status == SWITCH_STATUS_TOO_LATE) { goto more; @@ -7805,10 +7800,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ process_rtcp_packet(rtp_session, &rtcp_bytes); ret = 1; - if (!rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] && rtp_session->timer.interval && !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { - switch_core_timer_sync(&rtp_session->timer); - reset_jitter_seq(rtp_session); - } continue; } } From c460588dfe801a7e7ba16dc757c9e5b321e82e25 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 8 Mar 2022 01:40:16 +0300 Subject: [PATCH 496/655] [mod_conference] Fix memory consumption and Media flow direction issue. --- src/mod/applications/mod_conference/mod_conference.c | 6 +++++- src/mod/applications/mod_conference/mod_conference.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index ec1cd5c8f7..f512379cab 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2479,9 +2479,13 @@ SWITCH_STANDARD_APP(conference_function) do { switch_media_flow_t audio_flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO); - if (switch_channel_test_flag(channel, CF_AUDIO) && (audio_flow == SWITCH_MEDIA_FLOW_SENDRECV || audio_flow == SWITCH_MEDIA_FLOW_RECVONLY)) { + if (switch_channel_test_flag(channel, CF_AUDIO) && (audio_flow == SWITCH_MEDIA_FLOW_SENDRECV || audio_flow == SWITCH_MEDIA_FLOW_SENDONLY)) { conference_loop_output(&member); } else { + if (!member.input_thread) { + conference_loop_launch_input(&member, switch_core_session_get_pool(member.session)); + } + if (conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) { switch_yield(100000); member.loop_loop = 1; diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index f6f932fc07..3c28634264 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -1110,6 +1110,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thread, void *obj); void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_t *thread, void *obj); void conference_loop_output(conference_member_t *member); +void conference_loop_launch_input(conference_member_t *member, switch_memory_pool_t *pool); uint32_t conference_file_stop(conference_obj_t *conference, file_stop_t stop); switch_status_t conference_file_play(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async); void conference_member_send_all_dtmf(conference_member_t *member, conference_obj_t *conference, const char *dtmf); From 7e0a7f0f281f286a1584f35b96fe5bd16a13efed Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 7 Jan 2022 15:36:46 +0300 Subject: [PATCH 497/655] [mod_verto] Fix dead nested assignments --- src/mod/endpoints/mod_verto/mod_verto.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 8b69519f6f..8d39806f59 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -2429,7 +2429,7 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char switch_status_t verto_tech_media(verto_pvt_t *tech_pvt, const char *r_sdp, switch_sdp_type_t sdp_type) { - uint8_t match = 0, p = 0; + uint8_t p = 0; switch_assert(tech_pvt != NULL); switch_assert(r_sdp != NULL); @@ -2438,7 +2438,7 @@ switch_status_t verto_tech_media(verto_pvt_t *tech_pvt, const char *r_sdp, switc return SWITCH_STATUS_FALSE; } - if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, r_sdp, &p, sdp_type))) { + if (switch_core_media_negotiate_sdp(tech_pvt->session, r_sdp, &p, sdp_type)) { if (switch_core_media_choose_ports(tech_pvt->session, SWITCH_TRUE, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) { //if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; @@ -3413,7 +3413,7 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); } else if (!strcasecmp(action, "updateMedia")) { const char *sdp = NULL; - uint8_t match = 0, p = 0; + uint8_t p = 0; if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) { switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -3443,7 +3443,7 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock //switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK); //switch_core_session_kill_channel(tech_pvt->session, SWITCH_SIG_BREAK); - if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_REQUEST))) { + if (switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_REQUEST)) { switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0); if (switch_core_media_activate_rtp(tech_pvt->session) != SWITCH_STATUS_SUCCESS) { @@ -3549,7 +3549,7 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock cJSON *dialog; verto_pvt_t *tech_pvt = NULL; const char *call_id = NULL, *sdp = NULL; - uint8_t match = 0, p = 0; + uint8_t p = 0; *response = obj; @@ -3601,7 +3601,7 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock //switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK); //switch_core_session_kill_channel(tech_pvt->session, SWITCH_SIG_BREAK); - if ((match = switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_RESPONSE))) { + if (switch_core_media_negotiate_sdp(tech_pvt->session, tech_pvt->r_sdp, &p, SDP_TYPE_RESPONSE)) { //switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0); if (switch_core_media_activate_rtp(tech_pvt->session) != SWITCH_STATUS_SUCCESS) { @@ -4573,7 +4573,6 @@ static switch_bool_t fsapi_func(const char *method, cJSON *params, jsock_t *jsoc { cJSON *cmd = NULL, *arg = NULL, *reply; switch_stream_handle_t stream = { 0 }; - switch_status_t status = SWITCH_STATUS_SUCCESS; if (params) { cmd = cJSON_GetObjectItem(params, "cmd"); @@ -4598,7 +4597,7 @@ static switch_bool_t fsapi_func(const char *method, cJSON *params, jsock_t *jsoc SWITCH_STANDARD_STREAM(stream); - if (cmd && (status = switch_api_execute(cmd->valuestring, arg ? arg->valuestring : NULL, NULL, &stream)) == SWITCH_STATUS_SUCCESS) { + if (cmd && switch_api_execute(cmd->valuestring, arg ? arg->valuestring : NULL, NULL, &stream) == SWITCH_STATUS_SUCCESS) { cJSON_AddItemToObject(reply, "message", cJSON_CreateString((char *) stream.data)); } else { cJSON_AddItemToObject(reply, "message", cJSON_CreateString("INVALID CALL")); @@ -5921,10 +5920,9 @@ static switch_status_t verto_write_text_frame(switch_core_session_t *session, sw } if (switch_buffer_inuse(tech_pvt->text_write_buffer)) { - uint32_t datalen; switch_byte_t data[SWITCH_RTP_MAX_BUF_LEN] = ""; - if ((datalen = switch_buffer_read(tech_pvt->text_write_buffer, data, 100))) { + if (switch_buffer_read(tech_pvt->text_write_buffer, data, 100)) { cJSON *obj = NULL, *txt = NULL, *params = NULL; jsock_t *jsock; From a40584b465e378b2b74b1933ebc8070342dc25f6 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Tue, 25 Jan 2022 16:27:49 +0200 Subject: [PATCH 498/655] [mod_verto] fix potential memleaks at init. --- src/mod/endpoints/mod_verto/mod_verto.c | 49 +++++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 8d39806f59..2245c33a56 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -6736,6 +6736,26 @@ static void mod_verto_ks_logger(const char *file, const char *func, int line, in va_end(ap); } +static void verto_event_free_subclass() +{ + switch_event_free_subclass(MY_EVENT_LOGIN); + switch_event_free_subclass(MY_EVENT_CLIENT_DISCONNECT); + switch_event_free_subclass(MY_EVENT_CLIENT_CONNECT); +} + +static void verto_destroy_globals_hash_tables() +{ + if (verto_globals.method_hash) { + switch_core_hash_destroy(&verto_globals.method_hash); + } + if (verto_globals.event_channel_hash) { + switch_core_hash_destroy(&verto_globals.event_channel_hash); + } + if (verto_globals.jsock_hash) { + switch_core_hash_destroy(&verto_globals.jsock_hash); + } +} + /* Macro expands to: switch_status_t mod_verto_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) { @@ -6750,16 +6770,22 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) ks_init(); if (switch_event_reserve_subclass(MY_EVENT_LOGIN) != SWITCH_STATUS_SUCCESS) { + ks_shutdown(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_LOGIN); return SWITCH_STATUS_TERM; } if (switch_event_reserve_subclass(MY_EVENT_CLIENT_DISCONNECT) != SWITCH_STATUS_SUCCESS) { + switch_event_free_subclass(MY_EVENT_LOGIN); + ks_shutdown(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_CLIENT_DISCONNECT); return SWITCH_STATUS_TERM; } if (switch_event_reserve_subclass(MY_EVENT_CLIENT_CONNECT) != SWITCH_STATUS_SUCCESS) { + switch_event_free_subclass(MY_EVENT_LOGIN); + switch_event_free_subclass(MY_EVENT_CLIENT_DISCONNECT); + ks_shutdown(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_CLIENT_CONNECT); return SWITCH_STATUS_TERM; } @@ -6810,7 +6836,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) r = init(); - if (r) return SWITCH_STATUS_TERM; + if (r) { + switch_core_hash_destroy(&json_GLOBALS.store_hash); + verto_event_free_subclass(); + switch_event_channel_unbind(NULL, verto_broadcast, NULL); + verto_destroy_globals_hash_tables(); + ks_shutdown(); + return SWITCH_STATUS_TERM; + } if (verto_globals.kslog_on == SWITCH_TRUE) { ks_global_set_logger(mod_verto_ks_logger); @@ -6848,6 +6881,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) if (verto_globals.enable_fs_events) { if (switch_event_bind(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + verto_event_free_subclass(); + switch_event_channel_unbind(NULL, verto_broadcast, NULL); + switch_core_hash_destroy(&json_GLOBALS.store_hash); + verto_destroy_globals_hash_tables(); + ks_global_set_logger(NULL); + ks_shutdown(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_GENERR; } @@ -6865,9 +6904,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_verto_shutdown) { - switch_event_free_subclass(MY_EVENT_LOGIN); - switch_event_free_subclass(MY_EVENT_CLIENT_DISCONNECT); - switch_event_free_subclass(MY_EVENT_CLIENT_CONNECT); + verto_event_free_subclass(); json_cleanup(); switch_core_hash_destroy(&json_GLOBALS.store_hash); @@ -6881,9 +6918,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_verto_shutdown) attach_wake(); attach_wake(); - switch_core_hash_destroy(&verto_globals.method_hash); - switch_core_hash_destroy(&verto_globals.event_channel_hash); - switch_core_hash_destroy(&verto_globals.jsock_hash); + verto_destroy_globals_hash_tables(); ks_global_set_logger(NULL); ks_shutdown(); From 24355b63ab7b79cba1c6b2db445387bfce78df63 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Tue, 15 Mar 2022 18:47:06 +0200 Subject: [PATCH 499/655] [mod_local_stream] fix path with ".loc" file extension. --- src/mod/formats/mod_local_stream/mod_local_stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 a38411e954..2587313c36 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -311,6 +311,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void switch_size_t olen; const char *artist = NULL, *title = NULL; char tmp_space[128] = ""; + const char *l; if (fd > -1) { char *pb; @@ -330,7 +331,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", source->location, SWITCH_PATH_SEPARATOR, fname); - if (switch_stristr(".loc", path_buf)) { + if ((l = switch_stristr(".loc", fname)) && (l == fname + strlen(fname) - 4)) { if ((fd = open(path_buf, O_RDONLY)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s\n", fname); switch_yield(1000000); From d01c427c0baf31cc3ca34506c469e241001379bc Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 18 Mar 2022 00:54:46 +0300 Subject: [PATCH 500/655] [mod_conference] Fix regression made by previous commit when fixing memory consumption. --- .../mod_conference/conference_loop.c | 27 +++++++++---------- .../mod_conference/mod_conference.c | 12 ++++++++- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index 8c3804ef8c..f6c2856892 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -1286,15 +1286,19 @@ void conference_loop_launch_input(conference_member_t *member, switch_memory_poo { switch_threadattr_t *thd_attr = NULL; - if (member == NULL || member->input_thread) - return; - - switch_threadattr_create(&thd_attr, pool); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - conference_utils_member_set_flag_locked(member, MFLAG_ITHREAD); - if (switch_thread_create(&member->input_thread, thd_attr, conference_loop_input, member, pool) != SWITCH_STATUS_SUCCESS) { - conference_utils_member_clear_flag_locked(member, MFLAG_ITHREAD); + switch_mutex_lock(member->flag_mutex); + + if (member != NULL && !conference_utils_member_test_flag(member, MFLAG_ITHREAD)) { + switch_threadattr_create(&thd_attr, pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME); + conference_utils_member_set_flag_locked(member, MFLAG_ITHREAD); + if (switch_thread_create(&member->input_thread, thd_attr, conference_loop_input, member, pool) != SWITCH_STATUS_SUCCESS) { + conference_utils_member_clear_flag_locked(member, MFLAG_ITHREAD); + } } + + switch_mutex_unlock(member->flag_mutex); } /* marshall frames from the conference (or file or tts output) to the call leg */ @@ -1314,7 +1318,6 @@ void conference_loop_output(conference_member_t *member) call_list_t *call_list, *cp; switch_codec_implementation_t read_impl = { 0 }, real_read_impl = { 0 }; int sanity; - switch_status_t st; switch_core_session_get_read_impl(member->session, &read_impl); switch_core_session_get_real_read_impl(member->session, &real_read_impl); @@ -1654,12 +1657,6 @@ void conference_loop_output(conference_member_t *member) if (!member->loop_loop) { conference_utils_member_clear_flag_locked(member, MFLAG_RUNNING); - - /* Wait for the input thread to end */ - if (member->input_thread) { - switch_thread_join(&st, member->input_thread); - member->input_thread = NULL; - } } switch_core_timer_destroy(&timer); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index f512379cab..d6cdab6ef7 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2482,7 +2482,7 @@ SWITCH_STANDARD_APP(conference_function) if (switch_channel_test_flag(channel, CF_AUDIO) && (audio_flow == SWITCH_MEDIA_FLOW_SENDRECV || audio_flow == SWITCH_MEDIA_FLOW_SENDONLY)) { conference_loop_output(&member); } else { - if (!member.input_thread) { + if (!conference_utils_member_test_flag(&member, MFLAG_ITHREAD)) { conference_loop_launch_input(&member, switch_core_session_get_pool(member.session)); } @@ -2495,6 +2495,16 @@ SWITCH_STANDARD_APP(conference_function) } } while (member.loop_loop); + conference_utils_member_clear_flag_locked(&member, MFLAG_RUNNING); + + /* Wait for the input thread to end */ + if (member.input_thread) { + switch_status_t st; + + switch_thread_join(&st, member.input_thread); + member.input_thread = NULL; + } + switch_core_session_video_reset(session); switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ); From 6913ccd41bda5547d23c3cd60af77d232fee226c Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 18 Mar 2022 03:17:33 +0300 Subject: [PATCH 501/655] [Testing] Enable repo auth on Drone CI --- .drone.yml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 947424b302..1af6f67826 100644 --- a/.drone.yml +++ b/.drone.yml @@ -13,9 +13,15 @@ steps: - name: configure image: signalwire/freeswitch-public-base pull: always + environment: + REPOTOKEN: + from_secret: repotoken commands: + - echo "machine freeswitch.signalwire.com password $REPOTOKEN" > /etc/apt/auth.conf - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libsofia-sip-ua0 libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libspandsp3-dev + - export REPOTOKEN='' + - rm -rf /etc/apt/auth.conf - git clone https://github.com/freeswitch/sofia-sip.git - cd sofia-sip && ./autogen.sh && ./configure.gnu && make -j`nproc` && make install && cd .. - echo 'codecs/mod_openh264' >> modules.conf @@ -29,9 +35,15 @@ steps: - name: build image: signalwire/freeswitch-public-base pull: always + environment: + REPOTOKEN: + from_secret: repotoken commands: + - echo "machine freeswitch.signalwire.com password $REPOTOKEN" > /etc/apt/auth.conf - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libsofia-sip-ua0 libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libspandsp3-dev + - export REPOTOKEN='' + - rm -rf /etc/apt/auth.conf - cd sofia-sip && make install && cd .. - echo '#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./build-status.txt\n' > build.sh - chmod +x build.sh @@ -40,9 +52,15 @@ steps: - name: run-tests image: signalwire/freeswitch-public-base pull: always + environment: + REPOTOKEN: + from_secret: repotoken commands: + - echo "machine freeswitch.signalwire.com password $REPOTOKEN" > /etc/apt/auth.conf - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libsofia-sip-ua0 libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libspandsp3-dev + - export REPOTOKEN='' + - rm -rf /etc/apt/auth.conf - cd sofia-sip && make install && cd .. - make install || true - cd tests/unit @@ -86,9 +104,15 @@ steps: - name: configure image: signalwire/freeswitch-public-base pull: always + environment: + REPOTOKEN: + from_secret: repotoken commands: + - echo "machine freeswitch.signalwire.com password $REPOTOKEN" > /etc/apt/auth.conf - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev + - export REPOTOKEN='' + - rm -rf /etc/apt/auth.conf - cp build/modules.conf.most modules.conf #Enable/Uncomment mods - echo 'codecs/mod_openh264' >> modules.conf @@ -117,9 +141,15 @@ steps: - name: scan-build image: signalwire/freeswitch-public-base pull: always + environment: + REPOTOKEN: + from_secret: repotoken commands: + - echo "machine freeswitch.signalwire.com password $REPOTOKEN" > /etc/apt/auth.conf - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev - DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev + - 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 - chmod +x scan.sh @@ -147,6 +177,6 @@ trigger: --- kind: signature -hmac: a85b0db203d2c9a71c3e4a63a46b5513fbdb3b8f5135e21d0fe0992f33626824 +hmac: 2d5d834ca6a67e0c22a7ce7407ee9de8520eb11789f3a9c836f3ec8ad5c53c87 ... 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 502/655] [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 4e22812eec6959053adae2398c327d3caa7dae8c Mon Sep 17 00:00:00 2001 From: soroshsabz <soorosh_abi@hotmail.com> Date: Mon, 21 Mar 2022 01:04:47 +0330 Subject: [PATCH 503/655] [Docker] Correct keyserver and key id in the Dockerfile --- docker/master/Dockerfile | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/docker/master/Dockerfile b/docker/master/Dockerfile index 9ed9b4dab6..a746af635b 100644 --- a/docker/master/Dockerfile +++ b/docker/master/Dockerfile @@ -1,5 +1,7 @@ # vim:set ft=dockerfile: -FROM debian:jessie +ARG DEBIAN_VERSION=buster +FROM debian:${DEBIAN_VERSION} +ARG TOKEN # Source Dockerfile: # https://github.com/docker-library/postgres/blob/master/9.4/Dockerfile @@ -8,7 +10,11 @@ FROM debian:jessie RUN groupadd -r freeswitch --gid=999 && useradd -r -g freeswitch --uid=999 freeswitch # grab gosu for easy step-down from root -RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 +RUN apt-get update && apt-get install -y --no-install-recommends dirmngr gnupg2 \ + && gpg2 --keyserver hkp://keyserver.ubuntu.com --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && gpg2 --keyserver hkp://keyserver.ubuntu.com --recv-keys 655DA1341B5207915210AFE936B4249FA7B0FB03 \ + && gpg2 --output /usr/share/keyrings/signalwire-freeswitch-repo.gpg --export 655DA1341B5207915210AFE936B4249FA7B0FB03 \ + && apt-get purge -y --auto-remove gnupg2 RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ @@ -22,25 +28,15 @@ RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 -# https://files.freeswitch.org/repo/deb/freeswitch-1.*/dists/jessie/main/binary-amd64/Packages +# https://freeswitch.org/confluence/display/FREESWITCH/Debian -ENV FS_MAJOR debian-unstable - -RUN sed -i "s/jessie main/jessie main contrib non-free/" /etc/apt/sources.list - -# https://freeswitch.org/confluence/display/FREESWITCH/Debian+8+Jessie#Debian8Jessie-InstallingfromDebianpackages - -RUN apt-get update && apt-get install -y curl \ - && curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add - \ - && echo "deb http://files.freeswitch.org/repo/deb/$FS_MAJOR/ jessie main" > /etc/apt/sources.list.d/freeswitch.list \ - && apt-get purge -y --auto-remove curl - -RUN apt-get update && apt-get install -y freeswitch-all \ +RUN apt-get update && apt-get install ca-certificates lsb-release -y --no-install-recommends \ + && echo "machine freeswitch.signalwire.com login signalwire password ${TOKEN}" > /etc/apt/auth.conf \ + && echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ `lsb_release -sc` main" > /etc/apt/sources.list.d/freeswitch.list \ + && apt-get update && apt-get install -y freeswitch-all \ + && apt-get purge -y --auto-remove ca-certificates lsb-release \ && apt-get clean && rm -rf /var/lib/apt/lists/* -# Clean up -RUN apt-get autoremove - COPY docker-entrypoint.sh / # Add anything else here From 92766c7388d0fccdf6f614c02d8f44e1c633aa9e Mon Sep 17 00:00:00 2001 From: soroshsabz <soorosh_abi@hotmail.com> Date: Mon, 21 Mar 2022 01:48:11 +0330 Subject: [PATCH 504/655] [Docker] Fix broken gpg --verify and Dockerfile cleanup --- docker/master/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docker/master/Dockerfile b/docker/master/Dockerfile index a746af635b..e9b626b400 100644 --- a/docker/master/Dockerfile +++ b/docker/master/Dockerfile @@ -10,18 +10,17 @@ ARG TOKEN RUN groupadd -r freeswitch --gid=999 && useradd -r -g freeswitch --uid=999 freeswitch # grab gosu for easy step-down from root -RUN apt-get update && apt-get install -y --no-install-recommends dirmngr gnupg2 \ +RUN apt-get update && apt-get install -y --no-install-recommends dirmngr gnupg2 ca-certificates wget \ && gpg2 --keyserver hkp://keyserver.ubuntu.com --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg2 --keyserver hkp://keyserver.ubuntu.com --recv-keys 655DA1341B5207915210AFE936B4249FA7B0FB03 \ && gpg2 --output /usr/share/keyrings/signalwire-freeswitch-repo.gpg --export 655DA1341B5207915210AFE936B4249FA7B0FB03 \ - && apt-get purge -y --auto-remove gnupg2 -RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ + && rm -rf /var/lib/apt/lists/* \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ - && apt-get purge -y --auto-remove ca-certificates wget + && apt-get purge -y --auto-remove ca-certificates wget dirmngr gnupg2 # make the "en_US.UTF-8" locale so freeswitch will be utf-8 enabled by default RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ From df81021a11b0ce554cd3fc7571492a2cfa2ef087 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 23 Feb 2022 12:23:57 +0200 Subject: [PATCH 505/655] [core] make switch_core_media_prepare_codecs() more unit-test friendly. --- src/include/switch_core_media.h | 2 +- src/switch_core_media.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 8722e05a1f..78f43f3725 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -252,7 +252,7 @@ SWITCH_DECLARE(void)switch_core_media_set_local_sdp(switch_core_session_t *sessi SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t *session, switch_t38_options_t *t38_options, int insist); SWITCH_DECLARE(switch_core_media_params_t *) switch_core_media_get_mparams(switch_media_handle_t *smh); -SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force); +SWITCH_DECLARE(switch_status_t) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force); SWITCH_DECLARE(void) switch_core_media_start_udptl(switch_core_session_t *session, switch_t38_options_t *t38_options); SWITCH_DECLARE(void) switch_core_media_hard_mute(switch_core_session_t *session, switch_bool_t on); SWITCH_DECLARE(cJSON *) switch_core_media_gen_json_constraint(float min, float ideal, float max); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 1b7f392761..c69134844b 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -2353,7 +2353,7 @@ SWITCH_DECLARE(switch_core_media_params_t *) switch_core_media_get_mparams(switc return smh->mparams; } -SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force) +SWITCH_DECLARE(switch_status_t) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force) { const char *abs, *codec_string = NULL; const char *ocodec = NULL, *val; @@ -2363,11 +2363,11 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses switch_assert(session); if (!(smh = session->media_handle)) { - return; + return SWITCH_STATUS_FALSE; } if (!force && (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || switch_channel_test_flag(session->channel, CF_PROXY_MEDIA))) { - return; + return SWITCH_STATUS_FALSE; } if (force) { @@ -2375,7 +2375,7 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses } if (smh->mparams->num_codecs) { - return; + return SWITCH_STATUS_FALSE; } ocodec = switch_channel_get_variable(session->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE); @@ -2419,6 +2419,7 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses switch_channel_set_variable(session->channel, "rtp_use_codec_string", codec_string); smh->codec_order_last = switch_separate_string(tmp_codec_string, ',', smh->codec_order, SWITCH_MAX_CODECS); smh->mparams->num_codecs = switch_loadable_module_get_codecs_sorted(smh->codecs, smh->fmtp, SWITCH_MAX_CODECS, smh->codec_order, smh->codec_order_last); + return SWITCH_STATUS_SUCCESS; } static void check_jb(switch_core_session_t *session, const char *input, int32_t jb_msec, int32_t maxlen, switch_bool_t silent) From 3d283a989d8ee30dbb3c11be1b9c5f0f68163834 Mon Sep 17 00:00:00 2001 From: Clarence <xjh.azzbcc@gmail.com> Date: Wed, 23 Mar 2022 17:00:02 +0800 Subject: [PATCH 506/655] [core] fix memory leak in switch_core_asr_feed --- src/switch_core_asr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c index dd0df4302e..6b91922a8a 100644 --- a/src/switch_core_asr.c +++ b/src/switch_core_asr.c @@ -233,6 +233,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_close(switch_asr_handle_t *ah, s status = ah->asr_interface->asr_close(ah, flags); switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED); + switch_safe_free(ah->dbuf); switch_resample_destroy(&ah->resampler); UNPROTECT_INTERFACE(ah->asr_interface); @@ -260,7 +261,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, vo switch_resample_process(ah->resampler, data, len / 2); if (ah->resampler->to_len * 2 > orig_len) { - if (!ah->dbuf) { + if (ah->dbuflen < ah->resampler->to_len * 2) { void *mem; ah->dbuflen = ah->resampler->to_len * 2; mem = realloc(ah->dbuf, ah->dbuflen); From 0365becc0dc43d2c5c002ae8d2653692e6e01f21 Mon Sep 17 00:00:00 2001 From: Aron Podrigal <aronp@guaranteedplus.com> Date: Fri, 25 Mar 2022 11:44:25 -0500 Subject: [PATCH 507/655] [mod_sofia] Fix fs_path to keep `<>` so that sofia doesn't put the uri parameters as header parameters. Handle multiple `Record-Route` / `Route` and `Path` headers. --- src/mod/endpoints/mod_sofia/mod_sofia.h | 3 ++ src/mod/endpoints/mod_sofia/sofia_glue.c | 61 +++++++++++++++++++----- src/mod/endpoints/mod_sofia/sofia_reg.c | 25 ++-------- 3 files changed, 54 insertions(+), 35 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 3408b7ca0b..9c4da13a67 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -57,6 +57,8 @@ #define HAVE_FUNC 1 #endif +#define ROUTE_MAX_HEADERS 20 +#define ROUTE_ENCODED_HEADER_MAX_CHARS (1024 * 3) #define MAX_CODEC_CHECK_FRAMES 50 #define MAX_MISMATCH_FRAMES 5 #define MODNAME "mod_sofia" @@ -1260,6 +1262,7 @@ void sofia_glue_global_watchdog(switch_bool_t on); uint32_t sofia_presence_get_cseq(sofia_profile_t *profile); void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); +char *sofia_glue_get_encoded_fs_path(nua_handle_t *nh, sip_route_t *rt, switch_bool_t add_fs_path_prefix); char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua_handle_t *nh, sofia_dispatch_event_t *de, sofia_nat_parse_t *np); void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on); void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 4d37fc97f9..955b75f899 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3294,6 +3294,44 @@ void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const } +char *sofia_glue_get_encoded_fs_path(nua_handle_t *nh, sip_route_t *rt, switch_bool_t add_fs_path_prefix) +{ + char *route = NULL; + int count = 0; + char route_buf[ROUTE_ENCODED_HEADER_MAX_CHARS] = {0}; + sip_route_t *rrp; + switch_stream_handle_t rr_stream = { 0 }; + SWITCH_STANDARD_STREAM(rr_stream); + + if (add_fs_path_prefix) { + rr_stream.write_function(&rr_stream, ";fs_path="); + } + + for(rrp = rt; rrp; rrp = rrp->r_next) { + char *sep = count == 0 ? "" : "%2C"; + char *rr = sip_header_as_string(nua_handle_home(nh), (void *) rrp); + switch_url_encode(rr, route_buf, ROUTE_ENCODED_HEADER_MAX_CHARS); + rr_stream.write_function(&rr_stream, "%s%s", sep, route_buf); + su_free(nua_handle_home(nh), rr); + + if (count >= ROUTE_MAX_HEADERS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ROUTE_MAX_HEADERS of %d reached\n", ROUTE_MAX_HEADERS); + break; + } + count++; + } + + if (!zstr((char *) rr_stream.data)) { + route = rr_stream.data; + } else { + switch_safe_free(rr_stream.data); + } + + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "fs_path with %d Route headers [%s]\n", count, route ? route : ""); + return route; +} + + char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua_handle_t *nh, sofia_dispatch_event_t *de, sofia_nat_parse_t *np) { char *contact_str = NULL; @@ -3388,19 +3426,16 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua } if (sip->sip_record_route) { - char *full_contact = sip_header_as_string(nua_handle_get_home(nh), (void *) contact); - char *route = sofia_glue_strip_uri(sip_header_as_string(nua_handle_get_home(nh), (void *) sip->sip_record_route)); - char *full_contact_dup; - char *route_encoded; - int route_encoded_len; - full_contact_dup = sofia_glue_get_url_from_contact(full_contact, 1); - route_encoded_len = (int)(strlen(route) * 3) + 1; - switch_zmalloc(route_encoded, route_encoded_len); - switch_url_encode(route, route_encoded, route_encoded_len); - contact_str = switch_mprintf("%s <%s;fs_path=%s>", display, full_contact_dup, route_encoded); - free(route); - free(full_contact_dup); - free(route_encoded); + char *fs_path_str = sofia_glue_get_encoded_fs_path(nh, sip->sip_record_route, SWITCH_FALSE); + char *full_contact = sip_header_as_string(nua_handle_home(nh), (void *) contact); + char *full_contact_dup = sofia_glue_get_url_from_contact(full_contact, 1); + if (fs_path_str && full_contact_dup) { + contact_str = switch_mprintf("%s <%s;fs_path=%s>", display, full_contact_dup, fs_path_str); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not get fs_path str.\n"); + } + switch_safe_free(fs_path_str); + switch_safe_free(full_contact_dup); } else if (np->is_nat && np->fs_path) { char *full_contact = sip_header_as_string(nua_handle_get_home(nh), (void *) contact); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index d553f36d1e..a07d47b758 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1524,30 +1524,11 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu if (sip->sip_path) { - char *path_stripped = NULL; - char *path_val_to_encode = NULL; - su_strlst_t *path_list = su_strlst_create(nua_handle_home(nh)); - sip_path_t *next_path = sip->sip_path; - for (; next_path; next_path = next_path->r_next) { - path_val = sip_header_as_string(nua_handle_home(nh), (void *) next_path); - if (path_val) { - path_stripped = sofia_glue_get_url_from_contact(path_val, SWITCH_TRUE); - su_free(nua_handle_home(nh), path_val); - su_strlst_dup_append(path_list, path_stripped); - switch_safe_free(path_stripped); - } + path_encoded = sofia_glue_get_encoded_fs_path(nh, sip->sip_path, SWITCH_TRUE); + if (!path_encoded) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not get fs_path str.\n"); } - path_val = su_strlst_join(path_list, nua_handle_home(nh), ","); - path_val_to_encode = su_strlst_join(path_list, nua_handle_home(nh), "%2C"); - su_strlst_destroy(path_list); - if (path_val_to_encode) { - path_encoded_len = (int)(strlen(path_val_to_encode) * 3) + 1; - switch_zmalloc(path_encoded, path_encoded_len); - switch_copy_string(path_encoded, ";fs_path=", 10); - switch_url_encode(path_val_to_encode, path_encoded + 9, path_encoded_len - 9); - su_free(nua_handle_home(nh), path_val_to_encode); - } } else if (is_nat) { char my_contact_str[1024]; if (uparams) { From e14a2d9c10e90bd5d392e16bd7af2928fe48ac60 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 26 Mar 2022 21:47:42 +0300 Subject: [PATCH 508/655] [Unit-tests] Improve back traces reported by ASAN --- .drone.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1af6f67826..efef5de4da 100644 --- a/.drone.yml +++ b/.drone.yml @@ -29,7 +29,7 @@ steps: - sed -i '/event_handlers\\/mod_rayo/s/^#//g' modules.conf - sed -i '/formats\\/mod_opusfile/s/^#//g' modules.conf - sed -i '/languages\\/mod_lua/s/^#//g' modules.conf - - export ASAN_OPTIONS=log_path=stdout:disable_coredump=0:unmap_shadow_on_exit=1; + - export ASAN_OPTIONS=log_path=stdout:disable_coredump=0:unmap_shadow_on_exit=1:fast_unwind_on_malloc=0 - ./configure --enable-address-sanitizer - name: build @@ -64,6 +64,7 @@ steps: - cd sofia-sip && make install && cd .. - make install || true - cd tests/unit + - export ASAN_OPTIONS=log_path=stdout:disable_coredump=0:unmap_shadow_on_exit=1:fast_unwind_on_malloc=0 - ./run-tests.sh - ls -la /cores - mkdir logs && (mv log_run-tests_*.html logs || true) && (mv backtrace_*.txt logs || true) @@ -177,6 +178,6 @@ trigger: --- kind: signature -hmac: 2d5d834ca6a67e0c22a7ce7407ee9de8520eb11789f3a9c836f3ec8ad5c53c87 +hmac: 8fd652a876c5578617608e516c37c156219c62a29b2f14114e876745a1aab597 ... From 30d5d58e6e243fad31b27a1559f644c68f242018 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Tue, 29 Mar 2022 10:20:42 +0300 Subject: [PATCH 509/655] [core] fix set rtp flag for rtcp events after flags zeroed out. --- src/switch_core_media.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index c69134844b..fea9bcc4d7 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -8710,8 +8710,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi switch_core_media_set_video_codec(session, 0); - - memset(flags, 0, sizeof(flags)); flags[SWITCH_RTP_FLAG_DATAWAIT]++; if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) && !switch_channel_test_flag(session->channel, CF_AVPF) && From 4886383e32fd4238d6e17bd52f19c67c96a6a526 Mon Sep 17 00:00:00 2001 From: prabhugithubme <100773071+prabhugithubme@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:52:25 +0530 Subject: [PATCH 510/655] [Core] Fix switch_core_media_patch_sdp parsing m=text wrongly --- src/switch_core_media.c | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index fea9bcc4d7..e27b81e166 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -12207,7 +12207,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) char o_line[1024] = ""; if (oe >= pe) { - bad = 5; + bad = 4; goto end; } @@ -12263,7 +12263,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) p += 8; if (p >= pe) { - bad = 4; + bad = 6; goto end; } @@ -12271,7 +12271,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) q += 8; if (q >= qe) { - bad = 5; + bad = 7; goto end; } @@ -12280,13 +12280,13 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) q += strlen(port_buf); if (q >= qe) { - bad = 6; + bad = 8; goto end; } while (p && *p && (*p >= '0' && *p <= '9')) { if (p >= pe) { - bad = 7; + bad = 9; goto end; } p++; @@ -12327,14 +12327,14 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) p += 8; if (p >= pe) { - bad = 8; + bad = 10; goto end; } q += 8; if (q >= qe) { - bad = 9; + bad = 11; goto end; } @@ -12342,14 +12342,14 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) q += strlen(vport_buf); if (q >= qe) { - bad = 10; + bad = 12; goto end; } while (p && *p && (*p >= '0' && *p <= '9')) { if (p >= pe) { - bad = 11; + bad = 13; goto end; } @@ -12357,7 +12357,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) } has_video++; - } else if (!strncmp("m=text ", p, 8) && *(p + 8) != '0') { + } else if (!strncmp("m=text ", p, 7) && *(p + 7) != '0') { if (!has_text) { switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_TEXT, 1); clear_pmaps(t_engine); @@ -12386,18 +12386,18 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) //TEXT switch_core_media_set_text_codec(session, SWITCH_FALSE); } - strncpy(q, p, 8); - p += 8; + strncpy(q, p, 7); + p += 7; if (p >= pe) { - bad = 8; + bad = 14; goto end; } - q += 8; + q += 7; if (q >= qe) { - bad = 9; + bad = 15; goto end; } @@ -12405,14 +12405,14 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) q += strlen(tport_buf); if (q >= qe) { - bad = 10; + bad = 16; goto end; } while (p && *p && (*p >= '0' && *p <= '9')) { if (p >= pe) { - bad = 11; + bad = 17; goto end; } @@ -12426,12 +12426,12 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) while (p && *p && *p != '\n') { if (p >= pe) { - bad = 12; + bad = 18; goto end; } if (q >= qe) { - bad = 13; + bad = 19; goto end; } @@ -12439,12 +12439,12 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) } if (p >= pe) { - bad = 14; + bad = 20; goto end; } if (q >= qe) { - bad = 15; + bad = 21; goto end; } From 456041982f05d05317eaaaab4582df6c49edb2e5 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 14 Apr 2022 20:34:59 +0300 Subject: [PATCH 511/655] [Docs] Add Debian 11 Dockerfile example showing how to build FreeSWITCH without repo. --- README.md | 17 ++++++++-- docker/examples/Debian11/Dockerfile | 49 +++++++++++++++++++++++++++++ docker/examples/README.md | 4 +++ 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 docker/examples/Debian11/Dockerfile create mode 100644 docker/examples/README.md diff --git a/README.md b/README.md index f2525918f3..1660933611 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,26 @@ The main index for documentation is available at: * https://freeswitch.org/confluence/ + ### Release notes: * https://freeswitch.org/confluence/display/FREESWITCH/Release+Notes -### Installation +### Install from packages -Step by step tutorials to install FreeSWITCH from packages or source code are available at: +Step by step tutorials to install FreeSWITCH from packages: - * [Debian 10 Buster](https://freeswitch.org/confluence/display/FREESWITCH/Debian+10+Buster) [<b>Recommended</b>] + * [Debian](https://freeswitch.org/confluence/display/FREESWITCH/Debian) [<b>Recommended</b>] + * [Raspberry Pi](https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi) + * [CentOS 7](https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7) + +### Build from source + +Example Dockerfiles to build FreeSWITCH and dependencies from source: + * https://github.com/signalwire/freeswitch/tree/dockerfile/docker/examples + +Step by step tutorials to build FreeSWITCH with provided dependency packages: + * [Debian](https://freeswitch.org/confluence/display/FREESWITCH/Debian#Debian-buildfromsource) [<b>Recommended</b>] * [Raspberry Pi](https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi) * [CentOS 7](https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7) diff --git a/docker/examples/Debian11/Dockerfile b/docker/examples/Debian11/Dockerfile new file mode 100644 index 0000000000..2497a39850 --- /dev/null +++ b/docker/examples/Debian11/Dockerfile @@ -0,0 +1,49 @@ +FROM debian:bullseye +MAINTAINER Andrey Volk <andrey@signalwire.com> + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install git + +RUN git clone https://github.com/signalwire/freeswitch /usr/src/freeswitch +RUN git clone https://github.com/signalwire/libks /usr/src/libs/libks +RUN git clone https://github.com/freeswitch/sofia-sip /usr/src/libs/sofia-sip +RUN git clone https://github.com/freeswitch/spandsp /usr/src/libs/spandsp +RUN git clone https://github.com/signalwire/signalwire-c /usr/src/libs/signalwire-c + +RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install \ +# build + build-essential cmake automake autoconf 'libtool-bin|libtool' pkg-config \ +# general + libssl-dev zlib1g-dev libdb-dev unixodbc-dev libncurses5-dev libexpat1-dev libgdbm-dev bison erlang-dev libtpl-dev libtiff5-dev uuid-dev \ +# core + libpcre3-dev libedit-dev libsqlite3-dev libcurl4-openssl-dev nasm \ +# core codecs + libogg-dev libspeex-dev libspeexdsp-dev \ +# mod_enum + libldns-dev \ +# mod_python3 + python3-dev \ +# mod_av + libavformat-dev libswscale-dev libavresample-dev \ +# mod_lua + liblua5.2-dev \ +# mod_opus + libopus-dev \ +# mod_pgsql + libpq-dev \ +# mod_sndfile + libsndfile1-dev libflac-dev libogg-dev libvorbis-dev + +RUN cd /usr/src/libs/libks && cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1 && make install +RUN cd /usr/src/libs/sofia-sip && ./bootstrap.sh && ./configure CFLAGS="-g -ggdb" --with-pic --with-glib=no --without-doxygen --disable-stun --prefix=/usr && make -j`nproc --all` && make install +RUN cd /usr/src/libs/spandsp && ./bootstrap.sh && ./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr && make -j`nproc --all` && make install +RUN cd /usr/src/libs/signalwire-c && PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && make install + +RUN cd /usr/src/freeswitch && ./bootstrap.sh -j +RUN cd /usr/src/freeswitch && ./configure +RUN cd /usr/src/freeswitch && make -j`nproc` && make install + +# Cleanup the image +RUN apt-get clean + +# Uncomment to cleanup even more +#RUN rm -rf /usr/src/* \ No newline at end of file diff --git a/docker/examples/README.md b/docker/examples/README.md new file mode 100644 index 0000000000..5dd765ab49 --- /dev/null +++ b/docker/examples/README.md @@ -0,0 +1,4 @@ +##### Dockerfile examples showing how to build FreeSWITCH without installing FreeSWITCH repo. + +[Debian 11](https://github.com/signalwire/freeswitch/blob/dockerfile/docker/examples/Debian11/Dockerfile "Debian 11") + From caffa27a55cf29ae0d750874a2e899d3b39db77f Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 22 Apr 2022 21:02:50 +0300 Subject: [PATCH 512/655] [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) [<b>Recommended</b>] From f07a4426824bea832b3408466a2a0f213cfa5e1f Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 18 May 2022 23:45:00 +0300 Subject: [PATCH 513/655] [Core] Avoid using insecure sqlite3_enable_load_extension when SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION is available. --- src/switch_core_db.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/switch_core_db.c b/src/switch_core_db.c index d3701ce91f..afda66af62 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -181,9 +181,14 @@ SWITCH_DECLARE(int) switch_core_db_load_extension(switch_core_db_t *db, const ch int ret = 0; char *err = NULL; +#ifdef SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION + sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, 0); + ret = sqlite3_load_extension(db, extension, 0, &err); +#else sqlite3_enable_load_extension(db, 1); ret = sqlite3_load_extension(db, extension, 0, &err); sqlite3_enable_load_extension(db, 0); +#endif if (err) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LOAD EXTENSION ERR [%s]\n", err); From 56ed4bbf5526e28aef14ebf53eec6c5672ae2afd Mon Sep 17 00:00:00 2001 From: Mike Jerris <mike@signalwire.com> Date: Thu, 19 May 2022 14:32:50 -0600 Subject: [PATCH 514/655] [build] fix postgres detection on osx --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index baec8b2b83..4131e629a6 100644 --- a/configure.ac +++ b/configure.ac @@ -665,12 +665,13 @@ AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no]) case $host in *-darwin*) path_push_unique PKG_CONFIG_PATH /usr/local/opt/libpq/lib/pkgconfig + path_push_unique PKG_CONFIG_PATH /usr/local/opt/openssl/lib/pkgconfig ;; esac if test "$PKG_CONFIG" = "no" \ || test x"$enable_core_pgsql_pkgconfig" = x"no" \ - || ! pkg-config libpq; then + || ! pkg-config --modversion libpq > /dev/null; then if test "$PG_CONFIG" != "no"; then AC_MSG_CHECKING([for PostgreSQL libraries via pg_config]) POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`" @@ -682,7 +683,6 @@ if test "$PKG_CONFIG" = "no" \ POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | awk '{ print $NF }' | awk -F. '{ print $3 }'` fi else - AC_MSG_CHECKING([for PostgreSQL libraries via pkg_config]) POSTGRESQL_CFLAGS="`$PKG_CONFIG --cflags libpq`" POSTGRESQL_LIBDIR="`$PKG_CONFIG libpq --libs-only-L`" From aa161b9e5822d25c5cdfab56459d5a539a40855c Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 19 Feb 2022 18:10:26 +0300 Subject: [PATCH 515/655] [Core] Allow switch_buffer_write() to fill in a buffer with zeros. Add switch_buffer_zero_fill() --- src/include/switch_buffer.h | 4 +++- src/switch_buffer.c | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/include/switch_buffer.h b/src/include/switch_buffer.h index 7025308544..72d9a18e3b 100644 --- a/src/include/switch_buffer.h +++ b/src/include/switch_buffer.h @@ -132,13 +132,15 @@ SWITCH_DECLARE(void) switch_buffer_set_loops(_In_ switch_buffer_t *buffer, _In_ /*! \brief Write data into a switch_buffer_t up to the length of datalen * \param buffer any buffer of type switch_buffer_t - * \param data pointer to the data to be written + * \param data pointer to the data to be written or 0 to fill in with datalen zeros * \param datalen amount of data to be written * \return int amount of buffer used after the write, or 0 if no space available */ SWITCH_DECLARE(switch_size_t) switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen); +#define switch_buffer_zero_fill(_buffer, _datalen) switch_buffer_write(_buffer, 0, _datalen); + /*! \brief Remove data from the buffer * \param buffer any buffer of type switch_buffer_t * \param datalen amount of data to be removed diff --git a/src/switch_buffer.c b/src/switch_buffer.c index 5ca53a4683..bf31952da5 100644 --- a/src/switch_buffer.c +++ b/src/switch_buffer.c @@ -344,7 +344,12 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_write(switch_buffer_t *buffer, const return 0; } - memcpy(buffer->head + buffer->used, data, datalen); + if (data) { + memcpy(buffer->head + buffer->used, data, datalen); + } else { + memset(buffer->head + buffer->used, 0, datalen); + } + buffer->used += datalen; buffer->actually_used += datalen; return buffer->used; From 6b4359f4ae8be8d67e1347f9b304cdf6a0c8542c Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 23 May 2022 22:00:45 +0300 Subject: [PATCH 516/655] [mod_av] Avoid using 16384 stack (or heap) bytes in av_file_write(). Remove ff_input_buffer_padding static variable. --- src/mod/applications/mod_av/avcodec.c | 7 ++----- src/mod/applications/mod_av/avformat.c | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index 703dc1b2ce..a9f6d0927e 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -405,8 +405,6 @@ typedef struct h264_codec_context_s { #define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE #endif -static uint8_t ff_input_buffer_padding[AV_INPUT_BUFFER_PADDING_SIZE] = { 0 }; - #define MAX_PROFILES 100 typedef struct avcodec_profile_s { @@ -753,8 +751,7 @@ static switch_status_t buffer_h263_rfc4629_packets(h264_codec_context_t *context if (len < 0) return SWITCH_STATUS_FALSE; if (startcode) { - uint8_t zeros[2] = { 0 }; - switch_buffer_write(context->nalu_buffer, zeros, 2); + switch_buffer_zero_fill(context->nalu_buffer, 2); } switch_buffer_write(context->nalu_buffer, data, len); @@ -1712,7 +1709,7 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t if (size > 0) { av_init_packet(&pkt); - switch_buffer_write(context->nalu_buffer, ff_input_buffer_padding, sizeof(ff_input_buffer_padding)); + switch_buffer_zero_fill(context->nalu_buffer, AV_INPUT_BUFFER_PADDING_SIZE); switch_buffer_peek_zerocopy(context->nalu_buffer, (const void **)&pkt.data); pkt.size = size; diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index f748968202..1f5e7e5f0e 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -2043,7 +2043,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s int lead_frames = (context->offset * fps) / 1000; for (int x = 0; x < lead_frames; x++) { - switch_buffer_write(context->audio_buffer, buf, datalen); + switch_buffer_zero_fill(context->audio_buffer, datalen); } context->offset = 0; } @@ -2063,8 +2063,7 @@ GCC_DIAG_ON(deprecated-declarations) if (context->closed) { inuse = switch_buffer_inuse(context->audio_buffer); if (inuse < bytes) { - char buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; - switch_buffer_write(context->audio_buffer, buf, bytes - inuse); + switch_buffer_zero_fill(context->audio_buffer, bytes - inuse); } } From 1f055250e19cb1d93dcb4dcb71dcc3781e0fefe9 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 23 May 2022 22:34:29 +0300 Subject: [PATCH 517/655] [mod_av] Remove unused buf variable in av_file_write --- src/mod/applications/mod_av/avformat.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 1f5e7e5f0e..da7d543fa7 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -2037,7 +2037,6 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s datalen = *len * 2 * handle->channels; if (context->offset) { - char buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; switch_size_t samples = *len; int fps = handle->samplerate / samples; int lead_frames = (context->offset * fps) / 1000; From 04df9c12f7e1a786875a6f3299dc766c314b73c1 Mon Sep 17 00:00:00 2001 From: Ken <krice@freeswitch.org> Date: Tue, 7 Jun 2022 11:56:54 -0500 Subject: [PATCH 518/655] [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 <brian@freeswitch.org> --- 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 <krice@freeswitch.org> Date: Tue, 7 Jun 2022 13:44:48 -0500 Subject: [PATCH 519/655] [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 <krice@sipnavigator.com> --- 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 <andywolk@gmail.com> Date: Tue, 7 Jun 2022 19:38:29 +0000 Subject: [PATCH 520/655] 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 <dragos@signalwire.com> Date: Wed, 8 Jun 2022 13:25:35 +0300 Subject: [PATCH 521/655] [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 <markjcrane@gmail.com> Date: Thu, 16 Jun 2022 09:00:09 -0600 Subject: [PATCH 522/655] [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 <dragos@signalwire.com> Date: Sun, 20 Mar 2022 17:25:37 +0300 Subject: [PATCH 523/655] [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 @@ +<?xml version="1.0"?> +<document type="freeswitch/xml"> + <X-PRE-PROCESS cmd="exec-set" data="test=echo 1234"/> + <X-PRE-PROCESS cmd="set" data="default_password=$${test}"/> + <X-PRE-PROCESS cmd="set" data="core_video_blank_image=$${conf_dir}/freeswitch-logo.png"/> + <section name="configuration" description="Various Configuration"> + <configuration name="modules.conf" description="Modules"> + <modules> + <load module="mod_console"/> + <load module="mod_loopback"/> + <load module="mod_commands"/> + <load module="mod_sndfile"/> + <load module="mod_dptools"/> + <load module="mod_tone_stream"/> + <load module="mod_test"/> + </modules> + </configuration> + + <configuration name="console.conf" description="Console Logger"> + <mappings> + <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/> + </mappings> + <settings> + <param name="colorize" value="true"/> + <param name="loglevel" value="debug"/> + + </settings> + </configuration> + + <configuration name="switch.conf" description="Core Configuration"> + + <default-ptimes> + </default-ptimes> + + <settings> + + <param name="colorize-console" value="false"/> + <param name="dialplan-timestamps" value="false"/> + <param name="loglevel" value="debug"/> + <param name="rtp-start-port" value="1234"/> + <param name="rtp-end-port" value="1234"/> + <param name="rtp-enable-zrtp" value="false"/> + + </settings> + </configuration> + + <configuration name="timezones.conf" description="Timezones"> + <timezones> + <zone name="GMT" value="GMT0" /> + </timezones> + </configuration> + + </section> + + <section name="dialplan" description="Regex/XML Dialplan"> + <context name="test"> + <extension> + <condition field="${sip_h_X-COUNTDOWN}" expression="^0$" break="on-true"> + <action application="answer"/> + <action application="playback" data="tone_stream://%(251,0,1004);loops=-1"/> + </condition> + <condition field="${sip_h_X-COUNTDOWN}" expression="^(\d+)$" break="never"> + <action application="export" data="_nolocal_sip_h_X-COUNTDOWN=${expr($1 - 1)}"/> + <anti-action application="export" data="_nolocal_sip_h_X-COUNTDOWN=10"/> + </condition> + <condition> + <action application="bridge" data="sofia/test/1234@127.0.0.1"/> + </condition> + </extension> + </context> + + </section> +</document> 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{Zila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-CV0Vs>nztJ7M z;P01!Dm0WnHS3(+Ta-7OPi);`tbBx(Q7Db(KBai$&<)}q?5-e`jnu4jc0W<xU@B7{ zV&yz?)`Xz6b^3}sHwDV^YSuZszbL1g%D<54o=?t`ekk2Z;<nBJhjNFSb<RFdlv$?o z-K$x-fRzy_efg8beYVa3XJv(bTKDSg3q<MZp|<=(RxTuGZ4k<u1NoIwtm{FEsX}8d zuTrzl*+WH{YOdu|TUq%iIZqLkr}NgXi0eUC%m9b-AGNP@_C=zcWGeS}WaT1OhN0YI z>GTzMZVHq=)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+$$2IS<qmg?XXy-ZD34dO&e;=088nrfXR~qzInNT5Jp0=?ptY?E z4dqd4);T*xl*3Hr&huIMI4i?Y+B$v3otpw>e>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 z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91Lr~V+mRmb& z$2-8G+?}b8<qe{I%v9D`z{(qmCVHUk#@V~*@gN)Bz7n}N1<DtWsLDa2jO)AA<6o>C zK=d?0DaR{}SEJOB+9nGP<*jP1v+rh6K5UNVkEK{Skd;9wQ+47n(JVBScc`__zM-Og z$W*R5z{){H&$yusOx=LvLAU_t%o<V~WTBzlsMb3BZWZOdrn2%NRt{!mSd_@#HH>NU 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 <anthm@freeswitch.org> +* +* 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 <anthm@freeswitch.org> +* Portions created by the Initial Developer are Copyright (C) +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): +* Dragos Oancea <dragos@signalwire.com> +* +* switch_rtp_pcap.c -- tests RTP stack using PCAP. +*/ + + +#include <switch.h> +#include <test/switch_test.h> + +/* 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 <pcap.h> + +#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 <andywolk@gmail.com> Date: Wed, 29 Jun 2022 21:42:37 +0300 Subject: [PATCH 524/655] [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 <dragos@signalwire.com> Date: Wed, 6 Jul 2022 15:26:43 +0300 Subject: [PATCH 525/655] [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 <thiadmer@voipq.nl> Date: Sun, 10 Jul 2022 15:16:07 +0200 Subject: [PATCH 526/655] [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 <andywolk@gmail.com> Date: Tue, 26 Jul 2022 01:47:27 +0300 Subject: [PATCH 527/655] [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 <andywolk@gmail.com> Date: Sat, 23 Jul 2022 22:07:40 +0300 Subject: [PATCH 528/655] [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 <Len-PGH@users.noreply.github.com> Date: Fri, 5 Aug 2022 13:52:48 -0400 Subject: [PATCH 529/655] [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 <dragos@signalwire.com> Date: Mon, 8 Aug 2022 18:56:09 +0300 Subject: [PATCH 530/655] [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 <andywolk@gmail.com> Date: Tue, 4 Jan 2022 18:51:16 +0300 Subject: [PATCH 531/655] [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 <andywolk@gmail.com> Date: Thu, 6 Jan 2022 19:18:26 +0300 Subject: [PATCH 532/655] [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 <andywolk@gmail.com> Date: Thu, 6 Jan 2022 16:39:31 +0300 Subject: [PATCH 533/655] [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 <andywolk@gmail.com> Date: Wed, 12 Jan 2022 16:30:34 +0300 Subject: [PATCH 534/655] 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 <level> | kslog <on|off|logfile e.g. /tmp/ks.log>" 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 "<user@domain> [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 <andywolk@gmail.com> Date: Wed, 5 Jan 2022 18:35:06 +0300 Subject: [PATCH 535/655] [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 <andywolk@gmail.com> Date: Wed, 12 Jan 2022 20:07:20 +0300 Subject: [PATCH 536/655] [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 <andywolk@gmail.com> Date: Tue, 11 Jan 2022 19:16:53 +0300 Subject: [PATCH 537/655] [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 <andywolk@gmail.com> Date: Wed, 5 Jan 2022 01:46:21 +0300 Subject: [PATCH 538/655] [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 <andywolk@gmail.com> Date: Tue, 11 Jan 2022 14:15:44 +0300 Subject: [PATCH 539/655] [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 <andywolk@gmail.com> Date: Fri, 7 Jan 2022 03:09:08 +0300 Subject: [PATCH 540/655] [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 <andywolk@gmail.com> Date: Wed, 5 Jan 2022 19:14:27 +0300 Subject: [PATCH 541/655] [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 <andywolk@gmail.com> Date: Thu, 6 Jan 2022 23:03:02 +0300 Subject: [PATCH 542/655] [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 <word>|del [<word>|*]" 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] <alias> <command> | del [<alias>|*]" 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 <andywolk@gmail.com> Date: Fri, 7 Jan 2022 22:44:48 +0300 Subject: [PATCH 543/655] [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] <uuid>" 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 <andywolk@gmail.com> Date: Fri, 7 Jan 2022 13:43:20 +0300 Subject: [PATCH 544/655] [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 <andywolk@gmail.com> Date: Fri, 7 Jan 2022 14:53:45 +0300 Subject: [PATCH 545/655] [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 <andywolk@gmail.com> Date: Wed, 12 Jan 2022 14:37:56 +0300 Subject: [PATCH 546/655] [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 <andywolk@gmail.com> Date: Wed, 5 Jan 2022 01:49:16 +0300 Subject: [PATCH 547/655] [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 <andywolk@gmail.com> Date: Wed, 12 Jan 2022 14:34:22 +0300 Subject: [PATCH 548/655] [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 <andywolk@gmail.com> Date: Sat, 8 Jan 2022 12:09:53 +0300 Subject: [PATCH 549/655] [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 <andywolk@gmail.com> Date: Thu, 6 Jan 2022 20:16:26 +0300 Subject: [PATCH 550/655] [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 <andywolk@gmail.com> Date: Wed, 5 Jan 2022 02:15:42 +0300 Subject: [PATCH 551/655] [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 <andywolk@gmail.com> Date: Tue, 11 Jan 2022 22:40:17 +0300 Subject: [PATCH 552/655] [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 <andywolk@gmail.com> Date: Thu, 6 Jan 2022 20:54:33 +0300 Subject: [PATCH 553/655] [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 <andywolk@gmail.com> Date: Tue, 9 Aug 2022 01:08:40 +0300 Subject: [PATCH 554/655] [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 <ahrongreenberg@gmail.com> Date: Sun, 21 Aug 2022 01:16:36 -0400 Subject: [PATCH 555/655] [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 556/655] [mod_conference] file descriptor stays open Solution: don't even start to play file if conference is not running. Co-authored-by: Ruslan Andronov <randronov@outlook.com> --- 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 <andywolk@gmail.com> Date: Thu, 25 Aug 2022 20:14:47 +0300 Subject: [PATCH 557/655] [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 @@ <!-- <param name="core-db-dsn" value="postgresql://freeswitch:@127.0.0.1/freeswitch?options=-c%20client_min_messages%3DNOTICE" /> --> <!-- <param name="core-db-dsn" value="mariadb://Server=localhost;Database=freeswitch;Uid=freeswitch;Pwd=pass;" /> --> <!-- <param name="core-db-dsn" value="dsn:username:password" /> --> + + <!-- <param name="odbc-skip-autocommit-flip" value="true" /> --> + <!-- Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for better performance on most linux distro (note, you loose the data if you reboot)) diff --git a/src/include/switch_odbc.h b/src/include/switch_odbc.h index 84e049a1ac..b640f43da9 100644 --- a/src/include/switch_odbc.h +++ b/src/include/switch_odbc.h @@ -51,6 +51,7 @@ typedef enum { SWITCH_ODBC_FAIL = -1 } switch_odbc_status_t; +SWITCH_DECLARE(void) switch_odbc_skip_autocommit_flip(); SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(const char *dsn, const char *username, const char *password); SWITCH_DECLARE(void) switch_odbc_set_num_retries(switch_odbc_handle_t *handle, int num_retries); SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_disconnect(switch_odbc_handle_t *handle); diff --git a/src/switch_core.c b/src/switch_core.c index d1bba3fa3e..b1be132018 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2172,6 +2172,10 @@ static void switch_load_core_config(const char *file) } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-db-handles must be between 5 and 5000\n"); } + } else if (!strcasecmp(var, "odbc-skip-autocommit-flip")) { + if (switch_true(val)) { + switch_odbc_skip_autocommit_flip(); + } } else if (!strcasecmp(var, "db-handle-timeout")) { long tmp = atol(val); diff --git a/src/switch_odbc.c b/src/switch_odbc.c index fbad0e371a..be42080a70 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -62,6 +62,13 @@ struct switch_odbc_handle { }; #endif +uint8_t skip_autocommit_flip = 0; + +SWITCH_DECLARE(void) switch_odbc_skip_autocommit_flip() +{ + skip_autocommit_flip = 1; +} + SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(const char *dsn, const char *username, const char *password) { #ifdef SWITCH_HAVE_ODBC @@ -811,6 +818,10 @@ SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void) SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_SQLSetAutoCommitAttr(switch_odbc_handle_t *handle, switch_bool_t on) { #ifdef SWITCH_HAVE_ODBC + if (skip_autocommit_flip) { + return SWITCH_ODBC_SUCCESS; + } + if (on) { return SQLSetConnectAttr(handle->con, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER *) SQL_AUTOCOMMIT_ON, 0 ); } else { From 9f5c2a1619864ad13a791dd3fa6c59016e94c5d1 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 26 Aug 2022 16:21:01 +0300 Subject: [PATCH 558/655] [mod_sofia] Unit-test: Fix strcmp null argument. --- src/mod/endpoints/mod_sofia/test/sipp-based-tests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 52c7c2f66c..60a7b61a3a 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -48,7 +48,7 @@ static void test_wait_for_uuid(char *uuid) SWITCH_STANDARD_STREAM(stream); switch_api_execute("show", "channels", NULL, &stream); - if (!strncmp((char *)stream.data, "uuid,", 5)) { + if (stream.data && !strncmp((char *)stream.data, "uuid,", 5)) { channel_data = switch_mprintf("%s", (char *)stream.data); switch_safe_free(stream.data); break; @@ -76,7 +76,9 @@ static const char *test_wait_for_chan_var(switch_channel_t *channel, const char int loop_count = 50; const char *var=NULL; do { - if (!strcmp(switch_channel_get_variable(channel, "sip_cseq"),seq)){ + const char *sip_cseq = switch_channel_get_variable(channel, "sip_cseq"); + + if (sip_cseq && seq && !strcmp(sip_cseq, seq)){ switch_sleep(100 * 1000); var = switch_channel_get_variable(channel, "rtp_local_sdp_str"); break; From 060a65601bfc01536898208cb29b34eaee86d6e3 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 26 Aug 2022 21:47:45 +0300 Subject: [PATCH 559/655] [Core] Fix wrong switch_odbc_skip_autocommit_flip function declaration. --- src/include/switch_odbc.h | 2 +- src/switch_odbc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/switch_odbc.h b/src/include/switch_odbc.h index b640f43da9..d36f3742f6 100644 --- a/src/include/switch_odbc.h +++ b/src/include/switch_odbc.h @@ -51,7 +51,7 @@ typedef enum { SWITCH_ODBC_FAIL = -1 } switch_odbc_status_t; -SWITCH_DECLARE(void) switch_odbc_skip_autocommit_flip(); +SWITCH_DECLARE(void) switch_odbc_skip_autocommit_flip(void); SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(const char *dsn, const char *username, const char *password); SWITCH_DECLARE(void) switch_odbc_set_num_retries(switch_odbc_handle_t *handle, int num_retries); SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_disconnect(switch_odbc_handle_t *handle); diff --git a/src/switch_odbc.c b/src/switch_odbc.c index be42080a70..da134811d3 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -64,7 +64,7 @@ struct switch_odbc_handle { uint8_t skip_autocommit_flip = 0; -SWITCH_DECLARE(void) switch_odbc_skip_autocommit_flip() +SWITCH_DECLARE(void) switch_odbc_skip_autocommit_flip(void) { skip_autocommit_flip = 1; } From 4d9c71e2ec0c234c93bed49ce74b62b929c66b93 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 26 Aug 2022 22:47:54 +0300 Subject: [PATCH 560/655] [Unit-tests] Add --enable-fake-dlclose to .drone.yml --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 3d4c06f05a..07ccb34f27 100644 --- a/.drone.yml +++ b/.drone.yml @@ -30,7 +30,7 @@ steps: - sed -i '/formats\\/mod_opusfile/s/^#//g' modules.conf - sed -i '/languages\\/mod_lua/s/^#//g' modules.conf - export ASAN_OPTIONS=log_path=stdout:disable_coredump=0:unmap_shadow_on_exit=1:fast_unwind_on_malloc=0 - - ./configure --enable-address-sanitizer + - ./configure --enable-address-sanitizer --enable-fake-dlclose - name: build image: signalwire/freeswitch-public-base:bullseye @@ -178,6 +178,6 @@ trigger: --- kind: signature -hmac: 96f5b3ecee6a6b61fa39bc748bd68295be30eff4768dcfc53091dd448d3ee28d +hmac: 780e4aaee61e3683ea4a8d6fe5131f7c9e62ebad727546013f18df0fca80d705 ... From 767b163cbdaf101d4715e01fc68d3ed3022cfed3 Mon Sep 17 00:00:00 2001 From: agree <ahrongreenberg@gmail.com> Date: Fri, 26 Aug 2022 17:48:31 -0400 Subject: [PATCH 561/655] [mod_sofia] Fix PRESENCE_PROBE firing on rejection After rejecting the subscription for authentication the function calls goto end. In the end block freeswitch fires PRESENCE_PROBE events and releases the allocated memory * when rejecting a call for auth PRESENCE_PROBE should not get fired * This caused all other subscribers to the same entity to get flooded with NOTIFY's because `call_id` only gets set later in the function, so when firing the PRESENCE_PROBE without `call_id` being set all subscriptions will get a notify * this can be considered a security flaw as any unauthorized user can send SUBSCRIBES and trigger thousands of NOTIFY's to the SUBSCRIBED endpoints This was fixed simply my moving down the end label after the code that sends the PRESENCE_PROBE event --- src/mod/endpoints/mod_sofia/sofia_presence.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 828f665b6c..00cc8561d6 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -4325,7 +4325,6 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_event_fire(&event); } - end: if (strcasecmp(event, "call-info") && strcasecmp(event, "line-seize")) { @@ -4407,6 +4406,8 @@ void sofia_presence_handle_sip_i_subscribe(int status, } } + end: + if (event) { su_free(nua_handle_get_home(nh), event); } From 23eeb4ae759c11a69a88015067976ab3e31a02b7 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 24 Aug 2022 17:19:20 +0300 Subject: [PATCH 562/655] [Unit-tests] Improve stability of some tests. --- src/mod/applications/mod_test/test/test_tts.c | 2 +- tests/unit/switch_hold.c | 11 ++++++++++- tests/unit/switch_ivr_originate.c | 4 ++-- tests/unit/switch_sip.c | 13 +++++++++++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_test/test/test_tts.c b/src/mod/applications/mod_test/test/test_tts.c index e5ec1aa254..83369212d1 100644 --- a/src/mod/applications/mod_test/test/test_tts.c +++ b/src/mod/applications/mod_test/test/test_tts.c @@ -146,7 +146,7 @@ FST_TEST_BEGIN(tts_time) } while (status == SWITCH_STATUS_SUCCESS); fst_check(read = sample_rate / interval * 3); // samples of 3 second - fst_check_duration(3000, 750); + fst_check_duration(3000, 1000); switch_core_speech_close(&sh, &flags); } FST_TEST_END() diff --git a/tests/unit/switch_hold.c b/tests/unit/switch_hold.c index e48865155b..50156e5efe 100644 --- a/tests/unit/switch_hold.c +++ b/tests/unit/switch_hold.c @@ -1,12 +1,21 @@ #include <switch.h> #include <test/switch_test.h> +int timeout_sec = 10; +switch_interval_time_t delay_start_ms = 5000; + FST_CORE_DB_BEGIN("./conf_test") { FST_SUITE_BEGIN(switch_hold) { 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_requires_module("mod_sofia"); fst_requires_module("mod_commands"); } @@ -23,7 +32,7 @@ FST_SUITE_BEGIN(switch_hold) switch_status_t status; switch_call_cause_t cause; - status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/test_gateway/+15553332900", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/test_gateway/+15553332900", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); fst_requires(session); fst_check(status == SWITCH_STATUS_SUCCESS); diff --git a/tests/unit/switch_ivr_originate.c b/tests/unit/switch_ivr_originate.c index 4cf9695275..5603e18f0e 100644 --- a/tests/unit/switch_ivr_originate.c +++ b/tests/unit/switch_ivr_originate.c @@ -482,7 +482,7 @@ FST_CORE_BEGIN("./conf") switch_dial_handle_destroy(&dh); - fst_check_duration(3000, 500); + fst_check_duration(3000, 600); } FST_TEST_END() @@ -513,7 +513,7 @@ FST_CORE_BEGIN("./conf") switch_dial_handle_destroy(&dh); - fst_check_duration(3000, 500); + fst_check_duration(3000, 600); } FST_TEST_END() diff --git a/tests/unit/switch_sip.c b/tests/unit/switch_sip.c index bcb00eac2b..b535823e12 100644 --- a/tests/unit/switch_sip.c +++ b/tests/unit/switch_sip.c @@ -1,12 +1,21 @@ #include <switch.h> #include <test/switch_test.h> +int timeout_sec = 10; +switch_interval_time_t delay_start_ms = 5000; + FST_CORE_DB_BEGIN("./conf_sip") { FST_SUITE_BEGIN(switch_sip) { 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_requires_module("mod_sofia"); fst_requires_module("mod_hash"); } @@ -24,7 +33,7 @@ FST_SUITE_BEGIN(switch_sip) const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>"; char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data); - switch_ivr_originate(NULL, &session, &cause, originate_str, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + switch_ivr_originate(NULL, &session, &cause, originate_str, timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); switch_safe_free(originate_str); fst_requires(session); @@ -60,7 +69,7 @@ FST_SUITE_BEGIN(switch_sip) const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>;alg=ES256;ppt=shaken"; char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data); - switch_ivr_originate(NULL, &session, &cause, originate_str, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + switch_ivr_originate(NULL, &session, &cause, originate_str, timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); switch_safe_free(originate_str); fst_requires(session); From 9468ff746a6444efea37be9c8417cd766357e9a7 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Tue, 16 Aug 2022 16:08:37 -0400 Subject: [PATCH 563/655] [core] remove apr-util from tree --- Makefile.am | 19 +- bootstrap.sh | 3 - cmake_modules/FindAPRUtil.cmake | 49 - configure.ac | 9 +- libs/.gitignore | 35 +- libs/apr-util/.update | 1 - libs/apr-util/CHANGES | 619 --- libs/apr-util/CMakeLists.txt | 36 - libs/apr-util/INSTALL.MySQL | 14 - libs/apr-util/LICENSE | 404 -- libs/apr-util/Makefile.in | 91 - libs/apr-util/NOTICE | 11 - libs/apr-util/NWGNUmakefile | 292 -- libs/apr-util/apr-util.pc.in | 13 - libs/apr-util/apr-util.spec | 89 - libs/apr-util/aprutil.dsp | 587 --- libs/apr-util/aprutil.dsw | 161 - libs/apr-util/apu-config.in | 207 - libs/apr-util/buckets/apr_brigade.c | 702 --- libs/apr-util/buckets/apr_buckets.c | 46 - libs/apr-util/buckets/apr_buckets_alloc.c | 184 - libs/apr-util/buckets/apr_buckets_eos.c | 54 - libs/apr-util/buckets/apr_buckets_file.c | 228 - libs/apr-util/buckets/apr_buckets_flush.c | 54 - libs/apr-util/buckets/apr_buckets_heap.c | 96 - libs/apr-util/buckets/apr_buckets_mmap.c | 144 - libs/apr-util/buckets/apr_buckets_pipe.c | 119 - libs/apr-util/buckets/apr_buckets_pool.c | 142 - libs/apr-util/buckets/apr_buckets_refcount.c | 64 - libs/apr-util/buckets/apr_buckets_simple.c | 137 - libs/apr-util/buckets/apr_buckets_socket.c | 114 - libs/apr-util/build-outputs.mk | 40 - libs/apr-util/build.conf | 32 - libs/apr-util/build/apu-conf.m4 | 435 -- libs/apr-util/build/apu-hints.m4 | 61 - libs/apr-util/build/apu-iconv.m4 | 123 - libs/apr-util/build/dbd.m4 | 278 - libs/apr-util/build/dbm.m4 | 870 --- libs/apr-util/build/find_apu.m4 | 176 - libs/apr-util/build/mkdir.sh | 37 - libs/apr-util/build/pkg/README | 20 - libs/apr-util/build/pkg/buildpkg.sh | 99 - libs/apr-util/build/pkg/pkginfo.in | 11 - libs/apr-util/build/rpm/apr-util.spec.in | 89 - libs/apr-util/build/w32locatedb.pl | 217 - libs/apr-util/buildconf | 111 - libs/apr-util/config.layout | 232 - libs/apr-util/configure.ac | 216 - libs/apr-util/configure.gnu | 4 - libs/apr-util/crypto/apr_md4.c | 404 -- libs/apr-util/crypto/apr_md5.c | 733 --- libs/apr-util/crypto/apr_sha1.c | 372 -- libs/apr-util/crypto/getuuid.c | 209 - libs/apr-util/crypto/uuid.c | 130 - libs/apr-util/dbd/apr_dbd.c | 303 -- libs/apr-util/dbd/apr_dbd_pgsql.c | 664 --- libs/apr-util/dbd/apr_dbd_sqlite2.c | 396 -- libs/apr-util/dbd/apr_dbd_sqlite3.c | 723 --- libs/apr-util/dbm/apr_dbm.c | 207 - libs/apr-util/dbm/apr_dbm_berkeleydb.c | 403 -- libs/apr-util/dbm/apr_dbm_gdbm.c | 270 - libs/apr-util/dbm/apr_dbm_ndbm.c | 227 - libs/apr-util/dbm/apr_dbm_sdbm.c | 265 - libs/apr-util/dbm/sdbm/sdbm.c | 588 --- libs/apr-util/dbm/sdbm/sdbm_hash.c | 63 - libs/apr-util/dbm/sdbm/sdbm_lock.c | 78 - libs/apr-util/dbm/sdbm/sdbm_pair.c | 319 -- libs/apr-util/dbm/sdbm/sdbm_pair.h | 40 - libs/apr-util/dbm/sdbm/sdbm_private.h | 84 - libs/apr-util/dbm/sdbm/sdbm_tune.h | 40 - libs/apr-util/docs/doxygen.conf | 30 - libs/apr-util/encoding/apr_base64.c | 268 - libs/apr-util/export_vars.sh.in | 13 - libs/apr-util/hooks/apr_hooks.c | 404 -- libs/apr-util/include/apr_anylock.h | 128 - libs/apr-util/include/apr_base64.h | 111 - libs/apr-util/include/apr_buckets.h | 1464 ------ libs/apr-util/include/apr_date.h | 106 - libs/apr-util/include/apr_dbd.h | 357 -- libs/apr-util/include/apr_dbm.h | 224 - libs/apr-util/include/apr_hooks.h | 256 - libs/apr-util/include/apr_ldap.h.in | 131 - libs/apr-util/include/apr_ldap.hnw | 133 - libs/apr-util/include/apr_ldap.hw | 124 - libs/apr-util/include/apr_ldap_init.h | 137 - libs/apr-util/include/apr_ldap_option.h | 240 - libs/apr-util/include/apr_ldap_url.h | 117 - libs/apr-util/include/apr_md4.h | 135 - libs/apr-util/include/apr_md5.h | 162 - libs/apr-util/include/apr_optional.h | 92 - libs/apr-util/include/apr_optional_hooks.h | 117 - libs/apr-util/include/apr_queue.h | 154 - libs/apr-util/include/apr_reslist.h | 144 - libs/apr-util/include/apr_rmm.h | 137 - libs/apr-util/include/apr_sdbm.h | 175 - libs/apr-util/include/apr_sha1.h | 121 - libs/apr-util/include/apr_strmatch.h | 81 - libs/apr-util/include/apr_uri.h | 178 - libs/apr-util/include/apr_uuid.h | 76 - libs/apr-util/include/apr_xlate.h | 163 - libs/apr-util/include/apr_xml.h | 356 -- libs/apr-util/include/apu.h.in | 91 - libs/apr-util/include/apu.hnw | 84 - libs/apr-util/include/apu.hw | 113 - libs/apr-util/include/apu_version.h | 134 - libs/apr-util/include/apu_want.h.in | 51 - libs/apr-util/include/apu_want.hnw | 52 - libs/apr-util/include/apu_want.hw | 52 - .../include/private/apr_dbd_internal.h | 257 - .../include/private/apr_dbm_private.h | 125 - libs/apr-util/include/private/apu_config.hw | 39 - .../include/private/apu_select_dbm.h.in | 28 - .../include/private/apu_select_dbm.hw | 32 - libs/apr-util/ldap/NWGNUmakefile | 260 - libs/apr-util/ldap/apr_ldap_init.c | 189 - libs/apr-util/ldap/apr_ldap_option.c | 598 --- libs/apr-util/ldap/apr_ldap_url.c | 694 --- libs/apr-util/libaprutil.dsp | 614 --- libs/apr-util/libaprutil.rc | 66 - libs/apr-util/misc/apr_date.c | 616 --- libs/apr-util/misc/apr_reslist.c | 376 -- libs/apr-util/misc/apr_rmm.c | 446 -- libs/apr-util/misc/apu_version.c | 37 - libs/apr-util/renames_pending | 2 - libs/apr-util/strmatch/apr_strmatch.c | 118 - libs/apr-util/test/Makefile.in | 81 - libs/apr-util/test/Makefile.win | 131 - libs/apr-util/test/NWGNUmakefile | 258 - libs/apr-util/test/abts.c | 416 -- libs/apr-util/test/abts.h | 98 - libs/apr-util/test/abts_tests.h | 37 - libs/apr-util/test/data/.empty | 0 libs/apr-util/test/dbd.c | 407 -- libs/apr-util/test/nw_misc.c | 16 - libs/apr-util/test/nwgnuaputest | 272 - libs/apr-util/test/test_apu.h | 100 - libs/apr-util/test/testbuckets.c | 490 -- libs/apr-util/test/testdate.c | 198 - libs/apr-util/test/testdbd.c | 233 - libs/apr-util/test/testdbm.c | 425 -- libs/apr-util/test/testldap.c | 250 - libs/apr-util/test/testmd4.c | 119 - libs/apr-util/test/testmd5.c | 78 - libs/apr-util/test/testpass.c | 140 - libs/apr-util/test/testqueue.c | 282 - libs/apr-util/test/testreslist.c | 300 -- libs/apr-util/test/testrmm.c | 281 - libs/apr-util/test/teststrmatch.c | 92 - libs/apr-util/test/testuri.c | 230 - libs/apr-util/test/testutil.c | 48 - libs/apr-util/test/testutil.h | 56 - libs/apr-util/test/testuuid.c | 56 - libs/apr-util/test/testxlate.c | 124 - libs/apr-util/test/testxml.c | 219 - libs/apr-util/uri/NWGNUmakefile | 257 - libs/apr-util/uri/apr_uri.c | 462 -- libs/apr-util/xlate/xlate.c | 458 -- libs/apr-util/xml/NWGNUmakefile | 258 - libs/apr-util/xml/apr_xml.c | 976 ---- libs/apr-util/xml/expat/COPYING | 21 - libs/apr-util/xml/expat/Makefile.in | 156 - libs/apr-util/xml/expat/README | 72 - libs/apr-util/xml/expat/buildconf.sh | 77 - libs/apr-util/xml/expat/configure.ac | 120 - libs/apr-util/xml/expat/conftools/PrintPath | 116 - .../apr-util/xml/expat/conftools/config.guess | 1420 ----- libs/apr-util/xml/expat/conftools/config.sub | 1799 ------- libs/apr-util/xml/expat/conftools/install-sh | 251 - libs/apr-util/xml/expat/conftools/missing | 190 - .../xml/expat/conftools/mkinstalldirs | 40 - libs/apr-util/xml/expat/lib/Makefile.in | 154 - libs/apr-util/xml/expat/lib/ascii.h | 86 - libs/apr-util/xml/expat/lib/asciitab.h | 37 - libs/apr-util/xml/expat/lib/config.hnw | 23 - libs/apr-util/xml/expat/lib/expat.dsp | 227 - libs/apr-util/xml/expat/lib/expat.h.in | 742 --- libs/apr-util/xml/expat/lib/iasciitab.h | 38 - libs/apr-util/xml/expat/lib/latin1tab.h | 37 - .../xml/expat/lib/map_osd_ebcdic_df04_1.h | 18 - libs/apr-util/xml/expat/lib/nametab.h | 150 - .../xml/expat/lib/osd_ebcdic_df04_1.h | 81 - libs/apr-util/xml/expat/lib/utf8tab.h | 38 - libs/apr-util/xml/expat/lib/winconfig.h | 28 - libs/apr-util/xml/expat/lib/xml.dsp | 221 - libs/apr-util/xml/expat/lib/xmlparse.c | 4650 ----------------- libs/apr-util/xml/expat/lib/xmlrole.c | 1275 ----- libs/apr-util/xml/expat/lib/xmlrole.h | 100 - libs/apr-util/xml/expat/lib/xmltok.c | 1569 ------ libs/apr-util/xml/expat/lib/xmltok.h | 299 -- libs/apr-util/xml/expat/lib/xmltok_impl.c | 1768 ------- libs/apr-util/xml/expat/lib/xmltok_impl.h | 46 - libs/apr-util/xml/expat/lib/xmltok_ns.c | 98 - src/include/private/switch_apr_pvt.h | 11 + src/include/switch_apr.h | 2 +- src/switch_apr.c | 37 +- .../apr_queue.c => src/switch_apr_queue.c | 66 +- 196 files changed, 60 insertions(+), 49552 deletions(-) delete mode 100644 cmake_modules/FindAPRUtil.cmake delete mode 100644 libs/apr-util/.update delete mode 100644 libs/apr-util/CHANGES delete mode 100644 libs/apr-util/CMakeLists.txt delete mode 100644 libs/apr-util/INSTALL.MySQL delete mode 100644 libs/apr-util/LICENSE delete mode 100644 libs/apr-util/Makefile.in delete mode 100644 libs/apr-util/NOTICE delete mode 100644 libs/apr-util/NWGNUmakefile delete mode 100644 libs/apr-util/apr-util.pc.in delete mode 100644 libs/apr-util/apr-util.spec delete mode 100644 libs/apr-util/aprutil.dsp delete mode 100644 libs/apr-util/aprutil.dsw delete mode 100644 libs/apr-util/apu-config.in delete mode 100644 libs/apr-util/buckets/apr_brigade.c delete mode 100644 libs/apr-util/buckets/apr_buckets.c delete mode 100644 libs/apr-util/buckets/apr_buckets_alloc.c delete mode 100644 libs/apr-util/buckets/apr_buckets_eos.c delete mode 100644 libs/apr-util/buckets/apr_buckets_file.c delete mode 100644 libs/apr-util/buckets/apr_buckets_flush.c delete mode 100644 libs/apr-util/buckets/apr_buckets_heap.c delete mode 100644 libs/apr-util/buckets/apr_buckets_mmap.c delete mode 100644 libs/apr-util/buckets/apr_buckets_pipe.c delete mode 100644 libs/apr-util/buckets/apr_buckets_pool.c delete mode 100644 libs/apr-util/buckets/apr_buckets_refcount.c delete mode 100644 libs/apr-util/buckets/apr_buckets_simple.c delete mode 100644 libs/apr-util/buckets/apr_buckets_socket.c delete mode 100644 libs/apr-util/build-outputs.mk delete mode 100644 libs/apr-util/build.conf delete mode 100644 libs/apr-util/build/apu-conf.m4 delete mode 100644 libs/apr-util/build/apu-hints.m4 delete mode 100644 libs/apr-util/build/apu-iconv.m4 delete mode 100644 libs/apr-util/build/dbd.m4 delete mode 100644 libs/apr-util/build/dbm.m4 delete mode 100644 libs/apr-util/build/find_apu.m4 delete mode 100755 libs/apr-util/build/mkdir.sh delete mode 100644 libs/apr-util/build/pkg/README delete mode 100755 libs/apr-util/build/pkg/buildpkg.sh delete mode 100644 libs/apr-util/build/pkg/pkginfo.in delete mode 100644 libs/apr-util/build/rpm/apr-util.spec.in delete mode 100644 libs/apr-util/build/w32locatedb.pl delete mode 100755 libs/apr-util/buildconf delete mode 100644 libs/apr-util/config.layout delete mode 100644 libs/apr-util/configure.ac delete mode 100644 libs/apr-util/configure.gnu delete mode 100644 libs/apr-util/crypto/apr_md4.c delete mode 100644 libs/apr-util/crypto/apr_md5.c delete mode 100644 libs/apr-util/crypto/apr_sha1.c delete mode 100644 libs/apr-util/crypto/getuuid.c delete mode 100644 libs/apr-util/crypto/uuid.c delete mode 100644 libs/apr-util/dbd/apr_dbd.c delete mode 100644 libs/apr-util/dbd/apr_dbd_pgsql.c delete mode 100644 libs/apr-util/dbd/apr_dbd_sqlite2.c delete mode 100644 libs/apr-util/dbd/apr_dbd_sqlite3.c delete mode 100644 libs/apr-util/dbm/apr_dbm.c delete mode 100644 libs/apr-util/dbm/apr_dbm_berkeleydb.c delete mode 100644 libs/apr-util/dbm/apr_dbm_gdbm.c delete mode 100644 libs/apr-util/dbm/apr_dbm_ndbm.c delete mode 100644 libs/apr-util/dbm/apr_dbm_sdbm.c delete mode 100644 libs/apr-util/dbm/sdbm/sdbm.c delete mode 100644 libs/apr-util/dbm/sdbm/sdbm_hash.c delete mode 100644 libs/apr-util/dbm/sdbm/sdbm_lock.c delete mode 100644 libs/apr-util/dbm/sdbm/sdbm_pair.c delete mode 100644 libs/apr-util/dbm/sdbm/sdbm_pair.h delete mode 100644 libs/apr-util/dbm/sdbm/sdbm_private.h delete mode 100644 libs/apr-util/dbm/sdbm/sdbm_tune.h delete mode 100644 libs/apr-util/docs/doxygen.conf delete mode 100644 libs/apr-util/encoding/apr_base64.c delete mode 100644 libs/apr-util/export_vars.sh.in delete mode 100644 libs/apr-util/hooks/apr_hooks.c delete mode 100644 libs/apr-util/include/apr_anylock.h delete mode 100644 libs/apr-util/include/apr_base64.h delete mode 100644 libs/apr-util/include/apr_buckets.h delete mode 100644 libs/apr-util/include/apr_date.h delete mode 100644 libs/apr-util/include/apr_dbd.h delete mode 100644 libs/apr-util/include/apr_dbm.h delete mode 100644 libs/apr-util/include/apr_hooks.h delete mode 100644 libs/apr-util/include/apr_ldap.h.in delete mode 100644 libs/apr-util/include/apr_ldap.hnw delete mode 100644 libs/apr-util/include/apr_ldap.hw delete mode 100644 libs/apr-util/include/apr_ldap_init.h delete mode 100644 libs/apr-util/include/apr_ldap_option.h delete mode 100644 libs/apr-util/include/apr_ldap_url.h delete mode 100644 libs/apr-util/include/apr_md4.h delete mode 100644 libs/apr-util/include/apr_md5.h delete mode 100644 libs/apr-util/include/apr_optional.h delete mode 100644 libs/apr-util/include/apr_optional_hooks.h delete mode 100644 libs/apr-util/include/apr_queue.h delete mode 100644 libs/apr-util/include/apr_reslist.h delete mode 100644 libs/apr-util/include/apr_rmm.h delete mode 100644 libs/apr-util/include/apr_sdbm.h delete mode 100644 libs/apr-util/include/apr_sha1.h delete mode 100644 libs/apr-util/include/apr_strmatch.h delete mode 100644 libs/apr-util/include/apr_uri.h delete mode 100644 libs/apr-util/include/apr_uuid.h delete mode 100644 libs/apr-util/include/apr_xlate.h delete mode 100644 libs/apr-util/include/apr_xml.h delete mode 100644 libs/apr-util/include/apu.h.in delete mode 100644 libs/apr-util/include/apu.hnw delete mode 100644 libs/apr-util/include/apu.hw delete mode 100644 libs/apr-util/include/apu_version.h delete mode 100644 libs/apr-util/include/apu_want.h.in delete mode 100644 libs/apr-util/include/apu_want.hnw delete mode 100644 libs/apr-util/include/apu_want.hw delete mode 100644 libs/apr-util/include/private/apr_dbd_internal.h delete mode 100644 libs/apr-util/include/private/apr_dbm_private.h delete mode 100644 libs/apr-util/include/private/apu_config.hw delete mode 100644 libs/apr-util/include/private/apu_select_dbm.h.in delete mode 100644 libs/apr-util/include/private/apu_select_dbm.hw delete mode 100644 libs/apr-util/ldap/NWGNUmakefile delete mode 100644 libs/apr-util/ldap/apr_ldap_init.c delete mode 100644 libs/apr-util/ldap/apr_ldap_option.c delete mode 100644 libs/apr-util/ldap/apr_ldap_url.c delete mode 100644 libs/apr-util/libaprutil.dsp delete mode 100644 libs/apr-util/libaprutil.rc delete mode 100644 libs/apr-util/misc/apr_date.c delete mode 100644 libs/apr-util/misc/apr_reslist.c delete mode 100644 libs/apr-util/misc/apr_rmm.c delete mode 100644 libs/apr-util/misc/apu_version.c delete mode 100644 libs/apr-util/renames_pending delete mode 100644 libs/apr-util/strmatch/apr_strmatch.c delete mode 100644 libs/apr-util/test/Makefile.in delete mode 100644 libs/apr-util/test/Makefile.win delete mode 100644 libs/apr-util/test/NWGNUmakefile delete mode 100644 libs/apr-util/test/abts.c delete mode 100644 libs/apr-util/test/abts.h delete mode 100644 libs/apr-util/test/abts_tests.h delete mode 100644 libs/apr-util/test/data/.empty delete mode 100644 libs/apr-util/test/dbd.c delete mode 100644 libs/apr-util/test/nw_misc.c delete mode 100644 libs/apr-util/test/nwgnuaputest delete mode 100644 libs/apr-util/test/test_apu.h delete mode 100644 libs/apr-util/test/testbuckets.c delete mode 100644 libs/apr-util/test/testdate.c delete mode 100644 libs/apr-util/test/testdbd.c delete mode 100644 libs/apr-util/test/testdbm.c delete mode 100644 libs/apr-util/test/testldap.c delete mode 100644 libs/apr-util/test/testmd4.c delete mode 100644 libs/apr-util/test/testmd5.c delete mode 100644 libs/apr-util/test/testpass.c delete mode 100644 libs/apr-util/test/testqueue.c delete mode 100644 libs/apr-util/test/testreslist.c delete mode 100644 libs/apr-util/test/testrmm.c delete mode 100644 libs/apr-util/test/teststrmatch.c delete mode 100644 libs/apr-util/test/testuri.c delete mode 100644 libs/apr-util/test/testutil.c delete mode 100644 libs/apr-util/test/testutil.h delete mode 100644 libs/apr-util/test/testuuid.c delete mode 100644 libs/apr-util/test/testxlate.c delete mode 100644 libs/apr-util/test/testxml.c delete mode 100644 libs/apr-util/uri/NWGNUmakefile delete mode 100644 libs/apr-util/uri/apr_uri.c delete mode 100644 libs/apr-util/xlate/xlate.c delete mode 100644 libs/apr-util/xml/NWGNUmakefile delete mode 100644 libs/apr-util/xml/apr_xml.c delete mode 100644 libs/apr-util/xml/expat/COPYING delete mode 100644 libs/apr-util/xml/expat/Makefile.in delete mode 100644 libs/apr-util/xml/expat/README delete mode 100755 libs/apr-util/xml/expat/buildconf.sh delete mode 100644 libs/apr-util/xml/expat/configure.ac delete mode 100755 libs/apr-util/xml/expat/conftools/PrintPath delete mode 100755 libs/apr-util/xml/expat/conftools/config.guess delete mode 100755 libs/apr-util/xml/expat/conftools/config.sub delete mode 100755 libs/apr-util/xml/expat/conftools/install-sh delete mode 100755 libs/apr-util/xml/expat/conftools/missing delete mode 100755 libs/apr-util/xml/expat/conftools/mkinstalldirs delete mode 100644 libs/apr-util/xml/expat/lib/Makefile.in delete mode 100644 libs/apr-util/xml/expat/lib/ascii.h delete mode 100644 libs/apr-util/xml/expat/lib/asciitab.h delete mode 100644 libs/apr-util/xml/expat/lib/config.hnw delete mode 100644 libs/apr-util/xml/expat/lib/expat.dsp delete mode 100644 libs/apr-util/xml/expat/lib/expat.h.in delete mode 100644 libs/apr-util/xml/expat/lib/iasciitab.h delete mode 100644 libs/apr-util/xml/expat/lib/latin1tab.h delete mode 100644 libs/apr-util/xml/expat/lib/map_osd_ebcdic_df04_1.h delete mode 100644 libs/apr-util/xml/expat/lib/nametab.h delete mode 100644 libs/apr-util/xml/expat/lib/osd_ebcdic_df04_1.h delete mode 100644 libs/apr-util/xml/expat/lib/utf8tab.h delete mode 100644 libs/apr-util/xml/expat/lib/winconfig.h delete mode 100644 libs/apr-util/xml/expat/lib/xml.dsp delete mode 100644 libs/apr-util/xml/expat/lib/xmlparse.c delete mode 100644 libs/apr-util/xml/expat/lib/xmlrole.c delete mode 100644 libs/apr-util/xml/expat/lib/xmlrole.h delete mode 100644 libs/apr-util/xml/expat/lib/xmltok.c delete mode 100644 libs/apr-util/xml/expat/lib/xmltok.h delete mode 100644 libs/apr-util/xml/expat/lib/xmltok_impl.c delete mode 100644 libs/apr-util/xml/expat/lib/xmltok_impl.h delete mode 100644 libs/apr-util/xml/expat/lib/xmltok_ns.c rename libs/apr-util/misc/apr_queue.c => src/switch_apr_queue.c (87%) diff --git a/Makefile.am b/Makefile.am index 739bd29ecb..815eafd188 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,16 +15,6 @@ AM_LIBAPR_CPPFLAGS := $(shell ./libs/apr/apr-1-config --cppflags --includes) AM_LIBAPR_LDFLAGS := $(shell ./libs/apr/apr-1-config --ldflags) AM_LIBAPR_LIBS := $(subst $(switch_builddir)/,,$(shell ./libs/apr/apr-1-config \--libs)) endif -if SYSTEM_APRUTIL -AM_LIBAPU_CPPFLAGS := $(shell apu-1-config --includes) -AM_LIBAPU_LDFLAGS := $(shell apu-1-config --ldflags) -AM_LIBAPU_LIBS := $(shell apu-1-config \--libs) -AM_LIBAPU_LINKLIBTOOL := $(shell apu-1-config \--link-libtool) -else -AM_LIBAPU_CPPFLAGS := $(shell ./libs/apr-util/apu-1-config --includes) -AM_LIBAPU_LDFLAGS := $(shell ./libs/apr-util/apu-1-config --ldflags) -AM_LIBAPU_LIBS := $(subst $(switch_builddir)/,,$(shell ./libs/apr-util/apu-1-config \--libs)) -endif AM_CFLAGS = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS) @@ -141,11 +131,6 @@ CORE_LIBS= if ENABLE_LIBVPX CORE_LIBS += libs/libvpx/libvpx.a endif -if SYSTEM_APRUTIL -CORE_LIBS += $(AM_LIBAPU_LINKLIBTOOL) -else -CORE_LIBS += libs/apr-util/libaprutil-1.la -endif if SYSTEM_APR CORE_LIBS += $(AM_LIBAPR_LINKLIBTOOL) else @@ -340,6 +325,7 @@ nodist_libfreeswitch_la_SOURCES = \ libfreeswitch_la_SOURCES = \ src/switch_apr.c \ + src/switch_apr_queue.c \ src/switch_buffer.c \ src/switch_caller.c \ src/switch_channel.c \ @@ -600,9 +586,6 @@ libs/apr/Makefile: libs/apr/Makefile.in libs/apr/config.status libs/apr libs/apr libs/apr/libapr-1.la: libs/apr/Makefile libs/apr/.update @if [ $(MAKELEVEL) = 0 -o -z "`echo "$(MAKEARGS)" | grep "j"`" ] ; then touch $(switch_srcdir)/src/include/switch.h; cd libs/apr && $(MAKE) $(MFLAGS) && touch libapr-1.la; fi -libs/apr-util/libaprutil-1.la: libs/apr/libapr-1.la libs/apr-util libs/apr-util/.update - @if [ $(MAKELEVEL) = 0 -o -z "`echo "$(MAKEARGS)" | grep "j"`" ] ; then touch $(switch_srcdir)/src/include/switch.h; cd libs/apr-util && $(MAKE) $(MFLAGS) && touch libaprutil-1.la; fi - SRTP_SRC = libs/srtp/srtp/srtp.c libs/srtp/crypto/cipher/cipher.c libs/srtp/crypto/cipher/null_cipher.c \ libs/srtp/crypto/cipher/aes.c libs/srtp/crypto/cipher/aes_icm.c \ libs/srtp/crypto/hash/null_auth.c libs/srtp/crypto/hash/sha1.c \ diff --git a/bootstrap.sh b/bootstrap.sh index b19a522044..46e09f3537 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -170,9 +170,6 @@ bootstrap_apr() { # Remove autoconf 2.5x's cache directory rm -rf autom4te*.cache - echo "Entering directory ${LIBDIR}/apr-util" - cd ${LIBDIR}/apr-util - ./buildconf } bootstrap_libzrtp() { diff --git a/cmake_modules/FindAPRUtil.cmake b/cmake_modules/FindAPRUtil.cmake deleted file mode 100644 index 4de5d6050e..0000000000 --- a/cmake_modules/FindAPRUtil.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# Locate APR-Util include paths and libraries - -# This module defines -# APRUTIL_INCLUDES, where to find apr.h, etc. -# APRUTIL_LIBS, the libraries to link against to use APR. -# APRUTIL_FOUND, set to yes if found - -find_program(APRUTIL_CONFIG_EXECUTABLE - apu-1-config - /usr/local/apr-util/1.2.12/bin - /usr/local/bin - /usr/bin - C:/Progra~1/apr/bin - ) - -mark_as_advanced(APRUTIL_CONFIG_EXECUTABLE) - -macro(_apu_invoke _varname _regexp) - execute_process( - COMMAND ${APRUTIL_CONFIG_EXECUTABLE} ${ARGN} - OUTPUT_VARIABLE _apr_output - RESULT_VARIABLE _apr_failed - ) - - if(_apr_failed) - message(FATAL_ERROR "apu-1-config ${ARGN} failed") - else(_apr_failed) - string(REGEX REPLACE "[\r\n]" "" _apr_output "${_apr_output}") - string(REGEX REPLACE " +$" "" _apr_output "${_apr_output}") - - if(NOT ${_regexp} STREQUAL "") - string(REGEX REPLACE "${_regexp}" " " _apr_output "${_apr_output}") - endif(NOT ${_regexp} STREQUAL "") - - separate_arguments(_apr_output) - - set(${_varname} "${_apr_output}") - endif(_apr_failed) -endmacro(_apu_invoke) - -_apu_invoke(APRUTIL_INCLUDES "(^| )-I" --includes) -_apu_invoke(APRUTIL_LIBS "" --link-ld) - -if(APRUTIL_LIBS AND APRUTIL_INCLUDES) - set(APRUTIL_FOUND "YES") - set(APRUTIL_DEFINITIONS "") - message (STATUS "apr-util found: YES ${APRUTIL_LIBS}") -endif(APRUTIL_LIBS AND APRUTIL_INCLUDES) - diff --git a/configure.ac b/configure.ac index 3ee7c58f9d..6d8d140a60 100644 --- a/configure.ac +++ b/configure.ac @@ -844,8 +844,6 @@ PKG_CHECK_MODULES([STIRSHAKEN], [stirshaken],[ AC_CHECK_LIB(apr-1, apr_pool_mutex_set, use_system_apr=yes, use_system_apr=no) AM_CONDITIONAL([SYSTEM_APR],[test "${use_system_apr}" = "yes"]) -AC_CHECK_LIB(aprutil-1, apr_queue_pop_timeout, use_system_aprutil=yes, use_system_aprutil=no) -AM_CONDITIONAL([SYSTEM_APRUTIL],[test "${use_system_aprutil}" = "yes"]) save_LIBS="$LIBS" LIBS= @@ -2333,12 +2331,9 @@ AC_CONFIG_SUBDIRS([libs/srtp]) if test "$use_system_apr" != "yes"; then AC_CONFIG_SUBDIRS([libs/apr]) fi -if test "$use_system_aprutil" != "yes"; then - AC_CONFIG_SUBDIRS([libs/apr-util]) -fi AC_CONFIG_SUBDIRS([libs/iksemel]) -AC_CONFIG_SUBDIRS([libs/libdingaling]) -AC_CONFIG_SUBDIRS([libs/unimrcp]) +#AC_CONFIG_SUBDIRS([libs/libdingaling]) +#AC_CONFIG_SUBDIRS([libs/unimrcp]) if test "x${enable_zrtp}" = "xyes"; then AC_CONFIG_SUBDIRS([libs/libzrtp]) fi diff --git a/libs/.gitignore b/libs/.gitignore index 355bae9a6d..7fbd445cf3 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -41,33 +41,6 @@ opal /apr/Makefile /apr/test/internal/Makefile /apr/test/Makefile -/apr-util/aprutil.exp -/apr-util/apu-1-config -/apr-util/build/apr_common.m4 -/apr-util/build/find_apr.m4 -/apr-util/build/get-version.sh -/apr-util/build/install.sh -/apr-util/build/pkg/pkginfo -/apr-util/build/rules.mk -/apr-util/exports.c -/apr-util/export_vars.c -/apr-util/export_vars.sh -/apr-util/include/apr_ldap.h -/apr-util/include/apu_config.h -/apr-util/include/apu.h -/apr-util/include/apu_select_dbm.h -/apr-util/include/apu_want.h -/apr-util/include/private/apu_config.h -/apr-util/include/private/apu_config.h.in -/apr-util/include/private/apu_select_dbm.h -/apr-util/.make.dirs -/apr-util/Makefile -/apr-util/test/Makefile -/apr-util/xml/expat/config.h -/apr-util/xml/expat/lib/config.h -/apr-util/xml/expat/lib/expat.h -/apr-util/xml/expat/lib/Makefile -/apr-util/xml/expat/Makefile /broadvoice/config-h.in /broadvoice/doc/Makefile /broadvoice/doc/Makefile.in @@ -728,10 +701,6 @@ opal /v8-*.zip # build products we should remove -!/apr-util/xml/expat/conftools/config.guess -!/apr-util/xml/expat/conftools/config.sub -!/apr-util/xml/expat/conftools/install-sh -!/apr-util/xml/expat/conftools/missing !/iksemel/ltmain.sh !/libdingaling/config.guess !/libdingaling/config.sub @@ -759,8 +728,6 @@ unimrcp/build/compile /ldns/ /portaudio/ portaudio.*.log -apr-util/configure -apr-util/xml/expat/configure apr/configure iksemel/configure libdingaling/configure @@ -794,4 +761,4 @@ mariadb-connector-c-* /spandsp*/ /spandsp* win32/spandsp/spandsp.h -win32/spandsp/win32 \ No newline at end of file +win32/spandsp/win32 diff --git a/libs/apr-util/.update b/libs/apr-util/.update deleted file mode 100644 index a573c80504..0000000000 --- a/libs/apr-util/.update +++ /dev/null @@ -1 +0,0 @@ -Thu 18 Nov 2010 20:56:38 EST diff --git a/libs/apr-util/CHANGES b/libs/apr-util/CHANGES deleted file mode 100644 index dbbe4ae567..0000000000 --- a/libs/apr-util/CHANGES +++ /dev/null @@ -1,619 +0,0 @@ -Changes with APR-util 1.2.8 - - *) Add support for Berkeley DB 4.5 to the configure scripts. - [Garrett Rooney] - - *) Allow apr_queue.h to be included before other APR headers. - PR 40891 [Henry Jen <henryjen ztune.net>] - - *) Provide folding in autogenerated .manifest files for Win32 builders - using VisualStudio 2005 [William Rowe] - - *) Implement prepared statement support in SQLite3 DBD driver - [Bojan Smojver] - - *) Fix to ensure that "deprecated" LDAP interfaces are still - exposed if using OpenLDAP 2.3. [Joe Orton] - - *) Fix incorrect byte order and incorrect timestamp type - in the fallback UUID generator used when no external UUID - generator is detected by APR. PR 37342. [Max Bowsher] - -Changes with APR-util 1.2.7 - - *) Fix apr_dbd_init to be safe to call multiple times - [Bojan Smojver <bojan rexursive com>, Nick Kew] - - *) Win32 / Netware - add missing apu_version.c for apu_version_string() - to the Windows and Netware specific builds. Unix platforms supported - this API since 0.9.1. [William Rowe, Brad Nicholes]. - -Changes with APR-util 1.2.6 - - *) Stop trying to link against Berkeley DB by default. To enable use - of Berkeley DB users must now explicitly pass --with-berkeley-db to - configure, since Berkeley DB is released under a viral license that - requires distribution of source code for any program that uses it. - [Garrett Rooney] - - *) Stop trying to link against GDBM by default. To enable use of GDBM - users must now explicitly pass --with-gdbm to configure, since GDBM - is licensed under the GPL. - [Garrett Rooney] - - *) Fix VPATH builds, and symlink builds where apr and apr-util - reside in parallel as symlinks to directories with more explicit - names, e.g. apr-1.x and apr-util-1.x. This solves various breakage - on Solaris in particular with ./buildconf and ./configure. Also - eliminated the nested ../apr-iconv/buildconf, given that apr-util - didn't bother with ../apr/buildconf, and this was inconsistant. - [William Rowe] - - *) Fix the escape implementations for the sqlite2 and sqlite3 dbd - back ends. - [Ronen Mizrahi <ronen tversity.com>, Garrett Rooney] - - *) Add support for Berkeley DB 4.4 to the configure scripts. - [Garrett Rooney] - - *) Fix bug in test suite that cause testbuckets to write 8GB file - on Mac OS X. [Justin Erenkrantz] - -Changes with APR-util 1.2.2 - - *) Teach configure how to find the Novell LDAP SDK. [Graham Leggett] - - *) Fix usage of ldapssl_init/ldap_sslinit on platforms that support - these API's including Win32. Support APR_HAS_LDAP_START_TLS_S - flag in the Win32 LDAP API, to drop usage of ldap_start_ssl_s - and ldap_stop_ssl_s on Win32 by default (change the flag in apr_ldap.hw - to enable if supported on a given OS level). [William Rowe] - -Changes with APR-util 1.2.1 - - *) Fix apr_rmm_realloc() offset calculation bug. [Keith Kelleman - <keith.kelleman oracle.com>] - - *) Add sqlite3 support to APR DBD. [Rick Keiner <rick_keiner yahoo.com>] - - *) Fix build failure with non-threaded APR on AIX. PR 34655. - [Ryan Murray <rmurray+apache cyberhqz.com>] - - *) Add sqlite2 support to APR DBD. [Ryan Phillips <ryan trolocsis.com>] - - *) Introduction of APR DBD layer. [Nick Kew] - -Changes with APR-util 1.1.2 - - *) Fix libaprutil.rc for Win32 builds [William Rowe, Justin Erenkrantz] - -Changes with APR-util 1.1.1 - - *) Fix memory leak in buckets when using APR_POOL_DEBUG mode. [Joe Schaefer] - - *) find_apu.m4: Try installed APR-util before bundled copy if --with-apr-util - not passed to configure. [Justin Erenkrantz] - -Changes with APR-util 1.1.0 - - *) LDAP: Move all certificate initialisation, and the creation of SSL - and TLS connections into the apr_ldap_set_option() API. Add support - for client certificates. [Graham Leggett] - - *) Emit the run-time link path option in apu-config after installation - if the user is linking with libtool. [Justin Erenkrantz] - - *) Port testmd4 and testmd5 to the new test suite. [Thom May] - - *) Allow passing NULL inbuf/inbytes_left parameters to - apr_xlate_conv_buffer(), required to correctly terminate the - output buffer for some stateful character set encodings. - [Joe Orton] - - *) Link libaprutil against the libraries on which it depends. - PR 11122. [Joe Orton] - - *) Add apr_brigade_insert_file() function, to safely insert a file - into a brigade, regardless of size. [Joe Orton] - -Changes with APR-util 1.0.2 - - *) Teach apr_ldap_init() how to handle STARTTLS in addition to the existing - SSL support. Add apr_ldap_option API. [Graham Leggett] - - *) Rework the LDAP toolkit detection to be more accurate than "OpenLDAP - detected regardless", while remaining backwards compatible with v1.0. - [Graham Leggett] - - *) Added the apr_ldap_ssl_add_cert() API to allow multiple certificates - to be stored and used when establishing an SSL connection to different - LDAP servers. [Brad Nicholes] - - *) Fix the detection of ldap.h on Solaris - it needs lber.h to be - defined first. [Graham Leggett] - - *) Add a build script to create a solaris package. [Graham Leggett] - -Changes with APR-util 1.0.1 - - *) Add support for Berkeley DB 4.3. [Jani Averbach <jaa jaa.iki.fi>] - - *) SECURITY: CAN-2004-0786 (cve.mitre.org) - Fix input validation in apr_uri_parse() to avoid passing negative - length to memcpy for malformed IPv6 literal addresses. - [Joe Orton] - -Changes with APR-util 1.0 - - *) Only install apu-$MAJOR-config and add appropriate detection code to - find_apu.m4 (APU_FIND_APU). [Max Bowsher <maxb ukf.net>] - - *) Overhaul support for LDAP URL parsing. Instead of using incompatible - URL parsers and memory that needs freeing, apr-util provides a parser - which parses the URL and allocates memory from a pool. [Graham Leggett] - - *) Remove support for LDAP v2.0 SDK toolkits. This will be added - back properly later assuming there is demand for it. In the mean - time, please use an LDAP v3.0 SDK toolkit. [Graham Leggett] - - *) Add an apr_ldap_err_t structure to handle the return of LDAP - specific error codes. [Graham Leggett, Brad Nicholes] - - *) Add APR functions to do the job of ldap_init(), hiding toolkit - specific SSL/TLS handling. Code derived from httpd util_ldap. - [Graham Leggett] - - *) Add an RPM spec file derived from Fedora Core. - [Graham Leggett, Joe Orton] - - *) The whole codebase was relicensed and is now available under - the Apache License, Version 2.0 (http://www.apache.org/licenses). - [Apache Software Foundation] - - *) A new function, apr_reslist_invalidate, was added so that invalid - resources can be removed from a reslist instead of being returned - to the reslist in a broken state. [Nick Kew <nick webthing.com>] - - *) Switch to a single, top-level make. [Greg Stein] - - *) Add timeout feature to apr_reslist_acquire(). - [Mladen Turk <mturk apache.org>] - - *) Pass error codes returned from constructors all the way back to - the reslist consumer. Also fix a minor reslist memory leak that could - happen when a constructor returns an error code. PR 23492. - [Snke Tesch <st@kino-fahrplan.de>, Aaron Bannert] - - *) The following header files have been removed: - - apu_compat.h - -Changes with APR-util 0.9.5 - - *) Fix corrupt output from the apr_xlate_* interfaces on AIX 4.x. - [Joe Orton] - - *) Change the order in which ldap.h and lber.h are defined, to fix - a compile bug in Solaris v2.8 which requires lber.h then ldap.h. - PR 27379. [Andrew Connors <andy.connors idea.com>] - - *) Restore support for SHA1 passwords in apr_validate_password. - PR 17343. [Paul Querna <chip force-elite.com>] - - *) Fix DESTDIR install for bundled expat library. PR 14076 - [David S. Madole <david madole.net>] - - *) Fix occasional crash in apr_rmm_realloc(). PR 22915. - [Jay Shrauner <shrauner inktomi.com>] - - *) Fix apr_dbm_exists() for sdbm when sizeof(int) != sizeof(size_t). - [Joe Orton] - - *) The whole codebase was relicensed and is now available under - the Apache License, Version 2.0 (http://www.apache.org/licenses). - [Apache Software Foundation] - - *) Fix xlate.c compile failure on AIX 5.2. PR 25701. [Jeff Trawick] - - *) Fixed a bug in apr_rmm that would cause it to mishandle blocks of - a size close to the one requested from the allocator. - [Kevin Wang <xwang_tech yahoo.com>] - -Changes with APR-util 0.9.4 - - *) Changed apr_bucket_alloc_create() so that it uses the allocator - from the pool that was passed in rather than creating its own. - Also, the bucket_allocator is now allocated from the apr_allocator_t - rather than using apr_palloc(). Added apr_bucket_alloc_create_ex() - which takes an apr_allocator_t* directly rather than an apr_pool_t*. - [Cliff Woolley, Jean-Jacques Clar] - - *) Added debugging consistency checks to the buckets code. Add - -DAPR_BUCKET_DEBUG to the build flags to enable. - [Cliff Woolley] - - *) Make the version of the db library APU built against visible. - [Thom May] - - *) Fix a problem with VPATH builds copying the APR rules.mk into the - source directory rather than the build directory. [Justin Erenkrantz] - - *) SECURITY [httpd incident CAN-2003-0189] Address a thread safety - issue with apr_password_validate() on AIX, Linux, Mac OS X, and - possibly other platforms. [Jeff Trawick, Justin Erenkrantz] - - *) Fix a problem with LDAP configuration which caused subsequent - configure tests to fail since LIBS contained LDAP libraries for - subsequent tests but LDFLAGS no longer included the path to such - LDAP libraries. [Jeff Trawick] - - *) Fix a problem preventing the use of the bundled Expat when APR-util - is built stand-alone. [Jeff Trawick] - - *) Use the same compiler and preprocessor for the APR-util config tests - which were used by APR. The user can override this via CC and CPP. - This was done all along for the actual build, but not necessarily - for the config tests. [Jeff Trawick] - - *) Fix apr_uuid_parse() on EBCDIC machines. [Jeff Trawick] - - *) Fix alignment problem when allocating memory using apr_rmm. The problem - showed up while trying to write a double in the memory allocated. - [Madhusudan Mathihalli] - -Changes with APR-util 0.9.3 - - *) Allow apr_date_parse_rfc to parse 'Sun, 06-Nov-1994 08:49:37 GMT' as a - valid date. [Dmitri Tikhonov <dmitri@netilla.com>] - - *) Fix error in apu-config when symlinks are involved. - [Garrett Rooney <rooneg@electricjellyfish.net>] - -Changes with APR-util 0.9.2 - - *) Fix the APR_BUCKET_IS_foo() macros so they parenthesize their parameter. - This fixes compile problems with some types of parameters. - [Jim Carlson <jcarlson@jnous.com>] - - *) Queue overwrite, we now return the item pushed, not a reference to it. - [Paul Marquis <PMarquis@pobox.com, Jacob Lewallen <jlwalle@cs.ucr.edu>] - - *) Remove include/apr_ldap.h on distclean. PR 15592. [Justin Erenkrantz] - - *) Fix race conditions in apr_queue. - [Jacob Lewallen <jlwalle@cs.ucr.edu>] - - *) Stop buildconf copying rules.mk, copy it at configure time. - [Thom May] - - *) Make buildconf copy rules.mk as well. - [Garrett Rooney <rooneg@electricjellyfish.net>] - - *) Add --includedir flag to apu-config. [Justin Erenkrantz] - - *) Fix brokenness in sdbm when sizeof(int) != sizeof(size_t) - (e.g., 64-bit AIX, 64-bit Solaris). PR 14861. [Jeff Trawick] - - *) Have buildconf copy required files from apr so that apr-util can build - on its own. [Craig Rodrigues <rodrigc@attbi.com>] - - *) Detect OpenLDAP when used with Solaris 9. PR 13427. - [Gary Algier <gaa@ulticom.com>] - - *) Detect Berkeley DB 4.1 when compiled with --with-uniquenames - [Thom May] - - *) Allow apu-config to work in symlinked install directories when - 'realpath' is available. [Justin Erenkrantz] - - *) Fix bug in apr_strmatch when used with case-insensitive patterns. - [Justin Erenkrantz] - - *) Allow apr_queue to have greater than int number of elements. - [Justin Erenkrantz] - - *) Detect Berkeley DB 4.0 compiled with --with-uniquenames. - [Philip Martin <philip@codematters.co.uk>] - - *) Allocate brigades from a bucket allocator rather than a pool. [Brian Pane] - - *) Update with the latest APR renames [Thom May] - - *) Update doxygen tags. [Justin Erenkrantz] - - *) Add apr_ldap.hw for Windows build. - [Andre Schild <A.Schild@aarboard.ch>] - - *) Add IPv6 literal address support to apr_uri_parse(), apr_uri_unparse(), - and apr_uri_parse_hostinfo(). PR 11887 [Jeff Trawick] - - *) Add apr_brigade_writev() [Brian Pane] - - *) Add support for Berkeley DB 4.1. [Justin Erenkrantz] - - *) Add --bindir option to apu-config. [Justin Erenkrantz] - -Changes with APR-util 0.9.1 - - *) Add versioning infrastructure. - [Justin Erenkrantz] - - *) Running "make check" in the toplevel directory or the test/ directory - will build and run all test programs. [Aaron Bannert] - - *) Bug #9789 : NDBM support - [Toomas Soome <tsoome@muhv.pri.ee>, Ian Holsman] - - *) Added a Thread safe FIFO bounded buffer (apr_queue) [Ian Holsman] - - *) Changed file_bucket_setaside() to use apr_file_setaside() instead - of turning the file bucket into an mmap bucket. [Brian Pane] - - *) Install libaprutil support libraries before installing libaprutil - itself, since on some platforms libaprutil is relinked during - make install and the support libraries need to exist already. - [Jeff Trawick] - - *) Added a Resource List API for threadsafe access to persistent - and dynamically created user-defined resources. [Aaron Bannert] - - *) Adopted apr-util/xlate from apr/i18n for inclusion of apr-iconv - as required by missing libiconv. [William Rowe] - - *) Adopted apr-util/crypto/ uuid and md5 from apr. [William Rowe] - - *) Look for expat in lib64 directories. [Peter Poeml <poeml@suse.de>] - - *) Faster implementation of apr_brigade_puts() [Brian Pane] - - *) Fixed a segfault in apr_date_parse_rfc() for some date formats - where it was trying to overlay a potentially static input - string even though it didn't really need to. - [Cliff Woolley, Doug MacEachern] - - *) Ensure that apu-config does not print libtool libraries when - using --libs. [Justin Erenkrantz] - - *) Added apr_bucket_file_enable_mmap() function to the bucket - API to let an application control whether a file bucket may - be turned into an mmap bucket upon read. (The default remains - to do the mmap, but this function lets the app prevent the - mmap in contexts where mmap would be a bad idea. Examples - include multiprocessors where mmap doesn't scale well and - NFS-mounted filesystems where a bus error can result if - a memory-mapped file is removed or truncated.) [Brian Pane] - - *) Added string-matching API (apr_strmatch.h) [Brian Pane] - - *) Rearrange INCLUDES so that APRUTIL_PRIV_INCLUDES is always - first. [Garrett Rooney <rooneg@electricjellyfish.net>] - - *) Add --old-expat option to apu-config to allow users of apr-util to - determine what expat it should expect to be installed. If the - flag is set to yes, it should include xmlparse.h. If it is set to - no, it should include expat.h. [Justin Erenkrantz] - - *) Fix exporting of includes in apu-config. [Justin Erenkrantz] - - *) Change bucket brigades API to allow a "bucket allocator" to be - passed in at certain points. This allows us to implement freelists - so that we can stop using malloc/free so frequently. - [Cliff Woolley, Brian Pane] - - *) add apr_rmm_realloc() function - [Madhusudan Mathihalli <madhusudan_mathihalli@hp.com>] - - *) renames: apr_ansi_time_to_apr_time becomes apr_time_ansi_put - ap_exploded_time_t becomes apr_time_exp_t - [Thom May <thom@planetarytramp.net>] - - *) Add detection support for FreeBSD's expat and expat2 ports. - [Justin Erenkrantz] - - *) Deprecate check_brigade_flush(), which had several nasty bugs, and - which was causing apr_brigade_write()'s logic to be less than obvious. - Everything is now done in a slightly rearranged apr_brigade_write(). - [Cliff Woolley] - - *) Don't add /usr/include to the INCLUDES variable on expat's account. - [Joe Orton <joe@manyfish.co.uk>] - - *) Remove the autoconf 2.5x cache directory in buildconf. - [Joe Orton <joe@manyfish.co.uk>] - - *) BerkleyDB should NULL out the key if it is @EOF in vt_db_nextkey - [Ian Holsman] - - *) Add ability to natively fetch and split brigades based on LF lines. - [Justin Erenkrantz] - - *) add --with-berkeley-db=DIR & --with-gdbm configure flags - [Ian Holsman/Justin Erenkrantz] - - *) Fix expat detection to recognize installed versions. - [Eric Gillespie, Jr. <epg@pretzelnet.org>] - - *) Add find_apu.m4 to allow third-party programs that use APR-util - to have a standard m4 macro for detection. [Justin Erenkrantz] - - *) Add apu-config - a shell script to allow third-party programs - easy access to APR configuration parameters. [Justin Erenkrantz] - - *) Add GMT offset calculation to apr_date_parse_rfc(). - [Justin Erenkrantz] - - *) Introduce the apr_rmm api, to allow relocatable memory management - of address-independent data stores, such as shared memory. - [William Rowe] - - *) Rework and fix VPATH-build support. [Justin Erenkrantz] - - *) Add support for Berkeley DB4. [Justin Erenkrantz] - - *) Improve testdbm help. [Justin Erenkrantz] - - *) Improve autoconf detection of DBMs. [Justin Erenkrantz] - - *) BerkeleyDBM v2 now checks minor level for cursor ops [Ian Holsman] - - *) Reading a file bucket bigger than APR_MMAP_LIMIT (4MB) now yields - a string of 4MB mmap buckets, rather than a string of 8KB heap buckets - plus a 4MB mmap bucket. To accomodate this, the mmap bucket destroy - function explicitly deletes the apr_mmap_t after last reference - to avoid having too much of a large file mapped at once if possible. - [Cliff Woolley] - - *) Multi-DBM support (via apr_dbm_open_ex). [Ian Holsman] - - *) Use apr_mmap_dup in mmap_setaside(). [Brian Pane <bpane@pacbell.net>] - - *) Dropped the "w" parameter from apr_bucket_heap_create() and - apr_bucket_heap_make(). That parameter was originally intended - to return the amount of data copied into the bucket, but it - ended up being unnecessary because that amount is invariant from - the size of the data and is available as b->length in the - resulting bucket anyway. [Cliff Woolley] - - *) Fix Makefile conversion for BSD/OS. [Cliff Woolley] - - *) Use APR_XtOffsetOf instead of offsetof() in the ring macros for - portability. [Cliff Woolley] - - *) We now create exports.c and export_vars.h, which in turn create - exports.c. From this we generate two more files with different - purposes: aprutil.exp - list of exported symbols; and exports.lo - (exports.o) - an object file that can be linked with an executable - to force resolution of all apr-util symbols. [Aaron Bannert] - - *) Fix Berkley DBM support [Ian Holsman <ianh@apache.org>] - - *) Fix apr_brigade_vprintf so that it can handle more than - 4k of data at one time. [Cody Sherr <csherr@covalent.net>] - - *) prefix UNP_* flags with APR_URI_ - - rename: - apr_uri_components -> apr_uri_t - apr_uri_unparse_components -> apr_uri_unparse - apr_uri_parse_components -> apr_uri_parse - apr_uri_parse_hostinfo_components -> apr_uri_parse_hostinfo - - s/APU_URI_/APR_URI_/g - [Perl] - - *) Landed the link-to-LDAP to the build process, and the LDAP v2/v3 - compatibility functions. - [Dave Carrigan <dave@rudedog.org>, Graham Leggett] - - *) Fix URI unparse function to handle the case where it would place a @ - when both the username and password were present but omitted. - [Jon Travis <jtravis@covalent.net] - - *) Added apr_xml_parse_file() routine and a testxml program. - [Ian Holsman <ianh@cnet.com>] - - *) Extend apr_bucket struct to add a pointer to a function used - to free the bucket. This change enables custom buckets to - completely specify how they are to be allocated and freed. - Before this change, custom buckets were required to use the - same memory allocation scheme as the standard APR buckets. - [Saeid Sakhitab, Bill Stoddard, Cliff Woolley, Roy Fielding] - - *) Install Expat when installing APR-util. [Justin Erenkrantz] - - *) Make APR-util configure script rely on APR. This removes the locally - generated copy of libtool and uses the one in APR. Fix up how we - call the expat configure script. Generate config.nice file. - [Justin Erenkrantz] - - *) The apr_bucket lengths are now consistently apr_size_t, while any - apr_brigade lengths (short of a read) are consistently apr_off_t. - This is required for APR_HAS_LARGE_FILES handling. [William Rowe] - - *) apr_bucket_file_create() and apr_bucket_file_make() now take a pool - parameter which is the pool into which any needed data structures - should be created during file_read(). This is used for MMAPing the - file and reopening the file if the original apr_file_t is in XTHREAD - mode. [Cliff Woolley] - - *) apr_brigade_partition() now returns an apr_status_t. [Cliff Woolley] - - *) Add MD4 implementation in crypto. [Sander Striker, Justin Erenkrantz] - - *) Moved httpd 2.0.18's util_date to apr_date and enhanced its parsing - capabilities. [Justin Erenkrantz] - - *) Moved httpd 2.0.18's util_uri to apr_uri and name-protected its - symbols and functions. [Justin Erenkrantz, Roy Fielding] - - *) Rename field "private" in struct apr_xml_elem to "priv" for C++ - compatibility. PR #7727 [Joshua MacDonald <jmacd@cs.berkeley.edu>] - - *) Make APR_IMPLEMENT_EXTERNAL_HOOK_BASE generate a - ${namespace}_hook_get_${hookname} function to fetch the - list of registered hooks [Doug MacEachern] - - *) Allow LTFLAGS to be overridden by the configure command-line - (default="--silent") and introduce LT_LDFLAGS. [Roy Fielding] - - *) Add APR_SHARELOCK support to apr_sdbm_open(), locking read operations - with a shared lock and all write ops with an excl lock. [Will Rowe] - - *) Namespace protect apr_sdbm, and normalize the return values (including - the apr_sdbm_fetch, apr_sdbm_firstkey and apr_sdbm_nextkey functions). - Normalized the get/clear error function names, and stores the actual - apr error for apr_sdbm_error_get. [Will Rowe] - - *) Introduce an apr_fileperms_t argument to apr_dbm_open(). [Will Rowe] - - *) Removed apr_bucket_do_create() macro, which was causing warnings - about unreachable code in some compilers (notably MSVC). What - used to be done by this macro is now done inline in the various - apr_bucket_foo_create() functions. [Cliff Woolley] - - *) Make clean, distclean, and extraclean consistently according to the - Gnu makefile guidelines. [Justin Erenkrantz <jerenkrantz@ebuilt.com>] - - *) Migrate the --disable-libtool changes from APR to APR-util. - This cleans things up, and allows more flexibility when building - programs. [Ryan Bloom] - - *) Allow APR-util to be compiled without libtool. The default is - to use libtool, but it can turned off with --disable-libtool - on the configure command. [Ryan Bloom] - - *) Repair calling convention for apr_register_optional_fn to - eliminate GP fault on Win32. [William Rowe] - - *) Substantial changes to correct linkage and declarations for - generic hooks on dso architectures. [Ben Laurie, Will Rowe] - - *) apr_bucket_shared_destroy() now returns a boolean value. - [Cliff Woolley] - - *) We have to initialize the heap buckets to the correct length. - we were seeing heap buckets with 17 chars in them reporting - a length of 9017, because they were initialized to the amount - of memory allocated, instead of the amount of memory used. - This was only an issue for heap buckets created by the - apr_brigade_* functions. [Ryan Bloom] - - *) apr_bucket_init_types() and apr_bucket_insert_type() have been - removed... they're not needed anymore. [Cliff Woolley] - - *) The apr_bucket_shared and apr_bucket_simple structures have been - removed as an API simplification/optimization. This should be - transparent outside APR-util except to callers who attempt to - directly manipulate the buckets' internal structure (which is - not recommended anyway) and to callers who create their own - bucket types. [Cliff Woolley] - - *) apr_bucket_simple_split() and apr_bucket_simple_copy() are now - exported functions, which could be helpful in implementing - external bucket types. [Cliff Woolley] - - *) The third parameter to apr_bucket_shared_make() is now - 'apr_off_t length' rather than 'apr_off_t end', since the - end usually had to be computed by the caller and all we - really want is the length anyway. [Cliff Woolley] - diff --git a/libs/apr-util/CMakeLists.txt b/libs/apr-util/CMakeLists.txt deleted file mode 100644 index 796f5e4b05..0000000000 --- a/libs/apr-util/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -INCLUDE_DIRECTORIES(include/) - -add_definitions(-DHAVE_CONFIG_H -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK) -INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/libs/apr-util/include ${CMAKE_SOURCE_DIR}/libs/apr-util/include/private ${CMAKE_SOURCE_DIR}/libs/apr/include) - - -SET (apr-util_SRCS -crypto/apr_md5.c -crypto/uuid.c -crypto/apr_sha1.c -crypto/getuuid.c -crypto/apr_md4.c -encoding/apr_base64.c -hooks/apr_hooks.c -misc/apr_reslist.c -misc/apr_rmm.c -misc/apr_date.c -misc/apu_version.c -misc/apr_queue.c -uri/apr_uri.c -strmatch/apr_strmatch.c -xlate/xlate.c -) - -LINK_LIBRARIES ("-liconv -ldl -lpthread") - -ADD_LIBRARY(apr-util STATIC ${apr-util_SRCS}) - - - - - - - diff --git a/libs/apr-util/INSTALL.MySQL b/libs/apr-util/INSTALL.MySQL deleted file mode 100644 index 67718bf9d8..0000000000 --- a/libs/apr-util/INSTALL.MySQL +++ /dev/null @@ -1,14 +0,0 @@ -The MySQL driver is not distributed from apache.org due to licensing issues. - -If you wish to build the driver, download apr_dbd_mysql.c from -http://apache.webthing.com/database/ -and copy it into the dbd directory. -Now run buildconf, followed by configure. - -It is distributed under the GPL to conform with MySQL License terms -This means it cannot be distributed from apache.org, as that would -violate ASF policy. - -Using the driver with APR and Apache is of course allowed, -and there is no problem with a third party bundling the driver, -provided you respect both the ASF and GPL licenses. diff --git a/libs/apr-util/LICENSE b/libs/apr-util/LICENSE deleted file mode 100644 index 2813d26052..0000000000 --- a/libs/apr-util/LICENSE +++ /dev/null @@ -1,404 +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. - - - -APACHE PORTABLE RUNTIME SUBCOMPONENTS: - -The Apache Portable Runtime includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -For the include\apr_md5.h component: -/* - * 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. - */ - -For the passwd\apr_md5.c component: - -/* - * 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. - */ - -/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm - */ - -/* 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. - */ -/* - * The apr_md5_encode() routine uses much code obtained from the FreeBSD 3.0 - * MD5 crypt() function, which is licenced as follows: - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -For the crypto\apr_md4.c component: - - * 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. - */ - -For the include\apr_md4.h component: - - * - * 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. - */ - -For the test\testmd4.c component: - - * - * 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. - */ - -For the xml\expat\conftools\install-sh component: - -# -# 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. -# - -For the expat xml parser component: - -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/Makefile.in b/libs/apr-util/Makefile.in deleted file mode 100644 index c33574ed20..0000000000 --- a/libs/apr-util/Makefile.in +++ /dev/null @@ -1,91 +0,0 @@ -# -# Top-level Makefile for APRUTIL -# -CPP = @CPP@ - -# gets substituted into some targets -APRUTIL_MAJOR_VERSION=@APRUTIL_MAJOR_VERSION@ -APRUTIL_DOTTED_VERSION=@APRUTIL_DOTTED_VERSION@ - -srcdir = @srcdir@ -VPATH = @srcdir@ - -INCLUDES = @APRUTIL_PRIV_INCLUDES@ @APR_INCLUDES@ @APRUTIL_INCLUDES@ -APRUTIL_LDFLAGS = @APRUTIL_LDFLAGS@ -APRUTIL_LIBS = @APRUTIL_LIBS@ - -TARGET_LIB = lib@APRUTIL_LIBNAME@.la -INSTALL_SUBDIRS = @APR_ICONV_DIR@ @APR_XML_DIR@ -EXTRA_SOURCE_DIRS = @APR_ICONV_DIR@ @APR_XML_DIR@ -APRUTIL_PCFILE = apr-util-$(APRUTIL_MAJOR_VERSION).pc -APU_CONFIG = apu-$(APRUTIL_MAJOR_VERSION)-config -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ - -TARGETS = $(TARGET_LIB) aprutil.exp - -# bring in rules.mk for standard functionality -@INCLUDE_RULES@ -@INCLUDE_OUTPUTS@ - -CLEAN_SUBDIRS = test @APR_ICONV_DIR@ - -CLEAN_TARGETS = exports.c export_vars.c aprutil.exp .make.dirs apu-config.out -DISTCLEAN_TARGETS = config.cache config.log config.status libtool \ - include/private/apu_config.h include/private/apu_private.h \ - include/private/apu_select_dbm.h include/apr_ldap.h include/apu.h \ - export_vars.sh $(APU_CONFIG) build/rules.mk include/apu_want.h \ - apr-util.pc build/pkg/pkginfo -EXTRACLEAN_TARGETS = configure aclocal.m4 include/private/apu_config.h.in \ - exports.c build-outputs.mk \ - build/apr_common.m4 build/find_apr.m4 build/install.sh \ - build/config.guess build/config.sub - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ -libdir=@libdir@ -includedir=@includedir@ -top_srcdir=@abs_srcdir@ -top_blddir=@abs_builddir@ - -# Create apu-config script suitable for the install tree -apu-config.out: $(APU_CONFIG) - sed 's,^\(location=\).*$$,\1installed,' < $(APU_CONFIG) > $@ - -install: $(TARGET_LIB) apu-config.out - $(APR_MKDIR) $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/pkgconfig \ - $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) - for f in $(top_srcdir)/include/*.h $(top_blddir)/include/*.h; do \ - $(INSTALL_DATA) $${f} $(DESTDIR)$(includedir); \ - done - $(INSTALL_DATA) apr-util.pc $(DESTDIR)$(libdir)/pkgconfig/$(APRUTIL_PCFILE) - list='$(INSTALL_SUBDIRS)'; for i in $$list; do \ - ( cd $$i ; $(MAKE) DESTDIR=$(DESTDIR) install ); \ - done - $(LIBTOOL) --mode=install $(INSTALL) -m 755 $(TARGET_LIB) $(DESTDIR)$(libdir) - $(INSTALL_DATA) aprutil.exp $(DESTDIR)$(libdir) - $(INSTALL) -m 755 apu-config.out $(DESTDIR)$(bindir)/$(APU_CONFIG) - -$(TARGET_LIB): $(OBJECTS) - $(LINK) @lib_target@ $(ALL_LIBS) $(APRUTIL_LDFLAGS) $(APRUTIL_LIBS) - -exports.c: $(HEADERS) - $(APR_MKEXPORT) $(HEADERS) > $@ - -export_vars.c: $(HEADERS) - $(APR_MKVAREXPORT) $(HEADERS) > $@ - -aprutil.exp: exports.c export_vars.c - @echo "#! lib@APRUTIL_LIBNAME@.so" > $@ - @echo "* This file was AUTOGENERATED at build time." >> $@ - @echo "* Please do not edit by hand." >> $@ - $(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/' >> $@ - $(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$$/d' >> $@ - -dox: - doxygen $(top_srcdir)/docs/doxygen.conf - -test: check -check: $(TARGET_LIB) - cd test && $(MAKE) check diff --git a/libs/apr-util/NOTICE b/libs/apr-util/NOTICE deleted file mode 100644 index 9ccc9d7974..0000000000 --- a/libs/apr-util/NOTICE +++ /dev/null @@ -1,11 +0,0 @@ -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, including various -modifications by Spyglass Inc., Carnegie Mellon University, and -Bell Communications Research, Inc (Bellcore). diff --git a/libs/apr-util/NWGNUmakefile b/libs/apr-util/NWGNUmakefile deleted file mode 100644 index db72b27603..0000000000 --- a/libs/apr-util/NWGNUmakefile +++ /dev/null @@ -1,292 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - ldap \ - xml \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(APR_WORK)\build\NWGNUhead.inc - -# -# 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 \ - $(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 = - -# -# 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)/aprutil.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 $(NWOS)\copyright.txt. -# -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_base64.o \ - $(OBJDIR)/apr_brigade.o \ - $(OBJDIR)/apr_buckets.o \ - $(OBJDIR)/apr_buckets_alloc.o \ - $(OBJDIR)/apr_buckets_eos.o \ - $(OBJDIR)/apr_buckets_file.o \ - $(OBJDIR)/apr_buckets_flush.o \ - $(OBJDIR)/apr_buckets_heap.o \ - $(OBJDIR)/apr_buckets_mmap.o \ - $(OBJDIR)/apr_buckets_pipe.o \ - $(OBJDIR)/apr_buckets_pool.o \ - $(OBJDIR)/apr_buckets_refcount.o \ - $(OBJDIR)/apr_buckets_simple.o \ - $(OBJDIR)/apr_buckets_socket.o \ - $(OBJDIR)/apr_date.o \ - $(OBJDIR)/apr_dbm.o \ - $(OBJDIR)/apr_dbd.o \ - $(OBJDIR)/apr_dbd_pgsql.o \ - $(OBJDIR)/apr_dbm_berkeleydb.o \ - $(OBJDIR)/apr_dbm_sdbm.o \ - $(OBJDIR)/apr_hooks.o \ - $(OBJDIR)/apr_md4.o \ - $(OBJDIR)/apr_md5.o \ - $(OBJDIR)/apr_queue.o \ - $(OBJDIR)/apr_reslist.o \ - $(OBJDIR)/apr_rmm.o \ - $(OBJDIR)/apr_sha1.o \ - $(OBJDIR)/apu_version.o \ - $(OBJDIR)/getuuid.o \ - $(OBJDIR)/uuid.o \ - $(OBJDIR)/apr_strmatch.o \ - $(OBJDIR)/apr_uri.o \ - $(OBJDIR)/sdbm.o \ - $(OBJDIR)/sdbm_hash.o \ - $(OBJDIR)/sdbm_lock.o \ - $(OBJDIR)/sdbm_pair.o \ - $(OBJDIR)/xlate.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 buckets:crypto:dbd:dbm:dbm/sdbm:encoding:hooks:ldap:misc:strmatch:uri:xlate:xml - -# -# 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/apr-util.pc.in b/libs/apr-util/apr-util.pc.in deleted file mode 100644 index 9e3cda6a3c..0000000000 --- a/libs/apr-util/apr-util.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -APRUTIL_MAJOR_VERSION=@APRUTIL_MAJOR_VERSION@ -includedir=@includedir@ - -Name: APR Utils -Description: Companion library for APR -Version: @APRUTIL_DOTTED_VERSION@ -# assume that apr-util requires libapr of same major version -Requires: apr-@APRUTIL_MAJOR_VERSION@ -Libs: -L${libdir} -l@APRUTIL_LIBNAME@ @APRUTIL_EXPORT_LIBS@ -Cflags: -I${includedir} diff --git a/libs/apr-util/apr-util.spec b/libs/apr-util/apr-util.spec deleted file mode 100644 index f7f387f3bb..0000000000 --- a/libs/apr-util/apr-util.spec +++ /dev/null @@ -1,89 +0,0 @@ - -%define apuver 1 - -Summary: Apache Portable Runtime Utility library -Name: apr-util -Version: 1.2.8 -Release: 1 -License: Apache Software License -Group: System Environment/Libraries -URL: http://apr.apache.org/ -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildPrereq: autoconf, libtool, doxygen, apr-devel >= 0:{version}-{release} -BuildPrereq: openldap-devel, db4-devel, expat-devel -Conflicts: subversion < 0.20.1-2 - -%description -The mission of the Apache Portable Runtime (APR) is to provide a -free library of C data structures and routines. This library -contains additional utility interfaces for APR; including support -for XML, LDAP, database interfaces, URI parsing and more. - -%package devel -Group: Development/Libraries -Summary: APR utility library development kit -Requires: apr-util = %{version}-%{release}, apr-devel -Requires: openldap-devel, db4-devel, expat-devel -Conflicts: subversion-devel < 0.20.1-2 - -%description devel -This package provides the support files which can be used to -build applications using the APR utility library. The mission -of the Apache Portable Runtime (APR) is to provide a free -library of C data structures and routines. - -%prep -%setup -q - -%build -%configure --with-apr=%{_prefix} \ - --includedir=%{_includedir}/apr-%{apuver} \ - --with-ldap --without-gdbm -make %{?_smp_mflags} && make dox - -%check -# Run non-interactive tests -pushd test -make %{?_smp_mflags} testall CFLAGS=-fno-strict-aliasing -./testall -v || exit 1 -popd - -%install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT - -# Documentation -mv docs/dox/html html - -# Unpackaged files -rm -f $RPM_BUILD_ROOT%{_libdir}/aprutil.exp - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root,-) -%doc CHANGES LICENSE NOTICE -%{_libdir}/libaprutil-%{apuver}.so.* - -%files devel -%defattr(-,root,root,-) -%{_bindir}/apu-%{apuver}-config -%{_libdir}/libaprutil-%{apuver}.*a -%{_libdir}/libaprutil-%{apuver}.so -%{_libdir}/pkgconfig/apr-util-%{apuver}.pc -%{_includedir}/apr-%{apuver}/*.h -%doc --parents html - -%changelog -* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1 -- update to support v1.0.0 of APR - -* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1 -- derived from Fedora Core apr.spec - diff --git a/libs/apr-util/aprutil.dsp b/libs/apr-util/aprutil.dsp deleted file mode 100644 index efa1f8239d..0000000000 --- a/libs/apr-util/aprutil.dsp +++ /dev/null @@ -1,587 +0,0 @@ -# Microsoft Developer Studio Project File - Name="aprutil" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=aprutil - 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 "aprutil.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 "aprutil.mak" CFG="aprutil - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "aprutil - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "aprutil - 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)" == "aprutil - 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" /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 "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC" /D "APU_USE_SDBM" /D "XML_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibR\aprutil_src" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"LibR\aprutil-1.lib" - -!ELSEIF "$(CFG)" == "aprutil - 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" /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 "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC" /D "APU_USE_SDBM" /D "XML_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibD\aprutil_src" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"LibD\aprutil-1.lib" - -!ENDIF - -# Begin Target - -# Name "aprutil - Win32 Release" -# Name "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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)" == "aprutil - 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 -# End Group -# End Target -# End Project diff --git a/libs/apr-util/aprutil.dsw b/libs/apr-util/aprutil.dsw deleted file mode 100644 index 75352c2974..0000000000 --- a/libs/apr-util/aprutil.dsw +++ /dev/null @@ -1,161 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "apr"="..\apr\apr.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "apriconv"="..\apr-iconv\apriconv.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name apr - End Project Dependency -}}} - -############################################################################### - -Project: "aprutil"=".\aprutil.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name apr - End Project Dependency - Begin Project Dependency - Project_Dep_Name xml - End Project Dependency - Begin Project Dependency - Project_Dep_Name apriconv - End Project Dependency -}}} - -############################################################################### - -Project: "libapr"="..\apr\libapr.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "libapriconv"="..\apr-iconv\libapriconv.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency -}}} - -############################################################################### - -Project: "libapriconv_ccs_modules"="..\apr-iconv\ccs\libapriconv_ccs_modules.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libapriconv - End Project Dependency -}}} - -############################################################################### - -Project: "libapriconv_ces_modules"="..\apr-iconv\ces\libapriconv_ces_modules.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name libapriconv - End Project Dependency -}}} - -############################################################################### - -Project: "libaprutil"=".\libaprutil.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libapr - End Project Dependency - Begin Project Dependency - Project_Dep_Name xml - End Project Dependency - Begin Project Dependency - Project_Dep_Name libapriconv - End Project Dependency -}}} - -############################################################################### - -Project: "xml"=".\xml\expat\lib\xml.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/libs/apr-util/apu-config.in b/libs/apr-util/apu-config.in deleted file mode 100644 index b4d896e008..0000000000 --- a/libs/apr-util/apu-config.in +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/sh -# 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. -# - -# APR-util script designed to allow easy command line access to APR-util -# configuration parameters. - -APRUTIL_MAJOR_VERSION="@APRUTIL_MAJOR_VERSION@" -APRUTIL_DOTTED_VERSION="@APRUTIL_DOTTED_VERSION@" - -prefix="@prefix@" -exec_prefix="@exec_prefix@" -bindir="@bindir@" -libdir="@libdir@" -includedir="@includedir@" - -LIBS="@APRUTIL_EXPORT_LIBS@" -INCLUDES="@APRUTIL_INCLUDES@" -LDFLAGS="@APRUTIL_LDFLAGS@" - -APRUTIL_LIBNAME="@APRUTIL_LIBNAME@" - -APU_SOURCE_DIR="@abs_srcdir@" -APU_BUILD_DIR="@abs_builddir@" -APR_XML_EXPAT_OLD="@APR_XML_EXPAT_OLD@" -APU_DB_VERSION="@apu_db_version@" - -# NOTE: the following line is modified during 'make install': alter with care! -location=@APU_CONFIG_LOCATION@ - -show_usage() -{ - cat << EOF -Usage: apu-$APRUTIL_MAJOR_VERSION-config [OPTION] - -Known values for OPTION are: - --prefix[=DIR] change prefix to DIR - --bindir print location where binaries are installed - --includes print include information - --includedir print location where headers are installed - --ldflags print linker flags - --libs print library information - --srcdir print APR-util source directory - --link-ld print link switch(es) for linking to APR-util - --link-libtool print the libtool inputs for linking to APR-util - --apu-la-file print the path to the .la file, if available - --old-expat indicate if APR-util was built against an old expat - --db-version print the DB version - --version print APR-util's version as a dotted triple - --help print this help - -When linking with libtool, an application should do something like: - APU_LIBS="\`apu-$APRUTIL_MAJOR_VERSION-config --link-libtool --libs\`" -or when linking directly: - APU_LIBS="\`apu-$APRUTIL_MAJOR_VERSION-config --link-ld --libs\`" - -An application should use the results of --includes, and --ldflags in -their build process. -EOF -} - -if test $# -eq 0; then - show_usage - exit 1 -fi - -if test "$location" = "installed"; then - LA_FILE="$libdir/lib${APRUTIL_LIBNAME}.la" - - LIBS=`echo "$LIBS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s $prefix/lib/libexpat.la -lexpat g"` - LDFLAGS=`echo "$LDFLAGS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g"` - INCLUDES=`echo "$INCLUDES" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s -I$prefix/lib g"` -else - LA_FILE="$APU_BUILD_DIR/lib${APRUTIL_LIBNAME}.la" -fi - -flags="" - -while test $# -gt 0; do - # Normalize the prefix. - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case "$1" in - # It is possible for the user to override our prefix. - --prefix=*) - prefix=$optarg - ;; - --prefix) - echo $prefix - exit 0 - ;; - --bindir) - echo $bindir - exit 0 - ;; - --libs) - flags="$flags $LIBS" - ;; - --includedir) - if test "$location" = "installed"; then - flags="$includedir" - elif test "$location" = "source"; then - flags="$APU_SOURCE_DIR/include" - else - # this is for VPATH builds - flags="$APU_BUILD_DIR/include $APU_SOURCE_DIR/include" - fi - echo $flags - exit 0 - ;; - --includes) - if test "$location" = "installed"; then - flags="$flags -I$includedir $INCLUDES" - elif test "$location" = "source"; then - flags="$flags -I$APU_SOURCE_DIR/include $INCLUDES" - else - # this is for VPATH builds - flags="$flags -I$APU_BUILD_DIR/include -I$APU_SOURCE_DIR/include $INCLUDES" - fi - ;; - --ldflags) - flags="$flags $LDFLAGS" - ;; - --srcdir) - echo $APU_SOURCE_DIR - exit 0 - ;; - --version) - echo $APRUTIL_DOTTED_VERSION - exit 0 - ;; - --link-ld) - if test "$location" = "installed"; then - ### avoid using -L if libdir is a "standard" location like /usr/lib - flags="$flags -L$libdir -l$APRUTIL_LIBNAME" - else - flags="$flags -L$APU_BUILD_DIR -l$APRUTIL_LIBNAME" - fi - ;; - --link-libtool) - # If the LA_FILE exists where we think it should be, use it. If we're - # installed and the LA_FILE does not exist, assume to use -L/-l - # (the LA_FILE may not have been installed). If we're building ourselves, - # we'll assume that at some point the .la file be created. - if test -f "$LA_FILE"; then - flags="$flags $LA_FILE" - elif test "$location" = "installed"; then - ### avoid using -L if libdir is a "standard" location like /usr/lib - # Since the user is specifying they are linking with libtool, we - # *know* that -R will be recognized by libtool. - flags="$flags -L$libdir -R$libdir -l$APRUTIL_LIBNAME" - else - flags="$flags $LA_FILE" - fi - ;; - --apu-la-file) - if test -f "$LA_FILE"; then - flags="$flags $LA_FILE" - fi - ;; - --old-expat) - if test ! -n "$APR_XML_EXPAT_OLD"; then - echo "no" - else - echo "$APR_XML_EXPAT_OLD" - fi - exit 0 - ;; - --db-version) - echo $APU_DB_VERSION - exit 0 - ;; - --help) - show_usage - exit 0 - ;; - *) - show_usage - exit 1 - ;; - esac - - # Next please. - shift -done - -if test -n "$flags"; then - echo "$flags" -fi - -exit 0 diff --git a/libs/apr-util/buckets/apr_brigade.c b/libs/apr-util/buckets/apr_brigade.c deleted file mode 100644 index 69813f2963..0000000000 --- a/libs/apr-util/buckets/apr_brigade.c +++ /dev/null @@ -1,702 +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_lib.h" -#include "apr_strings.h" -#include "apr_pools.h" -#include "apr_tables.h" -#include "apr_buckets.h" -#include "apr_errno.h" -#define APR_WANT_MEMFUNC -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_SYS_UIO_H -#include <sys/uio.h> -#endif - -static apr_status_t brigade_cleanup(void *data) -{ - return apr_brigade_cleanup(data); -} - -APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data) -{ - apr_bucket_brigade *b = data; - apr_bucket *e; - - while (!APR_BRIGADE_EMPTY(b)) { - e = APR_BRIGADE_FIRST(b); - apr_bucket_delete(e); - } - /* We don't need to free(bb) because it's allocated from a pool. */ - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b) -{ - apr_pool_cleanup_kill(b->p, b, brigade_cleanup); - return apr_brigade_cleanup(b); -} - -APU_DECLARE(apr_bucket_brigade *) apr_brigade_create(apr_pool_t *p, - apr_bucket_alloc_t *list) -{ - apr_bucket_brigade *b; - - b = apr_palloc(p, sizeof(*b)); - b->p = p; - b->bucket_alloc = list; - - APR_RING_INIT(&b->list, apr_bucket, link); - - apr_pool_cleanup_register(b->p, b, brigade_cleanup, apr_pool_cleanup_null); - return b; -} - -APU_DECLARE(apr_bucket_brigade *) apr_brigade_split(apr_bucket_brigade *b, - apr_bucket *e) -{ - apr_bucket_brigade *a; - apr_bucket *f; - - a = apr_brigade_create(b->p, b->bucket_alloc); - /* Return an empty brigade if there is nothing left in - * the first brigade to split off - */ - if (e != APR_BRIGADE_SENTINEL(b)) { - f = APR_RING_LAST(&b->list); - APR_RING_UNSPLICE(e, f, link); - APR_RING_SPLICE_HEAD(&a->list, e, f, apr_bucket, link); - } - - APR_BRIGADE_CHECK_CONSISTENCY(a); - APR_BRIGADE_CHECK_CONSISTENCY(b); - - return a; -} - -APU_DECLARE(apr_status_t) apr_brigade_partition(apr_bucket_brigade *b, - apr_off_t point, - apr_bucket **after_point) -{ - apr_bucket *e; - const char *s; - apr_size_t len; - apr_status_t rv; - - if (point < 0) { - /* this could cause weird (not necessarily SEGV) things to happen */ - return APR_EINVAL; - } - if (point == 0) { - *after_point = APR_BRIGADE_FIRST(b); - return APR_SUCCESS; - } - - APR_BRIGADE_CHECK_CONSISTENCY(b); - - for (e = APR_BRIGADE_FIRST(b); - e != APR_BRIGADE_SENTINEL(b); - e = APR_BUCKET_NEXT(e)) - { - if ((e->length == (apr_size_t)(-1)) && (point > (apr_size_t)(-1))) { - /* point is too far out to simply split this bucket, - * we must fix this bucket's size and keep going... */ - rv = apr_bucket_read(e, &s, &len, APR_BLOCK_READ); - if (rv != APR_SUCCESS) { - *after_point = e; - return rv; - } - } - if ((point < e->length) || (e->length == (apr_size_t)(-1))) { - /* We already checked e->length -1 above, so we now - * trust e->length < MAX_APR_SIZE_T. - * First try to split the bucket natively... */ - if ((rv = apr_bucket_split(e, (apr_size_t)point)) - != APR_ENOTIMPL) { - *after_point = APR_BUCKET_NEXT(e); - return rv; - } - - /* if the bucket cannot be split, we must read from it, - * changing its type to one that can be split */ - rv = apr_bucket_read(e, &s, &len, APR_BLOCK_READ); - if (rv != APR_SUCCESS) { - *after_point = e; - return rv; - } - - /* this assumes that len == e->length, which is okay because e - * might have been morphed by the apr_bucket_read() above, but - * if it was, the length would have been adjusted appropriately */ - if (point < e->length) { - rv = apr_bucket_split(e, (apr_size_t)point); - *after_point = APR_BUCKET_NEXT(e); - return rv; - } - } - if (point == e->length) { - *after_point = APR_BUCKET_NEXT(e); - return APR_SUCCESS; - } - point -= e->length; - } - *after_point = APR_BRIGADE_SENTINEL(b); - return APR_INCOMPLETE; -} - -APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb, - int read_all, apr_off_t *length) -{ - apr_off_t total = 0; - apr_bucket *bkt; - - for (bkt = APR_BRIGADE_FIRST(bb); - bkt != APR_BRIGADE_SENTINEL(bb); - bkt = APR_BUCKET_NEXT(bkt)) - { - if (bkt->length == (apr_size_t)(-1)) { - const char *ignore; - apr_size_t len; - apr_status_t status; - - if (!read_all) { - *length = -1; - return APR_SUCCESS; - } - - if ((status = apr_bucket_read(bkt, &ignore, &len, - APR_BLOCK_READ)) != APR_SUCCESS) { - return status; - } - } - - total += bkt->length; - } - - *length = total; - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb, - char *c, apr_size_t *len) -{ - apr_size_t actual = 0; - apr_bucket *b; - - for (b = APR_BRIGADE_FIRST(bb); - b != APR_BRIGADE_SENTINEL(bb); - b = APR_BUCKET_NEXT(b)) - { - const char *str; - apr_size_t str_len; - apr_status_t status; - - status = apr_bucket_read(b, &str, &str_len, APR_BLOCK_READ); - if (status != APR_SUCCESS) { - return status; - } - - /* If we would overflow. */ - if (str_len + actual > *len) { - str_len = *len - actual; - } - - /* XXX: It appears that overflow of the final bucket - * is DISCARDED without any warning to the caller. - * - * No, we only copy the data up to their requested size. -- jre - */ - memcpy(c, str, str_len); - - c += str_len; - actual += str_len; - - /* This could probably be actual == *len, but be safe from stray - * photons. */ - if (actual >= *len) { - break; - } - } - - *len = actual; - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb, - char **c, - apr_size_t *len, - apr_pool_t *pool) -{ - apr_off_t actual; - apr_size_t total; - apr_status_t rv; - - apr_brigade_length(bb, 1, &actual); - - /* XXX: This is dangerous beyond belief. At least in the - * apr_brigade_flatten case, the user explicitly stated their - * buffer length - so we don't up and palloc 4GB for a single - * file bucket. This API must grow a useful max boundry, - * either compiled-in or preset via the *len value. - * - * Shouldn't both fn's grow an additional return value for - * the case that the brigade couldn't be flattened into the - * provided or allocated buffer (such as APR_EMOREDATA?) - * Not a failure, simply an advisory result. - */ - total = (apr_size_t)actual; - - *c = apr_palloc(pool, total); - - rv = apr_brigade_flatten(bb, *c, &total); - - if (rv != APR_SUCCESS) { - return rv; - } - - *len = total; - return APR_SUCCESS; -} - -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) -{ - apr_off_t readbytes = 0; - - while (!APR_BRIGADE_EMPTY(bbIn)) { - const char *pos; - const char *str; - apr_size_t len; - apr_status_t rv; - apr_bucket *e; - - e = APR_BRIGADE_FIRST(bbIn); - rv = apr_bucket_read(e, &str, &len, block); - - if (rv != APR_SUCCESS) { - return rv; - } - - pos = memchr(str, APR_ASCII_LF, len); - /* We found a match. */ - if (pos != NULL) { - apr_bucket_split(e, pos - str + 1); - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(bbOut, e); - return APR_SUCCESS; - } - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(bbOut, e); - readbytes += len; - /* We didn't find an APR_ASCII_LF within the maximum line length. */ - if (readbytes >= maxbytes) { - break; - } - } - - return APR_SUCCESS; -} - - -APU_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b, - struct iovec *vec, int *nvec) -{ - int left = *nvec; - apr_bucket *e; - struct iovec *orig; - apr_size_t iov_len; - apr_status_t rv; - - orig = vec; - - for (e = APR_BRIGADE_FIRST(b); - e != APR_BRIGADE_SENTINEL(b); - e = APR_BUCKET_NEXT(e)) - { - if (left-- == 0) - break; - - rv = apr_bucket_read(e, (const char **)&vec->iov_base, &iov_len, - APR_NONBLOCK_READ); - if (rv != APR_SUCCESS) - return rv; - vec->iov_len = iov_len; /* set indirectly in case size differs */ - ++vec; - } - - *nvec = vec - orig; - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_brigade_vputstrs(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, - va_list va) -{ - for (;;) { - const char *str = va_arg(va, const char *); - apr_status_t rv; - - if (str == NULL) - break; - - rv = apr_brigade_write(b, flush, ctx, str, strlen(str)); - if (rv != APR_SUCCESS) - return rv; - } - - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_brigade_putc(apr_bucket_brigade *b, - apr_brigade_flush flush, void *ctx, - const char c) -{ - return apr_brigade_write(b, flush, ctx, &c, 1); -} - -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) -{ - apr_bucket *e = APR_BRIGADE_LAST(b); - apr_size_t remaining = APR_BUCKET_BUFF_SIZE; - char *buf = NULL; - - if (!APR_BRIGADE_EMPTY(b) && APR_BUCKET_IS_HEAP(e)) { - apr_bucket_heap *h = e->data; - - /* HEAP bucket start offsets are always in-memory, safe to cast */ - remaining = h->alloc_len - (e->length + (apr_size_t)e->start); - buf = h->base + e->start + e->length; - } - - if (nbyte > remaining) { - /* either a buffer bucket exists but is full, - * or no buffer bucket exists and the data is too big - * to buffer. In either case, we should flush. */ - if (flush) { - e = apr_bucket_transient_create(str, nbyte, b->bucket_alloc); - APR_BRIGADE_INSERT_TAIL(b, e); - return flush(b, ctx); - } - else { - e = apr_bucket_heap_create(str, nbyte, NULL, b->bucket_alloc); - APR_BRIGADE_INSERT_TAIL(b, e); - return APR_SUCCESS; - } - } - else if (!buf) { - /* we don't have a buffer, but the data is small enough - * that we don't mind making a new buffer */ - buf = apr_bucket_alloc(APR_BUCKET_BUFF_SIZE, b->bucket_alloc); - e = apr_bucket_heap_create(buf, APR_BUCKET_BUFF_SIZE, - apr_bucket_free, b->bucket_alloc); - APR_BRIGADE_INSERT_TAIL(b, e); - e->length = 0; /* We are writing into the brigade, and - * allocating more memory than we need. This - * ensures that the bucket thinks it is empty just - * after we create it. We'll fix the length - * once we put data in it below. - */ - } - - /* there is a sufficiently big buffer bucket available now */ - memcpy(buf, str, nbyte); - e->length += nbyte; - - return APR_SUCCESS; -} - -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) -{ - apr_bucket *e; - apr_size_t total_len; - apr_size_t i; - char *buf; - - /* Compute the total length of the data to be written. - */ - total_len = 0; - for (i = 0; i < nvec; i++) { - total_len += vec[i].iov_len; - } - - /* If the data to be written is very large, try to convert - * the iovec to transient buckets rather than copying. - */ - if (total_len > APR_BUCKET_BUFF_SIZE) { - if (flush) { - for (i = 0; i < nvec; i++) { - e = apr_bucket_transient_create(vec[i].iov_base, - vec[i].iov_len, - b->bucket_alloc); - APR_BRIGADE_INSERT_TAIL(b, e); - } - return flush(b, ctx); - } - else { - for (i = 0; i < nvec; i++) { - e = apr_bucket_heap_create((const char *) vec[i].iov_base, - vec[i].iov_len, NULL, - b->bucket_alloc); - APR_BRIGADE_INSERT_TAIL(b, e); - } - return APR_SUCCESS; - } - } - - i = 0; - - /* If there is a heap bucket at the end of the brigade - * already, copy into the existing bucket. - */ - e = APR_BRIGADE_LAST(b); - if (!APR_BRIGADE_EMPTY(b) && APR_BUCKET_IS_HEAP(e)) { - apr_bucket_heap *h = e->data; - apr_size_t remaining = h->alloc_len - - (e->length + (apr_size_t)e->start); - buf = h->base + e->start + e->length; - - if (remaining >= total_len) { - /* Simple case: all the data will fit in the - * existing heap bucket - */ - for (; i < nvec; i++) { - apr_size_t len = vec[i].iov_len; - memcpy(buf, (const void *) vec[i].iov_base, len); - buf += len; - } - e->length += total_len; - return APR_SUCCESS; - } - else { - /* More complicated case: not all of the data - * will fit in the existing heap bucket. The - * total data size is <= APR_BUCKET_BUFF_SIZE, - * so we'll need only one additional bucket. - */ - const char *start_buf = buf; - for (; i < nvec; i++) { - apr_size_t len = vec[i].iov_len; - if (len > remaining) { - break; - } - memcpy(buf, (const void *) vec[i].iov_base, len); - buf += len; - remaining -= len; - } - e->length += (buf - start_buf); - total_len -= (buf - start_buf); - - if (flush) { - apr_status_t rv = flush(b, ctx); - if (rv != APR_SUCCESS) { - return rv; - } - } - - /* Now fall through into the case below to - * allocate another heap bucket and copy the - * rest of the array. (Note that i is not - * reset to zero here; it holds the index - * of the first vector element to be - * written to the new bucket.) - */ - } - } - - /* Allocate a new heap bucket, and copy the data into it. - * The checks above ensure that the amount of data to be - * written here is no larger than APR_BUCKET_BUFF_SIZE. - */ - buf = apr_bucket_alloc(APR_BUCKET_BUFF_SIZE, b->bucket_alloc); - e = apr_bucket_heap_create(buf, APR_BUCKET_BUFF_SIZE, - apr_bucket_free, b->bucket_alloc); - for (; i < nvec; i++) { - apr_size_t len = vec[i].iov_len; - memcpy(buf, (const void *) vec[i].iov_base, len); - buf += len; - } - e->length = total_len; - APR_BRIGADE_INSERT_TAIL(b, e); - - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb, - apr_brigade_flush flush, void *ctx, - const char *str) -{ - apr_size_t len = strlen(str); - apr_bucket *bkt = APR_BRIGADE_LAST(bb); - if (!APR_BRIGADE_EMPTY(bb) && APR_BUCKET_IS_HEAP(bkt)) { - /* If there is enough space available in a heap bucket - * at the end of the brigade, copy the string directly - * into the heap bucket - */ - apr_bucket_heap *h = bkt->data; - apr_size_t bytes_avail = h->alloc_len - bkt->length; - - if (bytes_avail >= len) { - char *buf = h->base + bkt->start + bkt->length; - memcpy(buf, str, len); - bkt->length += len; - return APR_SUCCESS; - } - } - - /* If the string could not be copied into an existing heap - * bucket, delegate the work to apr_brigade_write(), which - * knows how to grow the brigade - */ - return apr_brigade_write(bb, flush, ctx, str, len); -} - -APU_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, ...) -{ - va_list va; - apr_status_t rv; - - va_start(va, ctx); - rv = apr_brigade_vputstrs(b, flush, ctx, va); - va_end(va); - return rv; -} - -APU_DECLARE_NONSTD(apr_status_t) apr_brigade_printf(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, - const char *fmt, ...) -{ - va_list ap; - apr_status_t rv; - - va_start(ap, fmt); - rv = apr_brigade_vprintf(b, flush, ctx, fmt, ap); - va_end(ap); - return rv; -} - -struct brigade_vprintf_data_t { - apr_vformatter_buff_t vbuff; - - apr_bucket_brigade *b; /* associated brigade */ - apr_brigade_flush *flusher; /* flushing function */ - void *ctx; - - char *cbuff; /* buffer to flush from */ -}; - -static apr_status_t brigade_flush(apr_vformatter_buff_t *buff) -{ - /* callback function passed to ap_vformatter to be - * called when vformatter needs to buff and - * buff.curpos > buff.endpos - */ - - /* "downcast," have really passed a brigade_vprintf_data_t* */ - struct brigade_vprintf_data_t *vd = (struct brigade_vprintf_data_t*)buff; - apr_status_t res = APR_SUCCESS; - - res = apr_brigade_write(vd->b, *vd->flusher, vd->ctx, vd->cbuff, - APR_BUCKET_BUFF_SIZE); - - if(res != APR_SUCCESS) { - return -1; - } - - vd->vbuff.curpos = vd->cbuff; - vd->vbuff.endpos = vd->cbuff + APR_BUCKET_BUFF_SIZE; - - return res; -} - -APU_DECLARE(apr_status_t) apr_brigade_vprintf(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, - const char *fmt, va_list va) -{ - /* the cast, in order of appearance */ - struct brigade_vprintf_data_t vd; - char buf[APR_BUCKET_BUFF_SIZE]; - apr_size_t written; - - vd.vbuff.curpos = buf; - vd.vbuff.endpos = buf + APR_BUCKET_BUFF_SIZE; - vd.b = b; - vd.flusher = &flush; - vd.ctx = ctx; - vd.cbuff = buf; - - written = apr_vformatter(brigade_flush, &vd.vbuff, fmt, va); - - if (written == -1) { - return -1; - } - - /* tack on null terminator to remaining string */ - *(vd.vbuff.curpos) = '\0'; - - /* write out what remains in the buffer */ - return apr_brigade_write(b, flush, ctx, buf, vd.vbuff.curpos - buf); -} - -/* A "safe" maximum bucket size, 1Gb */ -#define MAX_BUCKET_SIZE (0x40000000) - -APU_DECLARE(apr_bucket *) apr_brigade_insert_file(apr_bucket_brigade *bb, - apr_file_t *f, - apr_off_t start, - apr_off_t length, - apr_pool_t *p) -{ - apr_bucket *e; - - if (sizeof(apr_off_t) == sizeof(apr_size_t) || length < MAX_BUCKET_SIZE) { - e = apr_bucket_file_create(f, start, (apr_size_t)length, p, - bb->bucket_alloc); - } - else { - /* Several buckets are needed. */ - e = apr_bucket_file_create(f, start, MAX_BUCKET_SIZE, p, - bb->bucket_alloc); - - while (length > MAX_BUCKET_SIZE) { - apr_bucket *ce; - apr_bucket_copy(e, &ce); - APR_BRIGADE_INSERT_TAIL(bb, ce); - e->start += MAX_BUCKET_SIZE; - length -= MAX_BUCKET_SIZE; - } - e->length = (apr_size_t)length; /* Resize just the last bucket */ - } - - APR_BRIGADE_INSERT_TAIL(bb, e); - return e; -} diff --git a/libs/apr-util/buckets/apr_buckets.c b/libs/apr-util/buckets/apr_buckets.c deleted file mode 100644 index 69b7f6cf75..0000000000 --- a/libs/apr-util/buckets/apr_buckets.c +++ /dev/null @@ -1,46 +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_buckets.h" - -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_noop(apr_bucket *data, - apr_pool_t *pool) -{ - return APR_SUCCESS; -} - -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_notimpl(apr_bucket *data, - apr_pool_t *pool) -{ - return APR_ENOTIMPL; -} - -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_split_notimpl(apr_bucket *data, - apr_size_t point) -{ - return APR_ENOTIMPL; -} - -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_copy_notimpl(apr_bucket *e, - apr_bucket **c) -{ - return APR_ENOTIMPL; -} - -APU_DECLARE_NONSTD(void) apr_bucket_destroy_noop(void *data) -{ - return; -} diff --git a/libs/apr-util/buckets/apr_buckets_alloc.c b/libs/apr-util/buckets/apr_buckets_alloc.c deleted file mode 100644 index 81a8271484..0000000000 --- a/libs/apr-util/buckets/apr_buckets_alloc.c +++ /dev/null @@ -1,184 +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 <stdlib.h> - -#include "apr_buckets.h" -#include "apr_allocator.h" - -#define ALLOC_AMT (8192 - APR_MEMNODE_T_SIZE) - -typedef struct node_header_t { - apr_size_t size; - apr_bucket_alloc_t *alloc; - apr_memnode_t *memnode; - struct node_header_t *next; -} node_header_t; - -#define SIZEOF_NODE_HEADER_T APR_ALIGN_DEFAULT(sizeof(node_header_t)) -#define SMALL_NODE_SIZE (APR_BUCKET_ALLOC_SIZE + SIZEOF_NODE_HEADER_T) - -/** A list of free memory from which new buckets or private bucket - * structures can be allocated. - */ -struct apr_bucket_alloc_t { - apr_pool_t *pool; - apr_allocator_t *allocator; - node_header_t *freelist; - apr_memnode_t *blocks; -}; - -static apr_status_t alloc_cleanup(void *data) -{ - apr_bucket_alloc_t *list = data; - - apr_allocator_free(list->allocator, list->blocks); - -#if APR_POOL_DEBUG - if (list->pool && list->allocator != apr_pool_allocator_get(list->pool)) { - apr_allocator_destroy(list->allocator); - } -#endif - - return APR_SUCCESS; -} - -APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t *p) -{ - apr_allocator_t *allocator = apr_pool_allocator_get(p); - apr_bucket_alloc_t *list; - -#if APR_POOL_DEBUG - /* may be NULL for debug mode. */ - if (allocator == NULL) { - if (apr_allocator_create(&allocator) != APR_SUCCESS) { - abort(); - } - } -#endif - - list = apr_bucket_alloc_create_ex(allocator); - list->pool = p; - apr_pool_cleanup_register(list->pool, list, alloc_cleanup, - apr_pool_cleanup_null); - - return list; -} - -APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create_ex( - apr_allocator_t *allocator) -{ - apr_bucket_alloc_t *list; - apr_memnode_t *block; - - block = apr_allocator_alloc(allocator, ALLOC_AMT); - list = (apr_bucket_alloc_t *)block->first_avail; - list->pool = NULL; - list->allocator = allocator; - list->freelist = NULL; - list->blocks = block; - block->first_avail += APR_ALIGN_DEFAULT(sizeof(*list)); - - return list; -} - -APU_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list) -{ - if (list->pool) { - apr_pool_cleanup_kill(list->pool, list, alloc_cleanup); - } - - apr_allocator_free(list->allocator, list->blocks); - -#if APR_POOL_DEBUG - if (list->pool && list->allocator != apr_pool_allocator_get(list->pool)) { - apr_allocator_destroy(list->allocator); - } -#endif -} - -APU_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size, - apr_bucket_alloc_t *list) -{ - node_header_t *node; - apr_memnode_t *active = list->blocks; - char *endp; - - size += SIZEOF_NODE_HEADER_T; - if (size <= SMALL_NODE_SIZE) { - if (list->freelist) { - node = list->freelist; - list->freelist = node->next; - } - else { - endp = active->first_avail + SMALL_NODE_SIZE; - if (endp >= active->endp) { - list->blocks = apr_allocator_alloc(list->allocator, ALLOC_AMT); - list->blocks->next = active; - active = list->blocks; - endp = active->first_avail + SMALL_NODE_SIZE; - } - node = (node_header_t *)active->first_avail; - node->alloc = list; - node->memnode = active; - node->size = SMALL_NODE_SIZE; - active->first_avail = endp; - } - } - else { - apr_memnode_t *memnode = apr_allocator_alloc(list->allocator, size); - node = (node_header_t *)memnode->first_avail; - node->alloc = list; - node->memnode = memnode; - node->size = size; - } - return ((char *)node) + SIZEOF_NODE_HEADER_T; -} - -#ifdef APR_BUCKET_DEBUG -#if APR_HAVE_STDLIB_H -#include <stdlib.h> -#endif -static void check_not_already_free(node_header_t *node) -{ - apr_bucket_alloc_t *list = node->alloc; - node_header_t *curr = list->freelist; - - while (curr) { - if (node == curr) { - abort(); - } - curr = curr->next; - } -} -#else -#define check_not_already_free(node) -#endif - -APU_DECLARE_NONSTD(void) apr_bucket_free(void *mem) -{ - node_header_t *node = (node_header_t *)((char *)mem - SIZEOF_NODE_HEADER_T); - apr_bucket_alloc_t *list = node->alloc; - - if (node->size == SMALL_NODE_SIZE) { - check_not_already_free(node); - node->next = list->freelist; - list->freelist = node; - } - else { - apr_allocator_free(list->allocator, node->memnode); - } -} diff --git a/libs/apr-util/buckets/apr_buckets_eos.c b/libs/apr-util/buckets/apr_buckets_eos.c deleted file mode 100644 index 5783857dfa..0000000000 --- a/libs/apr-util/buckets/apr_buckets_eos.c +++ /dev/null @@ -1,54 +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_buckets.h" - -static apr_status_t eos_bucket_read(apr_bucket *b, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - *str = NULL; - *len = 0; - return APR_SUCCESS; -} - -APU_DECLARE(apr_bucket *) apr_bucket_eos_make(apr_bucket *b) -{ - b->length = 0; - b->start = 0; - b->data = NULL; - b->type = &apr_bucket_type_eos; - - return b; -} - -APU_DECLARE(apr_bucket *) apr_bucket_eos_create(apr_bucket_alloc_t *list) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_eos_make(b); -} - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_eos = { - "EOS", 5, APR_BUCKET_METADATA, - apr_bucket_destroy_noop, - eos_bucket_read, - apr_bucket_setaside_noop, - apr_bucket_split_notimpl, - apr_bucket_simple_copy -}; diff --git a/libs/apr-util/buckets/apr_buckets_file.c b/libs/apr-util/buckets/apr_buckets_file.c deleted file mode 100644 index 7462bb7032..0000000000 --- a/libs/apr-util/buckets/apr_buckets_file.c +++ /dev/null @@ -1,228 +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_file_io.h" -#include "apr_buckets.h" - -#if APR_HAS_MMAP -#include "apr_mmap.h" - -/* mmap support for static files based on ideas from John Heidemann's - * patch against 1.0.5. See - * <http://www.isi.edu/~johnh/SOFTWARE/APACHE/index.html>. - */ - -#endif /* APR_HAS_MMAP */ - -static void file_bucket_destroy(void *data) -{ - apr_bucket_file *f = data; - - if (apr_bucket_shared_destroy(f)) { - /* no need to close the file here; it will get - * done automatically when the pool gets cleaned up */ - apr_bucket_free(f); - } -} - -#if APR_HAS_MMAP -static int file_make_mmap(apr_bucket *e, apr_size_t filelength, - apr_off_t fileoffset, apr_pool_t *p) -{ - apr_bucket_file *a = e->data; - apr_mmap_t *mm; - - if (!a->can_mmap) { - return 0; - } - - if (filelength > APR_MMAP_LIMIT) { - if (apr_mmap_create(&mm, a->fd, fileoffset, APR_MMAP_LIMIT, - APR_MMAP_READ, p) != APR_SUCCESS) - { - return 0; - } - apr_bucket_split(e, APR_MMAP_LIMIT); - filelength = APR_MMAP_LIMIT; - } - else if ((filelength < APR_MMAP_THRESHOLD) || - (apr_mmap_create(&mm, a->fd, fileoffset, filelength, - APR_MMAP_READ, p) != APR_SUCCESS)) - { - return 0; - } - apr_bucket_mmap_make(e, mm, 0, filelength); - file_bucket_destroy(a); - return 1; -} -#endif - -static apr_status_t file_bucket_read(apr_bucket *e, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - apr_bucket_file *a = e->data; - apr_file_t *f = a->fd; - apr_bucket *b = NULL; - char *buf; - apr_status_t rv; - apr_size_t filelength = e->length; /* bytes remaining in file past offset */ - apr_off_t fileoffset = e->start; -#if APR_HAS_THREADS && !APR_HAS_XTHREAD_FILES - apr_int32_t flags; -#endif - -#if APR_HAS_MMAP - if (file_make_mmap(e, filelength, fileoffset, a->readpool)) { - return apr_bucket_read(e, str, len, block); - } -#endif - -#if APR_HAS_THREADS && !APR_HAS_XTHREAD_FILES - if ((flags = apr_file_flags_get(f)) & APR_XTHREAD) { - /* this file descriptor is shared across multiple threads and - * this OS doesn't support that natively, so as a workaround - * we must reopen the file into a->readpool */ - const char *fname; - apr_file_name_get(&fname, f); - - rv = apr_file_open(&f, fname, (flags & ~APR_XTHREAD), 0, a->readpool); - if (rv != APR_SUCCESS) - return rv; - - a->fd = f; - } -#endif - - *len = (filelength > APR_BUCKET_BUFF_SIZE) - ? APR_BUCKET_BUFF_SIZE - : filelength; - *str = NULL; /* in case we die prematurely */ - buf = apr_bucket_alloc(*len, e->list); - - /* Handle offset ... */ - rv = apr_file_seek(f, APR_SET, &fileoffset); - if (rv != APR_SUCCESS) { - apr_bucket_free(buf); - return rv; - } - rv = apr_file_read(f, buf, len); - if (rv != APR_SUCCESS && rv != APR_EOF) { - apr_bucket_free(buf); - return rv; - } - filelength -= *len; - /* - * Change the current bucket to refer to what we read, - * even if we read nothing because we hit EOF. - */ - apr_bucket_heap_make(e, buf, *len, apr_bucket_free); - - /* If we have more to read from the file, then create another bucket */ - if (filelength > 0 && rv != APR_EOF) { - /* for efficiency, we can just build a new apr_bucket struct - * to wrap around the existing file bucket */ - b = apr_bucket_alloc(sizeof(*b), e->list); - b->start = fileoffset + (*len); - b->length = filelength; - b->data = a; - b->type = &apr_bucket_type_file; - b->free = apr_bucket_free; - b->list = e->list; - APR_BUCKET_INSERT_AFTER(e, b); - } - else { - file_bucket_destroy(a); - } - - *str = buf; - return rv; -} - -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) -{ - apr_bucket_file *f; - - f = apr_bucket_alloc(sizeof(*f), b->list); - f->fd = fd; - f->readpool = p; -#if APR_HAS_MMAP - f->can_mmap = 1; -#endif - - b = apr_bucket_shared_make(b, f, offset, len); - b->type = &apr_bucket_type_file; - - return b; -} - -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) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_file_make(b, fd, offset, len, p); -} - -APU_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *e, - int enabled) -{ -#if APR_HAS_MMAP - apr_bucket_file *a = e->data; - a->can_mmap = enabled; - return APR_SUCCESS; -#else - return APR_ENOTIMPL; -#endif /* APR_HAS_MMAP */ -} - - -static apr_status_t file_bucket_setaside(apr_bucket *data, apr_pool_t *reqpool) -{ - apr_bucket_file *a = data->data; - apr_file_t *fd = NULL; - apr_file_t *f = a->fd; - apr_pool_t *curpool = apr_file_pool_get(f); - - if (apr_pool_is_ancestor(curpool, reqpool)) { - return APR_SUCCESS; - } - - if (!apr_pool_is_ancestor(a->readpool, reqpool)) { - a->readpool = reqpool; - } - - apr_file_setaside(&fd, f, reqpool); - a->fd = fd; - return APR_SUCCESS; -} - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_file = { - "FILE", 5, APR_BUCKET_DATA, - file_bucket_destroy, - file_bucket_read, - file_bucket_setaside, - apr_bucket_shared_split, - apr_bucket_shared_copy -}; diff --git a/libs/apr-util/buckets/apr_buckets_flush.c b/libs/apr-util/buckets/apr_buckets_flush.c deleted file mode 100644 index 68b6bfa214..0000000000 --- a/libs/apr-util/buckets/apr_buckets_flush.c +++ /dev/null @@ -1,54 +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_buckets.h" - -static apr_status_t flush_bucket_read(apr_bucket *b, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - *str = NULL; - *len = 0; - return APR_SUCCESS; -} - -APU_DECLARE(apr_bucket *) apr_bucket_flush_make(apr_bucket *b) -{ - b->length = 0; - b->start = 0; - b->data = NULL; - b->type = &apr_bucket_type_flush; - - return b; -} - -APU_DECLARE(apr_bucket *) apr_bucket_flush_create(apr_bucket_alloc_t *list) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_flush_make(b); -} - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_flush = { - "FLUSH", 5, APR_BUCKET_METADATA, - apr_bucket_destroy_noop, - flush_bucket_read, - apr_bucket_setaside_noop, - apr_bucket_split_notimpl, - apr_bucket_simple_copy -}; diff --git a/libs/apr-util/buckets/apr_buckets_heap.c b/libs/apr-util/buckets/apr_buckets_heap.c deleted file mode 100644 index d1ebd2947a..0000000000 --- a/libs/apr-util/buckets/apr_buckets_heap.c +++ /dev/null @@ -1,96 +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_buckets.h" -#define APR_WANT_MEMFUNC -#include "apr_want.h" - -static apr_status_t heap_bucket_read(apr_bucket *b, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - apr_bucket_heap *h = b->data; - - *str = h->base + b->start; - *len = b->length; - return APR_SUCCESS; -} - -static void heap_bucket_destroy(void *data) -{ - apr_bucket_heap *h = data; - - if (apr_bucket_shared_destroy(h)) { - (*h->free_func)(h->base); - apr_bucket_free(h); - } -} - -/* Warning: if you change this function, be sure to - * change apr_bucket_pool_make() too! */ -APU_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b, const char *buf, - apr_size_t length, - void (*free_func)(void *data)) -{ - apr_bucket_heap *h; - - h = apr_bucket_alloc(sizeof(*h), b->list); - - if (!free_func) { - h->alloc_len = length; - h->base = apr_bucket_alloc(h->alloc_len, b->list); - if (h->base == NULL) { - apr_bucket_free(h); - return NULL; - } - h->free_func = apr_bucket_free; - memcpy(h->base, buf, length); - } - else { - /* XXX: we lose the const qualifier here which indicates - * there's something screwy with the API... - */ - h->base = (char *) buf; - h->alloc_len = length; - h->free_func = free_func; - } - - b = apr_bucket_shared_make(b, h, 0, length); - b->type = &apr_bucket_type_heap; - - return b; -} - -APU_DECLARE(apr_bucket *) apr_bucket_heap_create(const char *buf, - apr_size_t length, - void (*free_func)(void *data), - apr_bucket_alloc_t *list) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_heap_make(b, buf, length, free_func); -} - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_heap = { - "HEAP", 5, APR_BUCKET_DATA, - heap_bucket_destroy, - heap_bucket_read, - apr_bucket_setaside_noop, - apr_bucket_shared_split, - apr_bucket_shared_copy -}; diff --git a/libs/apr-util/buckets/apr_buckets_mmap.c b/libs/apr-util/buckets/apr_buckets_mmap.c deleted file mode 100644 index 3e7a9d73c2..0000000000 --- a/libs/apr-util/buckets/apr_buckets_mmap.c +++ /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. - */ - -#include "apr_buckets.h" - -#if APR_HAS_MMAP - -static apr_status_t mmap_bucket_read(apr_bucket *b, const char **str, - apr_size_t *length, apr_read_type_e block) -{ - apr_bucket_mmap *m = b->data; - apr_status_t ok; - void *addr; - - if (!m->mmap) { - /* the apr_mmap_t was already cleaned up out from under us */ - return APR_EINVAL; - } - - ok = apr_mmap_offset(&addr, m->mmap, b->start); - if (ok != APR_SUCCESS) { - return ok; - } - *str = addr; - *length = b->length; - return APR_SUCCESS; -} - -static apr_status_t mmap_bucket_cleanup(void *data) -{ - /* the apr_mmap_t is about to disappear out from under us, so we - * have no choice but to pretend it doesn't exist anymore. the - * refcount is now useless because there's nothing to refer to - * anymore. so the only valid action on any remaining referrer - * is to delete it. no more reads, no more anything. */ - apr_bucket_mmap *m = data; - - m->mmap = NULL; - return APR_SUCCESS; -} - -static void mmap_bucket_destroy(void *data) -{ - apr_bucket_mmap *m = data; - - if (apr_bucket_shared_destroy(m)) { - if (m->mmap) { - apr_pool_cleanup_kill(m->mmap->cntxt, m, mmap_bucket_cleanup); - apr_mmap_delete(m->mmap); - } - apr_bucket_free(m); - } -} - -/* - * XXX: are the start and length arguments useful? - */ -APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm, - apr_off_t start, - apr_size_t length) -{ - apr_bucket_mmap *m; - - m = apr_bucket_alloc(sizeof(*m), b->list); - m->mmap = mm; - - apr_pool_cleanup_register(mm->cntxt, m, mmap_bucket_cleanup, - apr_pool_cleanup_null); - - b = apr_bucket_shared_make(b, m, start, length); - b->type = &apr_bucket_type_mmap; - - return b; -} - - -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) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_mmap_make(b, mm, start, length); -} - -static apr_status_t mmap_bucket_setaside(apr_bucket *b, apr_pool_t *p) -{ - apr_bucket_mmap *m = b->data; - apr_mmap_t *mm = m->mmap; - apr_mmap_t *new_mm; - apr_status_t ok; - - if (!mm) { - /* the apr_mmap_t was already cleaned up out from under us */ - return APR_EINVAL; - } - - /* shortcut if possible */ - if (apr_pool_is_ancestor(mm->cntxt, p)) { - return APR_SUCCESS; - } - - /* duplicate apr_mmap_t into new pool */ - ok = apr_mmap_dup(&new_mm, mm, p); - if (ok != APR_SUCCESS) { - return ok; - } - - /* decrement refcount on old apr_bucket_mmap */ - mmap_bucket_destroy(m); - - /* create new apr_bucket_mmap pointing to new apr_mmap_t */ - apr_bucket_mmap_make(b, new_mm, b->start, b->length); - - return APR_SUCCESS; -} - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_mmap = { - "MMAP", 5, APR_BUCKET_DATA, - mmap_bucket_destroy, - mmap_bucket_read, - mmap_bucket_setaside, - apr_bucket_shared_split, - apr_bucket_shared_copy -}; - -#endif diff --git a/libs/apr-util/buckets/apr_buckets_pipe.c b/libs/apr-util/buckets/apr_buckets_pipe.c deleted file mode 100644 index 36c0cd55eb..0000000000 --- a/libs/apr-util/buckets/apr_buckets_pipe.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. - */ - -#include "apr_buckets.h" - -static apr_status_t pipe_bucket_read(apr_bucket *a, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - apr_file_t *p = a->data; - char *buf; - apr_status_t rv; - apr_interval_time_t timeout; - - if (block == APR_NONBLOCK_READ) { - apr_file_pipe_timeout_get(p, &timeout); - apr_file_pipe_timeout_set(p, 0); - } - - *str = NULL; - *len = APR_BUCKET_BUFF_SIZE; - buf = apr_bucket_alloc(*len, a->list); /* XXX: check for failure? */ - - rv = apr_file_read(p, buf, len); - - if (block == APR_NONBLOCK_READ) { - apr_file_pipe_timeout_set(p, timeout); - } - - if (rv != APR_SUCCESS && rv != APR_EOF) { - apr_bucket_free(buf); - return rv; - } - /* - * If there's more to read we have to keep the rest of the pipe - * for later. Otherwise, we'll close the pipe. - * XXX: Note that more complicated bucket types that - * refer to data not in memory and must therefore have a read() - * function similar to this one should be wary of copying this - * code because if they have a destroy function they probably - * want to migrate the bucket's subordinate structure from the - * old bucket to a raw new one and adjust it as appropriate, - * rather than destroying the old one and creating a completely - * new bucket. - */ - if (*len > 0) { - apr_bucket_heap *h; - /* Change the current bucket to refer to what we read */ - a = apr_bucket_heap_make(a, buf, *len, apr_bucket_free); - h = a->data; - h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */ - *str = buf; - APR_BUCKET_INSERT_AFTER(a, apr_bucket_pipe_create(p, a->list)); - } - else { - apr_bucket_free(buf); - a = apr_bucket_immortal_make(a, "", 0); - *str = a->data; - if (rv == APR_EOF) { - apr_file_close(p); - } - } - return APR_SUCCESS; -} - -APU_DECLARE(apr_bucket *) apr_bucket_pipe_make(apr_bucket *b, apr_file_t *p) -{ - /* - * A pipe is closed when the end is reached in pipe_bucket_read(). If - * the pipe isn't read to the end (e.g., error path), the pipe will be - * closed when its pool goes away. - * - * Note that typically the pipe is allocated from the request pool - * so it will disappear when the request is finished. However the - * core filter may decide to set aside the tail end of a CGI - * response if the connection is pipelined. This turns out not to - * be a problem because the core will have read to the end of the - * stream so the bucket(s) that it sets aside will be the heap - * buckets created by pipe_bucket_read() above. - */ - b->type = &apr_bucket_type_pipe; - b->length = (apr_size_t)(-1); - b->start = -1; - b->data = p; - - return b; -} - -APU_DECLARE(apr_bucket *) apr_bucket_pipe_create(apr_file_t *p, - apr_bucket_alloc_t *list) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_pipe_make(b, p); -} - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_pipe = { - "PIPE", 5, APR_BUCKET_DATA, - apr_bucket_destroy_noop, - pipe_bucket_read, - apr_bucket_setaside_notimpl, - apr_bucket_split_notimpl, - apr_bucket_copy_notimpl -}; diff --git a/libs/apr-util/buckets/apr_buckets_pool.c b/libs/apr-util/buckets/apr_buckets_pool.c deleted file mode 100644 index 2226a75196..0000000000 --- a/libs/apr-util/buckets/apr_buckets_pool.c +++ /dev/null @@ -1,142 +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_buckets.h" -#define APR_WANT_MEMFUNC -#include "apr_want.h" - -static apr_status_t pool_bucket_cleanup(void *data) -{ - apr_bucket_pool *p = data; - - /* - * If the pool gets cleaned up, we have to copy the data out - * of the pool and onto the heap. But the apr_buckets out there - * that point to this pool bucket need to be notified such that - * they can morph themselves into a regular heap bucket the next - * time they try to read. To avoid having to manipulate - * reference counts and b->data pointers, the apr_bucket_pool - * actually _contains_ an apr_bucket_heap as its first element, - * so the two share their apr_bucket_refcount member, and you - * can typecast a pool bucket struct to make it look like a - * regular old heap bucket struct. - */ - p->heap.base = apr_bucket_alloc(p->heap.alloc_len, p->list); - memcpy(p->heap.base, p->base, p->heap.alloc_len); - p->base = NULL; - p->pool = NULL; - - return APR_SUCCESS; -} - -static apr_status_t pool_bucket_read(apr_bucket *b, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - apr_bucket_pool *p = b->data; - const char *base = p->base; - - if (p->pool == NULL) { - /* - * pool has been cleaned up... masquerade as a heap bucket from now - * on. subsequent bucket operations will use the heap bucket code. - */ - b->type = &apr_bucket_type_heap; - base = p->heap.base; - } - *str = base + b->start; - *len = b->length; - return APR_SUCCESS; -} - -static void pool_bucket_destroy(void *data) -{ - apr_bucket_pool *p = data; - - /* If the pool is cleaned up before the last reference goes - * away, the data is really now on the heap; heap_destroy() takes - * over. free() in heap_destroy() thinks it's freeing - * an apr_bucket_heap, when in reality it's freeing the whole - * apr_bucket_pool for us. - */ - if (p->pool) { - /* the shared resource is still in the pool - * because the pool has not been cleaned up yet - */ - if (apr_bucket_shared_destroy(p)) { - apr_pool_cleanup_kill(p->pool, p, pool_bucket_cleanup); - apr_bucket_free(p); - } - } - else { - /* the shared resource is no longer in the pool, it's - * on the heap, but this reference still thinks it's a pool - * bucket. we should just go ahead and pass control to - * heap_destroy() for it since it doesn't know any better. - */ - apr_bucket_type_heap.destroy(p); - } -} - -APU_DECLARE(apr_bucket *) apr_bucket_pool_make(apr_bucket *b, - const char *buf, apr_size_t length, apr_pool_t *pool) -{ - apr_bucket_pool *p; - - p = apr_bucket_alloc(sizeof(*p), b->list); - - /* XXX: we lose the const qualifier here which indicates - * there's something screwy with the API... - */ - /* XXX: why is this? buf is const, p->base is const... what's - * the problem? --jcw */ - p->base = (char *) buf; - p->pool = pool; - p->list = b->list; - - b = apr_bucket_shared_make(b, p, 0, length); - b->type = &apr_bucket_type_pool; - - /* pre-initialize heap bucket member */ - p->heap.alloc_len = length; - p->heap.base = NULL; - p->heap.free_func = apr_bucket_free; - - apr_pool_cleanup_register(p->pool, p, pool_bucket_cleanup, - apr_pool_cleanup_null); - return b; -} - -APU_DECLARE(apr_bucket *) apr_bucket_pool_create(const char *buf, - apr_size_t length, - apr_pool_t *pool, - apr_bucket_alloc_t *list) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_pool_make(b, buf, length, pool); -} - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_pool = { - "POOL", 5, APR_BUCKET_DATA, - pool_bucket_destroy, - pool_bucket_read, - apr_bucket_setaside_noop, /* don't need to setaside thanks to the cleanup*/ - apr_bucket_shared_split, - apr_bucket_shared_copy -}; diff --git a/libs/apr-util/buckets/apr_buckets_refcount.c b/libs/apr-util/buckets/apr_buckets_refcount.c deleted file mode 100644 index 72747878d7..0000000000 --- a/libs/apr-util/buckets/apr_buckets_refcount.c +++ /dev/null @@ -1,64 +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_buckets.h" - -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_split(apr_bucket *a, - apr_size_t point) -{ - apr_bucket_refcount *r = a->data; - apr_status_t rv; - - if ((rv = apr_bucket_simple_split(a, point)) != APR_SUCCESS) { - return rv; - } - r->refcount++; - - return APR_SUCCESS; -} - -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_copy(apr_bucket *a, - apr_bucket **b) -{ - apr_bucket_refcount *r = a->data; - - apr_bucket_simple_copy(a, b); - r->refcount++; - - return APR_SUCCESS; -} - -APU_DECLARE(int) apr_bucket_shared_destroy(void *data) -{ - apr_bucket_refcount *r = data; - r->refcount--; - return (r->refcount == 0); -} - -APU_DECLARE(apr_bucket *) apr_bucket_shared_make(apr_bucket *b, void *data, - apr_off_t start, - apr_size_t length) -{ - apr_bucket_refcount *r = data; - - b->data = r; - b->start = start; - b->length = length; - /* caller initializes the type field */ - r->refcount = 1; - - return b; -} diff --git a/libs/apr-util/buckets/apr_buckets_simple.c b/libs/apr-util/buckets/apr_buckets_simple.c deleted file mode 100644 index aabe086479..0000000000 --- a/libs/apr-util/buckets/apr_buckets_simple.c +++ /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. - */ - -#include "apr_buckets.h" - -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_copy(apr_bucket *a, - apr_bucket **b) -{ - *b = apr_bucket_alloc(sizeof(**b), a->list); /* XXX: check for failure? */ - **b = *a; - - return APR_SUCCESS; -} - -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_split(apr_bucket *a, - apr_size_t point) -{ - apr_bucket *b; - - if (point > a->length) { - return APR_EINVAL; - } - - apr_bucket_simple_copy(a, &b); - - a->length = point; - b->length -= point; - b->start += point; - - APR_BUCKET_INSERT_AFTER(a, b); - - return APR_SUCCESS; -} - -static apr_status_t simple_bucket_read(apr_bucket *b, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - *str = (char *)b->data + b->start; - *len = b->length; - return APR_SUCCESS; -} - -APU_DECLARE(apr_bucket *) apr_bucket_immortal_make(apr_bucket *b, - const char *buf, - apr_size_t length) -{ - b->data = (char *)buf; - b->length = length; - b->start = 0; - b->type = &apr_bucket_type_immortal; - - return b; -} - -APU_DECLARE(apr_bucket *) apr_bucket_immortal_create(const char *buf, - apr_size_t length, - apr_bucket_alloc_t *list) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_immortal_make(b, buf, length); -} - -/* - * XXX: This function could do with some tweaking to reduce memory - * usage in various cases, e.g. share buffers in the heap between all - * the buckets that are set aside, or even spool set-aside data to - * disk if it gets too voluminous (but if it does then that's probably - * a bug elsewhere). There should probably be a apr_brigade_setaside() - * function that co-ordinates the action of all the bucket setaside - * functions to improve memory efficiency. - */ -static apr_status_t transient_bucket_setaside(apr_bucket *b, apr_pool_t *pool) -{ - b = apr_bucket_heap_make(b, (char *)b->data + b->start, b->length, NULL); - if (b == NULL) { - return APR_ENOMEM; - } - return APR_SUCCESS; -} - -APU_DECLARE(apr_bucket *) apr_bucket_transient_make(apr_bucket *b, - const char *buf, - apr_size_t length) -{ - b->data = (char *)buf; - b->length = length; - b->start = 0; - b->type = &apr_bucket_type_transient; - return b; -} - -APU_DECLARE(apr_bucket *) apr_bucket_transient_create(const char *buf, - apr_size_t length, - apr_bucket_alloc_t *list) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_transient_make(b, buf, length); -} - -const apr_bucket_type_t apr_bucket_type_immortal = { - "IMMORTAL", 5, APR_BUCKET_DATA, - apr_bucket_destroy_noop, - simple_bucket_read, - apr_bucket_setaside_noop, - apr_bucket_simple_split, - apr_bucket_simple_copy -}; - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_transient = { - "TRANSIENT", 5, APR_BUCKET_DATA, - apr_bucket_destroy_noop, - simple_bucket_read, - transient_bucket_setaside, - apr_bucket_simple_split, - apr_bucket_simple_copy -}; diff --git a/libs/apr-util/buckets/apr_buckets_socket.c b/libs/apr-util/buckets/apr_buckets_socket.c deleted file mode 100644 index 7885d08efb..0000000000 --- a/libs/apr-util/buckets/apr_buckets_socket.c +++ /dev/null @@ -1,114 +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_buckets.h" - -static apr_status_t socket_bucket_read(apr_bucket *a, const char **str, - apr_size_t *len, apr_read_type_e block) -{ - apr_socket_t *p = a->data; - char *buf; - apr_status_t rv; - apr_interval_time_t timeout; - - if (block == APR_NONBLOCK_READ) { - apr_socket_timeout_get(p, &timeout); - apr_socket_timeout_set(p, 0); - } - - *str = NULL; - *len = APR_BUCKET_BUFF_SIZE; - buf = apr_bucket_alloc(*len, a->list); /* XXX: check for failure? */ - - rv = apr_socket_recv(p, buf, len); - - if (block == APR_NONBLOCK_READ) { - apr_socket_timeout_set(p, timeout); - } - - if (rv != APR_SUCCESS && rv != APR_EOF) { - apr_bucket_free(buf); - return rv; - } - /* - * If there's more to read we have to keep the rest of the socket - * for later. XXX: Note that more complicated bucket types that - * refer to data not in memory and must therefore have a read() - * function similar to this one should be wary of copying this - * code because if they have a destroy function they probably - * want to migrate the bucket's subordinate structure from the - * old bucket to a raw new one and adjust it as appropriate, - * rather than destroying the old one and creating a completely - * new bucket. - * - * Even if there is nothing more to read, don't close the socket here - * as we have to use it to send any response :) We could shut it - * down for reading, but there is no benefit to doing so. - */ - if (*len > 0) { - apr_bucket_heap *h; - /* Change the current bucket to refer to what we read */ - a = apr_bucket_heap_make(a, buf, *len, apr_bucket_free); - h = a->data; - h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */ - *str = buf; - APR_BUCKET_INSERT_AFTER(a, apr_bucket_socket_create(p, a->list)); - } - else { - apr_bucket_free(buf); - a = apr_bucket_immortal_make(a, "", 0); - *str = a->data; - } - return APR_SUCCESS; -} - -APU_DECLARE(apr_bucket *) apr_bucket_socket_make(apr_bucket *b, apr_socket_t *p) -{ - /* - * XXX: We rely on a cleanup on some pool or other to actually - * destroy the socket. We should probably explicitly call apr to - * destroy it instead. - * - * Note that typically the socket is allocated from the connection pool - * so it will disappear when the connection is finished. - */ - b->type = &apr_bucket_type_socket; - b->length = (apr_size_t)(-1); - b->start = -1; - b->data = p; - - return b; -} - -APU_DECLARE(apr_bucket *) apr_bucket_socket_create(apr_socket_t *p, - apr_bucket_alloc_t *list) -{ - apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); - - APR_BUCKET_INIT(b); - b->free = apr_bucket_free; - b->list = list; - return apr_bucket_socket_make(b, p); -} - -APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_socket = { - "SOCKET", 5, APR_BUCKET_DATA, - apr_bucket_destroy_noop, - socket_bucket_read, - apr_bucket_setaside_notimpl, - apr_bucket_split_notimpl, - apr_bucket_copy_notimpl -}; diff --git a/libs/apr-util/build-outputs.mk b/libs/apr-util/build-outputs.mk deleted file mode 100644 index d42cda80ff..0000000000 --- a/libs/apr-util/build-outputs.mk +++ /dev/null @@ -1,40 +0,0 @@ -# DO NOT EDIT. AUTOMATICALLY GENERATED. - -crypto/apr_md5.lo: crypto/apr_md5.c .make.dirs include/apr_xlate.h include/apr_md5.h include/apr_sha1.h -crypto/uuid.lo: crypto/uuid.c .make.dirs include/apr_uuid.h -crypto/apr_sha1.lo: crypto/apr_sha1.c .make.dirs include/apr_xlate.h include/apr_sha1.h include/apr_base64.h -crypto/getuuid.lo: crypto/getuuid.c .make.dirs include/apr_uuid.h include/apr_md5.h include/apr_xlate.h -crypto/apr_md4.lo: crypto/apr_md4.c .make.dirs include/apr_md4.h include/apr_xlate.h -encoding/apr_base64.lo: encoding/apr_base64.c .make.dirs include/apr_base64.h include/apr_xlate.h -hooks/apr_hooks.lo: hooks/apr_hooks.c .make.dirs include/apr_optional_hooks.h include/apr_optional.h include/apr_hooks.h -misc/apr_reslist.lo: misc/apr_reslist.c .make.dirs include/apr_reslist.h -misc/apr_rmm.lo: misc/apr_rmm.c .make.dirs include/apr_rmm.h include/apr_anylock.h -misc/apr_date.lo: misc/apr_date.c .make.dirs include/apr_date.h -misc/apu_version.lo: misc/apu_version.c .make.dirs include/apu_version.h -misc/apr_queue.lo: misc/apr_queue.c .make.dirs include/apr_queue.h -uri/apr_uri.lo: uri/apr_uri.c .make.dirs include/apr_uri.h -xml/apr_xml.lo: xml/apr_xml.c .make.dirs include/apr_xml.h include/apr_xlate.h -strmatch/apr_strmatch.lo: strmatch/apr_strmatch.c .make.dirs include/apr_strmatch.h -xlate/xlate.lo: xlate/xlate.c .make.dirs include/apr_xlate.h - -OBJECTS_all = crypto/apr_md5.lo crypto/uuid.lo crypto/apr_sha1.lo crypto/getuuid.lo crypto/apr_md4.lo encoding/apr_base64.lo hooks/apr_hooks.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_date.lo misc/apu_version.lo misc/apr_queue.lo uri/apr_uri.lo xml/apr_xml.lo strmatch/apr_strmatch.lo xlate/xlate.lo - -OBJECTS_unix = $(OBJECTS_all) - -OBJECTS_aix = $(OBJECTS_all) - -OBJECTS_beos = $(OBJECTS_all) - -OBJECTS_os2 = $(OBJECTS_all) - -OBJECTS_os390 = $(OBJECTS_all) - -HEADERS = $(top_srcdir)/include/apr_optional.h $(top_srcdir)/include/apu_version.h $(top_srcdir)/include/apr_strmatch.h $(top_srcdir)/include/apr_optional_hooks.h $(top_srcdir)/include/apr_sdbm.h $(top_srcdir)/include/apr_md4.h $(top_srcdir)/include/apr_reslist.h $(top_srcdir)/include/apr_base64.h $(top_srcdir)/include/apr_xml.h $(top_srcdir)/include/apr_anylock.h $(top_srcdir)/include/apr_rmm.h $(top_srcdir)/include/apr_md5.h $(top_srcdir)/include/apr_date.h $(top_srcdir)/include/apr_hooks.h $(top_srcdir)/include/apr_xlate.h $(top_srcdir)/include/apr_queue.h $(top_srcdir)/include/apr_uri.h $(top_srcdir)/include/apr_uuid.h $(top_srcdir)/include/apr_sha1.h - -SOURCE_DIRS = xml encoding hooks misc crypto uri strmatch xlate $(EXTRA_SOURCE_DIRS) - -BUILD_DIRS = crypto encoding hooks misc strmatch uri xlate xml - -.make.dirs: $(srcdir)/build-outputs.mk - @for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done - @echo timestamp > $@ diff --git a/libs/apr-util/build.conf b/libs/apr-util/build.conf deleted file mode 100644 index 066009fdaa..0000000000 --- a/libs/apr-util/build.conf +++ /dev/null @@ -1,32 +0,0 @@ -# -# Configuration file for APRUTIL. Used by APR/build/gen-build.py -# - -[options] - -# the platform-independent .c files -paths = - buckets/*.c - crypto/*.c - dbm/*.c - dbm/sdbm/*.c - encoding/*.c - hooks/*.c - ldap/*.c - misc/*.c - uri/apr_uri.c - xml/*.c - strmatch/*.c - xlate/*.c - dbd/*.c - -# we have no platform-specific subdirs -platform_dirs = - -# the public headers -headers = include/*.h - -# gen_uri_delim.c - -# we have a recursive makefile for the test files (for now) -# test/*.c diff --git a/libs/apr-util/build/apu-conf.m4 b/libs/apr-util/build/apu-conf.m4 deleted file mode 100644 index b78b038e7b..0000000000 --- a/libs/apr-util/build/apu-conf.m4 +++ /dev/null @@ -1,435 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Copyright 2000-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 custom autoconf rules for APRUTIL -dnl - -dnl -dnl APU_FIND_APR: figure out where APR is located -dnl -AC_DEFUN([APU_FIND_APR], [ - - dnl use the find_apr.m4 script to locate APR. sets apr_found and apr_config - APR_FIND_APR(,,,[1]) - if test "$apr_found" = "no"; then - AC_MSG_ERROR(APR could not be located. Please use the --with-apr option.) - fi - - APR_BUILD_DIR="`$apr_config --installbuilddir`" - - dnl make APR_BUILD_DIR an absolute directory (we'll need it in the - dnl sub-projects in some cases) - APR_BUILD_DIR="`cd $APR_BUILD_DIR && pwd`" - - APR_INCLUDES="`$apr_config --includes`" - APR_LIBS="`$apr_config --link-libtool --libs`" - APR_SO_EXT="`$apr_config --apr-so-ext`" - APR_LIB_TARGET="`$apr_config --apr-lib-target`" - - AC_SUBST(APR_INCLUDES) - AC_SUBST(APR_LIBS) - AC_SUBST(APR_BUILD_DIR) -]) - - -dnl -dnl APU_TEST_EXPAT(directory): test if Expat is located in the specified dir -dnl -dnl if present: sets expat_include_dir, expat_libs, possibly expat_old -dnl -AC_DEFUN([APU_TEST_EXPAT], [ - AC_MSG_CHECKING(for Expat in ifelse($2,,$1,$2)) - - expat_libtool="" - - if test -r "$1/lib/expat.h.in"; then - dnl Expat 1.95.* distribution - expat_include_dir="$1/lib" - expat_ldflags="-L$1/lib" - expat_libs="-lexpat" - expat_libtool="$1/lib/libexpat.la" - elif test -r "$1/include/expat.h" -a \ - -r "$1/lib/libexpat.la"; then - dnl Expat 1.95.* installation (with libtool) - expat_include_dir="$1/include" - expat_ldflags="-L$1/lib" - expat_libs="-lexpat" - expat_libtool="$1/lib/libexpat.la" - elif test -r "$1/include/expat.h" -a \ - -r "$1/lib64/libexpat.la"; then - dnl Expat 1.95.* installation on certain 64-bit platforms (with libtool) - expat_include_dir="$1/include" - expat_ldflags="-L$1/lib64" - expat_libs="-lexpat" - expat_libtool="$1/lib64/libexpat.la" - elif test -r "$1/include/expat.h" -a \ - -r "$1/lib/libexpat.a"; then - dnl Expat 1.95.* installation (without libtool) - dnl FreeBSD textproc/expat2 - expat_include_dir="$1/include" - expat_ldflags="-L$1/lib" - expat_libs="-lexpat" - elif test -r "$1/xmlparse.h"; then - dnl maybe an expat-lite. use this dir for both includes and libs - expat_include_dir="$1" - expat_ldflags="-L$1" - expat_libs="-lexpat" - expat_libtool="$1/libexpat.la" - expat_old=yes - elif test -r "$1/include/xmlparse.h" -a \ - -r "$1/lib/libexpat.a"; then - dnl previously installed expat - expat_include_dir="$1/include" - expat_ldflags="-L$1/lib" - expat_libs="-lexpat" - expat_old=yes - elif test -r "$1/include/xml/xmlparse.h" -a \ - -r "$1/lib/xml/libexpat.a"; then - dnl previously installed expat - expat_include_dir="$1/include/xml" - expat_ldflags="-L$1/lib" - expat_libs="-lexpat" - expat_old=yes - elif test -r "$1/include/xmltok/xmlparse.h"; then - dnl Debian distribution - expat_include_dir="$1/include/xmltok" - expat_ldflags="-L$1/lib" - expat_libs="-lxmlparse -lxmltok" - expat_old=yes - elif test -r "$1/include/xml/xmlparse.h" -a \ - -r "$1/lib/libexpat.a"; then - dnl FreeBSD textproc/expat package - expat_include_dir="$1/include/xml" - expat_ldflags="-L$1/lib" - expat_libs="-lexpat" - expat_old=yes - elif test -r "$1/xmlparse/xmlparse.h"; then - dnl Expat 1.0 or 1.1 source directory - expat_include_dir="$1/xmlparse" - expat_ldflags="-L$1" - expat_libs="-lexpat" - expat_old=yes - fi - dnl ### test for installed Expat 1.95.* distros - - if test -n "$expat_include_dir"; then - dnl ### more info about what we found there? version? using .la? - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi -]) - - -dnl -dnl APU_FIND_EXPAT: figure out where EXPAT is located (or use bundled) -dnl -AC_DEFUN([APU_FIND_EXPAT], [ - -AC_ARG_WITH([expat], -[ --with-expat=DIR specify Expat location or 'builtin'], [ - if test "$withval" = "yes"; then - AC_MSG_ERROR([a directory must be specified for --with-expat]) - elif test "$withval" = "no"; then - AC_MSG_ERROR([Expat cannot be disabled (at this time)]) - elif test "$withval" = "builtin"; then - abs_expatdir="`cd $srcdir/xml/expat && pwd`" - if test -d $abs_expatdir/. -a ! -d xml/expat/.; then - $mkdir_p xml/expat - fi - APU_TEST_EXPAT($abs_expatdir, xml/expat) - else - abs_expatdir="`cd $withval && pwd`" - APU_TEST_EXPAT($abs_expatdir, $withval) - if test -z "$expat_include_dir"; then - AC_MSG_ERROR([Expat was not found (or recognized) in \"$withval\"]) - fi - fi -]) - -if test -z "$expat_include_dir"; then - for d in /usr /usr/local xml/expat-cvs xml/expat $srcdir/xml/expat ; do - APU_TEST_EXPAT($d) - if test -n "$expat_include_dir"; then - dnl For /usr installs of expat, we can't specify -L/usr/lib - if test "$d" = "/usr"; then - expat_ldflags="" - fi - break - fi - done -fi -if test -z "$expat_include_dir"; then - AC_MSG_ERROR([could not locate Expat. use --with-expat]) -fi - -dnl If this expat doesn't use libtool natively, we'll mimic it for our -dnl dependency library generation. -if test -z "$expat_libtool"; then - expat_libtool="$expat_ldflags $expat_libs" -fi - -if test -n "$expat_old"; then - AC_DEFINE(APR_HAVE_OLD_EXPAT, 1, [define if Expat 1.0 or 1.1 was found]) -fi - -dnl special-case the bundled distribution (use absolute dirs) -if test "$expat_include_dir" = "xml/expat/lib" -o "$expat_include_dir" = "xml/expat-cvs/lib"; then - bundled_subdir="`echo $expat_include_dir | sed -e 's%/lib%%'`" - APR_SUBDIR_CONFIG($bundled_subdir, [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir]) - expat_include_dir=$top_builddir/$bundled_subdir/lib - expat_ldflags="-L$top_builddir/$bundled_subdir/lib" - expat_libs="-lexpat" - expat_libtool=$top_builddir/$bundled_subdir/lib/libexpat.la - APR_XML_SUBDIRS="`echo $bundled_subdir | sed -e 's%xml/%%'`" - APR_ADDTO(APRUTIL_EXPORT_LIBS, [$expat_libtool]) -else -if test "$expat_include_dir" = "$abs_srcdir/xml/expat/include" -o "$expat_include_dir" = "$abs_srcdir/xml/expat/lib"; then - dnl This is a bit of a hack. This only works because we know that - dnl we are working with the bundled version of the software. - bundled_subdir="xml/expat" - APR_SUBDIR_CONFIG($bundled_subdir, [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir]) - expat_include_dir=$top_builddir/$bundled_subdir/lib - expat_ldflags="-L$top_builddir/$bundled_subdir/lib" - expat_libs="-lexpat" - expat_libtool=$top_builddir/$bundled_subdir/lib/libexpat.la - APR_XML_SUBDIRS="`echo $bundled_subdir | sed -e 's%xml/%%'`" - APR_ADDTO(APRUTIL_EXPORT_LIBS, [$expat_libtool]) -else - APR_ADDTO(APRUTIL_EXPORT_LIBS, [$expat_libs]) -fi -fi -APR_XML_DIR=$bundled_subdir -APR_XML_EXPAT_OLD=$expat_old -AC_SUBST(APR_XML_SUBDIRS) -AC_SUBST(APR_XML_DIR) -AC_SUBST(APR_XML_EXPAT_OLD) - -if test "$expat_include_dir" != "/usr/include"; then - APR_ADDTO(APRUTIL_INCLUDES, [-I$expat_include_dir]) -fi -APR_ADDTO(APRUTIL_LDFLAGS, [$expat_ldflags]) -APR_ADDTO(APRUTIL_LIBS, [$expat_libtool]) -]) - - -dnl -dnl Find a particular LDAP library -dnl -AC_DEFUN([APU_FIND_LDAPLIB], [ - if test ${apu_has_ldap} != "1"; then - ldaplib=$1 - extralib=$2 - unset ac_cv_lib_${ldaplib}_ldap_init - unset ac_cv_lib_${ldaplib}___ldap_init - AC_CHECK_LIB(${ldaplib}, ldap_init, - [ - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l${ldaplib} ${extralib}]) - APR_ADDTO(APRUTIL_LIBS,[-l${ldaplib} ${extralib}]) - AC_CHECK_LIB(${ldaplib}, ldapssl_client_init, apu_has_ldapssl_client_init="1", , ${extralib}) - AC_CHECK_LIB(${ldaplib}, ldapssl_client_deinit, apu_has_ldapssl_client_deinit="1", , ${extralib}) - AC_CHECK_LIB(${ldaplib}, ldapssl_add_trusted_cert, apu_has_ldapssl_add_trusted_cert="1", , ${extralib}) - AC_CHECK_LIB(${ldaplib}, ldap_start_tls_s, apu_has_ldap_start_tls_s="1", , ${extralib}) - AC_CHECK_LIB(${ldaplib}, ldap_sslinit, apu_has_ldap_sslinit="1", , ${extralib}) - AC_CHECK_LIB(${ldaplib}, ldapssl_init, apu_has_ldapssl_init="1", , ${extralib}) - AC_CHECK_LIB(${ldaplib}, ldapssl_install_routines, apu_has_ldapssl_install_routines="1", , ${extralib}) - apu_has_ldap="1"; - ], , ${extralib}) - fi -]) - - -dnl -dnl APU_FIND_LDAP: figure out where LDAP is located -dnl -AC_DEFUN([APU_FIND_LDAP], [ - -echo $ac_n "${nl}checking for ldap support..." - -apu_has_ldap="0"; -apu_has_ldapssl_client_init="0" -apu_has_ldapssl_client_deinit="0" -apu_has_ldapssl_add_trusted_cert="0" -apu_has_ldap_start_tls_s="0" -apu_has_ldapssl_init="0" -apu_has_ldap_sslinit="0" -apu_has_ldapssl_install_routines="0" -apu_has_ldap_openldap="0" -apu_has_ldap_solaris="0" -apu_has_ldap_novell="0" -apu_has_ldap_microsoft="0" -apu_has_ldap_netscape="0" -apu_has_ldap_mozilla="0" -apu_has_ldap_other="0" - -AC_ARG_WITH(ldap-include,[ --with-ldap-include=path path to ldap include files with trailing slash]) -AC_ARG_WITH(ldap-lib,[ --with-ldap-lib=path path to ldap lib file]) -AC_ARG_WITH(ldap,[ --with-ldap=library ldap library to use], - [ - save_cppflags="$CPPFLAGS" - save_ldflags="$LDFLAGS" - save_libs="$LIBS" - if test -n "$with_ldap_include"; then - CPPFLAGS="$CPPFLAGS -I$with_ldap_include" - APR_ADDTO(APRUTIL_INCLUDES, [-I$with_ldap_include]) - fi - if test -n "$with_ldap_lib"; then - LDFLAGS="$LDFLAGS -L$with_ldap_lib" - APR_ADDTO(APRUTIL_LDFLAGS, [-L$with_ldap_lib]) - fi - - LIBLDAP="$withval" - if test "$LIBLDAP" = "yes"; then -dnl The iPlanet C SDK 5.0 is as yet untested... - APU_FIND_LDAPLIB("ldap50", "-lnspr4 -lplc4 -lplds4 -liutil50 -llber50 -lldif50 -lnss3 -lprldap50 -lssl3 -lssldap50") - APU_FIND_LDAPLIB("ldapssl41", "-lnspr3 -lplc3 -lplds3") - APU_FIND_LDAPLIB("ldapssl40") - APU_FIND_LDAPLIB("ldapssl30") - APU_FIND_LDAPLIB("ldapssl20") - APU_FIND_LDAPLIB("ldapsdk", "-lldapx -lldapssl -lldapgss -lgssapi_krb5") - APU_FIND_LDAPLIB("ldapsdk", "-lldapx -lldapssl -lldapgss -lgss -lresolv -lsocket") - APU_FIND_LDAPLIB("ldap", "-llber") - APU_FIND_LDAPLIB("ldap", "-llber -lresolv") - APU_FIND_LDAPLIB("ldap", "-llber -lresolv -lsocket -lnsl") - APU_FIND_LDAPLIB("ldap", "-ldl -lpthread") - else - APU_FIND_LDAPLIB($LIBLDAP) - APU_FIND_LDAPLIB($LIBLDAP, "-lresolv") - APU_FIND_LDAPLIB($LIBLDAP, "-lresolv -lsocket -lnsl") - APU_FIND_LDAPLIB($LIBLDAP, "-ldl -lpthread") - fi - - test ${apu_has_ldap} != "1" && AC_MSG_ERROR(could not find an LDAP library) - AC_CHECK_LIB(lber, ber_init) - - AC_CHECK_HEADERS(lber.h, lber_h=["#include <lber.h>"]) - - # Solaris has a problem in <ldap.h> which prevents it from - # being included by itself. Check for <ldap.h> manually, - # including lber.h first. - AC_CACHE_CHECK([for ldap.h], [apr_cv_hdr_ldap_h], - [AC_TRY_CPP( - [#ifdef HAVE_LBER_H - #include <lber.h> - #endif - #include <ldap.h> - ], [apr_cv_hdr_ldap_h=yes], [apr_cv_hdr_ldap_h=no])]) - if test "$apr_cv_hdr_ldap_h" = "yes"; then - ldap_h=["#include <ldap.h>"] - AC_DEFINE([HAVE_LDAP_H], 1, [Defined if ldap.h is present]) - fi - - AC_CHECK_HEADERS(ldap_ssl.h, ldap_ssl_h=["#include <ldap_ssl.h>"]) - - if test "$apr_cv_hdr_ldap_h" = "yes"; then - AC_CACHE_CHECK([for LDAP toolkit], - [apr_cv_ldap_toolkit], [ - if test "x$apr_cv_ldap_toolkit" = "x"; then - AC_EGREP_CPP([OpenLDAP], [$lber_h - $ldap_h - LDAP_VENDOR_NAME], [apu_has_ldap_openldap="1" - apr_cv_ldap_toolkit="OpenLDAP"]) - fi - if test "x$apr_cv_ldap_toolkit" = "x"; then - AC_EGREP_CPP([Sun Microsystems Inc.], [$lber_h - $ldap_h - LDAP_VENDOR_NAME], [apu_has_ldap_solaris="1" - apr_cv_ldap_toolkit="Solaris"]) - fi - if test "x$apr_cv_ldap_toolkit" = "x"; then - AC_EGREP_CPP([Novell], [$lber_h - $ldap_h - LDAP_VENDOR_NAME], [apu_has_ldap_novell="1" - apr_cv_ldap_toolkit="Novell"]) - fi - if test "x$apr_cv_ldap_toolkit" = "x"; then - AC_EGREP_CPP([Microsoft Corporation.], [$lber_h - $ldap_h - LDAP_VENDOR_NAME], [apu_has_ldap_microsoft="1" - apr_cv_ldap_toolkit="Microsoft"]) - fi - if test "x$apr_cv_ldap_toolkit" = "x"; then - AC_EGREP_CPP([Netscape Communications Corp.], [$lber_h - $ldap_h - LDAP_VENDOR_NAME], [apu_has_ldap_netscape="1" - apr_cv_ldap_toolkit="Netscape"]) - fi - if test "x$apr_cv_ldap_toolkit" = "x"; then - AC_EGREP_CPP([mozilla.org], [$lber_h - $ldap_h - LDAP_VENDOR_NAME], [apu_has_ldap_mozilla="1" - apr_cv_ldap_toolkit="Mozilla"]) - fi - if test "x$apr_cv_ldap_toolkit" = "x"; then - apu_has_ldap_other="1" - apr_cv_ldap_toolkit="unknown" - fi - ]) - fi - - CPPFLAGS=$save_cppflags - LDFLAGS=$save_ldflags - LIBS=$save_libs - ]) - -AC_SUBST(ldap_h) -AC_SUBST(lber_h) -AC_SUBST(ldap_ssl_h) -AC_SUBST(apu_has_ldapssl_client_init) -AC_SUBST(apu_has_ldapssl_client_deinit) -AC_SUBST(apu_has_ldapssl_add_trusted_cert) -AC_SUBST(apu_has_ldap_start_tls_s) -AC_SUBST(apu_has_ldapssl_init) -AC_SUBST(apu_has_ldap_sslinit) -AC_SUBST(apu_has_ldapssl_install_routines) -AC_SUBST(apu_has_ldap) -AC_SUBST(apu_has_ldap_openldap) -AC_SUBST(apu_has_ldap_solaris) -AC_SUBST(apu_has_ldap_novell) -AC_SUBST(apu_has_ldap_microsoft) -AC_SUBST(apu_has_ldap_netscape) -AC_SUBST(apu_has_ldap_mozilla) -AC_SUBST(apu_has_ldap_other) - -]) - -dnl -dnl APU_CHECK_CRYPT_R_STYLE -dnl -dnl Decide which of a couple of flavors of crypt_r() is necessary for -dnl this platform. -dnl -AC_DEFUN([APU_CHECK_CRYPT_R_STYLE], [ - -AC_CACHE_CHECK([style of crypt_r], apr_cv_crypt_r_style, -[AC_TRY_COMPILE([#include <crypt.h>], - [CRYPTD buffer; - crypt_r("passwd", "hash", &buffer);], - [apr_cv_crypt_r_style=cryptd], - [AC_TRY_COMPILE([#include <crypt.h>], - [struct crypt_data buffer; - crypt_r("passwd", "hash", &buffer);], - [apr_cv_crypt_r_style=struct_crypt_data], - [apr_cv_crypt_r_style=none])])]) - -if test "$apr_cv_crypt_r_style" = "cryptd"; then - AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD]) -elif test "$apr_cv_crypt_r_style" = "struct_crypt_data"; then - AC_DEFINE(CRYPT_R_STRUCT_CRYPT_DATA, 1, [Define if crypt_r uses struct crypt_data]) -fi -]) diff --git a/libs/apr-util/build/apu-hints.m4 b/libs/apr-util/build/apu-hints.m4 deleted file mode 100644 index 20878d3275..0000000000 --- a/libs/apr-util/build/apu-hints.m4 +++ /dev/null @@ -1,61 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Copyright 2003-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 apu-hints.m4: apr-util's autoconf macros for platform-specific hints -dnl -dnl We preload various configure settings depending -dnl on previously obtained platform knowledge. -dnl We allow all settings to be overridden from -dnl the command-line. - -dnl -dnl APU_PRELOAD -dnl -dnl Preload various build parameters based on outside knowledge. -dnl -AC_DEFUN([APU_PRELOAD], [ -if test "x$apu_preload_done" != "xyes" ; then - apu_preload_done="yes" - - echo "Applying apr-util hints file rules for $host" - - case "$host" in - *-dec-osf*) - APR_SETIFNULL(apu_crypt_threadsafe, [1]) - ;; - *-hp-hpux11.*) - APR_SETIFNULL(apu_crypt_threadsafe, [1]) - ;; - *-ibm-aix4*|*-ibm-aix5.1*) - APR_SETIFNULL(apu_iconv_inbuf_const, [1]) - ;; - *-ibm-os390) - APR_SETIFNULL(apu_crypt_threadsafe, [1]) - ;; - *-solaris2*) - APR_SETIFNULL(apu_iconv_inbuf_const, [1]) - APR_SETIFNULL(apu_crypt_threadsafe, [1]) - ;; - *-sco3.2v5*) - APR_SETIFNULL(apu_db_xtra_libs, [-lsocket]) - ;; - esac - -fi -]) - - diff --git a/libs/apr-util/build/apu-iconv.m4 b/libs/apr-util/build/apu-iconv.m4 deleted file mode 100644 index b27b75cec7..0000000000 --- a/libs/apr-util/build/apu-iconv.m4 +++ /dev/null @@ -1,123 +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 APU_TRY_ICONV[ IF-SUCCESS, IF-FAILURE ]: try to compile for iconv. -dnl -AC_DEFUN([APU_TRY_ICONV], [ - AC_TRY_LINK([ -#include <stdlib.h> -#include <iconv.h> -], -[ - iconv_t cd = iconv_open("", ""); - iconv(cd, NULL, NULL, NULL, NULL); -], [$1], [$2]) -]) - -dnl -dnl APU_FIND_ICONV: find an iconv library -dnl -AC_DEFUN([APU_FIND_ICONV], [ - -apu_iconv_dir="unknown" -have_apr_iconv="0" -AC_ARG_WITH(iconv,[ --with-iconv[=DIR] path to iconv installation], - [ apu_iconv_dir="$withval" - if test "$apu_iconv_dir" != "yes"; then - APR_ADDTO(CPPFLAGS,[-I$apu_iconv_dir/include]) - APR_ADDTO(LDFLAGS,[-L$apu_iconv_dir/lib]) - fi - if test -f "$apu_iconv_dir/include/api_version.h"; then - have_apr_iconv="1" - have_iconv="0" - APR_REMOVEFROM(LIBS,[-lapriconv]) - AC_MSG_RESULT("Using apr-iconv") - fi - ]) - -if test "$have_apr_iconv" != "1"; then - AC_CHECK_HEADER(iconv.h, [ - APU_TRY_ICONV([ have_iconv="1" ], [ - - APR_ADDTO(LIBS,[-liconv]) - - APU_TRY_ICONV([ - APR_ADDTO(APRUTIL_LIBS,[-liconv]) - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv]) - have_iconv="1" ], - [ have_iconv="0" ]) - - APR_REMOVEFROM(LIBS,[-liconv]) - - ]) - ], [ have_iconv="0" ]) -fi - -if test "$apu_iconv_dir" != "unknown"; then - if test "$have_iconv" != "1"; then - if test "$have_apr_iconv" != "1"; then - AC_MSG_ERROR([iconv support requested, but not found]) - fi - fi - APR_REMOVEFROM(CPPFLAGS,[-I$apu_iconv_dir/include]) - APR_REMOVEFROM(LDFLAGS,[-L$apu_iconv_dir/lib]) - APR_ADDTO(APRUTIL_INCLUDES,[-I$apu_iconv_dir/include]) - APR_ADDTO(APRUTIL_LDFLAGS,[-L$apu_iconv_dir/lib]) -fi - -if test "$have_iconv" = "1"; then - APU_CHECK_ICONV_INBUF -fi - -APR_FLAG_HEADERS(iconv.h langinfo.h) -APR_FLAG_FUNCS(nl_langinfo) -APR_CHECK_DEFINE(CODESET, langinfo.h, [CODESET defined in langinfo.h]) - -AC_SUBST(have_iconv) -AC_SUBST(have_apr_iconv) -])dnl - -dnl -dnl APU_CHECK_ICONV_INBUF -dnl -dnl Decide whether or not the inbuf parameter to iconv() is const. -dnl -dnl We try to compile something without const. If it fails to -dnl compile, we assume that the system's iconv() has const. -dnl Unfortunately, we won't realize when there was a compile -dnl warning, so we allow a variable -- apu_iconv_inbuf_const -- to -dnl be set in hints.m4 to specify whether or not iconv() has const -dnl on this parameter. -dnl -AC_DEFUN([APU_CHECK_ICONV_INBUF], [ -AC_MSG_CHECKING(for type of inbuf parameter to iconv) -if test "x$apu_iconv_inbuf_const" = "x"; then - APR_TRY_COMPILE_NO_WARNING([ - #include <stddef.h> - #include <iconv.h> - ],[ - iconv(0,(char **)0,(size_t *)0,(char **)0,(size_t *)0); - ], apu_iconv_inbuf_const="0", apu_iconv_inbuf_const="1") -fi -if test "$apu_iconv_inbuf_const" = "1"; then - AC_DEFINE(APU_ICONV_INBUF_CONST, 1, [Define if the inbuf parm to iconv() is const char **]) - msg="const char **" -else - msg="char **" -fi -AC_MSG_RESULT([$msg]) -])dnl diff --git a/libs/apr-util/build/dbd.m4 b/libs/apr-util/build/dbd.m4 deleted file mode 100644 index 076efb51e6..0000000000 --- a/libs/apr-util/build/dbd.m4 +++ /dev/null @@ -1,278 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Copyright 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 DBD module -dnl - -dnl -dnl APU_CHECK_DBD: compile backends for apr_dbd. -dnl -AC_DEFUN([APU_CHECK_DBD], [ - apu_have_pgsql=0 - - AC_ARG_WITH([pgsql], [ - --with-pgsql=DIR specify PostgreSQL location - ], [ - apu_have_pgsql=0 - if test "$withval" = "yes"; then - AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])) - if test "$apu_have_pgsql" = "0"; then - AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])) - fi - elif test "$withval" = "no"; then - apu_have_pgsql=0 - else - old_cppflags="$CPPFLAGS" - old_ldflags="$LDFLAGS" - - pgsql_CPPFLAGS="-I$withval/include" - pgsql_LDFLAGS="-L$withval/lib " - - APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS]) - APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS]) - - AC_MSG_NOTICE(checking for pgsql in $withval) - AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])) - if test "$apu_have_pgsql" != "0"; then - APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib]) - APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include]) - fi - if test "$apu_have_pgsql" != "1"; then - AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])) - if test "$apu_have_pgsql" != "0"; then - APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/postgresql]) - APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib]) - fi - fi - - CPPFLAGS="$old_cppflags" - LDFLAGS="$old_ldflags" - fi - ], [ - apu_have_pgsql=0 - AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])) - ]) - AC_SUBST(apu_have_pgsql) - dnl Since we have already done the AC_CHECK_LIB tests, if we have it, - dnl we know the library is there. - if test "$apu_have_pgsql" = "1"; then - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lpq]) - APR_ADDTO(APRUTIL_LIBS,[-lpq]) - fi -]) -dnl -AC_DEFUN([APU_CHECK_DBD_MYSQL], [ - apu_have_mysql=0 - - AC_CHECK_FILES([dbd/apr_dbd_mysql.c],[ - AC_ARG_WITH([mysql], [ - --with-mysql=DIR **** SEE INSTALL.MySQL **** - ], [ - apu_have_mysql=0 - if test "$withval" = "yes"; then - old_cppflags="$CPPFLAGS" - old_ldflags="$LDFLAGS" - - AC_PATH_PROG([MYSQL_CONFIG],[mysql_config]) - if test "x$MYSQL_CONFIG" != 'x'; then - mysql_CPPFLAGS="`$MYSQL_CONFIG --include`" - mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`" - - APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS]) - APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS]) - fi - - AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1])) - if test "$apu_have_mysql" = "0"; then - AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1])) - else - if test "x$MYSQL_CONFIG" != 'x'; then - APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS]) - APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS]) - fi - fi - - CPPFLAGS="$old_cppflags" - LDFLAGS="$old_ldflags" - elif test "$withval" = "no"; then - apu_have_mysql=0 - else - old_cppflags="$CPPFLAGS" - old_ldflags="$LDFLAGS" - - AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin]) - if test "x$MYSQL_CONFIG" != 'x'; then - mysql_CPPFLAGS="`$MYSQL_CONFIG --include`" - mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`" - else - mysql_CPPFLAGS="-I$withval/include" - mysql_LDFLAGS="-L$withval/lib " - fi - - APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS]) - APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS]) - - AC_MSG_NOTICE(checking for mysql in $withval) - AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1])) - if test "$apu_have_mysql" != "0"; then - APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS]) - APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS]) - fi - - if test "$apu_have_mysql" != "1"; then - AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1])) - if test "$apu_have_mysql" != "0"; then - APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/mysql]) - APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib]) - fi - fi - - CPPFLAGS="$old_cppflags" - LDFLAGS="$old_ldflags" - fi - ], [ - apu_have_mysql=0 - - old_cppflags="$CPPFLAGS" - old_ldflags="$LDFLAGS" - - AC_PATH_PROG([MYSQL_CONFIG],[mysql_config]) - if test "x$MYSQL_CONFIG" != 'x'; then - mysql_CPPFLAGS="`$MYSQL_CONFIG --include`" - mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`" - - APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS]) - APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS]) - fi - - AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1])) - - if test "$apu_have_mysql" != "0"; then - if test "x$MYSQL_CONFIG" != 'x'; then - APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS]) - APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS]) - fi - fi - - CPPFLAGS="$old_cppflags" - LDFLAGS="$old_ldflags" - ]) - ]) - - AC_SUBST(apu_have_mysql) - - dnl Since we have already done the AC_CHECK_LIB tests, if we have it, - dnl we know the library is there. - if test "$apu_have_mysql" = "1"; then - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lmysqlclient_r]) - APR_ADDTO(APRUTIL_LIBS,[-lmysqlclient_r]) - fi -]) -dnl -AC_DEFUN([APU_CHECK_DBD_SQLITE3], [ - apu_have_sqlite3=0 - - AC_ARG_WITH([sqlite3], [ - --with-sqlite3=DIR - ], [ - apu_have_sqlite3=0 - if test "$withval" = "yes"; then - AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1])) - elif test "$withval" = "no"; then - apu_have_sqlite3=0 - else - old_cppflags="$CPPFLAGS" - old_ldflags="$LDFLAGS" - - sqlite3_CPPFLAGS="-I$withval/include" - sqlite3_LDFLAGS="-L$withval/lib " - - APR_ADDTO(CPPFLAGS, [$sqlite3_CPPFLAGS]) - APR_ADDTO(LDFLAGS, [$sqlite3_LDFLAGS]) - - AC_MSG_NOTICE(checking for sqlite3 in $withval) - AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1])) - if test "$apu_have_sqlite3" != "0"; then - APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib]) - APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include]) - fi - - CPPFLAGS="$old_cppflags" - LDFLAGS="$old_ldflags" - fi - ], [ - apu_have_sqlite3=0 - AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1])) - ]) - - AC_SUBST(apu_have_sqlite3) - - dnl Since we have already done the AC_CHECK_LIB tests, if we have it, - dnl we know the library is there. - if test "$apu_have_sqlite3" = "1"; then - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lsqlite3]) - APR_ADDTO(APRUTIL_LIBS,[-lsqlite3]) - fi -]) -dnl -AC_DEFUN([APU_CHECK_DBD_SQLITE2], [ - apu_have_sqlite2=0 - - AC_ARG_WITH([sqlite2], [ - --with-sqlite2=DIR - ], [ - apu_have_sqlite2=0 - if test "$withval" = "yes"; then - AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1])) - elif test "$withval" = "no"; then - apu_have_sqlite2=0 - else - old_cppflags="$CPPFLAGS" - old_ldflags="$LDFLAGS" - - sqlite2_CPPFLAGS="-I$withval/include" - sqlite2_LDFLAGS="-L$withval/lib " - - APR_ADDTO(CPPFLAGS, [$sqlite2_CPPFLAGS]) - APR_ADDTO(LDFLAGS, [$sqlite2_LDFLAGS]) - - AC_MSG_NOTICE(checking for sqlite2 in $withval) - AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1])) - if test "$apu_have_sqlite2" != "0"; then - APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib]) - APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include]) - fi - - CPPFLAGS="$old_cppflags" - LDFLAGS="$old_ldflags" - fi - ], [ - apu_have_sqlite2=0 - AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1])) - ]) - - AC_SUBST(apu_have_sqlite2) - - dnl Since we have already done the AC_CHECK_LIB tests, if we have it, - dnl we know the library is there. - if test "$apu_have_sqlite2" = "1"; then - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lsqlite]) - APR_ADDTO(APRUTIL_LIBS,[-lsqlite]) - fi -]) -dnl - diff --git a/libs/apr-util/build/dbm.m4 b/libs/apr-util/build/dbm.m4 deleted file mode 100644 index 39a6252d71..0000000000 --- a/libs/apr-util/build/dbm.m4 +++ /dev/null @@ -1,870 +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 DBM module -dnl - -dnl APU_LIB_BERKELEY_DB(major, minor, patch, places, headers, libnames) -dnl -dnl Search for a useable version of Berkeley DB in a number of -dnl common places. The installed DB must be no older than the -dnl version given by MAJOR, MINOR, and PATCH. All of these -dnl arguments are allowed to be '-1', indicating we don't care. -dnl PLACES is a list of places to search for a Berkeley DB -dnl installation. HEADERS is a list of headers to try. LIBNAMES -dnl is a list of names of the library to attempt to link against, -dnl typically 'db' and 'db4'. -dnl -dnl If we find a useable version, set CPPFLAGS and LIBS as -dnl appropriate, and set the shell variable `apu_have_db' to -dnl `1', and apu_db_lib to the matching lib name, and apu_db_header -dnl to the header to use. Otherwise, set `apu_have_db' to `0'. -dnl -dnl This macro also checks for the `--with-berkeley-db=PATH' flag; -dnl if given, the macro will use the PATH specified, and the -dnl configuration script will die if it can't find the library. If -dnl the user gives the `--without-berkeley-db' flag, the entire -dnl search is skipped. -dnl -dnl We cache the results of individual searches under particular -dnl prefixes, not the overall result of whether we found Berkeley -dnl DB. That way, the user can re-run the configure script with -dnl different --with-berkeley-db switch values, without interference -dnl from the cache. - - -AC_DEFUN([APU_CHECK_BERKELEY_DB], [ - bdb_version=$1 - if test "$2" != "-1"; then - bdb_version="$bdb_version.$2" - if test "$3" != "-1"; then - bdb_version="$bdb_version.$3" - fi - fi - bdb_places=$4 - bdb_default_search_headers=$5 - bdb_default_search_lib_names=$6 - - apu_have_db=0 - - # Save the original values of the flags we tweak. - apu_check_lib_save_libs="$LIBS" - apu_check_lib_save_ldflags="$LDFLAGS" - apu_check_lib_save_cppflags="$CPPFLAGS" - - # The variable `found' is the prefix under which we've found - # Berkeley DB, or `not' if we haven't found it anywhere yet. - found=not - for bdb_place in $bdb_places; do - - LDFLAGS="$apu_check_lib_save_ldflags" - CPPFLAGS="$apu_check_lib_save_cppflags" - case "$bdb_place" in - "std" ) - description="the standard places" - ;; - *":"* ) - header="`echo $bdb_place | sed -e 's/:.*$//'`" - lib="`echo $bdb_place | sed -e 's/^.*://'`" - CPPFLAGS="$CPPFLAGS -I$header" - LDFLAGS="$LDFLAGS -L$lib" - description="$header and $lib" - ;; - * ) - if test -d $bdb_place; then - LDFLAGS="$LDFLAGS -L$bdb_place/lib" - CPPFLAGS="$CPPFLAGS -I$bdb_place/include" - else - AC_MSG_CHECKING([for Berkeley DB $bdb_version in $bdb_place]) - AC_MSG_RESULT([directory not found]) - continue - fi - description="$bdb_place" - ;; - esac - - # Since there is no AC_MSG_NOTICE in autoconf 2.13, we use this - # trick to display a message instead. - AC_MSG_CHECKING([for Berkeley DB $bdb_version in $description]) - AC_MSG_RESULT() - - for bdb_libname in $bdb_default_search_lib_names; do - for bdb_header in $bdb_default_search_headers; do - # Clear the header cache variable for each location - changequote(,) - cache_id="`echo ac_cv_header_${bdb_header} \ - | sed -e 's/[^a-zA-Z0-9_]/_/g'`" - changequote([,]) - unset $cache_id - AC_CHECK_HEADER([$bdb_header], [ - if test "$1" = "3" -o "$1" = "4"; then - # We generate a separate cache variable for each prefix and libname - # we search under. That way, we avoid caching information that - # changes if the user runs `configure' with a different set of - # switches. - changequote(,) - cache_id="`echo apu_cv_check_berkeley_db_$1_$2_$3_${bdb_header}_${bdb_libname}_in_${bdb_place} \ - | sed -e 's/[^a-zA-Z0-9_]/_/g'`" - changequote([,]) - - AC_MSG_CHECKING([for -l$bdb_libname]) - dnl We can't use AC_CACHE_CHECK here, because that won't print out - dnl the value of the computed cache variable properly. - AC_CACHE_VAL($cache_id, - [ - APU_TRY_BERKELEY_DB($1, $2, $3, $bdb_header, $bdb_libname) - eval "$cache_id=$apu_try_berkeley_db" - ]) - result="`eval echo '$'$cache_id`" - AC_MSG_RESULT($result) - elif test "$1" = "1"; then - AC_CHECK_LIB($bdb_libname, - dbopen, - [result=yes], - [result=no] - ) - elif test "$1" = "2"; then - AC_CHECK_LIB($bdb_libname, - db_open, - [result=yes], - [result=no] - ) - fi - ], [result="no"]) - - # If we found it, no need to search any more. - if test "$result" = "yes"; then - found="$bdb_place" - break - fi - done - test "$found" != "not" && break - done - test "$found" != "not" && break - done - - # Restore the original values of the flags we tweak. - LDFLAGS="$apu_check_lib_save_ldflags" - CPPFLAGS="$apu_check_lib_save_cppflags" - - case "$found" in - "not") - apu_have_db=0 - ;; - "std") - apu_db_header=$bdb_header - apu_db_lib=$bdb_libname - apu_have_db=1 - ;; - *":"*) - header="`echo $found | sed -e 's/:.*$//'`" - lib="`echo $found | sed -e 's/^.*://'`" - - APR_ADDTO(APRUTIL_INCLUDES, [-I$header]) - APR_ADDTO(APRUTIL_LDFLAGS, [-L$lib]) - apu_db_header=$bdb_header - apu_db_lib=$bdb_libname - apu_have_db=1 - ;; - *) - APR_ADDTO(APRUTIL_INCLUDES, [-I$found/include]) - APR_ADDTO(APRUTIL_LDFLAGS, [-L$found/lib]) - apu_db_header=$bdb_header - apu_db_lib=$bdb_libname - apu_have_db=1 - ;; - esac -]) - - -dnl APU_TRY_BERKELEY_DB(major, minor, patch, header, libname) -dnl -dnl A subroutine of APU_CHECK_BERKELEY_DB. -dnl -dnl Check that a new-enough version of Berkeley DB is installed. -dnl "New enough" means no older than the version given by MAJOR, -dnl MINOR, and PATCH. The result of the test is not cached; no -dnl messages are printed. Use HEADER as the header file to include. -dnl Use LIBNAME as the library to link against. -dnl (e.g. LIBNAME should usually be "db" or "db4".) -dnl -dnl Set the shell variable `apu_try_berkeley_db' to `yes' if we found -dnl an appropriate version installed, or `no' otherwise. -dnl -dnl This macro uses the Berkeley DB library function `db_version' to -dnl find the version. If the library installed doesn't have this -dnl function, then this macro assumes it is too old. - -dnl NOTE: This is pretty messed up. It seems that the FreeBSD port of -dnl Berkeley DB 4 puts the header file in /usr/local/include/db4, but the -dnl database library in /usr/local/lib, as libdb4.[a|so]. There is no -dnl /usr/local/include/db.h. So if you check for /usr/local first, you'll -dnl get the old header file from /usr/include, and the new library from -dnl /usr/local/lib. Disaster. Thus this test compares the version constants -dnl in the db.h header with the ones returned by db_version(). - - -AC_DEFUN([APU_TRY_BERKELEY_DB], - [ - apu_try_berkeley_db_save_libs="$LIBS" - - apu_check_berkeley_db_major=$1 - apu_check_berkeley_db_minor=$2 - apu_check_berkeley_db_patch=$3 - apu_try_berkeley_db_header=$4 - apu_try_berkeley_db_libname=$5 - - LIBS="$LIBS -l$apu_try_berkeley_db_libname" - AC_TRY_RUN( - [ -#include <stdio.h> -#include <$apu_try_berkeley_db_header> -main () -{ - int major, minor, patch; - - db_version(&major, &minor, &patch); - - /* Sanity check: ensure that db.h constants actually match the db library */ - if (major != DB_VERSION_MAJOR - || minor != DB_VERSION_MINOR - || patch != DB_VERSION_PATCH) - exit (1); - - /* Run-time check: ensure the library claims to be the correct version. */ - - if ($apu_check_berkeley_db_major != -1) { - if (major < $apu_check_berkeley_db_major) - exit (1); - if (major > $apu_check_berkeley_db_major) - exit (0); - } - - if ($apu_check_berkeley_db_minor != -1) { - if (minor < $apu_check_berkeley_db_minor) - exit (1); - if (minor > $apu_check_berkeley_db_minor) - exit (0); - } - - if ($apu_check_berkeley_db_patch == -1 - || patch >= $apu_check_berkeley_db_patch) - exit (0); - else - exit (1); -} - ], - [apu_try_berkeley_db=yes], - [apu_try_berkeley_db=no], - [apu_try_berkeley_db=yes] - ) - - LIBS="$apu_try_berkeley_db_save_libs" - ] -) - - -dnl -dnl APU_CHECK_DB1: is DB1 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB1], [ - places=$1 - if test -z "$places"; then - places="std" - fi - APU_CHECK_BERKELEY_DB(1, 0, 0, - "$places", - "db1/db.h db.h", - "db1" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=1 - fi -]) - - -dnl -dnl APU_CHECK_DB185: is DB1.85 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -dnl NB: BerkelyDB v2 and above can be compiled in 1.85 mode -dnl which has a libdb not libdb1 or libdb185 -AC_DEFUN([APU_CHECK_DB185], [ - places=$1 - if test -z "$places"; then - places="std" - fi - APU_CHECK_BERKELEY_DB(1, -1, -1, - "$places", - "db_185.h", - "db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=185 - fi -]) - - -dnl -dnl APU_CHECK_DB2: is DB2 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB2], [ - places=$1 - if test -z "$places"; then - places="std" - fi - APU_CHECK_BERKELEY_DB(2, -1, -1, - "$places", - "db2/db.h db.h", - "db2 db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=2 - fi -]) - - -dnl -dnl APU_CHECK_DB3: is DB3 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB3], [ - places=$1 - if test -z "$places"; then - places="std" - fi - APU_CHECK_BERKELEY_DB(3, -1, -1, - "$places", - "db3/db.h db.h", - "db3 db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=3 - fi -]) - - -dnl -dnl APU_CHECK_DB4: is DB4 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB4], [ - places=$1 - if test -z "$places"; then - places="std /usr/local /usr/local/BerkeleyDB.4.0 /boot/home/config" - fi - APU_CHECK_BERKELEY_DB("4", "0", "-1", - "$places", - "db4/db.h db.h", - "db-4.0 db4 db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=4 - fi -]) - - -dnl -dnl APU_CHECK_DB41: is DB4.1 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB41], [ - places=$1 - if test -z "$places"; then - places="std /usr/local /usr/local/BerkeleyDB.4.1 /boot/home/config" - fi - APU_CHECK_BERKELEY_DB("4", "1", "-1", - "$places", - "db41/db.h db4/db.h db.h", - "db-4.1 db41 db4 db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=4 - fi -]) - - -dnl -dnl APU_CHECK_DB42: is DB4.2 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB42], [ - places=$1 - if test -z "$places"; then - places="std /usr/local /usr/local/BerkeleyDB.4.2 /boot/home/config" - fi - APU_CHECK_BERKELEY_DB("4", "2", "-1", - "$places", - "db42/db.h db4/db.h db.h", - "db-4.2 db42 db4 db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=4 - fi -]) -dnl -dnl APU_CHECK_DB43: is DB4.3 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB43], [ - places=$1 - if test -z "$places"; then - places="std /usr/local/BerkeleyDB.4.3 /boot/home/config" - fi - APU_CHECK_BERKELEY_DB("4", "3", "-1", - "$places", - "db43/db.h db4/db.h db.h", - "db-4.3 db4-4.3 db43 db4 db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=4 - fi -]) -dnl -dnl APU_CHECK_DB44: is DB4.4 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB44], [ - places=$1 - if test -z "$places"; then - places="std /usr/local/BerkeleyDB.4.4 /boot/home/config" - fi - APU_CHECK_BERKELEY_DB("4", "4", "-1", - "$places", - "db44/db.h db4/db.h db.h", - "db-4.4 db4-4.4 db44 db4 db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=4 - fi -]) -dnl -dnl APU_CHECK_DB45: is DB4.5 present? -dnl -dnl if present: sets apu_db_header, apu_db_lib, and apu_db_version -dnl -AC_DEFUN([APU_CHECK_DB45], [ - places=$1 - if test -z "$places"; then - places="std /usr/local/BerkeleyDB.4.5 /boot/home/config" - fi - APU_CHECK_BERKELEY_DB("4", "5", "-1", - "$places", - "db45/db.h db4/db.h db.h", - "db-4.5 db4-4.5 db45 db4 db" - ) - if test "$apu_have_db" = "1"; then - apu_db_version=4 - fi -]) - -AC_DEFUN([APU_CHECK_DB], [ - requested=$1 - check_places=$2 - - case "$requested" in - db) - APU_CHECK_DB_ALL("$check_places") - if test "$apu_have_db" = "0"; then - AC_MSG_ERROR(Berkeley db requested, but not found) - fi - ;; - db1) - APU_CHECK_DB1("$check_places") - if test "$apu_db_version" != "1"; then - AC_MSG_ERROR(Berkeley db1 not found) - fi - ;; - db185) - APU_CHECK_DB185("$check_places") - if test "$apu_db_version" != "185"; then - AC_MSG_ERROR(Berkeley db185 not found) - fi - ;; - db2) - APU_CHECK_DB2("$check_places") - if test "$apu_db_version" != "2"; then - AC_MSG_ERROR(Berkeley db2 not found) - fi - ;; - db3) - APU_CHECK_DB3("$check_places") - if test "$apu_db_version" != "3"; then - AC_MSG_ERROR(Berkeley db3 not found) - fi - ;; - db4) - APU_CHECK_DB4("$check_places") - if test "$apu_db_version" != "4"; then - AC_MSG_ERROR(Berkeley db4 not found) - fi - ;; - db41) - APU_CHECK_DB41("$check_places") - if test "$apu_db_version" != "4"; then - AC_MSG_ERROR(Berkeley db4 not found) - fi - ;; - db42) - APU_CHECK_DB42("$check_places") - if test "$apu_db_version" != "4"; then - AC_MSG_ERROR(Berkeley db4 not found) - fi - ;; - db43) - APU_CHECK_DB43("$check_places") - if test "$apu_db_version" != "4"; then - AC_MSG_ERROR(Berkeley db4 not found) - fi - ;; - db44) - APU_CHECK_DB44("$check_places") - if test "$apu_db_version" != "4"; then - AC_MSG_ERROR(Berkeley db4 not found) - fi - ;; - db45) - APU_CHECK_DB44("$check_places") - if test "$apu_db_version" != "4"; then - AC_MSG_ERROR(Berkeley db4 not found) - fi - ;; - default) - APU_CHECK_DB_ALL("$check_places") - ;; - esac -]) - -dnl -dnl APU_CHECK_DB_ALL: Try all Berkeley DB versions, from 4.3 to 1. -dnl -AC_DEFUN([APU_CHECK_DB_ALL], [ - all_places=$1 - - APU_CHECK_DB45("$all_places") - if test "$apu_db_version" != "4"; then - APU_CHECK_DB44("$all_places") - if test "$apu_db_version" != "4"; then - APU_CHECK_DB43("$all_places") - if test "$apu_db_version" != "4"; then - APU_CHECK_DB42("$all_places") - if test "$apu_db_version" != "4"; then - APU_CHECK_DB41("$all_places") - if test "$apu_db_version" != "4"; then - APU_CHECK_DB4("$all_places") - if test "$apu_db_version" != "4"; then - APU_CHECK_DB3("$all_places") - if test "$apu_db_version" != "3"; then - APU_CHECK_DB2("$all_places") - if test "$apu_db_version" != "2"; then - APU_CHECK_DB1("$all_places") - if test "$apu_db_version" != "1"; then - APU_CHECK_DB185("$all_places") - fi - fi - fi - fi - fi - fi - fi - fi - fi - AC_MSG_CHECKING(for Berkeley DB) - if test "$apu_have_db" = "1"; then - AC_MSG_RESULT(found db$apu_db_version) - else - AC_MSG_RESULT(not found) - fi -]) - - -dnl -dnl APU_CHECK_DBM: see what kind of DBM backend to use for apr_dbm. -dnl -AC_DEFUN([APU_CHECK_DBM], [ - apu_use_sdbm=0 - apu_use_ndbm=0 - apu_use_gdbm=0 - apu_use_db=0 - dnl it's in our codebase - apu_have_sdbm=1 - apu_have_gdbm=0 - apu_have_ndbm=0 - apu_have_db=0 - - apu_db_header=db.h # default so apu_select_dbm.h is syntactically correct - apu_db_version=0 - - AC_ARG_WITH(dbm, [ - --with-dbm=DBM choose the DBM type to use. - DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db41,db42,db43,db44,db45} - ], [ - if test "$withval" = "yes"; then - AC_MSG_ERROR([--with-dbm needs to specify a DBM type to use. - One of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44, db45]) - fi - requested="$withval" - ], [ - requested=default - ]) - - dnl We don't pull in GDBM unless the user asks for it, since it's GPL - AC_ARG_WITH([gdbm], [ - --with-gdbm=DIR specify GDBM location - ], [ - apu_have_gdbm=0 - if test "$withval" = "yes"; then - AC_CHECK_HEADER(gdbm.h, AC_CHECK_LIB(gdbm, gdbm_open, [apu_have_gdbm=1])) - elif test "$withval" = "no"; then - apu_have_gdbm=0 - else - CPPFLAGS="-I$withval/include" - LIBS="-L$withval/lib " - - AC_MSG_CHECKING(checking for gdbm in $withval) - AC_CHECK_HEADER(gdbm.h, AC_CHECK_LIB(gdbm, gdbm_open, [apu_have_gdbm=1])) - if test "$apu_have_gdbm" != "0"; then - APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib]) - APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include]) - fi - fi - ]) - - AC_ARG_WITH([ndbm], [ - --with-ndbm=PATH - Find the NDBM header and library in \`PATH/include' and - \`PATH/lib'. If PATH is of the form \`HEADER:LIB', then search - for header files in HEADER, and the library in LIB. If you omit - the \`=PATH' part completely, the configure script will search - for NDBM in a number of standard places. - ], [ - apu_have_ndbm=0 - if test "$withval" = "yes"; then - AC_MSG_CHECKING(checking for ndbm in the usual places) - apu_want_ndbm=1 - NDBM_INC="" - NDBM_LDFLAGS="" - elif test "$withval" = "no"; then - apu_want_ndbm=0 - else - apu_want_ndbm=1 - case "$withval" in - *":"*) - NDBM_INC="-I`echo $withval |sed -e 's/:.*$//'`" - NDBM_LDFLAGS="-L`echo $withval |sed -e 's/^.*://'`" - AC_MSG_CHECKING(checking for ndbm includes with $NDBM_INC libs with $NDBM_LDFLAGS ) - ;; - *) - NDBM_INC="-I$withval/include" - NDBM_LDFLAGS="-L$withval/lib" - AC_MSG_CHECKING(checking for ndbm includes in $withval) - ;; - esac - fi - - save_cppflags="$CPPFLAGS" - save_ldflags="$LDFLAGS" - CPPFLAGS="$CPPFLAGS $NDBM_INC" - LDFLAGS="$LDFLAGS $NDBM_LDFLAGS" - dnl db_ndbm_open is what sleepcat's compatibility library actually has in it's lib - if test "$apu_want_ndbm" != "0"; then - AC_CHECK_HEADER(ndbm.h, - AC_CHECK_LIB(c, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=c], - AC_CHECK_LIB(dbm, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=dbm], - AC_CHECK_LIB(db, dbm_open, [apu_have_ndbm=1;apu_ndbm_lib=db], - AC_CHECK_LIB(db, __db_ndbm_open, [apu_have_ndbm=1;apu_ndbm_lib=db]) - ) - ) - ) - ) - if test "$apu_have_ndbm" != "0"; then - if test "$withval" != "yes"; then - APR_ADDTO(APRUTIL_INCLUDES, [$NDBM_INC]) - APR_ADDTO(APRUTIL_LDFLAGS, [$NDBM_LDFLAGS]) - fi - elif test "$withval" != "yes"; then - AC_ERROR( NDBM not found in the specified directory) - fi - fi - CPPFLAGS="$save_cppflags" - LDFLAGS="$save_ldflags" - ], [ - dnl don't check it no one has asked us for it - apu_have_ndbm=0 - ]) - - - if test -n "$apu_db_xtra_libs"; then - saveddbxtralibs="$LIBS" - LIBS="$apu_db_xtra_libs $LIBS" - fi - - dnl We're going to try to find the highest version of Berkeley DB supported. - dnl - dnl Note that we only do this if the user requested it, since the Sleepycat - dnl license is viral and requires distribution of source along with programs - dnl that use it. - AC_ARG_WITH([berkeley-db], [ - --with-berkeley-db=PATH - Find the Berkeley DB header and library in \`PATH/include' and - \`PATH/lib'. If PATH is of the form \`HEADER:LIB', then search - for header files in HEADER, and the library in LIB. If you omit - the \`=PATH' part completely, the configure script will search - for Berkeley DB in a number of standard places. - ], [ - if test "$withval" = "yes"; then - apu_want_db=1 - user_places="" - elif test "$withval" = "no"; then - apu_want_db=0 - else - apu_want_db=1 - user_places="$withval" - fi - - if test "$apu_want_db" != "0"; then - APU_CHECK_DB($requested, $user_places) - if test "$apu_have_db" = "0"; then - AC_ERROR(Berkeley DB not found.) - fi - fi - ]) - - if test -n "$apu_db_xtra_libs"; then - LIBS="$saveddbxtralibs" - fi - - case "$requested" in - sdbm) - apu_use_sdbm=1 - apu_default_dbm=sdbm - ;; - gdbm) - apu_use_gdbm=1 - apu_default_dbm=gdbm - ;; - ndbm) - apu_use_ndbm=1 - apu_default_dbm=ndbm - ;; - db) - apu_use_db=1 - apu_default_dbm=db - ;; - db1) - apu_use_db=1 - apu_default_dbm=db1 - ;; - db185) - apu_use_db=1 - apu_default_dbm=db185 - ;; - db2) - apu_use_db=1 - apu_default_dbm=db2 - ;; - db3) - apu_use_db=1 - apu_default_dbm=db3 - ;; - db4) - apu_use_db=1 - apu_default_dbm=db4 - ;; - db41) - apu_use_db=1 - apu_default_dbm=db4 - ;; - db42) - apu_use_db=1 - apu_default_dbm=db4 - ;; - db43) - apu_use_db=1 - apu_default_dbm=db4 - ;; - db44) - apu_use_db=1 - apu_default_dbm=db4 - ;; - db45) - apu_use_db=1 - apu_default_dbm=db4 - ;; - default) - dnl ### use more sophisticated DBMs for the default? - apu_default_dbm="sdbm (default)" - apu_use_sdbm=1 - ;; - *) - AC_MSG_ERROR([--with-dbm=$look_for is an unknown DBM type. - Use one of: sdbm, gdbm, ndbm, db, db1, db185, db2, db3, db4, db41, db42, db43, db44 db45]) - ;; - esac - - dnl Yes, it'd be nice if we could collate the output in an order - dnl so that the AC_MSG_CHECKING would be output before the actual - dnl checks, but it isn't happening now. - AC_MSG_CHECKING(for default DBM) - AC_MSG_RESULT($apu_default_dbm) - - AC_SUBST(apu_use_sdbm) - AC_SUBST(apu_use_gdbm) - AC_SUBST(apu_use_ndbm) - AC_SUBST(apu_use_db) - - AC_SUBST(apu_have_sdbm) - AC_SUBST(apu_have_gdbm) - AC_SUBST(apu_have_ndbm) - AC_SUBST(apu_have_db) - AC_SUBST(apu_db_header) - AC_SUBST(apu_db_version) - - dnl Since we have already done the AC_CHECK_LIB tests, if we have it, - dnl we know the library is there. - if test "$apu_have_gdbm" = "1"; then - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lgdbm]) - APR_ADDTO(APRUTIL_LIBS,[-lgdbm]) - fi - - if test "$apu_have_ndbm" = "1"; then - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l$apu_ndbm_lib]) - APR_ADDTO(APRUTIL_LIBS,[-l$apu_ndbm_lib]) - fi - - if test "$apu_have_db" = "1"; then - APR_ADDTO(APRUTIL_EXPORT_LIBS,[-l$apu_db_lib]) - APR_ADDTO(APRUTIL_LIBS,[-l$apu_db_lib]) - if test -n "apu_db_xtra_libs"; then - APR_ADDTO(APRUTIL_EXPORT_LIBS,[$apu_db_xtra_libs]) - APR_ADDTO(APRUTIL_LIBS,[$apu_db_xtra_libs]) - fi - fi -]) - diff --git a/libs/apr-util/build/find_apu.m4 b/libs/apr-util/build/find_apu.m4 deleted file mode 100644 index e29bc60923..0000000000 --- a/libs/apr-util/build/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/apr-util/build/mkdir.sh b/libs/apr-util/build/mkdir.sh deleted file mode 100755 index b947c92606..0000000000 --- a/libs/apr-util/build/mkdir.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -## -## mkdir.sh -- make directory hierarchy -## -## Based on `mkinstalldirs' from Noah Friedman <friedman@prep.ai.mit.edu> -## as of 1994-03-25, which was placed in the Public Domain. -## Cleaned up for Apache's Autoconf-style Interface (APACI) -## by Ralf S. Engelschall <rse@apache.org> -## -# -# This script falls under the Apache License. -# See http://www.apache.org/docs/LICENSE - - -umask 022 -errstatus=0 -for file in ${1+"$@"} ; do - set fnord `echo ":$file" |\ - sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'` - shift - pathcomp= - for d in ${1+"$@"}; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - ?: ) pathcomp="$pathcomp/" - continue ;; - esac - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? - fi - pathcomp="$pathcomp/" - done -done -exit $errstatus - diff --git a/libs/apr-util/build/pkg/README b/libs/apr-util/build/pkg/README deleted file mode 100644 index d7e61a762c..0000000000 --- a/libs/apr-util/build/pkg/README +++ /dev/null @@ -1,20 +0,0 @@ -The script in this directory will attempt to build a Solaris package -out of a source tree for APR-util. - -To build a package, make sure you are in the root of the source tree, -and run: - -build/pkg/buildpkg.sh - -A Solaris package called apr-util-<version>-<architecture>-local.gz will be -created in the root of the source tree. - -By default, if you attempt to build packages for apr-util, it will -search for the sources for apr in: - -../apr - -You may override the location of apr like so: - -build/pkg/buildpkg.sh --with-apr=some/other/path - diff --git a/libs/apr-util/build/pkg/buildpkg.sh b/libs/apr-util/build/pkg/buildpkg.sh deleted file mode 100755 index ae9d00b321..0000000000 --- a/libs/apr-util/build/pkg/buildpkg.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh -# 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. -# -# - -# buildpkg.sh: This script builds a Solaris PKG from the source tree -# provided. - -PREFIX=/usr/local -TEMPDIR=/var/tmp/$USER/apr-util-root -rm -rf $TEMPDIR - -apr_util_src_dir=. -apr_src_dir=../apr -expat_dir=/usr - -while test $# -gt 0 -do - # Normalize - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case "$1" in - --with-apr=*) - apr_src_dir=$optarg - ;; - esac - - case "$1" in - --with-apr-util=*) - apr_util_src_dir=$optarg - ;; - esac - - case "$1" in - --with-expat=*) - expat_dir=$optarg - ;; - esac - - shift -done - -if [ -f "$apr_util_src_dir/configure.ac" ]; then - cd $apr_util_src_dir -else - echo "The apr-util source could not be found within $apr_util_src_dir" - echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]" - exit 1 -fi - -if [ ! -f "$apr_src_dir/configure.ac" ]; then - echo "The apr source could not be found within $apr_src_dir" - echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]" - exit 1 -fi - -if [ ! -d "$expat_dir" ]; then - echo "The expat directory could not be found within $expat_dir" - echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]" - exit 1 -fi - -./configure --prefix=$PREFIX --with-apr=$apr_src_dir \ - --with-ldap --with-expat=$expat_dir -make -make install DESTDIR=$TEMPDIR -rm $TEMPDIR$PREFIX/lib/aprutil.exp -. build/pkg/pkginfo -cp build/pkg/pkginfo $TEMPDIR$PREFIX - -current=`pwd` -cd $TEMPDIR$PREFIX -echo "i pkginfo=./pkginfo" > prototype -find . -print | grep -v ./prototype | grep -v ./pkginfo | pkgproto | awk '{print $1" "$2" "$3" "$4" root bin"}' >> prototype -mkdir $TEMPDIR/pkg -pkgmk -r $TEMPDIR$PREFIX -d $TEMPDIR/pkg - -cd $current -pkgtrans -s $TEMPDIR/pkg $current/$NAME-$VERSION-$ARCH-local -gzip $current/$NAME-$VERSION-$ARCH-local - -rm -rf $TEMPDIR - diff --git a/libs/apr-util/build/pkg/pkginfo.in b/libs/apr-util/build/pkg/pkginfo.in deleted file mode 100644 index 1b6359a059..0000000000 --- a/libs/apr-util/build/pkg/pkginfo.in +++ /dev/null @@ -1,11 +0,0 @@ -PKG="ASFapu-1" -NAME="apr-util" -ARCH="@target_cpu@" -VERSION="@APRUTIL_DOTTED_VERSION@" -CATEGORY="application" -VENDOR="Apache Software Foundation" -EMAIL="dev@apr.apache.org" -PSTAMP="dev@apr.apache.org" -BASEDIR="@prefix@" -CLASSES="none" - diff --git a/libs/apr-util/build/rpm/apr-util.spec.in b/libs/apr-util/build/rpm/apr-util.spec.in deleted file mode 100644 index b7157682ca..0000000000 --- a/libs/apr-util/build/rpm/apr-util.spec.in +++ /dev/null @@ -1,89 +0,0 @@ - -%define apuver 1 - -Summary: Apache Portable Runtime Utility library -Name: apr-util -Version: APU_VERSION -Release: APU_RELEASE -License: Apache Software License -Group: System Environment/Libraries -URL: http://apr.apache.org/ -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildPrereq: autoconf, libtool, doxygen, apr-devel >= 0:{version}-{release} -BuildPrereq: openldap-devel, db4-devel, expat-devel -Conflicts: subversion < 0.20.1-2 - -%description -The mission of the Apache Portable Runtime (APR) is to provide a -free library of C data structures and routines. This library -contains additional utility interfaces for APR; including support -for XML, LDAP, database interfaces, URI parsing and more. - -%package devel -Group: Development/Libraries -Summary: APR utility library development kit -Requires: apr-util = %{version}-%{release}, apr-devel -Requires: openldap-devel, db4-devel, expat-devel -Conflicts: subversion-devel < 0.20.1-2 - -%description devel -This package provides the support files which can be used to -build applications using the APR utility library. The mission -of the Apache Portable Runtime (APR) is to provide a free -library of C data structures and routines. - -%prep -%setup -q - -%build -%configure --with-apr=%{_prefix} \ - --includedir=%{_includedir}/apr-%{apuver} \ - --with-ldap --without-gdbm -make %{?_smp_mflags} && make dox - -%check -# Run non-interactive tests -pushd test -make %{?_smp_mflags} testall CFLAGS=-fno-strict-aliasing -./testall -v || exit 1 -popd - -%install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT - -# Documentation -mv docs/dox/html html - -# Unpackaged files -rm -f $RPM_BUILD_ROOT%{_libdir}/aprutil.exp - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root,-) -%doc CHANGES LICENSE NOTICE -%{_libdir}/libaprutil-%{apuver}.so.* - -%files devel -%defattr(-,root,root,-) -%{_bindir}/apu-%{apuver}-config -%{_libdir}/libaprutil-%{apuver}.*a -%{_libdir}/libaprutil-%{apuver}.so -%{_libdir}/pkgconfig/apr-util-%{apuver}.pc -%{_includedir}/apr-%{apuver}/*.h -%doc --parents html - -%changelog -* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1 -- update to support v1.0.0 of APR - -* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1 -- derived from Fedora Core apr.spec - diff --git a/libs/apr-util/build/w32locatedb.pl b/libs/apr-util/build/w32locatedb.pl deleted file mode 100644 index 121dbf857f..0000000000 --- a/libs/apr-util/build/w32locatedb.pl +++ /dev/null @@ -1,217 +0,0 @@ -#! perl -w -# -# w32locatedb.pl -- Build apr-util with Berkeley DB on Win32 -# -# Usage: perl w32locatedb.pl <type> <incdir> <libdir> -# type: Library type to link with ('lib' or 'dll') -# incdir: BDB includes directory (for db.h) -# libdir: Library directory (for libdbXY[s][d].lib) -# -# This script falls under the Apache License. -# See http://www.apache.org/docs/LICENSE - -require 5.008; -use strict; -use File::Spec::Functions qw(canonpath rel2abs - splitpath catpath splitdir catdir); - -######## -# Subroutine prototypes -sub usage(); -sub find_srcdir(); -sub get_lib_name($$); -sub edit_header($$); -sub edit_project($$); - -######## -# Parse program arguments and set globals -die usage() unless scalar @ARGV >= 3; - -my $type = lc($ARGV[0]); -die "Invalid library type '$type'\n" - unless $type eq 'lib' or $type eq 'dll'; - -my $incdir = $ARGV[1]; -die "No 'db.h' in $incdir\n" unless -f "$incdir/db.h"; - -my $libdir = $ARGV[2]; -die "$libdir: $!" unless -d $libdir; - -my $libname = get_lib_name($type, $incdir); -die "No '$libname.lib' in $libdir" unless -f "$libdir/$libname.lib"; -die "No '${libname}d.lib' in $libdir" unless -f "$libdir/${libname}d.lib"; - -my $srcdir = find_srcdir(); -my $apu_hw = canonpath("$srcdir/include/apu.hw"); -my $apu_want_hw = canonpath("$srcdir/include/apu_want.hw"); -my $apu_select_dbm_hw = canonpath("$srcdir/include/private/apu_select_dbm.hw"); -my $aprutil_dsp = canonpath("$srcdir/aprutil.dsp"); -my $libaprutil_dsp = canonpath("$srcdir/libaprutil.dsp"); -die "Can't find $apu_hw" unless -f $apu_hw; -die "Can't find $apu_want_hw" unless -f $apu_want_hw; -die "Can't find $apu_select_dbm_hw" unless -f $apu_select_dbm_hw; -die "Can't find $aprutil_dsp" unless -f $aprutil_dsp; -die "Can't find $libaprutil_dsp" unless -f $libaprutil_dsp; - - -######## -# Edit the header file templates -my $db_h = rel2abs(canonpath("$incdir/db.h")); -$db_h =~ s/\\/\//g; -edit_header($apu_hw, - [['^\s*\#\s*define\s+APU_HAVE_DB\s+0\s*$', - '#define APU_HAVE_DB 1']]); -edit_header($apu_want_hw, - [['^\s*\#\s*include\s+\<db\.h\>\s*$', - "#include \"$db_h\""]]); -edit_header($apu_select_dbm_hw, - [['^\s*\#\s*define\s+APU_USE_DB\s+0\s*$', - '#define APU_USE_DB 1'], - ['^\s*\#\s*include\s+\<db\.h\>\s*$', - "#include \"$db_h\""]]); - -######## -# Edit the .dsp files -my $libpath = rel2abs(canonpath("$libdir/$libname")); -edit_project($aprutil_dsp, $libpath); -edit_project($libaprutil_dsp, $libpath); - - -######## -# Print usage -sub usage() -{ - return ("Usage: perl w32locatedb.pl <type> <incdir> <libdir>\n" - . " type: Library type to link with ('lib' or 'dll')\n" - . " incdir: BDB includes directory (for db.h)\n" - . " libdir: Library directory (for libdbXY[s][d].lib)\n"); -} - -######## -# Calculate the (possibly relative) path to the top of the apr-util -# source dir. -sub find_srcdir() -{ - my $srcdir = rel2abs(canonpath($0)); - my ($vol, $dir, $file) = splitpath($srcdir); - my @dirs = splitdir($dir); - die if scalar @dirs < 1; - do { $_ = pop @dirs } while ($_ eq ''); - return catpath($vol, catdir(@dirs), ''); -} - -######## -# Construct the name of the BDB library, based on the type and -# version information in db.h -sub get_lib_name($$) -{ - my ($type, $incdir) = @_; - my $major = undef; - my $minor = undef; - my $patch = undef; - - open(DBH, "< $incdir/db.h") - or die "Can't open $incdir/db.h: $!"; - while (<DBH>) { - chomp; - m/^\s*\#\s*define\s+DB_VERSION_(MAJOR|MINOR|PATCH)\s+(\d+)\s*$/; - next unless defined $1 and defined $2; - if ($1 eq 'MAJOR') { $major = $2; } - elsif ($1 eq 'MINOR') { $minor = $2; } - elsif ($1 eq 'PATCH') { $patch = $2; } - last if defined $major and defined $minor and defined $patch; - } - close(DBH); - die "Can't determine BDB version\n" - unless defined $major and defined $minor and defined $patch; - - print "Using BDB version $major.$minor.$patch\n"; - - my $libname = "libdb$major$minor"; - $libname .= 's' if $type eq 'lib'; - return $libname; -} - -######## -# Replace a file, keeping a backup copy -sub maybe_rename_with_backup($$$) -{ - my ($tmpfile, $file, $maybe) = @_; - if ($maybe) { - # Make the file writable by the owner. On Windows, this removes - # any read-only bits. - chmod((stat($file))[2] | 0600, $file); - rename($file, "${file}~"); - rename($tmpfile, $file); - } else { - print "No changes in $file\n"; - unlink($tmpfile); - } -} - -######## -# Edit a header template in-place. -sub edit_header($$) -{ - my ($file, $pairs) = @_; - my $tmpfile = "$file.tmp"; - my $substs = 0; - - open(IN, "< $file") or die "Can't open $file: $!"; - open(TMP, "> $tmpfile") or die "Can't open $tmpfile: $!"; - while (<IN>) { - chomp; - foreach my $pair (@$pairs) { - $substs += s/${$pair}[0]/${$pair}[1]/; - } - print TMP $_, "\n"; - } - close(IN); - close(TMP); - - maybe_rename_with_backup($tmpfile, $file, $substs > 0); -} - -######## -# Edit a project file in-place -sub edit_project($$) -{ - my ($file, $libpath) = @_; - my $tmpfile = "$file.tmp"; - my $substs = 0; - my ($prog, $debug) = (undef, undef); - - my $libsearch = $libpath; - $libsearch =~ s/\\/\\\\/g; - - open(IN, "< $file") or die "Can't open $file: $!"; - open(TMP, "> $tmpfile") or die "Can't open $tmpfile: $!"; - while (<IN>) { - chomp; - - if (m/^\# TARGTYPE \"[^\"]+\" 0x([0-9A-Za-z]+)/ - and defined $1) { - $prog = 'LINK32' if $1 eq '0102'; - $prog = 'LIB32' if $1 eq '0104'; - die "Unknown project type 0x$1" unless defined $prog; - } elsif (defined $prog - and m/^\# PROP Use_Debug_Libraries ([01])/ - and defined $1) { - $debug = $1; - } elsif (defined $prog and defined $debug - and m/^\# ADD $prog (\"$libsearch)?/ - and not defined $1) { - my $fullpath = - ($debug eq '1' ? "${libpath}d.lib" : "$libpath.lib"); - $substs += s/^\# ADD $prog /\# ADD $prog \"$fullpath\" /; - } elsif (m/^\# ADD CPP/) { - $substs += s/APU_USE_SDBM/APU_USE_DB/g; - } - - print TMP $_, "\n"; - } - close(IN); - close(TMP); - - maybe_rename_with_backup($tmpfile, $file, $substs > 0); -} diff --git a/libs/apr-util/buildconf b/libs/apr-util/buildconf deleted file mode 100755 index 718cb0ac2d..0000000000 --- a/libs/apr-util/buildconf +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh -# -# Copyright 1999-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. -# -# - -# Default place to look for apr source. Can be overridden with -# --with-apr=[directory] -apr_src_dir=../apr - -while test $# -gt 0 -do - # Normalize - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case "$1" in - --with-apr=*) - apr_src_dir=$optarg - ;; - esac - - shift -done - -if [ -f "$apr_src_dir/build/apr_common.m4" ]; then - apr_src_dir=`cd $apr_src_dir; pwd` - echo "" - echo "Looking for apr source in $apr_src_dir" -else - echo "" - echo "Problem finding apr source in $apr_src_dir." - echo "Use:" - echo " --with-apr=[directory]" - exit 1 -fi - -set -e - -# Remove some files, then copy them from apr source tree -rm -f build/apr_common.m4 build/find_apr.m4 build/install.sh \ - build/config.guess build/config.sub build/get-version.sh -cp -p $apr_src_dir/build/apr_common.m4 $apr_src_dir/build/find_apr.m4 \ - $apr_src_dir/build/install.sh $apr_src_dir/build/config.guess \ - $apr_src_dir/build/config.sub $apr_src_dir/build/get-version.sh \ - build/ - -# Remove aclocal.m4 as it'll break some builds... -rm -rf aclocal.m4 autom4te*.cache - -# -# Generate the autoconf header (include/apu_config.h) and ./configure -# -echo "Creating include/private/apu_config.h ..." -${AUTOHEADER:-autoheader} - -echo "Creating configure ..." -### do some work to toss config.cache? -if ${AUTOCONF:-autoconf}; then - : -else - echo "autoconf failed" - exit 1 -fi - -# -# Generate build-outputs.mk for the build systme -# -echo "Generating 'make' outputs ..." -#$apr_src_dir/build/gen-build.py make - -# -# If Expat has been bundled, then go and configure the thing -# -if [ -f xml/expat/buildconf.sh ]; then - echo "Invoking xml/expat/buildconf.sh ..." - (cd xml/expat; ./buildconf.sh) -fi - -# Remove autoconf cache again -rm -rf autom4te*.cache - -# Create RPM Spec file -if [ -f `which cut` ]; then - echo rebuilding rpm spec file - REVISION=`build/get-version.sh all include/apu_version.h APU` - VERSION=`echo $REVISION | cut -d- -s -f1` - RELEASE=`echo $REVISION | cut -d- -s -f2` - if [ "x$VERSION" = "x" ]; then - VERSION=$REVISION - RELEASE=1 - fi - sed -e "s/APU_VERSION/$VERSION/" -e "s/APU_RELEASE/$RELEASE/" \ - ./build/rpm/apr-util.spec.in > apr-util.spec -fi - diff --git a/libs/apr-util/config.layout b/libs/apr-util/config.layout deleted file mode 100644 index 907d0bb116..0000000000 --- a/libs/apr-util/config.layout +++ /dev/null @@ -1,232 +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 `apr' -## - a trailing plus character (`+') on paths is replaced with a -## `/<target>' suffix where <target> is currently hardcoded to 'apr'. -## (This may become a configurable parameter at some point.) -## - -# Classical APR-util path layout designed for parallel installs. -<Layout apr-util> - prefix: /usr/local/apr - 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 - datadir: ${prefix} - installbuilddir: ${datadir}/build - includedir: ${prefix}/include/apr-${APRUTIL_MAJOR_VERSION} - localstatedir: ${prefix} - libsuffix: -${APRUTIL_MAJOR_VERSION} -</Layout> - -# Classical single-installation APR path layout. -<Layout classic> - prefix: /usr/local/apr - 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 - datadir: ${prefix} - installbuilddir: ${datadir}/build - includedir: ${prefix}/include - localstatedir: ${prefix} -</Layout> - -# GNU standards conforming path layout. -# See FSF's GNU project `make-stds' document for details. -<Layout GNU> - prefix: /usr/local - exec_prefix: ${prefix} - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/sbin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/libexec - mandir: ${prefix}/man - sysconfdir: ${prefix}/etc+ - datadir: ${prefix}/share+ - installbuilddir: ${datadir}/build - includedir: ${prefix}/include+ - localstatedir: ${prefix}/var+ - runtimedir: ${localstatedir}/run -</Layout> - -# Mac OS X Server (Rhapsody) -<Layout Mac OS X Server> - prefix: /Local/Library/WebServer - exec_prefix: /usr - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/sbin - libdir: ${exec_prefix}/lib - libexecdir: /System/Library/apr/Modules - mandir: ${exec_prefix}/share/man - sysconfdir: ${prefix}/Configuration - datadir: ${prefix} - installbuilddir: /System/Library/apr/Build - includedir: /System/Library/Frameworks/apr.framework/Versions/2.0/Headers - localstatedir: /var - runtimedir: ${prefix}/Logs -</Layout> - -# Darwin/Mac OS Layout -<Layout Darwin> - prefix: /usr - exec_prefix: ${prefix} - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/sbin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/libexec+ - mandir: ${prefix}/share/man - datadir: /Library/WebServer - sysconfdir: /etc+ - installbuilddir: ${prefix}/share/httpd/build - includedir: ${prefix}/include+ - localstatedir: /var - runtimedir: ${localstatedir}/run -</Layout> - -# Red Hat Linux 7.x layout -<Layout RedHat> - prefix: /usr - exec_prefix: ${prefix} - bindir: ${prefix}/bin - sbindir: ${prefix}/sbin - libdir: ${prefix}/lib - libexecdir: ${prefix}/lib/apr - mandir: ${prefix}/man - sysconfdir: /etc/httpd/conf - datadir: /var/www - installbuilddir: ${datadir}/build - includedir: ${prefix}/include/apr - localstatedir: /var - runtimedir: ${localstatedir}/run -</Layout> - -# According to the /opt filesystem conventions -<Layout opt> - prefix: /opt/apr - exec_prefix: ${prefix} - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/sbin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/libexec - mandir: ${prefix}/man - sysconfdir: /etc${prefix} - datadir: ${prefix}/share - installbuilddir: ${datadir}/build - includedir: ${prefix}/include - localstatedir: /var${prefix} - runtimedir: ${localstatedir}/run -</Layout> - -# BeOS layout... -<Layout beos> - prefix: /boot/home/apr - exec_prefix: ${prefix} - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/bin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/libexec - mandir: ${prefix}/man - sysconfdir: ${prefix}/conf - datadir: ${prefix} - installbuilddir: ${datadir}/build - includedir: ${prefix}/include - localstatedir: ${prefix} - runtimedir: ${localstatedir}/logs -</Layout> - -# SuSE 6.x layout -<Layout SuSE> - prefix: /usr - exec_prefix: ${prefix} - bindir: ${prefix}/bin - sbindir: ${prefix}/sbin - libdir: ${prefix}/lib - libexecdir: ${prefix}/lib/apr - mandir: ${prefix}/share/man - sysconfdir: /etc/httpd - datadir: /usr/local/httpd - installbuilddir: ${datadir}/build - includedir: ${prefix}/include/apr - localstatedir: /var/lib/httpd - runtimedir: /var/run -</Layout> - -# BSD/OS layout -<Layout BSDI> - prefix: /var/www - exec_prefix: /usr/contrib - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/bin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/libexec/apr - mandir: ${exec_prefix}/man - sysconfdir: ${prefix}/conf - datadir: ${prefix} - installbuilddir: ${datadir}/build - includedir: ${exec_prefix}/include/apr - localstatedir: /var - runtimedir: ${localstatedir}/run -</Layout> - -# Solaris 8 Layout -<Layout Solaris> - prefix: /usr/apr - exec_prefix: ${prefix} - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/bin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/libexec - mandir: ${exec_prefix}/man - sysconfdir: /etc/apr - datadir: /var/apr - installbuilddir: ${datadir}/build - includedir: ${exec_prefix}/include - localstatedir: ${prefix} - runtimedir: /var/run -</Layout> - -# OpenBSD Layout -<Layout OpenBSD> - prefix: /var/www - exec_prefix: /usr - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/sbin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/lib/apr/modules - mandir: ${exec_prefix}/share/man - sysconfdir: ${prefix}/conf - datadir: ${prefix} - installbuilddir: ${prefix}/build - includedir: ${exec_prefix}/lib/apr/include - localstatedir: ${prefix} - runtimedir: ${prefix}/logs -</Layout> - -# Debian layout -<Layout Debian> - prefix: - exec_prefix: ${prefix}/usr - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/sbin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/lib/apr/modules - mandir: ${exec_prefix}/share/man - datadir: ${exec_prefix}/share/apr - includedir: ${exec_prefix}/include/apr-${APRUTIL_MAJOR_VERSION} - localstatedir: ${prefix}/var/run - runtimedir: ${prefix}/var/run - infodir: ${exec_prefix}/share/info - libsuffix: -${APRUTIL_MAJOR_VERSION} - installbuilddir: ${prefix}/usr/share/apache2/build -</Layout> diff --git a/libs/apr-util/configure.ac b/libs/apr-util/configure.ac deleted file mode 100644 index c0b4a3bfad..0000000000 --- a/libs/apr-util/configure.ac +++ /dev/null @@ -1,216 +0,0 @@ -dnl -dnl Process this file with autoconf to produce a configure script -dnl - -AC_PREREQ(2.50) -AC_INIT(export_vars.sh.in) - -AC_CONFIG_HEADERS(include/private/apu_config.h) -AC_CONFIG_AUX_DIR(build) - -sinclude(build/apu-conf.m4) -sinclude(build/apu-iconv.m4) -sinclude(build/apu-hints.m4) -sinclude(build/apr_common.m4) -sinclude(build/find_apr.m4) -sinclude(build/dbm.m4) -sinclude(build/dbd.m4) - -dnl Generate ./config.nice for reproducing runs of configure -dnl -APR_CONFIG_NICE(config.nice) - -CFLAGS="$CFLAGS $CONFIGURE_CFLAGS" -CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS" -LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS" - -dnl # Some initial steps for configuration. We setup the default directory -dnl # and which files are to be configured. - -dnl Absolute source/build directory -abs_srcdir=`(cd $srcdir && pwd)` -abs_builddir=`pwd` - -if test "$abs_builddir" != "$abs_srcdir"; then - USE_VPATH=1 - APU_CONFIG_LOCATION=build -else - APU_CONFIG_LOCATION=source -fi - -AC_SUBST(APU_CONFIG_LOCATION) - -AC_CANONICAL_SYSTEM - -AC_PROG_INSTALL - -dnl -dnl compute the top directory of the build -dnl note: this is needed for LIBTOOL and exporting the bundled Expat -dnl -top_builddir="$abs_builddir" -AC_SUBST(top_builddir) -AC_SUBST(abs_srcdir) -AC_SUBST(abs_builddir) - -dnl Initialize mkdir -p functionality. -APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh) - -dnl get our version information -get_version="$abs_srcdir/build/get-version.sh" -version_hdr="$abs_srcdir/include/apu_version.h" -APRUTIL_MAJOR_VERSION="`$get_version major $version_hdr APU`" -APRUTIL_DOTTED_VERSION="`$get_version all $version_hdr APU`" - -AC_SUBST(APRUTIL_DOTTED_VERSION) -AC_SUBST(APRUTIL_MAJOR_VERSION) - -echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}" - -dnl Enable the layout handling code, then reparse the prefix-style -dnl arguments due to autoconf being a PITA. -APR_ENABLE_LAYOUT(apr-util) -APR_PARSE_ARGUMENTS - -dnl load os-specific hints for apr-util -APU_PRELOAD - -dnl -dnl set up the compilation flags and stuff -dnl - -APRUTIL_INCLUDES="" -APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private" -if test -n "$USE_VPATH"; then - APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include" -fi - -dnl -dnl Find the APR includes directory and (possibly) the source (base) dir. -dnl -APU_FIND_APR - -dnl -dnl even though we use apr_rules.mk for building apr-util, we need -dnl to grab CC and CPP ahead of time so that apr-util config tests -dnl use the same compiler as APR; we need the same compiler options -dnl and feature test macros as well -dnl -APR_SETIFNULL(CC, `$apr_config --cc`) -APR_SETIFNULL(CPP, `$apr_config --cpp`) -APR_ADDTO(CFLAGS, `$apr_config --cflags`) -APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`) - -dnl -dnl Find the APR-ICONV directory. -dnl -if test -d ../apr-iconv; then - APR_SUBDIR_CONFIG(../apr-iconv, - [$apache_apr_flags --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir --datadir=$datadir --with-installbuilddir=$installbuilddir], - [--enable-layout=*|\'--enable-layout=*]) - APRUTIL_EXPORT_LIBS="$abs_srcdir/../apr-iconv/lib/libapriconv.la $APRUTIL_EXPORT_LIBS" - APRUTIL_INCLUDES="-I$abs_srcdir/../apr-iconv/include $APRUTIL_INCLUDES" - APR_ICONV_DIR=../apr-iconv -else - APR_ICONV_DIR="" -fi -AC_SUBST(APR_ICONV_DIR) - -dnl Find LDAP library -dnl Determine what DBM backend type to use. -dnl Find Expat -dnl Find an iconv library -APU_FIND_LDAP -APU_CHECK_DBM -APU_CHECK_DBD -APU_CHECK_DBD_MYSQL -APU_CHECK_DBD_SQLITE3 -APU_CHECK_DBD_SQLITE2 -APU_FIND_EXPAT -APU_FIND_ICONV - -AC_SEARCH_LIBS(crypt, crypt ufc) -AC_MSG_CHECKING(if system crypt() function is threadsafe) -if test "x$apu_crypt_threadsafe" = "x1"; then - AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe]) - msg="yes" -else - msg="no" -fi -AC_MSG_RESULT([$msg]) - -AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ]) -if test "$crypt_r" = "1"; then - APU_CHECK_CRYPT_R_STYLE -fi - -so_ext=$APR_SO_EXT -lib_target=$APR_LIB_TARGET -AC_SUBST(so_ext) -AC_SUBST(lib_target) - -APRUTIL_LIBNAME="aprutil${libsuffix}" -AC_SUBST(APRUTIL_LIBNAME) - -dnl -dnl Prep all the flags and stuff for compilation and export to other builds -dnl -APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS]) - -AC_SUBST(APRUTIL_EXPORT_LIBS) -AC_SUBST(APRUTIL_PRIV_INCLUDES) -AC_SUBST(APRUTIL_INCLUDES) -AC_SUBST(APRUTIL_LDFLAGS) -AC_SUBST(APRUTIL_LIBS) -AC_SUBST(LDFLAGS) - -dnl copy apr's rules.mk into our build directory. -if test ! -d ./build; then - $mkdir_p build -fi -cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk - -dnl -dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles -dnl -case "$host_alias" in -*bsdi* | BSD/OS) - # Check whether they've installed GNU make - if make --version > /dev/null 2>&1; then - INCLUDE_RULES="include $abs_builddir/build/rules.mk" - INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk" - else - INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\"" - INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\"" - fi - ;; -*) - INCLUDE_RULES="include $abs_builddir/build/rules.mk" - INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk" - ;; -esac -AC_SUBST(INCLUDE_RULES) -AC_SUBST(INCLUDE_OUTPUTS) - -for d in include include/private; do - test -d $top_builddir/$d || mkdir $top_builddir/$d -done - -AC_CONFIG_FILES([Makefile export_vars.sh - build/pkg/pkginfo apr-util.pc - apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in - include/private/apu_select_dbm.h - include/apr_ldap.h - include/apu.h include/apu_want.h]) - -AC_CONFIG_COMMANDS([default], [ -chmod +x apu-$APRUTIL_MAJOR_VERSION-config -],[ -APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION -]) - -if test -d $srcdir/test; then - AC_CONFIG_FILES([test/Makefile]) -fi - -AC_OUTPUT diff --git a/libs/apr-util/configure.gnu b/libs/apr-util/configure.gnu deleted file mode 100644 index 72f3dccb09..0000000000 --- a/libs/apr-util/configure.gnu +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -srcpath=$(dirname $0 2>/dev/null ) || srcpath="." -$srcpath/configure "$@" --with-apr=../apr --disable-shared --with-pic --without-sqlite2 --without-sqlite3 --with-expat=builtin - diff --git a/libs/apr-util/crypto/apr_md4.c b/libs/apr-util/crypto/apr_md4.c deleted file mode 100644 index 6b9d9f4b39..0000000000 --- a/libs/apr-util/crypto/apr_md4.c +++ /dev/null @@ -1,404 +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. - */ - -#include "apr_strings.h" -#include "apr_md4.h" -#include "apr_lib.h" - -#if APR_HAVE_STRING_H -#include <string.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif - -/* Constants for MD4Transform routine. - */ - -#define S11 3 -#define S12 7 -#define S13 11 -#define S14 19 -#define S21 3 -#define S22 5 -#define S23 9 -#define S24 13 -#define S31 3 -#define S32 9 -#define S33 11 -#define S34 15 - -static void MD4Transform(apr_uint32_t state[4], const unsigned char block[64]); -static void Encode(unsigned char *output, const apr_uint32_t *input, - unsigned int len); -static void Decode(apr_uint32_t *output, const unsigned char *input, - unsigned int len); - -static unsigned char PADDING[64] = -{ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -#if APR_CHARSET_EBCDIC -static apr_xlate_t *xlate_ebcdic_to_ascii; /* used in apr_md4_encode() */ -#endif - -/* F, G and I are basic MD4 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) - -/* ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ -/* Rotation is separate from addition to prevent recomputation */ - -#define FF(a, b, c, d, x, s) { \ - (a) += F ((b), (c), (d)) + (x); \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define GG(a, b, c, d, x, s) { \ - (a) += G ((b), (c), (d)) + (x) + (apr_uint32_t)0x5a827999; \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define HH(a, b, c, d, x, s) { \ - (a) += H ((b), (c), (d)) + (x) + (apr_uint32_t)0x6ed9eba1; \ - (a) = ROTATE_LEFT ((a), (s)); \ - } - -/* MD4 initialization. Begins an MD4 operation, writing a new context. - */ -APU_DECLARE(apr_status_t) apr_md4_init(apr_md4_ctx_t *context) -{ - context->count[0] = context->count[1] = 0; - - /* Load magic initialization constants. */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; - -#if APR_HAS_XLATE - context->xlate = NULL; -#endif - - return APR_SUCCESS; -} - -#if APR_HAS_XLATE -/* MD4 translation setup. Provides the APR translation handle - * to be used for translating the content before calculating the - * digest. - */ -APU_DECLARE(apr_status_t) apr_md4_set_xlate(apr_md4_ctx_t *context, - apr_xlate_t *xlate) -{ - apr_status_t rv; - int is_sb; - - /* TODO: remove the single-byte-only restriction from this code - */ - rv = apr_xlate_sb_get(xlate, &is_sb); - if (rv != APR_SUCCESS) { - return rv; - } - if (!is_sb) { - return APR_EINVAL; - } - context->xlate = xlate; - return APR_SUCCESS; -} -#endif /* APR_HAS_XLATE */ - -/* MD4 block update operation. Continues an MD4 message-digest - * operation, processing another message block, and updating the - * context. - */ -APU_DECLARE(apr_status_t) apr_md4_update(apr_md4_ctx_t *context, - const unsigned char *input, - apr_size_t inputLen) -{ - unsigned int i, idx, partLen; -#if APR_HAS_XLATE - apr_size_t inbytes_left, outbytes_left; -#endif - - /* Compute number of bytes mod 64 */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((apr_uint32_t)inputLen << 3)) - < ((apr_uint32_t)inputLen << 3)) - context->count[1]++; - context->count[1] += (apr_uint32_t)inputLen >> 29; - - partLen = 64 - idx; - - /* Transform as many times as possible. */ -#if !APR_HAS_XLATE - if (inputLen >= partLen) { - memcpy(&context->buffer[idx], input, partLen); - MD4Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD4Transform(context->state, &input[i]); - - idx = 0; - } - else - i = 0; - - /* Buffer remaining input */ - memcpy(&context->buffer[idx], &input[i], inputLen - i); -#else /*APR_HAS_XLATE*/ - if (inputLen >= partLen) { - if (context->xlate) { - inbytes_left = outbytes_left = partLen; - apr_xlate_conv_buffer(context->xlate, (const char *)input, - &inbytes_left, - (char *)&context->buffer[idx], - &outbytes_left); - } - else { - memcpy(&context->buffer[idx], input, partLen); - } - MD4Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) { - if (context->xlate) { - unsigned char inp_tmp[64]; - inbytes_left = outbytes_left = 64; - apr_xlate_conv_buffer(context->xlate, (const char *)&input[i], - &inbytes_left, - (char *)inp_tmp, &outbytes_left); - MD4Transform(context->state, inp_tmp); - } - else { - MD4Transform(context->state, &input[i]); - } - } - - idx = 0; - } - else - i = 0; - - /* Buffer remaining input */ - if (context->xlate) { - inbytes_left = outbytes_left = inputLen - i; - apr_xlate_conv_buffer(context->xlate, (const char *)&input[i], - &inbytes_left, (char *)&context->buffer[idx], - &outbytes_left); - } - else { - memcpy(&context->buffer[idx], &input[i], inputLen - i); - } -#endif /*APR_HAS_XLATE*/ - return APR_SUCCESS; -} - -/* MD4 finalization. Ends an MD4 message-digest operation, writing the - * the message digest and zeroizing the context. - */ -APU_DECLARE(apr_status_t) apr_md4_final( - unsigned char digest[APR_MD4_DIGESTSIZE], - apr_md4_ctx_t *context) -{ - unsigned char bits[8]; - unsigned int idx, padLen; - - /* Save number of bits */ - Encode(bits, context->count, 8); - -#if APR_HAS_XLATE - /* apr_md4_update() should not translate for this final round. */ - context->xlate = NULL; -#endif /*APR_HAS_XLATE*/ - - /* Pad out to 56 mod 64. */ - idx = (unsigned int) ((context->count[0] >> 3) & 0x3f); - padLen = (idx < 56) ? (56 - idx) : (120 - idx); - apr_md4_update(context, PADDING, padLen); - - /* Append length (before padding) */ - apr_md4_update(context, bits, 8); - - /* Store state in digest */ - Encode(digest, context->state, APR_MD4_DIGESTSIZE); - - /* Zeroize sensitive information. */ - memset(context, 0, sizeof(*context)); - - return APR_SUCCESS; -} - -/* MD4 computation in one step (init, update, final) - */ -APU_DECLARE(apr_status_t) apr_md4(unsigned char digest[APR_MD4_DIGESTSIZE], - const unsigned char *input, - apr_size_t inputLen) -{ - apr_md4_ctx_t ctx; - apr_status_t rv; - - apr_md4_init(&ctx); - - if ((rv = apr_md4_update(&ctx, input, inputLen)) != APR_SUCCESS) - return rv; - - return apr_md4_final(digest, &ctx); -} - -/* MD4 basic transformation. Transforms state based on block. */ -static void MD4Transform(apr_uint32_t state[4], const unsigned char block[64]) -{ - apr_uint32_t a = state[0], b = state[1], c = state[2], d = state[3], - x[APR_MD4_DIGESTSIZE]; - - Decode(x, block, 64); - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11); /* 1 */ - FF (d, a, b, c, x[ 1], S12); /* 2 */ - FF (c, d, a, b, x[ 2], S13); /* 3 */ - FF (b, c, d, a, x[ 3], S14); /* 4 */ - FF (a, b, c, d, x[ 4], S11); /* 5 */ - FF (d, a, b, c, x[ 5], S12); /* 6 */ - FF (c, d, a, b, x[ 6], S13); /* 7 */ - FF (b, c, d, a, x[ 7], S14); /* 8 */ - FF (a, b, c, d, x[ 8], S11); /* 9 */ - FF (d, a, b, c, x[ 9], S12); /* 10 */ - FF (c, d, a, b, x[10], S13); /* 11 */ - FF (b, c, d, a, x[11], S14); /* 12 */ - FF (a, b, c, d, x[12], S11); /* 13 */ - FF (d, a, b, c, x[13], S12); /* 14 */ - FF (c, d, a, b, x[14], S13); /* 15 */ - FF (b, c, d, a, x[15], S14); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 0], S21); /* 17 */ - GG (d, a, b, c, x[ 4], S22); /* 18 */ - GG (c, d, a, b, x[ 8], S23); /* 19 */ - GG (b, c, d, a, x[12], S24); /* 20 */ - GG (a, b, c, d, x[ 1], S21); /* 21 */ - GG (d, a, b, c, x[ 5], S22); /* 22 */ - GG (c, d, a, b, x[ 9], S23); /* 23 */ - GG (b, c, d, a, x[13], S24); /* 24 */ - GG (a, b, c, d, x[ 2], S21); /* 25 */ - GG (d, a, b, c, x[ 6], S22); /* 26 */ - GG (c, d, a, b, x[10], S23); /* 27 */ - GG (b, c, d, a, x[14], S24); /* 28 */ - GG (a, b, c, d, x[ 3], S21); /* 29 */ - GG (d, a, b, c, x[ 7], S22); /* 30 */ - GG (c, d, a, b, x[11], S23); /* 31 */ - GG (b, c, d, a, x[15], S24); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 0], S31); /* 33 */ - HH (d, a, b, c, x[ 8], S32); /* 34 */ - HH (c, d, a, b, x[ 4], S33); /* 35 */ - HH (b, c, d, a, x[12], S34); /* 36 */ - HH (a, b, c, d, x[ 2], S31); /* 37 */ - HH (d, a, b, c, x[10], S32); /* 38 */ - HH (c, d, a, b, x[ 6], S33); /* 39 */ - HH (b, c, d, a, x[14], S34); /* 40 */ - HH (a, b, c, d, x[ 1], S31); /* 41 */ - HH (d, a, b, c, x[ 9], S32); /* 42 */ - HH (c, d, a, b, x[ 5], S33); /* 43 */ - HH (b, c, d, a, x[13], S34); /* 44 */ - HH (a, b, c, d, x[ 3], S31); /* 45 */ - HH (d, a, b, c, x[11], S32); /* 46 */ - HH (c, d, a, b, x[ 7], S33); /* 47 */ - HH (b, c, d, a, x[15], S34); /* 48 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. */ - memset(x, 0, sizeof(x)); -} - -/* Encodes input (apr_uint32_t) into output (unsigned char). Assumes len is - * a multiple of 4. - */ -static void Encode(unsigned char *output, const apr_uint32_t *input, - unsigned int len) -{ - unsigned int i, j; - apr_uint32_t k; - - for (i = 0, j = 0; j < len; i++, j += 4) { - k = input[i]; - output[j] = (unsigned char)(k & 0xff); - output[j + 1] = (unsigned char)((k >> 8) & 0xff); - output[j + 2] = (unsigned char)((k >> 16) & 0xff); - output[j + 3] = (unsigned char)((k >> 24) & 0xff); - } -} - -/* Decodes input (unsigned char) into output (apr_uint32_t). Assumes len is - * a multiple of 4. - */ -static void Decode(apr_uint32_t *output, const unsigned char *input, - unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((apr_uint32_t)input[j]) | - (((apr_uint32_t)input[j + 1]) << 8) | - (((apr_uint32_t)input[j + 2]) << 16) | - (((apr_uint32_t)input[j + 3]) << 24); -} - -#if APR_CHARSET_EBCDIC -APU_DECLARE(apr_status_t) apr_MD4InitEBCDIC(apr_xlate_t *xlate) -{ - xlate_ebcdic_to_ascii = xlate; - return APR_SUCCESS; -} -#endif diff --git a/libs/apr-util/crypto/apr_md5.c b/libs/apr-util/crypto/apr_md5.c deleted file mode 100644 index 40942e30db..0000000000 --- a/libs/apr-util/crypto/apr_md5.c +++ /dev/null @@ -1,733 +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. - */ - -/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm - */ - -/* 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. - */ - -/* - * The apr_md5_encode() routine uses much code obtained from the FreeBSD 3.0 - * MD5 crypt() function, which is licenced as follows: - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ -#include "apr_strings.h" -#include "apr_md5.h" -#include "apr_lib.h" -#include "apu_config.h" -#include "apr_sha1.h" - -#if APR_HAVE_STRING_H -#include <string.h> -#endif -#if APR_HAVE_CRYPT_H -#include <crypt.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#if APR_HAVE_PTHREAD_H -#include <pthread.h> -#endif - -/* Constants for MD5Transform routine. - */ - -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - -static void MD5Transform(apr_uint32_t state[4], const unsigned char block[64]); -static void Encode(unsigned char *output, const apr_uint32_t *input, - unsigned int len); -static void Decode(apr_uint32_t *output, const unsigned char *input, - unsigned int len); - -static unsigned char PADDING[64] = -{ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -#if APR_CHARSET_EBCDIC -static apr_xlate_t *xlate_ebcdic_to_ascii; /* used in apr_md5_encode() */ -#endif - -/* F, G, H and I are basic MD5 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. - * Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (apr_uint32_t)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (apr_uint32_t)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (apr_uint32_t)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (apr_uint32_t)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -/* MD5 initialization. Begins an MD5 operation, writing a new context. - */ -APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context) -{ - context->count[0] = context->count[1] = 0; - - /* Load magic initialization constants. */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; - context->xlate = NULL; - - return APR_SUCCESS; -} - -/* MD5 translation setup. Provides the APR translation handle - * to be used for translating the content before calculating the - * digest. - */ -APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context, - apr_xlate_t *xlate) -{ -#if APR_HAS_XLATE - apr_status_t rv; - int is_sb; - - /* TODO: remove the single-byte-only restriction from this code - */ - rv = apr_xlate_sb_get(xlate, &is_sb); - if (rv != APR_SUCCESS) { - return rv; - } - if (!is_sb) { - return APR_EINVAL; - } - context->xlate = xlate; - return APR_SUCCESS; -#else - return APR_ENOTIMPL; -#endif /* APR_HAS_XLATE */ -} - -/* MD5 block update operation. Continues an MD5 message-digest - * operation, processing another message block, and updating the - * context. - */ -APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context, - const void *_input, - apr_size_t inputLen) -{ - const unsigned char *input = _input; - unsigned int i, idx, partLen; -#if APR_HAS_XLATE - apr_size_t inbytes_left, outbytes_left; -#endif - - /* Compute number of bytes mod 64 */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((apr_uint32_t)inputLen << 3)) - < ((apr_uint32_t)inputLen << 3)) - context->count[1]++; - context->count[1] += (apr_uint32_t)inputLen >> 29; - - partLen = 64 - idx; - - /* Transform as many times as possible. */ -#if !APR_HAS_XLATE - if (inputLen >= partLen) { - memcpy(&context->buffer[idx], input, partLen); - MD5Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform(context->state, &input[i]); - - idx = 0; - } - else - i = 0; - - /* Buffer remaining input */ - memcpy(&context->buffer[idx], &input[i], inputLen - i); -#else /*APR_HAS_XLATE*/ - if (inputLen >= partLen) { - if (context->xlate) { - inbytes_left = outbytes_left = partLen; - apr_xlate_conv_buffer(context->xlate, (const char *)input, - &inbytes_left, - (char *)&context->buffer[idx], - &outbytes_left); - } - else { - memcpy(&context->buffer[idx], input, partLen); - } - MD5Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) { - if (context->xlate) { - unsigned char inp_tmp[64]; - inbytes_left = outbytes_left = 64; - apr_xlate_conv_buffer(context->xlate, (const char *)&input[i], - &inbytes_left, (char *)inp_tmp, - &outbytes_left); - MD5Transform(context->state, inp_tmp); - } - else { - MD5Transform(context->state, &input[i]); - } - } - - idx = 0; - } - else - i = 0; - - /* Buffer remaining input */ - if (context->xlate) { - inbytes_left = outbytes_left = inputLen - i; - apr_xlate_conv_buffer(context->xlate, (const char *)&input[i], - &inbytes_left, (char *)&context->buffer[idx], - &outbytes_left); - } - else { - memcpy(&context->buffer[idx], &input[i], inputLen - i); - } -#endif /*APR_HAS_XLATE*/ - return APR_SUCCESS; -} - -/* MD5 finalization. Ends an MD5 message-digest operation, writing the - * the message digest and zeroizing the context. - */ -APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE], - apr_md5_ctx_t *context) -{ - unsigned char bits[8]; - unsigned int idx, padLen; - - /* Save number of bits */ - Encode(bits, context->count, 8); - -#if APR_HAS_XLATE - /* apr_md5_update() should not translate for this final round. */ - context->xlate = NULL; -#endif /*APR_HAS_XLATE*/ - - /* Pad out to 56 mod 64. */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (idx < 56) ? (56 - idx) : (120 - idx); - apr_md5_update(context, PADDING, padLen); - - /* Append length (before padding) */ - apr_md5_update(context, bits, 8); - - /* Store state in digest */ - Encode(digest, context->state, APR_MD5_DIGESTSIZE); - - /* Zeroize sensitive information. */ - memset(context, 0, sizeof(*context)); - - return APR_SUCCESS; -} - -/* MD5 in one step (init, update, final) - */ -APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE], - const void *_input, - apr_size_t inputLen) -{ - const unsigned char *input = _input; - apr_md5_ctx_t ctx; - apr_status_t rv; - - apr_md5_init(&ctx); - - if ((rv = apr_md5_update(&ctx, input, inputLen)) != APR_SUCCESS) - return rv; - - return apr_md5_final(digest, &ctx); -} - -/* MD5 basic transformation. Transforms state based on block. */ -static void MD5Transform(apr_uint32_t state[4], const unsigned char block[64]) -{ - apr_uint32_t a = state[0], b = state[1], c = state[2], d = state[3], - x[APR_MD5_DIGESTSIZE]; - - Decode(x, block, 64); - - /* Round 1 */ - FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */ - FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */ - FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */ - FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */ - FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */ - FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */ - FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */ - FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */ - FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */ - FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */ - FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */ - GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */ - GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */ - GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */ - GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */ - GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */ - GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */ - GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */ - GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */ - GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */ - GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */ - HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */ - HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */ - HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */ - HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */ - HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */ - HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */ - HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */ - HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */ - HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */ - II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */ - II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */ - II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */ - II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */ - II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */ - II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */ - II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */ - II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */ - II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. */ - memset(x, 0, sizeof(x)); -} - -/* Encodes input (apr_uint32_t) into output (unsigned char). Assumes len is - * a multiple of 4. - */ -static void Encode(unsigned char *output, const apr_uint32_t *input, - unsigned int len) -{ - unsigned int i, j; - apr_uint32_t k; - - for (i = 0, j = 0; j < len; i++, j += 4) { - k = input[i]; - output[j] = (unsigned char)(k & 0xff); - output[j + 1] = (unsigned char)((k >> 8) & 0xff); - output[j + 2] = (unsigned char)((k >> 16) & 0xff); - output[j + 3] = (unsigned char)((k >> 24) & 0xff); - } -} - -/* Decodes input (unsigned char) into output (apr_uint32_t). Assumes len is - * a multiple of 4. - */ -static void Decode(apr_uint32_t *output, const unsigned char *input, - unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((apr_uint32_t)input[j]) | - (((apr_uint32_t)input[j + 1]) << 8) | - (((apr_uint32_t)input[j + 2]) << 16) | - (((apr_uint32_t)input[j + 3]) << 24); -} - -#if APR_CHARSET_EBCDIC -APU_DECLARE(apr_status_t) apr_MD5InitEBCDIC(apr_xlate_t *xlate) -{ - xlate_ebcdic_to_ascii = xlate; - return APR_SUCCESS; -} -#endif - -/* - * Define the Magic String prefix that identifies a password as being - * hashed using our algorithm. - */ -static const char *apr1_id = "$apr1$"; - -/* - * The following MD5 password encryption code was largely borrowed from - * the FreeBSD 3.0 /usr/src/lib/libcrypt/crypt.c file, which is - * licenced as stated at the top of this file. - */ - -static void to64(char *s, unsigned long v, int n) -{ - static unsigned char itoa64[] = /* 0 ... 63 => ASCII - 64 */ - "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - - while (--n >= 0) { - *s++ = itoa64[v&0x3f]; - v >>= 6; - } -} - -APU_DECLARE(apr_status_t) apr_md5_encode(const char *pw, const char *salt, - char *result, apr_size_t nbytes) -{ - /* - * Minimum size is 8 bytes for salt, plus 1 for the trailing NUL, - * plus 4 for the '$' separators, plus the password hash itself. - * Let's leave a goodly amount of leeway. - */ - - char passwd[120], *p; - const char *sp, *ep; - unsigned char final[APR_MD5_DIGESTSIZE]; - apr_ssize_t sl, pl, i; - apr_md5_ctx_t ctx, ctx1; - unsigned long l; - - /* - * Refine the salt first. It's possible we were given an already-hashed - * string as the salt argument, so extract the actual salt value from it - * if so. Otherwise just use the string up to the first '$' as the salt. - */ - sp = salt; - - /* - * If it starts with the magic string, then skip that. - */ - if (!strncmp(sp, apr1_id, strlen(apr1_id))) { - sp += strlen(apr1_id); - } - - /* - * It stops at the first '$' or 8 chars, whichever comes first - */ - for (ep = sp; (*ep != '\0') && (*ep != '$') && (ep < (sp + 8)); ep++) { - continue; - } - - /* - * Get the length of the true salt - */ - sl = ep - sp; - - /* - * 'Time to make the doughnuts..' - */ - apr_md5_init(&ctx); -#if APR_CHARSET_EBCDIC - apr_md5_set_xlate(&ctx, xlate_ebcdic_to_ascii); -#endif - - /* - * The password first, since that is what is most unknown - */ - apr_md5_update(&ctx, pw, strlen(pw)); - - /* - * Then our magic string - */ - apr_md5_update(&ctx, apr1_id, strlen(apr1_id)); - - /* - * Then the raw salt - */ - apr_md5_update(&ctx, sp, sl); - - /* - * Then just as many characters of the MD5(pw, salt, pw) - */ - apr_md5_init(&ctx1); - apr_md5_update(&ctx1, pw, strlen(pw)); - apr_md5_update(&ctx1, sp, sl); - apr_md5_update(&ctx1, pw, strlen(pw)); - apr_md5_final(final, &ctx1); - for (pl = strlen(pw); pl > 0; pl -= APR_MD5_DIGESTSIZE) { - apr_md5_update(&ctx, final, - (pl > APR_MD5_DIGESTSIZE) ? APR_MD5_DIGESTSIZE : pl); - } - - /* - * Don't leave anything around in vm they could use. - */ - memset(final, 0, sizeof(final)); - - /* - * Then something really weird... - */ - for (i = strlen(pw); i != 0; i >>= 1) { - if (i & 1) { - apr_md5_update(&ctx, final, 1); - } - else { - apr_md5_update(&ctx, pw, 1); - } - } - - /* - * Now make the output string. We know our limitations, so we - * can use the string routines without bounds checking. - */ - strcpy(passwd, apr1_id); - strncat(passwd, sp, sl); - strcat(passwd, "$"); - - apr_md5_final(final, &ctx); - - /* - * And now, just to make sure things don't run too fast.. - * On a 60 Mhz Pentium this takes 34 msec, so you would - * need 30 seconds to build a 1000 entry dictionary... - */ - for (i = 0; i < 1000; i++) { - apr_md5_init(&ctx1); - if (i & 1) { - apr_md5_update(&ctx1, pw, strlen(pw)); - } - else { - apr_md5_update(&ctx1, final, APR_MD5_DIGESTSIZE); - } - if (i % 3) { - apr_md5_update(&ctx1, sp, sl); - } - - if (i % 7) { - apr_md5_update(&ctx1, pw, strlen(pw)); - } - - if (i & 1) { - apr_md5_update(&ctx1, final, APR_MD5_DIGESTSIZE); - } - else { - apr_md5_update(&ctx1, pw, strlen(pw)); - } - apr_md5_final(final,&ctx1); - } - - p = passwd + strlen(passwd); - - l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p, l, 4); p += 4; - l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p, l, 4); p += 4; - l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p, l, 4); p += 4; - l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p, l, 4); p += 4; - l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p, l, 4); p += 4; - l = final[11] ; to64(p, l, 2); p += 2; - *p = '\0'; - - /* - * Don't leave anything around in vm they could use. - */ - memset(final, 0, sizeof(final)); - - apr_cpystrn(result, passwd, nbytes - 1); - return APR_SUCCESS; -} - -#if !defined(WIN32) && !defined(BEOS) && !defined(NETWARE) -#if defined(APU_CRYPT_THREADSAFE) || !APR_HAS_THREADS || \ - defined(CRYPT_R_CRYPTD) || defined(CRYPT_R_STRUCT_CRYPT_DATA) - -#define crypt_mutex_lock() -#define crypt_mutex_unlock() - -#elif APR_HAVE_PTHREAD_H && defined(PTHREAD_MUTEX_INITIALIZER) - -static pthread_mutex_t crypt_mutex = PTHREAD_MUTEX_INITIALIZER; -static void crypt_mutex_lock(void) -{ - pthread_mutex_lock(&crypt_mutex); -} - -static void crypt_mutex_unlock(void) -{ - pthread_mutex_unlock(&crypt_mutex); -} - -#else - -#error apr_password_validate() is not threadsafe. rebuild APR without thread support. - -#endif -#endif - -/* - * Validate a plaintext password against a smashed one. Uses either - * crypt() (if available) or apr_md5_encode() or apr_sha1_base64(), depending - * upon the format of the smashed input password. Returns APR_SUCCESS if - * they match, or APR_EMISMATCH if they don't. If the platform doesn't - * support crypt, then the default check is against a clear text string. - */ -APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd, - const char *hash) -{ - char sample[120]; -#if !defined(WIN32) && !defined(BEOS) && !defined(NETWARE) - char *crypt_pw; -#endif - if (!strncmp(hash, apr1_id, strlen(apr1_id))) { - /* - * The hash was created using our custom algorithm. - */ - apr_md5_encode(passwd, hash, sample, sizeof(sample)); - } - else if (!strncmp(hash, APR_SHA1PW_ID, APR_SHA1PW_IDLEN)) { - apr_sha1_base64(passwd, strlen(passwd), sample); - } - else { - /* - * It's not our algorithm, so feed it to crypt() if possible. - */ -#if defined(WIN32) || defined(BEOS) || defined(NETWARE) - apr_cpystrn(sample, passwd, sizeof(sample) - 1); -#elif defined(CRYPT_R_CRYPTD) - CRYPTD buffer; - - crypt_pw = crypt_r(passwd, hash, &buffer); - apr_cpystrn(sample, crypt_pw, sizeof(sample) - 1); -#elif defined(CRYPT_R_STRUCT_CRYPT_DATA) - struct crypt_data buffer; - - /* having to clear this seems bogus... GNU doc is - * confusing... user report found from google says - * the crypt_data struct had to be cleared to get - * the same result as plain crypt() - */ - memset(&buffer, 0, sizeof(buffer)); - crypt_pw = crypt_r(passwd, hash, &buffer); - apr_cpystrn(sample, crypt_pw, sizeof(sample) - 1); -#else - /* Do a bit of sanity checking since we know that crypt_r() - * should always be used for threaded builds on AIX, and - * problems in configure logic can result in the wrong - * choice being made. - */ -#if defined(_AIX) && APR_HAS_THREADS -#error Configuration error! crypt_r() should have been selected! -#endif - - /* Handle thread safety issues by holding a mutex around the - * call to crypt(). - */ - crypt_mutex_lock(); - crypt_pw = crypt(passwd, hash); - apr_cpystrn(sample, crypt_pw, sizeof(sample) - 1); - crypt_mutex_unlock(); -#endif - } - return (strcmp(sample, hash) == 0) ? APR_SUCCESS : APR_EMISMATCH; -} diff --git a/libs/apr-util/crypto/apr_sha1.c b/libs/apr-util/crypto/apr_sha1.c deleted file mode 100644 index 0b139127e6..0000000000 --- a/libs/apr-util/crypto/apr_sha1.c +++ /dev/null @@ -1,372 +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 exported function: - * - * apr_sha1_base64(const char *clear, int len, char *out); - * - * provides a means to SHA1 crypt/encode a plaintext password in - * a way which makes password files compatible with those commonly - * used in netscape web and ldap installations. It was put together - * by Clinton Wong <clintdw@netcom.com>, who also notes that: - * - * 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. - * - * See also the documentation in support/SHA1 as to hints on how to - * migrate an existing netscape installation and other supplied utitlites. - * - * This software also makes use of the following component: - * - * 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 - */ - -#include "apr_sha1.h" -#include "apr_base64.h" -#include "apr_strings.h" -#include "apr_lib.h" -#if APR_CHARSET_EBCDIC -#include "apr_xlate.h" -#endif /*APR_CHARSET_EBCDIC*/ -#include <string.h> - -/* a bit faster & bigger, if defined */ -#define UNROLL_LOOPS - -/* NIST's proposed modification to SHA, 7/11/94 */ -#define USE_MODIFIED_SHA - -/* SHA f()-functions */ -#define f1(x,y,z) ((x & y) | (~x & z)) -#define f2(x,y,z) (x ^ y ^ z) -#define f3(x,y,z) ((x & y) | (x & z) | (y & z)) -#define f4(x,y,z) (x ^ y ^ z) - -/* SHA constants */ -#define CONST1 0x5a827999L -#define CONST2 0x6ed9eba1L -#define CONST3 0x8f1bbcdcL -#define CONST4 0xca62c1d6L - -/* 32-bit rotate */ - -#define ROT32(x,n) ((x << n) | (x >> (32 - n))) - -#define FUNC(n,i) \ - temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \ - E = D; D = C; C = ROT32(B,30); B = A; A = temp - -#define SHA_BLOCKSIZE 64 - -#if APR_CHARSET_EBCDIC -static apr_xlate_t *ebcdic2ascii_xlate; - -APU_DECLARE(apr_status_t) apr_SHA1InitEBCDIC(apr_xlate_t *x) -{ - apr_status_t rv; - int onoff; - - /* Only single-byte conversion is supported. - */ - rv = apr_xlate_sb_get(x, &onoff); - if (rv) { - return rv; - } - if (!onoff) { /* If conversion is not single-byte-only */ - return APR_EINVAL; - } - ebcdic2ascii_xlate = x; - return APR_SUCCESS; -} -#endif - -/* do SHA transformation */ -static void sha_transform(apr_sha1_ctx_t *sha_info) -{ - int i; - apr_uint32_t temp, A, B, C, D, E, W[80]; - - for (i = 0; i < 16; ++i) { - W[i] = sha_info->data[i]; - } - for (i = 16; i < 80; ++i) { - W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]; -#ifdef USE_MODIFIED_SHA - W[i] = ROT32(W[i], 1); -#endif /* USE_MODIFIED_SHA */ - } - A = sha_info->digest[0]; - B = sha_info->digest[1]; - C = sha_info->digest[2]; - D = sha_info->digest[3]; - E = sha_info->digest[4]; -#ifdef UNROLL_LOOPS - FUNC(1, 0); FUNC(1, 1); FUNC(1, 2); FUNC(1, 3); FUNC(1, 4); - FUNC(1, 5); FUNC(1, 6); FUNC(1, 7); FUNC(1, 8); FUNC(1, 9); - FUNC(1,10); FUNC(1,11); FUNC(1,12); FUNC(1,13); FUNC(1,14); - FUNC(1,15); FUNC(1,16); FUNC(1,17); FUNC(1,18); FUNC(1,19); - - FUNC(2,20); FUNC(2,21); FUNC(2,22); FUNC(2,23); FUNC(2,24); - FUNC(2,25); FUNC(2,26); FUNC(2,27); FUNC(2,28); FUNC(2,29); - FUNC(2,30); FUNC(2,31); FUNC(2,32); FUNC(2,33); FUNC(2,34); - FUNC(2,35); FUNC(2,36); FUNC(2,37); FUNC(2,38); FUNC(2,39); - - FUNC(3,40); FUNC(3,41); FUNC(3,42); FUNC(3,43); FUNC(3,44); - FUNC(3,45); FUNC(3,46); FUNC(3,47); FUNC(3,48); FUNC(3,49); - FUNC(3,50); FUNC(3,51); FUNC(3,52); FUNC(3,53); FUNC(3,54); - FUNC(3,55); FUNC(3,56); FUNC(3,57); FUNC(3,58); FUNC(3,59); - - FUNC(4,60); FUNC(4,61); FUNC(4,62); FUNC(4,63); FUNC(4,64); - FUNC(4,65); FUNC(4,66); FUNC(4,67); FUNC(4,68); FUNC(4,69); - FUNC(4,70); FUNC(4,71); FUNC(4,72); FUNC(4,73); FUNC(4,74); - FUNC(4,75); FUNC(4,76); FUNC(4,77); FUNC(4,78); FUNC(4,79); -#else /* !UNROLL_LOOPS */ - for (i = 0; i < 20; ++i) { - FUNC(1,i); - } - for (i = 20; i < 40; ++i) { - FUNC(2,i); - } - for (i = 40; i < 60; ++i) { - FUNC(3,i); - } - for (i = 60; i < 80; ++i) { - FUNC(4,i); - } -#endif /* !UNROLL_LOOPS */ - sha_info->digest[0] += A; - sha_info->digest[1] += B; - sha_info->digest[2] += C; - sha_info->digest[3] += D; - sha_info->digest[4] += E; -} - -union endianTest { - long Long; - char Char[sizeof(long)]; -}; - -static char isLittleEndian(void) -{ - static union endianTest u; - u.Long = 1; - return (u.Char[0] == 1); -} - -/* change endianness of data */ - -/* count is the number of bytes to do an endian flip */ -static void maybe_byte_reverse(apr_uint32_t *buffer, int count) -{ - int i; - apr_byte_t ct[4], *cp; - - if (isLittleEndian()) { /* do the swap only if it is little endian */ - count /= sizeof(apr_uint32_t); - cp = (apr_byte_t *) buffer; - for (i = 0; i < count; ++i) { - ct[0] = cp[0]; - ct[1] = cp[1]; - ct[2] = cp[2]; - ct[3] = cp[3]; - cp[0] = ct[3]; - cp[1] = ct[2]; - cp[2] = ct[1]; - cp[3] = ct[0]; - cp += sizeof(apr_uint32_t); - } - } -} - -/* initialize the SHA digest */ - -APU_DECLARE(void) apr_sha1_init(apr_sha1_ctx_t *sha_info) -{ - sha_info->digest[0] = 0x67452301L; - sha_info->digest[1] = 0xefcdab89L; - sha_info->digest[2] = 0x98badcfeL; - sha_info->digest[3] = 0x10325476L; - sha_info->digest[4] = 0xc3d2e1f0L; - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; - sha_info->local = 0; -} - -/* update the SHA digest */ - -APU_DECLARE(void) apr_sha1_update_binary(apr_sha1_ctx_t *sha_info, - const unsigned char *buffer, - unsigned int count) -{ - unsigned int i; - - if ((sha_info->count_lo + ((apr_uint32_t) count << 3)) < sha_info->count_lo) { - ++sha_info->count_hi; - } - sha_info->count_lo += (apr_uint32_t) count << 3; - sha_info->count_hi += (apr_uint32_t) count >> 29; - if (sha_info->local) { - i = SHA_BLOCKSIZE - sha_info->local; - if (i > count) { - i = count; - } - memcpy(((apr_byte_t *) sha_info->data) + sha_info->local, buffer, i); - count -= i; - buffer += i; - sha_info->local += i; - if (sha_info->local == SHA_BLOCKSIZE) { - maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); - sha_transform(sha_info); - } - else { - return; - } - } - while (count >= SHA_BLOCKSIZE) { - memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); - buffer += SHA_BLOCKSIZE; - count -= SHA_BLOCKSIZE; - maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); - sha_transform(sha_info); - } - memcpy(sha_info->data, buffer, count); - sha_info->local = count; -} - -APU_DECLARE(void) apr_sha1_update(apr_sha1_ctx_t *sha_info, const char *buf, - unsigned int count) -{ -#if APR_CHARSET_EBCDIC - int i; - const apr_byte_t *buffer = (const apr_byte_t *) buf; - apr_size_t inbytes_left, outbytes_left; - - if ((sha_info->count_lo + ((apr_uint32_t) count << 3)) < sha_info->count_lo) { - ++sha_info->count_hi; - } - sha_info->count_lo += (apr_uint32_t) count << 3; - sha_info->count_hi += (apr_uint32_t) count >> 29; - /* Is there a remainder of the previous Update operation? */ - if (sha_info->local) { - i = SHA_BLOCKSIZE - sha_info->local; - if (i > count) { - i = count; - } - inbytes_left = outbytes_left = i; - apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left, - ((apr_byte_t *) sha_info->data) + sha_info->local, - &outbytes_left); - count -= i; - buffer += i; - sha_info->local += i; - if (sha_info->local == SHA_BLOCKSIZE) { - maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); - sha_transform(sha_info); - } - else { - return; - } - } - while (count >= SHA_BLOCKSIZE) { - inbytes_left = outbytes_left = SHA_BLOCKSIZE; - apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left, - (apr_byte_t *) sha_info->data, &outbytes_left); - buffer += SHA_BLOCKSIZE; - count -= SHA_BLOCKSIZE; - maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); - sha_transform(sha_info); - } - inbytes_left = outbytes_left = count; - apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left, - (apr_byte_t *) sha_info->data, &outbytes_left); - sha_info->local = count; -#else - apr_sha1_update_binary(sha_info, (const unsigned char *) buf, count); -#endif -} - -/* finish computing the SHA digest */ - -APU_DECLARE(void) apr_sha1_final(unsigned char digest[APR_SHA1_DIGESTSIZE], - apr_sha1_ctx_t *sha_info) -{ - int count, i, j; - apr_uint32_t lo_bit_count, hi_bit_count, k; - - lo_bit_count = sha_info->count_lo; - hi_bit_count = sha_info->count_hi; - count = (int) ((lo_bit_count >> 3) & 0x3f); - ((apr_byte_t *) sha_info->data)[count++] = 0x80; - if (count > SHA_BLOCKSIZE - 8) { - memset(((apr_byte_t *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count); - maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); - sha_transform(sha_info); - memset((apr_byte_t *) sha_info->data, 0, SHA_BLOCKSIZE - 8); - } - else { - memset(((apr_byte_t *) sha_info->data) + count, 0, - SHA_BLOCKSIZE - 8 - count); - } - maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); - sha_info->data[14] = hi_bit_count; - sha_info->data[15] = lo_bit_count; - sha_transform(sha_info); - - for (i = 0, j = 0; j < APR_SHA1_DIGESTSIZE; i++) { - k = sha_info->digest[i]; - digest[j++] = (unsigned char) ((k >> 24) & 0xff); - digest[j++] = (unsigned char) ((k >> 16) & 0xff); - digest[j++] = (unsigned char) ((k >> 8) & 0xff); - digest[j++] = (unsigned char) (k & 0xff); - } -} - - -APU_DECLARE(void) apr_sha1_base64(const char *clear, int len, char *out) -{ - int l; - apr_sha1_ctx_t context; - apr_byte_t digest[APR_SHA1_DIGESTSIZE]; - - if (strncmp(clear, APR_SHA1PW_ID, APR_SHA1PW_IDLEN) == 0) { - clear += APR_SHA1PW_IDLEN; - } - - apr_sha1_init(&context); - apr_sha1_update(&context, clear, len); - apr_sha1_final(digest, &context); - - /* private marker. */ - apr_cpystrn(out, APR_SHA1PW_ID, APR_SHA1PW_IDLEN + 1); - - /* SHA1 hash is always 20 chars */ - l = apr_base64_encode_binary(out + APR_SHA1PW_IDLEN, digest, sizeof(digest)); - out[l + APR_SHA1PW_IDLEN] = '\0'; - - /* - * output of base64 encoded SHA1 is always 28 chars + APR_SHA1PW_IDLEN - */ -} diff --git a/libs/apr-util/crypto/getuuid.c b/libs/apr-util/crypto/getuuid.c deleted file mode 100644 index 293b24eeb2..0000000000 --- a/libs/apr-util/crypto/getuuid.c +++ /dev/null @@ -1,209 +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 attempts to generate V1 UUIDs according to the Internet Draft - * located at http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt - */ -#include "apr.h" -#include "apr_uuid.h" -#include "apr_general.h" -#include "apr_portable.h" -#if !APR_HAS_RANDOM -#include "apr_md5.h" -#endif - -#if APR_HAVE_UNISTD_H -#include <unistd.h> /* for getpid, gethostname */ -#endif -#if APR_HAVE_STDLIB_H -#include <stdlib.h> /* for rand, srand */ -#endif - - -#if APR_HAVE_STRING_H -#include <string.h> -#endif -#if APR_HAVE_STRINGS_H -#include <strings.h> -#endif -#if APR_HAVE_NETDB_H -#include <netdb.h> -#endif -#if APR_HAVE_SYS_TIME_H -#include <sys/time.h> /* for gettimeofday */ -#endif - -#define NODE_LENGTH 6 - -static int uuid_state_seqnum; -static unsigned char uuid_state_node[NODE_LENGTH] = { 0 }; - - -static void get_random_info(unsigned char node[NODE_LENGTH]) -{ -#if APR_HAS_RANDOM - - (void) apr_generate_random_bytes(node, NODE_LENGTH); - -#else - - unsigned char seed[APR_MD5_DIGESTSIZE]; - apr_md5_ctx_t c; - - /* ### probably should revise some of this to be a bit more portable */ - - /* Leach & Salz use Linux-specific struct sysinfo; - * replace with pid/tid for portability (in the spirit of mod_unique_id) */ - struct { - /* Add thread id here, if applicable, when we get to pthread or apr */ - pid_t pid; -#ifdef NETWARE - apr_uint64_t t; -#else - struct timeval t; -#endif - char hostname[257]; - - } r; - - apr_md5_init(&c); -#ifdef NETWARE - r.pid = NXThreadGetId(); - NXGetTime(NX_SINCE_BOOT, NX_USECONDS, &(r.t)); -#else - r.pid = getpid(); - gettimeofday(&r.t, (struct timezone *)0); -#endif - gethostname(r.hostname, 256); - apr_md5_update(&c, (const unsigned char *)&r, sizeof(r)); - apr_md5_final(seed, &c); - - memcpy(node, seed, NODE_LENGTH); /* use a subset of the seed bytes */ -#endif -} - -/* This implementation generates a random node ID instead of a - system-dependent call to get IEEE node ID. This is also more secure: - we aren't passing out our MAC address. -*/ -static void get_pseudo_node_identifier(unsigned char *node) -{ - get_random_info(node); - node[0] |= 0x01; /* this designates a random node ID */ -} - -static void get_system_time(apr_uint64_t *uuid_time) -{ - /* ### fix this call to be more portable? */ - *uuid_time = apr_time_now(); - - /* Offset between UUID formatted times and Unix formatted times. - UUID UTC base time is October 15, 1582. - Unix base time is January 1, 1970. */ - *uuid_time = (*uuid_time * 10) + APR_TIME_C(0x01B21DD213814000); -} - -/* true_random -- generate a crypto-quality random number. */ -static int true_random(void) -{ - apr_uint64_t time_now; - -#if APR_HAS_RANDOM - unsigned char buf[2]; - - if (apr_generate_random_bytes(buf, 2) == APR_SUCCESS) { - return (buf[0] << 8) | buf[1]; - } -#endif - - /* crap. this isn't crypto quality, but it will be Good Enough */ - - get_system_time(&time_now); - srand((unsigned int)(((time_now >> 32) ^ time_now) & 0xffffffff)); - - return rand() & 0x0FFFF; -} - -static void init_state(void) -{ - uuid_state_seqnum = true_random(); - get_pseudo_node_identifier(uuid_state_node); -} - -static void get_current_time(apr_uint64_t *timestamp) -{ - /* ### this needs to be made thread-safe! */ - - apr_uint64_t time_now; - static apr_uint64_t time_last = 0; - static apr_uint64_t fudge = 0; - - get_system_time(&time_now); - - /* if clock reading changed since last UUID generated... */ - if (time_last != time_now) { - /* The clock reading has changed since the last UUID was generated. - Reset the fudge factor. if we are generating them too fast, then - the fudge may need to be reset to something greater than zero. */ - if (time_last + fudge > time_now) - fudge = time_last + fudge - time_now + 1; - else - fudge = 0; - time_last = time_now; - } - else { - /* We generated two really fast. Bump the fudge factor. */ - ++fudge; - } - - *timestamp = time_now + fudge; -} - -APU_DECLARE(void) apr_uuid_get(apr_uuid_t *uuid) -{ - apr_uint64_t timestamp; - unsigned char *d = uuid->data; - -#if APR_HAS_OS_UUID - if (apr_os_uuid_get(d) == APR_SUCCESS) { - return; - } -#endif /* !APR_HAS_OS_UUID */ - - if (!uuid_state_node[0]) - init_state(); - - get_current_time(&timestamp); - - /* time_low, uint32 */ - d[3] = (unsigned char)timestamp; - d[2] = (unsigned char)(timestamp >> 8); - d[1] = (unsigned char)(timestamp >> 16); - d[0] = (unsigned char)(timestamp >> 24); - /* time_mid, uint16 */ - d[5] = (unsigned char)(timestamp >> 32); - d[4] = (unsigned char)(timestamp >> 40); - /* time_hi_and_version, uint16 */ - d[7] = (unsigned char)(timestamp >> 48); - d[6] = (unsigned char)(((timestamp >> 56) & 0x0F) | 0x10); - /* clock_seq_hi_and_reserved, uint8 */ - d[8] = (unsigned char)(((++uuid_state_seqnum >> 8) & 0x3F) | 0x80); - /* clock_seq_low, uint8 */ - d[9] = (unsigned char)uuid_state_seqnum; - /* node, byte[6] */ - memcpy(&d[10], uuid_state_node, NODE_LENGTH); -} diff --git a/libs/apr-util/crypto/uuid.c b/libs/apr-util/crypto/uuid.c deleted file mode 100644 index 451481b5a5..0000000000 --- a/libs/apr-util/crypto/uuid.c +++ /dev/null @@ -1,130 +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 <stdio.h> /* for sprintf */ - -#include "apr.h" -#include "apr_uuid.h" -#include "apr_errno.h" -#include "apr_lib.h" - - -APU_DECLARE(void) apr_uuid_format(char *buffer, const apr_uuid_t *uuid) -{ - const unsigned char *d = uuid->data; - - sprintf(buffer, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], - d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); -} - -/* convert a pair of hex digits to an integer value [0,255] */ -#if 'A' == 65 -static unsigned char parse_hexpair(const char *s) -{ - int result; - int temp; - - result = s[0] - '0'; - if (result > 48) - result = (result - 39) << 4; - else if (result > 16) - result = (result - 7) << 4; - else - result = result << 4; - - temp = s[1] - '0'; - if (temp > 48) - result |= temp - 39; - else if (temp > 16) - result |= temp - 7; - else - result |= temp; - - return (unsigned char)result; -} -#else -static unsigned char parse_hexpair(const char *s) -{ - int result; - - if (isdigit(*s)) { - result = (*s - '0') << 4; - } - else { - if (isupper(*s)) { - result = (*s - 'A' + 10) << 4; - } - else { - result = (*s - 'a' + 10) << 4; - } - } - - ++s; - if (isdigit(*s)) { - result |= (*s - '0'); - } - else { - if (isupper(*s)) { - result |= (*s - 'A' + 10); - } - else { - result |= (*s - 'a' + 10); - } - } - - return (unsigned char)result; -} -#endif - -APU_DECLARE(apr_status_t) apr_uuid_parse(apr_uuid_t *uuid, - const char *uuid_str) -{ - int i; - unsigned char *d = uuid->data; - - for (i = 0; i < 36; ++i) { - char c = uuid_str[i]; - if (!apr_isxdigit(c) && - !(c == '-' && (i == 8 || i == 13 || i == 18 || i == 23))) - /* ### need a better value */ - return APR_BADARG; - } - if (uuid_str[36] != '\0') { - /* ### need a better value */ - return APR_BADARG; - } - - d[0] = parse_hexpair(&uuid_str[0]); - d[1] = parse_hexpair(&uuid_str[2]); - d[2] = parse_hexpair(&uuid_str[4]); - d[3] = parse_hexpair(&uuid_str[6]); - - d[4] = parse_hexpair(&uuid_str[9]); - d[5] = parse_hexpair(&uuid_str[11]); - - d[6] = parse_hexpair(&uuid_str[14]); - d[7] = parse_hexpair(&uuid_str[16]); - - d[8] = parse_hexpair(&uuid_str[19]); - d[9] = parse_hexpair(&uuid_str[21]); - - for (i = 6; i--;) - d[10 + i] = parse_hexpair(&uuid_str[i*2+24]); - - return APR_SUCCESS; -} diff --git a/libs/apr-util/dbd/apr_dbd.c b/libs/apr-util/dbd/apr_dbd.c deleted file mode 100644 index d9ec11e04c..0000000000 --- a/libs/apr-util/dbd/apr_dbd.c +++ /dev/null @@ -1,303 +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 <stdio.h> - -#include "apu.h" -#include "apr_pools.h" -#include "apr_dbd_internal.h" -#include "apr_dbd.h" -#include "apr_hash.h" -#include "apr_thread_mutex.h" -#include "apr_dso.h" -#include "apr_strings.h" - -static apr_hash_t *drivers = NULL; - -#define CLEANUP_CAST (apr_status_t (*)(void*)) - -/* Once the autofoo supports building it for dynamic load, we can use - * #define APR_DSO_BUILD APR_HAS_DSO - */ - -#if APR_DSO_BUILD -#if APR_HAS_THREADS -static apr_thread_mutex_t* mutex = NULL; -#endif -#else -#define DRIVER_LOAD(name,driver,pool) \ - { \ - extern const apr_dbd_driver_t driver; \ - apr_hash_set(drivers,name,APR_HASH_KEY_STRING,&driver); \ - if (driver.init) { \ - driver.init(pool); \ - } \ - } -#endif - -static apr_status_t apr_dbd_term(void *ptr) -{ - /* set drivers to NULL so init can work again */ - drivers = NULL; - - /* Everything else we need is handled by cleanups registered - * when we created mutexes and loaded DSOs - */ - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool) -{ - apr_status_t ret = APR_SUCCESS; - - if (drivers != NULL) { - return APR_SUCCESS; - } - drivers = apr_hash_make(pool); - apr_pool_cleanup_register(pool, NULL, apr_dbd_term, - apr_pool_cleanup_null); - -#if APR_DSO_BUILD - -#if APR_HAS_THREADS - ret = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pool); - /* This already registers a pool cleanup */ -#endif - -#else - -#if APU_HAVE_MYSQL - DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool); -#endif -#if APU_HAVE_PGSQL - DRIVER_LOAD("pgsql", apr_dbd_pgsql_driver, pool); -#endif -#if APU_HAVE_SQLITE3 - DRIVER_LOAD("sqlite3", apr_dbd_sqlite3_driver, pool); -#endif -#if APU_HAVE_SQLITE2 - DRIVER_LOAD("sqlite2", apr_dbd_sqlite2_driver, pool); -#endif -#if APU_HAVE_SOME_OTHER_BACKEND - DRIVER_LOAD("firebird", apr_dbd_other_driver, pool); -#endif -#endif - return ret; -} -APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name, - const apr_dbd_driver_t **driver) -{ -#if APR_DSO_BUILD - char path[80]; - apr_dso_handle_t *dlhandle = NULL; -#endif - apr_status_t rv; - - *driver = apr_hash_get(drivers, name, APR_HASH_KEY_STRING); - if (*driver) { - return APR_SUCCESS; - } - -#if APR_DSO_BUILD - -#if APR_HAS_THREADS - rv = apr_thread_mutex_lock(mutex); - if (rv != APR_SUCCESS) { - goto unlock; - } - *driver = apr_hash_get(drivers, name, APR_HASH_KEY_STRING); - if (*driver) { - goto unlock; - } -#endif - -#ifdef WIN32 - sprintf(path, "apr_dbd_%s.dll", name); -#else - sprintf(path, "apr_dbd_%s.so", name); -#endif - rv = apr_dso_load(&dlhandle, path, pool); - if (rv != APR_SUCCESS) { /* APR_EDSOOPEN */ - goto unlock; - } - sprintf(path, "apr_dbd_%s_driver", name); - rv = apr_dso_sym((void*)driver, dlhandle, path); - if (rv != APR_SUCCESS) { /* APR_ESYMNOTFOUND */ - apr_dso_unload(dlhandle); - goto unlock; - } - if ((*driver)->init) { - (*driver)->init(pool); - } - apr_hash_set(drivers, name, APR_HASH_KEY_STRING, *driver); - -unlock: -#if APR_HAS_THREADS - apr_thread_mutex_unlock(mutex); -#endif - -#else /* APR_DSO_BUILD - so if it wasn't already loaded, it's NOTIMPL */ - rv = APR_ENOTIMPL; -#endif - - return rv; -} -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_status_t rv; - *handle = driver->open(pool, params); - if (*handle == NULL) { - return APR_EGENERAL; - } - rv = apr_dbd_check_conn(driver, pool, *handle); - if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) { - apr_dbd_close(driver, *handle); - return APR_EGENERAL; - } - return APR_SUCCESS; -} -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) -{ - int ret = driver->start_transaction(pool, handle, trans); - if (*trans) { - apr_pool_cleanup_register(pool, *trans, - CLEANUP_CAST driver->end_transaction, - apr_pool_cleanup_null); - } - return ret; -} -APU_DECLARE(int) apr_dbd_transaction_end(const apr_dbd_driver_t *driver, - apr_pool_t *pool, - apr_dbd_transaction_t *trans) -{ - apr_pool_cleanup_kill(pool, trans, CLEANUP_CAST driver->end_transaction); - return driver->end_transaction(trans); -} - -APU_DECLARE(apr_status_t) apr_dbd_close(const apr_dbd_driver_t *driver, - apr_dbd_t *handle) -{ - return driver->close(handle); -} -APU_DECLARE(const char*) apr_dbd_name(const apr_dbd_driver_t *driver) -{ - return driver->name; -} -APU_DECLARE(void*) apr_dbd_native_handle(const apr_dbd_driver_t *driver, - apr_dbd_t *handle) -{ - return driver->native_handle(handle); -} -APU_DECLARE(int) apr_dbd_check_conn(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle) -{ - return driver->check_conn(pool, handle); -} -APU_DECLARE(int) apr_dbd_set_dbname(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle, const char *name) -{ - return driver->set_dbname(pool,handle,name); -} -APU_DECLARE(int) apr_dbd_query(const apr_dbd_driver_t *driver, apr_dbd_t *handle, - int *nrows, const char *statement) -{ - return driver->query(handle,nrows,statement); -} -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) -{ - return driver->select(pool,handle,res,statement,random); -} -APU_DECLARE(int) apr_dbd_num_cols(const apr_dbd_driver_t *driver, - apr_dbd_results_t *res) -{ - return driver->num_cols(res); -} -APU_DECLARE(int) apr_dbd_num_tuples(const apr_dbd_driver_t *driver, - apr_dbd_results_t *res) -{ - return driver->num_tuples(res); -} -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) -{ - return driver->get_row(pool,res,row,rownum); -} -APU_DECLARE(const char*) apr_dbd_get_entry(const apr_dbd_driver_t *driver, - apr_dbd_row_t *row, int col) -{ - return driver->get_entry(row,col); -} -APU_DECLARE(const char*) apr_dbd_error(const apr_dbd_driver_t *driver, - apr_dbd_t *handle, int errnum) -{ - return driver->error(handle,errnum); -} -APU_DECLARE(const char*) apr_dbd_escape(const apr_dbd_driver_t *driver, - apr_pool_t *pool, const char *string, - apr_dbd_t *handle) -{ - return driver->escape(pool,string,handle); -} -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) -{ - return driver->prepare(pool,handle,query,label,statement); -} -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) -{ - return driver->pquery(pool,handle,nrows,statement,nargs,args); -} -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) -{ - return driver->pselect(pool,handle,res,statement,random,nargs,args); -} -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,...) -{ - int ret; - va_list args; - va_start(args, statement); - ret = driver->pvquery(pool,handle,nrows,statement,args); - va_end(args); - return ret; -} -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,...) -{ - int ret; - va_list args; - va_start(args, random); - ret = driver->pvselect(pool,handle,res,statement,random,args); - va_end(args); - return ret; -} diff --git a/libs/apr-util/dbd/apr_dbd_pgsql.c b/libs/apr-util/dbd/apr_dbd_pgsql.c deleted file mode 100644 index 76bfa0c11f..0000000000 --- a/libs/apr-util/dbd/apr_dbd_pgsql.c +++ /dev/null @@ -1,664 +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" - -#if APU_HAVE_PGSQL - -#include "apu_config.h" - -#include <ctype.h> -#include <stdlib.h> - -#ifdef HAVE_LIBPQ_FE_H -#include <libpq-fe.h> -#elif defined(HAVE_POSTGRESQL_LIBPQ_FE_H) -#include <postgresql/libpq-fe.h> -#endif - -#include "apr_strings.h" -#include "apr_time.h" - -#include "apr_dbd_internal.h" - -#define QUERY_MAX_ARGS 40 - -struct apr_dbd_transaction_t { - int errnum; - apr_dbd_t *handle; -}; - -struct apr_dbd_t { - PGconn *conn; - apr_dbd_transaction_t *trans; -}; - -struct apr_dbd_results_t { - int random; - PGconn *handle; - PGresult *res; - size_t ntuples; - size_t sz; - size_t index; -}; - -struct apr_dbd_row_t { - int n; - apr_dbd_results_t *res; -}; - -struct apr_dbd_prepared_t { - const char *name; - int prepared; - int nargs; -}; - -#define dbd_pgsql_is_success(x) (((x) == PGRES_EMPTY_QUERY) \ - || ((x) == PGRES_COMMAND_OK) \ - || ((x) == PGRES_TUPLES_OK)) - -static apr_status_t clear_result(void *data) -{ - PQclear(data); - return APR_SUCCESS; -} - -static int dbd_pgsql_select(apr_pool_t *pool, apr_dbd_t *sql, - apr_dbd_results_t **results, - const char *query, int seek) -{ - PGresult *res; - int ret; - if ( sql->trans && sql->trans->errnum ) { - return sql->trans->errnum; - } - if (seek) { /* synchronous query */ - res = PQexec(sql->conn, query); - if (res) { - ret = PQresultStatus(res); - if (dbd_pgsql_is_success(ret)) { - ret = 0; - } else { - PQclear(res); - } - } else { - ret = PGRES_FATAL_ERROR; - } - if (ret != 0) { - if (sql->trans) { - sql->trans->errnum = ret; - } - return ret; - } - if (!*results) { - *results = apr_pcalloc(pool, sizeof(apr_dbd_results_t)); - } - (*results)->res = res; - (*results)->ntuples = PQntuples(res); - (*results)->sz = PQnfields(res); - (*results)->random = seek; - apr_pool_cleanup_register(pool, res, clear_result, - apr_pool_cleanup_null); - } - else { - if (PQsendQuery(sql->conn, query) == 0) { - if (sql->trans) { - sql->trans->errnum = 1; - } - return 1; - } - if (*results == NULL) { - *results = apr_pcalloc(pool, sizeof(apr_dbd_results_t)); - } - (*results)->random = seek; - (*results)->handle = sql->conn; - } - return 0; -} - -static int dbd_pgsql_get_row(apr_pool_t *pool, apr_dbd_results_t *res, - apr_dbd_row_t **rowp, int rownum) -{ - apr_dbd_row_t *row = *rowp; - int sequential = ((rownum >= 0) && res->random) ? 0 : 1; - - if (row == NULL) { - row = apr_palloc(pool, sizeof(apr_dbd_row_t)); - *rowp = row; - row->res = res; - row->n = sequential ? 0 : rownum; - } - else { - if ( sequential ) { - ++row->n; - } - else { - row->n = rownum; - } - } - - if (res->random) { - if (row->n >= res->ntuples) { - *rowp = NULL; - apr_pool_cleanup_run(pool, res->res, clear_result); - res->res = NULL; - return -1; - } - } - else { - if (row->n >= res->ntuples) { - /* no data; we have to fetch some */ - row->n -= res->ntuples; - if (res->res != NULL) { - PQclear(res->res); - } - res->res = PQgetResult(res->handle); - if (res->res) { - res->ntuples = PQntuples(res->res); - while (res->ntuples == 0) { - /* if we got an empty result, clear it, wait a mo, try - * again */ - PQclear(res->res); - apr_sleep(100000); /* 0.1 secs */ - res->res = PQgetResult(res->handle); - if (res->res) { - res->ntuples = PQntuples(res->res); - } - else { - return -1; - } - } - if (res->sz == 0) { - res->sz = PQnfields(res->res); - } - } - else { - return -1; - } - } - } - return 0; -} - -static const char *dbd_pgsql_get_entry(const apr_dbd_row_t *row, int n) -{ - return PQgetvalue(row->res->res, row->n, n); -} - -static const char *dbd_pgsql_error(apr_dbd_t *sql, int n) -{ - return PQerrorMessage(sql->conn); -} - -static int dbd_pgsql_query(apr_dbd_t *sql, int *nrows, const char *query) -{ - PGresult *res; - int ret; - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - res = PQexec(sql->conn, query); - if (res) { - ret = PQresultStatus(res); - if (dbd_pgsql_is_success(ret)) { - /* ugh, making 0 return-success doesn't fit */ - ret = 0; - } - *nrows = atoi(PQcmdTuples(res)); - PQclear(res); - } - else { - ret = PGRES_FATAL_ERROR; - } - if (sql->trans) { - sql->trans->errnum = ret; - } - return ret; -} - -static const char *dbd_pgsql_escape(apr_pool_t *pool, const char *arg, - apr_dbd_t *sql) -{ - size_t len = strlen(arg); - char *ret = apr_palloc(pool, 2*(len + 1)); - PQescapeString(ret, arg, len); - return ret; -} - -static int dbd_pgsql_prepare(apr_pool_t *pool, apr_dbd_t *sql, - const char *query, const char *label, - apr_dbd_prepared_t **statement) -{ - char *sqlcmd; - char *sqlptr; - size_t length; - size_t i = 0; - const char *args[QUERY_MAX_ARGS]; - size_t alen; - int ret; - PGresult *res; - char *pgquery; - char *pgptr; - - if (!*statement) { - *statement = apr_palloc(pool, sizeof(apr_dbd_prepared_t)); - } - (*statement)->nargs = 0; - /* Translate from apr_dbd to native query format */ - for (sqlptr = (char*)query; *sqlptr; ++sqlptr) { - if (sqlptr[0] == '%') { - if (isalpha(sqlptr[1])) { - ++(*statement)->nargs; - } - else if (sqlptr[1] == '%') { - ++sqlptr; - } - } - } - length = strlen(query) + 1; - if ((*statement)->nargs > 8) { - length += (*statement)->nargs - 8; - } - pgptr = pgquery = apr_palloc(pool, length) ; - - for (sqlptr = (char*)query; *sqlptr; ++sqlptr) { - if ((sqlptr[0] == '%') && isalpha(sqlptr[1])) { - *pgptr++ = '$'; - if (i < 9) { - *pgptr++ = '1' + i; - } - else { - *pgptr++ = '0' + ((i+1)/10); - *pgptr++ = '0' + ((i+1)%10); - } - switch (*++sqlptr) { - case 'd': - args[i] = "integer"; - break; - case 's': - args[i] = "varchar"; - break; - default: - args[i] = "varchar"; - break; - } - length += 1 + strlen(args[i]); - ++i; - } - else if ((sqlptr[0] == '%') && (sqlptr[1] == '%')) { - /* reduce %% to % */ - *pgptr++ = *sqlptr++; - } - else { - *pgptr++ = *sqlptr; - } - } - *pgptr = 0; - - if (!label) { - /* don't really prepare; use in execParams instead */ - (*statement)->prepared = 0; - (*statement)->name = apr_pstrdup(pool, pgquery); - return 0; - } - (*statement)->name = apr_pstrdup(pool, label); - - /* length of SQL query that prepares this statement */ - length = 8 + strlen(label) + 2 + 4 + length + 1; - sqlcmd = apr_palloc(pool, length); - sqlptr = sqlcmd; - memcpy(sqlptr, "PREPARE ", 8); - sqlptr += 8; - length = strlen(label); - memcpy(sqlptr, label, length); - sqlptr += length; - if ((*statement)->nargs > 0) { - memcpy(sqlptr, " (",2); - sqlptr += 2; - for (i=0; i < (*statement)->nargs; ++i) { - alen = strlen(args[i]); - memcpy(sqlptr, args[i], alen); - sqlptr += alen; - *sqlptr++ = ','; - } - sqlptr[-1] = ')'; - } - memcpy(sqlptr, " AS ", 4); - sqlptr += 4; - memcpy(sqlptr, pgquery, strlen(pgquery)); - sqlptr += strlen(pgquery); - *sqlptr = 0; - - res = PQexec(sql->conn, sqlcmd); - if ( res ) { - ret = PQresultStatus(res); - if (dbd_pgsql_is_success(ret)) { - ret = 0; - } - /* Hmmm, do we do this here or register it on the pool? */ - PQclear(res); - } - else { - ret = PGRES_FATAL_ERROR; - } - (*statement)->prepared = 1; - - return ret; -} - -static int dbd_pgsql_pquery(apr_pool_t *pool, apr_dbd_t *sql, - int *nrows, apr_dbd_prepared_t *statement, - int nargs, const char **values) -{ - int ret; - PGresult *res; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - if (statement->prepared) { - res = PQexecPrepared(sql->conn, statement->name, nargs, values, 0, 0, - 0); - } - else { - res = PQexecParams(sql->conn, statement->name, nargs, 0, values, 0, 0, - 0); - } - if (res) { - ret = PQresultStatus(res); - if (dbd_pgsql_is_success(ret)) { - ret = 0; - } - *nrows = atoi(PQcmdTuples(res)); - PQclear(res); - } - else { - ret = PGRES_FATAL_ERROR; - } - - if (sql->trans) { - sql->trans->errnum = ret; - } - return ret; -} - -static int dbd_pgsql_pvquery(apr_pool_t *pool, apr_dbd_t *sql, - int *nrows, apr_dbd_prepared_t *statement, - va_list args) -{ - const char **values; - int i; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - values = apr_palloc(pool, sizeof(*values) * statement->nargs); - - for (i = 0; i < statement->nargs; i++) { - values[i] = apr_pstrdup(pool, va_arg(args, const char*)); - } - - return dbd_pgsql_pquery(pool, sql, nrows, statement, - statement->nargs, values); -} - -static int dbd_pgsql_pselect(apr_pool_t *pool, apr_dbd_t *sql, - apr_dbd_results_t **results, - apr_dbd_prepared_t *statement, - int seek, int nargs, const char **values) -{ - PGresult *res; - int rv; - int ret = 0; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - if (seek) { /* synchronous query */ - if (statement->prepared) { - res = PQexecPrepared(sql->conn, statement->name, nargs, values, 0, - 0, 0); - } - else { - res = PQexecParams(sql->conn, statement->name, nargs, 0, values, 0, - 0, 0); - } - if (res) { - ret = PQresultStatus(res); - if (dbd_pgsql_is_success(ret)) { - ret = 0; - } - else { - PQclear(res); - } - } - else { - ret = PGRES_FATAL_ERROR; - } - if (ret != 0) { - if (sql->trans) { - sql->trans->errnum = ret; - } - return ret; - } - if (!*results) { - *results = apr_pcalloc(pool, sizeof(apr_dbd_results_t)); - } - (*results)->res = res; - (*results)->ntuples = PQntuples(res); - (*results)->sz = PQnfields(res); - (*results)->random = seek; - apr_pool_cleanup_register(pool, res, clear_result, - apr_pool_cleanup_null); - } - else { - if (statement->prepared) { - rv = PQsendQueryPrepared(sql->conn, statement->name, nargs, values, - 0, 0, 0); - } - else { - rv = PQsendQueryParams(sql->conn, statement->name, nargs, 0, - values, 0, 0, 0); - } - if (rv == 0) { - if (sql->trans) { - sql->trans->errnum = 1; - } - return 1; - } - if (!*results) { - *results = apr_pcalloc(pool, sizeof(apr_dbd_results_t)); - } - (*results)->random = seek; - (*results)->handle = sql->conn; - } - - if (sql->trans) { - sql->trans->errnum = ret; - } - return ret; -} - -static int dbd_pgsql_pvselect(apr_pool_t *pool, apr_dbd_t *sql, - apr_dbd_results_t **results, - apr_dbd_prepared_t *statement, - int seek, va_list args) -{ - const char **values; - int i; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - values = apr_palloc(pool, sizeof(*values) * statement->nargs); - - for (i = 0; i < statement->nargs; i++) { - values[i] = apr_pstrdup(pool, va_arg(args, const char*)); - } - - return dbd_pgsql_pselect(pool, sql, results, statement, - seek, statement->nargs, values) ; -} - -static int dbd_pgsql_start_transaction(apr_pool_t *pool, apr_dbd_t *handle, - apr_dbd_transaction_t **trans) -{ - int ret = 0; - PGresult *res; - - /* XXX handle recursive transactions here */ - - res = PQexec(handle->conn, "BEGIN TRANSACTION"); - if (res) { - ret = PQresultStatus(res); - if (dbd_pgsql_is_success(ret)) { - ret = 0; - if (!*trans) { - *trans = apr_pcalloc(pool, sizeof(apr_dbd_transaction_t)); - } - } - PQclear(res); - (*trans)->handle = handle; - handle->trans = *trans; - } - else { - ret = PGRES_FATAL_ERROR; - } - return ret; -} - -static int dbd_pgsql_end_transaction(apr_dbd_transaction_t *trans) -{ - PGresult *res; - int ret = -1; /* no transaction is an error cond */ - if (trans) { - if (trans->errnum) { - trans->errnum = 0; - res = PQexec(trans->handle->conn, "ROLLBACK"); - } - else { - res = PQexec(trans->handle->conn, "COMMIT"); - } - if (res) { - ret = PQresultStatus(res); - if (dbd_pgsql_is_success(ret)) { - ret = 0; - } - PQclear(res); - } - else { - ret = PGRES_FATAL_ERROR; - } - trans->handle->trans = NULL; - } - return ret; -} - -static apr_dbd_t *dbd_pgsql_open(apr_pool_t *pool, const char *params) -{ - apr_dbd_t *sql; - - PGconn *conn = PQconnectdb(params); - - /* if there's an error in the connect string or something we get - * back a * bogus connection object, and things like PQreset are - * liable to segfault, so just close it out now. it would be nice - * if we could give an indication of why we failed to connect... */ - if (PQstatus(conn) != CONNECTION_OK) { - PQfinish(conn); - return NULL; - } - - sql = apr_pcalloc (pool, sizeof (*sql)); - - sql->conn = conn; - - return sql; -} - -static apr_status_t dbd_pgsql_close(apr_dbd_t *handle) -{ - PQfinish(handle->conn); - return APR_SUCCESS; -} - -static apr_status_t dbd_pgsql_check_conn(apr_pool_t *pool, - apr_dbd_t *handle) -{ - if (PQstatus(handle->conn) != CONNECTION_OK) { - PQreset(handle->conn); - if (PQstatus(handle->conn) != CONNECTION_OK) { - return APR_EGENERAL; - } - } - return APR_SUCCESS; -} - -static int dbd_pgsql_select_db(apr_pool_t *pool, apr_dbd_t *handle, - const char *name) -{ - return APR_ENOTIMPL; -} - -static void *dbd_pgsql_native(apr_dbd_t *handle) -{ - return handle->conn; -} - -static int dbd_pgsql_num_cols(apr_dbd_results_t* res) -{ - return res->sz; -} - -static int dbd_pgsql_num_tuples(apr_dbd_results_t* res) -{ - if (res->random) { - return res->ntuples; - } - else { - return -1; - } -} - -APU_DECLARE_DATA const apr_dbd_driver_t apr_dbd_pgsql_driver = { - "pgsql", - NULL, - dbd_pgsql_native, - dbd_pgsql_open, - dbd_pgsql_check_conn, - dbd_pgsql_close, - dbd_pgsql_select_db, - dbd_pgsql_start_transaction, - dbd_pgsql_end_transaction, - dbd_pgsql_query, - dbd_pgsql_select, - dbd_pgsql_num_cols, - dbd_pgsql_num_tuples, - dbd_pgsql_get_row, - dbd_pgsql_get_entry, - dbd_pgsql_error, - dbd_pgsql_escape, - dbd_pgsql_prepare, - dbd_pgsql_pvquery, - dbd_pgsql_pvselect, - dbd_pgsql_pquery, - dbd_pgsql_pselect, -}; -#endif diff --git a/libs/apr-util/dbd/apr_dbd_sqlite2.c b/libs/apr-util/dbd/apr_dbd_sqlite2.c deleted file mode 100644 index d93bf11100..0000000000 --- a/libs/apr-util/dbd/apr_dbd_sqlite2.c +++ /dev/null @@ -1,396 +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" - -#if APU_HAVE_SQLITE2 - -#include <ctype.h> -#include <stdlib.h> - -#include <sqlite.h> - -#include "apr_strings.h" -#include "apr_time.h" - -#include "apr_dbd_internal.h" - -struct apr_dbd_transaction_t { - int errnum; - apr_dbd_t *handle; -}; - -struct apr_dbd_t { - sqlite *conn; - char *errmsg; - apr_dbd_transaction_t *trans; -}; - -struct apr_dbd_results_t { - int random; - sqlite *handle; - char **res; - size_t ntuples; - size_t sz; - size_t index; -}; - -struct apr_dbd_row_t { - int n; - char **data; - apr_dbd_results_t *res; -}; - -struct apr_dbd_prepared_t { - const char *name; - int prepared; -}; - -#define FREE_ERROR_MSG(dbd) \ - do { \ - if(dbd && dbd->errmsg) { \ - free(dbd->errmsg); \ - dbd->errmsg = NULL; \ - } \ - } while(0); - -static apr_status_t free_table(void *data) -{ - sqlite_free_table(data); - return APR_SUCCESS; -} - -static int dbd_sqlite_select(apr_pool_t * pool, apr_dbd_t * sql, - apr_dbd_results_t ** results, const char *query, - int seek) -{ - char **result; - int ret = 0; - int tuples = 0; - int fields = 0; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - FREE_ERROR_MSG(sql); - - ret = sqlite_get_table(sql->conn, query, &result, &tuples, &fields, - &sql->errmsg); - - if (ret == SQLITE_OK) { - if (!*results) { - *results = apr_pcalloc(pool, sizeof(apr_dbd_results_t)); - } - - (*results)->res = result; - (*results)->ntuples = tuples; - (*results)->sz = fields; - (*results)->random = seek; - - if (tuples > 0) - apr_pool_cleanup_register(pool, result, free_table, - apr_pool_cleanup_null); - - ret = 0; - } - else { - sql->trans->errnum = ret; - } - - return ret; -} - -static int dbd_sqlite_get_row(apr_pool_t * pool, apr_dbd_results_t * res, - apr_dbd_row_t ** rowp, int rownum) -{ - apr_dbd_row_t *row = *rowp; - int sequential = ((rownum >= 0) && res->random) ? 0 : 1; - - if (row == NULL) { - row = apr_palloc(pool, sizeof(apr_dbd_row_t)); - *rowp = row; - row->res = res; - row->n = sequential ? 0 : rownum - 1; - } - else { - if (sequential) { - ++row->n; - } - else { - row->n = rownum - 1; - } - } - - if (row->n >= res->ntuples) { - *rowp = NULL; - apr_pool_cleanup_run(pool, res->res, free_table); - res->res = NULL; - return -1; - } - - /* Pointer magic explanation: - * The sqlite result is an array such that the first res->sz elements are - * the column names and each tuple follows afterwards - * ex: (from the sqlite2 documentation) - SELECT employee_name, login, host FROM users WHERE login LIKE * 'd%'; - - nrow = 2 - ncolumn = 3 - result[0] = "employee_name" - result[1] = "login" - result[2] = "host" - result[3] = "dummy" - result[4] = "No such user" - result[5] = 0 - result[6] = "D. Richard Hipp" - result[7] = "drh" - result[8] = "zadok" - */ - - row->data = res->res + res->sz + (res->sz * row->n); - - return 0; -} - -static const char *dbd_sqlite_get_entry(const apr_dbd_row_t * row, int n) -{ - if ((n < 0) || (n >= row->res->sz)) { - return NULL; - } - - return row->data[n]; -} - -static const char *dbd_sqlite_error(apr_dbd_t * sql, int n) -{ - return sql->errmsg; -} - -static int dbd_sqlite_query(apr_dbd_t * sql, int *nrows, const char *query) -{ - char **result; - int ret; - int tuples = 0; - int fields = 0; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - FREE_ERROR_MSG(sql); - - ret = - sqlite_get_table(sql->conn, query, &result, &tuples, &fields, - &sql->errmsg); - if (ret == SQLITE_OK) { - *nrows = sqlite_changes(sql->conn); - - if (tuples > 0) - free(result); - - ret = 0; - } - - if (sql->trans) { - sql->trans->errnum = ret; - } - - return ret; -} - -static apr_status_t free_mem(void *data) -{ - sqlite_freemem(data); - return APR_SUCCESS; -} - -static const char *dbd_sqlite_escape(apr_pool_t * pool, const char *arg, - apr_dbd_t * sql) -{ - char *ret = sqlite_mprintf("%q", arg); - apr_pool_cleanup_register(pool, ret, free_mem, apr_pool_cleanup_null); - return ret; -} - -static int dbd_sqlite_prepare(apr_pool_t * pool, apr_dbd_t * sql, - const char *query, const char *label, - apr_dbd_prepared_t ** statement) -{ - return APR_ENOTIMPL; -} - -static int dbd_sqlite_pquery(apr_pool_t * pool, apr_dbd_t * sql, - int *nrows, apr_dbd_prepared_t * statement, - int nargs, const char **values) -{ - return APR_ENOTIMPL; -} - -static int dbd_sqlite_pvquery(apr_pool_t * pool, apr_dbd_t * sql, - int *nrows, apr_dbd_prepared_t * statement, - va_list args) -{ - return APR_ENOTIMPL; -} - -static int dbd_sqlite_pselect(apr_pool_t * pool, apr_dbd_t * sql, - apr_dbd_results_t ** results, - apr_dbd_prepared_t * statement, - int seek, int nargs, const char **values) -{ - return APR_ENOTIMPL; -} - -static int dbd_sqlite_pvselect(apr_pool_t * pool, apr_dbd_t * sql, - apr_dbd_results_t ** results, - apr_dbd_prepared_t * statement, int seek, - va_list args) -{ - return APR_ENOTIMPL; -} - -static int dbd_sqlite_start_transaction(apr_pool_t * pool, apr_dbd_t * handle, - apr_dbd_transaction_t ** trans) -{ - int ret, rows; - - ret = dbd_sqlite_query(handle, &rows, "BEGIN TRANSACTION"); - if (ret == 0) { - if (!*trans) { - *trans = apr_pcalloc(pool, sizeof(apr_dbd_transaction_t)); - } - (*trans)->handle = handle; - handle->trans = *trans; - } - else { - ret = -1; - } - return ret; -} - -static int dbd_sqlite_end_transaction(apr_dbd_transaction_t * trans) -{ - int rows; - int ret = -1; /* no transaction is an error cond */ - - if (trans) { - if (trans->errnum) { - trans->errnum = 0; - ret = - dbd_sqlite_query(trans->handle, &rows, - "ROLLBACK TRANSACTION"); - } - else { - ret = - dbd_sqlite_query(trans->handle, &rows, "COMMIT TRANSACTION"); - } - trans->handle->trans = NULL; - } - - return ret; -} - -static apr_dbd_t *dbd_sqlite_open(apr_pool_t * pool, const char *params_) -{ - apr_dbd_t *sql; - sqlite *conn = NULL; - char *perm; - int iperms = 600; - char* params = apr_pstrdup(pool, params_); - /* params = "[filename]:[permissions]" - * example: "shopping.db:600" - */ - - perm = strstr(params, ":"); - if (perm) { - *(perm++) = '\x00'; /* split the filename and permissions */ - - if (strlen(perm) > 0) - iperms = atoi(perm); - } - - conn = sqlite_open(params, iperms, NULL); - - sql = apr_pcalloc(pool, sizeof(*sql)); - sql->conn = conn; - - return sql; -} - -static apr_status_t dbd_sqlite_close(apr_dbd_t * handle) -{ - if (handle->conn) { - sqlite_close(handle->conn); - handle->conn = NULL; - } - return APR_SUCCESS; -} - -static apr_status_t dbd_sqlite_check_conn(apr_pool_t * pool, - apr_dbd_t * handle) -{ - if (handle->conn == NULL) - return -1; - return APR_SUCCESS; -} - -static int dbd_sqlite_select_db(apr_pool_t * pool, apr_dbd_t * handle, - const char *name) -{ - return APR_ENOTIMPL; -} - -static void *dbd_sqlite_native(apr_dbd_t * handle) -{ - return handle->conn; -} - -static int dbd_sqlite_num_cols(apr_dbd_results_t * res) -{ - return res->sz; -} - -static int dbd_sqlite_num_tuples(apr_dbd_results_t * res) -{ - return res->ntuples; -} - -APU_DECLARE_DATA const apr_dbd_driver_t apr_dbd_sqlite2_driver = { - "sqlite2", - NULL, - dbd_sqlite_native, - dbd_sqlite_open, - dbd_sqlite_check_conn, - dbd_sqlite_close, - dbd_sqlite_select_db, - dbd_sqlite_start_transaction, - dbd_sqlite_end_transaction, - dbd_sqlite_query, - dbd_sqlite_select, - dbd_sqlite_num_cols, - dbd_sqlite_num_tuples, - dbd_sqlite_get_row, - dbd_sqlite_get_entry, - dbd_sqlite_error, - dbd_sqlite_escape, - dbd_sqlite_prepare, - dbd_sqlite_pvquery, - dbd_sqlite_pvselect, - dbd_sqlite_pquery, - dbd_sqlite_pselect, -}; -#endif diff --git a/libs/apr-util/dbd/apr_dbd_sqlite3.c b/libs/apr-util/dbd/apr_dbd_sqlite3.c deleted file mode 100644 index d82e3d31d2..0000000000 --- a/libs/apr-util/dbd/apr_dbd_sqlite3.c +++ /dev/null @@ -1,723 +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" - -#if APU_HAVE_SQLITE3 - -#include <ctype.h> -#include <stdlib.h> - -#include <sqlite3.h> - -#include "apr_strings.h" -#include "apr_time.h" - -#include "apr_dbd_internal.h" - -#define MAX_RETRY_COUNT 15 -#define MAX_RETRY_SLEEP 100000 - -struct apr_dbd_transaction_t { - int errnum; - apr_dbd_t *handle; -}; - -struct apr_dbd_t { - sqlite3 *conn; - apr_dbd_transaction_t *trans; -#if APR_HAS_THREADS - apr_thread_mutex_t *mutex; -#endif - apr_pool_t *pool; - apr_dbd_prepared_t *prep; -}; - -typedef struct { - char *name; - char *value; - int size; - int type; -} apr_dbd_column_t; - -struct apr_dbd_row_t { - apr_dbd_results_t *res; - apr_dbd_column_t **columns; - apr_dbd_row_t *next_row; - int columnCount; - int rownum; -}; - -struct apr_dbd_results_t { - int random; - sqlite3 *handle; - sqlite3_stmt *stmt; - apr_dbd_row_t *next_row; - size_t sz; - int tuples; - char **col_names; -}; - -struct apr_dbd_prepared_t { - sqlite3_stmt *stmt; - apr_dbd_prepared_t *next; -}; - -#define dbd_sqlite3_is_success(x) (((x) == SQLITE_DONE ) \ - || ((x) == SQLITE_OK )) - -static int dbd_sqlite3_select(apr_pool_t * pool, apr_dbd_t * sql, apr_dbd_results_t ** results, const char *query, int seek) -{ - sqlite3_stmt *stmt = NULL; - const char *tail = NULL; - int i, ret, retry_count = 0; - size_t num_tuples = 0; - int increment = 0; - apr_dbd_row_t *row = NULL; - apr_dbd_row_t *lastrow = NULL; - apr_dbd_column_t *column; - char *hold = NULL; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - - ret = sqlite3_prepare(sql->conn, query, strlen(query), &stmt, &tail); - if (!dbd_sqlite3_is_success(ret)) { -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - return ret; - } else { - int column_count; - column_count = sqlite3_column_count(stmt); - if (!*results) { - *results = apr_pcalloc(pool, sizeof(apr_dbd_results_t)); - } - (*results)->stmt = stmt; - (*results)->sz = column_count; - (*results)->random = seek; - (*results)->next_row = 0; - (*results)->tuples = 0; - (*results)->col_names = apr_pcalloc(pool, - column_count * sizeof(char *)); - do { - ret = sqlite3_step(stmt); - if (ret == SQLITE_BUSY) { - if (retry_count++ > MAX_RETRY_COUNT) { - ret = SQLITE_ERROR; - } else { -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - apr_sleep(MAX_RETRY_SLEEP); -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - } - } else if (ret == SQLITE_ROW) { - int length; - apr_dbd_column_t *col; - row = apr_palloc(pool, sizeof(apr_dbd_row_t)); - row->res = *results; - increment = sizeof(apr_dbd_column_t *); - length = increment * (*results)->sz; - row->columns = apr_palloc(pool, length); - row->columnCount = column_count; - for (i = 0; i < (*results)->sz; i++) { - column = apr_palloc(pool, sizeof(apr_dbd_column_t)); - row->columns[i] = column; - /* copy column name once only */ - if ((*results)->col_names[i] == NULL) { - (*results)->col_names[i] = - apr_pstrdup(pool, sqlite3_column_name(stmt, i)); - } - column->name = (*results)->col_names[i]; - column->size = sqlite3_column_bytes(stmt, i); - column->type = sqlite3_column_type(stmt, i); - column->value = NULL; - switch (column->type) { - case SQLITE_FLOAT: - case SQLITE_INTEGER: - case SQLITE_TEXT: - hold = NULL; - hold = (char *) sqlite3_column_text(stmt, i); - if (hold) { - column->value = apr_palloc(pool, column->size + 1); - strncpy(column->value, hold, column->size + 1); - } - break; - case SQLITE_BLOB: - break; - case SQLITE_NULL: - break; - } - col = row->columns[i]; - } - row->rownum = num_tuples++; - row->next_row = 0; - (*results)->tuples = num_tuples; - if ((*results)->next_row == 0) { - (*results)->next_row = row; - } - if (lastrow != 0) { - lastrow->next_row = row; - } - lastrow = row; - } else if (ret == SQLITE_DONE) { - ret = SQLITE_OK; - } - } while (ret == SQLITE_ROW || ret == SQLITE_BUSY); - } - ret = sqlite3_finalize(stmt); -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - - if (sql->trans) { - sql->trans->errnum = ret; - } - return ret; -} - -static int dbd_sqlite3_get_row(apr_pool_t *pool, apr_dbd_results_t *res, - apr_dbd_row_t **rowp, int rownum) -{ - int i = 0; - - if (rownum == -1) { - *rowp = res->next_row; - if (*rowp == 0) - return -1; - res->next_row = (*rowp)->next_row; - return 0; - } - if (rownum > res->tuples) { - return -1; - } - rownum--; - *rowp = res->next_row; - for (; *rowp != 0; i++, *rowp = (*rowp)->next_row) { - if (i == rownum) { - return 0; - } - } - - return -1; - -} - -static const char *dbd_sqlite3_get_entry(const apr_dbd_row_t *row, int n) -{ - apr_dbd_column_t *column; - const char *value; - if ((n < 0) || (n >= row->columnCount)) { - return NULL; - } - column = row->columns[n]; - value = column->value; - return value; -} - -static const char *dbd_sqlite3_error(apr_dbd_t *sql, int n) -{ - return sqlite3_errmsg(sql->conn); -} - -static int dbd_sqlite3_query(apr_dbd_t *sql, int *nrows, const char *query) -{ - sqlite3_stmt *stmt = NULL; - const char *tail = NULL; - int ret = -1, length = 0; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - length = strlen(query); -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - - do { - int retry_count = 0; - - ret = sqlite3_prepare(sql->conn, query, length, &stmt, &tail); - if (ret != SQLITE_OK) { - sqlite3_finalize(stmt); - break; - } - - while(retry_count++ <= MAX_RETRY_COUNT) { - ret = sqlite3_step(stmt); - if (ret != SQLITE_BUSY) - break; - -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - apr_sleep(MAX_RETRY_SLEEP); -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - } - - *nrows = sqlite3_changes(sql->conn); - sqlite3_finalize(stmt); - length -= (tail - query); - query = tail; - } while (length > 0); - - if (dbd_sqlite3_is_success(ret)) { - ret = 0; - } -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - if (sql->trans) { - sql->trans->errnum = ret; - } - return ret; -} - -static apr_status_t free_mem(void *data) -{ - sqlite3_free(data); - return APR_SUCCESS; -} - -static const char *dbd_sqlite3_escape(apr_pool_t *pool, const char *arg, - apr_dbd_t *sql) -{ - char *ret = sqlite3_mprintf("%q", arg); - apr_pool_cleanup_register(pool, ret, free_mem, - apr_pool_cleanup_null); - return ret; -} - -static int dbd_sqlite3_prepare(apr_pool_t *pool, apr_dbd_t *sql, - const char *query, const char *label, - apr_dbd_prepared_t **statement) -{ - sqlite3_stmt *stmt; - char *p, *slquery = apr_pstrdup(pool, query); - const char *tail = NULL, *q; - int ret; - - for (p = slquery, q = query; *q; ++q) { - if (q[0] == '%') { - if (isalpha(q[1])) { - *p++ = '?'; - ++q; - } - else if (q[1] == '%') { - /* reduce %% to % */ - *p++ = *q++; - } - else { - *p++ = *q; - } - } - else { - *p++ = *q; - } - } - *p = 0; - -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - - ret = sqlite3_prepare(sql->conn, slquery, strlen(query), &stmt, &tail); - if (ret == SQLITE_OK) { - apr_dbd_prepared_t *prep; - - prep = apr_pcalloc(sql->pool, sizeof(*prep)); - prep->stmt = stmt; - prep->next = sql->prep; - - /* link new statement to the handle */ - sql->prep = prep; - - *statement = prep; - } else { - sqlite3_finalize(stmt); - } - -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - - return ret; -} - -static int dbd_sqlite3_pquery(apr_pool_t *pool, apr_dbd_t *sql, - int *nrows, apr_dbd_prepared_t *statement, - int nargs, const char **values) -{ - sqlite3_stmt *stmt = statement->stmt; - int ret = -1, retry_count = 0, i; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - - ret = sqlite3_reset(stmt); - if (ret == SQLITE_OK) { - for (i=0; i < nargs; i++) { - sqlite3_bind_text(stmt, i + 1, values[i], strlen(values[i]), - SQLITE_STATIC); - } - - while(retry_count++ <= MAX_RETRY_COUNT) { - ret = sqlite3_step(stmt); - if (ret != SQLITE_BUSY) - break; - -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - apr_sleep(MAX_RETRY_SLEEP); -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - } - - *nrows = sqlite3_changes(sql->conn); - - sqlite3_reset(stmt); - } - - if (dbd_sqlite3_is_success(ret)) { - ret = 0; - } -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - if (sql->trans) { - sql->trans->errnum = ret; - } - - return ret; -} - -static int dbd_sqlite3_pvquery(apr_pool_t *pool, apr_dbd_t *sql, int *nrows, - apr_dbd_prepared_t *statement, va_list args) -{ - const char **values; - int i, nargs; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - nargs = sqlite3_bind_parameter_count(statement->stmt); - values = apr_palloc(pool, sizeof(*values) * nargs); - - for (i = 0; i < nargs; i++) { - values[i] = apr_pstrdup(pool, va_arg(args, const char*)); - } - - return dbd_sqlite3_pquery(pool, sql, nrows, statement, nargs, values); -} - -static int dbd_sqlite3_pselect(apr_pool_t *pool, apr_dbd_t *sql, - apr_dbd_results_t **results, - apr_dbd_prepared_t *statement, int seek, - int nargs, const char **values) -{ - sqlite3_stmt *stmt = statement->stmt; - int i, ret, retry_count = 0; - size_t num_tuples = 0; - int increment = 0; - apr_dbd_row_t *row = NULL; - apr_dbd_row_t *lastrow = NULL; - apr_dbd_column_t *column; - char *hold = NULL; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - - ret = sqlite3_reset(stmt); - if (ret == SQLITE_OK) { - int column_count; - - for (i=0; i < nargs; i++) { - sqlite3_bind_text(stmt, i + 1, values[i], strlen(values[i]), - SQLITE_STATIC); - } - - column_count = sqlite3_column_count(stmt); - if (!*results) { - *results = apr_pcalloc(pool, sizeof(apr_dbd_results_t)); - } - (*results)->stmt = stmt; - (*results)->sz = column_count; - (*results)->random = seek; - (*results)->next_row = 0; - (*results)->tuples = 0; - (*results)->col_names = apr_pcalloc(pool, - column_count * sizeof(char *)); - do { - ret = sqlite3_step(stmt); - if (ret == SQLITE_BUSY) { - if (retry_count++ > MAX_RETRY_COUNT) { - ret = SQLITE_ERROR; - } else { -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - apr_sleep(MAX_RETRY_SLEEP); -#if APR_HAS_THREADS - apr_thread_mutex_lock(sql->mutex); -#endif - } - } else if (ret == SQLITE_ROW) { - int length; - apr_dbd_column_t *col; - row = apr_palloc(pool, sizeof(apr_dbd_row_t)); - row->res = *results; - increment = sizeof(apr_dbd_column_t *); - length = increment * (*results)->sz; - row->columns = apr_palloc(pool, length); - row->columnCount = column_count; - for (i = 0; i < (*results)->sz; i++) { - column = apr_palloc(pool, sizeof(apr_dbd_column_t)); - row->columns[i] = column; - /* copy column name once only */ - if ((*results)->col_names[i] == NULL) { - (*results)->col_names[i] = - apr_pstrdup(pool, sqlite3_column_name(stmt, i)); - } - column->name = (*results)->col_names[i]; - column->size = sqlite3_column_bytes(stmt, i); - column->type = sqlite3_column_type(stmt, i); - column->value = NULL; - switch (column->type) { - case SQLITE_FLOAT: - case SQLITE_INTEGER: - case SQLITE_TEXT: - hold = NULL; - hold = (char *) sqlite3_column_text(stmt, i); - if (hold) { - column->value = apr_palloc(pool, column->size + 1); - strncpy(column->value, hold, column->size + 1); - } - break; - case SQLITE_BLOB: - break; - case SQLITE_NULL: - break; - } - col = row->columns[i]; - } - row->rownum = num_tuples++; - row->next_row = 0; - (*results)->tuples = num_tuples; - if ((*results)->next_row == 0) { - (*results)->next_row = row; - } - if (lastrow != 0) { - lastrow->next_row = row; - } - lastrow = row; - } else if (ret == SQLITE_DONE) { - ret = SQLITE_OK; - } - } while (ret == SQLITE_ROW || ret == SQLITE_BUSY); - - sqlite3_reset(stmt); - } -#if APR_HAS_THREADS - apr_thread_mutex_unlock(sql->mutex); -#endif - - if (sql->trans) { - sql->trans->errnum = ret; - } - return ret; -} - -static int dbd_sqlite3_pvselect(apr_pool_t *pool, apr_dbd_t *sql, - apr_dbd_results_t **results, - apr_dbd_prepared_t *statement, int seek, - va_list args) -{ - const char **values; - int i, nargs; - - if (sql->trans && sql->trans->errnum) { - return sql->trans->errnum; - } - - nargs = sqlite3_bind_parameter_count(statement->stmt); - values = apr_palloc(pool, sizeof(*values) * nargs); - - for (i = 0; i < nargs; i++) { - values[i] = apr_pstrdup(pool, va_arg(args, const char*)); - } - - return dbd_sqlite3_pselect(pool, sql, results, statement, - seek, nargs, values); -} - -static int dbd_sqlite3_start_transaction(apr_pool_t *pool, - apr_dbd_t *handle, - apr_dbd_transaction_t **trans) -{ - int ret = 0; - int nrows = 0; - - ret = dbd_sqlite3_query(handle, &nrows, "BEGIN"); - if (!*trans) { - *trans = apr_pcalloc(pool, sizeof(apr_dbd_transaction_t)); - (*trans)->handle = handle; - handle->trans = *trans; - } - - return ret; -} - -static int dbd_sqlite3_end_transaction(apr_dbd_transaction_t *trans) -{ - int ret = -1; /* ending transaction that was never started is an error */ - int nrows = 0; - - if (trans) { - if (trans->errnum) { - trans->errnum = 0; - ret = dbd_sqlite3_query(trans->handle, &nrows, "ROLLBACK"); - } else { - ret = dbd_sqlite3_query(trans->handle, &nrows, "COMMIT"); - } - trans->handle->trans = NULL; - } - - return ret; -} - -static apr_dbd_t *dbd_sqlite3_open(apr_pool_t *pool, const char *params) -{ - apr_dbd_t *sql = NULL; - sqlite3 *conn = NULL; - apr_status_t res; - int sqlres; - if (!params) - return NULL; - sqlres = sqlite3_open(params, &conn); - if (sqlres != SQLITE_OK) { - sqlite3_close(conn); - return NULL; - } - /* should we register rand or power functions to the sqlite VM? */ - sql = apr_pcalloc(pool, sizeof(*sql)); - sql->conn = conn; - sql->pool = pool; - sql->trans = NULL; -#if APR_HAS_THREADS - /* Create a mutex */ - res = apr_thread_mutex_create(&sql->mutex, APR_THREAD_MUTEX_DEFAULT, - pool); - if (res != APR_SUCCESS) { - return NULL; - } -#endif - - return sql; -} - -static apr_status_t dbd_sqlite3_close(apr_dbd_t *handle) -{ - apr_dbd_prepared_t *prep = handle->prep; - - /* finalize all prepared statements, or we'll get SQLITE_BUSY on close */ - while (prep) { - sqlite3_finalize(prep->stmt); - prep = prep->next; - } - - sqlite3_close(handle->conn); -#if APR_HAS_THREADS - apr_thread_mutex_destroy(handle->mutex); -#endif - return APR_SUCCESS; -} - -static apr_status_t dbd_sqlite3_check_conn(apr_pool_t *pool, - apr_dbd_t *handle) -{ - return (handle->conn != NULL) ? APR_SUCCESS : APR_EGENERAL; -} - -static int dbd_sqlite3_select_db(apr_pool_t *pool, apr_dbd_t *handle, - const char *name) -{ - return APR_ENOTIMPL; -} - -static void *dbd_sqlite3_native(apr_dbd_t *handle) -{ - return handle->conn; -} - -static int dbd_sqlite3_num_cols(apr_dbd_results_t *res) -{ - return res->sz; -} - -static int dbd_sqlite3_num_tuples(apr_dbd_results_t *res) -{ - return res->tuples; -} - -APU_DECLARE_DATA const apr_dbd_driver_t apr_dbd_sqlite3_driver = { - "sqlite3", - NULL, - dbd_sqlite3_native, - dbd_sqlite3_open, - dbd_sqlite3_check_conn, - dbd_sqlite3_close, - dbd_sqlite3_select_db, - dbd_sqlite3_start_transaction, - dbd_sqlite3_end_transaction, - dbd_sqlite3_query, - dbd_sqlite3_select, - dbd_sqlite3_num_cols, - dbd_sqlite3_num_tuples, - dbd_sqlite3_get_row, - dbd_sqlite3_get_entry, - dbd_sqlite3_error, - dbd_sqlite3_escape, - dbd_sqlite3_prepare, - dbd_sqlite3_pvquery, - dbd_sqlite3_pvselect, - dbd_sqlite3_pquery, - dbd_sqlite3_pselect, -}; -#endif diff --git a/libs/apr-util/dbm/apr_dbm.c b/libs/apr-util/dbm/apr_dbm.c deleted file mode 100644 index 88cf08e675..0000000000 --- a/libs/apr-util/dbm/apr_dbm.c +++ /dev/null @@ -1,207 +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_errno.h" -#include "apr_pools.h" -#include "apr_strings.h" -#define APR_WANT_MEMFUNC -#define APR_WANT_STRFUNC -#include "apr_want.h" -#include "apr_general.h" - -#include "apu.h" -#include "apu_select_dbm.h" -#include "apr_dbm.h" -#include "apr_dbm_private.h" - -/* ### note: the setting of DBM_VTABLE will go away once we have multiple - ### DBMs in here. - ### Well, that day is here. So, do we remove DBM_VTABLE and the old - ### API entirely? Oh, what to do. We need an APU_DEFAULT_DBM #define. - ### Sounds like a job for autoconf. */ - -#if APU_USE_SDBM -#define DBM_VTABLE apr_dbm_type_sdbm -#elif APU_USE_GDBM -#define DBM_VTABLE apr_dbm_type_gdbm -#elif APU_USE_DB -#define DBM_VTABLE apr_dbm_type_db -#elif APU_USE_NDBM -#define DBM_VTABLE apr_dbm_type_ndbm -#else /* Not in the USE_xDBM list above */ -#error a DBM implementation was not specified -#endif - -APU_DECLARE(apr_status_t) apr_dbm_open_ex(apr_dbm_t **pdb, const char*type, - const char *pathname, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *pool) -{ -#if APU_HAVE_GDBM - if (!strcasecmp(type, "GDBM")) { - return (*apr_dbm_type_gdbm.open)(pdb, pathname, mode, perm, pool); - } -#endif -#if APU_HAVE_SDBM - if (!strcasecmp(type, "SDBM")) { - return (*apr_dbm_type_sdbm.open)(pdb, pathname, mode, perm, pool); - } -#endif -#if APU_HAVE_DB - if (!strcasecmp(type, "DB")) { - return (*apr_dbm_type_db.open)(pdb, pathname, mode, perm, pool); - } -#endif -#if APU_HAVE_NDBM - if (!strcasecmp(type, "NDBM")) { - return (*apr_dbm_type_ndbm.open)(pdb, pathname, mode, perm, pool); - } -#endif - - if (!strcasecmp(type, "default")) { - return (*DBM_VTABLE.open)(pdb, pathname, mode, perm, pool); - } - - return APR_ENOTIMPL; -} - -APU_DECLARE(apr_status_t) apr_dbm_open(apr_dbm_t **pdb, const char *pathname, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *pool) -{ - return (*DBM_VTABLE.open)(pdb, pathname, mode, perm, pool); -} - -APU_DECLARE(void) apr_dbm_close(apr_dbm_t *dbm) -{ - (*dbm->type->close)(dbm); -} - -APU_DECLARE(apr_status_t) apr_dbm_fetch(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t *pvalue) -{ - return (*dbm->type->fetch)(dbm, key, pvalue); -} - -APU_DECLARE(apr_status_t) apr_dbm_store(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t value) -{ - return (*dbm->type->store)(dbm, key, value); -} - -APU_DECLARE(apr_status_t) apr_dbm_delete(apr_dbm_t *dbm, apr_datum_t key) -{ - return (*dbm->type->del)(dbm, key); -} - -APU_DECLARE(int) apr_dbm_exists(apr_dbm_t *dbm, apr_datum_t key) -{ - return (*dbm->type->exists)(dbm, key); -} - -APU_DECLARE(apr_status_t) apr_dbm_firstkey(apr_dbm_t *dbm, apr_datum_t *pkey) -{ - return (*dbm->type->firstkey)(dbm, pkey); -} - -APU_DECLARE(apr_status_t) apr_dbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey) -{ - return (*dbm->type->nextkey)(dbm, pkey); -} - -APU_DECLARE(void) apr_dbm_freedatum(apr_dbm_t *dbm, apr_datum_t data) -{ - (*dbm->type->freedatum)(dbm, data); -} - -APU_DECLARE(char *) apr_dbm_geterror(apr_dbm_t *dbm, int *errcode, - char *errbuf, apr_size_t errbufsize) -{ - if (errcode != NULL) - *errcode = dbm->errcode; - - /* assert: errbufsize > 0 */ - - if (dbm->errmsg == NULL) - *errbuf = '\0'; - else - (void) apr_cpystrn(errbuf, dbm->errmsg, errbufsize); - return errbuf; -} - -APU_DECLARE(apr_status_t) apr_dbm_get_usednames_ex(apr_pool_t *p, - const char *type, - const char *pathname, - const char **used1, - const char **used2) -{ -#if APU_HAVE_GDBM - if (!strcasecmp(type, "GDBM")) { - (*apr_dbm_type_gdbm.getusednames)(p,pathname,used1,used2); - return APR_SUCCESS; - } -#endif -#if APU_HAVE_SDBM - if (!strcasecmp(type, "SDBM")) { - (*apr_dbm_type_sdbm.getusednames)(p,pathname,used1,used2); - return APR_SUCCESS; - } -#endif -#if APU_HAVE_DB - if (!strcasecmp(type, "DB")) { - (*apr_dbm_type_db.getusednames)(p,pathname,used1,used2); - return APR_SUCCESS; - } -#endif -#if APU_HAVE_NDBM - if (!strcasecmp(type, "NDBM")) { - (*apr_dbm_type_ndbm.getusednames)(p,pathname,used1,used2); - return APR_SUCCESS; - } -#endif - - if (!strcasecmp(type, "default")) { - (*DBM_VTABLE.getusednames)(p, pathname, used1, used2); - return APR_SUCCESS; - } - - return APR_ENOTIMPL; -} - -APU_DECLARE(void) apr_dbm_get_usednames(apr_pool_t *p, - const char *pathname, - const char **used1, - const char **used2) -{ - /* ### one day, a DBM type name will be passed and we'll need to look it - ### up. for now, it is constant. */ - - (*DBM_VTABLE.getusednames)(p, pathname, used1, used2); -} - -/* 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) -{ - int mode = 0; - - mode |= 0700 & (perm >> 2); /* User is off-by-2 bits */ - mode |= 0070 & (perm >> 1); /* Group is off-by-1 bit */ - mode |= 0007 & (perm); /* World maps 1 for 1 */ - return mode; -} diff --git a/libs/apr-util/dbm/apr_dbm_berkeleydb.c b/libs/apr-util/dbm/apr_dbm_berkeleydb.c deleted file mode 100644 index 46ededcc0c..0000000000 --- a/libs/apr-util/dbm/apr_dbm_berkeleydb.c +++ /dev/null @@ -1,403 +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_strings.h" -#define APR_WANT_MEMFUNC -#include "apr_want.h" - -#define APU_WANT_DB -#include "apu_want.h" - -#if APR_HAVE_STDLIB_H -#include <stdlib.h> /* for abort() */ -#endif - -#include "apu.h" - -#if APU_HAVE_DB -#include "apr_dbm_private.h" - -/* - * We pick up all varieties of Berkeley DB through db.h (included through - * apu_select_dbm.h). This code has been compiled/tested against DB1, - * DB_185, DB2, DB3, and DB4. - */ - -#if defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 4) -/* We will treat anything greater than 4.1 as DB4. - * We can treat 4.0 as DB3. - */ -#if defined(DB_VERSION_MINOR) && (DB_VERSION_MINOR >= 1) -#define DB_VER 4 -#else -#define DB_VER 3 -#endif -#elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3) -#define DB_VER 3 -#elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 2) -#define DB_VER 2 -#else -#define DB_VER 1 -#endif - -typedef struct { - DB *bdb; -#if DB_VER != 1 - DBC *curs; -#endif -} real_file_t; - - -#if DB_VER == 1 -#define TXN_ARG -#else -#define TXN_ARG NULL, -#endif - -#define GET_BDB(f) (((real_file_t *)(f))->bdb) - -#define do_fetch(bdb, k, v) ((*(bdb)->get)(bdb, TXN_ARG &(k), &(v), 0)) - -#if DB_VER == 1 -#include <sys/fcntl.h> -#define APR_DBM_DBMODE_RO O_RDONLY -#define APR_DBM_DBMODE_RW O_RDWR -#define APR_DBM_DBMODE_RWCREATE (O_CREAT | O_RDWR) -#define APR_DBM_DBMODE_RWTRUNC (O_CREAT | O_RDWR | O_TRUNC) -#else -#define APR_DBM_DBMODE_RO DB_RDONLY -#define APR_DBM_DBMODE_RW 0 -#define APR_DBM_DBMODE_RWCREATE DB_CREATE -#define APR_DBM_DBMODE_RWTRUNC DB_TRUNCATE -#endif /* DBVER == 1 */ - -/* -------------------------------------------------------------------------- -** -** UTILITY FUNCTIONS -*/ - -/* map a DB error to an apr_status_t */ -static apr_status_t db2s(int dberr) -{ - if (dberr != 0) { - /* ### need to fix this */ - return APR_OS_START_USEERR + dberr; - } - - return APR_SUCCESS; -} - - -static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said) -{ - apr_status_t rv = APR_SUCCESS; - - /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */ - - if (dbm_said == APR_SUCCESS) { - dbm->errcode = 0; - dbm->errmsg = NULL; - } - else { - /* ### need to fix. dberr was tossed in db2s(). */ - /* ### use db_strerror() */ - dbm->errcode = dbm_said; -#if DB_VER == 1 || DB_VER == 2 - dbm->errmsg = NULL; -#else - dbm->errmsg = db_strerror(dbm_said - APR_OS_START_USEERR); -#endif - rv = dbm_said; - } - - return rv; -} - -/* -------------------------------------------------------------------------- -** -** DEFINE THE VTABLE FUNCTIONS FOR BERKELEY DB -** -** ### we may need three sets of these: db1, db2, db3 -*/ - -static apr_status_t vt_db_open(apr_dbm_t **pdb, const char *pathname, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *pool) -{ - real_file_t file; - int dbmode; - - *pdb = NULL; - - switch (mode) { - case APR_DBM_READONLY: - dbmode = APR_DBM_DBMODE_RO; - break; - case APR_DBM_READWRITE: - dbmode = APR_DBM_DBMODE_RW; - break; - case APR_DBM_RWCREATE: - dbmode = APR_DBM_DBMODE_RWCREATE; - break; - case APR_DBM_RWTRUNC: - dbmode = APR_DBM_DBMODE_RWTRUNC; - break; - default: - return APR_EINVAL; - } - - { - int dberr; - -#if DB_VER >= 3 - if ((dberr = db_create(&file.bdb, NULL, 0)) == 0) { - if ((dberr = (*file.bdb->open)(file.bdb, -#if DB_VER == 4 - NULL, -#endif - pathname, NULL, - DB_HASH, dbmode, - apr_posix_perms2mode(perm))) != 0) { - /* close the DB handler */ - (void) (*file.bdb->close)(file.bdb, 0); - } - } - file.curs = NULL; -#elif DB_VER == 2 - dberr = db_open(pathname, DB_HASH, dbmode, apr_posix_perms2mode(perm), - NULL, NULL, &file.bdb); - file.curs = NULL; -#else - file.bdb = dbopen(pathname, dbmode, apr_posix_perms2mode(perm), - DB_HASH, NULL); - if (file.bdb == NULL) - return APR_EGENERAL; /* ### need a better error */ - dberr = 0; -#endif - if (dberr != 0) - return db2s(dberr); - } - - /* we have an open database... return it */ - *pdb = apr_pcalloc(pool, sizeof(**pdb)); - (*pdb)->pool = pool; - (*pdb)->type = &apr_dbm_type_db; - (*pdb)->file = apr_pmemdup(pool, &file, sizeof(file)); - - /* ### register a cleanup to close the DBM? */ - - return APR_SUCCESS; -} - -static void vt_db_close(apr_dbm_t *dbm) -{ - (*GET_BDB(dbm->file)->close)(GET_BDB(dbm->file) -#if DB_VER != 1 - , 0 -#endif - ); -} - -static apr_status_t vt_db_fetch(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t * pvalue) -{ - DBT ckey = { 0 }; - DBT rd = { 0 }; - int dberr; - - ckey.data = key.dptr; - ckey.size = key.dsize; - - dberr = do_fetch(GET_BDB(dbm->file), ckey, rd); - - /* "not found" is not an error. return zero'd value. */ - if (dberr == -#if DB_VER == 1 - RET_SPECIAL -#else - DB_NOTFOUND -#endif - ) { - memset(&rd, 0, sizeof(rd)); - dberr = 0; - } - - pvalue->dptr = rd.data; - pvalue->dsize = rd.size; - - /* store the error info into DBM, and return a status code. Also, note - that *pvalue should have been cleared on error. */ - return set_error(dbm, db2s(dberr)); -} - -static apr_status_t vt_db_store(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t value) -{ - apr_status_t rv; - DBT ckey = { 0 }; - DBT cvalue = { 0 }; - - ckey.data = key.dptr; - ckey.size = key.dsize; - - cvalue.data = value.dptr; - cvalue.size = value.dsize; - - rv = db2s((*GET_BDB(dbm->file)->put)(GET_BDB(dbm->file), - TXN_ARG - &ckey, - &cvalue, - 0)); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static apr_status_t vt_db_del(apr_dbm_t *dbm, apr_datum_t key) -{ - apr_status_t rv; - DBT ckey = { 0 }; - - ckey.data = key.dptr; - ckey.size = key.dsize; - - rv = db2s((*GET_BDB(dbm->file)->del)(GET_BDB(dbm->file), - TXN_ARG - &ckey, - 0)); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static int vt_db_exists(apr_dbm_t *dbm, apr_datum_t key) -{ - DBT ckey = { 0 }; /* converted key */ - DBT data = { 0 }; - int dberr; - - ckey.data = key.dptr; - ckey.size = key.dsize; - - dberr = do_fetch(GET_BDB(dbm->file), ckey, data); - - /* note: the result data is "loaned" to us; we don't need to free it */ - - /* DB returns DB_NOTFOUND if it doesn't exist. but we want to say - that *any* error means it doesn't exist. */ - return dberr == 0; -} - -static apr_status_t vt_db_firstkey(apr_dbm_t *dbm, apr_datum_t * pkey) -{ - real_file_t *f = dbm->file; - DBT first = { 0 }; - DBT data = { 0 }; - int dberr; - -#if DB_VER == 1 - dberr = (*f->bdb->seq)(f->bdb, &first, &data, R_FIRST); -#else - if ((dberr = (*f->bdb->cursor)(f->bdb, NULL, &f->curs -#if DB_VER >= 3 || ((DB_VERSION_MAJOR == 2) && (DB_VERSION_MINOR > 5)) - , 0 -#endif - )) == 0) { - dberr = (*f->curs->c_get)(f->curs, &first, &data, DB_FIRST); - if (dberr == DB_NOTFOUND) { - memset(&first, 0, sizeof(first)); - (*f->curs->c_close)(f->curs); - f->curs = NULL; - dberr = 0; - } - } -#endif - - pkey->dptr = first.data; - pkey->dsize = first.size; - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, db2s(dberr)); -} - -static apr_status_t vt_db_nextkey(apr_dbm_t *dbm, apr_datum_t * pkey) -{ - real_file_t *f = dbm->file; - DBT ckey = { 0 }; - DBT data = { 0 }; - int dberr; - - ckey.data = pkey->dptr; - ckey.size = pkey->dsize; - -#if DB_VER == 1 - dberr = (*f->bdb->seq)(f->bdb, &ckey, &data, R_NEXT); - if (dberr == RET_SPECIAL) { - dberr = 0; - ckey.data = NULL; - ckey.size = 0; - } -#else - if (f->curs == NULL) - return APR_EINVAL; - - dberr = (*f->curs->c_get)(f->curs, &ckey, &data, DB_NEXT); - if (dberr == DB_NOTFOUND) { - (*f->curs->c_close)(f->curs); - f->curs = NULL; - dberr = 0; - ckey.data = NULL; - ckey.size = 0; - } -#endif - - pkey->dptr = ckey.data; - pkey->dsize = ckey.size; - - /* store any error info into DBM, and return a status code. */ - /* ### or use db2s(dberr) instead of APR_SUCCESS? */ - return set_error(dbm, APR_SUCCESS); -} - -static void vt_db_freedatum(apr_dbm_t *dbm, apr_datum_t data) -{ - /* nothing to do */ -} - -static void vt_db_usednames(apr_pool_t *pool, const char *pathname, - const char **used1, const char **used2) -{ - *used1 = apr_pstrdup(pool, pathname); - *used2 = NULL; -} - - -APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_db = { - "db", - - vt_db_open, - vt_db_close, - vt_db_fetch, - vt_db_store, - vt_db_del, - vt_db_exists, - vt_db_firstkey, - vt_db_nextkey, - vt_db_freedatum, - vt_db_usednames -}; - -#endif /* APU_HAVE_DB */ diff --git a/libs/apr-util/dbm/apr_dbm_gdbm.c b/libs/apr-util/dbm/apr_dbm_gdbm.c deleted file mode 100644 index 93fb942a6c..0000000000 --- a/libs/apr-util/dbm/apr_dbm_gdbm.c +++ /dev/null @@ -1,270 +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_strings.h" - -#if APR_HAVE_STDLIB_H -#include <stdlib.h> /* for free() */ -#endif - -#include "apu.h" - -#if APU_HAVE_GDBM -#include "apr_dbm_private.h" - -#include <gdbm.h> - -/* this is used in a few places to define a noop "function". it is needed - to stop "no effect" warnings from GCC. */ -#define NOOP_FUNCTION if (0) ; else - -/* ### define defaults for now; these will go away in a while */ -#define REGISTER_CLEANUP(dbm, pdatum) NOOP_FUNCTION -#define SET_FILE(pdb, f) ((pdb)->file = (f)) - -typedef GDBM_FILE real_file_t; - -typedef datum *cvt_datum_t; -#define CONVERT_DATUM(cvt, pinput) ((cvt) = (datum *)(pinput)) - -typedef datum result_datum_t; -#define RETURN_DATUM(poutput, rd) (*(poutput) = *(apr_datum_t *)&(rd)) - -#define APR_DBM_CLOSE(f) gdbm_close(f) -#define APR_DBM_FETCH(f, k, v) ((v) = gdbm_fetch(f, *(k)), APR_SUCCESS) -#define APR_DBM_STORE(f, k, v) g2s(gdbm_store(f, *(k), *(v), GDBM_REPLACE)) -#define APR_DBM_DELETE(f, k) g2s(gdbm_delete(f, *(k))) -#define APR_DBM_FIRSTKEY(f, k) ((k) = gdbm_firstkey(f), APR_SUCCESS) -#define APR_DBM_NEXTKEY(f, k, nk) ((nk) = gdbm_nextkey(f, *(k)), APR_SUCCESS) -#define APR_DBM_FREEDPTR(dptr) ((dptr) ? free(dptr) : 0) - -#undef REGISTER_CLEANUP -#define REGISTER_CLEANUP(dbm, pdatum) \ - if ((pdatum)->dptr) \ - apr_pool_cleanup_register((dbm)->pool, (pdatum)->dptr, \ - datum_cleanup, apr_pool_cleanup_null); \ - else - -#define APR_DBM_DBMODE_RO GDBM_READER -#define APR_DBM_DBMODE_RW GDBM_WRITER -#define APR_DBM_DBMODE_RWCREATE GDBM_WRCREAT -#define APR_DBM_DBMODE_RWTRUNC GDBM_NEWDB - -/* map a GDBM error to an apr_status_t */ -static apr_status_t g2s(int gerr) -{ - if (gerr == -1) { - /* ### need to fix this */ - return APR_EGENERAL; - } - - return APR_SUCCESS; -} - -static apr_status_t datum_cleanup(void *dptr) -{ - if (dptr) - free(dptr); - - return APR_SUCCESS; -} - -static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said) -{ - apr_status_t rv = APR_SUCCESS; - - /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */ - - if ((dbm->errcode = gdbm_errno) == GDBM_NO_ERROR) { - dbm->errmsg = NULL; - } - else { - dbm->errmsg = gdbm_strerror(gdbm_errno); - rv = APR_EGENERAL; /* ### need something better */ - } - - /* captured it. clear it now. */ - gdbm_errno = GDBM_NO_ERROR; - - return rv; -} - -/* -------------------------------------------------------------------------- -** -** DEFINE THE VTABLE FUNCTIONS FOR GDBM -*/ - -static apr_status_t vt_gdbm_open(apr_dbm_t **pdb, const char *pathname, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *pool) -{ - real_file_t file; - int dbmode; - - *pdb = NULL; - - switch (mode) { - case APR_DBM_READONLY: - dbmode = APR_DBM_DBMODE_RO; - break; - case APR_DBM_READWRITE: - dbmode = APR_DBM_DBMODE_RW; - break; - case APR_DBM_RWCREATE: - dbmode = APR_DBM_DBMODE_RWCREATE; - break; - case APR_DBM_RWTRUNC: - dbmode = APR_DBM_DBMODE_RWTRUNC; - break; - default: - return APR_EINVAL; - } - - { - /* Note: stupid cast to get rid of "const" on the pathname */ - file = gdbm_open((char *) pathname, 0, dbmode, - apr_posix_perms2mode(perm), NULL); - if (file == NULL) - return APR_EGENERAL; /* ### need a better error */ - } - - /* we have an open database... return it */ - *pdb = apr_pcalloc(pool, sizeof(**pdb)); - (*pdb)->pool = pool; - (*pdb)->type = &apr_dbm_type_gdbm; - SET_FILE(*pdb, file); - - /* ### register a cleanup to close the DBM? */ - - return APR_SUCCESS; -} - -static void vt_gdbm_close(apr_dbm_t *dbm) -{ - APR_DBM_CLOSE(dbm->file); -} - -static apr_status_t vt_gdbm_fetch(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t * pvalue) -{ - apr_status_t rv; - cvt_datum_t ckey; - result_datum_t rd; - - CONVERT_DATUM(ckey, &key); - rv = APR_DBM_FETCH(dbm->file, ckey, rd); - RETURN_DATUM(pvalue, rd); - - REGISTER_CLEANUP(dbm, pvalue); - - /* store the error info into DBM, and return a status code. Also, note - that *pvalue should have been cleared on error. */ - return set_error(dbm, rv); -} - -static apr_status_t vt_gdbm_store(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t value) -{ - apr_status_t rv; - cvt_datum_t ckey; - cvt_datum_t cvalue; - - CONVERT_DATUM(ckey, &key); - CONVERT_DATUM(cvalue, &value); - rv = APR_DBM_STORE(dbm->file, ckey, cvalue); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static apr_status_t vt_gdbm_del(apr_dbm_t *dbm, apr_datum_t key) -{ - apr_status_t rv; - cvt_datum_t ckey; - - CONVERT_DATUM(ckey, &key); - rv = APR_DBM_DELETE(dbm->file, ckey); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static int vt_gdbm_exists(apr_dbm_t *dbm, apr_datum_t key) -{ - datum *ckey = (datum *)&key; - - return gdbm_exists(dbm->file, *ckey) != 0; -} - -static apr_status_t vt_gdbm_firstkey(apr_dbm_t *dbm, apr_datum_t * pkey) -{ - apr_status_t rv; - result_datum_t rd; - - rv = APR_DBM_FIRSTKEY(dbm->file, rd); - RETURN_DATUM(pkey, rd); - - REGISTER_CLEANUP(dbm, pkey); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t * pkey) -{ - apr_status_t rv; - cvt_datum_t ckey; - result_datum_t rd; - - CONVERT_DATUM(ckey, pkey); - rv = APR_DBM_NEXTKEY(dbm->file, ckey, rd); - RETURN_DATUM(pkey, rd); - - REGISTER_CLEANUP(dbm, pkey); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, APR_SUCCESS); -} - -static void vt_gdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data) -{ - (void) apr_pool_cleanup_run(dbm->pool, data.dptr, datum_cleanup); -} - -static void vt_gdbm_usednames(apr_pool_t *pool, const char *pathname, - const char **used1, const char **used2) -{ - *used1 = apr_pstrdup(pool, pathname); - *used2 = NULL; -} - - -APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_gdbm = { - "gdbm", - - vt_gdbm_open, - vt_gdbm_close, - vt_gdbm_fetch, - vt_gdbm_store, - vt_gdbm_del, - vt_gdbm_exists, - vt_gdbm_firstkey, - vt_gdbm_nextkey, - vt_gdbm_freedatum, - vt_gdbm_usednames -}; - -#endif /* APU_HAVE_GDBM */ diff --git a/libs/apr-util/dbm/apr_dbm_ndbm.c b/libs/apr-util/dbm/apr_dbm_ndbm.c deleted file mode 100644 index d770ed4403..0000000000 --- a/libs/apr-util/dbm/apr_dbm_ndbm.c +++ /dev/null @@ -1,227 +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_strings.h" - -#if APR_HAVE_STDLIB_H -#include <stdlib.h> /* for free() */ -#endif - -#include "apu.h" - -#if APU_HAVE_NDBM -#include "apr_dbm_private.h" - -#include <ndbm.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -/* this is used in a few places to define a noop "function". it is needed - to stop "no effect" warnings from GCC. */ -#define NOOP_FUNCTION if (0) ; else - -#define APR_DBM_DBMODE_RO O_RDONLY -#define APR_DBM_DBMODE_RW O_RDWR -#define APR_DBM_DBMODE_RWCREATE (O_RDWR|O_CREAT) -#define APR_DBM_DBMODE_RWTRUNC (O_RDWR|O_CREAT|O_TRUNC) - -/* map a NDBM error to an apr_status_t */ -static apr_status_t ndbm2s(int ndbmerr) -{ - if (ndbmerr == -1) { - /* ### need to fix this */ - return APR_EGENERAL; - } - - return APR_SUCCESS; -} - -static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said) -{ - apr_status_t rv = APR_SUCCESS; - - /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */ - - dbm->errmsg = NULL; - if (dbm_error((DBM*)dbm->file)) { - dbm->errmsg = NULL; - rv = APR_EGENERAL; /* ### need something better */ - } - - /* captured it. clear it now. */ - dbm_clearerr((DBM*)dbm->file); - - return rv; -} - -/* -------------------------------------------------------------------------- -** -** DEFINE THE VTABLE FUNCTIONS FOR NDBM -*/ - -static apr_status_t vt_ndbm_open(apr_dbm_t **pdb, const char *pathname, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *pool) -{ - DBM *file; - int dbmode; - - *pdb = NULL; - - switch (mode) { - case APR_DBM_READONLY: - dbmode = APR_DBM_DBMODE_RO; - break; - case APR_DBM_READWRITE: - dbmode = APR_DBM_DBMODE_RW; - break; - case APR_DBM_RWCREATE: - dbmode = APR_DBM_DBMODE_RWCREATE; - break; - case APR_DBM_RWTRUNC: - dbmode = APR_DBM_DBMODE_RWTRUNC; - break; - default: - return APR_EINVAL; - } - - { - file = dbm_open(pathname, dbmode, apr_posix_perms2mode(perm)); - if (file == NULL) - return APR_EGENERAL; /* ### need a better error */ - } - - /* we have an open database... return it */ - *pdb = apr_pcalloc(pool, sizeof(**pdb)); - (*pdb)->pool = pool; - (*pdb)->type = &apr_dbm_type_ndbm; - (*pdb)->file = file; - - /* ### register a cleanup to close the DBM? */ - - return APR_SUCCESS; -} - -static void vt_ndbm_close(apr_dbm_t *dbm) -{ - dbm_close(dbm->file); -} - -static apr_status_t vt_ndbm_fetch(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t * pvalue) -{ - datum *ckey; - datum rd; - - ckey = (datum*)&key; - rd = dbm_fetch(dbm->file, *ckey); - *pvalue = *(apr_datum_t*)&rd; - - /* store the error info into DBM, and return a status code. Also, note - that *pvalue should have been cleared on error. */ - return set_error(dbm, APR_SUCCESS); -} - -static apr_status_t vt_ndbm_store(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t value) -{ - apr_status_t rv; - datum *ckey; - datum *cvalue; - - ckey = (datum*)&key; - cvalue = (datum*)&value; - rv = ndbm2s( dbm_store( dbm->file, *ckey, *cvalue, DBM_REPLACE)); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static apr_status_t vt_ndbm_del(apr_dbm_t *dbm, apr_datum_t key) -{ - apr_status_t rv; - datum *ckey; - - ckey = (datum*)&key; - rv = ndbm2s( dbm_delete(dbm->file, *ckey)); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static int vt_ndbm_exists(apr_dbm_t *dbm, apr_datum_t key) -{ - datum *ckey = (datum *)&key; - datum value; - - value = dbm_fetch( dbm->file, *ckey); - - return value.dptr != NULL; -} - -static apr_status_t vt_ndbm_firstkey(apr_dbm_t *dbm, apr_datum_t * pkey) -{ - datum rd; - - rd = dbm_firstkey(dbm->file); - *pkey = *(apr_datum_t*)&rd; - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, APR_SUCCESS); -} - -static apr_status_t vt_ndbm_nextkey(apr_dbm_t *dbm, apr_datum_t * pkey) -{ - datum *ckey; - datum rd; - - ckey = (datum*)pkey; - rd = dbm_nextkey(dbm->file); - *pkey = *(apr_datum_t*)&rd; - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, APR_SUCCESS); -} - -static void vt_ndbm_freedatum(apr_dbm_t *dbm, apr_datum_t data) -{ - /* nothing to do */ -} - -static void vt_ndbm_usednames(apr_pool_t *pool, const char *pathname, - const char **used1, const char **used2) -{ - *used1 = apr_pstrdup(pool, pathname); - *used2 = NULL; -} - - -APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_ndbm = { - "ndbm", - - vt_ndbm_open, - vt_ndbm_close, - vt_ndbm_fetch, - vt_ndbm_store, - vt_ndbm_del, - vt_ndbm_exists, - vt_ndbm_firstkey, - vt_ndbm_nextkey, - vt_ndbm_freedatum, - vt_ndbm_usednames -}; -#endif /* APU_HAVE_NDBM */ diff --git a/libs/apr-util/dbm/apr_dbm_sdbm.c b/libs/apr-util/dbm/apr_dbm_sdbm.c deleted file mode 100644 index dadb1e2670..0000000000 --- a/libs/apr-util/dbm/apr_dbm_sdbm.c +++ /dev/null @@ -1,265 +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_strings.h" -#define APR_WANT_MEMFUNC -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "apu.h" - -#if APU_HAVE_SDBM - -#include "apr_dbm_private.h" - -#include "apr_sdbm.h" -#if APR_HAVE_STDLIB_H -#include <stdlib.h> /* For abort() */ -#endif - -/* this is used in a few places to define a noop "function". it is needed - to stop "no effect" warnings from GCC. */ -#define NOOP_FUNCTION if (0) ; else - -/* ### define defaults for now; these will go away in a while */ -#define REGISTER_CLEANUP(dbm, pdatum) NOOP_FUNCTION -#define SET_FILE(pdb, f) ((pdb)->file = (f)) - -typedef apr_sdbm_t *real_file_t; - -typedef apr_sdbm_datum_t cvt_datum_t; -#define CONVERT_DATUM(cvt, pinput) ((cvt).dptr = (pinput)->dptr, (cvt).dsize = (pinput)->dsize) - -typedef apr_sdbm_datum_t result_datum_t; -#define RETURN_DATUM(poutput, rd) ((poutput)->dptr = (rd).dptr, (poutput)->dsize = (rd).dsize) - -#define APR_DBM_CLOSE(f) apr_sdbm_close(f) -#define APR_DBM_FETCH(f, k, v) apr_sdbm_fetch(f, &(v), (k)) -#define APR_DBM_STORE(f, k, v) apr_sdbm_store(f, (k), (v), APR_SDBM_REPLACE) -#define APR_DBM_DELETE(f, k) apr_sdbm_delete(f, (k)) -#define APR_DBM_FIRSTKEY(f, k) apr_sdbm_firstkey(f, &(k)) -#define APR_DBM_NEXTKEY(f, k, nk) apr_sdbm_nextkey(f, &(nk)) -#define APR_DBM_FREEDPTR(dptr) NOOP_FUNCTION - -#define APR_DBM_DBMODE_RO APR_READ -#define APR_DBM_DBMODE_RW (APR_READ | APR_WRITE) -#define APR_DBM_DBMODE_RWCREATE (APR_READ | APR_WRITE | APR_CREATE) -#define APR_DBM_DBMODE_RWTRUNC (APR_READ | APR_WRITE | APR_CREATE | \ - APR_TRUNCATE) - -static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said) -{ - apr_status_t rv = APR_SUCCESS; - - /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */ - - if ((dbm->errcode = dbm_said) == APR_SUCCESS) { - dbm->errmsg = NULL; - } - else { - dbm->errmsg = "I/O error occurred."; - rv = APR_EGENERAL; /* ### need something better */ - } - - return rv; -} - -/* -------------------------------------------------------------------------- -** -** DEFINE THE VTABLE FUNCTIONS FOR SDBM -*/ - -static apr_status_t vt_sdbm_open(apr_dbm_t **pdb, const char *pathname, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *pool) -{ - real_file_t file; - int dbmode; - - *pdb = NULL; - - switch (mode) { - case APR_DBM_READONLY: - dbmode = APR_DBM_DBMODE_RO; - break; - case APR_DBM_READWRITE: - dbmode = APR_DBM_DBMODE_RW; - break; - case APR_DBM_RWCREATE: - dbmode = APR_DBM_DBMODE_RWCREATE; - break; - case APR_DBM_RWTRUNC: - dbmode = APR_DBM_DBMODE_RWTRUNC; - break; - default: - return APR_EINVAL; - } - - { - apr_status_t rv; - - rv = apr_sdbm_open(&file, pathname, dbmode, perm, pool); - if (rv != APR_SUCCESS) - return rv; - } - - /* we have an open database... return it */ - *pdb = apr_pcalloc(pool, sizeof(**pdb)); - (*pdb)->pool = pool; - (*pdb)->type = &apr_dbm_type_sdbm; - SET_FILE(*pdb, file); - - /* ### register a cleanup to close the DBM? */ - - return APR_SUCCESS; -} - -static void vt_sdbm_close(apr_dbm_t *dbm) -{ - APR_DBM_CLOSE(dbm->file); -} - -static apr_status_t vt_sdbm_fetch(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t * pvalue) -{ - apr_status_t rv; - cvt_datum_t ckey; - result_datum_t rd; - - CONVERT_DATUM(ckey, &key); - rv = APR_DBM_FETCH(dbm->file, ckey, rd); - RETURN_DATUM(pvalue, rd); - - REGISTER_CLEANUP(dbm, pvalue); - - /* store the error info into DBM, and return a status code. Also, note - that *pvalue should have been cleared on error. */ - return set_error(dbm, rv); -} - -static apr_status_t vt_sdbm_store(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t value) -{ - apr_status_t rv; - cvt_datum_t ckey; - cvt_datum_t cvalue; - - CONVERT_DATUM(ckey, &key); - CONVERT_DATUM(cvalue, &value); - rv = APR_DBM_STORE(dbm->file, ckey, cvalue); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static apr_status_t vt_sdbm_del(apr_dbm_t *dbm, apr_datum_t key) -{ - apr_status_t rv; - cvt_datum_t ckey; - - CONVERT_DATUM(ckey, &key); - rv = APR_DBM_DELETE(dbm->file, ckey); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static int vt_sdbm_exists(apr_dbm_t *dbm, apr_datum_t key) -{ - int exists; - apr_sdbm_datum_t ckey; - - CONVERT_DATUM(ckey, &key); - - { - apr_sdbm_datum_t value; - if (apr_sdbm_fetch(dbm->file, &value, ckey) != APR_SUCCESS) { - exists = 0; - } - else - exists = value.dptr != NULL; - } - - return exists; -} - -static apr_status_t vt_sdbm_firstkey(apr_dbm_t *dbm, apr_datum_t * pkey) -{ - apr_status_t rv; - result_datum_t rd; - - rv = APR_DBM_FIRSTKEY(dbm->file, rd); - RETURN_DATUM(pkey, rd); - - REGISTER_CLEANUP(dbm, pkey); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, rv); -} - -static apr_status_t vt_sdbm_nextkey(apr_dbm_t *dbm, apr_datum_t * pkey) -{ - apr_status_t rv; - cvt_datum_t ckey; - result_datum_t rd; - - CONVERT_DATUM(ckey, pkey); - rv = APR_DBM_NEXTKEY(dbm->file, ckey, rd); - RETURN_DATUM(pkey, rd); - - REGISTER_CLEANUP(dbm, pkey); - - /* store any error info into DBM, and return a status code. */ - return set_error(dbm, APR_SUCCESS); -} - -static void vt_sdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data) -{ - APR_DBM_FREEDPTR(data.dptr); -} - -static void vt_sdbm_usednames(apr_pool_t *pool, const char *pathname, - const char **used1, const char **used2) -{ - char *work; - - /* ### this could be optimized by computing strlen() once and using - ### memcpy and pmemdup instead. but why bother? */ - - *used1 = apr_pstrcat(pool, pathname, APR_SDBM_DIRFEXT, NULL); - *used2 = work = apr_pstrdup(pool, *used1); - - /* we know the extension is 4 characters */ - memcpy(&work[strlen(work) - 4], APR_SDBM_PAGFEXT, 4); -} - - -APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_sdbm = { - "sdbm", - - vt_sdbm_open, - vt_sdbm_close, - vt_sdbm_fetch, - vt_sdbm_store, - vt_sdbm_del, - vt_sdbm_exists, - vt_sdbm_firstkey, - vt_sdbm_nextkey, - vt_sdbm_freedatum, - vt_sdbm_usednames -}; - -#endif /* APU_HAVE_SDBM */ diff --git a/libs/apr-util/dbm/sdbm/sdbm.c b/libs/apr-util/dbm/sdbm/sdbm.c deleted file mode 100644 index 537a5b7254..0000000000 --- a/libs/apr-util/dbm/sdbm/sdbm.c +++ /dev/null @@ -1,588 +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-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - * ex-public domain, ported to APR for Apache 2 - * core routines - */ - -#include "apr.h" -#include "apr_file_io.h" -#include "apr_strings.h" -#include "apr_errno.h" -#include "apr_sdbm.h" - -#include "sdbm_tune.h" -#include "sdbm_pair.h" -#include "sdbm_private.h" - -#include <string.h> /* for memset() */ -#include <stdlib.h> /* for malloc() and free() */ - -/* - * forward - */ -static int getdbit (apr_sdbm_t *, long); -static apr_status_t setdbit(apr_sdbm_t *, long); -static apr_status_t getpage(apr_sdbm_t *db, long); -static apr_status_t getnext(apr_sdbm_datum_t *key, apr_sdbm_t *db); -static apr_status_t makroom(apr_sdbm_t *, long, int); - -/* - * useful macros - */ -#define bad(x) ((x).dptr == NULL || (x).dsize <= 0) -#define exhash(item) sdbm_hash((item).dptr, (item).dsize) - -/* ### Does anything need these externally? */ -#define sdbm_dirfno(db) ((db)->dirf) -#define sdbm_pagfno(db) ((db)->pagf) - -#define OFF_PAG(off) (apr_off_t) (off) * PBLKSIZ -#define OFF_DIR(off) (apr_off_t) (off) * DBLKSIZ - -static long masks[] = { - 000000000000, 000000000001, 000000000003, 000000000007, - 000000000017, 000000000037, 000000000077, 000000000177, - 000000000377, 000000000777, 000000001777, 000000003777, - 000000007777, 000000017777, 000000037777, 000000077777, - 000000177777, 000000377777, 000000777777, 000001777777, - 000003777777, 000007777777, 000017777777, 000037777777, - 000077777777, 000177777777, 000377777777, 000777777777, - 001777777777, 003777777777, 007777777777, 017777777777 -}; - -const apr_sdbm_datum_t sdbm_nullitem = { NULL, 0 }; - -static apr_status_t database_cleanup(void *data) -{ - apr_sdbm_t *db = data; - - /* - * Can't rely on apr_sdbm_unlock, since it will merely - * decrement the refcnt if several locks are held. - */ - if (db->flags & (SDBM_SHARED_LOCK | SDBM_EXCLUSIVE_LOCK)) - (void) apr_file_unlock(db->dirf); - (void) apr_file_close(db->dirf); - (void) apr_file_close(db->pagf); - free(db); - - return APR_SUCCESS; -} - -static apr_status_t prep(apr_sdbm_t **pdb, const char *dirname, const char *pagname, - apr_int32_t flags, apr_fileperms_t perms, apr_pool_t *p) -{ - apr_sdbm_t *db; - apr_status_t status; - - *pdb = NULL; - - db = malloc(sizeof(*db)); - memset(db, 0, sizeof(*db)); - - db->pool = p; - - /* - * adjust user flags so that WRONLY becomes RDWR, - * as required by this package. Also set our internal - * flag for RDONLY if needed. - */ - if (!(flags & APR_WRITE)) { - db->flags |= SDBM_RDONLY; - } - - /* - * adjust the file open flags so that we handle locking - * on our own (don't rely on any locking behavior within - * an apr_file_t, in case it's ever introduced, and set - * our own flag. - */ - if (flags & APR_SHARELOCK) { - db->flags |= SDBM_SHARED; - flags &= ~APR_SHARELOCK; - } - - flags |= APR_BINARY | APR_READ; - - /* - * open the files in sequence, and stat the dirfile. - * If we fail anywhere, undo everything, return NULL. - */ - - if ((status = apr_file_open(&db->dirf, dirname, flags, perms, p)) - != APR_SUCCESS) - goto error; - - if ((status = apr_file_open(&db->pagf, pagname, flags, perms, p)) - != APR_SUCCESS) - goto error; - - if ((status = apr_sdbm_lock(db, (db->flags & SDBM_RDONLY) - ? APR_FLOCK_SHARED - : APR_FLOCK_EXCLUSIVE)) - != APR_SUCCESS) - goto error; - - /* apr_pcalloc zeroed the buffers - * apr_sdbm_lock stated the dirf->size and invalidated the cache - */ - - /* - * if we are opened in SHARED mode, unlock ourself - */ - if (db->flags & SDBM_SHARED) - if ((status = apr_sdbm_unlock(db)) != APR_SUCCESS) - goto error; - - /* make sure that we close the database at some point */ - apr_pool_cleanup_register(p, db, database_cleanup, apr_pool_cleanup_null); - - /* Done! */ - *pdb = db; - return APR_SUCCESS; - -error: - if (db->dirf && db->pagf) - (void) apr_sdbm_unlock(db); - if (db->dirf != NULL) - (void) apr_file_close(db->dirf); - if (db->pagf != NULL) { - (void) apr_file_close(db->pagf); - } - free(db); - return status; -} - -APU_DECLARE(apr_status_t) apr_sdbm_open(apr_sdbm_t **db, const char *file, - apr_int32_t flags, - apr_fileperms_t perms, apr_pool_t *p) -{ - char *dirname = apr_pstrcat(p, file, APR_SDBM_DIRFEXT, NULL); - char *pagname = apr_pstrcat(p, file, APR_SDBM_PAGFEXT, NULL); - - return prep(db, dirname, pagname, flags, perms, p); -} - -APU_DECLARE(apr_status_t) apr_sdbm_close(apr_sdbm_t *db) -{ - return apr_pool_cleanup_run(db->pool, db, database_cleanup); -} - -APU_DECLARE(apr_status_t) apr_sdbm_fetch(apr_sdbm_t *db, apr_sdbm_datum_t *val, - apr_sdbm_datum_t key) -{ - apr_status_t status; - - if (db == NULL || bad(key)) - return APR_EINVAL; - - if ((status = apr_sdbm_lock(db, APR_FLOCK_SHARED)) != APR_SUCCESS) - return status; - - if ((status = getpage(db, exhash(key))) == APR_SUCCESS) { - *val = getpair(db->pagbuf, key); - /* ### do we want a not-found result? */ - } - - (void) apr_sdbm_unlock(db); - - return status; -} - -static apr_status_t write_page(apr_sdbm_t *db, const char *buf, long pagno) -{ - apr_status_t status; - apr_off_t off = OFF_PAG(pagno); - - if ((status = apr_file_seek(db->pagf, APR_SET, &off)) == APR_SUCCESS) - status = apr_file_write_full(db->pagf, buf, PBLKSIZ, NULL); - - return status; -} - -APU_DECLARE(apr_status_t) apr_sdbm_delete(apr_sdbm_t *db, - const apr_sdbm_datum_t key) -{ - apr_status_t status; - - if (db == NULL || bad(key)) - return APR_EINVAL; - if (apr_sdbm_rdonly(db)) - return APR_EINVAL; - - if ((status = apr_sdbm_lock(db, APR_FLOCK_EXCLUSIVE)) != APR_SUCCESS) - return status; - - if ((status = getpage(db, exhash(key))) == APR_SUCCESS) { - if (!delpair(db->pagbuf, key)) - /* ### should we define some APRUTIL codes? */ - status = APR_EGENERAL; - else - status = write_page(db, db->pagbuf, db->pagbno); - } - - (void) apr_sdbm_unlock(db); - - return status; -} - -APU_DECLARE(apr_status_t) apr_sdbm_store(apr_sdbm_t *db, apr_sdbm_datum_t key, - apr_sdbm_datum_t val, int flags) -{ - int need; - register long hash; - apr_status_t status; - - if (db == NULL || bad(key)) - return APR_EINVAL; - if (apr_sdbm_rdonly(db)) - return APR_EINVAL; - need = key.dsize + val.dsize; - /* - * is the pair too big (or too small) for this database ?? - */ - if (need < 0 || need > PAIRMAX) - return APR_EINVAL; - - if ((status = apr_sdbm_lock(db, APR_FLOCK_EXCLUSIVE)) != APR_SUCCESS) - return status; - - if ((status = getpage(db, (hash = exhash(key)))) == APR_SUCCESS) { - - /* - * if we need to replace, delete the key/data pair - * first. If it is not there, ignore. - */ - if (flags == APR_SDBM_REPLACE) - (void) delpair(db->pagbuf, key); - else if (!(flags & APR_SDBM_INSERTDUP) && duppair(db->pagbuf, key)) { - status = APR_EEXIST; - goto error; - } - /* - * if we do not have enough room, we have to split. - */ - if (!fitpair(db->pagbuf, need)) - if ((status = makroom(db, hash, need)) != APR_SUCCESS) - goto error; - /* - * we have enough room or split is successful. insert the key, - * and update the page file. - */ - (void) putpair(db->pagbuf, key, val); - - status = write_page(db, db->pagbuf, db->pagbno); - } - -error: - (void) apr_sdbm_unlock(db); - - return status; -} - -/* - * makroom - make room by splitting the overfull page - * this routine will attempt to make room for SPLTMAX times before - * giving up. - */ -static apr_status_t makroom(apr_sdbm_t *db, long hash, int need) -{ - long newp; - char twin[PBLKSIZ]; - char *pag = db->pagbuf; - char *new = twin; - register int smax = SPLTMAX; - apr_status_t status; - - do { - /* - * split the current page - */ - (void) splpage(pag, new, db->hmask + 1); - /* - * address of the new page - */ - newp = (hash & db->hmask) | (db->hmask + 1); - - /* - * write delay, read avoidence/cache shuffle: - * select the page for incoming pair: if key is to go to the new page, - * write out the previous one, and copy the new one over, thus making - * it the current page. If not, simply write the new page, and we are - * still looking at the page of interest. current page is not updated - * here, as sdbm_store will do so, after it inserts the incoming pair. - */ - if (hash & (db->hmask + 1)) { - if ((status = write_page(db, db->pagbuf, db->pagbno)) - != APR_SUCCESS) - return status; - - db->pagbno = newp; - (void) memcpy(pag, new, PBLKSIZ); - } - else { - if ((status = write_page(db, new, newp)) != APR_SUCCESS) - return status; - } - - if ((status = setdbit(db, db->curbit)) != APR_SUCCESS) - return status; - /* - * see if we have enough room now - */ - if (fitpair(pag, need)) - return APR_SUCCESS; - /* - * try again... update curbit and hmask as getpage would have - * done. because of our update of the current page, we do not - * need to read in anything. BUT we have to write the current - * [deferred] page out, as the window of failure is too great. - */ - db->curbit = 2 * db->curbit - + ((hash & (db->hmask + 1)) ? 2 : 1); - db->hmask |= db->hmask + 1; - - if ((status = write_page(db, db->pagbuf, db->pagbno)) - != APR_SUCCESS) - return status; - - } while (--smax); - - /* - * if we are here, this is real bad news. After SPLTMAX splits, - * we still cannot fit the key. say goodnight. - */ -#if 0 - (void) write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44); -#endif - /* ### ENOSPC not really appropriate but better than nothing */ - return APR_ENOSPC; - -} - -/* Reads 'len' bytes from file 'f' at offset 'off' into buf. - * 'off' is given relative to the start of the file. - * If EOF is returned while reading, this is taken as success. - */ -static apr_status_t read_from(apr_file_t *f, void *buf, - apr_off_t off, apr_size_t len) -{ - apr_status_t status; - - if ((status = apr_file_seek(f, APR_SET, &off)) != APR_SUCCESS || - ((status = apr_file_read_full(f, buf, len, NULL)) != APR_SUCCESS)) { - /* if EOF is reached, pretend we read all zero's */ - if (status == APR_EOF) { - memset(buf, 0, len); - status = APR_SUCCESS; - } - } - - return status; -} - -/* - * the following two routines will break if - * deletions aren't taken into account. (ndbm bug) - */ -APU_DECLARE(apr_status_t) apr_sdbm_firstkey(apr_sdbm_t *db, - apr_sdbm_datum_t *key) -{ - apr_status_t status; - - if ((status = apr_sdbm_lock(db, APR_FLOCK_SHARED)) != APR_SUCCESS) - return status; - - /* - * start at page 0 - */ - if ((status = read_from(db->pagf, db->pagbuf, OFF_PAG(0), PBLKSIZ)) - == APR_SUCCESS) { - db->pagbno = 0; - db->blkptr = 0; - db->keyptr = 0; - status = getnext(key, db); - } - - (void) apr_sdbm_unlock(db); - - return status; -} - -APU_DECLARE(apr_status_t) apr_sdbm_nextkey(apr_sdbm_t *db, - apr_sdbm_datum_t *key) -{ - apr_status_t status; - - if ((status = apr_sdbm_lock(db, APR_FLOCK_SHARED)) != APR_SUCCESS) - return status; - - status = getnext(key, db); - - (void) apr_sdbm_unlock(db); - - return status; -} - -/* - * all important binary tree traversal - */ -static apr_status_t getpage(apr_sdbm_t *db, long hash) -{ - register int hbit; - register long dbit; - register long pagb; - apr_status_t status; - - dbit = 0; - hbit = 0; - while (dbit < db->maxbno && getdbit(db, dbit)) - dbit = 2 * dbit + ((hash & (1 << hbit++)) ? 2 : 1); - - debug(("dbit: %d...", dbit)); - - db->curbit = dbit; - db->hmask = masks[hbit]; - - pagb = hash & db->hmask; - /* - * see if the block we need is already in memory. - * note: this lookaside cache has about 10% hit rate. - */ - if (pagb != db->pagbno) { - /* - * note: here, we assume a "hole" is read as 0s. - * if not, must zero pagbuf first. - * ### joe: this assumption was surely never correct? but - * ### we make it so in read_from anyway. - */ - if ((status = read_from(db->pagf, db->pagbuf, OFF_PAG(pagb), PBLKSIZ)) - != APR_SUCCESS) - return status; - - if (!chkpage(db->pagbuf)) - return APR_ENOSPC; /* ### better error? */ - db->pagbno = pagb; - - debug(("pag read: %d\n", pagb)); - } - return APR_SUCCESS; -} - -static int getdbit(apr_sdbm_t *db, long dbit) -{ - register long c; - register long dirb; - - c = dbit / BYTESIZ; - dirb = c / DBLKSIZ; - - if (dirb != db->dirbno) { - if (read_from(db->dirf, db->dirbuf, OFF_DIR(dirb), DBLKSIZ) - != APR_SUCCESS) - return 0; - - db->dirbno = dirb; - - debug(("dir read: %d\n", dirb)); - } - - return db->dirbuf[c % DBLKSIZ] & (1 << dbit % BYTESIZ); -} - -static apr_status_t setdbit(apr_sdbm_t *db, long dbit) -{ - register long c; - register long dirb; - apr_status_t status; - apr_off_t off; - - c = dbit / BYTESIZ; - dirb = c / DBLKSIZ; - - if (dirb != db->dirbno) { - if ((status = read_from(db->dirf, db->dirbuf, OFF_DIR(dirb), DBLKSIZ)) - != APR_SUCCESS) - return status; - - db->dirbno = dirb; - - debug(("dir read: %d\n", dirb)); - } - - db->dirbuf[c % DBLKSIZ] |= (1 << dbit % BYTESIZ); - - if (dbit >= db->maxbno) - db->maxbno += DBLKSIZ * BYTESIZ; - - off = OFF_DIR(dirb); - if ((status = apr_file_seek(db->dirf, APR_SET, &off)) == APR_SUCCESS) - status = apr_file_write_full(db->dirf, db->dirbuf, DBLKSIZ, NULL); - - return status; -} - -/* -* getnext - get the next key in the page, and if done with -* the page, try the next page in sequence -*/ -static apr_status_t getnext(apr_sdbm_datum_t *key, apr_sdbm_t *db) -{ - apr_status_t status; - for (;;) { - db->keyptr++; - *key = getnkey(db->pagbuf, db->keyptr); - if (key->dptr != NULL) - return APR_SUCCESS; - /* - * we either run out, or there is nothing on this page.. - * try the next one... If we lost our position on the - * file, we will have to seek. - */ - db->keyptr = 0; - if (db->pagbno != db->blkptr++) { - apr_off_t off = OFF_PAG(db->blkptr); - if ((status = apr_file_seek(db->pagf, APR_SET, &off) - != APR_SUCCESS)) - return status; - } - - db->pagbno = db->blkptr; - /* ### EOF acceptable here too? */ - if ((status = apr_file_read_full(db->pagf, db->pagbuf, PBLKSIZ, NULL)) - != APR_SUCCESS) - return status; - if (!chkpage(db->pagbuf)) - return APR_EGENERAL; /* ### need better error */ - } - - /* NOTREACHED */ -} - - -APU_DECLARE(int) apr_sdbm_rdonly(apr_sdbm_t *db) -{ - /* ### Should we return true if the first lock is a share lock, - * to reflect that apr_sdbm_store and apr_sdbm_delete will fail? - */ - return (db->flags & SDBM_RDONLY) != 0; -} - diff --git a/libs/apr-util/dbm/sdbm/sdbm_hash.c b/libs/apr-util/dbm/sdbm/sdbm_hash.c deleted file mode 100644 index 012e3d0750..0000000000 --- a/libs/apr-util/dbm/sdbm/sdbm_hash.c +++ /dev/null @@ -1,63 +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-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - * status: ex-public domain. keep it that way. - * - * hashing routine - */ - -#include "apr_sdbm.h" -#include "sdbm_private.h" - -/* - * polynomial conversion ignoring overflows - * [this seems to work remarkably well, in fact better - * then the ndbm hash function. Replace at your own risk] - * use: 65599 nice. - * 65587 even better. - */ -long sdbm_hash(const char *str, int len) -{ - register unsigned long n = 0; - -#define DUFF /* go ahead and use the loop-unrolled version */ -#ifdef DUFF - -#define HASHC n = *str++ + 65599 * n - - if (len > 0) { - register int loop = (len + 8 - 1) >> 3; - - switch(len & (8 - 1)) { - case 0: do { - HASHC; case 7: HASHC; - case 6: HASHC; case 5: HASHC; - case 4: HASHC; case 3: HASHC; - case 2: HASHC; case 1: HASHC; - } while (--loop); - } - - } -#else - while (len--) - n = *str++ + 65599 * n; -#endif - return n; -} diff --git a/libs/apr-util/dbm/sdbm/sdbm_lock.c b/libs/apr-util/dbm/sdbm/sdbm_lock.c deleted file mode 100644 index a001ed413b..0000000000 --- a/libs/apr-util/dbm/sdbm/sdbm_lock.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 "apr_file_info.h" -#include "apr_file_io.h" -#include "apr_sdbm.h" - -#include "sdbm_private.h" -#include "sdbm_tune.h" - -/* NOTE: this function blocks until it acquires the lock */ -APU_DECLARE(apr_status_t) apr_sdbm_lock(apr_sdbm_t *db, int type) -{ - apr_status_t status; - - if (!(type == APR_FLOCK_SHARED || type == APR_FLOCK_EXCLUSIVE)) - return APR_EINVAL; - - if (db->flags & SDBM_EXCLUSIVE_LOCK) { - ++db->lckcnt; - return APR_SUCCESS; - } - else if (db->flags & SDBM_SHARED_LOCK) { - /* - * Cannot promote a shared lock to an exlusive lock - * in a cross-platform compatibile manner. - */ - if (type == APR_FLOCK_EXCLUSIVE) - return APR_EINVAL; - ++db->lckcnt; - return APR_SUCCESS; - } - /* - * zero size: either a fresh database, or one with a single, - * unsplit data page: dirpage is all zeros. - */ - if ((status = apr_file_lock(db->dirf, type)) == APR_SUCCESS) - { - apr_finfo_t finfo; - if ((status = apr_file_info_get(&finfo, APR_FINFO_SIZE, db->dirf)) - != APR_SUCCESS) { - (void) apr_file_unlock(db->dirf); - return status; - } - - SDBM_INVALIDATE_CACHE(db, finfo); - - ++db->lckcnt; - if (type == APR_FLOCK_SHARED) - db->flags |= SDBM_SHARED_LOCK; - else if (type == APR_FLOCK_EXCLUSIVE) - db->flags |= SDBM_EXCLUSIVE_LOCK; - } - return status; -} - -APU_DECLARE(apr_status_t) apr_sdbm_unlock(apr_sdbm_t *db) -{ - if (!(db->flags & (SDBM_SHARED_LOCK | SDBM_EXCLUSIVE_LOCK))) - return APR_EINVAL; - if (--db->lckcnt > 0) - return APR_SUCCESS; - db->flags &= ~(SDBM_SHARED_LOCK | SDBM_EXCLUSIVE_LOCK); - return apr_file_unlock(db->dirf); -} diff --git a/libs/apr-util/dbm/sdbm/sdbm_pair.c b/libs/apr-util/dbm/sdbm/sdbm_pair.c deleted file mode 100644 index 3fe82b6664..0000000000 --- a/libs/apr-util/dbm/sdbm/sdbm_pair.c +++ /dev/null @@ -1,319 +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-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - * status: ex-public domain. - * - * page-level routines - */ - -#include "apr_sdbm.h" - -#include "sdbm_tune.h" -#include "sdbm_pair.h" -#include "sdbm_private.h" - -#include <string.h> /* for memset() */ - - -#define exhash(item) sdbm_hash((item).dptr, (item).dsize) - -/* - * forward - */ -static int seepair(char *, int, char *, int); - -/* - * page format: - * +------------------------------+ - * ino | n | keyoff | datoff | keyoff | - * +------------+--------+--------+ - * | datoff | - - - ----> | - * +--------+---------------------+ - * | 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 <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#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 <panos@alumni.cs.colorado.edu> 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 <sys/uio.h> /* for struct iovec */ -#endif -#if APR_HAVE_STDARG_H -#include <stdarg.h> -#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: - * <pre> - * while (e != APR_BRIGADE_SENTINEL(b)) { - * ... - * e = APR_BUCKET_NEXT(e); - * } - * </pre> - * @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: - * <pre> - * APR_BUCKET_REMOVE(e); - * apr_bucket_destroy(e); - * </pre> - * @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): - * <PRE> - * '\@' - uppercase letter - * '\$' - lowercase letter - * '\&' - hex digit - * '#' - digit - * '~' - digit or space - * '*' - swallow remaining characters - * </PRE> - * @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: - * <PRE> - * 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 - * </PRE> - * @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. - * <PRE> - * 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] - * </PRE> - * - * @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) - * <pre> - * GDBM for GDBM files - * SDBM for SDBM files - * DB for berkeley DB files - * NDBM for NDBM files - * default for the default DBM type - * </pre> - * @param name The dbm file name to open - * @param mode The flag value - * <PRE> - * 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 - * </PRE> - * @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 - * <PRE> - * 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 - * </PRE> - * @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 <lber.h> -#include <ldap.h> -#if APR_HAS_LDAP_SSL -#include <ldap_ssl.h> -#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 <winldap.h> - - -/* - * 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) - * <PRE> - * 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 - * </PRE> - * @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 - * <PRE> - * APR_FLOCK_SHARED - * APR_FLOCK_EXCLUSIVE - * </PRE> - * @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 - * <PRE> - * APR_SDBM_INSERT return an error if the record exists - * APR_SDBM_REPLACE overwrite any existing record for key - * </PRE> - */ -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: - * <PRE> - * 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" - * </PRE> - * @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: - * <PRE> - * 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 - * </PRE> - * @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 '&lt;', '&gt;', and '&amp;'. - * @param p The pool to allocate out of - * @param s The string to quote - * @param quotes If quotes is true, then replace '"' with '&quot;'. - * @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 - * - * <PRE> - * 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) - * </PRE> - */ - -/* --------------------------------------------------------------------- */ - -#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 - * - * <PRE> - * 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) - * </PRE> - */ - -/* --------------------------------------------------------------------- */ - -#ifdef APU_WANT_DB - -#if APU_HAVE_DB -/* win32 note.. you will need to change this for db1 */ -#include <db.h> -#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 - * - * <PRE> - * 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) - * </PRE> - */ - -/* --------------------------------------------------------------------- */ - -#ifdef APU_WANT_DB - -#if APU_HAVE_DB -/* win32 note.. you will need to change this for db1 */ -#include <db.h> -#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 <stdarg.h> - -#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 <db.h> -#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: <ldapurl> and <URL:ldapurl> - */ - -#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 <stdlib.h> -#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 <stdlib.h> -#endif - -#if APR_HAVE_CTYPE_H -#include <ctype.h> -#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 - * <x> - 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 <andrew@vancouver-webpages.com>, 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 <assert.h> - -#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 <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#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 <stdio.h> - -#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 <netware.h> -#include <screen.h> -#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 <stdio.h> -#include <stdlib.h> -#include <time.h> -#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<count; i++) { - sqf = apr_psprintf(pool, sql, i, i, i); - rv = apr_dbd_query(driver, handle, &nrows, sqf); - ABTS_ASSERT(tc, sqf, rv == APR_SUCCESS); - ABTS_ASSERT(tc, sqf, 1 == nrows); - } -} - -static void select_rows(abts_case *tc, apr_dbd_t* handle, - const apr_dbd_driver_t* driver, int count) -{ - apr_status_t rv; - apr_pool_t* pool = p; - apr_pool_t* tpool; - const char* sql = "SELECT * FROM apr_dbd_test ORDER BY col1"; - apr_dbd_results_t *res = NULL; - apr_dbd_row_t *row = NULL; - int i; - - rv = apr_dbd_select(driver, pool, handle, &res, sql, 0); - ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); - ABTS_PTR_NOTNULL(tc, res); - - apr_pool_create(&tpool, pool); - i = count; - while (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 <stdio.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <stdlib.h> /* for atexit(), malloc() */ -#include <string.h> - -#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 <stdlib.h> -#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 <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#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 <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#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 <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#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 <apr_thread_proc.h> -#include <apr_errno.h> -#include <apr_general.h> -#include <apr_getopt.h> -#include <apr_strings.h> -#include "errno.h" -#include <stdio.h> -#include <stdlib.h> -#include <apr_time.h> -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <apr_portable.h> -#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", &current_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", &current_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<numconsumers;i++) { - rv = apr_thread_create(&t[i], NULL, consumer, queue, context); - if (rv != APR_SUCCESS) { - apr_strerror(rv, errorbuf,200); - fprintf(stderr, "Failed\nError starting consumer thread (%d) rv=%d:%s\n",i, rv,errorbuf); - exit(-1); - - } - } - for (i=numconsumers;i<(numconsumers+numproducers);i++) { - rv = apr_thread_create(&t[i], NULL, producer, queue, context); - if (rv != APR_SUCCESS) { - apr_strerror(rv, errorbuf,200); - fprintf(stderr, "Failed\nError starting producer thread (%d) rv=%d:%s\n",i, rv,errorbuf); - exit(-1); - - } - } - - printf("OK\n"); - printf("%-60s", "Sleeping\n"); - apr_sleep( sleeptime * 1000000 ); /* sleep 10 seconds */ - printf("OK\n"); - - printf("%-60s", "Terminating queue"); - rv = apr_queue_term(queue); - if (rv != APR_SUCCESS) { - apr_strerror(rv, errorbuf,200); - fprintf( stderr, "apr_queue_term failed %d:%s\n",rv,errorbuf); - } - printf("OK\n"); - - - printf("%-60s", "Waiting for threads to exit\n"); - fflush(stdout); - for (i=0;i<numconsumers+numproducers;i++) { - apr_thread_join(&rv, t[i]); - if (rv != 0 ) { - apr_strerror(rv, errorbuf,200); - if (i<numconsumers) - fprintf( stderr, "consumer thread %d failed rv %d:%s\n",i,rv,errorbuf); - else - fprintf( stderr, "producer thread %d failed rv %d:%s\n",i,rv,errorbuf); - } - } - - printf("OK\n"); - - apr_terminate(); - - return 0; -} - -#endif /* !APR_HAS_THREADS */ diff --git a/libs/apr-util/test/testreslist.c b/libs/apr-util/test/testreslist.c deleted file mode 100644 index e5879682d7..0000000000 --- a/libs/apr-util/test/testreslist.c +++ /dev/null @@ -1,300 +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 <stdio.h> -#include <stdlib.h> -#include "apr_reslist.h" -#include "apr_thread_proc.h" - -#if APR_HAVE_TIME_H -#include <time.h> -#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 <errno.h> -#include <stdio.h> -#include <stdlib.h> -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#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 <stdlib.h> -#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 <stdio.h> -#include <stdlib.h> - -#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 <stdio.h> -#include <stdlib.h> - -#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 <stdio.h> -#include <stdlib.h> - -#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 <stdlib.h> /* 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("<?xml version=\"1.0\" ?>\n<maryx>" - "<had a=\"little\"/><lamb its='fleece " - "was white as snow' />\n", *fd); - if (rv != APR_SUCCESS) - return rv; - - for (i = 0; i < 5000; i++) { - rv = apr_file_puts("<hmm roast=\"lamb\" " - "for=\"dinner\">yummy</hmm>\n", *fd); - if (rv != APR_SUCCESS) - return rv; - } - rv = apr_file_puts("</mary>\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("<?xml version=\"1.0\" ?>\n<mary>" - "<had a=\"little\"/><lamb its='fleece " - "was white as snow' />\n", *fd); - if (rv != APR_SUCCESS) - return rv; - - for (i = 0; i < 5000; i++) { - rv = apr_file_puts("<hmm roast=\"lamb\" " - "for=\"dinner\">yummy</hmm>\n", *fd); - if (rv != APR_SUCCESS) - return rv; - } - rv = apr_file_puts("</mary>\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 <stdlib.h> - -#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 <stddef.h> /* for NULL */ -#endif -#if APR_HAVE_STRING_H -#include <string.h> -#endif -#if APR_HAVE_STRINGS_H -#include <strings.h> -#endif -#ifdef HAVE_ICONV_H -#include <iconv.h> -#endif -#if APU_HAVE_APR_ICONV -#include <apr_iconv.h> -#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 '&lt;', '&gt;', and '&amp;'. -** If quotes is true, then replace '"' with '&quot;'. -** -** 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; /* &lt; or &gt; */ - else if (c == '&') - extra += 4; /* &amp; */ - else if (quotes && c == '"') - extra += 5; /* &quot; */ - } - - /* 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: <ns%d:%s> */ - 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 "/": - * <ns%d:%s> ... </ns%d:%s> - * OR <%s> ... </%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, "<ns%d:%s", ns, elem->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, "</%s>", elem->name); - } - else { - ns = ns_map ? ns_map[elem->ns] : elem->ns; - len = sprintf(s, "</ns%d:%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, "<ns%d:%s/>" 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 <<ENDTEST -#!/bin/sh -if [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then - exit 0 -fi -exit 1 -ENDTEST - - if `/bin/sh $testfile 2>/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 <http://www.gnu.org/licenses/>. -# -# 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 <config-patches@gnu.org>." - -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 <features.h> - #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 <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -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 <sys/systemcfg.h> - - 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 <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -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 <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -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' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|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 <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # 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 <<EOF -$0: unable to guess system type - -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from - - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -and - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> 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 <http://www.gnu.org/licenses/>. -# -# 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 <config-patches@gnu.org>." - -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 <pinard@iro.umontreal.ca>, 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 <friedman@prep.ai.mit.edu> -# 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 <memory.h> -#include <string.h> - -#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 <stdlib.h> - -#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 (<!ENTITY foo "bar">), 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 ,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dc ,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 <windows.h> -#undef WIN32_LEAN_AND_MEAN - -#include <memory.h> -#include <string.h> - -#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 <config.h> - -#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 <string.h> -#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 <stddef.h> - -#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 <config.h> -#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 <config.h> -#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 <e/> */ -#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 /* <!foo */ -#define XML_TOK_DECL_CLOSE 17 /* > */ -#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_COND_SECT_CLOSE 34 /* ]]> */ -#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 "<!-" */ - -static -int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr != end) { - if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - ptr += MINBPC(enc); - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - INVALID_CASES(ptr, nextTokPtr) - case BT_MINUS: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_COMMENT; - } - break; - default: - ptr += MINBPC(enc); - break; - } - } - } - return XML_TOK_PARTIAL; -} - -/* ptr points to character following "<!" */ - -static -int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - case BT_MINUS: - return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_LSQB: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_COND_SECT_OPEN; - case BT_NMSTRT: - case BT_HEX: - ptr += MINBPC(enc); - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_PERCNT: - if (ptr + MINBPC(enc) == end) - return XML_TOK_PARTIAL; - /* don't allow <!ENTITY% foo "whatever"> */ - 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 "<?" */ - -static -int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - int tok; - const char *target = ptr; - 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_S: case BT_CR: case BT_LF: - if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - ptr += MINBPC(enc); - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - INVALID_CASES(ptr, nextTokPtr) - case BT_QUEST: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { - *nextTokPtr = ptr + MINBPC(enc); - return tok; - } - break; - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; - case BT_QUEST: - if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { - *nextTokPtr = ptr + MINBPC(enc); - return tok; - } - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - - -static -int PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, ASCII_LSQB }; - int i; - /* CDATA[ */ - if (end - ptr < 6 * MINBPC(enc)) - return XML_TOK_PARTIAL; - for (i = 0; i < 6; i++, ptr += MINBPC(enc)) { - if (!CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - *nextTokPtr = ptr; - return XML_TOK_CDATA_SECT_OPEN; -} - -static -int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - 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_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 "</" */ - -static -int PREFIX(scanEndTag)(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_S: case BT_CR: case BT_LF: - for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_CR: case BT_LF: - break; - case BT_GT: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_END_TAG; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -#ifdef XML_NS - case BT_COLON: - /* no need to check qname syntax here, since end-tag must match exactly */ - ptr += MINBPC(enc); - break; -#endif - case BT_GT: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_END_TAG; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -/* ptr points to character following "&#X" */ - -static -int PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - case BT_HEX: - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - case BT_HEX: - break; - case BT_SEMI: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CHAR_REF; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - } - return XML_TOK_PARTIAL; -} - -/* ptr points to character following "&#" */ - -static -int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr != end) { - if (CHAR_MATCHES(enc, ptr, ASCII_x)) - return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - break; - case BT_SEMI: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CHAR_REF; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - } - return XML_TOK_PARTIAL; -} - -/* ptr points to character following "&" */ - -static -int PREFIX(scanRef)(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_NUM: - return PREFIX(scanCharRef)(enc, ptr + MINBPC(enc), 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_SEMI: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_ENTITY_REF; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -/* ptr points to character following first character of attribute name */ - -static -int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ -#ifdef XML_NS - int hadColon = 0; -#endif - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) -#ifdef XML_NS - case BT_COLON: - if (hadColon) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - hadColon = 1; - ptr += MINBPC(enc); - 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; - } - break; -#endif - case BT_S: case BT_CR: case BT_LF: - for (;;) { - int t; - - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - t = BYTE_TYPE(enc, ptr); - if (t == BT_EQUALS) - break; - switch (t) { - case BT_S: - case BT_LF: - case BT_CR: - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - /* fall through */ - case BT_EQUALS: - { - int open; -#ifdef XML_NS - hadColon = 0; -#endif - for (;;) { - - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - open = BYTE_TYPE(enc, ptr); - if (open == BT_QUOT || open == BT_APOS) - break; - switch (open) { - case BT_S: - case BT_LF: - case BT_CR: - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - ptr += MINBPC(enc); - /* in attribute value */ - for (;;) { - int t; - if (ptr == end) - return XML_TOK_PARTIAL; - t = BYTE_TYPE(enc, ptr); - if (t == open) - break; - switch (t) { - INVALID_CASES(ptr, nextTokPtr) - case BT_AMP: - { - int tok = PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, &ptr); - if (tok <= 0) { - if (tok == XML_TOK_INVALID) - *nextTokPtr = ptr; - return tok; - } - break; - } - case BT_LT: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - default: - ptr += MINBPC(enc); - break; - } - } - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: - case BT_CR: - case BT_LF: - break; - case BT_SOL: - goto sol; - case BT_GT: - goto gt; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - /* ptr points to closing quote */ - for (;;) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_S: case BT_CR: case BT_LF: - continue; - case BT_GT: - gt: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_START_TAG_WITH_ATTS; - case BT_SOL: - sol: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_EMPTY_ELEMENT_WITH_ATTS; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - break; - } - break; - } - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -/* ptr points to character following "<" */ - -static -int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ -#ifdef XML_NS - int hadColon; -#endif - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_EXCL: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - case BT_MINUS: - return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_LSQB: - return PREFIX(scanCdataSection)(enc, ptr + MINBPC(enc), end, nextTokPtr); - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_QUEST: - return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_SOL: - return PREFIX(scanEndTag)(enc, ptr + MINBPC(enc), end, nextTokPtr); - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } -#ifdef XML_NS - hadColon = 0; -#endif - /* we have a start-tag */ - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) -#ifdef XML_NS - case BT_COLON: - if (hadColon) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - hadColon = 1; - ptr += MINBPC(enc); - 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; - } - break; -#endif - case BT_S: case BT_CR: case BT_LF: - { - ptr += MINBPC(enc); - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_GT: - goto gt; - case BT_SOL: - goto sol; - case BT_S: case BT_CR: case BT_LF: - ptr += MINBPC(enc); - continue; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - return PREFIX(scanAtts)(enc, ptr, end, nextTokPtr); - } - return XML_TOK_PARTIAL; - } - case BT_GT: - gt: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_START_TAG_NO_ATTS; - case BT_SOL: - sol: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_EMPTY_ELEMENT_NO_ATTS; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static -int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - 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_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 <stddef.h> 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 <apr_portable.h> +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 <switch_private.h> #endif #include "private/switch_core_pvt.h" +#include "private/switch_apr_pvt.h" /* apr headers*/ #include <apr.h> @@ -70,17 +71,14 @@ /* apr_vformatter_buff_t definition*/ #include <apr_lib.h> -/* apr-util headers */ -#include <apr_queue.h> -#include <apr_uuid.h> #if (defined(HAVE_LIBMD5) || defined(HAVE_LIBMD) || defined(HAVE_MD5INIT)) #include <md5.h> #elif defined(HAVE_LIBCRYPTO) #include <openssl/md5.h> -#else -#include <apr_md5.h> #endif +#include <uuid/uuid.h> + /* 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 <apr.h> +#include <apr_thread_proc.h> +#include <apr_thread_mutex.h> +#include <apr_thread_cond.h> -#if APR_HAVE_STDIO_H -#include <stdio.h> -#endif -#if APR_HAVE_STDLIB_H -#include <stdlib.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#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 <chris@signalwire.com> Date: Tue, 16 Aug 2022 18:01:53 -0400 Subject: [PATCH 564/655] [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 <anthm@freeswitch.org> - 2001-2003 Allan Saddi <allan@saddi.com> -License: MPL-1.1 - -Files: libs/libdingaling/src/sha1.[ch] -Copyright: 2001-2003 Allan Saddi <allan@saddi.com> -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 @@ -<configuration name="dingaling.conf" description="XMPP Jingle Endpoint"> - <settings> - <param name="debug" value="0"/> - <param name="codec-prefs" value="PCMU"/> - </settings> - - <X-PRE-PROCESS cmd="include" data="../jingle_profiles/*.xml"/> - -</configuration> 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 <anthm@freeswitch.org> - 2001-2003 Allan Saddi <allan@saddi.com> -License: MPL-1.1 - -Files: libs/libdingaling/src/sha1.[ch] -Copyright: 2001-2003 Allan Saddi <allan@saddi.com> -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 <anthm@freeswitch.org> -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 <anthm@freeswitch.org> - Primary developer of all core components - and many of the included modules. Much of freeswitch is based on his work. - - Michael Jerris <mike@jerris.com> - 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=<desired 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=<arch>], [use architecture <arch> 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 <stdio.h>], [ - 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 <tromey@cygnus.com>. -# -# 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 <bug-automake@gnu.org> or send patches to -# <automake-patches@gnu.org>. - -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 <bug-automake@gnu.org>. -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 <http://www.gnu.org/licenses/>. -# -# 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 <config-patches@gnu.org>." - -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 <features.h> - #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 <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -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 <sys/systemcfg.h> - - 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 <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -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 <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -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' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|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 <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # 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 <<EOF -$0: unable to guess system type - -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from - - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -and - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> 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 <http://www.gnu.org/licenses/>. -# -# 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 <config-patches@gnu.org>." - -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 <oliva@dcc.unicamp.br>. - -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 <bug-automake@gnu.org>. -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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="docs" - ProjectGUID="{1A1FF289-4FD6-4285-A422-D31DD67A4723}" - RootNamespace="docs" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - BuildLogFile="" - > - <Tool - Name="VCPreBuildEventTool" - CommandLine="" - /> - <Tool - Name="VCCustomBuildTool" - CommandLine="" - AdditionalDependencies="" - Outputs="" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\src\include; ..\libs\include" - PreprocessorDefinitions="WIN32" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - OutputDocumentFile="" - /> - <Tool - Name="VCBscMakeTool" - OutputFile="" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - BuildLogFile="" - > - <Tool - Name="VCPreBuildEventTool" - CommandLine="" - /> - <Tool - Name="VCCustomBuildTool" - CommandLine="" - AdditionalDependencies="" - Outputs="" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\src\include; ..\libs\include" - PreprocessorDefinitions="WIN32" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - OutputDocumentFile="" - /> - <Tool - Name="VCBscMakeTool" - OutputFile="" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\Doxygen.conf" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="doxygen $(InputPath)" - AdditionalDependencies="..\src\include\switch.h;..\src\include\switch_apr.h;..\src\include\switch_buffer.h;..\src\include\switch_caller.h;..\src\include\switch_channel.h;..\src\include\switch_config.h;..\src\include\switch_console.h;..\src\include\switch_core.h;..\src\include\switch_event.h;..\src\include\switch_frame.h;..\src\include\switch_loadable_module.h;..\src\include\switch_module_interface.h;..\src\include\switch_mutex.h;..\src\include\switch_platform.h;..\src\include\switch_resample.h;..\src\include\switch_sqlite.h;..\src\include\switch_types.h;..\src\include\switch_utils.h" - Outputs="html/index.html" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="doxygen $(InputPath)" - AdditionalDependencies="..\src\include\switch.h;..\src\include\switch_apr.h;..\src\include\switch_buffer.h;..\src\include\switch_caller.h;..\src\include\switch_channel.h;..\src\include\switch_config.h;..\src\include\switch_console.h;..\src\include\switch_core.h;..\src\include\switch_event.h;..\src\include\switch_frame.h;..\src\include\switch_loadable_module.h;..\src\include\switch_module_interface.h;..\src\include\switch_mutex.h;..\src\include\switch_platform.h;..\src\include\switch_resample.h;..\src\include\switch_sqlite.h;..\src\include\switch_types.h;..\src\include\switch_utils.h" - Outputs="html/index.html" - /> - </FileConfiguration> - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="libdingaling" - ProjectGUID="{1906D736-08BD-4EE1-924F-B536249B9A54}" - RootNamespace="libdingaling" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - DebugInformationFormat="3" - DisableSpecificWarnings="4100;4706" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug DLL|Win32" - OutputDirectory="$(SolutionDir)Debug" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - DebugInformationFormat="4" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libapr-1.lib libaprutil-1.lib iksemel.lib Ws2_32.lib" - AdditionalLibraryDirectories="..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug" - ModuleDefinitionFile=".\src\dingaling.def" - GenerateDebugInformation="true" - OptimizeReferences="1" - EnableCOMDATFolding="1" - OptimizeForWindows98="1" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release DLL|Win32" - OutputDirectory="$(SolutionDir)Release" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libapr-1.lib libaprutil-1.lib iksemel.lib Ws2_32.lib" - AdditionalLibraryDirectories="..\apr\Release;..\apr-util\Release;..\iksemel\Release" - ModuleDefinitionFile=".\src\dingaling.def" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - DebugInformationFormat="3" - DisableSpecificWarnings="4100;4706" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug DLL|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libapr-1.lib libaprutil-1.lib iksemel.lib Ws2_32.lib" - AdditionalLibraryDirectories="..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug" - ModuleDefinitionFile=".\src\dingaling.def" - GenerateDebugInformation="true" - OptimizeReferences="1" - EnableCOMDATFolding="1" - OptimizeForWindows98="1" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release DLL|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libapr-1.lib libaprutil-1.lib iksemel.lib Ws2_32.lib" - AdditionalLibraryDirectories="..\apr\Release;..\apr-util\Release;..\iksemel\Release" - ModuleDefinitionFile=".\src\dingaling.def" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\libdingaling.c" - > - </File> - <File - RelativePath=".\src\sha1.c" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\src\ldl_compat.h" - > - </File> - <File - RelativePath=".\src\libdingaling.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - <File - RelativePath=".\src\dingaling.def" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\libdingaling.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="src\sha1.c"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="src\ldl_compat.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="src\libdingaling.h"> - <Filter>Header Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <None Include="src\dingaling.def"> - <Filter>Source Files</Filter> - </None> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug DLL|Win32"> - <Configuration>Debug DLL</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug DLL|x64"> - <Configuration>Debug DLL</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release DLL|Win32"> - <Configuration>Release DLL</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release DLL|x64"> - <Configuration>Release DLL</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>libdingaling</ProjectName> - <ProjectGuid>{1906D736-08BD-4EE1-924F-B536249B9A54}</ProjectGuid> - <RootNamespace>libdingaling</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\w32\extlib.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">$(SolutionDir)Debug\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'">$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">$(SolutionDir)Release\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'">$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'">$(Platform)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'">$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>.;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level4</WarningLevel> - <DisableSpecificWarnings>4718;4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>.;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <WarningLevel>Level4</WarningLevel> - <DisableSpecificWarnings>4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>.;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - <DisableSpecificWarnings>4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <ModuleDefinitionFile>.\src\dingaling.def</ModuleDefinitionFile> - <GenerateDebugInformation>true</GenerateDebugInformation> - <OptimizeReferences>false</OptimizeReferences> - <EnableCOMDATFolding>false</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>.;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>..\apr\Release;..\apr-util\Release;..\iksemel\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <ModuleDefinitionFile>.\src\dingaling.def</ModuleDefinitionFile> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>.;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level4</WarningLevel> - <DisableSpecificWarnings>4718;4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>.;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <WarningLevel>Level4</WarningLevel> - <DisableSpecificWarnings>4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug DLL|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>.;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <ModuleDefinitionFile>.\src\dingaling.def</ModuleDefinitionFile> - <GenerateDebugInformation>true</GenerateDebugInformation> - <OptimizeReferences>false</OptimizeReferences> - <EnableCOMDATFolding>false</EnableCOMDATFolding> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <TargetMachine>MachineX64</TargetMachine> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release DLL|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>.;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level4</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalDependencies>libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>..\apr\Release;..\apr-util\Release;..\iksemel\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <ModuleDefinitionFile>.\src\dingaling.def</ModuleDefinitionFile> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <TargetMachine>MachineX64</TargetMachine> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\libdingaling.c" /> - <ClCompile Include="src\sha1.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="src\ldl_compat.h" /> - <ClInclude Include="src\libdingaling.h" /> - </ItemGroup> - <ItemGroup> - <None Include="src\dingaling.def" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\win32\apr-util\libaprutil.2017.vcxproj"> - <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\win32\iksemel\iksemel.2017.vcxproj"> - <Project>{e727e8f6-935d-46fe-8b0e-37834748a0e3}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="libdingaling" - ProjectGUID="{1906D736-08BD-4EE1-924F-B536249B9A54}" - RootNamespace="libdingaling" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100;4706" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug DLL|Win32" - OutputDirectory="$(SolutionDir)Debug" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libapr-1.lib libaprutil-1.lib iksemel.lib Ws2_32.lib" - AdditionalLibraryDirectories="..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug" - ModuleDefinitionFile=".\src\dingaling.def" - GenerateDebugInformation="true" - OptimizeReferences="1" - EnableCOMDATFolding="1" - OptimizeForWindows98="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release DLL|Win32" - OutputDirectory="$(SolutionDir)Release" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories=".;.\src;..\iksemel\include;..\include;..\apr\include;&quot;..\iksemel-1.2\include&quot;" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="4" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libapr-1.lib libaprutil-1.lib iksemel.lib Ws2_32.lib" - AdditionalLibraryDirectories="..\apr\Release;..\apr-util\Release;..\iksemel\Release" - ModuleDefinitionFile=".\src\dingaling.def" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\libdingaling.c" - > - </File> - <File - RelativePath=".\src\sha1.c" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\src\ldl_compat.h" - > - </File> - <File - RelativePath=".\src\libdingaling.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - <File - RelativePath=".\src\dingaling.def" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 <gord@gnu.ai.mit.edu>, 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 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 <<EOF -$* -EOF - exit $EXIT_SUCCESS -fi - -default_mode= -help="Try \`$progname --help' for more information." -magic="%%%MAGIC variable%%%" -mkdir="mkdir" -mv="mv -f" -rm="rm -f" - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - SP2NL='tr \040 \012' - NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - SP2NL='tr \100 \n' - NL2SP='tr \r\n \100\100' - ;; -esac - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -# We save the old values to restore during execute mode. -if test "${LC_ALL+set}" = set; then - save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL -fi -if test "${LANG+set}" = set; then - save_LANG="$LANG"; LANG=C; export LANG -fi - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - $echo "$modename: not configured to build any kind of library" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $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 <<EOF -# $libobj - a libtool object file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# Name of the PIC object. -EOF - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - if test ! -d "${xdir}$objdir"; then - $show "$mkdir ${xdir}$objdir" - $run $mkdir ${xdir}$objdir - status=$? - if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then - exit $status - fi - fi - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - command="$command -o $lobj" - fi - - $run $rm "$lobj" "$output_obj" - - $show "$command" - if $run eval "$command"; then : - else - test -n "$output_obj" && $run $rm $removelist - exit $EXIT_FAILURE - fi - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $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 <<EOF -pic_object='$objdir/$objname' - -EOF - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - else - # No PIC object so indicate it doesn't exist in the libtool - # object file. - test -z "$run" && cat >> ${libobj}T <<EOF -pic_object=none - -EOF - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - $run $rm "$obj" "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - $run $rm $removelist - exit $EXIT_FAILURE - fi - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $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 <<EOF -# Name of the non-PIC object. -non_pic_object='$objname' - -EOF - else - # 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 <<EOF -# Name of the non-PIC object. -non_pic_object=none - -EOF - fi - - $run $mv "${libobj}T" "${libobj}" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - $run $rm "$lockfile" - fi - - exit $EXIT_SUCCESS - ;; - - # libtool link mode - link | relink) - modename="$modename: link" - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args="$nonopt" - base_compile="$nonopt $@" - compile_command="$nonopt" - finalize_command="$nonopt" - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - - avoid_version=no - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -all-static | -static) - if test "X$arg" = "X-all-static"; then - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - 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 <<EOF - int main() { return 0; } -EOF - $rm conftest - $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - for i in $deplibs; do - name=`expr $i : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which I believe you do not have" - $echo "*** because a test_compile did reveal that the linker did not use it for" - $echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occurred in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name=`expr $i : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - $rm conftest - $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because a test_compile did reveal that the linker did not use this one" - $echo "*** as a dynamic dependency that programs can get resolved with at runtime." - fi - fi - else - droppeddeps=yes - $echo - $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" - $echo "*** library that it depends on before this library will be fully" - $echo "*** functional. Installing it before continuing would be even better." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - fi - ;; - file_magic*) - set dummy $deplibs_check_method - file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - 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 >/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 <<EOF - -/* $cwrappersource - temporary wrapper executable 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 executable should never be moved out of the build directory. - If it is, it will not operate correctly. - - Currently, it simply execs the wrapper *script* "/bin/sh $output", - but could eventually absorb all of the scripts functionality and - exec $objdir/$outputname directly. -*/ -EOF - cat >> $cwrappersource<<"EOF" -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <malloc.h> -#include <stdarg.h> -#include <assert.h> - -#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 <<EOF - newargz[0] = "$SHELL"; -EOF - - cat >> $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 <<EOF - execv("$SHELL",newargz); -EOF - - cat >> $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 <bug-libtool@gnu.org>." - 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 <pinard@iro.umontreal.ca>, 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 <bug-automake@gnu.org>." - 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 <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to <bug-automake@gnu.org> or send patches to -# <automake-patches@gnu.org>. - -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 <bug-automake@gnu.org>." - -# 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 <anthm@freeswitch.org> - * - * 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 <anthm@freeswitch.org> - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II <anthm@freeswitch.org> - * - * 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 <anthm@freeswitch.org> - * - * 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 <anthm@freeswitch.org> - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II <anthm@freeswitch.org> - * - * libdingaling.c -- Main Library Code - * - * QMOD: XMPP Video Signaling + Presentation (video-v1 & camera-v1) - * - */ - - -#ifndef _MSC_VER -#include <config.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <time.h> -#endif - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> -#include <ctype.h> -#include <fcntl.h> -#include <iksemel.h> -#include <apr.h> -#include <apr_network_io.h> -#include <apr_errno.h> -#include <apr_general.h> -#include <apr_thread_proc.h> -#include <apr_thread_mutex.h> -#include <apr_thread_cond.h> -#include <apr_thread_rwlock.h> -#include <apr_file_io.h> -#include <apr_poll.h> -#include <apr_dso.h> -#include <apr_hash.h> -#include <apr_strings.h> -#include <apr_network_io.h> -#include <apr_poll.h> -#include <apr_queue.h> -#include <apr_uuid.h> -#include <apr_strmatch.h> -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include <apr_want.h> -#include <apr_env.h> - -#include "ldl_compat.h" -#include "libdingaling.h" -#include "sha1.h" - -#ifdef _MSC_VER -#include <io.h> -#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<ilen;x++) { - b = (b<<8) + in[x]; - l += 8; - while (l >= 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), "<handshake>%s</handshake>", 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, - "<vCard xmlns='vcard-temp'><PHOTO><TYPE>image/%s</TYPE><BINVAL>%s</BINVAL></PHOTO></vCard>", - 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 <anthm@freeswitch.org> - * - * 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 <anthm@freeswitch.org> - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II <anthm@freeswitch.org> - * - * 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 <strings.h> -#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 <allan@saddi.com> - * 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 <config.h> -#endif /* HAVE_CONFIG_H */ - -#if HAVE_INTTYPES_H -# include <inttypes.h> -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif -#endif - -#ifdef _MSC_VER -#define inline __inline -#endif - -#include <string.h> - -#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 <stdio.h> -#include <stdlib.h> -#include <string.h> - -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 <allan@saddi.com> - * 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 <inttypes.h> -#else -# if HAVE_STDINT_H -# include <stdint.h> -# 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mod_dingaling</ProjectName> - <ProjectGuid>{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}</ProjectGuid> - <RootNamespace>mod_dingaling</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <Import Project="..\..\..\..\w32\openssl.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\w32\module_release.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\w32\module_debug.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\w32\module_release.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\w32\module_debug.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>%(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PrecompiledHeader> - </PrecompiledHeader> - <DisableSpecificWarnings>4718;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalOptions>/NODEFAULTLIB:LIMBCTD %(AdditionalOptions)</AdditionalOptions> - <AdditionalLibraryDirectories>$(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>%(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PrecompiledHeader> - </PrecompiledHeader> - <DisableSpecificWarnings>4718;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalOptions>/NODEFAULTLIB:LIMBCTD %(AdditionalOptions)</AdditionalOptions> - <AdditionalLibraryDirectories>$(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <TargetMachine>MachineX64</TargetMachine> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>%(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PrecompiledHeader> - </PrecompiledHeader> - <DisableSpecificWarnings>4718;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>%(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PrecompiledHeader> - </PrecompiledHeader> - <DisableSpecificWarnings>4718;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <TargetMachine>MachineX64</TargetMachine> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="mod_dingaling.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\..\libs\libdingaling\libdingaling.2017.vcxproj"> - <Project>{1906d736-08bd-4ee1-924f-b536249b9a54}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\win32\apr-util\libaprutil.2017.vcxproj"> - <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\win32\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\win32\iksemel\iksemel.2017.vcxproj"> - <Project>{e727e8f6-935d-46fe-8b0e-37834748a0e3}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj"> - <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 <anthm@freeswitch.org> - * - * 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 <anthm@freeswitch.org> - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II <anthm@freeswitch.org> - * - * - * mod_dingaling.c -- Jingle Endpoint Module - * - */ -#include <switch.h> -#include <switch_stun.h> -#include <libdingaling.h> - -#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 <profile_name>" -#define LOGOUT_SYNTAX "dl_logout <profile_name>" -#define LOGIN_SYNTAX "Existing Profile:\ndl_login profile=<profile_name>\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(&params, 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 <vcard> 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(&params); - - 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 <chris@signalwire.com> Date: Tue, 16 Aug 2022 18:29:47 -0400 Subject: [PATCH 565/655] [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 @@ </input> ]]> </alias> - <alias name="input_voice_yesno_unimrcp" target="call"> - <![CDATA[ - <input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp"> - <grammar content-type="application/srgs+xml> - <![CDATA[ - <grammar xmlns="http://www.w3.org/2001/06/grammar" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" - xml:lang="en-US" version="1.0"> - <rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar> - ]]]]><![CDATA[> - </grammar> - </input> - ]]> - </alias> - <alias name="input_voice_yesno_unimrcp_timeout" target="call"> - <![CDATA[ - <input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp" max-silence="5000" initial-timeout="5000"> - <grammar content-type="application/srgs+xml> - <![CDATA[ - <grammar xmlns="http://www.w3.org/2001/06/grammar" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" - xml:lang="en-US" version="1.0"> - <rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar> - ]]]]><![CDATA[> - </grammar> - </input> - ]]> - </alias> <alias name="input_voice_yesno_pocketsphinx" target="call"> <![CDATA[ diff --git a/conf/vanilla/autoload_configs/unimrcp.conf.xml b/conf/vanilla/autoload_configs/unimrcp.conf.xml deleted file mode 100644 index 45dda798a1..0000000000 --- a/conf/vanilla/autoload_configs/unimrcp.conf.xml +++ /dev/null @@ -1,23 +0,0 @@ -<configuration name="unimrcp.conf" description="UniMRCP Client"> - <settings> - <!-- UniMRCP profile to use for TTS --> - <param name="default-tts-profile" value="voxeo-prophecy8.0-mrcp1"/> - <!-- UniMRCP profile to use for ASR --> - <param name="default-asr-profile" value="voxeo-prophecy8.0-mrcp1"/> - <!-- UniMRCP logging level to appear in freeswitch.log. Options are: - EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG --> - <param name="log-level" value="DEBUG"/> - <!-- Enable events for profile creation, open, and close --> - <param name="enable-profile-events" value="false"/> - - <param name="max-connection-count" value="100"/> - <param name="offer-new-connection" value="1"/> - <param name="request-timeout" value="3000"/> - </settings> - - <profiles> - <X-PRE-PROCESS cmd="include" data="../mrcp_profiles/*.xml"/> - </profiles> - -</configuration> - 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 @@ -<include> - <!-- Loquendo MRCP Server 7 MRCPv2 --> - <profile name="loquendo7-mrcp2" version="2"> - <!--param name="client-ext-ip" value="auto"--> - <param name="client-ip" value="auto"/> - <param name="client-port" value="5090"/> - <param name="server-ip" value="10.5.5.152"/> - <param name="server-port" value="5060"/> - <!--param name="force-destination" value="1"/--> - <param name="sip-transport" value="udp"/> - <!--param name="ua-name" value="FreeSWITCH"/--> - <!--param name="sdp-origin" value="FreeSWITCH"/--> - <!--param name="rtp-ext-ip" value="auto"/--> - <param name="rtp-ip" value="auto"/> - <param name="rtp-port-min" value="4000"/> - <param name="rtp-port-max" value="5000"/> - <!--param name="playout-delay" value="50"/--> - <!--param name="max-playout-delay" value="200"/--> - <!--param name="ptime" value="20"/--> - <param name="codecs" value="PCMU PCMA L16/96/8000"/> - <param name="jsgf-mime-type" value="application/jsgf"/> - - <!-- Add any default MRCP params for SPEAK requests here --> - <synthparams> - </synthparams> - - <!-- Add any default MRCP params for RECOGNIZE requests here --> - <recogparams> - <!--param name="start-input-timers" value="false"/--> - </recogparams> - </profile> -</include> 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 @@ -<include> - <!-- Nuance MRCP 1.0.0 Server --> - <profile name="nuance-mrcp1" version="1"> - <param name="server-ip" value="10.5.5.152"/> - <param name="server-port" value="554"/> - <param name="resource-location" value=""/> - <param name="speechsynth" value="synthesizer"/> - <param name="speechrecog" value="recognizer"/> - <!--param name="rtp-ext-ip" value="auto"/--> - <param name="rtp-ip" value="auto"/> - <param name="rtp-port-min" value="4000"/> - <param name="rtp-port-max" value="5000"/> - <!-- enable/disable rtcp support --> - <param name="rtcp" value="1"/> - <!-- rtcp bye policies (rtcp must be enabled first) - 0 - disable rtcp bye - 1 - send rtcp bye at the end of session - 2 - send rtcp bye also at the end of each talkspurt (input) - --> - <param name="rtcp-bye" value="2"/> - <!-- rtcp transmission interval in msec (set 0 to disable) --> - <param name="rtcp-tx-interval" value="5000"/> - <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) --> - <param name="rtcp-rx-resolution" value="1000"/> - <!--param name="playout-delay" value="50"/--> - <!--param name="max-playout-delay" value="200"/--> - <!--param name="ptime" value="20"/--> - <param name="codecs" value="PCMU PCMA L16/96/8000"/> - - <!-- Add any default MRCP params for SPEAK requests here --> - <synthparams> - </synthparams> - - <!-- Add any default MRCP params for RECOGNIZE requests here --> - <recogparams> - <!--param name="start-input-timers" value="false"/--> - </recogparams> - </profile> -</include> 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 @@ -<include> - <!-- Nuance Speech Server 5.0 MRCPv1 --> - <profile name="nuance5-mrcp1" version="1"> - <param name="server-ip" value="10.5.5.152"/> - <param name="server-port" value="4900"/> - <param name="resource-location" value="media"/> - <param name="speechsynth" value="speechsynthesizer"/> - <param name="speechrecog" value="speechrecognizer"/> - <!--param name="rtp-ext-ip" value="auto"/--> - <param name="rtp-ip" value="auto"/> - <param name="rtp-port-min" value="4000"/> - <param name="rtp-port-max" value="5000"/> - <!-- enable/disable rtcp support --> - <param name="rtcp" value="1"/> - <!-- rtcp bye policies (rtcp must be enabled first) - 0 - disable rtcp bye - 1 - send rtcp bye at the end of session - 2 - send rtcp bye also at the end of each talkspurt (input) - --> - <param name="rtcp-bye" value="2"/> - <!-- rtcp transmission interval in msec (set 0 to disable) --> - <param name="rtcp-tx-interval" value="5000"/> - <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) --> - <param name="rtcp-rx-resolution" value="1000"/> - <!--param name="playout-delay" value="50"/--> - <!--param name="max-playout-delay" value="200"/--> - <!--param name="ptime" value="20"/--> - <param name="codecs" value="PCMU PCMA L16/96/8000"/> - - <!-- Add any default MRCP params for SPEAK requests here --> - <synthparams> - </synthparams> - - <!-- Add any default MRCP params for RECOGNIZE requests here --> - <recogparams> - <!--param name="start-input-timers" value="false"/--> - </recogparams> - </profile> -</include> 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 @@ -<include> - <!-- Nuance Speech Server 5.0 MRCPv2 --> - <profile name="nuance5-mrcp2" version="2"> - <!--param name="client-ext-ip" value="auto"--> - <param name="client-ip" value="auto"/> - <param name="client-port" value="5090"/> - <param name="server-ip" value="10.5.5.152"/> - <param name="server-port" value="5060"/> - <!--param name="force-destination" value="1"/--> - <param name="sip-transport" value="udp"/> - <!--param name="ua-name" value="FreeSWITCH"/--> - <!--param name="sdp-origin" value="FreeSWITCH"/--> - <!--param name="rtp-ext-ip" value="auto"/--> - <param name="rtp-ip" value="auto"/> - <param name="rtp-port-min" value="4000"/> - <param name="rtp-port-max" value="5000"/> - <!-- enable/disable rtcp support --> - <param name="rtcp" value="1"/> - <!-- rtcp bye policies (rtcp must be enabled first) - 0 - disable rtcp bye - 1 - send rtcp bye at the end of session - 2 - send rtcp bye also at the end of each talkspurt (input) - --> - <param name="rtcp-bye" value="2"/> - <!-- rtcp transmission interval in msec (set 0 to disable) --> - <param name="rtcp-tx-interval" value="5000"/> - <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) --> - <param name="rtcp-rx-resolution" value="1000"/> - <!--param name="playout-delay" value="50"/--> - <!--param name="max-playout-delay" value="200"/--> - <!--param name="ptime" value="20"/--> - <param name="codecs" value="PCMU PCMA L16/96/8000"/> - - <!-- Add any default MRCP params for SPEAK requests here --> - <synthparams> - </synthparams> - - <!-- Add any default MRCP params for RECOGNIZE requests here --> - <recogparams> - <!--param name="start-input-timers" value="false"/--> - </recogparams> - </profile> -</include> 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 @@ -<include> - <!-- UniMRCP Server MRCPv1 --> - <profile name="unimrcpserver-mrcp1" version="1"> - <param name="server-ip" value="10.5.5.152"/> - <param name="server-port" value="1554"/> - <param name="resource-location" value=""/> - <param name="speechsynth" value="speechsynthesizer"/> - <param name="speechrecog" value="speechrecognizer"/> - <!--param name="rtp-ext-ip" value="auto"/--> - <param name="rtp-ip" value="auto"/> - <param name="rtp-port-min" value="4000"/> - <param name="rtp-port-max" value="5000"/> - <!--param name="playout-delay" value="50"/--> - <!--param name="max-playout-delay" value="200"/--> - <!--param name="ptime" value="20"/--> - <param name="codecs" value="PCMU PCMA L16/96/8000"/> - - <!-- Add any default MRCP params for SPEAK requests here --> - <synthparams> - </synthparams> - - <!-- Add any default MRCP params for RECOGNIZE requests here --> - <recogparams> - <!--param name="start-input-timers" value="false"/--> - </recogparams> - </profile> -</include> 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 @@ -<include> - <!-- Vestec VASRE MRCP Server --> - <profile name="vestec-mrcp-v1" version="1"> - <param name="server-ip" value="127.0.0.1"/> - <param name="server-port" value="1554"/> - <param name="resource-location" value=""/> - <param name="speechsynth" value="speechsynthesizer"/> - <param name="speechrecog" value="speechrecognizer"/> - <param name="rtp-ip" value="auto"/> - <param name="rtp-port-min" value="14000"/> - <param name="rtp-port-max" value="15000"/> - <!--param name="playout-delay" value="50"/--> - <!--param name="max-playout-delay" value="200"/--> - <!--param name="ptime" value="20"/--> - <param name="codecs" value="PCMU PCMA L16/96/8000"/> - - <!-- Add any default MRCP params for SPEAK requests here --> - <synthparams> - </synthparams> - - <!-- Add any default MRCP params for RECOGNIZE requests here --> - <recogparams> - <!--param name="start-input-timers" value="false"/--> - </recogparams> - </profile> -</include> 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 @@ -<include> - <!-- Voxeo Prophecy 8.0 MRCPv1 --> - <profile name="voxeo-prophecy8.0-mrcp1" version="1"> - <param name="server-ip" value="99.185.85.31"/> - <param name="server-port" value="554"/> - <param name="resource-location" value=""/> - <param name="speechsynth" value="synthesizer"/> - <param name="speechrecog" value="recognizer"/> - <!--param name="rtp-ext-ip" value="auto"/--> - <param name="rtp-ip" value="auto"/> - <param name="rtp-port-min" value="4000"/> - <param name="rtp-port-max" value="5000"/> - <!--param name="playout-delay" value="50"/--> - <!--param name="max-playout-delay" value="200"/--> - <!--param name="ptime" value="20"/--> - <param name="codecs" value="PCMU PCMA L16/96/8000"/> - - <!-- Add any default MRCP params for SPEAK requests here --> - <synthparams> - </synthparams> - - <!-- Add any default MRCP params for RECOGNIZE requests here --> - <recogparams> - <!--param name="start-input-timers" value="false"/--> - </recogparams> - </profile> -</include> 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 <achaloyan@gmail.com> - - -Contributor(s): - Kamil Shakirov <kamils80@gmail.com> - Anthony Masse <amasse.atwork@gmail.com> - Vlad Socaciu <Curatica@gmail.com> - Garmt <garmt.noname@gmail.com> - Patrick Nunes <pnunes29@gmail.com> - Bayram Boyraz <bayramboyraz@gmail.com> - Mahmoud Hassan <firstmahmoud2002@gmail.com> - Michael Jerris <mike@jerris.com> - Carlos Pina Soares - Chaitanya Chokkareddy <chaitanya.chokkareddy@gmail.com> - Tomas Valenta <tomas.valenta@speechtech.cz> - Danijel Korzinek <danijel.korzinek@gmail.com> 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 <offer-new-connection>. - * 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 <instance> and <input> 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 <speak> 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 - <UserMacro - Name="AprDir" - Value="$(SolutionDir)libs\apr" - /> - <UserMacro - Name="AprUtilDir" - Value="$(SolutionDir)libs\apr-util" - /> - -sofiasip.vsprops - <UserMacro - Name="SofiaDir" - Value="$(SolutionDir)libs\sofia-sip" - /> - -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 <Pekka.Pessi@nokia.com> - -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 <steveu@coppice.org> -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<<EOF -#! /bin/sh -# -# Created by configure - -EOF - if test -n "$CC"; then - echo "CC=\"$CC\"; export CC" >> $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 <apr.h> -#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(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl -dnl The cache variable name. -define(<<AC_CV_NAME>>, 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 <stdio.h> -$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 <errno.h> -#include <string.h> -#include <stdio.h> -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 <sys/types.h> -#include <dirent.h> -],[ -#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 <sys/types.h> -#include <dirent.h> -],[ -#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 <sys/types.h> -#include <dirent.h> -],[ -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 <sys/types.h> should be available everywhere! - cat > conftest.c <<EOF -#include <sys/types.h> - 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="$(ProjectDir)..\..\build\props\unibase.props" Condition=" '$(UniBaseImported)' == '' "/> - </ImportGroup> - <PropertyGroup Label="UserMacros"> - <AprDir>$(LibRootDir)libs\apr</AprDir> - <AprUtilDir>$(LibRootDir)libs\apr-util</AprUtilDir> - <AprIconvDir>$(LibRootDir)libs\apr-iconv</AprIconvDir> - </PropertyGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup> - <AprImported>true</AprImported> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(AprDir)\include;$(AprUtilDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <BuildMacro Include="AprDir"> - <Value>$(AprDir)</Value> - </BuildMacro> - <BuildMacro Include="AprUtilDir"> - <Value>$(AprUtilDir)</Value> - </BuildMacro> - <BuildMacro Include="AprIconvDir"> - <Value>$(AprIconvDir)</Value> - </BuildMacro> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup> - <AptImported>true</AptImported> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\apr-toolkit\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="apt.props" Condition=" '$(AptImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup> - <MpfImported>true</MpfImported> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mpf\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="apt.props" Condition=" '$(AptImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup> - <MrcpImported>true</MrcpImported> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp\include;$(ProjectRootDir)libs\mrcp\message\include;$(ProjectRootDir)libs\mrcp\control\include;$(ProjectRootDir)libs\mrcp\resources\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="mrcpsignaling.props" /> - <Import Project="mrcpv2transport.props" /> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="mpf.props" Condition=" '$(MpfImported)' == '' " /> - <Import Project="mrcp.props" Condition=" '$(MrcpImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp-engine\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="mrcpengine.props" /> - <Import Project="mrcpsignaling.props" /> - <Import Project="mrcpv2transport.props" /> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp-server\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="mpf.props" Condition=" '$(MpfImported)' == '' " /> - <Import Project="mrcp.props" Condition=" '$(MrcpImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp-signaling\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="mrcp.props" Condition=" '$(MrcpImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcpv2-transport\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="unimrcpsdk.props"/> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup /> - <ItemDefinitionGroup> - <Link> - <AdditionalDependencies>libunimrcpclient.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpclient.lib mrcpv2transport.lib mrcpsignaling.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemGroup /> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="unimrcpsdk.props"/> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup /> - <ItemDefinitionGroup> - <Link> - <AdditionalDependencies>mrcpengine.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemGroup /> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets" /> - <PropertyGroup Label="UserMacros"> - <ProjectRootDir>C:\Program Files\UniMRCP</ProjectRootDir> - </PropertyGroup> - <PropertyGroup /> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(ProjectRootDir)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <BuildMacro Include="ProjectRootDir"> - <Value>$(ProjectRootDir)</Value> - </BuildMacro> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="unimrcpsdk.props"/> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup /> - <ItemDefinitionGroup> - <Link> - <AdditionalDependencies>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)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemGroup /> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="$(ProjectDir)..\..\build\props\unibase.props" Condition=" '$(UniBaseImported)' == '' "/> - </ImportGroup> - <PropertyGroup Label="UserMacros"> - <SofiaDir>$(LibRootDir)libs\sofia-sip</SofiaDir> - </PropertyGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup> - <SofiaSipImported>true</SofiaSipImported> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(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)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <BuildMacro Include="SofiaDir"> - <Value>$(SofiaDir)</Value> - </BuildMacro> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup Label="UserMacros"> - <ProjectRootDir>$(ProjectDir)..\..\</ProjectRootDir> - <LibRootDir>$(SolutionDir)</LibRootDir> - </PropertyGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <PropertyGroup> - <UniBaseImported>true</UniBaseImported> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> - <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <BuildMacro Include="ProjectRootDir"> - <Value>$(ProjectRootDir)</Value> - </BuildMacro> - <BuildMacro Include="LibRootDir"> - <Value>$(LibRootDir)</Value> - </BuildMacro> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/> - <Import Project="sofiasip.props" Condition=" '$(SofiaSipImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir>$(SolutionDir)$(PlatformName)\$(Configuration)\bin\</OutDir> - <IntDir>$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <PreprocessorDefinitions>_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;$(SolutionDir)$(Platform)\$(Configuration)\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <TargetMachine>MachineX64</TargetMachine> - </Link> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/> - <Import Project="sofiasip.props" Condition=" '$(SofiaSipImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir>$(SolutionDir)$(Configuration)\bin\</OutDir> - <IntDir>$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup> - <Link> - <AdditionalLibraryDirectories>$(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration);$(SolutionDir)$(Configuration)\lib;$(SolutionDir)$(Configuration)\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <TargetMachine>MachineX86</TargetMachine> - </Link> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="$(ProjectDir)..\..\build\props\unibase.props" Condition=" '$(UniBaseImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <LinkIncremental>true</LinkIncremental> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - </Link> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir>$(SolutionDir)$(PlatformName)\$(Configuration)\lib\</OutDir> - <IntDir>$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <PreprocessorDefinitions>_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir>$(SolutionDir)$(Configuration)\lib\</OutDir> - <IntDir>$(Configuration)\</IntDir> - </PropertyGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="mrcpclient.props" /> - <Import Project="sofiasip.props" Condition=" '$(SofiaSipImported)' == '' "/> - </ImportGroup> - <PropertyGroup Label="UserMacros"> - <UniMRCPClientLibs>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</UniMRCPClientLibs> - </PropertyGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)platforms\libunimrcp-client\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <BuildMacro Include="UniMRCPClientLibs"> - <Value>$(UniMRCPClientLibs)</Value> - </BuildMacro> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="mrcpserver.props" /> - <Import Project="sofiasip.props" Condition=" '$(SofiaSipImported)' == '' "/> - </ImportGroup> - <PropertyGroup Label="UserMacros"> - <UniMRCPServerLibs>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</UniMRCPServerLibs> - </PropertyGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)platforms\libunimrcp-server\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <BuildMacro Include="UniMRCPServerLibs"> - <Value>$(UniMRCPServerLibs)</Value> - </BuildMacro> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/> - <Import Project="mrcpengine.props" /> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir>$(SolutionDir)$(PlatformName)\$(Configuration)\plugin\</OutDir> - <IntDir>$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <PreprocessorDefinitions>_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <TargetMachine>MachineX64</TargetMachine> - </Link> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/> - <Import Project="mrcpengine.props" /> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir>$(SolutionDir)$(Configuration)\plugin\</OutDir> - <IntDir>$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup> - <Link> - <AdditionalLibraryDirectories>$(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SolutionDir)$(Configuration)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <AdditionalDependencies>mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <TargetMachine>MachineX86</TargetMachine> - </Link> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="$(ProjectDir)..\..\build\props\unibase.props" Condition=" '$(UniBaseImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="apt.props" Condition=" '$(AptImported)' == '' "/> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)libs\uni-rtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>RTSP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="prepare" - ProjectGUID="{01D63BF5-7798-4746-852A-4B45229BB735}" - RootNamespace="prepare" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="10" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - CommandLine="xcopy &quot;$(AprDir)\$(ConfigurationName)\libapr-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprUtilDir)\$(ConfigurationName)\libaprutil-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll&quot; (&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;if exist &quot;$(AprIconvDir)\$(ConfigurationName)\iconv&quot; (&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\bin\iconv&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\bin\iconv&quot;&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(ConfigurationName)\iconv\*.so&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\iconv\&quot; /Y&#x0D;&#x0A;)&#x0D;&#x0A;)&#x0D;&#x0A;&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)\libsofia_sip_ua.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\pthread\$(ConfigurationName)\pthreadVC2.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\conf&quot; (&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\*.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\*.xsd&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\client-profiles\*.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\client-profiles\&quot; /Y&#x0D;&#x0A;)&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\data&quot; xcopy &quot;$(SolutionDir)data\*&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\log&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\log\&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\var&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\var\&quot;&#x0D;&#x0A;" - ExcludedFromBuild="false" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="10" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - CommandLine="xcopy &quot;$(AprDir)\$(PlatformName)\$(ConfigurationName)\libapr-1.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprUtilDir)\$(PlatformName)\$(ConfigurationName)\libaprutil-1.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\libapriconv-1.dll&quot; (&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\libapriconv-1.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;if exist &quot;$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\iconv&quot; (&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv&quot; mkdir &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv&quot;&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\iconv\*.so&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv\&quot; /Y&#x0D;&#x0A;)&#x0D;&#x0A;)&#x0D;&#x0A;&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\libsofia-sip-ua\$(PlatformName)\$(ConfigurationName)\libsofia_sip_ua.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\pthread\$(PlatformName)\$(ConfigurationName)\pthreadVC2.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf&quot; (&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\*.xml&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\*.xsd&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\client-profiles\*.xml&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\client-profiles\&quot; /Y&#x0D;&#x0A;)&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\data&quot; xcopy &quot;$(SolutionDir)data\*&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\data\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\log&quot; mkdir &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\log\&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\var&quot; mkdir &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\var\&quot;&#x0D;&#x0A;" - ExcludedFromBuild="false" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="10" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - CommandLine="xcopy &quot;$(AprDir)\$(ConfigurationName)\libapr-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprUtilDir)\$(ConfigurationName)\libaprutil-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll&quot; (&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;if exist &quot;$(AprIconvDir)\$(ConfigurationName)\iconv&quot; (&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\bin\iconv&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\bin\iconv&quot;&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(ConfigurationName)\iconv\*.so&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\iconv\&quot; /Y&#x0D;&#x0A;)&#x0D;&#x0A;)&#x0D;&#x0A;&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)\libsofia_sip_ua.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\pthread\$(ConfigurationName)\pthreadVC2.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\conf&quot; (&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\*.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\*.xsd&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\client-profiles\*.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\client-profiles\&quot; /Y&#x0D;&#x0A;)&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\data&quot; xcopy &quot;$(SolutionDir)data\*&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\log&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\log\&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\var&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\var\&quot;&#x0D;&#x0A;" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="10" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - CommandLine="xcopy &quot;$(AprDir)\$(PlatformName)\$(ConfigurationName)\libapr-1.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprUtilDir)\$(PlatformName)\$(ConfigurationName)\libaprutil-1.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\libapriconv-1.dll&quot; (&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\libapriconv-1.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;if exist &quot;$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\iconv&quot; (&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv&quot; mkdir &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv&quot;&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\iconv\*.so&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv\&quot; /Y&#x0D;&#x0A;)&#x0D;&#x0A;)&#x0D;&#x0A;&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\libsofia-sip-ua\$(PlatformName)\$(ConfigurationName)\libsofia_sip_ua.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\pthread\$(PlatformName)\$(ConfigurationName)\pthreadVC2.dll&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf&quot; (&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\*.xml&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\*.xsd&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SolutionDir)conf\client-profiles\*.xml&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\client-profiles\&quot; /Y&#x0D;&#x0A;)&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\data&quot; xcopy &quot;$(SolutionDir)data\*&quot; &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\data\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\log&quot; mkdir &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\log\&quot;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\var&quot; mkdir &quot;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\var\&quot;&#x0D;&#x0A;" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{01D63BF5-7798-4746-852A-4B45229BB735}</ProjectGuid> - <RootNamespace>prepare</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Utility</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Utility</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Utility</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Utility</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\apr.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\apr.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\apr.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\apr.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> - <PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreBuildEventUseInBuild> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> - <PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PreBuildEventUseInBuild> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <PreBuildEvent> - <Command>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\" -</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <PreBuildEvent> - <Command>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\" -</Command> - </PreBuildEvent> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <PreBuildEvent> - <Command>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\" -</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <PreBuildEvent> - <Command>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\" -</Command> - </PreBuildEvent> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - </ItemDefinitionGroup> - <ItemGroup> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 <windows.h> -#include <apr_getopt.h> -#include <apr_file_info.h> -#include <apr_strings.h> -#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 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> - <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="<AppName>" type="win32"/> - <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> - <security> - <requestedPrivileges> - <requestedExecutionLevel level="requireAdministrator"/> - </requestedPrivileges> - </security> - </trustInfo> -</assembly> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpservice" - ProjectGUID="{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}" - RootNamespace="unimrcpservice" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - AdditionalManifestFiles="unimrcpservice.exe.manifest" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - AdditionalManifestFiles="unimrcpservice.exe.manifest" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - AdditionalManifestFiles="unimrcpservice.exe.manifest" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - AdditionalManifestFiles="unimrcpservice.exe.manifest" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\unimrcp_service.c" - > - </File> - </Filter> - <File - RelativePath=".\unimrcpservice.rc" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}</ProjectGuid> - <RootNamespace>unimrcpservice</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <UACExecutionLevel>RequireAdministrator</UACExecutionLevel> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - <UACExecutionLevel>RequireAdministrator</UACExecutionLevel> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <UACExecutionLevel>RequireAdministrator</UACExecutionLevel> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - <UACExecutionLevel>RequireAdministrator</UACExecutionLevel> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="unimrcp_service.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\apr-toolkit\aprtoolkit.vcxproj"> - <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="unimrcpservice.rc"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="unimrcp_service.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="unimrcpservice.rc" /> - </ItemGroup> -</Project> \ 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. - * - * <a href="http://apr.apache.org/versioning.html"> APR's Version Numbering </a> - */ - -/** 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="apr" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(AprDir)\include&quot;;&quot;$(AprUtilDir)\include&quot;" - /> - <UserMacro - Name="AprDir" - Value="$(LibRootDir)libs\apr" - /> - <UserMacro - Name="AprUtilDir" - Value="$(LibRootDir)libs\apr-util" - /> - <UserMacro - Name="AprIconvDir" - Value="$(LibRootDir)libs\apr-iconv" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="apt" - InheritedPropertySheets="apr.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\apr-toolkit\include&quot;" - PreprocessorDefinitions="APT_STATIC_LIB" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="mpf" - InheritedPropertySheets="apt.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mpf\include&quot;" - PreprocessorDefinitions="MPF_STATIC_LIB" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="mrcp" - InheritedPropertySheets=".\apt.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp\include&quot;;&quot;$(ProjectRootDir)libs\mrcp\message\include&quot;;&quot;$(ProjectRootDir)libs\mrcp\control\include&quot;;&quot;$(ProjectRootDir)libs\mrcp\resources\include&quot;" - PreprocessorDefinitions="MRCP_STATIC_LIB" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="mrcpclient" - InheritedPropertySheets=".\mrcpsignaling.vsprops;.\mrcpv2transport.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp-client\include&quot;" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="mrcpengine" - InheritedPropertySheets=".\mpf.vsprops;.\mrcp.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp-engine\include&quot;" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="mrcpserver" - InheritedPropertySheets=".\mrcpengine.vsprops;.\mrcpsignaling.vsprops;.\mrcpv2transport.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp-server\include&quot;" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="mrcpsignaling" - InheritedPropertySheets=".\mpf.vsprops;.\mrcp.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcp-signaling\include&quot;" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="mrcpv2transport" - InheritedPropertySheets=".\mrcp.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\mrcpv2-transport\include&quot;" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpclient" - InheritedPropertySheets="unimrcpsdk.vsprops" - > - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libunimrcpclient.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpclient.lib mrcpv2transport.lib mrcpsignaling.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpplugin" - InheritedPropertySheets="unimrcpsdk.vsprops" - > - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mrcpengine.lib" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpsdk" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)\include&quot;" - PreprocessorDefinitions="APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB" - /> - <Tool - Name="VCLinkerTool" - AdditionalLibraryDirectories="&quot;$(ProjectRootDir)\lib&quot;" - AdditionalDependencies="mrcp.lib mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <UserMacro - Name="ProjectRootDir" - Value="C:\Program Files\UniMRCP" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpserver" - InheritedPropertySheets="unimrcpsdk.vsprops" - > - <Tool - Name="VCLinkerTool" - AdditionalDependencies="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" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="sofiasip" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(SofiaDir)\win32&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\su&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\nua&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\url&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\sip&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\msg&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\sdp&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\nta&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\nea&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\soa&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\iptsec&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\bnf&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\features&quot;;&quot;$(SofiaDir)\libsofia-sip-ua\tport&quot;" - /> - <UserMacro - Name="SofiaDir" - Value="$(LibRootDir)libs\sofia-sip" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unibase" - > - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="WIN32" - WarningLevel="4" - WarnAsError="true" - DisableSpecificWarnings="4100" - /> - <UserMacro - Name="ProjectRootDir" - Value="$(ProjectDir)..\..\" - /> - <UserMacro - Name="LibRootDir" - Value="$(SolutionDir)" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unibin-x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - InheritedPropertySheets="apr.vsprops;sofiasip.vsprops" - > - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="_WIN64" - /> - <Tool - Name="VCLinkerTool" - AdditionalLibraryDirectories="$(AprDir)\$(PlatformName)\$(ConfigurationName);$(AprUtilDir)\$(PlatformName)\$(ConfigurationName);$(SofiaDir)\win32\libsofia-sip-ua\$(PlatformName)\$(ConfigurationName);$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin" - TargetMachine="17" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unibin" - OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin" - IntermediateDirectory="$(ConfigurationName)" - InheritedPropertySheets="apr.vsprops;sofiasip.vsprops" - > - <Tool - Name="VCLinkerTool" - AdditionalLibraryDirectories="$(AprDir)\$(ConfigurationName);$(AprUtilDir)\$(ConfigurationName);$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName);$(SolutionDir)$(ConfigurationName)\lib;$(SolutionDir)$(ConfigurationName)\bin" - TargetMachine="1" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unidebug" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops" - > - <Tool - Name="VCCLCompilerTool" - Optimization="0" - PreprocessorDefinitions="_DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - DebugInformationFormat="3" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unilib-x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - > - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="_WIN64" - /> - <Tool - Name="VCLinkerTool" - TargetMachine="17" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unilib" - OutputDirectory="$(SolutionDir)$(ConfigurationName)\lib" - IntermediateDirectory="$(ConfigurationName)" - > - <Tool - Name="VCLinkerTool" - TargetMachine="1" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpclient" - InheritedPropertySheets=".\mrcpclient.vsprops;.\sofiasip.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)platforms\libunimrcp-client\include&quot;;&quot;$(ProjectRootDir)build&quot;" - /> - <UserMacro - Name="UniMRCPClientLibs" - Value="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" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpserver" - InheritedPropertySheets=".\mrcpserver.vsprops;.\sofiasip.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)platforms\libunimrcp-server\include&quot;;&quot;$(ProjectRootDir)build&quot;" - /> - <UserMacro - Name="UniMRCPServerLibs" - Value="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" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="uniplugin-x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\plugin" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - InheritedPropertySheets="apr.vsprops;mrcpengine.vsprops" - > - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="_WIN64" - /> - <Tool - Name="VCLinkerTool" - AdditionalLibraryDirectories="$(AprDir)\$(PlatformName)\$(ConfigurationName);$(AprUtilDir)\$(PlatformName)\$(ConfigurationName);$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib" - AdditionalDependencies="mrcpengine.lib mrcp.lib mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib" - TargetMachine="17" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="uniplugin" - OutputDirectory="$(SolutionDir)$(ConfigurationName)\plugin" - IntermediateDirectory="$(ConfigurationName)" - InheritedPropertySheets="apr.vsprops;mrcpengine.vsprops" - > - <Tool - Name="VCLinkerTool" - AdditionalLibraryDirectories="$(AprDir)\$(ConfigurationName);$(AprUtilDir)\$(ConfigurationName);$(SolutionDir)$(ConfigurationName)\lib" - AdditionalDependencies="mrcpengine.lib mrcp.lib mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib" - TargetMachine="1" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unirelease" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops" - > - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="NDEBUG;" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - DebugInformationFormat="3" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="unirtsp" - InheritedPropertySheets="apt.vsprops" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)libs\uni-rtsp\include&quot;" - PreprocessorDefinitions="RTSP_STATIC_LIB" - /> -</VisualStudioPropertySheet> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- UniMRCP client document --> -<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../unimrcpclient.xsd" - version="1.0"> - <settings> - <!-- SIP MRCPv2 settings --> - <sip-settings id="LumenVox-SIP-Settings"> - <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. --> - <!-- <server-ip>10.10.0.1</server-ip> --> - <server-port>5060</server-port> - <!-- <force-destination>true</force-destination> --> - </sip-settings> - - <!-- RTSP MRCPv1 settings --> - <rtsp-settings id="LumenVox-RTSP-Settings"> - <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. --> - <!-- <server-ip>10.10.0.1</server-ip> --> - <server-port>554</server-port> - <!-- <force-destination>true</force-destination> --> - <resource-location></resource-location> - <resource-map> - <param name="speechrecog" value="recognizer"/> - </resource-map> - </rtsp-settings> - </settings> - - <profiles> - <!-- LumenVox MRCPv2 profile --> - <mrcpv2-profile id="lv2"> - <sip-uac>SIP-Agent-1</sip-uac> - <mrcpv2-uac>MRCPv2-Agent-1</mrcpv2-uac> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <sip-settings>LumenVox-SIP-Settings</sip-settings> - <rtp-settings>RTP-Settings-1</rtp-settings> - </mrcpv2-profile> - - <!-- LumenVox MRCPv1 profile --> - <mrcpv1-profile id="lv1"> - <rtsp-uac>RTSP-Agent-1</rtsp-uac> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <rtsp-settings>LumenVox-RTSP-Settings</rtsp-settings> - <rtp-settings>RTP-Settings-1</rtp-settings> - </mrcpv1-profile> - - <!-- more profiles might be added here --> - </profiles> -</unimrcpclient> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- UniMRCP client document --> -<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../unimrcpclient.xsd" - version="1.0"> - <settings> - <!-- SIP MRCPv2 settings --> - <sip-settings id="Nuance-SIP-Settings"> - <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. --> - <!-- <server-ip>10.10.0.1</server-ip> --> - <server-port>5060</server-port> - <!-- <force-destination>true</force-destination> --> - <!-- <feature-tags>*;+mrcpv2.speechrecog;+mrcpv2.speechrecog.grammars="http://grammars.example.com/biggrammar.gram"</feature-tags> --> - </sip-settings> - - <!-- RTSP MRCPv1 settings --> - <rtsp-settings id="Nuance-RTSP-Settings"> - <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. --> - <!-- <server-ip>10.10.0.1</server-ip> --> - <server-port>4900</server-port> - <!-- <force-destination>true</force-destination> --> - <resource-location>media</resource-location> - <resource-map> - <param name="speechsynth" value="speechsynthesizer"/> - <param name="speechrecog" value="speechrecognizer"/> - </resource-map> - </rtsp-settings> - - <!-- RTP/RTCP settings --> - <rtp-settings id="Nuance-RTP-Settings"> - <jitter-buffer> - <adaptive>1</adaptive> - <playout-delay>50</playout-delay> - <max-playout-delay>600</max-playout-delay> - <time-skew-detection>1</time-skew-detection> - </jitter-buffer> - <ptime>20</ptime> - <codecs>PCMU PCMA L16/96/8000 telephone-event/101/8000</codecs> - <!-- enable/disable RTCP support --> - <rtcp enable="true"> - <!-- RTCP BYE policies (RTCP must be enabled first) - 0 - disable RTCP BYE - 1 - send RTCP BYE at the end of session - 2 - send RTCP BYE also at the end of each talkspurt (input) - --> - <rtcp-bye>2</rtcp-bye> - <!-- rtcp transmission interval in msec (set 0 to disable) --> - <tx-interval>5000</tx-interval> - <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) --> - <rx-resolution>1000</rx-resolution> - </rtcp> - </rtp-settings> - - </settings> - - <profiles> - <!-- Nuance MRCPv2 profile --> - <mrcpv2-profile id="nss2"> - <sip-uac>SIP-Agent-1</sip-uac> - <mrcpv2-uac>MRCPv2-Agent-1</mrcpv2-uac> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <sip-settings>Nuance-SIP-Settings</sip-settings> - <rtp-settings>Nuance-RTP-Settings</rtp-settings> - </mrcpv2-profile> - - <!-- Nuance MRCPv1 profile --> - <mrcpv1-profile id="nss1"> - <rtsp-uac>RTSP-Agent-1</rtsp-uac> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <rtsp-settings>Nuance-RTSP-Settings</rtsp-settings> - <rtp-settings>Nuance-RTP-Settings</rtp-settings> - </mrcpv1-profile> - - <!-- more profiles might be added here --> - </profiles> -</unimrcpclient> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- UniMRCP client document --> -<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../unimrcpclient.xsd" - version="1.0"> - <settings> - <!-- RTSP MRCPv1 settings --> - <rtsp-settings id="SpeechPro-RTSP-Settings"> - <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. --> - <!-- <server-ip>10.10.0.1</server-ip> --> - <server-port>8000</server-port> - <!-- <force-destination>true</force-destination> --> - <resource-location></resource-location> - <resource-map> - <param name="speechsynth" value="tts"/> - <param name="speechrecog" value="asr"/> - </resource-map> - </rtsp-settings> - </settings> - - <profiles> - <!-- SpeechPro MRCPv1 profile --> - <mrcpv1-profile id="sp1"> - <rtsp-uac>RTSP-Agent-1</rtsp-uac> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <rtsp-settings>SpeechPro-RTSP-Settings</rtsp-settings> - <rtp-settings>RTP-Settings-1</rtp-settings> - </mrcpv1-profile> - - <!-- more profiles might be added here --> - </profiles> -</unimrcpclient> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- UniMRCP client document --> -<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../unimrcpclient.xsd" - version="1.0"> - <settings> - <!-- SIP MRCPv2 settings --> - <sip-settings id="UniMRCP-SIP-Settings"> - <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. --> - <!-- <server-ip>10.10.0.1</server-ip> --> - <server-port>8060</server-port> - <!-- <force-destination>true</force-destination> --> - </sip-settings> - - <!-- RTSP MRCPv1 settings --> - <rtsp-settings id="UniMRCP-RTSP-Settings"> - <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. --> - <!-- <server-ip>10.10.0.1</server-ip> --> - <server-port>1554</server-port> - <!-- <force-destination>true</force-destination> --> - <resource-location>media</resource-location> - <resource-map> - <param name="speechsynth" value="speechsynthesizer"/> - <param name="speechrecog" value="speechrecognizer"/> - </resource-map> - </rtsp-settings> - </settings> - - <profiles> - <!-- UniMRCP MRCPv2 profile --> - <mrcpv2-profile id="uni2"> - <sip-uac>SIP-Agent-1</sip-uac> - <mrcpv2-uac>MRCPv2-Agent-1</mrcpv2-uac> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <sip-settings>UniMRCP-SIP-Settings</sip-settings> - <rtp-settings>RTP-Settings-1</rtp-settings> - </mrcpv2-profile> - - <!-- UniMRCP MRCPv1 profile --> - <mrcpv1-profile id="uni1"> - <rtsp-uac>RTSP-Agent-1</rtsp-uac> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <rtsp-settings>UniMRCP-RTSP-Settings</rtsp-settings> - <rtp-settings>RTP-Settings-1</rtp-settings> - </mrcpv1-profile> - - <!-- more profiles might be added here --> - </profiles> -</unimrcpclient> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Directories Layout - -The root element of the document is <dirlayout>, which accepts an optional -attribute rootdir. The rootdir attribute defaults to "../" and can be specified -as an absolute or relative path. For instance, - - <dirlayout rootdir="../"> - <dirlayout rootdir="C:\unimrcp"> - <dirlayout rootdir="/usr/local/unimrcp"> - -Each subdirectory can be specified as an absolute path or a name relative to -the rootdir path. For instance, - - <confdir>conf</confdir> - <confdir>C:\unimrcp\conf</confdir> - <confdir>/etc/conf</confdir> ---> - -<dirlayout> - <confdir>conf</confdir> - <plugindir>plugin</plugindir> - <logdir>log</logdir> - <datadir>data</datadir> - <vardir>var</vardir> -</dirlayout> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Logger Document --> -<aptlogger> - <!-- Set the log priority to one of - EMERGENCY system is unusable - ALERT action must be taken immediately - CRITICAL critical condition - ERROR error condition - WARNING warning condition - NOTICE normal, but significant condition - INFO informational message - DEBUG debug-level message - --> - <priority>INFO</priority> - - <!-- Set the log output mode - CONSOLE console output - FILE log file output - CONSOLE,FILE both console and the log file output - --> - <output>CONSOLE</output> - - <!-- Set the format of the log messages - DATE date output - TIME time output - PRIORITY priority output - MARK file:line marker output - THREAD calling thread identifier output - --> - <headers>DATE,TIME,PRIORITY</headers> - - <!-- Set the log masking mode - NONE log everything as is - COMPLETE mask private data completely - ENCRYPTED enrcypt private data - --> - <masking>NONE</masking> -</aptlogger> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -UniMRCP Client Scenarios. -There are predefined, named scenarios, which you can customize and use. -Currently available scenarios are -1. class="Synthesizer" -2. class="Recognizer" -3. class="Recorder" -4. class="DtmfRecognizer" -5. class="Params" -6. class="Verifier" - -More than one scenario of the same type (class) can be defined. -The name (not class) of the scenario is used to run it from console. -For instance, -> run synth ---> - -<umcscenarios> - <scenario name="synth" class="Synthesizer" profile="uni2"> - <resource-discovery enable="0"/> - <speak enable="1" content-type="application/synthesis+ssml" content-location="speak.xml"/> - <!-- <speak enable="1" content-type="text/plain" content-location="speak.txt"/> --> - - <termination enable="1"> - <capabilities> - <codec name="LPCM" rates="8000 16000"/> - <!-- <codec name="PCMU" rates="8000 16000"/> --> - </capabilities> - </termination> - <!-- - <rtp-termination enable="1" ip="127.0.0.1" port="5678"> - <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/> - </rtp-termination> - --> - </scenario> - - <scenario name="recog" class="Recognizer" profile="uni2"> - <resource-discovery enable="0"/> - <define-grammar enable="1" content-type="application/srgs+xml" content-location="grammar.xml"/> - <!-- <define-grammar enable="1" content-type="application/grammar+xml" content-location="grammar.xml"/> --> - <!-- <define-grammar enable="1" content-type="application/x-jsgf" content-location="grammar.jsgf"/> --> - <recognize enable="1"/> - <!-- <recognize enable="1" audio-source="one-8kHz.pcm"/> --> - <!-- <recognize enable="1" content-type="application/srgs+xml" content-location="grammar.xml"/> --> - - <termination enable="1"> - <capabilities> - <codec name="LPCM" rates="8000 16000"/> - <!-- <codec name="PCMU" rates="8000 16000"/> --> - </capabilities> - </termination> - <!-- - <rtp-termination enable="1" ip="127.0.0.1" port="5678"> - <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/> - </rtp-termination> - --> - </scenario> - - <scenario name="rec" class="Recorder" profile="uni2"> - <resource-discovery enable="0"/> - <record enable="1"/> - - <termination enable="1"> - <capabilities> - <codec name="LPCM" rates="8000 16000"/> - <!-- <codec name="PCMU" rates="8000 16000"/> --> - </capabilities> - </termination> - <!-- - <rtp-termination enable="1" ip="127.0.0.1" port="5678"> - <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/> - </rtp-termination> - --> - </scenario> - - <scenario name="dtmf" class="DtmfRecognizer" profile="uni2"> - <resource-discovery enable="0"/> - <recognize enable="1" content-type="text/uri-list" grammar="builtin:dtmf/digits" digits="1234"/> --> - - <termination enable="1"> - <capabilities> - <codec name="LPCM" rates="8000 16000"/> - <!-- <codec name="PCMU" rates="8000 16000"/> --> - </capabilities> - </termination> - <!-- - <rtp-termination enable="1" ip="127.0.0.1" port="5678"> - <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/> - </rtp-termination> - --> - </scenario> - - <scenario name="params" class="Params" profile="uni2"/> - - <scenario name="verify" class="Verifier" profile="uni2"> - <resource-discovery enable="0"/> - <verify repository-uri="http://www.example.com/voiceprintdbase/" verification-mode="verify" voiceprint-identifier="johnsmith"/> - - <termination enable="1"> - <capabilities> - <codec name="LPCM" rates="8000 16000"/> - <!-- <codec name="PCMU" rates="8000 16000"/> --> - </capabilities> - </termination> - <!-- - <rtp-termination enable="1" ip="127.0.0.1" port="5678"> - <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/> - </rtp-termination> - --> - </scenario> - <!-- It'd be great to have scriptable custom scenarios as well. - <scenario name="custom" class="UmcXml"> - </scenario> - --> - -</umcscenarios> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- UniMRCP client document --> -<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="unimrcpclient.xsd" - version="1.0" - subfolder="client-profiles"> - <properties> - <!-- If the attribute "type" is set to "auto", IP address is - determined implicitly by the hostname. This is the default setting. --> - <ip type="auto"/> - - <!-- If the attribute "type" is set to "iface", IP address is - determined by the specified name of network interface/adapter. --> - <!-- <ip type="iface">eth0</ip>--> - - <!-- IP address can also be specified explicitly. --> - <!-- <ip>10.10.0.1</ip> --> - - <!-- <ext-ip>a.b.c.d</ext-ip> --> - <!-- <server-ip>a.b.c.d</server-ip> --> - </properties> - - <components> - <!-- Factory of MRCP resources --> - <resource-factory> - <resource id="speechsynth" enable="true"/> - <resource id="speechrecog" enable="true"/> - <resource id="recorder" enable="true"/> - <resource id="speakverify" enable="true"/> - </resource-factory> - - <!-- SofiaSIP MRCPv2 signaling agent --> - <sip-uac id="SIP-Agent-1" type="SofiaSIP"> - <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used. - They still can be explicitly specified (overriden) here. - --> - <!-- <sip-ip>10.10.0.1</sip-ip> --> - <!-- <sip-ext-ip>a.b.c.d</sip-ext-ip> --> - <sip-port>8062</sip-port> - <sip-transport>udp</sip-transport> - <ua-name>UniMRCP SofiaSIP</ua-name> - <sdp-origin>UniMRCPClient</sdp-origin> - <!-- <sip-t1>500</sip-t1> --> - <!-- <sip-t2>4000</sip-t2> --> - <!-- <sip-t4>4000</sip-t4> --> - <!-- <sip-t1x64>32000</sip-t1x64> --> - <!-- <sip-message-output>true</sip-message-output> --> - <!-- <sip-message-dump>sofia-sip-uac.log</sip-message-dump> --> - </sip-uac> - - <!-- UniRTSP MRCPv1 signaling agent --> - <rtsp-uac id="RTSP-Agent-1" type="UniRTSP"> - <max-connection-count>100</max-connection-count> - <!-- <request-timeout>5000</request-timeout> --> - <sdp-origin>UniMRCPClient</sdp-origin> - </rtsp-uac> - - <!-- MRCPv2 connection agent --> - <mrcpv2-uac id="MRCPv2-Agent-1"> - <max-connection-count>100</max-connection-count> - <offer-new-connection>false</offer-new-connection> - <rx-buffer-size>1024</rx-buffer-size> - <tx-buffer-size>1024</tx-buffer-size> - <!-- <request-timeout>5000</request-timeout> --> - </mrcpv2-uac> - - <!-- Media processing engine --> - <media-engine id="Media-Engine-1"> - <realtime-rate>1</realtime-rate> - </media-engine> - - <!-- Factory of RTP terminations --> - <rtp-factory id="RTP-Factory-1"> - <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used. - They still can be explicitly specified (overriden) here. - --> - <!-- <rtp-ip>10.10.0.1</rtp-ip> --> - <!-- <rtp-ext-ip>a.b.c.d</rtp-ext-ip> --> - <rtp-port-min>4000</rtp-port-min> - <rtp-port-max>5000</rtp-port-max> - </rtp-factory> - </components> - - <settings> - <!-- common (default) RTP/RTCP settings --> - <rtp-settings id="RTP-Settings-1"> - <jitter-buffer> - <adaptive>1</adaptive> - <playout-delay>50</playout-delay> - <max-playout-delay>600</max-playout-delay> - <time-skew-detection>1</time-skew-detection> - </jitter-buffer> - <ptime>20</ptime> - <codecs>PCMU PCMA L16/96/8000 telephone-event/101/8000</codecs> - <!-- <codecs>PCMU PCMA L16/96/8000 PCMU/97/16000 PCMA/98/16000 L16/99/16000</codecs> --> - <!-- enable/disable RTCP support --> - <rtcp enable="false"> - <!-- RTCP BYE policies (RTCP must be enabled first) - 0 - disable RTCP BYE - 1 - send RTCP BYE at the end of session - 2 - send RTCP BYE also at the end of each talkspurt (input) - --> - <rtcp-bye>1</rtcp-bye> - <!-- rtcp transmission interval in msec (set 0 to disable) --> - <tx-interval>5000</tx-interval> - <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) --> - <rx-resolution>1000</rx-resolution> - </rtcp> - </rtp-settings> - </settings> -</unimrcpclient> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> - <xsd:element name="unimrcpclient"> - <xsd:annotation> - <xsd:documentation>UniMRCP client document</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="properties" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Generic properties</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="ip" minOccurs="0"> - <xsd:complexType> - <xsd:attribute name="type" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="ext-ip" minOccurs="0"> - <xsd:complexType> - <xsd:attribute name="type" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="server-ip" minOccurs="0"> - <xsd:complexType> - <xsd:attribute name="type" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="components" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Common components</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="resource-factory" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Factory of MRCP resources</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence maxOccurs="unbounded"> - <xsd:element name="resource"> - <xsd:complexType> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="sip-uac" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>SIP signaling agent</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="sip-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="sip-ext-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="sip-port" type="xsd:short" /> - <xsd:element name="sip-transport" type="xsd:string" /> - <xsd:element name="ua-name" type="xsd:string" minOccurs="0" /> - <xsd:element name="sdp-origin" type="xsd:string" minOccurs="0" /> - <xsd:element name="sip-t1" type="xsd:long" minOccurs="0" /> - <xsd:element name="sip-t2" type="xsd:long" minOccurs="0" /> - <xsd:element name="sip-t4" type="xsd:long" minOccurs="0" /> - <xsd:element name="sip-t1x64" type="xsd:long" minOccurs="0" /> - <xsd:element name="sip-message-output" type="xsd:boolean" /> - <xsd:element name="sip-message-dump" type="xsd:string" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="type" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="rtsp-uac" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>RTSP signaling agent</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="max-connection-count" type="xsd:short" minOccurs="0" /> - <xsd:element name="request-timeout" type="xsd:long" minOccurs="0" /> - <xsd:element name="sdp-origin" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="type" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="mrcpv2-uac" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>MRCPv2 connection agent</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="max-connection-count" type="xsd:short" minOccurs="0" /> - <xsd:element name="offer-new-connection" type="xsd:boolean" minOccurs="0" /> - <xsd:element name="rx-buffer-size" type="xsd:long" minOccurs="0" /> - <xsd:element name="tx-buffer-size" type="xsd:long" minOccurs="0" /> - <xsd:element name="request-timeout" type="xsd:long" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="media-engine" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>Media processing engine</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="realtime-rate" type="xsd:short" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="rtp-factory" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>Factory of RTP terminations</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="rtp-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="rtp-ext-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="rtp-port-min" type="xsd:short" /> - <xsd:element name="rtp-port-max" type="xsd:short" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="settings" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Settings</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="sip-settings" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>SIP settings</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="server-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="server-port" type="xsd:short" /> - <xsd:element name="force-destination" type="xsd:boolean" default="false" minOccurs="0" /> - <xsd:element name="feature-tags" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="rtsp-settings" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>RTSP settings</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="server-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="server-port" type="xsd:short" /> - <xsd:element name="force-destination" type="xsd:boolean" default="false" minOccurs="0" /> - <xsd:element name="resource-location" type="xsd:string" /> - <xsd:element name="resource-map"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="param" maxOccurs="unbounded"> - <xsd:complexType> - <xsd:attribute name="name" type="xsd:string" use="required" /> - <xsd:attribute name="value" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="rtp-settings" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>RTP settings</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="jitter-buffer" minOccurs="0"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="adaptive" type="xsd:byte" /> - <xsd:element name="playout-delay" type="xsd:long" /> - <xsd:element name="max-playout-delay" type="xsd:long" /> - <xsd:element name="time-skew-detection" type="xsd:byte" /> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="ptime" type="xsd:long" minOccurs="0" /> - <xsd:element name="codecs" type="xsd:string" /> - <xsd:element name="rtcp" minOccurs="0"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="rtcp-bye" type="xsd:int" /> - <xsd:element name="tx-interval" type="xsd:long" /> - <xsd:element name="rx-resolution" type="xsd:long" /> - </xsd:sequence> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="profiles" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Profiles</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="mrcpv2-profile" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>MRCPv2 profile</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="sip-uac" type="xsd:string" /> - <xsd:element name="mrcpv2-uac" type="xsd:string" /> - <xsd:element name="media-engine" type="xsd:string" /> - <xsd:element name="rtp-factory" type="xsd:string" /> - <xsd:element name="sip-settings" type="xsd:string" /> - <xsd:element name="rtp-settings" type="xsd:string" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="mrcpv1-profile" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>MRCPv1 profile</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="rtsp-uac" type="xsd:string" /> - <xsd:element name="media-engine" type="xsd:string" /> - <xsd:element name="rtp-factory" type="xsd:string" /> - <xsd:element name="rtsp-settings" type="xsd:string" /> - <xsd:element name="rtp-settings" type="xsd:string" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="misc" minOccurs="0"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="sofiasip-logger" type="xsd:string" /> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - <xsd:attribute name="version" type="xsd:string" use="required" /> - <xsd:attribute name="subfolder" type="xsd:string" use="optional" /> - </xsd:complexType> - </xsd:element> -</xsd:schema> \ 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- UniMRCP server document --> -<unimrcpserver xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="unimrcpserver.xsd" version="1.0"> - <properties> - <!-- If the attribute "type" is set to "auto", IP address is - determined implicitly by the hostname. This is the default setting. --> - <ip type="auto"/> - - <!-- If the attribute "type" is set to "iface", IP address is - determined by the specified name of network interface/adapter. --> - <!-- <ip type="iface">eth0</ip>--> - - <!-- IP address can also be specified explicitly. --> - <!-- <ip>10.10.0.1</ip> --> - - <!-- <ext-ip>a.b.c.d</ext-ip> --> - </properties> - - <components> - <!-- Factory of MRCP resources --> - <resource-factory> - <resource id="speechsynth" enable="true"/> - <resource id="speechrecog" enable="true"/> - <resource id="recorder" enable="true"/> - <resource id="speakverify" enable="true"/> - </resource-factory> - - <!-- SofiaSIP MRCPv2 signaling agent --> - <sip-uas id="SIP-Agent-1" type="SofiaSIP"> - <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used. - They still can be explicitly specified (overriden) here. - --> - <!-- <sip-ip>10.10.0.1</sip-ip> --> - <!-- <sip-ext-ip>a.b.c.d</sip-ext-ip> --> - <sip-port>8060</sip-port> - <sip-transport>udp,tcp</sip-transport> - <!-- <force-destination>true</force-destination> --> - <ua-name>UniMRCP SofiaSIP</ua-name> - <sdp-origin>UniMRCPServer</sdp-origin> - <!-- <sip-t1>500</sip-t1> --> - <!-- <sip-t2>4000</sip-t2> --> - <!-- <sip-t4>4000</sip-t4> --> - <!-- <sip-t1x64>32000</sip-t1x64> --> - <!-- <sip-message-output>true</sip-message-output> --> - <!-- <sip-message-dump>sofia-sip-uas.log</sip-message-dump> --> - </sip-uas> - - <!-- UniRTSP MRCPv1 signaling agent --> - <rtsp-uas id="RTSP-Agent-1" type="UniRTSP"> - <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used. - They still can be explicitly specified (overriden) here. - --> - <!-- <rtsp-ip>10.10.0.1</rtsp-ip> --> - <!-- <rtsp-ext-ip>a.b.c.d</rtsp-ext-ip> --> - <rtsp-port>1554</rtsp-port> - <!-- <force-destination>true</force-destination> --> - <resource-map> - <param name="speechsynth" value="speechsynthesizer"/> - <param name="speechrecog" value="speechrecognizer"/> - </resource-map> - <max-connection-count>100</max-connection-count> - <sdp-origin>UniMRCPServer</sdp-origin> - </rtsp-uas> - - <!-- MRCPv2 connection agent --> - <mrcpv2-uas id="MRCPv2-Agent-1"> - <!-- By default, "ip" set in the properties will be used. - It still can be explicitly specified (overriden) here. - --> - <!-- <mrcp-ip>10.10.0.1</mrcp-ip> --> - <mrcp-port>1544</mrcp-port> - <max-connection-count>100</max-connection-count> - <force-new-connection>false</force-new-connection> - <rx-buffer-size>1024</rx-buffer-size> - <tx-buffer-size>1024</tx-buffer-size> - </mrcpv2-uas> - - <!-- Media processing engine --> - <media-engine id="Media-Engine-1"> - <realtime-rate>1</realtime-rate> - </media-engine> - - <!-- Factory of RTP terminations --> - <rtp-factory id="RTP-Factory-1"> - <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used. - They still can be explicitly specified (overriden) here. - --> - <!-- <rtp-ip>10.10.0.1</rtp-ip> --> - <!-- <rtp-ext-ip>a.b.c.d</rtp-ext-ip> --> - <rtp-port-min>5000</rtp-port-min> - <rtp-port-max>6000</rtp-port-max> - </rtp-factory> - - <!-- Factory of plugins (MRCP engines) --> - <plugin-factory> - <engine id="Demo-Synth-1" name="demosynth" enable="true"/> - <engine id="Demo-Recog-1" name="demorecog" enable="true"/> - <engine id="Demo-Verifier-1" name="demoverifier" enable="true"/> - <engine id="Recorder-1" name="mrcprecorder" enable="true"/> - - <!-- Engines may have additional named and generic params - <engine id="Your-Engine-1" name="yourengine" enable="false"> - <max-channel-count>100</max-channel-count> - <param name="..." value="..."/> - </engine> - --> - </plugin-factory> - </components> - - <settings> - <!-- RTP/RTCP settings --> - <rtp-settings id="RTP-Settings-1"> - <jitter-buffer> - <adaptive>1</adaptive> - <playout-delay>50</playout-delay> - <max-playout-delay>600</max-playout-delay> - <time-skew-detection>1</time-skew-detection> - </jitter-buffer> - <ptime>20</ptime> - <codecs own-preference="false">PCMU PCMA L16/96/8000 telephone-event/101/8000</codecs> - <!-- <codecs own-preference="false">PCMU PCMA L16/96/8000 PCMU/97/16000 PCMA/98/16000 L16/99/16000</codecs> --> - <!-- enable/disable RTCP support --> - <rtcp enable="false"> - <!-- RTCP BYE policies (RTCP must be enabled first) - 0 - disable RTCP BYE - 1 - send RTCP BYE at the end of session - 2 - send RTCP BYE also at the end of each talkspurt (input) - --> - <rtcp-bye>1</rtcp-bye> - <!-- rtcp transmission interval in msec (set 0 to disable) --> - <tx-interval>5000</tx-interval> - <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) --> - <rx-resolution>1000</rx-resolution> - </rtcp> - </rtp-settings> - </settings> - - - <profiles> - <!-- MRCPv2 default profile --> - <mrcpv2-profile id="uni2"> - <sip-uas>SIP-Agent-1</sip-uas> - <mrcpv2-uas>MRCPv2-Agent-1</mrcpv2-uas> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <rtp-settings>RTP-Settings-1</rtp-settings> - - <!-- It's possible to define profile based map of resources and engines. - <resource-engine-map> - <param name="speechsynth" value="Flite-1"/> - <param name="speechrecog" value="PocketSphinx-1"/> - </resource-engine-map> - --> - </mrcpv2-profile> - - <!-- MRCPv1 default profile --> - <mrcpv1-profile id="uni1"> - <rtsp-uas>RTSP-Agent-1</rtsp-uas> - <media-engine>Media-Engine-1</media-engine> - <rtp-factory>RTP-Factory-1</rtp-factory> - <rtp-settings>RTP-Settings-1</rtp-settings> - </mrcpv1-profile> - - <!-- more profiles might be added here --> - </profiles> -</unimrcpserver> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> - <xsd:element name="unimrcpserver"> - <xsd:annotation> - <xsd:documentation>UniMRCP server document</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="properties" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Generic properties</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="ip" minOccurs="0"> - <xsd:complexType> - <xsd:attribute name="type" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="ext-ip" minOccurs="0"> - <xsd:complexType> - <xsd:attribute name="type" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="components" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Common components</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="resource-factory" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Factory of MRCP resources</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence maxOccurs="unbounded"> - <xsd:element name="resource"> - <xsd:complexType> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="sip-uas" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>SIP signaling agent</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="sip-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="sip-ext-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="sip-port" type="xsd:short" /> - <xsd:element name="sip-transport" type="xsd:string" /> - <xsd:element name="force-destination" type="xsd:boolean" default="false" minOccurs="0" /> - <xsd:element name="ua-name" type="xsd:string" minOccurs="0" /> - <xsd:element name="sdp-origin" type="xsd:string" minOccurs="0" /> - <xsd:element name="sip-t1" type="xsd:long" minOccurs="0" /> - <xsd:element name="sip-t2" type="xsd:long" minOccurs="0" /> - <xsd:element name="sip-t4" type="xsd:long" minOccurs="0" /> - <xsd:element name="sip-t1x64" type="xsd:long" minOccurs="0" /> - <xsd:element name="sip-message-output" type="xsd:boolean" /> - <xsd:element name="sip-message-dump" type="xsd:string" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="type" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="rtsp-uas" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>RTSP signaling agent</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="rtsp-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="rtsp-ext-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="rtsp-port" type="xsd:string" /> - <xsd:element name="resource-map"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="param" maxOccurs="unbounded"> - <xsd:complexType> - <xsd:attribute name="name" type="xsd:string" use="required" /> - <xsd:attribute name="value" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="max-connection-count" type="xsd:short" minOccurs="0" /> - <xsd:element name="sdp-origin" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="type" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="mrcpv2-uas" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>MRCPv2 connection agent</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="mrcp-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="mrcp-port" type="xsd:string" /> - <xsd:element name="max-connection-count" type="xsd:short" minOccurs="0" /> - <xsd:element name="force-new-connection" type="xsd:boolean" minOccurs="0" /> - <xsd:element name="rx-buffer-size" type="xsd:long" minOccurs="0" /> - <xsd:element name="tx-buffer-size" type="xsd:long" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="media-engine" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>Media processing engine</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="realtime-rate" type="xsd:short" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="rtp-factory" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>Factory of RTP terminations</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="rtp-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="rtp-ext-ip" type="xsd:string" minOccurs="0" /> - <xsd:element name="rtp-port-min" type="xsd:short" /> - <xsd:element name="rtp-port-max" type="xsd:short" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="plugin-factory" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Factory of plugins (MRCP engines)</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence maxOccurs="unbounded"> - <xsd:element name="engine"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="max-channel-count" minOccurs="0" /> - <xsd:element name="param" minOccurs="0" maxOccurs="unbounded"> - <xsd:complexType> - <xsd:attribute name="name" type="xsd:string" use="required" /> - <xsd:attribute name="value" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="name" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="settings" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Settings</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="rtp-settings" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>RTP settings</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="jitter-buffer" minOccurs="0"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="adaptive" type="xsd:byte" /> - <xsd:element name="playout-delay" type="xsd:long" /> - <xsd:element name="max-playout-delay" type="xsd:long" /> - <xsd:element name="time-skew-detection" type="xsd:byte" /> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="ptime" type="xsd:long" minOccurs="0" /> - <xsd:element name="codecs"> - <xsd:complexType> - <xsd:simpleContent> - <xsd:extension base="xsd:string"> - <xsd:attribute name="own-preference" type="xsd:boolean" use="optional" /> - </xsd:extension> - </xsd:simpleContent> - </xsd:complexType> - </xsd:element> - <xsd:element name="rtcp" minOccurs="0"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="rtcp-bye" type="xsd:int" /> - <xsd:element name="tx-interval" type="xsd:long" /> - <xsd:element name="rx-resolution" type="xsd:long" /> - </xsd:sequence> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="profiles" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Profiles</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="mrcpv2-profile" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>MRCPv2 profile</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="sip-uas" type="xsd:string" /> - <xsd:element name="mrcpv2-uas" type="xsd:string" /> - <xsd:element name="media-engine" type="xsd:string" /> - <xsd:element name="rtp-factory" type="xsd:string" /> - <xsd:element name="rtp-settings" type="xsd:string" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="mrcpv1-profile" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>MRCPv1 profile</xsd:documentation> - </xsd:annotation> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="rtsp-uas" type="xsd:string" /> - <xsd:element name="media-engine" type="xsd:string" /> - <xsd:element name="rtp-factory" type="xsd:string" /> - <xsd:element name="rtp-settings" type="xsd:string" /> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string" use="required" /> - <xsd:attribute name="enable" type="xsd:boolean" use="optional" /> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - <xsd:element name="misc" minOccurs="0"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="sofiasip-logger" type="xsd:string" /> - </xsd:sequence> - </xsd:complexType> - </xsd:element> - </xsd:sequence> - <xsd:attribute name="version" type="xsd:string" use="required" /> - <xsd:attribute name="subfolder" type="xsd:string" use="optional" /> - </xsd:complexType> - </xsd:element> -</xsd:schema> \ 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. -<Layout classic> - 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} -</Layout> 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!sX<byB$etbO)hp|7k1|RJh<lKJn$au&cEhiZ+_gFfAwKMr2N>2d2j)6 zA{HQ&;VR`j87mlrS0E)rEEreQ3Z&J$K_}&>)lhv-%@2kmT!T64z2H~XQ1t>hwLI0U zr3SCTSl~Z-YO3Ig;Pe09QPcn455BF2>X+5p2Sc^2pi|2a)<CV(f4g8>4b^(9zMvIq zd(~Vu4<QA-nxls3fBeY&6op7cA^Ja#K@8G>V-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<lt4UgX#)eUobQL z%g+V8{ol_7-}(0o|6OXZ9%}e+&-~j<1oWTUYji$G7jSd1mxH0o4?!*t@~s+IT>-}i zQ(S&Jn6L71fm1mr$bss&gZ!!T3(AlGTcdwt1vORMP(ZDJd!rzx-ci?vV4MH{u%Iss zXcBx+rDj1)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7nR~_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~<t5#z+-Ql>T6lF= uNNkOJ#zD_-JbcGuF&5)Lyf?brgvQ?gFkbAlp_<2~-An4ZW`ayV+xj0Wei<hK diff --git a/libs/unimrcp/data/demo-8kHz.pcm b/libs/unimrcp/data/demo-8kHz.pcm deleted file mode 100644 index 5121fdc4839f9bfb74533fb784c4848d1950b50a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35200 zcmZs@1(X~&um!5-=^mbCGc$9{j+q%^ikTs1W;<rb%#N9vF=mFCnY~`#9i}Gf*La^# z-uwTrPWSZmbPGySsqU@PYD6a(j{nZ&#~(t3pdWt}q7eg$Mcj|XBLNwH90vIOc_qLd z0r8L`PqFYkjVMTweDIGHDMKSFB!$R74jDcpSJ~fxp8xwExr(I7JCUUQsAqOvv-6Bp z6=zo%Y8$!uS?@^Mk(x(RcI{cHRiq6++mYQG?tf|=xu5-Oq@|HJvQu^rk+%H2`uR)b zssHlKzKWdxdq4Y)Y$;^RGP{2NQ{n$5m+T&h$S3=VoU>c|Uz;QC{{N<k9R9aNvgHyv z|CIYr`DB;+zkiAJ`OlJnen#^8|0^>)-~TJ^Y+3)5^M7*re@i%9(my2>c`jQr=zqpX zcF#rXmtD%wbN2WD+WfP&KY#zfpV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!MH?xNFHnT7O=a%=axkuif|M{Hv*?;bBe)6Bk$-4{xyT{j~=k4{M$I2^7 zo`3D@b6yGaYW;tGHrwa_e#>iD^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 <numbers> = (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 - -<?xml version="1.0"?> -<grammar root="digit" version="1.0" xml:lang="en-US" - xmlns="http://www.w3.org/2001/06/grammar"> - <rule id="digit" scope="public"> - <item>one two three four five</item> - </rule> -</grammar> ---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 @@ -<?xml version="1.0"?> -<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" version="1.0" mode="voice" root="digit"> - <rule id="digit"> - <one-of> - <item>one</item> - <item>two</item> - <item>three</item> - </one-of> - </rule> -</grammar> \ 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%<Pykjwxn}nVFes?Ol6$hi96kzs7U? z<$V9W&mBG8tyYs%swzoUZ;c6=kP$XBY=K-L{X7~_AQ@qk{*y!`AQ6&)c*OlkEMgG@ ziA6tuloA@;bQ(x1)qW&}{!B8JsUNn${@)~1-;c9@OMl)My!Yo>;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{QrDQ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S@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@<lPQ3Phw?W#JPV3TXi@mq3ZQt7? z_k_OW_s^E+bdD!;Rtl7}_ogLb^jsEgnq_hqo01-WGq}n=GnM}d{I#Xn!C0s93PKfo zZ(=t`NE=}l+B=ZiyWHAx>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;<7<zxt%LLT<F&PnE%llI?N9#sS$z7pulByU z`8y`tbA<h}_vf`aD!)heUwaQ=dxypRpZpzx^Ut-<Qhb+B3G4Y;_L=#w{PXQr+h^N9 z_O<^~(mwLvTmJX@e?Qrjv?*cVH=iE)|Nq?;JpWq<-`kY3>G<zA`E&#74f^KqZf)y? z{O|3f_RBtE>#qE9$R7)P#O(9)k9(hwpgm&$duM;Lf9<>2*Z*(F?f>nSZMX7&bh3M6 zkC*+*-<jQ(%lw_9?a{G!bhUZf);IRc9>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(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G&l z%mR6Y00}X$#~?Ss_c{Hb@HsdNYBUY=q=MSu=RHRK09glR?gqUQ#x*f=IM%5M&>92E z^I{*0nPP$e2<S2nzw%?=NX(i8Gel!!pe5*I0~jOteyoaL7CcvwE(<({Vq^ul@Pn41 z4+-XQypSFT=Nvi-`kvrhnV&#S0A4}hY|#5fV9ekfz0uHY1hgKCPcH18m@OVh!XOKQ WF(UpWUl-=V>uFy!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~&;o39<W%Ce|1AzgphqbGTh!nIZD<4#EA|abihz2w z1Z5aGpwKf&sjTeAGTeXIfB`J1XV*5m?%JasG8O9|ENFa~S18@M5kY(D_5=G&*(ieg zh#nX487-mlxNWya<%p&=<f8I_-`prb@5V~ov;`9EH<lPPYN0<g5;q!(bz2Y_+JiUT zM_a|(Pz2aek8Yn(PW@vpU2a-~$SBU;Vr9`SsKa=<c=Qbt#6z@b;iA$1y?q7^wLlKE zaz_Yaj<y9f`ayQIgc7ufp)!}j^#w-)=82*xo6Cs4sRr`t+5#htH%iemnvvQ;Z=eQT zzz4plHCV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avly)Nvi8Nu$_q>y 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(k<XQ!La^?sed z$TH}tVmmPZ5cA6i<nolBN{GE@<w(zroxk1G{&MO}QidT*U*`6fDy)e2PVeo%tL=U~ z^NGu^43243-P+l9hC4No{_a3TXMk($65KU&K4r2ueS4{tr*(>sa_u=^ip$ImB=x!7 ztZ-#*gu&JOP)FYN_vbN0?~b01)vmX0bj0XV6?HzXS<Ug*)4pSDIp&tFOUkL+1J^$~ z^i{4xIdzgVS2e+;s#Y2DTtA)Mr`7Cwq)PAB#nxri$;`Obix)<wcRAlvrrO8cth}x& mr^?zL(@#&VEPba?HY=VJch;fiqCa<fzqPE{4Waw)s{S8|tvPQ1 diff --git a/libs/unimrcp/data/one-8kHz.pcm b/libs/unimrcp/data/one-8kHz.pcm deleted file mode 100644 index 92c1e92cf032b2a2980c176786855dafc4d41101..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32318 zcmeI1tCQQ<w#Fq{cDuXX=}zJ#JsHh8sVUV|?kU%;1_lEJ1_<O<84NHOATU5+K!X5- zfQA791_KNN1OfyC3<3-W2n-MiFbFUhU=Sb>;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<<Bt8n{Uf~ ztMU`$1CLeNG)|1i#+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7=vP9zAY!p)BC0_CxPc&ffC;AGHif$$O%Q49_cxKnP{){NjlT9R{Y%k z>Jibi2E<A0Ht#xo7Rc`)_#4Qt2`EcMFUNiMd98y!bl}~<46s@_H9!j@vWfkY_A-=M zkTsdGNIcNlBHrKwIuHsjYL+jtw4e8hz5Ff_!LkJywDXY~(dj#I*(*=syUj|kN*50@ zu=2_7u_b2?eb_QIpMmBAJjdo4_b#j<d#xe-6#p1fec)-pHP3oKfYR~0$EjpT&-BFj z71bD!LxW<Ok6{NW($@?aOR2NuONP~%XpCBtiz8II4YEr$!Tv=tXNW=)75WW%h+i#E zXIFIm@5;BZ`;YPo>SAMY&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<q%YWlrr^W~DeMu}{aQ7=_I$_q=*mJ=+CsSni@_~EbGvxmZK6}fx)I9?`exYK> 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%*56V<VTF>eB%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 @@ -<?xml version="1.0"?> -<result> - <verification-result> - <voiceprint id="johnsmith"> - <incremental> - <utterance-length> 500 </utterance-length> - <device> cellular-phone </device> - <gender> male </gender> - <decision> accepted </decision> - <verification-score> 0.85 </verification-score> - </incremental> - <cumulative> - <utterance-length> 1500 </utterance-length> - <device> cellular-phone </device> - <gender> male </gender> - <decision> accepted </decision> - <verification-score> 0.75 </verification-score> - </cumulative> - </voiceprint> - </verification-result> -</result> \ 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 @@ -<?xml version="1.0"?> -<result> - <interpretation grammar="session:request1@form-level.store" confidence="0.97"> - <instance>one</instance> - <input mode="speech">one</input> - </interpretation> -</result> \ 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 @@ -<?xml version="1.0"?> -<speak version="1.0" xml:lang="en-US" xmlns="http://www.w3.org/2001/10/synthesis"> - <p> - <s>Welcome to Uni MRCP.</s> - </p> -</speak> \ 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 - -<br> -@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++ -<br> -<br> -@section _ Source Tree Structure - -<br> -@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. - -<br> -@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. - -<br> -@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. - -<br> -@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. - -<br> -@section Dependencies - -- <a href="http://apr.apache.org"> APR - Apache Portable Runtime Library </a> -- <a href="http://sofia-sip.sourceforge.net"> Sofia-SIP - SIP User Agent Library </a> - -<br> -@section Project Links - -- <a href="http://www.unimrcp.org"> Website </a> -- <a href="http://www.unimrcp.org/downloads"> Downloads </a> -- <a href="http://www.unimrcp.org/documentation"> Documentation </a> -- <a href="http://code.google.com/p/unimrcp/issues/list"> Issue Tracker </a> -- <a href="http://groups.google.com/group/unimrcp"> Discussion Group </a> -<br> - -*/ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>aprtoolkit</ProjectName> - <ProjectGuid>{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}</ProjectGuid> - <RootNamespace>aprtoolkit</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\apt.h" /> - <ClInclude Include="include\apt_consumer_task.h" /> - <ClInclude Include="include\apt_cyclic_queue.h" /> - <ClInclude Include="include\apt_dir_layout.h" /> - <ClInclude Include="include\apt_header_field.h" /> - <ClInclude Include="include\apt_log.h" /> - <ClInclude Include="include\apt_multipart_content.h" /> - <ClInclude Include="include\apt_net.h" /> - <ClInclude Include="include\apt_nlsml_doc.h" /> - <ClInclude Include="include\apt_obj_list.h" /> - <ClInclude Include="include\apt_pair.h" /> - <ClInclude Include="include\apt_pollset.h" /> - <ClInclude Include="include\apt_poller_task.h" /> - <ClInclude Include="include\apt_pool.h" /> - <ClInclude Include="include\apt_string.h" /> - <ClInclude Include="include\apt_string_table.h" /> - <ClInclude Include="include\apt_task.h" /> - <ClInclude Include="include\apt_task_msg.h" /> - <ClInclude Include="include\apt_test_suite.h" /> - <ClInclude Include="include\apt_text_message.h" /> - <ClInclude Include="include\apt_text_stream.h" /> - <ClInclude Include="include\apt_time_queue.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\apt_consumer_task.c" /> - <ClCompile Include="src\apt_cyclic_queue.c" /> - <ClCompile Include="src\apt_dir_layout.c" /> - <ClCompile Include="src\apt_header_field.c" /> - <ClCompile Include="src\apt_log.c" /> - <ClCompile Include="src\apt_multipart_content.c" /> - <ClCompile Include="src\apt_net.c" /> - <ClCompile Include="src\apt_nlsml_doc.c" /> - <ClCompile Include="src\apt_obj_list.c" /> - <ClCompile Include="src\apt_pair.c" /> - <ClCompile Include="src\apt_poller_task.c" /> - <ClCompile Include="src\apt_pollset.c" /> - <ClCompile Include="src\apt_pool.c" /> - <ClCompile Include="src\apt_string_table.c" /> - <ClCompile Include="src\apt_task.c" /> - <ClCompile Include="src\apt_task_msg.c" /> - <ClCompile Include="src\apt_test_suite.c" /> - <ClCompile Include="src\apt_text_message.c" /> - <ClCompile Include="src\apt_text_stream.c" /> - <ClCompile Include="src\apt_timer_queue.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\apr-util\libaprutil.2017.vcxproj"> - <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="aprtoolkit" - ProjectGUID="{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}" - RootNamespace="aprtoolkit" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\apt.h" - > - </File> - <File - RelativePath=".\include\apt_consumer_task.h" - > - </File> - <File - RelativePath=".\include\apt_cyclic_queue.h" - > - </File> - <File - RelativePath=".\include\apt_dir_layout.h" - > - </File> - <File - RelativePath=".\include\apt_header_field.h" - > - </File> - <File - RelativePath=".\include\apt_log.h" - > - </File> - <File - RelativePath=".\include\apt_multipart_content.h" - > - </File> - <File - RelativePath=".\include\apt_net.h" - > - </File> - <File - RelativePath=".\include\apt_nlsml_doc.h" - > - </File> - <File - RelativePath=".\include\apt_obj_list.h" - > - </File> - <File - RelativePath=".\include\apt_pair.h" - > - </File> - <File - RelativePath=".\include\apt_poller_task.h" - > - </File> - <File - RelativePath=".\include\apt_pollset.h" - > - </File> - <File - RelativePath=".\include\apt_pool.h" - > - </File> - <File - RelativePath=".\include\apt_string.h" - > - </File> - <File - RelativePath=".\include\apt_string_table.h" - > - </File> - <File - RelativePath=".\include\apt_task.h" - > - </File> - <File - RelativePath=".\include\apt_task_msg.h" - > - </File> - <File - RelativePath=".\include\apt_test_suite.h" - > - </File> - <File - RelativePath=".\include\apt_text_message.h" - > - </File> - <File - RelativePath=".\include\apt_text_stream.h" - > - </File> - <File - RelativePath=".\include\apt_timer_queue.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\apt_consumer_task.c" - > - </File> - <File - RelativePath=".\src\apt_cyclic_queue.c" - > - </File> - <File - RelativePath=".\src\apt_dir_layout.c" - > - </File> - <File - RelativePath=".\src\apt_header_field.c" - > - </File> - <File - RelativePath=".\src\apt_log.c" - > - </File> - <File - RelativePath=".\src\apt_multipart_content.c" - > - </File> - <File - RelativePath=".\src\apt_net.c" - > - </File> - <File - RelativePath=".\src\apt_nlsml_doc.c" - > - </File> - <File - RelativePath=".\src\apt_obj_list.c" - > - </File> - <File - RelativePath=".\src\apt_pair.c" - > - </File> - <File - RelativePath=".\src\apt_poller_task.c" - > - </File> - <File - RelativePath=".\src\apt_pollset.c" - > - </File> - <File - RelativePath=".\src\apt_pool.c" - > - </File> - <File - RelativePath=".\src\apt_string_table.c" - > - </File> - <File - RelativePath=".\src\apt_task.c" - > - </File> - <File - RelativePath=".\src\apt_task_msg.c" - > - </File> - <File - RelativePath=".\src\apt_test_suite.c" - > - </File> - <File - RelativePath=".\src\apt_text_message.c" - > - </File> - <File - RelativePath=".\src\apt_text_stream.c" - > - </File> - <File - RelativePath=".\src\apt_timer_queue.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}</ProjectGuid> - <RootNamespace>aprtoolkit</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\apt.h" /> - <ClInclude Include="include\apt_consumer_task.h" /> - <ClInclude Include="include\apt_cyclic_queue.h" /> - <ClInclude Include="include\apt_dir_layout.h" /> - <ClInclude Include="include\apt_header_field.h" /> - <ClInclude Include="include\apt_log.h" /> - <ClInclude Include="include\apt_multipart_content.h" /> - <ClInclude Include="include\apt_net.h" /> - <ClInclude Include="include\apt_nlsml_doc.h" /> - <ClInclude Include="include\apt_obj_list.h" /> - <ClInclude Include="include\apt_pair.h" /> - <ClInclude Include="include\apt_poller_task.h" /> - <ClInclude Include="include\apt_pollset.h" /> - <ClInclude Include="include\apt_pool.h" /> - <ClInclude Include="include\apt_string.h" /> - <ClInclude Include="include\apt_string_table.h" /> - <ClInclude Include="include\apt_task.h" /> - <ClInclude Include="include\apt_task_msg.h" /> - <ClInclude Include="include\apt_test_suite.h" /> - <ClInclude Include="include\apt_text_message.h" /> - <ClInclude Include="include\apt_text_stream.h" /> - <ClInclude Include="include\apt_timer_queue.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\apt_consumer_task.c" /> - <ClCompile Include="src\apt_cyclic_queue.c" /> - <ClCompile Include="src\apt_dir_layout.c" /> - <ClCompile Include="src\apt_header_field.c" /> - <ClCompile Include="src\apt_log.c" /> - <ClCompile Include="src\apt_multipart_content.c" /> - <ClCompile Include="src\apt_net.c" /> - <ClCompile Include="src\apt_nlsml_doc.c" /> - <ClCompile Include="src\apt_obj_list.c" /> - <ClCompile Include="src\apt_pair.c" /> - <ClCompile Include="src\apt_poller_task.c" /> - <ClCompile Include="src\apt_pollset.c" /> - <ClCompile Include="src\apt_pool.c" /> - <ClCompile Include="src\apt_string_table.c" /> - <ClCompile Include="src\apt_task.c" /> - <ClCompile Include="src\apt_task_msg.c" /> - <ClCompile Include="src\apt_test_suite.c" /> - <ClCompile Include="src\apt_text_message.c" /> - <ClCompile Include="src\apt_text_stream.c" /> - <ClCompile Include="src\apt_timer_queue.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{4e9335ac-20e8-4284-ad77-20ad9190c94d}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\apt.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_consumer_task.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_cyclic_queue.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_dir_layout.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_header_field.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_log.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_multipart_content.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_net.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_nlsml_doc.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_obj_list.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_pair.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_poller_task.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_pollset.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_pool.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_string.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_string_table.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_task.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_task_msg.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_test_suite.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_text_message.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_text_stream.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\apt_timer_queue.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\apt_consumer_task.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_cyclic_queue.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_dir_layout.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_header_field.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_log.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_multipart_content.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_net.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_nlsml_doc.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_obj_list.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_pair.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_poller_task.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_pollset.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_pool.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_string_table.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_task.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_task_msg.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_test_suite.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_text_message.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_text_stream.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\apt_timer_queue.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr.h> -#include <apr_pools.h> -#include <apr_strings.h> - -#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 <apr_ring.h> -#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 <stdio.h> -#include <stdarg.h> -#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 <apr_xml.h> -#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 <result> element. - * Each <result> element may contain one or more <interpretation>, <enrollment-result>, - * <verification-result> elements, and an optional <grammar> 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 <interpretation> 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 <instance> and <input> 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 <apr_tables.h> -#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 <apr_poll.h> -#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 <apr_time.h> -#include <apr_queue.h> -#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 <stdlib.h> -#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 <apr_file_info.h> -#include <apr_xml.h> -#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; i<count; i++) { - if(strcasecmp(labels[i],name) == 0) { - if(id) - *id = i; - return TRUE; - } - } - return FALSE; -} - -static apr_xml_doc* apt_dir_layout_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; -} - -static APR_INLINE apr_status_t apt_dir_is_path_absolute(const char *path, apr_pool_t *pool) -{ - const char *root_path; - const char *file_path = path; - return apr_filepath_root(&root_path,&file_path,0,pool); -} - -static char* apt_dir_layout_subdir_parse(const char *root_dir_path, const apr_xml_elem *elem, apr_pool_t *pool) -{ - char *path; - char *full_path = NULL; - apr_status_t status; - - if(!elem || !elem->first_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 <apr_time.h> -#include <apr_file_io.h> -#include <apr_portable.h> -#include <apr_xml.h> -#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_index<file_data->max_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 <stdlib.h> -#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 <apr_network_io.h> -#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 <iphlpapi.h> -#pragma comment(lib, "IPHLPAPI.lib") -#else -#include <netdb.h> -#include <ifaddrs.h> -#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 <stdlib.h> -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include <apr_ring.h> - -#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 <result> */ - 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 <instance> 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 <input> 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 <interpretation> 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 <enrollment-result> 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 <verification-result> 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 <interpretation>, <enrollment-result>, <verification-result> 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 <apr_ring.h> -#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; i<arr->nelts; 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; i<arr->nelts; 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 <apr_poll.h> -#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 <ctype.h> -#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; i<size; i++) { - item = &table[i]; - if(item->value.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 <apr_ring.h> -#include <apr_thread_proc.h> -#include <apr_thread_cond.h> -#include <apr_portable.h> -#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 <stdlib.h> -#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; i<folded_lines->nelts; 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 <CR> and <LF> */ - if(stream->pos == stream->end && *(stream->pos-1)== APT_TOKEN_CR) { - /* if this is the case be prepared to skip <LF> 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 <LF> occurred as a result of message segmentation between <CR> and <LF> */ - 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 <stdlib.h> -#include <stdio.h> -#include <apr_uuid.h> -#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<CRLF> - name: value<CRLF> - name: value<CRLF> - name: value<LF> - name:<CRLF> (only name, no value) - <CRLF> (empty header) - Malformed header fields are: - name:value (missing end of line <CRLF>) - name<CRLF> (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; i<arr->nelts; 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; i<arr->nelts; 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; i<count; i++) { - sprintf(hex_str+i*2,"%02x",uuid.data[i]); - } - hex_str[length] = '\0'; - - id->buf = 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 <apr_ring.h> -#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 <steveu@coppice.org> - * - * 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 <steveu@coppice.org> - * - * 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 <apt.h> - -/** 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 <stdio.h> -#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 <apr_tables.h> -#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 <apr_network_io.h> -#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 <stdio.h> -#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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="codecs"> - <UniqueIdentifier>{3d69fc35-a195-4376-9508-ef77d7b27e71}</UniqueIdentifier> - </Filter> - <Filter Include="codecs\g711"> - <UniqueIdentifier>{81e2eace-c57a-4135-92cd-cc3575dfb088}</UniqueIdentifier> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{6fc3533a-b688-477d-914d-e0ffb15aa9a9}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="codecs\g711\g711.c"> - <Filter>codecs\g711</Filter> - </ClCompile> - <ClCompile Include="src\mpf_activity_detector.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_audio_file_stream.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_bridge.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_buffer.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_codec_descriptor.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_codec_g711.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_codec_linear.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_codec_manager.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_context.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_decoder.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_dtmf_detector.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_dtmf_generator.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_encoder.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_engine.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_file_termination_factory.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_frame_buffer.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_jitter_buffer.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_mixer.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_multiplier.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_named_event.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_resampler.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_rtp_attribs.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_rtp_stream.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_rtp_termination_factory.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_scheduler.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_stream.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_termination.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_termination_factory.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_engine_factory.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="codecs\g711\g711.h"> - <Filter>codecs\g711</Filter> - </ClInclude> - <ClInclude Include="include\mpf.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_activity_detector.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_audio_file_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_audio_file_stream.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_bridge.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_buffer.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_codec.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_codec_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_codec_manager.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_context.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_decoder.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_dtmf_detector.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_dtmf_generator.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_encoder.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_file_termination_factory.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_frame.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_frame_buffer.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_jitter_buffer.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_message.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_mixer.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_multiplier.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_named_event.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_object.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_resampler.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtcp_packet.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_attribs.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_defs.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_header.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_pt.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_stat.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_stream.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_termination_factory.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_scheduler.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_stream.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_stream_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_termination.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_termination_factory.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_types.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mpf</ProjectName> - <ProjectGuid>{B5A00BFA-6083-4FAE-A097-71642D6473B5}</ProjectGuid> - <RootNamespace>mpf</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <TreatWarningAsError>false</TreatWarningAsError> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <TreatWarningAsError>false</TreatWarningAsError> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="codecs\g711\g711.c" /> - <ClCompile Include="src\mpf_activity_detector.c" /> - <ClCompile Include="src\mpf_audio_file_stream.c" /> - <ClCompile Include="src\mpf_bridge.c" /> - <ClCompile Include="src\mpf_buffer.c" /> - <ClCompile Include="src\mpf_codec_descriptor.c" /> - <ClCompile Include="src\mpf_codec_g711.c" /> - <ClCompile Include="src\mpf_codec_linear.c" /> - <ClCompile Include="src\mpf_codec_manager.c" /> - <ClCompile Include="src\mpf_context.c" /> - <ClCompile Include="src\mpf_decoder.c" /> - <ClCompile Include="src\mpf_dtmf_detector.c" /> - <ClCompile Include="src\mpf_dtmf_generator.c" /> - <ClCompile Include="src\mpf_encoder.c" /> - <ClCompile Include="src\mpf_engine.c" /> - <ClCompile Include="src\mpf_engine_factory.c" /> - <ClCompile Include="src\mpf_file_termination_factory.c" /> - <ClCompile Include="src\mpf_frame_buffer.c" /> - <ClCompile Include="src\mpf_jitter_buffer.c" /> - <ClCompile Include="src\mpf_mixer.c" /> - <ClCompile Include="src\mpf_multiplier.c" /> - <ClCompile Include="src\mpf_named_event.c" /> - <ClCompile Include="src\mpf_resampler.c" /> - <ClCompile Include="src\mpf_rtp_attribs.c" /> - <ClCompile Include="src\mpf_rtp_stream.c" /> - <ClCompile Include="src\mpf_rtp_termination_factory.c" /> - <ClCompile Include="src\mpf_scheduler.c" /> - <ClCompile Include="src\mpf_stream.c" /> - <ClCompile Include="src\mpf_termination.c" /> - <ClCompile Include="src\mpf_termination_factory.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="codecs\g711\g711.h" /> - <ClInclude Include="include\mpf.h" /> - <ClInclude Include="include\mpf_activity_detector.h" /> - <ClInclude Include="include\mpf_audio_file_descriptor.h" /> - <ClInclude Include="include\mpf_audio_file_stream.h" /> - <ClInclude Include="include\mpf_bridge.h" /> - <ClInclude Include="include\mpf_buffer.h" /> - <ClInclude Include="include\mpf_codec.h" /> - <ClInclude Include="include\mpf_codec_descriptor.h" /> - <ClInclude Include="include\mpf_codec_manager.h" /> - <ClInclude Include="include\mpf_context.h" /> - <ClInclude Include="include\mpf_decoder.h" /> - <ClInclude Include="include\mpf_dtmf_detector.h" /> - <ClInclude Include="include\mpf_dtmf_generator.h" /> - <ClInclude Include="include\mpf_encoder.h" /> - <ClInclude Include="include\mpf_engine.h" /> - <ClInclude Include="include\mpf_file_termination_factory.h" /> - <ClInclude Include="include\mpf_frame.h" /> - <ClInclude Include="include\mpf_frame_buffer.h" /> - <ClInclude Include="include\mpf_jitter_buffer.h" /> - <ClInclude Include="include\mpf_message.h" /> - <ClInclude Include="include\mpf_mixer.h" /> - <ClInclude Include="include\mpf_multiplier.h" /> - <ClInclude Include="include\mpf_named_event.h" /> - <ClInclude Include="include\mpf_object.h" /> - <ClInclude Include="include\mpf_resampler.h" /> - <ClInclude Include="include\mpf_rtcp_packet.h" /> - <ClInclude Include="include\mpf_rtp_attribs.h" /> - <ClInclude Include="include\mpf_rtp_defs.h" /> - <ClInclude Include="include\mpf_rtp_descriptor.h" /> - <ClInclude Include="include\mpf_rtp_header.h" /> - <ClInclude Include="include\mpf_rtp_pt.h" /> - <ClInclude Include="include\mpf_rtp_stat.h" /> - <ClInclude Include="include\mpf_rtp_stream.h" /> - <ClInclude Include="include\mpf_rtp_termination_factory.h" /> - <ClInclude Include="include\mpf_scheduler.h" /> - <ClInclude Include="include\mpf_stream.h" /> - <ClInclude Include="include\mpf_stream_descriptor.h" /> - <ClInclude Include="include\mpf_termination.h" /> - <ClInclude Include="include\mpf_termination_factory.h" /> - <ClInclude Include="include\mpf_types.h" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mpf" - ProjectGUID="{B5A00BFA-6083-4FAE-A097-71642D6473B5}" - RootNamespace="mpf" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="codecs" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="codecs" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="codecs" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="codecs" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="codecs" - > - <Filter - Name="g711" - > - <File - RelativePath=".\codecs\g711\g711.c" - > - </File> - <File - RelativePath=".\codecs\g711\g711.h" - > - </File> - </Filter> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mpf.h" - > - </File> - <File - RelativePath=".\include\mpf_activity_detector.h" - > - </File> - <File - RelativePath=".\include\mpf_audio_file_descriptor.h" - > - </File> - <File - RelativePath=".\include\mpf_audio_file_stream.h" - > - </File> - <File - RelativePath=".\include\mpf_bridge.h" - > - </File> - <File - RelativePath=".\include\mpf_buffer.h" - > - </File> - <File - RelativePath=".\include\mpf_codec.h" - > - </File> - <File - RelativePath=".\include\mpf_codec_descriptor.h" - > - </File> - <File - RelativePath=".\include\mpf_codec_manager.h" - > - </File> - <File - RelativePath=".\include\mpf_context.h" - > - </File> - <File - RelativePath=".\include\mpf_decoder.h" - > - </File> - <File - RelativePath=".\include\mpf_dtmf_detector.h" - > - </File> - <File - RelativePath=".\include\mpf_dtmf_generator.h" - > - </File> - <File - RelativePath=".\include\mpf_encoder.h" - > - </File> - <File - RelativePath=".\include\mpf_engine.h" - > - </File> - <File - RelativePath=".\include\mpf_engine_factory.h" - > - </File> - <File - RelativePath=".\include\mpf_file_termination_factory.h" - > - </File> - <File - RelativePath=".\include\mpf_frame.h" - > - </File> - <File - RelativePath=".\include\mpf_frame_buffer.h" - > - </File> - <File - RelativePath=".\include\mpf_jitter_buffer.h" - > - </File> - <File - RelativePath=".\include\mpf_message.h" - > - </File> - <File - RelativePath=".\include\mpf_mixer.h" - > - </File> - <File - RelativePath=".\include\mpf_multiplier.h" - > - </File> - <File - RelativePath=".\include\mpf_named_event.h" - > - </File> - <File - RelativePath=".\include\mpf_object.h" - > - </File> - <File - RelativePath=".\include\mpf_resampler.h" - > - </File> - <File - RelativePath=".\include\mpf_rtcp_packet.h" - > - </File> - <File - RelativePath=".\include\mpf_rtp_attribs.h" - > - </File> - <File - RelativePath=".\include\mpf_rtp_defs.h" - > - </File> - <File - RelativePath=".\include\mpf_rtp_descriptor.h" - > - </File> - <File - RelativePath=".\include\mpf_rtp_header.h" - > - </File> - <File - RelativePath=".\include\mpf_rtp_pt.h" - > - </File> - <File - RelativePath=".\include\mpf_rtp_stat.h" - > - </File> - <File - RelativePath=".\include\mpf_rtp_stream.h" - > - </File> - <File - RelativePath=".\include\mpf_rtp_termination_factory.h" - > - </File> - <File - RelativePath=".\include\mpf_scheduler.h" - > - </File> - <File - RelativePath=".\include\mpf_stream.h" - > - </File> - <File - RelativePath=".\include\mpf_stream_descriptor.h" - > - </File> - <File - RelativePath=".\include\mpf_termination.h" - > - </File> - <File - RelativePath=".\include\mpf_termination_factory.h" - > - </File> - <File - RelativePath=".\include\mpf_types.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mpf_activity_detector.c" - > - </File> - <File - RelativePath=".\src\mpf_audio_file_stream.c" - > - </File> - <File - RelativePath=".\src\mpf_bridge.c" - > - </File> - <File - RelativePath=".\src\mpf_buffer.c" - > - </File> - <File - RelativePath=".\src\mpf_codec_descriptor.c" - > - </File> - <File - RelativePath=".\src\mpf_codec_g711.c" - > - </File> - <File - RelativePath=".\src\mpf_codec_linear.c" - > - </File> - <File - RelativePath=".\src\mpf_codec_manager.c" - > - </File> - <File - RelativePath=".\src\mpf_context.c" - > - </File> - <File - RelativePath=".\src\mpf_decoder.c" - > - </File> - <File - RelativePath=".\src\mpf_dtmf_detector.c" - > - </File> - <File - RelativePath=".\src\mpf_dtmf_generator.c" - > - </File> - <File - RelativePath=".\src\mpf_encoder.c" - > - </File> - <File - RelativePath=".\src\mpf_engine.c" - > - </File> - <File - RelativePath=".\src\mpf_engine_factory.c" - > - </File> - <File - RelativePath=".\src\mpf_file_termination_factory.c" - > - </File> - <File - RelativePath=".\src\mpf_frame_buffer.c" - > - </File> - <File - RelativePath=".\src\mpf_jitter_buffer.c" - > - </File> - <File - RelativePath=".\src\mpf_mixer.c" - > - </File> - <File - RelativePath=".\src\mpf_multiplier.c" - > - </File> - <File - RelativePath=".\src\mpf_named_event.c" - > - </File> - <File - RelativePath=".\src\mpf_resampler.c" - > - </File> - <File - RelativePath=".\src\mpf_rtp_attribs.c" - > - </File> - <File - RelativePath=".\src\mpf_rtp_stream.c" - > - </File> - <File - RelativePath=".\src\mpf_rtp_termination_factory.c" - > - </File> - <File - RelativePath=".\src\mpf_scheduler.c" - > - </File> - <File - RelativePath=".\src\mpf_stream.c" - > - </File> - <File - RelativePath=".\src\mpf_termination.c" - > - </File> - <File - RelativePath=".\src\mpf_termination_factory.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{B5A00BFA-6083-4FAE-A097-71642D6473B5}</ProjectGuid> - <RootNamespace>mpf</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="codecs\g711\g711.c" /> - <ClCompile Include="src\mpf_activity_detector.c" /> - <ClCompile Include="src\mpf_audio_file_stream.c" /> - <ClCompile Include="src\mpf_bridge.c" /> - <ClCompile Include="src\mpf_buffer.c" /> - <ClCompile Include="src\mpf_codec_descriptor.c" /> - <ClCompile Include="src\mpf_codec_g711.c" /> - <ClCompile Include="src\mpf_codec_linear.c" /> - <ClCompile Include="src\mpf_codec_manager.c" /> - <ClCompile Include="src\mpf_context.c" /> - <ClCompile Include="src\mpf_decoder.c" /> - <ClCompile Include="src\mpf_dtmf_detector.c" /> - <ClCompile Include="src\mpf_dtmf_generator.c" /> - <ClCompile Include="src\mpf_encoder.c" /> - <ClCompile Include="src\mpf_engine.c" /> - <ClCompile Include="src\mpf_engine_factory.c" /> - <ClCompile Include="src\mpf_file_termination_factory.c" /> - <ClCompile Include="src\mpf_frame_buffer.c" /> - <ClCompile Include="src\mpf_jitter_buffer.c" /> - <ClCompile Include="src\mpf_mixer.c" /> - <ClCompile Include="src\mpf_multiplier.c" /> - <ClCompile Include="src\mpf_named_event.c" /> - <ClCompile Include="src\mpf_resampler.c" /> - <ClCompile Include="src\mpf_rtp_attribs.c" /> - <ClCompile Include="src\mpf_rtp_stream.c" /> - <ClCompile Include="src\mpf_rtp_termination_factory.c" /> - <ClCompile Include="src\mpf_scheduler.c" /> - <ClCompile Include="src\mpf_stream.c" /> - <ClCompile Include="src\mpf_termination.c" /> - <ClCompile Include="src\mpf_termination_factory.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="codecs\g711\g711.h" /> - <ClInclude Include="include\mpf.h" /> - <ClInclude Include="include\mpf_activity_detector.h" /> - <ClInclude Include="include\mpf_audio_file_descriptor.h" /> - <ClInclude Include="include\mpf_audio_file_stream.h" /> - <ClInclude Include="include\mpf_bridge.h" /> - <ClInclude Include="include\mpf_buffer.h" /> - <ClInclude Include="include\mpf_codec.h" /> - <ClInclude Include="include\mpf_codec_descriptor.h" /> - <ClInclude Include="include\mpf_codec_manager.h" /> - <ClInclude Include="include\mpf_context.h" /> - <ClInclude Include="include\mpf_decoder.h" /> - <ClInclude Include="include\mpf_dtmf_detector.h" /> - <ClInclude Include="include\mpf_dtmf_generator.h" /> - <ClInclude Include="include\mpf_encoder.h" /> - <ClInclude Include="include\mpf_engine.h" /> - <ClInclude Include="include\mpf_engine_factory.h" /> - <ClInclude Include="include\mpf_file_termination_factory.h" /> - <ClInclude Include="include\mpf_frame.h" /> - <ClInclude Include="include\mpf_frame_buffer.h" /> - <ClInclude Include="include\mpf_jitter_buffer.h" /> - <ClInclude Include="include\mpf_message.h" /> - <ClInclude Include="include\mpf_mixer.h" /> - <ClInclude Include="include\mpf_multiplier.h" /> - <ClInclude Include="include\mpf_named_event.h" /> - <ClInclude Include="include\mpf_object.h" /> - <ClInclude Include="include\mpf_resampler.h" /> - <ClInclude Include="include\mpf_rtcp_packet.h" /> - <ClInclude Include="include\mpf_rtp_attribs.h" /> - <ClInclude Include="include\mpf_rtp_defs.h" /> - <ClInclude Include="include\mpf_rtp_descriptor.h" /> - <ClInclude Include="include\mpf_rtp_header.h" /> - <ClInclude Include="include\mpf_rtp_pt.h" /> - <ClInclude Include="include\mpf_rtp_stat.h" /> - <ClInclude Include="include\mpf_rtp_stream.h" /> - <ClInclude Include="include\mpf_rtp_termination_factory.h" /> - <ClInclude Include="include\mpf_scheduler.h" /> - <ClInclude Include="include\mpf_stream.h" /> - <ClInclude Include="include\mpf_stream_descriptor.h" /> - <ClInclude Include="include\mpf_termination.h" /> - <ClInclude Include="include\mpf_termination_factory.h" /> - <ClInclude Include="include\mpf_types.h" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\apr-toolkit\aprtoolkit.vcxproj"> - <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="codecs"> - <UniqueIdentifier>{33a3a10a-4697-4720-8c24-20340757326e}</UniqueIdentifier> - </Filter> - <Filter Include="codecs\g711"> - <UniqueIdentifier>{148f1b8f-859b-4dd9-96b0-0474d7bb875b}</UniqueIdentifier> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{35011b8a-6a42-4e9f-b55b-a84db1d929a8}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="codecs\g711\g711.c"> - <Filter>codecs\g711</Filter> - </ClCompile> - <ClCompile Include="src\mpf_activity_detector.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_audio_file_stream.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_bridge.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_buffer.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_codec_descriptor.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_codec_g711.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_codec_linear.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_codec_manager.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_context.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_decoder.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_dtmf_detector.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_dtmf_generator.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_encoder.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_engine.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_file_termination_factory.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_frame_buffer.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_jitter_buffer.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_mixer.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_multiplier.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_named_event.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_resampler.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_rtp_attribs.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_rtp_stream.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_rtp_termination_factory.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_scheduler.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_stream.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_termination.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_termination_factory.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_engine_factory.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="codecs\g711\g711.h"> - <Filter>codecs\g711</Filter> - </ClInclude> - <ClInclude Include="include\mpf.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_activity_detector.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_audio_file_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_audio_file_stream.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_bridge.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_buffer.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_codec.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_codec_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_codec_manager.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_context.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_decoder.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_dtmf_detector.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_dtmf_generator.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_encoder.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_file_termination_factory.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_frame.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_frame_buffer.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_jitter_buffer.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_message.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_mixer.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_multiplier.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_named_event.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_object.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_resampler.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtcp_packet.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_attribs.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_defs.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_header.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_pt.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_stat.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_stream.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_rtp_termination_factory.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_scheduler.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_stream.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_stream_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_termination.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_termination_factory.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mpf_engine_factory.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> -</Project> \ 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 <apr_ring.h> -#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; i<codec_list->descriptor_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; i<capabilities->attrib_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; i<codec_list->descriptor_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; i<codec_list1->descriptor_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; i<codec_list2->descriptor_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; i<frame_out->size; 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; i<frame_in->size; 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; i<frame_out->size; 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; i<frame_out->size; 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; i<frame_in->size; 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; i<frame_out->size; 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 <apr_want.h> -#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; i<samples; i++) { - buf_out[i] = htons(buf_in[i]); - } - - return TRUE; -} - -static apt_bool_t l16_decode(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; i<samples; i++) { - buf_out[i] = ntohs(buf_in[i]); - } - - return TRUE; -} - -static const mpf_codec_vtable_t l16_vtable = { - l16_open, - l16_close, - l16_encode, - l16_decode, - NULL, - NULL -}; - -static const mpf_codec_attribs_t l16_attribs = { - {L16_CODEC_NAME, L16_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 */ -}; - -mpf_codec_t* mpf_codec_l16_create(apr_pool_t *pool) -{ - return mpf_codec_create(&l16_vtable,&l16_attribs,NULL,pool); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_manager.c b/libs/unimrcp/libs/mpf/src/mpf_codec_manager.c deleted file mode 100644 index 38cd7c0e5c..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_codec_manager.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES 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.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include <stdlib.h> -#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; i<codec_manager->codec_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; i<codec_manager->codec_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; i<codec_manager->codec_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 <apr_ring.h> -#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; i<context->capacity; 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; j<context->capacity; 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; i<context->capacity; 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; i<context->capacity; 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; j<context->capacity && k<context->count; 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; i<context->capacity && k<context->count; 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; j<context->capacity; 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; i<context->capacity && k<context->count; 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; i<context->mpf_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; i<context->mpf_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; j<context->capacity; 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; j<context->capacity && k<header_item1->tx_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; i<context->capacity && k<header_item1->rx_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 <math.h> - -#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 <math.h> - -#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; i<request->count; 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 <apr_tables.h> -#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; i<mpf_factory->engines_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; i<buffer->frame_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; i<jb->frame_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; i<samples; i++) { - /* overflow MUST be considered */ - mix_buf[i] = mix_buf[i] + buf[i]; - } - mix_frame->type |= 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; i<mixer->source_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; i<mixer->source_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; i<mixer->source_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; i<source_count; i++) { - source = source_arr[i]; - if(!source) continue; - - if(mpf_audio_stream_rx_validate(source,NULL,NULL,pool) == FALSE) { - continue; - } - - 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 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; i<multiplier->sink_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; i<multiplier->sink_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; i<multiplier->sink_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; i<sink_count; i++) { - sink = sink_arr[i]; - if(!sink) continue; - - if(mpf_audio_stream_tx_validate(sink,NULL,NULL,pool) == FALSE) { - continue; - } - - 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 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 <apr_network_io.h> -#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 <apr_tables.h> -#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; i<rtp_termination_factory->media_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; i<rtp_termination_factory->media_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; i<rtp_termination_factory->media_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 <mmsystem.h> -#include <windows.h> - -#ifndef TIME_KILL_SYNCHRONOUS -#define TIME_KILL_SYNCHRONOUS 0x0100 -#endif - -#else -#include <apr_thread_proc.h> -#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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcpclient</ProjectName> - <ProjectGuid>{72782932-37CC-46AE-8C7F-9A7B1A6EE108}</ProjectGuid> - <RootNamespace>mrcpclient</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_application.h" /> - <ClInclude Include="include\mrcp_client.h" /> - <ClInclude Include="include\mrcp_client_session.h" /> - <ClInclude Include="include\mrcp_client_types.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_application.c" /> - <ClCompile Include="src\mrcp_client.c" /> - <ClCompile Include="src\mrcp_client_session.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcpclient" - ProjectGUID="{72782932-37CC-46AE-8C7F-9A7B1A6EE108}" - RootNamespace="mrcpclient" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mrcp_application.h" - > - </File> - <File - RelativePath=".\include\mrcp_client.h" - > - </File> - <File - RelativePath=".\include\mrcp_client_session.h" - > - </File> - <File - RelativePath=".\include\mrcp_client_types.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mrcp_application.c" - > - </File> - <File - RelativePath=".\src\mrcp_client.c" - > - </File> - <File - RelativePath=".\src\mrcp_client_session.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{72782932-37CC-46AE-8C7F-9A7B1A6EE108}</ProjectGuid> - <RootNamespace>mrcpclient</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_application.h" /> - <ClInclude Include="include\mrcp_client.h" /> - <ClInclude Include="include\mrcp_client_session.h" /> - <ClInclude Include="include\mrcp_client_types.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_application.c" /> - <ClCompile Include="src\mrcp_client.c" /> - <ClCompile Include="src\mrcp_client_session.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\mrcp-signaling\mrcpsignaling.vcxproj"> - <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\mrcpv2-transport\mrcpv2transport.vcxproj"> - <Project>{a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{dc4325fe-8e7a-4a40-ab63-4173d85cf131}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_application.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_client.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_client_session.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_client_types.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_application.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_client.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_client_session.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_thread_cond.h> -#include <apr_hash.h> -#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; i<session->channels->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; i<session->channels->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; i<session->terminations->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; i<session->channels->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; i<session->channels->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; i<session->channels->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; i<session->terminations->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; i<MRCP_RESOURCE_TYPE_COUNT; i++) { - resource = mrcp_resource_get(session->profile->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; i<mpf_message_container->count; 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; i<count; i++) { - /* get existing channel */ - channel = APR_ARRAY_IDX(session->channels,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; i<count; i++) { - mpf_rtp_media_descriptor_t *remote_media; - mpf_rtp_termination_descriptor_t *rtp_descriptor; - /* get existing termination */ - slot = &APR_ARRAY_IDX(session->terminations,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 <apr_tables.h> -#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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcpengine" - ProjectGUID="{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}" - RootNamespace="mrcpengine" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mrcp_engine_factory.h" - > - </File> - <File - RelativePath=".\include\mrcp_engine_iface.h" - > - </File> - <File - RelativePath=".\include\mrcp_engine_impl.h" - > - </File> - <File - RelativePath=".\include\mrcp_engine_loader.h" - > - </File> - <File - RelativePath=".\include\mrcp_engine_plugin.h" - > - </File> - <File - RelativePath=".\include\mrcp_engine_types.h" - > - </File> - <File - RelativePath=".\include\mrcp_recog_engine.h" - > - </File> - <File - RelativePath=".\include\mrcp_recog_state_machine.h" - > - </File> - <File - RelativePath=".\include\mrcp_recorder_engine.h" - > - </File> - <File - RelativePath=".\include\mrcp_recorder_state_machine.h" - > - </File> - <File - RelativePath=".\include\mrcp_resource_engine.h" - > - </File> - <File - RelativePath=".\include\mrcp_state_machine.h" - > - </File> - <File - RelativePath=".\include\mrcp_synth_engine.h" - > - </File> - <File - RelativePath=".\include\mrcp_synth_state_machine.h" - > - </File> - <File - RelativePath=".\include\mrcp_verifier_engine.h" - > - </File> - <File - RelativePath=".\include\mrcp_verifier_state_machine.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mrcp_engine_factory.c" - > - </File> - <File - RelativePath=".\src\mrcp_engine_iface.c" - > - </File> - <File - RelativePath=".\src\mrcp_engine_impl.c" - > - </File> - <File - RelativePath=".\src\mrcp_engine_loader.c" - > - </File> - <File - RelativePath=".\src\mrcp_recog_state_machine.c" - > - </File> - <File - RelativePath=".\src\mrcp_recorder_state_machine.c" - > - </File> - <File - RelativePath=".\src\mrcp_synth_state_machine.c" - > - </File> - <File - RelativePath=".\src\mrcp_verifier_state_machine.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}</ProjectGuid> - <RootNamespace>mrcpengine</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpengine.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpengine.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpengine.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpengine.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_engine_factory.h" /> - <ClInclude Include="include\mrcp_engine_iface.h" /> - <ClInclude Include="include\mrcp_engine_impl.h" /> - <ClInclude Include="include\mrcp_engine_loader.h" /> - <ClInclude Include="include\mrcp_engine_plugin.h" /> - <ClInclude Include="include\mrcp_engine_types.h" /> - <ClInclude Include="include\mrcp_recog_engine.h" /> - <ClInclude Include="include\mrcp_recog_state_machine.h" /> - <ClInclude Include="include\mrcp_recorder_engine.h" /> - <ClInclude Include="include\mrcp_recorder_state_machine.h" /> - <ClInclude Include="include\mrcp_resource_engine.h" /> - <ClInclude Include="include\mrcp_state_machine.h" /> - <ClInclude Include="include\mrcp_synth_engine.h" /> - <ClInclude Include="include\mrcp_synth_state_machine.h" /> - <ClInclude Include="include\mrcp_verifier_engine.h" /> - <ClInclude Include="include\mrcp_verifier_state_machine.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_engine_factory.c" /> - <ClCompile Include="src\mrcp_engine_iface.c" /> - <ClCompile Include="src\mrcp_engine_impl.c" /> - <ClCompile Include="src\mrcp_engine_loader.c" /> - <ClCompile Include="src\mrcp_recog_state_machine.c" /> - <ClCompile Include="src\mrcp_recorder_state_machine.c" /> - <ClCompile Include="src\mrcp_synth_state_machine.c" /> - <ClCompile Include="src\mrcp_verifier_state_machine.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\mpf\mpf.vcxproj"> - <Project>{b5a00bfa-6083-4fae-a097-71642d6473b5}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\mrcp\mrcp.vcxproj"> - <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{dd062ad2-9a06-4efc-8e17-328567b52854}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_engine_factory.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_engine_iface.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_engine_impl.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_engine_loader.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_engine_plugin.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_engine_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_recog_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_recog_state_machine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_recorder_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_recorder_state_machine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_resource_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_state_machine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_synth_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_synth_state_machine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_verifier_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_verifier_state_machine.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_engine_factory.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_engine_iface.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_engine_impl.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_engine_loader.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_recog_state_machine.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_recorder_state_machine.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_synth_state_machine.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_verifier_state_machine.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_hash.h> -#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 <apr_dso.h> -#include <apr_hash.h> -#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 <apr_hash.h> -#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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcpserver" - ProjectGUID="{18B1F35A-10F8-4287-9B37-2D10501B0B38}" - RootNamespace="mrcpserver" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mrcp_server.h" - > - </File> - <File - RelativePath=".\include\mrcp_server_session.h" - > - </File> - <File - RelativePath=".\include\mrcp_server_types.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mrcp_server.c" - > - </File> - <File - RelativePath=".\src\mrcp_server_session.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{18B1F35A-10F8-4287-9B37-2D10501B0B38}</ProjectGuid> - <RootNamespace>mrcpserver</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpserver.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_server.h" /> - <ClInclude Include="include\mrcp_server_session.h" /> - <ClInclude Include="include\mrcp_server_types.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_server.c" /> - <ClCompile Include="src\mrcp_server_session.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\mrcp-engine\mrcpengine.vcxproj"> - <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\mrcp-signaling\mrcpsignaling.vcxproj"> - <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\mrcpv2-transport\mrcpv2transport.vcxproj"> - <Project>{a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{4557fd27-79b0-442d-809b-82996c7da820}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_server.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_server_session.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_server_types.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_server.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_server_session.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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; i<MRCP_RESOURCE_TYPE_COUNT; i++) { - resource = mrcp_resource_get(server->resource_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; i<offer->control_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; i<offer->audio_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; i<offer->video_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; i<session->channels->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; i<session->terminations->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; i<session->channels->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; i<session->channels->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; i<count; i++) { - channel = APR_ARRAY_IDX(session->channels,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(; i<descriptor->control_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; i<session->channels->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; i<slot->channels->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; i<count; i++) { - /* get existing termination */ - slot = &APR_ARRAY_IDX(session->terminations,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(; i<descriptor->audio_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; i<session->channels->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; i<session->terminations->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; i<session->channels->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; i<session->channels->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; i<mpf_message_container->count; 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 <apr_network_io.h> -#include <apr_tables.h> -#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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{f3dc550f-1a0f-4b9e-b077-3b6940dc5531}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_session.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_session_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_sig_agent.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_sig_types.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_session_descriptor.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_sig_agent.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcpsignaling</ProjectName> - <ProjectGuid>{12A49562-BAB9-43A3-A21D-15B60BBB4C31}</ProjectGuid> - <RootNamespace>mrcpsignaling</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_session.h" /> - <ClInclude Include="include\mrcp_session_descriptor.h" /> - <ClInclude Include="include\mrcp_sig_agent.h" /> - <ClInclude Include="include\mrcp_sig_types.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_session_descriptor.c" /> - <ClCompile Include="src\mrcp_sig_agent.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcpsignaling" - ProjectGUID="{12A49562-BAB9-43A3-A21D-15B60BBB4C31}" - RootNamespace="mrcpsignaling" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mrcp_session.h" - > - </File> - <File - RelativePath=".\include\mrcp_session_descriptor.h" - > - </File> - <File - RelativePath=".\include\mrcp_sig_agent.h" - > - </File> - <File - RelativePath=".\include\mrcp_sig_types.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mrcp_session_descriptor.c" - > - </File> - <File - RelativePath=".\src\mrcp_sig_agent.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{12A49562-BAB9-43A3-A21D-15B60BBB4C31}</ProjectGuid> - <RootNamespace>mrcpsignaling</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_session.h" /> - <ClInclude Include="include\mrcp_session_descriptor.h" /> - <ClInclude Include="include\mrcp_sig_agent.h" /> - <ClInclude Include="include\mrcp_sig_types.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_session_descriptor.c" /> - <ClCompile Include="src\mrcp_sig_agent.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\mpf\mpf.vcxproj"> - <Project>{b5a00bfa-6083-4fae-a097-71642d6473b5}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\mrcp\mrcp.vcxproj"> - <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{38ec7b90-673c-4c54-9c3a-13d5270556a0}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_session.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_session_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_sig_agent.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_sig_types.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_session_descriptor.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_sig_agent.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_hash.h> -#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; i<resource_count; i++) { - resource_factory->resource_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; id<MRCP_RESOURCE_TYPE_COUNT; id++) { - mrcp_resource_load_by_id(loader,id); - } - return TRUE; -} - -/** Load MRCP resource by resource name */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_load(mrcp_resource_loader_t *loader, const apt_str_t *name) -{ - mrcp_resource_id id = apt_string_table_id_find( - mrcp_resource_string_table, - MRCP_RESOURCE_TYPE_COUNT, - name); - - mrcp_resource_t *resource = mrcp_resource_create_by_id(id,loader->pool); - 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 <apt.h> -#include <apt_dir_layout.h> - -/** 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; i<request_id_list->count; 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; i<request_id_list->count; 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 <stdlib.h> -#include <stdio.h> -#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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="message"> - <UniqueIdentifier>{19ad4bde-c4f4-4937-9073-ca2780341d76}</UniqueIdentifier> - </Filter> - <Filter Include="message\include"> - <UniqueIdentifier>{8ec996ac-8a0a-4bf0-9b3c-535616585109}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="message\src"> - <UniqueIdentifier>{5ba77874-7c17-4748-b5ba-b07b7f0a2169}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="control"> - <UniqueIdentifier>{f30fd049-a10d-4aea-b4bb-3eb674690fdd}</UniqueIdentifier> - </Filter> - <Filter Include="control\include"> - <UniqueIdentifier>{7e71717b-6f22-4c59-ba50-7b5a15516b2f}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="control\src"> - <UniqueIdentifier>{c66dbb84-ce9d-4408-b54d-4d0ec51069fb}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="resources"> - <UniqueIdentifier>{f20cfd62-4bb9-42de-bf1c-d578c8cd1a18}</UniqueIdentifier> - </Filter> - <Filter Include="resources\include"> - <UniqueIdentifier>{039a4834-7ddb-40e7-9177-55d11ef1e733}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="resources\src"> - <UniqueIdentifier>{dc087d31-8ecf-473c-baa1-f3091e16014d}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_generic_header.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_header_accessor.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_message.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_start_line.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="control\include\mrcp_resource.h"> - <Filter>control\include</Filter> - </ClInclude> - <ClInclude Include="control\include\mrcp_resource_factory.h"> - <Filter>control\include</Filter> - </ClInclude> - <ClInclude Include="control\include\mrcp_resource_loader.h"> - <Filter>control\include</Filter> - </ClInclude> - <ClInclude Include="control\include\mrcp_stream.h"> - <Filter>control\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_recog_header.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_recog_resource.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_recorder_header.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_recorder_resource.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_synth_header.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_synth_resource.h"> - <Filter>resources\include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="message\src\mrcp_generic_header.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="message\src\mrcp_header_accessor.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="message\src\mrcp_message.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="message\src\mrcp_start_line.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="control\src\mrcp_resource_factory.c"> - <Filter>control\src</Filter> - </ClCompile> - <ClCompile Include="control\src\mrcp_resource_loader.c"> - <Filter>control\src</Filter> - </ClCompile> - <ClCompile Include="control\src\mrcp_stream.c"> - <Filter>control\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_recog_header.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_recog_resource.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_recorder_header.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_recorder_resource.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_synth_header.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_synth_resource.c"> - <Filter>resources\src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcp</ProjectName> - <ProjectGuid>{1C320193-46A6-4B34-9C56-8AB584FC1B56}</ProjectGuid> - <RootNamespace>mrcp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp.h" /> - <ClInclude Include="include\mrcp_types.h" /> - <ClInclude Include="message\include\mrcp_generic_header.h" /> - <ClInclude Include="message\include\mrcp__header.h" /> - <ClInclude Include="message\include\mrcp_header_accessor.h" /> - <ClInclude Include="message\include\mrcp_message.h" /> - <ClInclude Include="message\include\mrcp_start_line.h" /> - <ClInclude Include="control\include\mrcp_resource.h" /> - <ClInclude Include="control\include\mrcp_resource_factory.h" /> - <ClInclude Include="control\include\mrcp_resource_loader.h" /> - <ClInclude Include="control\include\mrcp_stream.h" /> - <ClInclude Include="resources\include\mrcp_recog_header.h" /> - <ClInclude Include="resources\include\mrcp_recog_resource.h" /> - <ClInclude Include="resources\include\mrcp_recorder_header.h" /> - <ClInclude Include="resources\include\mrcp_recorder_resource.h" /> - <ClInclude Include="resources\include\mrcp_synth_header.h" /> - <ClInclude Include="resources\include\mrcp_synth_resource.h" /> - <ClInclude Include="resources\include\mrcp_verifier_header.h" /> - <ClInclude Include="resources\include\mrcp_verifier_resource.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="message\src\mrcp_generic_header.c" /> - <ClCompile Include="message\src\mrcp_header.c" /> - <ClCompile Include="message\src\mrcp_header_accessor.c" /> - <ClCompile Include="message\src\mrcp_message.c" /> - <ClCompile Include="message\src\mrcp_start_line.c" /> - <ClCompile Include="control\src\mrcp_resource_factory.c" /> - <ClCompile Include="control\src\mrcp_resource_loader.c" /> - <ClCompile Include="control\src\mrcp_stream.c" /> - <ClCompile Include="resources\src\mrcp_recog_header.c" /> - <ClCompile Include="resources\src\mrcp_recog_resource.c" /> - <ClCompile Include="resources\src\mrcp_recorder_header.c" /> - <ClCompile Include="resources\src\mrcp_recorder_resource.c" /> - <ClCompile Include="resources\src\mrcp_synth_header.c" /> - <ClCompile Include="resources\src\mrcp_synth_resource.c" /> - <ClCompile Include="resources\src\mrcp_verifier_header.c" /> - <ClCompile Include="resources\src\mrcp_verifier_resource.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcp" - ProjectGUID="{1C320193-46A6-4B34-9C56-8AB584FC1B56}" - RootNamespace="mrcp" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mrcp.h" - > - </File> - <File - RelativePath=".\include\mrcp_types.h" - > - </File> - </Filter> - <Filter - Name="message" - > - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - > - <File - RelativePath=".\message\include\mrcp_generic_header.h" - > - </File> - <File - RelativePath=".\message\include\mrcp_header.h" - > - </File> - <File - RelativePath=".\message\include\mrcp_header_accessor.h" - > - </File> - <File - RelativePath=".\message\include\mrcp_message.h" - > - </File> - <File - RelativePath=".\message\include\mrcp_start_line.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\message\src\mrcp_generic_header.c" - > - </File> - <File - RelativePath=".\message\src\mrcp_header.c" - > - </File> - <File - RelativePath=".\message\src\mrcp_header_accessor.c" - > - </File> - <File - RelativePath=".\message\src\mrcp_message.c" - > - </File> - <File - RelativePath=".\message\src\mrcp_start_line.c" - > - </File> - </Filter> - </Filter> - <Filter - Name="control" - > - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - > - <File - RelativePath=".\control\include\mrcp_resource.h" - > - </File> - <File - RelativePath=".\control\include\mrcp_resource_factory.h" - > - </File> - <File - RelativePath=".\control\include\mrcp_resource_loader.h" - > - </File> - <File - RelativePath=".\control\include\mrcp_stream.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\control\src\mrcp_resource_factory.c" - > - </File> - <File - RelativePath=".\control\src\mrcp_resource_loader.c" - > - </File> - <File - RelativePath=".\control\src\mrcp_stream.c" - > - </File> - </Filter> - </Filter> - <Filter - Name="resources" - > - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - > - <File - RelativePath=".\resources\include\mrcp_recog_header.h" - > - </File> - <File - RelativePath=".\resources\include\mrcp_recog_resource.h" - > - </File> - <File - RelativePath=".\resources\include\mrcp_recorder_header.h" - > - </File> - <File - RelativePath=".\resources\include\mrcp_recorder_resource.h" - > - </File> - <File - RelativePath=".\resources\include\mrcp_synth_header.h" - > - </File> - <File - RelativePath=".\resources\include\mrcp_synth_resource.h" - > - </File> - <File - RelativePath=".\resources\include\mrcp_verifier_header.h" - > - </File> - <File - RelativePath=".\resources\include\mrcp_verifier_resource.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\resources\src\mrcp_recog_header.c" - > - </File> - <File - RelativePath=".\resources\src\mrcp_recog_resource.c" - > - </File> - <File - RelativePath=".\resources\src\mrcp_recorder_header.c" - > - </File> - <File - RelativePath=".\resources\src\mrcp_recorder_resource.c" - > - </File> - <File - RelativePath=".\resources\src\mrcp_synth_header.c" - > - </File> - <File - RelativePath=".\resources\src\mrcp_synth_resource.c" - > - </File> - <File - RelativePath=".\resources\src\mrcp_verifier_header.c" - > - </File> - <File - RelativePath=".\resources\src\mrcp_verifier_resource.c" - > - </File> - </Filter> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{1C320193-46A6-4B34-9C56-8AB584FC1B56}</ProjectGuid> - <RootNamespace>mrcp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp.h" /> - <ClInclude Include="include\mrcp_types.h" /> - <ClInclude Include="message\include\mrcp_generic_header.h" /> - <ClInclude Include="message\include\mrcp_header.h" /> - <ClInclude Include="message\include\mrcp_header_accessor.h" /> - <ClInclude Include="message\include\mrcp_message.h" /> - <ClInclude Include="message\include\mrcp_start_line.h" /> - <ClInclude Include="control\include\mrcp_resource.h" /> - <ClInclude Include="control\include\mrcp_resource_factory.h" /> - <ClInclude Include="control\include\mrcp_resource_loader.h" /> - <ClInclude Include="control\include\mrcp_stream.h" /> - <ClInclude Include="resources\include\mrcp_recog_header.h" /> - <ClInclude Include="resources\include\mrcp_recog_resource.h" /> - <ClInclude Include="resources\include\mrcp_recorder_header.h" /> - <ClInclude Include="resources\include\mrcp_recorder_resource.h" /> - <ClInclude Include="resources\include\mrcp_synth_header.h" /> - <ClInclude Include="resources\include\mrcp_synth_resource.h" /> - <ClInclude Include="resources\include\mrcp_verifier_header.h" /> - <ClInclude Include="resources\include\mrcp_verifier_resource.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="message\src\mrcp_generic_header.c" /> - <ClCompile Include="message\src\mrcp_header.c" /> - <ClCompile Include="message\src\mrcp_header_accessor.c" /> - <ClCompile Include="message\src\mrcp_message.c" /> - <ClCompile Include="message\src\mrcp_start_line.c" /> - <ClCompile Include="control\src\mrcp_resource_factory.c" /> - <ClCompile Include="control\src\mrcp_resource_loader.c" /> - <ClCompile Include="control\src\mrcp_stream.c" /> - <ClCompile Include="resources\src\mrcp_recog_header.c" /> - <ClCompile Include="resources\src\mrcp_recog_resource.c" /> - <ClCompile Include="resources\src\mrcp_recorder_header.c" /> - <ClCompile Include="resources\src\mrcp_recorder_resource.c" /> - <ClCompile Include="resources\src\mrcp_synth_header.c" /> - <ClCompile Include="resources\src\mrcp_synth_resource.c" /> - <ClCompile Include="resources\src\mrcp_verifier_header.c" /> - <ClCompile Include="resources\src\mrcp_verifier_resource.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="message"> - <UniqueIdentifier>{235b9544-2004-49c6-96de-a5830544296e}</UniqueIdentifier> - </Filter> - <Filter Include="message\include"> - <UniqueIdentifier>{64717899-118b-46de-8646-d7312b19ce00}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="message\src"> - <UniqueIdentifier>{1b656d42-e8f0-4126-85da-9bb8a470cfaa}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="control"> - <UniqueIdentifier>{39545f85-6811-4878-af3f-26d813012ea3}</UniqueIdentifier> - </Filter> - <Filter Include="control\include"> - <UniqueIdentifier>{e165b2a9-81db-4030-9e72-7189ee45182b}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="control\src"> - <UniqueIdentifier>{a4e3b1a7-762d-4fcf-83e8-f52675aab2ff}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="resources"> - <UniqueIdentifier>{35e8458d-fc25-4066-b4be-ab452a6da8a9}</UniqueIdentifier> - </Filter> - <Filter Include="resources\include"> - <UniqueIdentifier>{8bbdedd2-2c1e-4474-8dbb-fcecf1f9a869}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="resources\src"> - <UniqueIdentifier>{1d167695-a5d2-4f87-8bd3-ea21cea5a368}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_generic_header.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_header.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_header_accessor.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_message.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="message\include\mrcp_start_line.h"> - <Filter>message\include</Filter> - </ClInclude> - <ClInclude Include="control\include\mrcp_resource.h"> - <Filter>control\include</Filter> - </ClInclude> - <ClInclude Include="control\include\mrcp_resource_factory.h"> - <Filter>control\include</Filter> - </ClInclude> - <ClInclude Include="control\include\mrcp_resource_loader.h"> - <Filter>control\include</Filter> - </ClInclude> - <ClInclude Include="control\include\mrcp_stream.h"> - <Filter>control\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_recog_header.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_recog_resource.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_recorder_header.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_recorder_resource.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_synth_header.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_synth_resource.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_verifier_header.h"> - <Filter>resources\include</Filter> - </ClInclude> - <ClInclude Include="resources\include\mrcp_verifier_resource.h"> - <Filter>resources\include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="message\src\mrcp_generic_header.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="message\src\mrcp_header.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="message\src\mrcp_header_accessor.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="message\src\mrcp_message.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="message\src\mrcp_start_line.c"> - <Filter>message\src</Filter> - </ClCompile> - <ClCompile Include="control\src\mrcp_resource_factory.c"> - <Filter>control\src</Filter> - </ClCompile> - <ClCompile Include="control\src\mrcp_resource_loader.c"> - <Filter>control\src</Filter> - </ClCompile> - <ClCompile Include="control\src\mrcp_stream.c"> - <Filter>control\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_recog_header.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_recog_resource.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_recorder_header.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_recorder_resource.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_synth_header.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_synth_resource.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_verifier_header.c"> - <Filter>resources\src</Filter> - </ClCompile> - <ClCompile Include="resources\src\mrcp_verifier_resource.c"> - <Filter>resources\src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_poll.h> -#include <apr_hash.h> -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include <apr_ring.h> -#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 <apr_network_io.h> -#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 <apr_tables.h> -#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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{a92d3b8c-d54d-416c-b458-dc57ac24d2e9}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_client_connection.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_connection.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_connection_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_control_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_server_connection.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_client_connection.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_connection.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_control_descriptor.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_server_connection.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_ca_factory.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcpv2transport</ProjectName> - <ProjectGuid>{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}</ProjectGuid> - <RootNamespace>mrcpv2transport</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_client_connection.h" /> - <ClInclude Include="include\mrcp_connection.h" /> - <ClInclude Include="include\mrcp_connection_types.h" /> - <ClInclude Include="include\mrcp_control_descriptor.h" /> - <ClInclude Include="include\mrcp_server_connection.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_ca_factory.c" /> - <ClCompile Include="src\mrcp_client_connection.c" /> - <ClCompile Include="src\mrcp_connection.c" /> - <ClCompile Include="src\mrcp_control_descriptor.c" /> - <ClCompile Include="src\mrcp_server_connection.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcpv2transport" - ProjectGUID="{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}" - RootNamespace="mrcpv2transport" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mrcp_ca_factory.h" - > - </File> - <File - RelativePath=".\include\mrcp_client_connection.h" - > - </File> - <File - RelativePath=".\include\mrcp_connection.h" - > - </File> - <File - RelativePath=".\include\mrcp_connection_types.h" - > - </File> - <File - RelativePath=".\include\mrcp_control_descriptor.h" - > - </File> - <File - RelativePath=".\include\mrcp_server_connection.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mrcp_ca_factory.c" - > - </File> - <File - RelativePath=".\src\mrcp_client_connection.c" - > - </File> - <File - RelativePath=".\src\mrcp_connection.c" - > - </File> - <File - RelativePath=".\src\mrcp_control_descriptor.c" - > - </File> - <File - RelativePath=".\src\mrcp_server_connection.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}</ProjectGuid> - <RootNamespace>mrcpv2transport</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_ca_factory.h" /> - <ClInclude Include="include\mrcp_client_connection.h" /> - <ClInclude Include="include\mrcp_connection.h" /> - <ClInclude Include="include\mrcp_connection_types.h" /> - <ClInclude Include="include\mrcp_control_descriptor.h" /> - <ClInclude Include="include\mrcp_server_connection.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_ca_factory.c" /> - <ClCompile Include="src\mrcp_client_connection.c" /> - <ClCompile Include="src\mrcp_connection.c" /> - <ClCompile Include="src\mrcp_control_descriptor.c" /> - <ClCompile Include="src\mrcp_server_connection.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\mrcp\mrcp.vcxproj"> - <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{119450fa-653a-4fdc-9017-a4350ff3066c}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_client_connection.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_connection.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_connection_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_control_descriptor.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_server_connection.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_ca_factory.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_client_connection.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_connection.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_control_descriptor.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_server_connection.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_ca_factory.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_tables.h> -#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; i<cmid_arr->nelts; 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 <apt.h> -#include <apr_network_io.h> - -/** 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 <apr_ring.h> -#include <apr_hash.h> -#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 <apr_ring.h> -#include <apr_hash.h> -#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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{fd4564ef-9f34-4f23-992d-37f127e289a2}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\rtsp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_client.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_header.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_message.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_server.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_start_line.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_stream.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\rtsp_client.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_header.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_message.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_server.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_start_line.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_stream.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>unirtsp</ProjectName> - <ProjectGuid>{504B3154-7A4F-459D-9877-B951021C3F1F}</ProjectGuid> - <RootNamespace>unirtsp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\rtsp.h" /> - <ClInclude Include="include\rtsp_client.h" /> - <ClInclude Include="include\rtsp_header.h" /> - <ClInclude Include="include\rtsp_message.h" /> - <ClInclude Include="include\rtsp_server.h" /> - <ClInclude Include="include\rtsp_start_line.h" /> - <ClInclude Include="include\rtsp_stream.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\rtsp_client.c" /> - <ClCompile Include="src\rtsp_header.c" /> - <ClCompile Include="src\rtsp_message.c" /> - <ClCompile Include="src\rtsp_server.c" /> - <ClCompile Include="src\rtsp_start_line.c" /> - <ClCompile Include="src\rtsp_stream.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="unirtsp" - ProjectGUID="{504B3154-7A4F-459D-9877-B951021C3F1F}" - RootNamespace="unirtsp" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\rtsp.h" - > - </File> - <File - RelativePath=".\include\rtsp_client.h" - > - </File> - <File - RelativePath=".\include\rtsp_header.h" - > - </File> - <File - RelativePath=".\include\rtsp_message.h" - > - </File> - <File - RelativePath=".\include\rtsp_server.h" - > - </File> - <File - RelativePath=".\include\rtsp_start_line.h" - > - </File> - <File - RelativePath=".\include\rtsp_stream.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\rtsp_client.c" - > - </File> - <File - RelativePath=".\src\rtsp_header.c" - > - </File> - <File - RelativePath=".\src\rtsp_message.c" - > - </File> - <File - RelativePath=".\src\rtsp_server.c" - > - </File> - <File - RelativePath=".\src\rtsp_start_line.c" - > - </File> - <File - RelativePath=".\src\rtsp_stream.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{504B3154-7A4F-459D-9877-B951021C3F1F}</ProjectGuid> - <RootNamespace>unirtsp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\rtsp.h" /> - <ClInclude Include="include\rtsp_client.h" /> - <ClInclude Include="include\rtsp_header.h" /> - <ClInclude Include="include\rtsp_message.h" /> - <ClInclude Include="include\rtsp_server.h" /> - <ClInclude Include="include\rtsp_start_line.h" /> - <ClInclude Include="include\rtsp_stream.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\rtsp_client.c" /> - <ClCompile Include="src\rtsp_header.c" /> - <ClCompile Include="src\rtsp_message.c" /> - <ClCompile Include="src\rtsp_server.c" /> - <ClCompile Include="src\rtsp_start_line.c" /> - <ClCompile Include="src\rtsp_stream.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\apr-toolkit\aprtoolkit.vcxproj"> - <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{8ffd50c3-3b28-438d-a305-071644d5f115}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\rtsp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_client.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_header.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_message.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_server.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_start_line.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\rtsp_stream.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\rtsp_client.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_header.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_message.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_server.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_start_line.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\rtsp_stream.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_network_io.h> -#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 <apr_network_io.h> -#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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{6e92b598-880e-4fe5-88fb-f69df8e06a57}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_sdp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_sofiasip_client_agent.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_sofiasip_server_agent.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_sdp.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_sofiasip_client_agent.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_sofiasip_server_agent.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_sofiasip_logger.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcpsofiasip</ProjectName> - <ProjectGuid>{746F3632-5BB2-4570-9453-31D6D58A7D8E}</ProjectGuid> - <RootNamespace>mrcpsofiasip</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_sdp.h" /> - <ClInclude Include="include\mrcp_sofiasip_client_agent.h" /> - <ClInclude Include="include\mrcp_sofiasip_server_agent.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_sdp.c" /> - <ClCompile Include="src\mrcp_sofiasip_client_agent.c" /> - <ClCompile Include="src\mrcp_sofiasip_logger.c" /> - <ClCompile Include="src\mrcp_sofiasip_server_agent.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\sofia\libsofia_sip_ua_static.2017.vcxproj"> - <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcpsofiasip" - ProjectGUID="{746F3632-5BB2-4570-9453-31D6D58A7D8E}" - RootNamespace="mrcpsofiasip" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mrcp_sdp.h" - > - </File> - <File - RelativePath=".\include\mrcp_sofiasip_client_agent.h" - > - </File> - <File - RelativePath=".\include\mrcp_sofiasip_server_agent.h" - > - </File> - <File - RelativePath=".\include\mrcp_sofiasip_log.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mrcp_sdp.c" - > - </File> - <File - RelativePath=".\src\mrcp_sofiasip_client_agent.c" - > - </File> - <File - RelativePath=".\src\mrcp_sofiasip_logger.c" - > - </File> - <File - RelativePath=".\src\mrcp_sofiasip_server_agent.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{746F3632-5BB2-4570-9453-31D6D58A7D8E}</ProjectGuid> - <RootNamespace>mrcpsofiasip</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_sdp.h" /> - <ClInclude Include="include\mrcp_sofiasip_client_agent.h" /> - <ClInclude Include="include\mrcp_sofiasip_server_agent.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_sdp.c" /> - <ClCompile Include="src\mrcp_sofiasip_client_agent.c" /> - <ClCompile Include="src\mrcp_sofiasip_logger.c" /> - <ClCompile Include="src\mrcp_sofiasip_server_agent.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp-signaling\mrcpsignaling.vcxproj"> - <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\libs\mrcpv2-transport\mrcpv2transport.vcxproj"> - <Project>{a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{5256b9c6-18be-48fc-aaa3-8e2c17df7f8d}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_sdp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_sofiasip_client_agent.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_sofiasip_server_agent.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_sdp.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_sofiasip_client_agent.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_sofiasip_server_agent.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_sofiasip_logger.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <stdlib.h> -#include <apr_general.h> -#include <sofia-sip/sdp.h> -#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; i<count; i++) { - audio_media = mrcp_session_audio_media_get(descriptor,audio_index); - if(audio_media && audio_media->id == 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; i<descriptor_arr->nelts; 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; i<descriptor_arr->nelts; 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; i<control_media->cmid_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 <sofia-sip/su.h> -#include <sofia-sip/nua.h> -#include <sofia-sip/sip_status.h> -#include <sofia-sip/sip_header.h> -#include <sofia-sip/sdp.h> -#include <sofia-sip/tport.h> -#include <sofia-sip/sofia_features.h> -#undef strcasecmp -#undef strncasecmp -#include <apr_general.h> - -#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 <stdlib.h> -#include <apr_general.h> -#include <sofia-sip/su_log.h> -#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 <sofia-sip/su.h> -#include <sofia-sip/nua.h> -#include <sofia-sip/sip_status.h> -#include <sofia-sip/sdp.h> -#include <sofia-sip/tport.h> -#include <sofia-sip/sofia_features.h> -#undef strcasecmp -#undef strncasecmp -#include <apr_general.h> - -#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 <apr_network_io.h> -#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 <apr_network_io.h> -#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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{f87f8ada-12d1-412b-bd14-7e62df3f92a0}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_unirtsp_client_agent.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_unirtsp_sdp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_unirtsp_server_agent.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_unirtsp_client_agent.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_unirtsp_sdp.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_unirtsp_server_agent.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mrcpunirtsp</ProjectName> - <ProjectGuid>{DEB01ACB-D65F-4A62-AED9-58C1054499E9}</ProjectGuid> - <RootNamespace>mrcpunirtsp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DisableSpecificWarnings>4456;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <DisableSpecificWarnings>4456;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DisableSpecificWarnings>4456;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DisableSpecificWarnings>4456;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_unirtsp_client_agent.h" /> - <ClInclude Include="include\mrcp_unirtsp_sdp.h" /> - <ClInclude Include="include\mrcp_unirtsp_server_agent.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_unirtsp_client_agent.c" /> - <ClCompile Include="src\mrcp_unirtsp_sdp.c" /> - <ClCompile Include="src\mrcp_unirtsp_server_agent.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\sofia\libsofia_sip_ua_static.2017.vcxproj"> - <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcpunirtsp" - ProjectGUID="{DEB01ACB-D65F-4A62-AED9-58C1054499E9}" - RootNamespace="mrcpunirtsp" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\mrcp_unirtsp_client_agent.h" - > - </File> - <File - RelativePath=".\include\mrcp_unirtsp_sdp.h" - > - </File> - <File - RelativePath=".\include\mrcp_unirtsp_server_agent.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mrcp_unirtsp_client_agent.c" - > - </File> - <File - RelativePath=".\src\mrcp_unirtsp_sdp.c" - > - </File> - <File - RelativePath=".\src\mrcp_unirtsp_server_agent.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{DEB01ACB-D65F-4A62-AED9-58C1054499E9}</ProjectGuid> - <RootNamespace>mrcpunirtsp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_unirtsp_client_agent.h" /> - <ClInclude Include="include\mrcp_unirtsp_sdp.h" /> - <ClInclude Include="include\mrcp_unirtsp_server_agent.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_unirtsp_client_agent.c" /> - <ClCompile Include="src\mrcp_unirtsp_sdp.c" /> - <ClCompile Include="src\mrcp_unirtsp_server_agent.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp-signaling\mrcpsignaling.vcxproj"> - <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\libs\uni-rtsp\unirtsp.vcxproj"> - <Project>{504b3154-7a4f-459d-9877-b951021c3f1f}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{1ae8fa5f-5d29-4bd7-a332-b2e917a801ca}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\mrcp_unirtsp_client_agent.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_unirtsp_sdp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\mrcp_unirtsp_server_agent.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_unirtsp_client_agent.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_unirtsp_sdp.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mrcp_unirtsp_server_agent.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_general.h> -#include <sofia-sip/sdp.h> - -#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 <stdlib.h> -#include <apr_general.h> -#include <sofia-sip/sdp.h> -#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; i<descriptor_arr->nelts; 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; i<descriptor_arr->nelts; 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; i<count; i++) { - audio_media = mrcp_session_audio_media_get(descriptor,audio_index); - if(audio_media && audio_media->id == 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; i<count; i++) { - audio_media = mrcp_session_audio_media_get(descriptor,audio_index); - if(audio_media && audio_media->id == 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; i<header->nelts; 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 <apr_general.h> -#include <sofia-sip/sdp.h> - -#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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="asrclient" - ProjectGUID="{6B83AC6D-01CE-4E1C-81CE-02AD8116C684}" - RootNamespace="asrclient" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include;&quot;..\libasr-client\include&quot;" - RuntimeLibrary="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libasrclient.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include;&quot;..\libasr-client\include&quot;" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libasrclient.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include;&quot;..\libasr-client\include&quot;" - RuntimeLibrary="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libasrclient.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include;&quot;..\libasr-client\include&quot;" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libasrclient.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\main.c" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{6B83AC6D-01CE-4E1C-81CE-02AD8116C684}</ProjectGuid> - <RootNamespace>asrclient</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;..\libasr-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - </ClCompile> - <Link> - <AdditionalDependencies>libasrclient.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;..\libasr-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <AdditionalDependencies>libasrclient.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;..\libasr-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>libasrclient.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;..\libasr-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <AdditionalDependencies>libasrclient.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\main.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\libasr-client\libasrclient.vcxproj"> - <Project>{272fafa8-2b2f-4716-b95f-3b37cf2e0cb3}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\main.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <stdio.h> -#include <stdlib.h> -#include <apr_getopt.h> -#include <apr_file_info.h> -#include <apr_thread_proc.h> -#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(&params->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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="libasrclient" - ProjectGUID="{272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}" - RootNamespace="libasrclient" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - PreprocessorDefinitions="ASR_CLIENT_LIB_EXPORT" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - PreprocessorDefinitions="ASR_CLIENT_LIB_EXPORT" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - PreprocessorDefinitions="ASR_CLIENT_LIB_EXPORT" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - PreprocessorDefinitions="ASR_CLIENT_LIB_EXPORT" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\asr_engine.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\asr_engine.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}</ProjectGuid> - <RootNamespace>libasrclient</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="include\asr_engine.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\asr_engine.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\libunimrcp-client\libunimrcpclient.vcxproj"> - <Project>{ee157390-1e85-416c-946e-620e32c9ad33}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{21e6c16e-f977-468a-9576-0c5981eb7da5}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\asr_engine.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\asr_engine.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <stdlib.h> - -/* APR includes */ -#include <apr_thread_cond.h> -#include <apr_thread_proc.h> - -/* 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 <mpf_frame_buffer.h> -/* 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="libunimrcpclient" - ProjectGUID="{EE157390-1E85-416C-946E-620E32C9AD33}" - RootNamespace="libunimrcpclient" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="..\..\build\uni_revision.h" - > - </File> - <File - RelativePath="..\..\build\uni_version.h" - > - </File> - <File - RelativePath=".\include\unimrcp_client.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\unimrcp_client.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{EE157390-1E85-416C-946E-620E32C9AD33}</ProjectGuid> - <RootNamespace>libunimrcpclient</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\..\build\uni_revision.h" /> - <ClInclude Include="..\..\build\uni_version.h" /> - <ClInclude Include="include\unimrcp_client.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\unimrcp_client.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp-client\mrcpclient.vcxproj"> - <Project>{72782932-37cc-46ae-8c7f-9a7b1a6ee108}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\modules\mrcp-sofiasip\mrcpsofiasip.vcxproj"> - <Project>{746f3632-5bb2-4570-9453-31d6d58a7d8e}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\modules\mrcp-unirtsp\mrcpunirtsp.vcxproj"> - <Project>{deb01acb-d65f-4a62-aed9-58c1054499e9}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{15d2ec58-ba87-4dd8-9f7a-434f9e186e4e}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\build\uni_revision.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\build\uni_version.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\unimrcp_client.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\unimrcp_client.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <stdlib.h> -#include <apr_xml.h> -#include <apr_fnmatch.h> -#include <apr_version.h> -#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 <id> 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 <id> 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="libunimrcpserver" - ProjectGUID="{C98AF157-352E-4737-BD30-A24E2647F5AE}" - RootNamespace="libunimrcpserver" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="4" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="&quot;$(ProjectRootDir)modules\mrcp-sofiasip\include&quot;;&quot;$(ProjectRootDir)modules\mrcp-unirtsp\include&quot;" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="..\..\build\uni_revision.h" - > - </File> - <File - RelativePath="..\..\build\uni_version.h" - > - </File> - <File - RelativePath=".\include\unimrcp_server.h" - > - </File> - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\unimrcp_server.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{C98AF157-352E-4737-BD30-A24E2647F5AE}</ProjectGuid> - <RootNamespace>libunimrcpserver</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\..\build\uni_revision.h" /> - <ClInclude Include="..\..\build\uni_version.h" /> - <ClInclude Include="include\unimrcp_server.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\unimrcp_server.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp-server\mrcpserver.vcxproj"> - <Project>{18b1f35a-10f8-4287-9b37-2d10501b0b38}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\modules\mrcp-sofiasip\mrcpsofiasip.vcxproj"> - <Project>{746f3632-5bb2-4570-9453-31d6d58a7d8e}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\modules\mrcp-unirtsp\mrcpunirtsp.vcxproj"> - <Project>{deb01acb-d65f-4a62-aed9-58c1054499e9}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{c164436d-b3de-474f-99bc-6b2ca1a4c879}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\build\uni_revision.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\build\uni_version.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\unimrcp_server.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\unimrcp_server.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <stdlib.h> -#include <apr_xml.h> -#include <apr_version.h> -#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 <id> 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 <apr_tables.h> -#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 <apr_xml.h> -#include <apr_hash.h> -#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 <apr_xml.h> -#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 <stdlib.h> -#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 <stdlib.h> -#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 <stdlib.h> -#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 <stdlib.h> -#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 <stdio.h> -#include <stdlib.h> -#include <apr_getopt.h> -#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 <stdlib.h> -#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; i<m_pCapabilities->attrib_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 <stdlib.h> -#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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="umc" - ProjectGUID="{CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}" - RootNamespace="umc" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\dtmfscenario.cpp" - > - </File> - <File - RelativePath=".\src\dtmfsession.cpp" - > - </File> - <File - RelativePath=".\src\main.cpp" - > - </File> - <File - RelativePath=".\src\recogscenario.cpp" - > - </File> - <File - RelativePath=".\src\recogsession.cpp" - > - </File> - <File - RelativePath=".\src\recorderscenario.cpp" - > - </File> - <File - RelativePath=".\src\recordersession.cpp" - > - </File> - <File - RelativePath=".\src\setparamscenario.cpp" - > - </File> - <File - RelativePath=".\src\setparamsession.cpp" - > - </File> - <File - RelativePath=".\src\synthscenario.cpp" - > - </File> - <File - RelativePath=".\src\synthsession.cpp" - > - </File> - <File - RelativePath=".\src\umcconsole.cpp" - > - </File> - <File - RelativePath=".\src\umcframework.cpp" - > - </File> - <File - RelativePath=".\src\umcscenario.cpp" - > - </File> - <File - RelativePath=".\src\umcsession.cpp" - > - </File> - <File - RelativePath=".\src\verifierscenario.cpp" - > - </File> - <File - RelativePath=".\src\verifiersession.cpp" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\dtmfscenario.h" - > - </File> - <File - RelativePath=".\include\dtmfsession.h" - > - </File> - <File - RelativePath=".\include\recogscenario.h" - > - </File> - <File - RelativePath=".\include\recogsession.h" - > - </File> - <File - RelativePath=".\include\recorderscenario.h" - > - </File> - <File - RelativePath=".\include\recordersession.h" - > - </File> - <File - RelativePath=".\include\setparamscenario.h" - > - </File> - <File - RelativePath=".\include\setparamsession.h" - > - </File> - <File - RelativePath=".\include\synthscenario.h" - > - </File> - <File - RelativePath=".\include\synthsession.h" - > - </File> - <File - RelativePath=".\include\umcconsole.h" - > - </File> - <File - RelativePath=".\include\umcframework.h" - > - </File> - <File - RelativePath=".\include\umcscenario.h" - > - </File> - <File - RelativePath=".\include\umcsession.h" - > - </File> - <File - RelativePath=".\include\verifierscenario.h" - > - </File> - <File - RelativePath=".\include\verifiersession.h" - > - </File> - </Filter> - <File - RelativePath=".\umc.rc" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}</ProjectGuid> - <RootNamespace>umc</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\dtmfscenario.cpp" /> - <ClCompile Include="src\dtmfsession.cpp" /> - <ClCompile Include="src\main.cpp" /> - <ClCompile Include="src\recogscenario.cpp" /> - <ClCompile Include="src\recogsession.cpp" /> - <ClCompile Include="src\recorderscenario.cpp" /> - <ClCompile Include="src\recordersession.cpp" /> - <ClCompile Include="src\setparamscenario.cpp" /> - <ClCompile Include="src\setparamsession.cpp" /> - <ClCompile Include="src\synthscenario.cpp" /> - <ClCompile Include="src\synthsession.cpp" /> - <ClCompile Include="src\umcconsole.cpp" /> - <ClCompile Include="src\umcframework.cpp" /> - <ClCompile Include="src\umcscenario.cpp" /> - <ClCompile Include="src\umcsession.cpp" /> - <ClCompile Include="src\verifierscenario.cpp" /> - <ClCompile Include="src\verifiersession.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\dtmfscenario.h" /> - <ClInclude Include="include\dtmfsession.h" /> - <ClInclude Include="include\recogscenario.h" /> - <ClInclude Include="include\recogsession.h" /> - <ClInclude Include="include\recorderscenario.h" /> - <ClInclude Include="include\recordersession.h" /> - <ClInclude Include="include\setparamscenario.h" /> - <ClInclude Include="include\setparamsession.h" /> - <ClInclude Include="include\synthscenario.h" /> - <ClInclude Include="include\synthsession.h" /> - <ClInclude Include="include\umcconsole.h" /> - <ClInclude Include="include\umcframework.h" /> - <ClInclude Include="include\umcscenario.h" /> - <ClInclude Include="include\umcsession.h" /> - <ClInclude Include="include\verifierscenario.h" /> - <ClInclude Include="include\verifiersession.h" /> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="umc.rc"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\libunimrcp-client\libunimrcpclient.vcxproj"> - <Project>{ee157390-1e85-416c-946e-620e32c9ad33}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\dtmfscenario.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\dtmfsession.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\main.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\recogscenario.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\recogsession.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\recorderscenario.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\recordersession.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\setparamscenario.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\setparamsession.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\synthscenario.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\synthsession.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\umcconsole.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\umcframework.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\umcscenario.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\umcsession.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\verifierscenario.cpp"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\verifiersession.cpp"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\dtmfscenario.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\dtmfsession.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\recogscenario.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\recogsession.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\recorderscenario.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\recordersession.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\setparamscenario.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\setparamsession.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\synthscenario.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\synthsession.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\umcconsole.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\umcframework.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\umcscenario.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\umcsession.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\verifierscenario.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\verifiersession.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="umc.rc" /> - </ItemGroup> -</Project> \ 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 <apr_hash.h> -#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 <stdlib.h> -#include <apr_getopt.h> -#include <apr_file_info.h> -#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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpclient" - ProjectGUID="{57FAF32E-49FD-491F-895D-132D0D5EFE0A}" - RootNamespace="unimrcpclient" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPClientLibs)" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\demo_bypass_application.c" - > - </File> - <File - RelativePath=".\src\demo_discover_application.c" - > - </File> - <File - RelativePath=".\src\demo_framework.c" - > - </File> - <File - RelativePath=".\src\demo_recog_application.c" - > - </File> - <File - RelativePath=".\src\demo_synth_application.c" - > - </File> - <File - RelativePath=".\src\demo_util.c" - > - </File> - <File - RelativePath=".\src\main.c" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\demo_application.h" - > - </File> - <File - RelativePath=".\include\demo_framework.h" - > - </File> - <File - RelativePath=".\include\demo_util.h" - > - </File> - </Filter> - <File - RelativePath=".\unimrcpclient.rc" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{57FAF32E-49FD-491F-895D-132D0D5EFE0A}</ProjectGuid> - <RootNamespace>unimrcpclient</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\demo_bypass_application.c" /> - <ClCompile Include="src\demo_discover_application.c" /> - <ClCompile Include="src\demo_framework.c" /> - <ClCompile Include="src\demo_recog_application.c" /> - <ClCompile Include="src\demo_synth_application.c" /> - <ClCompile Include="src\demo_util.c" /> - <ClCompile Include="src\main.c" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\demo_application.h" /> - <ClInclude Include="include\demo_framework.h" /> - <ClInclude Include="include\demo_util.h" /> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="unimrcpclient.rc"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\libunimrcp-client\libunimrcpclient.vcxproj"> - <Project>{ee157390-1e85-416c-946e-620e32c9ad33}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\demo_bypass_application.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\demo_discover_application.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\demo_framework.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\demo_recog_application.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\demo_synth_application.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\demo_util.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\main.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="include\demo_application.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\demo_framework.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="include\demo_util.h"> - <Filter>include</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="unimrcpclient.rc" /> - </ItemGroup> -</Project> \ 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 <stdlib.h> -#include <apr_getopt.h> -#include <apr_file_info.h> -#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 <stdio.h> -#include <stdlib.h> -#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 <apr_signal.h> -#include <apr_thread_proc.h> -#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 <windows.h> -#include <apr_lib.h> -#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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="unimrcpserver" - ProjectGUID="{592CF22D-3F8F-4A77-A174-130D77B7623B}" - RootNamespace="unimrcpserver" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPServerLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPServerLibs)" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPServerLibs)" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(UniMRCPServerLibs)" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\main.c" - > - </File> - <File - RelativePath=".\src\uni_cmdline.c" - > - </File> - <File - RelativePath=".\src\uni_daemon.c" - > - </File> - <File - RelativePath=".\src\uni_service.c" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <File - RelativePath=".\unimrcpserver.rc" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|x64" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|x64" - > - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories="..\..\build" - /> - </FileConfiguration> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{592CF22D-3F8F-4A77-A174-130D77B7623B}</ProjectGuid> - <RootNamespace>unimrcpserver</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <AdditionalDependencies>$(UniMRCPServerLibs);%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <AdditionalDependencies>$(UniMRCPServerLibs);%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>$(UniMRCPServerLibs);%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <Link> - <AdditionalDependencies>$(UniMRCPServerLibs);%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\main.c" /> - <ClCompile Include="src\uni_cmdline.c" /> - <ClCompile Include="src\uni_daemon.c" /> - <ClCompile Include="src\uni_service.c" /> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="unimrcpserver.rc"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\libunimrcp-server\libunimrcpserver.vcxproj"> - <Project>{c98af157-352e-4737-bd30-a24e2647f5ae}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\main.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\uni_cmdline.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\uni_daemon.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\uni_service.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="unimrcpserver.rc" /> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="demorecog" - ProjectGUID="{B495B6D9-AF84-479D-B30A-313C16EF8BFD}" - RootNamespace="demorecog" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\demo_recog_engine.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{B495B6D9-AF84-479D-B30A-313C16EF8BFD}</ProjectGuid> - <RootNamespace>demorecog</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\demo_recog_engine.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp-engine\mrcpengine.vcxproj"> - <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{4c5e54ad-7563-43a7-8b11-5067a45289e9}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\demo_recog_engine.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="demosynth" - ProjectGUID="{92BFA534-C419-4EB2-AAA3-510653F38F08}" - RootNamespace="demosynth" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\demo_synth_engine.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{92BFA534-C419-4EB2-AAA3-510653F38F08}</ProjectGuid> - <RootNamespace>demosynth</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\demo_synth_engine.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp-engine\mrcpengine.vcxproj"> - <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{c816d2c0-8f04-4474-ad43-cfac130a1a84}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\demo_synth_engine.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="demoverifier" - ProjectGUID="{F7563CAD-5C95-46E5-89B7-0953C6C6E746}" - RootNamespace="demoverifier" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\demo_verifier_engine.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{F7563CAD-5C95-46E5-89B7-0953C6C6E746}</ProjectGuid> - <RootNamespace>demoverifier</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\demo_verifier_engine.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp-engine\mrcpengine.vcxproj"> - <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{42255732-d637-4aef-ab75-104eb723ff72}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\demo_verifier_engine.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcprecorder" - ProjectGUID="{5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}" - RootNamespace="mrcprecorder" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="2" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="include" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - > - <File - RelativePath=".\src\mrcp_recorder_engine.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}</ProjectGuid> - <RootNamespace>mrcprecorder</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_recorder_engine.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp-engine\mrcpengine.vcxproj"> - <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{b1d2c804-b3bb-4413-8d11-7ff67d4e874c}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\mrcp_recorder_engine.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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, - "<file://mediaserver/data/%s>;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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="apttest" - ProjectGUID="{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}" - RootNamespace="apttest" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\consumer_task_suite.c" - > - </File> - <File - RelativePath=".\src\main.c" - > - </File> - <File - RelativePath=".\src\multipart_suite.c" - > - </File> - <File - RelativePath=".\src\task_suite.c" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}</ProjectGuid> - <RootNamespace>apttest</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\consumer_task_suite.c" /> - <ClCompile Include="src\main.c" /> - <ClCompile Include="src\multipart_suite.c" /> - <ClCompile Include="src\task_suite.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\apr-toolkit\aprtoolkit.vcxproj"> - <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\consumer_task_suite.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\main.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\multipart_suite.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\task_suite.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_time.h> -#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, - "<?xml version=\"1.0\"?>\r\n" - "<speak version=\"1.0\"\r\n" - "<p> <s>You have 4 new messages.</s> </p>\r\n" - "</speak>"); - 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mpftest" - ProjectGUID="{DCF01B1C-5268-44F3-9130-D647FABFB663}" - RootNamespace="mpftest" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib " - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib " - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\main.c" - > - </File> - <File - RelativePath=".\src\mpf_suite.c" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{DCF01B1C-5268-44F3-9130-D647FABFB663}</ProjectGuid> - <RootNamespace>mpftest</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mpf.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <AdditionalDependencies>mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <AdditionalDependencies>mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <Link> - <AdditionalDependencies>mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\main.c" /> - <ClCompile Include="src\mpf_suite.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mpf\mpf.vcxproj"> - <Project>{b5a00bfa-6083-4fae-a097-71642d6473b5}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\main.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\mpf_suite.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_thread_cond.h> -#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; i<container->count; 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="mrcptest" - ProjectGUID="{3CA97077-6210-4362-998A-D15A35EEAA08}" - RootNamespace="mrcptest" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\main.c" - > - </File> - <File - RelativePath=".\src\parse_gen_suite.c" - > - </File> - <File - RelativePath=".\src\set_get_suite.c" - > - </File> - <File - RelativePath=".\src\transparent_set_get_suite.c" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{3CA97077-6210-4362-998A-D15A35EEAA08}</ProjectGuid> - <RootNamespace>mrcptest</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <AdditionalDependencies>mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <AdditionalDependencies>mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <Link> - <AdditionalDependencies>mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\main.c" /> - <ClCompile Include="src\parse_gen_suite.c" /> - <ClCompile Include="src\set_get_suite.c" /> - <ClCompile Include="src\transparent_set_get_suite.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\mrcp\mrcp.vcxproj"> - <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\main.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\parse_gen_suite.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\set_get_suite.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\transparent_set_get_suite.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_file_info.h> -#include <apr_file_io.h> -#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: <empty>"); - 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(&param_name,SAMPLE_PARAM_NAME); - apt_string_reset(&param_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,&param_name,&param_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: <empty>"); - 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 - -<?xml version="1.0"?> - -<!-- the default grammar language is US English --> -<grammar xml:lang="en-US" version="1.0"> - -<!-- single language attachment to tokens --> -<rule id="yes"> - <one-of> - <item xml:lang="fr-CA">oui</item> - <item xml:lang="en-US">yes</item> - </one-of> -</rule> \ 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 - -<?xml version="1.0"?> -<speak> -<paragraph> - <sentence>You have 4 new messages.</sentence> - <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> - <mark name="Stephanie"/> and arrived at <break/> - <say-as type="time">3:45pm</say-as>.</sentence> - - <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence> -</paragraph> -</speak> \ 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 - - <?xml version="1.0"?> - <result x-model="http://IdentityModel" - xmlns:xf="http://www.w3.org/2000/xforms" - grammar="session:request1@form-level.store"> - <interpretation> - <xf:instance name="Person"> - <Person> - <Name> Andre Roy </Name> - </Person> - </xf:instance> - <input> may I speak to Andre Roy </input> - </interpretation> - </result> \ 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 - -<?xml version="1.0"?> - -<!-- the default grammar language is US English --> -<grammar xml:lang="en-US" version="1.0"> - -<!-- single language attachment to tokens --> - <rule id="yes"> - <one-of> - <item xml:lang="fr-CA">oui</item> - <item xml:lang="en-US">yes</item> - </one-of> - </rule> - -<!-- single language attachment to a rule expansion --> - <rule id="request"> - may I speak to - <one-of xml:lang="fr-CA"> - <item>Michel Tremblay</item> - <item>Andre Roy</item> - </one-of> - </rule> - -</grammar> \ 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 - -<?xml version="1.0"?> -<speak> -<paragraph> - <sentence>You have 4 new messages.</sentence> - <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> - <mark name="Stephanie"/> and arrived at <break/> - <say-as type="time">3:45pm</say-as>.</sentence> - - <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence> -</paragraph> -</speak> \ 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:<request1@form-level.store> -Content-Length:685 - -<?xml version="1.0"?> - -<!-- the default grammar language is US English --> -<grammar xmlns="http://www.w3.org/2001/06/grammar" - xml:lang="en-US" version="1.0"> - -<!-- single language attachment to tokens --> - <rule id="yes"> - <one-of> - <item xml:lang="fr-CA">oui</item> - <item xml:lang="en-US">yes</item> - </one-of> - </rule> - -<!-- single language attachment to a rule expansion --> - <rule id="request"> - may I speak to - <one-of xml:lang="fr-CA"> - <item>Michel Tremblay</item> - <item>Andre Roy</item> - </one-of> - </rule> - -</grammar> \ 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:<http://web.media.com/session123/audio.wav>;size=342456;duration=25435 -Content-Type:application/nlsml+xml -Content-Length:430 - -<?xml version="1.0"?> -<result xmlns="http://www.ietf.org/xml/ns/mrcpv2" - xmlns:ex="http://www.example.com/example" - grammar="session:request1@form-level.store"> - <interpretation> - <instance name="Person"> - <ex:Person> - <ex:Name> Andre Roy </ex:Name> - </ex:Person> - </instance> - <input> may I speak to Andre Roy </input> - </interpretation> -</result> \ 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:<request1@form-level.store> -Content-Length:702 - -<?xml version="1.0"?> - -<!-- the default grammar language is US English --> -<grammar xmlns="http://www.w3.org/2001/06/grammar" - xml:lang="en-US" version="1.0" root="request"> - -<!-- single language attachment to tokens --> - <rule id="yes"> - <one-of> - <item xml:lang="fr-CA">oui</item> - <item xml:lang="en-US">yes</item> - </one-of> - </rule> - -<!-- single language attachment to a rule expansion --> - <rule id="request"> - may I speak to - <one-of xml:lang="fr-CA"> - <item>Michel Tremblay</item> - <item>Andre Roy</item> - </one-of> - </rule> -</grammar> \ 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 - -<?xml version="1.0"?> -<speak version="1.0" - xmlns="http://www.w3.org/2001/10/synthesis" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.w3.org/2001/10/synthesis - http://www.w3.org/TR/speech-synthesis/synthesis.xsd" - xml:lang="en-US"> - <p> - <s>You have 4 new messages.</s> - <s>The first is from Stephanie Williams and arrived at - <break/> - <say-as interpret-as="vxml:time">0345p</say-as>. - </s> - <s>The subject is - <prosody rate="-20%">ski trip</prosody> - </s> - </p> -</speak> \ 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 - -<?xml version="1.0"?> -<speak> -<paragraph> - <sentence>You have 4 new messages.</sentence> - <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> - <mark name="Stephanie"/> and arrived at <break/> - <say-as type="time">3:45pm</say-as>.</sentence> - - <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence> -</paragraph> -</speak> \ 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 - -<?xml version="1.0"?> -<speak> -<paragraph> - <sentence>You have 4 new messages.</sentence> - <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> - <mark name="Stephanie"/> and arrived at <break/> - <say-as type="time">3:45pm</say-as>.</sentence> - - <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence> -</paragraph> -</speak> \ 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="rtsptest" - ProjectGUID="{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}" - RootNamespace="rtsptest" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\main.c" - > - </File> - <File - RelativePath=".\src\parse_gen_suite.c" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}</ProjectGuid> - <RootNamespace>rtsptest</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <AdditionalDependencies>unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <AdditionalDependencies>unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <Link> - <AdditionalDependencies>unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\main.c" /> - <ClCompile Include="src\parse_gen_suite.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\uni-rtsp\unirtsp.vcxproj"> - <Project>{504b3154-7a4f-459d-9877-b951021c3f1f}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\main.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="src\parse_gen_suite.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 <apr_file_info.h> -#include <apr_file_io.h> -#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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Multiple Resources UAC"> - <!-- In client mode (sipp placing calls), the Call-ID MUST be --> - <!-- generated by sipp. To do so, use [call_id] token. --> - <send retrans="500"> - <![CDATA[ - - INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]> - 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 - - ]]> - </send> - - <recv response="100" - optional="true"> - </recv> - - <recv response="180" optional="true"> - </recv> - - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv response="200" rtd="true"> - </recv> - - <!-- Packet lost can be simulated in any send/recv message by --> - <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --> - <send> - <![CDATA[ - - ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <!-- This delay can be customized by the -d command-line option --> - <!-- or by adding a 'milliseconds = "value"' option here. --> - <pause/> - - <!-- The 'crlf' option inserts a blank line in the statistics report. --> - <send retrans="500"> - <![CDATA[ - - BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <recv response="200" crlf="true"> - </recv> - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Recognizer Resource UAC"> - <!-- In client mode (sipp placing calls), the Call-ID MUST be --> - <!-- generated by sipp. To do so, use [call_id] token. --> - <send retrans="500"> - <![CDATA[ - - INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]> - 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 - - ]]> - </send> - - <recv response="100" - optional="true"> - </recv> - - <recv response="180" optional="true"> - </recv> - - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv response="200" rtd="true"> - </recv> - - <!-- Packet lost can be simulated in any send/recv message by --> - <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --> - <send> - <![CDATA[ - - ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <!-- This delay can be customized by the -d command-line option --> - <!-- or by adding a 'milliseconds = "value"' option here. --> - <pause/> - - <!-- The 'crlf' option inserts a blank line in the statistics report. --> - <send retrans="500"> - <![CDATA[ - - BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <recv response="200" crlf="true"> - </recv> - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Synthesizer Resource UAC"> - <!-- In client mode (sipp placing calls), the Call-ID MUST be --> - <!-- generated by sipp. To do so, use [call_id] token. --> - <send retrans="500"> - <![CDATA[ - - INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]> - 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 - - ]]> - </send> - - <recv response="100" - optional="true"> - </recv> - - <recv response="180" optional="true"> - </recv> - - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv response="200" rtd="true"> - </recv> - - <!-- Packet lost can be simulated in any send/recv message by --> - <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --> - <send> - <![CDATA[ - - ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <!-- This delay can be customized by the -d command-line option --> - <!-- or by adding a 'milliseconds = "value"' option here. --> - <pause/> - - <!-- The 'crlf' option inserts a blank line in the statistics report. --> - <send retrans="500"> - <![CDATA[ - - BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <recv response="200" crlf="true"> - </recv> - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Unknown Resource UAC"> - <!-- In client mode (sipp placing calls), the Call-ID MUST be --> - <!-- generated by sipp. To do so, use [call_id] token. --> - <send retrans="500"> - <![CDATA[ - - INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]> - 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 - - ]]> - </send> - - <recv response="100" - optional="true"> - </recv> - - <recv response="180" optional="true"> - </recv> - - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv response="200" rtd="true"> - </recv> - - <!-- Packet lost can be simulated in any send/recv message by --> - <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --> - <send> - <![CDATA[ - - ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <!-- This delay can be customized by the -d command-line option --> - <!-- or by adding a 'milliseconds = "value"' option here. --> - <pause/> - - <!-- The 'crlf' option inserts a blank line in the statistics report. --> - <send retrans="500"> - <![CDATA[ - - BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <recv response="200" crlf="true"> - </recv> - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Synthesizer/Recognizer Resources UAC"> - <!-- In client mode (sipp placing calls), the Call-ID MUST be --> - <!-- generated by sipp. To do so, use [call_id] token. --> - <send retrans="500"> - <![CDATA[ - - INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]> - 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 - - ]]> - </send> - - <recv response="100" - optional="true"> - </recv> - - <recv response="180" optional="true"> - </recv> - - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv response="200" rtd="true"> - </recv> - - <!-- Packet lost can be simulated in any send/recv message by --> - <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --> - <send> - <![CDATA[ - - ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <!-- This delay can be customized by the -d command-line option --> - <!-- or by adding a 'milliseconds = "value"' option here. --> - <pause/> - - <!-- In client mode (sipp placing calls), the Call-ID MUST be --> - <!-- generated by sipp. To do so, use [call_id] token. --> - <send retrans="500"> - <![CDATA[ - - INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]> - 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 - - ]]> - </send> - - <recv response="100" - optional="true"> - </recv> - - <recv response="180" optional="true"> - </recv> - - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv response="200" rtd="true"> - </recv> - - <!-- Packet lost can be simulated in any send/recv message by --> - <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --> - <send> - <![CDATA[ - - ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <!-- This delay can be customized by the -d command-line option --> - <!-- or by adding a 'milliseconds = "value"' option here. --> - <pause/> - - - <!-- The 'crlf' option inserts a blank line in the statistics report. --> - <send retrans="500"> - <![CDATA[ - - BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] - From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] - To: sut <sip:[service]@[remote_ip]:[remote_port]>[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 - - ]]> - </send> - - <recv response="200" crlf="true"> - </recv> - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Recognizer Resource UAS"> - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv request="INVITE" crlf="true"> - </recv> - - <!-- The '[last_*]' keyword is replaced automatically by the --> - <!-- specified header if it was present in the last message received --> - <!-- (except if it was a retransmission). If the header was not --> - <!-- present or if no message has been received, the '[last_*]' --> - <!-- keyword is discarded, and all bytes until the end of the line --> - <!-- are also discarded. --> - <!-- --> - <!-- If the specified header was present several times in the --> - <!-- message, all occurences are concatenated (CRLF seperated) --> - <!-- to be used in place of the '[last_*]' keyword. --> - - <send retrans="500"> - <![CDATA[ - - SIP/2.0 200 OK - [last_Via:] - [last_From:] - [last_To:];tag=[call_number] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - 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 - - ]]> - </send> - - <recv request="ACK" - optional="true" - rtd="true" - crlf="true"> - </recv> - - <recv request="INVITE" crlf="true"> - </recv> - - <send retrans="500"> - <![CDATA[ - - SIP/2.0 200 OK - [last_Via:] - [last_From:] - [last_To:];tag=[call_number] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - 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 - - ]]> - </send> - - <recv request="ACK" - optional="true" - rtd="true" - crlf="true"> - </recv> - - <recv request="BYE"> - </recv> - - <send> - <![CDATA[ - - SIP/2.0 200 OK - [last_Via:] - [last_From:] - [last_To:] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - Content-Length: 0 - - ]]> - </send> - - <!-- Keep the call open for a while in case the 200 is lost to be --> - <!-- able to retransmit it if we receive the BYE again. --> - <pause milliseconds="4000"/> - - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Rejected Offer UAS"> - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv request="INVITE" crlf="true"> - </recv> - - <!-- The '[last_*]' keyword is replaced automatically by the --> - <!-- specified header if it was present in the last message received --> - <!-- (except if it was a retransmission). If the header was not --> - <!-- present or if no message has been received, the '[last_*]' --> - <!-- keyword is discarded, and all bytes until the end of the line --> - <!-- are also discarded. --> - <!-- --> - <!-- If the specified header was present several times in the --> - <!-- message, all occurences are concatenated (CRLF seperated) --> - <!-- to be used in place of the '[last_*]' keyword. --> - - <send retrans="500"> - <![CDATA[ - - SIP/2.0 404 OK - [last_Via:] - [last_From:] - [last_To:];tag=[call_number] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - Content-Length: 0 - ]]> - </send> - - <recv request="ACK" - optional="true" - rtd="true" - crlf="true"> - </recv> - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Synthesizer Resource UAS"> - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv request="INVITE" crlf="true"> - </recv> - - <!-- The '[last_*]' keyword is replaced automatically by the --> - <!-- specified header if it was present in the last message received --> - <!-- (except if it was a retransmission). If the header was not --> - <!-- present or if no message has been received, the '[last_*]' --> - <!-- keyword is discarded, and all bytes until the end of the line --> - <!-- are also discarded. --> - <!-- --> - <!-- If the specified header was present several times in the --> - <!-- message, all occurences are concatenated (CRLF seperated) --> - <!-- to be used in place of the '[last_*]' keyword. --> - - <send retrans="500"> - <![CDATA[ - - SIP/2.0 200 OK - [last_Via:] - [last_From:] - [last_To:];tag=[call_number] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - 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 - - ]]> - </send> - - <recv request="ACK" - optional="true" - rtd="true" - crlf="true"> - </recv> - - <recv request="INVITE" crlf="true"> - </recv> - - <send retrans="500"> - <![CDATA[ - - SIP/2.0 200 OK - [last_Via:] - [last_From:] - [last_To:];tag=[call_number] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - 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 - - ]]> - </send> - - <recv request="ACK" - optional="true" - rtd="true" - crlf="true"> - </recv> - - <recv request="BYE"> - </recv> - - <send> - <![CDATA[ - - SIP/2.0 200 OK - [last_Via:] - [last_From:] - [last_To:] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - Content-Length: 0 - - ]]> - </send> - - <!-- Keep the call open for a while in case the 200 is lost to be --> - <!-- able to retransmit it if we receive the BYE again. --> - <pause milliseconds="4000"/> - - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE scenario SYSTEM "sipp.dtd"> - - -<scenario name="MRCP Unknown Resource UAS"> - <!-- By adding rrs="true" (Record Route Sets), the route sets --> - <!-- are saved and used for following messages sent. Useful to test --> - <!-- against stateful SIP proxies/B2BUAs. --> - <recv request="INVITE" crlf="true"> - </recv> - - <!-- The '[last_*]' keyword is replaced automatically by the --> - <!-- specified header if it was present in the last message received --> - <!-- (except if it was a retransmission). If the header was not --> - <!-- present or if no message has been received, the '[last_*]' --> - <!-- keyword is discarded, and all bytes until the end of the line --> - <!-- are also discarded. --> - <!-- --> - <!-- If the specified header was present several times in the --> - <!-- message, all occurences are concatenated (CRLF seperated) --> - <!-- to be used in place of the '[last_*]' keyword. --> - - <send retrans="500"> - <![CDATA[ - - SIP/2.0 200 OK - [last_Via:] - [last_From:] - [last_To:];tag=[call_number] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - 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 - - ]]> - </send> - - <recv request="ACK" - optional="true" - rtd="true" - crlf="true"> - </recv> - - <recv request="BYE"> - </recv> - - <send> - <![CDATA[ - - SIP/2.0 200 OK - [last_Via:] - [last_From:] - [last_To:] - [last_Call-ID:] - [last_CSeq:] - Contact: <sip:[local_ip]:[local_port];transport=[transport]> - Content-Length: 0 - - ]]> - </send> - - <!-- Keep the call open for a while in case the 200 is lost to be --> - <!-- able to retransmit it if we receive the BYE again. --> - <pause milliseconds="4000"/> - - - <!-- definition of the response time repartition table (unit is ms) --> - <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> - - <!-- definition of the call length repartition table (unit is ms) --> - <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> - -</scenario> 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 <stdio.h> -#include <ctype.h> -#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; i<count; i++) { - buf = table[i].value.buf; - if(i != item_index && char_index < table[i].value.length && - tolower(value) == tolower(buf[char_index])) { - return FALSE; - } - } - return TRUE; -} - -static apt_bool_t string_table_key_generate(apt_str_table_item_t table[], apr_size_t count) -{ - size_t i,j; - size_t length; - for(i=0; i<count; i++) { - length = table[i].value.length; - table[i].key = length; - for(j=0; j<length; j++) { - if(is_unique(table,count,i,j,table[i].value.buf[j]) == TRUE) { - table[i].key = j; - break; - } - } - } - return TRUE; -} - -#define TEST_BUFFER_SIZE 2048 -static char parse_buffer[TEST_BUFFER_SIZE]; - -static size_t string_table_read(apt_str_table_item_t table[], apr_size_t max_count, FILE *file, apr_pool_t *pool) -{ - apt_str_table_item_t *item; - size_t count = 0; - apt_str_t line; - apt_text_stream_t text_stream; - - text_stream.text.length = fread(parse_buffer, 1, sizeof(parse_buffer)-1, file); - parse_buffer[text_stream.text.length] = '\0'; - text_stream.text.buf = parse_buffer; - apt_text_stream_reset(&text_stream); - - do { - if(apt_text_line_read(&text_stream,&line) == FALSE || !line.length) { - break; - } - item = &table[count]; - apt_string_copy(&item->value,&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; i<count; i++) { - item = &table[i]; - fprintf(file,"{{\"%s\",%"APR_SIZE_T_FMT"},%"APR_SIZE_T_FMT"},\r\n", - item->value.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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="strtablegen" - ProjectGUID="{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}" - RootNamespace="strtablegen" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - ConfigurationType="1" - InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib" - LinkTimeCodeGeneration="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\main.c" - > - </File> - </Filter> - <Filter - Name="include" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}</ProjectGuid> - <RootNamespace>strtablegen</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" /> - <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" /> - <Import Project="$(ProjectDir)..\..\build\props\apt.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <Link> - <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="src\main.c" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\libs\apr-toolkit\aprtoolkit.vcxproj"> - <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="src"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="include"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="src\main.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>mod_unimrcp</ProjectName> - <ProjectGuid>{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}</ProjectGuid> - <RootNamespace>mod_unimrcp</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <Import Project="..\..\..\..\w32\openssl.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\w32\module_release.props" /> - <Import Project="unimrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\w32\module_debug.props" /> - <Import Project="unimrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\w32\module_release.props" /> - <Import Project="unimrcp.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\..\w32\module_debug.props" /> - <Import Project="unimrcp.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(SolutionDir)Debug/bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <TargetMachine>MachineX64</TargetMachine> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(SolutionDir)Release/bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <AdditionalLibraryDirectories>$(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <DataExecutionPrevention> - </DataExecutionPrevention> - <TargetMachine>MachineX64</TargetMachine> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="mod_unimrcp.c"> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsC</CompileAs> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs> - <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsC</CompileAs> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\apr-toolkit\aprtoolkit.2017.vcxproj"> - <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mpf\mpf.2017.vcxproj"> - <Project>{b5a00bfa-6083-4fae-a097-71642d6473b5}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mrcp-client\mrcpclient.2017.vcxproj"> - <Project>{72782932-37cc-46ae-8c7f-9a7b1a6ee108}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mrcp-signaling\mrcpsignaling.2017.vcxproj"> - <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mrcpv2-transport\mrcpv2transport.2017.vcxproj"> - <Project>{a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mrcp\mrcp.2017.vcxproj"> - <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\uni-rtsp\unirtsp.2017.vcxproj"> - <Project>{504b3154-7a4f-459d-9877-b951021c3f1f}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\unimrcp\modules\mrcp-sofiasip\mrcpsofiasip.2017.vcxproj"> - <Project>{746f3632-5bb2-4570-9453-31d6d58a7d8e}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\unimrcp\modules\mrcp-unirtsp\mrcpunirtsp.2017.vcxproj"> - <Project>{deb01acb-d65f-4a62-aed9-58c1054499e9}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\win32\apr-util\libaprutil.2017.vcxproj"> - <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\win32\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\win32\pthread\pthread.2017.vcxproj"> - <Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project> - </ProjectReference> - <ProjectReference Include="..\..\..\..\libs\win32\sofia\libsofia_sip_ua_static.2017.vcxproj"> - <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project> - </ProjectReference> - <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj"> - <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 <anthm@freeswitch.org> - * - * 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 <chris@rienzo.com> - * - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Brian West <brian@freeswitch.org> - * Christopher M. Rienzo <chris@rienzo.com> - * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC) - * - * Maintainer: Christopher M. Rienzo <chris@rienzo.com> - * - * mod_unimrcp.c -- UniMRCP module (MRCP client) - * - */ -#include <switch.h> - -/* 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 "<?xml" -#define SRGS_ID "<grammar" -#define SSML_ID "<speak" -#define GSL_ID ";GSL2.0" -#define ABNF_ID "#ABNF" -#define JSGF_ID "#JSGF" -#define GSR_ID "<speech-context" -#define BUILTIN_ID "builtin:" -#define SESSION_ID "session:" -#define HTTP_ID "http://" -#define HTTPS_ID "https://" -#define FILE_ID "file://" -#define INLINE_ID "inline:" -static int text_starts_with(const char *text, const char *match); -static const char *skip_initial_whitespace(const char *text); - -/** - * UniMRCP parameter ID container - */ -struct unimrcp_param_id { - /** The parameter ID */ - int id; -}; -typedef struct unimrcp_param_id unimrcp_param_id_t; -static unimrcp_param_id_t *unimrcp_param_id_create(int id, switch_memory_pool_t *pool); - - -/******************************************************************************************************************************************** - * AUDIO QUEUE : UniMRCP <--> 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, "<profile> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ImportGroup Label="PropertySheets"> - <Import Project="..\..\..\..\w32\apr.props" /> - </ImportGroup> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalIncludeDirectories>$(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)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>MRCP_STATIC_LIB;MPF_STATIC_LIB;APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemDefinitionGroup> -</Project> \ 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 @@ </input> ]]> </alias> - <alias name="input_voice_yesno_unimrcp" target="call"> - <![CDATA[ - <input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp"> - <grammar content-type="application/srgs+xml> - <![CDATA[ - <grammar xmlns="http://www.w3.org/2001/06/grammar" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" - xml:lang="en-US" version="1.0"> - <rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar> - ]]]]><![CDATA[> - </grammar> - </input> - ]]> - </alias> - <alias name="input_voice_yesno_unimrcp_timeout" target="call"> - <![CDATA[ - <input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp" max-silence="5000" initial-timeout="5000"> - <grammar content-type="application/srgs+xml> - <![CDATA[ - <grammar xmlns="http://www.w3.org/2001/06/grammar" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" - xml:lang="en-US" version="1.0"> - <rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar> - ]]]]><![CDATA[> - </grammar> - </input> - ]]> - </alias> <alias name="input_voice_yesno_pocketsphinx" target="call"> <![CDATA[ From 5c2726f41358b02cb0479cc078a1f4c0b0887996 Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Thu, 18 Aug 2022 13:40:33 -0400 Subject: [PATCH 566/655] [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 <stdlib.h> -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 <stdlib.h> -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 <stdlib.h> @@ -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 <apr.h> +#include <fspr.h> #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.</p> <h2>APR On Windows and Netware</h2> <p>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.</p> <p> <strong> @@ -34,7 +34,7 @@ and apr.hw (apr.hwn) respectively.</p> 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. <li>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.</p> </ul> @@ -171,14 +171,14 @@ in file_io/unix/fileio.h:</p> <pre> struct ap_file_t { - apr_pool_t *cntxt; + fspr_pool_t *cntxt; int filedes; FILE *filehand; ... } </pre> -<p>In include/apr_file_io.h:</p> +<p>In include/fspr_file_io.h:</p> </pre> typedef struct ap_file_t ap_file_t; </pre> @@ -187,7 +187,7 @@ in file_io/unix/fileio.h:</p> field in this structure. Windows does not have a filedes field, so obviously, it is important that programs not be able to access these.</p> -<p>You may notice the apr_pool_t field. Most APR types have this field. This +<p>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.</strong> <p>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 -<code>apr_proc_wait</code>, which can only return APR_CHILDDONE, +<code>fspr_proc_wait</code>, 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 <code>apr_compare_users</code>, which can only return +example of this is <code>fspr_compare_users</code>, which can only return APR_SUCCESS, APR_EMISMATCH, or an error code.</p> -<p>All of these definitions can be found in apr_errno.h for all platforms. When +<p>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: </p> @@ -320,7 +320,7 @@ case. We'll get to how this problem is solved in a little while.</p> <p>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.</p> <p>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.</p> <h2>Canonical API</h2> -Functions to manipulate the apr_canon_file_t (an opaque type) include: +Functions to manipulate the fspr_canon_file_t (an opaque type) include: <ul> <li>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: </ul> <p>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.</p> 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 @@ </p> <blockquote> <pre> -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);</pre> +fspr_pool_destroy(subpool);</pre> </blockquote> <p> 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.</p> <p>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 <sys/types.h> #include <sys/ldr.h> #include <a.out.h> -#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 <library.h> #include <unistd.h> -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 <stdio.h> #include <string.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; 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 <errno.h> #include <string.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)->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 <utime.h> @@ -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 <nks/fsio.h> -#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 <stdlib.h> /* 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 <nks/fsio.h> #include <nks/errno.h> -#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 <string.h> -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 <string.h> #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 <string.h> -#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 <sys/time.h> -#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 <ctype.h> /* 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 <errno.h> #include <string.h> -#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<MAPSIZE) rv = errormap[index][1]; else - fprintf(stderr, "apr_canonical_error: Unknown OS/2 error code %d\n", err ); + fprintf(stderr, "fspr_canonical_error: Unknown OS/2 error code %d\n", err ); return rv; } diff --git a/libs/apr/file_io/os2/open.c b/libs/apr/file_io/os2/open.c index 297a60b75b..4f8a8e57f9 100644 --- a/libs/apr/file_io/os2/open.c +++ b/libs/apr/file_io/os2/open.c @@ -14,29 +14,29 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include "apr_strings.h" -#include "apr_arch_inherit.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_lib.h" +#include "fspr_portable.h" +#include "fspr_strings.h" +#include "fspr_arch_inherit.h" #include <string.h> -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 <string.h> #include <process.h> -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 <malloc.h> -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 <string.h> #include <io.h> -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 <sys/syslimits.h> #endif @@ -24,9 +24,9 @@ #include <limits.h> #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 <unistd.h> #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 <utime.h> #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 <fcntl.h> @@ -23,7 +23,7 @@ #include <sys/file.h> #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 <errno.h> @@ -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 <string.h> -#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 <string.h> #include <ctype.h> @@ -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 <aclapi.h> -#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 <sys/stat.h> -#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 <errno.h> #endif @@ -29,11 +29,11 @@ #if APR_HAVE_SYS_STAT_H #include <sys/stat.h> #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 <errno.h> #endif @@ -29,9 +29,9 @@ #if APR_HAVE_SYS_STAT_H #include <sys/stat.h> #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 <malloc.h> -#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 <errno.h> #include <string.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_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 (<DATA>) { chomp; @@ -41,7 +41,7 @@ sub replace { while (<IN>) { 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 <apr_pools.h> - -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 <kernel/image.h> #include <string.h> #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 <kernel/OS.h> -#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 <kernel/OS.h> -#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 <kernel/OS.h> -#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 <kernel/OS.h> #include <signal.h> #include <string.h> @@ -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 <dlfcn.h> @@ -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 <nks/synch.h> -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 <nks/synch.h> -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 <nks/synch.h> -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 <sys/wait.h> @@ -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 <sys/types.h> #include <stddef.h> @@ -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 <sys/types.h> -#include <sys/socket.h> - -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 <netdb.h> @@ -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 <sys/types.h> +#include <sys/socket.h> + +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 <dll.h> -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 <stdio.h> @@ -49,13 +49,13 @@ #include <kernel/OS.h> #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 <poll.h> @@ -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 <sys/mman.h> @@ -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 <pthread.h> @@ -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 <pthread.h> #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 <time.h> #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 <sys/stat.h> @@ -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 <wchar.h> -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 * </pre> * @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 <stdio.h> @@ -46,26 +46,26 @@ #include <string.h> #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 <errno.h> @@ -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 <sys/uio.h> @@ -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 <EM>pool</EM> 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. * </PRE> * @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" { * </PRE> */ -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. * </PRE> */ -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, /** * <PRE> * - * 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; * } * </PRE> */ -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 <ctype.h> @@ -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" * </PRE> */ -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. * </PRE> */ -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 <kernel/OS.h> @@ -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 { * </PRE> * @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 <netinet/in.h> @@ -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 * </PRE> - * @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 * </PRE> - * @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 * <PRE> * 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. * </PRE> */ -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 * <PRE> * 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. * </PRE> */ -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 * <PRE> * 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. * </PRE> */ -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, * </PRE> * @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 * </PRE> */ -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, * </PRE> * @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 <netinet/in.h> @@ -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: * <pre> * 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); * </pre> * @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 <dirent.h> @@ -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 <kernel/OS.h> #include <kernel/image.h> -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 <dl.h> -typedef shl_t apr_os_dso_handle_t; +typedef shl_t fspr_os_dso_handle_t; #elif defined(DARWIN) #include <mach-o/dyld.h> -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 * </PRE> * @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 <fspr_pools.h> + +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 <signal.h> @@ -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 <stdarg.h> @@ -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 * <PRE> * 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. * </PRE> */ -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 <stdarg.h> /* 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. */ /** *<PRE> - * 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, * </PRE> */ -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 <sys/time.h> @@ -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 * </PRE> */ -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, * </PRE> * @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. * </PRE> */ -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; * <pre> - * 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 ...] * </pre> */ -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: * <PRE> * 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 * </PRE> */ -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 * * <PRE> @@ -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) * </PRE> */ 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 <hippo@be.com> */ -#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 <hippo@be.com> */ -#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 <hippo@be.com> */ -#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 <nks/errno.h> -#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 <string.h> #include <stddef.h> #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 <string.h> -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 <string.h> #include <stddef.h> -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 <string.h> -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 <limits.h> -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 <stdlib.h> /* 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 <langinfo.h> @@ -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 <unistd.h> @@ -27,9 +27,9 @@ #include <stdlib.h> #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 <netdb.h> @@ -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 <ctype.h> -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; c<len; c++) { /* skip multiple whitespace */ - while (apr_isspace(message[c]) && apr_isspace(message[c+1])) + while (fspr_isspace(message[c]) && fspr_isspace(message[c+1])) c++; - *(pos++) = apr_isspace(message[c]) ? ' ' : message[c]; + *(pos++) = fspr_isspace(message[c]) ? ' ' : message[c]; } *pos = 0; @@ -186,7 +186,7 @@ static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) #elif defined(WIN32) || (defined(NETWARE) && defined(USE_WINSOCK)) static const struct { - apr_status_t code; + fspr_status_t code; const char *msg; } gaErrorList[] = { WSAEINTR, "Interrupted system call", @@ -242,9 +242,9 @@ static const struct { }; -static char *apr_os_strerror(char *buf, apr_size_t bufsize, apr_status_t errcode) +static char *fspr_os_strerror(char *buf, fspr_size_t bufsize, fspr_status_t errcode) { - apr_size_t len=0, i; + fspr_size_t len=0, i; #ifndef NETWARE len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM @@ -260,7 +260,7 @@ static char *apr_os_strerror(char *buf, apr_size_t bufsize, apr_status_t errcode if (!len) { for (i = 0; gaErrorList[i].msg; ++i) { if (gaErrorList[i].code == errcode) { - apr_cpystrn(buf, gaErrorList[i].msg, bufsize); + fspr_cpystrn(buf, gaErrorList[i].msg, bufsize); len = strlen(buf); break; } @@ -284,17 +284,17 @@ static char *apr_os_strerror(char *buf, apr_size_t bufsize, apr_status_t errcode else { /* Windows didn't provide us with a message. Even stuff like * WSAECONNREFUSED won't get a message. */ - apr_snprintf(buf, bufsize, "Unrecognized Win32 error code %d", errcode); + fspr_snprintf(buf, bufsize, "Unrecognized Win32 error code %d", errcode); } return buf; } #else -/* On Unix, apr_os_strerror() handles error codes from the resolver +/* On Unix, fspr_os_strerror() handles error codes from the resolver * (h_errno). */ -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) { #ifdef HAVE_HSTRERROR return stuffbuffer(buf, bufsize, hstrerror(err)); @@ -327,8 +327,8 @@ static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) #if defined(HAVE_STRERROR_R) && defined(STRERROR_R_RC_INT) && !defined(BEOS) /* AIX and Tru64 style */ -static char *native_strerror(apr_status_t statcode, char *buf, - apr_size_t bufsize) +static char *native_strerror(fspr_status_t statcode, char *buf, + fspr_size_t bufsize) { if (strerror_r(statcode, buf, bufsize) < 0) { return stuffbuffer(buf, bufsize, @@ -346,11 +346,11 @@ static char *native_strerror(apr_status_t statcode, char *buf, * we add a suitable prototype here. */ #if defined(BEOS) -const char *strerror_r(apr_status_t, char *, apr_size_t); +const char *strerror_r(fspr_status_t, char *, fspr_size_t); #endif -static char *native_strerror(apr_status_t statcode, char *buf, - apr_size_t bufsize) +static char *native_strerror(fspr_status_t statcode, char *buf, + fspr_size_t bufsize) { const char *msg; @@ -367,8 +367,8 @@ static char *native_strerror(apr_status_t statcode, char *buf, /* plain old strerror(); * thread-safe on some platforms (e.g., Solaris, OS/390) */ -static char *native_strerror(apr_status_t statcode, char *buf, - apr_size_t bufsize) +static char *native_strerror(fspr_status_t statcode, char *buf, + fspr_size_t bufsize) { #ifdef _WIN32_WCE static char err[32]; @@ -386,14 +386,14 @@ static char *native_strerror(apr_status_t statcode, char *buf, } #endif -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 (statcode < APR_OS_START_ERROR) { return native_strerror(statcode, buf, bufsize); } else if (statcode < APR_OS_START_USERERR) { - return stuffbuffer(buf, bufsize, apr_error_string(statcode)); + return stuffbuffer(buf, bufsize, fspr_error_string(statcode)); } else if (statcode < APR_OS_START_EAIERR) { return stuffbuffer(buf, bufsize, "APR does not understand this error code"); @@ -410,7 +410,7 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, #endif } else { - return apr_os_strerror(buf, bufsize, statcode - APR_OS_START_SYSERR); + return fspr_os_strerror(buf, bufsize, statcode - APR_OS_START_SYSERR); } } diff --git a/libs/apr/misc/unix/getopt.c b/libs/apr/misc/unix/getopt.c index 24be3c82f8..e9e3e383e9 100644 --- a/libs/apr/misc/unix/getopt.c +++ b/libs/apr/misc/unix/getopt.c @@ -31,21 +31,21 @@ * SUCH DAMAGE. */ -#include "apr_arch_misc.h" -#include "apr_strings.h" -#include "apr_lib.h" +#include "fspr_arch_misc.h" +#include "fspr_strings.h" +#include "fspr_lib.h" #define EMSG "" -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) { void *argv_buff; - *os = apr_palloc(cont, sizeof(apr_getopt_t)); + *os = fspr_palloc(cont, sizeof(fspr_getopt_t)); (*os)->cont = 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 <sys/socket.h> /* 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 <sys/stat.h> #if APR_HAVE_SYS_TYPES_H #include <sys/types.h> @@ -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 <crtdbg.h> #include <assert.h> @@ -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 <wincrypt.h> -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 <sys/time.h> -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 <sys/time.h> -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 <errno.h> #include <string.h> #include <sys/socket.h> @@ -28,11 +28,11 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> -#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 <errno.h> #include <string.h> #include <sys/socket.h> @@ -29,16 +29,16 @@ #include <sys/so_ioctl.h> -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 <sys/types.h> @@ -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 <sys/types.h> @@ -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 <net/if.h> @@ -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.h> /* 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 <stdlib.h> #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 <time.h> #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 <string.h> -#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 <string.h> -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 <sys/types.h> #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 <assert.h> #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 <apr.h> -#include <apr_random.h> -#include <apr_pools.h> +#include <fspr.h> +#include <fspr_random.h> +#include <fspr_pools.h> #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 <stdio.h> #include <stdlib.h> #include <kernel/OS.h> -#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 <sys/types.h> @@ -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 <string.h> #if APR_HAVE_CTYPE_H # include <ctype.h> @@ -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 <math.h> #if APR_HAVE_CTYPE_H #include <ctype.h> @@ -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 <stddef.h> /* NULL */ @@ -63,24 +63,24 @@ #include <stdlib.h> /* 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 <ctype.h> #include <string.h> -#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 <stddef.h> /* 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 <sys/poll.h> #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 <stdlib.h> @@ -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 <stdlib.h> #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 <stdlib.h> @@ -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 <regex.h> #include <stdio.h> #include <stdlib.h> 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<iters;i++) { regexec( &regex, argv[2], 0, NULL,0) ; } - end=apr_time_now(); - puts(apr_psprintf( context, "Time to run %d regex's %8lld\n",iters,end-now)); - h = apr_hash_make( context); + end=fspr_time_now(); + puts(fspr_psprintf( context, "Time to run %d regex's %8lld\n",iters,end-now)); + h = fspr_hash_make( context); for (i=0;i<70;i++) { - apr_hash_set(h,apr_psprintf(context, "%dkey",i),APR_HASH_KEY_STRING,"1"); + fspr_hash_set(h,fspr_psprintf(context, "%dkey",i),APR_HASH_KEY_STRING,"1"); } - now = apr_time_now(); + now = fspr_time_now(); for (i=0;i<iters;i++) { - apr_hash_get( h, argv[2], APR_HASH_KEY_STRING); + fspr_hash_get( h, argv[2], APR_HASH_KEY_STRING); } - end=apr_time_now(); - puts(apr_psprintf( context, "Time to run %d hash (no find)'s %8lld\n",iters,end-now)); - apr_hash_set(h, argv[2],APR_HASH_KEY_STRING,"1"); - now = apr_time_now(); + end=fspr_time_now(); + puts(fspr_psprintf( context, "Time to run %d hash (no find)'s %8lld\n",iters,end-now)); + fspr_hash_set(h, argv[2],APR_HASH_KEY_STRING,"1"); + now = fspr_time_now(); for (i=0;i<iters;i++) { - apr_hash_get( h, argv[2], APR_HASH_KEY_STRING); + fspr_hash_get( h, argv[2], APR_HASH_KEY_STRING); } - end=apr_time_now(); - puts(apr_psprintf( context, "Time to run %d hash (find)'s %8lld\n",iters,end-now)); + end=fspr_time_now(); + puts(fspr_psprintf( context, "Time to run %d hash (find)'s %8lld\n",iters,end-now)); return 0; } diff --git a/libs/apr/test/internal/testucs.c b/libs/apr/test/internal/testucs.c index ca735d233b..bf1f24a86d 100644 --- a/libs/apr/test/internal/testucs.c +++ b/libs/apr/test/internal/testucs.c @@ -14,8 +14,8 @@ * limitations under the License. */ -#include "apr.h" -#include "arch/win32/apr_arch_utf8.h" +#include "fspr.h" +#include "arch/win32/fspr_arch_utf8.h" #include <wchar.h> #include <string.h> @@ -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 <stdlib.h> @@ -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 <stdio.h> #if APR_HAVE_UNISTD_H #include <unistd.h> @@ -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 <stdlib.h> -#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 <signal.h> #include <stdlib.h> #include <string.h> -#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, &current_file_offset, &len, 0); + rv = fspr_socket_sendfile(sock, f, &hdtr, &current_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, &current_file_offset, &tmplen, 0); - printf("apr_socket_sendfile()->%d, sent %ld bytes\n", rv, (long)tmplen); + rv = fspr_socket_sendfile(sock, f, &hdtr, &current_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, &current_file_offset); + rv = fspr_file_seek(f, APR_CUR, &current_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 <stdlib.h> #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 <apr.h> -#include <apr_general.h> +#include <fspr.h> +#include <fspr_general.h> 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 <stdio.h> #include <stdlib.h> #include <string.h> -#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 <unistd.h> #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(&copy, to, APR_FINFO_SIZE, p); + rv = fspr_stat(&copy, 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 <stdio.h> #include <stdlib.h> @@ -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 <stdio.h> #include <stdlib.h> -#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 <stdlib.h> #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 <string.h> #include <stdlib.h> #include <stdio.h> @@ -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<ALLOC_BYTES;i++) { @@ -55,7 +55,7 @@ static void calloc_bytes(abts_case *tc, void *data) int i; char *alloc; - alloc = apr_pcalloc(pmain, ALLOC_BYTES); + alloc = fspr_pcalloc(pmain, ALLOC_BYTES); ABTS_PTR_NOTNULL(tc, alloc); for (i=0;i<ALLOC_BYTES;i++) { @@ -66,75 +66,75 @@ static void calloc_bytes(abts_case *tc, void *data) static void parent_pool(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_pool_create(&pmain, NULL); + rv = fspr_pool_create(&pmain, NULL); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); ABTS_PTR_NOTNULL(tc, pmain); } static void child_pool(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_pool_create(&pchild, pmain); + rv = fspr_pool_create(&pchild, pmain); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); ABTS_PTR_NOTNULL(tc, pchild); } static void test_ancestor(abts_case *tc, void *data) { - ABTS_INT_EQUAL(tc, 1, apr_pool_is_ancestor(pmain, pchild)); + ABTS_INT_EQUAL(tc, 1, fspr_pool_is_ancestor(pmain, pchild)); } static void test_notancestor(abts_case *tc, void *data) { - ABTS_INT_EQUAL(tc, 0, apr_pool_is_ancestor(pchild, pmain)); + ABTS_INT_EQUAL(tc, 0, fspr_pool_is_ancestor(pchild, pmain)); } -static apr_status_t success_cleanup(void *data) +static fspr_status_t success_cleanup(void *data) { return APR_SUCCESS; } static char *checker_data = "Hello, world."; -static apr_status_t checker_cleanup(void *data) +static fspr_status_t checker_cleanup(void *data) { return data == checker_data ? APR_SUCCESS : APR_EGENERAL; } static void test_cleanups(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int n; /* do this several times to test the cleanup freelist handling. */ for (n = 0; n < 5; n++) { - apr_pool_cleanup_register(pchild, NULL, success_cleanup, + fspr_pool_cleanup_register(pchild, NULL, success_cleanup, success_cleanup); - apr_pool_cleanup_register(pchild, checker_data, checker_cleanup, + fspr_pool_cleanup_register(pchild, checker_data, checker_cleanup, success_cleanup); - apr_pool_cleanup_register(pchild, NULL, checker_cleanup, + fspr_pool_cleanup_register(pchild, NULL, checker_cleanup, success_cleanup); - rv = apr_pool_cleanup_run(p, NULL, success_cleanup); + rv = fspr_pool_cleanup_run(p, NULL, success_cleanup); ABTS_ASSERT(tc, "nullop cleanup run OK", rv == APR_SUCCESS); - rv = apr_pool_cleanup_run(p, checker_data, checker_cleanup); + rv = fspr_pool_cleanup_run(p, checker_data, checker_cleanup); ABTS_ASSERT(tc, "cleanup passed correct data", rv == APR_SUCCESS); - rv = apr_pool_cleanup_run(p, NULL, checker_cleanup); + rv = fspr_pool_cleanup_run(p, NULL, checker_cleanup); ABTS_ASSERT(tc, "cleanup passed correct data", rv == APR_EGENERAL); if (n == 2) { /* clear the pool to check that works */ - apr_pool_clear(pchild); + fspr_pool_clear(pchild); } if (n % 2 == 0) { /* throw another random cleanup into the mix */ - apr_pool_cleanup_register(pchild, NULL, - apr_pool_cleanup_null, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(pchild, NULL, + fspr_pool_cleanup_null, + fspr_pool_cleanup_null); } } } diff --git a/libs/apr/test/testproc.c b/libs/apr/test/testproc.c index b025c8e59d..a21a8be744 100644 --- a/libs/apr/test/testproc.c +++ b/libs/apr/test/testproc.c @@ -14,145 +14,145 @@ * limitations under the License. */ -#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" #include "testutil.h" #define TESTSTR "This is a test" -static apr_proc_t newproc; +static fspr_proc_t newproc; static void test_create_proc(abts_case *tc, void *data) { const char *args[2]; - apr_procattr_t *attr; - apr_file_t *testfile = NULL; - apr_status_t rv; - apr_size_t length; + fspr_procattr_t *attr; + fspr_file_t *testfile = NULL; + fspr_status_t rv; + fspr_size_t length; char *buf; - rv = apr_procattr_create(&attr, p); + rv = fspr_procattr_create(&attr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_io_set(attr, APR_FULL_BLOCK, APR_FULL_BLOCK, + rv = fspr_procattr_io_set(attr, APR_FULL_BLOCK, APR_FULL_BLOCK, APR_NO_PIPE); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_dir_set(attr, "data"); + rv = fspr_procattr_dir_set(attr, "data"); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_cmdtype_set(attr, APR_PROGRAM); + rv = fspr_procattr_cmdtype_set(attr, APR_PROGRAM); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); args[0] = "proc_child" EXTENSION; args[1] = NULL; - rv = apr_proc_create(&newproc, "../proc_child" EXTENSION, args, NULL, + rv = fspr_proc_create(&newproc, "../proc_child" EXTENSION, args, NULL, attr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); testfile = newproc.in; length = strlen(TESTSTR); - rv = apr_file_write(testfile, TESTSTR, &length); + rv = fspr_file_write(testfile, TESTSTR, &length); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(TESTSTR), length); testfile = newproc.out; length = 256; - buf = apr_pcalloc(p, length); - rv = apr_file_read(testfile, buf, &length); + buf = fspr_pcalloc(p, length); + rv = fspr_file_read(testfile, buf, &length); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, TESTSTR, buf); } static void test_proc_wait(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_proc_wait(&newproc, NULL, NULL, APR_WAIT); + rv = fspr_proc_wait(&newproc, NULL, NULL, APR_WAIT); ABTS_INT_EQUAL(tc, APR_CHILD_DONE, rv); } static void test_file_redir(abts_case *tc, void *data) { - apr_file_t *testout = NULL; - apr_file_t *testerr = NULL; - apr_off_t offset; - apr_status_t rv; + fspr_file_t *testout = NULL; + fspr_file_t *testerr = NULL; + fspr_off_t offset; + fspr_status_t rv; const char *args[2]; - apr_procattr_t *attr; - apr_file_t *testfile = NULL; - apr_size_t length; + fspr_procattr_t *attr; + fspr_file_t *testfile = NULL; + fspr_size_t length; char *buf; testfile = NULL; - rv = apr_file_open(&testfile, "data/stdin", + rv = fspr_file_open(&testfile, "data/stdin", APR_READ | APR_WRITE | APR_CREATE | APR_EXCL, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_open(&testout, "data/stdout", + rv = fspr_file_open(&testout, "data/stdout", APR_READ | APR_WRITE | APR_CREATE | APR_EXCL, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_open(&testerr, "data/stderr", + rv = fspr_file_open(&testerr, "data/stderr", APR_READ | APR_WRITE | APR_CREATE | APR_EXCL, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); length = strlen(TESTSTR); - apr_file_write(testfile, TESTSTR, &length); + fspr_file_write(testfile, TESTSTR, &length); offset = 0; - rv = apr_file_seek(testfile, APR_SET, &offset); + rv = fspr_file_seek(testfile, APR_SET, &offset); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File position mismatch, expected 0", offset == 0); - rv = apr_procattr_create(&attr, p); + rv = fspr_procattr_create(&attr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_child_in_set(attr, testfile, NULL); + rv = fspr_procattr_child_in_set(attr, testfile, NULL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_child_out_set(attr, testout, NULL); + rv = fspr_procattr_child_out_set(attr, testout, NULL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_child_err_set(attr, testerr, NULL); + rv = fspr_procattr_child_err_set(attr, testerr, NULL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_dir_set(attr, "data"); + rv = fspr_procattr_dir_set(attr, "data"); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_cmdtype_set(attr, APR_PROGRAM); + rv = fspr_procattr_cmdtype_set(attr, APR_PROGRAM); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); args[0] = "proc_child"; args[1] = NULL; - rv = apr_proc_create(&newproc, "../proc_child" EXTENSION, args, NULL, + rv = fspr_proc_create(&newproc, "../proc_child" EXTENSION, args, NULL, attr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_proc_wait(&newproc, NULL, NULL, APR_WAIT); + rv = fspr_proc_wait(&newproc, NULL, NULL, APR_WAIT); ABTS_INT_EQUAL(tc, APR_CHILD_DONE, rv); offset = 0; - rv = apr_file_seek(testout, APR_SET, &offset); + rv = fspr_file_seek(testout, APR_SET, &offset); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); length = 256; - buf = apr_pcalloc(p, length); - rv = apr_file_read(testout, buf, &length); + buf = fspr_pcalloc(p, length); + rv = fspr_file_read(testout, buf, &length); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, TESTSTR, buf); - apr_file_close(testfile); - apr_file_close(testout); - apr_file_close(testerr); + fspr_file_close(testfile); + fspr_file_close(testout); + fspr_file_close(testerr); - rv = apr_file_remove("data/stdin", p);; + rv = fspr_file_remove("data/stdin", p);; ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_remove("data/stdout", p);; + rv = fspr_file_remove("data/stdout", p);; ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_remove("data/stderr", p);; + rv = fspr_file_remove("data/stderr", p);; ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } diff --git a/libs/apr/test/testprocmutex.c b/libs/apr/test/testprocmutex.c index 013e49f175..2dfc393d01 100644 --- a/libs/apr/test/testprocmutex.c +++ b/libs/apr/test/testprocmutex.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_shm.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_proc_mutex.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_getopt.h" +#include "fspr_shm.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_proc_mutex.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_getopt.h" #include "errno.h" #include <stdio.h> #include <stdlib.h> @@ -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 <errno.h> #include <stdio.h> #include <stdlib.h> @@ -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 <errno.h> #include <stdio.h> #include <stdlib.h> @@ -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 <stdlib.h> @@ -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 <stdlib.h> @@ -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 <stdlib.h> @@ -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 <errno.h> #include <stdio.h> #include <stdlib.h> @@ -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 <limits.h> #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 <stdio.h> #endif @@ -30,11 +30,11 @@ #include <string.h> #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 <time.h> #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 <stdio.h> #include <stdlib.h> -#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 <stdio.h> #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 <stdlib.h> @@ -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 <proc.h> -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 <nks/thread.h> -#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 <assert.h> #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H #include <pthread.h> #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 <signal.h> #include <string.h> #include <sys/wait.h> @@ -34,10 +34,10 @@ #include <process.h> #include <stdlib.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_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<numargs; i++) cmdlen += strlen(newargs[i]) + 3; - cmdline = apr_palloc(pool, cmdlen + 2); + cmdline = fspr_palloc(pool, cmdlen + 2); cmdline_pos = cmdline; for (i=0; i<numargs; i++) { const char *a = newargs[i]; if (strpbrk(a, "&|<>\" ")) - 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 <stdlib.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; @@ -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 <assert.h> #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 <stdlib.h> #if APR_HAVE_SIGNAL_H #include <signal.h> @@ -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 <signal.h> #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 <process.h> #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 <sys/time.h> @@ -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 <time.h> #endif @@ -27,7 +27,7 @@ #endif #include <string.h> #include <winbase.h> -#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 <grp.h> #endif @@ -28,14 +28,14 @@ #include <unistd.h> /* 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 <pwd.h> #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 <grp.h> #endif @@ -28,15 +28,15 @@ #include <unistd.h> /* 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 <pwd.h> #endif @@ -28,17 +28,17 @@ #include <unistd.h> /* 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 <sys/types.h> #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 <sys/types.h> #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 <chris@signalwire.com> Date: Thu, 18 Aug 2022 14:39:44 -0400 Subject: [PATCH 567/655] [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 <apr_pools.h> +#include <fspr_pools.h> -/* 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 <apr_hash.h> +#include <fspr_hash.h> -/* for apr_pvsprintf */ +/* for fspr_pvsprintf */ /* function only used in this file so not exposed */ -#include <apr_strings.h> +#include <fspr_strings.h> -/* for apr_initialize and apr_terminate */ +/* for fspr_initialize and fspr_terminate */ /* function only used in this file so not exposed */ -#include <apr_general.h> +#include <fspr_general.h> -#include <apr_portable.h> +#include <fspr_portable.h> 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 <EM>pool</EM> 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. * </PRE> * @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 * </PRE> - * @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 * <PRE> * 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 * <PRE> * 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 <apr.h> -#include <apr_atomic.h> -#include <apr_pools.h> -#include <apr_hash.h> -#include <apr_network_io.h> -#include <apr_errno.h> -#include <apr_thread_proc.h> -#include <apr_portable.h> -#include <apr_thread_mutex.h> -#include <apr_thread_cond.h> -#include <apr_thread_rwlock.h> -#include <apr_file_io.h> -#include <apr_poll.h> -#include <apr_strings.h> +#include <fspr.h> +#include <fspr_atomic.h> +#include <fspr_pools.h> +#include <fspr_hash.h> +#include <fspr_network_io.h> +#include <fspr_errno.h> +#include <fspr_thread_proc.h> +#include <fspr_portable.h> +#include <fspr_thread_mutex.h> +#include <fspr_thread_cond.h> +#include <fspr_thread_rwlock.h> +#include <fspr_file_io.h> +#include <fspr_poll.h> +#include <fspr_strings.h> #define APR_WANT_STDIO #define APR_WANT_STRFUNC -#include <apr_want.h> -#include <apr_file_info.h> -#include <apr_fnmatch.h> -#include <apr_tables.h> +#include <fspr_want.h> +#include <fspr_file_info.h> +#include <fspr_fnmatch.h> +#include <fspr_tables.h> #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 <apr_lib.h> +/* fspr_vformatter_buff_t definition*/ +#include <fspr_lib.h> #if (defined(HAVE_LIBMD5) || defined(HAVE_LIBMD) || defined(HAVE_MD5INIT)) #include <md5.h> @@ -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 <apr.h> -#include <apr_thread_proc.h> -#include <apr_thread_mutex.h> -#include <apr_thread_cond.h> +#include <fspr.h> +#include <fspr_thread_mutex.h> +#include <fspr_thread_cond.h> /* * 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 <switch.h> #include "private/switch_core_pvt.h" -/* for apr_pstrcat */ -#include <apr_strings.h> +/* for fspr_pstrcat */ +#include <fspr_strings.h> -/* for apr_env_get and apr_env_set */ -#include <apr_env.h> +/* for fspr_env_get and fspr_env_set */ +#include <fspr_env.h> -/* for apr file and directory handling */ -#include <apr_file_io.h> +/* for fspr file and directory handling */ +#include <fspr_file_io.h> 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 <switch_private.h> #endif #include <switch_stun.h> -#include <apr_network_io.h> +#include <fspr_network_io.h> #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 <andywolk@gmail.com> Date: Fri, 19 Aug 2022 02:51:59 +0300 Subject: [PATCH 568/655] [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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>libaprutil</ProjectName> - <ProjectGuid>{F057DA7F-79E5-4B00-845C-EF446EF055E3}</ProjectGuid> - <RootNamespace>libaprutil</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extdll.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extdll.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extdll.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extdll.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> - <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> - <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> - <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" type "$(ProjectDir)..\..\apr-util\include\apr_ldap.hw" &gt; "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" -if not exist "$(ProjectDir)..\..\apr-util\include\apu.h" type "$(ProjectDir)..\..\apr-util\include\apu.hw" &gt; "$(ProjectDir)..\..\apr-util\include\apu.h" -if not exist "$(ProjectDir)..\..\apr-util\include\apu_config.h" type "$(ProjectDir)..\..\apr-util\include\apu_config.hw" &gt; "$(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" &gt; "$(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" &gt; "$(ProjectDir)..\..\apr-util\include\apu_want.h" -xcopy "$(ProjectDir)..\..\apr-util\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y -</Command> - </PreBuildEvent> - <ClCompile> - <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - <DisableSpecificWarnings>4244;4018;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;APU_VERSION_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - <AdditionalIncludeDirectories>..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr-1.2.7\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - <Link> - <AdditionalDependencies>ws2_32.lib;mswsock.lib;wldap32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SuppressStartupBanner>true</SuppressStartupBanner> - <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <BaseAddress>0x6EE60000</BaseAddress> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <TargetMachine>MachineX86</TargetMachine> - </Link> - <Bscmake> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Bscmake> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" type "$(ProjectDir)..\..\apr-util\include\apr_ldap.hw" &gt; "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" -if not exist "$(ProjectDir)..\..\apr-util\include\apu.h" type "$(ProjectDir)..\..\apr-util\include\apu.hw" &gt; "$(ProjectDir)..\..\apr-util\include\apu.h" -if not exist "$(ProjectDir)..\..\apr-util\include\apu_config.h" type "$(ProjectDir)..\..\apr-util\include\apu_config.hw" &gt; "$(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" &gt; "$(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" &gt; "$(ProjectDir)..\..\apr-util\include\apu_want.h" -xcopy "$(ProjectDir)..\..\apr-util\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y -</Command> - </PreBuildEvent> - <ClCompile> - <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_DEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - <DisableSpecificWarnings>4244;4018;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;APU_VERSION_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - <AdditionalIncludeDirectories>..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr-1.2.7\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - <Link> - <AdditionalDependencies>ws2_32.lib;mswsock.lib;wldap32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SuppressStartupBanner>true</SuppressStartupBanner> - <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <BaseAddress>0x6EE60000</BaseAddress> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <TargetMachine>MachineX64</TargetMachine> - </Link> - <Bscmake> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Bscmake> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" type "$(ProjectDir)..\..\apr-util\include\apr_ldap.hw" &gt; "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" -if not exist "$(ProjectDir)..\..\apr-util\include\apu.h" type "$(ProjectDir)..\..\apr-util\include\apu.hw" &gt; "$(ProjectDir)..\..\apr-util\include\apu.h" -if not exist "$(ProjectDir)..\..\apr-util\include\apu_config.h" type "$(ProjectDir)..\..\apr-util\include\apu_config.hw" &gt; "$(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" &gt; "$(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" &gt; "$(ProjectDir)..\..\apr-util\include\apu_want.h" -xcopy "$(ProjectDir)..\..\apr-util\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y -</Command> - </PreBuildEvent> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <FunctionLevelLinking>true</FunctionLevelLinking> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - <DisableSpecificWarnings>4244;4018;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;APU_VERSION_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - <AdditionalIncludeDirectories>..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr-1.2.7\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - <Link> - <AdditionalDependencies>ws2_32.lib;mswsock.lib;wldap32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SuppressStartupBanner>true</SuppressStartupBanner> - <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <BaseAddress>0x6EE60000</BaseAddress> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <TargetMachine>MachineX86</TargetMachine> - </Link> - <Bscmake> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Bscmake> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" type "$(ProjectDir)..\..\apr-util\include\apr_ldap.hw" &gt; "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" -if not exist "$(ProjectDir)..\..\apr-util\include\apu.h" type "$(ProjectDir)..\..\apr-util\include\apu.hw" &gt; "$(ProjectDir)..\..\apr-util\include\apu.h" -if not exist "$(ProjectDir)..\..\apr-util\include\apu_config.h" type "$(ProjectDir)..\..\apr-util\include\apu_config.hw" &gt; "$(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" &gt; "$(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" &gt; "$(ProjectDir)..\..\apr-util\include\apu_want.h" -xcopy "$(ProjectDir)..\..\apr-util\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y -</Command> - </PreBuildEvent> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>NDEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <FunctionLevelLinking>true</FunctionLevelLinking> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - <DisableSpecificWarnings>4244;4018;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;APU_VERSION_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - <AdditionalIncludeDirectories>..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr-1.2.7\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - <Link> - <AdditionalDependencies>ws2_32.lib;mswsock.lib;wldap32.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SuppressStartupBanner>true</SuppressStartupBanner> - <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Windows</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <BaseAddress>0x6EE60000</BaseAddress> - <RandomizedBaseAddress>false</RandomizedBaseAddress> - <TargetMachine>MachineX64</TargetMachine> - </Link> - <Bscmake> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Bscmake> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\apr-util\buckets\apr_brigade.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_alloc.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_eos.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_file.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_flush.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_heap.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_mmap.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_pipe.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_pool.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_refcount.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_simple.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\buckets\apr_buckets_socket.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\crypto\apr_md4.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\crypto\apr_md5.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\crypto\apr_sha1.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\crypto\getuuid.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\crypto\uuid.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbd\apr_dbd.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbd\apr_dbd_pgsql.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbd\apr_dbd_sqlite2.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbd\apr_dbd_sqlite3.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbm\apr_dbm.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbm\apr_dbm_berkeleydb.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbm\apr_dbm_gdbm.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbm\apr_dbm_sdbm.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\encoding\apr_base64.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\hooks\apr_hooks.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\ldap\apr_ldap_init.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\ldap\apr_ldap_option.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\ldap\apr_ldap_url.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\misc\apr_date.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\misc\apr_queue.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\misc\apr_reslist.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\misc\apr_rmm.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbm\sdbm\sdbm.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbm\sdbm\sdbm_hash.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbm\sdbm\sdbm_lock.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\dbm\sdbm\sdbm_pair.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\strmatch\apr_strmatch.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\uri\apr_uri.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\xlate\xlate.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\xml\apr_xml.c" /> - </ItemGroup> - <ItemGroup> - <CustomBuildStep Include="..\..\apr-util\dbm\sdbm\sdbm_pair.h"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </CustomBuildStep> - <CustomBuildStep Include="..\..\apr-util\dbm\sdbm\sdbm_private.h"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </CustomBuildStep> - <CustomBuildStep Include="..\..\apr-util\dbm\sdbm\sdbm_tune.h"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - </CustomBuildStep> - <ClInclude Include="..\..\apr-util\include\apr_anylock.h" /> - <ClInclude Include="..\..\apr-util\include\apr_base64.h" /> - <ClInclude Include="..\..\apr-util\include\apr_buckets.h" /> - <ClInclude Include="..\..\apr-util\include\apr_date.h" /> - <ClInclude Include="..\..\apr-util\include\apr_dbm.h" /> - <ClInclude Include="..\..\apr-util\include\apr_hooks.h" /> - <ClInclude Include="..\..\apr-util\include\apr_ldap_url.h" /> - <ClInclude Include="..\..\apr-util\include\apr_md4.h" /> - <ClInclude Include="..\..\apr-util\include\apr_md5.h" /> - <ClInclude Include="..\..\apr-util\include\apr_optional.h" /> - <ClInclude Include="..\..\apr-util\include\apr_optional_hooks.h" /> - <ClInclude Include="..\..\apr-util\include\apr_queue.h" /> - <ClInclude Include="..\..\apr-util\include\apr_reslist.h" /> - <ClInclude Include="..\..\apr-util\include\apr_rmm.h" /> - <ClInclude Include="..\..\apr-util\include\apr_sdbm.h" /> - <ClInclude Include="..\..\apr-util\include\apr_sha1.h" /> - <ClInclude Include="..\..\apr-util\include\apr_strmatch.h" /> - <ClInclude Include="..\..\apr-util\include\apr_uri.h" /> - <ClInclude Include="..\..\apr-util\include\apr_uuid.h" /> - <ClInclude Include="..\..\apr-util\include\apr_xlate.h" /> - <ClInclude Include="..\..\apr-util\include\apr_xml.h" /> - <ClInclude Include="..\..\apr-util\include\apu_version.h" /> - </ItemGroup> - <ItemGroup> - <None Include="..\..\apr-util\include\apr_ldap.h.in" /> - <None Include="..\..\apr-util\include\apr_ldap.hnw" /> - <CustomBuild Include="..\..\apr-util\include\apr_ldap.hw"> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Creating apr_ldap.h from apr_ldap.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw &gt; ..\..\apr-util\include\apr_ldap.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\apr-util\include\apr_ldap.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Creating apr_ldap.h from apr_ldap.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw &gt; ..\..\apr-util\include\apr_ldap.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\apr-util\include\apr_ldap.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating apr_ldap.h from apr_ldap.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw &gt; ..\..\apr-util\include\apr_ldap.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\apr-util\include\apr_ldap.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Creating apr_ldap.h from apr_ldap.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw &gt; ..\..\apr-util\include\apr_ldap.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\apr-util\include\apr_ldap.h;%(Outputs)</Outputs> - </CustomBuild> - <None Include="..\..\apr-util\include\apu.h.in" /> - <None Include="..\..\apr-util\include\apu.hnw" /> - <CustomBuild Include="..\..\apr-util\include\apu.hw"> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Creating apu.h from apu.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw &gt; ..\..\apr-util\include\apu.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\apr-util\include\apu.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Creating apu.h from apu.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw &gt; ..\..\apr-util\include\apu.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\apr-util\include\apu.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating apu.h from apu.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw &gt; ..\..\apr-util\include\apu.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\apr-util\include\apu.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Creating apu.h from apu.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw &gt; ..\..\apr-util\include\apu.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\apr-util\include\apu.h;%(Outputs)</Outputs> - </CustomBuild> - <None Include="..\..\apr-util\include\private\apu_config.h.in" /> - <CustomBuild Include="..\..\apr-util\include\private\apu_config.hw"> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Creating apu_config.h from apu_config.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw &gt; ..\..\apr-util\include\private\apu_config.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\apr-util\include\private\apu_config.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Creating apu_config.h from apu_config.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw &gt; ..\..\apr-util\include\private\apu_config.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\apr-util\include\private\apu_config.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating apu_config.h from apu_config.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw &gt; ..\..\apr-util\include\private\apu_config.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\apr-util\include\private\apu_config.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Creating apu_config.h from apu_config.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw &gt; ..\..\apr-util\include\private\apu_config.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\apr-util\include\private\apu_config.h;%(Outputs)</Outputs> - </CustomBuild> - <None Include="..\..\apr-util\include\private\apu_select_dbm.h.in" /> - <CustomBuild Include="..\..\apr-util\include\private\apu_select_dbm.hw"> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Creating apu_select_dbm.h from apu_select_dbm.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw &gt; ..\..\apr-util\include\private\apu_select_dbm.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\apr-util\include\private\apu_select_dbm.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Creating apu_select_dbm.h from apu_select_dbm.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw &gt; ..\..\apr-util\include\private\apu_select_dbm.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\apr-util\include\private\apu_select_dbm.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating apu_select_dbm.h from apu_select_dbm.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw &gt; ..\..\apr-util\include\private\apu_select_dbm.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\apr-util\include\private\apu_select_dbm.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Creating apu_select_dbm.h from apu_select_dbm.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw &gt; ..\..\apr-util\include\private\apu_select_dbm.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\apr-util\include\private\apu_select_dbm.h;%(Outputs)</Outputs> - </CustomBuild> - <None Include="..\..\apr-util\include\apu_want.h.in" /> - <None Include="..\..\apr-util\include\apu_want.hnw" /> - <CustomBuild Include="..\..\apr-util\include\apu_want.hw"> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Creating apu_want.h from apu_want.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw &gt; ..\..\apr-util\include\apu_want.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\apr-util\include\apu_want.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Creating apu_want.h from apu_want.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw &gt; ..\..\apr-util\include\apu_want.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\apr-util\include\apu_want.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating apu_want.h from apu_want.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw &gt; ..\..\apr-util\include\apu_want.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\apr-util\include\apu_want.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Creating apu_want.h from apu_want.hw</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw &gt; ..\..\apr-util\include\apu_want.h -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\apr-util\include\apu_want.h;%(Outputs)</Outputs> - </CustomBuild> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="..\..\apr-util\libaprutil.rc"> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - </ResourceCompile> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\apr\libapr.2017.vcxproj"> - <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> - </ProjectReference> - <ProjectReference Include="xml.2017.vcxproj"> - <Project>{155844c3-ec5f-407f-97a4-a2ddaded9b2f}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>xml</ProjectName> - <ProjectGuid>{155844C3-EC5F-407F-97A4-A2DDADED9B2F}</ProjectGuid> - <RootNamespace>xml</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\..\..\w32\extlib.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\xml\$(Configuration)\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\xml\$(Configuration)\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\xml\$(Configuration)\</IntDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\xml\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <AdditionalIncludeDirectories>$(ProjectDir)..\..\apr-util\xml\expat\lib\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;VERSION="expat_1.95.2";%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <FunctionLevelLinking>true</FunctionLevelLinking> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <ResourceCompile> - <Culture>0x0409</Culture> - </ResourceCompile> - <Lib> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Lib> - <Bscmake> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Bscmake> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <AdditionalIncludeDirectories>$(ProjectDir)..\..\apr-util\xml\expat\lib\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;VERSION="expat_1.95.2";%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <FunctionLevelLinking>true</FunctionLevelLinking> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <ResourceCompile> - <Culture>0x0409</Culture> - </ResourceCompile> - <Lib> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Lib> - <Bscmake> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Bscmake> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(ProjectDir)..\..\apr-util\xml\expat\lib\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;VERSION="expat_1.95.2";%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <ResourceCompile> - <Culture>0x0409</Culture> - </ResourceCompile> - <Lib> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Lib> - <Bscmake> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Bscmake> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Midl> - <TargetEnvironment>X64</TargetEnvironment> - </Midl> - <ClCompile> - <AdditionalOptions>/EHsc %(AdditionalOptions)</AdditionalOptions> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>$(ProjectDir)..\..\apr-util\xml\expat\lib\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;VERSION="expat_1.95.2";%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> - <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <ResourceCompile> - <Culture>0x0409</Culture> - </ResourceCompile> - <Lib> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Lib> - <Bscmake> - <SuppressStartupBanner>true</SuppressStartupBanner> - </Bscmake> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\apr-util\xml\expat\lib\xmlparse.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\xml\expat\lib\xmlrole.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\xml\expat\lib\xmltok.c"> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\xml\expat\lib\xmltok_impl.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <ClCompile Include="..\..\apr-util\xml\expat\lib\xmltok_ns.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> - <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\apr-util\xml\expat\lib\ascii.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\asciitab.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\config.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\expat.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\iasciitab.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\latin1tab.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\nametab.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\utf8tab.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\xmlrole.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\xmltok.h" /> - <ClInclude Include="..\..\apr-util\xml\expat\lib\xmltok_impl.h" /> - <CustomBuild Include="..\..\apr-util\xml\expat\lib\winconfig.h"> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Creating config.h from winconfig.h</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h" &gt; "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Creating config.h from winconfig.h</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h" &gt; "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating config.h from winconfig.h</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h" &gt; "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Creating config.h from winconfig.h</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h" &gt; "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h;%(Outputs)</Outputs> - </CustomBuild> - </ItemGroup> - <ItemGroup> - <CustomBuild Include="..\..\apr-util\xml\expat\lib\expat.h.in"> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Creating expat.h from expat.h.in</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in" &gt; "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Creating expat.h from expat.h.in</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in" &gt; "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating expat.h from expat.h.in</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in" &gt; "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h;%(Outputs)</Outputs> - <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Creating expat.h from expat.h.in</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in" &gt; "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" -</Command> - <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h;%(Outputs)</Outputs> - </CustomBuild> - <None Include="..\..\apr-util\xml\expat\lib\ReadMe.txt" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\apr\include\apr.h" type "$(ProjectDir)apr.hw" &gt; "$(ProjectDir)..\..\apr\include\apr.h" + <Command>if not exist "$(ProjectDir)..\..\apr\include\fspr.h" type "$(ProjectDir)fspr.hw" &gt; "$(ProjectDir)..\..\apr\include\fspr.h" xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y </Command> </PreBuildEvent> @@ -109,7 +109,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D / </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\apr\include\apr.h" type "$(ProjectDir)apr.hw" &gt; "$(ProjectDir)..\..\apr\include\apr.h" + <Command>if not exist "$(ProjectDir)..\..\apr\include\fspr.h" type "$(ProjectDir)fspr.hw" &gt; "$(ProjectDir)..\..\apr\include\fspr.h" xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y </Command> </PreBuildEvent> @@ -143,7 +143,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D / </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\apr\include\apr.h" type "$(ProjectDir)apr.hw" &gt; "$(ProjectDir)..\..\apr\include\apr.h" + <Command>if not exist "$(ProjectDir)..\..\apr\include\fspr.h" type "$(ProjectDir)fspr.hw" &gt; "$(ProjectDir)..\..\apr\include\fspr.h" xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y </Command> </PreBuildEvent> @@ -180,7 +180,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D / </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\apr\include\apr.h" type "$(ProjectDir)apr.hw" &gt; "$(ProjectDir)..\..\apr\include\apr.h" + <Command>if not exist "$(ProjectDir)..\..\apr\include\fspr.h" type "$(ProjectDir)fspr.hw" &gt; "$(ProjectDir)..\..\apr\include\fspr.h" xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y </Command> </PreBuildEvent> @@ -216,7 +216,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D / </Bscmake> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\..\apr\atomic\win32\apr_atomic.c" /> + <ClCompile Include="..\..\apr\atomic\win32\fspr_atomic.c" /> <ClCompile Include="..\..\apr\dso\win32\dso.c" /> <ClCompile Include="..\..\apr\file_io\unix\copy.c" /> <ClCompile Include="..\..\apr\file_io\win32\dir.c" /> @@ -238,7 +238,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D / <ClCompile Include="..\..\apr\locks\win32\thread_cond.c" /> <ClCompile Include="..\..\apr\locks\win32\thread_mutex.c" /> <ClCompile Include="..\..\apr\locks\win32\thread_rwlock.c" /> - <ClCompile Include="..\..\apr\memory\unix\apr_pools.c" /> + <ClCompile Include="..\..\apr\memory\unix\fspr_pools.c" /> <ClCompile Include="..\..\apr\misc\win32\charset.c" /> <ClCompile Include="..\..\apr\misc\win32\env.c" /> <ClCompile Include="..\..\apr\misc\unix\errorcodes.c" /> @@ -260,19 +260,19 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D / <ClCompile Include="..\..\apr\network_io\unix\sockaddr.c" /> <ClCompile Include="..\..\apr\network_io\win32\sockets.c" /> <ClCompile Include="..\..\apr\network_io\win32\sockopt.c" /> - <ClCompile Include="..\..\apr\passwd\apr_getpass.c" /> - <ClCompile Include="..\..\apr\random\unix\apr_random.c" /> + <ClCompile Include="..\..\apr\passwd\fspr_getpass.c" /> + <ClCompile Include="..\..\apr\random\unix\fspr_random.c" /> <ClCompile Include="..\..\apr\random\unix\sha2.c" /> <ClCompile Include="..\..\apr\random\unix\sha2_glue.c" /> <ClCompile Include="..\..\apr\shmem\win32\shm.c" /> - <ClCompile Include="..\..\apr\strings\apr_cpystrn.c" /> - <ClCompile Include="..\..\apr\strings\apr_fnmatch.c" /> - <ClCompile Include="..\..\apr\strings\apr_snprintf.c" /> - <ClCompile Include="..\..\apr\strings\apr_strings.c" /> - <ClCompile Include="..\..\apr\strings\apr_strnatcmp.c" /> - <ClCompile Include="..\..\apr\strings\apr_strtok.c" /> - <ClCompile Include="..\..\apr\tables\apr_hash.c" /> - <ClCompile Include="..\..\apr\tables\apr_tables.c" /> + <ClCompile Include="..\..\apr\strings\fspr_cpystrn.c" /> + <ClCompile Include="..\..\apr\strings\fspr_fnmatch.c" /> + <ClCompile Include="..\..\apr\strings\fspr_snprintf.c" /> + <ClCompile Include="..\..\apr\strings\fspr_strings.c" /> + <ClCompile Include="..\..\apr\strings\fspr_strnatcmp.c" /> + <ClCompile Include="..\..\apr\strings\fspr_strtok.c" /> + <ClCompile Include="..\..\apr\tables\fspr_hash.c" /> + <ClCompile Include="..\..\apr\tables\fspr_tables.c" /> <ClCompile Include="..\..\apr\threadproc\win32\proc.c" /> <ClCompile Include="..\..\apr\threadproc\win32\signals.c" /> <ClCompile Include="..\..\apr\threadproc\win32\thread.c" /> @@ -284,52 +284,52 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D / <ClCompile Include="..\..\apr\user\win32\userinfo.c" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_atime.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_dso.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_file_io.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_inherit.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_misc.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_networkio.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_thread_mutex.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_thread_rwlock.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_threadproc.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_utf8.h" /> - <ClInclude Include="..\..\apr\include\arch\win32\apr_private.h" /> - <ClInclude Include="..\..\apr\include\arch\apr_private_common.h" /> - <ClInclude Include="..\..\apr\include\apr_allocator.h" /> - <ClInclude Include="..\..\apr\include\apr_atomic.h" /> - <ClInclude Include="..\..\apr\include\apr_dso.h" /> - <ClInclude Include="..\..\apr\include\apr_env.h" /> - <ClInclude Include="..\..\apr\include\apr_errno.h" /> - <ClInclude Include="..\..\apr\include\apr_file_info.h" /> - <ClInclude Include="..\..\apr\include\apr_file_io.h" /> - <ClInclude Include="..\..\apr\include\apr_fnmatch.h" /> - <ClInclude Include="..\..\apr\include\apr_general.h" /> - <ClInclude Include="..\..\apr\include\apr_getopt.h" /> - <ClInclude Include="..\..\apr\include\apr_global_mutex.h" /> - <ClInclude Include="..\..\apr\include\apr_hash.h" /> - <ClInclude Include="..\..\apr\include\apr_inherit.h" /> - <ClInclude Include="..\..\apr\include\apr_lib.h" /> - <ClInclude Include="..\..\apr\include\apr_mmap.h" /> - <ClInclude Include="..\..\apr\include\apr_network_io.h" /> - <ClInclude Include="..\..\apr\include\apr_poll.h" /> - <ClInclude Include="..\..\apr\include\apr_pools.h" /> - <ClInclude Include="..\..\apr\include\apr_portable.h" /> - <ClInclude Include="..\..\apr\include\apr_proc_mutex.h" /> - <ClInclude Include="..\..\apr\include\apr_ring.h" /> - <ClInclude Include="..\..\apr\include\apr_shm.h" /> - <ClInclude Include="..\..\apr\include\apr_signal.h" /> - <ClInclude Include="..\..\apr\include\apr_strings.h" /> - <ClInclude Include="..\..\apr\include\apr_support.h" /> - <ClInclude Include="..\..\apr\include\apr_tables.h" /> - <ClInclude Include="..\..\apr\include\apr_thread_cond.h" /> - <ClInclude Include="..\..\apr\include\apr_thread_mutex.h" /> - <ClInclude Include="..\..\apr\include\apr_thread_proc.h" /> - <ClInclude Include="..\..\apr\include\apr_thread_rwlock.h" /> - <ClInclude Include="..\..\apr\include\apr_time.h" /> - <ClInclude Include="..\..\apr\include\apr_user.h" /> - <ClInclude Include="..\..\apr\include\apr_version.h" /> - <ClInclude Include="..\..\apr\include\apr_want.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_atime.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_dso.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_file_io.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_inherit.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_misc.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_networkio.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_thread_mutex.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_thread_rwlock.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_threadproc.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_arch_utf8.h" /> + <ClInclude Include="..\..\apr\include\arch\win32\fspr_private.h" /> + <ClInclude Include="..\..\apr\include\arch\fspr_private_common.h" /> + <ClInclude Include="..\..\apr\include\fspr_allocator.h" /> + <ClInclude Include="..\..\apr\include\fspr_atomic.h" /> + <ClInclude Include="..\..\apr\include\fspr_dso.h" /> + <ClInclude Include="..\..\apr\include\fspr_env.h" /> + <ClInclude Include="..\..\apr\include\fspr_errno.h" /> + <ClInclude Include="..\..\apr\include\fspr_file_info.h" /> + <ClInclude Include="..\..\apr\include\fspr_file_io.h" /> + <ClInclude Include="..\..\apr\include\fspr_fnmatch.h" /> + <ClInclude Include="..\..\apr\include\fspr_general.h" /> + <ClInclude Include="..\..\apr\include\fspr_getopt.h" /> + <ClInclude Include="..\..\apr\include\fspr_global_mutex.h" /> + <ClInclude Include="..\..\apr\include\fspr_hash.h" /> + <ClInclude Include="..\..\apr\include\fspr_inherit.h" /> + <ClInclude Include="..\..\apr\include\fspr_lib.h" /> + <ClInclude Include="..\..\apr\include\fspr_mmap.h" /> + <ClInclude Include="..\..\apr\include\fspr_network_io.h" /> + <ClInclude Include="..\..\apr\include\fspr_poll.h" /> + <ClInclude Include="..\..\apr\include\fspr_pools.h" /> + <ClInclude Include="..\..\apr\include\fspr_portable.h" /> + <ClInclude Include="..\..\apr\include\fspr_proc_mutex.h" /> + <ClInclude Include="..\..\apr\include\fspr_ring.h" /> + <ClInclude Include="..\..\apr\include\fspr_shm.h" /> + <ClInclude Include="..\..\apr\include\fspr_signal.h" /> + <ClInclude Include="..\..\apr\include\fspr_strings.h" /> + <ClInclude Include="..\..\apr\include\fspr_support.h" /> + <ClInclude Include="..\..\apr\include\fspr_tables.h" /> + <ClInclude Include="..\..\apr\include\fspr_thread_cond.h" /> + <ClInclude Include="..\..\apr\include\fspr_thread_mutex.h" /> + <ClInclude Include="..\..\apr\include\fspr_thread_proc.h" /> + <ClInclude Include="..\..\apr\include\fspr_thread_rwlock.h" /> + <ClInclude Include="..\..\apr\include\fspr_time.h" /> + <ClInclude Include="..\..\apr\include\fspr_user.h" /> + <ClInclude Include="..\..\apr\include\fspr_version.h" /> + <ClInclude Include="..\..\apr\include\fspr_want.h" /> </ItemGroup> <ItemGroup> <ResourceCompile Include="..\..\apr\libapr.rc"> 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 @@ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <PrecompiledHeader> </PrecompiledHeader> - <DisableSpecificWarnings>4505;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <DisableSpecificWarnings>4505;6553;%(DisableSpecificWarnings)</DisableSpecificWarnings> <TreatWarningAsError>true</TreatWarningAsError> </ClCompile> <Link> @@ -178,7 +178,7 @@ <PrecompiledHeader> </PrecompiledHeader> <TreatWarningAsError>true</TreatWarningAsError> - <DisableSpecificWarnings>4505;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <DisableSpecificWarnings>4505;6553;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>shlwapi.lib;mscoree.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -196,7 +196,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <PrecompiledHeader> </PrecompiledHeader> - <DisableSpecificWarnings>4505;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <DisableSpecificWarnings>4505;6553;%(DisableSpecificWarnings)</DisableSpecificWarnings> <IntrinsicFunctions>true</IntrinsicFunctions> </ClCompile> <Link> @@ -217,7 +217,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <PrecompiledHeader> </PrecompiledHeader> - <DisableSpecificWarnings>4505;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <DisableSpecificWarnings>4505;6553;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <ModuleDefinitionFile> @@ -237,7 +237,7 @@ <PrecompiledHeader> </PrecompiledHeader> <TreatWarningAsError>true</TreatWarningAsError> - <DisableSpecificWarnings>4505;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <DisableSpecificWarnings>4505;6553;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>shlwapi.lib;mono.lib;C:\program Files\Mono\lib\glib-2.0.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -261,7 +261,7 @@ <PrecompiledHeader> </PrecompiledHeader> <TreatWarningAsError>true</TreatWarningAsError> - <DisableSpecificWarnings>4505;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <DisableSpecificWarnings>4505;6553;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>shlwapi.lib;mono.lib;C:\program Files\Mono\lib\glib-2.0.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -283,7 +283,7 @@ <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> - <DisableSpecificWarnings>4505;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <DisableSpecificWarnings>4505;6553;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <ModuleDefinitionFile> @@ -305,7 +305,7 @@ <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> - <DisableSpecificWarnings>4505;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <DisableSpecificWarnings>4505;6553;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <ModuleDefinitionFile> 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 <openssl/md5.h> #endif +#ifndef WIN32 #include <uuid/uuid.h> +#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 <switch.h> #include <fspr.h> #include <fspr_thread_mutex.h> #include <fspr_thread_cond.h> 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 <glob.h> #else /* we're on windoze :( */ /* glob functions at end of this file */ -#include <apr_file_io.h> +#include <fspr_file_io.h> 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\" </ClCompile> <ClCompile Include="..\..\src\switch_core_video.c" /> <ClCompile Include="..\..\src\switch_apr.c" /> + <ClCompile Include="..\..\src\switch_apr_queue.c" /> <ClCompile Include="..\..\src\switch_buffer.c"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> @@ -799,10 +800,6 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <Project>{eef031cb-fed8-451e-a471-91ec8d4f6750}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> - <ProjectReference Include="..\..\libs\win32\apr-util\libaprutil.2017.vcxproj"> - <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> <ProjectReference Include="..\..\libs\win32\apr\libapr.2017.vcxproj"> <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> From 193316b244a22df1a8a2c7986e2924f1937c345c Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 29 Aug 2022 17:50:06 +0300 Subject: [PATCH 569/655] [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 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLFOLDER</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\..\src\mod\asr_tts\mod_unimrcp\mod_unimrcp.2017.vcxproj"> - <Name>mod_unimrcp</Name> - <Project>{d07c378a-f5f7-438f-adf3-4ac4fb1883cd}</Project> - <Private>True</Private> - <DoNotHarvest>True</DoNotHarvest> - <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> - <RefTargetDir>INSTALLFOLDER</RefTargetDir> - </ProjectReference> <ProjectReference Include="..\..\src\mod\codecs\mod_amr\mod_amr.2017.vcxproj"> <Name>mod_amr</Name> <Project>{8deb383c-4091-4f42-a56f-c9e46d552d79}</Project> @@ -529,14 +521,6 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLFOLDER</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\..\src\mod\endpoints\mod_dingaling\mod_dingaling.2017.vcxproj"> - <Name>mod_dingaling</Name> - <Project>{ffaa4c52-3a53-4f99-90c1-d59d1f0427f3}</Project> - <Private>True</Private> - <DoNotHarvest>True</DoNotHarvest> - <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> - <RefTargetDir>INSTALLFOLDER</RefTargetDir> - </ProjectReference> <ProjectReference Include="..\..\src\mod\endpoints\mod_gsmopen\mod_gsmopen.2017.vcxproj"> <Name>mod_gsmopen</Name> <Project>{74b120ff-6935-4dfe-a142-cdb6bea99c90}</Project> From 9311ee7dc2ec6ca6292c7bf3f44c3ab970e71608 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 29 Aug 2022 18:23:14 +0300 Subject: [PATCH 570/655] [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 @@ -<configuration name="dingaling.conf" description="XMPP Jingle Endpoint"> - <settings> - <param name="debug" value="0"/> - <param name="codec-prefs" value="H264,PCMU"/> - </settings> - - <X-PRE-PROCESS cmd="include" data="../jingle_profiles/*.xml"/> - -</configuration> From 91799e0fc78aa68f41c7dd78e9892761ac51e871 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 30 Aug 2022 00:17:52 +0300 Subject: [PATCH 571/655] [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 <andywolk@gmail.com> Date: Tue, 30 Aug 2022 01:08:39 +0300 Subject: [PATCH 572/655] [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 <andywolk@gmail.com> Date: Tue, 30 Aug 2022 01:41:22 +0300 Subject: [PATCH 573/655] [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 @@ -<include> - <!-- Client Profile (Original mode) --> - <!-- to use this profile take the x- away from the open and close tags so its <profile> and </profile> --> - <x-profile type="client"> - <param name="name" value="$${xmpp_client_profile}"/> - <param name="login" value="myjid@myserver.com/talk"/> - <param name="password" value="mypass"/> - <param name="dialplan" value="XML"/> - <param name="context" value="public"/> - <param name="message" value="Jingle all the way"/> - <param name="rtp-ip" value="$${bind_server_ip}"/> - <!-- <param name="ext-rtp-ip" value="auto-nat"/> --> - <param name="auto-login" value="true"/> - <!-- SASL "plain" or "md5" --> - <param name="sasl" value="plain"/> - <!-- if the server where the jabber is hosted is not the same as the one in the jid --> - <!--<param name="server" value="alternate.server.com"/>--> - <!-- Enable TLS or not --> - <param name="tls" value="true"/> - <!-- disable to trade async for more calls --> - <param name="use-rtp-timer" value="true"/> - <!-- default extension (if one cannot be determined) --> - <param name="exten" value="888"/> - <!-- VAD choose one --> - <!-- <param name="vad" value="in"/> --> - <!-- <param name="vad" value="out"/> --> - <!--<param name="vad" value="both"/>--> - <!--<param name="avatar" value="/path/to/tiny.jpg"/>--> - <!--<param name="candidate-acl" value="wan.auto"/>--> - <param name="local-network-acl" value="localnet.auto"/> - - <!-- google voice does not work on this yet ....ikr... --> - <!--<param name="use-jingle" value="true"/>--> - - </x-profile> -</include> 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 @@ -<include> - <!-- Component (Server to Server Login) --> - <!-- to use this profile take the x- away from the open and close tags so its <profile> and </profile> --> - <x-profile type="component"> - <param name="name" value="$${xmpp_server_profile}"/> - <param name="password" value="secret"/> - <param name="dialplan" value="XML"/> - <param name="context" value="public"/> - <param name="rtp-ip" value="$${bind_server_ip}"/> - <param name="server" value="jabber.server.org:5347"/> - <!-- disable to trade async for more calls --> - <param name="use-rtp-timer" value="true"/> - <!-- "_auto_" means the extension will be automaticly set to the called jid --> - <param name="exten" value="_auto_"/> - <!--<param name="vad" value="both"/>--> - <!--<param name="avatar" value="/path/to/tiny.jpg"/>--> - <!--If you have ODBC support and a working dsn you can use it instead of SQLite--> - <!--<param name="odbc-dsn" value="dsn:user:pass"/>--> - <!--<param name="candidate-acl" value="wan.auto"/>--> - </x-profile> -</include> From 741d1632844eec670d1ab31cc074e7011a2431d3 Mon Sep 17 00:00:00 2001 From: Len <Len-PGH@users.noreply.github.com> Date: Tue, 6 Sep 2022 11:16:20 -0400 Subject: [PATCH 574/655] [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 @@ +<configuration name="signalwire.conf" description="SignalWire"> + <settings> + <!-- on/off/file-path --> + <!--<param name="kslog" value="on"/>--> + <!--<param name="blade-bootstrap" value="blade://switchblade:2100"/>--> + <!--<param name="adoption-service" value="https://adopt.signalwire.com/adoption"/>--> + <!--<param name="stun-server" value="stun.freeswitch.org"/>--> + <!--<param name="caller-id-in-from" value="true"/>--> + <!--<authentication></authentication>--> + + <!-- override dialplan context for calls on connector --> + <!--<param name="override-context" value="signalwire"/--> + </settings> +</configuration> From 82cec3104ea63bd91182454aee84ab61e5fce7cb Mon Sep 17 00:00:00 2001 From: Len <Len-PGH@users.noreply.github.com> Date: Tue, 6 Sep 2022 15:30:35 -0400 Subject: [PATCH 575/655] [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 <jakub.karolczyk@signalwire.com> Date: Fri, 9 Sep 2022 11:07:19 +0100 Subject: [PATCH 576/655] [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 <clock.00.smith@gmail.com> Date: Wed, 5 Oct 2022 01:19:10 +0800 Subject: [PATCH 577/655] [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" <kvishnivetsky@users.noreply.github.com> Date: Thu, 6 Oct 2022 13:12:05 +0400 Subject: [PATCH 578/655] [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 <udmitry@mail.ru> Date: Thu, 6 Oct 2022 13:15:41 +0400 Subject: [PATCH 579/655] [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 @@ <!-- Or, if you have PGSQL support, you can use that --> <!--<param name="odbc-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />--> + <!-- By default each profile will give the database 1000 ms to spin-up on load --> + <!--<param name="db-spin-up-wait-ms" value="1000" />--> + <!--Uncomment to set all inbound calls to no media mode--> <!--<param name="inbound-bypass-media" value="true"/>--> 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 <andywolk@gmail.com> Date: Fri, 14 Oct 2022 18:11:17 +0000 Subject: [PATCH 580/655] 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; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 <andywolk@gmail.com> Date: Sat, 15 Oct 2022 01:16:48 +0300 Subject: [PATCH 581/655] 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 <andywolk@gmail.com> Date: Thu, 20 Oct 2022 18:54:05 +0300 Subject: [PATCH 582/655] [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 <andywolk@gmail.com> Date: Tue, 25 Oct 2022 12:19:58 +0300 Subject: [PATCH 583/655] [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?= <zbuzanic@gmail.com> Date: Wed, 26 Oct 2022 19:53:01 +0200 Subject: [PATCH 584/655] [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 <andywolk@gmail.com> Date: Fri, 28 Oct 2022 00:27:55 +0300 Subject: [PATCH 585/655] [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 <dragos@signalwire.com> Date: Fri, 28 Oct 2022 18:34:18 +0300 Subject: [PATCH 586/655] [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 <drh@hwaci.com> 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 @@ <param name="auth-calls" value="false"/> <param name="rtp-timeout-sec" value="1800"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) --> <!-- DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS! --> 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 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> <!-- <param name="accept-blind-reg" value="true"/> --> 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 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> <!-- <param name="accept-blind-reg" value="true"/> --> 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 @@ <!-- <param name="rtp-start-port" value="16384"/> --> <!-- <param name="rtp-end-port" value="32768"/> --> - <param name="rtp-enable-zrtp" value="true"/> - <!-- Native PostgreSQL support was removed from the FreeSWITCH Core! ================================= diff --git a/conf/rayo/sip_profiles/external.xml b/conf/rayo/sip_profiles/external.xml index 952e6c7848..2b601fbb38 100644 --- a/conf/rayo/sip_profiles/external.xml +++ b/conf/rayo/sip_profiles/external.xml @@ -57,7 +57,6 @@ <param name="nonce-ttl" value="60"/> <param name="auth-calls" value="$${external_auth_calls}"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) --> <!-- DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS! --> 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 @@ <X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/> <X-PRE-PROCESS cmd="set" data="use_profile=external"/> - <!-- - Enable ZRTP globally you can override this on a per channel basis - - http://wiki.freeswitch.org/wiki/ZRTP (on how to enable zrtp) - --> - <X-PRE-PROCESS cmd="set" data="zrtp_secure_media=true"/> - <X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA"/> <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA"/> 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 @@ <param name="auth-calls" value="false"/> <param name="rtp-timeout-sec" value="1800"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) --> <!-- DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS! --> 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 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> <!-- <param name="accept-blind-reg" value="true"/> --> 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 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> <!-- <param name="accept-blind-reg" value="true"/> --> 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 @@ <!-- Test each port to make sure it is not in use by some other process before allocating it to RTP --> <!-- <param name="rtp-port-usage-robustness" value="true"/> --> - <param name="rtp-enable-zrtp" value="true"/> - <!-- Native PostgreSQL support was removed from the FreeSWITCH Core! ================================= diff --git a/conf/testing/sip_profiles/external-ipv6.xml b/conf/testing/sip_profiles/external-ipv6.xml index be6e65efe4..1ac8414731 100644 --- a/conf/testing/sip_profiles/external-ipv6.xml +++ b/conf/testing/sip_profiles/external-ipv6.xml @@ -51,7 +51,6 @@ <param name="nonce-ttl" value="60"/> <param name="auth-calls" value="false"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) --> <!-- DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS! --> 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 @@ <param name="nonce-ttl" value="60"/> <param name="auth-calls" value="false"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) --> <!-- DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS! --> 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 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> <!-- <param name="accept-blind-reg" value="true"/> --> 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 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> <!-- <param name="accept-blind-reg" value="true"/> --> 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 @@ <X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/> <X-PRE-PROCESS cmd="set" data="use_profile=external"/> <X-PRE-PROCESS cmd="set" data="rtp_sdes_suites=AEAD_AES_256_GCM_8|AEAD_AES_128_GCM_8|AES_CM_256_HMAC_SHA1_80|AES_CM_192_HMAC_SHA1_80|AES_CM_128_HMAC_SHA1_80|AES_CM_256_HMAC_SHA1_32|AES_CM_192_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_32|AES_CM_128_NULL_AUTH"/> - <X-PRE-PROCESS cmd="set" data="zrtp_secure_media=true"/> <X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,G722,PCMU,PCMA,VP8,H264,H263,H263-1998,G7221@32000h"/> <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=OPUS,G722,PCMU,PCMA,VP8,H264,H263,H263-1998,G7221@32000h"/> <X-PRE-PROCESS cmd="set" data="outbound_caller_name=FreeSWITCH"/> 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 @@ <!-- Test each port to make sure it is not in use by some other process before allocating it to RTP --> <!-- <param name="rtp-port-usage-robustness" value="true"/> --> - <param name="rtp-enable-zrtp" value="false"/> - <!-- Store encryption keys for secure media in channel variables and call CDRs. Default: false. WARNING: If true, anyone with CDR access can decrypt secure media! diff --git a/conf/vanilla/dialplan/default.xml b/conf/vanilla/dialplan/default.xml index 7f7ff6fa35..c3edafc1c8 100644 --- a/conf/vanilla/dialplan/default.xml +++ b/conf/vanilla/dialplan/default.xml @@ -443,10 +443,6 @@ This will take the SAS from the b-leg and send it to the display on the a-leg phone. Known working with Polycom and Snom maybe others. --> - <!-- - <action application="set" data="exec_after_bridge_app=${sched_api(+4 zrtp expand uuid_display ${uuid} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas1_string )} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas2_string )} )}"/> - <action application="export" data="nolocal:zrtp_secure_media=true"/> - --> <action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/> </condition> </extension> @@ -768,13 +764,6 @@ </condition> </extension> - <!-- install zrtp_agent.lua into scripts (ZRTP == 9787) --> - <extension name="zrtp_enrollement"> - <condition field="destination_number" expression="^9787$"> - <action application="lua" data="zrtp_agent.lua"/> - </condition> - </extension> - <!-- You will no longer hear the bong tone. The wav file is playing stating the call is secure. The file will not play unless you have both TLS and SRTP active. @@ -786,10 +775,8 @@ <action application="answer"/> <action application="execute_extension" data="is_secure XML features"/> <action application="playback" data="$${hold_music}"/> - <anti-action application="set" data="zrtp_secure_media=true"/> <anti-action application="answer"/> <anti-action application="playback" data="silence_stream://2000"/> - <anti-action application="execute_extension" data="is_zrtp_secure XML features"/> <anti-action application="playback" data="$${hold_music}"/> </condition> </extension> diff --git a/conf/vanilla/dialplan/features.xml b/conf/vanilla/dialplan/features.xml index 665925f964..0612aa5544 100644 --- a/conf/vanilla/dialplan/features.xml +++ b/conf/vanilla/dialplan/features.xml @@ -44,15 +44,7 @@ <action application="transfer" data="$1 XML default"/> </condition> </extension> - - <extension name="is_zrtp_secure" continue="true"> - <condition field="${zrtp_secure_media_confirmed}" expression="^true$"> - <action application="sleep" data="1000"/> - <action application="playback" data="misc/call_secured.wav"/> - <anti-action application="eval" data="not_secure"/> - </condition> - </extension> - + <extension name="is_secure" continue="true"> <!-- Only Truly consider it secure if its TLS and SRTP --> <condition field="${sip_via_protocol}" expression="tls"/> 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 @@ <param name="nonce-ttl" value="60"/> <param name="auth-calls" value="false"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) --> <!-- DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS! --> 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 @@ <param name="nonce-ttl" value="60"/> <param name="auth-calls" value="false"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) --> <!-- DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS! --> 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 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> <!-- <param name="accept-blind-reg" value="true"/> --> 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 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> <!-- <param name="accept-blind-reg" value="true"/> --> 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 @@ <X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/> <X-PRE-PROCESS cmd="set" data="use_profile=external"/> <X-PRE-PROCESS cmd="set" data="rtp_sdes_suites=AEAD_AES_256_GCM_8|AEAD_AES_128_GCM_8|AES_CM_256_HMAC_SHA1_80|AES_CM_192_HMAC_SHA1_80|AES_CM_128_HMAC_SHA1_80|AES_CM_256_HMAC_SHA1_32|AES_CM_192_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_32|AES_CM_128_NULL_AUTH"/> - <!-- - Enable ZRTP globally you can override this on a per channel basis - - http://wiki.freeswitch.org/wiki/ZRTP (on how to enable zrtp) - --> - <X-PRE-PROCESS cmd="set" data="zrtp_secure_media=true"/> <!-- NOTICE: When using SRTP it's critical that you do not offer or accept variable bit rate codecs, doing so would leak information and possibly diff --git a/configure.ac b/configure.ac index 9b87103dae..b2bd0ad876 100644 --- a/configure.ac +++ b/configure.ac @@ -601,13 +601,6 @@ have_openal=no AC_CHECK_LIB(openal, alcLoopbackOpenDeviceSOFT, [have_openal="yes"]) AM_CONDITIONAL([HAVE_OPENAL],[test "${have_openal}" = "yes"]) -AC_ARG_ENABLE(zrtp, - [AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"]) -if test "x$enable_zrtp" = "xyes" ; then - LIBS="-lpthread $LIBS" - APR_ADDTO(SWITCH_AM_CFLAGS, -DENABLE_ZRTP) -fi - PA_LIBS= PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no) @@ -622,8 +615,6 @@ fi AC_SUBST(PA_LIBS) -AM_CONDITIONAL([ENABLE_ZRTP],[test "x$enable_zrtp" != "xno"]) - AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"]) AC_ARG_ENABLE(core-odbc-support, @@ -2330,9 +2321,6 @@ if test "$use_system_apr" != "yes"; then AC_CONFIG_SUBDIRS([libs/apr]) fi AC_CONFIG_SUBDIRS([libs/iksemel]) -if test "x${enable_zrtp}" = "xyes"; then - AC_CONFIG_SUBDIRS([libs/libzrtp]) -fi case $host in *-openbsd*|*-netbsd*) diff --git a/debian/copyright b/debian/copyright index 01473e4940..5a76744817 100644 --- a/debian/copyright +++ b/debian/copyright @@ -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 <drh@hwaci.com> diff --git a/debian/license-reconcile.yml b/debian/license-reconcile.yml index 9cd5742d3f..22fdb40a19 100644 --- a/debian/license-reconcile.yml +++ b/debian/license-reconcile.yml @@ -23,11 +23,6 @@ Rules: - Glob: libs/srtp/update.sh Copyright: Ingate Systems AB - - - Glob: libs/libzrtp/third_party/bnlib/test/md5.c - Matches: This\scode\sis\sin\sthe\spublic\sdomain;\sdo\swith\sit\swhat\syou\swish. - Copyright: 1995 Abandoned Colin Plumb - License: public-domain - Glob: src/g711.c Matches: Copyright\s\(C\)\s2006\sSteve\sUnderwood @@ -56,28 +51,6 @@ Rules: Glob: src/include/switch_cpp.h Matches: Author[:]\sYossi\sNeiman\s<freeswitch@cartissolutions.com>,\s\(C\)\s2007////\sCopyright[:] Copyright: 2007 Yossi Neiman <freeswitch@cartissolutions.com> - - - Glob: libs/libzrtp/* - Matches: For\slicensing\sand\sother\slegal\sdetails,\ssee\sthe\sfile\szrtp_legal.c. - License: AGPL-3 or MPL-1.1 - - - Glob: libs/libzrtp/third_party/bnlib/* - Matches: For\slicensing\sand\sother\slegal\sdetails,\ssee\sthe\sfile\slegal.c. - License: GPL-2 or GPL-3 or MPL-1.1 - - - Glob: libs/libzrtp/src/zrtp_legal.c - Matches: As\sa\sspecial\sexception,\syou\smay\scombine\sthis\slibrary\swith\sthe\scode - Matches: License\sVersion\s1.1\s\(MPLv1.1\). - License: AGPL-3 or MPL-1.1 - - - Glob: libs/libzrtp/third_party/bnlib/legal.c - Matches: As\sa\sspecial\sexception,\syou\smay\scombine\sthis\slibrary\swith\sthe\scode - Matches: License\sVersion\s1.1\s\(MPLv1.1\). - License: GPL-2 or GPL-3 or MPL-1.1 - - - Glob: libs/libzrtp/projects/symbian/DelayRuner.h - Matches: Copyright\s+:\sCopyright\s\(c\)\s2010\sSoft\sIndustry - Copyright: 2010 Soft Industry - Glob: libs/win32/sqlite/*.[ch] Matches: The\sauthor\sdisclaims\scopyright\sto\sthis\ssource\scode. diff --git a/debian/rules b/debian/rules index c11f733e8c..88aaee3f71 100755 --- a/debian/rules +++ b/debian/rules @@ -74,7 +74,7 @@ override_dh_auto_clean: --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr --localstatedir=/var --sysconfdir=/etc \ --with-gnu-ld --with-python --with-python3 --with-erlang --with-openssl \ - --enable-core-odbc-support --enable-zrtp + --enable-core-odbc-support touch $@ override_dh_auto_configure: .stamp-configure diff --git a/docs/phrase/phrase_de.xml b/docs/phrase/phrase_de.xml index 52d453ea01..aa55e396d2 100644 --- a/docs/phrase/phrase_de.xml +++ b/docs/phrase/phrase_de.xml @@ -814,24 +814,6 @@ <prompt phrase="Das ist eine ungültige Durchwahl." filename="invalid_extension.wav"/> <prompt phrase="Englisch." filename="en.wav"/> </misc> - <zrtp> - <!-- Event prompts --> - <prompt phrase="Willkommen bei der Anmeldung zum Z R T P Sicherheits-System." filename="zrtp-enroll_welcome.wav"/> - <prompt phrase="Sie müssen den Authentisierungs-String mit Ihrem Gesprächspartner vergleichen. Wenn er nicht übereinstimmt, ist dies ein Hinweis darauf, dass das Gespräch abgehört wird." filename="zrtp-check_sas.wav"/> - <prompt phrase="Nur authentisierte Telefone können so konfiguriert werden, dass sie diesem System vertrauen bezüglich der Vermittlung von Verbindungen die mit Z R T P gesichert sind. Ihr Telefon ist nicht authentisiert, daher wird dieser Anruf nicht vermittelt." filename="zrtp-enroll_not_sip_registered.wav"/> - <prompt phrase="Ihr Telefon signalisiert, dass es diesem System bereits vertraut bezüglich der Vermittlung von Verbindungen die mit Z R T P gesichert sind. Sie müssen deshalb nichts weiter tun." filename="zrtp-enroll_already_enrolled.wav"/> - <prompt phrase="Nur Telefone, die das Z R T P Protokoll unterstützen, können diese Nebenstelle Nutzen. Ihr Telefon unterstützt Z R T P nicht, daher wird dieser Anruf nicht vermittelt." filename="zrtp-enroll_notzrtp.wav"/> - <prompt phrase="Dieses System ist für die Verarbeitung von mit Z R T P verschlüsselten Telefonanrufen ausgestattet. Sie müssen entscheiden, ob Sie zulassen möchten, dass dieses System Ihre sicheren Telefonanrufe abfangen und möglicherweise überwachen kann. Sie können auflegen, nachdem Sie dies getan haben." filename="zrtp-enroll_confirmed.wav"/> - <prompt phrase="Vergleichen Sie diesen Authentifizierungscode mit Ihrem Gesprächspartner, indem Sie sich diesen Code vorlesen." filename="zrtp-is_secure.wav"/> - <prompt phrase="Der Authentifizierungscode ist derzeit nicht überprüft." filename="zrtp-is_unverified.wav"/> - <prompt phrase="Der Authentifizierungscode ist jetzt überprüft." filename="zrtp-is_verified.wav"/> - <prompt phrase="Vielen Dank für Ihren Anruf. Auf Wiedersehen." filename="zrtp-thankyou_goodbye.wav"/> - <prompt phrase="Etwas stimmt nicht." filename="zrtp-somethings_wrong.wav"/> - <prompt phrase="Fehler." filename="zrtp-status_error.wav"/> - <prompt phrase="Verbindung ist nicht sicher." filename="zrtp-status_notsecure.wav"/> - <prompt phrase="Verbindung ist sicher." filename="zrtp-status_secure.wav"/> - <prompt phrase="Sichere die Verbindung." filename="zrtp-status_securing.wav"/> - </zrtp> </de> </language> <!-- diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index e47ca4f987..44a6173243 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -1253,24 +1253,6 @@ <prompt phrase="woodlark" filename="woodlark.wav"/> <prompt phrase="yesteryear" filename="yesteryear.wav"/> </base256> - <zrtp> - <!-- Event prompts --> - <prompt phrase="Welcome to the ZRTP security enrollment agent." filename="zrtp-enroll_welcome.wav"/> - <prompt phrase="You must check the authentication string with your partner. If it doesn't match, it indicates the presence of a wire tapper." filename="zrtp-check_sas.wav"/> - <prompt phrase="Only phones that are authenticated can be configured to trust this system to relay ZRTP secured calls. Your phone is not authenticated with this system, so this call will have no effect." filename="zrtp-enroll_not_sip_registered.wav"/> - <prompt phrase="Your phone indicates that it already trusts this system to relay ZRTP secured calls, so you do not need to do anything more." filename="zrtp-enroll_already_enrolled.wav"/> - <prompt phrase="Only phones equipped with the ZRTP protocol can use this extension. Your phone is not a ZRTP-enable phone, so this call will have no effect." filename="zrtp-enroll_notzrtp.wav"/> - <prompt phrase="This system is equipped to handle ZRTP encrypted phone calls. You must decide if you want to allow this system to be in a position to intercept and possibly monitor your secure phone calls. You may hang up after you've done this." filename="zrtp-enroll_confirmed.wav"/> - <prompt phrase="Verbally compare this authentication code with your partner." filename="zrtp-is_secure.wav"/> - <prompt phrase="Authentication code is now unverified." filename="zrtp-is_unverified.wav"/> - <prompt phrase="Authentication code is now verified." filename="zrtp-is_verified.wav"/> - <prompt phrase="Thank you for calling. Goodbye." filename="zrtp-thankyou_goodbye.wav"/> - <prompt phrase="Something's wrong" filename="zrtp-somethings_wrong.wav"/> - <prompt phrase="Error." filename="zrtp-status_error.wav"/> - <prompt phrase="Call is not secure." filename="zrtp-status_notsecure.wav"/> - <prompt phrase="Call is secure." filename="zrtp-status_secure.wav"/> - <prompt phrase="Securing call." filename="zrtp-status_securing.wav"/> - </zrtp> </en> </language> <!-- diff --git a/docs/phrase/phrase_es_ES.xml b/docs/phrase/phrase_es_ES.xml index d3ab9fd310..661e9547c2 100644 --- a/docs/phrase/phrase_es_ES.xml +++ b/docs/phrase/phrase_es_ES.xml @@ -992,23 +992,5 @@ <prompt phrase="woodlark" filename="woodlark.wav"/> <prompt phrase="yesteryear" filename="yesteryear.wav"/> </base256> - <zrtp> - <!-- Event prompts --> - <prompt phrase="Bienvenidos al servicio de inscripción ZRTP." filename="zrtp-enroll_welcome.wav"/> - <prompt phrase="Usted debe verificar la cadena de caracteres con su destino. Si no coincide, indica la presencia de una escucha telefónica." filename="zrtp-check_sas.wav"/> - <prompt phrase="Solo teléfonos autenticados pueden confiar en llamadas securizadas con ZRTP. Su teléfono no está autenticado con este sistema, por lo que esta llamada no estará securizada." filename="zrtp-enroll_not_sip_registered.wav"/> - <prompt phrase="Su teléfono indica que confía en este sistema para realizar llamadas seguras con ZRTP, no necesita hacer nada más." filename="zrtp-enroll_already_enrolled.wav"/> - <prompt phrase="Solo teléfonos soportando el protocolo ZRTP pueden usar esta extensión. Su teléfono no tiene ZRTP habilitado, por lo que esta llamada no estará securizada." filename="zrtp-enroll_notzrtp.wav"/> - <prompt phrase="Este sistema está configurado para manejar llamadas cifradas con ZRTP. Decida si permite al sistema tener la posibilidad de interceptar o monitorizar su llamada. Puede colgar una vez confirmado." filename="zrtp-enroll_confirmed.wav"/> - <prompt phrase="Compara verbalmente este código de autenticación con su destino." filename="zrtp-is_secure.wav"/> - <prompt phrase="El código de autenticación no está verificado." filename="zrtp-is_unverified.wav"/> - <prompt phrase="El código de autenticación está verificado." filename="zrtp-is_verified.wav"/> - <prompt phrase="Gracias por llamar. Adiós." filename="zrtp-thankyou_goodbye.wav"/> - <prompt phrase="Algún error ha ocurrido." filename="zrtp-somethings_wrong.wav"/> - <prompt phrase="Error." filename="zrtp-status_error.wav"/> - <prompt phrase="Esta llamada no está protegida." filename="zrtp-status_notsecure.wav"/> - <prompt phrase="Esta llamada está protegida." filename="zrtp-status_secure.wav"/> - <prompt phrase="Securizando su llamada." filename="zrtp-status_securing.wav"/> - </zrtp> </es_ES> </language> 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 @@ <prompt phrase="woodlark" filename="woodlark.wav"/> <prompt phrase="yesteryear" filename="yesteryear.wav"/> </base256> - <zrtp> - <!-- Event prompts --> - <prompt phrase="Bienvenidos al servicio de inscripción ZRTP." filename="zrtp-enroll_welcome.wav"/> - <prompt phrase="Usted debe verificar la cadena de caracteres con su destino. Si no coincide, indica la presencia de una escucha telefónica." filename="zrtp-check_sas.wav"/> - <prompt phrase="Solo teléfonos autenticados pueden confiar en llamadas seguras con ZRTP. Su teléfono no está autenticado con este sistema, su llamada no estará securizada." filename="zrtp-enroll_not_sip_registered.wav"/> - <prompt phrase="Su teléfono indica que confía en este sistema para realizar llamadas seguras con ZRTP, no necesita hacer nada más." filename="zrtp-enroll_already_enrolled.wav"/> - <prompt phrase="Solo teléfonos soportando el protocolo ZRTP pueden usar esta extensión. Su teléfono no tiene ZRTP habilitado, y está llamada no será securizada." filename="zrtp-enroll_notzrtp.wav"/> - <prompt phrase="Este sistema está configurado para manejar llamadas cifradas con ZRTP. Decida si permite al sistema tener la posibilidad de interceptar o monitorizar su llamada. Puede colgar una vez confirmado." filename="zrtp-enroll_confirmed.wav"/> - <prompt phrase="Compara verbalmente este código de autenticación con su destino." filename="zrtp-is_secure.wav"/> - <prompt phrase="El código de autenticación no está verificado." filename="zrtp-is_unverified.wav"/> - <prompt phrase="El código de autenticación está verificado." filename="zrtp-is_verified.wav"/> - <prompt phrase="Gracias por llamar. Adiós." filename="zrtp-thankyou_goodbye.wav"/> - <prompt phrase="Algún error ha ocurrido." filename="zrtp-somethings_wrong.wav"/> - <prompt phrase="Error." filename="zrtp-status_error.wav"/> - <prompt phrase="Esta llamada no está protegida." filename="zrtp-status_notsecure.wav"/> - <prompt phrase="Esta llamada está protegida." filename="zrtp-status_secure.wav"/> - <prompt phrase="Securizando su llamada." filename="zrtp-status_securing.wav"/> - </zrtp> </es_MX> </language> 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 @@ <prompt phrase="woodlark" filename="woodlark.wav"/> <prompt phrase="yesteryear" filename="yesteryear.wav"/> </base256> - <zrtp> - <!-- Event prompts --> - <prompt phrase="Bem-vindo ao agente de registro de segurança ZRTP." filename="zrtp-enroll_welcome.wav"/> - <prompt phrase="Você deve verificar a autentificação com o seu destinatário. Se não coincidir, isso indica presença de um dispositivo de escuta telefonica." filename="zrtp-check_sas.wav"/> - <prompt phrase="Somente aqueles telefones que estão autentificados podem ser configurados de maneira segura neste sistema para retransmitir as ligações em ZRTP. O seu telefone não está autentificado com este sistema, esta ligação não será realizada." filename="zrtp-enroll_not_sip_registered.wav"/> - <prompt phrase="O seu telefone indica que é seguro este sistema para realizar ligações seguras em ZRTP, você não precisa fazer nada mais." filename="zrtp-enroll_already_enrolled.wav"/> - <prompt phrase="Somente os telefones equipados com protocolo ZRTP podem usar este ramal. O seu telefone não esta configurado para ZRTP, esta ligação não sera completada." filename="zrtp-enroll_notzrtp.wav"/> - <prompt phrase="Este sistema está configurado para realizar ligações telefónicas encriptadas em ZRTP. Você deve decidir se permitira que este sistema possa interceptar e monitorizar as suas ligações telefónicas seguras. Pode finalizar a ligação depois disso." filename="zrtp-enroll_confirmed.wav"/> - <prompt phrase="Compare verbalmente este código de autentificação com o seu destinatário." filename="zrtp-is_secure.wav"/> - <prompt phrase="O código de autentificação não foi verificado." filename="zrtp-is_unverified.wav"/> - <prompt phrase="O código de autentificação foi verificado." filename="zrtp-is_verified.wav"/> - <prompt phrase="Obrigado pela sua ligação. Até logo." filename="zrtp-thankyou_goodbye.wav"/> - <prompt phrase="Algo falha." filename="zrtp-somethings_wrong.wav"/> - <prompt phrase="Erro." filename="zrtp-status_error.wav"/> - <prompt phrase="A ligação não e segura." filename="zrtp-status_notsecure.wav"/> - <prompt phrase="A ligação é segura." filename="zrtp-status_secure.wav"/> - <prompt phrase="Securizando a ligação." filename="zrtp-status_securing.wav"/> - </zrtp> </pt_BR> </language> 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 @@ <prompt phrase="woodlark" filename="woodlark.wav"/> <prompt phrase="yesteryear" filename="yesteryear.wav"/> </base256> - <zrtp> - <!-- Event prompts --> - <prompt phrase="Bem-vindo ao agente de registo ZRTP." filename="zrtp-enroll_welcome.wav"/> - <prompt phrase="Deve verificar a chave de autenticação com destinatário. Se não for igual, indica a presença de uma escuta." filename="zrtp-check_sas.wav"/> - <prompt phrase="Apenas telefones que estão autenticados podem ser configurados para usarem este sistema de retransmissão ZRTP para chamadas com modo de segurança activo. Se o seu telefone não está autenticado com o sistema, esta chamada não terá qualquer efeito." filename="zrtp-enroll_not_sip_registered.wav"/> - <prompt phrase="O seu telefone indica que já confia neste sistema de retransmissão ZRTP para chamadas com o modo de segurança activo, portanto você já não precisa de fazer mais nada." filename="zrtp-enroll_already_enrolled.wav"/> - <prompt phrase="Apenas telefones equipados com o protocolo ZRTP podem usar esta extensão. O seu telefone não suporta ZRTP, portanto esta chamada não terá qualquer efeito." filename="zrtp-enroll_notzrtp.wav"/> - <prompt phrase="Este sistema está preparado para suportar chamadas telefónicas encriptadas em ZRTP. Você deve determinar se deseja permitir que o sistema possa interceptar ou gravar as suas chamadas telefónicas com o modo de segurança activado. Você pode desligar após confirmar este comportamento." filename="zrtp-enroll_confirmed.wav"/> - <prompt phrase="Comparando verbalmente o código desta autenticação com o destinatário." filename="zrtp-is_secure.wav"/> - <prompt phrase="O código de autenticação não foi verificado." filename="zrtp-is_unverified.wav"/> - <prompt phrase="O código de autenticação foi verificado." filename="zrtp-is_verified.wav"/> - <prompt phrase="Obrigado por telefonar. Até breve." filename="zrtp-thankyou_goodbye.wav"/> - <prompt phrase="Algo está errado" filename="zrtp-somethings_wrong.wav"/> - <prompt phrase="Erro." filename="zrtp-status_error.wav"/> - <prompt phrase="O modo de segurança não está activo na chamada." filename="zrtp-status_notsecure.wav"/> - <prompt phrase="O modo de segurança está activo na chamada." filename="zrtp-status_secure.wav"/> - <prompt phrase="Activando o modo de segurança na chamada." filename="zrtp-status_securing.wav"/> - </zrtp> </pt_PT> </language> 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 @@ <prompt phrase="woodlark" filename="woodlark.wav"/> <prompt phrase="yesteryear" filename="yesteryear.wav"/> </base256> - <zrtp> - <!-- Event prompts --> - <prompt phrase="Добро пожаловать в агента регистрации шифрования ZRTP" filename="zrtp-enroll_welcome.wav"/> - <!-- Welcome to the ZRTP security enrollment agent. --> - <prompt phrase="Вы должны выбрать строку аутентификации с партнером по разговору, Если она не совпадет, система сообщит Вам разрывом линии." filename="zrtp-check_sas.wav"/> - <!-- You must check the authentication string with your partner. If it doesn't match, it indicates the presence of a wire tapper. --> - <prompt phrase="Только телефоны, прошедшие аутентификацию, могут быть сконфигурированы для доверия системе для обеспечения ZRTP шифрованных звонков, так что такой звонок не даст эффекта." filename="zrtp-enroll_not_sip_registered.wav"/> - <!-- Only phones that are authenticated can be configured to trust this system to relay ZRTP secured calls. Your phone is not authenticated with this system, so this call will have no effect. --> - <prompt phrase="Ваш телефон сообщит, что он уже доверяет системе для перенаправления ZRTP шифрованных звонков, так что больше делать ничего не нужно будет" filename="zrtp-enroll_already_enrolled.wav"/> - <!-- Your phone indicates that it already trusts this system to relay ZRTP secured calls, so you do not need to do anything more. --> - <prompt phrase="Только телефоны, с поддержкой протокола ZRTP могут использовать такую функцию. Ваш телефон не поддерживает ZRTP протокол и звонок не даст эффекта ZRTP защиты." filename="zrtp-enroll_notzrtp.wav"/> - <!-- Only phones equipped with the ZRTP protocol can use this extension. Your phone is not a ZRTP-enable phone, so this call will have no effect.--> - <prompt phrase="Система оборудована для проведения шифрованных ZRTP звонков. Вы должны решить, если вы хотите чтобы система была задействована для приема и возможно мониторинга Ваших защищенных звонков. Вы можете повесить трубку после окончания разговора." filename="zrtp-enroll_confirmed.wav"/> - <!-- This system is equipped to handle ZRTP encrypted phone calls. You must decide if you want to allow this system to be in a position to intercept and possibly monitor your secure phone calls. You may hang up after you've done this. --> - <prompt phrase="Договоритесь с партнером по разговору о парольной фразе." filename="zrtp-is_secure.wav"/> - <!-- Verbally compare this authentication code with your partner. --> - <prompt phrase="Парольная фраза на данный момент не проверена" filename="zrtp-is_unverified.wav"/> - <!-- Authentication code is now unverified. --> - <prompt phrase="Парольная фраза проверена." filename="zrtp-is_verified.wav"/> - <!-- Authentication code is now verified. --> - <prompt phrase="Спасибо за звонок. До свидания." filename="zrtp-thankyou_goodbye.wav"/> - <!-- Thank you for calling. Goodbye. --> - <prompt phrase="Что-то происходит не так." filename="zrtp-somethings_wrong.wav"/> - <!-- Something's wrong --> - <prompt phrase="Ошибка." filename="zrtp-status_error.wav"/> - <!-- Error. --> - <prompt phrase="Ваш разговор не шифруется" filename="zrtp-status_notsecure.wav"/> - <!-- Call is not secure. --> - <prompt phrase="Ваш разговор шифруется." filename="zrtp-status_secure.wav"/> - <!-- Call is secure. --> - <prompt phrase="Шифрованный вызов." filename="zrtp-status_securing.wav"/> - <!-- Securing call. --> - </zrtp> <users> <prompt phrase="Для отправки факса" filename="to_send_a_fax.wav"/> <prompt phrase="Абонент с номером ... не отвечает, пожалуйста..." filename="no_answer_please.wav"/> 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 <v.krikun at zfoneproject.com> - -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 <v.krikun at zfoneproject.com> - */ - -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: <c>Commands: <dir>\ml /c /Cx -/coff /Fo $(TargetDir)\$(InputName).obj $(InputPath) Outputs: $(TargetDir)\$(InputName).obj -</c> where <dir> 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 <v.krikun@soft-industry.com> <v.krikun@gmail.com> -# - -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 <v.krikun at zfoneproject.com> -# - -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 <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> 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 <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> 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 -# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> -# Qt Help Project / Custom Filters</a>. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> -# Qt Help Project / Filter Attributes</a>. - -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 <v.krikun at zfoneproject.com> - -/** - * \file changelog.dox - * \brief libzrtp ChangeLog - */ - -/*! -\page changelog ChangeLog - -**************************************************************************************************** -\section v120 libzrtp v1.20 build XXX (ZRTP RFC 6189, protocol 1.1) -**************************************************************************************************** - -<b>This release is focused</b> 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 - <c>"./configure --enable-enterprise".</c> By default libzrtp will be build with no ECDH support. - -<HR> -***\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) -**************************************************************************************************** -<HR> -***\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) -**************************************************************************************************** -<HR> -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) -**************************************************************************************************** -<HR> -***\subsection v081_bugs Bug - *- [LZRTP-161] <b>Improvement in ZRTP state-machine</b>\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] <b>Fixed "Secure Since" logic.</b>\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] <b>Implement algorithms negotiation according to ZRTP ID v15 section 4.1.2</b>\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] <b>Zfone Ping response implemented.</b>\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] <b>New ZRTP security event was added.</b>\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] <b>New Project files to build libzrtp on Windows CE.</b>\n - Check ./projects/win_ce directory to find appropriate Microsoft Visual Studio projects. - - - -**************************************************************************************************** -\section v080 Release Notes - libzrtp - Version 0.80 -**************************************************************************************************** -<HR> -***\subsection v080_bugs Bug - - [LZRTP-97] <b>zrtp_hex2str and zrtp_st2hex don't work correct.</b>\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] <b>Refactoring in the test-unite</b>\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] <b>Change zrtp_time_t to literal integer type.</b>\n - zrtp_tim_now() just returns current time in milliseconds instead of zrtp_time_t structure. - - *- [LZRTP-83] <b>Refactoring in libzrtp debug logging.</b>\n - Made logs easy to read and analyze. Used indention. - - *- [LZRTP-84] <b>Refactoring in libzrtp terms.</b>\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] <b>Hide private fields in zrtp_session_ctx and zrtp_stream_ctx.</b>\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] <b>Create a macro for UNALIGNED constructions on mobile platforms.</b>\n - - *- [LZRTP-89] <b>Code style for crypto components sources.</b>\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] <b>zrtp_session_init should allocate memory for zrtp_session_t.</b>\n - - *- [LZRTP-112] <b>Modify zrtp logger to be able write \\n and NON \\n logs.</b>\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] <b>Review synchronization objects in libzrtp.</b>\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] <b>Add file with version number to identify builds.</b>\n - zrtp_version.h have been added to the project. - - *- [LZRTP-128] <b>Eliminate Sound event from libzrtp.</b>\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] <b>Move ssrc parameter from stream_create() to stream_start()</b>\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] <b>Speedup DH key exchange procedure.</b>\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] <b>Add DH2K public key exchange scheme</b>\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] <b>Implement Self-tests for DH and ECDH components.</b>\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] <b>Print out all zrtp configuration settings and adjustments on initialization.</b> - - *- [LZRTP-123] <b>Create standard error codes and error text descriptions.</b>\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] <b>Replace HMAC with KDF function call.</b>\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 <v.krikun at zfoneproject.com> - - -/** - * \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 -**************************************************************************************************** -<HR> -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 -**************************************************************************************************** -<HR> - ***<H3>Building with GNU tools (Linux, *BSD, MacOS X, mingw, etc.)</H3> - - 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 - - **<H3>Building Win32 Target with Microsoft Visual Studio</H3> - Generally we can just do these steps: - -# Visual Studio 8: open projects/win/libzrtp_vc8.sln solution, - -# build the libzrtp_test application. - - **<H3>Building for Windows Mobile</H3> - Generally these are all that are needed: - -# Visual Studio 8: open projects/win/libzrtp_wince_vc8.sln solution, - -# build the libzrtp_test application. - - **<H3>Locating Output Binaries/Libraries</H3> - For GNU targets, library files will be placed to <c>./projects/gnu/build</c> and <c>./third_party/bnlib</c>. - - **<H3>Running the Applications</H3> - 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 -**************************************************************************************************** -<HR> -***\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 -**************************************************************************************************** -<HR> -***\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 -**************************************************************************************************** -<HR> -***\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 -**************************************************************************************************** -<HR> -***\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 -**************************************************************************************************** -<HR> -***\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) -**************************************************************************************************** -<HR> -***\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 -**************************************************************************************************** -<HR> - -**************************************************************************************************** -\section howto_using 10. Using libzrtp with Applications -**************************************************************************************************** -<HR> - 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 -**************************************************************************************************** -<HR> - -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 -**************************************************************************************************** -<HR> -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 <v.krikun at zfoneproject.com> - -/** -\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 <v.krikun at zfoneproject.com> - - -/** - * \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 -**************************************************************************************************** -<HR> - 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 -**************************************************************************************************** -<HR> - 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 <A - HREF="http://tools.ietf.org/html/rfc4086">RFC 4086</A> 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 -**************************************************************************************************** -<HR> - The SDK library provides a default implementation of entropy accumulation for <b>Windows Kernel</b> and <b>Unix based</b> 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. -**************************************************************************************************** -<HR> - 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 <A HREF="http://en.wikipedia.org/wiki/Ring_oscillator">ring oscillator</A> 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 <v.krikun at zfoneproject.com> - */ - -/** - * \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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - -#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 <linux/version.h> -# 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 <windef.h> -# 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 <linux/version.h> -#endif -#if ZRTP_HAVE_ASM_TYPES_H == 1 -#include <asm/types.h> -#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 <stdlib.h> -# endif -# if ZRTP_HAVE_STDINT_H == 1 -# include <stdint.h> -# endif -# if ZRTP_HAVE_INTTYPES_H == 1 -# include <inttypes.h> -# endif -# if ZRTP_HAVE_SYS_TYPES_H == 1 -# include <sys/types.h> -# endif -# if ZRTP_HAVE_SYS_INT_TYPES_H == 1 -# include <sys/int_types.h> -# endif -# if ZRTP_HAVE_MACHINE_TYPES_H == 1 -# include <machine/types.h> -# 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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - -#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 <inttypes.h> 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 <stdio.h> 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 <v.krikun at zfoneproject.com> - */ - -/** - * @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 <v.krikun at zfoneproject.com> - */ - -#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 <Windows.h> -#endif - -/* - * Used to map system integer types to zrtp integer definitions. - * Define to 1 if you have the <inttypes.h> 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 <stdio.h> 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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - - -#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 <v.krikun at zfoneproject.com> - */ - - -/** - * \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 <v.krikun at zfoneproject.com> - */ - - - -/** - * \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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - - -#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 <windows.h> - 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 <v.krikun at zfoneproject.com> - */ - - -/** - * \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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - - -#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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - - -/** - * \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 <v.krikun at zfoneproject.com> - */ - -#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 <A HREF="http://zfoneproject.com/zrtp_ietf.html">"ZRTP Internet Draft"</A>. - * 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: <verison> + <client ID> + <hash> + <ZID> + <components length> */ -#define ZRTP_HELLO_STATIC_SIZE (ZRTP_VERSION_SIZE + ZRTP_CLIENTID_SIZE + 32 + ZRTP_ZID_SIZE + 4) - -/* Without header and HMAC: <hash> + <secrets IDs> */ -#define ZRTP_DH_STATIC_SIZE (32 + 4*8) - -/* Without header and HMAC: <hash> + <ZID> + <components definitions> */ -#define ZRTP_COMMIT_STATIC_SIZE (32 + ZRTP_ZID_SIZE + 4*5) - -/* <RTP> + <ext. header> + <ZRTP message type> + 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 <A HREF="http://zfoneproject.com/zrtp_ietf.html">"ZRTP Internet Draft"</A> */ - 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 <v.rozhkov at soft-industry.com> - */ - -#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 <v.krikun at zfoneproject.com> - * Vitaly Rozhkov <v.rozhkov at soft-industry.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - - -#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 - * <A HREF="http://zfoneproject.com/zrtp_ietf.html">"ZRTP Internet Draft"</A> - * 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 <A - * HREF="http://zfoneproject.com/zrtp_ietf.html">"ZRTP Internet Draft"</A> - * 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 <v.krikun at zfoneproject.com> - */ - -#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 <e32base.h> // For CActive, link against: euser.lib -#include <e32std.h> // For RTimer, link against: euser.lib - -#include <zrtp.h> -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: <chaser@soft-industry.com> - * - */ - -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 <charconv.h> -#include <stdarg.h> -#include <sys/time.h> - -#include <e32msgqueue.h> - -#include <UNISTD.H> -#include <e32base.h> -#include <e32math.h> - -#include <zrtp.h> - -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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{c0e76076-0032-445d-8c07-32b6c762622b}</UniqueIdentifier> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{a03c0d83-0032-4848-9704-22cdce5ab144}</UniqueIdentifier> - </Filter> - <Filter Include="bnlib"> - <UniqueIdentifier>{dbe8a34e-0032-495e-8df7-e82218921e60}</UniqueIdentifier> - </Filter> - <Filter Include="bgaes"> - <UniqueIdentifier>{96d1a5c9-0032-4230-a764-a0ed11f434a7}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\include\zrtp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_base.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config_user.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config_win.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_crypto.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_ec.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_error.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_builtin.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_cache.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_system.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_legal.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_list.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_log.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_pbx.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_protocol.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_srtp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_srtp_builtin.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_string.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_utils.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_version.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bn.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bn32.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bnsize00.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\kludge.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbn.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbn32.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbnmem.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\legal.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aes.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aesopt.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aestab.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\bg2zrtp.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\brg_types.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\sha1.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\sha2.h"> - <Filter>bgaes</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\src\zrtp.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crc.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_aes.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_atl.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_hash.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_pk.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_sas.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_datatypes.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_engine.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_engine_driven.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_cache.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_scheduler.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_sys.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_initiator.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_legal.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_list.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_log.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_pbx.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_protocol.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_responder.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_rng.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_srtp_builtin.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_string.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_utils.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_utils_proto.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bn.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bn32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bninit32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bntest00.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\lbn32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\lbnmem.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\legal.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aes_modes.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aescrypt.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aeskey.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aestab.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\sha1.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\sha2.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_ec.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_ecdh.c"> - <Filter>src</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <None Include="..\..\ChangeLog" /> - <None Include="..\..\News" /> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{C13CC324-0032-4492-9A30-310A6BD64FF5}</ProjectGuid> - <RootNamespace>libzrtp.x32</RootNamespace> - <Keyword>Win32Proj</Keyword> - <ProjectName>libzrtp</ProjectName> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - <Import Project="..\..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - <Import Project="..\..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - <Import Project="..\..\..\..\w32\extlib.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - <Import Project="..\..\..\..\w32\extlib.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0;ZRTP_USE_BUILTIN_CACHE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <CompileAs>CompileAsC</CompileAs> - <DisableSpecificWarnings>4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Lib /> - <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" copy "$(ProjectDir)..\..\third_party\bnlib\bnconfig.win" "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h"</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0;ZRTP_USE_BUILTIN_CACHE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <CompileAs>CompileAsC</CompileAs> - <DisableSpecificWarnings>4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Lib /> - <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" copy "$(ProjectDir)..\..\third_party\bnlib\bnconfig.win" "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h"</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>../../include;../../third_party/bnlib;../../third_party/bgaes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0;ZRTP_USE_BUILTIN_CACHE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling> - </ExceptionHandling> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <BufferSecurityCheck>false</BufferSecurityCheck> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <CompileAs>CompileAsC</CompileAs> - <DisableSpecificWarnings>4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Lib /> - <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" copy "$(ProjectDir)..\..\third_party\bnlib\bnconfig.win" "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h"</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <AdditionalIncludeDirectories>../../include;../../third_party/bnlib;../../third_party/bgaes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0;ZRTP_USE_BUILTIN_CACHE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling> - </ExceptionHandling> - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <BufferSecurityCheck>false</BufferSecurityCheck> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <CompileAs>CompileAsC</CompileAs> - <DisableSpecificWarnings>4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> - <Lib /> - <PreBuildEvent> - <Command>if not exist "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" copy "$(ProjectDir)..\..\third_party\bnlib\bnconfig.win" "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h"</Command> - </PreBuildEvent> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\..\include\zrtp.h" /> - <ClInclude Include="..\..\include\zrtp_base.h" /> - <ClInclude Include="..\..\include\zrtp_config.h" /> - <ClInclude Include="..\..\include\zrtp_config_user.h" /> - <ClInclude Include="..\..\include\zrtp_config_win.h" /> - <ClInclude Include="..\..\include\zrtp_crypto.h" /> - <ClInclude Include="..\..\include\zrtp_ec.h" /> - <ClInclude Include="..\..\include\zrtp_engine.h" /> - <ClInclude Include="..\..\include\zrtp_error.h" /> - <ClInclude Include="..\..\include\zrtp_iface.h" /> - <ClInclude Include="..\..\include\zrtp_iface_cache.h" /> - <ClInclude Include="..\..\include\zrtp_iface_system.h" /> - <ClInclude Include="..\..\include\zrtp_legal.h" /> - <ClInclude Include="..\..\include\zrtp_list.h" /> - <ClInclude Include="..\..\include\zrtp_log.h" /> - <ClInclude Include="..\..\include\zrtp_pbx.h" /> - <ClInclude Include="..\..\include\zrtp_protocol.h" /> - <ClInclude Include="..\..\include\zrtp_srtp.h" /> - <ClInclude Include="..\..\include\zrtp_srtp_builtin.h" /> - <ClInclude Include="..\..\include\zrtp_string.h" /> - <ClInclude Include="..\..\include\zrtp_types.h" /> - <ClInclude Include="..\..\include\zrtp_version.h" /> - <ClInclude Include="..\..\third_party\bnlib\bn.h" /> - <ClInclude Include="..\..\third_party\bnlib\bn32.h" /> - <ClInclude Include="..\..\third_party\bnlib\bnsize00.h" /> - <ClInclude Include="..\..\third_party\bnlib\kludge.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbn.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbn32.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbnmem.h" /> - <ClInclude Include="..\..\third_party\bnlib\legal.h" /> - <ClInclude Include="..\..\third_party\bgaes\aes.h" /> - <ClInclude Include="..\..\third_party\bgaes\aesopt.h" /> - <ClInclude Include="..\..\third_party\bgaes\aestab.h" /> - <ClInclude Include="..\..\third_party\bgaes\bg2zrtp.h" /> - <ClInclude Include="..\..\third_party\bgaes\brg_types.h" /> - <ClInclude Include="..\..\third_party\bgaes\sha1.h" /> - <ClInclude Include="..\..\third_party\bgaes\sha2.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\src\zrtp.c" /> - <ClCompile Include="..\..\src\zrtp_crc.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_aes.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_atl.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_ec.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_ecdh.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_hash.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_pk.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_sas.c" /> - <ClCompile Include="..\..\src\zrtp_datatypes.c" /> - <ClCompile Include="..\..\src\zrtp_engine.c" /> - <ClCompile Include="..\..\src\zrtp_engine_driven.c" /> - <ClCompile Include="..\..\src\zrtp_iface_cache.c" /> - <ClCompile Include="..\..\src\zrtp_iface_scheduler.c" /> - <ClCompile Include="..\..\src\zrtp_iface_sys.c" /> - <ClCompile Include="..\..\src\zrtp_initiator.c" /> - <ClCompile Include="..\..\src\zrtp_legal.c" /> - <ClCompile Include="..\..\src\zrtp_list.c" /> - <ClCompile Include="..\..\src\zrtp_log.c" /> - <ClCompile Include="..\..\src\zrtp_pbx.c" /> - <ClCompile Include="..\..\src\zrtp_protocol.c" /> - <ClCompile Include="..\..\src\zrtp_responder.c" /> - <ClCompile Include="..\..\src\zrtp_rng.c" /> - <ClCompile Include="..\..\src\zrtp_srtp_builtin.c" /> - <ClCompile Include="..\..\src\zrtp_string.c" /> - <ClCompile Include="..\..\src\zrtp_utils.c" /> - <ClCompile Include="..\..\src\zrtp_utils_proto.c" /> - <ClCompile Include="..\..\third_party\bnlib\bn.c" /> - <ClCompile Include="..\..\third_party\bnlib\bn32.c" /> - <ClCompile Include="..\..\third_party\bnlib\bninit32.c" /> - <ClCompile Include="..\..\third_party\bnlib\bntest00.c" /> - <ClCompile Include="..\..\third_party\bnlib\lbn32.c" /> - <ClCompile Include="..\..\third_party\bnlib\lbnmem.c" /> - <ClCompile Include="..\..\third_party\bnlib\legal.c" /> - <ClCompile Include="..\..\third_party\bgaes\aes_modes.c" /> - <ClCompile Include="..\..\third_party\bgaes\aescrypt.c" /> - <ClCompile Include="..\..\third_party\bgaes\aeskey.c" /> - <ClCompile Include="..\..\third_party\bgaes\aestab.c" /> - <ClCompile Include="..\..\third_party\bgaes\sha1.c" /> - <ClCompile Include="..\..\third_party\bgaes\sha2.c" /> - </ItemGroup> - <ItemGroup> - <None Include="..\..\ChangeLog" /> - <None Include="..\..\News" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9,00" - Name="libzrtp" - ProjectGUID="{C13CC324-E0CA-4492-9A30-310A6BD64FF5}" - RootNamespace="libzrtp" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - StructMemberAlignment="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="false" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/libzrtp.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="../../include;../../third_party/bnlib;../../third_party/bgaes" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1" - ExceptionHandling="0" - RuntimeLibrary="0" - StructMemberAlignment="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="false" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/libzrtp.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - > - <File - RelativePath="..\..\include\zrtp.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_base.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config_user.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config_win.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_crypto.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_ec.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_engine.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_error.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_builtin.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_cache.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_system.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_legal.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_list.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_log.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_pbx.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_protocol.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_srtp.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_srtp_builtin.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_string.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_types.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_utils.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_version.h" - > - </File> - </Filter> - <Filter - Name="src" - > - <File - RelativePath="..\..\src\zrtp.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crc.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_aes.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_atl.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_ec.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_ecdh.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_hash.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_pk.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_sas.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_datatypes.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_engine.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_engine_driven.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_cache.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_scheduler.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_sys.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_initiator.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_legal.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_list.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_log.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_pbx.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_protocol.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_responder.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_rng.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_srtp_builtin.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_string.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_utils.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_utils_proto.c" - > - </File> - </Filter> - <Filter - Name="bnlib" - > - <File - RelativePath="..\..\third_party\bnlib\bn.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn32.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bninit32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bnsize00.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bntest00.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\kludge.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn32.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbnmem.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbnmem.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\legal.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\legal.h" - > - </File> - </Filter> - <Filter - Name="bgaes" - > - <File - RelativePath="..\..\third_party\bgaes\aes.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aes_modes.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aescrypt.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aeskey.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aesopt.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aestab.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aestab.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\bg2zrtp.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\brg_types.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha1.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha1.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha2.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha2.h" - > - </File> - </Filter> - <File - RelativePath="..\..\ChangeLog" - > - </File> - <File - RelativePath="..\..\News" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{C13CC324-0032-4492-9A30-310A6BD64FF5}</ProjectGuid> - <RootNamespace>libzrtp.x32</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration).x32\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration).x32\</IntDir> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <CompileAs>CompileAsC</CompileAs> - </ClCompile> - <Lib> - <OutputFile>$(OutDir)libzrtp.x32.lib</OutputFile> - </Lib> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>../../include;../../third_party/bnlib;../../third_party/bgaes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling> - </ExceptionHandling> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <BufferSecurityCheck>false</BufferSecurityCheck> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <CompileAs>CompileAsC</CompileAs> - </ClCompile> - <Lib> - <OutputFile>$(OutDir)libzrtp.x32.lib</OutputFile> - </Lib> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\..\include\zrtp.h" /> - <ClInclude Include="..\..\include\zrtp_base.h" /> - <ClInclude Include="..\..\include\zrtp_config.h" /> - <ClInclude Include="..\..\include\zrtp_config_user.h" /> - <ClInclude Include="..\..\include\zrtp_config_win.h" /> - <ClInclude Include="..\..\include\zrtp_crypto.h" /> - <ClInclude Include="..\..\include\zrtp_ec.h" /> - <ClInclude Include="..\..\include\zrtp_engine.h" /> - <ClInclude Include="..\..\include\zrtp_error.h" /> - <ClInclude Include="..\..\include\zrtp_iface.h" /> - <ClInclude Include="..\..\include\zrtp_iface_builtin.h" /> - <ClInclude Include="..\..\include\zrtp_iface_cache.h" /> - <ClInclude Include="..\..\include\zrtp_iface_system.h" /> - <ClInclude Include="..\..\include\zrtp_legal.h" /> - <ClInclude Include="..\..\include\zrtp_list.h" /> - <ClInclude Include="..\..\include\zrtp_log.h" /> - <ClInclude Include="..\..\include\zrtp_pbx.h" /> - <ClInclude Include="..\..\include\zrtp_protocol.h" /> - <ClInclude Include="..\..\include\zrtp_srtp.h" /> - <ClInclude Include="..\..\include\zrtp_srtp_builtin.h" /> - <ClInclude Include="..\..\include\zrtp_string.h" /> - <ClInclude Include="..\..\include\zrtp_types.h" /> - <ClInclude Include="..\..\include\zrtp_utils.h" /> - <ClInclude Include="..\..\include\zrtp_version.h" /> - <ClInclude Include="..\..\third_party\bnlib\bn.h" /> - <ClInclude Include="..\..\third_party\bnlib\bn32.h" /> - <ClInclude Include="..\..\third_party\bnlib\bnsize00.h" /> - <ClInclude Include="..\..\third_party\bnlib\kludge.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbn.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbn32.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbnmem.h" /> - <ClInclude Include="..\..\third_party\bnlib\legal.h" /> - <ClInclude Include="..\..\third_party\bgaes\aes.h" /> - <ClInclude Include="..\..\third_party\bgaes\aesopt.h" /> - <ClInclude Include="..\..\third_party\bgaes\aestab.h" /> - <ClInclude Include="..\..\third_party\bgaes\bg2zrtp.h" /> - <ClInclude Include="..\..\third_party\bgaes\brg_types.h" /> - <ClInclude Include="..\..\third_party\bgaes\sha1.h" /> - <ClInclude Include="..\..\third_party\bgaes\sha2.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\src\zrtp.c" /> - <ClCompile Include="..\..\src\zrtp_crc.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_aes.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_atl.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_ec.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_ecdh.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_hash.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_pk.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_sas.c" /> - <ClCompile Include="..\..\src\zrtp_datatypes.c" /> - <ClCompile Include="..\..\src\zrtp_engine.c" /> - <ClCompile Include="..\..\src\zrtp_engine_driven.c" /> - <ClCompile Include="..\..\src\zrtp_iface_cache.c" /> - <ClCompile Include="..\..\src\zrtp_iface_scheduler.c" /> - <ClCompile Include="..\..\src\zrtp_iface_sys.c" /> - <ClCompile Include="..\..\src\zrtp_initiator.c" /> - <ClCompile Include="..\..\src\zrtp_legal.c" /> - <ClCompile Include="..\..\src\zrtp_list.c" /> - <ClCompile Include="..\..\src\zrtp_log.c" /> - <ClCompile Include="..\..\src\zrtp_pbx.c" /> - <ClCompile Include="..\..\src\zrtp_protocol.c" /> - <ClCompile Include="..\..\src\zrtp_responder.c" /> - <ClCompile Include="..\..\src\zrtp_rng.c" /> - <ClCompile Include="..\..\src\zrtp_srtp_builtin.c" /> - <ClCompile Include="..\..\src\zrtp_string.c" /> - <ClCompile Include="..\..\src\zrtp_utils.c" /> - <ClCompile Include="..\..\src\zrtp_utils_proto.c" /> - <ClCompile Include="..\..\third_party\bnlib\bn.c" /> - <ClCompile Include="..\..\third_party\bnlib\bn32.c" /> - <ClCompile Include="..\..\third_party\bnlib\bninit32.c" /> - <ClCompile Include="..\..\third_party\bnlib\bntest00.c" /> - <ClCompile Include="..\..\third_party\bnlib\lbn32.c" /> - <ClCompile Include="..\..\third_party\bnlib\lbnmem.c" /> - <ClCompile Include="..\..\third_party\bnlib\legal.c" /> - <ClCompile Include="..\..\third_party\bgaes\aes_modes.c" /> - <ClCompile Include="..\..\third_party\bgaes\aescrypt.c" /> - <ClCompile Include="..\..\third_party\bgaes\aeskey.c" /> - <ClCompile Include="..\..\third_party\bgaes\aestab.c" /> - <ClCompile Include="..\..\third_party\bgaes\sha1.c" /> - <ClCompile Include="..\..\third_party\bgaes\sha2.c" /> - </ItemGroup> - <ItemGroup> - <None Include="..\..\ChangeLog" /> - <None Include="..\..\News" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{c0e76076-0032-445d-8c07-32b6c762622b}</UniqueIdentifier> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{a03c0d83-0032-4848-9704-22cdce5ab144}</UniqueIdentifier> - </Filter> - <Filter Include="bnlib"> - <UniqueIdentifier>{dbe8a34e-0032-495e-8df7-e82218921e60}</UniqueIdentifier> - </Filter> - <Filter Include="bgaes"> - <UniqueIdentifier>{96d1a5c9-0032-4230-a764-a0ed11f434a7}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\include\zrtp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_base.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config_user.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config_win.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_crypto.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_ec.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_error.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_builtin.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_cache.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_system.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_legal.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_list.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_log.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_pbx.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_protocol.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_srtp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_srtp_builtin.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_string.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_utils.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_version.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bn.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bn32.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bnsize00.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\kludge.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbn.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbn32.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbnmem.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\legal.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aes.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aesopt.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aestab.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\bg2zrtp.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\brg_types.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\sha1.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\sha2.h"> - <Filter>bgaes</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\src\zrtp.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crc.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_aes.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_atl.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_ec.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_ecdh.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_hash.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_pk.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_sas.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_datatypes.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_engine.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_engine_driven.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_cache.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_scheduler.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_sys.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_initiator.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_legal.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_list.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_log.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_pbx.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_protocol.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_responder.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_rng.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_srtp_builtin.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_string.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_utils.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_utils_proto.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bn.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bn32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bninit32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bntest00.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\lbn32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\lbnmem.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\legal.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aes_modes.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aescrypt.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aeskey.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aestab.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\sha1.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\sha2.c"> - <Filter>bgaes</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <None Include="..\..\ChangeLog" /> - <None Include="..\..\News" /> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{C13CC324-0064-4492-9A30-310A6BD64FF5}</ProjectGuid> - <RootNamespace>libzrtp.x64</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration).x64\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration).x64\</IntDir> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> - <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> - <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_WIN64;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <CompileAs>CompileAsC</CompileAs> - </ClCompile> - <Lib> - <OutputFile>$(OutDir)libzrtp.x64.lib</OutputFile> - </Lib> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <AdditionalIncludeDirectories>../../include;../../third_party/bnlib;../../third_party/bgaes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_WIN64;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling> - </ExceptionHandling> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <StructMemberAlignment>Default</StructMemberAlignment> - <BufferSecurityCheck>false</BufferSecurityCheck> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <CompileAs>CompileAsC</CompileAs> - </ClCompile> - <Lib> - <OutputFile>$(OutDir)libzrtp.x64.lib</OutputFile> - </Lib> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\..\include\zrtp.h" /> - <ClInclude Include="..\..\include\zrtp_base.h" /> - <ClInclude Include="..\..\include\zrtp_config.h" /> - <ClInclude Include="..\..\include\zrtp_config_user.h" /> - <ClInclude Include="..\..\include\zrtp_config_win.h" /> - <ClInclude Include="..\..\include\zrtp_crypto.h" /> - <ClInclude Include="..\..\include\zrtp_ec.h" /> - <ClInclude Include="..\..\include\zrtp_engine.h" /> - <ClInclude Include="..\..\include\zrtp_error.h" /> - <ClInclude Include="..\..\include\zrtp_iface.h" /> - <ClInclude Include="..\..\include\zrtp_iface_builtin.h" /> - <ClInclude Include="..\..\include\zrtp_iface_cache.h" /> - <ClInclude Include="..\..\include\zrtp_iface_system.h" /> - <ClInclude Include="..\..\include\zrtp_legal.h" /> - <ClInclude Include="..\..\include\zrtp_list.h" /> - <ClInclude Include="..\..\include\zrtp_log.h" /> - <ClInclude Include="..\..\include\zrtp_pbx.h" /> - <ClInclude Include="..\..\include\zrtp_protocol.h" /> - <ClInclude Include="..\..\include\zrtp_srtp.h" /> - <ClInclude Include="..\..\include\zrtp_srtp_builtin.h" /> - <ClInclude Include="..\..\include\zrtp_string.h" /> - <ClInclude Include="..\..\include\zrtp_types.h" /> - <ClInclude Include="..\..\include\zrtp_utils.h" /> - <ClInclude Include="..\..\include\zrtp_version.h" /> - <ClInclude Include="..\..\third_party\bnlib\bn.h" /> - <ClInclude Include="..\..\third_party\bnlib\bn32.h" /> - <ClInclude Include="..\..\third_party\bnlib\bnsize00.h" /> - <ClInclude Include="..\..\third_party\bnlib\kludge.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbn.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbn32.h" /> - <ClInclude Include="..\..\third_party\bnlib\lbnmem.h" /> - <ClInclude Include="..\..\third_party\bnlib\legal.h" /> - <ClInclude Include="..\..\third_party\bgaes\aes.h" /> - <ClInclude Include="..\..\third_party\bgaes\aesopt.h" /> - <ClInclude Include="..\..\third_party\bgaes\aestab.h" /> - <ClInclude Include="..\..\third_party\bgaes\bg2zrtp.h" /> - <ClInclude Include="..\..\third_party\bgaes\brg_types.h" /> - <ClInclude Include="..\..\third_party\bgaes\sha1.h" /> - <ClInclude Include="..\..\third_party\bgaes\sha2.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\src\zrtp.c" /> - <ClCompile Include="..\..\src\zrtp_crc.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_aes.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_atl.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_ec.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_ecdh.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_hash.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_pk.c" /> - <ClCompile Include="..\..\src\zrtp_crypto_sas.c" /> - <ClCompile Include="..\..\src\zrtp_datatypes.c" /> - <ClCompile Include="..\..\src\zrtp_engine.c" /> - <ClCompile Include="..\..\src\zrtp_engine_driven.c" /> - <ClCompile Include="..\..\src\zrtp_iface_cache.c" /> - <ClCompile Include="..\..\src\zrtp_iface_scheduler.c" /> - <ClCompile Include="..\..\src\zrtp_iface_sys.c" /> - <ClCompile Include="..\..\src\zrtp_initiator.c" /> - <ClCompile Include="..\..\src\zrtp_legal.c" /> - <ClCompile Include="..\..\src\zrtp_list.c" /> - <ClCompile Include="..\..\src\zrtp_log.c" /> - <ClCompile Include="..\..\src\zrtp_pbx.c" /> - <ClCompile Include="..\..\src\zrtp_protocol.c" /> - <ClCompile Include="..\..\src\zrtp_responder.c" /> - <ClCompile Include="..\..\src\zrtp_rng.c" /> - <ClCompile Include="..\..\src\zrtp_srtp_builtin.c" /> - <ClCompile Include="..\..\src\zrtp_string.c" /> - <ClCompile Include="..\..\src\zrtp_utils.c" /> - <ClCompile Include="..\..\src\zrtp_utils_proto.c" /> - <ClCompile Include="..\..\third_party\bnlib\bn.c" /> - <ClCompile Include="..\..\third_party\bnlib\bn32.c" /> - <ClCompile Include="..\..\third_party\bnlib\bninit32.c" /> - <ClCompile Include="..\..\third_party\bnlib\bntest00.c" /> - <ClCompile Include="..\..\third_party\bnlib\lbn32.c" /> - <ClCompile Include="..\..\third_party\bnlib\lbnmem.c" /> - <ClCompile Include="..\..\third_party\bnlib\legal.c" /> - <ClCompile Include="..\..\third_party\bgaes\aes_modes.c" /> - <ClCompile Include="..\..\third_party\bgaes\aescrypt.c" /> - <ClCompile Include="..\..\third_party\bgaes\aeskey.c" /> - <ClCompile Include="..\..\third_party\bgaes\aestab.c" /> - <ClCompile Include="..\..\third_party\bgaes\sha1.c" /> - <ClCompile Include="..\..\third_party\bgaes\sha2.c" /> - </ItemGroup> - <ItemGroup> - <None Include="..\..\ChangeLog" /> - <None Include="..\..\News" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="include"> - <UniqueIdentifier>{c0e76076-0064-445d-8c07-32b6c762622b}</UniqueIdentifier> - </Filter> - <Filter Include="src"> - <UniqueIdentifier>{a03c0d83-0064-4848-9704-22cdce5ab144}</UniqueIdentifier> - </Filter> - <Filter Include="bnlib"> - <UniqueIdentifier>{dbe8a34e-0064-495e-8df7-e82218921e60}</UniqueIdentifier> - </Filter> - <Filter Include="bgaes"> - <UniqueIdentifier>{96d1a5c9-0064-4230-a764-a0ed11f434a7}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\include\zrtp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_base.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config_user.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_config_win.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_crypto.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_ec.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_engine.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_error.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_builtin.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_cache.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_iface_system.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_legal.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_list.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_log.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_pbx.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_protocol.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_srtp.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_srtp_builtin.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_string.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_types.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_utils.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\include\zrtp_version.h"> - <Filter>include</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bn.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bn32.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\bnsize00.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\kludge.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbn.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbn32.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\lbnmem.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bnlib\legal.h"> - <Filter>bnlib</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aes.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aesopt.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\aestab.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\bg2zrtp.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\brg_types.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\sha1.h"> - <Filter>bgaes</Filter> - </ClInclude> - <ClInclude Include="..\..\third_party\bgaes\sha2.h"> - <Filter>bgaes</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\src\zrtp.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crc.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_aes.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_atl.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_ec.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_ecdh.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_hash.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_pk.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_crypto_sas.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_datatypes.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_engine.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_engine_driven.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_cache.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_scheduler.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_iface_sys.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_initiator.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_legal.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_list.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_log.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_pbx.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_protocol.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_responder.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_rng.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_srtp_builtin.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_string.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_utils.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\src\zrtp_utils_proto.c"> - <Filter>src</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bn.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bn32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bninit32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\bntest00.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\lbn32.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\lbnmem.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bnlib\legal.c"> - <Filter>bnlib</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aes_modes.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aescrypt.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aeskey.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\aestab.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\sha1.c"> - <Filter>bgaes</Filter> - </ClCompile> - <ClCompile Include="..\..\third_party\bgaes\sha2.c"> - <Filter>bgaes</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <None Include="..\..\ChangeLog" /> - <None Include="..\..\News" /> - </ItemGroup> -</Project> \ 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9,00" - Name="libzrtp" - ProjectGUID="{C13CC324-E0CA-4492-9A30-310A6BD64FF5}" - RootNamespace="libzrtp" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - StructMemberAlignment="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="false" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/libzrtp.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="4" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="../../include;../../third_party/bnlib;../../third_party/bgaes" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H=1; ZRTP_ENABLE_EC=0" - ExceptionHandling="0" - RuntimeLibrary="0" - StructMemberAlignment="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="false" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)/libzrtp.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - > - <File - RelativePath="..\..\include\zrtp.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_base.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config_user.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config_win.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_crypto.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_engine.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_error.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_builtin.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_cache.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_system.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_legal.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_list.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_log.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_pbx.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_protocol.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_srtp.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_srtp_builtin.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_string.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_types.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_utils.h" - > - </File> - </Filter> - <Filter - Name="src" - > - <File - RelativePath="..\..\src\zrtp.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crc.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_aes.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_atl.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_hash.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_pk.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_sas.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_datatypes.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_engine.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_engine_driven.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_cache.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_scheduler.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_sys.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_initiator.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_legal.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_list.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_log.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_pbx.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_protocol.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_responder.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_rng.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_srtp_builtin.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_string.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_utils.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_utils_proto.c" - > - </File> - </Filter> - <Filter - Name="bnlib" - > - <File - RelativePath="..\..\third_party\bnlib\bn.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn32.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bninit32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bnsize00.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bntest00.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\kludge.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn32.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbnmem.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbnmem.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\legal.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\legal.h" - > - </File> - </Filter> - <Filter - Name="bgaes" - > - <File - RelativePath="..\..\third_party\bgaes\aes.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aes_modes.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aescrypt.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aeskey.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aesopt.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aestab.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aestab.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\bg2zrtp.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\brg_types.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha1.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha1.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha2.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha2.h" - > - </File> - </Filter> - <File - RelativePath="..\..\ChangeLog" - > - </File> - <File - RelativePath="..\..\News" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9,00" - Name="libzrtp_test" - ProjectGUID="{BA35741B-8C8E-4A39-9CA1-0CE032D6E4ED}" - RootNamespace="libzrtp_test" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\include\enterprise;..\..\third_party\bgaes;..\..\third_party\bnlib" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - StructMemberAlignment="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="false" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalOptions="Ws2_32.lib" - AdditionalDependencies="Debug/libzrtp.lib" - OutputFile="$(OutDir)/libzrtp_test.exe" - LinkIncremental="2" - GenerateDebugInformation="true" - ProgramDatabaseFile="$(OutDir)/libzrtp_test.pdb" - SubSystem="1" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="1" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="1" - AdditionalIncludeDirectories="..\..\include;..\..\third_party\bgaes;..\..\third_party\bnlib" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;" - RuntimeLibrary="0" - StructMemberAlignment="0" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalOptions="Ws2_32.lib" - AdditionalDependencies="Release/libzrtp.lib" - OutputFile="$(OutDir)/libzrtp_test.exe" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <File - RelativePath="..\..\test\pc\zrtp_test_core.c" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_core.h" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_crypto.c" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_queue.c" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_queue.h" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_ui.c" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9,00" - Name="libzrtp_test" - ProjectGUID="{5C082222-FD44-4295-8055-915936F086BE}" - RootNamespace="libzrtp_test_GUI" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Pocket PC 2003 (ARMV4)" - /> - <Platform - Name="Smartphone 2003 (ARMV4)" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Pocket PC 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\include\enterprise;..\..\third_party\bnlib;..\..\third_party\bgaes;..\..\test\pc" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL;HAVE_CONFIG_H=1;" - MinimalRebuild="true" - RuntimeLibrary="1" - StructMemberAlignment="0" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE&#x0D;&#x0A; ws2.lib" - AdditionalDependencies="&quot;$(OutDir)/wince.lib&quot;" - OutputFile="$(OutDir)/libzrtp_test_GUI.exe" - LinkIncremental="2" - DelayLoadDLLs="$(NOINHERIT)" - GenerateDebugInformation="true" - ProgramDatabaseFile="$(OutDir)/libzrtp_test_GUI.pdb" - SubSystem="0" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Debug|Smartphone 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\include\enterprise;..\..\third_party\bnlib;..\..\third_party\bgaes;..\..\test\pc" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;SMARTPHONE2003_UI_MODEL;SMARTPHONE2003_UI_MODEL;BUILD_ZRTP_MUTEXES;ZRTP_ENABLE_TEST;HAVE_CONFIG_H=1;" - MinimalRebuild="true" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE&#x0D;&#x0A;ws2.lib" - AdditionalDependencies="&quot;$(OutDir)/wince.lib&quot;" - OutputFile="$(OutDir)/libzrtp_test_GUI.exe" - LinkIncremental="2" - DelayLoadDLLs="$(NOINHERIT)" - GenerateDebugInformation="true" - ProgramDatabaseFile="$(OutDir)/libzrtp_test_GUI.pdb" - SubSystem="0" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Release|Pocket PC 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="2" - AdditionalIncludeDirectories="..\..\include;..\..\include\enterprise;..\..\third_party\bnlib;..\..\third_party\bgaes;..\..\test\pc" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;POCKETPC2003_UI_MODEL;POCKETPC2003_UI_MODEL;BUILD_ZRTP_MUTEXES;ZRTP_ENABLE_TEST;HAVE_CONFIG_H=1" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE&#x0D;&#x0A; ws2.lib" - AdditionalDependencies="&quot;$(OutDir)/wince.lib&quot;" - OutputFile="$(OutDir)/libzrtp_test_GUI.exe" - LinkIncremental="1" - DelayLoadDLLs="$(NOINHERIT)" - GenerateDebugInformation="true" - ProgramDatabaseFile="$(OutDir)/libzrtp_test_GUI.pdb" - SubSystem="0" - OptimizeReferences="2" - EnableCOMDATFolding="2" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Release|Smartphone 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="2" - AdditionalIncludeDirectories="..\..\include;..\..\include\enterprise;..\..\third_party\bnlib;..\..\third_party\bgaes;..\..\test\pc" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;SMARTPHONE2003_UI_MODEL;SMARTPHONE2003_UI_MODEL;BUILD_ZRTP_MUTEXES;ZRTP_ENABLE_TEST;HAVE_CONFIG_H=1" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE&#x0D;&#x0A;ws2.lib " - AdditionalDependencies="&quot;$(OutDir)/wince.lib&quot;" - OutputFile="$(OutDir)/libzrtp_test_GUI.exe" - LinkIncremental="1" - DelayLoadDLLs="$(NOINHERIT)" - GenerateDebugInformation="true" - ProgramDatabaseFile="$(OutDir)/libzrtp_test_GUI.pdb" - SubSystem="0" - OptimizeReferences="2" - EnableCOMDATFolding="2" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath="..\..\test\win_ce\libzrtp_test_GUI.cpp" - > - </File> - <File - RelativePath="..\..\test\win_ce\stdafx.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\..\..\test\win_ce\libzrtp_test_GUI.h" - > - </File> - <File - RelativePath=".\..\..\test\win_ce\resourceppc.h" - > - </File> - <File - RelativePath=".\..\..\test\win_ce\resourcesp.h" - > - </File> - <File - RelativePath=".\..\..\test\win_ce\stdafx.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - <File - RelativePath=".\..\..\test\win_ce\libzrtp_test_GUI.ico" - > - </File> - <File - RelativePath=".\..\..\test\win_ce\libzrtp_test_GUIppc.rc" - > - <FileConfiguration - Name="Debug|Smartphone 2003 (ARMV4)" - ExcludedFromBuild="true" - > - <Tool - Name="VCResourceCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Smartphone 2003 (ARMV4)" - ExcludedFromBuild="true" - > - <Tool - Name="VCResourceCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\..\..\test\win_ce\libzrtp_test_GUIppc.rc2" - > - </File> - <File - RelativePath=".\..\..\test\win_ce\libzrtp_test_GUIsp.rc" - > - <FileConfiguration - Name="Debug|Pocket PC 2003 (ARMV4)" - ExcludedFromBuild="true" - > - <Tool - Name="VCResourceCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Pocket PC 2003 (ARMV4)" - ExcludedFromBuild="true" - > - <Tool - Name="VCResourceCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\..\..\test\win_ce\libzrtp_test_GUIsp.rc2" - > - </File> - </Filter> - <Filter - Name="PC Sources" - > - <File - RelativePath="..\..\test\pc\zrtp_test_core.c" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_core.h" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_crypto.c" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_queue.c" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_queue.h" - > - </File> - <File - RelativePath="..\..\test\pc\zrtp_test_ui.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9,00" - Name="libzrtp" - ProjectGUID="{53F84E3B-9903-4046-897B-33FEFFED527A}" - RootNamespace="wince" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Pocket PC 2003 (ARMV4)" - /> - <Platform - Name="Smartphone 2003 (ARMV4)" - /> - </Platforms> - <ToolFiles> - <DefaultToolFile - FileName="masm.rules" - /> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Pocket PC 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="MASM" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="0" - AdditionalIncludeDirectories="../../third_party/bnlib;../../include;../../include/enterprise;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;ZRTP_ENABLE_EC=1" - MinimalRebuild="true" - RuntimeLibrary="1" - StructMemberAlignment="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - CompileForArchitecture="2" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" - OutputFile="$(OutDir)/wince.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Debug|Smartphone 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="MASM" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="0" - AdditionalIncludeDirectories="../../third_party/bnlib;../../include;../../include/enterprise;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;ZRTP_ENABLE_EC=1" - MinimalRebuild="true" - RuntimeLibrary="1" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - CompileForArchitecture="0" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" - OutputFile="$(OutDir)/wince.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Release|Pocket PC 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="MASM" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="2" - AdditionalIncludeDirectories="../../third_party/bnlib;../../include;../../include/enterprise;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;ZRTP_ENABLE_EC=1" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" - OutputFile="$(OutDir)/wince.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Release|Smartphone 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="MASM" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="2" - AdditionalIncludeDirectories="../../third_party/bnlib;../../include;../../include/enterprise;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;ZRTP_ENABLE_EC=1" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" - OutputFile="$(OutDir)/wince.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - > - <File - RelativePath="..\..\include\zrtp.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_base.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config_user.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config_win.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_crypto.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_ec.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_engine.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_error.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_cache.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_system.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_legal.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_list.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_log.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_pbx.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_protocol.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_srtp.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_srtp_builtin.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_string.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_types.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_utils.h" - > - </File> - </Filter> - <Filter - Name="src" - > - <File - RelativePath="..\..\src\zrtp.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crc.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_aes.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_atl.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_ec.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_ecdh.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_ecdsa.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_hash.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_pk.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_sas.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_datatypes.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_engine.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_engine_driven.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_cache.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_scheduler.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_sys.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_initiator.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_list.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_log.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_pbx.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_protocol.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_responder.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_rng.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_srtp_builtin.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_string.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_utils.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_utils_proto.c" - > - </File> - </Filter> - <Filter - Name="bgaes" - > - <File - RelativePath="..\..\third_party\bgaes\aes.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aes_modes.c" - > - </File> - <File - RelativePath="..\..\third_party\..\third_party\bgaes\aescrypt.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aeskey.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aesopt.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aestab.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aestab.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\bg2zrtp.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\brg_types.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha1.c" - > - <FileConfiguration - Name="Debug|Pocket PC 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|Smartphone 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Pocket PC 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Smartphone 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\..\third_party\bgaes\sha1.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha2.c" - > - <FileConfiguration - Name="Debug|Pocket PC 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|Smartphone 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Pocket PC 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Smartphone 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\..\third_party\bgaes\sha2.h" - > - </File> - </Filter> - <Filter - Name="bnlib" - > - <File - RelativePath="..\..\third_party\bnlib\bn.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn32.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bninit32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bnsize00.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\config\config.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\kludge.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn32.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn80386.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbnmem.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbnmem.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\legal.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\legal.h" - > - </File> - </Filter> - <File - RelativePath=".\ReadMe.txt" - > - </File> - <File - RelativePath="..\libzrtp_test_GUI\ReadMe.txt" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 @@ -<?xml version="1.0" encoding="windows-1251"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9,00" - Name="libzrtp" - ProjectGUID="{53F84E3B-9903-4046-897B-33FEFFED527A}" - RootNamespace="wince" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Pocket PC 2003 (ARMV4)" - /> - <Platform - Name="Smartphone 2003 (ARMV4)" - /> - </Platforms> - <ToolFiles> - <DefaultToolFile - FileName="masm.rules" - /> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Pocket PC 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="MASM" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="0" - AdditionalIncludeDirectories="../../third_party/bnlib;../../include;../../include/enterprise;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;ZRTP_ENABLE_EC=0" - MinimalRebuild="true" - RuntimeLibrary="1" - StructMemberAlignment="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - CompileForArchitecture="2" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" - OutputFile="$(OutDir)/wince.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Debug|Smartphone 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="MASM" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="0" - AdditionalIncludeDirectories="../../third_party/bnlib;../../include;../../include/enterprise;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;ZRTP_ENABLE_EC=0" - MinimalRebuild="true" - RuntimeLibrary="1" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - CompileForArchitecture="0" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" - OutputFile="$(OutDir)/wince.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Release|Pocket PC 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="MASM" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="2" - AdditionalIncludeDirectories="../../third_party/bnlib;../../include;../../include/enterprise;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;ZRTP_ENABLE_EC=0" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" - OutputFile="$(OutDir)/wince.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - <Configuration - Name="Release|Smartphone 2003 (ARMV4)" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="MASM" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - ExecutionBucket="7" - Optimization="2" - AdditionalIncludeDirectories="../../third_party/bnlib;../../include;../../include/enterprise;../../third_party/bgaes;../../test/include" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;ZRTP_ENABLE_EC=0" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)" - Culture="1033" - AdditionalIncludeDirectories="$(IntDir)" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM" - OutputFile="$(OutDir)/wince.lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCCodeSignTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - <DeploymentTool - ForceDirty="-1" - RemoteDirectory="" - RegisterOutput="0" - AdditionalFiles="" - /> - <DebuggerTool - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="include" - > - <File - RelativePath="..\..\include\zrtp.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_base.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config_user.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_config_win.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_crypto.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_engine.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_error.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_cache.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_iface_system.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_legal.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_list.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_log.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_pbx.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_protocol.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_srtp.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_srtp_builtin.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_string.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_types.h" - > - </File> - <File - RelativePath="..\..\include\zrtp_utils.h" - > - </File> - </Filter> - <Filter - Name="src" - > - <File - RelativePath="..\..\src\zrtp.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crc.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_aes.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_atl.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_hash.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_pk.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_crypto_sas.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_datatypes.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_engine.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_cache.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_scheduler.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_iface_sys.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_initiator.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_list.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_log.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_pbx.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_protocol.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_responder.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_rng.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_srtp_builtin.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_string.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_utils.c" - > - </File> - <File - RelativePath="..\..\src\zrtp_utils_proto.c" - > - </File> - </Filter> - <Filter - Name="bgaes" - > - <File - RelativePath="..\..\third_party\bgaes\aes.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aes_modes.c" - > - </File> - <File - RelativePath="..\..\third_party\..\third_party\bgaes\aescrypt.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aeskey.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aesopt.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aestab.c" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\aestab.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\bg2zrtp.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\brg_types.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha1.c" - > - <FileConfiguration - Name="Debug|Pocket PC 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|Smartphone 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Pocket PC 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Smartphone 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\..\third_party\bgaes\sha1.h" - > - </File> - <File - RelativePath="..\..\third_party\bgaes\sha2.c" - > - <FileConfiguration - Name="Debug|Pocket PC 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|Smartphone 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Pocket PC 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Smartphone 2003 (ARMV4)" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)/$(InputName)1.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\..\third_party\bgaes\sha2.h" - > - </File> - </Filter> - <Filter - Name="bnlib" - > - <File - RelativePath="..\..\third_party\bnlib\bn.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bn32.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bninit32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\bnsize00.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\config\config.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\kludge.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn32.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn32.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbn80386.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbnmem.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\lbnmem.h" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\legal.c" - > - </File> - <File - RelativePath="..\..\third_party\bnlib\legal.h" - > - </File> - </Filter> - <File - RelativePath=".\ReadMe.txt" - > - </File> - <File - RelativePath="..\libzrtp_test_GUI\ReadMe.txt" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> 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 <a.rozinko@soft-industry.com> - -# -# 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)/$(<B).obj - -.asm.obj: - $(ASM) $(AINCLUDE) $(AFLAGS) /Fo$(OUT_DIR)/$(<B).obj $< - -$(BASENAME).lib : $(OUT_DIR) $(OBJECTS) - $(LIB) /OUT:"$(OUT_DIR)\$(BASENAME).lib" /NOLOGO $(OUT_DIR)\*.obj - -$(OUT_DIR) : - @mkdir $(OUT_DIR) - -clean: - del "$(OUT_DIR)\*.obj" - del "$(OUT_DIR)\*.res" - del "$(OUT_DIR)\*.map" - del "$(OUT_DIR)\*.pdb" - del "$(OUT_DIR)\$(BASENAME).lib" diff --git a/libs/libzrtp/projects/win_kernel/MAKEFILE.WIN64 b/libs/libzrtp/projects/win_kernel/MAKEFILE.WIN64 deleted file mode 100644 index ccc2a73a17..0000000000 --- a/libs/libzrtp/projects/win_kernel/MAKEFILE.WIN64 +++ /dev/null @@ -1,134 +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 <a.rozinko@soft-industry.com> - -# -# 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)/$(<B).obj - -.asm.obj: - $(ASM) $(AINCLUDE) $(AFLAGS) /Fo$(OUT_DIR)/$(<B).obj $< - -$(BASENAME).lib : $(OUT_DIR) $(OBJECTS) - $(LIB) /OUT:"$(OUT_DIR)\$(BASENAME).lib" /NOLOGO $(OUT_DIR)\*.obj - -$(OUT_DIR) : - @mkdir $(OUT_DIR) - -clean: - del "$(OUT_DIR)\*.obj" - del "$(OUT_DIR)\*.res" - del "$(OUT_DIR)\*.map" - del "$(OUT_DIR)\*.pdb" - del "$(OUT_DIR)\$(BASENAME).lib" diff --git a/libs/libzrtp/projects/win_kernel/MAKEFILE_NOT_EC.WIN32 b/libs/libzrtp/projects/win_kernel/MAKEFILE_NOT_EC.WIN32 deleted file mode 100644 index ff9c4470ab..0000000000 --- a/libs/libzrtp/projects/win_kernel/MAKEFILE_NOT_EC.WIN32 +++ /dev/null @@ -1,129 +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 <a.rozinko@soft-industry.com> - -# -# 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)/$(<B).obj - -.asm.obj: - $(ASM) $(AINCLUDE) $(AFLAGS) /Fo$(OUT_DIR)/$(<B).obj $< - -$(BASENAME).lib : $(OUT_DIR) $(OBJECTS) - $(LIB) /OUT:"$(OUT_DIR)\$(BASENAME).lib" /NOLOGO $(OUT_DIR)\*.obj - -$(OUT_DIR) : - @mkdir $(OUT_DIR) - -clean: - del "$(OUT_DIR)\*.obj" - del "$(OUT_DIR)\*.res" - del "$(OUT_DIR)\*.map" - del "$(OUT_DIR)\*.pdb" - del "$(OUT_DIR)\$(BASENAME).lib" diff --git a/libs/libzrtp/projects/win_kernel/MAKEFILE_NOT_EC.WIN64 b/libs/libzrtp/projects/win_kernel/MAKEFILE_NOT_EC.WIN64 deleted file mode 100644 index 52a1cb7e4d..0000000000 --- a/libs/libzrtp/projects/win_kernel/MAKEFILE_NOT_EC.WIN64 +++ /dev/null @@ -1,131 +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 <a.rozinko@soft-industry.com> - -# -# 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)/$(<B).obj - -.asm.obj: - $(ASM) $(AINCLUDE) $(AFLAGS) /Fo$(OUT_DIR)/$(<B).obj $< - -$(BASENAME).lib : $(OUT_DIR) $(OBJECTS) - $(LIB) /OUT:"$(OUT_DIR)\$(BASENAME).lib" /NOLOGO $(OUT_DIR)\*.obj - -$(OUT_DIR) : - @mkdir $(OUT_DIR) - -clean: - del "$(OUT_DIR)\*.obj" - del "$(OUT_DIR)\*.res" - del "$(OUT_DIR)\*.map" - del "$(OUT_DIR)\*.pdb" - del "$(OUT_DIR)\$(BASENAME).lib" diff --git a/libs/libzrtp/projects/xcode/libzrtp.xcodeproj/project.pbxproj b/libs/libzrtp/projects/xcode/libzrtp.xcodeproj/project.pbxproj deleted file mode 100644 index d6410e978d..0000000000 --- a/libs/libzrtp/projects/xcode/libzrtp.xcodeproj/project.pbxproj +++ /dev/null @@ -1,626 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXAggregateTarget section */ - 8DF95BE80EC06AAE00832CBC /* configure */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 8DF95BEB0EC06ACD00832CBC /* Build configuration list for PBXAggregateTarget "configure" */; - buildPhases = ( - 8DF95BE70EC06AAE00832CBC /* ShellScript */, - ); - dependencies = ( - ); - name = configure; - productName = configure; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 8996DFEA0EC9CA8C007D7FD5 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9A90EACB11400A8A8EA /* aes.h */; }; - 8996DFEB0EC9CA8C007D7FD5 /* aesopt.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9AD0EACB11400A8A8EA /* aesopt.h */; }; - 8996DFEC0EC9CA8C007D7FD5 /* aestab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9AF0EACB11400A8A8EA /* aestab.h */; }; - 8996DFED0EC9CA8C007D7FD5 /* bg2zrtp.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9B00EACB11400A8A8EA /* bg2zrtp.h */; }; - 8996DFEE0EC9CA8C007D7FD5 /* brg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9B10EACB11400A8A8EA /* brg_types.h */; }; - 8996DFEF0EC9CA8C007D7FD5 /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9B30EACB11400A8A8EA /* sha1.h */; }; - 8996DFF00EC9CA8C007D7FD5 /* sha2.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9B50EACB11400A8A8EA /* sha2.h */; }; - 8996DFF10EC9CA8C007D7FD5 /* bn.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9DB0EACB51300A8A8EA /* bn.h */; }; - 8996DFF20EC9CA8C007D7FD5 /* bn32.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9DD0EACB51300A8A8EA /* bn32.h */; }; - 8996DFF30EC9CA8C007D7FD5 /* lbn.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9DF0EACB51300A8A8EA /* lbn.h */; }; - 8996DFF40EC9CA8C007D7FD5 /* lbn16.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9E00EACB51300A8A8EA /* lbn16.h */; }; - 8996DFF50EC9CA8C007D7FD5 /* lbnmem.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9E30EACB51300A8A8EA /* lbnmem.h */; }; - 8996DFF60EC9CA8C007D7FD5 /* legal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9E50EACB51300A8A8EA /* legal.h */; }; - 8996E0000EC9CA8C007D7FD5 /* zrtp_base.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30AB7B0EADA86000A8A8EA /* zrtp_base.h */; }; - 8996E01C0EC9CA8C007D7FD5 /* aes_modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9AA0EACB11400A8A8EA /* aes_modes.c */; }; - 8996E01D0EC9CA8C007D7FD5 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9AB0EACB11400A8A8EA /* aescrypt.c */; }; - 8996E01E0EC9CA8C007D7FD5 /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9AC0EACB11400A8A8EA /* aeskey.c */; }; - 8996E01F0EC9CA8C007D7FD5 /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9AE0EACB11400A8A8EA /* aestab.c */; }; - 8996E0200EC9CA8C007D7FD5 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9B20EACB11400A8A8EA /* sha1.c */; }; - 8996E0210EC9CA8C007D7FD5 /* sha2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9B40EACB11400A8A8EA /* sha2.c */; }; - 8996E0220EC9CA8C007D7FD5 /* bn.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9DA0EACB51300A8A8EA /* bn.c */; }; - 8996E0230EC9CA8C007D7FD5 /* bn32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9DC0EACB51300A8A8EA /* bn32.c */; }; - 8996E0240EC9CA8C007D7FD5 /* bntest32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9DE0EACB51300A8A8EA /* bntest32.c */; }; - 8996E0250EC9CA8C007D7FD5 /* lbn32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9E10EACB51300A8A8EA /* lbn32.c */; }; - 8996E0260EC9CA8C007D7FD5 /* lbnmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9E20EACB51300A8A8EA /* lbnmem.c */; }; - 8996E0270EC9CA8C007D7FD5 /* legal.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9E40EACB51300A8A8EA /* legal.c */; }; - 8996E0280EC9CA8C007D7FD5 /* zrtp_iface_sys.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30AE120EAE2BAB00A8A8EA /* zrtp_iface_sys.c */; }; - 8996E0290EC9CA8C007D7FD5 /* zrtp_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30AFFF0EAF590400A8A8EA /* zrtp_log.c */; }; - 8996E02A0EC9CA8C007D7FD5 /* zrtp_utils_proto.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30B2A60EB0BA2600A8A8EA /* zrtp_utils_proto.c */; }; - 8996E02B0EC9CA8C007D7FD5 /* bninit32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D4BE7680EC325A5003584D4 /* bninit32.c */; }; - 8D6EEBBF0F01386E00529121 /* zrtp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9590EACB0D600A8A8EA /* zrtp.c */; }; - 8D6EEBC00F01386E00529121 /* zrtp_crc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A95B0EACB0D600A8A8EA /* zrtp_crc.c */; }; - 8D6EEBC10F01386E00529121 /* zrtp_crypto_aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A95C0EACB0D600A8A8EA /* zrtp_crypto_aes.c */; }; - 8D6EEBC20F01386E00529121 /* zrtp_crypto_atl.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A95D0EACB0D600A8A8EA /* zrtp_crypto_atl.c */; }; - 8D6EEBC30F01386E00529121 /* zrtp_crypto_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A95E0EACB0D600A8A8EA /* zrtp_crypto_hash.c */; }; - 8D6EEBC40F01386E00529121 /* zrtp_crypto_pk.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A95F0EACB0D600A8A8EA /* zrtp_crypto_pk.c */; }; - 8D6EEBC50F01386E00529121 /* zrtp_crypto_sas.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9600EACB0D600A8A8EA /* zrtp_crypto_sas.c */; }; - 8D6EEBC60F01386E00529121 /* zrtp_datatypes.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9610EACB0D600A8A8EA /* zrtp_datatypes.c */; }; - 8D6EEBC70F01386E00529121 /* zrtp_engine.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9620EACB0D600A8A8EA /* zrtp_engine.c */; }; - 8D6EEBC80F01386E00529121 /* zrtp_initiator.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9640EACB0D600A8A8EA /* zrtp_initiator.c */; }; - 8D6EEBC90F01386E00529121 /* zrtp_responder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9680EACB0D600A8A8EA /* zrtp_responder.c */; }; - 8D6EEBCA0F01386E00529121 /* zrtp_list.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9650EACB0D600A8A8EA /* zrtp_list.c */; }; - 8D6EEBCB0F01386E00529121 /* zrtp_pbx.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9660EACB0D600A8A8EA /* zrtp_pbx.c */; }; - 8D6EEBCC0F01386E00529121 /* zrtp_protocol.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9670EACB0D600A8A8EA /* zrtp_protocol.c */; }; - 8D6EEBCD0F01386E00529121 /* zrtp_rng.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9690EACB0D600A8A8EA /* zrtp_rng.c */; }; - 8D6EEBCE0F01386E00529121 /* zrtp_srtp_builtin.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A96A0EACB0D600A8A8EA /* zrtp_srtp_builtin.c */; }; - 8D6EEBCF0F01386E00529121 /* zrtp_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A96C0EACB0D600A8A8EA /* zrtp_string.c */; }; - 8D6EEBD00F01386E00529121 /* zrtp_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A96D0EACB0D600A8A8EA /* zrtp_utils.c */; }; - 8D6EEBD10F01386E00529121 /* zrtp_legal.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D4A9EDB0EC9E2E300F07172 /* zrtp_legal.c */; }; - 8D6EEBD30F01386E00529121 /* zrtp_iface_scheduler.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D30A9520EACB0C700A8A8EA /* zrtp_iface_scheduler.c */; }; - 8D6EEBD70F01388C00529121 /* zrtp.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9830EACB0EA00A8A8EA /* zrtp.h */; }; - 8D6EEBD80F01388C00529121 /* zrtp_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9940EACB0EA00A8A8EA /* zrtp_types.h */; }; - 8D6EEBDA0F01388C00529121 /* zrtp_error.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9890EACB0EA00A8A8EA /* zrtp_error.h */; }; - 8D6EEBDB0F01388C00529121 /* zrtp_iface.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A98A0EACB0EA00A8A8EA /* zrtp_iface.h */; }; - 8D6EEBDC0F01388C00529121 /* zrtp_iface_system.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A98B0EACB0EA00A8A8EA /* zrtp_iface_system.h */; }; - 8D6EEBDD0F01388C00529121 /* zrtp_legal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A98C0EACB0EA00A8A8EA /* zrtp_legal.h */; }; - 8D6EEBDE0F01388C00529121 /* zrtp_list.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A98D0EACB0EA00A8A8EA /* zrtp_list.h */; }; - 8D6EEBDF0F01388C00529121 /* zrtp_log.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A98E0EACB0EA00A8A8EA /* zrtp_log.h */; }; - 8D6EEBE00F01388C00529121 /* zrtp_pbx.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A98F0EACB0EA00A8A8EA /* zrtp_pbx.h */; }; - 8D6EEBE10F01388C00529121 /* zrtp_protocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9900EACB0EA00A8A8EA /* zrtp_protocol.h */; }; - 8D6EEBE20F01388C00529121 /* zrtp_srtp.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9910EACB0EA00A8A8EA /* zrtp_srtp.h */; }; - 8D6EEBE30F01388C00529121 /* zrtp_srtp_builtin.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9920EACB0EA00A8A8EA /* zrtp_srtp_builtin.h */; }; - 8D6EEBE40F01388C00529121 /* zrtp_string.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9930EACB0EA00A8A8EA /* zrtp_string.h */; }; - 8D6EEBE50F01388C00529121 /* zrtp_crypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9860EACB0EA00A8A8EA /* zrtp_crypto.h */; }; - 8D6EEBE60F01388C00529121 /* zrtp_version.h in Headers */ = {isa = PBXBuildFile; fileRef = 8DBAF5AD0EE91A8C00D34BFB /* zrtp_version.h */; }; - 8D6EEBE70F0138AF00529121 /* zrtp_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9840EACB0EA00A8A8EA /* zrtp_config.h */; }; - 8D6EEBE80F0138AF00529121 /* zrtp_config_user.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D30A9850EACB0EA00A8A8EA /* zrtp_config_user.h */; }; - 8DCDA604119850ED006B39ED /* zrtp_engine.h in Headers */ = {isa = PBXBuildFile; fileRef = 8DCDA603119850ED006B39ED /* zrtp_engine.h */; }; - 8DD1C11E0F36D4A500903190 /* zrtp_config_unix.h in Headers */ = {isa = PBXBuildFile; fileRef = 8DD1C11C0F36D4A500903190 /* zrtp_config_unix.h */; }; - 8DEE0799102FF96100B585AD /* zrtp_ec.h in Headers */ = {isa = PBXBuildFile; fileRef = 8DEE0793102FF96100B585AD /* zrtp_ec.h */; }; - 8DEE079A102FF96100B585AD /* zrtp_iface_cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 8DEE0794102FF96100B585AD /* zrtp_iface_cache.h */; }; - 8DEE079B102FF96100B585AD /* zrtp_iface_scheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8DEE0795102FF96100B585AD /* zrtp_iface_scheduler.h */; }; - 8DEE07B2102FF9BD00B585AD /* zrtp_crypto_ec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8DEE07AC102FF9BD00B585AD /* zrtp_crypto_ec.c */; }; - 8DEE07B3102FF9BD00B585AD /* zrtp_crypto_ecdh.c in Sources */ = {isa = PBXBuildFile; fileRef = 8DEE07AD102FF9BD00B585AD /* zrtp_crypto_ecdh.c */; }; - 8DEE07B5102FF9BD00B585AD /* zrtp_engine_driven.c in Sources */ = {isa = PBXBuildFile; fileRef = 8DEE07AF102FF9BD00B585AD /* zrtp_engine_driven.c */; }; - 8DEE07B6102FF9BD00B585AD /* zrtp_iface_cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 8DEE07B0102FF9BD00B585AD /* zrtp_iface_cache.c */; }; - 8DEE07B7102FF9BD00B585AD /* zrtp_srtp_dm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8DEE07B1102FF9BD00B585AD /* zrtp_srtp_dm.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 8996E0300EC9CA8C007D7FD5 /* libzrtp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libzrtp.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 8D30A9520EACB0C700A8A8EA /* zrtp_iface_scheduler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_iface_scheduler.c; path = ../../src/zrtp_iface_scheduler.c; sourceTree = SOURCE_ROOT; }; - 8D30A9590EACB0D600A8A8EA /* zrtp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp.c; path = ../../src/zrtp.c; sourceTree = SOURCE_ROOT; }; - 8D30A95B0EACB0D600A8A8EA /* zrtp_crc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_crc.c; path = ../../src/zrtp_crc.c; sourceTree = SOURCE_ROOT; }; - 8D30A95C0EACB0D600A8A8EA /* zrtp_crypto_aes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_crypto_aes.c; path = ../../src/zrtp_crypto_aes.c; sourceTree = SOURCE_ROOT; }; - 8D30A95D0EACB0D600A8A8EA /* zrtp_crypto_atl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_crypto_atl.c; path = ../../src/zrtp_crypto_atl.c; sourceTree = SOURCE_ROOT; }; - 8D30A95E0EACB0D600A8A8EA /* zrtp_crypto_hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_crypto_hash.c; path = ../../src/zrtp_crypto_hash.c; sourceTree = SOURCE_ROOT; }; - 8D30A95F0EACB0D600A8A8EA /* zrtp_crypto_pk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_crypto_pk.c; path = ../../src/zrtp_crypto_pk.c; sourceTree = SOURCE_ROOT; }; - 8D30A9600EACB0D600A8A8EA /* zrtp_crypto_sas.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_crypto_sas.c; path = ../../src/zrtp_crypto_sas.c; sourceTree = SOURCE_ROOT; }; - 8D30A9610EACB0D600A8A8EA /* zrtp_datatypes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_datatypes.c; path = ../../src/zrtp_datatypes.c; sourceTree = SOURCE_ROOT; }; - 8D30A9620EACB0D600A8A8EA /* zrtp_engine.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_engine.c; path = ../../src/zrtp_engine.c; sourceTree = SOURCE_ROOT; }; - 8D30A9640EACB0D600A8A8EA /* zrtp_initiator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_initiator.c; path = ../../src/zrtp_initiator.c; sourceTree = SOURCE_ROOT; }; - 8D30A9650EACB0D600A8A8EA /* zrtp_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_list.c; path = ../../src/zrtp_list.c; sourceTree = SOURCE_ROOT; }; - 8D30A9660EACB0D600A8A8EA /* zrtp_pbx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_pbx.c; path = ../../src/zrtp_pbx.c; sourceTree = SOURCE_ROOT; }; - 8D30A9670EACB0D600A8A8EA /* zrtp_protocol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_protocol.c; path = ../../src/zrtp_protocol.c; sourceTree = SOURCE_ROOT; }; - 8D30A9680EACB0D600A8A8EA /* zrtp_responder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_responder.c; path = ../../src/zrtp_responder.c; sourceTree = SOURCE_ROOT; }; - 8D30A9690EACB0D600A8A8EA /* zrtp_rng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_rng.c; path = ../../src/zrtp_rng.c; sourceTree = SOURCE_ROOT; }; - 8D30A96A0EACB0D600A8A8EA /* zrtp_srtp_builtin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_srtp_builtin.c; path = ../../src/zrtp_srtp_builtin.c; sourceTree = SOURCE_ROOT; }; - 8D30A96C0EACB0D600A8A8EA /* zrtp_string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_string.c; path = ../../src/zrtp_string.c; sourceTree = SOURCE_ROOT; }; - 8D30A96D0EACB0D600A8A8EA /* zrtp_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_utils.c; path = ../../src/zrtp_utils.c; sourceTree = SOURCE_ROOT; }; - 8D30A9830EACB0EA00A8A8EA /* zrtp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp.h; path = ../../include/zrtp.h; sourceTree = SOURCE_ROOT; }; - 8D30A9840EACB0EA00A8A8EA /* zrtp_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_config.h; path = ../../include/zrtp_config.h; sourceTree = SOURCE_ROOT; }; - 8D30A9850EACB0EA00A8A8EA /* zrtp_config_user.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_config_user.h; path = ../../include/zrtp_config_user.h; sourceTree = SOURCE_ROOT; }; - 8D30A9860EACB0EA00A8A8EA /* zrtp_crypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_crypto.h; path = ../../include/zrtp_crypto.h; sourceTree = SOURCE_ROOT; }; - 8D30A9890EACB0EA00A8A8EA /* zrtp_error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_error.h; path = ../../include/zrtp_error.h; sourceTree = SOURCE_ROOT; }; - 8D30A98A0EACB0EA00A8A8EA /* zrtp_iface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_iface.h; path = ../../include/zrtp_iface.h; sourceTree = SOURCE_ROOT; }; - 8D30A98B0EACB0EA00A8A8EA /* zrtp_iface_system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_iface_system.h; path = ../../include/zrtp_iface_system.h; sourceTree = SOURCE_ROOT; }; - 8D30A98C0EACB0EA00A8A8EA /* zrtp_legal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_legal.h; path = ../../include/zrtp_legal.h; sourceTree = SOURCE_ROOT; }; - 8D30A98D0EACB0EA00A8A8EA /* zrtp_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_list.h; path = ../../include/zrtp_list.h; sourceTree = SOURCE_ROOT; }; - 8D30A98E0EACB0EA00A8A8EA /* zrtp_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_log.h; path = ../../include/zrtp_log.h; sourceTree = SOURCE_ROOT; }; - 8D30A98F0EACB0EA00A8A8EA /* zrtp_pbx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_pbx.h; path = ../../include/zrtp_pbx.h; sourceTree = SOURCE_ROOT; }; - 8D30A9900EACB0EA00A8A8EA /* zrtp_protocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_protocol.h; path = ../../include/zrtp_protocol.h; sourceTree = SOURCE_ROOT; }; - 8D30A9910EACB0EA00A8A8EA /* zrtp_srtp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_srtp.h; path = ../../include/zrtp_srtp.h; sourceTree = SOURCE_ROOT; }; - 8D30A9920EACB0EA00A8A8EA /* zrtp_srtp_builtin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_srtp_builtin.h; path = ../../include/zrtp_srtp_builtin.h; sourceTree = SOURCE_ROOT; }; - 8D30A9930EACB0EA00A8A8EA /* zrtp_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_string.h; path = ../../include/zrtp_string.h; sourceTree = SOURCE_ROOT; }; - 8D30A9940EACB0EA00A8A8EA /* zrtp_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_types.h; path = ../../include/zrtp_types.h; sourceTree = SOURCE_ROOT; }; - 8D30A9A90EACB11400A8A8EA /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aes.h; path = ../../third_party/bgaes/aes.h; sourceTree = SOURCE_ROOT; }; - 8D30A9AA0EACB11400A8A8EA /* aes_modes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = aes_modes.c; path = ../../third_party/bgaes/aes_modes.c; sourceTree = SOURCE_ROOT; }; - 8D30A9AB0EACB11400A8A8EA /* aescrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = aescrypt.c; path = ../../third_party/bgaes/aescrypt.c; sourceTree = SOURCE_ROOT; }; - 8D30A9AC0EACB11400A8A8EA /* aeskey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = aeskey.c; path = ../../third_party/bgaes/aeskey.c; sourceTree = SOURCE_ROOT; }; - 8D30A9AD0EACB11400A8A8EA /* aesopt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aesopt.h; path = ../../third_party/bgaes/aesopt.h; sourceTree = SOURCE_ROOT; }; - 8D30A9AE0EACB11400A8A8EA /* aestab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = aestab.c; path = ../../third_party/bgaes/aestab.c; sourceTree = SOURCE_ROOT; }; - 8D30A9AF0EACB11400A8A8EA /* aestab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aestab.h; path = ../../third_party/bgaes/aestab.h; sourceTree = SOURCE_ROOT; }; - 8D30A9B00EACB11400A8A8EA /* bg2zrtp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bg2zrtp.h; path = ../../third_party/bgaes/bg2zrtp.h; sourceTree = SOURCE_ROOT; }; - 8D30A9B10EACB11400A8A8EA /* brg_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = brg_types.h; path = ../../third_party/bgaes/brg_types.h; sourceTree = SOURCE_ROOT; }; - 8D30A9B20EACB11400A8A8EA /* sha1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sha1.c; path = ../../third_party/bgaes/sha1.c; sourceTree = SOURCE_ROOT; }; - 8D30A9B30EACB11400A8A8EA /* sha1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sha1.h; path = ../../third_party/bgaes/sha1.h; sourceTree = SOURCE_ROOT; }; - 8D30A9B40EACB11400A8A8EA /* sha2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sha2.c; path = ../../third_party/bgaes/sha2.c; sourceTree = SOURCE_ROOT; }; - 8D30A9B50EACB11400A8A8EA /* sha2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sha2.h; path = ../../third_party/bgaes/sha2.h; sourceTree = SOURCE_ROOT; }; - 8D30A9DA0EACB51300A8A8EA /* bn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bn.c; path = ../../third_party/bnlib/bn.c; sourceTree = SOURCE_ROOT; }; - 8D30A9DB0EACB51300A8A8EA /* bn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bn.h; path = ../../third_party/bnlib/bn.h; sourceTree = SOURCE_ROOT; }; - 8D30A9DC0EACB51300A8A8EA /* bn32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bn32.c; path = ../../third_party/bnlib/bn32.c; sourceTree = SOURCE_ROOT; }; - 8D30A9DD0EACB51300A8A8EA /* bn32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bn32.h; path = ../../third_party/bnlib/bn32.h; sourceTree = SOURCE_ROOT; }; - 8D30A9DE0EACB51300A8A8EA /* bntest32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bntest32.c; path = ../../third_party/bnlib/bntest32.c; sourceTree = SOURCE_ROOT; }; - 8D30A9DF0EACB51300A8A8EA /* lbn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lbn.h; path = ../../third_party/bnlib/lbn.h; sourceTree = SOURCE_ROOT; }; - 8D30A9E00EACB51300A8A8EA /* lbn16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lbn16.h; path = ../../third_party/bnlib/lbn16.h; sourceTree = SOURCE_ROOT; }; - 8D30A9E10EACB51300A8A8EA /* lbn32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbn32.c; path = ../../third_party/bnlib/lbn32.c; sourceTree = SOURCE_ROOT; }; - 8D30A9E20EACB51300A8A8EA /* lbnmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbnmem.c; path = ../../third_party/bnlib/lbnmem.c; sourceTree = SOURCE_ROOT; }; - 8D30A9E30EACB51300A8A8EA /* lbnmem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lbnmem.h; path = ../../third_party/bnlib/lbnmem.h; sourceTree = SOURCE_ROOT; }; - 8D30A9E40EACB51300A8A8EA /* legal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = legal.c; path = ../../third_party/bnlib/legal.c; sourceTree = SOURCE_ROOT; }; - 8D30A9E50EACB51300A8A8EA /* legal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = legal.h; path = ../../third_party/bnlib/legal.h; sourceTree = SOURCE_ROOT; }; - 8D30AB7B0EADA86000A8A8EA /* zrtp_base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_base.h; path = ../../include/zrtp_base.h; sourceTree = SOURCE_ROOT; }; - 8D30AE120EAE2BAB00A8A8EA /* zrtp_iface_sys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_iface_sys.c; path = ../../src/zrtp_iface_sys.c; sourceTree = SOURCE_ROOT; }; - 8D30AFFF0EAF590400A8A8EA /* zrtp_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_log.c; path = ../../src/zrtp_log.c; sourceTree = SOURCE_ROOT; }; - 8D30B2A60EB0BA2600A8A8EA /* zrtp_utils_proto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_utils_proto.c; path = ../../src/zrtp_utils_proto.c; sourceTree = SOURCE_ROOT; }; - 8D4A9EDB0EC9E2E300F07172 /* zrtp_legal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_legal.c; path = ../../src/zrtp_legal.c; sourceTree = SOURCE_ROOT; }; - 8D4BE7680EC325A5003584D4 /* bninit32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bninit32.c; path = ../../third_party/bnlib/bninit32.c; sourceTree = SOURCE_ROOT; }; - 8DBAF5AD0EE91A8C00D34BFB /* zrtp_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_version.h; path = ../../include/zrtp_version.h; sourceTree = SOURCE_ROOT; }; - 8DCDA603119850ED006B39ED /* zrtp_engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_engine.h; path = ../../include/zrtp_engine.h; sourceTree = SOURCE_ROOT; }; - 8DD1C11C0F36D4A500903190 /* zrtp_config_unix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_config_unix.h; path = ../../include/zrtp_config_unix.h; sourceTree = SOURCE_ROOT; }; - 8DEE0793102FF96100B585AD /* zrtp_ec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_ec.h; path = ../../include/zrtp_ec.h; sourceTree = SOURCE_ROOT; }; - 8DEE0794102FF96100B585AD /* zrtp_iface_cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_iface_cache.h; path = ../../include/zrtp_iface_cache.h; sourceTree = SOURCE_ROOT; }; - 8DEE0795102FF96100B585AD /* zrtp_iface_scheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_iface_scheduler.h; path = ../../include/zrtp_iface_scheduler.h; sourceTree = SOURCE_ROOT; }; - 8DEE07AC102FF9BD00B585AD /* zrtp_crypto_ec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_crypto_ec.c; path = ../../src/zrtp_crypto_ec.c; sourceTree = SOURCE_ROOT; }; - 8DEE07AD102FF9BD00B585AD /* zrtp_crypto_ecdh.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_crypto_ecdh.c; path = ../../src/zrtp_crypto_ecdh.c; sourceTree = SOURCE_ROOT; }; - 8DEE07AF102FF9BD00B585AD /* zrtp_engine_driven.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_engine_driven.c; path = ../../src/zrtp_engine_driven.c; sourceTree = SOURCE_ROOT; }; - 8DEE07B0102FF9BD00B585AD /* zrtp_iface_cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_iface_cache.c; path = ../../src/zrtp_iface_cache.c; sourceTree = SOURCE_ROOT; }; - 8DEE07B1102FF9BD00B585AD /* zrtp_srtp_dm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_srtp_dm.c; path = ../../src/zrtp_srtp_dm.c; sourceTree = SOURCE_ROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8996E02C0EC9CA8C007D7FD5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 08FB7794FE84155DC02AAC07 /* libzrtp */ = { - isa = PBXGroup; - children = ( - 08FB7795FE84155DC02AAC07 /* Source */, - C6A0FF2B0290797F04C91782 /* Documentation */, - 1AB674ADFE9D54B511CA2CBB /* Products */, - ); - name = libzrtp; - sourceTree = "<group>"; - }; - 08FB7795FE84155DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 8D30A9480EACB07700A8A8EA /* include */, - 8D30A9490EACB08100A8A8EA /* src */, - 8D30A94B0EACB09000A8A8EA /* bgaes */, - 8D30A94A0EACB08600A8A8EA /* bnlib */, - ); - name = Source; - sourceTree = "<group>"; - }; - 1AB674ADFE9D54B511CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8996E0300EC9CA8C007D7FD5 /* libzrtp.a */, - ); - name = Products; - sourceTree = "<group>"; - }; - 8D30A9480EACB07700A8A8EA /* include */ = { - isa = PBXGroup; - children = ( - 8D30A9F60EACB53700A8A8EA /* config */, - 8D30A9830EACB0EA00A8A8EA /* zrtp.h */, - 8D30AB7B0EADA86000A8A8EA /* zrtp_base.h */, - 8D30A9940EACB0EA00A8A8EA /* zrtp_types.h */, - 8D30A9890EACB0EA00A8A8EA /* zrtp_error.h */, - 8D30A98A0EACB0EA00A8A8EA /* zrtp_iface.h */, - 8DCDA603119850ED006B39ED /* zrtp_engine.h */, - 8DEE0794102FF96100B585AD /* zrtp_iface_cache.h */, - 8DEE0795102FF96100B585AD /* zrtp_iface_scheduler.h */, - 8D30A98B0EACB0EA00A8A8EA /* zrtp_iface_system.h */, - 8D30A98C0EACB0EA00A8A8EA /* zrtp_legal.h */, - 8D30A98D0EACB0EA00A8A8EA /* zrtp_list.h */, - 8D30A98E0EACB0EA00A8A8EA /* zrtp_log.h */, - 8D30A98F0EACB0EA00A8A8EA /* zrtp_pbx.h */, - 8D30A9900EACB0EA00A8A8EA /* zrtp_protocol.h */, - 8D30A9910EACB0EA00A8A8EA /* zrtp_srtp.h */, - 8D30A9920EACB0EA00A8A8EA /* zrtp_srtp_builtin.h */, - 8D30A9930EACB0EA00A8A8EA /* zrtp_string.h */, - 8D30A9860EACB0EA00A8A8EA /* zrtp_crypto.h */, - 8DEE0793102FF96100B585AD /* zrtp_ec.h */, - 8DBAF5AD0EE91A8C00D34BFB /* zrtp_version.h */, - ); - name = include; - sourceTree = "<group>"; - }; - 8D30A9490EACB08100A8A8EA /* src */ = { - isa = PBXGroup; - children = ( - 8D30A9590EACB0D600A8A8EA /* zrtp.c */, - 8D30A95B0EACB0D600A8A8EA /* zrtp_crc.c */, - 8D30A95C0EACB0D600A8A8EA /* zrtp_crypto_aes.c */, - 8D30A95D0EACB0D600A8A8EA /* zrtp_crypto_atl.c */, - 8D30A95E0EACB0D600A8A8EA /* zrtp_crypto_hash.c */, - 8D30A95F0EACB0D600A8A8EA /* zrtp_crypto_pk.c */, - 8D30A9600EACB0D600A8A8EA /* zrtp_crypto_sas.c */, - 8DEE07AC102FF9BD00B585AD /* zrtp_crypto_ec.c */, - 8DEE07AD102FF9BD00B585AD /* zrtp_crypto_ecdh.c */, - 8D30A9610EACB0D600A8A8EA /* zrtp_datatypes.c */, - 8D30A9620EACB0D600A8A8EA /* zrtp_engine.c */, - 8DEE07AF102FF9BD00B585AD /* zrtp_engine_driven.c */, - 8D30A9640EACB0D600A8A8EA /* zrtp_initiator.c */, - 8D30A9680EACB0D600A8A8EA /* zrtp_responder.c */, - 8D30A9650EACB0D600A8A8EA /* zrtp_list.c */, - 8D30AFFF0EAF590400A8A8EA /* zrtp_log.c */, - 8D30A9660EACB0D600A8A8EA /* zrtp_pbx.c */, - 8D30A9670EACB0D600A8A8EA /* zrtp_protocol.c */, - 8D30A9690EACB0D600A8A8EA /* zrtp_rng.c */, - 8D30A96A0EACB0D600A8A8EA /* zrtp_srtp_builtin.c */, - 8DEE07B1102FF9BD00B585AD /* zrtp_srtp_dm.c */, - 8D30A96C0EACB0D600A8A8EA /* zrtp_string.c */, - 8D30A96D0EACB0D600A8A8EA /* zrtp_utils.c */, - 8D30B2A60EB0BA2600A8A8EA /* zrtp_utils_proto.c */, - 8D4A9EDB0EC9E2E300F07172 /* zrtp_legal.c */, - 8D30AE120EAE2BAB00A8A8EA /* zrtp_iface_sys.c */, - 8D30A9520EACB0C700A8A8EA /* zrtp_iface_scheduler.c */, - 8DEE07B0102FF9BD00B585AD /* zrtp_iface_cache.c */, - ); - name = src; - sourceTree = "<group>"; - }; - 8D30A94A0EACB08600A8A8EA /* bnlib */ = { - isa = PBXGroup; - children = ( - 8D4BE7680EC325A5003584D4 /* bninit32.c */, - 8D30A9DA0EACB51300A8A8EA /* bn.c */, - 8D30A9DB0EACB51300A8A8EA /* bn.h */, - 8D30A9DC0EACB51300A8A8EA /* bn32.c */, - 8D30A9DD0EACB51300A8A8EA /* bn32.h */, - 8D30A9DE0EACB51300A8A8EA /* bntest32.c */, - 8D30A9DF0EACB51300A8A8EA /* lbn.h */, - 8D30A9E00EACB51300A8A8EA /* lbn16.h */, - 8D30A9E10EACB51300A8A8EA /* lbn32.c */, - 8D30A9E20EACB51300A8A8EA /* lbnmem.c */, - 8D30A9E30EACB51300A8A8EA /* lbnmem.h */, - 8D30A9E40EACB51300A8A8EA /* legal.c */, - 8D30A9E50EACB51300A8A8EA /* legal.h */, - ); - name = bnlib; - sourceTree = "<group>"; - }; - 8D30A94B0EACB09000A8A8EA /* bgaes */ = { - isa = PBXGroup; - children = ( - 8D30A9A90EACB11400A8A8EA /* aes.h */, - 8D30A9AA0EACB11400A8A8EA /* aes_modes.c */, - 8D30A9AB0EACB11400A8A8EA /* aescrypt.c */, - 8D30A9AC0EACB11400A8A8EA /* aeskey.c */, - 8D30A9AD0EACB11400A8A8EA /* aesopt.h */, - 8D30A9AE0EACB11400A8A8EA /* aestab.c */, - 8D30A9AF0EACB11400A8A8EA /* aestab.h */, - 8D30A9B00EACB11400A8A8EA /* bg2zrtp.h */, - 8D30A9B10EACB11400A8A8EA /* brg_types.h */, - 8D30A9B20EACB11400A8A8EA /* sha1.c */, - 8D30A9B30EACB11400A8A8EA /* sha1.h */, - 8D30A9B40EACB11400A8A8EA /* sha2.c */, - 8D30A9B50EACB11400A8A8EA /* sha2.h */, - ); - name = bgaes; - sourceTree = "<group>"; - }; - 8D30A9F60EACB53700A8A8EA /* config */ = { - isa = PBXGroup; - children = ( - 8D30A9840EACB0EA00A8A8EA /* zrtp_config.h */, - 8D30A9850EACB0EA00A8A8EA /* zrtp_config_user.h */, - 8DD1C11C0F36D4A500903190 /* zrtp_config_unix.h */, - ); - name = config; - sourceTree = "<group>"; - }; - C6A0FF2B0290797F04C91782 /* Documentation */ = { - isa = PBXGroup; - children = ( - ); - name = Documentation; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8996DFD80EC9CA8C007D7FD5 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D6EEBE70F0138AF00529121 /* zrtp_config.h in Headers */, - 8D6EEBE80F0138AF00529121 /* zrtp_config_user.h in Headers */, - 8D6EEBD70F01388C00529121 /* zrtp.h in Headers */, - 8996E0000EC9CA8C007D7FD5 /* zrtp_base.h in Headers */, - 8D6EEBD80F01388C00529121 /* zrtp_types.h in Headers */, - 8D6EEBDA0F01388C00529121 /* zrtp_error.h in Headers */, - 8D6EEBDB0F01388C00529121 /* zrtp_iface.h in Headers */, - 8D6EEBDC0F01388C00529121 /* zrtp_iface_system.h in Headers */, - 8D6EEBDD0F01388C00529121 /* zrtp_legal.h in Headers */, - 8D6EEBDE0F01388C00529121 /* zrtp_list.h in Headers */, - 8D6EEBDF0F01388C00529121 /* zrtp_log.h in Headers */, - 8D6EEBE00F01388C00529121 /* zrtp_pbx.h in Headers */, - 8D6EEBE10F01388C00529121 /* zrtp_protocol.h in Headers */, - 8D6EEBE20F01388C00529121 /* zrtp_srtp.h in Headers */, - 8D6EEBE30F01388C00529121 /* zrtp_srtp_builtin.h in Headers */, - 8D6EEBE40F01388C00529121 /* zrtp_string.h in Headers */, - 8D6EEBE50F01388C00529121 /* zrtp_crypto.h in Headers */, - 8D6EEBE60F01388C00529121 /* zrtp_version.h in Headers */, - 8996DFEA0EC9CA8C007D7FD5 /* aes.h in Headers */, - 8996DFEB0EC9CA8C007D7FD5 /* aesopt.h in Headers */, - 8996DFEC0EC9CA8C007D7FD5 /* aestab.h in Headers */, - 8996DFED0EC9CA8C007D7FD5 /* bg2zrtp.h in Headers */, - 8996DFEE0EC9CA8C007D7FD5 /* brg_types.h in Headers */, - 8996DFEF0EC9CA8C007D7FD5 /* sha1.h in Headers */, - 8996DFF00EC9CA8C007D7FD5 /* sha2.h in Headers */, - 8996DFF10EC9CA8C007D7FD5 /* bn.h in Headers */, - 8996DFF20EC9CA8C007D7FD5 /* bn32.h in Headers */, - 8996DFF30EC9CA8C007D7FD5 /* lbn.h in Headers */, - 8996DFF40EC9CA8C007D7FD5 /* lbn16.h in Headers */, - 8996DFF50EC9CA8C007D7FD5 /* lbnmem.h in Headers */, - 8996DFF60EC9CA8C007D7FD5 /* legal.h in Headers */, - 8DD1C11E0F36D4A500903190 /* zrtp_config_unix.h in Headers */, - 8DEE0799102FF96100B585AD /* zrtp_ec.h in Headers */, - 8DEE079A102FF96100B585AD /* zrtp_iface_cache.h in Headers */, - 8DEE079B102FF96100B585AD /* zrtp_iface_scheduler.h in Headers */, - 8DCDA604119850ED006B39ED /* zrtp_engine.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8996DFD70EC9CA8C007D7FD5 /* libzrtp */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8996E02D0EC9CA8C007D7FD5 /* Build configuration list for PBXNativeTarget "libzrtp" */; - buildPhases = ( - 8996DFD80EC9CA8C007D7FD5 /* Headers */, - 8996E0030EC9CA8C007D7FD5 /* Sources */, - 8996E02C0EC9CA8C007D7FD5 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = libzrtp; - productName = libzrtp; - productReference = 8996E0300EC9CA8C007D7FD5 /* libzrtp.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0420; - }; - buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "libzrtp" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - en, - ); - mainGroup = 08FB7794FE84155DC02AAC07 /* libzrtp */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8DF95BE80EC06AAE00832CBC /* configure */, - 8996DFD70EC9CA8C007D7FD5 /* libzrtp */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXShellScriptBuildPhase section */ - 8DF95BE70EC06AAE00832CBC /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd ../../projects/gnu\n./configure\nexit 0"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8996E0030EC9CA8C007D7FD5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D6EEBBF0F01386E00529121 /* zrtp.c in Sources */, - 8D6EEBC00F01386E00529121 /* zrtp_crc.c in Sources */, - 8D6EEBC10F01386E00529121 /* zrtp_crypto_aes.c in Sources */, - 8D6EEBC20F01386E00529121 /* zrtp_crypto_atl.c in Sources */, - 8D6EEBC30F01386E00529121 /* zrtp_crypto_hash.c in Sources */, - 8D6EEBC40F01386E00529121 /* zrtp_crypto_pk.c in Sources */, - 8D6EEBC50F01386E00529121 /* zrtp_crypto_sas.c in Sources */, - 8D6EEBC60F01386E00529121 /* zrtp_datatypes.c in Sources */, - 8D6EEBC70F01386E00529121 /* zrtp_engine.c in Sources */, - 8D6EEBC80F01386E00529121 /* zrtp_initiator.c in Sources */, - 8D6EEBC90F01386E00529121 /* zrtp_responder.c in Sources */, - 8D6EEBCA0F01386E00529121 /* zrtp_list.c in Sources */, - 8996E0290EC9CA8C007D7FD5 /* zrtp_log.c in Sources */, - 8D6EEBCB0F01386E00529121 /* zrtp_pbx.c in Sources */, - 8D6EEBCC0F01386E00529121 /* zrtp_protocol.c in Sources */, - 8D6EEBCD0F01386E00529121 /* zrtp_rng.c in Sources */, - 8D6EEBCE0F01386E00529121 /* zrtp_srtp_builtin.c in Sources */, - 8D6EEBCF0F01386E00529121 /* zrtp_string.c in Sources */, - 8D6EEBD00F01386E00529121 /* zrtp_utils.c in Sources */, - 8996E02A0EC9CA8C007D7FD5 /* zrtp_utils_proto.c in Sources */, - 8D6EEBD10F01386E00529121 /* zrtp_legal.c in Sources */, - 8996E01C0EC9CA8C007D7FD5 /* aes_modes.c in Sources */, - 8996E01D0EC9CA8C007D7FD5 /* aescrypt.c in Sources */, - 8D6EEBD30F01386E00529121 /* zrtp_iface_scheduler.c in Sources */, - 8996E0280EC9CA8C007D7FD5 /* zrtp_iface_sys.c in Sources */, - 8996E01E0EC9CA8C007D7FD5 /* aeskey.c in Sources */, - 8996E01F0EC9CA8C007D7FD5 /* aestab.c in Sources */, - 8996E0200EC9CA8C007D7FD5 /* sha1.c in Sources */, - 8996E0210EC9CA8C007D7FD5 /* sha2.c in Sources */, - 8996E0220EC9CA8C007D7FD5 /* bn.c in Sources */, - 8996E0230EC9CA8C007D7FD5 /* bn32.c in Sources */, - 8996E0240EC9CA8C007D7FD5 /* bntest32.c in Sources */, - 8996E0250EC9CA8C007D7FD5 /* lbn32.c in Sources */, - 8996E0260EC9CA8C007D7FD5 /* lbnmem.c in Sources */, - 8996E0270EC9CA8C007D7FD5 /* legal.c in Sources */, - 8996E02B0EC9CA8C007D7FD5 /* bninit32.c in Sources */, - 8DEE07B2102FF9BD00B585AD /* zrtp_crypto_ec.c in Sources */, - 8DEE07B3102FF9BD00B585AD /* zrtp_crypto_ecdh.c in Sources */, - 8DEE07B5102FF9BD00B585AD /* zrtp_engine_driven.c in Sources */, - 8DEE07B6102FF9BD00B585AD /* zrtp_iface_cache.c in Sources */, - 8DEE07B7102FF9BD00B585AD /* zrtp_srtp_dm.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1DEB91F008733DB70010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = NO; - SDKROOT = macosx; - VALID_ARCHS = "i386 x86_64 ppc"; - }; - name = Debug; - }; - 1DEB91F108733DB70010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - SDKROOT = macosx; - VALID_ARCHS = "i386 x86_64 ppc"; - }; - name = Release; - }; - 8996E02E0EC9CA8C007D7FD5 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = ( - "..\\..\\include\\bgaes", - "..\\..\\third_party\\bnlib", - "..\\..\\include", - ); - INSTALL_PATH = /usr/local/lib; - ONLY_ACTIVE_ARCH = NO; - OTHER_CFLAGS = ""; - PRODUCT_NAME = zrtp; - SDKROOT = macosx; - SYMROOT = build; - VALID_ARCHS = "i386 ppc x86_64"; - }; - name = Debug; - }; - 8996E02F0EC9CA8C007D7FD5 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_MODEL_TUNING = G5; - HEADER_SEARCH_PATHS = ( - "..\\..\\include\\bgaes", - "..\\..\\third_party\\bnlib", - "..\\..\\include", - ); - INSTALL_PATH = /usr/local/lib; - OTHER_CFLAGS = "-DZRTP_USE_ENTERPRISE=1"; - PRODUCT_NAME = zrtp; - SDKROOT = macosx; - VALID_ARCHS = "i386 ppc x86_64"; - }; - name = Release; - }; - 8DF95BE90EC06AAF00832CBC /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - PRODUCT_NAME = configure; - }; - name = Debug; - }; - 8DF95BEA0EC06AAF00832CBC /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - PRODUCT_NAME = configure; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "libzrtp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91F008733DB70010E9CD /* Debug */, - 1DEB91F108733DB70010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8996E02D0EC9CA8C007D7FD5 /* Build configuration list for PBXNativeTarget "libzrtp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8996E02E0EC9CA8C007D7FD5 /* Debug */, - 8996E02F0EC9CA8C007D7FD5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8DF95BEB0EC06ACD00832CBC /* Build configuration list for PBXAggregateTarget "configure" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8DF95BE90EC06AAF00832CBC /* Debug */, - 8DF95BEA0EC06AAF00832CBC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; -} diff --git a/libs/libzrtp/projects/xcode/libzrtp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/libs/libzrtp/projects/xcode/libzrtp.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index d933b88e96..0000000000 --- a/libs/libzrtp/projects/xcode/libzrtp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Workspace - version = "1.0"> - <FileRef - location = "self:libzrtp.xcodeproj"> - </FileRef> -</Workspace> 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 = "<group>"; }; -/* 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 = "<group>"; - }; - 08FB7795FE84155DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 8DFEC0890F0125D3004540A4 /* include */, - 8DFEC08A0F0125DE004540A4 /* src */, - ); - name = Source; - sourceTree = "<group>"; - }; - 1AB674ADFE9D54B511CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D6EEC500F013D2A00529121 /* libzrtp_test_ec */, - ); - name = Products; - sourceTree = "<group>"; - }; - 8D6EED040F0145AA00529121 /* Products */ = { - isa = PBXGroup; - children = ( - 8D6EED0F0F0145AA00529121 /* libzrtp.a */, - ); - name = Products; - sourceTree = "<group>"; - }; - 8DFEC0890F0125D3004540A4 /* include */ = { - isa = PBXGroup; - children = ( - 8D6EECF50F01450800529121 /* zrtp_test_core.h */, - 8D6EECF60F01450800529121 /* zrtp_test_queue.h */, - ); - name = include; - sourceTree = "<group>"; - }; - 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 = "<group>"; - }; -/* 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Workspace - version = "1.0"> - <FileRef - location = "self:libzrtp_test.xcodeproj"> - </FileRef> -</Workspace> 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 <v.krikun at zfoneproject.com> - */ - -#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; i<ZRTP_MAX_STREAMS_PER_SESSION ; i++) { - new_session->streams[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; i<ZRTP_MAX_STREAMS_PER_SESSION; i++) { - zrtp_stream_t *the_stream = &session->streams[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; i<ZRTP_MAX_STREAMS_PER_SESSION; i++) { - if (ZRTP_STATE_NONE == session->streams[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; i<ZRTP_MAX_STREAMS_PER_SESSION; i++) { - zrtp_stream_t* full_stream = &session->streams[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 <v.krikun at zfoneproject.com> - */ - -#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<length; i++) { - ZRTP_CRC32C(crc_c, crc32, buff[i]); - } - result = ~crc32; - - /* result now holds the negated polynomial remainder; - * since the table and algorithm is "reflected" [williams95]. - * That is, result has the same value as if we mapped the message - * to a polynomial, computed the host-bit-order polynomial - * remainder, performed final negation, then did an end-for-end - * bit-reversal. - * Note that a 32-bit bit-reversal is identical to four inplace - * 8-bit reversals followed by an end-for-end byteswap. - * In other words, the bits of each byte are in the right order, - * but the bytes have been byteswapped. So we now do an explicit - * byteswap. On a little-endian machine, this byteswap and - * the final ntohl cancel out and could be elided. - */ - - byte0 = result & 0xff; - byte1 = (result>>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 <v.krikun at zfoneproject.com> - * Vitaly Rozhkov <v.rozhkov at soft-industry.com> - */ - -#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; i<sizeof(aes_cfb_test_buf1a); i++) { - if (aes_cfb_test_buf1b[i] != aes_cfb_test_buf1a[i]) { - ZRTP_LOGC(1, ("ERROR! 128-bit AES CFB failed on decrypt test\n")); - self->stop(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; i<sizeof(aes_cfb_test_buf3a); i++) { - if (aes_cfb_test_buf3a[i] != aes_cfb_test_buf3b[i]) { - ZRTP_LOGC(1, ("ERROR! 128-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_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; i<sizeof(aes_cfb_test_buf3b); i++) { - if (aes_cfb_test_buf3b[i] != 0x00) { - ZRTP_LOGC(1, ("ERROR! 128-bit AES CFB failed on decrypt test\n")); - self->stop(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; i<sizeof(aes_ctr_test_ciphertext128); i++) { - if (tmp_buf[i] != aes_ctr_test_ciphertext128[i]) { - ZRTP_LOGC(1, ("ERROR! Fail on 128 bit encrypt test. i=%i\n", i)); - self->stop(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; i<sizeof(aes_ctr_test_plaintext128); i++) { - if (tmp_buf[i] != aes_ctr_test_plaintext128[i]) { - ZRTP_LOGC(1, ("ERROR! 128-bit AES CTR failed on decrypt test\n")); - self->stop(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; i<sizeof(aes_cfb_test_buf2b); i++) { - if (aes_cfb_test_buf2b[i] != aes_cfb_test_buf2a[i]) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB failed on decrypt test\n")); - self->stop(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; i<sizeof(aes_cfb_test_buf3a); i++) { - if (aes_cfb_test_buf3a[i] != aes_cfb_test_buf3c[i]) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB failed on bit 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_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; i<sizeof(aes_cfb_test_buf3c); i++) { - if (aes_cfb_test_buf3c[i] != 0x00) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB failed on decrypt test\n")); - self->stop(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; i<sizeof(aes_ctr_test_ciphertext256); i++) { - if (tmp_buf[i] != aes_ctr_test_ciphertext256[i]) { - ZRTP_LOGC(1, ("ERROR! Fail on 256 bit encrypt test. i=%i\n", i)); - self->stop(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; i<sizeof(aes_ctr_test_plaintext256); i++) { - if (tmp_buf[i] != aes_ctr_test_plaintext256[i]) { - ZRTP_LOGC(1, (_ZTU_, "ERROR! 256-bit AES CTR failed on decrypt test\n")); - self->stop(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 <v.krikun at zfoneproject.com> - */ - -#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, 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x9a, 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(&params, 256); - return ECDSA_keygen(self, dsa_cc, &params, -#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(&params, 256); - return ECDSA_sign(self, dsa_cc, &params, -#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(&params, 256); - return ECDSA_verify(self, dsa_cc, &params, -#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(&params, 384); - return ECDSA_keygen(self, dsa_cc, &params, -#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(&params, 384); - return ECDSA_sign(self, dsa_cc, &params, -#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(&params, 384); - return ECDSA_verify(self, dsa_cc, &params, 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(&params, 521); - return ECDSA_keygen(self, dsa_cc, &params, -#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(&params, 521); - return ECDSA_sign(self, dsa_cc, &params, -#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(&params, 521); - return ECDSA_verify(self, dsa_cc, &params, 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 <v.krikun at zfoneproject.com> - * Vitaly Rozhkov <v.rozhkov at soft-industry.com> - */ - -#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; i<local_key_len; i++) { - k_ipad[i] ^= 0x36; - k_opad[i] ^= 0x5c; - } - - switch (self->base.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, 0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 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 <v.krikun at zfoneproject.com> - */ - -#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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7A, 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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - -#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 <RTP+static HELLO part>. */ - 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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - -#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 <stdio.h> -#endif - -#include <string.h> - -/*---------------------------------------------------------------------------*/ -#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<mitmcache_elems_count; i++) - { - new_elem = (zrtp_cache_elem_t*) zrtp_sys_alloc(sizeof(zrtp_cache_elem_t)); - if (!new_elem) { - ZRTP_INT_CACHE_BREAK(s, zrtp_status_alloc_fail); - } - - if (fread(new_elem, ZRTP_MITMCACHE_ELEM_LENGTH, 1, cache_file) <= 0) { - ZRTP_LOG(3,(_ZTU_,"\tERROR! MiTM cache element read fail (id=%u).\n", i)); - - zrtp_sys_free(new_elem); - ZRTP_INT_CACHE_BREAK(s, zrtp_status_read_fail); - } - - cache_make_cross(NULL, new_elem, 1); - - new_elem->_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<cache_elems_count; i++) - { - new_elem = (zrtp_cache_elem_t*) zrtp_sys_alloc(sizeof(zrtp_cache_elem_t)); - if (!new_elem) { - ZRTP_INT_CACHE_BREAK(s, zrtp_status_alloc_fail); - } - - if (fread(new_elem, ZRTP_CACHE_ELEM_LENGTH, 1, cache_file) <= 0) { - ZRTP_LOG(3,(_ZTU_,"\tERROR! RS cache element read fail (id=%u).\n", i)); - zrtp_sys_free(new_elem); - ZRTP_INT_CACHE_BREAK(s, zrtp_status_read_fail); - } - - cache_make_cross(NULL, new_elem, 1); - - new_elem->_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: <secrets count>, <secrets' data> - * - * 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: <secrets count>, <secrets' data> - */ - - /* 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 <v.krikun at zfoneproject.com> - */ - -#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 <pjlib.h> -#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 <Windows.h> - -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 <time.h> /* for nanosleep */ -#elif ZRTP_HAVE_UNISTD_H == 1 -#include <unistd.h> -#else -#error "Used environment dosn't have <unistd.h> - zrtp_scheduler can't be build." -#endif - -#if ZRTP_HAVE_PTHREAD_H == 1 -#include <pthread.h> -#else -# error "Used environment dosn't have <pthread.h> - 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 <v.krikun at zfoneproject.com> - */ - -#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 <Ndis.h> - -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 <Windows.h> - -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 <pthread.h> -#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 <stdio.h> -#endif -#if ZRTP_HAVE_SEMAPHORE_H -# include <semaphore.h> -#endif -#if ZRTP_HAVE_FCNTL_H -# include <fcntl.h> -#endif -#if ZRTP_HAVE_ERRNO_H -# include <errno.h> -#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 <string.h> /* 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 <sys/time.h> -#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 <v.krikun at zfoneproject.com> - */ - -#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 <prz@mit.edu> (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. <http://fsf.org/> - 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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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 <http://www.gnu.org/licenses/>. - -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 -<http://www.gnu.org/licenses/>. - -****************************************************************************/ 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 <v.krikun at zfoneproject.com> - */ - -#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 <v.krikun at zfoneproject.com> - */ - -#include "zrtp.h" - -#if (ZRTP_PLATFORM == ZP_WIN32_KERNEL) -#include <ndis.h> -#include <ntstrsafe.h> -#endif - -#if ZRTP_LOG_MAX_LEVEL >= 1 - -/*----------------------------------------------------------------------------*/ -#if defined ZRTP_HAVE_STDIO_H -# include <stdio.h> -#endif -#if defined ZRTP_HAVE_STRING_H -# include <string.h> -#endif -#if defined ZRTP_HAVE_STDARG_H -# include <stdarg.h> -#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<ZRTP_LOG_SENDER_MAX_LEN; ++i) { - *sline++ = *sender++; - } - } - - *sline++ = ']'; - *sline++ = ':'; - offset += 3 + ZRTP_LOG_SENDER_MAX_LEN; - - *sline++ = ' '; - offset += 1; - } - - /* Print Message itself */ -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN64) || (ZRTP_PLATFORM == ZP_WINCE) -# if (_MSC_VER >= 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 <v.krikun at zfoneproject.com> - */ - -#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; i<enhello->sc; 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; j<nonenhello->sc; 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 <v.krikun at zfoneproject.com> - */ - -#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: - * <RS1, 0, 0>, <RS1, AUX, 0>, <RS1, 0, PBX>, <RS1, AUX, PBX>. - */ - 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 <v.krikun at zfoneproject.com> - */ - -#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 <Wincrypt.h> - -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 <Ndis.h> - -/*----------------------------------------------------------------------------*/ -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 <stdio.h> -#else -# error "Used environment dosn't have <stdio.h> - 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 <v.rozhkov at soft-industry.com> - */ - -#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 <label>, set the rest of it to zero */ - zrtp_memset(&nonce, 0, sizeof(zrtp_v128_t)); - nonce.v8[7] = label; -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\t\tcipher IV[%s]\n", - hex2str((const char*)nonce.v8, sizeof(zrtp_v128_t), (char*)buffer, sizeof(buffer)))); -#endif - zrtp_cipher_set_iv(ctx, &nonce); - - length = (uint16_t) ZRTP_MIN(result_key->length, result_key->max_length); -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\t\texcepced key length[%i] result key length[%i]\n", result_key->length, length)); -#endif - zrtp_memset(result_key->buffer, 0, length); - - if(zrtp_status_ok == zrtp_cipher_encrypt(ctx, (uint8_t*)result_key->buffer, length)){ - result_key->length = length; - return length; - }else{ - return -1; - } -} - - -/*! \brief This function deallocates key derivation context allocated by \ref zrtp_dk_init() call. - * \param ctx - pointer to key derivation context to deallocate - */ -void zrtp_dk_deinit(zrtp_dk_ctx *ctx) -{ - zrtp_cipher_stop(ctx); - zrtp_memset(ctx, 0, sizeof(zrtp_dk_ctx)); - zrtp_sys_free(ctx); -} - - -/*! \brief This function allocates SRTP session and two stream contexts. - * \return - * - pointer to allocated SRTP session structure - * - NULL if error - */ -/*---------------------------------------------------------------------------*/ -zrtp_srtp_ctx_t * zrtp_srtp_alloc() -{ - zrtp_srtp_ctx_t *srtp_ctx = NULL; - - do{ - srtp_ctx = zrtp_sys_alloc(sizeof(zrtp_srtp_ctx_t)); - if(NULL == srtp_ctx){ - break; - } - - srtp_ctx->incoming_srtp = zrtp_sys_alloc(sizeof(zrtp_srtp_stream_ctx_t)); - if(NULL == srtp_ctx->incoming_srtp){ - /*deallocate everything previously allocated on failure*/ - zrtp_sys_free(srtp_ctx); - srtp_ctx = NULL; - break; - } - - srtp_ctx->outgoing_srtp = zrtp_sys_alloc(sizeof(zrtp_srtp_stream_ctx_t)); - if(NULL == srtp_ctx->outgoing_srtp){ - /*deallocate everything previously allocated on failure*/ - zrtp_sys_free(srtp_ctx->incoming_srtp); - zrtp_sys_free(srtp_ctx); - srtp_ctx = NULL; - break; - } - - }while(0); - - return srtp_ctx; -} - -/*! \brief This function deallocates SRTP session structure allocated by zrtp_srtp_alloc() call. - * \param srtp_ctx - pointer to SRTP session structure. - */ -void zrtp_srtp_free(zrtp_srtp_ctx_t * srtp_ctx) -{ - if (srtp_ctx) - { - if (srtp_ctx->incoming_srtp) - zrtp_sys_free(srtp_ctx->incoming_srtp); - if (srtp_ctx->outgoing_srtp) - zrtp_sys_free(srtp_ctx->outgoing_srtp); - zrtp_sys_free(srtp_ctx); - } -} - -/*! \brief This function initializes stream context based on given profile. - * \param srtp_global - pointer to SRTP engine global context - * \param srtp_stream - pointer to stream context to initialize - * \param profile - pointer to profile for stream initialization - * \return - * - zrtp_status_ok if stream has been initialized successfully - * - one of \ref zrtp_status_t errors - if error - */ -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_stream_init( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_stream_ctx_t *srtp_stream, - zrtp_srtp_profile_t *profile ) -{ -#if ZRTP_DEBUG_SRTP_KEYS - char buffer[256]; -#endif - zrtp_status_t res = zrtp_status_ok; - - /* - TODO: use dynamic buffers for temoprary keys storing - - NOTE!: be sure that tmp_key contains enought buffer length to store all - of derived keys. Authentication keys may be large. - */ - zrtp_string128_t tmp_key = ZSTR_INIT_EMPTY(tmp_key); - /*salt length is 16 bytes always*/ - zrtp_string16_t tmp_salt = ZSTR_INIT_EMPTY(tmp_salt); - - do{ - zrtp_dk_ctx *dk_ctx = NULL; -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\tzrtp_srtp_stream_init():\n")); -#endif - if(NULL == srtp_stream || NULL == profile){ - res = zrtp_status_bad_param; - break; - } - - dk_ctx = zrtp_dk_init( profile->dk_cipher, - (zrtp_stringn_t*)&profile->key, - (zrtp_stringn_t*)&profile->salt ); - if(NULL == dk_ctx) - { - res = zrtp_status_fail; - break; - } -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\t\tmaster_key[%s]\n", - hex2str(profile->key.buffer, profile->key.length, buffer, sizeof(buffer)))); - ZRTP_LOG(3,(_ZTU_, "\t\tmaster_salt[%s]\n", - hex2str(profile->salt.buffer, profile->salt.length, buffer, sizeof(buffer)))); -#endif - - /*------------ init RTP-items ----------------*/ - srtp_stream->rtp_cipher.cipher = profile->rtp_policy.cipher; - - tmp_key.length = (uint16_t) profile->rtp_policy.cipher_key_len; - tmp_salt.length = profile->salt.length; - - - zrtp_derive_key(dk_ctx, label_rtp_encryption, (zrtp_stringn_t*)&tmp_key); -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\t\tderive RTP encryption key[%s] label:%i\n", - hex2str(tmp_key.buffer, tmp_key.length, buffer, sizeof(buffer)), label_rtp_encryption)); - -#endif - zrtp_derive_key(dk_ctx, label_rtp_salt, (zrtp_stringn_t*)&tmp_salt); -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\t\tderive RTP encryption salt[%s] label:%i\n", - hex2str(tmp_salt.buffer, tmp_salt.length, buffer, sizeof(buffer)), label_rtp_salt)); -#endif - srtp_stream->rtp_cipher.ctx = zrtp_cipher_start(&srtp_stream->rtp_cipher, - tmp_key.buffer, - tmp_salt.buffer, - ZRTP_CIPHER_MODE_CTR ); - if(NULL == srtp_stream->rtp_cipher.ctx){ - zrtp_dk_deinit(dk_ctx); - res = zrtp_status_fail; - break; - } - - srtp_stream->rtp_auth.hash = profile->rtp_policy.hash; - srtp_stream->rtp_auth.key_len = profile->rtp_policy.auth_key_len; - srtp_stream->rtp_auth.tag_len = profile->rtp_policy.auth_tag_len; - - srtp_stream->rtp_auth.key = zrtp_sys_alloc(srtp_stream->rtp_auth.key_len); - if(NULL == srtp_stream->rtp_auth.key){ - zrtp_dk_deinit(dk_ctx); - zrtp_cipher_stop(&srtp_stream->rtp_cipher); - res = zrtp_status_fail; - break; - } - - tmp_key.length = (uint16_t)srtp_stream->rtp_auth.key_len; - zrtp_derive_key(dk_ctx, label_rtp_msg_auth, (zrtp_stringn_t*)&tmp_key); - zrtp_memcpy(srtp_stream->rtp_auth.key, tmp_key.buffer, tmp_key.length); -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\t\tderive RTP auth key[%s]\n", - hex2str(tmp_key.buffer, tmp_key.length, buffer, sizeof(buffer)))); -#endif - /*--------- init RTCP-items ----------------*/ - srtp_stream->rtcp_cipher.cipher = profile->rtcp_policy.cipher; - tmp_key.length = (uint16_t) profile->rtcp_policy.cipher_key_len; - - tmp_salt.length = profile->salt.length; - zrtp_derive_key(dk_ctx, label_rtcp_encryption, (zrtp_stringn_t*)&tmp_key); - zrtp_derive_key(dk_ctx, label_rtcp_salt, (zrtp_stringn_t*)&tmp_salt); - -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\t\tderive RTCP encryption key[%s]\n", - hex2str(tmp_key.buffer, tmp_key.length, buffer, sizeof(buffer)))); - ZRTP_LOG(3,(_ZTU_, "\t\tderive RTCP encryption salt[%s]\n", - hex2str(tmp_salt.buffer, tmp_salt.length, buffer, sizeof(buffer)))); -#endif - srtp_stream->rtcp_cipher.ctx = zrtp_cipher_start(&srtp_stream->rtcp_cipher, - tmp_key.buffer, - tmp_salt.buffer, - ZRTP_CIPHER_MODE_CTR ); - - if(NULL == srtp_stream->rtcp_cipher.ctx){ - zrtp_dk_deinit(dk_ctx); - zrtp_cipher_stop(&srtp_stream->rtp_cipher); - zrtp_sys_free(srtp_stream->rtp_auth.key); - res = zrtp_status_fail; - break; - } - - srtp_stream->rtcp_auth.hash = profile->rtcp_policy.hash; - srtp_stream->rtcp_auth.key_len = profile->rtcp_policy.auth_key_len; - srtp_stream->rtcp_auth.tag_len = profile->rtcp_policy.auth_tag_len; - - srtp_stream->rtcp_auth.key = zrtp_sys_alloc(srtp_stream->rtcp_auth.key_len); - if(NULL == srtp_stream->rtcp_auth.key){ - zrtp_dk_deinit(dk_ctx); - zrtp_cipher_stop(&srtp_stream->rtp_cipher); - zrtp_sys_free(srtp_stream->rtp_auth.key); - zrtp_cipher_stop(&srtp_stream->rtcp_cipher); - res = zrtp_status_fail; - break; - } - - tmp_key.length = (uint16_t)srtp_stream->rtcp_auth.key_len; - zrtp_derive_key(dk_ctx, label_rtcp_msg_auth, (zrtp_stringn_t*)&tmp_key); -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\t\tderive RTCP auth key[%s]\n", - hex2str(tmp_key.buffer, tmp_key.length, buffer, sizeof(buffer)))); -#endif - - zrtp_memcpy(srtp_stream->rtcp_auth.key, tmp_key.buffer, tmp_key.length); - zrtp_dk_deinit(dk_ctx); - - zrtp_wipe_zstring(ZSTR_GV(tmp_key)); - zrtp_wipe_zstring(ZSTR_GV(tmp_salt)); - - }while(0); - return res; -} - - -/*! \brief This function deinitializes stream context. - * \param srtp_global - pointer to SRTP engine global context - * \param srtp_stream - pointer to steam to deinitialize - */ -/*---------------------------------------------------------------------------*/ -void zrtp_srtp_stream_deinit( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_stream_ctx_t *srtp_stream ) -{ - zrtp_cipher_stop(&srtp_stream->rtp_cipher); - zrtp_memset(srtp_stream->rtp_auth.key, 0, srtp_stream->rtp_auth.key_len); - zrtp_sys_free(srtp_stream->rtp_auth.key); - - zrtp_cipher_stop(&srtp_stream->rtcp_cipher); - zrtp_memset(srtp_stream->rtcp_auth.key, 0, srtp_stream->rtcp_auth.key_len); - zrtp_sys_free(srtp_stream->rtcp_auth.key); -} - - -/*! \brief This function initializes SRTP session context. - * \param srtp_global - pointer to SRTP engine global context - * \param srtp_ctx - pointer to SRTP session context to initialize - * \param inc_profile - profile for incoming stream configuration; - * \param out_profile - profile for outgoing stream configuration. - * \return - * - zrtp_status_ok if stream has been initialized successfully - * - one of \ref zrtp_status_t errors - if error - */ -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_init_ctx( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_srtp_profile_t *inc_profile, - zrtp_srtp_profile_t *out_profile) -{ - zrtp_status_t res = zrtp_status_ok; - do{ - if(NULL == srtp_ctx || NULL == inc_profile || NULL == out_profile){ - res = zrtp_status_bad_param; - break; - } - - if(zrtp_status_ok != zrtp_srtp_stream_init(srtp_global, srtp_ctx->incoming_srtp, inc_profile)){ - res = zrtp_status_fail; - break; - } - - if(zrtp_status_ok != zrtp_srtp_stream_init(srtp_global, srtp_ctx->outgoing_srtp, out_profile)){ - zrtp_srtp_stream_deinit(srtp_global, srtp_ctx->incoming_srtp); - res = zrtp_status_fail; - break; - } - - }while(0); - return res; -} - - -/*===========================================================================*/ -/* Public interface */ -/*===========================================================================*/ - - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_init(zrtp_global_t *zrtp){ - - zrtp_srtp_global_t *srtp_global; - zrtp->srtp_global = NULL; - - if(EXIT_SUCCESS != zrtp_bg_gen_tabs()) - return zrtp_status_fail; - - srtp_global = zrtp_sys_alloc(sizeof(zrtp_srtp_global_t)); - if(NULL == srtp_global){ - return zrtp_status_fail; - } - srtp_global->rp_ctx = rp_init(); - if(NULL == srtp_global->rp_ctx){ - zrtp_sys_free(srtp_global); - return zrtp_status_fail; - } - - zrtp->srtp_global = srtp_global; - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_srtp_down(zrtp_global_t *zrtp){ - zrtp_srtp_global_t *srtp_global = zrtp->srtp_global; - - rp_destroy(srtp_global->rp_ctx); - zrtp_sys_free(srtp_global); - zrtp->srtp_global = NULL; - return zrtp_status_ok; -} - -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) -{ - zrtp_srtp_ctx_t *srtp_ctx = NULL; - if(NULL == inc_profile || NULL == out_profile){ - return NULL; - } - - do{ - srtp_ctx = zrtp_srtp_alloc(); - if(NULL == srtp_ctx){ - break; - } - - if(zrtp_status_ok != zrtp_srtp_init_ctx(srtp_global, srtp_ctx, inc_profile, out_profile)){ - zrtp_srtp_free(srtp_ctx); - srtp_ctx = NULL; - break; - } - - }while(0); - - return srtp_ctx; -} - -zrtp_status_t zrtp_srtp_destroy(zrtp_srtp_global_t *srtp_global, zrtp_srtp_ctx_t * srtp_ctx){ - zrtp_status_t res = zrtp_status_ok; - - remove_rp_nodes_by_srtp_ctx(srtp_ctx, srtp_global->rp_ctx); - - zrtp_srtp_stream_deinit(srtp_global, srtp_ctx->incoming_srtp); - zrtp_srtp_stream_deinit(srtp_global, srtp_ctx->outgoing_srtp); - zrtp_srtp_free(srtp_ctx); - - return res; -} - - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_protect( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet) -{ - zrtp_srtp_stream_ctx_t *srtp_stream_ctx = srtp_ctx->outgoing_srtp; - zrtp_rp_node_t *rp_node; - - uint32_t *enc_start; /* pointer to start of encrypted portion */ - uint32_t *auth_start; /* pointer to start of auth. portion */ - unsigned enc_octet_len = 0; /* number of octets in encrypted portion */ - uint8_t *auth_tag = NULL; /* location of auth_tag within packet */ - zrtp_status_t status; - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *hdr; - - zrtp_v128_t iv; - uint64_t packet_seq = 0; - zrtp_string64_t auth_tag_str = ZSTR_INIT_EMPTY(auth_tag_str); - void *hash_ctx = NULL; - - /* add new replay protection node or get existing one */ - rp_node = add_rp_node(srtp_ctx, srtp_global->rp_ctx, RP_OUTGOING_DIRECTION, packet->ssrc); - if(NULL == rp_node){ - return zrtp_status_rp_fail; - } - - /* check the packet length - it must at least contain a full header */ - if (*(packet->length) < octets_in_rtp_header){ - return zrtp_status_bad_param; - } - - hdr = (zrtp_rtp_hdr_t*)(packet->packet); - enc_start = (uint32_t *)hdr + uint32s_in_rtp_header + hdr->cc; - if (1 == hdr->x) { - zrtp_rtp_hdr_xtnd_t *xtn_hdr = (zrtp_rtp_hdr_xtnd_t *)enc_start; - enc_start += (zrtp_ntoh16(xtn_hdr->length) + 1); - } - //WIN64 - enc_octet_len = *(packet->length) - (uint32_t)((enc_start - (uint32_t *)hdr) << 2); - - auth_start = (uint32_t *)hdr; - auth_tag = (uint8_t *)hdr + *(packet->length); - - status = zrtp_srtp_rp_check(&rp_node->rtp_rp, packet); - if(zrtp_status_ok != status){ - return zrtp_status_rp_fail; - } - zrtp_srtp_rp_add(&rp_node->rtp_rp, packet); - - iv.v32[0] = 0; - iv.v32[1] = hdr->ssrc; - -#ifdef ZRTP_NO_64BIT_MATH - iv.v64[1] = zrtp_hton64(make64((packet->seq) >> 16, (packet->seq) << 16)); -#else - iv.v64[1] = zrtp_hton64(((uint64_t)(packet->seq)) << 16); -#endif - status = zrtp_cipher_set_iv(&srtp_stream_ctx->rtp_cipher, &iv); - if(status){ - return zrtp_status_cipher_fail; - } - - status = zrtp_cipher_encrypt(&srtp_stream_ctx->rtp_cipher, (unsigned char*)enc_start, enc_octet_len); - if(status){ - return zrtp_status_cipher_fail; - } - - - /* shift est, put into network byte order */ - packet_seq = packet->seq; -#ifdef ZRTP_NO_64BIT_MATH - packet_seq = zrtp_hton64(make64((high32(packet_seq) << 16) | - (low32(packet_seq) >> 16), - low32(packet_seq) << 16)); -#else - packet_seq = zrtp_hton64(packet_seq << 16); -#endif - - hash_ctx = srtp_stream_ctx->rtp_auth.hash->hmac_begin_c( srtp_stream_ctx->rtp_auth.hash, - (const char*)srtp_stream_ctx->rtp_auth.key, - srtp_stream_ctx->rtp_auth.key_len ); - if(NULL == hash_ctx) - { - return zrtp_status_auth_fail; - } - status = srtp_stream_ctx->rtp_auth.hash->hmac_update( srtp_stream_ctx->rtp_auth.hash, - hash_ctx, - (const char*)auth_start, - *packet->length); - if(status) - { - return zrtp_status_auth_fail; - } - status = srtp_stream_ctx->rtp_auth.hash->hmac_update( srtp_stream_ctx->rtp_auth.hash, - hash_ctx, - (const char*)&packet_seq, - 4); - if(status) - { - return zrtp_status_auth_fail; - } - status = srtp_stream_ctx->rtp_auth.hash->hmac_end( srtp_stream_ctx->rtp_auth.hash, - hash_ctx, - (zrtp_stringn_t*) &auth_tag_str, - srtp_stream_ctx->rtp_auth.tag_len->tag_length); - if(status) - { - return zrtp_status_auth_fail; - } - - /* uncomment this for authentication debug */ -#if ZRTP_DEBUG_SRTP_KEYS - { - char buff[256]; - ZRTP_LOG(3,(_ZTU_, - "\tzrtp_srtp_protect authentication make: npacket_seq[%s] expected auth length[%i] result auth length[%i]\n", - hex2str((char*)&packet_seq, sizeof(packet_seq), buff, sizeof(buff)), - srtp_stream_ctx->rtp_auth.tag_len->tag_length, - auth_tag_str.length)); - ZRTP_LOG(3,(_ZTU_, "\tauth tag[%s]\n", - hex2str(auth_tag_str.buffer, auth_tag_str.length, buff, sizeof(buff)))); - } -#endif - zrtp_memcpy(auth_tag, auth_tag_str.buffer, auth_tag_str.length); - *packet->length += auth_tag_str.length; - - return status; -} - - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_unprotect( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet) -{ - zrtp_srtp_stream_ctx_t *srtp_stream_ctx = srtp_ctx->incoming_srtp; - zrtp_rp_node_t *rp_node; - - - uint32_t *enc_start; /* pointer to start of encrypted portion */ - uint32_t *auth_start; /* pointer to start of auth. portion */ - unsigned enc_octet_len = 0; /* number of octets in encrypted portion */ - uint8_t *auth_tag = NULL; /* location of auth_tag within packet */ - zrtp_status_t status; - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *hdr = NULL; - - - void *hash_ctx = NULL; - zrtp_v128_t iv; - int tag_len = 0; - - /*add new replay protection node or get existing one*/ - rp_node = add_rp_node(srtp_ctx, srtp_global->rp_ctx, RP_INCOMING_DIRECTION, packet->ssrc); - if(NULL == rp_node){ - return zrtp_status_rp_fail; - } - - /* check the packet length - it must at least contain a full header */ - if (*(packet->length) < octets_in_rtp_header) - { - return zrtp_status_bad_param; - } - - hdr = (zrtp_rtp_hdr_t*)(packet->packet); - - status = zrtp_srtp_rp_check(&rp_node->rtp_rp, packet); - if(zrtp_status_ok != status){ - return zrtp_status_rp_fail; - } - - iv.v32[0] = 0; - iv.v32[1] = hdr->ssrc; - -#ifdef ZRTP_NO_64BIT_MATH - iv.v64[1] = zrtp_hton64(make64((packet->seq) >> 16, (packet->seq) << 16)); -#else - iv.v64[1] = zrtp_hton64((uint64_t)(packet->seq) << 16); -#endif - - status = zrtp_cipher_set_iv(&srtp_stream_ctx->rtp_cipher, &iv); - if(status){ - return zrtp_status_cipher_fail; - } - - tag_len = srtp_stream_ctx->rtp_auth.tag_len->tag_length; - hdr = (zrtp_rtp_hdr_t*)(packet->packet); - - enc_start = (uint32_t *)hdr + uint32s_in_rtp_header + hdr->cc; - if (1 == hdr->x) { - zrtp_rtp_hdr_xtnd_t *xtn_hdr = (zrtp_rtp_hdr_xtnd_t *)enc_start; - enc_start += (zrtp_ntoh16(xtn_hdr->length) + 1); - } - //WIN64 - enc_octet_len = *(packet->length) - tag_len - (uint32_t)((enc_start - (uint32_t *)hdr) << 2); - - - auth_start = (uint32_t *)hdr; - auth_tag = (uint8_t *)hdr + *(packet->length) - tag_len; - - if(tag_len>0){ - zrtp_string64_t auth_tag_str = ZSTR_INIT_EMPTY(auth_tag_str); - - /* shift est, put into network byte order */ - uint64_t packet_seq = packet->seq; -#ifdef ZRTP_NO_64BIT_MATH - packet_seq = zrtp_hton64( make64((high32(packet_seq) << 16) | - (low32(packet_seq) >> 16), - low32(packet_seq) << 16)); -#else - packet_seq = zrtp_hton64(packet_seq << 16); -#endif - - hash_ctx = srtp_stream_ctx->rtp_auth.hash->hmac_begin_c( srtp_stream_ctx->rtp_auth.hash, - (const char*)srtp_stream_ctx->rtp_auth.key, - srtp_stream_ctx->rtp_auth.key_len); - if(NULL == hash_ctx){ - return zrtp_status_auth_fail; - } - status = srtp_stream_ctx->rtp_auth.hash->hmac_update( srtp_stream_ctx->rtp_auth.hash, - hash_ctx, - (const char*)auth_start, - *packet->length - tag_len); - if(status){ - return zrtp_status_auth_fail; - } - - status = srtp_stream_ctx->rtp_auth.hash->hmac_update( srtp_stream_ctx->rtp_auth.hash, - hash_ctx, - (const char*)&packet_seq, - 4); - if(status){ - return zrtp_status_auth_fail; - } - - status = srtp_stream_ctx->rtp_auth.hash->hmac_end( srtp_stream_ctx->rtp_auth.hash, - hash_ctx, - (zrtp_stringn_t*) &auth_tag_str, - srtp_stream_ctx->rtp_auth.tag_len->tag_length); -#if ZRTP_DEBUG_SRTP_KEYS - { - char buff[256]; - ZRTP_LOG(3,(_ZTU_, - "\tzrtp_srtp_unprotect authentication check. packet_seq[%s] expected auth length[%i] result auth length[%i]\n", - hex2str((char*)&packet_seq, sizeof(packet_seq), buff, sizeof(buff)), - srtp_stream_ctx->rtp_auth.tag_len->tag_length, - auth_tag_str.length)); - ZRTP_LOG(3,(_ZTU_, "\tauth tag[%s]\n", - hex2str(auth_tag_str.buffer, auth_tag_str.length, buff, sizeof(buff)))); - } -#endif - if(status || tag_len != auth_tag_str.length){ -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_, "\tAuthentication fail1: status[%i] auth_tag_length[%i] result auth_tag_len[%i]\n", - status, tag_len, auth_tag_str.length)); -#endif - return zrtp_status_auth_fail; - } - - if(0 != zrtp_memcmp((uint8_t *)auth_tag_str.buffer, (uint8_t *)auth_tag, tag_len)){ -#if ZRTP_DEBUG_SRTP_KEYS - char buff[256], buff2[256]; - ZRTP_LOG(3,(_ZTU_, "\tAuthentication fail2: tag[%s] computed_tag[%s]\n", - hex2str((uint8_t *)auth_tag, tag_len, buff, sizeof(buff)), - hex2str(auth_tag_str.buffer, auth_tag_str.length, buff2, sizeof(buff2)))); -#endif - return zrtp_status_auth_fail; - } - } - - status = zrtp_cipher_decrypt(&srtp_stream_ctx->rtp_cipher, (unsigned char*)enc_start, enc_octet_len); - if(status){ - return zrtp_status_cipher_fail; - } - - zrtp_srtp_rp_add(&rp_node->rtp_rp, packet); - *packet->length -= tag_len; - - return status; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_protect_rtcp( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet) -{ - zrtp_srtp_stream_ctx_t *srtp_stream_ctx = srtp_ctx->outgoing_srtp; - zrtp_rp_node_t *rp_node; - - uint32_t *enc_start; /* pointer to start of encrypted portion */ - uint32_t *auth_start; /* pointer to start of auth. portion */ - unsigned enc_octet_len = 0; /* number of octets in encrypted portion */ - uint8_t *auth_tag = NULL; /* location of auth_tag within packet */ - zrtp_status_t status; - ZRTP_UNALIGNED(zrtp_rtcp_hdr_t) *hdr; - ZRTP_UNALIGNED(uint32_t) *trailer; /* pointer to start of trailer */ - - uint32_t seq_num; - - zrtp_v128_t iv; - zrtp_string64_t auth_tag_str = ZSTR_INIT_EMPTY(auth_tag_str); - - /*add new replay protection node or get existing one*/ - rp_node = add_rp_node(srtp_ctx, srtp_global->rp_ctx, RP_OUTGOING_DIRECTION, packet->ssrc); - if(NULL == rp_node){ - return zrtp_status_rp_fail; - } - - /* check the packet length - it must at least contain a full header */ - if (*(packet->length) < octets_in_rtcp_header){ - return zrtp_status_bad_param; - } - - hdr = (zrtp_rtcp_hdr_t*)(packet->packet); - enc_start = (uint32_t *)hdr + uint32s_in_rtcp_header; - enc_octet_len = *(packet->length) - octets_in_rtcp_header; - - /* all of the packet, except the header, gets encrypted */ - /* NOTE: hdr->length is not usable - it refers to only the first - RTCP report in the compound packet! */ - /* NOTE: trailer is 32-bit aligned because RTCP 'packets' are always - multiples of 32-bits (RFC 3550 6.1) */ - trailer = (uint32_t *) ((char *)enc_start + enc_octet_len); - - /* - * RFC gives us ability of using non-crypted RTCP packets - * but we encrypt them anyway. It may be option of stream - * context in the future. - * if no encryption is used trailer should contain 0x00000000 - */ - *trailer = zrtp_hton32(ZRTP_RTCP_E_BIT); /* set encrypt bit */ - - /* - * set the auth_start and auth_tag pointers to the proper locations - * (note that srtpc *always* provides authentication, unlike srtp) - */ - /* Note: This would need to change for optional mikey data */ - auth_start = (uint32_t *)hdr; - auth_tag = (uint8_t *)hdr + *(packet->length) + sizeof(zrtp_rtcp_trailer_t); - - status = zrtp_srtp_rp_increment(&rp_node->rtcp_rp); - if(zrtp_status_ok != status){ - return zrtp_status_rp_fail; - } - seq_num = zrtp_srtp_rp_get_value(&rp_node->rtcp_rp); - *trailer |= zrtp_hton32(seq_num); - packet->seq = seq_num; - - iv.v32[0] = 0; - iv.v32[1] = hdr->ssrc; - iv.v32[2] = zrtp_hton32(seq_num >> 16); - iv.v32[3] = zrtp_hton32(seq_num << 16); - - status = zrtp_cipher_set_iv(&srtp_stream_ctx->rtcp_cipher, &iv); - if(status){ - return zrtp_status_cipher_fail; - } - - status = zrtp_cipher_encrypt(&srtp_stream_ctx->rtcp_cipher, (unsigned char*)enc_start, enc_octet_len); - if(status){ - return zrtp_status_cipher_fail; - } - - status = srtp_stream_ctx->rtcp_auth.hash->hmac_truncated_c(srtp_stream_ctx->rtcp_auth.hash, - (const char*)srtp_stream_ctx->rtcp_auth.key, - srtp_stream_ctx->rtcp_auth.key_len, - (const char*)auth_start, - *packet->length + sizeof(zrtp_rtcp_trailer_t), - srtp_stream_ctx->rtcp_auth.tag_len->tag_length, - (zrtp_stringn_t*) &auth_tag_str); - if(status){ - return zrtp_status_auth_fail; - } - - zrtp_memcpy(auth_tag, auth_tag_str.buffer, auth_tag_str.length); - - /* increase the packet length by the length of the auth tag and seq_num*/ - *packet->length += (auth_tag_str.length + sizeof(zrtp_rtcp_trailer_t)); - - - -#if ZRTP_DEBUG_SRTP_KEYS - { - char buffer[1000]; - ZRTP_LOG(3,(_ZTU_, "\tpacket: %s\n", - hex2str(packet->packet, (*packet->length) - (auth_tag_str.length + sizeof(zrtp_rtcp_trailer_t)), buffer, 1000))); - ZRTP_LOG(3,(_ZTU_, "\ttrailer and auth tag: %s\n", - hex2str((uint8_t*)packet->packet + ((*packet->length) - (auth_tag_str.length + sizeof(zrtp_rtcp_trailer_t))), - auth_tag_str.length + sizeof(zrtp_rtcp_trailer_t), - buffer, 1000))); - } -#endif - - return status; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_unprotect_rtcp( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet) -{ - zrtp_srtp_stream_ctx_t *srtp_stream_ctx = srtp_ctx->incoming_srtp; - zrtp_rp_node_t *rp_node; - - uint32_t *enc_start; /* pointer to start of encrypted portion */ - uint32_t *auth_start; /* pointer to start of auth. portion */ - unsigned enc_octet_len = 0; /* number of octets in encrypted portion */ - uint8_t *auth_tag = NULL; /* location of auth_tag within packet */ - zrtp_status_t status; - ZRTP_UNALIGNED(zrtp_rtcp_hdr_t) *hdr; - ZRTP_UNALIGNED(uint32_t) *trailer; /* pointer to start of trailer */ - - - int tag_len = 0; - zrtp_v128_t iv; - - /* add new replay protection node or get existing one */ - rp_node = add_rp_node(srtp_ctx, srtp_global->rp_ctx, RP_INCOMING_DIRECTION, packet->ssrc); - if(NULL == rp_node){ - return zrtp_status_rp_fail; - } - - /* check the packet length - it must at least contain a full header */ - if (*(packet->length) < octets_in_rtcp_header){ - return zrtp_status_bad_param; - } - - tag_len = srtp_stream_ctx->rtcp_auth.tag_len->tag_length; - hdr = (zrtp_rtcp_hdr_t*)(packet->packet); - - enc_octet_len = *packet->length - - (octets_in_rtcp_header + tag_len + sizeof(zrtp_rtcp_trailer_t)); - - /* index & E (encryption) bit follow normal data. hdr->len - is the number of words (32-bit) in the normal packet minus 1 */ - /* This should point trailer to the word past the end of the - normal data. */ - /* This would need to be modified for optional mikey data */ - /* - * NOTE: trailer is 32-bit aligned because RTCP 'packets' are always - * multiples of 32-bits (RFC 3550 6.1) - */ - - trailer = (uint32_t *) ((char *) hdr + *packet->length - (tag_len + sizeof(zrtp_rtcp_trailer_t))); - - if (*((unsigned char *) trailer) & ZRTP_RTCP_E_BYTE_BIT) { - enc_start = (uint32_t *)hdr + uint32s_in_rtcp_header; - } else { - enc_octet_len = 0; - enc_start = NULL; /* this indicates that there's no encryption */ - } - - /* - * set the auth_start and auth_tag pointers to the proper locations - * (note that srtcp *always* uses authentication, unlike srtp) - */ - auth_start = (uint32_t *)hdr; - auth_tag = (uint8_t *)hdr + *packet->length - tag_len; - - packet->seq = zrtp_ntoh32(*trailer) & 0x7fffffff; - - status = zrtp_srtp_rp_check(&rp_node->rtcp_rp, packet); - if(zrtp_status_ok != status){ - return zrtp_status_rp_fail; - } - - iv.v32[0] = 0; - iv.v32[1] = hdr->ssrc; /* still in network order! */ - iv.v32[2] = zrtp_hton32(packet->seq >> 16); - iv.v32[3] = zrtp_hton32(packet->seq << 16); - - status = zrtp_cipher_set_iv(&srtp_stream_ctx->rtcp_cipher, &iv); - if(status){ - return zrtp_status_cipher_fail; - } - - if(tag_len>0){ - zrtp_string64_t auth_tag_str = ZSTR_INIT_EMPTY(auth_tag_str); - - status = srtp_stream_ctx->rtcp_auth.hash->hmac_truncated_c(srtp_stream_ctx->rtcp_auth.hash, - (const char*)srtp_stream_ctx->rtcp_auth.key, - srtp_stream_ctx->rtcp_auth.key_len, - (const char*)auth_start, - *packet->length - tag_len, - tag_len, - (zrtp_stringn_t*) &auth_tag_str); - if(status || tag_len != auth_tag_str.length){ - return zrtp_status_auth_fail; - } - - if(0 != zrtp_memcmp((uint8_t *)auth_tag_str.buffer, (uint8_t *)auth_tag, tag_len)){ - return zrtp_status_auth_fail; - } - }else{ - return zrtp_status_auth_fail; - } - - if(enc_start){ - status = zrtp_cipher_decrypt(&srtp_stream_ctx->rtcp_cipher, (unsigned char*)enc_start, enc_octet_len); - if(status){ - return zrtp_status_cipher_fail; - } - } - - zrtp_srtp_rp_add(&rp_node->rtcp_rp, packet); - *packet->length -= (tag_len + sizeof(zrtp_rtcp_trailer_t)); - - return status; -} - -#endif /* !ZRTP_USE_EXTERN_SRTP */ diff --git a/libs/libzrtp/src/zrtp_srtp_dm.c b/libs/libzrtp/src/zrtp_srtp_dm.c deleted file mode 100644 index 34b0b51f65..0000000000 --- a/libs/libzrtp/src/zrtp_srtp_dm.c +++ /dev/null @@ -1,232 +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 <v.krikun at zfoneproject.com> - */ - -#if (defined(ZRTP_USE_EXTERN_SRTP) && (ZRTP_USE_EXTERN_SRTP == 1)) - -/* exactly in this order (for winsock) */ -#include <srtp.h> -#include "zrtp.h" - -struct zrtp_srtp_ctx -{ - srtp_t outgoing_srtp; - srtp_t incoming_srtp; -}; - -/*---------------------------------------------------------------------------*/ -void init_policy(crypto_policy_t *sp, zrtp_srtp_policy_t *zp) -{ - //TODO: make incoming policy crypto algorithm check for David A. McGrew's implementation support - - /* there are no another appropriate ciphers in the David A. McGrew's implementation yet */ - sp->cipher_type = AES_128_ICM; - sp->cipher_key_len = zp->cipher_key_len; - sp->auth_type = HMAC_SHA1; - sp->auth_key_len = zp->auth_key_len; - sp->auth_tag_len = zp->auth_tag_len->tag_length ? zp->auth_tag_len->tag_length : 10; - sp->sec_serv = sec_serv_conf_and_auth; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t create_srtp_stream( srtp_t *srtp_stream, - zrtp_srtp_profile_t *profile, - ssrc_type_t ssrc_type ) -{ - srtp_policy_t policy; - uint8_t *tmp_key; - - init_policy(&policy.rtp, &profile->rtp_policy); - init_policy(&policy.rtcp, &profile->rtcp_policy); - - policy.ssrc.type = ssrc_type; - policy.ssrc.value = 0; - - /* David A. McGrew's implementation uses key and salt as whole buffer, so let's make it */ - tmp_key = (uint8_t*)zrtp_sys_alloc(profile->key.length + profile->salt.length); - if(NULL == tmp_key){ - return zrtp_status_fail; - } - zrtp_memcpy(tmp_key, profile->key.buffer, profile->key.length); - zrtp_memcpy(tmp_key+profile->key.length, profile->salt.buffer, profile->salt.length); - - policy.key = tmp_key; - policy.next = NULL; - - /* add salt length to the key length of each policy */ - policy.rtp.cipher_key_len += 14; - policy.rtcp.cipher_key_len += 14; - - if(err_status_ok != srtp_create(srtp_stream, &policy)){ - zrtp_sys_free(tmp_key); - return zrtp_status_fail; - } - - zrtp_sys_free(tmp_key); - return zrtp_status_ok; -} - - -/*===========================================================================*/ -/* Public interface */ -/*===========================================================================*/ - - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_init(zrtp_global_ctx_t *zrtp_global) -{ - err_status_t s = srtp_init(); - return (err_status_ok == s) ? zrtp_status_ok : s; -} - -zrtp_status_t zrtp_srtp_down( zrtp_global_ctx_t *zrtp_global ) -{ - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -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) -{ - zrtp_status_t res = zrtp_status_ok; - zrtp_srtp_ctx_t *srtp_ctx = NULL; - - if(NULL == inc_profile || NULL == out_profile){ - return NULL; - } - - do{ - srtp_policy_t *policy_head, *policy_next; - - srtp_ctx = zrtp_sys_alloc(sizeof(zrtp_srtp_ctx_t)); - if(NULL == srtp_ctx){ - break; - } - - res = create_srtp_stream(&srtp_ctx->incoming_srtp, inc_profile, ssrc_any_inbound); - if(zrtp_status_ok != res){ - zrtp_sys_free(srtp_ctx); - srtp_ctx = NULL; - break; - } - - res = create_srtp_stream(&srtp_ctx->outgoing_srtp, out_profile, ssrc_any_outbound); - if(zrtp_status_ok != res){ - srtp_dealloc(srtp_ctx->incoming_srtp); - zrtp_sys_free(srtp_ctx); - srtp_ctx = NULL; - break; - } - - }while(0); - - return srtp_ctx; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_destroy( zrtp_srtp_global_t *zrtp_srtp_global, - zrtp_srtp_ctx_t *srtp_ctx ) -{ - srtp_dealloc(srtp_ctx->incoming_srtp); - srtp_dealloc(srtp_ctx->outgoing_srtp); - zrtp_sys_free(srtp_ctx); - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_protect( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet) -{ - err_status_t res; - res = srtp_protect(srtp_ctx->outgoing_srtp, packet->packet, packet->length); - if(err_status_ok != res){ - return zrtp_status_fail; - }else{ - return zrtp_status_ok; - } -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_unprotect( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet) -{ - err_status_t res; - res = srtp_unprotect(srtp_ctx->incoming_srtp, packet->packet, packet->length); - if(err_status_ok != res){ - return zrtp_status_fail; - }else{ - return zrtp_status_ok; - } -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_protect_rtcp( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet) -{ - err_status_t res; - res = srtp_protect_rtcp(srtp_ctx->outgoing_srtp, packet->packet, packet->length); - if(err_status_ok != res){ - return zrtp_status_fail; - }else{ - return zrtp_status_ok; - } -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_unprotect_rtcp( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet) -{ - err_status_t res; - res = srtp_unprotect_rtcp(srtp_ctx->incoming_srtp, packet->packet, packet->length); - if(err_status_ok != res){ - return zrtp_status_fail; - }else{ - return zrtp_status_ok; - } -} - -/*----------------------------------------------------------------------------*/ -uint64_t make64(uint32_t high, uint32_t low) -{ - uint64_t_ res; - uint32_t *p = (uint32_t*)&res; - -#if ZRTP_BYTE_ORDER == ZBO_LITTLE_ENDIAN - *p++ = low; - *p = high; -#else - *p++ = high; - *p = low; -#endif - return res; -} - -uint32_t high32(uint64_t x) -{ - uint32_t *p = &x; -#if ZRTP_BYTE_ORDER == ZBO_LITTLE_ENDIAN - p++; -#endif - return *p; -} - -uint32_t low32(uint64_t x) -{ - uint32_t *p = &x; -#if ZRTP_BYTE_ORDER == ZBO_BIG_ENDIAN - p++; -#endif - return *p; -} - -#endif /*ZRTP_USE_EXTERN_SRTP*/ diff --git a/libs/libzrtp/src/zrtp_string.c b/libs/libzrtp/src/zrtp_string.c deleted file mode 100644 index 162dbca2f9..0000000000 --- a/libs/libzrtp/src/zrtp_string.c +++ /dev/null @@ -1,174 +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 <v.krikun at zfoneproject.com> - */ - -#include "zrtp.h" - -#if ZRTP_HAVE_STRING_H == 1 -# include <string.h> -#endif - - -/*----------------------------------------------------------------------------*/ -int zrtp_zstrcmp(const zrtp_stringn_t *left, const zrtp_stringn_t *right) -{ - if (left->length == right->length) { - return zrtp_memcmp(left->buffer, right->buffer, left->length); - } else { - return left->length - right->length; - } -} - -void zrtp_zstrcpy(zrtp_stringn_t *dst, const zrtp_stringn_t *src) -{ - dst->length = ZRTP_MIN(dst->max_length, src->length); - zrtp_memcpy(dst->buffer, src->buffer, dst->length); - if (dst->length < dst->max_length) { - dst->buffer[dst->length] = 0; - } -} - -void zrtp_zstrcpyc(zrtp_stringn_t *dst, const char *src) -{ - dst->length = ZRTP_MIN(dst->max_length, strlen(src)); - zrtp_memcpy(dst->buffer, src, dst->length); - if (dst->length < dst->max_length) { - dst->buffer[dst->length] = 0; - } -} - -void zrtp_zstrncpy(zrtp_stringn_t *dst, const zrtp_stringn_t *src, uint16_t size) -{ - dst->length = ZRTP_MIN(dst->max_length, size); - zrtp_memcpy(dst->buffer, src->buffer, dst->length); - if (dst->length < dst->max_length) { - dst->buffer[dst->length] = 0; - } -} - -void zrtp_zstrncpyc(zrtp_stringn_t *dst, const char *src, uint16_t size) -{ - dst->length = ZRTP_MIN(dst->max_length, size); - zrtp_memcpy(dst->buffer, src, dst->length); - if (dst->length < dst->max_length) { - dst->buffer[dst->length] = 0; - } -} - -void zrtp_zstrcat(zrtp_stringn_t *dst, const zrtp_stringn_t *src) -{ - uint16_t count = ZRTP_MIN((dst->max_length - dst->length), src->length); - zrtp_memcpy(dst->buffer + dst->length, src->buffer, count); - dst->length += count; - if (dst->length < dst->max_length) { - dst->buffer[dst->length] = 0; - } -} - -void zrtp_wipe_zstring(zrtp_stringn_t *zstr) -{ - if (zstr && zstr->length) { - zrtp_memset(zstr->buffer, 0, zstr->max_length); - zstr->length = 0; - } -} - -int zrtp_memcmp(const void* s1, const void* s2, uint32_t n) -{ - uint32_t i = 0; - uint8_t* s1uc = (uint8_t*) s1; - uint8_t* s2uc = (uint8_t*) s2; - - for (i=0; i<n; i++) { - if (s1uc[i] < s2uc[i]) { - return -1; - } else if (s1uc[i] > s2uc[i]) { - return 1; - } - } - - return 0; -} - -/*----------------------------------------------------------------------------*/ -static char* hex2char(char *dst, unsigned char b) -{ - unsigned char v = b >> 4; - *dst++ = (v<=9) ? '0'+v : 'a'+ (v-10); - v = b & 0x0f; - *dst++ = (v<=9) ? '0'+v : 'a'+ (v-10); - - return dst; -} - -const char* hex2str(const char* bin, int bin_size, char* buff, int buff_size) -{ - char* nptr = buff; - - if (NULL == buff) { - return "buffer is NULL"; - } - if (buff_size < bin_size*2) { - return "buffer too small"; - } - - while (bin_size--) { - nptr = hex2char(nptr, *bin++); - } - - if (buff_size >= bin_size*2+1) - *nptr = 0; - - return buff; -} - -/*----------------------------------------------------------------------------*/ -static int char2hex(char v) -{ - if (v >= 'a' && v <= 'f') { - return v - 'a' + 10; - } - if (v >= 'A' && v <= 'F') { - return v - 'A' + 10; - } - if (v >= '0' && v <= '9') { - return v - '0'; - } - return 0x10; -} - -char *str2hex(const char* buff, int buff_size, char* bin, int bin_size) -{ - char tmp = 0; - - if (NULL == buff || !buff_size) { - return "buffer is NULL || !buf_size"; - } - if (buff_size % 2) { - return "buff_size has to be even"; - } - if (buff_size > bin_size*2) { - return "buffer too small"; - } - - while (buff_size--) - { - int value = char2hex(*buff++); - if (value > 0x0F) { - return "wrong symbol in buffer"; - } - if (buff_size % 2) { - tmp = (char)value; - } else { - value |= (char)(tmp << 4); - *bin++ = value; - } - } - - return bin; -} diff --git a/libs/libzrtp/src/zrtp_utils.c b/libs/libzrtp/src/zrtp_utils.c deleted file mode 100644 index 45b5290d85..0000000000 --- a/libs/libzrtp/src/zrtp_utils.c +++ /dev/null @@ -1,630 +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 <v.krikun at zfoneproject.com> - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp utils" - -/*----------------------------------------------------------------------------*/ -static uint32_t _estimate_index(uint32_t seq, uint32_t s_l) -{ - uint32_t v; - uint32_t roc = (s_l >> 16) & 0xffff; - - /* from RFC 3711, Appendix A */ - if (0 == s_l) { - return seq; - } - - s_l &= 0xfffful; - if (s_l < 32768ul) { - v = (seq < s_l) ? roc : ((seq - s_l > 32768ul) ? (roc ? (roc - 1) : 0) : roc); - } else { - v = (s_l - 32768ul > seq) ? (roc + 1) : roc; - } - - return seq | (v << 16); -} - -/** - * @brief Converts RTP sequence number to implicit representation. - * @sa section 3.3.1 of RFC 3711 - * @param self - ZRTP stream context associated with the packet; - * @param packet - RTP packet for converting; - * @param is_media - 1 - assumes RTP media packet and 0 - ZRTP protocol message; - * @param is_input - 1 assumes incoming and 0 - outgoing packet direction. - * @return resulting sequence number. - */ -static uint32_t _convert_seq_to_implicit_seq( zrtp_stream_t *ctx, - char *packet, - uint8_t is_media, - uint8_t is_input) -{ - uint32_t header_seq = 0; - uint32_t ctx_seq = 0; - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *rtp_hdr = (zrtp_rtp_hdr_t*)packet; - - if (is_input) { - ctx_seq = is_media ? ctx->media_ctx.high_in_media_seq : ctx->media_ctx.high_in_zrtp_seq; - } - else { - ctx_seq = is_media ? ctx->media_ctx.high_out_media_seq : ctx->media_ctx.high_out_zrtp_seq; - } - - header_seq = _estimate_index(zrtp_ntoh16(rtp_hdr->seq), ctx_seq); - - if (0 == ctx_seq || header_seq > ctx_seq) /* as per section 3.3.1 of RFC 3711 */ - { - if (is_input) { - if (is_media) { - ctx->media_ctx.high_in_media_seq = header_seq; - } else { - ctx->media_ctx.high_in_zrtp_seq = header_seq; - } - } else { - if (is_media) { - ctx->media_ctx.high_out_media_seq = header_seq; - } else { - ctx->media_ctx.high_out_zrtp_seq = header_seq; - } - } - } - - return header_seq; -} - -/*----------------------------------------------------------------------------*/ -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) -{ - char *key = NULL; - - switch (type) - { - case ZRTP_HELLO: - zrtp_memcpy(hdr->type, "Hello ", ZRTP_PACKET_TYPE_SIZE); - key = (char*)stream->messages.commit.hash; - break; - case ZRTP_HELLOACK: - zrtp_memcpy(hdr->type, "HelloACK", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_COMMIT: - zrtp_memcpy(hdr->type, "Commit ", ZRTP_PACKET_TYPE_SIZE); - key = (char*)stream->messages.dhpart.hash; - break; - case ZRTP_DHPART1: - zrtp_memcpy(hdr->type, "DHPart1 ", ZRTP_PACKET_TYPE_SIZE); - key = stream->messages.h0.buffer; - break; - case ZRTP_DHPART2: - zrtp_memcpy(hdr->type, "DHPart2 ", ZRTP_PACKET_TYPE_SIZE); - key = stream->messages.h0.buffer; - break; - case ZRTP_CONFIRM2ACK: - zrtp_memcpy(hdr->type, "Conf2ACK", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_GOCLEAR: - zrtp_memcpy(hdr->type, "GoClear ", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_GOCLEARACK: - zrtp_memcpy(hdr->type, "ClearACK", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_ERROR: - zrtp_memcpy(hdr->type, "Error ", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_ERRORACK: - zrtp_memcpy(hdr->type, "ErrorACK", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_CONFIRM1: - zrtp_memcpy(hdr->type, "Confirm1", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_CONFIRM2: - zrtp_memcpy(hdr->type, "Confirm2", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_SASRELAY: - zrtp_memcpy(hdr->type, "SASrelay", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_RELAYACK: - zrtp_memcpy(hdr->type, "RelayACK", ZRTP_PACKET_TYPE_SIZE); - break; - case ZRTP_ZFONEPINGACK: - zrtp_memcpy(hdr->type, "PingACK ", ZRTP_PACKET_TYPE_SIZE); - break; - - default: - return zrtp_status_bad_param; - } - - - hdr->magic = zrtp_hton16(ZRTP_MESSAGE_MAGIC); - /* message type + length intelf */ - hdr->length = zrtp_hton16((ZRTP_PACKET_TYPE_SIZE + 4 + body_length) / 4); - - if (key) - { - char *hmac = (char*)hdr + ZRTP_PACKET_TYPE_SIZE + 4 + body_length - ZRTP_HMAC_SIZE; - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA256, stream->zrtp); - zrtp_string32_t hmac_buff = ZSTR_INIT_EMPTY(hmac_buff); - - hash->hmac_truncated_c( hash, - (const char*)key, - ZRTP_MESSAGE_HASH_SIZE, - (char*)hdr, - ZRTP_PACKET_TYPE_SIZE + 4 + body_length - ZRTP_HMAC_SIZE, - ZRTP_HMAC_SIZE, - ZSTR_GV(hmac_buff) ); - zrtp_memcpy(hmac, hmac_buff.buffer, ZRTP_HMAC_SIZE); - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -zrtp_msg_type_t _zrtp_packet_get_type(ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *hdr, uint32_t length) -{ - char *type = NULL; - - if (ZRTP_PACKETS_MAGIC != zrtp_ntoh32(hdr->ts)) { - /* This is non ZRTP packet */ - return ZRTP_NONE; - } else if (length < (ZRTP_MIN_PACKET_LENGTH)) { - /* Malformed packet: ZRTP MAGIC is present, but size is too small */ - return ZRTP_UNPARSED; - } - - /* Shifting to ZRTP packet type field: <RTP header> + <extension header> */ - type = (char*)(hdr) + sizeof(zrtp_rtp_hdr_t) + 4; - - switch (*type++) - { - case 'C': - case 'c': - if (0 == zrtp_memcmp(type, "ommit ", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_COMMIT; - if (0 == zrtp_memcmp(type, "onf2ACK", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_CONFIRM2ACK; - if (0 == zrtp_memcmp(type, "onfirm1", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_CONFIRM1; - if (0 == zrtp_memcmp(type, "onfirm2", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_CONFIRM2; - if (0 == zrtp_memcmp(type, "learACK", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_GOCLEARACK; - break; - - case 'D': - case 'd': - if (0 == zrtp_memcmp(type, "HPart1 ", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_DHPART1; - if (0 == zrtp_memcmp(type, "HPart2 ", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_DHPART2; - break; - - case 'E': - case 'e': - if (0 == zrtp_memcmp(type, "rror ", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_ERROR; - if (0 == zrtp_memcmp(type, "rrorACK", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_ERRORACK; - break; - - case 'G': - case 'g': - if (0 == zrtp_memcmp(type, "oClear ", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_GOCLEAR; - break; - - case 'H': - case 'h': - if (0 == zrtp_memcmp(type, "ello ", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_HELLO; - if (0 == zrtp_memcmp(type, "elloACK", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_HELLOACK; - break; - - case 'P': - case 'p': - if (0 == zrtp_memcmp(type, "ing ", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_ZFONEPING; - if (0 == zrtp_memcmp(type, "ingACK ", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_ZFONEPINGACK; - break; - - case 'R': - case 'r': - if (0 == zrtp_memcmp(type, "elayACK", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_RELAYACK; - break; - - case 'S': - case 's': - if (0 == zrtp_memcmp(type, "ASrelay", ZRTP_PACKET_TYPE_SIZE-1)) - return ZRTP_SASRELAY; - break; - } - - return ZRTP_NONE; -} - -/*----------------------------------------------------------------------------*/ -int _zrtp_packet_send_message(zrtp_stream_t* stream, zrtp_msg_type_t type, const void* message) -{ - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *rtp_hdr = NULL; - - zrtp_msg_hdr_t* zrtp_hdr = NULL; - uint32_t packet_length = sizeof(zrtp_rtp_hdr_t); - zrtp_status_t s = zrtp_status_ok; - -#if (defined(ZRTP_USE_STACK_MINIM) && (ZRTP_USE_STACK_MINIM == 1)) - char* buffer = zrtp_sys_alloc(1500); - if (!buffer) { - return zrtp_status_alloc_fail; - } -#else - char buffer[1500]; -#endif - - rtp_hdr = (zrtp_rtp_hdr_t*)buffer; - - /* Fill main RTP packet fields */ - zrtp_memset(rtp_hdr, 0, sizeof(zrtp_rtp_hdr_t)); - rtp_hdr->x = 1; - rtp_hdr->ssrc = stream->media_ctx.ssrc; - - /* Increment ZRTP RTP sequences space */ - rtp_hdr->seq = zrtp_hton16((++stream->media_ctx.high_out_zrtp_seq) & 0xffff); - if (stream->media_ctx.high_out_zrtp_seq >= 0xffff) { - stream->media_ctx.high_out_zrtp_seq = 0; - } - - /* Set ZRTP MAGIC instead of timestamp and as a extension type */ - rtp_hdr->ts = zrtp_hton32(ZRTP_PACKETS_MAGIC); - - if (message) { - zrtp_memcpy( buffer + RTP_HDR_SIZE, - (char*)message, - zrtp_ntoh16(((zrtp_msg_hdr_t*) message)->length)*4 ); - } else { - /* May be it's a primitive packet and we should fill ZRTP header there */ - zrtp_hdr = (zrtp_msg_hdr_t*) (buffer + RTP_HDR_SIZE); - if (zrtp_status_ok != _zrtp_packet_fill_msg_hdr(stream, type, 0, zrtp_hdr)) { -#if (defined(ZRTP_USE_STACK_MINIM) && (ZRTP_USE_STACK_MINIM == 1)) - zrtp_sys_free(buffer); -#endif - return zrtp_status_bad_param; - } - } - - zrtp_hdr = (zrtp_msg_hdr_t*) (buffer + RTP_HDR_SIZE); - packet_length += (zrtp_ntoh16(zrtp_hdr->length)*4 + 4); /* add ZRTP message header and CRC */ - - /* - * Why do we add our own extra CRC in the ZRTP key agreement packets? - * If we warn the user of a man-in-the-middle attack, we must be - * highly confident it's a real attack, not triggered by accidental - * line noise, or we risk unnecessary user panic and an inappropriate - * security response. Extra error detection is needed to reliably - * distinguish between a real attack and line noise, because unlike - * TCP, UDP does not have enough built-in error detection. It only - * has a 16 bit checksum, and in some UDP stacks it's not always - * present. - */ - _zrtp_packet_insert_crc(buffer, packet_length); - - ZRTP_LOG(3,(_ZTU_, "\tSend <%.8s> ssrc=%u seq=%u size=%d. Stream %u:%s:%s\n", - zrtp_log_pkt2str(type), - zrtp_ntoh32(rtp_hdr->ssrc), - zrtp_ntoh16(rtp_hdr->seq), - packet_length, - stream->id, - zrtp_log_mode2str(stream->mode), - zrtp_log_state2str(stream->state))); - - s = stream->zrtp->cb.misc_cb.on_send_packet(stream, buffer, packet_length); - -#if (defined(ZRTP_USE_STACK_MINIM) && (ZRTP_USE_STACK_MINIM == 1)) - zrtp_sys_free(buffer); -#endif - - return s; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_packet_preparse( zrtp_stream_t* stream, - char* packet, - uint32_t *length, - zrtp_rtp_info_t* info, - uint8_t is_input ) -{ - zrtp_status_t s = zrtp_status_fail; - uint8_t is_correct = 1; - - do - { - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *rtpHdr = NULL; - - if (*length < sizeof(zrtp_rtp_hdr_t)) { - ZRTP_LOG(1,(_ZTU_,"WARNING! Incoming packet is too small %d.ID=%u\n", *length, stream->id)); - s = zrtp_status_bad_param; - break; - } - - rtpHdr = (zrtp_rtp_hdr_t*) packet; - info->type = _zrtp_packet_get_type(rtpHdr, *length); - if (ZRTP_UNPARSED == info->type) { - ZRTP_LOG(1,(_ZTU_,"WARNING! Can't determinate packet type. ID=%u\n", stream->id)); - s = zrtp_status_bad_param; - break; - } - - info->packet = packet; - info->message = packet + RTP_HDR_SIZE; - info->length = length; - info->ssrc = rtpHdr->ssrc; - info->seq = _convert_seq_to_implicit_seq(stream, packet, info->type == ZRTP_NONE, is_input); - - /* - * Check ZRTP message correctness: - * - CRC - * - length according to type - * - hash (DOS attack) - */ - if (is_input && (info->type != ZRTP_NONE) && (info->type != ZRTP_UNPARSED)) - { - zrtp_string32_t hash_str = ZSTR_INIT_EMPTY(hash_str); - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA256, stream->zrtp); - char *hash2compare = NULL, *rechash = NULL; - zrtp_string32_t tmp_hash_str = ZSTR_INIT_EMPTY(tmp_hash_str); - - ZRTP_LOG(3,(_ZTU_, "Received <%.8s> packet with ssrc=%u seq=%u/%u size=%d. Stream%u:%s:%s.\n", - packet + sizeof(zrtp_rtp_hdr_t) + 4, - zrtp_ntoh32(info->ssrc), - zrtp_ntoh16(rtpHdr->seq), - info->seq, - *info->length, - stream->id, - zrtp_log_mode2str(stream->mode), - zrtp_log_state2str(stream->state))); - - /* - * Why do we add our own extra CRC in the ZRTP key agreement packets? - * If we warn the user of a man-in-the-middle attack, we must be - * highly confident it's a real attack, not triggered by accidental - * line noise, or we risk unnecessary user panic and an inappropriate - * security response. Extra error detection is needed to reliably - * distinguish between a real attack and line noise, because unlike - * TCP, UDP does not have enough built-in error detection. It only - * has a 16 bit checksum, and in some UDP stacks it's not always - * present. - */ - if (_zrtp_packet_validate_crc(info->packet, *info->length) != 0) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Incoming ZRTP CRC validation fails. ID=%u\n", stream->id)); - s = zrtp_status_crc_fail; - break; - } - - /* Check length field correctness */ - if (zrtp_ntoh16(((zrtp_msg_hdr_t*)info->message)->length)*4 != (*length - 4 - RTP_HDR_SIZE)) - { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Wrong length field for Incoming message %d packet=%d. ID=%u\n", - zrtp_ntoh16(((zrtp_msg_hdr_t*)info->message)->length)*4, - *length, stream->id)); - s = zrtp_status_bad_param; - break; - } - - /* Check packet size according to its type */ - switch (info->type) - { - case ZRTP_COMMIT: - { - switch (stream->mode) - { - case ZRTP_STREAM_MODE_DH: - is_correct = !(*length < (RTP_HDR_SIZE + ZRTP_COMMIT_STATIC_SIZE + ZRTP_HV_SIZE + ZRTP_HMAC_SIZE)); - break; - case ZRTP_STREAM_MODE_MULT: - is_correct = !(*length < (RTP_HDR_SIZE + ZRTP_COMMIT_STATIC_SIZE + ZRTP_HV_NONCE_SIZE + ZRTP_HMAC_SIZE)); - break; - case ZRTP_STREAM_MODE_PRESHARED: - is_correct = !(*length < (RTP_HDR_SIZE + ZRTP_COMMIT_STATIC_SIZE + ZRTP_HV_NONCE_SIZE + ZRTP_HV_KEY_SIZE + ZRTP_HMAC_SIZE)); - break; - default: - break; - }; - break; - } - case ZRTP_DHPART1: - case ZRTP_DHPART2: - if (stream->pubkeyscheme) { - is_correct = (*length == (ZRTP_MIN_PACKET_LENGTH + ZRTP_DH_STATIC_SIZE + stream->pubkeyscheme->pv_length + ZRTP_HMAC_SIZE)); - } - break; - case ZRTP_CONFIRM1: - case ZRTP_CONFIRM2: - is_correct = !(*length < (RTP_HDR_SIZE + sizeof(zrtp_packet_Confirm_t))); - break; - case ZRTP_SASRELAY: - is_correct = !(*length < (RTP_HDR_SIZE + sizeof(zrtp_packet_SASRelay_t))); - break; - case ZRTP_GOCLEAR: - is_correct = !(*length < (RTP_HDR_SIZE + sizeof(zrtp_packet_GoClear_t))); - break; - case ZRTP_ERROR: - is_correct = !(*length < (RTP_HDR_SIZE + sizeof(zrtp_packet_Error_t))); - break; - case ZRTP_ZFONEPING: - case ZRTP_ZFONEPINGACK: - is_correct = !(*length < (RTP_HDR_SIZE + sizeof(zrtp_packet_zfoneping_t))); - break; - default: - break; - } - /* If CRC have been verified but packet size is wrong - it looks like a stupid attack */ - if (!is_correct) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Incoming ZRTP message %d:%d is corrupted. ID=%u\n", - info->type, *length, stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_invalid_packet, 1); - s = zrtp_status_attack; - break; - } - - /* - * Check hash to prevent DOS attacks - */ - switch (info->type) - { - case ZRTP_HELLO: - if (stream->messages.signaling_hash.length) - { - hash->hash_c( hash, - (const char*) info->message, - zrtp_ntoh16(((zrtp_packet_Hello_t*) info->message)->hdr.length)*4, - ZSTR_GV(hash_str) ); - if (zrtp_memcmp(stream->messages.signaling_hash.buffer, hash_str.buffer, ZRTP_MESSAGE_HASH_SIZE)) { - if (stream->zrtp->cb.event_cb.on_zrtp_security_event) { - stream->zrtp->cb.event_cb.on_zrtp_security_event(stream, ZRTP_EVENT_WRONG_SIGNALING_HASH); - } - } - } break; - case ZRTP_COMMIT: - rechash = (char*)((zrtp_packet_Commit_t*) info->message)->hash; - hash2compare = (char*)stream->messages.peer_hello.hash; - break; - case ZRTP_DHPART1: - hash->hash_c( hash, - (const char*)((zrtp_packet_DHPart_t*) info->message)->hash, - ZRTP_MESSAGE_HASH_SIZE, - ZSTR_GV(tmp_hash_str) ); - rechash = (char*)tmp_hash_str.buffer; - hash2compare = (char*)stream->messages.peer_hello.hash; - break; - case ZRTP_DHPART2: - rechash = (char*)((zrtp_packet_DHPart_t*) info->message)->hash; - hash2compare = (char*)stream->messages.peer_commit.hash; - break; - default: - break; - } - - if (rechash) - { - hash->hash_c(hash, rechash, ZRTP_MESSAGE_HASH_SIZE, ZSTR_GV(hash_str)); - is_correct = !zrtp_memcmp(hash2compare, hash_str.buffer, ZRTP_MESSAGE_HASH_SIZE); - if (!is_correct) - { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! ZRTP Message hashes don't mach %s! ID=%u\n", - zrtp_log_pkt2str(info->type), stream->id)); - s = zrtp_status_attack; - break; - } /* hashes check */ - } - - - /* - * Check messages HMAC - */ - { - zrtp_msg_hdr_t *hdr = NULL; - switch (info->type) - { - case ZRTP_COMMIT: - case ZRTP_DHPART1: - hdr = &stream->messages.peer_hello.hdr; - break; - case ZRTP_DHPART2: - hdr = &stream->messages.peer_commit.hdr; - break; - default: - break; - } - if (hdr) - if (0 != _zrtp_validate_message_hmac(stream, hdr, rechash)) { - return zrtp_status_fail; - } - } - -// TODO: check this replay protection logic! -// if (info->seq != stream->media_ctx.high_in_zrtp_seq) { -// s = zrtp_status_zrp_fail; -// break; -// } - } /* for incoming ZRTP messages only only */ - - s = zrtp_status_ok; - } while(0); - - return s; -} - -/*----------------------------------------------------------------------------*/ -void _zrtp_cancel_send_packet_later( zrtp_stream_t* stream, - zrtp_msg_type_t type) -{ - zrtp_retry_task_t* task = NULL; - - switch (type) - { - case ZRTP_HELLO: - task = &stream->messages.hello_task; - break; - case ZRTP_COMMIT: - task = &stream->messages.commit_task; - break; - case ZRTP_DHPART2: - task = &stream->messages.dhpart_task; - break; - case ZRTP_CONFIRM2: - task = &stream->messages.confirm_task; - break; - case ZRTP_GOCLEAR: - task = &stream->messages.goclear_task; - break; - case ZRTP_ERROR: - task = &stream->messages.error_task; - break; - case ZRTP_PROCESS: - task = &stream->messages.dh_task; - break; - case ZRTP_SASRELAY: - task = &stream->messages.sasrelay_task; - break; - - case ZRTP_NONE: - stream->messages.hello_task._is_enabled = 0; - stream->messages.goclear_task._is_enabled = 0; - stream->messages.commit_task._is_enabled = 0; - stream->messages.confirm_task._is_enabled = 0; - stream->messages.dhpart_task._is_enabled = 0; - stream->messages.error_task._is_enabled = 0; - stream->messages.dh_task._is_enabled = 0; - stream->messages.sasrelay_task._is_enabled = 0; - break; - - default: - return; - } - - if(task) { - task->_is_enabled = 0; - } - - if (stream->zrtp->cb.sched_cb.on_cancel_call_later) { - stream->zrtp->cb.sched_cb.on_cancel_call_later(stream, task); - } -} - -void _zrtp_change_state( zrtp_stream_t* stream, zrtp_state_t state) -{ - stream->prev_state = stream->state; - stream->state = state; - ZRTP_LOG(3,("zrtp","\tStream ID=%u %s switching <%s> ---> <%s>.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->prev_state), zrtp_log_state2str(stream->state))); -} diff --git a/libs/libzrtp/src/zrtp_utils_proto.c b/libs/libzrtp/src/zrtp_utils_proto.c deleted file mode 100644 index c7e4459148..0000000000 --- a/libs/libzrtp/src/zrtp_utils_proto.c +++ /dev/null @@ -1,633 +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 <v.krikun at zfoneproject.com> - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp utils" - - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_prepare_secrets(zrtp_session_t* session) -{ - zrtp_secrets_t* sec = &session->secrets; - zrtp_status_t s = zrtp_status_ok; - - /* Protect Secrets from race conditions on multistream calls. */ - zrtp_mutex_lock(session->streams_protector); - - if (!sec->is_ready) { - do { - uint32_t verifiedflag = 0; - - session->secrets.rs1->_cachedflag = 0; - session->secrets.rs2->_cachedflag = 0; - if (session->zrtp->cb.cache_cb.on_get) { - s = session->zrtp->cb.cache_cb.on_get( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - session->secrets.rs1, - 0); - session->secrets.rs1->_cachedflag = (zrtp_status_ok == s); - - s = session->zrtp->cb.cache_cb.on_get( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - session->secrets.rs2, - 1); - session->secrets.rs2->_cachedflag = (zrtp_status_ok == s); - } - - if (session->zrtp->cb.cache_cb.on_get_verified) { - s = session->zrtp->cb.cache_cb.on_get_verified( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - &verifiedflag); - } - - if (session->zrtp->cb.cache_cb.on_get_mitm) { - s = session->zrtp->cb.cache_cb.on_get_mitm( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - session->secrets.pbxs); - session->secrets.pbxs->_cachedflag = (zrtp_status_ok == s); - } else { - session->secrets.pbxs->_cachedflag = 0; - } - - /* Duplicate all secrets flags to zrtp-context */ - session->secrets.cached |= session->secrets.rs1->_cachedflag ? ZRTP_BIT_RS1 : 0; - session->secrets.cached |= session->secrets.rs2->_cachedflag ? ZRTP_BIT_RS2 : 0; - session->secrets.cached |= session->secrets.pbxs->_cachedflag ? ZRTP_BIT_PBX : 0; - - { - char buff[128]; - char buff2[128]; - ZRTP_LOG(3,(_ZTU_,"\tRestoring Secrets: lZID=%s rZID=%s. V=%d sID=%u\n", - hex2str(session->zid.buffer, session->zid.length, buff, sizeof(buff)), - hex2str(session->peer_zid.buffer, session->peer_zid.length, buff2, sizeof(buff2)), - verifiedflag, - session->id)); - ZRTP_LOG(3,(_ZTU_,"\t\tRS1 <%s>\n", - session->secrets.rs1->_cachedflag ? - hex2str( session->secrets.rs1->value.buffer, - session->secrets.rs1->value.length, - buff, sizeof(buff) ) : "EMPTY")); - ZRTP_LOG(3,(_ZTU_,"\t\tRS2 <%s>\n", - session->secrets.rs2->_cachedflag ? - hex2str( session->secrets.rs2->value.buffer, - session->secrets.rs2->value.length, - buff, sizeof(buff) ) : "EMPTY")); - ZRTP_LOG(3,(_ZTU_,"\t\tPBX <%s>\n", - session->secrets.pbxs->_cachedflag ? - hex2str( session->secrets.pbxs->value.buffer, - session->secrets.pbxs->value.length, - buff, sizeof(buff) ) : "EMPTY")); - } - - sec->is_ready = 1; - s = zrtp_status_ok; - } while (0); - } - - zrtp_mutex_unlock(session->streams_protector); - - return s; -} - -/*----------------------------------------------------------------------------*/ -zrtp_shared_secret_t *_zrtp_alloc_shared_secret(zrtp_session_t* session) -{ - zrtp_shared_secret_t *ss = zrtp_sys_alloc(sizeof(zrtp_shared_secret_t)); - if (ss) { - zrtp_memset(ss, 0, sizeof(zrtp_shared_secret_t)); - ZSTR_SET_EMPTY(ss->value); - ss->value.length = ZRTP_MIN(ss->value.max_length, ZRTP_RS_SIZE); - - ss->lastused_at = (uint32_t)(zrtp_time_now()/1000); - ss->ttl = 0xFFFFFFFF; - ss->_cachedflag = 0; - ss->value.length = ZRTP_MIN(ss->value.max_length, ZRTP_RS_SIZE); - - if (ss->value.length != zrtp_randstr( session->zrtp, - (unsigned char*)ss->value.buffer, - ss->value.length)) - { - zrtp_sys_free(ss); - ss = NULL; - } - } - - return ss; -} - -/*----------------------------------------------------------------------------*/ -int _zrtp_can_start_stream(zrtp_stream_t* stream, zrtp_stream_t **conc, zrtp_stream_mode_t mode) -{ - uint8_t deny = 0; - mlist_t* node = NULL; - - zrtp_mutex_lock(stream->zrtp->sessions_protector); - - mlist_for_each(node, &stream->zrtp->sessions_head) - { - zrtp_session_t* tmp_sctx = mlist_get_struct(zrtp_session_t, _mlist, node); - - if ( !zrtp_zstrcmp(ZSTR_GV(tmp_sctx->zid), ZSTR_GV(stream->session->zid)) && - !zrtp_zstrcmp(ZSTR_GV(tmp_sctx->peer_zid), ZSTR_GV(stream->session->peer_zid)) ) - { - int i = 0; - - zrtp_mutex_lock(tmp_sctx->streams_protector); - - for (i=0; i<ZRTP_MAX_STREAMS_PER_SESSION; i++) - { - zrtp_stream_t* tmp_stctx = &tmp_sctx->streams[i]; - - /* - * We don't need to lock the stream because it have been already locked - * by high level function: zrtp_process_srtp() or _initiating_secure() - */ - if ((stream != tmp_stctx) && (tmp_stctx->state != ZRTP_STATE_NONE)) { - deny = ( (tmp_stctx->state > ZRTP_STATE_START_INITIATINGSECURE) && - (tmp_stctx->state < ZRTP_STATE_SECURE) ); - - if ((mode == ZRTP_STREAM_MODE_MULT) && deny) { - deny = !(tmp_stctx->mode == ZRTP_STREAM_MODE_MULT); - } - - if (deny) { - *conc = tmp_stctx; - break; - } - } - } - - zrtp_mutex_unlock(tmp_sctx->streams_protector); - - if (deny) { - break; - } - } - } - - zrtp_mutex_unlock(stream->zrtp->sessions_protector); - - if (!deny){ - *conc = NULL; - } - - return !deny; -} - -/*----------------------------------------------------------------------------*/ -uint8_t _zrtp_choose_best_comp( zrtp_profile_t *profile, - zrtp_packet_Hello_t* peer_hello, - zrtp_crypto_comp_t type ) -{ - uint8_t* prof_elem = NULL; - int i=0, j=0; - int offset = 0; - int count = 0; - - switch (type) - { - case ZRTP_CC_PKT: - { - uint8_t pref_peer_pk = ZRTP_COMP_UNKN; - uint8_t pref_pk = ZRTP_COMP_UNKN; - char *cp = NULL; - - prof_elem = (uint8_t*)profile->pk_schemes; - offset = (peer_hello->hc + peer_hello->cc + peer_hello->ac) * ZRTP_COMP_TYPE_SIZE; - count = peer_hello->kc; - - /* Looking for peer preferable DH scheme */ - cp = (char*)peer_hello->comp + offset; - for (i=0; i<count; i++, cp+=ZRTP_COMP_TYPE_SIZE) { - uint8_t tmp_pref_peer_pk = zrtp_comp_type2id(type, cp); - j = 0; - while (prof_elem[j]) { - if (prof_elem[j++] == tmp_pref_peer_pk) { - pref_peer_pk = tmp_pref_peer_pk; - break; - } - } - if (ZRTP_COMP_UNKN != pref_peer_pk) { - break; - } - } - - /* Looking for local preferable DH scheme */ - i=0; - while (prof_elem[i]) { - uint8_t tmp_pref_pk = prof_elem[i++]; - cp = (char*)peer_hello->comp + offset; - for (j=0; j<count; j++, cp+=ZRTP_COMP_TYPE_SIZE) { - if(tmp_pref_pk == zrtp_comp_type2id(type, cp)) { - pref_pk = tmp_pref_pk; - break; - } - } - if (ZRTP_COMP_UNKN != pref_pk) { - break; - } - } - - ZRTP_LOG(3,(_ZTU_,"\t_zrtp_choose_best_comp() for PKT. local=%s remote=%s, choosen=%s\n", - zrtp_comp_id2type(type, pref_pk), zrtp_comp_id2type(type, pref_peer_pk), zrtp_comp_id2type(type, ZRTP_MIN(pref_peer_pk, pref_pk)))); - - /* Choose the fastest one. */ - return ZRTP_MIN(pref_peer_pk, pref_pk); - } break; - case ZRTP_CC_HASH: - prof_elem = (uint8_t*)&profile->hash_schemes; - offset = 0; - count = peer_hello->hc; - break; - case ZRTP_CC_SAS: - prof_elem = (uint8_t*)profile->sas_schemes; - offset = (peer_hello->hc + peer_hello->cc + peer_hello->ac + peer_hello->kc)* ZRTP_COMP_TYPE_SIZE; - count = peer_hello->sc; - break; - case ZRTP_CC_CIPHER: - prof_elem = (uint8_t*)profile->cipher_types; - offset = peer_hello->hc * ZRTP_COMP_TYPE_SIZE; - count = peer_hello->cc; - break; - case ZRTP_CC_ATL: - prof_elem = (uint8_t*)profile->auth_tag_lens; - offset = (peer_hello->hc + peer_hello->cc)*ZRTP_COMP_TYPE_SIZE; - count = peer_hello->ac; - break; - default: - return ZRTP_COMP_UNKN; - } - - while (prof_elem[i]) - { - char *cp = (char*)peer_hello->comp + offset; - uint8_t comp_id = prof_elem[i++]; - - for (j=0; j<count; j++, cp+=ZRTP_COMP_TYPE_SIZE) { - if (comp_id == zrtp_comp_type2id(type, cp)) { - return comp_id; - } - } - } - - return ZRTP_COMP_UNKN; -} - -/*----------------------------------------------------------------------------*/ -static int _is_presh_in_hello(zrtp_packet_Hello_t* hello) -{ - int i = 0; - char* cp = (char*)hello->comp + (hello->hc + hello->cc + hello->ac) * ZRTP_COMP_TYPE_SIZE; - for (i=0; i < hello->kc; i++, cp+=ZRTP_COMP_TYPE_SIZE) { - if (!zrtp_memcmp(cp, ZRTP_PRESHARED, ZRTP_COMP_TYPE_SIZE)) { - return i; - } - } - - return -1; -} - -int _zrtp_is_dh_in_session(zrtp_stream_t* stream) -{ - uint8_t i = 0; - for (i=0; i< ZRTP_MAX_STREAMS_PER_SESSION; i++) { - zrtp_stream_t *tmp_stream = &stream->session->streams[i]; - if ((tmp_stream != stream) && ZRTP_IS_STREAM_DH(tmp_stream)) { - return 0; - } - } - return -1; -} - -zrtp_stream_mode_t _zrtp_define_stream_mode(zrtp_stream_t* stream) -{ - zrtp_session_t* session = stream->session; - - /* - * If ZRTP Session key is available - use Multistream mode. - * If both sides ready for Preshared and we have RS1 and it has Verified flag - try Preshared. - * Use DH in other cases - */ - if (session->zrtpsess.length > 0) { - stream->pubkeyscheme = zrtp_comp_find(ZRTP_CC_PKT, ZRTP_PKTYPE_MULT, session->zrtp); - return ZRTP_STREAM_MODE_MULT; - } else { - /* If both sides ready for Preshared and we have RSes in our cache - try Preshared. */ - if (ZRTP_PKTYPE_PRESH == stream->pubkeyscheme->base.id) - { - do { - uint32_t verifiedflag = 0; - uint32_t calls_counter = 0; - - if (_is_presh_in_hello(&stream->messages.peer_hello) < 0) { - break; - } - - if (ZRTP_IS_STREAM_PRESH(stream) && session->zrtp->cb.cache_cb.on_presh_counter_get) { - session->zrtp->cb.cache_cb.on_presh_counter_get( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - &calls_counter); - if (calls_counter >= ZRTP_PRESHARED_MAX_ALLOWED) { - ZRTP_LOG(3,(_ZTU_,"\tDefine stream mode: user wants PRESHARED but Preshared" - "calls counter reached the maximum value (ID=%u) - Reset to DH.\n", stream->id)); - break; - } - } - - 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); - } - - if (!session->secrets.rs1->_cachedflag || !verifiedflag) { - ZRTP_LOG(3,(_ZTU_,"\tDefine stream mode: user wants PRESHARED but we HAVE " - "RS1=%d and V=%d. Reset to DH. ID=%u\n", session->secrets.rs1->_cachedflag, verifiedflag, stream->id)); - break; - } - - ZRTP_LOG(3,(_ZTU_,"\tDefine stream mode: user wants PRESHARED and we have RS1," - " calls_counter=%d. Use preshared. ID=%u\n", calls_counter, stream->id)); - - return ZRTP_STREAM_MODE_PRESHARED; - } while (0); - } - - /* If Preshared not accepted by some reaseon - choose appropriate DH scheme. */ - if ( (ZRTP_PKTYPE_PRESH == stream->pubkeyscheme->base.id) || - (ZRTP_PKTYPE_MULT == stream->pubkeyscheme->base.id) ) - { - int i=0, j=0; - zrtp_packet_Hello_t* phello = &stream->messages.peer_hello; - uint8_t comp_id = ZRTP_COMP_UNKN; - - while (session->profile.pk_schemes[i]) - { - char *cp = (char*)phello->comp + (phello->hc + phello->cc + phello->ac) * ZRTP_COMP_TYPE_SIZE; - comp_id = session->profile.pk_schemes[i++]; - if ((comp_id != ZRTP_PKTYPE_PRESH) && (comp_id != ZRTP_PKTYPE_MULT)) - { - for (j=0; j<phello->kc; j++, cp+=ZRTP_COMP_TYPE_SIZE) { - if (comp_id == zrtp_comp_type2id(ZRTP_CC_PKT, cp)) { - break; - } - } - if (j != phello->kc) { - break; - } - } - } - - stream->pubkeyscheme = zrtp_comp_find(ZRTP_CC_PKT, comp_id, session->zrtp); - } - - return ZRTP_STREAM_MODE_DH; - } -} - -/*---------------------------------------------------------------------------*/ -int _zrtp_validate_message_hmac( zrtp_stream_t *stream, - zrtp_msg_hdr_t* msg2check, - char* hmackey) -{ - zrtp_string32_t hash_str = ZSTR_INIT_EMPTY(hash_str); - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA256, stream->session->zrtp); - - hash->hmac_truncated_c( hash, - hmackey, - ZRTP_MESSAGE_HASH_SIZE, - (char*)msg2check, - zrtp_ntoh16(msg2check->length)*4 - ZRTP_HMAC_SIZE, - ZRTP_HMAC_SIZE, - ZSTR_GV(hash_str)); - - if (0 != zrtp_memcmp((char*)msg2check + (zrtp_ntoh16(msg2check->length)*4 - ZRTP_HMAC_SIZE), hash_str.buffer, ZRTP_HMAC_SIZE)) - { - if (stream->zrtp->cb.event_cb.on_zrtp_security_event) { - stream->zrtp->cb.event_cb.on_zrtp_security_event(stream, ZRTP_EVENT_WRONG_MESSAGE_HMAC); - } - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_wrong_meshmac, 0); - return -1; - } - - return 0; -} - -/*---------------------------------------------------------------------------*/ -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) -{ - static const zrtp_string8_t presh_key_str = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_COMMIT_HV_KEY_STR); - zrtp_string32_t preshared_key = ZSTR_INIT_EMPTY(preshared_key); - static uint32_t length_rs = ZRTP_RS_SIZE; - static const uint32_t length_zero = 0; - - void *hash_ctx = session->hash->hash_begin(session->hash); - if (!hash_ctx) { - return zrtp_status_alloc_fail; - } - - length_rs = zrtp_hton32(length_rs); - - if (rs1) { - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&length_rs, 4); - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)rs1->buffer, ZRTP_RS_SIZE); - } else { - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&length_zero, 4); - } - - if (auxs) { - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&length_rs, 4); - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)auxs->buffer, ZRTP_RS_SIZE); - } else { - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&length_zero, 4); - } - - if (pbxs) { - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&length_rs, 4); - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)pbxs->buffer, ZRTP_RS_SIZE); - } else { - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&length_zero, 4); - } - - session->hash->hash_end(session->hash, hash_ctx, ZSTR_GV(preshared_key)); - if (key) { - zrtp_zstrcpy(ZSTR_GVP(key), ZSTR_GV(preshared_key)); - } - - if (key_id) { - session->hash->hmac_truncated( session->hash, - ZSTR_GV(preshared_key), - ZSTR_GV(presh_key_str), - ZRTP_HV_KEY_SIZE, - ZSTR_GVP(key_id)); - } - - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -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) -{ - /*KDF(KI, Label, Context, L) = HMAC(KI, i | Label | 0x00 | Context | L) */ - uint32_t i = 1; - uint8_t o = 0; - uint32_t L = zrtp_hton32(length*8); - zrtp_hash_t* hash = stream->session->hash; - void* ctx = hash->hmac_begin(hash, ki); - if (!ctx) { - return zrtp_status_alloc_fail; - } - - i = zrtp_hton32(i); - hash->hmac_update(hash, ctx, (const char*)&i, sizeof(i)); - hash->hmac_update(hash, ctx, label->buffer, label->length); - hash->hmac_update(hash, ctx, (const char*)&o, sizeof(o)); - hash->hmac_update(hash, ctx, context->buffer, context->length); - hash->hmac_update(hash, ctx, (const char*)&L, sizeof(L)); - - hash->hmac_end(hash, ctx, digest, length); - - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_verified_set( zrtp_global_t *zrtp, - zrtp_string16_t *zid1, - zrtp_string16_t *zid2, - uint8_t verified ) -{ - mlist_t *node = NULL; - - if (!zrtp) { - return zrtp_status_bad_param; - } - - zrtp_mutex_lock(zrtp->sessions_protector); - - mlist_for_each(node, &zrtp->sessions_head) - { - zrtp_session_t *session = mlist_get_struct(zrtp_session_t, _mlist, node); - if ( ( !zrtp_zstrcmp(ZSTR_GV(session->zid), ZSTR_GVP(zid1)) || - !zrtp_zstrcmp(ZSTR_GV(session->zid), ZSTR_GVP(zid2)) ) && - ( !zrtp_zstrcmp(ZSTR_GV(session->peer_zid), ZSTR_GVP(zid1)) || - !zrtp_zstrcmp(ZSTR_GV(session->peer_zid), ZSTR_GVP(zid2)) ) ) - { - if (session->zrtp->cb.cache_cb.on_set_verified) { - session->zrtp->cb.cache_cb.on_set_verified(ZSTR_GVP(zid1), ZSTR_GVP(zid2), verified); - } - - if (session->mitm_alert_detected) { - session->mitm_alert_detected = 0; - if (session->zrtp->cb.cache_cb.on_put) { - session->zrtp->cb.cache_cb.on_put( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - session->secrets.rs1); - } - } - } - } - - zrtp_mutex_unlock(zrtp->sessions_protector); - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -uint32_t _zrtp_get_timeout(uint32_t curr_timeout, zrtp_msg_type_t msg) -{ - uint32_t timeout = curr_timeout; - uint32_t base_interval = 0; - uint32_t capping = 0; -#if (defined(ZRTP_BUILD_FOR_CSD) && (ZRTP_BUILD_FOR_CSD == 1)) - uint8_t is_lineral = 1; - capping = 10000; -#else - uint8_t is_lineral = 0; -#endif - switch (msg) - { - case ZRTP_NONE: - case ZRTP_HELLOACK: - case ZRTP_DHPART1: - case ZRTP_CONFIRM1: - case ZRTP_CONFIRM2ACK: - case ZRTP_GOCLEARACK: - case ZRTP_RELAYACK: - return 0; -#if (defined(ZRTP_BUILD_FOR_CSD) && (ZRTP_BUILD_FOR_CSD == 1)) - case ZRTP_HELLO: - base_interval = ZRTP_CSD_T1; - break; - case ZRTP_COMMIT: - base_interval = ZRTP_CSD_T2; - break; - case ZRTP_DHPART2: - base_interval = ZRTP_CSD_T3; - break; - case ZRTP_CONFIRM2: - base_interval = ZRTP_CSD_T4; - break; - case ZRTP_GOCLEAR: - case ZRTP_SASRELAY: - base_interval = ZRTP_CSD_T2; - break; - case ZRTP_ERROR: - base_interval = ZRTP_CSD_ET; - break; -#else - case ZRTP_HELLO: - base_interval = ZRTP_T1; - capping = ZRTP_T1_CAPPING; - break; - case ZRTP_COMMIT: - case ZRTP_DHPART2: - case ZRTP_CONFIRM2: - case ZRTP_GOCLEAR: - case ZRTP_SASRELAY: - base_interval = ZRTP_T2; - capping = ZRTP_T2_CAPPING; - break; - case ZRTP_ERROR: - case ZRTP_ERRORACK: - base_interval = ZRTP_ET; - capping = ZRTP_T2_CAPPING; - break; -#endif - case ZRTP_PROCESS: - base_interval = ZRTP_PROCESS_T1; - break; - default: - return 0; - } - - if (0 == timeout) { - timeout = base_interval; - } else if (!is_lineral) { - timeout *= 2; - } else { - timeout += base_interval; - } - - if (timeout > capping) { - return capping; - } else { - return timeout; - } -} - diff --git a/libs/libzrtp/test/cache_test.c b/libs/libzrtp/test/cache_test.c deleted file mode 100644 index 5713249b7e..0000000000 --- a/libs/libzrtp/test/cache_test.c +++ /dev/null @@ -1,498 +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 <v.krikun at zfoneproject.com> - */ - -#include <stdarg.h> -#include <stddef.h> -#include <setjmp.h> -#include <string.h> -#include <stdio.h> - -#include "zrtp.h" -#include "cmockery/cmockery.h" - -#define TEST_CACHE_PATH "./zrtp_cache_test.dat" - -static zrtp_global_t g_zrtp_cfg; - -static zrtp_string16_t zid_my = ZSTR_INIT_WITH_CONST_CSTRING("000000000_00"); -static zrtp_string16_t zid_a = ZSTR_INIT_WITH_CONST_CSTRING("000000000_02"); -static zrtp_string16_t zid_b = ZSTR_INIT_WITH_CONST_CSTRING("000000000_03"); -static zrtp_string16_t zid_c = ZSTR_INIT_WITH_CONST_CSTRING("000000000_04"); -static zrtp_string16_t zid_mitm1 = ZSTR_INIT_WITH_CONST_CSTRING("000000000_m1"); -static zrtp_string16_t zid_mitm2 = ZSTR_INIT_WITH_CONST_CSTRING("000000000_m2"); - -static zrtp_shared_secret_t rs_my4a, rs_my4b, rs_my4c, rs_my4mitm1, rs_my4mitm2; -static zrtp_shared_secret_t rs_my4a_r, rs_my4b_r, rs_my4c_r, rs_my4mitm1_r, rs_my4mitm2_r; - -static zrtp_cache_id_t secerets_to_delete[24]; -static unsigned secerets_to_delete_count = 0; - -static void init_rs_secret_(zrtp_shared_secret_t *sec, unsigned char val_fill); - -extern void zrtp_cache_create_id(const zrtp_stringn_t* first_ZID, - const zrtp_stringn_t* second_ZID, - zrtp_cache_id_t id); - - -void cache_setup() { - zrtp_status_t status; - - /* Delete cache file from previous test if it exists. */ - remove(TEST_CACHE_PATH); - - secerets_to_delete_count = 0; - - ZSTR_SET_EMPTY(g_zrtp_cfg.def_cache_path); - /* Configure and Initialize ZRTP cache */ - zrtp_zstrcpyc(ZSTR_GV(g_zrtp_cfg.def_cache_path), TEST_CACHE_PATH); - - init_rs_secret_(&rs_my4a, 'a'); init_rs_secret_(&rs_my4b, 'b'); init_rs_secret_(&rs_my4c, 'c'); - init_rs_secret_(&rs_my4mitm1, '1'); init_rs_secret_(&rs_my4mitm2, '2'); - - init_rs_secret_(&rs_my4a_r, 0); init_rs_secret_(&rs_my4b_r, 0); init_rs_secret_(&rs_my4c_r, 0); - init_rs_secret_(&rs_my4mitm1_r, 0); init_rs_secret_(&rs_my4mitm2_r, 0); - - /* It should NOT crash and return OK. */ - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - /* Add few values into it */ - printf("==> Add few test entries.\n"); - - status = zrtp_def_cache_put(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a); - assert_int_equal(status, zrtp_status_ok); - status = zrtp_def_cache_put(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b); - assert_int_equal(status, zrtp_status_ok); - status = zrtp_def_cache_put(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c); - assert_int_equal(status, zrtp_status_ok); - - status = zrtp_def_cache_put_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1); - assert_int_equal(status, zrtp_status_ok); - status = zrtp_def_cache_put_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2); - assert_int_equal(status, zrtp_status_ok); - - status = zrtp_def_cache_put(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c); - assert_int_equal(status, zrtp_status_ok); - - /* Close the cache, it should be flushed to the file. */ - printf("==> Close the cache.\n"); - - zrtp_def_cache_down(); - - printf("==> Open just prepared cache file.\n"); - - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - printf("==> Ready for the test!.\n"); -} - -void cache_teardown() { - zrtp_def_cache_down(); -} - -/* - * Simply init ZRTP cache with empty or non-existing filer and close it. - * The app should not crash and trigger no errors. -*/ -void cache_init_store_empty_test() { - zrtp_def_cache_down(); -} - -/* - * Add few entries to the empty cache, flush it and then load again. Check if - * all the entries were restored successfully. - */ -void cache_add2empty_test() { - zrtp_status_t status; - int intres; - - /* Now, let's open the cache again and check if all the previously added values were restored successfully */ - printf("==> And open it again, it should contain all the stored values.\n"); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4a_r.value), ZSTR_GV(rs_my4a.value))); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4b_r.value), ZSTR_GV(rs_my4b.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm1_r.value), ZSTR_GV(rs_my4mitm1.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm2_r.value), ZSTR_GV(rs_my4mitm2.value))); -} - -/* - * Test if cache properly handles Open-Close-Open with now no changes to the cache values. - */ -void cache_save_unchanged_test() { - zrtp_status_t status; - - /* Now, let's open the cache again and check if all the previously added values were restored successfully */ - printf("==> Now let's Open the cache and Close it right after, make no changes.\n"); - - zrtp_def_cache_down(); - - /* - * TEST: now let's store the cache making no changes to it. - * After opening it should include all the secrets untouched. - */ - - printf("==> And the cache again, it should contain all the stored values.\n"); - - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4a_r.value), ZSTR_GV(rs_my4a.value))); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4b_r.value), ZSTR_GV(rs_my4b.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm1_r.value), ZSTR_GV(rs_my4mitm1.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm2_r.value), ZSTR_GV(rs_my4mitm2.value))); -} - -/* - * Check how the cache handles flushing of several dirty (modified) values. The cache should - * flush to the disk modified values only and leave rest of the items untouched. - */ -void cache_modify_and_save_test() { - zrtp_status_t status; - int intres; - - printf("==> And open it again, it should contain all the stored values.\n"); - - /* - * Now, let's modify just few entries and check of the fill will be stored. - * - * We will change RS secrets rs_my4b, rs_my4c and rs_my4mitm1 while leaving - * rs_my4a and rs_my4mitm2 untouched. - */ - - init_rs_secret_(&rs_my4b, 'x'); init_rs_secret_(&rs_my4c, 'y'); - init_rs_secret_(&rs_my4mitm1, 'z'); - - printf("==> Now we gonna to update few cache entries and flush the cache mack to the file.\n"); - - status = zrtp_def_cache_put(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b); - assert_int_equal(status, zrtp_status_ok); - status = zrtp_def_cache_put(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c); - assert_int_equal(status, zrtp_status_ok); - status = zrtp_def_cache_put_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1); - assert_int_equal(status, zrtp_status_ok); - - /* Flush the cache and open it again. */ - zrtp_def_cache_down(); - - printf("==> Open the cache and make sure all our prev. modifications saved properly.\n"); - - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - /* Let's check if all our modifications are in place. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4a_r.value), ZSTR_GV(rs_my4a.value))); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4b_r.value), ZSTR_GV(rs_my4b.value))); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4c_r.value), ZSTR_GV(rs_my4c.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm1_r.value), ZSTR_GV(rs_my4mitm1.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm2_r.value), ZSTR_GV(rs_my4mitm2.value))); -} - -/* - * The basic idea of all cache_delete_* tests is to delete few cache entries - * from preconfigured setup, flush caches, open the cache again and check if - * non-deleted values are Ok. - */ - -static int cache_foreach_del_func(zrtp_cache_elem_t* elem, int is_mitm, void* data, int* del) { - unsigned c; - - //printf("AAAA cache_foreach_del_func(): elem index=%u\n", elem->_index); - - for (c=0; c<secerets_to_delete_count; c++) { - if (!zrtp_memcmp(elem->id, secerets_to_delete[c], sizeof(zrtp_cache_id_t))) { - printf("\t==> Delete cache element index=%u.\n", elem->_index); - *del = 1; - break; - } - } - - return 1; -} - -void cache_delete_few_rs_test() { - zrtp_status_t status; - - printf("==> Delete few RS secrets and flush the cache.\n"); - - secerets_to_delete_count = 0; - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_b), secerets_to_delete[secerets_to_delete_count++]); - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_a), secerets_to_delete[secerets_to_delete_count++]); - - zrtp_def_cache_foreach(&g_zrtp_cfg, 0, &cache_foreach_del_func, NULL); - - /* Flush the cache and open it again. */ - zrtp_def_cache_down(); - - printf("==> Open the cache and make sure all our prev. Modifications saved properly.\n"); - - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - /* Let's check if all our modifications are in place. */ - - /* my4a should be deleted. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a_r, 0); - assert_int_not_equal(status, zrtp_status_ok); - - /* my4b should be deleted. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b_r, 0); - assert_int_not_equal(status, zrtp_status_ok); - - /* The rest of the secrets should be in place. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4c_r.value), ZSTR_GV(rs_my4c.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm1_r.value), ZSTR_GV(rs_my4mitm1.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm2_r.value), ZSTR_GV(rs_my4mitm2.value))); -} - -void cache_delete_few_mitm_test() { - zrtp_status_t status; - - printf("==> Delete few MiTM secrets and flush the cache.\n"); - - secerets_to_delete_count = 0; - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), secerets_to_delete[secerets_to_delete_count++]); - - zrtp_def_cache_foreach(&g_zrtp_cfg, 1, &cache_foreach_del_func, NULL); - - /* Flush the cache and open it again. */ - zrtp_def_cache_down(); - - printf("==> Open the cache and make sure all our prev. Modifications saved properly.\n"); - - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - /* Let's check if all our modifications are in place. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4a_r.value), ZSTR_GV(rs_my4a.value))); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4b_r.value), ZSTR_GV(rs_my4b.value))); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4c_r.value), ZSTR_GV(rs_my4c.value))); - - /* Should be deleted */ - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1_r); - assert_int_not_equal(status, zrtp_status_ok); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm2_r.value), ZSTR_GV(rs_my4mitm2.value))); -} - -void cache_delete_few_rs_and_mitm_test() { - zrtp_status_t status; - - printf("==> Delete few RS secrets and flush the cache.\n"); - - secerets_to_delete_count = 0; - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_b), secerets_to_delete[secerets_to_delete_count++]); - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_a), secerets_to_delete[secerets_to_delete_count++]); - - zrtp_def_cache_foreach(&g_zrtp_cfg, 0, &cache_foreach_del_func, NULL); - - secerets_to_delete_count = 0; - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), secerets_to_delete[secerets_to_delete_count++]); - - zrtp_def_cache_foreach(&g_zrtp_cfg, 1, &cache_foreach_del_func, NULL); - - /* Flush the cache and open it again. */ - zrtp_def_cache_down(); - - printf("==> Open the cache and make sure all our prev. Modifications saved properly.\n"); - - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - /* Let's check if all our modifications are in place. */ - - /* Should be deleted. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a_r, 0); - assert_int_not_equal(status, zrtp_status_ok); - - /* Should be deleted. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b_r, 0); - assert_int_not_equal(status, zrtp_status_ok); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4c_r.value), ZSTR_GV(rs_my4c.value))); - - /* Should be deleted. */ - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1_r); - assert_int_not_equal(status, zrtp_status_ok); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm2_r.value), ZSTR_GV(rs_my4mitm2.value))); -} - -void cache_delete_all_rs_test() { - zrtp_status_t status; - - printf("==> Delete few RS secrets and flush the cache.\n"); - - secerets_to_delete_count = 0; - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_b), secerets_to_delete[secerets_to_delete_count++]); - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_a), secerets_to_delete[secerets_to_delete_count++]); - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_c), secerets_to_delete[secerets_to_delete_count++]); - - zrtp_def_cache_foreach(&g_zrtp_cfg, 0, &cache_foreach_del_func, NULL); - - /* Flush the cache and open it again. */ - zrtp_def_cache_down(); - - printf("==> Open the cache and make sure all our prev. Modifications saved properly.\n"); - - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - /* Let's check if all our modifications are in place. */ - - /* All RS values should be deleted. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a_r, 0); - assert_int_not_equal(status, zrtp_status_ok); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b_r, 0); - assert_int_not_equal(status, zrtp_status_ok); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c_r, 0); - assert_int_not_equal(status, zrtp_status_ok); - - /* MiTM secrets should be in place. */ - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm1_r.value), ZSTR_GV(rs_my4mitm1.value))); - - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2_r); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4mitm2_r.value), ZSTR_GV(rs_my4mitm2.value))); -} - -void cache_delete_all_mitm_test() { - zrtp_status_t status; - - printf("==> Delete few MiTM secrets and flush the cache.\n"); - - secerets_to_delete_count = 0; - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), secerets_to_delete[secerets_to_delete_count++]); - zrtp_cache_create_id(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), secerets_to_delete[secerets_to_delete_count++]); - - zrtp_def_cache_foreach(&g_zrtp_cfg, 1, &cache_foreach_del_func, NULL); - - /* Flush the cache and open it again. */ - zrtp_def_cache_down(); - - printf("==> Open the cache and make sure all our prev. Modifications saved properly.\n"); - - status = zrtp_def_cache_init(&g_zrtp_cfg); - assert_int_equal(status, zrtp_status_ok); - - /* Let's check if all our modifications are in place. */ - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_a), &rs_my4a_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4a_r.value), ZSTR_GV(rs_my4a.value))); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_b), &rs_my4b_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4b_r.value), ZSTR_GV(rs_my4b.value))); - - status = zrtp_def_cache_get(ZSTR_GV(zid_my), ZSTR_GV(zid_c), &rs_my4c_r, 0); - assert_int_equal(status, zrtp_status_ok); - assert_false(zrtp_zstrcmp(ZSTR_GV(rs_my4c_r.value), ZSTR_GV(rs_my4c.value))); - - /* All MiTM secrets should be deleted. */ - status = zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm1), &rs_my4mitm1_r); - assert_int_not_equal(status, zrtp_status_ok); - - assert_int_not_equal(zrtp_def_cache_get_mitm(ZSTR_GV(zid_my), ZSTR_GV(zid_mitm2), &rs_my4mitm2_r), zrtp_status_ok); -} - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(cache_init_store_empty_test, cache_setup, cache_teardown), - unit_test_setup_teardown(cache_add2empty_test, cache_setup, cache_teardown), - unit_test_setup_teardown(cache_save_unchanged_test, cache_setup, cache_teardown), - unit_test_setup_teardown(cache_modify_and_save_test, cache_setup, cache_teardown), - - unit_test_setup_teardown(cache_delete_few_rs_test, cache_setup, cache_teardown), - unit_test_setup_teardown(cache_delete_few_mitm_test, cache_setup, cache_teardown), - unit_test_setup_teardown(cache_delete_few_rs_and_mitm_test, cache_setup, cache_teardown), - unit_test_setup_teardown(cache_delete_all_mitm_test, cache_setup, cache_teardown), - }; - - return run_tests(tests); -} - - -/****************************************************************************** - * Helpers - *****************************************************************************/ - -static void init_rs_secret_(zrtp_shared_secret_t *sec, unsigned char val_fill) { - - char val_buff[ZRTP_HASH_SIZE]; - zrtp_memset(val_buff, val_fill, sizeof(val_buff)); - - ZSTR_SET_EMPTY(sec->value); - zrtp_zstrcpyc(ZSTR_GV(sec->value), val_buff); - - sec->_cachedflag = 0; - sec->ttl = 0; - sec->lastused_at = 0; -} diff --git a/libs/libzrtp/test/cipher_test.c b/libs/libzrtp/test/cipher_test.c deleted file mode 100644 index 8ef7ec15d2..0000000000 --- a/libs/libzrtp/test/cipher_test.c +++ /dev/null @@ -1,65 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> -#include <stdio.h> - -#include "zrtp.h" -#include "cmockery/cmockery.h" - -zrtp_global_t *zrtp; - -void setup() { - zrtp_status_t s; - zrtp_config_t zrtp_config; - - zrtp_config_defaults(&zrtp_config); - - s = zrtp_init(&zrtp_config, &zrtp); - assert_int_equal(s, zrtp_status_ok); -} - -void teardown() { - zrtp_down(zrtp); -} - -static void aes128_ctr_test() { - zrtp_cipher_t *cipher = zrtp_comp_find(ZRTP_CC_CIPHER, ZRTP_CIPHER_AES128, zrtp); - assert_non_null(cipher); - cipher->self_test(cipher, ZRTP_CIPHER_MODE_CTR); -} - -static void aes128_cfb_test() { - zrtp_cipher_t *cipher = zrtp_comp_find(ZRTP_CC_CIPHER, ZRTP_CIPHER_AES128, zrtp); - assert_non_null(cipher); - cipher->self_test(cipher, ZRTP_CIPHER_MODE_CFB); -} - -static void aes256_ctr_test() { - zrtp_cipher_t *cipher = zrtp_comp_find(ZRTP_CC_CIPHER, ZRTP_CIPHER_AES256, zrtp); - assert_non_null(cipher); - cipher->self_test(cipher, ZRTP_CIPHER_MODE_CTR); -} - -static void aes256_cfb_test() { - zrtp_cipher_t *cipher = zrtp_comp_find(ZRTP_CC_CIPHER, ZRTP_CIPHER_AES256, zrtp); - assert_non_null(cipher); - cipher->self_test(cipher, ZRTP_CIPHER_MODE_CFB); -} - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(aes128_ctr_test, setup, teardown), - unit_test_setup_teardown(aes128_cfb_test, setup, teardown), - unit_test_setup_teardown(aes256_ctr_test, setup, teardown), - unit_test_setup_teardown(aes256_cfb_test, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/cmockery/cmockery.c b/libs/libzrtp/test/cmockery/cmockery.c deleted file mode 100644 index e162495115..0000000000 --- a/libs/libzrtp/test/cmockery/cmockery.c +++ /dev/null @@ -1,1803 +0,0 @@ -/* - * Copyright 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif -#include <setjmp.h> -#ifndef _WIN32 -#include <signal.h> -#endif // !_WIN32 -#include <stdarg.h> -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#endif /* HAVE_INTTYPES_H */ -#ifdef _WIN32 -#include <windows.h> -#endif // _WIN32 -#include <cmockery.h> - -#ifdef _WIN32 -#define vsnprintf _vsnprintf -#endif // _WIN32 - -/* Backwards compatibility with headers shipped with Visual Studio 2005 and - * earlier. */ -#ifdef _WIN32 -WINBASEAPI BOOL WINAPI IsDebuggerPresent(VOID); -#endif // _WIN32 - -// Size of guard bytes around dynamically allocated blocks. -#define MALLOC_GUARD_SIZE 16 -// Pattern used to initialize guard blocks. -#define MALLOC_GUARD_PATTERN 0xEF -// Pattern used to initialize memory allocated with test_malloc(). -#define MALLOC_ALLOC_PATTERN 0xBA -#define MALLOC_FREE_PATTERN 0xCD -// Alignment of allocated blocks. NOTE: This must be base2. -#define MALLOC_ALIGNMENT sizeof(size_t) - -// Printf formatting for source code locations. -#define SOURCE_LOCATION_FORMAT "%s:%d" - -// Calculates the number of elements in an array. -#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) - -// Declare and initialize the pointer member of ValuePointer variable name -// with ptr. -#define declare_initialize_value_pointer_pointer(name, ptr) \ - ValuePointer name ; \ - name.value = 0; \ - name.pointer = (void*)(ptr) - -// Declare and initialize the value member of ValuePointer variable name -// with val. -#define declare_initialize_value_pointer_value(name, val) \ - ValuePointer name ; \ - name.value = val - -// Cast a uintmax_t to pointer_type via a ValuePointer. -#define cast_largest_integral_type_to_pointer( \ - pointer_type, largest_integral_type) \ - ((pointer_type)((ValuePointer*)&(largest_integral_type))->pointer) - -// Used to cast uintmax_t to void* and vice versa. -typedef union ValuePointer { - uintmax_t value; - void *pointer; -} ValuePointer; - -// Doubly linked list node. -typedef struct ListNode { - const void *value; - int refcount; - struct ListNode *next; - struct ListNode *prev; -} ListNode; - -// Debug information for malloc(). -typedef struct MallocBlockInfo { - void* block; // Address of the block returned by malloc(). - size_t allocated_size; // Total size of the allocated block. - size_t size; // Request block size. - SourceLocation location; // Where the block was allocated. - ListNode node; // Node within list of all allocated blocks. -} MallocBlockInfo; - -// State of each test. -typedef struct TestState { - const ListNode *check_point; // Check point of the test if there's a - // setup function. - void *state; // State associated with the test. -} TestState; - -// Determines whether two values are the same. -typedef int (*EqualityFunction)(const void *left, const void *right); - -// Value of a symbol and the place it was declared. -typedef struct SymbolValue { - SourceLocation location; - uintmax_t value; -} SymbolValue; - -/* Contains a list of values for a symbol. - * NOTE: Each structure referenced by symbol_values_list_head must have a - * SourceLocation as its' first member. - */ -typedef struct SymbolMapValue { - const char *symbol_name; - ListNode symbol_values_list_head; -} SymbolMapValue; - -// Used by list_free() to deallocate values referenced by list nodes. -typedef void (*CleanupListValue)(const void *value, void *cleanup_value_data); - -// Structure used to check the range of integer types. -typedef struct CheckIntegerRange { - CheckParameterEvent event; - uintmax_t minimum; - uintmax_t maximum; -} CheckIntegerRange; - -// Structure used to check whether an integer value is in a set. -typedef struct CheckIntegerSet { - CheckParameterEvent event; - const uintmax_t *set; - size_t size_of_set; -} CheckIntegerSet; - -/* Used to check whether a parameter matches the area of memory referenced by - * this structure. */ -typedef struct CheckMemoryData { - CheckParameterEvent event; - const void *memory; - size_t size; -} CheckMemoryData; - -static ListNode* list_initialize(ListNode * const node); -static ListNode* list_add(ListNode * const head, ListNode *new_node); -static ListNode* list_add_value(ListNode * const head, const void *value, - const int count); -static ListNode* list_remove( - ListNode * const node, const CleanupListValue cleanup_value, - void * const cleanup_value_data); -static void list_remove_free( - ListNode * const node, const CleanupListValue cleanup_value, - void * const cleanup_value_data); -static int list_empty(const ListNode * const head); -static int list_find( - ListNode * const head, const void *value, - const EqualityFunction equal_func, ListNode **output); -static int list_first(ListNode * const head, ListNode **output); -static ListNode* list_free( - ListNode * const head, const CleanupListValue cleanup_value, - void * const cleanup_value_data); - -static void add_symbol_value( - ListNode * const symbol_map_head, const char * const symbol_names[], - const size_t number_of_symbol_names, const void* value, const int count); -static int get_symbol_value( - ListNode * const symbol_map_head, const char * const symbol_names[], - const size_t number_of_symbol_names, void **output); -static void free_value(const void *value, void *cleanup_value_data); -static void free_symbol_map_value( - const void *value, void *cleanup_value_data); -static void remove_always_return_values(ListNode * const map_head, - const size_t number_of_symbol_names); -static int check_for_leftover_values( - const ListNode * const map_head, const char * const error_message, - const size_t number_of_symbol_names); -// This must be called at the beginning of a test to initialize some data -// structures. -static void initialize_testing(const char *test_name); -// This must be called at the end of a test to free() allocated structures. -static void teardown_testing(const char *test_name); - - -// Keeps track of the calling context returned by setenv() so that the fail() -// method can jump out of a test. -static jmp_buf global_run_test_env; -static int global_running_test = 0; - -// Keeps track of the calling context returned by setenv() so that -// mock_assert() can optionally jump back to expect_assert_failure(). -jmp_buf global_expect_assert_env; -int global_expecting_assert = 0; - -// Keeps a map of the values that functions will have to return to provide -// mocked interfaces. -static ListNode global_function_result_map_head; -// Location of the last mock value returned was declared. -static SourceLocation global_last_mock_value_location; - -/* Keeps a map of the values that functions expect as parameters to their - * mocked interfaces. */ -static ListNode global_function_parameter_map_head; -// Location of last parameter value checked was declared. -static SourceLocation global_last_parameter_location; - -// List of all currently allocated blocks. -static ListNode global_allocated_blocks; - -#ifndef _WIN32 -// Signals caught by exception_handler(). -static const int exception_signals[] = { - SIGFPE, - SIGILL, - SIGSEGV, - SIGBUS, - SIGSYS, -}; - -// Default signal functions that should be restored after a test is complete. -typedef void (*SignalFunction)(int signal); -static SignalFunction default_signal_functions[ - ARRAY_LENGTH(exception_signals)]; - -#else // _WIN32 - -// The default exception filter. -static LPTOP_LEVEL_EXCEPTION_FILTER previous_exception_filter; - -// Fatal exceptions. -typedef struct ExceptionCodeInfo { - DWORD code; - const char* description; -} ExceptionCodeInfo; - -#define EXCEPTION_CODE_INFO(exception_code) {exception_code, #exception_code} - -static const ExceptionCodeInfo exception_codes[] = { - EXCEPTION_CODE_INFO(EXCEPTION_ACCESS_VIOLATION), - EXCEPTION_CODE_INFO(EXCEPTION_ARRAY_BOUNDS_EXCEEDED), - EXCEPTION_CODE_INFO(EXCEPTION_DATATYPE_MISALIGNMENT), - EXCEPTION_CODE_INFO(EXCEPTION_FLT_DENORMAL_OPERAND), - EXCEPTION_CODE_INFO(EXCEPTION_FLT_DIVIDE_BY_ZERO), - EXCEPTION_CODE_INFO(EXCEPTION_FLT_INEXACT_RESULT), - EXCEPTION_CODE_INFO(EXCEPTION_FLT_INVALID_OPERATION), - EXCEPTION_CODE_INFO(EXCEPTION_FLT_OVERFLOW), - EXCEPTION_CODE_INFO(EXCEPTION_FLT_STACK_CHECK), - EXCEPTION_CODE_INFO(EXCEPTION_FLT_UNDERFLOW), - EXCEPTION_CODE_INFO(EXCEPTION_GUARD_PAGE), - EXCEPTION_CODE_INFO(EXCEPTION_ILLEGAL_INSTRUCTION), - EXCEPTION_CODE_INFO(EXCEPTION_INT_DIVIDE_BY_ZERO), - EXCEPTION_CODE_INFO(EXCEPTION_INT_OVERFLOW), - EXCEPTION_CODE_INFO(EXCEPTION_INVALID_DISPOSITION), - EXCEPTION_CODE_INFO(EXCEPTION_INVALID_HANDLE), - EXCEPTION_CODE_INFO(EXCEPTION_IN_PAGE_ERROR), - EXCEPTION_CODE_INFO(EXCEPTION_NONCONTINUABLE_EXCEPTION), - EXCEPTION_CODE_INFO(EXCEPTION_PRIV_INSTRUCTION), - EXCEPTION_CODE_INFO(EXCEPTION_STACK_OVERFLOW), -}; -#endif // !_WIN32 - - -// Exit the currently executing test. -static void exit_test(const int quit_application) { - if (global_running_test) { - longjmp(global_run_test_env, 1); - } else if (quit_application) { - exit(-1); - } -} - - -// Initialize a SourceLocation structure. -static void initialize_source_location(SourceLocation * const location) { - assert_non_null(location); - location->file = NULL; - location->line = 0; -} - - -// Determine whether a source location is currently set. -static int source_location_is_set(const SourceLocation * const location) { - assert_non_null(location); - return location->file && location->line; -} - - -// Set a source location. -static void set_source_location( - SourceLocation * const location, const char * const file, - const int line) { - assert_non_null(location); - location->file = file; - location->line = line; -} - - -// Create function results and expected parameter lists. -void initialize_testing(const char *test_name) { - (void)test_name; - list_initialize(&global_function_result_map_head); - initialize_source_location(&global_last_mock_value_location); - list_initialize(&global_function_parameter_map_head); - initialize_source_location(&global_last_parameter_location); -} - - -void fail_if_leftover_values(const char *test_name) { - int error_occurred = 0; - (void)test_name; - remove_always_return_values(&global_function_result_map_head, 1); - if (check_for_leftover_values( - &global_function_result_map_head, - "%s() has remaining non-returned values.\n", 1)) { - error_occurred = 1; - } - - remove_always_return_values(&global_function_parameter_map_head, 2); - if (check_for_leftover_values( - &global_function_parameter_map_head, - "%s parameter still has values that haven't been checked.\n", 2)) { - error_occurred = 1; - } - if (error_occurred) { - exit_test(1); - } -} - - -void teardown_testing(const char *test_name) { - (void)test_name; - list_free(&global_function_result_map_head, free_symbol_map_value, - (void*)0); - initialize_source_location(&global_last_mock_value_location); - list_free(&global_function_parameter_map_head, free_symbol_map_value, - (void*)1); - initialize_source_location(&global_last_parameter_location); -} - -// Initialize a list node. -static ListNode* list_initialize(ListNode * const node) { - node->value = NULL; - node->next = node; - node->prev = node; - node->refcount = 1; - return node; -} - - -/* Adds a value at the tail of a given list. - * The node referencing the value is allocated from the heap. */ -static ListNode* list_add_value(ListNode * const head, const void *value, - const int refcount) { - ListNode * const new_node = (ListNode*)malloc(sizeof(ListNode)); - assert_non_null(head); - assert_non_null(value); - new_node->value = value; - new_node->refcount = refcount; - return list_add(head, new_node); -} - - -// Add new_node to the end of the list. -static ListNode* list_add(ListNode * const head, ListNode *new_node) { - assert_non_null(head); - assert_non_null(new_node); - new_node->next = head; - new_node->prev = head->prev; - head->prev->next = new_node; - head->prev = new_node; - return new_node; -} - - -// Remove a node from a list. -static ListNode* list_remove( - ListNode * const node, const CleanupListValue cleanup_value, - void * const cleanup_value_data) { - assert_non_null(node); - node->prev->next = node->next; - node->next->prev = node->prev; - if (cleanup_value) { - cleanup_value(node->value, cleanup_value_data); - } - return node; -} - - -/* Remove a list node from a list and free the node. */ -static void list_remove_free( - ListNode * const node, const CleanupListValue cleanup_value, - void * const cleanup_value_data) { - assert_non_null(node); - free(list_remove(node, cleanup_value, cleanup_value_data)); -} - - -/* Frees memory kept by a linked list - * The cleanup_value function is called for every "value" field of nodes in the - * list, except for the head. In addition to each list value, - * cleanup_value_data is passed to each call to cleanup_value. The head - * of the list is not deallocated. - */ -static ListNode* list_free( - ListNode * const head, const CleanupListValue cleanup_value, - void * const cleanup_value_data) { - assert_non_null(head); - while (!list_empty(head)) { - list_remove_free(head->next, cleanup_value, cleanup_value_data); - } - return head; -} - - -// Determine whether a list is empty. -static int list_empty(const ListNode * const head) { - assert_non_null(head); - return head->next == head; -} - - -/* Find a value in the list using the equal_func to compare each node with the - * value. - */ -static int list_find(ListNode * const head, const void *value, - const EqualityFunction equal_func, ListNode **output) { - ListNode *current; - assert_non_null(head); - for (current = head->next; current != head; current = current->next) { - if (equal_func(current->value, value)) { - *output = current; - return 1; - } - } - return 0; -} - -// Returns the first node of a list -static int list_first(ListNode * const head, ListNode **output) { - ListNode *target_node; - assert_non_null(head); - if (list_empty(head)) { - return 0; - } - target_node = head->next; - *output = target_node; - return 1; -} - - -// Deallocate a value referenced by a list. -static void free_value(const void *value, void *cleanup_value_data) { - (void)cleanup_value_data; - assert_non_null(value); - free((void*)value); -} - - -// Releases memory associated to a symbol_map_value. -static void free_symbol_map_value(const void *value, - void *cleanup_value_data) { - SymbolMapValue * const map_value = (SymbolMapValue*)value; - const uintmax_t children = cast_ptr_to_largest_integral_type(cleanup_value_data); - assert_non_null(value); - list_free(&map_value->symbol_values_list_head, - children ? free_symbol_map_value : free_value, - (void *) ((uintptr_t)children - 1)); - free(map_value); -} - - -/* Determine whether a symbol name referenced by a symbol_map_value - * matches the specified function name. */ -static int symbol_names_match(const void *map_value, const void *symbol) { - return !strcmp(((SymbolMapValue*)map_value)->symbol_name, - (const char*)symbol); -} - - -/* Adds a value to the queue of values associated with the given - * hierarchy of symbols. It's assumed value is allocated from the heap. - */ -static void add_symbol_value(ListNode * const symbol_map_head, - const char * const symbol_names[], - const size_t number_of_symbol_names, - const void* value, const int refcount) { - const char* symbol_name; - ListNode *target_node; - SymbolMapValue *target_map_value; - assert_non_null(symbol_map_head); - assert_non_null(symbol_names); - assert_true(number_of_symbol_names); - symbol_name = symbol_names[0]; - - if (!list_find(symbol_map_head, symbol_name, symbol_names_match, - &target_node)) { - SymbolMapValue * const new_symbol_map_value = - (SymbolMapValue*)malloc(sizeof(*new_symbol_map_value)); - new_symbol_map_value->symbol_name = symbol_name; - list_initialize(&new_symbol_map_value->symbol_values_list_head); - target_node = list_add_value(symbol_map_head, new_symbol_map_value, - 1); - } - - target_map_value = (SymbolMapValue*)target_node->value; - if (number_of_symbol_names == 1) { - list_add_value(&target_map_value->symbol_values_list_head, - value, refcount); - } else { - add_symbol_value(&target_map_value->symbol_values_list_head, - &symbol_names[1], number_of_symbol_names - 1, value, - refcount); - } -} - - -/* Gets the next value associated with the given hierarchy of symbols. - * The value is returned as an output parameter with the function returning the - * node's old refcount value if a value is found, 0 otherwise. - * This means that a return value of 1 indicates the node was just removed from - * the list. - */ -static int get_symbol_value( - ListNode * const head, const char * const symbol_names[], - const size_t number_of_symbol_names, void **output) { - const char* symbol_name; - ListNode *target_node; - assert_non_null(head); - assert_non_null(symbol_names); - assert_true(number_of_symbol_names); - assert_non_null(output); - symbol_name = symbol_names[0]; - - if (list_find(head, symbol_name, symbol_names_match, &target_node)) { - SymbolMapValue *map_value; - ListNode *child_list; - int return_value = 0; - assert_non_null(target_node); - assert_non_null(target_node->value); - - map_value = (SymbolMapValue*)target_node->value; - child_list = &map_value->symbol_values_list_head; - - if (number_of_symbol_names == 1) { - ListNode *value_node = NULL; - return_value = list_first(child_list, &value_node); - assert_true(return_value); - *output = (void*) value_node->value; - return_value = value_node->refcount; - if (--value_node->refcount == 0) { - list_remove_free(value_node, NULL, NULL); - } - } else { - return_value = get_symbol_value( - child_list, &symbol_names[1], number_of_symbol_names - 1, - output); - } - if (list_empty(child_list)) { - list_remove_free(target_node, free_symbol_map_value, (void*)0); - } - return return_value; - } else { - print_error("No entries for symbol %s.\n", symbol_name); - } - return 0; -} - - -/* Traverse down a tree of symbol values and remove the first symbol value - * in each branch that has a refcount < -1 (i.e should always be returned - * and has been returned at least once). - */ -static void remove_always_return_values(ListNode * const map_head, - const size_t number_of_symbol_names) { - ListNode *current; - assert_non_null(map_head); - assert_true(number_of_symbol_names); - current = map_head->next; - while (current != map_head) { - SymbolMapValue * const value = (SymbolMapValue*)current->value; - ListNode * const next = current->next; - ListNode *child_list; - assert_non_null(value); - child_list = &value->symbol_values_list_head; - - if (!list_empty(child_list)) { - if (number_of_symbol_names == 1) { - ListNode * const child_node = child_list->next; - // If this item has been returned more than once, free it. - if (child_node->refcount < -1) { - list_remove_free(child_node, free_value, NULL); - } - } else { - remove_always_return_values(child_list, - number_of_symbol_names - 1); - } - } - - if (list_empty(child_list)) { - list_remove_free(current, free_value, NULL); - } - current = next; - } -} - -/* Checks if there are any leftover values set up by the test that were never - * retrieved through execution, and fail the test if that is the case. - */ -static int check_for_leftover_values( - const ListNode * const map_head, const char * const error_message, - const size_t number_of_symbol_names) { - const ListNode *current; - int symbols_with_leftover_values = 0; - assert_non_null(map_head); - assert_true(number_of_symbol_names); - - for (current = map_head->next; current != map_head; - current = current->next) { - const SymbolMapValue * const value = - (SymbolMapValue*)current->value; - const ListNode *child_list; - assert_non_null(value); - child_list = &value->symbol_values_list_head; - - if (!list_empty(child_list)) { - if (number_of_symbol_names == 1) { - const ListNode *child_node; - print_error(error_message, value->symbol_name); - print_error(" Remaining item(s) declared at...\n"); - - for (child_node = child_list->next; child_node != child_list; - child_node = child_node->next) { - const SourceLocation * const location = - (const SourceLocation*)child_node->value; - print_error(" " SOURCE_LOCATION_FORMAT "\n", - location->file, location->line); - } - } else { - print_error("%s.", value->symbol_name); - check_for_leftover_values(child_list, error_message, - number_of_symbol_names - 1); - } - symbols_with_leftover_values ++; - } - } - return symbols_with_leftover_values; -} - - -// Get the next return value for the specified mock function. -uintmax_t _mock(const char * const function, const char* const file, - const int line) { - void *result; - const int rc = get_symbol_value(&global_function_result_map_head, - &function, 1, &result); - if (rc) { - SymbolValue * const symbol = (SymbolValue*)result; - const uintmax_t value = symbol->value; - global_last_mock_value_location = symbol->location; - if (rc == 1) { - free(symbol); - } - return value; - } else { - print_error("ERROR: " SOURCE_LOCATION_FORMAT " - Could not get value " - "to mock function %s\n", file, line, function); - if (source_location_is_set(&global_last_mock_value_location)) { - print_error("Previously returned mock value was declared at " - SOURCE_LOCATION_FORMAT "\n", - global_last_mock_value_location.file, - global_last_mock_value_location.line); - } else { - print_error("There were no previously returned mock values for " - "this test.\n"); - } - exit_test(1); - } - return 0; -} - - -// Add a return value for the specified mock function name. -void _will_return(const char * const function_name, const char * const file, - const int line, const uintmax_t value, - const int count) { - SymbolValue * const return_value = - (SymbolValue*)malloc(sizeof(*return_value)); - assert_true(count > 0 || count == -1); - return_value->value = value; - set_source_location(&return_value->location, file, line); - add_symbol_value(&global_function_result_map_head, &function_name, 1, - return_value, count); -} - - -/* Add a custom parameter checking function. If the event parameter is NULL - * the event structure is allocated internally by this function. If event - * parameter is provided it must be allocated on the heap and doesn't need to - * be deallocated by the caller. - */ -void _expect_check( - const char* const function, const char* const parameter, - const char* const file, const int line, - const CheckParameterValue check_function, - const uintmax_t check_data, - CheckParameterEvent * const event, const int count) { - CheckParameterEvent * const check = - event ? event : (CheckParameterEvent*)malloc(sizeof(*check)); - const char* symbols[] = {function, parameter}; - check->parameter_name = parameter; - check->check_value = check_function; - check->check_value_data = check_data; - set_source_location(&check->location, file, line); - add_symbol_value(&global_function_parameter_map_head, symbols, 2, check, - count); -} - - -/* Returns 1 if the specified values are equal. If the values are not equal - * an error is displayed and 0 is returned. */ -static int values_equal_display_error(const uintmax_t left, - const uintmax_t right) { - const int equal = left == right; - if (!equal) { - print_error("%" PRIxMAX " != " - "%" PRIxMAX "\n", left, right); - } - return equal; -} - -/* Returns 1 if the specified values are not equal. If the values are equal - * an error is displayed and 0 is returned. */ -static int values_not_equal_display_error(const uintmax_t left, - const uintmax_t right) { - const int not_equal = left != right; - if (!not_equal) { - print_error("%" PRIxMAX " == " - "%" PRIxMAX "\n", left, right); - } - return not_equal; -} - - -/* Determine whether value is contained within check_integer_set. - * If invert is 0 and the value is in the set 1 is returned, otherwise 0 is - * returned and an error is displayed. If invert is 1 and the value is not - * in the set 1 is returned, otherwise 0 is returned and an error is - * displayed. */ -static int value_in_set_display_error( - const uintmax_t value, - const CheckIntegerSet * const check_integer_set, const int invert) { - int succeeded = invert; - assert_non_null(check_integer_set); - { - const uintmax_t * const set = check_integer_set->set; - const size_t size_of_set = check_integer_set->size_of_set; - size_t i; - for (i = 0; i < size_of_set; i++) { - if (set[i] == value) { - // If invert = 0 and item is found, succeeded = 1. - // If invert = 1 and item is found, succeeded = 0. - succeeded = !succeeded; - break; - } - } - if (succeeded) { - return 1; - } - print_error("%" PRIuMAX " is %sin the set (", value, invert ? "" : "not "); - for (i = 0; i < size_of_set; i++) { - print_error("%" PRIuMAX ", ", set[i]); - } - print_error(")\n"); - } - return 0; -} - - -/* Determine whether a value is within the specified range. If the value is - * within the specified range 1 is returned. If the value isn't within the - * specified range an error is displayed and 0 is returned. */ -static int integer_in_range_display_error( - const uintmax_t value, const uintmax_t range_min, - const uintmax_t range_max) { - if (value >= range_min && value <= range_max) { - return 1; - } - print_error("%" PRIuMAX " is not within the range %" PRIuMAX "-%" PRIuMAX "\n", - value, range_min, range_max); - return 0; -} - - -/* Determine whether a value is within the specified range. If the value - * is not within the range 1 is returned. If the value is within the - * specified range an error is displayed and zero is returned. */ -static int integer_not_in_range_display_error( - const uintmax_t value, const uintmax_t range_min, - const uintmax_t range_max) { - if (value < range_min || value > range_max) { - return 1; - } - print_error("%" PRIuMAX " is within the range %" PRIuMAX "-%" PRIuMAX "\n", - value, range_min, range_max); - return 0; -} - - -/* Determine whether the specified strings are equal. If the strings are equal - * 1 is returned. If they're not equal an error is displayed and 0 is - * returned. */ -static int string_equal_display_error( - const char * const left, const char * const right) { - if (strcmp(left, right) == 0) { - return 1; - } - print_error("\"%s\" != \"%s\"\n", left, right); - return 0; -} - - -/* Determine whether the specified strings are equal. If the strings are not - * equal 1 is returned. If they're not equal an error is displayed and 0 is - * returned */ -static int string_not_equal_display_error( - const char * const left, const char * const right) { - if (strcmp(left, right) != 0) { - return 1; - } - print_error("\"%s\" == \"%s\"\n", left, right); - return 0; -} - - -/* Determine whether the specified areas of memory are equal. If they're equal - * 1 is returned otherwise an error is displayed and 0 is returned. */ -static int memory_equal_display_error(const char* const a, const char* const b, - const size_t size) { - int differences = 0; - size_t i; - for (i = 0; i < size; i++) { - const char l = a[i]; - const char r = b[i]; - if (l != r) { - print_error("difference at offset %" PRIuMAX " 0x%02x 0x%02x\n", - cast_to_largest_integral_type(i), l, r); - differences ++; - } - } - if (differences) { - print_error("%d bytes of 0x%08" PRIxMAX " and 0x%08" PRIxMAX " differ\n", - differences, - cast_ptr_to_largest_integral_type(a), - cast_ptr_to_largest_integral_type(b)); - return 0; - } - return 1; -} - - -/* Determine whether the specified areas of memory are not equal. If they're - * not equal 1 is returned otherwise an error is displayed and 0 is - * returned. */ -static int memory_not_equal_display_error( - const char* const a, const char* const b, const size_t size) { - size_t same = 0; - size_t i; - for (i = 0; i < size; i++) { - const char l = a[i]; - const char r = b[i]; - if (l == r) { - same ++; - } - } - if (same == size) { - print_error("%" PRIuMAX " bytes of 0x%08" PRIxMAX " and 0x%08" PRIxMAX" the same\n", - cast_to_largest_integral_type(same), - cast_ptr_to_largest_integral_type(a), - cast_ptr_to_largest_integral_type(b)); - return 0; - } - return 1; -} - - -// CheckParameterValue callback to check whether a value is within a set. -static int check_in_set(const uintmax_t value, - const uintmax_t check_value_data) { - return value_in_set_display_error(value, - cast_largest_integral_type_to_pointer(CheckIntegerSet*, - check_value_data), 0); -} - - -// CheckParameterValue callback to check whether a value isn't within a set. -static int check_not_in_set(const uintmax_t value, - const uintmax_t check_value_data) { - return value_in_set_display_error(value, - cast_largest_integral_type_to_pointer(CheckIntegerSet*, - check_value_data), 1); -} - - -/* Create the callback data for check_in_set() or check_not_in_set() and - * register a check event. */ -static void expect_set( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t values[], const size_t number_of_values, - const CheckParameterValue check_function, const int count) { - CheckIntegerSet * const check_integer_set = - (CheckIntegerSet*)malloc(sizeof(*check_integer_set) + - (sizeof(values[0]) * number_of_values)); - uintmax_t * const set = (uintmax_t*)( - check_integer_set + 1); - declare_initialize_value_pointer_pointer(check_data, check_integer_set); - assert_non_null(values); - assert_true(number_of_values); - memcpy(set, values, number_of_values * sizeof(values[0])); - check_integer_set->set = set; - _expect_check( - function, parameter, file, line, check_function, - check_data.value, &check_integer_set->event, count); -} - - -// Add an event to check whether a value is in a set. -void _expect_in_set( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t values[], const size_t number_of_values, - const int count) { - expect_set(function, parameter, file, line, values, number_of_values, - check_in_set, count); -} - - -// Add an event to check whether a value isn't in a set. -void _expect_not_in_set( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t values[], const size_t number_of_values, - const int count) { - expect_set(function, parameter, file, line, values, number_of_values, - check_not_in_set, count); -} - - -// CheckParameterValue callback to check whether a value is within a range. -static int check_in_range(const uintmax_t value, - const uintmax_t check_value_data) { - CheckIntegerRange * const check_integer_range = - cast_largest_integral_type_to_pointer(CheckIntegerRange*, - check_value_data); - assert_non_null(check_integer_range); - return integer_in_range_display_error(value, check_integer_range->minimum, - check_integer_range->maximum); -} - - -// CheckParameterValue callback to check whether a value is not within a range. -static int check_not_in_range(const uintmax_t value, - const uintmax_t check_value_data) { - CheckIntegerRange * const check_integer_range = - cast_largest_integral_type_to_pointer(CheckIntegerRange*, - check_value_data); - assert_non_null(check_integer_range); - return integer_not_in_range_display_error( - value, check_integer_range->minimum, check_integer_range->maximum); -} - - -/* Create the callback data for check_in_range() or check_not_in_range() and - * register a check event. */ -static void expect_range( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t minimum, const uintmax_t maximum, - const CheckParameterValue check_function, const int count) { - CheckIntegerRange * const check_integer_range = - (CheckIntegerRange*)malloc(sizeof(*check_integer_range)); - declare_initialize_value_pointer_pointer(check_data, check_integer_range); - check_integer_range->minimum = minimum; - check_integer_range->maximum = maximum; - _expect_check(function, parameter, file, line, check_function, - check_data.value, &check_integer_range->event, count); -} - - -// Add an event to determine whether a parameter is within a range. -void _expect_in_range( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t minimum, const uintmax_t maximum, - const int count) { - expect_range(function, parameter, file, line, minimum, maximum, - check_in_range, count); -} - - -// Add an event to determine whether a parameter is not within a range. -void _expect_not_in_range( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t minimum, const uintmax_t maximum, - const int count) { - expect_range(function, parameter, file, line, minimum, maximum, - check_not_in_range, count); -} - - -/* CheckParameterValue callback to check whether a value is equal to an - * expected value. */ -static int check_value(const uintmax_t value, - const uintmax_t check_value_data) { - return values_equal_display_error(value, check_value_data); -} - - -// Add an event to check a parameter equals an expected value. -void _expect_value( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t value, const int count) { - _expect_check(function, parameter, file, line, check_value, value, NULL, - count); -} - - -/* CheckParameterValue callback to check whether a value is not equal to an - * expected value. */ -static int check_not_value(const uintmax_t value, - const uintmax_t check_value_data) { - return values_not_equal_display_error(value, check_value_data); -} - - -// Add an event to check a parameter is not equal to an expected value. -void _expect_not_value( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t value, const int count) { - _expect_check(function, parameter, file, line, check_not_value, value, - NULL, count); -} - - -// CheckParameterValue callback to check whether a parameter equals a string. -static int check_string(const uintmax_t value, - const uintmax_t check_value_data) { - return string_equal_display_error( - cast_largest_integral_type_to_pointer(char*, value), - cast_largest_integral_type_to_pointer(char*, check_value_data)); -} - - -// Add an event to check whether a parameter is equal to a string. -void _expect_string( - const char* const function, const char* const parameter, - const char* const file, const int line, const char* string, - const int count) { - declare_initialize_value_pointer_pointer(string_pointer, (char*)string); - _expect_check(function, parameter, file, line, check_string, - string_pointer.value, NULL, count); -} - - -/* CheckParameterValue callback to check whether a parameter is not equals to - * a string. */ -static int check_not_string(const uintmax_t value, - const uintmax_t check_value_data) { - return string_not_equal_display_error( - cast_largest_integral_type_to_pointer(char*, value), - cast_largest_integral_type_to_pointer(char*, check_value_data)); -} - - -// Add an event to check whether a parameter is not equal to a string. -void _expect_not_string( - const char* const function, const char* const parameter, - const char* const file, const int line, const char* string, - const int count) { - declare_initialize_value_pointer_pointer(string_pointer, (char*)string); - _expect_check(function, parameter, file, line, check_not_string, - string_pointer.value, NULL, count); -} - -/* CheckParameterValue callback to check whether a parameter equals an area of - * memory. */ -static int check_memory(const uintmax_t value, - const uintmax_t check_value_data) { - CheckMemoryData * const check = cast_largest_integral_type_to_pointer( - CheckMemoryData*, check_value_data); - assert_non_null(check); - return memory_equal_display_error( - cast_largest_integral_type_to_pointer(const char*, value), - (const char*)check->memory, check->size); -} - - -/* Create the callback data for check_memory() or check_not_memory() and - * register a check event. */ -static void expect_memory_setup( - const char* const function, const char* const parameter, - const char* const file, const int line, - const void * const memory, const size_t size, - const CheckParameterValue check_function, const int count) { - CheckMemoryData * const check_data = - (CheckMemoryData*)malloc(sizeof(*check_data) + size); - void * const mem = (void*)(check_data + 1); - declare_initialize_value_pointer_pointer(check_data_pointer, check_data); - assert_non_null(memory); - assert_true(size); - memcpy(mem, memory, size); - check_data->memory = mem; - check_data->size = size; - _expect_check(function, parameter, file, line, check_function, - check_data_pointer.value, &check_data->event, count); -} - - -// Add an event to check whether a parameter matches an area of memory. -void _expect_memory( - const char* const function, const char* const parameter, - const char* const file, const int line, const void* const memory, - const size_t size, const int count) { - expect_memory_setup(function, parameter, file, line, memory, size, - check_memory, count); -} - - -/* CheckParameterValue callback to check whether a parameter is not equal to - * an area of memory. */ -static int check_not_memory(const uintmax_t value, - const uintmax_t check_value_data) { - CheckMemoryData * const check = cast_largest_integral_type_to_pointer( - CheckMemoryData*, check_value_data); - assert_non_null(check); - return memory_not_equal_display_error( - cast_largest_integral_type_to_pointer(const char*, value), - (const char*)check->memory, - check->size); -} - - -// Add an event to check whether a parameter doesn't match an area of memory. -void _expect_not_memory( - const char* const function, const char* const parameter, - const char* const file, const int line, const void* const memory, - const size_t size, const int count) { - expect_memory_setup(function, parameter, file, line, memory, size, - check_not_memory, count); -} - - -// CheckParameterValue callback that always returns 1. -static int check_any(const uintmax_t value, - const uintmax_t check_value_data) { - (void)value; - (void)check_value_data; - return 1; -} - - -// Add an event to allow any value for a parameter. -void _expect_any( - const char* const function, const char* const parameter, - const char* const file, const int line, const int count) { - _expect_check(function, parameter, file, line, check_any, 0, NULL, - count); -} - - -void _check_expected( - const char * const function_name, const char * const parameter_name, - const char* file, const int line, const uintmax_t value) { - void *result; - const char* symbols[] = {function_name, parameter_name}; - const int rc = get_symbol_value(&global_function_parameter_map_head, - symbols, 2, &result); - if (rc) { - CheckParameterEvent * const check = (CheckParameterEvent*)result; - int check_succeeded; - global_last_parameter_location = check->location; - check_succeeded = check->check_value(value, check->check_value_data); - if (rc == 1) { - free(check); - } - if (!check_succeeded) { - print_error("ERROR: Check of parameter %s, function %s failed\n" - "Expected parameter declared at " - SOURCE_LOCATION_FORMAT "\n", - parameter_name, function_name, - global_last_parameter_location.file, - global_last_parameter_location.line); - _fail(file, line); - } - } else { - print_error("ERROR: " SOURCE_LOCATION_FORMAT " - Could not get value " - "to check parameter %s of function %s\n", file, line, - parameter_name, function_name); - if (source_location_is_set(&global_last_parameter_location)) { - print_error("Previously declared parameter value was declared at " - SOURCE_LOCATION_FORMAT "\n", - global_last_parameter_location.file, - global_last_parameter_location.line); - } else { - print_error("There were no previously declared parameter values " - "for this test.\n"); - } - exit_test(1); - } -} - - -// Replacement for assert. -void mock_assert(const int result, const char* const expression, - const char* const file, const int line) { - if (!result) { - if (global_expecting_assert) { - longjmp(global_expect_assert_env, (int)expression); - } else { - print_error("ASSERT: %s\n", expression); - _fail(file, line); - } - } -} - - -void _assert_true(const uintmax_t result, - const char * const expression, - const char * const file, const int line) { - if (!result) { - print_error("%s\n", expression); - _fail(file, line); - } -} - -void _assert_int_equal( - const uintmax_t a, const uintmax_t b, - const char * const file, const int line) { - if (!values_equal_display_error(a, b)) { - _fail(file, line); - } -} - - -void _assert_int_not_equal( - const uintmax_t a, const uintmax_t b, - const char * const file, const int line) { - if (!values_not_equal_display_error(a, b)) { - _fail(file, line); - } -} - - -void _assert_string_equal(const char * const a, const char * const b, - const char * const file, const int line) { - if (!string_equal_display_error(a, b)) { - _fail(file, line); - } -} - - -void _assert_string_not_equal(const char * const a, const char * const b, - const char *file, const int line) { - if (!string_not_equal_display_error(a, b)) { - _fail(file, line); - } -} - - -void _assert_memory_equal(const void * const a, const void * const b, - const size_t size, const char* const file, - const int line) { - if (!memory_equal_display_error((const char*)a, (const char*)b, size)) { - _fail(file, line); - } -} - - -void _assert_memory_not_equal(const void * const a, const void * const b, - const size_t size, const char* const file, - const int line) { - if (!memory_not_equal_display_error((const char*)a, (const char*)b, - size)) { - _fail(file, line); - } -} - - -void _assert_in_range( - const uintmax_t value, const uintmax_t minimum, - const uintmax_t maximum, const char* const file, - const int line) { - if (!integer_in_range_display_error(value, minimum, maximum)) { - _fail(file, line); - } -} - -void _assert_not_in_range( - const uintmax_t value, const uintmax_t minimum, - const uintmax_t maximum, const char* const file, - const int line) { - if (!integer_not_in_range_display_error(value, minimum, maximum)) { - _fail(file, line); - } -} - -void _assert_in_set(const uintmax_t value, - const uintmax_t values[], - const size_t number_of_values, const char* const file, - const int line) { - CheckIntegerSet check_integer_set; - check_integer_set.set = values; - check_integer_set.size_of_set = number_of_values; - if (!value_in_set_display_error(value, &check_integer_set, 0)) { - _fail(file, line); - } -} - -void _assert_not_in_set(const uintmax_t value, - const uintmax_t values[], - const size_t number_of_values, const char* const file, - const int line) { - CheckIntegerSet check_integer_set; - check_integer_set.set = values; - check_integer_set.size_of_set = number_of_values; - if (!value_in_set_display_error(value, &check_integer_set, 1)) { - _fail(file, line); - } -} - - -// Get the list of allocated blocks. -static ListNode* get_allocated_blocks_list() { - // If it initialized, initialize the list of allocated blocks. - if (!global_allocated_blocks.value) { - list_initialize(&global_allocated_blocks); - global_allocated_blocks.value = (void*)1; - } - return &global_allocated_blocks; -} - -// Use the real malloc in this function. -#undef malloc -void* _test_malloc(const size_t size, const char* file, const int line) { - char* ptr; - MallocBlockInfo *block_info; - ListNode * const block_list = get_allocated_blocks_list(); - const size_t allocate_size = size + (MALLOC_GUARD_SIZE * 2) + - sizeof(*block_info) + MALLOC_ALIGNMENT; - char* const block = (char*)malloc(allocate_size); - assert_non_null(block); - - // Calculate the returned address. - ptr = (char*)(((size_t)block + MALLOC_GUARD_SIZE + sizeof(*block_info) + - MALLOC_ALIGNMENT) & ~(MALLOC_ALIGNMENT - 1)); - - // Initialize the guard blocks. - memset(ptr - MALLOC_GUARD_SIZE, MALLOC_GUARD_PATTERN, MALLOC_GUARD_SIZE); - memset(ptr + size, MALLOC_GUARD_PATTERN, MALLOC_GUARD_SIZE); - memset(ptr, MALLOC_ALLOC_PATTERN, size); - - block_info = (MallocBlockInfo*)(ptr - (MALLOC_GUARD_SIZE + - sizeof(*block_info))); - set_source_location(&block_info->location, file, line); - block_info->allocated_size = allocate_size; - block_info->size = size; - block_info->block = block; - block_info->node.value = block_info; - list_add(block_list, &block_info->node); - return ptr; -} -#define malloc test_malloc - - -void* _test_calloc(const size_t number_of_elements, const size_t size, - const char* file, const int line) { - void* const ptr = _test_malloc(number_of_elements * size, file, line); - if (ptr) { - memset(ptr, 0, number_of_elements * size); - } - return ptr; -} - - -// Use the real free in this function. -#undef free -void _test_free(void* const ptr, const char* file, const int line) { - unsigned int i; - char *block = (char*)ptr; - MallocBlockInfo *block_info; - _assert_true(cast_ptr_to_largest_integral_type(ptr), "ptr", file, line); - block_info = (MallocBlockInfo*)(block - (MALLOC_GUARD_SIZE + - sizeof(*block_info))); - // Check the guard blocks. - { - char *guards[2] = {block - MALLOC_GUARD_SIZE, - block + block_info->size}; - for (i = 0; i < ARRAY_LENGTH(guards); i++) { - unsigned int j; - char * const guard = guards[i]; - for (j = 0; j < MALLOC_GUARD_SIZE; j++) { - const char diff = guard[j] - MALLOC_GUARD_PATTERN; - if (diff) { - print_error( - "Guard block of 0x%08" PRIxMAX " size=%" PRIuMAX " allocated by " - SOURCE_LOCATION_FORMAT " at 0x%08" PRIxMAX " is corrupt\n", - cast_ptr_to_largest_integral_type(ptr), - cast_to_largest_integral_type(block_info->size), - block_info->location.file, block_info->location.line, - cast_ptr_to_largest_integral_type(&guard[j])); - _fail(file, line); - } - } - } - } - list_remove(&block_info->node, NULL, NULL); - - block = (char*)block_info->block; - memset(block, MALLOC_FREE_PATTERN, block_info->allocated_size); - free(block); -} -#define free test_free - - -// Crudely checkpoint the current heap state. -static const ListNode* check_point_allocated_blocks() { - return get_allocated_blocks_list()->prev; -} - - -/* Display the blocks allocated after the specified check point. This - * function returns the number of blocks displayed. */ -static int display_allocated_blocks(const ListNode * const check_point) { - const ListNode * const head = get_allocated_blocks_list(); - const ListNode *node; - int allocated_blocks = 0; - assert_non_null(check_point); - assert_non_null(check_point->next); - - for (node = check_point->next; node != head; node = node->next) { - const MallocBlockInfo * const block_info = - (const MallocBlockInfo*)node->value; - assert_non_null(block_info); - - if (!allocated_blocks) { - print_error("Blocks allocated...\n"); - } - print_error(" 0x%08" PRIxMAX " : " SOURCE_LOCATION_FORMAT "\n", - cast_ptr_to_largest_integral_type(block_info->block), - block_info->location.file, - block_info->location.line); - allocated_blocks ++; - } - return allocated_blocks; -} - - -// Free all blocks allocated after the specified check point. -static void free_allocated_blocks(const ListNode * const check_point) { - const ListNode * const head = get_allocated_blocks_list(); - const ListNode *node; - assert_non_null(check_point); - - node = check_point->next; - assert_non_null(node); - - while (node != head) { - MallocBlockInfo * const block_info = (MallocBlockInfo*)node->value; - node = node->next; - free((char*)block_info + sizeof(*block_info) + MALLOC_GUARD_SIZE); - } -} - - -// Fail if any any blocks are allocated after the specified check point. -static void fail_if_blocks_allocated(const ListNode * const check_point, - const char * const test_name) { - const int allocated_blocks = display_allocated_blocks(check_point); - if (allocated_blocks) { - free_allocated_blocks(check_point); - print_error("ERROR: %s leaked %d block(s)\n", test_name, - allocated_blocks); - exit_test(1); - } -} - - -void _fail(const char * const file, const int line) { - print_error("ERROR: " SOURCE_LOCATION_FORMAT " Failure!\n", file, line); - exit_test(1); -} - - -#ifndef _WIN32 -static void exception_handler(int sig) { -#ifdef _HPUX - print_error("%d\n", sig); -#else - print_error("%s\n", strsignal(sig)); -#endif - exit_test(1); -} - -#else // _WIN32 - -static LONG WINAPI exception_filter(EXCEPTION_POINTERS *exception_pointers) { - EXCEPTION_RECORD * const exception_record = - exception_pointers->ExceptionRecord; - const DWORD code = exception_record->ExceptionCode; - unsigned int i; - for (i = 0; i < ARRAY_LENGTH(exception_codes); i++) { - const ExceptionCodeInfo * const code_info = &exception_codes[i]; - if (code == code_info->code) { - static int shown_debug_message = 0; - fflush(stdout); - print_error("%s occurred at 0x%08" PRIxMAX ".\n", code_info->description, - cast_to_largest_integral_type(exception_record->ExceptionAddress)); - if (!shown_debug_message) { - print_error( - "\n" - "To debug in Visual Studio...\n" - "1. Select menu item File->Open Project\n" - "2. Change 'Files of type' to 'Executable Files'\n" - "3. Open this executable.\n" - "4. Select menu item Debug->Start\n" - "\n" - "Alternatively, set the environment variable \n" - "UNIT_TESTING_DEBUG to 1 and rebuild this executable, \n" - "then click 'Debug' in the popup dialog box.\n" - "\n"); - shown_debug_message = 1; - } - exit_test(0); - return EXCEPTION_EXECUTE_HANDLER; - } - } - return EXCEPTION_CONTINUE_SEARCH; -} -#endif // !_WIN32 - - -// Standard output and error print methods. -void vprint_message(const char* const format, va_list args) { - char buffer[1024]; - vsnprintf(buffer, sizeof(buffer), format, args); - printf("%s", buffer); - fflush(stdout); -#ifdef _WIN32 - OutputDebugString(buffer); -#endif // _WIN32 -} - - -void vprint_error(const char* const format, va_list args) { - char buffer[1024]; - vsnprintf(buffer, sizeof(buffer), format, args); - fprintf(stderr, "%s", buffer); - fflush(stderr); -#ifdef _WIN32 - OutputDebugString(buffer); -#endif // _WIN32 -} - - -void print_message(const char* const format, ...) { - va_list args; - va_start(args, format); - vprint_message(format, args); - va_end(args); -} - - -void print_error(const char* const format, ...) { - va_list args; - va_start(args, format); - vprint_error(format, args); - va_end(args); -} - - -int _run_test( - const char * const function_name, const UnitTestFunction Function, - void ** const volatile state, const UnitTestFunctionType function_type, - const void* const heap_check_point) { - const ListNode * const volatile check_point = (const ListNode*) - (heap_check_point ? - heap_check_point : check_point_allocated_blocks()); - void *current_state = NULL; - volatile int rc = 1; - int handle_exceptions = 1; -#ifdef _WIN32 - handle_exceptions = !IsDebuggerPresent(); -#endif // _WIN32 -#if UNIT_TESTING_DEBUG - handle_exceptions = 0; -#endif // UNIT_TESTING_DEBUG - - if (handle_exceptions) { -#ifndef _WIN32 - unsigned int i; - for (i = 0; i < ARRAY_LENGTH(exception_signals); i++) { - default_signal_functions[i] = signal( - exception_signals[i], exception_handler); - } -#else // _WIN32 - previous_exception_filter = SetUnhandledExceptionFilter( - exception_filter); -#endif // !_WIN32 - } - - if (function_type == UNIT_TEST_FUNCTION_TYPE_TEST) { - print_message("[ RUN ] %s\n", function_name); - } - initialize_testing(function_name); - global_running_test = 1; - if (setjmp(global_run_test_env) == 0) { - Function(state ? state : &current_state); - fail_if_leftover_values(function_name); - - /* If this is a setup function then ignore any allocated blocks - * only ensure they're deallocated on tear down. */ - if (function_type != UNIT_TEST_FUNCTION_TYPE_SETUP) { - fail_if_blocks_allocated(check_point, function_name); - } - - global_running_test = 0; - - if (function_type == UNIT_TEST_FUNCTION_TYPE_TEST) { - print_message("[ OK ] %s\n", function_name); - } - rc = 0; - } else { - global_running_test = 0; - print_message("[ FAILED ] %s\n", function_name); - } - teardown_testing(function_name); - - if (handle_exceptions) { -#ifndef _WIN32 - unsigned int i; - for (i = 0; i < ARRAY_LENGTH(exception_signals); i++) { - signal(exception_signals[i], default_signal_functions[i]); - } -#else // _WIN32 - if (previous_exception_filter) { - SetUnhandledExceptionFilter(previous_exception_filter); - previous_exception_filter = NULL; - } -#endif // !_WIN32 - } - - return rc; -} - - -int _run_tests(const UnitTest * const tests, const size_t number_of_tests) { - // Whether to execute the next test. - int run_next_test = 1; - // Whether the previous test failed. - int previous_test_failed = 0; - // Check point of the heap state. - const ListNode * const check_point = check_point_allocated_blocks(); - // Current test being executed. - size_t current_test = 0; - // Number of tests executed. - size_t tests_executed = 0; - // Number of failed tests. - size_t total_failed = 0; - // Number of setup functions. - size_t setups = 0; - // Number of teardown functions. - size_t teardowns = 0; - /* A stack of test states. A state is pushed on the stack - * when a test setup occurs and popped on tear down. */ - TestState* test_states = - (TestState*)malloc(number_of_tests * sizeof(*test_states)); - size_t number_of_test_states = 0; - // Names of the tests that failed. - const char** failed_names = (const char**)malloc(number_of_tests * - sizeof(*failed_names)); - void **current_state = NULL; - - print_message("[==========] Running %d test(s).\n", number_of_tests); - - // Make sure uintmax_t is at least the size of a pointer. - assert_true(sizeof(uintmax_t) >= sizeof(void*)); - - while (current_test < number_of_tests) { - const ListNode *test_check_point = NULL; - TestState *current_TestState; - const UnitTest * const test = &tests[current_test++]; - if (!test->function) { - continue; - } - - switch (test->function_type) { - case UNIT_TEST_FUNCTION_TYPE_TEST: - run_next_test = 1; - break; - case UNIT_TEST_FUNCTION_TYPE_SETUP: { - // Checkpoint the heap before the setup. - current_TestState = &test_states[number_of_test_states++]; - current_TestState->check_point = check_point_allocated_blocks(); - test_check_point = current_TestState->check_point; - current_state = &current_TestState->state; - *current_state = NULL; - run_next_test = 1; - setups ++; - break; - } - case UNIT_TEST_FUNCTION_TYPE_TEARDOWN: - // Check the heap based on the last setup checkpoint. - assert_true(number_of_test_states); - current_TestState = &test_states[--number_of_test_states]; - test_check_point = current_TestState->check_point; - current_state = &current_TestState->state; - teardowns ++; - break; - default: - print_error("Invalid unit test function type %d\n", - test->function_type); - exit_test(1); - break; - } - - if (run_next_test) { - int failed = _run_test(test->name, test->function, current_state, - test->function_type, test_check_point); - if (failed) { - failed_names[total_failed] = test->name; - } - - switch (test->function_type) { - case UNIT_TEST_FUNCTION_TYPE_TEST: - previous_test_failed = failed; - total_failed += failed; - tests_executed ++; - break; - - case UNIT_TEST_FUNCTION_TYPE_SETUP: - if (failed) { - total_failed ++; - tests_executed ++; - // Skip forward until the next test or setup function. - run_next_test = 0; - } - previous_test_failed = 0; - break; - - case UNIT_TEST_FUNCTION_TYPE_TEARDOWN: - // If this test failed. - if (failed && !previous_test_failed) { - total_failed ++; - } - break; - default: -#ifndef _HPUX - assert_null("BUG: shouldn't be here!"); -#endif - break; - } - } - } - - print_message("[==========] %d test(s) run.\n", tests_executed); - print_error("[ PASSED ] %d test(s).\n", tests_executed - total_failed); - - if (total_failed) { - size_t i; - print_error("[ FAILED ] %d test(s), listed below:\n", total_failed); - for (i = 0; i < total_failed; i++) { - print_error("[ FAILED ] %s\n", failed_names[i]); - } - } else { - print_error("\n %d FAILED TEST(S)\n", total_failed); - } - - if (number_of_test_states) { - print_error("[ ERROR ] Mismatched number of setup %d and " - "teardown %d functions\n", setups, teardowns); - total_failed = (size_t)-1; - } - - free(test_states); - free((void*)failed_names); - - fail_if_blocks_allocated(check_point, "run_tests"); - return (int)total_failed; -} diff --git a/libs/libzrtp/test/cmockery/cmockery.h b/libs/libzrtp/test/cmockery/cmockery.h deleted file mode 100644 index 6810f5b8ff..0000000000 --- a/libs/libzrtp/test/cmockery/cmockery.h +++ /dev/null @@ -1,565 +0,0 @@ -/* - * Copyright 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef CMOCKERY_H_ -#define CMOCKERY_H_ -#ifdef _WIN32 -#if _MSC_VER < 1500 -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus -int __stdcall IsDebuggerPresent(); -#ifdef __cplusplus -} /* extern "C" */ -#endif // __cplusplus -#endif // _MSC_VER < 1500 -#endif // _WIN32 -/* - * These headers or their equivalents should be included prior to including - * this header file. - * - * #include <stdarg.h> - * #include <stddef.h> - * #include <setjmp.h> - * #include <inttypes.h> - * - * This allows test applications to use custom definitions of C standard - * library functions and types. - */ - -// For those who are used to __func__ from gcc. -#ifndef __func__ -#define __func__ __FUNCTION__ -#endif - -/* Largest integral type. This type should be large enough to hold any - * pointer or integer supported by the compiler. */ -#ifndef _UINTMAX_T -#define _UINTMAX_T -typedef unsigned long long uintmax_t; -#endif /* _UINTMAX_T */ - -/* Printf formats used to display uintmax_t. */ -#ifdef _WIN32 - -#ifndef PRIdMAX -#define PRIdMAX "I64d" -#endif /* PRIdMAX */ -#ifndef PRIiMAX -#define PRIiMAX "I64i" -#endif /* PRIiMAX */ -#ifndef PRIoMAX -#define PRIoMAX "I64o" -#endif /* PRIoMAX */ -#ifndef PRIuMAX -#define PRIuMAX "I64u" -#endif /* PRIuMAX */ -#ifndef PRIxMAX -#define PRIxMAX "I64x" -#endif /* PRIxMAX */ -#ifndef PRIXMAX -#define PRIXMAX "I64X" -#endif /* PRIXMAX */ - -#else /* _WIN32 */ - -#ifndef PRIdMAX -#define PRIdMAX "lld" -#endif /* PRIdMAX */ -#ifndef PRIiMAX -#define PRIiMAX "lli" -#endif /* PRIiMAX */ -#ifndef PRIoMAX -#define PRIoMAX "llo" -#endif /* PRIoMAX */ -#ifndef PRIuMAX -#define PRIuMAX "llu" -#endif /* PRIuMAX */ -#ifndef PRIxMAX -#define PRIxMAX "llx" -#endif /* PRIxMAX */ -#ifndef PRIXMAX -#define PRIXMAX "llX" -#endif /* PRIXMAX */ - -#endif /* _WIN32 */ - -// Perform an unsigned cast to uintmax_t. -#define cast_to_largest_integral_type(value) \ - ((uintmax_t)(value)) - -/* Smallest integral type capable of holding a pointer. */ -#ifndef _UINTPTR_T -#define _UINTPTR_T -#ifdef _WIN32 - -/* WIN32 is an ILP32 platform */ -typedef unsigned long uintptr_t; - -#else /* _WIN32 */ - -/* what about 64-bit windows? - * what's the right preprocessor symbol? -typedef unsigned long long uintptr_t */ - -#endif /* _WIN32 */ -#endif /* _UINTPTR_T */ - -/* Perform an unsigned cast to uintptr_t. */ -#define cast_to_pointer_integral_type(value) \ - ((uintptr_t)(value)) - -/* Perform a cast of a pointer to uintmax_t */ -#define cast_ptr_to_largest_integral_type(value) \ -cast_to_largest_integral_type(cast_to_pointer_integral_type(value)) - -// Retrieves a return value for the current function. -#define mock() _mock(__func__, __FILE__, __LINE__) - -/* Stores a value to be returned by the specified function later. - * The count parameter returns the number of times the value should be returned - * by mock(). If count is set to -1 the value will always be returned. - */ -#define will_return(function, value) \ - _will_return(#function, __FILE__, __LINE__, \ - cast_to_largest_integral_type(value), 1) -#define will_return_count(function, value, count) \ - _will_return(#function, __FILE__, __LINE__, \ - cast_to_largest_integral_type(value), count) - -/* Add a custom parameter checking function. If the event parameter is NULL - * the event structure is allocated internally by this function. If event - * parameter is provided it must be allocated on the heap and doesn't need to - * be deallocated by the caller. - */ -#define expect_check(function, parameter, check_function, check_data) \ - _expect_check(#function, #parameter, __FILE__, __LINE__, check_function, \ - cast_to_largest_integral_type(check_data), NULL, 0) - -/* Add an event to check a parameter, using check_expected(), against a set of - * values. See will_return() for a description of the count parameter. - */ -#define expect_in_set(function, parameter, value_array) \ - expect_in_set_count(function, parameter, value_array, 1) -#define expect_in_set_count(function, parameter, value_array, count) \ - _expect_in_set(#function, #parameter, __FILE__, __LINE__, value_array, \ - sizeof(value_array) / sizeof((value_array)[0]), count) -#define expect_not_in_set(function, parameter, value_array) \ - expect_not_in_set_count(function, parameter, value_array, 1) -#define expect_not_in_set_count(function, parameter, value_array, count) \ - _expect_not_in_set( \ - #function, #parameter, __FILE__, __LINE__, value_array, \ - sizeof(value_array) / sizeof((value_array)[0]), count) - - -/* Add an event to check a parameter, using check_expected(), against a - * signed range. Where range is minimum <= value <= maximum. - * See will_return() for a description of the count parameter. - */ -#define expect_in_range(function, parameter, minimum, maximum) \ - expect_in_range_count(function, parameter, minimum, maximum, 1) -#define expect_in_range_count(function, parameter, minimum, maximum, count) \ - _expect_in_range(#function, #parameter, __FILE__, __LINE__, minimum, \ - maximum, count) - -/* Add an event to check a parameter, using check_expected(), against a - * signed range. Where range is value < minimum or value > maximum. - * See will_return() for a description of the count parameter. - */ -#define expect_not_in_range(function, parameter, minimum, maximum) \ - expect_not_in_range_count(function, parameter, minimum, maximum, 1) -#define expect_not_in_range_count(function, parameter, minimum, maximum, \ - count) \ - _expect_not_in_range(#function, #parameter, __FILE__, __LINE__, \ - minimum, maximum, count) - -/* Add an event to check whether a parameter, using check_expected(), is or - * isn't a value. See will_return() for a description of the count parameter. - */ -#define expect_value(function, parameter, value) \ - expect_value_count(function, parameter, value, 1) -#define expect_value_count(function, parameter, value, count) \ - _expect_value(#function, #parameter, __FILE__, __LINE__, \ - cast_to_largest_integral_type(value), count) -#define expect_not_value(function, parameter, value) \ - expect_not_value_count(function, parameter, value, 1) -#define expect_not_value_count(function, parameter, value, count) \ - _expect_not_value(#function, #parameter, __FILE__, __LINE__, \ - cast_to_largest_integral_type(value), count) - -/* Add an event to check whether a parameter, using check_expected(), - * is or isn't a string. See will_return() for a description of the count - * parameter. - */ -#define expect_string(function, parameter, string) \ - expect_string_count(function, parameter, string, 1) -#define expect_string_count(function, parameter, string, count) \ - _expect_string(#function, #parameter, __FILE__, __LINE__, \ - (const char*)(string), count) -#define expect_not_string(function, parameter, string) \ - expect_not_string_count(function, parameter, string, 1) -#define expect_not_string_count(function, parameter, string, count) \ - _expect_not_string(#function, #parameter, __FILE__, __LINE__, \ - (const char*)(string), count) - -/* Add an event to check whether a parameter, using check_expected() does or - * doesn't match an area of memory. See will_return() for a description of - * the count parameter. - */ -#define expect_memory(function, parameter, memory, size) \ - expect_memory_count(function, parameter, memory, size, 1) -#define expect_memory_count(function, parameter, memory, size, count) \ - _expect_memory(#function, #parameter, __FILE__, __LINE__, \ - (const void*)(memory), size, count) -#define expect_not_memory(function, parameter, memory, size) \ - expect_not_memory_count(function, parameter, memory, size, 1) -#define expect_not_memory_count(function, parameter, memory, size, count) \ - _expect_not_memory(#function, #parameter, __FILE__, __LINE__, \ - (const void*)(memory), size, count) - - -/* Add an event to allow any value for a parameter checked using - * check_expected(). See will_return() for a description of the count - * parameter. - */ -#define expect_any(function, parameter) \ - expect_any_count(function, parameter, 1) -#define expect_any_count(function, parameter, count) \ - _expect_any(#function, #parameter, __FILE__, __LINE__, count) - -/* Determine whether a function parameter is correct. This ensures the next - * value queued by one of the expect_*() macros matches the specified variable. - */ -#define check_expected(parameter) \ - _check_expected(__func__, #parameter, __FILE__, __LINE__, \ - cast_to_largest_integral_type(parameter)) - -// Assert that the given expression is true. -#define assert_true(c) _assert_true(cast_to_largest_integral_type(c), #c, \ - __FILE__, __LINE__) -// Assert that the given expression is false. -#define assert_false(c) _assert_true(!(cast_to_largest_integral_type(c)), #c, \ - __FILE__, __LINE__) - -// Assert that the given pointer is non-NULL. -#define assert_non_null(c) _assert_true(cast_ptr_to_largest_integral_type(c), #c, \ -__FILE__, __LINE__) -// Assert that the given pointer is NULL. -#define assert_null(c) _assert_true(!(cast_ptr_to_largest_integral_type(c)), #c, \ -__FILE__, __LINE__) - -// Assert that the two given integers are equal, otherwise fail. -#define assert_int_equal(a, b) \ - _assert_int_equal(cast_to_largest_integral_type(a), \ - cast_to_largest_integral_type(b), \ - __FILE__, __LINE__) -// Assert that the two given integers are not equal, otherwise fail. -#define assert_int_not_equal(a, b) \ - _assert_int_not_equal(cast_to_largest_integral_type(a), \ - cast_to_largest_integral_type(b), \ - __FILE__, __LINE__) - -// Assert that the two given strings are equal, otherwise fail. -#define assert_string_equal(a, b) \ - _assert_string_equal((const char*)(a), (const char*)(b), __FILE__, \ - __LINE__) -// Assert that the two given strings are not equal, otherwise fail. -#define assert_string_not_equal(a, b) \ - _assert_string_not_equal((const char*)(a), (const char*)(b), __FILE__, \ - __LINE__) - -// Assert that the two given areas of memory are equal, otherwise fail. -#define assert_memory_equal(a, b, size) \ - _assert_memory_equal((const char*)(a), (const char*)(b), size, __FILE__, \ - __LINE__) -// Assert that the two given areas of memory are not equal, otherwise fail. -#define assert_memory_not_equal(a, b, size) \ - _assert_memory_not_equal((const char*)(a), (const char*)(b), size, \ - __FILE__, __LINE__) - -// Assert that the specified value is >= minimum and <= maximum. -#define assert_in_range(value, minimum, maximum) \ - _assert_in_range( \ - cast_to_largest_integral_type(value), \ - cast_to_largest_integral_type(minimum), \ - cast_to_largest_integral_type(maximum), __FILE__, __LINE__) - -// Assert that the specified value is < minumum or > maximum -#define assert_not_in_range(value, minimum, maximum) \ - _assert_not_in_range( \ - cast_to_largest_integral_type(value), \ - cast_to_largest_integral_type(minimum), \ - cast_to_largest_integral_type(maximum), __FILE__, __LINE__) - -// Assert that the specified value is within a set. -#define assert_in_set(value, values, number_of_values) \ - _assert_in_set(value, values, number_of_values, __FILE__, __LINE__) -// Assert that the specified value is not within a set. -#define assert_not_in_set(value, values, number_of_values) \ - _assert_not_in_set(value, values, number_of_values, __FILE__, __LINE__) - - -// Forces the test to fail immediately and quit. -#define fail() _fail(__FILE__, __LINE__) - -// Generic method to kick off testing -#define run_test(f) _run_test(#f, f, NULL, UNIT_TEST_FUNCTION_TYPE_TEST, NULL) - -// Initializes a UnitTest structure. -#define unit_test(f) { #f, f, UNIT_TEST_FUNCTION_TYPE_TEST } -#define unit_test_setup(test, setup) \ - { #test "_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_SETUP } -#define unit_test_teardown(test, teardown) \ - { #test "_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_TEARDOWN } - -/* Initialize an array of UnitTest structures with a setup function for a test - * and a teardown function. Either setup or teardown can be NULL. - */ -#define unit_test_setup_teardown(test, setup, teardown) \ - unit_test_setup(test, setup), \ - unit_test(test), \ - unit_test_teardown(test, teardown) - -/* - * Run tests specified by an array of UnitTest structures. The following - * example illustrates this macro's use with the unit_test macro. - * - * void Test0(); - * void Test1(); - * - * int main(int argc, char* argv[]) { - * const UnitTest tests[] = { - * unit_test(Test0); - * unit_test(Test1); - * }; - * return run_tests(tests); - * } - */ -#define run_tests(tests) _run_tests(tests, sizeof(tests) / sizeof(tests)[0]) - -// Dynamic allocators -#define test_malloc(size) _test_malloc(size, __FILE__, __LINE__) -#define test_calloc(num, size) _test_calloc(num, size, __FILE__, __LINE__) -#define test_free(ptr) _test_free(ptr, __FILE__, __LINE__) - -// Redirect malloc, calloc and free to the unit test allocators. -#if UNIT_TESTING -#define malloc test_malloc -#define calloc test_calloc -#define free test_free -#endif // UNIT_TESTING - -/* - * Ensure mock_assert() is called. If mock_assert() is called the assert - * expression string is returned. - * For example: - * - * #define assert mock_assert - * - * void showmessage(const char *message) { - * assert(message); - * } - * - * int main(int argc, const char* argv[]) { - * expect_assert_failure(show_message(NULL)); - * printf("succeeded\n"); - * return 0; - * } - */ -#define expect_assert_failure(function_call) \ - { \ - const int expression = setjmp(global_expect_assert_env); \ - global_expecting_assert = 1; \ - if (expression) { \ - print_message("Expected assertion %s occurred\n", \ - *((const char**)&expression)); \ - global_expecting_assert = 0; \ - } else { \ - function_call ; \ - global_expecting_assert = 0; \ - print_error("Expected assert in %s\n", #function_call); \ - _fail(__FILE__, __LINE__); \ - } \ - } - -// Function prototype for setup, test and teardown functions. -typedef void (*UnitTestFunction)(void **state); - -// Function that determines whether a function parameter value is correct. -typedef int (*CheckParameterValue)(const uintmax_t value, - const uintmax_t check_value_data); - -// Type of the unit test function. -typedef enum UnitTestFunctionType { - UNIT_TEST_FUNCTION_TYPE_TEST = 0, - UNIT_TEST_FUNCTION_TYPE_SETUP, - UNIT_TEST_FUNCTION_TYPE_TEARDOWN, -} UnitTestFunctionType; - -/* Stores a unit test function with its name and type. - * NOTE: Every setup function must be paired with a teardown function. It's - * possible to specify NULL function pointers. - */ -typedef struct UnitTest { - const char* name; - UnitTestFunction function; - UnitTestFunctionType function_type; -} UnitTest; - - -// Location within some source code. -typedef struct SourceLocation { - const char* file; - int line; -} SourceLocation; - -// Event that's called to check a parameter value. -typedef struct CheckParameterEvent { - SourceLocation location; - const char *parameter_name; - CheckParameterValue check_value; - uintmax_t check_value_data; -} CheckParameterEvent; - -// Used by expect_assert_failure() and mock_assert(). -extern int global_expecting_assert; -extern jmp_buf global_expect_assert_env; - -// Retrieves a value for the given function, as set by "will_return". -uintmax_t _mock(const char * const function, const char* const file, - const int line); - -void _expect_check( - const char* const function, const char* const parameter, - const char* const file, const int line, - const CheckParameterValue check_function, - const uintmax_t check_data, CheckParameterEvent * const event, - const int count); - -void _expect_in_set( - const char* const function, const char* const parameter, - const char* const file, const int line, const uintmax_t values[], - const size_t number_of_values, const int count); -void _expect_not_in_set( - const char* const function, const char* const parameter, - const char* const file, const int line, const uintmax_t values[], - const size_t number_of_values, const int count); - -void _expect_in_range( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t minimum, - const uintmax_t maximum, const int count); -void _expect_not_in_range( - const char* const function, const char* const parameter, - const char* const file, const int line, - const uintmax_t minimum, - const uintmax_t maximum, const int count); - -void _expect_value( - const char* const function, const char* const parameter, - const char* const file, const int line, const uintmax_t value, - const int count); -void _expect_not_value( - const char* const function, const char* const parameter, - const char* const file, const int line, const uintmax_t value, - const int count); - -void _expect_string( - const char* const function, const char* const parameter, - const char* const file, const int line, const char* string, - const int count); -void _expect_not_string( - const char* const function, const char* const parameter, - const char* const file, const int line, const char* string, - const int count); - -void _expect_memory( - const char* const function, const char* const parameter, - const char* const file, const int line, const void* const memory, - const size_t size, const int count); -void _expect_not_memory( - const char* const function, const char* const parameter, - const char* const file, const int line, const void* const memory, - const size_t size, const int count); - -void _expect_any( - const char* const function, const char* const parameter, - const char* const file, const int line, const int count); - -void _check_expected( - const char * const function_name, const char * const parameter_name, - const char* file, const int line, const uintmax_t value); - -// Can be used to replace assert in tested code so that in conjuction with -// check_assert() it's possible to determine whether an assert condition has -// failed without stopping a test. -void mock_assert(const int result, const char* const expression, - const char * const file, const int line); - -void _will_return(const char * const function_name, const char * const file, - const int line, const uintmax_t value, - const int count); -void _assert_true(const uintmax_t result, - const char* const expression, - const char * const file, const int line); -void _assert_int_equal( - const uintmax_t a, const uintmax_t b, - const char * const file, const int line); -void _assert_int_not_equal( - const uintmax_t a, const uintmax_t b, - const char * const file, const int line); -void _assert_string_equal(const char * const a, const char * const b, - const char * const file, const int line); -void _assert_string_not_equal(const char * const a, const char * const b, - const char *file, const int line); -void _assert_memory_equal(const void * const a, const void * const b, - const size_t size, const char* const file, - const int line); -void _assert_memory_not_equal(const void * const a, const void * const b, - const size_t size, const char* const file, - const int line); -void _assert_in_range( - const uintmax_t value, const uintmax_t minimum, - const uintmax_t maximum, const char* const file, const int line); -void _assert_not_in_range( - const uintmax_t value, const uintmax_t minimum, - const uintmax_t maximum, const char* const file, const int line); -void _assert_in_set( - const uintmax_t value, const uintmax_t values[], - const size_t number_of_values, const char* const file, const int line); -void _assert_not_in_set( - const uintmax_t value, const uintmax_t values[], - const size_t number_of_values, const char* const file, const int line); - -void* _test_malloc(const size_t size, const char* file, const int line); -void* _test_calloc(const size_t number_of_elements, const size_t size, - const char* file, const int line); -void _test_free(void* const ptr, const char* file, const int line); - -void _fail(const char * const file, const int line); -int _run_test( - const char * const function_name, const UnitTestFunction Function, - void ** const volatile state, const UnitTestFunctionType function_type, - const void* const heap_check_point); -int _run_tests(const UnitTest * const tests, const size_t number_of_tests); - -// Standard output and error print methods. -void print_message(const char* const format, ...); -void print_error(const char* const format, ...); -void vprint_message(const char* const format, va_list args); -void vprint_error(const char* const format, va_list args); - -#endif // CMOCKERY_H_ diff --git a/libs/libzrtp/test/dh_test.c b/libs/libzrtp/test/dh_test.c deleted file mode 100644 index 0047bb53db..0000000000 --- a/libs/libzrtp/test/dh_test.c +++ /dev/null @@ -1,52 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> -#include <stdio.h> - -#include "zrtp.h" -#include "cmockery/cmockery.h" - -zrtp_global_t *zrtp; - -void setup() { - zrtp_status_t s; - zrtp_config_t zrtp_config; - - zrtp_config_defaults(&zrtp_config); - - s = zrtp_init(&zrtp_config, &zrtp); - assert_int_equal(s, zrtp_status_ok); -} - -void teardown() { - zrtp_down(zrtp); -} - -static void dh2k_test() { - zrtp_pk_scheme_t *pks = zrtp_comp_find(ZRTP_CC_PKT, ZRTP_PKTYPE_DH2048, zrtp); - assert_non_null(pks); - pks->self_test(pks); -} - -static void dh3k_test() { - zrtp_pk_scheme_t *pks = zrtp_comp_find(ZRTP_CC_PKT, ZRTP_PKTYPE_DH3072, zrtp); - assert_non_null(pks); - pks->self_test(pks); -} - - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(dh2k_test, setup, teardown), - unit_test_setup_teardown(dh3k_test, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/dk_test.c b/libs/libzrtp/test/dk_test.c deleted file mode 100644 index 81fa60673b..0000000000 --- a/libs/libzrtp/test/dk_test.c +++ /dev/null @@ -1,140 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> -#include <stdio.h> - -#include "zrtp.h" -#include "cmockery/cmockery.h" - -zrtp_global_t *zrtp; - -extern zrtp_dk_ctx *zrtp_dk_init(zrtp_cipher_t *cipher, zrtp_stringn_t *key, zrtp_stringn_t *salt); -extern zrtp_status_t zrtp_derive_key(zrtp_dk_ctx *ctx, zrtp_srtp_prf_label label, zrtp_stringn_t *result_key); -extern void zrtp_dk_deinit(zrtp_dk_ctx *ctx); - -static uint8_t dk_master_key[16] = { - 0xE1, 0xF9, 0x7A, 0x0D, 0x3E, 0x01, 0x8B, 0xE0, - 0xD6, 0x4F, 0xA3, 0x2C, 0x06, 0xDE, 0x41, 0x39 -}; - -static uint8_t dk_master_salt[14] = { - 0x0E, 0xC6, 0x75, 0xAD, 0x49, 0x8A, 0xFE, 0xEB, - 0xB6, 0x96, 0x0B, 0x3A, 0xAB, 0xE6 -}; - - -static uint8_t dk_cipher_key[16] = { - 0xC6, 0x1E, 0x7A, 0x93, 0x74, 0x4F, 0x39, 0xEE, - 0x10, 0x73, 0x4A, 0xFE, 0x3F, 0xF7, 0xA0, 0x87 -}; - -static uint8_t dk_cipher_salt[14] = { - 0x30, 0xCB, 0xBC, 0x08, 0x86, 0x3D, 0x8C, 0x85, - 0xD4, 0x9D, 0xB3, 0x4A, 0x9A, 0xE1 -}; - -static uint8_t dk_auth_key[94] = { - 0xCE, 0xBE, 0x32, 0x1F, 0x6F, 0xF7, 0x71, 0x6B, - 0x6F, 0xD4, 0xAB, 0x49, 0xAF, 0x25, 0x6A, 0x15, - 0x6D, 0x38, 0xBA, 0xA4, 0x8F, 0x0A, 0x0A, 0xCF, - 0x3C, 0x34, 0xE2, 0x35, 0x9E, 0x6C, 0xDB, 0xCE, - 0xE0, 0x49, 0x64, 0x6C, 0x43, 0xD9, 0x32, 0x7A, - 0xD1, 0x75, 0x57, 0x8E, 0xF7, 0x22, 0x70, 0x98, - 0x63, 0x71, 0xC1, 0x0C, 0x9A, 0x36, 0x9A, 0xC2, - 0xF9, 0x4A, 0x8C, 0x5F, 0xBC, 0xDD, 0xDC, 0x25, - 0x6D, 0x6E, 0x91, 0x9A, 0x48, 0xB6, 0x10, 0xEF, - 0x17, 0xC2, 0x04, 0x1E, 0x47, 0x40, 0x35, 0x76, - 0x6B, 0x68, 0x64, 0x2C, 0x59, 0xBB, 0xFC, 0x2F, - 0x34, 0xDB, 0x60, 0xDB, 0xDF, 0xB2 -}; - - -void setup() { - zrtp_status_t s; - zrtp_config_t zrtp_config; - - zrtp_config_defaults(&zrtp_config); - - s = zrtp_init(&zrtp_config, &zrtp); - assert_int_equal(s, zrtp_status_ok); -} - -void teardown() { - zrtp_down(zrtp); -} - -zrtp_status_t hex_cmp(uint8_t *a, uint8_t *b, uint32_t len) -{ - uint32_t i; - zrtp_status_t res = zrtp_status_ok; - for (i = 0; i<len; i++) { - if (a[i] != b[i]) { - res = zrtp_status_fail; - break; - } - } - return res; -} - -static void dk_test() { - - zrtp_status_t res; - zrtp_string16_t master_key, master_salt, cipher_key, cipher_salt; - zrtp_string128_t auth_key; - zrtp_dk_ctx *ctx; - - zrtp_cipher_t *cipher = zrtp_comp_find(ZRTP_CC_CIPHER, ZRTP_CIPHER_AES128, zrtp); - assert_non_null(cipher); - - master_key.length = master_key.max_length = 16; - zrtp_memcpy(master_key.buffer, dk_master_key, 16); - - master_salt.length = 14; - master_salt.max_length = 16; - zrtp_memcpy(master_salt.buffer, dk_master_salt, 14); - - - ctx = zrtp_dk_init(cipher, (zrtp_stringn_t*)&master_key, (zrtp_stringn_t*)&master_salt); - assert_non_null(ctx); - - cipher_key.length = 16; - cipher_key.max_length = 16; - - zrtp_derive_key(ctx, label_rtp_encryption, (zrtp_stringn_t*)&cipher_key); - res = hex_cmp((uint8_t*)cipher_key.buffer, dk_cipher_key, cipher_key.length); - assert_int_equal(res, zrtp_status_ok); - - - cipher_salt.length = 14; - cipher_salt.max_length = 16; - - zrtp_derive_key(ctx, label_rtp_salt, (zrtp_stringn_t*)&cipher_salt); - res = hex_cmp((uint8_t*)cipher_salt.buffer, dk_cipher_salt, cipher_salt.length); - assert_int_equal(res, zrtp_status_ok); - - - auth_key.length = 94; - auth_key.max_length = 128; - - zrtp_derive_key(ctx, label_rtp_msg_auth, (zrtp_stringn_t*)&auth_key); - res = hex_cmp((uint8_t*)auth_key.buffer, dk_auth_key, auth_key.length); - assert_int_equal(res, zrtp_status_ok); - - zrtp_dk_deinit(ctx); -} - - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(dk_test, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/ecdh_test.c b/libs/libzrtp/test/ecdh_test.c deleted file mode 100644 index fb30737daa..0000000000 --- a/libs/libzrtp/test/ecdh_test.c +++ /dev/null @@ -1,60 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> -#include <stdio.h> - -#include "zrtp.h" -#include "cmockery/cmockery.h" - -zrtp_global_t *zrtp; - -void setup() { - zrtp_status_t s; - zrtp_config_t zrtp_config; - - zrtp_config_defaults(&zrtp_config); - - s = zrtp_init(&zrtp_config, &zrtp); - assert_int_equal(s, zrtp_status_ok); -} - -void teardown() { - zrtp_down(zrtp); -} - - -static void ecdh256_test() { - zrtp_pk_scheme_t *pks = zrtp_comp_find(ZRTP_CC_PKT, ZRTP_PKTYPE_EC256P, zrtp); - assert_non_null(pks); - pks->self_test(pks); -} - -static void ecdh384_test() { - zrtp_pk_scheme_t *pks = zrtp_comp_find(ZRTP_CC_PKT, ZRTP_PKTYPE_EC384P, zrtp); - assert_non_null(pks); - pks->self_test(pks); -} - -static void ecdh512_test() { - zrtp_pk_scheme_t *pks = zrtp_comp_find(ZRTP_CC_PKT, ZRTP_PKTYPE_EC521P, zrtp); - assert_non_null(pks); - pks->self_test(pks); -} - - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(ecdh256_test, setup, teardown), - unit_test_setup_teardown(ecdh384_test, setup, teardown), - unit_test_setup_teardown(ecdh512_test, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/engine_helpers.c b/libs/libzrtp/test/engine_helpers.c deleted file mode 100644 index 3a3c2cb80a..0000000000 --- a/libs/libzrtp/test/engine_helpers.c +++ /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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> /*chmockery dependency*/ -#include <stdio.h> /*chmockery dependency*/ -#include <unistd.h> /*for usleep*/ - -#include "cmockery/cmockery.h" -#include "test_engine.h" - -static zrtp_test_id_t g_alice, g_bob; -static zrtp_test_id_t g_alice_sid, g_bob_sid; -static zrtp_test_id_t g_secure_audio_channel; - - -static void prepare_alice_bob() { - zrtp_status_t s; - - zrtp_test_session_cfg_t session_config; - zrtp_test_session_config_defaults(&session_config); - - /* - * Create two test sessions, one for Alice and one for Bob and link them - * into test secure channel - */ - s = zrtp_test_session_create(g_alice, &session_config, &g_alice_sid); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_alice_sid); - - s = zrtp_test_session_create(g_bob, &session_config, &g_bob_sid); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_bob_sid); - - s = zrtp_test_channel_create2(g_alice_sid, g_bob_sid, 0, &g_secure_audio_channel); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_secure_audio_channel); -} - -static void release_alice_bob() { - zrtp_test_session_destroy(g_alice_sid); - zrtp_test_session_destroy(g_bob_sid); - - zrtp_test_channel_destroy(g_secure_audio_channel); -} - -static void start_alice_bob_and_wait4secure() { - zrtp_status_t s; - zrtp_test_channel_info_t channel_info; - - /* Everything is ready. Let's start the stream and give it few seconds to switch secure. */ - s = zrtp_test_channel_start(g_secure_audio_channel); - assert_int_equal(zrtp_status_ok, s); - - unsigned i = 30; - for (; i>0; i--) { - usleep(100*1000); - } - - s = zrtp_test_channel_get(g_secure_audio_channel, &channel_info); - assert_int_equal(zrtp_status_ok, s); - - assert_true(channel_info.is_secure); -} diff --git a/libs/libzrtp/test/enroll_test_helpers.c b/libs/libzrtp/test/enroll_test_helpers.c deleted file mode 100644 index ef0973b9f3..0000000000 --- a/libs/libzrtp/test/enroll_test_helpers.c +++ /dev/null @@ -1,81 +0,0 @@ - -static zrtp_test_id_t g_alice, g_bob, g_pbx; -static zrtp_test_id_t g_alice_sid, g_bob_sid, g_pbxa_sid, g_pbxb_sid; -static zrtp_test_id_t g_alice2pbx_channel, g_bob2pbx_channel; - -static void pbx_setup() { - zrtp_status_t s; - - zrtp_test_endpoint_cfg_t endpoint_cfg; - zrtp_test_endpoint_config_defaults(&endpoint_cfg); - - s = zrtp_test_endpoint_create(&endpoint_cfg, "Alice", &g_alice); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_alice); - - s = zrtp_test_endpoint_create(&endpoint_cfg, "Bob", &g_bob); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_bob); - - endpoint_cfg.zrtp.is_mitm = 1; - s = zrtp_test_endpoint_create(&endpoint_cfg, "PBX", &g_pbx); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_pbx); -} - -static void pbx_teardown() { - zrtp_test_endpoint_destroy(g_alice); - zrtp_test_endpoint_destroy(g_bob); - zrtp_test_endpoint_destroy(g_pbx); -} - - -static void prepare_alice_pbx_bob_setup(zrtp_test_session_cfg_t *alice_sconfig, - zrtp_test_session_cfg_t *bob_sconfig, - zrtp_test_session_cfg_t *pbxa_sconfig, - zrtp_test_session_cfg_t *pbxb_sconfig) { - zrtp_status_t s; - - if (alice_sconfig) { - assert_non_null(pbxa_sconfig); - - s = zrtp_test_session_create(g_alice, alice_sconfig, &g_alice_sid); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_alice_sid); - - s = zrtp_test_session_create(g_pbx, pbxa_sconfig, &g_pbxa_sid); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_pbxa_sid); - - s = zrtp_test_channel_create2(g_alice_sid, g_pbxa_sid, 0, &g_alice2pbx_channel); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_alice2pbx_channel); - } - - if (bob_sconfig) { - assert_non_null(pbxb_sconfig); - - s = zrtp_test_session_create(g_bob, bob_sconfig, &g_bob_sid); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_bob_sid); - - s = zrtp_test_session_create(g_pbx, pbxb_sconfig, &g_pbxb_sid); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_pbxb_sid); - - s = zrtp_test_channel_create2(g_bob_sid, g_pbxb_sid, 0, &g_bob2pbx_channel); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_bob2pbx_channel); - } -} - -static void cleanup_alice_pbx_bob_setup() { - zrtp_test_session_destroy(g_alice_sid); - zrtp_test_session_destroy(g_bob_sid); - zrtp_test_session_destroy(g_pbxa_sid); - zrtp_test_session_destroy(g_pbxb_sid); - - zrtp_test_channel_destroy(g_alice2pbx_channel); - zrtp_test_channel_destroy(g_bob2pbx_channel); -} - diff --git a/libs/libzrtp/test/enrollment_test.c b/libs/libzrtp/test/enrollment_test.c deleted file mode 100644 index aaedfd1785..0000000000 --- a/libs/libzrtp/test/enrollment_test.c +++ /dev/null @@ -1,101 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> /*chmockery dependency*/ -#include <stdio.h> /*chmockery dependency*/ -#include <unistd.h> /*for usleep*/ - -#include "cmockery/cmockery.h" -#include "test_engine.h" - -#include "enroll_test_helpers.c" - -static void enrollment_test() { - zrtp_status_t s; - - zrtp_test_channel_info_t a2pbx_channel_info; - zrtp_test_session_cfg_t session_config, session_config_enroll; - zrtp_test_session_config_defaults(&session_config); - zrtp_test_session_config_defaults(&session_config_enroll); - - session_config_enroll.is_enrollment = 1; - - /************************************************************************** - * Enroll Alice to PBX and check triggered events. - */ - prepare_alice_pbx_bob_setup(&session_config, NULL, &session_config_enroll, NULL); - - /* Everything is ready. Let's start the stream and give it few seconds to switch secure. */ - s = zrtp_test_channel_start(g_alice2pbx_channel); - assert_int_equal(zrtp_status_ok, s); - - int i = 30; - for (; i>0; i--) { - usleep(100*1000); - } - - s = zrtp_test_channel_get(g_alice2pbx_channel, &a2pbx_channel_info); - assert_int_equal(zrtp_status_ok, s); - - /* Both, Alice and PBX should switch secure */ - assert_true(a2pbx_channel_info.is_secure); - - /* Alice should receive Enrollment notification */ - zrtp_test_id_t alice2pbx_stream = zrtp_test_session_get_stream_by_idx(g_alice_sid, 0); - assert_true(zrtp_stream_did_event_receive(alice2pbx_stream, ZRTP_EVENT_IS_CLIENT_ENROLLMENT)); - - /* PBX streams should receive incoming enrollment notification */ - zrtp_test_id_t pbx2alice_stream = zrtp_test_session_get_stream_by_idx(g_pbxa_sid, 0); - assert_true(zrtp_stream_did_event_receive(pbx2alice_stream, ZRTP_EVENT_NEW_USER_ENROLLED)); - - /* Confirm enrollment at the PBX side */ - s = zrtp_register_with_trusted_mitm(zrtp_stream_for_test_stream(alice2pbx_stream)); - assert_int_equal(zrtp_status_ok, s); - - /* Clean-up */ - cleanup_alice_pbx_bob_setup(); - - /************************************************************************** - * Try to make one more enrollment call. This time it should say "Already enrolled" - */ - prepare_alice_pbx_bob_setup(&session_config, NULL, &session_config_enroll, NULL); - - /* Everything is ready. Let's start the stream and give it few seconds to switch secure. */ - s = zrtp_test_channel_start(g_alice2pbx_channel); - assert_int_equal(zrtp_status_ok, s); - - i = 30; - for (; i>0; i--) { - usleep(100*1000); - } - - s = zrtp_test_channel_get(g_alice2pbx_channel, &a2pbx_channel_info); - assert_int_equal(zrtp_status_ok, s); - - assert_true(a2pbx_channel_info.is_secure); - - /* Alice should receive Enrollment notification */ - alice2pbx_stream = zrtp_test_session_get_stream_by_idx(g_alice_sid, 0); - assert_true(zrtp_stream_did_event_receive(alice2pbx_stream, ZRTP_EVENT_IS_CLIENT_ENROLLMENT)); - - /* PBX streams should receive incoming enrollment notification */ - pbx2alice_stream = zrtp_test_session_get_stream_by_idx(g_pbxa_sid, 0); - assert_true(zrtp_stream_did_event_receive(pbx2alice_stream, ZRTP_EVENT_USER_ALREADY_ENROLLED)); - - // TODO: check if we have PBX secret cached - // TODO: test zrtp_is_user_enrolled() -} - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(enrollment_test, pbx_setup, pbx_teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/go_secure_test.c b/libs/libzrtp/test/go_secure_test.c deleted file mode 100644 index d75af8d91e..0000000000 --- a/libs/libzrtp/test/go_secure_test.c +++ /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 <v.krikun at zfoneproject.com> - */ - -#include "engine_helpers.c" - -static void setup() { - zrtp_status_t s; - - zrtp_test_endpoint_cfg_t endpoint_cfg; - zrtp_test_endpoint_config_defaults(&endpoint_cfg); - - s = zrtp_test_endpoint_create(&endpoint_cfg, "Alice", &g_alice); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_alice); - - s = zrtp_test_endpoint_create(&endpoint_cfg, "Bob", &g_bob); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_bob); -} - -static void teardown() { - zrtp_test_endpoint_destroy(g_alice); - zrtp_test_endpoint_destroy(g_bob); -} - - -static void go_secure_test() { - /* - * Create two test sessions, one for Alice and one for Bob and link them - * into test secure channel - */ - prepare_alice_bob(); - start_alice_bob_and_wait4secure(); - release_alice_bob(); -} - -static void go_secure_flags_test() { - zrtp_status_t s; - zrtp_test_session_info_t alice_ses_info; - - prepare_alice_bob(); - - start_alice_bob_and_wait4secure(); - - /* All flags should be clear */ - s = zrtp_test_session_get(g_alice_sid, &alice_ses_info); - assert_int_equal(zrtp_status_ok, s); - - assert_int_equal(0, alice_ses_info.zrtp.matches_flags); - assert_int_equal(0, alice_ses_info.zrtp.cached_flags); - assert_int_equal(0, alice_ses_info.zrtp.wrongs_flags); - - /* - * Now let's make one more call, RS1 should match and cached - */ - release_alice_bob(); - - prepare_alice_bob(); - - start_alice_bob_and_wait4secure(); - - s = zrtp_test_session_get(g_alice_sid, &alice_ses_info); - assert_int_equal(zrtp_status_ok, s); - - assert_int_equal((int)ZRTP_BIT_RS1, alice_ses_info.zrtp.matches_flags); - assert_int_equal((int)ZRTP_BIT_RS1, alice_ses_info.zrtp.cached_flags); - assert_int_equal(0, alice_ses_info.zrtp.wrongs_flags); - - /* - * And one more time.. both RS1 and RS2 should be cached and should match. - */ - release_alice_bob(); - - prepare_alice_bob(); - - start_alice_bob_and_wait4secure(); - - s = zrtp_test_session_get(g_alice_sid, &alice_ses_info); - assert_int_equal(zrtp_status_ok, s); - - assert_int_equal((int)(ZRTP_BIT_RS1 | ZRTP_BIT_RS2) , alice_ses_info.zrtp.matches_flags); - assert_int_equal((int)(ZRTP_BIT_RS1 | ZRTP_BIT_RS2), alice_ses_info.zrtp.cached_flags); - assert_int_equal(0, alice_ses_info.zrtp.wrongs_flags); -} - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(go_secure_test, setup, teardown), - unit_test_setup_teardown(go_secure_flags_test, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/hash_test.c b/libs/libzrtp/test/hash_test.c deleted file mode 100644 index 4f9b3733d2..0000000000 --- a/libs/libzrtp/test/hash_test.c +++ /dev/null @@ -1,80 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> -#include <stdio.h> - -#include "zrtp.h" -#include "cmockery/cmockery.h" - -zrtp_global_t *zrtp; - -void setup() { - zrtp_status_t s; - zrtp_config_t zrtp_config; - - zrtp_config_defaults(&zrtp_config); - - s = zrtp_init(&zrtp_config, &zrtp); - assert_int_equal(s, zrtp_status_ok); -} - -void teardown() { - zrtp_down(zrtp); -} - -static void sha1_hash_test() { - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_SRTP_HASH_HMAC_SHA1, zrtp); - assert_non_null(hash); - hash->hash_self_test(hash); -} - -static void sha1_hmac_test() { - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_SRTP_HASH_HMAC_SHA1, zrtp); - assert_non_null(hash); - hash->hmac_self_test(hash); -} - -static void sha256_hash_test() { - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA256, zrtp); - assert_non_null(hash); - hash->hash_self_test(hash); -} - -static void sha256_hmac_test() { - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA256, zrtp); - assert_non_null(hash); - hash->hmac_self_test(hash); -} - -static void sha384_hash_test() { - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA384, zrtp); - assert_non_null(hash); - hash->hash_self_test(hash); -} - -static void sha384_hmac_test() { - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA384, zrtp); - assert_non_null(hash); - hash->hmac_self_test(hash); -} - - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(sha1_hash_test, setup, teardown), - unit_test_setup_teardown(sha1_hmac_test, setup, teardown), - unit_test_setup_teardown(sha256_hash_test, setup, teardown), - unit_test_setup_teardown(sha256_hmac_test, setup, teardown), - unit_test_setup_teardown(sha384_hash_test, setup, teardown), - unit_test_setup_teardown(sha384_hmac_test, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/minor_bugs_test.c b/libs/libzrtp/test/minor_bugs_test.c deleted file mode 100644 index 2bf46b220b..0000000000 --- a/libs/libzrtp/test/minor_bugs_test.c +++ /dev/null @@ -1,92 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> -#include <stdio.h> - -#include "zrtp.h" -#include "cmockery/cmockery.h" - -zrtp_global_t *zrtp; - -void setup() { - zrtp_status_t s; - zrtp_config_t zrtp_config; - - zrtp_config_defaults(&zrtp_config); - - s = zrtp_init(&zrtp_config, &zrtp); - assert_int_equal(s, zrtp_status_ok); -} - -void teardown() { - zrtp_down(zrtp); -} - - -static void session_init_fails_with_no_dh2k() { - zrtp_profile_t profile; - zrtp_status_t s; - - zrtp_session_t *new_session; - - /* Let's initialize ZRTP session with default profile first */ - zrtp_profile_defaults(&profile, zrtp); - - new_session = NULL; - s = zrtp_session_init(zrtp, - &profile, - ZRTP_SIGNALING_ROLE_INITIATOR, - &new_session); - - assert_int_equal(zrtp_status_ok, s); - assert_non_null(new_session); - - /* Then disable DH2K and leave just mandatory parameters */ - profile.pk_schemes[0] = ZRTP_PKTYPE_DH3072; - profile.pk_schemes[1] = ZRTP_PKTYPE_MULT; - profile.pk_schemes[2] = 0; - - new_session = NULL; - s = zrtp_session_init(zrtp, - &profile, - ZRTP_SIGNALING_ROLE_INITIATOR, - &new_session); - - assert_int_equal(zrtp_status_ok, s); - assert_non_null(new_session); - - /* Let's try to disable Multi key exchange, it should produce an error. */ - profile.pk_schemes[0] = ZRTP_PKTYPE_DH3072; - profile.pk_schemes[1] = 0; - - new_session = NULL; - s = zrtp_session_init(zrtp, - &profile, - ZRTP_SIGNALING_ROLE_INITIATOR, - &new_session); - - assert_int_not_equal(zrtp_status_ok, s); - assert_null(new_session); - - /* Profile checking with one of mandatory components missing should return error too. */ - s = zrtp_profile_check(&profile, zrtp); - assert_int_not_equal(zrtp_status_ok, s); - - /* NOTE: we ignore memory leaks and don't destroy ZRTP sessions to make test sources cleaner */ -} - - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(session_init_fails_with_no_dh2k, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/queue.c b/libs/libzrtp/test/queue.c deleted file mode 100644 index 4b0d9b8194..0000000000 --- a/libs/libzrtp/test/queue.c +++ /dev/null @@ -1,111 +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 <v.krikun at zfoneproject.com> - */ - -#include "zrtp.h" -#include "queue.h" - -struct zrtp_queue { - zrtp_sem_t* size_sem; - zrtp_sem_t* main_sem; - zrtp_mutex_t* mutex; - mlist_t head; - uint32_t size; -}; - - -zrtp_status_t zrtp_test_queue_create(zrtp_queue_t** queue) { - - zrtp_status_t s = zrtp_status_fail; - zrtp_queue_t* new_queue = (zrtp_queue_t*) zrtp_sys_alloc(sizeof(zrtp_queue_t)); - if (! new_queue) { - return zrtp_status_fail; - } - zrtp_memset(new_queue, 0, sizeof(zrtp_queue_t)); - - do { - s = zrtp_sem_init(&new_queue->size_sem, ZRTP_QUEUE_SIZE, ZRTP_QUEUE_SIZE); - if (zrtp_status_ok != s) { - break; - } - s = zrtp_sem_init(&new_queue->main_sem, 0, ZRTP_QUEUE_SIZE); - if (zrtp_status_ok != s) { - break; - } - - s = zrtp_mutex_init(&new_queue->mutex); - if (zrtp_status_ok != s) { - break; - } - - init_mlist(&new_queue->head); - new_queue->size = 0; - - s = zrtp_status_ok; - } while (0); - - if (zrtp_status_ok != s) { - if (new_queue->size_sem) { - zrtp_sem_destroy(new_queue->size_sem); - } - if (new_queue->main_sem) { - zrtp_sem_destroy(new_queue->main_sem); - } - if (new_queue->mutex) { - zrtp_mutex_destroy(new_queue->mutex); - } - } - - *queue = new_queue; - - return s; -} - -void zrtp_test_queue_destroy(zrtp_queue_t* queue) { - if (queue->size_sem) { - zrtp_sem_destroy(queue->size_sem); - } - if (queue->main_sem) { - zrtp_sem_destroy(queue->main_sem); - } - if (queue->mutex) { - zrtp_mutex_destroy(queue->mutex); - } -} - - -void zrtp_test_queue_push(zrtp_queue_t* queue, zrtp_queue_elem_t* elem) { - zrtp_sem_wait(queue->size_sem); - - zrtp_mutex_lock(queue->mutex); - mlist_add_tail(&queue->head, &elem->_mlist); - queue->size++; - zrtp_mutex_unlock(queue->mutex); - - zrtp_sem_post(queue->main_sem); -} - -zrtp_queue_elem_t* zrtp_test_queue_pop(zrtp_queue_t* queue) { - zrtp_queue_elem_t* res = NULL; - zrtp_sem_wait(queue->main_sem); - - zrtp_mutex_lock(queue->mutex); - if (queue->size) { - zrtp_queue_elem_t* elem_cover = mlist_get_struct(zrtp_queue_elem_t, _mlist, queue->head.next); - res = elem_cover; - mlist_del(queue->head.next); - - queue->size--; - zrtp_sem_post(queue->size_sem); - } else { - zrtp_sem_post(queue->main_sem); - } - zrtp_mutex_unlock(queue->mutex); - - return res; -} diff --git a/libs/libzrtp/test/queue.h b/libs/libzrtp/test/queue.h deleted file mode 100644 index 6a0cbe2bfe..0000000000 --- a/libs/libzrtp/test/queue.h +++ /dev/null @@ -1,29 +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 <v.krikun at zfoneproject.com> - */ - -#ifndef __ZRTP_TEST_QUEUE_H__ -#define __ZRTP_TEST_QUEUE_H__ - -#include "zrtp.h" - -#define ZRTP_QUEUE_SIZE 2000 - -typedef struct zrtp_queue_elem { - char data[1500]; - uint32_t size; - mlist_t _mlist; -} zrtp_queue_elem_t; -typedef struct zrtp_queue zrtp_queue_t; - -zrtp_status_t zrtp_test_queue_create(zrtp_queue_t** queue); -void zrtp_test_queue_destroy(zrtp_queue_t* queue); -void zrtp_test_queue_push(zrtp_queue_t* queue, zrtp_queue_elem_t* elem); -zrtp_queue_elem_t* zrtp_test_queue_pop(zrtp_queue_t* queue); - -#endif /* __ZRTP_TEST_QUEUE_H__ */ diff --git a/libs/libzrtp/test/sasrelay_test.c b/libs/libzrtp/test/sasrelay_test.c deleted file mode 100644 index 5148c6a724..0000000000 --- a/libs/libzrtp/test/sasrelay_test.c +++ /dev/null @@ -1,123 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> /*chmockery dependency*/ -#include <stdio.h> /*chmockery dependency*/ -#include <unistd.h> /*for usleep*/ - -#include "cmockery/cmockery.h" -#include "test_engine.h" - -#include "enroll_test_helpers.c" - -static void enrollment_test() { - zrtp_status_t s; - - zrtp_test_channel_info_t a2pbx_channel_info, b2pbx_channel_info; - zrtp_test_session_cfg_t session_config, session_config_enroll; - zrtp_test_session_config_defaults(&session_config); - zrtp_test_session_config_defaults(&session_config_enroll); - - session_config_enroll.is_enrollment = 1; - - /************************************************************************** - * Enroll both Alice and Bob to PBX - */ - prepare_alice_pbx_bob_setup(&session_config, &session_config, &session_config_enroll, &session_config_enroll); - - /* Everything is ready. Let's start the stream and give it few seconds to switch secure. */ - s = zrtp_test_channel_start(g_alice2pbx_channel); - assert_int_equal(zrtp_status_ok, s); - s = zrtp_test_channel_start(g_bob2pbx_channel); - assert_int_equal(zrtp_status_ok, s); - - int i = 30; - for (; i>0; i--) { - usleep(100*1000); - } - - s = zrtp_test_channel_get(g_alice2pbx_channel, &a2pbx_channel_info); - assert_int_equal(zrtp_status_ok, s); - s = zrtp_test_channel_get(g_bob2pbx_channel, &b2pbx_channel_info); - assert_int_equal(zrtp_status_ok, s); - - /* Both, Alice and Bob should switch secure and ready for enrollment */ - assert_true(a2pbx_channel_info.is_secure); - assert_true(b2pbx_channel_info.is_secure); - - /* Confirm enrollment for both, Alice and Bob */ - zrtp_test_id_t alice2pbx_stream = zrtp_test_session_get_stream_by_idx(g_alice_sid, 0); - zrtp_test_id_t bob2pbx_stream = zrtp_test_session_get_stream_by_idx(g_bob_sid, 0); - - s = zrtp_register_with_trusted_mitm(zrtp_stream_for_test_stream(alice2pbx_stream)); - assert_int_equal(zrtp_status_ok, s); - s = zrtp_register_with_trusted_mitm(zrtp_stream_for_test_stream(bob2pbx_stream)); - assert_int_equal(zrtp_status_ok, s); - - /* Clean-up */ - cleanup_alice_pbx_bob_setup(); - - /************************************************************************** - * Now, when we have two enrolled parties, make one more call and initiate - * SAS Relay at the PBX side. Both endpoints should received SASRelay, but - * just one should get ZRTP_EVENT_LOCAL_SAS_UPDATED event. - */ - - prepare_alice_pbx_bob_setup(&session_config, &session_config, &session_config, &session_config); - - /* Everything is ready. Let's start the stream and give it few seconds to switch secure. */ - s = zrtp_test_channel_start(g_alice2pbx_channel); - assert_int_equal(zrtp_status_ok, s); - s = zrtp_test_channel_start(g_bob2pbx_channel); - assert_int_equal(zrtp_status_ok, s); - - i = 30; - for (; i>0; i--) { - usleep(100*1000); - } - - s = zrtp_test_channel_get(g_alice2pbx_channel, &a2pbx_channel_info); - assert_int_equal(zrtp_status_ok, s); - s = zrtp_test_channel_get(g_bob2pbx_channel, &b2pbx_channel_info); - assert_int_equal(zrtp_status_ok, s); - - /* Both, Alice and Bob should switch secure */ - assert_true(a2pbx_channel_info.is_secure); - assert_true(b2pbx_channel_info.is_secure); - - zrtp_test_id_t pbx2alice_stream = zrtp_test_session_get_stream_by_idx(g_pbxa_sid, 0); - zrtp_test_id_t pbx2bob_stream = zrtp_test_session_get_stream_by_idx(g_pbxb_sid, 0); - alice2pbx_stream = zrtp_test_session_get_stream_by_idx(g_alice_sid, 0); - bob2pbx_stream = zrtp_test_session_get_stream_by_idx(g_bob_sid, 0); - - /* Resolve MiTM call! */ - s = zrtp_resolve_mitm_call(zrtp_stream_for_test_stream(pbx2alice_stream), - zrtp_stream_for_test_stream(pbx2bob_stream)); - - i = 20; - for (; i>0; i--) { - usleep(100*1000); - } - - /* Alice and Bob should receive Enrollment notification */ - unsigned sas_update1 = zrtp_stream_did_event_receive(alice2pbx_stream, ZRTP_EVENT_LOCAL_SAS_UPDATED); - unsigned sas_update2 = zrtp_stream_did_event_receive(bob2pbx_stream, ZRTP_EVENT_LOCAL_SAS_UPDATED); - assert_true(sas_update1 ^ sas_update2); - - /* Clean-up */ - cleanup_alice_pbx_bob_setup(); -} - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(enrollment_test, pbx_setup, pbx_teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/srtp_replay_test.c b/libs/libzrtp/test/srtp_replay_test.c deleted file mode 100644 index 67c94a87b7..0000000000 --- a/libs/libzrtp/test/srtp_replay_test.c +++ /dev/null @@ -1,240 +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 <v.krikun at zfoneproject.com> - */ - -#include <setjmp.h> -#include <stdio.h> - -#include "zrtp.h" -#include "cmockery/cmockery.h" - -#define _ZTU_ "srtp replay test" - -zrtp_global_t *zrtp; - -#define TEST_MAP_WIDTH 64 -#if TEST_MAP_WIDTH%8 -# define TEST_MAP_WIDTH_BYTES TEST_MAP_WIDTH/8+1 -#else -# define TEST_MAP_WIDTH_BYTES TEST_MAP_WIDTH/8 -#endif - -#define FIRST_TEST_MAP_INIT_WIDTH 24 - -extern zrtp_rp_node_t *get_rp_node_non_lock(zrtp_rp_ctx_t *ctx, uint8_t direction, uint32_t ssrc); -extern zrtp_rp_node_t *add_rp_node(zrtp_srtp_ctx_t *srtp_ctx, zrtp_rp_ctx_t *ctx, uint8_t direction, uint32_t ssrc); -extern zrtp_status_t zrtp_srtp_rp_check(zrtp_srtp_rp_t *srtp_rp, zrtp_rtp_info_t *packet); -extern zrtp_status_t zrtp_srtp_rp_add(zrtp_srtp_rp_t *srtp_rp, zrtp_rtp_info_t *packet); - - -void setup() { - zrtp_status_t s; - zrtp_config_t zrtp_config; - - zrtp_config_defaults(&zrtp_config); - - s = zrtp_init(&zrtp_config, &zrtp); - assert_int_equal(s, zrtp_status_ok); -} - -void teardown() { - zrtp_down(zrtp); -} - -static void print_map(uint8_t *map, int width_bytes) -{ - int i; - for(i=width_bytes-1; i >= 0; i--) { - ZRTP_LOGC(3, ("%i%i%i%i%i%i%i%i", - zrtp_bitmap_get_bit(map, 8*i+7), - zrtp_bitmap_get_bit(map, 8*i+6), - zrtp_bitmap_get_bit(map, 8*i+5), - zrtp_bitmap_get_bit(map, 8*i+4), - zrtp_bitmap_get_bit(map, 8*i+3), - zrtp_bitmap_get_bit(map, 8*i+2), - zrtp_bitmap_get_bit(map, 8*i+1), - zrtp_bitmap_get_bit(map, 8*i+0))); - } - ZRTP_LOG(3, (_ZTU_, "\n")); -} - -static void init_random_map(uint8_t *map, int width, zrtp_global_t *zrtp) { - int i; - for(i=0; i<width; i++) { - uint32_t rnd = 0; - zrtp_randstr(zrtp, (uint8_t*)&rnd, sizeof(rnd)); - if(rnd%10 < 5) { - zrtp_bitmap_set_bit(map, i); - } else { - zrtp_bitmap_clear_bit(map, i); - } - } -} - -void inject_from_map( zrtp_srtp_global_t *srtp_global, - uint32_t ssrc, - uint8_t *src_map, uint8_t *dst_map, int width) { - zrtp_rp_node_t *rp_node; - int i; - zrtp_rtp_info_t pkt; - - rp_node = get_rp_node_non_lock(srtp_global->rp_ctx, RP_INCOMING_DIRECTION, ssrc); - if (NULL == rp_node) { - return; - } - - for (i=0; i< width; i++) { - if (1 == zrtp_bitmap_get_bit(src_map, i)) { - pkt.seq = i; - if (zrtp_status_ok == zrtp_srtp_rp_check(&rp_node->rtp_rp, &pkt)) { - zrtp_bitmap_set_bit(dst_map, i); - zrtp_srtp_rp_add(&rp_node->rtp_rp, &pkt); - } - } - } -} - -// TODO: split test into several, more atomic tests -static void srtp_replay_test() { - int res = 0; - uint32_t ssrc = 1; - int i = 0; - uint8_t test_map[TEST_MAP_WIDTH_BYTES]; - uint8_t result_map[TEST_MAP_WIDTH_BYTES]; - uint8_t tmp_window[ZRTP_SRTP_WINDOW_WIDTH_BYTES]; - uint32_t tmp_seq; - int delta, shift; - - zrtp_rp_node_t *rp_node; - zrtp_srtp_global_t *srtp = zrtp->srtp_global; - - rp_node = add_rp_node(NULL, srtp->rp_ctx, RP_INCOMING_DIRECTION, ssrc); - assert_non_null(rp_node); - - for (i=0; i< TEST_MAP_WIDTH_BYTES; i++) { - test_map[i] = 0; - result_map[i] = 0; - } - /* - * 1st test - * ---------------------------------------------------------------------- - */ - init_random_map(test_map, FIRST_TEST_MAP_INIT_WIDTH, zrtp); - inject_from_map(srtp, ssrc, test_map, result_map, TEST_MAP_WIDTH); - - ZRTP_LOG(3, (_ZTU_,"1st test. Wnd[%i]...\n", ZRTP_SRTP_WINDOW_WIDTH)); - - tmp_seq = rp_node->rtp_rp.seq; - for (i=0; i<ZRTP_SRTP_WINDOW_WIDTH_BYTES; i++) { - tmp_window[i] = rp_node->rtp_rp.window[i]; - } - - delta = tmp_seq-ZRTP_SRTP_WINDOW_WIDTH + 1; - if (delta > 0) { - ZRTP_LOG(3, (_ZTU_,"after wnd: (%i;0]\n", delta)); - ZRTP_LOG(3, (_ZTU_,"inside wnd: [%i;%i]\n", tmp_seq, delta)); - } else { - ZRTP_LOG(3, (_ZTU_,"after wnd: (0;0)\n")); - ZRTP_LOG(3, (_ZTU_,"inside wnd: [%i;0]\n", tmp_seq)); - } - - ZRTP_LOG(3, (_ZTU_,"before wnd: [%i;%i)\n", TEST_MAP_WIDTH-1, tmp_seq)); - - ZRTP_LOG(3, (_ZTU_,"Test map: ")); - print_map(test_map, TEST_MAP_WIDTH_BYTES); - - ZRTP_LOG(3, (_ZTU_,"Res map: ")); - print_map(result_map, TEST_MAP_WIDTH_BYTES); - - shift = TEST_MAP_WIDTH; - shift -= rp_node->rtp_rp.seq + 1; - - ZRTP_LOG(3, (_ZTU_,"Window : ")); - for(i=shift; i > 0; i--){ - ZRTP_LOGC(3, (" ")); - } - print_map(rp_node->rtp_rp.window, ZRTP_SRTP_WINDOW_WIDTH_BYTES); - - /* - * 2nd test - * ---------------------------------------------------------------------- - */ - for(i=0; i< TEST_MAP_WIDTH_BYTES; i++){ - test_map[i] = 0; - result_map[i] = 0; - } - - init_random_map(test_map, TEST_MAP_WIDTH, zrtp); - inject_from_map(srtp, ssrc, test_map, result_map, TEST_MAP_WIDTH); - - ZRTP_LOG(3, (_ZTU_,"2nd test. Wnd[%i]...\n", ZRTP_SRTP_WINDOW_WIDTH)); - ZRTP_LOG(3, (_ZTU_,"Test map: ")); - print_map(test_map, TEST_MAP_WIDTH_BYTES); - - ZRTP_LOG(3, (_ZTU_,"Res map: ")); - print_map(result_map, TEST_MAP_WIDTH_BYTES); - - shift = TEST_MAP_WIDTH; - shift -= rp_node->rtp_rp.seq + 1; - - ZRTP_LOG(3, (_ZTU_,"Window : ")); - for (i=shift; i > 0; i--) { - //zrtp_print_log(ZRTP_LOG_DEBUG, " "); - } - print_map(rp_node->rtp_rp.window, ZRTP_SRTP_WINDOW_WIDTH_BYTES); - - - /* - in result map: - - after window we should to have all zeroes - - into the window we should have ones only if window have zero at appropriate position - - before window we should have equal values of test map and result map bits - */ - for (i=0; i < TEST_MAP_WIDTH; i++) { - if (delta > 0 && i < delta) { - /* After window */ - if (0 != zrtp_bitmap_get_bit(result_map, i)) { - ZRTP_LOG(3, (_ZTU_,"After window. %i bit should be 0\n", i)); - res = -1; - } - } else if (i <= (int)tmp_seq && i >= delta) { - /* inside window */ - - /* check window filtering */ - if(1 == zrtp_bitmap_get_bit(result_map, i)) { - if (1 == zrtp_bitmap_get_bit(tmp_window, i - (tmp_seq-ZRTP_SRTP_WINDOW_WIDTH) - 1)) { - ZRTP_LOG(3, (_ZTU_,"Inside window. Window filtering fail. %i bit should be 0\n", i)); - res = -1; - } - } - /* check test vs result maps */ - if ( zrtp_bitmap_get_bit(result_map, i) != zrtp_bitmap_get_bit(test_map, i) && - !zrtp_bitmap_get_bit(tmp_window, i - (tmp_seq-ZRTP_SRTP_WINDOW_WIDTH) - 1)) { - ZRTP_LOG(3, (_ZTU_, "Inside window. Test map isn't equal to result at bit %i\n", i)); - res = -1; - } - - } else { - /* after window */ - if (zrtp_bitmap_get_bit(result_map, i) != zrtp_bitmap_get_bit(test_map, i)) { - ZRTP_LOG(3, (_ZTU_,"Before window. Test map isn't equal to result at bit %i\n", i)); - res = -1; - } - } - } - - assert_int_equal(res, 0); -} - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(srtp_replay_test, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/test/test_engine.c b/libs/libzrtp/test/test_engine.c deleted file mode 100644 index 8ec6fc2381..0000000000 --- a/libs/libzrtp/test/test_engine.c +++ /dev/null @@ -1,854 +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 <v.krikun at zfoneproject.com> - */ - -#include <stdio.h> /* for sprintf(), remove() */ -#include <string.h> /* for string operations */ - -#include "test_engine.h" -#include "queue.h" - -#define _ZTU_ "test engine" - -#define K_ZRTP_TEST_MAX_ENDPOINTS 10 -#define K_ZRTP_TEST_MAX_SESSIONS_PER_ENDPOINT 100 -#define K_ZRTP_TEST_MAX_CHANNELS (K_ZRTP_TEST_MAX_ENDPOINTS * K_ZRTP_TEST_MAX_ENDPOINTS * ZRTP_MAX_STREAMS_PER_SESSION) - -#define K_ZRTP_TEST_PROCESSORS_COUNT 2 -#define K_ZRTP_TEST_RTP_RATE 200 - -extern uint8_t hash_word_list_odd[256][12]; -extern uint8_t hash_word_list_even[256][10]; - -typedef struct { - zrtp_test_id_t id; - zrtp_test_id_t session_id; - zrtp_test_id_t channel_id; - zrtp_test_id_t endpoint_id; - zrtp_stream_t *zrtp; - uint16_t seq; - zrtp_queue_t *input; - zrtp_queue_t *output; - unsigned zrtp_events_queueu[128]; - unsigned zrtp_events_count; -} zrtp_test_stream_t; - -typedef struct { - zrtp_test_id_t id; - zrtp_test_id_t endpoint_id; - zrtp_test_session_cfg_t cfg; - zrtp_session_t *zrtp; - zrtp_test_stream_t streams[ZRTP_MAX_STREAMS_PER_SESSION]; - unsigned streams_count; -} zrtp_test_session_t; - -typedef struct { - zrtp_test_id_t id; - char name[ZRTP_TEST_STR_LEN]; - zrtp_zid_t zid; - zrtp_test_endpoint_cfg_t cfg; - zrtp_test_session_t sessions[K_ZRTP_TEST_MAX_SESSIONS_PER_ENDPOINT]; - unsigned sessions_count; - zrtp_global_t *zrtp; - unsigned is_running; - zrtp_queue_t *input_queue; -} zrtp_endpoint_t; - - -typedef struct { - zrtp_test_id_t id; - zrtp_test_stream_t *left; - zrtp_test_stream_t *right; - unsigned is_attached; - unsigned is_secure; -} zrtp_test_channel_t; - -typedef struct zrtp_test_packet { - uint32_t is_rtp; /*! Defines is packet RTP or RTCP */ - uint32_t length; /*! Packet Length in bytes */ - char body[1024]; /*! Packet body */ -} zrtp_test_packet_t; - - -static zrtp_endpoint_t g_test_endpoints[K_ZRTP_TEST_MAX_ENDPOINTS]; -static unsigned g_test_endpoints_count = 0; - -static zrtp_test_channel_t g_test_channels[K_ZRTP_TEST_MAX_CHANNELS]; -static unsigned g_test_channels_count = 0; - -static int g_endpoints_counter = 7; -static int g_channels_counter = 7; -static int g_sessions_counter = 7; -static int g_streams_counter = 7; - - -zrtp_endpoint_t *zrtp_test_endpoint_by_id(zrtp_test_id_t id); -zrtp_test_stream_t *zrtp_test_stream_by_id(zrtp_test_id_t id); -zrtp_test_stream_t *zrtp_test_stream_by_peerid(zrtp_test_id_t id); -zrtp_test_session_t *zrtp_test_session_by_id(zrtp_test_id_t id); -zrtp_test_channel_t *zrtp_test_channel_by_id(zrtp_test_id_t id); - - -/****************************************************************************** - * libzrtp interface implementation - */ - -static void on_zrtp_event(zrtp_stream_t *ctx, zrtp_protocol_event_t event) { - zrtp_test_id_t *stream_id = zrtp_stream_get_userdata(ctx); - zrtp_test_stream_t *stream = zrtp_test_stream_by_id(*stream_id); - - stream->zrtp_events_queueu[stream->zrtp_events_count++] = event; -} - - -static void on_zrtp_secure(zrtp_stream_t *ctx) { - zrtp_test_id_t *stream_id = zrtp_stream_get_userdata(ctx); - zrtp_test_stream_t *stream = zrtp_test_stream_by_id(*stream_id); - zrtp_test_channel_t *channel = zrtp_test_channel_by_id(stream->channel_id); - zrtp_test_stream_t *remote_stream = (channel->left == stream) ? channel->right : channel->left; - - if (stream->zrtp->state == ZRTP_STATE_SECURE && - remote_stream->zrtp->state == ZRTP_STATE_SECURE) { - channel->is_secure = 1; - } - -} - -static int on_send_packet(const zrtp_stream_t* ctx, char* message, unsigned int length) { - zrtp_queue_elem_t* elem = zrtp_sys_alloc(sizeof(zrtp_queue_elem_t)); - if (elem) { - zrtp_test_packet_t* packet = (zrtp_test_packet_t*) elem->data; - elem->size = length; - - packet->is_rtp = 1; - packet->length = length; - zrtp_memcpy(packet->body, message, length); - - zrtp_test_id_t *stream_id = zrtp_stream_get_userdata(ctx); - zrtp_test_stream_t *stream = zrtp_test_stream_by_id(*stream_id); - if (stream) { - zrtp_test_queue_push(stream->output, elem); - return zrtp_status_ok; - } else { - return zrtp_status_fail; - } - } else { - return zrtp_status_alloc_fail; - } -} - - -/****************************************************************************** - * Processing Loop - */ - -static zrtp_test_stream_t *get_stream_to_process_(zrtp_endpoint_t *endpoint) { - zrtp_test_id_t all_streams[K_ZRTP_TEST_MAX_SESSIONS_PER_ENDPOINT*ZRTP_MAX_STREAMS_PER_SESSION]; - unsigned streams_count = 0; - unsigned i, j; - - for (i=0; i<endpoint->sessions_count; i++) { - for (j=0; j<endpoint->sessions[i].streams_count; j++) { - zrtp_test_stream_t *stream = &endpoint->sessions[i].streams[j]; - if (stream->input && stream->output) - all_streams[streams_count++] = stream->id; - } - } - - if (0 == streams_count) - return NULL; - - zrtp_randstr(endpoint->zrtp, (unsigned char*)&i, sizeof(i)); - j = (unsigned)i; - j = j % streams_count; - - //printf("trace>>> CHOOSE stream Endpoint=%u IDX=%u ID=%u\n", endpoint->id, j, all_streams[j]); - return zrtp_test_stream_by_id(all_streams[j]); -} - - -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WINCE) -DWORD WINAPI process_incoming(void *param) -#else -void *process_incoming(void *param) -#endif -{ - zrtp_endpoint_t *the_endpoint = (zrtp_endpoint_t *)param; - - while (the_endpoint->is_running) { - zrtp_test_packet_t* packet = NULL; - zrtp_queue_elem_t* elem = NULL; - zrtp_status_t s = zrtp_status_fail; - zrtp_test_stream_t *stream; - int is_protocol = 0; - - // TODO: use peak to not to block processing if queue for this stream is empty - elem = zrtp_test_queue_pop(the_endpoint->input_queue); - if (!elem || elem->size <= 0) { - if (elem) zrtp_sys_free(elem); - break; - } - - packet = (zrtp_test_packet_t*) elem->data; - zrtp_test_id_t stream_id; - { - if (packet->is_rtp) { - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *rtp_hdr = (zrtp_rtp_hdr_t*)packet->body; - stream_id = zrtp_ntoh32(rtp_hdr->ssrc); /* remember, we use stream Id as it's RTP SSRC */ - } else { - ZRTP_UNALIGNED(zrtp_rtcp_hdr_t) *rtcp_hdr = (zrtp_rtcp_hdr_t*)packet->body; - stream_id = zrtp_ntoh32(rtcp_hdr->ssrc); /* remember, we use stream Id as it's RTP SSRC */ - } - stream = zrtp_test_stream_by_peerid(stream_id); - } - - /* - * Process incoming packet by libzrtp. Is this a RTP media packet - copy it to the buffer - * to print out later. - */ - if (packet->is_rtp) { - s = zrtp_process_srtp(stream->zrtp, packet->body, &packet->length); - } else { - s = zrtp_process_srtcp(stream->zrtp, packet->body, &packet->length); - } - - if (!is_protocol) { - char *body; - if (packet->is_rtp) { - body = packet->body + sizeof(zrtp_rtp_hdr_t); - body[packet->length - sizeof(zrtp_rtp_hdr_t)] = 0; - } else { - body = packet->body + sizeof(zrtp_rtcp_hdr_t); - body[packet->length - sizeof(zrtp_rtcp_hdr_t)] = 0; - } - - switch (s) - { - case zrtp_status_ok: { - ZRTP_LOG(1, (_ZTU_,"Incoming: (%s) [%p:ssrc=%u] OK. <%s> decrypted %d bytes.\n", - zrtp_log_state2str(stream->zrtp->state), stream->zrtp, stream->id, body, packet->length)); - } break; - - case zrtp_status_drop: { - ZRTP_LOG(1, (_ZTU_,"Incoming: (%s) [%p:ssrc=%u] DROPPED. <%s>\n", - zrtp_log_state2str(stream->zrtp->state), stream->zrtp, stream->id, body)); - } break; - - case zrtp_status_fail: { - ZRTP_LOG(1, (_ZTU_,"Incoming: (%s) [%p:ssrc=%u] DECRYPT FAILED. <%s>\n", - zrtp_log_state2str(stream->zrtp->state), stream->zrtp, stream->id, body)); - } break; - - default: - break; - } - } - - zrtp_sys_free(elem); - - /* - * When zrtp_stream is in the pending clear state and other side wants to send plain - * traffic. We have to call zrtp_clear_stream(). - */ - if (stream->zrtp->state == ZRTP_STATE_PENDINGCLEAR) { - zrtp_stream_clear(stream->zrtp); - } - } -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WINCE) - return 0; -#else - return NULL; -#endif -} - -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WINCE) -DWORD WINAPI process_outgoing(void *param) -#else -void *process_outgoing(void *param) -#endif -{ - unsigned packets_counter = 0; - zrtp_endpoint_t *the_endpoint = (zrtp_endpoint_t *)param; - - while (the_endpoint->is_running) { - zrtp_test_stream_t* stream = NULL; - unsigned i; - - zrtp_status_t s = zrtp_status_fail; - zrtp_test_packet_t* packet; - zrtp_queue_elem_t* elem; - char* word = NULL; - - zrtp_sleep(K_ZRTP_TEST_RTP_RATE); - - /* Get random channel to operate with and select random peer */ - stream = get_stream_to_process_(the_endpoint); - if (!stream) { - continue; - } - - elem = zrtp_sys_alloc(sizeof(zrtp_queue_elem_t)); - if (!elem) { - break; - } - packet = (zrtp_test_packet_t*) elem->data; - packet->is_rtp = (packets_counter++ % 20); /* Every 20-th packet is RTCP */ - - /* - * Construct RTP/RTCP Packet - */ - if (packet->is_rtp) - { - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *rtp_hdr = (zrtp_rtp_hdr_t*)packet->body; - - /* Fill RTP Header according to the specification */ - zrtp_memset(rtp_hdr, 0, sizeof(zrtp_rtp_hdr_t)); - rtp_hdr->version = 2; /* Current RTP version 2 */ - rtp_hdr->pt = 0; /* PCMU padding type */ - rtp_hdr->ssrc = zrtp_hton32(stream->id); /* Use stream Identifier as it's SSRC */ - if (stream->seq >= 0xFFFF) { - stream->seq = 0; - } - rtp_hdr->seq = zrtp_hton16(stream->seq++); - rtp_hdr->ts = zrtp_hton32((uint32_t)(zrtp_time_now()/1000)); - - /* Get RTP body from PGP words lists */ - word = (char*)(i ? hash_word_list_odd[packets_counter % 256] : hash_word_list_even[packets_counter % 256]); - - zrtp_memcpy(packet->body + sizeof(zrtp_rtp_hdr_t), word, (uint32_t)strlen(word)); - packet->length = sizeof(zrtp_rtp_hdr_t) + (uint32_t)strlen(word); - - /* Process RTP media with libzrtp */ - s = zrtp_process_rtp(stream->zrtp, packet->body, &packet->length); - } - else { - ZRTP_UNALIGNED(zrtp_rtcp_hdr_t) *rtcp_hdr = (zrtp_rtcp_hdr_t*)packet->body; - - /* Fill RTCP Header according to the specification */ - rtcp_hdr->rc = 0; - rtcp_hdr->version = 2; - rtcp_hdr->ssrc = stream->id; - - /* Get RTP body from PGP words lists. Put RTCP marker at the beginning */ - zrtp_memcpy(packet->body + sizeof(zrtp_rtcp_hdr_t), "RTCP", 4); - word = (char*)( i ? hash_word_list_odd[packets_counter % 256] : hash_word_list_even[packets_counter % 256]); - - zrtp_memcpy(packet->body + sizeof(zrtp_rtcp_hdr_t) + 4, word, (uint32_t)strlen(word)); - packet->length = sizeof(zrtp_rtcp_hdr_t) + (uint32_t)strlen(word) + 4; - /* RTCP packets sould be 32 byes aligned */ - packet->length += (packet->length % 4) ? (4 - packet->length % 4) : 0; - - /* Process RTCP control with libzrtp */ - s = zrtp_process_rtcp(stream->zrtp, packet->body, &packet->length); - } - - elem->size = packet->length; - - /* Handle zrtp_process_xxx() instructions */ - switch (s) { - /* Put the packet to the queue ==> send packet to the other side pear */ - case zrtp_status_ok: { - ZRTP_LOG(3, (_ZTU_,"Outgoing: (%s) [%p:ssrc=%u] OK. <%s%s> encrypted %d bytes.\n", - zrtp_log_state2str(stream->zrtp->state), stream->zrtp, stream->id, packet->is_rtp ? "" : "RTCP", word, packet->length)); - zrtp_test_queue_push(stream->output, elem); - } break; - - case zrtp_status_drop: { - ZRTP_LOG(1, (_ZTU_,"Outgoing: (%s) [%p:ssrc=%u] DROPPED.\n", - zrtp_log_state2str(stream->zrtp->state), stream->zrtp, stream->id)); - } break; - - case zrtp_status_fail: { - ZRTP_LOG(1, (_ZTU_,"Outgoing: (%s) [%p:ssrc=%u] ENCRYPT FAILED.\n", - zrtp_log_state2str(stream->zrtp->state), stream->zrtp, stream->id)); - } break; - - default: - break; - } - - if (zrtp_status_ok != s) { - zrtp_sys_free(packet); - } - } -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WINCE) - return 0; -#else - return NULL; -#endif -} - - -/****************************************************************************** - * Test Engine Public API - */ - -void zrtp_test_endpoint_config_defaults(zrtp_test_endpoint_cfg_t* cfg) { - - zrtp_memset(cfg, 0, sizeof(zrtp_test_endpoint_cfg_t)); - - cfg->generate_traffic = 0; - - /* It's always a good idea to start with default values */ - zrtp_config_defaults(&cfg->zrtp); - - /* Set ZRTP client id */ - strcpy(cfg->zrtp.client_id, "zrtp-test-engine"); - - cfg->zrtp.is_mitm = 0; - cfg->zrtp.lic_mode = ZRTP_LICENSE_MODE_ACTIVE; - - cfg->zrtp.cb.event_cb.on_zrtp_secure = &on_zrtp_secure; - cfg->zrtp.cb.event_cb.on_zrtp_security_event = &on_zrtp_event; - cfg->zrtp.cb.event_cb.on_zrtp_protocol_event = &on_zrtp_event; - cfg->zrtp.cb.misc_cb.on_send_packet = &on_send_packet; -} - -zrtp_status_t zrtp_test_endpoint_create(zrtp_test_endpoint_cfg_t* cfg, - const char *name, - zrtp_test_id_t* id) { - zrtp_status_t s; - unsigned i; - char cache_file_path[ZRTP_TEST_STR_LEN]; - zrtp_endpoint_t *new_endpoint; - - if (g_test_endpoints_count >= K_ZRTP_TEST_MAX_ENDPOINTS) - return zrtp_status_alloc_fail; - - new_endpoint = &g_test_endpoints[g_test_endpoints_count++]; - zrtp_memset(new_endpoint, 0, sizeof(zrtp_endpoint_t)); - - /* Copy configuration, we will use it later to clean up after ourselves */ - zrtp_memcpy(&new_endpoint->cfg, cfg, sizeof(zrtp_test_endpoint_cfg_t)); - - /* Remember endpoint name */ - strcpy(new_endpoint->name, name); - - new_endpoint->id = g_endpoints_counter++; - - /* Adjust cache file path so each endpoint will use it's own file. */ - sprintf(cache_file_path, "./%s_cache.dat", name); - zrtp_zstrcpyc(ZSTR_GV(new_endpoint->cfg.zrtp.def_cache_path), cache_file_path); - - /* Initialize libzrtp engine for this endpoint */ - s = zrtp_init(&new_endpoint->cfg.zrtp, &new_endpoint->zrtp); - if (zrtp_status_ok == s) { - *id = new_endpoint->id; - - /* Generate random ZID */ - zrtp_randstr(new_endpoint->zrtp, new_endpoint->zid, sizeof(new_endpoint->zid)); - } - - /* Create Input queue*/ - s = zrtp_test_queue_create(&new_endpoint->input_queue); - if (zrtp_status_ok != s) { - return s; - } - - /* Start processing loop */ - new_endpoint->is_running = 1; - - for (i = 0; i<K_ZRTP_TEST_PROCESSORS_COUNT; i++) { - if (0 != zrtp_thread_create(process_incoming, new_endpoint)) { - return zrtp_status_fail; - } - - if (cfg->generate_traffic) { - if (0 != zrtp_thread_create(process_outgoing, new_endpoint)) { - return zrtp_status_fail; - } - } - } - - return s; -} - -zrtp_status_t zrtp_test_endpoint_destroy(zrtp_test_id_t id) { - unsigned i; - zrtp_status_t s = zrtp_status_ok; - zrtp_endpoint_t *endpoint = zrtp_test_endpoint_by_id(id); - - endpoint->is_running = 0; - - if (endpoint->input_queue) { - /* Push faked element to the queue to unlock incoming threads */ - for (i=0; i<K_ZRTP_TEST_PROCESSORS_COUNT; i++) { - zrtp_queue_elem_t *elem = malloc(sizeof(zrtp_queue_elem_t)); - elem->size = 0; - zrtp_test_queue_push(endpoint->input_queue, elem); - } - zrtp_sleep(0.5*1000); - - zrtp_test_queue_destroy(endpoint->input_queue); - } - - for (i=0; i<20; i++) zrtp_sleep(100); - - if (endpoint) { - /* Shut down libzrtp */ - if (endpoint->zrtp) - s = zrtp_down(endpoint->zrtp); - - /* Clean-up ZRTP cache after ourselves */ - remove(endpoint->cfg.zrtp.def_cache_path.buffer); - } else { - s = zrtp_status_fail; - } - - return s; -} - -zrtp_status_t zrtp_test_stream_get(zrtp_test_id_t id, - zrtp_test_stream_info_t* info) { - - zrtp_test_stream_t *stream = zrtp_test_stream_by_id(id); - if (stream) { - zrtp_status_t s; - zrtp_memset(info, 0, sizeof(zrtp_test_stream_info_t)); - - zrtp_memcpy(info->zrtp_events_queueu, stream->zrtp_events_queueu, sizeof(info->zrtp_events_queueu)); - info->zrtp_events_count = stream->zrtp_events_count; - - s = zrtp_stream_get(stream->zrtp, &info->zrtp); - return s; - } else { - return zrtp_status_bad_param; - } -} - -void zrtp_test_session_config_defaults(zrtp_test_session_cfg_t* cfg) { - cfg->streams_count = 1; - cfg->role = ZRTP_SIGNALING_ROLE_UNKNOWN; - cfg->is_enrollment = 0; - - zrtp_profile_defaults(&cfg->zrtp, NULL); -} - -zrtp_status_t zrtp_test_session_create(zrtp_test_id_t endpoint_id, - zrtp_test_session_cfg_t* cfg, - zrtp_test_id_t* id) { - zrtp_status_t s; - unsigned i; - zrtp_test_session_t *the_session; - zrtp_endpoint_t *the_endpoint = zrtp_test_endpoint_by_id(endpoint_id); - - if (!the_endpoint) - return zrtp_status_fail; - - if (the_endpoint->sessions_count >= K_ZRTP_TEST_MAX_SESSIONS_PER_ENDPOINT) - return zrtp_status_fail; - - the_session = &the_endpoint->sessions[the_endpoint->sessions_count++]; - - zrtp_memset(the_session, 0, sizeof(zrtp_test_session_t)); - - zrtp_memcpy(&the_session->cfg, cfg, sizeof(zrtp_test_session_cfg_t)); - - the_session->id = g_sessions_counter++; - the_session->endpoint_id = endpoint_id; - - s = zrtp_session_init(the_endpoint->zrtp, - &cfg->zrtp, - the_endpoint->zid, - cfg->role, - &the_session->zrtp); - - if (zrtp_status_ok == s) { - - zrtp_session_set_userdata(the_session->zrtp, &the_session->id); - - for (i=0; i<cfg->streams_count; i++) { - zrtp_test_stream_t *the_stream = &the_session->streams[i]; - zrtp_memset(the_stream, 0, sizeof(zrtp_test_stream_t)); - - the_stream->id = g_streams_counter++; - the_stream->session_id = the_session->id; - the_stream->endpoint_id = endpoint_id; - - s = zrtp_stream_attach(the_session->zrtp, &the_stream->zrtp); - if (zrtp_status_ok == s) { - zrtp_stream_set_userdata(the_stream->zrtp, &the_stream->id); - the_session->streams_count++; - } else { - break; - } - } - } - - if (zrtp_status_ok == s) { - *id = the_session->id; - } - - return s; -} - -zrtp_status_t zrtp_test_session_destroy(zrtp_test_id_t id) { - zrtp_test_session_t *session = zrtp_test_session_by_id(id); - if (session) { - /* NOTE: we don't release session slots here due to nature of testing - * engine: test configuration constructed from scratch for every single test. - */ - zrtp_session_down(session->zrtp); - } - return zrtp_status_ok; -} - -zrtp_status_t zrtp_test_session_get(zrtp_test_id_t id, zrtp_test_session_info_t* info) { - zrtp_status_t s; - zrtp_test_session_t *session = zrtp_test_session_by_id(id); - if (session) { - s = zrtp_session_get(session->zrtp, &info->zrtp); - if (zrtp_status_ok == s) { - unsigned i; - for (i=0; i<session->streams_count; i++) { - s = zrtp_test_stream_get(session->streams[i].id, &info->streams[i]); - if (zrtp_status_ok != s) - break; - } - } - - return s; - } else { - return zrtp_status_bad_param; - } -} - -zrtp_status_t zrtp_test_channel_create(zrtp_test_id_t left_id, zrtp_test_id_t right_id, zrtp_test_id_t* id) { - zrtp_test_channel_t *the_channel; - zrtp_test_stream_t *left = zrtp_test_stream_by_id(left_id); - zrtp_test_stream_t *right = zrtp_test_stream_by_id(right_id); - - if (!left || !right) - return zrtp_status_bad_param; - - if (g_test_channels_count >= K_ZRTP_TEST_MAX_CHANNELS) - return zrtp_status_bad_param; - - zrtp_endpoint_t *left_endpoint = zrtp_test_endpoint_by_id(left->endpoint_id); - zrtp_endpoint_t *right_endpoint = zrtp_test_endpoint_by_id(right->endpoint_id); - - the_channel = &g_test_channels[g_test_channels_count++]; - zrtp_memset(the_channel, 0, sizeof(zrtp_test_channel_t)); - - the_channel->id = g_channels_counter++; - the_channel->left = left; - the_channel->right = right; - - left->output = right_endpoint->input_queue; - left->input = left_endpoint->input_queue; - right->output = left_endpoint->input_queue; - right->input = right_endpoint->input_queue; - - right->channel_id = the_channel->id; - left->channel_id = the_channel->id; - - the_channel->is_attached = 1; - - *id = the_channel->id; - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_test_channel_create2(zrtp_test_id_t left_session, - zrtp_test_id_t right_session, - unsigned stream_idx, - zrtp_test_id_t *id) { - zrtp_test_session_t *left = zrtp_test_session_by_id(left_session); - zrtp_test_session_t *right = zrtp_test_session_by_id(right_session); - - if (!left || !right) - return zrtp_status_bad_param; - - if (left->streams_count <= stream_idx || right->streams_count <= stream_idx) - return zrtp_status_bad_param; - - return zrtp_test_channel_create(left->streams[stream_idx].id, right->streams[stream_idx].id, id); -} - -zrtp_status_t zrtp_test_channel_destroy(zrtp_test_id_t id) { - zrtp_test_channel_t *channel = zrtp_test_channel_by_id(id); - if (!channel) - return zrtp_status_bad_param; - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_test_channel_start(zrtp_test_id_t id) { - zrtp_status_t s1, s2; - zrtp_test_channel_t *the_channel = zrtp_test_channel_by_id(id); - zrtp_test_session_t *the_session; - - the_session = zrtp_test_session_by_id(the_channel->left->session_id); - if (the_session->cfg.is_enrollment) - s1 = zrtp_stream_registration_start(the_channel->left->zrtp, the_channel->left->id); /* use stream Id as ssrc */ - else - s1 = zrtp_stream_start(the_channel->left->zrtp, the_channel->left->id); /* use stream Id as ssrc */ - if (s1 == zrtp_status_ok) { - the_session = zrtp_test_session_by_id(the_channel->right->session_id); - if (the_session->cfg.is_enrollment) - s2 = zrtp_stream_registration_start(the_channel->right->zrtp, the_channel->right->id); - else - s2 = zrtp_stream_start(the_channel->right->zrtp, the_channel->right->id); - } else { - return s1; - } - - return s2; -} - -zrtp_status_t zrtp_test_channel_get(zrtp_test_id_t id, - zrtp_test_channel_info_t* info) { - - zrtp_test_channel_t *channel = zrtp_test_channel_by_id(id); - if (channel) { - zrtp_status_t s; - - zrtp_memset(info, 0, sizeof(zrtp_test_channel_info_t)); - - s = zrtp_test_stream_get(channel->left->id, &info->left); - if (zrtp_status_ok == s) { - s = zrtp_test_stream_get(channel->right->id, &info->right); - if (zrtp_status_ok == s) { - info->is_secure = channel->is_secure; - } - } - - return s; - } else { - return zrtp_status_bad_param; - } -} - - -/****************************************************************************** - * Helpers - */ - -zrtp_endpoint_t *zrtp_test_endpoint_by_id(zrtp_test_id_t id) { - int i; - - if (ZRTP_TEST_UNKNOWN_ID == id) return NULL; - - for (i=0; i<g_test_endpoints_count; i++) { - if (g_test_endpoints[i].id == id) { - return &g_test_endpoints[i]; - } - } - - return NULL; -} - -zrtp_test_session_t *zrtp_test_session_by_id(zrtp_test_id_t id) { - int i, j; - - if (ZRTP_TEST_UNKNOWN_ID == id) return NULL; - - for (i=0; i<g_test_endpoints_count; i++) { - zrtp_endpoint_t *endpoint = &g_test_endpoints[i]; - if (endpoint->id == ZRTP_TEST_UNKNOWN_ID) - continue; - - for (j=0; j<endpoint->sessions_count; j++) { - if (endpoint->sessions[j].id == id) { - return &endpoint->sessions[j]; - } - } - } - - return NULL; -} - -zrtp_test_stream_t *zrtp_test_stream_by_id(zrtp_test_id_t id) { - int i, j, k; - - if (ZRTP_TEST_UNKNOWN_ID == id) return NULL; - - for (i=0; i<g_test_endpoints_count; i++) { - zrtp_endpoint_t *endpoint = &g_test_endpoints[i]; - if (endpoint->id == ZRTP_TEST_UNKNOWN_ID) - continue; - - for (j=0; j<endpoint->sessions_count; j++) { - zrtp_test_session_t *session = &endpoint->sessions[j]; - if (session->id == ZRTP_TEST_UNKNOWN_ID) - continue; - - for (k=0; k<session->streams_count; k++) { - if (session->streams[k].id == id) { - return &session->streams[k]; - } - } - } - } - - return NULL; -} - -zrtp_test_channel_t *zrtp_test_channel_by_id(zrtp_test_id_t id) { - int i; - zrtp_test_channel_t *channel = NULL; - - if (ZRTP_TEST_UNKNOWN_ID == id) return NULL; - - for (i=0; i<g_test_channels_count; i++) { - if (g_test_channels[i].id != ZRTP_TEST_UNKNOWN_ID && g_test_channels[i].id == id) { - channel = &g_test_channels[i]; - break; - } - } - - return channel; -} - -zrtp_test_stream_t *zrtp_test_stream_by_peerid(zrtp_test_id_t id) { - int i; - if (ZRTP_TEST_UNKNOWN_ID == id) return NULL; - - for (i=0; i<g_test_channels_count; i++) { - if (g_test_channels[i].id != ZRTP_TEST_UNKNOWN_ID) { - if (g_test_channels[i].left->id == id) - return g_test_channels[i].right; - else if (g_test_channels[i].right->id == id) - return g_test_channels[i].left; - } - } - - return NULL; -} - -zrtp_test_id_t zrtp_test_session_get_stream_by_idx(zrtp_test_id_t session_id, unsigned idx) { - zrtp_test_session_t *session = zrtp_test_session_by_id(session_id); - if (session && session->streams_count > idx) { - return session->streams[idx].id; - } else { - return ZRTP_TEST_UNKNOWN_ID; - } -} - -zrtp_stream_t *zrtp_stream_for_test_stream(zrtp_test_id_t stream_id) { - zrtp_test_stream_t *stream = zrtp_test_stream_by_id(stream_id); - if (stream) { - return stream->zrtp; - } else { - return NULL; - } -} - -unsigned zrtp_stream_did_event_receive(zrtp_test_id_t stream_id, unsigned event) { - unsigned i; - zrtp_test_stream_info_t stream_info; - - zrtp_test_stream_get(stream_id, &stream_info); - for (i=0; i<stream_info.zrtp_events_count; i++) { - if (stream_info.zrtp_events_queueu[i] == event) - break; - } - - return (i != stream_info.zrtp_events_count); -} - diff --git a/libs/libzrtp/test/test_engine.h b/libs/libzrtp/test/test_engine.h deleted file mode 100644 index a8493aebd8..0000000000 --- a/libs/libzrtp/test/test_engine.h +++ /dev/null @@ -1,130 +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 <v.krikun at zfoneproject.com> - */ - -#include "zrtp.h" - -/** libzrtp test elements identifier */ -typedef uint32_t zrtp_test_id_t; - -/** Defines constant for unknown test element identifier */ -#define ZRTP_TEST_UNKNOWN_ID 0 - -/** Default lengths for libzrtp test string buffers */ -#define ZRTP_TEST_STR_LEN 128 - -/** libzrtp test endpoint configuration */ -typedef struct { - zrtp_config_t zrtp; /** libzrtp global configuration parameters */ - unsigned generate_traffic; /** switch On to emulate RTP/RTCP traffic generation. Off by default. */ -} zrtp_test_endpoint_cfg_t; - -/** ZRTP test session parameters*/ -typedef struct { - zrtp_profile_t zrtp; /** libzrtp session parameters */ - unsigned streams_count; /** number of zrtp streams to be attached to the session */ - zrtp_signaling_role_t role; /** signaling role, default is ZRTP_SIGNALING_ROLE_UNKNOWN */ - unsigned is_enrollment; /** true if enrollment session should be created */ -} zrtp_test_session_cfg_t; - -/** ZRTP test stream info */ -typedef struct { - zrtp_stream_info_t zrtp; /** libzrtp stream info */ - unsigned zrtp_events_queueu[128]; /** list of received zrtp events*/ - unsigned zrtp_events_count; /** number of received events */ -} zrtp_test_stream_info_t; - -/** ZRTP test session state snapshot */ -typedef struct { - zrtp_session_info_t zrtp; /** libzrtp session info*/ - zrtp_test_stream_info_t streams[ZRTP_MAX_STREAMS_PER_SESSION]; /** array of attached streams info */ - unsigned streams_count; /** number streams attached to the session */ -} zrtp_test_session_info_t; - -/** *ZRTP test channel state */ -typedef struct { - zrtp_test_stream_info_t left; /** one-leg zrtp stream */ - zrtp_test_stream_info_t right; /** second-leg zrtp stream */ - unsigned char is_secure; /** enabled when both streams in the channel are secure */ -} zrtp_test_channel_info_t; - - -/** - * Initialize zrtp test endpoint configuration with default values - * @param cfg - endpoint config to initialize - */ -void zrtp_test_endpoint_config_defaults(zrtp_test_endpoint_cfg_t *cfg); - -/** - * ZRTP test endpoint constructor - * One endpoint is created, it starts processing threads and ready to emulate ZRTP exchange. - * - * @param cfg - endpoint configuration - * @param name - endpoint name for debug purposes and cache naming, e.h "Alice", "Bob". - * @param id - just created endpoint identifier will be placed here - * - * @return zrtp_status_ok on success or some of zrtp_status_t error codes on failure - */ -zrtp_status_t zrtp_test_endpoint_create(zrtp_test_endpoint_cfg_t *cfg, - const char *name, - zrtp_test_id_t *id); - -/** - * ZRTP test endpoint destructor - * zrtp_test_endpoint_destroy() stops processing threads and release all - * recurses allocated in zrtp_test_endpoint_create(). - * - * @param id - endpoint identifier - * @return zrtp_status_ok on success or some of zrtp_status_t error codes on failure - */ -zrtp_status_t zrtp_test_endpoint_destroy(zrtp_test_id_t id); - -/** - * Enables test session config with default values - * @param cfg - session config for initialization - */ -void zrtp_test_session_config_defaults(zrtp_test_session_cfg_t *cfg); - -/** - * Create zrtp test session - * - * @param endpoint - test endpoint creating endpoint should belong to - * @param cfg - session parameters - * @param id - created session identifier will be placed here - * @return zrtp_status_ok on success or some of zrtp_status_t error codes on failure - */ -zrtp_status_t zrtp_test_session_create(zrtp_test_id_t endpoint, - zrtp_test_session_cfg_t *cfg, - zrtp_test_id_t *id); - -zrtp_status_t zrtp_test_session_destroy(zrtp_test_id_t id); - -zrtp_status_t zrtp_test_session_get(zrtp_test_id_t id, zrtp_test_session_info_t *info); - -/** - * Get stream Id by it's index in zrtp session - * - * @param session_id - zrtp test session id where needed stream should be taken - * @param idx - stream index - * @return found stream id, or ZRTP_TEST_UNKNOWN_ID if idex is out of stream array range - */ -zrtp_test_id_t zrtp_test_session_get_stream_by_idx(zrtp_test_id_t session_id, unsigned idx); - -zrtp_status_t zrtp_test_stream_get(zrtp_test_id_t id, zrtp_test_stream_info_t *info); - -zrtp_status_t zrtp_test_channel_create(zrtp_test_id_t left_stream, zrtp_test_id_t right_stream, zrtp_test_id_t *id); -zrtp_status_t zrtp_test_channel_create2(zrtp_test_id_t left_session, zrtp_test_id_t right_session, unsigned stream_idx, zrtp_test_id_t *id); -zrtp_status_t zrtp_test_channel_destroy(zrtp_test_id_t id); -zrtp_status_t zrtp_test_channel_start(zrtp_test_id_t id); -zrtp_status_t zrtp_test_channel_get(zrtp_test_id_t id, zrtp_test_channel_info_t *info); - -zrtp_stream_t *zrtp_stream_for_test_stream(zrtp_test_id_t stream_id); - -unsigned zrtp_stream_did_event_receive(zrtp_test_id_t stream_id, unsigned event); - - diff --git a/libs/libzrtp/test/zrtphash_test.c b/libs/libzrtp/test/zrtphash_test.c deleted file mode 100644 index 0566148914..0000000000 --- a/libs/libzrtp/test/zrtphash_test.c +++ /dev/null @@ -1,113 +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 <v.krikun at zfoneproject.com> - */ - -#include "engine_helpers.c" - -static void setup() { - zrtp_status_t s; - - zrtp_test_endpoint_cfg_t endpoint_cfg; - zrtp_test_endpoint_config_defaults(&endpoint_cfg); - - s = zrtp_test_endpoint_create(&endpoint_cfg, "Alice", &g_alice); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_alice); - - s = zrtp_test_endpoint_create(&endpoint_cfg, "Bob", &g_bob); - assert_int_equal(zrtp_status_ok, s); - assert_int_not_equal(ZRTP_TEST_UNKNOWN_ID, g_bob); -} - -static void teardown() { - zrtp_test_endpoint_destroy(g_alice); - zrtp_test_endpoint_destroy(g_bob); -} - - -static void zrtp_hash_export_import_sunny_test() { - zrtp_status_t s; - char alice_zrtp_hash[ZRTP_SIGN_ZRTP_HASH_LENGTH]; - char bob_zrtp_hash[ZRTP_SIGN_ZRTP_HASH_LENGTH]; - zrtp_stream_t *alice_zrtp_stream, *bob_zrtp_stream; - - /* Create two test sessions, one for Alice and one for Bob and link them into test secure channel */ - prepare_alice_bob(); - - alice_zrtp_stream = zrtp_stream_for_test_stream(zrtp_test_session_get_stream_by_idx(g_alice_sid, 0)); - bob_zrtp_stream = zrtp_stream_for_test_stream(zrtp_test_session_get_stream_by_idx(g_bob_sid, 0)); - assert_non_null(alice_zrtp_stream); assert_non_null(bob_zrtp_stream); - - /* Take Alice's hash and give it to Bob */ - s = zrtp_signaling_hash_get(alice_zrtp_stream, alice_zrtp_hash, sizeof(alice_zrtp_hash)); - assert_int_equal(zrtp_status_ok, s); - - s = zrtp_signaling_hash_set(bob_zrtp_stream, alice_zrtp_hash, ZRTP_SIGN_ZRTP_HASH_LENGTH); - assert_int_equal(zrtp_status_ok, s); - - /* Take Bob's hash and give it to Alice */ - s = zrtp_signaling_hash_get(bob_zrtp_stream, bob_zrtp_hash, sizeof(bob_zrtp_hash)); - assert_int_equal(zrtp_status_ok, s); - - s = zrtp_signaling_hash_set(alice_zrtp_stream, bob_zrtp_hash, ZRTP_SIGN_ZRTP_HASH_LENGTH); - assert_int_equal(zrtp_status_ok, s); - - /* Start and wait for Secure */ - start_alice_bob_and_wait4secure(); - - /* Check if ZRTP_EVENT_WRONG_SIGNALING_HASH was not triggered for any of test endpoints */ - assert_false(zrtp_stream_did_event_receive(zrtp_test_session_get_stream_by_idx(g_alice_sid, 0), - ZRTP_EVENT_WRONG_SIGNALING_HASH)); - - assert_false(zrtp_stream_did_event_receive(zrtp_test_session_get_stream_by_idx(g_bob_sid, 0), - ZRTP_EVENT_WRONG_SIGNALING_HASH)); - - /* Release test setup */ - release_alice_bob(); -} - -static void zrtp_hash_import_wrong_test() { - zrtp_status_t s; - char wrong_alice_zrtp_hash[ZRTP_SIGN_ZRTP_HASH_LENGTH]; - zrtp_stream_t *bob_zrtp_stream; - - /* Create two test sessions, one for Alice and one for Bob and link them into test secure channel */ - prepare_alice_bob(); - - bob_zrtp_stream = zrtp_stream_for_test_stream(zrtp_test_session_get_stream_by_idx(g_bob_sid, 0)); - assert_non_null(bob_zrtp_stream); - - /* Let's provide wrong hash to bob */ - zrtp_memset(wrong_alice_zrtp_hash, 6, ZRTP_SIGN_ZRTP_HASH_LENGTH); - - s = zrtp_signaling_hash_set(bob_zrtp_stream, wrong_alice_zrtp_hash, ZRTP_SIGN_ZRTP_HASH_LENGTH); - assert_int_equal(zrtp_status_ok, s); - - /* Start and wait for Secure */ - start_alice_bob_and_wait4secure(); - - /* Check if Alice don't receive ZRTP_EVENT_WRONG_SIGNALING_HASH, but Bob should get one */ - assert_false(zrtp_stream_did_event_receive(zrtp_test_session_get_stream_by_idx(g_alice_sid, 0), - ZRTP_EVENT_WRONG_SIGNALING_HASH)); - - assert_true(zrtp_stream_did_event_receive(zrtp_test_session_get_stream_by_idx(g_bob_sid, 0), - ZRTP_EVENT_WRONG_SIGNALING_HASH)); - - /* Release test setup */ - release_alice_bob(); -} - - -int main(void) { - const UnitTest tests[] = { - unit_test_setup_teardown(zrtp_hash_export_import_sunny_test, setup, teardown), - unit_test_setup_teardown(zrtp_hash_import_wrong_test, setup, teardown), - }; - - return run_tests(tests); -} diff --git a/libs/libzrtp/third_party/bgaes/aes.h b/libs/libzrtp/third_party/bgaes/aes.h deleted file mode 100644 index f103b5d25b..0000000000 --- a/libs/libzrtp/third_party/bgaes/aes.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 - - This file contains the definitions required to use AES in C. See aesopt.h - for optimisation details. -*/ - -#ifndef __aes_h__ -#define __aes_h__ - -#include <stdlib.h> - - -//#include "zrtp_types.h" - -/* This include is used to find 8 & 32 bit unsigned integer types */ -#include "brg_types.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#ifndef ZRTP_RESTRICT -#define AES_128 /* define if AES with 128 bit keys is needed */ -#define AES_192 /* define if AES with 192 bit keys is needed */ -#define AES_256 /* define if AES with 256 bit keys is needed */ -#define AES_VAR /* define if a variable key size is needed */ -#define AES_MODES /* define if support is needed for modes */ -#else -#define AES_128 /* define if AES with 128 bit keys is needed */ -#define AES_256 /* define if AES with 256 bit keys is needed */ -#define AES_MODES /* define if support is needed for modes */ -#endif //ZRTP_RESTRICT - -/* The following must also be set in assembler files if being used */ - -#define AES_ENCRYPT /* if support for encryption is needed */ - -#ifndef ZRTP_RESTRICT -#define AES_DECRYPT /* if support for decryption is needed */ -#define AES_ERR_CHK /* for parameter checks & error return codes */ -#define AES_REV_DKS /* define to reverse decryption key schedule */ -#else -#define AES_DECRYPT /* if support for decryption is needed */ -#define AES_ERR_CHK /* for parameter checks & error return codes */ -#endif //ZRTP_RESTRICT - -#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */ -#define N_COLS 4 /* the number of columns in the state */ - -/* The key schedule length is 11, 13 or 15 16-byte blocks for 128, */ -/* 192 or 256-bit keys respectively. That is 176, 208 or 240 bytes */ -/* or 44, 52 or 60 32-bit words. */ - -#if defined( AES_VAR ) || defined( AES_256 ) -#define KS_LENGTH 60 -#elif defined( AES_192 ) -#define KS_LENGTH 52 -#else -#define KS_LENGTH 44 -#endif - -#if defined( AES_ERR_CHK ) -#define AES_RETURN INT_RETURN -#else -#define AES_RETURN VOID_RETURN -#endif - -/* the character array 'inf' in the following structures is used */ -/* to hold AES context information. This AES code uses cx->inf.b[0] */ -/* to hold the number of rounds multiplied by 16. The other three */ -/* elements can be used by code that implements additional modes */ - -typedef union -{ uint_32t l; - uint_8t b[4]; -} aes_inf; - -typedef struct -{ uint_32t ks[KS_LENGTH]; - aes_inf inf; -} aes_encrypt_ctx; - -typedef struct -{ uint_32t ks[KS_LENGTH]; - aes_inf inf; -} aes_decrypt_ctx; - -/* This routine must be called before first use if non-static */ -/* tables are being used */ - -AES_RETURN zrtp_bg_gen_tabs(void); - -/* Key lengths in the range 16 <= key_len <= 32 are given in bytes, */ -/* those in the range 128 <= key_len <= 256 are given in bits */ - -#if defined( AES_ENCRYPT ) - -#if defined(AES_128) || defined(AES_VAR) -AES_RETURN zrtp_bg_aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_192) || defined(AES_VAR) -AES_RETURN zrtp_bg_aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_256) || defined(AES_VAR) -AES_RETURN zrtp_bg_aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_VAR) -AES_RETURN zrtp_bg_aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]); -#endif - -AES_RETURN zrtp_bg_aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]); - -#endif - -#if defined( AES_DECRYPT ) - -#if defined(AES_128) || defined(AES_VAR) -AES_RETURN zrtp_bg_aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_192) || defined(AES_VAR) -AES_RETURN zrtp_bg_aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_256) || defined(AES_VAR) -AES_RETURN zrtp_bg_aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_VAR) -AES_RETURN zrtp_bg_aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]); -#endif - -AES_RETURN zrtp_bg_aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]); - -#endif - -#if defined(AES_MODES) - -/* Multiple calls to the following subroutines for multiple block */ -/* ECB, CBC, CFB, OFB and CTR mode encryption can be used to handle */ -/* long messages incremantally provided that the context AND the iv */ -/* are preserved between all such calls. For the ECB and CBC modes */ -/* each individual call within a series of incremental calls must */ -/* process only full blocks (i.e. len must be a multiple of 16) but */ -/* the CFB, OFB and CTR mode calls can handle multiple incremental */ -/* calls of any length. Each mode is reset when a new AES key is */ -/* set but ECB and CBC operations can be reset without setting a */ -/* new key by setting a new IV value. To reset CFB, OFB and CTR */ -/* without setting the key, zrtp_bg_aes_mode_reset() must be called and the */ -/* IV must be set. NOTE: All these calls update the IV on exit so */ -/* this has to be reset if a new operation with the same IV as the */ -/* previous one is required (or decryption follows encryption with */ -/* the same IV array). */ - -AES_RETURN zrtp_bg_aes_ecb_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, const aes_encrypt_ctx cx[1]); - -AES_RETURN zrtp_bg_aes_ecb_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, const aes_decrypt_ctx cx[1]); - -#ifndef ZRTP_RESTRICT -AES_RETURN zrtp_bg_aes_cbc_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, const aes_encrypt_ctx cx[1]); - -AES_RETURN zrtp_bg_aes_cbc_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, const aes_decrypt_ctx cx[1]); -#endif //ZRTP_RESTRICT - -AES_RETURN zrtp_bg_aes_mode_reset(aes_encrypt_ctx cx[1]); - -AES_RETURN zrtp_bg_aes_cfb_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx cx[1]); - -AES_RETURN zrtp_bg_aes_cfb_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx cx[1]); -#ifndef ZRTP_RESTRICT -#define zrtp_bg_aes_ofb_encrypt zrtp_bg_aes_ofb_crypt -#define zrtp_bg_aes_ofb_decrypt zrtp_bg_aes_ofb_crypt - -AES_RETURN aes_ofb_crypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx cx[1]); -#endif //ZRTP_RESTRICT - -typedef void cbuf_inc(unsigned char *cbuf); - -#define zrtp_bg_aes_ctr_encrypt zrtp_bg_aes_ctr_crypt -#define zrtp_bg_aes_ctr_decrypt zrtp_bg_aes_ctr_crypt - -//[winfix] -AES_RETURN zrtp_bg_aes_ctr_crypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *cbuf, cbuf_inc ctr_inc, aes_encrypt_ctx cx[1]); - -#endif - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/libs/libzrtp/third_party/bgaes/aes_modes.c b/libs/libzrtp/third_party/bgaes/aes_modes.c deleted file mode 100644 index 25b94a8e8b..0000000000 --- a/libs/libzrtp/third_party/bgaes/aes_modes.c +++ /dev/null @@ -1,914 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 - - These subroutines implement multiple block AES modes for ECB, CBC, CFB, - OFB and CTR encryption, The code provides support for the VIA Advanced - Cryptography Engine (ACE). - - NOTE: In the following subroutines, the AES contexts (ctx) must be - 16 byte aligned if VIA ACE is being used -*/ - -#include <string.h> -#include <assert.h> - -#include "aesopt.h" - -#if defined( AES_MODES ) -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if defined( _MSC_VER ) && ( _MSC_VER > 800 ) -#pragma intrinsic(memcpy) -#define in_line __inline -#else -#define in_line -#endif - -#define BFR_BLOCKS 8 - -/* These values are used to detect long word alignment in order to */ -/* speed up some buffer operations. This facility may not work on */ -/* some machines so this define can be commented out if necessary */ - -#define FAST_BUFFER_OPERATIONS - -#define lp32(x) ((uint_32t*)(x)) - -//[{] - -#if defined( _MSC_VER ) && ( _MSC_VER > 1200 ) -# define aligned_uint_8t(n) __declspec(align(n)) uint_8t _zrtp_bg_al_##n -#elif defined( __GNUC__ ) || (__MWERKS__) -# define aligned_uint_8t(n) uint_8t _zrtp_bg_al_##n __attribute__ ((aligned(n))) -#else // disabled for VC6 -# undef FAST_BUFFER_OPERATIONS -#endif - -#ifdef FAST_BUFFER_OPERATIONS - -aligned_uint_8t( 4); /* a variable that is 4 byte aligned */ -aligned_uint_8t(16); /* a variable that is 16 byte aligned */ - -#define addr_offset(x,n) (((uint_8t*)(x) - &_zrtp_bg_al_##n) & ((n) - 1)) - -#endif - -//[}] - -#if defined( USE_VIA_ACE_IF_PRESENT ) - - -#include "aes_via_ace.h" - -#pragma pack(16) - -aligned_array(unsigned long, enc_gen_table, 12, 16) = NEH_ENC_GEN_DATA; -aligned_array(unsigned long, enc_load_table, 12, 16) = NEH_ENC_LOAD_DATA; -aligned_array(unsigned long, enc_hybrid_table, 12, 16) = NEH_ENC_HYBRID_DATA; -aligned_array(unsigned long, dec_gen_table, 12, 16) = NEH_DEC_GEN_DATA; -aligned_array(unsigned long, dec_load_table, 12, 16) = NEH_DEC_LOAD_DATA; -aligned_array(unsigned long, dec_hybrid_table, 12, 16) = NEH_DEC_HYBRID_DATA; - -/* NOTE: These control word macros must only be used after */ -/* a key has been set up because they depend on key size */ - -#if NEH_KEY_TYPE == NEH_LOAD -#define kd_adr(c) ((uint_8t*)(c)->ks) -#elif NEH_KEY_TYPE == NEH_GENERATE -#define kd_adr(c) ((uint_8t*)(c)->ks + (c)->inf.b[0]) -#else -#define kd_adr(c) ((uint_8t*)(c)->ks + ((c)->inf.b[0] == 160 ? 160 : 0)) -#endif - -#else - -#define aligned_array(type, name, no, stride) type name[no] -#define aligned_auto(type, name, no, stride) type name[no] - -#endif - -#if defined( _MSC_VER ) && _MSC_VER > 1200 - -#define via_cwd(cwd, ty, dir, len) \ - unsigned long* cwd = (dir##_##ty##_table + ((len - 128) >> 4)) - -#else - -#define via_cwd(cwd, ty, dir, len) \ - aligned_auto(unsigned long, cwd, 4, 16); \ - cwd[1] = cwd[2] = cwd[3] = 0; \ - cwd[0] = neh_##dir##_##ty##_key(len) - -#endif - -AES_RETURN zrtp_bg_aes_mode_reset(aes_encrypt_ctx ctx[1]) -{ - ctx->inf.b[2] = 0; - return EXIT_SUCCESS; -} - -AES_RETURN zrtp_bg_aes_ecb_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, const aes_encrypt_ctx ctx[1]) -{ int nb = len >> 4; - - if(len & (AES_BLOCK_SIZE - 1)) - return EXIT_FAILURE; - -#if defined( USE_VIA_ACE_IF_PRESENT ) - - if(ctx->inf.b[1] == 0xff) - { uint_8t *ksp = (uint_8t*)(ctx->ks); - via_cwd(cwd, hybrid, enc, 2 * ctx->inf.b[0] - 192); - - if(addr_offset( ctx, 16 )) - return EXIT_FAILURE; - - if(!addr_offset( ibuf, 16 ) && !addr_offset( obuf, 16 )) - { - via_ecb_op5(ksp,cwd,ibuf,obuf,nb); - } - else - { aligned_auto(uint_8t, buf, BFR_BLOCKS * AES_BLOCK_SIZE, 16); - uint_8t *ip, *op; - - while(nb) - { - int m = (nb > BFR_BLOCKS ? BFR_BLOCKS : nb); - - ip = (addr_offset( ibuf, 16 ) ? buf : (uint_8t*)ibuf); - op = (addr_offset( obuf, 16 ) ? buf : obuf); - - if(ip != ibuf) - memcpy(buf, ibuf, m * AES_BLOCK_SIZE); - - via_ecb_op5(ksp,cwd,ip,op,m); - - if(op != obuf) - memcpy(obuf, buf, m * AES_BLOCK_SIZE); - - ibuf += m * AES_BLOCK_SIZE; - obuf += m * AES_BLOCK_SIZE; - nb -= m; - } - } - - return EXIT_SUCCESS; - } - -#endif - -#if !defined( ASSUME_VIA_ACE_PRESENT ) - while(nb--) - { - zrtp_bg_aes_encrypt(ibuf, obuf, ctx); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } -#endif - return EXIT_SUCCESS; -} - -AES_RETURN zrtp_bg_aes_ecb_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, const aes_decrypt_ctx ctx[1]) -{ int nb = len >> 4; - - if(len & (AES_BLOCK_SIZE - 1)) - return EXIT_FAILURE; - -#if defined( USE_VIA_ACE_IF_PRESENT ) - - if(ctx->inf.b[1] == 0xff) - { uint_8t *ksp = kd_adr(ctx); - via_cwd(cwd, hybrid, dec, 2 * ctx->inf.b[0] - 192); - - if(addr_offset( ctx, 16 )) - return EXIT_FAILURE; - - if(!addr_offset( ibuf, 16 ) && !addr_offset( obuf, 16 )) - { - via_ecb_op5(ksp,cwd,ibuf,obuf,nb); - } - else - { aligned_auto(uint_8t, buf, BFR_BLOCKS * AES_BLOCK_SIZE, 16); - uint_8t *ip, *op; - - while(nb) - { - int m = (nb > BFR_BLOCKS ? BFR_BLOCKS : nb); - - ip = (addr_offset( ibuf, 16 ) ? buf : (uint_8t*)ibuf); - op = (addr_offset( obuf, 16 ) ? buf : obuf); - - if(ip != ibuf) - memcpy(buf, ibuf, m * AES_BLOCK_SIZE); - - via_ecb_op5(ksp,cwd,ip,op,m); - - if(op != obuf) - memcpy(obuf, buf, m * AES_BLOCK_SIZE); - - ibuf += m * AES_BLOCK_SIZE; - obuf += m * AES_BLOCK_SIZE; - nb -= m; - } - } - - return EXIT_SUCCESS; - } - -#endif - -#if !defined( ASSUME_VIA_ACE_PRESENT ) - while(nb--) - { - zrtp_bg_aes_decrypt(ibuf, obuf, ctx); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } -#endif - return EXIT_SUCCESS; -} - -#ifndef ZRTP_RESTRICT -AES_RETURN zrtp_bg_aes_cbc_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, const aes_encrypt_ctx ctx[1]) -{ int nb = len >> 4; - - if(len & (AES_BLOCK_SIZE - 1)) - return EXIT_FAILURE; - -#if defined( USE_VIA_ACE_IF_PRESENT ) - - if(ctx->inf.b[1] == 0xff) - { uint_8t *ksp = (uint_8t*)(ctx->ks), *ivp = iv; - aligned_auto(uint_8t, liv, AES_BLOCK_SIZE, 16); - via_cwd(cwd, hybrid, enc, 2 * ctx->inf.b[0] - 192); - - if(addr_offset( ctx, 16 )) - return EXIT_FAILURE; - - if(addr_offset( iv, 16 )) /* ensure an aligned iv */ - { - ivp = liv; - memcpy(liv, iv, AES_BLOCK_SIZE); - } - - if(!addr_offset( ibuf, 16 ) && !addr_offset( obuf, 16 ) && !addr_offset( iv, 16 )) - { - via_cbc_op7(ksp,cwd,ibuf,obuf,nb,ivp,ivp); - } - else - { aligned_auto(uint_8t, buf, BFR_BLOCKS * AES_BLOCK_SIZE, 16); - uint_8t *ip, *op; - - while(nb) - { - int m = (nb > BFR_BLOCKS ? BFR_BLOCKS : nb); - - ip = (addr_offset( ibuf, 16 ) ? buf : (uint_8t*)ibuf); - op = (addr_offset( obuf, 16 ) ? buf : obuf); - - if(ip != ibuf) - memcpy(buf, ibuf, m * AES_BLOCK_SIZE); - - via_cbc_op7(ksp,cwd,ip,op,m,ivp,ivp); - - if(op != obuf) - memcpy(obuf, buf, m * AES_BLOCK_SIZE); - - ibuf += m * AES_BLOCK_SIZE; - obuf += m * AES_BLOCK_SIZE; - nb -= m; - } - } - - if(iv != ivp) - memcpy(iv, ivp, AES_BLOCK_SIZE); - - return EXIT_SUCCESS; - } - -#endif - -#if !defined( ASSUME_VIA_ACE_PRESENT ) -# ifdef FAST_BUFFER_OPERATIONS - if(!addr_offset( ibuf, 4 ) && !addr_offset( iv, 4 )) - while(nb--) - { - lp32(iv)[0] ^= lp32(ibuf)[0]; - lp32(iv)[1] ^= lp32(ibuf)[1]; - lp32(iv)[2] ^= lp32(ibuf)[2]; - lp32(iv)[3] ^= lp32(ibuf)[3]; - zrtp_bg_aes_encrypt(iv, iv, ctx); - memcpy(obuf, iv, AES_BLOCK_SIZE); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } - else -# endif - while(nb--) - { - iv[ 0] ^= ibuf[ 0]; iv[ 1] ^= ibuf[ 1]; - iv[ 2] ^= ibuf[ 2]; iv[ 3] ^= ibuf[ 3]; - iv[ 4] ^= ibuf[ 4]; iv[ 5] ^= ibuf[ 5]; - iv[ 6] ^= ibuf[ 6]; iv[ 7] ^= ibuf[ 7]; - iv[ 8] ^= ibuf[ 8]; iv[ 9] ^= ibuf[ 9]; - iv[10] ^= ibuf[10]; iv[11] ^= ibuf[11]; - iv[12] ^= ibuf[12]; iv[13] ^= ibuf[13]; - iv[14] ^= ibuf[14]; iv[15] ^= ibuf[15]; - zrtp_bg_aes_encrypt(iv, iv, ctx); - memcpy(obuf, iv, AES_BLOCK_SIZE); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } -#endif - return EXIT_SUCCESS; -} - -AES_RETURN zrtp_bg_aes_cbc_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, const aes_decrypt_ctx ctx[1]) -{ unsigned char tmp[AES_BLOCK_SIZE]; - int nb = len >> 4; - - if(len & (AES_BLOCK_SIZE - 1)) - return EXIT_FAILURE; - -#if defined( USE_VIA_ACE_IF_PRESENT ) - - if(ctx->inf.b[1] == 0xff) - { uint_8t *ksp = kd_adr(ctx), *ivp = iv; - aligned_auto(uint_8t, liv, AES_BLOCK_SIZE, 16); - via_cwd(cwd, hybrid, dec, 2 * ctx->inf.b[0] - 192); - - if(addr_offset( ctx, 16 )) - return EXIT_FAILURE; - - if(addr_offset( iv, 16 )) /* ensure an aligned iv */ - { - ivp = liv; - memcpy(liv, iv, AES_BLOCK_SIZE); - } - - if(!addr_offset( ibuf, 16 ) && !addr_offset( obuf, 16 ) && !addr_offset( iv, 16 )) - { - via_cbc_op6(ksp,cwd,ibuf,obuf,nb,ivp); - } - else - { aligned_auto(uint_8t, buf, BFR_BLOCKS * AES_BLOCK_SIZE, 16); - uint_8t *ip, *op; - - while(nb) - { - int m = (nb > BFR_BLOCKS ? BFR_BLOCKS : nb); - - ip = (addr_offset( ibuf, 16 ) ? buf : (uint_8t*)ibuf); - op = (addr_offset( obuf, 16 ) ? buf : obuf); - - if(ip != ibuf) - memcpy(buf, ibuf, m * AES_BLOCK_SIZE); - - via_cbc_op6(ksp,cwd,ip,op,m,ivp); - - if(op != obuf) - memcpy(obuf, buf, m * AES_BLOCK_SIZE); - - ibuf += m * AES_BLOCK_SIZE; - obuf += m * AES_BLOCK_SIZE; - nb -= m; - } - } - - if(iv != ivp) - memcpy(iv, ivp, AES_BLOCK_SIZE); - - return EXIT_SUCCESS; - } -#endif - -#if !defined( ASSUME_VIA_ACE_PRESENT ) -# ifdef FAST_BUFFER_OPERATIONS - if(!addr_offset( obuf, 4 ) && !addr_offset( iv, 4 )) - while(nb--) - { - memcpy(tmp, ibuf, AES_BLOCK_SIZE); - zrtp_bg_aes_decrypt(ibuf, obuf, ctx); - lp32(obuf)[0] ^= lp32(iv)[0]; - lp32(obuf)[1] ^= lp32(iv)[1]; - lp32(obuf)[2] ^= lp32(iv)[2]; - lp32(obuf)[3] ^= lp32(iv)[3]; - memcpy(iv, tmp, AES_BLOCK_SIZE); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } - else -# endif - while(nb--) - { - memcpy(tmp, ibuf, AES_BLOCK_SIZE); - zrtp_bg_aes_decrypt(ibuf, obuf, ctx); - obuf[ 0] ^= iv[ 0]; obuf[ 1] ^= iv[ 1]; - obuf[ 2] ^= iv[ 2]; obuf[ 3] ^= iv[ 3]; - obuf[ 4] ^= iv[ 4]; obuf[ 5] ^= iv[ 5]; - obuf[ 6] ^= iv[ 6]; obuf[ 7] ^= iv[ 7]; - obuf[ 8] ^= iv[ 8]; obuf[ 9] ^= iv[ 9]; - obuf[10] ^= iv[10]; obuf[11] ^= iv[11]; - obuf[12] ^= iv[12]; obuf[13] ^= iv[13]; - obuf[14] ^= iv[14]; obuf[15] ^= iv[15]; - memcpy(iv, tmp, AES_BLOCK_SIZE); - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } -#endif - return EXIT_SUCCESS; -} -#endif //ZRTP_RESTRICT - -AES_RETURN zrtp_bg_aes_cfb_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx ctx[1]) -{ int cnt = 0, b_pos = (int)ctx->inf.b[2], nb; - - if(b_pos) /* complete any partial block */ - { - while(b_pos < AES_BLOCK_SIZE && cnt < len) - *obuf++ = iv[b_pos++] ^= *ibuf++, cnt++; - - b_pos = (b_pos == AES_BLOCK_SIZE ? 0 : b_pos); - } - - if((nb = (len - cnt) >> 4) != 0) /* process whole blocks */ - { -#if defined( USE_VIA_ACE_IF_PRESENT ) - - if(ctx->inf.b[1] == 0xff) - { int m; - uint_8t *ksp = (uint_8t*)(ctx->ks), *ivp = iv; - aligned_auto(uint_8t, liv, AES_BLOCK_SIZE, 16); - via_cwd(cwd, hybrid, enc, 2 * ctx->inf.b[0] - 192); - - if(addr_offset( ctx, 16 )) - return EXIT_FAILURE; - - if(addr_offset( iv, 16 )) /* ensure an aligned iv */ - { - ivp = liv; - memcpy(liv, iv, AES_BLOCK_SIZE); - } - - if(!addr_offset( ibuf, 16 ) && !addr_offset( obuf, 16 )) - { - via_cfb_op7(ksp, cwd, ibuf, obuf, nb, ivp, ivp); - ibuf += nb * AES_BLOCK_SIZE; - obuf += nb * AES_BLOCK_SIZE; - cnt += nb * AES_BLOCK_SIZE; - } - else /* input, output or both are unaligned */ - { aligned_auto(uint_8t, buf, BFR_BLOCKS * AES_BLOCK_SIZE, 16); - uint_8t *ip, *op; - - while(nb) - { - m = (nb > BFR_BLOCKS ? BFR_BLOCKS : nb), nb -= m; - - ip = (addr_offset( ibuf, 16 ) ? buf : (uint_8t*)ibuf); - op = (addr_offset( obuf, 16 ) ? buf : obuf); - - if(ip != ibuf) - memcpy(buf, ibuf, m * AES_BLOCK_SIZE); - - via_cfb_op7(ksp, cwd, ip, op, m, ivp, ivp); - - if(op != obuf) - memcpy(obuf, buf, m * AES_BLOCK_SIZE); - - ibuf += m * AES_BLOCK_SIZE; - obuf += m * AES_BLOCK_SIZE; - cnt += m * AES_BLOCK_SIZE; - } - } - - if(ivp != iv) - memcpy(iv, ivp, AES_BLOCK_SIZE); - } -#else -# ifdef FAST_BUFFER_OPERATIONS - if(!addr_offset( ibuf, 4 ) && !addr_offset( obuf, 4 ) && !addr_offset( iv, 4 )) - while(cnt + AES_BLOCK_SIZE <= len) - { - assert(b_pos == 0); - zrtp_bg_aes_encrypt(iv, iv, ctx); - lp32(obuf)[0] = lp32(iv)[0] ^= lp32(ibuf)[0]; - lp32(obuf)[1] = lp32(iv)[1] ^= lp32(ibuf)[1]; - lp32(obuf)[2] = lp32(iv)[2] ^= lp32(ibuf)[2]; - lp32(obuf)[3] = lp32(iv)[3] ^= lp32(ibuf)[3]; - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - cnt += AES_BLOCK_SIZE; - } - else -# endif - while(cnt + AES_BLOCK_SIZE <= len) - { - assert(b_pos == 0); - zrtp_bg_aes_encrypt(iv, iv, ctx); - obuf[ 0] = iv[ 0] ^= ibuf[ 0]; obuf[ 1] = iv[ 1] ^= ibuf[ 1]; - obuf[ 2] = iv[ 2] ^= ibuf[ 2]; obuf[ 3] = iv[ 3] ^= ibuf[ 3]; - obuf[ 4] = iv[ 4] ^= ibuf[ 4]; obuf[ 5] = iv[ 5] ^= ibuf[ 5]; - obuf[ 6] = iv[ 6] ^= ibuf[ 6]; obuf[ 7] = iv[ 7] ^= ibuf[ 7]; - obuf[ 8] = iv[ 8] ^= ibuf[ 8]; obuf[ 9] = iv[ 9] ^= ibuf[ 9]; - obuf[10] = iv[10] ^= ibuf[10]; obuf[11] = iv[11] ^= ibuf[11]; - obuf[12] = iv[12] ^= ibuf[12]; obuf[13] = iv[13] ^= ibuf[13]; - obuf[14] = iv[14] ^= ibuf[14]; obuf[15] = iv[15] ^= ibuf[15]; - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - cnt += AES_BLOCK_SIZE; - } -#endif - } - - while(cnt < len) - { - if(!b_pos) - zrtp_bg_aes_ecb_encrypt(iv, iv, AES_BLOCK_SIZE, ctx); - - while(cnt < len && b_pos < AES_BLOCK_SIZE) - *obuf++ = iv[b_pos++] ^= *ibuf++, cnt++; - - b_pos = (b_pos == AES_BLOCK_SIZE ? 0 : b_pos); - } - - ctx->inf.b[2] = (uint_8t)b_pos; - return EXIT_SUCCESS; -} - -AES_RETURN zrtp_bg_aes_cfb_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx ctx[1]) -{ int cnt = 0, b_pos = (int)ctx->inf.b[2], nb; - - if(b_pos) /* complete any partial block */ - { uint_8t t; - - while(b_pos < AES_BLOCK_SIZE && cnt < len) - t = *ibuf++, *obuf++ = t ^ iv[b_pos], iv[b_pos++] = t, cnt++; - - b_pos = (b_pos == AES_BLOCK_SIZE ? 0 : b_pos); - } - - if((nb = (len - cnt) >> 4) != 0) /* process whole blocks */ - { -#if defined( USE_VIA_ACE_IF_PRESENT ) - - if(ctx->inf.b[1] == 0xff) - { int m; - uint_8t *ksp = (uint_8t*)(ctx->ks), *ivp = iv; - aligned_auto(uint_8t, liv, AES_BLOCK_SIZE, 16); - via_cwd(cwd, hybrid, dec, 2 * ctx->inf.b[0] - 192); - - if(addr_offset( ctx, 16 )) - return EXIT_FAILURE; - - if(addr_offset( iv, 16 )) /* ensure an aligned iv */ - { - ivp = liv; - memcpy(liv, iv, AES_BLOCK_SIZE); - } - - if(!addr_offset( ibuf, 16 ) && !addr_offset( obuf, 16 )) - { - via_cfb_op6(ksp, cwd, ibuf, obuf, nb, ivp); - ibuf += nb * AES_BLOCK_SIZE; - obuf += nb * AES_BLOCK_SIZE; - cnt += nb * AES_BLOCK_SIZE; - } - else /* input, output or both are unaligned */ - { aligned_auto(uint_8t, buf, BFR_BLOCKS * AES_BLOCK_SIZE, 16); - uint_8t *ip, *op; - - while(nb) - { - m = (nb > BFR_BLOCKS ? BFR_BLOCKS : nb), nb -= m; - - ip = (addr_offset( ibuf, 16 ) ? buf : (uint_8t*)ibuf); - op = (addr_offset( obuf, 16 ) ? buf : op); - - if(ip != ibuf) - memcpy(buf, ibuf, m * AES_BLOCK_SIZE); - - via_cfb_op6(ksp, cwd, ip, op, m, ivp); - - if(op != obuf) - memcpy(obuf, buf, m * AES_BLOCK_SIZE); - - ibuf += m * AES_BLOCK_SIZE; - obuf += m * AES_BLOCK_SIZE; - cnt += m * AES_BLOCK_SIZE; - } - } - - if(ivp != iv) - memcpy(iv, ivp, AES_BLOCK_SIZE); - } -#else -# ifdef FAST_BUFFER_OPERATIONS - if(!addr_offset( ibuf, 4 ) && !addr_offset( obuf, 4 ) &&!addr_offset( iv, 4 )) - while(cnt + AES_BLOCK_SIZE <= len) - { uint_32t t; - - assert(b_pos == 0); - zrtp_bg_aes_encrypt(iv, iv, ctx); - t = lp32(ibuf)[0], lp32(obuf)[0] = t ^ lp32(iv)[0], lp32(iv)[0] = t; - t = lp32(ibuf)[1], lp32(obuf)[1] = t ^ lp32(iv)[1], lp32(iv)[1] = t; - t = lp32(ibuf)[2], lp32(obuf)[2] = t ^ lp32(iv)[2], lp32(iv)[2] = t; - t = lp32(ibuf)[3], lp32(obuf)[3] = t ^ lp32(iv)[3], lp32(iv)[3] = t; - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - cnt += AES_BLOCK_SIZE; - } - else -# endif - while(cnt + AES_BLOCK_SIZE <= len) - { uint_8t t; - - assert(b_pos == 0); - zrtp_bg_aes_encrypt(iv, iv, ctx); - t = ibuf[ 0], obuf[ 0] = t ^ iv[ 0], iv[ 0] = t; - t = ibuf[ 1], obuf[ 1] = t ^ iv[ 1], iv[ 1] = t; - t = ibuf[ 2], obuf[ 2] = t ^ iv[ 2], iv[ 2] = t; - t = ibuf[ 3], obuf[ 3] = t ^ iv[ 3], iv[ 3] = t; - t = ibuf[ 4], obuf[ 4] = t ^ iv[ 4], iv[ 4] = t; - t = ibuf[ 5], obuf[ 5] = t ^ iv[ 5], iv[ 5] = t; - t = ibuf[ 6], obuf[ 6] = t ^ iv[ 6], iv[ 6] = t; - t = ibuf[ 7], obuf[ 7] = t ^ iv[ 7], iv[ 7] = t; - t = ibuf[ 8], obuf[ 8] = t ^ iv[ 8], iv[ 8] = t; - t = ibuf[ 9], obuf[ 9] = t ^ iv[ 9], iv[ 9] = t; - t = ibuf[10], obuf[10] = t ^ iv[10], iv[10] = t; - t = ibuf[11], obuf[11] = t ^ iv[11], iv[11] = t; - t = ibuf[12], obuf[12] = t ^ iv[12], iv[12] = t; - t = ibuf[13], obuf[13] = t ^ iv[13], iv[13] = t; - t = ibuf[14], obuf[14] = t ^ iv[14], iv[14] = t; - t = ibuf[15], obuf[15] = t ^ iv[15], iv[15] = t; - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - cnt += AES_BLOCK_SIZE; - } -#endif - } - - while(cnt < len) - { uint_8t t; - - if(!b_pos) - zrtp_bg_aes_ecb_encrypt(iv, iv, AES_BLOCK_SIZE, ctx); - - while(cnt < len && b_pos < AES_BLOCK_SIZE) - t = *ibuf++, *obuf++ = t ^ iv[b_pos], iv[b_pos++] = t, cnt++; - - b_pos = (b_pos == AES_BLOCK_SIZE ? 0 : b_pos); - } - - ctx->inf.b[2] = (uint_8t)b_pos; - return EXIT_SUCCESS; -} - -#ifndef ZRTP_RESTRICT -AES_RETURN zrtp_bg_aes_ofb_crypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx ctx[1]) -{ int cnt = 0, b_pos = (int)ctx->inf.b[2], nb; - - if(b_pos) /* complete any partial block */ - { - while(b_pos < AES_BLOCK_SIZE && cnt < len) - *obuf++ = iv[b_pos++] ^ *ibuf++, cnt++; - - b_pos = (b_pos == AES_BLOCK_SIZE ? 0 : b_pos); - } - - if((nb = (len - cnt) >> 4) != 0) /* process whole blocks */ - { -#if defined( USE_VIA_ACE_IF_PRESENT ) - - if(ctx->inf.b[1] == 0xff) - { int m; - uint_8t *ksp = (uint_8t*)(ctx->ks), *ivp = iv; - aligned_auto(uint_8t, liv, AES_BLOCK_SIZE, 16); - via_cwd(cwd, hybrid, enc, 2 * ctx->inf.b[0] - 192); - - if(addr_offset( ctx, 16 )) - return EXIT_FAILURE; - - if(addr_offset( iv, 16 )) /* ensure an aligned iv */ - { - ivp = liv; - memcpy(liv, iv, AES_BLOCK_SIZE); - } - - if(!addr_offset( ibuf, 16 ) && !addr_offset( obuf, 16 )) - { - via_ofb_op6(ksp, cwd, ibuf, obuf, nb, ivp); - ibuf += nb * AES_BLOCK_SIZE; - obuf += nb * AES_BLOCK_SIZE; - cnt += nb * AES_BLOCK_SIZE; - } - else /* input, output or both are unaligned */ - { aligned_auto(uint_8t, buf, BFR_BLOCKS * AES_BLOCK_SIZE, 16); - uint_8t *ip, *op; - - while(nb) - { - m = (nb > BFR_BLOCKS ? BFR_BLOCKS : nb), nb -= m; - - ip = (addr_offset( ibuf, 16 ) ? buf : (uint_8t*)ibuf); - op = (addr_offset( obuf, 16 ) ? buf : obuf); - - if(ip != ibuf) - memcpy(buf, ibuf, m * AES_BLOCK_SIZE); - - via_ofb_op6(ksp, cwd, ip, op, m, ivp); - - if(op != obuf) - memcpy(obuf, buf, m * AES_BLOCK_SIZE); - - ibuf += m * AES_BLOCK_SIZE; - obuf += m * AES_BLOCK_SIZE; - cnt += m * AES_BLOCK_SIZE; - } - } - - if(ivp != iv) - memcpy(iv, ivp, AES_BLOCK_SIZE); - } -#else -# ifdef FAST_BUFFER_OPERATIONS - if(!addr_offset( ibuf, 4 ) && !addr_offset( obuf, 4 ) && !addr_offset( iv, 4 )) - while(cnt + AES_BLOCK_SIZE <= len) - { - assert(b_pos == 0); - zrtp_bg_aes_encrypt(iv, iv, ctx); - lp32(obuf)[0] = lp32(iv)[0] ^ lp32(ibuf)[0]; - lp32(obuf)[1] = lp32(iv)[1] ^ lp32(ibuf)[1]; - lp32(obuf)[2] = lp32(iv)[2] ^ lp32(ibuf)[2]; - lp32(obuf)[3] = lp32(iv)[3] ^ lp32(ibuf)[3]; - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - cnt += AES_BLOCK_SIZE; - } - else -# endif - while(cnt + AES_BLOCK_SIZE <= len) - { - assert(b_pos == 0); - zrtp_bg_aes_encrypt(iv, iv, ctx); - obuf[ 0] = iv[ 0] ^ ibuf[ 0]; obuf[ 1] = iv[ 1] ^ ibuf[ 1]; - obuf[ 2] = iv[ 2] ^ ibuf[ 2]; obuf[ 3] = iv[ 3] ^ ibuf[ 3]; - obuf[ 4] = iv[ 4] ^ ibuf[ 4]; obuf[ 5] = iv[ 5] ^ ibuf[ 5]; - obuf[ 6] = iv[ 6] ^ ibuf[ 6]; obuf[ 7] = iv[ 7] ^ ibuf[ 7]; - obuf[ 8] = iv[ 8] ^ ibuf[ 8]; obuf[ 9] = iv[ 9] ^ ibuf[ 9]; - obuf[10] = iv[10] ^ ibuf[10]; obuf[11] = iv[11] ^ ibuf[11]; - obuf[12] = iv[12] ^ ibuf[12]; obuf[13] = iv[13] ^ ibuf[13]; - obuf[14] = iv[14] ^ ibuf[14]; obuf[15] = iv[15] ^ ibuf[15]; - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - cnt += AES_BLOCK_SIZE; - } -#endif - } - - while(cnt < len) - { - if(!b_pos) - zrtp_bg_aes_ecb_encrypt(iv, iv, AES_BLOCK_SIZE, ctx); - - while(cnt < len && b_pos < AES_BLOCK_SIZE) - *obuf++ = iv[b_pos++] ^ *ibuf++, cnt++; - - b_pos = (b_pos == AES_BLOCK_SIZE ? 0 : b_pos); - } - - ctx->inf.b[2] = (uint_8t)b_pos; - return EXIT_SUCCESS; -} -#endif //ZRTP_RESTRICT - -#define BFR_LENGTH (BFR_BLOCKS * AES_BLOCK_SIZE) - -AES_RETURN zrtp_bg_aes_ctr_crypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *cbuf, cbuf_inc ctr_inc, aes_encrypt_ctx ctx[1]) -{ uint_8t *ip; - int i, blen, b_pos = (int)(ctx->inf.b[2]); - -#if defined( USE_VIA_ACE_IF_PRESENT ) - aligned_auto(uint_8t, buf, BFR_LENGTH, 16); - if(ctx->inf.b[1] == 0xff && addr_offset( ctx, 16 )) - return EXIT_FAILURE; -#else - uint_8t buf[BFR_LENGTH]; -#endif - - if(b_pos) - { - memcpy(buf, cbuf, AES_BLOCK_SIZE); - zrtp_bg_aes_ecb_encrypt(buf, buf, AES_BLOCK_SIZE, ctx); - while(b_pos < AES_BLOCK_SIZE && len) - *obuf++ = *ibuf++ ^ buf[b_pos++], --len; - if(len) - ctr_inc(cbuf), b_pos = 0; - } - - while(len) - { - blen = (len > BFR_LENGTH ? BFR_LENGTH : len), len -= blen; - - for(i = 0, ip = buf; i < (blen >> 4); ++i) - { - memcpy(ip, cbuf, AES_BLOCK_SIZE); - ctr_inc(cbuf); - ip += AES_BLOCK_SIZE; - } - - if(blen & (AES_BLOCK_SIZE - 1)) - memcpy(ip, cbuf, AES_BLOCK_SIZE), i++; - -#if defined( USE_VIA_ACE_IF_PRESENT ) - if(ctx->inf.b[1] == 0xff) - { - via_cwd(cwd, hybrid, enc, 2 * ctx->inf.b[0] - 192); - via_ecb_op5((ctx->ks),cwd,buf,buf,i); - } - else -#endif - zrtp_bg_aes_ecb_encrypt(buf, buf, i * AES_BLOCK_SIZE, ctx); - - i = 0; ip = buf; -# ifdef FAST_BUFFER_OPERATIONS - if(!addr_offset( ibuf, 4 ) && !addr_offset( obuf, 4 ) && !addr_offset( ip, 4 )) - while(i + AES_BLOCK_SIZE <= blen) - { - lp32(obuf)[0] = lp32(ibuf)[0] ^ lp32(ip)[0]; - lp32(obuf)[1] = lp32(ibuf)[1] ^ lp32(ip)[1]; - lp32(obuf)[2] = lp32(ibuf)[2] ^ lp32(ip)[2]; - lp32(obuf)[3] = lp32(ibuf)[3] ^ lp32(ip)[3]; - i += AES_BLOCK_SIZE; - ip += AES_BLOCK_SIZE; - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } - else -#endif - while(i + AES_BLOCK_SIZE <= blen) - { - obuf[ 0] = ibuf[ 0] ^ ip[ 0]; obuf[ 1] = ibuf[ 1] ^ ip[ 1]; - obuf[ 2] = ibuf[ 2] ^ ip[ 2]; obuf[ 3] = ibuf[ 3] ^ ip[ 3]; - obuf[ 4] = ibuf[ 4] ^ ip[ 4]; obuf[ 5] = ibuf[ 5] ^ ip[ 5]; - obuf[ 6] = ibuf[ 6] ^ ip[ 6]; obuf[ 7] = ibuf[ 7] ^ ip[ 7]; - obuf[ 8] = ibuf[ 8] ^ ip[ 8]; obuf[ 9] = ibuf[ 9] ^ ip[ 9]; - obuf[10] = ibuf[10] ^ ip[10]; obuf[11] = ibuf[11] ^ ip[11]; - obuf[12] = ibuf[12] ^ ip[12]; obuf[13] = ibuf[13] ^ ip[13]; - obuf[14] = ibuf[14] ^ ip[14]; obuf[15] = ibuf[15] ^ ip[15]; - i += AES_BLOCK_SIZE; - ip += AES_BLOCK_SIZE; - ibuf += AES_BLOCK_SIZE; - obuf += AES_BLOCK_SIZE; - } - - while(i++ < blen) - *obuf++ = *ibuf++ ^ ip[b_pos++]; - } - - ctx->inf.b[2] = (uint_8t)b_pos; - return EXIT_SUCCESS; -} - -#if defined(__cplusplus) -} -#endif -#endif diff --git a/libs/libzrtp/third_party/bgaes/aescrypt.c b/libs/libzrtp/third_party/bgaes/aescrypt.c deleted file mode 100644 index 2ca47c32b8..0000000000 --- a/libs/libzrtp/third_party/bgaes/aescrypt.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 -*/ - -#include "aesopt.h" -#include "aestab.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define si(y,x,k,c) (s(y,c) = word_in(x, c) ^ (k)[c]) -#define so(y,x,c) word_out(y, c, s(x,c)) - -#if defined(ARRAYS) -#define locals(y,x) x[4],y[4] -#else -#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3 -#endif - -#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \ - s(y,2) = s(x,2); s(y,3) = s(x,3); -#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3) -#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3) -#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3) - -#if ( FUNCS_IN_C & ENCRYPTION_IN_C ) - -/* Visual C++ .Net v7.1 provides the fastest encryption code when using - Pentium optimiation with small code but this is poor for decryption - so we need to control this with the following VC++ pragmas -*/ - -#if defined( _MSC_VER ) && !defined( _WIN64 ) -#pragma optimize( "s", on ) -#endif - -/* Given the column (c) of the output state variable, the following - macros give the input state variables which are needed in its - computation for each row (r) of the state. All the alternative - macros give the same end values but expand into different ways - of calculating these values. In particular the complex macro - used for dynamically variable block sizes is designed to expand - to a compile time constant whenever possible but will expand to - conditional clauses on some branches (I am grateful to Frank - Yellin for this construction) -*/ - -#define fwd_var(x,r,c)\ - ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ - : r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\ - : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ - : ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))) - -#if defined(FT4_SET) -#undef dec_fmvars -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c)) -#elif defined(FT1_SET) -#undef dec_fmvars -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(f,n),fwd_var,rf1,c)) -#else -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ fwd_mcol(no_table(x,t_use(s,box),fwd_var,rf1,c))) -#endif - -#if defined(FL4_SET) -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,l),fwd_var,rf1,c)) -#elif defined(FL1_SET) -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(f,l),fwd_var,rf1,c)) -#else -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(s,box),fwd_var,rf1,c)) -#endif - -AES_RETURN zrtp_bg_aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]) -{ uint_32t locals(b0, b1); - const uint_32t *kp; -#if defined( dec_fmvars ) - dec_fmvars; /* declare variables for fwd_mcol() if needed */ -#endif - -#if defined( AES_ERR_CHK ) - if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 ) - return EXIT_FAILURE; -#endif - - kp = cx->ks; - state_in(b0, in, kp); - -#if (ENC_UNROLL == FULL) - - switch(cx->inf.b[0]) - { - case 14 * 16: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - kp += 2 * N_COLS; - case 12 * 16: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - kp += 2 * N_COLS; - case 10 * 16: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - round(fwd_rnd, b1, b0, kp + 3 * N_COLS); - round(fwd_rnd, b0, b1, kp + 4 * N_COLS); - round(fwd_rnd, b1, b0, kp + 5 * N_COLS); - round(fwd_rnd, b0, b1, kp + 6 * N_COLS); - round(fwd_rnd, b1, b0, kp + 7 * N_COLS); - round(fwd_rnd, b0, b1, kp + 8 * N_COLS); - round(fwd_rnd, b1, b0, kp + 9 * N_COLS); - round(fwd_lrnd, b0, b1, kp +10 * N_COLS); - } - -#else - -#if (ENC_UNROLL == PARTIAL) - { uint_32t rnd; - for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd) - { - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); - kp += N_COLS; - round(fwd_rnd, b0, b1, kp); - } - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); -#else - { uint_32t rnd; - for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd) - { - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); - l_copy(b0, b1); - } -#endif - kp += N_COLS; - round(fwd_lrnd, b0, b1, kp); - } -#endif - - state_out(out, b0); - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if ( FUNCS_IN_C & DECRYPTION_IN_C) - -/* Visual C++ .Net v7.1 provides the fastest encryption code when using - Pentium optimiation with small code but this is poor for decryption - so we need to control this with the following VC++ pragmas -*/ - -#if defined( _MSC_VER ) && !defined( _WIN64 ) -#pragma optimize( "t", on ) -#endif - -/* Given the column (c) of the output state variable, the following - macros give the input state variables which are needed in its - computation for each row (r) of the state. All the alternative - macros give the same end values but expand into different ways - of calculating these values. In particular the complex macro - used for dynamically variable block sizes is designed to expand - to a compile time constant whenever possible but will expand to - conditional clauses on some branches (I am grateful to Frank - Yellin for this construction) -*/ - -#define inv_var(x,r,c)\ - ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ - : r == 1 ? ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))\ - : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ - : ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))) - -#if defined(IT4_SET) -#undef dec_imvars -#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,n),inv_var,rf1,c)) -#elif defined(IT1_SET) -#undef dec_imvars -#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(i,n),inv_var,rf1,c)) -#else -#define inv_rnd(y,x,k,c) (s(y,c) = inv_mcol((k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c))) -#endif - -#if defined(IL4_SET) -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,l),inv_var,rf1,c)) -#elif defined(IL1_SET) -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(i,l),inv_var,rf1,c)) -#else -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c)) -#endif - -/* This code can work with the decryption key schedule in the */ -/* order that is used for encrytpion (where the 1st decryption */ -/* round key is at the high end ot the schedule) or with a key */ -/* schedule that has been reversed to put the 1st decryption */ -/* round key at the low end of the schedule in memory (when */ -/* AES_REV_DKS is defined) */ - -#ifdef AES_REV_DKS -#define key_ofs 0 -#define rnd_key(n) (kp + n * N_COLS) -#else -#define key_ofs 1 -#define rnd_key(n) (kp - n * N_COLS) -#endif - -AES_RETURN zrtp_bg_aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]) -{ uint_32t locals(b0, b1); -#if defined( dec_imvars ) - dec_imvars; /* declare variables for inv_mcol() if needed */ -#endif - const uint_32t *kp; - -#if defined( AES_ERR_CHK ) - if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 ) - return EXIT_FAILURE; -#endif - - kp = cx->ks + (key_ofs ? (cx->inf.b[0] >> 2) : 0); - state_in(b0, in, kp); - -#if (DEC_UNROLL == FULL) - - kp = cx->ks + (key_ofs ? 0 : (cx->inf.b[0] >> 2)); - switch(cx->inf.b[0]) - { - case 14 * 16: - round(inv_rnd, b1, b0, rnd_key(-13)); - round(inv_rnd, b0, b1, rnd_key(-12)); - case 12 * 16: - round(inv_rnd, b1, b0, rnd_key(-11)); - round(inv_rnd, b0, b1, rnd_key(-10)); - case 10 * 16: - round(inv_rnd, b1, b0, rnd_key(-9)); - round(inv_rnd, b0, b1, rnd_key(-8)); - round(inv_rnd, b1, b0, rnd_key(-7)); - round(inv_rnd, b0, b1, rnd_key(-6)); - round(inv_rnd, b1, b0, rnd_key(-5)); - round(inv_rnd, b0, b1, rnd_key(-4)); - round(inv_rnd, b1, b0, rnd_key(-3)); - round(inv_rnd, b0, b1, rnd_key(-2)); - round(inv_rnd, b1, b0, rnd_key(-1)); - round(inv_lrnd, b0, b1, rnd_key( 0)); - } - -#else - -#if (DEC_UNROLL == PARTIAL) - { uint_32t rnd; - for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd) - { - kp = rnd_key(1); - round(inv_rnd, b1, b0, kp); - kp = rnd_key(1); - round(inv_rnd, b0, b1, kp); - } - kp = rnd_key(1); - round(inv_rnd, b1, b0, kp); -#else - { uint_32t rnd; - for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd) - { - kp = rnd_key(1); - round(inv_rnd, b1, b0, kp); - l_copy(b0, b1); - } -#endif - kp = rnd_key(1); - round(inv_lrnd, b0, b1, kp); - } -#endif - - state_out(out, b0); - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(__cplusplus) -} -#endif diff --git a/libs/libzrtp/third_party/bgaes/aeskey.c b/libs/libzrtp/third_party/bgaes/aeskey.c deleted file mode 100644 index ded6513322..0000000000 --- a/libs/libzrtp/third_party/bgaes/aeskey.c +++ /dev/null @@ -1,578 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 -*/ - -#include "aesopt.h" -#include "aestab.h" - -#ifdef USE_VIA_ACE_IF_PRESENT -# include "aes_via_ace.h" -#endif - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* Initialise the key schedule from the user supplied key. The key - length can be specified in bytes, with legal values of 16, 24 - and 32, or in bits, with legal values of 128, 192 and 256. These - values correspond with Nk values of 4, 6 and 8 respectively. - - The following macros implement a single cycle in the key - schedule generation process. The number of cycles needed - for each cx->n_col and nk value is: - - nk = 4 5 6 7 8 - ------------------------------ - cx->n_col = 4 10 9 8 7 7 - cx->n_col = 5 14 11 10 9 9 - cx->n_col = 6 19 15 12 11 11 - cx->n_col = 7 21 19 16 13 14 - cx->n_col = 8 29 23 19 17 14 -*/ - -#if (FUNCS_IN_C & ENC_KEYING_IN_C) - -#if defined(AES_128) || defined(AES_VAR) - -#define ke4(k,i) \ -{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \ - k[4*(i)+5] = ss[1] ^= ss[0]; \ - k[4*(i)+6] = ss[2] ^= ss[1]; \ - k[4*(i)+7] = ss[3] ^= ss[2]; \ -} - -AES_RETURN zrtp_bg_aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ uint_32t ss[4]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - -#if ENC_UNROLL == NONE - { uint_32t i; - for(i = 0; i < 9; ++i) - ke4(cx->ks, i); - } -#else - ke4(cx->ks, 0); ke4(cx->ks, 1); - ke4(cx->ks, 2); ke4(cx->ks, 3); - ke4(cx->ks, 4); ke4(cx->ks, 5); - ke4(cx->ks, 6); ke4(cx->ks, 7); - ke4(cx->ks, 8); -#endif - ke4(cx->ks, 9); - cx->inf.l = 0; - cx->inf.b[0] = 10 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_192) || defined(AES_VAR) - -#define kef6(k,i) \ -{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \ - k[6*(i)+ 7] = ss[1] ^= ss[0]; \ - k[6*(i)+ 8] = ss[2] ^= ss[1]; \ - k[6*(i)+ 9] = ss[3] ^= ss[2]; \ -} - -#define ke6(k,i) \ -{ kef6(k,i); \ - k[6*(i)+10] = ss[4] ^= ss[3]; \ - k[6*(i)+11] = ss[5] ^= ss[4]; \ -} - -AES_RETURN zrtp_bg_aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ uint_32t ss[6]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - cx->ks[4] = ss[4] = word_in(key, 4); - cx->ks[5] = ss[5] = word_in(key, 5); - -#if ENC_UNROLL == NONE - { uint_32t i; - for(i = 0; i < 7; ++i) - ke6(cx->ks, i); - } -#else - ke6(cx->ks, 0); ke6(cx->ks, 1); - ke6(cx->ks, 2); ke6(cx->ks, 3); - ke6(cx->ks, 4); ke6(cx->ks, 5); - ke6(cx->ks, 6); -#endif - kef6(cx->ks, 7); - cx->inf.l = 0; - cx->inf.b[0] = 12 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_256) || defined(AES_VAR) - -#define kef8(k,i) \ -{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \ - k[8*(i)+ 9] = ss[1] ^= ss[0]; \ - k[8*(i)+10] = ss[2] ^= ss[1]; \ - k[8*(i)+11] = ss[3] ^= ss[2]; \ -} - -#define ke8(k,i) \ -{ kef8(k,i); \ - k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); \ - k[8*(i)+13] = ss[5] ^= ss[4]; \ - k[8*(i)+14] = ss[6] ^= ss[5]; \ - k[8*(i)+15] = ss[7] ^= ss[6]; \ -} - -AES_RETURN zrtp_bg_aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ uint_32t ss[8]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - cx->ks[4] = ss[4] = word_in(key, 4); - cx->ks[5] = ss[5] = word_in(key, 5); - cx->ks[6] = ss[6] = word_in(key, 6); - cx->ks[7] = ss[7] = word_in(key, 7); - -#if ENC_UNROLL == NONE - { uint_32t i; - for(i = 0; i < 6; ++i) - ke8(cx->ks, i); - } -#else - ke8(cx->ks, 0); ke8(cx->ks, 1); - ke8(cx->ks, 2); ke8(cx->ks, 3); - ke8(cx->ks, 4); ke8(cx->ks, 5); -#endif - kef8(cx->ks, 6); - cx->inf.l = 0; - cx->inf.b[0] = 14 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_VAR) - -AES_RETURN zrtp_bg_aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]) -{ - switch(key_len) - { -#if defined( AES_ERR_CHK ) - case 16: case 128: return zrtp_bg_aes_encrypt_key128(key, cx); - case 24: case 192: return zrtp_bg_aes_encrypt_key192(key, cx); - case 32: case 256: return zrtp_bg_aes_encrypt_key256(key, cx); - default: return EXIT_FAILURE; -#else - case 16: case 128: zrtp_bg_aes_encrypt_key128(key, cx); return; - case 24: case 192: zrtp_bg_aes_encrypt_key192(key, cx); return; - case 32: case 256: zrtp_bg_aes_encrypt_key256(key, cx); return; -#endif - } -} - -#endif - -#endif - -#if (FUNCS_IN_C & DEC_KEYING_IN_C) - -/* this is used to store the decryption round keys */ -/* in forward or reverse order */ - -#ifdef AES_REV_DKS -#define v(n,i) ((n) - (i) + 2 * ((i) & 3)) -#else -#define v(n,i) (i) -#endif - -#if DEC_ROUND == NO_TABLES -#define ff(x) (x) -#else -#define ff(x) inv_mcol(x) -#if defined( dec_imvars ) -#define d_vars dec_imvars -#endif -#endif - -#if defined(AES_128) || defined(AES_VAR) - -#define k4e(k,i) \ -{ k[v(40,(4*(i))+4)] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \ - k[v(40,(4*(i))+5)] = ss[1] ^= ss[0]; \ - k[v(40,(4*(i))+6)] = ss[2] ^= ss[1]; \ - k[v(40,(4*(i))+7)] = ss[3] ^= ss[2]; \ -} - -#if 1 - -#define kdf4(k,i) \ -{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; \ - ss[1] = ss[1] ^ ss[3]; \ - ss[2] = ss[2] ^ ss[3]; \ - ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \ - ss[i % 4] ^= ss[4]; \ - ss[4] ^= k[v(40,(4*(i)))]; k[v(40,(4*(i))+4)] = ff(ss[4]); \ - ss[4] ^= k[v(40,(4*(i))+1)]; k[v(40,(4*(i))+5)] = ff(ss[4]); \ - ss[4] ^= k[v(40,(4*(i))+2)]; k[v(40,(4*(i))+6)] = ff(ss[4]); \ - ss[4] ^= k[v(40,(4*(i))+3)]; k[v(40,(4*(i))+7)] = ff(ss[4]); \ -} - -#define kd4(k,i) \ -{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \ - ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \ - k[v(40,(4*(i))+4)] = ss[4] ^= k[v(40,(4*(i)))]; \ - k[v(40,(4*(i))+5)] = ss[4] ^= k[v(40,(4*(i))+1)]; \ - k[v(40,(4*(i))+6)] = ss[4] ^= k[v(40,(4*(i))+2)]; \ - k[v(40,(4*(i))+7)] = ss[4] ^= k[v(40,(4*(i))+3)]; \ -} - -#define kdl4(k,i) \ -{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \ - k[v(40,(4*(i))+4)] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; \ - k[v(40,(4*(i))+5)] = ss[1] ^ ss[3]; \ - k[v(40,(4*(i))+6)] = ss[0]; \ - k[v(40,(4*(i))+7)] = ss[1]; \ -} - -#else - -#define kdf4(k,i) \ -{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ff(ss[0]); \ - ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ff(ss[2]); \ - ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ff(ss[3]); \ -} - -#define kd4(k,i) \ -{ ss[4] = ls_box(ss[3],3) ^ t_use(r,c)[i]; \ - ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[v(40,(4*(i))+ 4)] = ss[4] ^= k[v(40,(4*(i)))]; \ - ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[4] ^= k[v(40,(4*(i))+ 1)]; \ - ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[4] ^= k[v(40,(4*(i))+ 2)]; \ - ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[4] ^= k[v(40,(4*(i))+ 3)]; \ -} - -#define kdl4(k,i) \ -{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ss[0]; \ - ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[1]; \ - ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[2]; \ - ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[3]; \ -} - -#endif - -AES_RETURN zrtp_bg_aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ uint_32t ss[5]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[v(40,(0))] = ss[0] = word_in(key, 0); - cx->ks[v(40,(1))] = ss[1] = word_in(key, 1); - cx->ks[v(40,(2))] = ss[2] = word_in(key, 2); - cx->ks[v(40,(3))] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - { uint_32t i; - for(i = 0; i < 10; ++i) - k4e(cx->ks, i); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 10 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); -#endif - } -#else - kdf4(cx->ks, 0); kd4(cx->ks, 1); - kd4(cx->ks, 2); kd4(cx->ks, 3); - kd4(cx->ks, 4); kd4(cx->ks, 5); - kd4(cx->ks, 6); kd4(cx->ks, 7); - kd4(cx->ks, 8); kdl4(cx->ks, 9); -#endif - cx->inf.l = 0; - cx->inf.b[0] = 10 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_192) || defined(AES_VAR) - -#define k6ef(k,i) \ -{ k[v(48,(6*(i))+ 6)] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \ - k[v(48,(6*(i))+ 7)] = ss[1] ^= ss[0]; \ - k[v(48,(6*(i))+ 8)] = ss[2] ^= ss[1]; \ - k[v(48,(6*(i))+ 9)] = ss[3] ^= ss[2]; \ -} - -#define k6e(k,i) \ -{ k6ef(k,i); \ - k[v(48,(6*(i))+10)] = ss[4] ^= ss[3]; \ - k[v(48,(6*(i))+11)] = ss[5] ^= ss[4]; \ -} - -#define kdf6(k,i) \ -{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ff(ss[0]); \ - ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ff(ss[2]); \ - ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ff(ss[3]); \ - ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ff(ss[4]); \ - ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ff(ss[5]); \ -} - -#define kd6(k,i) \ -{ ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \ - ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[v(48,(6*(i))+ 6)] = ss[6] ^= k[v(48,(6*(i)))]; \ - ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[6] ^= k[v(48,(6*(i))+ 1)]; \ - ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[6] ^= k[v(48,(6*(i))+ 2)]; \ - ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[6] ^= k[v(48,(6*(i))+ 3)]; \ - ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ss[6] ^= k[v(48,(6*(i))+ 4)]; \ - ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ss[6] ^= k[v(48,(6*(i))+ 5)]; \ -} - -#define kdl6(k,i) \ -{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ss[0]; \ - ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[1]; \ - ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[2]; \ - ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[3]; \ -} - -AES_RETURN zrtp_bg_aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ uint_32t ss[7]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[v(48,(0))] = ss[0] = word_in(key, 0); - cx->ks[v(48,(1))] = ss[1] = word_in(key, 1); - cx->ks[v(48,(2))] = ss[2] = word_in(key, 2); - cx->ks[v(48,(3))] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - cx->ks[v(48,(4))] = ss[4] = word_in(key, 4); - cx->ks[v(48,(5))] = ss[5] = word_in(key, 5); - { uint_32t i; - - for(i = 0; i < 7; ++i) - k6e(cx->ks, i); - k6ef(cx->ks, 7); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 12 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); -#endif - } -#else - cx->ks[v(48,(4))] = ff(ss[4] = word_in(key, 4)); - cx->ks[v(48,(5))] = ff(ss[5] = word_in(key, 5)); - kdf6(cx->ks, 0); kd6(cx->ks, 1); - kd6(cx->ks, 2); kd6(cx->ks, 3); - kd6(cx->ks, 4); kd6(cx->ks, 5); - kd6(cx->ks, 6); kdl6(cx->ks, 7); -#endif - cx->inf.l = 0; - cx->inf.b[0] = 12 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_256) || defined(AES_VAR) - -#define k8ef(k,i) \ -{ k[v(56,(8*(i))+ 8)] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \ - k[v(56,(8*(i))+ 9)] = ss[1] ^= ss[0]; \ - k[v(56,(8*(i))+10)] = ss[2] ^= ss[1]; \ - k[v(56,(8*(i))+11)] = ss[3] ^= ss[2]; \ -} - -#define k8e(k,i) \ -{ k8ef(k,i); \ - k[v(56,(8*(i))+12)] = ss[4] ^= ls_box(ss[3],0); \ - k[v(56,(8*(i))+13)] = ss[5] ^= ss[4]; \ - k[v(56,(8*(i))+14)] = ss[6] ^= ss[5]; \ - k[v(56,(8*(i))+15)] = ss[7] ^= ss[6]; \ -} - -#define kdf8(k,i) \ -{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ff(ss[0]); \ - ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ff(ss[2]); \ - ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ff(ss[3]); \ - ss[4] ^= ls_box(ss[3],0); k[v(56,(8*(i))+12)] = ff(ss[4]); \ - ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ff(ss[5]); \ - ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ff(ss[6]); \ - ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ff(ss[7]); \ -} - -#define kd8(k,i) \ -{ ss[8] = ls_box(ss[7],3) ^ t_use(r,c)[i]; \ - ss[0] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+ 8)] = ss[8] ^= k[v(56,(8*(i)))]; \ - ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[8] ^= k[v(56,(8*(i))+ 1)]; \ - ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[8] ^= k[v(56,(8*(i))+ 2)]; \ - ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[8] ^= k[v(56,(8*(i))+ 3)]; \ - ss[8] = ls_box(ss[3],0); \ - ss[4] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+12)] = ss[8] ^= k[v(56,(8*(i))+ 4)]; \ - ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ss[8] ^= k[v(56,(8*(i))+ 5)]; \ - ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ss[8] ^= k[v(56,(8*(i))+ 6)]; \ - ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ss[8] ^= k[v(56,(8*(i))+ 7)]; \ -} - -#define kdl8(k,i) \ -{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ss[0]; \ - ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[1]; \ - ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[2]; \ - ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[3]; \ -} - -AES_RETURN zrtp_bg_aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ uint_32t ss[9]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[v(56,(0))] = ss[0] = word_in(key, 0); - cx->ks[v(56,(1))] = ss[1] = word_in(key, 1); - cx->ks[v(56,(2))] = ss[2] = word_in(key, 2); - cx->ks[v(56,(3))] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - cx->ks[v(56,(4))] = ss[4] = word_in(key, 4); - cx->ks[v(56,(5))] = ss[5] = word_in(key, 5); - cx->ks[v(56,(6))] = ss[6] = word_in(key, 6); - cx->ks[v(56,(7))] = ss[7] = word_in(key, 7); - { uint_32t i; - - for(i = 0; i < 6; ++i) - k8e(cx->ks, i); - k8ef(cx->ks, 6); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 14 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); - -#endif - } -#else - cx->ks[v(56,(4))] = ff(ss[4] = word_in(key, 4)); - cx->ks[v(56,(5))] = ff(ss[5] = word_in(key, 5)); - cx->ks[v(56,(6))] = ff(ss[6] = word_in(key, 6)); - cx->ks[v(56,(7))] = ff(ss[7] = word_in(key, 7)); - kdf8(cx->ks, 0); kd8(cx->ks, 1); - kd8(cx->ks, 2); kd8(cx->ks, 3); - kd8(cx->ks, 4); kd8(cx->ks, 5); - kdl8(cx->ks, 6); -#endif - cx->inf.l = 0; - cx->inf.b[0] = 14 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_VAR) - -AES_RETURN zrtp_bg_aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]) -{ - switch(key_len) - { -#if defined( AES_ERR_CHK ) - case 16: case 128: return zrtp_bg_aes_decrypt_key128(key, cx); - case 24: case 192: return zrtp_bg_aes_decrypt_key192(key, cx); - case 32: case 256: return zrtp_bg_aes_decrypt_key256(key, cx); - default: return EXIT_FAILURE; -#else - case 16: case 128: zrtp_bg_aes_decrypt_key128(key, cx); return; - case 24: case 192: zrtp_bg_aes_decrypt_key192(key, cx); return; - case 32: case 256: zrtp_bg_aes_decrypt_key256(key, cx); return; -#endif - } -} - -#endif - -#endif - -#if defined(__cplusplus) -} -#endif diff --git a/libs/libzrtp/third_party/bgaes/aesopt.h b/libs/libzrtp/third_party/bgaes/aesopt.h deleted file mode 100644 index 459f0f4f89..0000000000 --- a/libs/libzrtp/third_party/bgaes/aesopt.h +++ /dev/null @@ -1,728 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 - - This file contains the compilation options for AES (Rijndael) and code - that is common across encryption, key scheduling and table generation. - - OPERATION - - These source code files implement the AES algorithm Rijndael designed by - Joan Daemen and Vincent Rijmen. This version is designed for the standard - block size of 16 bytes and for key sizes of 128, 192 and 256 bits (16, 24 - and 32 bytes). - - This version is designed for flexibility and speed using operations on - 32-bit words rather than operations on bytes. It can be compiled with - either big or little endian internal byte order but is faster when the - native byte order for the processor is used. - - THE CIPHER INTERFACE - - The cipher interface is implemented as an array of bytes in which lower - AES bit sequence indexes map to higher numeric significance within bytes. - - uint_8t (an unsigned 8-bit type) - uint_32t (an unsigned 32-bit type) - struct aes_encrypt_ctx (structure for the cipher encryption context) - struct aes_decrypt_ctx (structure for the cipher decryption context) - AES_RETURN the function return type - - C subroutine calls: - - AES_RETURN zrtp_bg_aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); - AES_RETURN zrtp_bg_aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); - AES_RETURN zrtp_bg_aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); - AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, - const aes_encrypt_ctx cx[1]); - - AES_RETURN zrtp_bg_aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); - AES_RETURN zrtp_bg_aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); - AES_RETURN zrtp_bg_aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); - AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, - const aes_decrypt_ctx cx[1]); - - IMPORTANT NOTE: If you are using this C interface with dynamic tables make sure that - you call zrtp_bg_gen_tabs() before AES is used so that the tables are initialised. - - C++ aes class subroutines: - - Class AESencrypt for encryption - - Construtors: - AESencrypt(void) - AESencrypt(const unsigned char *key) - 128 bit key - Members: - AES_RETURN key128(const unsigned char *key) - AES_RETURN key192(const unsigned char *key) - AES_RETURN key256(const unsigned char *key) - AES_RETURN encrypt(const unsigned char *in, unsigned char *out) const - - Class AESdecrypt for encryption - Construtors: - AESdecrypt(void) - AESdecrypt(const unsigned char *key) - 128 bit key - Members: - AES_RETURN key128(const unsigned char *key) - AES_RETURN key192(const unsigned char *key) - AES_RETURN key256(const unsigned char *key) - AES_RETURN decrypt(const unsigned char *in, unsigned char *out) const -*/ - -#ifdef _AESOPT_H - #warning "_AESOPT_H already defined. aesopt.h will not be included" -#endif - -#if !defined( _AESOPT_H ) -#define _AESOPT_H - -#if defined( __cplusplus ) -#include "aescpp.h" -#else -#include "aes.h" -#endif - -/* PLATFORM SPECIFIC INCLUDES */ - -//#include "brg_endian.h" -#include "bg2zrtp.h" - -/* CONFIGURATION - THE USE OF DEFINES - - Later in this section there are a number of defines that control the - operation of the code. In each section, the purpose of each define is - explained so that the relevant form can be included or excluded by - setting either 1's or 0's respectively on the branches of the related - #if clauses. The following local defines should not be changed. -*/ - -#define ENCRYPTION_IN_C 1 -#define DECRYPTION_IN_C 2 -#define ENC_KEYING_IN_C 4 -#define DEC_KEYING_IN_C 8 - -#define NO_TABLES 0 -#define ONE_TABLE 1 -#define FOUR_TABLES 4 -#define NONE 0 -#define PARTIAL 1 -#define FULL 2 - -/* --- START OF USER CONFIGURED OPTIONS --- */ - -/* 1. BYTE ORDER WITHIN 32 BIT WORDS - - The fundamental data processing units in Rijndael are 8-bit bytes. The - input, output and key input are all enumerated arrays of bytes in which - bytes are numbered starting at zero and increasing to one less than the - number of bytes in the array in question. This enumeration is only used - for naming bytes and does not imply any adjacency or order relationship - from one byte to another. When these inputs and outputs are considered - as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to - byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte. - In this implementation bits are numbered from 0 to 7 starting at the - numerically least significant end of each byte (bit n represents 2^n). - - However, Rijndael can be implemented more efficiently using 32-bit - words by packing bytes into words so that bytes 4*n to 4*n+3 are placed - into word[n]. While in principle these bytes can be assembled into words - in any positions, this implementation only supports the two formats in - which bytes in adjacent positions within words also have adjacent byte - numbers. This order is called big-endian if the lowest numbered bytes - in words have the highest numeric significance and little-endian if the - opposite applies. - - This code can work in either order irrespective of the order used by the - machine on which it runs. Normally the internal byte order will be set - to the order of the processor on which the code is to be run but this - define can be used to reverse this in special situations - - WARNING: Assembler code versions rely on PLATFORM_BYTE_ORDER being set. - This define will hence be redefined later (in section 4) if necessary -*/ - -#if 1 -#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER -#elif 0 -#define ALGORITHM_BYTE_ORDER IS_LITTLE_ENDIAN -#elif 0 -#define ALGORITHM_BYTE_ORDER IS_BIG_ENDIAN -#else -#error The algorithm byte order is not defined -#endif - -/* 2. VIA ACE SUPPORT - - Define this option if support for the VIA ACE is required. This uses - inline assembler instructions and is only implemented for the Microsoft, - Intel and GCC compilers. If VIA ACE is known to be present, then defining - ASSUME_VIA_ACE_PRESENT will remove the ordinary encryption/decryption - code. If USE_VIA_ACE_IF_PRESENT is defined then VIA ACE will be used if - it is detected (both present and enabled) but the normal AES code will - also be present. - - When VIA ACE is to be used, all AES encryption contexts MUST be 16 byte - aligned; other input/output buffers do not need to be 16 byte aligned - but there are very large performance gains if this can be arranged. - VIA ACE also requires the decryption key schedule to be in reverse - order (which later checks below ensure). -*/ - -#if 0 && !defined( USE_VIA_ACE_IF_PRESENT ) -# define USE_VIA_ACE_IF_PRESENT -#endif - -#if 0 && !defined( ASSUME_VIA_ACE_PRESENT ) -# define ASSUME_VIA_ACE_PRESENT -# endif - -#if defined ( _WIN64 ) || defined( _WIN32_WCE ) || \ - defined( _MSC_VER ) && ( _MSC_VER <= 800 ) -# if defined( USE_VIA_ACE_IF_PRESENT ) -# undef USE_VIA_ACE_IF_PRESENT -# endif -# if defined( ASSUME_VIA_ACE_PRESENT ) -# undef ASSUME_VIA_ACE_PRESENT -# endif -#endif - -/* 3. ASSEMBLER SUPPORT - - This define (which can be on the command line) enables the use of the - assembler code routines for encryption, decryption and key scheduling - as follows: - - ASM_X86_V1C uses the assembler (aes_x86_v1.asm) with large tables for - encryption and decryption and but with key scheduling in C - ASM_X86_V2 uses assembler (aes_x86_v2.asm) with compressed tables for - encryption, decryption and key scheduling - ASM_X86_V2C uses assembler (aes_x86_v2.asm) with compressed tables for - encryption and decryption and but with key scheduling in C - ASM_AMD64_C uses assembler (aes_amd64.asm) with compressed tables for - encryption and decryption and but with key scheduling in C - - Change one 'if 0' below to 'if 1' to select the version or define - as a compilation option. -*/ - -#if 0 && !defined( ASM_X86_V1C ) -# define ASM_X86_V1C -#elif 0 && !defined( ASM_X86_V2 ) -# define ASM_X86_V2 -#elif 0 && !defined( ASM_X86_V2C ) -# define ASM_X86_V2C -#elif 0 && !defined( ASM_AMD64_C ) -# define ASM_AMD64_C -#endif - -#if (defined ( ASM_X86_V1C ) || defined( ASM_X86_V2 ) || defined( ASM_X86_V2C )) \ - && !defined( _M_IX86 ) || defined( ASM_AMD64_C ) && !defined( _M_X64 ) -# error Assembler code is only available for x86 and AMD64 systems -#endif - -/* 4. FAST INPUT/OUTPUT OPERATIONS. - - On some machines it is possible to improve speed by transferring the - bytes in the input and output arrays to and from the internal 32-bit - variables by addressing these arrays as if they are arrays of 32-bit - words. On some machines this will always be possible but there may - be a large performance penalty if the byte arrays are not aligned on - the normal word boundaries. On other machines this technique will - lead to memory access errors when such 32-bit word accesses are not - properly aligned. The option SAFE_IO avoids such problems but will - often be slower on those machines that support misaligned access - (especially so if care is taken to align the input and output byte - arrays on 32-bit word boundaries). If SAFE_IO is not defined it is - assumed that access to byte arrays as if they are arrays of 32-bit - words will not cause problems when such accesses are misaligned. -*/ -#if 1 && !defined( _MSC_VER ) -#define SAFE_IO -#endif - -/* 5. LOOP UNROLLING - - The code for encryption and decrytpion cycles through a number of rounds - that can be implemented either in a loop or by expanding the code into a - long sequence of instructions, the latter producing a larger program but - one that will often be much faster. The latter is called loop unrolling. - There are also potential speed advantages in expanding two iterations in - a loop with half the number of iterations, which is called partial loop - unrolling. The following options allow partial or full loop unrolling - to be set independently for encryption and decryption -*/ -#if 1 -#define ENC_UNROLL FULL -#elif 0 -#define ENC_UNROLL PARTIAL -#else -#define ENC_UNROLL NONE -#endif - -#if 1 -#define DEC_UNROLL FULL -#elif 0 -#define DEC_UNROLL PARTIAL -#else -#define DEC_UNROLL NONE -#endif - -/* 6. FAST FINITE FIELD OPERATIONS - - If this section is included, tables are used to provide faster finite - field arithmetic (this has no effect if FIXED_TABLES is defined). -*/ -#if 1 -#define FF_TABLES -#endif - -/* 7. INTERNAL STATE VARIABLE FORMAT - - The internal state of Rijndael is stored in a number of local 32-bit - word varaibles which can be defined either as an array or as individual - names variables. Include this section if you want to store these local - varaibles in arrays. Otherwise individual local variables will be used. -*/ -#if 1 -#define ARRAYS -#endif - -/* 8. FIXED OR DYNAMIC TABLES - - When this section is included the tables used by the code are compiled - statically into the binary file. Otherwise the subroutine zrtp_bg_gen_tabs() - must be called to compute them before the code is first used. -*/ -#if 1 && !(defined( _MSC_VER ) && ( _MSC_VER <= 800 )) -#define FIXED_TABLES -#endif - -/* 9. TABLE ALIGNMENT - - On some sytsems speed will be improved by aligning the AES large lookup - tables on particular boundaries. This define should be set to a power of - two giving the desired alignment. It can be left undefined if alignment - is not needed. This option is specific to the Microsft VC++ compiler - - it seems to sometimes cause trouble for the VC++ version 6 compiler. -*/ - -#if 1 && defined( _MSC_VER ) && ( _MSC_VER >= 1300 ) -#define TABLE_ALIGN 32 -#endif - -/* 10. TABLE OPTIONS - - This cipher proceeds by repeating in a number of cycles known as 'rounds' - which are implemented by a round function which can optionally be speeded - up using tables. The basic tables are each 256 32-bit words, with either - one or four tables being required for each round function depending on - how much speed is required. The encryption and decryption round functions - are different and the last encryption and decrytpion round functions are - different again making four different round functions in all. - - This means that: - 1. Normal encryption and decryption rounds can each use either 0, 1 - or 4 tables and table spaces of 0, 1024 or 4096 bytes each. - 2. The last encryption and decryption rounds can also use either 0, 1 - or 4 tables and table spaces of 0, 1024 or 4096 bytes each. - - Include or exclude the appropriate definitions below to set the number - of tables used by this implementation. -*/ - -#if 1 /* set tables for the normal encryption round */ -#define ENC_ROUND FOUR_TABLES -#elif 0 -#define ENC_ROUND ONE_TABLE -#else -#define ENC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the last encryption round */ -#define LAST_ENC_ROUND FOUR_TABLES -#elif 0 -#define LAST_ENC_ROUND ONE_TABLE -#else -#define LAST_ENC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the normal decryption round */ -#define DEC_ROUND FOUR_TABLES -#elif 0 -#define DEC_ROUND ONE_TABLE -#else -#define DEC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the last decryption round */ -#define LAST_DEC_ROUND FOUR_TABLES -#elif 0 -#define LAST_DEC_ROUND ONE_TABLE -#else -#define LAST_DEC_ROUND NO_TABLES -#endif - -/* The decryption key schedule can be speeded up with tables in the same - way that the round functions can. Include or exclude the following - defines to set this requirement. -*/ -#if 1 -#define KEY_SCHED FOUR_TABLES -#elif 0 -#define KEY_SCHED ONE_TABLE -#else -#define KEY_SCHED NO_TABLES -#endif - -/* ---- END OF USER CONFIGURED OPTIONS ---- */ - -/* VIA ACE support is only available for VC++ and GCC */ - -#if !defined( _MSC_VER ) && !defined( __GNUC__ ) -# if defined( ASSUME_VIA_ACE_PRESENT ) -# undef ASSUME_VIA_ACE_PRESENT -# endif -# if defined( USE_VIA_ACE_IF_PRESENT ) -# undef USE_VIA_ACE_IF_PRESENT -# endif -#endif - -#if defined( ASSUME_VIA_ACE_PRESENT ) && !defined( USE_VIA_ACE_IF_PRESENT ) -#define USE_VIA_ACE_IF_PRESENT -#endif - -#if defined( USE_VIA_ACE_IF_PRESENT ) && !defined ( AES_REV_DKS ) -#define AES_REV_DKS -#endif - -/* Assembler support requires the use of platform byte order */ - -#if ( defined( ASM_X86_V1C ) || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) ) \ - && (ALGORITHM_BYTE_ORDER != PLATFORM_BYTE_ORDER) -#undef ALGORITHM_BYTE_ORDER -#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER -#endif - -/* In this implementation the columns of the state array are each held in - 32-bit words. The state array can be held in various ways: in an array - of words, in a number of individual word variables or in a number of - processor registers. The following define maps a variable name x and - a column number c to the way the state array variable is to be held. - The first define below maps the state into an array x[c] whereas the - second form maps the state into a number of individual variables x0, - x1, etc. Another form could map individual state colums to machine - register names. -*/ - -#if defined( ARRAYS ) -#define s(x,c) x[c] -#else -#define s(x,c) x##c -#endif - -/* This implementation provides subroutines for encryption, decryption - and for setting the three key lengths (separately) for encryption - and decryption. Since not all functions are needed, masks are set - up here to determine which will be implemented in C -*/ - -#if !defined( AES_ENCRYPT ) -# define EFUNCS_IN_C 0 -#elif defined( ASSUME_VIA_ACE_PRESENT ) || defined( ASM_X86_V1C ) \ - || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) -# define EFUNCS_IN_C ENC_KEYING_IN_C -#elif !defined( ASM_X86_V2 ) -# define EFUNCS_IN_C ( ENCRYPTION_IN_C | ENC_KEYING_IN_C ) -#else -# define EFUNCS_IN_C 0 -#endif - -#if !defined( AES_DECRYPT ) -# define DFUNCS_IN_C 0 -#elif defined( ASSUME_VIA_ACE_PRESENT ) || defined( ASM_X86_V1C ) \ - || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) -# define DFUNCS_IN_C DEC_KEYING_IN_C -#elif !defined( ASM_X86_V2 ) -# define DFUNCS_IN_C ( DECRYPTION_IN_C | DEC_KEYING_IN_C ) -#else -# define DFUNCS_IN_C 0 -#endif - -#define FUNCS_IN_C ( EFUNCS_IN_C | DFUNCS_IN_C ) - -/* END OF CONFIGURATION OPTIONS */ - -#define RC_LENGTH (5 * (AES_BLOCK_SIZE / 4 - 2)) - -/* Disable or report errors on some combinations of options */ - -#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES -#undef LAST_ENC_ROUND -#define LAST_ENC_ROUND NO_TABLES -#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES -#undef LAST_ENC_ROUND -#define LAST_ENC_ROUND ONE_TABLE -#endif - -#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE -#undef ENC_UNROLL -#define ENC_UNROLL NONE -#endif - -#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES -#undef LAST_DEC_ROUND -#define LAST_DEC_ROUND NO_TABLES -#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES -#undef LAST_DEC_ROUND -#define LAST_DEC_ROUND ONE_TABLE -#endif - -#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE -#undef DEC_UNROLL -#define DEC_UNROLL NONE -#endif - -#if defined( bswap32 ) -#define aes_sw32 bswap32 -#elif defined( bswap_32 ) -#define aes_sw32 bswap_32 -#else -#define brot(x,n) (((uint_32t)(x) << n) | ((uint_32t)(x) >> (32 - n))) -#define aes_sw32(x) ((brot((x),8) & 0x00ff00ff) | (brot((x),24) & 0xff00ff00)) -#endif - -/* upr(x,n): rotates bytes within words by n positions, moving bytes to - higher index positions with wrap around into low positions - ups(x,n): moves bytes by n positions to higher index positions in - words but without wrap around - bval(x,n): extracts a byte from a word - - WARNING: The definitions given here are intended only for use with - unsigned variables and with shift counts that are compile - time constants -*/ - -#if ( ALGORITHM_BYTE_ORDER == IS_LITTLE_ENDIAN ) -#define upr(x,n) (((uint_32t)(x) << (8 * (n))) | ((uint_32t)(x) >> (32 - 8 * (n)))) -#define ups(x,n) ((uint_32t) (x) << (8 * (n))) -#define bval(x,n) ((uint_8t)((x) >> (8 * (n)))) -#define bytes2word(b0, b1, b2, b3) \ - (((uint_32t)(b3) << 24) | ((uint_32t)(b2) << 16) | ((uint_32t)(b1) << 8) | (b0)) -#endif - -#if ( ALGORITHM_BYTE_ORDER == IS_BIG_ENDIAN ) -#define upr(x,n) (((uint_32t)(x) >> (8 * (n))) | ((uint_32t)(x) << (32 - 8 * (n)))) -#define ups(x,n) ((uint_32t) (x) >> (8 * (n))) -#define bval(x,n) ((uint_8t)((x) >> (24 - 8 * (n)))) -#define bytes2word(b0, b1, b2, b3) \ - (((uint_32t)(b0) << 24) | ((uint_32t)(b1) << 16) | ((uint_32t)(b2) << 8) | (b3)) -#endif - -#if defined( SAFE_IO ) - -#define word_in(x,c) bytes2word(((const uint_8t*)(x)+4*c)[0], ((const uint_8t*)(x)+4*c)[1], \ - ((const uint_8t*)(x)+4*c)[2], ((const uint_8t*)(x)+4*c)[3]) -#define word_out(x,c,v) { ((uint_8t*)(x)+4*c)[0] = bval(v,0); ((uint_8t*)(x)+4*c)[1] = bval(v,1); \ - ((uint_8t*)(x)+4*c)[2] = bval(v,2); ((uint_8t*)(x)+4*c)[3] = bval(v,3); } - -#elif ( ALGORITHM_BYTE_ORDER == PLATFORM_BYTE_ORDER ) - -#define word_in(x,c) (*((uint_32t*)(x)+(c))) -#define word_out(x,c,v) (*((uint_32t*)(x)+(c)) = (v)) - -#else - -#define word_in(x,c) aes_sw32(*((uint_32t*)(x)+(c))) -#define word_out(x,c,v) (*((uint_32t*)(x)+(c)) = aes_sw32(v)) - -#endif - -/* the finite field modular polynomial and elements */ - -#define WPOLY 0x011b -#define BPOLY 0x1b - -/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */ - -#define m1 0x80808080 -#define m2 0x7f7f7f7f -#define gf_mulx(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY)) - -/* The following defines provide alternative definitions of gf_mulx that might - give improved performance if a fast 32-bit multiply is not available. Note - that a temporary variable u needs to be defined where gf_mulx is used. - -#define gf_mulx(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6)) -#define m4 (0x01010101 * BPOLY) -#define gf_mulx(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4) -*/ - -/* Work out which tables are needed for the different options */ - -#if defined( ASM_X86_V1C ) -#if defined( ENC_ROUND ) -#undef ENC_ROUND -#endif -#define ENC_ROUND FOUR_TABLES -#if defined( LAST_ENC_ROUND ) -#undef LAST_ENC_ROUND -#endif -#define LAST_ENC_ROUND FOUR_TABLES -#if defined( DEC_ROUND ) -#undef DEC_ROUND -#endif -#define DEC_ROUND FOUR_TABLES -#if defined( LAST_DEC_ROUND ) -#undef LAST_DEC_ROUND -#endif -#define LAST_DEC_ROUND FOUR_TABLES -#if defined( KEY_SCHED ) -#undef KEY_SCHED -#define KEY_SCHED FOUR_TABLES -#endif -#endif - -#if ( FUNCS_IN_C & ENCRYPTION_IN_C ) || defined( ASM_X86_V1C ) -#if ENC_ROUND == ONE_TABLE -#define FT1_SET -#elif ENC_ROUND == FOUR_TABLES -#define FT4_SET -#else -#define SBX_SET -#endif -#if LAST_ENC_ROUND == ONE_TABLE -#define FL1_SET -#elif LAST_ENC_ROUND == FOUR_TABLES -#define FL4_SET -#elif !defined( SBX_SET ) -#define SBX_SET -#endif -#endif - -#if ( FUNCS_IN_C & DECRYPTION_IN_C ) || defined( ASM_X86_V1C ) -#if DEC_ROUND == ONE_TABLE -#define IT1_SET -#elif DEC_ROUND == FOUR_TABLES -#define IT4_SET -#else -#define ISB_SET -#endif -#if LAST_DEC_ROUND == ONE_TABLE -#define IL1_SET -#elif LAST_DEC_ROUND == FOUR_TABLES -#define IL4_SET -#elif !defined(ISB_SET) -#define ISB_SET -#endif -#endif - -#if (FUNCS_IN_C & ENC_KEYING_IN_C) || (FUNCS_IN_C & DEC_KEYING_IN_C) -#if KEY_SCHED == ONE_TABLE -#define LS1_SET -#elif KEY_SCHED == FOUR_TABLES -#define LS4_SET -#elif !defined( SBX_SET ) -#define SBX_SET -#endif -#endif - -#if (FUNCS_IN_C & DEC_KEYING_IN_C) -#if KEY_SCHED == ONE_TABLE -#define IM1_SET -#elif KEY_SCHED == FOUR_TABLES -#define IM4_SET -#elif !defined( SBX_SET ) -#define SBX_SET -#endif -#endif - -/* generic definitions of Rijndael macros that use tables */ - -#define no_table(x,box,vf,rf,c) bytes2word( \ - box[bval(vf(x,0,c),rf(0,c))], \ - box[bval(vf(x,1,c),rf(1,c))], \ - box[bval(vf(x,2,c),rf(2,c))], \ - box[bval(vf(x,3,c),rf(3,c))]) - -#define one_table(x,op,tab,vf,rf,c) \ - ( tab[bval(vf(x,0,c),rf(0,c))] \ - ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \ - ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \ - ^ op(tab[bval(vf(x,3,c),rf(3,c))],3)) - -#define four_tables(x,tab,vf,rf,c) \ - ( tab[0][bval(vf(x,0,c),rf(0,c))] \ - ^ tab[1][bval(vf(x,1,c),rf(1,c))] \ - ^ tab[2][bval(vf(x,2,c),rf(2,c))] \ - ^ tab[3][bval(vf(x,3,c),rf(3,c))]) - -#define vf1(x,r,c) (x) -#define rf1(r,c) (r) -#define rf2(r,c) ((8+r-c)&3) - -/* perform forward and inverse column mix operation on four bytes in long word x in */ -/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */ - -#if defined( FM4_SET ) /* not currently used */ -#define fwd_mcol(x) four_tables(x,t_use(f,m),vf1,rf1,0) -#elif defined( FM1_SET ) /* not currently used */ -#define fwd_mcol(x) one_table(x,upr,t_use(f,m),vf1,rf1,0) -#else -#define dec_fmvars uint_32t g2 -#define fwd_mcol(x) (g2 = gf_mulx(x), g2 ^ upr((x) ^ g2, 3) ^ upr((x), 2) ^ upr((x), 1)) -#endif - -#if defined( IM4_SET ) -#define inv_mcol(x) four_tables(x,t_use(i,m),vf1,rf1,0) -#elif defined( IM1_SET ) -#define inv_mcol(x) one_table(x,upr,t_use(i,m),vf1,rf1,0) -#else -#define dec_imvars uint_32t g2, g4, g9 -#define inv_mcol(x) (g2 = gf_mulx(x), g4 = gf_mulx(g2), g9 = (x) ^ gf_mulx(g4), g4 ^= g9, \ - (x) ^ g2 ^ g4 ^ upr(g2 ^ g9, 3) ^ upr(g4, 2) ^ upr(g9, 1)) -#endif - -#if defined( FL4_SET ) -#define ls_box(x,c) four_tables(x,t_use(f,l),vf1,rf2,c) -#elif defined( LS4_SET ) -#define ls_box(x,c) four_tables(x,t_use(l,s),vf1,rf2,c) -#elif defined( FL1_SET ) -#define ls_box(x,c) one_table(x,upr,t_use(f,l),vf1,rf2,c) -#elif defined( LS1_SET ) -#define ls_box(x,c) one_table(x,upr,t_use(l,s),vf1,rf2,c) -#else -#define ls_box(x,c) no_table(x,t_use(s,box),vf1,rf2,c) -#endif - -#if defined( ASM_X86_V1C ) && defined( AES_DECRYPT ) && !defined( ISB_SET ) -#define ISB_SET -#endif - -#endif diff --git a/libs/libzrtp/third_party/bgaes/aestab.c b/libs/libzrtp/third_party/bgaes/aestab.c deleted file mode 100644 index b3487536da..0000000000 --- a/libs/libzrtp/third_party/bgaes/aestab.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 -*/ - -#define DO_TABLES - -#include "aes.h" -#include "aesopt.h" - - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -//[winfix] -#if 0 -#if ZRTP_PLATFORM != ZP_WIN32 && ZRTP_PLATFORM != ZP_WIN32_KERNEL -#ifndef FIXED_TABLES - #warning "FIXED_TABLES isn't defined. Use dynamic tables." -#else - #warning "FIXED_TABLES is defined. Use static tables." -#endif -#endif -#endif - -#if defined(FIXED_TABLES) - -#define sb_data(w) {\ - w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\ - w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\ - w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\ - w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\ - w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\ - w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\ - w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\ - w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\ - w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\ - w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\ - w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\ - w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\ - w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\ - w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\ - w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\ - w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\ - w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\ - w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\ - w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\ - w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\ - w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\ - w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\ - w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\ - w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\ - w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\ - w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\ - w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\ - w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\ - w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\ - w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\ - w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\ - w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16) } - -#define isb_data(w) {\ - w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\ - w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\ - w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\ - w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\ - w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\ - w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\ - w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\ - w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\ - w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\ - w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\ - w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\ - w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\ - w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\ - w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\ - w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\ - w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\ - w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\ - w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\ - w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\ - w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\ - w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\ - w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\ - w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\ - w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\ - w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\ - w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\ - w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\ - w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\ - w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\ - w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\ - w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\ - w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d) } - -#define mm_data(w) {\ - w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\ - w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\ - w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\ - w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\ - w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\ - w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\ - w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\ - w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\ - w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\ - w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\ - w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\ - w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\ - w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\ - w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\ - w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\ - w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\ - w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\ - w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\ - w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\ - w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\ - w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\ - w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\ - w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\ - w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\ - w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\ - w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\ - w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\ - w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\ - w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\ - w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\ - w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\ - w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff) } - -#define rc_data(w) {\ - w(0x01), w(0x02), w(0x04), w(0x08), w(0x10),w(0x20), w(0x40), w(0x80),\ - w(0x1b), w(0x36) } - -#define h0(x) (x) - -#define w0(p) bytes2word(p, 0, 0, 0) -#define w1(p) bytes2word(0, p, 0, 0) -#define w2(p) bytes2word(0, 0, p, 0) -#define w3(p) bytes2word(0, 0, 0, p) - -#define u0(p) bytes2word(f2(p), p, p, f3(p)) -#define u1(p) bytes2word(f3(p), f2(p), p, p) -#define u2(p) bytes2word(p, f3(p), f2(p), p) -#define u3(p) bytes2word(p, p, f3(p), f2(p)) - -#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p)) -#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p)) -#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p)) -#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p)) - -#endif - -#if defined(FIXED_TABLES) || !defined(FF_TABLES) - -#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY)) -#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) -#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ - ^ (((x>>5) & 4) * WPOLY)) -#define f3(x) (f2(x) ^ x) -#define f9(x) (f8(x) ^ x) -#define fb(x) (f8(x) ^ f2(x) ^ x) -#define fd(x) (f8(x) ^ f4(x) ^ x) -#define fe(x) (f8(x) ^ f4(x) ^ f2(x)) - -#else - -#define f2(x) ((x) ? pow[log[x] + 0x19] : 0) -#define f3(x) ((x) ? pow[log[x] + 0x01] : 0) -#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0) -#define fb(x) ((x) ? pow[log[x] + 0x68] : 0) -#define fd(x) ((x) ? pow[log[x] + 0xee] : 0) -#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0) -#define fi(x) ((x) ? pow[ 255 - log[x]] : 0) - -#endif - -#include "aestab.h" - -#if defined(FIXED_TABLES) - -/* implemented in case of wrong call for fixed tables */ - -AES_RETURN zrtp_bg_gen_tabs(void) -{ - return EXIT_SUCCESS; -} - -#else /* dynamic table generation */ - -#if !defined(FF_TABLES) - -/* Generate the tables for the dynamic table option - - It will generally be sensible to use tables to compute finite - field multiplies and inverses but where memory is scarse this - code might sometimes be better. But it only has effect during - initialisation so its pretty unimportant in overall terms. -*/ - -/* return 2 ^ (n - 1) where n is the bit number of the highest bit - set in x with x in the range 1 < x < 0x00000200. This form is - used so that locals within fi can be bytes rather than words -*/ - -static uint_8t hibit(const uint_32t x) -{ uint_8t r = (uint_8t)((x >> 1) | (x >> 2)); - - r |= (r >> 2); - r |= (r >> 4); - return (r + 1) >> 1; -} - -/* return the inverse of the finite field element x */ - -static uint_8t fi(const uint_8t x) -{ uint_8t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0; - - if(x < 2) return x; - - for(;;) - { - if(!n1) return v1; - - while(n2 >= n1) - { - n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2); - } - - if(!n2) return v2; - - while(n1 >= n2) - { - n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1); - } - } -} - -#endif - -/* The forward and inverse affine transformations used in the S-box */ - -#define fwd_affine(x) \ - (w = (uint_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(uint_8t)(w^(w>>8))) - -#define inv_affine(x) \ - (w = (uint_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(uint_8t)(w^(w>>8))) - -static int init = 0; - -AES_RETURN zrtp_bg_gen_tabs(void) -{ uint_32t i, w; -#if defined(FF_TABLES) - - uint_8t pow[512], log[256]; - - if(init) - return EXIT_SUCCESS; - /* log and power tables for GF(2^8) finite field with - WPOLY as modular polynomial - the simplest primitive - root is 0x03, used here to generate the tables - */ - - i = 0; w = 1; - do - { - pow[i] = (uint_8t)w; - pow[i + 255] = (uint_8t)w; - log[w] = (uint_8t)i++; - w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0); - } - while (w != 1); - -#else - if(init) - return EXIT_SUCCESS; -#endif - - for(i = 0, w = 1; i < RC_LENGTH; ++i) - { - t_set(r,c)[i] = bytes2word(w, 0, 0, 0); - w = f2(w); - } - - for(i = 0; i < 256; ++i) - { uint_8t b; - - b = fwd_affine(fi((uint_8t)i)); - w = bytes2word(f2(b), b, b, f3(b)); - -#if defined( SBX_SET ) - t_set(s,box)[i] = b; -#endif - -#if defined( FT1_SET ) /* tables for a normal encryption round */ - t_set(f,n)[i] = w; -#endif -#if defined( FT4_SET ) - t_set(f,n)[0][i] = w; - t_set(f,n)[1][i] = upr(w,1); - t_set(f,n)[2][i] = upr(w,2); - t_set(f,n)[3][i] = upr(w,3); -#endif - w = bytes2word(b, 0, 0, 0); - -#if defined( FL1_SET ) /* tables for last encryption round (may also */ - t_set(f,l)[i] = w; /* be used in the key schedule) */ -#endif -#if defined( FL4_SET ) - t_set(f,l)[0][i] = w; - t_set(f,l)[1][i] = upr(w,1); - t_set(f,l)[2][i] = upr(w,2); - t_set(f,l)[3][i] = upr(w,3); -#endif - -#if defined( LS1_SET ) /* table for key schedule if t_set(f,l) above is */ - t_set(l,s)[i] = w; /* not of the required form */ -#endif -#if defined( LS4_SET ) - t_set(l,s)[0][i] = w; - t_set(l,s)[1][i] = upr(w,1); - t_set(l,s)[2][i] = upr(w,2); - t_set(l,s)[3][i] = upr(w,3); -#endif - - b = fi(inv_affine((uint_8t)i)); - w = bytes2word(fe(b), f9(b), fd(b), fb(b)); - -#if defined( IM1_SET ) /* tables for the inverse mix column operation */ - t_set(i,m)[b] = w; -#endif -#if defined( IM4_SET ) - t_set(i,m)[0][b] = w; - t_set(i,m)[1][b] = upr(w,1); - t_set(i,m)[2][b] = upr(w,2); - t_set(i,m)[3][b] = upr(w,3); -#endif - -#if defined( ISB_SET ) - t_set(i,box)[i] = b; -#endif -#if defined( IT1_SET ) /* tables for a normal decryption round */ - t_set(i,n)[i] = w; -#endif -#if defined( IT4_SET ) - t_set(i,n)[0][i] = w; - t_set(i,n)[1][i] = upr(w,1); - t_set(i,n)[2][i] = upr(w,2); - t_set(i,n)[3][i] = upr(w,3); -#endif - w = bytes2word(b, 0, 0, 0); -#if defined( IL1_SET ) /* tables for last decryption round */ - t_set(i,l)[i] = w; -#endif -#if defined( IL4_SET ) - t_set(i,l)[0][i] = w; - t_set(i,l)[1][i] = upr(w,1); - t_set(i,l)[2][i] = upr(w,2); - t_set(i,l)[3][i] = upr(w,3); -#endif - } - init = 1; - return EXIT_SUCCESS; -} - -#endif - -#if defined(__cplusplus) -} -#endif - diff --git a/libs/libzrtp/third_party/bgaes/aestab.h b/libs/libzrtp/third_party/bgaes/aestab.h deleted file mode 100644 index ea960f3294..0000000000 --- a/libs/libzrtp/third_party/bgaes/aestab.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 - - This file contains the code for declaring the tables needed to implement - AES. The file aesopt.h is assumed to be included before this header file. - If there are no global variables, the definitions here can be used to put - the AES tables in a structure so that a pointer can then be added to the - AES context to pass them to the AES routines that need them. If this - facility is used, the calling program has to ensure that this pointer is - managed appropriately. In particular, the value of the t_dec(in,it) item - in the table structure must be set to zero in order to ensure that the - tables are initialised. In practice the three code sequences in aeskey.c - that control the calls to zrtp_bg_gen_tabs() and the gen_tabs() routine itself will - have to be changed for a specific implementation. If global variables are - available it will generally be preferable to use them with the precomputed - FIXED_TABLES option that uses static global tables. - - The following defines can be used to control the way the tables - are defined, initialised and used in embedded environments that - require special features for these purposes - - the 't_dec' construction is used to declare fixed table arrays - the 't_set' construction is used to set fixed table values - the 't_use' construction is used to access fixed table values - - 256 byte tables: - - t_xxx(s,box) => forward S box - t_xxx(i,box) => inverse S box - - 256 32-bit word OR 4 x 256 32-bit word tables: - - t_xxx(f,n) => forward normal round - t_xxx(f,l) => forward last round - t_xxx(i,n) => inverse normal round - t_xxx(i,l) => inverse last round - t_xxx(l,s) => key schedule table - t_xxx(i,m) => key schedule table - - Other variables and tables: - - t_xxx(r,c) => the rcon table -*/ - -#if !defined( _AESTAB_H ) -#define _AESTAB_H - -#define t_dec(m,n) zrtp_bg_t_##m##n -#define t_set(m,n) zrtp_bg_t_##m##n -#define t_use(m,n) zrtp_bg_t_##m##n - -#if defined(FIXED_TABLES) -# if defined( __MSDOS__ ) || defined( __WIN16__ ) -/* make tables far data to avoid using too much DGROUP space (PG) */ -# define CONST const far -# else -# define CONST const -# endif -#else -# define CONST -#endif - -#if defined(DO_TABLES) -#define EXTERN -#else -#define EXTERN extern -#endif - -#if defined(_MSC_VER) && defined(TABLE_ALIGN) -#define ALIGN __declspec(align(TABLE_ALIGN)) -#else -#define ALIGN -#endif - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if defined( __WATCOMC__ ) && ( __WATCOMC__ >= 1100 ) -# define XP_DIR __cdecl -#else -# define XP_DIR -#endif - -#if defined(DO_TABLES) && defined(FIXED_TABLES) -#define d_1(t,n,b,e) ALIGN CONST XP_DIR t n[256] = b(e) -#define d_4(t,n,b,e,f,g,h) ALIGN CONST XP_DIR t n[4][256] = { b(e), b(f), b(g), b(h) } -EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH] = rc_data(w0); -#else -#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] -#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] -EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH]; -#endif - -#if defined( SBX_SET ) - d_1(uint_8t, t_dec(s,box), sb_data, h0); -#endif -#if defined( ISB_SET ) - d_1(uint_8t, t_dec(i,box), isb_data, h0); -#endif - -#if defined( FT1_SET ) - d_1(uint_32t, t_dec(f,n), sb_data, u0); -#endif -#if defined( FT4_SET ) - d_4(uint_32t, t_dec(f,n), sb_data, u0, u1, u2, u3); -#endif - -#if defined( FL1_SET ) - d_1(uint_32t, t_dec(f,l), sb_data, w0); -#endif -#if defined( FL4_SET ) - d_4(uint_32t, t_dec(f,l), sb_data, w0, w1, w2, w3); -#endif - -#if defined( IT1_SET ) - d_1(uint_32t, t_dec(i,n), isb_data, v0); -#endif -#if defined( IT4_SET ) - d_4(uint_32t, t_dec(i,n), isb_data, v0, v1, v2, v3); -#endif - -#if defined( IL1_SET ) - d_1(uint_32t, t_dec(i,l), isb_data, w0); -#endif -#if defined( IL4_SET ) - d_4(uint_32t, t_dec(i,l), isb_data, w0, w1, w2, w3); -#endif - -#if defined( LS1_SET ) -#if defined( FL1_SET ) -#undef LS1_SET -#else - d_1(uint_32t, t_dec(l,s), sb_data, w0); -#endif -#endif - -#if defined( LS4_SET ) -#if defined( FL4_SET ) -#undef LS4_SET -#else - d_4(uint_32t, t_dec(l,s), sb_data, w0, w1, w2, w3); -#endif -#endif - -#if defined( IM1_SET ) - d_1(uint_32t, t_dec(i,m), mm_data, v0); -#endif -#if defined( IM4_SET ) - d_4(uint_32t, t_dec(i,m), mm_data, v0, v1, v2, v3); -#endif - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/libs/libzrtp/third_party/bgaes/bg2zrtp.h b/libs/libzrtp/third_party/bgaes/bg2zrtp.h deleted file mode 100644 index cc0374060d..0000000000 --- a/libs/libzrtp/third_party/bgaes/bg2zrtp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2006-2008 Philip R. Zimmermann. All rights reserved. - * Contact: http://www.philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krikun <v.krikun@soft-industry.com> <v.krikun@gmail.com> - */ - -#ifndef __BG2ZRTP_H__ -#define __BG2ZRTP_H__ - -/* Define platform byte order for Brian Gladman's AES */ -#include "zrtp_config.h" - -#define IS_BIG_ENDIAN 4321 -#define IS_LITTLE_ENDIAN 1234 - - -#if ZRTP_BYTE_ORDER == ZBO_LITTLE_ENDIAN - #define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -#elif ZRTP_BYTE_ORDER == ZBO_BIG_ENDIAN - #define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -#else - #error "Can't define byte order for BG AES. Edit zrtp_system.h" -#endif - - -/* Define integers for Brian Gladman's AES */ - -#define BRG_UI8 -typedef uint8_t uint_8t; - -#define BRG_UI16 -typedef uint16_t uint_16t; - -#define BRG_UI32 -//typedef uint32_t uint_32t; -typedef unsigned int uint_32t; - -#define BRG_UI64 -typedef uint64_t uint_64t; - - -#endif /*__BG2ZRTP_H__*/ diff --git a/libs/libzrtp/third_party/bgaes/brg_types.h b/libs/libzrtp/third_party/bgaes/brg_types.h deleted file mode 100644 index bed53959f4..0000000000 --- a/libs/libzrtp/third_party/bgaes/brg_types.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 - - The unsigned integer types defined here are of the form uint_<nn>t where - <nn> is the length of the type; for example, the unsigned 32-bit type is - 'uint_32t'. These are NOT the same as the 'C99 integer types' that are - defined in the inttypes.h and stdint.h headers since attempts to use these - types have shown that support for them is still highly variable. However, - since the latter are of the form uint<nn>_t, a regular expression search - and replace (in VC++ search on 'uint_{:z}t' and replace with 'uint\1_t') - can be used to convert the types used here to the C99 standard types. -*/ - -#ifndef BRG_TYPES_H -#define BRG_TYPES_H - -#if defined(__cplusplus) -extern "C" { -#endif - -#include "bg2zrtp.h" -//#include <limits.h> - - -#ifndef BRG_UI8 -# define BRG_UI8 -# if UCHAR_MAX == 255u - typedef unsigned char uint_8t; -# else -# error Please define uint_8t as an 8-bit unsigned integer type in brg_types.h -# endif -#endif - -#ifndef BRG_UI16 -# define BRG_UI16 -# if USHRT_MAX == 65535u - typedef unsigned short uint_16t; -# else -# error Please define uint_16t as a 16-bit unsigned short type in brg_types.h -# endif -#endif - -#ifndef BRG_UI32 -# define BRG_UI32 -# if UINT_MAX == 4294967295u -# define li_32(h) 0x##h##u - typedef unsigned int uint_32t; -# elif ULONG_MAX == 4294967295u -# define li_32(h) 0x##h##ul - typedef unsigned long uint_32t; -# elif defined( _CRAY ) -# error This code needs 32-bit data types, which Cray machines do not provide -# else -# error Please define uint_32t as a 32-bit unsigned integer type in brg_types.h -# endif -#endif - -#ifndef BRG_UI64 -# if defined( __BORLANDC__ ) && !defined( __MSDOS__ ) -# define BRG_UI64 -# define li_64(h) 0x##h##ull - typedef unsigned __int64 uint_64t; -# elif defined( _MSC_VER ) && ( _MSC_VER < 1300 ) /* 1300 == VC++ 7.0 */ -# define BRG_UI64 -# define li_64(h) 0x##h##ui64 - typedef unsigned __int64 uint_64t; -# elif defined( __sun ) && defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful -# define BRG_UI64 -# define li_64(h) 0x##h##ull - typedef unsigned long long uint_64t; -# elif defined( UINT_MAX ) && UINT_MAX > 4294967295u -# if UINT_MAX == 18446744073709551615u -# define BRG_UI64 -# define li_64(h) 0x##h##u - typedef unsigned int uint_64t; -# endif -# elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u -# if ULONG_MAX == 18446744073709551615ul -# define BRG_UI64 -# define li_64(h) 0x##h##ul - typedef unsigned long uint_64t; -# endif -# elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u -# if ULLONG_MAX == 18446744073709551615ull -# define BRG_UI64 -# define li_64(h) 0x##h##ull - typedef unsigned long long uint_64t; -# endif -# elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u -# if ULONG_LONG_MAX == 18446744073709551615ull -# define BRG_UI64 -# define li_64(h) 0x##h##ull - typedef unsigned long long uint_64t; -# endif -# endif -#endif - -#if defined( NEED_UINT_64T ) && !defined( BRG_UI64 ) -# error Please define uint_64t as an unsigned 64 bit type in brg_types.h -#endif - -#ifndef RETURN_VALUES -# define RETURN_VALUES -# if defined( DLL_EXPORT ) -# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER ) -# define VOID_RETURN __declspec( dllexport ) void __stdcall -# define INT_RETURN __declspec( dllexport ) int __stdcall -# elif defined( __GNUC__ ) -# define VOID_RETURN __declspec( __dllexport__ ) void -# define INT_RETURN __declspec( __dllexport__ ) int -# else -# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers -# endif -# elif defined( DLL_IMPORT ) -# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER ) -# define VOID_RETURN __declspec( dllimport ) void __stdcall -# define INT_RETURN __declspec( dllimport ) int __stdcall -# elif defined( __GNUC__ ) -# define VOID_RETURN __declspec( __dllimport__ ) void -# define INT_RETURN __declspec( __dllimport__ ) int -# else -# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers -# endif -# elif defined( __WATCOMC__ ) -# define VOID_RETURN void __cdecl -# define INT_RETURN int __cdecl -# else -# define VOID_RETURN void -# define INT_RETURN int -# endif -#endif - -/* These defines are used to declare buffers in a way that allows - faster operations on longer variables to be used. In all these - defines 'size' must be a power of 2 and >= 8 - - dec_unit_type(size,x) declares a variable 'x' of length - 'size' bits - - dec_bufr_type(size,bsize,x) declares a buffer 'x' of length 'bsize' - bytes defined as an array of variables - each of 'size' bits (bsize must be a - multiple of size / 8) - - ptr_cast(x,size) casts a pointer to a pointer to a - varaiable of length 'size' bits -*/ - -#define ui_type(size) uint_##size##t -#define dec_unit_type(size,x) typedef ui_type(size) x -#define dec_bufr_type(size,bsize,x) typedef ui_type(size) x[bsize / (size >> 3)] -#define ptr_cast(x,size) ((ui_type(size)*)(x)) - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/libs/libzrtp/third_party/bgaes/sha1.c b/libs/libzrtp/third_party/bgaes/sha1.c deleted file mode 100644 index 473e845b5b..0000000000 --- a/libs/libzrtp/third_party/bgaes/sha1.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 01/08/2005 - - This is a byte oriented version of SHA1 that operates on arrays of bytes - stored in memory. -*/ - -#include <string.h> /* for memcpy() etc. */ - -#include "sha1.h" -//#include "brg_endian.h" -#include "bg2zrtp.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if defined( _MSC_VER ) && ( _MSC_VER > 800 ) -#pragma intrinsic(memcpy) -#endif - -#if 0 && defined(_MSC_VER) -#define rotl32 _lrotl -#define rotr32 _lrotr -#else -#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) -#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) -#endif - -#if !defined(bswap_32) -#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) -#endif - -#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) -#define SWAP_BYTES -#else -#undef SWAP_BYTES -#endif - -#if defined(SWAP_BYTES) -#define bsw_32(p,n) \ - { int _i = (n); while(_i--) ((uint_32t*)p)[_i] = bswap_32(((uint_32t*)p)[_i]); } -#else -#define bsw_32(p,n) -#endif - -#define SHA1_MASK (SHA1_BLOCK_SIZE - 1) - -#if 0 - -#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define parity(x,y,z) ((x) ^ (y) ^ (z)) -#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -#else /* Discovered by Rich Schroeppel and Colin Plumb */ - -#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) -#define parity(x,y,z) ((x) ^ (y) ^ (z)) -#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) - -#endif - -/* Compile 64 bytes of hash data into SHA1 context. Note */ -/* that this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is in such an order that low */ -/* address bytes in the ORIGINAL byte stream will go in */ -/* this buffer to the high end of 32-bit words on BOTH big */ -/* and little endian systems */ - -#ifdef ARRAY -#define q(v,n) v[n] -#else -#define q(v,n) v##n -#endif - -#define one_cycle(v,a,b,c,d,e,f,k,h) \ - q(v,e) += rotr32(q(v,a),27) + \ - f(q(v,b),q(v,c),q(v,d)) + k + h; \ - q(v,b) = rotr32(q(v,b), 2) - -#define five_cycle(v,f,k,i) \ - one_cycle(v, 0,1,2,3,4, f,k,hf(i )); \ - one_cycle(v, 4,0,1,2,3, f,k,hf(i+1)); \ - one_cycle(v, 3,4,0,1,2, f,k,hf(i+2)); \ - one_cycle(v, 2,3,4,0,1, f,k,hf(i+3)); \ - one_cycle(v, 1,2,3,4,0, f,k,hf(i+4)) - -VOID_RETURN sha1_compile(sha1_ctx ctx[1]) -{ uint_32t *w = ctx->wbuf; - -#ifdef ARRAY - uint_32t v[5]; - memcpy(v, ctx->hash, 5 * sizeof(uint_32t)); -#else - uint_32t v0, v1, v2, v3, v4; - v0 = ctx->hash[0]; v1 = ctx->hash[1]; - v2 = ctx->hash[2]; v3 = ctx->hash[3]; - v4 = ctx->hash[4]; -#endif - -#define hf(i) w[i] - - five_cycle(v, ch, 0x5a827999, 0); - five_cycle(v, ch, 0x5a827999, 5); - five_cycle(v, ch, 0x5a827999, 10); - one_cycle(v,0,1,2,3,4, ch, 0x5a827999, hf(15)); \ - -#undef hf -#define hf(i) (w[(i) & 15] = rotl32( \ - w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \ - ^ w[((i) + 2) & 15] ^ w[(i) & 15], 1)) - - one_cycle(v,4,0,1,2,3, ch, 0x5a827999, hf(16)); - one_cycle(v,3,4,0,1,2, ch, 0x5a827999, hf(17)); - one_cycle(v,2,3,4,0,1, ch, 0x5a827999, hf(18)); - one_cycle(v,1,2,3,4,0, ch, 0x5a827999, hf(19)); - - five_cycle(v, parity, 0x6ed9eba1, 20); - five_cycle(v, parity, 0x6ed9eba1, 25); - five_cycle(v, parity, 0x6ed9eba1, 30); - five_cycle(v, parity, 0x6ed9eba1, 35); - - five_cycle(v, maj, 0x8f1bbcdc, 40); - five_cycle(v, maj, 0x8f1bbcdc, 45); - five_cycle(v, maj, 0x8f1bbcdc, 50); - five_cycle(v, maj, 0x8f1bbcdc, 55); - - five_cycle(v, parity, 0xca62c1d6, 60); - five_cycle(v, parity, 0xca62c1d6, 65); - five_cycle(v, parity, 0xca62c1d6, 70); - five_cycle(v, parity, 0xca62c1d6, 75); - -#ifdef ARRAY - ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; - ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; - ctx->hash[4] += v[4]; -#else - ctx->hash[0] += v0; ctx->hash[1] += v1; - ctx->hash[2] += v2; ctx->hash[3] += v3; - ctx->hash[4] += v4; -#endif -} - -VOID_RETURN sha1_begin(sha1_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - ctx->hash[0] = 0x67452301; - ctx->hash[1] = 0xefcdab89; - ctx->hash[2] = 0x98badcfe; - ctx->hash[3] = 0x10325476; - ctx->hash[4] = 0xc3d2e1f0; -} - -/* SHA1 hash data in an array of bytes into hash buffer and */ -/* call the hash_compile function as required. */ - -VOID_RETURN sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1]) -{ - uint_32t pos = (uint_32t)(ctx->count[0] & SHA1_MASK), - space = SHA1_BLOCK_SIZE - pos; - const unsigned char *sp = data; - - if((ctx->count[0] += len) < len) - ++(ctx->count[1]); - - while(len >= space) /* tranfer whole blocks if possible */ - { - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); - sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0; - bsw_32(ctx->wbuf, SHA1_BLOCK_SIZE >> 2); - sha1_compile(ctx); - } - - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); -} - -/* SHA1 final padding and digest calculation */ - -VOID_RETURN sha1_end(unsigned char hval[], sha1_ctx ctx[1]) -{ uint_32t i = (uint_32t)(ctx->count[0] & SHA1_MASK); - - /* put bytes in the buffer in an order in which references to */ - /* 32-bit words will put bytes with lower addresses into the */ - /* top of 32 bit words on BOTH big and little endian machines */ - bsw_32(ctx->wbuf, (i + 3) >> 2); - - /* we now need to mask valid bytes and add the padding which is */ - /* a single 1 bit and as many zero bits as necessary. Note that */ - /* we can always add the first padding byte here because the */ - /* buffer always has at least one empty slot */ - ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); - ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); - - /* we need 9 or more empty positions, one for the padding byte */ - /* (above) and eight for the length count. If there is not */ - /* enough space, pad and empty the buffer */ - if(i > SHA1_BLOCK_SIZE - 9) - { - if(i < 60) ctx->wbuf[15] = 0; - sha1_compile(ctx); - i = 0; - } - else /* compute a word index for the empty buffer positions */ - i = (i >> 2) + 1; - - while(i < 14) /* and zero pad all but last two positions */ - ctx->wbuf[i++] = 0; - - /* the following 32-bit length fields are assembled in the */ - /* wrong byte order on little endian machines but this is */ - /* corrected later since they are only ever used as 32-bit */ - /* word values. */ - ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); - ctx->wbuf[15] = ctx->count[0] << 3; - sha1_compile(ctx); - - /* extract the hash value as bytes in case the hash buffer is */ - /* misaligned for 32-bit words */ - for(i = 0; i < SHA1_DIGEST_SIZE; ++i) - hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); -} - -VOID_RETURN bg_sha1(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha1_ctx cx[1]; - - sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx); -} - -#if defined(__cplusplus) -} -#endif diff --git a/libs/libzrtp/third_party/bgaes/sha1.h b/libs/libzrtp/third_party/bgaes/sha1.h deleted file mode 100644 index 65ee6d39e4..0000000000 --- a/libs/libzrtp/third_party/bgaes/sha1.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 01/08/2005 -*/ - -#ifndef _SHA1_H -#define _SHA1_H - -#include <stdlib.h> -#include "brg_types.h" - -#define SHA1_BLOCK_SIZE 64 -#define SHA1_DIGEST_SIZE 20 - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* type to hold the SHA256 context */ - -typedef struct -{ uint_32t count[2]; - uint_32t hash[5]; - uint_32t wbuf[16]; -} sha1_ctx; - -/* Note that these prototypes are the same for both bit and */ -/* byte oriented implementations. However the length fields */ -/* are in bytes or bits as appropriate for the version used */ -/* and bit sequences are input as arrays of bytes in which */ -/* bit sequences run from the most to the least significant */ -/* end of each byte */ - -VOID_RETURN sha1_compile(sha1_ctx ctx[1]); - -VOID_RETURN sha1_begin(sha1_ctx ctx[1]); -VOID_RETURN sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1]); -VOID_RETURN sha1_end(unsigned char hval[], sha1_ctx ctx[1]); -VOID_RETURN sha1(unsigned char hval[], const unsigned char data[], unsigned long len); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/libs/libzrtp/third_party/bgaes/sha2.c b/libs/libzrtp/third_party/bgaes/sha2.c deleted file mode 100644 index 1a95984dcb..0000000000 --- a/libs/libzrtp/third_party/bgaes/sha2.c +++ /dev/null @@ -1,774 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 01/08/2005 - - This is a byte oriented version of SHA2 that operates on arrays of bytes - stored in memory. This code implements sha256, sha384 and sha512 but the - latter two functions rely on efficient 64-bit integer operations that - may not be very efficient on 32-bit machines - - The sha256 functions use a type 'sha256_ctx' to hold details of the - current hash state and uses the following three calls: - - void sha256_begin(sha256_ctx ctx[1]) - void sha256_hash(const unsigned char data[], - unsigned long len, sha256_ctx ctx[1]) - void sha_end1(unsigned char hval[], sha256_ctx ctx[1]) - - The first subroutine initialises a hash computation by setting up the - context in the sha256_ctx context. The second subroutine hashes 8-bit - bytes from array data[] into the hash state withinh sha256_ctx context, - the number of bytes to be hashed being given by the the unsigned long - integer len. The third subroutine completes the hash calculation and - places the resulting digest value in the array of 8-bit bytes hval[]. - - The sha384 and sha512 functions are similar and use the interfaces: - - void sha384_begin(sha384_ctx ctx[1]); - void sha384_hash(const unsigned char data[], - unsigned long len, sha384_ctx ctx[1]); - void sha384_end(unsigned char hval[], sha384_ctx ctx[1]); - - void sha512_begin(sha512_ctx ctx[1]); - void sha512_hash(const unsigned char data[], - unsigned long len, sha512_ctx ctx[1]); - void sha512_end(unsigned char hval[], sha512_ctx ctx[1]); - - In addition there is a function sha2 that can be used to call all these - functions using a call with a hash length parameter as follows: - - int sha2_begin(unsigned long len, sha2_ctx ctx[1]); - void sha2_hash(const unsigned char data[], - unsigned long len, sha2_ctx ctx[1]); - void sha2_end(unsigned char hval[], sha2_ctx ctx[1]); - - My thanks to Erik Andersen <andersen@codepoet.org> for testing this code - on big-endian systems and for his assistance with corrections -*/ - -#if 0 -#define UNROLL_SHA2 /* for SHA2 loop unroll */ -#endif - -#include <string.h> /* for memcpy() etc. */ - -#include "sha2.h" - -//#include "brg_endian.h" -#include "bg2zrtp.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if defined( _MSC_VER ) && ( _MSC_VER > 800 ) -#pragma intrinsic(memcpy) -#endif - -#if 0 && defined(_MSC_VER) -#define rotl32 _lrotl -#define rotr32 _lrotr -#else -#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) -#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) -#endif - -#if !defined(bswap_32) -#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) -#endif - -#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) -#define SWAP_BYTES -#else -#undef SWAP_BYTES -#endif - -#if 0 - -#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -#else /* Thanks to Rich Schroeppel and Colin Plumb for the following */ - -#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) -#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) - -#endif - -/* round transforms for SHA256 and SHA512 compression functions */ - -#define vf(n,i) v[(n - i) & 7] - -#define hf(i) (p[i & 15] += \ - g_1(p[(i + 14) & 15]) + p[(i + 9) & 15] + g_0(p[(i + 1) & 15])) - -#define v_cycle(i,j) \ - vf(7,i) += (j ? hf(i) : p[i]) + k_0[i+j] \ - + s_1(vf(4,i)) + ch(vf(4,i),vf(5,i),vf(6,i)); \ - vf(3,i) += vf(7,i); \ - vf(7,i) += s_0(vf(0,i))+ maj(vf(0,i),vf(1,i),vf(2,i)) - -#if defined(SHA_224) || defined(SHA_256) - -#define SHA256_MASK (SHA256_BLOCK_SIZE - 1) - -#if defined(SWAP_BYTES) -#define bsw_32(p,n) \ - { int _i = (n); while(_i--) ((uint_32t*)p)[_i] = bswap_32(((uint_32t*)p)[_i]); } -#else -#define bsw_32(p,n) -#endif - -#define s_0(x) (rotr32((x), 2) ^ rotr32((x), 13) ^ rotr32((x), 22)) -#define s_1(x) (rotr32((x), 6) ^ rotr32((x), 11) ^ rotr32((x), 25)) -#define g_0(x) (rotr32((x), 7) ^ rotr32((x), 18) ^ ((x) >> 3)) -#define g_1(x) (rotr32((x), 17) ^ rotr32((x), 19) ^ ((x) >> 10)) -#define k_0 k256 - -/* rotated SHA256 round definition. Rather than swapping variables as in */ -/* FIPS-180, different variables are 'rotated' on each round, returning */ -/* to their starting positions every eight rounds */ - -#define q(n) v##n - -#define one_cycle(a,b,c,d,e,f,g,h,k,w) \ - q(h) += s_1(q(e)) + ch(q(e), q(f), q(g)) + k + w; \ - q(d) += q(h); q(h) += s_0(q(a)) + maj(q(a), q(b), q(c)) - -/* SHA256 mixing data */ - -const uint_32t k256[64] = -{ 0x428a2f98ul, 0x71374491ul, 0xb5c0fbcful, 0xe9b5dba5ul, - 0x3956c25bul, 0x59f111f1ul, 0x923f82a4ul, 0xab1c5ed5ul, - 0xd807aa98ul, 0x12835b01ul, 0x243185beul, 0x550c7dc3ul, - 0x72be5d74ul, 0x80deb1feul, 0x9bdc06a7ul, 0xc19bf174ul, - 0xe49b69c1ul, 0xefbe4786ul, 0x0fc19dc6ul, 0x240ca1ccul, - 0x2de92c6ful, 0x4a7484aaul, 0x5cb0a9dcul, 0x76f988daul, - 0x983e5152ul, 0xa831c66dul, 0xb00327c8ul, 0xbf597fc7ul, - 0xc6e00bf3ul, 0xd5a79147ul, 0x06ca6351ul, 0x14292967ul, - 0x27b70a85ul, 0x2e1b2138ul, 0x4d2c6dfcul, 0x53380d13ul, - 0x650a7354ul, 0x766a0abbul, 0x81c2c92eul, 0x92722c85ul, - 0xa2bfe8a1ul, 0xa81a664bul, 0xc24b8b70ul, 0xc76c51a3ul, - 0xd192e819ul, 0xd6990624ul, 0xf40e3585ul, 0x106aa070ul, - 0x19a4c116ul, 0x1e376c08ul, 0x2748774cul, 0x34b0bcb5ul, - 0x391c0cb3ul, 0x4ed8aa4aul, 0x5b9cca4ful, 0x682e6ff3ul, - 0x748f82eeul, 0x78a5636ful, 0x84c87814ul, 0x8cc70208ul, - 0x90befffaul, 0xa4506cebul, 0xbef9a3f7ul, 0xc67178f2ul, -}; - -/* Compile 64 bytes of hash data into SHA256 digest value */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is such that low address bytes */ -/* in the ORIGINAL byte stream will go into the high end of */ -/* words on BOTH big and little endian systems */ - -VOID_RETURN sha256_compile(sha256_ctx ctx[1]) -{ -#if !defined(UNROLL_SHA2) - - uint_32t j, *p = ctx->wbuf, v[8]; - - memcpy(v, ctx->hash, 8 * sizeof(uint_32t)); - - for(j = 0; j < 64; j += 16) - { - v_cycle( 0, j); v_cycle( 1, j); - v_cycle( 2, j); v_cycle( 3, j); - v_cycle( 4, j); v_cycle( 5, j); - v_cycle( 6, j); v_cycle( 7, j); - v_cycle( 8, j); v_cycle( 9, j); - v_cycle(10, j); v_cycle(11, j); - v_cycle(12, j); v_cycle(13, j); - v_cycle(14, j); v_cycle(15, j); - } - - ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; - ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; - ctx->hash[4] += v[4]; ctx->hash[5] += v[5]; - ctx->hash[6] += v[6]; ctx->hash[7] += v[7]; - -#else - - uint_32t *p = ctx->wbuf,v0,v1,v2,v3,v4,v5,v6,v7; - - v0 = ctx->hash[0]; v1 = ctx->hash[1]; - v2 = ctx->hash[2]; v3 = ctx->hash[3]; - v4 = ctx->hash[4]; v5 = ctx->hash[5]; - v6 = ctx->hash[6]; v7 = ctx->hash[7]; - - one_cycle(0,1,2,3,4,5,6,7,k256[ 0],p[ 0]); - one_cycle(7,0,1,2,3,4,5,6,k256[ 1],p[ 1]); - one_cycle(6,7,0,1,2,3,4,5,k256[ 2],p[ 2]); - one_cycle(5,6,7,0,1,2,3,4,k256[ 3],p[ 3]); - one_cycle(4,5,6,7,0,1,2,3,k256[ 4],p[ 4]); - one_cycle(3,4,5,6,7,0,1,2,k256[ 5],p[ 5]); - one_cycle(2,3,4,5,6,7,0,1,k256[ 6],p[ 6]); - one_cycle(1,2,3,4,5,6,7,0,k256[ 7],p[ 7]); - one_cycle(0,1,2,3,4,5,6,7,k256[ 8],p[ 8]); - one_cycle(7,0,1,2,3,4,5,6,k256[ 9],p[ 9]); - one_cycle(6,7,0,1,2,3,4,5,k256[10],p[10]); - one_cycle(5,6,7,0,1,2,3,4,k256[11],p[11]); - one_cycle(4,5,6,7,0,1,2,3,k256[12],p[12]); - one_cycle(3,4,5,6,7,0,1,2,k256[13],p[13]); - one_cycle(2,3,4,5,6,7,0,1,k256[14],p[14]); - one_cycle(1,2,3,4,5,6,7,0,k256[15],p[15]); - - one_cycle(0,1,2,3,4,5,6,7,k256[16],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[17],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[18],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[19],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[20],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[21],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[22],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[23],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[24],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[25],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[26],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[27],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[28],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[29],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[30],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[31],hf(15)); - - one_cycle(0,1,2,3,4,5,6,7,k256[32],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[33],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[34],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[35],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[36],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[37],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[38],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[39],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[40],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[41],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[42],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[43],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[44],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[45],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[46],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[47],hf(15)); - - one_cycle(0,1,2,3,4,5,6,7,k256[48],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[49],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[50],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[51],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[52],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[53],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[54],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[55],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[56],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[57],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[58],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[59],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[60],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[61],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[62],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[63],hf(15)); - - ctx->hash[0] += v0; ctx->hash[1] += v1; - ctx->hash[2] += v2; ctx->hash[3] += v3; - ctx->hash[4] += v4; ctx->hash[5] += v5; - ctx->hash[6] += v6; ctx->hash[7] += v7; -#endif -} - -/* SHA256 hash data in an array of bytes into hash buffer */ -/* and call the hash_compile function as required. */ - -VOID_RETURN sha256_hash(const unsigned char data[], unsigned long len, sha256_ctx ctx[1]) -{ uint_32t pos = (uint_32t)(ctx->count[0] & SHA256_MASK), - space = SHA256_BLOCK_SIZE - pos; - const unsigned char *sp = data; - - if((ctx->count[0] += len) < len) - ++(ctx->count[1]); - - while(len >= space) /* tranfer whole blocks while possible */ - { - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); - sp += space; len -= space; space = SHA256_BLOCK_SIZE; pos = 0; - bsw_32(ctx->wbuf, SHA256_BLOCK_SIZE >> 2) - sha256_compile(ctx); - } - - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); -} - -/* SHA256 Final padding and digest calculation */ - -static void sha_end1(unsigned char hval[], sha256_ctx ctx[1], const unsigned int hlen) -{ uint_32t i = (uint_32t)(ctx->count[0] & SHA256_MASK); - - /* put bytes in the buffer in an order in which references to */ - /* 32-bit words will put bytes with lower addresses into the */ - /* top of 32 bit words on BOTH big and little endian machines */ - bsw_32(ctx->wbuf, (i + 3) >> 2) - - /* we now need to mask valid bytes and add the padding which is */ - /* a single 1 bit and as many zero bits as necessary. Note that */ - /* we can always add the first padding byte here because the */ - /* buffer always has at least one empty slot */ - ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); - ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); - - /* we need 9 or more empty positions, one for the padding byte */ - /* (above) and eight for the length count. If there is not */ - /* enough space pad and empty the buffer */ - if(i > SHA256_BLOCK_SIZE - 9) - { - if(i < 60) ctx->wbuf[15] = 0; - sha256_compile(ctx); - i = 0; - } - else /* compute a word index for the empty buffer positions */ - i = (i >> 2) + 1; - - while(i < 14) /* and zero pad all but last two positions */ - ctx->wbuf[i++] = 0; - - /* the following 32-bit length fields are assembled in the */ - /* wrong byte order on little endian machines but this is */ - /* corrected later since they are only ever used as 32-bit */ - /* word values. */ - ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); - ctx->wbuf[15] = ctx->count[0] << 3; - sha256_compile(ctx); - - /* extract the hash value as bytes in case the hash buffer is */ - /* mislaigned for 32-bit words */ - for(i = 0; i < hlen; ++i) - hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); -} - -#endif - -#if defined(SHA_224) - -const uint_32t i224[8] = -{ - 0xc1059ed8ul, 0x367cd507ul, 0x3070dd17ul, 0xf70e5939ul, - 0xffc00b31ul, 0x68581511ul, 0x64f98fa7ul, 0xbefa4fa4ul -}; - -VOID_RETURN sha224_begin(sha224_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i224, 8 * sizeof(uint_32t)); -} - -VOID_RETURN sha224_end(unsigned char hval[], sha224_ctx ctx[1]) -{ - sha_end1(hval, ctx, SHA224_DIGEST_SIZE); -} - -VOID_RETURN sha224(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha224_ctx cx[1]; - - sha224_begin(cx); - sha224_hash(data, len, cx); - sha_end1(hval, cx, SHA224_DIGEST_SIZE); -} - -#endif - -#if defined(SHA_256) - -const uint_32t i256[8] = -{ - 0x6a09e667ul, 0xbb67ae85ul, 0x3c6ef372ul, 0xa54ff53aul, - 0x510e527ful, 0x9b05688cul, 0x1f83d9abul, 0x5be0cd19ul -}; - -VOID_RETURN sha256_begin(sha256_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i256, 8 * sizeof(uint_32t)); -} - -VOID_RETURN sha256_end(unsigned char hval[], sha256_ctx ctx[1]) -{ - sha_end1(hval, ctx, SHA256_DIGEST_SIZE); -} - -VOID_RETURN sha256(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha256_ctx cx[1]; - - sha256_begin(cx); - sha256_hash(data, len, cx); - sha_end1(hval, cx, SHA256_DIGEST_SIZE); -} - -#endif - -#if defined(SHA_384) || defined(SHA_512) - -#define SHA512_MASK (SHA512_BLOCK_SIZE - 1) - -#define rotr64(x,n) (((x) >> n) | ((x) << (64 - n))) - -#if !defined(bswap_64) -#define bswap_64(x) (((uint_64t)(bswap_32((uint_32t)(x)))) << 32 | bswap_32((uint_32t)((x) >> 32))) -#endif - -#if defined(SWAP_BYTES) -#define bsw_64(p,n) \ - { int _i = (n); while(_i--) ((uint_64t*)p)[_i] = bswap_64(((uint_64t*)p)[_i]); } -#else -#define bsw_64(p,n) -#endif - -/* SHA512 mixing function definitions */ - -#ifdef s_0 -# undef s_0 -# undef s_1 -# undef g_0 -# undef g_1 -# undef k_0 -#endif - -#define s_0(x) (rotr64((x), 28) ^ rotr64((x), 34) ^ rotr64((x), 39)) -#define s_1(x) (rotr64((x), 14) ^ rotr64((x), 18) ^ rotr64((x), 41)) -#define g_0(x) (rotr64((x), 1) ^ rotr64((x), 8) ^ ((x) >> 7)) -#define g_1(x) (rotr64((x), 19) ^ rotr64((x), 61) ^ ((x) >> 6)) -#define k_0 k512 - -/* SHA384/SHA512 mixing data */ - -const uint_64t k512[80] = -{ - li_64(428a2f98d728ae22), li_64(7137449123ef65cd), - li_64(b5c0fbcfec4d3b2f), li_64(e9b5dba58189dbbc), - li_64(3956c25bf348b538), li_64(59f111f1b605d019), - li_64(923f82a4af194f9b), li_64(ab1c5ed5da6d8118), - li_64(d807aa98a3030242), li_64(12835b0145706fbe), - li_64(243185be4ee4b28c), li_64(550c7dc3d5ffb4e2), - li_64(72be5d74f27b896f), li_64(80deb1fe3b1696b1), - li_64(9bdc06a725c71235), li_64(c19bf174cf692694), - li_64(e49b69c19ef14ad2), li_64(efbe4786384f25e3), - li_64(0fc19dc68b8cd5b5), li_64(240ca1cc77ac9c65), - li_64(2de92c6f592b0275), li_64(4a7484aa6ea6e483), - li_64(5cb0a9dcbd41fbd4), li_64(76f988da831153b5), - li_64(983e5152ee66dfab), li_64(a831c66d2db43210), - li_64(b00327c898fb213f), li_64(bf597fc7beef0ee4), - li_64(c6e00bf33da88fc2), li_64(d5a79147930aa725), - li_64(06ca6351e003826f), li_64(142929670a0e6e70), - li_64(27b70a8546d22ffc), li_64(2e1b21385c26c926), - li_64(4d2c6dfc5ac42aed), li_64(53380d139d95b3df), - li_64(650a73548baf63de), li_64(766a0abb3c77b2a8), - li_64(81c2c92e47edaee6), li_64(92722c851482353b), - li_64(a2bfe8a14cf10364), li_64(a81a664bbc423001), - li_64(c24b8b70d0f89791), li_64(c76c51a30654be30), - li_64(d192e819d6ef5218), li_64(d69906245565a910), - li_64(f40e35855771202a), li_64(106aa07032bbd1b8), - li_64(19a4c116b8d2d0c8), li_64(1e376c085141ab53), - li_64(2748774cdf8eeb99), li_64(34b0bcb5e19b48a8), - li_64(391c0cb3c5c95a63), li_64(4ed8aa4ae3418acb), - li_64(5b9cca4f7763e373), li_64(682e6ff3d6b2b8a3), - li_64(748f82ee5defb2fc), li_64(78a5636f43172f60), - li_64(84c87814a1f0ab72), li_64(8cc702081a6439ec), - li_64(90befffa23631e28), li_64(a4506cebde82bde9), - li_64(bef9a3f7b2c67915), li_64(c67178f2e372532b), - li_64(ca273eceea26619c), li_64(d186b8c721c0c207), - li_64(eada7dd6cde0eb1e), li_64(f57d4f7fee6ed178), - li_64(06f067aa72176fba), li_64(0a637dc5a2c898a6), - li_64(113f9804bef90dae), li_64(1b710b35131c471b), - li_64(28db77f523047d84), li_64(32caab7b40c72493), - li_64(3c9ebe0a15c9bebc), li_64(431d67c49c100d4c), - li_64(4cc5d4becb3e42b6), li_64(597f299cfc657e2a), - li_64(5fcb6fab3ad6faec), li_64(6c44198c4a475817) -}; - -/* Compile 128 bytes of hash data into SHA384/512 digest */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is such that low address bytes */ -/* in the ORIGINAL byte stream will go into the high end of */ -/* words on BOTH big and little endian systems */ - -VOID_RETURN sha512_compile(sha512_ctx ctx[1]) -{ uint_64t v[8], *p = ctx->wbuf; - uint_32t j; - - memcpy(v, ctx->hash, 8 * sizeof(uint_64t)); - - for(j = 0; j < 80; j += 16) - { - v_cycle( 0, j); v_cycle( 1, j); - v_cycle( 2, j); v_cycle( 3, j); - v_cycle( 4, j); v_cycle( 5, j); - v_cycle( 6, j); v_cycle( 7, j); - v_cycle( 8, j); v_cycle( 9, j); - v_cycle(10, j); v_cycle(11, j); - v_cycle(12, j); v_cycle(13, j); - v_cycle(14, j); v_cycle(15, j); - } - - ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; - ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; - ctx->hash[4] += v[4]; ctx->hash[5] += v[5]; - ctx->hash[6] += v[6]; ctx->hash[7] += v[7]; -} - -/* Compile 128 bytes of hash data into SHA256 digest value */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is in such an order that low */ -/* address bytes in the ORIGINAL byte stream placed in this */ -/* buffer will now go to the high end of words on BOTH big */ -/* and little endian systems */ - -VOID_RETURN sha512_hash(const unsigned char data[], unsigned long len, sha512_ctx ctx[1]) -{ uint_32t pos = (uint_32t)(ctx->count[0] & SHA512_MASK), - space = SHA512_BLOCK_SIZE - pos; - const unsigned char *sp = data; - - if((ctx->count[0] += len) < len) - ++(ctx->count[1]); - - while(len >= space) /* tranfer whole blocks while possible */ - { - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); - sp += space; len -= space; space = SHA512_BLOCK_SIZE; pos = 0; - bsw_64(ctx->wbuf, SHA512_BLOCK_SIZE >> 3); - sha512_compile(ctx); - } - - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); -} - -/* SHA384/512 Final padding and digest calculation */ - -static void sha_end2(unsigned char hval[], sha512_ctx ctx[1], const unsigned int hlen) -{ uint_32t i = (uint_32t)(ctx->count[0] & SHA512_MASK); - - /* put bytes in the buffer in an order in which references to */ - /* 32-bit words will put bytes with lower addresses into the */ - /* top of 32 bit words on BOTH big and little endian machines */ - bsw_64(ctx->wbuf, (i + 7) >> 3); - - /* we now need to mask valid bytes and add the padding which is */ - /* a single 1 bit and as many zero bits as necessary. Note that */ - /* we can always add the first padding byte here because the */ - /* buffer always has at least one empty slot */ - ctx->wbuf[i >> 3] &= li_64(ffffffffffffff00) << 8 * (~i & 7); - ctx->wbuf[i >> 3] |= li_64(0000000000000080) << 8 * (~i & 7); - - /* we need 17 or more empty byte positions, one for the padding */ - /* byte (above) and sixteen for the length count. If there is */ - /* not enough space pad and empty the buffer */ - if(i > SHA512_BLOCK_SIZE - 17) - { - if(i < 120) ctx->wbuf[15] = 0; - sha512_compile(ctx); - i = 0; - } - else - i = (i >> 3) + 1; - - while(i < 14) - ctx->wbuf[i++] = 0; - - /* the following 64-bit length fields are assembled in the */ - /* wrong byte order on little endian machines but this is */ - /* corrected later since they are only ever used as 64-bit */ - /* word values. */ - ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 61); - ctx->wbuf[15] = ctx->count[0] << 3; - sha512_compile(ctx); - - /* extract the hash value as bytes in case the hash buffer is */ - /* misaligned for 32-bit words */ - for(i = 0; i < hlen; ++i) - hval[i] = (unsigned char)(ctx->hash[i >> 3] >> (8 * (~i & 7))); -} - -#endif - -#if defined(SHA_384) - -/* SHA384 initialisation data */ - -const uint_64t i384[80] = -{ - li_64(cbbb9d5dc1059ed8), li_64(629a292a367cd507), - li_64(9159015a3070dd17), li_64(152fecd8f70e5939), - li_64(67332667ffc00b31), li_64(8eb44a8768581511), - li_64(db0c2e0d64f98fa7), li_64(47b5481dbefa4fa4) -}; - -VOID_RETURN sha384_begin(sha384_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i384, 8 * sizeof(uint_64t)); -} - -VOID_RETURN sha384_end(unsigned char hval[], sha384_ctx ctx[1]) -{ - sha_end2(hval, ctx, SHA384_DIGEST_SIZE); -} - -VOID_RETURN sha384(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha384_ctx cx[1]; - - sha384_begin(cx); - sha384_hash(data, len, cx); - sha_end2(hval, cx, SHA384_DIGEST_SIZE); -} - -#endif - -#if defined(SHA_512) - -/* SHA512 initialisation data */ - -const uint_64t i512[80] = -{ - li_64(6a09e667f3bcc908), li_64(bb67ae8584caa73b), - li_64(3c6ef372fe94f82b), li_64(a54ff53a5f1d36f1), - li_64(510e527fade682d1), li_64(9b05688c2b3e6c1f), - li_64(1f83d9abfb41bd6b), li_64(5be0cd19137e2179) -}; - -VOID_RETURN sha512_begin(sha512_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i512, 8 * sizeof(uint_64t)); -} - -VOID_RETURN sha512_end(unsigned char hval[], sha512_ctx ctx[1]) -{ - sha_end2(hval, ctx, SHA512_DIGEST_SIZE); -} - -VOID_RETURN sha512(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha512_ctx cx[1]; - - sha512_begin(cx); - sha512_hash(data, len, cx); - sha_end2(hval, cx, SHA512_DIGEST_SIZE); -} - -#endif - -#if defined(SHA_2) - -#define CTX_224(x) ((x)->uu->ctx256) -#define CTX_256(x) ((x)->uu->ctx256) -#define CTX_384(x) ((x)->uu->ctx512) -#define CTX_512(x) ((x)->uu->ctx512) - -/* SHA2 initialisation */ - -INT_RETURN sha2_begin(unsigned long len, sha2_ctx ctx[1]) -{ - switch(len) - { -#if defined(SHA_224) - case 224: - case 28: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0; - memcpy(CTX_256(ctx)->hash, i224, 32); - ctx->sha2_len = 28; return EXIT_SUCCESS; -#endif -#if defined(SHA_256) - case 256: - case 32: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0; - memcpy(CTX_256(ctx)->hash, i256, 32); - ctx->sha2_len = 32; return EXIT_SUCCESS; -#endif -#if defined(SHA_384) - case 384: - case 48: CTX_384(ctx)->count[0] = CTX_384(ctx)->count[1] = 0; - memcpy(CTX_384(ctx)->hash, i384, 64); - ctx->sha2_len = 48; return EXIT_SUCCESS; -#endif -#if defined(SHA_512) - case 512: - case 64: CTX_512(ctx)->count[0] = CTX_512(ctx)->count[1] = 0; - memcpy(CTX_512(ctx)->hash, i512, 64); - ctx->sha2_len = 64; return EXIT_SUCCESS; -#endif - default: return EXIT_FAILURE; - } -} - -VOID_RETURN sha2_hash(const unsigned char data[], unsigned long len, sha2_ctx ctx[1]) -{ - switch(ctx->sha2_len) - { -#if defined(SHA_224) - case 28: sha224_hash(data, len, CTX_224(ctx)); return; -#endif -#if defined(SHA_256) - case 32: sha256_hash(data, len, CTX_256(ctx)); return; -#endif -#if defined(SHA_384) - case 48: sha384_hash(data, len, CTX_384(ctx)); return; -#endif -#if defined(SHA_512) - case 64: sha512_hash(data, len, CTX_512(ctx)); return; -#endif - } -} - -VOID_RETURN sha2_end(unsigned char hval[], sha2_ctx ctx[1]) -{ - switch(ctx->sha2_len) - { -#if defined(SHA_224) - case 28: sha_end1(hval, CTX_224(ctx), SHA224_DIGEST_SIZE); return; -#endif -#if defined(SHA_256) - case 32: sha_end1(hval, CTX_256(ctx), SHA256_DIGEST_SIZE); return; -#endif -#if defined(SHA_384) - case 48: sha_end2(hval, CTX_384(ctx), SHA384_DIGEST_SIZE); return; -#endif -#if defined(SHA_512) - case 64: sha_end2(hval, CTX_512(ctx), SHA512_DIGEST_SIZE); return; -#endif - } -} - -INT_RETURN sha2(unsigned char hval[], unsigned long size, - const unsigned char data[], unsigned long len) -{ sha2_ctx cx[1]; - - if(sha2_begin(size, cx) == EXIT_SUCCESS) - { - sha2_hash(data, len, cx); sha2_end(hval, cx); return EXIT_SUCCESS; - } - else - return EXIT_FAILURE; -} - -#endif - -#if defined(__cplusplus) -} -#endif diff --git a/libs/libzrtp/third_party/bgaes/sha2.h b/libs/libzrtp/third_party/bgaes/sha2.h deleted file mode 100644 index 6ab8907c1a..0000000000 --- a/libs/libzrtp/third_party/bgaes/sha2.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 01/08/2005 -*/ - -#ifndef _SHA2_H -#define _SHA2_H - -#include <stdlib.h> - -#define SHA_64BIT - -/* define the hash functions that you need */ -#define SHA_2 /* for dynamic hash length */ -#define SHA_224 -#define SHA_256 -#ifdef SHA_64BIT -# define SHA_384 -# define SHA_512 -# define NEED_UINT_64T -#endif - -#include "brg_types.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* Note that the following function prototypes are the same */ -/* for both the bit and byte oriented implementations. But */ -/* the length fields are in bytes or bits as is appropriate */ -/* for the version used. Bit sequences are arrays of bytes */ -/* in which bit sequence indexes increase from the most to */ -/* the least significant end of each byte */ - -#define SHA224_DIGEST_SIZE 28 -#define SHA224_BLOCK_SIZE 64 -#define SHA256_DIGEST_SIZE 32 -#define SHA256_BLOCK_SIZE 64 - -/* type to hold the SHA256 (and SHA224) context */ - -typedef struct -{ uint_32t count[2]; - uint_32t hash[8]; - uint_32t wbuf[16]; -} sha256_ctx; - -typedef sha256_ctx sha224_ctx; - -VOID_RETURN sha256_compile(sha256_ctx ctx[1]); - -VOID_RETURN sha224_begin(sha224_ctx ctx[1]); -#define sha224_hash sha256_hash -VOID_RETURN sha224_end(unsigned char hval[], sha224_ctx ctx[1]); -VOID_RETURN sha224(unsigned char hval[], const unsigned char data[], unsigned long len); - -VOID_RETURN sha256_begin(sha256_ctx ctx[1]); -VOID_RETURN sha256_hash(const unsigned char data[], unsigned long len, sha256_ctx ctx[1]); -VOID_RETURN sha256_end(unsigned char hval[], sha256_ctx ctx[1]); -VOID_RETURN sha256(unsigned char hval[], const unsigned char data[], unsigned long len); - -#ifndef SHA_64BIT - -typedef struct -{ union - { sha256_ctx ctx256[1]; - } uu[1]; - uint_32t sha2_len; -} sha2_ctx; - -#define SHA2_MAX_DIGEST_SIZE SHA256_DIGEST_SIZE - -#else - -#define SHA384_DIGEST_SIZE 48 -#define SHA384_BLOCK_SIZE 128 -#define SHA512_DIGEST_SIZE 64 -#define SHA512_BLOCK_SIZE 128 -#define SHA2_MAX_DIGEST_SIZE SHA512_DIGEST_SIZE - -/* type to hold the SHA384 (and SHA512) context */ - -typedef struct -{ uint_64t count[2]; - uint_64t hash[8]; - uint_64t wbuf[16]; -} sha512_ctx; - -typedef sha512_ctx sha384_ctx; - -typedef struct -{ union - { sha256_ctx ctx256[1]; - sha512_ctx ctx512[1]; - } uu[1]; - uint_32t sha2_len; -} sha2_ctx; - -VOID_RETURN sha512_compile(sha512_ctx ctx[1]); - -VOID_RETURN sha384_begin(sha384_ctx ctx[1]); -#define sha384_hash sha512_hash -VOID_RETURN sha384_end(unsigned char hval[], sha384_ctx ctx[1]); -VOID_RETURN sha384(unsigned char hval[], const unsigned char data[], unsigned long len); - -VOID_RETURN sha512_begin(sha512_ctx ctx[1]); -VOID_RETURN sha512_hash(const unsigned char data[], unsigned long len, sha512_ctx ctx[1]); -VOID_RETURN sha512_end(unsigned char hval[], sha512_ctx ctx[1]); -VOID_RETURN sha512(unsigned char hval[], const unsigned char data[], unsigned long len); - -INT_RETURN sha2_begin(unsigned long size, sha2_ctx ctx[1]); -VOID_RETURN sha2_hash(const unsigned char data[], unsigned long len, sha2_ctx ctx[1]); -VOID_RETURN sha2_end(unsigned char hval[], sha2_ctx ctx[1]); -INT_RETURN sha2(unsigned char hval[], unsigned long size, const unsigned char data[], unsigned long len); - -#endif - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/libs/libzrtp/third_party/bnlib/.gitignore b/libs/libzrtp/third_party/bnlib/.gitignore deleted file mode 100644 index 49dd32a5b0..0000000000 --- a/libs/libzrtp/third_party/bnlib/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode:conf -*- -/*.a -/*.o -/Makefile -/autom4te.cache/* -/bnconfig.h -/config.* -/configure diff --git a/libs/libzrtp/third_party/bnlib/CHANGES b/libs/libzrtp/third_party/bnlib/CHANGES deleted file mode 100644 index b592ec7995..0000000000 --- a/libs/libzrtp/third_party/bnlib/CHANGES +++ /dev/null @@ -1,59 +0,0 @@ -1.1.4 -- Added bnBasePrecompCopy, bnDoubleBasePrecompExpMod, and corresponding - lbn* functions. -- Fixed some stupid bugs in bnExtractBigBytes and bnExtractLittleBytes - when asking for more bytes than the numbers have. - -1.1.3 -1999-05-09 -- Added bnBasePrecompBegin, bnBasePrecompEnd and bnBasePrecompExpMod, - and corresponding lbn* functions. -- Added some rudimentary tests of the above to bntest. -- Updated dsatest to use the new functions. Speedup on 1024 bits seems - to be about 3x. - -1.1.2: -1998-06-22 -- Added bnReadBit function -- Fixed corruption in bnMakeOdd_16 -- Clarified comments in germain.c -- Fixed nasty bug in lbnModQ_16 in lbn80386.asm -- renamed rand parameter to randFunc in prime.c to avoid warnings - -1.1.1: -- Cleaned up some test directory code - -1.1: Second public release - -- Generalized Sophie Germain primes to variable "orders", - which is the number of 2*p+1 levels that are all prime. - An order-0 primeis an ordinary prime. An order-1 prime is - a Sophie Germain prime. An order-3 prime also has 4*p+3 prime. - (Changed hours before release; I wonder if there are bugs?) -- Figured out that if p and 2*p+1 are prime, it's p that's called - a Sophie Germain prime, not 2*p+1. germain.c and germtest.c - updated accordingly. 2*p+1 is called a "strong prime". -- Updated to not use 16-bit MSDOS-isms like "cdecl" with GCC under GO32. -- Fixed a bug in primeGen() that caused it to do strange things - if the first number in the sieve passed. -- Fixed a memory leak in lbnExpMod -- Fixed bug in lbn80386.asm lbnModQ_32 (was a complete mess) -- Fixed bug in bnDoubleExpMod (one-character change; masked a bug in SKIP!) -- Fixed a bug in error recovery in lbnInv -- Added out-of-memory checking to bntest -- Installation documentation improved, especially for non-Unix platforms. -- Preprocessor trickery made compatible with some ancient sort-of-ANSI - compilers. To be precise: - - Not liking "#if FOO" when FOO is not defined (ANSI says FOO is "0") - - Not liking long constants without "l" (ANSI says all pp math is long) -- bnInit() made redundant; now called automatically by bnBegin(). -- bnCmpQ(struct BigNum const *, unsigned) added. -- Removed copyright disclaimers from some files so as not to confuse lawyers. -- Spell-checked, corrected and improved comments in lbn16.c. Especially - added a big description of Montgomery representation. -- Added parens a few places to shut up compiler warnings. -- Added 386 support for Unix and some GCC-specific inline assembler tricks. -- Got rid of some warnings in lbn8086.h. -- Improved PowerPC inline assembler for CodeWarrior 8. - -1.0: Initial release (unnumbered, retroactively named 1.0) diff --git a/libs/libzrtp/third_party/bnlib/Makefile.in b/libs/libzrtp/third_party/bnlib/Makefile.in deleted file mode 100644 index 7fc2a4429b..0000000000 --- a/libs/libzrtp/third_party/bnlib/Makefile.in +++ /dev/null @@ -1,182 +0,0 @@ -# -# This code is pretty well tested, but not optimizing it will have -# a *major* effect on speed, so its optimzation flags are separate -# from the rest of the release. -# -# For the SPARC v8, at least, gcc produces a *much* faster library than -# the SunPro C compiler. On a 50 MHz TI TMS390Z50 SuperSPARC: -# 14.5 vs. 47.2 ms per 256-bit modular exponentiation. -# 77.4 vs. 317.8 ms per 512-bit modular exponentiation. -# 249.0 vs. 1031.5 ms per 1024-bit modular exponentiation -# -CC=@CC@ -# for libzrtp support -CFLAGS=@CFLAGS@ @CPPFLAGS@ @WARN@ @TUNE@ @DEFS@ $(DEFINE) -I../../include -I../../include/enterprise -I../../projects/gnu/config -I../../third_party/bgaes -srcdir=@srcdir@ -VPATH=@srcdir@ - -# Extra object files (e.g. lbnalpha.o for Alpha assembly routines) -AUXOBJS= -# Extra definitions (e.g. -DBNINCLUDE=lbnalpha.h) -DEFINE= - -SHELL = /bin/sh -.SUFFIXES: -.SUFFIXES: .c .h .o .s - -LD =$(CC) -LDFLAGS =@LDFLAGS@ -LIBS=@LIBS@ -RANLIB=@RANLIB@ - -# If you have a machine-specific assembly file, add it to AUXOBJS. -OBJS = bn00.o lbn00.o bn.o lbnmem.o sieve.o prime.o \ - bnprint.o jacobi.o germain.o $(AUXOBJS) - -BNLIB = libbn.a - -# for libzrtp support -all: $(BNLIB) bntest32.c bntest64.c -# bntest germtest - -# for libzrtp support -install: all - test -d /usr/local/include/libzrtp || mkdir /usr/local/include/libzrtp - cp *.h /usr/local/include/libzrtp - cp 'libbn.a' '/usr/local/lib/libbn.a' - chmod 644 /usr/local/lib/libbn.a - chown 0:0 /usr/local/lib/libbn.a - $(RANLIB) '/usr/local/lib/libbn.a' - -# for libzrtp support -#check: bntest -# ./bntest -check: - -bntest: bntest00.o $(BNLIB) - $(LD) $(LDFLAGS) -o $@ bntest00.o $(BNLIB) $(LIBS) - -germtest: germtest.o $(BNLIB) - $(LD) $(LDFLAGS) -o $@ germtest.o $(BNLIB) $(LIBS) - -$(BNLIB): $(OBJS) - $(AR) r $@ $? - $(RANLIB) $@ - -# Here we get tricky... if we're compiling with GCC, then GCCMAGIC1 and -# GCCMAGIC2 are set so that we actually do a link, but with the -r flag -# (produce relocatable output) and with -lgcc *only*. This is so that -# the result can be linked cleanly with code compiled with another cc, -# which doesn't know about -lgcc. Presumably the lbnXX.o file, which -# has by far the most math in it, will have a call to every interesting -# support-library function. - -lbn00.o: $(srcdir)/lbn00.c $(HDRS) bnconfig.h - $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir) -o $@ @GCCMAGIC1@ lbn00.c @GCCMAGIC2@ - -lbn16.o: $(srcdir)/lbn16.c $(HDRS) bnconfig.h - $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir) -o $@ @GCCMAGIC1@ lbn16.c @GCCMAGIC2@ - -lbn32.o: $(srcdir)/lbn32.c $(HDRS) bnconfig.h - $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir) -o $@ @GCCMAGIC1@ lbn32.c @GCCMAGIC2@ - -lbn64.o: $(srcdir)/lbn64.c $(HDRS) bnconfig.h - $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir) -o $@ @GCCMAGIC1@ lbn64.c @GCCMAGIC2@ - -# The default .o rule. -.c.o: bnconfig.h - $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir) -o $@ -c $< - -# Extra, non-obvious dependencies. Bnlib can be compiled in three -# word sizes, and the *00.c files #include the right .c files based -# on <limits.h>, which means that a single compilation will only use a -# subset of these files. Duplicated here in case someone regenerates -# dependencies with cc -M and they get lost. - -lbn00.o: lbn16.c lbn32.c lbn64.c lbn16.h lbn32.h lbn64.h -bn00.o: bn16.c bn32.c bn64.c bn16.h bn32.h bn64.h \ - bninit16.c bninit32.c bninit64.c -bntest00.o: bntest16.c bntest32.c bntest64.c lbn16.h lbn32.h lbn64.h - -# Actual build commented out to prevent confusion by people without autoconf. -# Do it manually for now. -configure: configure.in - @echo "configure script is out of date; run autoconf" -# autoconf - -clean: - $(RM) -f *.o *32.[ch] *64.[ch] - -distclean: clean - -rm -f Makefile - -BNSOURCES = lbn32.c lbn32.h bn32.c bn32.h bninit32.c bntest32.c \ - lbn64.c lbn64.h bn64.c bn64.h bninit64.c bntest64.c - -# An explicit target that can be made before distribution for -# machines that don't have sed. -bnsources: $(BNSOURCES) - -# The 16-bit versions of the code are the master versions; all else is -# generated from them. This fiddling about makes them unwriteable -# to discourage improper edits. - -# (You didn't know that suffixes for suffix rules didn't have to begin -# with a period, did you?) -.SUFFIXES: 16.c 16.h 32.c 32.h 64.c 64.h -16.c32.c: - @test ! -f $@ -o -w $@ || chmod u+w $@ && test -w $@ || rm -f $@ - sed -e s/32/64/g -e s/16/32/g $< > $@ - @chmod a-w $@ - -16.h32.h: - @test ! -f $@ -o -w $@ || chmod u+w $@ && test -w $@ || rm -f $@ - sed -e s/32/64/g -e s/16/32/g $< > $@ - @chmod a-w $@ - -16.c64.c: - @test ! -f $@ -o -w $@ || chmod u+w $@ && test -w $@ || rm -f $@ - sed -e s/32/128/g -e s/16/64/g $< > $@ - @chmod a-w $@ - -16.h64.h: - @test ! -f $@ -o -w $@ || chmod u+w $@ && test -w $@ || rm -f $@ - sed -e s/32/128/g -e s/16/64/g $< > $@ - @chmod a-w $@ - -### Dependencies -bn.o: bn.c bn.h -bn00.o: bn00.c bnsize00.h lbn.h bn16.c bn32.c bn64.c lbn16.c lbn32.h \ - lbn64.h lbnmem.h bn16.h bn32.h bn64.h bn.h kludge.h bninit16.c \ - bninit32.c bninit64.c -bn16.o: bn16.c lbn.h lbn16.h lbnmem.h bn16.h bn.h kludge.h -bn32.o: bn32.c lbn.h lbn32.h lbnmem.h bn32.h bn.h kludge.h -bn64.o: bn64.c lbn.h lbn64.h lbnmem.h bn64.h bn.h kludge.h -bn68000.o: bn68000.c lbn.h lbn68000.h bn16.h bn32.h -bn8086.o: bn8086.c lbn.h bn64.h lbn8086.h bn32.h -bninit16.o: bninit16.c bn.h bn16.h -bninit32.o: bninit32.c bn.h bn32.h -bninit64.o: bninit64.c bn.h bn64.h -bnprint.o: bnprint.c bn.h bnprint.h kludge.h -bntest00.o: bntest00.c bnsize00.h lbn.h bntest16.c bntest32.c \ - bntest64.c cputime.h lbn16.h lbn32.h lbn64.h kludge.h -bntest16.o: bntest16.c cputime.h lbn16.h lbn.h kludge.h -bntest32.o: bntest32.c cputime.h lbn32.h lbn.h kludge.h -bntest64.o: bntest64.c cputime.h lbn64.h lbn.h kludge.h -germain.o: germain.c bn.h germain.h jacobi.h lbnmem.h sieve.h kludge.h -germtest.o: germtest.c bn.h germain.h sieve.h cputime.h bnprint.h -jacobi.o: jacobi.c bn.h jacobi.h -lbn00.o: lbn00.c bnsize00.h lbn.h lbn16.c lbn16.h lbn32.c lbn32.h \ - lbn64.c lbn64.h lbnmem.h kludge.h -lbn16.o: lbn16.c lbn.h lbn16.h lbnmem.h kludge.h -lbn32.o: lbn32.c lbn.h lbn32.h lbnmem.h kludge.h -lbn64.o: lbn64.c lbn.h lbn64.h lbnmem.h kludge.h -lbn68000.o: lbn68000.c lbn.h lbn68000.h -lbn68020.o: lbn68020.c lbn.h lbn68020.h -lbnmem.o: lbnmem.c lbn.h lbnmem.h kludge.h -lbnppc.o: lbnppc.c lbnppc.h ppcasm.h -prime.o: prime.c bn.h lbnmem.h prime.h sieve.h kludge.h -sieve.o: sieve.c bn.h sieve.h kludge.h -sizetest.c: bnsize00.h - -distdir: diff --git a/libs/libzrtp/third_party/bnlib/README.bn b/libs/libzrtp/third_party/bnlib/README.bn deleted file mode 100644 index 46facbb4c5..0000000000 --- a/libs/libzrtp/third_party/bnlib/README.bn +++ /dev/null @@ -1,225 +0,0 @@ -Welcome to my multiprecision math library! I'm a little bit proud -of it, particularly its speed. If you have a machine for which -assembly-language subroutines are available (you can probably guess -from the filename), it will go even faster. Instructions for -building the library with assembly subroutines are included later. - -Barring that, on many machines using GCC, the GNU C compiler, helps -the speed significantly, because it not only supports "long long" -64-bit data types, but it can perform operations on them in line. -Some other compilers that support "long long" generate inefficient -code for working with them. - -For a description of what the library does, see bn.doc. For a description -of how it's organized, see bnintern.doc. For the real nitty-gritty, -read the code. I'm very curious what you all think of it. One thing I -tried to do was to comment it better than most, although that is more -apparent in the lower-level parts of the code (the lbn* files) that I -wrote first rather than the higher levels, when I didn't need comments -to explain what I was doing to myself. - -I can't put a full number theory course in the comments, so there -are some parts that are just going to be confusing unless you -have the background. I'd rather not answer questions that elementary. -But really, I can't stop you from saying whatever you want. If you'd -like to send some comments, good or bad, send me some mail. --- - -Colin <colin@nyx.net> - - -** How to build the library - -For the full details of how all the bits go together, see bnintern.doc. -If you're on a Unix machine, run the "configure" script (generated from -configure.in using GNU autoconf) and it will set up the basic C version -automatically. Assembly-language support is still configured by hand. -(Just edit the generated Makefile.) If you're on another machine, -you'll have to do everything by hand, although it's still not hard. - -This library works in three word sizes: 16, 32 and 64 bits. The limiting -factor is that it needs a double-word multiply, so even a 64-bit SPARC -must use the 32-bit code, because it only produces a 64-bit multiply -result. The DEC Alpha, MIPS R4000 (and up) and the upcoming 64-bit -PowerPC, however, can use the 64-bit version, as they provide access to -the high 64 bits of an integer multiply result. - -Trying to compile the file "sizetest.c" will produce an error telling -you what word size is needed. In the absence of any assembly-language -support routines, if your compiler has 64-bit longs or 64-bit long longs, -you'll get the 32-bit version. Otherwise, you'll get the 16-bit version. - -The shipped archive contains only the 16-bit version of six important -source files: bn16.c, bn16.h, lbn16.c, lbn16.h, bninit16.c and bntest16.c. -The 32- and 64-bit versions are produced by a trivial replacement process -from those. They are built automatically on demand by the Unix Makefile; -other platforms will have to build them by hand if needed. - -If you have the Unix stream editor sed, you can do: - sed -e s/32/64/g -e s/16/32/g bn16.c > bn32.c - sed -e s/32/64/g -e s/16/32/g bn16.h > bn32.h - sed -e s/32/64/g -e s/16/32/g lbn16.c > lbn32.c - sed -e s/32/64/g -e s/16/32/g lbn16.h > lbn32.h - sed -e s/32/64/g -e s/16/32/g bninit16.c > bninit32.c - sed -e s/32/64/g -e s/16/32/g bntest16.c > bntest32.c - -If you don't, you'll have to use your favourite text editor and manually: - Copy bn16.c to bn32.c - Copy bn16.h to bn32.h - Copy lbn16.c to lbn32.c - Copy lbn16.h to lbn32.h - Copy bninit16.c to bninit32.c - Copy bntest16.c to bntest32.c - Edit bn32.c, bn32.h, lbn32.c, lbn32.h, bninit32.c and bntest32.c (*32.?) - Globally replace all "32" by "64" - Globally replace all "16" by "32" - -I don't know of any non-Unix platforms that can use the 64-bit version, -so you probably won't need it, but the process is siliar, just replace -every "32" with "128" and every "16" with "64". - -Once you have all the word size versions you need you can compile them. -If you're compiling a pure C version, or even a simple assembly-language -version, there are some special auto-size-detecting files that will -figure out (at compile time, using <limits.h> and the C preprocessor) -the largest size that it can compile and #include it. To compile that -version, you need to compile the following files: - -- bn.c -- bn00.c -- lbn00.c -- lbnmem.c -- legal.c - -The file "bntest00.c" (see README.bntest) is a low-level test program -that will check the correct operation of the core low-level routines of -the library. It needs only lbn00.c, lbnmem.c and legal.c. - -The file "germtest.c" is a simple program to generate Sophie Germain -primes which demonstrates the library's use. This uses the full library. - - -** Adding assembly-language support routines - -It is possible to include some assembly-language primitives in this. -For example, for the DEC Alpha primitives, you need to compile everything -with the -DBNINCLUDE=lbnalpha.h flag (or somehow get the effect of -"#define BNINCLUDE lbnalpha.h" in all of the code), and assemble and -link in "lbnalpha.s". - -If you want to compile a specific version of the library, say the -32-bit version, you need to compile together the following files: - -- bn.c -- bn32.c -- bninit32.c -- lbn32.c -- lbnmem.c -- legal.c - -Note the extra "bninit32.c" file. It contains only the function -"bnInit()" which does nothing but call "bnInit_32()". This is included in -"bn00.c", but is separated out here so that you can compile the library -for two word sizes and replace the bnInit() function with one that will -select a version to initialize at run time! That's described later. - -To include assembly-language support routines for a given processor -(as an example, I'll use the mythical "DLX" processor), compile all the -C files with -DBNINCLUDE=lbndlx.h and (or somehow get the effect of -"#define BNINCLUDE lbndlx.h" when compiling all the .c files), and -assemble and link in the lbndlx.s assembly-language file. - -The fun comes when you compile a version of the library for two -word sizes. This is currently only supported for the 680x0 and 80x86 -processors, which come in 16- and 32-bit versions, but this also makes -sense on MIPS and PowerPC processors that have 32- and 64-bit versions. - -To do this, you need to compile the library in two word sizes and include -a custom bndlx.c file that defines a smart bnInit() which chooses between -the two. For the 80x8 family (or the 680x0 family), you want to compile -the following with -DBNINCLUDE=lbn8086.h (or -DBNINCLUDE=lbn68000.h): - -- bn.c -- bn16.c -- bn32.c -- lbn16.c -- lbn32.c -- lbnmem.c -- legal.c -- lbn8086.asm (or lbn68000.c and lbn68020.c for the 680x0) -- bn8086.c (or bn68000.c for the 680x0) - -The lbn8086.asm file contains the assembly-language subroutines. -The lbn8086.h file contains declarations for them and the -necessary information to call them instead of the C versions -The bn8086.c file contains the single function bnInit(), which -determines the word size of the processor when called and calls -bnInit_16() or bnInit_32(), as appropriate. - -To summarize: - -To build a (not necessarily optimal) version on any machine, do the following, -or get your favourite make(1)-like utility to do it: - -- Compile bn.c, bn00.c, lbn00.c, lbnmem.c and legal.c, with as much - optimization as possible. -- Link all of the .o files together - -To build an MS-DOS version that will run well on an 8088 and up, -compile with -DBNINCLUDE=lbn8086.h: - -- Compile bn.c, bn16.c, bn32.c, lbn16.c, lbn32.c, lbnmem.c, legal.c and - bn8086.c, with -DBNINCLUDE=lbn8086.h -- Assemble lbn8086.asm -- Link all of the .obj files together - -To build an 80x86 WIN16 version (16-bit segmented addressing, 32-bit processor): - -- Compile bn.c, bn00.c (or bn32.c and bninit32.c), lbn00.c (or lbn32.c), - lbnmem.c and legal.c, with -DBNINCLUDE=lbn8086.h -- Assemble lbn8086.asm -- Link all of the .obj files together - -To build an 80x86 WIN32 version (32-bit flat model), - -- Compile bn.c, bn00.c (or bn32.c and bninit32.c), lbn00.c (or lbn32.c), - lbnmem.c and legal.c, with -DBNINCLUDE=lbn80386.h -- Assemble lbn80386.asm -- Link all of the .obj files together - -To build a Mac 68K version that will work well on a 68000 and up, - -- Compile bn.c, bn16.c, bn32.c, lbn16.c, lbn32.c, lbnmem.c, legal.c and - bn8086.c, with -DBNINCLUDE=lbn68000.h (On Metrowerks, you may have to - build your own precompiled header to achieve this effect.) -- Assemble lbn68000.c and lbn68020.c -- Link all of the .o files together - -To build a Mac 68K version which will only work on a 68020 or better, - -- Compile bn.c, bn00.c (or bn32.c and bninit32.c), lbn00.c (or lbn32.c), - lbnmem.c and legal.c, with -DBNINCLUDE=lbn68020.h (On Metrowerks, you - may have to build your own precompiled header to achieve this effect.) -- Assemble lbn68020.c -- Link all of the .o files together - -To build a Mac PowerPC version, - -- Compile bn.c, bn00.c (or bn32.c and bninit32.c), lbn00.c (or lbn32.c), - lbnmem.c and legal.c, with -DBNINCLUDE=lbnppc.h (On Metrowerks, you - may have to build your own precompiled header to achieve this effect.) -- Assemble lbnppc.c -- Link all of the .o files together - -To build a Unix 80x86 version (32-bit flat model, AT&T assembler mnemonics), - -- Compile bn.c, bn00.c (or bn32.c and bninit32.c), lbn00.c (or lbn32.c), - lbnmem.c and legal.c, with -DBNINCLUDE=lbn80386.h -- Assemble lbn80386.s -- Link all of the .o files together - -To build a DEC Alpha version (64-bit math; this *screams*), - -- Compile bn.c, bn00.c (or bn64.c and bninit64.c), lbn00.c (or lbn64.c), - lbnmem.c and legal.c, with -DBNINCLUDE=lbnalpha.h -- Assemble lbnalpha.s -- Link all of the .o files together diff --git a/libs/libzrtp/third_party/bnlib/README.bntest b/libs/libzrtp/third_party/bnlib/README.bntest deleted file mode 100644 index 09a3f91cab..0000000000 --- a/libs/libzrtp/third_party/bnlib/README.bntest +++ /dev/null @@ -1,28 +0,0 @@ -Test driver for low-level BigNum library correctness. - -In addition to the generic "bntest" program, which picks a size -at compile time, there are specific test drivers, bntest16, -bntest32 and bntest64 that you can compile specifically, e.g. -to test multiple word sizes. - -bntest is different from other programs in that it invokes the -low-level BigNum functions directly. It need only be linked with -lbnmem.o, lbn32.o and legal.o. This is not normally desirable, but -it lets this test driver isolate errors better in the bottom-level -primitives. - -It's served very well in tracking down errors. If you write some new -assembly primitives and it doesn't find a problem with them, you -can have a good deal of confidence that they're correct. - -This program also does timing tests on basic modular exponentiation. -It is invoked as bntest [modsize [expsize [expsize2]]]. -If modsize is not specified, it only runs consistency checks. -If expsize is not specified, it defaults to modsize. -If expsize2 is not specified, it defaults to expsize. -Invalid arguments produce a usage message. - -Example invocation lines: -bntest -bntest 512 -bntest 1024 160 diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/README-small-memory b/libs/libzrtp/third_party/bnlib/bignum-ARM/README-small-memory deleted file mode 100644 index 88c994dcd0..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/README-small-memory +++ /dev/null @@ -1,6 +0,0 @@ -This directory contains a stripped-down version of Colin Plumb's bnlib bignum package for ARM processors in minimal memory environments, such as embedded Wireless USB controllers. All unnecessary functions have been removed, and code has been reorganized for shrinking the memory footprint. These functions duplicate the functionality of similar functions in the main bnlib package, but with smaller memory footprints. Wireless USB only requires Diffie-Hellman, and little else. - -For more information, see the documentation in the main bnlib package, which is not in this directory. Or contact: - -Philip Zimmermann <prz@mit.edu> -October 2007 diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/bntest16.c b/libs/libzrtp/third_party/bnlib/bignum-ARM/bntest16.c deleted file mode 100644 index c220d6e683..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/bntest16.c +++ /dev/null @@ -1,797 +0,0 @@ -/* - * Test driver for low-level bignum library (16-bit version). - * This access the low-level library directly. It is NOT an example of - * how to program with the library normally! By accessing the library - * at a low level, it is possible to exercise the smallest components - * and thus localize bugs more accurately. This is especially useful - * when writing assembly-language primitives. - * - * This also does timing tests on modular exponentiation. Modular - * exponentiation is so computationally expensive that the fact that this - * code omits one level of interface glue has no perceptible effect on - * the results. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STDLIB_H -#define NO_STDLIB_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#include <stdio.h> - -#if !NO_STDLIB_H -#include <stdlib.h> /* For strtol */ -#else -long strtol(const char *, char **, int); -#endif - -#if !NO_STRING_H -#include <string.h> /* For memcpy */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "cputime.h" -#include "lbn16.h" - -#include "kludge.h" - -#if BNYIELD -int (*bnYield)(void) = 0; -#endif - -/* Work with up to 2048-bit numbers */ -#define MAXBITS 3072 -#define SIZE (MAXBITS/16 + 1) - -/* Additive congruential random number generator, x[i] = x[i-24] + x[i-55] */ -static BNWORD16 randp[55]; -static BNWORD16 *randp1 = randp, *randp2 = randp+24; - -static BNWORD16 -rand16(void) -{ - if (++randp2 == randp+55) { - randp2 = randp; - randp1++; - } else if (++randp1 == randp+55) { - randp1 = randp; - } - - return *randp1 += *randp2; -} - -/* - * CRC-3_2: x^3_2+x^26+x^23+x^22+x^1_6+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 - * - * The additive congruential RNG is seeded with a single integer, - * which is shuffled with a CRC polynomial to generate the initial - * table values. The Polynomial is the same size as the words being - * used. - * - * Thus, in the various versions of this library, we actually use this - * polynomial as-is, this polynomial mod x^17, and this polynomial with - * the leading coefficient deleted and replaced with x^6_4. As-is, - * it's irreducible, so it has a long period. Modulo x^17, it factors as - * (x^4+x^3+x^2+x+1) * (x^12+x^11+x^8+x^7+x^6+x^5+x^4+x^3+1), - * which still has a large enough period (4095) for the use it's put to. - * With the leading coefficient moved up, it factors as - * (x^50+x^49+x^48+x^47+x^46+x^43+x^41+x^40+x^38+x^37+x^36+x^35+x^34+x^33+ - * x^31+x^30+x^29+x^28+x^27+x^25+x^23+x^18+x^1_6+x^15+x^14+x^13+x^11+x^9+ - * x^8+x^7+x^6+x^5+x^3+x^2+1)*(x^11+x^10+x^9+x^5+x^4+x^3+1)*(x^3+x+1), - * which definitely has a long enough period to serve for initialization. - * - * The effort put into this PRNG is kind of unwarranted given the trivial - * use it's being put to, but oh, well. It does have the nice advantage - * of producing numbers that are portable between platforms, so if there's - * a problem with one platform, you can compare all the intermediate - * results with another platform. - */ -#define POLY (BNWORD16)0x04c11db7 - -static void -srand16(BNWORD16 seed) -{ - int i, j; - - for (i = 0; i < 55; i++) { - for (j = 0; j < 16; j++) - if (seed >> (16-1)) - seed = (seed << 1) ^ POLY; - else - seed <<= 1; - randp[i] = seed; - } - for (i = 0; i < 3*55; i ++) - rand16(); -} - -static void -randnum(BNWORD16 *num, unsigned len) -{ - while (len--) - BIGLITTLE(*--num,*num++) = rand16(); -} - -static void -bnprint16(BNWORD16 const *num, unsigned len) -{ - BIGLITTLE(num -= len, num += len); - - while (len--) - printf("%0*lX", 16/4, (unsigned long)BIGLITTLE(*num++,*--num)); -} - -static void -bnput16(char const *prompt, BNWORD16 const *num, unsigned len) -{ - fputs(prompt, stdout); - bnprint16(num, len); - putchar('\n'); -} - -/* - * One of our tests uses a known prime. The following selections were - * taken from the tables at the end of Hans Reisel's "Prime Numbers and - * Computer Methods for Factorization", second edition - an excellent book. - * (ISBN 0-8176-3743-5 ISBN 3-7323-3743-5) - */ -#if 0 -/* P31=1839605 17620282 38179967 87333633 from the factors of 3^256+2^256 */ -static unsigned char const prime[] = { - 0x17,0x38,0x15,0xBC,0x8B,0xBB,0xE9,0xEF,0x01,0xA9,0xFD,0x3A,0x01 -}; -#elif 0 -/* P48=40554942 04557502 46193993 36199835 4279613_2 73199617 from the same */ -static unsigned char const prime[] = { - 0x47,0x09,0x77,0x07,0xCF,0xFD,0xE1,0x54,0x3E,0x24, - 0xF7,0xF1,0x7A,0x3E,0x91,0x51,0xCC,0xC7,0xD4,0x01 -}; -#elif 0 -/* - * P75 = 450 55287320 97906895 47687014 5808213_2 - * 05219565 99525911 39967932 66003_258 91979521 - * from the factors of 4^128+3+128 - * (The "026" and "062" are to prevent a Bad String from appearing here.) - */ -static unsigned char const prime[] = { - 0xFF,0x00,0xFF,0x00,0xFF,0x01,0x06,0x4F,0xF8,0xED, - 0xA3,0x37,0x23,0x2A,0x04,0xEA,0xF9,0x5F,0x30,0x4C, - 0xAE,0xCD, 026,0x4E, 062,0x10,0x04,0x7D,0x0D,0x79, - 0x01 -}; -#else -/* - * P75 = 632 85659796 45277755 9123_2190 67300940 - * 51844953 78793489 59444670 35675855 57440257 - * from the factors of 5^128+4^128 - * (The "026" is to prevent a Bad String from appearing here.) - */ -static unsigned char const prime[] = { - 0x01,0x78,0x4B,0xA5,0xD3,0x30,0x03,0xEB,0x73,0xE6, - 0x0F,0x4E,0x31,0x7D,0xBC,0xE2,0xA0,0xD4, 026,0x3F, - 0x3C,0xEA,0x1B,0x44,0xAD,0x39,0xE7,0xE5,0xAD,0x19, - 0x67,0x01 -}; -#endif - -static int -usage(char const *name) -{ - fprintf(stderr, "Usage: %s [modbits [expbits [expbits2]]\n" -"With no arguments, just runs test suite. If modbits is given, runs\n" -"quick validation test, then runs timing tests of modular exponentiation.\n" -"If expbits is given, it is used as an exponent size, otherwise it defaults\n" -"to the same as modbits. If expbits2 is given it is used as the second\n" -"exponent size in the double-exponentiation tests, otherwise it defaults\n" -"to the same as expbits. All are limited to %u bits.\n", - name, (unsigned)MAXBITS); - return 1; -} - -/* for libzrtp support */ -int -bntest_main(int argc, char **argv) -{ - unsigned i, j, k, l, m; - int z; - BNWORD16 t, carry, borrow; - BNWORD16 a[SIZE], b[SIZE], c[SIZE], d[SIZE]; - BNWORD16 e[SIZE], f[SIZE]; - static BNWORD16 entries[sizeof(prime)*2][(sizeof(prime)-1)/(16/8)+1]; - BNWORD16 *array[sizeof(prime)*2]; - unsigned long modbits = 0, expbits = 0, expbits2 = 0; - char *p; -#define A BIGLITTLE((a+SIZE),a) -#define B BIGLITTLE((b+SIZE),b) -#define C BIGLITTLE((c+SIZE),c) -#define D BIGLITTLE((d+SIZE),d) -#define E BIGLITTLE((e+SIZE),e) -#define F BIGLITTLE((f+SIZE),f) - static unsigned const smallprimes[] = { - 2, 3, 5, 7, 11, 13, 17, 19, 23, 27, 29, 31, 37, 41, 43 - }; - - /* Set up array for precomputed modexp */ - for (i = 0; i < sizeof(array)/sizeof(*array); i++) - array[i] = entries[i] BIG(+ SIZE); - - srand16(1); - - puts(BIGLITTLE("Big-endian machine","Little-endian machine")); - - if (argc >= 2) { - modbits = strtoul(argv[1], &p, 0); - if (!modbits || *p) { - fprintf(stderr, "Invalid modbits: %s\n", argv[1]); - return usage(argv[0]); - } - } - if (argc >= 3) { - expbits = strtoul(argv[2], &p, 0); - if (!expbits || *p) { - fprintf(stderr, "Invalid expbits: %s\n", argv[2]); - return usage(argv[0]); - } - expbits2 = expbits; - } - if (argc >= 4) { - expbits2 = strtoul(argv[3], &p, 0); - if (!expbits2 || *p) { - fprintf(stderr, "Invalid expbits2: %s\n", argv[3]); - return usage(argv[0]); - } - } - if (argc >= 5) { - fprintf(stderr, "Too many arguments: %s\n", argv[4]); - return usage(argv[0]); - } - - /* B is a nice not-so-little prime */ - lbnInsertBigBytes_16(B, prime, 0, sizeof(prime)); - ((unsigned char *)c)[0] = 0; - lbnInsertBigBytes_16(B, (unsigned char *)c, sizeof(prime), 1); - lbnExtractBigBytes_16(B, (unsigned char *)c, 0, sizeof(prime)+1); - i = (sizeof(prime)-1)/(16/8)+1; /* Size of array in words */ - if (((unsigned char *)c)[0] || - memcmp(prime, (unsigned char *)c+1, sizeof(prime)) != 0) - { - printf("Input != output!:\n "); - for (k = 0; k < sizeof(prime); k++) - printf("%02X ", prime[k]); - putchar('\n'); - for (k = 0; k < sizeof(prime)+1; k++) - printf("%02X ", ((unsigned char *)c)[k]); - putchar('\n'); - bnput16("p = ", B, i); - - } - - /* Timing test code - only if requested on the command line */ - if (modbits) { - timetype start, stop; - unsigned long cursec, expsec, twoexpsec, dblexpsec; - unsigned curms, expms, twoexpms, dblexpms; - - expsec = twoexpsec = dblexpsec = 0; - expms = twoexpms = dblexpms = 0; - - lbnCopy_16(C,B,i); - lbnSub1_16(C,i,1); /* C is exponent: p-1 */ - - puts("Testing modexp with a known prime. " - "All results should be 1."); - bnput16("p = ", B, i); - bnput16("p-1 = ", C, i); - z = lbnTwoExpMod_16(A, C, i, B, i); - if (z < 0) - goto nomem; - bnput16("2^(p-1) mod p = ", A, i); - for (j = 0; j < 10; j++) { - randnum(A,i); - (void)lbnDiv_16(D,A,i,B,i); - - bnput16("a = ", A, i); - z = lbnExpMod_16(D, A, i, C, i, B, i); - if (z < 0) - goto nomem; - bnput16("a^(p-1) mod p = ", D, i); -#if 0 - z = lbnBasePrecompBegin_16(array, (sizeof(prime)*8+4)/5, 5, - A, i, B, i); - if (z < 0) - goto nomem; - BIGLITTLE(D[-1],D[0]) = -1; - z = lbnBasePrecompExp_16(D, (BNWORD16 const * const *)array, - 5, C, i, B, i); - if (z < 0) - goto nomem; - bnput16("a^(p-1) mod p = ", D, i); -#endif - for (k = 0; k < 5; k++) { - randnum(E,i); - bnput16("e = ", E, i); - z = lbnExpMod_16(D, A, i, E, i, B, i); - if (z < 0) - goto nomem; - bnput16("a^e mod p = ", D, i); -#if 0 - z = lbnBasePrecompExp_16(D, (BNWORD16 const * const *)array, - 5, E, i, B, i); - if (z < 0) - goto nomem; - bnput16("a^e mod p = ", D, i); -#endif - } - } - - printf("\n" - "Timing exponentiations modulo a %d-bit modulus, i.e.\n" - "2^<%d> mod <%d> bits, <%d>^<%d> mod <%d> bits and\n" - "<%d>^<%d> * <%d>^<%d> mod <%d> bits\n", - (int)modbits, (int)expbits, (int)modbits, - (int)modbits, (int)expbits, (int)modbits, - (int)modbits, (int)expbits, (int)modbits, (int)expbits2, - (int)modbits); - - i = ((int)modbits-1)/16+1; - k = ((int)expbits-1)/16+1; - l = ((int)expbits2-1)/16+1; - for (j = 0; j < 25; j++) { - randnum(A,i); /* Base */ - randnum(B,k); /* Exponent */ - randnum(C,i); /* Modulus */ - randnum(D,i); /* Base2 */ - randnum(E,l); /* Exponent */ - /* Clip bases and mod to appropriate number of bits */ - t = ((BNWORD16)2<<((modbits-1)%16)) - 1; - *(BIGLITTLE(A-i,A+i-1)) &= t; - *(BIGLITTLE(C-i,C+i-1)) &= t; - *(BIGLITTLE(D-i,D+i-1)) &= t; - /* Make modulus large (msbit set) and odd (lsbit set) */ - *(BIGLITTLE(C-i,C+i-1)) |= (t >> 1) + 1; - BIGLITTLE(C[-1],C[0]) |= 1; - - /* Clip exponent to appropriate number of bits */ - t = ((BNWORD16)2<<((expbits-1)%16)) - 1; - *(BIGLITTLE(B-k,B+k-1)) &= t; - /* Make exponent large (msbit set) */ - *(BIGLITTLE(B-k,B+k-1)) |= (t >> 1) + 1; - /* The same for exponent 2 */ - t = ((BNWORD16)2<<((expbits2-1)%16)) - 1; - *(BIGLITTLE(E-l,E+l-1)) &= t; - *(BIGLITTLE(E-l,E+l-1)) |= (t >> 1) + 1; - - m = lbnBits_16(A, i); - if (m > (unsigned)modbits) { - bnput16("a = ", a, i); - printf("%u bits, should be <= %d\n", - m, (int)modbits); - } - m = lbnBits_16(B, k); - if (m != (unsigned)expbits) { - bnput16("b = ", b, i); - printf("%u bits, should be %d\n", - m, (int)expbits); - } - m = lbnBits_16(C, i); - if (m != (unsigned)modbits) { - bnput16("c = ", c, k); - printf("%u bits, should be %d\n", - m, (int)modbits); - } - m = lbnBits_16(D, i); - if (m > (unsigned)modbits) { - bnput16("d = ", d, i); - printf("%u bits, should be <= %d\n", - m, (int)modbits); - } - m = lbnBits_16(E, l); - if (m != (unsigned)expbits2) { - bnput16("e = ", e, i); - printf("%u bits, should be %d\n", - m, (int)expbits2); - } - gettime(&start); - z = lbnTwoExpMod_16(A, B, k, C, i); - if (z < 0) - goto nomem; - gettime(&stop); - subtime(stop, start); - twoexpsec += cursec = sec(stop); - twoexpms += curms = msec(stop); - - printf("2^<%d>:%4lu.%03u ", (int)expbits, cursec, curms); - fflush(stdout); - - gettime(&start); - z = lbnExpMod_16(A, A, i, B, k, C, i); - if (z < 0) - goto nomem; - gettime(&stop); - subtime(stop, start); - expsec += cursec = sec(stop); - expms += curms = msec(stop); - printf("<%d>^<%d>:%4lu.%03u ",(int)modbits, (int)expbits, - cursec, curms); - fflush(stdout); - -#if 0 - gettime(&start); - z = lbnDoubleExpMod_16(D, A, i, B, k, D, i, E, l,C,i); - if (z < 0) - goto nomem; - gettime(&stop); - subtime(stop, start); - dblexpsec += cursec = sec(stop); - dblexpms += curms = msec(stop); - printf("<%d>^<%d>*<%d>^<%d>:%4lu.%03u\n", - (int)modbits, (int)expbits, - (int)modbits, (int)expbits2, - cursec, curms); -#else - putchar('\n'); -#endif - } - twoexpms += (twoexpsec % j) * 1000; - printf("2^<%d> mod <%d> bits AVERAGE: %4lu.%03u s\n", - (int)expbits, (int)modbits, twoexpsec/j, twoexpms/j); - expms += (expsec % j) * 1000; - printf("<%d>^<%d> mod <%d> bits AVERAGE: %4lu.%03u s\n", - (int)modbits, (int)expbits, (int)modbits, expsec/j, expms/j); -#if 0 - dblexpms += (dblexpsec % j) * 1000; - printf("<%d>^<%d> * <%d>^<%d> mod <%d> bits AVERAGE:" - " %4lu.%03u s\n", - (int)modbits, (int)expbits, (int)modbits, - (int)expbits2, - (int)modbits, dblexpsec/j, dblexpms/j); -#endif - putchar('\n'); - } - - printf("Beginning 1000 interations of sanity checking.\n"); - printf("Any output indicates a bug. No output is very strong\n"); - printf("evidence that all the important low-level bignum routines\n"); - printf("are working properly.\n"); - - /* - * If you change this loop to have an iteration 0, all results - * are primted on that iteration. Useful to see what's going - * on in case of major wierdness, but it produces a *lot* of - * output. - */ - for (j = 1; j <= 1000; j++) { - /* Do the tests for lots of different number sizes. */ - for (i = 1; i <= SIZE/2; i++) { - /* Make a random number i words long */ - do { - randnum(A,i); - } while (lbnNorm_16(A,i) < i); - - /* Checl lbnCmp - does a == a? */ - if (lbnCmp_16(A,A,i) || !j) { - bnput16("a = ", A, i); - printf("(a <=> a) = %d\n", lbnCmp_16(A,A,i)); - } - - memcpy(c, a, sizeof(a)); - - /* Check that the difference, after copy, is good. */ - if (lbnCmp_16(A,C,i) || !j) { - bnput16("a = ", A, i); - bnput16("c = ", C, i); - printf("(a <=> c) = %d\n", lbnCmp_16(A,C,i)); - } - - /* Generate a non-zero random t */ - do { - t = rand16(); - } while (!t); - - /* - * Add t to A. Check that: - * - lbnCmp works in both directions, and - * - A + t is greater than A. If there was a carry, - * the result, less the carry, should be *less* - * than A. - */ - carry = lbnAdd1_16(A,i,t); - if (lbnCmp_16(A,C,i) + lbnCmp_16(C,A,i) != 0 || - lbnCmp_16(A,C,i) != (carry ? -1 : 1) || !j) - { - bnput16("c = ", C, i); - printf("t = %lX\n", (unsigned long)t); - bnput16("a = c+t = ", A, i); - printf("carry = %lX\n", (unsigned long)carry); - printf("(a <=> c) = %d\n", lbnCmp_16(A,C,i)); - printf("(c <=> a) = %d\n", lbnCmp_16(C,A,i)); - } - - /* Subtract t again */ - memcpy(d, a, sizeof(a)); - borrow = lbnSub1_16(A,i,t); - - if (carry != borrow || lbnCmp_16(A,C,i) || !j) { - bnput16("a = ", C, i); - printf("t = %lX\n", (unsigned long)t); - lbnAdd1_16(A,i,t); - bnput16("a += t = ", A, i); - printf("Carry = %lX\n", (unsigned long)carry); - lbnSub1_16(A,i,t); - bnput16("a -= t = ", A, i); - printf("Borrow = %lX\n", (unsigned long)borrow); - printf("(a <=> c) = %d\n", lbnCmp_16(A,C,i)); - } - - /* Generate a random B */ - do { - randnum(B,i); - } while (lbnNorm_16(B,i) < i); - - carry = lbnAddN_16(A,B,i); - memcpy(d, a, sizeof(a)); - borrow = lbnSubN_16(A,B,i); - - if (carry != borrow || lbnCmp_16(A,C,i) || !j) { - bnput16("a = ", C, i); - bnput16("b = ", B, i); - bnput16("a += b = ", D, i); - printf("Carry = %lX\n", (unsigned long)carry); - bnput16("a -= b = ", A, i); - printf("Borrow = %lX\n", (unsigned long)borrow); - printf("(a <=> c) = %d\n", lbnCmp_16(A,C,i)); - } - - /* D = B * t */ - lbnMulN1_16(D, B, i, t); - memcpy(e, d, sizeof(e)); - /* D = A + B * t, "carry" is overflow */ - borrow = *(BIGLITTLE(D-i-1,D+i)) += lbnAddN_16(D,A,i); - - carry = lbnMulAdd1_16(A, B, i, t); - - /* Did MulAdd get the same answer as mul then add? */ - if (carry != borrow || lbnCmp_16(A, D, i) || !j) { - bnput16("a = ", C, i); - bnput16("b = ", B, i); - printf("t = %lX\n", (unsigned long)t); - bnput16("e = b * t = ", E, i+1); - bnput16(" a + e = ", D, i+1); - bnput16("a + b * t = ", A, i); - printf("carry = %lX\n", (unsigned long)carry); - } - - memcpy(d, a, sizeof(a)); - borrow = lbnMulSub1_16(A, B, i, t); - - /* Did MulSub perform the inverse of MulAdd */ - if (carry != borrow || lbnCmp_16(A,C,i) || !j) { - bnput16(" a = ", C, i); - bnput16(" b = ", B, i); - bnput16("a += b*t = ", D, i); - printf("Carry = %lX\n", (unsigned long)carry); - bnput16("a -= b*t = ", A, i); - printf("Borrow = %lX\n", (unsigned long)borrow); - printf("(a <=> c) = %d\n", lbnCmp_16(A,C,i)); - bnput16("b*t = ", E, i+1); - } - /* At this point we're done with t, so it's scratch */ -#if 0 -/* Extra debug code */ - lbnMulN1_16(C, A, i, BIGLITTLE(B[-1],B[0])); - bnput16("a * b[0] = ", C, i+1); - for (k = 1; k < i; k++) { - carry = lbnMulAdd1_16(BIGLITTLE(C-k,C+k), A, i, - *(BIGLITTLE(B-1-k,B+k))); - *(BIGLITTLE(C-i-k,C+i+k)) = carry; - bnput16("a * b[x] = ", C, i+k+1); - } - - lbnMulN1_16(D, B, i, BIGLITTLE(A[-1],A[0])); - bnput16("b * a[0] = ", D, i+1); - for (k = 1; k < i; k++) { - carry = lbnMulAdd1_16(BIGLITTLE(D-k,D+k), B, i, - *(BIGLITTLE(A-1-k,A+k))); - *(BIGLITTLE(D-i-k,D+i+k)) = carry; - bnput16("b * a[x] = ", D, i+k+1); - } -#endif - /* Does Mul work both ways symmetrically */ - lbnMul_16(C,A,i,B,i); - lbnMul_16(D,B,i,A,i); - if (lbnCmp_16(C,D,i+i) || !j) { - bnput16("a = ", A, i); - bnput16("b = ", B, i); - bnput16("a * b = ", C, i+i); - bnput16("b * a = ", D, i+i); - printf("(a*b <=> b*a) = %d\n", - lbnCmp_16(C,D,i+i)); - } - /* Check multiplication modulo some small things */ - /* 30030 = 2*3*5*11*13 */ - k = lbnModQ_16(C, i+i, 30030); - for (l = 0; - l < sizeof(smallprimes)/sizeof(*smallprimes); - l++) - { - m = smallprimes[l]; - t = lbnModQ_16(C, i+i, m); - carry = lbnModQ_16(A, i, m); - borrow = lbnModQ_16(B, i, m); - if (t != (carry * borrow) % m) { - bnput16("a = ", A, i); - printf("a mod %u = %u\n", m, - (unsigned)carry); - bnput16("b = ", B, i); - printf("b mod %u = %u\n", m, - (unsigned)borrow); - bnput16("a*b = ", C, i+i); - printf("a*b mod %u = %u\n", m, - (unsigned)t); - printf("expected %u\n", - (unsigned)((carry*borrow)%m)); - } - /* Verify that (C % 30030) % m == C % m */ - if (m <= 13 && t != k % m) { - printf("c mod 30030 = %u mod %u= %u\n", - k, m, k%m); - printf("c mod %u = %u\n", - m, (unsigned)t); - } - } - - /* Generate an F less than A and B */ - do { - randnum(F,i); - } while (lbnCmp_16(F,A,i) >= 0 || - lbnCmp_16(F,B,i) >= 0); - - /* Add F to D (remember, D = A*B) */ - lbnAdd1_16(BIGLITTLE(D-i,D+i), i, lbnAddN_16(D, F, i)); - memcpy(c, d, sizeof(d)); - - /* - * Divide by A and check that quotient and remainder - * match (remainder should be F, quotient should be B) - */ - t = lbnDiv_16(E,C,i+i,A,i); - if (t || lbnCmp_16(E,B,i) || lbnCmp_16(C, F, i) || !j) { - bnput16("a = ", A, i); - bnput16("b = ", B, i); - bnput16("f = ", F, i); - bnput16("a * b + f = ", D, i+i); - printf("qhigh = %lX\n", (unsigned long)t); - bnput16("(a*b+f) / a = ", E, i); - bnput16("(a*b+f) % a = ", C, i); - } - - memcpy(c, d, sizeof(d)); - - /* Divide by B and check similarly */ - t = lbnDiv_16(E,C,i+i,B,i); - if (lbnCmp_16(E,A,i) || lbnCmp_16(C, F, i) || !j) { - bnput16("a = ", A, i); - bnput16("b = ", B, i); - bnput16("f = ", F, i); - bnput16("a * b + f = ", D, i+i); - printf("qhigh = %lX\n", (unsigned long)t); - bnput16("(a*b+f) / b = ", E, i); - bnput16("(a*b+f) % b = ", C, i); - } - - /* Check that A*A == A^2 */ - lbnMul_16(C,A,i,A,i); - lbnSquare_16(D,A,i); - if (lbnCmp_16(C,D,i+i) || !j) { - bnput16("a*a = ", C, i+i); - bnput16("a^2 = ", D, i+i); - printf("(a * a == a^2) = %d\n", - lbnCmp_16(C,D,i+i)); - } -#if 0 - /* Compute a GCD */ - lbnCopy_16(C,A,i); - lbnCopy_16(D,B,i); - z = lbnGcd_16(C, i, D, i, &k); - if (z < 0) - goto nomem; - /* z = 1 if GCD in D; z = 0 if GCD in C */ - - /* Approximate check that the GCD came out right */ - for (l = 0; - l < sizeof(smallprimes)/sizeof(*smallprimes); - l++) - { - m = smallprimes[l]; - t = lbnModQ_16(z ? D : C, k, m); - carry = lbnModQ_16(A, i, m); - borrow = lbnModQ_16(B, i, m); - if (!t != (!carry && !borrow)) { - bnput16("a = ", A, i); - printf("a mod %u = %u\n", m, - (unsigned)carry); - bnput16("b = ", B, i); - printf("b mod %u = %u\n", m, - (unsigned)borrow); - bnput16("gcd(a,b) = ", z ? D : C, k); - printf("gcd(a,b) mod %u = %u\n", m, - (unsigned)t); - } - } -#endif - - /* - * Do some Montgomery operations - * Start with A > B, and also place a copy of B into C. - * Then make A odd so it can be a Montgomery modulus. - */ - if (lbnCmp_16(A, B, i) < 0) { - memcpy(c, a, sizeof(c)); - memcpy(a, b, sizeof(a)); - memcpy(b, c, sizeof(b)); - } else { - memcpy(c, b, sizeof(c)); - } - BIGLITTLE(A[-1],A[0]) |= 1; - - /* Convert to and from */ - lbnToMont_16(B, i, A, i); - lbnFromMont_16(B, A, i); - if (lbnCmp_16(B, C, i)) { - memcpy(b, c, sizeof(c)); - bnput16("mod = ", A, i); - bnput16("input = ", B, i); - lbnToMont_16(B, i, A, i); - bnput16("mont = ", B, i); - lbnFromMont_16(B, A, i); - bnput16("output = ", B, i); - } - /* E = B^5 (mod A), no Montgomery ops */ - lbnSquare_16(E, B, i); - (void)lbnDiv_16(BIGLITTLE(E-i,E+i),E,i+i,A,i); - lbnSquare_16(D, E, i); - (void)lbnDiv_16(BIGLITTLE(D-i,D+i),D,i+i,A,i); - lbnMul_16(E, D, i, B, i); - (void)lbnDiv_16(BIGLITTLE(E-i,E+i),E,i+i,A,i); - - /* D = B^5, using ExpMod */ - BIGLITTLE(F[-1],F[0]) = 5; - z = lbnExpMod_16(D, B, i, F, 1, A, i); - if (z < 0) - goto nomem; - if (lbnCmp_16(D, E, i) || !j) { - bnput16("mod = ", A, i); - bnput16("input = ", B, i); - bnput16("input^5 = ", E, i); - bnput16("input^5 = ", D, i); - printf("a>b (x <=> y) = %d\n", - lbnCmp_16(D,E,i)); - } - /* TODO: Test lbnTwoExpMod, lbnDoubleExpMod */ - } /* for (i) */ - printf("\r%d ", j); - fflush(stdout); - } /* for (j) */ - printf("%d iterations of up to %d 16-bit words completed.\n", - j-1, i-1); - return 0; - nomem: - printf("Out of memory\n"); - return 1; -} diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/config.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/config.h deleted file mode 100644 index 27e128c8d9..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/config.h +++ /dev/null @@ -1,59 +0,0 @@ -/* bnconfig.h. Generated automatically by configure. */ -/* - * bnconfig.h -- Configuration file for BigNum library. - * - * This file is automatically filled in by configure. - * Everything must start out turned *off*, because configure - * (or, more properly, config.status) only knows how to turn them - * *on*. - */ -#ifndef CONFIG_H -#define CONFIG_H - -/* Define to empty if the compiler does not support 'const' variables. */ -/* #undef const */ - -/* Define to `unsigned' if <sys/types.h> doesn't define it. */ -/* #undef size_t */ - -/* Checks for the presence and absence of various header files */ -#define HAVE_ASSERT_H 1 -#define NO_ASSERT_H !HAVE_ASSERT_H -#define HAVE_LIMITS_H 1 -#define NO_LIMITS_H !HAVE_LIMITS_H -#define HAVE_STDLIB_H 1 -#define NO_STDLIB_H !HAVE_STDLIB_H -#define HAVE_STRING_H 1 -#define NO_STRING_H !HAVE_STRING_H - -#define HAVE_STRINGS_H 0 - -/* We go to some trouble to find accurate times... */ - -/* Define if you have Posix.4 glock_gettime() */ -#define HAVE_CLOCK_GETTIME 0 -/* Define if you have Solaris-style gethrvtime() */ -#define HAVE_GETHRVTIME 0 -/* Define if you have getrusage() */ -#define HAVE_GETRUSAGE 1 -/* Define if you have clock() */ -#define HAVE_CLOCK 1 -/* Define if you have time() */ -#define HAVE_TIME 1 - -/* - * Define as 0 if #including <sys/time.h> automatically - * #includes <time.h>, and doing so explicitly causes an - * error. - */ -#define TIME_WITH_SYS_TIME 1 - -/* Defines for various kinds of library brokenness */ - -/* If not available, bcopy() is substituted */ -#define HAVE_MEMMOVE 1 -#define NO_MEMMOVE !HAVE_MEMMOVE -#define HAVE_MEMCPY 1 -#define NO_MEMCPY !HAVE_MEMCPY - -#endif /* CONFIG_H */ diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/cputime.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/cputime.h deleted file mode 100644 index 53b273b141..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/cputime.h +++ /dev/null @@ -1,250 +0,0 @@ -#ifndef CPUTIME_H -#define CPUTIME_H - -/* - * Figure out what clock to use. Each possibility can be specifically - * enabled or disabled by predefining USE_XXX to 1 or 0. For some, - * the code attempts to detect availability automatically. If the - * Symbols HAVE_XXX are defined, they are used. If not, they are - * set to reasonable default assumptions while further conditions - * are checked. The choices, and the ways they are auto-detected are: - * - gethrvtime(), if HAVE_GETHRVTIME is set to 1. - * - clock_gettime(CLOCK_VIRTUAL,...), if CLOCK_VIRTUAL is defined in <time.h> - * - getrusage(RUSAGE_SELF,...), if RUSAGE_SELF is defined in <sys/resource.h> - * - clock(), if CLOCKS_PER_SEC or CLK_TCK are defined in <time.h> - * - time(), unless specifically disabled. - * - * The symbol CLOCK_AVAIL is given a value of 1 if a clock is found. - * The following are then available: - * timetype (typedef): the type needed to hold a clock value. - * gettime(t) (macro): A function that gets passed a timetype *. - * subtime(d,s) (macro): Sets d -= s, essentially. - * msec(t) (macro): Given a timetype, return the number of milliseconds - * in it, as an unsigned integer between 0 and 999. - * sec(t) (macro): Given a timetype, return the number of seconds in it, - * as an unsigned long integer. - */ - -/* We expect that our caller has already #included "bnconfig.h" if possible. */ - -#ifndef unix -#define unix 0 -#endif -#ifndef __unix -#define __unix 0 -#endif -#ifndef __unix__ -#define __unix__ 0 -#endif - -#ifdef UNIX -/* Nothing */ -#elif unix -#define UNIX 1 -#elif __unix -#define UNIX 1 -#elif __unix__ -#define UNIX 1 -#endif - -#ifndef UNIX -#define UNIX 0 -#endif - -#ifndef TIME_WITH_SYS_TIME -#define TIME_WITH_SYS_TIME 1 /* Assume true if not told */ -#endif -#ifndef HAVE_SYS_TIME_H -#define HAVE_SYS_TIME_H 0 /* Assume true if not told */ -#endif - -/* - * Include <time.h> unless that would prevent us from later including - * <sys/time.h>, in which case include *that* immediately. - */ -#if TIME_WITH_SYS_TIME -#include <time.h> -#elif HAVE_SYS_TIME_H -#include <sys/time.h> -#else -#include <time.h> -#endif - -#ifndef USE_GETHRVTIME -#ifdef HAVE_GETHRVTIME -#define USE_GETHRVTIME HAVE_GETHRVTIME -#else -#define USE_GETHRVTIME 0 -#endif -#endif - -#if USE_GETHRVTIME -#define CLOCK_AVAIL 1 -typedef hrtime_t timetype; -#define gettime(t) *(t) = gethrvtime() -#define subtime(d,s) d -= s -#define msec(t) (unsigned)((t/1000000)%1000) -#define sec(t) (unsigned long)(t/1000000000) - -#else -#ifndef USE_CLOCK_GETTIME -#define USE_CLOCK_GETTIME 0 -#ifndef HAVE_CLOCK_GETTIME -#define HAVE_CLOCK_GETTIME 1 /* Assume the CLOCK_VIRTUAL test will catch */ -#endif -/* - * It turns out to be non-ANSI to use the apparently simpler construct - * "#define USE_CLOCK_GETTIME defined(CLOCK_VIRTUAL)", since - * "If the token defined is generated as a result of this replacement - * process or use of the defined unary operator does not match one - * of the two specified forms prior ro macro replacement, the behaviour - * is undefined." (ANSI/ISO 9899-1990 section 6.8.1) - * In practice, it breaks the DEC Alpha compiler. - */ -#if HAVE_CLOCK_GETTIME -#ifdef CLOCK_VIRTUAL -#ifdef USE_CLOCK_GETTIME -#undef USE_CLOCK_GETTIME -#endif -#define USE_CLOCK_GETTIME 1 -#endif -#endif -#endif - -#if USE_CLOCK_GETTIME -#define CLOCK_AVAIL 1 -typedef struct timespec timetype; -#define gettime(t) clock_gettime(CLOCK_VIRTUAL, t) -#define subtime(d,s) \ - d.tv_sec -= s.tv_sec + (d.tv_nsec >= s.tv_nsec ? \ - (d.tv_nsec -= s.tv_nsec, 0) : \ - (d.tv_nsec += 1000000000-s.tv_nsec, 1)) -#define msec(t) (unsigned)(t.tv_nsec/1000000) -#define sec(t) (unsigned long)(t.tv_sec) - -#else -#if UNIX -#ifndef HAVE_GETRUSAGE -#define HAVE_GETRUSAGE 1 -#endif -#endif /* UNIX */ - -#define USE_GETRUSAGE 0 - -/* AJR */ -/*#define HAVE_GETRUSAGE 0*/ - -#include <sys/time.h> -#if HAVE_GETRUSAGE -#if TIME_WITH_SYS_TIME -#ifndef HAVE_SYS_TIME_H -#include <sys/time.h> -#elif HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#endif /* TIME_WITH_SYS_TIME */ -#include <sys/resource.h> - -#ifdef RUSAGE_SELF -#undef USE_GETRUSAGE -#define USE_GETRUSAGE 1 -#endif -#endif /* HAVE_GETRUSAGE */ - -#if USE_GETRUSAGE -#define CLOCK_AVAIL 1 -typedef struct rusage timetype; -#define gettime(t) getrusage(RUSAGE_SELF, t); -#define subtime(d, s) \ - d.ru_utime.tv_sec -= s.ru_utime.tv_sec + \ - (d.ru_utime.tv_usec >= s.ru_utime.tv_usec ? \ - (d.ru_utime.tv_usec -= s.ru_utime.tv_usec, 0) : \ - (d.ru_utime.tv_usec += 1000000-s.ru_utime.tv_usec, 1)) -#define msec(t) (unsigned)(t.ru_utime.tv_usec/1000) -#define sec(t) (unsigned long)(t.ru_utime.tv_sec) - -#else - -#ifndef HAVE_CLOCK -#define HAVE_CLOCK 1 -#endif - -#define USE_CLOCK 0 -#define USE_TIME 0 - -#if HAVE_CLOCK -#ifndef CLOCKS_PER_SEC -#ifdef CLK_TCK -#define CLOCKS_PER_SEC CLK_TCK -#endif -#endif /* !defined(CLOCKS_PER_SEC) */ - -#ifndef USE_CLOCK -#ifdef CLOCKS_PER_SEC -#define USE_CLOCK 1 -#endif -#endif /* !defined(USE_CLOCK) */ -#endif /* HAVE_CLOCK */ - -#if USE_CLOCK -#define CLOCK_AVAIL 1 -typedef clock_t timetype; -#define gettime(t) *(t) = clock() -#define subtime(d, s) d -= s -/* - * I don't like having to do floating point math. CLOCKS_PER_SEC is - * almost always an integer, and the most common non-integral case is - * the MS-DOS wierdness of 18.2. We have to be a bit careful with the - * casts, because ANSI C doesn't provide % with non-integral operands, - * but just to be extra annoying, some implementations define it as an - * integral-valued float. (E.g. Borland C++ 4.5 with 1000.0) - */ -/* AJR #if ((unsigned)CLOCKS_PER_SEC == CLOCKS_PER_SEC)*/ -#if 1 - /* Integer CLOCKS_PER_SEC */ - -#define sec(t) (unsigned long)(t/CLOCKS_PER_SEC) -#define msec(t) (unsigned)(t % (unsigned)CLOCKS_PER_SEC * 1000 / \ - (unsigned)CLOCKS_PER_SEC) -/* AJR #elif (CLOCKS_PER_SEC == 18.2)*/ -#elif 0 - /* MS-DOS-ism */ - -#define sec(t) (unsigned long)(t*5 / 91) -#define msec(t) (unsigned)(t*5 % 91 * 1000 / 91) - -#else /* We are forced to muck with floating point.... */ - -#include <math.h> /* For floor() */ -#define sec(t) (unsigned long)(t/CLOCKS_PER_SEC) -#define msec(t) (unsigned)((t - sec(t)*CLOCKS_PER_SEC) * 1000 / CLOCKS_PER_SEC) - -#endif - -#else - -#ifndef HAVE_TIME -#define HAVE_TIME 1 -#endif - -#if HAVE_TIME -#ifndef USE_TIME -#define USE_TIME 1 -#endif -#endif - -#if USE_TIME -#define CLOCK_AVAIL 1 -typedef time_t timetype; -#define gettime(t) time(t) -#define subtime(d, s) d -= s -#define msec(t) (unsigned)0 -#define sec(t) (unsigned long)t - -#endif /* USE_TIME */ -#endif /* USE_CLOCK */ -#endif /* USE_GETRUSAGE */ -#endif /* USE_CLOCK_GETTIME */ -#endif /* USE_GETHRVTIME */ - -#endif /*CPUTIME_H*/ diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/kludge.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/kludge.h deleted file mode 100644 index 6c5340e789..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/kludge.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef KLUDGE_H -#define KLUDGE_H - -/* - * Kludges for not-quite-ANSI systems. - * This should always be the last file included, because it may - * mess up some system header files. - */ - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STDLIB_H -#define NO_STDLIB_H 0 -#endif - -#ifndef NO_MEMMOVE -#define NO_MEMMOVE 0 -#endif -#if NO_MEMMOVE /* memove() not in libraries */ -#define memmove(dest,src,len) bcopy(src,dest,len) -#endif - -#ifndef NO_MEMCPY -#define NO_MEMCPY 0 -#endif -#if NO_MEMCPY /* memcpy() not in libraries */ -#define memcpy(dest,src,len) bcopy(src,dest,len) -#endif - -/* - * Borland C seems to think that it's a bad idea to decleare a - * structure tag and not declare the contents. I happen to think - * it's a *good* idea to use such "opaque" structures wherever - * possible. So shut up. - */ -#ifdef __BORLANDC__ -#pragma warn -stu -#ifndef MSDOS -#define MSDOS 1 -#endif -#endif - -/* Turn off warning about negation of unsigned values */ -#ifdef _MSC_VER -#pragma warning(disable:4146) -#endif - -/* Cope with people forgetting to define the OS, if possible... */ -#ifndef MSDOS -#ifdef __MSDOS -#define MSDOS 1 -#endif -#endif -#ifndef MSDOS -#ifdef __MSDOS__ -#define MSDOS 1 -#endif -#endif - -/* By MS-DOS, we mean 16-bit brain-dead MS-DOS. Not GCC & GO32 */ -#ifdef __GO32 -#undef MSDOS -#endif -#ifdef __GO32__ -#undef MSDOS -#endif - -#endif /* KLUDGE_H */ diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn.h deleted file mode 100644 index 5e288481d0..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * lbn.h - Low-level bignum header. - * Defines various word sizes and useful macros. - * - * Copyright (c) 1995 Colin Plumb. All rights reserved. - */ -#ifndef LBN_H -#define LBN_H - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_LIMITS_H -#define NO_LIMITS_H 0 -#endif - -/* Make sure we have 8-bit bytes */ -#if !NO_LIMITS_H -#include <limits.h> -#if UCHAR_MAX != 0xff || CHAR_BIT != 8 -#error The bignum library requires 8-bit unsigned characters. -#endif -#endif /* !NO_LIMITS_H */ - -#ifdef BNINCLUDE /* If this is defined as, say, foo.h */ -#define STR(x) #x /* STR(BNINCLUDE) -> "BNINCLUDE" */ -#define XSTR(x) STR(x) /* XSTR(BNINCLUDE) -> STR(foo.h) -> "foo.h" */ -#include XSTR(BNINCLUDE) /* #include "foo.h" */ -#undef XSTR -#undef STR -#endif - -/* Do we want bnYield()? */ -#ifndef BNYIELD -#define BNYIELD 0 -#endif - -/* Figure out the endianness */ -/* Error if more than one is defined */ -#if defined(BN_BIG_ENDIAN) && defined(BN_LITTLE_ENDIAN) -#error Only one of BN_BIG_ENDIAN or BN_LITTLE_ENDIAN may be defined -#endif - -/* - * If no preference is stated, little-endian C code is slightly more - * efficient, so prefer that. (The endianness here does NOT have to - * match the machine's native byte sex; the library's C code will work - * either way. The flexibility is allowed for assembly routines - * that do care. - */ -#if !defined(BN_BIG_ENDIAN) && !defined(BN_LITTLE_ENDIAN) -#define BN_LITTLE_ENDIAN 1 -#endif /* !BN_BIG_ENDIAN && !BN_LITTLE_ENDIAN */ - -/* Macros to choose between big and little endian */ -#if defined(BN_BIG_ENDIAN) -#define BIG(b) b -#define LITTLE(l) /*nothing*/ -#define BIGLITTLE(b,l) b -#elif BN_LITTLE_ENDIAN -#define BIG(b) /*nothing*/ -#define LITTLE(l) l -#define BIGLITTLE(b,l) l -#else -#error One of BN_BIG_ENDIAN or BN_LITTLE_ENDIAN must be defined as 1 -#endif - - -/* - * Find a 16-bit unsigned type. - * Unsigned short is preferred over unsigned int to make the type chosen - * by this file more stable on platforms (such as many 68000 compilers) - * which support both 16- and 32-bit ints. - */ -#ifndef BNWORD16 -#ifndef USHRT_MAX /* No <limits.h> available - guess */ -typedef unsigned short bnword16; -#define BNWORD16 bnword16 -#elif USHRT_MAX == 0xffff -typedef unsigned short bnword16; -#define BNWORD16 bnword16 -#elif UINT_MAX == 0xffff -typedef unsigned bnword16; -#define BNWORD16 bnword16 -#endif -#endif /* BNWORD16 */ - -/* - * Find a 32-bit unsigned type. - * Unsigned long is preferred over unsigned int to make the type chosen - * by this file more stable on platforms (such as many 68000 compilers) - * which support both 16- and 32-bit ints. - */ -#ifndef BNWORD32 -#ifndef ULONG_MAX /* No <limits.h> available - guess */ -typedef unsigned long bnword32; -#define BNWORD32 bnword32 -#elif ULONG_MAX == 0xfffffffful -typedef unsigned long bnword32; -#define BNWORD32 bnword32 -#elif UINT_MAX == 0xffffffff -typedef unsigned bnword32; -#define BNWORD32 bnword32 -#elif USHRT_MAX == 0xffffffff -typedef unsigned short bnword32; -#define BNWORD32 bnword32 -#endif -#endif /* BNWORD16 */ - -/* - * Find a 64-bit unsigned type. - * The conditions here are more complicated to avoid using numbers that - * will choke lesser preprocessors (like 0xffffffffffffffff) unless - * we're reasonably certain that they'll be acceptable. - */ -#if !defined(BNWORD64) && ULONG_MAX > 0xfffffffful -#if ULONG_MAX == 0xffffffffffffffff -typedef unsigned long bnword64; -#define BNWORD64 bnword64 -#endif -#endif - -/* - * I would test the value of unsigned long long, but some *preprocessors* - * don't constants that long even if the compiler can accept them, so it - * doesn't work reliably. So cross our fingers and hope that it's a 64-bit - * type. - * - * GCC uses ULONG_LONG_MAX. Solaris uses ULLONG_MAX. IRIX uses ULONGLONG_MAX. - * Are there any other names for this? - */ -#if !defined(BNWORD64) && \ - (defined(ULONG_LONG_MAX) || defined (ULLONG_MAX) || defined(ULONGLONG_MAX)) -typedef unsigned long long bnword64; -#define BNWORD64 bnword64 -#else -typedef unsigned long long bnword64; -#define BNWORD64 bnword64 -#endif - -/* We don't even try to find a 128-bit type at the moment */ - -#endif /* !LBN_H */ diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.c b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.c deleted file mode 100644 index 0b8d52e021..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.c +++ /dev/null @@ -1,4070 +0,0 @@ -/* - * lbn16.c - Low-level bignum routines, 16-bit version. - * - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * - * NOTE: the magic constants "16" and "32" appear in many places in this - * file, including inside identifiers. Because it is not possible to - * ask "#ifdef" of a macro expansion, it is not possible to use the - * preprocessor to conditionalize these properly. Thus, this file is - * intended to be edited with textual search and replace to produce - * alternate word size versions. Any reference to the number of bits - * in a word must be the string "16", and that string must not appear - * otherwise. Any reference to twice this number must appear as "32", - * which likewise must not appear otherwise. Is that clear? - * - * Remember, when doubling the bit size replace the larger number (32) - * first, then the smaller (16). When halving the bit size, do the - * opposite. Otherwise, things will get wierd. Also, be sure to replace - * every instance that appears. (:%s/foo/bar/g in vi) - * - * These routines work with a pointer to the least-significant end of - * an array of WORD16s. The BIG(x), LITTLE(y) and BIGLTTLE(x,y) macros - * defined in lbn.h (which expand to x on a big-edian machine and y on a - * little-endian machine) are used to conditionalize the code to work - * either way. If you have no assembly primitives, it doesn't matter. - * Note that on a big-endian machine, the least-significant-end pointer - * is ONE PAST THE END. The bytes are ptr[-1] through ptr[-len]. - * On little-endian, they are ptr[0] through ptr[len-1]. This makes - * perfect sense if you consider pointers to point *between* bytes rather - * than at them. - * - * Because the array index values are unsigned integers, ptr[-i] - * may not work properly, since the index -i is evaluated as an unsigned, - * and if pointers are wider, zero-extension will produce a positive - * number rahter than the needed negative. The expression used in this - * code, *(ptr-i) will, however, work. (The array syntax is equivalent - * to *(ptr+-i), which is a pretty subtle difference.) - * - * Many of these routines will get very unhappy if fed zero-length inputs. - * They use assert() to enforce this. An higher layer of code must make - * sure that these aren't called with zero-length inputs. - * - * Any of these routines can be replaced with more efficient versions - * elsewhere, by just #defining their names. If one of the names - * is #defined, the C code is not compiled in and no declaration is - * made. Use the BNINCLUDE file to do that. Typically, you compile - * asm subroutines with the same name and just, e.g. - * #define lbnMulAdd1_16 lbnMulAdd1_16 - * - * If you want to write asm routines, start with lbnMulAdd1_16(). - * This is the workhorse of modular exponentiation. lbnMulN1_16() is - * also used a fair bit, although not as much and it's defined in terms - * of lbnMulAdd1_16 if that has a custom version. lbnMulSub1_16 and - * lbnDiv21_16 are used in the usual division and remainder finding. - * (Not the Montgomery reduction used in modular exponentiation, though.) - * Once you have lbnMulAdd1_16 defined, writing the other two should - * be pretty easy. (Just make sure you get the sign of the subtraction - * in lbnMulSub1_16 right - it's dest = dest - source * k.) - * - * The only definitions that absolutely need a double-word (BNWORD32) - * type are lbnMulAdd1_16 and lbnMulSub1_16; if those are provided, - * the rest follows. lbnDiv21_16, however, is a lot slower unless you - * have them, and lbnModQ_16 takes after it. That one is used quite a - * bit for prime sieving. - */ - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#if !NO_STRING_H -#include <string.h> /* For memcpy */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "lbn.h" -#include "lbn16.h" -#include "lbnmem.h" - -#include "kludge.h" - -#ifndef BNWORD16 -#error 16-bit bignum library requires a 16-bit data type -#endif - -/* If this is defined, include bnYield() calls */ -#if BNYIELD -extern int (*bnYield)(void); /* From bn.c */ -#endif - -/* - * Most of the multiply (and Montgomery reduce) routines use an outer - * loop that iterates over one of the operands - a so-called operand - * scanning approach. One big advantage of this is that the assembly - * support routines are simpler. The loops can be rearranged to have - * an outer loop that iterates over the product, a so-called product - * scanning approach. This has the advantage of writing less data - * and doing fewer adds to memory, so is supposedly faster. Some - * code has been written using a product-scanning approach, but - * it appears to be slower, so it is turned off by default. Some - * experimentation would be appreciated. - * - * (The code is also annoying to get right and not very well commented, - * one of my pet peeves about math libraries. I'm sorry.) - */ -#ifndef PRODUCT_SCAN -#define PRODUCT_SCAN 0 -#endif - -/* - * Copy an array of words. <Marvin mode on> Thrilling, isn't it? </Marvin> - * This is a good example of how the byte offsets and BIGLITTLE() macros work. - * Another alternative would have been - * memcpy(dest BIG(-len), src BIG(-len), len*sizeof(BNWORD16)), but I find that - * putting operators into conditional macros is confusing. - */ -#ifndef lbnCopy_16 -void -lbnCopy_16(BNWORD16 *dest, BNWORD16 const *src, unsigned len) -{ - memcpy(BIGLITTLE(dest-len,dest), BIGLITTLE(src-len,src), - len * sizeof(*src)); -} -#endif /* !lbnCopy_16 */ - -/* - * Fill n words with zero. This does it manually rather than calling - * memset because it can assume alignment to make things faster while - * memset can't. Note how big-endian numbers are naturally addressed - * using predecrement, while little-endian is postincrement. - */ -#ifndef lbnZero_16 -void -lbnZero_16(BNWORD16 *num, unsigned len) -{ - while (len--) - BIGLITTLE(*--num,*num++) = 0; -} -#endif /* !lbnZero_16 */ - -/* - * Negate an array of words. - * Negation is subtraction from zero. Negating low-order words - * entails doing nothing until a non-zero word is hit. Once that - * is negated, a borrow is generated and never dies until the end - * of the number is hit. Negation with borrow, -x-1, is the same as ~x. - * Repeat that until the end of the number. - * - * Doesn't return borrow out because that's pretty useless - it's - * always set unless the input is 0, which is easy to notice in - * normalized form. - */ -#ifndef lbnNeg_16 -void -lbnNeg_16(BNWORD16 *num, unsigned len) -{ - assert(len); - - /* Skip low-order zero words */ - while (BIGLITTLE(*--num,*num) == 0) { - if (!--len) - return; - LITTLE(num++;) - } - /* Negate the lowest-order non-zero word */ - *num = -*num; - /* Complement all the higher-order words */ - while (--len) { - BIGLITTLE(--num,++num); - *num = ~*num; - } -} -#endif /* !lbnNeg_16 */ - - -/* - * lbnAdd1_16: add the single-word "carry" to the given number. - * Used for minor increments and propagating the carry after - * adding in a shorter bignum. - * - * Technique: If we have a double-width word, presumably the compiler - * can add using its carry in inline code, so we just use a larger - * accumulator to compute the carry from the first addition. - * If not, it's more complex. After adding the first carry, which may - * be > 1, compare the sum and the carry. If the sum wraps (causing a - * carry out from the addition), the result will be less than each of the - * inputs, since the wrap subtracts a number (2^16) which is larger than - * the other input can possibly be. If the sum is >= the carry input, - * return success immediately. - * In either case, if there is a carry, enter a loop incrementing words - * until one does not wrap. Since we are adding 1 each time, the wrap - * will be to 0 and we can test for equality. - */ -#ifndef lbnAdd1_16 /* If defined, it's provided as an asm subroutine */ -#ifdef BNWORD32 -BNWORD16 -lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry) -{ - BNWORD32 t; - assert(len > 0); /* Alternative: if (!len) return carry */ - - t = (BNWORD32)BIGLITTLE(*--num,*num) + carry; - BIGLITTLE(*num,*num++) = (BNWORD16)t; - if ((t >> 16) == 0) - return 0; - while (--len) { - if (++BIGLITTLE(*--num,*num++) != 0) - return 0; - } - return 1; -} -#else /* no BNWORD32 */ -BNWORD16 -lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry) -{ - assert(len > 0); /* Alternative: if (!len) return carry */ - - if ((BIGLITTLE(*--num,*num++) += carry) >= carry) - return 0; - while (--len) { - if (++BIGLITTLE(*--num,*num++) != 0) - return 0; - } - return 1; -} -#endif -#endif/* !lbnAdd1_16 */ - -/* - * lbnSub1_16: subtract the single-word "borrow" from the given number. - * Used for minor decrements and propagating the borrow after - * subtracting a shorter bignum. - * - * Technique: Similar to the add, above. If there is a double-length type, - * use that to generate the first borrow. - * If not, after subtracting the first borrow, which may be > 1, compare - * the difference and the *negative* of the carry. If the subtract wraps - * (causing a borrow out from the subtraction), the result will be at least - * as large as -borrow. If the result < -borrow, then no borrow out has - * appeared and we may return immediately, except when borrow == 0. To - * deal with that case, use the identity that -x = ~x+1, and instead of - * comparing < -borrow, compare for <= ~borrow. - * Either way, if there is a borrow out, enter a loop decrementing words - * until a non-zero word is reached. - * - * Note the cast of ~borrow to (BNWORD16). If the size of an int is larger - * than BNWORD16, C rules say the number is expanded for the arithmetic, so - * the inversion will be done on an int and the value won't be quite what - * is expected. - */ -#ifndef lbnSub1_16 /* If defined, it's provided as an asm subroutine */ -#ifdef BNWORD32 -BNWORD16 -lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow) -{ - BNWORD32 t; - assert(len > 0); /* Alternative: if (!len) return borrow */ - - t = (BNWORD32)BIGLITTLE(*--num,*num) - borrow; - BIGLITTLE(*num,*num++) = (BNWORD16)t; - if ((t >> 16) == 0) - return 0; - while (--len) { - if ((BIGLITTLE(*--num,*num++))-- != 0) - return 0; - } - return 1; -} -#else /* no BNWORD32 */ -BNWORD16 -lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow) -{ - assert(len > 0); /* Alternative: if (!len) return borrow */ - - if ((BIGLITTLE(*--num,*num++) -= borrow) <= (BNWORD16)~borrow) - return 0; - while (--len) { - if ((BIGLITTLE(*--num,*num++))-- != 0) - return 0; - } - return 1; -} -#endif -#endif /* !lbnSub1_16 */ - -/* - * lbnAddN_16: add two bignums of the same length, returning the carry (0 or 1). - * One of the building blocks, along with lbnAdd1, of adding two bignums of - * differing lengths. - * - * Technique: Maintain a word of carry. If there is no double-width type, - * use the same technique as in lbnAdd1, above, to maintain the carry by - * comparing the inputs. Adding the carry sources is used as an OR operator; - * at most one of the two comparisons can possibly be true. The first can - * only be true if carry == 1 and x, the result, is 0. In that case the - * second can't possibly be true. - */ -#ifndef lbnAddN_16 -#ifdef BNWORD32 -BNWORD16 -lbnAddN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len) -{ - BNWORD32 t; - - assert(len > 0); - - t = (BNWORD32)BIGLITTLE(*--num1,*num1) + BIGLITTLE(*--num2,*num2++); - BIGLITTLE(*num1,*num1++) = (BNWORD16)t; - while (--len) { - t = (BNWORD32)BIGLITTLE(*--num1,*num1) + - (BNWORD32)BIGLITTLE(*--num2,*num2++) + (t >> 16); - BIGLITTLE(*num1,*num1++) = (BNWORD16)t; - } - - return (BNWORD16)(t>>16); -} -#else /* no BNWORD32 */ -BNWORD16 -lbnAddN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len) -{ - BNWORD16 x, carry = 0; - - assert(len > 0); /* Alternative: change loop to test at start */ - - do { - x = BIGLITTLE(*--num2,*num2++); - carry = (x += carry) < carry; - carry += (BIGLITTLE(*--num1,*num1++) += x) < x; - } while (--len); - - return carry; -} -#endif -#endif /* !lbnAddN_16 */ - -/* - * lbnSubN_16: add two bignums of the same length, returning the carry (0 or 1). - * One of the building blocks, along with subn1, of subtracting two bignums of - * differing lengths. - * - * Technique: If no double-width type is availble, maintain a word of borrow. - * First, add the borrow to the subtrahend (did you have to learn all those - * awful words in elementary school, too?), and if it overflows, set the - * borrow again. Then subtract the modified subtrahend from the next word - * of input, using the same technique as in subn1, above. - * Adding the borrows is used as an OR operator; at most one of the two - * comparisons can possibly be true. The first can only be true if - * borrow == 1 and x, the result, is 0. In that case the second can't - * possibly be true. - * - * In the double-word case, (BNWORD16)-(t>>16) is subtracted, rather than - * adding t>>16, because the shift would need to sign-extend and that's - * not guaranteed to happen in ANSI C, even with signed types. - */ -#ifndef lbnSubN_16 -#ifdef BNWORD32 -BNWORD16 -lbnSubN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len) -{ - BNWORD32 t; - - assert(len > 0); - - t = (BNWORD32)BIGLITTLE(*--num1,*num1) - BIGLITTLE(*--num2,*num2++); - BIGLITTLE(*num1,*num1++) = (BNWORD16)t; - - while (--len) { - t = (BNWORD32)BIGLITTLE(*--num1,*num1) - - (BNWORD32)BIGLITTLE(*--num2,*num2++) - (BNWORD16)-(t >> 16); - BIGLITTLE(*num1,*num1++) = (BNWORD16)t; - } - - return -(BNWORD16)(t>>16); -} -#else -BNWORD16 -lbnSubN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len) -{ - BNWORD16 x, borrow = 0; - - assert(len > 0); /* Alternative: change loop to test at start */ - - do { - x = BIGLITTLE(*--num2,*num2++); - borrow = (x += borrow) < borrow; - borrow += (BIGLITTLE(*--num1,*num1++) -= x) > (BNWORD16)~x; - } while (--len); - - return borrow; -} -#endif -#endif /* !lbnSubN_16 */ - -#ifndef lbnCmp_16 -/* - * lbnCmp_16: compare two bignums of equal length, returning the sign of - * num1 - num2. (-1, 0 or +1). - * - * Technique: Change the little-endian pointers to big-endian pointers - * and compare from the most-significant end until a difference if found. - * When it is, figure out the sign of the difference and return it. - */ -int -lbnCmp_16(BNWORD16 const *num1, BNWORD16 const *num2, unsigned len) -{ - BIGLITTLE(num1 -= len, num1 += len); - BIGLITTLE(num2 -= len, num2 += len); - - while (len--) { - if (BIGLITTLE(*num1++ != *num2++, *--num1 != *--num2)) { - if (BIGLITTLE(num1[-1] < num2[-1], *num1 < *num2)) - return -1; - else - return 1; - } - } - return 0; -} -#endif /* !lbnCmp_16 */ - -/* - * mul16_ppmmaa(ph,pl,x,y,a,b) is an optional routine that - * computes (ph,pl) = x * y + a + b. mul16_ppmma and mul16_ppmm - * are simpler versions. If you want to be lazy, all of these - * can be defined in terms of the others, so here we create any - * that have not been defined in terms of the ones that have been. - */ - -/* Define ones with fewer a's in terms of ones with more a's */ -#if !defined(mul16_ppmma) && defined(mul16_ppmmaa) -#define mul16_ppmma(ph,pl,x,y,a) mul16_ppmmaa(ph,pl,x,y,a,0) -#endif - -#if !defined(mul16_ppmm) && defined(mul16_ppmma) -#define mul16_ppmm(ph,pl,x,y) mul16_ppmma(ph,pl,x,y,0) -#endif - -/* - * Use this definition to test the mul16_ppmm-based operations on machines - * that do not provide mul16_ppmm. Change the final "0" to a "1" to - * enable it. - */ -#if !defined(mul16_ppmm) && defined(BNWORD32) && 0 /* Debugging */ -#define mul16_ppmm(ph,pl,x,y) \ - ({BNWORD32 _ = (BNWORD32)(x)*(y); (pl) = _; (ph) = _>>16;}) -#endif - -#if defined(mul16_ppmm) && !defined(mul16_ppmma) -#define mul16_ppmma(ph,pl,x,y,a) \ - (mul16_ppmm(ph,pl,x,y), (ph) += ((pl) += (a)) < (a)) -#endif - -#if defined(mul16_ppmma) && !defined(mul16_ppmmaa) -#define mul16_ppmmaa(ph,pl,x,y,a,b) \ - (mul16_ppmma(ph,pl,x,y,a), (ph) += ((pl) += (b)) < (b)) -#endif - -/* - * lbnMulN1_16: Multiply an n-word input by a 1-word input and store the - * n+1-word product. This uses either the mul16_ppmm and mul16_ppmma - * macros, or C multiplication with the BNWORD32 type. This uses mul16_ppmma - * if available, assuming you won't bother defining it unless you can do - * better than the normal multiplication. - */ -#ifndef lbnMulN1_16 -#ifdef lbnMulAdd1_16 /* If we have this asm primitive, use it. */ -void -lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - lbnZero_16(out, len); - BIGLITTLE(*(out-len),*(out+len)) = lbnMulAdd1_16(out, in, len, k); -} -#elif defined(mul16_ppmm) -void -lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD16 carry, carryin; - - assert(len > 0); - - BIG(--out;--in;); - mul16_ppmm(carry, *out, *in, k); - LITTLE(out++;in++;) - - while (--len) { - BIG(--out;--in;) - carryin = carry; - mul16_ppmma(carry, *out, *in, k, carryin); - LITTLE(out++;in++;) - } - BIGLITTLE(*--out,*out) = carry; -} -#elif defined(BNWORD32) -void -lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD32 p; - - assert(len > 0); - - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k; - BIGLITTLE(*--out,*out++) = (BNWORD16)p; - - while (--len) { - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k + (BNWORD16)(p >> 16); - BIGLITTLE(*--out,*out++) = (BNWORD16)p; - } - BIGLITTLE(*--out,*out) = (BNWORD16)(p >> 16); -} -#else -#error No 16x16 -> 32 multiply available for 16-bit bignum package -#endif -#endif /* lbnMulN1_16 */ - -/* - * lbnMulAdd1_16: Multiply an n-word input by a 1-word input and add the - * low n words of the product to the destination. *Returns the n+1st word - * of the product.* (That turns out to be more convenient than adding - * it into the destination and dealing with a possible unit carry out - * of *that*.) This uses either the mul16_ppmma and mul16_ppmmaa macros, - * or C multiplication with the BNWORD32 type. - * - * If you're going to write assembly primitives, this is the one to - * start with. It is by far the most commonly called function. - */ -#ifndef lbnMulAdd1_16 -#if defined(mul16_ppmm) -BNWORD16 -lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD16 prod, carry, carryin; - - assert(len > 0); - - BIG(--out;--in;); - carryin = *out; - mul16_ppmma(carry, *out, *in, k, carryin); - LITTLE(out++;in++;) - - while (--len) { - BIG(--out;--in;); - carryin = carry; - mul16_ppmmaa(carry, prod, *in, k, carryin, *out); - *out = prod; - LITTLE(out++;in++;) - } - - return carry; -} -#elif defined(BNWORD32) -BNWORD16 -lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD32 p; - - assert(len > 0); - - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k + BIGLITTLE(*--out,*out); - BIGLITTLE(*out,*out++) = (BNWORD16)p; - - while (--len) { - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k + - (BNWORD16)(p >> 16) + BIGLITTLE(*--out,*out); - BIGLITTLE(*out,*out++) = (BNWORD16)p; - } - - return (BNWORD16)(p >> 16); -} -#else -#error No 16x16 -> 32 multiply available for 16-bit bignum package -#endif -#endif /* lbnMulAdd1_16 */ - -/* - * lbnMulSub1_16: Multiply an n-word input by a 1-word input and subtract the - * n-word product from the destination. Returns the n+1st word of the product. - * This uses either the mul16_ppmm and mul16_ppmma macros, or - * C multiplication with the BNWORD32 type. - * - * This is rather uglier than adding, but fortunately it's only used in - * division which is not used too heavily. - */ -#ifndef lbnMulSub1_16 -#if defined(mul16_ppmm) -BNWORD16 -lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD16 prod, carry, carryin; - - assert(len > 0); - - BIG(--in;) - mul16_ppmm(carry, prod, *in, k); - LITTLE(in++;) - carry += (BIGLITTLE(*--out,*out++) -= prod) > (BNWORD16)~prod; - - while (--len) { - BIG(--in;); - carryin = carry; - mul16_ppmma(carry, prod, *in, k, carryin); - LITTLE(in++;) - carry += (BIGLITTLE(*--out,*out++) -= prod) > (BNWORD16)~prod; - } - - return carry; -} -#elif defined(BNWORD32) -BNWORD16 -lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD32 p; - BNWORD16 carry, t; - - assert(len > 0); - - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k; - t = BIGLITTLE(*--out,*out); - carry = (BNWORD16)(p>>16) + ((BIGLITTLE(*out,*out++)=t-(BNWORD16)p) > t); - - while (--len) { - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k + carry; - t = BIGLITTLE(*--out,*out); - carry = (BNWORD16)(p>>16) + - ( (BIGLITTLE(*out,*out++)=t-(BNWORD16)p) > t ); - } - - return carry; -} -#else -#error No 16x16 -> 32 multiply available for 16-bit bignum package -#endif -#endif /* !lbnMulSub1_16 */ - -/* - * Shift n words left "shift" bits. 0 < shift < 16. Returns the - * carry, any bits shifted off the left-hand side (0 <= carry < 2^shift). - */ -#ifndef lbnLshift_16 -BNWORD16 -lbnLshift_16(BNWORD16 *num, unsigned len, unsigned shift) -{ - BNWORD16 x, carry; - - assert(shift > 0); - assert(shift < 16); - - carry = 0; - while (len--) { - BIG(--num;) - x = *num; - *num = (x<<shift) | carry; - LITTLE(num++;) - carry = x >> (16-shift); - } - return carry; -} -#endif /* !lbnLshift_16 */ - -/* - * An optimized version of the above, for shifts of 1. - * Some machines can use add-with-carry tricks for this. - */ -#ifndef lbnDouble_16 -BNWORD16 -lbnDouble_16(BNWORD16 *num, unsigned len) -{ - BNWORD16 x, carry; - - carry = 0; - while (len--) { - BIG(--num;) - x = *num; - *num = (x<<1) | carry; - LITTLE(num++;) - carry = x >> (16-1); - } - return carry; -} -#endif /* !lbnDouble_16 */ - -/* - * Shift n words right "shift" bits. 0 < shift < 16. Returns the - * carry, any bits shifted off the right-hand side (0 <= carry < 2^shift). - */ -#ifndef lbnRshift_16 -BNWORD16 -lbnRshift_16(BNWORD16 *num, unsigned len, unsigned shift) -{ - BNWORD16 x, carry = 0; - - assert(shift > 0); - assert(shift < 16); - - BIGLITTLE(num -= len, num += len); - - while (len--) { - LITTLE(--num;) - x = *num; - *num = (x>>shift) | carry; - BIG(num++;) - carry = x << (16-shift); - } - return carry >> (16-shift); -} -#endif /* !lbnRshift_16 */ - -/* - * Multiply two numbers of the given lengths. prod and num2 may overlap, - * provided that the low len1 bits of prod are free. (This corresponds - * nicely to the place the result is returned from lbnMontReduce_16.) - * - * TODO: Use Karatsuba multiply. The overlap constraints may have - * to get rewhacked. - */ -#ifndef lbnMul_16 -void -lbnMul_16(BNWORD16 *prod, BNWORD16 const *num1, unsigned len1, - BNWORD16 const *num2, unsigned len2) -{ - /* Special case of zero */ - if (!len1 || !len2) { - lbnZero_16(prod, len1+len2); - return; - } - - /* Multiply first word */ - lbnMulN1_16(prod, num1, len1, BIGLITTLE(*--num2,*num2++)); - - /* - * Add in subsequent words, storing the most significant word, - * which is new each time. - */ - while (--len2) { - BIGLITTLE(--prod,prod++); - BIGLITTLE(*(prod-len1-1),*(prod+len1)) = - lbnMulAdd1_16(prod, num1, len1, BIGLITTLE(*--num2,*num2++)); - } -} -#endif /* !lbnMul_16 */ - -/* - * lbnMulX_16 is a square multiply - both inputs are the same length. - * It's normally just a macro wrapper around the general multiply, - * but might be implementable in assembly more efficiently (such as - * when product scanning). - */ -#ifndef lbnMulX_16 -#if defined(BNWORD32) && PRODUCT_SCAN -/* - * Test code to see whether product scanning is any faster. It seems - * to make the C code slower, so PRODUCT_SCAN is not defined. - */ -static void -lbnMulX_16(BNWORD16 *prod, BNWORD16 const *num1, BNWORD16 const *num2, - unsigned len) -{ - BNWORD32 x, y; - BNWORD16 const *p1, *p2; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - x = (BNWORD32)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]); - BIGLITTLE(*--prod, *prod++) = (BNWORD16)x; - x >>= 16; - - for (i = 1; i < len; i++) { - carry = 0; - p1 = num1; - p2 = BIGLITTLE(num2-i-1,num2+i+1); - for (j = 0; j <= i; j++) { - BIG(y = (BNWORD32)*--p1 * *p2++;) - LITTLE(y = (BNWORD32)*p1++ * *--p2;) - x += y; - carry += (x < y); - } - BIGLITTLE(*--prod,*prod++) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - for (i = 1; i < len; i++) { - carry = 0; - p1 = BIGLITTLE(num1-i,num1+i); - p2 = BIGLITTLE(num2-len,num2+len); - for (j = i; j < len; j++) { - BIG(y = (BNWORD32)*--p1 * *p2++;) - LITTLE(y = (BNWORD32)*p1++ * *--p2;) - x += y; - carry += (x < y); - } - BIGLITTLE(*--prod,*prod++) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - - BIGLITTLE(*--prod,*prod) = (BNWORD16)x; -} -#else /* !defined(BNWORD32) || !PRODUCT_SCAN */ -/* Default trivial macro definition */ -#define lbnMulX_16(prod, num1, num2, len) lbnMul_16(prod, num1, len, num2, len) -#endif /* !defined(BNWORD32) || !PRODUCT_SCAN */ -#endif /* !lbmMulX_16 */ - -#if !defined(lbnMontMul_16) && defined(BNWORD32) && PRODUCT_SCAN -/* - * Test code for product-scanning multiply. This seems to slow the C - * code down rather than speed it up. - * This does a multiply and Montgomery reduction together, using the - * same loops. The outer loop scans across the product, twice. - * The first pass computes the low half of the product and the - * Montgomery multipliers. These are stored in the product array, - * which contains no data as of yet. x and carry add up the columns - * and propagate carries forward. - * - * The second half multiplies the upper half, adding in the modulus - * times the Montgomery multipliers. The results of this multiply - * are stored. - */ -static void -lbnMontMul_16(BNWORD16 *prod, BNWORD16 const *num1, BNWORD16 const *num2, - BNWORD16 const *mod, unsigned len, BNWORD16 inv) -{ - BNWORD32 x, y; - BNWORD16 const *p1, *p2, *pm; - BNWORD16 *pp; - BNWORD16 t; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - /* - * This computes directly into the high half of prod, so just - * shift the pointer and consider prod only "len" elements long - * for the rest of the code. - */ - BIGLITTLE(prod -= len, prod += len); - - /* Pass 1 - compute Montgomery multipliers */ - /* First iteration can have certain simplifications. */ - x = (BNWORD32)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]); - BIGLITTLE(prod[-1], prod[0]) = t = inv * (BNWORD16)x; - y = (BNWORD32)t * BIGLITTLE(mod[-1],mod[0]); - x += y; - /* Note: GCC 2.6.3 has a bug if you try to eliminate "carry" */ - carry = (x < y); - assert((BNWORD16)x == 0); - x = x >> 16 | (BNWORD32)carry << 16; - - for (i = 1; i < len; i++) { - carry = 0; - p1 = num1; - p2 = BIGLITTLE(num2-i-1,num2+i+1); - pp = prod; - pm = BIGLITTLE(mod-i-1,mod+i+1); - for (j = 0; j < i; j++) { - y = (BNWORD32)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2); - x += y; - carry += (x < y); - y = (BNWORD32)BIGLITTLE(*--pp * *pm++, *pp++ * *--pm); - x += y; - carry += (x < y); - } - y = (BNWORD32)BIGLITTLE(p1[-1] * p2[0], p1[0] * p2[-1]); - x += y; - carry += (x < y); - assert(BIGLITTLE(pp == prod-i, pp == prod+i)); - BIGLITTLE(pp[-1], pp[0]) = t = inv * (BNWORD16)x; - assert(BIGLITTLE(pm == mod-1, pm == mod+1)); - y = (BNWORD32)t * BIGLITTLE(pm[0],pm[-1]); - x += y; - carry += (x < y); - assert((BNWORD16)x == 0); - x = x >> 16 | (BNWORD32)carry << 16; - } - - /* Pass 2 - compute reduced product and store */ - for (i = 1; i < len; i++) { - carry = 0; - p1 = BIGLITTLE(num1-i,num1+i); - p2 = BIGLITTLE(num2-len,num2+len); - pm = BIGLITTLE(mod-i,mod+i); - pp = BIGLITTLE(prod-len,prod+len); - for (j = i; j < len; j++) { - y = (BNWORD32)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2); - x += y; - carry += (x < y); - y = (BNWORD32)BIGLITTLE(*--pm * *pp++, *pm++ * *--pp); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pm == mod-len, pm == mod+len)); - assert(BIGLITTLE(pp == prod-i, pp == prod+i)); - BIGLITTLE(pp[0],pp[-1]) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - - /* Last round of second half, simplified. */ - BIGLITTLE(*(prod-len),*(prod+len-1)) = (BNWORD16)x; - carry = (x >> 16); - - while (carry) - carry -= lbnSubN_16(prod, mod, len); - while (lbnCmp_16(prod, mod, len) >= 0) - (void)lbnSubN_16(prod, mod, len); -} -/* Suppress later definition */ -#define lbnMontMul_16 lbnMontMul_16 -#endif - -#if !defined(lbnSquare_16) && defined(BNWORD32) && PRODUCT_SCAN -/* - * Trial code for product-scanning squaring. This seems to slow the C - * code down rather than speed it up. - */ -void -lbnSquare_16(BNWORD16 *prod, BNWORD16 const *num, unsigned len) -{ - BNWORD32 x, y, z; - BNWORD16 const *p1, *p2; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - /* Word 0 of product */ - x = (BNWORD32)BIGLITTLE(num[-1] * num[-1], num[0] * num[0]); - BIGLITTLE(*--prod, *prod++) = (BNWORD16)x; - x >>= 16; - - /* Words 1 through len-1 */ - for (i = 1; i < len; i++) { - carry = 0; - y = 0; - p1 = num; - p2 = BIGLITTLE(num-i-1,num+i+1); - for (j = 0; j < (i+1)/2; j++) { - BIG(z = (BNWORD32)*--p1 * *p2++;) - LITTLE(z = (BNWORD32)*p1++ * *--p2;) - y += z; - carry += (y < z); - } - y += z = y; - carry += carry + (y < z); - if ((i & 1) == 0) { - assert(BIGLITTLE(--p1 == p2, p1 == --p2)); - BIG(z = (BNWORD32)*p2 * *p2;) - LITTLE(z = (BNWORD32)*p1 * *p1;) - y += z; - carry += (y < z); - } - x += y; - carry += (x < y); - BIGLITTLE(*--prod,*prod++) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - /* Words len through 2*len-2 */ - for (i = 1; i < len; i++) { - carry = 0; - y = 0; - p1 = BIGLITTLE(num-i,num+i); - p2 = BIGLITTLE(num-len,num+len); - for (j = 0; j < (len-i)/2; j++) { - BIG(z = (BNWORD32)*--p1 * *p2++;) - LITTLE(z = (BNWORD32)*p1++ * *--p2;) - y += z; - carry += (y < z); - } - y += z = y; - carry += carry + (y < z); - if ((len-i) & 1) { - assert(BIGLITTLE(--p1 == p2, p1 == --p2)); - BIG(z = (BNWORD32)*p2 * *p2;) - LITTLE(z = (BNWORD32)*p1 * *p1;) - y += z; - carry += (y < z); - } - x += y; - carry += (x < y); - BIGLITTLE(*--prod,*prod++) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - - /* Word 2*len-1 */ - BIGLITTLE(*--prod,*prod) = (BNWORD16)x; -} -/* Suppress later definition */ -#define lbnSquare_16 lbnSquare_16 -#endif - -/* - * Square a number, using optimized squaring to reduce the number of - * primitive multiples that are executed. There may not be any - * overlap of the input and output. - * - * Technique: Consider the partial products in the multiplication - * of "abcde" by itself: - * - * a b c d e - * * a b c d e - * ================== - * ae be ce de ee - * ad bd cd dd de - * ac bc cc cd ce - * ab bb bc bd be - * aa ab ac ad ae - * - * Note that everything above the main diagonal: - * ae be ce de = (abcd) * e - * ad bd cd = (abc) * d - * ac bc = (ab) * c - * ab = (a) * b - * - * is a copy of everything below the main diagonal: - * de - * cd ce - * bc bd be - * ab ac ad ae - * - * Thus, the sum is 2 * (off the diagonal) + diagonal. - * - * This is accumulated beginning with the diagonal (which - * consist of the squares of the digits of the input), which is then - * divided by two, the off-diagonal added, and multiplied by two - * again. The low bit is simply a copy of the low bit of the - * input, so it doesn't need special care. - * - * TODO: Merge the shift by 1 with the squaring loop. - * TODO: Use Karatsuba. (a*W+b)^2 = a^2 * (W^2+W) + b^2 * (W+1) - (a-b)^2 * W. - */ -#ifndef lbnSquare_16 -void -lbnSquare_16(BNWORD16 *prod, BNWORD16 const *num, unsigned len) -{ - BNWORD16 t; - BNWORD16 *prodx = prod; /* Working copy of the argument */ - BNWORD16 const *numx = num; /* Working copy of the argument */ - unsigned lenx = len; /* Working copy of the argument */ - - if (!len) - return; - - /* First, store all the squares */ - while (lenx--) { -#ifdef mul16_ppmm - BNWORD16 ph, pl; - t = BIGLITTLE(*--numx,*numx++); - mul16_ppmm(ph,pl,t,t); - BIGLITTLE(*--prodx,*prodx++) = pl; - BIGLITTLE(*--prodx,*prodx++) = ph; -#elif defined(BNWORD32) /* use BNWORD32 */ - BNWORD32 p; - t = BIGLITTLE(*--numx,*numx++); - p = (BNWORD32)t * t; - BIGLITTLE(*--prodx,*prodx++) = (BNWORD16)p; - BIGLITTLE(*--prodx,*prodx++) = (BNWORD16)(p>>16); -#else /* Use lbnMulN1_16 */ - t = BIGLITTLE(numx[-1],*numx); - lbnMulN1_16(prodx, numx, 1, t); - BIGLITTLE(--numx,numx++); - BIGLITTLE(prodx -= 2, prodx += 2); -#endif - } - /* Then, shift right 1 bit */ - (void)lbnRshift_16(prod, 2*len, 1); - - /* Then, add in the off-diagonal sums */ - lenx = len; - numx = num; - prodx = prod; - while (--lenx) { - t = BIGLITTLE(*--numx,*numx++); - BIGLITTLE(--prodx,prodx++); - t = lbnMulAdd1_16(prodx, numx, lenx, t); - lbnAdd1_16(BIGLITTLE(prodx-lenx,prodx+lenx), lenx+1, t); - BIGLITTLE(--prodx,prodx++); - } - - /* Shift it back up */ - lbnDouble_16(prod, 2*len); - - /* And set the low bit appropriately */ - BIGLITTLE(prod[-1],prod[0]) |= BIGLITTLE(num[-1],num[0]) & 1; -} -#endif /* !lbnSquare_16 */ - -/* - * lbnNorm_16 - given a number, return a modified length such that the - * most significant digit is non-zero. Zero-length input is okay. - */ -#ifndef lbnNorm_16 -unsigned -lbnNorm_16(BNWORD16 const *num, unsigned len) -{ - BIGLITTLE(num -= len,num += len); - while (len && BIGLITTLE(*num++,*--num) == 0) - --len; - return len; -} -#endif /* lbnNorm_16 */ - -/* - * lbnBits_16 - return the number of significant bits in the array. - * It starts by normalizing the array. Zero-length input is okay. - * Then assuming there's anything to it, it fetches the high word, - * generates a bit length by multiplying the word length by 16, and - * subtracts off 16/2, 16/4, 16/8, ... bits if the high bits are clear. - */ -#ifndef lbnBits_16 -unsigned -lbnBits_16(BNWORD16 const *num, unsigned len) -{ - BNWORD16 t; - unsigned i; - - len = lbnNorm_16(num, len); - if (len) { - t = BIGLITTLE(*(num-len),*(num+(len-1))); - assert(t); - len *= 16; - i = 16/2; - do { - if (t >> i) - t >>= i; - else - len -= i; - } while ((i /= 2) != 0); - } - return len; -} -#endif /* lbnBits_16 */ - -/* - * If defined, use hand-rolled divide rather than compiler's native. - * If the machine doesn't do it in line, the manual code is probably - * faster, since it can assume normalization and the fact that the - * quotient will fit into 16 bits, which a general 32-bit divide - * in a compiler's run-time library can't do. - */ -#ifndef BN_SLOW_DIVIDE_32 -/* Assume that divisors of more than thirty-two bits are slow */ -#define BN_SLOW_DIVIDE_32 (32 > 0x20) -#endif - -/* - * Return (nh<<16|nl) % d, and place the quotient digit into *q. - * It is guaranteed that nh < d, and that d is normalized (with its high - * bit set). If we have a double-width type, it's easy. If not, ooh, - * yuk! - */ -#ifndef lbnDiv21_16 -#if defined(BNWORD32) && !BN_SLOW_DIVIDE_32 -BNWORD16 -lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d) -{ - BNWORD32 n = (BNWORD32)nh << 16 | nl; - - /* Divisor must be normalized */ - assert(d >> (16-1) == 1); - - *q = n / d; - return n % d; -} -#else -/* - * This is where it gets ugly. - * - * Do the division in two halves, using Algorithm D from section 4.3.1 - * of Knuth. Note Theorem B from that section, that the quotient estimate - * is never more than the true quotient, and is never more than two - * too low. - * - * The mapping onto conventional long division is (everything a half word): - * _____________qh___ql_ - * dh dl ) nh.h nh.l nl.h nl.l - * - (qh * d) - * ----------- - * rrrr rrrr nl.l - * - (ql * d) - * ----------- - * rrrr rrrr - * - * The implicit 3/2-digit d*qh and d*ql subtractors are computed this way: - * First, estimate a q digit so that nh/dh works. Subtracting qh*dh from - * the (nh.h nh.l) list leaves a 1/2-word remainder r. Then compute the - * low part of the subtractor, qh * dl. This also needs to be subtracted - * from (nh.h nh.l nl.h) to get the final remainder. So we take the - * remainder, which is (nh.h nh.l) - qh*dl, shift it and add in nl.h, and - * try to subtract qh * dl from that. Since the remainder is 1/2-word - * long, shifting and adding nl.h results in a single word r. - * It is possible that the remainder we're working with, r, is less than - * the product qh * dl, if we estimated qh too high. The estimation - * technique can produce a qh that is too large (never too small), leading - * to r which is too small. In that case, decrement the digit qh, add - * shifted dh to r (to correct for that error), and subtract dl from the - * product we're comparing r with. That's the "correct" way to do it, but - * just adding dl to r instead of subtracting it from the product is - * equivalent and a lot simpler. You just have to watch out for overflow. - * - * The process is repeated with (rrrr rrrr nl.l) for the low digit of the - * quotient ql. - * - * The various uses of 16/2 for shifts are because of the note about - * automatic editing of this file at the very top of the file. - */ -#define highhalf(x) ( (x) >> 16/2 ) -#define lowhalf(x) ( (x) & (((BNWORD16)1 << 16/2)-1) ) -BNWORD16 -lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d) -{ - BNWORD16 dh = highhalf(d), dl = lowhalf(d); - BNWORD16 qh, ql, prod, r; - - /* Divisor must be normalized */ - assert((d >> (16-1)) == 1); - - /* Do first half-word of division */ - qh = nh / dh; - r = nh % dh; - prod = qh * dl; - - /* - * Add next half-word of numerator to remainder and correct. - * qh may be up to two too large. - */ - r = (r << (16/2)) | highhalf(nl); - if (r < prod) { - --qh; r += d; - if (r >= d && r < prod) { - --qh; r += d; - } - } - r -= prod; - - /* Do second half-word of division */ - ql = r / dh; - r = r % dh; - prod = ql * dl; - - r = (r << (16/2)) | lowhalf(nl); - if (r < prod) { - --ql; r += d; - if (r >= d && r < prod) { - --ql; r += d; - } - } - r -= prod; - - *q = (qh << (16/2)) | ql; - - return r; -} -#endif -#endif /* lbnDiv21_16 */ - - -/* - * In the division functions, the dividend and divisor are referred to - * as "n" and "d", which stand for "numerator" and "denominator". - * - * The quotient is (nlen-dlen+1) digits long. It may be overlapped with - * the high (nlen-dlen) words of the dividend, but one extra word is needed - * on top to hold the top word. - */ - -/* - * Divide an n-word number by a 1-word number, storing the remainder - * and n-1 words of the n-word quotient. The high word is returned. - * It IS legal for rem to point to the same address as n, and for - * q to point one word higher. - * - * TODO: If BN_SLOW_DIVIDE_32, add a divnhalf_16 which uses 16-bit - * dividends if the divisor is half that long. - * TODO: Shift the dividend on the fly to avoid the last division and - * instead have a remainder that needs shifting. - * TODO: Use reciprocals rather than dividing. - */ -#ifndef lbnDiv1_16 -BNWORD16 -lbnDiv1_16(BNWORD16 *q, BNWORD16 *rem, BNWORD16 const *n, unsigned len, - BNWORD16 d) -{ - unsigned shift; - unsigned xlen; - BNWORD16 r; - BNWORD16 qhigh; - - assert(len > 0); - assert(d); - - if (len == 1) { - r = *n; - *rem = r%d; - return r/d; - } - - shift = 0; - r = d; - xlen = 16/2; - do { - if (r >> xlen) - r >>= xlen; - else - shift += xlen; - } while ((xlen /= 2) != 0); - assert((d >> (16-1-shift)) == 1); - d <<= shift; - - BIGLITTLE(q -= len-1,q += len-1); - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - if (r < d) { - qhigh = 0; - } else { - qhigh = r/d; - r %= d; - } - - xlen = len; - while (--xlen) - r = lbnDiv21_16(BIGLITTLE(q++,--q), r, BIGLITTLE(*n++,*--n), d); - - /* - * Final correction for shift - shift the quotient up "shift" - * bits, and merge in the extra bits of quotient. Then reduce - * the final remainder mod the real d. - */ - if (shift) { - d >>= shift; - qhigh = (qhigh << shift) | lbnLshift_16(q, len-1, shift); - BIGLITTLE(q[-1],*q) |= r/d; - r %= d; - } - *rem = r; - - return qhigh; -} -#endif - -/* - * This function performs a "quick" modulus of a number with a divisor - * d which is guaranteed to be at most sixteen bits, i.e. less than 65536. - * This applies regardless of the word size the library is compiled with. - * - * This function is important to prime generation, for sieving. - */ -#ifndef lbnModQ_16 -/* If there's a custom lbnMod21_16, no normalization needed */ -#ifdef lbnMod21_16 -unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d) -{ - unsigned i, shift; - BNWORD16 r; - - assert(len > 0); - - BIGLITTLE(n -= len,n += len); - - /* Try using a compare to avoid the first divide */ - r = BIGLITTLE(*n++,*--n); - if (r >= d) - r %= d; - while (--len) - r = lbnMod21_16(r, BIGLITTLE(*n++,*--n), d); - - return r; -} -#elif defined(BNWORD32) && !BN_SLOW_DIVIDE_32 -unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d) -{ - BNWORD16 r; - - if (!--len) - return BIGLITTLE(n[-1],n[0]) % d; - - BIGLITTLE(n -= len,n += len); - r = BIGLITTLE(n[-1],n[0]); - - do { - r = (BNWORD16)((((BNWORD32)r<<16) | BIGLITTLE(*n++,*--n)) % d); - } while (--len); - - return r; -} -#elif 16 >= 0x20 -/* - * If the single word size can hold 65535*65536, then this function - * is avilable. - */ -#ifndef highhalf -#define highhalf(x) ( (x) >> 16/2 ) -#define lowhalf(x) ( (x) & ((1 << 16/2)-1) ) -#endif -unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d) -{ - BNWORD16 r, x; - - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - while (--len) { - x = BIGLITTLE(*n++,*--n); - r = (r%d << 16/2) | highhalf(x); - r = (r%d << 16/2) | lowhalf(x); - } - - return r%d; -} -#else -/* Default case - use lbnDiv21_16 */ -unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d) -{ - unsigned i, shift; - BNWORD16 r; - BNWORD16 q; - - assert(len > 0); - - shift = 0; - r = d; - i = 16; - while (i /= 2) { - if (r >> i) - r >>= i; - else - shift += i; - } - assert(d >> (16-1-shift) == 1); - d <<= shift; - - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - if (r >= d) - r %= d; - - while (--len) - r = lbnDiv21_16(&q, r, BIGLITTLE(*n++,*--n), d); - - /* - * Final correction for shift - shift the quotient up "shift" - * bits, and merge in the extra bits of quotient. Then reduce - * the final remainder mod the real d. - */ - if (shift) - r %= d >> shift; - - return r; -} -#endif -#endif /* lbnModQ_16 */ - -/* - * Reduce n mod d and return the quotient. That is, find: - * q = n / d; - * n = n % d; - * d is altered during the execution of this subroutine by normalizing it. - * It must already have its most significant word non-zero; it is shifted - * so its most significant bit is non-zero. - * - * The quotient q is nlen-dlen+1 words long. To make it possible to - * overlap the quptient with the input (you can store it in the high dlen - * words), the high word of the quotient is *not* stored, but is returned. - * (If all you want is the remainder, you don't care about it, anyway.) - * - * This uses algorithm D from Knuth (4.3.1), except that we do binary - * (shift) normalization of the divisor. WARNING: This is hairy! - * - * This function is used for some modular reduction, but it is not used in - * the modular exponentiation loops; they use Montgomery form and the - * corresponding, more efficient, Montgomery reduction. This code - * is needed for the conversion to Montgomery form, however, so it - * has to be here and it might as well be reasonably efficient. - * - * The overall operation is as follows ("top" and "up" refer to the - * most significant end of the number; "bottom" and "down", the least): - * - * - Shift the divisor up until the most significant bit is set. - * - Shift the dividend up the same amount. This will produce the - * correct quotient, and the remainder can be recovered by shifting - * it back down the same number of bits. This may produce an overflow - * word, but the word is always strictly less than the most significant - * divisor word. - * - Estimate the first quotient digit qhat: - * - First take the top two words (one of which is the overflow) of the - * dividend and divide by the top word of the divisor: - * qhat = (nh,nm)/dh. This qhat is >= the correct quotient digit - * and, since dh is normalized, it is at most two over. - * - Second, correct by comparing the top three words. If - * (dh,dl) * qhat > (nh,nm,ml), decrease qhat and try again. - * The second iteration can be simpler because there can't be a third. - * The computation can be simplified by subtracting dh*qhat from - * both sides, suitably shifted. This reduces the left side to - * dl*qhat. On the right, (nh,nm)-dh*qhat is simply the - * remainder r from (nh,nm)%dh, so the right is (r,nl). - * This produces qhat that is almost always correct and at - * most (prob ~ 2/2^16) one too high. - * - Subtract qhat times the divisor (suitably shifted) from the dividend. - * If there is a borrow, qhat was wrong, so decrement it - * and add the divisor back in (once). - * - Store the final quotient digit qhat in the quotient array q. - * - * Repeat the quotient digit computation for successive digits of the - * quotient until the whole quotient has been computed. Then shift the - * divisor and the remainder down to correct for the normalization. - * - * TODO: Special case 2-word divisors. - * TODO: Use reciprocals rather than dividing. - */ -#ifndef divn_16 -BNWORD16 -lbnDiv_16(BNWORD16 *q, BNWORD16 *n, unsigned nlen, BNWORD16 *d, unsigned dlen) -{ - BNWORD16 nh,nm,nl; /* Top three words of the dividend */ - BNWORD16 dh,dl; /* Top two words of the divisor */ - BNWORD16 qhat; /* Extimate of quotient word */ - BNWORD16 r; /* Remainder from quotient estimate division */ - BNWORD16 qhigh; /* High word of quotient */ - unsigned i; /* Temp */ - unsigned shift; /* Bits shifted by normalization */ - unsigned qlen = nlen-dlen; /* Size of quotient (less 1) */ -#ifdef mul16_ppmm - BNWORD16 t16; -#elif defined(BNWORD32) - BNWORD32 t32; -#else /* use lbnMulN1_16 */ - BNWORD16 t2[2]; -#define t2high BIGLITTLE(t2[0],t2[1]) -#define t2low BIGLITTLE(t2[1],t2[0]) -#endif - - assert(dlen); - assert(nlen >= dlen); - - /* - * Special cases for short divisors. The general case uses the - * top top 2 digits of the divisor (d) to estimate a quotient digit, - * so it breaks if there are fewer digits available. Thus, we need - * special cases for a divisor of length 1. A divisor of length - * 2 can have a *lot* of administrivia overhead removed removed, - * so it's probably worth special-casing that case, too. - */ - if (dlen == 1) - return lbnDiv1_16(q, BIGLITTLE(n-1,n), n, nlen, - BIGLITTLE(d[-1],d[0])); - -#if 0 - /* - * @@@ This is not yet written... The general loop will do, - * albeit less efficiently - */ - if (dlen == 2) { - /* - * divisor two digits long: - * use the 3/2 technique from Knuth, but we know - * it's exact. - */ - dh = BIGLITTLE(d[-1],d[0]); - dl = BIGLITTLE(d[-2],d[1]); - shift = 0; - if ((sh & ((BNWORD16)1 << 16-1-shift)) == 0) { - do { - shift++; - } while (dh & (BNWORD16)1<<16-1-shift) == 0); - dh = dh << shift | dl >> (16-shift); - dl <<= shift; - - - } - - - for (shift = 0; (dh & (BNWORD16)1 << 16-1-shift)) == 0; shift++) - ; - if (shift) { - } - dh = dh << shift | dl >> (16-shift); - shift = 0; - while (dh - } -#endif - - dh = BIGLITTLE(*(d-dlen),*(d+(dlen-1))); - assert(dh); - - /* Normalize the divisor */ - shift = 0; - r = dh; - i = 16/2; - do { - if (r >> i) - r >>= i; - else - shift += i; - } while ((i /= 2) != 0); - - nh = 0; - if (shift) { - lbnLshift_16(d, dlen, shift); - dh = BIGLITTLE(*(d-dlen),*(d+(dlen-1))); - nh = lbnLshift_16(n, nlen, shift); - } - - /* Assert that dh is now normalized */ - assert(dh >> (16-1)); - - /* Also get the second-most significant word of the divisor */ - dl = BIGLITTLE(*(d-(dlen-1)),*(d+(dlen-2))); - - /* - * Adjust pointers: n to point to least significant end of first - * first subtract, and q to one the most-significant end of the - * quotient array. - */ - BIGLITTLE(n -= qlen,n += qlen); - BIGLITTLE(q -= qlen,q += qlen); - - /* Fetch the most significant stored word of the dividend */ - nm = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - - /* - * Compute the first digit of the quotient, based on the - * first two words of the dividend (the most significant of which - * is the overflow word h). - */ - if (nh) { - assert(nh < dh); - r = lbnDiv21_16(&qhat, nh, nm, dh); - } else if (nm >= dh) { - qhat = nm/dh; - r = nm % dh; - } else { /* Quotient is zero */ - qhigh = 0; - goto divloop; - } - - /* Now get the third most significant word of the dividend */ - nl = BIGLITTLE(*(n-(dlen-1)),*(n+(dlen-2))); - - /* - * Correct qhat, the estimate of quotient digit. - * qhat can only be high, and at most two words high, - * so the loop can be unrolled and abbreviated. - */ -#ifdef mul16_ppmm - mul16_ppmm(nm, t16, qhat, dl); - if (nm > r || (nm == r && t16 > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - nm -= (t16 < dl); - t16 -= dl; - if (nm > r || (nm == r && t16 > nl)) - qhat--; - } - } -#elif defined(BNWORD32) - t32 = (BNWORD32)qhat * dl; - if (t32 > ((BNWORD32)r << 16) + nl) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) > dh) { - t32 -= dl; - if (t32 > ((BNWORD32)r << 16) + nl) - qhat--; - } - } -#else /* Use lbnMulN1_16 */ - lbnMulN1_16(BIGLITTLE(t2+2,t2), &dl, 1, qhat); - if (t2high > r || (t2high == r && t2low > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t2high -= (t2low < dl); - t2low -= dl; - if (t2high > r || (t2high == r && t2low > nl)) - qhat--; - } - } -#endif - - /* Do the multiply and subtract */ - r = lbnMulSub1_16(n, d, dlen, qhat); - /* If there was a borrow, add back once. */ - if (r > nh) { /* Borrow? */ - (void)lbnAddN_16(n, d, dlen); - qhat--; - } - - /* Remember the first quotient digit. */ - qhigh = qhat; - - /* Now, the main division loop: */ -divloop: - while (qlen--) { - - /* Advance n */ - nh = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - BIGLITTLE(++n,--n); - nm = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - - if (nh == dh) { - qhat = ~(BNWORD16)0; - /* Optimized computation of r = (nh,nm) - qhat * dh */ - r = nh + nm; - if (r < nh) - goto subtract; - } else { - assert(nh < dh); - r = lbnDiv21_16(&qhat, nh, nm, dh); - } - - nl = BIGLITTLE(*(n-(dlen-1)),*(n+(dlen-2))); -#ifdef mul16_ppmm - mul16_ppmm(nm, t16, qhat, dl); - if (nm > r || (nm == r && t16 > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - nm -= (t16 < dl); - t16 -= dl; - if (nm > r || (nm == r && t16 > nl)) - qhat--; - } - } -#elif defined(BNWORD32) - t32 = (BNWORD32)qhat * dl; - if (t32 > ((BNWORD32)r<<16) + nl) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t32 -= dl; - if (t32 > ((BNWORD32)r << 16) + nl) - qhat--; - } - } -#else /* Use lbnMulN1_16 */ - lbnMulN1_16(BIGLITTLE(t2+2,t2), &dl, 1, qhat); - if (t2high > r || (t2high == r && t2low > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t2high -= (t2low < dl); - t2low -= dl; - if (t2high > r || (t2high == r && t2low > nl)) - qhat--; - } - } -#endif - - /* - * As a point of interest, note that it is not worth checking - * for qhat of 0 or 1 and installing special-case code. These - * occur with probability 2^-16, so spending 1 cycle to check - * for them is only worth it if we save more than 2^15 cycles, - * and a multiply-and-subtract for numbers in the 1024-bit - * range just doesn't take that long. - */ -subtract: - /* - * n points to the least significant end of the substring - * of n to be subtracted from. qhat is either exact or - * one too large. If the subtract gets a borrow, it was - * one too large and the divisor is added back in. It's - * a dlen+1 word add which is guaranteed to produce a - * carry out, so it can be done very simply. - */ - r = lbnMulSub1_16(n, d, dlen, qhat); - if (r > nh) { /* Borrow? */ - (void)lbnAddN_16(n, d, dlen); - qhat--; - } - /* Store the quotient digit */ - BIGLITTLE(*q++,*--q) = qhat; - } - /* Tah dah! */ - - if (shift) { - lbnRshift_16(d, dlen, shift); - lbnRshift_16(n, dlen, shift); - } - - return qhigh; -} -#endif - -/* - * Find the negative multiplicative inverse of x (x must be odd!) modulo 2^16. - * - * This just performs Newton's iteration until it gets the - * inverse. The initial estimate is always correct to 3 bits, and - * sometimes 4. The number of valid bits doubles each iteration. - * (To prove it, assume x * y == 1 (mod 2^n), and introduce a variable - * for the error mod 2^2n. x * y == 1 + k*2^n (mod 2^2n) and follow - * the iteration through.) - */ -#ifndef lbnMontInv1_16 -BNWORD16 -lbnMontInv1_16(BNWORD16 const x) -{ - BNWORD16 y = x, z; - - assert(x & 1); - - while ((z = x*y) != 1) - y *= 2 - z; - return -y; -} -#endif /* !lbnMontInv1_16 */ - -#if defined(BNWORD32) && PRODUCT_SCAN -/* - * Test code for product-scanning Montgomery reduction. - * This seems to slow the C code down rather than speed it up. - * - * The first loop computes the Montgomery multipliers, storing them over - * the low half of the number n. - * - * The second half multiplies the upper half, adding in the modulus - * times the Montgomery multipliers. The results of this multiply - * are stored. - */ -void -lbnMontReduce_16(BNWORD16 *n, BNWORD16 const *mod, unsigned mlen, BNWORD16 inv) -{ - BNWORD32 x, y; - BNWORD16 const *pm; - BNWORD16 *pn; - BNWORD16 t; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!mlen) - return; - - /* Pass 1 - compute Montgomery multipliers */ - /* First iteration can have certain simplifications. */ - t = BIGLITTLE(n[-1],n[0]); - x = t; - t *= inv; - BIGLITTLE(n[-1], n[0]) = t; - x += (BNWORD32)t * BIGLITTLE(mod[-1],mod[0]); /* Can't overflow */ - assert((BNWORD16)x == 0); - x = x >> 16; - - for (i = 1; i < mlen; i++) { - carry = 0; - pn = n; - pm = BIGLITTLE(mod-i-1,mod+i+1); - for (j = 0; j < i; j++) { - y = (BNWORD32)BIGLITTLE(*--pn * *pm++, *pn++ * *--pm); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pn == n-i, pn == n+i)); - y = t = BIGLITTLE(pn[-1], pn[0]); - x += y; - carry += (x < y); - BIGLITTLE(pn[-1], pn[0]) = t = inv * (BNWORD16)x; - assert(BIGLITTLE(pm == mod-1, pm == mod+1)); - y = (BNWORD32)t * BIGLITTLE(pm[0],pm[-1]); - x += y; - carry += (x < y); - assert((BNWORD16)x == 0); - x = x >> 16 | (BNWORD32)carry << 16; - } - - BIGLITTLE(n -= mlen, n += mlen); - - /* Pass 2 - compute upper words and add to n */ - for (i = 1; i < mlen; i++) { - carry = 0; - pm = BIGLITTLE(mod-i,mod+i); - pn = n; - for (j = i; j < mlen; j++) { - y = (BNWORD32)BIGLITTLE(*--pm * *pn++, *pm++ * *--pn); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pm == mod-mlen, pm == mod+mlen)); - assert(BIGLITTLE(pn == n+mlen-i, pn == n-mlen+i)); - y = t = BIGLITTLE(*(n-i),*(n+i-1)); - x += y; - carry += (x < y); - BIGLITTLE(*(n-i),*(n+i-1)) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - - /* Last round of second half, simplified. */ - t = BIGLITTLE(*(n-mlen),*(n+mlen-1)); - x += t; - BIGLITTLE(*(n-mlen),*(n+mlen-1)) = (BNWORD16)x; - carry = (unsigned)(x >> 16); - - while (carry) - carry -= lbnSubN_16(n, mod, mlen); - while (lbnCmp_16(n, mod, mlen) >= 0) - (void)lbnSubN_16(n, mod, mlen); -} -#define lbnMontReduce_16 lbnMontReduce_16 -#endif - -/* - * Montgomery reduce n, modulo mod. This reduces modulo mod and divides by - * 2^(16*mlen). Returns the result in the *top* mlen words of the argument n. - * This is ready for another multiplication using lbnMul_16. - * - * Montgomery representation is a very useful way to encode numbers when - * you're doing lots of modular reduction. What you do is pick a multiplier - * R which is relatively prime to the modulus and very easy to divide by. - * Since the modulus is odd, R is closen as a power of 2, so the division - * is a shift. In fact, it's a shift of an integral number of words, - * so the shift can be implicit - just drop the low-order words. - * - * Now, choose R *larger* than the modulus m, 2^(16*mlen). Then convert - * all numbers a, b, etc. to Montgomery form M(a), M(b), etc using the - * relationship M(a) = a*R mod m, M(b) = b*R mod m, etc. Note that: - * - The Montgomery form of a number depends on the modulus m. - * A fixed modulus m is assumed throughout this discussion. - * - Since R is relaitvely prime to m, multiplication by R is invertible; - * no information about the numbers is lost, they're just scrambled. - * - Adding (and subtracting) numbers in this form works just as usual. - * M(a+b) = (a+b)*R mod m = (a*R + b*R) mod m = (M(a) + M(b)) mod m - * - Multiplying numbers in this form produces a*b*R*R. The problem - * is to divide out the excess factor of R, modulo m as well as to - * reduce to the given length mlen. It turns out that this can be - * done *faster* than a normal divide, which is where the speedup - * in Montgomery division comes from. - * - * Normal reduction chooses a most-significant quotient digit q and then - * subtracts q*m from the number to be reduced. Choosing q is tricky - * and involved (just look at lbnDiv_16 to see!) and is usually - * imperfect, requiring a check for correction after the subtraction. - * - * Montgomery reduction *adds* a multiple of m to the *low-order* part - * of the number to be reduced. This multiple is chosen to make the - * low-order part of the number come out to zero. This can be done - * with no trickery or error using a precomputed inverse of the modulus. - * In this code, the "part" is one word, but any width can be used. - * - * Repeating this step sufficiently often results in a value which - * is a multiple of R (a power of two, remember) but is still (since - * the additions were to the low-order part and thus did not increase - * the value of the number being reduced very much) still not much - * larger than m*R. Then implicitly divide by R and subtract off - * m until the result is in the correct range. - * - * Since the low-order part being cancelled is less than R, the - * multiple of m added must have a multiplier which is at most R-1. - * Assuming that the input is at most m*R-1, the final number is - * at most m*(2*R-1)-1 = 2*m*R - m - 1, so subtracting m once from - * the high-order part, equivalent to subtracting m*R from the - * while number, produces a result which is at most m*R - m - 1, - * which divided by R is at most m-1. - * - * To convert *to* Montgomery form, you need a regular remainder - * routine, although you can just compute R*R (mod m) and do the - * conversion using Montgomery multiplication. To convert *from* - * Montgomery form, just Montgomery reduce the number to - * remove the extra factor of R. - * - * TODO: Change to a full inverse and use Karatsuba's multiplication - * rather than this word-at-a-time. - */ -#ifndef lbnMontReduce_16 -void -lbnMontReduce_16(BNWORD16 *n, BNWORD16 const *mod, unsigned const mlen, - BNWORD16 inv) -{ - BNWORD16 t; - BNWORD16 c = 0; - unsigned len = mlen; - - /* inv must be the negative inverse of mod's least significant word */ - assert((BNWORD16)(inv * BIGLITTLE(mod[-1],mod[0])) == (BNWORD16)-1); - - assert(len); - - do { - t = lbnMulAdd1_16(n, mod, mlen, inv * BIGLITTLE(n[-1],n[0])); - c += lbnAdd1_16(BIGLITTLE(n-mlen,n+mlen), len, t); - BIGLITTLE(--n,++n); - } while (--len); - - /* - * All that adding can cause an overflow past the modulus size, - * but it's unusual, and never by much, so a subtraction loop - * is the right way to deal with it. - * This subtraction happens infrequently - I've only ever seen it - * invoked once per reduction, and then just under 22.5% of the time. - */ - while (c) - c -= lbnSubN_16(n, mod, mlen); - while (lbnCmp_16(n, mod, mlen) >= 0) - (void)lbnSubN_16(n, mod, mlen); -} -#endif /* !lbnMontReduce_16 */ - -/* - * A couple of helpers that you might want to implement atomically - * in asm sometime. - */ -#ifndef lbnMontMul_16 -/* - * Multiply "num1" by "num2", modulo "mod", all of length "len", and - * place the result in the high half of "prod". "inv" is the inverse - * of the least-significant word of the modulus, modulo 2^16. - * This uses numbers in Montgomery form. Reduce using "len" and "inv". - * - * This is implemented as a macro to win on compilers that don't do - * inlining, since it's so trivial. - */ -#define lbnMontMul_16(prod, n1, n2, mod, len, inv) \ - (lbnMulX_16(prod, n1, n2, len), lbnMontReduce_16(prod, mod, len, inv)) -#endif /* !lbnMontMul_16 */ - -#ifndef lbnMontSquare_16 -/* - * Square "n", modulo "mod", both of length "len", and place the result - * in the high half of "prod". "inv" is the inverse of the least-significant - * word of the modulus, modulo 2^16. - * This uses numbers in Montgomery form. Reduce using "len" and "inv". - * - * This is implemented as a macro to win on compilers that don't do - * inlining, since it's so trivial. - */ -#define lbnMontSquare_16(prod, n, mod, len, inv) \ - (lbnSquare_16(prod, n, len), lbnMontReduce_16(prod, mod, len, inv)) - -#endif /* !lbnMontSquare_16 */ - -/* - * Convert a number to Montgomery form - requires mlen + nlen words - * of memory in "n". - */ -void -lbnToMont_16(BNWORD16 *n, unsigned nlen, BNWORD16 *mod, unsigned mlen) -{ - /* Move n up "mlen" words */ - lbnCopy_16(BIGLITTLE(n-mlen,n+mlen), n, nlen); - lbnZero_16(n, mlen); - /* Do the division - dump the quotient in the high-order words */ - (void)lbnDiv_16(BIGLITTLE(n-mlen,n+mlen), n, mlen+nlen, mod, mlen); -} - -/* - * Convert from Montgomery form. Montgomery reduction is all that is - * needed. - */ -void -lbnFromMont_16(BNWORD16 *n, BNWORD16 *mod, unsigned len) -{ - /* Zero the high words of n */ - lbnZero_16(BIGLITTLE(n-len,n+len), len); - lbnMontReduce_16(n, mod, len, lbnMontInv1_16(mod[BIGLITTLE(-1,0)])); - /* Move n down len words */ - lbnCopy_16(n, BIGLITTLE(n-len,n+len), len); -} - -/* - * The windowed exponentiation algorithm, precomputes a table of odd - * powers of n up to 2^k. See the comment in bnExpMod_16 below for - * an explanation of how it actually works works. - * - * It takes 2^(k-1)-1 multiplies to compute the table, and (e-1)/(k+1) - * multiplies (on average) to perform the exponentiation. To minimize - * the sum, k must vary with e. The optimal window sizes vary with the - * exponent length. Here are some selected values and the boundary cases. - * (An underscore _ has been inserted into some of the numbers to ensure - * that magic strings like 16 do not appear in this table. It should be - * ignored.) - * - * At e = 1 bits, k=1 (0.000000) is best - * At e = 2 bits, k=1 (0.500000) is best - * At e = 4 bits, k=1 (1.500000) is best - * At e = 8 bits, k=2 (3.333333) < k=1 (3.500000) - * At e = 1_6 bits, k=2 (6.000000) is best - * At e = 26 bits, k=3 (9.250000) < k=2 (9.333333) - * At e = 3_2 bits, k=3 (10.750000) is best - * At e = 6_4 bits, k=3 (18.750000) is best - * At e = 82 bits, k=4 (23.200000) < k=3 (23.250000) - * At e = 128 bits, k=4 (3_2.400000) is best - * At e = 242 bits, k=5 (55.1_66667) < k=4 (55.200000) - * At e = 256 bits, k=5 (57.500000) is best - * At e = 512 bits, k=5 (100.1_66667) is best - * At e = 674 bits, k=6 (127.142857) < k=5 (127.1_66667) - * At e = 1024 bits, k=6 (177.142857) is best - * At e = 1794 bits, k=7 (287.125000) < k=6 (287.142857) - * At e = 2048 bits, k=7 (318.875000) is best - * At e = 4096 bits, k=7 (574.875000) is best - * - * The numbers in parentheses are the expected number of multiplications - * needed to do the computation. The normal russian-peasant modular - * exponentiation technique always uses (e-1)/2. For exponents as - * small as 192 bits (below the range of current factoring algorithms), - * half of the multiplies are eliminated, 45.2 as opposed to the naive - * 95.5. Counting the 191 squarings as 3/4 a multiply each (squaring - * proper is just over half of multiplying, but the Montgomery - * reduction in each case is also a multiply), that's 143.25 - * multiplies, for totals of 188.45 vs. 238.75 - a 21% savings. - * For larger exponents (like 512 bits), it's 483.92 vs. 639.25, a - * 24.3% savings. It asymptotically approaches 25%. - * - * Um, actually there's a slightly more accurate way to count, which - * really is the average number of multiplies required, averaged - * uniformly over all 2^(e-1) e-bit numbers, from 2^(e-1) to (2^e)-1. - * It's based on the recurrence that for the last b bits, b <= k, at - * most one multiply is needed (and none at all 1/2^b of the time), - * while when b > k, the odds are 1/2 each way that the bit will be - * 0 (meaning no multiplies to reduce it to the b-1-bit case) and - * 1/2 that the bit will be 1, starting a k-bit window and requiring - * 1 multiply beyond the b-k-bit case. Since the most significant - * bit is always 1, a k-bit window always starts there, and that - * multiply is by 1, so it isn't a multiply at all. Thus, the - * number of multiplies is simply that needed for the last e-k bits. - * This recurrence produces: - * - * At e = 1 bits, k=1 (0.000000) is best - * At e = 2 bits, k=1 (0.500000) is best - * At e = 4 bits, k=1 (1.500000) is best - * At e = 6 bits, k=2 (2.437500) < k=1 (2.500000) - * At e = 8 bits, k=2 (3.109375) is best - * At e = 1_6 bits, k=2 (5.777771) is best - * At e = 24 bits, k=3 (8.437629) < k=2 (8.444444) - * At e = 3_2 bits, k=3 (10.437492) is best - * At e = 6_4 bits, k=3 (18.437500) is best - * At e = 81 bits, k=4 (22.6_40000) < k=3 (22.687500) - * At e = 128 bits, k=4 (3_2.040000) is best - * At e = 241 bits, k=5 (54.611111) < k=4 (54.6_40000) - * At e = 256 bits, k=5 (57.111111) is best - * At e = 512 bits, k=5 (99.777778) is best - * At e = 673 bits, k=6 (126.591837) < k=5 (126.611111) - * At e = 1024 bits, k=6 (176.734694) is best - * At e = 1793 bits, k=7 (286.578125) < k=6 (286.591837) - * At e = 2048 bits, k=7 (318.453125) is best - * At e = 4096 bits, k=7 (574.453125) is best - * - * This has the rollover points at 6, 24, 81, 241, 673 and 1793 instead - * of 8, 26, 82, 242, 674, and 1794. Not a very big difference. - * (The numbers past that are k=8 at 4609 and k=9 at 11521, - * vs. one more in each case for the approximation.) - * - * Given that exponents for which k>7 are useful are uncommon, - * a fixed size table for k <= 7 is used for simplicity. - * - * The basic number of squarings needed is e-1, although a k-bit - * window (for k > 1) can save, on average, k-2 of those, too. - * That savings currently isn't counted here. It would drive the - * crossover points slightly lower. - * (Actually, this win is also reduced in the DoubleExpMod case, - * meaning we'd have to split the tables. Except for that, the - * multiplies by powers of the two bases are independent, so - * the same logic applies to each as the single case.) - * - * Table entry i is the largest number of bits in an exponent to - * process with a window size of i+1. Entry 6 is the largest - * possible unsigned number, so the window will never be more - * than 7 bits, requiring 2^6 = 0x40 slots. - */ -#define BNEXPMOD_MAX_WINDOW 7 -static unsigned const bnExpModThreshTable[BNEXPMOD_MAX_WINDOW] = { - 5, 23, 80, 240, 672, 1792, (unsigned)-1 -/* 7, 25, 81, 241, 673, 1793, (unsigned)-1 ### The old approximations */ -}; - -/* - * Perform modular exponentiation, as fast as possible! This uses - * Montgomery reduction, optimized squaring, and windowed exponentiation. - * The modulus "mod" MUST be odd! - * - * This returns 0 on success, -1 on out of memory. - * - * The window algorithm: - * The idea is to keep a running product of b1 = n^(high-order bits of exp), - * and then keep appending exponent bits to it. The following patterns - * apply to a 3-bit window (k = 3): - * To append 0: square - * To append 1: square, multiply by n^1 - * To append 10: square, multiply by n^1, square - * To append 11: square, square, multiply by n^3 - * To append 100: square, multiply by n^1, square, square - * To append 101: square, square, square, multiply by n^5 - * To append 110: square, square, multiply by n^3, square - * To append 111: square, square, square, multiply by n^7 - * - * Since each pattern involves only one multiply, the longer the pattern - * the better, except that a 0 (no multiplies) can be appended directly. - * We precompute a table of odd powers of n, up to 2^k, and can then - * multiply k bits of exponent at a time. Actually, assuming random - * exponents, there is on average one zero bit between needs to - * multiply (1/2 of the time there's none, 1/4 of the time there's 1, - * 1/8 of the time, there's 2, 1/16 of the time, there's 3, etc.), so - * you have to do one multiply per k+1 bits of exponent. - * - * The loop walks down the exponent, squaring the result buffer as - * it goes. There is a wbits+1 bit lookahead buffer, buf, that is - * filled with the upcoming exponent bits. (What is read after the - * end of the exponent is unimportant, but it is filled with zero here.) - * When the most-significant bit of this buffer becomes set, i.e. - * (buf & tblmask) != 0, we have to decide what pattern to multiply - * by, and when to do it. We decide, remember to do it in future - * after a suitable number of squarings have passed (e.g. a pattern - * of "100" in the buffer requires that we multiply by n^1 immediately; - * a pattern of "110" calls for multiplying by n^3 after one more - * squaring), clear the buffer, and continue. - * - * When we start, there is one more optimization: the result buffer - * is implcitly one, so squaring it or multiplying by it can be - * optimized away. Further, if we start with a pattern like "100" - * in the lookahead window, rather than placing n into the buffer - * and then starting to square it, we have already computed n^2 - * to compute the odd-powers table, so we can place that into - * the buffer and save a squaring. - * - * This means that if you have a k-bit window, to compute n^z, - * where z is the high k bits of the exponent, 1/2 of the time - * it requires no squarings. 1/4 of the time, it requires 1 - * squaring, ... 1/2^(k-1) of the time, it reqires k-2 squarings. - * And the remaining 1/2^(k-1) of the time, the top k bits are a - * 1 followed by k-1 0 bits, so it again only requires k-2 - * squarings, not k-1. The average of these is 1. Add that - * to the one squaring we have to do to compute the table, - * and you'll see that a k-bit window saves k-2 squarings - * as well as reducing the multiplies. (It actually doesn't - * hurt in the case k = 1, either.) - * - * n must have mlen words allocated. Although fewer may be in use - * when n is passed in, all are in use on exit. - */ -int -lbnExpMod_16(BNWORD16 *result, BNWORD16 const *n, unsigned nlen, - BNWORD16 const *e, unsigned elen, BNWORD16 *mod, unsigned mlen) -{ - BNWORD16 *table[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n */ - unsigned ebits; /* Exponent bits */ - unsigned wbits; /* Window size */ - unsigned tblmask; /* Mask of exponentiation window */ - BNWORD16 bitpos; /* Mask of current look-ahead bit */ - unsigned buf; /* Buffer of exponent bits */ - unsigned multpos; /* Where to do pending multiply */ - BNWORD16 const *mult; /* What to multiply by */ - unsigned i; /* Loop counter */ - int isone; /* Flag: accum. is implicitly one */ - BNWORD16 *a, *b; /* Working buffers/accumulators */ - BNWORD16 *t; /* Pointer into the working buffers */ - BNWORD16 inv; /* mod^-1 modulo 2^16 */ - int y; /* bnYield() result */ - - assert(mlen); - assert(nlen <= mlen); - - /* First, a couple of trivial cases. */ - elen = lbnNorm_16(e, elen); - if (!elen) { - /* x ^ 0 == 1 */ - lbnZero_16(result, mlen); - BIGLITTLE(result[-1],result[0]) = 1; - return 0; - } - ebits = lbnBits_16(e, elen); - if (ebits == 1) { - /* x ^ 1 == x */ - if (n != result) - lbnCopy_16(result, n, nlen); - if (mlen > nlen) - lbnZero_16(BIGLITTLE(result-nlen,result+nlen), - mlen-nlen); - return 0; - } - - /* Okay, now move the exponent pointer to the most-significant word */ - e = BIGLITTLE(e-elen, e+elen-1); - - /* Look up appropriate k-1 for the exponent - tblmask = 1<<(k-1) */ - wbits = 0; - while (ebits > bnExpModThreshTable[wbits]) - wbits++; - - /* Allocate working storage: two product buffers and the tables. */ - LBNALLOC(a, BNWORD16, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD16, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert to the appropriate table size: tblmask = 1<<(k-1) */ - tblmask = 1u << wbits; - - /* We have the result buffer available, so use it. */ - table[0] = result; - - /* - * Okay, we now have a minimal-sized table - expand it. - * This is allowed to fail! If so, scale back the table size - * and proceed. - */ - for (i = 1; i < tblmask; i++) { - LBNALLOC(t, BNWORD16, mlen); - if (!t) /* Out of memory! Quit the loop. */ - break; - table[i] = t; - } - - /* If we stopped, with i < tblmask, shrink the tables appropriately */ - while (tblmask > i) { - wbits--; - tblmask >>= 1; - } - /* Free up our overallocations */ - while (--i > tblmask) - LBNFREE(table[i], mlen); - - /* Okay, fill in the table */ - - /* Compute the necessary modular inverse */ - inv = lbnMontInv1_16(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - /* Convert n to Montgomery form */ - - /* Move n up "mlen" words into a */ - t = BIGLITTLE(a-mlen, a+mlen); - lbnCopy_16(t, n, nlen); - lbnZero_16(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_16(t, a, mlen+nlen, mod, mlen); - /* Copy into first table entry */ - lbnCopy_16(table[0], a, mlen); - - /* Square a into b */ - lbnMontSquare_16(b, a, mod, mlen, inv); - - /* Use high half of b to initialize the table */ - t = BIGLITTLE(b-mlen, b+mlen); - for (i = 1; i < tblmask; i++) { - lbnMontMul_16(a, t, table[i-1], mod, mlen, inv); - lbnCopy_16(table[i], BIGLITTLE(a-mlen, a+mlen), mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* We might use b = n^2 later... */ - - /* Initialze the fetch pointer */ - bitpos = (BNWORD16)1 << ((ebits-1) & (16-1)); /* Initialize mask */ - - /* This should point to the msbit of e */ - assert((*e & bitpos) != 0); - - /* - * Pre-load the window. Becuase the window size is - * never larger than the exponent size, there is no need to - * detect running off the end of e in here. - * - * The read-ahead is controlled by elen and the bitpos mask. - * Note that this is *ahead* of ebits, which tracks the - * most significant end of the window. The purpose of this - * initialization is to get the two wbits+1 bits apart, - * like they should be. - * - * Note that bitpos and e1len together keep track of the - * lookahead read pointer in the exponent that is used here. - */ - buf = 0; - for (i = 0; i <= wbits; i++) { - buf = (buf << 1) | ((*e & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e++,e--); - bitpos = (BNWORD16)1 << (16-1); - elen--; - } - } - assert(buf & tblmask); - - /* - * Set the pending multiply positions to a location that will - * never be encountered, thus ensuring that nothing will happen - * until the need for a multiply appears and one is scheduled. - */ - multpos = ebits; /* A NULL value */ - mult = 0; /* Force a crash if we use these */ - - /* - * Okay, now begins the real work. The first step is - * slightly magic, so it's done outside the main loop, - * but it's very similar to what's inside. - */ - ebits--; /* Start processing the first bit... */ - isone = 1; - - /* - * This is just like the multiply in the loop, except that - * - We know the msbit of buf is set, and - * - We have the extra value n^2 floating around. - * So, do the usual computation, and if the result is that - * the buffer should be multiplied by n^1 immediately - * (which we'd normally then square), we multiply it - * (which reduces to a copy, which reduces to setting a flag) - * by n^2 and skip the squaring. Thus, we do the - * multiply and the squaring in one step. - */ - assert(buf & tblmask); - multpos = ebits - wbits; - while ((buf & 1) == 0) { - buf >>= 1; - multpos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(multpos <= ebits); - mult = table[buf>>1]; - buf = 0; - - /* Special case: use already-computed value sitting in buffer */ - if (multpos == ebits) - isone = 0; - - /* - * At this point, the buffer (which is the high half of b) holds - * either 1 (implicitly, as the "isone" flag is set), or n^2. - */ - - /* - * The main loop. The procedure is: - * - Advance the window - * - If the most-significant bit of the window is set, - * schedule a multiply for the appropriate time in the - * future (may be immediately) - * - Perform any pending multiples - * - Check for termination - * - Square the buffer - * - * At any given time, the acumulated product is held in - * the high half of b. - */ - for (;;) { - ebits--; - - /* Advance the window */ - assert(buf < tblmask); - buf <<= 1; - /* - * This reads ahead of the current exponent position - * (controlled by ebits), so we have to be able to read - * past the lsb of the exponents without error. - */ - if (elen) { - buf |= ((*e & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e++,e--); - bitpos = (BNWORD16)1 << (16-1); - elen--; - } - } - - /* Examine the window for pending multiplies */ - if (buf & tblmask) { - multpos = ebits - wbits; - while ((buf & 1) == 0) { - buf >>= 1; - multpos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(multpos <= ebits); - mult = table[buf>>1]; - buf = 0; - } - - /* If we have a pending multiply, do it */ - if (ebits == multpos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_16(t, mult, mlen); - isone = 0; - } else { - lbnMontMul_16(a, t, mult, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* Are we done? */ - if (!ebits) - break; - - /* Square the input */ - if (!isone) { - t = BIGLITTLE(b-mlen, b+mlen); - lbnMontSquare_16(a, t, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } /* for (;;) */ - - assert(!isone); - assert(!buf); - - /* DONE! */ - - /* Convert result out of Montgomery form */ - t = BIGLITTLE(b-mlen, b+mlen); - lbnCopy_16(b, t, mlen); - lbnZero_16(t, mlen); - lbnMontReduce_16(b, mod, mlen, inv); - lbnCopy_16(result, t, mlen); - /* - * Clean up - free intermediate storage. - * Do NOT free table[0], which is the result - * buffer. - */ - y = 0; -#if BNYIELD -yield: -#endif - while (--tblmask) - LBNFREE(table[tblmask], mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - -#if 0 -/* - * Compute and return n1^e1 * n2^e2 mod "mod". - * result may be either input buffer, or something separate. - * It must be "mlen" words long. - * - * There is a current position in the exponents, which is kept in e1bits. - * (The exponents are swapped if necessary so e1 is the longer of the two.) - * At any given time, the value in the accumulator is - * n1^(e1>>e1bits) * n2^(e2>>e1bits) mod "mod". - * As e1bits is counted down, this is updated, by squaring it and doing - * any necessary multiplies. - * To decide on the necessary multiplies, two windows, each w1bits+1 bits - * wide, are maintained in buf1 and buf2, which read *ahead* of the - * e1bits position (with appropriate handling of the case when e1bits - * drops below w1bits+1). When the most-significant bit of either window - * becomes set, indicating that something needs to be multiplied by - * the accumulator or it will get out of sync, the window is examined - * to see which power of n1 or n2 to multiply by, and when (possibly - * later, if the power is greater than 1) the multiply should take - * place. Then the multiply and its location are remembered and the - * window is cleared. - * - * If we had every power of n1 in the table, the multiply would always - * be w1bits steps in the future. But we only keep the odd powers, - * so instead of waiting w1bits squarings and then multiplying - * by n1^k, we wait w1bits-k squarings and multiply by n1. - * - * Actually, w2bits can be less than w1bits, but the window is the same - * size, to make it easier to keep track of where we're reading. The - * appropriate number of low-order bits of the window are just ignored. - */ -int -lbnDoubleExpMod_16(BNWORD16 *result, - BNWORD16 const *n1, unsigned n1len, - BNWORD16 const *e1, unsigned e1len, - BNWORD16 const *n2, unsigned n2len, - BNWORD16 const *e2, unsigned e2len, - BNWORD16 *mod, unsigned mlen) -{ - BNWORD16 *table1[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n1 */ - BNWORD16 *table2[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n2 */ - unsigned e1bits, e2bits; /* Exponent bits */ - unsigned w1bits, w2bits; /* Window sizes */ - unsigned tblmask; /* Mask of exponentiation window */ - BNWORD16 bitpos; /* Mask of current look-ahead bit */ - unsigned buf1, buf2; /* Buffer of exponent bits */ - unsigned mult1pos, mult2pos; /* Where to do pending multiply */ - BNWORD16 const *mult1, *mult2; /* What to multiply by */ - unsigned i; /* Loop counter */ - int isone; /* Flag: accum. is implicitly one */ - BNWORD16 *a, *b; /* Working buffers/accumulators */ - BNWORD16 *t; /* Pointer into the working buffers */ - BNWORD16 inv; /* mod^-1 modulo 2^16 */ - int y; /* bnYield() result */ - - assert(mlen); - assert(n1len <= mlen); - assert(n2len <= mlen); - - /* First, a couple of trivial cases. */ - e1len = lbnNorm_16(e1, e1len); - e2len = lbnNorm_16(e2, e2len); - - /* Ensure that the first exponent is the longer */ - e1bits = lbnBits_16(e1, e1len); - e2bits = lbnBits_16(e2, e2len); - if (e1bits < e2bits) { - i = e1len; e1len = e2len; e2len = i; - i = e1bits; e1bits = e2bits; e2bits = i; - t = (BNWORD16 *)n1; n1 = n2; n2 = t; - t = (BNWORD16 *)e1; e1 = e2; e2 = t; - } - assert(e1bits >= e2bits); - - /* Handle a trivial case */ - if (!e2len) - return lbnExpMod_16(result, n1, n1len, e1, e1len, mod, mlen); - assert(e2bits); - - /* The code below fucks up if the exponents aren't at least 2 bits */ - if (e1bits == 1) { - assert(e2bits == 1); - - LBNALLOC(a, BNWORD16, n1len+n2len); - if (!a) - return -1; - - lbnMul_16(a, n1, n1len, n2, n2len); - /* Do a direct modular reduction */ - if (n1len + n2len >= mlen) - (void)lbnDiv_16(a+mlen, a, n1len+n2len, mod, mlen); - lbnCopy_16(result, a, mlen); - LBNFREE(a, n1len+n2len); - return 0; - } - - /* Okay, now move the exponent pointers to the most-significant word */ - e1 = BIGLITTLE(e1-e1len, e1+e1len-1); - e2 = BIGLITTLE(e2-e2len, e2+e2len-1); - - /* Look up appropriate k-1 for the exponent - tblmask = 1<<(k-1) */ - w1bits = 0; - while (e1bits > bnExpModThreshTable[w1bits]) - w1bits++; - w2bits = 0; - while (e2bits > bnExpModThreshTable[w2bits]) - w2bits++; - - assert(w1bits >= w2bits); - - /* Allocate working storage: two product buffers and the tables. */ - LBNALLOC(a, BNWORD16, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD16, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert to the appropriate table size: tblmask = 1<<(k-1) */ - tblmask = 1u << w1bits; - /* Use buf2 for its size, temporarily */ - buf2 = 1u << w2bits; - - LBNALLOC(t, BNWORD16, mlen); - if (!t) { - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - return -1; - } - table1[0] = t; - table2[0] = result; - - /* - * Okay, we now have some minimal-sized tables - expand them. - * This is allowed to fail! If so, scale back the table sizes - * and proceed. We allocate both tables at the same time - * so if it fails partway through, they'll both be a reasonable - * size rather than one huge and one tiny. - * When i passes buf2 (the number of entries in the e2 window, - * which may be less than the number of entries in the e1 window), - * stop allocating e2 space. - */ - for (i = 1; i < tblmask; i++) { - LBNALLOC(t, BNWORD16, mlen); - if (!t) /* Out of memory! Quit the loop. */ - break; - table1[i] = t; - if (i < buf2) { - LBNALLOC(t, BNWORD16, mlen); - if (!t) { - LBNFREE(table1[i], mlen); - break; - } - table2[i] = t; - } - } - - /* If we stopped, with i < tblmask, shrink the tables appropriately */ - while (tblmask > i) { - w1bits--; - tblmask >>= 1; - } - /* Free up our overallocations */ - while (--i > tblmask) { - if (i < buf2) - LBNFREE(table2[i], mlen); - LBNFREE(table1[i], mlen); - } - /* And shrink the second window too, if needed */ - if (w2bits > w1bits) { - w2bits = w1bits; - buf2 = tblmask; - } - - /* - * From now on, use the w2bits variable for the difference - * between w1bits and w2bits. - */ - w2bits = w1bits-w2bits; - - /* Okay, fill in the tables */ - - /* Compute the necessary modular inverse */ - inv = lbnMontInv1_16(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - /* Convert n1 to Montgomery form */ - - /* Move n1 up "mlen" words into a */ - t = BIGLITTLE(a-mlen, a+mlen); - lbnCopy_16(t, n1, n1len); - lbnZero_16(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_16(t, a, mlen+n1len, mod, mlen); - /* Copy into first table entry */ - lbnCopy_16(table1[0], a, mlen); - - /* Square a into b */ - lbnMontSquare_16(b, a, mod, mlen, inv); - - /* Use high half of b to initialize the first table */ - t = BIGLITTLE(b-mlen, b+mlen); - for (i = 1; i < tblmask; i++) { - lbnMontMul_16(a, t, table1[i-1], mod, mlen, inv); - lbnCopy_16(table1[i], BIGLITTLE(a-mlen, a+mlen), mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* Convert n2 to Montgomery form */ - - t = BIGLITTLE(a-mlen, a+mlen); - /* Move n2 up "mlen" words into a */ - lbnCopy_16(t, n2, n2len); - lbnZero_16(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_16(t, a, mlen+n2len, mod, mlen); - /* Copy into first table entry */ - lbnCopy_16(table2[0], a, mlen); - - /* Square it into a */ - lbnMontSquare_16(a, table2[0], mod, mlen, inv); - /* Copy to b, low half */ - lbnCopy_16(b, t, mlen); - - /* Use b to initialize the second table */ - for (i = 1; i < buf2; i++) { - lbnMontMul_16(a, b, table2[i-1], mod, mlen, inv); - lbnCopy_16(table2[i], t, mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* - * Okay, a recap: at this point, the low part of b holds - * n2^2, the high part holds n1^2, and the tables are - * initialized with the odd powers of n1 and n2 from 1 - * through 2*tblmask-1 and 2*buf2-1. - * - * We might use those squares in b later, or we might not. - */ - - /* Initialze the fetch pointer */ - bitpos = (BNWORD16)1 << ((e1bits-1) & (16-1)); /* Initialize mask */ - - /* This should point to the msbit of e1 */ - assert((*e1 & bitpos) != 0); - - /* - * Pre-load the windows. Becuase the window size is - * never larger than the exponent size, there is no need to - * detect running off the end of e1 in here. - * - * The read-ahead is controlled by e1len and the bitpos mask. - * Note that this is *ahead* of e1bits, which tracks the - * most significant end of the window. The purpose of this - * initialization is to get the two w1bits+1 bits apart, - * like they should be. - * - * Note that bitpos and e1len together keep track of the - * lookahead read pointer in the exponent that is used here. - * e2len is not decremented, it is only ever compared with - * e1len as *that* is decremented. - */ - buf1 = buf2 = 0; - for (i = 0; i <= w1bits; i++) { - buf1 = (buf1 << 1) | ((*e1 & bitpos) != 0); - if (e1len <= e2len) - buf2 = (buf2 << 1) | ((*e2 & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e1++,e1--); - if (e1len <= e2len) - BIGLITTLE(e2++,e2--); - bitpos = (BNWORD16)1 << (16-1); - e1len--; - } - } - assert(buf1 & tblmask); - - /* - * Set the pending multiply positions to a location that will - * never be encountered, thus ensuring that nothing will happen - * until the need for a multiply appears and one is scheduled. - */ - mult1pos = mult2pos = e1bits; /* A NULL value */ - mult1 = mult2 = 0; /* Force a crash if we use these */ - - /* - * Okay, now begins the real work. The first step is - * slightly magic, so it's done outside the main loop, - * but it's very similar to what's inside. - */ - isone = 1; /* Buffer is implicitly 1, so replace * by copy */ - e1bits--; /* Start processing the first bit... */ - - /* - * This is just like the multiply in the loop, except that - * - We know the msbit of buf1 is set, and - * - We have the extra value n1^2 floating around. - * So, do the usual computation, and if the result is that - * the buffer should be multiplied by n1^1 immediately - * (which we'd normally then square), we multiply it - * (which reduces to a copy, which reduces to setting a flag) - * by n1^2 and skip the squaring. Thus, we do the - * multiply and the squaring in one step. - */ - assert(buf1 & tblmask); - mult1pos = e1bits - w1bits; - while ((buf1 & 1) == 0) { - buf1 >>= 1; - mult1pos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(mult1pos <= e1bits); - mult1 = table1[buf1>>1]; - buf1 = 0; - - /* Special case: use already-computed value sitting in buffer */ - if (mult1pos == e1bits) - isone = 0; - - /* - * The first multiply by a power of n2. Similar, but - * we might not even want to schedule a multiply if e2 is - * shorter than e1, and the window might be shorter so - * we have to leave the low w2bits bits alone. - */ - if (buf2 & tblmask) { - /* Remember low-order bits for later */ - i = buf2 & ((1u << w2bits) - 1); - buf2 >>= w2bits; - mult2pos = e1bits - w1bits + w2bits; - while ((buf2 & 1) == 0) { - buf2 >>= 1; - mult2pos++; - } - assert(mult2pos <= e1bits); - mult2 = table2[buf2>>1]; - buf2 = i; - - if (mult2pos == e1bits) { - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - lbnCopy_16(t, b, mlen); /* Copy low to high */ - isone = 0; - } else { - lbnMontMul_16(a, t, b, mod, mlen, inv); - t = a; a = b; b = t; - } - } - } - - /* - * At this point, the buffer (which is the high half of b) - * holds either 1 (implicitly, as the "isone" flag is set), - * n1^2, n2^2 or n1^2 * n2^2. - */ - - /* - * The main loop. The procedure is: - * - Advance the windows - * - If the most-significant bit of a window is set, - * schedule a multiply for the appropriate time in the - * future (may be immediately) - * - Perform any pending multiples - * - Check for termination - * - Square the buffers - * - * At any given time, the acumulated product is held in - * the high half of b. - */ - for (;;) { - e1bits--; - - /* Advance the windows */ - assert(buf1 < tblmask); - buf1 <<= 1; - assert(buf2 < tblmask); - buf2 <<= 1; - /* - * This reads ahead of the current exponent position - * (controlled by e1bits), so we have to be able to read - * past the lsb of the exponents without error. - */ - if (e1len) { - buf1 |= ((*e1 & bitpos) != 0); - if (e1len <= e2len) - buf2 |= ((*e2 & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e1++,e1--); - if (e1len <= e2len) - BIGLITTLE(e2++,e2--); - bitpos = (BNWORD16)1 << (16-1); - e1len--; - } - } - - /* Examine the first window for pending multiplies */ - if (buf1 & tblmask) { - mult1pos = e1bits - w1bits; - while ((buf1 & 1) == 0) { - buf1 >>= 1; - mult1pos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(mult1pos <= e1bits); - mult1 = table1[buf1>>1]; - buf1 = 0; - } - - /* - * Examine the second window for pending multiplies. - * Window 2 can be smaller than window 1, but we - * keep the same number of bits in buf2, so we need - * to ignore any low-order bits in the buffer when - * computing what to multiply by, and recompute them - * later. - */ - if (buf2 & tblmask) { - /* Remember low-order bits for later */ - i = buf2 & ((1u << w2bits) - 1); - buf2 >>= w2bits; - mult2pos = e1bits - w1bits + w2bits; - while ((buf2 & 1) == 0) { - buf2 >>= 1; - mult2pos++; - } - assert(mult2pos <= e1bits); - mult2 = table2[buf2>>1]; - buf2 = i; - } - - - /* If we have a pending multiply for e1, do it */ - if (e1bits == mult1pos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_16(t, mult1, mlen); - isone = 0; - } else { - lbnMontMul_16(a, t, mult1, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* If we have a pending multiply for e2, do it */ - if (e1bits == mult2pos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_16(t, mult2, mlen); - isone = 0; - } else { - lbnMontMul_16(a, t, mult2, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* Are we done? */ - if (!e1bits) - break; - - /* Square the buffer */ - if (!isone) { - t = BIGLITTLE(b-mlen, b+mlen); - lbnMontSquare_16(a, t, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } /* for (;;) */ - - assert(!isone); - assert(!buf1); - assert(!buf2); - - /* DONE! */ - - /* Convert result out of Montgomery form */ - t = BIGLITTLE(b-mlen, b+mlen); - lbnCopy_16(b, t, mlen); - lbnZero_16(t, mlen); - lbnMontReduce_16(b, mod, mlen, inv); - lbnCopy_16(result, t, mlen); - - /* Clean up - free intermediate storage */ - y = 0; -#if BNYIELD -yield: -#endif - buf2 = tblmask >> w2bits; - while (--tblmask) { - if (tblmask < buf2) - LBNFREE(table2[tblmask], mlen); - LBNFREE(table1[tblmask], mlen); - } - t = table1[0]; - LBNFREE(t, mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} -#endif - -/* - * 2^exp (mod mod). This is an optimized version for use in Fermat - * tests. The input value of n is ignored; it is returned with - * "mlen" words valid. - */ -int -lbnTwoExpMod_16(BNWORD16 *n, BNWORD16 const *exp, unsigned elen, - BNWORD16 *mod, unsigned mlen) -{ - unsigned e; /* Copy of high words of the exponent */ - unsigned bits; /* Assorted counter of bits */ - BNWORD16 const *bitptr; - BNWORD16 bitword, bitpos; - BNWORD16 *a, *b, *a1; - BNWORD16 inv; - int y; /* Result of bnYield() */ - - assert(mlen); - - bitptr = BIGLITTLE(exp-elen, exp+elen-1); - bitword = *bitptr; - assert(bitword); - - /* Clear n for future use. */ - lbnZero_16(n, mlen); - - bits = lbnBits_16(exp, elen); - - /* First, a couple of trivial cases. */ - if (bits <= 1) { - /* 2 ^ 0 == 1, 2 ^ 1 == 2 */ - BIGLITTLE(n[-1],n[0]) = (BNWORD16)1<<elen; - return 0; - } - - /* Set bitpos to the most significant bit */ - bitpos = (BNWORD16)1 << ((bits-1) & (16-1)); - - /* Now, count the bits in the modulus. */ - bits = lbnBits_16(mod, mlen); - assert(bits > 1); /* a 1-bit modulus is just stupid... */ - - /* - * We start with 1<<e, where "e" is as many high bits of the - * exponent as we can manage without going over the modulus. - * This first loop finds "e". - */ - e = 1; - while (elen) { - /* Consume the first bit */ - bitpos >>= 1; - if (!bitpos) { - if (!--elen) - break; - bitword = BIGLITTLE(*++bitptr,*--bitptr); - bitpos = (BNWORD16)1<<(16-1); - } - e = (e << 1) | ((bitpos & bitword) != 0); - if (e >= bits) { /* Overflow! Back out. */ - e >>= 1; - break; - } - } - /* - * The bit in "bitpos" being examined by the bit buffer has NOT - * been consumed yet. This may be past the end of the exponent, - * in which case elen == 1. - */ - - /* Okay, now, set bit "e" in n. n is already zero. */ - inv = (BNWORD16)1 << (e & (16-1)); - e /= 16; - BIGLITTLE(n[-e-1],n[e]) = inv; - /* - * The effective length of n in words is now "e+1". - * This is used a little bit later. - */ - - if (!elen) - return 0; /* That was easy! */ - - /* - * We have now processed the first few bits. The next step - * is to convert this to Montgomery form for further squaring. - */ - - /* Allocate working storage: two product buffers */ - LBNALLOC(a, BNWORD16, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD16, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert n to Montgomery form */ - inv = BIGLITTLE(mod[-1],mod[0]); /* LSW of modulus */ - assert(inv & 1); /* Modulus must be odd */ - inv = lbnMontInv1_16(inv); - /* Move n (length e+1, remember?) up "mlen" words into b */ - /* Note that we lie about a1 for a bit - it's pointing to b */ - a1 = BIGLITTLE(b-mlen,b+mlen); - lbnCopy_16(a1, n, e+1); - lbnZero_16(b, mlen); - /* Do the division - dump the quotient into the high-order words */ - (void)lbnDiv_16(a1, b, mlen+e+1, mod, mlen); - /* - * Now do the first squaring and modular reduction to put - * the number up in a1 where it belongs. - */ - lbnMontSquare_16(a, b, mod, mlen, inv); - /* Fix up a1 to point to where it should go. */ - a1 = BIGLITTLE(a-mlen,a+mlen); - - /* - * Okay, now, a1 holds the number being accumulated, and - * b is a scratch register. Start working: - */ - for (;;) { - /* - * Is the bit set? If so, double a1 as well. - * A modular doubling like this is very cheap. - */ - if (bitpos & bitword) { - /* - * Double the number. If there was a carry out OR - * the result is greater than the modulus, subract - * the modulus. - */ - if (lbnDouble_16(a1, mlen) || - lbnCmp_16(a1, mod, mlen) > 0) - (void)lbnSubN_16(a1, mod, mlen); - } - - /* Advance to the next exponent bit */ - bitpos >>= 1; - if (!bitpos) { - if (!--elen) - break; /* Done! */ - bitword = BIGLITTLE(*++bitptr,*--bitptr); - bitpos = (BNWORD16)1<<(16-1); - } - - /* - * The elen/bitword/bitpos bit buffer is known to be - * non-empty, i.e. there is at least one more unconsumed bit. - * Thus, it's safe to square the number. - */ - lbnMontSquare_16(b, a1, mod, mlen, inv); - /* Rename result (in b) back to a (a1, really). */ - a1 = b; b = a; a = a1; - a1 = BIGLITTLE(a-mlen,a+mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* DONE! Just a little bit of cleanup... */ - - /* - * Convert result out of Montgomery form... this is - * just a Montgomery reduction. - */ - lbnCopy_16(a, a1, mlen); - lbnZero_16(a1, mlen); - lbnMontReduce_16(a, mod, mlen, inv); - lbnCopy_16(n, a1, mlen); - - /* Clean up - free intermediate storage */ - y = 0; -#if BNYIELD -yield: -#endif - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - - -/* - * Returns a substring of the big-endian array of bytes representation - * of the bignum array based on two parameters, the least significant - * byte number (0 to start with the least significant byte) and the - * length. I.e. the number returned is a representation of - * (bn / 2^(8*lsbyte)) % 2 ^ (8*buflen). - * - * It is an error if the bignum is not at least buflen + lsbyte bytes - * long. - * - * This code assumes that the compiler has the minimal intelligence - * neded to optimize divides and modulo operations on an unsigned data - * type with a power of two. - */ -void -lbnExtractBigBytes_16(BNWORD16 const *n, unsigned char *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD16 t = 0; /* Needed to shut up uninitialized var warnings */ - unsigned shift; - - lsbyte += buflen; - - shift = (8 * lsbyte) % 16; - lsbyte /= (16/8); /* Convert to word offset */ - BIGLITTLE(n -= lsbyte, n += lsbyte); - - if (shift) - t = BIGLITTLE(n[-1],n[0]); - - while (buflen--) { - if (!shift) { - t = BIGLITTLE(*n++,*--n); - shift = 16; - } - shift -= 8; - *buf++ = (unsigned char)(t>>shift); - } -} - -/* - * Merge a big-endian array of bytes into a bignum array. - * The array had better be big enough. This is - * equivalent to extracting the entire bignum into a - * large byte array, copying the input buffer into the - * middle of it, and converting back to a bignum. - * - * The buf is "len" bytes long, and its *last* byte is at - * position "lsbyte" from the end of the bignum. - * - * Note that this is a pain to get right. Fortunately, it's hardly - * critical for efficiency. - */ -void -lbnInsertBigBytes_16(BNWORD16 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD16 t = 0; /* Shut up uninitialized varibale warnings */ - - lsbyte += buflen; - - BIGLITTLE(n -= lsbyte/(16/8), n += lsbyte/(16/8)); - - /* Load up leading odd bytes */ - if (lsbyte % (16/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte * 8) % 16; - } - - /* The main loop - merge into t, storing at each word boundary. */ - while (buflen--) { - t = (t << 8) | *buf++; - if ((--lsbyte % (16/8)) == 0) - BIGLITTLE(*n++,*--n) = t; - } - - /* Merge odd bytes in t into last word */ - lsbyte = (lsbyte * 8) % 16; - if (lsbyte) { - t <<= lsbyte; - t |= (((BNWORD16)1 << lsbyte) - 1) & BIGLITTLE(n[0],n[-1]); - BIGLITTLE(n[0],n[-1]) = t; - } - - return; -} - -/* - * Returns a substring of the little-endian array of bytes representation - * of the bignum array based on two parameters, the least significant - * byte number (0 to start with the least significant byte) and the - * length. I.e. the number returned is a representation of - * (bn / 2^(8*lsbyte)) % 2 ^ (8*buflen). - * - * It is an error if the bignum is not at least buflen + lsbyte bytes - * long. - * - * This code assumes that the compiler has the minimal intelligence - * neded to optimize divides and modulo operations on an unsigned data - * type with a power of two. - */ -void -lbnExtractLittleBytes_16(BNWORD16 const *n, unsigned char *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD16 t = 0; /* Needed to shut up uninitialized var warnings */ - - BIGLITTLE(n -= lsbyte/(16/8), n += lsbyte/(16/8)); - - if (lsbyte % (16/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte % (16/8)) * 8 ; - } - - while (buflen--) { - if ((lsbyte++ % (16/8)) == 0) - t = BIGLITTLE(*--n,*n++); - *buf++ = (unsigned char)t; - t >>= 8; - } -} - -/* - * Merge a little-endian array of bytes into a bignum array. - * The array had better be big enough. This is - * equivalent to extracting the entire bignum into a - * large byte array, copying the input buffer into the - * middle of it, and converting back to a bignum. - * - * The buf is "len" bytes long, and its first byte is at - * position "lsbyte" from the end of the bignum. - * - * Note that this is a pain to get right. Fortunately, it's hardly - * critical for efficiency. - */ -void -lbnInsertLittleBytes_16(BNWORD16 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD16 t = 0; /* Shut up uninitialized varibale warnings */ - - /* Move to most-significant end */ - lsbyte += buflen; - buf += buflen; - - BIGLITTLE(n -= lsbyte/(16/8), n += lsbyte/(16/8)); - - /* Load up leading odd bytes */ - if (lsbyte % (16/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte * 8) % 16; - } - - /* The main loop - merge into t, storing at each word boundary. */ - while (buflen--) { - t = (t << 8) | *--buf; - if ((--lsbyte % (16/8)) == 0) - BIGLITTLE(*n++,*--n) = t; - } - - /* Merge odd bytes in t into last word */ - lsbyte = (lsbyte * 8) % 16; - if (lsbyte) { - t <<= lsbyte; - t |= (((BNWORD16)1 << lsbyte) - 1) & BIGLITTLE(n[0],n[-1]); - BIGLITTLE(n[0],n[-1]) = t; - } - - return; -} - -#ifdef DEADCODE /* This was a precursor to the more flexible lbnExtractBytes */ -/* - * Convert a big-endian array of bytes to a bignum. - * Returns the number of words in the bignum. - * Note the expression "16/8" for the number of bytes per word. - * This is so the word-size adjustment will work. - */ -unsigned -lbnFromBytes_16(BNWORD16 *a, unsigned char const *b, unsigned blen) -{ - BNWORD16 t; - unsigned alen = (blen + (16/8-1))/(16/8); - BIGLITTLE(a -= alen, a += alen); - - while (blen) { - t = 0; - do { - t = t << 8 | *b++; - } while (--blen & (16/8-1)); - BIGLITTLE(*a++,*--a) = t; - } - return alen; -} -#endif - -#if 0 -/* - * Computes the GCD of a and b. Modifies both arguments; when it returns, - * one of them is the GCD and the other is trash. The return value - * indicates which: 0 for a, and 1 for b. The length of the retult is - * returned in rlen. Both inputs must have one extra word of precision. - * alen must be >= blen. - * - * TODO: use the binary algorithm (Knuth section 4.5.2, algorithm B). - * This is based on taking out common powers of 2, then repeatedly: - * gcd(2*u,v) = gcd(u,2*v) = gcd(u,v) - isolated powers of 2 can be deleted. - * gcd(u,v) = gcd(u-v,v) - the numbers can be easily reduced. - * It gets less reduction per step, but the steps are much faster than - * the division case. - */ -int -lbnGcd_16(BNWORD16 *a, unsigned alen, BNWORD16 *b, unsigned blen, - unsigned *rlen) -{ -#if BNYIELD - int y; -#endif - assert(alen >= blen); - - while (blen != 0) { - (void)lbnDiv_16(BIGLITTLE(a-blen,a+blen), a, alen, b, blen); - alen = lbnNorm_16(a, blen); - if (alen == 0) { - *rlen = blen; - return 1; - } - (void)lbnDiv_16(BIGLITTLE(b-alen,b+alen), b, blen, a, alen); - blen = lbnNorm_16(b, alen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - return y; -#endif - } - *rlen = alen; - return 0; -} - -/* - * Invert "a" modulo "mod" using the extended Euclidean algorithm. - * Note that this only computes one of the cosequences, and uses the - * theorem that the signs flip every step and the absolute value of - * the cosequence values are always bounded by the modulus to avoid - * having to work with negative numbers. - * gcd(a,mod) had better equal 1. Returns 1 if the GCD is NOT 1. - * a must be one word longer than "mod". It is overwritten with the - * result. - * TODO: Use Richard Schroeppel's *much* faster algorithm. - */ -int -lbnInv_16(BNWORD16 *a, unsigned alen, BNWORD16 const *mod, unsigned mlen) -{ - BNWORD16 *b; /* Hold a copy of mod during GCD reduction */ - BNWORD16 *p; /* Temporary for products added to t0 and t1 */ - BNWORD16 *t0, *t1; /* Inverse accumulators */ - BNWORD16 cy; - unsigned blen, t0len, t1len, plen; - int y; - - alen = lbnNorm_16(a, alen); - if (!alen) - return 1; /* No inverse */ - - mlen = lbnNorm_16(mod, mlen); - - assert (alen <= mlen); - - /* Inverse of 1 is 1 */ - if (alen == 1 && BIGLITTLE(a[-1],a[0]) == 1) { - lbnZero_16(BIGLITTLE(a-alen,a+alen), mlen-alen); - return 0; - } - - /* Allocate a pile of space */ - LBNALLOC(b, BNWORD16, mlen+1); - if (b) { - /* - * Although products are guaranteed to always be less than the - * modulus, it can involve multiplying two 3-word numbers to - * get a 5-word result, requiring a 6th word to store a 0 - * temporarily. Thus, mlen + 1. - */ - LBNALLOC(p, BNWORD16, mlen+1); - if (p) { - LBNALLOC(t0, BNWORD16, mlen); - if (t0) { - LBNALLOC(t1, BNWORD16, mlen); - if (t1) - goto allocated; - LBNFREE(t0, mlen); - } - LBNFREE(p, mlen+1); - } - LBNFREE(b, mlen+1); - } - return -1; - -allocated: - - /* Set t0 to 1 */ - t0len = 1; - BIGLITTLE(t0[-1],t0[0]) = 1; - - /* b = mod */ - lbnCopy_16(b, mod, mlen); - /* blen = mlen (implicitly) */ - - /* t1 = b / a; b = b % a */ - cy = lbnDiv_16(t1, b, mlen, a, alen); - *(BIGLITTLE(t1-(mlen-alen)-1,t1+(mlen-alen))) = cy; - t1len = lbnNorm_16(t1, mlen-alen+1); - blen = lbnNorm_16(b, alen); - - /* while (b > 1) */ - while (blen > 1 || BIGLITTLE(b[-1],b[0]) != (BNWORD16)1) { - /* q = a / b; a = a % b; */ - if (alen < blen || (alen == blen && lbnCmp_16(a, a, alen) < 0)) - assert(0); - cy = lbnDiv_16(BIGLITTLE(a-blen,a+blen), a, alen, b, blen); - *(BIGLITTLE(a-alen-1,a+alen)) = cy; - plen = lbnNorm_16(BIGLITTLE(a-blen,a+blen), alen-blen+1); - assert(plen); - alen = lbnNorm_16(a, blen); - if (!alen) - goto failure; /* GCD not 1 */ - - /* t0 += q * t1; */ - assert(plen+t1len <= mlen+1); - lbnMul_16(p, BIGLITTLE(a-blen,a+blen), plen, t1, t1len); - plen = lbnNorm_16(p, plen + t1len); - assert(plen <= mlen); - if (plen > t0len) { - lbnZero_16(BIGLITTLE(t0-t0len,t0+t0len), plen-t0len); - t0len = plen; - } - cy = lbnAddN_16(t0, p, plen); - if (cy) { - if (t0len > plen) { - cy = lbnAdd1_16(BIGLITTLE(t0-plen,t0+plen), - t0len-plen, cy); - } - if (cy) { - BIGLITTLE(t0[-t0len-1],t0[t0len]) = cy; - t0len++; - } - } - - /* if (a <= 1) return a ? t0 : FAIL; */ - if (alen <= 1 && BIGLITTLE(a[-1],a[0]) == (BNWORD16)1) { - if (alen == 0) - goto failure; /* FAIL */ - assert(t0len <= mlen); - lbnCopy_16(a, t0, t0len); - lbnZero_16(BIGLITTLE(a-t0len, a+t0len), mlen-t0len); - goto success; - } - - /* q = b / a; b = b % a; */ - if (blen < alen || (blen == alen && lbnCmp_16(b, a, alen) < 0)) - assert(0); - cy = lbnDiv_16(BIGLITTLE(b-alen,b+alen), b, blen, a, alen); - *(BIGLITTLE(b-blen-1,b+blen)) = cy; - plen = lbnNorm_16(BIGLITTLE(b-alen,b+alen), blen-alen+1); - assert(plen); - blen = lbnNorm_16(b, alen); - if (!blen) - goto failure; /* GCD not 1 */ - - /* t1 += q * t0; */ - assert(plen+t0len <= mlen+1); - lbnMul_16(p, BIGLITTLE(b-alen,b+alen), plen, t0, t0len); - plen = lbnNorm_16(p, plen + t0len); - assert(plen <= mlen); - if (plen > t1len) { - lbnZero_16(BIGLITTLE(t1-t1len,t1+t1len), plen-t1len); - t1len = plen; - } - cy = lbnAddN_16(t1, p, plen); - if (cy) { - if (t1len > plen) { - cy = lbnAdd1_16(BIGLITTLE(t1-plen,t0+plen), - t1len-plen, cy); - } - if (cy) { - BIGLITTLE(t1[-t1len-1],t1[t1len]) = cy; - t1len++; - } - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - - if (!blen) - goto failure; /* gcd(a, mod) != 1 -- FAIL */ - - /* return mod-t1 */ - lbnCopy_16(a, mod, mlen); - assert(t1len <= mlen); - cy = lbnSubN_16(a, t1, t1len); - if (cy) { - assert(mlen > t1len); - cy = lbnSub1_16(BIGLITTLE(a-t1len, a+t1len), mlen-t1len, cy); - assert(!cy); - } - -success: - LBNFREE(t1, mlen); - LBNFREE(t0, mlen); - LBNFREE(p, mlen+1); - LBNFREE(b, mlen+1); - - return 0; - -failure: /* GCD is not 1 - no inverse exists! */ - y = 1; -#if BNYIELD -yield: -#endif - LBNFREE(t1, mlen); - LBNFREE(t0, mlen); - LBNFREE(p, mlen+1); - LBNFREE(b, mlen+1); - - return y; -} - -/* - * Precompute powers of "a" mod "mod". Compute them every "bits" - * for "n" steps. This is sufficient to compute powers of g with - * exponents up to n*bits bits long, i.e. less than 2^(n*bits). - * - * This assumes that the caller has already initialized "array" to point - * to "n" buffers of size "mlen". - */ -int -lbnBasePrecompBegin_16(BNWORD16 **array, unsigned n, unsigned bits, - BNWORD16 const *g, unsigned glen, BNWORD16 *mod, unsigned mlen) -{ - BNWORD16 *a, *b; /* Temporary double-width accumulators */ - BNWORD16 *a1; /* Pointer to high half of a*/ - BNWORD16 inv; /* Montgomery inverse of LSW of mod */ - BNWORD16 *t; - unsigned i; - - glen = lbnNorm_16(g, glen); - assert(glen); - - assert (mlen == lbnNorm_16(mod, mlen)); - assert (glen <= mlen); - - /* Allocate two temporary buffers, and the array slots */ - LBNALLOC(a, BNWORD16, mlen*2); - if (!a) - return -1; - LBNALLOC(b, BNWORD16, mlen*2); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Okay, all ready */ - - /* Convert n to Montgomery form */ - inv = BIGLITTLE(mod[-1],mod[0]); /* LSW of modulus */ - assert(inv & 1); /* Modulus must be odd */ - inv = lbnMontInv1_16(inv); - /* Move g up "mlen" words into a (clearing the low mlen words) */ - a1 = BIGLITTLE(a-mlen,a+mlen); - lbnCopy_16(a1, g, glen); - lbnZero_16(a, mlen); - - /* Do the division - dump the quotient into the high-order words */ - (void)lbnDiv_16(a1, a, mlen+glen, mod, mlen); - - /* Copy the first value into the array */ - t = *array; - lbnCopy_16(t, a, mlen); - a1 = a; /* This first value is *not* shifted up */ - - /* Now compute the remaining n-1 array entries */ - assert(bits); - assert(n); - while (--n) { - i = bits; - do { - /* Square a1 into b1 */ - lbnMontSquare_16(b, a1, mod, mlen, inv); - t = b; b = a; a = t; - a1 = BIGLITTLE(a-mlen, a+mlen); - } while (--i); - t = *++array; - lbnCopy_16(t, a1, mlen); - } - - /* Hooray, we're done. */ - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - return 0; -} - -/* - * result = base^exp (mod mod). "array" is a an array of pointers - * to procomputed powers of base, each 2^bits apart. (I.e. array[i] - * is base^(2^(i*bits))). - * - * The algorithm consists of: - * a = b = (powers of g to be raised to the power 2^bits-1) - * a *= b *= (powers of g to be raised to the power 2^bits-2) - * ... - * a *= b *= (powers of g to be raised to the power 1) - * - * All we do is walk the exponent 2^bits-1 times in groups of "bits" bits, - */ -int -lbnBasePrecompExp_16(BNWORD16 *result, BNWORD16 const * const *array, - unsigned bits, BNWORD16 const *exp, unsigned elen, - BNWORD16 const *mod, unsigned mlen) -{ - BNWORD16 *a, *b, *c, *t; - BNWORD16 *a1, *b1; - int anull, bnull; /* Null flags: values are implicitly 1 */ - unsigned i, j; /* Loop counters */ - unsigned mask; /* Exponent bits to examime */ - BNWORD16 const *eptr; /* Pointer into exp */ - BNWORD16 buf, curbits, nextword; /* Bit-buffer varaibles */ - BNWORD16 inv; /* Inverse of LSW of modulus */ - unsigned ewords; /* Words of exponent left */ - int bufbits; /* Number of valid bits */ - int y = 0; - - mlen = lbnNorm_16(mod, mlen); - assert (mlen); - - elen = lbnNorm_16(exp, elen); - if (!elen) { - lbnZero_16(result, mlen); - BIGLITTLE(result[-1],result[0]) = 1; - return 0; - } - /* - * This could be precomputed, but it's so cheap, and it would require - * making the precomputation structure word-size dependent. - */ - inv = lbnMontInv1_16(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - assert(elen); - - /* - * Allocate three temporary buffers. The current numbers generally - * live in the upper halves of these buffers. - */ - LBNALLOC(a, BNWORD16, mlen*2); - if (a) { - LBNALLOC(b, BNWORD16, mlen*2); - if (b) { - LBNALLOC(c, BNWORD16, mlen*2); - if (c) - goto allocated; - LBNFREE(b, 2*mlen); - } - LBNFREE(a, 2*mlen); - } - return -1; - -allocated: - - anull = bnull = 1; - - mask = (1u<<bits) - 1; - for (i = mask; i; --i) { - /* Set up bit buffer for walking the exponent */ - eptr = exp; - buf = BIGLITTLE(*--eptr, *eptr++); - ewords = elen-1; - bufbits = 16; - for (j = 0; ewords || buf; j++) { - /* Shift down current buffer */ - curbits = buf; - buf >>= bits; - /* If necessary, add next word */ - bufbits -= bits; - if (bufbits < 0 && ewords > 0) { - nextword = BIGLITTLE(*--eptr, *eptr++); - ewords--; - curbits |= nextword << (bufbits+bits); - buf = nextword >> -bufbits; - bufbits += 16; - } - /* If appropriate, multiply b *= array[j] */ - if ((curbits & mask) == i) { - BNWORD16 const *d = array[j]; - - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (bnull) { - lbnCopy_16(b1, d, mlen); - bnull = 0; - } else { - lbnMontMul_16(c, b1, d, mod, mlen, inv); - t = c; c = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - } - - /* Multiply a *= b */ - if (!bnull) { - a1 = BIGLITTLE(a-mlen-1,a+mlen); - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (anull) { - lbnCopy_16(a1, b1, mlen); - anull = 0; - } else { - lbnMontMul_16(c, a1, b1, mod, mlen, inv); - t = c; c = a; a = t; - } - } - } - - assert(!anull); /* If it were, elen would have been 0 */ - - /* Convert out of Montgomery form and return */ - a1 = BIGLITTLE(a-mlen-1,a+mlen); - lbnCopy_16(a, a1, mlen); - lbnZero_16(a1, mlen); - lbnMontReduce_16(a, mod, mlen, inv); - lbnCopy_16(result, a1, mlen); - -#if BNYIELD -yield: -#endif - LBNFREE(c, 2*mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; -} - -/* - * result = base1^exp1 *base2^exp2 (mod mod). "array1" and "array2" are - * arrays of pointers to procomputed powers of the corresponding bases, - * each 2^bits apart. (I.e. array1[i] is base1^(2^(i*bits))). - * - * Bits must be the same in both. (It could be made adjustable, but it's - * a bit of a pain. Just make them both equal to the larger one.) - * - * The algorithm consists of: - * a = b = (powers of base1 and base2 to be raised to the power 2^bits-1) - * a *= b *= (powers of base1 and base2 to be raised to the power 2^bits-2) - * ... - * a *= b *= (powers of base1 and base2 to be raised to the power 1) - * - * All we do is walk the exponent 2^bits-1 times in groups of "bits" bits, - */ -int -lbnDoubleBasePrecompExp_16(BNWORD16 *result, unsigned bits, - BNWORD16 const * const *array1, BNWORD16 const *exp1, unsigned elen1, - BNWORD16 const * const *array2, BNWORD16 const *exp2, - unsigned elen2, BNWORD16 const *mod, unsigned mlen) -{ - BNWORD16 *a, *b, *c, *t; - BNWORD16 *a1, *b1; - int anull, bnull; /* Null flags: values are implicitly 1 */ - unsigned i, j, k; /* Loop counters */ - unsigned mask; /* Exponent bits to examime */ - BNWORD16 const *eptr; /* Pointer into exp */ - BNWORD16 buf, curbits, nextword; /* Bit-buffer varaibles */ - BNWORD16 inv; /* Inverse of LSW of modulus */ - unsigned ewords; /* Words of exponent left */ - int bufbits; /* Number of valid bits */ - int y = 0; - BNWORD16 const * const *array; - - mlen = lbnNorm_16(mod, mlen); - assert (mlen); - - elen1 = lbnNorm_16(exp1, elen1); - if (!elen1) { - return lbnBasePrecompExp_16(result, array2, bits, exp2, elen2, - mod, mlen); - } - elen2 = lbnNorm_16(exp2, elen2); - if (!elen2) { - return lbnBasePrecompExp_16(result, array1, bits, exp1, elen1, - mod, mlen); - } - /* - * This could be precomputed, but it's so cheap, and it would require - * making the precomputation structure word-size dependent. - */ - inv = lbnMontInv1_16(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - assert(elen1); - assert(elen2); - - /* - * Allocate three temporary buffers. The current numbers generally - * live in the upper halves of these buffers. - */ - LBNALLOC(a, BNWORD16, mlen*2); - if (a) { - LBNALLOC(b, BNWORD16, mlen*2); - if (b) { - LBNALLOC(c, BNWORD16, mlen*2); - if (c) - goto allocated; - LBNFREE(b, 2*mlen); - } - LBNFREE(a, 2*mlen); - } - return -1; - -allocated: - - anull = bnull = 1; - - mask = (1u<<bits) - 1; - for (i = mask; i; --i) { - /* Walk each exponent in turn */ - for (k = 0; k < 2; k++) { - /* Set up the exponent for walking */ - array = k ? array2 : array1; - eptr = k ? exp2 : exp1; - ewords = (k ? elen2 : elen1) - 1; - /* Set up bit buffer for walking the exponent */ - buf = BIGLITTLE(*--eptr, *eptr++); - bufbits = 16; - for (j = 0; ewords || buf; j++) { - /* Shift down current buffer */ - curbits = buf; - buf >>= bits; - /* If necessary, add next word */ - bufbits -= bits; - if (bufbits < 0 && ewords > 0) { - nextword = BIGLITTLE(*--eptr, *eptr++); - ewords--; - curbits |= nextword << (bufbits+bits); - buf = nextword >> -bufbits; - bufbits += 16; - } - /* If appropriate, multiply b *= array[j] */ - if ((curbits & mask) == i) { - BNWORD16 const *d = array[j]; - - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (bnull) { - lbnCopy_16(b1, d, mlen); - bnull = 0; - } else { - lbnMontMul_16(c, b1, d, mod, mlen, inv); - t = c; c = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - } - } - - /* Multiply a *= b */ - if (!bnull) { - a1 = BIGLITTLE(a-mlen-1,a+mlen); - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (anull) { - lbnCopy_16(a1, b1, mlen); - anull = 0; - } else { - lbnMontMul_16(c, a1, b1, mod, mlen, inv); - t = c; c = a; a = t; - } - } - } - - assert(!anull); /* If it were, elen would have been 0 */ - - /* Convert out of Montgomery form and return */ - a1 = BIGLITTLE(a-mlen-1,a+mlen); - lbnCopy_16(a, a1, mlen); - lbnZero_16(a1, mlen); - lbnMontReduce_16(a, mod, mlen, inv); - lbnCopy_16(result, a1, mlen); - -#if BNYIELD -yield: -#endif - LBNFREE(c, 2*mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; -} -#endif diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.h deleted file mode 100644 index 976b7b88c7..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.h +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef LBN16_H -#define LBN16_H - -#include "lbn.h" - -#ifndef BNWORD16 -#error 16-bit bignum library requires a 16-bit data type -#endif - -#ifndef lbnCopy_16 -void lbnCopy_16(BNWORD16 *dest, BNWORD16 const *src, unsigned len); -#endif -#ifndef lbnZero_16 -void lbnZero_16(BNWORD16 *num, unsigned len); -#endif -#ifndef lbnNeg_16 -void lbnNeg_16(BNWORD16 *num, unsigned len); -#endif - -#ifndef lbnAdd1_16 -BNWORD16 lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry); -#endif -#ifndef lbnSub1_16 -BNWORD16 lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow); -#endif - -#ifndef lbnAddN_16 -BNWORD16 lbnAddN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len); -#endif -#ifndef lbnSubN_16 -BNWORD16 lbnSubN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len); -#endif - -#ifndef lbnCmp_16 -int lbnCmp_16(BNWORD16 const *num1, BNWORD16 const *num2, unsigned len); -#endif - -#ifndef lbnMulN1_16 -void lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); -#endif -#ifndef lbnMulAdd1_16 -BNWORD16 -lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); -#endif -#ifndef lbnMulSub1_16 -BNWORD16 lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); -#endif - -#ifndef lbnLshift_16 -BNWORD16 lbnLshift_16(BNWORD16 *num, unsigned len, unsigned shift); -#endif -#ifndef lbnDouble_16 -BNWORD16 lbnDouble_16(BNWORD16 *num, unsigned len); -#endif -#ifndef lbnRshift_16 -BNWORD16 lbnRshift_16(BNWORD16 *num, unsigned len, unsigned shift); -#endif - -#ifndef lbnMul_16 -void lbnMul_16(BNWORD16 *prod, BNWORD16 const *num1, unsigned len1, - BNWORD16 const *num2, unsigned len2); -#endif -#ifndef lbnSquare_16 -void lbnSquare_16(BNWORD16 *prod, BNWORD16 const *num, unsigned len); -#endif - -#ifndef lbnNorm_16 -unsigned lbnNorm_16(BNWORD16 const *num, unsigned len); -#endif -#ifndef lbnBits_16 -unsigned lbnBits_16(BNWORD16 const *num, unsigned len); -#endif - -#ifndef lbnExtractBigBytes_16 -void lbnExtractBigBytes_16(BNWORD16 const *bn, unsigned char *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnInsertBigytes_16 -void lbnInsertBigBytes_16(BNWORD16 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnExtractLittleBytes_16 -void lbnExtractLittleBytes_16(BNWORD16 const *bn, unsigned char *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnInsertLittleBytes_16 -void lbnInsertLittleBytes_16(BNWORD16 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen); -#endif - -#ifndef lbnDiv21_16 -BNWORD16 lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d); -#endif -#ifndef lbnDiv1_16 -BNWORD16 lbnDiv1_16(BNWORD16 *q, BNWORD16 *rem, - BNWORD16 const *n, unsigned len, BNWORD16 d); -#endif -#ifndef lbnModQ_16 -unsigned lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d); -#endif -#ifndef lbnDiv_16 -BNWORD16 -lbnDiv_16(BNWORD16 *q, BNWORD16 *n, unsigned nlen, BNWORD16 *d, unsigned dlen); -#endif - -#ifndef lbnMontInv1_16 -BNWORD16 lbnMontInv1_16(BNWORD16 const x); -#endif -#ifndef lbnMontReduce_16 -void lbnMontReduce_16(BNWORD16 *n, BNWORD16 const *mod, unsigned const mlen, - BNWORD16 inv); -#endif -#ifndef lbnToMont_16 -void lbnToMont_16(BNWORD16 *n, unsigned nlen, BNWORD16 *mod, unsigned mlen); -#endif -#ifndef lbnFromMont_16 -void lbnFromMont_16(BNWORD16 *n, BNWORD16 *mod, unsigned len); -#endif - -#ifndef lbnExpMod_16 -int lbnExpMod_16(BNWORD16 *result, BNWORD16 const *n, unsigned nlen, - BNWORD16 const *exp, unsigned elen, BNWORD16 *mod, unsigned mlen); -#endif -#if 0 -#ifndef lbnDoubleExpMod_16 -int lbnDoubleExpMod_16(BNWORD16 *result, - BNWORD16 const *n1, unsigned n1len, BNWORD16 const *e1, unsigned e1len, - BNWORD16 const *n2, unsigned n2len, BNWORD16 const *e2, unsigned e2len, - BNWORD16 *mod, unsigned mlen); -#endif -#endif -#ifndef lbnTwoExpMod_16 -int lbnTwoExpMod_16(BNWORD16 *n, BNWORD16 const *exp, unsigned elen, - BNWORD16 *mod, unsigned mlen); -#endif -#if 0 -#ifndef lbnGcd_16 -int lbnGcd_16(BNWORD16 *a, unsigned alen, BNWORD16 *b, unsigned blen, - unsigned *rlen); -#endif -#ifndef lbnInv_16 -int lbnInv_16(BNWORD16 *a, unsigned alen, BNWORD16 const *mod, unsigned mlen); -#endif - -int lbnBasePrecompBegin_16(BNWORD16 **array, unsigned n, unsigned bits, - BNWORD16 const *g, unsigned glen, BNWORD16 *mod, unsigned mlen); -int lbnBasePrecompExp_16(BNWORD16 *result, BNWORD16 const * const *array, - unsigned bits, BNWORD16 const *exp, unsigned elen, - BNWORD16 const *mod, unsigned mlen); -int lbnDoubleBasePrecompExp_16(BNWORD16 *result, unsigned bits, - BNWORD16 const * const *array1, BNWORD16 const *exp1, unsigned elen1, - BNWORD16 const * const *array2, BNWORD16 const *exp2, - unsigned elen2, BNWORD16 const *mod, unsigned mlen); -#endif - -#endif /* LBN16_H */ diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnarm.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnarm.h deleted file mode 100644 index e6c69224b5..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnarm.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * lbnarm.h - This file defines the interfaces to the ARM - * assembly primitives. It is intended to be included in "lbn.h" - * via the "#include BNINCLUDE" mechanism. - */ - -#define BN_LITTLE_ENDIAN 1 - -typedef unsigned bnword32; -#define BNWORD32 bnword32 - -/* Function prototypes for the asm routines */ -void -lbnMulN1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulN1_32 lbnMulN1_32 - -bnword32 -lbnMulAdd1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulAdd1_32 lbnMulAdd1_32 - -/* Not implemented yet */ -bnword32 -lbnMulSub1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulSub1_32 lbnMulSub1_32 - -#if __GNUC__ && 0 -/* - * Use the (massively cool) GNU inline-assembler extension to define - * inline expansions for various operations. - * - * The massively cool part is that the assembler can have inputs - * and outputs, and you specify the operands and which effective - * addresses are legal and they get substituted into the code. - * (For example, some of the code requires a zero. Rather than - * specify an immediate constant, the expansion specifies an operand - * of zero which can be in various places. This lets GCC use an - * immediate zero, or a register which contains zero if it's available.) - * - * The syntax is asm("asm_code" : outputs : inputs : trashed) - * %0, %1 and so on in the asm code are substituted by the operands - * in left-to-right order (outputs, then inputs). - * The operands contain constraint strings and values to use. - * Outputs must be lvalues, inputs may be rvalues. In the constraints: - * "r" means that the operand may be in a register. - * "=" means that the operand is assigned to. - * "%" means that this operand and the following one may be - * interchanged if desirable. - * "&" means that this output operand is written before the input operands - * are read, so it may NOT overlap with any input operands. - * "0" and "1" mean that this operand may be in the same place as the - * given operand. - * Multiple sets of constraints may be listed, separated by commas. - * - * Note that ARM multi-precision multiply syntax lists destLo before destHi. - * Also, the first source (%2) may not be the same as %0 or %1. - * The second source, however, may be. - */ - -/* (ph<<32) + pl = x*y */ -#define mul32_ppmm(ph,pl,x,y) \ - __asm__("umull %1,%0,%2,%3" : "=&r,&r"(ph), "=&r,&r"(pl) \ - : "%r,%r"(x), "r0,r1"(y)) - -/* (ph<<32) + pl = x*y + a */ -#define mul32_ppmma(ph,pl,x,y,a) \ - __asm__("umlal %1,%0,%2,%3" : "=&r"(ph), "=&r"(pl) \ - : "%r"(x), "r"(y), "0"(0), "1"(a)) - -/* (ph<<32) + pl = x*y + a + b */ -/* %4 (a) may share a register with %0, but nothing else may. */ -#define mul32_ppmmaa(ph,pl,x,y,a,b) \ - __asm__("adds %1, %4, %5\n\t" \ - "movcc %0, #0\n\t" \ - "movcs %0, #1\n\t" \ - "umlal %1,%0,%2,%3" \ - : "=&r"(ph), "=&r"(pl) \ - : "%r"(x), "r"(y), "%r"(a), "r1"(b)) - -#endif /* __GNUC__ */ diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnarm.s b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnarm.s deleted file mode 100644 index cae3602fd5..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnarm.s +++ /dev/null @@ -1,173 +0,0 @@ -@ lbnarm.s - 32-bit bignum primitives for ARM processors with 32x32-bit multiply -@ -@ This uses the standard ARM calling convetion, which is that arguments -@ are passed, and results returned, in r0..r3. r0..r3, r12 (IP) and r14 (LR) -@ are volatile across the function; all others are callee-save. -@ However, note that r14 (LR) is the return address, so it would be -@ wise to save it somewhere before trashing it. Fortunately, there is -@ a neat trick possible, in that you can pop LR from the stack straight -@ into r15 (PC), effecting a return at the same time. -@ -@ Also, r13 (SP) is probably best left alone, and r15 (PC) is obviously -@ reserved by hardware. Temps should use lr, then r4..r9 in order. - - .text - .align 2 - -@ out[0..len] = in[0..len-1] * k -@ void lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) - .global lbnMulN1_32 - .type lbnMulN1_32, %function -lbnMulN1_32: - stmfd sp!, {r4, r5, lr} - ldr lr, [r1], #4 @ lr = *in++ - umull r5, r4, lr, r3 @ (r4,r5) = lr * r3 - str r5, [r0], #4 @ *out++ = r5 - movs r2, r2, lsr #1 - bcc m32_even - mov r5, r4 @ Get carry in the right register - beq m32_done -m32_loop: - @ carry is in r5 - ldr lr, [r1], #4 @ lr = *in++ - mov r4, #0 - umlal r5, r4, lr, r3 @ (r4,r5) += lr * r3 - str r5, [r0], #4 @ *out++ = r5 -m32_even: - @ carry is in r4 - ldr lr, [r1], #4 @ lr = *in++ - mov r5, #0 - umlal r4, r5, lr, r3 @ (r5,r4) += lr * r3 - subs r2, r2, #1 - str r4, [r0], #4 @ *out++ = r4 - - bne m32_loop -m32_done: - str r5, [r0, #0] @ store carry - ldmfd sp!, {r4, r5, pc} - .size lbnMulN1_32, .-lbnMulN1_32 - -@ out[0..len-1] += in[0..len-1] * k, return carry -@ BNWORD32 -@ lbnMulAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) - - .global lbnMulAdd1_32 - .type lbnMulAdd1_32, %function -lbnMulAdd1_32: - stmfd sp!, {r4, r5, lr} - - mov r4, #0 - ldr lr, [r1], #4 @ lr = *in++ - ldr r5, [r0, #0] @ r5 = *out - mov r4, #0 - umlal r5, r4, lr, r3 @ (r4,r5) += lr * r3 - str r5, [r0], #4 @ *out++ = r5 - movs r2, r2, lsr #1 - bcc ma32_even - beq ma32_done -ma32_loop: - @ carry is in r4 - ldr lr, [r1], #4 @ lr = *in++ - mov r5, #0 - umlal r4, r5, lr, r3 @ (r5,r4) += lr * r3 - ldr lr, [r0, #0] @ lr = *out - adds lr, lr, r4 @ lr += product.low - str lr, [r0], #4 @ *out++ = lr - adc r4, r5, #0 @ Compute carry and move back to r4 -ma32_even: - @ another unrolled copy - ldr lr, [r1], #4 @ lr = *in++ - mov r5, #0 - umlal r4, r5, lr, r3 @ (r5,r4) += lr * r3 - ldr lr, [r0, #0] @ lr = *out - adds lr, lr, r4 @ lr += product.low - adc r4, r5, #0 @ Compute carry and move back to r4 - str lr, [r0], #4 @ *out++ = lr - subs r2, r2, #1 - - bne ma32_loop -ma32_done: - mov r0, r4 - ldmfd sp!, {r4, r5, pc} - .size lbnMulAdd1_32, .-lbnMulAdd1_32 - -@@@ This is a bit messy... punt for now... -@ out[0..len-1] -= in[0..len-1] * k, return carry (borrow) -@ BNWORD32 -@ lbnMulSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) - .global lbnMulSub1_32 - .type lbnMulSub1_32, %function -lbnMulSub1_32: - stmfd sp!, {r4, r5, lr} - - mov r4, #0 - mov r5, #0 - ldr lr, [r1], #4 @ lr = *in++ - umull r4, r5, lr, r3 @ (r5,r4) = lr * r3 - ldr lr, [r0, #0] @ lr = *out - subs lr, lr, r4 @ lr -= product.low - str lr, [r0], #4 @ *out++ = lr - addcc r5, r5, #1 @ propagate carry - - movs r2, r2, lsr #1 - bcc ms32_even - mov r4, r5 - beq ms32_done -ms32_loop: - @ carry is in r4 - ldr lr, [r1], #4 @ lr = *in++ - mov r5, #0 - umlal r4, r5, lr, r3 @ (r5,r4) += lr * r3 - ldr lr, [r0, #0] @ lr = *out - subs lr, lr, r4 @ lr -= product.low - str lr, [r0], #4 @ *out++ = lr - addcc r5, r5, #1 @ propagate carry -ms32_even: - @ carry is in r5 - ldr lr, [r1], #4 @ lr = *in++ - mov r4, #0 - umlal r5, r4, lr, r3 @ (r4,r5) += lr * r3 - ldr lr, [r0, #0] @ lr = *out - subs lr, lr, r5 @ lr -= product.low - str lr, [r0], #4 @ *out++ = lr - addcc r4, r4, #1 @ Propagate carry - - subs r2, r2, #1 - bne ms32_loop -ms32_done: - mov r0, r4 - ldmfd sp!, {r4, r5, pc} - - .size lbnMulSub1_32, .-lbnMulSub1_32 - -@@ -@@ It's possible to eliminate the store traffic by doing the multiplies -@@ in a different order, forming all the partial products in one column -@@ at a time. But it requires 32x32 + 64 -> 65-bit MAC. The -@@ ARM has the MAC, but no carry out. -@@ -@@ The question is, is it faster to do the add directly (3 instructions), -@@ or can we compute the carry out in 1 instruction (+1 to do the add)? -@@ Well... it takes at least 1 instruction to copy the original accumulator, -@@ out of the way, and 1 to do a compare, so no. -@@ -@@ Now, the overall loop... this is an nxn->2n multiply. For i=0..n-1, -@@ we sum i+1 multiplies in each (plus the carry in from the -@@ previous one). For i = n..2*n-1 we sum 2*n-1-i, plus the previous -@@ carry. -@@ -@@ This "non-square" structure makes things more complicated. -@@ -@@ void -@@ lbnMulX_32(BNWORD32 *prod, BNWORD32 const *num1, BNWORD32 const *num2, -@@ unsigned len) -@ .global lbnMulX_32 -@ .type lbnMulX_32, %function -@lbnMulX_32: -@ stmfd sp!, {r4, r5, r6, r7, lr} -@ -@ mov r4, #0 -@ mov r5, #0 -@ mov r0, r4 -@ ldmfd sp!, {r4, r5, pc} -@ .size lbnMulX_32, .-lbnMulX_32 diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.c b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.c deleted file mode 100644 index 70094d5f31..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * lbnmem.c - low-level bignum memory handling. - * - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * - * Note that in all cases, the pointers passed around - * are pointers to the *least* significant end of the word. - * On big-endian machines, these are pointers to the *end* - * of the allocated range. - * - * BNSECURE is a simple level of security; for more security - * change these function to use locked unswappable memory. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STDLIB_H -#define NO_STDLIB_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_STDLIB_H -#include <stdlib.h> /* For malloc() & co. */ -#else -void *malloc(); -void *realloc(); -void free(); -#endif - -#if !NO_STRING_H -#include <string.h> /* For memset */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#ifndef DBMALLOC -#define DBMALLOC 0 -#endif -#if DBMALLOC -/* Development debugging */ -#include "../dbmalloc/malloc.h" -#endif - -#include "lbn.h" -#include "lbnmem.h" - -#include "kludge.h" - -#ifndef lbnMemWipe -void -lbnMemWipe(void *ptr, unsigned bytes) -{ - memset(ptr, 0, bytes); -} -#define lbnMemWipe(ptr, bytes) memset(ptr, 0, bytes) -#endif - -#ifndef lbnMemAlloc -void * -lbnMemAlloc(unsigned bytes) -{ - return malloc(bytes); -} -#define lbnMemAlloc(bytes) malloc(bytes) -#endif - -#ifndef lbnMemFree -void -lbnMemFree(void *ptr, unsigned bytes) -{ - lbnMemWipe(ptr, bytes); - free(ptr); -} -#endif - -#if 0 -#ifndef lbnRealloc -#if defined(lbnMemRealloc) || !BNSECURE -void * -lbnRealloc(void *ptr, unsigned oldbytes, unsigned newbytes) -{ - if (ptr) { - BIG(ptr = (char *)ptr - oldbytes;) - if (newbytes < oldbytes) - memmove(ptr, (char *)ptr + oldbytes-newbytes, oldbytes); - } -#ifdef lbnMemRealloc - ptr = lbnMemRealloc(ptr, oldbytes, newbytes); -#else - ptr = realloc(ptr, newbytes); -#endif - if (ptr) { - if (newbytes > oldbytes) - memmove((char *)ptr + newbytes-oldbytes, ptr, oldbytes); - BIG(ptr = (char *)ptr + newbytes;) - } - - return ptr; -} - -#else /* BNSECURE */ - -void * -lbnRealloc(void *oldptr, unsigned oldbytes, unsigned newbytes) -{ - void *newptr = lbnMemAlloc(newbytes); - - if (!newptr) - return newptr; - if (!oldptr) - return BIGLITTLE((char *)newptr+newbytes, newptr); - - /* - * The following copies are a bit non-obvious in the big-endian case - * because one of the pointers points to the *end* of allocated memory. - */ - if (newbytes > oldbytes) { /* Copy all of old into part of new */ - BIG(newptr = (char *)newptr + newbytes;) - BIG(oldptr = (char *)oldptr - oldbytes;) - memcpy(BIGLITTLE((char *)newptr-oldbytes, newptr), oldptr, - oldbytes); - } else { /* Copy part of old into all of new */ - memcpy(newptr, BIGLITTLE((char *)oldptr-newbytes, oldptr), - newbytes); - BIG(newptr = (char *)newptr + newbytes;) - BIG(oldptr = (char *)oldptr - oldbytes;) - } - - lbnMemFree(oldptr, oldbytes); - - return newptr; -} -#endif /* BNSECURE */ -#endif /* !lbnRealloc */ -#endif diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.h deleted file mode 100644 index f77298b327..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Operations on the usual buffers of bytes - */ -#ifndef BNSECURE -#define BNSECURE 1 -#endif - -/* - * These operations act on buffers of memory, just like malloc & free. - * One exception: it is not legal to pass a NULL pointer to lbnMemFree. - */ - -#ifndef lbnMemAlloc -void *lbnMemAlloc(unsigned bytes); -#endif - -#ifndef lbnMemFree -void lbnMemFree(void *ptr, unsigned bytes); -#endif - -/* This wipes out a buffer of bytes if necessary needed. */ - -#ifndef lbnMemWipe -#if BNSECURE -void lbnMemWipe(void *ptr, unsigned bytes); -#else -#define lbnMemWipe(ptr, bytes) (void)(ptr,bytes) -#endif -#endif /* !lbnMemWipe */ - -/* - * lbnRealloc is NOT like realloc(); it's endian-sensitive! - * If lbnMemRealloc is #defined, lbnRealloc will be defined in terms of it. - * It is legal to pass a NULL pointer to lbnRealloc, although oldbytes - * will always be sero. - */ -#ifndef lbnRealloc -void *lbnRealloc(void *ptr, unsigned oldbytes, unsigned newbytes); -#endif - - -/* - * These macros are the ones actually used most often in the math library. - * They take and return pointers to the *end* of the given buffer, and - * take sizes in terms of words, not bytes. - * - * Note that LBNALLOC takes the pointer as an argument instead of returning - * the value. - * - * Note also that these macros are only useable if you have included - * lbn.h (for the BIG and BIGLITTLE macros), which this file does NOT include. - */ - -#define LBNALLOC(p,type,words) BIGLITTLE( \ - if ( ((p) = (type *)lbnMemAlloc((words)*sizeof*(p))) != 0) \ - (p) += (words), \ - (p) = (type *)lbnMemAlloc((words) * sizeof*(p)) \ - ) -#define LBNFREE(p,words) lbnMemFree((p) BIG(-(words)), (words) * sizeof*(p)) -#define LBNREALLOC(p,old,new) \ - lbnRealloc(p, (old) * sizeof*(p), (new) * sizeof*(p)) -#define LBNWIPE(p,words) lbnMemWipe((p) BIG(-(words)), (words) * sizeof*(p)) - diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/sha256_arm.c b/libs/libzrtp/third_party/bnlib/bignum-ARM/sha256_arm.c deleted file mode 100644 index 69af34e64f..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/sha256_arm.c +++ /dev/null @@ -1,241 +0,0 @@ -#include <stdint.h> -#include <stdio.h> -#include <string.h> -#include <assert.h> - -#define DEBUG 0 - -/* - * For code size reasons, this doesn't even try to support - * input sizes >= 2^32 bits = 2^29 bytes - */ -struct sha256_state { - uint32_t iv[8]; /* a, b, c, d, e, f, g, h */ - uint32_t w[64]; /* Fill in first 16 with ntohl(input) */ - uint32_t bytes; -}; - -/* Rotate right macro. GCC can usually get this right. */ -#define ROTR(x,s) ((x)>>(s) | (x)<<(32-(s))) - -#if 1 -/* - * An implementation of SHA-256 for register-starved architectures like - * x86 or perhaps the MSP430. (Although the latter's lack of a multi-bit - * shifter will doom its performance no matter what.) - * This code is also quite small. - * - * If you have 12 32-bit registers to work with, loading the 8 state - * variables into registers is probably faster. If you have 28 registers - * or so, you can put the input block into registers as well. - * - * The key idea is to notice that each round consumes one word from the - * key schedule w[i], computes a new a, and shifts all the other state - * variables down one position, discarding the old h. - * - * So if we store the state vector in reverse order h..a, immediately - * before w[i], then a single base pointer can be incremented to advance - * to the next round. - */ -void -sha256_transform(uint32_t p[76]) -{ - static uint32_t const k[64] = { - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, - 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, - 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, - 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, - 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, - 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, - 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, - 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, - 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, - 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 - }; - /* - * Look, ma, only 6 local variables including p! - * Too bad they're so overloaded it's impossible to give them - * meaningful names. - */ - register uint32_t const *kp; - register uint32_t a, s, t, u; - - /* Step 1: Expand the 16 words of w[], at p[8..23] into 64 words */ - for (u = 8; u < 8+64-16; u++) { - /* w[i] = s1(w[i-2]) + w[i-7] + s0(w[i-15]) + w[i-16] */ - /* Form s0(x) = (x >>> 7) ^ (x >>> 18) ^ (x >> 3) */ - s = t = p[u+1]; - s = ROTR(s, 18-7); - s ^= t; - s = ROTR(s, 7); - s ^= t >> 3; - /* Form s1(x) = (x >>> 17) ^ (x >>> 19) ^ (x >> 10) */ - a = t = p[u+14]; - a = ROTR(a, 19-17); - a ^= t; - a = ROTR(a, 17); - a ^= t >> 10; - - p[u+16] = s + a + p[u] + p[u+9]; - } - - /* Step 2: Copy the initial values of d, c, b, a out of the way */ - p[72] = p[4]; - p[73] = p[5]; - p[74] = p[6]; - p[75] = a = p[7]; - - /* - * Step 3: The big loop. - * We maintain p[0..7] = h..a, and p[8] is w[i] - */ - kp = k; - - do { - /* T1 = h + S1(e) + Ch(e,f,g) + k[i] + w[i] */ - /* Form Ch(e,f,g) = g ^ (e & (f ^ g)) */ - s = t = p[1]; /* g */ - s ^= p[2]; /* f ^ g */ - s &= u = p[3]; /* e & (f ^ g) */ - s ^= t; - /* Form S1(e) = (e >>> 6) ^ (e >>> 11) ^ (e >>> 25) */ - t = u; - u = ROTR(u, 25-11); - u ^= t; - u = ROTR(u, 11-6); - u ^= t; - u = ROTR(u, 6); - s += u; - /* Now add other things to t1 */ - s += p[0] + p[8] + *kp; /* h + w[i] + kp[i] */ - /* Round function: e = d + T1 */ - p[4] += s; - /* a = t1 + (t2 = S0(a) + Maj(a,b,c) */ - /* Form S0(a) = (a >>> 2) ^ (a >>> 13) ^ (a >>> 22) */ - t = a; - t = ROTR(t, 22-13); - t ^= a; - t = ROTR(t, 13-2); - t ^= a; - t = ROTR(t, 2); - s += t; - /* Form Maj(a,b,c) = (a & b) + (c & (a ^ b)) */ - t = a; - u = p[6]; /* b */ - a ^= u; /* a ^ b */ - u &= t; /* a & b */ - a &= p[5]; /* c & (a + b) */ - s += u; - a += s; /* Sum final result into a */ - - /* Now store new a on top of w[i] and shift... */ - p[8] = a; - p++; -#if DEBUG - /* If debugging, print out the state variables each round */ - printf("%2u:", kp-k); - for (t = 8; t--; ) - printf(" %08x", p[t]); - putchar('\n'); -#endif - } while (++kp != k+64); - - /* Now, do the final summation. */ - p -= 64; - /* - * Now, the final h..a are in p[64..71], and the initial values - * are in p[0..7]. Except that p[4..7] got trashed in the loop - * above, so use the copies we made. - */ - p[0] += p[64]; - p[1] += p[65]; - p[2] += p[66]; - p[3] += p[67]; - p[4] = p[68] + p[72]; - p[5] = p[69] + p[73]; - p[6] = p[70] + p[74]; - p[7] = a + p[75]; -} - -#else - -/* A space-optimized ARM assembly implementation */ -void sha256_transform(uint32_t p[8+64]); - -#endif - -/* Initial values H0..H7 for SHA-256, and SHA-224. */ -static uint32_t const sha256_iv[8] = { - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, - 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 -}; -#if 0 -static uint32_t const sha224_iv[8] = { - 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, - 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 -}; -#endif - -void -sha256_begin(struct sha256_state *s) -{ - memcpy(s->iv, sha256_iv, sizeof sha256_iv); - s->bytes = 0; -} - -#include <netinet/in.h> /* For ntohl, htonl */ - -void -sha256_hash(unsigned char const *data, size_t len, struct sha256_state *s) -{ - unsigned space = 64 - (unsigned)s->bytes % 64; - unsigned i; - - s->bytes += len; - - while (len >= space) { - memcpy((unsigned char *)s->w + 64 - space, data, space); - len -= space; - space = 64; - for (i = 0; i < 16; i++) - s->w[i] = ntohl(s->w[i]); - sha256_transform(s->iv); - } - memcpy((unsigned char *)s->w + 64 - space, data, len); -} - -void -sha256_end(unsigned char hash[32], struct sha256_state *s) -{ - static unsigned char const padding[64] = { 0x80, 0, 0 /* ,... */ }; - uint32_t bytes = s->bytes; - unsigned i; - - /* Add trailing bit padding. */ - sha256_hash(padding, 64 - ((bytes+8) & 63), s); - assert(s->bytes % 64 == 56); - - /* Byte-swap and hash final block */ - for (i = 0; i < 14; i++) - s->w[i] = ntohl(s->w[i]); - s->w[14] = 0; /* We don't even try */ - s->w[15] = s->bytes << 3; - sha256_transform(s->iv); - - for (i = 0; i < 8; i++) - s->iv[i] = htonl(s->iv[i]); - memcpy(hash, s->iv, sizeof s->iv); - memset(s, 0, sizeof *s); /* Good cryptographic hygiene */ -} - -void -sha256(unsigned char hash[32], const unsigned char *data, size_t len) -{ - struct sha256_state s; - sha256_begin(&s); - sha256_hash(data, len, &s); - sha256_end(hash, &s); -} diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/sha256_core.s b/libs/libzrtp/third_party/bnlib/bignum-ARM/sha256_core.s deleted file mode 100644 index 634af9f331..0000000000 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/sha256_core.s +++ /dev/null @@ -1,157 +0,0 @@ -@ ARM procedure call convention: -@ r0..r3, r12 (ip) and r14 (lr) are volatile. Args are passed in r0..r3, -@ and the return address in r14. -@ -@ All other registers must be preserved by the callee. r13 (sp) and r15 (pc) -@ are as expected. -@ -@ The usual convention is to push all the needed registers, including r14, -@ on the stack, and the restore them at the end, but to r15 rather than r14. -@ This, however, WILL NOT WORK for Thumb code. You have to use the "bx" -@ instruction for that, so you need one more trailing instruction. - - .text - .align 2 - .type k_table, %object -k_table: - .word 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b - .word 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01 - .word 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7 - .word 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc - .word 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152 - .word 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147 - .word 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc - .word 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85 - .word 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819 - .word 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08 - .word 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f - .word 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208 - .word 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 - .size k_table, .-k_table - -@ We use 13 local variables: -pp .req r0 @ The argument, points to the IV and w[] space -aa .req r1 @ Working variable. -bb .req r2 -cc .req r3 -dd .req r4 -ee .req r5 -ff .req r6 -gg .req r7 -hh .req r8 -ii .req r9 @ Loop index -tt .req r10 @ General purpose temp -kk .req r11 @ k+64 (k_table+256) -ww .req r12 @ Actually, w+64 much of the time -@ We could use r14 as well, but don't need to. -@ (The names are doubled because a sigle b is "branch"! -@ -@ This function takes a pointer to an array of 72 32-bit words: -@ The first 8 are the state vector a..h -@ The next 16 are the input data words w[0..15], in native byte order. -@ The next 48 are used to hold the rest of the key schedule w[16..63]. - - .global sha256_transform - .type sha256_transform, %function -sha256_transform: - stmfd sp!, {r4,r5,r6,r7,r8,r9,r10,r11} - add ww, pp, #4*(8+16) @ w + 16 = p + 8 + 16 - mov ii, #64-16 @ loop counter - - @ Fill in words 16..63 of the w[] array, at p+24..p+71 -1: - @ ww[i] = w[i-16] + s0(w[i-15]) + w[i-7] + s1(w[i-2]) - ldr aa, [ww, #-64] @ a = w[i-16] - ldr bb, [ww, #-60] @ b = w[i-15] - ldr cc, [ww, #-28] @ c = w[i-7] - add aa, aa, cc @ a += c (= w[i-7]) - - @ s0(x) = (x >>> 7) ^ (x >>> 18) ^ (x >> 3) - mov cc, bb, ror #18 @ c = b>>>18 - eor cc, cc, bb, ror #7 @ c ^= b>>>7 - eor cc, cc, bb, lsr #3 @ c ^= b>>3 - ldr bb, [ww, #-8] @ b = w[i-2] - add aa, aa, cc @ a += c (= s0(w[i-15])) - @ s1(x) = (x >>> 17) ^ (x >>> 19) ^ (x >> 10) - mov cc, bb, ror #19 @ c = b>>>19 - eor cc, cc, bb, ror #17 @ c ^= b>>>17 - eor cc, cc, bb, lsr #10 @ c ^= b>>10 - add aa, aa, cc @ a += c (= s1(w[i-2])) - - subs ii, ii, #1 @ --i - str aa, [ww], #4 @ w[i++] = a - bne 1b - - - @ The main loop. Arrays are indexed with i, which starts at -256 - @ and counts up to 0. In addition to t, we use h as a working - @ variable for the first part of the loop, until doing the - @ big register rotation, then a as a temp for the last part. - - ldmia pp, {aa,bb,cc,dd,ee,ff,gg,hh} @ Load a..h - mov ii, #-256 @ i = -64 (*4 strength-reduced) - adr kk, k_table+256 @ Load up r12 to the END of k -2: - @ t = h + S1(e) + Ch(e,f,g) + k[i] + w[i] - @ Form t = Ch(e,f,g) = (g ^ (e & (f ^ g)) - eor tt, ff, gg @ t = f^g - and tt, tt, ee @ t &= e - eor tt, tt, gg @ t ^= g - - add tt, tt, hh @ t += h - - @ Form t += S1(e) = (e >>> 6) ^ (e >>> 11) ^ (e >>> 25) - eor hh, ee, ee, ror #25-6 @ h = e ^ e>>>(25-6) - eor hh, hh, ee, ror #11-6 @ h = h ^ e>>>(11-6) - add tt, tt, hh, ror #6 @ t += h>>>6 - - @ Add k[i] and w[i]. Note that -64 <= i < 0. - ldr hh, [ww, ii] @ h = w[64+i] - add tt, tt, hh - ldr hh, [kk, ii] @ h = k[64+i] - add tt, tt, hh - adds ii, ii, #4 @ ++i (*4 strength-reduced) - - @ Copy (h,g,f,e,d,c,b) = (g,f,e,d+t1,c,b,a) - @ This could be shrunk with aa big stm/ldm pair, but that - @ seems terribly wasteful... - mov hh, gg @ h = g - mov gg, ff @ g = f - mov ff, ee @ f = e - add ee, dd, tt @ e = d + t - mov dd, cc @ d = c - mov cc, bb @ c = b - mov bb, aa @ b = a - - @ a = t + S0(b) + Maj(b,c,d) - @ Form t += S0(b) = (b >>> 2) ^ (b >>> 13) ^ (b >>> 22) */ - eor aa, bb, bb, ror #22-2 @ a = b ^ b>>>(22-2) - eor aa, aa, bb, ror #13-2 @ a = a ^ b>>>(13-2) - add tt, tt, aa, ror #2 @ t += a>>>2 - - @ Form a = t + Maj(b,c,d) = (c & d) + (b & (c ^ d)) - and aa, cc, dd @ a = c & d - add tt, tt, aa @ t += a - eor aa, cc, dd @ a = c ^ d - and aa, aa, bb @ a &= b - add aa, aa, tt @ a += t - - bne 2b @ while (i != 0) - - @ Now, the final summation. Minimum code size is tricky... - ldmia pp!, {ii,tt,kk,ww} @ Load old iv[0..3] - add aa, aa, ii @ a += iv[0] - add bb, bb, tt @ b += iv[1] - add cc, cc, kk @ c += iv[2] - add dd, dd, ww @ d += iv[3] - ldmia pp!, {ii,tt,kk,ww} @ Load old iv[4..7] - add ee, ee, ii @ e += iv[4] - add ff, ff, tt @ f += iv[5] - add gg, gg, kk @ g += iv[6] - add hh, hh, ww @ h += iv[7] - stmfd pp, {aa,bb,cc,dd,ee,ff,gg,hh} @ Store new iv[0..7] - - ldmfd sp!, {r4,r5,r6,r7,r8,r9,r10,r11} - bx lr - - .size sha256_transform, .-sha256_transform diff --git a/libs/libzrtp/third_party/bnlib/bn.c b/libs/libzrtp/third_party/bnlib/bn.c deleted file mode 100644 index d9043a82fa..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn.c - the high-level bignum interface - */ - -#include "bn.h" - -/* Functions */ -void -bnBegin(struct BigNum *bn) -{ - static int bninit = 0; - - if (!bninit) { - bnInit(); - bninit = 1; - } - - bn->ptr = 0; - bn->size = 0; - bn->allocated = 0; -} - -void -bnSwap(struct BigNum *a, struct BigNum *b) -{ - void *p; - unsigned t; - - p = a->ptr; - a->ptr = b->ptr; - b->ptr = p; - - t = a->size; - a->size = b->size; - b->size = t; - - t = a->allocated; - a->allocated = b->allocated; - b->allocated = t; -} - -int (*bnYield)(void); - -void (*bnEnd)(struct BigNum *bn); -int (*bnPrealloc)(struct BigNum *bn, unsigned bits); -int (*bnCopy)(struct BigNum *dest, struct BigNum const *src); -void (*bnNorm)(struct BigNum *bn); -void (*bnExtractBigBytes)(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned len); -int (*bnInsertBigBytes)(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); -void (*bnExtractLittleBytes)(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned len); -int (*bnInsertLittleBytes)(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); -unsigned (*bnLSWord)(struct BigNum const *src); -int (*bnReadBit)(struct BigNum const *bn, unsigned bit); -unsigned (*bnBits)(struct BigNum const *src); -int (*bnAdd)(struct BigNum *dest, struct BigNum const *src); -int (*bnSub)(struct BigNum *dest, struct BigNum const *src); -int (*bnCmpQ)(struct BigNum const *a, unsigned b); -int (*bnSetQ)(struct BigNum *dest, unsigned src); -int (*bnAddQ)(struct BigNum *dest, unsigned src); -int (*bnSubQ)(struct BigNum *dest, unsigned src); -int (*bnCmp)(struct BigNum const *a, struct BigNum const *b); -int (*bnSquare)(struct BigNum *dest, struct BigNum const *src); -int (*bnMul)(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); -int (*bnMulQ)(struct BigNum *dest, struct BigNum const *a, unsigned b); -int (*bnDivMod)(struct BigNum *q, struct BigNum *r, struct BigNum const *n, - struct BigNum const *d); -int (*bnMod)(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *d); -unsigned (*bnModQ)(struct BigNum const *src, unsigned d); -int (*bnExpMod)(struct BigNum *result, struct BigNum const *n, - struct BigNum const *exp, struct BigNum const *mod); -int (*bnDoubleExpMod)(struct BigNum *dest, - struct BigNum const *n1, struct BigNum const *e1, - struct BigNum const *n2, struct BigNum const *e2, - struct BigNum const *mod); -int (*bnTwoExpMod)(struct BigNum *n, struct BigNum const *exp, - struct BigNum const *mod); -int (*bnGcd)(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); -int (*bnInv)(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *mod); -int (*bnLShift)(struct BigNum *dest, unsigned amt); -void (*bnRShift)(struct BigNum *dest, unsigned amt); -unsigned (*bnMakeOdd)(struct BigNum *n); -int (*bnBasePrecompBegin)(struct BnBasePrecomp *pre, struct BigNum const *base, - struct BigNum const *mod, unsigned maxebits); -int (*bnBasePrecompCopy)(struct BnBasePrecomp *dst, - struct BnBasePrecomp const *src); -void (*bnBasePrecompEnd)(struct BnBasePrecomp *pre); -int (*bnBasePrecompExpMod)(struct BigNum *dest, - struct BnBasePrecomp const *pre, struct BigNum const *exp, - struct BigNum const *mod); -int (*bnDoubleBasePrecompExpMod)(struct BigNum *dest, - struct BnBasePrecomp const *pre1, struct BigNum const *exp1, - struct BnBasePrecomp const *pre2, struct BigNum const *exp2, - struct BigNum const *mod); diff --git a/libs/libzrtp/third_party/bnlib/bn.doc b/libs/libzrtp/third_party/bnlib/bn.doc deleted file mode 100644 index 1d8dba92e3..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn.doc +++ /dev/null @@ -1,541 +0,0 @@ -* The BigNum multi-precision integer math library - -This is a multi-precision math library designed to be very portable, -reasonably clean and easy to use, have very liberal bounds on the sizes -of numbers that can be represented, but above all to perform extremely -fast modular exponentiation. It has some limitations, such as -representing positive numbers only, and supporting only odd moduli, -which simplify it without impairing this ability. - -A second speed goal which has had considerable effort applied to it is -prime number generation. - -Finally, while there is probably a long way to go in this direction, -some effort has gone into commenting the code a lot more than seems to -be fashionable among mathematicians. - -It is written in C, and should compile on any platform with an ANSI C -compiler and 16 and 32-bit unsigned data types, but various primitives -can be replaced with assembly versions in a great variety of ways for -greater speedup. See "bnintern.doc" for a description. - -In case you're wondering, yes C++ would produce a much nicer syntax -for working with these numbers, but there are a lot of compilers out -there that actually implement ANSI C, and get it almost right. I have -a few kludges to deal with some that get little things wrong, but -overall it's not too difficult to write code that I can be sure -will work on lots of machines. And porting it to a K&R C compiler, -if it ever becomes necessary, shouldn't be all *that* difficult. - -The C++ compiler world is a less friendly place. First of all, C++ -compilers are still not as common as C compilers, so that hurts -portability right there, and I don't need the extra power to write my -code. C++ compilers all seem to have important bugs, and different -bugs for each compiler. First I have to learn all the foibles of a -whole lot of C++ compilers, and then I have write code that uses only -the features that work in all of them. This is a language not a whole -heck of a lot bigger than C. - -(The fact that it drives me *batty* the way that C++ drags *everything* -into the same name space is also a contributing factor. I *like* -writing "struct" (or "class") before structure names. I *like* putting -"this->" in front of member references. It makes it clear to me, when -reading a single line of code, roughly what is being affected by it and -where I can find the relevant source code to find out more. I've seen -people develop complicated naming conventions to make all this clear, -but the conventions are still very much in flux.) - -Anyway... - -The main public interface is contained in the file bn.h. This is -mostly a bunch of pointers to functions which start out uninitialized, -but are set by bnInit() (which is called by bnBegin()). - -All of the public routines have names of the bnFunction variety. -Some internal routines are lbnFunction, but you should never have to -worry about those unless you're hacking with the code. - -The code uses the assert() macro a lot internally. If you do something -you're not supposed to, you'll generally notice because an assert() -will fail. The library does not have special error codes for division -by zero or the like - it assert fails instead. Just don't do that. - -A BigNum is represented by a struct BigNum, which really doesn't -need to be understood, but it often makes me feel better to understand -what's going on, so here it is: - -#> struct BigNum { -#> void *ptr; -#> unsigned size; /* Note: in (variable-sized) words */ -#> unsigned allocated; -#> }; - -The pointer points to the least-significant end of an array of words which -hold the number. The array contains "allocated" words, but only "size" -of them are actually meaningful. The others may have any value. -This is all of limited use because the size of a word is not specified. -In fact, it can change at run time - if you run on an 8086 one day and an -80386 the next, you may find the word size different. - -* Initialization - -The user of the library is responsible for allocating and freeing each -struct BigNum. Usually they're just local variables. All the library -functions take pointers to them. The first thing you need to do is -initialize all the fields to empty, a zero-valued BigNum. This is done -with the function bnBegin: -#> void bnBegin(struct BigNum *bn); - -When you're done with a BigNum, call bnEnd to deallocate the data storage -in preparation for deallocating the structure: -#> void bnEnd(struct BigNum *bn); - -This resets the number to the 0 state. You can actually start using the -number right away again, or call bnEnd again, so if you're really -memory-conscious you might want to use this to free a large -number you're done with this way before going on to use the buffer -for smaller things. - -A simple assignment can be done with bnCopy. -#> int bnCopy(struct BigNum *dest, struct BigNum const *src); - -This sets dest = src, and returns an error code. Most functions in the -library do this, and return 0 on success and -1 if they were unable to -allocate needed memory. If you're lazy and sure you'll never run out -of memory, you can avoid checking this, but it's better to be -paranoid. If a function returns -1, the what has happened to the -destination values is undefined. They're usually unmodified, and -they're always still valid BigNum numbers, but their values might be -strange. - -In general, anywhere that follows, unless otherwise documented, assume -that an "int" return value is 0 for success or -1 for error. - -A trivial little function which is sometimes handy, and quite cheap to -execute (it just swaps the pointers) is: -#> void bnSwap(struct BigNum *a, struct BigNum *b); - -* Input and output - -For now, the library only works with numbers in binary form - there's -no way to get decimal numbers into or out of it. But it's pretty -flexible on how it does that. - -The first function just sets a BigNum to have a small value. There are -several such "quick" forms which work with "small" second operads. -"Small" is defined as less than 65536, the minimum 16-bit word size -supported by the library. The limit applies even if unsigned is larger -or the library is compiled for a larger word size. -#> int bnSetQ(struct BigNum *dest, unsigned src); - -This returns the usual -1 error if it couldn't allocate memory. - -There's also a function to determine the size of a BigNum, in bits. -The size is the number of bits required to represent the number, -0 if the number is 0, and floor(log2(src)) + 1 otherwise. E.g. 1 is -the only 1-bit number, 2 and 3 are 2-bit numbers, etc. -#> unsigned bnBits(struct BigNum const *src); - -If bnBits(src) <= 16, you can get the whole number with this function. -If it's larger, you get the low k bits, where k is at least 16. -(This doesn't bother masking if it's easy to return more, but you -shouldn't rely on it.) Even that is useful for many things, like -deciding if a number is even or odd. -#> unsigned bnLSWord(struct BigNum const *src); - -For larger numbers, the format used by the library is an array of -unsigned 8-bit bytes. These bytes may be in big-endian or little-endian -order, and it's possible to examine or change just part of a number. -The functions are: -#> void bnExtractBigBytes(struct BigNum const *bn, unsigned char *dest, -#> unsigned lsbyte, unsigned len); -#> int bnInsertBigBytes(struct BigNum *bn, unsigned char const *src, -#> unsigned lsbyte, unsigned len); -#> void bnExtractLittleBytes(struct BigNum const *bn, unsigned char *dest, -#> unsigned lsbyte, unsigned len); -#> int bnInsertLittleBytes(struct BigNum *bn, unsigned char const *src, -#> unsigned lsbyte, unsigned len); - -These move bytes between the BigNum and the buffer of 8-bit bytes. The -Insert functions can allocate memory, so return an error code. The -Extract functions always succeed. - -The buffer is encoded in base 256, with either the most significant -byte (the Big functions) or the least significant byte (the Little -functions) coming first. "len" is the length of the buffer, so the -buffer always encodes a value between 0 and 256^len. (That's -"to the power of", not "xor".) - -"lsbyte" gives the offset into the BigNum which is being worked with. -This is usually zero, but you can, for example, read out a large -BigNum in 32-byte chunks, using a len of 32 and an lsbyte of 0, 32, -64, 96, etc. - -After these complete, the number encoded in the buffer will be -equal to (bn / 256^lsbyte) % 256^len. The only difference between -Insert and Extract is which is changed to match the other. - -* Simple math - -#> int bnAdd(struct BigNum *dest, struct BigNum const *src); -#> int bnAddQ(struct BigNum *dest, unsigned src); - -These add dest += src. In the Q form, as mentioned above with bnSetQ, -src must be < 65536. In either case, the functions can fail and return --1, as usual. - -#> int bnSub(struct BigNum *dest, struct BigNum const *src); -#> int bnSubQ(struct BigNum *dest, unsigned src); - -These subtract dest -= src. If this would make the result negative, -dest is set to (src-dest) and a value of 1 is returned, so you can -keep track of a separate sign if you need to. Otherwise, they return -0 on success and -1 if they were unable to allocate needed memory. - -To make your life simpler if you are error checking, these four functions -are guaranteed not to allocate memory unnecessarily. So if you know -that the addition or subtraction you're doing won't produce a result -larger than the input, and won't underflow either (like subtracting 1 -from an odd number or adding 1 to an even number), you can skip checking -the error code. - -#> extern int (*bnCmp)(struct BigNum const *a, struct BigNum const *b); -#> extern int (*bnCmpQ)(struct BigNum const *a, unsigned b); - -This returns the sign (-1, 0 or +1) of a-b. Another way of saying -this is that a <=> b is the same as bnCmp(a, b) <=> 0, where "<=>" -stands for one of <, <=, =, !=, >= or >. The bnCmpQ form is the same, -but (as in all the Q functions) the second argument is a number < 65536. - -#> int bnSquare(struct BigNum *dest, struct BigNum const *src); - -This computes dest = src^2, returning an error if it ran out of memory. -If you care about performance tuning, this slows down when dest and -src are the same BigNum, since it needs to allocate a temporary buffer -to do the work in. It does work, however. - -#> int bnMul(struct BigNum *dest, struct BigNum const *a, -#> struct BigNum const *b); -#> int bnMulQ(struct BigNum *dest, struct BigNum const *a, unsigned b); - -These compute dest = a * b, and work in the same way as bnSquare. -(Including the fact that it's faster if dest is not the same as any of -the inputs.) bnSquare is faster if a and b are the same. The second -input operand to bnMulQ must be < 65536, like all the "Q" functions. - -#> int bnDivMod(struct BigNum *q, struct BigNum *r, -#> struct BigNum const *n, struct BigNum const *d); - -This computes division with remainder, q = n/d and r = n%d. Don't -pass in a zero d; it will blow up. In general, all of the values -must be different (it will blow up if you try), but r and n may be the -same. - -RE-ENTRANCY NOTE: This temporarily modifies the BigNum "d" internally, -although it restores it before returning. If you're doing something -multi-threaded, you can't share the d value between threads, even though -it says "const". That's a safe assumption elsewhere, but this is an -exception. - -That note also means that it's not safe to let n be the same as d, -although that's such a stupid way to set q to 1 and r to 0 that -I don't think it's worth worrying about. (I hope you understand that -this doesn't mean that n and d can't have the same numerical value, -just that they can't both point to the same struct BigNum.) - -#> int bnMod(struct BigNum *dest, struct BigNum const *src, -#> struct BigNum const *d); - -This works just the same as the above, but doesn't bother you with the -quotient. (No, there's no function that doesn't bother you with the -remainder.) Again, dest and src may be the same (it's actually -more efficient if they are), but d may not be the same as either. - -#> unsigned int bnModQ(struct BigNum const *src, unsigned d); - -This also computes src % d, but does so for small (up to 65535, -the usual limit on "Q" functions) values of d. It returns the -remainder. (No error is possible.) - -* Advanced math - -#> int bnLShift(struct BigNum *dest, unsigned amt); -#> void bnRShift(struct BigNum *dest, unsigned amt); - -These shift the given bignum left or right by "amt" bit positions. -Left shifts multiply by 2^amt, and may have to allocate memory -(and thus fail). Right shifts divide by 2^amt, throwing away the -remainder, and can never fail. - -#> unsigned bnMakeOdd(struct BigNum *n); - -This right shifts the input number as many places as possible without -throwing anything away, and returns the number of bits shifted. -If you see "let n = s * 2^t, where s is odd" in an algorithm, -this is the function to call. It modifies n in place to produce s -and returns t. - -This returns 0 if you pass it 0. - -#> int bnExpMod(struct BigNum *result, struct BigNum const *n, -#> struct BigNum const *exp, struct BigNum const *mod); - -Ah, now we get to the heart of the library - probably the most heavily -optimized function in it. This computes result = n^exp, modulo "mod". -result may be the same as n, but not the same as exp or mod. For large -exponents and moduli, it can try to allocate quite a bit of working -storage, although it will manage to finish its work (just slower) -if some of those allocations fail. (Not all, though - the first few -are essential.) - -"mod" must be odd. It will blow up if not. Also, n must be less than -mod. If you're not sure if it is, use bnMod first. The return value -is always between 0 and mod-1. - -#> int bnTwoExpMod(struct BigNum *result, struct BigNum const *exp, -#> struct BigNum const *mod); - -This computes result = 2^exp, modulo "mod". It's faster than the general -bnExpMod function, although that function checks to see if n = 2 and calls -this one internally, so you don't need to check yourself if you're not -sure. The main reason to mention this is that if you're doing something -like a pseudoprimality test, using a base of 2 first can save some time. - -#> int bnDoubleExpMod(struct BigNum *result, -#> struct BigNum const *n1, struct BigNum const *e1, -#> struct BigNum const *n2, struct BigNum const *e2, -#> struct BigNum const *mod); - -This computes dest = n1^e1 * n2^e2, modulo "mod". It does it quite -a bit faster than doing two separate bnExpMod operations; in fact, -it's not that much more expensive than one. "result" may be the -same BigNum as n1 or n2, but it may not be the same as the exponents -or the modulus. All of the other caveats about bnExpMod apply. - -#> int bnGcd(struct BigNum *dest, struct BigNum const *a, -#> struct BigNum const *b); - -This returns dest = gcd(a,b). dest may be the same as either input. - -/* dest = src^-1, modulo "mod". dest may be the same as src. */ -#> int bnInv(struct BigNum *dest, struct BigNum const *src, -#> struct BigNum const *mod); - -This requires that gcd(src, mod) = 1, and returns dest = src^-1, modulo -"mod". That is, 0 < dest < mod and dest*src = 1, modulo "mod". -dest and src may be the same, but mod must be different. - -This will probably get extended at some point to find dest such that -dest * src = gcd(src, mod), modulo "mod", but that isn't implemented -yet. - -* Auxiliary functions - -These mostly-internal functions aren't very useful to call directly, -and might even get removed, but for now they're there in the unusual -case where you might want them. - -#> void bnInit(void); - -This does global library initialization. It is called by the first -call to bnBegin(), so you shouldn't need to call it explicitly. It is -idempotent, so you can call it multiple times if you like. The only -thing it does right now is set up the function pointers to the rest of -the library. If a program crashes and the debugger tells you that -it's trying to execute at address 0, bnInit never got called. - -#> int bnPrealloc(struct BigNum *bn, unsigned bits); - -This preallocates space in bn to make sure that it can hold "bits" bits. -If the overflow characteristics of various algorithms get documented -better, this might allow even more error-checking to be avoided, but -for now it's only to reduce memory fragmentation. - -#> void bnNorm(struct BigNum *bn); - -This decreases the "size" field of the given bignum until it has no leading -zero words in its internal representation. Given that almost everything -in the library does the equivalent of this on input and output, the utility -of this function is a bit dubious. It's kind of a legacy. - -* Extra libraries - -There are a number of utilities built on top of the basic library. -They are built on top of the interfaces just described, and can be used -if you like. - -* jacobi.h - -#> int bnJacobiQ(unsigned p, struct BigNum const *bn); - -This returns the Jacobi symbol J(p,bn), where p is a small number. -The Jacobi symbol is always -1, 0, or +1. You'll note that p may -only be positive, even though the Jacobi symbol is defined for -negative p. If you want to worry about negative p, do it yourself. -J(-p,bn) = (bnLSWord(bn) & 2 ? -1 : +1) * bnJacobiQ(p, bn). - -A function to compute the Jacobi symbol for large p would be nice. - -* prime.h - -#> int primeGen(struct BigNum *bn, unsigned (*rand)(unsigned), -#> int (*f)(void *arg, int c), void *arg, unsigned exponent, ...); - -This finds the next prime p >= bn, and sets bn to equal it. -Well, sort of. - -It always leaves bn at least as large as when it started (unless it -runs out of memory and returns -1), and if you pass a 0 for the rand -function, it will be the next prime >= bn. - -Except: -- It doesn't bother coping with small primes. If it's divisible by any -prime up to 65521, it's considered non-prime. Even if the quotient is 0. -If you pass in "1", expecting to get "2" back, you'll get 65537. Maybe -it would be nice to fix that. -- It actually only does a few strong pseudoprimality tests to fixed -bases to determine if the candidate number is prime. For random input, -this is fine; the chance of error is so infinitesimal that it is -absolutely not worth worrying about. But if you give it numbers carefully -chosen to be strong pseudoprimes, it will think they're primes and not -complain. For example, 341550071728321 = 10670053 * 32010157 will -pass the primality test quite handily. So will -68528663395046912244223605902738356719751082784386681071. -- If you supply a rand() function, which returns 0 <= rand(n) < n -(n never gets very large - currently, at most 256), this shuffles the -candidates before testing and accepting one. If you want a "random" -prime, this produces a more uniformly distributed prime, while -retaining all of the speed advantages of a sequential search from a -random starting point, which would otherwise produce a bias towards -primes which were not closely preceded by other primes. So, for -example, the second of a pair of twin primes would be very unlikely to -be chosen. rand() doesn't totally flatten the distribution, but it -comes very close. - -The "f" function is called periodically during the progress of the -search (which can take a while) with the supplied argument (for private -context) and a character c, which sort of tells you what it's doing. -c is either '.' or '*' (if it's found something and is confirming that -it's really prime) or '/' (if it's having a really hard time finding -something). Also, if f returns < 0, primeGen immediately returns that -value. This can form the basis for a user interface which can show some -life occasionally and abort the computation if desired. - -If you just print these characters to the screen, don't forget to -fflush() after printing them. - -Finally, "exponent, ..." is a zero-terminated list of small numbers -which must not divide p-1 when the function returns. If the numbers -are chosen to be the prime factors of n, then gcd(n, p-1) will be -1, so the map f(x) -> x^n is invertible modulo p. - -#> int primeGenStrong(struct BigNum *bn, struct BigNum const *step, -#> int (*f)(void *arg, int c), void *arg); - -This is similar, but searches in steps of "step", rather than 1, from the -given starting value. The starting value must be odd and the step -size must be even! If you start with bn == 1 (mod step), and step -is 2*q, where q is a large prime, then this generates "strong" primes, -p-1 having a large prime factor q. There are other uses, too. - -#ifdef __cplusplus -} -#endif - -* germain.h - -#> int germainPrimeGen(struct BigNum *bn, int (*f)(void *arg, int c), -#> void *arg); - -This increases bn until it is a Sophie Germain prime, that is, a number p -such that p and (p-1)/2 are both prime. These numbers are rarer than -ordinary primes and the search takes correspondingly longer. - -It omits the randomization portion of primeGen, and the exponent list, -since the factors of bn-1 are known already. The f function for -progress is the same, but it is also sometimes passed a '+' or '-' -character when it's found a (p-1)/2 that's prime. This is just to lend -some interest to an otherwise very boring row of dots. Finding large -primes with this function, even though it's pretty optimized, takes a -*while*, and otherwise once the screen filled with dots (one every few -seconds) it would be hard to keep track of the scroll. - -It varies a lot, depending on luck of the starting value and the speed -of your machine, but if your starting number is over 1024 bits, plan on -over an hour of run time, and if it's over 2048 bits, plan on a day. -At 4096 bits, start thinking about a week. - -Past that, supporting checkpoint/restart is a good idea. Every time -the progress function gets a '/' is probably a good interval, and when -it happens have f return a distinct error value like -2. When -germainPrimeGen returns with that value, save the value in bn to a file -somewhere and call it again with the same bn to continue searching. - -* sieve.h - -This is the sieving code that the other prime-finding functions call -to do trial division. You might use it if you are doing some magic -prime-finding of your own. A sieve is an array of bits, stored -little-endian in an array of bytes (i.e. the lsb of byte 0 is bit 0). -Sieves are indexed with the "unsigned" data type, so should not, for -portability, be larger than 65536/8 = 8192 bytes long. - -A 1 bit is considered "in" the sieve, it has passed all the sieving. -A 0 bit has been removed by some step. - -The functions are: - -#> void sieveSingle(unsigned char *array, unsigned size, unsigned start, -#> unsigned step); - -This (efficiently) clears the bits at positions start, start+step, -start+2*step, etc. in the sieve given by array and size. This is the -elementary sieve-building step. Start with a sieve of all 1s, and -apply this as required. - -#> unsigned sieveSearch(unsigned char const *array, unsigned size, -#> unsigned start); - -This returns the next bit position *greater than* start which is set -in the indicated sieve, or 0 on failure. NOTE that this means that -you have to look at the bit at position 0 (array[0] & 1) by yourself -if you want to pay attention to it, because there's no way to tell -sieveSearch to start searching at 0 - it starts at start+1. - -#> int sieveBuild(unsigned char *array, unsigned size, struct BigNum const *bn, -#> unsigned step, unsigned dbl); - -This initializes a sieve where, if bit i is set, then bn+step*i is not -divisible by any small primes. (Small is from 2 through 65521, the -largest prime less that 65536.) If "dbl" is > 0, then bits are also -cleared if 2*(bn+step*i)+1 is divisible. If dbl > 1, then -4*(bn+step*i)+3 is also checked, and so on. This feature is used when -generating Sohpie Germain primes. - -Usually, you use a step of 2. - -#> int sieveBuildBig(unsigned char *array, unsigned size, -#> struct BigNum const *bn, struct BigNum const *step, unsigned dbl); - -This is just the same, but accepts a BigNum step size, and is correspondingly -slower. - -* bnprint.h - -#> int bnPrint(FILE *f, char const *prefix, struct BigNum const *bn, -#> char const *suffix); - -This prints a nicely-formatted BigNum in hexadecimal form to the given -FILE *. The "prefix" is printed before it, as a prompt, and the -"suffix" is printed afterwards. The BigNum itself is printed in -64-character lines, broken with a trailing backslash if necessary. -Continuation lines are indented by the length of the prefix. - -E.g. a 2^512-1, printed with the call bnPrint(stdout, "a = (", bn, ")\n") -would result in: - -a = (FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\ - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) - -Hex digits are printed in upper case to facilitate cutting and pasting into -the Unix "dc" utility. diff --git a/libs/libzrtp/third_party/bnlib/bn.h b/libs/libzrtp/third_party/bnlib/bn.h deleted file mode 100644 index 87c08c3180..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn.h +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn.h - the interface to the bignum routines. - * All functions which return ints can potentially allocate memory - * and return -1 if they are unable to. All "const" arguments - * are unmodified. - * - * This is not particularly asymmetric, as some operations are of the - * form a = b @ c, while others do a @= b. In general, outputs may not - * point to the same struct BigNums as inputs, except as specified - * below. This relationship is referred to as "being the same as". - * This is not numerical equivalence. - * - * The "Q" operations take "unsigned" inputs. Higher values of the - * extra input may work on some implementations, but 65535 is the - * highest portable value. Just because UNSIGNED_MAX is larger than - * that, or you know that the word size of the library is larger than that, - * that, does *not* mean it's allowed. - */ -#ifndef BN_H -#define BN_H - -struct BigNum { - void *ptr; - unsigned size; /* Note: in (variable-sized) words */ - unsigned allocated; -}; - -/* - * User-supplied function: if non-NULL, this is called during long-running - * computations. You may put Yield() calls in here to give CPU time to - * other processes. You may also force the computation to be aborted, - * by returning a value < 0, which will be the return value of the - * bnXXX call. (You probably want the value to be someting other than - * -1, to distinguish it from a n out-of-memory error.) - * - * The functions that this is called from, and the intervals at which it - * is called, are not well defined, just "reasonably often". (Currently, - * once per exponent bit in nodular exponentiation, and once per two - * divisions in GCD and inverse computation.) - */ -extern int (*bnYield)(void); - -/* Functions */ - -/* - * You usually never have to call this function explicitly, as - * bnBegin() takes care of it. If the program jumps to address 0, - * this function has bot been called. - */ -void bnInit(void); - -/* - * This initializes an empty struct BigNum to a zero value. - * Do not use this on a BigNum which has had a value stored in it! - */ -void bnBegin(struct BigNum *bn); - -/* Swap two BigNums. Cheap. */ -void bnSwap(struct BigNum *a, struct BigNum *b); - -/* Reset an initialized bigNum to empty, pending deallocation. */ -extern void (*bnEnd)(struct BigNum *bn); - -/* - * If you know you'll need space in the number soon, you can use this function - * to ensure that there is room for at least "bits" bits. Optional. - * Returns <0 on out of memory, but the value is unaffected. - */ -extern int (*bnPrealloc)(struct BigNum *bn, unsigned bits); - -/* Hopefully obvious. dest = src. dest may be the same as src. */ -extern int (*bnCopy)(struct BigNum *dest, struct BigNum const *src); - -/* - * Mostly done automatically, but this removes leading zero words from - * the internal representation of the BigNum. Use is unclear. - */ -extern void (*bnNorm)(struct BigNum *bn); - -/* - * Move bytes between the given buffer and the given BigNum encoded in - * base 256. I.e. after either of these, the buffer will be equal to - * (bn / 256^lsbyte) % 256^len. The difference is which is altered to - * match the other! - */ -extern void (*bnExtractBigBytes)(struct BigNum const *bn, - unsigned char *dest, unsigned lsbyte, unsigned len); -extern int (*bnInsertBigBytes)(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); - -/* The same, but the buffer is little-endian. */ -extern void (*bnExtractLittleBytes)(struct BigNum const *bn, - unsigned char *dest, unsigned lsbyte, unsigned len); -extern int (*bnInsertLittleBytes)(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); - -/* Return the least-significant bits (at least 16) of the BigNum */ -extern unsigned (*bnLSWord)(struct BigNum const *src); - -/* Return the selected bit of the BigNum (bit 0 is bn mod 2) */ -extern int (*bnReadBit)(struct BigNum const *bn, unsigned bit); - -/* - * Return the number of significant bits in the BigNum. - * 0 or 1+floor(log2(src)) - */ -extern unsigned (*bnBits)(struct BigNum const *src); -#define bnBytes(bn) ((bnBits(bn)+7)/8) - -/* - * dest += src. dest and src may be the same. Guaranteed not to - * allocate memory unnecessarily, so if you're sure bnBits(dest) - * won't change, you don't need to check the return value. - */ -extern int (*bnAdd)(struct BigNum *dest, struct BigNum const *src); - -/* - * dest -= src. dest and src may be the same, but bnSetQ(dest, 0) is faster. - * if dest < src, returns +1 and sets dest = src-dest. - */ -extern int (*bnSub)(struct BigNum *dest, struct BigNum const *src); - -/* Return sign (-1, 0, +1) of a-b. a <=> b --> bnCmpQ(a, b) <=> 0 */ -extern int (*bnCmpQ)(struct BigNum const *a, unsigned b); - -/* dest = src, where 0 <= src < 2^16. */ -extern int (*bnSetQ)(struct BigNum *dest, unsigned src); - -/* dest += src, where 0 <= src < 2^16 */ -extern int (*bnAddQ)(struct BigNum *dest, unsigned src); - -/* dest -= src, where 0 <= src < 2^16 */ -extern int (*bnSubQ)(struct BigNum *dest, unsigned src); - -/* Return sign (-1, 0, +1) of a-b. a <=> b --> bnCmp(a, b) <=> 0 */ -extern int (*bnCmp)(struct BigNum const *a, struct BigNum const *b); - -/* dest = src^2. dest may be the same as src, but it costs time. */ -extern int (*bnSquare)(struct BigNum *dest, struct BigNum const *src); - -/* dest = a * b. dest may be the same as a or b, but it costs time. */ -extern int (*bnMul)(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); - -/* dest = a * b, where 0 <= b < 2^16. dest and a may be the same. */ -extern int (*bnMulQ)(struct BigNum *dest, struct BigNum const *a, unsigned b); - -/* - * q = n/d, r = n%d. r may be the same as n, but not d, - * and q may not be the same as n or d. - * re-entrancy issue: this temporarily modifies d, but restores - * it for return. - */ -extern int (*bnDivMod)(struct BigNum *q, struct BigNum *r, - struct BigNum const *n, struct BigNum const *d); -/* - * dest = src % d. dest and src may be the same, but not dest and d. - * re-entrancy issue: this temporarily modifies d, but restores - * it for return. - */ -extern int (*bnMod)(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *d); - -/* return src % d, where 0 <= d < 2^16. */ -extern unsigned int (*bnModQ)(struct BigNum const *src, unsigned d); - -/* n = n^exp, modulo "mod" "mod" *must* be odd */ -extern int (*bnExpMod)(struct BigNum *result, struct BigNum const *n, - struct BigNum const *exp, struct BigNum const *mod); - -/* - * dest = n1^e1 * n2^e2, modulo "mod". "mod" *must* be odd. - * dest may be the same as n1 or n2. - */ -extern int (*bnDoubleExpMod)(struct BigNum *dest, - struct BigNum const *n1, struct BigNum const *e1, - struct BigNum const *n2, struct BigNum const *e2, - struct BigNum const *mod); - -/* n = 2^exp, modulo "mod" "mod" *must* be odd */ -extern int (*bnTwoExpMod)(struct BigNum *n, struct BigNum const *exp, - struct BigNum const *mod); - -/* dest = gcd(a, b). The inputs may overlap arbitrarily. */ -extern int (*bnGcd)(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); - -/* dest = src^-1, modulo "mod". dest may be the same as src. */ -extern int (*bnInv)(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *mod); - -/* Shift dest left "amt" places */ -extern int (*bnLShift)(struct BigNum *dest, unsigned amt); -/* Shift dest right "amt" places, discarding low-order bits */ -extern void (*bnRShift)(struct BigNum *dest, unsigned amt); - -/* For the largest 2^k that divides n, divide n by it and return k. */ -extern unsigned (*bnMakeOdd)(struct BigNum *n); - -/* - * Precomputed data for rapid base^exp (mod mod) computation with fixed - * base and mod. - */ -struct BnBasePrecomp { - void *array; /* Ponter to array of pointers to words */ - unsigned msize; /* Words in modulis (normalized) */ - unsigned bits; /* Bits per array element */ - unsigned maxebits; /* Maximum exponent bits */ - unsigned entries; /* Number of entries */ - unsigned arraysize; -}; - -extern int (*bnBasePrecompBegin)(struct BnBasePrecomp *pre, - struct BigNum const *base, struct BigNum const *mod, - unsigned maxebits); -extern void (*bnBasePrecompEnd)(struct BnBasePrecomp *pre); -extern int (*bnBasePrecompExpMod)(struct BigNum *dest, - struct BnBasePrecomp const *pre, struct BigNum const *exp, - struct BigNum const *mod); -extern int (*bnDoubleBasePrecompExpMod)(struct BigNum *dest, - struct BnBasePrecomp const *pre1, struct BigNum const *exp1, - struct BnBasePrecomp const *pre2, struct BigNum const *exp2, - struct BigNum const *mod); - -#endif/* !BN_H */ diff --git a/libs/libzrtp/third_party/bnlib/bn00.c b/libs/libzrtp/third_party/bnlib/bn00.c deleted file mode 100644 index 3f40113e25..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn00.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn00.c - auto-size-detecting bn??.c file. - * - * Written in 1995 by Colin Plumb. - */ - -#include "bnsize00.h" - -#if BNSIZE64 - -/* Include all of the C source file by reference */ -#include "bn64.c" -#include "bninit64.c" - -#elif BNSIZE32 - -/* Include all of the C source file by reference */ -#include "bn32.c" -#include "bninit32.c" - -#else /* BNSIZE16 */ - -/* Include all of the C source file by reference */ -#include "bn16.c" -#include "bninit16.c" - -#endif diff --git a/libs/libzrtp/third_party/bnlib/bn16.c b/libs/libzrtp/third_party/bnlib/bn16.c deleted file mode 100644 index d81ac6acaa..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn16.c +++ /dev/null @@ -1,1182 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn16.c - the high-level bignum interface - * - * Like lbn16.c, this reserves the string "16" for textual replacement. - * The string must not appear anywhere unless it is intended to be replaced - * to generate other bignum interface functions. - */ - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#if !NO_STRING_H -#include <string.h> /* for memmove() in bnMakeOdd */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -/* - * This was useful during debugging, so it's left in here. - * You can ignore it. DBMALLOC is generally undefined. - */ -#ifndef DBMALLOC -#define DBMALLOC 0 -#endif -#if DBMALLOC -#include "../dbmalloc/malloc.h" -#define MALLOCDB malloc_chain_check(1) -#else -#define MALLOCDB (void)0 -#endif - -#include "lbn.h" -#include "lbn16.h" -#include "lbnmem.h" -#include "bn16.h" -#include "bn.h" - -/* Work-arounds for some particularly broken systems */ -#include "kludge.h" /* For memmove() */ - -/* Functions */ -void -bnInit_16(void) -{ - bnEnd = bnEnd_16; - bnPrealloc = bnPrealloc_16; - bnCopy = bnCopy_16; - bnNorm = bnNorm_16; - bnExtractBigBytes = bnExtractBigBytes_16; - bnInsertBigBytes = bnInsertBigBytes_16; - bnExtractLittleBytes = bnExtractLittleBytes_16; - bnInsertLittleBytes = bnInsertLittleBytes_16; - bnLSWord = bnLSWord_16; - bnReadBit = bnReadBit_16; - bnBits = bnBits_16; - bnAdd = bnAdd_16; - bnSub = bnSub_16; - bnCmpQ = bnCmpQ_16; - bnSetQ = bnSetQ_16; - bnAddQ = bnAddQ_16; - bnSubQ = bnSubQ_16; - bnCmp = bnCmp_16; - bnSquare = bnSquare_16; - bnMul = bnMul_16; - bnMulQ = bnMulQ_16; - bnDivMod = bnDivMod_16; - bnMod = bnMod_16; - bnModQ = bnModQ_16; - bnExpMod = bnExpMod_16; - bnDoubleExpMod = bnDoubleExpMod_16; - bnTwoExpMod = bnTwoExpMod_16; - bnGcd = bnGcd_16; - bnInv = bnInv_16; - bnLShift = bnLShift_16; - bnRShift = bnRShift_16; - bnMakeOdd = bnMakeOdd_16; - bnBasePrecompBegin = bnBasePrecompBegin_16; - bnBasePrecompEnd = bnBasePrecompEnd_16; - bnBasePrecompExpMod = bnBasePrecompExpMod_16; - bnDoubleBasePrecompExpMod = bnDoubleBasePrecompExpMod_16; -} - -void -bnEnd_16(struct BigNum *bn) -{ - if (bn->ptr) { - LBNFREE((BNWORD16 *)bn->ptr, bn->allocated); - bn->ptr = 0; - } - bn->size = 0; - bn->allocated = 0; - - MALLOCDB; -} - -/* Internal function. It operates in words. */ -static int -bnResize_16(struct BigNum *bn, unsigned len) -{ - void *p; - - /* Round size up: most mallocs impose 8-byte granularity anyway */ - len = (len + (8/sizeof(BNWORD16) - 1)) & ~(8/sizeof(BNWORD16) - 1); - p = LBNREALLOC((BNWORD16 *)bn->ptr, bn->allocated, len); - if (!p) - return -1; - bn->ptr = p; - bn->allocated = len; - - MALLOCDB; - - return 0; -} - -#define bnSizeCheck(bn, size) \ - if (bn->allocated < size && bnResize_16(bn, size) < 0) \ - return -1 - -/* Preallocate enough space in bn to hold "bits" bits. */ -int -bnPrealloc_16(struct BigNum *bn, unsigned bits) -{ - bits = (bits + 16-1)/16; - bnSizeCheck(bn, bits); - MALLOCDB; - return 0; -} - -int -bnCopy_16(struct BigNum *dest, struct BigNum const *src) -{ - bnSizeCheck(dest, src->size); - dest->size = src->size; - lbnCopy_16((BNWORD16 *)dest->ptr, (BNWORD16 *)src->ptr, src->size); - MALLOCDB; - return 0; -} - -/* Is this ever needed? Normalize the bn by deleting high-order 0 words */ -void -bnNorm_16(struct BigNum *bn) -{ - bn->size = lbnNorm_16((BNWORD16 *)bn->ptr, bn->size); -} - -/* - * Convert a bignum to big-endian bytes. Returns, in big-endian form, a - * substring of the bignum starting from lsbyte and "len" bytes long. - * Unused high-order (leading) bytes are filled with 0. - */ -void -bnExtractBigBytes_16(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size * (16 / 8); - - /* Fill unused leading bytes with 0 */ - while (s < lsbyte + len) { - *dest++ = 0; - len--; - } - - if (len) - lbnExtractBigBytes_16((BNWORD16 *)bn->ptr, dest, lsbyte, len); - MALLOCDB; -} - -/* The inverse of the above. */ -int -bnInsertBigBytes_16(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size; - unsigned words = (len+lsbyte+sizeof(BNWORD16)-1) / sizeof(BNWORD16); - - /* Pad with zeros as required */ - bnSizeCheck(bn, words); - - if (s < words) { - lbnZero_16((BNWORD16 *)bn->ptr BIGLITTLE(-s,+s), words-s); - s = words; - } - - lbnInsertBigBytes_16((BNWORD16 *)bn->ptr, src, lsbyte, len); - - bn->size = lbnNorm_16((BNWORD16 *)bn->ptr, s); - - MALLOCDB; - return 0; -} - - -/* - * Convert a bignum to little-endian bytes. Returns, in little-endian form, a - * substring of the bignum starting from lsbyte and "len" bytes long. - * Unused high-order (trailing) bytes are filled with 0. - */ -void -bnExtractLittleBytes_16(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size * (16 / 8); - - /* Fill unused leading bytes with 0 */ - while (s < lsbyte + len) - dest[--len] = 0; - - if (len) - lbnExtractLittleBytes_16((BNWORD16 *)bn->ptr, dest, - lsbyte, len); - MALLOCDB; -} - -/* The inverse of the above */ -int -bnInsertLittleBytes_16(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size; - unsigned words = (len+lsbyte+sizeof(BNWORD16)-1) / sizeof(BNWORD16); - - /* Pad with zeros as required */ - bnSizeCheck(bn, words); - - if (s < words) { - lbnZero_16((BNWORD16 *)bn->ptr BIGLITTLE(-s,+s), words-s); - s = words; - } - - lbnInsertLittleBytes_16((BNWORD16 *)bn->ptr, src, lsbyte, len); - - bn->size = lbnNorm_16((BNWORD16 *)bn->ptr, s); - - MALLOCDB; - return 0; -} - -/* Return the least-significant word of the input. */ -unsigned -bnLSWord_16(struct BigNum const *bn) -{ - return bn->size ? (unsigned)((BNWORD16 *)bn->ptr)[BIGLITTLE(-1,0)]: 0; -} - -/* Return a selected bit of the data */ -int -bnReadBit_16(struct BigNum const *bn, unsigned bit) -{ - BNWORD16 word; - if (bit/16 >= bn->size) - return 0; - word = ((BNWORD16 *)bn->ptr)[BIGLITTLE(-1-bit/16,bit/16)]; - return (int)(word >> (bit % 16) & 1); -} - -/* Count the number of significant bits. */ -unsigned -bnBits_16(struct BigNum const *bn) -{ - return lbnBits_16((BNWORD16 *)bn->ptr, bn->size); -} - -/* dest += src */ -int -bnAdd_16(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s = src->size, d = dest->size; - BNWORD16 t; - - if (!s) - return 0; - - bnSizeCheck(dest, s); - - if (d < s) { - lbnZero_16((BNWORD16 *)dest->ptr BIGLITTLE(-d,+d), s-d); - dest->size = d = s; - MALLOCDB; - } - t = lbnAddN_16((BNWORD16 *)dest->ptr, (BNWORD16 *)src->ptr, s); - MALLOCDB; - if (t) { - if (d > s) { - t = lbnAdd1_16((BNWORD16 *)dest->ptr BIGLITTLE(-s,+s), - d-s, t); - MALLOCDB; - } - if (t) { - bnSizeCheck(dest, d+1); - ((BNWORD16 *)dest->ptr)[BIGLITTLE(-1-d,d)] = t; - dest->size = d+1; - } - } - return 0; -} - -/* - * dest -= src. - * If dest goes negative, this produces the absolute value of - * the difference (the negative of the true value) and returns 1. - * Otherwise, it returls 0. - */ -int -bnSub_16(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s = src->size, d = dest->size; - BNWORD16 t; - - if (d < s && d < (s = lbnNorm_16((BNWORD16 *)src->ptr, s))) { - bnSizeCheck(dest, s); - lbnZero_16((BNWORD16 *)dest->ptr BIGLITTLE(-d,+d), s-d); - dest->size = d = s; - MALLOCDB; - } - if (!s) - return 0; - t = lbnSubN_16((BNWORD16 *)dest->ptr, (BNWORD16 *)src->ptr, s); - MALLOCDB; - if (t) { - if (d > s) { - t = lbnSub1_16((BNWORD16 *)dest->ptr BIGLITTLE(-s,+s), - d-s, t); - MALLOCDB; - } - if (t) { - lbnNeg_16((BNWORD16 *)dest->ptr, d); - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, - dest->size); - MALLOCDB; - return 1; - } - } - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, dest->size); - return 0; -} - -/* - * Compare the BigNum to the given value, which must be < 65536. - * Returns -1. 0 or 1 if a<b, a == b or a>b. - * a <=> b --> bnCmpQ(a,b) <=> 0 - */ -int -bnCmpQ_16(struct BigNum const *a, unsigned b) -{ - unsigned t; - BNWORD16 v; - - t = lbnNorm_16((BNWORD16 *)a->ptr, a->size); - /* If a is more than one word long or zero, it's easy... */ - if (t != 1) - return (t > 1) ? 1 : (b ? -1 : 0); - v = (unsigned)((BNWORD16 *)a->ptr)[BIGLITTLE(-1,0)]; - return (v > b) ? 1 : ((v < b) ? -1 : 0); -} - -/* Set dest to a small value */ -int -bnSetQ_16(struct BigNum *dest, unsigned src) -{ - if (src) { - bnSizeCheck(dest, 1); - - ((BNWORD16 *)dest->ptr)[BIGLITTLE(-1,0)] = (BNWORD16)src; - dest->size = 1; - } else { - dest->size = 0; - } - return 0; -} - -/* dest += src */ -int -bnAddQ_16(struct BigNum *dest, unsigned src) -{ - BNWORD16 t; - - if (!dest->size) - return bnSetQ(dest, src); - - t = lbnAdd1_16((BNWORD16 *)dest->ptr, dest->size, (BNWORD16)src); - MALLOCDB; - if (t) { - src = dest->size; - bnSizeCheck(dest, src+1); - ((BNWORD16 *)dest->ptr)[BIGLITTLE(-1-src,src)] = t; - dest->size = src+1; - } - return 0; -} - -/* - * Return value as for bnSub: 1 if subtract underflowed, in which - * case the return is the negative of the computed value. - */ -int -bnSubQ_16(struct BigNum *dest, unsigned src) -{ - BNWORD16 t; - - if (!dest->size) - return bnSetQ(dest, src) < 0 ? -1 : (src != 0); - - t = lbnSub1_16((BNWORD16 *)dest->ptr, dest->size, src); - MALLOCDB; - if (t) { - /* Underflow. <= 1 word, so do it simply. */ - lbnNeg_16((BNWORD16 *)dest->ptr, 1); - dest->size = 1; - return 1; - } -/* Try to normalize? Needing this is going to be pretty damn rare. */ -/* dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, dest->size); */ - return 0; -} - -/* - * Compare two BigNums. Returns -1. 0 or 1 if a<b, a == b or a>b. - * a <=> b --> bnCmp(a,b) <=> 0 - */ -int -bnCmp_16(struct BigNum const *a, struct BigNum const *b) -{ - unsigned s, t; - - s = lbnNorm_16((BNWORD16 *)a->ptr, a->size); - t = lbnNorm_16((BNWORD16 *)b->ptr, b->size); - - if (s != t) - return s > t ? 1 : -1; - return lbnCmp_16((BNWORD16 *)a->ptr, (BNWORD16 *)b->ptr, s); -} - -/* dest = src*src. This is more efficient than bnMul. */ -int -bnSquare_16(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s; - BNWORD16 *srcbuf; - - s = lbnNorm_16((BNWORD16 *)src->ptr, src->size); - if (!s) { - dest->size = 0; - return 0; - } - bnSizeCheck(dest, 2*s); - - if (src == dest) { - LBNALLOC(srcbuf, BNWORD16, s); - if (!srcbuf) - return -1; - lbnCopy_16(srcbuf, (BNWORD16 *)src->ptr, s); - lbnSquare_16((BNWORD16 *)dest->ptr, (BNWORD16 *)srcbuf, s); - LBNFREE(srcbuf, s); - } else { - lbnSquare_16((BNWORD16 *)dest->ptr, (BNWORD16 *)src->ptr, s); - } - - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, 2*s); - MALLOCDB; - return 0; -} - -/* dest = a * b. Any overlap between operands is allowed. */ -int -bnMul_16(struct BigNum *dest, struct BigNum const *a, struct BigNum const *b) -{ - unsigned s, t; - BNWORD16 *srcbuf; - - s = lbnNorm_16((BNWORD16 *)a->ptr, a->size); - t = lbnNorm_16((BNWORD16 *)b->ptr, b->size); - - if (!s || !t) { - dest->size = 0; - return 0; - } - - if (a == b) - return bnSquare_16(dest, a); - - bnSizeCheck(dest, s+t); - - if (dest == a) { - LBNALLOC(srcbuf, BNWORD16, s); - if (!srcbuf) - return -1; - lbnCopy_16(srcbuf, (BNWORD16 *)a->ptr, s); - lbnMul_16((BNWORD16 *)dest->ptr, srcbuf, s, - (BNWORD16 *)b->ptr, t); - LBNFREE(srcbuf, s); - } else if (dest == b) { - LBNALLOC(srcbuf, BNWORD16, t); - if (!srcbuf) - return -1; - lbnCopy_16(srcbuf, (BNWORD16 *)b->ptr, t); - lbnMul_16((BNWORD16 *)dest->ptr, (BNWORD16 *)a->ptr, s, - srcbuf, t); - LBNFREE(srcbuf, t); - } else { - lbnMul_16((BNWORD16 *)dest->ptr, (BNWORD16 *)a->ptr, s, - (BNWORD16 *)b->ptr, t); - } - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, s+t); - MALLOCDB; - return 0; -} - -/* dest = a * b */ -int -bnMulQ_16(struct BigNum *dest, struct BigNum const *a, unsigned b) -{ - unsigned s; - - s = lbnNorm_16((BNWORD16 *)a->ptr, a->size); - if (!s || !b) { - dest->size = 0; - return 0; - } - if (b == 1) - return bnCopy_16(dest, a); - bnSizeCheck(dest, s+1); - lbnMulN1_16((BNWORD16 *)dest->ptr, (BNWORD16 *)a->ptr, s, b); - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, s+1); - MALLOCDB; - return 0; -} - -/* q = n/d, r = n % d */ -int -bnDivMod_16(struct BigNum *q, struct BigNum *r, struct BigNum const *n, - struct BigNum const *d) -{ - unsigned dsize, nsize; - BNWORD16 qhigh; - - dsize = lbnNorm_16((BNWORD16 *)d->ptr, d->size); - nsize = lbnNorm_16((BNWORD16 *)n->ptr, n->size); - - if (nsize < dsize) { - q->size = 0; /* No quotient */ - r->size = nsize; - return 0; /* Success */ - } - - bnSizeCheck(q, nsize-dsize); - - if (r != n) { /* You are allowed to reduce in place */ - bnSizeCheck(r, nsize); - lbnCopy_16((BNWORD16 *)r->ptr, (BNWORD16 *)n->ptr, nsize); - } - - qhigh = lbnDiv_16((BNWORD16 *)q->ptr, (BNWORD16 *)r->ptr, nsize, - (BNWORD16 *)d->ptr, dsize); - nsize -= dsize; - if (qhigh) { - bnSizeCheck(q, nsize+1); - *((BNWORD16 *)q->ptr BIGLITTLE(-nsize-1,+nsize)) = qhigh; - q->size = nsize+1; - } else { - q->size = lbnNorm_16((BNWORD16 *)q->ptr, nsize); - } - r->size = lbnNorm_16((BNWORD16 *)r->ptr, dsize); - MALLOCDB; - return 0; -} - -/* det = src % d */ -int -bnMod_16(struct BigNum *dest, struct BigNum const *src, struct BigNum const *d) -{ - unsigned dsize, nsize; - - nsize = lbnNorm_16((BNWORD16 *)src->ptr, src->size); - dsize = lbnNorm_16((BNWORD16 *)d->ptr, d->size); - - - if (dest != src) { - bnSizeCheck(dest, nsize); - lbnCopy_16((BNWORD16 *)dest->ptr, (BNWORD16 *)src->ptr, nsize); - } - - if (nsize < dsize) { - dest->size = nsize; /* No quotient */ - return 0; - } - - (void)lbnDiv_16((BNWORD16 *)dest->ptr BIGLITTLE(-dsize,+dsize), - (BNWORD16 *)dest->ptr, nsize, - (BNWORD16 *)d->ptr, dsize); - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, dsize); - MALLOCDB; - return 0; -} - -/* return src % d. */ -unsigned -bnModQ_16(struct BigNum const *src, unsigned d) -{ - unsigned s; - - s = lbnNorm_16((BNWORD16 *)src->ptr, src->size); - if (!s) - return 0; - - if (d & (d-1)) /* Not a power of 2 */ - d = lbnModQ_16((BNWORD16 *)src->ptr, s, d); - else - d = (unsigned)((BNWORD16 *)src->ptr)[BIGLITTLE(-1,0)] & (d-1); - return d; -} - -/* dest = n^exp (mod mod) */ -int -bnExpMod_16(struct BigNum *dest, struct BigNum const *n, - struct BigNum const *exp, struct BigNum const *mod) -{ - unsigned nsize, esize, msize; - - nsize = lbnNorm_16((BNWORD16 *)n->ptr, n->size); - esize = lbnNorm_16((BNWORD16 *)exp->ptr, exp->size); - msize = lbnNorm_16((BNWORD16 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD16 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(dest, msize); - - /* Special-case base of 2 */ - if (nsize == 1 && ((BNWORD16 *)n->ptr)[BIGLITTLE(-1,0)] == 2) { - if (lbnTwoExpMod_16((BNWORD16 *)dest->ptr, - (BNWORD16 *)exp->ptr, esize, - (BNWORD16 *)mod->ptr, msize) < 0) - return -1; - } else { - if (lbnExpMod_16((BNWORD16 *)dest->ptr, - (BNWORD16 *)n->ptr, nsize, - (BNWORD16 *)exp->ptr, esize, - (BNWORD16 *)mod->ptr, msize) < 0) - return -1; - } - - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, msize); - MALLOCDB; - return 0; -} - -/* - * dest = n1^e1 * n2^e2 (mod mod). This is more efficient than two - * separate modular exponentiations, and in fact asymptotically approaches - * the cost of one. - */ -int -bnDoubleExpMod_16(struct BigNum *dest, - struct BigNum const *n1, struct BigNum const *e1, - struct BigNum const *n2, struct BigNum const *e2, - struct BigNum const *mod) -{ - unsigned n1size, e1size, n2size, e2size, msize; - - n1size = lbnNorm_16((BNWORD16 *)n1->ptr, n1->size); - e1size = lbnNorm_16((BNWORD16 *)e1->ptr, e1->size); - n2size = lbnNorm_16((BNWORD16 *)n2->ptr, n2->size); - e2size = lbnNorm_16((BNWORD16 *)e2->ptr, e2->size); - msize = lbnNorm_16((BNWORD16 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD16 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(dest, msize); - - if (lbnDoubleExpMod_16((BNWORD16 *)dest->ptr, - (BNWORD16 *)n1->ptr, n1size, (BNWORD16 *)e1->ptr, e1size, - (BNWORD16 *)n2->ptr, n2size, (BNWORD16 *)e2->ptr, e2size, - (BNWORD16 *)mod->ptr, msize) < 0) - return -1; - - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, msize); - MALLOCDB; - return 0; -} - -/* n = 2^exp (mod mod) */ -int -bnTwoExpMod_16(struct BigNum *n, struct BigNum const *exp, - struct BigNum const *mod) -{ - unsigned esize, msize; - - esize = lbnNorm_16((BNWORD16 *)exp->ptr, exp->size); - msize = lbnNorm_16((BNWORD16 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD16 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(n, msize); - - if (lbnTwoExpMod_16((BNWORD16 *)n->ptr, (BNWORD16 *)exp->ptr, esize, - (BNWORD16 *)mod->ptr, msize) < 0) - return -1; - - n->size = lbnNorm_16((BNWORD16 *)n->ptr, msize); - MALLOCDB; - return 0; -} - -/* dest = gcd(a, b) */ -int -bnGcd_16(struct BigNum *dest, struct BigNum const *a, struct BigNum const *b) -{ - BNWORD16 *tmp; - unsigned asize, bsize; - int i; - - /* Kind of silly, but we might as well permit it... */ - if (a == b) - return dest == a ? 0 : bnCopy(dest, a); - - /* Ensure a is not the same as "dest" */ - if (a == dest) { - a = b; - b = dest; - } - - asize = lbnNorm_16((BNWORD16 *)a->ptr, a->size); - bsize = lbnNorm_16((BNWORD16 *)b->ptr, b->size); - - bnSizeCheck(dest, bsize+1); - - /* Copy a to tmp */ - LBNALLOC(tmp, BNWORD16, asize+1); - if (!tmp) - return -1; - lbnCopy_16(tmp, (BNWORD16 *)a->ptr, asize); - - /* Copy b to dest, if necessary */ - if (dest != b) - lbnCopy_16((BNWORD16 *)dest->ptr, - (BNWORD16 *)b->ptr, bsize); - if (bsize > asize || (bsize == asize && - lbnCmp_16((BNWORD16 *)b->ptr, (BNWORD16 *)a->ptr, asize) > 0)) - { - i = lbnGcd_16((BNWORD16 *)dest->ptr, bsize, tmp, asize, - &dest->size); - if (i > 0) /* Result in tmp, not dest */ - lbnCopy_16((BNWORD16 *)dest->ptr, tmp, dest->size); - } else { - i = lbnGcd_16(tmp, asize, (BNWORD16 *)dest->ptr, bsize, - &dest->size); - if (i == 0) /* Result in tmp, not dest */ - lbnCopy_16((BNWORD16 *)dest->ptr, tmp, dest->size); - } - LBNFREE(tmp, asize+1); - MALLOCDB; - return (i < 0) ? i : 0; -} - -/* - * dest = 1/src (mod mod). Returns >0 if gcd(src, mod) != 1 (in which case - * the inverse does not exist). - */ -int -bnInv_16(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *mod) -{ - unsigned s, m; - int i; - - s = lbnNorm_16((BNWORD16 *)src->ptr, src->size); - m = lbnNorm_16((BNWORD16 *)mod->ptr, mod->size); - - /* lbnInv_16 requires that the input be less than the modulus */ - if (m < s || - (m==s && lbnCmp_16((BNWORD16 *)src->ptr, (BNWORD16 *)mod->ptr, s))) - { - bnSizeCheck(dest, s + (m==s)); - if (dest != src) - lbnCopy_16((BNWORD16 *)dest->ptr, - (BNWORD16 *)src->ptr, s); - /* Pre-reduce modulo the modulus */ - (void)lbnDiv_16((BNWORD16 *)dest->ptr BIGLITTLE(-m,+m), - (BNWORD16 *)dest->ptr, s, - (BNWORD16 *)mod->ptr, m); - s = lbnNorm_16((BNWORD16 *)dest->ptr, m); - MALLOCDB; - } else { - bnSizeCheck(dest, m+1); - if (dest != src) - lbnCopy_16((BNWORD16 *)dest->ptr, - (BNWORD16 *)src->ptr, s); - } - - i = lbnInv_16((BNWORD16 *)dest->ptr, s, (BNWORD16 *)mod->ptr, m); - if (i == 0) - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, m); - - MALLOCDB; - return i; -} - -/* - * Shift a bignum left the appropriate number of bits, - * multiplying by 2^amt. - */ -int -bnLShift_16(struct BigNum *dest, unsigned amt) -{ - unsigned s = dest->size; - BNWORD16 carry; - - if (amt % 16) { - carry = lbnLshift_16((BNWORD16 *)dest->ptr, s, amt % 16); - if (carry) { - s++; - bnSizeCheck(dest, s); - ((BNWORD16 *)dest->ptr)[BIGLITTLE(-s,s-1)] = carry; - } - } - - amt /= 16; - if (amt) { - bnSizeCheck(dest, s+amt); - memmove((BNWORD16 *)dest->ptr BIGLITTLE(-s-amt, +amt), - (BNWORD16 *)dest->ptr BIG(-s), - s * sizeof(BNWORD16)); - lbnZero_16((BNWORD16 *)dest->ptr, amt); - s += amt; - } - dest->size = s; - MALLOCDB; - return 0; -} - -/* - * Shift a bignum right the appropriate number of bits, - * dividing by 2^amt. - */ -void -bnRShift_16(struct BigNum *dest, unsigned amt) -{ - unsigned s = dest->size; - - if (amt >= 16) { - memmove( - (BNWORD16 *)dest->ptr BIG(-s+amt/16), - (BNWORD16 *)dest->ptr BIGLITTLE(-s, +amt/16), - (s-amt/16) * sizeof(BNWORD16)); - s -= amt/16; - amt %= 16; - } - - if (amt) - (void)lbnRshift_16((BNWORD16 *)dest->ptr, s, amt); - - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, s); - MALLOCDB; -} - -/* - * Shift a bignum right until it is odd, and return the number of - * bits shifted. n = d * 2^s. Replaces n with d and returns s. - * Returns 0 when given 0. (Another valid answer is infinity.) - */ -unsigned -bnMakeOdd_16(struct BigNum *n) -{ - unsigned size; - unsigned s; /* shift amount */ - BNWORD16 *p; - BNWORD16 t; - - p = (BNWORD16 *)n->ptr; - size = lbnNorm_16(p, n->size); - if (!size) - return 0; - - t = BIGLITTLE(p[-1],p[0]); - s = 0; - - /* See how many words we have to shift */ - if (!t) { - /* Shift by words */ - do { - s++; - BIGLITTLE(--p,p++); - } while ((t = BIGLITTLE(p[-1],p[0])) == 0); - size -= s; - s *= 16; - memmove((BNWORD16 *)n->ptr BIG(-size), p BIG(-size), - size * sizeof(BNWORD16)); - p = (BNWORD16 *)n->ptr; - MALLOCDB; - } - - assert(t); - - if (!(t & 1)) { - /* Now count the bits */ - do { - t >>= 1; - s++; - } while ((t & 1) == 0); - - /* Shift the bits */ - lbnRshift_16(p, size, s & (16-1)); - /* Renormalize */ - if (BIGLITTLE(*(p-size),*(p+(size-1))) == 0) - --size; - } - n->size = size; - - MALLOCDB; - return s; -} - -/* - * Do base- and modulus-dependent precomputation for rapid computation of - * base^exp (mod mod) with various exponents. - * - * See lbn16.c for the details on how the algorithm works. Basically, - * it involves precomputing a table of powers of base, base^(order^k), - * for a suitable range 0 <= k < n detemined by the maximum exponent size - * desired. To do eht exponentiation, the exponent is expressed in base - * "order" (sorry for the confusing terminology) and the precomputed powers - * are combined. - * - * This implementation allows only power-of-2 values for "order". Using - * other numbers can be more efficient, but it's more work and for the - * popular exponent size of 160 bits, an order of 8 is optimal, so it - * hasn't seemed worth it to implement. - * - * Here's a table of the optimal power-of-2 order for various exponent - * sizes and the associated (average) cost for an exponentiation. - * Note that *higher* orders are more memory-efficient; the number - * of precomputed values required is ceil(ebits/order). (Ignore the - * underscores in the middle of numbers; they're harmless.) - * - * At 2 bits, order 2 uses 0.000000 multiplies - * At 4 bits, order 2 uses 1.000000 multiplies - * At 8 bits, order 2 uses 3.000000 multiplies - * At 1_6 bits, order 2 uses 7.000000 multiplies - * At 3_2 bits, order 2 uses 15.000000 multiplies - * At 34 bits, 15.750000 (order 4) < 1_6.000000 (order 2) - * At 6_4 bits, order 4 uses 27.000000 multiplies - * At 99 bits, 39.875000 (order 8) < 40.250000 (order 4) - * At 128 bits, order 8 uses 48.500000 multiplies - * At 256 bits, order 8 uses 85.875000 multiplies - * At 280 bits, 92.625000 (order 1_6) < 92.875000 (order 8) - * At 512 bits, order 1_6 uses 147.000000 multiplies - * At 785 bits, 211.093750 (order 3_2) < 211.250000 (order 1_6) - * At 1024 bits, order 3_2 uses 257.562500 multiplies - * At 2048 bits, order 3_2 uses 456.093750 multiplies - * At 2148 bits, 475.406250 (order 6_4) < 475.468750 (order 3_2) - * At 4096 bits, order 6_4 uses 795.281250 multiplies - * At 5726 bits, 1062.609375 (order 128) < 1062.843750 (order 6_4) - * At 8192 bits, order 128 uses 1412.609375 multiplies - * At 14848 bits, 2355.750000 (order 256) < 2355.929688 (order 128) - * At 37593 bits, 5187.841797 (order 512) < 5188.144531 (order 256) - */ -int -bnBasePrecompBegin_16(struct BnBasePrecomp *pre, struct BigNum const *base, - struct BigNum const *mod, unsigned maxebits) -{ - int i; - BNWORD16 **array; /* Array of precomputed powers of base */ - unsigned n; /* Number of entries in array (needed) */ - unsigned m; /* Number of entries in array (non-NULL) */ - unsigned arraysize; /* Number of entries in array (allocated) */ - unsigned bits; /* log2(order) */ - unsigned msize = lbnNorm_16((BNWORD16 *)mod->ptr, mod->size); - static unsigned const bnBasePrecompThreshTable[] = { - 33, 98, 279, 784, 2147, 5725, 14847, 37592, (unsigned)-1 - }; - - /* Clear pre in case of failure */ - pre->array = 0; - pre->msize = 0; - pre->bits = 0; - pre->maxebits = 0; - pre->arraysize = 0; - pre->entries = 0; - - /* Find the correct bit-window size */ - bits = 0; - do - bits++; - while (maxebits > bnBasePrecompThreshTable[bits]); - - /* Now the number of precomputed values we need */ - n = (maxebits+bits-1)/bits; - assert(n*bits >= maxebits); - - arraysize = n+1; /* Add one trailing NULL for safety */ - array = lbnMemAlloc(arraysize * sizeof(*array)); - if (!array) - return -1; /* Out of memory */ - - /* Now allocate the entries (precomputed powers of base) */ - for (m = 0; m < n; m++) { - BNWORD16 *entry; - - LBNALLOC(entry, BNWORD16, msize); - if (!entry) - break; - array[m] = entry; - } - - /* "m" is the number of successfully allocated entries */ - if (m < n) { - /* Ran out of memory; see if we can use a smaller array */ - BNWORD16 **newarray; - - if (m < 2) { - n = 0; /* Forget it */ - } else { - /* How few bits can we use with what's allocated? */ - bits = (maxebits + m - 1) / m; -retry: - n = (maxebits + bits - 1) / bits; - if (! (n >> bits) ) - n = 0; /* Not enough to amount to anything */ - } - /* Free excess allocated array entries */ - while (m > n) { - BNWORD16 *entry = array[--m]; - LBNFREE(entry, msize); - } - if (!n) { - /* Give it up */ - lbnMemFree(array, arraysize * sizeof(*array)); - return -1; - } - /* - * Try to shrink the pointer array. This might fail, but - * it's not critical. lbnMemRealloc isn't guarnateed to - * exist, so we may have to allocate, copy, and free. - */ -#ifdef lbnMemRealloc - newarray = lbnMemRealloc(array, arraysize * sizeof(*array), - (n+1) * sizeof(*array)); - if (newarray) { - array = newarray; - arraysize = n+1; - } -#else - newarray = lbnMemAlloc((n+1) * sizeof(*array)); - if (newarray) { - memcpy(newarray, array, n * sizeof(*array)); - lbnMemFree(array, arraysize * sizeof(*array)); - array = newarray; - arraysize = n+1; - } -#endif - } - - /* Pad with null pointers */ - while (m < arraysize) - array[m++] = 0; - - /* Okay, we have our array, now initialize it */ - i = lbnBasePrecompBegin_16(array, n, bits, - (BNWORD16 *)base->ptr, base->size, - (BNWORD16 *)mod->ptr, msize); - if (i < 0) { - /* Ack, still out of memory */ - bits++; - m = n; - goto retry; - } - /* Finally, totoal success */ - pre->array = array; - pre->bits = bits; - pre->msize = msize; - pre->maxebits = n * bits; - pre->arraysize = arraysize; - pre->entries = n; - return 0; -} - -/* Free everything preallocated */ -void -bnBasePrecompEnd_16(struct BnBasePrecomp *pre) -{ - BNWORD16 **array = pre->array; - - if (array) { - unsigned entries = pre->entries; - unsigned msize = pre->msize; - unsigned m; - - for (m = 0; m < entries; m++) { - BNWORD16 *entry = array[m]; - if (entry) - LBNFREE(entry, msize); - } - lbnMemFree(array, pre->arraysize * sizeof(array)); - } - pre->array = 0; - pre->bits = 0; - pre->msize = 0; - pre->maxebits = 0; - pre->arraysize = 0; - pre->entries = 0; -} - -int -bnBasePrecompExpMod_16(struct BigNum *dest, struct BnBasePrecomp const *pre, - struct BigNum const *exp, struct BigNum const *mod) -{ - unsigned msize = lbnNorm_16((BNWORD16 *)mod->ptr, mod->size); - unsigned esize = lbnNorm_16((BNWORD16 *)exp->ptr, exp->size); - BNWORD16 const * const *array = pre->array; - int i; - - assert(msize == pre->msize); - assert(((BNWORD16 *)mod->ptr)[BIGLITTLE(-1,0)] & 1); - assert(lbnBits_16((BNWORD16 *)exp->ptr, esize) <= pre->maxebits); - - bnSizeCheck(dest, msize); - - i = lbnBasePrecompExp_16(dest->ptr, array, pre->bits, - exp->ptr, esize, mod->ptr, msize); - if (i == 0) - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, msize); - return i; -} - -int -bnDoubleBasePrecompExpMod_16(struct BigNum *dest, - struct BnBasePrecomp const *pre1, struct BigNum const *exp1, - struct BnBasePrecomp const *pre2, struct BigNum const *exp2, - struct BigNum const *mod) -{ - unsigned msize = lbnNorm_16((BNWORD16 *)mod->ptr, mod->size); - unsigned e1size = lbnNorm_16((BNWORD16 *)exp1->ptr, exp1->size); - unsigned e2size = lbnNorm_16((BNWORD16 *)exp1->ptr, exp2->size); - BNWORD16 const * const *array1 = pre1->array; - BNWORD16 const * const *array2 = pre2->array; - int i; - - assert(msize == pre1->msize); - assert(msize == pre2->msize); - assert(((BNWORD16 *)mod->ptr)[BIGLITTLE(-1,0)] & 1); - assert(lbnBits_16((BNWORD16 *)exp1->ptr, e1size) <= pre1->maxebits); - assert(lbnBits_16((BNWORD16 *)exp2->ptr, e2size) <= pre2->maxebits); - assert(pre1->bits == pre2->bits); - - bnSizeCheck(dest, msize); - - i = lbnDoubleBasePrecompExp_16(dest->ptr, pre1->bits, array1, - exp1->ptr, e1size, array2, exp2->ptr, e2size, - mod->ptr, msize); - if (i == 0) - dest->size = lbnNorm_16((BNWORD16 *)dest->ptr, msize); - return i; -} diff --git a/libs/libzrtp/third_party/bnlib/bn16.h b/libs/libzrtp/third_party/bnlib/bn16.h deleted file mode 100644 index b94bbeae34..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn16.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn16.h - interface to 16-bit bignum routines. - */ -struct BigNum; -struct BnBasePrecomp; - -void bnInit_16(void); -void bnEnd_16(struct BigNum *bn); -int bnPrealloc_16(struct BigNum *bn, unsigned bits); -int bnCopy_16(struct BigNum *dest, struct BigNum const *src); -int bnSwap_16(struct BigNum *a, struct BigNum *b); -void bnNorm_16(struct BigNum *bn); -void bnExtractBigBytes_16(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned dlen); -int bnInsertBigBytes_16(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); -void bnExtractLittleBytes_16(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned dlen); -int bnInsertLittleBytes_16(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); -unsigned bnLSWord_16(struct BigNum const *src); -int bnReadBit_16(struct BigNum const *bn, unsigned bit); -unsigned bnBits_16(struct BigNum const *src); -int bnAdd_16(struct BigNum *dest, struct BigNum const *src); -int bnSub_16(struct BigNum *dest, struct BigNum const *src); -int bnCmpQ_16(struct BigNum const *a, unsigned b); -int bnSetQ_16(struct BigNum *dest, unsigned src); -int bnAddQ_16(struct BigNum *dest, unsigned src); -int bnSubQ_16(struct BigNum *dest, unsigned src); -int bnCmp_16(struct BigNum const *a, struct BigNum const *b); -int bnSquare_16(struct BigNum *dest, struct BigNum const *src); -int bnMul_16(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); -int bnMulQ_16(struct BigNum *dest, struct BigNum const *a, unsigned b); -int bnDivMod_16(struct BigNum *q, struct BigNum *r, struct BigNum const *n, - struct BigNum const *d); -int bnMod_16(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *d); -unsigned bnModQ_16(struct BigNum const *src, unsigned d); -int bnExpMod_16(struct BigNum *dest, struct BigNum const *n, - struct BigNum const *exp, struct BigNum const *mod); -int bnDoubleExpMod_16(struct BigNum *dest, - struct BigNum const *n1, struct BigNum const *e1, - struct BigNum const *n2, struct BigNum const *e2, - struct BigNum const *mod); -int bnTwoExpMod_16(struct BigNum *n, struct BigNum const *exp, - struct BigNum const *mod); -int bnGcd_16(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); -int bnInv_16(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *mod); -int bnLShift_16(struct BigNum *dest, unsigned amt); -void bnRShift_16(struct BigNum *dest, unsigned amt); -unsigned bnMakeOdd_16(struct BigNum *n); -int bnBasePrecompBegin_16(struct BnBasePrecomp *pre, struct BigNum const *base, - struct BigNum const *mod, unsigned maxebits); -void bnBasePrecompEnd_16(struct BnBasePrecomp *pre); -int bnBasePrecompExpMod_16(struct BigNum *dest, struct BnBasePrecomp const *pre, - struct BigNum const *exp, struct BigNum const *mod); -int bnDoubleBasePrecompExpMod_16(struct BigNum *dest, - struct BnBasePrecomp const *pre1, struct BigNum const *exp1, - struct BnBasePrecomp const *pre2, struct BigNum const *exp2, - struct BigNum const *mod); diff --git a/libs/libzrtp/third_party/bnlib/bn32.c b/libs/libzrtp/third_party/bnlib/bn32.c deleted file mode 100644 index d9daca0c97..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn32.c +++ /dev/null @@ -1,1182 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn32.c - the high-level bignum interface - * - * Like lbn32.c, this reserves the string "32" for textual replacement. - * The string must not appear anywhere unless it is intended to be replaced - * to generate other bignum interface functions. - */ - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#if !NO_STRING_H -#include <string.h> /* for memmove() in bnMakeOdd */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -/* - * This was useful during debugging, so it's left in here. - * You can ignore it. DBMALLOC is generally undefined. - */ -#ifndef DBMALLOC -#define DBMALLOC 0 -#endif -#if DBMALLOC -#include "../dbmalloc/malloc.h" -#define MALLOCDB malloc_chain_check(1) -#else -#define MALLOCDB (void)0 -#endif - -#include "lbn.h" -#include "lbn32.h" -#include "lbnmem.h" -#include "bn32.h" -#include "bn.h" - -/* Work-arounds for some particularly broken systems */ -#include "kludge.h" /* For memmove() */ - -/* Functions */ -void -bnInit_32(void) -{ - bnEnd = bnEnd_32; - bnPrealloc = bnPrealloc_32; - bnCopy = bnCopy_32; - bnNorm = bnNorm_32; - bnExtractBigBytes = bnExtractBigBytes_32; - bnInsertBigBytes = bnInsertBigBytes_32; - bnExtractLittleBytes = bnExtractLittleBytes_32; - bnInsertLittleBytes = bnInsertLittleBytes_32; - bnLSWord = bnLSWord_32; - bnReadBit = bnReadBit_32; - bnBits = bnBits_32; - bnAdd = bnAdd_32; - bnSub = bnSub_32; - bnCmpQ = bnCmpQ_32; - bnSetQ = bnSetQ_32; - bnAddQ = bnAddQ_32; - bnSubQ = bnSubQ_32; - bnCmp = bnCmp_32; - bnSquare = bnSquare_32; - bnMul = bnMul_32; - bnMulQ = bnMulQ_32; - bnDivMod = bnDivMod_32; - bnMod = bnMod_32; - bnModQ = bnModQ_32; - bnExpMod = bnExpMod_32; - bnDoubleExpMod = bnDoubleExpMod_32; - bnTwoExpMod = bnTwoExpMod_32; - bnGcd = bnGcd_32; - bnInv = bnInv_32; - bnLShift = bnLShift_32; - bnRShift = bnRShift_32; - bnMakeOdd = bnMakeOdd_32; - bnBasePrecompBegin = bnBasePrecompBegin_32; - bnBasePrecompEnd = bnBasePrecompEnd_32; - bnBasePrecompExpMod = bnBasePrecompExpMod_32; - bnDoubleBasePrecompExpMod = bnDoubleBasePrecompExpMod_32; -} - -void -bnEnd_32(struct BigNum *bn) -{ - if (bn->ptr) { - LBNFREE((BNWORD32 *)bn->ptr, bn->allocated); - bn->ptr = 0; - } - bn->size = 0; - bn->allocated = 0; - - MALLOCDB; -} - -/* Internal function. It operates in words. */ -static int -bnResize_32(struct BigNum *bn, unsigned len) -{ - void *p; - - /* Round size up: most mallocs impose 8-byte granularity anyway */ - len = (len + (8/sizeof(BNWORD32) - 1)) & ~(8/sizeof(BNWORD32) - 1); - p = LBNREALLOC((BNWORD32 *)bn->ptr, bn->allocated, len); - if (!p) - return -1; - bn->ptr = p; - bn->allocated = len; - - MALLOCDB; - - return 0; -} - -#define bnSizeCheck(bn, size) \ - if (bn->allocated < size && bnResize_32(bn, size) < 0) \ - return -1 - -/* Preallocate enough space in bn to hold "bits" bits. */ -int -bnPrealloc_32(struct BigNum *bn, unsigned bits) -{ - bits = (bits + 32-1)/32; - bnSizeCheck(bn, bits); - MALLOCDB; - return 0; -} - -int -bnCopy_32(struct BigNum *dest, struct BigNum const *src) -{ - bnSizeCheck(dest, src->size); - dest->size = src->size; - lbnCopy_32((BNWORD32 *)dest->ptr, (BNWORD32 *)src->ptr, src->size); - MALLOCDB; - return 0; -} - -/* Is this ever needed? Normalize the bn by deleting high-order 0 words */ -void -bnNorm_32(struct BigNum *bn) -{ - bn->size = lbnNorm_32((BNWORD32 *)bn->ptr, bn->size); -} - -/* - * Convert a bignum to big-endian bytes. Returns, in big-endian form, a - * substring of the bignum starting from lsbyte and "len" bytes long. - * Unused high-order (leading) bytes are filled with 0. - */ -void -bnExtractBigBytes_32(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size * (32 / 8); - - /* Fill unused leading bytes with 0 */ - while (s < lsbyte + len) { - *dest++ = 0; - len--; - } - - if (len) - lbnExtractBigBytes_32((BNWORD32 *)bn->ptr, dest, lsbyte, len); - MALLOCDB; -} - -/* The inverse of the above. */ -int -bnInsertBigBytes_32(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size; - unsigned words = (len+lsbyte+sizeof(BNWORD32)-1) / sizeof(BNWORD32); - - /* Pad with zeros as required */ - bnSizeCheck(bn, words); - - if (s < words) { - lbnZero_32((BNWORD32 *)bn->ptr BIGLITTLE(-s,+s), words-s); - s = words; - } - - lbnInsertBigBytes_32((BNWORD32 *)bn->ptr, src, lsbyte, len); - - bn->size = lbnNorm_32((BNWORD32 *)bn->ptr, s); - - MALLOCDB; - return 0; -} - - -/* - * Convert a bignum to little-endian bytes. Returns, in little-endian form, a - * substring of the bignum starting from lsbyte and "len" bytes long. - * Unused high-order (trailing) bytes are filled with 0. - */ -void -bnExtractLittleBytes_32(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size * (32 / 8); - - /* Fill unused leading bytes with 0 */ - while (s < lsbyte + len) - dest[--len] = 0; - - if (len) - lbnExtractLittleBytes_32((BNWORD32 *)bn->ptr, dest, - lsbyte, len); - MALLOCDB; -} - -/* The inverse of the above */ -int -bnInsertLittleBytes_32(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size; - unsigned words = (len+lsbyte+sizeof(BNWORD32)-1) / sizeof(BNWORD32); - - /* Pad with zeros as required */ - bnSizeCheck(bn, words); - - if (s < words) { - lbnZero_32((BNWORD32 *)bn->ptr BIGLITTLE(-s,+s), words-s); - s = words; - } - - lbnInsertLittleBytes_32((BNWORD32 *)bn->ptr, src, lsbyte, len); - - bn->size = lbnNorm_32((BNWORD32 *)bn->ptr, s); - - MALLOCDB; - return 0; -} - -/* Return the least-significant word of the input. */ -unsigned -bnLSWord_32(struct BigNum const *bn) -{ - return bn->size ? (unsigned)((BNWORD32 *)bn->ptr)[BIGLITTLE(-1,0)]: 0; -} - -/* Return a selected bit of the data */ -int -bnReadBit_32(struct BigNum const *bn, unsigned bit) -{ - BNWORD32 word; - if (bit/32 >= bn->size) - return 0; - word = ((BNWORD32 *)bn->ptr)[BIGLITTLE(-1-bit/32,bit/32)]; - return (int)(word >> (bit % 32) & 1); -} - -/* Count the number of significant bits. */ -unsigned -bnBits_32(struct BigNum const *bn) -{ - return lbnBits_32((BNWORD32 *)bn->ptr, bn->size); -} - -/* dest += src */ -int -bnAdd_32(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s = src->size, d = dest->size; - BNWORD32 t; - - if (!s) - return 0; - - bnSizeCheck(dest, s); - - if (d < s) { - lbnZero_32((BNWORD32 *)dest->ptr BIGLITTLE(-d,+d), s-d); - dest->size = d = s; - MALLOCDB; - } - t = lbnAddN_32((BNWORD32 *)dest->ptr, (BNWORD32 *)src->ptr, s); - MALLOCDB; - if (t) { - if (d > s) { - t = lbnAdd1_32((BNWORD32 *)dest->ptr BIGLITTLE(-s,+s), - d-s, t); - MALLOCDB; - } - if (t) { - bnSizeCheck(dest, d+1); - ((BNWORD32 *)dest->ptr)[BIGLITTLE(-1-d,d)] = t; - dest->size = d+1; - } - } - return 0; -} - -/* - * dest -= src. - * If dest goes negative, this produces the absolute value of - * the difference (the negative of the true value) and returns 1. - * Otherwise, it returls 0. - */ -int -bnSub_32(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s = src->size, d = dest->size; - BNWORD32 t; - - if (d < s && d < (s = lbnNorm_32((BNWORD32 *)src->ptr, s))) { - bnSizeCheck(dest, s); - lbnZero_32((BNWORD32 *)dest->ptr BIGLITTLE(-d,+d), s-d); - dest->size = d = s; - MALLOCDB; - } - if (!s) - return 0; - t = lbnSubN_32((BNWORD32 *)dest->ptr, (BNWORD32 *)src->ptr, s); - MALLOCDB; - if (t) { - if (d > s) { - t = lbnSub1_32((BNWORD32 *)dest->ptr BIGLITTLE(-s,+s), - d-s, t); - MALLOCDB; - } - if (t) { - lbnNeg_32((BNWORD32 *)dest->ptr, d); - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, - dest->size); - MALLOCDB; - return 1; - } - } - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, dest->size); - return 0; -} - -/* - * Compare the BigNum to the given value, which must be < 65536. - * Returns -1. 0 or 1 if a<b, a == b or a>b. - * a <=> b --> bnCmpQ(a,b) <=> 0 - */ -int -bnCmpQ_32(struct BigNum const *a, unsigned b) -{ - unsigned t; - BNWORD32 v; - - t = lbnNorm_32((BNWORD32 *)a->ptr, a->size); - /* If a is more than one word long or zero, it's easy... */ - if (t != 1) - return (t > 1) ? 1 : (b ? -1 : 0); - v = (unsigned)((BNWORD32 *)a->ptr)[BIGLITTLE(-1,0)]; - return (v > b) ? 1 : ((v < b) ? -1 : 0); -} - -/* Set dest to a small value */ -int -bnSetQ_32(struct BigNum *dest, unsigned src) -{ - if (src) { - bnSizeCheck(dest, 1); - - ((BNWORD32 *)dest->ptr)[BIGLITTLE(-1,0)] = (BNWORD32)src; - dest->size = 1; - } else { - dest->size = 0; - } - return 0; -} - -/* dest += src */ -int -bnAddQ_32(struct BigNum *dest, unsigned src) -{ - BNWORD32 t; - - if (!dest->size) - return bnSetQ(dest, src); - - t = lbnAdd1_32((BNWORD32 *)dest->ptr, dest->size, (BNWORD32)src); - MALLOCDB; - if (t) { - src = dest->size; - bnSizeCheck(dest, src+1); - ((BNWORD32 *)dest->ptr)[BIGLITTLE(-1-src,src)] = t; - dest->size = src+1; - } - return 0; -} - -/* - * Return value as for bnSub: 1 if subtract underflowed, in which - * case the return is the negative of the computed value. - */ -int -bnSubQ_32(struct BigNum *dest, unsigned src) -{ - BNWORD32 t; - - if (!dest->size) - return bnSetQ(dest, src) < 0 ? -1 : (src != 0); - - t = lbnSub1_32((BNWORD32 *)dest->ptr, dest->size, src); - MALLOCDB; - if (t) { - /* Underflow. <= 1 word, so do it simply. */ - lbnNeg_32((BNWORD32 *)dest->ptr, 1); - dest->size = 1; - return 1; - } -/* Try to normalize? Needing this is going to be pretty damn rare. */ -/* dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, dest->size); */ - return 0; -} - -/* - * Compare two BigNums. Returns -1. 0 or 1 if a<b, a == b or a>b. - * a <=> b --> bnCmp(a,b) <=> 0 - */ -int -bnCmp_32(struct BigNum const *a, struct BigNum const *b) -{ - unsigned s, t; - - s = lbnNorm_32((BNWORD32 *)a->ptr, a->size); - t = lbnNorm_32((BNWORD32 *)b->ptr, b->size); - - if (s != t) - return s > t ? 1 : -1; - return lbnCmp_32((BNWORD32 *)a->ptr, (BNWORD32 *)b->ptr, s); -} - -/* dest = src*src. This is more efficient than bnMul. */ -int -bnSquare_32(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s; - BNWORD32 *srcbuf; - - s = lbnNorm_32((BNWORD32 *)src->ptr, src->size); - if (!s) { - dest->size = 0; - return 0; - } - bnSizeCheck(dest, 2*s); - - if (src == dest) { - LBNALLOC(srcbuf, BNWORD32, s); - if (!srcbuf) - return -1; - lbnCopy_32(srcbuf, (BNWORD32 *)src->ptr, s); - lbnSquare_32((BNWORD32 *)dest->ptr, (BNWORD32 *)srcbuf, s); - LBNFREE(srcbuf, s); - } else { - lbnSquare_32((BNWORD32 *)dest->ptr, (BNWORD32 *)src->ptr, s); - } - - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, 2*s); - MALLOCDB; - return 0; -} - -/* dest = a * b. Any overlap between operands is allowed. */ -int -bnMul_32(struct BigNum *dest, struct BigNum const *a, struct BigNum const *b) -{ - unsigned s, t; - BNWORD32 *srcbuf; - - s = lbnNorm_32((BNWORD32 *)a->ptr, a->size); - t = lbnNorm_32((BNWORD32 *)b->ptr, b->size); - - if (!s || !t) { - dest->size = 0; - return 0; - } - - if (a == b) - return bnSquare_32(dest, a); - - bnSizeCheck(dest, s+t); - - if (dest == a) { - LBNALLOC(srcbuf, BNWORD32, s); - if (!srcbuf) - return -1; - lbnCopy_32(srcbuf, (BNWORD32 *)a->ptr, s); - lbnMul_32((BNWORD32 *)dest->ptr, srcbuf, s, - (BNWORD32 *)b->ptr, t); - LBNFREE(srcbuf, s); - } else if (dest == b) { - LBNALLOC(srcbuf, BNWORD32, t); - if (!srcbuf) - return -1; - lbnCopy_32(srcbuf, (BNWORD32 *)b->ptr, t); - lbnMul_32((BNWORD32 *)dest->ptr, (BNWORD32 *)a->ptr, s, - srcbuf, t); - LBNFREE(srcbuf, t); - } else { - lbnMul_32((BNWORD32 *)dest->ptr, (BNWORD32 *)a->ptr, s, - (BNWORD32 *)b->ptr, t); - } - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, s+t); - MALLOCDB; - return 0; -} - -/* dest = a * b */ -int -bnMulQ_32(struct BigNum *dest, struct BigNum const *a, unsigned b) -{ - unsigned s; - - s = lbnNorm_32((BNWORD32 *)a->ptr, a->size); - if (!s || !b) { - dest->size = 0; - return 0; - } - if (b == 1) - return bnCopy_32(dest, a); - bnSizeCheck(dest, s+1); - lbnMulN1_32((BNWORD32 *)dest->ptr, (BNWORD32 *)a->ptr, s, b); - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, s+1); - MALLOCDB; - return 0; -} - -/* q = n/d, r = n % d */ -int -bnDivMod_32(struct BigNum *q, struct BigNum *r, struct BigNum const *n, - struct BigNum const *d) -{ - unsigned dsize, nsize; - BNWORD32 qhigh; - - dsize = lbnNorm_32((BNWORD32 *)d->ptr, d->size); - nsize = lbnNorm_32((BNWORD32 *)n->ptr, n->size); - - if (nsize < dsize) { - q->size = 0; /* No quotient */ - r->size = nsize; - return 0; /* Success */ - } - - bnSizeCheck(q, nsize-dsize); - - if (r != n) { /* You are allowed to reduce in place */ - bnSizeCheck(r, nsize); - lbnCopy_32((BNWORD32 *)r->ptr, (BNWORD32 *)n->ptr, nsize); - } - - qhigh = lbnDiv_32((BNWORD32 *)q->ptr, (BNWORD32 *)r->ptr, nsize, - (BNWORD32 *)d->ptr, dsize); - nsize -= dsize; - if (qhigh) { - bnSizeCheck(q, nsize+1); - *((BNWORD32 *)q->ptr BIGLITTLE(-nsize-1,+nsize)) = qhigh; - q->size = nsize+1; - } else { - q->size = lbnNorm_32((BNWORD32 *)q->ptr, nsize); - } - r->size = lbnNorm_32((BNWORD32 *)r->ptr, dsize); - MALLOCDB; - return 0; -} - -/* det = src % d */ -int -bnMod_32(struct BigNum *dest, struct BigNum const *src, struct BigNum const *d) -{ - unsigned dsize, nsize; - - nsize = lbnNorm_32((BNWORD32 *)src->ptr, src->size); - dsize = lbnNorm_32((BNWORD32 *)d->ptr, d->size); - - - if (dest != src) { - bnSizeCheck(dest, nsize); - lbnCopy_32((BNWORD32 *)dest->ptr, (BNWORD32 *)src->ptr, nsize); - } - - if (nsize < dsize) { - dest->size = nsize; /* No quotient */ - return 0; - } - - (void)lbnDiv_32((BNWORD32 *)dest->ptr BIGLITTLE(-dsize,+dsize), - (BNWORD32 *)dest->ptr, nsize, - (BNWORD32 *)d->ptr, dsize); - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, dsize); - MALLOCDB; - return 0; -} - -/* return src % d. */ -unsigned -bnModQ_32(struct BigNum const *src, unsigned d) -{ - unsigned s; - - s = lbnNorm_32((BNWORD32 *)src->ptr, src->size); - if (!s) - return 0; - - if (d & (d-1)) /* Not a power of 2 */ - d = lbnModQ_32((BNWORD32 *)src->ptr, s, d); - else - d = (unsigned)((BNWORD32 *)src->ptr)[BIGLITTLE(-1,0)] & (d-1); - return d; -} - -/* dest = n^exp (mod mod) */ -int -bnExpMod_32(struct BigNum *dest, struct BigNum const *n, - struct BigNum const *exp, struct BigNum const *mod) -{ - unsigned nsize, esize, msize; - - nsize = lbnNorm_32((BNWORD32 *)n->ptr, n->size); - esize = lbnNorm_32((BNWORD32 *)exp->ptr, exp->size); - msize = lbnNorm_32((BNWORD32 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD32 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(dest, msize); - - /* Special-case base of 2 */ - if (nsize == 1 && ((BNWORD32 *)n->ptr)[BIGLITTLE(-1,0)] == 2) { - if (lbnTwoExpMod_32((BNWORD32 *)dest->ptr, - (BNWORD32 *)exp->ptr, esize, - (BNWORD32 *)mod->ptr, msize) < 0) - return -1; - } else { - if (lbnExpMod_32((BNWORD32 *)dest->ptr, - (BNWORD32 *)n->ptr, nsize, - (BNWORD32 *)exp->ptr, esize, - (BNWORD32 *)mod->ptr, msize) < 0) - return -1; - } - - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, msize); - MALLOCDB; - return 0; -} - -/* - * dest = n1^e1 * n2^e2 (mod mod). This is more efficient than two - * separate modular exponentiations, and in fact asymptotically approaches - * the cost of one. - */ -int -bnDoubleExpMod_32(struct BigNum *dest, - struct BigNum const *n1, struct BigNum const *e1, - struct BigNum const *n2, struct BigNum const *e2, - struct BigNum const *mod) -{ - unsigned n1size, e1size, n2size, e2size, msize; - - n1size = lbnNorm_32((BNWORD32 *)n1->ptr, n1->size); - e1size = lbnNorm_32((BNWORD32 *)e1->ptr, e1->size); - n2size = lbnNorm_32((BNWORD32 *)n2->ptr, n2->size); - e2size = lbnNorm_32((BNWORD32 *)e2->ptr, e2->size); - msize = lbnNorm_32((BNWORD32 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD32 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(dest, msize); - - if (lbnDoubleExpMod_32((BNWORD32 *)dest->ptr, - (BNWORD32 *)n1->ptr, n1size, (BNWORD32 *)e1->ptr, e1size, - (BNWORD32 *)n2->ptr, n2size, (BNWORD32 *)e2->ptr, e2size, - (BNWORD32 *)mod->ptr, msize) < 0) - return -1; - - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, msize); - MALLOCDB; - return 0; -} - -/* n = 2^exp (mod mod) */ -int -bnTwoExpMod_32(struct BigNum *n, struct BigNum const *exp, - struct BigNum const *mod) -{ - unsigned esize, msize; - - esize = lbnNorm_32((BNWORD32 *)exp->ptr, exp->size); - msize = lbnNorm_32((BNWORD32 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD32 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(n, msize); - - if (lbnTwoExpMod_32((BNWORD32 *)n->ptr, (BNWORD32 *)exp->ptr, esize, - (BNWORD32 *)mod->ptr, msize) < 0) - return -1; - - n->size = lbnNorm_32((BNWORD32 *)n->ptr, msize); - MALLOCDB; - return 0; -} - -/* dest = gcd(a, b) */ -int -bnGcd_32(struct BigNum *dest, struct BigNum const *a, struct BigNum const *b) -{ - BNWORD32 *tmp; - unsigned asize, bsize; - int i; - - /* Kind of silly, but we might as well permit it... */ - if (a == b) - return dest == a ? 0 : bnCopy(dest, a); - - /* Ensure a is not the same as "dest" */ - if (a == dest) { - a = b; - b = dest; - } - - asize = lbnNorm_32((BNWORD32 *)a->ptr, a->size); - bsize = lbnNorm_32((BNWORD32 *)b->ptr, b->size); - - bnSizeCheck(dest, bsize+1); - - /* Copy a to tmp */ - LBNALLOC(tmp, BNWORD32, asize+1); - if (!tmp) - return -1; - lbnCopy_32(tmp, (BNWORD32 *)a->ptr, asize); - - /* Copy b to dest, if necessary */ - if (dest != b) - lbnCopy_32((BNWORD32 *)dest->ptr, - (BNWORD32 *)b->ptr, bsize); - if (bsize > asize || (bsize == asize && - lbnCmp_32((BNWORD32 *)b->ptr, (BNWORD32 *)a->ptr, asize) > 0)) - { - i = lbnGcd_32((BNWORD32 *)dest->ptr, bsize, tmp, asize, - &dest->size); - if (i > 0) /* Result in tmp, not dest */ - lbnCopy_32((BNWORD32 *)dest->ptr, tmp, dest->size); - } else { - i = lbnGcd_32(tmp, asize, (BNWORD32 *)dest->ptr, bsize, - &dest->size); - if (i == 0) /* Result in tmp, not dest */ - lbnCopy_32((BNWORD32 *)dest->ptr, tmp, dest->size); - } - LBNFREE(tmp, asize+1); - MALLOCDB; - return (i < 0) ? i : 0; -} - -/* - * dest = 1/src (mod mod). Returns >0 if gcd(src, mod) != 1 (in which case - * the inverse does not exist). - */ -int -bnInv_32(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *mod) -{ - unsigned s, m; - int i; - - s = lbnNorm_32((BNWORD32 *)src->ptr, src->size); - m = lbnNorm_32((BNWORD32 *)mod->ptr, mod->size); - - /* lbnInv_32 requires that the input be less than the modulus */ - if (m < s || - (m==s && lbnCmp_32((BNWORD32 *)src->ptr, (BNWORD32 *)mod->ptr, s))) - { - bnSizeCheck(dest, s + (m==s)); - if (dest != src) - lbnCopy_32((BNWORD32 *)dest->ptr, - (BNWORD32 *)src->ptr, s); - /* Pre-reduce modulo the modulus */ - (void)lbnDiv_32((BNWORD32 *)dest->ptr BIGLITTLE(-m,+m), - (BNWORD32 *)dest->ptr, s, - (BNWORD32 *)mod->ptr, m); - s = lbnNorm_32((BNWORD32 *)dest->ptr, m); - MALLOCDB; - } else { - bnSizeCheck(dest, m+1); - if (dest != src) - lbnCopy_32((BNWORD32 *)dest->ptr, - (BNWORD32 *)src->ptr, s); - } - - i = lbnInv_32((BNWORD32 *)dest->ptr, s, (BNWORD32 *)mod->ptr, m); - if (i == 0) - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, m); - - MALLOCDB; - return i; -} - -/* - * Shift a bignum left the appropriate number of bits, - * multiplying by 2^amt. - */ -int -bnLShift_32(struct BigNum *dest, unsigned amt) -{ - unsigned s = dest->size; - BNWORD32 carry; - - if (amt % 32) { - carry = lbnLshift_32((BNWORD32 *)dest->ptr, s, amt % 32); - if (carry) { - s++; - bnSizeCheck(dest, s); - ((BNWORD32 *)dest->ptr)[BIGLITTLE(-s,s-1)] = carry; - } - } - - amt /= 32; - if (amt) { - bnSizeCheck(dest, s+amt); - memmove((BNWORD32 *)dest->ptr BIGLITTLE(-s-amt, +amt), - (BNWORD32 *)dest->ptr BIG(-s), - s * sizeof(BNWORD32)); - lbnZero_32((BNWORD32 *)dest->ptr, amt); - s += amt; - } - dest->size = s; - MALLOCDB; - return 0; -} - -/* - * Shift a bignum right the appropriate number of bits, - * dividing by 2^amt. - */ -void -bnRShift_32(struct BigNum *dest, unsigned amt) -{ - unsigned s = dest->size; - - if (amt >= 32) { - memmove( - (BNWORD32 *)dest->ptr BIG(-s+amt/32), - (BNWORD32 *)dest->ptr BIGLITTLE(-s, +amt/32), - (s-amt/32) * sizeof(BNWORD32)); - s -= amt/32; - amt %= 32; - } - - if (amt) - (void)lbnRshift_32((BNWORD32 *)dest->ptr, s, amt); - - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, s); - MALLOCDB; -} - -/* - * Shift a bignum right until it is odd, and return the number of - * bits shifted. n = d * 2^s. Replaces n with d and returns s. - * Returns 0 when given 0. (Another valid answer is infinity.) - */ -unsigned -bnMakeOdd_32(struct BigNum *n) -{ - unsigned size; - unsigned s; /* shift amount */ - BNWORD32 *p; - BNWORD32 t; - - p = (BNWORD32 *)n->ptr; - size = lbnNorm_32(p, n->size); - if (!size) - return 0; - - t = BIGLITTLE(p[-1],p[0]); - s = 0; - - /* See how many words we have to shift */ - if (!t) { - /* Shift by words */ - do { - s++; - BIGLITTLE(--p,p++); - } while ((t = BIGLITTLE(p[-1],p[0])) == 0); - size -= s; - s *= 32; - memmove((BNWORD32 *)n->ptr BIG(-size), p BIG(-size), - size * sizeof(BNWORD32)); - p = (BNWORD32 *)n->ptr; - MALLOCDB; - } - - assert(t); - - if (!(t & 1)) { - /* Now count the bits */ - do { - t >>= 1; - s++; - } while ((t & 1) == 0); - - /* Shift the bits */ - lbnRshift_32(p, size, s & (32-1)); - /* Renormalize */ - if (BIGLITTLE(*(p-size),*(p+(size-1))) == 0) - --size; - } - n->size = size; - - MALLOCDB; - return s; -} - -/* - * Do base- and modulus-dependent precomputation for rapid computation of - * base^exp (mod mod) with various exponents. - * - * See lbn32.c for the details on how the algorithm works. Basically, - * it involves precomputing a table of powers of base, base^(order^k), - * for a suitable range 0 <= k < n detemined by the maximum exponent size - * desired. To do eht exponentiation, the exponent is expressed in base - * "order" (sorry for the confusing terminology) and the precomputed powers - * are combined. - * - * This implementation allows only power-of-2 values for "order". Using - * other numbers can be more efficient, but it's more work and for the - * popular exponent size of 320 bits, an order of 8 is optimal, so it - * hasn't seemed worth it to implement. - * - * Here's a table of the optimal power-of-2 order for various exponent - * sizes and the associated (average) cost for an exponentiation. - * Note that *higher* orders are more memory-efficient; the number - * of precomputed values required is ceil(ebits/order). (Ignore the - * underscores in the middle of numbers; they're harmless.) - * - * At 2 bits, order 2 uses 0.000000 multiplies - * At 4 bits, order 2 uses 1.000000 multiplies - * At 8 bits, order 2 uses 3.000000 multiplies - * At 1_6 bits, order 2 uses 7.000000 multiplies - * At 3_2 bits, order 2 uses 15.000000 multiplies - * At 34 bits, 15.750000 (order 4) < 1_6.000000 (order 2) - * At 6_4 bits, order 4 uses 27.000000 multiplies - * At 99 bits, 39.875000 (order 8) < 40.250000 (order 4) - * At 128 bits, order 8 uses 48.500000 multiplies - * At 256 bits, order 8 uses 85.875000 multiplies - * At 280 bits, 92.625000 (order 1_6) < 92.875000 (order 8) - * At 512 bits, order 1_6 uses 147.000000 multiplies - * At 785 bits, 211.093750 (order 3_2) < 211.250000 (order 1_6) - * At 1024 bits, order 3_2 uses 257.562500 multiplies - * At 2048 bits, order 3_2 uses 456.093750 multiplies - * At 2148 bits, 475.406250 (order 6_4) < 475.468750 (order 3_2) - * At 4096 bits, order 6_4 uses 795.281250 multiplies - * At 5726 bits, 1062.609375 (order 128) < 1062.843750 (order 6_4) - * At 8192 bits, order 128 uses 1412.609375 multiplies - * At 14848 bits, 2355.750000 (order 256) < 2355.929688 (order 128) - * At 37593 bits, 5187.841797 (order 512) < 5188.144531 (order 256) - */ -int -bnBasePrecompBegin_32(struct BnBasePrecomp *pre, struct BigNum const *base, - struct BigNum const *mod, unsigned maxebits) -{ - int i; - BNWORD32 **array; /* Array of precomputed powers of base */ - unsigned n; /* Number of entries in array (needed) */ - unsigned m; /* Number of entries in array (non-NULL) */ - unsigned arraysize; /* Number of entries in array (allocated) */ - unsigned bits; /* log2(order) */ - unsigned msize = lbnNorm_32((BNWORD32 *)mod->ptr, mod->size); - static unsigned const bnBasePrecompThreshTable[] = { - 33, 98, 279, 784, 2147, 5725, 14847, 37592, (unsigned)-1 - }; - - /* Clear pre in case of failure */ - pre->array = 0; - pre->msize = 0; - pre->bits = 0; - pre->maxebits = 0; - pre->arraysize = 0; - pre->entries = 0; - - /* Find the correct bit-window size */ - bits = 0; - do - bits++; - while (maxebits > bnBasePrecompThreshTable[bits]); - - /* Now the number of precomputed values we need */ - n = (maxebits+bits-1)/bits; - assert(n*bits >= maxebits); - - arraysize = n+1; /* Add one trailing NULL for safety */ - array = lbnMemAlloc(arraysize * sizeof(*array)); - if (!array) - return -1; /* Out of memory */ - - /* Now allocate the entries (precomputed powers of base) */ - for (m = 0; m < n; m++) { - BNWORD32 *entry; - - LBNALLOC(entry, BNWORD32, msize); - if (!entry) - break; - array[m] = entry; - } - - /* "m" is the number of successfully allocated entries */ - if (m < n) { - /* Ran out of memory; see if we can use a smaller array */ - BNWORD32 **newarray; - - if (m < 2) { - n = 0; /* Forget it */ - } else { - /* How few bits can we use with what's allocated? */ - bits = (maxebits + m - 1) / m; -retry: - n = (maxebits + bits - 1) / bits; - if (! (n >> bits) ) - n = 0; /* Not enough to amount to anything */ - } - /* Free excess allocated array entries */ - while (m > n) { - BNWORD32 *entry = array[--m]; - LBNFREE(entry, msize); - } - if (!n) { - /* Give it up */ - lbnMemFree(array, arraysize * sizeof(*array)); - return -1; - } - /* - * Try to shrink the pointer array. This might fail, but - * it's not critical. lbnMemRealloc isn't guarnateed to - * exist, so we may have to allocate, copy, and free. - */ -#ifdef lbnMemRealloc - newarray = lbnMemRealloc(array, arraysize * sizeof(*array), - (n+1) * sizeof(*array)); - if (newarray) { - array = newarray; - arraysize = n+1; - } -#else - newarray = lbnMemAlloc((n+1) * sizeof(*array)); - if (newarray) { - memcpy(newarray, array, n * sizeof(*array)); - lbnMemFree(array, arraysize * sizeof(*array)); - array = newarray; - arraysize = n+1; - } -#endif - } - - /* Pad with null pointers */ - while (m < arraysize) - array[m++] = 0; - - /* Okay, we have our array, now initialize it */ - i = lbnBasePrecompBegin_32(array, n, bits, - (BNWORD32 *)base->ptr, base->size, - (BNWORD32 *)mod->ptr, msize); - if (i < 0) { - /* Ack, still out of memory */ - bits++; - m = n; - goto retry; - } - /* Finally, totoal success */ - pre->array = array; - pre->bits = bits; - pre->msize = msize; - pre->maxebits = n * bits; - pre->arraysize = arraysize; - pre->entries = n; - return 0; -} - -/* Free everything preallocated */ -void -bnBasePrecompEnd_32(struct BnBasePrecomp *pre) -{ - BNWORD32 **array = pre->array; - - if (array) { - unsigned entries = pre->entries; - unsigned msize = pre->msize; - unsigned m; - - for (m = 0; m < entries; m++) { - BNWORD32 *entry = array[m]; - if (entry) - LBNFREE(entry, msize); - } - lbnMemFree(array, pre->arraysize * sizeof(array)); - } - pre->array = 0; - pre->bits = 0; - pre->msize = 0; - pre->maxebits = 0; - pre->arraysize = 0; - pre->entries = 0; -} - -int -bnBasePrecompExpMod_32(struct BigNum *dest, struct BnBasePrecomp const *pre, - struct BigNum const *exp, struct BigNum const *mod) -{ - unsigned msize = lbnNorm_32((BNWORD32 *)mod->ptr, mod->size); - unsigned esize = lbnNorm_32((BNWORD32 *)exp->ptr, exp->size); - BNWORD32 const * const *array = pre->array; - int i; - - assert(msize == pre->msize); - assert(((BNWORD32 *)mod->ptr)[BIGLITTLE(-1,0)] & 1); - assert(lbnBits_32((BNWORD32 *)exp->ptr, esize) <= pre->maxebits); - - bnSizeCheck(dest, msize); - - i = lbnBasePrecompExp_32(dest->ptr, array, pre->bits, - exp->ptr, esize, mod->ptr, msize); - if (i == 0) - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, msize); - return i; -} - -int -bnDoubleBasePrecompExpMod_32(struct BigNum *dest, - struct BnBasePrecomp const *pre1, struct BigNum const *exp1, - struct BnBasePrecomp const *pre2, struct BigNum const *exp2, - struct BigNum const *mod) -{ - unsigned msize = lbnNorm_32((BNWORD32 *)mod->ptr, mod->size); - unsigned e1size = lbnNorm_32((BNWORD32 *)exp1->ptr, exp1->size); - unsigned e2size = lbnNorm_32((BNWORD32 *)exp1->ptr, exp2->size); - BNWORD32 const * const *array1 = pre1->array; - BNWORD32 const * const *array2 = pre2->array; - int i; - - assert(msize == pre1->msize); - assert(msize == pre2->msize); - assert(((BNWORD32 *)mod->ptr)[BIGLITTLE(-1,0)] & 1); - assert(lbnBits_32((BNWORD32 *)exp1->ptr, e1size) <= pre1->maxebits); - assert(lbnBits_32((BNWORD32 *)exp2->ptr, e2size) <= pre2->maxebits); - assert(pre1->bits == pre2->bits); - - bnSizeCheck(dest, msize); - - i = lbnDoubleBasePrecompExp_32(dest->ptr, pre1->bits, array1, - exp1->ptr, e1size, array2, exp2->ptr, e2size, - mod->ptr, msize); - if (i == 0) - dest->size = lbnNorm_32((BNWORD32 *)dest->ptr, msize); - return i; -} diff --git a/libs/libzrtp/third_party/bnlib/bn32.h b/libs/libzrtp/third_party/bnlib/bn32.h deleted file mode 100644 index d8f5acd906..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn32.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn32.h - interface to 32-bit bignum routines. - */ -struct BigNum; -struct BnBasePrecomp; - -void bnInit_32(void); -void bnEnd_32(struct BigNum *bn); -int bnPrealloc_32(struct BigNum *bn, unsigned bits); -int bnCopy_32(struct BigNum *dest, struct BigNum const *src); -int bnSwap_32(struct BigNum *a, struct BigNum *b); -void bnNorm_32(struct BigNum *bn); -void bnExtractBigBytes_32(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned dlen); -int bnInsertBigBytes_32(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); -void bnExtractLittleBytes_32(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned dlen); -int bnInsertLittleBytes_32(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); -unsigned bnLSWord_32(struct BigNum const *src); -int bnReadBit_32(struct BigNum const *bn, unsigned bit); -unsigned bnBits_32(struct BigNum const *src); -int bnAdd_32(struct BigNum *dest, struct BigNum const *src); -int bnSub_32(struct BigNum *dest, struct BigNum const *src); -int bnCmpQ_32(struct BigNum const *a, unsigned b); -int bnSetQ_32(struct BigNum *dest, unsigned src); -int bnAddQ_32(struct BigNum *dest, unsigned src); -int bnSubQ_32(struct BigNum *dest, unsigned src); -int bnCmp_32(struct BigNum const *a, struct BigNum const *b); -int bnSquare_32(struct BigNum *dest, struct BigNum const *src); -int bnMul_32(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); -int bnMulQ_32(struct BigNum *dest, struct BigNum const *a, unsigned b); -int bnDivMod_32(struct BigNum *q, struct BigNum *r, struct BigNum const *n, - struct BigNum const *d); -int bnMod_32(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *d); -unsigned bnModQ_32(struct BigNum const *src, unsigned d); -int bnExpMod_32(struct BigNum *dest, struct BigNum const *n, - struct BigNum const *exp, struct BigNum const *mod); -int bnDoubleExpMod_32(struct BigNum *dest, - struct BigNum const *n1, struct BigNum const *e1, - struct BigNum const *n2, struct BigNum const *e2, - struct BigNum const *mod); -int bnTwoExpMod_32(struct BigNum *n, struct BigNum const *exp, - struct BigNum const *mod); -int bnGcd_32(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); -int bnInv_32(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *mod); -int bnLShift_32(struct BigNum *dest, unsigned amt); -void bnRShift_32(struct BigNum *dest, unsigned amt); -unsigned bnMakeOdd_32(struct BigNum *n); -int bnBasePrecompBegin_32(struct BnBasePrecomp *pre, struct BigNum const *base, - struct BigNum const *mod, unsigned maxebits); -void bnBasePrecompEnd_32(struct BnBasePrecomp *pre); -int bnBasePrecompExpMod_32(struct BigNum *dest, struct BnBasePrecomp const *pre, - struct BigNum const *exp, struct BigNum const *mod); -int bnDoubleBasePrecompExpMod_32(struct BigNum *dest, - struct BnBasePrecomp const *pre1, struct BigNum const *exp1, - struct BnBasePrecomp const *pre2, struct BigNum const *exp2, - struct BigNum const *mod); diff --git a/libs/libzrtp/third_party/bnlib/bn64.c b/libs/libzrtp/third_party/bnlib/bn64.c deleted file mode 100644 index 841a277a48..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn64.c +++ /dev/null @@ -1,1182 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn64.c - the high-level bignum interface - * - * Like lbn64.c, this reserves the string "64" for textual replacement. - * The string must not appear anywhere unless it is intended to be replaced - * to generate other bignum interface functions. - */ - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#if !NO_STRING_H -#include <string.h> /* for memmove() in bnMakeOdd */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -/* - * This was useful during debugging, so it's left in here. - * You can ignore it. DBMALLOC is generally undefined. - */ -#ifndef DBMALLOC -#define DBMALLOC 0 -#endif -#if DBMALLOC -#include "../dbmalloc/malloc.h" -#define MALLOCDB malloc_chain_check(1) -#else -#define MALLOCDB (void)0 -#endif - -#include "lbn.h" -#include "lbn64.h" -#include "lbnmem.h" -#include "bn64.h" -#include "bn.h" - -/* Work-arounds for some particularly broken systems */ -#include "kludge.h" /* For memmove() */ - -/* Functions */ -void -bnInit_64(void) -{ - bnEnd = bnEnd_64; - bnPrealloc = bnPrealloc_64; - bnCopy = bnCopy_64; - bnNorm = bnNorm_64; - bnExtractBigBytes = bnExtractBigBytes_64; - bnInsertBigBytes = bnInsertBigBytes_64; - bnExtractLittleBytes = bnExtractLittleBytes_64; - bnInsertLittleBytes = bnInsertLittleBytes_64; - bnLSWord = bnLSWord_64; - bnReadBit = bnReadBit_64; - bnBits = bnBits_64; - bnAdd = bnAdd_64; - bnSub = bnSub_64; - bnCmpQ = bnCmpQ_64; - bnSetQ = bnSetQ_64; - bnAddQ = bnAddQ_64; - bnSubQ = bnSubQ_64; - bnCmp = bnCmp_64; - bnSquare = bnSquare_64; - bnMul = bnMul_64; - bnMulQ = bnMulQ_64; - bnDivMod = bnDivMod_64; - bnMod = bnMod_64; - bnModQ = bnModQ_64; - bnExpMod = bnExpMod_64; - bnDoubleExpMod = bnDoubleExpMod_64; - bnTwoExpMod = bnTwoExpMod_64; - bnGcd = bnGcd_64; - bnInv = bnInv_64; - bnLShift = bnLShift_64; - bnRShift = bnRShift_64; - bnMakeOdd = bnMakeOdd_64; - bnBasePrecompBegin = bnBasePrecompBegin_64; - bnBasePrecompEnd = bnBasePrecompEnd_64; - bnBasePrecompExpMod = bnBasePrecompExpMod_64; - bnDoubleBasePrecompExpMod = bnDoubleBasePrecompExpMod_64; -} - -void -bnEnd_64(struct BigNum *bn) -{ - if (bn->ptr) { - LBNFREE((BNWORD64 *)bn->ptr, bn->allocated); - bn->ptr = 0; - } - bn->size = 0; - bn->allocated = 0; - - MALLOCDB; -} - -/* Internal function. It operates in words. */ -static int -bnResize_64(struct BigNum *bn, unsigned len) -{ - void *p; - - /* Round size up: most mallocs impose 8-byte granularity anyway */ - len = (len + (8/sizeof(BNWORD64) - 1)) & ~(8/sizeof(BNWORD64) - 1); - p = LBNREALLOC((BNWORD64 *)bn->ptr, bn->allocated, len); - if (!p) - return -1; - bn->ptr = p; - bn->allocated = len; - - MALLOCDB; - - return 0; -} - -#define bnSizeCheck(bn, size) \ - if (bn->allocated < size && bnResize_64(bn, size) < 0) \ - return -1 - -/* Preallocate enough space in bn to hold "bits" bits. */ -int -bnPrealloc_64(struct BigNum *bn, unsigned bits) -{ - bits = (bits + 64-1)/64; - bnSizeCheck(bn, bits); - MALLOCDB; - return 0; -} - -int -bnCopy_64(struct BigNum *dest, struct BigNum const *src) -{ - bnSizeCheck(dest, src->size); - dest->size = src->size; - lbnCopy_64((BNWORD64 *)dest->ptr, (BNWORD64 *)src->ptr, src->size); - MALLOCDB; - return 0; -} - -/* Is this ever needed? Normalize the bn by deleting high-order 0 words */ -void -bnNorm_64(struct BigNum *bn) -{ - bn->size = lbnNorm_64((BNWORD64 *)bn->ptr, bn->size); -} - -/* - * Convert a bignum to big-endian bytes. Returns, in big-endian form, a - * substring of the bignum starting from lsbyte and "len" bytes long. - * Unused high-order (leading) bytes are filled with 0. - */ -void -bnExtractBigBytes_64(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size * (64 / 8); - - /* Fill unused leading bytes with 0 */ - while (s < lsbyte + len) { - *dest++ = 0; - len--; - } - - if (len) - lbnExtractBigBytes_64((BNWORD64 *)bn->ptr, dest, lsbyte, len); - MALLOCDB; -} - -/* The inverse of the above. */ -int -bnInsertBigBytes_64(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size; - unsigned words = (len+lsbyte+sizeof(BNWORD64)-1) / sizeof(BNWORD64); - - /* Pad with zeros as required */ - bnSizeCheck(bn, words); - - if (s < words) { - lbnZero_64((BNWORD64 *)bn->ptr BIGLITTLE(-s,+s), words-s); - s = words; - } - - lbnInsertBigBytes_64((BNWORD64 *)bn->ptr, src, lsbyte, len); - - bn->size = lbnNorm_64((BNWORD64 *)bn->ptr, s); - - MALLOCDB; - return 0; -} - - -/* - * Convert a bignum to little-endian bytes. Returns, in little-endian form, a - * substring of the bignum starting from lsbyte and "len" bytes long. - * Unused high-order (trailing) bytes are filled with 0. - */ -void -bnExtractLittleBytes_64(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size * (64 / 8); - - /* Fill unused leading bytes with 0 */ - while (s < lsbyte + len) - dest[--len] = 0; - - if (len) - lbnExtractLittleBytes_64((BNWORD64 *)bn->ptr, dest, - lsbyte, len); - MALLOCDB; -} - -/* The inverse of the above */ -int -bnInsertLittleBytes_64(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len) -{ - unsigned s = bn->size; - unsigned words = (len+lsbyte+sizeof(BNWORD64)-1) / sizeof(BNWORD64); - - /* Pad with zeros as required */ - bnSizeCheck(bn, words); - - if (s < words) { - lbnZero_64((BNWORD64 *)bn->ptr BIGLITTLE(-s,+s), words-s); - s = words; - } - - lbnInsertLittleBytes_64((BNWORD64 *)bn->ptr, src, lsbyte, len); - - bn->size = lbnNorm_64((BNWORD64 *)bn->ptr, s); - - MALLOCDB; - return 0; -} - -/* Return the least-significant word of the input. */ -unsigned -bnLSWord_64(struct BigNum const *bn) -{ - return bn->size ? (unsigned)((BNWORD64 *)bn->ptr)[BIGLITTLE(-1,0)]: 0; -} - -/* Return a selected bit of the data */ -int -bnReadBit_64(struct BigNum const *bn, unsigned bit) -{ - BNWORD64 word; - if (bit/64 >= bn->size) - return 0; - word = ((BNWORD64 *)bn->ptr)[BIGLITTLE(-1-bit/64,bit/64)]; - return (int)(word >> (bit % 64) & 1); -} - -/* Count the number of significant bits. */ -unsigned -bnBits_64(struct BigNum const *bn) -{ - return lbnBits_64((BNWORD64 *)bn->ptr, bn->size); -} - -/* dest += src */ -int -bnAdd_64(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s = src->size, d = dest->size; - BNWORD64 t; - - if (!s) - return 0; - - bnSizeCheck(dest, s); - - if (d < s) { - lbnZero_64((BNWORD64 *)dest->ptr BIGLITTLE(-d,+d), s-d); - dest->size = d = s; - MALLOCDB; - } - t = lbnAddN_64((BNWORD64 *)dest->ptr, (BNWORD64 *)src->ptr, s); - MALLOCDB; - if (t) { - if (d > s) { - t = lbnAdd1_64((BNWORD64 *)dest->ptr BIGLITTLE(-s,+s), - d-s, t); - MALLOCDB; - } - if (t) { - bnSizeCheck(dest, d+1); - ((BNWORD64 *)dest->ptr)[BIGLITTLE(-1-d,d)] = t; - dest->size = d+1; - } - } - return 0; -} - -/* - * dest -= src. - * If dest goes negative, this produces the absolute value of - * the difference (the negative of the true value) and returns 1. - * Otherwise, it returls 0. - */ -int -bnSub_64(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s = src->size, d = dest->size; - BNWORD64 t; - - if (d < s && d < (s = lbnNorm_64((BNWORD64 *)src->ptr, s))) { - bnSizeCheck(dest, s); - lbnZero_64((BNWORD64 *)dest->ptr BIGLITTLE(-d,+d), s-d); - dest->size = d = s; - MALLOCDB; - } - if (!s) - return 0; - t = lbnSubN_64((BNWORD64 *)dest->ptr, (BNWORD64 *)src->ptr, s); - MALLOCDB; - if (t) { - if (d > s) { - t = lbnSub1_64((BNWORD64 *)dest->ptr BIGLITTLE(-s,+s), - d-s, t); - MALLOCDB; - } - if (t) { - lbnNeg_64((BNWORD64 *)dest->ptr, d); - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, - dest->size); - MALLOCDB; - return 1; - } - } - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, dest->size); - return 0; -} - -/* - * Compare the BigNum to the given value, which must be < 65536. - * Returns -1. 0 or 1 if a<b, a == b or a>b. - * a <=> b --> bnCmpQ(a,b) <=> 0 - */ -int -bnCmpQ_64(struct BigNum const *a, unsigned b) -{ - unsigned t; - BNWORD64 v; - - t = lbnNorm_64((BNWORD64 *)a->ptr, a->size); - /* If a is more than one word long or zero, it's easy... */ - if (t != 1) - return (t > 1) ? 1 : (b ? -1 : 0); - v = (unsigned)((BNWORD64 *)a->ptr)[BIGLITTLE(-1,0)]; - return (v > b) ? 1 : ((v < b) ? -1 : 0); -} - -/* Set dest to a small value */ -int -bnSetQ_64(struct BigNum *dest, unsigned src) -{ - if (src) { - bnSizeCheck(dest, 1); - - ((BNWORD64 *)dest->ptr)[BIGLITTLE(-1,0)] = (BNWORD64)src; - dest->size = 1; - } else { - dest->size = 0; - } - return 0; -} - -/* dest += src */ -int -bnAddQ_64(struct BigNum *dest, unsigned src) -{ - BNWORD64 t; - - if (!dest->size) - return bnSetQ(dest, src); - - t = lbnAdd1_64((BNWORD64 *)dest->ptr, dest->size, (BNWORD64)src); - MALLOCDB; - if (t) { - src = dest->size; - bnSizeCheck(dest, src+1); - ((BNWORD64 *)dest->ptr)[BIGLITTLE(-1-src,src)] = t; - dest->size = src+1; - } - return 0; -} - -/* - * Return value as for bnSub: 1 if subtract underflowed, in which - * case the return is the negative of the computed value. - */ -int -bnSubQ_64(struct BigNum *dest, unsigned src) -{ - BNWORD64 t; - - if (!dest->size) - return bnSetQ(dest, src) < 0 ? -1 : (src != 0); - - t = lbnSub1_64((BNWORD64 *)dest->ptr, dest->size, src); - MALLOCDB; - if (t) { - /* Underflow. <= 1 word, so do it simply. */ - lbnNeg_64((BNWORD64 *)dest->ptr, 1); - dest->size = 1; - return 1; - } -/* Try to normalize? Needing this is going to be pretty damn rare. */ -/* dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, dest->size); */ - return 0; -} - -/* - * Compare two BigNums. Returns -1. 0 or 1 if a<b, a == b or a>b. - * a <=> b --> bnCmp(a,b) <=> 0 - */ -int -bnCmp_64(struct BigNum const *a, struct BigNum const *b) -{ - unsigned s, t; - - s = lbnNorm_64((BNWORD64 *)a->ptr, a->size); - t = lbnNorm_64((BNWORD64 *)b->ptr, b->size); - - if (s != t) - return s > t ? 1 : -1; - return lbnCmp_64((BNWORD64 *)a->ptr, (BNWORD64 *)b->ptr, s); -} - -/* dest = src*src. This is more efficient than bnMul. */ -int -bnSquare_64(struct BigNum *dest, struct BigNum const *src) -{ - unsigned s; - BNWORD64 *srcbuf; - - s = lbnNorm_64((BNWORD64 *)src->ptr, src->size); - if (!s) { - dest->size = 0; - return 0; - } - bnSizeCheck(dest, 2*s); - - if (src == dest) { - LBNALLOC(srcbuf, BNWORD64, s); - if (!srcbuf) - return -1; - lbnCopy_64(srcbuf, (BNWORD64 *)src->ptr, s); - lbnSquare_64((BNWORD64 *)dest->ptr, (BNWORD64 *)srcbuf, s); - LBNFREE(srcbuf, s); - } else { - lbnSquare_64((BNWORD64 *)dest->ptr, (BNWORD64 *)src->ptr, s); - } - - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, 2*s); - MALLOCDB; - return 0; -} - -/* dest = a * b. Any overlap between operands is allowed. */ -int -bnMul_64(struct BigNum *dest, struct BigNum const *a, struct BigNum const *b) -{ - unsigned s, t; - BNWORD64 *srcbuf; - - s = lbnNorm_64((BNWORD64 *)a->ptr, a->size); - t = lbnNorm_64((BNWORD64 *)b->ptr, b->size); - - if (!s || !t) { - dest->size = 0; - return 0; - } - - if (a == b) - return bnSquare_64(dest, a); - - bnSizeCheck(dest, s+t); - - if (dest == a) { - LBNALLOC(srcbuf, BNWORD64, s); - if (!srcbuf) - return -1; - lbnCopy_64(srcbuf, (BNWORD64 *)a->ptr, s); - lbnMul_64((BNWORD64 *)dest->ptr, srcbuf, s, - (BNWORD64 *)b->ptr, t); - LBNFREE(srcbuf, s); - } else if (dest == b) { - LBNALLOC(srcbuf, BNWORD64, t); - if (!srcbuf) - return -1; - lbnCopy_64(srcbuf, (BNWORD64 *)b->ptr, t); - lbnMul_64((BNWORD64 *)dest->ptr, (BNWORD64 *)a->ptr, s, - srcbuf, t); - LBNFREE(srcbuf, t); - } else { - lbnMul_64((BNWORD64 *)dest->ptr, (BNWORD64 *)a->ptr, s, - (BNWORD64 *)b->ptr, t); - } - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, s+t); - MALLOCDB; - return 0; -} - -/* dest = a * b */ -int -bnMulQ_64(struct BigNum *dest, struct BigNum const *a, unsigned b) -{ - unsigned s; - - s = lbnNorm_64((BNWORD64 *)a->ptr, a->size); - if (!s || !b) { - dest->size = 0; - return 0; - } - if (b == 1) - return bnCopy_64(dest, a); - bnSizeCheck(dest, s+1); - lbnMulN1_64((BNWORD64 *)dest->ptr, (BNWORD64 *)a->ptr, s, b); - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, s+1); - MALLOCDB; - return 0; -} - -/* q = n/d, r = n % d */ -int -bnDivMod_64(struct BigNum *q, struct BigNum *r, struct BigNum const *n, - struct BigNum const *d) -{ - unsigned dsize, nsize; - BNWORD64 qhigh; - - dsize = lbnNorm_64((BNWORD64 *)d->ptr, d->size); - nsize = lbnNorm_64((BNWORD64 *)n->ptr, n->size); - - if (nsize < dsize) { - q->size = 0; /* No quotient */ - r->size = nsize; - return 0; /* Success */ - } - - bnSizeCheck(q, nsize-dsize); - - if (r != n) { /* You are allowed to reduce in place */ - bnSizeCheck(r, nsize); - lbnCopy_64((BNWORD64 *)r->ptr, (BNWORD64 *)n->ptr, nsize); - } - - qhigh = lbnDiv_64((BNWORD64 *)q->ptr, (BNWORD64 *)r->ptr, nsize, - (BNWORD64 *)d->ptr, dsize); - nsize -= dsize; - if (qhigh) { - bnSizeCheck(q, nsize+1); - *((BNWORD64 *)q->ptr BIGLITTLE(-nsize-1,+nsize)) = qhigh; - q->size = nsize+1; - } else { - q->size = lbnNorm_64((BNWORD64 *)q->ptr, nsize); - } - r->size = lbnNorm_64((BNWORD64 *)r->ptr, dsize); - MALLOCDB; - return 0; -} - -/* det = src % d */ -int -bnMod_64(struct BigNum *dest, struct BigNum const *src, struct BigNum const *d) -{ - unsigned dsize, nsize; - - nsize = lbnNorm_64((BNWORD64 *)src->ptr, src->size); - dsize = lbnNorm_64((BNWORD64 *)d->ptr, d->size); - - - if (dest != src) { - bnSizeCheck(dest, nsize); - lbnCopy_64((BNWORD64 *)dest->ptr, (BNWORD64 *)src->ptr, nsize); - } - - if (nsize < dsize) { - dest->size = nsize; /* No quotient */ - return 0; - } - - (void)lbnDiv_64((BNWORD64 *)dest->ptr BIGLITTLE(-dsize,+dsize), - (BNWORD64 *)dest->ptr, nsize, - (BNWORD64 *)d->ptr, dsize); - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, dsize); - MALLOCDB; - return 0; -} - -/* return src % d. */ -unsigned -bnModQ_64(struct BigNum const *src, unsigned d) -{ - unsigned s; - - s = lbnNorm_64((BNWORD64 *)src->ptr, src->size); - if (!s) - return 0; - - if (d & (d-1)) /* Not a power of 2 */ - d = lbnModQ_64((BNWORD64 *)src->ptr, s, d); - else - d = (unsigned)((BNWORD64 *)src->ptr)[BIGLITTLE(-1,0)] & (d-1); - return d; -} - -/* dest = n^exp (mod mod) */ -int -bnExpMod_64(struct BigNum *dest, struct BigNum const *n, - struct BigNum const *exp, struct BigNum const *mod) -{ - unsigned nsize, esize, msize; - - nsize = lbnNorm_64((BNWORD64 *)n->ptr, n->size); - esize = lbnNorm_64((BNWORD64 *)exp->ptr, exp->size); - msize = lbnNorm_64((BNWORD64 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD64 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(dest, msize); - - /* Special-case base of 2 */ - if (nsize == 1 && ((BNWORD64 *)n->ptr)[BIGLITTLE(-1,0)] == 2) { - if (lbnTwoExpMod_64((BNWORD64 *)dest->ptr, - (BNWORD64 *)exp->ptr, esize, - (BNWORD64 *)mod->ptr, msize) < 0) - return -1; - } else { - if (lbnExpMod_64((BNWORD64 *)dest->ptr, - (BNWORD64 *)n->ptr, nsize, - (BNWORD64 *)exp->ptr, esize, - (BNWORD64 *)mod->ptr, msize) < 0) - return -1; - } - - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, msize); - MALLOCDB; - return 0; -} - -/* - * dest = n1^e1 * n2^e2 (mod mod). This is more efficient than two - * separate modular exponentiations, and in fact asymptotically approaches - * the cost of one. - */ -int -bnDoubleExpMod_64(struct BigNum *dest, - struct BigNum const *n1, struct BigNum const *e1, - struct BigNum const *n2, struct BigNum const *e2, - struct BigNum const *mod) -{ - unsigned n1size, e1size, n2size, e2size, msize; - - n1size = lbnNorm_64((BNWORD64 *)n1->ptr, n1->size); - e1size = lbnNorm_64((BNWORD64 *)e1->ptr, e1->size); - n2size = lbnNorm_64((BNWORD64 *)n2->ptr, n2->size); - e2size = lbnNorm_64((BNWORD64 *)e2->ptr, e2->size); - msize = lbnNorm_64((BNWORD64 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD64 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(dest, msize); - - if (lbnDoubleExpMod_64((BNWORD64 *)dest->ptr, - (BNWORD64 *)n1->ptr, n1size, (BNWORD64 *)e1->ptr, e1size, - (BNWORD64 *)n2->ptr, n2size, (BNWORD64 *)e2->ptr, e2size, - (BNWORD64 *)mod->ptr, msize) < 0) - return -1; - - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, msize); - MALLOCDB; - return 0; -} - -/* n = 2^exp (mod mod) */ -int -bnTwoExpMod_64(struct BigNum *n, struct BigNum const *exp, - struct BigNum const *mod) -{ - unsigned esize, msize; - - esize = lbnNorm_64((BNWORD64 *)exp->ptr, exp->size); - msize = lbnNorm_64((BNWORD64 *)mod->ptr, mod->size); - - if (!msize || (((BNWORD64 *)mod->ptr)[BIGLITTLE(-1,0)] & 1) == 0) - return -1; /* Illegal modulus! */ - - bnSizeCheck(n, msize); - - if (lbnTwoExpMod_64((BNWORD64 *)n->ptr, (BNWORD64 *)exp->ptr, esize, - (BNWORD64 *)mod->ptr, msize) < 0) - return -1; - - n->size = lbnNorm_64((BNWORD64 *)n->ptr, msize); - MALLOCDB; - return 0; -} - -/* dest = gcd(a, b) */ -int -bnGcd_64(struct BigNum *dest, struct BigNum const *a, struct BigNum const *b) -{ - BNWORD64 *tmp; - unsigned asize, bsize; - int i; - - /* Kind of silly, but we might as well permit it... */ - if (a == b) - return dest == a ? 0 : bnCopy(dest, a); - - /* Ensure a is not the same as "dest" */ - if (a == dest) { - a = b; - b = dest; - } - - asize = lbnNorm_64((BNWORD64 *)a->ptr, a->size); - bsize = lbnNorm_64((BNWORD64 *)b->ptr, b->size); - - bnSizeCheck(dest, bsize+1); - - /* Copy a to tmp */ - LBNALLOC(tmp, BNWORD64, asize+1); - if (!tmp) - return -1; - lbnCopy_64(tmp, (BNWORD64 *)a->ptr, asize); - - /* Copy b to dest, if necessary */ - if (dest != b) - lbnCopy_64((BNWORD64 *)dest->ptr, - (BNWORD64 *)b->ptr, bsize); - if (bsize > asize || (bsize == asize && - lbnCmp_64((BNWORD64 *)b->ptr, (BNWORD64 *)a->ptr, asize) > 0)) - { - i = lbnGcd_64((BNWORD64 *)dest->ptr, bsize, tmp, asize, - &dest->size); - if (i > 0) /* Result in tmp, not dest */ - lbnCopy_64((BNWORD64 *)dest->ptr, tmp, dest->size); - } else { - i = lbnGcd_64(tmp, asize, (BNWORD64 *)dest->ptr, bsize, - &dest->size); - if (i == 0) /* Result in tmp, not dest */ - lbnCopy_64((BNWORD64 *)dest->ptr, tmp, dest->size); - } - LBNFREE(tmp, asize+1); - MALLOCDB; - return (i < 0) ? i : 0; -} - -/* - * dest = 1/src (mod mod). Returns >0 if gcd(src, mod) != 1 (in which case - * the inverse does not exist). - */ -int -bnInv_64(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *mod) -{ - unsigned s, m; - int i; - - s = lbnNorm_64((BNWORD64 *)src->ptr, src->size); - m = lbnNorm_64((BNWORD64 *)mod->ptr, mod->size); - - /* lbnInv_64 requires that the input be less than the modulus */ - if (m < s || - (m==s && lbnCmp_64((BNWORD64 *)src->ptr, (BNWORD64 *)mod->ptr, s))) - { - bnSizeCheck(dest, s + (m==s)); - if (dest != src) - lbnCopy_64((BNWORD64 *)dest->ptr, - (BNWORD64 *)src->ptr, s); - /* Pre-reduce modulo the modulus */ - (void)lbnDiv_64((BNWORD64 *)dest->ptr BIGLITTLE(-m,+m), - (BNWORD64 *)dest->ptr, s, - (BNWORD64 *)mod->ptr, m); - s = lbnNorm_64((BNWORD64 *)dest->ptr, m); - MALLOCDB; - } else { - bnSizeCheck(dest, m+1); - if (dest != src) - lbnCopy_64((BNWORD64 *)dest->ptr, - (BNWORD64 *)src->ptr, s); - } - - i = lbnInv_64((BNWORD64 *)dest->ptr, s, (BNWORD64 *)mod->ptr, m); - if (i == 0) - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, m); - - MALLOCDB; - return i; -} - -/* - * Shift a bignum left the appropriate number of bits, - * multiplying by 2^amt. - */ -int -bnLShift_64(struct BigNum *dest, unsigned amt) -{ - unsigned s = dest->size; - BNWORD64 carry; - - if (amt % 64) { - carry = lbnLshift_64((BNWORD64 *)dest->ptr, s, amt % 64); - if (carry) { - s++; - bnSizeCheck(dest, s); - ((BNWORD64 *)dest->ptr)[BIGLITTLE(-s,s-1)] = carry; - } - } - - amt /= 64; - if (amt) { - bnSizeCheck(dest, s+amt); - memmove((BNWORD64 *)dest->ptr BIGLITTLE(-s-amt, +amt), - (BNWORD64 *)dest->ptr BIG(-s), - s * sizeof(BNWORD64)); - lbnZero_64((BNWORD64 *)dest->ptr, amt); - s += amt; - } - dest->size = s; - MALLOCDB; - return 0; -} - -/* - * Shift a bignum right the appropriate number of bits, - * dividing by 2^amt. - */ -void -bnRShift_64(struct BigNum *dest, unsigned amt) -{ - unsigned s = dest->size; - - if (amt >= 64) { - memmove( - (BNWORD64 *)dest->ptr BIG(-s+amt/64), - (BNWORD64 *)dest->ptr BIGLITTLE(-s, +amt/64), - (s-amt/64) * sizeof(BNWORD64)); - s -= amt/64; - amt %= 64; - } - - if (amt) - (void)lbnRshift_64((BNWORD64 *)dest->ptr, s, amt); - - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, s); - MALLOCDB; -} - -/* - * Shift a bignum right until it is odd, and return the number of - * bits shifted. n = d * 2^s. Replaces n with d and returns s. - * Returns 0 when given 0. (Another valid answer is infinity.) - */ -unsigned -bnMakeOdd_64(struct BigNum *n) -{ - unsigned size; - unsigned s; /* shift amount */ - BNWORD64 *p; - BNWORD64 t; - - p = (BNWORD64 *)n->ptr; - size = lbnNorm_64(p, n->size); - if (!size) - return 0; - - t = BIGLITTLE(p[-1],p[0]); - s = 0; - - /* See how many words we have to shift */ - if (!t) { - /* Shift by words */ - do { - s++; - BIGLITTLE(--p,p++); - } while ((t = BIGLITTLE(p[-1],p[0])) == 0); - size -= s; - s *= 64; - memmove((BNWORD64 *)n->ptr BIG(-size), p BIG(-size), - size * sizeof(BNWORD64)); - p = (BNWORD64 *)n->ptr; - MALLOCDB; - } - - assert(t); - - if (!(t & 1)) { - /* Now count the bits */ - do { - t >>= 1; - s++; - } while ((t & 1) == 0); - - /* Shift the bits */ - lbnRshift_64(p, size, s & (64-1)); - /* Renormalize */ - if (BIGLITTLE(*(p-size),*(p+(size-1))) == 0) - --size; - } - n->size = size; - - MALLOCDB; - return s; -} - -/* - * Do base- and modulus-dependent precomputation for rapid computation of - * base^exp (mod mod) with various exponents. - * - * See lbn64.c for the details on how the algorithm works. Basically, - * it involves precomputing a table of powers of base, base^(order^k), - * for a suitable range 0 <= k < n detemined by the maximum exponent size - * desired. To do eht exponentiation, the exponent is expressed in base - * "order" (sorry for the confusing terminology) and the precomputed powers - * are combined. - * - * This implementation allows only power-of-2 values for "order". Using - * other numbers can be more efficient, but it's more work and for the - * popular exponent size of 640 bits, an order of 8 is optimal, so it - * hasn't seemed worth it to implement. - * - * Here's a table of the optimal power-of-2 order for various exponent - * sizes and the associated (average) cost for an exponentiation. - * Note that *higher* orders are more memory-efficient; the number - * of precomputed values required is ceil(ebits/order). (Ignore the - * underscores in the middle of numbers; they're harmless.) - * - * At 2 bits, order 2 uses 0.000000 multiplies - * At 4 bits, order 2 uses 1.000000 multiplies - * At 8 bits, order 2 uses 3.000000 multiplies - * At 1_6 bits, order 2 uses 7.000000 multiplies - * At 3_2 bits, order 2 uses 15.000000 multiplies - * At 34 bits, 15.750000 (order 4) < 1_6.000000 (order 2) - * At 6_4 bits, order 4 uses 27.000000 multiplies - * At 99 bits, 39.875000 (order 8) < 40.250000 (order 4) - * At 128 bits, order 8 uses 48.500000 multiplies - * At 256 bits, order 8 uses 85.875000 multiplies - * At 280 bits, 92.625000 (order 1_6) < 92.875000 (order 8) - * At 512 bits, order 1_6 uses 147.000000 multiplies - * At 785 bits, 211.093750 (order 3_2) < 211.250000 (order 1_6) - * At 1024 bits, order 3_2 uses 257.562500 multiplies - * At 2048 bits, order 3_2 uses 456.093750 multiplies - * At 2148 bits, 475.406250 (order 6_4) < 475.468750 (order 3_2) - * At 4096 bits, order 6_4 uses 795.281250 multiplies - * At 5726 bits, 1062.609375 (order 128) < 1062.843750 (order 6_4) - * At 8192 bits, order 128 uses 1412.609375 multiplies - * At 14848 bits, 2355.750000 (order 256) < 2355.929688 (order 128) - * At 37593 bits, 5187.841797 (order 512) < 5188.144531 (order 256) - */ -int -bnBasePrecompBegin_64(struct BnBasePrecomp *pre, struct BigNum const *base, - struct BigNum const *mod, unsigned maxebits) -{ - int i; - BNWORD64 **array; /* Array of precomputed powers of base */ - unsigned n; /* Number of entries in array (needed) */ - unsigned m; /* Number of entries in array (non-NULL) */ - unsigned arraysize; /* Number of entries in array (allocated) */ - unsigned bits; /* log2(order) */ - unsigned msize = lbnNorm_64((BNWORD64 *)mod->ptr, mod->size); - static unsigned const bnBasePrecompThreshTable[] = { - 33, 98, 279, 784, 2147, 5725, 14847, 37592, (unsigned)-1 - }; - - /* Clear pre in case of failure */ - pre->array = 0; - pre->msize = 0; - pre->bits = 0; - pre->maxebits = 0; - pre->arraysize = 0; - pre->entries = 0; - - /* Find the correct bit-window size */ - bits = 0; - do - bits++; - while (maxebits > bnBasePrecompThreshTable[bits]); - - /* Now the number of precomputed values we need */ - n = (maxebits+bits-1)/bits; - assert(n*bits >= maxebits); - - arraysize = n+1; /* Add one trailing NULL for safety */ - array = lbnMemAlloc(arraysize * sizeof(*array)); - if (!array) - return -1; /* Out of memory */ - - /* Now allocate the entries (precomputed powers of base) */ - for (m = 0; m < n; m++) { - BNWORD64 *entry; - - LBNALLOC(entry, BNWORD64, msize); - if (!entry) - break; - array[m] = entry; - } - - /* "m" is the number of successfully allocated entries */ - if (m < n) { - /* Ran out of memory; see if we can use a smaller array */ - BNWORD64 **newarray; - - if (m < 2) { - n = 0; /* Forget it */ - } else { - /* How few bits can we use with what's allocated? */ - bits = (maxebits + m - 1) / m; -retry: - n = (maxebits + bits - 1) / bits; - if (! (n >> bits) ) - n = 0; /* Not enough to amount to anything */ - } - /* Free excess allocated array entries */ - while (m > n) { - BNWORD64 *entry = array[--m]; - LBNFREE(entry, msize); - } - if (!n) { - /* Give it up */ - lbnMemFree(array, arraysize * sizeof(*array)); - return -1; - } - /* - * Try to shrink the pointer array. This might fail, but - * it's not critical. lbnMemRealloc isn't guarnateed to - * exist, so we may have to allocate, copy, and free. - */ -#ifdef lbnMemRealloc - newarray = lbnMemRealloc(array, arraysize * sizeof(*array), - (n+1) * sizeof(*array)); - if (newarray) { - array = newarray; - arraysize = n+1; - } -#else - newarray = lbnMemAlloc((n+1) * sizeof(*array)); - if (newarray) { - memcpy(newarray, array, n * sizeof(*array)); - lbnMemFree(array, arraysize * sizeof(*array)); - array = newarray; - arraysize = n+1; - } -#endif - } - - /* Pad with null pointers */ - while (m < arraysize) - array[m++] = 0; - - /* Okay, we have our array, now initialize it */ - i = lbnBasePrecompBegin_64(array, n, bits, - (BNWORD64 *)base->ptr, base->size, - (BNWORD64 *)mod->ptr, msize); - if (i < 0) { - /* Ack, still out of memory */ - bits++; - m = n; - goto retry; - } - /* Finally, totoal success */ - pre->array = array; - pre->bits = bits; - pre->msize = msize; - pre->maxebits = n * bits; - pre->arraysize = arraysize; - pre->entries = n; - return 0; -} - -/* Free everything preallocated */ -void -bnBasePrecompEnd_64(struct BnBasePrecomp *pre) -{ - BNWORD64 **array = pre->array; - - if (array) { - unsigned entries = pre->entries; - unsigned msize = pre->msize; - unsigned m; - - for (m = 0; m < entries; m++) { - BNWORD64 *entry = array[m]; - if (entry) - LBNFREE(entry, msize); - } - lbnMemFree(array, pre->arraysize * sizeof(array)); - } - pre->array = 0; - pre->bits = 0; - pre->msize = 0; - pre->maxebits = 0; - pre->arraysize = 0; - pre->entries = 0; -} - -int -bnBasePrecompExpMod_64(struct BigNum *dest, struct BnBasePrecomp const *pre, - struct BigNum const *exp, struct BigNum const *mod) -{ - unsigned msize = lbnNorm_64((BNWORD64 *)mod->ptr, mod->size); - unsigned esize = lbnNorm_64((BNWORD64 *)exp->ptr, exp->size); - BNWORD64 const * const *array = pre->array; - int i; - - assert(msize == pre->msize); - assert(((BNWORD64 *)mod->ptr)[BIGLITTLE(-1,0)] & 1); - assert(lbnBits_64((BNWORD64 *)exp->ptr, esize) <= pre->maxebits); - - bnSizeCheck(dest, msize); - - i = lbnBasePrecompExp_64(dest->ptr, array, pre->bits, - exp->ptr, esize, mod->ptr, msize); - if (i == 0) - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, msize); - return i; -} - -int -bnDoubleBasePrecompExpMod_64(struct BigNum *dest, - struct BnBasePrecomp const *pre1, struct BigNum const *exp1, - struct BnBasePrecomp const *pre2, struct BigNum const *exp2, - struct BigNum const *mod) -{ - unsigned msize = lbnNorm_64((BNWORD64 *)mod->ptr, mod->size); - unsigned e1size = lbnNorm_64((BNWORD64 *)exp1->ptr, exp1->size); - unsigned e2size = lbnNorm_64((BNWORD64 *)exp1->ptr, exp2->size); - BNWORD64 const * const *array1 = pre1->array; - BNWORD64 const * const *array2 = pre2->array; - int i; - - assert(msize == pre1->msize); - assert(msize == pre2->msize); - assert(((BNWORD64 *)mod->ptr)[BIGLITTLE(-1,0)] & 1); - assert(lbnBits_64((BNWORD64 *)exp1->ptr, e1size) <= pre1->maxebits); - assert(lbnBits_64((BNWORD64 *)exp2->ptr, e2size) <= pre2->maxebits); - assert(pre1->bits == pre2->bits); - - bnSizeCheck(dest, msize); - - i = lbnDoubleBasePrecompExp_64(dest->ptr, pre1->bits, array1, - exp1->ptr, e1size, array2, exp2->ptr, e2size, - mod->ptr, msize); - if (i == 0) - dest->size = lbnNorm_64((BNWORD64 *)dest->ptr, msize); - return i; -} diff --git a/libs/libzrtp/third_party/bnlib/bn64.h b/libs/libzrtp/third_party/bnlib/bn64.h deleted file mode 100644 index 95bc73dd44..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn64.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn64.h - interface to 64-bit bignum routines. - */ -struct BigNum; -struct BnBasePrecomp; - -void bnInit_64(void); -void bnEnd_64(struct BigNum *bn); -int bnPrealloc_64(struct BigNum *bn, unsigned bits); -int bnCopy_64(struct BigNum *dest, struct BigNum const *src); -int bnSwap_64(struct BigNum *a, struct BigNum *b); -void bnNorm_64(struct BigNum *bn); -void bnExtractBigBytes_64(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned dlen); -int bnInsertBigBytes_64(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); -void bnExtractLittleBytes_64(struct BigNum const *bn, unsigned char *dest, - unsigned lsbyte, unsigned dlen); -int bnInsertLittleBytes_64(struct BigNum *bn, unsigned char const *src, - unsigned lsbyte, unsigned len); -unsigned bnLSWord_64(struct BigNum const *src); -int bnReadBit_64(struct BigNum const *bn, unsigned bit); -unsigned bnBits_64(struct BigNum const *src); -int bnAdd_64(struct BigNum *dest, struct BigNum const *src); -int bnSub_64(struct BigNum *dest, struct BigNum const *src); -int bnCmpQ_64(struct BigNum const *a, unsigned b); -int bnSetQ_64(struct BigNum *dest, unsigned src); -int bnAddQ_64(struct BigNum *dest, unsigned src); -int bnSubQ_64(struct BigNum *dest, unsigned src); -int bnCmp_64(struct BigNum const *a, struct BigNum const *b); -int bnSquare_64(struct BigNum *dest, struct BigNum const *src); -int bnMul_64(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); -int bnMulQ_64(struct BigNum *dest, struct BigNum const *a, unsigned b); -int bnDivMod_64(struct BigNum *q, struct BigNum *r, struct BigNum const *n, - struct BigNum const *d); -int bnMod_64(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *d); -unsigned bnModQ_64(struct BigNum const *src, unsigned d); -int bnExpMod_64(struct BigNum *dest, struct BigNum const *n, - struct BigNum const *exp, struct BigNum const *mod); -int bnDoubleExpMod_64(struct BigNum *dest, - struct BigNum const *n1, struct BigNum const *e1, - struct BigNum const *n2, struct BigNum const *e2, - struct BigNum const *mod); -int bnTwoExpMod_64(struct BigNum *n, struct BigNum const *exp, - struct BigNum const *mod); -int bnGcd_64(struct BigNum *dest, struct BigNum const *a, - struct BigNum const *b); -int bnInv_64(struct BigNum *dest, struct BigNum const *src, - struct BigNum const *mod); -int bnLShift_64(struct BigNum *dest, unsigned amt); -void bnRShift_64(struct BigNum *dest, unsigned amt); -unsigned bnMakeOdd_64(struct BigNum *n); -int bnBasePrecompBegin_64(struct BnBasePrecomp *pre, struct BigNum const *base, - struct BigNum const *mod, unsigned maxebits); -void bnBasePrecompEnd_64(struct BnBasePrecomp *pre); -int bnBasePrecompExpMod_64(struct BigNum *dest, struct BnBasePrecomp const *pre, - struct BigNum const *exp, struct BigNum const *mod); -int bnDoubleBasePrecompExpMod_64(struct BigNum *dest, - struct BnBasePrecomp const *pre1, struct BigNum const *exp1, - struct BnBasePrecomp const *pre2, struct BigNum const *exp2, - struct BigNum const *mod); diff --git a/libs/libzrtp/third_party/bnlib/bn68000.c b/libs/libzrtp/third_party/bnlib/bn68000.c deleted file mode 100644 index 14d6c4d0a4..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn68000.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn68000.c - bnInit() for Motorola 680x0 family, 16 or 32-bit. - * - * Written in 1995 by Colin Plumb. - */ - -#include "lbn.h" -#include "bn16.h" -#include "bn32.h" - -#ifndef BNINCLUDE -#error You must define BNINCLUDE to lbn68000.h to use assembly primitives. -#endif - -void -bnInit(void) -{ - if (is68020()) - bnInit_32(); - else - bnInit_16(); -} diff --git a/libs/libzrtp/third_party/bnlib/bn8086.c b/libs/libzrtp/third_party/bnlib/bn8086.c deleted file mode 100644 index 5f24ac58b0..0000000000 --- a/libs/libzrtp/third_party/bnlib/bn8086.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bn8086.c - bnInit() for Intel x86 family in 16-bit mode. - * - * Written in 1995 by Colin Plumb. - */ - -#include "lbn.h" -#include "bn16.h" -#include "bn32.h" - -#ifndef BNINCLUDE -#error You must define BNINCLUDE to lbn8086.h to use assembly primitives. -#endif - -void -bnInit(void) -{ - if (not386()) - bnInit_16(); - else - bnInit_32(); -} diff --git a/libs/libzrtp/third_party/bnlib/bnconfig.hin b/libs/libzrtp/third_party/bnlib/bnconfig.hin deleted file mode 100644 index 1b5e5986f9..0000000000 --- a/libs/libzrtp/third_party/bnlib/bnconfig.hin +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bnconfig.h -- Configuration file for BigNum library. - * - * This file is automatically filled in by configure. - * Everything must start out turned *off*, because configure - * (or, more properly, config.status) only knows how to turn them - * *on*. - */ -#ifndef CONFIG_H -#define CONFIG_H - -/* Define to empty if the compiler does not support 'const' variables. */ -#undef const - -/* Define to `unsigned' if <sys/types.h> doesn't define it. */ -#undef size_t - -/* Checks for the presence and absence of various header files */ -#define HAVE_ASSERT_H 0 -#define NO_ASSERT_H !HAVE_ASSERT_H -#define HAVE_LIMITS_H 0 -#define NO_LIMITS_H !HAVE_LIMITS_H -#define HAVE_STDLIB_H 0 -#define NO_STDLIB_H !HAVE_STDLIB_H -#define HAVE_STRING_H 0 -#define NO_STRING_H !HAVE_STRING_H - -#define HAVE_STRINGS_H 0 - -/* We go to some trouble to find accurate times... */ - -/* Define if you have Posix.4 glock_gettime() */ -#define HAVE_CLOCK_GETTIME 0 -/* Define if you have Solaris-style gethrvtime() */ -#define HAVE_GETHRVTIME 0 -/* Define if you have getrusage() */ -#define HAVE_GETRUSAGE 0 -/* Define if you have clock() */ -#define HAVE_CLOCK 0 -/* Define if you have time() */ -#define HAVE_TIME 0 - -/* - * Define as 0 if #including <sys/time.h> automatically - * #includes <time.h>, and doing so explicitly causes an - * error. - */ -#define TIME_WITH_SYS_TIME 0 - -/* Defines for various kinds of library brokenness */ - -/* If not available, bcopy() is substituted */ -#define HAVE_MEMMOVE 0 -#define NO_MEMMOVE !HAVE_MEMMOVE -#define HAVE_MEMCPY 0 -#define NO_MEMCPY !HAVE_MEMCPY - -#endif /* CONFIG_H */ diff --git a/libs/libzrtp/third_party/bnlib/bnconfig.win b/libs/libzrtp/third_party/bnlib/bnconfig.win deleted file mode 100644 index 2e36938835..0000000000 --- a/libs/libzrtp/third_party/bnlib/bnconfig.win +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bnconfig.h -- Configuration file for BigNum library. - * - * This file is automatically filled in by configure. - * Everything must start out turned *off*, because configure - * (or, more properly, config.status) only knows how to turn them - * *on*. - */ -#ifndef CONFIG_H -#define CONFIG_H - -/* Define to empty if the compiler does not support 'const' variables. */ -#undef const - -/* Define to `unsigned' if <sys/types.h> doesn't define it. */ -#undef size_t - -/* Checks for the presence and absence of various header files */ -#define HAVE_ASSERT_H 1 -#define NO_ASSERT_H !HAVE_ASSERT_H -#define HAVE_LIMITS_H 1 -#define NO_LIMITS_H !HAVE_LIMITS_H -#define HAVE_STDLIB_H 1 -#define NO_STDLIB_H !HAVE_STDLIB_H -#define HAVE_STRING_H 1 -#define NO_STRING_H !HAVE_STRING_H - -#define HAVE_STRINGS_H 0 - -/* We go to some trouble to find accurate times... */ - -/* Define if you have Posix.4 glock_gettime() */ -#define HAVE_CLOCK_GETTIME 0 -/* Define if you have Solaris-style gethrvtime() */ -#define HAVE_GETHRVTIME 0 -/* Define if you have getrusage() */ -#define HAVE_GETRUSAGE 0 -/* Define if you have clock() */ -#define HAVE_CLOCK 0 -/* Define if you have time() */ -#define HAVE_TIME 0 - -/* - * Define as 0 if #including <sys/time.h> automatically - * #includes <time.h>, and doing so explicitly causes an - * error. - */ -#define TIME_WITH_SYS_TIME 0 - -/* Defines for various kinds of library brokenness */ - -/* If not available, bcopy() is substituted */ -#define HAVE_MEMMOVE 1 -#define NO_MEMMOVE !HAVE_MEMMOVE -#define HAVE_MEMCPY 1 -#define NO_MEMCPY !HAVE_MEMCPY - -#endif /* CONFIG_H */ diff --git a/libs/libzrtp/third_party/bnlib/bninit16.c b/libs/libzrtp/third_party/bnlib/bninit16.c deleted file mode 100644 index bbdefe12a7..0000000000 --- a/libs/libzrtp/third_party/bnlib/bninit16.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bninit16.c - Provide an init function that sets things up for 16-bit - * operation. This is a seaparate tiny file so you can compile two bn - * packages into the library and write a custom init routine. - * - * Written in 1995 by Colin Plumb. - */ - -#include "bn.h" -#include "bn16.h" - -void -bnInit(void) -{ - bnInit_16(); -} diff --git a/libs/libzrtp/third_party/bnlib/bninit32.c b/libs/libzrtp/third_party/bnlib/bninit32.c deleted file mode 100644 index 58e0906cd3..0000000000 --- a/libs/libzrtp/third_party/bnlib/bninit32.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bninit32.c - Provide an init function that sets things up for 32-bit - * operation. This is a seaparate tiny file so you can compile two bn - * packages into the library and write a custom init routine. - * - * Written in 1995 by Colin Plumb. - */ - -#include "bn.h" -#include "bn32.h" - -void -bnInit(void) -{ - bnInit_32(); -} diff --git a/libs/libzrtp/third_party/bnlib/bninit64.c b/libs/libzrtp/third_party/bnlib/bninit64.c deleted file mode 100644 index 93e6128f14..0000000000 --- a/libs/libzrtp/third_party/bnlib/bninit64.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bninit64.c - Provide an init function that sets things up for 64-bit - * operation. This is a seaparate tiny file so you can compile two bn - * packages into the library and write a custom init routine. - * - * Written in 1995 by Colin Plumb. - */ - -#include "bn.h" -#include "bn64.h" - -void -bnInit(void) -{ - bnInit_64(); -} diff --git a/libs/libzrtp/third_party/bnlib/bnintern.doc b/libs/libzrtp/third_party/bnlib/bnintern.doc deleted file mode 100644 index f26aa4d249..0000000000 --- a/libs/libzrtp/third_party/bnlib/bnintern.doc +++ /dev/null @@ -1,304 +0,0 @@ -* The organization of the BigNum Library - -As mentioned in bn.doc, the library should compile on anything with an -ANSI C compiler and 16 and 32-bit data types. (Non-power-of-2 word -lengths probably wouldn't be *too* hard, but the matter is likely to -remain academic.) However, assembly subroutines can be added in a -great variety of ways to speed up computations. - -It's even possible to vary the word length dynamically at run time. -Currently, 80x86 and 680x0 assembly primitives have been written in 16 -and 32-bit forms, as not all members of these families support 32x32->64 -bit multiply. In future, 32/64 bit routines may be nice for the MIPS -and PowerPC processors. (The SPARC has a 64-bit extension, but it still -only produces a maximum 64-bit multiply result. The MIPS, PowerPC and -Alpha give access to 128 bits of product.) - -The way that this works is that the file bn.c declares a big pile of -function pointers, and the first bnInit() call figures out which set -of functions to point these to. The functions are named so that -it is possible to link several sets into the same executable without -collisions. - -The library can store numbers in big-endian or little-endian word order, -although the order of bytes within a word is always the platform native -order. As long as you're using the pure C version, you can compile -independent of the native byte ordering, but the flexibility is available -in case assembly primitives are easier to write one way or the other. -(In the absence of other considerations, little-endian is somewhat more -efficient, and is the default. This is controlled by BN_XXX_ENDIAN.) - -In fact, it would be possible to change the word order at run time, -except that there is no naming convention to support linking in -functions that differ only in endianness. (Which is because the -point of doing so is unclear.) - -The core of the library is in the files lbn??.c and bn??.c, where "??" -is 16, 32, or 64. The 32 and 64-bit files are generated from the 16-bit -version by a simple textual substitution. The 16-bit files are generally -considered the master source, and the others generated from it with sed. - -Usually, only one set of these files is used on any given platform, -but if you want multiple word sizes, you include one for each supported -word size. The files bninit??.c define a bnInit function for a given -word size, which calls bnInit_??() internally. Only one of these may -be included at a time, and multiple word sizes are handled by a more -complex bnInit function such as the ones in bn8086.c and bn68000.c, -which determine the word size of the processor they're running on and -call the appropriate bnInit_??() function. - -The file lbn.h uses <limits.h> to find the platform's available data -types. The types are defined both as macros (BNWORD32) and as typedefs -(bnword32) which aren't used anywhere but can come in very handy when -using a debugger (which doesn't know about macros). Any of these may -be overridden either on the compiler command line (cc -DBN_BIG_ENDIAN --DBNWORD32="unsigned long"), or from an extra include file BNINCLUDE -defined on the command line. (cc -DBNINCLUDE=lbnmagic.h) This is the -preferred way to specify assembly primitives. - -So, for example, to build a 68020 version of the library, compile the -32-bit library with -DBNINCLUDE=lbn68020.h, and compile and link in -lbn68020.c (which is actually an assembly source file, if you look). - -Both 16- and 32-bit 80x86 code is included in lbn8086.h and .asm. That -code uses 16-bit large-model addressing. lbn80386.h and .asm use 32-bit -flat-model addressing. - -Three particularly heavily used macros defined by lbn.h are BIG(x), -LITTLE(y) and BIGLITTLE(x,y). These expand to x (or nothing) on -a big-endian system, and y (or nothing) on a little-endian system. -These are used to conditionalize the rest of the code without taking -up entire lines to say "#ifdef BN_BIG_ENDIAN", "#else" and "#endif". - -* The lbn??.c files - -The lbn?? file contains the low-level bignum functions. These universally -expect their numbers to be passed to them in (buffer, length) form and -do not attempt to extend the buffers. (In some cases, they do allocate -temporary buffers.) The buffer pointer points to the least-significant -end of the buffer. If the machine uses big-endian word ordering, that -is a pointer to the end of the buffer. This is motivated by considering -pointers to point to the boundaries between words (or bytes). If you -consider a pointer to point to a word rather than between words, the -pointer in the big-endian case points to the first word past the end of the -buffer. - -All of the primitives have names of the form lbnAddN_16, where the -_16 is the word size. All are surrounded by "#ifndef lbnAddN_16". -If you #define lbnAddN_16 previously (either on the command like or -in the BNINCLUDE file), the C code will neither define *nor declare* the -corresponding function. The declaration must be suppressed in case you -declare it in a magic way with special calling attributes or define it as -a macro. - -If you wish to write an assembly primitive, lbnMulAdd1_??, which -multiplies N words by 1 word and adds the result to N words, returning -the carry word, is by FAR the most important function - almost all of -the time spent performing a modular exponentiation is spent in this -function. lbnMulSub1_??, which does the same but subtracts the product -and returns a word of borrow, is used heavily in the division routine -and thus by GCD and modular inverse computation. - -These two functions are the only functions which *require* some sort -of double-word data type, so if you define them in assembly language, -the ?? may be the widest word your C compiler supports; otherwise, you -must limit your implementation to half of the maximum word size. Other -functions will, however, use a double-word data type if available. - -Actually, there are some even simpler primitives which you can provide -to allow double-width multiplication: mul??_ppmm, mul??_ppmma and -mul??_ppmmaa These are expected to be defined as macros (all arguments -are always side-effect-free lvalues), and must return two words of result -of the computation m1*m2 + a1 + a2. It is best to define all three, -although any that are not defined will be generated from the others in -the obvious way. GCC's inline assembler can be used to define these. -(The names are borrowed from the GNU MP package.) - -There is also lbnMulN1_??, which stores the result rather than adding or -subtracting it, but it is less critical. If it is not provided, but -lbnMulAdd1_?? is, it will be implemented in terms of lbnMulAdd1_?? in the -obvious way. - -lbnDiv21_??, which divides two words by one word and returns a quotient -and remainder, is greatly sped up by a double-word data type, macro -definition, or assembly implementation, but has a version which will run -without one. If your platform has a double/single divide with remainder, -it would help to define this, and it's quite simple. - -lbnModQ_?? (return a multi-precision number reduced modulo a "quick" -(< 65536) modulus is used heavily by prime generation for trial division, -but is otherwise little used. - -Other primitives may be implemented depending on the expected usage mix. -It is generally not worth implementing lbnAddN_?? and lbnSubN_?? unless -you want to start learning to write assembly primitives on something -simple; they just aren't used very much. (Of course, if you do, you'll -probably get some improvements, in both speed and object code size, so -it's worth keeping them in, once written.) - -* The bn??.c files - -While the lbn??.c files deal in words, the bn??.c files provide the -public interface to the library and deal in bignum structures. These -contain a buffer pointer, an allocated length, and a used length. -The lengths are specified in words, but as long as the user doesn't go -prying into such innards, all of the different word-size libraries -provide the same interface; they may be exchanged at link time, or even -at run time. - -The bn.c file defines a large collection of function pointers and one -function, bnInit. bnInit is responsible for setting the function pointers -to point to the appropriate bn??.c functions. Each bn??.c file -provides a bnInit_?? function which sets itself up; it is the job -of bnInit to figure out which word size to use and call the appropriate -bnInit_?? function. - -If only one word size is in use, you may link in the file bninit??.c, -which provides a trivial bnInit function. If multiple word sizes are -in use, you must provide the appropriate bnInit function. See -bn8086.c as an example. - -For maximum portability, you may just compile and link in the files -lbn00.c, bn00.c and bninit00.c, which determine, using the preprocessor -at compile time, the best word size to use. (The logic is actually -located in the file bnsize00.h, so that the three .c files cannot get out -of sync.) - -The bignum buffers are allocated using the memory management routines in -lbnmem.c. These are word-size independent; they expect byte counts and -expect the system malloc() to return suitably aligned buffers. The -main reason for this wrapper layer is to support any customized allocators -that the user might want to provide. - -* Other bn*.c files - -bnprint.c is a simple routine for printing a bignum in hex. It is -provided in a separate file so that its calls to stdio can be eliminated -from the link process if the capability is not needed. - -bntest??.c is a very useful regression test if you're implementing -assembly primitives. If it doesn't complain, you've probably -got it right. It also does timing tests so you can see the effects -of any changes. - -* Other files - -sieve.c contains some primitives which use the bignum library to perform -sieving (trial division) of ranges of numbers looking for candidate primes. -This involves two steps: using a sieve of Eratosthenes to generate the -primes up to 65536, and using that to do trial division on a range of -numbers following a larger input number. Note that this is designed -for large numbers, greater than 65536, since there is no check to see -if the input is one of the small primes; if it is divisible, it is assumed -composite. - -prime.c uses sieve.c to generate primes. It uses sieve.c to eliminate -numbers with trivial divisors, then does strong pseudoprimality tests -with some small bases. (Actually, the first test, to the base 2, is -optimized a bit to be faster when it fails, which is the common case, -but 1/8 of the time it's not a strong pseudoprimality test, so an extra, -strong, test is done in that case.) - -It prints progress indicators as it searches. The algorithm -searches a range of numbers starting at a given prime, but it does -so in a "shuffled" order, inspired by algorithm M from Knuth. (The -random number generator to use for this is passed in; if no function -is given, the numbers are searched in sequential order and the -returns value will be the next prime >= the input value.) - -germain.c operates similarly, but generates Sophie Germain primes; -that is, primes p such that (p-1)/2 is also prime. It lacks the -shuffling feature - searching is always sequential. - -jacobi.c computes the Jacobi symbol between a small integer and a BigNum. -It's currently only ever used in germain.c. - -* Sources - -Obviously, a key source of information was Knuth, Volume 2, -particularly on division algorithms. - -The greatest inspiration, however, was Arjen Lenstra's LIP -(Large Integer Package), distributed with the RSA-129 effort. -While very difficult to read (there is no internal documentation on -sometimes very subtle algorithms), it showed me many useful tricks, -notably the windowed exponentiation algorithm that saves so many -multiplies. If you need a more general-purpose large-integer package, -with only a minor speed penalty, the LIP package is almost certainly -the best available. It implements a great range of efficient -algorithms. - -The second most important source was Torbjorn Granlund's gmp -(GNU multi-precision) library. A number of C coding tricks were -adapted from there. I'd like to thank Torbjorn for some useful -discussions and letting me see his development work on GMP 2.0. - -Antoon Bosselaers, Rene' Govaerts and Joos Vandewalle, in their CRYPTO -'93 paper, "Comparison of three modular reduction functions", brought -Montgomery reduction to my attention, for which I am grateful. - -Burt Kaliski's article in the September 1993 Dr. Dobb's Journal, -"The Z80180 and Big-number Arithmetic" pointed out the advantages (and -terminology) of product scanning to me, although the limited -experiments I've done have shown no improvement from trying it in C. - -Hans Reisel's book, "Prime Numbers and Computer Methods for Factorization" -was of great help in designing the prime testing, although some of -the code in the book, notably the Jacobi function in Appendix 3, -is an impressive example of why GOTO should be considered harmful. -Papers by R. G. E. Pinch and others in Mathematics of Computation were -also very useful. - -Keith Geddes, Stephen Czapor and George Labahn's book "Algorithms -for Computer Algebra", although it's mostly about polynomials, -has some useful multi-precision math examples. - -Philip Zimmermann's mpi (multi-precision integer) library suggested -storing the numbers in native byte order to facilitate assembly -subroutines, although the core modular multiplication algorithms are -so confusing that I still don't understand them. His boasting about -the speed of his library (albeit in 1986, before any of the above were -available for study) also inspired me to particular effort to soundly -beat it. It also provoked a strong reaction from me against fixed -buffer sizes, and complaints about its implementation from Paul Leyland -(interface) and Robert Silverman (prime searching) contributed usefully -to the design of this current library. - -I'd like to credit all of the above, plus the Berkeley MP package, with -giving me difficulty finding a short, unique distinguishing prefix for -my library's functions. (I have just, sigh, discovered that Eric Young -is using the same prefix for *his* library, although with the -bn_function_name convention as opposed to the bnFunctionName one.) - -I'd like to thank the original implementor of Unix "dc" and "factor" -for providing useful tools for verifying the correct operation of -my library. - -* Future - -- Obviously, assembly-language subroutines for more platforms would - always be nice. -- There's a special case in the division for a two-word denominator - which should be completed. -- When the quotient of a division is big enough, compute an inverse of - the high word of the denominator and use multiplication by that - to do the divide. -- A more efficient GCD algorithm would be nice to have. -- More efficient modular inversion is possible. Do it. -- Extend modular inversion to deal with non-relatively-prime - inputs. Produce y = inv(x,m) with y * x == gcd(x,m) mod m. -- Try some product scanning in assembly. -- Karatsuba's multiplication and squaring speedups would be nice. -- I *don't* think that FFT-based algorithms are worth implementing yet, - but it's worth a little bit of study to make sure. -- More general support for numbers in Montgomery form, so they can - be used by more than the bowels of lbnExpMod. -- Provide an lbnExpMod optimized for small arguments > 2, using - conventional (or even Barrett) reduction of the multiplies, and - Montgomery reduction of the squarings. -- Adding a Lucas-based prime test would be a real coup, although it's - hard to give rational reasons why it's necessary. I have a number of - ideas on this already. Find out if norm-1 (which is faster to - compute) suffices. -- Split up the source code more to support linking with smaller subsets - of the library. diff --git a/libs/libzrtp/third_party/bnlib/bnprint.c b/libs/libzrtp/third_party/bnlib/bnprint.c deleted file mode 100644 index e986a30d52..0000000000 --- a/libs/libzrtp/third_party/bnlib/bnprint.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bnprint.c - Print a bignum, for debugging purposes. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#include <stdio.h> - -#if !NO_STRING_H -#include <string.h> -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "bn.h" -#include "bnprint.h" - -#include "kludge.h" - -int -bnPrint(FILE *f, char const *prefix, struct BigNum const *bn, - char const *suffix) -{ - unsigned char temp[32]; /* How much to print on one line */ - unsigned len; - size_t i; - - if (prefix && fputs(prefix, f) < 0) - return EOF; - - len = (bnBits(bn) + 7)/ 8; - - if (!len) { - if (putc('0', f) < 0) - return EOF; - } else { - while (len > sizeof(temp)) { - len -= sizeof(temp); - bnExtractBigBytes(bn, temp, len, sizeof(temp)); - for (i = 0; i < sizeof(temp); i++) - if (fprintf(f, "%02X", temp[i]) < 0) - return EOF; - if (putc('\\', f) < 0 || putc('\n', f) < 0) - return EOF; - if (prefix) { - i = strlen(prefix); - while (i--) - if (putc(' ', f) < 0) - return EOF; - } - } - bnExtractBigBytes(bn, temp, 0, len); - for (i = 0; i < len; i++) - if (fprintf(f, "%02X", temp[i]) < 0) - return EOF; - } - return suffix ? fputs(suffix, f) : 0; -} diff --git a/libs/libzrtp/third_party/bnlib/bnprint.h b/libs/libzrtp/third_party/bnlib/bnprint.h deleted file mode 100644 index e6f496e79b..0000000000 --- a/libs/libzrtp/third_party/bnlib/bnprint.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef BNPRINT_H -#define BNPRINT_H - -#include <stdio.h> -struct BigNum; - -int bnPrint(FILE *f, char const *prefix, struct BigNum const *bn, - char const *suffix); - -#endif /* BNPRINT_H */ diff --git a/libs/libzrtp/third_party/bnlib/bnsize00.h b/libs/libzrtp/third_party/bnlib/bnsize00.h deleted file mode 100644 index bf236d5967..0000000000 --- a/libs/libzrtp/third_party/bnlib/bnsize00.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bnsize00.h - pick the correct machine word size to use. - */ -#include "lbn.h" /* Get basic information */ - -#if !BNSIZE64 && !BNSIZE32 && !BNSIZE16 && defined(BNWORD64) -# if defined(BNWORD128) || (defined(lbnMulAdd1_64) && defined(lbnMulSub1_64)) -# define BNSIZE64 1 -# elif defined(mul64_ppmm) || defined(mul64_ppmma) || defined(mul64_ppmmaa) -# define BNSIZE64 1 -# endif -#endif - -#if !BNSIZE64 && !BNSIZE32 && !BNSIZE16 && defined(BNWORD32) -# if defined(BNWORD64) || (defined(lbnMulAdd1_32) && defined(lbnMulSub1_32)) -# define BNSIZE32 1 -# elif defined(mul32_ppmm) || defined(mul32_ppmma) || defined(mul32_ppmmaa) -# define BNSIZE32 1 -# endif -#endif - -#if !BNSIZE64 && !BNSIZE32 && !BNSIZE16 && defined(BNWORD16) -# if defined(BNWORD32) || (defined(lbnMulAdd1_16) && defined(lbnMulSub1_16)) -# define BNSIZE16 1 -# elif defined(mul16_ppmm) || defined(mul16_ppmma) || defined(mul16_ppmmaa) -# define BNSIZE16 1 -# endif -#endif - -#if !BNSIZE64 && !BNSIZE32 && !BNSIZE16 -#error Unable to find a viable word size to compile bignum library. -#endif diff --git a/libs/libzrtp/third_party/bnlib/bntest00.c b/libs/libzrtp/third_party/bnlib/bntest00.c deleted file mode 100644 index ea84f66b5b..0000000000 --- a/libs/libzrtp/third_party/bnlib/bntest00.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * bntest00.c - auto-size-detecting bntest??.c file. - * - * Written in 1995 by Colin Plumb. - */ - -#include "bnsize00.h" - -#if BNSIZE64 - -#include "bntest64.c" - -#elif BNSIZE32 - -#include "bntest32.c" - -#else /* BNSIZE16 */ - -#include "bntest16.c" - -#endif diff --git a/libs/libzrtp/third_party/bnlib/bntest16.c b/libs/libzrtp/third_party/bnlib/bntest16.c deleted file mode 100644 index 79c1157f8a..0000000000 --- a/libs/libzrtp/third_party/bnlib/bntest16.c +++ /dev/null @@ -1,798 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Test driver for low-level bignum library (16-bit version). - * This access the low-level library directly. It is NOT an example of - * how to program with the library normally! By accessing the library - * at a low level, it is possible to exercise the smallest components - * and thus localize bugs more accurately. This is especially useful - * when writing assembly-language primitives. - * - * This also does timing tests on modular exponentiation. Modular - * exponentiation is so computationally expensive that the fact that this - * code omits one level of interface glue has no perceptible effect on - * the results. - */ -#include "zrtp.h" - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -#define _ZTU_ "bntest" - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STDLIB_H -#define NO_STDLIB_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#include <stdio.h> - -#if !NO_STDLIB_H -#include <stdlib.h> /* For strtol */ -#else -long strtol(const char *, char **, int); -#endif - -#if !NO_STRING_H -#include <string.h> /* For memcpy */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "lbn16.h" -#include "kludge.h" - -#if BNYIELD -int (*bnYield)(void) = 0; -#endif - -/* Work with up to 2048-bit numbers */ -#define MAXBITS 3072 -#define SIZE (MAXBITS/16 + 1) - -/* Additive congruential random number generator, x[i] = x[i-24] + x[i-55] */ -static BNWORD16 randp[55]; -static BNWORD16 *randp1 = randp, *randp2 = randp+24; - -static BNWORD16 -rand16(void) -{ - if (++randp2 == randp+55) { - randp2 = randp; - randp1++; - } else if (++randp1 == randp+55) { - randp1 = randp; - } - - return *randp1 += *randp2; -} - -/* - * CRC-3_2: x^3_2+x^26+x^23+x^22+x^1_6+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 - * - * The additive congruential RNG is seeded with a single integer, - * which is shuffled with a CRC polynomial to generate the initial - * table values. The Polynomial is the same size as the words being - * used. - * - * Thus, in the various versions of this library, we actually use this - * polynomial as-is, this polynomial mod x^17, and this polynomial with - * the leading coefficient deleted and replaced with x^6_4. As-is, - * it's irreducible, so it has a long period. Modulo x^17, it factors as - * (x^4+x^3+x^2+x+1) * (x^12+x^11+x^8+x^7+x^6+x^5+x^4+x^3+1), - * which still has a large enough period (4095) for the use it's put to. - * With the leading coefficient moved up, it factors as - * (x^50+x^49+x^48+x^47+x^46+x^43+x^41+x^40+x^38+x^37+x^36+x^35+x^34+x^33+ - * x^31+x^30+x^29+x^28+x^27+x^25+x^23+x^18+x^1_6+x^15+x^14+x^13+x^11+x^9+ - * x^8+x^7+x^6+x^5+x^3+x^2+1)*(x^11+x^10+x^9+x^5+x^4+x^3+1)*(x^3+x+1), - * which definitely has a long enough period to serve for initialization. - * - * The effort put into this PRNG is kind of unwarranted given the trivial - * use it's being put to, but oh, well. It does have the nice advantage - * of producing numbers that are portable between platforms, so if there's - * a problem with one platform, you can compare all the intermediate - * results with another platform. - */ -#define POLY (BNWORD16)0x04c11db7 - -static void -srand16(BNWORD16 seed) -{ - int i, j; - - for (i = 0; i < 55; i++) { - for (j = 0; j < 16; j++) - if (seed >> (16-1)) - seed = (seed << 1) ^ POLY; - else - seed <<= 1; - randp[i] = seed; - } - for (i = 0; i < 3*55; i ++) - rand16(); -} - -static void -randnum(BNWORD16 *num, unsigned len) -{ - while (len--) - BIGLITTLE(*--num,*num++) = rand16(); -} - -static void -bnprint16(BNWORD16 const *num, unsigned len) -{ - BIGLITTLE(num -= len, num += len); - - while (len--) - ZRTP_LOG(3, (_ZTU_, "%0*lX", 16/4, (unsigned long)BIGLITTLE(*num++,*--num))); -} - -static void -bnput16(char const *prompt, BNWORD16 const *num, unsigned len) -{ - fputs(prompt, stdout); - bnprint16(num, len); - putchar('\n'); -} - -/* - * One of our tests uses a known prime. The following selections were - * taken from the tables at the end of Hans Reisel's "Prime Numbers and - * Computer Methods for Factorization", second edition - an excellent book. - * (ISBN 0-8176-3743-5 ISBN 3-7323-3743-5) - */ -#if 0 -/* P31=1839605 17620282 38179967 87333633 from the factors of 3^256+2^256 */ -static unsigned char const prime[] = { - 0x17,0x38,0x15,0xBC,0x8B,0xBB,0xE9,0xEF,0x01,0xA9,0xFD,0x3A,0x01 -}; -#elif 0 -/* P48=40554942 04557502 46193993 36199835 4279613_2 73199617 from the same */ -static unsigned char const prime[] = { - 0x47,0x09,0x77,0x07,0xCF,0xFD,0xE1,0x54,0x3E,0x24, - 0xF7,0xF1,0x7A,0x3E,0x91,0x51,0xCC,0xC7,0xD4,0x01 -}; -#elif 0 -/* - * P75 = 450 55287320 97906895 47687014 5808213_2 - * 05219565 99525911 39967932 66003_258 91979521 - * from the factors of 4^128+3+128 - * (The "026" and "062" are to prevent a Bad String from appearing here.) - */ -static unsigned char const prime[] = { - 0xFF,0x00,0xFF,0x00,0xFF,0x01,0x06,0x4F,0xF8,0xED, - 0xA3,0x37,0x23,0x2A,0x04,0xEA,0xF9,0x5F,0x30,0x4C, - 0xAE,0xCD, 026,0x4E, 062,0x10,0x04,0x7D,0x0D,0x79, - 0x01 -}; -#else -/* - * P75 = 632 85659796 45277755 9123_2190 67300940 - * 51844953 78793489 59444670 35675855 57440257 - * from the factors of 5^128+4^128 - * (The "026" is to prevent a Bad String from appearing here.) - */ -static unsigned char const prime[] = { - 0x01,0x78,0x4B,0xA5,0xD3,0x30,0x03,0xEB,0x73,0xE6, - 0x0F,0x4E,0x31,0x7D,0xBC,0xE2,0xA0,0xD4, 026,0x3F, - 0x3C,0xEA,0x1B,0x44,0xAD,0x39,0xE7,0xE5,0xAD,0x19, - 0x67,0x01 -}; -#endif - -static int -usage(char const *name) -{ - ZRTP_LOG(3, (_ZTU_, "Usage: %s [modbits [expbits [expbits2]]" -"With no arguments, just runs test suite. If modbits is given, runs\n" -"quick validation test, then runs timing tests of modular exponentiation.\n" -"If expbits is given, it is used as an exponent size, otherwise it defaults\n" -"to the same as modbits. If expbits2 is given it is used as the second\n" -"exponent size in the double-exponentiation tests, otherwise it defaults\n" -"to the same as expbits. All are limited to %u bits.\n", - name, (unsigned)MAXBITS)); - return 1; -} - -/* for libzrtp support */ -int -bntest_main(int argc, char **argv) -{ - unsigned i, j, k, l, m; - int z; - BNWORD16 t, carry, borrow; - BNWORD16 a[SIZE], b[SIZE], c[SIZE], d[SIZE]; - BNWORD16 e[SIZE], f[SIZE]; - static BNWORD16 entries[sizeof(prime)*2][(sizeof(prime)-1)/(16/8)+1]; - BNWORD16 *array[sizeof(prime)*2]; - unsigned long modbits = 0, expbits = 0, expbits2 = 0; - char *p; -#define A BIGLITTLE((a+SIZE),a) -#define B BIGLITTLE((b+SIZE),b) -#define C BIGLITTLE((c+SIZE),c) -#define D BIGLITTLE((d+SIZE),d) -#define E BIGLITTLE((e+SIZE),e) -#define F BIGLITTLE((f+SIZE),f) - static unsigned const smallprimes[] = { - 2, 3, 5, 7, 11, 13, 17, 19, 23, 27, 29, 31, 37, 41, 43 - }; - - /* Set up array for precomputed modexp */ - for (i = 0; i < sizeof(array)/sizeof(*array); i++) - array[i] = entries[i] BIG(+ SIZE); - - srand16(1); - - puts(BIGLITTLE("Big-endian machine","Little-endian machine")); - - if (argc >= 2) { - modbits = strtoul(argv[1], &p, 0); - if (!modbits || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid modbits: %s", argv[1])); - return usage(argv[0]); - } - } - if (argc >= 3) { - expbits = strtoul(argv[2], &p, 0); - if (!expbits || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid expbits: %s", argv[2])); - return usage(argv[0]); - } - expbits2 = expbits; - } - if (argc >= 4) { - expbits2 = strtoul(argv[3], &p, 0); - if (!expbits2 || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid expbits2: %s", argv[3])); - return usage(argv[0]); - } - } - if (argc >= 5) { - ZRTP_LOG(1, (_ZTU_, "Too many arguments: %s", argv[4])); - return usage(argv[0]); - } - -/* B is a nice not-so-little prime */ - lbnInsertBigBytes_16(B, prime, 0, sizeof(prime)); - ((unsigned char *)c)[0] = 0; - lbnInsertBigBytes_16(B, (unsigned char *)c, sizeof(prime), 1); - lbnExtractBigBytes_16(B, (unsigned char *)c, 0, sizeof(prime)+1); - i = (sizeof(prime)-1)/(16/8)+1; /* Size of array in words */ - if (((unsigned char *)c)[0] || - memcmp(prime, (unsigned char *)c+1, sizeof(prime)) != 0) - { - ZRTP_LOG(3, (_ZTU_, "Input != output!: ")); - for (k = 0; k < sizeof(prime); k++) - ZRTP_LOG(3, (_ZTU_, "%02X ", prime[k])); - putchar('\n'); - for (k = 0; k < sizeof(prime)+1; k++) - ZRTP_LOG(3, (_ZTU_, "%02X ", ((unsigned char *)c)[k])); - putchar('\n'); - bnput16("p = ", B, i); - - } - - /* Timing test code - only if requested on the command line */ - if (modbits) { -#if CLOCK_AVAIL - timetype start, stop; - unsigned long cursec, expsec, twoexpsec, dblexpsec; - unsigned curms, expms, twoexpms, dblexpms; - - expsec = twoexpsec = dblexpsec = 0; - expms = twoexpms = dblexpms = 0; -#endif - - lbnCopy_16(C,B,i); - lbnSub1_16(C,i,1); /* C is exponent: p-1 */ - - puts("Testing modexp with a known prime. " - "All results should be 1."); - bnput16("p = ", B, i); - bnput16("p-1 = ", C, i); - z = lbnTwoExpMod_16(A, C, i, B, i); - if (z < 0) - goto nomem; - bnput16("2^(p-1) mod p = ", A, i); - for (j = 0; j < 10; j++) { - randnum(A,i); - (void)lbnDiv_16(D,A,i,B,i); - - bnput16("a = ", A, i); - z = lbnExpMod_16(D, A, i, C, i, B, i); - if (z < 0) - goto nomem; - bnput16("a^(p-1) mod p = ", D, i); - - z = lbnBasePrecompBegin_16(array, (sizeof(prime)*8+4)/5, 5, - A, i, B, i); - if (z < 0) - goto nomem; - BIGLITTLE(D[-1],D[0]) = -1; - z = lbnBasePrecompExp_16(D, (BNWORD16 const * const *)array, - 5, C, i, B, i); - if (z < 0) - goto nomem; - bnput16("a^(p-1) mod p = ", D, i); - - for (k = 0; k < 5; k++) { - randnum(E,i); - bnput16("e = ", E, i); - z = lbnExpMod_16(D, A, i, E, i, B, i); - if (z < 0) - goto nomem; - bnput16("a^e mod p = ", D, i); - z = lbnBasePrecompExp_16(D, (BNWORD16 const * const *)array, - 5, E, i, B, i); - if (z < 0) - goto nomem; - bnput16("a^e mod p = ", D, i); - } - } - - ZRTP_LOG(3, (_ZTU_, "\n" - "Timing exponentiations modulo a %d-bit modulus, i.e.\n" - "2^<%d> mod <%d> bits, <%d>^<%d> mod <%d> bits and\n" - "<%d>^<%d> * <%d>^<%d> mod <%d> bits", - (int)modbits, (int)expbits, (int)modbits, - (int)modbits, (int)expbits, (int)modbits, - (int)modbits, (int)expbits, (int)modbits, (int)expbits2, - (int)modbits)); - - i = ((int)modbits-1)/16+1; - k = ((int)expbits-1)/16+1; - l = ((int)expbits2-1)/16+1; - for (j = 0; j < 25; j++) { - randnum(A,i); /* Base */ - randnum(B,k); /* Exponent */ - randnum(C,i); /* Modulus */ - randnum(D,i); /* Base2 */ - randnum(E,l); /* Exponent */ - /* Clip bases and mod to appropriate number of bits */ - t = ((BNWORD16)2<<((modbits-1)%16)) - 1; - *(BIGLITTLE(A-i,A+i-1)) &= t; - *(BIGLITTLE(C-i,C+i-1)) &= t; - *(BIGLITTLE(D-i,D+i-1)) &= t; - /* Make modulus large (msbit set) and odd (lsbit set) */ - *(BIGLITTLE(C-i,C+i-1)) |= (t >> 1) + 1; - BIGLITTLE(C[-1],C[0]) |= 1; - - /* Clip exponent to appropriate number of bits */ - t = ((BNWORD16)2<<((expbits-1)%16)) - 1; - *(BIGLITTLE(B-k,B+k-1)) &= t; - /* Make exponent large (msbit set) */ - *(BIGLITTLE(B-k,B+k-1)) |= (t >> 1) + 1; - /* The same for exponent 2 */ - t = ((BNWORD16)2<<((expbits2-1)%16)) - 1; - *(BIGLITTLE(E-l,E+l-1)) &= t; - *(BIGLITTLE(E-l,E+l-1)) |= (t >> 1) + 1; - - m = lbnBits_16(A, i); - if (m > (unsigned)modbits) { - bnput16("a = ", a, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be <= %d", m, (int)modbits)); - } - m = lbnBits_16(B, k); - if (m != (unsigned)expbits) { - bnput16("b = ", b, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)expbits)); - } - m = lbnBits_16(C, i); - if (m != (unsigned)modbits) { - bnput16("c = ", c, k); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)modbits)); - } - m = lbnBits_16(D, i); - if (m > (unsigned)modbits) { - bnput16("d = ", d, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be <= %d", m, (int)modbits)); - } - m = lbnBits_16(E, l); - if (m != (unsigned)expbits2) { - bnput16("e = ", e, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)expbits2)); - } -#if CLOCK_AVAIL - gettime(&start); -#endif - z = lbnTwoExpMod_16(A, B, k, C, i); - if (z < 0) - goto nomem; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - twoexpsec += cursec = sec(stop); - twoexpms += curms = msec(stop); - - ZRTP_LOG(3, (_ZTU_, "2^<%d>:%4lu.%03u ", (int)expbits, cursec, curms)); -#else - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> ", (int)modbits, (int)expbits)); -#endif - fflush(stdout); - -#if CLOCK_AVAIL - gettime(&start); -#endif - z = lbnExpMod_16(A, A, i, B, k, C, i); - if (z < 0) - goto nomem; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - expsec += cursec = sec(stop); - expms += curms = msec(stop); - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>:%4lu.%03u ",(int)modbits, (int)expbits, cursec, curms)); - fflush(stdout); - - gettime(&start); - z = lbnDoubleExpMod_16(D, A, i, B, k, D, i, E, l,C,i); - if (z < 0) - goto nomem; - gettime(&stop); - subtime(stop, start); - dblexpsec += cursec = sec(stop); - dblexpms += curms = msec(stop); - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>*<%d>^<%d>:%4lu.%03u", - (int)modbits, (int)expbits, - (int)modbits, (int)expbits2, - cursec, curms)); -#else - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>*<%d>^<%d>", - (int)modbits, (int)expbits, - (int)modbits, (int)expbits2)); -#endif - } -#if CLOCK_AVAIL - twoexpms += (twoexpsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "2^<%d> mod <%d> bits AVERAGE: %4lu.%03u s", - (int)expbits, (int)modbits, twoexpsec/j, twoexpms/j)); - expms += (expsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> mod <%d> bits AVERAGE: %4lu.%03u s", - (int)modbits, (int)expbits, (int)modbits, expsec/j, expms/j)); - dblexpms += (dblexpsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> * <%d>^<%d> mod <%d> bits AVERAGE:" - " %4lu.%03u s", - (int)modbits, (int)expbits, (int)modbits, - (int)expbits2, - (int)modbits, dblexpsec/j, dblexpms/j)); - - putchar('\n'); -#endif - } - - puts("Beginning 1000 interations of sanity checking.\n" - "Any output indicates a bug. No output is very strong\n" - "evidence that all the important low-level bignum routines\n" - "are working properly.\n"); - - /* - * If you change this loop to have an iteration 0, all results - * are primted on that iteration. Useful to see what's going - * on in case of major wierdness, but it produces a *lot* of - * output. - */ -#if (ZRTP_PLATFORM == ZP_WINCE) || (ZRTP_PLATFORM == ZP_SYMBIAN) - for (j = 1; j <= 20; j++) { -#else - for (j = 1; j <= 1000; j++) { -#endif -/* Do the tests for lots of different number sizes. */ - for (i = 1; i <= SIZE/2; i++) { - /* Make a random number i words long */ - do { - randnum(A,i); - } while (lbnNorm_16(A,i) < i); - - /* Checl lbnCmp - does a == a? */ - if (lbnCmp_16(A,A,i) || !j) { - bnput16("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "(a <=> a) = %d", lbnCmp_16(A,A,i))); - } - - memcpy(c, a, sizeof(a)); - - /* Check that the difference, after copy, is good. */ - if (lbnCmp_16(A,C,i) || !j) { - bnput16("a = ", A, i); - bnput16("c = ", C, i); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_16(A,C,i))); - } - - /* Generate a non-zero random t */ - do { - t = rand16(); - } while (!t); - - /* - * Add t to A. Check that: - * - lbnCmp works in both directions, and - * - A + t is greater than A. If there was a carry, - * the result, less the carry, should be *less* - * than A. - */ - carry = lbnAdd1_16(A,i,t); - if (lbnCmp_16(A,C,i) + lbnCmp_16(C,A,i) != 0 || - lbnCmp_16(A,C,i) != (carry ? -1 : 1) || !j) - { - bnput16("c = ", C, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - bnput16("a = c+t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "carry = %lX", (unsigned long)carry)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_16(A,C,i))); - ZRTP_LOG(3, (_ZTU_, "(c <=> a) = %d", lbnCmp_16(C,A,i))); - } - - /* Subtract t again */ - memcpy(d, a, sizeof(a)); - borrow = lbnSub1_16(A,i,t); - - if (carry != borrow || lbnCmp_16(A,C,i) || !j) { - bnput16("a = ", C, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - lbnAdd1_16(A,i,t); - bnput16("a += t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - lbnSub1_16(A,i,t); - bnput16("a -= t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_16(A,C,i))); - } - - /* Generate a random B */ - do { - randnum(B,i); - } while (lbnNorm_16(B,i) < i); - - carry = lbnAddN_16(A,B,i); - memcpy(d, a, sizeof(a)); - borrow = lbnSubN_16(A,B,i); - - if (carry != borrow || lbnCmp_16(A,C,i) || !j) { - bnput16("a = ", C, i); - bnput16("b = ", B, i); - bnput16("a += b = ", D, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - bnput16("a -= b = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_16(A,C,i))); - } - - /* D = B * t */ - lbnMulN1_16(D, B, i, t); - memcpy(e, d, sizeof(e)); - /* D = A + B * t, "carry" is overflow */ - borrow = *(BIGLITTLE(D-i-1,D+i)) += lbnAddN_16(D,A,i); - - carry = lbnMulAdd1_16(A, B, i, t); - - /* Did MulAdd get the same answer as mul then add? */ - if (carry != borrow || lbnCmp_16(A, D, i) || !j) { - bnput16("a = ", C, i); - bnput16("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - bnput16("e = b * t = ", E, i+1); - bnput16(" a + e = ", D, i+1); - bnput16("a + b * t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "carry = %lX", (unsigned long)carry)); - } - - memcpy(d, a, sizeof(a)); - borrow = lbnMulSub1_16(A, B, i, t); - - /* Did MulSub perform the inverse of MulAdd */ - if (carry != borrow || lbnCmp_16(A,C,i) || !j) { - bnput16(" a = ", C, i); - bnput16(" b = ", B, i); - bnput16("a += b*t = ", D, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - bnput16("a -= b*t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_16(A,C,i))); - bnput16("b*t = ", E, i+1); - } - /* At this point we're done with t, so it's scratch */ -#if 0 -/* Extra debug code */ - lbnMulN1_16(C, A, i, BIGLITTLE(B[-1],B[0])); - bnput16("a * b[0] = ", C, i+1); - for (k = 1; k < i; k++) { - carry = lbnMulAdd1_16(BIGLITTLE(C-k,C+k), A, i, - *(BIGLITTLE(B-1-k,B+k))); - *(BIGLITTLE(C-i-k,C+i+k)) = carry; - bnput16("a * b[x] = ", C, i+k+1); - } - - lbnMulN1_16(D, B, i, BIGLITTLE(A[-1],A[0])); - bnput16("b * a[0] = ", D, i+1); - for (k = 1; k < i; k++) { - carry = lbnMulAdd1_16(BIGLITTLE(D-k,D+k), B, i, - *(BIGLITTLE(A-1-k,A+k))); - *(BIGLITTLE(D-i-k,D+i+k)) = carry; - bnput16("b * a[x] = ", D, i+k+1); - } -#endif - /* Does Mul work both ways symmetrically */ - lbnMul_16(C,A,i,B,i); - lbnMul_16(D,B,i,A,i); - if (lbnCmp_16(C,D,i+i) || !j) { - bnput16("a = ", A, i); - bnput16("b = ", B, i); - bnput16("a * b = ", C, i+i); - bnput16("b * a = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "(a*b <=> b*a) = %d", lbnCmp_16(C,D,i+i))); - } - /* Check multiplication modulo some small things */ - /* 30030 = 2*3*5*11*13 */ - k = lbnModQ_16(C, i+i, 30030); - for (l = 0; - l < sizeof(smallprimes)/sizeof(*smallprimes); - l++) - { - m = smallprimes[l]; - t = lbnModQ_16(C, i+i, m); - carry = lbnModQ_16(A, i, m); - borrow = lbnModQ_16(B, i, m); - if (t != (carry * borrow) % m) { - bnput16("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "a mod %u = %u", m, (unsigned)carry)); - bnput16("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "b mod %u = %u", m, (unsigned)borrow)); - bnput16("a*b = ", C, i+i); - ZRTP_LOG(3, (_ZTU_, "a*b mod %u = %u", m, (unsigned)t)); - ZRTP_LOG(3, (_ZTU_, "expected %u", (unsigned)((carry*borrow)%m))); - } - /* Verify that (C % 30030) % m == C % m */ - if (m <= 13 && t != k % m) { - ZRTP_LOG(3, (_ZTU_, "c mod 30030 = %u mod %u= %u", k, m, k%m)); - ZRTP_LOG(3, (_ZTU_, "c mod %u = %u", m, (unsigned)t)); - } - } - - /* Generate an F less than A and B */ - do { - randnum(F,i); - } while (lbnCmp_16(F,A,i) >= 0 || - lbnCmp_16(F,B,i) >= 0); - - /* Add F to D (remember, D = A*B) */ - lbnAdd1_16(BIGLITTLE(D-i,D+i), i, lbnAddN_16(D, F, i)); - memcpy(c, d, sizeof(d)); - - /* - * Divide by A and check that quotient and remainder - * match (remainder should be F, quotient should be B) - */ - t = lbnDiv_16(E,C,i+i,A,i); - if (t || lbnCmp_16(E,B,i) || lbnCmp_16(C, F, i) || !j) { - bnput16("a = ", A, i); - bnput16("b = ", B, i); - bnput16("f = ", F, i); - bnput16("a * b + f = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "qhigh = %lX", (unsigned long)t)); - bnput16("(a*b+f) / a = ", E, i); - bnput16("(a*b+f) % a = ", C, i); - } - - memcpy(c, d, sizeof(d)); - - /* Divide by B and check similarly */ - t = lbnDiv_16(E,C,i+i,B,i); - if (lbnCmp_16(E,A,i) || lbnCmp_16(C, F, i) || !j) { - bnput16("a = ", A, i); - bnput16("b = ", B, i); - bnput16("f = ", F, i); - bnput16("a * b + f = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "qhigh = %lX", (unsigned long)t)); - bnput16("(a*b+f) / b = ", E, i); - bnput16("(a*b+f) % b = ", C, i); - } - - /* Check that A*A == A^2 */ - lbnMul_16(C,A,i,A,i); - lbnSquare_16(D,A,i); - if (lbnCmp_16(C,D,i+i) || !j) { - bnput16("a*a = ", C, i+i); - bnput16("a^2 = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "(a * a == a^2) = %d", lbnCmp_16(C,D,i+i))); - } - - /* Compute a GCD */ - lbnCopy_16(C,A,i); - lbnCopy_16(D,B,i); - z = lbnGcd_16(C, i, D, i, &k); - if (z < 0) - goto nomem; - /* z = 1 if GCD in D; z = 0 if GCD in C */ - - /* Approximate check that the GCD came out right */ - for (l = 0; - l < sizeof(smallprimes)/sizeof(*smallprimes); - l++) - { - m = smallprimes[l]; - t = lbnModQ_16(z ? D : C, k, m); - carry = lbnModQ_16(A, i, m); - borrow = lbnModQ_16(B, i, m); - if (!t != (!carry && !borrow)) { - bnput16("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "a mod %u = %u", m, (unsigned)carry)); - bnput16("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "b mod %u = %u", m, (unsigned)borrow)); - bnput16("gcd(a,b) = ", z ? D : C, k); - ZRTP_LOG(3, (_ZTU_, "gcd(a,b) mod %u = %u", m, (unsigned)t)); - } - } - - - /* - * Do some Montgomery operations - * Start with A > B, and also place a copy of B into C. - * Then make A odd so it can be a Montgomery modulus. - */ - if (lbnCmp_16(A, B, i) < 0) { - memcpy(c, a, sizeof(c)); - memcpy(a, b, sizeof(a)); - memcpy(b, c, sizeof(b)); - } else { - memcpy(c, b, sizeof(c)); - } - BIGLITTLE(A[-1],A[0]) |= 1; - - /* Convert to and from */ - lbnToMont_16(B, i, A, i); - lbnFromMont_16(B, A, i); - if (lbnCmp_16(B, C, i)) { - memcpy(b, c, sizeof(c)); - bnput16("mod = ", A, i); - bnput16("input = ", B, i); - lbnToMont_16(B, i, A, i); - bnput16("mont = ", B, i); - lbnFromMont_16(B, A, i); - bnput16("output = ", B, i); - } - /* E = B^5 (mod A), no Montgomery ops */ - lbnSquare_16(E, B, i); - (void)lbnDiv_16(BIGLITTLE(E-i,E+i),E,i+i,A,i); - lbnSquare_16(D, E, i); - (void)lbnDiv_16(BIGLITTLE(D-i,D+i),D,i+i,A,i); - lbnMul_16(E, D, i, B, i); - (void)lbnDiv_16(BIGLITTLE(E-i,E+i),E,i+i,A,i); - - /* D = B^5, using ExpMod */ - BIGLITTLE(F[-1],F[0]) = 5; - z = lbnExpMod_16(D, B, i, F, 1, A, i); - if (z < 0) - goto nomem; - if (lbnCmp_16(D, E, i) || !j) { - bnput16("mod = ", A, i); - bnput16("input = ", B, i); - bnput16("input^5 = ", E, i); - bnput16("input^5 = ", D, i); - ZRTP_LOG(3, (_ZTU_, "a>b (x <=> y) = %d", lbnCmp_16(D,E,i))); - } - /* TODO: Test lbnTwoExpMod, lbnDoubleExpMod */ - } /* for (i) */ - ZRTP_LOG(3, (_ZTU_, "\r%d ", j)); - fflush(stdout); - } /* for (j) */ - ZRTP_LOG(3, (_ZTU_, "%d iterations of up to %d 16-bit words completed.", j-1, i-1)); - return 0; -nomem: - ZRTP_LOG(3, (_ZTU_, "Out of memory")); - return 1; -} diff --git a/libs/libzrtp/third_party/bnlib/bntest32.c b/libs/libzrtp/third_party/bnlib/bntest32.c deleted file mode 100644 index 2e8c33494e..0000000000 --- a/libs/libzrtp/third_party/bnlib/bntest32.c +++ /dev/null @@ -1,798 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Test driver for low-level bignum library (32-bit version). - * This access the low-level library directly. It is NOT an example of - * how to program with the library normally! By accessing the library - * at a low level, it is possible to exercise the smallest components - * and thus localize bugs more accurately. This is especially useful - * when writing assembly-language primitives. - * - * This also does timing tests on modular exponentiation. Modular - * exponentiation is so computationally expensive that the fact that this - * code omits one level of interface glue has no perceptible effect on - * the results. - */ -#include "zrtp.h" - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -#define _ZTU_ "bntest" - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STDLIB_H -#define NO_STDLIB_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#include <stdio.h> - -#if !NO_STDLIB_H -#include <stdlib.h> /* For strtol */ -#else -long strtol(const char *, char **, int); -#endif - -#if !NO_STRING_H -#include <string.h> /* For memcpy */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "lbn32.h" -#include "kludge.h" - -#if BNYIELD -int (*bnYield)(void) = 0; -#endif - -/* Work with up to 2048-bit numbers */ -#define MAXBITS 3072 -#define SIZE (MAXBITS/32 + 1) - -/* Additive congruential random number generator, x[i] = x[i-24] + x[i-55] */ -static BNWORD32 randp[55]; -static BNWORD32 *randp1 = randp, *randp2 = randp+24; - -static BNWORD32 -rand32(void) -{ - if (++randp2 == randp+55) { - randp2 = randp; - randp1++; - } else if (++randp1 == randp+55) { - randp1 = randp; - } - - return *randp1 += *randp2; -} - -/* - * CRC-3_2: x^3_2+x^26+x^23+x^22+x^1_6+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 - * - * The additive congruential RNG is seeded with a single integer, - * which is shuffled with a CRC polynomial to generate the initial - * table values. The Polynomial is the same size as the words being - * used. - * - * Thus, in the various versions of this library, we actually use this - * polynomial as-is, this polynomial mod x^17, and this polynomial with - * the leading coefficient deleted and replaced with x^6_4. As-is, - * it's irreducible, so it has a long period. Modulo x^17, it factors as - * (x^4+x^3+x^2+x+1) * (x^12+x^11+x^8+x^7+x^6+x^5+x^4+x^3+1), - * which still has a large enough period (4095) for the use it's put to. - * With the leading coefficient moved up, it factors as - * (x^50+x^49+x^48+x^47+x^46+x^43+x^41+x^40+x^38+x^37+x^36+x^35+x^34+x^33+ - * x^31+x^30+x^29+x^28+x^27+x^25+x^23+x^18+x^1_6+x^15+x^14+x^13+x^11+x^9+ - * x^8+x^7+x^6+x^5+x^3+x^2+1)*(x^11+x^10+x^9+x^5+x^4+x^3+1)*(x^3+x+1), - * which definitely has a long enough period to serve for initialization. - * - * The effort put into this PRNG is kind of unwarranted given the trivial - * use it's being put to, but oh, well. It does have the nice advantage - * of producing numbers that are portable between platforms, so if there's - * a problem with one platform, you can compare all the intermediate - * results with another platform. - */ -#define POLY (BNWORD32)0x04c11db7 - -static void -srand32(BNWORD32 seed) -{ - int i, j; - - for (i = 0; i < 55; i++) { - for (j = 0; j < 32; j++) - if (seed >> (32-1)) - seed = (seed << 1) ^ POLY; - else - seed <<= 1; - randp[i] = seed; - } - for (i = 0; i < 3*55; i ++) - rand32(); -} - -static void -randnum(BNWORD32 *num, unsigned len) -{ - while (len--) - BIGLITTLE(*--num,*num++) = rand32(); -} - -static void -bnprint32(BNWORD32 const *num, unsigned len) -{ - BIGLITTLE(num -= len, num += len); - - while (len--) - ZRTP_LOG(3, (_ZTU_, "%0*lX", 32/4, (unsigned long)BIGLITTLE(*num++,*--num))); -} - -static void -bnput32(char const *prompt, BNWORD32 const *num, unsigned len) -{ - fputs(prompt, stdout); - bnprint32(num, len); - putchar('\n'); -} - -/* - * One of our tests uses a known prime. The following selections were - * taken from the tables at the end of Hans Reisel's "Prime Numbers and - * Computer Methods for Factorization", second edition - an excellent book. - * (ISBN 0-8176-3743-5 ISBN 3-7643-3743-5) - */ -#if 0 -/* P31=1839605 17620282 38179967 87333633 from the factors of 3^256+2^256 */ -static unsigned char const prime[] = { - 0x17,0x38,0x15,0xBC,0x8B,0xBB,0xE9,0xEF,0x01,0xA9,0xFD,0x3A,0x01 -}; -#elif 0 -/* P48=40554942 04557502 46193993 36199835 4279613_2 73199617 from the same */ -static unsigned char const prime[] = { - 0x47,0x09,0x77,0x07,0xCF,0xFD,0xE1,0x54,0x3E,0x24, - 0xF7,0xF1,0x7A,0x3E,0x91,0x51,0xCC,0xC7,0xD4,0x01 -}; -#elif 0 -/* - * P75 = 450 55287640 97906895 47687014 5808213_2 - * 05219565 99525911 39967964 66003_258 91979521 - * from the factors of 4^128+3+128 - * (The "026" and "062" are to prevent a Bad String from appearing here.) - */ -static unsigned char const prime[] = { - 0xFF,0x00,0xFF,0x00,0xFF,0x01,0x06,0x4F,0xF8,0xED, - 0xA3,0x37,0x23,0x2A,0x04,0xEA,0xF9,0x5F,0x30,0x4C, - 0xAE,0xCD, 026,0x4E, 062,0x10,0x04,0x7D,0x0D,0x79, - 0x01 -}; -#else -/* - * P75 = 664 85659796 45277755 9123_2190 67300940 - * 51844953 78793489 59444670 35675855 57440257 - * from the factors of 5^128+4^128 - * (The "026" is to prevent a Bad String from appearing here.) - */ -static unsigned char const prime[] = { - 0x01,0x78,0x4B,0xA5,0xD3,0x30,0x03,0xEB,0x73,0xE6, - 0x0F,0x4E,0x31,0x7D,0xBC,0xE2,0xA0,0xD4, 026,0x3F, - 0x3C,0xEA,0x1B,0x44,0xAD,0x39,0xE7,0xE5,0xAD,0x19, - 0x67,0x01 -}; -#endif - -static int -usage(char const *name) -{ - ZRTP_LOG(3, (_ZTU_, "Usage: %s [modbits [expbits [expbits2]]" -"With no arguments, just runs test suite. If modbits is given, runs\n" -"quick validation test, then runs timing tests of modular exponentiation.\n" -"If expbits is given, it is used as an exponent size, otherwise it defaults\n" -"to the same as modbits. If expbits2 is given it is used as the second\n" -"exponent size in the double-exponentiation tests, otherwise it defaults\n" -"to the same as expbits. All are limited to %u bits.\n", - name, (unsigned)MAXBITS)); - return 1; -} - -/* for libzrtp support */ -int -bntest_main(int argc, char **argv) -{ - unsigned i, j, k, l, m; - int z; - BNWORD32 t, carry, borrow; - BNWORD32 a[SIZE], b[SIZE], c[SIZE], d[SIZE]; - BNWORD32 e[SIZE], f[SIZE]; - static BNWORD32 entries[sizeof(prime)*2][(sizeof(prime)-1)/(32/8)+1]; - BNWORD32 *array[sizeof(prime)*2]; - unsigned long modbits = 0, expbits = 0, expbits2 = 0; - char *p; -#define A BIGLITTLE((a+SIZE),a) -#define B BIGLITTLE((b+SIZE),b) -#define C BIGLITTLE((c+SIZE),c) -#define D BIGLITTLE((d+SIZE),d) -#define E BIGLITTLE((e+SIZE),e) -#define F BIGLITTLE((f+SIZE),f) - static unsigned const smallprimes[] = { - 2, 3, 5, 7, 11, 13, 17, 19, 23, 27, 29, 31, 37, 41, 43 - }; - - /* Set up array for precomputed modexp */ - for (i = 0; i < sizeof(array)/sizeof(*array); i++) - array[i] = entries[i] BIG(+ SIZE); - - srand32(1); - - puts(BIGLITTLE("Big-endian machine","Little-endian machine")); - - if (argc >= 2) { - modbits = strtoul(argv[1], &p, 0); - if (!modbits || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid modbits: %s", argv[1])); - return usage(argv[0]); - } - } - if (argc >= 3) { - expbits = strtoul(argv[2], &p, 0); - if (!expbits || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid expbits: %s", argv[2])); - return usage(argv[0]); - } - expbits2 = expbits; - } - if (argc >= 4) { - expbits2 = strtoul(argv[3], &p, 0); - if (!expbits2 || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid expbits2: %s", argv[3])); - return usage(argv[0]); - } - } - if (argc >= 5) { - ZRTP_LOG(1, (_ZTU_, "Too many arguments: %s", argv[4])); - return usage(argv[0]); - } - -/* B is a nice not-so-little prime */ - lbnInsertBigBytes_32(B, prime, 0, sizeof(prime)); - ((unsigned char *)c)[0] = 0; - lbnInsertBigBytes_32(B, (unsigned char *)c, sizeof(prime), 1); - lbnExtractBigBytes_32(B, (unsigned char *)c, 0, sizeof(prime)+1); - i = (sizeof(prime)-1)/(32/8)+1; /* Size of array in words */ - if (((unsigned char *)c)[0] || - memcmp(prime, (unsigned char *)c+1, sizeof(prime)) != 0) - { - ZRTP_LOG(3, (_ZTU_, "Input != output!: ")); - for (k = 0; k < sizeof(prime); k++) - ZRTP_LOG(3, (_ZTU_, "%02X ", prime[k])); - putchar('\n'); - for (k = 0; k < sizeof(prime)+1; k++) - ZRTP_LOG(3, (_ZTU_, "%02X ", ((unsigned char *)c)[k])); - putchar('\n'); - bnput32("p = ", B, i); - - } - - /* Timing test code - only if requested on the command line */ - if (modbits) { -#if CLOCK_AVAIL - timetype start, stop; - unsigned long cursec, expsec, twoexpsec, dblexpsec; - unsigned curms, expms, twoexpms, dblexpms; - - expsec = twoexpsec = dblexpsec = 0; - expms = twoexpms = dblexpms = 0; -#endif - - lbnCopy_32(C,B,i); - lbnSub1_32(C,i,1); /* C is exponent: p-1 */ - - puts("Testing modexp with a known prime. " - "All results should be 1."); - bnput32("p = ", B, i); - bnput32("p-1 = ", C, i); - z = lbnTwoExpMod_32(A, C, i, B, i); - if (z < 0) - goto nomem; - bnput32("2^(p-1) mod p = ", A, i); - for (j = 0; j < 10; j++) { - randnum(A,i); - (void)lbnDiv_32(D,A,i,B,i); - - bnput32("a = ", A, i); - z = lbnExpMod_32(D, A, i, C, i, B, i); - if (z < 0) - goto nomem; - bnput32("a^(p-1) mod p = ", D, i); - - z = lbnBasePrecompBegin_32(array, (sizeof(prime)*8+4)/5, 5, - A, i, B, i); - if (z < 0) - goto nomem; - BIGLITTLE(D[-1],D[0]) = -1; - z = lbnBasePrecompExp_32(D, (BNWORD32 const * const *)array, - 5, C, i, B, i); - if (z < 0) - goto nomem; - bnput32("a^(p-1) mod p = ", D, i); - - for (k = 0; k < 5; k++) { - randnum(E,i); - bnput32("e = ", E, i); - z = lbnExpMod_32(D, A, i, E, i, B, i); - if (z < 0) - goto nomem; - bnput32("a^e mod p = ", D, i); - z = lbnBasePrecompExp_32(D, (BNWORD32 const * const *)array, - 5, E, i, B, i); - if (z < 0) - goto nomem; - bnput32("a^e mod p = ", D, i); - } - } - - ZRTP_LOG(3, (_ZTU_, "\n" - "Timing exponentiations modulo a %d-bit modulus, i.e.\n" - "2^<%d> mod <%d> bits, <%d>^<%d> mod <%d> bits and\n" - "<%d>^<%d> * <%d>^<%d> mod <%d> bits", - (int)modbits, (int)expbits, (int)modbits, - (int)modbits, (int)expbits, (int)modbits, - (int)modbits, (int)expbits, (int)modbits, (int)expbits2, - (int)modbits)); - - i = ((int)modbits-1)/32+1; - k = ((int)expbits-1)/32+1; - l = ((int)expbits2-1)/32+1; - for (j = 0; j < 25; j++) { - randnum(A,i); /* Base */ - randnum(B,k); /* Exponent */ - randnum(C,i); /* Modulus */ - randnum(D,i); /* Base2 */ - randnum(E,l); /* Exponent */ - /* Clip bases and mod to appropriate number of bits */ - t = ((BNWORD32)2<<((modbits-1)%32)) - 1; - *(BIGLITTLE(A-i,A+i-1)) &= t; - *(BIGLITTLE(C-i,C+i-1)) &= t; - *(BIGLITTLE(D-i,D+i-1)) &= t; - /* Make modulus large (msbit set) and odd (lsbit set) */ - *(BIGLITTLE(C-i,C+i-1)) |= (t >> 1) + 1; - BIGLITTLE(C[-1],C[0]) |= 1; - - /* Clip exponent to appropriate number of bits */ - t = ((BNWORD32)2<<((expbits-1)%32)) - 1; - *(BIGLITTLE(B-k,B+k-1)) &= t; - /* Make exponent large (msbit set) */ - *(BIGLITTLE(B-k,B+k-1)) |= (t >> 1) + 1; - /* The same for exponent 2 */ - t = ((BNWORD32)2<<((expbits2-1)%32)) - 1; - *(BIGLITTLE(E-l,E+l-1)) &= t; - *(BIGLITTLE(E-l,E+l-1)) |= (t >> 1) + 1; - - m = lbnBits_32(A, i); - if (m > (unsigned)modbits) { - bnput32("a = ", a, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be <= %d", m, (int)modbits)); - } - m = lbnBits_32(B, k); - if (m != (unsigned)expbits) { - bnput32("b = ", b, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)expbits)); - } - m = lbnBits_32(C, i); - if (m != (unsigned)modbits) { - bnput32("c = ", c, k); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)modbits)); - } - m = lbnBits_32(D, i); - if (m > (unsigned)modbits) { - bnput32("d = ", d, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be <= %d", m, (int)modbits)); - } - m = lbnBits_32(E, l); - if (m != (unsigned)expbits2) { - bnput32("e = ", e, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)expbits2)); - } -#if CLOCK_AVAIL - gettime(&start); -#endif - z = lbnTwoExpMod_32(A, B, k, C, i); - if (z < 0) - goto nomem; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - twoexpsec += cursec = sec(stop); - twoexpms += curms = msec(stop); - - ZRTP_LOG(3, (_ZTU_, "2^<%d>:%4lu.%03u ", (int)expbits, cursec, curms)); -#else - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> ", (int)modbits, (int)expbits)); -#endif - fflush(stdout); - -#if CLOCK_AVAIL - gettime(&start); -#endif - z = lbnExpMod_32(A, A, i, B, k, C, i); - if (z < 0) - goto nomem; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - expsec += cursec = sec(stop); - expms += curms = msec(stop); - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>:%4lu.%03u ",(int)modbits, (int)expbits, cursec, curms)); - fflush(stdout); - - gettime(&start); - z = lbnDoubleExpMod_32(D, A, i, B, k, D, i, E, l,C,i); - if (z < 0) - goto nomem; - gettime(&stop); - subtime(stop, start); - dblexpsec += cursec = sec(stop); - dblexpms += curms = msec(stop); - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>*<%d>^<%d>:%4lu.%03u", - (int)modbits, (int)expbits, - (int)modbits, (int)expbits2, - cursec, curms)); -#else - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>*<%d>^<%d>", - (int)modbits, (int)expbits, - (int)modbits, (int)expbits2)); -#endif - } -#if CLOCK_AVAIL - twoexpms += (twoexpsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "2^<%d> mod <%d> bits AVERAGE: %4lu.%03u s", - (int)expbits, (int)modbits, twoexpsec/j, twoexpms/j)); - expms += (expsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> mod <%d> bits AVERAGE: %4lu.%03u s", - (int)modbits, (int)expbits, (int)modbits, expsec/j, expms/j)); - dblexpms += (dblexpsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> * <%d>^<%d> mod <%d> bits AVERAGE:" - " %4lu.%03u s", - (int)modbits, (int)expbits, (int)modbits, - (int)expbits2, - (int)modbits, dblexpsec/j, dblexpms/j)); - - putchar('\n'); -#endif - } - - puts("Beginning 1000 interations of sanity checking.\n" - "Any output indicates a bug. No output is very strong\n" - "evidence that all the important low-level bignum routines\n" - "are working properly.\n"); - - /* - * If you change this loop to have an iteration 0, all results - * are primted on that iteration. Useful to see what's going - * on in case of major wierdness, but it produces a *lot* of - * output. - */ -#if (ZRTP_PLATFORM == ZP_WINCE) || (ZRTP_PLATFORM == ZP_SYMBIAN) - for (j = 1; j <= 20; j++) { -#else - for (j = 1; j <= 1000; j++) { -#endif -/* Do the tests for lots of different number sizes. */ - for (i = 1; i <= SIZE/2; i++) { - /* Make a random number i words long */ - do { - randnum(A,i); - } while (lbnNorm_32(A,i) < i); - - /* Checl lbnCmp - does a == a? */ - if (lbnCmp_32(A,A,i) || !j) { - bnput32("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "(a <=> a) = %d", lbnCmp_32(A,A,i))); - } - - memcpy(c, a, sizeof(a)); - - /* Check that the difference, after copy, is good. */ - if (lbnCmp_32(A,C,i) || !j) { - bnput32("a = ", A, i); - bnput32("c = ", C, i); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_32(A,C,i))); - } - - /* Generate a non-zero random t */ - do { - t = rand32(); - } while (!t); - - /* - * Add t to A. Check that: - * - lbnCmp works in both directions, and - * - A + t is greater than A. If there was a carry, - * the result, less the carry, should be *less* - * than A. - */ - carry = lbnAdd1_32(A,i,t); - if (lbnCmp_32(A,C,i) + lbnCmp_32(C,A,i) != 0 || - lbnCmp_32(A,C,i) != (carry ? -1 : 1) || !j) - { - bnput32("c = ", C, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - bnput32("a = c+t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "carry = %lX", (unsigned long)carry)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_32(A,C,i))); - ZRTP_LOG(3, (_ZTU_, "(c <=> a) = %d", lbnCmp_32(C,A,i))); - } - - /* Subtract t again */ - memcpy(d, a, sizeof(a)); - borrow = lbnSub1_32(A,i,t); - - if (carry != borrow || lbnCmp_32(A,C,i) || !j) { - bnput32("a = ", C, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - lbnAdd1_32(A,i,t); - bnput32("a += t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - lbnSub1_32(A,i,t); - bnput32("a -= t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_32(A,C,i))); - } - - /* Generate a random B */ - do { - randnum(B,i); - } while (lbnNorm_32(B,i) < i); - - carry = lbnAddN_32(A,B,i); - memcpy(d, a, sizeof(a)); - borrow = lbnSubN_32(A,B,i); - - if (carry != borrow || lbnCmp_32(A,C,i) || !j) { - bnput32("a = ", C, i); - bnput32("b = ", B, i); - bnput32("a += b = ", D, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - bnput32("a -= b = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_32(A,C,i))); - } - - /* D = B * t */ - lbnMulN1_32(D, B, i, t); - memcpy(e, d, sizeof(e)); - /* D = A + B * t, "carry" is overflow */ - borrow = *(BIGLITTLE(D-i-1,D+i)) += lbnAddN_32(D,A,i); - - carry = lbnMulAdd1_32(A, B, i, t); - - /* Did MulAdd get the same answer as mul then add? */ - if (carry != borrow || lbnCmp_32(A, D, i) || !j) { - bnput32("a = ", C, i); - bnput32("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - bnput32("e = b * t = ", E, i+1); - bnput32(" a + e = ", D, i+1); - bnput32("a + b * t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "carry = %lX", (unsigned long)carry)); - } - - memcpy(d, a, sizeof(a)); - borrow = lbnMulSub1_32(A, B, i, t); - - /* Did MulSub perform the inverse of MulAdd */ - if (carry != borrow || lbnCmp_32(A,C,i) || !j) { - bnput32(" a = ", C, i); - bnput32(" b = ", B, i); - bnput32("a += b*t = ", D, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - bnput32("a -= b*t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_32(A,C,i))); - bnput32("b*t = ", E, i+1); - } - /* At this point we're done with t, so it's scratch */ -#if 0 -/* Extra debug code */ - lbnMulN1_32(C, A, i, BIGLITTLE(B[-1],B[0])); - bnput32("a * b[0] = ", C, i+1); - for (k = 1; k < i; k++) { - carry = lbnMulAdd1_32(BIGLITTLE(C-k,C+k), A, i, - *(BIGLITTLE(B-1-k,B+k))); - *(BIGLITTLE(C-i-k,C+i+k)) = carry; - bnput32("a * b[x] = ", C, i+k+1); - } - - lbnMulN1_32(D, B, i, BIGLITTLE(A[-1],A[0])); - bnput32("b * a[0] = ", D, i+1); - for (k = 1; k < i; k++) { - carry = lbnMulAdd1_32(BIGLITTLE(D-k,D+k), B, i, - *(BIGLITTLE(A-1-k,A+k))); - *(BIGLITTLE(D-i-k,D+i+k)) = carry; - bnput32("b * a[x] = ", D, i+k+1); - } -#endif - /* Does Mul work both ways symmetrically */ - lbnMul_32(C,A,i,B,i); - lbnMul_32(D,B,i,A,i); - if (lbnCmp_32(C,D,i+i) || !j) { - bnput32("a = ", A, i); - bnput32("b = ", B, i); - bnput32("a * b = ", C, i+i); - bnput32("b * a = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "(a*b <=> b*a) = %d", lbnCmp_32(C,D,i+i))); - } - /* Check multiplication modulo some small things */ - /* 30030 = 2*3*5*11*13 */ - k = lbnModQ_32(C, i+i, 30030); - for (l = 0; - l < sizeof(smallprimes)/sizeof(*smallprimes); - l++) - { - m = smallprimes[l]; - t = lbnModQ_32(C, i+i, m); - carry = lbnModQ_32(A, i, m); - borrow = lbnModQ_32(B, i, m); - if (t != (carry * borrow) % m) { - bnput32("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "a mod %u = %u", m, (unsigned)carry)); - bnput32("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "b mod %u = %u", m, (unsigned)borrow)); - bnput32("a*b = ", C, i+i); - ZRTP_LOG(3, (_ZTU_, "a*b mod %u = %u", m, (unsigned)t)); - ZRTP_LOG(3, (_ZTU_, "expected %u", (unsigned)((carry*borrow)%m))); - } - /* Verify that (C % 30030) % m == C % m */ - if (m <= 13 && t != k % m) { - ZRTP_LOG(3, (_ZTU_, "c mod 30030 = %u mod %u= %u", k, m, k%m)); - ZRTP_LOG(3, (_ZTU_, "c mod %u = %u", m, (unsigned)t)); - } - } - - /* Generate an F less than A and B */ - do { - randnum(F,i); - } while (lbnCmp_32(F,A,i) >= 0 || - lbnCmp_32(F,B,i) >= 0); - - /* Add F to D (remember, D = A*B) */ - lbnAdd1_32(BIGLITTLE(D-i,D+i), i, lbnAddN_32(D, F, i)); - memcpy(c, d, sizeof(d)); - - /* - * Divide by A and check that quotient and remainder - * match (remainder should be F, quotient should be B) - */ - t = lbnDiv_32(E,C,i+i,A,i); - if (t || lbnCmp_32(E,B,i) || lbnCmp_32(C, F, i) || !j) { - bnput32("a = ", A, i); - bnput32("b = ", B, i); - bnput32("f = ", F, i); - bnput32("a * b + f = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "qhigh = %lX", (unsigned long)t)); - bnput32("(a*b+f) / a = ", E, i); - bnput32("(a*b+f) % a = ", C, i); - } - - memcpy(c, d, sizeof(d)); - - /* Divide by B and check similarly */ - t = lbnDiv_32(E,C,i+i,B,i); - if (lbnCmp_32(E,A,i) || lbnCmp_32(C, F, i) || !j) { - bnput32("a = ", A, i); - bnput32("b = ", B, i); - bnput32("f = ", F, i); - bnput32("a * b + f = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "qhigh = %lX", (unsigned long)t)); - bnput32("(a*b+f) / b = ", E, i); - bnput32("(a*b+f) % b = ", C, i); - } - - /* Check that A*A == A^2 */ - lbnMul_32(C,A,i,A,i); - lbnSquare_32(D,A,i); - if (lbnCmp_32(C,D,i+i) || !j) { - bnput32("a*a = ", C, i+i); - bnput32("a^2 = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "(a * a == a^2) = %d", lbnCmp_32(C,D,i+i))); - } - - /* Compute a GCD */ - lbnCopy_32(C,A,i); - lbnCopy_32(D,B,i); - z = lbnGcd_32(C, i, D, i, &k); - if (z < 0) - goto nomem; - /* z = 1 if GCD in D; z = 0 if GCD in C */ - - /* Approximate check that the GCD came out right */ - for (l = 0; - l < sizeof(smallprimes)/sizeof(*smallprimes); - l++) - { - m = smallprimes[l]; - t = lbnModQ_32(z ? D : C, k, m); - carry = lbnModQ_32(A, i, m); - borrow = lbnModQ_32(B, i, m); - if (!t != (!carry && !borrow)) { - bnput32("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "a mod %u = %u", m, (unsigned)carry)); - bnput32("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "b mod %u = %u", m, (unsigned)borrow)); - bnput32("gcd(a,b) = ", z ? D : C, k); - ZRTP_LOG(3, (_ZTU_, "gcd(a,b) mod %u = %u", m, (unsigned)t)); - } - } - - - /* - * Do some Montgomery operations - * Start with A > B, and also place a copy of B into C. - * Then make A odd so it can be a Montgomery modulus. - */ - if (lbnCmp_32(A, B, i) < 0) { - memcpy(c, a, sizeof(c)); - memcpy(a, b, sizeof(a)); - memcpy(b, c, sizeof(b)); - } else { - memcpy(c, b, sizeof(c)); - } - BIGLITTLE(A[-1],A[0]) |= 1; - - /* Convert to and from */ - lbnToMont_32(B, i, A, i); - lbnFromMont_32(B, A, i); - if (lbnCmp_32(B, C, i)) { - memcpy(b, c, sizeof(c)); - bnput32("mod = ", A, i); - bnput32("input = ", B, i); - lbnToMont_32(B, i, A, i); - bnput32("mont = ", B, i); - lbnFromMont_32(B, A, i); - bnput32("output = ", B, i); - } - /* E = B^5 (mod A), no Montgomery ops */ - lbnSquare_32(E, B, i); - (void)lbnDiv_32(BIGLITTLE(E-i,E+i),E,i+i,A,i); - lbnSquare_32(D, E, i); - (void)lbnDiv_32(BIGLITTLE(D-i,D+i),D,i+i,A,i); - lbnMul_32(E, D, i, B, i); - (void)lbnDiv_32(BIGLITTLE(E-i,E+i),E,i+i,A,i); - - /* D = B^5, using ExpMod */ - BIGLITTLE(F[-1],F[0]) = 5; - z = lbnExpMod_32(D, B, i, F, 1, A, i); - if (z < 0) - goto nomem; - if (lbnCmp_32(D, E, i) || !j) { - bnput32("mod = ", A, i); - bnput32("input = ", B, i); - bnput32("input^5 = ", E, i); - bnput32("input^5 = ", D, i); - ZRTP_LOG(3, (_ZTU_, "a>b (x <=> y) = %d", lbnCmp_32(D,E,i))); - } - /* TODO: Test lbnTwoExpMod, lbnDoubleExpMod */ - } /* for (i) */ - ZRTP_LOG(3, (_ZTU_, "\r%d ", j)); - fflush(stdout); - } /* for (j) */ - ZRTP_LOG(3, (_ZTU_, "%d iterations of up to %d 32-bit words completed.", j-1, i-1)); - return 0; -nomem: - ZRTP_LOG(3, (_ZTU_, "Out of memory")); - return 1; -} diff --git a/libs/libzrtp/third_party/bnlib/bntest64.c b/libs/libzrtp/third_party/bnlib/bntest64.c deleted file mode 100644 index 8afdb967ef..0000000000 --- a/libs/libzrtp/third_party/bnlib/bntest64.c +++ /dev/null @@ -1,798 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Test driver for low-level bignum library (64-bit version). - * This access the low-level library directly. It is NOT an example of - * how to program with the library normally! By accessing the library - * at a low level, it is possible to exercise the smallest components - * and thus localize bugs more accurately. This is especially useful - * when writing assembly-language primitives. - * - * This also does timing tests on modular exponentiation. Modular - * exponentiation is so computationally expensive that the fact that this - * code omits one level of interface glue has no perceptible effect on - * the results. - */ -#include "zrtp.h" - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -#define _ZTU_ "bntest" - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STDLIB_H -#define NO_STDLIB_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#include <stdio.h> - -#if !NO_STDLIB_H -#include <stdlib.h> /* For strtol */ -#else -long strtol(const char *, char **, int); -#endif - -#if !NO_STRING_H -#include <string.h> /* For memcpy */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "lbn64.h" -#include "kludge.h" - -#if BNYIELD -int (*bnYield)(void) = 0; -#endif - -/* Work with up to 2048-bit numbers */ -#define MAXBITS 3072 -#define SIZE (MAXBITS/64 + 1) - -/* Additive congruential random number generator, x[i] = x[i-24] + x[i-55] */ -static BNWORD64 randp[55]; -static BNWORD64 *randp1 = randp, *randp2 = randp+24; - -static BNWORD64 -rand64(void) -{ - if (++randp2 == randp+55) { - randp2 = randp; - randp1++; - } else if (++randp1 == randp+55) { - randp1 = randp; - } - - return *randp1 += *randp2; -} - -/* - * CRC-3_2: x^3_2+x^26+x^23+x^22+x^1_6+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 - * - * The additive congruential RNG is seeded with a single integer, - * which is shuffled with a CRC polynomial to generate the initial - * table values. The Polynomial is the same size as the words being - * used. - * - * Thus, in the various versions of this library, we actually use this - * polynomial as-is, this polynomial mod x^17, and this polynomial with - * the leading coefficient deleted and replaced with x^6_4. As-is, - * it's irreducible, so it has a long period. Modulo x^17, it factors as - * (x^4+x^3+x^2+x+1) * (x^12+x^11+x^8+x^7+x^6+x^5+x^4+x^3+1), - * which still has a large enough period (4095) for the use it's put to. - * With the leading coefficient moved up, it factors as - * (x^50+x^49+x^48+x^47+x^46+x^43+x^41+x^40+x^38+x^37+x^36+x^35+x^34+x^33+ - * x^31+x^30+x^29+x^28+x^27+x^25+x^23+x^18+x^1_6+x^15+x^14+x^13+x^11+x^9+ - * x^8+x^7+x^6+x^5+x^3+x^2+1)*(x^11+x^10+x^9+x^5+x^4+x^3+1)*(x^3+x+1), - * which definitely has a long enough period to serve for initialization. - * - * The effort put into this PRNG is kind of unwarranted given the trivial - * use it's being put to, but oh, well. It does have the nice advantage - * of producing numbers that are portable between platforms, so if there's - * a problem with one platform, you can compare all the intermediate - * results with another platform. - */ -#define POLY (BNWORD64)0x04c11db7 - -static void -srand64(BNWORD64 seed) -{ - int i, j; - - for (i = 0; i < 55; i++) { - for (j = 0; j < 64; j++) - if (seed >> (64-1)) - seed = (seed << 1) ^ POLY; - else - seed <<= 1; - randp[i] = seed; - } - for (i = 0; i < 3*55; i ++) - rand64(); -} - -static void -randnum(BNWORD64 *num, unsigned len) -{ - while (len--) - BIGLITTLE(*--num,*num++) = rand64(); -} - -static void -bnprint64(BNWORD64 const *num, unsigned len) -{ - BIGLITTLE(num -= len, num += len); - - while (len--) - ZRTP_LOG(3, (_ZTU_, "%0*lX", 64/4, (unsigned long)BIGLITTLE(*num++,*--num))); -} - -static void -bnput64(char const *prompt, BNWORD64 const *num, unsigned len) -{ - fputs(prompt, stdout); - bnprint64(num, len); - putchar('\n'); -} - -/* - * One of our tests uses a known prime. The following selections were - * taken from the tables at the end of Hans Reisel's "Prime Numbers and - * Computer Methods for Factorization", second edition - an excellent book. - * (ISBN 0-8176-3743-5 ISBN 3-71283-3743-5) - */ -#if 0 -/* P31=1839605 17620282 38179967 87333633 from the factors of 3^256+2^256 */ -static unsigned char const prime[] = { - 0x17,0x38,0x15,0xBC,0x8B,0xBB,0xE9,0xEF,0x01,0xA9,0xFD,0x3A,0x01 -}; -#elif 0 -/* P48=40554942 04557502 46193993 36199835 4279613_2 73199617 from the same */ -static unsigned char const prime[] = { - 0x47,0x09,0x77,0x07,0xCF,0xFD,0xE1,0x54,0x3E,0x24, - 0xF7,0xF1,0x7A,0x3E,0x91,0x51,0xCC,0xC7,0xD4,0x01 -}; -#elif 0 -/* - * P75 = 450 552871280 97906895 47687014 5808213_2 - * 05219565 99525911 399679128 66003_258 91979521 - * from the factors of 4^128+3+128 - * (The "026" and "062" are to prevent a Bad String from appearing here.) - */ -static unsigned char const prime[] = { - 0xFF,0x00,0xFF,0x00,0xFF,0x01,0x06,0x4F,0xF8,0xED, - 0xA3,0x37,0x23,0x2A,0x04,0xEA,0xF9,0x5F,0x30,0x4C, - 0xAE,0xCD, 026,0x4E, 062,0x10,0x04,0x7D,0x0D,0x79, - 0x01 -}; -#else -/* - * P75 = 6128 85659796 45277755 9123_2190 67300940 - * 51844953 78793489 59444670 35675855 57440257 - * from the factors of 5^128+4^128 - * (The "026" is to prevent a Bad String from appearing here.) - */ -static unsigned char const prime[] = { - 0x01,0x78,0x4B,0xA5,0xD3,0x30,0x03,0xEB,0x73,0xE6, - 0x0F,0x4E,0x31,0x7D,0xBC,0xE2,0xA0,0xD4, 026,0x3F, - 0x3C,0xEA,0x1B,0x44,0xAD,0x39,0xE7,0xE5,0xAD,0x19, - 0x67,0x01 -}; -#endif - -static int -usage(char const *name) -{ - ZRTP_LOG(3, (_ZTU_, "Usage: %s [modbits [expbits [expbits2]]" -"With no arguments, just runs test suite. If modbits is given, runs\n" -"quick validation test, then runs timing tests of modular exponentiation.\n" -"If expbits is given, it is used as an exponent size, otherwise it defaults\n" -"to the same as modbits. If expbits2 is given it is used as the second\n" -"exponent size in the double-exponentiation tests, otherwise it defaults\n" -"to the same as expbits. All are limited to %u bits.\n", - name, (unsigned)MAXBITS)); - return 1; -} - -/* for libzrtp support */ -int -bntest_main(int argc, char **argv) -{ - unsigned i, j, k, l, m; - int z; - BNWORD64 t, carry, borrow; - BNWORD64 a[SIZE], b[SIZE], c[SIZE], d[SIZE]; - BNWORD64 e[SIZE], f[SIZE]; - static BNWORD64 entries[sizeof(prime)*2][(sizeof(prime)-1)/(64/8)+1]; - BNWORD64 *array[sizeof(prime)*2]; - unsigned long modbits = 0, expbits = 0, expbits2 = 0; - char *p; -#define A BIGLITTLE((a+SIZE),a) -#define B BIGLITTLE((b+SIZE),b) -#define C BIGLITTLE((c+SIZE),c) -#define D BIGLITTLE((d+SIZE),d) -#define E BIGLITTLE((e+SIZE),e) -#define F BIGLITTLE((f+SIZE),f) - static unsigned const smallprimes[] = { - 2, 3, 5, 7, 11, 13, 17, 19, 23, 27, 29, 31, 37, 41, 43 - }; - - /* Set up array for precomputed modexp */ - for (i = 0; i < sizeof(array)/sizeof(*array); i++) - array[i] = entries[i] BIG(+ SIZE); - - srand64(1); - - puts(BIGLITTLE("Big-endian machine","Little-endian machine")); - - if (argc >= 2) { - modbits = strtoul(argv[1], &p, 0); - if (!modbits || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid modbits: %s", argv[1])); - return usage(argv[0]); - } - } - if (argc >= 3) { - expbits = strtoul(argv[2], &p, 0); - if (!expbits || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid expbits: %s", argv[2])); - return usage(argv[0]); - } - expbits2 = expbits; - } - if (argc >= 4) { - expbits2 = strtoul(argv[3], &p, 0); - if (!expbits2 || *p) { - ZRTP_LOG(1, (_ZTU_, "Invalid expbits2: %s", argv[3])); - return usage(argv[0]); - } - } - if (argc >= 5) { - ZRTP_LOG(1, (_ZTU_, "Too many arguments: %s", argv[4])); - return usage(argv[0]); - } - -/* B is a nice not-so-little prime */ - lbnInsertBigBytes_64(B, prime, 0, sizeof(prime)); - ((unsigned char *)c)[0] = 0; - lbnInsertBigBytes_64(B, (unsigned char *)c, sizeof(prime), 1); - lbnExtractBigBytes_64(B, (unsigned char *)c, 0, sizeof(prime)+1); - i = (sizeof(prime)-1)/(64/8)+1; /* Size of array in words */ - if (((unsigned char *)c)[0] || - memcmp(prime, (unsigned char *)c+1, sizeof(prime)) != 0) - { - ZRTP_LOG(3, (_ZTU_, "Input != output!: ")); - for (k = 0; k < sizeof(prime); k++) - ZRTP_LOG(3, (_ZTU_, "%02X ", prime[k])); - putchar('\n'); - for (k = 0; k < sizeof(prime)+1; k++) - ZRTP_LOG(3, (_ZTU_, "%02X ", ((unsigned char *)c)[k])); - putchar('\n'); - bnput64("p = ", B, i); - - } - - /* Timing test code - only if requested on the command line */ - if (modbits) { -#if CLOCK_AVAIL - timetype start, stop; - unsigned long cursec, expsec, twoexpsec, dblexpsec; - unsigned curms, expms, twoexpms, dblexpms; - - expsec = twoexpsec = dblexpsec = 0; - expms = twoexpms = dblexpms = 0; -#endif - - lbnCopy_64(C,B,i); - lbnSub1_64(C,i,1); /* C is exponent: p-1 */ - - puts("Testing modexp with a known prime. " - "All results should be 1."); - bnput64("p = ", B, i); - bnput64("p-1 = ", C, i); - z = lbnTwoExpMod_64(A, C, i, B, i); - if (z < 0) - goto nomem; - bnput64("2^(p-1) mod p = ", A, i); - for (j = 0; j < 10; j++) { - randnum(A,i); - (void)lbnDiv_64(D,A,i,B,i); - - bnput64("a = ", A, i); - z = lbnExpMod_64(D, A, i, C, i, B, i); - if (z < 0) - goto nomem; - bnput64("a^(p-1) mod p = ", D, i); - - z = lbnBasePrecompBegin_64(array, (sizeof(prime)*8+4)/5, 5, - A, i, B, i); - if (z < 0) - goto nomem; - BIGLITTLE(D[-1],D[0]) = -1; - z = lbnBasePrecompExp_64(D, (BNWORD64 const * const *)array, - 5, C, i, B, i); - if (z < 0) - goto nomem; - bnput64("a^(p-1) mod p = ", D, i); - - for (k = 0; k < 5; k++) { - randnum(E,i); - bnput64("e = ", E, i); - z = lbnExpMod_64(D, A, i, E, i, B, i); - if (z < 0) - goto nomem; - bnput64("a^e mod p = ", D, i); - z = lbnBasePrecompExp_64(D, (BNWORD64 const * const *)array, - 5, E, i, B, i); - if (z < 0) - goto nomem; - bnput64("a^e mod p = ", D, i); - } - } - - ZRTP_LOG(3, (_ZTU_, "\n" - "Timing exponentiations modulo a %d-bit modulus, i.e.\n" - "2^<%d> mod <%d> bits, <%d>^<%d> mod <%d> bits and\n" - "<%d>^<%d> * <%d>^<%d> mod <%d> bits", - (int)modbits, (int)expbits, (int)modbits, - (int)modbits, (int)expbits, (int)modbits, - (int)modbits, (int)expbits, (int)modbits, (int)expbits2, - (int)modbits)); - - i = ((int)modbits-1)/64+1; - k = ((int)expbits-1)/64+1; - l = ((int)expbits2-1)/64+1; - for (j = 0; j < 25; j++) { - randnum(A,i); /* Base */ - randnum(B,k); /* Exponent */ - randnum(C,i); /* Modulus */ - randnum(D,i); /* Base2 */ - randnum(E,l); /* Exponent */ - /* Clip bases and mod to appropriate number of bits */ - t = ((BNWORD64)2<<((modbits-1)%64)) - 1; - *(BIGLITTLE(A-i,A+i-1)) &= t; - *(BIGLITTLE(C-i,C+i-1)) &= t; - *(BIGLITTLE(D-i,D+i-1)) &= t; - /* Make modulus large (msbit set) and odd (lsbit set) */ - *(BIGLITTLE(C-i,C+i-1)) |= (t >> 1) + 1; - BIGLITTLE(C[-1],C[0]) |= 1; - - /* Clip exponent to appropriate number of bits */ - t = ((BNWORD64)2<<((expbits-1)%64)) - 1; - *(BIGLITTLE(B-k,B+k-1)) &= t; - /* Make exponent large (msbit set) */ - *(BIGLITTLE(B-k,B+k-1)) |= (t >> 1) + 1; - /* The same for exponent 2 */ - t = ((BNWORD64)2<<((expbits2-1)%64)) - 1; - *(BIGLITTLE(E-l,E+l-1)) &= t; - *(BIGLITTLE(E-l,E+l-1)) |= (t >> 1) + 1; - - m = lbnBits_64(A, i); - if (m > (unsigned)modbits) { - bnput64("a = ", a, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be <= %d", m, (int)modbits)); - } - m = lbnBits_64(B, k); - if (m != (unsigned)expbits) { - bnput64("b = ", b, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)expbits)); - } - m = lbnBits_64(C, i); - if (m != (unsigned)modbits) { - bnput64("c = ", c, k); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)modbits)); - } - m = lbnBits_64(D, i); - if (m > (unsigned)modbits) { - bnput64("d = ", d, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be <= %d", m, (int)modbits)); - } - m = lbnBits_64(E, l); - if (m != (unsigned)expbits2) { - bnput64("e = ", e, i); - ZRTP_LOG(3, (_ZTU_, "%u bits, should be %d", m, (int)expbits2)); - } -#if CLOCK_AVAIL - gettime(&start); -#endif - z = lbnTwoExpMod_64(A, B, k, C, i); - if (z < 0) - goto nomem; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - twoexpsec += cursec = sec(stop); - twoexpms += curms = msec(stop); - - ZRTP_LOG(3, (_ZTU_, "2^<%d>:%4lu.%03u ", (int)expbits, cursec, curms)); -#else - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> ", (int)modbits, (int)expbits)); -#endif - fflush(stdout); - -#if CLOCK_AVAIL - gettime(&start); -#endif - z = lbnExpMod_64(A, A, i, B, k, C, i); - if (z < 0) - goto nomem; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - expsec += cursec = sec(stop); - expms += curms = msec(stop); - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>:%4lu.%03u ",(int)modbits, (int)expbits, cursec, curms)); - fflush(stdout); - - gettime(&start); - z = lbnDoubleExpMod_64(D, A, i, B, k, D, i, E, l,C,i); - if (z < 0) - goto nomem; - gettime(&stop); - subtime(stop, start); - dblexpsec += cursec = sec(stop); - dblexpms += curms = msec(stop); - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>*<%d>^<%d>:%4lu.%03u", - (int)modbits, (int)expbits, - (int)modbits, (int)expbits2, - cursec, curms)); -#else - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d>*<%d>^<%d>", - (int)modbits, (int)expbits, - (int)modbits, (int)expbits2)); -#endif - } -#if CLOCK_AVAIL - twoexpms += (twoexpsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "2^<%d> mod <%d> bits AVERAGE: %4lu.%03u s", - (int)expbits, (int)modbits, twoexpsec/j, twoexpms/j)); - expms += (expsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> mod <%d> bits AVERAGE: %4lu.%03u s", - (int)modbits, (int)expbits, (int)modbits, expsec/j, expms/j)); - dblexpms += (dblexpsec % j) * 1000; - ZRTP_LOG(3, (_ZTU_, "<%d>^<%d> * <%d>^<%d> mod <%d> bits AVERAGE:" - " %4lu.%03u s", - (int)modbits, (int)expbits, (int)modbits, - (int)expbits2, - (int)modbits, dblexpsec/j, dblexpms/j)); - - putchar('\n'); -#endif - } - - puts("Beginning 1000 interations of sanity checking.\n" - "Any output indicates a bug. No output is very strong\n" - "evidence that all the important low-level bignum routines\n" - "are working properly.\n"); - - /* - * If you change this loop to have an iteration 0, all results - * are primted on that iteration. Useful to see what's going - * on in case of major wierdness, but it produces a *lot* of - * output. - */ -#if (ZRTP_PLATFORM == ZP_WINCE) || (ZRTP_PLATFORM == ZP_SYMBIAN) - for (j = 1; j <= 20; j++) { -#else - for (j = 1; j <= 1000; j++) { -#endif -/* Do the tests for lots of different number sizes. */ - for (i = 1; i <= SIZE/2; i++) { - /* Make a random number i words long */ - do { - randnum(A,i); - } while (lbnNorm_64(A,i) < i); - - /* Checl lbnCmp - does a == a? */ - if (lbnCmp_64(A,A,i) || !j) { - bnput64("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "(a <=> a) = %d", lbnCmp_64(A,A,i))); - } - - memcpy(c, a, sizeof(a)); - - /* Check that the difference, after copy, is good. */ - if (lbnCmp_64(A,C,i) || !j) { - bnput64("a = ", A, i); - bnput64("c = ", C, i); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_64(A,C,i))); - } - - /* Generate a non-zero random t */ - do { - t = rand64(); - } while (!t); - - /* - * Add t to A. Check that: - * - lbnCmp works in both directions, and - * - A + t is greater than A. If there was a carry, - * the result, less the carry, should be *less* - * than A. - */ - carry = lbnAdd1_64(A,i,t); - if (lbnCmp_64(A,C,i) + lbnCmp_64(C,A,i) != 0 || - lbnCmp_64(A,C,i) != (carry ? -1 : 1) || !j) - { - bnput64("c = ", C, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - bnput64("a = c+t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "carry = %lX", (unsigned long)carry)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_64(A,C,i))); - ZRTP_LOG(3, (_ZTU_, "(c <=> a) = %d", lbnCmp_64(C,A,i))); - } - - /* Subtract t again */ - memcpy(d, a, sizeof(a)); - borrow = lbnSub1_64(A,i,t); - - if (carry != borrow || lbnCmp_64(A,C,i) || !j) { - bnput64("a = ", C, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - lbnAdd1_64(A,i,t); - bnput64("a += t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - lbnSub1_64(A,i,t); - bnput64("a -= t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_64(A,C,i))); - } - - /* Generate a random B */ - do { - randnum(B,i); - } while (lbnNorm_64(B,i) < i); - - carry = lbnAddN_64(A,B,i); - memcpy(d, a, sizeof(a)); - borrow = lbnSubN_64(A,B,i); - - if (carry != borrow || lbnCmp_64(A,C,i) || !j) { - bnput64("a = ", C, i); - bnput64("b = ", B, i); - bnput64("a += b = ", D, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - bnput64("a -= b = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_64(A,C,i))); - } - - /* D = B * t */ - lbnMulN1_64(D, B, i, t); - memcpy(e, d, sizeof(e)); - /* D = A + B * t, "carry" is overflow */ - borrow = *(BIGLITTLE(D-i-1,D+i)) += lbnAddN_64(D,A,i); - - carry = lbnMulAdd1_64(A, B, i, t); - - /* Did MulAdd get the same answer as mul then add? */ - if (carry != borrow || lbnCmp_64(A, D, i) || !j) { - bnput64("a = ", C, i); - bnput64("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "t = %lX", (unsigned long)t)); - bnput64("e = b * t = ", E, i+1); - bnput64(" a + e = ", D, i+1); - bnput64("a + b * t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "carry = %lX", (unsigned long)carry)); - } - - memcpy(d, a, sizeof(a)); - borrow = lbnMulSub1_64(A, B, i, t); - - /* Did MulSub perform the inverse of MulAdd */ - if (carry != borrow || lbnCmp_64(A,C,i) || !j) { - bnput64(" a = ", C, i); - bnput64(" b = ", B, i); - bnput64("a += b*t = ", D, i); - ZRTP_LOG(3, (_ZTU_, "Carry = %lX", (unsigned long)carry)); - bnput64("a -= b*t = ", A, i); - ZRTP_LOG(3, (_ZTU_, "Borrow = %lX", (unsigned long)borrow)); - ZRTP_LOG(3, (_ZTU_, "(a <=> c) = %d", lbnCmp_64(A,C,i))); - bnput64("b*t = ", E, i+1); - } - /* At this point we're done with t, so it's scratch */ -#if 0 -/* Extra debug code */ - lbnMulN1_64(C, A, i, BIGLITTLE(B[-1],B[0])); - bnput64("a * b[0] = ", C, i+1); - for (k = 1; k < i; k++) { - carry = lbnMulAdd1_64(BIGLITTLE(C-k,C+k), A, i, - *(BIGLITTLE(B-1-k,B+k))); - *(BIGLITTLE(C-i-k,C+i+k)) = carry; - bnput64("a * b[x] = ", C, i+k+1); - } - - lbnMulN1_64(D, B, i, BIGLITTLE(A[-1],A[0])); - bnput64("b * a[0] = ", D, i+1); - for (k = 1; k < i; k++) { - carry = lbnMulAdd1_64(BIGLITTLE(D-k,D+k), B, i, - *(BIGLITTLE(A-1-k,A+k))); - *(BIGLITTLE(D-i-k,D+i+k)) = carry; - bnput64("b * a[x] = ", D, i+k+1); - } -#endif - /* Does Mul work both ways symmetrically */ - lbnMul_64(C,A,i,B,i); - lbnMul_64(D,B,i,A,i); - if (lbnCmp_64(C,D,i+i) || !j) { - bnput64("a = ", A, i); - bnput64("b = ", B, i); - bnput64("a * b = ", C, i+i); - bnput64("b * a = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "(a*b <=> b*a) = %d", lbnCmp_64(C,D,i+i))); - } - /* Check multiplication modulo some small things */ - /* 30030 = 2*3*5*11*13 */ - k = lbnModQ_64(C, i+i, 30030); - for (l = 0; - l < sizeof(smallprimes)/sizeof(*smallprimes); - l++) - { - m = smallprimes[l]; - t = lbnModQ_64(C, i+i, m); - carry = lbnModQ_64(A, i, m); - borrow = lbnModQ_64(B, i, m); - if (t != (carry * borrow) % m) { - bnput64("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "a mod %u = %u", m, (unsigned)carry)); - bnput64("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "b mod %u = %u", m, (unsigned)borrow)); - bnput64("a*b = ", C, i+i); - ZRTP_LOG(3, (_ZTU_, "a*b mod %u = %u", m, (unsigned)t)); - ZRTP_LOG(3, (_ZTU_, "expected %u", (unsigned)((carry*borrow)%m))); - } - /* Verify that (C % 30030) % m == C % m */ - if (m <= 13 && t != k % m) { - ZRTP_LOG(3, (_ZTU_, "c mod 30030 = %u mod %u= %u", k, m, k%m)); - ZRTP_LOG(3, (_ZTU_, "c mod %u = %u", m, (unsigned)t)); - } - } - - /* Generate an F less than A and B */ - do { - randnum(F,i); - } while (lbnCmp_64(F,A,i) >= 0 || - lbnCmp_64(F,B,i) >= 0); - - /* Add F to D (remember, D = A*B) */ - lbnAdd1_64(BIGLITTLE(D-i,D+i), i, lbnAddN_64(D, F, i)); - memcpy(c, d, sizeof(d)); - - /* - * Divide by A and check that quotient and remainder - * match (remainder should be F, quotient should be B) - */ - t = lbnDiv_64(E,C,i+i,A,i); - if (t || lbnCmp_64(E,B,i) || lbnCmp_64(C, F, i) || !j) { - bnput64("a = ", A, i); - bnput64("b = ", B, i); - bnput64("f = ", F, i); - bnput64("a * b + f = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "qhigh = %lX", (unsigned long)t)); - bnput64("(a*b+f) / a = ", E, i); - bnput64("(a*b+f) % a = ", C, i); - } - - memcpy(c, d, sizeof(d)); - - /* Divide by B and check similarly */ - t = lbnDiv_64(E,C,i+i,B,i); - if (lbnCmp_64(E,A,i) || lbnCmp_64(C, F, i) || !j) { - bnput64("a = ", A, i); - bnput64("b = ", B, i); - bnput64("f = ", F, i); - bnput64("a * b + f = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "qhigh = %lX", (unsigned long)t)); - bnput64("(a*b+f) / b = ", E, i); - bnput64("(a*b+f) % b = ", C, i); - } - - /* Check that A*A == A^2 */ - lbnMul_64(C,A,i,A,i); - lbnSquare_64(D,A,i); - if (lbnCmp_64(C,D,i+i) || !j) { - bnput64("a*a = ", C, i+i); - bnput64("a^2 = ", D, i+i); - ZRTP_LOG(3, (_ZTU_, "(a * a == a^2) = %d", lbnCmp_64(C,D,i+i))); - } - - /* Compute a GCD */ - lbnCopy_64(C,A,i); - lbnCopy_64(D,B,i); - z = lbnGcd_64(C, i, D, i, &k); - if (z < 0) - goto nomem; - /* z = 1 if GCD in D; z = 0 if GCD in C */ - - /* Approximate check that the GCD came out right */ - for (l = 0; - l < sizeof(smallprimes)/sizeof(*smallprimes); - l++) - { - m = smallprimes[l]; - t = lbnModQ_64(z ? D : C, k, m); - carry = lbnModQ_64(A, i, m); - borrow = lbnModQ_64(B, i, m); - if (!t != (!carry && !borrow)) { - bnput64("a = ", A, i); - ZRTP_LOG(3, (_ZTU_, "a mod %u = %u", m, (unsigned)carry)); - bnput64("b = ", B, i); - ZRTP_LOG(3, (_ZTU_, "b mod %u = %u", m, (unsigned)borrow)); - bnput64("gcd(a,b) = ", z ? D : C, k); - ZRTP_LOG(3, (_ZTU_, "gcd(a,b) mod %u = %u", m, (unsigned)t)); - } - } - - - /* - * Do some Montgomery operations - * Start with A > B, and also place a copy of B into C. - * Then make A odd so it can be a Montgomery modulus. - */ - if (lbnCmp_64(A, B, i) < 0) { - memcpy(c, a, sizeof(c)); - memcpy(a, b, sizeof(a)); - memcpy(b, c, sizeof(b)); - } else { - memcpy(c, b, sizeof(c)); - } - BIGLITTLE(A[-1],A[0]) |= 1; - - /* Convert to and from */ - lbnToMont_64(B, i, A, i); - lbnFromMont_64(B, A, i); - if (lbnCmp_64(B, C, i)) { - memcpy(b, c, sizeof(c)); - bnput64("mod = ", A, i); - bnput64("input = ", B, i); - lbnToMont_64(B, i, A, i); - bnput64("mont = ", B, i); - lbnFromMont_64(B, A, i); - bnput64("output = ", B, i); - } - /* E = B^5 (mod A), no Montgomery ops */ - lbnSquare_64(E, B, i); - (void)lbnDiv_64(BIGLITTLE(E-i,E+i),E,i+i,A,i); - lbnSquare_64(D, E, i); - (void)lbnDiv_64(BIGLITTLE(D-i,D+i),D,i+i,A,i); - lbnMul_64(E, D, i, B, i); - (void)lbnDiv_64(BIGLITTLE(E-i,E+i),E,i+i,A,i); - - /* D = B^5, using ExpMod */ - BIGLITTLE(F[-1],F[0]) = 5; - z = lbnExpMod_64(D, B, i, F, 1, A, i); - if (z < 0) - goto nomem; - if (lbnCmp_64(D, E, i) || !j) { - bnput64("mod = ", A, i); - bnput64("input = ", B, i); - bnput64("input^5 = ", E, i); - bnput64("input^5 = ", D, i); - ZRTP_LOG(3, (_ZTU_, "a>b (x <=> y) = %d", lbnCmp_64(D,E,i))); - } - /* TODO: Test lbnTwoExpMod, lbnDoubleExpMod */ - } /* for (i) */ - ZRTP_LOG(3, (_ZTU_, "\r%d ", j)); - fflush(stdout); - } /* for (j) */ - ZRTP_LOG(3, (_ZTU_, "%d iterations of up to %d 64-bit words completed.", j-1, i-1)); - return 0; -nomem: - ZRTP_LOG(3, (_ZTU_, "Out of memory")); - return 1; -} diff --git a/libs/libzrtp/third_party/bnlib/bootstrap.sh b/libs/libzrtp/third_party/bnlib/bootstrap.sh deleted file mode 100755 index 93030be3f6..0000000000 --- a/libs/libzrtp/third_party/bnlib/bootstrap.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -aclocal -autoconf - diff --git a/libs/libzrtp/third_party/bnlib/cfg b/libs/libzrtp/third_party/bnlib/cfg deleted file mode 100755 index a88548a582..0000000000 --- a/libs/libzrtp/third_party/bnlib/cfg +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 1995 Colin Plumb. All rights reserved. -# For licensing and other legal details, see the file legal.c. -# -./configure CFLAGS="$CFLAGS -O3 -g0 -W -Wall" diff --git a/libs/libzrtp/third_party/bnlib/cfg.debug b/libs/libzrtp/third_party/bnlib/cfg.debug deleted file mode 100755 index 58992bc9d6..0000000000 --- a/libs/libzrtp/third_party/bnlib/cfg.debug +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 1995 Colin Plumb. All rights reserved. -# For licensing and other legal details, see the file legal.c. -# -./configure CFLAGS="$CFLAGS -O0 -g3" diff --git a/libs/libzrtp/third_party/bnlib/configure.ac b/libs/libzrtp/third_party/bnlib/configure.ac deleted file mode 100644 index 67dc10f86a..0000000000 --- a/libs/libzrtp/third_party/bnlib/configure.ac +++ /dev/null @@ -1,271 +0,0 @@ -dnl Copyright (c) 1995 Colin Plumb. All rights reserved. -dnl For licensing and other legal details, see the file legal.c. -dnl -dnl This file in input to autoconf. It consists of a series of m4 -dnl macros which expand to produce the shell script "configure". -dnl Anything which is not an m4 macro is copied directly to the output. -dnl -dnl Start things up. If the specified file doesn't exist, configure -dnl will complain. -AC_INIT([libbn], [0.1]) - -dnl The following tests need to know that we intend to produce a config.h -dnl file, even though this won't expand to any shell script code until -dnl AC_OUTPUT time. Name it bnconfig.hin to avoid MS-LOSS. -AC_CONFIG_HEADER(bnconfig.h:bnconfig.hin) - -dnl Checks for programs. - -# Find a compiler to use. -# Check 1) The $CC environment varaible, 2) egcc, 3) gcc, 4) acc, and 5) cc. -dnl This used to be just AC-CHECK-PROGS(CC, gcc acc, cc), but... -# This deals with brain-damaged Sun systems that place a bogus cc or -# acc executable in the $PATH, which just prints an error and exit. -# We deal with this by actually trying to compile a trivial test program. -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - AC_MSG_CHECKING(For C compiler (cached)) - CC="$ac_cv_prog_CC" - AC_MSG_RESULT($CC) -elif test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. - AC_MSG_CHECKING(For C compiler) - AC_MSG_RESULT($CC) -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - echo 'main(){return 0;}' > conftest.$ac_ext - for ac_prog in egcc gcc acc cc; do -# Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 - AC_MSG_CHECKING(for $ac_word) - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -x "$ac_dir/$ac_word"; then - CC="$ac_prog" - if eval $ac_compile; then - ac_cv_prog_CC="$ac_prog" - fi - break - fi - done - CC="$ac_cv_prog_CC" - if test -n "$CC"; then - AC_MSG_RESULT($ac_dir/$CC) - break; - fi - AC_MSG_RESULT(no) - done - if test ! -n "$CC"; then - AC_MSG_ERROR(no C compiler found) - fi - IFS="$ac_save_ifs" - rm -f conftest* -fi -AC_SUBST(CC) - -AC_CACHE_CHECK(whether we are using GNU CC, ac_cv_prog_gcc, -[dnl The semicolon is to pacify NeXT's syntax-checking cpp. -cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if ${CC-cc} -E conftest.c 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi]) - -if test $ac_cv_prog_gcc = yes; then - if test "${CFLAGS+set}" != set; then -AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_gcc_g, -[echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_gcc_g=yes -else - ac_cv_prog_gcc_g=no -fi -rm -f conftest* -]) - fi - - # If we're using GCC, perform some Deep Magic to enable the result to - # link cleanly with code compiled with a compiler that doesn't understand - # GCC's support library (-lgcc). Do a link, to relocatable object form, - # with just -lgcc. If it's not GCC, do the normal -c thing. - # These substitutions are used in the Makefile to force that behaviour. - GCCMAGIC1='-Wl,-r -nostdlib' - GCCMAGIC2=-lgcc -else - GCCMAGIC1=-c - GCCMAGIC2= -fi -# newer gcc on debian 9 doesn't support this, and we don't need it here as its an embedded lib so we will disable this explicitly -GCCMAGIC1=-c -GCCMAGIC2= -AC_SUBST(GCCMAGIC1) -AC_SUBST(GCCMAGIC2) - -# Now, figure out the CFLAGS we want. If the user didn't *ask* -# for CFLAGS, we're going to use some ideas of our own. -if test "${CFLAGS+set}" != set; then - -# First, remember one useful thing that was just figured out, -# namely whether the compiler can take -g with -O. (Most compilers -# seem to do the opposite of what I want here - if you give both, -g -# overrides and disables optimization.) This is only done for -# gcc at the moment, and the no/yes combination is possible but -# misleading -if test $ac_cv_prog_gcc$ac_cv_prog_gcc_g = yesyes; then - CFLAGS=-g -else - CFLAGS="" -fi - -# Now, the whole raison d'e^tre of this library is that it's *fast*. -# So we are *not* happy with autoconf's normal conservative compilation -# flags. Try to figure out what kind the compiler we're using and soup -# things up a bit. Also turn on warnings if possible. -# If it's GCC, crank up optimization to -O6, and try to add some -# -m options, too. -# Otherwise, it gets even more ad-hoc, but the test below works for the -# SunPro C compiler and cranks it up to maximum optimization. -dnl -dnl Note that the situation here is actually *worse* than the usual -dnl CPU-COMPANY-SYSTEM system type can detect, because it depends on -dnl the C compiler. For example, all of the options below (as of the -dnl time this is written) are available on a single machine! -dnl Using compiler-specific checks rather than config.guess seems -dnl entirely appropriate here. -AC_MSG_CHECKING(for useful tuning options (\$TUNE)) -if test $ac_cv_prog_gcc = yes; then - : ${WARN="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"} - if test "${TUNE+set}" != set; then - TUNE=-O6 - case `$CC -v 2>&1` in - *gcc-lib/sparc-*) - # Try to use the architecture-detecting tool with SunPro CC. - if bn_tune=`(fpversion -foption) 2>/dev/null`; then - if test "$bn_tune" = xcg92 || test "$bn_tune" = cg92; then - TUNE="$TUNE -mv8" - elif test "$bn_tune" != xcg89 && test "$bn_tune" != cg89; then - TUNE="$TUNE -mv8" - bn_tune_guess=yes - fi - else - TUNE="$TUNE -mv8" - bn_tune_guess=yes - fi - esac - fi -elif $CC -flags 2>&1 | grep SunSoft >/dev/null 2>&1; then - if test "${WARN+set}" != set; then - if $CC -flags 2>&1 | grep 'checking' | grep '^-vc' > /dev/null 2>&1; then - WARN=-vc - elif $CC -flags 2>&1 | grep 'checking' | grep '^-v ' > /dev/null 2>&1; then - WARN=-v - fi - if $CC -flags 2>&1 | grep '^-xstrconst' > /dev/null 2>&1; then - WARN="${WARN}${WARN+ }-xstrconst" - fi - fi - # SunPro C compiler - now grok version and platform - if test "${TUNE+set}" != set; then - if $CC -flags 2>&1 | grep '^-xO.*5' >/dev/null 2>&1; then - TUNE=-xO5 - else - TUNE=-xO4 - fi - # Architecture: -native iv avail., else as fpversion says, else guess -mv8 - if $CC -flags 2>&1 | grep '^-native' >/dev/null 2>&1; then - TUNE="$TUNE -native" - elif bn_tune=`(fpversion -foption) 2>/dev/null`; then - TUNE="$TUNE -$bn_tune" - elif $CC -flags 2>&1 | grep '^-xcg92' >/dev/null 2>&1; then - TUNE="$TUNE -xcg92" - bn_tune_guess=yes - fi - fi -fi -bn_tune_set=${TUNE+set} -# If nothing better is available, turn on -O -: ${TUNE=-O} -AC_MSG_RESULT(${TUNE-none}) -if test "$bn_tune_set" != set; then - AC_MSG_WARN(not optimizing heavily - try setting \$CFLAGS) -elif test "$bn_tune_guess" = yes; then - AC_MSG_WARN([architecture guessed. If incorrect, use explicit \$TUNE.]) -fi -AC_MSG_CHECKING(for useful warning options (\$WARN)) -AC_MSG_RESULT(${WARN-none}) -fi -# ^^ End of "$(CFLAGS+set)" != set condition -AC_SUBST(TUNE) -AC_SUBST(WARN) - -# Find "ranlib". Sone systems don't have or need ranlib. If so, -# ":" (do nothing) is used instead. -AC_PROG_RANLIB - -dnl Checks for libraries. -dnl (we don't have any) - -dnl Checks for header files. -AC_HEADER_STDC - -if test $ac_cv_header_stdc = yes; then - AC_DEFINE(HAVE_ASSERT_H) - AC_DEFINE(HAVE_LIMITS_H) - AC_DEFINE(HAVE_STDLIB_H) - AC_DEFINE(HAVE_STRING_H) - -else # If non-ANSI, check for other brokenness. - -AC_CHECK_HEADERS(assert.h limits.h stdlib.h string.h) - -fi -# ^^ End of non-ANSI header brokenness tests (first part) - -# Check that we have <sys/time.h> explicitly. -AC_CHECK_HEADERS(sys/time.h) -AC_HEADER_TIME - -dnl Checks for typedefs, structures, and compiler characteristics. -# Verify that the compiler supports const, and that it works. -# A number of compilers sort of support const, but they have bugs -# that will prevent valid programs from compiling. -AC_C_CONST - -# See if we have size_t. (If not, define it as unsigned.) -AC_TYPE_SIZE_T - -dnl Checks for library functions. -AC_CHECK_FUNCS(clock_gettime gethrvtime getrusage) -dnl The following are for real-time clocks only as of yet. -dnl AC_CHECK_FUNCS(clock_getres gethrtime gettimeofday getitimer setitimer ftime) - -# If we don't have ANSI C, see if a few functions are missing that -# we've noticed the lack of before. -if test $ac_cv_header_stdc = yes; then - AC_DEFINE(HAVE_CLOCK) - AC_DEFINE(HAVE_TIME) - AC_DEFINE(HAVE_MEMMOVE) - AC_DEFINE(HAVE_MEMCPY) -else -AC_CHECK_FUNCS(clock time memmove memcpy) -fi -# ^^ End of non-ANSI header brokenness tests (second part) - -# libzrtp - fix it back -#AC_OUTPUT_SUBDIRS(test) - -# The big bang! Produce the output files. This is config.cache, and -# config.status, which builds the config.h file and a long list of -# Makefiles. -dnl The value specified to AC_CONFIG_HEADER at the top if the file is -dnl used here to produce bnconfig.h. -AC_OUTPUT(Makefile) - -echo -echo bnlib is now configured for a generic installation. -echo If you with assembly-language support, edit the Makefile according -echo to the instructions in README.bn. diff --git a/libs/libzrtp/third_party/bnlib/cputime.h b/libs/libzrtp/third_party/bnlib/cputime.h deleted file mode 100644 index 37bef8c877..0000000000 --- a/libs/libzrtp/third_party/bnlib/cputime.h +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef CPUTIME_H -#define CPUTIME_H - -/* - * Figure out what clock to use. Each possibility can be specifically - * enabled or disabled by predefining USE_XXX to 1 or 0. For some, - * the code attempts to detect availability automatically. If the - * Symbols HAVE_XXX are defined, they are used. If not, they are - * set to reasonable default assumptions while further conditions - * are checked. The choices, and the ways they are auto-detected are: - * - gethrvtime(), if HAVE_GETHRVTIME is set to 1. - * - clock_gettime(CLOCK_VIRTUAL,...), if CLOCK_VIRTUAL is defined in <time.h> - * - getrusage(RUSAGE_SELF,...), if RUSAGE_SELF is defined in <sys/resource.h> - * - clock(), if CLOCKS_PER_SEC or CLK_TCK are defined in <time.h> - * - time(), unless specifically disabled. - * - * The symbol CLOCK_AVAIL is given a value of 1 if a clock is found. - * The following are then available: - * timetype (typedef): the type needed to hold a clock value. - * gettime(t) (macro): A function that gets passed a timetype *. - * subtime(d,s) (macro): Sets d -= s, essentially. - * msec(t) (macro): Given a timetype, return the number of milliseconds - * in it, as an unsigned integer between 0 and 999. - * sec(t) (macro): Given a timetype, return the number of seconds in it, - * as an unsigned long integer. - * - * This is written to accomocate a number of crufy old preprocessors that: - * - Emit annoying warnings if you use "#if NOT_DEFINED". - * (Workaround: #ifndef FOO / #define FOO 0 / #endif) - * - Emit annoying warnings if you #undef something not defined. - * (Workaround: #ifdef FOO / #undef FOO / #endif) - * - Don't like spaces in "# define" and the like. - * (Workaround: harder-to-read code with no indentation.) - */ - -/* We expect that our caller has already #included "bnconfig.h" if possible. */ - -#ifndef unix -#define unix 0 -#endif -#ifndef __unix -#define __unix 0 -#endif -#ifndef __unix__ -#define __unix__ 0 -#endif - -#ifdef UNIX -/* Nothing */ -#elif unix -#define UNIX 1 -#elif __unix -#define UNIX 1 -#elif __unix__ -#define UNIX 1 -#endif - -#ifndef UNIX -#define UNIX 0 -#endif - -#ifndef TIME_WITH_SYS_TIME -#define TIME_WITH_SYS_TIME 1 /* Assume true if not told */ -#endif -#ifndef HAVE_SYS_TIME_H -#define HAVE_SYS_TIME_H 1 /* Assume true if not told */ -#endif - -/* - * Include <time.h> unless that would prevent us from later including - * <sys/time.h>, in which case include *that* immediately. - */ -#if TIME_WITH_SYS_TIME -#include <time.h> -#elif HAVE_SYS_TIME_H -#include <sys/time.h> -#else -#include <time.h> -#endif - -/* Do we want to use gethrvtime() (a Solaris special?) */ -#ifndef USE_GETHRVTIME -#ifdef HAVE_GETHRVTIME -#define USE_GETHRVTIME HAVE_GETHRVTIME -#else -#define USE_GETHRVTIME 0 -#endif -#endif - -/* If we do want to use gethrvtime(), define the functions */ -#if USE_GETHRVTIME -#define CLOCK_AVAIL 1 -typedef hrtime_t timetype; -#define gettime(t) *(t) = gethrvtime() -#define subtime(d,s) d -= s -#define msec(t) (unsigned)((t/1000000)%1000) -#define sec(t) (unsigned long)(t/1000000000) - -#else /* !USE_GETHRVTIME, extends to end of file */ - -/* Do we want to use clock_gettime()? */ -#ifndef USE_CLOCK_GETTIME -#ifndef HAVE_CLOCK_GETTIME -#define HAVE_CLOCK_GETTIME 1 /* Assume the CLOCK_VIRTUAL test will catch */ -#endif -/* - * It turns out to be non-ANSI to use the apparently simpler construct - * "#define USE_CLOCK_GETTIME defined(CLOCK_VIRTUAL)", since - * "If the token defined is generated as a result of this replacement - * process or use of the defined unary operator does not match one - * of the two specified forms prior ro macro replacement, the behaviour - * is undefined." (ANSI/ISO 9899-1990 section 6.8.1) - * In practice, it breaks the DEC Alpha compiler. - */ -#if HAVE_CLOCK_GETTIME -#ifdef CLOCK_VIRTUAL -#define USE_CLOCK_GETTIME 1 -#endif -#endif -#endif - -/* If we do want to use clock_gettime(), define the necessary functions */ -#if USE_CLOCK_GETTIME -#define CLOCK_AVAIL 1 -typedef struct timespec timetype; -#define gettime(t) clock_gettime(CLOCK_VIRTUAL, t) -#define subtime(d,s) \ - d.tv_sec -= s.tv_sec + (d.tv_nsec >= s.tv_nsec ? \ - (d.tv_nsec -= s.tv_nsec, 0) : \ - (d.tv_nsec += 1000000000-s.tv_nsec, 1)) -#define msec(t) (unsigned)(t.tv_nsec/1000000) -#define sec(t) (unsigned long)(t.tv_sec) - -#else /* !USE_CLOCK_GETTIME, extends to end of file */ - -#if UNIX -#ifndef HAVE_GETRUSAGE -#define HAVE_GETRUSAGE 1 -#endif -#endif /* UNIX */ - -/* Do we want to use getrusage()? */ -#if HAVE_GETRUSAGE -#if TIME_WITH_SYS_TIME -#ifndef HAVE_SYS_TIME_H /* If it's not defined */ -#include <sys/time.h> -#elif HAVE_SYS_TIME_H /* Or it's defined true */ -#include <sys/time.h> -#endif -#endif /* TIME_WITH_SYS_TIME */ -#include <sys/resource.h> - -#ifdef RUSAGE_SELF -#undef USE_GETRUSAGE -#define USE_GETRUSAGE 1 -#endif -#endif /* HAVE_GETRUSAGE */ - -/* If we do want to use getrusage(), define the necessary functions */ -#if USE_GETRUSAGE -#define CLOCK_AVAIL 1 -typedef struct rusage timetype; -#define gettime(t) getrusage(RUSAGE_SELF, t); -#define subtime(d, s) \ - d.ru_utime.tv_sec -= s.ru_utime.tv_sec + \ - (d.ru_utime.tv_usec >= s.ru_utime.tv_usec ? \ - (d.ru_utime.tv_usec -= s.ru_utime.tv_usec, 0) : \ - (d.ru_utime.tv_usec += 1000000-s.ru_utime.tv_usec, 1)) -#define msec(t) (unsigned)(t.ru_utime.tv_usec/1000) -#define sec(t) (unsigned long)(t.ru_utime.tv_sec) - -#else /* !USE_GETRUSAGE, extends to end of file */ - -#ifndef HAVE_CLOCK -#define HAVE_CLOCK 1 -#endif - -#if HAVE_CLOCK -#ifndef CLOCKS_PER_SEC -#ifdef CLK_TCK -#define CLOCKS_PER_SEC CLK_TCK -#endif -#endif /* !defined(CLOCKS_PER_SEC) */ - -#ifndef USE_CLOCK -#ifdef CLOCKS_PER_SEC -#define USE_CLOCK 1 -#endif -#endif /* !defined(USE_CLOCK) */ -#endif /* HAVE_CLOCK */ - -/* If we want to use clock(), define the necessary functions */ -#if USE_CLOCK -#define CLOCK_AVAIL 1 -typedef clock_t timetype; -#define gettime(t) *(t) = clock() -#define subtime(d, s) d -= s -/* - * I don't like having to do floating point math. CLOCKS_PER_SEC is - * almost always an integer, and the most common non-integral case is - * the MS-DOS wierdness of 18.2. We have to be a bit careful with the - * casts, because ANSI C doesn't provide % with non-integral operands, - * but just to be extra annoying, some implementations define it as an - * integral-valued float. (E.g. Borland C++ 4.5 with 1000.0) - */ -#if ((unsigned)CLOCKS_PER_SEC == CLOCKS_PER_SEC) - /* Integer CLOCKS_PER_SEC */ - -#define sec(t) (unsigned long)(t/CLOCKS_PER_SEC) -#define msec(t) (unsigned)(t % (unsigned)CLOCKS_PER_SEC * 1000 / \ - (unsigned)CLOCKS_PER_SEC) -#elif (CLOCKS_PER_SEC == 18.2) - /* MS-DOS-ism */ - -#define sec(t) (unsigned long)(t*5 / 91) -#define msec(t) (unsigned)(t*5 % 91 * 1000 / 91) - -#else /* We are forced to muck with floating point.... */ - -#include <math.h> /* For floor() */ -#define sec(t) (unsigned long)(t/CLOCKS_PER_SEC) -#define msec(t) (unsigned)((t - sec(t)*CLOCKS_PER_SEC) * 1000 / CLOCKS_PER_SEC) - -#endif - -#else /* !USE_CLOCK, extends to end of file */ - -#ifndef HAVE_TIME -#define HAVE_TIME 1 -#endif - -#if HAVE_TIME -#ifndef USE_TIME -#define USE_TIME 1 -#endif -#endif - -#if USE_TIME -#define CLOCK_AVAIL 1 -typedef time_t timetype; -#define gettime(t) time(t) -#define subtime(d, s) d -= s -#define msec(t) (unsigned)0 -#define sec(t) (unsigned long)t - -#else /* !USE_TIME, extends to end of file */ - -#error No clock available. - -#endif /* USE_TIME */ -#endif /* USE_CLOCK */ -#endif /* USE_GETRUSAGE */ -#endif /* USE_CLOCK_GETTIME */ -#endif /* USE_GETHRVTIME */ - -#endif /*CPUTIME_H*/ diff --git a/libs/libzrtp/third_party/bnlib/germain.c b/libs/libzrtp/third_party/bnlib/germain.c deleted file mode 100644 index 4797680976..0000000000 --- a/libs/libzrtp/third_party/bnlib/germain.c +++ /dev/null @@ -1,608 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Sophie Germain prime generation using the bignum library and sieving. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#define BNDEBUG 1 -#ifndef BNDEBUG -#define BNDEBUG 0 -#endif -#if BNDEBUG -#include <stdio.h> -#endif - -#include "bn.h" -#include "germain.h" -#include "jacobi.h" -#include "lbnmem.h" /* For lbnMemWipe */ -#include "sieve.h" - -#include "kludge.h" - -/* Size of the sieve area (can be up to 65536/8 = 8192) */ -#define SIEVE 8192 - -static unsigned const confirm[] = {2, 3, 5, 7, 11, 13, 17}; -#define CONFIRMTESTS (sizeof(confirm)/sizeof(*confirm)) - -#if BNDEBUG -/* - * For sanity checking the sieve, we check for small divisors of the numbers - * we get back. This takes "rem", a partially reduced form of the prime, - * "div" a divisor to check for, and "order", a parameter of the "order" - * of Sophie Germain primes (0 = normal primes, 1 = Sophie Germain primes, - * 2 = 4*p+3 is also prime, etc.) and does the check. It just complains - * to stdout if the check fails. - */ -static void -germainSanity(unsigned rem, unsigned div, unsigned order) -{ - unsigned mul = 1; - - rem %= div; - if (!rem) - printf("bn div by %u!\n", div); - while (order--) { - rem += rem+1; - if (rem >= div) - rem -= div; - mul += mul; - if (!rem) - printf("%u*bn+%u div by %u!\n", mul, mul-1, div); - } -} -#endif /* BNDEBUG */ - -/* - * Helper function that does the slow primality test. - * bn is the input bignum; a, e and bn2 are temporary buffers that are - * allocated by the caller to save overhead. bn2 is filled with - * a copy of 2^order*bn+2^order-1 if bn is found to be prime. - * - * Returns 0 if both bn and bn2 are prime, >0 if not prime, and -1 on - * error (out of memory). If not prime, the return value is the number - * of modular exponentiations performed. Prints a '+' or '-' on the - * given FILE (if any) for each test that is passed by bn, and a '*' - * for each test that is passed by bn2. - * - * The testing consists of strong pseudoprimality tests, to the bases given - * in the confirm[] array above. (Also called Miller-Rabin, although that's - * not technically correct if we're using fixed bases.) Some people worry - * that this might not be enough. Number theorists may wish to generate - * primality proofs, but for random inputs, this returns non-primes with - * a probability which is quite negligible, which is good enough. - * - * It has been proved (see Carl Pomerance, "On the Distribution of - * Pseudoprimes", Math. Comp. v.37 (1981) pp. 587-593) that the number of - * pseudoprimes (composite numbers that pass a Fermat test to the base 2) - * less than x is bounded by: - * exp(ln(x)^(5/14)) <= P_2(x) ### CHECK THIS FORMULA - it looks wrong! ### - * P_2(x) <= x * exp(-1/2 * ln(x) * ln(ln(ln(x))) / ln(ln(x))). - * Thus, the local density of Pseudoprimes near x is at most - * exp(-1/2 * ln(x) * ln(ln(ln(x))) / ln(ln(x))), and at least - * exp(ln(x)^(5/14) - ln(x)). Here are some values of this function - * for various k-bit numbers x = 2^k: - * Bits Density <= Bit equivalent Density >= Bit equivalent - * 128 3.577869e-07 21.414396 4.202213e-37 120.840190 - * 192 4.175629e-10 31.157288 4.936250e-56 183.724558 - * 256 5.804314e-13 40.647940 4.977813e-75 246.829095 - * 384 1.578039e-18 59.136573 3.938861e-113 373.400096 - * 512 5.858255e-24 77.175803 2.563353e-151 500.253110 - * 768 1.489276e-34 112.370944 7.872825e-228 754.422724 - * 1024 6.633188e-45 146.757062 1.882404e-304 1008.953565 - * - * As you can see, there's quite a bit of slop between these estimates. - * In fact, the density of pseudoprimes is conjectured to be closer to the - * square of that upper bound. E.g. the density of pseudoprimes of size - * 256 is around 3 * 10^-27. The density of primes is very high, from - * 0.005636 at 256 bits to 0.001409 at 1024 bits, i.e. more than 10^-3. - * - * For those people used to cryptographic levels of security where the - * 56 bits of DES key space is too small because it's exhaustible with - * custom hardware searching engines, note that you are not generating - * 50,000,000 primes per second on each of 56,000 custom hardware chips - * for several hours. The chances that another Dinosaur Killer asteroid - * will land today is about 10^-11 or 2^-36, so it would be better to - * spend your time worrying about *that*. Well, okay, there should be - * some derating for the chance that astronomers haven't seen it yet, - * but I think you get the idea. For a good feel about the probability - * of various events, I have heard that a good book is by E'mile Borel, - * "Les Probabilite's et la vie". (The 's are accents, not apostrophes.) - * - * For more on the subject, try "Finding Four Million Large Random Primes", - * by Ronald Rivest, in Advancess in Cryptology: Proceedings of Crypto - * '90. He used a small-divisor test, then a Fermat test to the base 2, - * and then 8 iterations of a Miller-Rabin test. About 718 million random - * 256-bit integers were generated, 43,741,404 passed the small divisor - * test, 4,058,000 passed the Fermat test, and all 4,058,000 passed all - * 8 iterations of the Miller-Rabin test, proving their primality beyond - * most reasonable doubts. - * - * If the probability of getting a pseudoprime is some small p, then the - * probability of not getting it in t trials is (1-p)^t. Remember that, - * for small p, (1-p)^(1/p) ~ 1/e, the base of natural logarithms. - * (This is more commonly expressed as e = lim_{x\to\infty} (1+1/x)^x.) - * Thus, (1-p)^t ~ e^(-p*t) = exp(-p*t). So the odds of being able to - * do this many tests without seeing a pseudoprime if you assume that - * p = 10^-6 (one in a million) is one in 57.86. If you assume that - * p = 2*10^-6, it's one in 3347.6. So it's implausible that the density - * of pseudoprimes is much more than one millionth the density of primes. - * - * He also gives a theoretical argument that the chance of finding a - * 256-bit non-prime which satisfies one Fermat test to the base 2 is - * less than 10^-22. The small divisor test improves this number, and - * if the numbers are 512 bits (as needed for a 1024-bit key) the odds - * of failure shrink to about 10^-44. Thus, he concludes, for practical - * purposes *one* Fermat test to the base 2 is sufficient. - */ -static int -germainPrimeTest(struct BigNum const *bn, struct BigNum *bn2, struct BigNum *e, - struct BigNum *a, unsigned order, int (*f)(void *arg, int c), void *arg) -{ - int err; - unsigned i; - int j; - unsigned k, l, n; - -#if BNDEBUG /* Debugging */ - /* - * This is debugging code to test the sieving stage. - * If the sieving is wrong, it will let past numbers with - * small divisors. The prime test here will still work, and - * weed them out, but you'll be doing a lot more slow tests, - * and presumably excluding from consideration some other numbers - * which might be prime. This check just verifies that none - * of the candidates have any small divisors. If this - * code is enabled and never triggers, you can feel quite - * confident that the sieving is doing its job. - */ - i = bnLSWord(bn); - if (!(i % 2)) printf("bn div by 2!"); - i = bnModQ(bn, 51051); /* 51051 = 3 * 7 * 11 * 13 * 17 */ - germainSanity(i, 3, order); - germainSanity(i, 7, order); - germainSanity(i, 11, order); - germainSanity(i, 13, order); - germainSanity(i, 17, order); - i = bnModQ(bn, 63365); /* 63365 = 5 * 19 * 23 * 29 */ - germainSanity(i, 5, order); - germainSanity(i, 19, order); - germainSanity(i, 23, order); - germainSanity(i, 29, order); - i = bnModQ(bn, 47027); /* 47027 = 31 * 37 * 41 */ - germainSanity(i, 31, order); - germainSanity(i, 37, order); - germainSanity(i, 41, order); -#endif - /* - * First, check whether bn is prime. This uses a fast primality - * test which usually obviates the need to do one of the - * confirmation tests later. See prime.c for a full explanation. - * We check bn first because it's one bit smaller, saving one - * modular squaring, and because we might be able to save another - * when testing it. (1/4 of the time.) A small speed hack, - * but finding big Sophie Germain primes is *slow*. - */ - if (bnCopy(e, bn) < 0) - return -1; - (void)bnSubQ(e, 1); - l = bnLSWord(e); - - j = 1; /* Where to start in prime array for strong prime tests */ - - if (l & 7) { - bnRShift(e, 1); - if (bnTwoExpMod(a, e, bn) < 0) - return -1; - if ((l & 7) == 6) { - /* bn == 7 mod 8, expect +1 */ - if (bnBits(a) != 1) - return 1; /* Not prime */ - k = 1; - } else { - /* bn == 3 or 5 mod 8, expect -1 == bn-1 */ - if (bnAddQ(a, 1) < 0) - return -1; - if (bnCmp(a, bn) != 0) - return 1; /* Not prime */ - k = 1; - if (l & 4) { - /* bn == 5 mod 8, make odd for strong tests */ - bnRShift(e, 1); - k = 2; - } - } - } else { - /* bn == 1 mod 8, expect 2^((bn-1)/4) == +/-1 mod bn */ - bnRShift(e, 2); - if (bnTwoExpMod(a, e, bn) < 0) - return -1; - if (bnBits(a) == 1) { - j = 0; /* Re-do strong prime test to base 2 */ - } else { - if (bnAddQ(a, 1) < 0) - return -1; - if (bnCmp(a, bn) != 0) - return 1; /* Not prime */ - } - k = 2 + bnMakeOdd(e); - } - - - /* - * It's prime! Now check higher-order forms bn2 = 2*bn+1, 4*bn+3, - * etc. Since bn2 == 3 mod 4, a strong pseudoprimality test boils - * down to looking at a^((bn2-1)/2) mod bn and seeing if it's +/-1. - * (+1 if bn2 is == 7 mod 8, -1 if it's == 3) - * Of course, that exponent is just the previous bn2 or bn... - */ - if (bnCopy(bn2, bn) < 0) - return -1; - for (n = 0; n < order; n++) { - /* - * Print a success indicator: the sign of Jacobi(2,bn2), - * which is available to us in l. bn2 = 2*bn + 1. Since bn - * is odd, bn2 must be == 3 mod 4, so the options modulo 8 - * are 3 and 7. 3 if l == 1 mod 4, 7 if l == 3 mod 4. - * The sign of the Jacobi symbol is - and + for these cases, - * respectively. - */ - if (f && (err = f(arg, "-+"[(l >> 1) & 1])) < 0) - return err; - /* Exponent is previous bn2 */ - if (bnCopy(e, bn2) < 0 || bnLShift(bn2, 1) < 0) - return -1; - (void)bnAddQ(bn2, 1); /* Can't overflow */ - if (bnTwoExpMod(a, e, bn2) < 0) - return -1; - if (n | l) { /* Expect + */ - if (bnBits(a) != 1) - return 2+n; /* Not prime */ - } else { - if (bnAddQ(a, 1) < 0) - return -1; - if (bnCmp(a, bn2) != 0) - return 2+n; /* Not prime */ - } - l = bnLSWord(bn2); - } - - /* Final success indicator - it's in the bag. */ - if (f && (err = f(arg, '*')) < 0) - return err; - - /* - * Success! We have found a prime! Now go on to confirmation - * tests... k is an amount by which we know it's safe to shift - * down e. j = 1 unless the test to the base 2 could stand to be - * re-done (it wasn't *quite* a strong test), in which case it's 0. - * - * Here, we do the full strong pseudoprimality test. This proves - * that a number is composite, or says that it's probably prime. - * - * For the given base a, find bn-1 = 2^k * e, then find - * x == a^e (mod bn). - * If x == +1 -> strong pseudoprime to base a - * Otherwise, repeat k times: - * If x == -1, -> strong pseudoprime - * x = x^2 (mod bn) - * If x = +1 -> composite - * If we reach the end of the iteration and x is *not* +1, at the - * end, it is composite. But it's also composite if the result - * *is* +1. Which means that the squaring actually only has to - * proceed k-1 times. If x is not -1 by then, it's composite - * no matter what the result of the squaring is. - * - * For the multiples 2*bn+1, 4*bn+3, etc. then k = 1 (and e is - * the previous multiple of bn) so the squaring loop is never - * actually executed at all. - */ - for (i = j; i < CONFIRMTESTS; i++) { - if (bnCopy(e, bn) < 0) - return -1; - bnRShift(e, k); - k += bnMakeOdd(e); - (void)bnSetQ(a, confirm[i]); - if (bnExpMod(a, a, e, bn) < 0) - return -1; - - if (bnBits(a) != 1) { - l = k; - for (;;) { - if (bnAddQ(a, 1) < 0) - return -1; - if (bnCmp(a, bn) == 0) /* Was result bn-1? */ - break; /* Prime */ - if (!--l) - return (1+order)*i+2; /* Fail */ - /* This part is executed once, on average. */ - (void)bnSubQ(a, 1); /* Restore a */ - if (bnSquare(a, a) < 0 || bnMod(a, a, bn) < 0) - return -1; - if (bnBits(a) == 1) - return (1+order)*i+1; /* Fail */ - } - } - - if (bnCopy(bn2, bn) < 0) - return -1; - - /* Only do the following if we're not re-doing base 2 */ - if (i) for (n = 0; n < order; n++) { - if (bnCopy(e, bn2) < 0 || bnLShift(bn2, 1) < 0) - return -1; - (void)bnAddQ(bn2, 1); - - /* Print success indicator for previous test */ - j = bnJacobiQ(confirm[i], bn2); - if (f && (err = f(arg, j < 0 ? '-' : '+')) < 0) - return err; - - /* Check that p^e == Jacobi(p,bn2) (mod bn2) */ - (void)bnSetQ(a, confirm[i]); - if (bnExpMod(a, a, e, bn2) < 0) - return -1; - /* - * FIXME: Actually, we don't need to compute the - * Jacobi symbol externally... it never happens that - * a = +/-1 but it's the wrong one. So we can just - * look at a and use its sign. Find a proof somewhere. - */ - if (j < 0) { - /* Not a Q.R., should have a = bn2-1 */ - if (bnAddQ(a, 1) < 0) - return -1; - if (bnCmp(a, bn2) != 0) /* Was result bn2-1? */ - return (1+order)*i+n+2; /* Fail */ - } else { - /* Quadratic residue, should have a = 1 */ - if (bnBits(a) != 1) - return (1+order)*i+n+2; /* Fail */ - } - } - /* Final success indicator for the base confirm[i]. */ - if (f && (err = f(arg, '*')) < 0) - return err; - } - - return 0; /* Prime! */ -} - -/* - * Add x*y to bn, which is usually (but not always) < 65536. - * Do it in a simple linear manner. - */ -static int -bnAddMult(struct BigNum *bn, unsigned long x, unsigned y) -{ - unsigned long z = (unsigned long)x * y; - - while (z > 65535) { - if (bnAddQ(bn, 65535) < 0) - return -1; - z -= 65535; - } - return bnAddQ(bn, (unsigned)z); -} - -/* - * Modifies the bignum to return the next Sophie Germain prime >= the - * input value. Sohpie Germain primes are number such that p is - * prime and 2*p+1 is also prime. - * - * This is actually parameterized: it generates primes p such that "order" - * multiples-plus-two are also prime, 2*p+1, 2*(2*p+1)+1 = 4*p+3, etc. - * - * Returns >=0 on success or -1 on failure (out of memory). On success, - * the return value is the number of modular exponentiations performed - * (excluding the final confirmations). This never gives up searching. - * - * The FILE *f argument, if non-NULL, has progress indicators written - * to it. A dot (.) is written every time a primeality test is failed, - * a plus (+) or minus (-) when the smaller prime of the pair passes a - * test, and a star (*) when the larger one does. Finally, a slash (/) - * is printed when the sieve was emptied without finding a prime and is - * being refilled. - * - * Apologies to structured programmers for all the GOTOs. - */ -int -germainPrimeGen(struct BigNum *bn, unsigned order, - int (*f)(void *arg, int c), void *arg) -{ - int retval; - unsigned p, prev; - unsigned inc; - struct BigNum a, e, bn2; - int modexps = 0; -#ifdef MSDOS - unsigned char *sieve; -#else - unsigned char sieve[SIEVE]; -#endif - -#ifdef MSDOS - sieve = lbnMemAlloc(SIEVE); - if (!sieve) - return -1; -#endif - - bnBegin(&a); - bnBegin(&e); - bnBegin(&bn2); - - /* - * Obviously, the prime we find must be odd. Further, if 2*p+1 - * is also to be prime (order > 0) then p != 1 (mod 3), lest - * 2*p+1 == 3 (mod 3). Added to p != 3 (mod 3), p == 2 (mod 3) - * and p == 5 (mod 6). - * If order > 2 and we care about 4*p+3 and 8*p+7, then similarly - * p == 4 (mod 5), so p == 29 (mod 30). - * So pick the step size for searching based on the order - * and increse bn until it's == -1 (mod inc). - * - * mod 7 doesn't have a unique value for p because 2 -> 5 -> 4 -> 2, - * nor does mod 11, and I don't want to think about things past - * that. The required order would be impractically high, in any case. - */ - inc = order ? ((order > 2) ? 30 : 6) : 2; - if (bnAddQ(bn, inc-1 - bnModQ(bn, inc)) < 0) - goto failed; - - for (;;) { - if (sieveBuild(sieve, SIEVE, bn, inc, order) < 0) - goto failed; - - p = prev = 0; - if (sieve[0] & 1 || (p = sieveSearch(sieve, SIEVE, p)) != 0) { - do { - /* Adjust bn to have the right value. */ - assert(p >= prev); - if (bnAddMult(bn, p-prev, inc) < 0) - goto failed; - prev = p; - - /* Okay, do the strong tests. */ - retval = germainPrimeTest(bn, &bn2, &e, &a, - order, f, arg); - if (retval <= 0) - goto done; - modexps += retval; - if (f && (retval = f(arg, '.')) < 0) - goto done; - - /* And try again */ - p = sieveSearch(sieve, SIEVE, p); - } while (p); - } - - /* Ran out of sieve space - increase bn and keep trying. */ - if (bnAddMult(bn, (unsigned long)SIEVE*8-prev, inc) < 0) - goto failed; - if (f && (retval = f(arg, '/')) < 0) - goto done; - } /* for (;;) */ - -failed: - retval = -1; -done: - bnEnd(&bn2); - bnEnd(&e); - bnEnd(&a); -#ifdef MSDOS - lbnMemFree(sieve, SIEVE); -#else - lbnMemWipe(sieve, sizeof(sieve)); -#endif - return retval < 0 ? retval : modexps+(order+1)*CONFIRMTESTS; -} - -int -germainPrimeGenStrong(struct BigNum *bn, struct BigNum const *step, - unsigned order, int (*f)(void *arg, int c), void *arg) -{ - int retval; - unsigned p, prev; - struct BigNum a, e, bn2; - int modexps = 0; -#ifdef MSDOS - unsigned char *sieve; -#else - unsigned char sieve[SIEVE]; -#endif - -#ifdef MSDOS - sieve = lbnMemAlloc(SIEVE); - if (!sieve) - return -1; -#endif - bnBegin(&a); - bnBegin(&e); - bnBegin(&bn2); - - for (;;) { - if (sieveBuildBig(sieve, SIEVE, bn, step, order) < 0) - goto failed; - - p = prev = 0; - if (sieve[0] & 1 || (p = sieveSearch(sieve, SIEVE, p)) != 0) { - do { - /* - * Adjust bn to have the right value, - * adding (p-prev) * 2*step. - */ - assert(p >= prev); - /* Compute delta into a */ - if (bnMulQ(&a, step, p-prev) < 0) - goto failed; - if (bnAdd(bn, &a) < 0) - goto failed; - prev = p; - - /* Okay, do the strong tests. */ - retval = germainPrimeTest(bn, &bn2, &e, &a, - order, f, arg); - if (retval <= 0) - goto done; - modexps += retval; - if (f && (retval = f(arg, '.')) < 0) - goto done; - - /* And try again */ - p = sieveSearch(sieve, SIEVE, p); - } while (p); - } - - /* Ran out of sieve space - increase bn and keep trying. */ -#if SIEVE*8 == 65536 - /* Corner case that will never actually happen */ - if (!prev) { - if (bnAdd(bn, step) < 0) - goto failed; - p = 65535; - } else { - p = (unsigned)(SIEVE*8 - prev); - } -#else - p = SIEVE*8 - prev; -#endif - if (bnMulQ(&a, step, p) < 0 || bnAdd(bn, &a) < 0) - goto failed; - if (f && (retval = f(arg, '/')) < 0) - goto done; - } /* for (;;) */ - -failed: - retval = -1; -done: - bnEnd(&bn2); - bnEnd(&e); - bnEnd(&a); -#ifdef MSDOS - lbnMemFree(sieve, SIEVE); -#else - lbnMemWipe(sieve, sizeof(sieve)); -#endif - return retval < 0 ? retval : modexps+(order+1)*CONFIRMTESTS; -} diff --git a/libs/libzrtp/third_party/bnlib/germain.h b/libs/libzrtp/third_party/bnlib/germain.h deleted file mode 100644 index 88c3e27d7a..0000000000 --- a/libs/libzrtp/third_party/bnlib/germain.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -struct BigNum; - -/* Generate a Sophie Germain prime */ -int germainPrimeGen(struct BigNum *bn, unsigned order, - int (*f)(void *arg, int c), void *arg); -/* The same, but search for using the given step size */ -int germainPrimeGenStrong(struct BigNum *bn, struct BigNum const *step, - unsigned order, int (*f)(void *arg, int c), void *arg); diff --git a/libs/libzrtp/third_party/bnlib/germtest.c b/libs/libzrtp/third_party/bnlib/germtest.c deleted file mode 100644 index 826de77174..0000000000 --- a/libs/libzrtp/third_party/bnlib/germtest.c +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * germtest.c - Random Sophie Germain prime generator. - * - * This generates random Sophie Germain primes using the command line - * as a seed value. It uses George Marsaglia's "mother of all random - * number generators" to (using the command line as a seed) to pick the - * starting search value and then searches sequentially for the next - * Sophie Germain prime p (a prime such that 2*p+1 is also prime). - * - * This is a really good way to burn a lot of CPU cycles. - */ -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -#include <stdio.h> -#if !NO_STRING_H -#include <string.h> -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include <stdlib.h> /* For malloc() */ - -#include "bn.h" -#include "germain.h" -#include "sieve.h" - -#include "cputime.h" - -#define BNDEBUG 1 - -#include "bnprint.h" -#define bnPut(prompt, bn) bnPrint(stdout, prompt, bn, "\n") - -/* - * Generate random numbers according to George Marsaglia's - * Mother Of All Random Number Generators. This has a - * period of 0x17768215025F82EA0378038A03A203CA7FFF, - * or decimal 2043908804452974490458343567652678881935359. - */ -static unsigned mstate[8]; -static unsigned mcarry; -static unsigned mindex; - -static unsigned -mRandom_16(void) -{ - unsigned long t; - - t = mcarry + - mstate[ mindex ] * 1941ul + - mstate[(mindex+1)&7] * 1860ul + - mstate[(mindex+2)&7] * 1812ul + - mstate[(mindex+3)&7] * 1776ul + - mstate[(mindex+4)&7] * 1492ul + - mstate[(mindex+5)&7] * 1215ul + - mstate[(mindex+6)&7] * 1066ul + - mstate[(mindex+7)&7] * 12013ul; - mcarry = (unsigned)(t >> 16); /* 0 <= mcarry <= 0x5a87 */ - mindex = (mindex-1) & 7; - return mstate[mindex] = (unsigned)(t & 0xffff); -} - -/* - * Initialize the RNG based on the given seed. - * A zero-length seed will produce pretty lousy numbers, - * but it will work. - */ -static void -mSeed(unsigned char const *seed, unsigned len) -{ - unsigned i; - - for (i = 0; i < 8; i++) - mstate[i] = 0; - mcarry = 1; - while (len--) { - mcarry += *seed++; - (void)mRandom_16(); - } -} - - -/* - * Generate a bignum of a specified length, with the given - * high and low 8 bits. "High" is merged into the high 8 bits of the - * number. For example, set it to 0x80 to ensure that the number is - * exactly "bits" bits long (i.e. 2^(bits-1) <= bn < 2^bits). - * "Low" is merged into the low 8 bits. For example, set it to - * 1 to ensure that you generate an odd number. "High" is merged - * into the high bits; set it to 0x80 to ensure that the high bit - * is set in the returned value. - */ -static int -genRandBn(struct BigNum *bn, unsigned bits, unsigned char high, -unsigned char low, unsigned char const *seed, unsigned len) -{ - unsigned char buf[64]; - unsigned bytes; - unsigned l = 0; /* Current position */ - unsigned t, i; - - bnSetQ(bn, 0); - if (bnPrealloc(bn, bits) < 0) - return -1; - mSeed(seed, len); - - bytes = (bits+7) / 8; /* Number of bytes to use */ - - for (i = 0; i < sizeof(buf); i += 2) { - t = mRandom_16(); - buf[i] = (unsigned char)(t >> 8); - buf[i+1] = (unsigned char)t; - } - buf[sizeof(buf)-1] |= low; - - while (bytes > sizeof(buf)) { - bytes -= sizeof(buf); - /* Merge in low half of high bits, if necessary */ - if (bytes == 1 && (bits & 7)) - buf[0] |= high << (bits & 7); - if (bnInsertBigBytes(bn, buf, l, sizeof(buf)) < 0) - return -1; - l += sizeof(buf); - for (i = 0; i < sizeof(buf); i += 2) { - t = mRandom_16(); - buf[i] = (unsigned char)t; - buf[i+1] = (unsigned char)(t >> 8); - } - } - - /* Do the final "bytes"-long section, using the tail bytes in buf */ - /* Mask off excess high bits */ - buf[sizeof(buf)-bytes] &= 255 >> (-bits & 7); - /* Merge in specified high bits */ - buf[sizeof(buf)-bytes] |= high >> (-bits & 7); - if (bytes > 1 && (bits & 7)) - buf[sizeof(buf)-bytes+1] |= high << (bits & 7); - /* Merge in the appropriate bytes of the buffer */ - if (bnInsertBigBytes(bn, buf+sizeof(buf)-bytes, l, bytes) < 0) - return -1; - return 0; -} - -struct Progress { - FILE *f; - unsigned column; - unsigned wrap; -}; - -/* Print a progress indicator, with line-wrap */ -static int -genProgress(void *arg, int c) -{ - struct Progress *p = arg; - if (++p->column > p->wrap) { - putc('\n', p->f); - p->column = 1; - } - putc(c, p->f); - fflush(p->f); - return 0; -} - -static int -genSophieGermain(struct BigNum *bn, unsigned bits, unsigned order, - unsigned char const *seed, unsigned len, FILE *f) -{ -#if CLOCK_AVAIL - timetype start, stop; - unsigned long s; -#endif - int i; -#if BNDEBUG - unsigned char s1[1024], s2[1024]; -#endif - char buf[40]; - unsigned p1, p2; - struct BigNum step; - struct Progress progress; - - if (f) - fprintf(f, "Generating a %u-bit order-%u Sophie Germain prime with \"%.*s\"\n", - bits, order, (int)len, (char *)seed); - progress.f = f; - progress.column = 0; - progress.wrap = 78; - - /* Find p - choose a starting place */ - if (genRandBn(bn, bits, 0xC0, 3, seed, len) < 0) - return -1; -#if BNDEBUG /* DEBUG - check that sieve works properly */ - bnBegin(&step); - bnSetQ(&step, 2); - sieveBuild(s1, 1024, bn, 2, order); - sieveBuildBig(s2, 1024, bn, &step, order); - p1 = p2 = 0; - if (s1[0] != s2[0]) - printf("Difference: s1[0] = %x s2[0] = %x\n", s1[0], s2[0]); - do { - p1 = sieveSearch(s1, 1024, p1); - p2 = sieveSearch(s2, 1024, p2); - - if (p1 != p2) - printf("Difference: p1 = %u p2 = %u\n", p1, p2); - } while (p1 && p2); - - bnEnd(&step); -#endif - /* And search for a prime */ -#if CLOCK_AVAIL - gettime(&start); -#endif - i = germainPrimeGen(bn, order, f ? genProgress : 0, (void *)&progress); - if (i < 0) - return -1; -#if CLOCK_AVAIL - gettime(&stop); -#endif - if (f) { - putc('\n', f); - fprintf(f, "%d modular exponentiations performed.\n", i); - } -#if CLOCK_AVAIL - subtime(stop, start); - s = sec(stop); - printf("%u-bit time = %lu.%03u sec.", bits, s, msec(stop)); - if (s > 60) { - putchar(' '); - putchar('('); - if (s > 3600) - printf("%u:%02u", (unsigned)(s/3600), - (unsigned)(s/60%60)); - else - printf("%u", (unsigned)(s/60)); - printf(":%02u)", (unsigned)(s%60)); - } - putchar('\n'); -#endif - - bnPut(" p = ", bn); - for (p1 = 0; p1 < order; p1++) { - if (bnLShift(bn, 1) <0) - return -1; - (void)bnAddQ(bn, 1); - sprintf(buf, "%u*p+%u = ", 2u<<p1, (2u<<p1) - 1); - bnPut(buf, bn); - } - return 0; -} - -/* Copy the command line to the buffer. */ -static unsigned char * -copy(int argc, char **argv, size_t *lenp) -{ - size_t len; - int i; - unsigned char *buf, *p; - - len = argc > 2 ? (size_t)(argc-2) : 0; - for (i = 1; i < argc; i++) - len += strlen(argv[i]); - *lenp = len; - buf = malloc(len+!len); /* Can't malloc 0 bytes... */ - if (buf) { - p = buf; - for (i = 1; i < argc; i++) { - if (i > 1) - *p++ = ' '; - len = strlen(argv[i]); - memcpy(p, argv[i], len); - p += len; - } - } - return buf; -} - -int -main(int argc, char **argv) -{ - unsigned len; - struct BigNum bn; - unsigned char *buf; - - if (argc < 2) { - fprintf(stderr, "Usage: %s <seed>\n", argv[0]); - fputs("\ -<seed> should be a a string of bytes to be hashed to seed the prime\n\ -generator. Note that unquoted whitespace between words will be counted\n\ -as a single space. To include multiple spaces, quote them.\n", stderr); - return 1; - } - - buf = copy(argc, argv, &len); - if (!buf) { - fprintf(stderr, "Out of memory!\n"); - return 1; - } - - bnBegin(&bn); - - genSophieGermain(&bn, 0x100, 0, buf, len, stdout); - genSophieGermain(&bn, 0x100, 1, buf, len, stdout); - genSophieGermain(&bn, 0x100, 2, buf, len, stdout); - genSophieGermain(&bn, 0x100, 3, buf, len, stdout); - genSophieGermain(&bn, 0x200, 0, buf, len, stdout); - genSophieGermain(&bn, 0x200, 1, buf, len, stdout); - genSophieGermain(&bn, 0x200, 2, buf, len, stdout); - genSophieGermain(&bn, 0x300, 0, buf, len, stdout); - genSophieGermain(&bn, 0x300, 1, buf, len, stdout); - genSophieGermain(&bn, 0x400, 0, buf, len, stdout); - genSophieGermain(&bn, 0x400, 1, buf, len, stdout); - genSophieGermain(&bn, 0x500, 0, buf, len, stdout); - genSophieGermain(&bn, 0x500, 1, buf, len, stdout); - genSophieGermain(&bn, 0x600, 0, buf, len, stdout); - genSophieGermain(&bn, 0x600, 1, buf, len, stdout); -#if 0 - /* These get *really* slow */ - genSophieGermain(&bn, 0x800, 0, buf, len, stdout); - genSophieGermain(&bn, 0x800, 1, buf, len, stdout); - genSophieGermain(&bn, 0xc00, 0, buf, len, stdout); - genSophieGermain(&bn, 0xc00, 1, buf, len, stdout); - /* Like, plan on a *week* or more for this one. */ - genSophieGermain(&bn, 0x1000, 0, buf, len, stdout); - genSophieGermain(&bn, 0x1000, 1, buf, len, stdout); -#endif - - bnEnd(&bn); - free(buf); - - return 0; -} diff --git a/libs/libzrtp/third_party/bnlib/jacobi.c b/libs/libzrtp/third_party/bnlib/jacobi.c deleted file mode 100644 index 5ebdb55698..0000000000 --- a/libs/libzrtp/third_party/bnlib/jacobi.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Compute the Jacobi symbol (small prime case only). - */ -#include "bn.h" -#include "jacobi.h" - -/* - * For a small (usually prime, but not necessarily) prime p, - * compute Jacobi(p,bn), which is -1, 0 or +1, using the following rules: - * Jacobi(x, y) = Jacobi(x mod y, y) - * Jacobi(0, y) = 0 - * Jacobi(1, y) = 1 - * Jacobi(2, y) = 0 if y is even, +1 if y is +/-1 mod 8, -1 if y = +/-3 mod 8 - * Jacobi(x1*x2, y) = Jacobi(x1, y) * Jacobi(x2, y) (used with x1 = 2 & x1 = 4) - * If x and y are both odd, then - * Jacobi(x, y) = Jacobi(y, x) * (-1 if x = y = 3 mod 4, +1 otherwise) - */ -int -bnJacobiQ(unsigned p, struct BigNum const *bn) -{ - int j = 1; - unsigned u = bnLSWord(bn); - - if (!(u & 1)) - return 0; /* Don't *do* that */ - - /* First, get rid of factors of 2 in p */ - while ((p & 3) == 0) - p >>= 2; - if ((p & 1) == 0) { - p >>= 1; - if ((u ^ u>>1) & 2) - j = -j; /* 3 (011) or 5 (101) mod 8 */ - } - if (p == 1) - return j; - /* Then, apply quadratic reciprocity */ - if (p & u & 2) /* p = u = 3 (mod 4? */ - j = -j; - /* And reduce u mod p */ - u = bnModQ(bn, p); - - /* Now compute Jacobi(u,p), u < p */ - while (u) { - while ((u & 3) == 0) - u >>= 2; - if ((u & 1) == 0) { - u >>= 1; - if ((p ^ p>>1) & 2) - j = -j; /* 3 (011) or 5 (101) mod 8 */ - } - if (u == 1) - return j; - /* Now both u and p are odd, so use quadratic reciprocity */ - if (u < p) { - unsigned t = u; u = p; p = t; - if (u & p & 2) /* u = p = 3 (mod 4? */ - j = -j; - } - /* Now u >= p, so it can be reduced */ - u %= p; - } - return 0; -} diff --git a/libs/libzrtp/third_party/bnlib/jacobi.h b/libs/libzrtp/third_party/bnlib/jacobi.h deleted file mode 100644 index 7177961164..0000000000 --- a/libs/libzrtp/third_party/bnlib/jacobi.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * For a small (usually prime, but not necessarily) prime p, - * Return Jacobi(p,bn), which is -1, 0 or +1. - * bn must be odd. - */ -struct BigNum; -int bnJacobiQ(unsigned p, struct BigNum const *bn); diff --git a/libs/libzrtp/third_party/bnlib/kludge.h b/libs/libzrtp/third_party/bnlib/kludge.h deleted file mode 100644 index 3d84a1f346..0000000000 --- a/libs/libzrtp/third_party/bnlib/kludge.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef KLUDGE_H -#define KLUDGE_H - -/* - * Kludges for not-quite-ANSI systems. - * This should always be the last file included, because it may - * mess up some system header files. - */ - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STDLIB_H -#define NO_STDLIB_H 0 -#endif - -#ifndef NO_MEMMOVE -#define NO_MEMMOVE 0 -#endif -#if NO_MEMMOVE /* memove() not in libraries */ -#define memmove(dest,src,len) bcopy(src,dest,len) -#endif - -#ifndef NO_MEMCPY -#define NO_MEMCPY 0 -#endif -#if NO_MEMCPY /* memcpy() not in libraries */ -#define memcpy(dest,src,len) bcopy(src,dest,len) -#endif - -/* - * Borland C seems to think that it's a bad idea to decleare a - * structure tag and not declare the contents. I happen to think - * it's a *good* idea to use such "opaque" structures wherever - * possible. So shut up. - */ -#ifdef __BORLANDC__ -#pragma warn -stu -#ifndef MSDOS -#define MSDOS 1 -#endif -#endif - -/* Turn off warning about negation of unsigned values */ -#ifdef _MSC_VER -#pragma warning(disable:4146) -#endif - -/* Cope with people forgetting to define the OS, if possible... */ -#ifndef MSDOS -#ifdef __MSDOS -#define MSDOS 1 -#endif -#endif -#ifndef MSDOS -#ifdef __MSDOS__ -#define MSDOS 1 -#endif -#endif - -/* By MS-DOS, we mean 16-bit brain-dead MS-DOS. Not GCC & GO32 */ -#ifdef __GO32 -#undef MSDOS -#endif -#ifdef __GO32__ -#undef MSDOS -#endif - -#endif /* KLUDGE_H */ diff --git a/libs/libzrtp/third_party/bnlib/lbn.h b/libs/libzrtp/third_party/bnlib/lbn.h deleted file mode 100644 index 43fc7c91dc..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn.h - Low-level bignum header. - * Defines various word sizes and useful macros. - * TODO: Rewrite this to use <stdint.h> and/or <inttypes.h> - */ -#ifndef LBN_H -#define LBN_H - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_LIMITS_H -#define NO_LIMITS_H 0 -#endif - -/* Make sure we have 8-bit bytes */ -#if !NO_LIMITS_H -#include <limits.h> -#if UCHAR_MAX != 0xff || CHAR_BIT != 8 -#error The bignum library requires 8-bit unsigned characters. -#endif -#endif /* !NO_LIMITS_H */ - -#ifdef BNINCLUDE /* If this is defined as, say, foo.h */ -#define STR(x) #x /* STR(BNINCLUDE) -> "BNINCLUDE" */ -#define XSTR(x) STR(x) /* XSTR(BNINCLUDE) -> STR(foo.h) -> "foo.h" */ -#include XSTR(BNINCLUDE) /* #include "foo.h" */ -#undef XSTR -#undef STR -#endif - -/* Do we want bnYield()? */ -#ifndef BNYIELD -#define BNYIELD 0 -#endif - -/* Figure out the endianness */ -/* Error if more than one is defined */ -#if defined(BN_BIG_ENDIAN) && defined(BN_LITTLE_ENDIAN) -#error Only one of BN_BIG_ENDIAN or BN_LITTLE_ENDIAN may be defined -#endif - -/* - * If no preference is stated, little-endian C code is slightly more - * efficient, so prefer that. (The endianness here does NOT have to - * match the machine's native byte sex; the library's C code will work - * either way. The flexibility is allowed for assembly routines - * that do care. - */ -#if !defined(BN_BIG_ENDIAN) && !defined(BN_LITTLE_ENDIAN) -#define BN_LITTLE_ENDIAN 1 -#endif /* !BN_BIG_ENDIAN && !BN_LITTLE_ENDIAN */ - -/* Macros to choose between big and little endian */ -#if defined(BN_BIG_ENDIAN) -#define BIG(b) b -#define LITTLE(l) /*nothing*/ -#define BIGLITTLE(b,l) b -#elif BN_LITTLE_ENDIAN -#define BIG(b) /*nothing*/ -#define LITTLE(l) l -#define BIGLITTLE(b,l) l -#else -#error One of BN_BIG_ENDIAN or BN_LITTLE_ENDIAN must be defined as 1 -#endif - - -/* - * Find a 16-bit unsigned type. - * Unsigned short is preferred over unsigned int to make the type chosen - * by this file more stable on platforms (such as many 68000 compilers) - * which support both 16- and 32-bit ints. - */ -#ifndef BNWORD16 -#ifndef USHRT_MAX /* No <limits.h> available - guess */ -typedef unsigned short bnword16; -#define BNWORD16 bnword16 -#elif USHRT_MAX == 0xffff -typedef unsigned short bnword16; -#define BNWORD16 bnword16 -#elif UINT_MAX == 0xffff -typedef unsigned bnword16; -#define BNWORD16 bnword16 -#endif -#endif /* BNWORD16 */ - -/* - * Find a 32-bit unsigned type. - * Unsigned long is preferred over unsigned int to make the type chosen - * by this file more stable on platforms (such as many 68000 compilers) - * which support both 16- and 32-bit ints. - */ -#ifndef BNWORD32 -#ifndef ULONG_MAX /* No <limits.h> available - guess */ -typedef unsigned long bnword32; -#define BNWORD32 bnword32 -#elif ULONG_MAX == 0xfffffffful -typedef unsigned long bnword32; -#define BNWORD32 bnword32 -#elif UINT_MAX == 0xffffffff -typedef unsigned bnword32; -#define BNWORD32 bnword32 -#elif USHRT_MAX == 0xffffffff -typedef unsigned short bnword32; -#define BNWORD32 bnword32 -#endif -#endif /* BNWORD16 */ - -/* - * Find a 64-bit unsigned type. - * The conditions here are more complicated to avoid using numbers that - * will choke lesser preprocessors (like 0xffffffffffffffff) unless - * we're reasonably certain that they'll be acceptable. - */ -#if !defined(BNWORD64) && ULONG_MAX > 0xfffffffful -#if ULONG_MAX == 0xffffffffffffffff -typedef unsigned long bnword64; -#define BNWORD64 bnword64 -#endif -#endif - -/* - * I would test the value of unsigned long long, but some *preprocessors* - * don't constants that long even if the compiler can accept them, so it - * doesn't work reliably. So cross our fingers and hope that it's a 64-bit - * type. - * - * GCC uses ULONG_LONG_MAX. Solaris uses ULLONG_MAX. IRIX uses ULONGLONG_MAX. - * Are there any other names for this? - */ -#if !defined(BNWORD64) && \ - (defined(ULONG_LONG_MAX) || defined (ULLONG_MAX) || defined(ULONGLONG_MAX) || defined(ULONG_MAX)) -typedef unsigned long long bnword64; -#define BNWORD64 bnword64 -#endif - -/*Workaround for windows for now. */ -#ifdef WIN32 -typedef unsigned long long bnword64; -#define BNWORD64 bnword64 -#endif - -/* We don't even try to find a 128-bit type at the moment */ - -#endif /* !LBN_H */ diff --git a/libs/libzrtp/third_party/bnlib/lbn00.c b/libs/libzrtp/third_party/bnlib/lbn00.c deleted file mode 100644 index faa7a35495..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn00.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn00.c - auto-size-detecting lbn??.c file. - * - * Written in 1995 by Colin Plumb. - */ - -#include "bnsize00.h" - -#if BNSIZE64 - -/* Include all of the C source file by reference */ -#include "lbn64.c" - -#elif BNSIZE32 - -/* Include all of the C source file by reference */ -#include "lbn32.c" - -#else /* BNSIZE16 */ - -/* Include all of the C source file by reference */ -#include "lbn16.c" - -#endif diff --git a/libs/libzrtp/third_party/bnlib/lbn16.c b/libs/libzrtp/third_party/bnlib/lbn16.c deleted file mode 100644 index 6e00a020e8..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn16.c +++ /dev/null @@ -1,4067 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn16.c - Low-level bignum routines, 16-bit version. - * - * NOTE: the magic constants "16" and "32" appear in many places in this - * file, including inside identifiers. Because it is not possible to - * ask "#ifdef" of a macro expansion, it is not possible to use the - * preprocessor to conditionalize these properly. Thus, this file is - * intended to be edited with textual search and replace to produce - * alternate word size versions. Any reference to the number of bits - * in a word must be the string "16", and that string must not appear - * otherwise. Any reference to twice this number must appear as "32", - * which likewise must not appear otherwise. Is that clear? - * - * Remember, when doubling the bit size replace the larger number (32) - * first, then the smaller (16). When halving the bit size, do the - * opposite. Otherwise, things will get wierd. Also, be sure to replace - * every instance that appears. (:%s/foo/bar/g in vi) - * - * These routines work with a pointer to the least-significant end of - * an array of WORD16s. The BIG(x), LITTLE(y) and BIGLTTLE(x,y) macros - * defined in lbn.h (which expand to x on a big-edian machine and y on a - * little-endian machine) are used to conditionalize the code to work - * either way. If you have no assembly primitives, it doesn't matter. - * Note that on a big-endian machine, the least-significant-end pointer - * is ONE PAST THE END. The bytes are ptr[-1] through ptr[-len]. - * On little-endian, they are ptr[0] through ptr[len-1]. This makes - * perfect sense if you consider pointers to point *between* bytes rather - * than at them. - * - * Because the array index values are unsigned integers, ptr[-i] - * may not work properly, since the index -i is evaluated as an unsigned, - * and if pointers are wider, zero-extension will produce a positive - * number rahter than the needed negative. The expression used in this - * code, *(ptr-i) will, however, work. (The array syntax is equivalent - * to *(ptr+-i), which is a pretty subtle difference.) - * - * Many of these routines will get very unhappy if fed zero-length inputs. - * They use assert() to enforce this. An higher layer of code must make - * sure that these aren't called with zero-length inputs. - * - * Any of these routines can be replaced with more efficient versions - * elsewhere, by just #defining their names. If one of the names - * is #defined, the C code is not compiled in and no declaration is - * made. Use the BNINCLUDE file to do that. Typically, you compile - * asm subroutines with the same name and just, e.g. - * #define lbnMulAdd1_16 lbnMulAdd1_16 - * - * If you want to write asm routines, start with lbnMulAdd1_16(). - * This is the workhorse of modular exponentiation. lbnMulN1_16() is - * also used a fair bit, although not as much and it's defined in terms - * of lbnMulAdd1_16 if that has a custom version. lbnMulSub1_16 and - * lbnDiv21_16 are used in the usual division and remainder finding. - * (Not the Montgomery reduction used in modular exponentiation, though.) - * Once you have lbnMulAdd1_16 defined, writing the other two should - * be pretty easy. (Just make sure you get the sign of the subtraction - * in lbnMulSub1_16 right - it's dest = dest - source * k.) - * - * The only definitions that absolutely need a double-word (BNWORD32) - * type are lbnMulAdd1_16 and lbnMulSub1_16; if those are provided, - * the rest follows. lbnDiv21_16, however, is a lot slower unless you - * have them, and lbnModQ_16 takes after it. That one is used quite a - * bit for prime sieving. - */ - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#if !NO_STRING_H -#include <string.h> /* For memcpy */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "lbn.h" -#include "lbn16.h" -#include "lbnmem.h" - -#include "kludge.h" - -#ifndef BNWORD16 -#error 16-bit bignum library requires a 16-bit data type -#endif - -/* If this is defined, include bnYield() calls */ -#if BNYIELD -extern int (*bnYield)(void); /* From bn.c */ -#endif - -/* - * Most of the multiply (and Montgomery reduce) routines use an outer - * loop that iterates over one of the operands - a so-called operand - * scanning approach. One big advantage of this is that the assembly - * support routines are simpler. The loops can be rearranged to have - * an outer loop that iterates over the product, a so-called product - * scanning approach. This has the advantage of writing less data - * and doing fewer adds to memory, so is supposedly faster. Some - * code has been written using a product-scanning approach, but - * it appears to be slower, so it is turned off by default. Some - * experimentation would be appreciated. - * - * (The code is also annoying to get right and not very well commented, - * one of my pet peeves about math libraries. I'm sorry.) - */ -#ifndef PRODUCT_SCAN -#define PRODUCT_SCAN 0 -#endif - -/* - * Copy an array of words. <Marvin mode on> Thrilling, isn't it? </Marvin> - * This is a good example of how the byte offsets and BIGLITTLE() macros work. - * Another alternative would have been - * memcpy(dest BIG(-len), src BIG(-len), len*sizeof(BNWORD16)), but I find that - * putting operators into conditional macros is confusing. - */ -#ifndef lbnCopy_16 -void -lbnCopy_16(BNWORD16 *dest, BNWORD16 const *src, unsigned len) -{ - memcpy(BIGLITTLE(dest-len,dest), BIGLITTLE(src-len,src), - len * sizeof(*src)); -} -#endif /* !lbnCopy_16 */ - -/* - * Fill n words with zero. This does it manually rather than calling - * memset because it can assume alignment to make things faster while - * memset can't. Note how big-endian numbers are naturally addressed - * using predecrement, while little-endian is postincrement. - */ -#ifndef lbnZero_16 -void -lbnZero_16(BNWORD16 *num, unsigned len) -{ - while (len--) - BIGLITTLE(*--num,*num++) = 0; -} -#endif /* !lbnZero_16 */ - -/* - * Negate an array of words. - * Negation is subtraction from zero. Negating low-order words - * entails doing nothing until a non-zero word is hit. Once that - * is negated, a borrow is generated and never dies until the end - * of the number is hit. Negation with borrow, -x-1, is the same as ~x. - * Repeat that until the end of the number. - * - * Doesn't return borrow out because that's pretty useless - it's - * always set unless the input is 0, which is easy to notice in - * normalized form. - */ -#ifndef lbnNeg_16 -void -lbnNeg_16(BNWORD16 *num, unsigned len) -{ - assert(len); - - /* Skip low-order zero words */ - while (BIGLITTLE(*--num,*num) == 0) { - if (!--len) - return; - LITTLE(num++;) - } - /* Negate the lowest-order non-zero word */ - *num = -*num; - /* Complement all the higher-order words */ - while (--len) { - BIGLITTLE(--num,++num); - *num = ~*num; - } -} -#endif /* !lbnNeg_16 */ - - -/* - * lbnAdd1_16: add the single-word "carry" to the given number. - * Used for minor increments and propagating the carry after - * adding in a shorter bignum. - * - * Technique: If we have a double-width word, presumably the compiler - * can add using its carry in inline code, so we just use a larger - * accumulator to compute the carry from the first addition. - * If not, it's more complex. After adding the first carry, which may - * be > 1, compare the sum and the carry. If the sum wraps (causing a - * carry out from the addition), the result will be less than each of the - * inputs, since the wrap subtracts a number (2^16) which is larger than - * the other input can possibly be. If the sum is >= the carry input, - * return success immediately. - * In either case, if there is a carry, enter a loop incrementing words - * until one does not wrap. Since we are adding 1 each time, the wrap - * will be to 0 and we can test for equality. - */ -#ifndef lbnAdd1_16 /* If defined, it's provided as an asm subroutine */ -#ifdef BNWORD32 -BNWORD16 -lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry) -{ - BNWORD32 t; - assert(len > 0); /* Alternative: if (!len) return carry */ - - t = (BNWORD32)BIGLITTLE(*--num,*num) + carry; - BIGLITTLE(*num,*num++) = (BNWORD16)t; - if ((t >> 16) == 0) - return 0; - while (--len) { - if (++BIGLITTLE(*--num,*num++) != 0) - return 0; - } - return 1; -} -#else /* no BNWORD32 */ -BNWORD16 -lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry) -{ - assert(len > 0); /* Alternative: if (!len) return carry */ - - if ((BIGLITTLE(*--num,*num++) += carry) >= carry) - return 0; - while (--len) { - if (++BIGLITTLE(*--num,*num++) != 0) - return 0; - } - return 1; -} -#endif -#endif/* !lbnAdd1_16 */ - -/* - * lbnSub1_16: subtract the single-word "borrow" from the given number. - * Used for minor decrements and propagating the borrow after - * subtracting a shorter bignum. - * - * Technique: Similar to the add, above. If there is a double-length type, - * use that to generate the first borrow. - * If not, after subtracting the first borrow, which may be > 1, compare - * the difference and the *negative* of the carry. If the subtract wraps - * (causing a borrow out from the subtraction), the result will be at least - * as large as -borrow. If the result < -borrow, then no borrow out has - * appeared and we may return immediately, except when borrow == 0. To - * deal with that case, use the identity that -x = ~x+1, and instead of - * comparing < -borrow, compare for <= ~borrow. - * Either way, if there is a borrow out, enter a loop decrementing words - * until a non-zero word is reached. - * - * Note the cast of ~borrow to (BNWORD16). If the size of an int is larger - * than BNWORD16, C rules say the number is expanded for the arithmetic, so - * the inversion will be done on an int and the value won't be quite what - * is expected. - */ -#ifndef lbnSub1_16 /* If defined, it's provided as an asm subroutine */ -#ifdef BNWORD32 -BNWORD16 -lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow) -{ - BNWORD32 t; - assert(len > 0); /* Alternative: if (!len) return borrow */ - - t = (BNWORD32)BIGLITTLE(*--num,*num) - borrow; - BIGLITTLE(*num,*num++) = (BNWORD16)t; - if ((t >> 16) == 0) - return 0; - while (--len) { - if ((BIGLITTLE(*--num,*num++))-- != 0) - return 0; - } - return 1; -} -#else /* no BNWORD32 */ -BNWORD16 -lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow) -{ - assert(len > 0); /* Alternative: if (!len) return borrow */ - - if ((BIGLITTLE(*--num,*num++) -= borrow) <= (BNWORD16)~borrow) - return 0; - while (--len) { - if ((BIGLITTLE(*--num,*num++))-- != 0) - return 0; - } - return 1; -} -#endif -#endif /* !lbnSub1_16 */ - -/* - * lbnAddN_16: add two bignums of the same length, returning the carry (0 or 1). - * One of the building blocks, along with lbnAdd1, of adding two bignums of - * differing lengths. - * - * Technique: Maintain a word of carry. If there is no double-width type, - * use the same technique as in lbnAdd1, above, to maintain the carry by - * comparing the inputs. Adding the carry sources is used as an OR operator; - * at most one of the two comparisons can possibly be true. The first can - * only be true if carry == 1 and x, the result, is 0. In that case the - * second can't possibly be true. - */ -#ifndef lbnAddN_16 -#ifdef BNWORD32 -BNWORD16 -lbnAddN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len) -{ - BNWORD32 t; - - assert(len > 0); - - t = (BNWORD32)BIGLITTLE(*--num1,*num1) + BIGLITTLE(*--num2,*num2++); - BIGLITTLE(*num1,*num1++) = (BNWORD16)t; - while (--len) { - t = (BNWORD32)BIGLITTLE(*--num1,*num1) + - (BNWORD32)BIGLITTLE(*--num2,*num2++) + (t >> 16); - BIGLITTLE(*num1,*num1++) = (BNWORD16)t; - } - - return (BNWORD16)(t>>16); -} -#else /* no BNWORD32 */ -BNWORD16 -lbnAddN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len) -{ - BNWORD16 x, carry = 0; - - assert(len > 0); /* Alternative: change loop to test at start */ - - do { - x = BIGLITTLE(*--num2,*num2++); - carry = (x += carry) < carry; - carry += (BIGLITTLE(*--num1,*num1++) += x) < x; - } while (--len); - - return carry; -} -#endif -#endif /* !lbnAddN_16 */ - -/* - * lbnSubN_16: add two bignums of the same length, returning the carry (0 or 1). - * One of the building blocks, along with subn1, of subtracting two bignums of - * differing lengths. - * - * Technique: If no double-width type is availble, maintain a word of borrow. - * First, add the borrow to the subtrahend (did you have to learn all those - * awful words in elementary school, too?), and if it overflows, set the - * borrow again. Then subtract the modified subtrahend from the next word - * of input, using the same technique as in subn1, above. - * Adding the borrows is used as an OR operator; at most one of the two - * comparisons can possibly be true. The first can only be true if - * borrow == 1 and x, the result, is 0. In that case the second can't - * possibly be true. - * - * In the double-word case, (BNWORD16)-(t>>16) is subtracted, rather than - * adding t>>16, because the shift would need to sign-extend and that's - * not guaranteed to happen in ANSI C, even with signed types. - */ -#ifndef lbnSubN_16 -#ifdef BNWORD32 -BNWORD16 -lbnSubN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len) -{ - BNWORD32 t; - - assert(len > 0); - - t = (BNWORD32)BIGLITTLE(*--num1,*num1) - BIGLITTLE(*--num2,*num2++); - BIGLITTLE(*num1,*num1++) = (BNWORD16)t; - - while (--len) { - t = (BNWORD32)BIGLITTLE(*--num1,*num1) - - (BNWORD32)BIGLITTLE(*--num2,*num2++) - (BNWORD16)-(t >> 16); - BIGLITTLE(*num1,*num1++) = (BNWORD16)t; - } - - return -(BNWORD16)(t>>16); -} -#else -BNWORD16 -lbnSubN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len) -{ - BNWORD16 x, borrow = 0; - - assert(len > 0); /* Alternative: change loop to test at start */ - - do { - x = BIGLITTLE(*--num2,*num2++); - borrow = (x += borrow) < borrow; - borrow += (BIGLITTLE(*--num1,*num1++) -= x) > (BNWORD16)~x; - } while (--len); - - return borrow; -} -#endif -#endif /* !lbnSubN_16 */ - -#ifndef lbnCmp_16 -/* - * lbnCmp_16: compare two bignums of equal length, returning the sign of - * num1 - num2. (-1, 0 or +1). - * - * Technique: Change the little-endian pointers to big-endian pointers - * and compare from the most-significant end until a difference if found. - * When it is, figure out the sign of the difference and return it. - */ -int -lbnCmp_16(BNWORD16 const *num1, BNWORD16 const *num2, unsigned len) -{ - BIGLITTLE(num1 -= len, num1 += len); - BIGLITTLE(num2 -= len, num2 += len); - - while (len--) { - if (BIGLITTLE(*num1++ != *num2++, *--num1 != *--num2)) { - if (BIGLITTLE(num1[-1] < num2[-1], *num1 < *num2)) - return -1; - else - return 1; - } - } - return 0; -} -#endif /* !lbnCmp_16 */ - -/* - * mul16_ppmmaa(ph,pl,x,y,a,b) is an optional routine that - * computes (ph,pl) = x * y + a + b. mul16_ppmma and mul16_ppmm - * are simpler versions. If you want to be lazy, all of these - * can be defined in terms of the others, so here we create any - * that have not been defined in terms of the ones that have been. - */ - -/* Define ones with fewer a's in terms of ones with more a's */ -#if !defined(mul16_ppmma) && defined(mul16_ppmmaa) -#define mul16_ppmma(ph,pl,x,y,a) mul16_ppmmaa(ph,pl,x,y,a,0) -#endif - -#if !defined(mul16_ppmm) && defined(mul16_ppmma) -#define mul16_ppmm(ph,pl,x,y) mul16_ppmma(ph,pl,x,y,0) -#endif - -/* - * Use this definition to test the mul16_ppmm-based operations on machines - * that do not provide mul16_ppmm. Change the final "0" to a "1" to - * enable it. - */ -#if !defined(mul16_ppmm) && defined(BNWORD32) && 0 /* Debugging */ -#define mul16_ppmm(ph,pl,x,y) \ - ({BNWORD32 _ = (BNWORD32)(x)*(y); (pl) = _; (ph) = _>>16;}) -#endif - -#if defined(mul16_ppmm) && !defined(mul16_ppmma) -#define mul16_ppmma(ph,pl,x,y,a) \ - (mul16_ppmm(ph,pl,x,y), (ph) += ((pl) += (a)) < (a)) -#endif - -#if defined(mul16_ppmma) && !defined(mul16_ppmmaa) -#define mul16_ppmmaa(ph,pl,x,y,a,b) \ - (mul16_ppmma(ph,pl,x,y,a), (ph) += ((pl) += (b)) < (b)) -#endif - -/* - * lbnMulN1_16: Multiply an n-word input by a 1-word input and store the - * n+1-word product. This uses either the mul16_ppmm and mul16_ppmma - * macros, or C multiplication with the BNWORD32 type. This uses mul16_ppmma - * if available, assuming you won't bother defining it unless you can do - * better than the normal multiplication. - */ -#ifndef lbnMulN1_16 -#ifdef lbnMulAdd1_16 /* If we have this asm primitive, use it. */ -void -lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - lbnZero_16(out, len); - BIGLITTLE(*(out-len-1),*(out+len)) = lbnMulAdd1_16(out, in, len, k); -} -#elif defined(mul16_ppmm) -void -lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD16 carry, carryin; - - assert(len > 0); - - BIG(--out;--in;); - mul16_ppmm(carry, *out, *in, k); - LITTLE(out++;in++;) - - while (--len) { - BIG(--out;--in;) - carryin = carry; - mul16_ppmma(carry, *out, *in, k, carryin); - LITTLE(out++;in++;) - } - BIGLITTLE(*--out,*out) = carry; -} -#elif defined(BNWORD32) -void -lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD32 p; - - assert(len > 0); - - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k; - BIGLITTLE(*--out,*out++) = (BNWORD16)p; - - while (--len) { - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k + (BNWORD16)(p >> 16); - BIGLITTLE(*--out,*out++) = (BNWORD16)p; - } - BIGLITTLE(*--out,*out) = (BNWORD16)(p >> 16); -} -#else -#error No 16x16 -> 32 multiply available for 16-bit bignum package -#endif -#endif /* lbnMulN1_16 */ - -/* - * lbnMulAdd1_16: Multiply an n-word input by a 1-word input and add the - * low n words of the product to the destination. *Returns the n+1st word - * of the product.* (That turns out to be more convenient than adding - * it into the destination and dealing with a possible unit carry out - * of *that*.) This uses either the mul16_ppmma and mul16_ppmmaa macros, - * or C multiplication with the BNWORD32 type. - * - * If you're going to write assembly primitives, this is the one to - * start with. It is by far the most commonly called function. - */ -#ifndef lbnMulAdd1_16 -#if defined(mul16_ppmm) -BNWORD16 -lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD16 prod, carry, carryin; - - assert(len > 0); - - BIG(--out;--in;); - carryin = *out; - mul16_ppmma(carry, *out, *in, k, carryin); - LITTLE(out++;in++;) - - while (--len) { - BIG(--out;--in;); - carryin = carry; - mul16_ppmmaa(carry, prod, *in, k, carryin, *out); - *out = prod; - LITTLE(out++;in++;) - } - - return carry; -} -#elif defined(BNWORD32) -BNWORD16 -lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD32 p; - - assert(len > 0); - - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k + BIGLITTLE(*--out,*out); - BIGLITTLE(*out,*out++) = (BNWORD16)p; - - while (--len) { - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k + - (BNWORD16)(p >> 16) + BIGLITTLE(*--out,*out); - BIGLITTLE(*out,*out++) = (BNWORD16)p; - } - - return (BNWORD16)(p >> 16); -} -#else -#error No 16x16 -> 32 multiply available for 16-bit bignum package -#endif -#endif /* lbnMulAdd1_16 */ - -/* - * lbnMulSub1_16: Multiply an n-word input by a 1-word input and subtract the - * n-word product from the destination. Returns the n+1st word of the product. - * This uses either the mul16_ppmm and mul16_ppmma macros, or - * C multiplication with the BNWORD32 type. - * - * This is rather uglier than adding, but fortunately it's only used in - * division which is not used too heavily. - */ -#ifndef lbnMulSub1_16 -#if defined(mul16_ppmm) -BNWORD16 -lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD16 prod, carry, carryin; - - assert(len > 0); - - BIG(--in;) - mul16_ppmm(carry, prod, *in, k); - LITTLE(in++;) - carry += (BIGLITTLE(*--out,*out++) -= prod) > (BNWORD16)~prod; - - while (--len) { - BIG(--in;); - carryin = carry; - mul16_ppmma(carry, prod, *in, k, carryin); - LITTLE(in++;) - carry += (BIGLITTLE(*--out,*out++) -= prod) > (BNWORD16)~prod; - } - - return carry; -} -#elif defined(BNWORD32) -BNWORD16 -lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - BNWORD32 p; - BNWORD16 carry, t; - - assert(len > 0); - - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k; - t = BIGLITTLE(*--out,*out); - carry = (BNWORD16)(p>>16) + ((BIGLITTLE(*out,*out++)=t-(BNWORD16)p) > t); - - while (--len) { - p = (BNWORD32)BIGLITTLE(*--in,*in++) * k + carry; - t = BIGLITTLE(*--out,*out); - carry = (BNWORD16)(p>>16) + - ( (BIGLITTLE(*out,*out++)=t-(BNWORD16)p) > t ); - } - - return carry; -} -#else -#error No 16x16 -> 32 multiply available for 16-bit bignum package -#endif -#endif /* !lbnMulSub1_16 */ - -/* - * Shift n words left "shift" bits. 0 < shift < 16. Returns the - * carry, any bits shifted off the left-hand side (0 <= carry < 2^shift). - */ -#ifndef lbnLshift_16 -BNWORD16 -lbnLshift_16(BNWORD16 *num, unsigned len, unsigned shift) -{ - BNWORD16 x, carry; - - assert(shift > 0); - assert(shift < 16); - - carry = 0; - while (len--) { - BIG(--num;) - x = *num; - *num = (x<<shift) | carry; - LITTLE(num++;) - carry = x >> (16-shift); - } - return carry; -} -#endif /* !lbnLshift_16 */ - -/* - * An optimized version of the above, for shifts of 1. - * Some machines can use add-with-carry tricks for this. - */ -#ifndef lbnDouble_16 -BNWORD16 -lbnDouble_16(BNWORD16 *num, unsigned len) -{ - BNWORD16 x, carry; - - carry = 0; - while (len--) { - BIG(--num;) - x = *num; - *num = (x<<1) | carry; - LITTLE(num++;) - carry = x >> (16-1); - } - return carry; -} -#endif /* !lbnDouble_16 */ - -/* - * Shift n words right "shift" bits. 0 < shift < 16. Returns the - * carry, any bits shifted off the right-hand side (0 <= carry < 2^shift). - */ -#ifndef lbnRshift_16 -BNWORD16 -lbnRshift_16(BNWORD16 *num, unsigned len, unsigned shift) -{ - BNWORD16 x, carry = 0; - - assert(shift > 0); - assert(shift < 16); - - BIGLITTLE(num -= len, num += len); - - while (len--) { - LITTLE(--num;) - x = *num; - *num = (x>>shift) | carry; - BIG(num++;) - carry = x << (16-shift); - } - return carry >> (16-shift); -} -#endif /* !lbnRshift_16 */ - -/* - * Multiply two numbers of the given lengths. prod and num2 may overlap, - * provided that the low len1 bits of prod are free. (This corresponds - * nicely to the place the result is returned from lbnMontReduce_16.) - * - * TODO: Use Karatsuba multiply. The overlap constraints may have - * to get rewhacked. - */ -#ifndef lbnMul_16 -void -lbnMul_16(BNWORD16 *prod, BNWORD16 const *num1, unsigned len1, - BNWORD16 const *num2, unsigned len2) -{ - /* Special case of zero */ - if (!len1 || !len2) { - lbnZero_16(prod, len1+len2); - return; - } - - /* Multiply first word */ - lbnMulN1_16(prod, num1, len1, BIGLITTLE(*--num2,*num2++)); - - /* - * Add in subsequent words, storing the most significant word, - * which is new each time. - */ - while (--len2) { - BIGLITTLE(--prod,prod++); - BIGLITTLE(*(prod-len1-1),*(prod+len1)) = - lbnMulAdd1_16(prod, num1, len1, BIGLITTLE(*--num2,*num2++)); - } -} -#endif /* !lbnMul_16 */ - -/* - * lbnMulX_16 is a square multiply - both inputs are the same length. - * It's normally just a macro wrapper around the general multiply, - * but might be implementable in assembly more efficiently (such as - * when product scanning). - */ -#ifndef lbnMulX_16 -#if defined(BNWORD32) && PRODUCT_SCAN -/* - * Test code to see whether product scanning is any faster. It seems - * to make the C code slower, so PRODUCT_SCAN is not defined. - */ -static void -lbnMulX_16(BNWORD16 *prod, BNWORD16 const *num1, BNWORD16 const *num2, - unsigned len) -{ - BNWORD32 x, y; - BNWORD16 const *p1, *p2; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - x = (BNWORD32)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]); - BIGLITTLE(*--prod, *prod++) = (BNWORD16)x; - x >>= 16; - - for (i = 1; i < len; i++) { - carry = 0; - p1 = num1; - p2 = BIGLITTLE(num2-i-1,num2+i+1); - for (j = 0; j <= i; j++) { - BIG(y = (BNWORD32)*--p1 * *p2++;) - LITTLE(y = (BNWORD32)*p1++ * *--p2;) - x += y; - carry += (x < y); - } - BIGLITTLE(*--prod,*prod++) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - for (i = 1; i < len; i++) { - carry = 0; - p1 = BIGLITTLE(num1-i,num1+i); - p2 = BIGLITTLE(num2-len,num2+len); - for (j = i; j < len; j++) { - BIG(y = (BNWORD32)*--p1 * *p2++;) - LITTLE(y = (BNWORD32)*p1++ * *--p2;) - x += y; - carry += (x < y); - } - BIGLITTLE(*--prod,*prod++) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - - BIGLITTLE(*--prod,*prod) = (BNWORD16)x; -} -#else /* !defined(BNWORD32) || !PRODUCT_SCAN */ -/* Default trivial macro definition */ -#define lbnMulX_16(prod, num1, num2, len) lbnMul_16(prod, num1, len, num2, len) -#endif /* !defined(BNWORD32) || !PRODUCT_SCAN */ -#endif /* !lbmMulX_16 */ - -#if !defined(lbnMontMul_16) && defined(BNWORD32) && PRODUCT_SCAN -/* - * Test code for product-scanning multiply. This seems to slow the C - * code down rather than speed it up. - * This does a multiply and Montgomery reduction together, using the - * same loops. The outer loop scans across the product, twice. - * The first pass computes the low half of the product and the - * Montgomery multipliers. These are stored in the product array, - * which contains no data as of yet. x and carry add up the columns - * and propagate carries forward. - * - * The second half multiplies the upper half, adding in the modulus - * times the Montgomery multipliers. The results of this multiply - * are stored. - */ -static void -lbnMontMul_16(BNWORD16 *prod, BNWORD16 const *num1, BNWORD16 const *num2, - BNWORD16 const *mod, unsigned len, BNWORD16 inv) -{ - BNWORD32 x, y; - BNWORD16 const *p1, *p2, *pm; - BNWORD16 *pp; - BNWORD16 t; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - /* - * This computes directly into the high half of prod, so just - * shift the pointer and consider prod only "len" elements long - * for the rest of the code. - */ - BIGLITTLE(prod -= len, prod += len); - - /* Pass 1 - compute Montgomery multipliers */ - /* First iteration can have certain simplifications. */ - x = (BNWORD32)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]); - BIGLITTLE(prod[-1], prod[0]) = t = inv * (BNWORD16)x; - y = (BNWORD32)t * BIGLITTLE(mod[-1],mod[0]); - x += y; - /* Note: GCC 2.6.3 has a bug if you try to eliminate "carry" */ - carry = (x < y); - assert((BNWORD16)x == 0); - x = x >> 16 | (BNWORD32)carry << 16; - - for (i = 1; i < len; i++) { - carry = 0; - p1 = num1; - p2 = BIGLITTLE(num2-i-1,num2+i+1); - pp = prod; - pm = BIGLITTLE(mod-i-1,mod+i+1); - for (j = 0; j < i; j++) { - y = (BNWORD32)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2); - x += y; - carry += (x < y); - y = (BNWORD32)BIGLITTLE(*--pp * *pm++, *pp++ * *--pm); - x += y; - carry += (x < y); - } - y = (BNWORD32)BIGLITTLE(p1[-1] * p2[0], p1[0] * p2[-1]); - x += y; - carry += (x < y); - assert(BIGLITTLE(pp == prod-i, pp == prod+i)); - BIGLITTLE(pp[-1], pp[0]) = t = inv * (BNWORD16)x; - assert(BIGLITTLE(pm == mod-1, pm == mod+1)); - y = (BNWORD32)t * BIGLITTLE(pm[0],pm[-1]); - x += y; - carry += (x < y); - assert((BNWORD16)x == 0); - x = x >> 16 | (BNWORD32)carry << 16; - } - - /* Pass 2 - compute reduced product and store */ - for (i = 1; i < len; i++) { - carry = 0; - p1 = BIGLITTLE(num1-i,num1+i); - p2 = BIGLITTLE(num2-len,num2+len); - pm = BIGLITTLE(mod-i,mod+i); - pp = BIGLITTLE(prod-len,prod+len); - for (j = i; j < len; j++) { - y = (BNWORD32)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2); - x += y; - carry += (x < y); - y = (BNWORD32)BIGLITTLE(*--pm * *pp++, *pm++ * *--pp); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pm == mod-len, pm == mod+len)); - assert(BIGLITTLE(pp == prod-i, pp == prod+i)); - BIGLITTLE(pp[0],pp[-1]) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - - /* Last round of second half, simplified. */ - BIGLITTLE(*(prod-len),*(prod+len-1)) = (BNWORD16)x; - carry = (x >> 16); - - while (carry) - carry -= lbnSubN_16(prod, mod, len); - while (lbnCmp_16(prod, mod, len) >= 0) - (void)lbnSubN_16(prod, mod, len); -} -/* Suppress later definition */ -#define lbnMontMul_16 lbnMontMul_16 -#endif - -#if !defined(lbnSquare_16) && defined(BNWORD32) && PRODUCT_SCAN -/* - * Trial code for product-scanning squaring. This seems to slow the C - * code down rather than speed it up. - */ -void -lbnSquare_16(BNWORD16 *prod, BNWORD16 const *num, unsigned len) -{ - BNWORD32 x, y, z; - BNWORD16 const *p1, *p2; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - /* Word 0 of product */ - x = (BNWORD32)BIGLITTLE(num[-1] * num[-1], num[0] * num[0]); - BIGLITTLE(*--prod, *prod++) = (BNWORD16)x; - x >>= 16; - - /* Words 1 through len-1 */ - for (i = 1; i < len; i++) { - carry = 0; - y = 0; - p1 = num; - p2 = BIGLITTLE(num-i-1,num+i+1); - for (j = 0; j < (i+1)/2; j++) { - BIG(z = (BNWORD32)*--p1 * *p2++;) - LITTLE(z = (BNWORD32)*p1++ * *--p2;) - y += z; - carry += (y < z); - } - y += z = y; - carry += carry + (y < z); - if ((i & 1) == 0) { - assert(BIGLITTLE(--p1 == p2, p1 == --p2)); - BIG(z = (BNWORD32)*p2 * *p2;) - LITTLE(z = (BNWORD32)*p1 * *p1;) - y += z; - carry += (y < z); - } - x += y; - carry += (x < y); - BIGLITTLE(*--prod,*prod++) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - /* Words len through 2*len-2 */ - for (i = 1; i < len; i++) { - carry = 0; - y = 0; - p1 = BIGLITTLE(num-i,num+i); - p2 = BIGLITTLE(num-len,num+len); - for (j = 0; j < (len-i)/2; j++) { - BIG(z = (BNWORD32)*--p1 * *p2++;) - LITTLE(z = (BNWORD32)*p1++ * *--p2;) - y += z; - carry += (y < z); - } - y += z = y; - carry += carry + (y < z); - if ((len-i) & 1) { - assert(BIGLITTLE(--p1 == p2, p1 == --p2)); - BIG(z = (BNWORD32)*p2 * *p2;) - LITTLE(z = (BNWORD32)*p1 * *p1;) - y += z; - carry += (y < z); - } - x += y; - carry += (x < y); - BIGLITTLE(*--prod,*prod++) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - - /* Word 2*len-1 */ - BIGLITTLE(*--prod,*prod) = (BNWORD16)x; -} -/* Suppress later definition */ -#define lbnSquare_16 lbnSquare_16 -#endif - -/* - * Square a number, using optimized squaring to reduce the number of - * primitive multiples that are executed. There may not be any - * overlap of the input and output. - * - * Technique: Consider the partial products in the multiplication - * of "abcde" by itself: - * - * a b c d e - * * a b c d e - * ================== - * ae be ce de ee - * ad bd cd dd de - * ac bc cc cd ce - * ab bb bc bd be - * aa ab ac ad ae - * - * Note that everything above the main diagonal: - * ae be ce de = (abcd) * e - * ad bd cd = (abc) * d - * ac bc = (ab) * c - * ab = (a) * b - * - * is a copy of everything below the main diagonal: - * de - * cd ce - * bc bd be - * ab ac ad ae - * - * Thus, the sum is 2 * (off the diagonal) + diagonal. - * - * This is accumulated beginning with the diagonal (which - * consist of the squares of the digits of the input), which is then - * divided by two, the off-diagonal added, and multiplied by two - * again. The low bit is simply a copy of the low bit of the - * input, so it doesn't need special care. - * - * TODO: Merge the shift by 1 with the squaring loop. - * TODO: Use Karatsuba. (a*W+b)^2 = a^2 * (W^2+W) + b^2 * (W+1) - (a-b)^2 * W. - */ -#ifndef lbnSquare_16 -void -lbnSquare_16(BNWORD16 *prod, BNWORD16 const *num, unsigned len) -{ - BNWORD16 t; - BNWORD16 *prodx = prod; /* Working copy of the argument */ - BNWORD16 const *numx = num; /* Working copy of the argument */ - unsigned lenx = len; /* Working copy of the argument */ - - if (!len) - return; - - /* First, store all the squares */ - while (lenx--) { -#ifdef mul16_ppmm - BNWORD16 ph, pl; - t = BIGLITTLE(*--numx,*numx++); - mul16_ppmm(ph,pl,t,t); - BIGLITTLE(*--prodx,*prodx++) = pl; - BIGLITTLE(*--prodx,*prodx++) = ph; -#elif defined(BNWORD32) /* use BNWORD32 */ - BNWORD32 p; - t = BIGLITTLE(*--numx,*numx++); - p = (BNWORD32)t * t; - BIGLITTLE(*--prodx,*prodx++) = (BNWORD16)p; - BIGLITTLE(*--prodx,*prodx++) = (BNWORD16)(p>>16); -#else /* Use lbnMulN1_16 */ - t = BIGLITTLE(numx[-1],*numx); - lbnMulN1_16(prodx, numx, 1, t); - BIGLITTLE(--numx,numx++); - BIGLITTLE(prodx -= 2, prodx += 2); -#endif - } - /* Then, shift right 1 bit */ - (void)lbnRshift_16(prod, 2*len, 1); - - /* Then, add in the off-diagonal sums */ - lenx = len; - numx = num; - prodx = prod; - while (--lenx) { - t = BIGLITTLE(*--numx,*numx++); - BIGLITTLE(--prodx,prodx++); - t = lbnMulAdd1_16(prodx, numx, lenx, t); - lbnAdd1_16(BIGLITTLE(prodx-lenx,prodx+lenx), lenx+1, t); - BIGLITTLE(--prodx,prodx++); - } - - /* Shift it back up */ - lbnDouble_16(prod, 2*len); - - /* And set the low bit appropriately */ - BIGLITTLE(prod[-1],prod[0]) |= BIGLITTLE(num[-1],num[0]) & 1; -} -#endif /* !lbnSquare_16 */ - -/* - * lbnNorm_16 - given a number, return a modified length such that the - * most significant digit is non-zero. Zero-length input is okay. - */ -#ifndef lbnNorm_16 -unsigned -lbnNorm_16(BNWORD16 const *num, unsigned len) -{ - BIGLITTLE(num -= len,num += len); - while (len && BIGLITTLE(*num++,*--num) == 0) - --len; - return len; -} -#endif /* lbnNorm_16 */ - -/* - * lbnBits_16 - return the number of significant bits in the array. - * It starts by normalizing the array. Zero-length input is okay. - * Then assuming there's anything to it, it fetches the high word, - * generates a bit length by multiplying the word length by 16, and - * subtracts off 16/2, 16/4, 16/8, ... bits if the high bits are clear. - */ -#ifndef lbnBits_16 -unsigned -lbnBits_16(BNWORD16 const *num, unsigned len) -{ - BNWORD16 t; - unsigned i; - - len = lbnNorm_16(num, len); - if (len) { - t = BIGLITTLE(*(num-len),*(num+(len-1))); - assert(t); - len *= 16; - i = 16/2; - do { - if (t >> i) - t >>= i; - else - len -= i; - } while ((i /= 2) != 0); - } - return len; -} -#endif /* lbnBits_16 */ - -/* - * If defined, use hand-rolled divide rather than compiler's native. - * If the machine doesn't do it in line, the manual code is probably - * faster, since it can assume normalization and the fact that the - * quotient will fit into 16 bits, which a general 32-bit divide - * in a compiler's run-time library can't do. - */ -#ifndef BN_SLOW_DIVIDE_32 -/* Assume that divisors of more than thirty-two bits are slow */ -#define BN_SLOW_DIVIDE_32 (32 > 0x20) -#endif - -/* - * Return (nh<<16|nl) % d, and place the quotient digit into *q. - * It is guaranteed that nh < d, and that d is normalized (with its high - * bit set). If we have a double-width type, it's easy. If not, ooh, - * yuk! - */ -#ifndef lbnDiv21_16 -#if defined(BNWORD32) && !BN_SLOW_DIVIDE_32 -BNWORD16 -lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d) -{ - BNWORD32 n = (BNWORD32)nh << 16 | nl; - - /* Divisor must be normalized */ - assert(d >> (16-1) == 1); - - *q = n / d; - return n % d; -} -#else -/* - * This is where it gets ugly. - * - * Do the division in two halves, using Algorithm D from section 4.3.1 - * of Knuth. Note Theorem B from that section, that the quotient estimate - * is never more than the true quotient, and is never more than two - * too low. - * - * The mapping onto conventional long division is (everything a half word): - * _____________qh___ql_ - * dh dl ) nh.h nh.l nl.h nl.l - * - (qh * d) - * ----------- - * rrrr rrrr nl.l - * - (ql * d) - * ----------- - * rrrr rrrr - * - * The implicit 3/2-digit d*qh and d*ql subtractors are computed this way: - * First, estimate a q digit so that nh/dh works. Subtracting qh*dh from - * the (nh.h nh.l) list leaves a 1/2-word remainder r. Then compute the - * low part of the subtractor, qh * dl. This also needs to be subtracted - * from (nh.h nh.l nl.h) to get the final remainder. So we take the - * remainder, which is (nh.h nh.l) - qh*dl, shift it and add in nl.h, and - * try to subtract qh * dl from that. Since the remainder is 1/2-word - * long, shifting and adding nl.h results in a single word r. - * It is possible that the remainder we're working with, r, is less than - * the product qh * dl, if we estimated qh too high. The estimation - * technique can produce a qh that is too large (never too small), leading - * to r which is too small. In that case, decrement the digit qh, add - * shifted dh to r (to correct for that error), and subtract dl from the - * product we're comparing r with. That's the "correct" way to do it, but - * just adding dl to r instead of subtracting it from the product is - * equivalent and a lot simpler. You just have to watch out for overflow. - * - * The process is repeated with (rrrr rrrr nl.l) for the low digit of the - * quotient ql. - * - * The various uses of 16/2 for shifts are because of the note about - * automatic editing of this file at the very top of the file. - */ -#define highhalf(x) ( (x) >> 16/2 ) -#define lowhalf(x) ( (x) & (((BNWORD16)1 << 16/2)-1) ) -BNWORD16 -lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d) -{ - BNWORD16 dh = highhalf(d), dl = lowhalf(d); - BNWORD16 qh, ql, prod, r; - - /* Divisor must be normalized */ - assert((d >> (16-1)) == 1); - - /* Do first half-word of division */ - qh = nh / dh; - r = nh % dh; - prod = qh * dl; - - /* - * Add next half-word of numerator to remainder and correct. - * qh may be up to two too large. - */ - r = (r << (16/2)) | highhalf(nl); - if (r < prod) { - --qh; r += d; - if (r >= d && r < prod) { - --qh; r += d; - } - } - r -= prod; - - /* Do second half-word of division */ - ql = r / dh; - r = r % dh; - prod = ql * dl; - - r = (r << (16/2)) | lowhalf(nl); - if (r < prod) { - --ql; r += d; - if (r >= d && r < prod) { - --ql; r += d; - } - } - r -= prod; - - *q = (qh << (16/2)) | ql; - - return r; -} -#endif -#endif /* lbnDiv21_16 */ - - -/* - * In the division functions, the dividend and divisor are referred to - * as "n" and "d", which stand for "numerator" and "denominator". - * - * The quotient is (nlen-dlen+1) digits long. It may be overlapped with - * the high (nlen-dlen) words of the dividend, but one extra word is needed - * on top to hold the top word. - */ - -/* - * Divide an n-word number by a 1-word number, storing the remainder - * and n-1 words of the n-word quotient. The high word is returned. - * It IS legal for rem to point to the same address as n, and for - * q to point one word higher. - * - * TODO: If BN_SLOW_DIVIDE_32, add a divnhalf_16 which uses 16-bit - * dividends if the divisor is half that long. - * TODO: Shift the dividend on the fly to avoid the last division and - * instead have a remainder that needs shifting. - * TODO: Use reciprocals rather than dividing. - */ -#ifndef lbnDiv1_16 -BNWORD16 -lbnDiv1_16(BNWORD16 *q, BNWORD16 *rem, BNWORD16 const *n, unsigned len, - BNWORD16 d) -{ - unsigned shift; - unsigned xlen; - BNWORD16 r; - BNWORD16 qhigh; - - assert(len > 0); - assert(d); - - if (len == 1) { - r = *n; - *rem = r%d; - return r/d; - } - - shift = 0; - r = d; - xlen = 16/2; - do { - if (r >> xlen) - r >>= xlen; - else - shift += xlen; - } while ((xlen /= 2) != 0); - assert((d >> (16-1-shift)) == 1); - d <<= shift; - - BIGLITTLE(q -= len-1,q += len-1); - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - if (r < d) { - qhigh = 0; - } else { - qhigh = r/d; - r %= d; - } - - xlen = len; - while (--xlen) - r = lbnDiv21_16(BIGLITTLE(q++,--q), r, BIGLITTLE(*n++,*--n), d); - - /* - * Final correction for shift - shift the quotient up "shift" - * bits, and merge in the extra bits of quotient. Then reduce - * the final remainder mod the real d. - */ - if (shift) { - d >>= shift; - qhigh = (qhigh << shift) | lbnLshift_16(q, len-1, shift); - BIGLITTLE(q[-1],*q) |= r/d; - r %= d; - } - *rem = r; - - return qhigh; -} -#endif - -/* - * This function performs a "quick" modulus of a number with a divisor - * d which is guaranteed to be at most sixteen bits, i.e. less than 65536. - * This applies regardless of the word size the library is compiled with. - * - * This function is important to prime generation, for sieving. - */ -#ifndef lbnModQ_16 -/* If there's a custom lbnMod21_16, no normalization needed */ -#ifdef lbnMod21_16 -unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d) -{ - unsigned i, shift; - BNWORD16 r; - - assert(len > 0); - - BIGLITTLE(n -= len,n += len); - - /* Try using a compare to avoid the first divide */ - r = BIGLITTLE(*n++,*--n); - if (r >= d) - r %= d; - while (--len) - r = lbnMod21_16(r, BIGLITTLE(*n++,*--n), d); - - return r; -} -#elif defined(BNWORD32) && !BN_SLOW_DIVIDE_32 -unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d) -{ - BNWORD16 r; - - if (!--len) - return BIGLITTLE(n[-1],n[0]) % d; - - BIGLITTLE(n -= len,n += len); - r = BIGLITTLE(n[-1],n[0]); - - do { - r = (BNWORD16)((((BNWORD32)r<<16) | BIGLITTLE(*n++,*--n)) % d); - } while (--len); - - return r; -} -#elif 16 >= 0x20 -/* - * If the single word size can hold 65535*65536, then this function - * is avilable. - */ -#ifndef highhalf -#define highhalf(x) ( (x) >> 16/2 ) -#define lowhalf(x) ( (x) & ((1 << 16/2)-1) ) -#endif -unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d) -{ - BNWORD16 r, x; - - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - while (--len) { - x = BIGLITTLE(*n++,*--n); - r = (r%d << 16/2) | highhalf(x); - r = (r%d << 16/2) | lowhalf(x); - } - - return r%d; -} -#else -/* Default case - use lbnDiv21_16 */ -unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d) -{ - unsigned i, shift; - BNWORD16 r; - BNWORD16 q; - - assert(len > 0); - - shift = 0; - r = d; - i = 16; - while (i /= 2) { - if (r >> i) - r >>= i; - else - shift += i; - } - assert(d >> (16-1-shift) == 1); - d <<= shift; - - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - if (r >= d) - r %= d; - - while (--len) - r = lbnDiv21_16(&q, r, BIGLITTLE(*n++,*--n), d); - - /* - * Final correction for shift - shift the quotient up "shift" - * bits, and merge in the extra bits of quotient. Then reduce - * the final remainder mod the real d. - */ - if (shift) - r %= d >> shift; - - return r; -} -#endif -#endif /* lbnModQ_16 */ - -/* - * Reduce n mod d and return the quotient. That is, find: - * q = n / d; - * n = n % d; - * d is altered during the execution of this subroutine by normalizing it. - * It must already have its most significant word non-zero; it is shifted - * so its most significant bit is non-zero. - * - * The quotient q is nlen-dlen+1 words long. To make it possible to - * overlap the quptient with the input (you can store it in the high dlen - * words), the high word of the quotient is *not* stored, but is returned. - * (If all you want is the remainder, you don't care about it, anyway.) - * - * This uses algorithm D from Knuth (4.3.1), except that we do binary - * (shift) normalization of the divisor. WARNING: This is hairy! - * - * This function is used for some modular reduction, but it is not used in - * the modular exponentiation loops; they use Montgomery form and the - * corresponding, more efficient, Montgomery reduction. This code - * is needed for the conversion to Montgomery form, however, so it - * has to be here and it might as well be reasonably efficient. - * - * The overall operation is as follows ("top" and "up" refer to the - * most significant end of the number; "bottom" and "down", the least): - * - * - Shift the divisor up until the most significant bit is set. - * - Shift the dividend up the same amount. This will produce the - * correct quotient, and the remainder can be recovered by shifting - * it back down the same number of bits. This may produce an overflow - * word, but the word is always strictly less than the most significant - * divisor word. - * - Estimate the first quotient digit qhat: - * - First take the top two words (one of which is the overflow) of the - * dividend and divide by the top word of the divisor: - * qhat = (nh,nm)/dh. This qhat is >= the correct quotient digit - * and, since dh is normalized, it is at most two over. - * - Second, correct by comparing the top three words. If - * (dh,dl) * qhat > (nh,nm,ml), decrease qhat and try again. - * The second iteration can be simpler because there can't be a third. - * The computation can be simplified by subtracting dh*qhat from - * both sides, suitably shifted. This reduces the left side to - * dl*qhat. On the right, (nh,nm)-dh*qhat is simply the - * remainder r from (nh,nm)%dh, so the right is (r,nl). - * This produces qhat that is almost always correct and at - * most (prob ~ 2/2^16) one too high. - * - Subtract qhat times the divisor (suitably shifted) from the dividend. - * If there is a borrow, qhat was wrong, so decrement it - * and add the divisor back in (once). - * - Store the final quotient digit qhat in the quotient array q. - * - * Repeat the quotient digit computation for successive digits of the - * quotient until the whole quotient has been computed. Then shift the - * divisor and the remainder down to correct for the normalization. - * - * TODO: Special case 2-word divisors. - * TODO: Use reciprocals rather than dividing. - */ -#ifndef divn_16 -BNWORD16 -lbnDiv_16(BNWORD16 *q, BNWORD16 *n, unsigned nlen, BNWORD16 *d, unsigned dlen) -{ - BNWORD16 nh,nm,nl; /* Top three words of the dividend */ - BNWORD16 dh,dl; /* Top two words of the divisor */ - BNWORD16 qhat; /* Extimate of quotient word */ - BNWORD16 r; /* Remainder from quotient estimate division */ - BNWORD16 qhigh; /* High word of quotient */ - unsigned i; /* Temp */ - unsigned shift; /* Bits shifted by normalization */ - unsigned qlen = nlen-dlen; /* Size of quotient (less 1) */ -#ifdef mul16_ppmm - BNWORD16 t16; -#elif defined(BNWORD32) - BNWORD32 t32; -#else /* use lbnMulN1_16 */ - BNWORD16 t2[2]; -#define t2high BIGLITTLE(t2[0],t2[1]) -#define t2low BIGLITTLE(t2[1],t2[0]) -#endif - - assert(dlen); - assert(nlen >= dlen); - - /* - * Special cases for short divisors. The general case uses the - * top top 2 digits of the divisor (d) to estimate a quotient digit, - * so it breaks if there are fewer digits available. Thus, we need - * special cases for a divisor of length 1. A divisor of length - * 2 can have a *lot* of administrivia overhead removed removed, - * so it's probably worth special-casing that case, too. - */ - if (dlen == 1) - return lbnDiv1_16(q, BIGLITTLE(n-1,n), n, nlen, - BIGLITTLE(d[-1],d[0])); - -#if 0 - /* - * @@@ This is not yet written... The general loop will do, - * albeit less efficiently - */ - if (dlen == 2) { - /* - * divisor two digits long: - * use the 3/2 technique from Knuth, but we know - * it's exact. - */ - dh = BIGLITTLE(d[-1],d[0]); - dl = BIGLITTLE(d[-2],d[1]); - shift = 0; - if ((sh & ((BNWORD16)1 << 16-1-shift)) == 0) { - do { - shift++; - } while (dh & (BNWORD16)1<<16-1-shift) == 0); - dh = dh << shift | dl >> (16-shift); - dl <<= shift; - - - } - - - for (shift = 0; (dh & (BNWORD16)1 << 16-1-shift)) == 0; shift++) - ; - if (shift) { - } - dh = dh << shift | dl >> (16-shift); - shift = 0; - while (dh - } -#endif - - dh = BIGLITTLE(*(d-dlen),*(d+(dlen-1))); - assert(dh); - - /* Normalize the divisor */ - shift = 0; - r = dh; - i = 16/2; - do { - if (r >> i) - r >>= i; - else - shift += i; - } while ((i /= 2) != 0); - - nh = 0; - if (shift) { - lbnLshift_16(d, dlen, shift); - dh = BIGLITTLE(*(d-dlen),*(d+(dlen-1))); - nh = lbnLshift_16(n, nlen, shift); - } - - /* Assert that dh is now normalized */ - assert(dh >> (16-1)); - - /* Also get the second-most significant word of the divisor */ - dl = BIGLITTLE(*(d-(dlen-1)),*(d+(dlen-2))); - - /* - * Adjust pointers: n to point to least significant end of first - * first subtract, and q to one the most-significant end of the - * quotient array. - */ - BIGLITTLE(n -= qlen,n += qlen); - BIGLITTLE(q -= qlen,q += qlen); - - /* Fetch the most significant stored word of the dividend */ - nm = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - - /* - * Compute the first digit of the quotient, based on the - * first two words of the dividend (the most significant of which - * is the overflow word h). - */ - if (nh) { - assert(nh < dh); - r = lbnDiv21_16(&qhat, nh, nm, dh); - } else if (nm >= dh) { - qhat = nm/dh; - r = nm % dh; - } else { /* Quotient is zero */ - qhigh = 0; - goto divloop; - } - - /* Now get the third most significant word of the dividend */ - nl = BIGLITTLE(*(n-(dlen-1)),*(n+(dlen-2))); - - /* - * Correct qhat, the estimate of quotient digit. - * qhat can only be high, and at most two words high, - * so the loop can be unrolled and abbreviated. - */ -#ifdef mul16_ppmm - mul16_ppmm(nm, t16, qhat, dl); - if (nm > r || (nm == r && t16 > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - nm -= (t16 < dl); - t16 -= dl; - if (nm > r || (nm == r && t16 > nl)) - qhat--; - } - } -#elif defined(BNWORD32) - t32 = (BNWORD32)qhat * dl; - if (t32 > ((BNWORD32)r << 16) + nl) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) > dh) { - t32 -= dl; - if (t32 > ((BNWORD32)r << 16) + nl) - qhat--; - } - } -#else /* Use lbnMulN1_16 */ - lbnMulN1_16(BIGLITTLE(t2+2,t2), &dl, 1, qhat); - if (t2high > r || (t2high == r && t2low > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t2high -= (t2low < dl); - t2low -= dl; - if (t2high > r || (t2high == r && t2low > nl)) - qhat--; - } - } -#endif - - /* Do the multiply and subtract */ - r = lbnMulSub1_16(n, d, dlen, qhat); - /* If there was a borrow, add back once. */ - if (r > nh) { /* Borrow? */ - (void)lbnAddN_16(n, d, dlen); - qhat--; - } - - /* Remember the first quotient digit. */ - qhigh = qhat; - - /* Now, the main division loop: */ -divloop: - while (qlen--) { - - /* Advance n */ - nh = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - BIGLITTLE(++n,--n); - nm = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - - if (nh == dh) { - qhat = ~(BNWORD16)0; - /* Optimized computation of r = (nh,nm) - qhat * dh */ - r = nh + nm; - if (r < nh) - goto subtract; - } else { - assert(nh < dh); - r = lbnDiv21_16(&qhat, nh, nm, dh); - } - - nl = BIGLITTLE(*(n-(dlen-1)),*(n+(dlen-2))); -#ifdef mul16_ppmm - mul16_ppmm(nm, t16, qhat, dl); - if (nm > r || (nm == r && t16 > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - nm -= (t16 < dl); - t16 -= dl; - if (nm > r || (nm == r && t16 > nl)) - qhat--; - } - } -#elif defined(BNWORD32) - t32 = (BNWORD32)qhat * dl; - if (t32 > ((BNWORD32)r<<16) + nl) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t32 -= dl; - if (t32 > ((BNWORD32)r << 16) + nl) - qhat--; - } - } -#else /* Use lbnMulN1_16 */ - lbnMulN1_16(BIGLITTLE(t2+2,t2), &dl, 1, qhat); - if (t2high > r || (t2high == r && t2low > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t2high -= (t2low < dl); - t2low -= dl; - if (t2high > r || (t2high == r && t2low > nl)) - qhat--; - } - } -#endif - - /* - * As a point of interest, note that it is not worth checking - * for qhat of 0 or 1 and installing special-case code. These - * occur with probability 2^-16, so spending 1 cycle to check - * for them is only worth it if we save more than 2^15 cycles, - * and a multiply-and-subtract for numbers in the 1024-bit - * range just doesn't take that long. - */ -subtract: - /* - * n points to the least significant end of the substring - * of n to be subtracted from. qhat is either exact or - * one too large. If the subtract gets a borrow, it was - * one too large and the divisor is added back in. It's - * a dlen+1 word add which is guaranteed to produce a - * carry out, so it can be done very simply. - */ - r = lbnMulSub1_16(n, d, dlen, qhat); - if (r > nh) { /* Borrow? */ - (void)lbnAddN_16(n, d, dlen); - qhat--; - } - /* Store the quotient digit */ - BIGLITTLE(*q++,*--q) = qhat; - } - /* Tah dah! */ - - if (shift) { - lbnRshift_16(d, dlen, shift); - lbnRshift_16(n, dlen, shift); - } - - return qhigh; -} -#endif - -/* - * Find the negative multiplicative inverse of x (x must be odd!) modulo 2^16. - * - * This just performs Newton's iteration until it gets the - * inverse. The initial estimate is always correct to 3 bits, and - * sometimes 4. The number of valid bits doubles each iteration. - * (To prove it, assume x * y == 1 (mod 2^n), and introduce a variable - * for the error mod 2^2n. x * y == 1 + k*2^n (mod 2^2n) and follow - * the iteration through.) - */ -#ifndef lbnMontInv1_16 -BNWORD16 -lbnMontInv1_16(BNWORD16 const x) -{ - BNWORD16 y = x, z; - - assert(x & 1); - - while ((z = x*y) != 1) - y *= 2 - z; - return -y; -} -#endif /* !lbnMontInv1_16 */ - -#if defined(BNWORD32) && PRODUCT_SCAN -/* - * Test code for product-scanning Montgomery reduction. - * This seems to slow the C code down rather than speed it up. - * - * The first loop computes the Montgomery multipliers, storing them over - * the low half of the number n. - * - * The second half multiplies the upper half, adding in the modulus - * times the Montgomery multipliers. The results of this multiply - * are stored. - */ -void -lbnMontReduce_16(BNWORD16 *n, BNWORD16 const *mod, unsigned mlen, BNWORD16 inv) -{ - BNWORD32 x, y; - BNWORD16 const *pm; - BNWORD16 *pn; - BNWORD16 t; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!mlen) - return; - - /* Pass 1 - compute Montgomery multipliers */ - /* First iteration can have certain simplifications. */ - t = BIGLITTLE(n[-1],n[0]); - x = t; - t *= inv; - BIGLITTLE(n[-1], n[0]) = t; - x += (BNWORD32)t * BIGLITTLE(mod[-1],mod[0]); /* Can't overflow */ - assert((BNWORD16)x == 0); - x = x >> 16; - - for (i = 1; i < mlen; i++) { - carry = 0; - pn = n; - pm = BIGLITTLE(mod-i-1,mod+i+1); - for (j = 0; j < i; j++) { - y = (BNWORD32)BIGLITTLE(*--pn * *pm++, *pn++ * *--pm); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pn == n-i, pn == n+i)); - y = t = BIGLITTLE(pn[-1], pn[0]); - x += y; - carry += (x < y); - BIGLITTLE(pn[-1], pn[0]) = t = inv * (BNWORD16)x; - assert(BIGLITTLE(pm == mod-1, pm == mod+1)); - y = (BNWORD32)t * BIGLITTLE(pm[0],pm[-1]); - x += y; - carry += (x < y); - assert((BNWORD16)x == 0); - x = x >> 16 | (BNWORD32)carry << 16; - } - - BIGLITTLE(n -= mlen, n += mlen); - - /* Pass 2 - compute upper words and add to n */ - for (i = 1; i < mlen; i++) { - carry = 0; - pm = BIGLITTLE(mod-i,mod+i); - pn = n; - for (j = i; j < mlen; j++) { - y = (BNWORD32)BIGLITTLE(*--pm * *pn++, *pm++ * *--pn); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pm == mod-mlen, pm == mod+mlen)); - assert(BIGLITTLE(pn == n+mlen-i, pn == n-mlen+i)); - y = t = BIGLITTLE(*(n-i),*(n+i-1)); - x += y; - carry += (x < y); - BIGLITTLE(*(n-i),*(n+i-1)) = (BNWORD16)x; - x = (x >> 16) | (BNWORD32)carry << 16; - } - - /* Last round of second half, simplified. */ - t = BIGLITTLE(*(n-mlen),*(n+mlen-1)); - x += t; - BIGLITTLE(*(n-mlen),*(n+mlen-1)) = (BNWORD16)x; - carry = (unsigned)(x >> 16); - - while (carry) - carry -= lbnSubN_16(n, mod, mlen); - while (lbnCmp_16(n, mod, mlen) >= 0) - (void)lbnSubN_16(n, mod, mlen); -} -#define lbnMontReduce_16 lbnMontReduce_16 -#endif - -/* - * Montgomery reduce n, modulo mod. This reduces modulo mod and divides by - * 2^(16*mlen). Returns the result in the *top* mlen words of the argument n. - * This is ready for another multiplication using lbnMul_16. - * - * Montgomery representation is a very useful way to encode numbers when - * you're doing lots of modular reduction. What you do is pick a multiplier - * R which is relatively prime to the modulus and very easy to divide by. - * Since the modulus is odd, R is closen as a power of 2, so the division - * is a shift. In fact, it's a shift of an integral number of words, - * so the shift can be implicit - just drop the low-order words. - * - * Now, choose R *larger* than the modulus m, 2^(16*mlen). Then convert - * all numbers a, b, etc. to Montgomery form M(a), M(b), etc using the - * relationship M(a) = a*R mod m, M(b) = b*R mod m, etc. Note that: - * - The Montgomery form of a number depends on the modulus m. - * A fixed modulus m is assumed throughout this discussion. - * - Since R is relaitvely prime to m, multiplication by R is invertible; - * no information about the numbers is lost, they're just scrambled. - * - Adding (and subtracting) numbers in this form works just as usual. - * M(a+b) = (a+b)*R mod m = (a*R + b*R) mod m = (M(a) + M(b)) mod m - * - Multiplying numbers in this form produces a*b*R*R. The problem - * is to divide out the excess factor of R, modulo m as well as to - * reduce to the given length mlen. It turns out that this can be - * done *faster* than a normal divide, which is where the speedup - * in Montgomery division comes from. - * - * Normal reduction chooses a most-significant quotient digit q and then - * subtracts q*m from the number to be reduced. Choosing q is tricky - * and involved (just look at lbnDiv_16 to see!) and is usually - * imperfect, requiring a check for correction after the subtraction. - * - * Montgomery reduction *adds* a multiple of m to the *low-order* part - * of the number to be reduced. This multiple is chosen to make the - * low-order part of the number come out to zero. This can be done - * with no trickery or error using a precomputed inverse of the modulus. - * In this code, the "part" is one word, but any width can be used. - * - * Repeating this step sufficiently often results in a value which - * is a multiple of R (a power of two, remember) but is still (since - * the additions were to the low-order part and thus did not increase - * the value of the number being reduced very much) still not much - * larger than m*R. Then implicitly divide by R and subtract off - * m until the result is in the correct range. - * - * Since the low-order part being cancelled is less than R, the - * multiple of m added must have a multiplier which is at most R-1. - * Assuming that the input is at most m*R-1, the final number is - * at most m*(2*R-1)-1 = 2*m*R - m - 1, so subtracting m once from - * the high-order part, equivalent to subtracting m*R from the - * while number, produces a result which is at most m*R - m - 1, - * which divided by R is at most m-1. - * - * To convert *to* Montgomery form, you need a regular remainder - * routine, although you can just compute R*R (mod m) and do the - * conversion using Montgomery multiplication. To convert *from* - * Montgomery form, just Montgomery reduce the number to - * remove the extra factor of R. - * - * TODO: Change to a full inverse and use Karatsuba's multiplication - * rather than this word-at-a-time. - */ -#ifndef lbnMontReduce_16 -void -lbnMontReduce_16(BNWORD16 *n, BNWORD16 const *mod, unsigned const mlen, - BNWORD16 inv) -{ - BNWORD16 t; - BNWORD16 c = 0; - unsigned len = mlen; - - /* inv must be the negative inverse of mod's least significant word */ - assert((BNWORD16)(inv * BIGLITTLE(mod[-1],mod[0])) == (BNWORD16)-1); - - assert(len); - - do { - t = lbnMulAdd1_16(n, mod, mlen, inv * BIGLITTLE(n[-1],n[0])); - c += lbnAdd1_16(BIGLITTLE(n-mlen,n+mlen), len, t); - BIGLITTLE(--n,++n); - } while (--len); - - /* - * All that adding can cause an overflow past the modulus size, - * but it's unusual, and never by much, so a subtraction loop - * is the right way to deal with it. - * This subtraction happens infrequently - I've only ever seen it - * invoked once per reduction, and then just under 22.5% of the time. - */ - while (c) - c -= lbnSubN_16(n, mod, mlen); - while (lbnCmp_16(n, mod, mlen) >= 0) - (void)lbnSubN_16(n, mod, mlen); -} -#endif /* !lbnMontReduce_16 */ - -/* - * A couple of helpers that you might want to implement atomically - * in asm sometime. - */ -#ifndef lbnMontMul_16 -/* - * Multiply "num1" by "num2", modulo "mod", all of length "len", and - * place the result in the high half of "prod". "inv" is the inverse - * of the least-significant word of the modulus, modulo 2^16. - * This uses numbers in Montgomery form. Reduce using "len" and "inv". - * - * This is implemented as a macro to win on compilers that don't do - * inlining, since it's so trivial. - */ -#define lbnMontMul_16(prod, n1, n2, mod, len, inv) \ - (lbnMulX_16(prod, n1, n2, len), lbnMontReduce_16(prod, mod, len, inv)) -#endif /* !lbnMontMul_16 */ - -#ifndef lbnMontSquare_16 -/* - * Square "n", modulo "mod", both of length "len", and place the result - * in the high half of "prod". "inv" is the inverse of the least-significant - * word of the modulus, modulo 2^16. - * This uses numbers in Montgomery form. Reduce using "len" and "inv". - * - * This is implemented as a macro to win on compilers that don't do - * inlining, since it's so trivial. - */ -#define lbnMontSquare_16(prod, n, mod, len, inv) \ - (lbnSquare_16(prod, n, len), lbnMontReduce_16(prod, mod, len, inv)) - -#endif /* !lbnMontSquare_16 */ - -/* - * Convert a number to Montgomery form - requires mlen + nlen words - * of memory in "n". - */ -void -lbnToMont_16(BNWORD16 *n, unsigned nlen, BNWORD16 *mod, unsigned mlen) -{ - /* Move n up "mlen" words */ - lbnCopy_16(BIGLITTLE(n-mlen,n+mlen), n, nlen); - lbnZero_16(n, mlen); - /* Do the division - dump the quotient in the high-order words */ - (void)lbnDiv_16(BIGLITTLE(n-mlen,n+mlen), n, mlen+nlen, mod, mlen); -} - -/* - * Convert from Montgomery form. Montgomery reduction is all that is - * needed. - */ -void -lbnFromMont_16(BNWORD16 *n, BNWORD16 *mod, unsigned len) -{ - /* Zero the high words of n */ - lbnZero_16(BIGLITTLE(n-len,n+len), len); - lbnMontReduce_16(n, mod, len, lbnMontInv1_16(mod[BIGLITTLE(-1,0)])); - /* Move n down len words */ - lbnCopy_16(n, BIGLITTLE(n-len,n+len), len); -} - -/* - * The windowed exponentiation algorithm, precomputes a table of odd - * powers of n up to 2^k. See the comment in bnExpMod_16 below for - * an explanation of how it actually works works. - * - * It takes 2^(k-1)-1 multiplies to compute the table, and (e-1)/(k+1) - * multiplies (on average) to perform the exponentiation. To minimize - * the sum, k must vary with e. The optimal window sizes vary with the - * exponent length. Here are some selected values and the boundary cases. - * (An underscore _ has been inserted into some of the numbers to ensure - * that magic strings like 16 do not appear in this table. It should be - * ignored.) - * - * At e = 1 bits, k=1 (0.000000) is best - * At e = 2 bits, k=1 (0.500000) is best - * At e = 4 bits, k=1 (1.500000) is best - * At e = 8 bits, k=2 (3.333333) < k=1 (3.500000) - * At e = 1_6 bits, k=2 (6.000000) is best - * At e = 26 bits, k=3 (9.250000) < k=2 (9.333333) - * At e = 3_2 bits, k=3 (10.750000) is best - * At e = 6_4 bits, k=3 (18.750000) is best - * At e = 82 bits, k=4 (23.200000) < k=3 (23.250000) - * At e = 128 bits, k=4 (3_2.400000) is best - * At e = 242 bits, k=5 (55.1_66667) < k=4 (55.200000) - * At e = 256 bits, k=5 (57.500000) is best - * At e = 512 bits, k=5 (100.1_66667) is best - * At e = 674 bits, k=6 (127.142857) < k=5 (127.1_66667) - * At e = 1024 bits, k=6 (177.142857) is best - * At e = 1794 bits, k=7 (287.125000) < k=6 (287.142857) - * At e = 2048 bits, k=7 (318.875000) is best - * At e = 4096 bits, k=7 (574.875000) is best - * - * The numbers in parentheses are the expected number of multiplications - * needed to do the computation. The normal russian-peasant modular - * exponentiation technique always uses (e-1)/2. For exponents as - * small as 192 bits (below the range of current factoring algorithms), - * half of the multiplies are eliminated, 45.2 as opposed to the naive - * 95.5. Counting the 191 squarings as 3/4 a multiply each (squaring - * proper is just over half of multiplying, but the Montgomery - * reduction in each case is also a multiply), that's 143.25 - * multiplies, for totals of 188.45 vs. 238.75 - a 21% savings. - * For larger exponents (like 512 bits), it's 483.92 vs. 639.25, a - * 24.3% savings. It asymptotically approaches 25%. - * - * Um, actually there's a slightly more accurate way to count, which - * really is the average number of multiplies required, averaged - * uniformly over all 2^(e-1) e-bit numbers, from 2^(e-1) to (2^e)-1. - * It's based on the recurrence that for the last b bits, b <= k, at - * most one multiply is needed (and none at all 1/2^b of the time), - * while when b > k, the odds are 1/2 each way that the bit will be - * 0 (meaning no multiplies to reduce it to the b-1-bit case) and - * 1/2 that the bit will be 1, starting a k-bit window and requiring - * 1 multiply beyond the b-k-bit case. Since the most significant - * bit is always 1, a k-bit window always starts there, and that - * multiply is by 1, so it isn't a multiply at all. Thus, the - * number of multiplies is simply that needed for the last e-k bits. - * This recurrence produces: - * - * At e = 1 bits, k=1 (0.000000) is best - * At e = 2 bits, k=1 (0.500000) is best - * At e = 4 bits, k=1 (1.500000) is best - * At e = 6 bits, k=2 (2.437500) < k=1 (2.500000) - * At e = 8 bits, k=2 (3.109375) is best - * At e = 1_6 bits, k=2 (5.777771) is best - * At e = 24 bits, k=3 (8.437629) < k=2 (8.444444) - * At e = 3_2 bits, k=3 (10.437492) is best - * At e = 6_4 bits, k=3 (18.437500) is best - * At e = 81 bits, k=4 (22.6_40000) < k=3 (22.687500) - * At e = 128 bits, k=4 (3_2.040000) is best - * At e = 241 bits, k=5 (54.611111) < k=4 (54.6_40000) - * At e = 256 bits, k=5 (57.111111) is best - * At e = 512 bits, k=5 (99.777778) is best - * At e = 673 bits, k=6 (126.591837) < k=5 (126.611111) - * At e = 1024 bits, k=6 (176.734694) is best - * At e = 1793 bits, k=7 (286.578125) < k=6 (286.591837) - * At e = 2048 bits, k=7 (318.453125) is best - * At e = 4096 bits, k=7 (574.453125) is best - * - * This has the rollover points at 6, 24, 81, 241, 673 and 1793 instead - * of 8, 26, 82, 242, 674, and 1794. Not a very big difference. - * (The numbers past that are k=8 at 4609 and k=9 at 11521, - * vs. one more in each case for the approximation.) - * - * Given that exponents for which k>7 are useful are uncommon, - * a fixed size table for k <= 7 is used for simplicity. - * - * The basic number of squarings needed is e-1, although a k-bit - * window (for k > 1) can save, on average, k-2 of those, too. - * That savings currently isn't counted here. It would drive the - * crossover points slightly lower. - * (Actually, this win is also reduced in the DoubleExpMod case, - * meaning we'd have to split the tables. Except for that, the - * multiplies by powers of the two bases are independent, so - * the same logic applies to each as the single case.) - * - * Table entry i is the largest number of bits in an exponent to - * process with a window size of i+1. Entry 6 is the largest - * possible unsigned number, so the window will never be more - * than 7 bits, requiring 2^6 = 0x40 slots. - */ -#define BNEXPMOD_MAX_WINDOW 7 -static unsigned const bnExpModThreshTable[BNEXPMOD_MAX_WINDOW] = { - 5, 23, 80, 240, 672, 1792, (unsigned)-1 -/* 7, 25, 81, 241, 673, 1793, (unsigned)-1 ### The old approximations */ -}; - -/* - * Perform modular exponentiation, as fast as possible! This uses - * Montgomery reduction, optimized squaring, and windowed exponentiation. - * The modulus "mod" MUST be odd! - * - * This returns 0 on success, -1 on out of memory. - * - * The window algorithm: - * The idea is to keep a running product of b1 = n^(high-order bits of exp), - * and then keep appending exponent bits to it. The following patterns - * apply to a 3-bit window (k = 3): - * To append 0: square - * To append 1: square, multiply by n^1 - * To append 10: square, multiply by n^1, square - * To append 11: square, square, multiply by n^3 - * To append 100: square, multiply by n^1, square, square - * To append 101: square, square, square, multiply by n^5 - * To append 110: square, square, multiply by n^3, square - * To append 111: square, square, square, multiply by n^7 - * - * Since each pattern involves only one multiply, the longer the pattern - * the better, except that a 0 (no multiplies) can be appended directly. - * We precompute a table of odd powers of n, up to 2^k, and can then - * multiply k bits of exponent at a time. Actually, assuming random - * exponents, there is on average one zero bit between needs to - * multiply (1/2 of the time there's none, 1/4 of the time there's 1, - * 1/8 of the time, there's 2, 1/16 of the time, there's 3, etc.), so - * you have to do one multiply per k+1 bits of exponent. - * - * The loop walks down the exponent, squaring the result buffer as - * it goes. There is a wbits+1 bit lookahead buffer, buf, that is - * filled with the upcoming exponent bits. (What is read after the - * end of the exponent is unimportant, but it is filled with zero here.) - * When the most-significant bit of this buffer becomes set, i.e. - * (buf & tblmask) != 0, we have to decide what pattern to multiply - * by, and when to do it. We decide, remember to do it in future - * after a suitable number of squarings have passed (e.g. a pattern - * of "100" in the buffer requires that we multiply by n^1 immediately; - * a pattern of "110" calls for multiplying by n^3 after one more - * squaring), clear the buffer, and continue. - * - * When we start, there is one more optimization: the result buffer - * is implcitly one, so squaring it or multiplying by it can be - * optimized away. Further, if we start with a pattern like "100" - * in the lookahead window, rather than placing n into the buffer - * and then starting to square it, we have already computed n^2 - * to compute the odd-powers table, so we can place that into - * the buffer and save a squaring. - * - * This means that if you have a k-bit window, to compute n^z, - * where z is the high k bits of the exponent, 1/2 of the time - * it requires no squarings. 1/4 of the time, it requires 1 - * squaring, ... 1/2^(k-1) of the time, it reqires k-2 squarings. - * And the remaining 1/2^(k-1) of the time, the top k bits are a - * 1 followed by k-1 0 bits, so it again only requires k-2 - * squarings, not k-1. The average of these is 1. Add that - * to the one squaring we have to do to compute the table, - * and you'll see that a k-bit window saves k-2 squarings - * as well as reducing the multiplies. (It actually doesn't - * hurt in the case k = 1, either.) - * - * n must have mlen words allocated. Although fewer may be in use - * when n is passed in, all are in use on exit. - */ -int -lbnExpMod_16(BNWORD16 *result, BNWORD16 const *n, unsigned nlen, - BNWORD16 const *e, unsigned elen, BNWORD16 *mod, unsigned mlen) -{ - BNWORD16 *table[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n */ - unsigned ebits; /* Exponent bits */ - unsigned wbits; /* Window size */ - unsigned tblmask; /* Mask of exponentiation window */ - BNWORD16 bitpos; /* Mask of current look-ahead bit */ - unsigned buf; /* Buffer of exponent bits */ - unsigned multpos; /* Where to do pending multiply */ - BNWORD16 const *mult; /* What to multiply by */ - unsigned i; /* Loop counter */ - int isone; /* Flag: accum. is implicitly one */ - BNWORD16 *a, *b; /* Working buffers/accumulators */ - BNWORD16 *t; /* Pointer into the working buffers */ - BNWORD16 inv; /* mod^-1 modulo 2^16 */ - int y; /* bnYield() result */ - - assert(mlen); - assert(nlen <= mlen); - - /* First, a couple of trivial cases. */ - elen = lbnNorm_16(e, elen); - if (!elen) { - /* x ^ 0 == 1 */ - lbnZero_16(result, mlen); - BIGLITTLE(result[-1],result[0]) = 1; - return 0; - } - ebits = lbnBits_16(e, elen); - if (ebits == 1) { - /* x ^ 1 == x */ - if (n != result) - lbnCopy_16(result, n, nlen); - if (mlen > nlen) - lbnZero_16(BIGLITTLE(result-nlen,result+nlen), - mlen-nlen); - return 0; - } - - /* Okay, now move the exponent pointer to the most-significant word */ - e = BIGLITTLE(e-elen, e+elen-1); - - /* Look up appropriate k-1 for the exponent - tblmask = 1<<(k-1) */ - wbits = 0; - while (ebits > bnExpModThreshTable[wbits]) - wbits++; - - /* Allocate working storage: two product buffers and the tables. */ - LBNALLOC(a, BNWORD16, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD16, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert to the appropriate table size: tblmask = 1<<(k-1) */ - tblmask = 1u << wbits; - - /* We have the result buffer available, so use it. */ - table[0] = result; - - /* - * Okay, we now have a minimal-sized table - expand it. - * This is allowed to fail! If so, scale back the table size - * and proceed. - */ - for (i = 1; i < tblmask; i++) { - LBNALLOC(t, BNWORD16, mlen); - if (!t) /* Out of memory! Quit the loop. */ - break; - table[i] = t; - } - - /* If we stopped, with i < tblmask, shrink the tables appropriately */ - while (tblmask > i) { - wbits--; - tblmask >>= 1; - } - /* Free up our overallocations */ - while (--i > tblmask) - LBNFREE(table[i], mlen); - - /* Okay, fill in the table */ - - /* Compute the necessary modular inverse */ - inv = lbnMontInv1_16(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - /* Convert n to Montgomery form */ - - /* Move n up "mlen" words into a */ - t = BIGLITTLE(a-mlen, a+mlen); - lbnCopy_16(t, n, nlen); - lbnZero_16(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_16(t, a, mlen+nlen, mod, mlen); - /* Copy into first table entry */ - lbnCopy_16(table[0], a, mlen); - - /* Square a into b */ - lbnMontSquare_16(b, a, mod, mlen, inv); - - /* Use high half of b to initialize the table */ - t = BIGLITTLE(b-mlen, b+mlen); - for (i = 1; i < tblmask; i++) { - lbnMontMul_16(a, t, table[i-1], mod, mlen, inv); - lbnCopy_16(table[i], BIGLITTLE(a-mlen, a+mlen), mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* We might use b = n^2 later... */ - - /* Initialze the fetch pointer */ - bitpos = (BNWORD16)1 << ((ebits-1) & (16-1)); /* Initialize mask */ - - /* This should point to the msbit of e */ - assert((*e & bitpos) != 0); - - /* - * Pre-load the window. Becuase the window size is - * never larger than the exponent size, there is no need to - * detect running off the end of e in here. - * - * The read-ahead is controlled by elen and the bitpos mask. - * Note that this is *ahead* of ebits, which tracks the - * most significant end of the window. The purpose of this - * initialization is to get the two wbits+1 bits apart, - * like they should be. - * - * Note that bitpos and e1len together keep track of the - * lookahead read pointer in the exponent that is used here. - */ - buf = 0; - for (i = 0; i <= wbits; i++) { - buf = (buf << 1) | ((*e & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e++,e--); - bitpos = (BNWORD16)1 << (16-1); - elen--; - } - } - assert(buf & tblmask); - - /* - * Set the pending multiply positions to a location that will - * never be encountered, thus ensuring that nothing will happen - * until the need for a multiply appears and one is scheduled. - */ - multpos = ebits; /* A NULL value */ - mult = 0; /* Force a crash if we use these */ - - /* - * Okay, now begins the real work. The first step is - * slightly magic, so it's done outside the main loop, - * but it's very similar to what's inside. - */ - ebits--; /* Start processing the first bit... */ - isone = 1; - - /* - * This is just like the multiply in the loop, except that - * - We know the msbit of buf is set, and - * - We have the extra value n^2 floating around. - * So, do the usual computation, and if the result is that - * the buffer should be multiplied by n^1 immediately - * (which we'd normally then square), we multiply it - * (which reduces to a copy, which reduces to setting a flag) - * by n^2 and skip the squaring. Thus, we do the - * multiply and the squaring in one step. - */ - assert(buf & tblmask); - multpos = ebits - wbits; - while ((buf & 1) == 0) { - buf >>= 1; - multpos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(multpos <= ebits); - mult = table[buf>>1]; - buf = 0; - - /* Special case: use already-computed value sitting in buffer */ - if (multpos == ebits) - isone = 0; - - /* - * At this point, the buffer (which is the high half of b) holds - * either 1 (implicitly, as the "isone" flag is set), or n^2. - */ - - /* - * The main loop. The procedure is: - * - Advance the window - * - If the most-significant bit of the window is set, - * schedule a multiply for the appropriate time in the - * future (may be immediately) - * - Perform any pending multiples - * - Check for termination - * - Square the buffer - * - * At any given time, the acumulated product is held in - * the high half of b. - */ - for (;;) { - ebits--; - - /* Advance the window */ - assert(buf < tblmask); - buf <<= 1; - /* - * This reads ahead of the current exponent position - * (controlled by ebits), so we have to be able to read - * past the lsb of the exponents without error. - */ - if (elen) { - buf |= ((*e & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e++,e--); - bitpos = (BNWORD16)1 << (16-1); - elen--; - } - } - - /* Examine the window for pending multiplies */ - if (buf & tblmask) { - multpos = ebits - wbits; - while ((buf & 1) == 0) { - buf >>= 1; - multpos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(multpos <= ebits); - mult = table[buf>>1]; - buf = 0; - } - - /* If we have a pending multiply, do it */ - if (ebits == multpos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_16(t, mult, mlen); - isone = 0; - } else { - lbnMontMul_16(a, t, mult, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* Are we done? */ - if (!ebits) - break; - - /* Square the input */ - if (!isone) { - t = BIGLITTLE(b-mlen, b+mlen); - lbnMontSquare_16(a, t, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } /* for (;;) */ - - assert(!isone); - assert(!buf); - - /* DONE! */ - - /* Convert result out of Montgomery form */ - t = BIGLITTLE(b-mlen, b+mlen); - lbnCopy_16(b, t, mlen); - lbnZero_16(t, mlen); - lbnMontReduce_16(b, mod, mlen, inv); - lbnCopy_16(result, t, mlen); - /* - * Clean up - free intermediate storage. - * Do NOT free table[0], which is the result - * buffer. - */ - y = 0; -#if BNYIELD -yield: -#endif - while (--tblmask) - LBNFREE(table[tblmask], mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - -/* - * Compute and return n1^e1 * n2^e2 mod "mod". - * result may be either input buffer, or something separate. - * It must be "mlen" words long. - * - * There is a current position in the exponents, which is kept in e1bits. - * (The exponents are swapped if necessary so e1 is the longer of the two.) - * At any given time, the value in the accumulator is - * n1^(e1>>e1bits) * n2^(e2>>e1bits) mod "mod". - * As e1bits is counted down, this is updated, by squaring it and doing - * any necessary multiplies. - * To decide on the necessary multiplies, two windows, each w1bits+1 bits - * wide, are maintained in buf1 and buf2, which read *ahead* of the - * e1bits position (with appropriate handling of the case when e1bits - * drops below w1bits+1). When the most-significant bit of either window - * becomes set, indicating that something needs to be multiplied by - * the accumulator or it will get out of sync, the window is examined - * to see which power of n1 or n2 to multiply by, and when (possibly - * later, if the power is greater than 1) the multiply should take - * place. Then the multiply and its location are remembered and the - * window is cleared. - * - * If we had every power of n1 in the table, the multiply would always - * be w1bits steps in the future. But we only keep the odd powers, - * so instead of waiting w1bits squarings and then multiplying - * by n1^k, we wait w1bits-k squarings and multiply by n1. - * - * Actually, w2bits can be less than w1bits, but the window is the same - * size, to make it easier to keep track of where we're reading. The - * appropriate number of low-order bits of the window are just ignored. - */ -int -lbnDoubleExpMod_16(BNWORD16 *result, - BNWORD16 const *n1, unsigned n1len, - BNWORD16 const *e1, unsigned e1len, - BNWORD16 const *n2, unsigned n2len, - BNWORD16 const *e2, unsigned e2len, - BNWORD16 *mod, unsigned mlen) -{ - BNWORD16 *table1[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n1 */ - BNWORD16 *table2[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n2 */ - unsigned e1bits, e2bits; /* Exponent bits */ - unsigned w1bits, w2bits; /* Window sizes */ - unsigned tblmask; /* Mask of exponentiation window */ - BNWORD16 bitpos; /* Mask of current look-ahead bit */ - unsigned buf1, buf2; /* Buffer of exponent bits */ - unsigned mult1pos, mult2pos; /* Where to do pending multiply */ - BNWORD16 const *mult1, *mult2; /* What to multiply by */ - unsigned i; /* Loop counter */ - int isone; /* Flag: accum. is implicitly one */ - BNWORD16 *a, *b; /* Working buffers/accumulators */ - BNWORD16 *t; /* Pointer into the working buffers */ - BNWORD16 inv; /* mod^-1 modulo 2^16 */ - int y; /* bnYield() result */ - - assert(mlen); - assert(n1len <= mlen); - assert(n2len <= mlen); - - /* First, a couple of trivial cases. */ - e1len = lbnNorm_16(e1, e1len); - e2len = lbnNorm_16(e2, e2len); - - /* Ensure that the first exponent is the longer */ - e1bits = lbnBits_16(e1, e1len); - e2bits = lbnBits_16(e2, e2len); - if (e1bits < e2bits) { - i = e1len; e1len = e2len; e2len = i; - i = e1bits; e1bits = e2bits; e2bits = i; - t = (BNWORD16 *)n1; n1 = n2; n2 = t; - t = (BNWORD16 *)e1; e1 = e2; e2 = t; - } - assert(e1bits >= e2bits); - - /* Handle a trivial case */ - if (!e2len) - return lbnExpMod_16(result, n1, n1len, e1, e1len, mod, mlen); - assert(e2bits); - - /* The code below fucks up if the exponents aren't at least 2 bits */ - if (e1bits == 1) { - assert(e2bits == 1); - - LBNALLOC(a, BNWORD16, n1len+n2len); - if (!a) - return -1; - - lbnMul_16(a, n1, n1len, n2, n2len); - /* Do a direct modular reduction */ - if (n1len + n2len >= mlen) - (void)lbnDiv_16(a+mlen, a, n1len+n2len, mod, mlen); - lbnCopy_16(result, a, mlen); - LBNFREE(a, n1len+n2len); - return 0; - } - - /* Okay, now move the exponent pointers to the most-significant word */ - e1 = BIGLITTLE(e1-e1len, e1+e1len-1); - e2 = BIGLITTLE(e2-e2len, e2+e2len-1); - - /* Look up appropriate k-1 for the exponent - tblmask = 1<<(k-1) */ - w1bits = 0; - while (e1bits > bnExpModThreshTable[w1bits]) - w1bits++; - w2bits = 0; - while (e2bits > bnExpModThreshTable[w2bits]) - w2bits++; - - assert(w1bits >= w2bits); - - /* Allocate working storage: two product buffers and the tables. */ - LBNALLOC(a, BNWORD16, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD16, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert to the appropriate table size: tblmask = 1<<(k-1) */ - tblmask = 1u << w1bits; - /* Use buf2 for its size, temporarily */ - buf2 = 1u << w2bits; - - LBNALLOC(t, BNWORD16, mlen); - if (!t) { - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - return -1; - } - table1[0] = t; - table2[0] = result; - - /* - * Okay, we now have some minimal-sized tables - expand them. - * This is allowed to fail! If so, scale back the table sizes - * and proceed. We allocate both tables at the same time - * so if it fails partway through, they'll both be a reasonable - * size rather than one huge and one tiny. - * When i passes buf2 (the number of entries in the e2 window, - * which may be less than the number of entries in the e1 window), - * stop allocating e2 space. - */ - for (i = 1; i < tblmask; i++) { - LBNALLOC(t, BNWORD16, mlen); - if (!t) /* Out of memory! Quit the loop. */ - break; - table1[i] = t; - if (i < buf2) { - LBNALLOC(t, BNWORD16, mlen); - if (!t) { - LBNFREE(table1[i], mlen); - break; - } - table2[i] = t; - } - } - - /* If we stopped, with i < tblmask, shrink the tables appropriately */ - while (tblmask > i) { - w1bits--; - tblmask >>= 1; - } - /* Free up our overallocations */ - while (--i > tblmask) { - if (i < buf2) - LBNFREE(table2[i], mlen); - LBNFREE(table1[i], mlen); - } - /* And shrink the second window too, if needed */ - if (w2bits > w1bits) { - w2bits = w1bits; - buf2 = tblmask; - } - - /* - * From now on, use the w2bits variable for the difference - * between w1bits and w2bits. - */ - w2bits = w1bits-w2bits; - - /* Okay, fill in the tables */ - - /* Compute the necessary modular inverse */ - inv = lbnMontInv1_16(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - /* Convert n1 to Montgomery form */ - - /* Move n1 up "mlen" words into a */ - t = BIGLITTLE(a-mlen, a+mlen); - lbnCopy_16(t, n1, n1len); - lbnZero_16(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_16(t, a, mlen+n1len, mod, mlen); - /* Copy into first table entry */ - lbnCopy_16(table1[0], a, mlen); - - /* Square a into b */ - lbnMontSquare_16(b, a, mod, mlen, inv); - - /* Use high half of b to initialize the first table */ - t = BIGLITTLE(b-mlen, b+mlen); - for (i = 1; i < tblmask; i++) { - lbnMontMul_16(a, t, table1[i-1], mod, mlen, inv); - lbnCopy_16(table1[i], BIGLITTLE(a-mlen, a+mlen), mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* Convert n2 to Montgomery form */ - - t = BIGLITTLE(a-mlen, a+mlen); - /* Move n2 up "mlen" words into a */ - lbnCopy_16(t, n2, n2len); - lbnZero_16(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_16(t, a, mlen+n2len, mod, mlen); - /* Copy into first table entry */ - lbnCopy_16(table2[0], a, mlen); - - /* Square it into a */ - lbnMontSquare_16(a, table2[0], mod, mlen, inv); - /* Copy to b, low half */ - lbnCopy_16(b, t, mlen); - - /* Use b to initialize the second table */ - for (i = 1; i < buf2; i++) { - lbnMontMul_16(a, b, table2[i-1], mod, mlen, inv); - lbnCopy_16(table2[i], t, mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* - * Okay, a recap: at this point, the low part of b holds - * n2^2, the high part holds n1^2, and the tables are - * initialized with the odd powers of n1 and n2 from 1 - * through 2*tblmask-1 and 2*buf2-1. - * - * We might use those squares in b later, or we might not. - */ - - /* Initialze the fetch pointer */ - bitpos = (BNWORD16)1 << ((e1bits-1) & (16-1)); /* Initialize mask */ - - /* This should point to the msbit of e1 */ - assert((*e1 & bitpos) != 0); - - /* - * Pre-load the windows. Becuase the window size is - * never larger than the exponent size, there is no need to - * detect running off the end of e1 in here. - * - * The read-ahead is controlled by e1len and the bitpos mask. - * Note that this is *ahead* of e1bits, which tracks the - * most significant end of the window. The purpose of this - * initialization is to get the two w1bits+1 bits apart, - * like they should be. - * - * Note that bitpos and e1len together keep track of the - * lookahead read pointer in the exponent that is used here. - * e2len is not decremented, it is only ever compared with - * e1len as *that* is decremented. - */ - buf1 = buf2 = 0; - for (i = 0; i <= w1bits; i++) { - buf1 = (buf1 << 1) | ((*e1 & bitpos) != 0); - if (e1len <= e2len) - buf2 = (buf2 << 1) | ((*e2 & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e1++,e1--); - if (e1len <= e2len) - BIGLITTLE(e2++,e2--); - bitpos = (BNWORD16)1 << (16-1); - e1len--; - } - } - assert(buf1 & tblmask); - - /* - * Set the pending multiply positions to a location that will - * never be encountered, thus ensuring that nothing will happen - * until the need for a multiply appears and one is scheduled. - */ - mult1pos = mult2pos = e1bits; /* A NULL value */ - mult1 = mult2 = 0; /* Force a crash if we use these */ - - /* - * Okay, now begins the real work. The first step is - * slightly magic, so it's done outside the main loop, - * but it's very similar to what's inside. - */ - isone = 1; /* Buffer is implicitly 1, so replace * by copy */ - e1bits--; /* Start processing the first bit... */ - - /* - * This is just like the multiply in the loop, except that - * - We know the msbit of buf1 is set, and - * - We have the extra value n1^2 floating around. - * So, do the usual computation, and if the result is that - * the buffer should be multiplied by n1^1 immediately - * (which we'd normally then square), we multiply it - * (which reduces to a copy, which reduces to setting a flag) - * by n1^2 and skip the squaring. Thus, we do the - * multiply and the squaring in one step. - */ - assert(buf1 & tblmask); - mult1pos = e1bits - w1bits; - while ((buf1 & 1) == 0) { - buf1 >>= 1; - mult1pos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(mult1pos <= e1bits); - mult1 = table1[buf1>>1]; - buf1 = 0; - - /* Special case: use already-computed value sitting in buffer */ - if (mult1pos == e1bits) - isone = 0; - - /* - * The first multiply by a power of n2. Similar, but - * we might not even want to schedule a multiply if e2 is - * shorter than e1, and the window might be shorter so - * we have to leave the low w2bits bits alone. - */ - if (buf2 & tblmask) { - /* Remember low-order bits for later */ - i = buf2 & ((1u << w2bits) - 1); - buf2 >>= w2bits; - mult2pos = e1bits - w1bits + w2bits; - while ((buf2 & 1) == 0) { - buf2 >>= 1; - mult2pos++; - } - assert(mult2pos <= e1bits); - mult2 = table2[buf2>>1]; - buf2 = i; - - if (mult2pos == e1bits) { - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - lbnCopy_16(t, b, mlen); /* Copy low to high */ - isone = 0; - } else { - lbnMontMul_16(a, t, b, mod, mlen, inv); - t = a; a = b; b = t; - } - } - } - - /* - * At this point, the buffer (which is the high half of b) - * holds either 1 (implicitly, as the "isone" flag is set), - * n1^2, n2^2 or n1^2 * n2^2. - */ - - /* - * The main loop. The procedure is: - * - Advance the windows - * - If the most-significant bit of a window is set, - * schedule a multiply for the appropriate time in the - * future (may be immediately) - * - Perform any pending multiples - * - Check for termination - * - Square the buffers - * - * At any given time, the acumulated product is held in - * the high half of b. - */ - for (;;) { - e1bits--; - - /* Advance the windows */ - assert(buf1 < tblmask); - buf1 <<= 1; - assert(buf2 < tblmask); - buf2 <<= 1; - /* - * This reads ahead of the current exponent position - * (controlled by e1bits), so we have to be able to read - * past the lsb of the exponents without error. - */ - if (e1len) { - buf1 |= ((*e1 & bitpos) != 0); - if (e1len <= e2len) - buf2 |= ((*e2 & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e1++,e1--); - if (e1len <= e2len) - BIGLITTLE(e2++,e2--); - bitpos = (BNWORD16)1 << (16-1); - e1len--; - } - } - - /* Examine the first window for pending multiplies */ - if (buf1 & tblmask) { - mult1pos = e1bits - w1bits; - while ((buf1 & 1) == 0) { - buf1 >>= 1; - mult1pos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(mult1pos <= e1bits); - mult1 = table1[buf1>>1]; - buf1 = 0; - } - - /* - * Examine the second window for pending multiplies. - * Window 2 can be smaller than window 1, but we - * keep the same number of bits in buf2, so we need - * to ignore any low-order bits in the buffer when - * computing what to multiply by, and recompute them - * later. - */ - if (buf2 & tblmask) { - /* Remember low-order bits for later */ - i = buf2 & ((1u << w2bits) - 1); - buf2 >>= w2bits; - mult2pos = e1bits - w1bits + w2bits; - while ((buf2 & 1) == 0) { - buf2 >>= 1; - mult2pos++; - } - assert(mult2pos <= e1bits); - mult2 = table2[buf2>>1]; - buf2 = i; - } - - - /* If we have a pending multiply for e1, do it */ - if (e1bits == mult1pos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_16(t, mult1, mlen); - isone = 0; - } else { - lbnMontMul_16(a, t, mult1, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* If we have a pending multiply for e2, do it */ - if (e1bits == mult2pos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_16(t, mult2, mlen); - isone = 0; - } else { - lbnMontMul_16(a, t, mult2, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* Are we done? */ - if (!e1bits) - break; - - /* Square the buffer */ - if (!isone) { - t = BIGLITTLE(b-mlen, b+mlen); - lbnMontSquare_16(a, t, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } /* for (;;) */ - - assert(!isone); - assert(!buf1); - assert(!buf2); - - /* DONE! */ - - /* Convert result out of Montgomery form */ - t = BIGLITTLE(b-mlen, b+mlen); - lbnCopy_16(b, t, mlen); - lbnZero_16(t, mlen); - lbnMontReduce_16(b, mod, mlen, inv); - lbnCopy_16(result, t, mlen); - - /* Clean up - free intermediate storage */ - y = 0; -#if BNYIELD -yield: -#endif - buf2 = tblmask >> w2bits; - while (--tblmask) { - if (tblmask < buf2) - LBNFREE(table2[tblmask], mlen); - LBNFREE(table1[tblmask], mlen); - } - t = table1[0]; - LBNFREE(t, mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - -/* - * 2^exp (mod mod). This is an optimized version for use in Fermat - * tests. The input value of n is ignored; it is returned with - * "mlen" words valid. - */ -int -lbnTwoExpMod_16(BNWORD16 *n, BNWORD16 const *exp, unsigned elen, - BNWORD16 *mod, unsigned mlen) -{ - unsigned e; /* Copy of high words of the exponent */ - unsigned bits; /* Assorted counter of bits */ - BNWORD16 const *bitptr; - BNWORD16 bitword, bitpos; - BNWORD16 *a, *b, *a1; - BNWORD16 inv; - int y; /* Result of bnYield() */ - - assert(mlen); - - bitptr = BIGLITTLE(exp-elen, exp+elen-1); - bitword = *bitptr; - assert(bitword); - - /* Clear n for future use. */ - lbnZero_16(n, mlen); - - bits = lbnBits_16(exp, elen); - - /* First, a couple of trivial cases. */ - if (bits <= 1) { - /* 2 ^ 0 == 1, 2 ^ 1 == 2 */ - BIGLITTLE(n[-1],n[0]) = (BNWORD16)1<<elen; - return 0; - } - - /* Set bitpos to the most significant bit */ - bitpos = (BNWORD16)1 << ((bits-1) & (16-1)); - - /* Now, count the bits in the modulus. */ - bits = lbnBits_16(mod, mlen); - assert(bits > 1); /* a 1-bit modulus is just stupid... */ - - /* - * We start with 1<<e, where "e" is as many high bits of the - * exponent as we can manage without going over the modulus. - * This first loop finds "e". - */ - e = 1; - while (elen) { - /* Consume the first bit */ - bitpos >>= 1; - if (!bitpos) { - if (!--elen) - break; - bitword = BIGLITTLE(*++bitptr,*--bitptr); - bitpos = (BNWORD16)1<<(16-1); - } - e = (e << 1) | ((bitpos & bitword) != 0); - if (e >= bits) { /* Overflow! Back out. */ - e >>= 1; - break; - } - } - /* - * The bit in "bitpos" being examined by the bit buffer has NOT - * been consumed yet. This may be past the end of the exponent, - * in which case elen == 1. - */ - - /* Okay, now, set bit "e" in n. n is already zero. */ - inv = (BNWORD16)1 << (e & (16-1)); - e /= 16; - BIGLITTLE(n[-e-1],n[e]) = inv; - /* - * The effective length of n in words is now "e+1". - * This is used a little bit later. - */ - - if (!elen) - return 0; /* That was easy! */ - - /* - * We have now processed the first few bits. The next step - * is to convert this to Montgomery form for further squaring. - */ - - /* Allocate working storage: two product buffers */ - LBNALLOC(a, BNWORD16, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD16, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert n to Montgomery form */ - inv = BIGLITTLE(mod[-1],mod[0]); /* LSW of modulus */ - assert(inv & 1); /* Modulus must be odd */ - inv = lbnMontInv1_16(inv); - /* Move n (length e+1, remember?) up "mlen" words into b */ - /* Note that we lie about a1 for a bit - it's pointing to b */ - a1 = BIGLITTLE(b-mlen,b+mlen); - lbnCopy_16(a1, n, e+1); - lbnZero_16(b, mlen); - /* Do the division - dump the quotient into the high-order words */ - (void)lbnDiv_16(a1, b, mlen+e+1, mod, mlen); - /* - * Now do the first squaring and modular reduction to put - * the number up in a1 where it belongs. - */ - lbnMontSquare_16(a, b, mod, mlen, inv); - /* Fix up a1 to point to where it should go. */ - a1 = BIGLITTLE(a-mlen,a+mlen); - - /* - * Okay, now, a1 holds the number being accumulated, and - * b is a scratch register. Start working: - */ - for (;;) { - /* - * Is the bit set? If so, double a1 as well. - * A modular doubling like this is very cheap. - */ - if (bitpos & bitword) { - /* - * Double the number. If there was a carry out OR - * the result is greater than the modulus, subract - * the modulus. - */ - if (lbnDouble_16(a1, mlen) || - lbnCmp_16(a1, mod, mlen) > 0) - (void)lbnSubN_16(a1, mod, mlen); - } - - /* Advance to the next exponent bit */ - bitpos >>= 1; - if (!bitpos) { - if (!--elen) - break; /* Done! */ - bitword = BIGLITTLE(*++bitptr,*--bitptr); - bitpos = (BNWORD16)1<<(16-1); - } - - /* - * The elen/bitword/bitpos bit buffer is known to be - * non-empty, i.e. there is at least one more unconsumed bit. - * Thus, it's safe to square the number. - */ - lbnMontSquare_16(b, a1, mod, mlen, inv); - /* Rename result (in b) back to a (a1, really). */ - a1 = b; b = a; a = a1; - a1 = BIGLITTLE(a-mlen,a+mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* DONE! Just a little bit of cleanup... */ - - /* - * Convert result out of Montgomery form... this is - * just a Montgomery reduction. - */ - lbnCopy_16(a, a1, mlen); - lbnZero_16(a1, mlen); - lbnMontReduce_16(a, mod, mlen, inv); - lbnCopy_16(n, a1, mlen); - - /* Clean up - free intermediate storage */ - y = 0; -#if BNYIELD -yield: -#endif - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - - -/* - * Returns a substring of the big-endian array of bytes representation - * of the bignum array based on two parameters, the least significant - * byte number (0 to start with the least significant byte) and the - * length. I.e. the number returned is a representation of - * (bn / 2^(8*lsbyte)) % 2 ^ (8*buflen). - * - * It is an error if the bignum is not at least buflen + lsbyte bytes - * long. - * - * This code assumes that the compiler has the minimal intelligence - * neded to optimize divides and modulo operations on an unsigned data - * type with a power of two. - */ -void -lbnExtractBigBytes_16(BNWORD16 const *n, unsigned char *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD16 t = 0; /* Needed to shut up uninitialized var warnings */ - unsigned shift; - - lsbyte += buflen; - - shift = (8 * lsbyte) % 16; - lsbyte /= (16/8); /* Convert to word offset */ - BIGLITTLE(n -= lsbyte, n += lsbyte); - - if (shift) - t = BIGLITTLE(n[-1],n[0]); - - while (buflen--) { - if (!shift) { - t = BIGLITTLE(*n++,*--n); - shift = 16; - } - shift -= 8; - *buf++ = (unsigned char)(t>>shift); - } -} - -/* - * Merge a big-endian array of bytes into a bignum array. - * The array had better be big enough. This is - * equivalent to extracting the entire bignum into a - * large byte array, copying the input buffer into the - * middle of it, and converting back to a bignum. - * - * The buf is "len" bytes long, and its *last* byte is at - * position "lsbyte" from the end of the bignum. - * - * Note that this is a pain to get right. Fortunately, it's hardly - * critical for efficiency. - */ -void -lbnInsertBigBytes_16(BNWORD16 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD16 t = 0; /* Shut up uninitialized varibale warnings */ - - lsbyte += buflen; - - BIGLITTLE(n -= lsbyte/(16/8), n += lsbyte/(16/8)); - - /* Load up leading odd bytes */ - if (lsbyte % (16/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte * 8) % 16; - } - - /* The main loop - merge into t, storing at each word boundary. */ - while (buflen--) { - t = (t << 8) | *buf++; - if ((--lsbyte % (16/8)) == 0) - BIGLITTLE(*n++,*--n) = t; - } - - /* Merge odd bytes in t into last word */ - lsbyte = (lsbyte * 8) % 16; - if (lsbyte) { - t <<= lsbyte; - t |= (((BNWORD16)1 << lsbyte) - 1) & BIGLITTLE(n[0],n[-1]); - BIGLITTLE(n[0],n[-1]) = t; - } - - return; -} - -/* - * Returns a substring of the little-endian array of bytes representation - * of the bignum array based on two parameters, the least significant - * byte number (0 to start with the least significant byte) and the - * length. I.e. the number returned is a representation of - * (bn / 2^(8*lsbyte)) % 2 ^ (8*buflen). - * - * It is an error if the bignum is not at least buflen + lsbyte bytes - * long. - * - * This code assumes that the compiler has the minimal intelligence - * neded to optimize divides and modulo operations on an unsigned data - * type with a power of two. - */ -void -lbnExtractLittleBytes_16(BNWORD16 const *n, unsigned char *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD16 t = 0; /* Needed to shut up uninitialized var warnings */ - - BIGLITTLE(n -= lsbyte/(16/8), n += lsbyte/(16/8)); - - if (lsbyte % (16/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte % (16/8)) * 8 ; - } - - while (buflen--) { - if ((lsbyte++ % (16/8)) == 0) - t = BIGLITTLE(*--n,*n++); - *buf++ = (unsigned char)t; - t >>= 8; - } -} - -/* - * Merge a little-endian array of bytes into a bignum array. - * The array had better be big enough. This is - * equivalent to extracting the entire bignum into a - * large byte array, copying the input buffer into the - * middle of it, and converting back to a bignum. - * - * The buf is "len" bytes long, and its first byte is at - * position "lsbyte" from the end of the bignum. - * - * Note that this is a pain to get right. Fortunately, it's hardly - * critical for efficiency. - */ -void -lbnInsertLittleBytes_16(BNWORD16 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD16 t = 0; /* Shut up uninitialized varibale warnings */ - - /* Move to most-significant end */ - lsbyte += buflen; - buf += buflen; - - BIGLITTLE(n -= lsbyte/(16/8), n += lsbyte/(16/8)); - - /* Load up leading odd bytes */ - if (lsbyte % (16/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte * 8) % 16; - } - - /* The main loop - merge into t, storing at each word boundary. */ - while (buflen--) { - t = (t << 8) | *--buf; - if ((--lsbyte % (16/8)) == 0) - BIGLITTLE(*n++,*--n) = t; - } - - /* Merge odd bytes in t into last word */ - lsbyte = (lsbyte * 8) % 16; - if (lsbyte) { - t <<= lsbyte; - t |= (((BNWORD16)1 << lsbyte) - 1) & BIGLITTLE(n[0],n[-1]); - BIGLITTLE(n[0],n[-1]) = t; - } - - return; -} - -#ifdef DEADCODE /* This was a precursor to the more flexible lbnExtractBytes */ -/* - * Convert a big-endian array of bytes to a bignum. - * Returns the number of words in the bignum. - * Note the expression "16/8" for the number of bytes per word. - * This is so the word-size adjustment will work. - */ -unsigned -lbnFromBytes_16(BNWORD16 *a, unsigned char const *b, unsigned blen) -{ - BNWORD16 t; - unsigned alen = (blen + (16/8-1))/(16/8); - BIGLITTLE(a -= alen, a += alen); - - while (blen) { - t = 0; - do { - t = t << 8 | *b++; - } while (--blen & (16/8-1)); - BIGLITTLE(*a++,*--a) = t; - } - return alen; -} -#endif - -/* - * Computes the GCD of a and b. Modifies both arguments; when it returns, - * one of them is the GCD and the other is trash. The return value - * indicates which: 0 for a, and 1 for b. The length of the retult is - * returned in rlen. Both inputs must have one extra word of precision. - * alen must be >= blen. - * - * TODO: use the binary algorithm (Knuth section 4.5.2, algorithm B). - * This is based on taking out common powers of 2, then repeatedly: - * gcd(2*u,v) = gcd(u,2*v) = gcd(u,v) - isolated powers of 2 can be deleted. - * gcd(u,v) = gcd(u-v,v) - the numbers can be easily reduced. - * It gets less reduction per step, but the steps are much faster than - * the division case. - */ -int -lbnGcd_16(BNWORD16 *a, unsigned alen, BNWORD16 *b, unsigned blen, - unsigned *rlen) -{ -#if BNYIELD - int y; -#endif - assert(alen >= blen); - - while (blen != 0) { - (void)lbnDiv_16(BIGLITTLE(a-blen,a+blen), a, alen, b, blen); - alen = lbnNorm_16(a, blen); - if (alen == 0) { - *rlen = blen; - return 1; - } - (void)lbnDiv_16(BIGLITTLE(b-alen,b+alen), b, blen, a, alen); - blen = lbnNorm_16(b, alen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - return y; -#endif - } - *rlen = alen; - return 0; -} - -/* - * Invert "a" modulo "mod" using the extended Euclidean algorithm. - * Note that this only computes one of the cosequences, and uses the - * theorem that the signs flip every step and the absolute value of - * the cosequence values are always bounded by the modulus to avoid - * having to work with negative numbers. - * gcd(a,mod) had better equal 1. Returns 1 if the GCD is NOT 1. - * a must be one word longer than "mod". It is overwritten with the - * result. - * TODO: Use Richard Schroeppel's *much* faster algorithm. - */ -int -lbnInv_16(BNWORD16 *a, unsigned alen, BNWORD16 const *mod, unsigned mlen) -{ - BNWORD16 *b; /* Hold a copy of mod during GCD reduction */ - BNWORD16 *p; /* Temporary for products added to t0 and t1 */ - BNWORD16 *t0, *t1; /* Inverse accumulators */ - BNWORD16 cy; - unsigned blen, t0len, t1len, plen; - int y; - - alen = lbnNorm_16(a, alen); - if (!alen) - return 1; /* No inverse */ - - mlen = lbnNorm_16(mod, mlen); - - assert (alen <= mlen); - - /* Inverse of 1 is 1 */ - if (alen == 1 && BIGLITTLE(a[-1],a[0]) == 1) { - lbnZero_16(BIGLITTLE(a-alen,a+alen), mlen-alen); - return 0; - } - - /* Allocate a pile of space */ - LBNALLOC(b, BNWORD16, mlen+1); - if (b) { - /* - * Although products are guaranteed to always be less than the - * modulus, it can involve multiplying two 3-word numbers to - * get a 5-word result, requiring a 6th word to store a 0 - * temporarily. Thus, mlen + 1. - */ - LBNALLOC(p, BNWORD16, mlen+1); - if (p) { - LBNALLOC(t0, BNWORD16, mlen); - if (t0) { - LBNALLOC(t1, BNWORD16, mlen); - if (t1) - goto allocated; - LBNFREE(t0, mlen); - } - LBNFREE(p, mlen+1); - } - LBNFREE(b, mlen+1); - } - return -1; - -allocated: - - /* Set t0 to 1 */ - t0len = 1; - BIGLITTLE(t0[-1],t0[0]) = 1; - - /* b = mod */ - lbnCopy_16(b, mod, mlen); - /* blen = mlen (implicitly) */ - - /* t1 = b / a; b = b % a */ - cy = lbnDiv_16(t1, b, mlen, a, alen); - *(BIGLITTLE(t1-(mlen-alen)-1,t1+(mlen-alen))) = cy; - t1len = lbnNorm_16(t1, mlen-alen+1); - blen = lbnNorm_16(b, alen); - - /* while (b > 1) */ - while (blen > 1 || BIGLITTLE(b[-1],b[0]) != (BNWORD16)1) { - /* q = a / b; a = a % b; */ - if (alen < blen || (alen == blen && lbnCmp_16(a, a, alen) < 0)) - assert(0); - cy = lbnDiv_16(BIGLITTLE(a-blen,a+blen), a, alen, b, blen); - *(BIGLITTLE(a-alen-1,a+alen)) = cy; - plen = lbnNorm_16(BIGLITTLE(a-blen,a+blen), alen-blen+1); - assert(plen); - alen = lbnNorm_16(a, blen); - if (!alen) - goto failure; /* GCD not 1 */ - - /* t0 += q * t1; */ - assert(plen+t1len <= mlen+1); - lbnMul_16(p, BIGLITTLE(a-blen,a+blen), plen, t1, t1len); - plen = lbnNorm_16(p, plen + t1len); - assert(plen <= mlen); - if (plen > t0len) { - lbnZero_16(BIGLITTLE(t0-t0len,t0+t0len), plen-t0len); - t0len = plen; - } - cy = lbnAddN_16(t0, p, plen); - if (cy) { - if (t0len > plen) { - cy = lbnAdd1_16(BIGLITTLE(t0-plen,t0+plen), - t0len-plen, cy); - } - if (cy) { - BIGLITTLE(t0[-t0len-1],t0[t0len]) = cy; - t0len++; - } - } - - /* if (a <= 1) return a ? t0 : FAIL; */ - if (alen <= 1 && BIGLITTLE(a[-1],a[0]) == (BNWORD16)1) { - if (alen == 0) - goto failure; /* FAIL */ - assert(t0len <= mlen); - lbnCopy_16(a, t0, t0len); - lbnZero_16(BIGLITTLE(a-t0len, a+t0len), mlen-t0len); - goto success; - } - - /* q = b / a; b = b % a; */ - if (blen < alen || (blen == alen && lbnCmp_16(b, a, alen) < 0)) - assert(0); - cy = lbnDiv_16(BIGLITTLE(b-alen,b+alen), b, blen, a, alen); - *(BIGLITTLE(b-blen-1,b+blen)) = cy; - plen = lbnNorm_16(BIGLITTLE(b-alen,b+alen), blen-alen+1); - assert(plen); - blen = lbnNorm_16(b, alen); - if (!blen) - goto failure; /* GCD not 1 */ - - /* t1 += q * t0; */ - assert(plen+t0len <= mlen+1); - lbnMul_16(p, BIGLITTLE(b-alen,b+alen), plen, t0, t0len); - plen = lbnNorm_16(p, plen + t0len); - assert(plen <= mlen); - if (plen > t1len) { - lbnZero_16(BIGLITTLE(t1-t1len,t1+t1len), plen-t1len); - t1len = plen; - } - cy = lbnAddN_16(t1, p, plen); - if (cy) { - if (t1len > plen) { - cy = lbnAdd1_16(BIGLITTLE(t1-plen,t0+plen), - t1len-plen, cy); - } - if (cy) { - BIGLITTLE(t1[-t1len-1],t1[t1len]) = cy; - t1len++; - } - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - - if (!blen) - goto failure; /* gcd(a, mod) != 1 -- FAIL */ - - /* return mod-t1 */ - lbnCopy_16(a, mod, mlen); - assert(t1len <= mlen); - cy = lbnSubN_16(a, t1, t1len); - if (cy) { - assert(mlen > t1len); - cy = lbnSub1_16(BIGLITTLE(a-t1len, a+t1len), mlen-t1len, cy); - assert(!cy); - } - -success: - LBNFREE(t1, mlen); - LBNFREE(t0, mlen); - LBNFREE(p, mlen+1); - LBNFREE(b, mlen+1); - - return 0; - -failure: /* GCD is not 1 - no inverse exists! */ - y = 1; -#if BNYIELD -yield: -#endif - LBNFREE(t1, mlen); - LBNFREE(t0, mlen); - LBNFREE(p, mlen+1); - LBNFREE(b, mlen+1); - - return y; -} - -/* - * Precompute powers of "a" mod "mod". Compute them every "bits" - * for "n" steps. This is sufficient to compute powers of g with - * exponents up to n*bits bits long, i.e. less than 2^(n*bits). - * - * This assumes that the caller has already initialized "array" to point - * to "n" buffers of size "mlen". - */ -int -lbnBasePrecompBegin_16(BNWORD16 **array, unsigned n, unsigned bits, - BNWORD16 const *g, unsigned glen, BNWORD16 *mod, unsigned mlen) -{ - BNWORD16 *a, *b; /* Temporary double-width accumulators */ - BNWORD16 *a1; /* Pointer to high half of a*/ - BNWORD16 inv; /* Montgomery inverse of LSW of mod */ - BNWORD16 *t; - unsigned i; - - glen = lbnNorm_16(g, glen); - assert(glen); - - assert (mlen == lbnNorm_16(mod, mlen)); - assert (glen <= mlen); - - /* Allocate two temporary buffers, and the array slots */ - LBNALLOC(a, BNWORD16, mlen*2); - if (!a) - return -1; - LBNALLOC(b, BNWORD16, mlen*2); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Okay, all ready */ - - /* Convert n to Montgomery form */ - inv = BIGLITTLE(mod[-1],mod[0]); /* LSW of modulus */ - assert(inv & 1); /* Modulus must be odd */ - inv = lbnMontInv1_16(inv); - /* Move g up "mlen" words into a (clearing the low mlen words) */ - a1 = BIGLITTLE(a-mlen,a+mlen); - lbnCopy_16(a1, g, glen); - lbnZero_16(a, mlen); - - /* Do the division - dump the quotient into the high-order words */ - (void)lbnDiv_16(a1, a, mlen+glen, mod, mlen); - - /* Copy the first value into the array */ - t = *array; - lbnCopy_16(t, a, mlen); - a1 = a; /* This first value is *not* shifted up */ - - /* Now compute the remaining n-1 array entries */ - assert(bits); - assert(n); - while (--n) { - i = bits; - do { - /* Square a1 into b1 */ - lbnMontSquare_16(b, a1, mod, mlen, inv); - t = b; b = a; a = t; - a1 = BIGLITTLE(a-mlen, a+mlen); - } while (--i); - t = *++array; - lbnCopy_16(t, a1, mlen); - } - - /* Hooray, we're done. */ - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - return 0; -} - -/* - * result = base^exp (mod mod). "array" is a an array of pointers - * to procomputed powers of base, each 2^bits apart. (I.e. array[i] - * is base^(2^(i*bits))). - * - * The algorithm consists of: - * a = b = (powers of g to be raised to the power 2^bits-1) - * a *= b *= (powers of g to be raised to the power 2^bits-2) - * ... - * a *= b *= (powers of g to be raised to the power 1) - * - * All we do is walk the exponent 2^bits-1 times in groups of "bits" bits, - */ -int -lbnBasePrecompExp_16(BNWORD16 *result, BNWORD16 const * const *array, - unsigned bits, BNWORD16 const *exp, unsigned elen, - BNWORD16 const *mod, unsigned mlen) -{ - BNWORD16 *a, *b, *c, *t; - BNWORD16 *a1, *b1; - int anull, bnull; /* Null flags: values are implicitly 1 */ - unsigned i, j; /* Loop counters */ - unsigned mask; /* Exponent bits to examime */ - BNWORD16 const *eptr; /* Pointer into exp */ - BNWORD16 buf, curbits, nextword; /* Bit-buffer varaibles */ - BNWORD16 inv; /* Inverse of LSW of modulus */ - unsigned ewords; /* Words of exponent left */ - int bufbits; /* Number of valid bits */ - int y = 0; - - mlen = lbnNorm_16(mod, mlen); - assert (mlen); - - elen = lbnNorm_16(exp, elen); - if (!elen) { - lbnZero_16(result, mlen); - BIGLITTLE(result[-1],result[0]) = 1; - return 0; - } - /* - * This could be precomputed, but it's so cheap, and it would require - * making the precomputation structure word-size dependent. - */ - inv = lbnMontInv1_16(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - assert(elen); - - /* - * Allocate three temporary buffers. The current numbers generally - * live in the upper halves of these buffers. - */ - LBNALLOC(a, BNWORD16, mlen*2); - if (a) { - LBNALLOC(b, BNWORD16, mlen*2); - if (b) { - LBNALLOC(c, BNWORD16, mlen*2); - if (c) - goto allocated; - LBNFREE(b, 2*mlen); - } - LBNFREE(a, 2*mlen); - } - return -1; - -allocated: - - anull = bnull = 1; - - mask = (1u<<bits) - 1; - for (i = mask; i; --i) { - /* Set up bit buffer for walking the exponent */ - eptr = exp; - buf = BIGLITTLE(*--eptr, *eptr++); - ewords = elen-1; - bufbits = 16; - for (j = 0; ewords || buf; j++) { - /* Shift down current buffer */ - curbits = buf; - buf >>= bits; - /* If necessary, add next word */ - bufbits -= bits; - if (bufbits < 0 && ewords > 0) { - nextword = BIGLITTLE(*--eptr, *eptr++); - ewords--; - curbits |= nextword << (bufbits+bits); - buf = nextword >> -bufbits; - bufbits += 16; - } - /* If appropriate, multiply b *= array[j] */ - if ((curbits & mask) == i) { - BNWORD16 const *d = array[j]; - - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (bnull) { - lbnCopy_16(b1, d, mlen); - bnull = 0; - } else { - lbnMontMul_16(c, b1, d, mod, mlen, inv); - t = c; c = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - } - - /* Multiply a *= b */ - if (!bnull) { - a1 = BIGLITTLE(a-mlen-1,a+mlen); - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (anull) { - lbnCopy_16(a1, b1, mlen); - anull = 0; - } else { - lbnMontMul_16(c, a1, b1, mod, mlen, inv); - t = c; c = a; a = t; - } - } - } - - assert(!anull); /* If it were, elen would have been 0 */ - - /* Convert out of Montgomery form and return */ - a1 = BIGLITTLE(a-mlen-1,a+mlen); - lbnCopy_16(a, a1, mlen); - lbnZero_16(a1, mlen); - lbnMontReduce_16(a, mod, mlen, inv); - lbnCopy_16(result, a1, mlen); - -#if BNYIELD -yield: -#endif - LBNFREE(c, 2*mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; -} - -/* - * result = base1^exp1 *base2^exp2 (mod mod). "array1" and "array2" are - * arrays of pointers to procomputed powers of the corresponding bases, - * each 2^bits apart. (I.e. array1[i] is base1^(2^(i*bits))). - * - * Bits must be the same in both. (It could be made adjustable, but it's - * a bit of a pain. Just make them both equal to the larger one.) - * - * The algorithm consists of: - * a = b = (powers of base1 and base2 to be raised to the power 2^bits-1) - * a *= b *= (powers of base1 and base2 to be raised to the power 2^bits-2) - * ... - * a *= b *= (powers of base1 and base2 to be raised to the power 1) - * - * All we do is walk the exponent 2^bits-1 times in groups of "bits" bits, - */ -int -lbnDoubleBasePrecompExp_16(BNWORD16 *result, unsigned bits, - BNWORD16 const * const *array1, BNWORD16 const *exp1, unsigned elen1, - BNWORD16 const * const *array2, BNWORD16 const *exp2, - unsigned elen2, BNWORD16 const *mod, unsigned mlen) -{ - BNWORD16 *a, *b, *c, *t; - BNWORD16 *a1, *b1; - int anull, bnull; /* Null flags: values are implicitly 1 */ - unsigned i, j, k; /* Loop counters */ - unsigned mask; /* Exponent bits to examime */ - BNWORD16 const *eptr; /* Pointer into exp */ - BNWORD16 buf, curbits, nextword; /* Bit-buffer varaibles */ - BNWORD16 inv; /* Inverse of LSW of modulus */ - unsigned ewords; /* Words of exponent left */ - int bufbits; /* Number of valid bits */ - int y = 0; - BNWORD16 const * const *array; - - mlen = lbnNorm_16(mod, mlen); - assert (mlen); - - elen1 = lbnNorm_16(exp1, elen1); - if (!elen1) { - return lbnBasePrecompExp_16(result, array2, bits, exp2, elen2, - mod, mlen); - } - elen2 = lbnNorm_16(exp2, elen2); - if (!elen2) { - return lbnBasePrecompExp_16(result, array1, bits, exp1, elen1, - mod, mlen); - } - /* - * This could be precomputed, but it's so cheap, and it would require - * making the precomputation structure word-size dependent. - */ - inv = lbnMontInv1_16(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - assert(elen1); - assert(elen2); - - /* - * Allocate three temporary buffers. The current numbers generally - * live in the upper halves of these buffers. - */ - LBNALLOC(a, BNWORD16, mlen*2); - if (a) { - LBNALLOC(b, BNWORD16, mlen*2); - if (b) { - LBNALLOC(c, BNWORD16, mlen*2); - if (c) - goto allocated; - LBNFREE(b, 2*mlen); - } - LBNFREE(a, 2*mlen); - } - return -1; - -allocated: - - anull = bnull = 1; - - mask = (1u<<bits) - 1; - for (i = mask; i; --i) { - /* Walk each exponent in turn */ - for (k = 0; k < 2; k++) { - /* Set up the exponent for walking */ - array = k ? array2 : array1; - eptr = k ? exp2 : exp1; - ewords = (k ? elen2 : elen1) - 1; - /* Set up bit buffer for walking the exponent */ - buf = BIGLITTLE(*--eptr, *eptr++); - bufbits = 16; - for (j = 0; ewords || buf; j++) { - /* Shift down current buffer */ - curbits = buf; - buf >>= bits; - /* If necessary, add next word */ - bufbits -= bits; - if (bufbits < 0 && ewords > 0) { - nextword = BIGLITTLE(*--eptr, *eptr++); - ewords--; - curbits |= nextword << (bufbits+bits); - buf = nextword >> -bufbits; - bufbits += 16; - } - /* If appropriate, multiply b *= array[j] */ - if ((curbits & mask) == i) { - BNWORD16 const *d = array[j]; - - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (bnull) { - lbnCopy_16(b1, d, mlen); - bnull = 0; - } else { - lbnMontMul_16(c, b1, d, mod, mlen, inv); - t = c; c = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - } - } - - /* Multiply a *= b */ - if (!bnull) { - a1 = BIGLITTLE(a-mlen-1,a+mlen); - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (anull) { - lbnCopy_16(a1, b1, mlen); - anull = 0; - } else { - lbnMontMul_16(c, a1, b1, mod, mlen, inv); - t = c; c = a; a = t; - } - } - } - - assert(!anull); /* If it were, elen would have been 0 */ - - /* Convert out of Montgomery form and return */ - a1 = BIGLITTLE(a-mlen-1,a+mlen); - lbnCopy_16(a, a1, mlen); - lbnZero_16(a1, mlen); - lbnMontReduce_16(a, mod, mlen, inv); - lbnCopy_16(result, a1, mlen); - -#if BNYIELD -yield: -#endif - LBNFREE(c, 2*mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; -} diff --git a/libs/libzrtp/third_party/bnlib/lbn16.h b/libs/libzrtp/third_party/bnlib/lbn16.h deleted file mode 100644 index 4370ab35bb..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn16.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef LBN16_H -#define LBN16_H - -#include "lbn.h" - -#ifndef BNWORD16 -#error 16-bit bignum library requires a 16-bit data type -#endif - -#ifndef lbnCopy_16 -void lbnCopy_16(BNWORD16 *dest, BNWORD16 const *src, unsigned len); -#endif -#ifndef lbnZero_16 -void lbnZero_16(BNWORD16 *num, unsigned len); -#endif -#ifndef lbnNeg_16 -void lbnNeg_16(BNWORD16 *num, unsigned len); -#endif - -#ifndef lbnAdd1_16 -BNWORD16 lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry); -#endif -#ifndef lbnSub1_16 -BNWORD16 lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow); -#endif - -#ifndef lbnAddN_16 -BNWORD16 lbnAddN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len); -#endif -#ifndef lbnSubN_16 -BNWORD16 lbnSubN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len); -#endif - -#ifndef lbnCmp_16 -int lbnCmp_16(BNWORD16 const *num1, BNWORD16 const *num2, unsigned len); -#endif - -#ifndef lbnMulN1_16 -void lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); -#endif -#ifndef lbnMulAdd1_16 -BNWORD16 -lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); -#endif -#ifndef lbnMulSub1_16 -BNWORD16 lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); -#endif - -#ifndef lbnLshift_16 -BNWORD16 lbnLshift_16(BNWORD16 *num, unsigned len, unsigned shift); -#endif -#ifndef lbnDouble_16 -BNWORD16 lbnDouble_16(BNWORD16 *num, unsigned len); -#endif -#ifndef lbnRshift_16 -BNWORD16 lbnRshift_16(BNWORD16 *num, unsigned len, unsigned shift); -#endif - -#ifndef lbnMul_16 -void lbnMul_16(BNWORD16 *prod, BNWORD16 const *num1, unsigned len1, - BNWORD16 const *num2, unsigned len2); -#endif -#ifndef lbnSquare_16 -void lbnSquare_16(BNWORD16 *prod, BNWORD16 const *num, unsigned len); -#endif - -#ifndef lbnNorm_16 -unsigned lbnNorm_16(BNWORD16 const *num, unsigned len); -#endif -#ifndef lbnBits_16 -unsigned lbnBits_16(BNWORD16 const *num, unsigned len); -#endif - -#ifndef lbnExtractBigBytes_16 -void lbnExtractBigBytes_16(BNWORD16 const *bn, unsigned char *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnInsertBigytes_16 -void lbnInsertBigBytes_16(BNWORD16 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnExtractLittleBytes_16 -void lbnExtractLittleBytes_16(BNWORD16 const *bn, unsigned char *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnInsertLittleBytes_16 -void lbnInsertLittleBytes_16(BNWORD16 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen); -#endif - -#ifndef lbnDiv21_16 -BNWORD16 lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d); -#endif -#ifndef lbnDiv1_16 -BNWORD16 lbnDiv1_16(BNWORD16 *q, BNWORD16 *rem, - BNWORD16 const *n, unsigned len, BNWORD16 d); -#endif -#ifndef lbnModQ_16 -unsigned lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d); -#endif -#ifndef lbnDiv_16 -BNWORD16 -lbnDiv_16(BNWORD16 *q, BNWORD16 *n, unsigned nlen, BNWORD16 *d, unsigned dlen); -#endif - -#ifndef lbnMontInv1_16 -BNWORD16 lbnMontInv1_16(BNWORD16 const x); -#endif -#ifndef lbnMontReduce_16 -void lbnMontReduce_16(BNWORD16 *n, BNWORD16 const *mod, unsigned const mlen, - BNWORD16 inv); -#endif -#ifndef lbnToMont_16 -void lbnToMont_16(BNWORD16 *n, unsigned nlen, BNWORD16 *mod, unsigned mlen); -#endif -#ifndef lbnFromMont_16 -void lbnFromMont_16(BNWORD16 *n, BNWORD16 *mod, unsigned len); -#endif - -#ifndef lbnExpMod_16 -int lbnExpMod_16(BNWORD16 *result, BNWORD16 const *n, unsigned nlen, - BNWORD16 const *exp, unsigned elen, BNWORD16 *mod, unsigned mlen); -#endif -#ifndef lbnDoubleExpMod_16 -int lbnDoubleExpMod_16(BNWORD16 *result, - BNWORD16 const *n1, unsigned n1len, BNWORD16 const *e1, unsigned e1len, - BNWORD16 const *n2, unsigned n2len, BNWORD16 const *e2, unsigned e2len, - BNWORD16 *mod, unsigned mlen); -#endif -#ifndef lbnTwoExpMod_16 -int lbnTwoExpMod_16(BNWORD16 *n, BNWORD16 const *exp, unsigned elen, - BNWORD16 *mod, unsigned mlen); -#endif -#ifndef lbnGcd_16 -int lbnGcd_16(BNWORD16 *a, unsigned alen, BNWORD16 *b, unsigned blen, - unsigned *rlen); -#endif -#ifndef lbnInv_16 -int lbnInv_16(BNWORD16 *a, unsigned alen, BNWORD16 const *mod, unsigned mlen); -#endif - -int lbnBasePrecompBegin_16(BNWORD16 **array, unsigned n, unsigned bits, - BNWORD16 const *g, unsigned glen, BNWORD16 *mod, unsigned mlen); -int lbnBasePrecompExp_16(BNWORD16 *result, BNWORD16 const * const *array, - unsigned bits, BNWORD16 const *exp, unsigned elen, - BNWORD16 const *mod, unsigned mlen); -int lbnDoubleBasePrecompExp_16(BNWORD16 *result, unsigned bits, - BNWORD16 const * const *array1, BNWORD16 const *exp1, unsigned elen1, - BNWORD16 const * const *array2, BNWORD16 const *exp2, - unsigned elen2, BNWORD16 const *mod, unsigned mlen); - -#endif /* LBN16_H */ diff --git a/libs/libzrtp/third_party/bnlib/lbn32.c b/libs/libzrtp/third_party/bnlib/lbn32.c deleted file mode 100644 index 996cccdc61..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn32.c +++ /dev/null @@ -1,4067 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn32.c - Low-level bignum routines, 32-bit version. - * - * NOTE: the magic constants "32" and "64" appear in many places in this - * file, including inside identifiers. Because it is not possible to - * ask "#ifdef" of a macro expansion, it is not possible to use the - * preprocessor to conditionalize these properly. Thus, this file is - * intended to be edited with textual search and replace to produce - * alternate word size versions. Any reference to the number of bits - * in a word must be the string "32", and that string must not appear - * otherwise. Any reference to twice this number must appear as "64", - * which likewise must not appear otherwise. Is that clear? - * - * Remember, when doubling the bit size replace the larger number (64) - * first, then the smaller (32). When halving the bit size, do the - * opposite. Otherwise, things will get wierd. Also, be sure to replace - * every instance that appears. (:%s/foo/bar/g in vi) - * - * These routines work with a pointer to the least-significant end of - * an array of WORD32s. The BIG(x), LITTLE(y) and BIGLTTLE(x,y) macros - * defined in lbn.h (which expand to x on a big-edian machine and y on a - * little-endian machine) are used to conditionalize the code to work - * either way. If you have no assembly primitives, it doesn't matter. - * Note that on a big-endian machine, the least-significant-end pointer - * is ONE PAST THE END. The bytes are ptr[-1] through ptr[-len]. - * On little-endian, they are ptr[0] through ptr[len-1]. This makes - * perfect sense if you consider pointers to point *between* bytes rather - * than at them. - * - * Because the array index values are unsigned integers, ptr[-i] - * may not work properly, since the index -i is evaluated as an unsigned, - * and if pointers are wider, zero-extension will produce a positive - * number rahter than the needed negative. The expression used in this - * code, *(ptr-i) will, however, work. (The array syntax is equivalent - * to *(ptr+-i), which is a pretty subtle difference.) - * - * Many of these routines will get very unhappy if fed zero-length inputs. - * They use assert() to enforce this. An higher layer of code must make - * sure that these aren't called with zero-length inputs. - * - * Any of these routines can be replaced with more efficient versions - * elsewhere, by just #defining their names. If one of the names - * is #defined, the C code is not compiled in and no declaration is - * made. Use the BNINCLUDE file to do that. Typically, you compile - * asm subroutines with the same name and just, e.g. - * #define lbnMulAdd1_32 lbnMulAdd1_32 - * - * If you want to write asm routines, start with lbnMulAdd1_32(). - * This is the workhorse of modular exponentiation. lbnMulN1_32() is - * also used a fair bit, although not as much and it's defined in terms - * of lbnMulAdd1_32 if that has a custom version. lbnMulSub1_32 and - * lbnDiv21_32 are used in the usual division and remainder finding. - * (Not the Montgomery reduction used in modular exponentiation, though.) - * Once you have lbnMulAdd1_32 defined, writing the other two should - * be pretty easy. (Just make sure you get the sign of the subtraction - * in lbnMulSub1_32 right - it's dest = dest - source * k.) - * - * The only definitions that absolutely need a double-word (BNWORD64) - * type are lbnMulAdd1_32 and lbnMulSub1_32; if those are provided, - * the rest follows. lbnDiv21_32, however, is a lot slower unless you - * have them, and lbnModQ_32 takes after it. That one is used quite a - * bit for prime sieving. - */ - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#if !NO_STRING_H -#include <string.h> /* For memcpy */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "lbn.h" -#include "lbn32.h" -#include "lbnmem.h" - -#include "kludge.h" - -#ifndef BNWORD32 -#error 32-bit bignum library requires a 32-bit data type -#endif - -/* If this is defined, include bnYield() calls */ -#if BNYIELD -extern int (*bnYield)(void); /* From bn.c */ -#endif - -/* - * Most of the multiply (and Montgomery reduce) routines use an outer - * loop that iterates over one of the operands - a so-called operand - * scanning approach. One big advantage of this is that the assembly - * support routines are simpler. The loops can be rearranged to have - * an outer loop that iterates over the product, a so-called product - * scanning approach. This has the advantage of writing less data - * and doing fewer adds to memory, so is supposedly faster. Some - * code has been written using a product-scanning approach, but - * it appears to be slower, so it is turned off by default. Some - * experimentation would be appreciated. - * - * (The code is also annoying to get right and not very well commented, - * one of my pet peeves about math libraries. I'm sorry.) - */ -#ifndef PRODUCT_SCAN -#define PRODUCT_SCAN 0 -#endif - -/* - * Copy an array of words. <Marvin mode on> Thrilling, isn't it? </Marvin> - * This is a good example of how the byte offsets and BIGLITTLE() macros work. - * Another alternative would have been - * memcpy(dest BIG(-len), src BIG(-len), len*sizeof(BNWORD32)), but I find that - * putting operators into conditional macros is confusing. - */ -#ifndef lbnCopy_32 -void -lbnCopy_32(BNWORD32 *dest, BNWORD32 const *src, unsigned len) -{ - memcpy(BIGLITTLE(dest-len,dest), BIGLITTLE(src-len,src), - len * sizeof(*src)); -} -#endif /* !lbnCopy_32 */ - -/* - * Fill n words with zero. This does it manually rather than calling - * memset because it can assume alignment to make things faster while - * memset can't. Note how big-endian numbers are naturally addressed - * using predecrement, while little-endian is postincrement. - */ -#ifndef lbnZero_32 -void -lbnZero_32(BNWORD32 *num, unsigned len) -{ - while (len--) - BIGLITTLE(*--num,*num++) = 0; -} -#endif /* !lbnZero_32 */ - -/* - * Negate an array of words. - * Negation is subtraction from zero. Negating low-order words - * entails doing nothing until a non-zero word is hit. Once that - * is negated, a borrow is generated and never dies until the end - * of the number is hit. Negation with borrow, -x-1, is the same as ~x. - * Repeat that until the end of the number. - * - * Doesn't return borrow out because that's pretty useless - it's - * always set unless the input is 0, which is easy to notice in - * normalized form. - */ -#ifndef lbnNeg_32 -void -lbnNeg_32(BNWORD32 *num, unsigned len) -{ - assert(len); - - /* Skip low-order zero words */ - while (BIGLITTLE(*--num,*num) == 0) { - if (!--len) - return; - LITTLE(num++;) - } - /* Negate the lowest-order non-zero word */ - *num = -*num; - /* Complement all the higher-order words */ - while (--len) { - BIGLITTLE(--num,++num); - *num = ~*num; - } -} -#endif /* !lbnNeg_32 */ - - -/* - * lbnAdd1_32: add the single-word "carry" to the given number. - * Used for minor increments and propagating the carry after - * adding in a shorter bignum. - * - * Technique: If we have a double-width word, presumably the compiler - * can add using its carry in inline code, so we just use a larger - * accumulator to compute the carry from the first addition. - * If not, it's more complex. After adding the first carry, which may - * be > 1, compare the sum and the carry. If the sum wraps (causing a - * carry out from the addition), the result will be less than each of the - * inputs, since the wrap subtracts a number (2^32) which is larger than - * the other input can possibly be. If the sum is >= the carry input, - * return success immediately. - * In either case, if there is a carry, enter a loop incrementing words - * until one does not wrap. Since we are adding 1 each time, the wrap - * will be to 0 and we can test for equality. - */ -#ifndef lbnAdd1_32 /* If defined, it's provided as an asm subroutine */ -#ifdef BNWORD64 -BNWORD32 -lbnAdd1_32(BNWORD32 *num, unsigned len, BNWORD32 carry) -{ - BNWORD64 t; - assert(len > 0); /* Alternative: if (!len) return carry */ - - t = (BNWORD64)BIGLITTLE(*--num,*num) + carry; - BIGLITTLE(*num,*num++) = (BNWORD32)t; - if ((t >> 32) == 0) - return 0; - while (--len) { - if (++BIGLITTLE(*--num,*num++) != 0) - return 0; - } - return 1; -} -#else /* no BNWORD64 */ -BNWORD32 -lbnAdd1_32(BNWORD32 *num, unsigned len, BNWORD32 carry) -{ - assert(len > 0); /* Alternative: if (!len) return carry */ - - if ((BIGLITTLE(*--num,*num++) += carry) >= carry) - return 0; - while (--len) { - if (++BIGLITTLE(*--num,*num++) != 0) - return 0; - } - return 1; -} -#endif -#endif/* !lbnAdd1_32 */ - -/* - * lbnSub1_32: subtract the single-word "borrow" from the given number. - * Used for minor decrements and propagating the borrow after - * subtracting a shorter bignum. - * - * Technique: Similar to the add, above. If there is a double-length type, - * use that to generate the first borrow. - * If not, after subtracting the first borrow, which may be > 1, compare - * the difference and the *negative* of the carry. If the subtract wraps - * (causing a borrow out from the subtraction), the result will be at least - * as large as -borrow. If the result < -borrow, then no borrow out has - * appeared and we may return immediately, except when borrow == 0. To - * deal with that case, use the identity that -x = ~x+1, and instead of - * comparing < -borrow, compare for <= ~borrow. - * Either way, if there is a borrow out, enter a loop decrementing words - * until a non-zero word is reached. - * - * Note the cast of ~borrow to (BNWORD32). If the size of an int is larger - * than BNWORD32, C rules say the number is expanded for the arithmetic, so - * the inversion will be done on an int and the value won't be quite what - * is expected. - */ -#ifndef lbnSub1_32 /* If defined, it's provided as an asm subroutine */ -#ifdef BNWORD64 -BNWORD32 -lbnSub1_32(BNWORD32 *num, unsigned len, BNWORD32 borrow) -{ - BNWORD64 t; - assert(len > 0); /* Alternative: if (!len) return borrow */ - - t = (BNWORD64)BIGLITTLE(*--num,*num) - borrow; - BIGLITTLE(*num,*num++) = (BNWORD32)t; - if ((t >> 32) == 0) - return 0; - while (--len) { - if ((BIGLITTLE(*--num,*num++))-- != 0) - return 0; - } - return 1; -} -#else /* no BNWORD64 */ -BNWORD32 -lbnSub1_32(BNWORD32 *num, unsigned len, BNWORD32 borrow) -{ - assert(len > 0); /* Alternative: if (!len) return borrow */ - - if ((BIGLITTLE(*--num,*num++) -= borrow) <= (BNWORD32)~borrow) - return 0; - while (--len) { - if ((BIGLITTLE(*--num,*num++))-- != 0) - return 0; - } - return 1; -} -#endif -#endif /* !lbnSub1_32 */ - -/* - * lbnAddN_32: add two bignums of the same length, returning the carry (0 or 1). - * One of the building blocks, along with lbnAdd1, of adding two bignums of - * differing lengths. - * - * Technique: Maintain a word of carry. If there is no double-width type, - * use the same technique as in lbnAdd1, above, to maintain the carry by - * comparing the inputs. Adding the carry sources is used as an OR operator; - * at most one of the two comparisons can possibly be true. The first can - * only be true if carry == 1 and x, the result, is 0. In that case the - * second can't possibly be true. - */ -#ifndef lbnAddN_32 -#ifdef BNWORD64 -BNWORD32 -lbnAddN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len) -{ - BNWORD64 t; - - assert(len > 0); - - t = (BNWORD64)BIGLITTLE(*--num1,*num1) + BIGLITTLE(*--num2,*num2++); - BIGLITTLE(*num1,*num1++) = (BNWORD32)t; - while (--len) { - t = (BNWORD64)BIGLITTLE(*--num1,*num1) + - (BNWORD64)BIGLITTLE(*--num2,*num2++) + (t >> 32); - BIGLITTLE(*num1,*num1++) = (BNWORD32)t; - } - - return (BNWORD32)(t>>32); -} -#else /* no BNWORD64 */ -BNWORD32 -lbnAddN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len) -{ - BNWORD32 x, carry = 0; - - assert(len > 0); /* Alternative: change loop to test at start */ - - do { - x = BIGLITTLE(*--num2,*num2++); - carry = (x += carry) < carry; - carry += (BIGLITTLE(*--num1,*num1++) += x) < x; - } while (--len); - - return carry; -} -#endif -#endif /* !lbnAddN_32 */ - -/* - * lbnSubN_32: add two bignums of the same length, returning the carry (0 or 1). - * One of the building blocks, along with subn1, of subtracting two bignums of - * differing lengths. - * - * Technique: If no double-width type is availble, maintain a word of borrow. - * First, add the borrow to the subtrahend (did you have to learn all those - * awful words in elementary school, too?), and if it overflows, set the - * borrow again. Then subtract the modified subtrahend from the next word - * of input, using the same technique as in subn1, above. - * Adding the borrows is used as an OR operator; at most one of the two - * comparisons can possibly be true. The first can only be true if - * borrow == 1 and x, the result, is 0. In that case the second can't - * possibly be true. - * - * In the double-word case, (BNWORD32)-(t>>32) is subtracted, rather than - * adding t>>32, because the shift would need to sign-extend and that's - * not guaranteed to happen in ANSI C, even with signed types. - */ -#ifndef lbnSubN_32 -#ifdef BNWORD64 -BNWORD32 -lbnSubN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len) -{ - BNWORD64 t; - - assert(len > 0); - - t = (BNWORD64)BIGLITTLE(*--num1,*num1) - BIGLITTLE(*--num2,*num2++); - BIGLITTLE(*num1,*num1++) = (BNWORD32)t; - - while (--len) { - t = (BNWORD64)BIGLITTLE(*--num1,*num1) - - (BNWORD64)BIGLITTLE(*--num2,*num2++) - (BNWORD32)-(t >> 32); - BIGLITTLE(*num1,*num1++) = (BNWORD32)t; - } - - return -(BNWORD32)(t>>32); -} -#else -BNWORD32 -lbnSubN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len) -{ - BNWORD32 x, borrow = 0; - - assert(len > 0); /* Alternative: change loop to test at start */ - - do { - x = BIGLITTLE(*--num2,*num2++); - borrow = (x += borrow) < borrow; - borrow += (BIGLITTLE(*--num1,*num1++) -= x) > (BNWORD32)~x; - } while (--len); - - return borrow; -} -#endif -#endif /* !lbnSubN_32 */ - -#ifndef lbnCmp_32 -/* - * lbnCmp_32: compare two bignums of equal length, returning the sign of - * num1 - num2. (-1, 0 or +1). - * - * Technique: Change the little-endian pointers to big-endian pointers - * and compare from the most-significant end until a difference if found. - * When it is, figure out the sign of the difference and return it. - */ -int -lbnCmp_32(BNWORD32 const *num1, BNWORD32 const *num2, unsigned len) -{ - BIGLITTLE(num1 -= len, num1 += len); - BIGLITTLE(num2 -= len, num2 += len); - - while (len--) { - if (BIGLITTLE(*num1++ != *num2++, *--num1 != *--num2)) { - if (BIGLITTLE(num1[-1] < num2[-1], *num1 < *num2)) - return -1; - else - return 1; - } - } - return 0; -} -#endif /* !lbnCmp_32 */ - -/* - * mul32_ppmmaa(ph,pl,x,y,a,b) is an optional routine that - * computes (ph,pl) = x * y + a + b. mul32_ppmma and mul32_ppmm - * are simpler versions. If you want to be lazy, all of these - * can be defined in terms of the others, so here we create any - * that have not been defined in terms of the ones that have been. - */ - -/* Define ones with fewer a's in terms of ones with more a's */ -#if !defined(mul32_ppmma) && defined(mul32_ppmmaa) -#define mul32_ppmma(ph,pl,x,y,a) mul32_ppmmaa(ph,pl,x,y,a,0) -#endif - -#if !defined(mul32_ppmm) && defined(mul32_ppmma) -#define mul32_ppmm(ph,pl,x,y) mul32_ppmma(ph,pl,x,y,0) -#endif - -/* - * Use this definition to test the mul32_ppmm-based operations on machines - * that do not provide mul32_ppmm. Change the final "0" to a "1" to - * enable it. - */ -#if !defined(mul32_ppmm) && defined(BNWORD64) && 0 /* Debugging */ -#define mul32_ppmm(ph,pl,x,y) \ - ({BNWORD64 _ = (BNWORD64)(x)*(y); (pl) = _; (ph) = _>>32;}) -#endif - -#if defined(mul32_ppmm) && !defined(mul32_ppmma) -#define mul32_ppmma(ph,pl,x,y,a) \ - (mul32_ppmm(ph,pl,x,y), (ph) += ((pl) += (a)) < (a)) -#endif - -#if defined(mul32_ppmma) && !defined(mul32_ppmmaa) -#define mul32_ppmmaa(ph,pl,x,y,a,b) \ - (mul32_ppmma(ph,pl,x,y,a), (ph) += ((pl) += (b)) < (b)) -#endif - -/* - * lbnMulN1_32: Multiply an n-word input by a 1-word input and store the - * n+1-word product. This uses either the mul32_ppmm and mul32_ppmma - * macros, or C multiplication with the BNWORD64 type. This uses mul32_ppmma - * if available, assuming you won't bother defining it unless you can do - * better than the normal multiplication. - */ -#ifndef lbnMulN1_32 -#ifdef lbnMulAdd1_32 /* If we have this asm primitive, use it. */ -void -lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - lbnZero_32(out, len); - BIGLITTLE(*(out-len-1),*(out+len)) = lbnMulAdd1_32(out, in, len, k); -} -#elif defined(mul32_ppmm) -void -lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - BNWORD32 carry, carryin; - - assert(len > 0); - - BIG(--out;--in;); - mul32_ppmm(carry, *out, *in, k); - LITTLE(out++;in++;) - - while (--len) { - BIG(--out;--in;) - carryin = carry; - mul32_ppmma(carry, *out, *in, k, carryin); - LITTLE(out++;in++;) - } - BIGLITTLE(*--out,*out) = carry; -} -#elif defined(BNWORD64) -void -lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - BNWORD64 p; - - assert(len > 0); - - p = (BNWORD64)BIGLITTLE(*--in,*in++) * k; - BIGLITTLE(*--out,*out++) = (BNWORD32)p; - - while (--len) { - p = (BNWORD64)BIGLITTLE(*--in,*in++) * k + (BNWORD32)(p >> 32); - BIGLITTLE(*--out,*out++) = (BNWORD32)p; - } - BIGLITTLE(*--out,*out) = (BNWORD32)(p >> 32); -} -#else -#error No 32x32 -> 64 multiply available for 32-bit bignum package -#endif -#endif /* lbnMulN1_32 */ - -/* - * lbnMulAdd1_32: Multiply an n-word input by a 1-word input and add the - * low n words of the product to the destination. *Returns the n+1st word - * of the product.* (That turns out to be more convenient than adding - * it into the destination and dealing with a possible unit carry out - * of *that*.) This uses either the mul32_ppmma and mul32_ppmmaa macros, - * or C multiplication with the BNWORD64 type. - * - * If you're going to write assembly primitives, this is the one to - * start with. It is by far the most commonly called function. - */ -#ifndef lbnMulAdd1_32 -#if defined(mul32_ppmm) -BNWORD32 -lbnMulAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - BNWORD32 prod, carry, carryin; - - assert(len > 0); - - BIG(--out;--in;); - carryin = *out; - mul32_ppmma(carry, *out, *in, k, carryin); - LITTLE(out++;in++;) - - while (--len) { - BIG(--out;--in;); - carryin = carry; - mul32_ppmmaa(carry, prod, *in, k, carryin, *out); - *out = prod; - LITTLE(out++;in++;) - } - - return carry; -} -#elif defined(BNWORD64) -BNWORD32 -lbnMulAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - BNWORD64 p; - - assert(len > 0); - - p = (BNWORD64)BIGLITTLE(*--in,*in++) * k + BIGLITTLE(*--out,*out); - BIGLITTLE(*out,*out++) = (BNWORD32)p; - - while (--len) { - p = (BNWORD64)BIGLITTLE(*--in,*in++) * k + - (BNWORD32)(p >> 32) + BIGLITTLE(*--out,*out); - BIGLITTLE(*out,*out++) = (BNWORD32)p; - } - - return (BNWORD32)(p >> 32); -} -#else -#error No 32x32 -> 64 multiply available for 32-bit bignum package -#endif -#endif /* lbnMulAdd1_32 */ - -/* - * lbnMulSub1_32: Multiply an n-word input by a 1-word input and subtract the - * n-word product from the destination. Returns the n+1st word of the product. - * This uses either the mul32_ppmm and mul32_ppmma macros, or - * C multiplication with the BNWORD64 type. - * - * This is rather uglier than adding, but fortunately it's only used in - * division which is not used too heavily. - */ -#ifndef lbnMulSub1_32 -#if defined(mul32_ppmm) -BNWORD32 -lbnMulSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - BNWORD32 prod, carry, carryin; - - assert(len > 0); - - BIG(--in;) - mul32_ppmm(carry, prod, *in, k); - LITTLE(in++;) - carry += (BIGLITTLE(*--out,*out++) -= prod) > (BNWORD32)~prod; - - while (--len) { - BIG(--in;); - carryin = carry; - mul32_ppmma(carry, prod, *in, k, carryin); - LITTLE(in++;) - carry += (BIGLITTLE(*--out,*out++) -= prod) > (BNWORD32)~prod; - } - - return carry; -} -#elif defined(BNWORD64) -BNWORD32 -lbnMulSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - BNWORD64 p; - BNWORD32 carry, t; - - assert(len > 0); - - p = (BNWORD64)BIGLITTLE(*--in,*in++) * k; - t = BIGLITTLE(*--out,*out); - carry = (BNWORD32)(p>>32) + ((BIGLITTLE(*out,*out++)=t-(BNWORD32)p) > t); - - while (--len) { - p = (BNWORD64)BIGLITTLE(*--in,*in++) * k + carry; - t = BIGLITTLE(*--out,*out); - carry = (BNWORD32)(p>>32) + - ( (BIGLITTLE(*out,*out++)=t-(BNWORD32)p) > t ); - } - - return carry; -} -#else -#error No 32x32 -> 64 multiply available for 32-bit bignum package -#endif -#endif /* !lbnMulSub1_32 */ - -/* - * Shift n words left "shift" bits. 0 < shift < 32. Returns the - * carry, any bits shifted off the left-hand side (0 <= carry < 2^shift). - */ -#ifndef lbnLshift_32 -BNWORD32 -lbnLshift_32(BNWORD32 *num, unsigned len, unsigned shift) -{ - BNWORD32 x, carry; - - assert(shift > 0); - assert(shift < 32); - - carry = 0; - while (len--) { - BIG(--num;) - x = *num; - *num = (x<<shift) | carry; - LITTLE(num++;) - carry = x >> (32-shift); - } - return carry; -} -#endif /* !lbnLshift_32 */ - -/* - * An optimized version of the above, for shifts of 1. - * Some machines can use add-with-carry tricks for this. - */ -#ifndef lbnDouble_32 -BNWORD32 -lbnDouble_32(BNWORD32 *num, unsigned len) -{ - BNWORD32 x, carry; - - carry = 0; - while (len--) { - BIG(--num;) - x = *num; - *num = (x<<1) | carry; - LITTLE(num++;) - carry = x >> (32-1); - } - return carry; -} -#endif /* !lbnDouble_32 */ - -/* - * Shift n words right "shift" bits. 0 < shift < 32. Returns the - * carry, any bits shifted off the right-hand side (0 <= carry < 2^shift). - */ -#ifndef lbnRshift_32 -BNWORD32 -lbnRshift_32(BNWORD32 *num, unsigned len, unsigned shift) -{ - BNWORD32 x, carry = 0; - - assert(shift > 0); - assert(shift < 32); - - BIGLITTLE(num -= len, num += len); - - while (len--) { - LITTLE(--num;) - x = *num; - *num = (x>>shift) | carry; - BIG(num++;) - carry = x << (32-shift); - } - return carry >> (32-shift); -} -#endif /* !lbnRshift_32 */ - -/* - * Multiply two numbers of the given lengths. prod and num2 may overlap, - * provided that the low len1 bits of prod are free. (This corresponds - * nicely to the place the result is returned from lbnMontReduce_32.) - * - * TODO: Use Karatsuba multiply. The overlap constraints may have - * to get rewhacked. - */ -#ifndef lbnMul_32 -void -lbnMul_32(BNWORD32 *prod, BNWORD32 const *num1, unsigned len1, - BNWORD32 const *num2, unsigned len2) -{ - /* Special case of zero */ - if (!len1 || !len2) { - lbnZero_32(prod, len1+len2); - return; - } - - /* Multiply first word */ - lbnMulN1_32(prod, num1, len1, BIGLITTLE(*--num2,*num2++)); - - /* - * Add in subsequent words, storing the most significant word, - * which is new each time. - */ - while (--len2) { - BIGLITTLE(--prod,prod++); - BIGLITTLE(*(prod-len1-1),*(prod+len1)) = - lbnMulAdd1_32(prod, num1, len1, BIGLITTLE(*--num2,*num2++)); - } -} -#endif /* !lbnMul_32 */ - -/* - * lbnMulX_32 is a square multiply - both inputs are the same length. - * It's normally just a macro wrapper around the general multiply, - * but might be implementable in assembly more efficiently (such as - * when product scanning). - */ -#ifndef lbnMulX_32 -#if defined(BNWORD64) && PRODUCT_SCAN -/* - * Test code to see whether product scanning is any faster. It seems - * to make the C code slower, so PRODUCT_SCAN is not defined. - */ -static void -lbnMulX_32(BNWORD32 *prod, BNWORD32 const *num1, BNWORD32 const *num2, - unsigned len) -{ - BNWORD64 x, y; - BNWORD32 const *p1, *p2; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - x = (BNWORD64)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]); - BIGLITTLE(*--prod, *prod++) = (BNWORD32)x; - x >>= 32; - - for (i = 1; i < len; i++) { - carry = 0; - p1 = num1; - p2 = BIGLITTLE(num2-i-1,num2+i+1); - for (j = 0; j <= i; j++) { - BIG(y = (BNWORD64)*--p1 * *p2++;) - LITTLE(y = (BNWORD64)*p1++ * *--p2;) - x += y; - carry += (x < y); - } - BIGLITTLE(*--prod,*prod++) = (BNWORD32)x; - x = (x >> 32) | (BNWORD64)carry << 32; - } - for (i = 1; i < len; i++) { - carry = 0; - p1 = BIGLITTLE(num1-i,num1+i); - p2 = BIGLITTLE(num2-len,num2+len); - for (j = i; j < len; j++) { - BIG(y = (BNWORD64)*--p1 * *p2++;) - LITTLE(y = (BNWORD64)*p1++ * *--p2;) - x += y; - carry += (x < y); - } - BIGLITTLE(*--prod,*prod++) = (BNWORD32)x; - x = (x >> 32) | (BNWORD64)carry << 32; - } - - BIGLITTLE(*--prod,*prod) = (BNWORD32)x; -} -#else /* !defined(BNWORD64) || !PRODUCT_SCAN */ -/* Default trivial macro definition */ -#define lbnMulX_32(prod, num1, num2, len) lbnMul_32(prod, num1, len, num2, len) -#endif /* !defined(BNWORD64) || !PRODUCT_SCAN */ -#endif /* !lbmMulX_32 */ - -#if !defined(lbnMontMul_32) && defined(BNWORD64) && PRODUCT_SCAN -/* - * Test code for product-scanning multiply. This seems to slow the C - * code down rather than speed it up. - * This does a multiply and Montgomery reduction together, using the - * same loops. The outer loop scans across the product, twice. - * The first pass computes the low half of the product and the - * Montgomery multipliers. These are stored in the product array, - * which contains no data as of yet. x and carry add up the columns - * and propagate carries forward. - * - * The second half multiplies the upper half, adding in the modulus - * times the Montgomery multipliers. The results of this multiply - * are stored. - */ -static void -lbnMontMul_32(BNWORD32 *prod, BNWORD32 const *num1, BNWORD32 const *num2, - BNWORD32 const *mod, unsigned len, BNWORD32 inv) -{ - BNWORD64 x, y; - BNWORD32 const *p1, *p2, *pm; - BNWORD32 *pp; - BNWORD32 t; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - /* - * This computes directly into the high half of prod, so just - * shift the pointer and consider prod only "len" elements long - * for the rest of the code. - */ - BIGLITTLE(prod -= len, prod += len); - - /* Pass 1 - compute Montgomery multipliers */ - /* First iteration can have certain simplifications. */ - x = (BNWORD64)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]); - BIGLITTLE(prod[-1], prod[0]) = t = inv * (BNWORD32)x; - y = (BNWORD64)t * BIGLITTLE(mod[-1],mod[0]); - x += y; - /* Note: GCC 2.6.3 has a bug if you try to eliminate "carry" */ - carry = (x < y); - assert((BNWORD32)x == 0); - x = x >> 32 | (BNWORD64)carry << 32; - - for (i = 1; i < len; i++) { - carry = 0; - p1 = num1; - p2 = BIGLITTLE(num2-i-1,num2+i+1); - pp = prod; - pm = BIGLITTLE(mod-i-1,mod+i+1); - for (j = 0; j < i; j++) { - y = (BNWORD64)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2); - x += y; - carry += (x < y); - y = (BNWORD64)BIGLITTLE(*--pp * *pm++, *pp++ * *--pm); - x += y; - carry += (x < y); - } - y = (BNWORD64)BIGLITTLE(p1[-1] * p2[0], p1[0] * p2[-1]); - x += y; - carry += (x < y); - assert(BIGLITTLE(pp == prod-i, pp == prod+i)); - BIGLITTLE(pp[-1], pp[0]) = t = inv * (BNWORD32)x; - assert(BIGLITTLE(pm == mod-1, pm == mod+1)); - y = (BNWORD64)t * BIGLITTLE(pm[0],pm[-1]); - x += y; - carry += (x < y); - assert((BNWORD32)x == 0); - x = x >> 32 | (BNWORD64)carry << 32; - } - - /* Pass 2 - compute reduced product and store */ - for (i = 1; i < len; i++) { - carry = 0; - p1 = BIGLITTLE(num1-i,num1+i); - p2 = BIGLITTLE(num2-len,num2+len); - pm = BIGLITTLE(mod-i,mod+i); - pp = BIGLITTLE(prod-len,prod+len); - for (j = i; j < len; j++) { - y = (BNWORD64)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2); - x += y; - carry += (x < y); - y = (BNWORD64)BIGLITTLE(*--pm * *pp++, *pm++ * *--pp); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pm == mod-len, pm == mod+len)); - assert(BIGLITTLE(pp == prod-i, pp == prod+i)); - BIGLITTLE(pp[0],pp[-1]) = (BNWORD32)x; - x = (x >> 32) | (BNWORD64)carry << 32; - } - - /* Last round of second half, simplified. */ - BIGLITTLE(*(prod-len),*(prod+len-1)) = (BNWORD32)x; - carry = (x >> 32); - - while (carry) - carry -= lbnSubN_32(prod, mod, len); - while (lbnCmp_32(prod, mod, len) >= 0) - (void)lbnSubN_32(prod, mod, len); -} -/* Suppress later definition */ -#define lbnMontMul_32 lbnMontMul_32 -#endif - -#if !defined(lbnSquare_32) && defined(BNWORD64) && PRODUCT_SCAN -/* - * Trial code for product-scanning squaring. This seems to slow the C - * code down rather than speed it up. - */ -void -lbnSquare_32(BNWORD32 *prod, BNWORD32 const *num, unsigned len) -{ - BNWORD64 x, y, z; - BNWORD32 const *p1, *p2; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - /* Word 0 of product */ - x = (BNWORD64)BIGLITTLE(num[-1] * num[-1], num[0] * num[0]); - BIGLITTLE(*--prod, *prod++) = (BNWORD32)x; - x >>= 32; - - /* Words 1 through len-1 */ - for (i = 1; i < len; i++) { - carry = 0; - y = 0; - p1 = num; - p2 = BIGLITTLE(num-i-1,num+i+1); - for (j = 0; j < (i+1)/2; j++) { - BIG(z = (BNWORD64)*--p1 * *p2++;) - LITTLE(z = (BNWORD64)*p1++ * *--p2;) - y += z; - carry += (y < z); - } - y += z = y; - carry += carry + (y < z); - if ((i & 1) == 0) { - assert(BIGLITTLE(--p1 == p2, p1 == --p2)); - BIG(z = (BNWORD64)*p2 * *p2;) - LITTLE(z = (BNWORD64)*p1 * *p1;) - y += z; - carry += (y < z); - } - x += y; - carry += (x < y); - BIGLITTLE(*--prod,*prod++) = (BNWORD32)x; - x = (x >> 32) | (BNWORD64)carry << 32; - } - /* Words len through 2*len-2 */ - for (i = 1; i < len; i++) { - carry = 0; - y = 0; - p1 = BIGLITTLE(num-i,num+i); - p2 = BIGLITTLE(num-len,num+len); - for (j = 0; j < (len-i)/2; j++) { - BIG(z = (BNWORD64)*--p1 * *p2++;) - LITTLE(z = (BNWORD64)*p1++ * *--p2;) - y += z; - carry += (y < z); - } - y += z = y; - carry += carry + (y < z); - if ((len-i) & 1) { - assert(BIGLITTLE(--p1 == p2, p1 == --p2)); - BIG(z = (BNWORD64)*p2 * *p2;) - LITTLE(z = (BNWORD64)*p1 * *p1;) - y += z; - carry += (y < z); - } - x += y; - carry += (x < y); - BIGLITTLE(*--prod,*prod++) = (BNWORD32)x; - x = (x >> 32) | (BNWORD64)carry << 32; - } - - /* Word 2*len-1 */ - BIGLITTLE(*--prod,*prod) = (BNWORD32)x; -} -/* Suppress later definition */ -#define lbnSquare_32 lbnSquare_32 -#endif - -/* - * Square a number, using optimized squaring to reduce the number of - * primitive multiples that are executed. There may not be any - * overlap of the input and output. - * - * Technique: Consider the partial products in the multiplication - * of "abcde" by itself: - * - * a b c d e - * * a b c d e - * ================== - * ae be ce de ee - * ad bd cd dd de - * ac bc cc cd ce - * ab bb bc bd be - * aa ab ac ad ae - * - * Note that everything above the main diagonal: - * ae be ce de = (abcd) * e - * ad bd cd = (abc) * d - * ac bc = (ab) * c - * ab = (a) * b - * - * is a copy of everything below the main diagonal: - * de - * cd ce - * bc bd be - * ab ac ad ae - * - * Thus, the sum is 2 * (off the diagonal) + diagonal. - * - * This is accumulated beginning with the diagonal (which - * consist of the squares of the digits of the input), which is then - * divided by two, the off-diagonal added, and multiplied by two - * again. The low bit is simply a copy of the low bit of the - * input, so it doesn't need special care. - * - * TODO: Merge the shift by 1 with the squaring loop. - * TODO: Use Karatsuba. (a*W+b)^2 = a^2 * (W^2+W) + b^2 * (W+1) - (a-b)^2 * W. - */ -#ifndef lbnSquare_32 -void -lbnSquare_32(BNWORD32 *prod, BNWORD32 const *num, unsigned len) -{ - BNWORD32 t; - BNWORD32 *prodx = prod; /* Working copy of the argument */ - BNWORD32 const *numx = num; /* Working copy of the argument */ - unsigned lenx = len; /* Working copy of the argument */ - - if (!len) - return; - - /* First, store all the squares */ - while (lenx--) { -#ifdef mul32_ppmm - BNWORD32 ph, pl; - t = BIGLITTLE(*--numx,*numx++); - mul32_ppmm(ph,pl,t,t); - BIGLITTLE(*--prodx,*prodx++) = pl; - BIGLITTLE(*--prodx,*prodx++) = ph; -#elif defined(BNWORD64) /* use BNWORD64 */ - BNWORD64 p; - t = BIGLITTLE(*--numx,*numx++); - p = (BNWORD64)t * t; - BIGLITTLE(*--prodx,*prodx++) = (BNWORD32)p; - BIGLITTLE(*--prodx,*prodx++) = (BNWORD32)(p>>32); -#else /* Use lbnMulN1_32 */ - t = BIGLITTLE(numx[-1],*numx); - lbnMulN1_32(prodx, numx, 1, t); - BIGLITTLE(--numx,numx++); - BIGLITTLE(prodx -= 2, prodx += 2); -#endif - } - /* Then, shift right 1 bit */ - (void)lbnRshift_32(prod, 2*len, 1); - - /* Then, add in the off-diagonal sums */ - lenx = len; - numx = num; - prodx = prod; - while (--lenx) { - t = BIGLITTLE(*--numx,*numx++); - BIGLITTLE(--prodx,prodx++); - t = lbnMulAdd1_32(prodx, numx, lenx, t); - lbnAdd1_32(BIGLITTLE(prodx-lenx,prodx+lenx), lenx+1, t); - BIGLITTLE(--prodx,prodx++); - } - - /* Shift it back up */ - lbnDouble_32(prod, 2*len); - - /* And set the low bit appropriately */ - BIGLITTLE(prod[-1],prod[0]) |= BIGLITTLE(num[-1],num[0]) & 1; -} -#endif /* !lbnSquare_32 */ - -/* - * lbnNorm_32 - given a number, return a modified length such that the - * most significant digit is non-zero. Zero-length input is okay. - */ -#ifndef lbnNorm_32 -unsigned -lbnNorm_32(BNWORD32 const *num, unsigned len) -{ - BIGLITTLE(num -= len,num += len); - while (len && BIGLITTLE(*num++,*--num) == 0) - --len; - return len; -} -#endif /* lbnNorm_32 */ - -/* - * lbnBits_32 - return the number of significant bits in the array. - * It starts by normalizing the array. Zero-length input is okay. - * Then assuming there's anything to it, it fetches the high word, - * generates a bit length by multiplying the word length by 32, and - * subtracts off 32/2, 32/4, 32/8, ... bits if the high bits are clear. - */ -#ifndef lbnBits_32 -unsigned -lbnBits_32(BNWORD32 const *num, unsigned len) -{ - BNWORD32 t; - unsigned i; - - len = lbnNorm_32(num, len); - if (len) { - t = BIGLITTLE(*(num-len),*(num+(len-1))); - assert(t); - len *= 32; - i = 32/2; - do { - if (t >> i) - t >>= i; - else - len -= i; - } while ((i /= 2) != 0); - } - return len; -} -#endif /* lbnBits_32 */ - -/* - * If defined, use hand-rolled divide rather than compiler's native. - * If the machine doesn't do it in line, the manual code is probably - * faster, since it can assume normalization and the fact that the - * quotient will fit into 32 bits, which a general 64-bit divide - * in a compiler's run-time library can't do. - */ -#ifndef BN_SLOW_DIVIDE_64 -/* Assume that divisors of more than thirty-two bits are slow */ -#define BN_SLOW_DIVIDE_64 (64 > 0x20) -#endif - -/* - * Return (nh<<32|nl) % d, and place the quotient digit into *q. - * It is guaranteed that nh < d, and that d is normalized (with its high - * bit set). If we have a double-width type, it's easy. If not, ooh, - * yuk! - */ -#ifndef lbnDiv21_32 -#if defined(BNWORD64) && !BN_SLOW_DIVIDE_64 -BNWORD32 -lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d) -{ - BNWORD64 n = (BNWORD64)nh << 32 | nl; - - /* Divisor must be normalized */ - assert(d >> (32-1) == 1); - - *q = n / d; - return n % d; -} -#else -/* - * This is where it gets ugly. - * - * Do the division in two halves, using Algorithm D from section 4.3.1 - * of Knuth. Note Theorem B from that section, that the quotient estimate - * is never more than the true quotient, and is never more than two - * too low. - * - * The mapping onto conventional long division is (everything a half word): - * _____________qh___ql_ - * dh dl ) nh.h nh.l nl.h nl.l - * - (qh * d) - * ----------- - * rrrr rrrr nl.l - * - (ql * d) - * ----------- - * rrrr rrrr - * - * The implicit 3/2-digit d*qh and d*ql subtractors are computed this way: - * First, estimate a q digit so that nh/dh works. Subtracting qh*dh from - * the (nh.h nh.l) list leaves a 1/2-word remainder r. Then compute the - * low part of the subtractor, qh * dl. This also needs to be subtracted - * from (nh.h nh.l nl.h) to get the final remainder. So we take the - * remainder, which is (nh.h nh.l) - qh*dl, shift it and add in nl.h, and - * try to subtract qh * dl from that. Since the remainder is 1/2-word - * long, shifting and adding nl.h results in a single word r. - * It is possible that the remainder we're working with, r, is less than - * the product qh * dl, if we estimated qh too high. The estimation - * technique can produce a qh that is too large (never too small), leading - * to r which is too small. In that case, decrement the digit qh, add - * shifted dh to r (to correct for that error), and subtract dl from the - * product we're comparing r with. That's the "correct" way to do it, but - * just adding dl to r instead of subtracting it from the product is - * equivalent and a lot simpler. You just have to watch out for overflow. - * - * The process is repeated with (rrrr rrrr nl.l) for the low digit of the - * quotient ql. - * - * The various uses of 32/2 for shifts are because of the note about - * automatic editing of this file at the very top of the file. - */ -#define highhalf(x) ( (x) >> 32/2 ) -#define lowhalf(x) ( (x) & (((BNWORD32)1 << 32/2)-1) ) -BNWORD32 -lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d) -{ - BNWORD32 dh = highhalf(d), dl = lowhalf(d); - BNWORD32 qh, ql, prod, r; - - /* Divisor must be normalized */ - assert((d >> (32-1)) == 1); - - /* Do first half-word of division */ - qh = nh / dh; - r = nh % dh; - prod = qh * dl; - - /* - * Add next half-word of numerator to remainder and correct. - * qh may be up to two too large. - */ - r = (r << (32/2)) | highhalf(nl); - if (r < prod) { - --qh; r += d; - if (r >= d && r < prod) { - --qh; r += d; - } - } - r -= prod; - - /* Do second half-word of division */ - ql = r / dh; - r = r % dh; - prod = ql * dl; - - r = (r << (32/2)) | lowhalf(nl); - if (r < prod) { - --ql; r += d; - if (r >= d && r < prod) { - --ql; r += d; - } - } - r -= prod; - - *q = (qh << (32/2)) | ql; - - return r; -} -#endif -#endif /* lbnDiv21_32 */ - - -/* - * In the division functions, the dividend and divisor are referred to - * as "n" and "d", which stand for "numerator" and "denominator". - * - * The quotient is (nlen-dlen+1) digits long. It may be overlapped with - * the high (nlen-dlen) words of the dividend, but one extra word is needed - * on top to hold the top word. - */ - -/* - * Divide an n-word number by a 1-word number, storing the remainder - * and n-1 words of the n-word quotient. The high word is returned. - * It IS legal for rem to point to the same address as n, and for - * q to point one word higher. - * - * TODO: If BN_SLOW_DIVIDE_64, add a divnhalf_32 which uses 32-bit - * dividends if the divisor is half that long. - * TODO: Shift the dividend on the fly to avoid the last division and - * instead have a remainder that needs shifting. - * TODO: Use reciprocals rather than dividing. - */ -#ifndef lbnDiv1_32 -BNWORD32 -lbnDiv1_32(BNWORD32 *q, BNWORD32 *rem, BNWORD32 const *n, unsigned len, - BNWORD32 d) -{ - unsigned shift; - unsigned xlen; - BNWORD32 r; - BNWORD32 qhigh; - - assert(len > 0); - assert(d); - - if (len == 1) { - r = *n; - *rem = r%d; - return r/d; - } - - shift = 0; - r = d; - xlen = 32/2; - do { - if (r >> xlen) - r >>= xlen; - else - shift += xlen; - } while ((xlen /= 2) != 0); - assert((d >> (32-1-shift)) == 1); - d <<= shift; - - BIGLITTLE(q -= len-1,q += len-1); - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - if (r < d) { - qhigh = 0; - } else { - qhigh = r/d; - r %= d; - } - - xlen = len; - while (--xlen) - r = lbnDiv21_32(BIGLITTLE(q++,--q), r, BIGLITTLE(*n++,*--n), d); - - /* - * Final correction for shift - shift the quotient up "shift" - * bits, and merge in the extra bits of quotient. Then reduce - * the final remainder mod the real d. - */ - if (shift) { - d >>= shift; - qhigh = (qhigh << shift) | lbnLshift_32(q, len-1, shift); - BIGLITTLE(q[-1],*q) |= r/d; - r %= d; - } - *rem = r; - - return qhigh; -} -#endif - -/* - * This function performs a "quick" modulus of a number with a divisor - * d which is guaranteed to be at most sixteen bits, i.e. less than 65536. - * This applies regardless of the word size the library is compiled with. - * - * This function is important to prime generation, for sieving. - */ -#ifndef lbnModQ_32 -/* If there's a custom lbnMod21_32, no normalization needed */ -#ifdef lbnMod21_32 -unsigned -lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d) -{ - unsigned i, shift; - BNWORD32 r; - - assert(len > 0); - - BIGLITTLE(n -= len,n += len); - - /* Try using a compare to avoid the first divide */ - r = BIGLITTLE(*n++,*--n); - if (r >= d) - r %= d; - while (--len) - r = lbnMod21_32(r, BIGLITTLE(*n++,*--n), d); - - return r; -} -#elif defined(BNWORD64) && !BN_SLOW_DIVIDE_64 -unsigned -lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d) -{ - BNWORD32 r; - - if (!--len) - return BIGLITTLE(n[-1],n[0]) % d; - - BIGLITTLE(n -= len,n += len); - r = BIGLITTLE(n[-1],n[0]); - - do { - r = (BNWORD32)((((BNWORD64)r<<32) | BIGLITTLE(*n++,*--n)) % d); - } while (--len); - - return r; -} -#elif 32 >= 0x20 -/* - * If the single word size can hold 65535*65536, then this function - * is avilable. - */ -#ifndef highhalf -#define highhalf(x) ( (x) >> 32/2 ) -#define lowhalf(x) ( (x) & ((1 << 32/2)-1) ) -#endif -unsigned -lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d) -{ - BNWORD32 r, x; - - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - while (--len) { - x = BIGLITTLE(*n++,*--n); - r = (r%d << 32/2) | highhalf(x); - r = (r%d << 32/2) | lowhalf(x); - } - - return r%d; -} -#else -/* Default case - use lbnDiv21_32 */ -unsigned -lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d) -{ - unsigned i, shift; - BNWORD32 r; - BNWORD32 q; - - assert(len > 0); - - shift = 0; - r = d; - i = 32; - while (i /= 2) { - if (r >> i) - r >>= i; - else - shift += i; - } - assert(d >> (32-1-shift) == 1); - d <<= shift; - - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - if (r >= d) - r %= d; - - while (--len) - r = lbnDiv21_32(&q, r, BIGLITTLE(*n++,*--n), d); - - /* - * Final correction for shift - shift the quotient up "shift" - * bits, and merge in the extra bits of quotient. Then reduce - * the final remainder mod the real d. - */ - if (shift) - r %= d >> shift; - - return r; -} -#endif -#endif /* lbnModQ_32 */ - -/* - * Reduce n mod d and return the quotient. That is, find: - * q = n / d; - * n = n % d; - * d is altered during the execution of this subroutine by normalizing it. - * It must already have its most significant word non-zero; it is shifted - * so its most significant bit is non-zero. - * - * The quotient q is nlen-dlen+1 words long. To make it possible to - * overlap the quptient with the input (you can store it in the high dlen - * words), the high word of the quotient is *not* stored, but is returned. - * (If all you want is the remainder, you don't care about it, anyway.) - * - * This uses algorithm D from Knuth (4.3.1), except that we do binary - * (shift) normalization of the divisor. WARNING: This is hairy! - * - * This function is used for some modular reduction, but it is not used in - * the modular exponentiation loops; they use Montgomery form and the - * corresponding, more efficient, Montgomery reduction. This code - * is needed for the conversion to Montgomery form, however, so it - * has to be here and it might as well be reasonably efficient. - * - * The overall operation is as follows ("top" and "up" refer to the - * most significant end of the number; "bottom" and "down", the least): - * - * - Shift the divisor up until the most significant bit is set. - * - Shift the dividend up the same amount. This will produce the - * correct quotient, and the remainder can be recovered by shifting - * it back down the same number of bits. This may produce an overflow - * word, but the word is always strictly less than the most significant - * divisor word. - * - Estimate the first quotient digit qhat: - * - First take the top two words (one of which is the overflow) of the - * dividend and divide by the top word of the divisor: - * qhat = (nh,nm)/dh. This qhat is >= the correct quotient digit - * and, since dh is normalized, it is at most two over. - * - Second, correct by comparing the top three words. If - * (dh,dl) * qhat > (nh,nm,ml), decrease qhat and try again. - * The second iteration can be simpler because there can't be a third. - * The computation can be simplified by subtracting dh*qhat from - * both sides, suitably shifted. This reduces the left side to - * dl*qhat. On the right, (nh,nm)-dh*qhat is simply the - * remainder r from (nh,nm)%dh, so the right is (r,nl). - * This produces qhat that is almost always correct and at - * most (prob ~ 2/2^32) one too high. - * - Subtract qhat times the divisor (suitably shifted) from the dividend. - * If there is a borrow, qhat was wrong, so decrement it - * and add the divisor back in (once). - * - Store the final quotient digit qhat in the quotient array q. - * - * Repeat the quotient digit computation for successive digits of the - * quotient until the whole quotient has been computed. Then shift the - * divisor and the remainder down to correct for the normalization. - * - * TODO: Special case 2-word divisors. - * TODO: Use reciprocals rather than dividing. - */ -#ifndef divn_32 -BNWORD32 -lbnDiv_32(BNWORD32 *q, BNWORD32 *n, unsigned nlen, BNWORD32 *d, unsigned dlen) -{ - BNWORD32 nh,nm,nl; /* Top three words of the dividend */ - BNWORD32 dh,dl; /* Top two words of the divisor */ - BNWORD32 qhat; /* Extimate of quotient word */ - BNWORD32 r; /* Remainder from quotient estimate division */ - BNWORD32 qhigh; /* High word of quotient */ - unsigned i; /* Temp */ - unsigned shift; /* Bits shifted by normalization */ - unsigned qlen = nlen-dlen; /* Size of quotient (less 1) */ -#ifdef mul32_ppmm - BNWORD32 t32; -#elif defined(BNWORD64) - BNWORD64 t64; -#else /* use lbnMulN1_32 */ - BNWORD32 t2[2]; -#define t2high BIGLITTLE(t2[0],t2[1]) -#define t2low BIGLITTLE(t2[1],t2[0]) -#endif - - assert(dlen); - assert(nlen >= dlen); - - /* - * Special cases for short divisors. The general case uses the - * top top 2 digits of the divisor (d) to estimate a quotient digit, - * so it breaks if there are fewer digits available. Thus, we need - * special cases for a divisor of length 1. A divisor of length - * 2 can have a *lot* of administrivia overhead removed removed, - * so it's probably worth special-casing that case, too. - */ - if (dlen == 1) - return lbnDiv1_32(q, BIGLITTLE(n-1,n), n, nlen, - BIGLITTLE(d[-1],d[0])); - -#if 0 - /* - * @@@ This is not yet written... The general loop will do, - * albeit less efficiently - */ - if (dlen == 2) { - /* - * divisor two digits long: - * use the 3/2 technique from Knuth, but we know - * it's exact. - */ - dh = BIGLITTLE(d[-1],d[0]); - dl = BIGLITTLE(d[-2],d[1]); - shift = 0; - if ((sh & ((BNWORD32)1 << 32-1-shift)) == 0) { - do { - shift++; - } while (dh & (BNWORD32)1<<32-1-shift) == 0); - dh = dh << shift | dl >> (32-shift); - dl <<= shift; - - - } - - - for (shift = 0; (dh & (BNWORD32)1 << 32-1-shift)) == 0; shift++) - ; - if (shift) { - } - dh = dh << shift | dl >> (32-shift); - shift = 0; - while (dh - } -#endif - - dh = BIGLITTLE(*(d-dlen),*(d+(dlen-1))); - assert(dh); - - /* Normalize the divisor */ - shift = 0; - r = dh; - i = 32/2; - do { - if (r >> i) - r >>= i; - else - shift += i; - } while ((i /= 2) != 0); - - nh = 0; - if (shift) { - lbnLshift_32(d, dlen, shift); - dh = BIGLITTLE(*(d-dlen),*(d+(dlen-1))); - nh = lbnLshift_32(n, nlen, shift); - } - - /* Assert that dh is now normalized */ - assert(dh >> (32-1)); - - /* Also get the second-most significant word of the divisor */ - dl = BIGLITTLE(*(d-(dlen-1)),*(d+(dlen-2))); - - /* - * Adjust pointers: n to point to least significant end of first - * first subtract, and q to one the most-significant end of the - * quotient array. - */ - BIGLITTLE(n -= qlen,n += qlen); - BIGLITTLE(q -= qlen,q += qlen); - - /* Fetch the most significant stored word of the dividend */ - nm = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - - /* - * Compute the first digit of the quotient, based on the - * first two words of the dividend (the most significant of which - * is the overflow word h). - */ - if (nh) { - assert(nh < dh); - r = lbnDiv21_32(&qhat, nh, nm, dh); - } else if (nm >= dh) { - qhat = nm/dh; - r = nm % dh; - } else { /* Quotient is zero */ - qhigh = 0; - goto divloop; - } - - /* Now get the third most significant word of the dividend */ - nl = BIGLITTLE(*(n-(dlen-1)),*(n+(dlen-2))); - - /* - * Correct qhat, the estimate of quotient digit. - * qhat can only be high, and at most two words high, - * so the loop can be unrolled and abbreviated. - */ -#ifdef mul32_ppmm - mul32_ppmm(nm, t32, qhat, dl); - if (nm > r || (nm == r && t32 > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - nm -= (t32 < dl); - t32 -= dl; - if (nm > r || (nm == r && t32 > nl)) - qhat--; - } - } -#elif defined(BNWORD64) - t64 = (BNWORD64)qhat * dl; - if (t64 > ((BNWORD64)r << 32) + nl) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) > dh) { - t64 -= dl; - if (t64 > ((BNWORD64)r << 32) + nl) - qhat--; - } - } -#else /* Use lbnMulN1_32 */ - lbnMulN1_32(BIGLITTLE(t2+2,t2), &dl, 1, qhat); - if (t2high > r || (t2high == r && t2low > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t2high -= (t2low < dl); - t2low -= dl; - if (t2high > r || (t2high == r && t2low > nl)) - qhat--; - } - } -#endif - - /* Do the multiply and subtract */ - r = lbnMulSub1_32(n, d, dlen, qhat); - /* If there was a borrow, add back once. */ - if (r > nh) { /* Borrow? */ - (void)lbnAddN_32(n, d, dlen); - qhat--; - } - - /* Remember the first quotient digit. */ - qhigh = qhat; - - /* Now, the main division loop: */ -divloop: - while (qlen--) { - - /* Advance n */ - nh = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - BIGLITTLE(++n,--n); - nm = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - - if (nh == dh) { - qhat = ~(BNWORD32)0; - /* Optimized computation of r = (nh,nm) - qhat * dh */ - r = nh + nm; - if (r < nh) - goto subtract; - } else { - assert(nh < dh); - r = lbnDiv21_32(&qhat, nh, nm, dh); - } - - nl = BIGLITTLE(*(n-(dlen-1)),*(n+(dlen-2))); -#ifdef mul32_ppmm - mul32_ppmm(nm, t32, qhat, dl); - if (nm > r || (nm == r && t32 > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - nm -= (t32 < dl); - t32 -= dl; - if (nm > r || (nm == r && t32 > nl)) - qhat--; - } - } -#elif defined(BNWORD64) - t64 = (BNWORD64)qhat * dl; - if (t64 > ((BNWORD64)r<<32) + nl) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t64 -= dl; - if (t64 > ((BNWORD64)r << 32) + nl) - qhat--; - } - } -#else /* Use lbnMulN1_32 */ - lbnMulN1_32(BIGLITTLE(t2+2,t2), &dl, 1, qhat); - if (t2high > r || (t2high == r && t2low > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t2high -= (t2low < dl); - t2low -= dl; - if (t2high > r || (t2high == r && t2low > nl)) - qhat--; - } - } -#endif - - /* - * As a point of interest, note that it is not worth checking - * for qhat of 0 or 1 and installing special-case code. These - * occur with probability 2^-32, so spending 1 cycle to check - * for them is only worth it if we save more than 2^15 cycles, - * and a multiply-and-subtract for numbers in the 1024-bit - * range just doesn't take that long. - */ -subtract: - /* - * n points to the least significant end of the substring - * of n to be subtracted from. qhat is either exact or - * one too large. If the subtract gets a borrow, it was - * one too large and the divisor is added back in. It's - * a dlen+1 word add which is guaranteed to produce a - * carry out, so it can be done very simply. - */ - r = lbnMulSub1_32(n, d, dlen, qhat); - if (r > nh) { /* Borrow? */ - (void)lbnAddN_32(n, d, dlen); - qhat--; - } - /* Store the quotient digit */ - BIGLITTLE(*q++,*--q) = qhat; - } - /* Tah dah! */ - - if (shift) { - lbnRshift_32(d, dlen, shift); - lbnRshift_32(n, dlen, shift); - } - - return qhigh; -} -#endif - -/* - * Find the negative multiplicative inverse of x (x must be odd!) modulo 2^32. - * - * This just performs Newton's iteration until it gets the - * inverse. The initial estimate is always correct to 3 bits, and - * sometimes 4. The number of valid bits doubles each iteration. - * (To prove it, assume x * y == 1 (mod 2^n), and introduce a variable - * for the error mod 2^2n. x * y == 1 + k*2^n (mod 2^2n) and follow - * the iteration through.) - */ -#ifndef lbnMontInv1_32 -BNWORD32 -lbnMontInv1_32(BNWORD32 const x) -{ - BNWORD32 y = x, z; - - assert(x & 1); - - while ((z = x*y) != 1) - y *= 2 - z; - return -y; -} -#endif /* !lbnMontInv1_32 */ - -#if defined(BNWORD64) && PRODUCT_SCAN -/* - * Test code for product-scanning Montgomery reduction. - * This seems to slow the C code down rather than speed it up. - * - * The first loop computes the Montgomery multipliers, storing them over - * the low half of the number n. - * - * The second half multiplies the upper half, adding in the modulus - * times the Montgomery multipliers. The results of this multiply - * are stored. - */ -void -lbnMontReduce_32(BNWORD32 *n, BNWORD32 const *mod, unsigned mlen, BNWORD32 inv) -{ - BNWORD64 x, y; - BNWORD32 const *pm; - BNWORD32 *pn; - BNWORD32 t; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!mlen) - return; - - /* Pass 1 - compute Montgomery multipliers */ - /* First iteration can have certain simplifications. */ - t = BIGLITTLE(n[-1],n[0]); - x = t; - t *= inv; - BIGLITTLE(n[-1], n[0]) = t; - x += (BNWORD64)t * BIGLITTLE(mod[-1],mod[0]); /* Can't overflow */ - assert((BNWORD32)x == 0); - x = x >> 32; - - for (i = 1; i < mlen; i++) { - carry = 0; - pn = n; - pm = BIGLITTLE(mod-i-1,mod+i+1); - for (j = 0; j < i; j++) { - y = (BNWORD64)BIGLITTLE(*--pn * *pm++, *pn++ * *--pm); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pn == n-i, pn == n+i)); - y = t = BIGLITTLE(pn[-1], pn[0]); - x += y; - carry += (x < y); - BIGLITTLE(pn[-1], pn[0]) = t = inv * (BNWORD32)x; - assert(BIGLITTLE(pm == mod-1, pm == mod+1)); - y = (BNWORD64)t * BIGLITTLE(pm[0],pm[-1]); - x += y; - carry += (x < y); - assert((BNWORD32)x == 0); - x = x >> 32 | (BNWORD64)carry << 32; - } - - BIGLITTLE(n -= mlen, n += mlen); - - /* Pass 2 - compute upper words and add to n */ - for (i = 1; i < mlen; i++) { - carry = 0; - pm = BIGLITTLE(mod-i,mod+i); - pn = n; - for (j = i; j < mlen; j++) { - y = (BNWORD64)BIGLITTLE(*--pm * *pn++, *pm++ * *--pn); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pm == mod-mlen, pm == mod+mlen)); - assert(BIGLITTLE(pn == n+mlen-i, pn == n-mlen+i)); - y = t = BIGLITTLE(*(n-i),*(n+i-1)); - x += y; - carry += (x < y); - BIGLITTLE(*(n-i),*(n+i-1)) = (BNWORD32)x; - x = (x >> 32) | (BNWORD64)carry << 32; - } - - /* Last round of second half, simplified. */ - t = BIGLITTLE(*(n-mlen),*(n+mlen-1)); - x += t; - BIGLITTLE(*(n-mlen),*(n+mlen-1)) = (BNWORD32)x; - carry = (unsigned)(x >> 32); - - while (carry) - carry -= lbnSubN_32(n, mod, mlen); - while (lbnCmp_32(n, mod, mlen) >= 0) - (void)lbnSubN_32(n, mod, mlen); -} -#define lbnMontReduce_32 lbnMontReduce_32 -#endif - -/* - * Montgomery reduce n, modulo mod. This reduces modulo mod and divides by - * 2^(32*mlen). Returns the result in the *top* mlen words of the argument n. - * This is ready for another multiplication using lbnMul_32. - * - * Montgomery representation is a very useful way to encode numbers when - * you're doing lots of modular reduction. What you do is pick a multiplier - * R which is relatively prime to the modulus and very easy to divide by. - * Since the modulus is odd, R is closen as a power of 2, so the division - * is a shift. In fact, it's a shift of an integral number of words, - * so the shift can be implicit - just drop the low-order words. - * - * Now, choose R *larger* than the modulus m, 2^(32*mlen). Then convert - * all numbers a, b, etc. to Montgomery form M(a), M(b), etc using the - * relationship M(a) = a*R mod m, M(b) = b*R mod m, etc. Note that: - * - The Montgomery form of a number depends on the modulus m. - * A fixed modulus m is assumed throughout this discussion. - * - Since R is relaitvely prime to m, multiplication by R is invertible; - * no information about the numbers is lost, they're just scrambled. - * - Adding (and subtracting) numbers in this form works just as usual. - * M(a+b) = (a+b)*R mod m = (a*R + b*R) mod m = (M(a) + M(b)) mod m - * - Multiplying numbers in this form produces a*b*R*R. The problem - * is to divide out the excess factor of R, modulo m as well as to - * reduce to the given length mlen. It turns out that this can be - * done *faster* than a normal divide, which is where the speedup - * in Montgomery division comes from. - * - * Normal reduction chooses a most-significant quotient digit q and then - * subtracts q*m from the number to be reduced. Choosing q is tricky - * and involved (just look at lbnDiv_32 to see!) and is usually - * imperfect, requiring a check for correction after the subtraction. - * - * Montgomery reduction *adds* a multiple of m to the *low-order* part - * of the number to be reduced. This multiple is chosen to make the - * low-order part of the number come out to zero. This can be done - * with no trickery or error using a precomputed inverse of the modulus. - * In this code, the "part" is one word, but any width can be used. - * - * Repeating this step sufficiently often results in a value which - * is a multiple of R (a power of two, remember) but is still (since - * the additions were to the low-order part and thus did not increase - * the value of the number being reduced very much) still not much - * larger than m*R. Then implicitly divide by R and subtract off - * m until the result is in the correct range. - * - * Since the low-order part being cancelled is less than R, the - * multiple of m added must have a multiplier which is at most R-1. - * Assuming that the input is at most m*R-1, the final number is - * at most m*(2*R-1)-1 = 2*m*R - m - 1, so subtracting m once from - * the high-order part, equivalent to subtracting m*R from the - * while number, produces a result which is at most m*R - m - 1, - * which divided by R is at most m-1. - * - * To convert *to* Montgomery form, you need a regular remainder - * routine, although you can just compute R*R (mod m) and do the - * conversion using Montgomery multiplication. To convert *from* - * Montgomery form, just Montgomery reduce the number to - * remove the extra factor of R. - * - * TODO: Change to a full inverse and use Karatsuba's multiplication - * rather than this word-at-a-time. - */ -#ifndef lbnMontReduce_32 -void -lbnMontReduce_32(BNWORD32 *n, BNWORD32 const *mod, unsigned const mlen, - BNWORD32 inv) -{ - BNWORD32 t; - BNWORD32 c = 0; - unsigned len = mlen; - - /* inv must be the negative inverse of mod's least significant word */ - assert((BNWORD32)(inv * BIGLITTLE(mod[-1],mod[0])) == (BNWORD32)-1); - - assert(len); - - do { - t = lbnMulAdd1_32(n, mod, mlen, inv * BIGLITTLE(n[-1],n[0])); - c += lbnAdd1_32(BIGLITTLE(n-mlen,n+mlen), len, t); - BIGLITTLE(--n,++n); - } while (--len); - - /* - * All that adding can cause an overflow past the modulus size, - * but it's unusual, and never by much, so a subtraction loop - * is the right way to deal with it. - * This subtraction happens infrequently - I've only ever seen it - * invoked once per reduction, and then just under 22.5% of the time. - */ - while (c) - c -= lbnSubN_32(n, mod, mlen); - while (lbnCmp_32(n, mod, mlen) >= 0) - (void)lbnSubN_32(n, mod, mlen); -} -#endif /* !lbnMontReduce_32 */ - -/* - * A couple of helpers that you might want to implement atomically - * in asm sometime. - */ -#ifndef lbnMontMul_32 -/* - * Multiply "num1" by "num2", modulo "mod", all of length "len", and - * place the result in the high half of "prod". "inv" is the inverse - * of the least-significant word of the modulus, modulo 2^32. - * This uses numbers in Montgomery form. Reduce using "len" and "inv". - * - * This is implemented as a macro to win on compilers that don't do - * inlining, since it's so trivial. - */ -#define lbnMontMul_32(prod, n1, n2, mod, len, inv) \ - (lbnMulX_32(prod, n1, n2, len), lbnMontReduce_32(prod, mod, len, inv)) -#endif /* !lbnMontMul_32 */ - -#ifndef lbnMontSquare_32 -/* - * Square "n", modulo "mod", both of length "len", and place the result - * in the high half of "prod". "inv" is the inverse of the least-significant - * word of the modulus, modulo 2^32. - * This uses numbers in Montgomery form. Reduce using "len" and "inv". - * - * This is implemented as a macro to win on compilers that don't do - * inlining, since it's so trivial. - */ -#define lbnMontSquare_32(prod, n, mod, len, inv) \ - (lbnSquare_32(prod, n, len), lbnMontReduce_32(prod, mod, len, inv)) - -#endif /* !lbnMontSquare_32 */ - -/* - * Convert a number to Montgomery form - requires mlen + nlen words - * of memory in "n". - */ -void -lbnToMont_32(BNWORD32 *n, unsigned nlen, BNWORD32 *mod, unsigned mlen) -{ - /* Move n up "mlen" words */ - lbnCopy_32(BIGLITTLE(n-mlen,n+mlen), n, nlen); - lbnZero_32(n, mlen); - /* Do the division - dump the quotient in the high-order words */ - (void)lbnDiv_32(BIGLITTLE(n-mlen,n+mlen), n, mlen+nlen, mod, mlen); -} - -/* - * Convert from Montgomery form. Montgomery reduction is all that is - * needed. - */ -void -lbnFromMont_32(BNWORD32 *n, BNWORD32 *mod, unsigned len) -{ - /* Zero the high words of n */ - lbnZero_32(BIGLITTLE(n-len,n+len), len); - lbnMontReduce_32(n, mod, len, lbnMontInv1_32(mod[BIGLITTLE(-1,0)])); - /* Move n down len words */ - lbnCopy_32(n, BIGLITTLE(n-len,n+len), len); -} - -/* - * The windowed exponentiation algorithm, precomputes a table of odd - * powers of n up to 2^k. See the comment in bnExpMod_32 below for - * an explanation of how it actually works works. - * - * It takes 2^(k-1)-1 multiplies to compute the table, and (e-1)/(k+1) - * multiplies (on average) to perform the exponentiation. To minimize - * the sum, k must vary with e. The optimal window sizes vary with the - * exponent length. Here are some selected values and the boundary cases. - * (An underscore _ has been inserted into some of the numbers to ensure - * that magic strings like 32 do not appear in this table. It should be - * ignored.) - * - * At e = 1 bits, k=1 (0.000000) is best - * At e = 2 bits, k=1 (0.500000) is best - * At e = 4 bits, k=1 (1.500000) is best - * At e = 8 bits, k=2 (3.333333) < k=1 (3.500000) - * At e = 1_6 bits, k=2 (6.000000) is best - * At e = 26 bits, k=3 (9.250000) < k=2 (9.333333) - * At e = 3_2 bits, k=3 (10.750000) is best - * At e = 6_4 bits, k=3 (18.750000) is best - * At e = 82 bits, k=4 (23.200000) < k=3 (23.250000) - * At e = 128 bits, k=4 (3_2.400000) is best - * At e = 242 bits, k=5 (55.1_66667) < k=4 (55.200000) - * At e = 256 bits, k=5 (57.500000) is best - * At e = 512 bits, k=5 (100.1_66667) is best - * At e = 674 bits, k=6 (127.142857) < k=5 (127.1_66667) - * At e = 1024 bits, k=6 (177.142857) is best - * At e = 1794 bits, k=7 (287.125000) < k=6 (287.142857) - * At e = 2048 bits, k=7 (318.875000) is best - * At e = 4096 bits, k=7 (574.875000) is best - * - * The numbers in parentheses are the expected number of multiplications - * needed to do the computation. The normal russian-peasant modular - * exponentiation technique always uses (e-1)/2. For exponents as - * small as 192 bits (below the range of current factoring algorithms), - * half of the multiplies are eliminated, 45.2 as opposed to the naive - * 95.5. Counting the 191 squarings as 3/4 a multiply each (squaring - * proper is just over half of multiplying, but the Montgomery - * reduction in each case is also a multiply), that's 143.25 - * multiplies, for totals of 188.45 vs. 238.75 - a 21% savings. - * For larger exponents (like 512 bits), it's 483.92 vs. 639.25, a - * 24.3% savings. It asymptotically approaches 25%. - * - * Um, actually there's a slightly more accurate way to count, which - * really is the average number of multiplies required, averaged - * uniformly over all 2^(e-1) e-bit numbers, from 2^(e-1) to (2^e)-1. - * It's based on the recurrence that for the last b bits, b <= k, at - * most one multiply is needed (and none at all 1/2^b of the time), - * while when b > k, the odds are 1/2 each way that the bit will be - * 0 (meaning no multiplies to reduce it to the b-1-bit case) and - * 1/2 that the bit will be 1, starting a k-bit window and requiring - * 1 multiply beyond the b-k-bit case. Since the most significant - * bit is always 1, a k-bit window always starts there, and that - * multiply is by 1, so it isn't a multiply at all. Thus, the - * number of multiplies is simply that needed for the last e-k bits. - * This recurrence produces: - * - * At e = 1 bits, k=1 (0.000000) is best - * At e = 2 bits, k=1 (0.500000) is best - * At e = 4 bits, k=1 (1.500000) is best - * At e = 6 bits, k=2 (2.437500) < k=1 (2.500000) - * At e = 8 bits, k=2 (3.109375) is best - * At e = 1_6 bits, k=2 (5.777771) is best - * At e = 24 bits, k=3 (8.437629) < k=2 (8.444444) - * At e = 3_2 bits, k=3 (10.437492) is best - * At e = 6_4 bits, k=3 (18.437500) is best - * At e = 81 bits, k=4 (22.6_40000) < k=3 (22.687500) - * At e = 128 bits, k=4 (3_2.040000) is best - * At e = 241 bits, k=5 (54.611111) < k=4 (54.6_40000) - * At e = 256 bits, k=5 (57.111111) is best - * At e = 512 bits, k=5 (99.777778) is best - * At e = 673 bits, k=6 (126.591837) < k=5 (126.611111) - * At e = 1024 bits, k=6 (176.734694) is best - * At e = 1793 bits, k=7 (286.578125) < k=6 (286.591837) - * At e = 2048 bits, k=7 (318.453125) is best - * At e = 4096 bits, k=7 (574.453125) is best - * - * This has the rollover points at 6, 24, 81, 241, 673 and 1793 instead - * of 8, 26, 82, 242, 674, and 1794. Not a very big difference. - * (The numbers past that are k=8 at 4609 and k=9 at 11521, - * vs. one more in each case for the approximation.) - * - * Given that exponents for which k>7 are useful are uncommon, - * a fixed size table for k <= 7 is used for simplicity. - * - * The basic number of squarings needed is e-1, although a k-bit - * window (for k > 1) can save, on average, k-2 of those, too. - * That savings currently isn't counted here. It would drive the - * crossover points slightly lower. - * (Actually, this win is also reduced in the DoubleExpMod case, - * meaning we'd have to split the tables. Except for that, the - * multiplies by powers of the two bases are independent, so - * the same logic applies to each as the single case.) - * - * Table entry i is the largest number of bits in an exponent to - * process with a window size of i+1. Entry 6 is the largest - * possible unsigned number, so the window will never be more - * than 7 bits, requiring 2^6 = 0x40 slots. - */ -#define BNEXPMOD_MAX_WINDOW 7 -static unsigned const bnExpModThreshTable[BNEXPMOD_MAX_WINDOW] = { - 5, 23, 80, 240, 672, 1792, (unsigned)-1 -/* 7, 25, 81, 241, 673, 1793, (unsigned)-1 ### The old approximations */ -}; - -/* - * Perform modular exponentiation, as fast as possible! This uses - * Montgomery reduction, optimized squaring, and windowed exponentiation. - * The modulus "mod" MUST be odd! - * - * This returns 0 on success, -1 on out of memory. - * - * The window algorithm: - * The idea is to keep a running product of b1 = n^(high-order bits of exp), - * and then keep appending exponent bits to it. The following patterns - * apply to a 3-bit window (k = 3): - * To append 0: square - * To append 1: square, multiply by n^1 - * To append 10: square, multiply by n^1, square - * To append 11: square, square, multiply by n^3 - * To append 100: square, multiply by n^1, square, square - * To append 101: square, square, square, multiply by n^5 - * To append 110: square, square, multiply by n^3, square - * To append 111: square, square, square, multiply by n^7 - * - * Since each pattern involves only one multiply, the longer the pattern - * the better, except that a 0 (no multiplies) can be appended directly. - * We precompute a table of odd powers of n, up to 2^k, and can then - * multiply k bits of exponent at a time. Actually, assuming random - * exponents, there is on average one zero bit between needs to - * multiply (1/2 of the time there's none, 1/4 of the time there's 1, - * 1/8 of the time, there's 2, 1/32 of the time, there's 3, etc.), so - * you have to do one multiply per k+1 bits of exponent. - * - * The loop walks down the exponent, squaring the result buffer as - * it goes. There is a wbits+1 bit lookahead buffer, buf, that is - * filled with the upcoming exponent bits. (What is read after the - * end of the exponent is unimportant, but it is filled with zero here.) - * When the most-significant bit of this buffer becomes set, i.e. - * (buf & tblmask) != 0, we have to decide what pattern to multiply - * by, and when to do it. We decide, remember to do it in future - * after a suitable number of squarings have passed (e.g. a pattern - * of "100" in the buffer requires that we multiply by n^1 immediately; - * a pattern of "110" calls for multiplying by n^3 after one more - * squaring), clear the buffer, and continue. - * - * When we start, there is one more optimization: the result buffer - * is implcitly one, so squaring it or multiplying by it can be - * optimized away. Further, if we start with a pattern like "100" - * in the lookahead window, rather than placing n into the buffer - * and then starting to square it, we have already computed n^2 - * to compute the odd-powers table, so we can place that into - * the buffer and save a squaring. - * - * This means that if you have a k-bit window, to compute n^z, - * where z is the high k bits of the exponent, 1/2 of the time - * it requires no squarings. 1/4 of the time, it requires 1 - * squaring, ... 1/2^(k-1) of the time, it reqires k-2 squarings. - * And the remaining 1/2^(k-1) of the time, the top k bits are a - * 1 followed by k-1 0 bits, so it again only requires k-2 - * squarings, not k-1. The average of these is 1. Add that - * to the one squaring we have to do to compute the table, - * and you'll see that a k-bit window saves k-2 squarings - * as well as reducing the multiplies. (It actually doesn't - * hurt in the case k = 1, either.) - * - * n must have mlen words allocated. Although fewer may be in use - * when n is passed in, all are in use on exit. - */ -int -lbnExpMod_32(BNWORD32 *result, BNWORD32 const *n, unsigned nlen, - BNWORD32 const *e, unsigned elen, BNWORD32 *mod, unsigned mlen) -{ - BNWORD32 *table[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n */ - unsigned ebits; /* Exponent bits */ - unsigned wbits; /* Window size */ - unsigned tblmask; /* Mask of exponentiation window */ - BNWORD32 bitpos; /* Mask of current look-ahead bit */ - unsigned buf; /* Buffer of exponent bits */ - unsigned multpos; /* Where to do pending multiply */ - BNWORD32 const *mult; /* What to multiply by */ - unsigned i; /* Loop counter */ - int isone; /* Flag: accum. is implicitly one */ - BNWORD32 *a, *b; /* Working buffers/accumulators */ - BNWORD32 *t; /* Pointer into the working buffers */ - BNWORD32 inv; /* mod^-1 modulo 2^32 */ - int y; /* bnYield() result */ - - assert(mlen); - assert(nlen <= mlen); - - /* First, a couple of trivial cases. */ - elen = lbnNorm_32(e, elen); - if (!elen) { - /* x ^ 0 == 1 */ - lbnZero_32(result, mlen); - BIGLITTLE(result[-1],result[0]) = 1; - return 0; - } - ebits = lbnBits_32(e, elen); - if (ebits == 1) { - /* x ^ 1 == x */ - if (n != result) - lbnCopy_32(result, n, nlen); - if (mlen > nlen) - lbnZero_32(BIGLITTLE(result-nlen,result+nlen), - mlen-nlen); - return 0; - } - - /* Okay, now move the exponent pointer to the most-significant word */ - e = BIGLITTLE(e-elen, e+elen-1); - - /* Look up appropriate k-1 for the exponent - tblmask = 1<<(k-1) */ - wbits = 0; - while (ebits > bnExpModThreshTable[wbits]) - wbits++; - - /* Allocate working storage: two product buffers and the tables. */ - LBNALLOC(a, BNWORD32, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD32, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert to the appropriate table size: tblmask = 1<<(k-1) */ - tblmask = 1u << wbits; - - /* We have the result buffer available, so use it. */ - table[0] = result; - - /* - * Okay, we now have a minimal-sized table - expand it. - * This is allowed to fail! If so, scale back the table size - * and proceed. - */ - for (i = 1; i < tblmask; i++) { - LBNALLOC(t, BNWORD32, mlen); - if (!t) /* Out of memory! Quit the loop. */ - break; - table[i] = t; - } - - /* If we stopped, with i < tblmask, shrink the tables appropriately */ - while (tblmask > i) { - wbits--; - tblmask >>= 1; - } - /* Free up our overallocations */ - while (--i > tblmask) - LBNFREE(table[i], mlen); - - /* Okay, fill in the table */ - - /* Compute the necessary modular inverse */ - inv = lbnMontInv1_32(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - /* Convert n to Montgomery form */ - - /* Move n up "mlen" words into a */ - t = BIGLITTLE(a-mlen, a+mlen); - lbnCopy_32(t, n, nlen); - lbnZero_32(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_32(t, a, mlen+nlen, mod, mlen); - /* Copy into first table entry */ - lbnCopy_32(table[0], a, mlen); - - /* Square a into b */ - lbnMontSquare_32(b, a, mod, mlen, inv); - - /* Use high half of b to initialize the table */ - t = BIGLITTLE(b-mlen, b+mlen); - for (i = 1; i < tblmask; i++) { - lbnMontMul_32(a, t, table[i-1], mod, mlen, inv); - lbnCopy_32(table[i], BIGLITTLE(a-mlen, a+mlen), mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* We might use b = n^2 later... */ - - /* Initialze the fetch pointer */ - bitpos = (BNWORD32)1 << ((ebits-1) & (32-1)); /* Initialize mask */ - - /* This should point to the msbit of e */ - assert((*e & bitpos) != 0); - - /* - * Pre-load the window. Becuase the window size is - * never larger than the exponent size, there is no need to - * detect running off the end of e in here. - * - * The read-ahead is controlled by elen and the bitpos mask. - * Note that this is *ahead* of ebits, which tracks the - * most significant end of the window. The purpose of this - * initialization is to get the two wbits+1 bits apart, - * like they should be. - * - * Note that bitpos and e1len together keep track of the - * lookahead read pointer in the exponent that is used here. - */ - buf = 0; - for (i = 0; i <= wbits; i++) { - buf = (buf << 1) | ((*e & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e++,e--); - bitpos = (BNWORD32)1 << (32-1); - elen--; - } - } - assert(buf & tblmask); - - /* - * Set the pending multiply positions to a location that will - * never be encountered, thus ensuring that nothing will happen - * until the need for a multiply appears and one is scheduled. - */ - multpos = ebits; /* A NULL value */ - mult = 0; /* Force a crash if we use these */ - - /* - * Okay, now begins the real work. The first step is - * slightly magic, so it's done outside the main loop, - * but it's very similar to what's inside. - */ - ebits--; /* Start processing the first bit... */ - isone = 1; - - /* - * This is just like the multiply in the loop, except that - * - We know the msbit of buf is set, and - * - We have the extra value n^2 floating around. - * So, do the usual computation, and if the result is that - * the buffer should be multiplied by n^1 immediately - * (which we'd normally then square), we multiply it - * (which reduces to a copy, which reduces to setting a flag) - * by n^2 and skip the squaring. Thus, we do the - * multiply and the squaring in one step. - */ - assert(buf & tblmask); - multpos = ebits - wbits; - while ((buf & 1) == 0) { - buf >>= 1; - multpos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(multpos <= ebits); - mult = table[buf>>1]; - buf = 0; - - /* Special case: use already-computed value sitting in buffer */ - if (multpos == ebits) - isone = 0; - - /* - * At this point, the buffer (which is the high half of b) holds - * either 1 (implicitly, as the "isone" flag is set), or n^2. - */ - - /* - * The main loop. The procedure is: - * - Advance the window - * - If the most-significant bit of the window is set, - * schedule a multiply for the appropriate time in the - * future (may be immediately) - * - Perform any pending multiples - * - Check for termination - * - Square the buffer - * - * At any given time, the acumulated product is held in - * the high half of b. - */ - for (;;) { - ebits--; - - /* Advance the window */ - assert(buf < tblmask); - buf <<= 1; - /* - * This reads ahead of the current exponent position - * (controlled by ebits), so we have to be able to read - * past the lsb of the exponents without error. - */ - if (elen) { - buf |= ((*e & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e++,e--); - bitpos = (BNWORD32)1 << (32-1); - elen--; - } - } - - /* Examine the window for pending multiplies */ - if (buf & tblmask) { - multpos = ebits - wbits; - while ((buf & 1) == 0) { - buf >>= 1; - multpos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(multpos <= ebits); - mult = table[buf>>1]; - buf = 0; - } - - /* If we have a pending multiply, do it */ - if (ebits == multpos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_32(t, mult, mlen); - isone = 0; - } else { - lbnMontMul_32(a, t, mult, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* Are we done? */ - if (!ebits) - break; - - /* Square the input */ - if (!isone) { - t = BIGLITTLE(b-mlen, b+mlen); - lbnMontSquare_32(a, t, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } /* for (;;) */ - - assert(!isone); - assert(!buf); - - /* DONE! */ - - /* Convert result out of Montgomery form */ - t = BIGLITTLE(b-mlen, b+mlen); - lbnCopy_32(b, t, mlen); - lbnZero_32(t, mlen); - lbnMontReduce_32(b, mod, mlen, inv); - lbnCopy_32(result, t, mlen); - /* - * Clean up - free intermediate storage. - * Do NOT free table[0], which is the result - * buffer. - */ - y = 0; -#if BNYIELD -yield: -#endif - while (--tblmask) - LBNFREE(table[tblmask], mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - -/* - * Compute and return n1^e1 * n2^e2 mod "mod". - * result may be either input buffer, or something separate. - * It must be "mlen" words long. - * - * There is a current position in the exponents, which is kept in e1bits. - * (The exponents are swapped if necessary so e1 is the longer of the two.) - * At any given time, the value in the accumulator is - * n1^(e1>>e1bits) * n2^(e2>>e1bits) mod "mod". - * As e1bits is counted down, this is updated, by squaring it and doing - * any necessary multiplies. - * To decide on the necessary multiplies, two windows, each w1bits+1 bits - * wide, are maintained in buf1 and buf2, which read *ahead* of the - * e1bits position (with appropriate handling of the case when e1bits - * drops below w1bits+1). When the most-significant bit of either window - * becomes set, indicating that something needs to be multiplied by - * the accumulator or it will get out of sync, the window is examined - * to see which power of n1 or n2 to multiply by, and when (possibly - * later, if the power is greater than 1) the multiply should take - * place. Then the multiply and its location are remembered and the - * window is cleared. - * - * If we had every power of n1 in the table, the multiply would always - * be w1bits steps in the future. But we only keep the odd powers, - * so instead of waiting w1bits squarings and then multiplying - * by n1^k, we wait w1bits-k squarings and multiply by n1. - * - * Actually, w2bits can be less than w1bits, but the window is the same - * size, to make it easier to keep track of where we're reading. The - * appropriate number of low-order bits of the window are just ignored. - */ -int -lbnDoubleExpMod_32(BNWORD32 *result, - BNWORD32 const *n1, unsigned n1len, - BNWORD32 const *e1, unsigned e1len, - BNWORD32 const *n2, unsigned n2len, - BNWORD32 const *e2, unsigned e2len, - BNWORD32 *mod, unsigned mlen) -{ - BNWORD32 *table1[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n1 */ - BNWORD32 *table2[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n2 */ - unsigned e1bits, e2bits; /* Exponent bits */ - unsigned w1bits, w2bits; /* Window sizes */ - unsigned tblmask; /* Mask of exponentiation window */ - BNWORD32 bitpos; /* Mask of current look-ahead bit */ - unsigned buf1, buf2; /* Buffer of exponent bits */ - unsigned mult1pos, mult2pos; /* Where to do pending multiply */ - BNWORD32 const *mult1, *mult2; /* What to multiply by */ - unsigned i; /* Loop counter */ - int isone; /* Flag: accum. is implicitly one */ - BNWORD32 *a, *b; /* Working buffers/accumulators */ - BNWORD32 *t; /* Pointer into the working buffers */ - BNWORD32 inv; /* mod^-1 modulo 2^32 */ - int y; /* bnYield() result */ - - assert(mlen); - assert(n1len <= mlen); - assert(n2len <= mlen); - - /* First, a couple of trivial cases. */ - e1len = lbnNorm_32(e1, e1len); - e2len = lbnNorm_32(e2, e2len); - - /* Ensure that the first exponent is the longer */ - e1bits = lbnBits_32(e1, e1len); - e2bits = lbnBits_32(e2, e2len); - if (e1bits < e2bits) { - i = e1len; e1len = e2len; e2len = i; - i = e1bits; e1bits = e2bits; e2bits = i; - t = (BNWORD32 *)n1; n1 = n2; n2 = t; - t = (BNWORD32 *)e1; e1 = e2; e2 = t; - } - assert(e1bits >= e2bits); - - /* Handle a trivial case */ - if (!e2len) - return lbnExpMod_32(result, n1, n1len, e1, e1len, mod, mlen); - assert(e2bits); - - /* The code below fucks up if the exponents aren't at least 2 bits */ - if (e1bits == 1) { - assert(e2bits == 1); - - LBNALLOC(a, BNWORD32, n1len+n2len); - if (!a) - return -1; - - lbnMul_32(a, n1, n1len, n2, n2len); - /* Do a direct modular reduction */ - if (n1len + n2len >= mlen) - (void)lbnDiv_32(a+mlen, a, n1len+n2len, mod, mlen); - lbnCopy_32(result, a, mlen); - LBNFREE(a, n1len+n2len); - return 0; - } - - /* Okay, now move the exponent pointers to the most-significant word */ - e1 = BIGLITTLE(e1-e1len, e1+e1len-1); - e2 = BIGLITTLE(e2-e2len, e2+e2len-1); - - /* Look up appropriate k-1 for the exponent - tblmask = 1<<(k-1) */ - w1bits = 0; - while (e1bits > bnExpModThreshTable[w1bits]) - w1bits++; - w2bits = 0; - while (e2bits > bnExpModThreshTable[w2bits]) - w2bits++; - - assert(w1bits >= w2bits); - - /* Allocate working storage: two product buffers and the tables. */ - LBNALLOC(a, BNWORD32, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD32, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert to the appropriate table size: tblmask = 1<<(k-1) */ - tblmask = 1u << w1bits; - /* Use buf2 for its size, temporarily */ - buf2 = 1u << w2bits; - - LBNALLOC(t, BNWORD32, mlen); - if (!t) { - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - return -1; - } - table1[0] = t; - table2[0] = result; - - /* - * Okay, we now have some minimal-sized tables - expand them. - * This is allowed to fail! If so, scale back the table sizes - * and proceed. We allocate both tables at the same time - * so if it fails partway through, they'll both be a reasonable - * size rather than one huge and one tiny. - * When i passes buf2 (the number of entries in the e2 window, - * which may be less than the number of entries in the e1 window), - * stop allocating e2 space. - */ - for (i = 1; i < tblmask; i++) { - LBNALLOC(t, BNWORD32, mlen); - if (!t) /* Out of memory! Quit the loop. */ - break; - table1[i] = t; - if (i < buf2) { - LBNALLOC(t, BNWORD32, mlen); - if (!t) { - LBNFREE(table1[i], mlen); - break; - } - table2[i] = t; - } - } - - /* If we stopped, with i < tblmask, shrink the tables appropriately */ - while (tblmask > i) { - w1bits--; - tblmask >>= 1; - } - /* Free up our overallocations */ - while (--i > tblmask) { - if (i < buf2) - LBNFREE(table2[i], mlen); - LBNFREE(table1[i], mlen); - } - /* And shrink the second window too, if needed */ - if (w2bits > w1bits) { - w2bits = w1bits; - buf2 = tblmask; - } - - /* - * From now on, use the w2bits variable for the difference - * between w1bits and w2bits. - */ - w2bits = w1bits-w2bits; - - /* Okay, fill in the tables */ - - /* Compute the necessary modular inverse */ - inv = lbnMontInv1_32(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - /* Convert n1 to Montgomery form */ - - /* Move n1 up "mlen" words into a */ - t = BIGLITTLE(a-mlen, a+mlen); - lbnCopy_32(t, n1, n1len); - lbnZero_32(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_32(t, a, mlen+n1len, mod, mlen); - /* Copy into first table entry */ - lbnCopy_32(table1[0], a, mlen); - - /* Square a into b */ - lbnMontSquare_32(b, a, mod, mlen, inv); - - /* Use high half of b to initialize the first table */ - t = BIGLITTLE(b-mlen, b+mlen); - for (i = 1; i < tblmask; i++) { - lbnMontMul_32(a, t, table1[i-1], mod, mlen, inv); - lbnCopy_32(table1[i], BIGLITTLE(a-mlen, a+mlen), mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* Convert n2 to Montgomery form */ - - t = BIGLITTLE(a-mlen, a+mlen); - /* Move n2 up "mlen" words into a */ - lbnCopy_32(t, n2, n2len); - lbnZero_32(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_32(t, a, mlen+n2len, mod, mlen); - /* Copy into first table entry */ - lbnCopy_32(table2[0], a, mlen); - - /* Square it into a */ - lbnMontSquare_32(a, table2[0], mod, mlen, inv); - /* Copy to b, low half */ - lbnCopy_32(b, t, mlen); - - /* Use b to initialize the second table */ - for (i = 1; i < buf2; i++) { - lbnMontMul_32(a, b, table2[i-1], mod, mlen, inv); - lbnCopy_32(table2[i], t, mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* - * Okay, a recap: at this point, the low part of b holds - * n2^2, the high part holds n1^2, and the tables are - * initialized with the odd powers of n1 and n2 from 1 - * through 2*tblmask-1 and 2*buf2-1. - * - * We might use those squares in b later, or we might not. - */ - - /* Initialze the fetch pointer */ - bitpos = (BNWORD32)1 << ((e1bits-1) & (32-1)); /* Initialize mask */ - - /* This should point to the msbit of e1 */ - assert((*e1 & bitpos) != 0); - - /* - * Pre-load the windows. Becuase the window size is - * never larger than the exponent size, there is no need to - * detect running off the end of e1 in here. - * - * The read-ahead is controlled by e1len and the bitpos mask. - * Note that this is *ahead* of e1bits, which tracks the - * most significant end of the window. The purpose of this - * initialization is to get the two w1bits+1 bits apart, - * like they should be. - * - * Note that bitpos and e1len together keep track of the - * lookahead read pointer in the exponent that is used here. - * e2len is not decremented, it is only ever compared with - * e1len as *that* is decremented. - */ - buf1 = buf2 = 0; - for (i = 0; i <= w1bits; i++) { - buf1 = (buf1 << 1) | ((*e1 & bitpos) != 0); - if (e1len <= e2len) - buf2 = (buf2 << 1) | ((*e2 & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e1++,e1--); - if (e1len <= e2len) - BIGLITTLE(e2++,e2--); - bitpos = (BNWORD32)1 << (32-1); - e1len--; - } - } - assert(buf1 & tblmask); - - /* - * Set the pending multiply positions to a location that will - * never be encountered, thus ensuring that nothing will happen - * until the need for a multiply appears and one is scheduled. - */ - mult1pos = mult2pos = e1bits; /* A NULL value */ - mult1 = mult2 = 0; /* Force a crash if we use these */ - - /* - * Okay, now begins the real work. The first step is - * slightly magic, so it's done outside the main loop, - * but it's very similar to what's inside. - */ - isone = 1; /* Buffer is implicitly 1, so replace * by copy */ - e1bits--; /* Start processing the first bit... */ - - /* - * This is just like the multiply in the loop, except that - * - We know the msbit of buf1 is set, and - * - We have the extra value n1^2 floating around. - * So, do the usual computation, and if the result is that - * the buffer should be multiplied by n1^1 immediately - * (which we'd normally then square), we multiply it - * (which reduces to a copy, which reduces to setting a flag) - * by n1^2 and skip the squaring. Thus, we do the - * multiply and the squaring in one step. - */ - assert(buf1 & tblmask); - mult1pos = e1bits - w1bits; - while ((buf1 & 1) == 0) { - buf1 >>= 1; - mult1pos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(mult1pos <= e1bits); - mult1 = table1[buf1>>1]; - buf1 = 0; - - /* Special case: use already-computed value sitting in buffer */ - if (mult1pos == e1bits) - isone = 0; - - /* - * The first multiply by a power of n2. Similar, but - * we might not even want to schedule a multiply if e2 is - * shorter than e1, and the window might be shorter so - * we have to leave the low w2bits bits alone. - */ - if (buf2 & tblmask) { - /* Remember low-order bits for later */ - i = buf2 & ((1u << w2bits) - 1); - buf2 >>= w2bits; - mult2pos = e1bits - w1bits + w2bits; - while ((buf2 & 1) == 0) { - buf2 >>= 1; - mult2pos++; - } - assert(mult2pos <= e1bits); - mult2 = table2[buf2>>1]; - buf2 = i; - - if (mult2pos == e1bits) { - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - lbnCopy_32(t, b, mlen); /* Copy low to high */ - isone = 0; - } else { - lbnMontMul_32(a, t, b, mod, mlen, inv); - t = a; a = b; b = t; - } - } - } - - /* - * At this point, the buffer (which is the high half of b) - * holds either 1 (implicitly, as the "isone" flag is set), - * n1^2, n2^2 or n1^2 * n2^2. - */ - - /* - * The main loop. The procedure is: - * - Advance the windows - * - If the most-significant bit of a window is set, - * schedule a multiply for the appropriate time in the - * future (may be immediately) - * - Perform any pending multiples - * - Check for termination - * - Square the buffers - * - * At any given time, the acumulated product is held in - * the high half of b. - */ - for (;;) { - e1bits--; - - /* Advance the windows */ - assert(buf1 < tblmask); - buf1 <<= 1; - assert(buf2 < tblmask); - buf2 <<= 1; - /* - * This reads ahead of the current exponent position - * (controlled by e1bits), so we have to be able to read - * past the lsb of the exponents without error. - */ - if (e1len) { - buf1 |= ((*e1 & bitpos) != 0); - if (e1len <= e2len) - buf2 |= ((*e2 & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e1++,e1--); - if (e1len <= e2len) - BIGLITTLE(e2++,e2--); - bitpos = (BNWORD32)1 << (32-1); - e1len--; - } - } - - /* Examine the first window for pending multiplies */ - if (buf1 & tblmask) { - mult1pos = e1bits - w1bits; - while ((buf1 & 1) == 0) { - buf1 >>= 1; - mult1pos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(mult1pos <= e1bits); - mult1 = table1[buf1>>1]; - buf1 = 0; - } - - /* - * Examine the second window for pending multiplies. - * Window 2 can be smaller than window 1, but we - * keep the same number of bits in buf2, so we need - * to ignore any low-order bits in the buffer when - * computing what to multiply by, and recompute them - * later. - */ - if (buf2 & tblmask) { - /* Remember low-order bits for later */ - i = buf2 & ((1u << w2bits) - 1); - buf2 >>= w2bits; - mult2pos = e1bits - w1bits + w2bits; - while ((buf2 & 1) == 0) { - buf2 >>= 1; - mult2pos++; - } - assert(mult2pos <= e1bits); - mult2 = table2[buf2>>1]; - buf2 = i; - } - - - /* If we have a pending multiply for e1, do it */ - if (e1bits == mult1pos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_32(t, mult1, mlen); - isone = 0; - } else { - lbnMontMul_32(a, t, mult1, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* If we have a pending multiply for e2, do it */ - if (e1bits == mult2pos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_32(t, mult2, mlen); - isone = 0; - } else { - lbnMontMul_32(a, t, mult2, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* Are we done? */ - if (!e1bits) - break; - - /* Square the buffer */ - if (!isone) { - t = BIGLITTLE(b-mlen, b+mlen); - lbnMontSquare_32(a, t, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } /* for (;;) */ - - assert(!isone); - assert(!buf1); - assert(!buf2); - - /* DONE! */ - - /* Convert result out of Montgomery form */ - t = BIGLITTLE(b-mlen, b+mlen); - lbnCopy_32(b, t, mlen); - lbnZero_32(t, mlen); - lbnMontReduce_32(b, mod, mlen, inv); - lbnCopy_32(result, t, mlen); - - /* Clean up - free intermediate storage */ - y = 0; -#if BNYIELD -yield: -#endif - buf2 = tblmask >> w2bits; - while (--tblmask) { - if (tblmask < buf2) - LBNFREE(table2[tblmask], mlen); - LBNFREE(table1[tblmask], mlen); - } - t = table1[0]; - LBNFREE(t, mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - -/* - * 2^exp (mod mod). This is an optimized version for use in Fermat - * tests. The input value of n is ignored; it is returned with - * "mlen" words valid. - */ -int -lbnTwoExpMod_32(BNWORD32 *n, BNWORD32 const *exp, unsigned elen, - BNWORD32 *mod, unsigned mlen) -{ - unsigned e; /* Copy of high words of the exponent */ - unsigned bits; /* Assorted counter of bits */ - BNWORD32 const *bitptr; - BNWORD32 bitword, bitpos; - BNWORD32 *a, *b, *a1; - BNWORD32 inv; - int y; /* Result of bnYield() */ - - assert(mlen); - - bitptr = BIGLITTLE(exp-elen, exp+elen-1); - bitword = *bitptr; - assert(bitword); - - /* Clear n for future use. */ - lbnZero_32(n, mlen); - - bits = lbnBits_32(exp, elen); - - /* First, a couple of trivial cases. */ - if (bits <= 1) { - /* 2 ^ 0 == 1, 2 ^ 1 == 2 */ - BIGLITTLE(n[-1],n[0]) = (BNWORD32)1<<elen; - return 0; - } - - /* Set bitpos to the most significant bit */ - bitpos = (BNWORD32)1 << ((bits-1) & (32-1)); - - /* Now, count the bits in the modulus. */ - bits = lbnBits_32(mod, mlen); - assert(bits > 1); /* a 1-bit modulus is just stupid... */ - - /* - * We start with 1<<e, where "e" is as many high bits of the - * exponent as we can manage without going over the modulus. - * This first loop finds "e". - */ - e = 1; - while (elen) { - /* Consume the first bit */ - bitpos >>= 1; - if (!bitpos) { - if (!--elen) - break; - bitword = BIGLITTLE(*++bitptr,*--bitptr); - bitpos = (BNWORD32)1<<(32-1); - } - e = (e << 1) | ((bitpos & bitword) != 0); - if (e >= bits) { /* Overflow! Back out. */ - e >>= 1; - break; - } - } - /* - * The bit in "bitpos" being examined by the bit buffer has NOT - * been consumed yet. This may be past the end of the exponent, - * in which case elen == 1. - */ - - /* Okay, now, set bit "e" in n. n is already zero. */ - inv = (BNWORD32)1 << (e & (32-1)); - e /= 32; - BIGLITTLE(n[-e-1],n[e]) = inv; - /* - * The effective length of n in words is now "e+1". - * This is used a little bit later. - */ - - if (!elen) - return 0; /* That was easy! */ - - /* - * We have now processed the first few bits. The next step - * is to convert this to Montgomery form for further squaring. - */ - - /* Allocate working storage: two product buffers */ - LBNALLOC(a, BNWORD32, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD32, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert n to Montgomery form */ - inv = BIGLITTLE(mod[-1],mod[0]); /* LSW of modulus */ - assert(inv & 1); /* Modulus must be odd */ - inv = lbnMontInv1_32(inv); - /* Move n (length e+1, remember?) up "mlen" words into b */ - /* Note that we lie about a1 for a bit - it's pointing to b */ - a1 = BIGLITTLE(b-mlen,b+mlen); - lbnCopy_32(a1, n, e+1); - lbnZero_32(b, mlen); - /* Do the division - dump the quotient into the high-order words */ - (void)lbnDiv_32(a1, b, mlen+e+1, mod, mlen); - /* - * Now do the first squaring and modular reduction to put - * the number up in a1 where it belongs. - */ - lbnMontSquare_32(a, b, mod, mlen, inv); - /* Fix up a1 to point to where it should go. */ - a1 = BIGLITTLE(a-mlen,a+mlen); - - /* - * Okay, now, a1 holds the number being accumulated, and - * b is a scratch register. Start working: - */ - for (;;) { - /* - * Is the bit set? If so, double a1 as well. - * A modular doubling like this is very cheap. - */ - if (bitpos & bitword) { - /* - * Double the number. If there was a carry out OR - * the result is greater than the modulus, subract - * the modulus. - */ - if (lbnDouble_32(a1, mlen) || - lbnCmp_32(a1, mod, mlen) > 0) - (void)lbnSubN_32(a1, mod, mlen); - } - - /* Advance to the next exponent bit */ - bitpos >>= 1; - if (!bitpos) { - if (!--elen) - break; /* Done! */ - bitword = BIGLITTLE(*++bitptr,*--bitptr); - bitpos = (BNWORD32)1<<(32-1); - } - - /* - * The elen/bitword/bitpos bit buffer is known to be - * non-empty, i.e. there is at least one more unconsumed bit. - * Thus, it's safe to square the number. - */ - lbnMontSquare_32(b, a1, mod, mlen, inv); - /* Rename result (in b) back to a (a1, really). */ - a1 = b; b = a; a = a1; - a1 = BIGLITTLE(a-mlen,a+mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* DONE! Just a little bit of cleanup... */ - - /* - * Convert result out of Montgomery form... this is - * just a Montgomery reduction. - */ - lbnCopy_32(a, a1, mlen); - lbnZero_32(a1, mlen); - lbnMontReduce_32(a, mod, mlen, inv); - lbnCopy_32(n, a1, mlen); - - /* Clean up - free intermediate storage */ - y = 0; -#if BNYIELD -yield: -#endif - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - - -/* - * Returns a substring of the big-endian array of bytes representation - * of the bignum array based on two parameters, the least significant - * byte number (0 to start with the least significant byte) and the - * length. I.e. the number returned is a representation of - * (bn / 2^(8*lsbyte)) % 2 ^ (8*buflen). - * - * It is an error if the bignum is not at least buflen + lsbyte bytes - * long. - * - * This code assumes that the compiler has the minimal intelligence - * neded to optimize divides and modulo operations on an unsigned data - * type with a power of two. - */ -void -lbnExtractBigBytes_32(BNWORD32 const *n, unsigned char *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD32 t = 0; /* Needed to shut up uninitialized var warnings */ - unsigned shift; - - lsbyte += buflen; - - shift = (8 * lsbyte) % 32; - lsbyte /= (32/8); /* Convert to word offset */ - BIGLITTLE(n -= lsbyte, n += lsbyte); - - if (shift) - t = BIGLITTLE(n[-1],n[0]); - - while (buflen--) { - if (!shift) { - t = BIGLITTLE(*n++,*--n); - shift = 32; - } - shift -= 8; - *buf++ = (unsigned char)(t>>shift); - } -} - -/* - * Merge a big-endian array of bytes into a bignum array. - * The array had better be big enough. This is - * equivalent to extracting the entire bignum into a - * large byte array, copying the input buffer into the - * middle of it, and converting back to a bignum. - * - * The buf is "len" bytes long, and its *last* byte is at - * position "lsbyte" from the end of the bignum. - * - * Note that this is a pain to get right. Fortunately, it's hardly - * critical for efficiency. - */ -void -lbnInsertBigBytes_32(BNWORD32 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD32 t = 0; /* Shut up uninitialized varibale warnings */ - - lsbyte += buflen; - - BIGLITTLE(n -= lsbyte/(32/8), n += lsbyte/(32/8)); - - /* Load up leading odd bytes */ - if (lsbyte % (32/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte * 8) % 32; - } - - /* The main loop - merge into t, storing at each word boundary. */ - while (buflen--) { - t = (t << 8) | *buf++; - if ((--lsbyte % (32/8)) == 0) - BIGLITTLE(*n++,*--n) = t; - } - - /* Merge odd bytes in t into last word */ - lsbyte = (lsbyte * 8) % 32; - if (lsbyte) { - t <<= lsbyte; - t |= (((BNWORD32)1 << lsbyte) - 1) & BIGLITTLE(n[0],n[-1]); - BIGLITTLE(n[0],n[-1]) = t; - } - - return; -} - -/* - * Returns a substring of the little-endian array of bytes representation - * of the bignum array based on two parameters, the least significant - * byte number (0 to start with the least significant byte) and the - * length. I.e. the number returned is a representation of - * (bn / 2^(8*lsbyte)) % 2 ^ (8*buflen). - * - * It is an error if the bignum is not at least buflen + lsbyte bytes - * long. - * - * This code assumes that the compiler has the minimal intelligence - * neded to optimize divides and modulo operations on an unsigned data - * type with a power of two. - */ -void -lbnExtractLittleBytes_32(BNWORD32 const *n, unsigned char *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD32 t = 0; /* Needed to shut up uninitialized var warnings */ - - BIGLITTLE(n -= lsbyte/(32/8), n += lsbyte/(32/8)); - - if (lsbyte % (32/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte % (32/8)) * 8 ; - } - - while (buflen--) { - if ((lsbyte++ % (32/8)) == 0) - t = BIGLITTLE(*--n,*n++); - *buf++ = (unsigned char)t; - t >>= 8; - } -} - -/* - * Merge a little-endian array of bytes into a bignum array. - * The array had better be big enough. This is - * equivalent to extracting the entire bignum into a - * large byte array, copying the input buffer into the - * middle of it, and converting back to a bignum. - * - * The buf is "len" bytes long, and its first byte is at - * position "lsbyte" from the end of the bignum. - * - * Note that this is a pain to get right. Fortunately, it's hardly - * critical for efficiency. - */ -void -lbnInsertLittleBytes_32(BNWORD32 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD32 t = 0; /* Shut up uninitialized varibale warnings */ - - /* Move to most-significant end */ - lsbyte += buflen; - buf += buflen; - - BIGLITTLE(n -= lsbyte/(32/8), n += lsbyte/(32/8)); - - /* Load up leading odd bytes */ - if (lsbyte % (32/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte * 8) % 32; - } - - /* The main loop - merge into t, storing at each word boundary. */ - while (buflen--) { - t = (t << 8) | *--buf; - if ((--lsbyte % (32/8)) == 0) - BIGLITTLE(*n++,*--n) = t; - } - - /* Merge odd bytes in t into last word */ - lsbyte = (lsbyte * 8) % 32; - if (lsbyte) { - t <<= lsbyte; - t |= (((BNWORD32)1 << lsbyte) - 1) & BIGLITTLE(n[0],n[-1]); - BIGLITTLE(n[0],n[-1]) = t; - } - - return; -} - -#ifdef DEADCODE /* This was a precursor to the more flexible lbnExtractBytes */ -/* - * Convert a big-endian array of bytes to a bignum. - * Returns the number of words in the bignum. - * Note the expression "32/8" for the number of bytes per word. - * This is so the word-size adjustment will work. - */ -unsigned -lbnFromBytes_32(BNWORD32 *a, unsigned char const *b, unsigned blen) -{ - BNWORD32 t; - unsigned alen = (blen + (32/8-1))/(32/8); - BIGLITTLE(a -= alen, a += alen); - - while (blen) { - t = 0; - do { - t = t << 8 | *b++; - } while (--blen & (32/8-1)); - BIGLITTLE(*a++,*--a) = t; - } - return alen; -} -#endif - -/* - * Computes the GCD of a and b. Modifies both arguments; when it returns, - * one of them is the GCD and the other is trash. The return value - * indicates which: 0 for a, and 1 for b. The length of the retult is - * returned in rlen. Both inputs must have one extra word of precision. - * alen must be >= blen. - * - * TODO: use the binary algorithm (Knuth section 4.5.2, algorithm B). - * This is based on taking out common powers of 2, then repeatedly: - * gcd(2*u,v) = gcd(u,2*v) = gcd(u,v) - isolated powers of 2 can be deleted. - * gcd(u,v) = gcd(u-v,v) - the numbers can be easily reduced. - * It gets less reduction per step, but the steps are much faster than - * the division case. - */ -int -lbnGcd_32(BNWORD32 *a, unsigned alen, BNWORD32 *b, unsigned blen, - unsigned *rlen) -{ -#if BNYIELD - int y; -#endif - assert(alen >= blen); - - while (blen != 0) { - (void)lbnDiv_32(BIGLITTLE(a-blen,a+blen), a, alen, b, blen); - alen = lbnNorm_32(a, blen); - if (alen == 0) { - *rlen = blen; - return 1; - } - (void)lbnDiv_32(BIGLITTLE(b-alen,b+alen), b, blen, a, alen); - blen = lbnNorm_32(b, alen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - return y; -#endif - } - *rlen = alen; - return 0; -} - -/* - * Invert "a" modulo "mod" using the extended Euclidean algorithm. - * Note that this only computes one of the cosequences, and uses the - * theorem that the signs flip every step and the absolute value of - * the cosequence values are always bounded by the modulus to avoid - * having to work with negative numbers. - * gcd(a,mod) had better equal 1. Returns 1 if the GCD is NOT 1. - * a must be one word longer than "mod". It is overwritten with the - * result. - * TODO: Use Richard Schroeppel's *much* faster algorithm. - */ -int -lbnInv_32(BNWORD32 *a, unsigned alen, BNWORD32 const *mod, unsigned mlen) -{ - BNWORD32 *b; /* Hold a copy of mod during GCD reduction */ - BNWORD32 *p; /* Temporary for products added to t0 and t1 */ - BNWORD32 *t0, *t1; /* Inverse accumulators */ - BNWORD32 cy; - unsigned blen, t0len, t1len, plen; - int y; - - alen = lbnNorm_32(a, alen); - if (!alen) - return 1; /* No inverse */ - - mlen = lbnNorm_32(mod, mlen); - - assert (alen <= mlen); - - /* Inverse of 1 is 1 */ - if (alen == 1 && BIGLITTLE(a[-1],a[0]) == 1) { - lbnZero_32(BIGLITTLE(a-alen,a+alen), mlen-alen); - return 0; - } - - /* Allocate a pile of space */ - LBNALLOC(b, BNWORD32, mlen+1); - if (b) { - /* - * Although products are guaranteed to always be less than the - * modulus, it can involve multiplying two 3-word numbers to - * get a 5-word result, requiring a 6th word to store a 0 - * temporarily. Thus, mlen + 1. - */ - LBNALLOC(p, BNWORD32, mlen+1); - if (p) { - LBNALLOC(t0, BNWORD32, mlen); - if (t0) { - LBNALLOC(t1, BNWORD32, mlen); - if (t1) - goto allocated; - LBNFREE(t0, mlen); - } - LBNFREE(p, mlen+1); - } - LBNFREE(b, mlen+1); - } - return -1; - -allocated: - - /* Set t0 to 1 */ - t0len = 1; - BIGLITTLE(t0[-1],t0[0]) = 1; - - /* b = mod */ - lbnCopy_32(b, mod, mlen); - /* blen = mlen (implicitly) */ - - /* t1 = b / a; b = b % a */ - cy = lbnDiv_32(t1, b, mlen, a, alen); - *(BIGLITTLE(t1-(mlen-alen)-1,t1+(mlen-alen))) = cy; - t1len = lbnNorm_32(t1, mlen-alen+1); - blen = lbnNorm_32(b, alen); - - /* while (b > 1) */ - while (blen > 1 || BIGLITTLE(b[-1],b[0]) != (BNWORD32)1) { - /* q = a / b; a = a % b; */ - if (alen < blen || (alen == blen && lbnCmp_32(a, a, alen) < 0)) - assert(0); - cy = lbnDiv_32(BIGLITTLE(a-blen,a+blen), a, alen, b, blen); - *(BIGLITTLE(a-alen-1,a+alen)) = cy; - plen = lbnNorm_32(BIGLITTLE(a-blen,a+blen), alen-blen+1); - assert(plen); - alen = lbnNorm_32(a, blen); - if (!alen) - goto failure; /* GCD not 1 */ - - /* t0 += q * t1; */ - assert(plen+t1len <= mlen+1); - lbnMul_32(p, BIGLITTLE(a-blen,a+blen), plen, t1, t1len); - plen = lbnNorm_32(p, plen + t1len); - assert(plen <= mlen); - if (plen > t0len) { - lbnZero_32(BIGLITTLE(t0-t0len,t0+t0len), plen-t0len); - t0len = plen; - } - cy = lbnAddN_32(t0, p, plen); - if (cy) { - if (t0len > plen) { - cy = lbnAdd1_32(BIGLITTLE(t0-plen,t0+plen), - t0len-plen, cy); - } - if (cy) { - BIGLITTLE(t0[-t0len-1],t0[t0len]) = cy; - t0len++; - } - } - - /* if (a <= 1) return a ? t0 : FAIL; */ - if (alen <= 1 && BIGLITTLE(a[-1],a[0]) == (BNWORD32)1) { - if (alen == 0) - goto failure; /* FAIL */ - assert(t0len <= mlen); - lbnCopy_32(a, t0, t0len); - lbnZero_32(BIGLITTLE(a-t0len, a+t0len), mlen-t0len); - goto success; - } - - /* q = b / a; b = b % a; */ - if (blen < alen || (blen == alen && lbnCmp_32(b, a, alen) < 0)) - assert(0); - cy = lbnDiv_32(BIGLITTLE(b-alen,b+alen), b, blen, a, alen); - *(BIGLITTLE(b-blen-1,b+blen)) = cy; - plen = lbnNorm_32(BIGLITTLE(b-alen,b+alen), blen-alen+1); - assert(plen); - blen = lbnNorm_32(b, alen); - if (!blen) - goto failure; /* GCD not 1 */ - - /* t1 += q * t0; */ - assert(plen+t0len <= mlen+1); - lbnMul_32(p, BIGLITTLE(b-alen,b+alen), plen, t0, t0len); - plen = lbnNorm_32(p, plen + t0len); - assert(plen <= mlen); - if (plen > t1len) { - lbnZero_32(BIGLITTLE(t1-t1len,t1+t1len), plen-t1len); - t1len = plen; - } - cy = lbnAddN_32(t1, p, plen); - if (cy) { - if (t1len > plen) { - cy = lbnAdd1_32(BIGLITTLE(t1-plen,t0+plen), - t1len-plen, cy); - } - if (cy) { - BIGLITTLE(t1[-t1len-1],t1[t1len]) = cy; - t1len++; - } - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - - if (!blen) - goto failure; /* gcd(a, mod) != 1 -- FAIL */ - - /* return mod-t1 */ - lbnCopy_32(a, mod, mlen); - assert(t1len <= mlen); - cy = lbnSubN_32(a, t1, t1len); - if (cy) { - assert(mlen > t1len); - cy = lbnSub1_32(BIGLITTLE(a-t1len, a+t1len), mlen-t1len, cy); - assert(!cy); - } - -success: - LBNFREE(t1, mlen); - LBNFREE(t0, mlen); - LBNFREE(p, mlen+1); - LBNFREE(b, mlen+1); - - return 0; - -failure: /* GCD is not 1 - no inverse exists! */ - y = 1; -#if BNYIELD -yield: -#endif - LBNFREE(t1, mlen); - LBNFREE(t0, mlen); - LBNFREE(p, mlen+1); - LBNFREE(b, mlen+1); - - return y; -} - -/* - * Precompute powers of "a" mod "mod". Compute them every "bits" - * for "n" steps. This is sufficient to compute powers of g with - * exponents up to n*bits bits long, i.e. less than 2^(n*bits). - * - * This assumes that the caller has already initialized "array" to point - * to "n" buffers of size "mlen". - */ -int -lbnBasePrecompBegin_32(BNWORD32 **array, unsigned n, unsigned bits, - BNWORD32 const *g, unsigned glen, BNWORD32 *mod, unsigned mlen) -{ - BNWORD32 *a, *b; /* Temporary double-width accumulators */ - BNWORD32 *a1; /* Pointer to high half of a*/ - BNWORD32 inv; /* Montgomery inverse of LSW of mod */ - BNWORD32 *t; - unsigned i; - - glen = lbnNorm_32(g, glen); - assert(glen); - - assert (mlen == lbnNorm_32(mod, mlen)); - assert (glen <= mlen); - - /* Allocate two temporary buffers, and the array slots */ - LBNALLOC(a, BNWORD32, mlen*2); - if (!a) - return -1; - LBNALLOC(b, BNWORD32, mlen*2); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Okay, all ready */ - - /* Convert n to Montgomery form */ - inv = BIGLITTLE(mod[-1],mod[0]); /* LSW of modulus */ - assert(inv & 1); /* Modulus must be odd */ - inv = lbnMontInv1_32(inv); - /* Move g up "mlen" words into a (clearing the low mlen words) */ - a1 = BIGLITTLE(a-mlen,a+mlen); - lbnCopy_32(a1, g, glen); - lbnZero_32(a, mlen); - - /* Do the division - dump the quotient into the high-order words */ - (void)lbnDiv_32(a1, a, mlen+glen, mod, mlen); - - /* Copy the first value into the array */ - t = *array; - lbnCopy_32(t, a, mlen); - a1 = a; /* This first value is *not* shifted up */ - - /* Now compute the remaining n-1 array entries */ - assert(bits); - assert(n); - while (--n) { - i = bits; - do { - /* Square a1 into b1 */ - lbnMontSquare_32(b, a1, mod, mlen, inv); - t = b; b = a; a = t; - a1 = BIGLITTLE(a-mlen, a+mlen); - } while (--i); - t = *++array; - lbnCopy_32(t, a1, mlen); - } - - /* Hooray, we're done. */ - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - return 0; -} - -/* - * result = base^exp (mod mod). "array" is a an array of pointers - * to procomputed powers of base, each 2^bits apart. (I.e. array[i] - * is base^(2^(i*bits))). - * - * The algorithm consists of: - * a = b = (powers of g to be raised to the power 2^bits-1) - * a *= b *= (powers of g to be raised to the power 2^bits-2) - * ... - * a *= b *= (powers of g to be raised to the power 1) - * - * All we do is walk the exponent 2^bits-1 times in groups of "bits" bits, - */ -int -lbnBasePrecompExp_32(BNWORD32 *result, BNWORD32 const * const *array, - unsigned bits, BNWORD32 const *exp, unsigned elen, - BNWORD32 const *mod, unsigned mlen) -{ - BNWORD32 *a, *b, *c, *t; - BNWORD32 *a1, *b1; - int anull, bnull; /* Null flags: values are implicitly 1 */ - unsigned i, j; /* Loop counters */ - unsigned mask; /* Exponent bits to examime */ - BNWORD32 const *eptr; /* Pointer into exp */ - BNWORD32 buf, curbits, nextword; /* Bit-buffer varaibles */ - BNWORD32 inv; /* Inverse of LSW of modulus */ - unsigned ewords; /* Words of exponent left */ - int bufbits; /* Number of valid bits */ - int y = 0; - - mlen = lbnNorm_32(mod, mlen); - assert (mlen); - - elen = lbnNorm_32(exp, elen); - if (!elen) { - lbnZero_32(result, mlen); - BIGLITTLE(result[-1],result[0]) = 1; - return 0; - } - /* - * This could be precomputed, but it's so cheap, and it would require - * making the precomputation structure word-size dependent. - */ - inv = lbnMontInv1_32(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - assert(elen); - - /* - * Allocate three temporary buffers. The current numbers generally - * live in the upper halves of these buffers. - */ - LBNALLOC(a, BNWORD32, mlen*2); - if (a) { - LBNALLOC(b, BNWORD32, mlen*2); - if (b) { - LBNALLOC(c, BNWORD32, mlen*2); - if (c) - goto allocated; - LBNFREE(b, 2*mlen); - } - LBNFREE(a, 2*mlen); - } - return -1; - -allocated: - - anull = bnull = 1; - - mask = (1u<<bits) - 1; - for (i = mask; i; --i) { - /* Set up bit buffer for walking the exponent */ - eptr = exp; - buf = BIGLITTLE(*--eptr, *eptr++); - ewords = elen-1; - bufbits = 32; - for (j = 0; ewords || buf; j++) { - /* Shift down current buffer */ - curbits = buf; - buf >>= bits; - /* If necessary, add next word */ - bufbits -= bits; - if (bufbits < 0 && ewords > 0) { - nextword = BIGLITTLE(*--eptr, *eptr++); - ewords--; - curbits |= nextword << (bufbits+bits); - buf = nextword >> -bufbits; - bufbits += 32; - } - /* If appropriate, multiply b *= array[j] */ - if ((curbits & mask) == i) { - BNWORD32 const *d = array[j]; - - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (bnull) { - lbnCopy_32(b1, d, mlen); - bnull = 0; - } else { - lbnMontMul_32(c, b1, d, mod, mlen, inv); - t = c; c = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - } - - /* Multiply a *= b */ - if (!bnull) { - a1 = BIGLITTLE(a-mlen-1,a+mlen); - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (anull) { - lbnCopy_32(a1, b1, mlen); - anull = 0; - } else { - lbnMontMul_32(c, a1, b1, mod, mlen, inv); - t = c; c = a; a = t; - } - } - } - - assert(!anull); /* If it were, elen would have been 0 */ - - /* Convert out of Montgomery form and return */ - a1 = BIGLITTLE(a-mlen-1,a+mlen); - lbnCopy_32(a, a1, mlen); - lbnZero_32(a1, mlen); - lbnMontReduce_32(a, mod, mlen, inv); - lbnCopy_32(result, a1, mlen); - -#if BNYIELD -yield: -#endif - LBNFREE(c, 2*mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; -} - -/* - * result = base1^exp1 *base2^exp2 (mod mod). "array1" and "array2" are - * arrays of pointers to procomputed powers of the corresponding bases, - * each 2^bits apart. (I.e. array1[i] is base1^(2^(i*bits))). - * - * Bits must be the same in both. (It could be made adjustable, but it's - * a bit of a pain. Just make them both equal to the larger one.) - * - * The algorithm consists of: - * a = b = (powers of base1 and base2 to be raised to the power 2^bits-1) - * a *= b *= (powers of base1 and base2 to be raised to the power 2^bits-2) - * ... - * a *= b *= (powers of base1 and base2 to be raised to the power 1) - * - * All we do is walk the exponent 2^bits-1 times in groups of "bits" bits, - */ -int -lbnDoubleBasePrecompExp_32(BNWORD32 *result, unsigned bits, - BNWORD32 const * const *array1, BNWORD32 const *exp1, unsigned elen1, - BNWORD32 const * const *array2, BNWORD32 const *exp2, - unsigned elen2, BNWORD32 const *mod, unsigned mlen) -{ - BNWORD32 *a, *b, *c, *t; - BNWORD32 *a1, *b1; - int anull, bnull; /* Null flags: values are implicitly 1 */ - unsigned i, j, k; /* Loop counters */ - unsigned mask; /* Exponent bits to examime */ - BNWORD32 const *eptr; /* Pointer into exp */ - BNWORD32 buf, curbits, nextword; /* Bit-buffer varaibles */ - BNWORD32 inv; /* Inverse of LSW of modulus */ - unsigned ewords; /* Words of exponent left */ - int bufbits; /* Number of valid bits */ - int y = 0; - BNWORD32 const * const *array; - - mlen = lbnNorm_32(mod, mlen); - assert (mlen); - - elen1 = lbnNorm_32(exp1, elen1); - if (!elen1) { - return lbnBasePrecompExp_32(result, array2, bits, exp2, elen2, - mod, mlen); - } - elen2 = lbnNorm_32(exp2, elen2); - if (!elen2) { - return lbnBasePrecompExp_32(result, array1, bits, exp1, elen1, - mod, mlen); - } - /* - * This could be precomputed, but it's so cheap, and it would require - * making the precomputation structure word-size dependent. - */ - inv = lbnMontInv1_32(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - assert(elen1); - assert(elen2); - - /* - * Allocate three temporary buffers. The current numbers generally - * live in the upper halves of these buffers. - */ - LBNALLOC(a, BNWORD32, mlen*2); - if (a) { - LBNALLOC(b, BNWORD32, mlen*2); - if (b) { - LBNALLOC(c, BNWORD32, mlen*2); - if (c) - goto allocated; - LBNFREE(b, 2*mlen); - } - LBNFREE(a, 2*mlen); - } - return -1; - -allocated: - - anull = bnull = 1; - - mask = (1u<<bits) - 1; - for (i = mask; i; --i) { - /* Walk each exponent in turn */ - for (k = 0; k < 2; k++) { - /* Set up the exponent for walking */ - array = k ? array2 : array1; - eptr = k ? exp2 : exp1; - ewords = (k ? elen2 : elen1) - 1; - /* Set up bit buffer for walking the exponent */ - buf = BIGLITTLE(*--eptr, *eptr++); - bufbits = 32; - for (j = 0; ewords || buf; j++) { - /* Shift down current buffer */ - curbits = buf; - buf >>= bits; - /* If necessary, add next word */ - bufbits -= bits; - if (bufbits < 0 && ewords > 0) { - nextword = BIGLITTLE(*--eptr, *eptr++); - ewords--; - curbits |= nextword << (bufbits+bits); - buf = nextword >> -bufbits; - bufbits += 32; - } - /* If appropriate, multiply b *= array[j] */ - if ((curbits & mask) == i) { - BNWORD32 const *d = array[j]; - - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (bnull) { - lbnCopy_32(b1, d, mlen); - bnull = 0; - } else { - lbnMontMul_32(c, b1, d, mod, mlen, inv); - t = c; c = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - } - } - - /* Multiply a *= b */ - if (!bnull) { - a1 = BIGLITTLE(a-mlen-1,a+mlen); - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (anull) { - lbnCopy_32(a1, b1, mlen); - anull = 0; - } else { - lbnMontMul_32(c, a1, b1, mod, mlen, inv); - t = c; c = a; a = t; - } - } - } - - assert(!anull); /* If it were, elen would have been 0 */ - - /* Convert out of Montgomery form and return */ - a1 = BIGLITTLE(a-mlen-1,a+mlen); - lbnCopy_32(a, a1, mlen); - lbnZero_32(a1, mlen); - lbnMontReduce_32(a, mod, mlen, inv); - lbnCopy_32(result, a1, mlen); - -#if BNYIELD -yield: -#endif - LBNFREE(c, 2*mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; -} diff --git a/libs/libzrtp/third_party/bnlib/lbn32.h b/libs/libzrtp/third_party/bnlib/lbn32.h deleted file mode 100644 index 713fa17df1..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn32.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef LBN32_H -#define LBN32_H - -#include "lbn.h" - -#ifndef BNWORD32 -#error 32-bit bignum library requires a 32-bit data type -#endif - -#ifndef lbnCopy_32 -void lbnCopy_32(BNWORD32 *dest, BNWORD32 const *src, unsigned len); -#endif -#ifndef lbnZero_32 -void lbnZero_32(BNWORD32 *num, unsigned len); -#endif -#ifndef lbnNeg_32 -void lbnNeg_32(BNWORD32 *num, unsigned len); -#endif - -#ifndef lbnAdd1_32 -BNWORD32 lbnAdd1_32(BNWORD32 *num, unsigned len, BNWORD32 carry); -#endif -#ifndef lbnSub1_32 -BNWORD32 lbnSub1_32(BNWORD32 *num, unsigned len, BNWORD32 borrow); -#endif - -#ifndef lbnAddN_32 -BNWORD32 lbnAddN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len); -#endif -#ifndef lbnSubN_32 -BNWORD32 lbnSubN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len); -#endif - -#ifndef lbnCmp_32 -int lbnCmp_32(BNWORD32 const *num1, BNWORD32 const *num2, unsigned len); -#endif - -#ifndef lbnMulN1_32 -void lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k); -#endif -#ifndef lbnMulAdd1_32 -BNWORD32 -lbnMulAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k); -#endif -#ifndef lbnMulSub1_32 -BNWORD32 lbnMulSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k); -#endif - -#ifndef lbnLshift_32 -BNWORD32 lbnLshift_32(BNWORD32 *num, unsigned len, unsigned shift); -#endif -#ifndef lbnDouble_32 -BNWORD32 lbnDouble_32(BNWORD32 *num, unsigned len); -#endif -#ifndef lbnRshift_32 -BNWORD32 lbnRshift_32(BNWORD32 *num, unsigned len, unsigned shift); -#endif - -#ifndef lbnMul_32 -void lbnMul_32(BNWORD32 *prod, BNWORD32 const *num1, unsigned len1, - BNWORD32 const *num2, unsigned len2); -#endif -#ifndef lbnSquare_32 -void lbnSquare_32(BNWORD32 *prod, BNWORD32 const *num, unsigned len); -#endif - -#ifndef lbnNorm_32 -unsigned lbnNorm_32(BNWORD32 const *num, unsigned len); -#endif -#ifndef lbnBits_32 -unsigned lbnBits_32(BNWORD32 const *num, unsigned len); -#endif - -#ifndef lbnExtractBigBytes_32 -void lbnExtractBigBytes_32(BNWORD32 const *bn, unsigned char *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnInsertBigytes_32 -void lbnInsertBigBytes_32(BNWORD32 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnExtractLittleBytes_32 -void lbnExtractLittleBytes_32(BNWORD32 const *bn, unsigned char *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnInsertLittleBytes_32 -void lbnInsertLittleBytes_32(BNWORD32 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen); -#endif - -#ifndef lbnDiv21_32 -BNWORD32 lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d); -#endif -#ifndef lbnDiv1_32 -BNWORD32 lbnDiv1_32(BNWORD32 *q, BNWORD32 *rem, - BNWORD32 const *n, unsigned len, BNWORD32 d); -#endif -#ifndef lbnModQ_32 -unsigned lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d); -#endif -#ifndef lbnDiv_32 -BNWORD32 -lbnDiv_32(BNWORD32 *q, BNWORD32 *n, unsigned nlen, BNWORD32 *d, unsigned dlen); -#endif - -#ifndef lbnMontInv1_32 -BNWORD32 lbnMontInv1_32(BNWORD32 const x); -#endif -#ifndef lbnMontReduce_32 -void lbnMontReduce_32(BNWORD32 *n, BNWORD32 const *mod, unsigned const mlen, - BNWORD32 inv); -#endif -#ifndef lbnToMont_32 -void lbnToMont_32(BNWORD32 *n, unsigned nlen, BNWORD32 *mod, unsigned mlen); -#endif -#ifndef lbnFromMont_32 -void lbnFromMont_32(BNWORD32 *n, BNWORD32 *mod, unsigned len); -#endif - -#ifndef lbnExpMod_32 -int lbnExpMod_32(BNWORD32 *result, BNWORD32 const *n, unsigned nlen, - BNWORD32 const *exp, unsigned elen, BNWORD32 *mod, unsigned mlen); -#endif -#ifndef lbnDoubleExpMod_32 -int lbnDoubleExpMod_32(BNWORD32 *result, - BNWORD32 const *n1, unsigned n1len, BNWORD32 const *e1, unsigned e1len, - BNWORD32 const *n2, unsigned n2len, BNWORD32 const *e2, unsigned e2len, - BNWORD32 *mod, unsigned mlen); -#endif -#ifndef lbnTwoExpMod_32 -int lbnTwoExpMod_32(BNWORD32 *n, BNWORD32 const *exp, unsigned elen, - BNWORD32 *mod, unsigned mlen); -#endif -#ifndef lbnGcd_32 -int lbnGcd_32(BNWORD32 *a, unsigned alen, BNWORD32 *b, unsigned blen, - unsigned *rlen); -#endif -#ifndef lbnInv_32 -int lbnInv_32(BNWORD32 *a, unsigned alen, BNWORD32 const *mod, unsigned mlen); -#endif - -int lbnBasePrecompBegin_32(BNWORD32 **array, unsigned n, unsigned bits, - BNWORD32 const *g, unsigned glen, BNWORD32 *mod, unsigned mlen); -int lbnBasePrecompExp_32(BNWORD32 *result, BNWORD32 const * const *array, - unsigned bits, BNWORD32 const *exp, unsigned elen, - BNWORD32 const *mod, unsigned mlen); -int lbnDoubleBasePrecompExp_32(BNWORD32 *result, unsigned bits, - BNWORD32 const * const *array1, BNWORD32 const *exp1, unsigned elen1, - BNWORD32 const * const *array2, BNWORD32 const *exp2, - unsigned elen2, BNWORD32 const *mod, unsigned mlen); - -#endif /* LBN32_H */ diff --git a/libs/libzrtp/third_party/bnlib/lbn64.c b/libs/libzrtp/third_party/bnlib/lbn64.c deleted file mode 100644 index c0f659ee3c..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn64.c +++ /dev/null @@ -1,4067 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn64.c - Low-level bignum routines, 64-bit version. - * - * NOTE: the magic constants "64" and "128" appear in many places in this - * file, including inside identifiers. Because it is not possible to - * ask "#ifdef" of a macro expansion, it is not possible to use the - * preprocessor to conditionalize these properly. Thus, this file is - * intended to be edited with textual search and replace to produce - * alternate word size versions. Any reference to the number of bits - * in a word must be the string "64", and that string must not appear - * otherwise. Any reference to twice this number must appear as "128", - * which likewise must not appear otherwise. Is that clear? - * - * Remember, when doubling the bit size replace the larger number (128) - * first, then the smaller (64). When halving the bit size, do the - * opposite. Otherwise, things will get wierd. Also, be sure to replace - * every instance that appears. (:%s/foo/bar/g in vi) - * - * These routines work with a pointer to the least-significant end of - * an array of WORD64s. The BIG(x), LITTLE(y) and BIGLTTLE(x,y) macros - * defined in lbn.h (which expand to x on a big-edian machine and y on a - * little-endian machine) are used to conditionalize the code to work - * either way. If you have no assembly primitives, it doesn't matter. - * Note that on a big-endian machine, the least-significant-end pointer - * is ONE PAST THE END. The bytes are ptr[-1] through ptr[-len]. - * On little-endian, they are ptr[0] through ptr[len-1]. This makes - * perfect sense if you consider pointers to point *between* bytes rather - * than at them. - * - * Because the array index values are unsigned integers, ptr[-i] - * may not work properly, since the index -i is evaluated as an unsigned, - * and if pointers are wider, zero-extension will produce a positive - * number rahter than the needed negative. The expression used in this - * code, *(ptr-i) will, however, work. (The array syntax is equivalent - * to *(ptr+-i), which is a pretty subtle difference.) - * - * Many of these routines will get very unhappy if fed zero-length inputs. - * They use assert() to enforce this. An higher layer of code must make - * sure that these aren't called with zero-length inputs. - * - * Any of these routines can be replaced with more efficient versions - * elsewhere, by just #defining their names. If one of the names - * is #defined, the C code is not compiled in and no declaration is - * made. Use the BNINCLUDE file to do that. Typically, you compile - * asm subroutines with the same name and just, e.g. - * #define lbnMulAdd1_64 lbnMulAdd1_64 - * - * If you want to write asm routines, start with lbnMulAdd1_64(). - * This is the workhorse of modular exponentiation. lbnMulN1_64() is - * also used a fair bit, although not as much and it's defined in terms - * of lbnMulAdd1_64 if that has a custom version. lbnMulSub1_64 and - * lbnDiv21_64 are used in the usual division and remainder finding. - * (Not the Montgomery reduction used in modular exponentiation, though.) - * Once you have lbnMulAdd1_64 defined, writing the other two should - * be pretty easy. (Just make sure you get the sign of the subtraction - * in lbnMulSub1_64 right - it's dest = dest - source * k.) - * - * The only definitions that absolutely need a double-word (BNWORD128) - * type are lbnMulAdd1_64 and lbnMulSub1_64; if those are provided, - * the rest follows. lbnDiv21_64, however, is a lot slower unless you - * have them, and lbnModQ_64 takes after it. That one is used quite a - * bit for prime sieving. - */ - -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#if !NO_STRING_H -#include <string.h> /* For memcpy */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "lbn.h" -#include "lbn64.h" -#include "lbnmem.h" - -#include "kludge.h" - -#ifndef BNWORD64 -#error 64-bit bignum library requires a 64-bit data type -#endif - -/* If this is defined, include bnYield() calls */ -#if BNYIELD -extern int (*bnYield)(void); /* From bn.c */ -#endif - -/* - * Most of the multiply (and Montgomery reduce) routines use an outer - * loop that iterates over one of the operands - a so-called operand - * scanning approach. One big advantage of this is that the assembly - * support routines are simpler. The loops can be rearranged to have - * an outer loop that iterates over the product, a so-called product - * scanning approach. This has the advantage of writing less data - * and doing fewer adds to memory, so is supposedly faster. Some - * code has been written using a product-scanning approach, but - * it appears to be slower, so it is turned off by default. Some - * experimentation would be appreciated. - * - * (The code is also annoying to get right and not very well commented, - * one of my pet peeves about math libraries. I'm sorry.) - */ -#ifndef PRODUCT_SCAN -#define PRODUCT_SCAN 0 -#endif - -/* - * Copy an array of words. <Marvin mode on> Thrilling, isn't it? </Marvin> - * This is a good example of how the byte offsets and BIGLITTLE() macros work. - * Another alternative would have been - * memcpy(dest BIG(-len), src BIG(-len), len*sizeof(BNWORD64)), but I find that - * putting operators into conditional macros is confusing. - */ -#ifndef lbnCopy_64 -void -lbnCopy_64(BNWORD64 *dest, BNWORD64 const *src, unsigned len) -{ - memcpy(BIGLITTLE(dest-len,dest), BIGLITTLE(src-len,src), - len * sizeof(*src)); -} -#endif /* !lbnCopy_64 */ - -/* - * Fill n words with zero. This does it manually rather than calling - * memset because it can assume alignment to make things faster while - * memset can't. Note how big-endian numbers are naturally addressed - * using predecrement, while little-endian is postincrement. - */ -#ifndef lbnZero_64 -void -lbnZero_64(BNWORD64 *num, unsigned len) -{ - while (len--) - BIGLITTLE(*--num,*num++) = 0; -} -#endif /* !lbnZero_64 */ - -/* - * Negate an array of words. - * Negation is subtraction from zero. Negating low-order words - * entails doing nothing until a non-zero word is hit. Once that - * is negated, a borrow is generated and never dies until the end - * of the number is hit. Negation with borrow, -x-1, is the same as ~x. - * Repeat that until the end of the number. - * - * Doesn't return borrow out because that's pretty useless - it's - * always set unless the input is 0, which is easy to notice in - * normalized form. - */ -#ifndef lbnNeg_64 -void -lbnNeg_64(BNWORD64 *num, unsigned len) -{ - assert(len); - - /* Skip low-order zero words */ - while (BIGLITTLE(*--num,*num) == 0) { - if (!--len) - return; - LITTLE(num++;) - } - /* Negate the lowest-order non-zero word */ - *num = -*num; - /* Complement all the higher-order words */ - while (--len) { - BIGLITTLE(--num,++num); - *num = ~*num; - } -} -#endif /* !lbnNeg_64 */ - - -/* - * lbnAdd1_64: add the single-word "carry" to the given number. - * Used for minor increments and propagating the carry after - * adding in a shorter bignum. - * - * Technique: If we have a double-width word, presumably the compiler - * can add using its carry in inline code, so we just use a larger - * accumulator to compute the carry from the first addition. - * If not, it's more complex. After adding the first carry, which may - * be > 1, compare the sum and the carry. If the sum wraps (causing a - * carry out from the addition), the result will be less than each of the - * inputs, since the wrap subtracts a number (2^64) which is larger than - * the other input can possibly be. If the sum is >= the carry input, - * return success immediately. - * In either case, if there is a carry, enter a loop incrementing words - * until one does not wrap. Since we are adding 1 each time, the wrap - * will be to 0 and we can test for equality. - */ -#ifndef lbnAdd1_64 /* If defined, it's provided as an asm subroutine */ -#ifdef BNWORD128 -BNWORD64 -lbnAdd1_64(BNWORD64 *num, unsigned len, BNWORD64 carry) -{ - BNWORD128 t; - assert(len > 0); /* Alternative: if (!len) return carry */ - - t = (BNWORD128)BIGLITTLE(*--num,*num) + carry; - BIGLITTLE(*num,*num++) = (BNWORD64)t; - if ((t >> 64) == 0) - return 0; - while (--len) { - if (++BIGLITTLE(*--num,*num++) != 0) - return 0; - } - return 1; -} -#else /* no BNWORD128 */ -BNWORD64 -lbnAdd1_64(BNWORD64 *num, unsigned len, BNWORD64 carry) -{ - assert(len > 0); /* Alternative: if (!len) return carry */ - - if ((BIGLITTLE(*--num,*num++) += carry) >= carry) - return 0; - while (--len) { - if (++BIGLITTLE(*--num,*num++) != 0) - return 0; - } - return 1; -} -#endif -#endif/* !lbnAdd1_64 */ - -/* - * lbnSub1_64: subtract the single-word "borrow" from the given number. - * Used for minor decrements and propagating the borrow after - * subtracting a shorter bignum. - * - * Technique: Similar to the add, above. If there is a double-length type, - * use that to generate the first borrow. - * If not, after subtracting the first borrow, which may be > 1, compare - * the difference and the *negative* of the carry. If the subtract wraps - * (causing a borrow out from the subtraction), the result will be at least - * as large as -borrow. If the result < -borrow, then no borrow out has - * appeared and we may return immediately, except when borrow == 0. To - * deal with that case, use the identity that -x = ~x+1, and instead of - * comparing < -borrow, compare for <= ~borrow. - * Either way, if there is a borrow out, enter a loop decrementing words - * until a non-zero word is reached. - * - * Note the cast of ~borrow to (BNWORD64). If the size of an int is larger - * than BNWORD64, C rules say the number is expanded for the arithmetic, so - * the inversion will be done on an int and the value won't be quite what - * is expected. - */ -#ifndef lbnSub1_64 /* If defined, it's provided as an asm subroutine */ -#ifdef BNWORD128 -BNWORD64 -lbnSub1_64(BNWORD64 *num, unsigned len, BNWORD64 borrow) -{ - BNWORD128 t; - assert(len > 0); /* Alternative: if (!len) return borrow */ - - t = (BNWORD128)BIGLITTLE(*--num,*num) - borrow; - BIGLITTLE(*num,*num++) = (BNWORD64)t; - if ((t >> 64) == 0) - return 0; - while (--len) { - if ((BIGLITTLE(*--num,*num++))-- != 0) - return 0; - } - return 1; -} -#else /* no BNWORD128 */ -BNWORD64 -lbnSub1_64(BNWORD64 *num, unsigned len, BNWORD64 borrow) -{ - assert(len > 0); /* Alternative: if (!len) return borrow */ - - if ((BIGLITTLE(*--num,*num++) -= borrow) <= (BNWORD64)~borrow) - return 0; - while (--len) { - if ((BIGLITTLE(*--num,*num++))-- != 0) - return 0; - } - return 1; -} -#endif -#endif /* !lbnSub1_64 */ - -/* - * lbnAddN_64: add two bignums of the same length, returning the carry (0 or 1). - * One of the building blocks, along with lbnAdd1, of adding two bignums of - * differing lengths. - * - * Technique: Maintain a word of carry. If there is no double-width type, - * use the same technique as in lbnAdd1, above, to maintain the carry by - * comparing the inputs. Adding the carry sources is used as an OR operator; - * at most one of the two comparisons can possibly be true. The first can - * only be true if carry == 1 and x, the result, is 0. In that case the - * second can't possibly be true. - */ -#ifndef lbnAddN_64 -#ifdef BNWORD128 -BNWORD64 -lbnAddN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len) -{ - BNWORD128 t; - - assert(len > 0); - - t = (BNWORD128)BIGLITTLE(*--num1,*num1) + BIGLITTLE(*--num2,*num2++); - BIGLITTLE(*num1,*num1++) = (BNWORD64)t; - while (--len) { - t = (BNWORD128)BIGLITTLE(*--num1,*num1) + - (BNWORD128)BIGLITTLE(*--num2,*num2++) + (t >> 64); - BIGLITTLE(*num1,*num1++) = (BNWORD64)t; - } - - return (BNWORD64)(t>>64); -} -#else /* no BNWORD128 */ -BNWORD64 -lbnAddN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len) -{ - BNWORD64 x, carry = 0; - - assert(len > 0); /* Alternative: change loop to test at start */ - - do { - x = BIGLITTLE(*--num2,*num2++); - carry = (x += carry) < carry; - carry += (BIGLITTLE(*--num1,*num1++) += x) < x; - } while (--len); - - return carry; -} -#endif -#endif /* !lbnAddN_64 */ - -/* - * lbnSubN_64: add two bignums of the same length, returning the carry (0 or 1). - * One of the building blocks, along with subn1, of subtracting two bignums of - * differing lengths. - * - * Technique: If no double-width type is availble, maintain a word of borrow. - * First, add the borrow to the subtrahend (did you have to learn all those - * awful words in elementary school, too?), and if it overflows, set the - * borrow again. Then subtract the modified subtrahend from the next word - * of input, using the same technique as in subn1, above. - * Adding the borrows is used as an OR operator; at most one of the two - * comparisons can possibly be true. The first can only be true if - * borrow == 1 and x, the result, is 0. In that case the second can't - * possibly be true. - * - * In the double-word case, (BNWORD64)-(t>>64) is subtracted, rather than - * adding t>>64, because the shift would need to sign-extend and that's - * not guaranteed to happen in ANSI C, even with signed types. - */ -#ifndef lbnSubN_64 -#ifdef BNWORD128 -BNWORD64 -lbnSubN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len) -{ - BNWORD128 t; - - assert(len > 0); - - t = (BNWORD128)BIGLITTLE(*--num1,*num1) - BIGLITTLE(*--num2,*num2++); - BIGLITTLE(*num1,*num1++) = (BNWORD64)t; - - while (--len) { - t = (BNWORD128)BIGLITTLE(*--num1,*num1) - - (BNWORD128)BIGLITTLE(*--num2,*num2++) - (BNWORD64)-(t >> 64); - BIGLITTLE(*num1,*num1++) = (BNWORD64)t; - } - - return -(BNWORD64)(t>>64); -} -#else -BNWORD64 -lbnSubN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len) -{ - BNWORD64 x, borrow = 0; - - assert(len > 0); /* Alternative: change loop to test at start */ - - do { - x = BIGLITTLE(*--num2,*num2++); - borrow = (x += borrow) < borrow; - borrow += (BIGLITTLE(*--num1,*num1++) -= x) > (BNWORD64)~x; - } while (--len); - - return borrow; -} -#endif -#endif /* !lbnSubN_64 */ - -#ifndef lbnCmp_64 -/* - * lbnCmp_64: compare two bignums of equal length, returning the sign of - * num1 - num2. (-1, 0 or +1). - * - * Technique: Change the little-endian pointers to big-endian pointers - * and compare from the most-significant end until a difference if found. - * When it is, figure out the sign of the difference and return it. - */ -int -lbnCmp_64(BNWORD64 const *num1, BNWORD64 const *num2, unsigned len) -{ - BIGLITTLE(num1 -= len, num1 += len); - BIGLITTLE(num2 -= len, num2 += len); - - while (len--) { - if (BIGLITTLE(*num1++ != *num2++, *--num1 != *--num2)) { - if (BIGLITTLE(num1[-1] < num2[-1], *num1 < *num2)) - return -1; - else - return 1; - } - } - return 0; -} -#endif /* !lbnCmp_64 */ - -/* - * mul64_ppmmaa(ph,pl,x,y,a,b) is an optional routine that - * computes (ph,pl) = x * y + a + b. mul64_ppmma and mul64_ppmm - * are simpler versions. If you want to be lazy, all of these - * can be defined in terms of the others, so here we create any - * that have not been defined in terms of the ones that have been. - */ - -/* Define ones with fewer a's in terms of ones with more a's */ -#if !defined(mul64_ppmma) && defined(mul64_ppmmaa) -#define mul64_ppmma(ph,pl,x,y,a) mul64_ppmmaa(ph,pl,x,y,a,0) -#endif - -#if !defined(mul64_ppmm) && defined(mul64_ppmma) -#define mul64_ppmm(ph,pl,x,y) mul64_ppmma(ph,pl,x,y,0) -#endif - -/* - * Use this definition to test the mul64_ppmm-based operations on machines - * that do not provide mul64_ppmm. Change the final "0" to a "1" to - * enable it. - */ -#if !defined(mul64_ppmm) && defined(BNWORD128) && 0 /* Debugging */ -#define mul64_ppmm(ph,pl,x,y) \ - ({BNWORD128 _ = (BNWORD128)(x)*(y); (pl) = _; (ph) = _>>64;}) -#endif - -#if defined(mul64_ppmm) && !defined(mul64_ppmma) -#define mul64_ppmma(ph,pl,x,y,a) \ - (mul64_ppmm(ph,pl,x,y), (ph) += ((pl) += (a)) < (a)) -#endif - -#if defined(mul64_ppmma) && !defined(mul64_ppmmaa) -#define mul64_ppmmaa(ph,pl,x,y,a,b) \ - (mul64_ppmma(ph,pl,x,y,a), (ph) += ((pl) += (b)) < (b)) -#endif - -/* - * lbnMulN1_64: Multiply an n-word input by a 1-word input and store the - * n+1-word product. This uses either the mul64_ppmm and mul64_ppmma - * macros, or C multiplication with the BNWORD128 type. This uses mul64_ppmma - * if available, assuming you won't bother defining it unless you can do - * better than the normal multiplication. - */ -#ifndef lbnMulN1_64 -#ifdef lbnMulAdd1_64 /* If we have this asm primitive, use it. */ -void -lbnMulN1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k) -{ - lbnZero_64(out, len); - BIGLITTLE(*(out-len-1),*(out+len)) = lbnMulAdd1_64(out, in, len, k); -} -#elif defined(mul64_ppmm) -void -lbnMulN1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k) -{ - BNWORD64 carry, carryin; - - assert(len > 0); - - BIG(--out;--in;); - mul64_ppmm(carry, *out, *in, k); - LITTLE(out++;in++;) - - while (--len) { - BIG(--out;--in;) - carryin = carry; - mul64_ppmma(carry, *out, *in, k, carryin); - LITTLE(out++;in++;) - } - BIGLITTLE(*--out,*out) = carry; -} -#elif defined(BNWORD128) -void -lbnMulN1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k) -{ - BNWORD128 p; - - assert(len > 0); - - p = (BNWORD128)BIGLITTLE(*--in,*in++) * k; - BIGLITTLE(*--out,*out++) = (BNWORD64)p; - - while (--len) { - p = (BNWORD128)BIGLITTLE(*--in,*in++) * k + (BNWORD64)(p >> 64); - BIGLITTLE(*--out,*out++) = (BNWORD64)p; - } - BIGLITTLE(*--out,*out) = (BNWORD64)(p >> 64); -} -#else -#error No 64x64 -> 128 multiply available for 64-bit bignum package -#endif -#endif /* lbnMulN1_64 */ - -/* - * lbnMulAdd1_64: Multiply an n-word input by a 1-word input and add the - * low n words of the product to the destination. *Returns the n+1st word - * of the product.* (That turns out to be more convenient than adding - * it into the destination and dealing with a possible unit carry out - * of *that*.) This uses either the mul64_ppmma and mul64_ppmmaa macros, - * or C multiplication with the BNWORD128 type. - * - * If you're going to write assembly primitives, this is the one to - * start with. It is by far the most commonly called function. - */ -#ifndef lbnMulAdd1_64 -#if defined(mul64_ppmm) -BNWORD64 -lbnMulAdd1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k) -{ - BNWORD64 prod, carry, carryin; - - assert(len > 0); - - BIG(--out;--in;); - carryin = *out; - mul64_ppmma(carry, *out, *in, k, carryin); - LITTLE(out++;in++;) - - while (--len) { - BIG(--out;--in;); - carryin = carry; - mul64_ppmmaa(carry, prod, *in, k, carryin, *out); - *out = prod; - LITTLE(out++;in++;) - } - - return carry; -} -#elif defined(BNWORD128) -BNWORD64 -lbnMulAdd1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k) -{ - BNWORD128 p; - - assert(len > 0); - - p = (BNWORD128)BIGLITTLE(*--in,*in++) * k + BIGLITTLE(*--out,*out); - BIGLITTLE(*out,*out++) = (BNWORD64)p; - - while (--len) { - p = (BNWORD128)BIGLITTLE(*--in,*in++) * k + - (BNWORD64)(p >> 64) + BIGLITTLE(*--out,*out); - BIGLITTLE(*out,*out++) = (BNWORD64)p; - } - - return (BNWORD64)(p >> 64); -} -#else -#error No 64x64 -> 128 multiply available for 64-bit bignum package -#endif -#endif /* lbnMulAdd1_64 */ - -/* - * lbnMulSub1_64: Multiply an n-word input by a 1-word input and subtract the - * n-word product from the destination. Returns the n+1st word of the product. - * This uses either the mul64_ppmm and mul64_ppmma macros, or - * C multiplication with the BNWORD128 type. - * - * This is rather uglier than adding, but fortunately it's only used in - * division which is not used too heavily. - */ -#ifndef lbnMulSub1_64 -#if defined(mul64_ppmm) -BNWORD64 -lbnMulSub1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k) -{ - BNWORD64 prod, carry, carryin; - - assert(len > 0); - - BIG(--in;) - mul64_ppmm(carry, prod, *in, k); - LITTLE(in++;) - carry += (BIGLITTLE(*--out,*out++) -= prod) > (BNWORD64)~prod; - - while (--len) { - BIG(--in;); - carryin = carry; - mul64_ppmma(carry, prod, *in, k, carryin); - LITTLE(in++;) - carry += (BIGLITTLE(*--out,*out++) -= prod) > (BNWORD64)~prod; - } - - return carry; -} -#elif defined(BNWORD128) -BNWORD64 -lbnMulSub1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k) -{ - BNWORD128 p; - BNWORD64 carry, t; - - assert(len > 0); - - p = (BNWORD128)BIGLITTLE(*--in,*in++) * k; - t = BIGLITTLE(*--out,*out); - carry = (BNWORD64)(p>>64) + ((BIGLITTLE(*out,*out++)=t-(BNWORD64)p) > t); - - while (--len) { - p = (BNWORD128)BIGLITTLE(*--in,*in++) * k + carry; - t = BIGLITTLE(*--out,*out); - carry = (BNWORD64)(p>>64) + - ( (BIGLITTLE(*out,*out++)=t-(BNWORD64)p) > t ); - } - - return carry; -} -#else -#error No 64x64 -> 128 multiply available for 64-bit bignum package -#endif -#endif /* !lbnMulSub1_64 */ - -/* - * Shift n words left "shift" bits. 0 < shift < 64. Returns the - * carry, any bits shifted off the left-hand side (0 <= carry < 2^shift). - */ -#ifndef lbnLshift_64 -BNWORD64 -lbnLshift_64(BNWORD64 *num, unsigned len, unsigned shift) -{ - BNWORD64 x, carry; - - assert(shift > 0); - assert(shift < 64); - - carry = 0; - while (len--) { - BIG(--num;) - x = *num; - *num = (x<<shift) | carry; - LITTLE(num++;) - carry = x >> (64-shift); - } - return carry; -} -#endif /* !lbnLshift_64 */ - -/* - * An optimized version of the above, for shifts of 1. - * Some machines can use add-with-carry tricks for this. - */ -#ifndef lbnDouble_64 -BNWORD64 -lbnDouble_64(BNWORD64 *num, unsigned len) -{ - BNWORD64 x, carry; - - carry = 0; - while (len--) { - BIG(--num;) - x = *num; - *num = (x<<1) | carry; - LITTLE(num++;) - carry = x >> (64-1); - } - return carry; -} -#endif /* !lbnDouble_64 */ - -/* - * Shift n words right "shift" bits. 0 < shift < 64. Returns the - * carry, any bits shifted off the right-hand side (0 <= carry < 2^shift). - */ -#ifndef lbnRshift_64 -BNWORD64 -lbnRshift_64(BNWORD64 *num, unsigned len, unsigned shift) -{ - BNWORD64 x, carry = 0; - - assert(shift > 0); - assert(shift < 64); - - BIGLITTLE(num -= len, num += len); - - while (len--) { - LITTLE(--num;) - x = *num; - *num = (x>>shift) | carry; - BIG(num++;) - carry = x << (64-shift); - } - return carry >> (64-shift); -} -#endif /* !lbnRshift_64 */ - -/* - * Multiply two numbers of the given lengths. prod and num2 may overlap, - * provided that the low len1 bits of prod are free. (This corresponds - * nicely to the place the result is returned from lbnMontReduce_64.) - * - * TODO: Use Karatsuba multiply. The overlap constraints may have - * to get rewhacked. - */ -#ifndef lbnMul_64 -void -lbnMul_64(BNWORD64 *prod, BNWORD64 const *num1, unsigned len1, - BNWORD64 const *num2, unsigned len2) -{ - /* Special case of zero */ - if (!len1 || !len2) { - lbnZero_64(prod, len1+len2); - return; - } - - /* Multiply first word */ - lbnMulN1_64(prod, num1, len1, BIGLITTLE(*--num2,*num2++)); - - /* - * Add in subsequent words, storing the most significant word, - * which is new each time. - */ - while (--len2) { - BIGLITTLE(--prod,prod++); - BIGLITTLE(*(prod-len1-1),*(prod+len1)) = - lbnMulAdd1_64(prod, num1, len1, BIGLITTLE(*--num2,*num2++)); - } -} -#endif /* !lbnMul_64 */ - -/* - * lbnMulX_64 is a square multiply - both inputs are the same length. - * It's normally just a macro wrapper around the general multiply, - * but might be implementable in assembly more efficiently (such as - * when product scanning). - */ -#ifndef lbnMulX_64 -#if defined(BNWORD128) && PRODUCT_SCAN -/* - * Test code to see whether product scanning is any faster. It seems - * to make the C code slower, so PRODUCT_SCAN is not defined. - */ -static void -lbnMulX_64(BNWORD64 *prod, BNWORD64 const *num1, BNWORD64 const *num2, - unsigned len) -{ - BNWORD128 x, y; - BNWORD64 const *p1, *p2; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - x = (BNWORD128)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]); - BIGLITTLE(*--prod, *prod++) = (BNWORD64)x; - x >>= 64; - - for (i = 1; i < len; i++) { - carry = 0; - p1 = num1; - p2 = BIGLITTLE(num2-i-1,num2+i+1); - for (j = 0; j <= i; j++) { - BIG(y = (BNWORD128)*--p1 * *p2++;) - LITTLE(y = (BNWORD128)*p1++ * *--p2;) - x += y; - carry += (x < y); - } - BIGLITTLE(*--prod,*prod++) = (BNWORD64)x; - x = (x >> 64) | (BNWORD128)carry << 64; - } - for (i = 1; i < len; i++) { - carry = 0; - p1 = BIGLITTLE(num1-i,num1+i); - p2 = BIGLITTLE(num2-len,num2+len); - for (j = i; j < len; j++) { - BIG(y = (BNWORD128)*--p1 * *p2++;) - LITTLE(y = (BNWORD128)*p1++ * *--p2;) - x += y; - carry += (x < y); - } - BIGLITTLE(*--prod,*prod++) = (BNWORD64)x; - x = (x >> 64) | (BNWORD128)carry << 64; - } - - BIGLITTLE(*--prod,*prod) = (BNWORD64)x; -} -#else /* !defined(BNWORD128) || !PRODUCT_SCAN */ -/* Default trivial macro definition */ -#define lbnMulX_64(prod, num1, num2, len) lbnMul_64(prod, num1, len, num2, len) -#endif /* !defined(BNWORD128) || !PRODUCT_SCAN */ -#endif /* !lbmMulX_64 */ - -#if !defined(lbnMontMul_64) && defined(BNWORD128) && PRODUCT_SCAN -/* - * Test code for product-scanning multiply. This seems to slow the C - * code down rather than speed it up. - * This does a multiply and Montgomery reduction together, using the - * same loops. The outer loop scans across the product, twice. - * The first pass computes the low half of the product and the - * Montgomery multipliers. These are stored in the product array, - * which contains no data as of yet. x and carry add up the columns - * and propagate carries forward. - * - * The second half multiplies the upper half, adding in the modulus - * times the Montgomery multipliers. The results of this multiply - * are stored. - */ -static void -lbnMontMul_64(BNWORD64 *prod, BNWORD64 const *num1, BNWORD64 const *num2, - BNWORD64 const *mod, unsigned len, BNWORD64 inv) -{ - BNWORD128 x, y; - BNWORD64 const *p1, *p2, *pm; - BNWORD64 *pp; - BNWORD64 t; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - /* - * This computes directly into the high half of prod, so just - * shift the pointer and consider prod only "len" elements long - * for the rest of the code. - */ - BIGLITTLE(prod -= len, prod += len); - - /* Pass 1 - compute Montgomery multipliers */ - /* First iteration can have certain simplifications. */ - x = (BNWORD128)BIGLITTLE(num1[-1] * num2[-1], num1[0] * num2[0]); - BIGLITTLE(prod[-1], prod[0]) = t = inv * (BNWORD64)x; - y = (BNWORD128)t * BIGLITTLE(mod[-1],mod[0]); - x += y; - /* Note: GCC 2.6.3 has a bug if you try to eliminate "carry" */ - carry = (x < y); - assert((BNWORD64)x == 0); - x = x >> 64 | (BNWORD128)carry << 64; - - for (i = 1; i < len; i++) { - carry = 0; - p1 = num1; - p2 = BIGLITTLE(num2-i-1,num2+i+1); - pp = prod; - pm = BIGLITTLE(mod-i-1,mod+i+1); - for (j = 0; j < i; j++) { - y = (BNWORD128)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2); - x += y; - carry += (x < y); - y = (BNWORD128)BIGLITTLE(*--pp * *pm++, *pp++ * *--pm); - x += y; - carry += (x < y); - } - y = (BNWORD128)BIGLITTLE(p1[-1] * p2[0], p1[0] * p2[-1]); - x += y; - carry += (x < y); - assert(BIGLITTLE(pp == prod-i, pp == prod+i)); - BIGLITTLE(pp[-1], pp[0]) = t = inv * (BNWORD64)x; - assert(BIGLITTLE(pm == mod-1, pm == mod+1)); - y = (BNWORD128)t * BIGLITTLE(pm[0],pm[-1]); - x += y; - carry += (x < y); - assert((BNWORD64)x == 0); - x = x >> 64 | (BNWORD128)carry << 64; - } - - /* Pass 2 - compute reduced product and store */ - for (i = 1; i < len; i++) { - carry = 0; - p1 = BIGLITTLE(num1-i,num1+i); - p2 = BIGLITTLE(num2-len,num2+len); - pm = BIGLITTLE(mod-i,mod+i); - pp = BIGLITTLE(prod-len,prod+len); - for (j = i; j < len; j++) { - y = (BNWORD128)BIGLITTLE(*--p1 * *p2++, *p1++ * *--p2); - x += y; - carry += (x < y); - y = (BNWORD128)BIGLITTLE(*--pm * *pp++, *pm++ * *--pp); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pm == mod-len, pm == mod+len)); - assert(BIGLITTLE(pp == prod-i, pp == prod+i)); - BIGLITTLE(pp[0],pp[-1]) = (BNWORD64)x; - x = (x >> 64) | (BNWORD128)carry << 64; - } - - /* Last round of second half, simplified. */ - BIGLITTLE(*(prod-len),*(prod+len-1)) = (BNWORD64)x; - carry = (x >> 64); - - while (carry) - carry -= lbnSubN_64(prod, mod, len); - while (lbnCmp_64(prod, mod, len) >= 0) - (void)lbnSubN_64(prod, mod, len); -} -/* Suppress later definition */ -#define lbnMontMul_64 lbnMontMul_64 -#endif - -#if !defined(lbnSquare_64) && defined(BNWORD128) && PRODUCT_SCAN -/* - * Trial code for product-scanning squaring. This seems to slow the C - * code down rather than speed it up. - */ -void -lbnSquare_64(BNWORD64 *prod, BNWORD64 const *num, unsigned len) -{ - BNWORD128 x, y, z; - BNWORD64 const *p1, *p2; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!len) - return; - - /* Word 0 of product */ - x = (BNWORD128)BIGLITTLE(num[-1] * num[-1], num[0] * num[0]); - BIGLITTLE(*--prod, *prod++) = (BNWORD64)x; - x >>= 64; - - /* Words 1 through len-1 */ - for (i = 1; i < len; i++) { - carry = 0; - y = 0; - p1 = num; - p2 = BIGLITTLE(num-i-1,num+i+1); - for (j = 0; j < (i+1)/2; j++) { - BIG(z = (BNWORD128)*--p1 * *p2++;) - LITTLE(z = (BNWORD128)*p1++ * *--p2;) - y += z; - carry += (y < z); - } - y += z = y; - carry += carry + (y < z); - if ((i & 1) == 0) { - assert(BIGLITTLE(--p1 == p2, p1 == --p2)); - BIG(z = (BNWORD128)*p2 * *p2;) - LITTLE(z = (BNWORD128)*p1 * *p1;) - y += z; - carry += (y < z); - } - x += y; - carry += (x < y); - BIGLITTLE(*--prod,*prod++) = (BNWORD64)x; - x = (x >> 64) | (BNWORD128)carry << 64; - } - /* Words len through 2*len-2 */ - for (i = 1; i < len; i++) { - carry = 0; - y = 0; - p1 = BIGLITTLE(num-i,num+i); - p2 = BIGLITTLE(num-len,num+len); - for (j = 0; j < (len-i)/2; j++) { - BIG(z = (BNWORD128)*--p1 * *p2++;) - LITTLE(z = (BNWORD128)*p1++ * *--p2;) - y += z; - carry += (y < z); - } - y += z = y; - carry += carry + (y < z); - if ((len-i) & 1) { - assert(BIGLITTLE(--p1 == p2, p1 == --p2)); - BIG(z = (BNWORD128)*p2 * *p2;) - LITTLE(z = (BNWORD128)*p1 * *p1;) - y += z; - carry += (y < z); - } - x += y; - carry += (x < y); - BIGLITTLE(*--prod,*prod++) = (BNWORD64)x; - x = (x >> 64) | (BNWORD128)carry << 64; - } - - /* Word 2*len-1 */ - BIGLITTLE(*--prod,*prod) = (BNWORD64)x; -} -/* Suppress later definition */ -#define lbnSquare_64 lbnSquare_64 -#endif - -/* - * Square a number, using optimized squaring to reduce the number of - * primitive multiples that are executed. There may not be any - * overlap of the input and output. - * - * Technique: Consider the partial products in the multiplication - * of "abcde" by itself: - * - * a b c d e - * * a b c d e - * ================== - * ae be ce de ee - * ad bd cd dd de - * ac bc cc cd ce - * ab bb bc bd be - * aa ab ac ad ae - * - * Note that everything above the main diagonal: - * ae be ce de = (abcd) * e - * ad bd cd = (abc) * d - * ac bc = (ab) * c - * ab = (a) * b - * - * is a copy of everything below the main diagonal: - * de - * cd ce - * bc bd be - * ab ac ad ae - * - * Thus, the sum is 2 * (off the diagonal) + diagonal. - * - * This is accumulated beginning with the diagonal (which - * consist of the squares of the digits of the input), which is then - * divided by two, the off-diagonal added, and multiplied by two - * again. The low bit is simply a copy of the low bit of the - * input, so it doesn't need special care. - * - * TODO: Merge the shift by 1 with the squaring loop. - * TODO: Use Karatsuba. (a*W+b)^2 = a^2 * (W^2+W) + b^2 * (W+1) - (a-b)^2 * W. - */ -#ifndef lbnSquare_64 -void -lbnSquare_64(BNWORD64 *prod, BNWORD64 const *num, unsigned len) -{ - BNWORD64 t; - BNWORD64 *prodx = prod; /* Working copy of the argument */ - BNWORD64 const *numx = num; /* Working copy of the argument */ - unsigned lenx = len; /* Working copy of the argument */ - - if (!len) - return; - - /* First, store all the squares */ - while (lenx--) { -#ifdef mul64_ppmm - BNWORD64 ph, pl; - t = BIGLITTLE(*--numx,*numx++); - mul64_ppmm(ph,pl,t,t); - BIGLITTLE(*--prodx,*prodx++) = pl; - BIGLITTLE(*--prodx,*prodx++) = ph; -#elif defined(BNWORD128) /* use BNWORD128 */ - BNWORD128 p; - t = BIGLITTLE(*--numx,*numx++); - p = (BNWORD128)t * t; - BIGLITTLE(*--prodx,*prodx++) = (BNWORD64)p; - BIGLITTLE(*--prodx,*prodx++) = (BNWORD64)(p>>64); -#else /* Use lbnMulN1_64 */ - t = BIGLITTLE(numx[-1],*numx); - lbnMulN1_64(prodx, numx, 1, t); - BIGLITTLE(--numx,numx++); - BIGLITTLE(prodx -= 2, prodx += 2); -#endif - } - /* Then, shift right 1 bit */ - (void)lbnRshift_64(prod, 2*len, 1); - - /* Then, add in the off-diagonal sums */ - lenx = len; - numx = num; - prodx = prod; - while (--lenx) { - t = BIGLITTLE(*--numx,*numx++); - BIGLITTLE(--prodx,prodx++); - t = lbnMulAdd1_64(prodx, numx, lenx, t); - lbnAdd1_64(BIGLITTLE(prodx-lenx,prodx+lenx), lenx+1, t); - BIGLITTLE(--prodx,prodx++); - } - - /* Shift it back up */ - lbnDouble_64(prod, 2*len); - - /* And set the low bit appropriately */ - BIGLITTLE(prod[-1],prod[0]) |= BIGLITTLE(num[-1],num[0]) & 1; -} -#endif /* !lbnSquare_64 */ - -/* - * lbnNorm_64 - given a number, return a modified length such that the - * most significant digit is non-zero. Zero-length input is okay. - */ -#ifndef lbnNorm_64 -unsigned -lbnNorm_64(BNWORD64 const *num, unsigned len) -{ - BIGLITTLE(num -= len,num += len); - while (len && BIGLITTLE(*num++,*--num) == 0) - --len; - return len; -} -#endif /* lbnNorm_64 */ - -/* - * lbnBits_64 - return the number of significant bits in the array. - * It starts by normalizing the array. Zero-length input is okay. - * Then assuming there's anything to it, it fetches the high word, - * generates a bit length by multiplying the word length by 64, and - * subtracts off 64/2, 64/4, 64/8, ... bits if the high bits are clear. - */ -#ifndef lbnBits_64 -unsigned -lbnBits_64(BNWORD64 const *num, unsigned len) -{ - BNWORD64 t; - unsigned i; - - len = lbnNorm_64(num, len); - if (len) { - t = BIGLITTLE(*(num-len),*(num+(len-1))); - assert(t); - len *= 64; - i = 64/2; - do { - if (t >> i) - t >>= i; - else - len -= i; - } while ((i /= 2) != 0); - } - return len; -} -#endif /* lbnBits_64 */ - -/* - * If defined, use hand-rolled divide rather than compiler's native. - * If the machine doesn't do it in line, the manual code is probably - * faster, since it can assume normalization and the fact that the - * quotient will fit into 64 bits, which a general 128-bit divide - * in a compiler's run-time library can't do. - */ -#ifndef BN_SLOW_DIVIDE_128 -/* Assume that divisors of more than thirty-two bits are slow */ -#define BN_SLOW_DIVIDE_128 (128 > 0x20) -#endif - -/* - * Return (nh<<64|nl) % d, and place the quotient digit into *q. - * It is guaranteed that nh < d, and that d is normalized (with its high - * bit set). If we have a double-width type, it's easy. If not, ooh, - * yuk! - */ -#ifndef lbnDiv21_64 -#if defined(BNWORD128) && !BN_SLOW_DIVIDE_128 -BNWORD64 -lbnDiv21_64(BNWORD64 *q, BNWORD64 nh, BNWORD64 nl, BNWORD64 d) -{ - BNWORD128 n = (BNWORD128)nh << 64 | nl; - - /* Divisor must be normalized */ - assert(d >> (64-1) == 1); - - *q = n / d; - return n % d; -} -#else -/* - * This is where it gets ugly. - * - * Do the division in two halves, using Algorithm D from section 4.3.1 - * of Knuth. Note Theorem B from that section, that the quotient estimate - * is never more than the true quotient, and is never more than two - * too low. - * - * The mapping onto conventional long division is (everything a half word): - * _____________qh___ql_ - * dh dl ) nh.h nh.l nl.h nl.l - * - (qh * d) - * ----------- - * rrrr rrrr nl.l - * - (ql * d) - * ----------- - * rrrr rrrr - * - * The implicit 3/2-digit d*qh and d*ql subtractors are computed this way: - * First, estimate a q digit so that nh/dh works. Subtracting qh*dh from - * the (nh.h nh.l) list leaves a 1/2-word remainder r. Then compute the - * low part of the subtractor, qh * dl. This also needs to be subtracted - * from (nh.h nh.l nl.h) to get the final remainder. So we take the - * remainder, which is (nh.h nh.l) - qh*dl, shift it and add in nl.h, and - * try to subtract qh * dl from that. Since the remainder is 1/2-word - * long, shifting and adding nl.h results in a single word r. - * It is possible that the remainder we're working with, r, is less than - * the product qh * dl, if we estimated qh too high. The estimation - * technique can produce a qh that is too large (never too small), leading - * to r which is too small. In that case, decrement the digit qh, add - * shifted dh to r (to correct for that error), and subtract dl from the - * product we're comparing r with. That's the "correct" way to do it, but - * just adding dl to r instead of subtracting it from the product is - * equivalent and a lot simpler. You just have to watch out for overflow. - * - * The process is repeated with (rrrr rrrr nl.l) for the low digit of the - * quotient ql. - * - * The various uses of 64/2 for shifts are because of the note about - * automatic editing of this file at the very top of the file. - */ -#define highhalf(x) ( (x) >> 64/2 ) -#define lowhalf(x) ( (x) & (((BNWORD64)1 << 64/2)-1) ) -BNWORD64 -lbnDiv21_64(BNWORD64 *q, BNWORD64 nh, BNWORD64 nl, BNWORD64 d) -{ - BNWORD64 dh = highhalf(d), dl = lowhalf(d); - BNWORD64 qh, ql, prod, r; - - /* Divisor must be normalized */ - assert((d >> (64-1)) == 1); - - /* Do first half-word of division */ - qh = nh / dh; - r = nh % dh; - prod = qh * dl; - - /* - * Add next half-word of numerator to remainder and correct. - * qh may be up to two too large. - */ - r = (r << (64/2)) | highhalf(nl); - if (r < prod) { - --qh; r += d; - if (r >= d && r < prod) { - --qh; r += d; - } - } - r -= prod; - - /* Do second half-word of division */ - ql = r / dh; - r = r % dh; - prod = ql * dl; - - r = (r << (64/2)) | lowhalf(nl); - if (r < prod) { - --ql; r += d; - if (r >= d && r < prod) { - --ql; r += d; - } - } - r -= prod; - - *q = (qh << (64/2)) | ql; - - return r; -} -#endif -#endif /* lbnDiv21_64 */ - - -/* - * In the division functions, the dividend and divisor are referred to - * as "n" and "d", which stand for "numerator" and "denominator". - * - * The quotient is (nlen-dlen+1) digits long. It may be overlapped with - * the high (nlen-dlen) words of the dividend, but one extra word is needed - * on top to hold the top word. - */ - -/* - * Divide an n-word number by a 1-word number, storing the remainder - * and n-1 words of the n-word quotient. The high word is returned. - * It IS legal for rem to point to the same address as n, and for - * q to point one word higher. - * - * TODO: If BN_SLOW_DIVIDE_128, add a divnhalf_64 which uses 64-bit - * dividends if the divisor is half that long. - * TODO: Shift the dividend on the fly to avoid the last division and - * instead have a remainder that needs shifting. - * TODO: Use reciprocals rather than dividing. - */ -#ifndef lbnDiv1_64 -BNWORD64 -lbnDiv1_64(BNWORD64 *q, BNWORD64 *rem, BNWORD64 const *n, unsigned len, - BNWORD64 d) -{ - unsigned shift; - unsigned xlen; - BNWORD64 r; - BNWORD64 qhigh; - - assert(len > 0); - assert(d); - - if (len == 1) { - r = *n; - *rem = r%d; - return r/d; - } - - shift = 0; - r = d; - xlen = 64/2; - do { - if (r >> xlen) - r >>= xlen; - else - shift += xlen; - } while ((xlen /= 2) != 0); - assert((d >> (64-1-shift)) == 1); - d <<= shift; - - BIGLITTLE(q -= len-1,q += len-1); - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - if (r < d) { - qhigh = 0; - } else { - qhigh = r/d; - r %= d; - } - - xlen = len; - while (--xlen) - r = lbnDiv21_64(BIGLITTLE(q++,--q), r, BIGLITTLE(*n++,*--n), d); - - /* - * Final correction for shift - shift the quotient up "shift" - * bits, and merge in the extra bits of quotient. Then reduce - * the final remainder mod the real d. - */ - if (shift) { - d >>= shift; - qhigh = (qhigh << shift) | lbnLshift_64(q, len-1, shift); - BIGLITTLE(q[-1],*q) |= r/d; - r %= d; - } - *rem = r; - - return qhigh; -} -#endif - -/* - * This function performs a "quick" modulus of a number with a divisor - * d which is guaranteed to be at most sixteen bits, i.e. less than 65536. - * This applies regardless of the word size the library is compiled with. - * - * This function is important to prime generation, for sieving. - */ -#ifndef lbnModQ_64 -/* If there's a custom lbnMod21_64, no normalization needed */ -#ifdef lbnMod21_64 -unsigned -lbnModQ_64(BNWORD64 const *n, unsigned len, unsigned d) -{ - unsigned i, shift; - BNWORD64 r; - - assert(len > 0); - - BIGLITTLE(n -= len,n += len); - - /* Try using a compare to avoid the first divide */ - r = BIGLITTLE(*n++,*--n); - if (r >= d) - r %= d; - while (--len) - r = lbnMod21_64(r, BIGLITTLE(*n++,*--n), d); - - return r; -} -#elif defined(BNWORD128) && !BN_SLOW_DIVIDE_128 -unsigned -lbnModQ_64(BNWORD64 const *n, unsigned len, unsigned d) -{ - BNWORD64 r; - - if (!--len) - return BIGLITTLE(n[-1],n[0]) % d; - - BIGLITTLE(n -= len,n += len); - r = BIGLITTLE(n[-1],n[0]); - - do { - r = (BNWORD64)((((BNWORD128)r<<64) | BIGLITTLE(*n++,*--n)) % d); - } while (--len); - - return r; -} -#elif 64 >= 0x20 -/* - * If the single word size can hold 65535*65536, then this function - * is avilable. - */ -#ifndef highhalf -#define highhalf(x) ( (x) >> 64/2 ) -#define lowhalf(x) ( (x) & ((1 << 64/2)-1) ) -#endif -unsigned -lbnModQ_64(BNWORD64 const *n, unsigned len, unsigned d) -{ - BNWORD64 r, x; - - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - while (--len) { - x = BIGLITTLE(*n++,*--n); - r = (r%d << 64/2) | highhalf(x); - r = (r%d << 64/2) | lowhalf(x); - } - - return r%d; -} -#else -/* Default case - use lbnDiv21_64 */ -unsigned -lbnModQ_64(BNWORD64 const *n, unsigned len, unsigned d) -{ - unsigned i, shift; - BNWORD64 r; - BNWORD64 q; - - assert(len > 0); - - shift = 0; - r = d; - i = 64; - while (i /= 2) { - if (r >> i) - r >>= i; - else - shift += i; - } - assert(d >> (64-1-shift) == 1); - d <<= shift; - - BIGLITTLE(n -= len,n += len); - - r = BIGLITTLE(*n++,*--n); - if (r >= d) - r %= d; - - while (--len) - r = lbnDiv21_64(&q, r, BIGLITTLE(*n++,*--n), d); - - /* - * Final correction for shift - shift the quotient up "shift" - * bits, and merge in the extra bits of quotient. Then reduce - * the final remainder mod the real d. - */ - if (shift) - r %= d >> shift; - - return r; -} -#endif -#endif /* lbnModQ_64 */ - -/* - * Reduce n mod d and return the quotient. That is, find: - * q = n / d; - * n = n % d; - * d is altered during the execution of this subroutine by normalizing it. - * It must already have its most significant word non-zero; it is shifted - * so its most significant bit is non-zero. - * - * The quotient q is nlen-dlen+1 words long. To make it possible to - * overlap the quptient with the input (you can store it in the high dlen - * words), the high word of the quotient is *not* stored, but is returned. - * (If all you want is the remainder, you don't care about it, anyway.) - * - * This uses algorithm D from Knuth (4.3.1), except that we do binary - * (shift) normalization of the divisor. WARNING: This is hairy! - * - * This function is used for some modular reduction, but it is not used in - * the modular exponentiation loops; they use Montgomery form and the - * corresponding, more efficient, Montgomery reduction. This code - * is needed for the conversion to Montgomery form, however, so it - * has to be here and it might as well be reasonably efficient. - * - * The overall operation is as follows ("top" and "up" refer to the - * most significant end of the number; "bottom" and "down", the least): - * - * - Shift the divisor up until the most significant bit is set. - * - Shift the dividend up the same amount. This will produce the - * correct quotient, and the remainder can be recovered by shifting - * it back down the same number of bits. This may produce an overflow - * word, but the word is always strictly less than the most significant - * divisor word. - * - Estimate the first quotient digit qhat: - * - First take the top two words (one of which is the overflow) of the - * dividend and divide by the top word of the divisor: - * qhat = (nh,nm)/dh. This qhat is >= the correct quotient digit - * and, since dh is normalized, it is at most two over. - * - Second, correct by comparing the top three words. If - * (dh,dl) * qhat > (nh,nm,ml), decrease qhat and try again. - * The second iteration can be simpler because there can't be a third. - * The computation can be simplified by subtracting dh*qhat from - * both sides, suitably shifted. This reduces the left side to - * dl*qhat. On the right, (nh,nm)-dh*qhat is simply the - * remainder r from (nh,nm)%dh, so the right is (r,nl). - * This produces qhat that is almost always correct and at - * most (prob ~ 2/2^64) one too high. - * - Subtract qhat times the divisor (suitably shifted) from the dividend. - * If there is a borrow, qhat was wrong, so decrement it - * and add the divisor back in (once). - * - Store the final quotient digit qhat in the quotient array q. - * - * Repeat the quotient digit computation for successive digits of the - * quotient until the whole quotient has been computed. Then shift the - * divisor and the remainder down to correct for the normalization. - * - * TODO: Special case 2-word divisors. - * TODO: Use reciprocals rather than dividing. - */ -#ifndef divn_64 -BNWORD64 -lbnDiv_64(BNWORD64 *q, BNWORD64 *n, unsigned nlen, BNWORD64 *d, unsigned dlen) -{ - BNWORD64 nh,nm,nl; /* Top three words of the dividend */ - BNWORD64 dh,dl; /* Top two words of the divisor */ - BNWORD64 qhat; /* Extimate of quotient word */ - BNWORD64 r; /* Remainder from quotient estimate division */ - BNWORD64 qhigh; /* High word of quotient */ - unsigned i; /* Temp */ - unsigned shift; /* Bits shifted by normalization */ - unsigned qlen = nlen-dlen; /* Size of quotient (less 1) */ -#ifdef mul64_ppmm - BNWORD64 t64; -#elif defined(BNWORD128) - BNWORD128 t128; -#else /* use lbnMulN1_64 */ - BNWORD64 t2[2]; -#define t2high BIGLITTLE(t2[0],t2[1]) -#define t2low BIGLITTLE(t2[1],t2[0]) -#endif - - assert(dlen); - assert(nlen >= dlen); - - /* - * Special cases for short divisors. The general case uses the - * top top 2 digits of the divisor (d) to estimate a quotient digit, - * so it breaks if there are fewer digits available. Thus, we need - * special cases for a divisor of length 1. A divisor of length - * 2 can have a *lot* of administrivia overhead removed removed, - * so it's probably worth special-casing that case, too. - */ - if (dlen == 1) - return lbnDiv1_64(q, BIGLITTLE(n-1,n), n, nlen, - BIGLITTLE(d[-1],d[0])); - -#if 0 - /* - * @@@ This is not yet written... The general loop will do, - * albeit less efficiently - */ - if (dlen == 2) { - /* - * divisor two digits long: - * use the 3/2 technique from Knuth, but we know - * it's exact. - */ - dh = BIGLITTLE(d[-1],d[0]); - dl = BIGLITTLE(d[-2],d[1]); - shift = 0; - if ((sh & ((BNWORD64)1 << 64-1-shift)) == 0) { - do { - shift++; - } while (dh & (BNWORD64)1<<64-1-shift) == 0); - dh = dh << shift | dl >> (64-shift); - dl <<= shift; - - - } - - - for (shift = 0; (dh & (BNWORD64)1 << 64-1-shift)) == 0; shift++) - ; - if (shift) { - } - dh = dh << shift | dl >> (64-shift); - shift = 0; - while (dh - } -#endif - - dh = BIGLITTLE(*(d-dlen),*(d+(dlen-1))); - assert(dh); - - /* Normalize the divisor */ - shift = 0; - r = dh; - i = 64/2; - do { - if (r >> i) - r >>= i; - else - shift += i; - } while ((i /= 2) != 0); - - nh = 0; - if (shift) { - lbnLshift_64(d, dlen, shift); - dh = BIGLITTLE(*(d-dlen),*(d+(dlen-1))); - nh = lbnLshift_64(n, nlen, shift); - } - - /* Assert that dh is now normalized */ - assert(dh >> (64-1)); - - /* Also get the second-most significant word of the divisor */ - dl = BIGLITTLE(*(d-(dlen-1)),*(d+(dlen-2))); - - /* - * Adjust pointers: n to point to least significant end of first - * first subtract, and q to one the most-significant end of the - * quotient array. - */ - BIGLITTLE(n -= qlen,n += qlen); - BIGLITTLE(q -= qlen,q += qlen); - - /* Fetch the most significant stored word of the dividend */ - nm = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - - /* - * Compute the first digit of the quotient, based on the - * first two words of the dividend (the most significant of which - * is the overflow word h). - */ - if (nh) { - assert(nh < dh); - r = lbnDiv21_64(&qhat, nh, nm, dh); - } else if (nm >= dh) { - qhat = nm/dh; - r = nm % dh; - } else { /* Quotient is zero */ - qhigh = 0; - goto divloop; - } - - /* Now get the third most significant word of the dividend */ - nl = BIGLITTLE(*(n-(dlen-1)),*(n+(dlen-2))); - - /* - * Correct qhat, the estimate of quotient digit. - * qhat can only be high, and at most two words high, - * so the loop can be unrolled and abbreviated. - */ -#ifdef mul64_ppmm - mul64_ppmm(nm, t64, qhat, dl); - if (nm > r || (nm == r && t64 > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - nm -= (t64 < dl); - t64 -= dl; - if (nm > r || (nm == r && t64 > nl)) - qhat--; - } - } -#elif defined(BNWORD128) - t128 = (BNWORD128)qhat * dl; - if (t128 > ((BNWORD128)r << 64) + nl) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) > dh) { - t128 -= dl; - if (t128 > ((BNWORD128)r << 64) + nl) - qhat--; - } - } -#else /* Use lbnMulN1_64 */ - lbnMulN1_64(BIGLITTLE(t2+2,t2), &dl, 1, qhat); - if (t2high > r || (t2high == r && t2low > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t2high -= (t2low < dl); - t2low -= dl; - if (t2high > r || (t2high == r && t2low > nl)) - qhat--; - } - } -#endif - - /* Do the multiply and subtract */ - r = lbnMulSub1_64(n, d, dlen, qhat); - /* If there was a borrow, add back once. */ - if (r > nh) { /* Borrow? */ - (void)lbnAddN_64(n, d, dlen); - qhat--; - } - - /* Remember the first quotient digit. */ - qhigh = qhat; - - /* Now, the main division loop: */ -divloop: - while (qlen--) { - - /* Advance n */ - nh = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - BIGLITTLE(++n,--n); - nm = BIGLITTLE(*(n-dlen),*(n+(dlen-1))); - - if (nh == dh) { - qhat = ~(BNWORD64)0; - /* Optimized computation of r = (nh,nm) - qhat * dh */ - r = nh + nm; - if (r < nh) - goto subtract; - } else { - assert(nh < dh); - r = lbnDiv21_64(&qhat, nh, nm, dh); - } - - nl = BIGLITTLE(*(n-(dlen-1)),*(n+(dlen-2))); -#ifdef mul64_ppmm - mul64_ppmm(nm, t64, qhat, dl); - if (nm > r || (nm == r && t64 > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - nm -= (t64 < dl); - t64 -= dl; - if (nm > r || (nm == r && t64 > nl)) - qhat--; - } - } -#elif defined(BNWORD128) - t128 = (BNWORD128)qhat * dl; - if (t128 > ((BNWORD128)r<<64) + nl) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t128 -= dl; - if (t128 > ((BNWORD128)r << 64) + nl) - qhat--; - } - } -#else /* Use lbnMulN1_64 */ - lbnMulN1_64(BIGLITTLE(t2+2,t2), &dl, 1, qhat); - if (t2high > r || (t2high == r && t2low > nl)) { - /* Decrement qhat and adjust comparison parameters */ - qhat--; - if ((r += dh) >= dh) { - t2high -= (t2low < dl); - t2low -= dl; - if (t2high > r || (t2high == r && t2low > nl)) - qhat--; - } - } -#endif - - /* - * As a point of interest, note that it is not worth checking - * for qhat of 0 or 1 and installing special-case code. These - * occur with probability 2^-64, so spending 1 cycle to check - * for them is only worth it if we save more than 2^15 cycles, - * and a multiply-and-subtract for numbers in the 1024-bit - * range just doesn't take that long. - */ -subtract: - /* - * n points to the least significant end of the substring - * of n to be subtracted from. qhat is either exact or - * one too large. If the subtract gets a borrow, it was - * one too large and the divisor is added back in. It's - * a dlen+1 word add which is guaranteed to produce a - * carry out, so it can be done very simply. - */ - r = lbnMulSub1_64(n, d, dlen, qhat); - if (r > nh) { /* Borrow? */ - (void)lbnAddN_64(n, d, dlen); - qhat--; - } - /* Store the quotient digit */ - BIGLITTLE(*q++,*--q) = qhat; - } - /* Tah dah! */ - - if (shift) { - lbnRshift_64(d, dlen, shift); - lbnRshift_64(n, dlen, shift); - } - - return qhigh; -} -#endif - -/* - * Find the negative multiplicative inverse of x (x must be odd!) modulo 2^64. - * - * This just performs Newton's iteration until it gets the - * inverse. The initial estimate is always correct to 3 bits, and - * sometimes 4. The number of valid bits doubles each iteration. - * (To prove it, assume x * y == 1 (mod 2^n), and introduce a variable - * for the error mod 2^2n. x * y == 1 + k*2^n (mod 2^2n) and follow - * the iteration through.) - */ -#ifndef lbnMontInv1_64 -BNWORD64 -lbnMontInv1_64(BNWORD64 const x) -{ - BNWORD64 y = x, z; - - assert(x & 1); - - while ((z = x*y) != 1) - y *= 2 - z; - return -y; -} -#endif /* !lbnMontInv1_64 */ - -#if defined(BNWORD128) && PRODUCT_SCAN -/* - * Test code for product-scanning Montgomery reduction. - * This seems to slow the C code down rather than speed it up. - * - * The first loop computes the Montgomery multipliers, storing them over - * the low half of the number n. - * - * The second half multiplies the upper half, adding in the modulus - * times the Montgomery multipliers. The results of this multiply - * are stored. - */ -void -lbnMontReduce_64(BNWORD64 *n, BNWORD64 const *mod, unsigned mlen, BNWORD64 inv) -{ - BNWORD128 x, y; - BNWORD64 const *pm; - BNWORD64 *pn; - BNWORD64 t; - unsigned carry; - unsigned i, j; - - /* Special case of zero */ - if (!mlen) - return; - - /* Pass 1 - compute Montgomery multipliers */ - /* First iteration can have certain simplifications. */ - t = BIGLITTLE(n[-1],n[0]); - x = t; - t *= inv; - BIGLITTLE(n[-1], n[0]) = t; - x += (BNWORD128)t * BIGLITTLE(mod[-1],mod[0]); /* Can't overflow */ - assert((BNWORD64)x == 0); - x = x >> 64; - - for (i = 1; i < mlen; i++) { - carry = 0; - pn = n; - pm = BIGLITTLE(mod-i-1,mod+i+1); - for (j = 0; j < i; j++) { - y = (BNWORD128)BIGLITTLE(*--pn * *pm++, *pn++ * *--pm); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pn == n-i, pn == n+i)); - y = t = BIGLITTLE(pn[-1], pn[0]); - x += y; - carry += (x < y); - BIGLITTLE(pn[-1], pn[0]) = t = inv * (BNWORD64)x; - assert(BIGLITTLE(pm == mod-1, pm == mod+1)); - y = (BNWORD128)t * BIGLITTLE(pm[0],pm[-1]); - x += y; - carry += (x < y); - assert((BNWORD64)x == 0); - x = x >> 64 | (BNWORD128)carry << 64; - } - - BIGLITTLE(n -= mlen, n += mlen); - - /* Pass 2 - compute upper words and add to n */ - for (i = 1; i < mlen; i++) { - carry = 0; - pm = BIGLITTLE(mod-i,mod+i); - pn = n; - for (j = i; j < mlen; j++) { - y = (BNWORD128)BIGLITTLE(*--pm * *pn++, *pm++ * *--pn); - x += y; - carry += (x < y); - } - assert(BIGLITTLE(pm == mod-mlen, pm == mod+mlen)); - assert(BIGLITTLE(pn == n+mlen-i, pn == n-mlen+i)); - y = t = BIGLITTLE(*(n-i),*(n+i-1)); - x += y; - carry += (x < y); - BIGLITTLE(*(n-i),*(n+i-1)) = (BNWORD64)x; - x = (x >> 64) | (BNWORD128)carry << 64; - } - - /* Last round of second half, simplified. */ - t = BIGLITTLE(*(n-mlen),*(n+mlen-1)); - x += t; - BIGLITTLE(*(n-mlen),*(n+mlen-1)) = (BNWORD64)x; - carry = (unsigned)(x >> 64); - - while (carry) - carry -= lbnSubN_64(n, mod, mlen); - while (lbnCmp_64(n, mod, mlen) >= 0) - (void)lbnSubN_64(n, mod, mlen); -} -#define lbnMontReduce_64 lbnMontReduce_64 -#endif - -/* - * Montgomery reduce n, modulo mod. This reduces modulo mod and divides by - * 2^(64*mlen). Returns the result in the *top* mlen words of the argument n. - * This is ready for another multiplication using lbnMul_64. - * - * Montgomery representation is a very useful way to encode numbers when - * you're doing lots of modular reduction. What you do is pick a multiplier - * R which is relatively prime to the modulus and very easy to divide by. - * Since the modulus is odd, R is closen as a power of 2, so the division - * is a shift. In fact, it's a shift of an integral number of words, - * so the shift can be implicit - just drop the low-order words. - * - * Now, choose R *larger* than the modulus m, 2^(64*mlen). Then convert - * all numbers a, b, etc. to Montgomery form M(a), M(b), etc using the - * relationship M(a) = a*R mod m, M(b) = b*R mod m, etc. Note that: - * - The Montgomery form of a number depends on the modulus m. - * A fixed modulus m is assumed throughout this discussion. - * - Since R is relaitvely prime to m, multiplication by R is invertible; - * no information about the numbers is lost, they're just scrambled. - * - Adding (and subtracting) numbers in this form works just as usual. - * M(a+b) = (a+b)*R mod m = (a*R + b*R) mod m = (M(a) + M(b)) mod m - * - Multiplying numbers in this form produces a*b*R*R. The problem - * is to divide out the excess factor of R, modulo m as well as to - * reduce to the given length mlen. It turns out that this can be - * done *faster* than a normal divide, which is where the speedup - * in Montgomery division comes from. - * - * Normal reduction chooses a most-significant quotient digit q and then - * subtracts q*m from the number to be reduced. Choosing q is tricky - * and involved (just look at lbnDiv_64 to see!) and is usually - * imperfect, requiring a check for correction after the subtraction. - * - * Montgomery reduction *adds* a multiple of m to the *low-order* part - * of the number to be reduced. This multiple is chosen to make the - * low-order part of the number come out to zero. This can be done - * with no trickery or error using a precomputed inverse of the modulus. - * In this code, the "part" is one word, but any width can be used. - * - * Repeating this step sufficiently often results in a value which - * is a multiple of R (a power of two, remember) but is still (since - * the additions were to the low-order part and thus did not increase - * the value of the number being reduced very much) still not much - * larger than m*R. Then implicitly divide by R and subtract off - * m until the result is in the correct range. - * - * Since the low-order part being cancelled is less than R, the - * multiple of m added must have a multiplier which is at most R-1. - * Assuming that the input is at most m*R-1, the final number is - * at most m*(2*R-1)-1 = 2*m*R - m - 1, so subtracting m once from - * the high-order part, equivalent to subtracting m*R from the - * while number, produces a result which is at most m*R - m - 1, - * which divided by R is at most m-1. - * - * To convert *to* Montgomery form, you need a regular remainder - * routine, although you can just compute R*R (mod m) and do the - * conversion using Montgomery multiplication. To convert *from* - * Montgomery form, just Montgomery reduce the number to - * remove the extra factor of R. - * - * TODO: Change to a full inverse and use Karatsuba's multiplication - * rather than this word-at-a-time. - */ -#ifndef lbnMontReduce_64 -void -lbnMontReduce_64(BNWORD64 *n, BNWORD64 const *mod, unsigned const mlen, - BNWORD64 inv) -{ - BNWORD64 t; - BNWORD64 c = 0; - unsigned len = mlen; - - /* inv must be the negative inverse of mod's least significant word */ - assert((BNWORD64)(inv * BIGLITTLE(mod[-1],mod[0])) == (BNWORD64)-1); - - assert(len); - - do { - t = lbnMulAdd1_64(n, mod, mlen, inv * BIGLITTLE(n[-1],n[0])); - c += lbnAdd1_64(BIGLITTLE(n-mlen,n+mlen), len, t); - BIGLITTLE(--n,++n); - } while (--len); - - /* - * All that adding can cause an overflow past the modulus size, - * but it's unusual, and never by much, so a subtraction loop - * is the right way to deal with it. - * This subtraction happens infrequently - I've only ever seen it - * invoked once per reduction, and then just under 22.5% of the time. - */ - while (c) - c -= lbnSubN_64(n, mod, mlen); - while (lbnCmp_64(n, mod, mlen) >= 0) - (void)lbnSubN_64(n, mod, mlen); -} -#endif /* !lbnMontReduce_64 */ - -/* - * A couple of helpers that you might want to implement atomically - * in asm sometime. - */ -#ifndef lbnMontMul_64 -/* - * Multiply "num1" by "num2", modulo "mod", all of length "len", and - * place the result in the high half of "prod". "inv" is the inverse - * of the least-significant word of the modulus, modulo 2^64. - * This uses numbers in Montgomery form. Reduce using "len" and "inv". - * - * This is implemented as a macro to win on compilers that don't do - * inlining, since it's so trivial. - */ -#define lbnMontMul_64(prod, n1, n2, mod, len, inv) \ - (lbnMulX_64(prod, n1, n2, len), lbnMontReduce_64(prod, mod, len, inv)) -#endif /* !lbnMontMul_64 */ - -#ifndef lbnMontSquare_64 -/* - * Square "n", modulo "mod", both of length "len", and place the result - * in the high half of "prod". "inv" is the inverse of the least-significant - * word of the modulus, modulo 2^64. - * This uses numbers in Montgomery form. Reduce using "len" and "inv". - * - * This is implemented as a macro to win on compilers that don't do - * inlining, since it's so trivial. - */ -#define lbnMontSquare_64(prod, n, mod, len, inv) \ - (lbnSquare_64(prod, n, len), lbnMontReduce_64(prod, mod, len, inv)) - -#endif /* !lbnMontSquare_64 */ - -/* - * Convert a number to Montgomery form - requires mlen + nlen words - * of memory in "n". - */ -void -lbnToMont_64(BNWORD64 *n, unsigned nlen, BNWORD64 *mod, unsigned mlen) -{ - /* Move n up "mlen" words */ - lbnCopy_64(BIGLITTLE(n-mlen,n+mlen), n, nlen); - lbnZero_64(n, mlen); - /* Do the division - dump the quotient in the high-order words */ - (void)lbnDiv_64(BIGLITTLE(n-mlen,n+mlen), n, mlen+nlen, mod, mlen); -} - -/* - * Convert from Montgomery form. Montgomery reduction is all that is - * needed. - */ -void -lbnFromMont_64(BNWORD64 *n, BNWORD64 *mod, unsigned len) -{ - /* Zero the high words of n */ - lbnZero_64(BIGLITTLE(n-len,n+len), len); - lbnMontReduce_64(n, mod, len, lbnMontInv1_64(mod[BIGLITTLE(-1,0)])); - /* Move n down len words */ - lbnCopy_64(n, BIGLITTLE(n-len,n+len), len); -} - -/* - * The windowed exponentiation algorithm, precomputes a table of odd - * powers of n up to 2^k. See the comment in bnExpMod_64 below for - * an explanation of how it actually works works. - * - * It takes 2^(k-1)-1 multiplies to compute the table, and (e-1)/(k+1) - * multiplies (on average) to perform the exponentiation. To minimize - * the sum, k must vary with e. The optimal window sizes vary with the - * exponent length. Here are some selected values and the boundary cases. - * (An underscore _ has been inserted into some of the numbers to ensure - * that magic strings like 64 do not appear in this table. It should be - * ignored.) - * - * At e = 1 bits, k=1 (0.000000) is best - * At e = 2 bits, k=1 (0.500000) is best - * At e = 4 bits, k=1 (1.500000) is best - * At e = 8 bits, k=2 (3.333333) < k=1 (3.500000) - * At e = 1_6 bits, k=2 (6.000000) is best - * At e = 26 bits, k=3 (9.250000) < k=2 (9.333333) - * At e = 3_2 bits, k=3 (10.750000) is best - * At e = 6_4 bits, k=3 (18.750000) is best - * At e = 82 bits, k=4 (23.200000) < k=3 (23.250000) - * At e = 128 bits, k=4 (3_2.400000) is best - * At e = 242 bits, k=5 (55.1_66667) < k=4 (55.200000) - * At e = 256 bits, k=5 (57.500000) is best - * At e = 512 bits, k=5 (100.1_66667) is best - * At e = 674 bits, k=6 (127.142857) < k=5 (127.1_66667) - * At e = 1024 bits, k=6 (177.142857) is best - * At e = 1794 bits, k=7 (287.125000) < k=6 (287.142857) - * At e = 2048 bits, k=7 (318.875000) is best - * At e = 4096 bits, k=7 (574.875000) is best - * - * The numbers in parentheses are the expected number of multiplications - * needed to do the computation. The normal russian-peasant modular - * exponentiation technique always uses (e-1)/2. For exponents as - * small as 192 bits (below the range of current factoring algorithms), - * half of the multiplies are eliminated, 45.2 as opposed to the naive - * 95.5. Counting the 191 squarings as 3/4 a multiply each (squaring - * proper is just over half of multiplying, but the Montgomery - * reduction in each case is also a multiply), that's 143.25 - * multiplies, for totals of 188.45 vs. 238.75 - a 21% savings. - * For larger exponents (like 512 bits), it's 483.92 vs. 639.25, a - * 24.3% savings. It asymptotically approaches 25%. - * - * Um, actually there's a slightly more accurate way to count, which - * really is the average number of multiplies required, averaged - * uniformly over all 2^(e-1) e-bit numbers, from 2^(e-1) to (2^e)-1. - * It's based on the recurrence that for the last b bits, b <= k, at - * most one multiply is needed (and none at all 1/2^b of the time), - * while when b > k, the odds are 1/2 each way that the bit will be - * 0 (meaning no multiplies to reduce it to the b-1-bit case) and - * 1/2 that the bit will be 1, starting a k-bit window and requiring - * 1 multiply beyond the b-k-bit case. Since the most significant - * bit is always 1, a k-bit window always starts there, and that - * multiply is by 1, so it isn't a multiply at all. Thus, the - * number of multiplies is simply that needed for the last e-k bits. - * This recurrence produces: - * - * At e = 1 bits, k=1 (0.000000) is best - * At e = 2 bits, k=1 (0.500000) is best - * At e = 4 bits, k=1 (1.500000) is best - * At e = 6 bits, k=2 (2.437500) < k=1 (2.500000) - * At e = 8 bits, k=2 (3.109375) is best - * At e = 1_6 bits, k=2 (5.777771) is best - * At e = 24 bits, k=3 (8.437629) < k=2 (8.444444) - * At e = 3_2 bits, k=3 (10.437492) is best - * At e = 6_4 bits, k=3 (18.437500) is best - * At e = 81 bits, k=4 (22.6_40000) < k=3 (22.687500) - * At e = 128 bits, k=4 (3_2.040000) is best - * At e = 241 bits, k=5 (54.611111) < k=4 (54.6_40000) - * At e = 256 bits, k=5 (57.111111) is best - * At e = 512 bits, k=5 (99.777778) is best - * At e = 673 bits, k=6 (126.591837) < k=5 (126.611111) - * At e = 1024 bits, k=6 (176.734694) is best - * At e = 1793 bits, k=7 (286.578125) < k=6 (286.591837) - * At e = 2048 bits, k=7 (318.453125) is best - * At e = 4096 bits, k=7 (574.453125) is best - * - * This has the rollover points at 6, 24, 81, 241, 673 and 1793 instead - * of 8, 26, 82, 242, 674, and 1794. Not a very big difference. - * (The numbers past that are k=8 at 4609 and k=9 at 11521, - * vs. one more in each case for the approximation.) - * - * Given that exponents for which k>7 are useful are uncommon, - * a fixed size table for k <= 7 is used for simplicity. - * - * The basic number of squarings needed is e-1, although a k-bit - * window (for k > 1) can save, on average, k-2 of those, too. - * That savings currently isn't counted here. It would drive the - * crossover points slightly lower. - * (Actually, this win is also reduced in the DoubleExpMod case, - * meaning we'd have to split the tables. Except for that, the - * multiplies by powers of the two bases are independent, so - * the same logic applies to each as the single case.) - * - * Table entry i is the largest number of bits in an exponent to - * process with a window size of i+1. Entry 6 is the largest - * possible unsigned number, so the window will never be more - * than 7 bits, requiring 2^6 = 0x40 slots. - */ -#define BNEXPMOD_MAX_WINDOW 7 -static unsigned const bnExpModThreshTable[BNEXPMOD_MAX_WINDOW] = { - 5, 23, 80, 240, 672, 1792, (unsigned)-1 -/* 7, 25, 81, 241, 673, 1793, (unsigned)-1 ### The old approximations */ -}; - -/* - * Perform modular exponentiation, as fast as possible! This uses - * Montgomery reduction, optimized squaring, and windowed exponentiation. - * The modulus "mod" MUST be odd! - * - * This returns 0 on success, -1 on out of memory. - * - * The window algorithm: - * The idea is to keep a running product of b1 = n^(high-order bits of exp), - * and then keep appending exponent bits to it. The following patterns - * apply to a 3-bit window (k = 3): - * To append 0: square - * To append 1: square, multiply by n^1 - * To append 10: square, multiply by n^1, square - * To append 11: square, square, multiply by n^3 - * To append 100: square, multiply by n^1, square, square - * To append 101: square, square, square, multiply by n^5 - * To append 110: square, square, multiply by n^3, square - * To append 111: square, square, square, multiply by n^7 - * - * Since each pattern involves only one multiply, the longer the pattern - * the better, except that a 0 (no multiplies) can be appended directly. - * We precompute a table of odd powers of n, up to 2^k, and can then - * multiply k bits of exponent at a time. Actually, assuming random - * exponents, there is on average one zero bit between needs to - * multiply (1/2 of the time there's none, 1/4 of the time there's 1, - * 1/8 of the time, there's 2, 1/64 of the time, there's 3, etc.), so - * you have to do one multiply per k+1 bits of exponent. - * - * The loop walks down the exponent, squaring the result buffer as - * it goes. There is a wbits+1 bit lookahead buffer, buf, that is - * filled with the upcoming exponent bits. (What is read after the - * end of the exponent is unimportant, but it is filled with zero here.) - * When the most-significant bit of this buffer becomes set, i.e. - * (buf & tblmask) != 0, we have to decide what pattern to multiply - * by, and when to do it. We decide, remember to do it in future - * after a suitable number of squarings have passed (e.g. a pattern - * of "100" in the buffer requires that we multiply by n^1 immediately; - * a pattern of "110" calls for multiplying by n^3 after one more - * squaring), clear the buffer, and continue. - * - * When we start, there is one more optimization: the result buffer - * is implcitly one, so squaring it or multiplying by it can be - * optimized away. Further, if we start with a pattern like "100" - * in the lookahead window, rather than placing n into the buffer - * and then starting to square it, we have already computed n^2 - * to compute the odd-powers table, so we can place that into - * the buffer and save a squaring. - * - * This means that if you have a k-bit window, to compute n^z, - * where z is the high k bits of the exponent, 1/2 of the time - * it requires no squarings. 1/4 of the time, it requires 1 - * squaring, ... 1/2^(k-1) of the time, it reqires k-2 squarings. - * And the remaining 1/2^(k-1) of the time, the top k bits are a - * 1 followed by k-1 0 bits, so it again only requires k-2 - * squarings, not k-1. The average of these is 1. Add that - * to the one squaring we have to do to compute the table, - * and you'll see that a k-bit window saves k-2 squarings - * as well as reducing the multiplies. (It actually doesn't - * hurt in the case k = 1, either.) - * - * n must have mlen words allocated. Although fewer may be in use - * when n is passed in, all are in use on exit. - */ -int -lbnExpMod_64(BNWORD64 *result, BNWORD64 const *n, unsigned nlen, - BNWORD64 const *e, unsigned elen, BNWORD64 *mod, unsigned mlen) -{ - BNWORD64 *table[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n */ - unsigned ebits; /* Exponent bits */ - unsigned wbits; /* Window size */ - unsigned tblmask; /* Mask of exponentiation window */ - BNWORD64 bitpos; /* Mask of current look-ahead bit */ - unsigned buf; /* Buffer of exponent bits */ - unsigned multpos; /* Where to do pending multiply */ - BNWORD64 const *mult; /* What to multiply by */ - unsigned i; /* Loop counter */ - int isone; /* Flag: accum. is implicitly one */ - BNWORD64 *a, *b; /* Working buffers/accumulators */ - BNWORD64 *t; /* Pointer into the working buffers */ - BNWORD64 inv; /* mod^-1 modulo 2^64 */ - int y; /* bnYield() result */ - - assert(mlen); - assert(nlen <= mlen); - - /* First, a couple of trivial cases. */ - elen = lbnNorm_64(e, elen); - if (!elen) { - /* x ^ 0 == 1 */ - lbnZero_64(result, mlen); - BIGLITTLE(result[-1],result[0]) = 1; - return 0; - } - ebits = lbnBits_64(e, elen); - if (ebits == 1) { - /* x ^ 1 == x */ - if (n != result) - lbnCopy_64(result, n, nlen); - if (mlen > nlen) - lbnZero_64(BIGLITTLE(result-nlen,result+nlen), - mlen-nlen); - return 0; - } - - /* Okay, now move the exponent pointer to the most-significant word */ - e = BIGLITTLE(e-elen, e+elen-1); - - /* Look up appropriate k-1 for the exponent - tblmask = 1<<(k-1) */ - wbits = 0; - while (ebits > bnExpModThreshTable[wbits]) - wbits++; - - /* Allocate working storage: two product buffers and the tables. */ - LBNALLOC(a, BNWORD64, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD64, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert to the appropriate table size: tblmask = 1<<(k-1) */ - tblmask = 1u << wbits; - - /* We have the result buffer available, so use it. */ - table[0] = result; - - /* - * Okay, we now have a minimal-sized table - expand it. - * This is allowed to fail! If so, scale back the table size - * and proceed. - */ - for (i = 1; i < tblmask; i++) { - LBNALLOC(t, BNWORD64, mlen); - if (!t) /* Out of memory! Quit the loop. */ - break; - table[i] = t; - } - - /* If we stopped, with i < tblmask, shrink the tables appropriately */ - while (tblmask > i) { - wbits--; - tblmask >>= 1; - } - /* Free up our overallocations */ - while (--i > tblmask) - LBNFREE(table[i], mlen); - - /* Okay, fill in the table */ - - /* Compute the necessary modular inverse */ - inv = lbnMontInv1_64(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - /* Convert n to Montgomery form */ - - /* Move n up "mlen" words into a */ - t = BIGLITTLE(a-mlen, a+mlen); - lbnCopy_64(t, n, nlen); - lbnZero_64(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_64(t, a, mlen+nlen, mod, mlen); - /* Copy into first table entry */ - lbnCopy_64(table[0], a, mlen); - - /* Square a into b */ - lbnMontSquare_64(b, a, mod, mlen, inv); - - /* Use high half of b to initialize the table */ - t = BIGLITTLE(b-mlen, b+mlen); - for (i = 1; i < tblmask; i++) { - lbnMontMul_64(a, t, table[i-1], mod, mlen, inv); - lbnCopy_64(table[i], BIGLITTLE(a-mlen, a+mlen), mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* We might use b = n^2 later... */ - - /* Initialze the fetch pointer */ - bitpos = (BNWORD64)1 << ((ebits-1) & (64-1)); /* Initialize mask */ - - /* This should point to the msbit of e */ - assert((*e & bitpos) != 0); - - /* - * Pre-load the window. Becuase the window size is - * never larger than the exponent size, there is no need to - * detect running off the end of e in here. - * - * The read-ahead is controlled by elen and the bitpos mask. - * Note that this is *ahead* of ebits, which tracks the - * most significant end of the window. The purpose of this - * initialization is to get the two wbits+1 bits apart, - * like they should be. - * - * Note that bitpos and e1len together keep track of the - * lookahead read pointer in the exponent that is used here. - */ - buf = 0; - for (i = 0; i <= wbits; i++) { - buf = (buf << 1) | ((*e & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e++,e--); - bitpos = (BNWORD64)1 << (64-1); - elen--; - } - } - assert(buf & tblmask); - - /* - * Set the pending multiply positions to a location that will - * never be encountered, thus ensuring that nothing will happen - * until the need for a multiply appears and one is scheduled. - */ - multpos = ebits; /* A NULL value */ - mult = 0; /* Force a crash if we use these */ - - /* - * Okay, now begins the real work. The first step is - * slightly magic, so it's done outside the main loop, - * but it's very similar to what's inside. - */ - ebits--; /* Start processing the first bit... */ - isone = 1; - - /* - * This is just like the multiply in the loop, except that - * - We know the msbit of buf is set, and - * - We have the extra value n^2 floating around. - * So, do the usual computation, and if the result is that - * the buffer should be multiplied by n^1 immediately - * (which we'd normally then square), we multiply it - * (which reduces to a copy, which reduces to setting a flag) - * by n^2 and skip the squaring. Thus, we do the - * multiply and the squaring in one step. - */ - assert(buf & tblmask); - multpos = ebits - wbits; - while ((buf & 1) == 0) { - buf >>= 1; - multpos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(multpos <= ebits); - mult = table[buf>>1]; - buf = 0; - - /* Special case: use already-computed value sitting in buffer */ - if (multpos == ebits) - isone = 0; - - /* - * At this point, the buffer (which is the high half of b) holds - * either 1 (implicitly, as the "isone" flag is set), or n^2. - */ - - /* - * The main loop. The procedure is: - * - Advance the window - * - If the most-significant bit of the window is set, - * schedule a multiply for the appropriate time in the - * future (may be immediately) - * - Perform any pending multiples - * - Check for termination - * - Square the buffer - * - * At any given time, the acumulated product is held in - * the high half of b. - */ - for (;;) { - ebits--; - - /* Advance the window */ - assert(buf < tblmask); - buf <<= 1; - /* - * This reads ahead of the current exponent position - * (controlled by ebits), so we have to be able to read - * past the lsb of the exponents without error. - */ - if (elen) { - buf |= ((*e & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e++,e--); - bitpos = (BNWORD64)1 << (64-1); - elen--; - } - } - - /* Examine the window for pending multiplies */ - if (buf & tblmask) { - multpos = ebits - wbits; - while ((buf & 1) == 0) { - buf >>= 1; - multpos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(multpos <= ebits); - mult = table[buf>>1]; - buf = 0; - } - - /* If we have a pending multiply, do it */ - if (ebits == multpos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_64(t, mult, mlen); - isone = 0; - } else { - lbnMontMul_64(a, t, mult, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* Are we done? */ - if (!ebits) - break; - - /* Square the input */ - if (!isone) { - t = BIGLITTLE(b-mlen, b+mlen); - lbnMontSquare_64(a, t, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } /* for (;;) */ - - assert(!isone); - assert(!buf); - - /* DONE! */ - - /* Convert result out of Montgomery form */ - t = BIGLITTLE(b-mlen, b+mlen); - lbnCopy_64(b, t, mlen); - lbnZero_64(t, mlen); - lbnMontReduce_64(b, mod, mlen, inv); - lbnCopy_64(result, t, mlen); - /* - * Clean up - free intermediate storage. - * Do NOT free table[0], which is the result - * buffer. - */ - y = 0; -#if BNYIELD -yield: -#endif - while (--tblmask) - LBNFREE(table[tblmask], mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - -/* - * Compute and return n1^e1 * n2^e2 mod "mod". - * result may be either input buffer, or something separate. - * It must be "mlen" words long. - * - * There is a current position in the exponents, which is kept in e1bits. - * (The exponents are swapped if necessary so e1 is the longer of the two.) - * At any given time, the value in the accumulator is - * n1^(e1>>e1bits) * n2^(e2>>e1bits) mod "mod". - * As e1bits is counted down, this is updated, by squaring it and doing - * any necessary multiplies. - * To decide on the necessary multiplies, two windows, each w1bits+1 bits - * wide, are maintained in buf1 and buf2, which read *ahead* of the - * e1bits position (with appropriate handling of the case when e1bits - * drops below w1bits+1). When the most-significant bit of either window - * becomes set, indicating that something needs to be multiplied by - * the accumulator or it will get out of sync, the window is examined - * to see which power of n1 or n2 to multiply by, and when (possibly - * later, if the power is greater than 1) the multiply should take - * place. Then the multiply and its location are remembered and the - * window is cleared. - * - * If we had every power of n1 in the table, the multiply would always - * be w1bits steps in the future. But we only keep the odd powers, - * so instead of waiting w1bits squarings and then multiplying - * by n1^k, we wait w1bits-k squarings and multiply by n1. - * - * Actually, w2bits can be less than w1bits, but the window is the same - * size, to make it easier to keep track of where we're reading. The - * appropriate number of low-order bits of the window are just ignored. - */ -int -lbnDoubleExpMod_64(BNWORD64 *result, - BNWORD64 const *n1, unsigned n1len, - BNWORD64 const *e1, unsigned e1len, - BNWORD64 const *n2, unsigned n2len, - BNWORD64 const *e2, unsigned e2len, - BNWORD64 *mod, unsigned mlen) -{ - BNWORD64 *table1[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n1 */ - BNWORD64 *table2[1 << (BNEXPMOD_MAX_WINDOW-1)]; - /* Table of odd powers of n2 */ - unsigned e1bits, e2bits; /* Exponent bits */ - unsigned w1bits, w2bits; /* Window sizes */ - unsigned tblmask; /* Mask of exponentiation window */ - BNWORD64 bitpos; /* Mask of current look-ahead bit */ - unsigned buf1, buf2; /* Buffer of exponent bits */ - unsigned mult1pos, mult2pos; /* Where to do pending multiply */ - BNWORD64 const *mult1, *mult2; /* What to multiply by */ - unsigned i; /* Loop counter */ - int isone; /* Flag: accum. is implicitly one */ - BNWORD64 *a, *b; /* Working buffers/accumulators */ - BNWORD64 *t; /* Pointer into the working buffers */ - BNWORD64 inv; /* mod^-1 modulo 2^64 */ - int y; /* bnYield() result */ - - assert(mlen); - assert(n1len <= mlen); - assert(n2len <= mlen); - - /* First, a couple of trivial cases. */ - e1len = lbnNorm_64(e1, e1len); - e2len = lbnNorm_64(e2, e2len); - - /* Ensure that the first exponent is the longer */ - e1bits = lbnBits_64(e1, e1len); - e2bits = lbnBits_64(e2, e2len); - if (e1bits < e2bits) { - i = e1len; e1len = e2len; e2len = i; - i = e1bits; e1bits = e2bits; e2bits = i; - t = (BNWORD64 *)n1; n1 = n2; n2 = t; - t = (BNWORD64 *)e1; e1 = e2; e2 = t; - } - assert(e1bits >= e2bits); - - /* Handle a trivial case */ - if (!e2len) - return lbnExpMod_64(result, n1, n1len, e1, e1len, mod, mlen); - assert(e2bits); - - /* The code below fucks up if the exponents aren't at least 2 bits */ - if (e1bits == 1) { - assert(e2bits == 1); - - LBNALLOC(a, BNWORD64, n1len+n2len); - if (!a) - return -1; - - lbnMul_64(a, n1, n1len, n2, n2len); - /* Do a direct modular reduction */ - if (n1len + n2len >= mlen) - (void)lbnDiv_64(a+mlen, a, n1len+n2len, mod, mlen); - lbnCopy_64(result, a, mlen); - LBNFREE(a, n1len+n2len); - return 0; - } - - /* Okay, now move the exponent pointers to the most-significant word */ - e1 = BIGLITTLE(e1-e1len, e1+e1len-1); - e2 = BIGLITTLE(e2-e2len, e2+e2len-1); - - /* Look up appropriate k-1 for the exponent - tblmask = 1<<(k-1) */ - w1bits = 0; - while (e1bits > bnExpModThreshTable[w1bits]) - w1bits++; - w2bits = 0; - while (e2bits > bnExpModThreshTable[w2bits]) - w2bits++; - - assert(w1bits >= w2bits); - - /* Allocate working storage: two product buffers and the tables. */ - LBNALLOC(a, BNWORD64, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD64, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert to the appropriate table size: tblmask = 1<<(k-1) */ - tblmask = 1u << w1bits; - /* Use buf2 for its size, temporarily */ - buf2 = 1u << w2bits; - - LBNALLOC(t, BNWORD64, mlen); - if (!t) { - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - return -1; - } - table1[0] = t; - table2[0] = result; - - /* - * Okay, we now have some minimal-sized tables - expand them. - * This is allowed to fail! If so, scale back the table sizes - * and proceed. We allocate both tables at the same time - * so if it fails partway through, they'll both be a reasonable - * size rather than one huge and one tiny. - * When i passes buf2 (the number of entries in the e2 window, - * which may be less than the number of entries in the e1 window), - * stop allocating e2 space. - */ - for (i = 1; i < tblmask; i++) { - LBNALLOC(t, BNWORD64, mlen); - if (!t) /* Out of memory! Quit the loop. */ - break; - table1[i] = t; - if (i < buf2) { - LBNALLOC(t, BNWORD64, mlen); - if (!t) { - LBNFREE(table1[i], mlen); - break; - } - table2[i] = t; - } - } - - /* If we stopped, with i < tblmask, shrink the tables appropriately */ - while (tblmask > i) { - w1bits--; - tblmask >>= 1; - } - /* Free up our overallocations */ - while (--i > tblmask) { - if (i < buf2) - LBNFREE(table2[i], mlen); - LBNFREE(table1[i], mlen); - } - /* And shrink the second window too, if needed */ - if (w2bits > w1bits) { - w2bits = w1bits; - buf2 = tblmask; - } - - /* - * From now on, use the w2bits variable for the difference - * between w1bits and w2bits. - */ - w2bits = w1bits-w2bits; - - /* Okay, fill in the tables */ - - /* Compute the necessary modular inverse */ - inv = lbnMontInv1_64(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - /* Convert n1 to Montgomery form */ - - /* Move n1 up "mlen" words into a */ - t = BIGLITTLE(a-mlen, a+mlen); - lbnCopy_64(t, n1, n1len); - lbnZero_64(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_64(t, a, mlen+n1len, mod, mlen); - /* Copy into first table entry */ - lbnCopy_64(table1[0], a, mlen); - - /* Square a into b */ - lbnMontSquare_64(b, a, mod, mlen, inv); - - /* Use high half of b to initialize the first table */ - t = BIGLITTLE(b-mlen, b+mlen); - for (i = 1; i < tblmask; i++) { - lbnMontMul_64(a, t, table1[i-1], mod, mlen, inv); - lbnCopy_64(table1[i], BIGLITTLE(a-mlen, a+mlen), mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* Convert n2 to Montgomery form */ - - t = BIGLITTLE(a-mlen, a+mlen); - /* Move n2 up "mlen" words into a */ - lbnCopy_64(t, n2, n2len); - lbnZero_64(a, mlen); - /* Do the division - lose the quotient into the high-order words */ - (void)lbnDiv_64(t, a, mlen+n2len, mod, mlen); - /* Copy into first table entry */ - lbnCopy_64(table2[0], a, mlen); - - /* Square it into a */ - lbnMontSquare_64(a, table2[0], mod, mlen, inv); - /* Copy to b, low half */ - lbnCopy_64(b, t, mlen); - - /* Use b to initialize the second table */ - for (i = 1; i < buf2; i++) { - lbnMontMul_64(a, b, table2[i-1], mod, mlen, inv); - lbnCopy_64(table2[i], t, mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* - * Okay, a recap: at this point, the low part of b holds - * n2^2, the high part holds n1^2, and the tables are - * initialized with the odd powers of n1 and n2 from 1 - * through 2*tblmask-1 and 2*buf2-1. - * - * We might use those squares in b later, or we might not. - */ - - /* Initialze the fetch pointer */ - bitpos = (BNWORD64)1 << ((e1bits-1) & (64-1)); /* Initialize mask */ - - /* This should point to the msbit of e1 */ - assert((*e1 & bitpos) != 0); - - /* - * Pre-load the windows. Becuase the window size is - * never larger than the exponent size, there is no need to - * detect running off the end of e1 in here. - * - * The read-ahead is controlled by e1len and the bitpos mask. - * Note that this is *ahead* of e1bits, which tracks the - * most significant end of the window. The purpose of this - * initialization is to get the two w1bits+1 bits apart, - * like they should be. - * - * Note that bitpos and e1len together keep track of the - * lookahead read pointer in the exponent that is used here. - * e2len is not decremented, it is only ever compared with - * e1len as *that* is decremented. - */ - buf1 = buf2 = 0; - for (i = 0; i <= w1bits; i++) { - buf1 = (buf1 << 1) | ((*e1 & bitpos) != 0); - if (e1len <= e2len) - buf2 = (buf2 << 1) | ((*e2 & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e1++,e1--); - if (e1len <= e2len) - BIGLITTLE(e2++,e2--); - bitpos = (BNWORD64)1 << (64-1); - e1len--; - } - } - assert(buf1 & tblmask); - - /* - * Set the pending multiply positions to a location that will - * never be encountered, thus ensuring that nothing will happen - * until the need for a multiply appears and one is scheduled. - */ - mult1pos = mult2pos = e1bits; /* A NULL value */ - mult1 = mult2 = 0; /* Force a crash if we use these */ - - /* - * Okay, now begins the real work. The first step is - * slightly magic, so it's done outside the main loop, - * but it's very similar to what's inside. - */ - isone = 1; /* Buffer is implicitly 1, so replace * by copy */ - e1bits--; /* Start processing the first bit... */ - - /* - * This is just like the multiply in the loop, except that - * - We know the msbit of buf1 is set, and - * - We have the extra value n1^2 floating around. - * So, do the usual computation, and if the result is that - * the buffer should be multiplied by n1^1 immediately - * (which we'd normally then square), we multiply it - * (which reduces to a copy, which reduces to setting a flag) - * by n1^2 and skip the squaring. Thus, we do the - * multiply and the squaring in one step. - */ - assert(buf1 & tblmask); - mult1pos = e1bits - w1bits; - while ((buf1 & 1) == 0) { - buf1 >>= 1; - mult1pos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(mult1pos <= e1bits); - mult1 = table1[buf1>>1]; - buf1 = 0; - - /* Special case: use already-computed value sitting in buffer */ - if (mult1pos == e1bits) - isone = 0; - - /* - * The first multiply by a power of n2. Similar, but - * we might not even want to schedule a multiply if e2 is - * shorter than e1, and the window might be shorter so - * we have to leave the low w2bits bits alone. - */ - if (buf2 & tblmask) { - /* Remember low-order bits for later */ - i = buf2 & ((1u << w2bits) - 1); - buf2 >>= w2bits; - mult2pos = e1bits - w1bits + w2bits; - while ((buf2 & 1) == 0) { - buf2 >>= 1; - mult2pos++; - } - assert(mult2pos <= e1bits); - mult2 = table2[buf2>>1]; - buf2 = i; - - if (mult2pos == e1bits) { - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - lbnCopy_64(t, b, mlen); /* Copy low to high */ - isone = 0; - } else { - lbnMontMul_64(a, t, b, mod, mlen, inv); - t = a; a = b; b = t; - } - } - } - - /* - * At this point, the buffer (which is the high half of b) - * holds either 1 (implicitly, as the "isone" flag is set), - * n1^2, n2^2 or n1^2 * n2^2. - */ - - /* - * The main loop. The procedure is: - * - Advance the windows - * - If the most-significant bit of a window is set, - * schedule a multiply for the appropriate time in the - * future (may be immediately) - * - Perform any pending multiples - * - Check for termination - * - Square the buffers - * - * At any given time, the acumulated product is held in - * the high half of b. - */ - for (;;) { - e1bits--; - - /* Advance the windows */ - assert(buf1 < tblmask); - buf1 <<= 1; - assert(buf2 < tblmask); - buf2 <<= 1; - /* - * This reads ahead of the current exponent position - * (controlled by e1bits), so we have to be able to read - * past the lsb of the exponents without error. - */ - if (e1len) { - buf1 |= ((*e1 & bitpos) != 0); - if (e1len <= e2len) - buf2 |= ((*e2 & bitpos) != 0); - bitpos >>= 1; - if (!bitpos) { - BIGLITTLE(e1++,e1--); - if (e1len <= e2len) - BIGLITTLE(e2++,e2--); - bitpos = (BNWORD64)1 << (64-1); - e1len--; - } - } - - /* Examine the first window for pending multiplies */ - if (buf1 & tblmask) { - mult1pos = e1bits - w1bits; - while ((buf1 & 1) == 0) { - buf1 >>= 1; - mult1pos++; - } - /* Intermediates can wrap, but final must NOT */ - assert(mult1pos <= e1bits); - mult1 = table1[buf1>>1]; - buf1 = 0; - } - - /* - * Examine the second window for pending multiplies. - * Window 2 can be smaller than window 1, but we - * keep the same number of bits in buf2, so we need - * to ignore any low-order bits in the buffer when - * computing what to multiply by, and recompute them - * later. - */ - if (buf2 & tblmask) { - /* Remember low-order bits for later */ - i = buf2 & ((1u << w2bits) - 1); - buf2 >>= w2bits; - mult2pos = e1bits - w1bits + w2bits; - while ((buf2 & 1) == 0) { - buf2 >>= 1; - mult2pos++; - } - assert(mult2pos <= e1bits); - mult2 = table2[buf2>>1]; - buf2 = i; - } - - - /* If we have a pending multiply for e1, do it */ - if (e1bits == mult1pos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_64(t, mult1, mlen); - isone = 0; - } else { - lbnMontMul_64(a, t, mult1, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* If we have a pending multiply for e2, do it */ - if (e1bits == mult2pos) { - /* Multiply by the table entry remembered previously */ - t = BIGLITTLE(b-mlen, b+mlen); - if (isone) { - /* Multiply by 1 is a trivial case */ - lbnCopy_64(t, mult2, mlen); - isone = 0; - } else { - lbnMontMul_64(a, t, mult2, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } - } - - /* Are we done? */ - if (!e1bits) - break; - - /* Square the buffer */ - if (!isone) { - t = BIGLITTLE(b-mlen, b+mlen); - lbnMontSquare_64(a, t, mod, mlen, inv); - /* Swap a and b */ - t = a; a = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } /* for (;;) */ - - assert(!isone); - assert(!buf1); - assert(!buf2); - - /* DONE! */ - - /* Convert result out of Montgomery form */ - t = BIGLITTLE(b-mlen, b+mlen); - lbnCopy_64(b, t, mlen); - lbnZero_64(t, mlen); - lbnMontReduce_64(b, mod, mlen, inv); - lbnCopy_64(result, t, mlen); - - /* Clean up - free intermediate storage */ - y = 0; -#if BNYIELD -yield: -#endif - buf2 = tblmask >> w2bits; - while (--tblmask) { - if (tblmask < buf2) - LBNFREE(table2[tblmask], mlen); - LBNFREE(table1[tblmask], mlen); - } - t = table1[0]; - LBNFREE(t, mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - -/* - * 2^exp (mod mod). This is an optimized version for use in Fermat - * tests. The input value of n is ignored; it is returned with - * "mlen" words valid. - */ -int -lbnTwoExpMod_64(BNWORD64 *n, BNWORD64 const *exp, unsigned elen, - BNWORD64 *mod, unsigned mlen) -{ - unsigned e; /* Copy of high words of the exponent */ - unsigned bits; /* Assorted counter of bits */ - BNWORD64 const *bitptr; - BNWORD64 bitword, bitpos; - BNWORD64 *a, *b, *a1; - BNWORD64 inv; - int y; /* Result of bnYield() */ - - assert(mlen); - - bitptr = BIGLITTLE(exp-elen, exp+elen-1); - bitword = *bitptr; - assert(bitword); - - /* Clear n for future use. */ - lbnZero_64(n, mlen); - - bits = lbnBits_64(exp, elen); - - /* First, a couple of trivial cases. */ - if (bits <= 1) { - /* 2 ^ 0 == 1, 2 ^ 1 == 2 */ - BIGLITTLE(n[-1],n[0]) = (BNWORD64)1<<elen; - return 0; - } - - /* Set bitpos to the most significant bit */ - bitpos = (BNWORD64)1 << ((bits-1) & (64-1)); - - /* Now, count the bits in the modulus. */ - bits = lbnBits_64(mod, mlen); - assert(bits > 1); /* a 1-bit modulus is just stupid... */ - - /* - * We start with 1<<e, where "e" is as many high bits of the - * exponent as we can manage without going over the modulus. - * This first loop finds "e". - */ - e = 1; - while (elen) { - /* Consume the first bit */ - bitpos >>= 1; - if (!bitpos) { - if (!--elen) - break; - bitword = BIGLITTLE(*++bitptr,*--bitptr); - bitpos = (BNWORD64)1<<(64-1); - } - e = (e << 1) | ((bitpos & bitword) != 0); - if (e >= bits) { /* Overflow! Back out. */ - e >>= 1; - break; - } - } - /* - * The bit in "bitpos" being examined by the bit buffer has NOT - * been consumed yet. This may be past the end of the exponent, - * in which case elen == 1. - */ - - /* Okay, now, set bit "e" in n. n is already zero. */ - inv = (BNWORD64)1 << (e & (64-1)); - e /= 64; - BIGLITTLE(n[-e-1],n[e]) = inv; - /* - * The effective length of n in words is now "e+1". - * This is used a little bit later. - */ - - if (!elen) - return 0; /* That was easy! */ - - /* - * We have now processed the first few bits. The next step - * is to convert this to Montgomery form for further squaring. - */ - - /* Allocate working storage: two product buffers */ - LBNALLOC(a, BNWORD64, 2*mlen); - if (!a) - return -1; - LBNALLOC(b, BNWORD64, 2*mlen); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Convert n to Montgomery form */ - inv = BIGLITTLE(mod[-1],mod[0]); /* LSW of modulus */ - assert(inv & 1); /* Modulus must be odd */ - inv = lbnMontInv1_64(inv); - /* Move n (length e+1, remember?) up "mlen" words into b */ - /* Note that we lie about a1 for a bit - it's pointing to b */ - a1 = BIGLITTLE(b-mlen,b+mlen); - lbnCopy_64(a1, n, e+1); - lbnZero_64(b, mlen); - /* Do the division - dump the quotient into the high-order words */ - (void)lbnDiv_64(a1, b, mlen+e+1, mod, mlen); - /* - * Now do the first squaring and modular reduction to put - * the number up in a1 where it belongs. - */ - lbnMontSquare_64(a, b, mod, mlen, inv); - /* Fix up a1 to point to where it should go. */ - a1 = BIGLITTLE(a-mlen,a+mlen); - - /* - * Okay, now, a1 holds the number being accumulated, and - * b is a scratch register. Start working: - */ - for (;;) { - /* - * Is the bit set? If so, double a1 as well. - * A modular doubling like this is very cheap. - */ - if (bitpos & bitword) { - /* - * Double the number. If there was a carry out OR - * the result is greater than the modulus, subract - * the modulus. - */ - if (lbnDouble_64(a1, mlen) || - lbnCmp_64(a1, mod, mlen) > 0) - (void)lbnSubN_64(a1, mod, mlen); - } - - /* Advance to the next exponent bit */ - bitpos >>= 1; - if (!bitpos) { - if (!--elen) - break; /* Done! */ - bitword = BIGLITTLE(*++bitptr,*--bitptr); - bitpos = (BNWORD64)1<<(64-1); - } - - /* - * The elen/bitword/bitpos bit buffer is known to be - * non-empty, i.e. there is at least one more unconsumed bit. - * Thus, it's safe to square the number. - */ - lbnMontSquare_64(b, a1, mod, mlen, inv); - /* Rename result (in b) back to a (a1, really). */ - a1 = b; b = a; a = a1; - a1 = BIGLITTLE(a-mlen,a+mlen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - goto yield; -#endif - } - - /* DONE! Just a little bit of cleanup... */ - - /* - * Convert result out of Montgomery form... this is - * just a Montgomery reduction. - */ - lbnCopy_64(a, a1, mlen); - lbnZero_64(a1, mlen); - lbnMontReduce_64(a, mod, mlen, inv); - lbnCopy_64(n, a1, mlen); - - /* Clean up - free intermediate storage */ - y = 0; -#if BNYIELD -yield: -#endif - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; /* Success */ -} - - -/* - * Returns a substring of the big-endian array of bytes representation - * of the bignum array based on two parameters, the least significant - * byte number (0 to start with the least significant byte) and the - * length. I.e. the number returned is a representation of - * (bn / 2^(8*lsbyte)) % 2 ^ (8*buflen). - * - * It is an error if the bignum is not at least buflen + lsbyte bytes - * long. - * - * This code assumes that the compiler has the minimal intelligence - * neded to optimize divides and modulo operations on an unsigned data - * type with a power of two. - */ -void -lbnExtractBigBytes_64(BNWORD64 const *n, unsigned char *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD64 t = 0; /* Needed to shut up uninitialized var warnings */ - unsigned shift; - - lsbyte += buflen; - - shift = (8 * lsbyte) % 64; - lsbyte /= (64/8); /* Convert to word offset */ - BIGLITTLE(n -= lsbyte, n += lsbyte); - - if (shift) - t = BIGLITTLE(n[-1],n[0]); - - while (buflen--) { - if (!shift) { - t = BIGLITTLE(*n++,*--n); - shift = 64; - } - shift -= 8; - *buf++ = (unsigned char)(t>>shift); - } -} - -/* - * Merge a big-endian array of bytes into a bignum array. - * The array had better be big enough. This is - * equivalent to extracting the entire bignum into a - * large byte array, copying the input buffer into the - * middle of it, and converting back to a bignum. - * - * The buf is "len" bytes long, and its *last* byte is at - * position "lsbyte" from the end of the bignum. - * - * Note that this is a pain to get right. Fortunately, it's hardly - * critical for efficiency. - */ -void -lbnInsertBigBytes_64(BNWORD64 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD64 t = 0; /* Shut up uninitialized varibale warnings */ - - lsbyte += buflen; - - BIGLITTLE(n -= lsbyte/(64/8), n += lsbyte/(64/8)); - - /* Load up leading odd bytes */ - if (lsbyte % (64/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte * 8) % 64; - } - - /* The main loop - merge into t, storing at each word boundary. */ - while (buflen--) { - t = (t << 8) | *buf++; - if ((--lsbyte % (64/8)) == 0) - BIGLITTLE(*n++,*--n) = t; - } - - /* Merge odd bytes in t into last word */ - lsbyte = (lsbyte * 8) % 64; - if (lsbyte) { - t <<= lsbyte; - t |= (((BNWORD64)1 << lsbyte) - 1) & BIGLITTLE(n[0],n[-1]); - BIGLITTLE(n[0],n[-1]) = t; - } - - return; -} - -/* - * Returns a substring of the little-endian array of bytes representation - * of the bignum array based on two parameters, the least significant - * byte number (0 to start with the least significant byte) and the - * length. I.e. the number returned is a representation of - * (bn / 2^(8*lsbyte)) % 2 ^ (8*buflen). - * - * It is an error if the bignum is not at least buflen + lsbyte bytes - * long. - * - * This code assumes that the compiler has the minimal intelligence - * neded to optimize divides and modulo operations on an unsigned data - * type with a power of two. - */ -void -lbnExtractLittleBytes_64(BNWORD64 const *n, unsigned char *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD64 t = 0; /* Needed to shut up uninitialized var warnings */ - - BIGLITTLE(n -= lsbyte/(64/8), n += lsbyte/(64/8)); - - if (lsbyte % (64/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte % (64/8)) * 8 ; - } - - while (buflen--) { - if ((lsbyte++ % (64/8)) == 0) - t = BIGLITTLE(*--n,*n++); - *buf++ = (unsigned char)t; - t >>= 8; - } -} - -/* - * Merge a little-endian array of bytes into a bignum array. - * The array had better be big enough. This is - * equivalent to extracting the entire bignum into a - * large byte array, copying the input buffer into the - * middle of it, and converting back to a bignum. - * - * The buf is "len" bytes long, and its first byte is at - * position "lsbyte" from the end of the bignum. - * - * Note that this is a pain to get right. Fortunately, it's hardly - * critical for efficiency. - */ -void -lbnInsertLittleBytes_64(BNWORD64 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen) -{ - BNWORD64 t = 0; /* Shut up uninitialized varibale warnings */ - - /* Move to most-significant end */ - lsbyte += buflen; - buf += buflen; - - BIGLITTLE(n -= lsbyte/(64/8), n += lsbyte/(64/8)); - - /* Load up leading odd bytes */ - if (lsbyte % (64/8)) { - t = BIGLITTLE(*--n,*n++); - t >>= (lsbyte * 8) % 64; - } - - /* The main loop - merge into t, storing at each word boundary. */ - while (buflen--) { - t = (t << 8) | *--buf; - if ((--lsbyte % (64/8)) == 0) - BIGLITTLE(*n++,*--n) = t; - } - - /* Merge odd bytes in t into last word */ - lsbyte = (lsbyte * 8) % 64; - if (lsbyte) { - t <<= lsbyte; - t |= (((BNWORD64)1 << lsbyte) - 1) & BIGLITTLE(n[0],n[-1]); - BIGLITTLE(n[0],n[-1]) = t; - } - - return; -} - -#ifdef DEADCODE /* This was a precursor to the more flexible lbnExtractBytes */ -/* - * Convert a big-endian array of bytes to a bignum. - * Returns the number of words in the bignum. - * Note the expression "64/8" for the number of bytes per word. - * This is so the word-size adjustment will work. - */ -unsigned -lbnFromBytes_64(BNWORD64 *a, unsigned char const *b, unsigned blen) -{ - BNWORD64 t; - unsigned alen = (blen + (64/8-1))/(64/8); - BIGLITTLE(a -= alen, a += alen); - - while (blen) { - t = 0; - do { - t = t << 8 | *b++; - } while (--blen & (64/8-1)); - BIGLITTLE(*a++,*--a) = t; - } - return alen; -} -#endif - -/* - * Computes the GCD of a and b. Modifies both arguments; when it returns, - * one of them is the GCD and the other is trash. The return value - * indicates which: 0 for a, and 1 for b. The length of the retult is - * returned in rlen. Both inputs must have one extra word of precision. - * alen must be >= blen. - * - * TODO: use the binary algorithm (Knuth section 4.5.2, algorithm B). - * This is based on taking out common powers of 2, then repeatedly: - * gcd(2*u,v) = gcd(u,2*v) = gcd(u,v) - isolated powers of 2 can be deleted. - * gcd(u,v) = gcd(u-v,v) - the numbers can be easily reduced. - * It gets less reduction per step, but the steps are much faster than - * the division case. - */ -int -lbnGcd_64(BNWORD64 *a, unsigned alen, BNWORD64 *b, unsigned blen, - unsigned *rlen) -{ -#if BNYIELD - int y; -#endif - assert(alen >= blen); - - while (blen != 0) { - (void)lbnDiv_64(BIGLITTLE(a-blen,a+blen), a, alen, b, blen); - alen = lbnNorm_64(a, blen); - if (alen == 0) { - *rlen = blen; - return 1; - } - (void)lbnDiv_64(BIGLITTLE(b-alen,b+alen), b, blen, a, alen); - blen = lbnNorm_64(b, alen); -#if BNYIELD - if (bnYield && (y = bnYield()) < 0) - return y; -#endif - } - *rlen = alen; - return 0; -} - -/* - * Invert "a" modulo "mod" using the extended Euclidean algorithm. - * Note that this only computes one of the cosequences, and uses the - * theorem that the signs flip every step and the absolute value of - * the cosequence values are always bounded by the modulus to avoid - * having to work with negative numbers. - * gcd(a,mod) had better equal 1. Returns 1 if the GCD is NOT 1. - * a must be one word longer than "mod". It is overwritten with the - * result. - * TODO: Use Richard Schroeppel's *much* faster algorithm. - */ -int -lbnInv_64(BNWORD64 *a, unsigned alen, BNWORD64 const *mod, unsigned mlen) -{ - BNWORD64 *b; /* Hold a copy of mod during GCD reduction */ - BNWORD64 *p; /* Temporary for products added to t0 and t1 */ - BNWORD64 *t0, *t1; /* Inverse accumulators */ - BNWORD64 cy; - unsigned blen, t0len, t1len, plen; - int y; - - alen = lbnNorm_64(a, alen); - if (!alen) - return 1; /* No inverse */ - - mlen = lbnNorm_64(mod, mlen); - - assert (alen <= mlen); - - /* Inverse of 1 is 1 */ - if (alen == 1 && BIGLITTLE(a[-1],a[0]) == 1) { - lbnZero_64(BIGLITTLE(a-alen,a+alen), mlen-alen); - return 0; - } - - /* Allocate a pile of space */ - LBNALLOC(b, BNWORD64, mlen+1); - if (b) { - /* - * Although products are guaranteed to always be less than the - * modulus, it can involve multiplying two 3-word numbers to - * get a 5-word result, requiring a 6th word to store a 0 - * temporarily. Thus, mlen + 1. - */ - LBNALLOC(p, BNWORD64, mlen+1); - if (p) { - LBNALLOC(t0, BNWORD64, mlen); - if (t0) { - LBNALLOC(t1, BNWORD64, mlen); - if (t1) - goto allocated; - LBNFREE(t0, mlen); - } - LBNFREE(p, mlen+1); - } - LBNFREE(b, mlen+1); - } - return -1; - -allocated: - - /* Set t0 to 1 */ - t0len = 1; - BIGLITTLE(t0[-1],t0[0]) = 1; - - /* b = mod */ - lbnCopy_64(b, mod, mlen); - /* blen = mlen (implicitly) */ - - /* t1 = b / a; b = b % a */ - cy = lbnDiv_64(t1, b, mlen, a, alen); - *(BIGLITTLE(t1-(mlen-alen)-1,t1+(mlen-alen))) = cy; - t1len = lbnNorm_64(t1, mlen-alen+1); - blen = lbnNorm_64(b, alen); - - /* while (b > 1) */ - while (blen > 1 || BIGLITTLE(b[-1],b[0]) != (BNWORD64)1) { - /* q = a / b; a = a % b; */ - if (alen < blen || (alen == blen && lbnCmp_64(a, a, alen) < 0)) - assert(0); - cy = lbnDiv_64(BIGLITTLE(a-blen,a+blen), a, alen, b, blen); - *(BIGLITTLE(a-alen-1,a+alen)) = cy; - plen = lbnNorm_64(BIGLITTLE(a-blen,a+blen), alen-blen+1); - assert(plen); - alen = lbnNorm_64(a, blen); - if (!alen) - goto failure; /* GCD not 1 */ - - /* t0 += q * t1; */ - assert(plen+t1len <= mlen+1); - lbnMul_64(p, BIGLITTLE(a-blen,a+blen), plen, t1, t1len); - plen = lbnNorm_64(p, plen + t1len); - assert(plen <= mlen); - if (plen > t0len) { - lbnZero_64(BIGLITTLE(t0-t0len,t0+t0len), plen-t0len); - t0len = plen; - } - cy = lbnAddN_64(t0, p, plen); - if (cy) { - if (t0len > plen) { - cy = lbnAdd1_64(BIGLITTLE(t0-plen,t0+plen), - t0len-plen, cy); - } - if (cy) { - BIGLITTLE(t0[-t0len-1],t0[t0len]) = cy; - t0len++; - } - } - - /* if (a <= 1) return a ? t0 : FAIL; */ - if (alen <= 1 && BIGLITTLE(a[-1],a[0]) == (BNWORD64)1) { - if (alen == 0) - goto failure; /* FAIL */ - assert(t0len <= mlen); - lbnCopy_64(a, t0, t0len); - lbnZero_64(BIGLITTLE(a-t0len, a+t0len), mlen-t0len); - goto success; - } - - /* q = b / a; b = b % a; */ - if (blen < alen || (blen == alen && lbnCmp_64(b, a, alen) < 0)) - assert(0); - cy = lbnDiv_64(BIGLITTLE(b-alen,b+alen), b, blen, a, alen); - *(BIGLITTLE(b-blen-1,b+blen)) = cy; - plen = lbnNorm_64(BIGLITTLE(b-alen,b+alen), blen-alen+1); - assert(plen); - blen = lbnNorm_64(b, alen); - if (!blen) - goto failure; /* GCD not 1 */ - - /* t1 += q * t0; */ - assert(plen+t0len <= mlen+1); - lbnMul_64(p, BIGLITTLE(b-alen,b+alen), plen, t0, t0len); - plen = lbnNorm_64(p, plen + t0len); - assert(plen <= mlen); - if (plen > t1len) { - lbnZero_64(BIGLITTLE(t1-t1len,t1+t1len), plen-t1len); - t1len = plen; - } - cy = lbnAddN_64(t1, p, plen); - if (cy) { - if (t1len > plen) { - cy = lbnAdd1_64(BIGLITTLE(t1-plen,t0+plen), - t1len-plen, cy); - } - if (cy) { - BIGLITTLE(t1[-t1len-1],t1[t1len]) = cy; - t1len++; - } - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - - if (!blen) - goto failure; /* gcd(a, mod) != 1 -- FAIL */ - - /* return mod-t1 */ - lbnCopy_64(a, mod, mlen); - assert(t1len <= mlen); - cy = lbnSubN_64(a, t1, t1len); - if (cy) { - assert(mlen > t1len); - cy = lbnSub1_64(BIGLITTLE(a-t1len, a+t1len), mlen-t1len, cy); - assert(!cy); - } - -success: - LBNFREE(t1, mlen); - LBNFREE(t0, mlen); - LBNFREE(p, mlen+1); - LBNFREE(b, mlen+1); - - return 0; - -failure: /* GCD is not 1 - no inverse exists! */ - y = 1; -#if BNYIELD -yield: -#endif - LBNFREE(t1, mlen); - LBNFREE(t0, mlen); - LBNFREE(p, mlen+1); - LBNFREE(b, mlen+1); - - return y; -} - -/* - * Precompute powers of "a" mod "mod". Compute them every "bits" - * for "n" steps. This is sufficient to compute powers of g with - * exponents up to n*bits bits long, i.e. less than 2^(n*bits). - * - * This assumes that the caller has already initialized "array" to point - * to "n" buffers of size "mlen". - */ -int -lbnBasePrecompBegin_64(BNWORD64 **array, unsigned n, unsigned bits, - BNWORD64 const *g, unsigned glen, BNWORD64 *mod, unsigned mlen) -{ - BNWORD64 *a, *b; /* Temporary double-width accumulators */ - BNWORD64 *a1; /* Pointer to high half of a*/ - BNWORD64 inv; /* Montgomery inverse of LSW of mod */ - BNWORD64 *t; - unsigned i; - - glen = lbnNorm_64(g, glen); - assert(glen); - - assert (mlen == lbnNorm_64(mod, mlen)); - assert (glen <= mlen); - - /* Allocate two temporary buffers, and the array slots */ - LBNALLOC(a, BNWORD64, mlen*2); - if (!a) - return -1; - LBNALLOC(b, BNWORD64, mlen*2); - if (!b) { - LBNFREE(a, 2*mlen); - return -1; - } - - /* Okay, all ready */ - - /* Convert n to Montgomery form */ - inv = BIGLITTLE(mod[-1],mod[0]); /* LSW of modulus */ - assert(inv & 1); /* Modulus must be odd */ - inv = lbnMontInv1_64(inv); - /* Move g up "mlen" words into a (clearing the low mlen words) */ - a1 = BIGLITTLE(a-mlen,a+mlen); - lbnCopy_64(a1, g, glen); - lbnZero_64(a, mlen); - - /* Do the division - dump the quotient into the high-order words */ - (void)lbnDiv_64(a1, a, mlen+glen, mod, mlen); - - /* Copy the first value into the array */ - t = *array; - lbnCopy_64(t, a, mlen); - a1 = a; /* This first value is *not* shifted up */ - - /* Now compute the remaining n-1 array entries */ - assert(bits); - assert(n); - while (--n) { - i = bits; - do { - /* Square a1 into b1 */ - lbnMontSquare_64(b, a1, mod, mlen, inv); - t = b; b = a; a = t; - a1 = BIGLITTLE(a-mlen, a+mlen); - } while (--i); - t = *++array; - lbnCopy_64(t, a1, mlen); - } - - /* Hooray, we're done. */ - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - return 0; -} - -/* - * result = base^exp (mod mod). "array" is a an array of pointers - * to procomputed powers of base, each 2^bits apart. (I.e. array[i] - * is base^(2^(i*bits))). - * - * The algorithm consists of: - * a = b = (powers of g to be raised to the power 2^bits-1) - * a *= b *= (powers of g to be raised to the power 2^bits-2) - * ... - * a *= b *= (powers of g to be raised to the power 1) - * - * All we do is walk the exponent 2^bits-1 times in groups of "bits" bits, - */ -int -lbnBasePrecompExp_64(BNWORD64 *result, BNWORD64 const * const *array, - unsigned bits, BNWORD64 const *exp, unsigned elen, - BNWORD64 const *mod, unsigned mlen) -{ - BNWORD64 *a, *b, *c, *t; - BNWORD64 *a1, *b1; - int anull, bnull; /* Null flags: values are implicitly 1 */ - unsigned i, j; /* Loop counters */ - unsigned mask; /* Exponent bits to examime */ - BNWORD64 const *eptr; /* Pointer into exp */ - BNWORD64 buf, curbits, nextword; /* Bit-buffer varaibles */ - BNWORD64 inv; /* Inverse of LSW of modulus */ - unsigned ewords; /* Words of exponent left */ - int bufbits; /* Number of valid bits */ - int y = 0; - - mlen = lbnNorm_64(mod, mlen); - assert (mlen); - - elen = lbnNorm_64(exp, elen); - if (!elen) { - lbnZero_64(result, mlen); - BIGLITTLE(result[-1],result[0]) = 1; - return 0; - } - /* - * This could be precomputed, but it's so cheap, and it would require - * making the precomputation structure word-size dependent. - */ - inv = lbnMontInv1_64(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - assert(elen); - - /* - * Allocate three temporary buffers. The current numbers generally - * live in the upper halves of these buffers. - */ - LBNALLOC(a, BNWORD64, mlen*2); - if (a) { - LBNALLOC(b, BNWORD64, mlen*2); - if (b) { - LBNALLOC(c, BNWORD64, mlen*2); - if (c) - goto allocated; - LBNFREE(b, 2*mlen); - } - LBNFREE(a, 2*mlen); - } - return -1; - -allocated: - - anull = bnull = 1; - - mask = (1u<<bits) - 1; - for (i = mask; i; --i) { - /* Set up bit buffer for walking the exponent */ - eptr = exp; - buf = BIGLITTLE(*--eptr, *eptr++); - ewords = elen-1; - bufbits = 64; - for (j = 0; ewords || buf; j++) { - /* Shift down current buffer */ - curbits = buf; - buf >>= bits; - /* If necessary, add next word */ - bufbits -= bits; - if (bufbits < 0 && ewords > 0) { - nextword = BIGLITTLE(*--eptr, *eptr++); - ewords--; - curbits |= nextword << (bufbits+bits); - buf = nextword >> -bufbits; - bufbits += 64; - } - /* If appropriate, multiply b *= array[j] */ - if ((curbits & mask) == i) { - BNWORD64 const *d = array[j]; - - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (bnull) { - lbnCopy_64(b1, d, mlen); - bnull = 0; - } else { - lbnMontMul_64(c, b1, d, mod, mlen, inv); - t = c; c = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - } - - /* Multiply a *= b */ - if (!bnull) { - a1 = BIGLITTLE(a-mlen-1,a+mlen); - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (anull) { - lbnCopy_64(a1, b1, mlen); - anull = 0; - } else { - lbnMontMul_64(c, a1, b1, mod, mlen, inv); - t = c; c = a; a = t; - } - } - } - - assert(!anull); /* If it were, elen would have been 0 */ - - /* Convert out of Montgomery form and return */ - a1 = BIGLITTLE(a-mlen-1,a+mlen); - lbnCopy_64(a, a1, mlen); - lbnZero_64(a1, mlen); - lbnMontReduce_64(a, mod, mlen, inv); - lbnCopy_64(result, a1, mlen); - -#if BNYIELD -yield: -#endif - LBNFREE(c, 2*mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; -} - -/* - * result = base1^exp1 *base2^exp2 (mod mod). "array1" and "array2" are - * arrays of pointers to procomputed powers of the corresponding bases, - * each 2^bits apart. (I.e. array1[i] is base1^(2^(i*bits))). - * - * Bits must be the same in both. (It could be made adjustable, but it's - * a bit of a pain. Just make them both equal to the larger one.) - * - * The algorithm consists of: - * a = b = (powers of base1 and base2 to be raised to the power 2^bits-1) - * a *= b *= (powers of base1 and base2 to be raised to the power 2^bits-2) - * ... - * a *= b *= (powers of base1 and base2 to be raised to the power 1) - * - * All we do is walk the exponent 2^bits-1 times in groups of "bits" bits, - */ -int -lbnDoubleBasePrecompExp_64(BNWORD64 *result, unsigned bits, - BNWORD64 const * const *array1, BNWORD64 const *exp1, unsigned elen1, - BNWORD64 const * const *array2, BNWORD64 const *exp2, - unsigned elen2, BNWORD64 const *mod, unsigned mlen) -{ - BNWORD64 *a, *b, *c, *t; - BNWORD64 *a1, *b1; - int anull, bnull; /* Null flags: values are implicitly 1 */ - unsigned i, j, k; /* Loop counters */ - unsigned mask; /* Exponent bits to examime */ - BNWORD64 const *eptr; /* Pointer into exp */ - BNWORD64 buf, curbits, nextword; /* Bit-buffer varaibles */ - BNWORD64 inv; /* Inverse of LSW of modulus */ - unsigned ewords; /* Words of exponent left */ - int bufbits; /* Number of valid bits */ - int y = 0; - BNWORD64 const * const *array; - - mlen = lbnNorm_64(mod, mlen); - assert (mlen); - - elen1 = lbnNorm_64(exp1, elen1); - if (!elen1) { - return lbnBasePrecompExp_64(result, array2, bits, exp2, elen2, - mod, mlen); - } - elen2 = lbnNorm_64(exp2, elen2); - if (!elen2) { - return lbnBasePrecompExp_64(result, array1, bits, exp1, elen1, - mod, mlen); - } - /* - * This could be precomputed, but it's so cheap, and it would require - * making the precomputation structure word-size dependent. - */ - inv = lbnMontInv1_64(mod[BIGLITTLE(-1,0)]); /* LSW of modulus */ - - assert(elen1); - assert(elen2); - - /* - * Allocate three temporary buffers. The current numbers generally - * live in the upper halves of these buffers. - */ - LBNALLOC(a, BNWORD64, mlen*2); - if (a) { - LBNALLOC(b, BNWORD64, mlen*2); - if (b) { - LBNALLOC(c, BNWORD64, mlen*2); - if (c) - goto allocated; - LBNFREE(b, 2*mlen); - } - LBNFREE(a, 2*mlen); - } - return -1; - -allocated: - - anull = bnull = 1; - - mask = (1u<<bits) - 1; - for (i = mask; i; --i) { - /* Walk each exponent in turn */ - for (k = 0; k < 2; k++) { - /* Set up the exponent for walking */ - array = k ? array2 : array1; - eptr = k ? exp2 : exp1; - ewords = (k ? elen2 : elen1) - 1; - /* Set up bit buffer for walking the exponent */ - buf = BIGLITTLE(*--eptr, *eptr++); - bufbits = 64; - for (j = 0; ewords || buf; j++) { - /* Shift down current buffer */ - curbits = buf; - buf >>= bits; - /* If necessary, add next word */ - bufbits -= bits; - if (bufbits < 0 && ewords > 0) { - nextword = BIGLITTLE(*--eptr, *eptr++); - ewords--; - curbits |= nextword << (bufbits+bits); - buf = nextword >> -bufbits; - bufbits += 64; - } - /* If appropriate, multiply b *= array[j] */ - if ((curbits & mask) == i) { - BNWORD64 const *d = array[j]; - - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (bnull) { - lbnCopy_64(b1, d, mlen); - bnull = 0; - } else { - lbnMontMul_64(c, b1, d, mod, mlen, inv); - t = c; c = b; b = t; - } -#if BNYIELD - if (bnYield && (y = bnYield() < 0)) - goto yield; -#endif - } - } - } - - /* Multiply a *= b */ - if (!bnull) { - a1 = BIGLITTLE(a-mlen-1,a+mlen); - b1 = BIGLITTLE(b-mlen-1,b+mlen); - if (anull) { - lbnCopy_64(a1, b1, mlen); - anull = 0; - } else { - lbnMontMul_64(c, a1, b1, mod, mlen, inv); - t = c; c = a; a = t; - } - } - } - - assert(!anull); /* If it were, elen would have been 0 */ - - /* Convert out of Montgomery form and return */ - a1 = BIGLITTLE(a-mlen-1,a+mlen); - lbnCopy_64(a, a1, mlen); - lbnZero_64(a1, mlen); - lbnMontReduce_64(a, mod, mlen, inv); - lbnCopy_64(result, a1, mlen); - -#if BNYIELD -yield: -#endif - LBNFREE(c, 2*mlen); - LBNFREE(b, 2*mlen); - LBNFREE(a, 2*mlen); - - return y; -} diff --git a/libs/libzrtp/third_party/bnlib/lbn64.h b/libs/libzrtp/third_party/bnlib/lbn64.h deleted file mode 100644 index 583be48416..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn64.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef LBN64_H -#define LBN64_H - -#include "lbn.h" - -#ifndef BNWORD64 -#error 64-bit bignum library requires a 64-bit data type -#endif - -#ifndef lbnCopy_64 -void lbnCopy_64(BNWORD64 *dest, BNWORD64 const *src, unsigned len); -#endif -#ifndef lbnZero_64 -void lbnZero_64(BNWORD64 *num, unsigned len); -#endif -#ifndef lbnNeg_64 -void lbnNeg_64(BNWORD64 *num, unsigned len); -#endif - -#ifndef lbnAdd1_64 -BNWORD64 lbnAdd1_64(BNWORD64 *num, unsigned len, BNWORD64 carry); -#endif -#ifndef lbnSub1_64 -BNWORD64 lbnSub1_64(BNWORD64 *num, unsigned len, BNWORD64 borrow); -#endif - -#ifndef lbnAddN_64 -BNWORD64 lbnAddN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len); -#endif -#ifndef lbnSubN_64 -BNWORD64 lbnSubN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len); -#endif - -#ifndef lbnCmp_64 -int lbnCmp_64(BNWORD64 const *num1, BNWORD64 const *num2, unsigned len); -#endif - -#ifndef lbnMulN1_64 -void lbnMulN1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k); -#endif -#ifndef lbnMulAdd1_64 -BNWORD64 -lbnMulAdd1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k); -#endif -#ifndef lbnMulSub1_64 -BNWORD64 lbnMulSub1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k); -#endif - -#ifndef lbnLshift_64 -BNWORD64 lbnLshift_64(BNWORD64 *num, unsigned len, unsigned shift); -#endif -#ifndef lbnDouble_64 -BNWORD64 lbnDouble_64(BNWORD64 *num, unsigned len); -#endif -#ifndef lbnRshift_64 -BNWORD64 lbnRshift_64(BNWORD64 *num, unsigned len, unsigned shift); -#endif - -#ifndef lbnMul_64 -void lbnMul_64(BNWORD64 *prod, BNWORD64 const *num1, unsigned len1, - BNWORD64 const *num2, unsigned len2); -#endif -#ifndef lbnSquare_64 -void lbnSquare_64(BNWORD64 *prod, BNWORD64 const *num, unsigned len); -#endif - -#ifndef lbnNorm_64 -unsigned lbnNorm_64(BNWORD64 const *num, unsigned len); -#endif -#ifndef lbnBits_64 -unsigned lbnBits_64(BNWORD64 const *num, unsigned len); -#endif - -#ifndef lbnExtractBigBytes_64 -void lbnExtractBigBytes_64(BNWORD64 const *bn, unsigned char *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnInsertBigytes_64 -void lbnInsertBigBytes_64(BNWORD64 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnExtractLittleBytes_64 -void lbnExtractLittleBytes_64(BNWORD64 const *bn, unsigned char *buf, - unsigned lsbyte, unsigned buflen); -#endif -#ifndef lbnInsertLittleBytes_64 -void lbnInsertLittleBytes_64(BNWORD64 *n, unsigned char const *buf, - unsigned lsbyte, unsigned buflen); -#endif - -#ifndef lbnDiv21_64 -BNWORD64 lbnDiv21_64(BNWORD64 *q, BNWORD64 nh, BNWORD64 nl, BNWORD64 d); -#endif -#ifndef lbnDiv1_64 -BNWORD64 lbnDiv1_64(BNWORD64 *q, BNWORD64 *rem, - BNWORD64 const *n, unsigned len, BNWORD64 d); -#endif -#ifndef lbnModQ_64 -unsigned lbnModQ_64(BNWORD64 const *n, unsigned len, unsigned d); -#endif -#ifndef lbnDiv_64 -BNWORD64 -lbnDiv_64(BNWORD64 *q, BNWORD64 *n, unsigned nlen, BNWORD64 *d, unsigned dlen); -#endif - -#ifndef lbnMontInv1_64 -BNWORD64 lbnMontInv1_64(BNWORD64 const x); -#endif -#ifndef lbnMontReduce_64 -void lbnMontReduce_64(BNWORD64 *n, BNWORD64 const *mod, unsigned const mlen, - BNWORD64 inv); -#endif -#ifndef lbnToMont_64 -void lbnToMont_64(BNWORD64 *n, unsigned nlen, BNWORD64 *mod, unsigned mlen); -#endif -#ifndef lbnFromMont_64 -void lbnFromMont_64(BNWORD64 *n, BNWORD64 *mod, unsigned len); -#endif - -#ifndef lbnExpMod_64 -int lbnExpMod_64(BNWORD64 *result, BNWORD64 const *n, unsigned nlen, - BNWORD64 const *exp, unsigned elen, BNWORD64 *mod, unsigned mlen); -#endif -#ifndef lbnDoubleExpMod_64 -int lbnDoubleExpMod_64(BNWORD64 *result, - BNWORD64 const *n1, unsigned n1len, BNWORD64 const *e1, unsigned e1len, - BNWORD64 const *n2, unsigned n2len, BNWORD64 const *e2, unsigned e2len, - BNWORD64 *mod, unsigned mlen); -#endif -#ifndef lbnTwoExpMod_64 -int lbnTwoExpMod_64(BNWORD64 *n, BNWORD64 const *exp, unsigned elen, - BNWORD64 *mod, unsigned mlen); -#endif -#ifndef lbnGcd_64 -int lbnGcd_64(BNWORD64 *a, unsigned alen, BNWORD64 *b, unsigned blen, - unsigned *rlen); -#endif -#ifndef lbnInv_64 -int lbnInv_64(BNWORD64 *a, unsigned alen, BNWORD64 const *mod, unsigned mlen); -#endif - -int lbnBasePrecompBegin_64(BNWORD64 **array, unsigned n, unsigned bits, - BNWORD64 const *g, unsigned glen, BNWORD64 *mod, unsigned mlen); -int lbnBasePrecompExp_64(BNWORD64 *result, BNWORD64 const * const *array, - unsigned bits, BNWORD64 const *exp, unsigned elen, - BNWORD64 const *mod, unsigned mlen); -int lbnDoubleBasePrecompExp_64(BNWORD64 *result, unsigned bits, - BNWORD64 const * const *array1, BNWORD64 const *exp1, unsigned elen1, - BNWORD64 const * const *array2, BNWORD64 const *exp2, - unsigned elen2, BNWORD64 const *mod, unsigned mlen); - -#endif /* LBN64_H */ diff --git a/libs/libzrtp/third_party/bnlib/lbn68000.c b/libs/libzrtp/third_party/bnlib/lbn68000.c deleted file mode 100644 index d46b9bfa33..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn68000.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn68000.c - 16-bit bignum primitives for the 68000 (or 68010) processors. - * - * This was written for Metrowerks C, and while it should be reasonably - * portable, NOTE that Metrowerks lets a callee trash a0, a1, d0, d1, and d2. - * Some 680x0 compilers make d2 callee-save, so instructions to save it - * will have to be added. - * - * This code supports 16 or 32-bit ints, based on UINT_MAX. - * Regardless of UINT_MAX, only bignums up to 64K words (1 million bits) - * are supported. (68k hackers will recognize this as a consequence of - * using dbra.) - * - * These primitives use little-endian word order. - * (The order of bytes within words is irrelevant to this issue.) - */ - -#include <limits.h> - -#include "lbn.h" /* Should include lbn68000.h */ - -/* - * The Metrowerks C compiler (1.2.2) produces bad 68k code for the - * following input, which happens to be the inner loop of lbnSub1, - * so a few less than critical routines have been recoded in assembly - * to avoid the bug. (Optimizer on or off does not matter.) - * - * unsigned - * decrement(unsigned *num, unsigned len) - * { - * do { - * if ((*num++)-- != 0) - * return 0; - * } while (--len); - * return 1; - * } - */ -asm BNWORD16 -lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow) -{ - movea.l 4(sp),a0 /* num */ -#if UINT_MAX == 0xffff - move.w 10(sp),d0 /* borrow */ -#else - move.w 12(sp),d0 /* borrow */ -#endif - sub.w d0,(a0)+ - bcc done -#if UINT_MAX == 0xffff - move.w 8(sp),d0 /* len */ -#else - move.w 10(sp),d0 /* len */ -#endif - subq.w #2,d0 - bcs done -loop: - subq.w #1,(a0)+ - dbcc d0,loop -done: - moveq.l #0,d0 - addx.w d0,d0 - rts -} - -asm BNWORD16 -lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry) -{ - movea.l 4(sp),a0 /* num */ -#if UINT_MAX == 0xffff - move.w 10(sp),d0 /* carry */ -#else - move.w 12(sp),d0 /* carry */ -#endif - add.w d0,(a0)+ - bcc done -#if UINT_MAX == 0xffff - move.w 8(sp),d0 /* len */ -#else - move.w 10(sp),d0 /* len */ -#endif - subq.w #2,d0 - bcs done -loop: - addq.w #1,(a0)+ - dbcc d0,loop -done: - moveq.l #0,d0 - addx.w d0,d0 - rts -} - -asm void -lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - move.w d3,-(sp) /* 2 bytes of stack frame */ - move.l 2+4(sp),a1 /* out */ - move.l 2+8(sp),a0 /* in */ -#if UINT_MAX == 0xffff - move.w 2+12(sp),d3 /* len */ - move.w 2+14(sp),d2 /* k */ -#else - move.w 2+14(sp),d3 /* len (low 16 bits) */ - move.w 2+16(sp),d2 /* k */ -#endif - - move.w (a0)+,d1 /* First multiply */ - mulu.w d2,d1 - move.w d1,(a1)+ - clr.w d1 - swap d1 - - subq.w #1,d3 /* Setup for loop unrolling */ - lsr.w #1,d3 - bcs.s m16_even - beq.s m16_short - - subq.w #1,d3 /* Set up software pipeline properly */ - move.l d1,d0 - -m16_loop: - move.w (a0)+,d1 - mulu.w d2,d1 - add.l d0,d1 - move.w d1,(a1)+ - clr.w d1 - swap d1 -m16_even: - - move.w (a0)+,d0 - mulu.w d2,d0 - add.l d1,d0 - move.w d0,(a1)+ - clr.w d0 - swap d0 - - dbra d3,m16_loop - - move.w d0,(a1) - move.w (sp)+,d3 - rts -m16_short: - move.w d1,(a1) - move.w (sp)+,d3 - rts -} - - -asm BNWORD16 -lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - move.w d4,-(sp) - clr.w d4 - move.w d3,-(sp) /* 4 bytes of stack frame */ - move.l 4+4(sp),a1 /* out */ - move.l 4+8(sp),a0 /* in */ -#if UINT_MAX == 0xffff - move.w 4+12(sp),d3 /* len */ - move.w 4+14(sp),d2 /* k */ -#else - move.w 4+14(sp),d3 /* len (low 16 bits) */ - move.w 4+16(sp),d2 /* k */ -#endif - - move.w (a0)+,d1 /* First multiply */ - mulu.w d2,d1 - add.w d1,(a1)+ - clr.w d1 - swap d1 - addx.w d4,d1 - - subq.w #1,d3 /* Setup for loop unrolling */ - lsr.w #1,d3 - bcs.s ma16_even - beq.s ma16_short - - subq.w #1,d3 /* Set up software pipeline properly */ - move.l d1,d0 - -ma16_loop: - move.w (a0)+,d1 - mulu.w d2,d1 - add.l d0,d1 - add.w d1,(a1)+ - clr.w d1 - swap d1 - addx.w d4,d1 -ma16_even: - - move.w (a0)+,d0 - mulu.w d2,d0 - add.l d1,d0 - add.w d0,(a1)+ - clr.w d0 - swap d0 - addx.w d4,d0 - - dbra d3,ma16_loop - - move.w (sp)+,d3 - move.w (sp)+,d4 - rts -ma16_short: - move.w (sp)+,d3 - move.l d1,d0 - move.w (sp)+,d4 - rts -} - - - -asm BNWORD16 -lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k) -{ - move.w d4,-(sp) - clr.w d4 - move.w d3,-(sp) /* 4 bytes of stack frame */ - move.l 4+4(sp),a1 /* out */ - move.l 4+8(sp),a0 /* in */ -#if UINT_MAX == 0xffff - move.w 4+12(sp),d3 /* len */ - move.w 4+14(sp),d2 /* k */ -#else - move.w 4+14(sp),d3 /* len (low 16 bits) */ - move.w 4+16(sp),d2 /* k */ -#endif - - move.w (a0)+,d1 /* First multiply */ - mulu.w d2,d1 - sub.w d1,(a1)+ - clr.w d1 - swap d1 - addx.w d4,d1 - - subq.w #1,d3 /* Setup for loop unrolling */ - lsr.w #1,d3 - bcs.s ms16_even - beq.s ms16_short - - subq.w #1,d3 /* Set up software pipeline properly */ - move.l d1,d0 - -ms16_loop: - move.w (a0)+,d1 - mulu.w d2,d1 - add.l d0,d1 - sub.w d1,(a1)+ - clr.w d1 - swap d1 - addx.w d4,d1 -ms16_even: - - move.w (a0)+,d0 - mulu.w d2,d0 - add.l d1,d0 - sub.w d0,(a1)+ - clr.w d0 - swap d0 - addx.w d4,d0 - - dbra d3,ms16_loop - - move.w (sp)+,d3 - move.w (sp)+,d4 - rts -ms16_short: - move.w (sp)+,d3 - move.l d1,d0 - move.w (sp)+,d4 - rts -} - -/* The generic long/short divide doesn't know that nh < d */ -asm BNWORD16 -lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d) -{ - move.l 8(sp),d0 /* nh *and* nl */ - divu.w 12(sp),d0 - move.l 4(sp),a0 - move.w d0,(a0) - clr.w d0 - swap d0 - rts -} - -asm unsigned -lbnModQ_16(BNWORD16 const *n, unsigned len, BNWORD16 d) -{ - move.l 4(sp),a0 /* n */ - moveq.l #0,d1 -#if UINT_MAX == 0xffff - move.w 8(sp),d1 /* len */ - move.w 10(sp),d2 /* d */ -#else - move.w 10(sp),d1 /* len (low 16 bits) */ - move.w 12(sp),d2 /* d */ -#endif - - add.l d1,a0 - add.l d1,a0 /* n += len */ - moveq.l #0,d0 - subq.w #1,d1 - -mq16_loop: - move.w -(a0),d0 /* Assemble remainder and new word */ - divu.w d2,d0 /* Put remainder in high half of d0 */ - dbra d1,mq16_loop - -mq16_done: - clr.w d0 - swap d0 - rts -} - -/* - * Detect if this is a 32-bit processor (68020+ *or* CPU32). - * Both the 68020+ and CPU32 processors (which have 32x32->64-bit - * multiply, what the 32-bit math library wants) support scaled indexed - * addressing. The 68000 and 68010 ignore the scale selection - * bits, treating it as *1 all the time. So a 32-bit processor - * will evaluate -2(a0,a0.w*2) as 1+1*2-2 = 1. - * A 16-bit processor will compute 1+1-2 = 0. - * - * Thus, the return value will indicate whether the chip this is - * running on supports 32x32->64-bit multiply (mulu.l). - */ -asm int -is68020(void) -{ - machine 68020 - lea 1,a0 -#if 0 - lea -2(a0,a0.w*2),a0 /* Metrowerks won't assemble this, arrgh */ -#else - dc.w 0x41f0, 0x82fe -#endif - move.l a0,d0 - rts -} -/* - * Since I had to hand-assemble that fancy addressing mode, I had to study - * up on 680x0 addressing modes. - * A summary of 680x0 addressing modes. - * A 68000 effective address specifies an operand on an instruction, which - * may be a register or in memory. It is made up of a 3-bit mode and a - * 3-bit register specifier. The meanings of the various modes are: - * - * 000 reg - Dn, n specified by "reg" - * 001 reg - An, n specified by "reg" - * 010 reg - (An) - * 011 reg - (An)+ - * 100 reg - -(An) - * 101 reg - d16(An), one 16-bit displacement word follows, sign-extended - * 110 reg - Fancy addressing mode off of An, see extension word below - * 111 000 - abs.W, one 16-bit signed absolute address follows - * 111 001 - abs.L, one 32-bit absolute address follows - * 111 010 - d16(PC), one 16-bit displacemnt word follows, sign-extended - * 111 011 - Fancy addressing mode off of PC, see extension word below - * 111 100 - #immediate, followed by 16 or 32 bits of immediate value - * 111 101 - unused, reserved - * 111 110 - unused, reserved - * 111 111 - unused, reserved - * - * Memory references are to data space, except that PC-relative references - * are to program space, and are read-only. - * - * Fancy addressing modes are followed by a 16-bit extension word, and come - * in "brief" and "full" forms. - * The "brief" form looks like this. Bit 8 is 0 to indicate this form: - * - * 1 1 1 1 1 1 1 - * 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - * |A/D| register |L/W| scale | 0 | 8-bit signed displacement | - * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - * - * The basic effective address specifies a 32-bit base register - A0 through - * A7 or PC (the address of the following instruction). - * The A/D and register fields specify an index register. A/D is 1 for - * address registers, and 0 for data registers. L/W specifies the length - * of the index register, 1 for 32 bits, and 0 for 16 bits (sign-extended). - * The scale field is a left shift amount (0 to 3 bits) to apply to the - * sign-extended index register. The final address is d8(An,Rn.X*SCALE), - * also written (d8,An,Rn.X*SCALE). X is "W" or "L", SCALE is 1, 2, 4 or 8. - * "*1" may be omitted, as may a d8 of 0. - * - * The 68000 supports this form, but only with a scale field of 0. - * It does NOT (says the MC68030 User's Manual MC68030UM/AD, section 2.7) - * decode the scale field and the following format bit. They are treated - * as 0. - * I recall (I don't have the data book handy) that the CPU32 processor - * core used in the 683xx series processors supports variable scales, - * but only the brief extension word form. I suspect it decodes the - * format bit and traps if it is not zero, but I don't recall. - * - * The "full" form (680x0, x >= 2 processors only) looks like this: - * - * 1 1 1 1 1 1 1 - * 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - * |A/D| register |L/W| scale | 1 | BS| IS|BD size| 0 | P |OD size| - * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - * - * The first 8 bits are interpreted the same way as in the brief form, - * except that bit 8 is set to 1 to indicate the full form. - * BS, Base Suppress, if set, causes a value of 0 to be used in place of - * the base register value. If this is set, the base register - * specified is irrelevant, except that if it is the PC, the fetch is - * still done from program space. The specifier "ZPC" can be used in - * place of "PC" in the effective address mnemonic to represent this - * case. - * IS, Index Suppress, if set, causes a value of 0 to be used in place - * of the scaled index register. In this case, the first 7 bits of the - * extension word are irrelevant. - * BD size specifies the base displacement size. A value of 00 - * in this field is illegal, while 01, 10 and 11 indicate that the - * extension word is followed by 0, 1 or 2 16-bit words of base displacement - * (zero, sign-extended to 32 bits, and most-significant word first, - * respectively) to add to the base register value. - * Bit 3 is unused. - * The P bit is the pre/post indexing bit, and only applies if an outer - * displacement is used. This is explained later. - * OD size specifies the size of an outer displacement. In the simple - * case, this field is set to 00 and the effective address is - * (disp,An,Rn.X*SCALE) or (disp,PC,Rn.X*SCALE). - * In this case the P bit must be 0. Any of those compnents may be - * suppressed, with a BD size of 01, the BS bit, or the IS bit. - * If the OD size is not 00, it encodes an outer displacement in the same - * manner as the BD size, and 0, 1 or 2 16-bit words of outer displacement - * follow the base displacement in the instruction stream. In this case, - * this is a double-indirect addressing mode. The base, base displacement, - * and possibly the index, specify a 32-bit memory word which holds a value - * which is fetched, and the outer displacement and possibly the index are - * added to produce the address of the operand. - * If the P bit is 0, this is pre-indexed, and the index value is added - * before the fetch of the indirect word, producing an effective address - * of ([disp,An,Rn.X*SCALE],disp). If the P bit is 1, the post-indexed case, - * the memory word is fectched from base+base displacement, then the index - * and outer displacement are added to compute the address of the operand. - * This effective address is written ([disp,An],Rn.X*SCALE,disp). - * (In both cases, "An" may also be "PC" or "ZPC".) - * Any of the components may be omitted. If the index is omitted (using the - * IS bit), the P bit is irrelevant, but must be written as 0. - * Thus, legal combinations of IS, P and OD size are: - * 0 0 00 - (disp,An,Rn.X*SCALE), also written disp(An,Rn.X*SCALE) - * 0 0 01 - ([disp,An,Rn.X*SCALE]) - * 0 0 10 - ([disp,An,Rn.X*SCALE],d16) - * 0 0 11 - ([disp,An,Rn.X*SCALE],d32) - * 0 1 01 - ([disp,An],Rn.X*SCALE) - * 0 1 10 - ([disp,An],Rn.X*SCALE,d16) - * 0 1 11 - ([disp,An],Rn.X*SCALE,d32) - * 1 0 00 - (disp,An), also written disp(An) - * 1 0 01 - ([disp,An]) - * 1 0 10 - ([disp,An],d16) - * 1 0 11 - ([disp,An],d32) - */ - -/* 45678901234567890123456789012345678901234567890123456789012345678901234567 */ diff --git a/libs/libzrtp/third_party/bnlib/lbn68000.h b/libs/libzrtp/third_party/bnlib/lbn68000.h deleted file mode 100644 index c46e9f8d3c..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn68000.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn68000.h - 16-bit bignum primitives for the 68000 (or 68010) processors. - * - * These primitives use little-endian word order. - * (The order of bytes within words is irrelevant.) - */ -#define BN_LITTLE_ENDIAN 1 - -typedef unsigned short bnword16 -#define BNWORD16 bnword16 - -bnword16 lbnSub1_16(bnword16 *num, unsigned len, bnword16 borrow); -bnword16 lbnAdd1_16(bnword16 *num, unsigned len, bnword16 carry); -void lbnMulN1_16(bnword16 *out, bnword16 const *in, unsigned len, bnword16 k); -bnword16 -lbnMulAdd1_16(bnword16 *out, bnword16 const *in, unsigned len, bnword16 k); -bnword16 -lbnMulSub1_16(bnword16 *out, bnword16 const *in, unsigned len, bnword16 k); -bnword16 lbnDiv21_16(bnword16 *q, bnword16 nh, bnword16 nl, bnword16 d); -unsigned lbnModQ_16(bnword16 const *n, unsigned len, bnword16 d); - -int is68020(void); - -/* #define the values to exclude the C versions */ -#define lbnSub1_16 lbnSub1_16 -#define lbnAdd1_16 lbnAdd1_16 -#define lbnMulN1_16 lbnMulN1_16 -#define lbnMulAdd1_16 lbnMulAdd1_16 -#define lbnMulSub1_16 lbnMulSub1_16 -#define lbnDiv21_16 lbnDiv21_16 -#define lbnModQ_16 lbnModQ_16 - -/* Also include the 68020 definitions for 16/32 bit switching versions. */ -#include <lbn68020.h> diff --git a/libs/libzrtp/third_party/bnlib/lbn68020.c b/libs/libzrtp/third_party/bnlib/lbn68020.c deleted file mode 100644 index 45b0281e42..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn68020.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn68020.c - 32-bit bignum primitives for the 68020+ (0r 683xx) processors. - * - * This was written for Metrowerks C, and while it should be reasonably - * portable, NOTE that Metrowerks lets a callee trash a0, a1, d0, d1, and d2. - * Some 680x0 compilers make d2 callee-save, so instructions to save it - * will have to be added. - * - * This code supports 16 or 32-bit ints, based on UINT_MAX. - * Regardless of UINT_MAX, only bignums up to 64K words (2 million bits) - * are supported. (68k hackers will recognize this as a consequence of - * using dbra.) - * - * These primitives use little-endian word order. - * (The order of bytes within words is irrelevant to this issue.) - * - * TODO: Schedule this for the 68040's pipeline. (When I get a 68040 manual.) - */ - -#include <limits.h> - -#include "lbn.h" /* Should include lbn68020.h */ - -/* - * The Metrowerks C compiler (1.2.2) produces bad 68k code for the - * following input, which happens to be the inner loop of lbnSub1, - * so a few less than critical routines have been recoded in assembly - * to avoid the bug. (Optimizer on or off does not matter.) - * - * unsigned - * decrement(unsigned *num, unsigned len) - * { - * do { - * if ((*num++)-- != 0) - * return 0; - * } while (--len); - * return 1; - * } - */ -asm BNWORD32 -lbnSub1_32(BNWORD32 *num, unsigned len, BNWORD32 borrow) -{ - movea.l 4(sp),a0 /* num */ -#if UINT_MAX == 0xffff - move.l 10(sp),d0 /* borrow */ -#else - move.l 12(sp),d0 /* borrow */ -#endif - sub.l d0,(a0)+ - bcc done -#if UINT_MAX == 0xffff - move.w 8(sp),d0 /* len */ -#else - move.w 10(sp),d0 /* len */ -#endif - subq.w #2,d0 - bcs done -loop: - subq.l #1,(a0)+ - dbcc d0,loop -done: - moveq.l #0,d0 - addx.w d0,d0 - rts -} - -asm BNWORD32 -lbnAdd1_32(BNWORD32 *num, unsigned len, BNWORD32 carry) -{ - movea.l 4(sp),a0 /* num */ -#if UINT_MAX == 0xffff - move.l 10(sp),d0 /* carry */ -#else - move.l 12(sp),d0 /* carry */ -#endif - add.l d0,(a0)+ - bcc done -#if UINT_MAX == 0xffff - move.w 8(sp),d0 /* len */ -#else - move.w 10(sp),d0 /* len */ -#endif - subq.w #2,d0 - bcs done -loop: - addq.l #1,(a0)+ - dbcc d0,loop -done: - moveq.l #0,d0 - addx.w d0,d0 - rts -} - -asm void -lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - machine 68020 - - movem.l d3-d5,-(sp) /* 12 bytes of extra data */ - moveq.l #0,d4 - move.l 16(sp),a1 /* out */ - move.l 20(sp),a0 /* in */ -#if UINT_MAX == 0xffff - move.w 24(sp),d5 /* len */ - move.l 26(sp),d2 /* k */ -#else - move.w 26(sp),d5 /* len */ - move.l 28(sp),d2 /* k */ -#endif - - move.l (a0)+,d3 /* First multiply */ - mulu.l d2,d1:d3 /* dc.w 0x4c02, 0x3401 */ - move.l d3,(a1)+ - - subq.w #1,d5 /* Setup for loop unrolling */ - lsr.w #1,d5 - bcs.s m32_even - beq.s m32_short - - subq.w #1,d5 /* Set up software pipeline properly */ - move.l d1,d0 - -m32_loop: - move.l (a0)+,d3 - mulu.l d2,d1:d3 /* dc.w 0x4c02, 0x3401 */ - add.l d0,d3 - addx.l d4,d1 - move.l d3,(a1)+ -m32_even: - - move.l (a0)+,d3 - mulu.l d2,d0:d3 /* dc.w 0x4c02, 0x3400 */ - add.l d1,d3 - addx.l d4,d0 - move.l d3,(a1)+ - - dbra d5,m32_loop - - move.l d0,(a1) - movem.l (sp)+,d3-d5 - rts -m32_short: - move.l d1,(a1) - movem.l (sp)+,d3-d5 - rts -} - - -asm BNWORD32 -lbnMulAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - machine 68020 - movem.l d3-d5,-(sp) /* 12 bytes of extra data */ - moveq.l #0,d4 - move.l 16(sp),a1 /* out */ - move.l 20(sp),a0 /* in */ -#if UINT_MAX == 0xffff - move.w 24(sp),d5 /* len */ - move.l 26(sp),d2 /* k */ -#else - move.w 26(sp),d5 /* len */ - move.l 28(sp),d2 /* k */ -#endif - - move.l (a0)+,d3 /* First multiply */ - mulu.l d2,d1:d3 /* dc.w 0x4c02, 0x3401 */ - add.l d3,(a1)+ - addx.l d4,d1 - - subq.w #1,d5 /* Setup for loop unrolling */ - lsr.w #1,d5 - bcs.s ma32_even - beq.s ma32_short - - subq.w #1,d5 /* Set up software pipeline properly */ - move.l d1,d0 - -ma32_loop: - move.l (a0)+,d3 - mulu.l d2,d1:d3 /* dc.w 0x4c02, 0x3401 */ - add.l d0,d3 - addx.l d4,d1 - add.l d3,(a1)+ - addx.l d4,d1 -ma32_even: - - move.l (a0)+,d3 - mulu.l d2,d0:d3 /* dc.w 0x4c02, 0x3400 */ - add.l d1,d3 - addx.l d4,d0 - add.l d3,(a1)+ - addx.l d4,d0 - - dbra d5,ma32_loop - - movem.l (sp)+,d3-d5 - rts -ma32_short: - move.l d1,d0 - movem.l (sp)+,d3-d5 - rts -} - - -asm BNWORD32 -lbnMulSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -{ - machine 68020 - movem.l d3-d5,-(sp) /* 12 bytes of extra data */ - moveq.l #0,d4 - move.l 16(sp),a1 /* out */ - move.l 20(sp),a0 /* in */ -#if UINT_MAX == 0xffff - move.w 24(sp),d5 /* len */ - move.l 26(sp),d2 /* k */ -#else - move.w 26(sp),d5 /* len */ - move.l 28(sp),d2 /* k */ -#endif - - move.l (a0)+,d3 /* First multiply */ - mulu.l d2,d1:d3 /* dc.w 0x4c02, 0x3401 */ - sub.l d3,(a1)+ - addx.l d4,d1 - - subq.w #1,d5 /* Setup for loop unrolling */ - lsr.w #1,d5 - bcs.s ms32_even - beq.s ms32_short - - subq.w #1,d5 /* Set up software pipeline properly */ - move.l d1,d0 - -ms32_loop: - move.l (a0)+,d3 - mulu.l d2,d1:d3 /* dc.w 0x4c02, 0x3401 */ - add.l d0,d3 - addx.l d4,d1 - sub.l d3,(a1)+ - addx.l d4,d1 -ms32_even: - - move.l (a0)+,d3 - mulu.l d2,d0:d3 /* dc.w 0x4c02, 0x3400 */ - add.l d1,d3 - addx.l d4,d0 - sub.l d3,(a1)+ - addx.l d4,d0 - - dbra d5,ms32_loop - - movem.l (sp)+,d3-d5 - rts - -ms32_short: - move.l d1,d0 - movem.l (sp)+,d3-d5 - rts -} - - -asm BNWORD32 -lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d) -{ - machine 68020 - move.l 8(sp),d0 - move.l 12(sp),d1 - move.l 4(sp),a0 - divu.l 16(sp),d0:d1 /* dc.w 0x4c6f, 0x1400, 16 */ - move.l d1,(a0) - rts -} - -asm unsigned -lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d) -{ - machine 68020 - move.l 4(sp),a0 /* n */ - move.l d3,a1 -#if UINT_MAX == 0xffff - moveq.l #0,d2 - move.w 8(sp),d1 /* len */ - move.w 10(sp),d2 /* d */ -#else - move.w 10(sp),d1 /* len */ - move.l 12(sp),d2 /* d */ -#endif - dc.w 0x41f0, 0x1cfc /* lea -4(a0,d1.L*4),a0 */ - - /* First time, divide 32/32 - may be faster than 64/32 */ - move.l (a0),d3 - divul.l d2,d0:d3 /* dc.w 0x4c02, 0x3000 */ - subq.w #2,d1 - bmi mq32_done - -mq32_loop: - move.l -(a0),d3 - divu.l d2,d0:d3 /* dc.w 0x4c02,0x3400 */ - dbra d1,mq32_loop - -mq32_done: - move.l a1,d3 - rts -} - -/* 45678901234567890123456789012345678901234567890123456789012345678901234567 */ diff --git a/libs/libzrtp/third_party/bnlib/lbn68020.h b/libs/libzrtp/third_party/bnlib/lbn68020.h deleted file mode 100644 index cae33dbf85..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn68020.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn68020.h - 32-bit bignum primitives for the 68020 (or 683xx) processors. - * - * These primitives use little-endian word order. - * (The order of bytes within words is irrelevant.) - */ -#define BN_LITTLE_ENDIAN 1 - -typedef unsigned long bnword32; -#define BNWORD32 bnword32 - -bnword32 lbnSub1_32(bnword32 *num, unsigned len, bnword32 borrow); -bnword32 lbnAdd1_32(bnword32 *num, unsigned len, bnword32 carry); -void lbnMulN1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -bnword32 -lbnMulAdd1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -bnword32 -lbnMulSub1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -bnword32 lbnDiv21_32(bnword32 *q, bnword32 nh, bnword32 nl, bnword32 d); -unsigned lbnModQ_32(bnword32 const *n, unsigned len, unsigned d); - -/* #define the values to exclude the C versions */ -#define lbnSub1_32 lbnSub1_32 -#define lbnAdd1_32 lbnAdd1_32 -#define lbnMulN1_32 lbnMulN1_32 -#define lbnMulAdd1_32 lbnMulAdd1_32 -#define lbnMulSub1_32 lbnMulSub1_32 -#define lbnDiv21_32 lbnDiv21_32 -#define lbnModQ_32 lbnModQ_32 diff --git a/libs/libzrtp/third_party/bnlib/lbn68360.s b/libs/libzrtp/third_party/bnlib/lbn68360.s deleted file mode 100644 index de6525e03d..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn68360.s +++ /dev/null @@ -1,280 +0,0 @@ -* Copyright (c) 1995 Colin Plumb. All rights reserved. -* For licensing and other legal details, see the file legal.c. -* -* lbn68360.c - 32-bit bignum primitives for 683xx processors. -* -* This code is using InterTools calling convention, which is a bit odd. -* One minor note is that the default variable sizes are -* char = unsigned 8, short = 8 (in violation of ANSI!), -* int = 16, long = 32. Longs (including on the stack) are 16-bit aligned. -* Arguments are apdded to 16 bits. -* A6 is used as a frame pointer, and globals are indexed off A5. -* Return valies are passes id D0 or A0 (or FP0), depending on type. -* D0, D1, A0 and A4 (!) are volatile across function calls. A1 -* must be preserved! -* -* This code assumes 16-bit ints. Code for 32-bit ints is commented out -* with "**". -* -* Regardless of UINT_MAX, only bignums up to 64K words (2 million bits) -* are supported. (68k hackers will recognize this as a consequence of -* using dbra.) This could be extended easily if anyone cares. -* -* These primitives use little-endian word order. -* (The order of bytes within words is irrelevant to this issue.) - -* The Metrowerks C compiler (1.2.2) produces bad 68k code for the -* following input, which happens to be the inner loop of lbnSub1, -* so it has been rewritees in assembly, even though it is not terribly -* speed-critical. (Optimizer on or off does not matter.) -* -* unsigned -* decrement(unsigned *num, unsigned len) -* { -* do { -* if ((*num++)-- != 0) -* return 0; -* } while (--len); -* return 1; -* } - -* BNWORD32 lbnSub1_32(BNWORD32 *num, unsigned len, BNWORD32 borrow) - SECTION S_lbnSub1_32,,"code" - XDEF _lbnSub1_32 -_lbnSub1_32: - movea.l 4(sp),a0 * num - move.l 10(sp),d0 * borrow -** move.l 12(sp),d0 * borrow - sub.l d0,(a0)+ - bcc sub_done - move.w 8(sp),d0 * len -** move.w 10(sp),d0 * len - subq.w #2,d0 - bcs sub_done -sub_loop: - subq.l #1,(a0)+ - dbcc d0,sub_loop -sub_done: - moveq.l #0,d0 - addx.w d0,d0 - rts - -* BNWORD32 lbnAdd1_32(BNWORD32 *num, unsigned len, BNWORD32 carry) - SECTION S_lbnAdd1_32,,"code" - XDEF _lbnAdd1_32 -_lbnAdd1_32: - movea.l 4(sp),a0 * num - move.l 10(sp),d0 * carry -** move.l 12(sp),d0 * carry - add.l d0,(a0)+ - bcc add_done - move.w 8(sp),d0 * len -** move.w 10(sp),d0 * len - subq.w #2,d0 - bcs add_done -add_loop: - addq.l #1,(a0)+ - dbcc d0,add_loop -add_done: - moveq.l #0,d0 - addx.w d0,d0 - rts - -* void lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) - SECTION S_lbnMulN1_32,,"code" - XDEF _lbnMulN1_32 -_lbnMulN1_32: - movem.l d2-d5,-(sp) * 16 bytes of extra data - moveq.l #0,d4 - move.l 20(sp),a4 * out - move.l 24(sp),a0 * in - move.w 28(sp),d5 * len - move.l 30(sp),d2 * k -** move.w 30(sp),d5 * len -** move.l 32(sp),d2 * k - - move.l (a0)+,d3 * First multiply - mulu.l d2,d1:d3 * dc.w 0x4c02, 0x3401 - move.l d3,(a4)+ - - subq.w #1,d5 * Setup for loop unrolling - lsr.w #1,d5 - bcs.s m32_even - beq.s m32_short - - subq.w #1,d5 * Set up software pipeline properly - move.l d1,d0 - -m32_loop: - move.l (a0)+,d3 - mulu.l d2,d1:d3 * dc.w 0x4c02, 0x3401 - add.l d0,d3 - addx.l d4,d1 - move.l d3,(a4)+ -m32_even: - - move.l (a0)+,d3 - mulu.l d2,d0:d3 * dc.w 0x4c02, 0x3400 - add.l d1,d3 - addx.l d4,d0 - move.l d3,(a4)+ - - dbra d5,m32_loop - - move.l d0,(a4) - movem.l (sp)+,d2-d5 - rts -m32_short: - move.l d1,(a4) - movem.l (sp)+,d2-d5 - rts - -* BNWORD32 -* lbnMulAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) - SECTION S_lbnMulAdd1_32,,"code" - XDEF _lbnMulAdd1_32 -_lbnMulAdd1_32: - movem.l d2-d5,-(sp) * 16 bytes of extra data - moveq.l #0,d4 - move.l 20(sp),a4 * out - move.l 24(sp),a0 * in - move.w 28(sp),d5 * len - move.l 30(sp),d2 * k -** move.w 30(sp),d5 * len -** move.l 32(sp),d2 * k - - move.l (a0)+,d3 * First multiply - mulu.l d2,d1:d3 * dc.w 0x4c02, 0x3401 - add.l d3,(a4)+ - addx.l d4,d1 - - subq.w #1,d5 * Setup for loop unrolling - lsr.w #1,d5 - bcs.s ma32_even - beq.s ma32_short - - subq.w #1,d5 * Set up software pipeline properly - move.l d1,d0 - -ma32_loop: - move.l (a0)+,d3 - mulu.l d2,d1:d3 * dc.w 0x4c02, 0x3401 - add.l d0,d3 - addx.l d4,d1 - add.l d3,(a4)+ - addx.l d4,d1 -ma32_even: - - move.l (a0)+,d3 - mulu.l d2,d0:d3 * dc.w 0x4c02, 0x3400 - add.l d1,d3 - addx.l d4,d0 - add.l d3,(a4)+ - addx.l d4,d0 - - dbra d5,ma32_loop - - movem.l (sp)+,d2-d5 - rts -ma32_short: - move.l d1,d0 - movem.l (sp)+,d2-d5 - rts - -* BNWORD32 -* lbnMulSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) - SECTION S_lbnMulSub1_32,,"code" - XDEF _lbnMulSub1_32 -_lbnMulSub1_32: - movem.l d2-d5,-(sp) * 16 bytes of extra data - moveq.l #0,d4 - move.l 20(sp),a4 * out - move.l 24(sp),a0 * in - move.w 28(sp),d5 * len - move.l 30(sp),d2 * k -** move.w 30(sp),d5 * len -** move.l 32(sp),d2 * k - - move.l (a0)+,d3 * First multiply - mulu.l d2,d1:d3 * dc.w 0x4c02, 0x3401 - sub.l d3,(a4)+ - addx.l d4,d1 - - subq.w #1,d5 * Setup for loop unrolling - lsr.w #1,d5 - bcs.s ms32_even - beq.s ms32_short - - subq.w #1,d5 * Set up software pipeline properly - move.l d1,d0 - -ms32_loop: - move.l (a0)+,d3 - mulu.l d2,d1:d3 * dc.w 0x4c02, 0x3401 - add.l d0,d3 - addx.l d4,d1 - sub.l d3,(a4)+ - addx.l d4,d1 -ms32_even: - - move.l (a0)+,d3 - mulu.l d2,d0:d3 * dc.w 0x4c02, 0x3400 - add.l d1,d3 - addx.l d4,d0 - sub.l d3,(a4)+ - addx.l d4,d0 - - dbra d5,ms32_loop - - movem.l (sp)+,d2-d5 - rts - -ms32_short: - move.l d1,d0 - movem.l (sp)+,d2-d5 - rts - - -* BNWORD32 lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d) - SECTION S_lbnDiv21_32,,"code" - XDEF _lbnDiv21_32 -_lbnDiv21_32: - move.l 8(sp),d0 - move.l 12(sp),d1 - move.l 4(sp),a0 - divu.l 16(sp),d0:d1 * dc.w 0x4c6f, 0x1400, 16 - move.l d1,(a0) - rts - -* unsigned lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d) - SECTION S_lbnModQ_32,,"code" - XDEF _lbnModQ_32 -_lbnModQ_32: - move.l 4(sp),a0 * n - move.l d2,-(sp) - move.l d3,a4 - moveq.l #0,d1 - moveq.l #0,d2 - move.w 12(sp),d1 * len - move.w 14(sp),d2 * d -** move.l 12(sp),d1 * len -** move.l 16(sp),d2 * d - lea -4(a0,d1.L*4),a0 * dc.w 0x41f0, 0x1cfc - -* First time, divide 32/32 - may be faster than 64/32 - move.l (a0),d3 - divul.l d2,d0:d3 * dc.w 0x4c02, 0x3000 - subq.w #2,d1 - bmi mq32_done - -mq32_loop: - move.l -(a0),d3 - divu.l d2,d0:d3 * dc.w 0x4c02,0x3400 - dbra d1,mq32_loop - -mq32_done: - move.l (sp)+,d2 - move.l a4,d3 - rts - - end diff --git a/libs/libzrtp/third_party/bnlib/lbn80386.asm b/libs/libzrtp/third_party/bnlib/lbn80386.asm deleted file mode 100644 index 4de77f5563..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn80386.asm +++ /dev/null @@ -1,414 +0,0 @@ -;;; Copyright (c) 1995, Colin Plumb. -;;; For licensing and other legal details, see the file legal.c. -;;; -;;; Assembly primitives for bignum library, 80386 family, 32-bit code. -;;; -;;; Several primitives are included here. Only lbnMulAdd1 is *really* -;;; critical, but once that's written, lnmMulN1 and lbnMulSub1 are quite -;;; easy to write as well, so they are included here as well. -;;; lbnDiv21 and lbnModQ are so easy to write that they're included, too. -;;; -;;; All functions here are for 32-bit flat mode. I.e. near code and -;;; near data, although the near offsets are 32 bits. -;;; -;;; The usual 80x86 calling conventions have AX, BX, CX and DX -;;; volatile, and SI, DI, SP and BP preserved across calls. -;;; This includes the "E"xtended forms of all of those registers -;;; -;;; However, just to be confusing, recent 32-bit DOS compilers have -;;; quietly changed that to require EBX preserved across calls, too. -;;; Joy. - -.386 -;_TEXT segment para public use32 'CODE' ; 16-byte aligned because 486 cares -;_TEXT ends - -ifdef @Version -if @Version le 510 -FLAT group _TEXT -endif -else -FLAT group _TEXT -endif - assume cs:FLAT, ds:FLAT, ss:FLAT -_TEXT segment para public use32 'CODE' ; 16-byte aligned because 486 cares - - public _lbnMulN1_32 - public _lbnMulAdd1_32 - public _lbnMulSub1_32 - public _lbnDiv21_32 - public _lbnModQ_32 - -;; Register usage: -;; eax - low half of product -;; ebx - carry to next iteration -;; ecx - multiplier (k) -;; edx - high half of product -;; esi - source pointer -;; edi - dest pointer -;; ebp - loop counter -;; -;; Stack frame: -;; +--------+ esp+20 esp+24 esp+28 esp+32 esp+36 -;; | k | -;; +--------+ esp+16 esp+20 esp+24 esp+28 esp+32 -;; | len | -;; +--------+ esp+12 esp+16 esp+20 esp+24 esp+28 -;; | in | -;; +--------+ esp+8 esp+12 esp+16 esp+20 esp+24 -;; | out | -;; +--------+ esp+4 esp+8 esp+12 esp+16 esp+20 -;; | return | -;; +--------+ esp esp+4 esp+8 esp+12 esp+16 -;; | esi | -;; +--------+ esp esp+4 esp+8 esp+12 -;; | ebp | -;; +--------+ esp esp+4 esp+8 -;; | ebx | -;; +--------+ esp esp+4 -;; | edi | -;; +--------+ esp - - align 16 -_lbnMulN1_32 proc near - - push esi ; U - mov esi,[esp+12] ; V load in - push ebp ; U - mov ebp,[esp+20] ; V load len - push ebx ; U - mov ecx,[esp+28] ; V load k - push edi ; U - mov edi,[esp+20] ; V load out - -;; First multiply step has no carry in. - mov eax,[esi] ; U - lea ebx,[ebp*4-4] ; V loop unrolling - mul ecx ; NP first multiply - mov [edi],eax ; U - and ebx,12 ; V loop unrolling - - add esi,ebx ; U loop unrolling - add edi,ebx ; V loop unrolling - - jmp DWORD PTR m32_jumptable[ebx] ; NP loop unrolling - - align 4 -m32_jumptable: - dd m32_case0 - dd m32_case1 - dd m32_case2 - dd m32_case3 - - nop - align 8 - nop - nop - nop ; Get loop nicely aligned - -m32_case0: - sub ebp,4 ; U - jbe SHORT m32_done ; V - -m32_loop: - mov eax,[esi+4] ; U - mov ebx,edx ; V Remember carry for later - add esi,16 ; U - add edi,16 ; V - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - mov [edi-12],eax ; V -m32_case3: - mov eax,[esi-8] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - mov [edi-8],eax ; V -m32_case2: - mov eax,[esi-4] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - mov [edi-4],eax ; V -m32_case1: - mov eax,[esi] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - mov [edi],eax ; V - - sub ebp,4 ; U - ja SHORT m32_loop ; V - -m32_done: - mov [edi+4],edx ; U - pop edi ; V - pop ebx ; U - pop ebp ; V - pop esi ; U - ret ; NP -_lbnMulN1_32 endp - - - align 16 -_lbnMulAdd1_32 proc near - - push esi ; U - mov esi,[esp+12] ; V load in - push edi ; U - mov edi,[esp+12] ; V load out - push ebp ; U - mov ebp,[esp+24] ; V load len - push ebx ; U - mov ecx,[esp+32] ; V load k - -;; First multiply step has no carry in. - mov eax,[esi] ; U - mov ebx,[edi] ; V - mul ecx ; NP first multiply - add ebx,eax ; U - lea eax,[ebp*4-4] ; V loop unrolling - adc edx,0 ; U - and eax,12 ; V loop unrolling - mov [edi],ebx ; U - - add esi,eax ; V loop unrolling - add edi,eax ; U loop unrolling - - jmp DWORD PTR ma32_jumptable[eax] ; NP loop unrolling - - align 4 -ma32_jumptable: - dd ma32_case0 - dd ma32_case1 - dd ma32_case2 - dd ma32_case3 - - nop - align 8 - nop - nop - nop ; To align loop properly - - -ma32_case0: - sub ebp,4 ; U - jbe SHORT ma32_done ; V - -ma32_loop: - mov eax,[esi+4] ; U - mov ebx,edx ; V Remember carry for later - add esi,16 ; U - add edi,16 ; V - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - mov ebx,[edi-12] ; V - adc edx,0 ; U - add ebx,eax ; V - adc edx,0 ; U - mov [edi-12],ebx ; V -ma32_case3: - mov eax,[esi-8] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - mov ebx,[edi-8] ; V - adc edx,0 ; U - add ebx,eax ; V - adc edx,0 ; U - mov [edi-8],ebx ; V -ma32_case2: - mov eax,[esi-4] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - mov ebx,[edi-4] ; V - adc edx,0 ; U - add ebx,eax ; V - adc edx,0 ; U - mov [edi-4],ebx ; V -ma32_case1: - mov eax,[esi] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - mov ebx,[edi] ; V - adc edx,0 ; U - add ebx,eax ; V - adc edx,0 ; U - mov [edi],ebx ; V - - sub ebp,4 ; U - ja SHORT ma32_loop ; V - -ma32_done: - pop ebx ; U - pop ebp ; V - mov eax,edx ; U - pop edi ; V - pop esi ; U - ret ; NP -_lbnMulAdd1_32 endp - - - align 16 -_lbnMulSub1_32 proc near - push esi ; U - mov esi,[esp+12] ; V load in - push edi ; U - mov edi,[esp+12] ; V load out - push ebp ; U - mov ebp,[esp+24] ; V load len - push ebx ; U - mov ecx,[esp+32] ; V load k - -;; First multiply step has no carry in. - push esi ; U - mov esi,[esp+12] ; V load in - push edi ; U - mov edi,[esp+12] ; V load out - push ebp ; U - mov ebp,[esp+24] ; V load len - mov ecx,[esp+28] ; U load k - -;; First multiply step has no carry in. - mov eax,[esi] ; V - mov ebx,[edi] ; U - mul ecx ; NP first multiply - sub ebx,eax ; U - lea eax,[ebp*4-4] ; V loop unrolling - adc edx,0 ; U - and eax,12 ; V loop unrolling - mov [edi],ebx ; U - - add esi,eax ; V loop unrolling - add edi,eax ; U loop unrolling - - jmp DWORD PTR ms32_jumptable[eax] ; NP loop unrolling - - align 4 -ms32_jumptable: - dd ms32_case0 - dd ms32_case1 - dd ms32_case2 - dd ms32_case3 - - nop - align 8 - nop - nop - nop - -ms32_case0: - sub ebp,4 ; U - jbe SHORT ms32_done ; V - -ms32_loop: - mov eax,[esi+4] ; U - mov ebx,edx ; V Remember carry for later - add esi,16 ; U - add edi,16 ; V - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - mov ebx,[edi-12] ; V - adc edx,0 ; U - sub ebx,eax ; V - adc edx,0 ; U - mov [edi-12],ebx ; V -ms32_case3: - mov eax,[esi-8] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - mov ebx,[edi-8] ; V - adc edx,0 ; U - sub ebx,eax ; V - adc edx,0 ; U - mov [edi-8],ebx ; V -ms32_case2: - mov eax,[esi-4] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - mov ebx,[edi-4] ; V - adc edx,0 ; U - sub ebx,eax ; V - adc edx,0 ; U - mov [edi-4],ebx ; V -ms32_case1: - mov eax,[esi] ; U - mov ebx,edx ; V Remember carry for later - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - mov ebx,[edi] ; V - adc edx,0 ; U - sub ebx,eax ; V - adc edx,0 ; U - mov [edi],ebx ; V - - sub ebp,4 ; U - ja SHORT ms32_loop ; V - -ms32_done: - pop ebx ; U - pop ebp ; V - mov eax,edx ; U - pop edi ; V - pop esi ; U - ret ; NP -_lbnMulSub1_32 endp - - - -;; Two-word by one-word divide. Stores quotient, returns remainder. -;; BNWORD32 lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d) -;; 4 8 12 16 -align 4 -_lbnDiv21_32 proc near - mov edx,[esp+8] ; U Load nh - mov eax,[esp+12] ; V Load nl - mov ecx,[esp+4] ; U Load q - div DWORD PTR [esp+16] ; NP - mov [ecx],eax ; U Store quotient - mov eax,edx ; V Return remainder - ret -_lbnDiv21_32 endp - -;; Multi-word by one-word remainder. -;; This speeds up key generation. It's not worth unrolling and so on; -;; using 32-bit divides is enough of a speedup. -;; -;; The modulus (in ebp) is often 16 bits. Given that the dividend is 32 -;; bits, the chances of saving the first divide because the high word of the -;; dividend is less than the modulus are low enough it's not worth taking -;; the cycles to test for it. -;; -;; unsigned lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d) -;; 4 8 12 -align 4 -_lbnModQ_32 proc near - mov eax,[esp+4] ; U Load n - push ebp ; V - mov ebp,[esp+12] ; U Load len - push esi ; V - lea esi,[ebp*4+eax-4] ; U - mov ecx,[esp+20] ; V Load d - xor edx,edx ; U Clear edx for first iteration -modq32_loop: - mov eax,[esi] ; U Load new low word for divide - sub esi,4 ; V - div ecx ; NP edx = edx:eax % ecx - dec ebp ; U - jnz SHORT modq32_loop ; V - - pop esi ; U - mov eax,edx ; V Return remainder in eax - pop ebp ; U - ret ; NP -_lbnModQ_32 endp - - end diff --git a/libs/libzrtp/third_party/bnlib/lbn80386.h b/libs/libzrtp/third_party/bnlib/lbn80386.h deleted file mode 100644 index 75c4f8a046..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn80386.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn80386.h - This file defines the interfaces to the 80386 - * assembly primitives. It is intended to be included in "lbn.h" - * via the "#include BNINCLUDE" mechanism. - */ - -#define BN_LITTLE_ENDIAN 1 - -typedef unsigned long bnword32; -#define BNWORD32 bnword32 - -/* MS-DOS needs the calling convention described to it. */ -#ifndef MSDOS -#ifdef __MSDOS -#define MSDOS 1 -#endif -#endif -#ifndef MSDOS -#ifdef __MSDOS__ -#define MSDOS 1 -#endif -#endif - -/* By MS-DOS, we mean 16-bit brain-dead MS-DOS. Not 32-bit good things. */ -#ifdef __GO32 -#undef MSDOS -#endif -#ifdef __GO32__ -#undef MSDOS -#endif - -#ifdef MSDOS -#define CDECL __cdecl -#else -#define CDECL /*nothing*/ -#endif - -#ifdef __cplusplus -/* These assembly-language primitives use C names */ -extern "C" { -#endif - -/* Function prototypes for the asm routines */ -void CDECL -lbnMulN1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulN1_32 lbnMulN1_32 - -bnword32 CDECL -lbnMulAdd1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulAdd1_32 lbnMulAdd1_32 - -bnword32 CDECL -lbnMulSub1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulSub1_32 lbnMulSub1_32 - -bnword32 CDECL -lbnDiv21_32(bnword32 *q, bnword32 nh, bnword32 nl, bnword32 d); -#define lbnDiv21_32 lbnDiv21_32 - -unsigned CDECL -lbnModQ_32(bnword32 const *n, unsigned len, bnword32 d); -#define lbnModQ_32 lbnModQ_32 - -#ifdef __cplusplus -} -#endif - - -#if __GNUC__ -/* - * Use the (massively cool) GNU inline-assembler extension to define - * inline expansions for various operations. - * - * The massively cool part is that the assembler can have inputs - * and outputs, and you specify the operands and which effective - * addresses are legal and they get substituted into the code. - * (For example, some of the code requires a zero. Rather than - * specify an immediate constant, the expansion specifies an operand - * of zero which can be in various places. This lets GCC use an - * immediate zero, or a register which contains zero if it's available.) - * - * The syntax is asm("asm_code" : outputs : inputs : trashed) - * %0, %1 and so on in the asm code are substituted by the operands - * in left-to-right order (outputs, then inputs). - * The operands contain constraint strings and values to use. - * Outputs must be lvalues, inputs may be rvalues. In the constraints: - * "a" means that the operand must be in eax. - * "d" means that the operand must be in edx. - * "g" means that the operand may be any effective address. - * "=" means that the operand is assigned to. - * "%" means that this operand and the following one may be - * interchanged if desirable. - * "bcDSmn" means that the operand must be in ebx, ecx, esi, edi, memory, - * or an immediate constant. (This is almost the same as "g" - * but allowing it in eax wouldn't help because x is already - * assigned there, and it must not be in edx, since edx is - * overwritten by the multiply before a and b are read.) - * - * Note that GCC uses AT&T assembler syntax, which is rather - * different from Intel syntax. The length (b, w or l) of the - * operation is appended to the opcode, and the *second* operand - * is the destination, not the first. Finally, the register names - * are all preceded with "%". (Doubled here because % is a - * magic character.) - */ - -/* (ph<<32) + pl = x*y */ -#define mul32_ppmm(ph,pl,x,y) \ - __asm__("mull %3" : "=d"(ph), "=a"(pl) : "%a"(x), "g"(y)) - -/* (ph<<32) + pl = x*y + a */ -#define mul32_ppmma(ph,pl,x,y,a) \ - __asm__("mull %3\n\t" \ - "addl %4,%%eax\n\t" \ - "adcl %5,%%edx" \ - : "=&d"(ph), "=a"(pl) \ - : "%a"(x), "g"(y), "bcDSmn"(a), "bcDSmn"(0)) - -/* (ph<<32) + pl = x*y + a + b */ -#define mul32_ppmmaa(ph,pl,x,y,a,b) \ - __asm__("mull %3\n\t" \ - "addl %4,%%eax\n\t" \ - "adcl %6,%%edx\n\t" \ - "addl %5,%%eax\n\t" \ - "adcl %6,%%edx" \ - : "=&d"(ph), "=a"(pl) \ - : "%a"(x), "g"(y), "%bcDSmn"(a), "bcDSmn"(b), "bcDSmn"(0)) - -/* q = ((nh<<32) + nl) / d, return remainder. nh guaranteed < d. */ -#undef lbnDiv21_32 -#define lbnDiv21_32(q,nh,nl,d) \ - ({unsigned _; \ - __asm__("divl %4" : "=d"(_), "=a"(*q) : "d"(nh), "a"(nl), "g"(d)); \ - _;}) - -/* No quotient, just return remainder ((nh<<32) + nl) % d */ -#define lbnMod21_32(nh,nl,d) \ - ({unsigned _; \ - __asm__("divl %3" : "=d"(_) : "d"(nh), "a"(nl), "g"(d) : "ax"); \ - _;}) - -#endif /* __GNUC__ */ diff --git a/libs/libzrtp/third_party/bnlib/lbn80386.s b/libs/libzrtp/third_party/bnlib/lbn80386.s deleted file mode 100644 index 92dd5d4a64..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn80386.s +++ /dev/null @@ -1,394 +0,0 @@ -### Copyright (c) 1995, Colin Plumb. -### For licensing and other legal details, see the file legal.c. -### -### Assembly primitives for bignum library, 80386 family, 32-bit code. -### -### Several primitives are included here. Only lbnMulAdd1 is *really* -### critical, but once that's written, lnmMulN1 and lbnMulSub1 are quite -### easy to write as well, so they are included here as well. -### lbnDiv21 and lbnModQ are so easy to write that they're included, too. -### -### All functions here are for 32-bit flat mode. I.e. near code and -### near data, although the near offsets are 32 bits. -### Preserved registers are esp, ebp, esi, edi and ebx. That last -### is needed by ELF for PIC, and differs from the IBM PC calling -### convention. - -# Different assemblers have different conventions here -align4=4 # could be 2 or 4 -align8=8 # could be 3 or 8 -align16=16 # cound be 4 or 16 - - -.text - -# We declare each symbol with two names, to deal with ELF/a.out variances. - .globl lbnMulN1_32 - .globl _lbnMulN1_32 - .globl lbnMulAdd1_32 - .globl _lbnMulAdd1_32 - .globl lbnMulSub1_32 - .globl _lbnMulSub1_32 - .globl lbnDiv21_32 - .globl _lbnDiv21_32 - .globl lbnModQ_32 - .globl _lbnModQ_32 - -## Register usage: -## %eax - low half of product -## %ebx - carry to next iteration -## %ecx - multiplier (k) -## %edx - high half of product -## %esi - source pointer -## %edi - dest pointer -## %ebp - loop counter -## -## Stack frame: -## +--------+ %esp+20 %esp+24 %esp+28 %esp+32 %esp+36 -## | k | -## +--------+ %esp+16 %esp+20 %esp+24 %esp+28 %esp+32 -## | len | -## +--------+ %esp+12 %esp+16 %esp+20 %esp+24 %esp+28 -## | in | -## +--------+ %esp+8 %esp+12 %esp+16 %esp+20 %esp+24 -## | out | -## +--------+ %esp+4 %esp+8 %esp+12 %esp+16 %esp+20 -## | return | -## +--------+ %esp %esp+4 %esp+8 %esp+12 %esp+16 -## | %esi | -## +--------+ %esp %esp+4 %esp+8 %esp+12 -## | %ebp | -## +--------+ %esp %esp+4 %esp+8 -## | %ebx | -## +--------+ %esp %esp+4 -## | %edi | -## +--------+ %esp - - .align align16 -lbnMulN1_32: -_lbnMulN1_32: - pushl %esi # U - movl 12(%esp),%esi # V load in - pushl %ebp # U - movl 20(%esp),%ebp # V load len - pushl %ebx # U - movl 28(%esp),%ecx # V load k - pushl %edi # U - movl 20(%esp),%edi # V load out - -## First multiply step has no carry in. - movl (%esi),%eax # V - leal -4(,%ebp,4),%ebx # U loop unrolling - mull %ecx # NP first multiply - movl %eax,(%edi) # U - andl $12,%ebx # V loop unrolling - - addl %ebx,%esi # U loop unrolling - addl %ebx,%edi # V loop unrolling - - jmp *m32_jumptable(%ebx) # NP loop unrolling - - .align align4 -m32_jumptable: - .long m32_case0 - .long m32_case1 - .long m32_case2 - .long m32_case3 - - nop - .align align8 - nop - nop - nop # Get loop nicely aligned - -m32_case0: - subl $4,%ebp # U - jbe m32_done # V - -m32_loop: - movl 4(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - addl $16,%esi # U - addl $16,%edi # V - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - adcl $0,%edx # U - movl %eax,-12(%edi) # V -m32_case3: - movl -8(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - adcl $0,%edx # U - movl %eax,-8(%edi) # V -m32_case2: - movl -4(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - adcl $0,%edx # U - movl %eax,-4(%edi) # V -m32_case1: - movl (%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - adcl $0,%edx # U - movl %eax,(%edi) # V - - subl $4,%ebp # U - ja m32_loop # V - -m32_done: - movl %edx,4(%edi) # U - popl %edi # V - popl %ebx # U - popl %ebp # V - popl %esi # U - ret # NP - - - .align align16 -lbnMulAdd1_32: -_lbnMulAdd1_32: - - pushl %esi # U - movl 12(%esp),%esi # V load in - pushl %edi # U - movl 12(%esp),%edi # V load out - pushl %ebp # U - movl 24(%esp),%ebp # V load len - pushl %ebx # U - movl 32(%esp),%ecx # V load k - -## First multiply step has no carry in. - movl (%esi),%eax # V - movl (%edi),%ebx # U - mull %ecx # NP first multiply - addl %eax,%ebx # U - leal -4(,%ebp,4),%eax # V loop unrolling - adcl $0,%edx # U - andl $12,%eax # V loop unrolling - movl %ebx,(%edi) # U - - addl %eax,%esi # V loop unrolling - addl %eax,%edi # U loop unrolling - - jmp *ma32_jumptable(%eax) # NP loop unrolling - - .align align4 -ma32_jumptable: - .long ma32_case0 - .long ma32_case1 - .long ma32_case2 - .long ma32_case3 - - .align align8 - nop - nop - nop # To align loop properly - - -ma32_case0: - subl $4,%ebp # U - jbe ma32_done # V - -ma32_loop: - movl 4(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - addl $16,%esi # U - addl $16,%edi # V - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - movl -12(%edi),%ebx # V - adcl $0,%edx # U - addl %eax,%ebx # V - adcl $0,%edx # U - movl %ebx,-12(%edi) # V -ma32_case3: - movl -8(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - movl -8(%edi),%ebx # V - adcl $0,%edx # U - addl %eax,%ebx # V - adcl $0,%edx # U - movl %ebx,-8(%edi) # V -ma32_case2: - movl -4(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - movl -4(%edi),%ebx # V - adcl $0,%edx # U - addl %eax,%ebx # V - adcl $0,%edx # U - movl %ebx,-4(%edi) # V -ma32_case1: - movl (%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - movl (%edi),%ebx # V - adcl $0,%edx # U - addl %eax,%ebx # V - adcl $0,%edx # U - movl %ebx,(%edi) # V - - subl $4,%ebp # U - ja ma32_loop # V - -ma32_done: - popl %ebx # U - popl %ebp # V - movl %edx,%eax # U - popl %edi # V - popl %esi # U - ret # NP - - - .align align16 -lbnMulSub1_32: -_lbnMulSub1_32: - pushl %esi # U - movl 12(%esp),%esi # V load in - pushl %edi # U - movl 12(%esp),%edi # V load out - pushl %ebp # U - movl 24(%esp),%ebp # V load len - pushl %ebx # U - movl 32(%esp),%ecx # V load k - -/* First multiply step has no carry in. */ - movl (%esi),%eax # V - movl (%edi),%ebx # U - mull %ecx # NP first multiply - subl %eax,%ebx # U - leal -4(,%ebp,4),%eax # V loop unrolling - adcl $0,%edx # U - andl $12,%eax # V loop unrolling - movl %ebx,(%edi) # U - - addl %eax,%esi # V loop unrolling - addl %eax,%edi # U loop unrolling - - jmp *ms32_jumptable(%eax) # NP loop unrolling - - .align align4 -ms32_jumptable: - .long ms32_case0 - .long ms32_case1 - .long ms32_case2 - .long ms32_case3 - - .align align8 - nop - nop - nop - -ms32_case0: - subl $4,%ebp # U - jbe ms32_done # V - -ms32_loop: - movl 4(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - addl $16,%esi # U - addl $16,%edi # V - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - movl -12(%edi),%ebx # V - adcl $0,%edx # U - subl %eax,%ebx # V - adcl $0,%edx # U - movl %ebx,-12(%edi) # V -ms32_case3: - movl -8(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - movl -8(%edi),%ebx # V - adcl $0,%edx # U - subl %eax,%ebx # V - adcl $0,%edx # U - movl %ebx,-8(%edi) # V -ms32_case2: - movl -4(%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - movl -4(%edi),%ebx # V - adcl $0,%edx # U - subl %eax,%ebx # V - adcl $0,%edx # U - movl %ebx,-4(%edi) # V -ms32_case1: - movl (%esi),%eax # U - movl %edx,%ebx # V Remember carry for later - mull %ecx # NP - addl %ebx,%eax # U Add carry in from previous word - movl (%edi),%ebx # V - adcl $0,%edx # U - subl %eax,%ebx # V - adcl $0,%edx # U - movl %ebx,(%edi) # V - - subl $4,%ebp # U - ja ms32_loop # V - -ms32_done: - popl %ebx # U - popl %ebp # V - movl %edx,%eax # U - popl %edi # V - popl %esi # U - ret # NP - -## Two-word by one-word divide. Stores quotient, returns remainder. -## BNWORD32 lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d) -## 4 8 12 16 - - .align align16 -lbnDiv21_32: -_lbnDiv21_32: - movl 8(%esp),%edx # U Load nh - movl 12(%esp),%eax # V Load nl - movl 4(%esp),%ecx # U Load q - divl 16(%esp) # NP - movl %eax,(%ecx) # U Store quotient - movl %edx,%eax # V Return remainder - ret - -## Multi-word by one-word remainder. -## This speeds up key generation. It's not worth unrolling and so on; -## using 32-bit divides is enough of a speedup. -## -## The modulus (in %ebp) is often 16 bits. Given that the dividend is 32 -## bits, the chances of saving the first divide because the high word of the -## dividend is less than the modulus are low enough it's not worth taking -## the cycles to test for it. -## -## unsigned lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d) -## 4 8 12 - .align align16 -lbnModQ_32: -_lbnModQ_32: - movl 4(%esp),%eax # U Load n - pushl %ebp # V - movl 12(%esp),%ebp # U Load len - pushl %esi # V - leal -4(%eax,%ebp,4),%esi # U - movl 20(%esp),%ecx # V Load d - xorl %edx,%edx # U Clear MSW for first divide -modq32_loop: - movl (%esi),%eax # U - subl $4,%esi # V - divl %ecx # NP - decl %ebp # U - jnz modq32_loop # V - - popl %esi # U - movl %edx,%eax # V - popl %ebp # U - ret # NP diff --git a/libs/libzrtp/third_party/bnlib/lbn8086.asm b/libs/libzrtp/third_party/bnlib/lbn8086.asm deleted file mode 100644 index 36497815c3..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn8086.asm +++ /dev/null @@ -1,1038 +0,0 @@ -;;; Copyright (c) 1995, Colin Plumb. -;;; For licensing and other legal details, see the file legal.c. -;;; -;;; Assembly primitives for bignum library, 80x86 family. -;;; -;;; Several primitives are included here. Only lbnMulAdd1 is *really* -;;; critical, but once that's written, lnmMul1 and lbnSub1 are quite -;;; easy to write as well, so they are included here as well. -;;; lbnDiv21 and lbnModQ are so easy to write that they're included, too. -;;; -;;; All functions here are for large code, large data. -;;; All use standard "cdecl" calling convention: arguments pushed on the -;;; stack (ss:sp) right to left (the leftmost agrument at the lowest address) -;;; and popped by the caller, return values in ax or dx:ax, and register -;;; usage as follows: -;;; -;;; Callee-save (preserved by callee if needed): -;;; ss, esp, cs, eip, ds, esi, edi, ebp, high byte of FLAGS except DF, -;;; all other registers (CRx, DRx, TRx, IDT, GDT, LDT, TR, etc.). -;;; Caller-save (may be corrupted by callee): -;;; es, eax, ebx, ecx, edx, low byte of flags (SF, ZF, AF, PF, CF) -;;; -;;; The direction flag (DF) is either preserved or cleared. -;;; I'm not sure what the calling convention is for fs and gs. This -;;; code never alters them. - -;; Not all of this code has to be '386 code, but STUPID FUCKING MASM (5.0) -;; gives an error if you change in the middle of a segment. Rather than -;; fight the thing, just enable '386 instructions everywhere. (And lose -;; the error checking.) -.386 - -_TEXT segment para public use16 'CODE' ; 16-byte aligned because '486 cares - assume cs:_TEXT - - public _lbnMulN1_16 - public _lbnMulAdd1_16 - public _lbnMulSub1_16 - public _lbnDiv21_16 - public _lbnModQ_16 - - public _lbnMulN1_32 - public _lbnMulAdd1_32 - public _lbnMulSub1_32 - public _lbnDiv21_32 - public _lbnModQ_32 - - public _not386 - - -;; Prototype: -;; BNWORD16 -;; lbnMulAdd_16(BNWORD16 *out, BNWORD16 *in, unsigned len, BNWORD16 k) -;; -;; Multiply len words of "in" by k and add to len words of "out"; -;; return the len+1st word of carry. All pointers are to the least- -;; significant ends of the appropriate arrays. len is guaraneed > 0. -;; -;; This 16-bit code is optimized for an 8086/80286. It will not be run -;; on 32-bit processors except for debugging during development. -;; -;; NOTE that it may be possible to assume that the direction flag is clear -;; on entry; this would avoid the need for the cld instructions. Hoewever, -;; the Microsoft C libraries require that the direction flag be clear. -;; Thus, lbnModQ_16 clears it before returning. -;; -;; Stack frame: -;; +--------+ bp+18 -;; | k | -;; +--------+ bp+16 -;; | len | -;; +--------+ bp+14 -;; | | -;; +- in -+ -;; | | -;; +--------+ bp+10 -;; | | -;; +- out -+ -;; | | -;; +--------+ bp+6 -;; | | -;; +-return-+ -;; | | -;; +--------+ bp+2 -;; | old bp | -;; +--------+ bp -;; -;; Register usage for lbnMul1_16: -;; ds:[si] in -;; es:[di] out -;; bp k -;; cx loop counter (len/4) -;; dx,ax high,low parts of product -;; bx carry from previous multiply iteration -;; -;; Register usage for lbnMulAdd1_16 and lbnMulSub1_16: -;; ds:[si] in -;; es:[bx+si] out -;; bp k -;; cx loop counter (len/4) -;; dx,ax high,low parts of product -;; di carry from previous multiply iteration -;; -;; The reson for the difference is that straight mul can use stosw, but -;; the multiply and add or multiply and subtract add the result in, so -;; they have to reference es:[di] to add it in. -;; -;; The options are either "add ax,es:[di]; stosw" or "add es:[di],ax; -;; add di,2"; both take 10 cycles on an 80286, 27 on an 8086 and 35 on -;; an 8088 although the former is preferred since it's one byte smaller. -;; However, using [bx+si] is even faster; "add es:[bx+si],ax" takes -;; 7 cycles on an 80286, 25 on an 8086 and 33 on an 8088, as well as -;; being the smallest. (Of course, stosw, at 3 on an 80286, 11 on an -;; 8086 amd 15 on an 8088 wins easily in the straight multiply case over -;; mov es:[bx+si],ax, which takes 3/18/22 cycles and is larger to boot.) -;; -;; Most of these register assignments are driven by the 8086's instruction -;; set. The only really practical variation would be to put the multiplier -;; k into bx or di and use bp for carry, but if someone can make a faster -;; Duff's device using a lookup table, bx and di are useful because indexing -;; off them is more flexible than bp. -;; -;; Overview of code: -;; -;; len is guaranteed to be at least 1, so do the first multiply (with no -;; carry in) unconditionally. Then go to a min loop unrolled 4 times, -;; jumping into the middle using a variant of Duff's device. -;; -;; The loop is constructed using the loop instruction, which does -;; "} while (--cnt)". This means that we have to divide the count -;; by 4, and increment it so it doesn't start at 0. To gain a little -;; bit more efficiency, we actually increment the count by 2, so the -;; minimum possible value is 3, which will be shifted down to produce 0. -;; usually in Duff's device, if the number of iterations is a multiple -;; of the unrolling factor, you branch to just before the loop conditional -;; and let it handle the case of 0. Here, we have a special test for 0 -;; at the head of the loop and fall through into the top of the loop -;; if it passes. -;; -;; Basically, with STEP being a multiply step, it's: -;; -;; STEP; -;; count += 2; -;; mod4 = count % 4; -;; count /= 4; -;; switch(mod4) { -;; case 3: -;; if (count) { -;; do { -;; STEP; -;; case 2: -;; STEP; -;; case 1: -;; STEP; -;; case 0: -;; STEP; -;; } while (--count); -;; } -;; } -;; -;; The switch() is actually done by two levels of branch instructions -;; rather than a lookup table. - -_lbnMulN1_16 proc far - - push bp - mov bp,sp - push ds - push si - push di - cld - - les di,[bp+6] ; out - lds si,[bp+10] ; in - mov cx,[bp+14] ; len - mov bp,[bp+16] ; k - -;; First multiply step has no carry in - lodsw - mul bp - stosw - -;; The switch() for Duff's device starts here -;; Note: this *is* faster than a jump table for an 8086 and '286. -;; 8086: jump table: 44 cycles; this: 27/29/31/41 -;; 80286: jump table: 25 cycles; this: 17/17/20/22 - shr cx,1 - jc SHORT m16_odd - - inc cx - shr cx,1 - jc SHORT m16_case2 - jmp SHORT m16_case0 - - nop ; To align loop -m16_odd: - inc cx - shr cx,1 - jnc SHORT m16_case1 - jz SHORT m16_done ; Avoid entire loop in this case - -m16_loop: - lodsw - mov bx,dx ; Remember carry for later - mul bp - add ax,bx ; Add carry in from previous word - adc dx,0 - stosw -m16_case2: - lodsw - mov bx,dx ; Remember carry for later - mul bp - add ax,bx ; Add carry in from previous word - adc dx,0 - stosw -m16_case1: - lodsw - mov bx,dx ; Remember carry for later - mul bp - add ax,bx ; Add carry in from previous word - adc dx,0 - stosw -m16_case0: - lodsw - mov bx,dx ; Remember carry for later - mul bp - add ax,bx ; Add carry in from previous word - adc dx,0 - stosw - - loop m16_loop - -m16_done: - mov ax,dx - stosw ; Store last word - pop di - pop si - pop ds - pop bp - ret - -_lbnMulN1_16 endp - - - align 2 -_lbnMulAdd1_16 proc far - - push bp - mov bp,sp - push ds - push si - push di - cld - - les bx,[bp+6] ; out - lds si,[bp+10] ; in - mov cx,[bp+14] ; len - mov bp,[bp+16] ; k - -;; First multiply step has no carry in - lodsw - mul bp - add es:[bx],ax ; This time, store in [bx] directly - adc dx,0 - sub bx,si ; Prepare to use [bx+si]. - -;; The switch() for Duff's device starts here -;; Note: this *is* faster than a jump table for an 8086 and '286. -;; 8086: jump table: 44 cycles; this: 27/29/31/41 -;; 80286: jump table: 25 cycles; this: 17/17/20/22 - shr cx,1 - jc SHORT ma16_odd - - inc cx - shr cx,1 - jc SHORT ma16_case2 - jmp SHORT ma16_case0 - -ma16_odd: - inc cx - shr cx,1 - jnc SHORT ma16_case1 - jz SHORT ma16_done ; Avoid entire loop in this case - -ma16_loop: - lodsw - mov di,dx ; Remember carry for later - mul bp - add ax,di ; Add carry in from previous word - adc dx,0 - add es:[bx+si],ax - adc dx,0 -ma16_case2: - lodsw - mov di,dx ; Remember carry for later - mul bp - add ax,di ; Add carry in from previous word - adc dx,0 - add es:[bx+si],ax - adc dx,0 -ma16_case1: - lodsw - mov di,dx ; Remember carry for later - mul bp - add ax,di ; Add carry in from previous word - adc dx,0 - add es:[bx+si],ax - adc dx,0 -ma16_case0: - lodsw - mov di,dx ; Remember carry for later - mul bp - add ax,di ; Add carry in from previous word - adc dx,0 - add es:[bx+si],ax - adc dx,0 - - loop ma16_loop - -ma16_done: - mov ax,dx - pop di - pop si - pop ds - pop bp - ret - -_lbnMulAdd1_16 endp - - align 2 -_lbnMulSub1_16 proc far - - push bp - mov bp,sp - push ds - push si - push di - cld - - les bx,[bp+6] ; out - lds si,[bp+10] ; in - mov cx,[bp+14] ; len - mov bp,[bp+16] ; k - -;; First multiply step has no carry in - lodsw - mul bp - sub es:[bx],ax ; This time, store in [bx] directly - adc dx,0 - sub bx,si ; Prepare to use [bx+si]. - -;; The switch() for Duff's device starts here -;; Note: this *is* faster than a jump table for an 8086 and '286. -;; 8086: jump table: 44 cycles; this: 27/29/31/41 -;; 80286: jump table: 25 cycles; this: 17/17/20/22 - shr cx,1 - jc SHORT ms16_odd - - inc cx - shr cx,1 - jc SHORT ms16_case2 - jmp SHORT ms16_case0 - -ms16_odd: - inc cx - shr cx,1 - jnc SHORT ms16_case1 - jz SHORT ms16_done ; Avoid entire loop in this case - -ms16_loop: - lodsw - mov di,dx ; Remember carry for later - mul bp - add ax,di ; Add carry in from previous word - adc dx,0 - sub es:[bx+si],ax - adc dx,0 -ms16_case2: - lodsw - mov di,dx ; Remember carry for later - mul bp - add ax,di ; Add carry in from previous word - adc dx,0 - sub es:[bx+si],ax - adc dx,0 -ms16_case1: - lodsw - mov di,dx ; Remember carry for later - mul bp - add ax,di ; Add carry in from previous word - adc dx,0 - sub es:[bx+si],ax - adc dx,0 -ms16_case0: - lodsw - mov di,dx ; Remember carry for later - mul bp - add ax,di ; Add carry in from previous word - adc dx,0 - sub es:[bx+si],ax - adc dx,0 - - loop ms16_loop - -ms16_done: - mov ax,dx - pop di - pop si - pop ds - pop bp - ret - -_lbnMulSub1_16 endp - -;; Two-word by one-word divide. Stores quotient, returns remainder. -;; BNWORD16 lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d) -;; 4 8 10 12 - align 2 -_lbnDiv21_16 proc far - mov cx,bp ; bp NOT pushed; note change in offsets - mov bp,sp - mov dx,[bp+8] - mov ax,[bp+10] - div WORD PTR [bp+12] - les bx,[bp+4] - mov es:[bx],ax - mov ax,dx - mov bp,cx - ret - - nop ; To align loop in lbnModQ properly - -_lbnDiv21_16 endp - -;; Multi-word by one-word remainder. -;; BNWORD16 lbnModQ_16(BNWORD16 *q, unsigned len, unsigned d) -;; 6 10 12 -_lbnModQ_16 proc far - push bp - mov bp,sp - push ds - mov bx,si - mov cx,10[bp] ; load len - lds si,6[bp] ; load q - std ; loop MSW to LSW - add si,cx - mov bp,12[bp] ; load d - add si,cx - xor dx,dx ; Set up for first divide - sub si,2 ; Adjust pointer to point to MSW - - lodsw ; Load first word - - cmp ax,bp ; See if we can skip first divide - jnc SHORT modq16_inner ; No such luck - mov dx,ax ; Yes! Modulus > input, so remainder = input - dec cx ; Do loop - jz SHORT modq16_done - -modq16_loop: - lodsw -modq16_inner: - div bp - loop modq16_loop -modq16_done: - pop ds - mov ax,dx ; Return remainder - pop bp - mov si,bx - cld ; Microsoft C's libraries assume this - ret - -_lbnModQ_16 endp - - -;; Similar, but using 32-bit operations. -;; -;; The differences are that the switch() in Duff's device is done using -;; a jump table, and lods is not used because it's slower than load and -;; increment. The pointers are only updated once per loop; offset -;; addressing modes are used, since they're no slower. [di] is used -;; instead of [bx+si] because the extra increment of di take only one -;; cycle per loop a '486, while [bx+si] takes one extra cycle per multiply. -;; -;; The register assignments are also slightly different: -;; -;; es:[si] in -;; ds:[di] out -;; ecx k -;; bp loop counter (len/4) -;; edx,eax high,low parts of product -;; ebx carry word from previous multiply iteration -;; -;; The use of bp for a loop counter lets all the 32-bit values go -;; in caller-save registers, so there's no need to do any 32-bit -;; saves and restores. Using ds:di for the destination saves one -;; segment override in the lbnMulN1_32 code, since there's one more -;; store to [di] than load from es:[si]. -;; -;; Given the number of 32-bit references that this code uses, optimizing -;; it for the Pentium is interesting, because the Pentium has a very -;; inefficient implementation of prefix bytes. Each prefix byte, with -;; the exception of 0x0f *>> on conditional branch instructions ONLY <<* -;; is a 1-cycle non-pairiable instruction. Which has the effect of -;; forcing the instruction it's on into the U pipe. But this code uses -;; *lots* of prefix bytes, notably the 0x66 operand size override. -;; -;; For example "add [di],eax" is advised against in Intel's optimization -;; papers, because it takes 3 cycles and 2 of them are not pairable. -;; But any longer sequence would have a prefix byte on every instruction, -;; resulting in even more non-pairable cycles. Also, only two instructions -;; in the multiply kernel can go in the V pipe (the increments of si and -;; di), and they're already there, so the pairable cycles would be wasted. -;; -;; Things would be *quite* different in native 32-bit mode. -;; -;; All instructions that could go in the V pipe that aren't there are -;; marked. -;; -;; The setup code is quite intricately interleaved to get the best possible -;; performance out of a Pentium. If you want to follow the code, -;; pretend that the sections actually come in the following order: -;; 1) prologue (push registers) -;; 2) load (fetch arguments) -;; 3) first multiply -;; 4) loop unrolling -;; -;; The loop unrolling setup consists of taking the count, adjusting -;; it to account for the first multiply, and splitting it into -;; two parts: the high bits are a loop count, while the low bits are -;; used to find the right entry in the Duff's device jump table and -;; to adjust the initial data pointers. -;; -;; Known slack: There is one instruction in the prologue and one in -;; the epilogue that could go in the V pipe if I could find a U-pipe -;; instruction to pair them with, but all the U-pipe instructions -;; are already paired, so it looks difficult. -;; -;; There is a cycle of Address Generation Interlock in the lbnMulN1_32 -;; code on the Pentium (not on a '486). I can't figure out how to -;; get rid of it without wasting time elsewhere. The problem is that -;; the load of bx needs to be done as soon as possible to let it -;; be set up in time for the switch(). The other problem is the -;; epilogue code which can waste time if the order of the pushed -;; registers is diddled with so that ds doesn't come between si and di. -;; -;; The increment of si after the last load is redundant, and the -;; copy of the high word of the product to the carry after the last -;; multiply is likewise unnecessary. -;; -;; In these cases, the operations were done that way in order to remove -;; cycles from the loop on the '486 and/or Pentium, even though it costs -;; a few overhead cycles on a '386. -;; The increment fo si has to be done early because a load based on si -;; is the first thing in any given multiply step, and the address -;; generation interlock on the '486 and Pentium requires that a full -;; cycle (i.e. possibly two instructions on a Pentium) pass between -;; incrementing a register and using it in an address. -;; This saves one cycle per multiply on a '486 and Pentium, and costs -;; 2 cycles per call to the function on a '386 and 1 cycle on a '486. -;; -;; The carry word is copied where it is so that the decrement of the loop -;; counter happens in the V pipe. The instruction between the decrement -;; of the loop counter and the branch should be a U-pipe instruction that -;; doesn't affect the flags. Thus, the "mov" was rotated down from -;; the top of the loop to fill the slot. -;; This is a bit more marginal: it saves one cycle per loop iteration on -;; a Pentium, and costs 2 cycles per call on a '386, '486 or Pentium. -;; -;; The same logic applies to the copy of the carry and increment of si -;; before the test, in case 0, for skipping the loop entirely. -;; It makes no difference in speed if the loop is executed, but -;; incrementing si before saves an address generation interlock cycle -;; On a '486 and Pentium in the case that the loop is executed. -;; And the loop is executed more often than not. -;; -;; Given that just one multiply on a '386 takes 12 to 41 cycles (with the -;; average being very much at the high end of that) 4 cycles of additional -;; overhead per call is not a big deal. -;; -;; On a Pentium, it would actually be easier to *not* unroll the loop -;; at all, since the decrement and compare are completely hidden -;; in the V-pipe and it wouldn't cost anything to do them more often. -;; That would save the setup for the unrolling and Duff's device at the -;; beginning. But the overhead for that is pretty minor: ignoring what's -;; hidden in the V pipe, it's two cycles plus the indirect jump. -;; Not too much, and special-casing the pentium is quite a hassle. -;; (For starters, you have to detect it, and since you're probably in -;; V86 mode, without access to the EFLAGS register to test the CPUID bit.) - - - align 16 -_lbnMulN1_32 proc far - - push bp ; U prologue ** Could be V - mov bp,sp ; V prologue - push si ; U prologue ** Could be V - mov bx,[bp+14] ; U load len ** Could be V (AGI!)r - push ds ; NP prologue - les si,[bp+10] ; NP load in - mov ecx,[bp+16] ; U load k - dec bx ; V loop unrolling - shl bx,2 ; U loop unrolling - push di ; V prologue - lds di,[bp+6] ; NP load out - mov bp,bx ; U loop unrolling ** Could be V - and bx,12 ; V loop unrolling - -;; First multiply step has no carry in. - mov eax,es:[si] ; U first multiply - add si,bx ; V loop unrolling - mul ecx ; NP first multiply - mov [di],eax ; U first multiply - add di,bx ; V loop unrolling - -;; The switch() for Duff's device. This jump table is (slightly!) faster -;; than a bunch of branches on a '386 and '486, and is probably better yet -;; on higher processors. - jmp WORD PTR cs:m32_jumptable[bx] ; NP loop unrolling - align 2 -m32_jumptable: - dw OFFSET m32_case0, 0 - dw OFFSET m32_case1, 0 - dw OFFSET m32_case2, 0 - dw OFFSET m32_case3, 0, 0, 0, 0 ; Get loop aligned properly - -m32_case0: - add si,16 ; U Fix up si ** Could be V - test bp,bp ; V - mov ebx,edx ; U Remember carry for later - jbe SHORT m32_done ; V Avoid entire loop if loop count is 0 - -m32_loop: - mov eax,es:[si-12] ; U - add di, 16 ; V - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - mov [di-12],eax ; U -m32_case3: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si-8] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - mov [di-8],eax ; U -m32_case2: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si-4] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - mov [di-4],eax ; U -m32_case1: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - add si,16 ; V - mov [di],eax ; U - - sub bp,16 ; V - mov ebx,edx ; U Remember carry for later - ja m32_loop ; V - -m32_done: - mov [di+4],edx ; U - pop di ; V - pop ds ; NP - pop si ; U ** Could be V - pop bp ; V - ret ; NP - -_lbnMulN1_32 endp - - - align 16 -_lbnMulAdd1_32 proc far - - push bp ; U prologue ** Could be V - mov bp,sp ; V prologue - push ds ; NP prologue - - mov ecx,[bp+16] ; U load k - mov bx,[bp+14] ; V load len - push di ; U prologue ** Could be V - dec bx ; V loop unrolling - lds di,[bp+6] ; NP load out - shl bx,2 ; U loop unrolling - push si ; V prologue - les si,[bp+10] ; NP load in - - mov bp,bx ; U loop unrolling ** Could be V - and bx,12 ; V loop unrolling - -;; First multiply step has no carry in. - mov eax,es:[si] ; U first multiply - add si,bx ; V loop unrolling - mul ecx ; NP first multiply - add [di],eax ; U first multiply - adc edx,0 ; U first multiply - add di,bx ; V loop unrolling - -;; The switch() for Duff's device. This jump table is (slightly!) faster -;; than a bunch of branches on a '386 and '486, and is probably better yet -;; on higher processors. - jmp WORD PTR cs:ma32_jumptable[bx] ; NP loop unrolling - align 2 -ma32_jumptable: - dw OFFSET ma32_case0, 0 - dw OFFSET ma32_case1, 0 - dw OFFSET ma32_case2, 0 - dw OFFSET ma32_case3, 0, 0 ; To get loop aligned properly - -ma32_case0: - add si,16 ; U Fix up si ** Could be V - test bp,bp ; V - mov ebx,edx ; U Remember carry for later - jbe SHORT ma32_done ; V Avoid entire loop if loop count is 0 - -ma32_loop: - mov eax,es:[si-12] ; U - add di, 16 ; V - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - add [di-12],eax ; U - adc edx,0 ; U -ma32_case3: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si-8] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - add [di-8],eax ; U - adc edx,0 ; U -ma32_case2: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si-4] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - add [di-4],eax ; U - adc edx,0 ; U -ma32_case1: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - add si,16 ; V - add [di],eax ; U - adc edx,0 ; U - - sub bp,16 ; V - mov ebx,edx ; U Remember carry for later - ja ma32_loop ; V - -ma32_done: - pop si ; U ** Could be V - pop di ; V - mov ax,dx ; U return value low ** Could be V - pop ds ; NP - shr edx,16 ; U return value high - pop bp ; V - ret ; NP - -_lbnMulAdd1_32 endp - - - align 16 -_lbnMulSub1_32 proc far - - push bp ; U prologue ** Could be V - mov bp,sp ; V prologue - push ds ; NP prologue - - mov ecx,[bp+16] ; U load k - mov bx,[bp+14] ; V load len - push di ; U prologue ** Could be V - dec bx ; V loop unrolling - lds di,[bp+6] ; NP load out - shl bx,2 ; U loop unrolling - push si ; V prologue - les si,[bp+10] ; NP load in - - mov bp,bx ; U loop unrolling ** Could be V - and bx,12 ; V loop unrolling - -;; First multiply step has no carry in. - mov eax,es:[si] ; U first multiply - add si,bx ; V loop unrolling - mul ecx ; NP first multiply - sub [di],eax ; U first multiply - adc edx,0 ; U first multiply - add di,bx ; V loop unrolling - -;; The switch() for Duff's device. This jump table is (slightly!) faster -;; than a bunch of branches on a '386 and '486, and is probably better yet -;; on higher processors. - jmp WORD PTR cs:ms32_jumptable[bx] ; NP loop unrolling - align 2 -ms32_jumptable: - dw OFFSET ms32_case0, 0 - dw OFFSET ms32_case1, 0 - dw OFFSET ms32_case2, 0 - dw OFFSET ms32_case3, 0, 0 ; To get loop aligned properly - -ms32_case0: - add si,16 ; U Fix up si ** Could be V - test bp,bp ; V - mov ebx,edx ; U Remember carry for later - jbe SHORT ms32_done ; V Avoid entire loop if loop count is 0 - -ms32_loop: - mov eax,es:[si-12] ; U - add di, 16 ; V - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - sub [di-12],eax ; U - adc edx,0 ; U -ms32_case3: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si-8] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - sub [di-8],eax ; U - adc edx,0 ; U -ms32_case2: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si-4] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - sub [di-4],eax ; U - adc edx,0 ; U -ms32_case1: - mov ebx,edx ; U Remember carry for later - mov eax,es:[si] ; U - mul ecx ; NP - add eax,ebx ; U Add carry in from previous word - adc edx,0 ; U - add si,16 ; V - sub [di],eax ; U - adc edx,0 ; U - - sub bp,16 ; V - mov ebx,edx ; U Remember carry for later - ja ms32_loop ; V - -ms32_done: - pop si ; U ** Could be V - pop di ; V - mov ax,dx ; U return value low ** Could be V - pop ds ; NP - shr edx,16 ; U return value high - pop bp ; V - ret ; NP - -_lbnMulSub1_32 endp - - - -;; Just for interest's sake, here's a completely Pentium-optimized version. -;; In addition to being smaller, it takes 8 + (8+mul_time)*n cycles, as -;; compared to the 10 + jmp_time + (8+mul_time)*n cycles for the loop above. -;; (I don't know how long a 32x32->64 bit multiply or an indirect jump -;; take on a Pentium, so plug those numbers in.) -; align 2 -; nop ; To align loop nicely -;P_lbnMulAdd1_32 proc far -; -; push bp ; U prologue ** Could be V -; mov bp,sp ; V prologue -; push ds ; NP prologue -; mov ecx,[bp+16] ; U load k -; push si ; V prologue -; lds si,[bp+10] ; NP load in -; mov eax,[si] ; U first multiply -; push di ; V prologue -; mul ecx ; NP first multiply -; les di,[bp+6] ; NP load out -; add es:[di],eax ; U first multiply -; mov bp,[bp+14] ; V load len -; adc edx,0 ; U first multiply -; dec bp ; V -; mov ebx,edx ; U Remember carry for later -; je Pma32_done ; V -;Pma32_loop: -; mov eax,[si+4] ; U -; add di,4 ; V -; mul ecx ; NP -; add eax,ebx ; U Add carry in from previous word -; adc edx,0 ; U -; add si,4 ; V -; add es:[di],eax ; U -; adc edx,0 ; U -; dec bp ; V -; mov ebx,edx ; U Remember carry for later -; jne Pma32_loop ; V -;Pma32_done: -; pop di ; U ** Could be V -; pop si ; V -; pop ds ; NP -; mov ax,dx ; U return value low ** Could be V -; pop bp ; V -; shr edx,16 ; U return value high -; ret ; NP -; -;P_lbnMulAdd1_32 endp - - - -;; Two-word by one-word divide. Stores quotient, returns remainder. -;; BNWORD32 lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d) -;; 4 8 12 16 - align 16 -_lbnDiv21_32 proc far - mov cx,bp ; U bp NOT pushed; offsets differ - mov bp,sp ; V - ; AGI - mov edx,[bp+8] ; U - mov eax,[bp+12] ; U - div DWORD PTR [bp+16] ; NP - les bx,[bp+4] ; NP - mov es:[bx],eax ; U - mov ax,dx ; V - shr edx,16 ; U - mov bp,cx ; V - ret ; NP - - nop - nop - nop - nop ; Get lbnModQ_32 aligned properly - -_lbnDiv21_32 endp - -;; Multi-word by one-word remainder. -;; This speeds up key generation. It's not worth unrolling and so on; -;; using 32-bit divides is enough of a speedup. -;; -;; bp is used as a counter so that all the 32-bit values can be in -;; caller-save registers (eax, ecx, edx). bx is needed as a pointer. -;; -;; The modulus (in ebp) is 16 bits. Given that the dividend is 32 bits, -;; the chances of saving the first divide because the high word of the -;; dividend is less than the modulus are low enough it's not worth taking -;; the cycles to test for it. -;; -;; unsigned lbnModQ_32(BNWORD16 *q, unsigned len, unsigned d) -;; 6 10 12 -_lbnModQ_32 proc far - xor ecx,ecx ; U Clear ecx (really, the high half) - push bp ; V - mov edx,ecx ; U Clear high word for first divide - mov bp,sp ; V - push ds ; NP - lds ax,[bp+6] ; NP Load dividend pointer - mov bx,[bp+10] ; U Load count ** Could be V - sub ax,4 ; V Offset dividend pointer - mov cx,[bp+12] ; U Load modulus ** Could be V - mov bp,bx ; V Copy count - shl bx,2 ; U Shift index - add bx,ax ; U Add base ** Could be V -; lea bx,[eax+ebp*4-4]; U Move pointer to high word - -modq32_loop: - mov eax,[bx] ; U - sub bx,4 ; V - div ecx ; NP - dec bp ; U ** Could be V - jnz modq32_loop ; V -modq32_done: - pop ds ; NP - mov ax,dx ; U ** Could be V - pop bp ; V - ret ; NP - -_lbnModQ_32 endp - - -;; int not386(void) returns 0 on a 32-bit (386 or better) processor; -;; non-zero if an 80286 or lower. The Z flag is set to reflect -;; ax on return. This is only called once, so it doesn't matter how -;; it's aligned. - -_not386 proc far -;; -;; This first test detects 80x86 for x < 2. On the 8086 and '186, -;; "push sp" does "--sp; sp[0] = sp". On all later processors, it does -;; "sp[-1] = sp; --sp". -;; - push sp - pop ax - sub ax,sp - jne SHORT return - -;; This test is the key one. It will probably detect 8086, V30 and 80186 -;; as well as 80286, but I haven't had access to test it on any of those, -;; so it's protected by the well-known test above. It has been tested -;; on the 80286, 80386, 80486, Pentium and AMD tested it on their K5. -;; I have not been able to confirm effectiveness on the P6 yet, although -;; someone I spoke to at Intel said it should work. -;; -;; This test uses the fact that the '386 and above have a barrel shifter -;; to do shifts, while the '286 does left shifts by releated adds. -;; That means that on the '286, the auxilliary carry gets a copy of -;; bit 4 of the shift output, while on the '386 and up, it's trashed -;; (as it happens, set to 1) independent of the result. (It's documented -;; as undefined.) -;; -;; We do two shifts, which should produce different auxilliary carries -;; on a '286 and XOR them to see if they are different. Even on a -;; future processor that does something different with the aux carry -;; flag, it probably does something data-independent, so this will still -;; work. Note that all flags except aux carry are defined for shl -;; output and will be the same for both cases. - - mov al,4 - shl al,1 ; Expected to produce ac = 0 on a '286 - lahf - shl al,1 ; Expected to produce ac = 1 on a '286 - mov al,ah - lahf - xor al,ah ; Xor the flags together to detect the difference - mov ah,al ; Clear ah if al is clear, leave Z flag alone -return: - ret - -_not386 endp - -_TEXT ends - - end diff --git a/libs/libzrtp/third_party/bnlib/lbn8086.h b/libs/libzrtp/third_party/bnlib/lbn8086.h deleted file mode 100644 index 87960a4c3b..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn8086.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn8086.h - This file defines the interfaces to the 8086 - * assembly primitives for 16-bit MS-DOS environments. - * It is intended to be included in "lbn.h" - * via the "#include BNINCLUDE" mechanism. - */ - -#define BN_LITTLE_ENDIAN 1 - -#ifdef __cplusplus -/* These assembly-language primitives use C names */ -extern "C" { -#endif - -/* Set up the appropriate types */ -typedef unsigned short bnword16; -#define BNWORD16 bnword16 -typedef unsigned long bnword32; -#define BNWORD32 bnword32 - -void __cdecl __far -lbnMulN1_16(bnword16 __far *out, bnword16 const __far *in, - unsigned len, bnword16 k); -#define lbnMulN1_16 lbnMulN1_16 - -bnword16 __cdecl __far -lbnMulAdd1_16(bnword16 __far *out, bnword16 const __far *in, - unsigned len, bnword16 k); -#define lbnMulAdd1_16 lbnMulAdd1_16 - -bnword16 __cdecl __far -lbnMulSub1_16(bnword16 __far *out, bnword16 const __far *in, - unsigned len, bnword16 k); -#define lbnMulSub1_16 lbnMulSub1_16 - -bnword16 __cdecl __far -lbnDiv21_16(bnword16 __far *q, bnword16 nh, bnword16 nl, bnword16 d); -#define lbnDiv21_16 lbnDiv21_16 - -bnword16 __cdecl __far -lbnModQ_16(bnword16 const __far *n, unsigned len, bnword16 d); -#define lbnModQ_16 lbnModQ_16 - - - -void __cdecl __far -lbnMulN1_32(bnword32 __far *out, bnword32 const __far *in, - unsigned len, bnword32 k); -#define lbnMulN1_32 lbnMulN1_32 - -bnword32 __cdecl __far -lbnMulAdd1_32(bnword32 __far *out, bnword32 const __far *in, - unsigned len, bnword32 k); -#define lbnMulAdd1_32 lbnMulAdd1_32 - -bnword32 __cdecl __far -lbnMulSub1_32(bnword32 __far *out, bnword32 const __far *in, - unsigned len, bnword32 k); -#define lbnMulSub1_32 lbnMulSub1_32 - -bnword32 __cdecl __far -lbnDiv21_32(bnword32 __far *q, bnword32 nh, bnword32 nl, bnword32 d); -#define lbnDiv21_32 lbnDiv21_32 - -bnword16 __cdecl __far -lbnModQ_32(bnword32 const __far *n, unsigned len, bnword32 d); -#define lbnModQ_32 lbnModQ_32 - -int __cdecl __far not386(void); - -#ifdef __cplusplus -} -#endif diff --git a/libs/libzrtp/third_party/bnlib/lbn960jx.h b/libs/libzrtp/third_party/bnlib/lbn960jx.h deleted file mode 100644 index 2247a22d9a..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn960jx.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbn960jx.h - This file defines the interfaces to assembly primitives - * for the the Intel i960Jx series of processors. In fact, these thould - * work on any i960 series processor, but haven't been tested. - * It is intended to be included in "lbn.h" - * via the "#include BNINCLUDE" mechanism. - */ - -#define BN_LITTLE_ENDIAN 1 - -typedef unsigned long bnword32; -#define BNWORD32 bnword32; - - -#ifdef __cplusplus -/* These assembly-language primitives use C names */ -extern "C" { -#endif - -/* Function prototypes for the asm routines */ -void -lbnMulN1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulN1_32 lbnMulN1_32 - -bnword32 -lbnMulAdd1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulAdd1_32 lbnMulAdd1_32 - -bnword32 -lbnMulSub1_32(bnword32 *out, bnword32 const *in, unsigned len, bnword32 k); -#define lbnMulSub1_32 lbnMulSub1_32 - -#ifdef __cplusplus -} -#endif diff --git a/libs/libzrtp/third_party/bnlib/lbn960jx.s b/libs/libzrtp/third_party/bnlib/lbn960jx.s deleted file mode 100644 index 9073a90abe..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbn960jx.s +++ /dev/null @@ -1,253 +0,0 @@ -# Copyright (c) 1995 Colin Plumb. All rights reserved. -# For licensing and other legal details, see the file legal.c. -# -# Assembly-language bignum primitives for the i960 Jx series. -# -# The Jx series is fairly straightforward single-instruction-issue -# implementation, with a 1-cycle-issue 4-cycle-latency non-pipelined -# multiplier that we can use. Note also that loads which hit in the -# cache have 2 cycles of latency and stores stall until all pending -# loads are done. -# -# What is intensely annoying about the i960 is that it uses the same -# flags for all conditional branches (even compare-and-branch sets the -# flags) AND for the carry bit. Further, it is hard to manipulate -# that bit. -# -# Calling conventions: -# The r registers are all local, if you set them up. There's an alternative -# calling convention that uses bal (branch and link) and doesn't set them up. -# Currently, all of these functions are designed to work that way. -# g0-g7 are argument registers and volatile across calls. return in g0-g3. -# g8-g11 are extra argument registers, and volatile if used, but -# preserved if not. Here, they are not. -# g12 is used for PIC, and is preserved. -# g13 is a pointer to a structure return value, if used, and is volatile. -# g14 is magic, and is used as a return address in the branch-and-link -# convention, and as a pointer to an argument block if the arguments -# won't fit in registers, but is usually hardwired 0 and must be -# returned set to zero (0). -# g15 is the frame pointer, and shouldn't be messed with. -# The AC (condition codes) are all volatile. -# The fp registers are all volatile, but irrelevant. -# - -# BNWORD32 -# lbnMultAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -# This adds "k" * "in" to "len" words of "out" and returns the word of -# carry. -# -# For doing multiply-add, the 960 is a bit annoying because it uses -# the same status bits for the carry flag and for the loop indexing -# computation, and doesn't have an "add with carry out but not carry in" -# instruction. Fortunately, we can arrange to have the loop indexing -# leave the carry bit clear most of the time. -# -# The basic sequence of the loop is: -# 1. Multiply k * *in++ -> high, low -# 2. Addc carry word and carry bit to low -# 3. Addc carry bit to high, producing carry word (note: cannot generate carry!) -# 4. Addc low to *out++ -# -# Note that the carry bit set in step 4 is used in step 2. The only place -# in this loop that the carry flag isn't in use is between steps 3 and 4, -# so we have to rotate the loop to place the loop indexing operations here. -# (Which consist of a compare-and-decrement and a conditional branch.) -# The loop above ignores the details of when to do loads and stores, which -# have some flexibility, but must be carefully scheduled to avoid stalls. -# -# The first iteration has no carry word in, so it requires only steps 1 and 4, -# and since we begin the loop with step 4, it boils down to just step 1 -# followed by the loop indexing (which clears the carry bit in preparation -# for step 4). -# -# Arguments are passed as follows: -# g0 - out pointer -# g1 - in pointer -# g2 - length -# g3 - k -# The other registers are used as follows. -# g4 - low word of product -# g5 - high word of product -# g6 - current word of "out" -# g7 - carry word -# g13 - current word of "in" - - .globl _lbnMulAdd1_32 -_lbnMulAdd1_32: - ld (g1),g13 # Fetch *in - addo g1,4,g1 # Increment in - emul g13,g3,g4 # Do multiply (step 1) - ld (g0),g6 # Fetch *out - chkbit 0,g2 # Check if loop counter was odd - shro 1,g2,g2 # Divide loop counter by 2 - mov g5,g7 # Move high word to carry - bno ma_loop1 # If even, jump to ma_loop1 - cmpo 0,g2 # If odd, was it 1 (now 0)? - be ma_done # If equal (carry set), jump to ending code - -# Entered with carry bit clear -ma_loop: - ld (g1),g13 # Fetch *in - addc g4,g6,g6 # Add low to *out (step 4), generate carry - emul g13,g3,g4 # Do multiply (step 1) - st g6,(g0) # Write out *out - addo g0,4,g0 # Increment out - addo g1,4,g1 # Increment in - ld (g0),g6 # Fetch next *out - addc g7,g4,g4 # Add carries to low (step 2) - addc g5,0,g7 # Add carry bit to high (step 3) & clear carry -ma_loop1: - ld (g1),g13 # Fetch *in - addc g4,g6,g6 # Add low to *out (step 4), generate carry - emul g13,g3,g4 # Do multiply (step 1) - st g6,(g0) # Write out *out - addo g0,4,g0 # Increment out - addo g1,4,g1 # Increment in - ld (g0),g6 # Fetch next *out - addc g7,g4,g4 # Add carries to low (step 2) - addc g5,0,g7 # Add carry bit to high (step 3) & clear carry - - cmpdeco 1,g2,g2 - bne ma_loop -# When we come here, carry is *set*, and we stil have to do step 4 -ma_done: - cmpi 0,1 # Clear carry (equal flag) - addc g4,g6,g6 # Add low to *out (step 4), generate carry - st g6,(g0) # Write out *out - addc g7,0,g0 # Add carry bit and word to produce return value - ret - -# Now, multiply N by 1 is similarly annoying. We only have one add in the -# whole loop, which should just be able to leave its carry output in the -# carry flag for the next iteration, but we need the condition codes to do -# loop testing. *Sigh*. -# -# void -# lbnMultN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -# This stores len+1 words of "k" * len words of "in" and stores the result -# in "out". -# -# To avoid having to do a move after the first iteration, for the first -# step, g4/g5 is the product. For second step, g6/g7 is used for product -# storage and g5 is the carry in. It alternates from then on. - .globl _lbnMulN1_32 -_lbnMulN1_32: - ld (g1),g13 # Fetch *in - addo g1,4,g1 # Increment in - emul g13,g3,g4 # Do multiply (step 1) - chkbit 0,g2 # Check if loop counter was odd - shro 1,g2,g2 # Divide loop counter by 2 - bno m_loop1 # If even, jump to ma_loop1 - mov g4,g6 - cmpo 0,g2 # If counter was odd, was it 1 (now 0)? - mov g5,g7 - be m_done # If equal (carry set), jump to ending code - -# Entered with carry bit clear -m_loop: - # Result in g6, carry word in g7 - ld (g1),g13 # Fetch *in - addo g1,4,g1 # Increment in - emul g13,g3,g4 # Do multiply (step 1) - st g6,(g0) # Write out *out - addo g0,4,g0 # Increment out - addc g7,g4,g4 # Add carries to low (step 2) -# No need to add carry bit here, because it'll get remembered until next addc. -# addc g5,0,g5 # Add carry bit to high (step 3) -m_loop1: - # Carry word in g5 - ld (g1),g13 # Fetch *in - addo g1,4,g1 # Increment in - emul g13,g3,g6 # Do multiply (step 1) - st g4,(g0) # Write out *out - addo g0,4,g0 # Increment out - addc g5,g6,g6 # Add carries to low (step 2) - addc g7,0,g7 # Add carry bit to high (step 3) - - cmpdeco 1,g2,g2 - bne m_loop - -# When we come here, we have to store g6 and the carry word in g7. -m_done: - st g6,(g0) # Write out *out - st g7,4(g0) # Write out *out - ret - -# BNWORD32 -# lbnMultSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k) -# This subtracts "k" * "in" from "len" words of "out" and returns the word of -# borrow. -# -# This is similar to multiply-add, but actually a bit more obnoxious, -# because of the carry situation. The 960 uses a carry (rather than a borrow) -# bit on subtracts, so the carry bit should be 1 for a subc to do the -# same thing as an ordinary subo. So we use two carry chains: one from -# the add of the low-order words to the high-order carry word, and a second, -# which uses an extra register, to connect the subtracts. This avoids -# the need to fiddle with inverting the bit in the usual case. -# -# Arguments are passed as follows: -# g0 - out pointer -# g1 - in pointer -# g2 - length -# g3 - k -# The other registers are used as follows. -# g4 - low word of product -# g5 - high word of product -# g6 - current word of "out" -# g7 - carry word -# g13 - current word of "in" -# g14 - remembered carry bit - - .globl _lbnMulSub1_32 -_lbnMulSub1_32: - ld (g1),g13 # Fetch *in - addo g1,4,g1 # Increment in - emul g13,g3,g4 # Do multiply (step 1) - ld (g0),g6 # Fetch *out - chkbit 0,g2 # Check if loop counter was odd - mov 1,g14 # Set remembered carry for first iteration - shro 1,g2,g2 # Divide loop counter by 2 - mov g5,g7 # Move high word to carry - bno ms_loop1 # If even, jump to ma_loop1 - cmpo 0,g2 # If odd, was it 1 (now 0)? - be ms_done # If equal (carry set), jump to ending code - -# Entered with carry bit clear -ms_loop: - ld (g1),g13 # Fetch *in - cmpi g14,1 # Set carry flag - subc g4,g6,g6 # Subtract low from *out (step 4), gen. carry - emul g13,g3,g4 # Do multiply (step 1) - addc 0,0,g14 # g14 = carry, then clear carry - st g6,(g0) # Write out *out - addo g0,4,g0 # Increment out - addo g1,4,g1 # Increment in - ld (g0),g6 # Fetch next *out - addc g7,g4,g4 # Add carries to low (step 2) - addc g5,0,g7 # Add carry bit to high (step 3) -ms_loop1: - ld (g1),g13 # Fetch *in - cmpi g14,1 # Set carry flag for subtrsct - subc g4,g6,g6 # Subtract low from *out (step 4), gen. carry - emul g13,g3,g4 # Do multiply (step 1) - addc 0,0,g14 # g14 = carry, then clear carry - st g6,(g0) # Write out *out - addo g0,4,g0 # Increment out - addo g1,4,g1 # Increment in - ld (g0),g6 # Fetch next *out - addc g7,g4,g4 # Add carries to low (step 2) - addc g5,0,g7 # Add carry bit to high (step 3) - - cmpdeco 1,g2,g2 - bne ms_loop -# When we come here, carry is *set*, and we stil have to do step 4 -ms_done: - cmpi g14,1 # set carry (equal flag) - subc g4,g6,g6 # Add low to *out (step 4), generate carry - st g6,(g0) # Write out *out - subc 0,0,g14 # g14 = -1 if no carry (borrow), 0 if carry - subo g14,g7,g0 # Add borrow bit to produce return value - mov 0,g14 # Restore g14 to 0 for return - ret diff --git a/libs/libzrtp/third_party/bnlib/lbnalpha.h b/libs/libzrtp/third_party/bnlib/lbnalpha.h deleted file mode 100644 index 02f467ce73..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbnalpha.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbnalpha.h - header file that declares the Alpha assembly-language - * subroutines. It is intended to be included via the BNINCLUDE - * mechanism. - */ - -#define BN_LITTLE_ENDIAN 1 - -typedef unsigned long bnword64; -#define BNWORD64 bnword64 - -#ifdef __cplusplus -/* These assembly-language primitives use C names */ -extern "C" { -#endif - -void lbnMulN1_64(bnword64 *out, bnword64 const *in, unsigned len, bnword64 k); -#define lbnMulN1_64 lbnMulN1_64 - -bnword64 -lbnMulAdd1_64(bnword64 *out, bnword64 const *in, unsigned len, bnword64 k); -#define lbnMulAdd1_64 lbnMulAdd1_64 - -bnword64 -lbnMulSub1_64(bnword64 *out, bnword64 const *in, unsigned len, bnword64 k); -#define lbnMulSub1_64 lbnMulSub1_64 - -#ifdef __cplusplus -} -#endif diff --git a/libs/libzrtp/third_party/bnlib/lbnalpha.s b/libs/libzrtp/third_party/bnlib/lbnalpha.s deleted file mode 100644 index 6ac2820dac..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbnalpha.s +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * DEC Alpha 64-bit math primitives. These use 64-bit words - * unless otherwise noted. - * - * The DEC assembler apparently does some instruction scheduling, - * but I tried to do some of my own, and tries to spread things - * out over the register file to give the assembler more room - * to schedule things. - * - * Alpha OSF/1 register usage conventions: - * r0 - v0 - Temp, holds integer return value - * r1..r8 - t0..t7 - Temp, trashed by procedure call - * r9..r14 - s0..s5 - Saved across procedure calls - * r15 - s6/FP - Frame pointer, saved across procedure calls - * r16..r21 - a0..a5 - Argument registers, all trashed by procedure call - * r22..r25 - t8..t11 - Temp, trashed by procedure call - * r26 - ra - Return address - * r27 - t12/pv - Procedure value, trashed by procedure call - * r28 - at - Assembler temp, trashed by procedure call - * r29 - gp - Global pointer - * r30 - sp - Stack pointer - * r31 - zero - hardwired to zero - */ - .text - .align 4 - .globl lbnMulN1_64 -/* I have no idea what the '2' at the end of the .ent line means. */ - .ent lbnMulN1_64 2 -/* - * Arguments: $16 = out, $17 = in, $18 = len<32>, $19 = k - * Other registers: $0 = carry word, $1 = product low, - * $2 = product high, $3 = input word - */ -lbnMulN1_64: - ldq $3,0($17) /* Load first word of input */ - subl $18,1,$18 - mulq $3,$19,$1 /* Do low half of first multiply */ - umulh $3,$19,$0 /* Do second half of first multiply */ - stq $1,0($16) - beq $18,m64_done -m64_loop: - ldq $3,8($17) - addq $17,8,$17 - mulq $3,$19,$1 /* Do bottom half of multiply */ - subl $18,1,$18 - umulh $3,$19,$2 /* Do top half of multiply */ - addq $0,$1,$1 /* Add carry word from previous multiply */ - stq $1,8($16) - cmpult $1,$0,$0 /* Compute carry bit from add */ - addq $16,8,$16 - addq $2,$0,$0 /* Add carry bit to carry word */ - - beq $18,m64_done - - ldq $3,8($17) - addq $17,8,$17 - mulq $3,$19,$1 /* Do bottom half of multiply */ - subl $18,1,$18 - umulh $3,$19,$2 /* Do top half of multiply */ - addq $0,$1,$1 /* Add carry word from previous multiply */ - stq $1,8($16) - cmpult $1,$0,$0 /* Compute carry bit from add */ - addq $16,8,$16 - addq $2,$0,$0 /* Add carry bit to carry word */ - - bne $18,m64_loop -m64_done: - stq $0,8($16) /* Store last word of result */ - ret $31,($26),1 -/* The '1' in the hint field means procedure return - software convention */ - .end lbnMulN1_64 - - - .text - .align 4 - .globl lbnMulAdd1_64 - .ent lbnMulAdd1_64 2 -/* - * Arguments: $16 = out, $17 = in, $18 = len<32>, $19 = k - * Other registers: $0 = product high, $1 = product low, - * $2 = product high temp, $3 = input word, $4 = output word - * $5 = carry bit from add to out - */ -lbnMulAdd1_64: - ldq $3,0($17) /* Load first word of input */ - subl $18,1,$18 - mulq $3,$19,$1 /* Do low half of first multiply */ - ldq $4,0($16) /* Load first word of output */ - umulh $3,$19,$2 /* Do second half of first multiply */ - addq $4,$1,$4 - cmpult $4,$1,$5 /* Compute borrow bit from subtract */ - stq $4,0($16) - addq $5,$2,$0 /* Add carry bit to high word */ - beq $18,ma64_done -ma64_loop: - ldq $3,8($17) /* Load next word of input */ - addq $17,8,$17 - ldq $4,8($16) /* Load next word of output */ - mulq $3,$19,$1 /* Do bottom half of multiply */ - subl $18,1,$18 - addq $0,$1,$1 /* Add carry word from previous multiply */ - umulh $3,$19,$2 /* Do top half of multiply */ - cmpult $1,$0,$0 /* Compute carry bit from add */ - addq $4,$1,$4 /* Add product to loaded word */ - cmpult $4,$1,$5 /* Compute carry bit from add */ - stq $4,8($16) - addq $5,$0,$5 /* Add carry bits together */ - addq $16,8,$16 - addq $5,$2,$0 /* Add carry bits to carry word */ - - beq $18,ma64_done - - ldq $3,8($17) /* Load next word of input */ - addq $17,8,$17 - ldq $4,8($16) /* Load next word of output */ - mulq $3,$19,$1 /* Do bottom half of multiply */ - subl $18,1,$18 - addq $0,$1,$1 /* Add carry word from previous multiply */ - umulh $3,$19,$2 /* Do top half of multiply */ - cmpult $1,$0,$0 /* Compute carry bit from add */ - addq $4,$1,$4 /* Add product to loaded word */ - cmpult $4,$1,$5 /* Compute carry bit from add */ - stq $4,8($16) - addq $5,$0,$5 /* Add carry bits together */ - addq $16,8,$16 - addq $5,$2,$0 /* Add carry bits to carry word */ - - bne $18,ma64_loop -ma64_done: - ret $31,($26),1 - .end lbnMulAdd1_64 - - - .text - .align 4 - .globl lbnMulSub1_64 - .ent lbnMulSub1_64 2 -/* - * Arguments: $16 = out, $17 = in, $18 = len<32>, $19 = k - * Other registers: $0 = carry word, $1 = product low, - * $2 = product high temp, $3 = input word, $4 = output word - * $5 = borrow bit from subtract - */ -lbnMulSub1_64: - ldq $3,0($17) /* Load first word of input */ - subl $18,1,$18 - mulq $3,$19,$1 /* Do low half of first multiply */ - ldq $4,0($16) /* Load first word of output */ - umulh $3,$19,$2 /* Do second half of first multiply */ - cmpult $4,$1,$5 /* Compute borrow bit from subtract */ - subq $4,$1,$4 - addq $5,$2,$0 /* Add carry bit to high word */ - stq $4,0($16) - beq $18,ms64_done -ms64_loop: - ldq $3,8($17) /* Load next word of input */ - addq $17,8,$17 - ldq $4,8($16) /* Load next word of output */ - mulq $3,$19,$1 /* Do bottom half of multiply */ - subl $18,1,$18 - addq $0,$1,$1 /* Add carry word from previous multiply */ - umulh $3,$19,$2 /* Do top half of multiply */ - cmpult $1,$0,$0 /* Compute carry bit from add */ - cmpult $4,$1,$5 /* Compute borrow bit from subtract */ - subq $4,$1,$4 - addq $5,$0,$5 /* Add carry bits together */ - stq $4,8($16) - addq $5,$2,$0 /* Add carry bits to carry word */ - addq $16,8,$16 - - beq $18,ms64_done - - ldq $3,8($17) /* Load next word of input */ - addq $17,8,$17 - ldq $4,8($16) /* Load next word of output */ - mulq $3,$19,$1 /* Do bottom half of multiply */ - subl $18,1,$18 - addq $0,$1,$1 /* Add carry word from previous multiply */ - umulh $3,$19,$2 /* Do top half of multiply */ - cmpult $1,$0,$0 /* Compute carry bit from add */ - cmpult $4,$1,$5 /* Compute borrow bit from subtract */ - subq $4,$1,$4 - addq $5,$0,$5 /* Add carry bits together */ - stq $4,8($16) - addq $5,$2,$0 /* Add carry bits to carry word */ - addq $16,8,$16 - - bne $18,ms64_loop -ms64_done: - ret $31,($26),1 - .end lbnMulSub1_64 diff --git a/libs/libzrtp/third_party/bnlib/lbnmem.c b/libs/libzrtp/third_party/bnlib/lbnmem.c deleted file mode 100644 index 06ab8a2ce5..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbnmem.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * lbnmem.c - low-level bignum memory handling. - * - * Note that in all cases, the pointers passed around - * are pointers to the *least* significant end of the word. - * On big-endian machines, these are pointers to the *end* - * of the allocated range. - * - * BNSECURE is a simple level of security; for more security - * change these function to use locked unswappable memory. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_STDLIB_H -#define NO_STDLIB_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_STDLIB_H -#include <stdlib.h> /* For malloc() & co. */ -#else -void *malloc(); -void *realloc(); -void free(); -#endif - -#if !NO_STRING_H -#include <string.h> /* For memset */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#ifndef DBMALLOC -#define DBMALLOC 0 -#endif -#if DBMALLOC -/* Development debugging */ -#include "../dbmalloc/malloc.h" -#endif - -#include "lbn.h" -#include "lbnmem.h" - -#include "kludge.h" - -#include "zrtp.h" - -#ifndef lbnMemWipe -void -lbnMemWipe(void *ptr, unsigned bytes) -{ - zrtp_memset(ptr, 0, bytes); -} -#define lbnMemWipe(ptr, bytes) memset(ptr, 0, bytes) -#endif - -#ifndef lbnMemAlloc -void * -lbnMemAlloc(unsigned bytes) -{ - return zrtp_sys_alloc(bytes); -} -#endif - -#ifndef lbnMemFree -void -lbnMemFree(void *ptr, unsigned bytes) -{ - lbnMemWipe(ptr, bytes); - zrtp_sys_free(ptr); -} -#endif - -#ifndef lbnRealloc -#if defined(lbnMemRealloc) || !BNSECURE -void * -lbnRealloc(void *ptr, unsigned oldbytes, unsigned newbytes) -{ - if (ptr) { - BIG(ptr = (char *)ptr - oldbytes;) - if (newbytes < oldbytes) - memmove(ptr, (char *)ptr + oldbytes-newbytes, oldbytes); - } -#ifdef lbnMemRealloc - ptr = lbnMemRealloc(ptr, oldbytes, newbytes); -#else - ptr = realloc(ptr, newbytes); -#endif - if (ptr) { - if (newbytes > oldbytes) - memmove((char *)ptr + newbytes-oldbytes, ptr, oldbytes); - BIG(ptr = (char *)ptr + newbytes;) - } - - return ptr; -} - -#else /* BNSECURE */ - -void * -lbnRealloc(void *oldptr, unsigned oldbytes, unsigned newbytes) -{ - void *newptr = lbnMemAlloc(newbytes); - - if (!newptr) - return newptr; - if (!oldptr) - return BIGLITTLE((char *)newptr+newbytes, newptr); - - /* - * The following copies are a bit non-obvious in the big-endian case - * because one of the pointers points to the *end* of allocated memory. - */ - if (newbytes > oldbytes) { /* Copy all of old into part of new */ - BIG(newptr = (char *)newptr + newbytes;) - BIG(oldptr = (char *)oldptr - oldbytes;) - memcpy(BIGLITTLE((char *)newptr-oldbytes, newptr), oldptr, - oldbytes); - } else { /* Copy part of old into all of new */ - memcpy(newptr, BIGLITTLE((char *)oldptr-newbytes, oldptr), - newbytes); - BIG(newptr = (char *)newptr + newbytes;) - BIG(oldptr = (char *)oldptr - oldbytes;) - } - - lbnMemFree(oldptr, oldbytes); - - return newptr; -} -#endif /* BNSECURE */ -#endif /* !lbnRealloc */ diff --git a/libs/libzrtp/third_party/bnlib/lbnmem.h b/libs/libzrtp/third_party/bnlib/lbnmem.h deleted file mode 100644 index 4218028be4..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbnmem.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Operations on the usual buffers of bytes - */ -#ifndef BNSECURE -#define BNSECURE 1 -#endif - -/* - * These operations act on buffers of memory, just like malloc & free. - * One exception: it is not legal to pass a NULL pointer to lbnMemFree. - */ - -#ifndef lbnMemAlloc -void *lbnMemAlloc(unsigned bytes); -#endif - -#ifndef lbnMemFree -void lbnMemFree(void *ptr, unsigned bytes); -#endif - -/* This wipes out a buffer of bytes if necessary needed. */ - -#ifndef lbnMemWipe -#if BNSECURE -void lbnMemWipe(void *ptr, unsigned bytes); -#else -#define lbnMemWipe(ptr, bytes) (void)(ptr,bytes) -#endif -#endif /* !lbnMemWipe */ - -/* - * lbnRealloc is NOT like realloc(); it's endian-sensitive! - * If lbnMemRealloc is #defined, lbnRealloc will be defined in terms of it. - * It is legal to pass a NULL pointer to lbnRealloc, although oldbytes - * will always be sero. - */ -#ifndef lbnRealloc -void *lbnRealloc(void *ptr, unsigned oldbytes, unsigned newbytes); -#endif - - -/* - * These macros are the ones actually used most often in the math library. - * They take and return pointers to the *end* of the given buffer, and - * take sizes in terms of words, not bytes. - * - * Note that LBNALLOC takes the pointer as an argument instead of returning - * the value. - * - * Note also that these macros are only useable if you have included - * lbn.h (for the BIG and BIGLITTLE macros), which this file does NOT include. - */ - -#define LBNALLOC(p,type,words) BIGLITTLE( \ - if ( ((p) = (type *)lbnMemAlloc((words)*sizeof*(p))) != 0) \ - (p) += (words), \ - (p) = (type *)lbnMemAlloc((words) * sizeof*(p)) \ - ) -#define LBNFREE(p,words) lbnMemFree((p) BIG(-(words)), (words) * sizeof*(p)) -#define LBNREALLOC(p,old,new) \ - lbnRealloc(p, (old) * sizeof*(p), (new) * sizeof*(p)) -#define LBNWIPE(p,words) lbnMemWipe((p) BIG(-(words)), (words) * sizeof*(p)) - diff --git a/libs/libzrtp/third_party/bnlib/lbnppc.c b/libs/libzrtp/third_party/bnlib/lbnppc.c deleted file mode 100644 index 249654d839..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbnppc.c +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#include "lbnppc.h" - -/* - * lbnppc.c - Assembly primitives for the bignum library, PowerPC version. - * - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Register usage during function calls is: - * r0 - volatile - * r1 - stack pointer, preserved - * r2 - TOC pointer, preserved - * r3 - First argument and return value register - * r4-r10 - More argument registers, volatile - * r11-r12 - Volatile - * r13-r31 - Preserved - * LR, CTR, XER and MQ are all volatile. - * LR holds return address on entry. - * - * On the PPC 601, unrolling the loops more doesn't seem to speed things - * up at all. I'd be curious if other chips differed. - */ -#if __MWERKS__ < 0x800 - -#include "ppcasm.h" /* PowerPC assembler */ - -/* - * MulN1 expects (*out, *in, len, k), count >= 1 - * r3 r4 r5 r6 - */ -static const unsigned mulN1[] = { - PPC_LWZ(7,4,0), /* Load first word of in in r7 */ - PPC_MULLW(8,7,6), /* Low half of multiply in r8 */ - PPC_MTCTR(5), /* Move len into CTR */ - PPC_ADDIC(0,0,0), /* Clear carry bit for loop */ - PPC_MULHWU(5,7,6), /* High half of multiply in r5 */ - PPC_STW(8,3,0), - PPC_BC(18,31,7), /* Branch to Label if --ctr == 0 */ -/* Loop: */ - PPC_LWZU(7,4,4), /* r7 = *++in */ - PPC_MULLW(8,7,6), /* r8 = low word of product */ - PPC_ADDE(8,8,5), /* Add carry word r5 and bit CF to r8 */ - PPC_STWU(8,3,4), /* *++out = r8 */ - PPC_MULHWU(5,7,6), /* r5 is high word of product, for carry word */ - PPC_BC(16,31,-5), /* Branch to Loop if --ctr != 0 */ -/* Label: */ - PPC_ADDZE(5,5), /* Add carry flag to r5 */ - PPC_STW(5,3,4), /* out[1] = r5 */ - PPC_BLR() -}; - -/* - * MulAdd1 expects (*out, *in, len, k), count >= 1 - * r3 r4 r5 r6 - */ -static unsigned const mulAdd1[] = { - PPC_LWZ(7,4,0), /* Load first word of in in r7 */ - PPC_LWZ(0,3,0), /* Load first word of out into r0 */ - PPC_MULLW(8,7,6), /* Low half of multiply in r8 */ - PPC_MTCTR(5), /* Move len into CTR */ - PPC_MULHWU(5,7,6), /* High half of multiply in r5 */ - PPC_ADDC(8,8,0), /* r8 = r8 + r0 */ - PPC_STW(8,3,0), /* Store result to memory */ - PPC_BC(18,31,10), /* Branch to Label if --ctr == 0 */ -/* Loop: */ - PPC_LWZU(7,4,4), /* r7 = *++in */ - PPC_LWZU(0,3,4), /* r0 = *++out */ - PPC_MULLW(8,7,6), /* r8 = low word of product */ - PPC_ADDE(8,8,5), /* Add carry word r5 and carry bit CF to r8 */ - PPC_MULHWU(5,7,6), /* r5 is high word of product, for carry word */ - PPC_ADDZE(5,5), /* Add carry bit from low add to r5 */ - PPC_ADDC(8,8,0), /* r8 = r8 + r0 */ - PPC_STW(8,3,0), /* *out = r8 */ - PPC_BC(16,31,-8), /* Branch to Loop if --ctr != 0 */ -/* Label: */ - PPC_ADDZE(3,5), /* Add carry flag to r5 and move to r3 */ - PPC_BLR() -}; - -/* - * MulSub1 expects (*out, *in, len, k), count >= 1 - * r3 r4 r5 r6 - * - * Multiply and subtract is rather a pain. If the subtract of the - * low word of the product from out[i] generates a borrow, we want to - * increment the carry word (initially in the range 0..0xfffffffe). - * However, the PPC's carry bit CF is *clear* after a subtract, so - * we want to add (1-CF) to the carry word. This is done using two - * instructions: - * - * SUBFME, subtract from minus one extended. This computes - * rD = ~rS + 0xffffffff + CF. Since rS is from 0 to 0xfffffffe, - * ~rS is from 1 through 0xffffffff, and the sum with 0xffffffff+CF is - * from 0 through 0xfffffffff, setting the carry flag unconditionally, and - * NOR, which is used as a bitwise invert NOT instruction. - * - * The SUBFME performs the computation rD = ~rS + 0xffffffff + CF, - * = (-rS - 1) + (CF - 1) = -(rS - CF + 1) - 1 = ~(rS + 1-CF), - * which is the bitwise complement of the value we want. - * We want to add the complement of that result to the low word of the - * product, which is just what a subtract would do, if only we could get - * the carry flag clear. But it's always set, except for SUBFE, and the - * operation we just performed unconditionally *sets* the carry flag. Ugh. - * So find the complement in a separate instruction. - */ -static unsigned const mulSub1[] = { - PPC_LWZ(7,4,0), /* Load first word of in in r7 */ - PPC_LWZ(0,3,0), /* Load first word of out into r0 */ - PPC_MTCTR(5), /* Move len into CTR */ - PPC_MULLW(8,7,6), /* Low half of multiply in r8 */ - PPC_MULHWU(5,7,6), /* High half of multiply in r5 */ - PPC_SUBFC(8,8,0), /* r8 = r0 - r8, setting CF */ - PPC_STW(8,3,0), /* Store result to memory */ - PPC_SUBFME(5,5), /* First of two insns to add (1-CF) to r5 */ - PPC_BC(18,31,12), /* Branch to Label if --ctr == 0 */ -/* Loop: */ - PPC_LWZU(7,4,4), /* r7 = *++in */ - PPC_LWZU(0,3,4), /* r0 = *++out */ - PPC_NOR(5,5,5), /* Second of two insns to add (1-CF) to r5 */ - PPC_MULLW(8,7,6), /* r8 = low word of product */ - PPC_ADDC(8,8,5), /* Add carry word r5 to r8 */ - PPC_MULHWU(5,7,6), /* r5 is high word of product, for carry word */ - PPC_ADDZE(5,5), /* Add carry bit from low add to r5 */ - PPC_SUBFC(8,8,0), /* r8 = r0 - r8, setting CF */ - PPC_STW(8,3,0), /* *out = r8 */ - PPC_SUBFME(5,5), /* First of two insns to add (1-CF) to r5 */ - PPC_BC(16,31,-10), /* Branch to Loop if --ctr != 0 */ -/* Label: */ - PPC_NOR(3,5,5), /* Finish adding (1-CF) to r5, store in r3 */ - PPC_BLR() -}; - -#if 0 -/* - * Args: BNWORD32 *n, BNWORD32 const *mod, unsigned mlen, BNWORD32 inv) - * r3 r4 r5 r6 - * r7, r8 and r9 are the triple-width accumulator. - * r0 and r10 are temporary registers. - * r11 and r12 are temporary pointers into n and mod, respectively. - * r2 (!) is another temporary register. - */ -static unsigned const montReduce[] = { - PPC_MTCTR(5), /* ??? */ - PPC_LWZ(7,3,0), /* Load low word of n into r7 */ - PPC_LWZ(10,4,0), /* Fetch low word of mod */ - PPC_MULLW(0,7,6), /* Invert r7 into r0 */ - PPC_STW(0,3,0), /* Store back for future use */ - PPC_MULHWU(8,10,7), /* Get high word of whatnot */ - PPC_MULLW(10,10,7), /* Get low word of it */ - PPC_ADDC(7,7,10), /* Add low word of product to r7 */ - PPC_ADDZE(8,8), /* Add carry to high word */ - PPC_ - - - PPC_MULHW(8,7,6), - PPC_ADDC(7,7,0), /* Add inverse back to r7 */ - PPC_ADDZE(8,8), - PPC_ - - PPC_LWZU( -/* Loop: */ - PPC_LWZU(0,11,4), - PPC_LWZU(10,23,-4), - PPC_MULLW(2,0,10), - PPC_ADDC(7,7,2), - PPC_MULHWU(0,0,10), - PPC_ADDE(8,8,0), - PPC_ADDZE(9,9), - PPC_BC(16,31,-7), /* Branch to Loop if --ctr != 0 */ - - PPC_ADDIC_(count,-1), - PPC_LWZU(0,x,4), - PPC_ADDC(0,7,0), - PPC_STW(0,x,0), - PPC_ADDZE(7,8), - PPC_ADDZE(8,9), - PPC_LI(9,0), - PPC_BC(xx,2,yy), - -}; -#endif - -/* - * Three overlapped transition vectors for three functions. - * A PowerPC transition vector for a (potentially) inter-module - * jump or call consists of two words, an instruction address - * and a Table Of Contents (TOC) pointer, which is loaded into - * r1. Since none of the routines here have global variables, - * they don't need a TOC pointer, so the value is unimportant. - * This array places an unintersting 32-bit value after each address. - */ -unsigned const * const lbnPPC_tv[] = { - mulN1, - mulAdd1, - mulSub1, - 0 -}; - -#else /* __MWERKS >= 0x800 */ - -/* - * MulN1 expects (*out, *in, len, k), count >= 1 - * r3 r4 r5 r6 - */ -asm void -lbnMulN1_32(register unsigned *out, register unsigned const *in, - register unsigned len, register unsigned k) -{ - lwz r7,0(in) /* Load first word of in in r7 */ - mtctr len /* Move len into CTR */ - mullw r8,r7,k /* Low half of multiply in r8 */ - addic r0,r0,0 /* Clear carry bit for loop */ - mulhwu len,r7,k /* High half of multiply in len */ - stw r8,0(out) /* *out = r8 */ - mulhwu len,r7,k /* len is high word of product, for carry */ - bdz- label /* Branch to Label if --ctr == 0 */ -loop: - lwzu r7,4(in) /* r7 = *++in */ - mullw r8,r7,k /* Low half of multiply in r8 */ - adde r8,r8,len /* Add carry word len and bit CF to r8 */ - stwu r8,4(out) /* *++out = r8 */ - mulhwu len,r7,k /* len is high word of product, for carry */ - bdnz+ loop /* Branch to Loop if --ctr != 0 */ -label: - addze len,len /* Add carry flag to carry word */ - stw len,4(out) - blr -} - -/* - * MulAdd1 expects (*out, *in, len, k), count >= 1 - * r3 r4 r5 r6 - */ -asm unsigned -lbnMulAdd1_32(register unsigned *out, register unsigned const *in, - register unsigned len, register unsigned k) -{ - lwz r7,0(in) /* Load first word of in in r7 */ - lwz r0,0(out) /* Load first word of out into r0 */ - mullw r8,r7,k /* Low half of multiply in r8 */ - mtctr len /* Move len into CTR */ - mulhwu len,r7,k /* High half of multiply in len */ - addc r8,r8,r0 /* r8 = r8 + r0 */ - stw r8,0(out) /* Store result to memory */ - bdz- label /* Branch to Label if --ctr == 0 */ -loop: - lwzu r7,4(in) /* r7 = *++in */ - lwzu r0,4(out) /* r0 = *++out */ - mullw r8,r7,k /* r8 = low word of product */ - adde r8,r8,len /* Add carry word len and carry bit CF to r8 */ - mulhwu len,r7,k /* len is high word of product, for carry */ - addze len,len /* Add carry bit from low add to r5 */ - addc r8,r8,r0 /* r8 = r8 + r0 */ - stw r8,0(out) /* *out = r8 */ - bdnz+ loop /* Branch to Loop if --ctr != 0 */ -label: - addze r3,r5 /* Add carry flag to r5 and move to r3 */ - blr -} - -/* - * MulSub1 expects (*out, *in, len, k), count >= 1 - * r3 r4 r5 r6 - * - * Multiply and subtract is rather a pain. If the subtract of the - * low word of the product from out[i] generates a borrow, we want to - * increment the carry word (initially in the range 0..0xfffffffe). - * However, the PPC's carry bit CF is *clear* after a subtract, so - * we want to add (1-CF) to the carry word. This is done using two - * instructions: - * - * SUBFME, subtract from minus one extended. This computes - * rD = ~rS + 0xffffffff + CF. Since rS is from 0 to 0xfffffffe, - * ~rS is from 1 through 0xffffffff, and the sum with 0xffffffff+CF is - * from 0 through 0xfffffffff, setting the carry flag unconditionally, and - * NOR, which is used as a bitwise invert NOT instruction. - * - * The SUBFME performs the computation rD = ~rS + 0xffffffff + CF, - * = (-rS - 1) + (CF - 1) = -(rS - CF + 1) - 1 = ~(rS + 1-CF), - * which is the bitwise complement of the value we want. - * We want to add the complement of that result to the low word of the - * product, which is just what a subtract would do, if only we could get - * the carry flag clear. But it's always set, except for SUBFE, and the - * operation we just performed unconditionally *sets* the carry flag. Ugh. - * So find the complement in a separate instruction. - */ -asm unsigned -lbnMulSub1_32(register unsigned *out, register unsigned const *in, - register unsigned len, register unsigned k) -{ - lwz r7,0(in) /* Load first word of in in r7 */ - lwz r0,0(out) /* Load first word of out into r0 */ - mtctr len /* Move len into CTR */ - mullw r8,r7,k /* Low half of multiply in r8 */ - mulhwu len,r7,k /* High half of multiply in len */ - subfc r8,r8,r0 /* r8 = r0 - r8, setting CF */ - stw r8,0(out) /* Store result to memory */ - subfme len,len /* First of two insns to add (1-CF) to len */ - bdz- label /* Branch to Label if --ctr == 0 */ -loop: - lwzu r7,4(in) /* r7 = *++in */ - lwzu r0,4(out) /* r0 = *++out */ - nor len,len,len /* Second of two insns to add (1-CF) to len */ - mullw r8,r7,k /* r8 = low word of product */ - addc r8,r8,len /* Add carry word len to r8 */ - mulhwu len,r7,k /* len is high word of product, for carry */ - addze len,len /* Add carry bit from low add to len */ - subfc r8,r8,r0 /* r8 = r0 - r8 */ - stw r8,0(out) /* *out = r8 */ - subfme len,len /* First of two insns to add (1-CF) to len */ - bdnz+ loop /* Branch to Loop if --ctr != 0 */ -label: - nor r3,r5,r5 /* Finish adding (1-CF) to len, store in r3 */ - blr -} - -#endif /* __MWERKS >= 0x800 */ -/* 45678901234567890123456789012345678901234567890123456789012345678901234567 */ diff --git a/libs/libzrtp/third_party/bnlib/lbnppc.h b/libs/libzrtp/third_party/bnlib/lbnppc.h deleted file mode 100644 index 8f8a347f73..0000000000 --- a/libs/libzrtp/third_party/bnlib/lbnppc.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef LBNPPC_H -#define LBNPPC_H - -/* - * Assembly-language routines for the Power PC processor. - * Annoyingly, the Power PC does not have 64/32->32 bit divide, - * so the C code should be reasonably fast. But it does have - * 32x32->64-bit multiplies, and these routines provide access - * to that. - * - * In versions of CodeWarrior before 8.0, there was no PPC assembler, - * so a kludged-up one in CPP is used. This requires casting an - * array of unsigneds to function pointer type, and a function pointer - * is not a pointer to the code, but rather a pointer to a (code,TOC) - * pointer pair which we fake up. - * - * CodeWarrior 8.0 supports PCC assembly, which is used directly. - */ - -/* - * Bignums are stored in arrays of 32-bit words, and the least - * significant 32-bit word has the lowest address, thus "little-endian". - * The C code is slightly more efficient this way, so unless the - * processor cares (the PowerPC, like most RISCs, doesn't), it is - * best to use BN_LITTLE_ENDIAN. - * Note that this has NOTHING to do with the order of bytes within a 32-bit - * word; the math library is insensitive to that. - */ -#define BN_LITTLE_ENDIAN 1 - -typedef unsigned bnword32; -#define BNWORD32 bnword32 - -#if __MWERKS__ < 0x800 - -/* Shared transition vector array */ -extern unsigned const * const lbnPPC_tv[]; - -/* A function pointer on the PowerPC is a pointer to a transition vector */ -#define lbnMulN1_32 \ -((void (*)(bnword32 *, bnword32 const *, unsigned, bnword32))(lbnPPC_tv+0)) -#define lbnMulAdd1_32 \ -((bnword32 (*)(bnword32 *, bnword32 const *, unsigned, bnword32))(lbnPPC_tv+1)) -#define lbnMulSub1_32 \ -((bnword32 (*)(bnword32 *, bnword32 const *, unsigned, bnword32))(lbnPPC_tv+2)) - -#else /* __MWERKS__ >= 0x800 */ - -void lbnMulN1_32(bnword32 *, bnword32 const *, unsigned, bnword32); -#define lbnMulN1_32 lbnMulN1_32 -bnword32 lbnMulAdd1_32(bnword32 *, bnword32 const *, unsigned, bnword32); -#define lbnMulAdd1_32 lbnMulAdd1_32 -bnword32 lbnMulSub1_32(bnword32 *, bnword32 const *, unsigned, bnword32); -#define lbnMulSub1_32 lbnMulSub1_32 - -#endif /* __MWERKS__ >= 0x800 */ - -#endif /* LBNPPC_H */ diff --git a/libs/libzrtp/third_party/bnlib/legal.c b/libs/libzrtp/third_party/bnlib/legal.c deleted file mode 100644 index 67fdd9171d..0000000000 --- a/libs/libzrtp/third_party/bnlib/legal.c +++ /dev/null @@ -1,1100 +0,0 @@ -/* - * bnlib - BigNum multiprecision integer math library. - * Copyright (c) 1995, 2005 Colin Plumb. All rights reserved. - * - * This library (the "program") is licensed under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, GPL version 2 or version 3 at your option, except as - * described below. - * - * Philip Zimmermann has received from Colin Plumb the unlimited right - * to sublicense this library to others under non-GPL terms. 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 this library except according to the terms - * described in this document. Don't be confused by the GPL. It is - * not the LGPL, Apache, MIT, BSD, Creative Commons, WTFPL, or any - * other license you might imagine. It is the GPL, as included below. - * - * The GPL license places many complex restrictions on the - * distribution of this library which might make it inconvenient to - * use in a commercial project. Be sure to check the exact details of - * the license before you use this library for anything meaningful. - * For more information about the GPL, visit: - * http://www.gnu.org/copyleft/gpl.html - * - * To license this library under non-GPL terms, please contact: Philip - * Zimmermann <prz@mit.edu> (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 GPL 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 GPL 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 - * bnlib"). - * - * This file must be packaged together with the rest of the bnlib - * 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. It may be commented out only - * if necessary in order to squeeze bnlib into memory-starved environments. */ -#include "legal.h" -volatile const char bnCopyright[] = - "\0bnlib Copyright (c) 1995, 2005 Colin Plumb."; - - -/**************************************************************************** - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. - -****************************************************************************/ - - -/**************************************************************************** - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is 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. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -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. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - 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 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. Use with the GNU Affero General Public License. - - 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 Affero 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 special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU 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 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 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 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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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 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 <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - 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 GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. - -****************************************************************************/ - diff --git a/libs/libzrtp/third_party/bnlib/legal.h b/libs/libzrtp/third_party/bnlib/legal.h deleted file mode 100644 index 18ca03b863..0000000000 --- a/libs/libzrtp/third_party/bnlib/legal.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * We want the copyright string to be accessable to the unix strings command - * in the final linked binary, and we don't want the linker to remove it if - * it's not referenced, so we do that by using 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." Yes, we can't expect a compiler to - * understand law... - */ -extern volatile const char bnCopyright[]; diff --git a/libs/libzrtp/third_party/bnlib/ppcasm.h b/libs/libzrtp/third_party/bnlib/ppcasm.h deleted file mode 100644 index ee9a434cf9..0000000000 --- a/libs/libzrtp/third_party/bnlib/ppcasm.h +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef PPCASM_H -#define PPCASM_H -/* - * A PowerPC assembler in the C preprocessor. - * This assumes that ints are 32 bits, and uses them for the values. - * - * An assembly-language routine is simply an array of unsigned ints, - * initialized with the macros defined here. - * - * In the PowerPC, a generic function pointer does *not* point to the - * first word of code, but to a two (or possibly more) word "transition - * vector." The first word of the TV points to the function's code. - * The second word is the function's TOC (Table Of Contents) pointer, - * which is loaded into r2. The function's global variables are - * accessed via the TOC pointed to by r2. TOC pointers are changed, - * for example, when a dynamically linked library is called, so the - * library can have private global variables. - * - * Saving r2 and reloading r2 each function call is a hassle that - * I'd really rather avoid, since a lot of useful assembly language routines - * can be written without global variables at all, so they don't need a TOC - * pointer. But I haven't figured out how to persuade CodeWarrior 7 to - * generate an intra-TOC call to an array. (CodeWarrior 8 supports - * PowerPC asm, which obviates the need to do the cast-to-function-pointer - * trick, which obviates the need for cross-TOC calls.) - * - * The basic PowerPC calling conventions for integers are: - * r0 - scratch. May be modified by function calls. - * r1 - stack pointer. Must be preserved across function calls. - * See IMPORTANT notes on stack frame format below. - * This must *ALWAYS*, at every instruction boundary, be 16-byte - * aligned and point to a valid stack frame. If a procedure - * needs to create a stack frame, the recommended way is to do: - * stwu r1,-frame_size(r1) - * and on exit, recover with one of: - * addi r1,r1,frame_size, OR - * lwz r1,0(r1) - * r2 - TOC pointer. Points to the current table of contents. - * Must be preserved across function calls. - * r3 - First argument register and return value register. - * Arguments are passed in r3 through r10, and values returned in - * r3 through r6, as needed. (Usually only r3 for single word.) - * r4-r10 - More argument registers - * r11 - Scratch, may be modified by function calls. - * On entry to indirect function calls, this points to the - * transition vector, and additional words may be loaded - * at offsets from it. Some conventions use r12 instead. - * r12 - Scratch, may be modified by function calls. - * r13-r31 - Callee-save registers, may not be modified by function - * calls. - * The LR, CTR and XER may be modified by function calls, as may the MQ - * register, on those processors for which it is implemented. - * CR fields 0, 1, 5, 6 and 7 are scratch and may be modified by function - * calls. CR fields 2, 3 and 4 must be preserved across function calls. - * - * Stack frame format - READ - * - * r1 points to a stack frame, which must *ALWAYS*, meaning after each and - * every instruction, without excpetion, point to a valid 16-byte-aligned - * stack frame, defined as follows: - * - The 296 bytes below r1 (from -296(r1) to -1(r1)) are the so-called Red - * Zone reserved for leaf procedures, which may use it without allocating - * a stack frame and without decrementing r1. The size comes from the room - * needed to store all the callee-save registers: 19 64-bit integer registers - * and 18 64-bit floating-point registers. (18+19)*8 = 296. So any - * procedure can save all the registers it needs to save before creating - * a stack frame and moving r1. - * The bytes at -297(r1) and below may be used by interrupt and exception - * handlers *at any time*. Anything placed there may disappear before - * the next instruction. - * The word at 0(r1) is the previous r1, and so on in a linked list. - * This is the minimum needed to be a valid stack frame, but some other - * offsets from r1 are preallocated by the calling procedure for the called - * procedure's use. These are: - * Offset 0: Link to previous stack frame - saved r1, if the called - * procedure alters it. - * Offset 4: Saved CR, if the called procedure alters the callee-save - * fields. There's no important reason to save it here, - * but the space is reserved and you might as well use it - * for its intended purpose unless you have good reason to - * do otherwise. (This may help some debuggers.) - * Offset 8: Saved LR, if the called procedure needs to save it for - * later function return. Saving the LR here helps a debugger - * track the chain of return addresses on the stack. - * Note that a called procedure does not need to preserve the - * LR for it's caller's sake, but it uually wants to preserve - * the value for its own sake until it finishes and it's - * time to return. At that point, this is usually loaded - * back into the LR and the branch accomplished with BLR. - * However, if you want to be preverse, you could load it - * into the CTR and use BCTR instead. - * Offset 12: Reserved to compiler. I can't find what this is for. - * Offset 16: Reserved to compiler. I can't find what this is for. - * Offset 20: Saved TOC pointer. In a cross-TOC call, the old TOC (r2) - * is saved here before r2 is loaded with the new TOC value. - * Again, it's not important to use this slot for this, but - * you might as well. - * Beginning at offset 24 is the argument area. This area is at least 8 words - * (32 bytes; I don't know what happens with 64 bits) long, and may be longer, - * up to the length of the longest argument list in a function called by - * the function which allocated this stack frame. Generally, arguments - * to functions are passed in registers, but if those functions notice - * the address of the arguments being taken, the registers are stored - * into the space reserved for them in this area and then used from memory. - * Additional arguments that will not fit into registers are also stored - * here. Variadic functions (like printf) generally start by saving - * all the integer argument registers from the "..." onwards to this space. - * For that reason, the space must be large enough to store all the argument - * registers, even if they're never used. - * (It could probably be safely shrunk if you're not calling any variadic - * functions, but be careful!) - * - * Offsets above that are private to the calling function and shouldn't - * be messed with. Generally, what appears there is locals, then saved - * registers. - * - * - * The floating-point instruction set isn't implemented yet (I'm too - * lazy, as I don't need it yet), but for when it is, the register - * usage convention is: - * FPSCR - Scratch, except for floating point exception enable fields, - * which should only be modified by functions defined to do so. - * fr0 - scratch - * fr1 - first floating point parameter and return value, scratch - * fr2 - second floating point parameter and return value (if needed), scratch - * fr3 - third floating point parameter and return value (if needed), scratch - * fr4 - fourth floating point parameter and return value (if needed), scratch - * fr5-fr13 - More floating point argument registers, scratch - * fr14-fr31 - Callee-save registers, may not be modified across a function call - * - * Complex values store the real part in the lower-numberd register of a pair. - * When mixing floating-point and integer arguments, reserve space (one register - * for single-precision, two for double-precision values) in the integer - * argument list for the floating-point values. Those integer registers - * generally have undefined values, UNLESS there is no prototype for the call, - * in which case they should contain a copy of the floating-point value's - * bit pattern to cope with wierd software. - * If the floating point arguments go past the end of the integer registers, - * they are stored in the argument area as well as being passed in here. - * - * After the argument area comes the calling function's private storage. - * Typically, there are locals, followed by saved GP rgisters, followed - * by saved FP registers. - * - * Suggested instruction for allocating a stack frame: - * stwu r1,-frame_size(r1) - * Suggested instructions for deallocating a stack frame: - * addi r1,r1,frame_size - * or - * lwz r1,0(r1) - * If frame_size is too big, you'll have to load the offset into a temp - * register, but be sure that r1 is updated atomically. - * - * - * Basic PowerPC instructions look like this: - * - * 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Opcode | | | | | | | | | | | | | | | | | | | | | | | | | | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * Branch instructions look like this: - * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Opcode | Branch offset |A|L| - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * The L, or LK, or Link bit indicates that the return address for the - * branch should be copied to the link register (LR). - * The A, or AA, or absolute address bit, indicates that the address - * of the current instruction (NOTE: not next instruction!) should NOT - * be added to the branch offset; it is relative to address 0. - * - * Conditional branches looks like this: - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Opcode | BO | BI | Branch offset |A|L| - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * The BI field specifies the condition bit of interest (from the CR). - * The BO field specifies what's interesting. You can branch on a - * combination of a bit of the condition register and --ctr, the CTR - * register. Two bits encode the branch condition to use: - * BRANCH IF - * 00--- = Bit BI is 0 - * 01--- = Bit BI is 1 - * 1z--- = don't care about bit BI (always true) - * AND - * --00- = --ctr != 0 - * --01- = --ctr == 0 - * --1z- = don't decrement ctr (always true) - * The last bit us used as a branch prediction bit. If set, it reverses - * the usual backward-branch-taken heuristic. - * - * y = branch prediction bit. z = unused, must be 0 - * 0000y - branch if --ctr != 0 && BI == 0 - * don't branch if --ctr == 0 || BI != 0 - * 0001y - branch if --ctr == 0 && BI == 0 - * don't branch if --ctr != 0 || BI != 0 - * 001zy - branch if BI == 0 - * don't branch if BI != 0 - * 0100y - branch if --ctr != 0 && BI != 0 - * don't branch if --ctr == 0 || BI == 0 - * 0101y - branch if --ctr == 0 && BI != 0 - * don't branch if --ctr != 0 || BI == 0 - * 011zy - branch if BI != 0 - * don't branch if BI == 0 - * 1z00y - branch if --ctr != 0 - * don't branch if --ctr == 0 - * 1z01y - branch if --ctr == 0 - * don't branch if --ctr != 0 - * 1z1zz - branch always - * If y is 1, the usual branch prediction (usually not taken, taken for - * backwards branches with immediate offsets) is reversed. - * - * Instructions with 2 operands and a 16-bit immediate field look like this: - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Opcode | D | A | 16-bit immediate value | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * Now, there are three variations of note. In some instructions, the 16-bit - * value is sign-extended. In others, it's zero-extended. These are noted - * below as "simm" (signed immediate) and "uimm", respectively. Also, which - * field is the destination and which is the source sometimes switches. - * Sometimes it's d = a OP imm, and sometimes it's a = s OP imm. In the - * latter cases, the "d" field is referred to as "s" ("source" instead of - * "destination". These are logical and shift instructions. (Store also - * refers to the s register, but that's the source of the value to be stored.) - * The assembly mnemonics, however, always lists the destination first, - * swapping the order in the instruction if necessary. - * Third, quite often, if r0 is specified for the source a, then the constant - * value 0 is used instead. Thus, r0 is of limited use - it can be used for - * some things, but not all. - * - * Instructions with three register operands look like this: - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Opcode | D | A | B | Subopcode |C| - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * For most of the instructions of interest the Opcode is 31 and the subopcode - * determines what the instruction does. For a few instructions (mostly loads - * and stores), if the A field is 0, the constant 0 is used. The "C" - * bit (also known as the "RC" bit) controls whether or not the condition - * codes are updated. If it is set (indicated by a "." suffix on the official - * PowerPC opcodes, and a "_" suffix on these macros), condition code register - * field 0 (for integer instructions; field 1 for floating point) is updated - * to reflect the result of the operation. - * Some arithmetic instructions use the most significant bit of the subopcode - * field as an overflow enable bit (o suffix). - * - * Then there are the rotate and mask instructions, which have 5 operands, and - * fill the subopcode field with 2 more 5-bit fields. See below for them. - * - * NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE - * These macros fully parenthesize their arguments, but are not themselves - * fully parenthesized. They are intended to be used for initializer lists, - * and if you want to do tricks with their numeric values, wrap them in - * parentheses. - */ - -#define PPC_MAJOR(x) ((x)<<26) /* Major opcode (0..63) */ -#define PPC_MINOR(x) ((x)<<1) /* Minor opcode (0..1023) */ -#define PPC_RC 1 /* Record carry (. suffix, represented as _) */ -#define PPC_OE 1024 /* Overflow enable (o suffix) */ -#define PPC_DEST(reg) ((reg)<<21) /* Dest register field */ -#define PPC_SRCA(reg) ((reg)<<16) /* First source register field */ -#define PPC_SRCB(reg) ((reg)<<11) /* Second source register field */ -#define PPC_AA 2 /* Branch is absolute, relative to address 0 */ -#define PPC_LK 1 /* Branch with link (L suffix) */ - -/* Unconditional branch (dest is 26 bits, +/- 2^25 bytes) */ -#define PPC_B(dest) PPC_MAJOR(18)|(((dest)<<2) & 0x03fffffc) -#define PPC_BA(dest) PPC_B(dest)|PPC_AA -#define PPC_BL(dest) PPC_B(dest)|PPC_LK -#define PPC_BLA(dest) PPC_B(dest)|PPC_AA|PPC_LK - -/* Three-operand instructions */ -#define PPC_TYPE31(minor,d,a,b) \ - PPC_MAJOR(31)|PPC_DEST(d)|PPC_SRCA(a)|PPC_SRCB(b)|PPC_MINOR(minor) -#define PPC_ADD(d,a,b) PPC_TYPE31(266,d,a,b) -#define PPC_ADD_(d,a,b) PPC_TYPE31(266,d,a,b)|PPC_RC -#define PPC_ADDO(d,a,b) PPC_TYPE31(266,d,a,b)|PPC_OE -#define PPC_ADDO_(d,a,b) PPC_TYPE31(266,d,a,b)|PPC_OE|PPC_RC -#define PPC_ADDC(d,a,b) PPC_TYPE31(10,d,a,b) -#define PPC_ADDC_(d,a,b) PPC_TYPE31(10,d,a,b)|PPC_RC -#define PPC_ADDCO(d,a,b) PPC_TYPE31(10,d,a,b)|PPC_OE -#define PPC_ADDCO_(d,a,b) PPC_TYPE31(10,d,a,b)|PPC_OE|PPC_RC -#define PPC_ADDE(d,a,b) PPC_TYPE31(138,d,a,b) -#define PPC_ADDE_(d,a,b) PPC_TYPE31(138,d,a,b)|PPC_RC -#define PPC_ADDEO(d,a,b) PPC_TYPE31(138,d,a,b)|PPC_OE -#define PPC_ADDEO_(d,a,b) PPC_TYPE31(138,d,a,b)|PPC_OE|PPC_RC -#define PPC_ADDME(d,a) PPC_TYPE31(234,d,a,0) -#define PPC_ADDME_(d,a) PPC_TYPE31(234,d,a,0)|PPC_RC -#define PPC_ADDMEO(d,a) PPC_TYPE31(234,d,a,0)|PPC_OE -#define PPC_ADDMEO_(d,a) PPC_TYPE31(234,d,a,0)|PPC_OE|PPC_RC -#define PPC_ADDZE(d,a) PPC_TYPE31(202,d,a,0) -#define PPC_ADDZE_(d,a) PPC_TYPE31(202,d,a,0)|PPC_RC -#define PPC_ADDZEO(d,a) PPC_TYPE31(202,d,a,0)|PPC_OE -#define PPC_ADDZEO_(d,a) PPC_TYPE31(202,d,a,0)|PPC_OE|PPC_RC -#define PPC_AND(a,s,b) PPC_TYPE31(28,s,a,b) -#define PPC_AND_(a,s,b) PPC_TYPE31(28,s,a,b)|PPC_RC -#define PPC_ANDC(a,s,b) PPC_TYPE31(60,s,a,b) -#define PPC_ANDC_(a,s,b) PPC_TYPE31(60,s,a,b)|PPC_RC -#define PPC_CMP(cr,a,b) PPC_TYPE31(0,(cr)<<2,a,b) -#define PPC_CMPL(cr,a,b) PPC_TYPE31(32,(cr)<<2,a,b) -#define PPC_CNTLZW(a,s) PPC_TYPE31(26,s,a,0) -#define PPC_CNTLZW_(a,s) PPC_TYPE31(26,s,a,0)|PPC_RC -#define PPC_DCBF(a,b) PPC_TYPE31(86,0,a,b) -#define PPC_DCBI(a,b) PPC_TYPE31(470,0,a,b) -#define PPC_DCBST(a,b) PPC_TYPE31(54,0,a,b) -#define PPC_DCBT(a,b) PPC_TYPE31(278,0,a,b) -#define PPC_DCBTST(a,b) PPC_TYPE31(246,0,a,b) -#define PPC_DCBZ(a,b) PPC_TYPE31(1014,0,a,b) -#define PPC_DIVW(d,a,b) PPC_TYPE31(491,d,a,b) -#define PPC_DIVW_(d,a,b) PPC_TYPE31(491,d,a,b)|PPC_RC -#define PPC_DIVWO(d,a,b) PPC_TYPE31(491,d,a,b)|PPC_OE -#define PPC_DIVWO_(d,a,b) PPC_TYPE31(491,d,a,b)|PPC_OE|PPC_RC -#define PPC_DIVWU(d,a,b) PPC_TYPE31(459,d,a,b) -#define PPC_DIVWU_(d,a,b) PPC_TYPE31(459,d,a,b)|PPC_RC -#define PPC_DIVWUO(d,a,b) PPC_TYPE31(459,d,a,b)|PPC_OE -#define PPC_DIVWUO_(d,a,b) PPC_TYPE31(459,d,a,b)|PPC_OE|PPC_RC -#define PPC_EIEIO() PPC_TYPE31(854,0,0,0) -#define PPC_EQV(a,s,b) PPC_TYPE31(284,s,a,b) -#define PPC_EQV_(a,s,b) PPC_TYPE31(284,s,a,b)|PPC_RC -#define PPC_EXTSB(a,s,b) PPC_TYPE31(954,s,a,b) -#define PPC_EXTSB_(a,s,b) PPC_TYPE31(954,s,a,b)|PPC_RC -#define PPC_EXTSH(a,s,b) PPC_TYPE31(922,s,a,b) -#define PPC_EXTSH_(a,s,b) PPC_TYPE31(922,s,a,b)|PPC_RC -#define PPC_ICBI(a,b) PPC_TYPE31(982,0,a,b) -#define PPC_ISYNC() PPC_TYPE31(150,0,0,0) -#define PPC_LBZUX(d,a,b) PPC_TYPE31(119,d,a,b) -#define PPC_LBZX(d,a,b) PPC_TYPE31(87,d,a,b) -#define PPC_LHAUX(d,a,b) PPC_TYPE31(375,d,a,b) -#define PPC_LHAX(d,a,b) PPC_TYPE31(343,d,a,b) -#define PPC_LHBRX(d,a,b) PPC_TYPE31(790,d,a,b) -#define PPC_LHZUX(d,a,b) PPC_TYPE31(311,d,a,b) -#define PPC_LHZX(d,a,b) PPC_TYPE31(279,d,a,b) -#define PPC_LSWI(d,a,nb) PPC_TYPE31(597,d,a,nb) -#define PPC_LSWX(d,a,b) PPC_TYPE31(533,d,a,b) -#define PPC_LSARX(d,a,b) PPC_TYPE31(20,d,a,b) -#define PPC_LSBRX(d,a,b) PPC_TYPE31(534,d,a,b) -#define PPC_MCRXR(crd) PPC_TYPE31(512,(crd)<<2,0,0) -#define PPC_MFCR(d) PPC_TYPE31(19,d,0,0) -#define PPC_MFSPR(d,spr) PPC_TYPE31(339,d,(spr)&31,(spr)>>5) -#define PPC_MFTB(d) PPC_TYPE31(371,d,12,8) -#define PPC_MFTBU(d) PPC_TYPE31(371,d,13,8) -#define PPC_MTCRF(mask,s) PPC_TYPE31(144,s,0,(mask)&0xff) -#define PPC_MTSPR(s,spr) PPC_TYPE31(467,s,(spr)&31,(spr)>>5) -#define PPC_MULHW(d,a,b) PPC_TYPE31(75,d,a,b) -#define PPC_MULHW_(d,a,b) PPC_TYPE31(75,d,a,b)|PPC_RC -#define PPC_MULHWU(d,a,b) PPC_TYPE31(11,d,a,b) -#define PPC_MULHWU_(d,a,b) PPC_TYPE31(11,d,a,b)|PPC_RC -#define PPC_MULLW(d,a,b) PPC_TYPE31(235,d,a,b) -#define PPC_MULLW_(d,a,b) PPC_TYPE31(235,d,a,b)|PPC_RC -#define PPC_MULLWO(d,a,b) PPC_TYPE31(235,d,a,b)|PPC_OE -#define PPC_MULLWO_(d,a,b) PPC_TYPE31(235,d,a,b)|PPC_OE|PPC_RC -#define PPC_NAND(a,s,b) PPC_TYPE31(476,s,a,b) -#define PPC_NAND_(a,s,b) PPC_TYPE31(476,s,a,b)|PPC_RC -#define PPC_NEG(d,a) PPC_TYPE31(104,d,a,b) -#define PPC_NEG_(d,a) PPC_TYPE31(104,d,a,b)|PPC_RC -#define PPC_NEGO(d,a) PPC_TYPE31(104,d,a,b)|PPC_OE -#define PPC_NEGO_(d,a) PPC_TYPE31(104,d,a,b)|PPC_OE|PPC_RC -#define PPC_NOR(a,s,b) PPC_TYPE31(124,s,a,b) -#define PPC_NOR_(a,s,b) PPC_TYPE31(124,s,a,b)|PPC_RC -#define PPC_OR(a,s,b) PPC_TYPE31(444,s,a,b) -#define PPC_OR_(a,s,b) PPC_TYPE31(444,s,a,b)|PPC_RC -#define PPC_ORC(a,s,b) PPC_TYPE31(412,s,a,b) -#define PPC_ORC_(a,s,b) PPC_TYPE31(412,s,a,b)|PPC_RC -#define PPC_SLW(a,s,b) PPC_TYPE31(24,s,a,b) -#define PPC_SLW_(a,s,b) PPC_TYPE31(24,s,a,b)|PPC_RC -#define PPC_SRAW(a,s,b) PPC_TYPE31(792,s,a,b) -#define PPC_SRAW_(a,s,b) PPC_TYPE31(792,s,a,b)|PPC_RC -#define PPC_SRAWI(a,s,sh) PPC_TYPE31(824,s,a,sh) -#define PPC_SRAWI_(a,s,sh) PPC_TYPE31(824,s,a,sh)|PPC_RC -#define PPC_SRW(a,s,b) PPC_TYPE31(536,s,a,b) -#define PPC_SRW_(a,s,b) PPC_TYPE31(536,s,a,b)|PPC_RC -#define PPC_STBUX(s,a,b) PPC_TYPE31(247,s,a,b) -#define PPC_STBX(s,a,b) PPC_TYPE31(215,s,a,b) -#define PPC_STHBRX(s,a,b) PPC_TYPE31(918,s,a,b) -#define PPC_STHUX(s,a,b) PPC_TYPE31(439,s,a,b) -#define PPC_STHX(s,a,b) PPC_TYPE31(407,s,a,b) -#define PPC_STSWI(s,a,nb) PPC_TYPE31(725,s,a,nb) -#define PPC_STSWX(s,a,b) PPC_TYPE31(661,s,a,b) -#define PPC_STWBRX(s,a,b) PPC_TYPE31(662,s,a,b) -#define PPC_STWCX_(s,a,b) PPC_TYPE31(150,s,a,b)|PPC_RC -#define PPC_STWUX(s,a,b) PPC_TYPE31(183,s,a,b) -#define PPC_STWX(s,a,b) PPC_TYPE31(151,s,a,b) -#define PPC_SUBF(d,a,b) PPC_TYPE31(40,d,a,b) -#define PPC_SUBF_(d,a,b) PPC_TYPE31(40,d,a,b)|PPC_RC -#define PPC_SUBFO(d,a,b) PPC_TYPE31(40,d,a,b)|PPC_OE -#define PPC_SUBFO_(d,a,b) PPC_TYPE31(40,d,a,b)|PPC_OE|PPC_RC -#define PPC_SUB(d,b,a) PPC_SUBF(d,a,b) -#define PPC_SUB_(d,b,a) PPC_SUBF_(d,a,b) -#define PPC_SUBO(d,b,a) PPC_SUBFO(d,a,b) -#define PPC_SUBO_(d,b,a) PPC_SUBFO_(d,a,b) -#define PPC_SUBFC(d,a,b) PPC_TYPE31(8,d,a,b) -#define PPC_SUBFC_(d,a,b) PPC_TYPE31(8,d,a,b)|PPC_RC -#define PPC_SUBFCO(d,a,b) PPC_TYPE31(8,d,a,b)|PPC_OE -#define PPC_SUBFCO_(d,a,b) PPC_TYPE31(8,d,a,b)|PPC_OE|PPC_RC -#define PPC_SUBFE(d,a,b) PPC_TYPE31(136,d,a,b) -#define PPC_SUBFE_(d,a,b) PPC_TYPE31(136,d,a,b)|PPC_RC -#define PPC_SUBFEO(d,a,b) PPC_TYPE31(136,d,a,b)|PPC_OE -#define PPC_SUBFEO_(d,a,b) PPC_TYPE31(136,d,a,b)|PPC_OE|PPC_RC -#define PPC_SUBFME(d,a) PPC_TYPE31(232,d,a,0) -#define PPC_SUBFME_(d,a) PPC_TYPE31(232,d,a,0)|PPC_RC -#define PPC_SUBFMEO(d,a) PPC_TYPE31(232,d,a,0)|PPC_OE -#define PPC_SUBFMEO_(d,a) PPC_TYPE31(232,d,a,0)|PPC_OE|PPC_RC -#define PPC_SUBFZE(d,a) PPC_TYPE31(200,d,a,0) -#define PPC_SUBFZE_(d,a) PPC_TYPE31(200,d,a,0)|PPC_RC -#define PPC_SUBFZEO(d,a) PPC_TYPE31(200,d,a,0)|PPC_OE -#define PPC_SUBFZEO_(d,a) PPC_TYPE31(200,d,a,0)|PPC_OE|PPC_RC -#define PPC_SYNC() PPC_TYPE31(598,0,0,0) -#define PPC_TW(to,a,b) PPC_TYPE31(4,to,a,b) -#define PPC_XOR(a,s,b) PPC_TYPE31(316,s,a,b) - -/* Immediate-operand instructions. Take a 16-bit immediate operand */ -#define PPC_IMM(major,d,a,imm) \ - PPC_MAJOR(major)|PPC_DEST(d)|PPC_SRCA(a)|((imm)&0xffff) -/* Trap word immediate */ -#define PPV_TWI(to,a,simm) PPC_IMM(3,to,a,simm) -/* Integer arithmetic */ -#define PPC_MULLI(d,a,simm) PPC_IMM(7,d,a,simm) -#define PPC_SUBFIC(s,a,simm) PPC_IMM(8,s,a,simm) -#define PPC_CMPLI(cr,a,uimm) PPC_IMM(10,(cr)<<2,a,uimm) -#define PPC_CMPI(cr,a,simm) PPC_IMM(11,(cr)<<2,a,simm) -#define PPC_ADDIC(d,a,simm) PPC_IMM(12,d,a,simm) -#define PPC_ADDIC_(d,a,simm) PPC_IMM(13,d,a,simm) -#define PPC_ADDI(d,a,simm) PPC_IMM(14,d,a,simm) -#define PPC_ADDIS(d,a,simm) PPC_IMM(15,d,a,simm) - -/* Conditional branch (dest is 16 bits, +/- 2^15 bytes) */ -#define PPC_BC(bo,bi,dest) PPC_IMM(16,bo,bi,((dest)<<2)&0xfffc) -#define PPC_BCA(bo,bi,dest) PPC_BC(bo,bi,dest)|PPC_AA -#define PPC_BCL(bo,bi,dest) PPC_BC(bo,bi,dest)|PPC_LK -#define PPC_BCLA(bo,bi,dest) PPC_BC(bo,bi,dest)|PPC_AA|PPC_LK - -/* Logical operations */ -#define PPC_ORI(a,s,uimm) PPC_IMM(24,s,a,uimm) -#define PPC_ORIS(a,s,uimm) PPC_IMM(25,s,a,uimm) -#define PPC_XORI(a,s,uimm) PPC_IMM(26,s,a,uimm) -#define PPC_XORIS(a,s,uimm) PPC_IMM(27,s,a,uimm) -#define PPC_ANDI_(a,s,uimm) PPC_IMM(28,s,a,uimm) -#define PPC_ANDIS(a,s,uimm) PPC_IMM(29,s,a,uimm) - -/* Load/store */ -#define PPC_LWZ(d,a,simm) PPC_IMM(32,d,a,simm) -#define PPC_LWZU(d,a,simm) PPC_IMM(33,d,a,simm) -#define PPC_LBZ(d,a,simm) PPC_IMM(34,d,a,simm) -#define PPC_LBZU(d,a,simm) PPC_IMM(35,d,a,simm) -#define PPC_STW(s,a,simm) PPC_IMM(36,s,a,simm) -#define PPC_STWU(s,a,simm) PPC_IMM(37,s,a,simm) -#define PPC_STB(s,a,simm) PPC_IMM(38,s,a,simm) -#define PPC_STBU(s,a,simm) PPC_IMM(39,s,a,simm) -#define PPC_LHZ(d,a,simm) PPC_IMM(40,d,a,simm) -#define PPC_LHZU(d,a,simm) PPC_IMM(41,d,a,simm) -#define PPC_LHA(d,a,simm) PPC_IMM(42,d,a,simm) -#define PPC_STH(s,a,simm) PPC_IMM(44,s,a,simm) -#define PPC_STHU(s,a,simm) PPC_IMM(45,s,a,simm) -#define PPC_LHAU(d,a,simm) PPC_IMM(43,d,a,simm) -#define PPC_LMW(d,a,simm) PPC_IMM(46,d,a,simm) -#define PPC_STMW(s,a,simm) PPC_IMM(47,s,a,simm) - -/* Major number = 19 - condition register operations. d, a and b are CR bits */ -#define PPC_TYPE19(minor,d,a,b) \ - PPC_MAJOR(19)|PPC_DEST(d)|PPC_SRCA(a)|PPC_SRCB(b)|PPC_MINOR(minor) -#define PPC_MCRF(d,s) PPC_TYPE19(0,(d)<<2,(s)<<2,0) -#define PPC_CRNOR(d,a,b) PPC_TYPE19(33,d,a,b) -#define PPC_CRANDC(d,a,b) PPC_TYPE19(129,d,a,b) -#define PPC_CRXOR(d,a,b) PPC_TYPE19(193,d,a,b) -#define PPC_CRNAND(d,a,b) PPC_TYPE19(225,d,a,b) -#define PPC_CRAND(d,a,b) PPC_TYPE19(257,d,a,b) -#define PPC_CREQV(d,a,b) PPC_TYPE19(289,d,a,b) -#define PPC_CRORC(d,a,b) PPC_TYPE19(417,d,a,b) -#define PPC_CROR(d,a,b) PPC_TYPE19(449,d,a,b) - -/* Indirect conditional branch */ -#define PPC_BCLR(bo,bi) PPC_TYPE19(16,bo,bi,0) -#define PPC_BCLRL(bo,bi) PPC_TYPE19(16,bo,bi,0)|PPC_LK -#define PPC_BCCTR(bo,bi) PPC_TYPE19(528,bo,bi,0) -#define PPC_BCCTRL(bo,bi) PPC_TYPE19(528,bo,bi,0)|PPC_LK -#define PPC_BLR() PPC_BCLR(20,31) -#define PPC_BCTR() PPC_BCCTR(20,31) - -/* Other */ -#define PPC_RLWIMI(a,s,sh,mb,me) \ - PPC_MAJOR(20)|PPC_DEST(s)|PPC_SRCA(A)|PPC_SRCB(sh)|(mb)<<6|(me)<<1 -#define PPC_RLWIMI_(a,s,sh,mb,me) PPC_RLWIMI(a,s,sh,mb,me)|PPC_RC -#define PPC_RLWINM(a,s,sh,mb,me) \ - PPC_MAJOR(21)|PPC_DEST(s)|PPC_SRCA(A)|PPC_SRCB(sh)|(mb)<<6|(me)<<1 -#define PPC_RLWINM_(a,s,sh,mb,me) PPC_RLWINM(a,s,sh,mb,me)|PPC_RC -#define PPC_RLWNM(a,s,b,mb,me) \ - PPC_MAJOR(23)|PPC_DEST(s)|PPC_SRCA(A)|PPC_SRCB(b)|(mb)<<6|(me)<<1 -#define PPC_RLWNM_(a,s,b,mb,me) PPC_RLWNM(a,s,b,mb,me)|PPC_RC - -#define PPC_SC() PPC_MAJOR(17)|2 -/* Major number = 63 Floating-point operations (not implemented for now) */ - -/* Simplified Mnemonics */ -/* Fabricate immediate subtract out of add negative */ -#define PPC_SUBI(d,a,simm) PPC_ADDI(d,a,-(simm)) -#define PPC_SUBIS(d,a,simm) PPC_ADDIS(d,a,-(simm)) -#define PPC_SUBIC(d,a,simm) PPC_ADDIC(d,a,-(simm)) -#define PPC_SUBIC_(d,a,simm) PPC_ADDIC_(d,a,-(simm)) -/* Fabricate subtract out of subtract from */ -#define PPC_SUBC(d,b,a) PPC_SUBFC(d,a,b) -#define PPC_SUBC_(d,b,a) PPC_SUBFC_(d,a,b) -#define PPC_SUBCO(d,b,a) PPC_SUBFCO(d,a,b) -#define PPC_SUBCO_(d,b,a) PPC_SUBFCO_(d,a,b) -/* Messy compare bits omitted */ -/* Shift and rotate omitted */ -/* Branch coding omitted */ -#define PPC_CRSET(d) PPC_CREQV(d,d,d) -#define PPC_CRCLR(d) PPC_CRXOR(d,d,d) -#define PPC_CRMOVE(d,s) PPC_CROR(d,s,s) -#define PPC_CRNOT(d,s) PPC_CRNOR(d,s,s) -/* Trap menmonics omitted */ -/* Menmonics for user-accessible SPRs */ -#define PPC_MFXER(d) PPC_MFSPR(d,1) -#define PPC_MFLR(d) PPC_MFSPR(d,8) -#define PPC_MFCTR(d) PPC_MFSPR(d,9) -#define PPC_MTXER(s) PPC_MTSPR(s,1) -#define PPC_MTLR(s) PPC_MTSPR(s,8) -#define PPC_MTCTR(s) PPC_MTSPR(s,9) -/* Recommended mnemonics */ -#define PPC_NOP() PPC_ORI(0,0,0) -#define PPC_LI(d,simm) PPC_ADDI(d,0,simm) -#define PPC_LIS(d,simm) PPC_ADDIS(d,0,simm) -#define PPC_LA(d,a,simm) PPC_ADDI(d,a,simm) -#define PPC_MR(d,s) PPC_OR(d,s,s) -#define PPC_NOT(d,s) PPC_NOR(d,s,s) -#define PPC_MTCR(s) PPC_MTCRF(0xff,s) - -#endif /* PPCASM_H */ - -/* 45678901234567890123456789012345678901234567890123456789012345678901234567 */ diff --git a/libs/libzrtp/third_party/bnlib/prime.c b/libs/libzrtp/third_party/bnlib/prime.c deleted file mode 100644 index 56bea9ccaa..0000000000 --- a/libs/libzrtp/third_party/bnlib/prime.c +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Prime generation using the bignum library and sieving. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#include <stdarg.h> /* We just can't live without this... */ - -#ifndef BNDEBUG -#define BNDEBUG 1 -#endif -#if BNDEBUG -#include <stdio.h> -#endif - -#include "bn.h" -#include "lbnmem.h" -#include "prime.h" -#include "sieve.h" - -#include "kludge.h" - -/* Size of the shuffle table */ -#define SHUFFLE 256 -/* Size of the sieve area */ -#define SIEVE 32768u/16 - -/* Confirmation tests. The first one *must* be 2 */ -static unsigned const confirm[] = {2, 3, 5, 7, 11, 13, 17}; -#define CONFIRMTESTS (sizeof(confirm)/sizeof(*confirm)) - -/* - * Helper function that does the slow primality test. - * bn is the input bignum; a and e are temporary buffers that are - * allocated by the caller to save overhead. - * - * Returns 0 if prime, >0 if not prime, and -1 on error (out of memory). - * If not prime, returns the number of modular exponentiations performed. - * Calls the given progress function with a '*' for each primality test - * that is passed. - * - * The testing consists of strong pseudoprimality tests, to the bases given - * in the confirm[] array above. (Also called Miller-Rabin, although that's - * not technically correct if we're using fixed bases.) Some people worry - * that this might not be enough. Number theorists may wish to generate - * primality proofs, but for random inputs, this returns non-primes with - * a probability which is quite negligible, which is good enough. - * - * It has been proved (see Carl Pomerance, "On the Distribution of - * Pseudoprimes", Math. Comp. v.37 (1981) pp. 587-593) that the number of - * pseudoprimes (composite numbers that pass a Fermat test to the base 2) - * less than x is bounded by: - * exp(ln(x)^(5/14)) <= P_2(x) ### CHECK THIS FORMULA - it looks wrong! ### - * P_2(x) <= x * exp(-1/2 * ln(x) * ln(ln(ln(x))) / ln(ln(x))). - * Thus, the local density of Pseudoprimes near x is at most - * exp(-1/2 * ln(x) * ln(ln(ln(x))) / ln(ln(x))), and at least - * exp(ln(x)^(5/14) - ln(x)). Here are some values of this function - * for various k-bit numbers x = 2^k: - * Bits Density <= Bit equivalent Density >= Bit equivalent - * 128 3.577869e-07 21.414396 4.202213e-37 120.840190 - * 192 4.175629e-10 31.157288 4.936250e-56 183.724558 - * 256 5.804314e-13 40.647940 4.977813e-75 246.829095 - * 384 1.578039e-18 59.136573 3.938861e-113 373.400096 - * 512 5.858255e-24 77.175803 2.563353e-151 500.253110 - * 768 1.489276e-34 112.370944 7.872825e-228 754.422724 - * 1024 6.633188e-45 146.757062 1.882404e-304 1008.953565 - * - * As you can see, there's quite a bit of slop between these estimates. - * In fact, the density of pseudoprimes is conjectured to be closer to the - * square of that upper bound. E.g. the density of pseudoprimes of size - * 256 is around 3 * 10^-27. The density of primes is very high, from - * 0.005636 at 256 bits to 0.001409 at 1024 bits, i.e. more than 10^-3. - * - * For those people used to cryptographic levels of security where the - * 56 bits of DES key space is too small because it's exhaustible with - * custom hardware searching engines, note that you are not generating - * 50,000,000 primes per second on each of 56,000 custom hardware chips - * for several hours. The chances that another Dinosaur Killer asteroid - * will land today is about 10^-11 or 2^-36, so it would be better to - * spend your time worrying about *that*. Well, okay, there should be - * some derating for the chance that astronomers haven't seen it yet, - * but I think you get the idea. For a good feel about the probability - * of various events, I have heard that a good book is by E'mile Borel, - * "Les Probabilite's et la vie". (The 's are accents, not apostrophes.) - * - * For more on the subject, try "Finding Four Million Large Random Primes", - * by Ronald Rivest, in Advancess in Cryptology: Proceedings of Crypto - * '90. He used a small-divisor test, then a Fermat test to the base 2, - * and then 8 iterations of a Miller-Rabin test. About 718 million random - * 256-bit integers were generated, 43,741,404 passed the small divisor - * test, 4,058,000 passed the Fermat test, and all 4,058,000 passed all - * 8 iterations of the Miller-Rabin test, proving their primality beyond - * most reasonable doubts. - * - * If the probability of getting a pseudoprime is some small p, then the - * probability of not getting it in t trials is (1-p)^t. Remember that, - * for small p, (1-p)^(1/p) ~ 1/e, the base of natural logarithms. - * (This is more commonly expressed as e = lim_{x\to\infty} (1+1/x)^x.) - * Thus, (1-p)^t ~ e^(-p*t) = exp(-p*t). So the odds of being able to - * do this many tests without seeing a pseudoprime if you assume that - * p = 10^-6 (one in a million) is one in 57.86. If you assume that - * p = 2*10^-6, it's one in 3347.6. So it's implausible that the density - * of pseudoprimes is much more than one millionth the density of primes. - * - * He also gives a theoretical argument that the chance of finding a - * 256-bit non-prime which satisfies one Fermat test to the base 2 is - * less than 10^-22. The small divisor test improves this number, and - * if the numbers are 512 bits (as needed for a 1024-bit key) the odds - * of failure shrink to about 10^-44. Thus, he concludes, for practical - * purposes *one* Fermat test to the base 2 is sufficient. - */ -static int -primeTest(struct BigNum const *bn, struct BigNum *e, struct BigNum *a, - int (*f)(void *arg, int c), void *arg) -{ - unsigned i, j; - unsigned k, l; - int err; - -#if BNDEBUG /* Debugging */ - /* - * This is debugging code to test the sieving stage. - * If the sieving is wrong, it will let past numbers with - * small divisors. The prime test here will still work, and - * weed them out, but you'll be doing a lot more slow tests, - * and presumably excluding from consideration some other numbers - * which might be prime. This check just verifies that none - * of the candidates have any small divisors. If this - * code is enabled and never triggers, you can feel quite - * confident that the sieving is doing its job. - */ - i = bnLSWord(bn); - if (!(i % 2)) printf("bn div by 2!"); - i = bnModQ(bn, 51051); /* 51051 = 3 * 7 * 11 * 13 * 17 */ - if (!(i % 3)) printf("bn div by 3!"); - if (!(i % 7)) printf("bn div by 7!"); - if (!(i % 11)) printf("bn div by 11!"); - if (!(i % 13)) printf("bn div by 13!"); - if (!(i % 17)) printf("bn div by 17!"); - i = bnModQ(bn, 63365); /* 63365 = 5 * 19 * 23 * 29 */ - if (!(i % 5)) printf("bn div by 5!"); - if (!(i % 19)) printf("bn div by 19!"); - if (!(i % 23)) printf("bn div by 23!"); - if (!(i % 29)) printf("bn div by 29!"); - i = bnModQ(bn, 47027); /* 47027 = 31 * 37 * 41 */ - if (!(i % 31)) printf("bn div by 31!"); - if (!(i % 37)) printf("bn div by 37!"); - if (!(i % 41)) printf("bn div by 41!"); -#endif - - /* - * Now, check that bn is prime. If it passes to the base 2, - * it's prime beyond all reasonable doubt, and everything else - * is just gravy, but it gives people warm fuzzies to do it. - * - * This starts with verifying Euler's criterion for a base of 2. - * This is the fastest pseudoprimality test that I know of, - * saving a modular squaring over a Fermat test, as well as - * being stronger. 7/8 of the time, it's as strong as a strong - * pseudoprimality test, too. (The exception being when bn == - * 1 mod 8 and 2 is a quartic residue, i.e. bn is of the form - * a^2 + (8*b)^2.) The precise series of tricks used here is - * not documented anywhere, so here's an explanation. - * Euler's criterion states that if p is prime then a^((p-1)/2) - * is congruent to Jacobi(a,p), modulo p. Jacobi(a,p) is - * a function which is +1 if a is a square modulo p, and -1 if - * it is not. For a = 2, this is particularly simple. It's - * +1 if p == +/-1 (mod 8), and -1 if m == +/-3 (mod 8). - * If p == 3 mod 4, then all a strong test does is compute - * 2^((p-1)/2). and see if it's +1 or -1. (Euler's criterion - * says *which* it should be.) If p == 5 (mod 8), then - * 2^((p-1)/2) is -1, so the initial step in a strong test, - * looking at 2^((p-1)/4), is wasted - you're not going to - * find a +/-1 before then if it *is* prime, and it shouldn't - * have either of those values if it isn't. So don't bother. - * - * The remaining case is p == 1 (mod 8). In this case, we - * expect 2^((p-1)/2) == 1 (mod p), so we expect that the - * square root of this, 2^((p-1)/4), will be +/-1 (mod p). - * Evaluating this saves us a modular squaring 1/4 of the time. - * If it's -1, a strong pseudoprimality test would call p - * prime as well. Only if the result is +1, indicating that - * 2 is not only a quadratic residue, but a quartic one as well, - * does a strong pseudoprimality test verify more things than - * this test does. Good enough. - * - * We could back that down another step, looking at 2^((p-1)/8) - * if there was a cheap way to determine if 2 were expected to - * be a quartic residue or not. Dirichlet proved that 2 is - * a quartic residue iff p is of the form a^2 + (8*b^2). - * All primes == 1 (mod 4) can be expressed as a^2 + (2*b)^2, - * but I see no cheap way to evaluate this condition. - */ - if (bnCopy(e, bn) < 0) - return -1; - (void)bnSubQ(e, 1); - l = bnLSWord(e); - - j = 1; /* Where to start in prime array for strong prime tests */ - - if (l & 7) { - bnRShift(e, 1); - if (bnTwoExpMod(a, e, bn) < 0) - return -1; - if ((l & 7) == 6) { - /* bn == 7 mod 8, expect +1 */ - if (bnBits(a) != 1) - return 1; /* Not prime */ - k = 1; - } else { - /* bn == 3 or 5 mod 8, expect -1 == bn-1 */ - if (bnAddQ(a, 1) < 0) - return -1; - if (bnCmp(a, bn) != 0) - return 1; /* Not prime */ - k = 1; - if (l & 4) { - /* bn == 5 mod 8, make odd for strong tests */ - bnRShift(e, 1); - k = 2; - } - } - } else { - /* bn == 1 mod 8, expect 2^((bn-1)/4) == +/-1 mod bn */ - bnRShift(e, 2); - if (bnTwoExpMod(a, e, bn) < 0) - return -1; - if (bnBits(a) == 1) { - j = 0; /* Re-do strong prime test to base 2 */ - } else { - if (bnAddQ(a, 1) < 0) - return -1; - if (bnCmp(a, bn) != 0) - return 1; /* Not prime */ - } - k = 2 + bnMakeOdd(e); - } - /* It's prime! Now go on to confirmation tests */ - - /* - * Now, e = (bn-1)/2^k is odd. k >= 1, and has a given value - * with probability 2^-k, so its expected value is 2. - * j = 1 in the usual case when the previous test was as good as - * a strong prime test, but 1/8 of the time, j = 0 because - * the strong prime test to the base 2 needs to be re-done. - */ - for (i = j; i < CONFIRMTESTS; i++) { - if (f && (err = f(arg, '*')) < 0) - return err; - (void)bnSetQ(a, confirm[i]); - if (bnExpMod(a, a, e, bn) < 0) - return -1; - if (bnBits(a) == 1) - continue; /* Passed this test */ - - l = k; - for (;;) { - if (bnAddQ(a, 1) < 0) - return -1; - if (bnCmp(a, bn) == 0) /* Was result bn-1? */ - break; /* Prime */ - if (!--l) /* Reached end, not -1? luck? */ - return i+2-j; /* Failed, not prime */ - /* This portion is executed, on average, once. */ - (void)bnSubQ(a, 1); /* Put a back where it was. */ - if (bnSquare(a, a) < 0 || bnMod(a, a, bn) < 0) - return -1; - if (bnBits(a) == 1) - return i+2-j; /* Failed, not prime */ - } - /* It worked (to the base confirm[i]) */ - } - - /* Yes, we've decided that it's prime. */ - if (f && (err = f(arg, '*')) < 0) - return err; - return 0; /* Prime! */ -} - -/* - * Add x*y to bn, which is usually (but not always) < 65536. - * Do it in a simple linear manner. - */ -static int -bnAddMult(struct BigNum *bn, unsigned x, unsigned y) -{ - unsigned long z = (unsigned long)x * y; - - while (z > 65535) { - if (bnAddQ(bn, 65535) < 0) - return -1; - z -= 65535; - } - return bnAddQ(bn, (unsigned)z); -} - -static int -bnSubMult(struct BigNum *bn, unsigned x, unsigned y) -{ - unsigned long z = (unsigned long)x * y; - - while (z > 65535) { - if (bnSubQ(bn, 65535) < 0) - return -1; - z -= 65535; - } - return bnSubQ(bn, (unsigned)z); -} - -/* - * Modifies the bignum to return a nearby (slightly larger) number which - * is a probable prime. Returns >=0 on success or -1 on failure (out of - * memory). The return value is the number of unsuccessful modular - * exponentiations performed. This never gives up searching. - * - * All other arguments are optional. They may be NULL. They are: - * - * unsigned (*rand)(unsigned limit) - * For better distributed numbers, supply a non-null pointer to a - * function which returns a random x, 0 <= x < limit. (It may make it - * simpler to know that 0 < limit <= SHUFFLE, so you need at most a byte.) - * The program generates a large window of sieve data and then does - * pseudoprimality tests on the data. If a rand function is supplied, - * the candidates which survive sieving are shuffled with a window of - * size SHUFFLE before testing to increase the uniformity of the prime - * selection. This isn't perfect, but it reduces the correlation between - * the size of the prime-free gap before a prime and the probability - * that that prime will be found by a sequential search. - * - * If rand is NULL, sequential search is used. If you want sequential - * search, note that the search begins with the given number; if you're - * trying to generate consecutive primes, you must increment the previous - * one by two before calling this again. - * - * int (*f)(void *arg, int c), void *arg - * The function f argument, if non-NULL, is called with progress indicator - * characters for printing. A dot (.) is written every time a primality test - * is failed, a star (*) every time one is passed, and a slash (/) in the - * (very rare) case that the sieve was emptied without finding a prime - * and is being refilled. f is also passed the void *arg argument for - * private context storage. If f returns < 0, the test aborts and returns - * that value immediately. (bn is set to the last value tested, so you - * can increment bn and continue.) - * - * The "exponent" argument, and following unsigned numbers, are exponents - * for which an inverse is desired, modulo p. For a d to exist such that - * (x^e)^d == x (mod p), then d*e == 1 (mod p-1), so gcd(e,p-1) must be 1. - * The prime returned is constrained to not be congruent to 1 modulo - * any of the zero-terminated list of 16-bit numbers. Note that this list - * should contain all the small prime factors of e. (You'll have to test - * for large prime factors of e elsewhere, but the chances of needing to - * generate another prime are low.) - * - * The list is terminated by a 0, and may be empty. - */ -int -primeGen(struct BigNum *bn, unsigned (*rand)(unsigned), - int (*f)(void *arg, int c), void *arg, unsigned exponent, ...) -{ - int retval; - int modexps = 0; - unsigned short offsets[SHUFFLE]; - unsigned i, j; - unsigned p, q, prev; - struct BigNum a, e; -#ifdef MSDOS - unsigned char *sieve; -#else - unsigned char sieve[SIEVE]; -#endif - -#ifdef MSDOS - sieve = lbnMemAlloc(SIEVE); - if (!sieve) - return -1; -#endif - - bnBegin(&a); - bnBegin(&e); - -#if 0 /* Self-test (not used for production) */ -{ - struct BigNum t; - static unsigned char const prime1[] = {5}; - static unsigned char const prime2[] = {7}; - static unsigned char const prime3[] = {11}; - static unsigned char const prime4[] = {1, 1}; /* 257 */ - static unsigned char const prime5[] = {0xFF, 0xF1}; /* 65521 */ - static unsigned char const prime6[] = {1, 0, 1}; /* 65537 */ - static unsigned char const prime7[] = {1, 0, 3}; /* 65539 */ - /* A small prime: 1234567891 */ - static unsigned char const prime8[] = {0x49, 0x96, 0x02, 0xD3}; - /* A slightly larger prime: 12345678901234567891 */ - static unsigned char const prime9[] = { - 0xAB, 0x54, 0xA9, 0x8C, 0xEB, 0x1F, 0x0A, 0xD3 }; - /* - * No, 123456789012345678901234567891 isn't prime; it's just a - * lucky, easy-to-remember conicidence. (You have to go to - * ...4567907 for a prime.) - */ - static struct { - unsigned char const *prime; - unsigned size; - } const primelist[] = { - { prime1, sizeof(prime1) }, - { prime2, sizeof(prime2) }, - { prime3, sizeof(prime3) }, - { prime4, sizeof(prime4) }, - { prime5, sizeof(prime5) }, - { prime6, sizeof(prime6) }, - { prime7, sizeof(prime7) }, - { prime8, sizeof(prime8) }, - { prime9, sizeof(prime9) } }; - - bnBegin(&t); - - for (i = 0; i < sizeof(primelist)/sizeof(primelist[0]); i++) { - bnInsertBytes(&t, primelist[i].prime, 0, - primelist[i].size); - bnCopy(&e, &t); - (void)bnSubQ(&e, 1); - bnTwoExpMod(&a, &e, &t); - p = bnBits(&a); - if (p != 1) { - printf( - "Bug: Fermat(2) %u-bit output (1 expected)\n", p); - fputs("Prime = 0x", stdout); - for (j = 0; j < primelist[i].size; j++) - printf("%02X", primelist[i].prime[j]); - putchar('\n'); - } - bnSetQ(&a, 3); - bnExpMod(&a, &a, &e, &t); - p = bnBits(&a); - if (p != 1) { - printf( - "Bug: Fermat(3) %u-bit output (1 expected)\n", p); - fputs("Prime = 0x", stdout); - for (j = 0; j < primelist[i].size; j++) - printf("%02X", primelist[i].prime[j]); - putchar('\n'); - } - } - - bnEnd(&t); -} -#endif - - /* First, make sure that bn is odd. */ - if ((bnLSWord(bn) & 1) == 0) - (void)bnAddQ(bn, 1); - -retry: - /* Then build a sieve starting at bn. */ - sieveBuild(sieve, SIEVE, bn, 2, 0); - - /* Do the extra exponent sieving */ - if (exponent) { - va_list ap; - unsigned t = exponent; - - va_start(ap, exponent); - - do { - /* The exponent had better be odd! */ - assert(t & 1); - - i = bnModQ(bn, t); - /* Find 1-i */ - if (i == 0) - i = 1; - else if (--i) - i = t - i; - - /* Divide by 2, modulo the exponent */ - i = (i & 1) ? i/2 + t/2 + 1 : i/2; - - /* Remove all following multiples from the sieve. */ - sieveSingle(sieve, SIEVE, i, t); - - /* Get the next exponent value */ - t = va_arg(ap, unsigned); - } while (t); - - va_end(ap); - } - - /* Fill up the offsets array with the first SHUFFLE candidates */ - i = p = 0; - /* Get first prime */ - if (sieve[0] & 1 || (p = sieveSearch(sieve, SIEVE, p)) != 0) { - offsets[i++] = p; - p = sieveSearch(sieve, SIEVE, p); - } - /* - * Okay, from this point onwards, p is always the next entry - * from the sieve, that has not been added to the shuffle table, - * and is 0 iff the sieve has been exhausted. - * - * If we want to shuffle, then fill the shuffle table until the - * sieve is exhausted or the table is full. - */ - if (rand && p) { - do { - offsets[i++] = p; - p = sieveSearch(sieve, SIEVE, p); - } while (p && i < SHUFFLE); - } - - /* Choose a random candidate for experimentation */ - prev = 0; - while (i) { - /* Pick a random entry from the shuffle table */ - j = rand ? rand(i) : 0; - q = offsets[j]; /* The entry to use */ - - /* Replace the entry with some more data, if possible */ - if (p) { - offsets[j] = p; - p = sieveSearch(sieve, SIEVE, p); - } else { - offsets[j] = offsets[--i]; - offsets[i] = 0; - } - - /* Adjust bn to have the right value */ - if ((q > prev ? bnAddMult(bn, q-prev, 2) - : bnSubMult(bn, prev-q, 2)) < 0) - goto failed; - prev = q; - - /* Now do the Fermat tests */ - retval = primeTest(bn, &e, &a, f, arg); - if (retval <= 0) - goto done; /* Success or error */ - modexps += retval; - if (f && (retval = f(arg, '.')) < 0) - goto done; - } - - /* Ran out of sieve space - increase bn and keep trying. */ - if (bnAddMult(bn, SIEVE*8-prev, 2) < 0) - goto failed; - if (f && (retval = f(arg, '/')) < 0) - goto done; - goto retry; - -failed: - retval = -1; -done: - bnEnd(&e); - bnEnd(&a); - lbnMemWipe(offsets, sizeof(offsets)); -#ifdef MSDOS - lbnMemFree(sieve, SIEVE); -#else - lbnMemWipe(sieve, sizeof(sieve)); -#endif - - return retval < 0 ? retval : modexps + CONFIRMTESTS; -} - -/* - * Similar, but searches forward from the given starting value in steps of - * "step" rather than 1. The step size must be even, and bn must be odd. - * Among other possibilities, this can be used to generate "strong" - * primes, where p-1 has a large prime factor. - */ -int -primeGenStrong(struct BigNum *bn, struct BigNum const *step, - int (*f)(void *arg, int c), void *arg) -{ - int retval; - unsigned p, prev; - struct BigNum a, e; - int modexps = 0; -#ifdef MSDOS - unsigned char *sieve; -#else - unsigned char sieve[SIEVE]; -#endif - -#ifdef MSDOS - sieve = lbnMemAlloc(SIEVE); - if (!sieve) - return -1; -#endif - - /* Step must be even and bn must be odd */ - assert((bnLSWord(step) & 1) == 0); - assert((bnLSWord(bn) & 1) == 1); - - bnBegin(&a); - bnBegin(&e); - - for (;;) { - if (sieveBuildBig(sieve, SIEVE, bn, step, 0) < 0) - goto failed; - - p = prev = 0; - if (sieve[0] & 1 || (p = sieveSearch(sieve, SIEVE, p)) != 0) { - do { - /* - * Adjust bn to have the right value, - * adding (p-prev) * 2*step. - */ - assert(p >= prev); - /* Compute delta into a */ - if (bnMulQ(&a, step, p-prev) < 0) - goto failed; - if (bnAdd(bn, &a) < 0) - goto failed; - prev = p; - - retval = primeTest(bn, &e, &a, f, arg); - if (retval <= 0) - goto done; /* Success! */ - modexps += retval; - if (f && (retval = f(arg, '.')) < 0) - goto done; - - /* And try again */ - p = sieveSearch(sieve, SIEVE, p); - } while (p); - } - - /* Ran out of sieve space - increase bn and keep trying. */ -#if SIEVE*8 == 65536 - /* Corner case that will never actually happen */ - if (!prev) { - if (bnAdd(bn, step) < 0) - goto failed; - p = 65535; - } else { - p = (unsigned)(SIEVE*8 - prev); - } -#else - p = SIEVE*8 - prev; -#endif - if (bnMulQ(&a, step, p) < 0 || bnAdd(bn, &a) < 0) - goto failed; - if (f && (retval = f(arg, '/')) < 0) - goto done; - } /* for (;;) */ - -failed: - retval = -1; - -done: - - bnEnd(&e); - bnEnd(&a); -#ifdef MSDOS - lbnMemFree(sieve, SIEVE); -#else - lbnMemWipe(sieve, sizeof(sieve)); -#endif - return retval < 0 ? retval : modexps + CONFIRMTESTS; -} diff --git a/libs/libzrtp/third_party/bnlib/prime.h b/libs/libzrtp/third_party/bnlib/prime.h deleted file mode 100644 index 8cfb3665f7..0000000000 --- a/libs/libzrtp/third_party/bnlib/prime.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -struct BigNum; - -/* Generate a prime >= bn. leaving the result in bn. */ -int primeGen(struct BigNum *bn, unsigned (*randfunc)(unsigned), - int (*f)(void *arg, int c), void *arg, unsigned exponent, ...); - -/* - * Generate a prime of the form bn + k*step. Step must be even and - * bn must be odd. - */ -int primeGenStrong(struct BigNum *bn, struct BigNum const *step, - int (*f)(void *arg, int c), void *arg); diff --git a/libs/libzrtp/third_party/bnlib/sieve.c b/libs/libzrtp/third_party/bnlib/sieve.c deleted file mode 100644 index 697e62652f..0000000000 --- a/libs/libzrtp/third_party/bnlib/sieve.c +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * sieve.c - Trial division for prime finding. - * - * Finding primes: - * - Sieve 1 to find the small primes for - * - Sieve 2 to find the candidate large primes, then - * - Pseudo-primality test. - * - * An important question is how much trial division by small primes - * should we do? The answer is a LOT. Even a heavily optimized - * Fermat test to the base 2 (the simplest pseudoprimality test) - * is much more expensive than a division. - * - * For an prime of n k-bit words, a Fermat test to the base 2 requires n*k - * modular squarings, each of which involves n*(n+1)/2 signle-word multiplies - * in the squaring and n*(n+1) multiplies in the modular reduction, plus - * some overhead to get into and out of Montgomery form. This is a total - * of 3/2 * k * n^2 * (n+1). Equivalently, if n*k = b bits, it's - * 3/2 * (b/k+1) * b^2 / k. - * - * A modulo operation requires n single-word divides. Let's assume that - * a divide is 4 times the cost of a multiply. That's 4*n multiplies. - * However, you only have to do the division once for your entire - * search. It can be amortized over 10-15 primes. So it's - * really more like n/3 multiplies. This is b/3k. - * - * Now, let's suppose you have a candidate prime t. Your options - * are to a) do trial division by a prime p, then do a Fermat test, - * or to do the Fermat test directly. Doing the trial division - * costs b/3k multiplies, but a certain fraction of the time (1/p), it - * saves you 3/2 b^3 / k^2 multiplies. Thus, it's worth it doing the - * division as long as b/3k < 3/2 * (b/k+1) * b^2 / k / p. - * I.e. p < 9/2 * (b/k + 1) * b = 9/2 * (b^2/k + b). - * E.g. for k=16 and b=256, p < 9/2 * 17 * 256 = 19584. - * Solving for k=16 and k=32 at a few interesting value of b: - * - * k=16, b=256: p < 19584 k=32, b=256: p < 10368 - * k=16, b=384: p < 43200 k=32, b=384; p < 22464 - * k=16, b=512: p < 76032 k=32, b=512: p < 39168 - * k=16, b=640: p < 118080 k=32, b=640: p < 60480 - * - * H'm... before using the highly-optimized Fermat test, I got much larger - * numbers (64K to 256K), and designed the sieve for that. Maybe it needs - * to be reduced. It *is* true that the desirable sieve size increases - * rapidly with increasing prime size, and it's the larger primes that are - * worrisome in any case. I'll leave it as is (64K) for now while I - * think about it. - * - * A bit of tweaking the division (we can compute a reciprocal and do - * multiplies instead, turning 4*n into 4 + 2*n) would increase all the - * numbers by a factor of 2 or so. - * - * - * Bit k in a sieve corresponds to the number a + k*b. - * For a given a and b, the sieve's job is to find the values of - * k for which a + k*b == 0 (mod p). Multiplying by b^-1 and - * isolating k, you get k == -a*b^-1 (mod p). So the values of - * k which should be worked on are k = (-a*b^-1 mod p) + i * p, - * for i = 0, 1, 2,... - * - * Note how this is still easy to use with very large b, if you need it. - * It just requires computing (b mod p) and then finding the multiplicative - * inverse of that. - * - * - * How large a space to search to ensure that one will hit a prime? - * The average density is known, but the primes behave oddly, and sometimes - * there are large gaps. It is conjectured by shanks that the first gap - * of size "delta" will occur at approximately exp(sqrt(delta)), so a delta - * of 65536 is conjectured to be to contain a prime up to e^256. - * Remembering the handy 2<->e conversion ratios: - * ln(2) = 0.693147 log2(e) = 1.442695 - * This covers up to 369 bits. Damn, not enough! Still, it'll have to do. - * - * Cramer's conjecture (he proved it for "most" cases) is that in the limit, - * as p goes to infinity, the largest gap after a prime p tends to (ln(p))^2. - * So, for a 1024-bit p, the interval to the next prime is expected to be - * about 709.78^2, or 503791. We'd need to enlarge our space by a factor of - * 8 to be sure. It isn't worth the hassle. - * - * Note that a span of this size is expected to contain 92 primes even - * in the vicinity of 2^1024 (it's 369 at 256 bits and 492 at 192 bits). - * So the probability of failure is pretty low. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_CONFIG_H 0 -#endif -#if HAVE_CONFIG_H -#include "bnconfig.h" -#endif - -/* - * Some compilers complain about #if FOO if FOO isn't defined, - * so do the ANSI-mandated thing explicitly... - */ -#ifndef NO_ASSERT_H -#define NO_ASSERT_H 0 -#endif -#ifndef NO_LIMITS_H -#define NO_LIMITS_H 0 -#endif -#ifndef NO_STRING_H -#define NO_STRING_H 0 -#endif -#ifndef HAVE_STRINGS_H -#define HAVE_STRINGS_H 0 -#endif - -#if !NO_ASSERT_H -#include <assert.h> -#else -#define assert(x) (void)0 -#endif - -#if !NO_LIMITS_H -#include <limits.h> /* For UINT_MAX */ -#endif /* If not avail, default value of 0 is safe */ - -#if !NO_STRING_H -#include <string.h> /* for memset() */ -#elif HAVE_STRINGS_H -#include <strings.h> -#endif - -#include "bn.h" -#include "sieve.h" -#ifdef MSDOS -#include "lbnmem.h" -#endif - -#include "kludge.h" - -/* - * Each array stores potential primes as 1 bits in little-endian bytes. - * Bit k in an array represents a + k*b, for some parameters a and b - * of the sieve. Currently, b is hardcoded to 2. - * - * Various factors of 16 arise because these are all *byte* sizes, and - * skipping even numbers, 16 numbers fit into a byte's worth of bitmap. - */ - -/* - * The first number in the small prime sieve. This could be raised to - * 3 if you want to squeeze bytes out aggressively for a smaller SMALL - * table, and doing so would let one more prime into the end of the array, - * but there is no sense making it larger if you're generating small - * primes up to the limit if 2^16, since it doesn't save any memory and - * would require extra code to ignore 65537 in the last byte, which is - * over the 16-bit limit. - */ -#define SMALLSTART 1 - -/* - * Size of sieve used to find large primes, in bytes. For compatibility - * with 16-bit-int systems, the largest prime that can appear in it, - * SMALL * 16 + SMALLSTART - 2, must be < 65536. Since 65537 is a prime, - * this is the absolute maximum table size. - */ -#define SMALL (65536/16) - -/* - * Compute the multiplicative inverse of x, modulo mod, using the extended - * Euclidean algorithm. The classical EEA returns two results, traditionally - * named s and t, but only one (t) is needed or computed here. - * It is unrolled twice to avoid some variable-swapping, and because negating - * t every other round makes all the number positive and less than the - * modulus, which makes fixed-length arithmetic easier. - * - * If gcd(x, mod) != 1, then this will return 0. - */ -static unsigned -sieveModInvert(unsigned x, unsigned mod) -{ - unsigned y; - unsigned t0, t1; - unsigned q; - - if (x <= 1) - return x; /* 0 and 1 are self-inverse */ - /* - * The first round is simplified based on the - * initial conditions t0 = 1 and t1 = 0. - */ - t1 = mod / x; - y = mod % x; - if (y <= 1) - return y ? mod - t1 : 0; - t0 = 1; - - do { - q = x / y; - x = x % y; - t0 += q * t1; - if (x <= 1) - return x ? t0 : 0; - q = y / x; - y = y % x; - t1 += q * t0; - } while (y > 1); - return y ? mod - t1 : 0; -} - - -/* - * Perform a single sieving operation on an array. Clear bits "start", - * "start+step", "start+2*step", etc. from the array, up to the size - * limit (in BYTES) "size". All of the arguments must fit into 16 bits - * for portability. - * - * This is the core of the sieving operation. In addition to being - * called from the sieving functions, it is useful to call directly if, - * say, you want to exclude primes congruent to 1 mod 3, or whatever. - * (Although in that case, it would be better to change the sieving to - * use a step size of 6 and start == 5 (mod 6).) - * - * Originally, this was inlined in the code below (with various checks - * turned off where they could be inferred from the environment), but it - * turns out that all the sieving is so fast that it makes a negligible - * speed difference and smaller, cleaner code was preferred. - * - * Rather than increment a bit index through the array and clear - * the corresponding bit, this code takes advantage of the fact that - * every eighth increment must use the same bit position in a byte. - * I.e. start + k*step == start + (k+8)*step (mod 8). Thus, a bitmask - * can be computed only eight times and used for all multiples. Thus, the - * outer loop is over (k mod 8) while the inner loop is over (k div 8). - * - * The only further trickiness is that this code is designed to accept - * start, step, and size up to 65535 on 16-bit machines. On such a - * machine, the computation "start+step" can overflow, so we need to - * insert an extra check for that situation. - */ -void -sieveSingle(unsigned char *array, unsigned size, unsigned start, unsigned step) -{ - unsigned bit; - unsigned char mask; - unsigned i; - -#if UINT_MAX < 0x1ffff - /* Unsigned is small; add checks for wrap */ - for (bit = 0; bit < 8; bit++) { - i = start/8; - if (i >= size) - break; - mask = ~(1 << (start & 7)); - do { - array[i] &= mask; - i += step; - } while (i >= step && i < size); - start += step; - if (start < step) /* Overflow test */ - break; - } -#else - /* Unsigned has the range - no overflow possible */ - for (bit = 0; bit < 8; bit++) { - i = start/8; - if (i >= size) - break; - mask = ~(1 << (start & 7)); - do { - array[i] &= mask; - i += step; - } while (i < size); - start += step; - } -#endif -} - -/* - * Returns the index of the next bit set in the given array. The search - * begins after the specified bit, so if you care about bit 0, you need - * to check it explicitly yourself. This returns 0 if no bits are found. - * - * Note that the size is in bytes, and that it takes and returns BIT - * positions. If the array represents odd numbers only, as usual, the - * returned values must be doubled to turn them into offsets from the - * initial number. - */ -unsigned -sieveSearch(unsigned char const *array, unsigned size, unsigned start) -{ - unsigned i; /* Loop index */ - unsigned char t; /* Temp */ - - if (!++start) - return 0; - i = start/8; - if (i >= size) - return 0; /* Done! */ - - /* Deal with odd-bit beginnings => search the first byte */ - if (start & 7) { - t = array[i++] >> (start & 7); - if (t) { - if (!(t & 15)) { - t >>= 4; - start += 4; - } - if (!(t & 3)) { - t >>= 2; - start += 2; - } - if (!(t & 1)) - start += 1; - return start; - } else if (i == size) { - return 0; /* Done */ - } - } - - /* Now the main search loop */ - - do { - if ((t = array[i]) != 0) { - start = 8*i; - if (!(t & 15)) { - t >>= 4; - start += 4; - } - if (!(t & 3)) { - t >>= 2; - start += 2; - } - if (!(t & 1)) - start += 1; - return start; - } - } while (++i < size); - - /* Failed */ - return 0; -} - -/* - * Build a table of small primes for sieving larger primes with. This - * could be cached between calls to sieveBuild, but it's so fast that - * it's really not worth it. This code takes a few milliseconds to run. - */ -static void -sieveSmall(unsigned char *array, unsigned size) -{ - unsigned i; /* Loop index */ - unsigned p; /* The current prime */ - - /* Initialize to all 1s */ - memset(array, 0xFF, size); - -#if SMALLSTART == 1 - /* Mark 1 as NOT prime */ - array[0] = 0xfe; - i = 1; /* Index of first prime */ -#else - i = 0; /* Index of first prime */ -#endif - - /* - * Okay, now sieve via the primes up to 256, obtained from the - * table itself. We know the maximum possible table size is - * 65536, and sieveSingle() can cope with out-of-range inputs - * safely, and the time required is trivial, so it isn't adaptive - * based on the array size. - * - * Convert each bit position into a prime, compute a starting - * sieve position (the square of the prime), and remove multiples - * from the table, using sieveSingle(). I used to have that - * code in line here, but the speed difference was so small it - * wasn't worth it. If a compiler really wants to waste memory, - * it can inline it. - */ - do { - p = 2 * i + SMALLSTART; - if (p > 256) - break; - /* Start at square of p */ - sieveSingle(array, size, (p*p-SMALLSTART)/2, p); - - /* And find the next prime */ - i = sieveSearch(array, 16, i); - } while (i); -} - - -/* - * This is the primary sieving function. It fills in the array with - * a sieve (multiples of small primes removed) beginning at bn and - * proceeding in steps of "step". - * - * It generates a small array to get the primes to sieve by. It's - * generated on the fly - sieveSmall is fast enough to make that - * perfectly acceptable. - * - * The caller should take the array, walk it with sieveSearch, and - * apply a stronger primality test to the numbers that are returned. - * - * If the "dbl" flag non-zero (at least 1), this also sieves 2*bn+1, in - * steps of 2*step. If dbl is 2 or more, this also sieve 4*bn+3, - * in steps of 4*step, and so on for arbitrarily high values of "dbl". - * This is convenient for finding primes such that (p-1)/2 is also prime. - * This is particularly efficient because sieveSingle is controlled by the - * parameter s = -n/step (mod p). (In fact, we find t = -1/step (mod p) - * and multiply that by n (mod p).) If you have -n/step (mod p), then - * finding -(2*n+1)/(2*step) (mod p), which is -n/step - 1/(2*step) (mod p), - * reduces to finding -1/(2*step) (mod p), or t/2 (mod p), and adding that - * to s = -n/step (mod p). Dividing by 2 modulo an odd p is easy - - * if even, divide directly. Otherwise, add p (which produces an even - * sum), and divide by 2. Very simple. And this produces s' and t' - * for step' = 2*step. It can be repeated for step'' = 4*step and so on. - * - * Note that some of the math is complicated by the fact that 2*p might - * not fit into an unsigned, so rather than if (odd(x)) x = (x+p)/2, - * we do if (odd(x)) x = x/2 + p/2 + 1; - * - * TODO: Do the double-sieving by sieving the larger number, and then - * just subtract one from the remainder to get the other parameter. - * (bn-1)/2 is divisible by an odd p iff bn-1 is divisible, which is - * true iff bn == 1 mod p. This requires using a step size of 4. - */ -int -sieveBuild(unsigned char *array, unsigned size, struct BigNum const *bn, - unsigned step, unsigned dbl) -{ - unsigned i, j; /* Loop index */ - unsigned p; /* Current small prime */ - unsigned s; /* Where to start operations in the big sieve */ - unsigned t; /* Step modulo p, the current prime */ -#ifdef MSDOS /* Use dynamic allocation rather than on the stack */ - unsigned char *small; -#else - unsigned char small[SMALL]; -#endif - - assert(array); - -#ifdef MSDOS - small = lbnMemAlloc(SMALL); /* Which allocator? Not secure. */ - if (!small) - return -1; /* Failed */ -#endif - - /* - * An odd step is a special case, since we must sieve by 2, - * which isn't in the small prime array and has a few other - * special properties. These are: - * - Since the numbers are stored in binary, we don't need to - * use bnModQ to find the remainder. - * - If step is odd, then t = step % 2 is 1, which allows - * the elimination of a lot of math. Inverting and negating - * t don't change it, and multiplying s by 1 is a no-op, - * so t isn't actually mentioned. - * - Since this is the first sieving, instead of calling - * sieveSingle, we can just use memset to fill the array - * with 0x55 or 0xAA. Since a 1 bit means possible prime - * (i.e. NOT divisible by 2), and the least significant bit - * is first, if bn % 2 == 0, we use 0xAA (bit 0 = bn is NOT - * prime), while if bn % 2 == 1, use 0x55. - * (If step is even, bn must be odd, so fill the array with 0xFF.) - * - Any doublings need not be considered, since 2*bn+1 is odd, and - * 2*step is even, so none of these numbers are divisible by 2. - */ - if (step & 1) { - s = bnLSWord(bn) & 1; - memset(array, 0xAA >> s, size); - } else { - /* Initialize the array to all 1's */ - memset(array, 255, size); - assert(bnLSWord(bn) & 1); - } - - /* - * This could be cached between calls to sieveBuild, but - * it's really not worth it; sieveSmall is *very* fast. - * sieveSmall returns a sieve of odd primes. - */ - sieveSmall(small, SMALL); - - /* - * Okay, now sieve via the primes up to ssize*16+SMALLSTART-1, - * obtained from the small table. - */ - i = (small[0] & 1) ? 0 : sieveSearch(small, SMALL, 0); - do { - p = 2 * i + SMALLSTART; - - /* - * Modulo is usually very expensive, but step is usually - * small, so this conditional is worth it. - */ - t = (step < p) ? step : step % p; - if (!t) { - /* - * Instead of assert failing, returning all zero - * bits is the "correct" thing to do, but I think - * that the caller should take care of that - * themselves before starting. - */ - assert(bnModQ(bn, p) != 0); - continue; - } - /* - * Get inverse of step mod p. 0 < t < p, and p is prime, - * so it has an inverse and sieveModInvert can't return 0. - */ - t = sieveModInvert(t, p); - assert(t); - /* Negate t, so now t == -1/step (mod p) */ - t = p - t; - - /* Now get the bignum modulo the prime. */ - s = bnModQ(bn, p); - - /* Multiply by t, the negative inverse of step size */ -#if UINT_MAX/0xffff < 0xffff - s = (unsigned)(((unsigned long)s * t) % p); -#else - s = (s * t) % p; -#endif - - /* s is now the starting bit position, so sieve */ - sieveSingle(array, size, s, p); - - /* Now do the double sieves as desired. */ - for (j = 0; j < dbl; j++) { - /* Halve t modulo p */ -#if UINT_MAX < 0x1ffff - t = (t & 1) ? p/2 + t/2 + 1 : t/2; - /* Add t to s, modulo p with overflow checks. */ - s += t; - if (s >= p || s < t) - s -= p; -#else - if (t & 1) - t += p; - t /= 2; - /* Add t to s, modulo p */ - s += t; - if (s >= p) - s -= p; -#endif - sieveSingle(array, size, s, p); - } - - /* And find the next prime */ - } while ((i = sieveSearch(small, SMALL, i)) != 0); - -#ifdef MSDOS - lbnMemFree(small, SMALL); -#endif - return 0; /* Success */ -} - -/* - * Similar to the above, but use "step" (which must be even) as a step - * size rather than a fixed value of 2. If "step" has any small divisors - * other than 2, this will blow up. - * - * Returns -1 on out of memory (MSDOS only, actually), and -2 - * if step is found to be non-prime. - */ -int -sieveBuildBig(unsigned char *array, unsigned size, struct BigNum const *bn, - struct BigNum const *step, unsigned dbl) -{ - unsigned i, j; /* Loop index */ - unsigned p; /* Current small prime */ - unsigned s; /* Where to start operations in the big sieve */ - unsigned t; /* step modulo p, the current prime */ -#ifdef MSDOS /* Use dynamic allocation rather than on the stack */ - unsigned char *small; -#else - unsigned char small[SMALL]; -#endif - - assert(array); - -#ifdef MSDOS - small = lbnMemAlloc(SMALL); /* Which allocator? Not secure. */ - if (!small) - return -1; /* Failed */ -#endif - /* - * An odd step is a special case, since we must sieve by 2, - * which isn't in the small prime array and has a few other - * special properties. These are: - * - Since the numbers are stored in binary, we don't need to - * use bnModQ to find the remainder. - * - If step is odd, then t = step % 2 is 1, which allows - * the elimination of a lot of math. Inverting and negating - * t don't change it, and multiplying s by 1 is a no-op, - * so t isn't actually mentioned. - * - Since this is the first sieving, instead of calling - * sieveSingle, we can just use memset to fill the array - * with 0x55 or 0xAA. Since a 1 bit means possible prime - * (i.e. NOT divisible by 2), and the least significant bit - * is first, if bn % 2 == 0, we use 0xAA (bit 0 = bn is NOT - * prime), while if bn % 2 == 1, use 0x55. - * (If step is even, bn must be odd, so fill the array with 0xFF.) - * - Any doublings need not be considered, since 2*bn+1 is odd, and - * 2*step is even, so none of these numbers are divisible by 2. - */ - if (bnLSWord(step) & 1) { - s = bnLSWord(bn) & 1; - memset(array, 0xAA >> s, size); - } else { - /* Initialize the array to all 1's */ - memset(array, 255, size); - assert(bnLSWord(bn) & 1); - } - - /* - * This could be cached between calls to sieveBuild, but - * it's really not worth it; sieveSmall is *very* fast. - * sieveSmall returns a sieve of the odd primes. - */ - sieveSmall(small, SMALL); - - /* - * Okay, now sieve via the primes up to ssize*16+SMALLSTART-1, - * obtained from the small table. - */ - i = (small[0] & 1) ? 0 : sieveSearch(small, SMALL, 0); - do { - p = 2 * i + SMALLSTART; - - t = bnModQ(step, p); - if (!t) { - assert(bnModQ(bn, p) != 0); - continue; - } - /* Get negative inverse of step */ - t = sieveModInvert(bnModQ(step, p), p); - assert(t); - t = p-t; - - /* Okay, we have a prime - get the remainder */ - s = bnModQ(bn, p); - - /* Now multiply s by the negative inverse of step (mod p) */ -#if UINT_MAX/0xffff < 0xffff - s = (unsigned)(((unsigned long)s * t) % p); -#else - s = (s * t) % p; -#endif - /* We now have the starting bit pos */ - sieveSingle(array, size, s, p); - - /* Now do the double sieves as desired. */ - for (j = 0; j < dbl; j++) { - /* Halve t modulo p */ -#if UINT_MAX < 0x1ffff - t = (t & 1) ? p/2 + t/2 + 1 : t/2; - /* Add t to s, modulo p with overflow checks. */ - s += t; - if (s >= p || s < t) - s -= p; -#else - if (t & 1) - t += p; - t /= 2; - /* Add t to s, modulo p */ - s += t; - if (s >= p) - s -= p; -#endif - sieveSingle(array, size, s, p); - } - - /* And find the next prime */ - } while ((i = sieveSearch(small, SMALL, i)) != 0); - -#ifdef MSDOS - lbnMemFree(small, SMALL); -#endif - return 0; /* Success */ -} diff --git a/libs/libzrtp/third_party/bnlib/sieve.h b/libs/libzrtp/third_party/bnlib/sieve.h deleted file mode 100644 index 1262083e10..0000000000 --- a/libs/libzrtp/third_party/bnlib/sieve.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * sieve.h - Trial division for prime finding. - * - * This is generally not intended for direct use by a user of the library; - * the prime.c and dhprime.c functions. are more likely to be used. - * However, a special application may need these. - */ -struct BigNum; - -/* Remove multiples of a single number from the sieve */ -void -sieveSingle(unsigned char *array, unsigned size, unsigned start, unsigned step); - -/* Build a sieve starting at the number and incrementing by "step". */ -int sieveBuild(unsigned char *array, unsigned size, struct BigNum const *bn, - unsigned step, unsigned dbl); - -/* Similar, but uses a >16-bit step size */ -int sieveBuildBig(unsigned char *array, unsigned size, struct BigNum const *bn, - struct BigNum const *step, unsigned dbl); - -/* Return the next bit set in the sieve (or 0 on failure) */ -unsigned sieveSearch(unsigned char const *array, unsigned size, unsigned start); diff --git a/libs/libzrtp/third_party/bnlib/sizetest.c b/libs/libzrtp/third_party/bnlib/sizetest.c deleted file mode 100644 index c3614e4a88..0000000000 --- a/libs/libzrtp/third_party/bnlib/sizetest.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#include "bnsize00.h" - -#if BNSIZE16 -#error Using 16-bit math library -#elif BNSIZE32 -#error Using 32-bit math library -#elif BNSIZE64 -#error Using 64-bit math library -#else -#error No math library size defined -#endif diff --git a/libs/libzrtp/third_party/bnlib/test/README.dhtest b/libs/libzrtp/third_party/bnlib/test/README.dhtest deleted file mode 100644 index afd6a01b23..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/README.dhtest +++ /dev/null @@ -1,21 +0,0 @@ -Test driver for Diffie-Hellman key agreement operations. - -This program generates Diffie-Hellman moduli and does a sample -key agreement with them. - -The command line is a seed string which is used to generate the -public modulus. The use of a seed lets you verify that the -modulus was not generated in a weak manner. - -Currently, the list of key sizes to generate is compiled in. - -After key generation, the program performs a sample key agreement. - -The primes used in SKIP were generated with the seed in the file -Gandhi, which contains 79 bytes plus a newline: -Whatever you do will be insignificant, but it is very important that you do it. - -Example invocation lines: - -dhtest arbitrary seed string -dhtest `cat Gandhi` diff --git a/libs/libzrtp/third_party/bnlib/test/README.dsatest b/libs/libzrtp/third_party/bnlib/test/README.dsatest deleted file mode 100644 index 9d8495c6bc..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/README.dsatest +++ /dev/null @@ -1,18 +0,0 @@ -Test driver for Digital Signature Algorithm operations. - -This program generates DSA keys (currently, of a few compiled-in -sizes) and does timing tests on DSA operations. - -The command line is a seed string which is used to generate the -public parameters. The use of a seed lets you verify that the -key was not generated in a weak manner. - -Currently, the list of key sizes to generate is compiled in. - -After key generation, the program DSA-signs and verifies a -random message, and displays the timing. - -Example invocation lines: - -dsatest arbitrary seed string -dsatest foo diff --git a/libs/libzrtp/third_party/bnlib/test/README.rsatest b/libs/libzrtp/third_party/bnlib/test/README.rsatest deleted file mode 100644 index d684f7d5e8..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/README.rsatest +++ /dev/null @@ -1,12 +0,0 @@ -Rsatest is a test driver for RSA operations. - -Rsatest takes a list of vecimal key sizes (in bits) on the command -line, and generates keys of those sizes. It generates keys randomly, -using keyboard timings for a random number source, then tests the -resultant keys, doing an encryption, a decryption, a signing and a -verification. - -Example invocation lines: - -rsatest 512 768 1024 -rsatest 2048 diff --git a/libs/libzrtp/third_party/bnlib/test/dhtest.c b/libs/libzrtp/third_party/bnlib/test/dhtest.c deleted file mode 100644 index 07bda58c33..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/dhtest.c +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * dhtest.c - Diffie-Hellman prime generator. - * - * This generates Diffie-Hellman primes using a (hopefully) clearly - * defined algorithm, based on David Kravitz's "kosherizer". - * This takes a seed in the form of a byte string, usually ASCII. - * The byte string is hashed with SHA. This forms the low 160 bits - * of the search start number. If the desired start number is longer - * than this, the byte string is treated as a big-endian number and - * incremented, which increments the last byte, propagating carry. - * (Modulo the size of the seed itself, which is not an issue in - * practice for any seed at least one byte long.) - * This incremented value is hashed to produce the next most significant - * 160 bits, and so on. - * After enough bits have been accumulated, the low bit is set, the extra - * high bits are masked off to zero, and the two high bits of the - * search start number are set. This is used as a starting seed for a - * sequential (increasing) search for a suitable prime. - * - * A suitable prime P is itself prime, and (P-1)/2 is also prime. - */ -#include <stdio.h> -#include <string.h> - -#include "bn.h" -#include "germain.h" -#include "sieve.h" - -#include "cputime.h" -#include "sha.h" - -#define BNDEBUG 1 - -#if BNDEBUG -#include "bnprint.h" -#define bndPut(prompt, bn) bnPrint(stdout, prompt, bn, "\n") -#define bndPrintf printf -#else -#define bndPut(prompt, bn) ((void)(prompt),(void)(bn)) -#define bndPrintf (void) -#endif - -/* - * Generate a bignum of a specified length, with the given - * high and low 8 bits. "High" is merged into the high 8 bits of the - * number. For example, set it to 0x80 to ensure that the number is - * exactly "bits" bits long (i.e. 2^(bits-1) <= bn < 2^bits). - * "Low" is merged into the low 8 bits. For example, set it to - * 1 to ensure that you generate an odd number. - * - * The bignum is generated using the given seed string. The - * technique is from David Kravitz (of the NSA)'s "kosherizer". - * The string is hashed, and that (with the low bit forced to 1) - * is used for the low 160 bits of the number. Then the string, - * considered as a big-endian array of bytes, is incremented - * and the incremented value is hashed to produce the next most - * significant 160 bits, and so on. The increment is performed - * modulo the size of the seed string. - * - * The most significant *two* bits are forced to 1, the first to - * ensure that the number is long enough, and the second just to - * place the prime in the high half of the range to make breaking - * it slightly more difficult, since it makes essentially no - * difference to the use of the number. - */ -static int -genRandBn(struct BigNum *bn, unsigned bits, unsigned char high, -unsigned char low, unsigned char *seed, unsigned len) -{ - unsigned char buf[SHA_DIGESTSIZE]; - unsigned bytes; - unsigned l = 0; /* Current position */ - unsigned i; - struct SHAContext sha; - - bnSetQ(bn, 0); - - bytes = (bits+7) / 8; /* Number of bytes to use */ - shaInit(&sha); - shaUpdate(&sha, seed, len); - shaFinal(&sha, buf); - buf[SHA_DIGESTSIZE-1] |= low; - - while (bytes > SHA_DIGESTSIZE) { - bytes -= SHA_DIGESTSIZE; - /* Merge in low half of high bits, if necessary */ - if (bytes == 1 && (bits & 7)) - buf[0] |= high << (bits & 7); - if (bnInsertBigBytes(bn, buf, l, SHA_DIGESTSIZE) < 0) - return -1; - l += SHA_DIGESTSIZE; - - /* Increment the seed, ignoring carry out. */ - i = len; - while (i--) { - if (++seed[i] & 255) - break; /* Didn't wrap; done */ - } - shaInit(&sha); - shaUpdate(&sha, seed, len); - shaFinal(&sha, buf); - } - - /* Do the final "bytes"-long section, using the tail bytes in buf */ - /* Mask off excess high bits */ - buf[SHA_DIGESTSIZE-bytes] &= 255 >> (-bits & 7); - /* Merge in specified high bits */ - buf[SHA_DIGESTSIZE-bytes] |= high >> (-bits & 7); - if (bytes > 1 && (bits & 7)) - buf[SHA_DIGESTSIZE-bytes+1] |= high << (bits & 7); - /* Merge in the appropriate bytes of the buffer */ - if (bnInsertBigBytes(bn, buf+SHA_DIGESTSIZE-bytes, l, bytes) < 0) - return -1; - return 0; -} - -struct Progress { - FILE *f; - unsigned column; - unsigned wrap; -}; - -static int -genProgress(void *arg, int c) -{ - struct Progress *p = arg; - if (++p->column > p->wrap) { - putc('\n', p->f); - p->column = 1; - } - putc(c, p->f); - fflush(p->f); - return 0; -} - -static int -genDH(struct BigNum *bn, unsigned bits, unsigned char *seed, unsigned len, - FILE *f) -{ -#if CLOCK_AVAIL - timetype start, stop; - unsigned long s; -#endif - int i; - unsigned char s1[1024], s2[1024]; - unsigned p1, p2; - struct BigNum step; - struct Progress progress; - - if (f) - fprintf(f, "Generating a %u-bit D-H prime with \"%.*s\"\n", - bits, (int)len, (char *)seed); - progress.f = f; - progress.column = 0; - progress.wrap = 78; - - /* Find p - choose a starting place */ - if (genRandBn(bn, bits, 0xC0, 3, seed, len) < 0) - return -1; -#if BNDEBUG /* DEBUG - check that sieve works properly */ - bnBegin(&step); - bnSetQ(&step, 2); - sieveBuild(s1, 1024, bn, 2, 0); - sieveBuildBig(s2, 1024, bn, &step, 0); - p1 = p2 = 0; - if (s1[0] != s2[0]) - printf("Difference: s1[0] = %x s2[0] = %x\n", s1[0], s2[0]); - do { - p1 = sieveSearch(s1, 1024, p1); - p2 = sieveSearch(s2, 1024, p2); - - if (p1 != p2) - printf("Difference: p1 = %u p2 = %u\n", p1, p2); - } while (p1 && p2); - - bnEnd(&step); -#endif - /* And search for a prime */ -#if CLOCK_AVAIL - gettime(&start); -#endif - i = germainPrimeGen(bn, 1, f ? genProgress : 0, (void *)&progress); - if (i < 0) - return -1; -#if CLOCK_AVAIL - gettime(&stop); -#endif - if (f) { - putc('\n', f); - fprintf(f, "%d modular exponentiations performed.\n", i); - } -#if CLOCK_AVAIL - subtime(stop, start); - s = sec(stop); - bndPrintf("%u-bit time = %lu.%03u sec.", bits, s, msec(stop)); - if (s > 60) { - putchar(' '); - putchar('('); - if (s > 3600) - printf("%u:%02u", (unsigned)(s/3600), - (unsigned)(s/60%60)); - else - printf("%u", (unsigned)(s/60)); - printf(":%02u)", (unsigned)(s%60)); - } - putchar('\n'); -#endif - - bndPut("p = ", bn); - - return 0; -} - -static int -testDH(struct BigNum *bn) -{ - struct BigNum pub1, pub2, sec1, sec2; - unsigned bits; - int i = 0; - char buf[4]; - - bnBegin(&pub1); - bnBegin(&pub2); - bnBegin(&sec1); - bnBegin(&sec2); - - /* Bits of secret - add a few to ensure an even distribution */ - bits = bnBits(bn)+4; - /* Temporarily decrement bn for some operations */ - (void)bnSubQ(bn, 1); - - strcpy(buf, "foo"); - i = genRandBn(&sec1, bits, 0, 0, (unsigned char *)buf, 4); - if (i < 0) - goto done; - /* Reduce sec1 to the correct range */ - i = bnMod(&sec1, &sec1, bn); - if (i < 0) - goto done; - - strcpy(buf, "bar"); - i = genRandBn(&sec2, bits, 0, 0, (unsigned char *)buf, 4); - if (i < 0) - goto done; - /* Reduce sec2 to the correct range */ - i = bnMod(&sec2, &sec2, bn); - if (i < 0) - goto done; - - /* Re-increment bn */ - (void)bnAddQ(bn, 1); - - puts("Doing first half for party 1"); - i = bnTwoExpMod(&pub1, &sec1, bn); - if (i < 0) - goto done; - puts("Doing first half for party 2"); - i = bnTwoExpMod(&pub2, &sec2, bn); - if (i < 0) - goto done; - - /* In a real protocol, pub1 and pub2 are now exchanged */ - - puts("Doing second half for party 1"); - i = bnExpMod(&pub2, &pub2, &sec1, bn); - if (i < 0) - goto done; - bndPut("shared = ", &pub2); - puts("Doing second half for party 2"); - i = bnExpMod(&pub1, &pub1, &sec2, bn); - if (i < 0) - goto done; - bndPut("shared = ", &pub1); - - if (bnCmp(&pub1, &pub2) != 0) { - puts("Diffie-Hellman failed!"); - i = -1; - } else { - puts("Test successful."); - } -done: - bnEnd(&sec2); - bnEnd(&sec1); - bnEnd(&pub2); - bnEnd(&pub1); - - return i; -} - -/* Copy the command line to the buffer. */ -static unsigned -copy(unsigned char *buf, int argc, char **argv) -{ - unsigned pos, len; - - pos = 0; - while (--argc) { - len = strlen(*++argv); - memcpy(buf, *argv, len); - buf += len; - pos += len; - if (argc > 1) { - *buf++ = ' '; - pos++; - } - } - return pos; -} - -int -main(int argc, char **argv) -{ - unsigned len; - struct BigNum bn; - unsigned char buf[1024]; - - if (argc < 2) { - fprintf(stderr, "Usage: %s <seed>\n", argv[0]); - fputs("\ -<seed> should be a a string of bytes to be hashed to seed the prime\n\ -generator. Note that unquoted whitespace between words will be counted\n\ -as a single space. To include multiple spaces, quote them.\n", stderr); - return 1; - } - - bnInit(); - bnBegin(&bn); - - len = copy(buf, argc, argv); - genDH(&bn, 0x100, buf, len, stdout); - testDH(&bn); - - len = copy(buf, argc, argv); - genDH(&bn, 0x200, buf, len, stdout); - testDH(&bn); - - len = copy(buf, argc, argv); - genDH(&bn, 0x300, buf, len, stdout); - testDH(&bn); - - len = copy(buf, argc, argv); - genDH(&bn, 0x400, buf, len, stdout); - testDH(&bn); - - len = copy(buf, argc, argv); - genDH(&bn, 0x500, buf, len, stdout); - testDH(&bn); - -#if 0 - /* These get *really* slow */ - len = copy(buf, argc, argv); - genDH(&bn, 0x600, buf, len, stdout); - testDH(&bn); - - len = copy(buf, argc, argv); - genDH(&bn, 0x800, buf, len, stdout); - testDH(&bn); - - len = copy(buf, argc, argv); - genDH(&bn, 0xc00, buf, len, stdout); - testDH(&bn); - - /* Like, plan on a *week* or more for this one. */ - len = copy(buf, argc, argv); - genDH(&bn, 0x1000, buf, len, stdout); - testDH(&bn); -#endif - - bnEnd(&bn); - - return 0; -} diff --git a/libs/libzrtp/third_party/bnlib/test/dsatest.c b/libs/libzrtp/third_party/bnlib/test/dsatest.c deleted file mode 100644 index bf131b3964..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/dsatest.c +++ /dev/null @@ -1,672 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * dsatest.c - DSA key generator and test driver. - * - * This generates DSA primes using a (hopefully) clearly - * defined algorithm, based on David Kravitz's "kosherizer". - * It is not, however, identical. - */ -#include <stdio.h> -#include <string.h> - -#include "bn.h" -#include "prime.h" - -#include "cputime.h" -#include "sha.h" - -#define BNDEBUG 1 - -#if BNDEBUG -#include "bnprint.h" -#define bndPut(prompt, bn) bnPrint(stdout, prompt, bn, "\n") -#define bndPrintf printf -#else -#define bndPut(prompt, bn) ((void)(prompt),(void)(bn)) -#define bndPrintf (void) -#endif - -/* - * Generate a bignum of a specified length, with the given - * high and low 8 bits. "High" is merged into the high 8 bits of the - * number. For example, set it to 0x80 to ensure that the number is - * exactly "bits" bits long (i.e. 2^(bits-1) <= bn < 2^bits). - * "Low" is merged into the low 8 bits. For example, set it to - * 1 to ensure that you generate an odd number. - * - * Then XOR the result into the input bignum. This is to - * accomodate the kosherizer in all its generality. - * - * The bignum is generated using the given seed string. The - * technique is from David Kravitz (of the NSA)'s "kosherizer". - * The string is hashed, and that (with the low bit forced to 1) - * is used for the low 160 bits of the number. Then the string, - * considered as a big-endian array of bytes, is incremented - * and the incremented value is hashed to produce the next most - * significant 160 bits, and so on. The increment is performed - * modulo the size of the seed string. - * - * The seed is returned incremented so that it may be used to generate - * subsequent numbers. - * - * The most and least significant 8 bits of the returned number are forced - * to the values passed in "high" and "low", respectively. Typically, - * high would be set to 0x80 to force the most significant bit to 1. - */ -static int -genRandBn(struct BigNum *bn, unsigned bits, unsigned char high, -unsigned char low, unsigned char *seed, unsigned len) -{ - unsigned char buf1[SHA_DIGESTSIZE]; - unsigned char buf2[SHA_DIGESTSIZE]; - unsigned bytes = (bits+7)/8; - unsigned l = 0; /* Current position */ - unsigned i; - struct SHAContext sha; - - if (!bits) - return 0; - - /* Generate the first bunch of hashed data */ - shaInit(&sha); - shaUpdate(&sha, seed, len); - shaFinal(&sha, buf1); - /* Increment the seed, ignoring carry out. */ - i = len; - while (i-- && (++seed[i] & 255) == 0) - ; - /* XOR in the existing bytes */ - bnExtractBigBytes(bn, buf2, l, SHA_DIGESTSIZE); - for (i = 0; i < SHA_DIGESTSIZE; i++) - buf1[i] ^= buf2[i]; - buf1[SHA_DIGESTSIZE-1] |= low; - - while (bytes > SHA_DIGESTSIZE) { - bytes -= SHA_DIGESTSIZE; - /* Merge in low half of high bits, if necessary */ - if (bytes == 1 && (bits & 7)) - buf1[0] |= high << (bits & 7); - if (bnInsertBigBytes(bn, buf1, l, SHA_DIGESTSIZE) < 0) - return -1; - l += SHA_DIGESTSIZE; - - /* Compute the next hash we need */ - shaInit(&sha); - shaUpdate(&sha, seed, len); - shaFinal(&sha, buf1); - /* Increment the seed, ignoring carry out. */ - i = len; - while (i-- && (++seed[i] & 255) == 0) - ; - /* XOR in the existing bytes */ - bnExtractBigBytes(bn, buf2, l, SHA_DIGESTSIZE); - for (i = 0; i < SHA_DIGESTSIZE; i++) - buf1[i] ^= buf2[i]; - } - - /* Do the final "bytes"-long section, using the tail bytes in buf1 */ - /* Mask off excess high bits */ - buf1[SHA_DIGESTSIZE-bytes] &= 255 >> (-bits & 7); - /* Merge in specified high bits */ - buf1[SHA_DIGESTSIZE-bytes] |= high >> (-bits & 7); - if (bytes > 1 && (bits & 7)) - buf1[SHA_DIGESTSIZE-bytes+1] |= high << (bits & 7); - /* Merge in the appropriate bytes of the buffer */ - if (bnInsertBigBytes(bn, buf1+SHA_DIGESTSIZE-bytes, l, bytes) < 0) - return -1; - - return 0; -} - -struct Progress { - FILE *f; - unsigned column; - unsigned wrap; -}; - -static int -genProgress(void *arg, int c) -{ - struct Progress *p = arg; - if (++p->column > p->wrap) { - putc('\n', p->f); - p->column = 1; - } - putc(c, p->f); - fflush(p->f); - return 0; -} - -static int -dsaGen(struct BigNum *p, unsigned pbits, struct BigNum *q, unsigned qbits, - struct BigNum *g, struct BigNum *x, struct BigNum *y, - unsigned char *seed, unsigned len, FILE *f) -{ - struct BigNum h, e; - int i; -#if CLOCK_AVAIL - timetype start, stop; - unsigned long s; -#endif - struct Progress progress; - - if (f) - fprintf(f, - "Generating a DSA key pair with %u-bit p and %u-bit q,\n" - "seed = \"%.*s\"\n", pbits, qbits, (int)len, (char *)seed); - progress.f = f; - progress.column = 0; - progress.wrap = 78; - -#if CLOCK_AVAIL - gettime(&start); -#endif - - /* - * Choose a random starting place for q - * Starting place is SHA(seed) XOR SHA(seed+1), - * With the high *8* bits set to 1. - */ - (void)bnSetQ(q, 0); - if (genRandBn(q, qbits, 0xFF, 0, seed, len) < 0) - return -1; - bndPut("q1 = ", q); - if (genRandBn(q, qbits, 0xFF, 1, seed, len) < 0) - return -1; - bndPut("q2 = ", q); - /* And search for a prime */ - i = primeGen(q, (unsigned (*)(unsigned))0, f ? genProgress : 0, - (void *)&progress, 0); - bndPut("q = ", q); - if (i < 0) - return -1; - - /* ...and for p */ - (void)bnSetQ(p, 0); - if (genRandBn(p, pbits, 0xC0, 1, seed, len) < 0) - return -1; - bndPut("p1 = ", p); - - /* Temporarily double q */ - if (bnLShift(q, 1) < 0) - return -1; - - bnBegin(&h); - bnBegin(&e); - - /* Set p = p - (p mod q) + 1, i.e. congruent to 1 mod 2*q */ - if (bnMod(&e, p, q) < 0) - goto failed; - if (bnSub(p, &e) < 0 || bnAddQ(p, 1) < 0) - goto failed; - bndPut("p2 = ", p); - - if (f) - genProgress(&progress, ' '); - - /* And search for a prime */ - i = primeGenStrong(p, q, f ? genProgress : 0, (void *)&progress); - if (i < 0) - return -1; - bndPut("p = ", p); - - /* Reduce q again */ - bnRShift(q, 1); - - /* Now hunt for a suitable g - first, find (p-1)/q */ - if (bnDivMod(&e, &h, p, q) < 0) - goto failed; - /* e is now the exponent (p-1)/q, and h is the remainder (one!) */ - if (bnBits(&h) != 1) { - bndPut("Huh? p % q = ", &h); - goto failed; - } - - if (f) - genProgress(&progress, ' '); - - /* Search for a suitable h */ - if (bnSetQ(&h, 2) < 0 || bnTwoExpMod(g, &e, p) < 0) - goto failed; - i++; - while (bnBits(g) < 2) { - if (f) - genProgress(&progress, '.'); - if (bnAddQ(&h, 1) < 0 || bnExpMod(g, &h, &e, p) < 0) - goto failed; - i++; - } - if (f) - genProgress(&progress, '*'); -#if CLOCK_AVAIL - gettime(&stop); -#endif - - /* - * Now pick the secret, x. Choose it a bit larger than q and do - * modular reduction to make it uniformly distributed. - */ - bnSetQ(x, 0); - /* XXX SECURITY ALERT Replace with a real RNG! SECURITY ALERT XXX */ - if (genRandBn(x, qbits+8, 0, 0, seed, len) < 0) - goto failed; - if (bnMod(x, x, q) < 0 || bnExpMod(y, g, x, p) < 0) - goto failed; - i++; - if (f) - putc('\n', f); - - printf("%d modular exponentiations performed.\n", i); - -#if CLOCK_AVAIL - subtime(stop, start); - s = sec(stop); - bndPrintf("%u/%u-bit time = %lu.%03u sec.", pbits, qbits, - s, msec(stop)); - if (s > 60) { - putchar(' '); - putchar('('); - if (s > 3600) - printf("%u:%02u", (unsigned)(s/3600), - (unsigned)(s/60%60)); - else - printf("%u", (unsigned)(s/60)); - printf(":%02u)", (unsigned)(s%60)); - } - putchar('\n'); -#endif - - bndPut("q = ", q); - bndPut("p = ", p); - bndPut("h = ", &h); - bndPut("g = ", g); - bndPut("x = ", x); - bndPut("y = ", y); - - bnEnd(&h); - bnEnd(&e); - - return 0; - -failed: - bnEnd(&h); - bnEnd(&e); - return -1; -} - -static int -dsaSign(struct BigNum const *p, struct BigNum const *q, struct BigNum const *g, - struct BigNum const *x, struct BigNum const *y, - struct BigNum const *hash, struct BigNum const *k, - struct BigNum *r, struct BigNum *s) -{ - int retval = -1; - struct BigNum t; - - (void)y; - - bnBegin(&t); - /* Make the signature... first the precomputation */ - - /* Compute r = (g^k mod p) mod q */ - if (bnExpMod(r, g, k, p) < 0 || bnMod(r, r, q) < 0) - goto failed; - - /* Compute s = k^-1 * (hash + x*r) mod q */ - if (bnInv(&t, k, q) < 0) - goto failed; - if (bnMul(s, x, r) < 0 || bnMod(s, s, q) < 0) - goto failed; - - /* End of precomputation. Steps after this require the hash. */ - - if (bnAdd(s, hash) < 0) - goto failed; - if (bnCmp(s, q) > 0 && bnSub(s, q) < 0) - goto failed; - if (bnMul(s, s, &t) < 0 || bnMod(s, s, q) < 0) - goto failed; - /* Okay, r and s are the signature! */ - - retval = 0; - -failed: - bnEnd(&t); - return retval; -} - -/* Faster version, using precomputed tables */ -static int -dsaSignFast(struct BigNum const *p, struct BigNum const *q, - struct BnBasePrecomp const *pre, - struct BigNum const *x, struct BigNum const *y, - struct BigNum const *hash, struct BigNum const *k, - struct BigNum *r, struct BigNum *s) -{ - int retval = -1; - struct BigNum t; - - (void)y; - - bnBegin(&t); - /* Make the signature... first the precomputation */ - - /* Compute r = (g^k mod p) mod q */ - if (bnBasePrecompExpMod(r, pre, k, p) < 0 || bnMod(r, r, q) < 0) - goto failed; - - /* Compute s = k^-1 * (hash + x*r) mod q */ - if (bnInv(&t, k, q) < 0) - goto failed; - if (bnMul(s, x, r) < 0 || bnMod(s, s, q) < 0) - goto failed; - - /* End of precomputation. Steps after this require the hash. */ - - if (bnAdd(s, hash) < 0) - goto failed; - if (bnCmp(s, q) > 0 && bnSub(s, q) < 0) - goto failed; - if (bnMul(s, s, &t) < 0 || bnMod(s, s, q) < 0) - goto failed; - /* Okay, r and s are the signature! */ - - retval = 0; - -failed: - bnEnd(&t); - return retval; -} - -/* - * Returns 1 for a good signature, 0 for bad, and -1 on error. - */ -static int -dsaVerify(struct BigNum const *p, struct BigNum const *q, - struct BigNum const *g, struct BigNum const *y, - struct BigNum const *r, struct BigNum const *s, - struct BigNum const *hash) -{ - struct BigNum w, u1, u2; - int retval = -1; - - bnBegin(&w); - bnBegin(&u1); - bnBegin(&u2); - - if (bnInv(&w, s, q) < 0) - goto failed; - - if (bnMul(&u1, hash, &w) < 0 || bnMod(&u1, &u1, q) < 0) - goto failed; - if (bnMul(&u2, r, &w) < 0 || bnMod(&u2, &u2, q) < 0) - goto failed; - - /* Now for the expensive part... */ - - if (bnDoubleExpMod(&w, g, &u1, y, &u2, p) < 0) - goto failed; - if (bnMod(&w, &w, q) < 0) - goto failed; - retval = (bnCmp(r, &w) == 0); -failed: - bnEnd(&u2); - bnEnd(&u1); - bnEnd(&w); - return retval; -} - -#define divide_by_n(sec, msec, n) \ - ( msec += 1000 * (sec % n), \ - sec /= n, msec /= n, \ - sec += msec / 1000, \ - msec %= 1000 ) - -static int -dsaTest(struct BigNum const *p, struct BigNum const *q, struct BigNum const *g, - struct BigNum const *x, struct BigNum const *y) -{ - struct BigNum hash, r, s, k; - struct BigNum r1, s1; - struct BnBasePrecomp pre; - unsigned bits; - unsigned i; - int verified; - int retval = -1; - unsigned char foo[4], bar[4]; -#if CLOCK_AVAIL - timetype start, stop; - unsigned long cursec, sigsec = 0, sig1sec = 0, versec = 0; - unsigned curms, sigms = 0, sig1ms = 0, verms = 0; - unsigned j, n, m = 0; -#endif - - bnBegin(&hash); - bnBegin(&r); bnBegin(&r1); - bnBegin(&s); bnBegin(&s1); - bnBegin(&k); - - bits = bnBits(q); - strcpy((char *)foo, "foo"); - strcpy((char *)bar, "bar"); - - /* Precompute powers of g */ - if (bnBasePrecompBegin(&pre, g, p, bits) < 0) - goto failed; - - bndPrintf(" N\tSigning \tSigning1\tVerifying\tStatus\n"); - for (i = 0; i < 25; i++) { - /* Pick a random hash, the right length. */ - (void)bnSetQ(&k, 0); - if (genRandBn(&hash, bits, 0, 0, foo, 4) < 0) - goto failed; - - /* Make the signature... */ - - /* - * XXX SECURITY ALERT XXX - * XXX Replace with a real RNG! XXX - * XXX SECURITY ALERT XXX - */ - (void)bnSetQ(&k, 0); - if (genRandBn(&k, bnBits(q)+8, 0, 0, bar, 4) < 0) - goto failed; - /* Reduce k to the correct range */ - if (bnMod(&k, &k, q) < 0) - goto failed; -#if CLOCK_AVAIL - /* Decide on a number of iterations to perform... */ - m += n = i+1; /* This goes from 1 to 325 */ - bndPrintf("%3d", n); - gettime(&start); - for (j = 0; j < n; j++) -#endif - if (dsaSign(p, q, g, x, y, &hash, &k, &r, &s) < 0) - goto failed; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - sigsec += cursec = sec(stop); - sigms += curms = msec(stop); - divide_by_n(cursec, curms, n); - bndPrintf("\t%lu.%03u\t\t", cursec, curms); -#else - bndPrintf("\t*\t\t"); -#endif - fflush(stdout); - -#if CLOCK_AVAIL - gettime(&start); - for (j = 0; j < n; j++) -#endif - if (dsaSignFast(p, q, &pre, x, y, &hash, &k, &r1, &s1) < 0) - goto failed; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - sig1sec += cursec = sec(stop); - sig1ms += curms = msec(stop); - divide_by_n(cursec, curms, n); - bndPrintf("%lu.%03u\t\t", cursec, curms); -#else - bndPrintf("*\t\t"); -#endif - fflush(stdout); - if (bnCmp(&r, &r1) != 0) { - printf("\a** Error r != r1"); - bndPut("g = ", g); - bndPut("k = ", &k); - bndPut("r = ", &r); - bndPut("r1= ", &r1); - } - if (bnCmp(&s, &s1) != 0) { - printf("\a** Error r != r1"); - bndPut("g = ", g); - bndPut("k = ", &k); - bndPut("s = ", &s); - bndPut("s1= ", &s1); - } - - /* Okay, r and s are the signature! Now, verify it. */ - -#if CLOCK_AVAIL - gettime(&start); - verified = 0; /* To silence warning */ - for (j = 0; j < n; j++) { -#endif - verified = dsaVerify(p, q, g, y, &r, &s, &hash); - if (verified <= 0) - break; - } -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - versec += cursec = sec(stop); - verms += curms = msec(stop); - divide_by_n(cursec, curms, j); - bndPrintf("%lu.%03u\t\t", cursec, curms); -#else - bndPrintf("*\t\t"); -#endif - if (verified > 0) { - printf("Test successful.\n"); - } else if (verified == 0) { - printf("\aSignature did NOT check!.\n"); - bndPut("hash = ", &hash); - bndPut("k = ", &k); - bndPut("r = ", &r); - bndPut("s = ", &s); - getchar(); - } else { - printf("\a** Error while verifying"); - bndPut("hash = ", &hash); - bndPut("k = ", &k); - bndPut("r = ", &r); - bndPut("s = ", &s); - getchar(); - goto failed; - } - } -#if CLOCK_AVAIL - divide_by_n(sigsec, sigms, m); - divide_by_n(sig1sec, sig1ms, m); - divide_by_n(versec, verms, m); - - bndPrintf("%3u\t%lu.%03u\t\t%lu.%03u\t\t%lu.%03u\t\tAVERAGE %u/%u\n", - m, sigsec, sigms, sig1sec, sig1ms, versec, verms, - bnBits(p), bnBits(q)); -#endif - /* Success */ - retval = 0; - -failed: - bnBasePrecompEnd(&pre); - bnEnd(&k); - bnEnd(&s1); bnEnd(&s); - bnEnd(&r1); bnEnd(&r); - bnEnd(&hash); - - return retval; -} - -/* Copy the command line to the buffer. */ -static unsigned -copy(unsigned char *buf, int argc, char **argv) -{ - unsigned pos, len; - - pos = 0; - while (--argc) { - len = strlen(*++argv); - memcpy(buf, *argv, len); - buf += len; - pos += len; - if (argc > 1) { - *buf++ = ' '; - pos++; - } - } - return pos; -} - -int -main(int argc, char **argv) -{ - unsigned len; - struct BigNum p, q, g, x, y; - unsigned char buf[1024]; - - if (argc < 2) { - fprintf(stderr, "Usage: %s <seed>\n", argv[0]); - fputs("\ -<seed> should be a a string of bytes to be hashed to seed the prime\n\ -generator. Note that unquoted whitespace between words will be counted\n\ -as a single space. To include multiple spaces, quote them.\n", stderr); - return 1; - } - - bnInit(); - bnBegin(&p); - bnBegin(&q); - bnBegin(&g); - bnBegin(&x); - bnBegin(&y); - - len = copy(buf, argc, argv); - dsaGen(&p, 512, &q, 160, &g, &x, &y, buf, len, stdout); - dsaTest(&p, &q, &g, &x, &y); - - len = copy(buf, argc, argv); - dsaGen(&p, 768, &q, 160, &g, &x, &y, buf, len, stdout); - dsaTest(&p, &q, &g, &x, &y); - - len = copy(buf, argc, argv); - dsaGen(&p, 1024, &q, 160, &g, &x, &y, buf, len, stdout); - dsaTest(&p, &q, &g, &x, &y); - - len = copy(buf, argc, argv); - dsaGen(&p, 1536, &q, 192, &g, &x, &y, buf, len, stdout); - dsaTest(&p, &q, &g, &x, &y); - - len = copy(buf, argc, argv); - dsaGen(&p, 2048, &q, 224, &g, &x, &y, buf, len, stdout); - dsaTest(&p, &q, &g, &x, &y); - - len = copy(buf, argc, argv); - dsaGen(&p, 3072, &q, 256, &g, &x, &y, buf, len, stdout); - dsaTest(&p, &q, &g, &x, &y); - - len = copy(buf, argc, argv); - dsaGen(&p, 4096, &q, 288, &g, &x, &y, buf, len, stdout); - dsaTest(&p, &q, &g, &x, &y); - - bnEnd(&y); - bnEnd(&x); - bnEnd(&g); - bnEnd(&q); - bnEnd(&p); - - return 0; -} diff --git a/libs/libzrtp/third_party/bnlib/test/first.h b/libs/libzrtp/third_party/bnlib/test/first.h deleted file mode 100644 index ea0a363aff..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/first.h +++ /dev/null @@ -1,4 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ diff --git a/libs/libzrtp/third_party/bnlib/test/kb.h b/libs/libzrtp/third_party/bnlib/test/kb.h deleted file mode 100644 index 67a2cd80f0..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/kb.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * kb.h - interface for keyboard I/O - */ - -/* The implementation is in kbunix.c, kbmsdos.c, kbvms.c, etc. */ - -void kbCbreak(void), kbNorm(void); -int kbGet(void); -void kbFlush(int thorough); diff --git a/libs/libzrtp/third_party/bnlib/test/kbmsdos.c b/libs/libzrtp/third_party/bnlib/test/kbmsdos.c deleted file mode 100644 index ab4d90ae92..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/kbmsdos.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1993 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * MS-DOS non-echoing keyboard routines. - */ - -#include <conio.h> /* For getch() and kbhit() */ -#include <signal.h> /* For raise() */ -#ifdef _MSC_VER -#include <time.h> /* For clock() */ -#else -#include <dos.h> /* For sleep() */ -#endif - -#include "kb.h" -#include "random.h" /* For randEvent() */ - -/* These are pretty boring */ -void kbCbreak(void) { } -void kbNorm(void) { } - -int kbGet(void) -{ - int c; - - c = getch(); - if (c == 0) - c = 0x100 + getch(); - - /* - * Borland C's getch() uses int 0x21 function 0x7, - * which does not detect break. So we do it explicitly. - */ - if (c == 3) - raise(SIGINT); - - randEvent(c); - - return c; -} - -#ifdef _MSC_VER -/* - * Microsoft Visual C 1.5 (at least) does not have sleep() in the - * library. So we use this crude approximation. ("crude" because, - * assuming CLOCKS_PER_SEC is 18.2, it rounds to 18 to avoid floating - * point math.) - */ -#ifndef CLOCKS_PER_SEC -#define CLOCKS_PER_SEC CLK_TCK -#endif -static unsigned -sleep(unsigned t) -{ - clock_t target; - - target = clock() + t * (unsigned)CLOCKS_PER_SEC; - while (clock() < target) - ; - return 0; -} -#endif - -void kbFlush(int thorough) -{ - do { - while(kbhit()) - (void)getch(); - if (!thorough) - break; - /* Extra thorough: wait for one second of quiet */ - sleep(1); - } while (kbhit()); -} diff --git a/libs/libzrtp/third_party/bnlib/test/kbunix.c b/libs/libzrtp/third_party/bnlib/test/kbunix.c deleted file mode 100644 index f2de6fc0ce..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/kbunix.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * kbunix.c - Unix keyboard input routines. - */ - -/* - * Define NOTERMIO if you don't have the termios stuff - */ - -#include "first.h" -#include <fcntl.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> /* For exit() */ -#include <sys/types.h> - -/* How to get cbreak mode */ - -#if defined(NOTERMIO) -#include <sgtty.h> /* No termio: Use ioctl() TIOCGETP and TIOCSETP */ -#elif defined(SVR2) -#include <termio.h> /* SVR2: Use ioctl() TCGETA and TCSETAF */ -#else /* Usual case */ -#include <termios.h> /* Posix: use tcgetattr/tcsetattr */ -#endif - -#ifdef sun /* including ioctl.h and termios.h gives a lot of warnings on sun */ -#include <sys/filio.h> -#else -#include <sys/ioctl.h> /* for FIONREAD */ -#endif /* sun */ - -#ifndef FIONREAD -#define FIONREAD TIOCINQ -#endif - -#include "posix.h" /* For read(), sleep() */ -#include "kb.h" -#if UNITTTEST -#define randEvent(c) (void)c -#else -#include "random.h" -#endif - -#include "kludge.h" - -/* The structure to hold the keyuboard's state */ -#if defined(NOTERMIO) -static struct sgttyb kbState0, kbState1; -#elif defined(SVR2) -static struct termio kbState0, kbState1; -#else -static struct termios kbState0, kbState1; -#endif - -#ifndef CBREAK -#define CBREAK RAW -#endif -/* The basic task of getting the terminal into CBREAK mode. */ -static void -kbInternalCbreak(int fd) -{ -#ifdef NOTERMIO - - if (ioctl(fd, TIOCGETP, &kbState0) < 0) { - fprintf (stderr, "\nUnable to get terminal characteristics: "); - perror("ioctl"); - exit(1); - } - kbState1 = kbState0; - kbState1.sg_flags |= CBREAK; - kbState1.sg_flags &= ~ECHO; - ioctl(fd, TIOCSETP, &kbState1); - -#else /* !NOTERMIO - the usual case */ - -#ifdef SVR2 - if (ioctl(fd, TCGETA, &kbState0) < 0) -#else - if (tcgetattr(fd, &kbState0) < 0) -#endif - { - fprintf (stderr, "\nUnable to get terminal characteristics: "); - perror("ioctl"); - exit(1); - } - kbState1 = kbState0; - kbState1.c_cc[VMIN] = 1; - kbState1.c_cc[VTIME] = 0; - kbState1.c_lflag &= ~(ECHO|ICANON); -#ifdef SVR2 - ioctl(fd, TCSETAF, &kbState1); -#else - tcsetattr(fd, TCSAFLUSH, &kbState1); -#endif /* not SVR2 */ - -#endif /* !NOTERMIO */ -} - -/* Restore the terminal to normal operation */ -static void -kbInternalNorm(int fd) -{ -#if defined(NOTERMIO) - ioctl(fd, TIOCSETP, &kbState0); -#elif defined(SVR2) - ioctl(fd, TCSETAF, &kbState0); -#else /* Usual case */ - tcsetattr (fd, TCSAFLUSH, &kbState0); -#endif -} - -/* State variables */ -static volatile int kbCbreakFlag = 0; -static int kbFd = -1; - -#ifdef SVR2 -static int (*savesig)(int); -#else -static void (*savesig)(int); -#endif - -/* A wrapper around SIGINT and SIGCONT to restore the terminal modes. */ -static void -kbSig1(int sig) -{ - if (kbCbreakFlag) - kbInternalNorm(kbFd); - if (sig == SIGINT) - signal(sig, savesig); - else - signal(sig, SIG_DFL); - raise(sig); /* Re-send the signal */ -} - -static void -kbAddSigs(void); - -/* Resume cbreak after SIGCONT */ -static void -kbSig2(int sig) -{ - (void)sig; - if (kbCbreakFlag) - kbInternalCbreak(kbFd); - else - kbAddSigs(); -} - -static void -kbAddSigs(void) -{ - savesig = signal (SIGINT, kbSig1); -#ifdef SIGTSTP - signal (SIGCONT, kbSig2); - signal (SIGTSTP, kbSig1); -#endif -} - -static void -kbRemoveSigs(void) -{ - signal (SIGINT, savesig); -#ifdef SIGTSTP - signal (SIGCONT, SIG_DFL); - signal (SIGTSTP, SIG_DFL); -#endif -} - - -/* Now, at last, the externally callable functions */ - -void -kbCbreak(void) -{ - if (kbFd < 0) { - kbFd = open("/dev/tty", O_RDWR); - if (kbFd < 0) { - fputs("Can't open tty; using stdin\n", stderr); - kbFd = STDIN_FILENO; - } - } - - kbAddSigs(); - kbCbreakFlag = 1; - kbInternalCbreak(kbFd); -} - -void -kbNorm(void) -{ - kbInternalNorm(kbFd); - kbCbreakFlag = 0; - kbRemoveSigs(); -} - -int -kbGet(void) -{ - int i; - char c; - - i = read(kbFd, &c, 1); - if (i < 1) - return -1; - randEvent(c); - return c; -} - -/* - * Flush any pending input. If "thorough" is set, tries to be more - * thorough about it. Ideally, wait for 1 second of quiet, but we - * may do something more primitive. - * - * kbCbreak() has the side effect of flushing the inout queue, so this - * is not too critical. - */ -void -kbFlush(int thorough) -{ - if (thorough) - sleep(1); -#if defined(TCIFLUSH) - tcflush(kbFd, TCIFLUSH); -#elif defined(TIOCFLUSH) -#ifndef FREAD -#define FREAD 1 /* The usual value */ -#endif - ioctl(kbFd, TIOCFLUSH, FREAD); -#endif -} - -#if UNITTEST /* Self-contained test driver */ - -#include <ctype.h> - -int -main(void) -{ - int c; - - puts("Going to cbreak mode..."); - kbCbreak(); - puts("In cbreak mode. Please type."); - for (;;) { - c = kbGet(); - if (c == '\n' || c == '\r') - break; - printf("c = %d = '%c'\n", c, c); - kbFlush(isupper(c)); - } - puts("Returning to normal mode..."); - kbNorm(); - puts("Done."); - return 0; -} - -#endif /* UNITTEST */ diff --git a/libs/libzrtp/third_party/bnlib/test/keygen.c b/libs/libzrtp/third_party/bnlib/test/keygen.c deleted file mode 100644 index bfa88da4a6..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/keygen.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * keygen.c - generate RSA key pairs using the bignum library. - */ -#include "first.h" -#include <assert.h> -#include <stdio.h> /* For FILE type */ -#include <string.h> /* For memset */ - -#include "bn.h" -#include "prime.h" - -#include "keygen.h" -#include "keys.h" /* Key structures */ -#include "random.h" /* Good random number generator */ - -#if BNDEBUG -#include "bnprint.h" -#define bndPut(prompt, bn) bnPrint(stdout, prompt, bn, "\n") -#define bndPrintf printf -#else -#define bndPut(prompt, bn) ((void)(prompt),(void)(bn)) -#define bndPrintf (void) -#endif - -#include "kludge.h" - - -/* - * Generate a random bignum of a specified length, with the given - * high and low 8 bits. "High" is merged into the high 8 bits of the - * number. For example, set it to 0x80 to ensure that the number is - * exactly "bits" bits long (i.e. 2^(bits-1) <= bn < 2^bits). - * "Low" is merged into the low 8 bits. For example, set it to - * 1 to ensure that you generate an odd number. - */ -static int -genRandBn(struct BigNum *bn, unsigned bits, byte high, byte low) -{ - unsigned char buf[64]; - unsigned bytes; - unsigned l; - int err; - - bnSetQ(bn, 0); - - bytes = (bits+7) / 8; - l = bytes < sizeof(buf) ? bytes : sizeof(buf); - randBytes(buf, l); - - /* Mask off excess high bits */ - buf[0] &= 255 >> (-bits & 7); - /* Merge in specified high bits */ - buf[0] |= high >> (-bits & 7); - if (bits & 7) - buf[1] |= high << (bits & 7); - - for (;;) { - bytes -= l; - if (!bytes) /* Last word - merge in low bits */ - buf[l-1] |= low; - err = bnInsertBigBytes(bn, buf, bytes, l); - if (!bytes || err < 0) - break; - l = bytes < sizeof(buf) ? bytes : sizeof(buf); - randBytes(buf, l); - } - - memset(buf, 0, sizeof(buf)); - return err; -} - - -/* - * Generate a new RSA key, with the specified number of bits and - * public exponent. The high two bits of each prime are always - * set to make the number more difficult to factor by forcing the - * number into the high end of the range. - */ - -struct Progress { - FILE *f; - unsigned column; - unsigned wrap; -}; - -static int -genProgress(void *arg, int c) -{ - struct Progress *p = arg; - if (++p->column > p->wrap) { - putc('\n', p->f); - p->column = 1; - } - putc(c, p->f); - fflush(p->f); - return 0; -} - -int -genRsaKey(struct PubKey *pub, struct SecKey *sec, - unsigned bits, unsigned exp, FILE *file) -{ - int modexps = 0; - struct BigNum t; /* Temporary */ - int i; - struct Progress progress; - - progress.f = file; - progress.column = 0; - progress.wrap = 78; - - if (bnSetQ(&pub->e, exp)) - return -1; - - /* Find p - choose a starting place */ - if (genRandBn(&sec->p, bits/2, 0xC0, 1) < 0) - return -1; - /* And search for a prime */ - i = primeGen(&sec->p, randRange, file ? genProgress : 0, &progress, - exp, 0); - if (i < 0) - goto error; - modexps = i; - assert(bnModQ(&sec->p, exp) != 1); -bndPut("p = ", &sec->p); - - do { - /* Visual separator between the two progress indicators */ - if (file) - genProgress(&progress, ' '); - - if (genRandBn(&sec->q, (bits+1)/2, 0xC0, 1) < 0) - goto error; - if (bnCopy(&pub->n, &sec->q) < 0) - goto error; - if (bnSub(&pub->n, &sec->p) < 0) - goto error; - /* Note that bnSub(a,b) returns abs(a-b) */ - } while (bnBits(&pub->n) < bits/2-5); - - if (file) - fflush(file); /* Ensure the separators are visible */ - - i = primeGen(&sec->q, randRange, file ? genProgress : 0, &progress, - exp, 0); - if (i < 0) - goto error; - modexps += i; - assert(bnModQ(&sec->p, exp) != 1); -bndPut("q = ", &sec->q); - - /* Wash the random number pool. */ - randFlush(); - - /* Ensure that q is larger */ - if (bnCmp(&sec->p, &sec->q) > 0) - bnSwap(&sec->p, &sec->q); -bndPut("p = ", &sec->p); -bndPut("q = ", &sec->q); - - - /* - * Now we dive into a large amount of fiddling to compute d, - * the decryption exponent, from the encryption exponent. - * We require that e*d == 1 (mod p-1) and e*d == 1 (mod q-1). - * This can alomost be done via the Chinese Remainder Algorithm, - * but it doesn't quite apply, because p-1 and q-1 are not - * realitvely prime. Our task is to massage these into - * two numbers a and b such that a*b = lcm(p-1,q-1) and - * gcd(a,b) = 1. The technique is not well documented, - * so I'll describe it here. - * First, let d = gcd(p-1,q-1), then let a' = (p-1)/d and - * b' = (q-1)/d. By the definition of the gcd, gcd(a',b') at - * this point is 1, but a'*b' is a factor of d shy of the desired - * value. We have to produce a = a' * d1 and b = b' * d2 such - * d1*d2 = d and gcd(a,b) is 1. This will be the case iff - * gcd(a,d2) = gcd(b,d1) = 1. Since GCD is associative and - * (gcd(x,y,z) = gcd(x,gcd(y,z)) = gcd(gcd(x,y),z), etc.), - * gcd(a',b') = 1 implies that gcd(a',b',d) = 1 which implies - * that gcd(a',gcd(b',d)) = gcd(gcd(a',d),b') = 1. So you can - * extract gcd(b',d) from d and make it part of d2, and the - * same for d1. And iterate? A pessimal example is x = 2*6^k - * and y = 3*6^k. gcd(x,y) = 6^k and we have to divvy it up - * somehow so that all the factors of 2 go to x and all the - * factors of 3 go to y, ending up with a = 2*2^k and b = 3*3^k. - * - * Aah, fuck it. It's simpler to do one big inverse for now. - * Later I'll figure out how to get this to work properly. - */ - - /* Decrement q temporarily */ - (void)bnSubQ(&sec->q, 1); - /* And u = p-1, to be divided by gcd(p-1,q-1) */ - if (bnCopy(&sec->u, &sec->p) < 0) - goto error; - (void)bnSubQ(&sec->u, 1); -bndPut("p-1 = ", &sec->u); -bndPut("q-1 = ", &sec->q); - /* Use t to store gcd(p-1,q-1) */ - bnBegin(&t); - if (bnGcd(&t, &sec->q, &sec->u) < 0) { - bnEnd(&t); - goto error; - } -bndPut("t = gcd(p-1,q-1) = ", &t); - - /* Let d = (p-1) / gcd(p-1,q-1) (n is scratch for the remainder) */ - i = bnDivMod(&sec->d, &pub->n, &sec->u, &t); -bndPut("(p-1)/t = ", &sec->d); -bndPut("(p-1)%t = ", &pub->n); - bnEnd(&t); - if (i < 0) - goto error; - assert(bnBits(&pub->n) == 0); - /* Now we have q-1 and d = (p-1) / gcd(p-1,q-1) */ - /* Find the product, n = lcm(p-1,q-1) = c * d */ - if (bnMul(&pub->n, &sec->q, &sec->d) < 0) - goto error; -bndPut("(p-1)*(q-1)/t = ", &pub->n); - /* Find the inverse of the exponent mod n */ - i = bnInv(&sec->d, &pub->e, &pub->n); -bndPut("e = ", &pub->e); -bndPut("d = ", &sec->d); - if (i < 0) - goto error; - assert(!i); /* We should NOT get an error here */ - /* - * Now we have the comparatively simple task of computing - * u = p^-1 mod q. - */ -#if BNDEBUG - bnMul(&sec->u, &sec->d, &pub->e); -bndPut("d * e = ", &sec->u); - bnMod(&pub->n, &sec->u, &sec->q); -bndPut("d * e = ", &sec->u); -bndPut("q-1 = ", &sec->q); -bndPut("d * e % (q-1)= ", &pub->n); - bnNorm(&pub->n); - bnSubQ(&sec->p, 1); -bndPut("d * e = ", &sec->u); - bnMod(&sec->u, &sec->u, &sec->p); -bndPut("p-1 = ", &sec->p); -bndPut("d * e % (p-1)= ", &sec->u); - bnNorm(&sec->u); - bnAddQ(&sec->p, 1); -#endif - - /* But it *would* be nice to have q back first. */ - (void)bnAddQ(&sec->q, 1); - -bndPut("p = ", &sec->p); -bndPut("q = ", &sec->q); - - /* Now compute u = p^-1 mod q */ - i = bnInv(&sec->u, &sec->p, &sec->q); - if (i < 0) - goto error; -bndPut("u = p^-1 % q = ", &sec->u); - assert(!i); /* p and q had better be relatively prime! */ - -#if BNDEBUG - bnMul(&pub->n, &sec->u, &sec->p); -bndPut("u * p = ", &pub->n); - bnMod(&pub->n, &pub->n, &sec->q); -bndPut("u * p % q = ", &pub->n); - bnNorm(&pub->n); -#endif - /* And finally, n = p * q */ - if (bnMul(&pub->n, &sec->p, &sec->q) < 0) - goto error; -bndPut("n = p * q = ", &pub->n); - /* And that's it... success! */ - if (file) - putc('\n', file); /* Signal done */ - return modexps; - -error: - if (file) - fputs("?\n", file); /* Signal error */ - - return -1; -} - -/* - * Chinese Remainder Theorem refresher. - * The theorem is actually that, "given x mod a, x mod b, x mod c, x mod d, - * etc., the value of x mod lcm(a, b, c, d, ...) is uniquely determined", - * But everyone seems to use the name "theorem" to refer to the algorithm - * to put the number back together. - * - * Doing it for multiple numbers efficiently is a bit hairier, so I'll - * just consider it for two moduli, a and b. We assume that the inputs - * are in the canonical equivalence class (0 <= xa = x mod a < a, and - * 0 <= xb = x mod b < b), and we want the output in the same form. - * - * First, divide one or the other by gcd(a,b) to reduce the problem to - * one of relatively prime numbers. You'll have to reduce the corresponding - * xa or xb modulo the new modulus. - * - * Then, note that if xa == x (mod a), then x = xa + a*k. The problem - * lies in finding k so that xa + a*k == xb (mod b). Rearranging - * gives a*k == xb - xa (mod b), and then multiplying both sides by - * a^-1, the inverse of a mod b, gives k == a^-1 * (xb-xa) (mod b). - * If k is reduced mod b, then xa + a*k <= (a-1) + a * (b-1) = - * a + a*(b-1) - 1 = a*b - 1, which is exactly as it should be to - * be reduced mod a*b. And if all the inputs are >= 0, the output - * will be non-negative. - * - * For multiple numbers, you can get the number into a similar mixed- - * radix form x = xa + a*(k1 + b*(k2 + c*(k3 +...))). All the math - * to do this is modulo the small numbers (and thus faster); only the - * final summing has to be performed at large sizes. For the greatest - * efficiency, order the numbers so a > b > c >..., so as many computations - * as possible are small. - * - * So the total procedure for two numbers is: - * - Let a be the larger and b be the smaller of the numbers. - * - Divide b by gcd(a,b) to make it even smaller. - * - Find a^-1 mod b. - * - Find (xb-xa) mod b. - * - Multiply (xb-xa) by a^-1, modulo b. - * - Multiply that by a, without any modular reduction - * - Add xa. - */ - -#if 0 -/* A simple test driver */ - -#include "bnprint.h" -#include <time.h> -int -main(void) -{ - struct BigNum p, q, d, u; - int i; - clock_t interval; - static unsigned const sizetable[] = { - 384, 512, 513, 514, 515, 768, 1024, 1536, 2048, 0 - }; - unsigned const *sizeptr = sizetable; - - bnInit(); - bnRandSeed(1); - bnBegin(&p); - bnBegin(&q); - bnBegin(&d); - bnBegin(&u); - - while (*sizeptr) { - printf("Generating a %u-bit RSA key\n", *sizeptr); - - interval = clock(); - i = genRsaKey(&p, &q, &d, &u, *sizeptr, 17, stdout); - interval = clock() - interval; - printf("genRsaKey returned %d. %ld.%06ld s\n", i, - interval / 1000000, interval % 1000000); - fputs("p = ", stdout); - bnPrint(stdout, &p); - fputs("\nq = ", stdout); - bnPrint(stdout, &q); - fputs("\nd = ", stdout); - bnPrint(stdout, &d); - fputs("\nu = ", stdout); - bnPrint(stdout, &u); - putchar('\n'); - - sizeptr++; - } - - bnEnd(&p); - bnEnd(&q); - bnEnd(&d); - bnEnd(&u); - - return 0; -} -#endif diff --git a/libs/libzrtp/third_party/bnlib/test/keygen.h b/libs/libzrtp/third_party/bnlib/test/keygen.h deleted file mode 100644 index c9f75f8c07..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/keygen.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#include <stdio.h> -struct PubKey; -struct SecKey; - -int -genRsaKey(struct PubKey *pub, struct SecKey *sec, - unsigned bits, unsigned exp, FILE *file); diff --git a/libs/libzrtp/third_party/bnlib/test/keys.c b/libs/libzrtp/third_party/bnlib/test/keys.c deleted file mode 100644 index 3b99f4988e..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/keys.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * keys.c - allocate and free PubKey and SecKey structures. - */ - -#include "first.h" - -#include "bn.h" - -#include "keys.h" -#include "usuals.h" - -void -pubKeyBegin(struct PubKey *pub) -{ - if (pub) { - bnBegin(&pub->n); - bnBegin(&pub->e); - } -} - -void -pubKeyEnd(struct PubKey *pub) -{ - if (pub) { - bnEnd(&pub->n); - bnEnd(&pub->e); - wipe(pub); - } -} - -void -secKeyBegin(struct SecKey *sec) -{ - if (sec) { - bnBegin(&sec->d); - bnBegin(&sec->p); - bnBegin(&sec->q); - bnBegin(&sec->u); - } -} - -void -secKeyEnd(struct SecKey *sec) -{ - if (sec) { - bnEnd(&sec->d); - bnEnd(&sec->p); - bnEnd(&sec->q); - bnEnd(&sec->u); - wipe(sec); - } -} diff --git a/libs/libzrtp/third_party/bnlib/test/keys.h b/libs/libzrtp/third_party/bnlib/test/keys.h deleted file mode 100644 index cb219da0e2..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/keys.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef KEYS_H -#define KEYS_H - -/* - * Structures for keys. - */ - -#include "bn.h" - -/* A structure to hold a public key */ -struct PubKey { - struct BigNum n; /* The public modulus */ - struct BigNum e; /* The public exponent */ -}; - -/* A structure to hold a secret key */ -struct SecKey { - struct BigNum d; /* Decryption exponent */ - struct BigNum p; /* The smaller factor of n */ - struct BigNum q; /* The larger factor of n */ - struct BigNum u; /* 1/p (mod q) */ -}; - -void pubKeyBegin(struct PubKey *pub); -void pubKeyEnd(struct PubKey *pub); - -void secKeyBegin(struct SecKey *sec); -void secKeyEnd(struct SecKey *sec); - -#endif /* KEYS_H */ diff --git a/libs/libzrtp/third_party/bnlib/test/kludge.h b/libs/libzrtp/third_party/bnlib/test/kludge.h deleted file mode 100644 index 695db0b653..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/kludge.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef KLUDGE_H -#define KLUDGE_H - -/* - * Kludges for not-quite-ANSI systems. - * This should always be the last file included, because it may - * mess up some system header files. - */ - -#if NO_MEMMOVE /* memove() not in libraries */ -#define memmove(dest,src,len) bcopy(src,dest,len) -#endif - -#if NO_STRTOUL /* strtoul() not in libraries */ -#define strtoul strtol /* Close enough */ -#endif - -#if NO_RAISE /* raise() not in libraries */ -#include <sys/types.h> /* For getpid() - kill() is in <signal.h> */ -#define raise(sig) kill(getpid(),sig) -#endif - -/* - * Make Microsoft Visual C shut the hell up about a few things... - * Warning 4116 complains about the alignof() macro, saying: - * warning C4116: unnamed type definition in parentheses - * I do not know of a reasonable way to recode to eliminate this warning. - * Warning 4761 complains about passing an expression (which has - * type int) to a function expecting something narrower - like - * a ringmask, if ringmask is set to 8 bits. The error is: - * warning C4761: integral size mismatch in argument : conversion supplied - * I do not know of a reasonable way to recode to eliminate this warning. - */ -#ifdef _MSC_VER -#pragma warning(disable: 4116 4761) -#endif - -/* - * Borland C seems to think that it's a bad idea to decleare a - * structure tag and not declare the contents. I happen to think - * it's a *good* idea to use such "opaque" structures wherever - * possible. So shut up. - */ -#ifdef __BORLANDC__ -#pragma warn -stu -#endif - -/* Cope with people forgetting to define the OS, if possible... */ - -#if !defined(MSDOS) && defined(__MSDOS__) -#define MSDOS 1 -#endif - -#if !defined(UNIX) && (defined(unix) || defined (__unix__)) -#define UNIX 1 -#endif - - -#endif /* KLUDGE_H */ diff --git a/libs/libzrtp/third_party/bnlib/test/md5.c b/libs/libzrtp/third_party/bnlib/test/md5.c deleted file mode 100644 index c65d1cca47..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/md5.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * This code implements the MD5 message-digest algorithm. - * The algorithm is due to Ron Rivest. This code was - * written by Colin Plumb in 1993, no copyright is claimed. - * This code is in the public domain; do with it what you wish. - * - * Equivalent code is available from RSA Data Security, Inc. - * This code has been tested against that, and is equivalent, - * except that you don't need to include two pages of legalese - * with every copy. - * - * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which - * will fill a supplied 16-byte array with the digest. - */ -#include "first.h" -#include <string.h> /* for memcpy() */ - -#include "md5.h" - -#ifndef ASM_MD5 -/* - * Shuffle the bytes into little-endian order within words, as per the - * MD5 spec. Note: this code works regardless of the byte order. - */ -void -byteSwap(word32 *buf, unsigned words) -{ - byte *p = (byte *)buf; - - do { - *buf++ = (word32)((unsigned)p[3] << 8 | p[2]) << 16 | - ((unsigned)p[1] << 8 | p[0]); - p += 4; - } while (--words); -} -#endif - -/* - * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious - * initialization constants. - */ -void -MD5Init(struct MD5Context *ctx) -{ - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; - - ctx->bytes[0] = 0; - ctx->bytes[1] = 0; -} - -/* - * Update context to reflect the concatenation of another buffer full - * of bytes. - */ -void -MD5Update(struct MD5Context *ctx, byte const *buf, size_t len) -{ - word32 t; - - /* Update byte count */ - - t = ctx->bytes[0]; - if ((ctx->bytes[0] = t + len) < t) - ctx->bytes[1]++; /* Carry from low to high */ - - t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ - if ((unsigned)t > len) { - memcpy((byte *)ctx->in + 64 - (unsigned)t, buf, len); - return; - } - /* First chunk is an odd size */ - memcpy((byte *)ctx->in + 64 - (unsigned)t, buf, (unsigned)t); - byteSwap(ctx->in, 16); - MD5Transform(ctx->buf, ctx->in); - buf += (unsigned)t; - len -= (unsigned)t; - - /* Process data in 64-byte chunks */ - while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteSwap(ctx->in, 16); - MD5Transform(ctx->buf, ctx->in); - buf += 64; - len -= 64; - } - - /* Handle any remaining bytes of data. */ - memcpy(ctx->in, buf, len); -} - -/* - * Final wrapup - pad to 64-byte boundary with the bit pattern - * 1 0* (64-bit count of bits processed, MSB-first) - */ -void -MD5Final(byte digest[16], struct MD5Context *ctx) -{ - int count = (int)(ctx->bytes[0] & 0x3f); /* Bytes in ctx->in */ - byte *p = (byte *)ctx->in + count; /* First unused byte */ - - /* Set the first char of padding to 0x80. There is always room. */ - *p++ = 0x80; - - /* Bytes of padding needed to make 56 bytes (-8..55) */ - count = 56 - 1 - count; - - if (count < 0) { /* Padding forces an extra block */ - memset(p, 0, count + 8); - byteSwap(ctx->in, 16); - MD5Transform(ctx->buf, ctx->in); - p = (byte *)ctx->in; - count = 56; - } - memset(p, 0, count); - byteSwap(ctx->in, 14); - - /* Append length in bits and transform */ - ctx->in[14] = ctx->bytes[0] << 3; - ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; - MD5Transform(ctx->buf, ctx->in); - - byteSwap(ctx->buf, 4); - memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ -} - -#ifndef ASM_MD5 - -/* The four core functions - F1 is optimized somewhat */ - -/* #define F1(x, y, z) (x & y | ~x & z) */ -#define F1(x, y, z) (z ^ (x & (y ^ z))) -#define F2(x, y, z) F1(z, x, y) -#define F3(x, y, z) (x ^ y ^ z) -#define F4(x, y, z) (y ^ (x | ~z)) - -/* This is the central step in the MD5 algorithm. */ -#define MD5STEP(f,w,x,y,z,in,s) \ - (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) - -/* - * The core of the MD5 algorithm, this alters an existing MD5 hash to - * reflect the addition of 16 longwords of new data. MD5Update blocks - * the data and converts bytes into longwords for this routine. - */ -void -MD5Transform(word32 buf[4], word32 const in[16]) -{ - register word32 a, b, c, d; - - a = buf[0]; - b = buf[1]; - c = buf[2]; - d = buf[3]; - - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; -} - -#endif diff --git a/libs/libzrtp/third_party/bnlib/test/md5.h b/libs/libzrtp/third_party/bnlib/test/md5.h deleted file mode 100644 index 89bf7f05dd..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/md5.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef MD5_H -#define MD5_H - -#include <stddef.h> -#include "usuals.h" - -struct MD5Context { - word32 buf[4]; - word32 bytes[2]; - word32 in[16]; -}; - -void MD5Init(struct MD5Context *context); -void MD5Update(struct MD5Context *context, byte const *buf, size_t len); -void MD5Final(unsigned char digest[16], struct MD5Context *context); -void MD5Transform(word32 buf[4], word32 const in[16]); - -void byteSwap(word32 *buf, unsigned words); - -#endif /* !MD5_H */ diff --git a/libs/libzrtp/third_party/bnlib/test/noise.c b/libs/libzrtp/third_party/bnlib/test/noise.c deleted file mode 100644 index 839736a079..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/noise.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright (c) 1993-1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Get environmental noise. - */ - -#include "first.h" -#include <time.h> /* For time measurement code */ - -#ifndef MSDOS -#ifdef __MSDOS -#define MSDOS 1 -#endif -#endif -#ifndef MSDOS -#ifdef __MSDOS__ -#define MSDOS 1 -#endif -#endif -#ifndef UNIX -#ifdef unix -#define UNIX 1 -#endif -#endif -#ifndef UNIX -#ifdef __unix -#define UNIX 1 -#endif -#endif -#ifndef UNIX -#ifdef __unix__ -#define UNIX 1 -#endif -#endif - -#ifdef MSDOS - -#if __BORLANDC__ -#define far __far /* Borland C++ 3.1's <dos.h> kacks in ANSI mode. Ugh! */ -#endif - -#include <dos.h> /* for enable() and disable() */ -#include <conio.h> /* for inp() and outp() */ - -/* - * This code gets as much information as possible out of 8253/8254 timer 0, - * which ticks every .84 microseconds. There are three cases: - * 1) Original 8253. 15 bits available, as the low bit is unused. - * 2) 8254, in mode 3. The 16th bit is available from the status register. - * 3) 8254, in mode 2. All 16 bits of the counters are available. - * (This is not documented anywhere, but I've seen it!) - * - * This code repeatedly tries to latch the status (ignored by an 8253) and - * sees if it looks like xx1101x0. If not, it's definitely not an 8254. - * Repeat this a few times to make sure it is an 8254. - */ -static int -has8254(void) -{ - int i, s1, s2; - - for (i = 0; i < 5; i++) { - _disable(); - outp(0x43, 0xe2); /* Latch status for timer 0 */ - s1 = inp(0x40); /* If 8253, read timer low byte */ - outp(0x43, 0xe2); /* Latch status for timer 0 */ - s2 = inp(0x40); /* If 8253, read timer high byte */ - _enable(); - if ((s1 & 0x3d) != 0x34 || (s2 & 0x3d) != 0x34) - return 0; /* Ignoring status latch; 8253 */ - } - return 1; /* Status reads as expected; 8254 */ -} - -/* TODO: It might be better to capture this data in a keyboard ISR */ -static unsigned -read8254(void) -{ - unsigned status, count; - - _disable(); - outp(0x43, 0xc2); /* Latch status and count for timer 0 */ - status = inp(0x40); - count = inp(0x40); - count |= inp(0x40) << 8; - _enable(); - /* The timer is usually in mode 3, but some motherboards use mode 2. */ - if (status & 2) - count = count>>1 | (status & 0x80)<<8; - - return count; -} - -static unsigned -read8253(void) -{ - unsigned count; - - _disable(); - outp(0x43, 0x00); /* Latch count for timer 0 */ - count = (inp(0x40) & 0xff); - count |= (inp(0x40) & 0xff) << 8; - _enable(); - - return count >> 1; -} -#endif /* MSDOS */ - -#ifdef UNIX -/* - * This code uses five different timers, if available, in decreasing - * priority order: - * - gethrtime(), assumed unavailable unless USE_GETHRTIME=1 - * - clock_gettime(), auto-detected unless overridden with USE_CLOCK_GETTIME - * - gettimeofday(), assumed available unless USE_GETTIMEOFDAY=0 - * - getitimer(), auto-detected unless overridden with USE_GETITIMER - * - ftime(), assumed available unless USE_FTIME=0 - * - * These are all accessed through the gettime(), timetype, and tickdiff() - * macros. The MINTICK constant is something to avoid the gettimeofday() - * glitch wherein it increments the return value even if no tick has occurred. - * When measuring the tick interval, if the difference between two successive - * times is not at least MINTICK ticks, it is ignored. - */ - -#include <sys/types.h> -#include <sys/times.h> /* for times() */ -#include <stdlib.h> /* For qsort() */ - -#if !USE_GETHRTIME -#ifndef USE_CLOCK_GETTIME /* Detect using CLOCK_REALTIME from <time.h> */ -#ifdef CLOCK_REALTIMExxx /* Stupid libc... */ -#define USE_CLOCK_GETTIME 1 -#else -#define USE_CLOCK_GETTIME 0 -#endif -#endif - -#if !USE_CLOCK_GETTIME -#include <sys/time.h> /* For gettimeofday(), getitimer(), or ftime() */ - -#ifndef USE_GETTIMEOFDAY -#define USE_GETTIMEOFDAY 1 /* No way to tell, so assume it's there */ -#endif - -#if !USE_GETTIMEOFDAY -#ifndef USE_GETITIMER /* Detect using ITIMER_REAL from <sys/time.h> */ -#define USE_GETITIMER defined(ITIMER_REAL) -#endif - -#if !USE_GETITIMER -#ifndef USE_FTIME -#define USE_FTIME 1 -#endif - -#endif /* !USE_GETITIMER */ -#endif /* !USE_GETTIMEOFDAY */ -#endif /* !USE_CLOCK_GETTIME */ -#endif /* !USE_GETHRTIME */ - -#if USE_GETHRTIME - -#define CHOICE_GETHRTIME 1 -#include <sys/time.h> -typedef hrtime_t timetype; -#define gettime(s) (*(s) = gethrtime()) -#define tickdiff(s,t) ((s)-(t)) -#define MINTICK 0 - -#elif USE_CLOCK_GETTIME - -#define CHOICE_CLOCK_GETTIME 1 -typedef struct timespec timetype; -#define gettime(s) (void)clock_gettime(CLOCK_REALTIME, s) -#define tickdiff(s,t) (((s).tv_sec-(t).tv_sec)*1000000000 + \ - (s).tv_nsec - (t).tv_nsec) - -#elif USE_GETTIMEOFDAY - -#define CHOICE_GETTIMEOFDAY 1 -typedef struct timeval timetype; -#define gettime(s) (void)gettimeofday(s, (struct timezone *)0) -#define tickdiff(s,t) (((s).tv_sec-(t).tv_sec)*1000000+(s).tv_usec-(t).tv_usec) -#define MINTICK 1 - -#elif USE_GETITIMER - -#define CHOICE_GETITIMER 1 -#include <signal.h> /* For signal(), SIGALRM, SIG_IGN */ -typedef struct itimerval timetype; -#define gettime(s) (void)getitimer(ITIMER_REAL, s) -#define tickdiff(s,t) (((t).it_value.tv_sec-(s).it_value.tv_sec)*1000000 + \ - (t).it_value.tv_usec - (s).it_value.tv_usec) -#define MINTICK 1 - -#elif USE_FTIME /* Use ftime() */ - -#define CHOICE_FTIME 1 -#include <sys/timeb.h> -typedef struct timeb timetype; -#define gettime(s) (void)ftime(s) -#define tickdiff(s,t) (((s).time-(t).time)*1000 + (s).millitm - (t).millitm) -#define MINTICK 0 - -#else - -#error No clock available - please define one. - -#endif /* End of complex choice of clock conditional */ - -#if CHOICE_CLOCK_GETTIME - -static unsigned -noiseTickSize(void) -{ - struct timespec res; - - clock_getres(CLOCK_REALTIME, &res); - return res.tv_nsec; -} - -#else /* Normal clock resolution estimation */ - -#if NOISEDEBUG -#include <stdio.h> -#endif - -#define N 15 /* Number of deltas to try (at least 5, preferably odd) */ - -/* Function needed for qsort() */ -static int -noiseCompare(void const *p1, void const *p2) -{ - return *(unsigned const *)p1 > *(unsigned const *)p2 ? 1 : - *(unsigned const *)p1 < *(unsigned const *)p2 ? -1 : 0; -} - -/* - * Find the resolution of the high-resolution clock by sampling successive - * values until a tick boundary, at which point the delta is entered into - * a table. An average near the median of the table is taken and returned - * as the system tick size to eliminate outliers due to descheduling (high) - * or tv0 not being the "zero" time in a given tick (low). - * - * Some trickery is needed to defeat the habit systems have of always - * incrementing the microseconds field from gettimeofday() results so that - * no two calls return the same value. Thus, a "tick boundary" is assumed - * when successive calls return a difference of more than MINTICK ticks. - * (For gettimeofday(), this is set to 2 us.) This catches cases where at - * most one other task reads the clock between successive reads by this task. - * More tasks in between are rare enough that they'll get cut off by the - * median filter. - * - * When a tick boundary is found, the *first* time read during the previous - * tick (tv0) is subtracted from the new time to get microseconds per tick. - * - * Suns have a 1 us timer, and as of SunOS 4.1, they return that timer, but - * there is ~50 us of system-call overhead to get it, so this overestimates - * the tick size considerably. On SunOS 5.x/Solaris, the overhead has been - * cut to about 2.5 us, so the measured time alternates between 2 and 3 us. - * Some better algorithms will be required for future machines that really - * do achieve 1 us granularity. - * - * Current best idea: discard all this hair and use Ueli Maurer's entropy - * estimation scheme. Assign each input event (delta) a sequence number. - * 16 bits should be more than adequate. Make a table of the last time - * (by sequence number) each possibe input event occurred. For practical - * implementation, hash the event to a fixed-size code and consider two - * events identical if they have the same hash code. This will only ever - * underestimate entropy. Then use the number of bits in the difference - * between the current sequence number and the previous one as the entropy - * estimate. - * - * If it's desirable to use longer contexts, Maurer's original technique - * just groups events into non-overlapping pairs and uses the technique on - * the pairs. If you want to increment the entropy numbers on each keystroke - * for user-interface niceness, you can do the operation each time, but you - * have to halve the sequence number difference before starting, and then you - * have to halve the number of bits of entropy computed because you're adding - * them twice. - * - * You can put the even and odd events into separate tables to close Maurer's - * model exactly, or you can just dump them into the same table, which will - * be more conservative. - */ -static unsigned -noiseTickSize(void) -{ - unsigned i = 0, j = 0, diff, d[N]; - timetype tv0, tv1, tv2; - - gettime(&tv0); - tv1 = tv0; - do { - gettime(&tv2); - diff = (unsigned)tickdiff(tv2, tv1); - if (diff > MINTICK) { - d[i++] = diff; - tv0 = tv2; - j = 0; - } else if (++j >= 4096) /* Always getting <= MINTICK units */ - return MINTICK + !MINTICK; - tv1 = tv2; - } while (i < N); - - /* Return average of middle 5 values (rounding up) */ - qsort(d, N, sizeof(d[0]), noiseCompare); - diff = (d[N/2-2]+d[N/2-1]+d[N/2]+d[N/2+1]+d[N/2+2]+4)/5; -#if NOISEDEBUG - fprintf(stderr, "Tick size is %u\n", diff); -#endif - return diff; -} - -#endif /* Clock resolution measurement condition */ - -#endif /* UNIX */ - -#include "usuals.h" -#include "randpool.h" -#include "noise.h" - -/* - * Add as much environmentally-derived random noise as possible - * to the randPool. Typically, this involves reading the most - * accurate system clocks available. - * - * Returns the number of ticks that have passed since the last call, - * for entropy estimation purposes. - */ -word32 -noise(void) -{ - word32 delta; - -#if defined(MSDOS) - static unsigned deltamask = 0; - static unsigned prevt; - unsigned t; - time_t tnow; - clock_t cnow; - - if (deltamask == 0) - deltamask = has8254() ? 0xffff : 0x7fff; - t = (deltamask & 0x8000) ? read8254() : read8253(); - randPoolAddBytes((byte const *)&t, sizeof(t)); - delta = deltamask & (t - prevt); - prevt = t; - - /* Add more-significant time components. */ - cnow = clock(); - randPoolAddBytes((byte *)&cnow, sizeof(cnow)); - tnow = time((time_t *)0); - randPoolAddBytes((byte *)&tnow, sizeof(tnow)); -/* END OF DOS */ -#elif defined(VMS) - word32 t[2]; /* little-endian 64-bit timer */ - word32 d1; /* MSW of difference */ - static word32 prevt[2]; - - SYS$GETTIM(t); /* VMS hardware clock increments by 100000 per tick */ - randPoolAddBytes((byte const *)t, sizeof(t)); - /* Get difference in d1 and delta, and old time in prevt */ - d1 = t[1] - prevt[1] + (t[0] < prevt[0]); - prevt[1] = t[1]; - delta = t[0] - prevt[0]; - prevt[0] = t[0]; - - /* Now, divide the 64-bit value by 100000 = 2^5 * 5^5 = 32 * 3125 */ - /* Divide value, MSW in d1 and LSW in delta, by 32 */ - delta >>= 5; - delta |= d1 << (32-5); - d1 >>= 5; - /* - * Divide by 3125. This fits into 16 bits, so the following - * code is possible. 2^32 = 3125 * 1374389 + 1671. - * - * This code has confused people reading it, so here's a detailed - * explanation. First, since we only want a 32-bit result, - * reduce the input mod 3125 * 2^32 before starting. This - * amounts to reducing the most significant word mod 3125 and - * leaving the least-significant word alone. - * - * Then, using / for mathematical (real, not integer) division, we - * want to compute floor(d1 * 2^32 + d0) / 3125), which I'll denote - * using the old [ ] syntax for floor, so it's - * [ (d1 * 2^32 + d0) / 3125 ] - * = [ (d1 * (3125 * 1374389 + 1671) + d0) / 3125 ] - * = [ d1 * 1374389 + (d1 * 1671 + d0) / 3125 ] - * = d1 * 137438 + [ (d1 * 1671 + d0) / 3125 ] - * = d1 * 137438 + [ d0 / 3125 ] + [ (d1 * 1671 + d0 % 3125) / 3125 ] - * - * The C / operator, applied to integers, performs [ a / b ], so - * this can be implemented in C, and since d1 < 3125 (by the first - * modulo operation), d1 * 1671 + d0 % 3125 < 3125 * 1672, which - * is 5225000, less than 2^32, so it all fits into 32 bits. - */ - d1 %= 3125; /* Ignore overflow past 32 bits */ - delta = delta/3125 + d1*1374389 + (delta%3125 + d1*1671) / 3125; -/* END OF VMS */ -#elif defined(UNIX) - timetype t; - static unsigned ticksize = 0; - static timetype prevt; - - gettime(&t); -#if CHOICE_GETITIMER - /* If itimer isn't started, start it */ - if (t.it_value.tv_sec == 0 && t.it_value.tv_usec == 0) { - /* - * start the timer - assume that PGP won't be running for - * more than 11 days, 13 hours, 46 minutes and 40 seconds. - */ - t.it_value.tv_sec = 1000000; - t.it_interval.tv_sec = 1000000; - t.it_interval.tv_usec = 0; - signal(SIGALRM, SIG_IGN); /* just in case.. */ - setitimer(ITIMER_REAL, &t, NULL); - t.it_value.tv_sec = 0; - } - randPoolAddBytes((byte const *)&t.it_value, sizeof(t.it_value)); -#else - randPoolAddBytes((byte const *)&t, sizeof(t)); -#endif - - if (!ticksize) - ticksize = noiseTickSize(); - delta = (word32)(tickdiff(t, prevt) / ticksize); - prevt = t; -/* END OF UNIX */ -#else -#error Unknown OS - define UNIX or MSDOS or add code for high-resolution timers -#endif - - return delta; -} diff --git a/libs/libzrtp/third_party/bnlib/test/noise.h b/libs/libzrtp/third_party/bnlib/test/noise.h deleted file mode 100644 index ae0584d54d..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/noise.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Noise.h - get environmental noise for RNG - * - * The interface is system-independent, but the - * implementation should be highly system-dependent, - * to get at as much state as possible. - */ - -#include "usuals.h" - -word32 noise(void); diff --git a/libs/libzrtp/third_party/bnlib/test/posix.h b/libs/libzrtp/third_party/bnlib/test/posix.h deleted file mode 100644 index 0d38eaf492..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/posix.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * This file includes <unistd.h>, if it's available, and - * declares a bunch of functions with "traditional" values if not. - * The GNU Libc Manual (node "Version Supported") says this is impossible; - * I wonder what they think of this. - */ - -#include <limits.h> - -/* - * See if this is a POSIX <limits.h>. A POSIX system *may* define - * a macro for ARG_MAX, but it may instead defined _SC_ARG_MAX - * in <unistd.h> and require you yo use sysconf() to get the value. - * However, a POSIX system is supposed to defined _POSIX_ARG_MAX - * in <limits.h> with the value of 4096, the POSIX-mandated lower - * bound on ARG_MAX or sysconf(_SC_ARG_MAX). - * A POSIX system is supposed to define most of these, so checking for - * them *all* is overkill, but it's easy enough... - */ -#ifndef HAVE_UNISTD_H -#ifdef __POSIX__ /* Defined by GCC on POSIX systems */ -#define HAVE_UNISTD_H 1 -#elif defined(_POSIX_ARG_MAX) || defined(_POSIX_CHILD_MAX) -#define HAVE_UNISTD_H 1 -#elif defined(_POSIX_LINK_MAX) || defined(_POSIX_MAX_CANON) -#define HAVE_UNISTD_H 1 -#elif defined(_POSIX_MAX_INPUT) || defined(_POSIX_NAME_MAX) -#define HAVE_UNISTD_H 1 -#elif defined(_POSIX_NGROUPS_MAX) || defined(_POSIX_OPEN_MAX) -#define HAVE_UNISTD_H 1 -#elif defined(_POSIX_PATH_MAX) || defined(_POSIX_PIPE_BUF) -#define HAVE_UNISTD_H 1 -#elif defined(_POSIX_RE_DUP_MAX) || defined(_POSIX_SSIZE_MAX) -#define HAVE_UNISTD_H 1 -#elif defined(_POSIX_STREAM_MAX) || defined (_POSIX_TZNAME_MAX) -#define HAVE_UNISTD_H 1 -#endif -#endif - -#if HAVE_UNISTD_H -#include <unistd.h> -#elif defined(MSDOS) -#include <io.h> /* Where MSDOS keeps such things */ -#else -/* Not POSIX - declare the portions of <unistd.h> we need manually. */ -int ioctl(int fd, int request, void *arg); -int isatty(int fd); -int read(int fd, void *buf, int nbytes); -unsigned sleep(unsigned seconds); -#endif diff --git a/libs/libzrtp/third_party/bnlib/test/primes.doc b/libs/libzrtp/third_party/bnlib/test/primes.doc deleted file mode 100644 index 84b3385609..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/primes.doc +++ /dev/null @@ -1,215 +0,0 @@ - The choice of Diffie-Hellman parameters - -* Background - -Diffie-Hellman key exchange uses two parameters, a prime p and a -generator g, which are used to derive the public parameters -y1 = g^x1 (mod p) and y2 = g^x2 (mod p), and then the shared secret -z = y1^x2 = (g^x1)^x2 = g^(x1*x2) = (g^x2)^x1 = y2^x1 (mod p). - -For the computation to be secure, several conditions must be true. -The exponent must be big enough, for there is a square-root search -algorithm to find the exponent. (E.g. a 16-bit exponent can be found -in about 2^8 = 256 steps.) And then the modulus must be chosen so -as to make the general discrete log problem difficult. - -The general discrete log problem can be solved for each prime-power -factor of p-1 independently, so if all of the factors of p-1 are small, -this is easy to do. Since p-1 is even, it must have a factor of 2, but -the remaining portion q = (p-1)/2 can be chosen to be prime, making the -problem as difficult as possible. Finding such numbers is computationally -expensive, but as they are parameters which are only computed once, this -is a reasonable up-front cost. - -* Number theory - -A second advantage of prime moduli of this form is that all generators -g are good. This is because the generator must have a large order in -the group Z*_p. But that group is of size p-1 = 2*q, and the order of -any element of a group must divide the size of the group. The only -divisors this has are 1, 2, q and 2*q. The only element of order 1 is -1, and the only element of order 2 is -1. All other elements, from 2 -through -2, have orders of either p-1 or (p-1)/2, which are both large. - -If the generator g has order p-1, it is a generator of the group Z*_p, -and this is generally how one is advised to generate Diffie-Hellman -parameters. This explains the similarity in names. However, if g is -of order p-1, then it must be a quadratic non-residue modulo p. That -is, it must not be a square of another number. If it were a square, -then since the size of the group is even, no power of it would ever -equal its square root, so it could not be a generator. - -If g is indeed of order p-1, then even powers of g are quadratic -residues (squares, modulo p), and odd powers are quadratic non-residues -(non-squares). Given a number y and a prime p, the Legendre symbol -(y/p) is straightforward to compute, and this tells you if y is a -quadratic residue. If it is, and y = g^x, then x must be even. If not, -then x would have to be odd. In this way, for a generator which is a -quadratic non-residue, the low-order bit of the exponent x is easily -computed. - -If g is a quadratic residue, then the useful values of exponents x is -more limited, since only the value of the exponent x modulo q = (p-1)/2 -has any effect on the output y = g^x (mod p), but generally exponents x -are much less than p in any case, so this limitation on range is not an -issue. - -Essentially, in either case, only the value of x modulo q is secret, -but if g is a quadratic non-residue, the low-order bit of x is -available to an attacker, while if it is a quadratic residue, the -high-order bit is known to be 0. - -Thus, it does not really matter whether g is a quadratic residue or -not, but if it is not, the exponent x should be chosen one bit larger. -This adds a trivial amount of work to the computation of y, and for -that reason it may be preferable to choose g to be a quadratic -residue. This is not currently done, however. - -* Choice of generator g - -Because any g will do, and the choice of g does not affect the difficulty -of performing the discrete log computation, choosing it for convenience -of computation is best, and g = 2 is simplest to compute with. - -If in fact it is desirable to choose a generator which is a quadratic -residue, then g = 2 can still be used if the prime p is suitably -chosen. If p = +/-1 (mod 8), then 2 is a quadratic residue. If -p = +/-3 (mod 8), then 2 is a non-residue. - -* Choice of prime-generation technique - -There may be additional primes of special form for which the discrete -logarithm problem is particularly easy. The authors are not aware of -any, but theoretical advances are possible and it would be nice to -assure users of the system that the prime was not chosen to have any -hidden special properties: only the published criteria were used. -David Kravitz of the NSA has suggested a technique for generating -"kosherized" primes for DSS which has been adapted to generate -Diffie-Hellman primes. - -The technique uses a string of bytes as a seed to a cryptographically -strong one-way hash function. This generator produces the initial -value for a search for a suitable prime. - -David Kravitz' technique generates random numbers from successive seeds -until one is found to be a suitable prime. This is unbearably slow for -primes of the special form being sought, but it can be sped up, at a -negligible cost in uniformity of the chosen primes by generating only a -starting position for a linear search for a suitable prime. Such a -search can be carried out particularly efficiently. - -* Details of the technique - -The generator is based on SHA.1, the FIPS 180.1 secure hash algorithm. -This takes the given seed as input and produces a 160-bit output -sequence in 20 bytes. These bytes are taken as a big-endian number to -produce a number n0 from 0 to 2^160-1. -(I.e. n0 = 2^152 * byte0 + 2^144 * byte1 + ... + 2^8 * byte19 + byte20.) - -Then, the seed is incremented, as a big-endian array of bytes, modulo its -size (i.e. the last byte is incremented, propagating carry if necessary), -and hashed again to produce n1, then n2, etc. - -A number of arbitrary size may be constructed by concatenating -N = n0 + 2^160 * n1 + 2^320 * n2 + .... To get a number no larger -than 2^k, take the low-order k bits of N, N mod 2^k. Obviously, -if k is 1024, it is only necessary to compute n0 through n6. - -To generate a k-bit prime p (2^k > p >= 2^(k-1)), take t = N mod 2^(k-2), -i.e. a number with at most k-2 significant bits. Then add 2^(k-1), -to force the number into the desired range, and 2^(k-2), to force it -into the high half of the range. This extra refinement makes an attack -more expensive, without affecting the time required to do computations -mod p. Additional high-order 1 bits could be forced, but the incremental -benefit rapidly diminishes. - -The resultant number t is used as the starting point in a search for a -suitable prime p. p is chosen to be the first number >= t such that p -is prime and (p-1)/2 is prime. - -* Choice of seed - -Because SHA.1 is a cryptographic hash, it is computationally infeasible -to find an input which has a given output. Indeed, there is no known -technique better than brute-force search to find an input which -produces an output with any special properties. Assuming that there is -an unknown class of primes which are easy to solve the discrete -logarithm problem for, this ensures that the chance of choosing a prime -p which is a member of that class is no better than random chance, -regardless of malice on the part of the designer. - -The seed chosen is arbitrary, so was chosen for aesthetic reasons. -It is the 79 bytes of the ASCII representation of a quote by Mahatma -Gandhi: - -Whatever you do will be insignificant, but it is very important that you do it. - -* Implementation details - -Obviously, a program was written to find a prime according to these -rules. To aid anyone who wishes to repeat the search to confirm that -the published primes were indeed generated in this way, here is a -description of how it was done. The primes if the desired form have a -density of about (ln p)^-2. E.g. for 1024-bit p, about one out of -every 503791 numbers meets these criteria, so a considerable amount of -searching is required. The following techniques can make the -computation tolerable. - -First, note that q must be odd and not congruent to 0, modulo 3. Thus, -q must be congruent to +/-1, modulo 6. Thus p = 2*q+1 must be -congruent to 2*1+1 = 3 or 2*-1+1 = -1 modulo 12. But p congruent to 3 -mod 12 would be divisible by 3, and not prime, so p must be congruent -to 11 mod 12. - -Thus, the initial search point t can first be increased until it is -congruent to 11 modulo 12. Searching from this point forward, only -every 12th number, t+12*i, needs to be considered. - -If it is desired to choose p so that 2 is a quadratic residue (meaning -that p is congruent to +/-1 modulo 8), then this additional constraint -can be met with no additional difficulty by beginning at the next -number which is congruent to 23 mod 24 and searching in steps of 24. -But in the following discussion, a step size of 12 is assumed. - -Then, a sieve is built for trial division by a number of small primes -for a range of following i values. For large primes, a large search -space is required, so a large sieve is desirable. The value used was -65536 bits (8K bytes). It may be necessary to rebuild the sieve -beginning at t+12*65536 if no suitable prime is found before then, but -this sieve is large enough that the refilling is infrequent and the -overhead is negligible. - -Initially, every position in the sieve is marked as a potential prime. -Then, for the small primes s from 5 through 65521, position i in the -sieve is marked as unsuitable if t+12*i is divisble by s, i.e. -definitely not prime. To do this cheaply, consider that t+12*i = 0 -(mod s) if i = -12^-1 * t (mod s). So finding t mod s, then 12^-1 (mod -s) and multiplying (mod s) will produce the first i value which is -known to be divisible by s, and then every s positions thereafter in -the sieve will be divisible. This does the equivalent of a great deal -of trial division with minimal effort. - -Positions in the sieve are also marked as as unsuitable if (t-1)/2+6*i -= 0 (mod s), because these positions will have (p-1)/2 divisible by s -and thus non-prime. This works similarly, and (t-1)/2 mod s can be -derived from t mod s without actually doing another full division. - -This sieve filters out all but 1/591 of the possible values of i as -obviously composite, leaving an expected 852 numbers to be checked by -stronger means before a suitable prime p is found. - -After these two sieving operations have removed all numbers from -consideration where p or q = (p-1)/2 have small divisors, the remaining -candidates are subjected to a fast optimized Fermat test, to the base 2, -once for p and once for q. This eliminates, for practical purposes, -all composite numbers. - -Special composite numbers can be chosen which pass this test and yet -are not primes - they are called pseudoprimes - but they are so rare in -the ranges considered that the chances of finding one without -deliberate search are utterly negligible. And the stating value for -the search was carefully chosen to have no hidden special properties. - -If p and q are found to be prime by this test, some extra confirmation -pseudoprimality tests are performed just to make sure of the conclusion -and p is returned as the result. diff --git a/libs/libzrtp/third_party/bnlib/test/primetest.c b/libs/libzrtp/third_party/bnlib/test/primetest.c deleted file mode 100644 index 0a1b475f0a..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/primetest.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 1994, 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * primetest.c - Test driver for prime generation. - */ - -#include "first.h" -#include <stdio.h> -#include <stdlib.h> /* For strtoul() */ - -#include "bn.h" -#include "bnprint.h" -#include "cputime.h" -#include "prime.h" -#include "random.h" /* Good random number generator */ -#include "noise.h" - -#include "kludge.h" - -#define bnPut(prompt, bn) bnPrint(stdout, prompt, bn, "\n") - -/* - * Generate a random bignum of a specified length, with the given - * high and low 8 bits. "High" is merged into the high 8 bits of the - * number. For example, set it to 0x80 to ensure that the number is - * exactly "bits" bits long (i.e. 2^(bits-1) <= bn < 2^bits). - * "Low" is merged into the low 8 bits. For example, set it to - * 1 to ensure that you generate an odd number. - */ -static int -genRandBn(struct BigNum *bn, unsigned bits, byte high, byte low) -{ - unsigned char buf[64]; - unsigned bytes; - unsigned l; - int err; - - bnSetQ(bn, 0); - - bytes = (bits+7) / 8; - l = bytes < sizeof(buf) ? bytes : sizeof(buf); - randBytes(buf, l); - - /* Mask off excess high bits */ - buf[0] &= 255 >> (-bits & 7); - /* Merge in specified high bits */ - buf[0] |= high >> (-bits & 7); - if (bits & 7) - buf[1] |= high << (bits & 7); - - for (;;) { - bytes -= l; - if (!bytes) /* Last word - merge in low bits */ - buf[l-1] |= low; - err = bnInsertBigBytes(bn, buf, bytes, l); - if (!bytes || err < 0) - break; - l = bytes < sizeof(buf) ? bytes : sizeof(buf); - randBytes(buf, l); - } - - memset(buf, 0, sizeof(buf)); - return err; -} - - -/* - * Generate a new RSA key, with the specified number of bits and - * public exponent. The high two bits of each prime are always - * set to make the number more difficult to factor by forcing the - * number into the high end of the range. - */ - -struct Progress { - FILE *f; - unsigned column; - unsigned wrap; -}; - -static int -primeProgress(void *arg, int c) -{ - struct Progress *p = arg; - if (++p->column > p->wrap) { - putc('\n', p->f); - p->column = 1; - } - putc(c, p->f); - fflush(p->f); - return 0; -} - -static int -primeTest(unsigned bits) -{ - int modexps = 0; - struct BigNum bn; /* Temporary */ - int i, j; - struct Progress progress; -#if CLOCK_AVAIL - timetype start, stop; - unsigned long curs, tots = 0; - unsigned curms, totms = 0; -#endif - progress.f = stdout; - progress.wrap = 78; - - bnBegin(&bn); - - /* Find p - choose a starting place */ - i = genRandBn(&bn, bits, 0x80, 1); - if (i < 0) - goto error; - - /* And search for primes */ - for (j = 0; j < 40; j++) { - progress.column = 0; -#if CLOCK_AVAIL - gettime(&start); -#endif - i = primeGen(&bn, 0, primeProgress, &progress, 0); - if (i < 0) - goto error; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - tots += curs = sec(stop); - totms += curms = msec(stop); -#endif - modexps += i; - putchar('\n'); /* Signal done */ - printf("%d modular exponentiations performed", i); -#if CLOCK_AVAIL - printf(" in %lu.%03u s", curs, curms); -#endif - putchar('\n'); - bnPut("n = ", &bn); - if (bnAddQ(&bn, 2) < 0) - goto error; - } - - bnEnd(&bn); - printf("Total %d modular exponentiations performed", modexps); -#if CLOCK_AVAIL - tots += totms/1000; - totms %= 1000; - printf(" in %lu.%03u s\n", tots, totms); - totms += 1000 * (tots % j); - tots /= j; - totms /= j; - tots += totms / 1000; - totms %= 1000; - printf("Average time: %lu.%03u s", tots, totms); -#endif - putchar('\n'); - - /* And that's it... success! */ - return 0; -error: - puts("\nError!"); - bnEnd(&bn); - return -1; -} - - -int -main(int argc, char **argv) -{ - unsigned long t; - char *p; - - if (argc < 2) { - fprintf(stderr, "Usage: %s <bits>...\n", argv[0]); - fputs("\ -This generates a random RSA key pair and prints its value. <bits>\n\ -is the size of the modulus to use.\n", stderr); - return 1; - } - - noise(); - bnInit(); - - while (--argc) { - t = strtoul(*++argv, &p, 0); - if (t < 17 || t > 65536 || *p) { - fprintf(stderr, "Illegal prime size: \"%s\"\n", - *argv); - return 1; - } - - primeTest((unsigned)t); - } - - return 0; -} diff --git a/libs/libzrtp/third_party/bnlib/test/pt.c b/libs/libzrtp/third_party/bnlib/test/pt.c deleted file mode 100644 index 798d27a118..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/pt.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 1994, 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * primetest.c - Test driver for prime generation. - */ - -#include "first.h" -#include <stdio.h> -#include <stdlib.h> /* For strtoul() */ - -#include "bn.h" -#include "bnprint.h" -#include "cputime.h" -#include "prime.h" -#include "noise.h" - -#include "kludge.h" - -#define bnPut(prompt, bn) bnPrint(stdout, prompt, bn, "\n") - -/* - * Generate a new RSA key, with the specified number of bits and - * public exponent. The high two bits of each prime are always - * set to make the number more difficult to factor by forcing the - * number into the high end of the range. - */ - -struct Progress { - FILE *f; - unsigned column; - unsigned wrap; -}; - -static int -primeProgress(void *arg, int c) -{ - struct Progress *p = arg; - if (++p->column > p->wrap) { - putc('\n', p->f); - p->column = 1; - } - putc(c, p->f); - fflush(p->f); - return 0; -} - -static int -hextoval(char c) -{ - if (c < '0') - return -1; - c -= '0'; - if (c < 10) - return c; - c -= 'A'-'0'; - c &= ~('a'-'A'); - if (c >= 0 && c < 6) - return c+10; - return -1; -} - -static int -stringToBn(struct BigNum *bn, char const *string) -{ - size_t len = strlen(string); - char buf; - int i, j; - - (void)bnSetQ(bn, 0); - - if (len & 1) { - i = hextoval(*string++); - if (i < 0) - return 0; - buf = i; - if (bnInsertBigBytes(bn, &buf, len/2, 1) < 0) - return -1; - } - len /= 2; - while (len--) { - i = hextoval(*string++); - if (i < 0) - return 0; - j = hextoval(*string++); - if (j < 0) - return 0; - buf = i*16 + j; - if (bnInsertBigBytes(bn, &buf, len, 1) < 0) - return -1; - } - return 1; /* Success */ -} - -static int -primeTest(char const *string) -{ - int modexps = 0; - struct BigNum bn; /* Temporary */ - int i, j; - struct Progress progress; -#if CLOCK_AVAIL - timetype start, stop; - unsigned long curs, tots = 0; - unsigned curms, totms = 0; -#endif - progress.f = stdout; - progress.wrap = 78; - - bnBegin(&bn); - - /* Find p - choose a starting place */ - i = stringToBn(&bn, string); - if (i < 1) { - if (i < 0) - goto error; - printf("Malformed string: \"%s\"\n", string); - bnEnd(&bn); - return 0; - } - - /* And search for primes */ - for (j = 0; j < 40; j++) { - progress.column = 0; -#if CLOCK_AVAIL - gettime(&start); -#endif - i = primeGen(&bn, 0, primeProgress, &progress, 0); - if (i < 0) - goto error; -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - tots += curs = sec(stop); - totms += curms = msec(stop); -#endif - modexps += i; - putchar('\n'); /* Signal done */ - printf("%d modular exponentiations performed", i); -#if CLOCK_AVAIL - printf(" in %lu.%03u s", curs, curms); -#endif - putchar('\n'); - bnPut("n = ", &bn); - if (bnAddQ(&bn, 2) < 0) - goto error; - } - - bnEnd(&bn); - printf("Total %d modular exponentiations performed", modexps); -#if CLOCK_AVAIL - tots += totms/1000; - totms %= 1000; - printf(" in %lu.%03u s\n", tots, totms); - totms += 1000 * (tots % j); - tots /= j; - totms /= j; - tots += totms / 1000; - totms %= 1000; - printf("Average time: %lu.%03u s", tots, totms); -#endif - putchar('\n'); - - /* And that's it... success! */ - return 1; -error: - puts("\nError!"); - bnEnd(&bn); - return -1; -} - -int -main(int argc, char **argv) -{ - if (argc < 2) { - fprintf(stderr, "Usage: %s <hex>...\n", argv[0]); - fputs("\ -This finds the next primes after the given hex strings.\n", stderr); - return 1; - } - - bnInit(); - - while (--argc) - primeTest(*++argv); - - return 0; -} diff --git a/libs/libzrtp/third_party/bnlib/test/random.c b/libs/libzrtp/third_party/bnlib/test/random.c deleted file mode 100644 index 1eef59f34b..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/random.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) 1993, 1994 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * Cryptographic random number generation. - */ - -#include "first.h" -#include <string.h> - -#include "kb.h" /* For kbGet() other stuff */ -#include "md5.h" -#include "noise.h" -#include "random.h" -#include "randpool.h" -#include "userio.h" - -#include "kludge.h" - -/* - * This code uses the randpool.c code to generate random numbers. - * That can be augmented with other techniques, such as the - * ANSI X9.17 generator, but the X9.17 generator uses a key-generating - * key which needs to be obtained from somewhere, and the location is - * not entirely clear. The randpool.c functions are entirely - * adequate; extra layers are for belt-and-suspenders security and - * compliance to standards. - * - * For generating long-lived secret keys, we go one more step: - * actually keep track of (an estimate of) the amount of entropy - * which is in the random number pool, and wait for events until - * the amount of entropy accumulated is enough to make all of the - * bits of the secret key truly random. Of course, the guarantees - * of cryptographic strength still apply even if this estimation - * is faulty. - */ - - -/* Get some random bytes */ -void -randBytes(byte *buf, unsigned len) -{ - randPoolGetBytes(buf, len); -} - -/* - * A handy utility for generating uniformly distributed random numbers - * in a small range. - */ -unsigned -randRange(unsigned range) -{ - unsigned div, r; - byte b[2]; - - if (range <= 1) - return 0; - - if (range <= 256) { - div = 256/range; - do { - randBytes(b, 1); - r = b[0]/div; - } while (r >= range); - } else { - div = (unsigned)(65536/range); - do { - randBytes(b, 2); - r = ((unsigned)b[0] << 8 | b[1])/div; - } while (r >= range); - } - b[0] = b[1] = 0; - return r; -} - -#ifdef UNIX /* Or we have popen() */ -/* - * Execute the command "string", adding the entropy from the data thus - * gethered to the random number pool. Because the pool is rather - * slow and we want to encourage the use of lots of data, rather than - * adding the data directly, the MD5 is taken and that is added to the - * pool. - */ -int -randSourceSet(char const *string, unsigned len, int pri) -{ - FILE *f; - struct MD5Context md5; - char buf[256]; - int i; - - (void)len; /* string is null-terminated */ - (void)pri; /* Use every argument, regardless of priority */ - - f = popen(string, "r"); - if (!f) - return -1; - MD5Init(&md5); - while ((i = fread(buf, 1, sizeof(buf), f)) > 0) - MD5Update(&md5, (unsigned char *)buf, i); - pclose(f); - MD5Final((unsigned char *)buf, &md5); - randPoolAddBytes((unsigned char *)buf, 16); - memset(buf, 0, sizeof(buf)); - return 0; -} -#endif - -/* - * True random bit handling - */ - -/* - * Truly random bits are difficult to get and must be carefully hoarded. - * These functions use the randpool.c code to store the entropy, and provide - * some bookkeeping on the count of bits of true (Shannon) entropy available - * in the pool. - * - * For generating ordinary session keys, "as much entropy as you've got" - * is good enough, and no accounting is done, except to get some entropy - * to generate the random number seed file if necessary. - * - * But for generating long-lived secret key components, extraordinary - * measures are called for. In addition to what may have been available - * from the random seed file, random data from timed keystrokes is - * accumulated until enough is available. - * - * An estimate of the number of bits of true (Shannon) entropy in the pool - * is kept in trueRandBits. This is incremented when timed keystrokes - * are available, and decremented when bits are explicitly consumed for - * some purpose or another. This counter is maintained here, scaled by - * FRACBITS to count fractional bits for thoroughness. (Thus, the name - * "trueRandBits" is a bit misleading, since it actually counts sixteenths - * of a bit, but I can't think of a better one.) - * - * randFlush is the pool-stirring function. It is also called to - * obliterate traces of old random bits after prime generation is - * completed. (Primes are the most carefully-guarded values in PGP.) - */ - -#define FRACBITS 4 -#define DERATING 0x28 /* 2.5 bits subtracted for derating */ -static word32 trueRandBits = 0; /* Bits of entropy in pool */ - -/* - * Ensure that the random numbers generated by prior calls to randBytes - * will never be recoverable from the contents of memory. This doesn't - * wipe memory to a fixed value (the entropy might come in handy for future - * operations), it just runs the generators forward enough that the previous - * state is irretrievable. - * - * This is called after prime generation, before the random data is saved - * out, so it is protecting prime data and is particularly paranoid. - */ -void -randFlush(void) -{ - byte buf[16]; - int i; - - for (i = 0; i < 3; i++) /* Zipper + Belt + Suspenders */ - randPoolStir(); /* Clean pseudo-random generator */ - memset(buf, 0, sizeof(buf)); - trueRandBits = 0; -} - -/* - * Given an event (typically a keystroke) coded by "event" at a random time, - * add all randomness to the random pool, compute a (conservative) estimate - * of the amount, add it to the pool, and return the amount of randomness. - * (The return value is just for informational purposes.) - * - * Double events are okay, but three in a row is considered - * suspicious and the randomness is counted as 0. - * - * As an extra precaution against key repeat or other very regular input - * data, the entropy extimate is derived not from the time interval measured, - * but from the minimum of it and the (absolute) difference between it and - * the previous time interval, i.e. the second-order delta. - */ -unsigned -randEvent(int event) -{ - static int event1 = 0, event2 = 0; /* Previous events */ - static word32 prevdelta; /* Previous delta */ - word32 delta; /* Time between last two events */ - unsigned cbits; /* Entropy estimate, in bits. */ - word32 t; /* Temprary value */ - int i; - - delta = noise(); - randPoolAddBytes((byte *)&event, sizeof(event)); - - /* - * Don't credit triple events with any entropy on the grounds that - * they're probably something periodic like key repeat. But remember - * the delta. - */ - if (event == event1 && event == event2) { - prevdelta = delta; - return 0; - } - - event2 = event1; - event1 = event; - - /* Compute second-order delta */ - t = (delta > prevdelta) ? delta - prevdelta : prevdelta - delta; - /* Remember current delta for next time */ - prevdelta = delta; - /* Find minimum of delta and second-order delta */ - if (delta > t) - delta = t; - - /* Avoid divide-by-zero errors below */ - if (!delta) - return 0; - - /* Count the number of bits of entropy available - integer log2. */ - cbits = 0; - i = 16; - t = 0xffffffff; - do { - t <<= i; - if (delta & t) - cbits += i; - else - delta <<= i; - } while (i >>= 1); - - /* - * At this point, delta is normalized and has its high bit set. - * Now count fractional bits, using binary logarithm algorithm - */ - for (i = 0; i < FRACBITS; i++) { - cbits <<= 1; - delta >>= 16; - delta *= delta; - if (delta & 0x80000000) - cbits++; - else - delta <<= 1; - } - - if (cbits <= DERATING) - return 0; /* nothing */ - cbits -= DERATING; - trueRandBits += cbits; - if (trueRandBits > RANDPOOLBITS<<FRACBITS) - trueRandBits = RANDPOOLBITS<<FRACBITS; - - return cbits; -} - -/* - * Performs an accumulation of random bits. As long as there are - * fewer bits in the buffer than are needed, prompt for more. - * (kbGet is known to call randEvent() which increments trueRandBits.) - */ -void -randAccum(unsigned count) -{ - word32 randbits = trueRandBits; - - noise(); /* Establish a baseline for timing comparisons */ - - if (count > RANDPOOLBITS) - count = RANDPOOLBITS; - - if (randbits>>FRACBITS >= count) - return; - - userPrintf("\n\ -We need to generate %u random bits. This is done by measuring the\n\ -time intervals between your keystrokes. Please enter some random text\n\ -on your keyboard until you hear the beep:\n", count - (randbits>>FRACBITS)); - - kbCbreak(); - - do { - /* display counter to show progress */ - userPrintf(("\r%4u "), count-(unsigned)(randbits>>FRACBITS)); - userFlush(); /* ensure screen update */ - - kbFlush(0); /* Typeahead is illegal */ - (void)kbGet(); /* Wait for next char */ - - /* Print flag indicating acceptance (or not) */ - userPutc(trueRandBits == randbits ? '?' : '.'); - randbits = trueRandBits; - } while (randbits>>FRACBITS < count); - - /* Do final display update */ - userPuts(("\r 0 *")); - userPuts("\a -Enough, thank you.\n"); - - /* Do an extra-thorough flush to absorb extra typing. */ - kbFlush(1); - - kbNorm(); -} diff --git a/libs/libzrtp/third_party/bnlib/test/random.h b/libs/libzrtp/third_party/bnlib/test/random.h deleted file mode 100644 index 1a472edc09..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/random.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#include "usuals.h" - -int randSourceSet(char const *string, unsigned len, int pri); - -void randBytes(byte *dest, unsigned len); -unsigned randRange(unsigned range); - -unsigned randEvent(int event); -void randFlush(void); - -void randAccum(unsigned count); diff --git a/libs/libzrtp/third_party/bnlib/test/randpool.c b/libs/libzrtp/third_party/bnlib/test/randpool.c deleted file mode 100644 index f8d4b986e6..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/randpool.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 1993, 1994 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * True random number computation and storage - * - */ - -#include "first.h" -#include <stdlib.h> -#include <string.h> - -#include "md5.h" -#include "randpool.h" -#include "usuals.h" - -/* This is a parameter of the MD5 algorithm */ -#define RANDKEYWORDS 16 - -/* The pool must be a multiple of the 16-byte (128-bit) MD5 block size */ -#define RANDPOOLWORDS (((RANDPOOLBITS+127) & ~127) >> 5) - -#if RANDPOOLWORDS <= RANDKEYWORDS -#error Random pool too small - please increase RANDPOOLBITS in randpool.h -#endif - -/* Must be word-aligned, so make it words. Cast to bytes as needed. */ -static word32 randPool[RANDPOOLWORDS]; /* Random pool */ -static word32 randKey[RANDKEYWORDS]; /* Random pool */ -static unsigned randKeyAddPos = 0; /* Position to add to */ -static unsigned randPoolGetPos = 16; /* Position to get from */ - -/* - * Destroys already-used random numbers. Ensures no sensitive data - * remains in memory that can be recovered later. This is also - * called to "stir in" newly acquired environmental noise bits before - * removing any random bytes. - * - * The transformation is carried out by "encrypting" the data in CFB - * mode with MD5 as the block cipher. Then, to make certain the stirring - * operation is strictly one-way, we destroy the key, getting 64 bytes - * from the beginning of the pool and using them to reinitialize the - * key. These bytes are not returned by randPoolGetBytes(). - * - * The key for the stirring operation is the XOR of some bytes from the - * previous pool contents (not provably necessary, but it produces uniformly - * distributed keys, which "feels better") and the newly added raw noise, - * which will have a profound effect on every bit in the pool. - * - * To make this useful for pseudo-random (that is, repeatable) operations, - * the MD5 transformation is always done with a consistent byte order. - * MD5Transform itself works with 32-bit words, not bytes, so the pool, - * usually an array of bytes, is transformed into an array of 32-bit words, - * taking each group of 4 bytes in big-endian order. At the end of the - * stirring, the transformation is reversed. - */ -void -randPoolStir(void) -{ - int i; - word32 iv[4]; - - /* Convert to word32s for stirring operation */ - byteSwap(randPool, RANDPOOLWORDS); - byteSwap(randKey, RANDKEYWORDS); - - /* Start IV from last block of randPool */ - memcpy(iv, randPool+RANDPOOLWORDS-4, sizeof(iv)); - - /* CFB pass */ - for (i = 0; i < RANDPOOLWORDS; i += 4) { - MD5Transform(iv, randKey); - iv[0] = randPool[i ] ^= iv[0]; - iv[1] = randPool[i+1] ^= iv[1]; - iv[2] = randPool[i+2] ^= iv[2]; - iv[3] = randPool[i+3] ^= iv[3]; - } - - /* Wipe iv from memory */ - iv[3] = iv[2] = iv[1] = iv[0] = 0; - - /* Convert randPool back to bytes for further use */ - byteSwap(randPool, RANDPOOLWORDS); - - /* Get new key */ - memcpy(randKey, randPool, sizeof(randKey)); - - /* Set up pointers for future addition or removal of random bytes */ - randKeyAddPos = 0; - randPoolGetPos = sizeof(randKey); -} - -/* - * Make a deposit of information (entropy) into the pool. This is done by - * XORing them into the key which is used to encrypt the pool. Before any - * bytes are retrieved from the pool, the altered key will be used to encrypt - * the whole pool, causing all bits in the pool to depend on the new - * information. - * - * The bits deposited need not have any particular distribution; the stirring - * operation transforms them to uniformly-distributed bits. - */ -void -randPoolAddBytes(byte const *buf, unsigned len) -{ - byte *p = (byte *)randKey + randKeyAddPos; - unsigned t = sizeof(randKey) - randKeyAddPos; - - while (len > t) { - len -= t; - while (t--) - *p++ ^= *buf++; - randPoolStir(); /* sets randKeyAddPos to 0 */ - p = (byte *)randKey; - t = sizeof(randKey); - } - - if (len) { - randKeyAddPos += len; - do - *p++ ^= *buf++; - while (--len); - randPoolGetPos = sizeof(randPool); /* Force stir on get */ - } -} - -/* - * Withdraw some bits from the pool. Regardless of the distribution of the - * input bits, the bits returned are uniformly distributed, although they - * cannot, of course, contain more Shannon entropy than the input bits. - */ -void -randPoolGetBytes(byte *buf, unsigned len) -{ - unsigned t; - - while (len > (t = sizeof(randPool) - randPoolGetPos)) { - memcpy(buf, (byte *)randPool+randPoolGetPos, t); - buf += t; - len -= t; - randPoolStir(); - } - - if (len) { - memcpy(buf, (byte *)randPool+randPoolGetPos, len); - randPoolGetPos += len; - buf += len; - } -} - -byte -randPoolGetByte(void) -{ - if (randPoolGetPos == sizeof(randPool)) - randPoolStir(); - - return ((byte *)randPool)[randPoolGetPos++]; -} diff --git a/libs/libzrtp/third_party/bnlib/test/randpool.h b/libs/libzrtp/third_party/bnlib/test/randpool.h deleted file mode 100644 index b4a3f26dc5..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/randpool.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#include "usuals.h" - -/* Set this to whatever you need (must be > 512) */ -#define RANDPOOLBITS 3072 - -void randPoolStir(void); -void randPoolAddBytes(byte const *buf, unsigned len); -void randPoolGetBytes(byte *buf, unsigned len); -byte randPoolGetByte(void); diff --git a/libs/libzrtp/third_party/bnlib/test/randtest.c b/libs/libzrtp/third_party/bnlib/test/randtest.c deleted file mode 100644 index f15ca4b27c..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/randtest.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * randtest.c - FIPS 140 random number tests. - * This performs all the tests required by the FIPS 140 - * standard on the raw random number pool. If any fail, - * with at least one bit of entropy in the input, the random - * number generator is to be considered broken. - * - * The FIPS parameters are very loose, to guarantee that a - * system will not, in practice, declare itself broken during - * normal operation. The results from any given run should - * be *much* closer to centered in the allowed ranges. - * - * E.g. The expected sum of 20000 random bits is 10000, - * with a standard deviation of 1/12 * sqrt(20000) = 11.785 - * the deviation at which an error is signalled of 346 from - * this average is 29.359 standard deviations out. *Very* unlikely. - */ -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> /* For strtoul */ -#include <string.h> /* For memset */ -#include "kludge.h" - -#include "random.h" /* Good random number generator */ - -/* Number of bits to check */ -#define NBITS 20000 -#define NBYTES ((NBITS+7)/8) - -#define MAXRUNSTAT 20 /* Longest run accumulated */ -#define MAXRUNCHECK 6 /* Longest run checked */ -#define MAXRUNTOOLONG 34 /* A run this long is an error */ - -static unsigned -pokerstat(unsigned char const buf[NBYTES], unsigned counts[16]) -{ - unsigned i; - unsigned char c; - - for (i = 0; i < 16; i++) - counts[i] = 0; - - for (i = 0; i < NBYTES; i++) { - c = buf[i]; - counts[c & 15]++; - counts[c>>4]++; - } - - return counts[15] * 4 + - (counts[14] + counts[13] + counts[11] + counts[7]) * 3 + - (counts[12] + counts[10] + counts[9] + - counts[6] + counts[5] + counts[3]) * 2 + - counts[8] + counts[4] + counts[2] + counts[1]; -} - -static unsigned -countrunsbig(unsigned char const buf[NBYTES], - unsigned zeros[MAXRUNSTAT], unsigned ones[MAXRUNSTAT]) -{ - unsigned i; - unsigned char c, mask; - unsigned char state; /* All 0s or all 1s */ - unsigned runlength; - unsigned maxrun = 0; - - /* Initialize to zero */ - for (i = 0; i < MAXRUNSTAT; i++) { - zeros[i] = 0; - ones[i] = 0; - } - - /* Start with a run of length 0 matching the first bit */ - state = (buf[0] & 0x80) ? 0xff : 0; - runlength = 0; - - for (i = 0; i < NBYTES; i++) { - c = buf[i]; - mask = 0x80; - do { - if ((c ^ state) & mask) { - /* Change of state; update counters */ - if (maxrun < runlength) - maxrun = runlength; - if (runlength > MAXRUNSTAT) - runlength = MAXRUNSTAT; - (state ? ones : zeros)[runlength-1]++; - state = ~state; - runlength = 0; - } - runlength++; - } while (mask >>= 1); - } - - /* Add in final run */ - if (maxrun < runlength) - maxrun = runlength; - if (runlength > MAXRUNSTAT) - runlength = MAXRUNSTAT; - (state ? ones : zeros)[runlength-1]++; - - return maxrun; -} - -static unsigned -countrunslittle(unsigned char const buf[NBYTES], - unsigned zeros[MAXRUNSTAT], unsigned ones[MAXRUNSTAT]) -{ - unsigned i; - unsigned char c, mask; - unsigned char state; /* All 0s or all 1s */ - unsigned runlength; - unsigned maxrun = 0; - - /* Initialize to zero */ - for (i = 0; i < MAXRUNSTAT; i++) { - zeros[i] = 0; - ones[i] = 0; - } - - /* Start with a run of length 0 matching the first bit */ - state = (buf[0] & 1) ? 0xff : 0; - runlength = 0; - - for (i = 0; i < NBYTES; i++) { - c = buf[i]; - mask = 1; - do { - if ((c ^ state) & mask) { - /* Change of state; update counters */ - if (maxrun < runlength) - maxrun = runlength; - if (runlength > MAXRUNSTAT) - runlength = MAXRUNSTAT; - (state ? ones : zeros)[runlength-1]++; - state = ~state; - runlength = 0; - } - runlength++; - } while ((mask <<= 1) & 0xff); - } - - /* Add in final run */ - if (maxrun < runlength) - maxrun = runlength; - if (runlength > MAXRUNSTAT) - runlength = MAXRUNSTAT; - (state ? ones : zeros)[runlength-1]++; - - return maxrun; -} - -static int -checkruns(unsigned const zeros[MAXRUNSTAT], unsigned const ones[MAXRUNSTAT], - unsigned maxrun) -{ - int passed, numfailed; - unsigned i, j; - unsigned sumones, sumzeros; - static unsigned const lowlimit[MAXRUNCHECK] = - { 2267, 1079, 502, 223, 90, 90 }; - static unsigned const highlimit[MAXRUNCHECK] = - { 2733, 1421, 748, 402, 223, 223 }; - - numfailed = 0; - - j = MAXRUNSTAT; - while (j--) { - if (zeros[j] || ones[j]) - break; - } - - for (i = 0; i < MAXRUNCHECK - 1; i++) { - passed = (lowlimit[i] < zeros[i]) && (zeros[i] < highlimit[i]); - numfailed += !passed; - printf("%2u zeros: %4u <%5u < %4u: %s\t", - i+1, lowlimit[i], zeros[i], highlimit[i], - passed ? "Pass " : "FAIL *"); - - passed = (lowlimit[i] < ones[i]) && (ones[i] < highlimit[i]); - numfailed += !passed; - printf("%2u ones: %4u <%5u < %4u: %s\n", - i+1, lowlimit[i], ones[i], highlimit[i], - passed ? "Pass " : "FAIL *"); - } - for (sumzeros = 0, sumones = 0; i <= j; i++) { - printf("%2u zeros: %4u \t\t", - i+1, zeros[i]); - sumzeros += zeros[i]; - printf("%2u ones: %4u\n", i+1, ones[i]); - sumones += ones[i]; - } - - i = MAXRUNCHECK-1; - passed = (lowlimit[i] < sumzeros) && (sumzeros < highlimit[i]); - numfailed += !passed; - printf("%u+ zeros: %4u < %4u < %4u: %s\t", - i+1, lowlimit[i], sumzeros, highlimit[i], - passed ? "Pass " : "FAIL *"); - passed = (lowlimit[i] < sumones) && (sumones < highlimit[i]); - numfailed += !passed; - printf("%u+ zeros: %4u < %4u < %4u: %s\n", - i+1, lowlimit[i], sumones, highlimit[i], - passed ? "Pass " : "FAIL *"); - - passed = maxrun < MAXRUNTOOLONG; - numfailed += !passed; - printf("Longest run: %u < %u: %s\n", maxrun, (unsigned)MAXRUNTOOLONG, - passed ? "Pass " : "FAIL *"); - - return numfailed; -} - -int -main(int argc, char **argv) -{ - unsigned char buf[NBYTES]; - unsigned poker[16]; - unsigned onebits; - unsigned runzero[MAXRUNSTAT], runone[MAXRUNSTAT]; - unsigned maxrun; - unsigned long t; - unsigned i; - int passed; - int numfailed = 0; - char *p; - - if (argc != 2) { - fprintf(stderr, "Usage: %s <bits>\n" -"Accumulate random bits and then do randomness tests on the RNG output.\n", - argv[0]); - return 1; - } - t = strtoul(argv[1], &p, 0); - if (t > 3072 || *p) { - fprintf(stderr, "Illegal number of bits: \"%s\"\n", argv[1]); - return 1; - } - randAccum(t); - - randBytes(buf, sizeof(buf)); - onebits = pokerstat(buf, poker); - - passed = (9654 < onebits) && (onebits < 10346); - numfailed += !passed; - printf("\nNumber of one bits: 9654 < %u < 10346: %s\n", onebits, - passed ? "Pass " : "FAIL *"); - /* - * Original test asks for - * X = (16/5000) * sum(poker[i]^2, i = 0..15) - 5000, - * and requires that 1.03 < X < 57.4. - * This test uses t = 5000/16 * X, and requires that - * 321.875 < t < 17937.5. Note that if the distribution - * were totally flat, t would be 0, which is *also* bad. - */ - t = 0; - for (i = 0; i < 16; i++) { - printf("poker[%u%u%u%u] =%4u %c", - i>>3, i>>2 & 1, i>>1 & 1, i & 1, - poker[i],(~i & 3) ? ' ' : '\n'); - t += (unsigned long)poker[i] * poker[i]; - } - t -= 5000ul * 5000 / 16; - passed = (321 < t) && (t < 17938); - numfailed += !passed; - printf("Poker parameter: 321.875 < %lu < 17937.5: %s\n", t, - passed ? "Pass " : "FAIL *"); - - /* - * Next, we're asked to count runs of consecutive ones and - * zeroes. The shortest possible run is of length 1. - * The longest, 20000. Since the byte ordering is not defined, - * do it both ways! This tallies the run lengths of all - * zeros and all ones, giving totals for the short runs - * and the longest run of either size encountered. - */ - printf("\nBig-endian run tests:\n"); - maxrun = countrunsbig(buf, runzero, runone); - numfailed += checkruns(runzero, runone, maxrun); - - printf("\nLittle-endian run tests:\n"); - maxrun = countrunslittle(buf, runzero, runone); - numfailed += checkruns(runzero, runone, maxrun); - - /* - * Tests are: - * 1 - Number of one bits - * 1 - Poker test - * 12 - Big-endian run length tests - * 1 - Big-endian maximum run length test - * 12 - Little-endian run length tests - * 1 - Little-endian maximum run length test - */ - printf("\nOut of 28 tests, %d tests failed.\n", numfailed); - - return numfailed; -} diff --git a/libs/libzrtp/third_party/bnlib/test/rsaglue.c b/libs/libzrtp/third_party/bnlib/test/rsaglue.c deleted file mode 100644 index 66175ee6c8..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/rsaglue.c +++ /dev/null @@ -1,471 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * rsaglue.c - The interface between bignum math and RSA operations. - * This layer's primary reason for existence is to allow adaptation - * to other RSA math libraries for legal reasons. - */ - -#include "first.h" - -#include "bn.h" - -#include "keys.h" -#include "random.h" -#include "rsaglue.h" -#include "usuals.h" - -/*#define BNDEBUG 1*/ - -#if BNDEBUG -/* Some debugging hooks which have been left in for now. */ -#include "bn/bnprint.h" -#define bndPut(prompt, bn) bnPrint(stdout, prompt, bn, "\n") -#define bndPrintf printf -#else -#define bndPut(prompt, bn) ((void)(prompt),(void)(bn)) -#define bndPrintf(x) (void)0 -#endif - - -/* - * This returns TRUE if the key is too big, returning the - * maximum number of bits that the library can accept. It - * is used if you want to use something icky from RSADSI, whose - * code is known to have satatic limits on key sizes. (BSAFE 2.1 - * advertises 2048-bit key sizes. It lies. It's talking about - * conventional RC4 keys, whicah are useless to make anything like - * that large. RSA keys are limited to 1024 bits. - */ -int -rsaKeyTooBig(struct PubKey const *pub, struct SecKey const *sec) -{ - (void)pub; - (void)sec; - return 0; /* Never too big! */ -} - -/* - * Fill the given bignum, from bytes high-1 through low (where 0 is - * the least significant byte), with non-zero random data. - */ -static int -randomPad(struct BigNum *bn, unsigned high, unsigned low) -{ - unsigned i, l; - byte padding[64]; /* This can be any size (>0) whatsoever */ - - high -= low; - while (high) { - l = high < sizeof(padding) ? high : sizeof(padding); - randBytes(padding, l); - for (i = 0; i < l; i++) { /* Replace all zero bytes */ - while(padding[i] == 0) - randBytes(padding+i, 1); - } - high -= l; - if (bnInsertBigBytes(bn, padding, high+low, l) < 0) - return RSAGLUE_NOMEM; - } - - memset(padding, 0, sizeof(padding)); - return 0; -} - -/* - * Fill the given bignum, from bytes high-1 through low (where 0 is - * the least significant byte), with all ones (0xFF) data. - */ -static int -onesPad(struct BigNum *bn, unsigned high, unsigned low) -{ - unsigned l; - static byte const padding[] = { - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255 - }; - - high -= low; - while (high) { - l = high < sizeof(padding) ? high : sizeof(padding); - high -= l; - if (bnInsertBigBytes(bn, padding, high+low, l) < 0) - return RSAGLUE_NOMEM; - } - return 0; -} - -/* - * Wrap a PKCS type 2 wrapper around some data and RSA encrypt it. - * If the modulus is n bytes long, with the most significant byte - * being n-1 and the least significant, 0, the wrapper looks like: - * - * Position Value Function - * n-1 0 This is needed to ensure that the padded number - * is less than the modulus. - * n-2 2 The padding type (non-zero random). - * n-3..len+1 ??? Non-zero random padding bytes to "salt" the - * output and prevent duplicate plaintext attacks. - * len 0 Zero byte to mark the end of the padding - * len-1..0 data Supplied payload data. - * - * There really should be several bytes of padding, although this - * routine will not fail to encrypt unless it will not fit, even - * with no padding bytes. - */ - -static byte const encryptedType = 2; - -int -rsaPublicEncrypt(struct BigNum *bn, byte const *in, unsigned len, - struct PubKey const *pub) -{ - unsigned bytes = (bnBits(&pub->n)+7)/8; - - if (len+3 > bytes) - return RSAGLUE_TOOSMALL; /* Won't fit! */ - - /* Set the entire number to 0 to start */ - (void)bnSetQ(bn, 0); - - if (bnInsertBigBytes(bn, &encryptedType, bytes-2, 1) < 0) - return RSAGLUE_NOMEM; - if (randomPad(bn, bytes-2, len+1) < 0) - return RSAGLUE_NOMEM; - - if (bnInsertBigBytes(bn, in, 0, len) < 0) - return RSAGLUE_NOMEM; -bndPrintf("RSA encrypting.\n"); -bndPut("plaintext = ", bn); - return bnExpMod(bn, bn, &pub->e, &pub->n); -} - -/* - * This performs a modular exponentiation using the Chinese Remainder - * Algorithm when the modulus is known to have two relatively prime - * factors n = p * q, and u = p^-1 (mod q) has been precomputed. - * - * The chinese remainder algorithm lets a computation mod n be performed - * mod p and mod q, and the results combined. Since it takes - * (considerably) more than twice as long to perform modular exponentiation - * mod n as it does to perform it mod p and mod q, time is saved. - * - * If x is the desired result, let xp and xq be the values of x mod p - * and mod q, respectively. Obviously, x = xp + p * k for some k. - * Taking this mod q, xq == xp + p*k (mod q), so p*k == xq-xp (mod q) - * and k == p^-1 * (xq-xp) (mod q), so k = u * (xq-xp mod q) mod q. - * After that, x = xp + p * k. - * - * Another savings comes from reducing the exponent d modulo phi(p) - * and phi(q). Here, we assume that p and q are prime, so phi(p) = p-1 - * and phi(q) = q-1. - */ -static int -bnExpModCRA(struct BigNum *x, struct BigNum const *d, - struct BigNum const *p, struct BigNum const *q, struct BigNum const *u) -{ - struct BigNum xp, xq, k; - int i; - -bndPrintf("Performing CRA\n"); -bndPut("x = ", x); -bndPut("p = ", p); -bndPut("q = ", q); -bndPut("d = ", d); -bndPut("u = ", u); - - bnBegin(&xp); - bnBegin(&xq); - bnBegin(&k); - - /* Compute xp = (x mod p) ^ (d mod p-1) mod p */ - if (bnCopy(&xp, p) < 0) /* First, use xp to hold p-1 */ - goto fail; - (void)bnSubQ(&xp, 1); /* p > 1, so subtracting is safe. */ - if (bnMod(&k, d, &xp) < 0) /* Use k to hold the exponent */ - goto fail; -bndPut("d mod p-1 = ", &k); - if (bnMod(&xp, x, p) < 0) /* Now xp = (x mod p) */ - goto fail; -bndPut("x mod p = ", &xp); - if (bnExpMod(&xp, &xp, &k, p) < 0) /* xp = (x mod p)^k mod p */ - goto fail; -bndPut("xp = x^d mod p = ", &xp); - - /* Compute xq = (x mod q) ^ (d mod q-1) mod q */ - if (bnCopy(&xq, q) < 0) /* First, use xq to hold q-1 */ - goto fail; - (void)bnSubQ(&xq, 1); /* q > 1, so subtracting is safe. */ - if (bnMod(&k, d, &xq) < 0) /* Use k to hold the exponent */ - goto fail; -bndPut("d mod q-1 = ", &k); - if (bnMod(&xq, x, q) < 0) /* Now xq = (x mod q) */ - goto fail; -bndPut("x mod q = ", &xq); - if (bnExpMod(&xq, &xq, &k, q) < 0) /* xq = (x mod q)^k mod q */ - goto fail; -bndPut("xq = x^d mod q = ", &xq); - - i = bnSub(&xq, &xp); -bndPut("xq - xp = ", &xq); -bndPrintf(("With sign %d\n", i)); - if (i < 0) - goto fail; - if (i) { - /* - * Borrow out - xq-xp is negative, so bnSub returned - * xp-xq instead, the negative of the true answer. - * Add q back (which is subtracting from the negative) - * until the sign flips again. If p is much greater - * than q, this step could take annoyingly long. - * PGP requires that p < q, so it'll only happen once. - * You could get this stuck in a very lengthy loop by - * feeding this function a p >> q, but it seems fair - * to assume that secret keys are not constructed - * maliciously. - * - * If this becomes a concern, you can fix it up with a - * bnMod. (But watch out for the case that the correct - * answer is zero!) - */ - do { - i = bnSub(&xq, q); -bndPut("xq - xp mod q = ", &xq); - if (i < 0) - goto fail; - } while (!i); - } - - /* Compute k = xq * u mod q */ - if (bnMul(&k, u, &xq) < 0) - goto fail; -bndPut("(xq-xp) * u = ", &k); - if (bnMod(&k, &k, q) < 0) - goto fail; -bndPut("k = (xq-xp)*u % q = ", &k); - -#if BNDEBUG /* @@@ DEBUG - do it the slow way for comparison */ - if (bnMul(&xq, p, q) < 0) - goto fail; -bndPut("n = p*q = ", &xq); - if (bnExpMod(x, x, d, &xq) < 0) - goto fail; - if (bnCopy(&xq, x) < 0) - goto fail; -bndPut("x^d mod n = ", &xq); -#endif - - /* Now x = k * p + xp is the final answer */ - if (bnMul(x, &k, p) < 0) - goto fail; -bndPut("k * p = ", x); - if (bnAdd(x, &xp) < 0) - goto fail; -bndPut("k*p + xp = ", x); -#if BNDEBUG - if (bnCmp(x, &xq) != 0) { -bndPrintf(("Nasty!!!\n")); - goto fail; - } - bnSetQ(&k, 17); - bnMul(&xp, p, q); - bnExpMod(&xq, &xq, &k, &xp); -bndPut("x^17 mod n = ", &xq); -#endif - bnEnd(&xp); - bnEnd(&xq); - bnEnd(&k); - return 0; - -fail: - bnEnd(&xp); - bnEnd(&xq); - bnEnd(&k); - return RSAGLUE_NOMEM; -} - -/* - * This does an RSA signing operation, which is very similar, except - * that the padding differs. The type is 1, and the padding is all 1's - * (hex 0xFF). - * - * To summarize, the format is: - * - * Position Value Function - * n-1 0 This is needed to ensure that the padded number - * is less than the modulus. - * n-2 1 The padding type (all ones). - * n-3..len+1 255 All ones padding to ensure signatures are rare. - * len 0 Zero byte to mark the end of the padding - * len-1..0 data The payload - * - * - * The reason for the all 1's padding is an extra consistency check. - * A randomly invented signature will not decrypt to have the long - * run of ones necessary for acceptance. - * - * Oh... the public key isn't needed to decrypt, but it's passed in - * because a different glue library may need it for some reason. - */ -static const byte signedType = 1; - -int -rsaPrivateEncrypt(struct BigNum *bn, byte const *in, unsigned len, - struct PubKey const *pub, struct SecKey const *sec) -{ - unsigned bytes = (bnBits(&pub->n)+7)/8; - - /* Set the entire number to 0 to start */ - (void)bnSetQ(bn, 0); - - if (len+3 > bytes) - return RSAGLUE_TOOSMALL; /* Won't fit */ - if (bnInsertBigBytes(bn, &signedType, bytes-2, 1) < 0) - return RSAGLUE_NOMEM; - if (onesPad(bn, bytes-2, len+1) < 0) - return RSAGLUE_NOMEM; - if (bnInsertBigBytes(bn, in, 0, len) < 0) - return RSAGLUE_NOMEM; - -bndPrintf(("RSA signing.\n")); -bndPut("plaintext = ", bn); - return bnExpModCRA(bn, &sec->d, &sec->p, &sec->q, &sec->u); -} - -/* - * Searches bytes, beginning with start-1 and progressing to 0, - * until one that is not 0xff is found. The idex of the last 0xff - * byte is returned (or start if start-1 is not 0xff.) - */ -static unsigned -bnSearchNonOneFromHigh(struct BigNum const *bn, unsigned start) -{ - byte buf[16]; /* Size is arbitrary */ - unsigned l; - unsigned i; - - while (start) { - l = start < sizeof(buf) ? start : sizeof(buf); - start -= l; - bnExtractBigBytes(bn, buf, start, l); - for (i = 0; i < l; i++) { - if (buf[i] != 0xff) { - memset(buf, 0, sizeof(buf)); - return start + l - i; - } - } - } - /* Nothing found */ - memset(buf, 0, sizeof(buf)); - return 0; -} - -/* - * Decrypt a message with a public key. - * These destroy (actually, replace with a decrypted version) the - * input bignum bn. - * - * Performs an RSA signature check. Returns a prefix of the unwrapped - * data in the given buf. Returns the length of the untruncated - * data, which may exceed "len". Returns <0 on error. - */ -int -rsaPublicDecrypt(byte *buf, unsigned len, struct BigNum *bn, - struct PubKey const *pub) -{ - byte tmp[1]; - unsigned bytes; - -bndPrintf(("RSA signature checking.\n")); - if (bnExpMod(bn, bn, &pub->e, &pub->n) < 0) - return RSAGLUE_NOMEM; -bndPut("decrypted = ", bn); - bytes = (bnBits(&pub->n)+7)/8; - - bnExtractBigBytes(bn, tmp, bytes-2, 2); - if (tmp[0] != 0 || tmp[1] != signedType) { - memset(tmp, 0, 2); - return RSAGLUE_CORRUPT; - } - - bytes = bnSearchNonOneFromHigh(bn, bytes-2); - if (bytes < 1) - return RSAGLUE_CORRUPT; - bytes--; - bnExtractBigBytes(bn, tmp, bytes, 1); - if (tmp[0] != 0) { - tmp[0] = 0; - return RSAGLUE_CORRUPT; - } - /* Note: tmp isn't sensitive any more because its a constant! */ - /* Success! Return the data */ - if (len > bytes) - len = bytes; - bnExtractBigBytes(bn, buf, bytes-len, len); - return bytes; -} - - -/* - * Searches bytes, beginning with start-1 and progressing to 0, - * until finding one that is zero, or the end of the array. - * The index of the last non-zero byte is returned (0 if the array - * is all non-zero, or start if start-1 is zero). - */ -static unsigned -bnSearchZeroFromHigh(struct BigNum const *bn, unsigned start) -{ - byte buf[16]; /* Size is arbitrary */ - unsigned l; - unsigned i; - - while (start) { - l = start < sizeof(buf) ? start : sizeof(buf); - start -= l; - bnExtractBigBytes(bn, buf, start, l); - for (i = 0; i < l; i++) { - if (buf[i] == 0) { - memset(buf, 0, sizeof(buf)); - return start + l - i; - } - } - } - /* Nothing found */ - memset(buf, 0, sizeof(buf)); - return 0; -} - -/* - * Performs an RSA decryption. Returns a prefix of the unwrapped - * data in the given buf. Returns the length of the untruncated - * data, which may exceed "len". Returns <0 on error. - */ -int -rsaPrivateDecrypt(byte *buf, unsigned len, struct BigNum *bn, - struct PubKey const *pub, struct SecKey const *sec) -{ - unsigned bytes; - byte tmp[2]; - -bndPrintf(("RSA decrypting\n")); - if (bnExpModCRA(bn, &sec->d, &sec->p, &sec->q, &sec->u) < 0) - return RSAGLUE_NOMEM; -bndPut("decrypted = ", bn); - bytes = (bnBits(&pub->n)+7)/8; - - bnExtractBigBytes(bn, tmp, bytes-2, 2); - if (tmp[0] != 0 || tmp[1] != 2) { - memset(tmp, 0, 2); - return RSAGLUE_CORRUPT; - } - - bytes = bnSearchZeroFromHigh(bn, bytes-2); - if (bytes-- == 0) - return RSAGLUE_CORRUPT; - - if (len > bytes) - len = bytes; - bnExtractBigBytes(bn, buf, bytes-len, len); - return bytes; -} diff --git a/libs/libzrtp/third_party/bnlib/test/rsaglue.h b/libs/libzrtp/third_party/bnlib/test/rsaglue.h deleted file mode 100644 index b776fd5a2e..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/rsaglue.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * rsaglue.h - RSA encryption and decryption - */ -#ifndef RSAGLUE_H -#define RSAGLUE_H - -struct PubKey; -struct SecKey; -struct BigNum; -#include "usuals.h" - -#define RSAGLUE_NOMEM -1 /* Ran out of memory */ -#define RSAGLUE_TOOBIG -2 /* Key too big (currently impossible) */ -#define RSAGLUE_TOOSMALL -3 /* Key too small (encryption only) */ -#define RSAGLUE_CORRUPT -4 /* Decrypted data corrupt (decrypt only) */ -#define RSAGLUE_UNRECOG -5 /* Unrecognized data (decrypt only) */ - -/* Declarations */ -int rsaKeyTooBig(struct PubKey const *pub, struct SecKey const *sec); - -int -rsaPublicEncrypt(struct BigNum *bn, byte const *in, unsigned len, - struct PubKey const *pub); -int -rsaPrivateEncrypt(struct BigNum *bn, byte const *in, unsigned len, - struct PubKey const *pub, struct SecKey const *sec); -int -rsaPublicDecrypt(byte *buf, unsigned len, struct BigNum *bn, - struct PubKey const *pub); -int -rsaPrivateDecrypt(byte *buf, unsigned len, struct BigNum *bn, - struct PubKey const *pub, struct SecKey const *sec); - -#endif /* !RSAGLUE_H */ diff --git a/libs/libzrtp/third_party/bnlib/test/rsatest.c b/libs/libzrtp/third_party/bnlib/test/rsatest.c deleted file mode 100644 index 8a1c1eec32..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/rsatest.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (c) 1994, 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * rsatest.c - Test driver for RSA key generation. - */ - -#include "first.h" -#include <stdio.h> -#include <stdlib.h> /* For strtoul() */ -#include <string.h> /* For strerror */ - -#include "bnprint.h" -#include "cputime.h" - -#include "keygen.h" -#include "keys.h" -#include "random.h" -#include "rsaglue.h" -#include "userio.h" - -#include "kludge.h" - -#define bnPut(prompt, bn) bnPrint(stdout, prompt, bn, "\n") - -static int -rsaTest(struct PubKey const *pub, struct SecKey const *sec) -{ - struct BigNum bn; - char const buf1[25] = "abcdefghijklmnopqrstuvwxy"; - char buf2[64]; - int i, j; -#if CLOCK_AVAIL - timetype start, stop; - unsigned long cursec, encsec = 0, decsec = 0, sigsec = 0, versec = 0; - unsigned curms, encms = 0, decms = 0, sigms = 0, verms = 0; -#endif - - if (rsaKeyTooBig(pub, sec)) { - printf("Key too large for RSA library - not testing.\n"); - return 0; - } - - puts("\tEncrypt\t\tDecrypt\t\tSign\t\tVerify\tStatus"); - bnBegin(&bn); - - for (j = 0; j < (int)sizeof(buf1); j++) { -#if CLOCK_AVAIL - gettime(&start); -#endif - i = rsaPublicEncrypt(&bn, (byte const *)buf1, (size_t)j+1, pub); - if (i < 0) { - printf("RSA encryption failed, i = %dn", i); - return i; - } -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - encsec += cursec = sec(stop); - encms += curms = msec(stop); - printf("\t%lu.%03u\t", cursec, curms); -#else - printf("\t*\t"); -#endif - fflush(stdout); -#if CLOCK_AVAIL - gettime(&start); -#endif - i = rsaPrivateDecrypt((byte *)buf2, sizeof(buf2), &bn, - pub, sec); -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - decsec += cursec = sec(stop); - decms += curms = msec(stop); - printf("\t%lu.%03u\t", cursec, curms); -#else - printf("\t*\t"); -#endif - fflush(stdout); - if (i != j+1 || memcmp(buf1, buf2, (size_t)j+1) != 0) { - printf("RSA Decryption failed, i = %d\n", i); - return i; - } -#if CLOCK_AVAIL - gettime(&start); -#endif - i = rsaPrivateEncrypt(&bn, (byte const *)buf1, (size_t)j+1, - pub, sec); -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - sigsec += cursec = sec(stop); - sigms += curms = msec(stop); - printf("\t%lu.%03u\t", cursec, curms); -#else - printf("\t*\t"); -#endif - fflush(stdout); - if (i < 0) { - printf("RSA signing failed, i = %d\n", i); - return i; - } - -#if CLOCK_AVAIL - gettime(&start); -#endif - i = rsaPublicDecrypt((byte *)buf2, sizeof(buf2), &bn, pub); -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - versec += cursec = sec(stop); - verms += curms = msec(stop); - printf("\t%lu.%03u\t", cursec, curms); -#else - printf("\t*\t"); -#endif - fflush(stdout); - if (i != j+1 || memcmp(buf1, buf2, (size_t)j+1) != 0) { - printf("RSA verify failed i = %d != %d\n", i, j+1); - return i; - } - printf("Succeeded\n"); - fflush(stdout); - } -#if CLOCK_AVAIL - encms += 1000 * (encsec % j); - encsec /= j; - encms /= j; - encsec += encms / 1000; - encms %= 1000; - decms += 1000 * (decsec % j); - decsec /= j; - decms /= j; - decsec += decms / 1000; - decms %= 1000; - sigms += 1000 * (sigsec % j); - sigsec /= j; - sigms /= j; - sigsec += sigms / 1000; - sigms %= 1000; - verms += 1000 * (versec % j); - versec /= j; - verms /= j; - versec += verms / 1000; - verms %= 1000; - printf("\t%lu.%03u\t\t%lu.%03u\t\t%lu.%03u\t\t%lu.%03u\tAVERAGE %u\n", - encsec, encms, decsec, decms, - sigsec, sigms, versec, verms, bnBits(&pub->n)); -#endif - - return 0; -} - -static int -rsaGen(unsigned keybits) -{ - struct PubKey pub; - struct SecKey sec; - int i; -#if CLOCK_AVAIL - timetype start, stop; - unsigned long s; -#endif - - if (keybits < 384) - keybits = 384; - userPrintf("Generating an RSA key with a %u-bit modulus.\n", keybits); - - randAccum(1); -/* randAccum(keybits); */ - - /* - * One dot is printed per pseudoprimality test that fails. - * the density of primes of length "keybits/2" is about - * ln(2^(keybits/2)), or keybits/2*ln(2), so if we were to - * naively test numbers at random, we'd expect to print - * keybits/2*ln(2) dots per number, or keybits*ln(2) for - * both. This is keybits/1.44. - * However, the sieve removes all multiples of 2, 3, 5, 7, 11, 13, - * etc (up to 65521, the largest prime < 65536) from the candidates. - * (1-1/2)*(1-1/3)*(1-1/5)*(1-1/7)*(1-1/11)*...*(1-1/65521) is - * about 0.05061325. So we only actually print keybits*ln(2)*0.0506 - * from the numbers we test, 0.035 of them, or about 1/28.5. - * We round this up to 0.04, or 1/25, because it produces nice - * round numbers and people don't get as impatient if we're a - * little pessimistic. (The Poisson distribution has a long - * tail.) If you really want to know, it's a 14% overestimate. - */ - userPrintf("\n\ -Key generation takes a little while. This program prints dots as it\n\ -searches for each of the two primes it needs for a key. How long it will\n\ -have to search is unpredictable, but expect an average of %u dots total.\n", - keybits/25); - - pubKeyBegin(&pub); - secKeyBegin(&sec); -#if CLOCK_AVAIL - gettime(&start); -#endif - i = genRsaKey(&pub, &sec, keybits, 17, stdout); -#if CLOCK_AVAIL - gettime(&stop); - subtime(stop, start); - s = sec(stop); - printf("%u-bit time = %lu.%03u sec.", keybits, s, msec(stop)); - if (s > 60) { - putchar(' '); - putchar('('); - if (s > 3600) - printf("%u:%02u", (unsigned)(s/3600), - (unsigned)(s/60%60)); - else - printf("%u", (unsigned)(s/60)); - printf(":%02u)", (unsigned)(s%60)); - } - putchar('\n'); -#endif - if (i < 0) { - userPuts("\a\nKeygen failed!\n"); - } else { - userPrintf("%d modular exponentiations performed.\n", i); - bnPut("n = ", &pub.n); - bnPut("e = ", &pub.e); - bnPut("d = ", &sec.d); - bnPut("p = ", &sec.p); - bnPut("q = ", &sec.q); - bnPut("u = ", &sec.u); - i = rsaTest(&pub, &sec); - } - - pubKeyEnd(&pub); - secKeyEnd(&sec); - return i; -} - -int -main(int argc, char **argv) -{ - unsigned long t; - char *p; - - if (argc < 2) { - fprintf(stderr, "Usage: %s <bits>...\n", argv[0]); - fputs("\ -This generates a random RSA key pair and prints its value. <bits>\n\ -is the size of the modulus to use.\n", stderr); - return 1; - } - - bnInit(); - - while (--argc) { - t = strtoul(*++argv, &p, 0); - if (t < 384 || t > 65536 || *p) { - fprintf(stderr, "Illegal modulus size: \"%s\"\n", - *argv); - return 1; - } - - rsaGen((unsigned)t); - } - - return 0; -} diff --git a/libs/libzrtp/third_party/bnlib/test/sha.c b/libs/libzrtp/third_party/bnlib/test/sha.c deleted file mode 100644 index cabef2d401..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/sha.c +++ /dev/null @@ -1,511 +0,0 @@ -/* --------------------------------- SHA.C ------------------------------- */ -#include <string.h> - -#include "sha.h" - -/* - * NIST Secure Hash Algorithm. - * - * Written 2 September 1992, Peter C. Gutmann. - * This implementation placed in the public domain. - * - * Modified 1 June 1993, Colin Plumb. - * Modified for the new SHS based on Peter Gutmann's work, - * 18 July 1994, Colin Plumb. - * Gutmann's work. - * Renamed to SHA and comments updated a bit 1 November 1995, Colin Plumb. - * These modifications placed in the public domain. - * - * Comments to pgut1@cs.aukuni.ac.nz - */ - -#include <string.h> - -/* - * The SHA f()-functions. The f1 and f3 functions can be optimized to - * save one boolean operation each - thanks to Rich Schroeppel, - * rcs@cs.arizona.edu for discovering this - */ -/*#define f1(x,y,z) ( (x & y) | (~x & z) ) // Rounds 0-19 */ -#define f1(x,y,z) ( z ^ (x & (y ^ z) ) ) /* Rounds 0-19 */ -#define f2(x,y,z) ( x ^ y ^ z ) /* Rounds 20-39 */ -/*#define f3(x,y,z) ( (x & y) | (x & z) | (y & z) ) // Rounds 40-59 */ -#define f3(x,y,z) ( (x & y) | (z & (x | y) ) ) /* Rounds 40-59 */ -#define f4(x,y,z) ( x ^ y ^ z ) /* Rounds 60-79 */ - -/* - * The SHA Mysterious Constants. - * K1 = floor(sqrt(2) * 2^30) - * K2 = floor(sqrt(3) * 2^30) - * K3 = floor(sqrt(5) * 2^30) - * K4 = floor(sqrt(10) * 2^30) - */ -#define K1 0x5A827999L /* Rounds 0-19 */ -#define K2 0x6ED9EBA1L /* Rounds 20-39 */ -#define K3 0x8F1BBCDCL /* Rounds 40-59 */ -#define K4 0xCA62C1D6L /* Rounds 60-79 */ - -/* SHA initial values */ - -#define h0init 0x67452301L -#define h1init 0xEFCDAB89L -#define h2init 0x98BADCFEL -#define h3init 0x10325476L -#define h4init 0xC3D2E1F0L - -/* - * Note that it may be necessary to add parentheses to these macros - * if they are to be called with expressions as arguments. - */ - -/* 32-bit rotate left - kludged with shifts */ - -#define ROTL(n,X) ( (X << n) | (X >> (32-n)) ) - -/* - * The initial expanding function - * - * The hash function is defined over an 80-word expanded input array W, - * where the first 16 are copies of the input data, and the remaining 64 - * are defined by W[i] = W[i-16] ^ W[i-14] ^ W[i-8] ^ W[i-3]. This - * implementation generates these values on the fly in a circular buffer. - */ - -#if SHA_VERSION -/* The new ("corrected") SHA, FIPS 180.1 */ -/* Same as below, but then rotate left one bit */ -#define expand(W,i) (W[i&15] ^= W[(i-14)&15] ^ W[(i-8)&15] ^ W[(i-3)&15], \ - W[i&15] = ROTL(1, W[i&15])) -#else -/* The old (pre-correction) SHA, FIPS 180 */ -#define expand(W,i) (W[i&15] ^= W[(i-14)&15] ^ W[(i-8)&15] ^ W[(i-3)&15]) -#endif - -/* - * The prototype SHA sub-round - * - * The fundamental sub-round is - * a' = e + ROTL(5,a) + f(b, c, d) + k + data; - * b' = a; - * c' = ROTL(30,b); - * d' = c; - * e' = d; - * ... but this is implemented by unrolling the loop 5 times and renaming - * the variables (e,a,b,c,d) = (a',b',c',d',e') each iteration. - */ -#define subRound(a, b, c, d, e, f, k, data) \ - ( e += ROTL(5,a) + f(b, c, d) + k + data, b = ROTL(30, b) ) -/* - * The above code is replicated 20 times for each of the 4 functions, - * using the next 20 values from the W[] array each time. - */ - -/* Initialize the SHA values */ - -void -shaInit(struct SHAContext *sha) -{ - /* Set the h-vars to their initial values */ - sha->digest[0] = h0init; - sha->digest[1] = h1init; - sha->digest[2] = h2init; - sha->digest[3] = h3init; - sha->digest[4] = h4init; - - /* Initialise bit count */ -#ifdef HAVE64 - sha->count = 0; -#else - sha->countLo = sha->countHi = 0; -#endif -} - -/* - * Perform the SHA transformation. Note that this code, like MD5, seems to - * break some optimizing compilers due to the complexity of the expressions - * and the size of the basic block. It may be necessary to split it into - * sections, e.g. based on the four subrounds - * - * Note that this corrupts the sha->data area. - */ -#ifndef ASM - -void shaTransform(struct SHAContext *sha) -{ - register word32 A, B, C, D, E; - - /* Set up first buffer */ - A = sha->digest[0]; - B = sha->digest[1]; - C = sha->digest[2]; - D = sha->digest[3]; - E = sha->digest[4]; - - /* Heavy mangling, in 4 sub-rounds of 20 interations each. */ - subRound( A, B, C, D, E, f1, K1, sha->data[ 0] ); - subRound( E, A, B, C, D, f1, K1, sha->data[ 1] ); - subRound( D, E, A, B, C, f1, K1, sha->data[ 2] ); - subRound( C, D, E, A, B, f1, K1, sha->data[ 3] ); - subRound( B, C, D, E, A, f1, K1, sha->data[ 4] ); - subRound( A, B, C, D, E, f1, K1, sha->data[ 5] ); - subRound( E, A, B, C, D, f1, K1, sha->data[ 6] ); - subRound( D, E, A, B, C, f1, K1, sha->data[ 7] ); - subRound( C, D, E, A, B, f1, K1, sha->data[ 8] ); - subRound( B, C, D, E, A, f1, K1, sha->data[ 9] ); - subRound( A, B, C, D, E, f1, K1, sha->data[10] ); - subRound( E, A, B, C, D, f1, K1, sha->data[11] ); - subRound( D, E, A, B, C, f1, K1, sha->data[12] ); - subRound( C, D, E, A, B, f1, K1, sha->data[13] ); - subRound( B, C, D, E, A, f1, K1, sha->data[14] ); - subRound( A, B, C, D, E, f1, K1, sha->data[15] ); - subRound( E, A, B, C, D, f1, K1, expand(sha->data, 16) ); - subRound( D, E, A, B, C, f1, K1, expand(sha->data, 17) ); - subRound( C, D, E, A, B, f1, K1, expand(sha->data, 18) ); - subRound( B, C, D, E, A, f1, K1, expand(sha->data, 19) ); - - subRound( A, B, C, D, E, f2, K2, expand(sha->data, 20) ); - subRound( E, A, B, C, D, f2, K2, expand(sha->data, 21) ); - subRound( D, E, A, B, C, f2, K2, expand(sha->data, 22) ); - subRound( C, D, E, A, B, f2, K2, expand(sha->data, 23) ); - subRound( B, C, D, E, A, f2, K2, expand(sha->data, 24) ); - subRound( A, B, C, D, E, f2, K2, expand(sha->data, 25) ); - subRound( E, A, B, C, D, f2, K2, expand(sha->data, 26) ); - subRound( D, E, A, B, C, f2, K2, expand(sha->data, 27) ); - subRound( C, D, E, A, B, f2, K2, expand(sha->data, 28) ); - subRound( B, C, D, E, A, f2, K2, expand(sha->data, 29) ); - subRound( A, B, C, D, E, f2, K2, expand(sha->data, 30) ); - subRound( E, A, B, C, D, f2, K2, expand(sha->data, 31) ); - subRound( D, E, A, B, C, f2, K2, expand(sha->data, 32) ); - subRound( C, D, E, A, B, f2, K2, expand(sha->data, 33) ); - subRound( B, C, D, E, A, f2, K2, expand(sha->data, 34) ); - subRound( A, B, C, D, E, f2, K2, expand(sha->data, 35) ); - subRound( E, A, B, C, D, f2, K2, expand(sha->data, 36) ); - subRound( D, E, A, B, C, f2, K2, expand(sha->data, 37) ); - subRound( C, D, E, A, B, f2, K2, expand(sha->data, 38) ); - subRound( B, C, D, E, A, f2, K2, expand(sha->data, 39) ); - - subRound( A, B, C, D, E, f3, K3, expand(sha->data, 40) ); - subRound( E, A, B, C, D, f3, K3, expand(sha->data, 41) ); - subRound( D, E, A, B, C, f3, K3, expand(sha->data, 42) ); - subRound( C, D, E, A, B, f3, K3, expand(sha->data, 43) ); - subRound( B, C, D, E, A, f3, K3, expand(sha->data, 44) ); - subRound( A, B, C, D, E, f3, K3, expand(sha->data, 45) ); - subRound( E, A, B, C, D, f3, K3, expand(sha->data, 46) ); - subRound( D, E, A, B, C, f3, K3, expand(sha->data, 47) ); - subRound( C, D, E, A, B, f3, K3, expand(sha->data, 48) ); - subRound( B, C, D, E, A, f3, K3, expand(sha->data, 49) ); - subRound( A, B, C, D, E, f3, K3, expand(sha->data, 50) ); - subRound( E, A, B, C, D, f3, K3, expand(sha->data, 51) ); - subRound( D, E, A, B, C, f3, K3, expand(sha->data, 52) ); - subRound( C, D, E, A, B, f3, K3, expand(sha->data, 53) ); - subRound( B, C, D, E, A, f3, K3, expand(sha->data, 54) ); - subRound( A, B, C, D, E, f3, K3, expand(sha->data, 55) ); - subRound( E, A, B, C, D, f3, K3, expand(sha->data, 56) ); - subRound( D, E, A, B, C, f3, K3, expand(sha->data, 57) ); - subRound( C, D, E, A, B, f3, K3, expand(sha->data, 58) ); - subRound( B, C, D, E, A, f3, K3, expand(sha->data, 59) ); - - subRound( A, B, C, D, E, f4, K4, expand(sha->data, 60) ); - subRound( E, A, B, C, D, f4, K4, expand(sha->data, 61) ); - subRound( D, E, A, B, C, f4, K4, expand(sha->data, 62) ); - subRound( C, D, E, A, B, f4, K4, expand(sha->data, 63) ); - subRound( B, C, D, E, A, f4, K4, expand(sha->data, 64) ); - subRound( A, B, C, D, E, f4, K4, expand(sha->data, 65) ); - subRound( E, A, B, C, D, f4, K4, expand(sha->data, 66) ); - subRound( D, E, A, B, C, f4, K4, expand(sha->data, 67) ); - subRound( C, D, E, A, B, f4, K4, expand(sha->data, 68) ); - subRound( B, C, D, E, A, f4, K4, expand(sha->data, 69) ); - subRound( A, B, C, D, E, f4, K4, expand(sha->data, 70) ); - subRound( E, A, B, C, D, f4, K4, expand(sha->data, 71) ); - subRound( D, E, A, B, C, f4, K4, expand(sha->data, 72) ); - subRound( C, D, E, A, B, f4, K4, expand(sha->data, 73) ); - subRound( B, C, D, E, A, f4, K4, expand(sha->data, 74) ); - subRound( A, B, C, D, E, f4, K4, expand(sha->data, 75) ); - subRound( E, A, B, C, D, f4, K4, expand(sha->data, 76) ); - subRound( D, E, A, B, C, f4, K4, expand(sha->data, 77) ); - subRound( C, D, E, A, B, f4, K4, expand(sha->data, 78) ); - subRound( B, C, D, E, A, f4, K4, expand(sha->data, 79) ); - - /* Build message digest */ - sha->digest[0] += A; - sha->digest[1] += B; - sha->digest[2] += C; - sha->digest[3] += D; - sha->digest[4] += E; -} - -#endif /* !ASM */ - -/* - * SHA is defined in big-endian form, so this converts the buffer from - * bytes to words, independent of the machine's native endianness. - * - * Assuming a consistent byte ordering for the machine, this also - * has the magic property of being self-inverse. It is used as - * such. - */ - -static void byteReverse(word32 *buffer, unsigned byteCount) -{ - word32 value; - - byteCount /= sizeof(word32); - while ( byteCount-- ) { - value = (word32)((unsigned)((word8 *)buffer)[0] << 8 | - ((word8 *)buffer)[1]) << 16 | - ((unsigned)((word8 *)buffer)[2] << 8 | - ((word8 *)buffer)[3]); - *buffer++ = value; - } -} - -/* Update SHA for a block of data. */ - -void -shaUpdate(struct SHAContext *sha, word8 const *buffer, unsigned count) -{ - word32 t; - - /* Update bitcount */ - -#ifdef HAVE64 - t = (word32)sha->count & 0x3f; - sha->count += count; -#else - t = sha->countLo; - if ( ( sha->countLo = t + count ) < t ) - sha->countHi++; /* Carry from low to high */ - - t &= 0x3f; /* Bytes already in sha->data */ -#endif - - /* Handle any leading odd-sized chunks */ - - if (t) { - word8 *p = (word8 *)sha->data + t; - - t = 64-t; - if (count < t) { - memcpy(p, buffer, count); - return; - } - memcpy(p, buffer, t); - byteReverse(sha->data, SHA_BLOCKSIZE); - shaTransform(sha); - buffer += t; - count -= t; - } - - /* Process data in SHA_BLOCKSIZE chunks */ - - while (count >= SHA_BLOCKSIZE) { - memcpy(sha->data, buffer, SHA_BLOCKSIZE); - byteReverse(sha->data, SHA_BLOCKSIZE); - shaTransform(sha); - buffer += SHA_BLOCKSIZE; - count -= SHA_BLOCKSIZE; - } - - /* Handle any remaining bytes of data. */ - - memcpy(sha->data, buffer, count); -} - -/* Final wrapup - pad to 64-byte boundary with the bit pattern - 1 0* (64-bit count of bits processed, MSB-first) */ - -void -shaFinal(struct SHAContext *sha, word8 *hash) -{ - int count; - word8 *p; - - /* Compute number of bytes mod 64 */ -#ifdef HAVE64 - count = (int)sha->count & 0x3F; -#else - count = (int)sha->countLo & 0x3F; -#endif - - /* - * Set the first char of padding to 0x80. - * This is safe since there is always at least one byte free - */ - p = (word8 *)sha->data + count; - *p++ = 0x80; - - /* Bytes of padding needed to make 64 bytes */ - count = SHA_BLOCKSIZE - 1 - count; - - /* Pad out to 56 mod 64 */ - if (count < 8) { - /* Two lots of padding: Pad the first block to 64 bytes */ - memset(p, 0, count); - byteReverse(sha->data, SHA_BLOCKSIZE); - shaTransform(sha); - - /* Now fill the next block with 56 bytes */ - memset(sha->data, 0, SHA_BLOCKSIZE-8); - } else { - /* Pad block to 56 bytes */ - memset(p, 0, count-8); - } - byteReverse(sha->data, SHA_BLOCKSIZE-8); - - /* Append length in *bits* and transform */ -#if HAVE64 - sha->data[14] = (word32)(sha->count >> 29); - sha->data[15] = (word32)sha->count << 3; -#else - sha->data[14] = sha->countHi << 3 | sha->countLo >> 29; - sha->data[15] = sha->countLo << 3; -#endif - - shaTransform(sha); - - /* Store output hash in buffer */ - byteReverse(sha->digest, SHA_DIGESTSIZE); - memcpy(hash, sha->digest, SHA_DIGESTSIZE); - memset(sha, 0, sizeof(*sha)); -} - -#if 0 -/* ----------------------------- SHA Test code --------------------------- */ -#include <stdio.h> -#include <stdlib.h> /* For exit() */ -#include <time.h> - -/* Size of buffer for SHA speed test data */ - -#define TEST_BLOCK_SIZE ( SHA_DIGESTSIZE * 100 ) - -/* Number of bytes of test data to process */ - -#define TEST_BYTES 10000000L -#define TEST_BLOCKS ( TEST_BYTES / TEST_BLOCK_SIZE ) - -#if SHA_VERSION -static char const *shaTestResults[] = { - "A9993E364706816ABA3E25717850C26C9CD0D89D", - "84983E441C3BD26EBAAE4AA1F95129E5E54670F1", - "34AA973CD4C4DAA4F61EEB2BDBAD27316534016F", - "34AA973CD4C4DAA4F61EEB2BDBAD27316534016F", - "34AA973CD4C4DAA4F61EEB2BDBAD27316534016F" }; -#else -static char const *shaTestResults[] = { - "0164B8A914CD2A5E74C4F7FF082C4D97F1EDF880", - "D2516EE1ACFA5BAF33DFC1C471E438449EF134C8", - "3232AFFA48628A26653B5AAA44541FD90D690603", - "3232AFFA48628A26653B5AAA44541FD90D690603", - "3232AFFA48628A26653B5AAA44541FD90D690603" }; -#endif - -static int -compareSHAresults(word8 *hash, int level) -{ - char buf[41]; - int i; - - for (i = 0; i < SHA_DIGESTSIZE; i++) - sprintf(buf+2*i, "%02X", hash[i]); - - if (strcmp(buf, shaTestResults[level-1]) == 0) { - printf("Test %d passed, result = %s\n", level, buf); - return 0; - } else { - printf("Error in SHA implementation: Test %d failed\n", level); - printf(" Result = %s\n", buf); - printf("Expected = %s\n", shaTestResults[level-1]); - return -1; - } -} - - -int -main(void) -{ - struct SHAContext sha; - word8 data[TEST_BLOCK_SIZE]; - word8 hash[SHA_DIGESTSIZE]; - time_t seconds; - long i; - word32 t; - - /* Check that LITTLE_ENDIAN is set correctly */ - t = 0x12345678; - -#if LITTLE_ENDIAN - if (*(word8 *)&t != 0x78) { - puts("Error: Define BIG_ENDIAN in SHA.H and recompile"); - exit(-1); - } -#elif BIG_ENDIAN - if (*(word8 *)&t != 0x12) { - puts("Error: Define LITTLE_ENDIAN in SHA.H and recompile"); - exit(-1); - } -#endif - - /* - * Test output data (these are the only test data given in the - * Secure Hash Standard document, but chances are if it works - * for this it'll work for anything) - */ - shaInit(&sha); - shaUpdate(&sha, (word8 *)"abc", 3); - shaFinal(&sha, hash); - if (compareSHAresults(hash, 1) < 0) - exit (-1); - - shaInit(&sha); - shaUpdate(&sha, (word8 *)"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56); - shaFinal(&sha, hash); - if (compareSHAresults(hash, 2) < 0) - exit (-1); - - /* 1,000,000 bytes of ASCII 'a' (0x61), by 64's */ - shaInit(&sha); - for (i = 0; i < 15625; i++) - shaUpdate(&sha, (word8 *)"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 64); - shaFinal(&sha, hash); - if (compareSHAresults(hash, 3) < 0) - exit (-1); - - /* 1,000,000 bytes of ASCII 'a' (0x61), by 25's */ - shaInit(&sha); - for (i = 0; i < 40000; i++) - shaUpdate(&sha, (word8 *)"aaaaaaaaaaaaaaaaaaaaaaaaa", 25); - shaFinal(&sha, hash); - if (compareSHAresults(hash, 4) < 0) - exit (-1); - - /* 1,000,000 bytes of ASCII 'a' (0x61), by 125's */ - shaInit(&sha); - for (i = 0; i < 8000; i++) - shaUpdate(&sha, (word8 *)"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 125); - shaFinal(&sha, hash); - if (compareSHAresults(hash, 5) < 0) - exit (-1); - - /* Now perform time trial, generating MD for 10MB of data. First, - initialize the test data */ - memset(data, 0, TEST_BLOCK_SIZE); - - /* Get start time */ - printf("SHA time trial. Processing %ld characters...\n", TEST_BYTES); - seconds = time((time_t *)0); - - /* Calculate SHA message digest in TEST_BLOCK_SIZE byte blocks */ - shaInit(&sha); - for (i = TEST_BLOCKS; i > 0; i--) - shaUpdate(&sha, data, TEST_BLOCK_SIZE); - shaFinal(&sha, hash); - - /* Get finish time and print difference */ - seconds = time((time_t *)0) - seconds; - printf("Seconds to process test input: %ld\n", seconds); - printf("Characters processed per second: %ld\n", TEST_BYTES / seconds); - - return 0; -} -#endif /* Test driver */ diff --git a/libs/libzrtp/third_party/bnlib/test/sha.h b/libs/libzrtp/third_party/bnlib/test/sha.h deleted file mode 100644 index 7d8fb23301..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/sha.h +++ /dev/null @@ -1,58 +0,0 @@ -/* --------------------------------- SHA.H ------------------------------- */ - -/* - * NIST Secure Hash Algorithm. - * - * Written 2 September 1992, Peter C. Gutmann. - * This implementation placed in the public domain. - * - * Modified 1 June 1993, Colin Plumb. - * Renamed to SHA and comments updated a bit 1 November 1995, Colin Plumb. - * These modifications placed in the public domain. - * - * Comments to pgut1@cs.aukuni.ac.nz - */ - -/* Typedefs for various word sizes */ -#include "types.h" - -/* - * Since 64-bit machines are the wave of the future, we may as well - * support them directly. - */ - -/* The SHA block size and message digest sizes, in bytes */ - -#define SHA_BLOCKSIZE 64 -#define SHA_DIGESTSIZE 20 - -/* - * The structure for storing SHA info. - * data[] is placed first in case offsets of 0 are faster - * for some reason; it's the most often accessed field. - */ - -struct SHAContext { - word32 data[ 16 ]; /* SHA data buffer */ - word32 digest[ 5 ]; /* Message digest */ -#ifdef HAVE64 - word64 count; -#else - word32 countHi, countLo; /* 64-bit byte count */ -#endif -}; - -/* Which standard? FIPS 180 or FIPS 180.1? */ - -#define SHA_VERSION 1 - -/* Whether the machine is little-endian or not */ - -#if !defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN) -#define BIG_ENDIAN 1 -#endif - -void shaInit(struct SHAContext *sha); -void shaTransform(struct SHAContext *sha); -void shaUpdate(struct SHAContext *sha, word8 const *buffer, unsigned count); -void shaFinal(struct SHAContext *shaInfo, word8 *hash); diff --git a/libs/libzrtp/third_party/bnlib/test/types.h b/libs/libzrtp/third_party/bnlib/test/types.h deleted file mode 100644 index 7b844afb72..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/types.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#ifndef TYPES_H -#define TYPES_H - -#include <limits.h> - -#if UCHAR_MAX == 0xff -typedef unsigned char word8; -typedef signed char int8; -#endif - -#if UINT_MAX == 0xffffu -typedef unsigned word16; -typedef int int16; -#elif USHRT_MAX == 0xffffu -typedef unsigned short word16; -typedef short int16; -#endif - -#if UINT_MAX == 0xffffffffu -typedef unsigned word32; -typedef int int32; -#elif ULONG_MAX == 0xffffffffu -typedef unsigned long word32; -typedef long int32; -#endif - -#if ULONG_MAX > 0xffffffffu -typedef unsigned long word64; -typedef long int64; -#ifndef HAVE64 -#define HAVE64 1 -#endif -#elif defined(ULONGLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULLONG_MAX) -typedef unsigned long long word64; -typedef long long int64; -#ifndef HAVE64 -#define HAVE64 1 -#endif -#endif - -#endif /* !TYPES_H */ diff --git a/libs/libzrtp/third_party/bnlib/test/userio.h b/libs/libzrtp/third_party/bnlib/test/userio.h deleted file mode 100644 index 715dd9c473..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/userio.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - */ -#include <stdio.h> - -#define userPrintf printf -#define userPuts(s) fputs(s, stdout) -#define userFlush() fflush(stdout) -#define userPutc putchar diff --git a/libs/libzrtp/third_party/bnlib/test/usuals.h b/libs/libzrtp/third_party/bnlib/test/usuals.h deleted file mode 100644 index cf07b0011b..0000000000 --- a/libs/libzrtp/third_party/bnlib/test/usuals.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1995 Colin Plumb. All rights reserved. - * For licensing and other legal details, see the file legal.c. - * - * usuals.h - Typedefs and #defines used widely. - */ -#ifndef USUALS_H -#define USUALS_H - -#include <limits.h> - -#if UCHAR_MAX == 0xff -typedef unsigned char byte; -typedef signed char int8; -#else -#error This machine has no 8-bit type -#endif - -#if UINT_MAX == 0xffffu -typedef unsigned word16; -typedef int int16; -#elif USHRT_MAX == 0xffffu -typedef unsigned short word16; -typedef short int16; -#else -#error This machine has no 16-bit type -#endif - -#if UINT_MAX == 0xffffffffu -typedef unsigned int word32; -typedef int int32; -#elif ULONG_MAX == 0xffffffffu -typedef unsigned long word32; -typedef long int32; -#else -#error This machine has no 32-bit type -#endif - -#include <string.h> /* Prototype for memset */ -/* - * Wipe sensitive data. - * Note that this takes a structure, not a pointer to one! - */ -#define wipe(x) memset(x, 0, sizeof(*(x))) - -#endif /* USUALS_H */ diff --git a/scripts/debian_min_build.sh b/scripts/debian_min_build.sh index b585c1921e..a07ad7165a 100755 --- a/scripts/debian_min_build.sh +++ b/scripts/debian_min_build.sh @@ -22,14 +22,14 @@ cd freeswitch.git ./configure -C --enable-portable-binary --enable-sctp\ --prefix=/usr --localstatedir=/var --sysconfdir=/etc \ --with-gnu-ld --with-openssl \ - --enable-core-odbc-support --enable-zrtp \ + --enable-core-odbc-support \ --enable-core-pgsql-support \ --enable-static-v8 --disable-parallel-build-v8 --enable-amr $@ #CC=clang-3.6 CXX=clang++-3.6 ./configure -C --enable-portable-binary \ # --prefix=/usr --localstatedir=/var --sysconfdir=/etc \ # --with-gnu-ld --with-openssl \ -# --enable-core-odbc-support --enable-zrtp \ +# --enable-core-odbc-support \ # --enable-core-pgsql-support \ # --enable-static-v8 --disable-parallel-build-v8 --enable-address-sanitizer diff --git a/scripts/lua/sound_test.lua b/scripts/lua/sound_test.lua index ee169f88f2..465ba65a28 100644 --- a/scripts/lua/sound_test.lua +++ b/scripts/lua/sound_test.lua @@ -42,7 +42,6 @@ tbl_types = { ['phonetic-ascii'] = 1, ['time'] = 1, ['voicemail'] = 1, - ['zrtp'] = 1 }; tbl_rates = {['8000'] = 1 ,['16000'] = 1, ['32000'] = 1, ['48000'] = 1}; @@ -71,4 +70,4 @@ else else freeswitch.consoleLog("ERR","Result of system call: " .. what .. " " .. code .. "\n"); end -end \ No newline at end of file +end diff --git a/scripts/lua/zrtp_agent.lua b/scripts/lua/zrtp_agent.lua deleted file mode 100644 index 2ce8b3e0a6..0000000000 --- a/scripts/lua/zrtp_agent.lua +++ /dev/null @@ -1,38 +0,0 @@ --- ZRTP Enrollment Agent -session:setVariable("zrtp_secure_media", "true"); -session:setVariable("zrtp_enrollment", "true"); -session:sleep(100); -session:answer(); -session:streamFile("zrtp/zrtp-status_securing.wav"); -session:sleep(3000); --- Give the agent time to bring up ZRTP. - -local zrtp_secure_media_confirmed = session:getVariable("zrtp_secure_media_confirmed_audio"); -local zrtp_new_user_enrolled = session:getVariable("zrtp_new_user_enrolled_audio"); -local zrtp_already_enrolled = session:getVariable("zrtp_already_enrolled_audio"); - -if zrtp_secure_media_confirmed == "true" then - session:streamFile("zrtp/zrtp-status_secure.wav"); -else - session:streamFile("zrtp/zrtp-status_notsecure.wav"); -end - -session:streamFile("zrtp/zrtp-enroll_welcome.wav"); -session:sleep(1000); - -if zrtp_secure_media_confirmed == "true" then - if zrtp_new_user_enrolled == "true" then - session:streamFile("zrtp/zrtp-enroll_confirmed.wav"); - session:sleep(3000); - else - if zrtp_already_enrolled == "true" then - session:streamFile("zrtp/zrtp-enroll_already_enrolled.wav"); - end - end -else - session:streamFile("zrtp/zrtp-enroll_notzrtp.wav"); -end - -session:sleep(1000); -session:streamFile("zrtp/zrtp-thankyou_goodbye.wav"); -session:sleep(1000); diff --git a/scripts/lua/zrtp_proxy_media.lua b/scripts/lua/zrtp_proxy_media.lua deleted file mode 100644 index 1af3893f30..0000000000 --- a/scripts/lua/zrtp_proxy_media.lua +++ /dev/null @@ -1,87 +0,0 @@ --- Copyright (c) 2011-2012, Travis Cross. --- --- 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. --- --- zrtp_proxy_media.lua --- --- The logic in this script enables ZRTP sessions to negotiate --- end-to-end security associations, which is desirable whether or not --- the switch natively supports ZRTP itself. --- --- To enable this logic, call the script from the top of your dialplan --- as so: --- --- <extension name="global" continue="true"> --- <condition break="never"> --- <action application="lua" data="lua/zrtp_proxy_media.lua"/> --- </condition> --- </extension> --- --- If any particular call flow should never have proxy_media enabled, --- such as for connecting to voicemail systems or conferences, make --- sure this is called before the bridge: --- --- <action application="lua" data="lua/zrtp_proxy_media.lua disable"/> - -api=freeswitch.API() - -function sappend(s1,s2) if s1 and #s1>0 then return s1..s2 else return s2 end end -function log(level,msg) return freeswitch.consoleLog(level,msg.."\n") end -function ready() return session:ready() end -function getvar(var) return session:getVariable(var) end -function getvarp(var) return getvar(var)=="true" end -function setvar_a(k,v) return session:setVariable(k,v) end -function append_var(k,v) return setvar_a(k,sappend(getvar(k),v)) end -function export(k) return append_var("export_vars",","..k) end -function setvar_ab(k,v) if v then setvar_a(k,v) end return export(k) end -function setvar_b(k,v) return setvar_ab("nolocal:"..k,v) end - -function enable_zd(msg) - log("info",msg) - setvar_ab("zrtp_set","true") - setvar_ab("proxy_media","true") - setvar_ab("zrtp_secure_media","false") -end - -function disable_zd(msg) - log("info",msg) - setvar_ab("zrtp_set","true") - setvar_ab("proxy_media","false") - setvar_ab("zrtp_secure_media","true") -end - -function xfer(x) - return session:transfer(x,getvar("dialplan"),getvar("context")) -end - -function main() - if ready() then - session:setAutoHangup(false) - local dst=getvar("destination_number") - if argv[1]=="disable" then - return disable_zd("zrtp-direct disabled on this call flow") - elseif getvarp("zrtp_set") then - return log("notice","zrtp already decided; doing nothing") end - local x=dst:match("^%*%*%*(.*)$") - if x then - enable_zd("going zrtp-direct based on star code") - return xfer(x) end - local x=dst:match("^%*%*(.*)$") - if x then - disable_zd("going zrtp-indirect based on star code") - return xfer(x) end - if getvar("switch_r_sdp"):match("a=zrtp%-hash:") then - return enable_zd("going zrtp-direct based on a=zrtp-hash") end - return disable_zd("not going zrtp-direct") - end -end - -main() diff --git a/scripts/lua/zrtp_sas_proxy.lua b/scripts/lua/zrtp_sas_proxy.lua deleted file mode 100644 index 503b8d8c72..0000000000 --- a/scripts/lua/zrtp_sas_proxy.lua +++ /dev/null @@ -1,103 +0,0 @@ --- zrtp_sas_proxy.lua --- --- Copyright (c) 2011-2013 Travis Cross --- --- 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. --- --- --- When we're acting as a ZRTP man-in-the-middle, proxy the SAS (Short --- Authentication String) from one leg of the call to the other. --- --- This script should be called asynchonously with luarun. e.g.: --- --- <action application="export" data="nolocal:api_on_answer=luarun zrtp_sas_proxy.lua ${uuid}"/> --- -aleg=argv[1] -api=freeswitch.API() - -function log(level,msg) return freeswitch.consoleLog(level,"zrtp_sas: "..msg.."\n") end -function sleep(sec) return freeswitch.msleep(sec*1000) end -function ready() return api:execute("uuid_exists",aleg)=="true" end -function getvar(uuid,var) - local x=api:execute("uuid_getvar",uuid.." "..var) - if x=="_undef_" then return nil end - return x -end -function getvarp(uuid,var) return getvar(uuid,var)=="true" end -function display(uuid,msg) - local cidn=getvar(uuid,"caller_id_name") - return api:execute("uuid_display",uuid.." "..msg.." "..cidn) -end - -function mk_sas(sas1,sas2) - if sas1 and sas2 then return sas1.." "..sas2 - else return sas1 or sas2 or "" end -end - -function get_sas(uuid) - return mk_sas(getvar(uuid,"zrtp_sas1_string_audio"), - getvar(uuid,"zrtp_sas2_string")) -end - -function log_sas(leg,uuid) - return log("notice",leg..": "..uuid.." sas: "..get_sas(uuid)) -end - -function display_sas(to,from) - return display(to," ("..get_sas(from)..")") -end - -function get_bleg(aleg) - local retries=15 bleg=nil - while ready() do - if retries<1 then return nil end - local bleg=getvar(aleg,"signal_bond") - if bleg then return bleg end - log("debug","waiting for bleg uuid...") - sleep(1) - retries=retries-1 - end -end - -function handle_sas(aleg,bleg) - local retries=45 af=false bf=false - while ready() do - if retries<1 then return nil end - if not af and getvarp(aleg,"zrtp_secure_media_confirmed_audio") then - af=true - log_sas("aleg",aleg) - display_sas(bleg,aleg) - end - if not bf and getvarp(bleg,"zrtp_secure_media_confirmed_audio") then - bf=true - log_sas("bleg",bleg) - display_sas(aleg,bleg) - end - if (af and bf) then break - elseif af then log("debug","waiting on bleg zrtp...") - elseif bf then log("debug","waiting on aleg zrtp...") - else log("debug","waiting for zrtp...") end - sleep(1) - retries=retries-1 - end -end - -if not (getvarp(aleg,"zrtp_passthru") or getvarp(aleg,"proxy_media")) then - handle_sas(aleg,get_bleg(aleg)) -end diff --git a/scripts/mk_fs_fhs.sh b/scripts/mk_fs_fhs.sh index a7cab3ecfe..a1183bf51c 100644 --- a/scripts/mk_fs_fhs.sh +++ b/scripts/mk_fs_fhs.sh @@ -4,13 +4,13 @@ touch noreg ./configure -C --enable-portable-binary \ --prefix=/usr --localstatedir=/var --sysconfdir=/etc \ --with-gnu-ld --with-python --with-erlang --with-openssl \ - --enable-core-odbc-support --enable-zrtp \ + --enable-core-odbc-support \ --enable-core-pgsql-support \ --enable-static-v8 #CC=clang-3.6 CXX=clang++-3.6 ./configure -C --enable-portable-binary \ # --prefix=/usr --localstatedir=/var --sysconfdir=/etc \ # --with-gnu-ld --with-python --with-erlang --with-openssl \ -# --enable-core-odbc-support --enable-zrtp \ +# --enable-core-odbc-support \ # --enable-core-pgsql-support \ # --enable-static-v8 --disable-parallel-build-v8 --enable-address-sanitizer make diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 5ee73c41fa..ee927e6db9 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -436,7 +436,6 @@ SWITCH_DECLARE(void) switch_channel_clear_flag_recursive(switch_channel_t *chann SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line); SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_channel_t *channel, const char *file, const char *func, int line); -SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel); /*! \brief Answer a channel (initiate/acknowledge a successful connection) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 78f43f3725..8694a0bc88 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -219,9 +219,6 @@ SWITCH_DECLARE(const char *)switch_core_media_get_codec_string(switch_core_sessi SWITCH_DECLARE(void) switch_core_media_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str); SWITCH_DECLARE(switch_status_t) switch_core_media_add_crypto(switch_core_session_t *session, switch_secure_settings_t *ssec, switch_rtp_crypto_direction_t direction); SWITCH_DECLARE(switch_t38_options_t *) switch_core_media_extract_t38_options(switch_core_session_t *session, const char *r_sdp); -SWITCH_DECLARE(void) switch_core_media_pass_zrtp_hash(switch_core_session_t *session); -SWITCH_DECLARE(const char *) switch_core_media_get_zrtp_hash(switch_core_session_t *session, switch_media_type_t type, switch_bool_t local); -SWITCH_DECLARE(void) switch_core_media_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core_session_t *bleg_session); SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session, int sendonly); SWITCH_DECLARE(void) switch_core_media_reset_t38(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_media_copy_t38_options(switch_t38_options_t *t38_options, switch_core_session_t *session); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index f6bb87d391..3ec80a7afd 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -189,7 +189,6 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME "__cache_speech_handles_obj__" #define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media" #define SWITCH_PROXY_MEDIA_VARIABLE "proxy_media" -#define SWITCH_ZRTP_PASSTHRU_VARIABLE "zrtp_passthru" #define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition" #define SWITCH_HOLD_MUSIC_VARIABLE "hold_music" #define SWITCH_TEMP_HOLD_MUSIC_VARIABLE "temp_hold_music" @@ -817,10 +816,6 @@ typedef enum { SWITCH_RTP_FLAG_FLUSH, SWITCH_RTP_FLAG_AUTOFLUSH, SWITCH_RTP_FLAG_STICKY_FLUSH, - SWITCH_ZRTP_FLAG_SECURE_SEND, - SWITCH_ZRTP_FLAG_SECURE_RECV, - SWITCH_ZRTP_FLAG_SECURE_MITM_SEND, - SWITCH_ZRTP_FLAG_SECURE_MITM_RECV, SWITCH_RTP_FLAG_DEBUG_RTP_READ, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE, SWITCH_RTP_FLAG_ESTIMATORS, @@ -1542,9 +1537,6 @@ typedef enum { CF_MANUAL_MEDIA_PARAMS, CF_SERVICE_AUDIO, CF_SERVICE_VIDEO, - CF_ZRTP_PASSTHRU_REQ, - CF_ZRTP_PASSTHRU, - CF_ZRTP_HASH, CF_CHANNEL_SWAP, CF_DEVICE_LEG, CF_FINAL_DEVICE_LEG, @@ -1693,20 +1685,19 @@ typedef enum { SFF_RFC2833 = (1 << 4), SFF_PROXY_PACKET = (1 << 5), SFF_DYNAMIC = (1 << 6), - SFF_ZRTP = (1 << 7), - SFF_UDPTL_PACKET = (1 << 8), - SFF_NOT_AUDIO = (1 << 9), - SFF_RTCP = (1 << 10), - SFF_MARKER = (1 << 11), - SFF_WAIT_KEY_FRAME = (1 << 12), - SFF_RAW_RTP_PARSE_FRAME = (1 << 13), - SFF_PICTURE_RESET = (1 << 14), - SFF_SAME_IMAGE = (1 << 15), - SFF_USE_VIDEO_TIMESTAMP = (1 << 16), - SFF_ENCODED = (1 << 17), - SFF_TEXT_LINE_BREAK = (1 << 18), - SFF_IS_KEYFRAME = (1 << 19), - SFF_EXTERNAL = (1 << 20) + SFF_UDPTL_PACKET = (1 << 7), + SFF_NOT_AUDIO = (1 << 8), + SFF_RTCP = (1 << 9), + SFF_MARKER = (1 << 10), + SFF_WAIT_KEY_FRAME = (1 << 11), + SFF_RAW_RTP_PARSE_FRAME = (1 << 12), + SFF_PICTURE_RESET = (1 << 13), + SFF_SAME_IMAGE = (1 << 14), + SFF_USE_VIDEO_TIMESTAMP = (1 << 15), + SFF_ENCODED = (1 << 16), + SFF_TEXT_LINE_BREAK = (1 << 17), + SFF_IS_KEYFRAME = (1 << 18), + SFF_EXTERNAL = (1 << 19) } switch_frame_flag_enum_t; typedef uint32_t switch_frame_flag_t; diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 0f5db4468f..4999681cdd 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -285,9 +285,6 @@ <!-- Let calls hit the dialplan before selecting codec for the a-leg --> <param name="inbound-late-negotiation" value="true"/> - <!-- Allow ZRTP clients to negotiate end-to-end security associations (also enables late negotiation) --> - <param name="inbound-zrtp-passthru" value="true"/> - <!-- this lets anything register --> <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication --> diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 97f735189d..e40f1e5deb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2597,8 +2597,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } - switch_channel_check_zrtp(tech_pvt->channel); - if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); goto end_lock; @@ -3066,7 +3064,6 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t stream->write_function(stream, "NOMEDIA \t%s\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false"); stream->write_function(stream, "LATE-NEG \t%s\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false"); stream->write_function(stream, "PROXY-MEDIA \t%s\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false"); - stream->write_function(stream, "ZRTP-PASSTHRU \t%s\n", sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) ? "true" : "false"); stream->write_function(stream, "AGGRESSIVENAT \t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false"); if (profile->user_agent_filter) { @@ -3369,7 +3366,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl stream->write_function(stream, " <nomedia>%s</nomedia>\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false"); stream->write_function(stream, " <late-neg>%s</late-neg>\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false"); stream->write_function(stream, " <proxy-media>%s</proxy-media>\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false"); - stream->write_function(stream, " <zrtp-passthru>%s</zrtp-passthru>\n", sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) ? "true" : "false"); stream->write_function(stream, " <aggressive-nat>%s</aggressive-nat>\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false"); if (profile->user_agent_filter) { @@ -5185,17 +5181,6 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session sofia_clear_flag(ctech_pvt, TFLAG_ENABLE_SOA); } - if (switch_channel_test_flag(o_channel, CF_ZRTP_PASSTHRU_REQ) && switch_channel_test_flag(o_channel, CF_ZRTP_HASH)) { - const char *x = NULL; - switch_core_media_pass_zrtp_hash2(session, nsession); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[zrtp_passthru] Setting a-leg inherit_codec=true\n"); - switch_channel_set_variable(o_channel, "inherit_codec", "true"); - if ((x = switch_channel_get_variable(o_channel, "ep_codec_string"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[zrtp_passthru] Setting b-leg absolute_codec_string='%s'\n", x); - switch_channel_set_variable(nchannel, "absolute_codec_string", x); - } - } - /* SNARK: lets copy this across so we can see if we're the other leg of 3PCC + bypass_media... */ if (sofia_test_flag(ctech_pvt, TFLAG_3PCC) && (switch_channel_test_flag(o_channel, CF_PROXY_MODE) || switch_channel_test_flag(o_channel, CF_PROXY_MEDIA))) { sofia_set_flag(tech_pvt, TFLAG_3PCC_INVITE); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 34ca3d66e4..bfd682c1f1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -350,7 +350,6 @@ typedef enum { TFLAG_TPORT_LOG, TFLAG_SENT_UPDATE, TFLAG_PROXY_MEDIA, - TFLAG_ZRTP_PASSTHRU, TFLAG_HOLD_LOCK, TFLAG_3PCC_HAS_ACK, TFLAG_UPDATING_DISPLAY, diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index dc52535e06..6f73823b86 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5053,12 +5053,6 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else { sofia_clear_flag(profile, TFLAG_PROXY_MEDIA); } - } else if (!strcasecmp(var, "inbound-zrtp-passthru")) { - if (switch_true(val)) { - sofia_set_flag(profile, TFLAG_ZRTP_PASSTHRU); - } else { - sofia_clear_flag(profile, TFLAG_ZRTP_PASSTHRU); - } } else if (!strcasecmp(var, "force-subscription-expires") && !zstr(val)) { int tmp = atoi(val); if (tmp > 0) { @@ -6131,11 +6125,6 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } - if (sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) && !sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ZRTP passthrough implictly enables inbound-late-negotiation\n"); - sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); - } - if (sofia_test_flag(profile, TFLAG_INB_NOMEDIA) && !sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "inbound-bypass-media implictly enables inbound-late-negotiation\n"); sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); @@ -6271,10 +6260,6 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) if (profile_already_started) { switch_xml_t gateways_tag, domain_tag, domains_tag, aliases_tag, alias_tag; - if (sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU)) { - sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); - } - if ((gateways_tag = switch_xml_child(xprofile, "gateways"))) { parse_gateways(profile, gateways_tag, NULL); } @@ -8683,7 +8668,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, sofia_set_flag_locked(tech_pvt, TFLAG_ANS); if (match) { - switch_channel_check_zrtp(channel); if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) == SWITCH_STATUS_SUCCESS) { if (sofia_media_activate_rtp(tech_pvt) == SWITCH_STATUS_SUCCESS) { @@ -11151,10 +11135,6 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_channel_set_flag(channel, CF_PROXY_MEDIA); } - if (sofia_test_flag(tech_pvt, TFLAG_ZRTP_PASSTHRU)) { - switch_channel_set_flag(channel, CF_ZRTP_PASSTHRU_REQ); - } - if (sip->sip_subject && sip->sip_subject->g_string) { switch_channel_set_variable(channel, "sip_subject", sip->sip_subject->g_string); } diff --git a/src/mod/endpoints/mod_sofia/test/conf-nuafail/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf-nuafail/freeswitch.xml index 324d74b2de..d7184b304a 100644 --- a/src/mod/endpoints/mod_sofia/test/conf-nuafail/freeswitch.xml +++ b/src/mod/endpoints/mod_sofia/test/conf-nuafail/freeswitch.xml @@ -65,7 +65,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="170.0.0.1"/> <param name="sip-ip" value="170.0.0.1"/> <param name="ext-rtp-ip" value="170.0.0.1"/> diff --git a/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml index d20625f77f..0c1c01bf5c 100644 --- a/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml +++ b/src/mod/endpoints/mod_sofia/test/conf-sipp/freeswitch.xml @@ -386,7 +386,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> @@ -428,7 +427,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> @@ -511,7 +509,6 @@ <param name="nonce-ttl" value="60"/> <param name="auth-calls" value="false"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) --> <!-- DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS! --> diff --git a/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml index d58f45b983..fa626af93e 100644 --- a/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml +++ b/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml @@ -78,7 +78,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c index a460586ff3..ef45af0ea3 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c @@ -826,20 +826,12 @@ switch_hash_t *create_default_filter() switch_core_hash_insert(filter, "variable_rtp_secure_media_confirmed", "1"); switch_core_hash_insert(filter, "variable_rtp_secure_media_confirmed_audio", "1"); switch_core_hash_insert(filter, "variable_rtp_secure_media_confirmed_video", "1"); - switch_core_hash_insert(filter, "variable_zrtp_secure_media", "1"); - switch_core_hash_insert(filter, "variable_zrtp_secure_media_confirmed", "1"); - switch_core_hash_insert(filter, "variable_zrtp_secure_media_confirmed_audio", "1"); - switch_core_hash_insert(filter, "variable_zrtp_secure_media_confirmed_video", "1"); switch_core_hash_insert(filter, "sdp_secure_savp_only", "1"); switch_core_hash_insert(filter, "rtp_has_crypto", "1"); switch_core_hash_insert(filter, "rtp_secure_media", "1"); switch_core_hash_insert(filter, "rtp_secure_media_confirmed", "1"); switch_core_hash_insert(filter, "rtp_secure_media_confirmed_audio", "1"); switch_core_hash_insert(filter, "rtp_secure_media_confirmed_video", "1"); - switch_core_hash_insert(filter, "zrtp_secure_media", "1"); - switch_core_hash_insert(filter, "zrtp_secure_media_confirmed", "1"); - switch_core_hash_insert(filter, "zrtp_secure_media_confirmed_audio", "1"); - switch_core_hash_insert(filter, "zrtp_secure_media_confirmed_video", "1"); /* Device Redirect headers */ switch_core_hash_insert(filter, "variable_last_bridge_hangup_cause", "1"); diff --git a/src/switch_channel.c b/src/switch_channel.c index 7c5ae934b3..ea3f66c246 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3501,61 +3501,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi return SWITCH_STATUS_FALSE; } -SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) -{ - - if (!switch_channel_test_flag(channel, CF_ZRTP_PASSTHRU) - && switch_channel_test_flag(channel, CF_ZRTP_PASSTHRU_REQ) - && switch_channel_test_flag(channel, CF_ZRTP_HASH)) { - switch_core_session_t *other_session; - switch_channel_t *other_channel; - int doit = 1; - - if (switch_core_session_get_partner(channel->session, &other_session) == SWITCH_STATUS_SUCCESS) { - other_channel = switch_core_session_get_channel(other_session); - - if (switch_channel_test_flag(other_channel, CF_ZRTP_HASH) && !switch_channel_test_flag(other_channel, CF_ZRTP_PASSTHRU)) { - - switch_channel_set_flag(channel, CF_ZRTP_PASSTHRU); - switch_channel_set_flag(other_channel, CF_ZRTP_PASSTHRU); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, - "%s Activating ZRTP passthru mode.\n", switch_channel_get_name(channel)); - - switch_channel_set_variable(channel, "zrtp_passthru_active", "true"); - switch_channel_set_variable(other_channel, "zrtp_passthru_active", "true"); - switch_channel_set_variable(channel, "zrtp_secure_media", "false"); - switch_channel_set_variable(other_channel, "zrtp_secure_media", "false"); - doit = 0; - } - - switch_core_session_rwunlock(other_session); - } - - if (doit) { - switch_channel_set_variable(channel, "zrtp_passthru_active", "false"); - switch_channel_set_variable(channel, "zrtp_secure_media", "true"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, - "%s ZRTP not negotiated on both sides; disabling ZRTP passthru mode.\n", switch_channel_get_name(channel)); - - switch_channel_clear_flag(channel, CF_ZRTP_PASSTHRU); - switch_channel_clear_flag(channel, CF_ZRTP_HASH); - - if (switch_core_session_get_partner(channel->session, &other_session) == SWITCH_STATUS_SUCCESS) { - other_channel = switch_core_session_get_channel(other_session); - - switch_channel_set_variable(other_channel, "zrtp_passthru_active", "false"); - switch_channel_set_variable(other_channel, "zrtp_secure_media", "true"); - switch_channel_clear_flag(other_channel, CF_ZRTP_PASSTHRU); - switch_channel_clear_flag(other_channel, CF_ZRTP_HASH); - - switch_core_session_rwunlock(other_session); - } - - } - } -} - SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line) { switch_event_t *event; @@ -3566,7 +3511,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_core_media_check_dtls(channel->session, SWITCH_MEDIA_TYPE_AUDIO); - switch_channel_check_zrtp(channel); switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name); switch_channel_set_flag(channel, CF_EARLY_MEDIA); @@ -3872,7 +3816,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_mutex_unlock(channel->profile_mutex); } - switch_channel_check_zrtp(channel); switch_channel_set_flag(channel, CF_ANSWERED); if (switch_true(switch_channel_get_variable(channel, "video_mirror_input"))) { diff --git a/src/switch_core.c b/src/switch_core.c index 0fafbfe522..b9b92f40c7 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1788,54 +1788,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu) } -#ifdef ENABLE_ZRTP -static void switch_core_set_serial(void) -{ - char buf[13] = ""; - char path[256]; - - int fd = -1, write_fd = -1; - switch_ssize_t bytes = 0; - - switch_snprintf(path, sizeof(path), "%s%sfreeswitch.serial", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR); - - - if ((fd = open(path, O_RDONLY, 0)) < 0) { - char *ip = switch_core_get_variable_dup("local_ip_v4"); - uint32_t ipi = 0; - switch_byte_t *byte; - int i = 0; - - if (ip) { - switch_inet_pton(AF_INET, ip, &ipi); - free(ip); - ip = NULL; - } - - - byte = (switch_byte_t *) & ipi; - - for (i = 0; i < 8; i += 2) { - switch_snprintf(buf + i, sizeof(buf) - i, "%0.2x", *byte); - byte++; - } - - switch_stun_random_string(buf + 8, 4, "0123456789abcdef"); - - if ((write_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) >= 0) { - bytes = write(write_fd, buf, sizeof(buf)); - bytes++; - close(write_fd); - } - } else { - bytes = read(fd, buf, sizeof(buf) - 1); - close(fd); - } - - switch_core_set_variable("switch_serial", buf); -} -#endif - SWITCH_DECLARE(int) switch_core_test_flag(int flag) { return switch_test_flag((&runtime), flag); @@ -1993,9 +1945,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_core_set_variable("cache_dir", SWITCH_GLOBAL_dirs.cache_dir); switch_core_set_variable("data_dir", SWITCH_GLOBAL_dirs.data_dir); switch_core_set_variable("localstate_dir", SWITCH_GLOBAL_dirs.localstate_dir); -#ifdef ENABLE_ZRTP - switch_core_set_serial(); -#endif switch_console_init(runtime.memory_pool); switch_event_init(runtime.memory_pool); switch_channel_global_init(runtime.memory_pool); @@ -2381,10 +2330,6 @@ static void switch_load_core_config(const char *file) } else { runtime.odbc_dbtype = DBTYPE_DEFAULT; } -#ifdef ENABLE_ZRTP - } else if (!strcasecmp(var, "rtp-enable-zrtp")) { - switch_core_set_variable("zrtp_enabled", val); -#endif } else if (!strcasecmp(var, "switchname") && !zstr(val)) { runtime.switchname = switch_core_strdup(runtime.memory_pool, val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Set switchname to %s\n", runtime.switchname); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d1397a833e..0754494ee3 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -43,7 +43,6 @@ #include <stdbool.h> static switch_t38_options_t * switch_core_media_process_udptl(switch_core_session_t *session, sdp_session_t *sdp, sdp_media_t *m); -static void switch_core_media_find_zrtp_hash(switch_core_session_t *session, sdp_session_t *sdp); static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp, switch_sdp_type_t sdp_type); static void gen_ice(switch_core_session_t *session, switch_media_type_t type, const char *ip, switch_port_t port); //#define GOOGLE_ICE @@ -149,10 +148,6 @@ typedef struct switch_rtp_engine_s { switch_port_t proxy_sdp_port; - /** ZRTP **/ - char *local_sdp_zrtp_hash; - char *remote_sdp_zrtp_hash; - payload_map_t *cur_payload_map; payload_map_t *payload_map; payload_map_t *pmap_tail; @@ -369,39 +364,6 @@ static int get_channels(const char *name, int dft) return dft ? dft : 1; } -static void _switch_core_media_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core_session_t *bleg_session, switch_media_type_t type) -{ - switch_rtp_engine_t *aleg_engine; - switch_rtp_engine_t *bleg_engine; - - if (!aleg_session->media_handle || !bleg_session->media_handle) return; - aleg_engine = &aleg_session->media_handle->engines[type]; - bleg_engine = &bleg_session->media_handle->engines[type]; - - - - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG1, - "Deciding whether to pass zrtp-hash between a-leg and b-leg\n"); - - if (!(switch_channel_test_flag(aleg_session->channel, CF_ZRTP_PASSTHRU_REQ))) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG1, - "CF_ZRTP_PASSTHRU_REQ not set on a-leg, so not propagating zrtp-hash\n"); - return; - } - - if (aleg_engine->remote_sdp_zrtp_hash) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG, "Passing a-leg remote zrtp-hash (audio) to b-leg\n"); - bleg_engine->local_sdp_zrtp_hash = switch_core_session_strdup(bleg_session, aleg_engine->remote_sdp_zrtp_hash); - switch_channel_set_variable(bleg_session->channel, "l_sdp_audio_zrtp_hash", bleg_engine->local_sdp_zrtp_hash); - } - - if (bleg_engine->remote_sdp_zrtp_hash) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG, "Passing b-leg remote zrtp-hash (audio) to a-leg\n"); - aleg_engine->local_sdp_zrtp_hash = switch_core_session_strdup(aleg_session, bleg_engine->remote_sdp_zrtp_hash); - switch_channel_set_variable(aleg_session->channel, "l_sdp_audio_zrtp_hash", aleg_engine->local_sdp_zrtp_hash); - } -} - SWITCH_DECLARE(uint32_t) switch_core_media_get_video_fps(switch_core_session_t *session) { switch_media_handle_t *smh; @@ -445,101 +407,6 @@ SWITCH_DECLARE(uint32_t) switch_core_media_get_video_fps(switch_core_session_t * return fps; } -SWITCH_DECLARE(void) switch_core_media_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core_session_t *bleg_session) -{ - _switch_core_media_pass_zrtp_hash2(aleg_session, bleg_session, SWITCH_MEDIA_TYPE_AUDIO); - _switch_core_media_pass_zrtp_hash2(aleg_session, bleg_session, SWITCH_MEDIA_TYPE_VIDEO); - _switch_core_media_pass_zrtp_hash2(aleg_session, bleg_session, SWITCH_MEDIA_TYPE_TEXT); -} - - -SWITCH_DECLARE(void) switch_core_media_pass_zrtp_hash(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - - switch_core_session_t *other_session; - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "Deciding whether to pass zrtp-hash between legs\n"); - if (!(switch_channel_test_flag(channel, CF_ZRTP_PASSTHRU_REQ))) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "CF_ZRTP_PASSTHRU_REQ not set, so not propagating zrtp-hash\n"); - return; - } else if (!(switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "No partner channel found, so not propagating zrtp-hash\n"); - return; - } else { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "Found peer channel; propagating zrtp-hash if set\n"); - switch_core_media_pass_zrtp_hash2(session, other_session); - switch_core_session_rwunlock(other_session); - } -} - -SWITCH_DECLARE(const char *) switch_core_media_get_zrtp_hash(switch_core_session_t *session, switch_media_type_t type, switch_bool_t local) -{ - switch_rtp_engine_t *engine; - if (!session->media_handle) return NULL; - - engine = &session->media_handle->engines[type]; - - if (local) { - return engine->local_sdp_zrtp_hash; - } - - - return engine->remote_sdp_zrtp_hash; - -} - -static void switch_core_media_find_zrtp_hash(switch_core_session_t *session, sdp_session_t *sdp) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_rtp_engine_t *audio_engine; - switch_rtp_engine_t *video_engine; - switch_rtp_engine_t *text_engine; - sdp_media_t *m; - sdp_attribute_t *attr; - int got_audio = 0, got_video = 0, got_text = 0; - - if (!session->media_handle) return; - - audio_engine = &session->media_handle->engines[SWITCH_MEDIA_TYPE_AUDIO]; - video_engine = &session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO]; - text_engine = &session->media_handle->engines[SWITCH_MEDIA_TYPE_TEXT]; - - - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "Looking for zrtp-hash\n"); - for (m = sdp->sdp_media; m; m = m->m_next) { - if (got_audio && got_video && got_text) break; - if (m->m_port && ((m->m_type == sdp_media_audio && !got_audio) - || (m->m_type == sdp_media_video && !got_video))) { - for (attr = m->m_attributes; attr; attr = attr->a_next) { - if (zstr(attr->a_name)) continue; - if (strcasecmp(attr->a_name, "zrtp-hash") || !(attr->a_value)) continue; - if (m->m_type == sdp_media_audio) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, - "Found audio zrtp-hash; setting r_sdp_audio_zrtp_hash=%s\n", attr->a_value); - switch_channel_set_variable(channel, "r_sdp_audio_zrtp_hash", attr->a_value); - audio_engine->remote_sdp_zrtp_hash = switch_core_session_strdup(session, attr->a_value); - got_audio++; - } else if (m->m_type == sdp_media_video) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, - "Found video zrtp-hash; setting r_sdp_video_zrtp_hash=%s\n", attr->a_value); - switch_channel_set_variable(channel, "r_sdp_video_zrtp_hash", attr->a_value); - video_engine->remote_sdp_zrtp_hash = switch_core_session_strdup(session, attr->a_value); - got_video++; - } else if (m->m_type == sdp_media_text) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, - "Found text zrtp-hash; setting r_sdp_video_zrtp_hash=%s\n", attr->a_value); - switch_channel_set_variable(channel, "r_sdp_text_zrtp_hash", attr->a_value); - text_engine->remote_sdp_zrtp_hash = switch_core_session_strdup(session, attr->a_value); - got_text++; - } - switch_channel_set_flag(channel, CF_ZRTP_HASH); - break; - } - } - } -} - - static switch_t38_options_t * switch_core_media_process_udptl(switch_core_session_t *session, sdp_session_t *sdp, sdp_media_t *m) { switch_t38_options_t *t38_options = switch_channel_get_private(session->channel, "t38_options"); @@ -5043,9 +4910,6 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s switch_channel_set_variable(session->channel, "t38_broken_boolean", "true"); } - switch_core_media_find_zrtp_hash(session, sdp); - switch_core_media_pass_zrtp_hash(session); - check_ice(smh, SWITCH_MEDIA_TYPE_AUDIO, sdp, NULL); check_ice(smh, SWITCH_MEDIA_TYPE_VIDEO, sdp, NULL); check_ice(smh, SWITCH_MEDIA_TYPE_TEXT, sdp, NULL); @@ -9143,16 +9007,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi switch_channel_set_variable(session->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp); - if (switch_channel_test_flag(session->channel, CF_ZRTP_PASSTHRU)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating ZRTP PROXY MODE\n"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Disable NOTIMER_DURING_BRIDGE\n"); - switch_channel_clear_flag(session->channel, CF_NOTIMER_DURING_BRIDGE); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Activating audio UDPTL mode\n"); - switch_rtp_udptl_mode(a_engine->rtp_session); - } - - - text: //if (switch_channel_test_flag(session->channel, CF_MSRP)) { // skip RTP RTT @@ -9450,12 +9304,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi switch_core_session_apply_crypto(session, SWITCH_MEDIA_TYPE_TEXT); - - if (switch_channel_test_flag(session->channel, CF_ZRTP_PASSTHRU)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Activating text UDPTL mode\n"); - switch_rtp_udptl_mode(t_engine->rtp_session); - } - } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TEXT RTP REPORTS ERROR: [%s]\n", switch_str_nil(err)); switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -9779,11 +9627,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi switch_core_session_apply_crypto(session, SWITCH_MEDIA_TYPE_VIDEO); - if (switch_channel_test_flag(session->channel, CF_ZRTP_PASSTHRU)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Activating video UDPTL mode\n"); - switch_rtp_udptl_mode(v_engine->rtp_session); - } - } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err)); switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); @@ -9876,7 +9719,6 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, int rate; int already_did[128] = { 0 }; int ptime = 0, noptime = 0; - const char *local_sdp_audio_zrtp_hash; switch_media_handle_t *smh; switch_rtp_engine_t *a_engine; int include_external; @@ -10232,13 +10074,6 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=ptime:%d\r\n", cur_ptime); } - local_sdp_audio_zrtp_hash = switch_core_media_get_zrtp_hash(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_TRUE); - - if (local_sdp_audio_zrtp_hash) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Adding audio a=zrtp-hash:%s\n", local_sdp_audio_zrtp_hash); - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=zrtp-hash:%s\r\n", local_sdp_audio_zrtp_hash); - } - if (!zstr(sr)) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=%s\r\n", sr); } @@ -10386,9 +10221,6 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_event_t *map = NULL, *ptmap = NULL; //const char *b_sdp = NULL; //const char *local_audio_crypto_key = switch_core_session_local_crypto_key(session, SWITCH_MEDIA_TYPE_AUDIO); - const char *local_sdp_audio_zrtp_hash = switch_core_media_get_zrtp_hash(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_TRUE); - const char *local_sdp_video_zrtp_hash = switch_core_media_get_zrtp_hash(session, SWITCH_MEDIA_TYPE_VIDEO, SWITCH_TRUE); - const char *local_sdp_text_zrtp_hash = switch_core_media_get_zrtp_hash(session, SWITCH_MEDIA_TYPE_TEXT, SWITCH_TRUE); const char *tmp; switch_rtp_engine_t *a_engine, *v_engine, *t_engine; switch_media_handle_t *smh; @@ -10825,13 +10657,6 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess } - if (local_sdp_audio_zrtp_hash) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Adding audio a=zrtp-hash:%s\r\n", - local_sdp_audio_zrtp_hash); - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=zrtp-hash:%s\r\n", - local_sdp_audio_zrtp_hash); - } - if (!zstr(sr)) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=%s\r\n", sr); } @@ -11505,12 +11330,6 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess } - if (local_sdp_video_zrtp_hash) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Adding video a=zrtp-hash:%s\n", local_sdp_video_zrtp_hash); - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=zrtp-hash:%s\r\n", local_sdp_video_zrtp_hash); - } - - if (switch_channel_test_flag(session->channel, CF_DTLS) || !switch_channel_test_flag(session->channel, CF_SECURE) || smh->crypto_mode == CRYPTO_MODE_MANDATORY || smh->crypto_mode == CRYPTO_MODE_FORBIDDEN) { @@ -11852,12 +11671,6 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess } - if (local_sdp_text_zrtp_hash) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Adding text a=zrtp-hash:%s\n", local_sdp_text_zrtp_hash); - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=zrtp-hash:%s\r\n", local_sdp_text_zrtp_hash); - } - - if (switch_channel_test_flag(session->channel, CF_DTLS) || !switch_channel_test_flag(session->channel, CF_SECURE) || smh->crypto_mode == CRYPTO_MODE_MANDATORY || smh->crypto_mode == CRYPTO_MODE_FORBIDDEN) { @@ -13771,9 +13584,6 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess } } - switch_core_media_find_zrtp_hash(session, sdp); - switch_core_media_pass_zrtp_hash(session); - for (m = sdp->sdp_media; m; m = m->m_next) { ptime = dptime; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index a590f7467c..2cfdee869d 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -743,10 +743,6 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } } - if (switch_channel_test_flag(channel, CF_ZRTP_PASSTHRU_REQ)) { - switch_channel_set_flag(peer_channel, CF_ZRTP_PASSTHRU_REQ); - } - if (profile) { if ((cloned_profile = switch_caller_profile_clone(*new_session, profile)) != 0) { switch_channel_set_originator_caller_profile(peer_channel, cloned_profile); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 63a0911929..31b326bc1f 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2139,7 +2139,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } if (session) { - const char *to_var, *bypass_media = NULL, *proxy_media = NULL, *zrtp_passthru = NULL; + const char *to_var, *bypass_media = NULL, *proxy_media = NULL; switch_channel_set_flag(caller_channel, CF_ORIGINATOR); oglobals.session = session; @@ -2154,7 +2154,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess proxy_media = switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE); bypass_media = switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE); - zrtp_passthru = switch_channel_get_variable(caller_channel, SWITCH_ZRTP_PASSTHRU_VARIABLE); if (!zstr(proxy_media)) { if (switch_true(proxy_media)) { @@ -2164,14 +2163,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } - if (!zstr(zrtp_passthru)) { - if (switch_true(zrtp_passthru)) { - switch_channel_set_flag(caller_channel, CF_ZRTP_PASSTHRU_REQ); - } else if (switch_channel_test_flag(caller_channel, CF_ZRTP_PASSTHRU_REQ)) { - switch_channel_clear_flag(caller_channel, CF_ZRTP_PASSTHRU_REQ); - } - } - if (bypass_media && switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(caller_channel, CF_ANSWERED)) { switch_core_session_message_t msg = { 0 }; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e9f2c53c81..e8a3d30da1 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -78,7 +78,6 @@ #define WARN_SRTP_ERRS 10 #define MAX_SRTP_ERRS 100 #define NTP_TIME_OFFSET 2208988800UL -#define ZRTP_MAGIC_COOKIE 0x5a525450 static const switch_payload_t INVALID_PT = 255; #define DTMF_SANITY (rtp_session->one_second * 30) @@ -97,17 +96,6 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_ typedef srtp_hdr_t rtp_hdr_t; -#ifdef ENABLE_ZRTP -#include "zrtp.h" -static zrtp_global_t *zrtp_global; -#ifndef WIN32 -static zrtp_zid_t zid = { "FreeSWITCH01" }; -#else -static zrtp_zid_t zid = { "FreeSWITCH0" }; -#endif -static int zrtp_on = 0; -#define ZRTP_MITM_TRIES 100 -#endif #ifdef _MSC_VER #pragma pack(4) @@ -495,14 +483,6 @@ struct switch_rtp { uint32_t last_max_vb_frames; int skip_timer; uint32_t prev_nacks_inflight; -#ifdef ENABLE_ZRTP - zrtp_session_t *zrtp_session; - zrtp_profile_t *zrtp_profile; - zrtp_stream_t *zrtp_stream; - int zrtp_mitm_tries; - int zinit; -#endif - }; struct switch_rtcp_report_block { @@ -1348,158 +1328,6 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d READ_DEC(rtp_session); } -#ifdef ENABLE_ZRTP -SWITCH_STANDARD_SCHED_FUNC(zrtp_cache_save_callback) -{ - zrtp_status_t status = zrtp_status_ok; - - status = zrtp_def_cache_store(zrtp_global); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Saving ZRTP cache: %s\n", zrtp_status_ok == status ? "OK" : "FAIL"); - task->runtime = switch_epoch_time_now(NULL) + 900; -} - -static int zrtp_send_rtp_callback(const zrtp_stream_t *stream, char *rtp_packet, unsigned int rtp_packet_length) -{ - switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream); - switch_size_t len = rtp_packet_length; - zrtp_status_t status = zrtp_status_ok; - - if (!rtp_session->sock_output) { - return status; - } - - switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, rtp_packet, &len); - return status; -} - -static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event) -{ - switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream); - zrtp_session_info_t zrtp_session_info; - - switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session); - switch_event_t *fsevent = NULL; - const char *type; - - type = rtp_type(rtp_session); - - switch (event) { - case ZRTP_EVENT_IS_SECURE: - { - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_SEND] = 1; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_RECV] = 1; - if (!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_SEND] = 1; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV] = 1; - } - if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { - if (zrtp_session_info.sas_is_ready) { - - switch_channel_set_variable_name_printf(channel, "true", "zrtp_secure_media_confirmed_%s", type); - switch_channel_set_variable_name_printf(channel, stream->session->sas1.buffer, "zrtp_sas1_string_%s", type); - switch_channel_set_variable_name_printf(channel, stream->session->sas2.buffer, "zrtp_sas2_string", type); - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)1); - } - } - - if (!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { - - - if (rtp_session->session) { - switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session); - switch_rtp_t *video_rtp_session = switch_channel_get_private(channel, "__zrtp_video_rtp_session"); - - if (!video_rtp_session) { - video_rtp_session = switch_channel_get_private_partner(channel, "__zrtp_video_rtp_session"); - } - - if (video_rtp_session) { - if (zrtp_status_ok != zrtp_stream_attach(stream->session, &video_rtp_session->zrtp_stream)) { - abort(); - } - zrtp_stream_set_userdata(video_rtp_session->zrtp_stream, video_rtp_session); - if (switch_true(switch_channel_get_variable(channel, "zrtp_enrollment"))) { - zrtp_stream_registration_start(video_rtp_session->zrtp_stream, video_rtp_session->ssrc); - } else { - zrtp_stream_start(video_rtp_session->zrtp_stream, video_rtp_session->ssrc); - } - } - } - } - - if (switch_event_create(&fsevent, SWITCH_EVENT_CALL_SECURE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_media_type", "%s", type); - switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "zrtp:%s:%s", stream->session->sas1.buffer, - stream->session->sas2.buffer); - switch_event_add_header_string(fsevent, SWITCH_STACK_BOTTOM, "caller-unique-id", switch_channel_get_uuid(channel)); - switch_event_fire(&fsevent); - } - } - break; -#if 0 - case ZRTP_EVENT_NO_ZRTP_QUICK: - { - if (stream != NULL) { - zrtp_stream_stop(stream); - } - } - break; -#endif - case ZRTP_EVENT_IS_CLIENT_ENROLLMENT: - { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Enrolled complete!\n"); - switch_channel_set_variable_name_printf(channel, "true", "zrtp_enroll_complete_%s", type); - } - break; - - case ZRTP_EVENT_USER_ALREADY_ENROLLED: - { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "User already enrolled!\n"); - switch_channel_set_variable_name_printf(channel, "true", "zrtp_already_enrolled_%s", type); - } - break; - - case ZRTP_EVENT_NEW_USER_ENROLLED: - { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "New user enrolled!\n"); - switch_channel_set_variable_name_printf(channel, "true", "zrtp_new_user_enrolled_%s", type); - } - break; - - case ZRTP_EVENT_USER_UNENROLLED: - { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "User unenrolled!\n"); - switch_channel_set_variable_name_printf(channel, "true", "zrtp_user_unenrolled_%s", type); - } - break; - - case ZRTP_EVENT_IS_PENDINGCLEAR: - { - switch_channel_set_variable_name_printf(channel, "false", "zrtp_secure_media_confirmed_%s", type); - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_SEND] = 0; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_RECV] = 0; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_SEND] = 0; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV] = 0; - rtp_session->zrtp_mitm_tries = 0; - } - break; - - case ZRTP_EVENT_NO_ZRTP: - { - switch_channel_set_variable_name_printf(channel, "false", "zrtp_secure_media_confirmed_%s", type); - } - break; - - default: - break; - } -} - -static void zrtp_logger(int level, const char *data, int len, int offset) -{ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s", data); -} -#endif #ifdef ENABLE_SRTP SWITCH_DECLARE(void) switch_srtp_err_to_txt(srtp_err_status_t stat, char **msg) @@ -1538,45 +1366,10 @@ SWITCH_DECLARE(void) switch_srtp_err_to_txt(srtp_err_status_t stat, char **msg) SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool) { -#ifdef ENABLE_ZRTP - const char *zid_string = switch_core_get_variable_pdup("switch_serial", pool); - const char *zrtp_enabled = switch_core_get_variable_pdup("zrtp_enabled", pool); - zrtp_config_t zrtp_config; - char zrtp_cache_path[256] = ""; - zrtp_on = zrtp_enabled ? switch_true(zrtp_enabled) : 0; -#endif if (global_init) { return; } switch_core_hash_init(&alloc_hash); -#ifdef ENABLE_ZRTP - if (zrtp_on) { - uint32_t cache_len; - zrtp_config_defaults(&zrtp_config); - strcpy(zrtp_config.client_id, "FreeSWITCH"); - zrtp_config.is_mitm = 1; - zrtp_config.lic_mode = ZRTP_LICENSE_MODE_ACTIVE; - switch_snprintf(zrtp_cache_path, sizeof(zrtp_cache_path), "%s%szrtp.dat", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR); - cache_len=(uint32_t)strlen(zrtp_cache_path); - ZSTR_SET_EMPTY(zrtp_config.def_cache_path); - zrtp_config.def_cache_path.length = cache_len > zrtp_config.def_cache_path.max_length ? zrtp_config.def_cache_path.max_length : (uint16_t)cache_len; - strncpy(zrtp_config.def_cache_path.buffer, zrtp_cache_path, zrtp_config.def_cache_path.max_length); - zrtp_config.cb.event_cb.on_zrtp_protocol_event = (void (*)(zrtp_stream_t*,zrtp_protocol_event_t))zrtp_event_callback; - zrtp_config.cb.misc_cb.on_send_packet = zrtp_send_rtp_callback; - zrtp_config.cb.event_cb.on_zrtp_security_event = (void (*)(zrtp_stream_t*,zrtp_security_event_t))zrtp_event_callback; - zrtp_log_set_log_engine((zrtp_log_engine *) zrtp_logger); - zrtp_log_set_level(4); - if (zrtp_status_ok == zrtp_init(&zrtp_config, &zrtp_global)) { - memcpy(zid, zid_string, 12); - switch_scheduler_add_task(switch_epoch_time_now(NULL) + 900, zrtp_cache_save_callback, "zrtp_cache_save", "core", 0, NULL, - SSHF_NONE | SSHF_NO_DEL); - } else { - switch_core_set_variable("zrtp_enabled", NULL); - zrtp_on = 0; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "ZRTP init failed!\n"); - } - } -#endif #ifdef ENABLE_SRTP { srtp_err_status_t stat = srtp_init(); @@ -2544,32 +2337,6 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) switch_mutex_unlock(rtp_session->ice_mutex); #endif -#ifdef ENABLE_ZRTP - /* ZRTP Send */ - if (zrtp_on && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) { - unsigned int sbytes = (int) rtcp_bytes; - zrtp_status_t stat = zrtp_status_fail; - - stat = zrtp_process_rtcp(rtp_session->zrtp_stream, (void *) &rtp_session->rtcp_send_msg, &sbytes); - - switch (stat) { - case zrtp_status_ok: - break; - case zrtp_status_drop: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); - ret = (int)rtcp_bytes; - goto end; - break; - case zrtp_status_fail: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); - break; - default: - break; - } - - rtcp_bytes = sbytes; - } -#endif //#define DEBUG_EXTRA #ifdef DEBUG_EXTRA { @@ -2651,15 +2418,6 @@ SWITCH_DECLARE(void) switch_rtp_shutdown(void) switch_core_hash_destroy(&alloc_hash); switch_mutex_unlock(port_lock); -#ifdef ENABLE_ZRTP - if (zrtp_on) { - zrtp_status_t status = zrtp_status_ok; - - status = zrtp_def_cache_store(zrtp_global); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Saving ZRTP cache: %s\n", zrtp_status_ok == status ? "OK" : "FAIL"); - zrtp_down(zrtp_global); - } -#endif #ifdef ENABLE_SRTP srtp_crypto_kernel_shutdown(); #endif @@ -4650,73 +4408,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session switch_channel_set_private(channel, "__rtcp_audio_rtp_session", rtp_session); } -#ifdef ENABLE_ZRTP - if (zrtp_on && session && channel && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) { - switch_rtp_t *master_rtp_session = NULL; - - int initiator = 0; - const char *zrtp_enabled = switch_channel_get_variable(channel, "zrtp_secure_media"); - int srtp_enabled = switch_channel_test_flag(channel, CF_SECURE); - - if (srtp_enabled && switch_true(zrtp_enabled)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, - "You can not have ZRTP and SRTP enabled simultaneously, ZRTP will be disabled for this call!\n"); - switch_channel_set_variable(channel, "zrtp_secure_media", NULL); - zrtp_enabled = NULL; - } - - - if (switch_true(zrtp_enabled)) { - if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { - switch_channel_set_private(channel, "__zrtp_video_rtp_session", rtp_session); - master_rtp_session = switch_channel_get_private(channel, "__zrtp_audio_rtp_session"); - } else { - switch_channel_set_private(channel, "__zrtp_audio_rtp_session", rtp_session); - master_rtp_session = rtp_session; - } - - - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - initiator = 1; - } - - if (rtp_session == master_rtp_session) { - rtp_session->zrtp_profile = switch_core_alloc(rtp_session->pool, sizeof(*rtp_session->zrtp_profile)); - zrtp_profile_defaults(rtp_session->zrtp_profile, zrtp_global); - - rtp_session->zrtp_profile->allowclear = 0; - rtp_session->zrtp_profile->disclose_bit = 0; - rtp_session->zrtp_profile->cache_ttl = (uint32_t) -1; - - if (zrtp_status_ok != zrtp_session_init(zrtp_global, rtp_session->zrtp_profile, zid, initiator, &rtp_session->zrtp_session)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! zRTP INIT Failed\n"); - zrtp_session_down(rtp_session->zrtp_session); - rtp_session->zrtp_session = NULL; - goto end; - } - - zrtp_session_set_userdata(rtp_session->zrtp_session, session); - - - if (zrtp_status_ok != zrtp_stream_attach(master_rtp_session->zrtp_session, &rtp_session->zrtp_stream)) { - abort(); - } - - zrtp_stream_set_userdata(rtp_session->zrtp_stream, rtp_session); - - if (switch_true(switch_channel_get_variable(channel, "zrtp_enrollment"))) { - zrtp_stream_registration_start(rtp_session->zrtp_stream, rtp_session->ssrc); - } else { - zrtp_stream_start(rtp_session->zrtp_stream, rtp_session->ssrc); - } - } - - } - } - - end: - -#endif /* Jitter */ rtp_session->stats.inbound.last_proc_time = switch_micro_time_now() / 1000; @@ -5418,28 +5109,6 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session) } #endif -#ifdef ENABLE_ZRTP - /* ZRTP */ - if (zrtp_on && !(*rtp_session)->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) { - - if ((*rtp_session)->zrtp_stream != NULL) { - zrtp_stream_stop((*rtp_session)->zrtp_stream); - } - - if ((*rtp_session)->flags[SWITCH_ZRTP_FLAG_SECURE_SEND]) { - (*rtp_session)->flags[SWITCH_ZRTP_FLAG_SECURE_SEND] = 0; - } - - if ((*rtp_session)->flags[SWITCH_ZRTP_FLAG_SECURE_RECV]) { - (*rtp_session)->flags[SWITCH_ZRTP_FLAG_SECURE_RECV] = 0; - } - - if ((*rtp_session)->zrtp_session) { - zrtp_session_down((*rtp_session)->zrtp_session); - (*rtp_session)->zrtp_session = NULL; - } - } -#endif if ((*rtp_session)->timer.timer_interface) { switch_core_timer_destroy(&(*rtp_session)->timer); } @@ -6057,8 +5726,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t if (*bytes) { b = (unsigned char *) &rtp_session->recv_msg; - /* version 2 probably rtp, zrtp cookie present means zrtp */ - rtp_session->has_rtp = (rtp_session->recv_msg.header.version == 2 || ntohl(*(int *)(b+4)) == ZRTP_MAGIC_COOKIE); + /* version 2 probably rtp */ + rtp_session->has_rtp = (rtp_session->recv_msg.header.version == 2); if (rtp_session->media_timeout) { rtp_session->last_media = switch_micro_time_now(); @@ -6128,11 +5797,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t switch_mutex_lock(rtp_session->flag_mutex); for (pmap = *rtp_session->pmaps; pmap && pmap->allocated; pmap = pmap->next) { - if (ntohl(*(int *)(b+4)) == ZRTP_MAGIC_COOKIE) { - accept_packet = 1; - break; - } - if (!pmap->negotiated) { continue; } @@ -6379,31 +6043,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t if (*bytes) { if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) { -#ifdef ENABLE_ZRTP - /* ZRTP Recv */ - if (zrtp_on) { - - unsigned int sbytes = (int) *bytes; - zrtp_status_t stat = 0; - - stat = zrtp_process_srtp(rtp_session->zrtp_stream, (void *) &rtp_session->recv_msg, &sbytes); - - switch (stat) { - case zrtp_status_ok: - *bytes = sbytes; - break; - case zrtp_status_drop: - /* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error: zRTP protection drop with code %d\n", stat); */ - *bytes = 0; - return SWITCH_STATUS_SUCCESS; - case zrtp_status_fail: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); - return SWITCH_STATUS_FALSE; - default: - break; - } - } -#endif #ifdef ENABLE_SRTP switch_mutex_lock(rtp_session->ice_mutex); @@ -7261,33 +6900,6 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t switch_mutex_unlock(rtp_session->ice_mutex); -#ifdef ENABLE_ZRTP - if (zrtp_on && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && rtp_session->rtcp_recv_msg_p->header.version == 2) { - /* ZRTP Recv */ - if (bytes) { - unsigned int sbytes = (int) *bytes; - zrtp_status_t stat = 0; - - stat = zrtp_process_srtcp(rtp_session->zrtp_stream, (void *) rtp_session->rtcp_recv_msg_p, &sbytes); - - switch (stat) { - case zrtp_status_ok: - *bytes = sbytes; - break; - case zrtp_status_drop: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); - *bytes = 0; - break; - case zrtp_status_fail: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); - *bytes = 0; - break; - default: - break; - } - } - } -#endif /* RTCP Auto ADJ */ if (*bytes && rtp_session->flags[SWITCH_RTP_FLAG_RTCP_AUTOADJ] && switch_sockaddr_get_port(rtp_session->rtcp_from_addr)) { @@ -7757,32 +7369,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ switch_mutex_unlock(other_rtp_session->ice_mutex); #endif -#ifdef ENABLE_ZRTP - /* ZRTP Send */ - if (zrtp_on && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) { - unsigned int sbytes = (unsigned int) bytes; - zrtp_status_t stat = zrtp_status_fail; - - stat = zrtp_process_rtcp(other_rtp_session->zrtp_stream, (void *) &other_rtp_session->rtcp_send_msg, &sbytes); - - switch (stat) { - case zrtp_status_ok: - break; - case zrtp_status_drop: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); - ret = (int) bytes; - goto end; - break; - case zrtp_status_fail: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); - break; - default: - break; - } - - bytes = sbytes; - } -#endif if (switch_socket_sendto(other_rtp_session->rtcp_sock_output, other_rtp_session->rtcp_remote_addr, 0, (const char*)&other_rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG,"RTCP packet not written\n"); @@ -8313,54 +7899,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp frame->m = rtp_session->last_rtp_hdr.m ? SWITCH_TRUE : SWITCH_FALSE; } -#ifdef ENABLE_ZRTP - if (zrtp_on && rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV]) { - zrtp_session_info_t zrtp_session_info; - - if (rtp_session->zrtp_session && (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info))) { - if (zrtp_session_info.sas_is_ready) { - - switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session); - - const char *uuid = switch_channel_get_partner_uuid(channel); - if (uuid) { - switch_core_session_t *other_session; - - if ((other_session = switch_core_session_locate(uuid))) { - switch_channel_t *other_channel = switch_core_session_get_channel(other_session); - switch_rtp_t *other_rtp_session = switch_channel_get_private(other_channel, "__zrtp_audio_rtp_session"); - - if (other_rtp_session) { - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { - switch_mutex_lock(other_rtp_session->read_mutex); - if (zrtp_status_ok == zrtp_session_get(other_rtp_session->zrtp_session, &zrtp_session_info)) { - if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) { - switch_rtp_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); - switch_rtp_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV] = 0; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_SEND] = 0; - } else if (zrtp_status_ok == zrtp_resolve_mitm_call(other_rtp_session->zrtp_stream, rtp_session->zrtp_stream)) { - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV] = 0; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_SEND] = 0; - switch_rtp_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); - switch_rtp_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - rtp_session->zrtp_mitm_tries++; - } - } - switch_mutex_unlock(other_rtp_session->read_mutex); - } - } - - switch_core_session_rwunlock(other_session); - } - } - } - } else { - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV] = 0; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_SEND] = 0; - } - } -#endif if (bytes < 0) { frame->datalen = 0; @@ -8809,33 +8347,6 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } switch_mutex_unlock(rtp_session->ice_mutex); #endif -#ifdef ENABLE_ZRTP - /* ZRTP Send */ - if (zrtp_on && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) { - unsigned int sbytes = (int) bytes; - zrtp_status_t stat = zrtp_status_fail; - - - stat = zrtp_process_rtp(rtp_session->zrtp_stream, (void *) send_msg, &sbytes); - - switch (stat) { - case zrtp_status_ok: - break; - case zrtp_status_drop: - /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Error: zRTP protection drop with code %d\n", stat); */ - ret = (int) bytes; - goto end; - break; - case zrtp_status_fail: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); - break; - default: - break; - } - - bytes = sbytes; - } -#endif now = switch_micro_time_now(); #ifdef RTP_DEBUG_WRITE_DELTA @@ -9123,49 +8634,6 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra rtp_session->stats.outbound.packet_count++; return (int) bytes; } -#ifdef ENABLE_ZRTP - if (zrtp_on && rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_SEND]) { - zrtp_session_info_t zrtp_session_info; - - if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) { - if (zrtp_session_info.sas_is_ready) { - - switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session); - - const char *uuid = switch_channel_get_partner_uuid(channel); - if (uuid) { - switch_core_session_t *other_session; - - if ((other_session = switch_core_session_locate(uuid))) { - switch_channel_t *other_channel = switch_core_session_get_channel(other_session); - switch_rtp_t *other_rtp_session = switch_channel_get_private(other_channel, "__zrtp_audio_rtp_session"); - - - if (other_rtp_session) { - if (zrtp_status_ok == zrtp_session_get(other_rtp_session->zrtp_session, &zrtp_session_info)) { - if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) { - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV] = 0; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_SEND] = 0; - switch_rtp_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); - switch_rtp_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - } else if (zrtp_status_ok == zrtp_resolve_mitm_call(other_rtp_session->zrtp_stream, rtp_session->zrtp_stream)) { - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV] = 0; - rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_SEND] = 0; - switch_rtp_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); - switch_rtp_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - rtp_session->zrtp_mitm_tries++; - } - rtp_session->zrtp_mitm_tries++; - } - } - - switch_core_session_rwunlock(other_session); - } - } - } - } - } -#endif fwd = (rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] && (switch_test_flag(frame, SFF_RAW_RTP) || switch_test_flag(frame, SFF_RAW_RTP_PARSE_FRAME))) ? 1 : 0; @@ -9400,37 +8868,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, *bytes = sbytes; } switch_mutex_unlock(rtp_session->ice_mutex); -#endif -#ifdef ENABLE_ZRTP - /* ZRTP Send */ - if (zrtp_on && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) { - unsigned int sbytes = (int) *bytes; - zrtp_status_t stat = zrtp_status_fail; - - stat = zrtp_process_rtp(rtp_session->zrtp_stream, (void *) &rtp_session->write_msg, &sbytes); - - switch (stat) { - case zrtp_status_ok: - break; - case zrtp_status_drop: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); - status = SWITCH_STATUS_SUCCESS; - goto end; - break; - case zrtp_status_fail: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); - break; - default: - break; - } - - *bytes = sbytes; - } #endif } status = switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, data, bytes); -#if defined(ENABLE_SRTP) || defined(ENABLE_ZRTP) +#if defined(ENABLE_SRTP) end: #endif diff --git a/tests/unit/conf/freeswitch.xml b/tests/unit/conf/freeswitch.xml index 99609824b5..e7c185531c 100644 --- a/tests/unit/conf/freeswitch.xml +++ b/tests/unit/conf/freeswitch.xml @@ -36,7 +36,6 @@ <param name="loglevel" value="debug"/> <param name="rtp-start-port" value="1234"/> <param name="rtp-end-port" value="1234"/> - <param name="rtp-enable-zrtp" value="false"/> </settings> diff --git a/tests/unit/conf_eavesdrop/freeswitch.xml b/tests/unit/conf_eavesdrop/freeswitch.xml index 4a65caf6d8..b74d21a499 100644 --- a/tests/unit/conf_eavesdrop/freeswitch.xml +++ b/tests/unit/conf_eavesdrop/freeswitch.xml @@ -77,7 +77,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> @@ -119,7 +118,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> diff --git a/tests/unit/conf_rtp/freeswitch.xml b/tests/unit/conf_rtp/freeswitch.xml index 69130f8f82..8ac1caeefb 100644 --- a/tests/unit/conf_rtp/freeswitch.xml +++ b/tests/unit/conf_rtp/freeswitch.xml @@ -39,7 +39,6 @@ <param name="loglevel" value="debug"/> <param name="rtp-start-port" value="1234"/> <param name="rtp-end-port" value="1234"/> - <param name="rtp-enable-zrtp" value="false"/> </settings> </configuration> diff --git a/tests/unit/conf_sip/freeswitch.xml b/tests/unit/conf_sip/freeswitch.xml index df7d638124..9a992a817b 100644 --- a/tests/unit/conf_sip/freeswitch.xml +++ b/tests/unit/conf_sip/freeswitch.xml @@ -78,7 +78,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> @@ -120,7 +119,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> diff --git a/tests/unit/conf_sofia/freeswitch.xml b/tests/unit/conf_sofia/freeswitch.xml index 793ac5a04a..be3113cfaf 100644 --- a/tests/unit/conf_sofia/freeswitch.xml +++ b/tests/unit/conf_sofia/freeswitch.xml @@ -60,7 +60,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> @@ -102,7 +101,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> diff --git a/tests/unit/conf_test/freeswitch.xml b/tests/unit/conf_test/freeswitch.xml index a68c7c56e6..9097246041 100644 --- a/tests/unit/conf_test/freeswitch.xml +++ b/tests/unit/conf_test/freeswitch.xml @@ -78,7 +78,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> @@ -120,7 +119,6 @@ <param name="inbound-codec-negotiation" value="generous"/> <param name="nonce-ttl" value="60"/> <param name="inbound-late-negotiation" value="true"/> - <param name="inbound-zrtp-passthru" value="false"/> <param name="rtp-ip" value="$${local_ip_v4}"/> <param name="sip-ip" value="$${local_ip_v4}"/> <param name="ext-rtp-ip" value="$${local_ip_v4}"/> diff --git a/w32/Library/FreeSwitchCore.2017.vcxproj b/w32/Library/FreeSwitchCore.2017.vcxproj index 642a01a259..e30868d48c 100644 --- a/w32/Library/FreeSwitchCore.2017.vcxproj +++ b/w32/Library/FreeSwitchCore.2017.vcxproj @@ -128,8 +128,8 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <BuildLog /> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;ENABLE_ZRTP;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -178,8 +178,8 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;ENABLE_ZRTP;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> @@ -219,8 +219,8 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <BuildLog /> <ClCompile> <Optimization>MaxSpeed</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;ENABLE_ZRTP;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader>Create</PrecompiledHeader> <PrecompiledHeaderFile>switch.h</PrecompiledHeaderFile> @@ -257,8 +257,8 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" </Midl> <ClCompile> <Optimization>MaxSpeed</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;ENABLE_ZRTP;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader>Create</PrecompiledHeader> <PrecompiledHeaderFile>switch.h</PrecompiledHeaderFile> @@ -768,9 +768,6 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <Project>{89385c74-5860-4174-9caf-a39e7c48909c}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> - <ProjectReference Include="..\..\libs\libzrtp\projects\win\libzrtp.2017.vcxproj"> - <Project>{c13cc324-0032-4492-9a30-310a6bd64ff5}</Project> - </ProjectReference> <ProjectReference Include="..\..\libs\win32\spandsp\libspandsp.2017.vcxproj"> <Project>{1cbb0077-18c5-455f-801c-0a0ce7b0bbf5}</Project> </ProjectReference> @@ -829,4 +826,4 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project> \ No newline at end of file +</Project> From f7c94bc01d01d15c91db10d123523c958a02475f Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Fri, 28 Oct 2022 20:22:33 +0300 Subject: [PATCH 587/655] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 18 - src/mod/languages/mod_managed/managed/swig.cs | 15219 ++++++++-------- 2 files changed, 7600 insertions(+), 7637 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 4ded90cb0e..d68cbc0e2d 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1569,16 +1569,6 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_SWITCH_PROXY_MEDIA_VARIAB } -SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_SWITCH_ZRTP_PASSTHRU_VARIABLE_get___() { - char * jresult ; - char *result = 0 ; - - result = (char *)("zrtp_passthru"); - jresult = SWIG_csharp_string_callback((const char *)result); - return jresult; -} - - SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get___() { char * jresult ; char *result = 0 ; @@ -37178,14 +37168,6 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_perform_mark_ } -SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_check_zrtp___(void * jarg1) { - switch_channel_t *arg1 = (switch_channel_t *) 0 ; - - arg1 = (switch_channel_t *)jarg1; - switch_channel_check_zrtp(arg1); -} - - SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_perform_acknowledge_call___(void * jarg1, char * jarg2, char * jarg3, int jarg4) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 06858aa6b9..e5f94152c4 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -73,6 +73,93 @@ public class Api : global::System.IDisposable { namespace FreeSWITCH.Native { +public class audio_buffer_header_t : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal audio_buffer_header_t(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(audio_buffer_header_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~audio_buffer_header_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_audio_buffer_header_t(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public uint ts { + set { + freeswitchPINVOKE.audio_buffer_header_t_ts_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.audio_buffer_header_t_ts_get(swigCPtr); + return ret; + } + } + + public uint len { + set { + freeswitchPINVOKE.audio_buffer_header_t_len_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.audio_buffer_header_t_len_get(swigCPtr); + return ret; + } + } + + public audio_buffer_header_t() : this(freeswitchPINVOKE.new_audio_buffer_header_t(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum cache_db_flag_t { + CDF_INUSE = (1 << 0), + CDF_PRUNE = (1 << 1), + CDF_NONEXPIRING = (1 << 2) +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 CoreSession : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -460,6 +547,155 @@ public class CoreSession : global::System.IDisposable { namespace FreeSWITCH.Native { +public enum dm_match_type_t { + DM_MATCH_POSITIVE, + DM_MATCH_NEGATIVE +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 dtls_fingerprint_t : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal dtls_fingerprint_t(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(dtls_fingerprint_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~dtls_fingerprint_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_dtls_fingerprint_t(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public uint len { + set { + freeswitchPINVOKE.dtls_fingerprint_t_len_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.dtls_fingerprint_t_len_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_unsigned_char data { + set { + freeswitchPINVOKE.dtls_fingerprint_t_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.dtls_fingerprint_t_data_get(swigCPtr); + SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + return ret; + } + } + + public string type { + set { + freeswitchPINVOKE.dtls_fingerprint_t_type_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.dtls_fingerprint_t_type_get(swigCPtr); + return ret; + } + } + + public string str { + set { + freeswitchPINVOKE.dtls_fingerprint_t_str_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.dtls_fingerprint_t_str_get(swigCPtr); + return ret; + } + } + + public dtls_fingerprint_t() : this(freeswitchPINVOKE.new_dtls_fingerprint_t(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum dtls_state_t { + DS_OFF, + DS_HANDSHAKE, + DS_SETUP, + DS_READY, + DS_FAIL, + DS_INVALID +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum dtls_type_t { + DTLS_TYPE_CLIENT = (1 << 0), + DTLS_TYPE_SERVER = (1 << 1), + DTLS_TYPE_RTP = (1 << 2), + DTLS_TYPE_RTCP = (1 << 3) +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 DTMF : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -528,133 +764,9 @@ public class DTMF : global::System.IDisposable { namespace FreeSWITCH.Native { -public partial class Event : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal Event(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Event obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~Event() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_Event(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public switch_event InternalEvent { - set { - freeswitchPINVOKE.Event_InternalEvent_set(swigCPtr, switch_event.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.Event_InternalEvent_get(swigCPtr); - switch_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_event(cPtr, false); - return ret; - } - } - - public string serialized_string { - set { - freeswitchPINVOKE.Event_serialized_string_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.Event_serialized_string_get(swigCPtr); - return ret; - } - } - - public int mine { - set { - freeswitchPINVOKE.Event_mine_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.Event_mine_get(swigCPtr); - return ret; - } - } - - public Event(string type, string subclass_name) : this(freeswitchPINVOKE.new_Event__SWIG_0(type, subclass_name), true) { - } - - public Event(switch_event wrap_me, int free_me) : this(freeswitchPINVOKE.new_Event__SWIG_1(switch_event.getCPtr(wrap_me), free_me), true) { - } - - public int chat_execute(string app, string data) { - int ret = freeswitchPINVOKE.Event_chat_execute(swigCPtr, app, data); - return ret; - } - - public int chat_send(string dest_proto) { - int ret = freeswitchPINVOKE.Event_chat_send(swigCPtr, dest_proto); - return ret; - } - - public string Serialize(string format) { - string ret = freeswitchPINVOKE.Event_Serialize(swigCPtr, format); - return ret; - } - - public bool SetPriority(switch_priority_t priority) { - bool ret = freeswitchPINVOKE.Event_SetPriority(swigCPtr, (int)priority); - return ret; - } - - public string GetHeader(string header_name) { - string ret = freeswitchPINVOKE.Event_GetHeader(swigCPtr, header_name); - return ret; - } - - public string GetBody() { - string ret = freeswitchPINVOKE.Event_GetBody(swigCPtr); - return ret; - } - - public string GetEventType() { - string ret = freeswitchPINVOKE.Event_GetEventType(swigCPtr); - return ret; - } - - public bool AddBody(string value) { - bool ret = freeswitchPINVOKE.Event_AddBody(swigCPtr, value); - return ret; - } - - public bool AddHeader(string header_name, string value) { - bool ret = freeswitchPINVOKE.Event_AddHeader(swigCPtr, header_name, value); - return ret; - } - - public bool DeleteHeader(string header_name) { - bool ret = freeswitchPINVOKE.Event_DeleteHeader(swigCPtr, header_name); - return ret; - } - - public bool Fire() { - bool ret = freeswitchPINVOKE.Event_Fire(swigCPtr); - return ret; - } - - public bool merge(Event to_merge) { - bool ret = freeswitchPINVOKE.Event_merge(swigCPtr, Event.getCPtr(to_merge)); - return ret; - } - +public enum dtmf_flag_t { + DTMF_FLAG_SKIP_PROCESS = (1 << 0), + DTMF_FLAG_SENSITIVE = (1 << 1) } } @@ -805,20 +917,20 @@ public class EventConsumer : global::System.IDisposable { namespace FreeSWITCH.Native { -public class IvrMenu : global::System.IDisposable { +public partial class Event : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; - internal IvrMenu(global::System.IntPtr cPtr, bool cMemoryOwn) { + internal Event(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IvrMenu obj) { + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Event obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - ~IvrMenu() { + ~Event() { Dispose(); } @@ -827,7 +939,7 @@ public class IvrMenu : global::System.IDisposable { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; - freeswitchPINVOKE.delete_IvrMenu(swigCPtr); + freeswitchPINVOKE.delete_Event(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } @@ -835,6976 +947,103 @@ public class IvrMenu : global::System.IDisposable { } } - public IvrMenu(IvrMenu 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) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.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), true) { + public switch_event InternalEvent { + set { + freeswitchPINVOKE.Event_InternalEvent_set(swigCPtr, switch_event.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.Event_InternalEvent_get(swigCPtr); + switch_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_event(cPtr, false); + return ret; + } } - public void bindAction(string action, string arg, string bind) { - freeswitchPINVOKE.IvrMenu_bindAction(swigCPtr, action, arg, bind); + public string serialized_string { + set { + freeswitchPINVOKE.Event_serialized_string_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.Event_serialized_string_get(swigCPtr); + return ret; + } } - public void Execute(CoreSession session, string name) { - freeswitchPINVOKE.IvrMenu_Execute(swigCPtr, CoreSession.getCPtr(session), name); + public int mine { + set { + freeswitchPINVOKE.Event_mine_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.Event_mine_get(swigCPtr); + return ret; + } } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 partial class ManagedSession : CoreSession { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal ManagedSession(global::System.IntPtr cPtr, bool cMemoryOwn) : base(freeswitchPINVOKE.ManagedSession_SWIGUpcast(cPtr), cMemoryOwn) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ManagedSession obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~ManagedSession() { - Dispose(); - } - - public override void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_ManagedSession(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - base.Dispose(); - } - } - - public ManagedSession() : this(freeswitchPINVOKE.new_ManagedSession__SWIG_0(), true) { - } - - public ManagedSession(string uuid) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_1(uuid), true) { - } - - public ManagedSession(SWIGTYPE_p_switch_core_session session) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_2(SWIGTYPE_p_switch_core_session.getCPtr(session)), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_FILE { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_FILE(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_FILE() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_FILE obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_a_256__char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_a_256__char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_a_256__char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_a_256__char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_a_2__icand_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_a_2__icand_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_a_2__icand_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_a_2__icand_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; - - internal SWIGTYPE_p_cJSON(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_cJSON() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_cJSON obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_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_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_p_switch_database_interface_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_p_switch_database_interface_handle__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_database_interface_handle__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_database_interface_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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_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_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_fspr_pool_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__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_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char__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_q_const__char_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__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_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__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_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__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_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_p_unsigned_long__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__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_q_const__char_p_switch_codec_fmtp__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__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_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_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_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_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_q_const__void_p_q_const__void_p_void__switch_bool_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle__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_switch_asr_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_char_double__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void() { - 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_asr_handle_p_char_double__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_char_int__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void() { - 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_asr_handle_p_char_int__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_char_p_q_const__char__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void() { - 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_asr_handle_p_char_p_q_const__char__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__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_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__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_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__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_switch_asr_handle_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__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_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__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_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__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_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__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_switch_asr_handle_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__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_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_codec__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_codec__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_codec__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_switch_codec__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal 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(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected 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() { - 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_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 obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal 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(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected 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() { - 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_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_codec_p_switch_frame__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_codec_p_switch_frame__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_switch_codec_p_switch_frame__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__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_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session__int() { - 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__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session__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_switch_core_session__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void() { - 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_enum_switch_channel_callstate_t_p_switch_device_record_s__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_int__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_switch_core_session_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_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_char_p_switch_say_args_t_p_p_char__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_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_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_char_p_switch_say_args_t_p_switch_input_args_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_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_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_p_switch_frame_unsigned_long_int__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_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__char__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void() { - 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_q_const__char__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_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_q_const__char_p_q_const__char__switch_bool_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_q_const__char_p_q_const__char__switch_bool_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_status_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_q_const__char_p_q_const__char__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_switch_core_session_p_q_const__char_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_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_q_const__char_p_q_const__char_q_const__int_q_const__int__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_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_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_q_const__switch_dtmf_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_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_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_q_const__switch_dtmf_t_enum_switch_dtmf_direction_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_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_core_session_message__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_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_core_session_message__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_switch_core_session_p_switch_core_session_message__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_event__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_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__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_switch_core_session_p_switch_event__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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_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_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_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; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_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_switch_core_session_unsigned_long__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_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_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_frame_p_void__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_switch_core_session_p_switch_frame_p_void__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_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_frame_unsigned_long_int__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_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_void__p_void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_void__p_void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_p_void__p_void() { - 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_void__p_void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_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_void_enum_switch_input_type_t_p_void_unsigned_int__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_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension() { - 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_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s() { - 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_t_switch_media_type_t__p_switch_jb_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_database_interface_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_database_interface_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_database_interface_handle__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_switch_database_interface_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_database_interface_handle_enum_switch_bool_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_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_switch_database_interface_handle_enum_switch_bool_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_database_interface_handle_p_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__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_switch_database_interface_handle_p_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__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_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_directory_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_directory_handle__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_switch_directory_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_directory_handle_p_char_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__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_switch_directory_handle_p_char_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__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_switch_directory_handle_p_char_p_char_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__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_switch_directory_handle_p_p_char_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_event__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_event__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_event__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_switch_event__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_event__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_event__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_event__void() { - 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_event__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_event_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_event_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_event_p_q_const__char__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_switch_event_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle__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_switch_file_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__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_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__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_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_enum_switch_file_command_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_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_switch_file_handle_enum_switch_file_command_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_long_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_long_long__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_switch_file_handle_long_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__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_switch_file_handle_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_switch_frame__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__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_switch_file_handle_p_switch_frame__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_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_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__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_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_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_switch_file_handle_p_void_p_switch_size_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_ivr_dmachine_match__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_ivr_dmachine_match__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_switch_ivr_dmachine_match__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_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_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void() { - 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_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_media_bug_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_media_bug_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_media_bug_p_void__void() { - 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_media_bug_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_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_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void() { - 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_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_scheduler_task__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_scheduler_task__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_scheduler_task__void() { - 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_scheduler_task__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle__void() { - 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_speech_handle__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_char_double__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void() { - 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_speech_handle_p_char_double__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_char_int__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void() { - 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_speech_handle_p_char_int__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_char_p_q_const__char__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void() { - 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_speech_handle_p_char_p_q_const__char__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__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_switch_speech_handle_p_char_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__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_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__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_switch_speech_handle_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__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_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_stream_handle_p_int__p_unsigned_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char() { - 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_stream_handle_p_int__p_unsigned_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______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_switch_stream_handle_p_q_const__char_v_______switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_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_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_thread_t_p_void__p_void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void() { - 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_thread_t_p_void__p_void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_timer__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_timer__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_timer__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_switch_timer__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_timer_enum_switch_bool_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_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_switch_timer_enum_switch_bool_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_void__void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_void_int_p_p_char_p_p_char__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_void_p_q_const__char__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_void_p_q_const__char__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_void_p_q_const__char__int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_q_const__char__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_void_p_switch_event__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_void_p_switch_event__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_void_p_switch_event__int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_switch_event__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__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_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_void__p_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_void__p_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_void__p_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_void__p_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_void__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_void__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_void__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_void__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_float { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_float(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_float() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_float obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; - - internal SWIGTYPE_p_in6_addr(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_in6_addr() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_in6_addr obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; - - internal SWIGTYPE_p_p_cJSON(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_cJSON() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_cJSON obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; - - internal SWIGTYPE_p_p_p_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_p_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_p_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_payload_map_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_payload_map_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_payload_map_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_payload_map_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_real_pcre { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_real_pcre(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_real_pcre() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_real_pcre obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sqlite3 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_sqlite3(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_sqlite3() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_sqlite3 obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sqlite3_stmt { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_sqlite3_stmt(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_sqlite3_stmt() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_sqlite3_stmt obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_agc_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_agc_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_agc_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_agc_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_audio_resampler_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_audio_resampler_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_audio_resampler_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_audio_resampler_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_buffer { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_buffer(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_buffer() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_buffer obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_cache_db_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_cache_db_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_cache_db_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_cache_db_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_caller_extension { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_caller_extension(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_caller_extension() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_caller_extension obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_channel { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_channel(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_channel() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_channel obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_codec_implementation { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_codec_implementation(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_codec_implementation() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_codec_implementation obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_console_callback_match { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_console_callback_match(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_console_callback_match() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_console_callback_match obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_port_allocator { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_core_port_allocator(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_core_port_allocator() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_port_allocator obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_session { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_core_session(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_core_session() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_session_message { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_core_session_message(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_core_session_message() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session_message obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_device_record_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_device_record_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_device_record_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_device_record_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_handle_list_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_dial_handle_list_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_list_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_handle_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_dial_handle_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_dial_handle_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_leg_list_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_dial_leg_list_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_dial_leg_list_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_leg_list_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_leg_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_dial_leg_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_dial_leg_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_leg_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_event { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_event(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_event() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_event obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_event_node { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_event_node(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_event_node() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_event_node obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_file_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_file_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_file_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_file_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_frame { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_frame(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_frame() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_frame obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_frame_buffer_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_frame_buffer_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_frame_buffer_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_frame_buffer_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_hashtable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_hashtable(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_hashtable() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_hashtable obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_hashtable_iterator { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_hashtable_iterator(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_hashtable_iterator() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_hashtable_iterator obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_digit_stream { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_digit_stream(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_digit_stream() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_digit_stream_parser { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_digit_stream_parser(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_digit_stream_parser() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream_parser obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_dmachine { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_dmachine(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_dmachine() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_dmachine_match { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_dmachine_match(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_dmachine_match() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine_match obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_menu { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_menu(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_menu() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_menu_xml_ctx { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_menu_xml_ctx(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_menu_xml_ctx() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_live_array_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_live_array_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_live_array_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_live_array_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_log_node_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_log_node_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_log_node_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_log_node_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_media_bug { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_media_bug(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_media_bug() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_media_bug obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_network_list { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_network_list(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_network_list() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_network_list obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_rtp { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_rtp(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_rtp() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_rtp obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_say_file_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_say_file_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_say_file_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_say_file_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_sql_queue_manager { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_sql_queue_manager(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_sql_queue_manager() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_sql_queue_manager obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_thread_data_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_thread_data_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_thread_data_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_thread_data_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_xml { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_xml() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_xml obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_xml_binding { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_xml_binding(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_xml_binding() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_xml_binding obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_unsigned_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_unsigned_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_pid_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_pid_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_pid_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_pid_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_real_pcre { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_real_pcre(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_real_pcre() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_real_pcre obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_short { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_short(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_short() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_short obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sockaddr { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_sockaddr(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_sockaddr() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sockaddr obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sockaddr_in6 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_sockaddr_in6(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_sockaddr_in6() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sockaddr_in6 obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_socklen_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_socklen_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_socklen_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_socklen_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sqlite3 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_sqlite3(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_sqlite3() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sqlite3 obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sqlite3_stmt { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_sqlite3_stmt(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_sqlite3_stmt() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sqlite3_stmt obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_agc_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_agc_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_agc_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_agc_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_buffer { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_buffer(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_buffer() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_buffer obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_cache_db_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_cache_db_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_cache_db_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_cache_db_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_call_cause_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_call_cause_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_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_switch_call_cause_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_channel { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_channel(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_channel() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_channel obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_codec_control_type_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_codec_control_type_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_codec_control_type_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_codec_control_type_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_port_allocator { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_core_port_allocator(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_core_port_allocator() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_core_port_allocator obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_session { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_core_session(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_core_session() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_core_session obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_handle_list_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_dial_handle_list_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_list_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_handle_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_dial_handle_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_dial_handle_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_leg_list_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_dial_leg_list_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_dial_leg_list_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_leg_list_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_leg_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_dial_leg_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_dial_leg_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_leg_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_event_types_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_event_types_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_event_types_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_event_types_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_file_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_file_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_file_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_file_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_frame_buffer_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_frame_buffer_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_frame_buffer_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_frame_buffer_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_hashtable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_hashtable(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_hashtable() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_hashtable obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_hashtable_iterator { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_hashtable_iterator(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_hashtable_iterator() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_hashtable_iterator obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_image_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_image_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_image_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_image_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_img_fmt_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_img_fmt_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_img_fmt_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_img_fmt_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_img_position_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_img_position_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_img_position_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_img_position_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_interval_time_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_interval_time_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_interval_time_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_interval_time_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_action_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_action_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_action_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_action_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_digit_stream { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_digit_stream(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_digit_stream() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_digit_stream_parser { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_digit_stream_parser(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_digit_stream_parser() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream_parser obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_dmachine { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_dmachine(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_dmachine() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_dmachine obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_menu { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_menu(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_menu() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_menu_xml_ctx { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_menu_xml_ctx(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_menu_xml_ctx() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu_xml_ctx obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_jb_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_jb_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_jb_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_jb_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_live_array_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_live_array_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_live_array_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_live_array_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_media_bug { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_media_bug(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_media_bug() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_media_bug obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_mutex_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_mutex_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_mutex_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_mutex_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_network_list { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_network_list(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_network_list() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_network_list obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_odbc_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_odbc_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_odbc_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_odbc_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_pollfd_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_pollfd_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_pollfd_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_pollfd_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_queue_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_queue_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_queue_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_queue_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_rtcp_frame { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_rtcp_frame(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_rtcp_frame() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtcp_frame obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_rtp { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_rtp(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_rtp() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtp obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_rtp_flag_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_rtp_flag_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_rtp_flag_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtp_flag_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_say_file_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_say_file_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_say_file_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_say_file_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_size_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_size_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_size_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_size_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_sockaddr_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_sockaddr_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_sockaddr_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_sockaddr_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_socket_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_socket_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_socket_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_socket_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_sql_queue_manager { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_sql_queue_manager(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_sql_queue_manager() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_sql_queue_manager obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ssize_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ssize_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ssize_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ssize_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_thread_rwlock_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_thread_rwlock_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_thread_rwlock_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_rwlock_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_thread_start_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_thread_start_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_thread_start_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_start_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_thread_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_thread_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_thread_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_time_exp_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_time_exp_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_time_exp_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_time_exp_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_time_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_time_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_time_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_time_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_xml_binding { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_xml_binding(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_xml_binding() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_xml_binding obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_time_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_time_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_time_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_time_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_unsigned_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_unsigned_int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_unsigned_int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_long { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_unsigned_long(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_unsigned_long() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_long obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_short { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_unsigned_short(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_unsigned_short() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_short obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 partial class Stream : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal Stream(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Stream obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~Stream() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_Stream(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public Stream() : this(freeswitchPINVOKE.new_Stream__SWIG_0(), true) { + public Event(string type, string subclass_name) : this(freeswitchPINVOKE.new_Event__SWIG_0(type, subclass_name), true) { } - public Stream(switch_stream_handle arg0) : this(freeswitchPINVOKE.new_Stream__SWIG_1(switch_stream_handle.getCPtr(arg0)), true) { + public Event(switch_event wrap_me, int free_me) : this(freeswitchPINVOKE.new_Event__SWIG_1(switch_event.getCPtr(wrap_me), free_me), true) { } - public string read(SWIGTYPE_p_int len) { - string ret = freeswitchPINVOKE.Stream_read(swigCPtr, SWIGTYPE_p_int.getCPtr(len)); + public int chat_execute(string app, string data) { + int ret = freeswitchPINVOKE.Event_chat_execute(swigCPtr, app, data); return ret; } - public void Write(string data) { - freeswitchPINVOKE.Stream_Write(swigCPtr, data); - } - - public void raw_write(string data, int len) { - freeswitchPINVOKE.Stream_raw_write(swigCPtr, data, len); - } - - public string get_data() { - string ret = freeswitchPINVOKE.Stream_get_data(swigCPtr); + public int chat_send(string dest_proto) { + int ret = freeswitchPINVOKE.Event_chat_send(swigCPtr, dest_proto); return ret; } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 audio_buffer_header_t : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal audio_buffer_header_t(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + public string Serialize(string format) { + string ret = freeswitchPINVOKE.Event_Serialize(swigCPtr, format); + return ret; } - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(audio_buffer_header_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + public bool SetPriority(switch_priority_t priority) { + bool ret = freeswitchPINVOKE.Event_SetPriority(swigCPtr, (int)priority); + return ret; } - ~audio_buffer_header_t() { - Dispose(); + public string GetHeader(string header_name) { + string ret = freeswitchPINVOKE.Event_GetHeader(swigCPtr, header_name); + return ret; } - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_audio_buffer_header_t(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } + public string GetBody() { + string ret = freeswitchPINVOKE.Event_GetBody(swigCPtr); + return ret; } - public uint ts { - set { - freeswitchPINVOKE.audio_buffer_header_t_ts_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.audio_buffer_header_t_ts_get(swigCPtr); - return ret; - } + public string GetEventType() { + string ret = freeswitchPINVOKE.Event_GetEventType(swigCPtr); + return ret; } - public uint len { - set { - freeswitchPINVOKE.audio_buffer_header_t_len_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.audio_buffer_header_t_len_get(swigCPtr); - return ret; - } + public bool AddBody(string value) { + bool ret = freeswitchPINVOKE.Event_AddBody(swigCPtr, value); + return ret; } - public audio_buffer_header_t() : this(freeswitchPINVOKE.new_audio_buffer_header_t(), true) { + public bool AddHeader(string header_name, string value) { + bool ret = freeswitchPINVOKE.Event_AddHeader(swigCPtr, header_name, value); + return ret; } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum cache_db_flag_t { - CDF_INUSE = (1 << 0), - CDF_PRUNE = (1 << 1), - CDF_NONEXPIRING = (1 << 2) -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum dm_match_type_t { - DM_MATCH_POSITIVE, - DM_MATCH_NEGATIVE -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 dtls_fingerprint_t : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal dtls_fingerprint_t(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + public bool DeleteHeader(string header_name) { + bool ret = freeswitchPINVOKE.Event_DeleteHeader(swigCPtr, header_name); + return ret; } - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(dtls_fingerprint_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + public bool Fire() { + bool ret = freeswitchPINVOKE.Event_Fire(swigCPtr); + return ret; } - ~dtls_fingerprint_t() { - Dispose(); + public bool merge(Event to_merge) { + bool ret = freeswitchPINVOKE.Event_merge(swigCPtr, Event.getCPtr(to_merge)); + return ret; } - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_dtls_fingerprint_t(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public uint len { - set { - freeswitchPINVOKE.dtls_fingerprint_t_len_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.dtls_fingerprint_t_len_get(swigCPtr); - return ret; - } - } - - public SWIGTYPE_p_unsigned_char data { - set { - freeswitchPINVOKE.dtls_fingerprint_t_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.dtls_fingerprint_t_data_get(swigCPtr); - SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); - return ret; - } - } - - public string type { - set { - freeswitchPINVOKE.dtls_fingerprint_t_type_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.dtls_fingerprint_t_type_get(swigCPtr); - return ret; - } - } - - public string str { - set { - freeswitchPINVOKE.dtls_fingerprint_t_str_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.dtls_fingerprint_t_str_get(swigCPtr); - return ret; - } - } - - public dtls_fingerprint_t() : this(freeswitchPINVOKE.new_dtls_fingerprint_t(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum dtls_state_t { - DS_OFF, - DS_HANDSHAKE, - DS_SETUP, - DS_READY, - DS_FAIL, - DS_INVALID -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum dtls_type_t { - DTLS_TYPE_CLIENT = (1 << 0), - DTLS_TYPE_SERVER = (1 << 1), - DTLS_TYPE_RTP = (1 << 2), - DTLS_TYPE_RTCP = (1 << 3) -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum dtmf_flag_t { - DTMF_FLAG_SKIP_PROCESS = (1 << 0), - DTMF_FLAG_SENSITIVE = (1 << 1) } } @@ -12022,10 +5261,6 @@ else return ret; } - public static void switch_channel_check_zrtp(SWIGTYPE_p_switch_channel channel) { - freeswitchPINVOKE.switch_channel_check_zrtp(SWIGTYPE_p_switch_channel.getCPtr(channel)); - } - public static switch_status_t switch_channel_perform_acknowledge_call(SWIGTYPE_p_switch_channel channel, string file, string func, int line) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_acknowledge_call(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line); return ret; @@ -15094,7 +8329,6 @@ else public static readonly string SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME = freeswitchPINVOKE.SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get(); public static readonly string SWITCH_BYPASS_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_VARIABLE_get(); public static readonly string SWITCH_PROXY_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_PROXY_MEDIA_VARIABLE_get(); - public static readonly string SWITCH_ZRTP_PASSTHRU_VARIABLE = freeswitchPINVOKE.SWITCH_ZRTP_PASSTHRU_VARIABLE_get(); public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get(); public static readonly string SWITCH_TEMP_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get(); @@ -15790,9 +9024,6 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_SWITCH_PROXY_MEDIA_VARIABLE_get___")] public static extern string SWITCH_PROXY_MEDIA_VARIABLE_get(); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_SWITCH_ZRTP_PASSTHRU_VARIABLE_get___")] - public static extern string SWITCH_ZRTP_PASSTHRU_VARIABLE_get(); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get___")] public static extern string SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); @@ -24580,9 +17811,6 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_perform_mark_answered___")] public static extern int switch_channel_perform_mark_answered(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, int jarg4); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_check_zrtp___")] - public static extern void switch_channel_check_zrtp(global::System.Runtime.InteropServices.HandleRef jarg1); - [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_perform_acknowledge_call___")] public static extern int switch_channel_perform_acknowledge_call(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, int jarg4); @@ -28614,6 +21842,115 @@ public class ip_t : global::System.IDisposable { namespace FreeSWITCH.Native { +public class IvrMenu : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal IvrMenu(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IvrMenu obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~IvrMenu() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_IvrMenu(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public IvrMenu(IvrMenu 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) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.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), true) { + } + + public void bindAction(string action, string arg, string bind) { + freeswitchPINVOKE.IvrMenu_bindAction(swigCPtr, action, arg, bind); + } + + public void Execute(CoreSession session, string name) { + freeswitchPINVOKE.IvrMenu_Execute(swigCPtr, CoreSession.getCPtr(session), name); + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 partial class ManagedSession : CoreSession { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ManagedSession(global::System.IntPtr cPtr, bool cMemoryOwn) : base(freeswitchPINVOKE.ManagedSession_SWIGUpcast(cPtr), cMemoryOwn) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ManagedSession obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~ManagedSession() { + Dispose(); + } + + public override void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_ManagedSession(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + base.Dispose(); + } + } + + public ManagedSession() : this(freeswitchPINVOKE.new_ManagedSession__SWIG_0(), true) { + } + + public ManagedSession(string uuid) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_1(uuid), true) { + } + + public ManagedSession(SWIGTYPE_p_switch_core_session session) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_2(SWIGTYPE_p_switch_core_session.getCPtr(session)), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 payload_map_t : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -29107,6 +22444,6658 @@ namespace FreeSWITCH.Native { namespace FreeSWITCH.Native { +public partial class Stream : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Stream(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Stream obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~Stream() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_Stream(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public Stream() : this(freeswitchPINVOKE.new_Stream__SWIG_0(), true) { + } + + public Stream(switch_stream_handle arg0) : this(freeswitchPINVOKE.new_Stream__SWIG_1(switch_stream_handle.getCPtr(arg0)), true) { + } + + public string read(SWIGTYPE_p_int len) { + string ret = freeswitchPINVOKE.Stream_read(swigCPtr, SWIGTYPE_p_int.getCPtr(len)); + return ret; + } + + public void Write(string data) { + freeswitchPINVOKE.Stream_Write(swigCPtr, data); + } + + public void raw_write(string data, int len) { + freeswitchPINVOKE.Stream_raw_write(swigCPtr, data, len); + } + + public string get_data() { + string ret = freeswitchPINVOKE.Stream_get_data(swigCPtr); + return ret; + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_a_256__char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_a_256__char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_a_256__char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_a_256__char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_a_2__icand_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_a_2__icand_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_a_2__icand_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_a_2__icand_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; + + internal SWIGTYPE_p_cJSON(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_cJSON() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_cJSON obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_FILE { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_FILE(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_FILE() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_FILE obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_float { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_float(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_float() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_float obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_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_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_p_switch_database_interface_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_p_switch_database_interface_handle__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_database_interface_handle__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_database_interface_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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_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_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_fspr_pool_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__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_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__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_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__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_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_p_unsigned_long__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char__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_q_const__char_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__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_q_const__char_p_switch_codec_fmtp__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__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_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__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_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_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_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_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_q_const__void_p_q_const__void_p_void__switch_bool_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_char_double__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void() { + 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_asr_handle_p_char_double__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_char_int__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void() { + 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_asr_handle_p_char_int__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_char_p_q_const__char__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void() { + 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_asr_handle_p_char_p_q_const__char__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__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_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__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_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__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_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__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_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__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_switch_asr_handle_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__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_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__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_switch_asr_handle_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__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_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle__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_switch_asr_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal 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(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected 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() { + 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_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 obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal 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(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected 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() { + 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_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_codec_p_switch_frame__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_codec_p_switch_frame__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_switch_codec_p_switch_frame__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_codec__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_codec__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_codec__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_switch_codec__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__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_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void() { + 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_enum_switch_channel_callstate_t_p_switch_device_record_s__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session__int() { + 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__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_int__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_switch_core_session_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_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_char_p_switch_say_args_t_p_p_char__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_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_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_char_p_switch_say_args_t_p_switch_input_args_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_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_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_p_switch_frame_unsigned_long_int__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_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_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_q_const__char_p_q_const__char_q_const__int_q_const__int__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_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_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_q_const__char_p_q_const__char__switch_bool_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_q_const__char_p_q_const__char__switch_bool_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_status_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_q_const__char_p_q_const__char__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_switch_core_session_p_q_const__char_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__char__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void() { + 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_q_const__char__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_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_q_const__switch_dtmf_t_enum_switch_dtmf_direction_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_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_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_q_const__switch_dtmf_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_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_core_session_message__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_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_core_session_message__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_switch_core_session_p_switch_core_session_message__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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_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_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_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; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_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_switch_core_session_unsigned_long__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_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_event__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_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__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_switch_core_session_p_switch_event__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_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_frame_p_void__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_switch_core_session_p_switch_frame_p_void__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_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_frame_unsigned_long_int__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_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_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_void_enum_switch_input_type_t_p_void_unsigned_int__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_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_void__p_void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_void__p_void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_p_void__p_void() { + 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_void__p_void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session__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_switch_core_session__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension() { + 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_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s() { + 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_t_switch_media_type_t__p_switch_jb_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_database_interface_handle_enum_switch_bool_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_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_switch_database_interface_handle_enum_switch_bool_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_database_interface_handle_p_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__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_switch_database_interface_handle_p_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__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_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_database_interface_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_database_interface_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_database_interface_handle__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_switch_database_interface_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__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_switch_directory_handle_p_char_p_char_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_directory_handle_p_char_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__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_switch_directory_handle_p_char_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__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_switch_directory_handle_p_p_char_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_directory_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_directory_handle__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_switch_directory_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_event_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_event_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_event_p_q_const__char__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_switch_event_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_event__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_event__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_event__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_switch_event__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_event__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_event__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_event__void() { + 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_event__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__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_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__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_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_enum_switch_file_command_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_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_switch_file_handle_enum_switch_file_command_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_long_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_long_long__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_switch_file_handle_long_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__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_switch_file_handle_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_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_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_switch_frame__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__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_switch_file_handle_p_switch_frame__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__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_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_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_switch_file_handle_p_void_p_switch_size_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle__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_switch_file_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_ivr_dmachine_match__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_ivr_dmachine_match__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_switch_ivr_dmachine_match__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_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_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void() { + 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_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_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_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_media_bug_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_media_bug_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_media_bug_p_void__void() { + 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_media_bug_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void() { + 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_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_scheduler_task__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_scheduler_task__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_scheduler_task__void() { + 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_scheduler_task__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_char_double__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void() { + 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_speech_handle_p_char_double__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_char_int__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void() { + 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_speech_handle_p_char_int__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_char_p_q_const__char__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void() { + 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_speech_handle_p_char_p_q_const__char__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__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_switch_speech_handle_p_char_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__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_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__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_switch_speech_handle_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__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_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle__void() { + 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_speech_handle__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_stream_handle_p_int__p_unsigned_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char() { + 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_stream_handle_p_int__p_unsigned_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______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_switch_stream_handle_p_q_const__char_v_______switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_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_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_thread_t_p_void__p_void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void() { + 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_thread_t_p_void__p_void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_timer_enum_switch_bool_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_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_switch_timer_enum_switch_bool_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_timer__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_timer__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_timer__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_switch_timer__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_void_int_p_p_char_p_p_char__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_void_p_q_const__char__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void_p_q_const__char__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void_p_q_const__char__int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_q_const__char__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_void_p_switch_event__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void_p_switch_event__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void_p_switch_event__int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_switch_event__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void__void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__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_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_void__p_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_void__p_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_void__p_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_void__p_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_void__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_void__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_void__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_void__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; + + internal SWIGTYPE_p_in6_addr(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_in6_addr() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_in6_addr obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; + + internal SWIGTYPE_p_p_cJSON(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_cJSON() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_cJSON obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_pid_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_pid_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_pid_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_pid_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_payload_map_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_payload_map_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_payload_map_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_payload_map_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; + + internal SWIGTYPE_p_p_p_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_p_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_p_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_real_pcre { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_real_pcre(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_real_pcre() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_real_pcre obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sqlite3 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_sqlite3(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_sqlite3() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_sqlite3 obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sqlite3_stmt { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_sqlite3_stmt(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_sqlite3_stmt() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_sqlite3_stmt obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_agc_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_agc_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_agc_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_agc_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_audio_resampler_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_audio_resampler_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_audio_resampler_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_audio_resampler_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_buffer { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_buffer(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_buffer() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_buffer obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_cache_db_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_cache_db_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_cache_db_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_cache_db_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_caller_extension { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_caller_extension(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_caller_extension() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_caller_extension obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_channel { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_channel(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_channel() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_channel obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_codec_implementation { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_codec_implementation(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_codec_implementation() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_codec_implementation obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_console_callback_match { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_console_callback_match(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_console_callback_match() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_console_callback_match obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_port_allocator { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_core_port_allocator(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_core_port_allocator() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_port_allocator obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_session { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_core_session(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_core_session() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_session_message { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_core_session_message(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_core_session_message() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session_message obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_device_record_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_device_record_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_device_record_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_device_record_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_handle_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_handle_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_list_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_handle_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_handle_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_handle_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_leg_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_leg_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_leg_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_leg_list_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_leg_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_leg_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_leg_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_leg_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_event { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_event(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_event() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_event obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_event_node { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_event_node(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_event_node() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_event_node obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_file_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_file_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_file_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_file_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_frame_buffer_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_frame_buffer_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_frame_buffer_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_frame_buffer_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_frame { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_frame(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_frame() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_frame obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_hashtable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_hashtable(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_hashtable() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_hashtable obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_hashtable_iterator { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_hashtable_iterator(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_hashtable_iterator() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_hashtable_iterator obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_digit_stream { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_digit_stream(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_digit_stream() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_digit_stream_parser { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_digit_stream_parser(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_digit_stream_parser() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream_parser obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_dmachine { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_dmachine_match { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine_match(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine_match() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine_match obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_menu { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_menu(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_menu() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_menu_xml_ctx { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_menu_xml_ctx(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_menu_xml_ctx() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_live_array_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_live_array_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_live_array_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_live_array_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_log_node_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_log_node_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_log_node_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_log_node_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_media_bug { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_media_bug(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_media_bug() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_media_bug obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_network_list { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_network_list(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_network_list() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_network_list obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_rtp { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_rtp(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_rtp() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_rtp obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_say_file_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_say_file_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_say_file_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_say_file_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_sql_queue_manager { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_sql_queue_manager(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_sql_queue_manager() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_sql_queue_manager obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_thread_data_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_thread_data_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_thread_data_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_thread_data_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_xml_binding { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_xml_binding(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_xml_binding() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_xml_binding obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_xml { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_xml() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_xml obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_unsigned_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_unsigned_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_real_pcre { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_real_pcre(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_real_pcre() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_real_pcre obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_short { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_short(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_short() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_short obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sockaddr { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_sockaddr(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_sockaddr() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sockaddr obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sockaddr_in6 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_sockaddr_in6(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_sockaddr_in6() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sockaddr_in6 obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_socklen_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_socklen_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_socklen_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_socklen_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sqlite3 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_sqlite3(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_sqlite3() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sqlite3 obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sqlite3_stmt { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_sqlite3_stmt(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_sqlite3_stmt() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sqlite3_stmt obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_agc_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_agc_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_agc_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_agc_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_buffer { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_buffer(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_buffer() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_buffer obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_cache_db_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_cache_db_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_cache_db_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_cache_db_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_call_cause_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_call_cause_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_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_switch_call_cause_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_channel { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_channel(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_channel() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_channel obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_codec_control_type_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_codec_control_type_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_codec_control_type_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_codec_control_type_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_port_allocator { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_core_port_allocator(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_core_port_allocator() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_core_port_allocator obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_session { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_core_session(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_core_session() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_core_session obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_handle_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_handle_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_list_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_handle_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_handle_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_handle_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_leg_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_leg_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_leg_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_leg_list_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_leg_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_leg_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_leg_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_leg_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_event_types_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_event_types_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_event_types_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_event_types_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_file_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_file_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_file_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_file_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_frame_buffer_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_frame_buffer_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_frame_buffer_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_frame_buffer_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_hashtable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_hashtable(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_hashtable() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_hashtable obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_hashtable_iterator { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_hashtable_iterator(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_hashtable_iterator() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_hashtable_iterator obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_image_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_image_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_image_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_image_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_img_fmt_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_img_fmt_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_img_fmt_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_img_fmt_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_img_position_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_img_position_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_img_position_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_img_position_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_interval_time_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_interval_time_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_interval_time_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_interval_time_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_action_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_action_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_action_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_action_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_digit_stream { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_digit_stream(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_digit_stream() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_digit_stream_parser { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_digit_stream_parser(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_digit_stream_parser() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream_parser obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_dmachine { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_dmachine(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_dmachine() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_dmachine obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_menu { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_menu(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_menu() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_menu_xml_ctx { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_menu_xml_ctx(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_menu_xml_ctx() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu_xml_ctx obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_jb_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_jb_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_jb_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_jb_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_live_array_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_live_array_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_live_array_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_live_array_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_media_bug { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_media_bug(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_media_bug() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_media_bug obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_mutex_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_mutex_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_mutex_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_mutex_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_network_list { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_network_list(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_network_list() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_network_list obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_odbc_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_odbc_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_odbc_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_odbc_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_pollfd_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_pollfd_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_pollfd_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_pollfd_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_queue_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_queue_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_queue_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_queue_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_rtcp_frame { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_rtcp_frame(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_rtcp_frame() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtcp_frame obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_rtp { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_rtp(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_rtp() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtp obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_rtp_flag_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_rtp_flag_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_rtp_flag_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtp_flag_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_say_file_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_say_file_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_say_file_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_say_file_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_size_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_size_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_size_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_size_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_sockaddr_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_sockaddr_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_sockaddr_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_sockaddr_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_socket_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_socket_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_socket_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_socket_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_sql_queue_manager { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_sql_queue_manager(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_sql_queue_manager() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_sql_queue_manager obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ssize_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ssize_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ssize_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ssize_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_thread_rwlock_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_thread_rwlock_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_thread_rwlock_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_rwlock_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_thread_start_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_thread_start_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_thread_start_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_start_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_thread_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_thread_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_thread_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_time_exp_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_time_exp_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_time_exp_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_time_exp_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_time_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_time_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_time_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_time_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_xml_binding { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_xml_binding(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_xml_binding() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_xml_binding obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_time_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_time_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_time_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_time_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_long { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_long(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_long() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_long obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_short { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_short(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_short() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_short obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum switch_abc_type_t { SWITCH_ABC_TYPE_INIT, SWITCH_ABC_TYPE_READ, @@ -29280,97 +29269,6 @@ public class switch_api_interface : global::System.IDisposable { namespace FreeSWITCH.Native { -public class switch_app_log : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal switch_app_log(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_app_log obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~switch_app_log() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_switch_app_log(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public string app { - set { - freeswitchPINVOKE.switch_app_log_app_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.switch_app_log_app_get(swigCPtr); - return ret; - } - } - - public string arg { - set { - freeswitchPINVOKE.switch_app_log_arg_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.switch_app_log_arg_get(swigCPtr); - return ret; - } - } - - public SWIGTYPE_p_switch_time_t stamp { - set { - freeswitchPINVOKE.switch_app_log_stamp_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value)); - if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); - } - get { - SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_app_log_stamp_get(swigCPtr), true); - if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } - - public switch_app_log next { - set { - freeswitchPINVOKE.switch_app_log_next_set(swigCPtr, switch_app_log.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_app_log_next_get(swigCPtr); - switch_app_log ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_app_log(cPtr, false); - return ret; - } - } - - public switch_app_log() : this(freeswitchPINVOKE.new_switch_app_log(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 { - [System.Flags] public enum switch_application_flag_enum_t { SAF_NONE = 0, SAF_SUPPORT_NOMEDIA = (1 << 0), @@ -29557,6 +29455,97 @@ public class switch_application_interface : global::System.IDisposable { namespace FreeSWITCH.Native { +public class switch_app_log : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_app_log(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_app_log obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_app_log() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_app_log(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public string app { + set { + freeswitchPINVOKE.switch_app_log_app_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_app_log_app_get(swigCPtr); + return ret; + } + } + + public string arg { + set { + freeswitchPINVOKE.switch_app_log_arg_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_app_log_arg_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_switch_time_t stamp { + set { + freeswitchPINVOKE.switch_app_log_stamp_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_app_log_stamp_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public switch_app_log next { + set { + freeswitchPINVOKE.switch_app_log_next_set(swigCPtr, switch_app_log.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_app_log_next_get(swigCPtr); + switch_app_log ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_app_log(cPtr, false); + return ret; + } + } + + public switch_app_log() : this(freeswitchPINVOKE.new_switch_app_log(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 { + [System.Flags] public enum switch_asr_flag_enum_t { SWITCH_ASR_FLAG_NONE = 0, SWITCH_ASR_FLAG_DATA = (1 << 0), @@ -31968,9 +31957,6 @@ public enum switch_channel_flag_t { CF_MANUAL_MEDIA_PARAMS, CF_SERVICE_AUDIO, CF_SERVICE_VIDEO, - CF_ZRTP_PASSTHRU_REQ, - CF_ZRTP_PASSTHRU, - CF_ZRTP_HASH, CF_CHANNEL_SWAP, CF_DEVICE_LEG, CF_FINAL_DEVICE_LEG, @@ -32605,6 +32591,48 @@ public class switch_chat_interface : global::System.IDisposable { namespace FreeSWITCH.Native { +public enum switch_codec_control_command_t { + SCC_VIDEO_GEN_KEYFRAME = 0, + SCC_VIDEO_BANDWIDTH, + SCC_VIDEO_RESET, + SCC_AUDIO_PACKET_LOSS, + SCC_AUDIO_ADJUST_BITRATE, + SCC_DEBUG, + SCC_CODEC_SPECIFIC +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum switch_codec_control_type_t { + SCCT_NONE = 0, + SCCT_STRING, + SCCT_INT +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 switch_codec : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -32781,48 +32809,6 @@ public class switch_codec : global::System.IDisposable { namespace FreeSWITCH.Native { -public enum switch_codec_control_command_t { - SCC_VIDEO_GEN_KEYFRAME = 0, - SCC_VIDEO_BANDWIDTH, - SCC_VIDEO_RESET, - SCC_AUDIO_PACKET_LOSS, - SCC_AUDIO_ADJUST_BITRATE, - SCC_DEBUG, - SCC_CODEC_SPECIFIC -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum switch_codec_control_type_t { - SCCT_NONE = 0, - SCCT_STRING, - SCCT_INT -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 { - [System.Flags] public enum switch_codec_flag_enum_t { SWITCH_CODEC_FLAG_ENCODE = (1 << 0), SWITCH_CODEC_FLAG_DECODE = (1 << 1), @@ -33788,6 +33774,75 @@ public class switch_console_callback_match_node : global::System.IDisposable { namespace FreeSWITCH.Native { +public class switch_coredb_handle : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_coredb_handle(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_coredb_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_coredb_handle() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_coredb_handle(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public switch_bool_t in_memory { + set { + freeswitchPINVOKE.switch_coredb_handle_in_memory_set(swigCPtr, (int)value); + } + get { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_coredb_handle_in_memory_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_sqlite3 handle { + set { + freeswitchPINVOKE.switch_coredb_handle_handle_set(swigCPtr, SWIGTYPE_p_sqlite3.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_coredb_handle_handle_get(swigCPtr); + SWIGTYPE_p_sqlite3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_sqlite3(cPtr, false); + return ret; + } + } + + public switch_coredb_handle() : this(freeswitchPINVOKE.new_switch_coredb_handle(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 { + [System.Flags] public enum switch_core_flag_enum_t { SCF_NONE = 0, SCF_USE_SQL = (1 << 0), @@ -34415,75 +34470,6 @@ public class switch_core_time_duration : global::System.IDisposable { namespace FreeSWITCH.Native { -public class switch_coredb_handle : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal switch_coredb_handle(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_coredb_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~switch_coredb_handle() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_switch_coredb_handle(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public switch_bool_t in_memory { - set { - freeswitchPINVOKE.switch_coredb_handle_in_memory_set(swigCPtr, (int)value); - } - get { - switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_coredb_handle_in_memory_get(swigCPtr); - return ret; - } - } - - public SWIGTYPE_p_sqlite3 handle { - set { - freeswitchPINVOKE.switch_coredb_handle_handle_set(swigCPtr, SWIGTYPE_p_sqlite3.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_coredb_handle_handle_get(swigCPtr); - SWIGTYPE_p_sqlite3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_sqlite3(cPtr, false); - return ret; - } - } - - public switch_coredb_handle() : this(freeswitchPINVOKE.new_switch_coredb_handle(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 switch_cputime : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -38545,20 +38531,19 @@ namespace FreeSWITCH.Native { SFF_RFC2833 = (1 << 4), SFF_PROXY_PACKET = (1 << 5), SFF_DYNAMIC = (1 << 6), - SFF_ZRTP = (1 << 7), - SFF_UDPTL_PACKET = (1 << 8), - SFF_NOT_AUDIO = (1 << 9), - SFF_RTCP = (1 << 10), - SFF_MARKER = (1 << 11), - SFF_WAIT_KEY_FRAME = (1 << 12), - SFF_RAW_RTP_PARSE_FRAME = (1 << 13), - SFF_PICTURE_RESET = (1 << 14), - SFF_SAME_IMAGE = (1 << 15), - SFF_USE_VIDEO_TIMESTAMP = (1 << 16), - SFF_ENCODED = (1 << 17), - SFF_TEXT_LINE_BREAK = (1 << 18), - SFF_IS_KEYFRAME = (1 << 19), - SFF_EXTERNAL = (1 << 20) + SFF_UDPTL_PACKET = (1 << 7), + SFF_NOT_AUDIO = (1 << 8), + SFF_RTCP = (1 << 9), + SFF_MARKER = (1 << 10), + SFF_WAIT_KEY_FRAME = (1 << 11), + SFF_RAW_RTP_PARSE_FRAME = (1 << 12), + SFF_PICTURE_RESET = (1 << 13), + SFF_SAME_IMAGE = (1 << 14), + SFF_USE_VIDEO_TIMESTAMP = (1 << 15), + SFF_ENCODED = (1 << 16), + SFF_TEXT_LINE_BREAK = (1 << 17), + SFF_IS_KEYFRAME = (1 << 18), + SFF_EXTERNAL = (1 << 19) } } @@ -39613,6 +39598,208 @@ public class switch_io_event_hook_recv_dtmf : global::System.IDisposable { namespace FreeSWITCH.Native { +public class switch_io_event_hooks : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_io_event_hooks(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_io_event_hooks obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_io_event_hooks() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_io_event_hooks(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public switch_io_event_hook_outgoing_channel outgoing_channel { + set { + freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_set(swigCPtr, switch_io_event_hook_outgoing_channel.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_get(swigCPtr); + switch_io_event_hook_outgoing_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_outgoing_channel(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_receive_message receive_message { + set { + freeswitchPINVOKE.switch_io_event_hooks_receive_message_set(swigCPtr, switch_io_event_hook_receive_message.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_message_get(swigCPtr); + switch_io_event_hook_receive_message ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_receive_message(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_receive_event receive_event { + set { + freeswitchPINVOKE.switch_io_event_hooks_receive_event_set(swigCPtr, switch_io_event_hook_receive_event.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_event_get(swigCPtr); + switch_io_event_hook_receive_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_receive_event(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_read_frame read_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_read_frame_set(swigCPtr, switch_io_event_hook_read_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_read_frame_get(swigCPtr); + switch_io_event_hook_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_read_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_video_read_frame video_read_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_set(swigCPtr, switch_io_event_hook_video_read_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_get(swigCPtr); + switch_io_event_hook_video_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_video_read_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_write_frame write_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_write_frame_set(swigCPtr, switch_io_event_hook_write_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_write_frame_get(swigCPtr); + switch_io_event_hook_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_write_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_video_write_frame video_write_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_set(swigCPtr, switch_io_event_hook_video_write_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_get(swigCPtr); + switch_io_event_hook_video_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_video_write_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_text_write_frame text_write_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_text_write_frame_set(swigCPtr, switch_io_event_hook_text_write_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_text_write_frame_get(swigCPtr); + switch_io_event_hook_text_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_text_write_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_text_read_frame text_read_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_text_read_frame_set(swigCPtr, switch_io_event_hook_text_read_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_text_read_frame_get(swigCPtr); + switch_io_event_hook_text_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_text_read_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_kill_channel kill_channel { + set { + freeswitchPINVOKE.switch_io_event_hooks_kill_channel_set(swigCPtr, switch_io_event_hook_kill_channel.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_kill_channel_get(swigCPtr); + switch_io_event_hook_kill_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_kill_channel(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_send_dtmf send_dtmf { + set { + freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_set(swigCPtr, switch_io_event_hook_send_dtmf.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_get(swigCPtr); + switch_io_event_hook_send_dtmf ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_send_dtmf(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_recv_dtmf recv_dtmf { + set { + freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_set(swigCPtr, switch_io_event_hook_recv_dtmf.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_get(swigCPtr); + switch_io_event_hook_recv_dtmf ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_recv_dtmf(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_change state_change { + set { + freeswitchPINVOKE.switch_io_event_hooks_state_change_set(swigCPtr, switch_io_event_hook_state_change.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_change_get(swigCPtr); + switch_io_event_hook_state_change ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_state_change(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_run state_run { + set { + freeswitchPINVOKE.switch_io_event_hooks_state_run_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_run_get(swigCPtr); + switch_io_event_hook_state_run ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); + return ret; + } + } + + public switch_io_event_hooks() : this(freeswitchPINVOKE.new_switch_io_event_hooks(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 switch_io_event_hook_send_dtmf : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -40173,208 +40360,6 @@ public class switch_io_event_hook_write_frame : global::System.IDisposable { namespace FreeSWITCH.Native { -public class switch_io_event_hooks : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal switch_io_event_hooks(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_io_event_hooks obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~switch_io_event_hooks() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_switch_io_event_hooks(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public switch_io_event_hook_outgoing_channel outgoing_channel { - set { - freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_set(swigCPtr, switch_io_event_hook_outgoing_channel.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_get(swigCPtr); - switch_io_event_hook_outgoing_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_outgoing_channel(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_receive_message receive_message { - set { - freeswitchPINVOKE.switch_io_event_hooks_receive_message_set(swigCPtr, switch_io_event_hook_receive_message.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_message_get(swigCPtr); - switch_io_event_hook_receive_message ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_receive_message(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_receive_event receive_event { - set { - freeswitchPINVOKE.switch_io_event_hooks_receive_event_set(swigCPtr, switch_io_event_hook_receive_event.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_event_get(swigCPtr); - switch_io_event_hook_receive_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_receive_event(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_read_frame read_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_read_frame_set(swigCPtr, switch_io_event_hook_read_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_read_frame_get(swigCPtr); - switch_io_event_hook_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_read_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_video_read_frame video_read_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_set(swigCPtr, switch_io_event_hook_video_read_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_get(swigCPtr); - switch_io_event_hook_video_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_video_read_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_write_frame write_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_write_frame_set(swigCPtr, switch_io_event_hook_write_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_write_frame_get(swigCPtr); - switch_io_event_hook_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_write_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_video_write_frame video_write_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_set(swigCPtr, switch_io_event_hook_video_write_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_get(swigCPtr); - switch_io_event_hook_video_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_video_write_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_text_write_frame text_write_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_text_write_frame_set(swigCPtr, switch_io_event_hook_text_write_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_text_write_frame_get(swigCPtr); - switch_io_event_hook_text_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_text_write_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_text_read_frame text_read_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_text_read_frame_set(swigCPtr, switch_io_event_hook_text_read_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_text_read_frame_get(swigCPtr); - switch_io_event_hook_text_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_text_read_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_kill_channel kill_channel { - set { - freeswitchPINVOKE.switch_io_event_hooks_kill_channel_set(swigCPtr, switch_io_event_hook_kill_channel.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_kill_channel_get(swigCPtr); - switch_io_event_hook_kill_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_kill_channel(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_send_dtmf send_dtmf { - set { - freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_set(swigCPtr, switch_io_event_hook_send_dtmf.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_get(swigCPtr); - switch_io_event_hook_send_dtmf ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_send_dtmf(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_recv_dtmf recv_dtmf { - set { - freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_set(swigCPtr, switch_io_event_hook_recv_dtmf.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_get(swigCPtr); - switch_io_event_hook_recv_dtmf ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_recv_dtmf(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_state_change state_change { - set { - freeswitchPINVOKE.switch_io_event_hooks_state_change_set(swigCPtr, switch_io_event_hook_state_change.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_change_get(swigCPtr); - switch_io_event_hook_state_change ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_state_change(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_state_run state_run { - set { - freeswitchPINVOKE.switch_io_event_hooks_state_run_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_run_get(swigCPtr); - switch_io_event_hook_state_run ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); - return ret; - } - } - - public switch_io_event_hooks() : this(freeswitchPINVOKE.new_switch_io_event_hooks(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 { - [System.Flags] public enum switch_io_flag_enum_t { SWITCH_IO_FLAG_NONE = 0, SWITCH_IO_FLAG_NOBLOCK = (1 << 0), @@ -43652,10 +43637,6 @@ public enum switch_rtp_flag_t { SWITCH_RTP_FLAG_FLUSH, SWITCH_RTP_FLAG_AUTOFLUSH, SWITCH_RTP_FLAG_STICKY_FLUSH, - SWITCH_ZRTP_FLAG_SECURE_SEND, - SWITCH_ZRTP_FLAG_SECURE_RECV, - SWITCH_ZRTP_FLAG_SECURE_MITM_SEND, - SWITCH_ZRTP_FLAG_SECURE_MITM_RECV, SWITCH_RTP_FLAG_DEBUG_RTP_READ, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE, SWITCH_RTP_FLAG_ESTIMATORS, @@ -47541,123 +47522,6 @@ public enum switch_vad_state_t { namespace FreeSWITCH.Native { -public class switch_vid_params_t : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal switch_vid_params_t(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_vid_params_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~switch_vid_params_t() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_switch_vid_params_t(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public uint width { - set { - freeswitchPINVOKE.switch_vid_params_t_width_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_width_get(swigCPtr); - return ret; - } - } - - public uint height { - set { - freeswitchPINVOKE.switch_vid_params_t_height_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_height_get(swigCPtr); - return ret; - } - } - - public uint fps { - set { - freeswitchPINVOKE.switch_vid_params_t_fps_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_fps_get(swigCPtr); - return ret; - } - } - - public uint d_width { - set { - freeswitchPINVOKE.switch_vid_params_t_d_width_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_d_width_get(swigCPtr); - return ret; - } - } - - public uint d_height { - set { - freeswitchPINVOKE.switch_vid_params_t_d_height_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_d_height_get(swigCPtr); - return ret; - } - } - - public switch_vid_params_t() : this(freeswitchPINVOKE.new_switch_vid_params_t(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum switch_vid_spy_fmt_t { - SPY_LOWER_RIGHT_SMALL, - SPY_LOWER_RIGHT_LARGE, - SPY_DUAL_CROP -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 switch_video_codec_settings : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -47824,6 +47688,123 @@ public enum switch_video_read_flag_t { namespace FreeSWITCH.Native { +public class switch_vid_params_t : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_vid_params_t(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_vid_params_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_vid_params_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_vid_params_t(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public uint width { + set { + freeswitchPINVOKE.switch_vid_params_t_width_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_width_get(swigCPtr); + return ret; + } + } + + public uint height { + set { + freeswitchPINVOKE.switch_vid_params_t_height_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_height_get(swigCPtr); + return ret; + } + } + + public uint fps { + set { + freeswitchPINVOKE.switch_vid_params_t_fps_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_fps_get(swigCPtr); + return ret; + } + } + + public uint d_width { + set { + freeswitchPINVOKE.switch_vid_params_t_d_width_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_d_width_get(swigCPtr); + return ret; + } + } + + public uint d_height { + set { + freeswitchPINVOKE.switch_vid_params_t_d_height_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_d_height_get(swigCPtr); + return ret; + } + } + + public switch_vid_params_t() : this(freeswitchPINVOKE.new_switch_vid_params_t(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum switch_vid_spy_fmt_t { + SPY_LOWER_RIGHT_SMALL, + SPY_LOWER_RIGHT_LARGE, + SPY_DUAL_CROP +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 switch_waitlist_t : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; From 1213217ccc65d1241b04f167bc2e467e65d00a44 Mon Sep 17 00:00:00 2001 From: Royce Mitchell <royce3@gmail.com> Date: Tue, 1 Nov 2022 11:19:15 -0500 Subject: [PATCH 588/655] [mod_logfile] Continue renaming if a logfile doesn't exist this prevents a scenario where freeswitch.log fails to get rotated and eventually fills up the hard drive causing a crash. See issue #1738 --- src/mod/loggers/mod_logfile/mod_logfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/loggers/mod_logfile/mod_logfile.c b/src/mod/loggers/mod_logfile/mod_logfile.c index 4dc3c6a7e8..877403c5b6 100644 --- a/src/mod/loggers/mod_logfile/mod_logfile.c +++ b/src/mod/loggers/mod_logfile/mod_logfile.c @@ -163,7 +163,9 @@ static switch_status_t mod_logfile_rotate(logfile_profile_t *profile) if ((status = switch_file_rename(from_filename, to_filename, pool)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error renaming log from %s to %s [%s]\n", from_filename, to_filename, strerror(errno)); - goto end; + if (errno != ENOENT) { + goto end; + } } } From 00f4bc5ab0c533eea9bf69e2b09b951c9a141c17 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 8 Nov 2022 00:43:17 +0300 Subject: [PATCH 589/655] [mod_smpp] Fix use of switch_event_add_header_string with SWITCH_STACK_NODUP. --- .../mod_smpp/mod_smpp_message.c | 38 ++++--------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/src/mod/event_handlers/mod_smpp/mod_smpp_message.c b/src/mod/event_handlers/mod_smpp/mod_smpp_message.c index a7407102bc..33b2f0ba52 100644 --- a/src/mod/event_handlers/mod_smpp/mod_smpp_message.c +++ b/src/mod/event_handlers/mod_smpp/mod_smpp_message.c @@ -121,46 +121,24 @@ switch_status_t mod_smpp_message_create(mod_smpp_gateway_t *gateway, switch_even switch_status_t mod_smpp_message_decode(mod_smpp_gateway_t *gateway, deliver_sm_t *res, switch_event_t **event) { switch_event_t *evt = NULL; - char *str = NULL; if (switch_event_create(&evt, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new event\n"); } switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "endpoint", "mod_smpp"); - - str = switch_mprintf("%d", res->sequence_number); - switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "sequence_number", str); - - str = switch_mprintf("%d", res->command_status); - switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "command_status", str); - - str = switch_mprintf("%d", res->command_id); - switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "command_id", str); - + switch_event_add_header(evt, SWITCH_STACK_BOTTOM, "sequence_number", "%d", res->sequence_number); + switch_event_add_header(evt, SWITCH_STACK_BOTTOM, "command_status", "%d", res->command_status); + switch_event_add_header(evt, SWITCH_STACK_BOTTOM, "command_id", "%d", res->command_id); switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "smpp_gateway", gateway->name); switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "proto", "smpp"); - - str = switch_mprintf("%d", res->source_addr_ton); - switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "source_addr_ton", str); - - str = switch_mprintf("%d", res->source_addr_npi); - switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "source_addr_npi", str); - + switch_event_add_header(evt, SWITCH_STACK_BOTTOM, "source_addr_ton", "%d", res->source_addr_ton); + switch_event_add_header(evt, SWITCH_STACK_BOTTOM, "source_addr_npi", "%d", res->source_addr_npi); switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "from_user", (const char *) res->source_addr); - - str = switch_mprintf("%d", res->dest_addr_ton); - switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "dest_addr_ton", str); - - str = switch_mprintf("%d", res->dest_addr_npi); - switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "dest_addr_npi", str); - + switch_event_add_header(evt, SWITCH_STACK_BOTTOM, "dest_addr_ton", "%d", res->dest_addr_ton); + switch_event_add_header(evt, SWITCH_STACK_BOTTOM, "dest_addr_npi", "%d", res->dest_addr_npi); switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "to_user", (const char *) res->destination_addr); - - str = switch_mprintf("%d", res->data_coding); - switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "data_coding", str); - str = NULL; - + switch_event_add_header(evt, SWITCH_STACK_BOTTOM, "data_coding", "%d", res->data_coding); switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "profile", gateway->profile); switch_event_add_body(evt, "%s", (const char *) res->short_message); From ffa220792607afaa85726348162b5174bfb3b0b6 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 31 Oct 2022 17:49:17 +0300 Subject: [PATCH 590/655] [Core] SWITCH_STACK_NODUP flag is deprecated and will be soon removed. Introduce switch_event_add_header_string_nodup() API. --- src/include/switch_event.h | 1 + .../event_handlers/mod_erlang_event/handle_msg.c | 4 ++-- src/mod/event_handlers/mod_kazoo/kazoo_cdr.c | 14 +++++++------- src/mod/event_handlers/mod_kazoo/kazoo_node.c | 2 +- src/switch_core.c | 2 +- src/switch_event.c | 8 ++++++++ 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/include/switch_event.h b/src/include/switch_event.h index f2ac381ee8..10841f469c 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -206,6 +206,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_set_subclass_name(switch_event_t *e \return SWITCH_STATUS_SUCCESS if the header was added */ SWITCH_DECLARE(switch_status_t) switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data); +SWITCH_DECLARE(switch_status_t) switch_event_add_header_string_nodup(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data); SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val); #define switch_event_del_header(_e, _h) switch_event_del_header_val(_e, _h, NULL) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 292134d716..aad45a4986 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -836,7 +836,7 @@ static switch_status_t handle_msg_sendevent(listener_t *listener, int arity, ei_ switch_safe_free(event->body); event->body = value; } else if (!fail) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value); + switch_event_add_header_string_nodup(event, SWITCH_STACK_BOTTOM, key, value); } /* Do not free malloc here! The above commands utilize the raw allocated memory and skip any copying/duplication. Faster. */ @@ -901,7 +901,7 @@ static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_ } if (!fail) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value); + switch_event_add_header_string_nodup(event, SWITCH_STACK_BOTTOM, key, value); } } diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_cdr.c b/src/mod/event_handlers/mod_kazoo/kazoo_cdr.c index f7b0d53df6..fef66f8be3 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_cdr.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_cdr.c @@ -196,7 +196,7 @@ static switch_status_t kz_report_channel_flaws(switch_core_session_t *session, s kz_switch_ivr_set_json_call_flaws(callStats, session, SWITCH_MEDIA_TYPE_AUDIO); kz_switch_ivr_set_json_call_flaws(callStats, session, SWITCH_MEDIA_TYPE_VIDEO); - switch_event_add_header_string(cdr_event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "_json_channel_media_errors", cJSON_PrintUnformatted(callStats)); + switch_event_add_header_string_nodup(cdr_event, SWITCH_STACK_BOTTOM, "_json_channel_media_errors", cJSON_PrintUnformatted(callStats)); cJSON_Delete(callStats); @@ -210,7 +210,7 @@ static switch_status_t kz_report_channel_stats(switch_core_session_t *session, s kz_switch_ivr_set_json_call_stats(callStats, session, SWITCH_MEDIA_TYPE_AUDIO); kz_switch_ivr_set_json_call_stats(callStats, session, SWITCH_MEDIA_TYPE_VIDEO); - switch_event_add_header_string(cdr_event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "_json_channel_stats", cJSON_PrintUnformatted(callStats)); + switch_event_add_header_string_nodup(cdr_event, SWITCH_STACK_BOTTOM, "_json_channel_stats", cJSON_PrintUnformatted(callStats)); cJSON_Delete(callStats); @@ -237,7 +237,7 @@ static switch_status_t kz_report_app_log(switch_core_session_t *session, switch_ cJSON_AddItemToArray(j_apps, j_application); } - switch_event_add_header_string(cdr_event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "_json_application_log", cJSON_PrintUnformatted(j_apps)); + switch_event_add_header_string_nodup(cdr_event, SWITCH_STACK_BOTTOM, "_json_application_log", cJSON_PrintUnformatted(j_apps)); cJSON_Delete(j_apps); @@ -381,7 +381,7 @@ static switch_status_t kz_report_callflow(switch_core_session_t *session, switch caller_profile = caller_profile->next; } - switch_event_add_header_string(cdr_event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "_json_callflow", cJSON_PrintUnformatted(j_callflow)); + switch_event_add_header_string_nodup(cdr_event, SWITCH_STACK_BOTTOM, "_json_callflow", cJSON_PrintUnformatted(j_callflow)); cJSON_Delete(j_callflow); @@ -435,7 +435,7 @@ static switch_status_t kz_report_originated_legs(switch_core_session_t *session, idx++; } - switch_event_add_header_string(cdr_event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, "_json_originated_legs", cJSON_PrintUnformatted(j_originated)); + switch_event_add_header_string_nodup(cdr_event, SWITCH_STACK_BOTTOM, "_json_originated_legs", cJSON_PrintUnformatted(j_originated)); cJSON_Delete(j_originated); @@ -526,10 +526,10 @@ static switch_status_t kz_report_transfer_history(switch_core_session_t *session for(n=0; n < argc; n++) { kz_report_transfer_history_item(argv[n], j_transfer); } - switch_event_add_header_string(cdr_event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, event_header, cJSON_PrintUnformatted(j_transfer)); + switch_event_add_header_string_nodup(cdr_event, SWITCH_STACK_BOTTOM, event_header, cJSON_PrintUnformatted(j_transfer)); } else if (strchr(history, HST_ITEM_DELIM)) { kz_report_transfer_history_item(history, j_transfer); - switch_event_add_header_string(cdr_event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, event_header, cJSON_PrintUnformatted(j_transfer)); + switch_event_add_header_string_nodup(cdr_event, SWITCH_STACK_BOTTOM, event_header, cJSON_PrintUnformatted(j_transfer)); } cJSON_Delete(j_transfer); switch_safe_free(tmp_history); diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_node.c b/src/mod/event_handlers/mod_kazoo/kazoo_node.c index fae09bee2f..feb8970a86 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_node.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_node.c @@ -512,7 +512,7 @@ static switch_status_t build_event(switch_event_t *event, ei_x_buff * buf) { } } } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value); + switch_event_add_header_string_nodup(event, SWITCH_STACK_BOTTOM, key, value); } n++; } diff --git a/src/switch_core.c b/src/switch_core.c index b9b92f40c7..83db2fc0d9 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -482,7 +482,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_set_var_conditional(const char *varnam if (value) { char *v = strdup(value); switch_string_var_check(v, SWITCH_TRUE); - switch_event_add_header_string(runtime.global_vars, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, varname, v); + switch_event_add_header_string_nodup(runtime.global_vars, SWITCH_STACK_BOTTOM, varname, v); } else { switch_event_del_header(runtime.global_vars, varname); } diff --git a/src/switch_event.c b/src/switch_event.c index 4cc60fa60c..a8ba532d19 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1235,6 +1235,14 @@ SWITCH_DECLARE(switch_status_t) switch_event_set_subclass_name(switch_event_t *e return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_status_t) switch_event_add_header_string_nodup(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data) +{ + if (data) { + return switch_event_base_add_header(event, stack, header_name, (char *)data); + } + return SWITCH_STATUS_GENERR; +} + SWITCH_DECLARE(switch_status_t) switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data) { if (data) { From 17453e00790a4ba6f9f6d66f03e24b0e3030b9a8 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 31 Oct 2022 17:49:17 +0300 Subject: [PATCH 591/655] [Core] Remove deprecated SWITCH_STACK_NODUP flag. Change switch_event_add_header_string() behavior to always dup. --- src/include/switch_types.h | 5 ++--- src/switch_event.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 3ec80a7afd..7b519899af 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1203,9 +1203,8 @@ SWITCH_STACK_TOP - Stack on the top typedef enum { SWITCH_STACK_BOTTOM = (1 << 0), SWITCH_STACK_TOP = (1 << 1), - SWITCH_STACK_NODUP = (1 << 2), - SWITCH_STACK_UNSHIFT = (1 << 3), - SWITCH_STACK_PUSH = (1 << 4), + SWITCH_STACK_UNSHIFT = (1 << 2), + SWITCH_STACK_PUSH = (1 << 3) } switch_stack_t; /*! diff --git a/src/switch_event.c b/src/switch_event.c index a8ba532d19..843469bd72 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1246,7 +1246,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_header_string_nodup(switch_even SWITCH_DECLARE(switch_status_t) switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data) { if (data) { - return switch_event_base_add_header(event, stack, header_name, (stack & SWITCH_STACK_NODUP) ? (char *)data : DUP(data)); + return switch_event_base_add_header(event, stack, header_name, DUP(data)); } return SWITCH_STATUS_GENERR; } From 7afeceb47eece55449dc2e5d3b073ebd0232e8c1 Mon Sep 17 00:00:00 2001 From: Joseph Nadiv <ynadiv@corpit.xyz> Date: Sat, 30 Oct 2021 21:14:00 -0400 Subject: [PATCH 592/655] [mod_sofia] Randomize OPTIONS Ping interval In FS-6400, the attempt was made to randomize OPTIONS packets to be sent at a random interval. The same random interval is applied to all endpoints so this doesn't work. Furthermore, rounding within the code, as well as reseeding with srand() on each run will ultimately make the ping times converge over time. Once the times converge, they will not separate since the reseeding will cause the same random number to apply to each registration. This commmit will apply the random interval only during initial registration and update of registration. All subsequent pings will be incremented with the actual value of ping-mean-interval. (This parameter name is no longer accurate, and would be better named ping-max-interval). srand() has been moved to the start of the worker thread, and all repeat calls have been removed, so that each call of rand(), even during the same second, generates a different random number. Fixes #1132, Fixes #1133 --- src/mod/endpoints/mod_sofia/sofia.c | 3 +++ src/mod/endpoints/mod_sofia/sofia_presence.c | 1 - src/mod/endpoints/mod_sofia/sofia_reg.c | 23 ++++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 6f73823b86..77c0b2d493 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2949,6 +2949,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread sofia_set_pflag_locked(profile, PFLAG_WORKER_RUNNING); + /* Seed PRNG for functions within worker thread */ + srand((unsigned)((intptr_t) switch_thread_self() + switch_micro_time_now())); + while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING))) { if (tick) { diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 00cc8561d6..89324ebe82 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3755,7 +3755,6 @@ void sofia_presence_handle_sip_i_subscribe(int status, if ((sub_max_deviation_var = profile->sip_subscription_max_deviation)) { int sub_deviation; - srand( (unsigned) ( (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now() ) ); /* random negative number between 0 and negative sub_max_deviation_var: */ sub_deviation = ( rand() % sub_max_deviation_var ) - sub_max_deviation_var; if ( (exp_delta + sub_deviation) > 45 ) { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 9791190f5f..d9e04528a8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -884,7 +884,6 @@ long sofia_reg_uniform_distribution(int max) int result; int range = max + 1; - srand((unsigned)((intptr_t) switch_thread_self() + switch_micro_time_now())); result = (int)((double)rand() / (((double)RAND_MAX + (double)1) / range)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Generated random %ld, max is %d\n", (long) result, max); @@ -894,8 +893,7 @@ long sofia_reg_uniform_distribution(int max) void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int interval) { char *sql; - int mean = interval / 2; - long next, irand; + long next; char buf[32] = ""; int count; @@ -952,8 +950,7 @@ void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int inter /* only update if needed */ if (count) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Updating ping expires for profile %s\n", profile->name); - irand = mean + sofia_reg_uniform_distribution(interval); - next = (long) now + irand; + next = (long) now + interval; sql = switch_mprintf("update sip_registrations set ping_expires = %ld where hostname='%q' and profile_name='%q' and ping_expires <= %ld ", next, mod_sofia_globals.hostname, profile->name, (long) now); @@ -1765,7 +1762,6 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu (( exp_max_deviation_var = profile->sip_expires_max_deviation )) ) { if (exp_max_deviation_var > 0) { int exp_deviation; - srand( (unsigned) ( (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now() ) ); /* random number between negative exp_max_deviation_var and positive exp_max_deviation_var: */ exp_deviation = ( rand() % ( exp_max_deviation_var * 2 ) ) - exp_max_deviation_var; exptime += exp_deviation; @@ -2013,23 +2009,26 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu sql = switch_mprintf("insert into sip_registrations " "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires," "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm," - "mwi_user,mwi_host, orig_server_host, orig_hostname, sub_host, ping_status, ping_count, force_ping) " - "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q','%q', '%q', %d, %d)", + "mwi_user,mwi_host, orig_server_host, orig_hostname, sub_host, ping_status, ping_count, ping_expires, force_ping) " + "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q','%q', '%q', %d, %ld, %d)", call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : "", contact_str, reg_desc, rpid, (long) reg_time + (long) exptime + profile->sip_expires_late_margin, agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm, - mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host, "Reachable", 0, force_ping); + mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host, "Reachable", 0, + (long) switch_epoch_time_now(NULL) + sofia_reg_uniform_distribution(profile->iping_seconds), force_ping); } else { sql = switch_mprintf("update sip_registrations set call_id='%q'," "sub_host='%q', network_ip='%q',network_port='%q'," "presence_hosts='%q', server_host='%q', orig_server_host='%q'," "hostname='%q', orig_hostname='%q'," - "expires = %ld, force_ping=%d where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'", + "expires = %ld, ping_expires=%ld, force_ping=%d " + "where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'", call_id, sub_host, network_ip, network_port_c, profile->presence_hosts ? profile->presence_hosts : "", guess_ip4, guess_ip4, mod_sofia_globals.hostname, mod_sofia_globals.hostname, - (long) reg_time + (long) exptime + profile->sip_expires_late_margin, force_ping, - to_user, username, reg_host, contact_str); + (long) reg_time + (long) exptime + profile->sip_expires_late_margin, + (long) switch_epoch_time_now(NULL) + sofia_reg_uniform_distribution(profile->iping_seconds), + force_ping, to_user, username, reg_host, contact_str); } if (sql) { From edd36639c7a57b2430d1df9787137c39da893dfa Mon Sep 17 00:00:00 2001 From: Anthony Minessale <anthm@signalwire.com> Date: Wed, 16 Nov 2022 15:31:36 -0600 Subject: [PATCH 593/655] [Core] Blind pass at using a rwlock for chat_hash --- src/switch_loadable_module.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index cf9c8f368e..f782e89f6e 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -99,6 +99,7 @@ struct switch_loadable_module_container { switch_hash_t *database_hash; switch_hash_t *secondary_recover_hash; switch_mutex_t *mutex; + switch_thread_rwlock_t *chat_rwlock; switch_memory_pool_t *pool; }; @@ -634,7 +635,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable added++; } + switch_thread_rwlock_wrlock(loadable_modules.chat_rwlock); switch_core_hash_insert(loadable_modules.chat_hash, ptr->interface_name, (const void *) ptr); + switch_thread_rwlock_unlock(loadable_modules.chat_rwlock); } } } @@ -822,7 +825,7 @@ static switch_status_t do_chat_send(switch_event_t *message_event) replying = switch_event_get_header(message_event, "replying"); if (!switch_true(replying) && !switch_stristr("global", proto) && !switch_true(switch_event_get_header(message_event, "skip_global_process"))) { - switch_mutex_lock(loadable_modules.mutex); + switch_thread_rwlock_rdlock(loadable_modules.chat_rwlock); for (hi = switch_core_hash_first(loadable_modules.chat_hash); hi; hi = switch_core_hash_next(&hi)) { switch_core_hash_this(hi, &var, NULL, &val); @@ -852,7 +855,7 @@ static switch_status_t do_chat_send(switch_event_t *message_event) } } switch_safe_free(hi); - switch_mutex_unlock(loadable_modules.mutex); + switch_thread_rwlock_unlock(loadable_modules.chat_rwlock); } @@ -1548,7 +1551,9 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t switch_event_fire(&event); removed++; } + switch_thread_rwlock_wrlock(loadable_modules.chat_rwlock); switch_core_hash_delete(loadable_modules.chat_hash, ptr->interface_name); + switch_thread_rwlock_unlock(loadable_modules.chat_rwlock); } } } @@ -2131,7 +2136,8 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo switch_core_hash_init_nocase(&loadable_modules.dialplan_hash); switch_core_hash_init(&loadable_modules.secondary_recover_hash); switch_mutex_init(&loadable_modules.mutex, SWITCH_MUTEX_NESTED, loadable_modules.pool); - + switch_thread_rwlock_create(&loadable_modules.chat_rwlock, loadable_modules.pool); + if (!autoload) return SWITCH_STATUS_SUCCESS; /* From ded2a4c1beaf9bed6d7666fe505e8392fff5eca6 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 30 Nov 2022 23:18:55 +0300 Subject: [PATCH 594/655] [Core] Fix crash in enterprise originate: memory fence the handles. --- src/switch_ivr_originate.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 31b326bc1f..f1e3e39de1 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1465,6 +1465,7 @@ typedef struct { int done; switch_thread_t *thread; switch_mutex_t *mutex; + switch_mutex_t *fence_mutex; switch_dial_handle_t *dh; } enterprise_originate_handle_t; @@ -1479,9 +1480,13 @@ struct ent_originate_ringback { static void *SWITCH_THREAD_FUNC enterprise_originate_thread(switch_thread_t *thread, void *obj) { enterprise_originate_handle_t *handle = (enterprise_originate_handle_t *) obj; + switch_status_t status; + switch_mutex_lock(handle->fence_mutex); handle->done = 0; - handle->status = switch_ivr_originate(NULL, &handle->bleg, &handle->cause, + switch_mutex_unlock(handle->fence_mutex); + + status = switch_ivr_originate(NULL, &handle->bleg, &handle->cause, handle->bridgeto, handle->timelimit_sec, handle->table, handle->cid_name_override, @@ -1492,8 +1497,11 @@ static void *SWITCH_THREAD_FUNC enterprise_originate_thread(switch_thread_t *thr &handle->cancel_cause, handle->dh); - + switch_mutex_lock(handle->fence_mutex); + handle->status = status; handle->done = 1; + switch_mutex_unlock(handle->fence_mutex); + switch_mutex_lock(handle->mutex); switch_mutex_unlock(handle->mutex); @@ -1697,6 +1705,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess switch_dial_handle_dup(&handles[i].dh, hl->handles[i]); } switch_mutex_init(&handles[i].mutex, SWITCH_MUTEX_NESTED, pool); + switch_mutex_init(&handles[i].fence_mutex, SWITCH_MUTEX_NESTED, pool); switch_mutex_lock(handles[i].mutex); switch_thread_create(&handles[i].thread, thd_attr, enterprise_originate_thread, &handles[i], pool); } @@ -1738,13 +1747,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess for (i = 0; i < x_argc; i++) { - + switch_mutex_lock(handles[i].fence_mutex); if (handles[i].done == 0) { running++; } else if (handles[i].done == 1) { if (handles[i].status == SWITCH_STATUS_SUCCESS) { handles[i].done = 2; hp = &handles[i]; + switch_mutex_unlock(handles[i].fence_mutex); goto done; } else { handles[i].done = -1; @@ -1753,6 +1763,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess over++; } + switch_mutex_unlock(handles[i].fence_mutex); + switch_yield(10000); } From 13646cc888f0f8b501919c1d39bc4c9e917624bb Mon Sep 17 00:00:00 2001 From: David Villasmil <david.villasmil.work@gmail.com> Date: Thu, 1 Dec 2022 19:51:17 +0100 Subject: [PATCH 595/655] [mod_sofia] Parse extra headers on reINVITE --- src/mod/endpoints/mod_sofia/sofia.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 6f73823b86..b4eb90f21b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -10299,6 +10299,7 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session, } } + sofia_glue_set_extra_headers(session, sip, SOFIA_SIP_HEADER_PREFIX); switch_channel_execute_on(channel, "execute_on_sip_reinvite"); } From 62d3e52cf90621bb71a1d2b66edfc7692a3e90ef Mon Sep 17 00:00:00 2001 From: morwin1 <118400677+morwin1@users.noreply.github.com> Date: Wed, 7 Dec 2022 04:07:19 +1100 Subject: [PATCH 596/655] [mod_python3] Fix compiler warnings --- .../mod_python3/freeswitch_python.cpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mod/languages/mod_python3/freeswitch_python.cpp b/src/mod/languages/mod_python3/freeswitch_python.cpp index 77c04fa9fc..e35c7ed464 100644 --- a/src/mod/languages/mod_python3/freeswitch_python.cpp +++ b/src/mod/languages/mod_python3/freeswitch_python.cpp @@ -167,9 +167,15 @@ void Session::do_hangup_hook() arglist = Py_BuildValue("(Os)", Self, what); } +#if PY_VERSION_HEX <= 0x03080000 if (!PyEval_CallObject(hangup_func, arglist)) { PyErr_Print(); } +#else + if (!PyObject_CallObject(hangup_func, arglist)) { + PyErr_Print(); + } +#endif Py_XDECREF(arglist); Py_XDECREF(hangup_func_arg); @@ -287,7 +293,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp PyObject *pyresult, *arglist, *io = NULL; int ts = 0; - char *str = NULL, *what = ""; + char *str = NULL, *what = (char*)""; if (TS) { ts++; @@ -302,9 +308,9 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp if (itype == SWITCH_INPUT_TYPE_DTMF) { switch_dtmf_t *dtmf = (switch_dtmf_t *) input; io = mod_python_conjure_DTMF(dtmf->digit, dtmf->duration); - what = "dtmf"; + what = (char*)"dtmf"; } else if (itype == SWITCH_INPUT_TYPE_EVENT){ - what = "event"; + what = (char*)"event"; io = mod_python_conjure_event((switch_event_t *) input); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unsupported type!\n"); @@ -320,8 +326,12 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp } else { arglist = Py_BuildValue("(OsO)", Self, what, io); } - - if ((pyresult = PyEval_CallObject(cb_function, arglist))) { +#if PY_VERSION_HEX <= 0x03080000 + pyresult = PyEval_CallObject(cb_function, arglist); +#else + pyresult = PyObject_CallObject(cb_function, arglist); +#endif + if (pyresult) { str = (char *) PyString_AsString(pyresult); } else { PyErr_Print(); From 4454ea58fd1fc2cfb9560bc7c1290b8fc1a6a02d Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 7 Dec 2022 23:31:51 +0300 Subject: [PATCH 597/655] [Build-System] Improve build time on Windows: Do not download a pre-compiled binary if it's found in a folder pointed by the FreeSWITCHBuildCachePath environment variable. --- w32/downloadpackage.task | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/w32/downloadpackage.task b/w32/downloadpackage.task index 0c7081a0fb..ef5322cfd7 100644 --- a/w32/downloadpackage.task +++ b/w32/downloadpackage.task @@ -100,7 +100,14 @@ using System.Diagnostics; Uri uri = new Uri(package); string urifilename = Path.GetFileName(uri.LocalPath); string output = Path.Combine(outputfolder ?? librarypath, (outputfilename ?? urifilename)); + string cachedir = Environment.GetEnvironmentVariable("FreeSWITCHBuildCachePath") ?? ""; + string cached_file = cachedir != "" ? Path.Combine(cachedir, (outputfilename ?? urifilename)) : ""; + if (cached_file != "" && File.Exists(cached_file)) { + Log.LogMessage(MessageImportance.High, + "Found package in cache \"" + cached_file + "\"."); + File.Copy(cached_file, output); + } else //if (!File.Exists(output)) // Uncomment to skip download if exists { var syncObject = new State From 52e97e8d0a361f6d5de2ede664b5e18c2fe84e3c Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 8 Dec 2022 03:02:42 +0300 Subject: [PATCH 598/655] [Build-System] Fix build on Windows 11: yasm tool compiled for x86 does not work on x64 system. Download yasm.exe 64bit instead. --- w32/yasm.props | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/w32/yasm.props b/w32/yasm.props index 3ebcc6c84c..ffc4151426 100644 --- a/w32/yasm.props +++ b/w32/yasm.props @@ -5,6 +5,9 @@ </ImportGroup> <PropertyGroup> <YasmPropsImported>true</YasmPropsImported> + <Is64yasm Condition="$([System.Environment]::Is64BitProcess)">true</Is64yasm> + <PackageToDownload Condition="'$(Is64yasm)' == 'true'">http://files.freeswitch.org/downloads/win64/yasm.exe</PackageToDownload> + <PackageToDownload Condition="'$(Is64yasm)' != 'true'">http://files.freeswitch.org/downloads/win32/yasm.exe</PackageToDownload> </PropertyGroup> <!-- @@ -28,8 +31,9 @@ --> <Target Name="YasmDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets=""> + <Message Text="System is 64 bit." Condition="'$(Is64yasm)' == 'true'" Importance="High" /> <DownloadPackageTask - package="http://files.freeswitch.org/downloads/win32/yasm.exe" + package="$(PackageToDownload)" expectfileordirectory="$(ProjectDir)\yasm.exe" outputfolder="$(ProjectDir)\" outputfilename="" From ec32dc300f3d6ae0b505dbc2762d7a2db39006e4 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 9 Dec 2022 01:43:10 +0300 Subject: [PATCH 599/655] [Build-System] Update SQLite to 3.40.0 on Windows --- libs/.gitignore | 1 + libs/win32/sqlite/sqlite.2017.vcxproj | 4 ++-- w32/Library/FreeSwitchCore.2017.vcxproj | 8 ++++---- w32/download_sqlite.props | 6 ++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libs/.gitignore b/libs/.gitignore index 7ed9df2c58..87da2671c6 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -617,6 +617,7 @@ srtp/build/compile /curl-*/ /sqlite-*.zip /sqlite-*/ +/sqlite/ /ldns/ /portaudio/ portaudio.*.log diff --git a/libs/win32/sqlite/sqlite.2017.vcxproj b/libs/win32/sqlite/sqlite.2017.vcxproj index fb218bc89b..22becd5fff 100644 --- a/libs/win32/sqlite/sqlite.2017.vcxproj +++ b/libs/win32/sqlite/sqlite.2017.vcxproj @@ -323,10 +323,10 @@ </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\..\sqlite-amalgamation-3080401\sqlite3.c" /> + <ClCompile Include="..\..\sqlite\sqlite3.c" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\sqlite-amalgamation-3080401\sqlite3.h" /> + <ClInclude Include="..\..\sqlite\sqlite3.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/w32/Library/FreeSwitchCore.2017.vcxproj b/w32/Library/FreeSwitchCore.2017.vcxproj index e30868d48c..2f7a3239bd 100644 --- a/w32/Library/FreeSwitchCore.2017.vcxproj +++ b/w32/Library/FreeSwitchCore.2017.vcxproj @@ -128,7 +128,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <BuildLog /> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -178,7 +178,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -219,7 +219,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" <BuildLog /> <ClCompile> <Optimization>MaxSpeed</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader>Create</PrecompiledHeader> @@ -257,7 +257,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\" </Midl> <ClCompile> <Optimization>MaxSpeed</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite;..\..\libs\speex-1.2rc1\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;..\..\libs\libyuv\include;..\..\libs\freetype\include;..\..\libs\libpng;..\..\libs\libvpx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>CJSON_EXPORT_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;SWITCH_HAVE_YUV;SWITCH_HAVE_VPX;SWITCH_HAVE_PNG;SWITCH_HAVE_FREETYPE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader>Create</PrecompiledHeader> diff --git a/w32/download_sqlite.props b/w32/download_sqlite.props index 5ec04a3774..8f4788d264 100644 --- a/w32/download_sqlite.props +++ b/w32/download_sqlite.props @@ -5,6 +5,7 @@ </ImportGroup> <PropertyGroup> <downloadsqlitePropsImported>true</downloadsqlitePropsImported> + <sqliteVersion>3400000</sqliteVersion> </PropertyGroup> <!-- @@ -29,11 +30,12 @@ <Target Name="sqliteDownloadTarget" BeforeTargets="CustomBuild;PreBuildEvent;" DependsOnTargets="7za"> <DownloadPackageTask - package="http://files.freeswitch.org/downloads/libs/sqlite-amalgamation-3080401.zip" - expectfileordirectory="$(BaseDir)libs\sqlite-amalgamation-3080401\sqlite3.c" + package="http://files.freeswitch.org/downloads/libs/sqlite-amalgamation-$(sqliteVersion).zip" + expectfileordirectory="$(BaseDir)libs\sqlite\sqlite3.c" outputfolder="" outputfilename="" extractto="$(BaseDir)libs\" + moveafter="sqlite-amalgamation-$(sqliteVersion)|sqlite" /> </Target> From f71a56022a579a91c8f563cc80c41c5129068bbd Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 9 Dec 2022 17:42:30 +0300 Subject: [PATCH 600/655] [Core] switch_mprintf: Increase the size of loop variables in the printf() implementation. Add unit-tests disabled by default. --- src/switch_mprintf.c | 4 ++-- tests/unit/switch_core.c | 44 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/switch_mprintf.c b/src/switch_mprintf.c index 5f576a0bfd..d840b4f8f1 100644 --- a/src/switch_mprintf.c +++ b/src/switch_mprintf.c @@ -680,8 +680,8 @@ static int vxprintf(void (*func) (void *, const char *, int), /* Consumer of tex case etSQLESCAPE2: case etSQLESCAPE4: case etSQLESCAPE3:{ - int i, j, n, ch, isnull; - int needQuote; + size_t i, j, n, ch; + int needQuote, isnull; char *escarg = va_arg(ap, char *); isnull = escarg == 0; if (isnull) diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index 5689513cbc..4c302ea7aa 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -36,6 +36,8 @@ #include <openssl/ssl.h> #endif +#define ENABLE_SNPRINTFV_TESTS 0 /* Do not turn on for CI as this requires a lot of RAM */ + FST_CORE_BEGIN("./conf") { FST_SUITE_BEGIN(switch_core) @@ -51,6 +53,48 @@ FST_CORE_BEGIN("./conf") } FST_TEARDOWN_END() +#if ENABLE_SNPRINTFV_TESTS + FST_TEST_BEGIN(test_snprintfv_1) + { + size_t src_buf_size = 0x100000001; + char* src = calloc(1, src_buf_size); + + if (!src) { + printf("bad allocation\n"); + + return -1; + } + + src[0] = '\xc0'; + memset(src + 1, '\x80', 0xffffffff); + + char dst[256]; + switch_snprintfv(dst, 256, "'%!q'", src); + free(src); + } + FST_TEST_END() + + FST_TEST_BEGIN(test_snprintfv_2) + { +#define STR_LEN ((0x100000001 - 3) / 2) + + char* src = calloc(1, STR_LEN + 1); /* Account for NULL byte. */ + + if (!src) { return -1; } + + memset(src, 'a', STR_LEN); + + char* dst = calloc(1, STR_LEN + 3); /* Account for extra quotes and NULL byte */ + if (!dst) { return -1; } + + switch_snprintfv(dst, 2 * STR_LEN + 3, "'%q'", src); + + free(src); + free(dst); + } + FST_TEST_END() +#endif + FST_TEST_BEGIN(test_switch_event_add_header_leak) { switch_event_t* event; From a739e197a51f277202803d59f12a54da7d4000da Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 26 Dec 2022 15:30:28 +0300 Subject: [PATCH 601/655] [Core] Fix false-positive illegal memory access detection in switch_console_complete() --- src/switch_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_console.c b/src/switch_console.c index 2de5ac27ab..8e26fec749 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -837,7 +837,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch } } - for (x = 0; x < argc && x < 11; x++) { + for (x = 0; x < argc; x++) { if (h.words + 1 > argc) { if (switch_cache_db_get_type(db) == SCDB_TYPE_CORE_DB) { stream.write_function(&stream, "(a%d like '::%%' or a%d = '' or a%d = '%q')%q", From 908481bd10c54e111099ce1684a17173b6f4ae72 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 28 Dec 2022 14:02:48 +0300 Subject: [PATCH 602/655] [Docs] Update get-started link in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1660933611..923054d848 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Visit [https://signalwire.com](https://signalwire.com/) or https://github.com/ FreeSWITCH is available on [Github](https://github.com/signalwire/freeswitch) in source code format. You can checkout the development branch and build for many popular platforms including Linux, Windows, MacOSX and BSD. There is an issue tracker and pull request system available as part of the repo online. -See [https://freeswitch.com/#getting-started](https://freeswitch.com/#getting-started) for more detailed instructions. +See https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/ for more detailed instructions. ## Additional Help From 84cb1bdf84b2f7a6ecda62e8cc13b34c6a911cb8 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 31 Dec 2022 01:43:03 +0300 Subject: [PATCH 603/655] [Unit-tests] mod_sofia: avoid duplicate symbols on macos. --- src/mod/endpoints/mod_sofia/Makefile.am | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/Makefile.am b/src/mod/endpoints/mod_sofia/Makefile.am index 461db1e6e5..c813f9f597 100644 --- a/src/mod/endpoints/mod_sofia/Makefile.am +++ b/src/mod/endpoints/mod_sofia/Makefile.am @@ -23,7 +23,7 @@ if HAVE_STIRSHAKEN test_test_sofia_funcs_CFLAGS += -DHAVE_STIRSHAKEN endif test_test_sofia_funcs_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) $(STIRSHAKEN_LIBS) -test_test_sofia_funcs_LDADD = libsofiamod.la $(SOFIA_SIP_LIBS) +test_test_sofia_funcs_LDADD = libsofiamod.la $(SOFIA_SIP_LIBS) $(STIRSHAKEN_LIBS) test_test_nuafail_SOURCES = test/test_nuafail.c test_test_nuafail_CFLAGS = $(AM_CFLAGS) $(SOFIA_SIP_CFLAGS) $(STIRSHAKEN_CFLAGS) -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index e40f1e5deb..f4fc4e639b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4667,7 +4667,7 @@ static switch_status_t sofia_manage(char *relative_oid, switch_management_action return SWITCH_STATUS_SUCCESS; } -static int protect_dest_uri(switch_caller_profile_t *cp) +int protect_dest_uri(switch_caller_profile_t *cp) { char *p = cp->destination_number, *o = p; char *q = NULL, *e = NULL, *qenc = NULL; 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 dbc75390d4..1806a8b7eb 100644 --- a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c +++ b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c @@ -31,7 +31,8 @@ #include <switch.h> #include <test/switch_test.h> -#include "../mod_sofia.c" + +int protect_dest_uri(switch_caller_profile_t *cp); static int timeout_sec = 10; static switch_interval_time_t delay_start_ms = 5000; From c69c399dd288ce5765aacd347bd7406d7dcc1cd4 Mon Sep 17 00:00:00 2001 From: Minh <hnimminh@outlook.com> Date: Mon, 9 Jan 2023 20:00:49 +0700 Subject: [PATCH 604/655] [mod_sofia] New chanvars for inbound multiple header identity --- src/mod/endpoints/mod_sofia/sofia.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b4eb90f21b..a2af9c3849 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -11484,6 +11484,16 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } } + if (sip->sip_identity) { + sip_identity_t *id; + + for (id = sip->sip_identity; id; id = id->id_next) { + if (!zstr(id->id_value)) { + switch_channel_add_variable_var_check(channel, "sip_identity", id->id_value, SWITCH_FALSE, SWITCH_STACK_PUSH); + } + } + } + if (sip->sip_identity && sip->sip_identity->id_value) { switch_channel_set_variable(channel, "sip_h_identity", sip->sip_identity->id_value); } From fe68e3aff4cb485c5c0596a1504ec434502cf3b5 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Thu, 12 Jan 2023 18:59:07 +0300 Subject: [PATCH 605/655] [Build-System] Fix NSIG redefinition issue. --- libs/apr/include/fspr_general.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/apr/include/fspr_general.h b/libs/apr/include/fspr_general.h index 103f69f1df..e2261228c0 100644 --- a/libs/apr/include/fspr_general.h +++ b/libs/apr/include/fspr_general.h @@ -29,7 +29,7 @@ #include "fspr_pools.h" #include "fspr_errno.h" -#if !defined(_ANSI_SOURCE) && defined(_DARWIN_C_SOURCE) +#if !defined(NSIG) && !defined(_ANSI_SOURCE) && defined(_DARWIN_C_SOURCE) #define NSIG __DARWIN_NSIG #endif From 4b350962d3400f6121a1828a0f7e0fa7a40bcc7e Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 16 Jan 2023 18:52:26 +0300 Subject: [PATCH 606/655] [mod_verto] Limit websocket payload size to 1000000. --- src/mod/endpoints/mod_verto/mod_verto.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 2245c33a56..d98e1abdef 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1970,6 +1970,7 @@ static void client_run(jsock_t *jsock) { int flags = KWS_BLOCK; int idle = 0; + ks_json_t *params = NULL; if (jsock->profile->vhosts) { flags |= KWS_STAY_OPEN; @@ -1977,7 +1978,14 @@ static void client_run(jsock_t *jsock) } ks_pool_open(&jsock->kpool); + +#if defined(KS_VERSION_NUM) && KS_VERSION_NUM >= 20000 + params = ks_json_create_object(); + ks_json_add_number_to_object(params, "payload_size_max", 1000000); + if (kws_init_ex(&jsock->ws, jsock->client_socket, (jsock->ptype & PTYPE_CLIENT_SSL) ? jsock->profile->ssl_ctx : NULL, 0, flags, jsock->kpool, params) != KS_STATUS_SUCCESS) { +#else if (kws_init(&jsock->ws, jsock->client_socket, (jsock->ptype & PTYPE_CLIENT_SSL) ? jsock->profile->ssl_ctx : NULL, 0, flags, jsock->kpool) != KS_STATUS_SUCCESS) { +#endif log_and_exit(SWITCH_LOG_NOTICE, "%s WS SETUP FAILED\n", jsock->name); } @@ -2123,6 +2131,8 @@ static void client_run(jsock_t *jsock) detach_jsock(jsock); kws_destroy(&jsock->ws); ks_pool_close(&jsock->kpool); + ks_json_delete(&params); + return; } @@ -6769,6 +6779,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load) ks_ssl_init_skip(KS_TRUE); ks_init(); +#if defined(KS_VERSION_NUM) && KS_VERSION_NUM < 20000 + kws_set_global_payload_size_max(1000000); +#endif + if (switch_event_reserve_subclass(MY_EVENT_LOGIN) != SWITCH_STATUS_SUCCESS) { ks_shutdown(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_LOGIN); From b2e78c90e7fb10cd2525018763eb1eec66cb67d7 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 18 Jan 2023 02:55:34 +0300 Subject: [PATCH 607/655] [Build-System] Fix MD5 on Windows. Add a unit-test. --- tests/unit/switch_core.c | 13 +++++++++++++ w32/openssl.props | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/unit/switch_core.c b/tests/unit/switch_core.c index 4c302ea7aa..e51c4e2b1d 100644 --- a/tests/unit/switch_core.c +++ b/tests/unit/switch_core.c @@ -95,6 +95,19 @@ FST_CORE_BEGIN("./conf") FST_TEST_END() #endif + FST_TEST_BEGIN(test_md5) + { + char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 }; + char test_string[] = "test"; + switch_status_t status; + + status = switch_md5_string(digest, (void *)test_string, strlen(test_string)); + + fst_check_int_equals(status, SWITCH_STATUS_SUCCESS); + fst_check_string_equals(digest, "098f6bcd4621d373cade4e832627b4f6"); + } + FST_TEST_END() + FST_TEST_BEGIN(test_switch_event_add_header_leak) { switch_event_t* event; diff --git a/w32/openssl.props b/w32/openssl.props index c3eaa3632b..aa31668a75 100644 --- a/w32/openssl.props +++ b/w32/openssl.props @@ -68,7 +68,7 @@ <AdditionalIncludeDirectories>$(OpenSSLLibDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Platform)'=='Win32'">$(OpenSSLLibDir)\include_x86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(OpenSSLLibDir)\include_x64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>OPENSSL;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;HAVE_OPENSSL_DTLSv1_2_method;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>HAVE_LIBCRYPTO;OPENSSL;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;HAVE_OPENSSL_DTLSv1_2_method;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <Link> <AdditionalLibraryDirectories>$(OpenSSLLibDir)\binaries\$(Platform)\$(LibraryConfiguration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> From a6096ce3184726c6cd38d7c1167015a7c34ad6c9 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 18 Jan 2023 19:45:35 +0300 Subject: [PATCH 608/655] Bump sofia-sip library requirement to version 1.13.12 --- configure.ac | 2 +- debian/bootstrap.sh | 4 ++-- freeswitch.spec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index b2bd0ad876..e64636fc1c 100644 --- a/configure.ac +++ b/configure.ac @@ -716,7 +716,7 @@ PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[ AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent]) ]) -PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.6],[ +PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.12],[ AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[ AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent]) ]) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 71c5b52f99..6b1a83b86b 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -332,7 +332,7 @@ Build-Depends: uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev, # used by many modules libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, - bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.6), + bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.12), libspandsp3-dev, # used to format the private freeswitch apt-repo key properly gnupg, @@ -371,7 +371,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: libfreeswitch1 Architecture: amd64 armhf -Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.6) +Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.12) Recommends: Suggests: libfreeswitch1-dbg Conflicts: freeswitch-all (<= 1.6.7) diff --git a/freeswitch.spec b/freeswitch.spec index 709f3ef38d..807d3e7395 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -140,7 +140,7 @@ BuildRequires: curl-devel >= 7.19 BuildRequires: gcc-c++ BuildRequires: libtool >= 1.5.17 BuildRequires: openssl-devel >= 1.0.1e -BuildRequires: sofia-sip-devel >= 1.13.6 +BuildRequires: sofia-sip-devel >= 1.13.12 BuildRequires: spandsp3-devel >= 3.0 BuildRequires: pcre-devel BuildRequires: speex-devel From 9fd214fcbb1a21325570f394153742bd556a76ce Mon Sep 17 00:00:00 2001 From: Jordan Yelloz <jordan.yelloz@collabora.com> Date: Fri, 16 Dec 2022 12:35:27 -0700 Subject: [PATCH 609/655] [mod_ladspa] Add activate/deactivate support. Without these -- especially activate() -- stateful plugins will not be set up correctly. For example, the low-pass filter "lpf" in the CMT library may produce a pop when starting since its state is not zeroed out. --- src/mod/applications/mod_ladspa/mod_ladspa.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mod/applications/mod_ladspa/mod_ladspa.c b/src/mod/applications/mod_ladspa/mod_ladspa.c index 2bccfffb9c..6e04e414a9 100644 --- a/src/mod/applications/mod_ladspa/mod_ladspa.c +++ b/src/mod/applications/mod_ladspa/mod_ladspa.c @@ -370,6 +370,11 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s } } } + + if (pvt->ldesc->activate) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "ACTIVATE\n"); + pvt->ldesc->activate(pvt->handle); + } } break; @@ -382,6 +387,10 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s } if (pvt->handle && pvt->ldesc) { + if (pvt->ldesc->deactivate) { + pvt->ldesc->deactivate(pvt->handle); + } + pvt->ldesc->cleanup(pvt->handle); } From c013a7dc644c2e8c5121ac63c98c3c29c04a30b3 Mon Sep 17 00:00:00 2001 From: Len <Len-PGH@users.noreply.github.com> Date: Mon, 23 Jan 2023 18:04:01 -0500 Subject: [PATCH 610/655] [Configuration] Use : not , in rtp_secure_media --- conf/vanilla/vars.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/vanilla/vars.xml b/conf/vanilla/vars.xml index e612694c83..8948d179cc 100644 --- a/conf/vanilla/vars.xml +++ b/conf/vanilla/vars.xml @@ -137,13 +137,13 @@ By default without specifying any crypto suites FreeSWITCH will offer crypto suites from strongest to weakest accepting the strongest each endpoint has in common. If you wish to force specific crypto suites you - can do so by appending the suites in a comma separated list in the order + can do so by appending the suites in a colon separated list in the order that you wish to offer them in. Examples: - rtp_secure_media=mandatory:AES_CM_256_HMAC_SHA1_80,AES_CM_256_HMAC_SHA1_32 - rtp_secure_media=true:AES_CM_256_HMAC_SHA1_80,AES_CM_256_HMAC_SHA1_32 + rtp_secure_media=mandatory:AES_CM_256_HMAC_SHA1_80:AES_CM_256_HMAC_SHA1_32 + rtp_secure_media=true:AES_CM_256_HMAC_SHA1_80:AES_CM_256_HMAC_SHA1_32 rtp_secure_media=optional:AES_CM_256_HMAC_SHA1_80 rtp_secure_media=true:AES_CM_256_HMAC_SHA1_80 From 889afccad06a774d11098f06c1b2829f96ebbe49 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 24 Jan 2023 14:14:27 +0300 Subject: [PATCH 611/655] [mod_xml_curl] Fix leaking event in xml_url_fetch() --- src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index 5a2e201a72..6a8f2aac53 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -141,6 +141,7 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data) static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data) { + switch_event_t *my_params = NULL; char filename[512] = ""; switch_CURL *curl_handle = NULL; switch_CURLcode cc; @@ -185,6 +186,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con if (!params) { switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS); switch_assert(params); + my_params = params; } switch_event_add_header_string(params, SWITCH_STACK_TOP, "hostname", hostname); @@ -333,6 +335,11 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_safe_free(uri); if (binding->use_dynamic_url && dynamic_url != binding->url) switch_safe_free(dynamic_url); + + if (my_params) { + switch_event_destroy(&my_params); + } + return xml; } From 3326f4ec577ba692158d45a0efddcb925d82180d Mon Sep 17 00:00:00 2001 From: Adrian Fretwell <adrian.fretwell@topgreen.co.uk> Date: Tue, 24 Jan 2023 15:14:29 +0000 Subject: [PATCH 612/655] [mod_python3] Create an event on python_fetch() --- src/mod/languages/mod_python3/mod_python3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/mod/languages/mod_python3/mod_python3.c b/src/mod/languages/mod_python3/mod_python3.c index 52a3312361..ca05f18710 100644 --- a/src/mod/languages/mod_python3/mod_python3.c +++ b/src/mod/languages/mod_python3/mod_python3.c @@ -354,12 +354,24 @@ static switch_xml_t python_fetch(const char *section, switch_xml_t xml = NULL; char *str = NULL; + switch_event_t *my_params = NULL; if (!zstr(globals.xml_handler)) { char *mycmd = strdup(globals.xml_handler); switch_assert(mycmd); + if (!params) { + switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS); + switch_assert(params); + my_params = params; + } + + switch_event_add_header_string(params, SWITCH_STACK_TOP, "section", switch_str_nil(section)); + switch_event_add_header_string(params, SWITCH_STACK_TOP, "tag_name", switch_str_nil(tag_name)); + switch_event_add_header_string(params, SWITCH_STACK_TOP, "key_name", switch_str_nil(key_name)); + switch_event_add_header_string(params, SWITCH_STACK_TOP, "key_value", switch_str_nil(key_value)); + eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str, NULL); if (str) { @@ -372,6 +384,10 @@ static switch_xml_t python_fetch(const char *section, } free(mycmd); + + if (my_params) { + switch_event_destroy(&my_params); + } } return xml; From b241a82d83a5e6519ef2d91cd88fc75d8305a726 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 25 Jan 2023 18:42:48 +0300 Subject: [PATCH 613/655] [Build-System] Update libks to 1.8.2 and signalwire-client-c to 1.3.2 on Windows --- w32/libks-version.props | 2 +- w32/signalwire-client-c-version.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/w32/libks-version.props b/w32/libks-version.props index c6845777cc..fd99aa73ca 100644 --- a/w32/libks-version.props +++ b/w32/libks-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <libksVersion>1.8.0</libksVersion> + <libksVersion>1.8.2</libksVersion> </PropertyGroup> <PropertyGroup> <libksVersionImported>true</libksVersionImported> diff --git a/w32/signalwire-client-c-version.props b/w32/signalwire-client-c-version.props index 56b4dc5545..53d65c87bd 100644 --- a/w32/signalwire-client-c-version.props +++ b/w32/signalwire-client-c-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <signalwire-client-cVersion>1.3.0</signalwire-client-cVersion> + <signalwire-client-cVersion>1.3.2</signalwire-client-cVersion> </PropertyGroup> <PropertyGroup> <signalwire-client-cVersionImported>true</signalwire-client-cVersionImported> From 06f45d2872c08924589a109737bdd4c6dd495efe Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 1 Feb 2023 01:30:11 +0300 Subject: [PATCH 614/655] [Build-system] Update libks version requirement to 1.8.2 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e64636fc1c..b3dad2275f 100644 --- a/configure.ac +++ b/configure.ac @@ -1518,7 +1518,7 @@ PKG_CHECK_MODULES([V8FS_STATIC], [v8-6.1_static >= 6.1.298],[ ]) ]) -PKG_CHECK_MODULES([KS], [libks >= 1.1.0],[ +PKG_CHECK_MODULES([KS], [libks >= 1.8.2],[ AM_CONDITIONAL([HAVE_KS],[true])],[ if module_enabled mod_verto; then AC_MSG_ERROR([You need to either install libks or disable mod_verto in modules.conf]) From 3cb697c495f88c9e524fed716e818e1aa5ac000f Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 3 Feb 2023 18:46:31 +0000 Subject: [PATCH 615/655] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 18 + src/mod/languages/mod_managed/managed/swig.cs | 15183 ++++++++-------- 2 files changed, 7613 insertions(+), 7588 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index d68cbc0e2d..89614987b5 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -39405,6 +39405,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_add_header_stri } +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_add_header_string_nodup___(void * jarg1, int jarg2, char * jarg3, char * jarg4) { + int jresult ; + switch_event_t *arg1 = (switch_event_t *) 0 ; + switch_stack_t arg2 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_event_t *)jarg1; + arg2 = (switch_stack_t)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + result = (switch_status_t)switch_event_add_header_string_nodup(arg1,arg2,(char const *)arg3,(char const *)arg4); + jresult = (int)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_del_header_val___(void * jarg1, char * jarg2, char * jarg3) { int jresult ; switch_event_t *arg1 = (switch_event_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index e5f94152c4..6483ed103b 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -73,93 +73,6 @@ public class Api : global::System.IDisposable { namespace FreeSWITCH.Native { -public class audio_buffer_header_t : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal audio_buffer_header_t(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(audio_buffer_header_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~audio_buffer_header_t() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_audio_buffer_header_t(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public uint ts { - set { - freeswitchPINVOKE.audio_buffer_header_t_ts_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.audio_buffer_header_t_ts_get(swigCPtr); - return ret; - } - } - - public uint len { - set { - freeswitchPINVOKE.audio_buffer_header_t_len_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.audio_buffer_header_t_len_get(swigCPtr); - return ret; - } - } - - public audio_buffer_header_t() : this(freeswitchPINVOKE.new_audio_buffer_header_t(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum cache_db_flag_t { - CDF_INUSE = (1 << 0), - CDF_PRUNE = (1 << 1), - CDF_NONEXPIRING = (1 << 2) -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 CoreSession : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -547,155 +460,6 @@ public class CoreSession : global::System.IDisposable { namespace FreeSWITCH.Native { -public enum dm_match_type_t { - DM_MATCH_POSITIVE, - DM_MATCH_NEGATIVE -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 dtls_fingerprint_t : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal dtls_fingerprint_t(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(dtls_fingerprint_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~dtls_fingerprint_t() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_dtls_fingerprint_t(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public uint len { - set { - freeswitchPINVOKE.dtls_fingerprint_t_len_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.dtls_fingerprint_t_len_get(swigCPtr); - return ret; - } - } - - public SWIGTYPE_p_unsigned_char data { - set { - freeswitchPINVOKE.dtls_fingerprint_t_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.dtls_fingerprint_t_data_get(swigCPtr); - SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); - return ret; - } - } - - public string type { - set { - freeswitchPINVOKE.dtls_fingerprint_t_type_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.dtls_fingerprint_t_type_get(swigCPtr); - return ret; - } - } - - public string str { - set { - freeswitchPINVOKE.dtls_fingerprint_t_str_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.dtls_fingerprint_t_str_get(swigCPtr); - return ret; - } - } - - public dtls_fingerprint_t() : this(freeswitchPINVOKE.new_dtls_fingerprint_t(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum dtls_state_t { - DS_OFF, - DS_HANDSHAKE, - DS_SETUP, - DS_READY, - DS_FAIL, - DS_INVALID -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum dtls_type_t { - DTLS_TYPE_CLIENT = (1 << 0), - DTLS_TYPE_SERVER = (1 << 1), - DTLS_TYPE_RTP = (1 << 2), - DTLS_TYPE_RTCP = (1 << 3) -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 DTMF : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -764,9 +528,133 @@ public class DTMF : global::System.IDisposable { namespace FreeSWITCH.Native { -public enum dtmf_flag_t { - DTMF_FLAG_SKIP_PROCESS = (1 << 0), - DTMF_FLAG_SENSITIVE = (1 << 1) +public partial class Event : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Event(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Event obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~Event() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_Event(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public switch_event InternalEvent { + set { + freeswitchPINVOKE.Event_InternalEvent_set(swigCPtr, switch_event.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.Event_InternalEvent_get(swigCPtr); + switch_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_event(cPtr, false); + return ret; + } + } + + public string serialized_string { + set { + freeswitchPINVOKE.Event_serialized_string_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.Event_serialized_string_get(swigCPtr); + return ret; + } + } + + public int mine { + set { + freeswitchPINVOKE.Event_mine_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.Event_mine_get(swigCPtr); + return ret; + } + } + + public Event(string type, string subclass_name) : this(freeswitchPINVOKE.new_Event__SWIG_0(type, subclass_name), true) { + } + + public Event(switch_event wrap_me, int free_me) : this(freeswitchPINVOKE.new_Event__SWIG_1(switch_event.getCPtr(wrap_me), free_me), true) { + } + + public int chat_execute(string app, string data) { + int ret = freeswitchPINVOKE.Event_chat_execute(swigCPtr, app, data); + return ret; + } + + public int chat_send(string dest_proto) { + int ret = freeswitchPINVOKE.Event_chat_send(swigCPtr, dest_proto); + return ret; + } + + public string Serialize(string format) { + string ret = freeswitchPINVOKE.Event_Serialize(swigCPtr, format); + return ret; + } + + public bool SetPriority(switch_priority_t priority) { + bool ret = freeswitchPINVOKE.Event_SetPriority(swigCPtr, (int)priority); + return ret; + } + + public string GetHeader(string header_name) { + string ret = freeswitchPINVOKE.Event_GetHeader(swigCPtr, header_name); + return ret; + } + + public string GetBody() { + string ret = freeswitchPINVOKE.Event_GetBody(swigCPtr); + return ret; + } + + public string GetEventType() { + string ret = freeswitchPINVOKE.Event_GetEventType(swigCPtr); + return ret; + } + + public bool AddBody(string value) { + bool ret = freeswitchPINVOKE.Event_AddBody(swigCPtr, value); + return ret; + } + + public bool AddHeader(string header_name, string value) { + bool ret = freeswitchPINVOKE.Event_AddHeader(swigCPtr, header_name, value); + return ret; + } + + public bool DeleteHeader(string header_name) { + bool ret = freeswitchPINVOKE.Event_DeleteHeader(swigCPtr, header_name); + return ret; + } + + public bool Fire() { + bool ret = freeswitchPINVOKE.Event_Fire(swigCPtr); + return ret; + } + + public bool merge(Event to_merge) { + bool ret = freeswitchPINVOKE.Event_merge(swigCPtr, Event.getCPtr(to_merge)); + return ret; + } + } } @@ -917,20 +805,20 @@ public class EventConsumer : global::System.IDisposable { namespace FreeSWITCH.Native { -public partial class Event : global::System.IDisposable { +public class IvrMenu : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; - internal Event(global::System.IntPtr cPtr, bool cMemoryOwn) { + internal IvrMenu(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Event obj) { + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IvrMenu obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - ~Event() { + ~IvrMenu() { Dispose(); } @@ -939,7 +827,7 @@ public partial class Event : global::System.IDisposable { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; - freeswitchPINVOKE.delete_Event(swigCPtr); + freeswitchPINVOKE.delete_IvrMenu(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } @@ -947,103 +835,6976 @@ public partial class Event : global::System.IDisposable { } } - public switch_event InternalEvent { + public IvrMenu(IvrMenu 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) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.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), true) { + } + + public void bindAction(string action, string arg, string bind) { + freeswitchPINVOKE.IvrMenu_bindAction(swigCPtr, action, arg, bind); + } + + public void Execute(CoreSession session, string name) { + freeswitchPINVOKE.IvrMenu_Execute(swigCPtr, CoreSession.getCPtr(session), name); + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 partial class ManagedSession : CoreSession { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ManagedSession(global::System.IntPtr cPtr, bool cMemoryOwn) : base(freeswitchPINVOKE.ManagedSession_SWIGUpcast(cPtr), cMemoryOwn) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ManagedSession obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~ManagedSession() { + Dispose(); + } + + public override void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_ManagedSession(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + base.Dispose(); + } + } + + public ManagedSession() : this(freeswitchPINVOKE.new_ManagedSession__SWIG_0(), true) { + } + + public ManagedSession(string uuid) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_1(uuid), true) { + } + + public ManagedSession(SWIGTYPE_p_switch_core_session session) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_2(SWIGTYPE_p_switch_core_session.getCPtr(session)), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_FILE { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_FILE(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_FILE() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_FILE obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_a_256__char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_a_256__char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_a_256__char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_a_256__char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_a_2__icand_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_a_2__icand_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_a_2__icand_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_a_2__icand_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; + + internal SWIGTYPE_p_cJSON(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_cJSON() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_cJSON obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_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_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_p_switch_database_interface_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_p_switch_database_interface_handle__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_database_interface_handle__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_database_interface_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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_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_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_fspr_pool_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__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_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char__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_q_const__char_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__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_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__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_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__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_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_p_unsigned_long__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_q_const__char_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__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_q_const__char_p_switch_codec_fmtp__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__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_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_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_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_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_q_const__void_p_q_const__void_p_void__switch_bool_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle__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_switch_asr_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_char_double__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void() { + 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_asr_handle_p_char_double__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_char_int__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void() { + 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_asr_handle_p_char_int__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_char_p_q_const__char__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void() { + 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_asr_handle_p_char_p_q_const__char__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__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_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__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_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__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_switch_asr_handle_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__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_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__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_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__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_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__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_switch_asr_handle_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__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_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_codec__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_codec__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_codec__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_switch_codec__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal 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(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected 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() { + 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_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 obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal 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(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected 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() { + 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_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_codec_p_switch_frame__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_codec_p_switch_frame__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_switch_codec_p_switch_frame__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__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_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session__int() { + 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__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session__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_switch_core_session__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void() { + 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_enum_switch_channel_callstate_t_p_switch_device_record_s__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_int__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_switch_core_session_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_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_char_p_switch_say_args_t_p_p_char__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_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_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_char_p_switch_say_args_t_p_switch_input_args_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_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_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_p_switch_frame_unsigned_long_int__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_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__char__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void() { + 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_q_const__char__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_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_q_const__char_p_q_const__char__switch_bool_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_q_const__char_p_q_const__char__switch_bool_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_status_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_q_const__char_p_q_const__char__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_switch_core_session_p_q_const__char_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_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_q_const__char_p_q_const__char_q_const__int_q_const__int__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_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_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_q_const__switch_dtmf_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_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_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_q_const__switch_dtmf_t_enum_switch_dtmf_direction_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_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_core_session_message__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_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_core_session_message__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_switch_core_session_p_switch_core_session_message__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_event__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_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__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_switch_core_session_p_switch_event__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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_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_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_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; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_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_switch_core_session_unsigned_long__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_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_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_frame_p_void__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_switch_core_session_p_switch_frame_p_void__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_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_frame_unsigned_long_int__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_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_void__p_void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_void__p_void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_p_void__p_void() { + 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_void__p_void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_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_void_enum_switch_input_type_t_p_void_unsigned_int__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_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension() { + 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_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s() { + 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_t_switch_media_type_t__p_switch_jb_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_database_interface_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_database_interface_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_database_interface_handle__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_switch_database_interface_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_database_interface_handle_enum_switch_bool_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_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_switch_database_interface_handle_enum_switch_bool_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_database_interface_handle_p_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__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_switch_database_interface_handle_p_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__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_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_directory_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_directory_handle__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_switch_directory_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_directory_handle_p_char_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__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_switch_directory_handle_p_char_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__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_switch_directory_handle_p_char_p_char_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__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_switch_directory_handle_p_p_char_p_p_char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_event__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_event__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_event__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_switch_event__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_event__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_event__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_event__void() { + 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_event__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_event_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_event_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_event_p_q_const__char__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_switch_event_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle__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_switch_file_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__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_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__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_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_enum_switch_file_command_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_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_switch_file_handle_enum_switch_file_command_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_long_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_long_long__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_switch_file_handle_long_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_q_const__char__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__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_switch_file_handle_p_q_const__char__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_switch_frame__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__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_switch_file_handle_p_switch_frame__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_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_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__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_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_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_switch_file_handle_p_void_p_switch_size_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_ivr_dmachine_match__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_ivr_dmachine_match__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_switch_ivr_dmachine_match__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_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_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void() { + 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_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_media_bug_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_media_bug_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_media_bug_p_void__void() { + 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_media_bug_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_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_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void() { + 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_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_scheduler_task__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_scheduler_task__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_scheduler_task__void() { + 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_scheduler_task__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle__void() { + 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_speech_handle__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_char_double__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void() { + 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_speech_handle_p_char_double__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_char_int__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void() { + 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_speech_handle_p_char_int__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_char_p_q_const__char__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void() { + 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_speech_handle_p_char_p_q_const__char__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__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_switch_speech_handle_p_char_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__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_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__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_switch_speech_handle_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__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_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_stream_handle_p_int__p_unsigned_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char() { + 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_stream_handle_p_int__p_unsigned_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______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_switch_stream_handle_p_q_const__char_v_______switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_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_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_thread_t_p_void__p_void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void() { + 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_thread_t_p_void__p_void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_timer__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_timer__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_timer__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_switch_timer__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_switch_timer_enum_switch_bool_t__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_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_switch_timer_enum_switch_bool_t__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_void__void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void__void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void__void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void__void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_void_int_p_p_char_p_p_char__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_void_p_q_const__char__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void_p_q_const__char__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void_p_q_const__char__int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_q_const__char__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_p_void_p_switch_event__int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void_p_switch_event__int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void_p_switch_event__int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_switch_event__int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__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_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_void__p_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_void__p_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_void__p_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_void__p_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_f_void__switch_status_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_void__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_void__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_void__switch_status_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_float { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_float(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_float() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_float obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; + + internal SWIGTYPE_p_in6_addr(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_in6_addr() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_in6_addr obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; + + internal SWIGTYPE_p_p_cJSON(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_cJSON() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_cJSON obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_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; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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; + + internal SWIGTYPE_p_p_p_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_p_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_p_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_payload_map_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_payload_map_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_payload_map_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_payload_map_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_real_pcre { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_real_pcre(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_real_pcre() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_real_pcre obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sqlite3 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_sqlite3(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_sqlite3() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_sqlite3 obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sqlite3_stmt { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_sqlite3_stmt(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_sqlite3_stmt() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_sqlite3_stmt obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_agc_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_agc_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_agc_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_agc_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_audio_resampler_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_audio_resampler_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_audio_resampler_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_audio_resampler_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_buffer { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_buffer(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_buffer() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_buffer obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_cache_db_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_cache_db_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_cache_db_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_cache_db_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_caller_extension { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_caller_extension(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_caller_extension() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_caller_extension obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_channel { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_channel(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_channel() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_channel obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_codec_implementation { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_codec_implementation(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_codec_implementation() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_codec_implementation obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_console_callback_match { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_console_callback_match(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_console_callback_match() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_console_callback_match obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_port_allocator { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_core_port_allocator(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_core_port_allocator() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_port_allocator obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_session { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_core_session(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_core_session() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_session_message { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_core_session_message(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_core_session_message() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session_message obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_device_record_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_device_record_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_device_record_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_device_record_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_handle_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_handle_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_list_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_handle_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_handle_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_handle_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_leg_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_leg_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_leg_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_leg_list_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_leg_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_dial_leg_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_dial_leg_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_leg_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_event { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_event(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_event() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_event obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_event_node { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_event_node(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_event_node() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_event_node obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_file_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_file_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_file_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_file_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_frame { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_frame(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_frame() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_frame obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_frame_buffer_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_frame_buffer_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_frame_buffer_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_frame_buffer_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_hashtable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_hashtable(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_hashtable() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_hashtable obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_hashtable_iterator { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_hashtable_iterator(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_hashtable_iterator() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_hashtable_iterator obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_digit_stream { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_digit_stream(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_digit_stream() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_digit_stream_parser { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_digit_stream_parser(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_digit_stream_parser() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream_parser obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_dmachine { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_dmachine_match { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine_match(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine_match() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine_match obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_menu { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_menu(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_menu() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_menu_xml_ctx { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_menu_xml_ctx(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_menu_xml_ctx() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_live_array_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_live_array_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_live_array_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_live_array_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_log_node_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_log_node_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_log_node_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_log_node_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_media_bug { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_media_bug(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_media_bug() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_media_bug obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_network_list { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_network_list(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_network_list() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_network_list obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_rtp { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_rtp(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_rtp() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_rtp obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_say_file_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_say_file_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_say_file_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_say_file_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_sql_queue_manager { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_sql_queue_manager(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_sql_queue_manager() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_sql_queue_manager obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_thread_data_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_thread_data_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_thread_data_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_thread_data_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_xml { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_xml() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_xml obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_xml_binding { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_xml_binding(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_xml_binding() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_xml_binding obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_unsigned_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_unsigned_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_p_void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_pid_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_pid_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_pid_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_pid_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_real_pcre { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_real_pcre(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_real_pcre() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_real_pcre obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_short { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_short(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_short() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_short obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sockaddr { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_sockaddr(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_sockaddr() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sockaddr obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sockaddr_in6 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_sockaddr_in6(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_sockaddr_in6() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sockaddr_in6 obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_socklen_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_socklen_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_socklen_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_socklen_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sqlite3 { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_sqlite3(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_sqlite3() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sqlite3 obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_sqlite3_stmt { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_sqlite3_stmt(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_sqlite3_stmt() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sqlite3_stmt obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_agc_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_agc_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_agc_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_agc_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_buffer { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_buffer(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_buffer() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_buffer obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_cache_db_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_cache_db_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_cache_db_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_cache_db_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_call_cause_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_call_cause_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_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_switch_call_cause_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_channel { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_channel(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_channel() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_channel obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_codec_control_type_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_codec_control_type_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_codec_control_type_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_codec_control_type_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_port_allocator { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_core_port_allocator(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_core_port_allocator() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_core_port_allocator obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_core_session { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_core_session(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_core_session() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_core_session obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_handle_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_handle_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_list_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_handle_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_handle_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_handle_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_leg_list_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_leg_list_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_leg_list_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_leg_list_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_dial_leg_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_dial_leg_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_dial_leg_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_leg_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_event_types_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_event_types_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_event_types_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_event_types_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_file_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_file_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_file_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_file_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_frame_buffer_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_frame_buffer_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_frame_buffer_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_frame_buffer_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_hashtable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_hashtable(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_hashtable() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_hashtable obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_hashtable_iterator { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_hashtable_iterator(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_hashtable_iterator() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_hashtable_iterator obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_image_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_image_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_image_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_image_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_img_fmt_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_img_fmt_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_img_fmt_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_img_fmt_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_img_position_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_img_position_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_img_position_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_img_position_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_interval_time_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_interval_time_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_interval_time_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_interval_time_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_action_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_action_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_action_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_action_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_digit_stream { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_digit_stream(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_digit_stream() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_digit_stream_parser { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_digit_stream_parser(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_digit_stream_parser() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream_parser obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_dmachine { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_dmachine(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_dmachine() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_dmachine obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_menu { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_menu(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_menu() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ivr_menu_xml_ctx { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_menu_xml_ctx(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_menu_xml_ctx() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu_xml_ctx obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_jb_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_jb_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_jb_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_jb_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_live_array_s { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_live_array_s(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_live_array_s() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_live_array_s obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_media_bug { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_media_bug(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_media_bug() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_media_bug obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_mutex_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_mutex_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_mutex_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_mutex_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_network_list { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_network_list(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_network_list() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_network_list obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_odbc_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_odbc_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_odbc_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_odbc_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_pollfd_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_pollfd_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_pollfd_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_pollfd_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_queue_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_queue_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_queue_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_queue_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_rtcp_frame { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_rtcp_frame(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_rtcp_frame() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtcp_frame obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_rtp { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_rtp(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_rtp() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtp obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_rtp_flag_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_rtp_flag_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_rtp_flag_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtp_flag_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_say_file_handle { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_say_file_handle(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_say_file_handle() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_say_file_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_size_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_size_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_size_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_size_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_sockaddr_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_sockaddr_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_sockaddr_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_sockaddr_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_socket_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_socket_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_socket_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_socket_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_sql_queue_manager { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_sql_queue_manager(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_sql_queue_manager() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_sql_queue_manager obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_ssize_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ssize_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ssize_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ssize_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_thread_rwlock_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_thread_rwlock_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_thread_rwlock_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_rwlock_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_thread_start_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_thread_start_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_thread_start_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_start_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_thread_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_thread_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_thread_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_time_exp_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_time_exp_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_time_exp_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_time_exp_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_time_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_time_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_time_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_time_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_switch_xml_binding { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_xml_binding(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_xml_binding() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_xml_binding obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_time_t { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_time_t(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_time_t() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_time_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_char { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_char() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_char obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_int { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_int(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_int() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_int obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_long { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_long(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_long() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_long obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_unsigned_short { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_short(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_short() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_short obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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_void { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_void(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_void() { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_void obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 partial class Stream : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Stream(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Stream obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~Stream() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_Stream(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public Stream() : this(freeswitchPINVOKE.new_Stream__SWIG_0(), true) { + } + + public Stream(switch_stream_handle arg0) : this(freeswitchPINVOKE.new_Stream__SWIG_1(switch_stream_handle.getCPtr(arg0)), true) { + } + + public string read(SWIGTYPE_p_int len) { + string ret = freeswitchPINVOKE.Stream_read(swigCPtr, SWIGTYPE_p_int.getCPtr(len)); + return ret; + } + + public void Write(string data) { + freeswitchPINVOKE.Stream_Write(swigCPtr, data); + } + + public void raw_write(string data, int len) { + freeswitchPINVOKE.Stream_raw_write(swigCPtr, data, len); + } + + public string get_data() { + string ret = freeswitchPINVOKE.Stream_get_data(swigCPtr); + return ret; + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 audio_buffer_header_t : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal audio_buffer_header_t(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(audio_buffer_header_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~audio_buffer_header_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_audio_buffer_header_t(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public uint ts { set { - freeswitchPINVOKE.Event_InternalEvent_set(swigCPtr, switch_event.getCPtr(value)); + freeswitchPINVOKE.audio_buffer_header_t_ts_set(swigCPtr, value); } get { - global::System.IntPtr cPtr = freeswitchPINVOKE.Event_InternalEvent_get(swigCPtr); - switch_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_event(cPtr, false); + uint ret = freeswitchPINVOKE.audio_buffer_header_t_ts_get(swigCPtr); return ret; } } - public string serialized_string { + public uint len { set { - freeswitchPINVOKE.Event_serialized_string_set(swigCPtr, value); + freeswitchPINVOKE.audio_buffer_header_t_len_set(swigCPtr, value); } get { - string ret = freeswitchPINVOKE.Event_serialized_string_get(swigCPtr); + uint ret = freeswitchPINVOKE.audio_buffer_header_t_len_get(swigCPtr); return ret; } } - public int mine { + public audio_buffer_header_t() : this(freeswitchPINVOKE.new_audio_buffer_header_t(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum cache_db_flag_t { + CDF_INUSE = (1 << 0), + CDF_PRUNE = (1 << 1), + CDF_NONEXPIRING = (1 << 2) +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum dm_match_type_t { + DM_MATCH_POSITIVE, + DM_MATCH_NEGATIVE +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 dtls_fingerprint_t : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal dtls_fingerprint_t(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(dtls_fingerprint_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~dtls_fingerprint_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_dtls_fingerprint_t(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public uint len { set { - freeswitchPINVOKE.Event_mine_set(swigCPtr, value); + freeswitchPINVOKE.dtls_fingerprint_t_len_set(swigCPtr, value); } get { - int ret = freeswitchPINVOKE.Event_mine_get(swigCPtr); + uint ret = freeswitchPINVOKE.dtls_fingerprint_t_len_get(swigCPtr); return ret; } } - public Event(string type, string subclass_name) : this(freeswitchPINVOKE.new_Event__SWIG_0(type, subclass_name), true) { + public SWIGTYPE_p_unsigned_char data { + set { + freeswitchPINVOKE.dtls_fingerprint_t_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.dtls_fingerprint_t_data_get(swigCPtr); + SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + return ret; + } } - public Event(switch_event wrap_me, int free_me) : this(freeswitchPINVOKE.new_Event__SWIG_1(switch_event.getCPtr(wrap_me), free_me), true) { + public string type { + set { + freeswitchPINVOKE.dtls_fingerprint_t_type_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.dtls_fingerprint_t_type_get(swigCPtr); + return ret; + } } - public int chat_execute(string app, string data) { - int ret = freeswitchPINVOKE.Event_chat_execute(swigCPtr, app, data); - return ret; + public string str { + set { + freeswitchPINVOKE.dtls_fingerprint_t_str_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.dtls_fingerprint_t_str_get(swigCPtr); + return ret; + } } - public int chat_send(string dest_proto) { - int ret = freeswitchPINVOKE.Event_chat_send(swigCPtr, dest_proto); - return ret; + public dtls_fingerprint_t() : this(freeswitchPINVOKE.new_dtls_fingerprint_t(), true) { } - public string Serialize(string format) { - string ret = freeswitchPINVOKE.Event_Serialize(swigCPtr, format); - return ret; - } +} - public bool SetPriority(switch_priority_t priority) { - bool ret = freeswitchPINVOKE.Event_SetPriority(swigCPtr, (int)priority); - return ret; - } +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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. +//------------------------------------------------------------------------------ - public string GetHeader(string header_name) { - string ret = freeswitchPINVOKE.Event_GetHeader(swigCPtr, header_name); - return ret; - } +namespace FreeSWITCH.Native { - public string GetBody() { - string ret = freeswitchPINVOKE.Event_GetBody(swigCPtr); - return ret; - } +public enum dtls_state_t { + DS_OFF, + DS_HANDSHAKE, + DS_SETUP, + DS_READY, + DS_FAIL, + DS_INVALID +} - public string GetEventType() { - string ret = freeswitchPINVOKE.Event_GetEventType(swigCPtr); - return ret; - } +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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. +//------------------------------------------------------------------------------ - public bool AddBody(string value) { - bool ret = freeswitchPINVOKE.Event_AddBody(swigCPtr, value); - return ret; - } +namespace FreeSWITCH.Native { - public bool AddHeader(string header_name, string value) { - bool ret = freeswitchPINVOKE.Event_AddHeader(swigCPtr, header_name, value); - return ret; - } +public enum dtls_type_t { + DTLS_TYPE_CLIENT = (1 << 0), + DTLS_TYPE_SERVER = (1 << 1), + DTLS_TYPE_RTP = (1 << 2), + DTLS_TYPE_RTCP = (1 << 3) +} - public bool DeleteHeader(string header_name) { - bool ret = freeswitchPINVOKE.Event_DeleteHeader(swigCPtr, header_name); - return ret; - } +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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. +//------------------------------------------------------------------------------ - public bool Fire() { - bool ret = freeswitchPINVOKE.Event_Fire(swigCPtr); - return ret; - } - - public bool merge(Event to_merge) { - bool ret = freeswitchPINVOKE.Event_merge(swigCPtr, Event.getCPtr(to_merge)); - return ret; - } +namespace FreeSWITCH.Native { +public enum dtmf_flag_t { + DTMF_FLAG_SKIP_PROCESS = (1 << 0), + DTMF_FLAG_SENSITIVE = (1 << 1) } } @@ -5802,6 +12563,11 @@ else return ret; } + public static switch_status_t switch_event_add_header_string_nodup(switch_event arg0, switch_stack_t stack, string header_name, string data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_add_header_string_nodup(switch_event.getCPtr(arg0), (int)stack, header_name, data); + return ret; + } + public static switch_status_t switch_event_del_header_val(switch_event arg0, string header_name, string val) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_del_header_val(switch_event.getCPtr(arg0), header_name, val); return ret; @@ -18321,6 +25087,9 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_event_add_header_string___")] public static extern int switch_event_add_header_string(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, string jarg3, string jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_event_add_header_string_nodup___")] + public static extern int switch_event_add_header_string_nodup(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, string jarg3, string jarg4); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_event_del_header_val___")] public static extern int switch_event_del_header_val(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3); @@ -21842,115 +28611,6 @@ public class ip_t : global::System.IDisposable { namespace FreeSWITCH.Native { -public class IvrMenu : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal IvrMenu(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IvrMenu obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~IvrMenu() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_IvrMenu(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public IvrMenu(IvrMenu 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) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.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), true) { - } - - public void bindAction(string action, string arg, string bind) { - freeswitchPINVOKE.IvrMenu_bindAction(swigCPtr, action, arg, bind); - } - - public void Execute(CoreSession session, string name) { - freeswitchPINVOKE.IvrMenu_Execute(swigCPtr, CoreSession.getCPtr(session), name); - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 partial class ManagedSession : CoreSession { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal ManagedSession(global::System.IntPtr cPtr, bool cMemoryOwn) : base(freeswitchPINVOKE.ManagedSession_SWIGUpcast(cPtr), cMemoryOwn) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ManagedSession obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~ManagedSession() { - Dispose(); - } - - public override void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_ManagedSession(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - base.Dispose(); - } - } - - public ManagedSession() : this(freeswitchPINVOKE.new_ManagedSession__SWIG_0(), true) { - } - - public ManagedSession(string uuid) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_1(uuid), true) { - } - - public ManagedSession(SWIGTYPE_p_switch_core_session session) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_2(SWIGTYPE_p_switch_core_session.getCPtr(session)), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 payload_map_t : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -22444,6658 +29104,6 @@ namespace FreeSWITCH.Native { namespace FreeSWITCH.Native { -public partial class Stream : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal Stream(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Stream obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~Stream() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_Stream(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public Stream() : this(freeswitchPINVOKE.new_Stream__SWIG_0(), true) { - } - - public Stream(switch_stream_handle arg0) : this(freeswitchPINVOKE.new_Stream__SWIG_1(switch_stream_handle.getCPtr(arg0)), true) { - } - - public string read(SWIGTYPE_p_int len) { - string ret = freeswitchPINVOKE.Stream_read(swigCPtr, SWIGTYPE_p_int.getCPtr(len)); - return ret; - } - - public void Write(string data) { - freeswitchPINVOKE.Stream_Write(swigCPtr, data); - } - - public void raw_write(string data, int len) { - freeswitchPINVOKE.Stream_raw_write(swigCPtr, data, len); - } - - public string get_data() { - string ret = freeswitchPINVOKE.Stream_get_data(swigCPtr); - return ret; - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_a_256__char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_a_256__char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_a_256__char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_a_256__char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_a_2__icand_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_a_2__icand_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_a_2__icand_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_a_2__icand_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; - - internal SWIGTYPE_p_cJSON(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_cJSON() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_cJSON obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_FILE { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_FILE(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_FILE() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_FILE obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_float { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_float(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_float() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_float obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_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_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_p_switch_database_interface_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_p_switch_database_interface_handle__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_database_interface_handle__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_database_interface_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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_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_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_fspr_pool_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__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_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_f_p_void_int_p_p_char_p_p_char__int_p_void_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__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_q_const__char_p_q_const__char_int_p_switch_database_interface_handle_p_q_const__char_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__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_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_p_unsigned_long__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char__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_q_const__char_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__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_q_const__char_p_switch_codec_fmtp__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__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_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__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_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_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_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_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_q_const__void_p_q_const__void_p_void__switch_bool_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_char_double__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void() { - 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_asr_handle_p_char_double__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_char_int__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void() { - 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_asr_handle_p_char_int__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_char_p_q_const__char__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void() { - 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_asr_handle_p_char_p_q_const__char__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__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_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_switch_event_p_unsigned_long__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_switch_asr_handle_p_p_switch_event_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__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_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__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_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__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_switch_asr_handle_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__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_switch_asr_handle_p_q_const__switch_dtmf_t_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__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_switch_asr_handle_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__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_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_asr_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_asr_handle__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_switch_asr_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal 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(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected 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() { - 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_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 obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal 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(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected 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() { - 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_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_codec_p_switch_frame__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_codec_p_switch_frame__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_switch_codec_p_switch_frame__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_codec__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_codec__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_codec__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_switch_codec__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__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_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_enum_switch_channel_callstate_t_p_switch_device_record_s__void() { - 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_enum_switch_channel_callstate_t_p_switch_device_record_s__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session__int() { - 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__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_int__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_switch_core_session_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_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_char_p_switch_say_args_t_p_p_char__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_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_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_char_p_switch_say_args_t_p_switch_input_args_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_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_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_p_switch_frame_unsigned_long_int__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_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_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_q_const__char_p_q_const__char_q_const__int_q_const__int__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_switch_core_session_p_q_const__char_p_q_const__char_q_const__int_q_const__int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_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_q_const__char_p_q_const__char__switch_bool_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_q_const__char_p_q_const__char__switch_bool_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_status_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_q_const__char_p_q_const__char__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_switch_core_session_p_q_const__char_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__char__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void() { - 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_q_const__char__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_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_q_const__switch_dtmf_t_enum_switch_dtmf_direction_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_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_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_q_const__switch_dtmf_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_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_core_session_message__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_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_core_session_message__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_switch_core_session_p_switch_core_session_message__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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_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_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_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; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_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_switch_core_session_unsigned_long__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_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_event__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_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__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_switch_core_session_p_switch_event__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_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_frame_p_void__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_switch_core_session_p_switch_frame_p_void__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_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_frame_unsigned_long_int__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_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_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_void_enum_switch_input_type_t_p_void_unsigned_int__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_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_p_void__p_void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_p_void__p_void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_p_void__p_void() { - 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_void__p_void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session__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_switch_core_session__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension() { - 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_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s() { - 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_t_switch_media_type_t__p_switch_jb_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_database_interface_handle_enum_switch_bool_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_database_interface_handle_enum_switch_bool_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_switch_database_interface_handle_enum_switch_bool_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_database_interface_handle_p_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_database_interface_handle_p_int__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_switch_database_interface_handle_p_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__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_switch_database_interface_handle_p_q_const__char_p_char_size_t_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_database_interface_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_database_interface_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_database_interface_handle__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_switch_database_interface_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__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_switch_directory_handle_p_char_p_char_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_directory_handle_p_char_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__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_switch_directory_handle_p_char_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__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_switch_directory_handle_p_p_char_p_p_char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_directory_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_directory_handle__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_switch_directory_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_event_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_event_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_event_p_q_const__char__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_switch_event_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_event__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_event__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_event__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_switch_event__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_event__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_event__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_event__void() { - 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_event__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__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_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__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_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_enum_switch_file_command_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_file_command_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_switch_file_handle_enum_switch_file_command_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_long_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_long_long__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_switch_file_handle_long_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_q_const__char__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__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_switch_file_handle_p_q_const__char__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_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_switch_file_handle_p_switch_frame_enum_switch_video_read_flag_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_switch_frame__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_switch_frame__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_switch_file_handle_p_switch_frame__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__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_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_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_switch_file_handle_p_void_p_switch_size_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_file_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_file_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_file_handle__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_switch_file_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_ivr_dmachine_match__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_ivr_dmachine_match__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_switch_ivr_dmachine_match__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_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_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void() { - 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_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_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_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_media_bug_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_media_bug_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_media_bug_p_void__void() { - 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_media_bug_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void() { - 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_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_scheduler_task__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_scheduler_task__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_scheduler_task__void() { - 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_scheduler_task__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_char_double__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void() { - 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_speech_handle_p_char_double__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_char_int__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void() { - 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_speech_handle_p_char_int__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_char_p_q_const__char__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void() { - 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_speech_handle_p_char_p_q_const__char__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__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_switch_speech_handle_p_char_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__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_switch_speech_handle_p_q_const__char_int_int_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__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_switch_speech_handle_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__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_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_speech_handle__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_speech_handle__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_speech_handle__void() { - 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_speech_handle__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_stream_handle_p_int__p_unsigned_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_stream_handle_p_int__p_unsigned_char() { - 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_stream_handle_p_int__p_unsigned_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______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_switch_stream_handle_p_q_const__char_v_______switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_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_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_thread_t_p_void__p_void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void() { - 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_thread_t_p_void__p_void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_timer_enum_switch_bool_t__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_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_switch_timer_enum_switch_bool_t__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_switch_timer__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_switch_timer__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_switch_timer__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_switch_timer__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_void_int_p_p_char_p_p_char__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_void_p_q_const__char__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_void_p_q_const__char__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_void_p_q_const__char__int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_q_const__char__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_void_p_switch_event__int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_void_p_switch_event__int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_void_p_switch_event__int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_switch_event__int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_p_void__void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_p_void__void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_p_void__void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_void__void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__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_switch_cache_db_database_interface_options_t_p_p_switch_database_interface_handle__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_uint8_t_p_p_q_const__char_p_void__p_switch_xml obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_void__p_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_void__p_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_void__p_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_void__p_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_f_void__switch_status_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_f_void__switch_status_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_f_void__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_void__switch_status_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; - - internal SWIGTYPE_p_in6_addr(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_in6_addr() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_in6_addr obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; - - internal SWIGTYPE_p_p_cJSON(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_cJSON() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_cJSON obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_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; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_pid_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_pid_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_pid_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_pid_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_payload_map_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_payload_map_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_payload_map_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_payload_map_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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; - - internal SWIGTYPE_p_p_p_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_p_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_p_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_real_pcre { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_real_pcre(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_real_pcre() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_real_pcre obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sqlite3 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_sqlite3(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_sqlite3() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_sqlite3 obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sqlite3_stmt { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_sqlite3_stmt(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_sqlite3_stmt() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_sqlite3_stmt obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_agc_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_agc_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_agc_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_agc_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_audio_resampler_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_audio_resampler_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_audio_resampler_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_audio_resampler_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_buffer { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_buffer(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_buffer() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_buffer obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_cache_db_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_cache_db_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_cache_db_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_cache_db_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_caller_extension { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_caller_extension(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_caller_extension() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_caller_extension obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_channel { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_channel(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_channel() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_channel obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_codec_implementation { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_codec_implementation(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_codec_implementation() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_codec_implementation obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_console_callback_match { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_console_callback_match(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_console_callback_match() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_console_callback_match obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_port_allocator { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_core_port_allocator(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_core_port_allocator() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_port_allocator obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_session { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_core_session(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_core_session() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_session_message { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_core_session_message(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_core_session_message() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session_message obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_device_record_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_device_record_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_device_record_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_device_record_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_handle_list_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_dial_handle_list_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_list_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_handle_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_dial_handle_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_dial_handle_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_handle_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_leg_list_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_dial_leg_list_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_dial_leg_list_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_leg_list_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_leg_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_dial_leg_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_dial_leg_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_dial_leg_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_event { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_event(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_event() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_event obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_event_node { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_event_node(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_event_node() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_event_node obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_file_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_file_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_file_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_file_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_frame_buffer_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_frame_buffer_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_frame_buffer_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_frame_buffer_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_frame { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_frame(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_frame() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_frame obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_hashtable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_hashtable(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_hashtable() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_hashtable obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_hashtable_iterator { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_hashtable_iterator(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_hashtable_iterator() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_hashtable_iterator obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_digit_stream { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_digit_stream(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_digit_stream() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_digit_stream_parser { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_digit_stream_parser(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_digit_stream_parser() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream_parser obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_dmachine { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_dmachine(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_dmachine() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_dmachine_match { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_dmachine_match(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_dmachine_match() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine_match obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_menu { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_menu(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_menu() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_menu_xml_ctx { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_ivr_menu_xml_ctx(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_ivr_menu_xml_ctx() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_live_array_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_live_array_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_live_array_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_live_array_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_log_node_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_log_node_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_log_node_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_log_node_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_media_bug { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_media_bug(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_media_bug() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_media_bug obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_network_list { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_network_list(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_network_list() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_network_list obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_rtp { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_rtp(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_rtp() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_rtp obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_say_file_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_say_file_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_say_file_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_say_file_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_sql_queue_manager { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_sql_queue_manager(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_sql_queue_manager() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_sql_queue_manager obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_thread_data_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_thread_data_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_thread_data_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_thread_data_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_xml_binding { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_xml_binding(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_xml_binding() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_xml_binding obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_xml { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_switch_xml(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_switch_xml() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_switch_xml obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_unsigned_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_unsigned_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_p_void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_p_void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_real_pcre { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_real_pcre(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_real_pcre() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_real_pcre obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_short { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_short(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_short() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_short obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sockaddr { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_sockaddr(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_sockaddr() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sockaddr obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sockaddr_in6 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_sockaddr_in6(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_sockaddr_in6() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sockaddr_in6 obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_socklen_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_socklen_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_socklen_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_socklen_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sqlite3 { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_sqlite3(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_sqlite3() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sqlite3 obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_sqlite3_stmt { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_sqlite3_stmt(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_sqlite3_stmt() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_sqlite3_stmt obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_agc_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_agc_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_agc_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_agc_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_buffer { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_buffer(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_buffer() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_buffer obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_cache_db_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_cache_db_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_cache_db_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_cache_db_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_call_cause_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_call_cause_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_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_switch_call_cause_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_channel { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_channel(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_channel() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_channel obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_codec_control_type_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_codec_control_type_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_codec_control_type_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_codec_control_type_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_port_allocator { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_core_port_allocator(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_core_port_allocator() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_core_port_allocator obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_core_session { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_core_session(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_core_session() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_core_session obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_handle_list_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_dial_handle_list_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_dial_handle_list_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_list_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_handle_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_dial_handle_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_dial_handle_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_handle_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_leg_list_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_dial_leg_list_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_dial_leg_list_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_leg_list_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_dial_leg_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_dial_leg_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_dial_leg_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_dial_leg_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_event_types_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_event_types_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_event_types_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_event_types_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_file_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_file_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_file_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_file_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_frame_buffer_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_frame_buffer_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_frame_buffer_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_frame_buffer_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_hashtable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_hashtable(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_hashtable() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_hashtable obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_hashtable_iterator { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_hashtable_iterator(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_hashtable_iterator() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_hashtable_iterator obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_image_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_image_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_image_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_image_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_img_fmt_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_img_fmt_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_img_fmt_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_img_fmt_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_img_position_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_img_position_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_img_position_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_img_position_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_interval_time_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_interval_time_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_interval_time_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_interval_time_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_action_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_action_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_action_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_action_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_digit_stream { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_digit_stream(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_digit_stream() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_digit_stream_parser { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_digit_stream_parser(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_digit_stream_parser() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream_parser obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_dmachine { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_dmachine(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_dmachine() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_dmachine obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_menu { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_menu(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_menu() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ivr_menu_xml_ctx { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ivr_menu_xml_ctx(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ivr_menu_xml_ctx() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu_xml_ctx obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_jb_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_jb_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_jb_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_jb_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_live_array_s { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_live_array_s(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_live_array_s() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_live_array_s obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_media_bug { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_media_bug(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_media_bug() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_media_bug obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_mutex_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_mutex_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_mutex_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_mutex_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_network_list { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_network_list(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_network_list() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_network_list obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_odbc_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_odbc_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_odbc_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_odbc_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_pollfd_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_pollfd_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_pollfd_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_pollfd_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_queue_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_queue_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_queue_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_queue_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_rtcp_frame { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_rtcp_frame(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_rtcp_frame() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtcp_frame obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_rtp { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_rtp(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_rtp() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtp obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_rtp_flag_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_rtp_flag_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_rtp_flag_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_rtp_flag_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_say_file_handle { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_say_file_handle(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_say_file_handle() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_say_file_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_size_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_size_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_size_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_size_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_sockaddr_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_sockaddr_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_sockaddr_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_sockaddr_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_socket_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_socket_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_socket_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_socket_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_sql_queue_manager { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_sql_queue_manager(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_sql_queue_manager() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_sql_queue_manager obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_ssize_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_ssize_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_ssize_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_ssize_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_thread_rwlock_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_thread_rwlock_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_thread_rwlock_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_rwlock_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_thread_start_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_thread_start_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_thread_start_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_start_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_thread_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_thread_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_thread_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_thread_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_time_exp_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_time_exp_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_time_exp_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_time_exp_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_time_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_time_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_time_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_time_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_switch_xml_binding { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_xml_binding(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_xml_binding() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_switch_xml_binding obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_time_t { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_time_t(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_time_t() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_time_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_char { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_unsigned_char() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_char obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_int { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_unsigned_int(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_unsigned_int() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_int obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_long { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_unsigned_long(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_unsigned_long() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_long obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_unsigned_short { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_unsigned_short(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_unsigned_short() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_short obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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_void { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - - internal SWIGTYPE_p_void(global::System.IntPtr cPtr, bool futureUse) { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_void() { - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_void obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum switch_abc_type_t { SWITCH_ABC_TYPE_INIT, SWITCH_ABC_TYPE_READ, @@ -29269,6 +29277,97 @@ public class switch_api_interface : global::System.IDisposable { namespace FreeSWITCH.Native { +public class switch_app_log : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_app_log(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_app_log obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_app_log() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_app_log(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public string app { + set { + freeswitchPINVOKE.switch_app_log_app_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_app_log_app_get(swigCPtr); + return ret; + } + } + + public string arg { + set { + freeswitchPINVOKE.switch_app_log_arg_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_app_log_arg_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_switch_time_t stamp { + set { + freeswitchPINVOKE.switch_app_log_stamp_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_app_log_stamp_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public switch_app_log next { + set { + freeswitchPINVOKE.switch_app_log_next_set(swigCPtr, switch_app_log.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_app_log_next_get(swigCPtr); + switch_app_log ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_app_log(cPtr, false); + return ret; + } + } + + public switch_app_log() : this(freeswitchPINVOKE.new_switch_app_log(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 { + [System.Flags] public enum switch_application_flag_enum_t { SAF_NONE = 0, SAF_SUPPORT_NOMEDIA = (1 << 0), @@ -29455,97 +29554,6 @@ public class switch_application_interface : global::System.IDisposable { namespace FreeSWITCH.Native { -public class switch_app_log : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal switch_app_log(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_app_log obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~switch_app_log() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_switch_app_log(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public string app { - set { - freeswitchPINVOKE.switch_app_log_app_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.switch_app_log_app_get(swigCPtr); - return ret; - } - } - - public string arg { - set { - freeswitchPINVOKE.switch_app_log_arg_set(swigCPtr, value); - } - get { - string ret = freeswitchPINVOKE.switch_app_log_arg_get(swigCPtr); - return ret; - } - } - - public SWIGTYPE_p_switch_time_t stamp { - set { - freeswitchPINVOKE.switch_app_log_stamp_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value)); - if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); - } - get { - SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_app_log_stamp_get(swigCPtr), true); - if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } - - public switch_app_log next { - set { - freeswitchPINVOKE.switch_app_log_next_set(swigCPtr, switch_app_log.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_app_log_next_get(swigCPtr); - switch_app_log ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_app_log(cPtr, false); - return ret; - } - } - - public switch_app_log() : this(freeswitchPINVOKE.new_switch_app_log(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 { - [System.Flags] public enum switch_asr_flag_enum_t { SWITCH_ASR_FLAG_NONE = 0, SWITCH_ASR_FLAG_DATA = (1 << 0), @@ -32591,48 +32599,6 @@ public class switch_chat_interface : global::System.IDisposable { namespace FreeSWITCH.Native { -public enum switch_codec_control_command_t { - SCC_VIDEO_GEN_KEYFRAME = 0, - SCC_VIDEO_BANDWIDTH, - SCC_VIDEO_RESET, - SCC_AUDIO_PACKET_LOSS, - SCC_AUDIO_ADJUST_BITRATE, - SCC_DEBUG, - SCC_CODEC_SPECIFIC -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum switch_codec_control_type_t { - SCCT_NONE = 0, - SCCT_STRING, - SCCT_INT -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 switch_codec : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -32809,6 +32775,48 @@ public class switch_codec : global::System.IDisposable { namespace FreeSWITCH.Native { +public enum switch_codec_control_command_t { + SCC_VIDEO_GEN_KEYFRAME = 0, + SCC_VIDEO_BANDWIDTH, + SCC_VIDEO_RESET, + SCC_AUDIO_PACKET_LOSS, + SCC_AUDIO_ADJUST_BITRATE, + SCC_DEBUG, + SCC_CODEC_SPECIFIC +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum switch_codec_control_type_t { + SCCT_NONE = 0, + SCCT_STRING, + SCCT_INT +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 { + [System.Flags] public enum switch_codec_flag_enum_t { SWITCH_CODEC_FLAG_ENCODE = (1 << 0), SWITCH_CODEC_FLAG_DECODE = (1 << 1), @@ -33774,75 +33782,6 @@ public class switch_console_callback_match_node : global::System.IDisposable { namespace FreeSWITCH.Native { -public class switch_coredb_handle : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal switch_coredb_handle(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_coredb_handle obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~switch_coredb_handle() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_switch_coredb_handle(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public switch_bool_t in_memory { - set { - freeswitchPINVOKE.switch_coredb_handle_in_memory_set(swigCPtr, (int)value); - } - get { - switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_coredb_handle_in_memory_get(swigCPtr); - return ret; - } - } - - public SWIGTYPE_p_sqlite3 handle { - set { - freeswitchPINVOKE.switch_coredb_handle_handle_set(swigCPtr, SWIGTYPE_p_sqlite3.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_coredb_handle_handle_get(swigCPtr); - SWIGTYPE_p_sqlite3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_sqlite3(cPtr, false); - return ret; - } - } - - public switch_coredb_handle() : this(freeswitchPINVOKE.new_switch_coredb_handle(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 { - [System.Flags] public enum switch_core_flag_enum_t { SCF_NONE = 0, SCF_USE_SQL = (1 << 0), @@ -34470,6 +34409,75 @@ public class switch_core_time_duration : global::System.IDisposable { namespace FreeSWITCH.Native { +public class switch_coredb_handle : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_coredb_handle(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_coredb_handle obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_coredb_handle() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_coredb_handle(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public switch_bool_t in_memory { + set { + freeswitchPINVOKE.switch_coredb_handle_in_memory_set(swigCPtr, (int)value); + } + get { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_coredb_handle_in_memory_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_sqlite3 handle { + set { + freeswitchPINVOKE.switch_coredb_handle_handle_set(swigCPtr, SWIGTYPE_p_sqlite3.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_coredb_handle_handle_get(swigCPtr); + SWIGTYPE_p_sqlite3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_sqlite3(cPtr, false); + return ret; + } + } + + public switch_coredb_handle() : this(freeswitchPINVOKE.new_switch_coredb_handle(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 switch_cputime : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -39598,208 +39606,6 @@ public class switch_io_event_hook_recv_dtmf : global::System.IDisposable { namespace FreeSWITCH.Native { -public class switch_io_event_hooks : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal switch_io_event_hooks(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_io_event_hooks obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~switch_io_event_hooks() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_switch_io_event_hooks(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public switch_io_event_hook_outgoing_channel outgoing_channel { - set { - freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_set(swigCPtr, switch_io_event_hook_outgoing_channel.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_get(swigCPtr); - switch_io_event_hook_outgoing_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_outgoing_channel(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_receive_message receive_message { - set { - freeswitchPINVOKE.switch_io_event_hooks_receive_message_set(swigCPtr, switch_io_event_hook_receive_message.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_message_get(swigCPtr); - switch_io_event_hook_receive_message ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_receive_message(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_receive_event receive_event { - set { - freeswitchPINVOKE.switch_io_event_hooks_receive_event_set(swigCPtr, switch_io_event_hook_receive_event.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_event_get(swigCPtr); - switch_io_event_hook_receive_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_receive_event(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_read_frame read_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_read_frame_set(swigCPtr, switch_io_event_hook_read_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_read_frame_get(swigCPtr); - switch_io_event_hook_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_read_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_video_read_frame video_read_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_set(swigCPtr, switch_io_event_hook_video_read_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_get(swigCPtr); - switch_io_event_hook_video_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_video_read_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_write_frame write_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_write_frame_set(swigCPtr, switch_io_event_hook_write_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_write_frame_get(swigCPtr); - switch_io_event_hook_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_write_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_video_write_frame video_write_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_set(swigCPtr, switch_io_event_hook_video_write_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_get(swigCPtr); - switch_io_event_hook_video_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_video_write_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_text_write_frame text_write_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_text_write_frame_set(swigCPtr, switch_io_event_hook_text_write_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_text_write_frame_get(swigCPtr); - switch_io_event_hook_text_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_text_write_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_text_read_frame text_read_frame { - set { - freeswitchPINVOKE.switch_io_event_hooks_text_read_frame_set(swigCPtr, switch_io_event_hook_text_read_frame.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_text_read_frame_get(swigCPtr); - switch_io_event_hook_text_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_text_read_frame(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_kill_channel kill_channel { - set { - freeswitchPINVOKE.switch_io_event_hooks_kill_channel_set(swigCPtr, switch_io_event_hook_kill_channel.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_kill_channel_get(swigCPtr); - switch_io_event_hook_kill_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_kill_channel(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_send_dtmf send_dtmf { - set { - freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_set(swigCPtr, switch_io_event_hook_send_dtmf.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_get(swigCPtr); - switch_io_event_hook_send_dtmf ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_send_dtmf(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_recv_dtmf recv_dtmf { - set { - freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_set(swigCPtr, switch_io_event_hook_recv_dtmf.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_get(swigCPtr); - switch_io_event_hook_recv_dtmf ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_recv_dtmf(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_state_change state_change { - set { - freeswitchPINVOKE.switch_io_event_hooks_state_change_set(swigCPtr, switch_io_event_hook_state_change.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_change_get(swigCPtr); - switch_io_event_hook_state_change ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_state_change(cPtr, false); - return ret; - } - } - - public switch_io_event_hook_state_run state_run { - set { - freeswitchPINVOKE.switch_io_event_hooks_state_run_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); - } - get { - global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_run_get(swigCPtr); - switch_io_event_hook_state_run ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); - return ret; - } - } - - public switch_io_event_hooks() : this(freeswitchPINVOKE.new_switch_io_event_hooks(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 switch_io_event_hook_send_dtmf : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -40360,6 +40166,208 @@ public class switch_io_event_hook_write_frame : global::System.IDisposable { namespace FreeSWITCH.Native { +public class switch_io_event_hooks : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_io_event_hooks(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_io_event_hooks obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_io_event_hooks() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_io_event_hooks(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public switch_io_event_hook_outgoing_channel outgoing_channel { + set { + freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_set(swigCPtr, switch_io_event_hook_outgoing_channel.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_get(swigCPtr); + switch_io_event_hook_outgoing_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_outgoing_channel(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_receive_message receive_message { + set { + freeswitchPINVOKE.switch_io_event_hooks_receive_message_set(swigCPtr, switch_io_event_hook_receive_message.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_message_get(swigCPtr); + switch_io_event_hook_receive_message ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_receive_message(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_receive_event receive_event { + set { + freeswitchPINVOKE.switch_io_event_hooks_receive_event_set(swigCPtr, switch_io_event_hook_receive_event.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_event_get(swigCPtr); + switch_io_event_hook_receive_event ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_receive_event(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_read_frame read_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_read_frame_set(swigCPtr, switch_io_event_hook_read_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_read_frame_get(swigCPtr); + switch_io_event_hook_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_read_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_video_read_frame video_read_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_set(swigCPtr, switch_io_event_hook_video_read_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_get(swigCPtr); + switch_io_event_hook_video_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_video_read_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_write_frame write_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_write_frame_set(swigCPtr, switch_io_event_hook_write_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_write_frame_get(swigCPtr); + switch_io_event_hook_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_write_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_video_write_frame video_write_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_set(swigCPtr, switch_io_event_hook_video_write_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_get(swigCPtr); + switch_io_event_hook_video_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_video_write_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_text_write_frame text_write_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_text_write_frame_set(swigCPtr, switch_io_event_hook_text_write_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_text_write_frame_get(swigCPtr); + switch_io_event_hook_text_write_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_text_write_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_text_read_frame text_read_frame { + set { + freeswitchPINVOKE.switch_io_event_hooks_text_read_frame_set(swigCPtr, switch_io_event_hook_text_read_frame.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_text_read_frame_get(swigCPtr); + switch_io_event_hook_text_read_frame ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_text_read_frame(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_kill_channel kill_channel { + set { + freeswitchPINVOKE.switch_io_event_hooks_kill_channel_set(swigCPtr, switch_io_event_hook_kill_channel.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_kill_channel_get(swigCPtr); + switch_io_event_hook_kill_channel ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_kill_channel(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_send_dtmf send_dtmf { + set { + freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_set(swigCPtr, switch_io_event_hook_send_dtmf.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_get(swigCPtr); + switch_io_event_hook_send_dtmf ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_send_dtmf(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_recv_dtmf recv_dtmf { + set { + freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_set(swigCPtr, switch_io_event_hook_recv_dtmf.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_get(swigCPtr); + switch_io_event_hook_recv_dtmf ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_recv_dtmf(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_change state_change { + set { + freeswitchPINVOKE.switch_io_event_hooks_state_change_set(swigCPtr, switch_io_event_hook_state_change.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_change_get(swigCPtr); + switch_io_event_hook_state_change ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_state_change(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_run state_run { + set { + freeswitchPINVOKE.switch_io_event_hooks_state_run_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); + } + get { + global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_run_get(swigCPtr); + switch_io_event_hook_state_run ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); + return ret; + } + } + + public switch_io_event_hooks() : this(freeswitchPINVOKE.new_switch_io_event_hooks(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 { + [System.Flags] public enum switch_io_flag_enum_t { SWITCH_IO_FLAG_NONE = 0, SWITCH_IO_FLAG_NOBLOCK = (1 << 0), @@ -46024,9 +46032,8 @@ namespace FreeSWITCH.Native { public enum switch_stack_t { SWITCH_STACK_BOTTOM = (1 << 0), SWITCH_STACK_TOP = (1 << 1), - SWITCH_STACK_NODUP = (1 << 2), - SWITCH_STACK_UNSHIFT = (1 << 3), - SWITCH_STACK_PUSH = (1 << 4) + SWITCH_STACK_UNSHIFT = (1 << 2), + SWITCH_STACK_PUSH = (1 << 3) } } @@ -47522,6 +47529,123 @@ public enum switch_vad_state_t { namespace FreeSWITCH.Native { +public class switch_vid_params_t : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_vid_params_t(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_vid_params_t obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_vid_params_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_vid_params_t(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public uint width { + set { + freeswitchPINVOKE.switch_vid_params_t_width_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_width_get(swigCPtr); + return ret; + } + } + + public uint height { + set { + freeswitchPINVOKE.switch_vid_params_t_height_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_height_get(swigCPtr); + return ret; + } + } + + public uint fps { + set { + freeswitchPINVOKE.switch_vid_params_t_fps_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_fps_get(swigCPtr); + return ret; + } + } + + public uint d_width { + set { + freeswitchPINVOKE.switch_vid_params_t_d_width_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_d_width_get(swigCPtr); + return ret; + } + } + + public uint d_height { + set { + freeswitchPINVOKE.switch_vid_params_t_d_height_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_vid_params_t_d_height_get(swigCPtr); + return ret; + } + } + + public switch_vid_params_t() : this(freeswitchPINVOKE.new_switch_vid_params_t(), true) { + } + +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 enum switch_vid_spy_fmt_t { + SPY_LOWER_RIGHT_SMALL, + SPY_LOWER_RIGHT_LARGE, + SPY_DUAL_CROP +} + +} +//------------------------------------------------------------------------------ +// <auto-generated /> +// +// 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 switch_video_codec_settings : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -47688,123 +47812,6 @@ public enum switch_video_read_flag_t { namespace FreeSWITCH.Native { -public class switch_vid_params_t : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - - internal switch_vid_params_t(global::System.IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - } - - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(switch_vid_params_t obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; - } - - ~switch_vid_params_t() { - Dispose(); - } - - public virtual void Dispose() { - lock(this) { - if (swigCPtr.Handle != global::System.IntPtr.Zero) { - if (swigCMemOwn) { - swigCMemOwn = false; - freeswitchPINVOKE.delete_switch_vid_params_t(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - global::System.GC.SuppressFinalize(this); - } - } - - public uint width { - set { - freeswitchPINVOKE.switch_vid_params_t_width_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_width_get(swigCPtr); - return ret; - } - } - - public uint height { - set { - freeswitchPINVOKE.switch_vid_params_t_height_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_height_get(swigCPtr); - return ret; - } - } - - public uint fps { - set { - freeswitchPINVOKE.switch_vid_params_t_fps_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_fps_get(swigCPtr); - return ret; - } - } - - public uint d_width { - set { - freeswitchPINVOKE.switch_vid_params_t_d_width_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_d_width_get(swigCPtr); - return ret; - } - } - - public uint d_height { - set { - freeswitchPINVOKE.switch_vid_params_t_d_height_set(swigCPtr, value); - } - get { - uint ret = freeswitchPINVOKE.switch_vid_params_t_d_height_get(swigCPtr); - return ret; - } - } - - public switch_vid_params_t() : this(freeswitchPINVOKE.new_switch_vid_params_t(), true) { - } - -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 enum switch_vid_spy_fmt_t { - SPY_LOWER_RIGHT_SMALL, - SPY_LOWER_RIGHT_LARGE, - SPY_DUAL_CROP -} - -} -//------------------------------------------------------------------------------ -// <auto-generated /> -// -// 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 switch_waitlist_t : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; From 0f15bde800659fb39c196c8897ca43afe5159022 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Sat, 4 Feb 2023 01:21:44 +0300 Subject: [PATCH 616/655] 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 e7cd7fead7..b61c58c7d4 100644 --- a/build/next-release.txt +++ b/build/next-release.txt @@ -1 +1 @@ -1.10.9-dev +1.10.10-dev diff --git a/configure.ac b/configure.ac index b3dad2275f..5ddf9a513f 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.9-dev], bugs@freeswitch.org) +AC_INIT([freeswitch], [1.10.10-dev], bugs@freeswitch.org) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [10]) -AC_SUBST(SWITCH_VERSION_MICRO, [9-dev]) +AC_SUBST(SWITCH_VERSION_MICRO, [10-dev]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, []) From 1a2033b9157b9a801b30713c30d34cae1b000961 Mon Sep 17 00:00:00 2001 From: demonspork <demonspork@gmail.com> Date: Fri, 10 Feb 2023 12:16:57 -0600 Subject: [PATCH 617/655] [mod_sofia] Ignore user agent for display update when channel variable update_ignore_ua is true --- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f4fc4e639b..0b74b89c9d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2065,7 +2065,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END()); - } else if (update_allowed && ua && (switch_stristr("polycom", ua) || + } else if (update_allowed && ua && (switch_channel_var_true(tech_pvt->channel, "update_ignore_ua") || + switch_stristr("polycom", ua) || (switch_stristr("aastra", ua) && !switch_stristr("Intelligate", ua)) || (switch_stristr("cisco/spa50", ua) || switch_stristr("cisco/spa525", ua)) || From 4f7658078522dd3292013d9b5d30ea21ad2c1b96 Mon Sep 17 00:00:00 2001 From: s3rj1k <evasive.gyron@gmail.com> Date: Thu, 16 Feb 2023 18:11:28 +0200 Subject: [PATCH 618/655] [mod_shout] Enable module in Dockerfile example. Signed-off-by: s3rj1k <evasive.gyron@gmail.com> --- docker/examples/Debian11/Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/examples/Debian11/Dockerfile b/docker/examples/Debian11/Dockerfile index 2497a39850..10d9302be1 100644 --- a/docker/examples/Debian11/Dockerfile +++ b/docker/examples/Debian11/Dockerfile @@ -31,13 +31,18 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install \ # mod_pgsql libpq-dev \ # mod_sndfile - libsndfile1-dev libflac-dev libogg-dev libvorbis-dev - + libsndfile1-dev libflac-dev libogg-dev libvorbis-dev \ +# mod_shout + libshout3-dev libmpg123-dev libmp3lame-dev + RUN cd /usr/src/libs/libks && cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1 && make install RUN cd /usr/src/libs/sofia-sip && ./bootstrap.sh && ./configure CFLAGS="-g -ggdb" --with-pic --with-glib=no --without-doxygen --disable-stun --prefix=/usr && make -j`nproc --all` && make install RUN cd /usr/src/libs/spandsp && ./bootstrap.sh && ./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr && make -j`nproc --all` && make install RUN cd /usr/src/libs/signalwire-c && PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && make install +# Enable modules +RUN sed -i 's|#formats/mod_shout|formats/mod_shout|' /usr/src/freeswitch/build/modules.conf.in + RUN cd /usr/src/freeswitch && ./bootstrap.sh -j RUN cd /usr/src/freeswitch && ./configure RUN cd /usr/src/freeswitch && make -j`nproc` && make install @@ -46,4 +51,4 @@ RUN cd /usr/src/freeswitch && make -j`nproc` && make install RUN apt-get clean # Uncomment to cleanup even more -#RUN rm -rf /usr/src/* \ No newline at end of file +#RUN rm -rf /usr/src/* From d4291b8113fd25ace184ee014742b6816c5ea85c Mon Sep 17 00:00:00 2001 From: Chris Rienzo <chris@signalwire.com> Date: Fri, 17 Feb 2023 15:24:03 -0500 Subject: [PATCH 619/655] Create SECURITY.md --- SECURITY.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000..9efb6b711a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,5 @@ +# Security Policy + +## Reporting a Vulnerability + +Send an e-mail to security@signalwire.com to report a vulnerability. If accepted, we'll create a security advisory and add you and your team as collaborators. Please allow our team sufficient time to resolve the vulnerability before disclosing it; we'll remain in contact about the fix and may ask for your assistance to verify it is resolved. From 83e4ccf80234c71e23847f05795350f043305756 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Tue, 21 Feb 2023 20:52:16 +0300 Subject: [PATCH 620/655] [Build-System] Windows: Update OpenSSL to 1.1.1t, libpq to 10.23, curl to 7.88.0, rabbitmq-c to 0.13.0. Allow using build numbers and bump libks version requirement to 1.8.2_1 and signalwire-c to 1.3.2_1 compiled with openssl 1.1.1t --- src/mod/event_handlers/mod_amqp/mod_amqp.2017.vcxproj | 5 +++++ w32/curl-version.props | 2 +- w32/libks-version.props | 1 + w32/libks.props | 4 ++-- w32/libpq-version.props | 2 +- w32/openssl-version.props | 2 +- w32/rabbitmq-c-version.props | 2 +- w32/signalwire-client-c-version.props | 1 + w32/signalwire-client-c.props | 4 ++-- 9 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp.2017.vcxproj b/src/mod/event_handlers/mod_amqp/mod_amqp.2017.vcxproj index 7abe38965f..657ad2027c 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp.2017.vcxproj +++ b/src/mod/event_handlers/mod_amqp/mod_amqp.2017.vcxproj @@ -70,6 +70,11 @@ <PropertyGroup> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <PreprocessorDefinitions>AMQP_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> diff --git a/w32/curl-version.props b/w32/curl-version.props index fe37b46801..65f768859d 100644 --- a/w32/curl-version.props +++ b/w32/curl-version.props @@ -2,7 +2,7 @@ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros"> - <curlVersion>7.78.0</curlVersion> + <curlVersion>7.88.0</curlVersion> </PropertyGroup> <PropertyGroup> <curlVersionImported>true</curlVersionImported> diff --git a/w32/libks-version.props b/w32/libks-version.props index fd99aa73ca..44246b4d90 100644 --- a/w32/libks-version.props +++ b/w32/libks-version.props @@ -5,6 +5,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros"> <libksVersion>1.8.2</libksVersion> + <libksBuildNumber>1</libksBuildNumber> </PropertyGroup> <PropertyGroup> <libksVersionImported>true</libksVersionImported> diff --git a/w32/libks.props b/w32/libks.props index 4bc05b2af0..fb7a82f200 100644 --- a/w32/libks.props +++ b/w32/libks.props @@ -36,7 +36,7 @@ <Target Name="libksBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za"> <DownloadPackageTask - package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)/libks-$(libksVersion)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip" + package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)_$(libksBuildNumber)/libks-$(libksVersion)_$(libksBuildNumber)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip" expectfileordirectory="$(libksDir)\binaries\$(Platform)\$(Configuration)\ks.dll" outputfolder="" outputfilename="" @@ -45,7 +45,7 @@ </Target> <Target Name="libksHeadersDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za"> <DownloadPackageTask - package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)/libks-$(libksVersion)-headers.zip" + package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)_$(libksBuildNumber)/libks-$(libksVersion)_$(libksBuildNumber)-headers.zip" expectfileordirectory="$(libksDir)\src\include\libks\ks.h" outputfolder="" outputfilename="" diff --git a/w32/libpq-version.props b/w32/libpq-version.props index 2bd87afc9e..2463086a50 100644 --- a/w32/libpq-version.props +++ b/w32/libpq-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <libpqVersion>10.18</libpqVersion> + <libpqVersion>10.23</libpqVersion> </PropertyGroup> <PropertyGroup> <libpqVersionImported>true</libpqVersionImported> diff --git a/w32/openssl-version.props b/w32/openssl-version.props index f0147f9baf..2d88e736e7 100644 --- a/w32/openssl-version.props +++ b/w32/openssl-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <OpenSSLVersion>1.1.1l</OpenSSLVersion> + <OpenSSLVersion>1.1.1t</OpenSSLVersion> <OpenSSLLibDir>$(BaseDir)libs\openssl-$(OpenSSLVersion)</OpenSSLLibDir> </PropertyGroup> <PropertyGroup> diff --git a/w32/rabbitmq-c-version.props b/w32/rabbitmq-c-version.props index 0688988cfb..6716df2314 100644 --- a/w32/rabbitmq-c-version.props +++ b/w32/rabbitmq-c-version.props @@ -4,7 +4,7 @@ <Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/> </ImportGroup> <PropertyGroup Label="UserMacros"> - <rabbitmq_cVersion>0.11.0</rabbitmq_cVersion> + <rabbitmq_cVersion>0.13.0</rabbitmq_cVersion> </PropertyGroup> <PropertyGroup> <rabbitmq_cVersionImported>true</rabbitmq_cVersionImported> diff --git a/w32/signalwire-client-c-version.props b/w32/signalwire-client-c-version.props index 53d65c87bd..337dc4cc19 100644 --- a/w32/signalwire-client-c-version.props +++ b/w32/signalwire-client-c-version.props @@ -5,6 +5,7 @@ </ImportGroup> <PropertyGroup Label="UserMacros"> <signalwire-client-cVersion>1.3.2</signalwire-client-cVersion> + <signalwire-client-cBuildNumber>1</signalwire-client-cBuildNumber> </PropertyGroup> <PropertyGroup> <signalwire-client-cVersionImported>true</signalwire-client-cVersionImported> diff --git a/w32/signalwire-client-c.props b/w32/signalwire-client-c.props index e7e40e2c4a..4d5f917b7e 100644 --- a/w32/signalwire-client-c.props +++ b/w32/signalwire-client-c.props @@ -34,7 +34,7 @@ <Target Name="signalwire-client-cBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za"> <DownloadPackageTask - package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)/signalwire-client-c-$(signalwire-client-cVersion)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip" + package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)/signalwire-client-c-$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip" expectfileordirectory="$(signalwire-client-cDir)\binaries\$(Platform)\$(Configuration)\signalwire_client.dll" outputfolder="" outputfilename="" @@ -43,7 +43,7 @@ </Target> <Target Name="signalwire-client-cHeadersDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za"> <DownloadPackageTask - package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)/signalwire-client-c-$(signalwire-client-cVersion)-headers.zip" + package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)/signalwire-client-c-$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)-headers.zip" expectfileordirectory="$(signalwire-client-cDir)\include\signalwire-client-c\client.h" outputfolder="" outputfilename="" From 3307083f8b2e33a1af368521962673b7682feef2 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 22 Feb 2023 23:06:28 +0300 Subject: [PATCH 621/655] Bump sofia-sip library requirement to version 1.13.14 --- configure.ac | 2 +- debian/bootstrap.sh | 4 ++-- freeswitch.spec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 5ddf9a513f..7ca19e49e8 100644 --- a/configure.ac +++ b/configure.ac @@ -716,7 +716,7 @@ PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[ AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent]) ]) -PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.12],[ +PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.14],[ AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[ AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent]) ]) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 6b1a83b86b..e3f0b1b9db 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -332,7 +332,7 @@ Build-Depends: uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev, # used by many modules libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, - bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.12), + bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.14), libspandsp3-dev, # used to format the private freeswitch apt-repo key properly gnupg, @@ -371,7 +371,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: libfreeswitch1 Architecture: amd64 armhf -Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.12) +Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.14) Recommends: Suggests: libfreeswitch1-dbg Conflicts: freeswitch-all (<= 1.6.7) diff --git a/freeswitch.spec b/freeswitch.spec index 807d3e7395..f3904afa2c 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -140,7 +140,7 @@ BuildRequires: curl-devel >= 7.19 BuildRequires: gcc-c++ BuildRequires: libtool >= 1.5.17 BuildRequires: openssl-devel >= 1.0.1e -BuildRequires: sofia-sip-devel >= 1.13.12 +BuildRequires: sofia-sip-devel >= 1.13.14 BuildRequires: spandsp3-devel >= 3.0 BuildRequires: pcre-devel BuildRequires: speex-devel From 81046e943a7dbef4037ccda875c3955504afc8a6 Mon Sep 17 00:00:00 2001 From: agree <ahrongreenberg@gmail.com> Date: Sun, 26 Feb 2023 21:49:12 -0500 Subject: [PATCH 622/655] [core] switch_ivr_originate set originate endpoint used This commit introduces a new channel variable that sets the channel endpoint used by the originate. This is particulary useful when using `execute_on_originate` that will execute multiple times when using fake endpoints as `user/` or `group/`. With this variable, a user can determine which endpoint is being used by the originate, and whether they want to process it. --- src/switch_ivr_originate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index f1e3e39de1..e0b0b55246 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3215,6 +3215,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess l_session = NULL; } + switch_channel_set_variable(oglobals.originate_status[i].peer_channel, "originate_endpoint", chan_type); switch_channel_execute_on(oglobals.originate_status[i].peer_channel, SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE); switch_channel_api_on(oglobals.originate_status[i].peer_channel, SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE); } From 23e6569fb0eef3568b1c68592b052034ef0ea82a Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Mon, 6 Feb 2023 15:25:34 +0300 Subject: [PATCH 623/655] [Core] Fix race condition of session_table hash in switch_core_session_request_uuid() --- src/switch_core_session.c | 17 +++++++++++------ src/switch_time.c | 7 +++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 2cfdee869d..44b653d9ce 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2380,11 +2380,6 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ int32_t sps = 0; - if (use_uuid && switch_core_hash_find(session_manager.session_table, use_uuid)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Duplicate UUID!\n"); - return NULL; - } - if (direction == SWITCH_CALL_DIRECTION_INBOUND && !switch_core_ready_inbound()) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The system cannot create any inbound sessions at this time.\n"); return NULL; @@ -2406,6 +2401,15 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ PROTECT_INTERFACE(endpoint_interface); + switch_mutex_lock(runtime.session_hash_mutex); + if (use_uuid && switch_core_hash_find(session_manager.session_table, use_uuid)) { + switch_mutex_unlock(runtime.session_hash_mutex); + UNPROTECT_INTERFACE(endpoint_interface); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Duplicate UUID!\n"); + + return NULL; + } + if (!(originate_flags & SOF_NO_LIMITS)) { switch_mutex_lock(runtime.throttle_mutex); count = session_manager.session_count; @@ -2413,12 +2417,14 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ switch_mutex_unlock(runtime.throttle_mutex); if (sps <= 0) { + switch_mutex_unlock(runtime.session_hash_mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error! %d\n", session_manager.session_count); UNPROTECT_INTERFACE(endpoint_interface); return NULL; } if ((count + 1) > session_manager.session_limit) { + switch_mutex_unlock(runtime.session_hash_mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit! %d\n", session_manager.session_limit); UNPROTECT_INTERFACE(endpoint_interface); return NULL; @@ -2490,7 +2496,6 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool); switch_queue_create(&session->private_event_queue_pri, SWITCH_EVENT_QUEUE_LEN, session->pool); - switch_mutex_lock(runtime.session_hash_mutex); switch_core_hash_insert(session_manager.session_table, session->uuid_str, session); session->id = session_manager.session_id++; session_manager.session_count++; diff --git a/src/switch_time.c b/src/switch_time.c index 44c1edbcce..445e698f9b 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -1243,15 +1243,17 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) if (runtime.sps <= 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Rate of %d!\n", runtime.sps_total); } + + /* These two mutexes must be held in exact order: session_hash_mutex and then throttle_mutex. See switch_core_session_request_uuid() */ + switch_mutex_lock(runtime.session_hash_mutex); switch_mutex_lock(runtime.throttle_mutex); runtime.sps_last = runtime.sps_total - runtime.sps; if (sps_interval_ticks >= 300) { runtime.sps_peak_fivemin = 0; sps_interval_ticks = 0; - switch_mutex_lock(runtime.session_hash_mutex); + /* This line is protected by runtime.session_hash_mutex */ runtime.sessions_peak_fivemin = session_manager.session_count; - switch_mutex_unlock(runtime.session_hash_mutex); } sps_interval_ticks++; @@ -1265,6 +1267,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) } runtime.sps = runtime.sps_total; switch_mutex_unlock(runtime.throttle_mutex); + switch_mutex_unlock(runtime.session_hash_mutex); tick = 0; } #ifndef DISABLE_1MS_COND From 6eb685d353cf6d986dd0d462f8fa7538c142147d Mon Sep 17 00:00:00 2001 From: agree <ahrongreenberg@gmail.com> Date: Tue, 21 Mar 2023 12:16:01 -0400 Subject: [PATCH 624/655] [mod_amqp] Events subclass support --- src/mod/event_handlers/mod_amqp/mod_amqp.h | 7 ++++++- .../mod_amqp/mod_amqp_producer.c | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp.h b/src/mod/event_handlers/mod_amqp/mod_amqp.h index 0717876040..f5c63780a4 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp.h +++ b/src/mod/event_handlers/mod_amqp/mod_amqp.h @@ -87,6 +87,11 @@ typedef struct mod_amqp_keypart_s { int size; } mod_amqp_keypart_t; +typedef struct { + switch_event_types_t id; + char* subclass; +} mod_amqp_events_t; + typedef struct { char *name; @@ -103,7 +108,7 @@ typedef struct { /* Array to store the possible event subscriptions */ int event_subscriptions; switch_event_node_t *event_nodes[SWITCH_EVENT_ALL]; - switch_event_types_t event_ids[SWITCH_EVENT_ALL]; + mod_amqp_events_t events[SWITCH_EVENT_ALL]; switch_event_node_t *eventNode; diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c b/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c index d7741d3f41..303927285e 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_producer.c @@ -186,7 +186,8 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg) profile->name = switch_core_strdup(profile->pool, name); profile->running = 1; memset(profile->format_fields, 0, (MAX_ROUTING_KEY_FORMAT_FIELDS + 1) * sizeof(mod_amqp_keypart_t)); - profile->event_ids[0] = SWITCH_EVENT_ALL; + profile->events[0].id = SWITCH_EVENT_ALL; + profile->events[0].subclass = SWITCH_EVENT_SUBCLASS_ANY; profile->event_subscriptions = 1; profile->conn_root = NULL; profile->conn_active = NULL; @@ -269,7 +270,14 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Found %d subscriptions\n", profile->event_subscriptions); for (arg = 0; arg < profile->event_subscriptions; arg++) { - if (switch_name_event(argv[arg], &(profile->event_ids[arg])) != SWITCH_STATUS_SUCCESS) { + char *subclass = SWITCH_EVENT_SUBCLASS_ANY; + if ((subclass = strchr(argv[arg], '^'))) { + *subclass++ = '\0'; + } + + if (switch_name_event(argv[arg], &(profile->events[arg].id)) == SWITCH_STATUS_SUCCESS) { + profile->events[arg].subclass = subclass; + } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The switch event %s was not recognised.\n", argv[arg]); } } @@ -344,13 +352,13 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg) /* Subscribe events */ for (i = 0; i < profile->event_subscriptions; i++) { if (switch_event_bind_removable("AMQP", - profile->event_ids[i], - SWITCH_EVENT_SUBCLASS_ANY, + profile->events[i].id, + profile->events[i].subclass, mod_amqp_producer_event_handler, profile, &(profile->event_nodes[i])) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind to event handler %d!\n",(int)profile->event_ids[i]); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind to event handler %d!\n",(int)profile->events[i].id); goto err; } } From 8cf90dae414008d66acf6e08fca96819b43ce8b8 Mon Sep 17 00:00:00 2001 From: agree <ahrongreenberg@gmail.com> Date: Thu, 27 Oct 2022 12:19:39 -0400 Subject: [PATCH 625/655] [mod_commands] Fix and improve coalesece function * fixed memory leak * added custom delimeter support --- .../applications/mod_commands/mod_commands.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 8e737a78a2..87741b8e59 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -5653,22 +5653,26 @@ SWITCH_STANDARD_API(alias_function) #define COALESCE_SYNTAX "[^^<delim>]<value1>,<value2>,..." SWITCH_STANDARD_API(coalesce_function) { - switch_status_t status = SWITCH_STATUS_FALSE; - char *data = (char *) cmd; char *mydata = NULL, *argv[256] = { 0 }; + char *arg = (char *) cmd; int argc = -1; + char delim = ','; - if (data && *data && (mydata = strdup(data))) { - argc = switch_separate_string(mydata, ',', argv, + if (!zstr(arg) && *arg == '^' && *(arg+1) == '^') { + arg += 2; + delim = *arg++; + } + + if (!zstr(arg) && (mydata = strdup(arg))) { + argc = switch_separate_string(mydata, delim, argv, (sizeof(argv) / sizeof(argv[0]))); } if (argc > 0) { int i; for (i = 0; i < argc; i++) { - if (argv[i] && *argv[i]) { + if (!zstr(argv[i])) { stream->write_function(stream, argv[i]); - status = SWITCH_STATUS_SUCCESS; break; } } @@ -5676,7 +5680,9 @@ SWITCH_STANDARD_API(coalesce_function) stream->write_function(stream, "-USAGE: %s\n", COALESCE_SYNTAX); } - return status; + switch_safe_free(mydata); + + return SWITCH_STATUS_SUCCESS; } #define SHOW_SYNTAX "codec|endpoint|application|api|dialplan|file|timer|calls [count]|channels [count|like <match string>]|calls|detailed_calls|bridged_calls|detailed_bridged_calls|aliases|complete|chat|management|modules|nat_map|say|interfaces|interface_types|tasks|limits|status" From 01d3b3c0e354abb20a33fc613f1985db4cee29d1 Mon Sep 17 00:00:00 2001 From: Tomasz Ostrowski <43222462+tomek-o@users.noreply.github.com> Date: Thu, 23 Mar 2023 19:15:41 +0100 Subject: [PATCH 626/655] [Core] ICE: fix wrong buffer size being passed and unitialized buffer --- src/switch_rtp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e8a3d30da1..17f3e66f8c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4764,11 +4764,12 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio if ((type & ICE_VANILLA)) { switch_snprintf(ice_user, sizeof(ice_user), "%s:%s", login, rlogin); switch_snprintf(user_ice, sizeof(user_ice), "%s:%s", rlogin, login); - switch_snprintf(luser_ice, sizeof(user_ice), "%s%s", rlogin, login); + switch_snprintf(luser_ice, sizeof(luser_ice), "%s%s", rlogin, login); ice->ready = ice->rready = 0; } else { switch_snprintf(ice_user, sizeof(ice_user), "%s%s", login, rlogin); switch_snprintf(user_ice, sizeof(user_ice), "%s%s", rlogin, login); + switch_snprintf(luser_ice, sizeof(luser_ice), ""); ice->ready = ice->rready = 1; } From 99ca7436d83c0868aa704df051745389ebd0ee28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= <dpa-github@aegee.org> Date: Mon, 27 Mar 2023 18:50:51 +0200 Subject: [PATCH 627/655] [mod_commands] add completions for fsctl api_expansion and sync_clock_when_idle --- src/mod/applications/mod_commands/mod_commands.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 8e737a78a2..1dd0767a99 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2417,7 +2417,7 @@ SWITCH_STANDARD_API(uptime_function) return SWITCH_STATUS_SUCCESS; } -#define CTL_SYNTAX "[recover|send_sighup|hupall|pause [inbound|outbound]|resume [inbound|outbound]|shutdown [cancel|elegant|asap|now|restart]|sps|sps_peak_reset|sync_clock|sync_clock_when_idle|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|min_idle_cpu|loglevel [level]|debug_level [level]|mdns_resolve [enable|disable]]" +#define CTL_SYNTAX "[api_expansion [on|off]|recover|send_sighup|hupall|pause [inbound|outbound]|resume [inbound|outbound]|shutdown [cancel|elegant|asap|now|restart]|sps|sps_peak_reset|sync_clock|sync_clock_when_idle|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|min_idle_cpu|loglevel [level]|debug_level [level]|mdns_resolve [enable|disable]]" SWITCH_STANDARD_API(ctl_function) { int argc; @@ -7745,6 +7745,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add complete add"); switch_console_set_complete("add complete del"); switch_console_set_complete("add db_cache status"); + switch_console_set_complete("add fsctl api_expansion on"); + switch_console_set_complete("add fsctl api_expansion off"); switch_console_set_complete("add fsctl debug_level"); switch_console_set_complete("add fsctl debug_pool"); switch_console_set_complete("add fsctl debug_sql"); @@ -7793,6 +7795,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add fsctl shutdown restart elegant"); switch_console_set_complete("add fsctl sps"); switch_console_set_complete("add fsctl sync_clock"); + switch_console_set_complete("add fsctl sync_clock_when_idle"); switch_console_set_complete("add fsctl flush_db_handles"); switch_console_set_complete("add fsctl min_idle_cpu"); switch_console_set_complete("add fsctl send_sighup"); From 8e604e8a945eb402f5cf318676aa72df76748057 Mon Sep 17 00:00:00 2001 From: Tomasz Ostrowski <43222462+tomek-o@users.noreply.github.com> Date: Mon, 27 Mar 2023 19:23:07 +0200 Subject: [PATCH 628/655] [mod_event_multicast] Few fixes * [mod_event_multicast] Fix crash / invalid pointer dereference * [mod_event_multicast] Check current number of addresses before zeroing memory on init * [mod_event_multicast] Fix condition checking number of addresses on init * [mod_event_multicast] Fix addresses zeroing on init * [mod_event_multicast] Reorder memset and assert after malloc --- .../mod_event_multicast/mod_event_multicast.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 1ebf5cb7fe..2a52ca0778 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -293,13 +293,13 @@ static switch_status_t initialize_sockets(switch_xml_t input_cfg) char *host_string; char ipv6_first_octet[3]; - memset(&globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, 0, sizeof(dst_sockaddr_t)); - - if (globals.num_dst_addrs > MAX_DST_HOSTS) { + if (globals.num_dst_addrs >= MAX_DST_HOSTS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot add destination address: %s, exceeded maximum of %d\n", dst_hosts[i], MAX_DST_HOSTS); continue; } + memset(&globals.dst_sockaddrs[globals.num_dst_addrs], 0, sizeof(dst_sockaddr_t)); + if (switch_sockaddr_info_get(&globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, dst_hosts[i], SWITCH_UNSPEC, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find address: %s\n", dst_hosts[i]); switch_goto_status(SWITCH_STATUS_TERM, fail); @@ -627,8 +627,8 @@ static void event_handler(switch_event_t *event) len = strlen(packet) + strlen((char *) MAGIC); #endif buf = malloc(len + 1); - memset(buf, 0, len + 1); switch_assert(buf); + memset(buf, 0, len + 1); #ifdef HAVE_OPENSSL if (globals.psk) { @@ -777,7 +777,11 @@ static switch_status_t process_packet(char* packet, size_t len) switch_url_decode(val); switch_snprintf(tmpname, sizeof(tmpname), "Orig-%s", var); switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, tmpname, val); - var = term + 1; + if (term) { + var = term + 1; + } else { + var = NULL; + } } else { /* This should be our magic packet, done processing incoming headers */ break; From 965e88a6b0607eb7f248c9a95ba0c3652eda8e36 Mon Sep 17 00:00:00 2001 From: yois615 <38441801+yois615@users.noreply.github.com> Date: Mon, 27 Mar 2023 18:47:23 -0400 Subject: [PATCH 629/655] [core, mod_cidlookup] Free memory allocated via strdup In mod_cidlookup and several other modules, config parameters are read from external XML files using the SWITCH_CONFIG_ITEM_STRING_STRDUP method. These items do not have string_options, and are not freed with switch_xml_config_cleanup. We therefore need to call switch_safe_free for config without string_options. We also add switch_xml_config_cleanup to mod_cidlookup. There are other modules that may be affected but this commit makes no attempt at fixing those. Fixes #1752 --- src/mod/applications/mod_cidlookup/mod_cidlookup.c | 1 + src/switch_xml_config.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_cidlookup/mod_cidlookup.c b/src/mod/applications/mod_cidlookup/mod_cidlookup.c index 7df22fb3ef..55d7aa0d90 100644 --- a/src/mod/applications/mod_cidlookup/mod_cidlookup.c +++ b/src/mod/applications/mod_cidlookup/mod_cidlookup.c @@ -845,6 +845,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cidlookup_load) Macro expands to: switch_status_t mod_cidlookup_shutdown() */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown) { + switch_xml_config_cleanup(instructions); switch_event_unbind(&reload_xml_event); return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_xml_config.c b/src/switch_xml_config.c index 6d67ccdad4..a208a6168e 100644 --- a/src/switch_xml_config.c +++ b/src/switch_xml_config.c @@ -457,7 +457,7 @@ SWITCH_DECLARE(void) switch_xml_config_cleanup(switch_xml_config_item_t *instruc char **ptr = (char **) item->ptr; switch_xml_config_string_options_t *string_options = (switch_xml_config_string_options_t *) item->data; /* if (using_strdup) */ - if (string_options && !string_options->pool && !string_options->length) { + if (!string_options || (!string_options->pool && !string_options->length)) { switch_safe_free(*ptr); } } From 6d65f8e08cdffcd657d837a4f5cdb1b6c51d74d0 Mon Sep 17 00:00:00 2001 From: yois615 <38441801+yois615@users.noreply.github.com> Date: Tue, 28 Mar 2023 07:53:16 -0400 Subject: [PATCH 630/655] [mod_callcenter] Fix stale agents and UUID broadcasts * [call_center] Stop uuid_broadcast on answer * [mod_callcenter] Fix stale members in database When a channel is originated to an agent but the member fails to bridge to that agent, the database is not updated with the member status and a stale entry of 'Answered' persists until mod_callcenter is restarted. Additionally, cc_agent_found is set before the bridge, therefore ending the while loop on the member channel. If there is a problem with the agent bridge, the call is terminated prematurely. In this commit, we: * Move the SQL update of the member to the 'Answered' state to the agent thread instead of the member's thread, so that correct data is populated. * Reset the members state accordingly to Abandoned or Waiting if the channels fail to bridge. * Use cc_agent_bridged to end the member loop, so that a member is put back on queue if the agent channel fails to bridge. --- .../mod_callcenter/mod_callcenter.c | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index fd7bb3dafa..b035b6d7f9 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1969,9 +1969,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa playback_array(agent_session, o_announce); } - /* This is used for the waiting caller to quit waiting for a agent */ + /* This is used to set the reason for callcenter_function breakout */ switch_channel_set_variable(member_channel, "cc_agent_found", "true"); switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid); + if (switch_true(switch_channel_get_variable(member_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) || switch_true(switch_channel_get_variable(agent_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) { switch_channel_set_flag(member_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE); } @@ -1990,6 +1991,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_channel_set_variable(agent_channel, "cc_agent_bridged", "false"); switch_channel_set_variable(member_channel, "cc_agent_bridged", "false"); + /* Set member to Abandoned state, previous Trying */ + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND instance_id = '%q'", + cc_member_state2str(CC_MEMBER_STATE_ABANDONED), local_epoch_time_now(NULL), h->member_uuid, globals.cc_instance_id); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + if ((o_announce = switch_channel_get_variable(member_channel, "cc_bridge_failed_outbound_announce"))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Playing bridge failed audio to agent %s, audio: %s\n", h->agent_name, o_announce); playback_array(agent_session, o_announce); @@ -2008,9 +2015,15 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa bridged = 1; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member \"%s\" %s is bridged to agent %s\n", h->member_cid_name, h->member_cid_number, h->agent_name); + switch_channel_set_variable(member_channel, "cc_agent_bridged", "true"); switch_channel_set_variable(agent_channel, "cc_agent_bridged", "true"); - switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid); + + /* Update member to Answered state, previous Trying */ + sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND instance_id = '%q'", + cc_member_state2str(CC_MEMBER_STATE_ANSWERED), local_epoch_time_now(NULL), h->member_uuid, globals.cc_instance_id); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); } if (bridged) { @@ -2111,7 +2124,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } } else { - /* Agent didn't answer or originate failed */ + /* Agent didn't answer or originate/bridge failed */ int delay_next_agent_call = 0; switch_channel_t *member_channel = switch_core_session_get_channel(member_session); switch_channel_clear_app_flag_key(CC_APP_KEY, member_channel, CC_APP_AGENT_CONNECTING); @@ -3051,6 +3064,10 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_set_variable(member_channel, "cc_side", "member"); switch_channel_set_variable(member_channel, "cc_member_uuid", member_uuid); + /* Clear flags in case previously set */ + switch_channel_set_variable(member_channel, "cc_agent_found", NULL); + switch_channel_set_variable(member_channel, "cc_agent_bridged", NULL); + /* Add manually imported score */ if (cc_base_score) { cc_base_score_int += atoi(cc_base_score); @@ -3178,8 +3195,8 @@ SWITCH_STANDARD_APP(callcenter_function) args.buf = (void *) &ht; args.buflen = sizeof(h); - /* An agent was found, time to exit and let the bridge do it job */ - if ((p = switch_channel_get_variable(member_channel, "cc_agent_found")) && (agent_found = switch_true(p))) { + /* If the bridge didn't break the loop, break out now */ + if ((p = switch_channel_get_variable(member_channel, "cc_agent_bridged")) && (agent_found = switch_true(p))) { break; } /* If the member thread set a different reason, we monitor it so we can quit the wait */ @@ -3201,8 +3218,6 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_set_variable(member_channel, "cc_exit_key", buf); h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_EXIT_WITH_KEY; break; - } else if (!SWITCH_READ_ACCEPTABLE(status)) { - break; } } else { switch_status_t status = switch_ivr_collect_digits_callback(member_session, &args, 0, 0); @@ -3230,12 +3245,18 @@ SWITCH_STANDARD_APP(callcenter_function) h->running = 0; } + /* Stop uuid_broadcasts */ + switch_core_session_flush_private_events(member_session); + switch_channel_stop_broadcast(member_channel); + switch_channel_set_flag_value(member_channel, CF_BREAK, 2); + /* Check if we were removed because FS Core(BREAK) asked us to */ if (h->member_cancel_reason == CC_MEMBER_CANCEL_REASON_NONE && !agent_found) { h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_BREAK_OUT; } switch_channel_set_variable(member_channel, "cc_agent_found", NULL); + /* Canceled for some reason */ if (!switch_channel_up(member_channel) || h->member_cancel_reason != CC_MEMBER_CANCEL_REASON_NONE) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> abandoned waiting in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); @@ -3282,12 +3303,6 @@ SWITCH_STANDARD_APP(callcenter_function) } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); - /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND instance_id = '%q'", - cc_member_state2str(CC_MEMBER_STATE_ANSWERED), local_epoch_time_now(NULL), member_uuid, globals.cc_instance_id); - cc_execute_sql(NULL, sql, NULL); - switch_safe_free(sql); - /* Update some channel variables for xml_cdr needs */ switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "answered"); if ((queue = get_queue(queue_name))) { From bb2fa440719b7fe47d48cc470c754106c600f1c7 Mon Sep 17 00:00:00 2001 From: Henrique <hdiniz@users.noreply.github.com> Date: Tue, 28 Mar 2023 10:53:16 -0300 Subject: [PATCH 631/655] [mod_conference] handle personal canvas with vmuted member --- src/mod/applications/mod_conference/conference_video.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index e94b835c3d..9105605185 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -3803,6 +3803,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_image_t *use_img = NULL; if (!omember->session || !switch_channel_test_flag(omember->channel, CF_VIDEO_READY) || + (conference_utils_test_flag(omember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) && !conference_utils_member_test_flag(omember, MFLAG_CAN_BE_SEEN)) || switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY || switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_INACTIVE) { continue; } From 6c97e3b0f4d8858c51dc834ad6957387067621fb Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 29 Dec 2021 19:07:54 +0300 Subject: [PATCH 632/655] [Core] Fix missing mutex unlock in switch_ivr_dmachine_ping() --- src/switch_ivr_async.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 6dfdcf7248..d00b75d40c 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -546,6 +546,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * } if (dmachine->pinging) { + switch_mutex_unlock(dmachine->mutex); return SWITCH_STATUS_BREAK; } From afc8d78a1899ce02650a70d0f18192d5028466c7 Mon Sep 17 00:00:00 2001 From: Tomasz Ostrowski <43222462+tomek-o@users.noreply.github.com> Date: Tue, 28 Mar 2023 16:36:01 +0200 Subject: [PATCH 633/655] [mod_enum] Fix use-after-free if creating resolver from file failed --- src/mod/applications/mod_enum/mod_enum.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 2908a1eb1e..aa87f24826 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -497,6 +497,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n /* create a new resolver from /etc/resolv.conf */ if (res) { ldns_resolver_free(res); + res = NULL; } s = ldns_resolver_new_frm_file(&res, NULL); } From 3c4695ea3111ebf9612973935e928b72cebbcbe6 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Thu, 23 Mar 2023 15:06:56 +0200 Subject: [PATCH 634/655] [mod_opus] coverity CID 1320733 (Result is not floating-point) --- src/mod/codecs/mod_opus/mod_opus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index a90aba346a..d24590f37a 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -1105,7 +1105,7 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec) uint32_t LBRR_threshold_bitrate,LBRR_rate_thres_bps,real_target_bitrate ; opus_int32 a32,b32; uint32_t fs = context->enc_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000); - float frame_rate =(float)(1000 / (codec->implementation->microseconds_per_packet / 1000)); + float frame_rate =(float)(1000 / (float)(codec->implementation->microseconds_per_packet / 1000)); uint32_t step = (codec->implementation->microseconds_per_packet / 1000) != 60 ? 8000 / (codec->implementation->microseconds_per_packet / 1000 ) : 134 ; opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&current_bitrate)); From 3c1824a68512c76b26b9097faa5f9f2d9dc26d36 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Thu, 23 Mar 2023 15:09:53 +0200 Subject: [PATCH 635/655] [mod_amr] coverity CID 1395603 (Unsigned compared against 0) --- src/mod/codecs/mod_amr/bitshift.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_amr/bitshift.c b/src/mod/codecs/mod_amr/bitshift.c index fd3fc55606..05a00ff1b5 100644 --- a/src/mod/codecs/mod_amr/bitshift.c +++ b/src/mod/codecs/mod_amr/bitshift.c @@ -47,7 +47,7 @@ extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len) if (!buf || !a_len) return (-1); - if ((lshift < 0) || (lshift > 8)) + if (lshift > 8) return (-1); first_byte = 0xFF >> lshift; From 8e5dc5a087634145e5fc68b4e6a693d7723fe643 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Wed, 29 Dec 2021 22:05:20 +0300 Subject: [PATCH 636/655] [mod_opusfile] Fix missing rdlock unlock in switch_opusfile_open() --- src/mod/formats/mod_opusfile/mod_opusfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/formats/mod_opusfile/mod_opusfile.c b/src/mod/formats/mod_opusfile/mod_opusfile.c index afd5f51267..1560142263 100644 --- a/src/mod/formats/mod_opusfile/mod_opusfile.c +++ b/src/mod/formats/mod_opusfile/mod_opusfile.c @@ -295,6 +295,7 @@ static switch_status_t switch_opusfile_open(switch_file_handle_t *handle, const context->of = op_open_file(path, &ret); if (!context->of) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS File] Error opening %s\n", path); + switch_thread_rwlock_unlock(context->rwlock); return SWITCH_STATUS_GENERR; } From 48b8b0c4d70cbd533684fcb2e238663beeedb02a Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 29 Mar 2023 19:08:18 +0300 Subject: [PATCH 637/655] [Core] Coverity fixes * [core] coverity CID 1395504 (Logically dead code) * [core] coverity CID 1395581 (Dereference before null check) * [core] coverity CID 1346451 (Improper use of negative value) * [core] coverity CID 1395497 (Dereference before null check) * [core] coverity CID 1468458 (Dereference before null check) --- src/switch_core_media.c | 16 ++++++---------- src/switch_ivr_originate.c | 3 +++ src/switch_rtp.c | 15 ++++++++++----- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 0754494ee3..d4954ee6b1 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3057,7 +3057,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session uint32_t codec_ms = (int) (engine->read_frame.timestamp - engine->last_ts) / (engine->read_impl.samples_per_second / 1000); if (engine->last_seq && (int) (engine->read_frame.seq - engine->last_seq) > 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[%s]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s). \n", is_vbr?"VBR":"CBR", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[CBR]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s). \n", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1)); codec_ms = codec_ms / (int) (engine->read_frame.seq - engine->last_seq); } @@ -3080,9 +3080,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session if (codec_ms > 120) { /* yeah right */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "[%s]: Your phone is trying to send timestamps that suggest an increment of %dms per packet\n" + "[CBR]: Your phone is trying to send timestamps that suggest an increment of %dms per packet\n" "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?\n", - is_vbr?"VBR":"CBR", (int) codec_ms); engine->check_frames = MAX_CODEC_CHECK_FRAMES; goto skip; @@ -3092,8 +3091,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session if (codec_ms != engine->cur_payload_map->codec_ms) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "[%s]: Asynchronous PTIME not supported, changing our end from %d to %d\n", - is_vbr?"VBR":"CBR", + "[CBR]: Asynchronous PTIME not supported, changing our end from %d to %d\n", (int) engine->cur_payload_map->codec_ms, (int) codec_ms ); @@ -3123,7 +3121,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session engine->last_ts) / (engine->read_impl.samples_per_second / 1000); if (engine->last_seq && (int) (engine->read_frame.seq - engine->last_seq) > 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[%s]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s)\n", is_vbr?"VBR":"CBR", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[VBR]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s)\n", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1)); codec_ms = codec_ms / (int) (engine->read_frame.seq - engine->last_seq); } @@ -3142,8 +3140,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session if (codec_ms > 120) { /*will show too many times with packet loss*/ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3, - "[%s]: Remote party is trying to send timestamps that suggest an increment of [%d] ms per packet, which is too high. Ignoring.\n", - is_vbr?"VBR":"CBR", + "[VBR]: Remote party is trying to send timestamps that suggest an increment of [%d] ms per packet, which is too high. Ignoring.\n", (int) codec_ms); engine->last_ts = engine->read_frame.timestamp; engine->last_seq = engine->read_frame.seq; @@ -3152,8 +3149,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session if (codec_ms != engine->cur_payload_map->codec_ms) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "[%s]: Packet size change detected. Remote PTIME changed from [%d] to [%d]\n", - is_vbr?"VBR":"CBR", + "[VBR]: Packet size change detected. Remote PTIME changed from [%d] to [%d]\n", (int) engine->cur_payload_map->codec_ms, (int) codec_ms ); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index e0b0b55246..f23549713b 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -909,6 +909,9 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map return -1; } wrote = teletone_mux_tones(ts, map); + if (wrote <= 0) { + return -1; + } if (tto->channels != 1) { if (tto->mux_buflen < wrote * 2 * tto->channels) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 17f3e66f8c..8398717818 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3529,9 +3529,13 @@ SWITCH_DECLARE(dtls_state_t) switch_rtp_dtls_state(switch_rtp_t *rtp_session, dt { dtls_state_t s = DS_OFF; + if (!rtp_session) { + return s; + } + switch_mutex_lock(rtp_session->ice_mutex); - if (!rtp_session || (!rtp_session->dtls && !rtp_session->rtcp_dtls)) { + if (!rtp_session->dtls && !rtp_session->rtcp_dtls) { s = DS_OFF; goto done; } @@ -3556,9 +3560,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, d { switch_status_t status = SWITCH_STATUS_SUCCESS; + if (!rtp_session) { + return SWITCH_STATUS_FALSE; + } + switch_mutex_lock(rtp_session->ice_mutex); - if (!rtp_session || (!rtp_session->dtls && !rtp_session->rtcp_dtls)) { + if (!rtp_session->dtls && !rtp_session->rtcp_dtls) { switch_goto_status(SWITCH_STATUS_FALSE, done); } @@ -6967,13 +6975,10 @@ static void check_timeout(switch_rtp_t *rtp_session) elapsed, rtp_session->media_timeout); if (elapsed > rtp_session->media_timeout) { - - if (rtp_session->session) { switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session); switch_channel_execute_on(channel, "execute_on_media_timeout"); switch_channel_hangup(channel, SWITCH_CAUSE_MEDIA_TIMEOUT); - } } } From 3d547647b2aee0e1406e503b53b7d544b343be1e Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 29 Mar 2023 19:14:54 +0300 Subject: [PATCH 638/655] [mod_verto] Coverity fixes * [mod_verto] coverity CID (Logically dead code) * [mod_verto] coverity CID 1468609 (Logically dead code) --- src/mod/endpoints/mod_verto/mod_verto.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index d98e1abdef..e7defb99aa 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -771,10 +771,6 @@ static void jsock_send_event(cJSON *event) } switch_thread_rwlock_unlock(verto_globals.event_channel_rwlock); - if (use_jsock) { - switch_thread_rwlock_unlock(use_jsock->rwlock); - use_jsock = NULL; - } } static jrpc_func_t jrpc_get_func(jsock_t *jsock, const char *method) @@ -1069,7 +1065,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * const char *use_passwd = NULL, *verto_context = NULL, *verto_dialplan = NULL; time_t now = switch_epoch_time_now(NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Login sucessful for user: %s domain: %s\n", id, domain ? domain : "N/A"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Login sucessful for user: %s domain: %s\n", id, domain); jsock->logintime = now; jsock->id = switch_core_strdup(jsock->pool, id); From 65b24c65dbcd56dda5c47f3c13c7c3e962b2ed93 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Fri, 24 Mar 2023 14:32:50 +0000 Subject: [PATCH 639/655] [mod_pgsql] Coverity CID 1468401 (Resource leak) --- src/mod/databases/mod_pgsql/mod_pgsql.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c index 575252223b..0308f1f1fd 100644 --- a/src/mod/databases/mod_pgsql/mod_pgsql.c +++ b/src/mod/databases/mod_pgsql/mod_pgsql.c @@ -629,6 +629,8 @@ done: error: + pgsql_free_result(&result); + return SWITCH_STATUS_FALSE; } From 9494148b109ab55c3311abd6b486031d1f7581ca Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 30 Mar 2023 20:00:40 +0100 Subject: [PATCH 640/655] [mod_sofia] Coverity fixes * [mod_sofia] Coverity CID 1468634 (Resource leak) * [mod_sofia] Coverity CID 1294467 (Resource leak) --------- Co-authored-by: Andrey Volk <andywolk@gmail.com> --- src/mod/endpoints/mod_sofia/sofia_glue.c | 13 +++++++++---- src/mod/endpoints/mod_sofia/sofia_presence.c | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 35704b44ab..8c9dfcc57a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -446,14 +446,16 @@ void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t a_id = switch_strip_whitespace(duped); - if (zstr(a_id)) return; + if (zstr(a_id)) { + goto end; + } p = strchr(a_id, ';'); if (p) *p = '\0'; if (!sofia_glue_is_valid_session_uuid(a_id)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Session-ID: Ignoring \"%s\" parsed as \"%s\"\n", header, a_id); - return; + goto end; } /* RFC7329 compatibility */ @@ -483,7 +485,7 @@ void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t if (!p) { switch_channel_set_flag(channel, CF_RFC7329_COMPAT); switch_channel_set_flag_partner(channel, CF_RFC7329_COMPAT); - return; + goto end; } p++; remote_param = strstr(p, "remote="); @@ -491,7 +493,7 @@ void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t switch_channel_set_flag(channel, CF_RFC7329_COMPAT); switch_channel_set_flag_partner(channel, CF_RFC7329_COMPAT); sofia_glue_check_filter_generic_params(session, profile, p); - return; + goto end; } b_id = remote_param + 7; if (!zstr(b_id) && strlen(b_id) == RFC7989_SESSION_UUID_LEN /*32*/) { @@ -503,6 +505,9 @@ void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Session-ID: invalid uuid, ignored.\n"); } + +end: + switch_safe_free(a_id); } /* add "Session-ID:" header */ diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 89324ebe82..b8576ae7f5 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -399,6 +399,7 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) switch_safe_free(route_uri); switch_safe_free(ffrom); switch_safe_free(dup); + switch_safe_free(extra_headers); if (profile) { switch_thread_rwlock_unlock(profile->rwlock); From 9940623bcef5e72d5a7036345bbc5ef4b18853e3 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 31 Mar 2023 20:47:56 +0300 Subject: [PATCH 641/655] [Core] Fix switch_core_sqldb_destroy() function declaration. --- src/include/private/switch_core_pvt.h | 2 +- src/switch_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index af6a4f53bd..fafaae3cba 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -310,7 +310,7 @@ extern struct switch_session_manager session_manager; switch_status_t switch_core_sqldb_init(const char **err); -void switch_core_sqldb_destroy(); +void switch_core_sqldb_destroy(void); switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_t manage); void switch_core_sqldb_stop(void); void switch_core_session_init(switch_memory_pool_t *pool); diff --git a/src/switch_core.c b/src/switch_core.c index 83db2fc0d9..cf2343482a 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -3009,7 +3009,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_ready_outbound(void) return (switch_test_flag((&runtime), SCF_SHUTTING_DOWN) || switch_test_flag((&runtime), SCF_NO_NEW_OUTBOUND_SESSIONS)) ? SWITCH_FALSE : SWITCH_TRUE; } -void switch_core_sqldb_destroy() +void switch_core_sqldb_destroy(void) { if (switch_test_flag((&runtime), SCF_USE_SQL)) { switch_core_sqldb_stop(); From 55313696dba8c09467092db241c4eb27c0144c62 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 31 Mar 2023 22:48:11 +0300 Subject: [PATCH 642/655] [Core] Remove unused count variable from switch_core_session_execute_exten() --- src/switch_core_session.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 44b653d9ce..a103a6e964 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -3005,7 +3005,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_se { char *dp[25]; char *dpstr; - int argc, x, count = 0; + int argc, x; uint32_t stack_count = 0; switch_caller_profile_t *profile, *new_profile, *pp = NULL; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -3059,8 +3059,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_se continue; } - count++; - extension = dialplan_interface->hunt_function(session, dparg, new_profile); UNPROTECT_INTERFACE(dialplan_interface); From 49c1c35982b1e47b4ac4825044df66b94bcba3a1 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Fri, 31 Mar 2023 22:07:59 +0100 Subject: [PATCH 643/655] [core] Coverity fixes * [core] Coverity CID 1468218 (Resource leak) * [core] Coverity CID 1468214 (Resource leak) * [core] Coverity CID 1294472 (Resource leak) * [core] Coverity CID 1294470 (Resource leak) * [core] Coverity CID 1500361 (Resource leak) * [core] Coverity CID 1500308 (Resource leak) * [core] Coverity CID 1500278 (Resource leak) --------- Co-authored-by: Andrey Volk <andywolk@gmail.com> --- src/include/switch_core_video.h | 2 +- src/mod/applications/mod_cv/mod_cv.cpp | 2 +- .../mod_video_filter/mod_video_filter.c | 2 +- src/mod/formats/mod_imagick/mod_imagick.c | 2 +- src/switch_core_sqldb.c | 2 ++ src/switch_core_video.c | 35 ++++++++++++------- src/switch_event.c | 4 +++ src/switch_xml.c | 20 +++++++++-- 8 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/include/switch_core_video.h b/src/include/switch_core_video.h index 1af0dec7ac..f65c322d30 100644 --- a/src/include/switch_core_video.h +++ b/src/include/switch_core_video.h @@ -448,7 +448,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_to_raw(switch_image_t *src, void *des * \param[in] width The raw data width * \param[in] height The raw data height */ -SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *src, switch_img_fmt_t fmt, int width, int height); +SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t** destP, void *src, switch_img_fmt_t fmt, int width, int height); SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_bool_t full, const char *text); SWITCH_DECLARE(switch_image_t *) switch_img_read_file(const char* file_name); diff --git a/src/mod/applications/mod_cv/mod_cv.cpp b/src/mod/applications/mod_cv/mod_cv.cpp index 800452dd9a..de39943b4b 100644 --- a/src/mod/applications/mod_cv/mod_cv.cpp +++ b/src/mod/applications/mod_cv/mod_cv.cpp @@ -854,7 +854,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi } if (context->rawImage && (context->debug || !context->overlay_count)) { - switch_img_from_raw(frame->img, (uint8_t *)context->rawImage->imageData, SWITCH_IMG_FMT_RGB24, context->rawImage->width, context->rawImage->height); + switch_img_from_raw(&frame->img, (uint8_t *)context->rawImage->imageData, SWITCH_IMG_FMT_RGB24, context->rawImage->width, context->rawImage->height); } int abs = 0; 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 7cf1f1dd0f..605559fdbb 100644 --- a/src/mod/applications/mod_video_filter/mod_video_filter.c +++ b/src/mod/applications/mod_video_filter/mod_video_filter.c @@ -645,7 +645,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi } - switch_img_from_raw(frame->img, patch_data, SWITCH_IMG_FMT_ARGB, frame->img->d_w, frame->img->d_h); + switch_img_from_raw(&frame->img, patch_data, SWITCH_IMG_FMT_ARGB, frame->img->d_w, frame->img->d_h); switch_img_free(&img); diff --git a/src/mod/formats/mod_imagick/mod_imagick.c b/src/mod/formats/mod_imagick/mod_imagick.c index ce789637cf..beb60387bf 100644 --- a/src/mod/formats/mod_imagick/mod_imagick.c +++ b/src/mod/formats/mod_imagick/mod_imagick.c @@ -387,7 +387,7 @@ static switch_status_t read_page(pdf_file_context_t *context) return SWITCH_STATUS_FALSE; } - switch_img_from_raw(context->img, storage, SWITCH_IMG_FMT_BGR24, w, h); + switch_img_from_raw(&context->img, storage, SWITCH_IMG_FMT_BGR24, w, h); free(storage); } else { switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, image->columns, image->rows, 0); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 702ee6a79c..5a75aeb573 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -3181,6 +3181,8 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName if (!(ep = switch_loadable_module_get_endpoint_interface(argv[0]))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "EP ERROR\n"); + switch_xml_free(xml); + return 0; } diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 0d377f9c3e..dad3181c2a 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -3521,11 +3521,18 @@ SWITCH_DECLARE(switch_status_t) switch_img_to_raw(switch_image_t *src, void *des #endif } -SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *src, switch_img_fmt_t fmt, int width, int height) +SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t **destP, void *src, switch_img_fmt_t fmt, int width, int height) { #ifdef SWITCH_HAVE_YUV uint32_t fourcc; int ret = -1; + switch_image_t *dest = NULL; + + if (!destP) { + return SWITCH_STATUS_FALSE; + } + + dest = *destP; fourcc = switch_img_fmt2fourcc(fmt); @@ -3574,6 +3581,8 @@ SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void * 0, fourcc); } + *destP = dest; + return ret == 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; #else return SWITCH_STATUS_FALSE; @@ -3586,10 +3595,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima switch_image_t *dest = NULL; int ret = 0; - if (destP) { - dest = *destP; + if (!destP) { + return SWITCH_STATUS_FALSE; } + dest = *destP; + switch_assert(width > 0); switch_assert(height > 0); @@ -3615,15 +3626,13 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima kFilterBox); } + *destP = dest; + if (ret != 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Scaling Error: ret: %d\n", ret); return SWITCH_STATUS_FALSE; } - if (destP) { - *destP = dest; - } - return SWITCH_STATUS_SUCCESS; #else return SWITCH_STATUS_FALSE; @@ -3637,10 +3646,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_mirror(switch_image_t *src, switch_im switch_image_t *dest = NULL; int ret = 0; - if (destP) { - dest = *destP; + if (!destP) { + return SWITCH_STATUS_FALSE; } + dest = *destP; + if (dest && src->fmt != dest->fmt) switch_img_free(&dest); if (!dest) dest = switch_img_alloc(NULL, src->fmt, src->d_w, src->d_h, 1); @@ -3660,15 +3671,13 @@ SWITCH_DECLARE(switch_status_t) switch_img_mirror(switch_image_t *src, switch_im } + *destP = dest; + if (ret != 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Mirror Error: ret: %d\n", ret); return SWITCH_STATUS_FALSE; } - if (destP) { - *destP = dest; - } - return SWITCH_STATUS_SUCCESS; #else return SWITCH_STATUS_FALSE; diff --git a/src/switch_event.c b/src/switch_event.c index 843469bd72..be49f2fc14 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1909,6 +1909,8 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch data = (char *) malloc(2048); if (!data) { va_end(ap); + switch_xml_free(xml); + return NULL; } ret = vsnprintf(data, 2048, fmt, ap); @@ -1918,6 +1920,8 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch #ifndef HAVE_VASPRINTF free(data); #endif + switch_xml_free(xml); + return NULL; } } diff --git a/src/switch_xml.c b/src/switch_xml.c index c43a530252..80b7553907 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1638,11 +1638,25 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file_simple(const char *file) if ((fd = open(file, O_RDONLY, 0)) > -1) { fstat(fd, &st); - if (!st.st_size) goto error; + if (!st.st_size) { + close(fd); + goto error; + } + m = switch_must_malloc(st.st_size); - if (!(0<(l = read(fd, m, st.st_size)))) goto error; - if (!(root = (switch_xml_root_t) switch_xml_parse_str((char *) m, l))) goto error; + if (!(0 < (l = read(fd, m, st.st_size)))) { + free(m); + close(fd); + goto error; + } + + if (!(root = (switch_xml_root_t)switch_xml_parse_str((char*)m, l))) { + free(m); + close(fd); + goto error; + } + root->dynamic = 1; close(fd); return &root->xml; From 73ea37c5abbc26c79a8508271c8109b35666e7e9 Mon Sep 17 00:00:00 2001 From: Dragos Oancea <dragos@signalwire.com> Date: Wed, 5 Apr 2023 18:54:11 +0300 Subject: [PATCH 644/655] [Core] Coverity fixes * [core] coverity CID 1320751 (Dereference before null check) * [core] coverity CID 1294546 (Unchecked return value) * [core] coverity CID 1227661 (Logically dead code) * [core] coverity CID 1227656 (Logically dead code) * [core] coverity CID 1060948 (Explicit null dereferenced) * [core] coverity CID 1346465 (Unchecked return value) * [core] coverity CID 1364953 (Logically dead code) * [core] coverity CID 1468210 (Dereference before null check) * [core] coverity CID 1468546 (Dereference before null check) * [core] coverity CID 1468342 (Dereference before null check) --- src/switch_core_media.c | 8 ++------ src/switch_ivr_async.c | 11 ++++++----- src/switch_ivr_bridge.c | 2 +- src/switch_nat.c | 4 ++-- src/switch_rtp.c | 4 ++-- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d4954ee6b1..912d5a5012 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6672,10 +6672,6 @@ SWITCH_DECLARE(void) switch_core_session_write_blank_video(switch_core_session_t if (!height) height = 288; if (!fps) fps = 15; - if (!(width && height && fps)) { - return; - } - fr.packet = buf; fr.packetlen = buflen; fr.data = buf + 12; @@ -12439,7 +12435,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_media_params(switch_core_sessi *val++ = '\0'; } - if (name && val) { + if (val) { if (!strcmp(name, "aspect")) { aspect = val; vid++; @@ -15860,7 +15856,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (!(switch_core_codec_ready(session->write_codec) && switch_core_codec_ready(frame->codec))) goto error; - if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) { + if (frame->codec && session->write_codec->implementation != frame->codec->implementation) { if (session->write_impl.codec_id == frame->codec->implementation->codec_id || session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) { ptime_mismatch = TRUE; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index d00b75d40c..9a33b43340 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2130,7 +2130,7 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data break; } - if (ep->eavesdropper && switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) { if (switch_core_session_write_video_frame(ep->eavesdropper, bug->video_ping_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing video to %s\n", switch_core_session_get_name(ep->eavesdropper)); ep->errs++; @@ -2178,10 +2178,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_pop_eavesdropper(switch_cor struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) switch_core_media_bug_get_user_data(bug); if (ep && ep->eavesdropper && ep->eavesdropper != session) { - switch_core_session_read_lock(ep->eavesdropper); - *sessionp = ep->eavesdropper; - switch_core_media_bug_set_flag(bug, SMBF_PRUNE); - status = SWITCH_STATUS_SUCCESS; + if (switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) { + *sessionp = ep->eavesdropper; + switch_core_media_bug_set_flag(bug, SMBF_PRUNE); + status = SWITCH_STATUS_SUCCESS; + } } } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index f91fc2c69f..527058f70c 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -237,7 +237,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj) continue; } - if (switch_channel_media_up(b_channel)) { + if (read_frame && switch_channel_media_up(b_channel)) { if (switch_core_session_write_video_frame(vh->session_b, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { switch_cond_next(); continue; diff --git a/src/switch_nat.c b/src/switch_nat.c index f6b9bc553b..a1620b4bfd 100644 --- a/src/switch_nat.c +++ b/src/switch_nat.c @@ -506,7 +506,7 @@ static switch_status_t switch_nat_add_mapping_upnp(switch_port_t port, switch_na if (r == UPNPCOMMAND_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %s protocol %s to localport %s\n", port_str, - (proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str); + (proto == SWITCH_NAT_TCP) ? "TCP" : "UDP", port_str); status = SWITCH_STATUS_SUCCESS; } @@ -566,7 +566,7 @@ static switch_status_t switch_nat_del_mapping_upnp(switch_port_t port, switch_na if (r == UPNPCOMMAND_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %s protocol %s to localport %s\n", port_str, - (proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str); + (proto == SWITCH_NAT_TCP) ? "TCP" : "UDP", port_str); status = SWITCH_STATUS_SUCCESS; } return status; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 8398717818..ad9f8eef1c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1277,7 +1277,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d } - if (ice->ice_params && ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type && + if (ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type && !strcasecmp(ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type, "relay")) { do_adj++; } @@ -3010,7 +3010,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_ rtp_session->dtls->sock_output = rtp_session->sock_output; if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { - switch_sockaddr_info_get(&rtp_session->dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); + status = switch_sockaddr_info_get(&rtp_session->dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); } } From 80d5790274ec85ba39c34fc9831867695c348986 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 12:42:23 +0100 Subject: [PATCH 645/655] [mod_xml_scgi] Coverity CID 1468595 (Resource leak) --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 63306c76a3..24c0270a57 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 @@ -176,6 +176,10 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con if (bytes > XML_SCGI_MAX_BYTES) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Data too big!\n"); len = -1; + if (expanded != (char*)buf) { + free(expanded); + } + break; } From b02fbc702df3849981d116565f3ca42a5bc72e2b Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 13:26:42 +0100 Subject: [PATCH 646/655] [mod_java] Coverity CID 1320753 (Resource leak) --- src/mod/languages/mod_java/modjava.c | 93 +++++++++++++--------------- 1 file changed, 43 insertions(+), 50 deletions(-) diff --git a/src/mod/languages/mod_java/modjava.c b/src/mod/languages/mod_java/modjava.c index a334af302d..899fee2b60 100644 --- a/src/mod/languages/mod_java/modjava.c +++ b/src/mod/languages/mod_java/modjava.c @@ -294,64 +294,57 @@ static switch_status_t load_config(JavaVMOption **javaOptions, int *optionCount, static switch_status_t create_java_vm(JavaVMOption *options, int optionCount, vm_control_t * vmControl) { - jint (JNICALL *pJNI_CreateJavaVM)(JavaVM**,void**,void*); - switch_status_t status; + jint (JNICALL *pJNI_CreateJavaVM)(JavaVM**,void**,void*); + switch_status_t status; char *derr = NULL; pJNI_CreateJavaVM = (jint (*)(JavaVM **, void **, void *))switch_dso_func_sym(javaVMHandle, "JNI_CreateJavaVM", &derr); - if (!derr) - { - JNIEnv *env; - JavaVMInitArgs initArgs; - jint res; + if (!derr) { + JNIEnv *env; + JavaVMInitArgs initArgs; + jint res; - memset(&initArgs, 0, sizeof(initArgs)); - initArgs.version = JNI_VERSION_1_4; - initArgs.nOptions = optionCount; - initArgs.options = options; - initArgs.ignoreUnrecognized = JNI_TRUE; + memset(&initArgs, 0, sizeof(initArgs)); + initArgs.version = JNI_VERSION_1_4; + initArgs.nOptions = optionCount; + initArgs.options = options; + initArgs.ignoreUnrecognized = JNI_TRUE; - res = pJNI_CreateJavaVM(&javaVM, (void*) &env, &initArgs); - if (res == JNI_OK) - { - // call FindClass here already so that the Java VM executes the static - // initializer (@see org.freeswitch.Launcher) which loads the jni library - // so we can use jni functions right away (for example in the startup method) - launcherClass = (*env)->FindClass(env, "org/freeswitch/Launcher"); - if ( launcherClass == NULL ) - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find 'org.freeswitch.Launcher' class!\n"); - (*env)->ExceptionDescribe(env); - } + res = pJNI_CreateJavaVM(&javaVM, (void*) &env, &initArgs); + if (res == JNI_OK) { + /* call FindClass here already so that the Java VM executes the static + initializer (@see org.freeswitch.Launcher) which loads the jni library + so we can use jni functions right away (for example in the startup method) */ - // store a global reference for use in the launch_java() function - launcherClass = (*env)->NewGlobalRef(env, launcherClass); - if ( launcherClass == NULL ) - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n"); - (*env)->ExceptionDescribe(env); - status = SWITCH_STATUS_FALSE; - } - else - { - status = SWITCH_STATUS_SUCCESS; - } + launcherClass = (*env)->FindClass(env, "org/freeswitch/Launcher"); + if ( launcherClass == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find 'org.freeswitch.Launcher' class!\n"); + (*env)->ExceptionDescribe(env); + } - (*javaVM)->DetachCurrentThread(javaVM); - } - else - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating Java VM!\n"); - status = SWITCH_STATUS_FALSE; - } - } - else - { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Specified Java VM doesn't have JNI_CreateJavaVM\n"); - status = SWITCH_STATUS_FALSE; - } - return status; + /* store a global reference for use in the launch_java() function */ + launcherClass = (*env)->NewGlobalRef(env, launcherClass); + if ( launcherClass == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n"); + (*env)->ExceptionDescribe(env); + status = SWITCH_STATUS_FALSE; + } else { + status = SWITCH_STATUS_SUCCESS; + } + + (*javaVM)->DetachCurrentThread(javaVM); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating Java VM!\n"); + status = SWITCH_STATUS_FALSE; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Specified Java VM doesn't have JNI_CreateJavaVM\n"); + switch_safe_free(derr); + status = SWITCH_STATUS_FALSE; + } + + return status; } SWITCH_MODULE_LOAD_FUNCTION(mod_java_load) From 0e9954467f1dfbd83d6ab747c4736dd2b831f00a Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 12:25:48 +0100 Subject: [PATCH 647/655] [mod_imagick] Coverity CID 1500258 (Resource leak) --- src/mod/formats/mod_imagick/mod_imagick.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/formats/mod_imagick/mod_imagick.c b/src/mod/formats/mod_imagick/mod_imagick.c index beb60387bf..5c185a5e44 100644 --- a/src/mod/formats/mod_imagick/mod_imagick.c +++ b/src/mod/formats/mod_imagick/mod_imagick.c @@ -384,6 +384,7 @@ static switch_status_t read_page(pdf_file_context_t *context) if (ret == MagickFalse && context->exception->severity != UndefinedException) { CatchException(context->exception); free(storage); + return SWITCH_STATUS_FALSE; } @@ -397,6 +398,8 @@ static switch_status_t read_page(pdf_file_context_t *context) if (ret == MagickFalse && context->exception->severity != UndefinedException) { CatchException(context->exception); + switch_img_free(&img); + return SWITCH_STATUS_FALSE; } From a9e81ae0b81d8a894efce43b12312cb7a7ada4c2 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 12:10:55 +0100 Subject: [PATCH 648/655] [mod_verto] Coverity CID 1320754 (Resource leak) --- src/mod/endpoints/mod_verto/mcast/mcast.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mcast/mcast.c b/src/mod/endpoints/mod_verto/mcast/mcast.c index fcb3035872..aaa6da995c 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast.c +++ b/src/mod/endpoints/mod_verto/mcast/mcast.c @@ -86,6 +86,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) != 0 ) { mcast_socket_close(handle); + return -1; } @@ -103,11 +104,13 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, if (setsockopt(handle->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) { mcast_socket_close(handle); + return -1; } if (bind(handle->sock, (struct sockaddr *) &handle->recv_addr, sizeof(handle->recv_addr)) < 0) { mcast_socket_close(handle); + return -1; } @@ -124,7 +127,11 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, addr_criteria.ai_flags |= AI_NUMERICHOST; snprintf(service, sizeof(service), "%d", port); - getaddrinfo(host, service, &addr_criteria, &mcast_addr); + if (getaddrinfo(host, service, &addr_criteria, &mcast_addr) != 0) { + mcast_socket_close(handle); + + return -1; + } memset(&handle->recv_addr6, 0, sizeof(handle->recv_addr6)); @@ -134,11 +141,14 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, memcpy(&mreq.ipv6mr_multiaddr, &((struct sockaddr_in6 *)mcast_addr->ai_addr)->sin6_addr, sizeof(struct in6_addr)); + freeaddrinfo(mcast_addr); + mreq.ipv6mr_interface = 0; setsockopt(handle->sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char *)&mreq, sizeof(mreq)); if (bind(handle->sock, (struct sockaddr *) &handle->recv_addr6, sizeof(handle->recv_addr6)) < 0) { mcast_socket_close(handle); + return -1; } } From 99e26d34487c6cb33847c5635e5ecf416096d2c3 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 11:27:19 +0100 Subject: [PATCH 649/655] [mod_dialplan_asterisk] Coverity CID 1214207 (Resource leak) --- .../mod_dialplan_asterisk/mod_dialplan_asterisk.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 24119f6f8c..652d292e65 100644 --- a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c +++ b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c @@ -142,6 +142,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt) if (!caller_profile || zstr(caller_profile->destination_number)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Obtaining Profile!\n"); + return NULL; } @@ -150,6 +151,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt) if (!switch_config_open_file(&cfg, cf)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + return NULL; } @@ -226,12 +228,14 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt) } } else { if (pattern && strcasecmp(pattern, field_data)) { + switch_safe_free(field_expanded); continue; } } if (cid) { if (strcasecmp(cid, caller_profile->caller_id_number)) { + switch_safe_free(field_expanded); continue; } } @@ -266,15 +270,19 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt) switch_perform_substitution(re, proceed, argument, field_data, substituted, sizeof(substituted), ovector); argument = substituted; } + switch_regex_safe_free(re); if (!extension) { if (zstr(field_data)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No extension!\n"); + switch_safe_free(field_expanded); break; } + if ((extension = switch_caller_extension_new(session, field_data, field_data)) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); + switch_safe_free(field_expanded); break; } } From 875a1b04ff57074b66fb964e3928f67fd01dc5f1 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 11:03:02 +0100 Subject: [PATCH 650/655] [mod_av] Coverity CID 1500320 (Resource leak) --- src/mod/applications/mod_av/avformat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index a791665c08..1f767d0bde 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -1591,6 +1591,8 @@ GCC_DIAG_ON(deprecated-declarations) context->vid_ready = 1; switch_queue_push(context->eh.video_queue, img); context->last_vid_push = switch_time_now(); + } else { + switch_img_free(&img); } } } From 5388319dd3673614349704bad1ee40d5b2a00a66 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 01:30:38 +0100 Subject: [PATCH 651/655] [mod_xml_curl] Coverity CID 1468413 (Resource leak) --- src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index 6a8f2aac53..67181e26c4 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -210,13 +210,6 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_uuid_format(uuid_str, &uuid); switch_snprintf(filename, sizeof(filename), "%s%s%s.tmp.xml", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str); - curl_handle = switch_curl_easy_init(); - headers = switch_curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded"); - - if (!strncasecmp(binding->url, "https", 5)) { - switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); - switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0); - } memset(&config_data, 0, sizeof(config_data)); @@ -224,6 +217,14 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con config_data.max_bytes = binding->curl_max_bytes; if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { + curl_handle = switch_curl_easy_init(); + headers = switch_curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded"); + + if (!strncasecmp(binding->url, "https", 5)) { + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0); + } + if (!zstr(binding->cred)) { switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, binding->auth_scheme); switch_curl_easy_setopt(curl_handle, CURLOPT_USERPWD, binding->cred); From a8f6625d12e140a44a60962af5a56092bdee15f8 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 00:43:08 +0100 Subject: [PATCH 652/655] [mod_amqp] Coverity CID 1468426 (Resource leak) --- src/mod/event_handlers/mod_amqp/mod_amqp_connection.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c b/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c index 91feec93d5..73cf09a354 100644 --- a/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c +++ b/src/mod/event_handlers/mod_amqp/mod_amqp_connection.c @@ -203,7 +203,11 @@ switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_ amqp_boolean_t ssl_verify_peer = 1; if (zstr(name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Connection missing name attribute\n%s\n", switch_xml_toxml(cfg, 1)); + char *str_tmp = switch_xml_toxml(cfg, 1); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Connection missing name attribute\n%s\n", str_tmp); + switch_safe_free(str_tmp); + return SWITCH_STATUS_GENERR; } @@ -260,6 +264,7 @@ switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_ new_con->ssl_verify_peer = ssl_verify_peer; *conn = new_con; + return SWITCH_STATUS_SUCCESS; } From 11b9c1d1042f0c05a3090c054de4dedf1aaa0e8d Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 00:56:56 +0100 Subject: [PATCH 653/655] [mod_event_multicast] Coverity CID 1468504 (Resource leak) --- .../mod_event_multicast/mod_event_multicast.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 2a52ca0778..ac58ee8ed9 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -153,16 +153,18 @@ static switch_status_t load_config(switch_xml_t input_cfg) } 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"); + char *val_no_whitespace = switch_strip_whitespace(val); if (!strcasecmp(var, "address")) { - set_global_dst_addrs(switch_strip_whitespace(val)); + set_global_dst_addrs(val_no_whitespace); } else if (!strcasecmp(var, "source_address")) { - set_global_src_addr(switch_strip_whitespace(val)); + set_global_src_addr(val_no_whitespace); } else if (!strcasecmp(var, "source_address_ipv6")) { - set_global_src_addr6(switch_strip_whitespace(val)); + set_global_src_addr6(val_no_whitespace); } else if (!strcasecmp(var, "bindings")) { set_global_bindings(val); } else if (!strcasecmp(var, "port")) { @@ -183,6 +185,8 @@ static switch_status_t load_config(switch_xml_t input_cfg) } else if (!strcasecmp(var, "loopback")) { globals.loopback = switch_true(val); } + + switch_safe_free(val_no_whitespace); } } @@ -190,6 +194,7 @@ static switch_status_t load_config(switch_xml_t input_cfg) if (globals.bindings) { + for (cur = globals.bindings; cur; count++) { switch_event_types_t type; From 9994c5149958a52855a19ce79e484c06380b6332 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk <jakub.karolczyk@signalwire.com> Date: Thu, 6 Apr 2023 01:11:35 +0100 Subject: [PATCH 654/655] [mod_xml_rpc] Coverity CID 1294469 (Resource leak) --- src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index 43e25b6f9e..8e49462d2c 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -614,7 +614,7 @@ abyss_bool websocket_hook(TSession *r) if (ret != 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "handshake error %d\n", ret); - return FALSE; + goto err; } if (switch_event_bind_removable("websocket", SWITCH_EVENT_CUSTOM, "websocket::stophook", stop_hook_event_handler, wsh, &nodes[node_count++]) != SWITCH_STATUS_SUCCESS) { @@ -696,8 +696,11 @@ abyss_bool websocket_hook(TSession *r) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wsh->down = %d, node_count = %d\n", wsh->down, node_count); switch_yield(2000); + while (--node_count >= 0) switch_event_unbind(&nodes[node_count]); + err: + ws_destroy(wsh); switch_safe_free(wsh); return FALSE; From 4d3b0a5778be5d321aaf6605fddd95d1a1e1fbe4 Mon Sep 17 00:00:00 2001 From: Andrey Volk <andywolk@gmail.com> Date: Fri, 28 Oct 2022 03:15:15 +0300 Subject: [PATCH 655/655] [mod_opus] Fix buf scope in switch_opus_decode(). --- src/mod/codecs/mod_opus/mod_opus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index d24590f37a..04850a672e 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -817,6 +817,7 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec, int fec = 0, plc = 0; int32_t frame_size = 0, last_frame_size = 0; uint32_t frame_samples; + uint8_t buf[SWITCH_RTP_MAX_BUF_LEN]; if (!context) { return SWITCH_STATUS_FALSE; @@ -842,7 +843,6 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec, } if (codec->cur_frame && (jb = switch_core_session_get_jb(session, SWITCH_MEDIA_TYPE_AUDIO))) { switch_frame_t frame = { 0 }; - uint8_t buf[SWITCH_RTP_MAX_BUF_LEN]; uint32_t ts = 0; uint16_t seq = 0;